func_before,vul "int proxy_authentication(zval* this_ptr, smart_str* soap_headers) { zval *login, *password; if ((login = zend_hash_str_find(Z_OBJPROP_P(this_ptr), ""_proxy_login"", sizeof(""_proxy_login"")-1)) != NULL && Z_TYPE_P(login) == IS_STRING) { zend_string *buf; smart_str auth = {0}; smart_str_appendl(&auth, Z_STRVAL_P(login), Z_STRLEN_P(login)); smart_str_appendc(&auth, ':'); if ((password = zend_hash_str_find(Z_OBJPROP_P(this_ptr), ""_proxy_password"", sizeof(""_proxy_password"")-1)) != NULL && Z_TYPE_P(password) == IS_STRING) { smart_str_appendl(&auth, Z_STRVAL_P(password), Z_STRLEN_P(password)); } smart_str_0(&auth); buf = php_base64_encode((unsigned char*)ZSTR_VAL(auth.s), ZSTR_LEN(auth.s)); smart_str_append_const(soap_headers, ""Proxy-Authorization: Basic ""); smart_str_appendl(soap_headers, (char*)ZSTR_VAL(buf), ZSTR_LEN(buf)); smart_str_append_const(soap_headers, ""\r\n""); zend_string_release(buf); smart_str_free(&auth); return 1; } return 0; } ",0 "bool ChunkedUploadDataStream::Writer::AppendData(const char* data, int data_len, bool is_done) { if (!upload_data_stream_) return false; upload_data_stream_->AppendData(data, data_len, is_done); return true; } ",0 "PredictorEncodeRow(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->encodepfunc != NULL); assert(sp->encoderow != NULL); /* XXX horizontal differencing alters user's data XXX */ if( !(*sp->encodepfunc)(tif, bp, cc) ) return 0; return (*sp->encoderow)(tif, bp, cc, s); } ",0 "do_revalidate(struct dentry *dentry, struct nameidata *nd) { int status = dentry->d_op->d_revalidate(dentry, nd); if (unlikely(status <= 0)) { /* * The dentry failed validation. * If d_revalidate returned 0 attempt to invalidate * the dentry otherwise d_revalidate is asking us * to return a fail status. */ if (!status) { if (!d_invalidate(dentry)) { dput(dentry); dentry = NULL; } } else { dput(dentry); dentry = ERR_PTR(status); } } return dentry; } ",0 "gx_dc_pattern2_save_dc( const gx_device_color * pdevc, gx_device_color_saved * psdc ) { gs_pattern2_instance_t * pinst = (gs_pattern2_instance_t *)pdevc->ccolor.pattern; psdc->type = pdevc->type; psdc->colors.pattern2.id = pinst->pattern_id; psdc->colors.pattern2.shfill = pinst->shfill; } ",0 "static void tq_freezethaw(struct thread_q *tq, bool frozen) { mutex_lock(&tq->mutex); tq->frozen = frozen; pthread_cond_signal(&tq->cond); mutex_unlock(&tq->mutex); } ",0 "static int bt_seq_open(struct inode *inode, struct file *file) { struct bt_sock_list *sk_list; struct bt_seq_state *s; sk_list = PDE(inode)->data; s = __seq_open_private(file, &bt_seq_ops, sizeof(struct bt_seq_state)); if (!s) return -ENOMEM; s->l = sk_list; return 0; } ",0 "xfs_da_state_free(xfs_da_state_t *state) { xfs_da_state_kill_altpath(state); #ifdef DEBUG memset((char *)state, 0, sizeof(*state)); #endif /* DEBUG */ kmem_zone_free(xfs_da_state_zone, state); } ",0 "ZEND_API uint zend_get_executed_lineno(void) /* {{{ */ { zend_execute_data *ex = EG(current_execute_data); while (ex && (!ex->func || !ZEND_USER_CODE(ex->func->type))) { ex = ex->prev_execute_data; } if (ex) { if (EG(exception) && ex->opline->opcode == ZEND_HANDLE_EXCEPTION && ex->opline->lineno == 0 && EG(opline_before_exception)) { return EG(opline_before_exception)->lineno; } return ex->opline->lineno; } else { return 0; } } /* }}} */ ",0 "static bool fwnet_pd_is_complete(struct fwnet_partial_datagram *pd) { struct fwnet_fragment_info *fi; fi = list_entry(pd->fi_list.next, struct fwnet_fragment_info, fi_link); return fi->len == pd->datagram_size; } ",0 "UsbChooserContext::UsbChooserContext(Profile* profile) : ChooserContextBase(profile, CONTENT_SETTINGS_TYPE_USB_GUARD, CONTENT_SETTINGS_TYPE_USB_CHOOSER_DATA), is_incognito_(profile->IsOffTheRecord()), client_binding_(this), weak_factory_(this) {} ",1 "ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo( const HeaderInterceptorInfo& other) {} ",0 "static void sctp_generate_t5_shutdown_guard_event(unsigned long data) { struct sctp_association *asoc = (struct sctp_association *)data; sctp_generate_timeout_event(asoc, SCTP_EVENT_TIMEOUT_T5_SHUTDOWN_GUARD); } /* sctp_generate_t5_shutdown_guard_event() */ ",0 "void AddChangePasswordStrings(content::WebUIDataSource* html_source) { #if defined(SAFE_BROWSING_DB_LOCAL) bool show_softer_warning = safe_browsing::PasswordProtectionService::ShouldShowSofterWarning(); auto title_string_id = show_softer_warning ? IDS_SETTINGS_CHANGE_PASSWORD_TITLE_SOFTER : IDS_SETTINGS_CHANGE_PASSWORD_TITLE; LocalizedString localized_strings[] = { {""changePasswordPageTitle"", title_string_id}, {""changePasswordPageDetails"", IDS_SETTINGS_CHANGE_PASSWORD_DETAIL}, {""changePasswordPageButton"", IDS_SETTINGS_CHANGE_PASSWORD_BUTTON}, }; AddLocalizedStringsBulk(html_source, localized_strings, arraysize(localized_strings)); const std::string icon_id = show_softer_warning ? ""settings:security"" : ""cr:warning""; html_source->AddString(""changePasswordPageIcon"", icon_id); #endif } ",0 "void OnDestroy(GtkDialog* dialog, PageInfoWindowGtk* page_info) { delete page_info; } ",0 "static void msix_table_mmio_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { PCIDevice *dev = opaque; int vector = addr / PCI_MSIX_ENTRY_SIZE; bool was_masked; was_masked = msix_is_masked(dev, vector); pci_set_long(dev->msix_table + addr, val); msix_handle_mask_update(dev, vector, was_masked); } ",0 "static int airspy_start_streaming(struct vb2_queue *vq, unsigned int count) { struct airspy *s = vb2_get_drv_priv(vq); int ret; dev_dbg(s->dev, ""\n""); if (!s->udev) return -ENODEV; mutex_lock(&s->v4l2_lock); s->sequence = 0; set_bit(POWER_ON, &s->flags); ret = airspy_alloc_stream_bufs(s); if (ret) goto err_clear_bit; ret = airspy_alloc_urbs(s); if (ret) goto err_free_stream_bufs; ret = airspy_submit_urbs(s); if (ret) goto err_free_urbs; /* start hardware streaming */ ret = airspy_ctrl_msg(s, CMD_RECEIVER_MODE, 1, 0, NULL, 0); if (ret) goto err_kill_urbs; goto exit_mutex_unlock; err_kill_urbs: airspy_kill_urbs(s); err_free_urbs: airspy_free_urbs(s); err_free_stream_bufs: airspy_free_stream_bufs(s); err_clear_bit: clear_bit(POWER_ON, &s->flags); /* return all queued buffers to vb2 */ { struct airspy_frame_buf *buf, *tmp; list_for_each_entry_safe(buf, tmp, &s->queued_bufs, list) { list_del(&buf->list); vb2_buffer_done(&buf->vb.vb2_buf, VB2_BUF_STATE_QUEUED); } } exit_mutex_unlock: mutex_unlock(&s->v4l2_lock); return ret; } ",0 "void AutofillManager::OnFocusOnFormFieldImpl(const FormData& form, const FormFieldData& field, const gfx::RectF& bounding_box) { if (!external_delegate_->HasActiveScreenReader()) return; std::vector suggestions; SuggestionsContext context; GetAvailableSuggestions(form, field, &suggestions, &context); external_delegate_->OnAutofillAvailabilityEvent( context.suppress_reason == SuppressReason::kNotSuppressed && !suggestions.empty()); } ",0 "GLvoid StubGLUniform4iv(GLint location, GLsizei count, const GLint* v) { glUniform4iv(location, count, v); } ",0 "void esds_del(GF_Box *s) { GF_ESDBox *ptr = (GF_ESDBox *)s; if (ptr == NULL) return; if (ptr->desc) gf_odf_desc_del((GF_Descriptor *)ptr->desc); gf_free(ptr); } ",0 "php_stream *php_stream_url_wrap_http(php_stream_wrapper *wrapper, const char *path, const char *mode, int options, char **opened_path, php_stream_context *context STREAMS_DC TSRMLS_DC) /* {{{ */ { return php_stream_url_wrap_http_ex(wrapper, path, mode, options, opened_path, context, PHP_URL_REDIRECT_MAX, HTTP_WRAPPER_HEADER_INIT STREAMS_CC TSRMLS_CC); } /* }}} */ ",0 "void rt_flush_dev(struct net_device *dev) { struct net *net = dev_net(dev); struct rtable *rt; int cpu; for_each_possible_cpu(cpu) { struct uncached_list *ul = &per_cpu(rt_uncached_list, cpu); spin_lock_bh(&ul->lock); list_for_each_entry(rt, &ul->head, rt_uncached) { if (rt->dst.dev != dev) continue; rt->dst.dev = net->loopback_dev; dev_hold(rt->dst.dev); dev_put(dev); } spin_unlock_bh(&ul->lock); } } ",0 "u32 hns_rcb_get_tx_coalesced_frames( struct rcb_common_cb *rcb_common, u32 port_idx) { u64 reg; reg = RCB_CFG_PKTLINE_REG + (port_idx + HNS_RCB_TX_PKTLINE_OFFSET) * 4; return dsaf_read_dev(rcb_common, reg); } ",0 "void WavpackSeekTrailingWrapper (WavpackContext *wpc) { if ((wpc->open_flags & OPEN_WRAPPER) && wpc->reader->can_seek (wpc->wv_in) && !wpc->stream3) seek_eof_information (wpc, NULL, TRUE); } ",0 "bool Browser::ShouldAddNavigationToHistory( const history::HistoryAddPageArgs& add_page_args, NavigationType::Type navigation_type) { return !IsApplication(); } ",0 "int svc_rdma_init(void) { dprintk(""SVCRDMA Module Init, register RPC RDMA transport\n""); dprintk(""\tsvcrdma_ord : %d\n"", svcrdma_ord); dprintk(""\tmax_requests : %u\n"", svcrdma_max_requests); dprintk(""\tsq_depth : %u\n"", svcrdma_max_requests * RPCRDMA_SQ_DEPTH_MULT); dprintk(""\tmax_bc_requests : %u\n"", svcrdma_max_bc_requests); dprintk(""\tmax_inline : %d\n"", svcrdma_max_req_size); svc_rdma_wq = alloc_workqueue(""svc_rdma"", 0, 0); if (!svc_rdma_wq) return -ENOMEM; if (!svcrdma_table_header) svcrdma_table_header = register_sysctl_table(svcrdma_root_table); /* Register RDMA with the SVC transport switch */ svc_reg_xprt_class(&svc_rdma_class); #if defined(CONFIG_SUNRPC_BACKCHANNEL) svc_reg_xprt_class(&svc_rdma_bc_class); #endif return 0; } ",1 "void xrangeCommand(client *c) { xrangeGenericCommand(c,0); } ",0 "void PrintViewManager::OnShowScriptedPrintPreview(content::RenderFrameHost* rfh, bool source_is_modifiable) { DCHECK(print_preview_rfh_); if (rfh != print_preview_rfh_) return; PrintPreviewDialogController* dialog_controller = PrintPreviewDialogController::GetInstance(); if (!dialog_controller) { PrintPreviewDone(); return; } dialog_controller->PrintPreview(web_contents()); PrintHostMsg_RequestPrintPreview_Params params; params.is_modifiable = source_is_modifiable; PrintPreviewUI::SetInitialParams( dialog_controller->GetPrintPreviewForContents(web_contents()), params); } ",0 "void RenderWidgetHostViewAura::Hide() { window_->Hide(); WasHidden(); } ",0 "static int mct_u232_tiocmset(struct tty_struct *tty, unsigned int set, unsigned int clear) { struct usb_serial_port *port = tty->driver_data; struct mct_u232_private *priv = usb_get_serial_port_data(port); unsigned int control_state; unsigned long flags; spin_lock_irqsave(&priv->lock, flags); control_state = priv->control_state; if (set & TIOCM_RTS) control_state |= TIOCM_RTS; if (set & TIOCM_DTR) control_state |= TIOCM_DTR; if (clear & TIOCM_RTS) control_state &= ~TIOCM_RTS; if (clear & TIOCM_DTR) control_state &= ~TIOCM_DTR; priv->control_state = control_state; spin_unlock_irqrestore(&priv->lock, flags); return mct_u232_set_modem_ctrl(port, control_state); } ",0 "static struct socket *sock_alloc(void) { struct inode *inode; struct socket *sock; inode = new_inode_pseudo(sock_mnt->mnt_sb); if (!inode) return NULL; sock = SOCKET_I(inode); kmemcheck_annotate_bitfield(sock, type); inode->i_ino = get_next_ino(); inode->i_mode = S_IFSOCK | S_IRWXUGO; inode->i_uid = current_fsuid(); inode->i_gid = current_fsgid(); inode->i_op = &sockfs_inode_ops; this_cpu_add(sockets_in_use, 1); return sock; } ",0 "WebGLSync* WebGL2RenderingContextBase::fenceSync(GLenum condition, GLbitfield flags) { if (isContextLost()) return nullptr; return WebGLFenceSync::Create(this, condition, flags); } ",0 "horAcc16(TIFF* tif, uint8* cp0, tmsize_t cc) { tmsize_t stride = PredictorState(tif)->stride; uint16* wp = (uint16*) cp0; tmsize_t wc = cc / 2; if((cc%(2*stride))!=0) { TIFFErrorExt(tif->tif_clientdata, ""horAcc16"", ""%s"", ""cc%(2*stride))!=0""); return 0; } if (wc > stride) { wc -= stride; do { REPEAT4(stride, wp[stride] = (uint16)(((unsigned int)wp[stride] + (unsigned int)wp[0]) & 0xffff); wp++) wc -= stride; } while (wc > 0); } return 1; } ",0 "gsicc_get_profile_handle_clist(cmm_profile_t *picc_profile, gs_memory_t *memory) { gcmmhprofile_t profile_handle = NULL; unsigned int profile_size; int size; gx_device_clist_reader *pcrdev = (gx_device_clist_reader*) picc_profile->dev; unsigned char *buffer_ptr; int64_t position; gsicc_serialized_profile_t profile_header; int k; if( pcrdev != NULL) { /* Check ICC table for hash code and get the whole size icc raw buffer plus serialized header information */ position = gsicc_search_icc_table(pcrdev->icc_table, picc_profile->hashcode, &size); if ( position < 0 ) return 0; /* Not found. */ /* Get the ICC buffer. We really want to avoid this transfer. I need to write an interface to the CMM to do this through the clist ioprocs */ /* Allocate the buffer */ profile_size = size - GSICC_SERIALIZED_SIZE; /* Profile and its members are ALL in non-gc memory */ buffer_ptr = gs_alloc_bytes(memory->non_gc_memory, profile_size, ""gsicc_get_profile_handle_clist""); if (buffer_ptr == NULL) return 0; picc_profile->buffer = buffer_ptr; clist_read_chunk(pcrdev, position + GSICC_SERIALIZED_SIZE, profile_size, (unsigned char *) buffer_ptr); profile_handle = gscms_get_profile_handle_mem(memory->non_gc_memory, buffer_ptr, profile_size); /* We also need to get some of the serialized information */ clist_read_chunk(pcrdev, position, GSICC_SERIALIZED_SIZE, (unsigned char *) (&profile_header)); picc_profile->buffer_size = profile_header.buffer_size; picc_profile->data_cs = profile_header.data_cs; picc_profile->default_match = profile_header.default_match; picc_profile->hash_is_valid = profile_header.hash_is_valid; picc_profile->hashcode = profile_header.hashcode; picc_profile->islab = profile_header.islab; picc_profile->num_comps = profile_header.num_comps; picc_profile->rend_is_valid = profile_header.rend_is_valid; picc_profile->rend_cond = profile_header.rend_cond; picc_profile->isdevlink = profile_header.isdevlink; for ( k = 0; k < profile_header.num_comps; k++ ) { picc_profile->Range.ranges[k].rmax = profile_header.Range.ranges[k].rmax; picc_profile->Range.ranges[k].rmin = profile_header.Range.ranges[k].rmin; } return profile_handle; } return 0; } ",0 "MagickExport MagickBooleanType AnnotateImage(Image *image, const DrawInfo *draw_info,ExceptionInfo *exception) { char *p, primitive[MagickPathExtent], *text, **textlist; DrawInfo *annotate, *annotate_info; GeometryInfo geometry_info; MagickBooleanType status; PointInfo offset; RectangleInfo geometry; register ssize_t i; TypeMetric metrics; size_t height, number_lines; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(draw_info != (DrawInfo *) NULL); assert(draw_info->signature == MagickCoreSignature); if (draw_info->text == (char *) NULL) return(MagickFalse); if (*draw_info->text == '\0') return(MagickTrue); annotate=CloneDrawInfo((ImageInfo *) NULL,draw_info); text=annotate->text; annotate->text=(char *) NULL; annotate_info=CloneDrawInfo((ImageInfo *) NULL,draw_info); number_lines=1; for (p=text; *p != '\0'; p++) if (*p == '\n') number_lines++; textlist=AcquireQuantumMemory(number_lines+1,sizeof(*textlist)); if (textlist == (char **) NULL) return(MagickFalse); p=text; for (i=0; i < number_lines; i++) { char *q; textlist[i]=p; for (q=p; *q != '\0'; q++) if ((*q == '\r') || (*q == '\n')) break; if (*q == '\r') { *q='\0'; q++; } *q='\0'; p=q+1; } textlist[i]=(char *) NULL; SetGeometry(image,&geometry); SetGeometryInfo(&geometry_info); if (annotate_info->geometry != (char *) NULL) { (void) ParsePageGeometry(image,annotate_info->geometry,&geometry, exception); (void) ParseGeometry(annotate_info->geometry,&geometry_info); } if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse) return(MagickFalse); if (IsGrayColorspace(image->colorspace) != MagickFalse) (void) SetImageColorspace(image,sRGBColorspace,exception); status=MagickTrue; (void) memset(&metrics,0,sizeof(metrics)); for (i=0; textlist[i] != (char *) NULL; i++) { if (*textlist[i] == '\0') continue; /* Position text relative to image. */ annotate_info->affine.tx=geometry_info.xi-image->page.x; annotate_info->affine.ty=geometry_info.psi-image->page.y; (void) CloneString(&annotate->text,textlist[i]); if ((metrics.width == 0) || (annotate->gravity != NorthWestGravity)) (void) GetTypeMetrics(image,annotate,&metrics,exception); height=(ssize_t) (metrics.ascent-metrics.descent+ draw_info->interline_spacing+0.5); switch (annotate->gravity) { case UndefinedGravity: default: { offset.x=annotate_info->affine.tx+i*annotate_info->affine.ry*height; offset.y=annotate_info->affine.ty+i*annotate_info->affine.sy*height; break; } case NorthWestGravity: { offset.x=(geometry.width == 0 ? -1.0 : 1.0)*annotate_info->affine.tx+i* annotate_info->affine.ry*height+annotate_info->affine.ry* (metrics.ascent+metrics.descent); offset.y=(geometry.height == 0 ? -1.0 : 1.0)*annotate_info->affine.ty+i* annotate_info->affine.sy*height+annotate_info->affine.sy* metrics.ascent; break; } case NorthGravity: { offset.x=(geometry.width == 0 ? -1.0 : 1.0)*annotate_info->affine.tx+ geometry.width/2.0+i*annotate_info->affine.ry*height- annotate_info->affine.sx*metrics.width/2.0+annotate_info->affine.ry* (metrics.ascent+metrics.descent); offset.y=(geometry.height == 0 ? -1.0 : 1.0)*annotate_info->affine.ty+i* annotate_info->affine.sy*height+annotate_info->affine.sy* metrics.ascent-annotate_info->affine.rx*metrics.width/2.0; break; } case NorthEastGravity: { offset.x=(geometry.width == 0 ? 1.0 : -1.0)*annotate_info->affine.tx+ geometry.width+i*annotate_info->affine.ry*height- annotate_info->affine.sx*metrics.width+annotate_info->affine.ry* (metrics.ascent+metrics.descent)-1.0; offset.y=(geometry.height == 0 ? -1.0 : 1.0)*annotate_info->affine.ty+i* annotate_info->affine.sy*height+annotate_info->affine.sy* metrics.ascent-annotate_info->affine.rx*metrics.width; break; } case WestGravity: { offset.x=(geometry.width == 0 ? -1.0 : 1.0)*annotate_info->affine.tx+i* annotate_info->affine.ry*height+annotate_info->affine.ry* (metrics.ascent+metrics.descent-(number_lines-1.0)*height)/2.0; offset.y=(geometry.height == 0 ? -1.0 : 1.0)*annotate_info->affine.ty+ geometry.height/2.0+i*annotate_info->affine.sy*height+ annotate_info->affine.sy*(metrics.ascent+metrics.descent- (number_lines-1.0)*height)/2.0; break; } case CenterGravity: { offset.x=(geometry.width == 0 ? -1.0 : 1.0)*annotate_info->affine.tx+ geometry.width/2.0+i*annotate_info->affine.ry*height- annotate_info->affine.sx*metrics.width/2.0+annotate_info->affine.ry* (metrics.ascent+metrics.descent-(number_lines-1.0)*height)/2.0; offset.y=(geometry.height == 0 ? -1.0 : 1.0)*annotate_info->affine.ty+ geometry.height/2.0+i*annotate_info->affine.sy*height- annotate_info->affine.rx*metrics.width/2.0+annotate_info->affine.sy* (metrics.ascent+metrics.descent-(number_lines-1.0)*height)/2.0; break; } case EastGravity: { offset.x=(geometry.width == 0 ? 1.0 : -1.0)*annotate_info->affine.tx+ geometry.width+i*annotate_info->affine.ry*height- annotate_info->affine.sx*metrics.width+ annotate_info->affine.ry*(metrics.ascent+metrics.descent- (number_lines-1.0)*height)/2.0-1.0; offset.y=(geometry.height == 0 ? -1.0 : 1.0)*annotate_info->affine.ty+ geometry.height/2.0+i*annotate_info->affine.sy*height- annotate_info->affine.rx*metrics.width+ annotate_info->affine.sy*(metrics.ascent+metrics.descent- (number_lines-1.0)*height)/2.0; break; } case SouthWestGravity: { offset.x=(geometry.width == 0 ? -1.0 : 1.0)*annotate_info->affine.tx+i* annotate_info->affine.ry*height-annotate_info->affine.ry* (number_lines-1.0)*height; offset.y=(geometry.height == 0 ? 1.0 : -1.0)*annotate_info->affine.ty+ geometry.height+i*annotate_info->affine.sy*height- annotate_info->affine.sy*(number_lines-1.0)*height+metrics.descent; break; } case SouthGravity: { offset.x=(geometry.width == 0 ? -1.0 : 1.0)*annotate_info->affine.tx+ geometry.width/2.0+i*annotate_info->affine.ry*height- annotate_info->affine.sx*metrics.width/2.0- annotate_info->affine.ry*(number_lines-1.0)*height/2.0; offset.y=(geometry.height == 0 ? 1.0 : -1.0)*annotate_info->affine.ty+ geometry.height+i*annotate_info->affine.sy*height- annotate_info->affine.rx*metrics.width/2.0- annotate_info->affine.sy*(number_lines-1.0)*height+metrics.descent; break; } case SouthEastGravity: { offset.x=(geometry.width == 0 ? 1.0 : -1.0)*annotate_info->affine.tx+ geometry.width+i*annotate_info->affine.ry*height- annotate_info->affine.sx*metrics.width- annotate_info->affine.ry*(number_lines-1.0)*height-1.0; offset.y=(geometry.height == 0 ? 1.0 : -1.0)*annotate_info->affine.ty+ geometry.height+i*annotate_info->affine.sy*height- annotate_info->affine.rx*metrics.width- annotate_info->affine.sy*(number_lines-1.0)*height+metrics.descent; break; } } switch (annotate->align) { case LeftAlign: { offset.x=annotate_info->affine.tx+i*annotate_info->affine.ry*height; offset.y=annotate_info->affine.ty+i*annotate_info->affine.sy*height; break; } case CenterAlign: { offset.x=annotate_info->affine.tx+i*annotate_info->affine.ry*height- annotate_info->affine.sx*metrics.width/2.0; offset.y=annotate_info->affine.ty+i*annotate_info->affine.sy*height- annotate_info->affine.rx*metrics.width/2.0; break; } case RightAlign: { offset.x=annotate_info->affine.tx+i*annotate_info->affine.ry*height- annotate_info->affine.sx*metrics.width; offset.y=annotate_info->affine.ty+i*annotate_info->affine.sy*height- annotate_info->affine.rx*metrics.width; break; } default: break; } if (draw_info->undercolor.alpha != TransparentAlpha) { DrawInfo *undercolor_info; /* Text box. */ undercolor_info=CloneDrawInfo((ImageInfo *) NULL,(DrawInfo *) NULL); undercolor_info->fill=draw_info->undercolor; undercolor_info->affine=draw_info->affine; undercolor_info->affine.tx=offset.x-draw_info->affine.ry*metrics.ascent; undercolor_info->affine.ty=offset.y-draw_info->affine.sy*metrics.ascent; (void) FormatLocaleString(primitive,MagickPathExtent, ""rectangle 0.0,0.0 %g,%g"",metrics.origin.x,(double) height); (void) CloneString(&undercolor_info->primitive,primitive); (void) DrawImage(image,undercolor_info,exception); (void) DestroyDrawInfo(undercolor_info); } annotate_info->affine.tx=offset.x; annotate_info->affine.ty=offset.y; (void) FormatLocaleString(primitive,MagickPathExtent,""stroke-width %g "" ""line 0,0 %g,0"",metrics.underline_thickness,metrics.width); if (annotate->decorate == OverlineDecoration) { annotate_info->affine.ty-=(draw_info->affine.sy*(metrics.ascent+ metrics.descent-metrics.underline_position)); (void) CloneString(&annotate_info->primitive,primitive); (void) DrawImage(image,annotate_info,exception); } else if (annotate->decorate == UnderlineDecoration) { annotate_info->affine.ty-=(draw_info->affine.sy* metrics.underline_position); (void) CloneString(&annotate_info->primitive,primitive); (void) DrawImage(image,annotate_info,exception); } /* Annotate image with text. */ status=RenderType(image,annotate,&offset,&metrics,exception); if (status == MagickFalse) break; if (annotate->decorate == LineThroughDecoration) { annotate_info->affine.ty-=(draw_info->affine.sy*(height+ metrics.underline_position+metrics.descent)/2.0); (void) CloneString(&annotate_info->primitive,primitive); (void) DrawImage(image,annotate_info,exception); } } /* Relinquish resources. */ annotate_info=DestroyDrawInfo(annotate_info); annotate=DestroyDrawInfo(annotate); textlist=(char **) RelinquishMagickMemory(textlist); return(status); } ",1 "static void __hsr_set_operstate(struct net_device *dev, int transition) { write_lock_bh(&dev_base_lock); if (dev->operstate != transition) { dev->operstate = transition; write_unlock_bh(&dev_base_lock); netdev_state_change(dev); } else { write_unlock_bh(&dev_base_lock); } } ",0 "void JSArray::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames, EnumerationMode mode) { ArrayStorage* storage = m_storage; unsigned usedVectorLength = min(storage->m_length, m_vectorLength); for (unsigned i = 0; i < usedVectorLength; ++i) { if (storage->m_vector[i]) propertyNames.add(Identifier::from(exec, i)); } if (SparseArrayValueMap* map = storage->m_sparseValueMap) { SparseArrayValueMap::iterator end = map->end(); for (SparseArrayValueMap::iterator it = map->begin(); it != end; ++it) propertyNames.add(Identifier::from(exec, it->first)); } if (mode == IncludeDontEnumProperties) propertyNames.add(exec->propertyNames().length); JSObject::getOwnPropertyNames(exec, propertyNames, mode); } ",0 "static void __exit crypto_cmac_module_exit(void) { crypto_unregister_template(&crypto_cmac_tmpl); } ",0 "pp::Buffer_Dev PDFiumEngine::PrintPagesAsRasterPDF( const PP_PrintPageNumberRange_Dev* page_ranges, uint32_t page_range_count, const PP_PrintSettings_Dev& print_settings) { if (!page_range_count) return pp::Buffer_Dev(); if (doc_ && !doc_loader_->IsDocumentComplete()) return pp::Buffer_Dev(); FPDF_DOCUMENT output_doc = FPDF_CreateNewDocument(); if (!output_doc) return pp::Buffer_Dev(); KillFormFocus(); std::vector pages_to_print; std::vector> source_page_sizes; std::vector page_numbers = GetPageNumbersFromPrintPageNumberRange(page_ranges, page_range_count); for (uint32_t page_number : page_numbers) { FPDF_PAGE pdf_page = FPDF_LoadPage(doc_, page_number); double source_page_width = FPDF_GetPageWidth(pdf_page); double source_page_height = FPDF_GetPageHeight(pdf_page); source_page_sizes.push_back( std::make_pair(source_page_width, source_page_height)); int width_in_pixels = ConvertUnit(source_page_width, kPointsPerInch, print_settings.dpi); int height_in_pixels = ConvertUnit(source_page_height, kPointsPerInch, print_settings.dpi); pp::Rect rect(width_in_pixels, height_in_pixels); pages_to_print.push_back(PDFiumPage(this, page_number, rect, true)); FPDF_ClosePage(pdf_page); } #if defined(OS_LINUX) g_last_instance_id = client_->GetPluginInstance()->pp_instance(); #endif size_t i = 0; for (; i < pages_to_print.size(); ++i) { double source_page_width = source_page_sizes[i].first; double source_page_height = source_page_sizes[i].second; FPDF_DOCUMENT temp_doc = CreateSinglePageRasterPdf(source_page_width, source_page_height, print_settings, &pages_to_print[i]); if (!temp_doc) break; pp::Buffer_Dev buffer = GetFlattenedPrintData(temp_doc); FPDF_CloseDocument(temp_doc); PDFiumMemBufferFileRead file_read(buffer.data(), buffer.size()); temp_doc = FPDF_LoadCustomDocument(&file_read, nullptr); FPDF_BOOL imported = FPDF_ImportPages(output_doc, temp_doc, ""1"", i); FPDF_CloseDocument(temp_doc); if (!imported) break; } pp::Buffer_Dev buffer; if (i == pages_to_print.size()) { FPDF_CopyViewerPreferences(output_doc, doc_); FitContentsToPrintableAreaIfRequired(output_doc, print_settings); buffer = GetFlattenedPrintData(output_doc); } FPDF_CloseDocument(output_doc); return buffer; } ",0 "static void perf_iterate_sb_cpu(perf_iterate_f output, void *data) { struct pmu_event_list *pel = this_cpu_ptr(&pmu_sb_events); struct perf_event *event; list_for_each_entry_rcu(event, &pel->list, sb_list) { /* * Skip events that are not fully formed yet; ensure that * if we observe event->ctx, both event and ctx will be * complete enough. See perf_install_in_context(). */ if (!smp_load_acquire(&event->ctx)) continue; if (event->state < PERF_EVENT_STATE_INACTIVE) continue; if (!event_filter_match(event)) continue; output(event, data); } } ",0 "gpu::CommandBuffer::State CommandBufferProxyImpl::WaitForGetOffsetInRange( uint32_t set_get_buffer_count, int32_t start, int32_t end) { CheckLock(); base::AutoLock lock(last_state_lock_); TRACE_EVENT2(""gpu"", ""CommandBufferProxyImpl::WaitForGetOffset"", ""start"", start, ""end"", end); if (last_state_.error != gpu::error::kNoError) { if (gpu_control_client_) gpu_control_client_->OnGpuControlLostContextMaybeReentrant(); return last_state_; } TryUpdateState(); if (((set_get_buffer_count != last_state_.set_get_buffer_count) || !InRange(start, end, last_state_.get_offset)) && last_state_.error == gpu::error::kNoError) { gpu::CommandBuffer::State state; if (Send(new GpuCommandBufferMsg_WaitForGetOffsetInRange( route_id_, set_get_buffer_count, start, end, &state))) SetStateFromMessageReply(state); } if (((set_get_buffer_count != last_state_.set_get_buffer_count) || !InRange(start, end, last_state_.get_offset)) && last_state_.error == gpu::error::kNoError) { LOG(ERROR) << ""GPU state invalid after WaitForGetOffsetInRange.""; OnGpuSyncReplyError(); } return last_state_; } ",0 "void ExpandableContainerView::UpdateArrowToggle(bool expanded) { gfx::ImageSkia icon = gfx::CreateVectorIcon( expanded ? gfx::VectorIconId::FIND_PREV : gfx::VectorIconId::FIND_NEXT, 16, gfx::kChromeIconGrey); arrow_toggle_->SetImage(views::Button::STATE_NORMAL, &icon); } ",0 "void CheckClientDownloadRequest::MaybeStorePingsForDownload( DownloadCheckResult result, bool upload_requested, const std::string& request_data, const std::string& response_body) { DownloadFeedbackService::MaybeStorePingsForDownload( result, upload_requested, item_, request_data, response_body); } ",0 "static int check_svme(struct x86_emulate_ctxt *ctxt) { u64 efer; ctxt->ops->get_msr(ctxt, MSR_EFER, &efer); if (!(efer & EFER_SVME)) return emulate_ud(ctxt); return X86EMUL_CONTINUE; } ",0 "static js_Ast *funstm(js_State *J) { js_Ast *a, *b, *c; a = identifier(J); jsP_expect(J, '('); b = parameters(J); jsP_expect(J, ')'); c = funbody(J); /* rewrite function statement as ""var X = function X() {}"" */ return STM1(VAR, LIST(EXP2(VAR, a, EXP3(FUN, a, b, c)))); } ",0 "static bool fuse_block_alloc(struct fuse_conn *fc, bool for_background) { return !fc->initialized || (for_background && fc->blocked); } ",0 "static inline unsigned long kvm_read_tr_base(void) { u16 tr; asm(""str %0"" : ""=g""(tr)); return segment_base(tr); } ",0 "message_send_groupchat(const char *const roomjid, const char *const msg, const char *const oob_url) { xmpp_ctx_t * const ctx = connection_get_ctx(); char *id = create_unique_id(""muc""); xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_GROUPCHAT, roomjid, id); xmpp_message_set_body(message, msg); free(id); if (oob_url) { stanza_attach_x_oob_url(ctx, message, oob_url); } _send_message_stanza(message); xmpp_stanza_release(message); } ",0 "static int rndis_set_response(USBNetState *s, rndis_set_msg_type *buf, unsigned int length) { rndis_set_cmplt_type *resp = rndis_queue_response(s, sizeof(rndis_set_cmplt_type)); uint32_t bufoffs, buflen; int ret; if (!resp) return USB_RET_STALL; bufoffs = le32_to_cpu(buf->InformationBufferOffset) + 8; buflen = le32_to_cpu(buf->InformationBufferLength); if (bufoffs + buflen > length) return USB_RET_STALL; ret = ndis_set(s, le32_to_cpu(buf->OID), bufoffs + (uint8_t *) buf, buflen); resp->MessageType = cpu_to_le32(RNDIS_SET_CMPLT); resp->RequestID = buf->RequestID; /* Still LE in msg buffer */ resp->MessageLength = cpu_to_le32(sizeof(rndis_set_cmplt_type)); if (ret < 0) { /* OID not supported */ resp->Status = cpu_to_le32(RNDIS_STATUS_NOT_SUPPORTED); return 0; } resp->Status = cpu_to_le32(RNDIS_STATUS_SUCCESS); return 0; } ",0 "static int mpage_map_and_submit_extent(handle_t *handle, struct mpage_da_data *mpd, bool *give_up_on_write) { struct inode *inode = mpd->inode; struct ext4_map_blocks *map = &mpd->map; int err; loff_t disksize; int progress = 0; mpd->io_submit.io_end->offset = ((loff_t)map->m_lblk) << inode->i_blkbits; do { err = mpage_map_one_extent(handle, mpd); if (err < 0) { struct super_block *sb = inode->i_sb; if (EXT4_SB(sb)->s_mount_flags & EXT4_MF_FS_ABORTED) goto invalidate_dirty_pages; /* * Let the uper layers retry transient errors. * In the case of ENOSPC, if ext4_count_free_blocks() * is non-zero, a commit should free up blocks. */ if ((err == -ENOMEM) || (err == -ENOSPC && ext4_count_free_clusters(sb))) { if (progress) goto update_disksize; return err; } ext4_msg(sb, KERN_CRIT, ""Delayed block allocation failed for "" ""inode %lu at logical offset %llu with"" "" max blocks %u with error %d"", inode->i_ino, (unsigned long long)map->m_lblk, (unsigned)map->m_len, -err); ext4_msg(sb, KERN_CRIT, ""This should not happen!! Data will "" ""be lost\n""); if (err == -ENOSPC) ext4_print_free_blocks(inode); invalidate_dirty_pages: *give_up_on_write = true; return err; } progress = 1; /* * Update buffer state, submit mapped pages, and get us new * extent to map */ err = mpage_map_and_submit_buffers(mpd); if (err < 0) goto update_disksize; } while (map->m_len); update_disksize: /* * Update on-disk size after IO is submitted. Races with * truncate are avoided by checking i_size under i_data_sem. */ disksize = ((loff_t)mpd->first_page) << PAGE_SHIFT; if (disksize > EXT4_I(inode)->i_disksize) { int err2; loff_t i_size; down_write(&EXT4_I(inode)->i_data_sem); i_size = i_size_read(inode); if (disksize > i_size) disksize = i_size; if (disksize > EXT4_I(inode)->i_disksize) EXT4_I(inode)->i_disksize = disksize; err2 = ext4_mark_inode_dirty(handle, inode); up_write(&EXT4_I(inode)->i_data_sem); if (err2) ext4_error(inode->i_sb, ""Failed to mark inode %lu dirty"", inode->i_ino); if (!err) err = err2; } return err; } ",0 "static int verify_command_mask(struct ib_device *ib_dev, __u32 command) { u64 mask; if (command <= IB_USER_VERBS_CMD_OPEN_QP) mask = ib_dev->uverbs_cmd_mask; else mask = ib_dev->uverbs_ex_cmd_mask; if (mask & ((u64)1 << command)) return 0; return -1; } ",0 "bool V8ValueConverter::Strategy::FromV8Undefined(base::Value** out) const { return false; } ",0 "crypto_load_certs(krb5_context context, pkinit_plg_crypto_context plg_cryptoctx, pkinit_req_crypto_context req_cryptoctx, pkinit_identity_opts *idopts, pkinit_identity_crypto_context id_cryptoctx, krb5_principal princ) { krb5_error_code retval; switch(idopts->idtype) { case IDTYPE_FILE: retval = pkinit_get_certs_fs(context, plg_cryptoctx, req_cryptoctx, idopts, id_cryptoctx, princ); break; case IDTYPE_DIR: retval = pkinit_get_certs_dir(context, plg_cryptoctx, req_cryptoctx, idopts, id_cryptoctx, princ); break; #ifndef WITHOUT_PKCS11 case IDTYPE_PKCS11: retval = pkinit_get_certs_pkcs11(context, plg_cryptoctx, req_cryptoctx, idopts, id_cryptoctx, princ); break; #endif case IDTYPE_PKCS12: retval = pkinit_get_certs_pkcs12(context, plg_cryptoctx, req_cryptoctx, idopts, id_cryptoctx, princ); break; default: retval = EINVAL; } if (retval) goto cleanup; cleanup: return retval; } ",0 "gsf_infile_tar_dup (GsfInput *src_input, GError **err) { GsfInfileTar *res, *src; unsigned ui; src = GSF_INFILE_TAR (src_input); if (src->err) { if (err) *err = g_error_copy (src->err); return NULL; } res = (GsfInfileTar *)g_object_new (GSF_INFILE_TAR_TYPE, NULL); gsf_infile_tar_set_source (res, src->source); for (ui = 0; ui < src->children->len; ui++) { /* This copies the structure. */ TarChild c = g_array_index (src->children, TarChild, ui); c.name = g_strdup (c.name); if (c.modtime) g_date_time_ref (c.modtime); if (c.dir) g_object_ref (c.dir); g_array_append_val (res->children, c); } return NULL; } ",0 "static int cxusb_bluebird_gpio_rw(struct dvb_usb_device *d, u8 changemask, u8 newval) { u8 o[2], gpio_state; int rc; o[0] = 0xff & ~changemask; /* mask of bits to keep */ o[1] = newval & changemask; /* new values for bits */ rc = cxusb_ctrl_msg(d, CMD_BLUEBIRD_GPIO_RW, o, 2, &gpio_state, 1); if (rc < 0 || (gpio_state & changemask) != (newval & changemask)) deb_info(""bluebird_gpio_write failed.\n""); return rc < 0 ? rc : gpio_state; } ",0 "IntRect WebGL2RenderingContextBase::GetTextureSourceSubRectangle( GLsizei width, GLsizei height) { return IntRect(unpack_skip_pixels_, unpack_skip_rows_, width, height); } ",0 "static THREAD_FUNCTION thread_decoding_proc(void *p_data) { int ithread = ((DECODETHREAD_DATA *)p_data)->ithread; VP8D_COMP *pbi = (VP8D_COMP *)(((DECODETHREAD_DATA *)p_data)->ptr1); MB_ROW_DEC *mbrd = (MB_ROW_DEC *)(((DECODETHREAD_DATA *)p_data)->ptr2); ENTROPY_CONTEXT_PLANES mb_row_left_context; while (1) { if (pbi->b_multithreaded_rd == 0) break; if (sem_wait(&pbi->h_event_start_decoding[ithread]) == 0) { if (pbi->b_multithreaded_rd == 0) break; else { MACROBLOCKD *xd = &mbrd->mbd; xd->left_context = &mb_row_left_context; mt_decode_mb_rows(pbi, xd, ithread+1); } } } return 0 ; } ",0 "bool HeapAllocator::shrinkVectorBacking(void* address, size_t quantizedCurrentSize, size_t quantizedShrunkSize) { return backingShrink(address, quantizedCurrentSize, quantizedShrunkSize); } ",0 "perf_event_set_addr_filter(struct perf_event *event, char *filter_str) { LIST_HEAD(filters); int ret; /* * Since this is called in perf_ioctl() path, we're already holding * ctx::mutex. */ lockdep_assert_held(&event->ctx->mutex); if (WARN_ON_ONCE(event->parent)) return -EINVAL; /* * For now, we only support filtering in per-task events; doing so * for CPU-wide events requires additional context switching trickery, * since same object code will be mapped at different virtual * addresses in different processes. */ if (!event->ctx->task) return -EOPNOTSUPP; ret = perf_event_parse_addr_filter(event, filter_str, &filters); if (ret) return ret; ret = event->pmu->addr_filters_validate(&filters); if (ret) { free_filters_list(&filters); return ret; } /* remove existing filters, if any */ perf_addr_filters_splice(event, &filters); /* install new filters */ perf_event_for_each_child(event, perf_event_addr_filters_apply); return ret; } ",0 "void FrameView::updateLayoutAndStyleIfNeededRecursive() { m_frame->document()->updateRenderTreeIfNeeded(); if (needsLayout()) layout(); Vector > frameViews; for (Frame* child = m_frame->tree().firstChild(); child; child = child->tree().nextSibling()) { if (!child->isLocalFrame()) continue; if (FrameView* view = toLocalFrame(child)->view()) frameViews.append(view); } const Vector >::iterator end = frameViews.end(); for (Vector >::iterator it = frameViews.begin(); it != end; ++it) (*it)->updateLayoutAndStyleIfNeededRecursive(); if (m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()) { m_frame->document()->updateRenderTreeIfNeeded(); if (needsLayout()) layout(); } ASSERT(!needsLayout()); ASSERT(!m_frame->document()->hasSVGFilterElementsRequiringLayerUpdate()); #if ENABLE(ASSERT) m_frame->document()->renderView()->assertRendererLaidOut(); #endif } ",0 "static void activityLoggedAttrGetter2AttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""activityLoggedAttrGetter2"", ""TestObject"", info.Holder(), info.GetIsolate()); TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState); imp->setActivityLoggedAttrGetter2(cppValue); } ",0 "static void release_node_locked(struct node* node) { TRACE(""RELEASE %p (%s) rc=%d\n"", node, node->name, node->refcount); if (node->refcount > 0) { node->refcount--; if (!node->refcount) { TRACE(""DESTROY %p (%s)\n"", node, node->name); remove_node_from_parent_locked(node); /* TODO: remove debugging - poison memory */ memset(node->name, 0xef, node->namelen); free(node->name); free(node->actual_name); memset(node, 0xfc, sizeof(*node)); free(node); } } else { ERROR(""Zero refcnt %p\n"", node); } } ",0 "WebContents* TabStripModel::GetActiveWebContents() const { return GetWebContentsAt(active_index()); } ",0 "WebLayer* DrawingBuffer::PlatformLayer() { if (!layer_) { layer_ = Platform::Current()->CompositorSupport()->CreateExternalTextureLayer( this); layer_->SetOpaque(!want_alpha_channel_); layer_->SetBlendBackgroundColor(want_alpha_channel_); layer_->SetPremultipliedAlpha(premultiplied_alpha_); layer_->SetNearestNeighbor(filter_quality_ == kNone_SkFilterQuality); GraphicsLayer::RegisterContentsLayer(layer_->Layer()); } return layer_->Layer(); } ",0 "void DevToolsUIBindings::LoadCompleted() { FrontendLoaded(); } ",0 "void red_channel_push_set_ack(RedChannel *channel) { red_channel_pipes_add_type(channel, PIPE_ITEM_TYPE_SET_ACK); } ",0 "bool DevToolsEventForwarder::ForwardEvent( const content::NativeWebKeyboardEvent& event) { std::string event_type; switch (event.GetType()) { case WebInputEvent::kKeyDown: case WebInputEvent::kRawKeyDown: event_type = kKeyDownEventName; break; case WebInputEvent::kKeyUp: event_type = kKeyUpEventName; break; default: return false; } int key_code = ui::LocatedToNonLocatedKeyboardCode( static_cast(event.windows_key_code)); int modifiers = event.GetModifiers() & (WebInputEvent::kShiftKey | WebInputEvent::kControlKey | WebInputEvent::kAltKey | WebInputEvent::kMetaKey); int key = CombineKeyCodeAndModifiers(key_code, modifiers); if (whitelisted_keys_.find(key) == whitelisted_keys_.end()) return false; base::DictionaryValue event_data; event_data.SetString(""type"", event_type); event_data.SetString(""key"", ui::KeycodeConverter::DomKeyToKeyString( static_cast(event.dom_key))); event_data.SetString(""code"", ui::KeycodeConverter::DomCodeToCodeString( static_cast(event.dom_code))); event_data.SetInteger(""keyCode"", key_code); event_data.SetInteger(""modifiers"", modifiers); devtools_window_->bindings_->CallClientFunction( ""DevToolsAPI.keyEventUnhandled"", &event_data, NULL, NULL); return true; } ",0 "static ssize_t ext4_attr_show(struct kobject *kobj, struct attribute *attr, char *buf) { struct ext4_sb_info *sbi = container_of(kobj, struct ext4_sb_info, s_kobj); struct ext4_attr *a = container_of(attr, struct ext4_attr, attr); return a->show ? a->show(a, sbi, buf) : 0; } ",0 "void NaClProcessHost::OnSetKnownToValidate(const std::string& signature) { NaClBrowser::GetInstance()->SetKnownToValidate(signature, off_the_record_); } ",0 "asn1_encode_sequence_of_keys(krb5_key_data *key_data, krb5_int16 n_key_data, krb5_int32 mkvno, krb5_data **code) { krb5_error_code err; ldap_seqof_key_data val; /* * This should be pushed back into other library initialization * code. */ err = kldap_ensure_initialized (); if (err) return err; val.key_data = key_data; val.n_key_data = n_key_data; val.mkvno = mkvno; val.kvno = key_data[0].key_data_kvno; return accessor.asn1_ldap_encode_sequence_of_keys(&val, code); } ",0 "int m_authenticate(struct Client* cptr, struct Client* sptr, int parc, char* parv[]) { struct Client* acptr; int first = 0; char realhost[HOSTLEN + 3]; char *hoststr = (cli_sockhost(cptr) ? cli_sockhost(cptr) : cli_sock_ip(cptr)); if (!CapActive(cptr, CAP_SASL)) return 0; if (parc < 2) /* have enough parameters? */ return need_more_params(cptr, ""AUTHENTICATE""); if (strlen(parv[1]) > 400) return send_reply(cptr, ERR_SASLTOOLONG); if (IsSASLComplete(cptr)) return send_reply(cptr, ERR_SASLALREADY); /* Look up the target server */ if (!(acptr = cli_saslagent(cptr))) { if (strcmp(feature_str(FEAT_SASL_SERVER), ""*"")) acptr = find_match_server((char *)feature_str(FEAT_SASL_SERVER)); else acptr = NULL; } if (!acptr && strcmp(feature_str(FEAT_SASL_SERVER), ""*"")) return send_reply(cptr, ERR_SASLFAIL, "": service unavailable""); /* If it's to us, do nothing; otherwise, forward the query */ if (acptr && IsMe(acptr)) return 0; /* Generate an SASL session cookie if not already generated */ if (!cli_saslcookie(cptr)) { do { cli_saslcookie(cptr) = ircrandom() & 0x7fffffff; } while (!cli_saslcookie(cptr)); first = 1; } if (strchr(hoststr, ':') != NULL) ircd_snprintf(0, realhost, sizeof(realhost), ""[%s]"", hoststr); else ircd_strncpy(realhost, hoststr, sizeof(realhost)); if (acptr) { if (first) { if (!EmptyString(cli_sslclifp(cptr))) sendcmdto_one(&me, CMD_SASL, acptr, ""%C %C!%u.%u S %s :%s"", acptr, &me, cli_fd(cptr), cli_saslcookie(cptr), parv[1], cli_sslclifp(cptr)); else sendcmdto_one(&me, CMD_SASL, acptr, ""%C %C!%u.%u S :%s"", acptr, &me, cli_fd(cptr), cli_saslcookie(cptr), parv[1]); if (feature_bool(FEAT_SASL_SENDHOST)) sendcmdto_one(&me, CMD_SASL, acptr, ""%C %C!%u.%u H :%s@%s:%s"", acptr, &me, cli_fd(cptr), cli_saslcookie(cptr), cli_username(cptr), realhost, cli_sock_ip(cptr)); } else { sendcmdto_one(&me, CMD_SASL, acptr, ""%C %C!%u.%u C :%s"", acptr, &me, cli_fd(cptr), cli_saslcookie(cptr), parv[1]); } } else { if (first) { if (!EmptyString(cli_sslclifp(cptr))) sendcmdto_serv_butone(&me, CMD_SASL, cptr, ""* %C!%u.%u S %s :%s"", &me, cli_fd(cptr), cli_saslcookie(cptr), parv[1], cli_sslclifp(cptr)); else sendcmdto_serv_butone(&me, CMD_SASL, cptr, ""* %C!%u.%u S :%s"", &me, cli_fd(cptr), cli_saslcookie(cptr), parv[1]); if (feature_bool(FEAT_SASL_SENDHOST)) sendcmdto_serv_butone(&me, CMD_SASL, cptr, ""* %C!%u.%u H :%s@%s:%s"", &me, cli_fd(cptr), cli_saslcookie(cptr), cli_username(cptr), realhost, cli_sock_ip(cptr)); } else { sendcmdto_serv_butone(&me, CMD_SASL, cptr, ""* %C!%u.%u C :%s"", &me, cli_fd(cptr), cli_saslcookie(cptr), parv[1]); } } if (!t_active(&cli_sasltimeout(cptr))) timer_add(timer_init(&cli_sasltimeout(cptr)), sasl_timeout_callback, (void*) cptr, TT_RELATIVE, feature_int(FEAT_SASL_TIMEOUT)); return 0; } ",1 "static void t1_check_unusual_charstring(void) { char *p = strstr(t1_line_array, charstringname) + strlen(charstringname); int i; /* if no number follows ""/CharStrings"", let's read the next line */ if (sscanf(p, ""%i"", &i) != 1) { /* pdftex_warn(""no number found after `%s', I assume it's on the next line"", charstringname); */ strcpy(t1_buf_array, t1_line_array); /* t1_getline always appends EOL to t1_line_array; let's change it to * space before appending the next line */ *(strend(t1_buf_array) - 1) = ' '; t1_getline(); strcat(t1_buf_array, t1_line_array); strcpy(t1_line_array, t1_buf_array); t1_line_ptr = eol(t1_line_array); } } ",1 "evdns_resolv_set_defaults(struct evdns_base *base, int flags) { /* if the file isn't found then we assume a local resolver */ ASSERT_LOCKED(base); if (flags & DNS_OPTION_SEARCH) search_set_from_hostname(base); if (flags & DNS_OPTION_NAMESERVERS) evdns_base_nameserver_ip_add(base,""127.0.0.1""); } ",0 "display_clean_write(struct display *dp) { if (dp->write_pp != NULL) png_destroy_write_struct(&dp->write_pp, NULL); } ",0 "static int rt_acct_proc_show(struct seq_file *m, void *v) { struct ip_rt_acct *dst, *src; unsigned int i, j; dst = kcalloc(256, sizeof(struct ip_rt_acct), GFP_KERNEL); if (!dst) return -ENOMEM; for_each_possible_cpu(i) { src = (struct ip_rt_acct *)per_cpu_ptr(ip_rt_acct, i); for (j = 0; j < 256; j++) { dst[j].o_bytes += src[j].o_bytes; dst[j].o_packets += src[j].o_packets; dst[j].i_bytes += src[j].i_bytes; dst[j].i_packets += src[j].i_packets; } } seq_write(m, dst, 256 * sizeof(struct ip_rt_acct)); kfree(dst); return 0; } ",0 " LRUCanvasResourceProviderCache::GetCanvasResourceProvider( const IntSize& size) { size_t i; for (i = 0; i < resource_providers_.size(); ++i) { CanvasResourceProvider* resource_provider = resource_providers_[i].get(); if (!resource_provider) break; if (resource_provider->Size() != size) continue; BubbleToFront(i); return resource_provider; } std::unique_ptr temp(CanvasResourceProvider::Create( size, CanvasResourceProvider::kSoftwareResourceUsage)); if (!temp) return nullptr; i = std::min(resource_providers_.size() - 1, i); resource_providers_[i] = std::move(temp); CanvasResourceProvider* resource_provider = resource_providers_[i].get(); BubbleToFront(i); return resource_provider; } ",0 "bool IsAccountManagerEnabled() { return base::FeatureList::IsEnabled(kAccountManager); } ",0 "double RegistrationManager::GetJitter() { return 2.0 * base::RandDouble() - 1.0; } ",0 "xfs_buf_hold( xfs_buf_t *bp) { trace_xfs_buf_hold(bp, _RET_IP_); atomic_inc(&bp->b_hold); } ",0 "make_invalid_file(i_ctx_t *i_ctx_p, ref * fp) { make_file(fp, avm_invalid_file_entry, ~0, i_ctx_p->invalid_file_stream); } ",0 "void OutOfProcessInstance::OnGeometryChanged(double old_zoom, float old_device_scale) { if (zoom_ != old_zoom || device_scale_ != old_device_scale) engine_->ZoomUpdated(zoom_ * device_scale_); available_area_ = pp::Rect(plugin_size_); int doc_width = GetDocumentPixelWidth(); if (doc_width < available_area_.width()) { available_area_.Offset((available_area_.width() - doc_width) / 2, 0); available_area_.set_width(doc_width); } int bottom_of_document = GetDocumentPixelHeight() + (top_toolbar_height_ * device_scale_); if (bottom_of_document < available_area_.height()) available_area_.set_height(bottom_of_document); CalculateBackgroundParts(); engine_->PageOffsetUpdated(available_area_.point()); engine_->PluginSizeUpdated(available_area_.size()); if (!document_size_.GetArea()) return; paint_manager_.InvalidateRect(pp::Rect(pp::Point(), plugin_size_)); } ",0 " std::string NavigateAndExtractInnerText(const GURL& url) { return ExtractInnerText(Navigate(url)); } ",0 "static void nfs4_lock_prepare(struct rpc_task *task, void *calldata) { struct nfs4_lockdata *data = calldata; struct nfs4_state *state = data->lsp->ls_state; dprintk(""%s: begin!\n"", __func__); if (nfs_wait_on_sequence(data->arg.lock_seqid, task) != 0) return; /* Do we need to do an open_to_lock_owner? */ if (!(data->arg.lock_seqid->sequence->flags & NFS_SEQID_CONFIRMED)) { if (nfs_wait_on_sequence(data->arg.open_seqid, task) != 0) return; data->arg.open_stateid = &state->stateid; data->arg.new_lock_owner = 1; data->res.open_seqid = data->arg.open_seqid; } else data->arg.new_lock_owner = 0; data->timestamp = jiffies; if (nfs4_setup_sequence(data->server, &data->arg.seq_args, &data->res.seq_res, 1, task)) return; rpc_call_start(task); dprintk(""%s: done!, ret = %d\n"", __func__, data->rpc_status); } ",0 "void InterstitialPageImpl::InterstitialPageRVHDelegateView::GotFocus() { WebContents* web_contents = interstitial_page_->web_contents(); if (web_contents) static_cast(web_contents)->NotifyWebContentsFocused(); } ",0 "smb_ofile_set_quota_resume(smb_ofile_t *ofile, char *resume) { ASSERT(ofile); mutex_enter(&ofile->f_mutex); if (resume == NULL) bzero(ofile->f_quota_resume, SMB_SID_STRSZ); else (void) strlcpy(ofile->f_quota_resume, resume, SMB_SID_STRSZ); mutex_exit(&ofile->f_mutex); } ",0 "setv4key_principal_2_svc(setv4key_arg *arg, struct svc_req *rqstp) { static generic_ret ret; char *prime_arg; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_generic_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) { ret.code = KADM5_BAD_PRINCIPAL; goto exit_func; } if (!(CHANGEPW_SERVICE(rqstp)) && kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_SETKEY, arg->princ, NULL)) { ret.code = kadm5_setv4key_principal((void *)handle, arg->princ, arg->keyblock); } else { log_unauth(""kadm5_setv4key_principal"", prime_arg, &client_name, &service_name, rqstp); ret.code = KADM5_AUTH_SETKEY; } if(ret.code != KADM5_AUTH_SETKEY) { if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done(""kadm5_setv4key_principal"", prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } free(prime_arg); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; } ",1 "std::unique_ptr NetworkHandler::CreateThrottleForNavigation( NavigationHandle* navigation_handle) { if (!interception_handle_) return nullptr; std::unique_ptr throttle(new NetworkNavigationThrottle( weak_factory_.GetWeakPtr(), navigation_handle)); return throttle; } ",0 "WavpackContext *WavpackOpenFileInputEx64 (WavpackStreamReader64 *reader, void *wv_id, void *wvc_id, char *error, int flags, int norm_offset) { WavpackContext *wpc = malloc (sizeof (WavpackContext)); WavpackStream *wps; int num_blocks = 0; unsigned char first_byte; uint32_t bcount; if (!wpc) { if (error) strcpy (error, ""can't allocate memory""); return NULL; } CLEAR (*wpc); wpc->wv_in = wv_id; wpc->wvc_in = wvc_id; wpc->reader = reader; wpc->total_samples = -1; wpc->norm_offset = norm_offset; wpc->max_streams = OLD_MAX_STREAMS; // use this until overwritten with actual number wpc->open_flags = flags; wpc->filelen = wpc->reader->get_length (wpc->wv_in); #ifndef NO_TAGS if ((flags & (OPEN_TAGS | OPEN_EDIT_TAGS)) && wpc->reader->can_seek (wpc->wv_in)) { load_tag (wpc); wpc->reader->set_pos_abs (wpc->wv_in, 0); if ((flags & OPEN_EDIT_TAGS) && !editable_tag (&wpc->m_tag)) { if (error) strcpy (error, ""can't edit tags located at the beginning of files!""); return WavpackCloseFile (wpc); } } #endif if (wpc->reader->read_bytes (wpc->wv_in, &first_byte, 1) != 1) { if (error) strcpy (error, ""can't read all of WavPack file!""); return WavpackCloseFile (wpc); } wpc->reader->push_back_byte (wpc->wv_in, first_byte); if (first_byte == 'R') { #ifdef ENABLE_LEGACY return open_file3 (wpc, error); #else if (error) strcpy (error, ""this legacy WavPack file is deprecated, use version 4.80.0 to transcode""); return WavpackCloseFile (wpc); #endif } wpc->streams = malloc ((wpc->num_streams = 1) * sizeof (wpc->streams [0])); if (!wpc->streams) { if (error) strcpy (error, ""can't allocate memory""); return WavpackCloseFile (wpc); } wpc->streams [0] = wps = malloc (sizeof (WavpackStream)); if (!wps) { if (error) strcpy (error, ""can't allocate memory""); return WavpackCloseFile (wpc); } CLEAR (*wps); while (!wps->wphdr.block_samples) { wpc->filepos = wpc->reader->get_pos (wpc->wv_in); bcount = read_next_header (wpc->reader, wpc->wv_in, &wps->wphdr); if (bcount == (uint32_t) -1 || (!wps->wphdr.block_samples && num_blocks++ > 16)) { if (error) strcpy (error, ""not compatible with this version of WavPack file!""); return WavpackCloseFile (wpc); } wpc->filepos += bcount; wps->blockbuff = malloc (wps->wphdr.ckSize + 8); if (!wps->blockbuff) { if (error) strcpy (error, ""can't allocate memory""); return WavpackCloseFile (wpc); } memcpy (wps->blockbuff, &wps->wphdr, 32); if (wpc->reader->read_bytes (wpc->wv_in, wps->blockbuff + 32, wps->wphdr.ckSize - 24) != wps->wphdr.ckSize - 24) { if (error) strcpy (error, ""can't read all of WavPack file!""); return WavpackCloseFile (wpc); } if (!WavpackVerifySingleBlock (wps->blockbuff, !(flags & OPEN_NO_CHECKSUM))) { wps->wphdr.block_samples = 0; free (wps->blockbuff); wps->blockbuff = NULL; wpc->crc_errors++; continue; } wps->init_done = FALSE; if (wps->wphdr.block_samples) { if (flags & OPEN_STREAMING) SET_BLOCK_INDEX (wps->wphdr, 0); else if (wpc->total_samples == -1) { if (GET_BLOCK_INDEX (wps->wphdr) || GET_TOTAL_SAMPLES (wps->wphdr) == -1) { wpc->initial_index = GET_BLOCK_INDEX (wps->wphdr); SET_BLOCK_INDEX (wps->wphdr, 0); if (wpc->reader->can_seek (wpc->wv_in)) { int64_t final_index = -1; seek_eof_information (wpc, &final_index, FALSE); if (final_index != -1) wpc->total_samples = final_index - wpc->initial_index; } } else wpc->total_samples = GET_TOTAL_SAMPLES (wps->wphdr); } } else if (wpc->total_samples == -1 && !GET_BLOCK_INDEX (wps->wphdr) && GET_TOTAL_SAMPLES (wps->wphdr)) wpc->total_samples = GET_TOTAL_SAMPLES (wps->wphdr); if (wpc->wvc_in && wps->wphdr.block_samples && (wps->wphdr.flags & HYBRID_FLAG)) { unsigned char ch; if (wpc->reader->read_bytes (wpc->wvc_in, &ch, 1) == 1) { wpc->reader->push_back_byte (wpc->wvc_in, ch); wpc->file2len = wpc->reader->get_length (wpc->wvc_in); wpc->wvc_flag = TRUE; } } if (wpc->wvc_flag && !read_wvc_block (wpc)) { if (error) strcpy (error, ""not compatible with this version of correction file!""); return WavpackCloseFile (wpc); } if (!wps->init_done && !unpack_init (wpc)) { if (error) strcpy (error, wpc->error_message [0] ? wpc->error_message : ""not compatible with this version of WavPack file!""); return WavpackCloseFile (wpc); } wps->init_done = TRUE; } wpc->config.flags &= ~0xff; wpc->config.flags |= wps->wphdr.flags & 0xff; if (!wpc->config.num_channels) { wpc->config.num_channels = (wps->wphdr.flags & MONO_FLAG) ? 1 : 2; wpc->config.channel_mask = 0x5 - wpc->config.num_channels; } if ((flags & OPEN_2CH_MAX) && !(wps->wphdr.flags & FINAL_BLOCK)) wpc->reduced_channels = (wps->wphdr.flags & MONO_FLAG) ? 1 : 2; if (wps->wphdr.flags & DSD_FLAG) { #ifdef ENABLE_DSD if (flags & OPEN_DSD_NATIVE) { wpc->config.bytes_per_sample = 1; wpc->config.bits_per_sample = 8; } else if (flags & OPEN_DSD_AS_PCM) { wpc->decimation_context = decimate_dsd_init (wpc->reduced_channels ? wpc->reduced_channels : wpc->config.num_channels); wpc->config.bytes_per_sample = 3; wpc->config.bits_per_sample = 24; } else { if (error) strcpy (error, ""not configured to handle DSD WavPack files!""); return WavpackCloseFile (wpc); } #else if (error) strcpy (error, ""not configured to handle DSD WavPack files!""); return WavpackCloseFile (wpc); #endif } else { wpc->config.bytes_per_sample = (wps->wphdr.flags & BYTES_STORED) + 1; wpc->config.float_norm_exp = wps->float_norm_exp; wpc->config.bits_per_sample = (wpc->config.bytes_per_sample * 8) - ((wps->wphdr.flags & SHIFT_MASK) >> SHIFT_LSB); } if (!wpc->config.sample_rate) { if (!wps->wphdr.block_samples || (wps->wphdr.flags & SRATE_MASK) == SRATE_MASK) wpc->config.sample_rate = 44100; else wpc->config.sample_rate = sample_rates [(wps->wphdr.flags & SRATE_MASK) >> SRATE_LSB]; } return wpc; } ",0 "void Prelin8free(cmsContext ContextID, void* ptr) { _cmsFree(ContextID, ptr); } ",0 "void TabStripModel::TabNavigating(TabContentsWrapper* contents, PageTransition::Type transition) { if (ShouldForgetOpenersForTransition(transition)) { if (!IsNewTabAtEndOfTabStrip(contents)) { ForgetAllOpeners(); ForgetGroup(contents); } } } ",0 "status_t Camera3Device::prepare(int streamId) { return prepare(camera3::Camera3StreamInterface::ALLOCATE_PIPELINE_MAX, streamId); } ",0 "png_read_init(png_structp png_ptr) { /* We only come here via pre-1.0.7-compiled applications */ png_read_init_2(png_ptr, ""1.0.6 or earlier"", 0, 0); } ",0 " void SwitchTabTo(TabContents* contents) { } ",0 "bool WebLocalFrameImpl::UsePrintingLayout() const { return print_context_ ? print_context_->use_printing_layout() : false; } ",0 " void OnShutdownFinished() { DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); host_ = NULL; ResetHost(); context_->ui_task_runner()->PostTask( FROM_HERE, base::Bind(&HostProcess::ShutdownHostProcess, base::Unretained(this))); } ",0 "ProfileDependencyManager* ProfileDependencyManager::GetInstance() { return Singleton::get(); } ",0 "void radeon_save_bios_scratch_regs(struct radeon_device *rdev) { uint32_t scratch_reg; int i; if (rdev->family >= CHIP_R600) scratch_reg = R600_BIOS_0_SCRATCH; else scratch_reg = RADEON_BIOS_0_SCRATCH; for (i = 0; i < RADEON_BIOS_NUM_SCRATCH; i++) rdev->bios_scratch[i] = RREG32(scratch_reg + (i * 4)); } ",0 "int dtls1_dispatch_alert(SSL *s) { int i, j; void (*cb) (const SSL *ssl, int type, int val) = NULL; unsigned char buf[DTLS1_AL_HEADER_LENGTH]; unsigned char *ptr = &buf[0]; s->s3->alert_dispatch = 0; memset(buf, 0x00, sizeof(buf)); *ptr++ = s->s3->send_alert[0]; *ptr++ = s->s3->send_alert[1]; #ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE if (s->s3->send_alert[1] == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE) { s2n(s->d1->handshake_read_seq, ptr); # if 0 if (s->d1->r_msg_hdr.frag_off == 0) /* * waiting for a new msg */ else s2n(s->d1->r_msg_hdr.seq, ptr); /* partial msg read */ # endif # if 0 fprintf(stderr, ""s->d1->handshake_read_seq = %d, s->d1->r_msg_hdr.seq = %d\n"", s->d1->handshake_read_seq, s->d1->r_msg_hdr.seq); # endif l2n3(s->d1->r_msg_hdr.frag_off, ptr); } #endif i = do_dtls1_write(s, SSL3_RT_ALERT, &buf[0], sizeof(buf), 0); if (i <= 0) { s->s3->alert_dispatch = 1; /* fprintf( stderr, ""not done with alert\n"" ); */ } else { if (s->s3->send_alert[0] == SSL3_AL_FATAL #ifdef DTLS1_AD_MISSING_HANDSHAKE_MESSAGE || s->s3->send_alert[1] == DTLS1_AD_MISSING_HANDSHAKE_MESSAGE #endif ) (void)BIO_flush(s->wbio); if (s->msg_callback) s->msg_callback(1, s->version, SSL3_RT_ALERT, s->s3->send_alert, 2, s, s->msg_callback_arg); if (s->info_callback != NULL) cb = s->info_callback; else if (s->ctx->info_callback != NULL) cb = s->ctx->info_callback; if (cb != NULL) { j = (s->s3->send_alert[0] << 8) | s->s3->send_alert[1]; cb(s, SSL_CB_WRITE_ALERT, j); } } return (i); } ",0 "LayoutUnit RenderBox::computeReplacedLogicalHeightRespectingMinMaxHeight(LayoutUnit logicalHeight) const { LayoutUnit minLogicalHeight = computeReplacedLogicalHeightUsing(style()->logicalMinHeight()); LayoutUnit maxLogicalHeight = style()->logicalMaxHeight().isUndefined() ? logicalHeight : computeReplacedLogicalHeightUsing(style()->logicalMaxHeight()); return max(minLogicalHeight, min(logicalHeight, maxLogicalHeight)); } ",0 "unsigned_relts_print(netdissect_options *ndo, uint32_t secs) { static const char *lengths[] = {""y"", ""w"", ""d"", ""h"", ""m"", ""s""}; static const u_int seconds[] = {31536000, 604800, 86400, 3600, 60, 1}; const char **l = lengths; const u_int *s = seconds; if (secs == 0) { ND_PRINT((ndo, ""0s"")); return; } while (secs > 0) { if (secs >= *s) { ND_PRINT((ndo, ""%d%s"", secs / *s, *l)); secs -= (secs / *s) * *s; } s++; l++; } } ",0 "kadm5_purgekeys(void *server_handle, krb5_principal principal, int keepkvno) { kadm5_server_handle_t handle = server_handle; kadm5_ret_t ret; krb5_db_entry *kdb; osa_princ_ent_rec adb; krb5_key_data *old_keydata; int n_old_keydata; int i, j, k; CHECK_HANDLE(server_handle); if (principal == NULL) return EINVAL; ret = kdb_get_entry(handle, principal, &kdb, &adb); if (ret) return(ret); if (keepkvno <= 0) { keepkvno = krb5_db_get_key_data_kvno(handle->context, kdb->n_key_data, kdb->key_data); } old_keydata = kdb->key_data; n_old_keydata = kdb->n_key_data; kdb->n_key_data = 0; kdb->key_data = krb5_db_alloc(handle->context, NULL, n_old_keydata * sizeof(krb5_key_data)); if (kdb->key_data == NULL) { ret = ENOMEM; goto done; } memset(kdb->key_data, 0, n_old_keydata * sizeof(krb5_key_data)); for (i = 0, j = 0; i < n_old_keydata; i++) { if (old_keydata[i].key_data_kvno < keepkvno) continue; /* Alias the key_data_contents pointers; we null them out in the * source array immediately after. */ kdb->key_data[j] = old_keydata[i]; for (k = 0; k < old_keydata[i].key_data_ver; k++) { old_keydata[i].key_data_contents[k] = NULL; } j++; } kdb->n_key_data = j; cleanup_key_data(handle->context, n_old_keydata, old_keydata); kdb->mask = KADM5_KEY_DATA; ret = kdb_put_entry(handle, kdb, &adb); if (ret) goto done; done: kdb_free_entry(handle, kdb, &adb); return ret; } ",0 "bool WebContentsImpl::Send(IPC::Message* message) { if (!GetRenderViewHost()) { delete message; return false; } return GetRenderViewHost()->Send(message); } ",0 "peek_from_buf(char *string, size_t string_len, const buf_t *buf) { chunk_t *chunk; tor_assert(string); /* make sure we don't ask for too much */ tor_assert(string_len <= buf->datalen); /* assert_buf_ok(buf); */ chunk = buf->head; while (string_len) { size_t copy = string_len; tor_assert(chunk); if (chunk->datalen < copy) copy = chunk->datalen; memcpy(string, chunk->data, copy); string_len -= copy; string += copy; chunk = chunk->next; } } ",0 "static int is_handler(const struct dirent *dirent) { if (strncmp(dirent->d_name, ""handler_"", 8)) return 0; return 1; } ",0 "void OfflinePageModelTaskified::MarkPageAccessed(int64_t offline_id) { auto task = base::MakeUnique(store_.get(), offline_id, GetCurrentTime()); task_queue_.AddTask(std::move(task)); } ",0 "static void rndis_clear_responsequeue(USBNetState *s) { struct rndis_response *r; while ((r = s->rndis_resp.tqh_first)) { QTAILQ_REMOVE(&s->rndis_resp, r, entries); g_free(r); } } ",0 "static gpa_t translate_gpa(struct kvm_vcpu *vcpu, gpa_t gpa, u32 access) { return gpa; } ",0 "static int crypt_extent(struct ecryptfs_crypt_stat *crypt_stat, struct page *dst_page, struct page *src_page, unsigned long extent_offset, int op) { pgoff_t page_index = op == ENCRYPT ? src_page->index : dst_page->index; loff_t extent_base; char extent_iv[ECRYPTFS_MAX_IV_BYTES]; struct scatterlist src_sg, dst_sg; size_t extent_size = crypt_stat->extent_size; int rc; extent_base = (((loff_t)page_index) * (PAGE_CACHE_SIZE / extent_size)); rc = ecryptfs_derive_iv(extent_iv, crypt_stat, (extent_base + extent_offset)); if (rc) { ecryptfs_printk(KERN_ERR, ""Error attempting to derive IV for "" ""extent [0x%.16llx]; rc = [%d]\n"", (unsigned long long)(extent_base + extent_offset), rc); goto out; } sg_init_table(&src_sg, 1); sg_init_table(&dst_sg, 1); sg_set_page(&src_sg, src_page, extent_size, extent_offset * extent_size); sg_set_page(&dst_sg, dst_page, extent_size, extent_offset * extent_size); rc = crypt_scatterlist(crypt_stat, &dst_sg, &src_sg, extent_size, extent_iv, op); if (rc < 0) { printk(KERN_ERR ""%s: Error attempting to crypt page with "" ""page_index = [%ld], extent_offset = [%ld]; "" ""rc = [%d]\n"", __func__, page_index, extent_offset, rc); goto out; } rc = 0; out: return rc; } ",0 "npasses_from_interlace_type(png_const_structp pp, int interlace_type) { switch (interlace_type) { default: png_error(pp, ""invalid interlace type""); case PNG_INTERLACE_NONE: return 1; case PNG_INTERLACE_ADAM7: return PNG_INTERLACE_ADAM7_PASSES; } } ",0 "SPL_METHOD(SplPriorityQueue, setExtractFlags) { long value; spl_heap_object *intern; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""l"", &value) == FAILURE) { return; } intern = (spl_heap_object*)zend_object_store_get_object(getThis() TSRMLS_CC); intern->flags = value & SPL_PQUEUE_EXTR_MASK; RETURN_LONG(intern->flags); } ",0 "static int _nfs4_proc_create_session(struct nfs_client *clp, struct rpc_cred *cred) { struct nfs4_session *session = clp->cl_session; struct nfs41_create_session_args args = { .client = clp, .clientid = clp->cl_clientid, .seqid = clp->cl_seqid, .cb_program = NFS4_CALLBACK, }; struct nfs41_create_session_res res; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_CREATE_SESSION], .rpc_argp = &args, .rpc_resp = &res, .rpc_cred = cred, }; int status; nfs4_init_channel_attrs(&args); args.flags = (SESSION4_PERSIST | SESSION4_BACK_CHAN); status = rpc_call_sync(session->clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); trace_nfs4_create_session(clp, status); if (!status) { /* Verify the session's negotiated channel_attrs values */ status = nfs4_verify_channel_attrs(&args, &res); /* Increment the clientid slot sequence id */ if (clp->cl_seqid == res.seqid) clp->cl_seqid++; if (status) goto out; nfs4_update_session(session, &res); } out: return status; } ",0 "message_send_chat_pgp(const char *const barejid, const char *const msg, gboolean request_receipt) { xmpp_ctx_t * const ctx = connection_get_ctx(); char *state = chat_session_get_state(barejid); char *jid = chat_session_get_jid(barejid); char *id = create_unique_id(""msg""); xmpp_stanza_t *message = NULL; #ifdef HAVE_LIBGPGME char *account_name = session_get_account_name(); ProfAccount *account = accounts_get_account(account_name); if (account->pgp_keyid) { Jid *jidp = jid_create(jid); char *encrypted = p_gpg_encrypt(jidp->barejid, msg, account->pgp_keyid); if (encrypted) { message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id); xmpp_message_set_body(message, ""This message is encrypted.""); xmpp_stanza_t *x = xmpp_stanza_new(ctx); xmpp_stanza_set_name(x, STANZA_NAME_X); xmpp_stanza_set_ns(x, STANZA_NS_ENCRYPTED); xmpp_stanza_t *enc_st = xmpp_stanza_new(ctx); xmpp_stanza_set_text(enc_st, encrypted); xmpp_stanza_add_child(x, enc_st); xmpp_stanza_release(enc_st); xmpp_stanza_add_child(message, x); xmpp_stanza_release(x); free(encrypted); } else { message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id); xmpp_message_set_body(message, msg); } jid_destroy(jidp); } else { message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id); xmpp_message_set_body(message, msg); } account_free(account); #else message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, jid, id); xmpp_message_set_body(message, msg); #endif free(jid); if (state) { stanza_attach_state(ctx, message, state); } if (request_receipt) { stanza_attach_receipt_request(ctx, message); } _send_message_stanza(message); xmpp_stanza_release(message); return id; } ",0 "static struct verifier_state *push_stack(struct verifier_env *env, int insn_idx, int prev_insn_idx) { struct verifier_stack_elem *elem; elem = kmalloc(sizeof(struct verifier_stack_elem), GFP_KERNEL); if (!elem) goto err; memcpy(&elem->st, &env->cur_state, sizeof(env->cur_state)); elem->insn_idx = insn_idx; elem->prev_insn_idx = prev_insn_idx; elem->next = env->head; env->head = elem; env->stack_size++; if (env->stack_size > 1024) { verbose(""BPF program is too complex\n""); goto err; } return &elem->st; err: /* pop all elements and return */ while (pop_stack(env, NULL) >= 0); return NULL; } ",0 "static inline bool kvm_vcpu_trigger_posted_interrupt(struct kvm_vcpu *vcpu, bool nested) { #ifdef CONFIG_SMP int pi_vec = nested ? POSTED_INTR_NESTED_VECTOR : POSTED_INTR_VECTOR; if (vcpu->mode == IN_GUEST_MODE) { /* * The vector of interrupt to be delivered to vcpu had * been set in PIR before this function. * * Following cases will be reached in this block, and * we always send a notification event in all cases as * explained below. * * Case 1: vcpu keeps in non-root mode. Sending a * notification event posts the interrupt to vcpu. * * Case 2: vcpu exits to root mode and is still * runnable. PIR will be synced to vIRR before the * next vcpu entry. Sending a notification event in * this case has no effect, as vcpu is not in root * mode. * * Case 3: vcpu exits to root mode and is blocked. * vcpu_block() has already synced PIR to vIRR and * never blocks vcpu if vIRR is not cleared. Therefore, * a blocked vcpu here does not wait for any requested * interrupts in PIR, and sending a notification event * which has no effect is safe here. */ apic->send_IPI_mask(get_cpu_mask(vcpu->cpu), pi_vec); return true; } #endif return false; } ",0 "static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov, unsigned int ol) { struct sock *sk = sock->sk; struct caifsock *cf_sk = container_of(sk, struct caifsock, sk); int linksel; if (cf_sk->sk.sk_socket->state != SS_UNCONNECTED) return -ENOPROTOOPT; switch (opt) { case CAIFSO_LINK_SELECT: if (ol < sizeof(int)) return -EINVAL; if (lvl != SOL_CAIF) goto bad_sol; if (copy_from_user(&linksel, ov, sizeof(int))) return -EINVAL; lock_sock(&(cf_sk->sk)); cf_sk->conn_req.link_selector = linksel; release_sock(&cf_sk->sk); return 0; case CAIFSO_REQ_PARAM: if (lvl != SOL_CAIF) goto bad_sol; if (cf_sk->sk.sk_protocol != CAIFPROTO_UTIL) return -ENOPROTOOPT; lock_sock(&(cf_sk->sk)); if (ol > sizeof(cf_sk->conn_req.param.data) || copy_from_user(&cf_sk->conn_req.param.data, ov, ol)) { release_sock(&cf_sk->sk); return -EINVAL; } cf_sk->conn_req.param.size = ol; release_sock(&cf_sk->sk); return 0; default: return -ENOPROTOOPT; } return 0; bad_sol: return -ENOPROTOOPT; } ",0 "void jpc_ms_destroy(jpc_ms_t *ms) { if (ms->ops && ms->ops->destroyparms) { (*ms->ops->destroyparms)(ms); } jas_free(ms); } ",0 "ZEND_API zval* ZEND_FASTCALL zend_hash_str_find(const HashTable *ht, const char *str, size_t len) { zend_ulong h; Bucket *p; IS_CONSISTENT(ht); h = zend_inline_hash_func(str, len); p = zend_hash_str_find_bucket(ht, str, len, h); return p ? &p->val : NULL; } ",0 "void RenderFrameHostImpl::CancelBlockedRequestsForFrame() { DCHECK_CURRENTLY_ON(BrowserThread::UI); NotifyForEachFrameFromUI( this, base::BindRepeating( &ResourceDispatcherHostImpl::CancelBlockedRequestsForRoute)); } ",0 " void append(SerializationTag tag) { append(static_cast(tag)); } ",0 "skia::PlatformCanvas* TransportDIB::GetPlatformCanvas(int w, int h) { if (address_ == kInvalidAddress && !Map()) return NULL; scoped_ptr canvas(new skia::PlatformCanvas); if (!canvas->initialize(w, h, true, reinterpret_cast(memory()))) return NULL; return canvas.release(); } ",0 "RunLoop::RunLoop() : delegate_(tls_delegate.Get().Get()), origin_task_runner_(ThreadTaskRunnerHandle::Get()), weak_factory_(this) { DCHECK(delegate_) << ""A RunLoop::Delegate must be bound to this thread prior "" ""to using RunLoop.""; DCHECK(origin_task_runner_); } ",1 " WebDateTimeChooserCompletion* ChooserCompletion() { return chooser_completion_; } ",0 "static void sd_read_block_characteristics(struct scsi_disk *sdkp) { unsigned char *buffer; u16 rot; const int vpd_len = 64; buffer = kmalloc(vpd_len, GFP_KERNEL); if (!buffer || /* Block Device Characteristics VPD */ scsi_get_vpd_page(sdkp->device, 0xb1, buffer, vpd_len)) goto out; rot = get_unaligned_be16(&buffer[4]); if (rot == 1) queue_flag_set_unlocked(QUEUE_FLAG_NONROT, sdkp->disk->queue); out: kfree(buffer); } ",0 "static int inet6_netconf_msgsize_devconf(int type) { int size = NLMSG_ALIGN(sizeof(struct netconfmsg)) + nla_total_size(4); /* NETCONFA_IFINDEX */ /* type -1 is used for ALL */ if (type == -1 || type == NETCONFA_FORWARDING) size += nla_total_size(4); #ifdef CONFIG_IPV6_MROUTE if (type == -1 || type == NETCONFA_MC_FORWARDING) size += nla_total_size(4); #endif if (type == -1 || type == NETCONFA_PROXY_NEIGH) size += nla_total_size(4); return size; } ",0 "static int lock_mount(struct path *path) { struct vfsmount *mnt; retry: mutex_lock(&path->dentry->d_inode->i_mutex); if (unlikely(cant_mount(path->dentry))) { mutex_unlock(&path->dentry->d_inode->i_mutex); return -ENOENT; } down_write(&namespace_sem); mnt = lookup_mnt(path); if (likely(!mnt)) return 0; up_write(&namespace_sem); mutex_unlock(&path->dentry->d_inode->i_mutex); path_put(path); path->mnt = mnt; path->dentry = dget(mnt->mnt_root); goto retry; } ",0 "void WebContentsImpl::DidNavigateMainFramePostCommit( RenderFrameHostImpl* render_frame_host, const LoadCommittedDetails& details, const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { if (details.is_navigation_to_different_page()) { UpdateTargetURL(render_frame_host->GetRenderViewHost(), GURL()); RenderWidgetHostViewBase* rwhvb = static_cast(GetRenderWidgetHostView()); if (rwhvb) rwhvb->OnDidNavigateMainFrameToNewPage(); did_first_visually_non_empty_paint_ = false; theme_color_ = SK_ColorTRANSPARENT; } if (!details.is_in_page) { displayed_insecure_content_ = false; SSLManager::NotifySSLInternalStateChanged( GetController().GetBrowserContext()); } FOR_EACH_OBSERVER(WebContentsObserver, observers_, DidNavigateMainFrame(details, params)); if (delegate_) delegate_->DidNavigateMainFramePostCommit(this); view_->SetOverscrollControllerEnabled(CanOverscrollContent()); } ",0 "void XMLTokenizer::internalSubset(const xmlChar* name, const xmlChar* externalID, const xmlChar* systemID) { if (m_parserStopped) return; if (m_parserPaused) { m_pendingCallbacks->appendInternalSubsetCallback(name, externalID, systemID); return; } if (m_doc) { #if ENABLE(WML) String extId = toString(externalID); if (isWMLDocument() && extId != ""-//WAPFORUM//DTD WML 1.3//EN"" && extId != ""-//WAPFORUM//DTD WML 1.2//EN"" && extId != ""-//WAPFORUM//DTD WML 1.1//EN"" && extId != ""-//WAPFORUM//DTD WML 1.0//EN"") handleError(fatal, ""Invalid DTD Public ID"", lineNumber(), columnNumber()); #endif m_doc->addChild(DocumentType::create(m_doc, toString(name), toString(externalID), toString(systemID))); } } ",0 "static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst, u8 tos, int oif, struct net_device *dev, int rpf, struct in_device *idev, u32 *itag) { int ret, no_addr; struct fib_result res; struct flowi4 fl4; struct net *net; bool dev_match; fl4.flowi4_oif = 0; fl4.flowi4_iif = l3mdev_master_ifindex_rcu(dev); if (!fl4.flowi4_iif) fl4.flowi4_iif = oif ? : LOOPBACK_IFINDEX; fl4.daddr = src; fl4.saddr = dst; fl4.flowi4_tos = tos; fl4.flowi4_scope = RT_SCOPE_UNIVERSE; fl4.flowi4_tun_key.tun_id = 0; fl4.flowi4_flags = 0; no_addr = idev->ifa_list == NULL; fl4.flowi4_mark = IN_DEV_SRC_VMARK(idev) ? skb->mark : 0; trace_fib_validate_source(dev, &fl4); net = dev_net(dev); if (fib_lookup(net, &fl4, &res, 0)) goto last_resort; if (res.type != RTN_UNICAST && (res.type != RTN_LOCAL || !IN_DEV_ACCEPT_LOCAL(idev))) goto e_inval; if (!rpf && !fib_num_tclassid_users(dev_net(dev)) && (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev))) goto last_resort; fib_combine_itag(itag, &res); dev_match = false; #ifdef CONFIG_IP_ROUTE_MULTIPATH for (ret = 0; ret < res.fi->fib_nhs; ret++) { struct fib_nh *nh = &res.fi->fib_nh[ret]; if (nh->nh_dev == dev) { dev_match = true; break; } else if (l3mdev_master_ifindex_rcu(nh->nh_dev) == dev->ifindex) { dev_match = true; break; } } #else if (FIB_RES_DEV(res) == dev) dev_match = true; #endif if (dev_match) { ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; return ret; } if (no_addr) goto last_resort; if (rpf == 1) goto e_rpf; fl4.flowi4_oif = dev->ifindex; ret = 0; if (fib_lookup(net, &fl4, &res, FIB_LOOKUP_IGNORE_LINKSTATE) == 0) { if (res.type == RTN_UNICAST) ret = FIB_RES_NH(res).nh_scope >= RT_SCOPE_HOST; } return ret; last_resort: if (rpf) goto e_rpf; *itag = 0; return 0; e_inval: return -EINVAL; e_rpf: return -EXDEV; } ",0 "AudioRendererHost::AudioRendererHost( media::AudioManager* audio_manager, MediaObserver* media_observer) : audio_manager_(audio_manager), media_observer_(media_observer) { } ",0 "zip_get_local_file_header_size(struct archive_read *a, size_t extra) { const char *p; ssize_t filename_length, extra_length; if ((p = __archive_read_ahead(a, extra + 30, NULL)) == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Truncated ZIP file header""); return (ARCHIVE_WARN); } p += extra; if (memcmp(p, ""PK\003\004"", 4) != 0) { archive_set_error(&a->archive, -1, ""Damaged Zip archive""); return ARCHIVE_WARN; } filename_length = archive_le16dec(p + 26); extra_length = archive_le16dec(p + 28); return (30 + filename_length + extra_length); } ",0 "GF_Err stsz_dump(GF_Box *a, FILE * trace) { GF_SampleSizeBox *p; u32 i; p = (GF_SampleSizeBox *)a; if (a->type == GF_ISOM_BOX_TYPE_STSZ) { gf_isom_box_dump_start(a, ""SampleSizeBox"", trace); } else { gf_isom_box_dump_start(a, ""CompactSampleSizeBox"", trace); } fprintf(trace, ""SampleCount=\""%d\"""", p->sampleCount); if (a->type == GF_ISOM_BOX_TYPE_STSZ) { if (p->sampleSize) { fprintf(trace, "" ConstantSampleSize=\""%d\"""", p->sampleSize); } } else { fprintf(trace, "" SampleSizeBits=\""%d\"""", p->sampleSize); } fprintf(trace, "">\n""); if ((a->type != GF_ISOM_BOX_TYPE_STSZ) || !p->sampleSize) { if (!p->sizes && p->size) { fprintf(trace, ""\n""); } else { for (i=0; isampleCount; i++) { fprintf(trace, ""\n"", p->sizes[i]); } } } if (!p->size) { fprintf(trace, ""\n""); } gf_isom_box_dump_done((a->type == GF_ISOM_BOX_TYPE_STSZ) ? ""SampleSizeBox"" : ""CompactSampleSizeBox"", a, trace); return GF_OK; } ",0 "struct ctl_table_header *__register_sysctl_paths( struct ctl_table_root *root, struct nsproxy *namespaces, const struct ctl_path *path, struct ctl_table *table) { struct ctl_table_header *header; struct ctl_table *new, **prevp; unsigned int n, npath; struct ctl_table_set *set; /* Count the path components */ for (npath = 0; path[npath].procname; ++npath) ; /* * For each path component, allocate a 2-element ctl_table array. * The first array element will be filled with the sysctl entry * for this, the second will be the sentinel (procname == 0). * * We allocate everything in one go so that we don't have to * worry about freeing additional memory in unregister_sysctl_table. */ header = kzalloc(sizeof(struct ctl_table_header) + (2 * npath * sizeof(struct ctl_table)), GFP_KERNEL); if (!header) return NULL; new = (struct ctl_table *) (header + 1); /* Now connect the dots */ prevp = &header->ctl_table; for (n = 0; n < npath; ++n, ++path) { /* Copy the procname */ new->procname = path->procname; new->mode = 0555; *prevp = new; prevp = &new->child; new += 2; } *prevp = table; header->ctl_table_arg = table; INIT_LIST_HEAD(&header->ctl_entry); header->used = 0; header->unregistering = NULL; header->root = root; sysctl_set_parent(NULL, header->ctl_table); header->count = 1; #ifdef CONFIG_SYSCTL_SYSCALL_CHECK if (sysctl_check_table(namespaces, header->ctl_table)) { kfree(header); return NULL; } #endif spin_lock(&sysctl_lock); header->set = lookup_header_set(root, namespaces); header->attached_by = header->ctl_table; header->attached_to = root_table; header->parent = &root_table_header; for (set = header->set; set; set = set->parent) { struct ctl_table_header *p; list_for_each_entry(p, &set->list, ctl_entry) { if (p->unregistering) continue; try_attach(p, header); } } header->parent->count++; list_add_tail(&header->ctl_entry, &header->set->list); spin_unlock(&sysctl_lock); return header; } ",0 "IncludeCreate(struct xkb_context *ctx, char *str, enum merge_mode merge) { IncludeStmt *incl, *first; char *file, *map, *stmt, *tmp, *extra_data; char nextop; incl = first = NULL; file = map = NULL; tmp = str; stmt = strdup_safe(str); while (tmp && *tmp) { if (!ParseIncludeMap(&tmp, &file, &map, &nextop, &extra_data)) goto err; /* * Given an RMLVO (here layout) like 'us,,fr', the rules parser * will give out something like 'pc+us+:2+fr:3+inet(evdev)'. * We should just skip the ':2' in this case and leave it to the * appropriate section to deal with the empty group. */ if (isempty(file)) { free(file); free(map); free(extra_data); continue; } if (first == NULL) { first = incl = malloc(sizeof(*first)); } else { incl->next_incl = malloc(sizeof(*first)); incl = incl->next_incl; } if (!incl) break; incl->common.type = STMT_INCLUDE; incl->common.next = NULL; incl->merge = merge; incl->stmt = NULL; incl->file = file; incl->map = map; incl->modifier = extra_data; incl->next_incl = NULL; if (nextop == '|') merge = MERGE_AUGMENT; else merge = MERGE_OVERRIDE; } if (first) first->stmt = stmt; else free(stmt); return first; err: log_err(ctx, ""Illegal include statement \""%s\""; Ignored\n"", stmt); FreeInclude(first); free(stmt); return NULL; } ",0 " void PartialMagnificationController::CloseMagnifierWindow() { if (zoom_widget_) { RemoveZoomWidgetObservers(); zoom_widget_->Close(); zoom_widget_ = NULL; } } ",1 "status_t MetadataRetrieverClient::dump(int fd, const Vector& /*args*/) { const size_t SIZE = 256; char buffer[SIZE]; String8 result; result.append("" MetadataRetrieverClient\n""); snprintf(buffer, 255, "" pid(%d)\n"", mPid); result.append(buffer); write(fd, result.string(), result.size()); write(fd, ""\n"", 1); return NO_ERROR; } ",0 "static int xcbc_init_tfm(struct crypto_tfm *tfm) { struct crypto_cipher *cipher; struct crypto_instance *inst = (void *)tfm->__crt_alg; struct crypto_spawn *spawn = crypto_instance_ctx(inst); struct xcbc_tfm_ctx *ctx = crypto_tfm_ctx(tfm); cipher = crypto_spawn_cipher(spawn); if (IS_ERR(cipher)) return PTR_ERR(cipher); ctx->child = cipher; return 0; }; ",0 "void WebMediaPlayerMS::SetRate(double rate) { DCHECK(thread_checker_.CalledOnValidThread()); } ",0 "void RenderFrameHostImpl::NavigateToInterstitialURL(const GURL& data_url) { DCHECK(data_url.SchemeIs(url::kDataScheme)); CommonNavigationParams common_params( data_url, Referrer(), ui::PAGE_TRANSITION_LINK, FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT, false, false, base::TimeTicks::Now(), FrameMsg_UILoadMetricsReportType::NO_REPORT, GURL(), GURL(), PREVIEWS_OFF, base::TimeTicks::Now(), ""GET"", nullptr, base::Optional(), CSPDisposition::CHECK /* should_check_main_world_csp */); if (IsBrowserSideNavigationEnabled()) { CommitNavigation(nullptr, nullptr, mojo::ScopedDataPipeConsumerHandle(), common_params, RequestNavigationParams(), false); } else { Navigate(common_params, StartNavigationParams(), RequestNavigationParams()); } } ",0 "void ResourceMessageFilter::OnDnsPrefetch( const std::vector& hostnames) { chrome_browser_net::DnsPrefetchList(hostnames); } ",0 "bool TabStrip::OnMouseWheel(const ui::MouseWheelEvent& event) { if ((!event.x_offset() && !event.IsShiftDown()) || tab_count() < 2 || !FindTabHitByPoint(event.location())) return false; accumulated_horizontal_scroll_ += (event.x_offset() ? event.x_offset() : event.y_offset()); int horizontal_offset = accumulated_horizontal_scroll_ / ui::MouseWheelEvent::kWheelDelta; if (!horizontal_offset) return true; accumulated_horizontal_scroll_ %= ui::MouseWheelEvent::kWheelDelta; int new_active_index = (controller_->GetActiveIndex() + horizontal_offset) % tab_count(); if (new_active_index < 0) new_active_index += tab_count(); DCHECK(IsValidModelIndex(new_active_index)); controller_->SelectTab(new_active_index, event); return true; } ",0 "static int tls1_check_ec_key(SSL *s, unsigned char *curve_id, unsigned char *comp_id) { const unsigned char *pformats, *pcurves; size_t num_formats, num_curves, i; int j; /* * If point formats extension present check it, otherwise everything is * supported (see RFC4492). */ if (comp_id && s->session->tlsext_ecpointformatlist) { pformats = s->session->tlsext_ecpointformatlist; num_formats = s->session->tlsext_ecpointformatlist_length; for (i = 0; i < num_formats; i++, pformats++) { if (*comp_id == *pformats) break; } if (i == num_formats) return 0; } if (!curve_id) return 1; /* Check curve is consistent with client and server preferences */ for (j = 0; j <= 1; j++) { if (!tls1_get_curvelist(s, j, &pcurves, &num_curves)) return 0; if (j == 1 && num_curves == 0) { /* * If we've not received any curves then skip this check. * RFC 4492 does not require the supported elliptic curves extension * so if it is not sent we can just choose any curve. * It is invalid to send an empty list in the elliptic curves * extension, so num_curves == 0 always means no extension. */ break; } for (i = 0; i < num_curves; i++, pcurves += 2) { if (pcurves[0] == curve_id[0] && pcurves[1] == curve_id[1]) break; } if (i == num_curves) return 0; /* For clients can only check sent curve list */ if (!s->server) return 1; } return 1; } ",0 "IMPL_CTYPE_FN(ISALPHA) IMPL_CTYPE_FN(ISALNUM) IMPL_CTYPE_FN(ISSPACE) IMPL_CTYPE_FN(ISDIGIT) IMPL_CTYPE_FN(ISXDIGIT) IMPL_CTYPE_FN(ISPRINT) IMPL_CTYPE_FN(ISLOWER) IMPL_CTYPE_FN(ISUPPER) char EVUTIL_TOLOWER_(char c) { return ((char)EVUTIL_TOLOWER_TABLE[(ev_uint8_t)c]); } ",0 " virtual void RequestWifiScan() { if (EnsureCrosLoaded()) { RequestScan(TYPE_WIFI); } } ",0 "static RList* imports(RBinFile *arch) { RBinDexObj *bin = (RBinDexObj*) arch->o->bin_obj; if (!bin) { return NULL; } if (bin && bin->imports_list) { return bin->imports_list; } dex_loadcode (arch, bin); return bin->imports_list; } ",0 "static int are_comps_similar(opj_image_t * image) { unsigned int i; for (i = 1; i < image->numcomps; i++) { if (image->comps[0].dx != image->comps[i].dx || image->comps[0].dy != image->comps[i].dy || (i <= 2 && (image->comps[0].prec != image->comps[i].prec || image->comps[0].sgnd != image->comps[i].sgnd))) { return OPJ_FALSE; } } return OPJ_TRUE; } ",0 "static int ims_pcu_resume(struct usb_interface *intf) { struct ims_pcu *pcu = usb_get_intfdata(intf); struct usb_host_interface *alt = intf->cur_altsetting; int retval = 0; if (alt->desc.bInterfaceClass == USB_CLASS_COMM) { retval = ims_pcu_start_io(pcu); if (retval == 0) retval = ims_pcu_line_setup(pcu); } return retval; } ",0 "bool GLES2DecoderImpl::RegenerateRenderbufferIfNeeded( Renderbuffer* renderbuffer) { if (!renderbuffer->RegenerateAndBindBackingObjectIfNeeded(workarounds())) { return false; } if (renderbuffer != state_.bound_renderbuffer.get()) { state_.bound_renderbuffer_valid = false; } return true; } ",0 "int __page_symlink(struct inode *inode, const char *symname, int len, int nofs) { struct address_space *mapping = inode->i_mapping; struct page *page; void *fsdata; int err; char *kaddr; unsigned int flags = AOP_FLAG_UNINTERRUPTIBLE; if (nofs) flags |= AOP_FLAG_NOFS; retry: err = pagecache_write_begin(NULL, mapping, 0, len-1, flags, &page, &fsdata); if (err) goto fail; kaddr = kmap_atomic(page, KM_USER0); memcpy(kaddr, symname, len-1); kunmap_atomic(kaddr, KM_USER0); err = pagecache_write_end(NULL, mapping, 0, len-1, len-1, page, fsdata); if (err < 0) goto fail; if (err < len-1) goto retry; mark_inode_dirty(inode); return 0; fail: return err; } ",0 "server_accept_loop(int *sock_in, int *sock_out, int *newsock, int *config_s) { fd_set *fdset; int i, j, ret, maxfd; int startups = 0; int startup_p[2] = { -1 , -1 }; struct sockaddr_storage from; socklen_t fromlen; pid_t pid; /* setup fd set for accept */ fdset = NULL; maxfd = 0; for (i = 0; i < num_listen_socks; i++) if (listen_socks[i] > maxfd) maxfd = listen_socks[i]; /* pipes connected to unauthenticated childs */ startup_pipes = xcalloc(options.max_startups, sizeof(int)); for (i = 0; i < options.max_startups; i++) startup_pipes[i] = -1; /* * Stay listening for connections until the system crashes or * the daemon is killed with a signal. */ for (;;) { if (received_sighup) sighup_restart(); free(fdset); fdset = xcalloc(howmany(maxfd + 1, NFDBITS), sizeof(fd_mask)); for (i = 0; i < num_listen_socks; i++) FD_SET(listen_socks[i], fdset); for (i = 0; i < options.max_startups; i++) if (startup_pipes[i] != -1) FD_SET(startup_pipes[i], fdset); /* Wait in select until there is a connection. */ ret = select(maxfd+1, fdset, NULL, NULL, NULL); if (ret < 0 && errno != EINTR) error(""select: %.100s"", strerror(errno)); if (received_sigterm) { logit(""Received signal %d; terminating."", (int) received_sigterm); close_listen_socks(); if (options.pid_file != NULL) unlink(options.pid_file); exit(received_sigterm == SIGTERM ? 0 : 255); } if (ret < 0) continue; for (i = 0; i < options.max_startups; i++) if (startup_pipes[i] != -1 && FD_ISSET(startup_pipes[i], fdset)) { /* * the read end of the pipe is ready * if the child has closed the pipe * after successful authentication * or if the child has died */ close(startup_pipes[i]); startup_pipes[i] = -1; startups--; } for (i = 0; i < num_listen_socks; i++) { if (!FD_ISSET(listen_socks[i], fdset)) continue; fromlen = sizeof(from); *newsock = accept(listen_socks[i], (struct sockaddr *)&from, &fromlen); if (*newsock < 0) { if (errno != EINTR && errno != EWOULDBLOCK && errno != ECONNABORTED) error(""accept: %.100s"", strerror(errno)); if (errno == EMFILE || errno == ENFILE) usleep(100 * 1000); continue; } if (unset_nonblock(*newsock) == -1) { close(*newsock); continue; } if (drop_connection(startups) == 1) { debug(""drop connection #%d"", startups); close(*newsock); continue; } if (pipe(startup_p) == -1) { close(*newsock); continue; } if (rexec_flag && socketpair(AF_UNIX, SOCK_STREAM, 0, config_s) == -1) { error(""reexec socketpair: %s"", strerror(errno)); close(*newsock); close(startup_p[0]); close(startup_p[1]); continue; } for (j = 0; j < options.max_startups; j++) if (startup_pipes[j] == -1) { startup_pipes[j] = startup_p[0]; if (maxfd < startup_p[0]) maxfd = startup_p[0]; startups++; break; } /* * Got connection. Fork a child to handle it, unless * we are in debugging mode. */ if (debug_flag) { /* * In debugging mode. Close the listening * socket, and start processing the * connection without forking. */ debug(""Server will not fork when running in debugging mode.""); close_listen_socks(); *sock_in = *newsock; *sock_out = *newsock; close(startup_p[0]); close(startup_p[1]); startup_pipe = -1; pid = getpid(); if (rexec_flag) { send_rexec_state(config_s[0], &cfg); close(config_s[0]); } break; } /* * Normal production daemon. Fork, and have * the child process the connection. The * parent continues listening. */ if ((pid = fork()) == 0) { /* * Child. Close the listening and * max_startup sockets. Start using * the accepted socket. Reinitialize * logging (since our pid has changed). * We break out of the loop to handle * the connection. */ startup_pipe = startup_p[1]; close_startup_pipes(); close_listen_socks(); *sock_in = *newsock; *sock_out = *newsock; log_init(__progname, options.log_level, options.log_facility, log_stderr); if (rexec_flag) close(config_s[0]); break; } /* Parent. Stay in the loop. */ if (pid < 0) error(""fork: %.100s"", strerror(errno)); else debug(""Forked child %ld."", (long)pid); close(startup_p[1]); if (rexec_flag) { send_rexec_state(config_s[0], &cfg); close(config_s[0]); close(config_s[1]); } close(*newsock); } /* child process check (or debug mode) */ if (num_listen_socks < 0) break; } } ",0 "bool TabStripModel::ContainsIndex(int index) const { return index >= 0 && index < count(); } ",0 "void perf_event_update_userpage(struct perf_event *event) { struct perf_event_mmap_page *userpg; struct ring_buffer *rb; u64 enabled, running, now; rcu_read_lock(); /* * compute total_time_enabled, total_time_running * based on snapshot values taken when the event * was last scheduled in. * * we cannot simply called update_context_time() * because of locking issue as we can be called in * NMI context */ calc_timer_values(event, &now, &enabled, &running); rb = rcu_dereference(event->rb); if (!rb) goto unlock; userpg = rb->user_page; /* * Disable preemption so as to not let the corresponding user-space * spin too long if we get preempted. */ preempt_disable(); ++userpg->lock; barrier(); userpg->index = perf_event_index(event); userpg->offset = perf_event_count(event); if (userpg->index) userpg->offset -= local64_read(&event->hw.prev_count); userpg->time_enabled = enabled + atomic64_read(&event->child_total_time_enabled); userpg->time_running = running + atomic64_read(&event->child_total_time_running); arch_perf_update_userpage(userpg, now); barrier(); ++userpg->lock; preempt_enable(); unlock: rcu_read_unlock(); } ",0 "void OneClickSigninHelper::NavigateToPendingEntry( const GURL& url, content::NavigationController::ReloadType reload_type) { VLOG(1) << ""OneClickSigninHelper::NavigateToPendingEntry: url="" << url.spec(); const GURL continue_url = signin::GetNextPageURLForPromoURL( signin::GetPromoURL(signin::SOURCE_START_PAGE, false)); GURL::Replacements replacements; replacements.ClearQuery(); if (!IsValidGaiaSigninRedirectOrResponseURL(url) && continue_url_.is_valid() && url.ReplaceComponents(replacements) != continue_url_.ReplaceComponents(replacements)) { if (++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince) CleanTransientState(); } } ",0 " TestMultiBufferDataProvider* GetProvider_allownull() { EXPECT_LE(test_data_providers.size(), 1U); if (test_data_providers.size() != 1U) return nullptr; return *test_data_providers.begin(); } ",0 " static enum AVPixelFormat h263_get_format(AVCodecContext *avctx) { /* MPEG-4 Studio Profile only, not supported by hardware */ if (avctx->bits_per_raw_sample > 8) { av_assert1(avctx->profile == FF_PROFILE_MPEG4_SIMPLE_STUDIO); return avctx->pix_fmt; } if (avctx->codec->id == AV_CODEC_ID_MSS2) return AV_PIX_FMT_YUV420P; if (CONFIG_GRAY && (avctx->flags & AV_CODEC_FLAG_GRAY)) { if (avctx->color_range == AVCOL_RANGE_UNSPECIFIED) avctx->color_range = AVCOL_RANGE_MPEG; return AV_PIX_FMT_GRAY8; } return avctx->pix_fmt = ff_get_format(avctx, avctx->codec->pix_fmts); } ",1 "static int _vop_virtio_copy(struct vop_vdev *vdev, struct mic_copy_desc *copy) { int ret = 0; u32 iovcnt = copy->iovcnt; struct iovec iov; struct iovec __user *u_iov = copy->iov; void __user *ubuf = NULL; struct vop_vringh *vvr = &vdev->vvr[copy->vr_idx]; struct vringh_kiov *riov = &vvr->riov; struct vringh_kiov *wiov = &vvr->wiov; struct vringh *vrh = &vvr->vrh; u16 *head = &vvr->head; struct mic_vring *vr = &vvr->vring; size_t len = 0, out_len; copy->out_len = 0; /* Fetch a new IOVEC if all previous elements have been processed */ if (riov->i == riov->used && wiov->i == wiov->used) { ret = vringh_getdesc_kern(vrh, riov, wiov, head, GFP_KERNEL); /* Check if there are available descriptors */ if (ret <= 0) return ret; } while (iovcnt) { if (!len) { /* Copy over a new iovec from user space. */ ret = copy_from_user(&iov, u_iov, sizeof(*u_iov)); if (ret) { ret = -EINVAL; dev_err(vop_dev(vdev), ""%s %d err %d\n"", __func__, __LINE__, ret); break; } len = iov.iov_len; ubuf = iov.iov_base; } /* Issue all the read descriptors first */ ret = vop_vringh_copy(vdev, riov, ubuf, len, MIC_VRINGH_READ, copy->vr_idx, &out_len); if (ret) { dev_err(vop_dev(vdev), ""%s %d err %d\n"", __func__, __LINE__, ret); break; } len -= out_len; ubuf += out_len; copy->out_len += out_len; /* Issue the write descriptors next */ ret = vop_vringh_copy(vdev, wiov, ubuf, len, !MIC_VRINGH_READ, copy->vr_idx, &out_len); if (ret) { dev_err(vop_dev(vdev), ""%s %d err %d\n"", __func__, __LINE__, ret); break; } len -= out_len; ubuf += out_len; copy->out_len += out_len; if (!len) { /* One user space iovec is now completed */ iovcnt--; u_iov++; } /* Exit loop if all elements in KIOVs have been processed. */ if (riov->i == riov->used && wiov->i == wiov->used) break; } /* * Update the used ring if a descriptor was available and some data was * copied in/out and the user asked for a used ring update. */ if (*head != USHRT_MAX && copy->out_len && copy->update_used) { u32 total = 0; /* Determine the total data consumed */ total += vop_vringh_iov_consumed(riov); total += vop_vringh_iov_consumed(wiov); vringh_complete_kern(vrh, *head, total); *head = USHRT_MAX; if (vringh_need_notify_kern(vrh) > 0) vringh_notify(vrh); vringh_kiov_cleanup(riov); vringh_kiov_cleanup(wiov); /* Update avail idx for user space */ vr->info->avail_idx = vrh->last_avail_idx; } return ret; } ",0 "void BaseAudioContext::ContextDestroyed(ExecutionContext*) { destination()->GetAudioDestinationHandler().ContextDestroyed(); Uninitialize(); } ",0 "static int ext4_writepage(struct page *page, struct writeback_control *wbc) { int ret = 0; loff_t size; unsigned int len; struct buffer_head *page_bufs = NULL; struct inode *inode = page->mapping->host; struct ext4_io_submit io_submit; bool keep_towrite = false; trace_ext4_writepage(page); size = i_size_read(inode); if (page->index == size >> PAGE_SHIFT) len = size & ~PAGE_MASK; else len = PAGE_SIZE; page_bufs = page_buffers(page); /* * We cannot do block allocation or other extent handling in this * function. If there are buffers needing that, we have to redirty * the page. But we may reach here when we do a journal commit via * journal_submit_inode_data_buffers() and in that case we must write * allocated buffers to achieve data=ordered mode guarantees. * * Also, if there is only one buffer per page (the fs block * size == the page size), if one buffer needs block * allocation or needs to modify the extent tree to clear the * unwritten flag, we know that the page can't be written at * all, so we might as well refuse the write immediately. * Unfortunately if the block size != page size, we can't as * easily detect this case using ext4_walk_page_buffers(), but * for the extremely common case, this is an optimization that * skips a useless round trip through ext4_bio_write_page(). */ if (ext4_walk_page_buffers(NULL, page_bufs, 0, len, NULL, ext4_bh_delay_or_unwritten)) { redirty_page_for_writepage(wbc, page); if ((current->flags & PF_MEMALLOC) || (inode->i_sb->s_blocksize == PAGE_SIZE)) { /* * For memory cleaning there's no point in writing only * some buffers. So just bail out. Warn if we came here * from direct reclaim. */ WARN_ON_ONCE((current->flags & (PF_MEMALLOC|PF_KSWAPD)) == PF_MEMALLOC); unlock_page(page); return 0; } keep_towrite = true; } if (PageChecked(page) && ext4_should_journal_data(inode)) /* * It's mmapped pagecache. Add buffers and journal it. There * doesn't seem much point in redirtying the page here. */ return __ext4_journalled_writepage(page, len); ext4_io_submit_init(&io_submit, wbc); io_submit.io_end = ext4_init_io_end(inode, GFP_NOFS); if (!io_submit.io_end) { redirty_page_for_writepage(wbc, page); unlock_page(page); return -ENOMEM; } ret = ext4_bio_write_page(&io_submit, page, len, wbc, keep_towrite); ext4_io_submit(&io_submit); /* Drop io_end reference we got from init */ ext4_put_io_end_defer(io_submit.io_end); return ret; } ",0 "const VisibleSelectionInFlatTree& FrameSelection::GetSelectionInFlatTree() const { return ComputeVisibleSelectionInFlatTree(); } ",0 "void usbip_pad_iso(struct usbip_device *ud, struct urb *urb) { int np = urb->number_of_packets; int i; int actualoffset = urb->actual_length; if (!usb_pipeisoc(urb->pipe)) return; /* if no packets or length of data is 0, then nothing to unpack */ if (np == 0 || urb->actual_length == 0) return; /* * if actual_length is transfer_buffer_length then no padding is * present. */ if (urb->actual_length == urb->transfer_buffer_length) return; /* * loop over all packets from last to first (to prevent overwritting * memory when padding) and move them into the proper place */ for (i = np-1; i > 0; i--) { actualoffset -= urb->iso_frame_desc[i].actual_length; memmove(urb->transfer_buffer + urb->iso_frame_desc[i].offset, urb->transfer_buffer + actualoffset, urb->iso_frame_desc[i].actual_length); } } ",0 "reset_conn(conn c) { int r; r = conn_update_evq(c, EV_READ | EV_PERSIST); if (r == -1) return twarnx(""update events failed""), conn_close(c); /* was this a peek or stats command? */ if (c->out_job && c->out_job->state == JOB_STATE_COPY) job_free(c->out_job); c->out_job = NULL; c->reply_sent = 0; /* now that we're done, reset this */ c->state = STATE_WANTCOMMAND; } ",0 "void SkipEOLN(cmsIT8* it8) { while (it8->sy == SEOLN) { InSymbol(it8); } } ",0 "validate_transit_path(krb5_context context, krb5_const_principal client, krb5_db_entry *server, krb5_db_entry *header_srv) { /* Incoming */ if (isflagset(server->attributes, KRB5_KDB_XREALM_NON_TRANSITIVE)) { return KRB5KDC_ERR_PATH_NOT_ACCEPTED; } /* Outgoing */ if (isflagset(header_srv->attributes, KRB5_KDB_XREALM_NON_TRANSITIVE) && (!krb5_principal_compare(context, server->princ, header_srv->princ) || !krb5_realm_compare(context, client, header_srv->princ))) { return KRB5KDC_ERR_PATH_NOT_ACCEPTED; } return 0; } ",0 "int tls1_final_finish_mac(SSL *s, const char *str, int slen, unsigned char *out) { int hashlen; unsigned char hash[EVP_MAX_MD_SIZE]; if (!ssl3_digest_cached_records(s, 0)) return 0; hashlen = ssl_handshake_hash(s, hash, sizeof(hash)); if (hashlen == 0) return 0; if (!tls1_PRF(s, str, slen, hash, hashlen, NULL, 0, NULL, 0, NULL, 0, s->session->master_key, s->session->master_key_length, out, TLS1_FINISH_MAC_LENGTH)) return 0; OPENSSL_cleanse(hash, hashlen); return TLS1_FINISH_MAC_LENGTH; } ",0 "grub_ext2_read_inode (struct grub_ext2_data *data, int ino, struct grub_ext2_inode *inode) { struct grub_ext2_block_group blkgrp; struct grub_ext2_sblock *sblock = &data->sblock; int inodes_per_block; unsigned int blkno; unsigned int blkoff; /* It is easier to calculate if the first inode is 0. */ ino--; int div = grub_le_to_cpu32 (sblock->inodes_per_group); if (div < 1) { return grub_errno = GRUB_ERR_BAD_FS; } grub_ext2_blockgroup (data, ino / div, &blkgrp); if (grub_errno) return grub_errno; int inode_size = EXT2_INODE_SIZE (data); if (inode_size < 1) { return grub_errno = GRUB_ERR_BAD_FS; } inodes_per_block = EXT2_BLOCK_SIZE (data) / inode_size; if (inodes_per_block < 1) { return grub_errno = GRUB_ERR_BAD_FS; } blkno = (ino % grub_le_to_cpu32 (sblock->inodes_per_group)) / inodes_per_block; blkoff = (ino % grub_le_to_cpu32 (sblock->inodes_per_group)) % inodes_per_block; /* Read the inode. */ if (grub_disk_read (data->disk, ((grub_le_to_cpu32 (blkgrp.inode_table_id) + blkno) << LOG2_EXT2_BLOCK_SIZE (data)), EXT2_INODE_SIZE (data) * blkoff, sizeof (struct grub_ext2_inode), inode)) return grub_errno; return 0; } ",0 "xfs_vm_bmap( struct address_space *mapping, sector_t block) { struct inode *inode = (struct inode *)mapping->host; struct xfs_inode *ip = XFS_I(inode); trace_xfs_vm_bmap(XFS_I(inode)); xfs_ilock(ip, XFS_IOLOCK_SHARED); /* * The swap code (ab-)uses ->bmap to get a block mapping and then * bypasseѕ the file system for actual I/O. We really can't allow * that on reflinks inodes, so we have to skip out here. And yes, * 0 is the magic code for a bmap error.. */ if (xfs_is_reflink_inode(ip)) { xfs_iunlock(ip, XFS_IOLOCK_SHARED); return 0; } filemap_write_and_wait(mapping); xfs_iunlock(ip, XFS_IOLOCK_SHARED); return generic_block_bmap(mapping, block, xfs_get_blocks); } ",0 "GF_Err hvcc_Size(GF_Box *s) { u32 i, count, j, subcount; GF_HEVCConfigurationBox *ptr = (GF_HEVCConfigurationBox *)s; if (!ptr->config) { ptr->size = 0; return GF_OK; } if (!ptr->config->is_lhvc) ptr->size += 23; else ptr->size += 6; count = gf_list_count(ptr->config->param_array); for (i=0; iconfig->param_array, i); ptr->size += 3; subcount = gf_list_count(ar->nalus); for (j=0; jsize += 2 + ((GF_AVCConfigSlot *)gf_list_get(ar->nalus, j))->size; } } return GF_OK; } ",0 " void OnAudioTimeCallback( base::TimeDelta current_time, base::TimeDelta max_time) { CHECK(current_time <= max_time); } ",0 "bool CanMouseDownStartSelect(Node* node) { if (!node || !node->GetLayoutObject()) return true; if (!node->CanStartSelection()) return false; return true; } ",0 "void PPB_URLLoader_Impl::didFinishLoading(WebURLLoader* loader, double finish_time) { done_status_ = PP_OK; RunCallback(done_status_); } ",0 "void AXObject::elementsFromAttribute(HeapVector>& elements, const QualifiedName& attribute) const { Vector ids; tokenVectorFromAttribute(ids, attribute); if (ids.isEmpty()) return; TreeScope& scope = getNode()->treeScope(); for (const auto& id : ids) { if (Element* idElement = scope.getElementById(AtomicString(id))) elements.push_back(idElement); } } ",0 "float RenderViewImpl::GetDeviceScaleFactor() const { return GetWebScreenInfo().device_scale_factor; } ",0 "AtomicString Document::contentType() const { if (!mime_type_.IsEmpty()) return mime_type_; if (DocumentLoader* document_loader = Loader()) return document_loader->MimeType(); String mime_type = SuggestedMIMEType(); if (!mime_type.IsEmpty()) return AtomicString(mime_type); return AtomicString(""application/xml""); } ",0 "int V8Proxy::contextDebugId(v8::Handle context) { v8::HandleScope scope; if (!context->GetData()->IsString()) return -1; v8::String::AsciiValue ascii(context->GetData()); char* comma = strnstr(*ascii, "","", ascii.length()); if (!comma) return -1; return atoi(comma + 1); } ",0 "uint64 TaskQueueManager::GetAndClearTaskWasRunOnQueueBitmap() { uint64 bitmap = task_was_run_bitmap_; task_was_run_bitmap_ = 0; return bitmap; } ",0 "gs_currentdevice(const gs_gstate * pgs) { return pgs->device; } ",0 "void WebMediaPlayerImpl::OnAudioDecoderChange(const std::string& name) { if (name == audio_decoder_name_) return; audio_decoder_name_ = name; if (!watch_time_reporter_) return; UpdateSecondaryProperties(); } ",0 "RendererPreferences* WebContentsImpl::GetMutableRendererPrefs() { return &renderer_preferences_; } ",0 "void WebContentsImpl::WebContentsTreeNode::ConnectToOuterWebContents( WebContentsImpl* outer_web_contents, RenderFrameHostImpl* outer_contents_frame) { outer_web_contents_ = outer_web_contents; outer_contents_frame_tree_node_id_ = outer_contents_frame->frame_tree_node()->frame_tree_node_id(); if (!outer_web_contents_->node_) outer_web_contents_->node_.reset(new WebContentsTreeNode()); outer_web_contents_->node_->inner_web_contents_tree_nodes_.insert(this); } ",0 "GF_Box *tfhd_New() { ISOM_DECL_BOX_ALLOC(GF_TrackFragmentHeaderBox, GF_ISOM_BOX_TYPE_TFHD); return (GF_Box *)tmp; } ",0 "void GfxCalRGBColorSpace::getGray(GfxColor *color, GfxGray *gray) { GfxRGB rgb; #ifdef USE_CMS if (XYZ2DisplayTransform != NULL && displayPixelType == PT_GRAY) { Guchar out[gfxColorMaxComps]; double in[gfxColorMaxComps]; double X, Y, Z; getXYZ(color,&X,&Y,&Z); in[0] = clip01(X); in[1] = clip01(Y); in[2] = clip01(Z); XYZ2DisplayTransform->doTransform(in,out,1); *gray = byteToCol(out[0]); return; } #endif getRGB(color, &rgb); *gray = clip01((GfxColorComp)(0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b + 0.5)); } ",0 "static void file_add_remove(struct diff_options *options, int addremove, unsigned mode, const unsigned char *sha1, int sha1_valid, const char *fullpath, unsigned dirty_submodule) { int diff = addremove == '+' ? REV_TREE_NEW : REV_TREE_OLD; tree_difference |= diff; if (tree_difference == REV_TREE_DIFFERENT) DIFF_OPT_SET(options, HAS_CHANGES); } ",0 "bool venc_dev::venc_set_meta_mode(bool mode) { metadatamode = mode; return true; } ",0 "void ResourceDispatcherHostImpl::OnRequestResource( const IPC::Message& message, int request_id, const ResourceHostMsg_Request& request_data) { BeginRequest(request_id, request_data, NULL, message.routing_id()); } ",0 "NTSTATUS TCStartVolumeThread (PDEVICE_OBJECT DeviceObject, PEXTENSION Extension, MOUNT_STRUCT * mount) { PTHREAD_BLOCK pThreadBlock = TCalloc (sizeof (THREAD_BLOCK)); HANDLE hThread; NTSTATUS ntStatus; OBJECT_ATTRIBUTES threadObjAttributes; SECURITY_QUALITY_OF_SERVICE qos; Dump (""Starting thread...\n""); if (pThreadBlock == NULL) { return STATUS_INSUFFICIENT_RESOURCES; } else { pThreadBlock->DeviceObject = DeviceObject; pThreadBlock->mount = mount; } qos.Length = sizeof (qos); qos.ContextTrackingMode = SECURITY_STATIC_TRACKING; qos.EffectiveOnly = TRUE; qos.ImpersonationLevel = SecurityImpersonation; ntStatus = SeCreateClientSecurity (PsGetCurrentThread(), &qos, FALSE, &Extension->SecurityClientContext); if (!NT_SUCCESS (ntStatus)) goto ret; Extension->SecurityClientContextValid = TRUE; Extension->bThreadShouldQuit = FALSE; InitializeObjectAttributes (&threadObjAttributes, NULL, OBJ_KERNEL_HANDLE, NULL, NULL); ntStatus = PsCreateSystemThread (&hThread, THREAD_ALL_ACCESS, &threadObjAttributes, NULL, NULL, VolumeThreadProc, pThreadBlock); if (!NT_SUCCESS (ntStatus)) { Dump (""PsCreateSystemThread Failed END\n""); goto ret; } ntStatus = ObReferenceObjectByHandle (hThread, THREAD_ALL_ACCESS, NULL, KernelMode, &Extension->peThread, NULL); ZwClose (hThread); if (!NT_SUCCESS (ntStatus)) goto ret; Dump (""Waiting for thread to initialize...\n""); KeWaitForSingleObject (&Extension->keCreateEvent, Executive, KernelMode, FALSE, NULL); Dump (""Waiting completed! Thread returns 0x%08x\n"", pThreadBlock->ntCreateStatus); ntStatus = pThreadBlock->ntCreateStatus; ret: TCfree (pThreadBlock); return ntStatus; } ",0 "static int config_output(AVFilterLink *outlink) { AVFilterContext *ctx = outlink->src; const FieldMatchContext *fm = ctx->priv; const AVFilterLink *inlink = ctx->inputs[fm->ppsrc ? INPUT_CLEANSRC : INPUT_MAIN]; outlink->flags |= FF_LINK_FLAG_REQUEST_LOOP; outlink->time_base = inlink->time_base; outlink->sample_aspect_ratio = inlink->sample_aspect_ratio; outlink->frame_rate = inlink->frame_rate; outlink->w = inlink->w; outlink->h = inlink->h; return 0; } ",0 "nfs4_set_delegation(struct nfs4_client *clp, struct svc_fh *fh, struct nfs4_file *fp, struct nfs4_clnt_odstate *odstate) { int status; struct nfs4_delegation *dp; if (fp->fi_had_conflict) return ERR_PTR(-EAGAIN); spin_lock(&state_lock); spin_lock(&fp->fi_lock); status = nfs4_get_existing_delegation(clp, fp); spin_unlock(&fp->fi_lock); spin_unlock(&state_lock); if (status) return ERR_PTR(status); dp = alloc_init_deleg(clp, fh, odstate); if (!dp) return ERR_PTR(-ENOMEM); get_nfs4_file(fp); spin_lock(&state_lock); spin_lock(&fp->fi_lock); dp->dl_stid.sc_file = fp; if (!fp->fi_deleg_file) { spin_unlock(&fp->fi_lock); spin_unlock(&state_lock); status = nfs4_setlease(dp); goto out; } if (fp->fi_had_conflict) { status = -EAGAIN; goto out_unlock; } status = hash_delegation_locked(dp, fp); out_unlock: spin_unlock(&fp->fi_lock); spin_unlock(&state_lock); out: if (status) { put_clnt_odstate(dp->dl_clnt_odstate); nfs4_put_stid(&dp->dl_stid); return ERR_PTR(status); } return dp; } ",0 "PDFiumEngine::PDFiumEngine(PDFEngine::Client* client) : client_(client), current_zoom_(1.0), current_rotation_(0), doc_(nullptr), form_(nullptr), defer_page_unload_(false), selecting_(false), mouse_down_state_(PDFiumPage::NONSELECTABLE_AREA, PDFiumPage::LinkTarget()), in_form_text_area_(false), editable_form_text_area_(false), mouse_left_button_down_(false), permissions_(0), permissions_handler_revision_(-1), fpdf_availability_(nullptr), last_page_mouse_down_(-1), most_visible_page_(-1), called_do_document_action_(false), render_grayscale_(false), render_annots_(true), edit_mode_(false) { find_factory_.Initialize(this); password_factory_.Initialize(this); file_access_.m_FileLen = 0; file_access_.m_GetBlock = &GetBlock; file_access_.m_Param = this; file_availability_.version = 1; file_availability_.IsDataAvail = &IsDataAvail; file_availability_.engine = this; download_hints_.version = 1; download_hints_.AddSegment = &AddSegment; download_hints_.engine = this; FPDF_FORMFILLINFO::version = 1; FPDF_FORMFILLINFO::m_pJsPlatform = this; FPDF_FORMFILLINFO::Release = nullptr; FPDF_FORMFILLINFO::FFI_Invalidate = Form_Invalidate; FPDF_FORMFILLINFO::FFI_OutputSelectedRect = Form_OutputSelectedRect; FPDF_FORMFILLINFO::FFI_SetCursor = Form_SetCursor; FPDF_FORMFILLINFO::FFI_SetTimer = Form_SetTimer; FPDF_FORMFILLINFO::FFI_KillTimer = Form_KillTimer; FPDF_FORMFILLINFO::FFI_GetLocalTime = Form_GetLocalTime; FPDF_FORMFILLINFO::FFI_OnChange = Form_OnChange; FPDF_FORMFILLINFO::FFI_GetPage = Form_GetPage; FPDF_FORMFILLINFO::FFI_GetCurrentPage = Form_GetCurrentPage; FPDF_FORMFILLINFO::FFI_GetRotation = Form_GetRotation; FPDF_FORMFILLINFO::FFI_ExecuteNamedAction = Form_ExecuteNamedAction; FPDF_FORMFILLINFO::FFI_SetTextFieldFocus = Form_SetTextFieldFocus; FPDF_FORMFILLINFO::FFI_DoURIAction = Form_DoURIAction; FPDF_FORMFILLINFO::FFI_DoGoToAction = Form_DoGoToAction; #if defined(PDF_ENABLE_XFA) FPDF_FORMFILLINFO::version = 2; FPDF_FORMFILLINFO::FFI_EmailTo = Form_EmailTo; FPDF_FORMFILLINFO::FFI_DisplayCaret = Form_DisplayCaret; FPDF_FORMFILLINFO::FFI_SetCurrentPage = Form_SetCurrentPage; FPDF_FORMFILLINFO::FFI_GetCurrentPageIndex = Form_GetCurrentPageIndex; FPDF_FORMFILLINFO::FFI_GetPageViewRect = Form_GetPageViewRect; FPDF_FORMFILLINFO::FFI_GetPlatform = Form_GetPlatform; FPDF_FORMFILLINFO::FFI_PageEvent = nullptr; FPDF_FORMFILLINFO::FFI_PopupMenu = Form_PopupMenu; FPDF_FORMFILLINFO::FFI_PostRequestURL = Form_PostRequestURL; FPDF_FORMFILLINFO::FFI_PutRequestURL = Form_PutRequestURL; FPDF_FORMFILLINFO::FFI_UploadTo = Form_UploadTo; FPDF_FORMFILLINFO::FFI_DownloadFromURL = Form_DownloadFromURL; FPDF_FORMFILLINFO::FFI_OpenFile = Form_OpenFile; FPDF_FORMFILLINFO::FFI_GotoURL = Form_GotoURL; FPDF_FORMFILLINFO::FFI_GetLanguage = Form_GetLanguage; #endif // defined(PDF_ENABLE_XFA) IPDF_JSPLATFORM::version = 3; IPDF_JSPLATFORM::app_alert = Form_Alert; IPDF_JSPLATFORM::app_beep = Form_Beep; IPDF_JSPLATFORM::app_response = Form_Response; IPDF_JSPLATFORM::Doc_getFilePath = Form_GetFilePath; IPDF_JSPLATFORM::Doc_mail = Form_Mail; IPDF_JSPLATFORM::Doc_print = Form_Print; IPDF_JSPLATFORM::Doc_submitForm = Form_SubmitForm; IPDF_JSPLATFORM::Doc_gotoPage = Form_GotoPage; IPDF_JSPLATFORM::Field_browse = nullptr; IFSDK_PAUSE::version = 1; IFSDK_PAUSE::user = nullptr; IFSDK_PAUSE::NeedToPauseNow = Pause_NeedToPauseNow; #if defined(OS_LINUX) pp::Instance* instance = client_->GetPluginInstance(); if (instance) g_last_instance_id = instance->pp_instance(); #endif } ",0 "static int usb_enable_remote_wakeup(struct usb_device *udev) { if (udev->speed < USB_SPEED_SUPER) return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), USB_REQ_SET_FEATURE, USB_RECIP_DEVICE, USB_DEVICE_REMOTE_WAKEUP, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); else return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), USB_REQ_SET_FEATURE, USB_RECIP_INTERFACE, USB_INTRF_FUNC_SUSPEND, USB_INTRF_FUNC_SUSPEND_RW | USB_INTRF_FUNC_SUSPEND_LP, NULL, 0, USB_CTRL_SET_TIMEOUT); } ",0 "static int filter_frame(AVFilterLink *inlink, AVFrame *in) { DelogoContext *s = inlink->dst->priv; AVFilterLink *outlink = inlink->dst->outputs[0]; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); AVFrame *out; int hsub0 = desc->log2_chroma_w; int vsub0 = desc->log2_chroma_h; int direct = 0; int plane; AVRational sar; if (av_frame_is_writable(in)) { direct = 1; out = in; } else { out = ff_get_video_buffer(outlink, outlink->w, outlink->h); if (!out) { av_frame_free(&in); return AVERROR(ENOMEM); } av_frame_copy_props(out, in); } sar = in->sample_aspect_ratio; /* Assume square pixels if SAR is unknown */ if (!sar.num) sar.num = sar.den = 1; for (plane = 0; plane < 4 && in->data[plane]; plane++) { int hsub = plane == 1 || plane == 2 ? hsub0 : 0; int vsub = plane == 1 || plane == 2 ? vsub0 : 0; apply_delogo(out->data[plane], out->linesize[plane], in ->data[plane], in ->linesize[plane], FF_CEIL_RSHIFT(inlink->w, hsub), FF_CEIL_RSHIFT(inlink->h, vsub), sar, s->x>>hsub, s->y>>vsub, /* Up and left borders were rounded down, inject lost bits * into width and height to avoid error accumulation */ FF_CEIL_RSHIFT(s->w + (s->x & ((1<h + (s->y & ((1<band>>FFMIN(hsub, vsub), s->show, direct); } if (!direct) av_frame_free(&in); return ff_filter_frame(outlink, out); } ",1 "void RTCPeerConnection::didChangeReadyState(ReadyState newState) { ASSERT(scriptExecutionContext()->isContextThread()); changeReadyState(newState); } ",0 "static int default_cu2_call(struct notifier_block *nfb, unsigned long action, void *data) { struct pt_regs *regs = data; switch (action) { default: die_if_kernel(""Unhandled kernel unaligned access or invalid "" ""instruction"", regs); /* Fall through */ case CU2_EXCEPTION: force_sig(SIGILL, current); } return NOTIFY_OK; } ",0 "poppler_page_get_selection_region (PopplerPage *page, gdouble scale, PopplerSelectionStyle style, PopplerRectangle *selection) { PDFRectangle poppler_selection; SelectionStyle selection_style = selectionStyleGlyph; GooList *list; GList *region = NULL; int i; poppler_selection.x1 = selection->x1; poppler_selection.y1 = selection->y1; poppler_selection.x2 = selection->x2; poppler_selection.y2 = selection->y2; switch (style) { case POPPLER_SELECTION_GLYPH: selection_style = selectionStyleGlyph; break; case POPPLER_SELECTION_WORD: selection_style = selectionStyleWord; break; case POPPLER_SELECTION_LINE: selection_style = selectionStyleLine; break; } #if defined (HAVE_CAIRO) TextPage *text; text = poppler_page_get_text_page (page); list = text->getSelectionRegion(&poppler_selection, selection_style, scale); #else TextOutputDev *text_dev; text_dev = poppler_page_get_text_output_dev (page); list = text_dev->getSelectionRegion(&poppler_selection, selection_style, scale); #endif for (i = 0; i < list->getLength(); i++) { PDFRectangle *selection_rect = (PDFRectangle *) list->get(i); PopplerRectangle *rect; rect = poppler_rectangle_new (); rect->x1 = selection_rect->x1; rect->y1 = selection_rect->y1; rect->x2 = selection_rect->x2; rect->y2 = selection_rect->y2; region = g_list_prepend (region, rect); delete selection_rect; } delete list; return g_list_reverse (region); } ",0 "static inline int notify_page_fault(struct pt_regs *regs) { int ret = 0; /* kprobe_running() needs smp_processor_id() */ if (kprobes_built_in() && !user_mode(regs)) { preempt_disable(); if (kprobe_running() && kprobe_fault_handler(regs, 14)) ret = 1; preempt_enable(); } return ret; } ",0 "static int enable_net_traffic(rtl8150_t * dev) { u8 cr, tcr, rcr, msr; if (!rtl8150_reset(dev)) { dev_warn(&dev->udev->dev, ""device reset failed\n""); } /* RCR bit7=1 attach Rx info at the end; =0 HW CRC (which is broken) */ rcr = 0x9e; tcr = 0xd8; cr = 0x0c; if (!(rcr & 0x80)) set_bit(RTL8150_HW_CRC, &dev->flags); set_registers(dev, RCR, 1, &rcr); set_registers(dev, TCR, 1, &tcr); set_registers(dev, CR, 1, &cr); get_registers(dev, MSR, 1, &msr); return 0; } ",0 "static bool ndisc_suppress_frag_ndisc(struct sk_buff *skb) { struct inet6_dev *idev = __in6_dev_get(skb->dev); if (!idev) return true; if (IP6CB(skb)->flags & IP6SKB_FRAGMENTED && idev->cnf.suppress_frag_ndisc) { net_warn_ratelimited(""Received fragmented ndisc packet. Carefully consider disabling suppress_frag_ndisc.\n""); return true; } return false; } ",0 "gs_main_run_string_with_length(gs_main_instance * minst, const char *str, uint length, int user_errors, int *pexit_code, ref * perror_object) { int code; code = gs_main_run_string_begin(minst, user_errors, pexit_code, perror_object); if (code < 0) return code; code = gs_main_run_string_continue(minst, str, length, user_errors, pexit_code, perror_object); if (code != gs_error_NeedInput) return code; return gs_main_run_string_end(minst, user_errors, pexit_code, perror_object); } ",0 "static void staticReadOnlyLongAttrAttributeGetter(const v8::PropertyCallbackInfo& info) { v8SetReturnValueInt(info, TestObject::staticReadOnlyLongAttr()); } ",0 "static int decode_close(struct xdr_stream *xdr, struct nfs_closeres *res) { int status; status = decode_op_hdr(xdr, OP_CLOSE); if (status != -EIO) nfs_increment_open_seqid(status, res->seqid); if (!status) status = decode_stateid(xdr, &res->stateid); return status; } ",0 "static struct ctl_dir *get_subdir(struct ctl_dir *dir, const char *name, int namelen) { struct ctl_table_set *set = dir->header.set; struct ctl_dir *subdir, *new = NULL; int err; spin_lock(&sysctl_lock); subdir = find_subdir(dir, name, namelen); if (!IS_ERR(subdir)) goto found; if (PTR_ERR(subdir) != -ENOENT) goto failed; spin_unlock(&sysctl_lock); new = new_dir(set, name, namelen); spin_lock(&sysctl_lock); subdir = ERR_PTR(-ENOMEM); if (!new) goto failed; /* Was the subdir added while we dropped the lock? */ subdir = find_subdir(dir, name, namelen); if (!IS_ERR(subdir)) goto found; if (PTR_ERR(subdir) != -ENOENT) goto failed; /* Nope. Use the our freshly made directory entry. */ err = insert_header(dir, &new->header); subdir = ERR_PTR(err); if (err) goto failed; subdir = new; found: subdir->header.nreg++; failed: if (IS_ERR(subdir)) { pr_err(""sysctl could not get directory: ""); sysctl_print_dir(dir); pr_cont(""/%*.*s %ld\n"", namelen, namelen, name, PTR_ERR(subdir)); } drop_sysctl_table(&dir->header); if (new) drop_sysctl_table(&new->header); spin_unlock(&sysctl_lock); return subdir; } ",0 "static void voidMethodInt32ArrayArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodInt32ArrayArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static int cipso_v4_map_lvl_valid(const struct cipso_v4_doi *doi_def, u8 level) { switch (doi_def->type) { case CIPSO_V4_MAP_PASS: return 0; case CIPSO_V4_MAP_TRANS: if (doi_def->map.std->lvl.cipso[level] < CIPSO_V4_INV_LVL) return 0; break; } return -EFAULT; } ",0 "static void sctp_do_ecn_cwr_work(struct sctp_association *asoc, __u32 lowest_tsn) { /* Turn off ECNE getting auto-prepended to every outgoing * packet */ asoc->need_ecne = 0; } ",0 "static void _ewk_frame_smart_add(Evas_Object* ewkFrame) { EWK_FRAME_SD_GET(ewkFrame, smartData); if (!smartData) { smartData = static_cast(calloc(1, sizeof(Ewk_Frame_Smart_Data))); if (!smartData) { CRITICAL(""could not allocate Ewk_Frame_Smart_Data""); return; } evas_object_smart_data_set(ewkFrame, smartData); } smartData->self = ewkFrame; _parent_sc.add(ewkFrame); evas_object_static_clip_set(smartData->base.clipper, false); evas_object_move(smartData->base.clipper, 0, 0); evas_object_resize(smartData->base.clipper, 0, 0); #ifdef EWK_FRAME_DEBUG smartData->region = evas_object_rectangle_add(smartData->base.evas); static int i = 0; switch (i) { case 0: evas_object_color_set(smartData->region, 128, 0, 0, 128); break; case 1: evas_object_color_set(smartData->region, 0, 128, 0, 128); break; case 2: evas_object_color_set(smartData->region, 0, 0, 128, 128); break; case 3: evas_object_color_set(smartData->region, 128, 0, 0, 128); break; case 4: evas_object_color_set(smartData->region, 128, 128, 0, 128); break; case 5: evas_object_color_set(smartData->region, 128, 0, 128, 128); break; case 6: evas_object_color_set(smartData->region, 0, 128, 128, 128); break; default: break; } i++; if (i > 6) i = 0; evas_object_smart_member_add(smartData->region, ewkFrame); evas_object_hide(smartData->region); #endif } ",0 "void ftyp_del(GF_Box *s) { GF_FileTypeBox *ptr = (GF_FileTypeBox *) s; if (ptr->altBrand) gf_free(ptr->altBrand); gf_free(ptr); } ",0 "static inline void vrend_fill_shader_key(struct vrend_context *ctx, struct vrend_shader_key *key) { if (vrend_state.use_core_profile == true) { int i; bool add_alpha_test = true; key->cbufs_are_a8_bitmask = 0; for (i = 0; i < ctx->sub->nr_cbufs; i++) { if (!ctx->sub->surf[i]) continue; if (vrend_format_is_emulated_alpha(ctx->sub->surf[i]->format)) key->cbufs_are_a8_bitmask |= (1 << i); if (util_format_is_pure_integer(ctx->sub->surf[i]->format)) add_alpha_test = false; } if (add_alpha_test) { key->add_alpha_test = ctx->sub->dsa_state.alpha.enabled; key->alpha_test = ctx->sub->dsa_state.alpha.func; key->alpha_ref_val = ctx->sub->dsa_state.alpha.ref_value; } key->pstipple_tex = ctx->sub->rs_state.poly_stipple_enable; key->color_two_side = ctx->sub->rs_state.light_twoside; key->clip_plane_enable = ctx->sub->rs_state.clip_plane_enable; key->flatshade = ctx->sub->rs_state.flatshade ? true : false; } else { key->add_alpha_test = 0; key->pstipple_tex = 0; } key->invert_fs_origin = !ctx->sub->inverted_fbo_content; key->coord_replace = ctx->sub->rs_state.point_quad_rasterization ? ctx->sub->rs_state.sprite_coord_enable : 0; if (ctx->sub->shaders[PIPE_SHADER_GEOMETRY]) key->gs_present = true; } ",0 "store_tabletExecute(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct aiptek *aiptek = dev_get_drvdata(dev); /* We do not care what you write to this file. Merely the action * of writing to this file triggers a tablet reprogramming. */ memcpy(&aiptek->curSetting, &aiptek->newSetting, sizeof(struct aiptek_settings)); if (aiptek_program_tablet(aiptek) < 0) return -EIO; return count; } ",0 "void gdImageStringUp (gdImagePtr im, gdFontPtr f, int x, int y, unsigned char *s, int color) { int i; int l; l = strlen ((char *) s); for (i = 0; (i < l); i++) { gdImageCharUp(im, f, x, y, s[i], color); y -= f->w; } } ",0 "MockDownloadFile* MockDownloadFileFactory::GetExistingFile( const DownloadId& id) { DCHECK(files_.find(id) != files_.end()); return files_[id]; } ",0 "pp::VarDictionary TraverseBookmarks(FPDF_DOCUMENT doc, FPDF_BOOKMARK bookmark, unsigned int depth) { pp::VarDictionary dict; base::string16 title; unsigned long buffer_size = FPDFBookmark_GetTitle(bookmark, nullptr, 0); if (buffer_size > 0) { PDFiumAPIStringBufferSizeInBytesAdapter api_string_adapter( &title, buffer_size, true); api_string_adapter.Close(FPDFBookmark_GetTitle( bookmark, api_string_adapter.GetData(), buffer_size)); } dict.Set(pp::Var(""title""), pp::Var(base::UTF16ToUTF8(title))); FPDF_DEST dest = FPDFBookmark_GetDest(doc, bookmark); if (dest) { int page_index = FPDFDest_GetPageIndex(doc, dest); dict.Set(pp::Var(""page""), pp::Var(page_index)); } else { FPDF_ACTION action = FPDFBookmark_GetAction(bookmark); buffer_size = FPDFAction_GetURIPath(doc, action, nullptr, 0); if (buffer_size > 0) { std::string uri; PDFiumAPIStringBufferAdapter api_string_adapter(&uri, buffer_size, true); api_string_adapter.Close(FPDFAction_GetURIPath( doc, action, api_string_adapter.GetData(), buffer_size)); dict.Set(pp::Var(""uri""), pp::Var(uri)); } } pp::VarArray children; const unsigned int kMaxDepth = 128; if (depth < kMaxDepth) { int child_index = 0; std::set seen_bookmarks; for (FPDF_BOOKMARK child_bookmark = FPDFBookmark_GetFirstChild(doc, bookmark); child_bookmark; child_bookmark = FPDFBookmark_GetNextSibling(doc, child_bookmark)) { if (base::ContainsKey(seen_bookmarks, child_bookmark)) break; seen_bookmarks.insert(child_bookmark); children.Set(child_index, TraverseBookmarks(doc, child_bookmark, depth + 1)); child_index++; } } dict.Set(pp::Var(""children""), children); return dict; } ",0 "static void uvesafb_exit(void) { struct uvesafb_ktask *task; if (v86d_started) { task = uvesafb_prep(); if (task) { task->t.flags = TF_EXIT; uvesafb_exec(task); uvesafb_free(task); } } cn_del_callback(&uvesafb_cn_id); driver_remove_file(&uvesafb_driver.driver, &driver_attr_v86d); platform_device_unregister(uvesafb_device); platform_driver_unregister(&uvesafb_driver); } ",0 "bool InputType::CanSetStringValue() const { return true; } ",0 "void AppLauncherHandler::HandleSetLaunchType(const base::ListValue* args) { std::string extension_id; double launch_type; CHECK(args->GetString(0, &extension_id)); CHECK(args->GetDouble(1, &launch_type)); const Extension* extension = extension_service_->GetExtensionById(extension_id, true); if (!extension) return; base::AutoReset auto_reset(&ignore_changes_, true); extensions::SetLaunchType( extension_service_, extension_id, static_cast(static_cast(launch_type))); } ",0 "inline SVGFEColorMatrixElement::SVGFEColorMatrixElement(Document& document) : SVGFilterPrimitiveStandardAttributes(SVGNames::feColorMatrixTag, document) , m_values(SVGAnimatedNumberList::create(this, SVGNames::valuesAttr, SVGNumberList::create())) , m_in1(SVGAnimatedString::create(this, SVGNames::inAttr, SVGString::create())) , m_type(SVGAnimatedEnumeration::create(this, SVGNames::typeAttr, FECOLORMATRIX_TYPE_MATRIX)) { addToPropertyMap(m_values); addToPropertyMap(m_in1); addToPropertyMap(m_type); } ",0 "static void virgl_cmd_set_scanout(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_set_scanout ss; struct virgl_renderer_resource_info info; int ret; VIRTIO_GPU_FILL_CMD(ss); trace_virtio_gpu_cmd_set_scanout(ss.scanout_id, ss.resource_id, ss.r.width, ss.r.height, ss.r.x, ss.r.y); if (ss.scanout_id >= g->conf.max_outputs) { qemu_log_mask(LOG_GUEST_ERROR, ""%s: illegal scanout id specified %d"", __func__, ss.scanout_id); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_SCANOUT_ID; return; } g->enable = 1; memset(&info, 0, sizeof(info)); if (ss.resource_id && ss.r.width && ss.r.height) { ret = virgl_renderer_resource_get_info(ss.resource_id, &info); if (ret == -1) { qemu_log_mask(LOG_GUEST_ERROR, ""%s: illegal resource specified %d\n"", __func__, ss.resource_id); cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID; return; } qemu_console_resize(g->scanout[ss.scanout_id].con, ss.r.width, ss.r.height); virgl_renderer_force_ctx_0(); dpy_gl_scanout(g->scanout[ss.scanout_id].con, info.tex_id, info.flags & 1 /* FIXME: Y_0_TOP */, info.width, info.height, ss.r.x, ss.r.y, ss.r.width, ss.r.height); } else { if (ss.scanout_id != 0) { dpy_gfx_replace_surface(g->scanout[ss.scanout_id].con, NULL); } dpy_gl_scanout(g->scanout[ss.scanout_id].con, 0, false, 0, 0, 0, 0, 0, 0); } g->scanout[ss.scanout_id].resource_id = ss.resource_id; } ",0 "static void genl_unbind(struct net *net, int group) { struct genl_family *f; unsigned int id; down_read(&cb_lock); idr_for_each_entry(&genl_fam_idr, f, id) { if (group >= f->mcgrp_offset && group < f->mcgrp_offset + f->n_mcgrps) { int fam_grp = group - f->mcgrp_offset; if (f->mcast_unbind) f->mcast_unbind(net, fam_grp); break; } } up_read(&cb_lock); } ",0 "static int __init set_thash_entries(char *str) { ssize_t ret; if (!str) return 0; ret = kstrtoul(str, 0, &thash_entries); if (ret) return 0; return 1; } ",0 "e1000e_update_rx_stats(E1000ECore *core, size_t data_size, size_t data_fcs_size) { e1000x_update_rx_total_stats(core->mac, data_size, data_fcs_size); switch (net_rx_pkt_get_packet_type(core->rx_pkt)) { case ETH_PKT_BCAST: e1000x_inc_reg_if_not_full(core->mac, BPRC); break; case ETH_PKT_MCAST: e1000x_inc_reg_if_not_full(core->mac, MPRC); break; default: break; } } ",0 "ripng_print(netdissect_options *ndo, const u_char *dat, unsigned int length) { register const struct rip6 *rp = (const struct rip6 *)dat; register const struct netinfo6 *ni; register u_int amt; register u_int i; int j; int trunc; if (ndo->ndo_snapend < dat) return; amt = ndo->ndo_snapend - dat; i = min(length, amt); if (i < (sizeof(struct rip6) - sizeof(struct netinfo6))) return; i -= (sizeof(struct rip6) - sizeof(struct netinfo6)); switch (rp->rip6_cmd) { case RIP6_REQUEST: j = length / sizeof(*ni); if (j == 1 && rp->rip6_nets->rip6_metric == HOPCNT_INFINITY6 && IN6_IS_ADDR_UNSPECIFIED(&rp->rip6_nets->rip6_dest)) { ND_PRINT((ndo, "" ripng-req dump"")); break; } if (j * sizeof(*ni) != length - 4) ND_PRINT((ndo, "" ripng-req %d[%u]:"", j, length)); else ND_PRINT((ndo, "" ripng-req %d:"", j)); trunc = ((i / sizeof(*ni)) * sizeof(*ni) != i); for (ni = rp->rip6_nets; i >= sizeof(*ni); i -= sizeof(*ni), ++ni) { if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""\n\t"")); else ND_PRINT((ndo, "" "")); rip6_entry_print(ndo, ni, 0); } break; case RIP6_RESPONSE: j = length / sizeof(*ni); if (j * sizeof(*ni) != length - 4) ND_PRINT((ndo, "" ripng-resp %d[%u]:"", j, length)); else ND_PRINT((ndo, "" ripng-resp %d:"", j)); trunc = ((i / sizeof(*ni)) * sizeof(*ni) != i); for (ni = rp->rip6_nets; i >= sizeof(*ni); i -= sizeof(*ni), ++ni) { if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""\n\t"")); else ND_PRINT((ndo, "" "")); rip6_entry_print(ndo, ni, ni->rip6_metric); } if (trunc) ND_PRINT((ndo, ""[|ripng]"")); break; default: ND_PRINT((ndo, "" ripng-%d ?? %u"", rp->rip6_cmd, length)); break; } if (rp->rip6_vers != RIP6_VERSION) ND_PRINT((ndo, "" [vers %d]"", rp->rip6_vers)); } ",1 "SYSCALL_DEFINE1(epoll_create1, int, flags) { int error, fd; struct eventpoll *ep = NULL; struct file *file; /* Check the EPOLL_* constant for consistency. */ BUILD_BUG_ON(EPOLL_CLOEXEC != O_CLOEXEC); if (flags & ~EPOLL_CLOEXEC) return -EINVAL; /* * Create the internal data structure (""struct eventpoll""). */ error = ep_alloc(&ep); if (error < 0) return error; /* * Creates all the items needed to setup an eventpoll file. That is, * a file structure and a free file descriptor. */ fd = get_unused_fd_flags(O_RDWR | (flags & O_CLOEXEC)); if (fd < 0) { error = fd; goto out_free_ep; } file = anon_inode_getfile(""[eventpoll]"", &eventpoll_fops, ep, O_RDWR | (flags & O_CLOEXEC)); if (IS_ERR(file)) { error = PTR_ERR(file); goto out_free_fd; } fd_install(fd, file); ep->file = file; return fd; out_free_fd: put_unused_fd(fd); out_free_ep: ep_free(ep); return error; } ",0 "static void addrconf_sysctl_unregister(struct inet6_dev *idev) { __addrconf_sysctl_unregister(&idev->cnf); neigh_sysctl_unregister(idev->nd_parms); } ",0 "static void x86_pmu_stop(struct perf_event *event, int flags) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); struct hw_perf_event *hwc = &event->hw; if (__test_and_clear_bit(hwc->idx, cpuc->active_mask)) { x86_pmu.disable(event); cpuc->events[hwc->idx] = NULL; WARN_ON_ONCE(hwc->state & PERF_HES_STOPPED); hwc->state |= PERF_HES_STOPPED; } if ((flags & PERF_EF_UPDATE) && !(hwc->state & PERF_HES_UPTODATE)) { /* * Drain the remaining delta count out of a event * that we are disabling: */ x86_perf_event_update(event); hwc->state |= PERF_HES_UPTODATE; } } ",0 "static MagickOffsetType TIFFSeekCustomStream(const MagickOffsetType offset, const int whence,void *user_data) { PhotoshopProfile *profile; profile=(PhotoshopProfile *) user_data; switch (whence) { case SEEK_SET: default: { if (offset < 0) return(-1); profile->offset=offset; break; } case SEEK_CUR: { if ((profile->offset+offset) < 0) return(-1); profile->offset+=offset; break; } case SEEK_END: { if (((MagickOffsetType) profile->length+offset) < 0) return(-1); profile->offset=profile->length+offset; break; } } return(profile->offset); } ",1 "static struct pgv *alloc_pg_vec(struct tpacket_req *req, int order) { unsigned int block_nr = req->tp_block_nr; struct pgv *pg_vec; int i; pg_vec = kcalloc(block_nr, sizeof(struct pgv), GFP_KERNEL); if (unlikely(!pg_vec)) goto out; for (i = 0; i < block_nr; i++) { pg_vec[i].buffer = alloc_one_pg_vec_page(order); if (unlikely(!pg_vec[i].buffer)) goto out_free_pgvec; } out: return pg_vec; out_free_pgvec: free_pg_vec(pg_vec, order, block_nr); pg_vec = NULL; goto out; } ",0 "proto_register_dcerpc_spoolss(void) { static hf_register_info hf[] = { /* GetPrinterDriver2 */ { &hf_clientmajorversion, { ""Client major version"", ""spoolss.clientmajorversion"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Client printer driver major version"", HFILL }}, { &hf_clientminorversion, { ""Client minor version"", ""spoolss.clientminorversion"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Client printer driver minor version"", HFILL }}, { &hf_servermajorversion, { ""Server major version"", ""spoolss.servermajorversion"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Server printer driver major version"", HFILL }}, { &hf_serverminorversion, { ""Server minor version"", ""spoolss.serverminorversion"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Server printer driver minor version"", HFILL }}, { &hf_driverpath, { ""Driver path"", ""spoolss.driverpath"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_datafile, { ""Data file"", ""spoolss.datafile"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_configfile, { ""Config file"", ""spoolss.configfile"", FT_STRING, BASE_NONE, NULL, 0, ""Printer name"", HFILL }}, { &hf_helpfile, { ""Help file"", ""spoolss.helpfile"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_monitorname, { ""Monitor name"", ""spoolss.monitorname"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_defaultdatatype, { ""Default data type"", ""spoolss.defaultdatatype"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_driverinfo_cversion, { ""Driver version"", ""spoolss.driverversion"", FT_UINT32, BASE_DEC, VALS(driverinfo_cversion_vals), 0, ""Printer name"", HFILL }}, { &hf_dependentfiles, { ""Dependent files"", ""spoolss.dependentfiles"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_printer_status, { ""Status"", ""spoolss.printer_status"", FT_UINT32, BASE_DEC|BASE_EXT_STRING, &printer_status_vals_ext, 0, NULL, HFILL }}, { &hf_previousdrivernames, { ""Previous Driver Names"", ""spoolss.previousdrivernames"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_driverdate, { ""Driver Date"", ""spoolss.driverdate"", FT_ABSOLUTE_TIME, ABSOLUTE_TIME_LOCAL, NULL, 0, ""Date of driver creation"", HFILL }}, { &hf_padding, { ""Padding"", ""spoolss.padding"", FT_UINT32, BASE_HEX, NULL, 0, ""Some padding - conveys no semantic information"", HFILL }}, { &hf_driver_version_low, { ""Minor Driver Version"", ""spoolss.minordriverversion"", FT_UINT32, BASE_DEC, NULL, 0, ""Driver Version Low"", HFILL }}, { &hf_driver_version_high, { ""Major Driver Version"", ""spoolss.majordriverversion"", FT_UINT32, BASE_DEC, NULL, 0, ""Driver Version High"", HFILL }}, { &hf_mfgname, { ""Mfgname"", ""spoolss.mfgname"", FT_STRING, BASE_NONE, NULL, 0, ""Manufacturer Name"", HFILL }}, { &hf_oemurl, { ""OEM URL"", ""spoolss.oemrul"", FT_STRING, BASE_NONE, NULL, 0, ""OEM URL - Website of Vendor"", HFILL }}, { &hf_hardwareid, { ""Hardware ID"", ""spoolss.hardwareid"", FT_STRING, BASE_NONE, NULL, 0, ""Hardware Identification Information"", HFILL }}, { &hf_provider, { ""Provider"", ""spoolss.provider"", FT_STRING, BASE_NONE, NULL, 0, ""Provider of Driver"", HFILL }}, /* Setprinter RPC */ { &hf_setprinter_cmd, { ""Command"", ""spoolss.setprinter_cmd"", FT_UINT32, BASE_DEC, VALS(setprinter_cmd_vals), 0, NULL, HFILL }}, /* Enumprinters */ { &hf_enumprinters_flags, { ""Flags"", ""spoolss.enumprinters.flags"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_enumprinters_flags_local, { ""Enum local"", ""spoolss.enumprinters.flags.enum_local"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ENUM_LOCAL, NULL, HFILL }}, { &hf_enumprinters_flags_name, { ""Enum name"", ""spoolss.enumprinters.flags.enum_name"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ENUM_NAME, NULL, HFILL }}, { &hf_enumprinters_flags_shared, { ""Enum shared"", ""spoolss.enumprinters.flags.enum_shared"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ENUM_SHARED, NULL, HFILL }}, { &hf_enumprinters_flags_default, { ""Enum default"", ""spoolss.enumprinters.flags.enum_default"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ENUM_DEFAULT, NULL, HFILL }}, { &hf_enumprinters_flags_connections, { ""Enum connections"", ""spoolss.enumprinters.flags.enum_connections"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ENUM_CONNECTIONS, NULL, HFILL }}, { &hf_enumprinters_flags_network, { ""Enum network"", ""spoolss.enumprinters.flags.enum_network"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ENUM_NETWORK, NULL, HFILL }}, { &hf_enumprinters_flags_remote, { ""Enum remote"", ""spoolss.enumprinters.flags.enum_remote"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ENUM_REMOTE, NULL, HFILL }}, /* GetPrinter */ { &hf_start_time, { ""Start time"", ""spoolss.start_time"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_end_time, { ""End time"", ""spoolss.end_time"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_elapsed_time, { ""Elapsed time"", ""spoolss.elapsed_time"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, /* * New hf index values */ { &hf_opnum, { ""Operation"", ""spoolss.opnum"", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_hnd, { ""Context handle"", ""spoolss.hnd"", FT_BYTES, BASE_NONE, NULL, 0x0, ""SPOOLSS policy handle"", HFILL }}, { &hf_rc, { ""Return code"", ""spoolss.rc"", FT_UINT32, BASE_HEX | BASE_EXT_STRING, &DOS_errors_ext, 0x0, ""SPOOLSS return code"", HFILL }}, { &hf_offered, { ""Offered"", ""spoolss.offered"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Size of buffer offered in this request"", HFILL }}, { &hf_needed, { ""Needed"", ""spoolss.needed"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Size of buffer required for request"", HFILL }}, { &hf_returned, { ""Returned"", ""spoolss.returned"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Number of items returned"", HFILL }}, { &hf_buffer_size, { ""Buffer size"", ""spoolss.buffer.size"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Size of buffer"", HFILL }}, { &hf_buffer_data, { ""Buffer data"", ""spoolss.buffer.data"", FT_BYTES, BASE_NONE, NULL, 0x0, ""Contents of buffer"", HFILL }}, { &hf_string_parm_size, { ""String buffer size"", ""spoolss.string.buffersize"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Size of string buffer"", HFILL }}, { &hf_string_parm_data, { ""String data"", ""spoolss.string.data"", FT_STRINGZ, BASE_NONE, NULL, 0x0, ""Contents of string"", HFILL }}, { &hf_offset, { ""Offset"", ""spoolss.offset"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Offset of data"", HFILL }}, { &hf_level, { ""Info level"", ""spoolss.enumjobs.level"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_printername, { ""Printer name"", ""spoolss.printername"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_machinename, { ""Machine name"", ""spoolss.machinename"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_notifyname, { ""Notify name"", ""spoolss.notifyname"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_printerdesc, { ""Printer description"", ""spoolss.printerdesc"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_printercomment, { ""Printer comment"", ""spoolss.printercomment"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_servername, { ""Server name"", ""spoolss.servername"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_sharename, { ""Share name"", ""spoolss.sharename"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_portname, { ""Port name"", ""spoolss.portname"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_printerlocation, { ""Printer location"", ""spoolss.printerlocation"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_environment, { ""Environment name"", ""spoolss.environment"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_drivername, { ""Driver name"", ""spoolss.drivername"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_username, { ""User name"", ""spoolss.username"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_documentname, { ""Document name"", ""spoolss.document"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_outputfile, { ""Output file"", ""spoolss.outputfile"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_datatype, { ""Datatype"", ""spoolss.datatype"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_textstatus, { ""Text status"", ""spoolss.textstatus"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_sepfile, { ""Separator file"", ""spoolss.setpfile"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_parameters, { ""Parameters"", ""spoolss.parameters"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_printprocessor, { ""Print processor"", ""spoolss.printprocessor"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, /* Printer data */ { &hf_printerdata, { ""Data"", ""spoolss.printerdata"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_printerdata_key, { ""Key"", ""spoolss.printerdata.key"", FT_STRING, BASE_NONE, NULL, 0, ""Printer data key"", HFILL }}, { &hf_printerdata_value, { ""Value"", ""spoolss.printerdata.value"", FT_STRING, BASE_NONE, NULL, 0, ""Printer data value"", HFILL }}, { &hf_printerdata_type, { ""Type"", ""spoolss.printerdata.type"", FT_UINT32, BASE_DEC|BASE_EXT_STRING, ®_datatypes_ext, 0, ""Printer data type"", HFILL }}, { &hf_printerdata_size, { ""Size"", ""spoolss.printerdata.size"", FT_UINT32, BASE_DEC, NULL, 0, ""Printer data size"", HFILL }}, { &hf_printerdata_data, { ""Data"", ""spoolss.printerdata.data"", FT_BYTES, BASE_NONE, NULL, 0x0, ""Printer data"", HFILL }}, { &hf_printerdata_data_dword, { ""DWORD data"", ""spoolss.printerdata.data.dword"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_printerdata_data_sz, { ""String data"", ""spoolss.printerdata.data.sz"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, /* Devicemode */ { &hf_devmodectr_size, { ""Devicemode ctr size"", ""spoolss.devicemodectr.size"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode, { ""Devicemode"", ""spoolss.devmode"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_devmode_size, { ""Size"", ""spoolss.devmode.size"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_spec_version, { ""Spec version"", ""spoolss.devmode.spec_version"", FT_UINT16, BASE_DEC, VALS(devmode_specversion_vals), 0, NULL, HFILL }}, { &hf_devmode_driver_version, { ""Driver version"", ""spoolss.devmode.driver_version"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_size2, { ""Size2"", ""spoolss.devmode.size2"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_fields, { ""Fields"", ""spoolss.devmode.fields"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_devmode_orientation, { ""Orientation"", ""spoolss.devmode.orientation"", FT_UINT16, BASE_DEC, VALS(devmode_orientation_vals), 0, NULL, HFILL }}, { &hf_devmode_paper_size, { ""Paper size"", ""spoolss.devmode.paper_size"", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &devmode_papersize_vals_ext, 0, NULL, HFILL }}, { &hf_devmode_paper_width, { ""Paper width"", ""spoolss.devmode.paper_width"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_paper_length, { ""Paper length"", ""spoolss.devmode.paper_length"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_scale, { ""Scale"", ""spoolss.devmode.scale"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_copies, { ""Copies"", ""spoolss.devmode.copies"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_default_source, { ""Default source"", ""spoolss.devmode.default_source"", FT_UINT16, BASE_DEC|BASE_EXT_STRING, &devmode_papersource_vals_ext, 0, NULL, HFILL }}, { &hf_devmode_print_quality, { ""Print quality"", ""spoolss.devmode.print_quality"", FT_UINT16, BASE_DEC, VALS(devmode_printquality_vals), 0, NULL, HFILL }}, { &hf_devmode_color, { ""Color"", ""spoolss.devmode.color"", FT_UINT16, BASE_DEC, VALS(devmode_colour_vals), 0, NULL, HFILL }}, { &hf_devmode_duplex, { ""Duplex"", ""spoolss.devmode.duplex"", FT_UINT16, BASE_DEC, VALS(devmode_duplex_vals), 0, NULL, HFILL }}, { &hf_devmode_y_resolution, { ""Y resolution"", ""spoolss.devmode.y_resolution"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_tt_option, { ""TT option"", ""spoolss.devmode.tt_option"", FT_UINT16, BASE_DEC, VALS(devmode_ttoption_vals), 0, NULL, HFILL }}, { &hf_devmode_collate, { ""Collate"", ""spoolss.devmode.collate"", FT_UINT16, BASE_DEC, VALS(devmode_collate_vals), 0, NULL, HFILL }}, { &hf_devmode_log_pixels, { ""Log pixels"", ""spoolss.devmode.log_pixels"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_bits_per_pel, { ""Bits per pel"", ""spoolss.devmode.bits_per_pel"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_pels_width, { ""Pels width"", ""spoolss.devmode.pels_width"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_pels_height, { ""Pels height"", ""spoolss.devmode.pels_height"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_display_flags, { ""Display flags"", ""spoolss.devmode.display_flags"", FT_UINT32, BASE_DEC, VALS(devmode_displayflags_vals), 0, NULL, HFILL }}, { &hf_devmode_display_freq, { ""Display frequency"", ""spoolss.devmode.display_freq"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_icm_method, { ""ICM method"", ""spoolss.devmode.icm_method"", FT_UINT32, BASE_DEC, VALS(devmode_icmmethod_vals), 0, NULL, HFILL }}, { &hf_devmode_icm_intent, { ""ICM intent"", ""spoolss.devmode.icm_intent"", FT_UINT32, BASE_DEC, VALS(devmode_icmintent_vals), 0, NULL, HFILL }}, { &hf_devmode_media_type, { ""Media type"", ""spoolss.devmode.media_type"", FT_UINT32, BASE_DEC, VALS(devmode_mediatype_vals), 0, NULL, HFILL }}, { &hf_devmode_dither_type, { ""Dither type"", ""spoolss.devmode.dither_type"", FT_UINT32, BASE_DEC, VALS(devmode_dithertype_vals), 0, NULL, HFILL }}, { &hf_devmode_reserved1, { ""Reserved1"", ""spoolss.devmode.reserved1"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_reserved2, { ""Reserved2"", ""spoolss.devmode.reserved2"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_panning_width, { ""Panning width"", ""spoolss.devmode.panning_width"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_panning_height, { ""Panning height"", ""spoolss.devmode.panning_height"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_driver_extra_len, { ""Driver extra length"", ""spoolss.devmode.driver_extra_len"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_driver_extra, { ""Driver extra"", ""spoolss.devmode.driver_extra"", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, /* Devicemode fields */ { &hf_devmode_fields_orientation, { ""Orientation"", ""spoolss.devmode.fields.orientation"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_ORIENTATION, NULL, HFILL }}, { &hf_devmode_fields_papersize, { ""Paper size"", ""spoolss.devmode.fields.paper_size"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_PAPERSIZE, NULL, HFILL }}, { &hf_devmode_fields_paperlength, { ""Paper length"", ""spoolss.devmode.fields.paper_length"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_PAPERLENGTH, NULL, HFILL }}, { &hf_devmode_fields_paperwidth, { ""Paper width"", ""spoolss.devmode.fields.paper_width"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_PAPERWIDTH, NULL, HFILL }}, { &hf_devmode_fields_scale, { ""Scale"", ""spoolss.devmode.fields.scale"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_SCALE, NULL, HFILL }}, { &hf_devmode_fields_position, { ""Position"", ""spoolss.devmode.fields.position"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_POSITION, NULL, HFILL }}, { &hf_devmode_fields_nup, { ""N-up"", ""spoolss.devmode.fields.nup"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_NUP, NULL, HFILL }}, { &hf_devmode_fields_copies, { ""Copies"", ""spoolss.devmode.fields.copies"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_COPIES, NULL, HFILL }}, { &hf_devmode_fields_defaultsource, { ""Default source"", ""spoolss.devmode.fields.default_source"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_DEFAULTSOURCE, NULL, HFILL }}, { &hf_devmode_fields_printquality, { ""Print quality"", ""spoolss.devmode.fields.print_quality"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_PRINTQUALITY, NULL, HFILL }}, { &hf_devmode_fields_color, { ""Color"", ""spoolss.devmode.fields.color"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_COLOR, NULL, HFILL }}, { &hf_devmode_fields_duplex, { ""Duplex"", ""spoolss.devmode.fields.duplex"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_DUPLEX, NULL, HFILL }}, { &hf_devmode_fields_yresolution, { ""Y resolution"", ""spoolss.devmode.fields.y_resolution"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_YRESOLUTION, NULL, HFILL }}, { &hf_devmode_fields_ttoption, { ""TT option"", ""spoolss.devmode.fields.tt_option"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_TTOPTION, NULL, HFILL }}, { &hf_devmode_fields_collate, { ""Collate"", ""spoolss.devmode.fields.collate"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_COLLATE, NULL, HFILL }}, { &hf_devmode_fields_formname, { ""Form name"", ""spoolss.devmode.fields.form_name"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_FORMNAME, NULL, HFILL }}, { &hf_devmode_fields_logpixels, { ""Log pixels"", ""spoolss.devmode.fields.log_pixels"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_LOGPIXELS, NULL, HFILL }}, { &hf_devmode_fields_bitsperpel, { ""Bits per pel"", ""spoolss.devmode.fields.bits_per_pel"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_BITSPERPEL, NULL, HFILL }}, { &hf_devmode_fields_pelswidth, { ""Pels width"", ""spoolss.devmode.fields.pels_width"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_PELSWIDTH, NULL, HFILL }}, { &hf_devmode_fields_pelsheight, { ""Pels height"", ""spoolss.devmode.fields.pels_height"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_PELSHEIGHT, NULL, HFILL }}, { &hf_devmode_fields_displayflags, { ""Display flags"", ""spoolss.devmode.fields.display_flags"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_DISPLAYFLAGS, NULL, HFILL }}, { &hf_devmode_fields_displayfrequency, { ""Display frequency"", ""spoolss.devmode.fields.display_frequency"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_DISPLAYFREQUENCY, NULL, HFILL }}, { &hf_devmode_fields_icmmethod, { ""ICM method"", ""spoolss.devmode.fields.icm_method"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_ICMMETHOD, NULL, HFILL }}, { &hf_devmode_fields_icmintent, { ""ICM intent"", ""spoolss.devmode.fields.icm_intent"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_ICMINTENT, NULL, HFILL }}, { &hf_devmode_fields_mediatype, { ""Media type"", ""spoolss.devmode.fields.media_type"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_MEDIATYPE, NULL, HFILL }}, { &hf_devmode_fields_dithertype, { ""Dither type"", ""spoolss.devmode.fields.dither_type"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_DITHERTYPE, NULL, HFILL }}, { &hf_devmode_fields_panningwidth, { ""Panning width"", ""spoolss.devmode.fields.panning_width"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_PANNINGWIDTH, NULL, HFILL }}, { &hf_devmode_fields_panningheight, { ""Panning height"", ""spoolss.devmode.fields.panning_height"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), DEVMODE_PANNINGHEIGHT, NULL, HFILL }}, /* EnumPrinterData RPC */ { &hf_enumprinterdata_enumindex, { ""Enum index"", ""spoolss.enumprinterdata.enumindex"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Index for start of enumeration"", HFILL }}, { &hf_enumprinterdata_value_offered, { ""Value size offered"", ""spoolss.enumprinterdata.value_offered"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Buffer size offered for printerdata value"", HFILL }}, { &hf_enumprinterdata_data_offered, { ""Data size offered"", ""spoolss.enumprinterdata.data_offered"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Buffer size offered for printerdata data"", HFILL }}, { &hf_enumprinterdata_value_len, { ""Value length"", ""spoolss.enumprinterdata.value_len"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Size of printerdata value"", HFILL }}, { &hf_enumprinterdata_value_needed, { ""Value size needed"", ""spoolss.enumprinterdata.value_needed"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Buffer size needed for printerdata value"", HFILL }}, { &hf_enumprinterdata_data_needed, { ""Data size needed"", ""spoolss.enumprinterdata.data_needed"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Buffer size needed for printerdata data"", HFILL }}, /* Print jobs */ { &hf_job_id, { ""Job ID"", ""spoolss.job.id"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Job identification number"", HFILL }}, { &hf_job_status, { ""Job status"", ""spoolss.job.status"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_job_status_paused, { ""Paused"", ""spoolss.job.status.paused"", FT_BOOLEAN, 32, TFS(&tfs_job_status_paused), JOB_STATUS_PAUSED, NULL, HFILL }}, { &hf_job_status_error, { ""Error"", ""spoolss.job.status.error"", FT_BOOLEAN, 32, TFS(&tfs_job_status_error), JOB_STATUS_ERROR, NULL, HFILL }}, { &hf_job_status_deleting, { ""Deleting"", ""spoolss.job.status.deleting"", FT_BOOLEAN, 32, TFS(&tfs_job_status_deleting), JOB_STATUS_DELETING, NULL, HFILL }}, { &hf_job_status_spooling, { ""Spooling"", ""spoolss.job.status.spooling"", FT_BOOLEAN, 32, TFS(&tfs_job_status_spooling), JOB_STATUS_SPOOLING, NULL, HFILL }}, { &hf_job_status_printing, { ""Printing"", ""spoolss.job.status.printing"", FT_BOOLEAN, 32, TFS(&tfs_job_status_printing), JOB_STATUS_PRINTING, NULL, HFILL }}, { &hf_job_status_offline, { ""Offline"", ""spoolss.job.status.offline"", FT_BOOLEAN, 32, TFS(&tfs_job_status_offline), JOB_STATUS_OFFLINE, NULL, HFILL }}, { &hf_job_status_paperout, { ""Paperout"", ""spoolss.job.status.paperout"", FT_BOOLEAN, 32, TFS(&tfs_job_status_paperout), JOB_STATUS_PAPEROUT, NULL, HFILL }}, { &hf_job_status_printed, { ""Printed"", ""spoolss.job.status.printed"", FT_BOOLEAN, 32, TFS(&tfs_job_status_printed), JOB_STATUS_PRINTED, NULL, HFILL }}, { &hf_job_status_deleted, { ""Deleted"", ""spoolss.job.status.deleted"", FT_BOOLEAN, 32, TFS(&tfs_job_status_deleted), JOB_STATUS_DELETED, NULL, HFILL }}, { &hf_job_status_blocked, { ""Blocked"", ""spoolss.job.status.blocked"", FT_BOOLEAN, 32, TFS(&tfs_job_status_blocked), JOB_STATUS_BLOCKED, NULL, HFILL }}, { &hf_job_status_user_intervention, { ""User intervention"", ""spoolss.job.status.user_intervention"", FT_BOOLEAN, 32, TFS(&tfs_job_status_user_intervention), JOB_STATUS_USER_INTERVENTION, NULL, HFILL }}, { &hf_job_priority, { ""Job priority"", ""spoolss.job.priority"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_job_position, { ""Job position"", ""spoolss.job.position"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_job_totalpages, { ""Job total pages"", ""spoolss.job.totalpages"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_job_totalbytes, { ""Job total bytes"", ""spoolss.job.totalbytes"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_job_bytesprinted, { ""Job bytes printed"", ""spoolss.job.bytesprinted"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_job_pagesprinted, { ""Job pages printed"", ""spoolss.job.pagesprinted"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_job_size, { ""Job size"", ""spoolss.job.size"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, /* Forms */ { &hf_form, { ""Data"", ""spoolss.form"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_form_level, { ""Level"", ""spoolss.form.level"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_form_name, { ""Name"", ""spoolss.form.name"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_form_flags, { ""Flags"", ""spoolss.form.flags"", FT_UINT32, BASE_DEC, VALS(form_type_vals), 0, NULL, HFILL }}, { &hf_form_unknown, { ""Unknown"", ""spoolss.form.unknown"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_form_width, { ""Width"", ""spoolss.form.width"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_form_height, { ""Height"", ""spoolss.form.height"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_form_left_margin, { ""Left margin"", ""spoolss.form.left"", FT_UINT32, BASE_DEC, NULL, 0, ""Left"", HFILL }}, { &hf_form_top_margin, { ""Top"", ""spoolss.form.top"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_form_horiz_len, { ""Horizontal"", ""spoolss.form.horiz"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_form_vert_len, { ""Vertical"", ""spoolss.form.vert"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_enumforms_num, { ""Num"", ""spoolss.enumforms.num"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, /* Print notify */ { &hf_notify_options_version, { ""Version"", ""spoolss.notify_options.version"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_options_flags, { ""Flags"", ""spoolss.notify_options.flags"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_options_count, { ""Count"", ""spoolss.notify_options.count"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_option_type, { ""Type"", ""spoolss.notify_option.type"", FT_UINT16, BASE_DEC, VALS(printer_notify_types), 0, NULL, HFILL }}, { &hf_notify_option_reserved1, { ""Reserved1"", ""spoolss.notify_option.reserved1"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_option_reserved2, { ""Reserved2"", ""spoolss.notify_option.reserved2"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_option_reserved3, { ""Reserved3"", ""spoolss.notify_option.reserved3"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_option_count, { ""Count"", ""spoolss.notify_option.count"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_option_data_count, { ""Count"", ""spoolss.notify_option_data.count"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_options_flags_refresh, { ""Refresh"", ""spoolss.notify_options.flags.refresh"", FT_BOOLEAN, 32, TFS(&tfs_notify_options_flags_refresh), PRINTER_NOTIFY_OPTIONS_REFRESH, NULL, HFILL }}, { &hf_notify_info_count, { ""Count"", ""spoolss.notify_info.count"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_info_version, { ""Version"", ""spoolss.notify_info.version"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_info_flags, { ""Flags"", ""spoolss.notify_info.flags"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_type, { ""Type"", ""spoolss.notify_info_data.type"", FT_UINT16, BASE_DEC, VALS(printer_notify_types), 0, NULL, HFILL }}, { &hf_notify_field, { ""Field"", ""spoolss.notify_field"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_count, { ""Count"", ""spoolss.notify_info_data.count"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_id, { ""Job Id"", ""spoolss.notify_info_data.jobid"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_value1, { ""Value1"", ""spoolss.notify_info_data.value1"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_value2, { ""Value2"", ""spoolss.notify_info_data.value2"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_bufsize, { ""Buffer size"", ""spoolss.notify_info_data.bufsize"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_buffer, { ""Buffer"", ""spoolss.notify_info_data.buffer"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_buffer_len, { ""Buffer length"", ""spoolss.notify_info_data.buffer.len"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_notify_info_data_buffer_data, { ""Buffer data"", ""spoolss.notify_info_data.buffer.data"", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, /* RffpCNex RPC */ { &hf_rffpcnex_options, { ""Options"", ""spoolss.rffpcnex.options"", FT_UINT32, BASE_DEC, NULL, 0, ""RFFPCNEX options"", HFILL }}, { &hf_printerlocal, /* XXX: move me */ { ""Printer local"", ""spoolss.printer_local"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_rffpcnex_flags, { ""RFFPCNEX flags"", ""spoolss.rffpcnex.flags"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_rffpcnex_flags_add_printer, { ""Add printer"", ""spoolss.rffpcnex.flags.add_printer"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_printer), SPOOLSS_PRINTER_CHANGE_ADD_PRINTER, NULL, HFILL }}, { &hf_rffpcnex_flags_set_printer, { ""Set printer"", ""spoolss.rffpcnex.flags.set_printer"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_set_printer), SPOOLSS_PRINTER_CHANGE_SET_PRINTER, NULL, HFILL }}, { &hf_rffpcnex_flags_delete_printer, { ""Delete printer"", ""spoolss.rffpcnex.flags.delete_printer"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_printer), SPOOLSS_PRINTER_CHANGE_DELETE_PRINTER, NULL, HFILL }}, { &hf_rffpcnex_flags_add_job, { ""Add job"", ""spoolss.rffpcnex.flags.add_job"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_job), SPOOLSS_PRINTER_CHANGE_ADD_JOB, NULL, HFILL }}, { &hf_rffpcnex_flags_set_job, { ""Set job"", ""spoolss.rffpcnex.flags.set_job"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_set_job), SPOOLSS_PRINTER_CHANGE_SET_JOB, NULL, HFILL }}, { &hf_rffpcnex_flags_delete_job, { ""Delete job"", ""spoolss.rffpcnex.flags.delete_job"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_job), SPOOLSS_PRINTER_CHANGE_DELETE_JOB, NULL, HFILL }}, { &hf_rffpcnex_flags_write_job, { ""Write job"", ""spoolss.rffpcnex.flags.write_job"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_write_job), SPOOLSS_PRINTER_CHANGE_WRITE_JOB, NULL, HFILL }}, { &hf_rffpcnex_flags_add_form, { ""Add form"", ""spoolss.rffpcnex.flags.add_form"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_form), SPOOLSS_PRINTER_CHANGE_ADD_FORM, NULL, HFILL }}, { &hf_rffpcnex_flags_set_form, { ""Set form"", ""spoolss.rffpcnex.flags.set_form"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_set_form), SPOOLSS_PRINTER_CHANGE_SET_FORM, NULL, HFILL }}, { &hf_rffpcnex_flags_delete_form, { ""Delete form"", ""spoolss.rffpcnex.flags.delete_form"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_form), SPOOLSS_PRINTER_CHANGE_DELETE_FORM, NULL, HFILL }}, { &hf_rffpcnex_flags_add_port, { ""Add port"", ""spoolss.rffpcnex.flags.add_port"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_port), SPOOLSS_PRINTER_CHANGE_ADD_PORT, NULL, HFILL }}, { &hf_rffpcnex_flags_configure_port, { ""Configure port"", ""spoolss.rffpcnex.flags.configure_port"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_configure_port), SPOOLSS_PRINTER_CHANGE_CONFIGURE_PORT, NULL, HFILL }}, { &hf_rffpcnex_flags_delete_port, { ""Delete port"", ""spoolss.rffpcnex.flags.delete_port"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_port), SPOOLSS_PRINTER_CHANGE_DELETE_PORT, NULL, HFILL }}, { &hf_rffpcnex_flags_add_print_processor, { ""Add processor"", ""spoolss.rffpcnex.flags.add_processor"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_print_processor), SPOOLSS_PRINTER_CHANGE_ADD_PRINT_PROCESSOR, NULL, HFILL }}, { &hf_rffpcnex_flags_delete_print_processor, { ""Delete processor"", ""spoolss.rffpcnex.flags.delete_processor"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_print_processor), SPOOLSS_PRINTER_CHANGE_DELETE_PRINT_PROCESSOR, NULL, HFILL }}, { &hf_rffpcnex_flags_add_driver, { ""Add driver"", ""spoolss.rffpcnex.flags.add_driver"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_add_driver), SPOOLSS_PRINTER_CHANGE_ADD_PRINTER_DRIVER, NULL, HFILL }}, { &hf_rffpcnex_flags_set_driver, { ""Set driver"", ""spoolss.rffpcnex.flags.set_driver"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_set_driver), SPOOLSS_PRINTER_CHANGE_SET_PRINTER_DRIVER, NULL, HFILL }}, { &hf_rffpcnex_flags_delete_driver, { ""Delete driver"", ""spoolss.rffpcnex.flags.delete_driver"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_delete_driver), SPOOLSS_PRINTER_CHANGE_DELETE_PRINTER_DRIVER, NULL, HFILL }}, { &hf_rffpcnex_flags_timeout, { ""Timeout"", ""spoolss.rffpcnex.flags.timeout"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_timeout), SPOOLSS_PRINTER_CHANGE_TIMEOUT, NULL, HFILL }}, { &hf_rffpcnex_flags_failed_printer_connection, { ""Failed printer connection"", ""spoolss.rffpcnex.flags.failed_connection_printer"", FT_BOOLEAN, 32, TFS(&tfs_rffpcnex_flags_failed_connection_printer), SPOOLSS_PRINTER_CHANGE_FAILED_CONNECTION_PRINTER, NULL, HFILL }}, /* RRPCN RPC */ { &hf_rrpcn_changelow, { ""Change low"", ""spoolss.rrpcn.changelow"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_rrpcn_changehigh, { ""Change high"", ""spoolss.rrpcn.changehigh"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_rrpcn_unk0, { ""Unknown 0"", ""spoolss.rrpcn.unk0"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_rrpcn_unk1, { ""Unknown 1"", ""spoolss.rrpcn.unk1"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, /* ReplyOpenPrinter RPC */ { &hf_replyopenprinter_unk0, { ""Unknown 0"", ""spoolss.replyopenprinter.unk0"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_replyopenprinter_unk1, { ""Unknown 1"", ""spoolss.replyopenprinter.unk1"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_devmode_devicename, { ""DeviceName"", ""spoolss.devmode.devicename"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_devmode_form_name, { ""FormName"", ""spoolss.devmode.form_name"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_relative_string, { ""String"", ""spoolss.relative_string"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_value_name, { ""Value Name"", ""spoolss.value_name"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_keybuffer, { ""Key"", ""spoolss.hf_keybuffer"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_value_string, { ""Value"", ""spoolss.value_string"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, /* Printer attributes */ { &hf_printer_attributes, { ""Attributes"", ""spoolss.printer_attributes"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_printer_attributes_queued, { ""Queued"", ""spoolss.printer_attributes.queued"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_queued), PRINTER_ATTRIBUTE_QUEUED, NULL, HFILL }}, { &hf_printer_attributes_direct, { ""Direct"", ""spoolss.printer_attributes.direct"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_direct), PRINTER_ATTRIBUTE_DIRECT, NULL, HFILL }}, { &hf_printer_attributes_default, { ""Default (9x/ME only)"", ""spoolss.printer_attributes.default"",FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_default), PRINTER_ATTRIBUTE_DEFAULT, ""Default"", HFILL }}, { &hf_printer_attributes_shared, { ""Shared"", ""spoolss.printer_attributes.shared"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_shared), PRINTER_ATTRIBUTE_SHARED, NULL, HFILL }}, { &hf_printer_attributes_network, { ""Network"", ""spoolss.printer_attributes.network"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_network), PRINTER_ATTRIBUTE_NETWORK, NULL, HFILL }}, { &hf_printer_attributes_hidden, { ""Hidden"", ""spoolss.printer_attributes.hidden"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_hidden), PRINTER_ATTRIBUTE_HIDDEN, NULL, HFILL }}, { &hf_printer_attributes_local, { ""Local"", ""spoolss.printer_attributes.local"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_local), PRINTER_ATTRIBUTE_LOCAL, NULL, HFILL }}, { &hf_printer_attributes_enable_devq, { ""Enable devq"", ""spoolss.printer_attributes.enable_devq"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_enable_devq), PRINTER_ATTRIBUTE_ENABLE_DEVQ, ""Enable evq"", HFILL }}, { &hf_printer_attributes_keep_printed_jobs, { ""Keep printed jobs"", ""spoolss.printer_attributes.keep_printed_jobs"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_keep_printed_jobs), PRINTER_ATTRIBUTE_KEEPPRINTEDJOBS, NULL, HFILL }}, { &hf_printer_attributes_do_complete_first, { ""Do complete first"", ""spoolss.printer_attributes.do_complete_first"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_do_complete_first), PRINTER_ATTRIBUTE_DO_COMPLETE_FIRST, NULL, HFILL }}, { &hf_printer_attributes_work_offline, { ""Work offline (9x/ME only)"", ""spoolss.printer_attributes.work_offline"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_work_offline), PRINTER_ATTRIBUTE_WORK_OFFLINE, ""Work offline"", HFILL }}, { &hf_printer_attributes_enable_bidi, { ""Enable bidi (9x/ME only)"", ""spoolss.printer_attributes.enable_bidi"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_enable_bidi), PRINTER_ATTRIBUTE_ENABLE_BIDI, ""Enable bidi"", HFILL }}, { &hf_printer_attributes_raw_only, { ""Raw only"", ""spoolss.printer_attributes.raw_only"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_raw_only), PRINTER_ATTRIBUTE_RAW_ONLY, NULL, HFILL }}, { &hf_printer_attributes_published, { ""Published"", ""spoolss.printer_attributes.published"", FT_BOOLEAN, 32, TFS(&tfs_printer_attributes_published), PRINTER_ATTRIBUTE_PUBLISHED, NULL, HFILL }}, /* Timestamps */ { &hf_time_year, { ""Year"", ""spoolss.time.year"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_time_month, { ""Month"", ""spoolss.time.month"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_time_dow, { ""Day of week"", ""spoolss.time.dow"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_time_day, { ""Day"", ""spoolss.time.day"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_time_hour, { ""Hour"", ""spoolss.time.hour"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_time_minute, { ""Minute"", ""spoolss.time.minute"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_time_second, { ""Second"", ""spoolss.time.second"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_time_msec, { ""Millisecond"", ""spoolss.time.msec"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, /* Userlevel */ { &hf_userlevel_size, { ""Size"", ""spoolss.userlevel.size"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_userlevel_client, { ""Client"", ""spoolss.userlevel.client"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_userlevel_user, { ""User"", ""spoolss.userlevel.user"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_userlevel_build, { ""Build"", ""spoolss.userlevel.build"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_userlevel_major, { ""Major"", ""spoolss.userlevel.major"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_userlevel_minor, { ""Minor"", ""spoolss.userlevel.minor"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_userlevel_processor, { ""Processor"", ""spoolss.userlevel.processor"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, /* EnumprinterdataEx RPC */ { &hf_enumprinterdataex_name_offset, { ""Name offset"", ""spoolss.enumprinterdataex.name_offset"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_name_len, { ""Name len"", ""spoolss.enumprinterdataex.name_len"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_name, { ""Name"", ""spoolss.enumprinterdataex.name"", FT_STRING, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_val_offset, { ""Value offset"", ""spoolss.enumprinterdataex.value_offset"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_val_len, { ""Value len"", ""spoolss.enumprinterdataex.value_len"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_val_dword_high, { ""DWORD value (high)"", ""spoolss.enumprinterdataex.val_dword.high"", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_value_null, { ""Value"", ""spoolss.enumprinterdataex.val_null"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_value_uint, { ""Value"", ""spoolss.enumprinterdataex.val_uint"", FT_UINT32, BASE_DEC, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_value_binary, { ""Value"", ""spoolss.enumprinterdataex.val_binary"", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_value_multi_sz, { ""Value"", ""spoolss.enumprinterdataex.val_multi_sz"", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, { &hf_enumprinterdataex_val_dword_low, { ""DWORD value (low)"", ""spoolss.enumprinterdataex.val_dword.low"", FT_UINT16, BASE_DEC, NULL, 0x0, NULL, HFILL }}, /* RouterReplyPrinter RPC */ { &hf_routerreplyprinter_condition, { ""Condition"", ""spoolss.routerreplyprinter.condition"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_routerreplyprinter_unknown1, { ""Unknown1"", ""spoolss.routerreplyprinter.unknown1"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_routerreplyprinter_changeid, { ""Change id"", ""spoolss.routerreplyprinter.changeid"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, /* EnumPrinterKey RPC */ { &hf_keybuffer_size, { ""Key Buffer size"", ""spoolss.keybuffer.size"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Size of buffer"", HFILL }}, /* SetJob RPC */ { &hf_setjob_cmd, { ""Set job command"", ""spoolss.setjob.cmd"", FT_UINT32, BASE_DEC, VALS(setjob_commands), 0x0, ""Printer data name"", HFILL }}, /* EnumJobs RPC */ { &hf_enumjobs_firstjob, { ""First job"", ""spoolss.enumjobs.firstjob"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Index of first job to return"", HFILL }}, { &hf_enumjobs_numjobs, { ""Num jobs"", ""spoolss.enumjobs.numjobs"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Number of jobs to return"", HFILL }}, /* Security descriptor buffer */ { &hf_secdescbuf_maxlen, { ""Max len"", ""spoolss.secdescbuf.max_len"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_secdescbuf_undoc, { ""Undocumented"", ""spoolss.secdescbuf.undoc"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_secdescbuf_len, { ""Length"", ""spoolss.secdescbuf.len"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, /* Spool printer info */ { &hf_spool_printer_info_devmode_ptr, { ""Devmode pointer"", ""spoolss.spoolprinterinfo.devmode_ptr"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_spool_printer_info_secdesc_ptr, { ""Secdesc pointer"", ""spoolss.spoolprinterinfo.secdesc_ptr"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, /* WritePrinter RPC */ { &hf_writeprinter_numwritten, { ""Num written"", ""spoolss.writeprinter.numwritten"", FT_UINT32, BASE_DEC, NULL, 0x0, ""Number of bytes written"", HFILL }}, /* Setprinterdataex RPC */ { &hf_setprinterdataex_max_len, { ""Max len"", ""spoolss.setprinterdataex.max_len"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_setprinterdataex_real_len, { ""Real len"", ""spoolss.setprinterdataex.real_len"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_setprinterdataex_data, { ""Data"", ""spoolss.setprinterdataex.data"", FT_BYTES, BASE_NONE, NULL, 0, NULL, HFILL }}, /* Specific access rights */ { &hf_access_required, { ""Access required"", ""spoolss.access_required"", FT_UINT32, BASE_HEX, NULL, 0x0, NULL, HFILL }}, { &hf_server_access_admin, { ""Server admin"", ""spoolss.access_mask.server_admin"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), SERVER_ACCESS_ADMINISTER, NULL, HFILL }}, { &hf_server_access_enum, { ""Server enum"", ""spoolss.access_mask.server_enum"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), SERVER_ACCESS_ENUMERATE, NULL, HFILL }}, { &hf_printer_access_admin, { ""Printer admin"", ""spoolss.access_mask.printer_admin"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ACCESS_ADMINISTER, NULL, HFILL }}, { &hf_printer_access_use, { ""Printer use"", ""spoolss.access_mask.printer_use"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), PRINTER_ACCESS_USE, NULL, HFILL }}, { &hf_job_access_admin, { ""Job admin"", ""spoolss.access_mask.job_admin"", FT_BOOLEAN, 32, TFS(&tfs_set_notset), JOB_ACCESS_ADMINISTER, NULL, HFILL }}, /* Printer information */ { &hf_printer_cjobs, { ""CJobs"", ""spoolss.printer.cjobs"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_total_jobs, { ""Total jobs"", ""spoolss.printer.total_jobs"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_total_bytes, { ""Total bytes"", ""spoolss.printer.total_bytes"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_global_counter, { ""Global counter"", ""spoolss.printer.global_counter"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_total_pages, { ""Total pages"", ""spoolss.printer.total_pages"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_major_version, { ""Major version"", ""spoolss.printer.major_version"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_build_version, { ""Build version"", ""spoolss.printer.build_version"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk7, { ""Unknown 7"", ""spoolss.printer.unknown7"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk8, { ""Unknown 8"", ""spoolss.printer.unknown8"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk9, { ""Unknown 9"", ""spoolss.printer.unknown9"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_session_ctr, { ""Session counter"", ""spoolss.printer.session_ctr"", FT_UINT32, BASE_DEC, NULL, 0, ""Sessopm counter"", HFILL }}, { &hf_printer_unk11, { ""Unknown 11"", ""spoolss.printer.unknown11"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_printer_errors, { ""Printer errors"", ""spoolss.printer.printer_errors"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk13, { ""Unknown 13"", ""spoolss.printer.unknown13"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk14, { ""Unknown 14"", ""spoolss.printer.unknown14"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk15, { ""Unknown 15"", ""spoolss.printer.unknown15"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk16, { ""Unknown 16"", ""spoolss.printer.unknown16"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_changeid, { ""Change id"", ""spoolss.printer.changeid"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk18, { ""Unknown 18"", ""spoolss.printer.unknown18"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk20, { ""Unknown 20"", ""spoolss.printer.unknown20"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_c_setprinter, { ""Csetprinter"", ""spoolss.printer.c_setprinter"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk22, { ""Unknown 22"", ""spoolss.printer.unknown22"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk23, { ""Unknown 23"", ""spoolss.printer.unknown23"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk24, { ""Unknown 24"", ""spoolss.printer.unknown24"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk25, { ""Unknown 25"", ""spoolss.printer.unknown25"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk26, { ""Unknown 26"", ""spoolss.printer.unknown26"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk27, { ""Unknown 27"", ""spoolss.printer.unknown27"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk28, { ""Unknown 28"", ""spoolss.printer.unknown28"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_unk29, { ""Unknown 29"", ""spoolss.printer.unknown29"", FT_UINT16, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_flags, { ""Flags"", ""spoolss.printer.flags"", FT_UINT32, BASE_HEX, NULL, 0, NULL, HFILL }}, { &hf_printer_priority, { ""Priority"", ""spoolss.printer.priority"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_default_priority, { ""Default Priority"", ""spoolss.printer.default_priority"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_averageppm, { ""Average PPM"", ""spoolss.printer.averageppm"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_jobs, { ""Jobs"", ""spoolss.printer.jobs"", FT_UINT32, BASE_DEC, NULL, 0, NULL, HFILL }}, { &hf_printer_guid, { ""GUID"", ""spoolss.printer.guid"", FT_STRING, BASE_NONE, NULL, 0, NULL, HFILL }}, { &hf_printer_action, { ""Action"", ""spoolss.printer.action"", FT_UINT32, BASE_DEC, VALS(getprinter_action_vals), 0, NULL, HFILL }}, }; static gint *ett[] = { &ett_dcerpc_spoolss, &ett_PRINTER_DATATYPE, &ett_DEVMODE_CTR, &ett_DEVMODE, &ett_DEVMODE_fields, &ett_USER_LEVEL_CTR, &ett_USER_LEVEL_1, &ett_BUFFER, &ett_PRINTER_INFO, &ett_SPOOL_PRINTER_INFO_LEVEL, &ett_PRINTER_INFO_0, &ett_PRINTER_INFO_1, &ett_PRINTER_INFO_2, &ett_PRINTER_INFO_3, &ett_PRINTER_INFO_7, &ett_RELSTR, &ett_RELSTR_ARRAY, &ett_FORM_REL, &ett_FORM_CTR, &ett_FORM_1, &ett_JOB_INFO_1, &ett_JOB_INFO_2, &ett_SEC_DESC_BUF, &ett_SYSTEM_TIME, &ett_DOC_INFO_1, &ett_DOC_INFO, &ett_DOC_INFO_CTR, &ett_printerdata_value, &ett_printerdata_data, &ett_writeprinter_buffer, &ett_DRIVER_INFO_1, &ett_DRIVER_INFO_2, &ett_DRIVER_INFO_3, &ett_DRIVER_INFO_6, &ett_DRIVER_INFO_101, &ett_rffpcnex_flags, &ett_notify_options_flags, &ett_NOTIFY_INFO_DATA, &ett_NOTIFY_OPTION, &ett_printer_attributes, &ett_job_status, &ett_enumprinters_flags, &ett_PRINTER_DATA_CTR, &ett_printer_enumdataex_value, }; static ei_register_info ei[] = { { &ei_unimplemented_dissector, { ""spoolss.unimplemented_dissector"", PI_UNDECODED, PI_WARN, ""Unimplemented dissector: SPOOLSS"", EXPFILL }}, { &ei_unknown_data, { ""spoolss.unknown_data"", PI_UNDECODED, PI_WARN, ""Unknown data follows"", EXPFILL }}, { &ei_printer_info_level, { ""spoolss.printer.unknown"", PI_PROTOCOL, PI_WARN, ""Unknown printer info level"", EXPFILL }}, { &ei_spool_printer_info_level, { ""spoolss.spool_printer.unknown"", PI_PROTOCOL, PI_WARN, ""Unknown spool printer info level"", EXPFILL }}, { &ei_form_level, { ""spoolss.form.level.unknown"", PI_PROTOCOL, PI_WARN, ""Unknown form info level"", EXPFILL }}, { &ei_job_info_level, { ""spoolss.job_info.level.unknown"", PI_PROTOCOL, PI_WARN, ""Unknown job info level"", EXPFILL }}, { &ei_driver_info_level, { ""spoolss.driver_info.level.unknown"", PI_PROTOCOL, PI_WARN, ""Unknown driver info level"", EXPFILL }}, { &ei_level, { ""spoolss.level.unknown"", PI_PROTOCOL, PI_WARN, ""Info level unknown"", EXPFILL }}, { &ei_notify_info_data_type, { ""spoolss.notify_info_data.type.unknown"", PI_PROTOCOL, PI_WARN, ""Unknown notify type"", EXPFILL }}, { &ei_enumprinterdataex_value, { ""spoolss.enumprinterdataex.val_unknown"", PI_PROTOCOL, PI_WARN, ""Unknown value type"", EXPFILL }}, }; expert_module_t* expert_dcerpc_spoolss; proto_dcerpc_spoolss = proto_register_protocol( ""Microsoft Spool Subsystem"", ""SPOOLSS"", ""spoolss""); proto_register_field_array(proto_dcerpc_spoolss, hf, array_length(hf)); proto_register_subtree_array(ett, array_length(ett)); expert_dcerpc_spoolss = expert_register_protocol(proto_dcerpc_spoolss); expert_register_field_array(expert_dcerpc_spoolss, ei, array_length(ei)); } ",0 "void RenderWidgetHostImpl::ShutdownAndDestroyWidget(bool also_delete) { RejectMouseLockOrUnlockIfNecessary(); if (process_->HasConnection()) { bool rv = Send(new ViewMsg_Close(routing_id_)); DCHECK(rv); } Destroy(also_delete); } ",0 "void Shell::PlatformResizeSubViews() { SizeTo(content_width_, content_height_); } ",0 "XML_SetElementHandler(XML_Parser parser, XML_StartElementHandler start, XML_EndElementHandler end) { if (parser == NULL) return; parser->m_startElementHandler = start; parser->m_endElementHandler = end; } ",0 "ssize_t InputDispatcher::InputState::findMotionMemento(const MotionEntry* entry, bool hovering) const { for (size_t i = 0; i < mMotionMementos.size(); i++) { const MotionMemento& memento = mMotionMementos.itemAt(i); if (memento.deviceId == entry->deviceId && memento.source == entry->source && memento.displayId == entry->displayId && memento.hovering == hovering) { return i; } } return -1; } ",0 "void LayoutBlockFlow::markAllDescendantsWithFloatsForLayout(LayoutBox* floatToRemove, bool inLayout) { if (!everHadLayout() && !containsFloats()) return; if (m_descendantsWithFloatsMarkedForLayout && !floatToRemove) return; m_descendantsWithFloatsMarkedForLayout |= !floatToRemove; MarkingBehavior markParents = inLayout ? MarkOnlyThis : MarkContainerChain; setChildNeedsLayout(markParents); if (floatToRemove) removeFloatingObject(floatToRemove); if (!childrenInline() || floatToRemove) { for (LayoutObject* child = firstChild(); child; child = child->nextSibling()) { if ((!floatToRemove && child->isFloatingOrOutOfFlowPositioned()) || !child->isLayoutBlock()) continue; if (!child->isLayoutBlockFlow()) { LayoutBlock* childBlock = toLayoutBlock(child); if (childBlock->shrinkToAvoidFloats() && childBlock->everHadLayout()) childBlock->setChildNeedsLayout(markParents); continue; } LayoutBlockFlow* childBlockFlow = toLayoutBlockFlow(child); if ((floatToRemove ? childBlockFlow->containsFloat(floatToRemove) : childBlockFlow->containsFloats()) || childBlockFlow->shrinkToAvoidFloats()) childBlockFlow->markAllDescendantsWithFloatsForLayout(floatToRemove, inLayout); } } } ",0 "static void virtio_register_types(void) { type_register_static(&virtio_net_info); } ",0 "static int ahash_no_export(struct ahash_request *req, void *out) { return -ENOSYS; } ",0 "xscale1pmu_disable_event(struct hw_perf_event *hwc, int idx) { unsigned long val, mask, evt, flags; switch (idx) { case XSCALE_CYCLE_COUNTER: mask = XSCALE1_CCOUNT_INT_EN; evt = 0; break; case XSCALE_COUNTER0: mask = XSCALE1_COUNT0_INT_EN | XSCALE1_COUNT0_EVT_MASK; evt = XSCALE_PERFCTR_UNUSED << XSCALE1_COUNT0_EVT_SHFT; break; case XSCALE_COUNTER1: mask = XSCALE1_COUNT1_INT_EN | XSCALE1_COUNT1_EVT_MASK; evt = XSCALE_PERFCTR_UNUSED << XSCALE1_COUNT1_EVT_SHFT; break; default: WARN_ONCE(1, ""invalid counter number (%d)\n"", idx); return; } raw_spin_lock_irqsave(&pmu_lock, flags); val = xscale1pmu_read_pmnc(); val &= ~mask; val |= evt; xscale1pmu_write_pmnc(val); raw_spin_unlock_irqrestore(&pmu_lock, flags); } ",0 "CardUnmaskPromptViews::FadeOutView::~FadeOutView() { } ",0 "bool RenderWidgetHostViewAura::ShouldDescendIntoChildForEventHandling( aura::Window* child, const gfx::Point& location) { return true; } ",0 "static int __init arm_mrc_hook_init(void) { register_undef_hook(&arm_mrc_hook); return 0; } ",0 "void CorePageLoadMetricsObserver::RecordRappor( const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) { if (g_browser_process->IsShuttingDown()) return; rappor::RapporService* rappor_service = g_browser_process->rappor_service(); if (!rappor_service) return; if (!info.time_to_commit) return; DCHECK(!info.committed_url.is_empty()); if (!WasStartedInForegroundOptionalEventInForeground( timing.first_contentful_paint, info)) { return; } std::unique_ptr sample = rappor_service->CreateSample(rappor::UMA_RAPPOR_TYPE); sample->SetStringField( ""Domain"", rappor::GetDomainAndRegistrySampleFromGURL(info.committed_url)); uint64_t bucket_index = RapporHistogramBucketIndex(timing.first_contentful_paint.value()); sample->SetFlagsField(""Bucket"", uint64_t(1) << bucket_index, kNumRapporHistogramBuckets); sample->SetFlagsField( ""IsSlow"", timing.first_contentful_paint.value().InSecondsF() >= 10, 1); rappor_service->RecordSampleObj(internal::kRapporMetricsNameCoarseTiming, std::move(sample)); } ",0 " RVHObserver(RenderViewHostObserverArray* parent, RenderViewHost* rvh) : RenderViewHostObserver(rvh), parent_(parent) { } ",0 "EOFStream::EOFStream(Stream *strA): FilterStream(strA) { } ",0 "static int ffs_func_set_alt(struct usb_function *f, unsigned interface, unsigned alt) { struct ffs_function *func = ffs_func_from_usb(f); struct ffs_data *ffs = func->ffs; int ret = 0, intf; if (alt != (unsigned)-1) { intf = ffs_func_revmap_intf(func, interface); if (unlikely(intf < 0)) return intf; } if (ffs->func) ffs_func_eps_disable(ffs->func); if (ffs->state == FFS_DEACTIVATED) { ffs->state = FFS_CLOSING; INIT_WORK(&ffs->reset_work, ffs_reset_work); schedule_work(&ffs->reset_work); return -ENODEV; } if (ffs->state != FFS_ACTIVE) return -ENODEV; if (alt == (unsigned)-1) { ffs->func = NULL; ffs_event_add(ffs, FUNCTIONFS_DISABLE); return 0; } ffs->func = func; ret = ffs_func_eps_enable(func); if (likely(ret >= 0)) ffs_event_add(ffs, FUNCTIONFS_ENABLE); return ret; } ",0 "static Bool leap_year(u32 year) { year += 1900; return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0) ? GF_TRUE : GF_FALSE; } ",0 "long long jsvGetLongInteger(const JsVar *v) { if (jsvIsInt(v)) return jsvGetInteger(v); return (long long)jsvGetFloat(v); } ",0 "void NetworkHandler::SetRenderer(RenderProcessHost* process_host, RenderFrameHostImpl* frame_host) { process_ = process_host; host_ = frame_host; } ",1 "static void nfs4_return_incompatible_delegation(struct inode *inode, fmode_t fmode) { struct nfs_delegation *delegation; rcu_read_lock(); delegation = rcu_dereference(NFS_I(inode)->delegation); if (delegation == NULL || (delegation->type & fmode) == fmode) { rcu_read_unlock(); return; } rcu_read_unlock(); nfs_inode_return_delegation(inode); } ",0 "static bool perf_event_validate_size(struct perf_event *event) { /* * The values computed here will be over-written when we actually * attach the event. */ __perf_event_read_size(event, event->group_leader->nr_siblings + 1); __perf_event_header_size(event, event->attr.sample_type & ~PERF_SAMPLE_READ); perf_event__id_header_size(event); /* * Sum the lot; should not exceed the 64k limit we have on records. * Conservative limit to allow for callchains and other variable fields. */ if (event->read_size + event->header_size + event->id_header_size + sizeof(struct perf_event_header) >= 16*1024) return false; return true; } ",0 "PHP_FUNCTION(imagecreatefromgd2) { _php_image_create_from(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, ""GD2"", gdImageCreateFromGd2, gdImageCreateFromGd2Ctx); } ",0 "void Pack(const float* source, uint16_t* destination, unsigned pixels_per_row) { for (unsigned i = 0; i < pixels_per_row; ++i) { float scale_factor = source[3] ? 1.0f / source[3] : 1.0f; destination[0] = ConvertFloatToHalfFloat(source[0] * scale_factor); destination[1] = ConvertFloatToHalfFloat(source[1] * scale_factor); source += 4; destination += 2; } } ",0 "MagickExport const void *AcquirePixelCachePixels(const Image *image, MagickSizeType *length,ExceptionInfo *exception) { CacheInfo *magick_restrict cache_info; assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickSignature); (void) exception; *length=0; if ((cache_info->type != MemoryCache) && (cache_info->type != MapCache)) return((const void *) NULL); *length=cache_info->length; return((const void *) cache_info->pixels); } ",0 "static MagickBooleanType TraceEdges(Image *edge_image,CacheView *edge_view, MatrixInfo *canny_cache,const ssize_t x,const ssize_t y, const double lower_threshold,ExceptionInfo *exception) { CannyInfo edge, pixel; MagickBooleanType status; register PixelPacket *q; register ssize_t i; q=GetCacheViewAuthenticPixels(edge_view,x,y,1,1,exception); if (q == (PixelPacket *) NULL) return(MagickFalse); q->red=QuantumRange; q->green=QuantumRange; q->blue=QuantumRange; status=SyncCacheViewAuthenticPixels(edge_view,exception); if (status == MagickFalse) return(MagickFalse); if (GetMatrixElement(canny_cache,0,0,&edge) == MagickFalse) return(MagickFalse); edge.x=x; edge.y=y; if (SetMatrixElement(canny_cache,0,0,&edge) == MagickFalse) return(MagickFalse); for (i=1; i != 0; ) { ssize_t v; i--; status=GetMatrixElement(canny_cache,i,0,&edge); if (status == MagickFalse) return(MagickFalse); for (v=(-1); v <= 1; v++) { ssize_t u; for (u=(-1); u <= 1; u++) { if ((u == 0) && (v == 0)) continue; if (IsAuthenticPixel(edge_image,edge.x+u,edge.y+v) == MagickFalse) continue; /* Not an edge if gradient value is below the lower threshold. */ q=GetCacheViewAuthenticPixels(edge_view,edge.x+u,edge.y+v,1,1, exception); if (q == (PixelPacket *) NULL) return(MagickFalse); status=GetMatrixElement(canny_cache,edge.x+u,edge.y+v,&pixel); if (status == MagickFalse) return(MagickFalse); if ((GetPixelIntensity(edge_image,q) == 0.0) && (pixel.intensity >= lower_threshold)) { q->red=QuantumRange; q->green=QuantumRange; q->blue=QuantumRange; status=SyncCacheViewAuthenticPixels(edge_view,exception); if (status == MagickFalse) return(MagickFalse); edge.x+=u; edge.y+=v; status=SetMatrixElement(canny_cache,i,0,&edge); if (status == MagickFalse) return(MagickFalse); i++; } } } } return(MagickTrue); } ",0 "bool RenderFrameDevToolsAgentHost::Activate() { WebContentsImpl* wc = static_cast(web_contents()); if (wc) { wc->Activate(); return true; } return false; } ",0 "get_remote_ip(const struct mg_connection *conn) { if (!conn) { return 0; } return ntohl(*(const uint32_t *)&conn->client.rsa.sin.sin_addr); } ",0 "void Dispatcher::OnShouldSuspend(const std::string& extension_id, uint64_t sequence_id) { RenderThread::Get()->Send( new ExtensionHostMsg_ShouldSuspendAck(extension_id, sequence_id)); } ",0 "insert_hIST(png_structp png_ptr, png_infop info_ptr, int nparams, png_charpp params) { int i; png_uint_16 freq[256]; /* libpng takes the count from the PLTE count; we don't check it here but we * do set the array to 0 for unspecified entries. */ memset(freq, 0, sizeof freq); for (i=0; ipage(); RefPtr renderTheme = page ? page->theme() : RenderTheme::defaultTheme(); if (!renderTheme->popsMenuByArrowKeys()) return false; if (!isSpatialNavigationEnabled(document()->frame())) { if (event->keyIdentifier() == ""Down"" || event->keyIdentifier() == ""Up"") { focus(); if (!renderer()) return true; saveLastSelection(); if (RenderMenuList* menuList = toRenderMenuList(renderer())) menuList->showPopup(); event->setDefaultHandled(); } return true; } return false; } ",0 "media_status_t AMediaCodec_createPersistentInputSurface(ANativeWindow **surface) { if (surface == NULL) { return AMEDIA_ERROR_INVALID_PARAMETER; } *surface = NULL; sp ps = MediaCodec::CreatePersistentInputSurface(); if (ps == NULL) { return AMEDIA_ERROR_UNKNOWN; } sp igbp = ps->getBufferProducer(); if (igbp == NULL) { return AMEDIA_ERROR_UNKNOWN; } *surface = new AMediaCodecPersistentSurface(igbp, ps); ANativeWindow_acquire(*surface); return AMEDIA_OK; } ",0 "static struct inet_peer_base *family_to_base(int family) { return family == AF_INET ? &v4_peers : &v6_peers; } ",0 "static int rb_head_page_set(struct ring_buffer_per_cpu *cpu_buffer, struct buffer_page *head, struct buffer_page *prev, int old_flag, int new_flag) { struct list_head *list; unsigned long val = (unsigned long)&head->list; unsigned long ret; list = &prev->list; val &= ~RB_FLAG_MASK; ret = cmpxchg((unsigned long *)&list->next, val | old_flag, val | new_flag); /* check if the reader took the page */ if ((ret & ~RB_FLAG_MASK) != val) return RB_PAGE_MOVED; return ret & RB_FLAG_MASK; } ",0 "iperf_recv(struct iperf_test *test, fd_set *read_setP) { int r; struct iperf_stream *sp; SLIST_FOREACH(sp, &test->streams, streams) { if (FD_ISSET(sp->socket, read_setP)) { if ((r = sp->rcv(sp)) < 0) { i_errno = IESTREAMREAD; return r; } test->bytes_sent += r; ++test->blocks_sent; FD_CLR(sp->socket, read_setP); } } return 0; } ",0 "void padLeft(std::string &str, const size_t num, const char paddingChar) { if (num > str.size()) str.insert(0, num - str.size(), paddingChar); } ",0 "static int function_stat_cmp(void *p1, void *p2) { struct ftrace_profile *a = p1; struct ftrace_profile *b = p2; if (a->time < b->time) return -1; if (a->time > b->time) return 1; else return 0; } ",0 "void WebResourceService::OnURLFetchComplete(const net::URLFetcher* source) { std::unique_ptr clean_up_fetcher(url_fetcher_.release()); if (source->GetStatus().is_success() && source->GetResponseCode() == 200) { std::string data; source->GetResponseAsString(&data); if (data.empty() || data == ""{}"") { OnUnpackFinished(base::MakeUnique()); } else { parse_json_callback_.Run(data, base::Bind(&WebResourceService::OnUnpackFinished, weak_ptr_factory_.GetWeakPtr()), base::Bind(&WebResourceService::OnUnpackError, weak_ptr_factory_.GetWeakPtr())); } } else { EndFetch(); } } ",0 " void testCrash_MakeOwner_Bug20080207() { UriParserStateA state; UriUriA sourceUri; state.uri = &sourceUri; const char * const sourceUriString = ""http://user:pass@somehost.com:80/""; if (uriParseUriA(&state, sourceUriString) != 0) { TEST_ASSERT(false); } if (uriNormalizeSyntaxA(&sourceUri) != 0) { TEST_ASSERT(false); } uriFreeUriMembersA(&sourceUri); TEST_ASSERT(true); } ",0 "status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer, nsecs_t expectedPresent) { ATRACE_CALL(); Mutex::Autolock lock(mCore->mMutex); int numAcquiredBuffers = 0; for (int s = 0; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { if (mSlots[s].mBufferState == BufferSlot::ACQUIRED) { ++numAcquiredBuffers; } } if (numAcquiredBuffers >= mCore->mMaxAcquiredBufferCount + 1) { BQ_LOGE(""acquireBuffer: max acquired buffer count reached: %d (max %d)"", numAcquiredBuffers, mCore->mMaxAcquiredBufferCount); return INVALID_OPERATION; } if (mCore->mQueue.empty()) { return NO_BUFFER_AVAILABLE; } BufferQueueCore::Fifo::iterator front(mCore->mQueue.begin()); if (expectedPresent != 0) { const int MAX_REASONABLE_NSEC = 1000000000ULL; // 1 second while (mCore->mQueue.size() > 1 && !mCore->mQueue[0].mIsAutoTimestamp) { const BufferItem& bufferItem(mCore->mQueue[1]); nsecs_t desiredPresent = bufferItem.mTimestamp; if (desiredPresent < expectedPresent - MAX_REASONABLE_NSEC || desiredPresent > expectedPresent) { BQ_LOGV(""acquireBuffer: nodrop desire=%"" PRId64 "" expect=%"" PRId64 "" (%"" PRId64 "") now=%"" PRId64, desiredPresent, expectedPresent, desiredPresent - expectedPresent, systemTime(CLOCK_MONOTONIC)); break; } BQ_LOGV(""acquireBuffer: drop desire=%"" PRId64 "" expect=%"" PRId64 "" size=%zu"", desiredPresent, expectedPresent, mCore->mQueue.size()); if (mCore->stillTracking(front)) { mSlots[front->mSlot].mBufferState = BufferSlot::FREE; } mCore->mQueue.erase(front); front = mCore->mQueue.begin(); } nsecs_t desiredPresent = front->mTimestamp; if (desiredPresent > expectedPresent && desiredPresent < expectedPresent + MAX_REASONABLE_NSEC) { BQ_LOGV(""acquireBuffer: defer desire=%"" PRId64 "" expect=%"" PRId64 "" (%"" PRId64 "") now=%"" PRId64, desiredPresent, expectedPresent, desiredPresent - expectedPresent, systemTime(CLOCK_MONOTONIC)); return PRESENT_LATER; } BQ_LOGV(""acquireBuffer: accept desire=%"" PRId64 "" expect=%"" PRId64 "" "" ""(%"" PRId64 "") now=%"" PRId64, desiredPresent, expectedPresent, desiredPresent - expectedPresent, systemTime(CLOCK_MONOTONIC)); } int slot = front->mSlot; *outBuffer = *front; ATRACE_BUFFER_INDEX(slot); BQ_LOGV(""acquireBuffer: acquiring { slot=%d/%"" PRIu64 "" buffer=%p }"", slot, front->mFrameNumber, front->mGraphicBuffer->handle); if (mCore->stillTracking(front)) { mSlots[slot].mAcquireCalled = true; mSlots[slot].mNeedsCleanupOnRelease = false; mSlots[slot].mBufferState = BufferSlot::ACQUIRED; mSlots[slot].mFence = Fence::NO_FENCE; } if (outBuffer->mAcquireCalled) { outBuffer->mGraphicBuffer = NULL; } mCore->mQueue.erase(front); mCore->mDequeueCondition.broadcast(); ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size()); return NO_ERROR; } ",0 "u32 rds_tcp_snd_una(struct rds_tcp_connection *tc) { return tcp_sk(tc->t_sock->sk)->snd_una; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoCheckFramebufferStatus( GLenum target, uint32_t* result) { *result = api()->glCheckFramebufferStatusEXTFn(target); return error::kNoError; } ",0 "void RenderFlexibleBox::alignChildren(const Vector& lineContexts) { Vector minMarginAfterBaselines; RenderBox* child = m_orderIterator.first(); for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) { LayoutUnit minMarginAfterBaseline = LayoutUnit::max(); LayoutUnit lineCrossAxisExtent = lineContexts[lineNumber].crossAxisExtent; LayoutUnit maxAscent = lineContexts[lineNumber].maxAscent; for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next()) { ASSERT(child); if (child->isOutOfFlowPositioned()) { if (style()->flexWrap() == FlexWrapReverse) adjustAlignmentForChild(child, lineCrossAxisExtent); continue; } if (updateAutoMarginsInCrossAxis(child, std::max(LayoutUnit(0), availableAlignmentSpaceForChild(lineCrossAxisExtent, child)))) continue; switch (alignmentForChild(child)) { case ItemPositionAuto: ASSERT_NOT_REACHED(); break; case ItemPositionStretch: { applyStretchAlignmentToChild(child, lineCrossAxisExtent); if (style()->flexWrap() == FlexWrapReverse) adjustAlignmentForChild(child, availableAlignmentSpaceForChild(lineCrossAxisExtent, child)); break; } case ItemPositionFlexStart: break; case ItemPositionFlexEnd: adjustAlignmentForChild(child, availableAlignmentSpaceForChild(lineCrossAxisExtent, child)); break; case ItemPositionCenter: adjustAlignmentForChild(child, availableAlignmentSpaceForChild(lineCrossAxisExtent, child) / 2); break; case ItemPositionBaseline: { LayoutUnit ascent = marginBoxAscentForChild(child); LayoutUnit startOffset = maxAscent - ascent; adjustAlignmentForChild(child, startOffset); if (style()->flexWrap() == FlexWrapReverse) minMarginAfterBaseline = std::min(minMarginAfterBaseline, availableAlignmentSpaceForChild(lineCrossAxisExtent, child) - startOffset); break; } case ItemPositionSelfStart: case ItemPositionSelfEnd: case ItemPositionStart: case ItemPositionEnd: case ItemPositionLeft: case ItemPositionRight: ASSERT_NOT_REACHED(); break; } } minMarginAfterBaselines.append(minMarginAfterBaseline); } if (style()->flexWrap() != FlexWrapReverse) return; child = m_orderIterator.first(); for (size_t lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) { LayoutUnit minMarginAfterBaseline = minMarginAfterBaselines[lineNumber]; for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next()) { ASSERT(child); if (alignmentForChild(child) == ItemPositionBaseline && !hasAutoMarginsInCrossAxis(child) && minMarginAfterBaseline) adjustAlignmentForChild(child, minMarginAfterBaseline); } } } ",0 "timestamp_verify(krb5_context ctx, const krb5_data *nonce) { krb5_error_code retval = EINVAL; krb5_pa_enc_ts *et = NULL; if (nonce->data == NULL) goto out; /* Decode the PA-ENC-TS-ENC structure. */ retval = decode_krb5_pa_enc_ts(nonce, &et); if (retval != 0) goto out; /* Check the clockskew. */ retval = krb5_check_clockskew(ctx, et->patimestamp); out: krb5_free_pa_enc_ts(ctx, et); return retval; } ",0 "OxideQQuickWebView* OxideQQuickWebViewAttached::view() const { return view_; } ",0 "ReadableStreamReader::ReadableStreamReader(ExecutionContext* executionContext, ReadableStream* stream) : ActiveScriptWrappable(this) , ActiveDOMObject(executionContext) , m_stream(stream) , m_closed(new ClosedPromise(executionContext, this, ClosedPromise::Closed)) { suspendIfNeeded(); ASSERT(m_stream->isLockedTo(nullptr)); m_stream->setReader(this); if (m_stream->stateInternal() == ReadableStream::Closed) m_closed->resolve(ToV8UndefinedGenerator()); if (m_stream->stateInternal() == ReadableStream::Errored) m_closed->reject(m_stream->storedException()); } ",0 "static void v9fs_fix_path(V9fsPath *dst, V9fsPath *src, int len) { V9fsPath str; v9fs_path_init(&str); v9fs_path_copy(&str, dst); v9fs_path_sprintf(dst, ""%s%s"", src->data, str.data + len); v9fs_path_free(&str); } ",0 "static void smtp_get_message(char *buffer, char **outptr) { size_t len = strlen(buffer); char *message = NULL; if(len > 4) { /* Find the start of the message */ len -= 4; for(message = buffer + 4; *message == ' ' || *message == '\t'; message++, len--) ; /* Find the end of the message */ for(; len--;) if(message[len] != '\r' && message[len] != '\n' && message[len] != ' ' && message[len] != '\t') break; /* Terminate the message */ if(++len) { message[len] = '\0'; } } else /* junk input => zero length output */ message = &buffer[len]; *outptr = message; } ",0 "static __inline USHORT RawCheckSumFinalize(UINT32 val) { val = (((val >> 16) | (val << 16)) + val) >> 16; return (USHORT)~val; } ",0 "int snd_seq_event_port_attach(int client, struct snd_seq_port_callback *pcbp, int cap, int type, int midi_channels, int midi_voices, char *portname) { struct snd_seq_port_info portinfo; int ret; /* Set up the port */ memset(&portinfo, 0, sizeof(portinfo)); portinfo.addr.client = client; strlcpy(portinfo.name, portname ? portname : ""Unamed port"", sizeof(portinfo.name)); portinfo.capability = cap; portinfo.type = type; portinfo.kernel = pcbp; portinfo.midi_channels = midi_channels; portinfo.midi_voices = midi_voices; /* Create it */ ret = snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_CREATE_PORT, &portinfo); if (ret >= 0) ret = portinfo.addr.port; return ret; } ",0 "BlockGroup::BlockGroup( Cluster* pCluster, long idx, long long block_start, long long block_size, long long prev, long long next, long long duration, long long discard_padding) : BlockEntry(pCluster, idx), m_block(block_start, block_size, discard_padding), m_prev(prev), m_next(next), m_duration(duration) { } ",1 "bool PrintWebViewHelper::GetPrintSettingsFromUser(blink::WebLocalFrame* frame, const blink::WebNode& node, int expected_pages_count, bool is_scripted) { PrintHostMsg_ScriptedPrint_Params params; PrintMsg_PrintPages_Params print_settings; params.cookie = print_pages_params_->params.document_cookie; params.has_selection = frame->hasSelection(); params.expected_pages_count = expected_pages_count; MarginType margin_type = DEFAULT_MARGINS; if (PrintingNodeOrPdfFrame(frame, node)) { margin_type = GetMarginsForPdf(frame, node, print_pages_params_->params); } params.margin_type = margin_type; params.is_scripted = is_scripted; Send(new PrintHostMsg_DidShowPrintDialog(routing_id())); blink::WebPrintScalingOption scaling_option = print_pages_params_->params.print_scaling_option; print_pages_params_.reset(); IPC::SyncMessage* msg = new PrintHostMsg_ScriptedPrint(routing_id(), params, &print_settings); msg->EnableMessagePumping(); Send(msg); print_settings.params.print_scaling_option = scaling_option; SetPrintPagesParams(print_settings); return (print_settings.params.dpi && print_settings.params.document_cookie); } ",0 "void NetworkChangeNotifier::RemoveDNSObserver(DNSObserver* observer) { if (g_network_change_notifier) { g_network_change_notifier->resolver_state_observer_list_->RemoveObserver( observer); } } ",0 "HRESULT CallDwmSetIconicLivePreviewBitmap(HWND window, HBITMAP bitmap, POINT* client, DWORD flags) { FilePath dwmapi_path(base::GetNativeLibraryName(L""dwmapi"")); base::ScopedNativeLibrary dwmapi(dwmapi_path); typedef HRESULT (STDAPICALLTYPE *DwmSetIconicLivePreviewBitmapProc)( HWND, HBITMAP, POINT*, DWORD); DwmSetIconicLivePreviewBitmapProc dwm_set_live_preview_bitmap = static_cast( dwmapi.GetFunctionPointer(""DwmSetIconicLivePreviewBitmap"")); if (!dwm_set_live_preview_bitmap) return E_FAIL; return dwm_set_live_preview_bitmap(window, bitmap, client, flags); } ",0 "void CoordinatorImpl::OnHeapDumpTimeOut(uint64_t dump_guid) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); QueuedRequest* request = GetCurrentRequest(); if (!request || request->dump_guid != dump_guid) return; if (request->heap_dump_in_progress) { request->heap_dump_in_progress = false; FinalizeGlobalMemoryDumpIfAllManagersReplied(); } } ",0 "void ipv6_push_frag_opts(struct sk_buff *skb, struct ipv6_txoptions *opt, u8 *proto) { if (opt->dst1opt) ipv6_push_exthdr(skb, proto, NEXTHDR_DEST, opt->dst1opt); } ",0 "void ChromeContentBrowserClient::OnNetworkServiceCreated( network::mojom::NetworkService* network_service) { if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) return; if (!SystemNetworkContextManager::GetInstance()) { DCHECK(!g_browser_process); DCHECK(chrome_feature_list_creator_->local_state()); SystemNetworkContextManager::CreateInstance( chrome_feature_list_creator_->local_state()); } SystemNetworkContextManager::GetInstance()->OnNetworkServiceCreated( network_service); } ",0 "const char* GLES2DecoderPassthroughImpl::GetCommandName( unsigned int command_id) const { if (command_id >= kFirstGLES2Command && command_id < kNumCommands) { return gles2::GetCommandName(static_cast(command_id)); } return GetCommonCommandName(static_cast(command_id)); } ",0 "cupsdCloseAllClients(void) { cupsd_client_t *con; /* Current client */ cupsdLogMessage(CUPSD_LOG_DEBUG2, ""cupsdCloseAllClients() Clients=%d"", cupsArrayCount(Clients)); for (con = (cupsd_client_t *)cupsArrayFirst(Clients); con; con = (cupsd_client_t *)cupsArrayNext(Clients)) if (cupsdCloseClient(con)) cupsdCloseClient(con); } ",0 "void PeopleHandler::HandleSetEncryption(const base::ListValue* args) { DCHECK(!sync_startup_tracker_); SyncConfigInfo configuration; const base::Value* callback_id = nullptr; ParseConfigurationArguments(args, &configuration, &callback_id); ProfileSyncService* service = GetSyncService(); if (!service || !service->IsEngineInitialized()) { CloseSyncSetup(); ResolveJavascriptCallback(*callback_id, base::Value(kDonePageStatus)); return; } if (!service->IsEncryptEverythingAllowed()) configuration.encrypt_all = false; if (configuration.encrypt_all) service->EnableEncryptEverything(); bool passphrase_failed = false; if (!configuration.passphrase.empty()) { if (service->IsPassphraseRequired()) { passphrase_failed = !service->SetDecryptionPassphrase(configuration.passphrase); } else { if (configuration.set_new_passphrase && !service->IsUsingSecondaryPassphrase()) { service->SetEncryptionPassphrase(configuration.passphrase); } } } if (passphrase_failed || service->IsPassphraseRequiredForDecryption()) { ResolveJavascriptCallback(*callback_id, base::Value(kPassphraseFailedPageStatus)); } else { ResolveJavascriptCallback(*callback_id, base::Value(kConfigurePageStatus)); } if (configuration.encrypt_all) ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_ENCRYPT); if (!configuration.set_new_passphrase && !configuration.passphrase.empty()) ProfileMetrics::LogProfileSyncInfo(ProfileMetrics::SYNC_PASSPHRASE); } ",0 "void TestWebKitPlatformSupport::sampleGamepads(WebKit::WebGamepads& data) { data = gamepad_data_; } ",0 "static unsigned ucvector_push_back(ucvector* p, unsigned char c) { if(!ucvector_resize(p, p->size + 1)) return 0; p->data[p->size - 1] = c; return 1; } ",0 "static int fuse_request_send_notify_reply(struct fuse_conn *fc, struct fuse_req *req, u64 unique) { int err = -ENODEV; req->isreply = 0; req->in.h.unique = unique; spin_lock(&fc->lock); if (fc->connected) { queue_request(fc, req); err = 0; } spin_unlock(&fc->lock); return err; } ",0 "void ext4_abort(struct super_block *sb, const char *function, const char *fmt, ...) { va_list args; va_start(args, fmt); printk(KERN_CRIT ""EXT4-fs error (device %s): %s: "", sb->s_id, function); vprintk(fmt, args); printk(""\n""); va_end(args); if (test_opt(sb, ERRORS_PANIC)) panic(""EXT4-fs panic from previous error\n""); if (sb->s_flags & MS_RDONLY) return; ext4_msg(sb, KERN_CRIT, ""Remounting filesystem read-only""); EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; sb->s_flags |= MS_RDONLY; EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; if (EXT4_SB(sb)->s_journal) jbd2_journal_abort(EXT4_SB(sb)->s_journal, -EIO); } ",0 " RenderFrameHostCreatedObserver(WebContents* web_contents, int expected_frame_count) : WebContentsObserver(web_contents), expected_frame_count_(expected_frame_count), frames_created_(0) {} ",0 "PHP_METHOD(Phar, __construct) { #if !HAVE_SPL zend_throw_exception_ex(zend_ce_exception, 0, ""Cannot instantiate Phar object without SPL extension""); #else char *fname, *alias = NULL, *error, *arch = NULL, *entry = NULL, *save_fname; size_t fname_len, alias_len = 0; int arch_len, entry_len, is_data; zend_long flags = SPL_FILE_DIR_SKIPDOTS|SPL_FILE_DIR_UNIXPATHS; zend_long format = 0; phar_archive_object *phar_obj; phar_archive_data *phar_data; zval *zobj = getThis(), arg1, arg2; phar_obj = (phar_archive_object*)((char*)Z_OBJ_P(zobj) - Z_OBJ_P(zobj)->handlers->offset); is_data = instanceof_function(Z_OBJCE_P(zobj), phar_ce_data); if (is_data) { if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), ""s|ls!l"", &fname, &fname_len, &flags, &alias, &alias_len, &format) == FAILURE) { return; } } else { if (zend_parse_parameters_throw(ZEND_NUM_ARGS(), ""s|ls!"", &fname, &fname_len, &flags, &alias, &alias_len) == FAILURE) { return; } } if (phar_obj->archive) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, ""Cannot call constructor twice""); return; } save_fname = fname; if (SUCCESS == phar_split_fname(fname, (int)fname_len, &arch, &arch_len, &entry, &entry_len, !is_data, 2)) { /* use arch (the basename for the archive) for fname instead of fname */ /* this allows support for RecursiveDirectoryIterator of subdirectories */ #ifdef PHP_WIN32 phar_unixify_path_separators(arch, arch_len); #endif fname = arch; fname_len = arch_len; #ifdef PHP_WIN32 } else { arch = estrndup(fname, fname_len); arch_len = fname_len; fname = arch; phar_unixify_path_separators(arch, arch_len); #endif } if (phar_open_or_create_filename(fname, fname_len, alias, alias_len, is_data, REPORT_ERRORS, &phar_data, &error) == FAILURE) { if (fname == arch && fname != save_fname) { efree(arch); fname = save_fname; } if (entry) { efree(entry); } if (error) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""%s"", error); efree(error); } else { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""Phar creation or opening failed""); } return; } if (is_data && phar_data->is_tar && phar_data->is_brandnew && format == PHAR_FORMAT_ZIP) { phar_data->is_zip = 1; phar_data->is_tar = 0; } if (fname == arch) { efree(arch); fname = save_fname; } if ((is_data && !phar_data->is_data) || (!is_data && phar_data->is_data)) { if (is_data) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""PharData class can only be used for non-executable tar and zip archives""); } else { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""Phar class can only be used for executable tar and zip archives""); } efree(entry); return; } is_data = phar_data->is_data; if (!phar_data->is_persistent) { ++(phar_data->refcount); } phar_obj->archive = phar_data; phar_obj->spl.oth_handler = &phar_spl_foreign_handler; if (entry) { fname_len = spprintf(&fname, 0, ""phar://%s%s"", phar_data->fname, entry); efree(entry); } else { fname_len = spprintf(&fname, 0, ""phar://%s"", phar_data->fname); } ZVAL_STRINGL(&arg1, fname, fname_len); ZVAL_LONG(&arg2, flags); zend_call_method_with_2_params(zobj, Z_OBJCE_P(zobj), &spl_ce_RecursiveDirectoryIterator->constructor, ""__construct"", NULL, &arg1, &arg2); zval_ptr_dtor(&arg1); if (!phar_data->is_persistent) { phar_obj->archive->is_data = is_data; } else if (!EG(exception)) { /* register this guy so we can modify if necessary */ zend_hash_str_add_ptr(&PHAR_G(phar_persist_map), (const char *) phar_obj->archive, sizeof(phar_obj->archive), phar_obj); } phar_obj->spl.info_class = phar_ce_entry; efree(fname); #endif /* HAVE_SPL */ } ",1 "static int codebook_decode_deinterleave_repeat(vorb *f, Codebook *c, float **outputs, int ch, int *c_inter_p, int *p_inter_p, int len, int total_decode) { int c_inter = *c_inter_p; int p_inter = *p_inter_p; int i,z, effective = c->dimensions; if (c->lookup_type == 0) return error(f, VORBIS_invalid_stream); while (total_decode > 0) { float last = CODEBOOK_ELEMENT_BASE(c); DECODE_VQ(z,f,c); #ifndef STB_VORBIS_DIVIDES_IN_CODEBOOK assert(!c->sparse || z < c->sorted_entries); #endif if (z < 0) { if (!f->bytes_in_seg) if (f->last_seg) return FALSE; return error(f, VORBIS_invalid_stream); } if (c_inter + p_inter*ch + effective > len * ch) { effective = len*ch - (p_inter*ch - c_inter); } #ifdef STB_VORBIS_DIVIDES_IN_CODEBOOK if (c->lookup_type == 1) { int div = 1; for (i=0; i < effective; ++i) { int off = (z / div) % c->lookup_values; float val = CODEBOOK_ELEMENT_FAST(c,off) + last; if (outputs[c_inter]) outputs[c_inter][p_inter] += val; if (++c_inter == ch) { c_inter = 0; ++p_inter; } if (c->sequence_p) last = val; div *= c->lookup_values; } } else #endif { z *= c->dimensions; if (c->sequence_p) { for (i=0; i < effective; ++i) { float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; if (outputs[c_inter]) outputs[c_inter][p_inter] += val; if (++c_inter == ch) { c_inter = 0; ++p_inter; } last = val; } } else { for (i=0; i < effective; ++i) { float val = CODEBOOK_ELEMENT_FAST(c,z+i) + last; if (outputs[c_inter]) outputs[c_inter][p_inter] += val; if (++c_inter == ch) { c_inter = 0; ++p_inter; } } } } total_decode -= effective; } *c_inter_p = c_inter; *p_inter_p = p_inter; return TRUE; } ",0 "void GLES2DecoderImpl::DoGetShaderiv( GLuint shader, GLenum pname, GLint* params) { ShaderManager::ShaderInfo* info = GetShaderInfoNotProgram( shader, ""glGetShaderiv""); if (!info) { return; } switch (pname) { case GL_SHADER_SOURCE_LENGTH: *params = info->source().size(); return; case GL_COMPILE_STATUS: *params = info->IsValid(); return; case GL_INFO_LOG_LENGTH: *params = info->log_info().size() + 1; return; default: break; } glGetShaderiv(info->service_id(), pname, params); } ",0 "void ChromeMockRenderThread::OnCheckForCancel( const std::string& preview_ui_addr, int preview_request_id, bool* cancel) { *cancel = (print_preview_pages_remaining_ == print_preview_cancel_page_number_); } ",1 "TimeRanges* HTMLMediaElement::buffered() const { if (media_source_) return media_source_->Buffered(); if (!GetWebMediaPlayer()) return TimeRanges::Create(); return TimeRanges::Create(GetWebMediaPlayer()->Buffered()); } ",0 "void RenderFrameDevToolsAgentHost::GrantPolicy() { if (!frame_host_) return; uint32_t process_id = frame_host_->GetProcess()->GetID(); if (base::FeatureList::IsEnabled(network::features::kNetworkService)) GetNetworkService()->SetRawHeadersAccess(process_id, true); ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadRawCookies( process_id); } ",0 "int attribute_align_arg avcodec_decode_audio4(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, const AVPacket *avpkt) { AVCodecInternal *avci = avctx->internal; int ret = 0; *got_frame_ptr = 0; if (!avctx->codec) return AVERROR(EINVAL); if (!avctx->codec->decode) { av_log(avctx, AV_LOG_ERROR, ""This decoder requires using the avcodec_send_packet() API.\n""); return AVERROR(ENOSYS); } if (!avpkt->data && avpkt->size) { av_log(avctx, AV_LOG_ERROR, ""invalid packet: NULL data, size != 0\n""); return AVERROR(EINVAL); } if (avctx->codec->type != AVMEDIA_TYPE_AUDIO) { av_log(avctx, AV_LOG_ERROR, ""Invalid media type for audio\n""); return AVERROR(EINVAL); } av_frame_unref(frame); if ((avctx->codec->capabilities & AV_CODEC_CAP_DELAY) || avpkt->size || (avctx->active_thread_type & FF_THREAD_FRAME)) { uint8_t *side; int side_size; uint32_t discard_padding = 0; uint8_t skip_reason = 0; uint8_t discard_reason = 0; AVPacket tmp = *avpkt; int did_split = av_packet_split_side_data(&tmp); ret = apply_param_change(avctx, &tmp); if (ret < 0) goto fail; avctx->internal->pkt = &tmp; if (HAVE_THREADS && avctx->active_thread_type & FF_THREAD_FRAME) ret = ff_thread_decode_frame(avctx, frame, got_frame_ptr, &tmp); else { ret = avctx->codec->decode(avctx, frame, got_frame_ptr, &tmp); av_assert0(ret <= tmp.size); frame->pkt_dts = avpkt->dts; } if (ret >= 0 && *got_frame_ptr) { avctx->frame_number++; av_frame_set_best_effort_timestamp(frame, guess_correct_pts(avctx, frame->pts, frame->pkt_dts)); if (frame->format == AV_SAMPLE_FMT_NONE) frame->format = avctx->sample_fmt; if (!frame->channel_layout) frame->channel_layout = avctx->channel_layout; if (!av_frame_get_channels(frame)) av_frame_set_channels(frame, avctx->channels); if (!frame->sample_rate) frame->sample_rate = avctx->sample_rate; } side= av_packet_get_side_data(avctx->internal->pkt, AV_PKT_DATA_SKIP_SAMPLES, &side_size); if(side && side_size>=10) { avctx->internal->skip_samples = AV_RL32(side); discard_padding = AV_RL32(side + 4); av_log(avctx, AV_LOG_DEBUG, ""skip %d / discard %d samples due to side data\n"", avctx->internal->skip_samples, (int)discard_padding); skip_reason = AV_RL8(side + 8); discard_reason = AV_RL8(side + 9); } if ((frame->flags & AV_FRAME_FLAG_DISCARD) && *got_frame_ptr && !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) { avctx->internal->skip_samples = FFMAX(0, avctx->internal->skip_samples - frame->nb_samples); *got_frame_ptr = 0; } if (avctx->internal->skip_samples > 0 && *got_frame_ptr && !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) { if(frame->nb_samples <= avctx->internal->skip_samples){ *got_frame_ptr = 0; avctx->internal->skip_samples -= frame->nb_samples; av_log(avctx, AV_LOG_DEBUG, ""skip whole frame, skip left: %d\n"", avctx->internal->skip_samples); } else { av_samples_copy(frame->extended_data, frame->extended_data, 0, avctx->internal->skip_samples, frame->nb_samples - avctx->internal->skip_samples, avctx->channels, frame->format); if(avctx->pkt_timebase.num && avctx->sample_rate) { int64_t diff_ts = av_rescale_q(avctx->internal->skip_samples, (AVRational){1, avctx->sample_rate}, avctx->pkt_timebase); if(frame->pts!=AV_NOPTS_VALUE) frame->pts += diff_ts; #if FF_API_PKT_PTS FF_DISABLE_DEPRECATION_WARNINGS if(frame->pkt_pts!=AV_NOPTS_VALUE) frame->pkt_pts += diff_ts; FF_ENABLE_DEPRECATION_WARNINGS #endif if(frame->pkt_dts!=AV_NOPTS_VALUE) frame->pkt_dts += diff_ts; if (av_frame_get_pkt_duration(frame) >= diff_ts) av_frame_set_pkt_duration(frame, av_frame_get_pkt_duration(frame) - diff_ts); } else { av_log(avctx, AV_LOG_WARNING, ""Could not update timestamps for skipped samples.\n""); } av_log(avctx, AV_LOG_DEBUG, ""skip %d/%d samples\n"", avctx->internal->skip_samples, frame->nb_samples); frame->nb_samples -= avctx->internal->skip_samples; avctx->internal->skip_samples = 0; } } if (discard_padding > 0 && discard_padding <= frame->nb_samples && *got_frame_ptr && !(avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL)) { if (discard_padding == frame->nb_samples) { *got_frame_ptr = 0; } else { if(avctx->pkt_timebase.num && avctx->sample_rate) { int64_t diff_ts = av_rescale_q(frame->nb_samples - discard_padding, (AVRational){1, avctx->sample_rate}, avctx->pkt_timebase); av_frame_set_pkt_duration(frame, diff_ts); } else { av_log(avctx, AV_LOG_WARNING, ""Could not update timestamps for discarded samples.\n""); } av_log(avctx, AV_LOG_DEBUG, ""discard %d/%d samples\n"", (int)discard_padding, frame->nb_samples); frame->nb_samples -= discard_padding; } } if ((avctx->flags2 & AV_CODEC_FLAG2_SKIP_MANUAL) && *got_frame_ptr) { AVFrameSideData *fside = av_frame_new_side_data(frame, AV_FRAME_DATA_SKIP_SAMPLES, 10); if (fside) { AV_WL32(fside->data, avctx->internal->skip_samples); AV_WL32(fside->data + 4, discard_padding); AV_WL8(fside->data + 8, skip_reason); AV_WL8(fside->data + 9, discard_reason); avctx->internal->skip_samples = 0; } } fail: avctx->internal->pkt = NULL; if (did_split) { av_packet_free_side_data(&tmp); if(ret == tmp.size) ret = avpkt->size; } if (ret >= 0 && *got_frame_ptr) { if (!avctx->refcounted_frames) { int err = unrefcount_frame(avci, frame); if (err < 0) return err; } } else av_frame_unref(frame); } av_assert0(ret <= avpkt->size); if (!avci->showed_multi_packet_warning && ret >= 0 && ret != avpkt->size && !(avctx->codec->capabilities & AV_CODEC_CAP_SUBFRAMES)) { av_log(avctx, AV_LOG_WARNING, ""Multiple frames in a packet.\n""); avci->showed_multi_packet_warning = 1; } return ret; } ",0 "static int get8_packet(vorb *f) { int x = get8_packet_raw(f); f->valid_bits = 0; return x; } ",0 "int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) { const struct x86_emulate_ops *ops = ctxt->ops; int rc = X86EMUL_CONTINUE; int saved_dst_type = ctxt->dst.type; ctxt->mem_read.pos = 0; /* LOCK prefix is allowed only with some instructions */ if (ctxt->lock_prefix && (!(ctxt->d & Lock) || ctxt->dst.type != OP_MEM)) { rc = emulate_ud(ctxt); goto done; } if ((ctxt->d & SrcMask) == SrcMemFAddr && ctxt->src.type != OP_MEM) { rc = emulate_ud(ctxt); goto done; } if (unlikely(ctxt->d & (No64|Undefined|Sse|Mmx|Intercept|CheckPerm|Priv|Prot|String))) { if ((ctxt->mode == X86EMUL_MODE_PROT64 && (ctxt->d & No64)) || (ctxt->d & Undefined)) { rc = emulate_ud(ctxt); goto done; } if (((ctxt->d & (Sse|Mmx)) && ((ops->get_cr(ctxt, 0) & X86_CR0_EM))) || ((ctxt->d & Sse) && !(ops->get_cr(ctxt, 4) & X86_CR4_OSFXSR))) { rc = emulate_ud(ctxt); goto done; } if ((ctxt->d & (Sse|Mmx)) && (ops->get_cr(ctxt, 0) & X86_CR0_TS)) { rc = emulate_nm(ctxt); goto done; } if (ctxt->d & Mmx) { rc = flush_pending_x87_faults(ctxt); if (rc != X86EMUL_CONTINUE) goto done; /* * Now that we know the fpu is exception safe, we can fetch * operands from it. */ fetch_possible_mmx_operand(ctxt, &ctxt->src); fetch_possible_mmx_operand(ctxt, &ctxt->src2); if (!(ctxt->d & Mov)) fetch_possible_mmx_operand(ctxt, &ctxt->dst); } if (unlikely(ctxt->guest_mode) && (ctxt->d & Intercept)) { rc = emulator_check_intercept(ctxt, ctxt->intercept, X86_ICPT_PRE_EXCEPT); if (rc != X86EMUL_CONTINUE) goto done; } /* Privileged instruction can be executed only in CPL=0 */ if ((ctxt->d & Priv) && ops->cpl(ctxt)) { if (ctxt->d & PrivUD) rc = emulate_ud(ctxt); else rc = emulate_gp(ctxt, 0); goto done; } /* Instruction can only be executed in protected mode */ if ((ctxt->d & Prot) && ctxt->mode < X86EMUL_MODE_PROT16) { rc = emulate_ud(ctxt); goto done; } /* Do instruction specific permission checks */ if (ctxt->d & CheckPerm) { rc = ctxt->check_perm(ctxt); if (rc != X86EMUL_CONTINUE) goto done; } if (unlikely(ctxt->guest_mode) && (ctxt->d & Intercept)) { rc = emulator_check_intercept(ctxt, ctxt->intercept, X86_ICPT_POST_EXCEPT); if (rc != X86EMUL_CONTINUE) goto done; } if (ctxt->rep_prefix && (ctxt->d & String)) { /* All REP prefixes have the same first termination condition */ if (address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) == 0) { ctxt->eip = ctxt->_eip; ctxt->eflags &= ~EFLG_RF; goto done; } } } if ((ctxt->src.type == OP_MEM) && !(ctxt->d & NoAccess)) { rc = segmented_read(ctxt, ctxt->src.addr.mem, ctxt->src.valptr, ctxt->src.bytes); if (rc != X86EMUL_CONTINUE) goto done; ctxt->src.orig_val64 = ctxt->src.val64; } if (ctxt->src2.type == OP_MEM) { rc = segmented_read(ctxt, ctxt->src2.addr.mem, &ctxt->src2.val, ctxt->src2.bytes); if (rc != X86EMUL_CONTINUE) goto done; } if ((ctxt->d & DstMask) == ImplicitOps) goto special_insn; if ((ctxt->dst.type == OP_MEM) && !(ctxt->d & Mov)) { /* optimisation - avoid slow emulated read if Mov */ rc = segmented_read(ctxt, ctxt->dst.addr.mem, &ctxt->dst.val, ctxt->dst.bytes); if (rc != X86EMUL_CONTINUE) goto done; } ctxt->dst.orig_val = ctxt->dst.val; special_insn: if (unlikely(ctxt->guest_mode) && (ctxt->d & Intercept)) { rc = emulator_check_intercept(ctxt, ctxt->intercept, X86_ICPT_POST_MEMACCESS); if (rc != X86EMUL_CONTINUE) goto done; } if (ctxt->rep_prefix && (ctxt->d & String)) ctxt->eflags |= EFLG_RF; else ctxt->eflags &= ~EFLG_RF; if (ctxt->execute) { if (ctxt->d & Fastop) { void (*fop)(struct fastop *) = (void *)ctxt->execute; rc = fastop(ctxt, fop); if (rc != X86EMUL_CONTINUE) goto done; goto writeback; } rc = ctxt->execute(ctxt); if (rc != X86EMUL_CONTINUE) goto done; goto writeback; } if (ctxt->opcode_len == 2) goto twobyte_insn; else if (ctxt->opcode_len == 3) goto threebyte_insn; switch (ctxt->b) { case 0x63: /* movsxd */ if (ctxt->mode != X86EMUL_MODE_PROT64) goto cannot_emulate; ctxt->dst.val = (s32) ctxt->src.val; break; case 0x70 ... 0x7f: /* jcc (short) */ if (test_cc(ctxt->b, ctxt->eflags)) rc = jmp_rel(ctxt, ctxt->src.val); break; case 0x8d: /* lea r16/r32, m */ ctxt->dst.val = ctxt->src.addr.mem.ea; break; case 0x90 ... 0x97: /* nop / xchg reg, rax */ if (ctxt->dst.addr.reg == reg_rmw(ctxt, VCPU_REGS_RAX)) ctxt->dst.type = OP_NONE; else rc = em_xchg(ctxt); break; case 0x98: /* cbw/cwde/cdqe */ switch (ctxt->op_bytes) { case 2: ctxt->dst.val = (s8)ctxt->dst.val; break; case 4: ctxt->dst.val = (s16)ctxt->dst.val; break; case 8: ctxt->dst.val = (s32)ctxt->dst.val; break; } break; case 0xcc: /* int3 */ rc = emulate_int(ctxt, 3); break; case 0xcd: /* int n */ rc = emulate_int(ctxt, ctxt->src.val); break; case 0xce: /* into */ if (ctxt->eflags & EFLG_OF) rc = emulate_int(ctxt, 4); break; case 0xe9: /* jmp rel */ case 0xeb: /* jmp rel short */ rc = jmp_rel(ctxt, ctxt->src.val); ctxt->dst.type = OP_NONE; /* Disable writeback. */ break; case 0xf4: /* hlt */ ctxt->ops->halt(ctxt); break; case 0xf5: /* cmc */ /* complement carry flag from eflags reg */ ctxt->eflags ^= EFLG_CF; break; case 0xf8: /* clc */ ctxt->eflags &= ~EFLG_CF; break; case 0xf9: /* stc */ ctxt->eflags |= EFLG_CF; break; case 0xfc: /* cld */ ctxt->eflags &= ~EFLG_DF; break; case 0xfd: /* std */ ctxt->eflags |= EFLG_DF; break; default: goto cannot_emulate; } if (rc != X86EMUL_CONTINUE) goto done; writeback: if (ctxt->d & SrcWrite) { BUG_ON(ctxt->src.type == OP_MEM || ctxt->src.type == OP_MEM_STR); rc = writeback(ctxt, &ctxt->src); if (rc != X86EMUL_CONTINUE) goto done; } if (!(ctxt->d & NoWrite)) { rc = writeback(ctxt, &ctxt->dst); if (rc != X86EMUL_CONTINUE) goto done; } /* * restore dst type in case the decoding will be reused * (happens for string instruction ) */ ctxt->dst.type = saved_dst_type; if ((ctxt->d & SrcMask) == SrcSI) string_addr_inc(ctxt, VCPU_REGS_RSI, &ctxt->src); if ((ctxt->d & DstMask) == DstDI) string_addr_inc(ctxt, VCPU_REGS_RDI, &ctxt->dst); if (ctxt->rep_prefix && (ctxt->d & String)) { unsigned int count; struct read_cache *r = &ctxt->io_read; if ((ctxt->d & SrcMask) == SrcSI) count = ctxt->src.count; else count = ctxt->dst.count; register_address_increment(ctxt, reg_rmw(ctxt, VCPU_REGS_RCX), -count); if (!string_insn_completed(ctxt)) { /* * Re-enter guest when pio read ahead buffer is empty * or, if it is not used, after each 1024 iteration. */ if ((r->end != 0 || reg_read(ctxt, VCPU_REGS_RCX) & 0x3ff) && (r->end == 0 || r->end != r->pos)) { /* * Reset read cache. Usually happens before * decode, but since instruction is restarted * we have to do it here. */ ctxt->mem_read.end = 0; writeback_registers(ctxt); return EMULATION_RESTART; } goto done; /* skip rip writeback */ } ctxt->eflags &= ~EFLG_RF; } ctxt->eip = ctxt->_eip; done: if (rc == X86EMUL_PROPAGATE_FAULT) { WARN_ON(ctxt->exception.vector > 0x1f); ctxt->have_exception = true; } if (rc == X86EMUL_INTERCEPTED) return EMULATION_INTERCEPTED; if (rc == X86EMUL_CONTINUE) writeback_registers(ctxt); return (rc == X86EMUL_UNHANDLEABLE) ? EMULATION_FAILED : EMULATION_OK; twobyte_insn: switch (ctxt->b) { case 0x09: /* wbinvd */ (ctxt->ops->wbinvd)(ctxt); break; case 0x08: /* invd */ case 0x0d: /* GrpP (prefetch) */ case 0x18: /* Grp16 (prefetch/nop) */ case 0x1f: /* nop */ break; case 0x20: /* mov cr, reg */ ctxt->dst.val = ops->get_cr(ctxt, ctxt->modrm_reg); break; case 0x21: /* mov from dr to reg */ ops->get_dr(ctxt, ctxt->modrm_reg, &ctxt->dst.val); break; case 0x40 ... 0x4f: /* cmov */ if (test_cc(ctxt->b, ctxt->eflags)) ctxt->dst.val = ctxt->src.val; else if (ctxt->mode != X86EMUL_MODE_PROT64 || ctxt->op_bytes != 4) ctxt->dst.type = OP_NONE; /* no writeback */ break; case 0x80 ... 0x8f: /* jnz rel, etc*/ if (test_cc(ctxt->b, ctxt->eflags)) rc = jmp_rel(ctxt, ctxt->src.val); break; case 0x90 ... 0x9f: /* setcc r/m8 */ ctxt->dst.val = test_cc(ctxt->b, ctxt->eflags); break; case 0xb6 ... 0xb7: /* movzx */ ctxt->dst.bytes = ctxt->op_bytes; ctxt->dst.val = (ctxt->src.bytes == 1) ? (u8) ctxt->src.val : (u16) ctxt->src.val; break; case 0xbe ... 0xbf: /* movsx */ ctxt->dst.bytes = ctxt->op_bytes; ctxt->dst.val = (ctxt->src.bytes == 1) ? (s8) ctxt->src.val : (s16) ctxt->src.val; break; case 0xc3: /* movnti */ ctxt->dst.bytes = ctxt->op_bytes; ctxt->dst.val = (ctxt->op_bytes == 8) ? (u64) ctxt->src.val : (u32) ctxt->src.val; break; default: goto cannot_emulate; } threebyte_insn: if (rc != X86EMUL_CONTINUE) goto done; goto writeback; cannot_emulate: return EMULATION_FAILED; } ",0 "static TEE_Result user_ta_enter_open_session(struct tee_ta_session *s, struct tee_ta_param *param, TEE_ErrorOrigin *eo) { return user_ta_enter(eo, s, UTEE_ENTRY_FUNC_OPEN_SESSION, 0, param); } ",0 "static struct sock *__sco_get_sock_listen_by_addr(bdaddr_t *ba) { struct sock *sk; sk_for_each(sk, &sco_sk_list.head) { if (sk->sk_state != BT_LISTEN) continue; if (!bacmp(&sco_pi(sk)->src, ba)) return sk; } return NULL; } ",0 " BlobRegistryContext(const KURL& url, PassOwnPtr blobData) : url(url.copy()) , blobData(blobData) { this->blobData->detachFromCurrentThread(); } ",0 "bool PasswordAutofillManager::GetDeletionConfirmationText( const base::string16& value, int identifier, base::string16* title, base::string16* body) { return false; } ",0 "void FrameLoader::setOpener(Frame* opener) { if (m_opener && !opener) m_client->didDisownOpener(); if (m_opener) m_opener->loader()->m_openedFrames.remove(m_frame); if (opener) opener->loader()->m_openedFrames.add(m_frame); m_opener = opener; if (m_frame->document()) m_frame->document()->initSecurityContext(); } ",0 "void mp_encode_lua_type(lua_State *L, mp_buf *buf, int level) { int t = lua_type(L,-1); /* Limit the encoding of nested tables to a specified maximum depth, so that * we survive when called against circular references in tables. */ if (t == LUA_TTABLE && level == LUACMSGPACK_MAX_NESTING) t = LUA_TNIL; switch(t) { case LUA_TSTRING: mp_encode_lua_string(L,buf); break; case LUA_TBOOLEAN: mp_encode_lua_bool(L,buf); break; case LUA_TNUMBER: #if LUA_VERSION_NUM < 503 mp_encode_lua_number(L,buf); break; #else if (lua_isinteger(L, -1)) { mp_encode_lua_integer(L, buf); } else { mp_encode_lua_number(L, buf); } break; #endif case LUA_TTABLE: mp_encode_lua_table(L,buf,level); break; default: mp_encode_lua_null(L,buf); break; } lua_pop(L,1); } ",0 "static const char *rpc_proc_name(const struct rpc_task *task) { const struct rpc_procinfo *proc = task->tk_msg.rpc_proc; if (proc) { if (proc->p_name) return proc->p_name; else return ""NULL""; } else return ""no proc""; } ",0 "hook_exec_end () { if (hook_exec_recursion > 0) hook_exec_recursion--; if (hook_exec_recursion == 0) hook_remove_deleted (); } ",0 "static void attach_mnt(struct mount *mnt, struct path *path) { mnt_set_mountpoint(real_mount(path->mnt), path->dentry, mnt); list_add_tail(&mnt->mnt_hash, mount_hashtable + hash(path->mnt, path->dentry)); list_add_tail(&mnt->mnt_child, &real_mount(path->mnt)->mnt_mounts); } ",0 " ServiceWorkerVersionBrowserTest() : next_registration_id_(1) {} ",0 "static void vmx_set_constant_host_state(struct vcpu_vmx *vmx) { u32 low32, high32; unsigned long tmpl; struct desc_ptr dt; unsigned long cr0, cr4; cr0 = read_cr0(); WARN_ON(cr0 & X86_CR0_TS); vmcs_writel(HOST_CR0, cr0); /* 22.2.3 */ vmcs_writel(HOST_CR3, read_cr3()); /* 22.2.3 FIXME: shadow tables */ /* Save the most likely value for this task's CR4 in the VMCS. */ cr4 = cr4_read_shadow(); vmcs_writel(HOST_CR4, cr4); /* 22.2.3, 22.2.5 */ vmx->host_state.vmcs_host_cr4 = cr4; vmcs_write16(HOST_CS_SELECTOR, __KERNEL_CS); /* 22.2.4 */ #ifdef CONFIG_X86_64 /* * Load null selectors, so we can avoid reloading them in * __vmx_load_host_state(), in case userspace uses the null selectors * too (the expected case). */ vmcs_write16(HOST_DS_SELECTOR, 0); vmcs_write16(HOST_ES_SELECTOR, 0); #else vmcs_write16(HOST_DS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ vmcs_write16(HOST_ES_SELECTOR, __KERNEL_DS); /* 22.2.4 */ #endif vmcs_write16(HOST_SS_SELECTOR, __KERNEL_DS); /* 22.2.4 */ vmcs_write16(HOST_TR_SELECTOR, GDT_ENTRY_TSS*8); /* 22.2.4 */ native_store_idt(&dt); vmcs_writel(HOST_IDTR_BASE, dt.address); /* 22.2.4 */ vmx->host_idt_base = dt.address; vmcs_writel(HOST_RIP, vmx_return); /* 22.2.5 */ rdmsr(MSR_IA32_SYSENTER_CS, low32, high32); vmcs_write32(HOST_IA32_SYSENTER_CS, low32); rdmsrl(MSR_IA32_SYSENTER_EIP, tmpl); vmcs_writel(HOST_IA32_SYSENTER_EIP, tmpl); /* 22.2.3 */ if (vmcs_config.vmexit_ctrl & VM_EXIT_LOAD_IA32_PAT) { rdmsr(MSR_IA32_CR_PAT, low32, high32); vmcs_write64(HOST_IA32_PAT, low32 | ((u64) high32 << 32)); } } ",0 "static void tg3_frob_aux_power(struct tg3 *tp, bool include_wol) { bool need_vaux = false; /* The GPIOs do something completely different on 57765. */ if (!tg3_flag(tp, IS_NIC) || tg3_flag(tp, 57765_CLASS)) return; if (tg3_asic_rev(tp) == ASIC_REV_5717 || tg3_asic_rev(tp) == ASIC_REV_5719 || tg3_asic_rev(tp) == ASIC_REV_5720) { tg3_frob_aux_power_5717(tp, include_wol ? tg3_flag(tp, WOL_ENABLE) != 0 : 0); return; } if (tp->pdev_peer && tp->pdev_peer != tp->pdev) { struct net_device *dev_peer; dev_peer = pci_get_drvdata(tp->pdev_peer); /* remove_one() may have been run on the peer. */ if (dev_peer) { struct tg3 *tp_peer = netdev_priv(dev_peer); if (tg3_flag(tp_peer, INIT_COMPLETE)) return; if ((include_wol && tg3_flag(tp_peer, WOL_ENABLE)) || tg3_flag(tp_peer, ENABLE_ASF)) need_vaux = true; } } if ((include_wol && tg3_flag(tp, WOL_ENABLE)) || tg3_flag(tp, ENABLE_ASF)) need_vaux = true; if (need_vaux) tg3_pwrsrc_switch_to_vaux(tp); else tg3_pwrsrc_die_with_vmain(tp); } ",0 "static bool is_mnt_ns_file(struct dentry *dentry) { /* Is this a proxy for a mount namespace? */ struct inode *inode = dentry->d_inode; struct proc_ns *ei; if (!proc_ns_inode(inode)) return false; ei = get_proc_ns(inode); if (ei->ns_ops != &mntns_operations) return false; return true; } ",0 "ofputil_bucket_list_back(const struct ovs_list *buckets) { static struct ofputil_bucket *bucket; ASSIGN_CONTAINER(bucket, ovs_list_back(buckets), list_node); return bucket; } ",0 "INST_HANDLER (adiw) { // ADIW Rd+1:Rd, K int d = ((buf[0] & 0x30) >> 3) + 24; int k = (buf[0] & 0xf) | ((buf[0] >> 2) & 0x30); op->val = k; ESIL_A (""r%d:r%d,%d,+,"", d + 1, d, k); // Rd+1:Rd + Rr ESIL_A (""r%d,0x80,&,!,"" // V ""0,RPICK,0x8000,&,!,!,"" ""&,vf,=,"", d + 1); ESIL_A (""0,RPICK,0x8000,&,!,!,nf,=,""); // N ESIL_A (""0,RPICK,!,zf,=,""); // Z ESIL_A (""r%d,0x80,&,!,!,"" // C ""0,RPICK,0x8000,&,!,"" ""&,cf,=,"", d + 1); ESIL_A (""vf,nf,^,sf,=,""); // S ESIL_A (""r%d:r%d,=,"", d + 1, d); // Rd = result } ",0 "void Layer::AddClipChild(Layer* child) { if (!clip_children_) clip_children_.reset(new std::set); clip_children_->insert(child); SetNeedsCommit(); } ",0 "static int aes_t4_ocb_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { EVP_AES_OCB_CTX *octx = EVP_C_DATA(EVP_AES_OCB_CTX,ctx); if (!iv && !key) return 1; if (key) { do { /* * We set both the encrypt and decrypt key here because decrypt * needs both. We could possibly optimise to remove setting the * decrypt for an encryption operation. */ aes_t4_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &octx->ksenc.ks); aes_t4_set_decrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &octx->ksdec.ks); if (!CRYPTO_ocb128_init(&octx->ocb, &octx->ksenc.ks, &octx->ksdec.ks, (block128_f) aes_t4_encrypt, (block128_f) aes_t4_decrypt, NULL)) return 0; } while (0); /* * If we have an iv we can set it directly, otherwise use saved IV. */ if (iv == NULL && octx->iv_set) iv = octx->iv; if (iv) { if (CRYPTO_ocb128_setiv(&octx->ocb, iv, octx->ivlen, octx->taglen) != 1) return 0; octx->iv_set = 1; } octx->key_set = 1; } else { /* If key set use IV, otherwise copy */ if (octx->key_set) CRYPTO_ocb128_setiv(&octx->ocb, iv, octx->ivlen, octx->taglen); else memcpy(octx->iv, iv, octx->ivlen); octx->iv_set = 1; } return 1; } ",0 "void RenderFrameImpl::OnRenderFallbackContent() const { frame_->RenderFallbackContent(); } ",0 "static void t1_flush_cs(PDF pdf, boolean is_subr) { char *p; byte *r, *return_cs = NULL; cs_entry *tab, *end_tab, *ptr; char *start_line, *line_end; int count, size_pos; unsigned short cr, cs_len; if (is_subr) { start_line = subr_array_start; line_end = subr_array_end; size_pos = subr_size_pos; tab = subr_tab; count = subr_max + 1; end_tab = subr_tab + count; } else { start_line = cs_dict_start; line_end = cs_dict_end; size_pos = cs_size_pos; tab = cs_tab; end_tab = cs_ptr; count = cs_counter; } t1_line_ptr = t1_line_array; for (p = start_line; p - start_line < size_pos;) *t1_line_ptr++ = *p++; while (isdigit((unsigned char)*p)) p++; sprintf(t1_line_ptr, ""%u"", count); strcat(t1_line_ptr, p); t1_line_ptr = eol(t1_line_array); t1_putline(pdf); /*tex For |-Wall|. */ cs_len = 0; /*tex Create |return_cs| to replace unsused |subr|s. */ if (is_subr) { cr = 4330; cs_len = 0; /*tex At this point we have |t1_lenIV >= 0;| a negative value would be caught in |t1_scan_param|. */ return_cs = xtalloc((unsigned) (t1_lenIV + 1), byte); for (cs_len = 0, r = return_cs; cs_len < t1_lenIV; cs_len++, r++) *r = cencrypt(0x00, &cr); *r = cencrypt(CS_RETURN, &cr); cs_len++; } for (ptr = tab; ptr < end_tab; ptr++) { if (ptr->used) { if (is_subr) sprintf(t1_line_array, ""dup %li %u"", (long int) (ptr - tab), ptr->cslen); else sprintf(t1_line_array, ""/%s %u"", ptr->name, ptr->cslen); p = strend(t1_line_array); memcpy(p, ptr->data, ptr->len); t1_line_ptr = p + ptr->len; t1_putline(pdf); } else { /*tex Replace unsused subr's by |return_cs|. */ if (is_subr) { sprintf(t1_line_array, ""dup %li %u%s "", (long int) (ptr - tab), cs_len, cs_token_pair[0]); p = strend(t1_line_array); memcpy(p, return_cs, cs_len); t1_line_ptr = p + cs_len; t1_putline(pdf); sprintf(t1_line_array, "" %s"", cs_token_pair[1]); t1_line_ptr = eol(t1_line_array); t1_putline(pdf); } } xfree(ptr->data); if (is_subr) ptr->valid = false; if (ptr->name != notdef) xfree(ptr->name); } sprintf(t1_line_array, ""%s"", line_end); t1_line_ptr = eol(t1_line_array); t1_putline(pdf); if (is_subr) { end_tab = subr_tab + subr_size; for (ptr = tab; ptr < end_tab; ptr++) { if (ptr->valid) { xfree(ptr->data); if (ptr->name != notdef) xfree(ptr->name); } } xfree(return_cs); } xfree(tab); xfree(start_line); xfree(line_end); } ",0 "static u64 maybe_change_configuration(struct cpu_hw_events *cpuc, u64 pcr) { int i; if (!cpuc->n_added) goto out; /* Read in the counters which are moving. */ for (i = 0; i < cpuc->n_events; i++) { struct perf_event *cp = cpuc->event[i]; if (cpuc->current_idx[i] != PIC_NO_INDEX && cpuc->current_idx[i] != cp->hw.idx) { sparc_perf_event_update(cp, &cp->hw, cpuc->current_idx[i]); cpuc->current_idx[i] = PIC_NO_INDEX; } } /* Assign to counters all unassigned events. */ for (i = 0; i < cpuc->n_events; i++) { struct perf_event *cp = cpuc->event[i]; struct hw_perf_event *hwc = &cp->hw; int idx = hwc->idx; u64 enc; if (cpuc->current_idx[i] != PIC_NO_INDEX) continue; sparc_perf_event_set_period(cp, hwc, idx); cpuc->current_idx[i] = idx; enc = perf_event_get_enc(cpuc->events[i]); pcr &= ~mask_for_index(idx); if (hwc->state & PERF_HES_STOPPED) pcr |= nop_for_index(idx); else pcr |= event_encoding(enc, idx); } out: return pcr; } ",0 "void GLES2Implementation::CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei image_size, const void* data) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG( ""["" << GetLogPrefix() << ""] glCompressedTexImage3D("" << GLES2Util::GetStringTexture3DTarget(target) << "", "" << level << "", "" << GLES2Util::GetStringCompressedTextureFormat(internalformat) << "", "" << width << "", "" << height << "", "" << depth << "", "" << border << "", "" << image_size << "", "" << static_cast(data) << "")""); if (width < 0 || height < 0 || depth < 0 || level < 0) { SetGLError(GL_INVALID_VALUE, ""glCompressedTexImage3D"", ""dimension < 0""); return; } if (border != 0) { SetGLError(GL_INVALID_VALUE, ""glCompressedTexImage3D"", ""border != 0""); return; } if (bound_pixel_unpack_transfer_buffer_id_) { GLuint offset = ToGLuint(data); BufferTracker::Buffer* buffer = GetBoundPixelTransferBufferIfValid( bound_pixel_unpack_transfer_buffer_id_, ""glCompressedTexImage3D"", offset, image_size); if (buffer && buffer->shm_id() != -1) { helper_->CompressedTexImage3D(target, level, internalformat, width, height, depth, image_size, buffer->shm_id(), buffer->shm_offset() + offset); buffer->set_last_usage_token(helper_->InsertToken()); } return; } if (bound_pixel_unpack_buffer_) { helper_->CompressedTexImage3D(target, level, internalformat, width, height, depth, image_size, 0, ToGLuint(data)); } else if (data) { SetBucketContents(kResultBucketId, data, image_size); helper_->CompressedTexImage3DBucket(target, level, internalformat, width, height, depth, kResultBucketId); helper_->SetBucketSize(kResultBucketId, 0); } else { helper_->CompressedTexImage3D(target, level, internalformat, width, height, depth, image_size, 0, 0); } CheckGLError(); } ",0 "static void conditionalOrLongAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""conditionalOrLongAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState); imp->setConditionalOrLongAttribute(cppValue); } ",0 "int ext4_ext_map_blocks(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, int flags) { struct ext4_ext_path *path = NULL; struct ext4_extent newex, *ex, *ex2; struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); ext4_fsblk_t newblock = 0; int free_on_err = 0, err = 0, depth, ret; unsigned int allocated = 0, offset = 0; unsigned int allocated_clusters = 0; struct ext4_allocation_request ar; ext4_io_end_t *io = ext4_inode_aio(inode); ext4_lblk_t cluster_offset; int set_unwritten = 0; bool map_from_cluster = false; ext_debug(""blocks %u/%u requested for inode %lu\n"", map->m_lblk, map->m_len, inode->i_ino); trace_ext4_ext_map_blocks_enter(inode, map->m_lblk, map->m_len, flags); /* find extent for this block */ path = ext4_find_extent(inode, map->m_lblk, NULL, 0); if (IS_ERR(path)) { err = PTR_ERR(path); path = NULL; goto out2; } depth = ext_depth(inode); /* * consistent leaf must not be empty; * this situation is possible, though, _during_ tree modification; * this is why assert can't be put in ext4_find_extent() */ if (unlikely(path[depth].p_ext == NULL && depth != 0)) { EXT4_ERROR_INODE(inode, ""bad extent address "" ""lblock: %lu, depth: %d pblock %lld"", (unsigned long) map->m_lblk, depth, path[depth].p_block); err = -EFSCORRUPTED; goto out2; } ex = path[depth].p_ext; if (ex) { ext4_lblk_t ee_block = le32_to_cpu(ex->ee_block); ext4_fsblk_t ee_start = ext4_ext_pblock(ex); unsigned short ee_len; /* * unwritten extents are treated as holes, except that * we split out initialized portions during a write. */ ee_len = ext4_ext_get_actual_len(ex); trace_ext4_ext_show_extent(inode, ee_block, ee_start, ee_len); /* if found extent covers block, simply return it */ if (in_range(map->m_lblk, ee_block, ee_len)) { newblock = map->m_lblk - ee_block + ee_start; /* number of remaining blocks in the extent */ allocated = ee_len - (map->m_lblk - ee_block); ext_debug(""%u fit into %u:%d -> %llu\n"", map->m_lblk, ee_block, ee_len, newblock); /* * If the extent is initialized check whether the * caller wants to convert it to unwritten. */ if ((!ext4_ext_is_unwritten(ex)) && (flags & EXT4_GET_BLOCKS_CONVERT_UNWRITTEN)) { allocated = convert_initialized_extent( handle, inode, map, &path, flags, allocated, newblock); goto out2; } else if (!ext4_ext_is_unwritten(ex)) goto out; ret = ext4_ext_handle_unwritten_extents( handle, inode, map, &path, flags, allocated, newblock); if (ret < 0) err = ret; else allocated = ret; goto out2; } } /* * requested block isn't allocated yet; * we couldn't try to create block if create flag is zero */ if ((flags & EXT4_GET_BLOCKS_CREATE) == 0) { /* * put just found gap into cache to speed up * subsequent requests */ ext4_ext_put_gap_in_cache(inode, path, map->m_lblk); goto out2; } /* * Okay, we need to do block allocation. */ newex.ee_block = cpu_to_le32(map->m_lblk); cluster_offset = EXT4_LBLK_COFF(sbi, map->m_lblk); /* * If we are doing bigalloc, check to see if the extent returned * by ext4_find_extent() implies a cluster we can use. */ if (cluster_offset && ex && get_implied_cluster_alloc(inode->i_sb, map, ex, path)) { ar.len = allocated = map->m_len; newblock = map->m_pblk; map_from_cluster = true; goto got_allocated_blocks; } /* find neighbour allocated blocks */ ar.lleft = map->m_lblk; err = ext4_ext_search_left(inode, path, &ar.lleft, &ar.pleft); if (err) goto out2; ar.lright = map->m_lblk; ex2 = NULL; err = ext4_ext_search_right(inode, path, &ar.lright, &ar.pright, &ex2); if (err) goto out2; /* Check if the extent after searching to the right implies a * cluster we can use. */ if ((sbi->s_cluster_ratio > 1) && ex2 && get_implied_cluster_alloc(inode->i_sb, map, ex2, path)) { ar.len = allocated = map->m_len; newblock = map->m_pblk; map_from_cluster = true; goto got_allocated_blocks; } /* * See if request is beyond maximum number of blocks we can have in * a single extent. For an initialized extent this limit is * EXT_INIT_MAX_LEN and for an unwritten extent this limit is * EXT_UNWRITTEN_MAX_LEN. */ if (map->m_len > EXT_INIT_MAX_LEN && !(flags & EXT4_GET_BLOCKS_UNWRIT_EXT)) map->m_len = EXT_INIT_MAX_LEN; else if (map->m_len > EXT_UNWRITTEN_MAX_LEN && (flags & EXT4_GET_BLOCKS_UNWRIT_EXT)) map->m_len = EXT_UNWRITTEN_MAX_LEN; /* Check if we can really insert (m_lblk)::(m_lblk + m_len) extent */ newex.ee_len = cpu_to_le16(map->m_len); err = ext4_ext_check_overlap(sbi, inode, &newex, path); if (err) allocated = ext4_ext_get_actual_len(&newex); else allocated = map->m_len; /* allocate new block */ ar.inode = inode; ar.goal = ext4_ext_find_goal(inode, path, map->m_lblk); ar.logical = map->m_lblk; /* * We calculate the offset from the beginning of the cluster * for the logical block number, since when we allocate a * physical cluster, the physical block should start at the * same offset from the beginning of the cluster. This is * needed so that future calls to get_implied_cluster_alloc() * work correctly. */ offset = EXT4_LBLK_COFF(sbi, map->m_lblk); ar.len = EXT4_NUM_B2C(sbi, offset+allocated); ar.goal -= offset; ar.logical -= offset; if (S_ISREG(inode->i_mode)) ar.flags = EXT4_MB_HINT_DATA; else /* disable in-core preallocation for non-regular files */ ar.flags = 0; if (flags & EXT4_GET_BLOCKS_NO_NORMALIZE) ar.flags |= EXT4_MB_HINT_NOPREALLOC; if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) ar.flags |= EXT4_MB_DELALLOC_RESERVED; if (flags & EXT4_GET_BLOCKS_METADATA_NOFAIL) ar.flags |= EXT4_MB_USE_RESERVED; newblock = ext4_mb_new_blocks(handle, &ar, &err); if (!newblock) goto out2; ext_debug(""allocate new block: goal %llu, found %llu/%u\n"", ar.goal, newblock, allocated); free_on_err = 1; allocated_clusters = ar.len; ar.len = EXT4_C2B(sbi, ar.len) - offset; if (ar.len > allocated) ar.len = allocated; got_allocated_blocks: /* try to insert new extent into found leaf and return */ ext4_ext_store_pblock(&newex, newblock + offset); newex.ee_len = cpu_to_le16(ar.len); /* Mark unwritten */ if (flags & EXT4_GET_BLOCKS_UNWRIT_EXT){ ext4_ext_mark_unwritten(&newex); map->m_flags |= EXT4_MAP_UNWRITTEN; /* * io_end structure was created for every IO write to an * unwritten extent. To avoid unnecessary conversion, * here we flag the IO that really needs the conversion. * For non asycn direct IO case, flag the inode state * that we need to perform conversion when IO is done. */ if (flags & EXT4_GET_BLOCKS_PRE_IO) set_unwritten = 1; } err = 0; if ((flags & EXT4_GET_BLOCKS_KEEP_SIZE) == 0) err = check_eofblocks_fl(handle, inode, map->m_lblk, path, ar.len); if (!err) err = ext4_ext_insert_extent(handle, inode, &path, &newex, flags); if (!err && set_unwritten) { if (io) ext4_set_io_unwritten_flag(inode, io); else ext4_set_inode_state(inode, EXT4_STATE_DIO_UNWRITTEN); } if (err && free_on_err) { int fb_flags = flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE ? EXT4_FREE_BLOCKS_NO_QUOT_UPDATE : 0; /* free data blocks we just allocated */ /* not a good idea to call discard here directly, * but otherwise we'd need to call it every free() */ ext4_discard_preallocations(inode); ext4_free_blocks(handle, inode, NULL, newblock, EXT4_C2B(sbi, allocated_clusters), fb_flags); goto out2; } /* previous routine could use block we allocated */ newblock = ext4_ext_pblock(&newex); allocated = ext4_ext_get_actual_len(&newex); if (allocated > map->m_len) allocated = map->m_len; map->m_flags |= EXT4_MAP_NEW; /* * Update reserved blocks/metadata blocks after successful * block allocation which had been deferred till now. */ if (flags & EXT4_GET_BLOCKS_DELALLOC_RESERVE) { unsigned int reserved_clusters; /* * Check how many clusters we had reserved this allocated range */ reserved_clusters = get_reserved_cluster_alloc(inode, map->m_lblk, allocated); if (!map_from_cluster) { BUG_ON(allocated_clusters < reserved_clusters); if (reserved_clusters < allocated_clusters) { struct ext4_inode_info *ei = EXT4_I(inode); int reservation = allocated_clusters - reserved_clusters; /* * It seems we claimed few clusters outside of * the range of this allocation. We should give * it back to the reservation pool. This can * happen in the following case: * * * Suppose s_cluster_ratio is 4 (i.e., each * cluster has 4 blocks. Thus, the clusters * are [0-3],[4-7],[8-11]... * * First comes delayed allocation write for * logical blocks 10 & 11. Since there were no * previous delayed allocated blocks in the * range [8-11], we would reserve 1 cluster * for this write. * * Next comes write for logical blocks 3 to 8. * In this case, we will reserve 2 clusters * (for [0-3] and [4-7]; and not for [8-11] as * that range has a delayed allocated blocks. * Thus total reserved clusters now becomes 3. * * Now, during the delayed allocation writeout * time, we will first write blocks [3-8] and * allocate 3 clusters for writing these * blocks. Also, we would claim all these * three clusters above. * * Now when we come here to writeout the * blocks [10-11], we would expect to claim * the reservation of 1 cluster we had made * (and we would claim it since there are no * more delayed allocated blocks in the range * [8-11]. But our reserved cluster count had * already gone to 0. * * Thus, at the step 4 above when we determine * that there are still some unwritten delayed * allocated blocks outside of our current * block range, we should increment the * reserved clusters count so that when the * remaining blocks finally gets written, we * could claim them. */ dquot_reserve_block(inode, EXT4_C2B(sbi, reservation)); spin_lock(&ei->i_block_reservation_lock); ei->i_reserved_data_blocks += reservation; spin_unlock(&ei->i_block_reservation_lock); } /* * We will claim quota for all newly allocated blocks. * We're updating the reserved space *after* the * correction above so we do not accidentally free * all the metadata reservation because we might * actually need it later on. */ ext4_da_update_reserve_space(inode, allocated_clusters, 1); } } /* * Cache the extent and update transaction to commit on fdatasync only * when it is _not_ an unwritten extent. */ if ((flags & EXT4_GET_BLOCKS_UNWRIT_EXT) == 0) ext4_update_inode_fsync_trans(handle, inode, 1); else ext4_update_inode_fsync_trans(handle, inode, 0); out: if (allocated > map->m_len) allocated = map->m_len; ext4_ext_show_leaf(inode, path); map->m_flags |= EXT4_MAP_MAPPED; map->m_pblk = newblock; map->m_len = allocated; out2: ext4_ext_drop_refs(path); kfree(path); trace_ext4_ext_map_blocks_exit(inode, flags, map, err ? err : allocated); return err ? err : allocated; } ",0 "void WebContentsImpl::DidStopLoading() { scoped_ptr details; NavigationEntry* entry = controller_.GetLastCommittedEntry(); Navigator* navigator = frame_tree_.root()->navigator(); if (entry) { base::TimeDelta elapsed = base::TimeTicks::Now() - navigator->GetCurrentLoadStart(); details.reset(new LoadNotificationDetails( entry->GetVirtualURL(), entry->GetTransitionType(), elapsed, &controller_, controller_.GetCurrentEntryIndex())); } SetIsLoading(false, true, details.get()); } ",0 "get_guard_confirmed_min_lifetime(void) { if (get_options()->GuardLifetime >= 86400) return get_options()->GuardLifetime; int32_t days; days = networkstatus_get_param(NULL, ""guard-confirmed-min-lifetime-days"", DFLT_GUARD_CONFIRMED_MIN_LIFETIME_DAYS, 1, 365*10); return days * 86400; } ",0 "PassRefPtr Document::createRange() { return Range::create(this); } ",0 "ip_finddst(netdissect_options *ndo, const struct ip *ip) { int length; int len; const u_char *cp; uint32_t retval; cp = (const u_char *)(ip + 1); length = (IP_HL(ip) << 2) - sizeof(struct ip); for (; length > 0; cp += len, length -= len) { int tt; ND_TCHECK(*cp); tt = *cp; if (tt == IPOPT_EOL) break; else if (tt == IPOPT_NOP) len = 1; else { ND_TCHECK(cp[1]); len = cp[1]; if (len < 2) break; } ND_TCHECK2(*cp, len); switch (tt) { case IPOPT_SSRR: case IPOPT_LSRR: if (len < 7) break; UNALIGNED_MEMCPY(&retval, cp + len - 4, 4); return retval; } } trunc: UNALIGNED_MEMCPY(&retval, &ip->ip_dst, sizeof(uint32_t)); return retval; } ",0 "static void unhash_lockowner_locked(struct nfs4_lockowner *lo) { struct nfs4_client *clp = lo->lo_owner.so_client; lockdep_assert_held(&clp->cl_lock); list_del_init(&lo->lo_owner.so_strhash); } ",0 "string_strcasestr (const char *string, const char *search) { int length_search; length_search = utf8_strlen (search); if (!string || !search || (length_search == 0)) return NULL; while (string[0]) { if (string_strncasecmp (string, search, length_search) == 0) return (char *)string; string = utf8_next_char (string); } return NULL; } ",0 " void MoveMouse(int x, int y) { gfx::Point screen_position(x, y); views::View::ConvertPointToScreen(top_container_, &screen_position); GetEventGenerator().MoveMouseTo(screen_position.x(), screen_position.y()); if (controller()->top_edge_hover_timer_.IsRunning()) { controller()->top_edge_hover_timer_.user_task().Run(); controller()->top_edge_hover_timer_.Stop(); } } ",0 "struct timeval* dtls1_get_timeout(SSL *s, struct timeval* timeleft) { struct timeval timenow; /* If no timeout is set, just return NULL */ if (s->d1->next_timeout.tv_sec == 0 && s->d1->next_timeout.tv_usec == 0) { return NULL; } /* Get current time */ get_current_time(&timenow); /* If timer already expired, set remaining time to 0 */ if (s->d1->next_timeout.tv_sec < timenow.tv_sec || (s->d1->next_timeout.tv_sec == timenow.tv_sec && s->d1->next_timeout.tv_usec <= timenow.tv_usec)) { memset(timeleft, 0, sizeof(struct timeval)); return timeleft; } /* Calculate time left until timer expires */ memcpy(timeleft, &(s->d1->next_timeout), sizeof(struct timeval)); timeleft->tv_sec -= timenow.tv_sec; timeleft->tv_usec -= timenow.tv_usec; if (timeleft->tv_usec < 0) { timeleft->tv_sec--; timeleft->tv_usec += 1000000; } /* If remaining time is less than 15 ms, set it to 0 * to prevent issues because of small devergences with * socket timeouts. */ if (timeleft->tv_sec == 0 && timeleft->tv_usec < 15000) { memset(timeleft, 0, sizeof(struct timeval)); } return timeleft; } ",0 "NetworkReaderProxy::~NetworkReaderProxy() { if (!job_canceller_.is_null()) { job_canceller_.Run(); } } ",0 "void ChromeContentBrowserClient::OverrideWebkitPrefs( RenderViewHost* rvh, WebPreferences* web_prefs) { Profile* profile = Profile::FromBrowserContext( rvh->GetProcess()->GetBrowserContext()); PrefService* prefs = profile->GetPrefs(); #if !defined(OS_ANDROID) FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitStandardFontFamilyMap, &web_prefs->standard_font_family_map); FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitFixedFontFamilyMap, &web_prefs->fixed_font_family_map); FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitSerifFontFamilyMap, &web_prefs->serif_font_family_map); FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitSansSerifFontFamilyMap, &web_prefs->sans_serif_font_family_map); FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitCursiveFontFamilyMap, &web_prefs->cursive_font_family_map); FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitFantasyFontFamilyMap, &web_prefs->fantasy_font_family_map); FontFamilyCache::FillFontFamilyMap(profile, prefs::kWebKitPictographFontFamilyMap, &web_prefs->pictograph_font_family_map); web_prefs->default_font_size = prefs->GetInteger(prefs::kWebKitDefaultFontSize); web_prefs->default_fixed_font_size = prefs->GetInteger(prefs::kWebKitDefaultFixedFontSize); web_prefs->minimum_font_size = prefs->GetInteger(prefs::kWebKitMinimumFontSize); web_prefs->minimum_logical_font_size = prefs->GetInteger(prefs::kWebKitMinimumLogicalFontSize); #endif web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); web_prefs->dom_paste_enabled = prefs->GetBoolean(prefs::kWebKitDomPasteEnabled); web_prefs->javascript_can_access_clipboard = prefs->GetBoolean(prefs::kWebKitJavascriptCanAccessClipboard); web_prefs->tabs_to_links = prefs->GetBoolean(prefs::kWebkitTabsToLinks); if (!prefs->GetBoolean(prefs::kWebKitJavascriptEnabled)) web_prefs->javascript_enabled = false; base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); if (!prefs->GetBoolean(prefs::kWebKitWebSecurityEnabled)) { web_prefs->web_security_enabled = false; } else if (!web_prefs->web_security_enabled && command_line->HasSwitch(switches::kDisableWebSecurity) && !command_line->HasSwitch(switches::kUserDataDir)) { LOG(ERROR) << ""Web security may only be disabled if '--user-data-dir' is "" ""also specified.""; web_prefs->web_security_enabled = true; } if (!prefs->GetBoolean(prefs::kWebKitPluginsEnabled)) web_prefs->plugins_enabled = false; web_prefs->loads_images_automatically = prefs->GetBoolean(prefs::kWebKitLoadsImagesAutomatically); if (prefs->GetBoolean(prefs::kDisable3DAPIs)) { web_prefs->webgl1_enabled = false; web_prefs->webgl2_enabled = false; } web_prefs->allow_running_insecure_content = prefs->GetBoolean(prefs::kWebKitAllowRunningInsecureContent); #if defined(OS_ANDROID) web_prefs->font_scale_factor = static_cast(prefs->GetDouble(prefs::kWebKitFontScaleFactor)); web_prefs->device_scale_adjustment = GetDeviceScaleAdjustment(); web_prefs->force_enable_zoom = prefs->GetBoolean(prefs::kWebKitForceEnableZoom); #endif #if defined(OS_ANDROID) web_prefs->password_echo_enabled = prefs->GetBoolean(prefs::kWebKitPasswordEchoEnabled); #else web_prefs->password_echo_enabled = browser_defaults::kPasswordEchoEnabled; #endif web_prefs->text_areas_are_resizable = prefs->GetBoolean(prefs::kWebKitTextAreasAreResizable); web_prefs->hyperlink_auditing_enabled = prefs->GetBoolean(prefs::kEnableHyperlinkAuditing); #if BUILDFLAG(ENABLE_EXTENSIONS) std::string image_animation_policy = prefs->GetString(prefs::kAnimationPolicy); if (image_animation_policy == kAnimationPolicyOnce) web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE; else if (image_animation_policy == kAnimationPolicyNone) web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_NO_ANIMATION; else web_prefs->animation_policy = content::IMAGE_ANIMATION_POLICY_ALLOWED; #endif web_prefs->default_encoding = base::GetCanonicalEncodingNameByAliasName(web_prefs->default_encoding); if (web_prefs->default_encoding.empty()) { prefs->ClearPref(prefs::kDefaultCharset); web_prefs->default_encoding = prefs->GetString(prefs::kDefaultCharset); } DCHECK(!web_prefs->default_encoding.empty()); if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnablePotentiallyAnnoyingSecurityFeatures)) { web_prefs->disable_reading_from_canvas = true; web_prefs->strict_mixed_content_checking = true; web_prefs->strict_powerful_feature_restrictions = true; } web_prefs->data_saver_enabled = GetDataSaverEnabledPref(prefs); web_prefs->data_saver_holdback_web_api_enabled = base::GetFieldTrialParamByFeatureAsBool(features::kDataSaverHoldback, ""holdback_web"", false); content::WebContents* contents = content::WebContents::FromRenderViewHost(rvh); if (contents) { #if defined(OS_ANDROID) TabAndroid* tab_android = TabAndroid::FromWebContents(contents); if (tab_android) { web_prefs->embedded_media_experience_enabled = tab_android->ShouldEnableEmbeddedMediaExperience(); if (base::FeatureList::IsEnabled( features::kAllowAutoplayUnmutedInWebappManifestScope)) { web_prefs->media_playback_gesture_whitelist_scope = tab_android->GetWebappManifestScope(); } web_prefs->picture_in_picture_enabled = tab_android->IsPictureInPictureEnabled(); } #endif // defined(OS_ANDROID) #if BUILDFLAG(ENABLE_EXTENSIONS) Browser* browser = chrome::FindBrowserWithWebContents(contents); if (browser && browser->hosted_app_controller() && browser->hosted_app_controller()->created_for_installed_pwa()) { web_prefs->strict_mixed_content_checking = true; } #endif web_prefs->immersive_mode_enabled = vr::VrTabHelper::IsInVr(contents); } #if defined(OS_ANDROID) web_prefs->video_fullscreen_detection_enabled = true; web_prefs->enable_media_download_in_product_help = base::FeatureList::IsEnabled( feature_engagement::kIPHMediaDownloadFeature); #endif // defined(OS_ANDROID) if (base::FeatureList::IsEnabled(features::kLowPriorityIframes)) { std::string effective_connection_type_param = base::GetFieldTrialParamValueByFeature( features::kLowPriorityIframes, ""max_effective_connection_type_threshold""); base::Optional effective_connection_type = net::GetEffectiveConnectionTypeForName(effective_connection_type_param); if (effective_connection_type) { web_prefs->low_priority_iframes_threshold = effective_connection_type.value(); } } web_prefs->lazy_load_enabled = (base::FeatureList::IsEnabled(features::kLazyFrameLoading) || base::FeatureList::IsEnabled(features::kLazyImageLoading)) && (!contents || !contents->GetDelegate() || contents->GetDelegate()->ShouldAllowLazyLoad()); if (base::FeatureList::IsEnabled(features::kLazyFrameLoading)) { const char* param_name = web_prefs->data_saver_enabled ? ""lazy_frame_loading_distance_thresholds_px_by_ect"" : ""lazy_frame_loading_distance_thresholds_px_by_ect_with_data_"" ""saver_enabled""; base::StringPairs pairs; base::SplitStringIntoKeyValuePairs( base::GetFieldTrialParamValueByFeature(features::kLazyFrameLoading, param_name), ':', ',', &pairs); for (const auto& pair : pairs) { base::Optional effective_connection_type = net::GetEffectiveConnectionTypeForName(pair.first); int value = 0; if (effective_connection_type && base::StringToInt(pair.second, &value)) { web_prefs->lazy_frame_loading_distance_thresholds_px [effective_connection_type.value()] = value; } } } if (base::FeatureList::IsEnabled(features::kLazyImageLoading)) { const char* param_name = web_prefs->data_saver_enabled ? ""lazy_image_loading_distance_thresholds_px_by_ect"" : ""lazy_image_loading_distance_thresholds_px_by_ect_with_data_"" ""saver_enabled""; base::StringPairs pairs; base::SplitStringIntoKeyValuePairs( base::GetFieldTrialParamValueByFeature(features::kLazyImageLoading, param_name), ':', ',', &pairs); for (const auto& pair : pairs) { base::Optional effective_connection_type = net::GetEffectiveConnectionTypeForName(pair.first); int value = 0; if (effective_connection_type && base::StringToInt(pair.second, &value)) { web_prefs->lazy_image_loading_distance_thresholds_px [effective_connection_type.value()] = value; } } } if (base::FeatureList::IsEnabled( features::kNetworkQualityEstimatorWebHoldback)) { std::string effective_connection_type_param = base::GetFieldTrialParamValueByFeature( features::kNetworkQualityEstimatorWebHoldback, ""web_effective_connection_type_override""); base::Optional effective_connection_type = net::GetEffectiveConnectionTypeForName(effective_connection_type_param); DCHECK(effective_connection_type_param.empty() || effective_connection_type); if (effective_connection_type) { DCHECK_NE(net::EFFECTIVE_CONNECTION_TYPE_UNKNOWN, effective_connection_type.value()); web_prefs->network_quality_estimator_web_holdback = effective_connection_type.value(); } } #if !defined(OS_ANDROID) if (IsAutoplayAllowedByPolicy(contents, prefs)) { web_prefs->autoplay_policy = content::AutoplayPolicy::kNoUserGestureRequired; } else if (base::FeatureList::IsEnabled(media::kAutoplayDisableSettings) && web_prefs->autoplay_policy == content::AutoplayPolicy::kDocumentUserActivationRequired) { web_prefs->autoplay_policy = UnifiedAutoplayConfig::ShouldBlockAutoplay(profile) ? content::AutoplayPolicy::kDocumentUserActivationRequired : content::AutoplayPolicy::kNoUserGestureRequired; } #endif // !defined(OS_ANDROID) web_prefs->translate_service_available = TranslateService::IsAvailable(prefs); for (size_t i = 0; i < extra_parts_.size(); ++i) extra_parts_[i]->OverrideWebkitPrefs(rvh, web_prefs); } ",0 "void LE_reset(LoudnessEnhancerContext *pContext) { ALOGV("" > LE_reset(%p)"", pContext); if (pContext->mCompressor != NULL) { float targetAmp = pow(10, pContext->mTargetGainmB/2000.0f); // mB to linear amplification ALOGV(""LE_reset(): Target gain=%dmB <=> factor=%.2fX"", pContext->mTargetGainmB, targetAmp); pContext->mCompressor->Initialize(targetAmp, pContext->mConfig.inputCfg.samplingRate); } else { ALOGE(""LE_reset(%p): null compressors, can't apply target gain"", pContext); } } ",0 "static void stringArrayFunctionMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""stringArrayFunction"", ""TestObject"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_VOID(Vector, values, toNativeArray(info[0], 1, info.GetIsolate())); Vector result = imp->stringArrayFunction(values, exceptionState); if (exceptionState.throwIfNeeded()) return; v8SetReturnValue(info, v8Array(result, info.GetIsolate())); } ",0 "static int parseOpcode(RAsm *a, const char *op, Opcode *out) { out->has_bnd = false; bool isrepop = false; if (!strncmp (op, ""bnd "", 4)) { out->has_bnd = true; op += 4; } char *args = strchr (op, ' '); out->mnemonic = args ? r_str_ndup (op, args - op) : strdup (op); out->operands[0].type = out->operands[1].type = 0; out->operands[0].extended = out->operands[1].extended = false; out->operands[0].reg = out->operands[0].regs[0] = out->operands[0].regs[1] = X86R_UNDEFINED; out->operands[1].reg = out->operands[1].regs[0] = out->operands[1].regs[1] = X86R_UNDEFINED; out->operands[0].immediate = out->operands[1].immediate = 0; out->operands[0].sign = out->operands[1].sign = 1; out->operands[0].is_good_flag = out->operands[1].is_good_flag = true; out->is_short = false; out->operands_count = 0; if (args) { args++; } else { return 1; } if (!r_str_ncasecmp (args, ""short"", 5)) { out->is_short = true; args += 5; } if (!strncmp (out->mnemonic, ""rep"", 3)) { isrepop = true; } parseOperand (a, args, &(out->operands[0]), isrepop); out->operands_count = 1; while (out->operands_count < MAX_OPERANDS) { args = strchr (args, ','); if (!args) { break; } args++; parseOperand (a, args, &(out->operands[out->operands_count]), isrepop); out->operands_count++; } return 0; } ",0 "static inline struct userfaultfd_wait_queue *find_userfault_in( wait_queue_head_t *wqh) { wait_queue_entry_t *wq; struct userfaultfd_wait_queue *uwq; lockdep_assert_held(&wqh->lock); uwq = NULL; if (!waitqueue_active(wqh)) goto out; /* walk in reverse to provide FIFO behavior to read userfaults */ wq = list_last_entry(&wqh->head, typeof(*wq), entry); uwq = container_of(wq, struct userfaultfd_wait_queue, wq); out: return uwq; } ",0 "MenuCacheType menu_cache_item_get_type( MenuCacheItem* item ) { return item->type; } ",0 "void ExtensionDevToolsClientHost::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK_EQ(chrome::NOTIFICATION_APP_TERMINATING, type); Close(); } ",0 "int tls1_ec_nid2curve_id(int nid) { /* ECC curves from RFC 4492 */ switch (nid) { case NID_sect163k1: /* sect163k1 (1) */ return 1; case NID_sect163r1: /* sect163r1 (2) */ return 2; case NID_sect163r2: /* sect163r2 (3) */ return 3; case NID_sect193r1: /* sect193r1 (4) */ return 4; case NID_sect193r2: /* sect193r2 (5) */ return 5; case NID_sect233k1: /* sect233k1 (6) */ return 6; case NID_sect233r1: /* sect233r1 (7) */ return 7; case NID_sect239k1: /* sect239k1 (8) */ return 8; case NID_sect283k1: /* sect283k1 (9) */ return 9; case NID_sect283r1: /* sect283r1 (10) */ return 10; case NID_sect409k1: /* sect409k1 (11) */ return 11; case NID_sect409r1: /* sect409r1 (12) */ return 12; case NID_sect571k1: /* sect571k1 (13) */ return 13; case NID_sect571r1: /* sect571r1 (14) */ return 14; case NID_secp160k1: /* secp160k1 (15) */ return 15; case NID_secp160r1: /* secp160r1 (16) */ return 16; case NID_secp160r2: /* secp160r2 (17) */ return 17; case NID_secp192k1: /* secp192k1 (18) */ return 18; case NID_X9_62_prime192v1: /* secp192r1 (19) */ return 19; case NID_secp224k1: /* secp224k1 (20) */ return 20; case NID_secp224r1: /* secp224r1 (21) */ return 21; case NID_secp256k1: /* secp256k1 (22) */ return 22; case NID_X9_62_prime256v1: /* secp256r1 (23) */ return 23; case NID_secp384r1: /* secp384r1 (24) */ return 24; case NID_secp521r1: /* secp521r1 (25) */ return 25; default: return 0; } } ",0 "do_ip_vs_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) { unsigned char arg[128]; int ret = 0; if (!capable(CAP_NET_ADMIN)) return -EPERM; if (*len < get_arglen[GET_CMDID(cmd)]) { pr_err(""get_ctl: len %u < %u\n"", *len, get_arglen[GET_CMDID(cmd)]); return -EINVAL; } if (copy_from_user(arg, user, get_arglen[GET_CMDID(cmd)]) != 0) return -EFAULT; if (mutex_lock_interruptible(&__ip_vs_mutex)) return -ERESTARTSYS; switch (cmd) { case IP_VS_SO_GET_VERSION: { char buf[64]; sprintf(buf, ""IP Virtual Server version %d.%d.%d (size=%d)"", NVERSION(IP_VS_VERSION_CODE), IP_VS_CONN_TAB_SIZE); if (copy_to_user(user, buf, strlen(buf)+1) != 0) { ret = -EFAULT; goto out; } *len = strlen(buf)+1; } break; case IP_VS_SO_GET_INFO: { struct ip_vs_getinfo info; info.version = IP_VS_VERSION_CODE; info.size = IP_VS_CONN_TAB_SIZE; info.num_services = ip_vs_num_services; if (copy_to_user(user, &info, sizeof(info)) != 0) ret = -EFAULT; } break; case IP_VS_SO_GET_SERVICES: { struct ip_vs_get_services *get; int size; get = (struct ip_vs_get_services *)arg; size = sizeof(*get) + sizeof(struct ip_vs_service_entry) * get->num_services; if (*len != size) { pr_err(""length: %u != %u\n"", *len, size); ret = -EINVAL; goto out; } ret = __ip_vs_get_service_entries(get, user); } break; case IP_VS_SO_GET_SERVICE: { struct ip_vs_service_entry *entry; struct ip_vs_service *svc; union nf_inet_addr addr; entry = (struct ip_vs_service_entry *)arg; addr.ip = entry->addr; if (entry->fwmark) svc = __ip_vs_svc_fwm_get(AF_INET, entry->fwmark); else svc = __ip_vs_service_get(AF_INET, entry->protocol, &addr, entry->port); if (svc) { ip_vs_copy_service(entry, svc); if (copy_to_user(user, entry, sizeof(*entry)) != 0) ret = -EFAULT; ip_vs_service_put(svc); } else ret = -ESRCH; } break; case IP_VS_SO_GET_DESTS: { struct ip_vs_get_dests *get; int size; get = (struct ip_vs_get_dests *)arg; size = sizeof(*get) + sizeof(struct ip_vs_dest_entry) * get->num_dests; if (*len != size) { pr_err(""length: %u != %u\n"", *len, size); ret = -EINVAL; goto out; } ret = __ip_vs_get_dest_entries(get, user); } break; case IP_VS_SO_GET_TIMEOUT: { struct ip_vs_timeout_user t; __ip_vs_get_timeouts(&t); if (copy_to_user(user, &t, sizeof(t)) != 0) ret = -EFAULT; } break; case IP_VS_SO_GET_DAEMON: { struct ip_vs_daemon_user d[2]; memset(&d, 0, sizeof(d)); if (ip_vs_sync_state & IP_VS_STATE_MASTER) { d[0].state = IP_VS_STATE_MASTER; strlcpy(d[0].mcast_ifn, ip_vs_master_mcast_ifn, sizeof(d[0].mcast_ifn)); d[0].syncid = ip_vs_master_syncid; } if (ip_vs_sync_state & IP_VS_STATE_BACKUP) { d[1].state = IP_VS_STATE_BACKUP; strlcpy(d[1].mcast_ifn, ip_vs_backup_mcast_ifn, sizeof(d[1].mcast_ifn)); d[1].syncid = ip_vs_backup_syncid; } if (copy_to_user(user, &d, sizeof(d)) != 0) ret = -EFAULT; } break; default: ret = -EINVAL; } out: mutex_unlock(&__ip_vs_mutex); return ret; } ",1 "static void enforcedRangeOctetAttrAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueUnsigned(info, imp->enforcedRangeOctetAttr()); } ",0 "void FileReaderLoader::setEncoding(const String& encoding) { if (!encoding.isEmpty()) m_encoding = WTF::TextEncoding(encoding); } ",0 "static int compareByStringPairForQSort(const void* a, const void* b) { const ValueStringPair* va = static_cast(a); const ValueStringPair* vb = static_cast(b); return codePointCompare(va->second, vb->second); } ",0 "static opj_image_t* bmp8toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride, opj_image_t* image, OPJ_UINT8 const* const* pLUT) { OPJ_UINT32 width, height; const OPJ_UINT8 *pSrc = NULL; width = image->comps[0].w; height = image->comps[0].h; pSrc = pData + (height - 1U) * stride; if (image->numcomps == 1U) { opj_applyLUT8u_8u32s_C1R(pSrc, -(OPJ_INT32)stride, image->comps[0].data, (OPJ_INT32)width, pLUT[0], width, height); } else { OPJ_INT32* pDst[3]; OPJ_INT32 pDstStride[3]; pDst[0] = image->comps[0].data; pDst[1] = image->comps[1].data; pDst[2] = image->comps[2].data; pDstStride[0] = (OPJ_INT32)width; pDstStride[1] = (OPJ_INT32)width; pDstStride[2] = (OPJ_INT32)width; opj_applyLUT8u_8u32s_C1P3R(pSrc, -(OPJ_INT32)stride, pDst, pDstStride, pLUT, width, height); } return image; } ",0 "static int cac_path_from_cardurl(sc_card_t *card, sc_path_t *path, cac_card_url_t *val, int len) { if (len < 10) { return SC_ERROR_INVALID_DATA; } sc_mem_clear(path, sizeof(sc_path_t)); memcpy(path->aid.value, &val->rid, sizeof(val->rid)); memcpy(&path->aid.value[5], &val->applicationID, sizeof(val->applicationID)); path->aid.len = sizeof(val->rid) + sizeof(val->applicationID); memcpy(path->value, &val->objectID, sizeof(val->objectID)); path->len = sizeof(val->objectID); path->type = SC_PATH_TYPE_FILE_ID; sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""path->aid=%x %x %x %x %x %x %x len=%""SC_FORMAT_LEN_SIZE_T""u, path->value = %x %x len=%""SC_FORMAT_LEN_SIZE_T""u path->type=%d (%x)"", path->aid.value[0], path->aid.value[1], path->aid.value[2], path->aid.value[3], path->aid.value[4], path->aid.value[5], path->aid.value[6], path->aid.len, path->value[0], path->value[1], path->len, path->type, path->type); sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""rid=%x %x %x %x %x len=%""SC_FORMAT_LEN_SIZE_T""u appid= %x %x len=%""SC_FORMAT_LEN_SIZE_T""u objid= %x %x len=%""SC_FORMAT_LEN_SIZE_T""u"", val->rid[0], val->rid[1], val->rid[2], val->rid[3], val->rid[4], sizeof(val->rid), val->applicationID[0], val->applicationID[1], sizeof(val->applicationID), val->objectID[0], val->objectID[1], sizeof(val->objectID)); return SC_SUCCESS; } ",0 "WORD32 ih264d_parse_sei_payload(dec_bit_stream_t *ps_bitstrm, UWORD32 ui4_payload_type, UWORD32 ui4_payload_size, dec_struct_t *ps_dec) { sei *ps_sei; WORD32 i4_status = 0; ps_sei = (sei *)ps_dec->ps_sei; switch(ui4_payload_type) { case SEI_BUF_PERIOD: i4_status = ih264d_parse_buffering_period(&ps_sei->s_buf_period, ps_bitstrm, ps_dec); /*if(i4_status != OK) return i4_status;*/ break; case SEI_PIC_TIMING: if(NULL == ps_dec->ps_cur_sps) ih264d_flush_bits_h264(ps_bitstrm, (ui4_payload_size << 3)); else ih264d_parse_pic_timing(ps_bitstrm, ps_dec, ui4_payload_size); break; case SEI_RECOVERY_PT: ih264d_parse_recovery_point(ps_bitstrm, ps_dec, ui4_payload_size); break; default: ih264d_flush_bits_h264(ps_bitstrm, (ui4_payload_size << 3)); break; } return (i4_status); } ",0 "static void ext4_inode_csum_set(struct inode *inode, struct ext4_inode *raw, struct ext4_inode_info *ei) { __u32 csum; if (EXT4_SB(inode->i_sb)->s_es->s_creator_os != cpu_to_le32(EXT4_OS_LINUX) || !ext4_has_metadata_csum(inode->i_sb)) return; csum = ext4_inode_csum(inode, raw, ei); raw->i_checksum_lo = cpu_to_le16(csum & 0xFFFF); if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE && EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) raw->i_checksum_hi = cpu_to_le16(csum >> 16); } ",0 "BlobURLRequestJob::~BlobURLRequestJob() { STLDeleteValues(&index_to_reader_); } ",0 "static int udf_translate_to_linux(uint8_t *newName, uint8_t *udfName, int udfLen, uint8_t *fidName, int fidNameLen) { int index, newIndex = 0, needsCRC = 0; int extIndex = 0, newExtIndex = 0, hasExt = 0; unsigned short valueCRC; uint8_t curr; if (udfName[0] == '.' && (udfLen == 1 || (udfLen == 2 && udfName[1] == '.'))) { needsCRC = 1; newIndex = udfLen; memcpy(newName, udfName, udfLen); } else { for (index = 0; index < udfLen; index++) { curr = udfName[index]; if (curr == '/' || curr == 0) { needsCRC = 1; curr = ILLEGAL_CHAR_MARK; while (index + 1 < udfLen && (udfName[index + 1] == '/' || udfName[index + 1] == 0)) index++; } if (curr == EXT_MARK && (udfLen - index - 1) <= EXT_SIZE) { if (udfLen == index + 1) hasExt = 0; else { hasExt = 1; extIndex = index; newExtIndex = newIndex; } } if (newIndex < 256) newName[newIndex++] = curr; else needsCRC = 1; } } if (needsCRC) { uint8_t ext[EXT_SIZE]; int localExtIndex = 0; if (hasExt) { int maxFilenameLen; for (index = 0; index < EXT_SIZE && extIndex + index + 1 < udfLen; index++) { curr = udfName[extIndex + index + 1]; if (curr == '/' || curr == 0) { needsCRC = 1; curr = ILLEGAL_CHAR_MARK; while (extIndex + index + 2 < udfLen && (index + 1 < EXT_SIZE && (udfName[extIndex + index + 2] == '/' || udfName[extIndex + index + 2] == 0))) index++; } ext[localExtIndex++] = curr; } maxFilenameLen = 250 - localExtIndex; if (newIndex > maxFilenameLen) newIndex = maxFilenameLen; else newIndex = newExtIndex; } else if (newIndex > 250) newIndex = 250; newName[newIndex++] = CRC_MARK; valueCRC = crc_itu_t(0, fidName, fidNameLen); newName[newIndex++] = hex_asc_upper_hi(valueCRC >> 8); newName[newIndex++] = hex_asc_upper_lo(valueCRC >> 8); newName[newIndex++] = hex_asc_upper_hi(valueCRC); newName[newIndex++] = hex_asc_upper_lo(valueCRC); if (hasExt) { newName[newIndex++] = EXT_MARK; for (index = 0; index < localExtIndex; index++) newName[newIndex++] = ext[index]; } } return newIndex; } ",1 "poppler_page_free_link_mapping (GList *list) { if (list == NULL) return; g_list_foreach (list, (GFunc) (poppler_mapping_free), NULL); g_list_free (list); } ",0 "bool xmp_set_property_bool(XmpPtr xmp, const char *schema, const char *name, bool value, uint32_t optionBits) { CHECK_PTR(xmp, false); RESET_ERROR; bool ret = false; auto txmp = reinterpret_cast(xmp); try { txmp->SetProperty_Bool(schema, name, value, optionBits); ret = true; } catch (const XMP_Error &e) { set_error(e); } catch (...) { } return ret; } ",0 "void AwContents::ClearMatches(JNIEnv* env, jobject obj) { DCHECK_CURRENTLY_ON(BrowserThread::UI); GetFindHelper()->ClearMatches(); } ",0 "bool HeadlessDevToolsManagerDelegate::HandleCommand( content::DevToolsAgentHost* agent_host, int session_id, base::DictionaryValue* command) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!browser_) return false; const base::Value* id_value = command->FindKey(""id""); const base::Value* method_value = command->FindKey(""method""); if (!id_value || !method_value) return false; const base::DictionaryValue* params = nullptr; command->GetDictionary(""params"", ¶ms); const std::string& method = method_value->GetString(); auto find_it = command_map_.find(method); if (find_it == command_map_.end()) { find_it = unhandled_command_map_.find(method); if (find_it != unhandled_command_map_.end()) find_it->second.Run(agent_host, session_id, id_value->GetInt(), params); return false; } if (method.find(""Browser."") == 0 && agent_host->GetType() != content::DevToolsAgentHost::kTypeBrowser) return false; auto cmd_result = find_it->second.Run(agent_host, session_id, id_value->GetInt(), params); if (!cmd_result) return false; agent_host->SendProtocolMessageToClient(session_id, ToString(std::move(cmd_result))); return true; } ",0 "nfs4_layoutcommit_done(struct rpc_task *task, void *calldata) { struct nfs4_layoutcommit_data *data = calldata; struct nfs_server *server = NFS_SERVER(data->args.inode); if (!nfs41_sequence_done(task, &data->res.seq_res)) return; switch (task->tk_status) { /* Just ignore these failures */ case -NFS4ERR_DELEG_REVOKED: /* layout was recalled */ case -NFS4ERR_BADIOMODE: /* no IOMODE_RW layout for range */ case -NFS4ERR_BADLAYOUT: /* no layout */ case -NFS4ERR_GRACE: /* loca_recalim always false */ task->tk_status = 0; case 0: break; default: if (nfs4_async_handle_error(task, server, NULL, NULL) == -EAGAIN) { rpc_restart_call_prepare(task); return; } } } ",0 "static int cqspi_wait_idle(struct cqspi_st *cqspi) { const unsigned int poll_idle_retry = 3; unsigned int count = 0; unsigned long timeout; timeout = jiffies + msecs_to_jiffies(CQSPI_TIMEOUT_MS); while (1) { /* * Read few times in succession to ensure the controller * is indeed idle, that is, the bit does not transition * low again. */ if (cqspi_is_idle(cqspi)) count++; else count = 0; if (count >= poll_idle_retry) return 0; if (time_after(jiffies, timeout)) { /* Timeout, in busy mode. */ dev_err(&cqspi->pdev->dev, ""QSPI is still busy after %dms timeout.\n"", CQSPI_TIMEOUT_MS); return -ETIMEDOUT; } cpu_relax(); } } ",0 "int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) { int r; struct kvm_memory_slot *memslot; unsigned long n, i; unsigned long *dirty_bitmap; unsigned long *dirty_bitmap_buffer; bool is_dirty = false; mutex_lock(&kvm->slots_lock); r = -EINVAL; if (log->slot >= KVM_USER_MEM_SLOTS) goto out; memslot = id_to_memslot(kvm->memslots, log->slot); dirty_bitmap = memslot->dirty_bitmap; r = -ENOENT; if (!dirty_bitmap) goto out; n = kvm_dirty_bitmap_bytes(memslot); dirty_bitmap_buffer = dirty_bitmap + n / sizeof(long); memset(dirty_bitmap_buffer, 0, n); spin_lock(&kvm->mmu_lock); for (i = 0; i < n / sizeof(long); i++) { unsigned long mask; gfn_t offset; if (!dirty_bitmap[i]) continue; is_dirty = true; mask = xchg(&dirty_bitmap[i], 0); dirty_bitmap_buffer[i] = mask; offset = i * BITS_PER_LONG; kvm_mmu_write_protect_pt_masked(kvm, memslot, offset, mask); } if (is_dirty) kvm_flush_remote_tlbs(kvm); spin_unlock(&kvm->mmu_lock); r = -EFAULT; if (copy_to_user(log->dirty_bitmap, dirty_bitmap_buffer, n)) goto out; r = 0; out: mutex_unlock(&kvm->slots_lock); return r; } ",0 " void RunOnCompositingDidCommit() { GetDelegatedFrameHost()->OnCompositingDidCommitForTesting( window()->GetHost()->compositor()); } ",0 "PHP_PGSQL_API int php_pgsql_convert(PGconn *pg_link, const char *table_name, const zval *values, zval *result, ulong opt TSRMLS_DC) { HashPosition pos; char *field = NULL; uint field_len = -1; ulong num_idx = -1; zval *meta, **def, **type, **not_null, **has_default, **is_enum, **val, *new_val; int key_type, err = 0, skip_field; php_pgsql_data_type data_type; assert(pg_link != NULL); assert(Z_TYPE_P(values) == IS_ARRAY); assert(Z_TYPE_P(result) == IS_ARRAY); assert(!(opt & ~PGSQL_CONV_OPTS)); if (!table_name) { return FAILURE; } MAKE_STD_ZVAL(meta); array_init(meta); /* table_name is escaped by php_pgsql_meta_data */ if (php_pgsql_meta_data(pg_link, table_name, meta TSRMLS_CC) == FAILURE) { zval_dtor(meta); FREE_ZVAL(meta); return FAILURE; } for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(values), &pos); zend_hash_get_current_data_ex(Z_ARRVAL_P(values), (void **)&val, &pos) == SUCCESS; zend_hash_move_forward_ex(Z_ARRVAL_P(values), &pos)) { skip_field = 0; new_val = NULL; if ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(values), &field, &field_len, &num_idx, 0, &pos)) == HASH_KEY_NON_EXISTANT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Failed to get array key type""); err = 1; } if (!err && key_type == HASH_KEY_IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Accepts only string key for values""); err = 1; } if (!err && key_type == HASH_KEY_NON_EXISTANT) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Accepts only string key for values""); err = 1; } if (!err && zend_hash_find(Z_ARRVAL_P(meta), field, field_len, (void **)&def) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid field name (%s) in values"", field); err = 1; } if (!err && zend_hash_find(Z_ARRVAL_PP(def), ""type"", sizeof(""type""), (void **)&type) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Detected broken meta data. Missing 'type'""); err = 1; } if (!err && zend_hash_find(Z_ARRVAL_PP(def), ""not null"", sizeof(""not null""), (void **)¬_null) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Detected broken meta data. Missing 'not null'""); err = 1; } if (!err && zend_hash_find(Z_ARRVAL_PP(def), ""has default"", sizeof(""has default""), (void **)&has_default) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Detected broken meta data. Missing 'has default'""); err = 1; } if (!err && zend_hash_find(Z_ARRVAL_PP(def), ""is enum"", sizeof(""is enum""), (void **)&is_enum) == FAILURE) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Detected broken meta data. Missing 'is enum'""); err = 1; } if (!err && (Z_TYPE_PP(val) == IS_ARRAY || Z_TYPE_PP(val) == IS_OBJECT || Z_TYPE_PP(val) == IS_CONSTANT_ARRAY)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects scalar values as field values""); err = 1; } if (err) { break; /* break out for() */ } ALLOC_INIT_ZVAL(new_val); if (Z_BVAL_PP(is_enum)) { /* enums need to be treated like strings */ data_type = PG_TEXT; } else { data_type = php_pgsql_get_data_type(Z_STRVAL_PP(type), Z_STRLEN_PP(type)); } switch(data_type) { case PG_BOOL: switch (Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { if (!strcmp(Z_STRVAL_PP(val), ""t"") || !strcmp(Z_STRVAL_PP(val), ""T"") || !strcmp(Z_STRVAL_PP(val), ""y"") || !strcmp(Z_STRVAL_PP(val), ""Y"") || !strcmp(Z_STRVAL_PP(val), ""true"") || !strcmp(Z_STRVAL_PP(val), ""True"") || !strcmp(Z_STRVAL_PP(val), ""yes"") || !strcmp(Z_STRVAL_PP(val), ""Yes"") || !strcmp(Z_STRVAL_PP(val), ""1"")) { ZVAL_STRING(new_val, ""'t'"", 1); } else if (!strcmp(Z_STRVAL_PP(val), ""f"") || !strcmp(Z_STRVAL_PP(val), ""F"") || !strcmp(Z_STRVAL_PP(val), ""n"") || !strcmp(Z_STRVAL_PP(val), ""N"") || !strcmp(Z_STRVAL_PP(val), ""false"") || !strcmp(Z_STRVAL_PP(val), ""False"") || !strcmp(Z_STRVAL_PP(val), ""no"") || !strcmp(Z_STRVAL_PP(val), ""No"") || !strcmp(Z_STRVAL_PP(val), ""0"")) { ZVAL_STRING(new_val, ""'f'"", 1); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Detected invalid value (%s) for PostgreSQL %s field (%s)"", Z_STRVAL_PP(val), Z_STRVAL_PP(type), field); err = 1; } } break; case IS_LONG: case IS_BOOL: if (Z_LVAL_PP(val)) { ZVAL_STRING(new_val, ""'t'"", 1); } else { ZVAL_STRING(new_val, ""'f'"", 1); } break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects string, null, long or boolelan value for PostgreSQL '%s' (%s)"", Z_STRVAL_PP(type), field); } break; case PG_OID: case PG_INT2: case PG_INT4: case PG_INT8: switch (Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { /* FIXME: better regex must be used */ if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^([+-]{0,1}[0-9]+)$"", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); } } break; case IS_DOUBLE: ZVAL_DOUBLE(new_val, Z_DVAL_PP(val)); convert_to_long_ex(&new_val); break; case IS_LONG: ZVAL_LONG(new_val, Z_LVAL_PP(val)); break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL, string, long or double value for pgsql '%s' (%s)"", Z_STRVAL_PP(type), field); } break; case PG_NUMERIC: case PG_MONEY: case PG_FLOAT4: case PG_FLOAT8: switch (Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { /* FIXME: better regex must be used */ if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^([+-]{0,1}[0-9]+)|([+-]{0,1}[0-9]*[\\.][0-9]+)|([+-]{0,1}[0-9]+[\\.][0-9]*)$"", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); } } break; case IS_LONG: ZVAL_LONG(new_val, Z_LVAL_PP(val)); break; case IS_DOUBLE: ZVAL_DOUBLE(new_val, Z_DVAL_PP(val)); break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL, string, long or double value for PostgreSQL '%s' (%s)"", Z_STRVAL_PP(type), field); } break; case PG_TEXT: case PG_CHAR: case PG_VARCHAR: switch (Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { if (opt & PGSQL_CONV_FORCE_NULL) { ZVAL_STRING(new_val, ""NULL"", 1); } else { ZVAL_STRING(new_val, ""''"", 1); } } else { char *tmp; Z_TYPE_P(new_val) = IS_STRING; tmp = (char *)safe_emalloc(Z_STRLEN_PP(val), 2, 1); Z_STRLEN_P(new_val) = (int)PQescapeStringConn(pg_link, tmp, Z_STRVAL_PP(val), Z_STRLEN_PP(val), NULL); Z_STRVAL_P(new_val) = tmp; php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); } break; case IS_LONG: ZVAL_LONG(new_val, Z_LVAL_PP(val)); convert_to_string_ex(&new_val); break; case IS_DOUBLE: ZVAL_DOUBLE(new_val, Z_DVAL_PP(val)); convert_to_string_ex(&new_val); break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL, string, long or double value for PostgreSQL '%s' (%s)"", Z_STRVAL_PP(type), field); } break; case PG_UNIX_TIME: case PG_UNIX_TIME_INTERVAL: /* these are the actallay a integer */ switch (Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { /* FIXME: Better regex must be used */ if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^[0-9]+$"", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); convert_to_long_ex(&new_val); } } break; case IS_DOUBLE: ZVAL_DOUBLE(new_val, Z_DVAL_PP(val)); convert_to_long_ex(&new_val); break; case IS_LONG: ZVAL_LONG(new_val, Z_LVAL_PP(val)); break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL, string, long or double value for '%s' (%s)"", Z_STRVAL_PP(type), field); } break; case PG_CIDR: case PG_INET: switch (Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { /* FIXME: Better regex must be used */ if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^([0-9]{1,3}\\.){3}[0-9]{1,3}(/[0-9]{1,2}){0,1}$"", 0 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); } } break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL or string for '%s' (%s)"", Z_STRVAL_PP(type), field); } break; case PG_TIME_WITH_TIMEZONE: case PG_TIMESTAMP: case PG_TIMESTAMP_WITH_TIMEZONE: switch(Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRINGL(new_val, ""NULL"", sizeof(""NULL"")-1, 1); } else if (!strcasecmp(Z_STRVAL_PP(val), ""now()"")) { ZVAL_STRINGL(new_val, ""NOW()"", sizeof(""NOW()"")-1, 1); } else { /* FIXME: better regex must be used */ if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})([ \\t]+(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1}(\\.[0-9]+){0,1}([ \\t]*([+-][0-9]{1,4}(:[0-9]{1,2}){0,1}|[-a-zA-Z_/+]{1,50})){0,1})){0,1}$"", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); } } break; case IS_NULL: ZVAL_STRINGL(new_val, ""NULL"", sizeof(""NULL"")-1, 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL or string for PostgreSQL %s field (%s)"", Z_STRVAL_PP(type), field); } break; case PG_DATE: switch(Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { /* FIXME: better regex must be used */ if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^([0-9]{4}[/-][0-9]{1,2}[/-][0-9]{1,2})$"", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); } } break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL or string for PostgreSQL %s field (%s)"", Z_STRVAL_PP(type), field); } break; case PG_TIME: switch(Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { /* FIXME: better regex must be used */ if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^(([0-9]{1,2}:[0-9]{1,2}){1}(:[0-9]{1,2}){0,1})){0,1}$"", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); } } break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL or string for PostgreSQL %s field (%s)"", Z_STRVAL_PP(type), field); } break; case PG_INTERVAL: switch(Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { /* From the Postgres docs: interval values can be written with the following syntax: [@] quantity unit [quantity unit...] [direction] Where: quantity is a number (possibly signed); unit is second, minute, hour, day, week, month, year, decade, century, millennium, or abbreviations or plurals of these units [note not *all* abbreviations] ; direction can be ago or empty. The at sign (@) is optional noise. ... Quantities of days, hours, minutes, and seconds can be specified without explicit unit markings. For example, '1 12:59:10' is read the same as '1 day 12 hours 59 min 10 sec'. */ if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^(@?[ \\t]+)?("" /* Textual time units and their abbreviations: */ ""(([-+]?[ \\t]+)?"" ""[0-9]+(\\.[0-9]*)?[ \\t]*"" ""(millenniums|millennia|millennium|mil|mils|"" ""centuries|century|cent|c|"" ""decades|decade|dec|decs|"" ""years|year|y|"" ""months|month|mon|"" ""weeks|week|w|"" ""days|day|d|"" ""hours|hour|hr|hrs|h|"" ""minutes|minute|mins|min|m|"" ""seconds|second|secs|sec|s))+|"" /* Textual time units plus (dd)* hh[:mm[:ss]] */ ""((([-+]?[ \\t]+)?"" ""[0-9]+(\\.[0-9]*)?[ \\t]*"" ""(millenniums|millennia|millennium|mil|mils|"" ""centuries|century|cent|c|"" ""decades|decade|dec|decs|"" ""years|year|y|"" ""months|month|mon|"" ""weeks|week|w|"" ""days|day|d))+"" ""([-+]?[ \\t]+"" ""([0-9]+[ \\t]+)+"" /* dd */ ""(([0-9]{1,2}:){0,2}[0-9]{0,2})"" /* hh:[mm:[ss]] */ "")?))"" ""([ \\t]+ago)?$"", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); } } break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL or string for PostgreSQL %s field (%s)"", Z_STRVAL_PP(type), field); } break; #ifdef HAVE_PQESCAPE case PG_BYTEA: switch (Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { unsigned char *tmp; size_t to_len; smart_str s = {0}; #ifdef HAVE_PQESCAPE_BYTEA_CONN tmp = PQescapeByteaConn(pg_link, (unsigned char *)Z_STRVAL_PP(val), Z_STRLEN_PP(val), &to_len); #else tmp = PQescapeBytea(Z_STRVAL_PP(val), (unsigned char *)Z_STRLEN_PP(val), &to_len); #endif Z_TYPE_P(new_val) = IS_STRING; Z_STRLEN_P(new_val) = to_len-1; /* PQescapeBytea's to_len includes additional '\0' */ Z_STRVAL_P(new_val) = emalloc(to_len); memcpy(Z_STRVAL_P(new_val), tmp, to_len); PQfreemem(tmp); php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); smart_str_appendl(&s, Z_STRVAL_P(new_val), Z_STRLEN_P(new_val)); smart_str_0(&s); efree(Z_STRVAL_P(new_val)); Z_STRVAL_P(new_val) = s.c; Z_STRLEN_P(new_val) = s.len; } break; case IS_LONG: ZVAL_LONG(new_val, Z_LVAL_PP(val)); convert_to_string_ex(&new_val); break; case IS_DOUBLE: ZVAL_DOUBLE(new_val, Z_DVAL_PP(val)); convert_to_string_ex(&new_val); break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL, string, long or double value for PostgreSQL '%s' (%s)"", Z_STRVAL_PP(type), field); } break; #endif case PG_MACADDR: switch(Z_TYPE_PP(val)) { case IS_STRING: if (Z_STRLEN_PP(val) == 0) { ZVAL_STRING(new_val, ""NULL"", 1); } else { if (php_pgsql_convert_match(Z_STRVAL_PP(val), Z_STRLEN_PP(val), ""^([0-9a-f]{2,2}:){5,5}[0-9a-f]{2,2}$"", 1 TSRMLS_CC) == FAILURE) { err = 1; } else { ZVAL_STRING(new_val, Z_STRVAL_PP(val), 1); php_pgsql_add_quotes(new_val, 1 TSRMLS_CC); } } break; case IS_NULL: ZVAL_STRING(new_val, ""NULL"", 1); break; default: err = 1; } PGSQL_CONV_CHECK_IGNORE(); if (err) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects NULL or string for PostgreSQL %s field (%s)"", Z_STRVAL_PP(type), field); } break; /* bit */ case PG_BIT: case PG_VARBIT: /* geometric */ case PG_LINE: case PG_LSEG: case PG_POINT: case PG_BOX: case PG_PATH: case PG_POLYGON: case PG_CIRCLE: php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""PostgreSQL '%s' type (%s) is not supported"", Z_STRVAL_PP(type), field); err = 1; break; case PG_UNKNOWN: default: php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Unknown or system data type '%s' for '%s'"", Z_STRVAL_PP(type), field); err = 1; break; } /* switch */ if (err) { zval_dtor(new_val); FREE_ZVAL(new_val); break; /* break out for() */ } /* If field is NULL and HAS DEFAULT, should be skipped */ if (!skip_field) { char *escaped; size_t field_len = strlen(field); if (_php_pgsql_detect_identifier_escape(field, field_len) == SUCCESS) { add_assoc_zval(result, field, new_val); } else { escaped = PGSQLescapeIdentifier(pg_link, field, field_len); add_assoc_zval(result, escaped, new_val); PGSQLfree(escaped); } } } /* for */ zval_dtor(meta); FREE_ZVAL(meta); if (err) { /* shouldn't destroy & free zval here */ return FAILURE; } return SUCCESS; } ",0 "compute_dh(unsigned char *buf, int size, BIGNUM *server_pub_key, DH *dh) { int len, pad; len = DH_compute_key(buf, server_pub_key, dh); assert(len >= 0 && len <= size); if (len < size) { pad = size - len; memmove(buf + pad, buf, len); memset(buf, 0, pad); } } ",0 "static bool task_participate_group_stop(struct task_struct *task) { struct signal_struct *sig = task->signal; bool consume = task->jobctl & JOBCTL_STOP_CONSUME; WARN_ON_ONCE(!(task->jobctl & JOBCTL_STOP_PENDING)); task_clear_jobctl_pending(task, JOBCTL_STOP_PENDING); if (!consume) return false; if (!WARN_ON_ONCE(sig->group_stop_count == 0)) sig->group_stop_count--; /* * Tell the caller to notify completion iff we are entering into a * fresh group stop. Read comment in do_signal_stop() for details. */ if (!sig->group_stop_count && !(sig->flags & SIGNAL_STOP_STOPPED)) { sig->flags = SIGNAL_STOP_STOPPED; return true; } return false; } ",0 "size_t lodepng_get_raw_size(unsigned w, unsigned h, const LodePNGColorMode* color) { return (w * h * lodepng_get_bpp(color) + 7) / 8; } ",0 "Element* Document::PointerLockElement() const { if (!GetPage() || GetPage()->GetPointerLockController().LockPending()) return 0; if (Element* element = GetPage()->GetPointerLockController().GetElement()) { if (element->GetDocument() == this) return element; } return 0; } ",0 "WORD32 ih264d_parse_decode_slice(UWORD8 u1_is_idr_slice, UWORD8 u1_nal_ref_idc, dec_struct_t *ps_dec /* Decoder parameters */ ) { dec_bit_stream_t * ps_bitstrm = ps_dec->ps_bitstrm; dec_pic_params_t *ps_pps; dec_seq_params_t *ps_seq; dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice; pocstruct_t s_tmp_poc; WORD32 i_delta_poc[2]; WORD32 i4_poc = 0; UWORD16 u2_first_mb_in_slice, u2_frame_num; UWORD8 u1_field_pic_flag, u1_redundant_pic_cnt = 0, u1_slice_type; UWORD32 u4_idr_pic_id = 0; UWORD8 u1_bottom_field_flag, u1_pic_order_cnt_type; UWORD8 u1_nal_unit_type; UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst; WORD8 i1_is_end_of_poc; WORD32 ret, end_of_frame; WORD32 prev_slice_err, num_mb_skipped; UWORD8 u1_mbaff; pocstruct_t *ps_cur_poc; UWORD32 u4_temp; WORD32 i_temp; UWORD32 u4_call_end_of_pic = 0; /* read FirstMbInSlice and slice type*/ ps_dec->ps_dpb_cmds->u1_dpb_commands_read_slc = 0; u2_first_mb_in_slice = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u2_first_mb_in_slice > (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs)) { return ERROR_CORRUPTED_SLICE; } /*we currently don not support ASO*/ if(((u2_first_mb_in_slice << ps_cur_slice->u1_mbaff_frame_flag) <= ps_dec->u2_cur_mb_addr) && (ps_dec->u4_first_slice_in_pic == 0)) { return ERROR_CORRUPTED_SLICE; } COPYTHECONTEXT(""SH: first_mb_in_slice"",u2_first_mb_in_slice); u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u4_temp > 9) return ERROR_INV_SLC_TYPE_T; u1_slice_type = u4_temp; COPYTHECONTEXT(""SH: slice_type"",(u1_slice_type)); ps_dec->u1_sl_typ_5_9 = 0; /* Find Out the Slice Type is 5 to 9 or not then Set the Flag */ /* u1_sl_typ_5_9 = 1 .Which tells that all the slices in the Pic*/ /* will be of same type of current */ if(u1_slice_type > 4) { u1_slice_type -= 5; ps_dec->u1_sl_typ_5_9 = 1; } { UWORD32 skip; if((ps_dec->i4_app_skip_mode == IVD_SKIP_PB) || (ps_dec->i4_dec_skip_mode == IVD_SKIP_PB)) { UWORD32 u4_bit_stream_offset = 0; if(ps_dec->u1_nal_unit_type == IDR_SLICE_NAL) { skip = 0; ps_dec->i4_dec_skip_mode = IVD_SKIP_NONE; } else if((I_SLICE == u1_slice_type) && (1 >= ps_dec->ps_cur_sps->u1_num_ref_frames)) { skip = 0; ps_dec->i4_dec_skip_mode = IVD_SKIP_NONE; } else { skip = 1; } /* If one frame worth of data is already skipped, do not skip the next one */ if((0 == u2_first_mb_in_slice) && (1 == ps_dec->u4_prev_nal_skipped)) { skip = 0; } if(skip) { ps_dec->u4_prev_nal_skipped = 1; ps_dec->i4_dec_skip_mode = IVD_SKIP_PB; return 0; } else { /* If the previous NAL was skipped, then do not process that buffer in this call. Return to app and process it in the next call. This is necessary to handle cases where I/IDR is not complete in the current buffer and application intends to fill the remaining part of the bitstream later. This ensures we process only frame worth of data in every call */ if(1 == ps_dec->u4_prev_nal_skipped) { ps_dec->u4_return_to_app = 1; return 0; } } } } u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u4_temp & MASK_ERR_PIC_SET_ID) return ERROR_INV_SLICE_HDR_T; /* discard slice if pic param is invalid */ COPYTHECONTEXT(""SH: pic_parameter_set_id"", u4_temp); ps_pps = &ps_dec->ps_pps[u4_temp]; if(FALSE == ps_pps->u1_is_valid) { return ERROR_INV_SLICE_HDR_T; } ps_seq = ps_pps->ps_sps; if(!ps_seq) return ERROR_INV_SLICE_HDR_T; if(FALSE == ps_seq->u1_is_valid) return ERROR_INV_SLICE_HDR_T; /* Get the frame num */ u2_frame_num = ih264d_get_bits_h264(ps_bitstrm, ps_seq->u1_bits_in_frm_num); COPYTHECONTEXT(""SH: frame_num"", u2_frame_num); /* Get the field related flags */ if(!ps_seq->u1_frame_mbs_only_flag) { u1_field_pic_flag = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT(""SH: field_pic_flag"", u1_field_pic_flag); u1_bottom_field_flag = 0; if(u1_field_pic_flag) { ps_dec->pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan_fld; u1_bottom_field_flag = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT(""SH: bottom_field_flag"", u1_bottom_field_flag); } else { ps_dec->pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan; } } else { u1_field_pic_flag = 0; u1_bottom_field_flag = 0; ps_dec->pu1_inv_scan = (UWORD8 *)gau1_ih264d_inv_scan; } u1_nal_unit_type = SLICE_NAL; if(u1_is_idr_slice) { if(0 == u1_field_pic_flag) { ps_dec->u1_top_bottom_decoded = TOP_FIELD_ONLY | BOT_FIELD_ONLY; } u1_nal_unit_type = IDR_SLICE_NAL; u4_idr_pic_id = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u4_idr_pic_id > 65535) return ERROR_INV_SLICE_HDR_T; COPYTHECONTEXT(""SH: "", u4_idr_pic_id); } /* read delta pic order count information*/ i_delta_poc[0] = i_delta_poc[1] = 0; s_tmp_poc.i4_pic_order_cnt_lsb = 0; s_tmp_poc.i4_delta_pic_order_cnt_bottom = 0; u1_pic_order_cnt_type = ps_seq->u1_pic_order_cnt_type; if(u1_pic_order_cnt_type == 0) { i_temp = ih264d_get_bits_h264( ps_bitstrm, ps_seq->u1_log2_max_pic_order_cnt_lsb_minus); if(i_temp < 0 || i_temp >= ps_seq->i4_max_pic_order_cntLsb) return ERROR_INV_SLICE_HDR_T; s_tmp_poc.i4_pic_order_cnt_lsb = i_temp; COPYTHECONTEXT(""SH: pic_order_cnt_lsb"", s_tmp_poc.i4_pic_order_cnt_lsb); if((ps_pps->u1_pic_order_present_flag == 1) && (!u1_field_pic_flag)) { s_tmp_poc.i4_delta_pic_order_cnt_bottom = ih264d_sev( pu4_bitstrm_ofst, pu4_bitstrm_buf); COPYTHECONTEXT(""SH: delta_pic_order_cnt_bottom"", s_tmp_poc.i4_delta_pic_order_cnt_bottom); } } s_tmp_poc.i4_delta_pic_order_cnt[0] = 0; s_tmp_poc.i4_delta_pic_order_cnt[1] = 0; if(u1_pic_order_cnt_type == 1 && (!ps_seq->u1_delta_pic_order_always_zero_flag)) { s_tmp_poc.i4_delta_pic_order_cnt[0] = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf); COPYTHECONTEXT(""SH: delta_pic_order_cnt[0]"", s_tmp_poc.i4_delta_pic_order_cnt[0]); if(ps_pps->u1_pic_order_present_flag && !u1_field_pic_flag) { s_tmp_poc.i4_delta_pic_order_cnt[1] = ih264d_sev( pu4_bitstrm_ofst, pu4_bitstrm_buf); COPYTHECONTEXT(""SH: delta_pic_order_cnt[1]"", s_tmp_poc.i4_delta_pic_order_cnt[1]); } } if(ps_pps->u1_redundant_pic_cnt_present_flag) { u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u4_temp > MAX_REDUNDANT_PIC_CNT) return ERROR_INV_SLICE_HDR_T; u1_redundant_pic_cnt = u4_temp; COPYTHECONTEXT(""SH: redundant_pic_cnt"", u1_redundant_pic_cnt); } /*--------------------------------------------------------------------*/ /* Check if the slice is part of new picture */ /*--------------------------------------------------------------------*/ /* First slice of a picture is always considered as part of new picture */ i1_is_end_of_poc = 1; ps_dec->ps_dec_err_status->u1_err_flag &= MASK_REJECT_CUR_PIC; if(ps_dec->u4_first_slice_in_pic != 2) { i1_is_end_of_poc = ih264d_is_end_of_pic(u2_frame_num, u1_nal_ref_idc, &s_tmp_poc, &ps_dec->s_cur_pic_poc, ps_cur_slice, u1_pic_order_cnt_type, u1_nal_unit_type, u4_idr_pic_id, u1_field_pic_flag, u1_bottom_field_flag); } /*--------------------------------------------------------------------*/ /* Check for error in slice and parse the missing/corrupted MB's */ /* as skip-MB's in an inserted P-slice */ /*--------------------------------------------------------------------*/ u1_mbaff = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag); prev_slice_err = 0; if(i1_is_end_of_poc || ps_dec->u1_first_slice_in_stream) { if(u2_frame_num != ps_dec->u2_prv_frame_num && ps_dec->u1_top_bottom_decoded != 0 && ps_dec->u1_top_bottom_decoded != (TOP_FIELD_ONLY | BOT_FIELD_ONLY)) { ps_dec->u1_dangling_field = 1; if(ps_dec->u4_first_slice_in_pic) { prev_slice_err = 1; } else { prev_slice_err = 2; } if(ps_dec->u1_top_bottom_decoded ==TOP_FIELD_ONLY) ps_cur_slice->u1_bottom_field_flag = 1; else ps_cur_slice->u1_bottom_field_flag = 0; num_mb_skipped = (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) - ps_dec->u2_total_mbs_coded; ps_cur_poc = &ps_dec->s_cur_pic_poc; u1_is_idr_slice = ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL; } else if(ps_dec->u4_first_slice_in_pic == 2) { if(u2_first_mb_in_slice > 0) { prev_slice_err = 1; num_mb_skipped = u2_first_mb_in_slice << u1_mbaff; ps_cur_poc = &s_tmp_poc; ps_cur_slice->u4_idr_pic_id = u4_idr_pic_id; ps_cur_slice->u1_field_pic_flag = u1_field_pic_flag; ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag; ps_cur_slice->i4_pic_order_cnt_lsb = s_tmp_poc.i4_pic_order_cnt_lsb; ps_cur_slice->u1_nal_unit_type = u1_nal_unit_type; ps_cur_slice->u1_redundant_pic_cnt = u1_redundant_pic_cnt; ps_cur_slice->u1_nal_ref_idc = u1_nal_ref_idc; ps_cur_slice->u1_pic_order_cnt_type = u1_pic_order_cnt_type; ps_cur_slice->u1_mbaff_frame_flag = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag); } } else { if(ps_dec->u4_first_slice_in_pic) { /* if valid slice header is not decoded do start of pic processing * since in the current process call, frame num is not updated in the slice structure yet * ih264d_is_end_of_pic is checked with valid frame num of previous process call, * although i1_is_end_of_poc is set there could be more slices in the frame, * so conceal only till cur slice */ prev_slice_err = 1; num_mb_skipped = u2_first_mb_in_slice << u1_mbaff; } else { /* since i1_is_end_of_poc is set ,means new frame num is encountered. so conceal the current frame * completely */ prev_slice_err = 2; num_mb_skipped = (ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) - ps_dec->u2_total_mbs_coded; } ps_cur_poc = &s_tmp_poc; } } else { if((u2_first_mb_in_slice << u1_mbaff) > ps_dec->u2_total_mbs_coded) { prev_slice_err = 2; num_mb_skipped = (u2_first_mb_in_slice << u1_mbaff) - ps_dec->u2_total_mbs_coded; ps_cur_poc = &s_tmp_poc; } else if((u2_first_mb_in_slice << u1_mbaff) < ps_dec->u2_total_mbs_coded) { return ERROR_CORRUPTED_SLICE; } } if(prev_slice_err) { ret = ih264d_mark_err_slice_skip(ps_dec, num_mb_skipped, u1_is_idr_slice, u2_frame_num, ps_cur_poc, prev_slice_err); if(ps_dec->u1_dangling_field == 1) { ps_dec->u1_second_field = 1 - ps_dec->u1_second_field; ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag; ps_dec->u2_prv_frame_num = u2_frame_num; ps_dec->u1_first_slice_in_stream = 0; return ERROR_DANGLING_FIELD_IN_PIC; } if(prev_slice_err == 2) { ps_dec->u1_first_slice_in_stream = 0; return ERROR_INCOMPLETE_FRAME; } if(ps_dec->u2_total_mbs_coded >= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) { /* return if all MBs in frame are parsed*/ ps_dec->u1_first_slice_in_stream = 0; return ERROR_IN_LAST_SLICE_OF_PIC; } if(ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) { ih264d_err_pic_dispbuf_mgr(ps_dec); return ERROR_NEW_FRAME_EXPECTED; } if(ret != OK) return ret; i1_is_end_of_poc = 0; } if (ps_dec->u4_first_slice_in_pic == 0) { ps_dec->ps_parse_cur_slice++; ps_dec->u2_cur_slice_num++; } if((ps_dec->u1_separate_parse == 0) && (ps_dec->u4_first_slice_in_pic == 0)) { ps_dec->ps_decode_cur_slice++; } ps_dec->u1_slice_header_done = 0; /*--------------------------------------------------------------------*/ /* If the slice is part of new picture, do End of Pic processing. */ /*--------------------------------------------------------------------*/ if(!ps_dec->u1_first_slice_in_stream) { UWORD8 uc_mbs_exceed = 0; if(ps_dec->u2_total_mbs_coded == (ps_dec->ps_cur_sps->u2_max_mb_addr + 1)) { /*u2_total_mbs_coded is forced to u2_max_mb_addr+ 1 at the end of decode ,so ,if it is first slice in pic dont consider u2_total_mbs_coded to detect new picture */ if(ps_dec->u4_first_slice_in_pic == 0) uc_mbs_exceed = 1; } if(i1_is_end_of_poc || uc_mbs_exceed) { if(1 == ps_dec->u1_last_pic_not_decoded) { ret = ih264d_end_of_pic_dispbuf_mgr(ps_dec); if(ret != OK) return ret; ret = ih264d_end_of_pic(ps_dec, u1_is_idr_slice, u2_frame_num); if(ret != OK) return ret; #if WIN32 H264_DEC_DEBUG_PRINT("" ------ PIC SKIPPED ------\n""); #endif return RET_LAST_SKIP; } else { ret = ih264d_end_of_pic(ps_dec, u1_is_idr_slice, u2_frame_num); if(ret != OK) return ret; } } } if(u1_field_pic_flag) { ps_dec->u2_prv_frame_num = u2_frame_num; } if(ps_cur_slice->u1_mmco_equalto5) { WORD32 i4_temp_poc; WORD32 i4_top_field_order_poc, i4_bot_field_order_poc; if(!ps_cur_slice->u1_field_pic_flag) // or a complementary field pair { i4_top_field_order_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt; i4_bot_field_order_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt; i4_temp_poc = MIN(i4_top_field_order_poc, i4_bot_field_order_poc); } else if(!ps_cur_slice->u1_bottom_field_flag) i4_temp_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt; else i4_temp_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt; ps_dec->ps_cur_pic->i4_top_field_order_cnt = i4_temp_poc - ps_dec->ps_cur_pic->i4_top_field_order_cnt; ps_dec->ps_cur_pic->i4_bottom_field_order_cnt = i4_temp_poc - ps_dec->ps_cur_pic->i4_bottom_field_order_cnt; ps_dec->ps_cur_pic->i4_poc = i4_temp_poc; ps_dec->ps_cur_pic->i4_avg_poc = i4_temp_poc; } if(ps_dec->u4_first_slice_in_pic == 2) { ret = ih264d_decode_pic_order_cnt(u1_is_idr_slice, u2_frame_num, &ps_dec->s_prev_pic_poc, &s_tmp_poc, ps_cur_slice, ps_pps, u1_nal_ref_idc, u1_bottom_field_flag, u1_field_pic_flag, &i4_poc); if(ret != OK) return ret; /* Display seq no calculations */ if(i4_poc >= ps_dec->i4_max_poc) ps_dec->i4_max_poc = i4_poc; /* IDR Picture or POC wrap around */ if(i4_poc == 0) { ps_dec->i4_prev_max_display_seq = ps_dec->i4_prev_max_display_seq + ps_dec->i4_max_poc + ps_dec->u1_max_dec_frame_buffering + 1; ps_dec->i4_max_poc = 0; } } /*--------------------------------------------------------------------*/ /* Copy the values read from the bitstream to the slice header and then*/ /* If the slice is first slice in picture, then do Start of Picture */ /* processing. */ /*--------------------------------------------------------------------*/ ps_cur_slice->i4_delta_pic_order_cnt[0] = i_delta_poc[0]; ps_cur_slice->i4_delta_pic_order_cnt[1] = i_delta_poc[1]; ps_cur_slice->u4_idr_pic_id = u4_idr_pic_id; ps_cur_slice->u2_first_mb_in_slice = u2_first_mb_in_slice; ps_cur_slice->u1_field_pic_flag = u1_field_pic_flag; ps_cur_slice->u1_bottom_field_flag = u1_bottom_field_flag; ps_cur_slice->u1_slice_type = u1_slice_type; ps_cur_slice->i4_pic_order_cnt_lsb = s_tmp_poc.i4_pic_order_cnt_lsb; ps_cur_slice->u1_nal_unit_type = u1_nal_unit_type; ps_cur_slice->u1_redundant_pic_cnt = u1_redundant_pic_cnt; ps_cur_slice->u1_nal_ref_idc = u1_nal_ref_idc; ps_cur_slice->u1_pic_order_cnt_type = u1_pic_order_cnt_type; if(ps_seq->u1_frame_mbs_only_flag) ps_cur_slice->u1_direct_8x8_inference_flag = ps_seq->u1_direct_8x8_inference_flag; else ps_cur_slice->u1_direct_8x8_inference_flag = 1; if(u1_slice_type == B_SLICE) { ps_cur_slice->u1_direct_spatial_mv_pred_flag = ih264d_get_bit_h264( ps_bitstrm); COPYTHECONTEXT(""SH: direct_spatial_mv_pred_flag"", ps_cur_slice->u1_direct_spatial_mv_pred_flag); if(ps_cur_slice->u1_direct_spatial_mv_pred_flag) ps_cur_slice->pf_decodeDirect = ih264d_decode_spatial_direct; else ps_cur_slice->pf_decodeDirect = ih264d_decode_temporal_direct; if(!((ps_pps->ps_sps->u1_mb_aff_flag) && (!u1_field_pic_flag))) ps_dec->pf_mvpred = ih264d_mvpred_nonmbaffB; } else { if(!((ps_pps->ps_sps->u1_mb_aff_flag) && (!u1_field_pic_flag))) ps_dec->pf_mvpred = ih264d_mvpred_nonmbaff; } if(ps_dec->u4_first_slice_in_pic == 2) { if(u2_first_mb_in_slice == 0) { ret = ih264d_start_of_pic(ps_dec, i4_poc, &s_tmp_poc, u2_frame_num, ps_pps); if(ret != OK) return ret; } ps_dec->u4_output_present = 0; { ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op)); /* If error code is non-zero then there is no buffer available for display, hence avoid format conversion */ if(0 != ps_dec->s_disp_op.u4_error_code) { ps_dec->u4_fmt_conv_cur_row = ps_dec->s_disp_frame_info.u4_y_ht; } else ps_dec->u4_output_present = 1; } if(ps_dec->u1_separate_parse == 1) { if(ps_dec->u4_dec_thread_created == 0) { ithread_create(ps_dec->pv_dec_thread_handle, NULL, (void *)ih264d_decode_picture_thread, (void *)ps_dec); ps_dec->u4_dec_thread_created = 1; } if((ps_dec->u4_num_cores == 3) && ((ps_dec->u4_app_disable_deblk_frm == 0) || ps_dec->i1_recon_in_thread3_flag) && (ps_dec->u4_bs_deblk_thread_created == 0)) { ps_dec->u4_start_recon_deblk = 0; ithread_create(ps_dec->pv_bs_deblk_thread_handle, NULL, (void *)ih264d_recon_deblk_thread, (void *)ps_dec); ps_dec->u4_bs_deblk_thread_created = 1; } } } /* INITIALIZATION of fn ptrs for MC and formMbPartInfo functions */ { UWORD8 uc_nofield_nombaff; uc_nofield_nombaff = ((ps_dec->ps_cur_slice->u1_field_pic_flag == 0) && (ps_dec->ps_cur_slice->u1_mbaff_frame_flag == 0) && (u1_slice_type != B_SLICE) && (ps_dec->ps_cur_pps->u1_wted_pred_flag == 0)); /* Initialise MC and formMbPartInfo fn ptrs one time based on profile_idc */ if(uc_nofield_nombaff) { ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_bp; ps_dec->p_motion_compensate = ih264d_motion_compensate_bp; } else { ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_mp; ps_dec->p_motion_compensate = ih264d_motion_compensate_mp; } } /* * Decide whether to decode the current picture or not */ { dec_err_status_t * ps_err = ps_dec->ps_dec_err_status; if(ps_err->u4_frm_sei_sync == u2_frame_num) { ps_err->u1_err_flag = ACCEPT_ALL_PICS; ps_err->u4_frm_sei_sync = SYNC_FRM_DEFAULT; } ps_err->u4_cur_frm = u2_frame_num; } /* Decision for decoding if the picture is to be skipped */ { WORD32 i4_skip_b_pic, i4_skip_p_pic; i4_skip_b_pic = (ps_dec->u4_skip_frm_mask & B_SLC_BIT) && (B_SLICE == u1_slice_type) && (0 == u1_nal_ref_idc); i4_skip_p_pic = (ps_dec->u4_skip_frm_mask & P_SLC_BIT) && (P_SLICE == u1_slice_type) && (0 == u1_nal_ref_idc); /**************************************************************/ /* Skip the B picture if skip mask is set for B picture and */ /* Current B picture is a non reference B picture or there is */ /* no user for reference B picture */ /**************************************************************/ if(i4_skip_b_pic) { ps_dec->ps_cur_pic->u4_pack_slc_typ |= B_SLC_BIT; /* Don't decode the picture in SKIP-B mode if that picture is B */ /* and also it is not to be used as a reference picture */ ps_dec->u1_last_pic_not_decoded = 1; return OK; } /**************************************************************/ /* Skip the P picture if skip mask is set for P picture and */ /* Current P picture is a non reference P picture or there is */ /* no user for reference P picture */ /**************************************************************/ if(i4_skip_p_pic) { ps_dec->ps_cur_pic->u4_pack_slc_typ |= P_SLC_BIT; /* Don't decode the picture in SKIP-P mode if that picture is P */ /* and also it is not to be used as a reference picture */ ps_dec->u1_last_pic_not_decoded = 1; return OK; } } { UWORD16 u2_mb_x, u2_mb_y; ps_dec->i4_submb_ofst = ((u2_first_mb_in_slice << ps_cur_slice->u1_mbaff_frame_flag) * SUB_BLK_SIZE) - SUB_BLK_SIZE; if(u2_first_mb_in_slice) { UWORD8 u1_mb_aff; UWORD8 u1_field_pic; UWORD16 u2_frm_wd_in_mbs; u2_frm_wd_in_mbs = ps_seq->u2_frm_wd_in_mbs; u1_mb_aff = ps_cur_slice->u1_mbaff_frame_flag; u1_field_pic = ps_cur_slice->u1_field_pic_flag; { UWORD32 x_offset; UWORD32 y_offset; UWORD32 u4_frame_stride; tfr_ctxt_t *ps_trns_addr; // = &ps_dec->s_tran_addrecon_parse; if(ps_dec->u1_separate_parse) { ps_trns_addr = &ps_dec->s_tran_addrecon_parse; } else { ps_trns_addr = &ps_dec->s_tran_addrecon; } u2_mb_x = MOD(u2_first_mb_in_slice, u2_frm_wd_in_mbs); u2_mb_y = DIV(u2_first_mb_in_slice, u2_frm_wd_in_mbs); u2_mb_y <<= u1_mb_aff; if((u2_mb_x > u2_frm_wd_in_mbs - 1) || (u2_mb_y > ps_dec->u2_frm_ht_in_mbs - 1)) { return ERROR_CORRUPTED_SLICE; } u4_frame_stride = ps_dec->u2_frm_wd_y << u1_field_pic; x_offset = u2_mb_x << 4; y_offset = (u2_mb_y * u4_frame_stride) << 4; ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1 + x_offset + y_offset; u4_frame_stride = ps_dec->u2_frm_wd_uv << u1_field_pic; x_offset >>= 1; y_offset = (u2_mb_y * u4_frame_stride) << 3; x_offset *= YUV420SP_FACTOR; ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2 + x_offset + y_offset; ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3 + x_offset + y_offset; ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y; ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u; ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v; if(ps_dec->u1_separate_parse == 1) { ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic + (u2_first_mb_in_slice << u1_mb_aff); } else { ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic + (u2_first_mb_in_slice << u1_mb_aff); } ps_dec->u2_cur_mb_addr = (u2_first_mb_in_slice << u1_mb_aff); ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv + ((u2_first_mb_in_slice << u1_mb_aff) << 4); } } else { tfr_ctxt_t *ps_trns_addr; if(ps_dec->u1_separate_parse) { ps_trns_addr = &ps_dec->s_tran_addrecon_parse; } else { ps_trns_addr = &ps_dec->s_tran_addrecon; } u2_mb_x = 0xffff; u2_mb_y = 0; ps_dec->u2_cur_mb_addr = 0; ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic; ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv; ps_trns_addr->pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1; ps_trns_addr->pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2; ps_trns_addr->pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3; ps_trns_addr->pu1_mb_y = ps_trns_addr->pu1_dest_y; ps_trns_addr->pu1_mb_u = ps_trns_addr->pu1_dest_u; ps_trns_addr->pu1_mb_v = ps_trns_addr->pu1_dest_v; } ps_dec->ps_part = ps_dec->ps_parse_part_params; ps_dec->u2_mbx = (MOD(u2_first_mb_in_slice - 1, ps_seq->u2_frm_wd_in_mbs)); ps_dec->u2_mby = (DIV(u2_first_mb_in_slice - 1, ps_seq->u2_frm_wd_in_mbs)); ps_dec->u2_mby <<= ps_cur_slice->u1_mbaff_frame_flag; ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx; ps_dec->i2_prev_slice_mby = ps_dec->u2_mby; } /* RBSP stop bit is used for CABAC decoding*/ ps_bitstrm->u4_max_ofst += ps_dec->ps_cur_pps->u1_entropy_coding_mode; ps_dec->u1_B = (u1_slice_type == B_SLICE); ps_dec->u4_next_mb_skip = 0; ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice = ps_dec->ps_cur_slice->u2_first_mb_in_slice; ps_dec->ps_parse_cur_slice->slice_type = ps_dec->ps_cur_slice->u1_slice_type; ps_dec->u4_start_recon_deblk = 1; { WORD32 num_entries; WORD32 size; UWORD8 *pu1_buf; num_entries = MIN(MAX_FRAMES, ps_dec->u4_num_ref_frames_at_init); num_entries = 2 * ((2 * num_entries) + 1); size = num_entries * sizeof(void *); size += PAD_MAP_IDX_POC * sizeof(void *); pu1_buf = (UWORD8 *)ps_dec->pv_map_ref_idx_to_poc_buf; pu1_buf += size * ps_dec->u2_cur_slice_num; ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc = ( void *)pu1_buf; } if(ps_dec->u1_separate_parse) { ps_dec->ps_parse_cur_slice->pv_tu_coeff_data_start = ps_dec->pv_parse_tu_coeff_data; } else { ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data; } if(u1_slice_type == I_SLICE) { ps_dec->ps_cur_pic->u4_pack_slc_typ |= I_SLC_BIT; ret = ih264d_parse_islice(ps_dec, u2_first_mb_in_slice); if(ps_dec->i4_pic_type != B_SLICE && ps_dec->i4_pic_type != P_SLICE) ps_dec->i4_pic_type = I_SLICE; } else if(u1_slice_type == P_SLICE) { ps_dec->ps_cur_pic->u4_pack_slc_typ |= P_SLC_BIT; ret = ih264d_parse_pslice(ps_dec, u2_first_mb_in_slice); ps_dec->u1_pr_sl_type = u1_slice_type; if(ps_dec->i4_pic_type != B_SLICE) ps_dec->i4_pic_type = P_SLICE; } else if(u1_slice_type == B_SLICE) { ps_dec->ps_cur_pic->u4_pack_slc_typ |= B_SLC_BIT; ret = ih264d_parse_bslice(ps_dec, u2_first_mb_in_slice); ps_dec->u1_pr_sl_type = u1_slice_type; ps_dec->i4_pic_type = B_SLICE; } else return ERROR_INV_SLC_TYPE_T; if(ps_dec->u1_slice_header_done) { /* set to zero to indicate a valid slice has been decoded */ /* first slice header successfully decoded */ ps_dec->u4_first_slice_in_pic = 0; ps_dec->u1_first_slice_in_stream = 0; } if(ret != OK) return ret; /* storing last Mb X and MbY of the slice */ ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx; ps_dec->i2_prev_slice_mby = ps_dec->u2_mby; /* End of Picture detection */ if(ps_dec->u2_total_mbs_coded >= (ps_seq->u2_max_mb_addr + 1)) { ps_dec->u1_pic_decode_done = 1; } { dec_err_status_t * ps_err = ps_dec->ps_dec_err_status; if((ps_err->u1_err_flag & REJECT_PB_PICS) && (ps_err->u1_cur_pic_type == PIC_TYPE_I)) { ps_err->u1_err_flag = ACCEPT_ALL_PICS; } } PRINT_BIN_BIT_RATIO(ps_dec) return ret; } ",1 "ExtensionTtsPlatformImpl* ExtensionTtsPlatformImpl::GetInstance() { return ExtensionTtsPlatformImplChromeOs::GetInstance(); } ",0 " static void ReconfigureImpl(Handle object, Handle store, uint32_t entry, Handle value, PropertyAttributes attributes) { SeededNumberDictionary* dictionary = SeededNumberDictionary::cast(*store); if (attributes != NONE) object->RequireSlowElements(dictionary); dictionary->ValueAtPut(entry, *value); PropertyDetails details = dictionary->DetailsAt(entry); details = PropertyDetails(kData, attributes, details.dictionary_index(), PropertyCellType::kNoCell); dictionary->DetailsAtPut(entry, details); } ",0 "AP_DECLARE(void) ap_finalize_sub_req_protocol(request_rec *sub) { /* tell the filter chain there is no more content coming */ if (!sub->eos_sent) { end_output_stream(sub); } } ",0 " void ExtensionInfoBar::Layout() { InfoBar::Layout(); int x = 0; gfx::Size sz = menu_->GetPreferredSize(); menu_->SetBounds(x, (height() - sz.height()) / 2, sz.width(), sz.height()); x += sz.width() + kMenuHorizontalMargin; ExtensionView* view = delegate_->extension_host()->view(); view->SetBounds(x, 0, width() - x - kFarRightMargin - 1, height() - 1); } ",1 "static int gcm_hash_len(struct aead_request *req, struct crypto_gcm_req_priv_ctx *pctx) { struct ahash_request *ahreq = &pctx->u.ahreq; struct crypto_gcm_ghash_ctx *gctx = &pctx->ghash_ctx; u128 lengths; lengths.a = cpu_to_be64(req->assoclen * 8); lengths.b = cpu_to_be64(gctx->cryptlen * 8); memcpy(pctx->iauth_tag, &lengths, 16); sg_init_one(pctx->src, pctx->iauth_tag, 16); ahash_request_set_callback(ahreq, aead_request_flags(req), gcm_hash_len_done, req); ahash_request_set_crypt(ahreq, pctx->src, NULL, sizeof(lengths)); return crypto_ahash_update(ahreq); } ",0 "void MediaControlFullscreenButtonElement::defaultEventHandler(Event* event) { if (event->type() == EventTypeNames::click) { if (mediaElement().isFullscreen()) { Platform::current()->recordAction( UserMetricsAction(""Media.Controls.ExitFullscreen"")); mediaControls().exitFullscreen(); } else { Platform::current()->recordAction( UserMetricsAction(""Media.Controls.EnterFullscreen"")); mediaControls().enterFullscreen(); } event->setDefaultHandled(); } MediaControlInputElement::defaultEventHandler(event); } ",0 "void FileSystemOperation::DirectoryExists(const GURL& path_url, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationDirectoryExists)); base::PlatformFileError result = SetUpFileSystemPath( path_url, &src_path_, &src_util_, PATH_FOR_READ); if (result != base::PLATFORM_FILE_OK) { callback.Run(result); delete this; return; } FileSystemFileUtilProxy::GetFileInfo( &operation_context_, src_util_, src_path_, base::Bind(&FileSystemOperation::DidDirectoryExists, base::Owned(this), callback)); } ",0 "TransportDIB* TransportDIB::CreateWithHandle(Handle shmkey) { TransportDIB* dib = new TransportDIB; dib->key_.shmkey = shmkey; return dib; } ",0 "inline bool doFancyUpsampling() { return true; } ",0 "psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) { sf_count_t total = 0 ; ssize_t count ; if (psf->virtual_io) return psf->vio.read (ptr, bytes*items, psf->vio_user_data) / bytes ; items *= bytes ; /* Do this check after the multiplication above. */ if (items <= 0) return 0 ; while (items > 0) { /* Break the read down to a sensible size. */ count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ; count = read (psf->file.filedes, ((char*) ptr) + total, (size_t) count) ; if (count == -1) { if (errno == EINTR) continue ; psf_log_syserr (psf, errno) ; break ; } ; if (count == 0) break ; total += count ; items -= count ; } ; if (psf->is_pipe) psf->pipeoffset += total ; return total / bytes ; } /* psf_fread */ ",0 "static inline unsigned countGraphemesInCluster(const UChar* normalizedBuffer, unsigned normalizedBufferLength, uint16_t startIndex, uint16_t endIndex) { if (startIndex > endIndex) { uint16_t tempIndex = startIndex; startIndex = endIndex; endIndex = tempIndex; } uint16_t length = endIndex - startIndex; ASSERT(static_cast(startIndex + length) <= normalizedBufferLength); TextBreakIterator* cursorPosIterator = cursorMovementIterator(&normalizedBuffer[startIndex], length); int cursorPos = cursorPosIterator->current(); int numGraphemes = -1; while (0 <= cursorPos) { cursorPos = cursorPosIterator->next(); numGraphemes++; } return numGraphemes < 0 ? 0 : numGraphemes; } ",0 "pdf_load_hinted_page(fz_context *ctx, pdf_document *doc, int pagenum) { if (!doc->hints_loaded || !doc->linear_page_refs) return; if (doc->linear_page_refs[pagenum]) return; fz_try(ctx) { int num = doc->hint_page[pagenum].number; pdf_obj *page = pdf_load_object(ctx, doc, num); if (pdf_name_eq(ctx, PDF_NAME_Page, pdf_dict_get(ctx, page, PDF_NAME_Type))) { /* We have found the page object! */ DEBUGMESS((ctx, ""LoadHintedPage pagenum=%d num=%d"", pagenum, num)); doc->linear_page_refs[pagenum] = pdf_new_indirect(ctx, doc, num, 0); } pdf_drop_obj(ctx, page); } fz_catch(ctx) { fz_rethrow_if(ctx, FZ_ERROR_TRYLATER); /* Silently swallow the error and proceed as normal */ } } ",0 "SoapError(struct upnphttp * h, int errCode, const char * errDesc) { static const char resp[] = """" """" """" ""s:Client"" ""UPnPError"" """" """" ""%d"" ""%s"" """" """" """" """" """"; char body[2048]; int bodylen; syslog(LOG_INFO, ""Returning UPnPError %d: %s"", errCode, errDesc); bodylen = snprintf(body, sizeof(body), resp, errCode, errDesc); BuildResp2_upnphttp(h, 500, ""Internal Server Error"", body, bodylen); SendRespAndClose_upnphttp(h); } ",0 "void NTPResourceCache::CreateNewTabIncognitoCSS() { ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); DCHECK(tp); SkColor color_background = GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND); std::vector subst; subst.push_back( profile_->GetPrefs()->GetString(prefs::kCurrentThemeID)); // $1 subst.push_back(SkColorToRGBAString(color_background)); // $2 subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3 subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4 subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5 static const base::StringPiece new_tab_theme_css( ResourceBundle::GetSharedInstance().GetRawDataResource( IDR_NEW_INCOGNITO_TAB_THEME_CSS)); std::string full_css = ReplaceStringPlaceholders( new_tab_theme_css, subst, NULL); new_tab_incognito_css_ = base::RefCountedString::TakeString(&full_css); } ",0 "DownloadCoreServiceImpl::~DownloadCoreServiceImpl() {} ",0 "void PrintPreviewMessageHandler::OnInvalidPrinterSettings(int document_cookie) { StopWorker(document_cookie); PrintPreviewUI* print_preview_ui = GetPrintPreviewUI(); if (!print_preview_ui) return; print_preview_ui->OnInvalidPrinterSettings(); } ",0 "static int param_get_mode(char *buffer, struct kernel_param *kp) { if (!capable(CAP_MAC_ADMIN)) return -EPERM; if (!apparmor_enabled) return -EINVAL; return sprintf(buffer, ""%s"", profile_mode_names[aa_g_profile_mode]); } ",0 "void RenderFrameHostImpl::ExecuteJavaScriptWithUserGestureForTests( const base::string16& javascript) { Send(new FrameMsg_JavaScriptExecuteRequestForTests(routing_id_, javascript, 0, false, true)); } ",0 "cdf_read_short_sector(const cdf_stream_t *sst, void *buf, size_t offs, size_t len, const cdf_header_t *h, cdf_secid_t id) { size_t ss = CDF_SHORT_SEC_SIZE(h); size_t pos = CDF_SHORT_SEC_POS(h, id); assert(ss == len); if (pos > CDF_SEC_SIZE(h) * sst->sst_len) { DPRINTF((""Out of bounds read %"" SIZE_T_FORMAT ""u > %"" SIZE_T_FORMAT ""u\n"", pos, CDF_SEC_SIZE(h) * sst->sst_len)); return -1; } (void)memcpy(((char *)buf) + offs, ((const char *)sst->sst_tab) + pos, len); return len; } ",1 "static int key_seal(struct trusted_key_payload *p, struct trusted_key_options *o) { struct tpm_buf *tb; int ret; tb = kzalloc(sizeof *tb, GFP_KERNEL); if (!tb) return -ENOMEM; /* include migratable flag at end of sealed key */ p->key[p->key_len] = p->migratable; ret = tpm_seal(tb, o->keytype, o->keyhandle, o->keyauth, p->key, p->key_len + 1, p->blob, &p->blob_len, o->blobauth, o->pcrinfo, o->pcrinfo_len); if (ret < 0) pr_info(""trusted_key: srkseal failed (%d)\n"", ret); kfree(tb); return ret; } ",0 "virDomainGetDiskErrors(virDomainPtr dom, virDomainDiskErrorPtr errors, unsigned int maxerrors, unsigned int flags) { VIR_DOMAIN_DEBUG(dom, ""errors=%p, maxerrors=%u, flags=%x"", errors, maxerrors, flags); virResetLastError(); virCheckDomainReturn(dom, -1); if (maxerrors) virCheckNonNullArgGoto(errors, error); else virCheckNullArgGoto(errors, error); if (dom->conn->driver->domainGetDiskErrors) { int ret = dom->conn->driver->domainGetDiskErrors(dom, errors, maxerrors, flags); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(dom->conn); return -1; } ",0 "static int auth_context_match( git_http_auth_context **out, http_subtransport *t, bool (*scheme_match)(git_http_auth_scheme *scheme, void *data), void *data) { git_http_auth_scheme *scheme = NULL; git_http_auth_context *context = NULL, *c; size_t i; *out = NULL; for (i = 0; i < ARRAY_SIZE(auth_schemes); i++) { if (scheme_match(&auth_schemes[i], data)) { scheme = &auth_schemes[i]; break; } } if (!scheme) return 0; /* See if authentication has already started for this scheme */ git_vector_foreach(&t->auth_contexts, i, c) { if (c->type == scheme->type) { context = c; break; } } if (!context) { if (scheme->init_context(&context, &t->connection_data) < 0) return -1; else if (!context) return 0; else if (git_vector_insert(&t->auth_contexts, context) < 0) return -1; } *out = context; return 0; } ",0 "Response InspectorPageAgent::addScriptToEvaluateOnNewDocument( const String& source, String* identifier) { return addScriptToEvaluateOnLoad(source, identifier); } ",0 "sg_start_req(Sg_request *srp, unsigned char *cmd) { int res; struct request *rq; Sg_fd *sfp = srp->parentfp; sg_io_hdr_t *hp = &srp->header; int dxfer_len = (int) hp->dxfer_len; int dxfer_dir = hp->dxfer_direction; unsigned int iov_count = hp->iovec_count; Sg_scatter_hold *req_schp = &srp->data; Sg_scatter_hold *rsv_schp = &sfp->reserve; struct request_queue *q = sfp->parentdp->device->request_queue; struct rq_map_data *md, map_data; int rw = hp->dxfer_direction == SG_DXFER_TO_DEV ? WRITE : READ; unsigned char *long_cmdp = NULL; SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp, ""sg_start_req: dxfer_len=%d\n"", dxfer_len)); if (hp->cmd_len > BLK_MAX_CDB) { long_cmdp = kzalloc(hp->cmd_len, GFP_KERNEL); if (!long_cmdp) return -ENOMEM; } /* * NOTE * * With scsi-mq enabled, there are a fixed number of preallocated * requests equal in number to shost->can_queue. If all of the * preallocated requests are already in use, then using GFP_ATOMIC with * blk_get_request() will return -EWOULDBLOCK, whereas using GFP_KERNEL * will cause blk_get_request() to sleep until an active command * completes, freeing up a request. Neither option is ideal, but * GFP_KERNEL is the better choice to prevent userspace from getting an * unexpected EWOULDBLOCK. * * With scsi-mq disabled, blk_get_request() with GFP_KERNEL usually * does not sleep except under memory pressure. */ rq = blk_get_request(q, rw, GFP_KERNEL); if (IS_ERR(rq)) { kfree(long_cmdp); return PTR_ERR(rq); } blk_rq_set_block_pc(rq); if (hp->cmd_len > BLK_MAX_CDB) rq->cmd = long_cmdp; memcpy(rq->cmd, cmd, hp->cmd_len); rq->cmd_len = hp->cmd_len; srp->rq = rq; rq->end_io_data = srp; rq->sense = srp->sense_b; rq->retries = SG_DEFAULT_RETRIES; if ((dxfer_len <= 0) || (dxfer_dir == SG_DXFER_NONE)) return 0; if (sg_allow_dio && hp->flags & SG_FLAG_DIRECT_IO && dxfer_dir != SG_DXFER_UNKNOWN && !iov_count && !sfp->parentdp->device->host->unchecked_isa_dma && blk_rq_aligned(q, (unsigned long)hp->dxferp, dxfer_len)) md = NULL; else md = &map_data; if (md) { if (!sg_res_in_use(sfp) && dxfer_len <= rsv_schp->bufflen) sg_link_reserve(sfp, srp, dxfer_len); else { res = sg_build_indirect(req_schp, sfp, dxfer_len); if (res) return res; } md->pages = req_schp->pages; md->page_order = req_schp->page_order; md->nr_entries = req_schp->k_use_sg; md->offset = 0; md->null_mapped = hp->dxferp ? 0 : 1; if (dxfer_dir == SG_DXFER_TO_FROM_DEV) md->from_user = 1; else md->from_user = 0; } if (unlikely(iov_count > MAX_UIOVEC)) return -EINVAL; if (iov_count) { int size = sizeof(struct iovec) * iov_count; struct iovec *iov; struct iov_iter i; iov = memdup_user(hp->dxferp, size); if (IS_ERR(iov)) return PTR_ERR(iov); iov_iter_init(&i, rw, iov, iov_count, min_t(size_t, hp->dxfer_len, iov_length(iov, iov_count))); res = blk_rq_map_user_iov(q, rq, md, &i, GFP_ATOMIC); kfree(iov); } else res = blk_rq_map_user(q, rq, md, hp->dxferp, hp->dxfer_len, GFP_ATOMIC); if (!res) { srp->bio = rq->bio; if (!md) { req_schp->dio_in_use = 1; hp->info |= SG_INFO_DIRECT_IO; } } return res; } ",1 "read_mtree(struct archive_read *a, struct mtree *mtree) { ssize_t len; uintmax_t counter; char *p; struct mtree_option *global; struct mtree_entry *last_entry; int r, is_form_d; mtree->archive_format = ARCHIVE_FORMAT_MTREE; mtree->archive_format_name = ""mtree""; global = NULL; last_entry = NULL; (void)detect_form(a, &is_form_d); for (counter = 1; ; ++counter) { len = readline(a, mtree, &p, 65536); if (len == 0) { mtree->this_entry = mtree->entries; free_options(global); return (ARCHIVE_OK); } if (len < 0) { free_options(global); return ((int)len); } /* Leading whitespace is never significant, ignore it. */ while (*p == ' ' || *p == '\t') { ++p; --len; } /* Skip content lines and blank lines. */ if (*p == '#') continue; if (*p == '\r' || *p == '\n' || *p == '\0') continue; if (*p != '/') { r = process_add_entry(a, mtree, &global, p, len, &last_entry, is_form_d); } else if (strncmp(p, ""/set"", 4) == 0) { if (p[4] != ' ' && p[4] != '\t') break; r = process_global_set(a, &global, p); } else if (strncmp(p, ""/unset"", 6) == 0) { if (p[6] != ' ' && p[6] != '\t') break; r = process_global_unset(a, &global, p); } else break; if (r != ARCHIVE_OK) { free_options(global); return r; } } archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Can't parse line %ju"", counter); free_options(global); return (ARCHIVE_FATAL); } ",0 "void napi_complete_done(struct napi_struct *n, int work_done) { unsigned long flags; /* * don't let napi dequeue from the cpu poll list * just in case its running on a different cpu */ if (unlikely(test_bit(NAPI_STATE_NPSVC, &n->state))) return; if (n->gro_list) { unsigned long timeout = 0; if (work_done) timeout = n->dev->gro_flush_timeout; if (timeout) hrtimer_start(&n->timer, ns_to_ktime(timeout), HRTIMER_MODE_REL_PINNED); else napi_gro_flush(n, false); } if (likely(list_empty(&n->poll_list))) { WARN_ON_ONCE(!test_and_clear_bit(NAPI_STATE_SCHED, &n->state)); } else { /* If n->poll_list is not empty, we need to mask irqs */ local_irq_save(flags); __napi_complete(n); local_irq_restore(flags); } } ",0 "int posix_cpu_nsleep(const clockid_t which_clock, int flags, struct timespec *rqtp, struct timespec __user *rmtp) { struct restart_block *restart_block = ¤t_thread_info()->restart_block; struct itimerspec it; int error; /* * Diagnose required errors first. */ if (CPUCLOCK_PERTHREAD(which_clock) && (CPUCLOCK_PID(which_clock) == 0 || CPUCLOCK_PID(which_clock) == current->pid)) return -EINVAL; error = do_cpu_nanosleep(which_clock, flags, rqtp, &it); if (error == -ERESTART_RESTARTBLOCK) { if (flags & TIMER_ABSTIME) return -ERESTARTNOHAND; /* * Report back to the user the time still remaining. */ if (rmtp != NULL && copy_to_user(rmtp, &it.it_value, sizeof *rmtp)) return -EFAULT; restart_block->fn = posix_cpu_nsleep_restart; restart_block->arg0 = which_clock; restart_block->arg1 = (unsigned long) rmtp; restart_block->arg2 = rqtp->tv_sec; restart_block->arg3 = rqtp->tv_nsec; } return error; } ",0 "static int __start_delalloc_inodes(struct btrfs_root *root, int delay_iput, int nr) { struct btrfs_inode *binode; struct inode *inode; struct btrfs_delalloc_work *work, *next; struct list_head works; struct list_head splice; int ret = 0; INIT_LIST_HEAD(&works); INIT_LIST_HEAD(&splice); mutex_lock(&root->delalloc_mutex); spin_lock(&root->delalloc_lock); list_splice_init(&root->delalloc_inodes, &splice); while (!list_empty(&splice)) { binode = list_entry(splice.next, struct btrfs_inode, delalloc_inodes); list_move_tail(&binode->delalloc_inodes, &root->delalloc_inodes); inode = igrab(&binode->vfs_inode); if (!inode) { cond_resched_lock(&root->delalloc_lock); continue; } spin_unlock(&root->delalloc_lock); work = btrfs_alloc_delalloc_work(inode, 0, delay_iput); if (!work) { if (delay_iput) btrfs_add_delayed_iput(inode); else iput(inode); ret = -ENOMEM; goto out; } list_add_tail(&work->list, &works); btrfs_queue_work(root->fs_info->flush_workers, &work->work); ret++; if (nr != -1 && ret >= nr) goto out; cond_resched(); spin_lock(&root->delalloc_lock); } spin_unlock(&root->delalloc_lock); out: list_for_each_entry_safe(work, next, &works, list) { list_del_init(&work->list); btrfs_wait_and_free_delalloc_work(work); } if (!list_empty_careful(&splice)) { spin_lock(&root->delalloc_lock); list_splice_tail(&splice, &root->delalloc_inodes); spin_unlock(&root->delalloc_lock); } mutex_unlock(&root->delalloc_mutex); return ret; } ",0 "static void kvm_patch_vmm(struct kvm_vmm_info *vmm_info, struct module *module) { unsigned long new_ar, new_ar_sn2; unsigned long module_base; if (!ia64_platform_is(""sn2"")) return; module_base = (unsigned long)module->module_core; new_ar = kvm_vmm_base + vmm_info->patch_mov_ar - module_base; new_ar_sn2 = kvm_vmm_base + vmm_info->patch_mov_ar_sn2 - module_base; printk(KERN_INFO ""kvm: Patching ITC emulation to use SGI SN2 RTC "" ""as source\n""); /* * Copy the SN2 version of mov_ar into place. They are both * the same size, so 6 bundles is sufficient (6 * 0x10). */ memcpy((void *)new_ar, (void *)new_ar_sn2, 0x60); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoHint(GLenum target, GLenum mode) { api()->glHintFn(target, mode); return error::kNoError; } ",0 "static struct dcb_app_type *dcb_app_lookup(const struct dcb_app *app, int ifindex, int prio) { struct dcb_app_type *itr; list_for_each_entry(itr, &dcb_app_list, list) { if (itr->app.selector == app->selector && itr->app.protocol == app->protocol && itr->ifindex == ifindex && (!prio || itr->app.priority == prio)) return itr; } return NULL; } ",0 "void ClearPendingEmailOnIOThread(content::ResourceContext* context) { ProfileIOData* io_data = ProfileIOData::FromResourceContext(context); DCHECK(io_data); io_data->set_reverse_autologin_pending_email(std::string()); } ",0 " void RunSingleClientMigrationTest(const MigrationList& migration_list, TriggerMethod trigger_method) { if (!ShouldRunMigrationTest()) { return; } ASSERT_TRUE(SetupSync()); RunMigrationTest(migration_list, trigger_method); } ",0 "status_t Parcel::writeByteArray(size_t len, const uint8_t *val) { if (!val) { return writeAligned(-1); } status_t ret = writeAligned(len); if (ret == NO_ERROR) { ret = write(val, len * sizeof(*val)); } return ret; } ",0 "void InspectorClientImpl::clearBrowserCookies() { if (WebDevToolsAgentImpl* agent = devToolsAgent()) agent->clearBrowserCookies(); } ",1 "struct net *copy_net_ns(unsigned long flags, struct user_namespace *user_ns, struct net *old_net) { struct ucounts *ucounts; struct net *net; int rv; if (!(flags & CLONE_NEWNET)) return get_net(old_net); ucounts = inc_net_namespaces(user_ns); if (!ucounts) return ERR_PTR(-ENOSPC); net = net_alloc(); if (!net) { dec_net_namespaces(ucounts); return ERR_PTR(-ENOMEM); } get_user_ns(user_ns); rv = mutex_lock_killable(&net_mutex); if (rv < 0) { net_free(net); dec_net_namespaces(ucounts); put_user_ns(user_ns); return ERR_PTR(rv); } net->ucounts = ucounts; rv = setup_net(net, user_ns); if (rv == 0) { rtnl_lock(); list_add_tail_rcu(&net->list, &net_namespace_list); rtnl_unlock(); } mutex_unlock(&net_mutex); if (rv < 0) { dec_net_namespaces(ucounts); put_user_ns(user_ns); net_drop_ns(net); return ERR_PTR(rv); } return net; } ",0 "static EAS_RESULT Parse_insh (SDLS_SYNTHESIZER_DATA *pDLSData, EAS_I32 pos, EAS_U32 *pRgnCount, EAS_U32 *pLocale) { EAS_RESULT result; EAS_U32 bank; EAS_U32 program; /* seek to start of chunk */ if ((result = EAS_HWFileSeek(pDLSData->hwInstData, pDLSData->fileHandle, pos)) != EAS_SUCCESS) return result; /* get the region count and locale */ if ((result = EAS_HWGetDWord(pDLSData->hwInstData, pDLSData->fileHandle, pRgnCount, EAS_FALSE)) != EAS_SUCCESS) return result; if ((result = EAS_HWGetDWord(pDLSData->hwInstData, pDLSData->fileHandle, &bank, EAS_FALSE)) != EAS_SUCCESS) return result; if ((result = EAS_HWGetDWord(pDLSData->hwInstData, pDLSData->fileHandle, &program, EAS_FALSE)) != EAS_SUCCESS) return result; /* verify the parameters are valid */ if (bank & 0x7fff8080) { { /* dpp: EAS_ReportEx(_EAS_SEVERITY_WARNING, ""DLS bank number is out of range: %08lx\n"", bank); */ } bank &= 0xff7f; } if (program > 127) { { /* dpp: EAS_ReportEx(_EAS_SEVERITY_WARNING, ""DLS program number is out of range: %08lx\n"", program); */ } program &= 0x7f; } /* save the program number */ *pLocale = (bank << 8) | program; return EAS_SUCCESS; } ",0 "static void nlm_put_lockowner(struct nlm_lockowner *lockowner) { if (!atomic_dec_and_lock(&lockowner->count, &lockowner->host->h_lock)) return; list_del(&lockowner->list); spin_unlock(&lockowner->host->h_lock); nlmclnt_release_host(lockowner->host); kfree(lockowner); } ",0 "OMX_ERRORTYPE omx_vdec::use_output_buffer( OMX_IN OMX_HANDLETYPE hComp, OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr, OMX_IN OMX_U32 port, OMX_IN OMX_PTR appData, OMX_IN OMX_U32 bytes, OMX_IN OMX_U8* buffer) { OMX_ERRORTYPE eRet = OMX_ErrorNone; OMX_BUFFERHEADERTYPE *bufHdr= NULL; // buffer header unsigned i= 0; // Temporary counter struct vdec_setbuffer_cmd setbuffers; OMX_PTR privateAppData = NULL; private_handle_t *handle = NULL; OMX_U8 *buff = buffer; struct v4l2_buffer buf; struct v4l2_plane plane[VIDEO_MAX_PLANES]; int extra_idx = 0; (void) hComp; (void) port; if (!m_out_mem_ptr) { DEBUG_PRINT_HIGH(""Use_op_buf:Allocating output headers""); eRet = allocate_output_headers(); if (eRet == OMX_ErrorNone) eRet = allocate_extradata(); } if (eRet == OMX_ErrorNone) { for (i=0; i< drv_ctx.op_buf.actualcount; i++) { if (BITMASK_ABSENT(&m_out_bm_count,i)) { break; } } } if (i >= drv_ctx.op_buf.actualcount) { DEBUG_PRINT_ERROR(""Already using %d o/p buffers"", drv_ctx.op_buf.actualcount); eRet = OMX_ErrorInsufficientResources; } if (eRet != OMX_ErrorNone) return eRet; if (dynamic_buf_mode) { *bufferHdr = (m_out_mem_ptr + i ); (*bufferHdr)->pBuffer = NULL; if (i == (drv_ctx.op_buf.actualcount -1) && !streaming[CAPTURE_PORT]) { enum v4l2_buf_type buf_type; int rr = 0; buf_type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; if (rr = ioctl(drv_ctx.video_driver_fd, VIDIOC_STREAMON,&buf_type)) { DEBUG_PRINT_ERROR("" STREAMON FAILED : %d"",rr); return OMX_ErrorInsufficientResources; } else { streaming[CAPTURE_PORT] = true; DEBUG_PRINT_LOW(""STREAMON Successful""); } } BITMASK_SET(&m_out_bm_count,i); (*bufferHdr)->pAppPrivate = appData; (*bufferHdr)->pBuffer = buffer; (*bufferHdr)->nAllocLen = sizeof(struct VideoDecoderOutputMetaData); return eRet; } if (eRet == OMX_ErrorNone) { #if defined(_ANDROID_HONEYCOMB_) || defined(_ANDROID_ICS_) if (m_enable_android_native_buffers) { if (m_use_android_native_buffers) { UseAndroidNativeBufferParams *params = (UseAndroidNativeBufferParams *)appData; sp nBuf = params->nativeBuffer; handle = (private_handle_t *)nBuf->handle; privateAppData = params->pAppPrivate; } else { handle = (private_handle_t *)buff; privateAppData = appData; } if (!handle) { DEBUG_PRINT_ERROR(""handle is invalid""); return OMX_ErrorBadParameter; } if ((OMX_U32)handle->size < drv_ctx.op_buf.buffer_size) { if (secure_mode && secure_scaling_to_non_secure_opb) { DEBUG_PRINT_HIGH(""Buffer size expected %u, got %u, but it's ok since we will never map it"", (unsigned int)drv_ctx.op_buf.buffer_size, (unsigned int)handle->size); } else { DEBUG_PRINT_ERROR(""Insufficient sized buffer given for playback,"" "" expected %u, got %u"", (unsigned int)drv_ctx.op_buf.buffer_size, (unsigned int)handle->size); return OMX_ErrorBadParameter; } } drv_ctx.op_buf.buffer_size = handle->size; if (!m_use_android_native_buffers) { if (!secure_mode) { buff = (OMX_U8*)mmap(0, handle->size, PROT_READ|PROT_WRITE, MAP_SHARED, handle->fd, 0); if (buff == MAP_FAILED) { DEBUG_PRINT_ERROR(""Failed to mmap pmem with fd = %d, size = %d"", handle->fd, handle->size); return OMX_ErrorInsufficientResources; } } } #if defined(_ANDROID_ICS_) native_buffer[i].nativehandle = handle; native_buffer[i].privatehandle = handle; #endif if (!handle) { DEBUG_PRINT_ERROR(""Native Buffer handle is NULL""); return OMX_ErrorBadParameter; } drv_ctx.ptr_outputbuffer[i].pmem_fd = handle->fd; drv_ctx.ptr_outputbuffer[i].offset = 0; drv_ctx.ptr_outputbuffer[i].bufferaddr = buff; drv_ctx.ptr_outputbuffer[i].buffer_len = drv_ctx.op_buf.buffer_size; drv_ctx.ptr_outputbuffer[i].mmaped_size = handle->size; } else #endif if (!ouput_egl_buffers && !m_use_output_pmem) { #ifdef USE_ION drv_ctx.op_buf_ion_info[i].ion_device_fd = alloc_map_ion_memory( drv_ctx.op_buf.buffer_size,drv_ctx.op_buf.alignment, &drv_ctx.op_buf_ion_info[i].ion_alloc_data, &drv_ctx.op_buf_ion_info[i].fd_ion_data, secure_mode ? ION_SECURE : 0); if (drv_ctx.op_buf_ion_info[i].ion_device_fd < 0) { DEBUG_PRINT_ERROR(""ION device fd is bad %d"", drv_ctx.op_buf_ion_info[i].ion_device_fd); return OMX_ErrorInsufficientResources; } drv_ctx.ptr_outputbuffer[i].pmem_fd = \ drv_ctx.op_buf_ion_info[i].fd_ion_data.fd; #else drv_ctx.ptr_outputbuffer[i].pmem_fd = \ open (MEM_DEVICE,O_RDWR); if (drv_ctx.ptr_outputbuffer[i].pmem_fd < 0) { DEBUG_PRINT_ERROR(""ION/pmem buffer fd is bad %d"", drv_ctx.ptr_outputbuffer[i].pmem_fd); return OMX_ErrorInsufficientResources; } /* FIXME: why is this code even here? We already open MEM_DEVICE a few lines above */ if (drv_ctx.ptr_outputbuffer[i].pmem_fd == 0) { drv_ctx.ptr_outputbuffer[i].pmem_fd = \ open (MEM_DEVICE,O_RDWR); if (drv_ctx.ptr_outputbuffer[i].pmem_fd < 0) { DEBUG_PRINT_ERROR(""ION/pmem buffer fd is bad %d"", drv_ctx.ptr_outputbuffer[i].pmem_fd); return OMX_ErrorInsufficientResources; } } if (!align_pmem_buffers(drv_ctx.ptr_outputbuffer[i].pmem_fd, drv_ctx.op_buf.buffer_size, drv_ctx.op_buf.alignment)) { DEBUG_PRINT_ERROR(""align_pmem_buffers() failed""); close(drv_ctx.ptr_outputbuffer[i].pmem_fd); return OMX_ErrorInsufficientResources; } #endif if (!secure_mode) { drv_ctx.ptr_outputbuffer[i].bufferaddr = (unsigned char *)mmap(NULL, drv_ctx.op_buf.buffer_size, PROT_READ|PROT_WRITE, MAP_SHARED, drv_ctx.ptr_outputbuffer[i].pmem_fd,0); if (drv_ctx.ptr_outputbuffer[i].bufferaddr == MAP_FAILED) { close(drv_ctx.ptr_outputbuffer[i].pmem_fd); #ifdef USE_ION free_ion_memory(&drv_ctx.op_buf_ion_info[i]); #endif DEBUG_PRINT_ERROR(""Unable to mmap output buffer""); return OMX_ErrorInsufficientResources; } } drv_ctx.ptr_outputbuffer[i].offset = 0; privateAppData = appData; } else { DEBUG_PRINT_LOW(""Use_op_buf: out_pmem=%d"",m_use_output_pmem); if (!appData || !bytes ) { if (!secure_mode && !buffer) { DEBUG_PRINT_ERROR(""Bad parameters for use buffer in EGL image case""); return OMX_ErrorBadParameter; } } OMX_QCOM_PLATFORM_PRIVATE_LIST *pmem_list; OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *pmem_info; pmem_list = (OMX_QCOM_PLATFORM_PRIVATE_LIST*) appData; if (!pmem_list || !pmem_list->entryList || !pmem_list->entryList->entry || !pmem_list->nEntries || pmem_list->entryList->type != OMX_QCOM_PLATFORM_PRIVATE_PMEM) { DEBUG_PRINT_ERROR(""Pmem info not valid in use buffer""); return OMX_ErrorBadParameter; } pmem_info = (OMX_QCOM_PLATFORM_PRIVATE_PMEM_INFO *) pmem_list->entryList->entry; DEBUG_PRINT_LOW(""vdec: use buf: pmem_fd=0x%lx"", pmem_info->pmem_fd); drv_ctx.ptr_outputbuffer[i].pmem_fd = pmem_info->pmem_fd; drv_ctx.ptr_outputbuffer[i].offset = pmem_info->offset; drv_ctx.ptr_outputbuffer[i].bufferaddr = buff; drv_ctx.ptr_outputbuffer[i].mmaped_size = drv_ctx.ptr_outputbuffer[i].buffer_len = drv_ctx.op_buf.buffer_size; privateAppData = appData; } m_pmem_info[i].offset = drv_ctx.ptr_outputbuffer[i].offset; m_pmem_info[i].pmem_fd = drv_ctx.ptr_outputbuffer[i].pmem_fd; m_pmem_info[i].size = drv_ctx.ptr_outputbuffer[i].buffer_len; m_pmem_info[i].mapped_size = drv_ctx.ptr_outputbuffer[i].mmaped_size; m_pmem_info[i].buffer = drv_ctx.ptr_outputbuffer[i].bufferaddr; *bufferHdr = (m_out_mem_ptr + i ); if (secure_mode) drv_ctx.ptr_outputbuffer[i].bufferaddr = *bufferHdr; memcpy (&setbuffers.buffer,&drv_ctx.ptr_outputbuffer[i], sizeof (vdec_bufferpayload)); DEBUG_PRINT_HIGH(""Set the Output Buffer Idx: %d Addr: %p, pmem_fd=0x%x"", i, drv_ctx.ptr_outputbuffer[i].bufferaddr, drv_ctx.ptr_outputbuffer[i].pmem_fd ); buf.index = i; buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; buf.memory = V4L2_MEMORY_USERPTR; plane[0].length = drv_ctx.op_buf.buffer_size; plane[0].m.userptr = (unsigned long)drv_ctx.ptr_outputbuffer[i].bufferaddr - (unsigned long)drv_ctx.ptr_outputbuffer[i].offset; plane[0].reserved[0] = drv_ctx.ptr_outputbuffer[i].pmem_fd; plane[0].reserved[1] = drv_ctx.ptr_outputbuffer[i].offset; plane[0].data_offset = 0; extra_idx = EXTRADATA_IDX(drv_ctx.num_planes); if (extra_idx && (extra_idx < VIDEO_MAX_PLANES)) { plane[extra_idx].length = drv_ctx.extradata_info.buffer_size; plane[extra_idx].m.userptr = (long unsigned int) (drv_ctx.extradata_info.uaddr + i * drv_ctx.extradata_info.buffer_size); #ifdef USE_ION plane[extra_idx].reserved[0] = drv_ctx.extradata_info.ion.fd_ion_data.fd; #endif plane[extra_idx].reserved[1] = i * drv_ctx.extradata_info.buffer_size; plane[extra_idx].data_offset = 0; } else if (extra_idx >= VIDEO_MAX_PLANES) { DEBUG_PRINT_ERROR(""Extradata index is more than allowed: %d"", extra_idx); return OMX_ErrorBadParameter; } buf.m.planes = plane; buf.length = drv_ctx.num_planes; if (ioctl(drv_ctx.video_driver_fd, VIDIOC_PREPARE_BUF, &buf)) { DEBUG_PRINT_ERROR(""Failed to prepare bufs""); /*TODO: How to handle this case */ return OMX_ErrorInsufficientResources; } if (i == (drv_ctx.op_buf.actualcount -1) && !streaming[CAPTURE_PORT]) { enum v4l2_buf_type buf_type; buf_type=V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; if (ioctl(drv_ctx.video_driver_fd, VIDIOC_STREAMON,&buf_type)) { return OMX_ErrorInsufficientResources; } else { streaming[CAPTURE_PORT] = true; DEBUG_PRINT_LOW(""STREAMON Successful""); } } (*bufferHdr)->nAllocLen = drv_ctx.op_buf.buffer_size; if (m_enable_android_native_buffers) { DEBUG_PRINT_LOW(""setting pBuffer to private_handle_t %p"", handle); (*bufferHdr)->pBuffer = (OMX_U8 *)handle; } else { (*bufferHdr)->pBuffer = buff; } (*bufferHdr)->pAppPrivate = privateAppData; BITMASK_SET(&m_out_bm_count,i); } return eRet; } ",0 "void UrlFetcher::Core::Start(const UrlFetcher::DoneCallback& done_callback) { done_callback_ = done_callback; network_task_runner_ = request_context_getter_->GetNetworkTaskRunner(); DCHECK(network_task_runner_); network_task_runner_->PostTask(FROM_HERE, base::Bind( &UrlFetcher::Core::DoStart, this)); } ",0 "void PrintWebViewHelper::OnPrintPreview(const DictionaryValue& settings) { DCHECK(is_preview_enabled_); print_preview_context_.OnPrintPreview(); if (!UpdatePrintSettings(print_preview_context_.frame(), print_preview_context_.node(), settings, false)) { if (print_preview_context_.last_error() != PREVIEW_ERROR_BAD_SETTING) { Send(new PrintHostMsg_PrintPreviewInvalidPrinterSettings( routing_id(), print_pages_params_->params.document_cookie)); notify_browser_of_print_failure_ = false; // Already sent. } DidFinishPrinting(FAIL_PREVIEW); return; } if (!print_pages_params_->params.is_first_request && old_print_pages_params_.get() && PrintMsg_Print_Params_IsEqual(*old_print_pages_params_, *print_pages_params_)) { PrintHostMsg_DidPreviewDocument_Params preview_params; preview_params.reuse_existing_data = true; preview_params.data_size = 0; preview_params.document_cookie = print_pages_params_->params.document_cookie; preview_params.expected_pages_count = print_preview_context_.total_page_count(); preview_params.modifiable = print_preview_context_.IsModifiable(); preview_params.preview_request_id = print_pages_params_->params.preview_request_id; Send(new PrintHostMsg_MetafileReadyForPrinting(routing_id(), preview_params)); return; } old_print_pages_params_.reset(); is_print_ready_metafile_sent_ = false; print_pages_params_->params.supports_alpha_blend = true; bool generate_draft_pages = false; if (!settings.GetBoolean(printing::kSettingGenerateDraftData, &generate_draft_pages)) { NOTREACHED(); } print_preview_context_.set_generate_draft_pages(generate_draft_pages); if (CreatePreviewDocument()) { DidFinishPrinting(OK); } else { if (notify_browser_of_print_failure_) LOG(ERROR) << ""CreatePreviewDocument failed""; DidFinishPrinting(FAIL_PREVIEW); } } ",0 " void WaitForCopySourceReady() { while (!GetRenderWidgetHostViewPort()->IsSurfaceAvailableForCopy()) GiveItSomeTime(); } ",0 "const char* TabStrip::GetClassName() const { return kViewClassName; } ",0 "GF_Box *rvcc_New() { ISOM_DECL_BOX_ALLOC(GF_RVCConfigurationBox, GF_ISOM_BOX_TYPE_RVCC); return (GF_Box *)tmp; } ",0 "void ff_amf_write_bool(uint8_t **dst, int val) { bytestream_put_byte(dst, AMF_DATA_TYPE_BOOL); bytestream_put_byte(dst, val); } ",0 "mISDN_sock_create(struct net *net, struct socket *sock, int proto, int kern) { int err = -EPROTONOSUPPORT; switch (proto) { case ISDN_P_BASE: err = base_sock_create(net, sock, proto); break; case ISDN_P_TE_S0: case ISDN_P_NT_S0: case ISDN_P_TE_E1: case ISDN_P_NT_E1: case ISDN_P_LAPD_TE: case ISDN_P_LAPD_NT: case ISDN_P_B_RAW: case ISDN_P_B_HDLC: case ISDN_P_B_X75SLP: case ISDN_P_B_L2DTMF: case ISDN_P_B_L2DSP: case ISDN_P_B_L2DSPHDLC: err = data_sock_create(net, sock, proto); break; default: return err; } return err; } ",0 "void RenderViewHostImpl::NotifyMoveOrResizeStarted() { Send(new ViewMsg_MoveOrResizeStarted(GetRoutingID())); } ",0 "void Job::OnDnsOperationComplete(int result) { CheckIsOnOriginThread(); DCHECK(!cancelled_.IsSet()); DCHECK(pending_dns_completed_synchronously_ == (pending_dns_ == NULL)); SaveDnsToLocalCache(pending_dns_host_, pending_dns_op_, result, pending_dns_addresses_); pending_dns_ = NULL; if (blocking_dns_) { event_.Signal(); return; } if (!blocking_dns_ && !pending_dns_completed_synchronously_) { worker_task_runner()->PostTask(FROM_HERE, base::Bind(&Job::ExecuteNonBlocking, this)); } } ",0 "static mif_hdr_t *mif_hdr_create(int maxcmpts) { mif_hdr_t *hdr; if (!(hdr = jas_malloc(sizeof(mif_hdr_t)))) { return 0; } hdr->numcmpts = 0; hdr->maxcmpts = 0; hdr->cmpts = 0; if (mif_hdr_growcmpts(hdr, maxcmpts)) { mif_hdr_destroy(hdr); return 0; } return hdr; } ",0 "int RenderBox::scrollHeight() const { if (hasOverflowClip()) return layer()->scrollHeight(); return max(clientHeight(), maxYLayoutOverflow() - borderTop()); } ",0 "TimeDomain* RendererSchedulerImpl::GetActiveTimeDomain() { if (main_thread_only().use_virtual_time) { return GetVirtualTimeDomain(); } else { return real_time_domain(); } } ",0 "cifs_push_posix_locks(struct cifsFileInfo *cfile) { struct inode *inode = cfile->dentry->d_inode; struct cifs_tcon *tcon = tlink_tcon(cfile->tlink); struct file_lock *flock, **before; unsigned int count = 0, i = 0; int rc = 0, xid, type; struct list_head locks_to_send, *el; struct lock_to_push *lck, *tmp; __u64 length; xid = get_xid(); spin_lock(&inode->i_lock); cifs_for_each_lock(inode, before) { if ((*before)->fl_flags & FL_POSIX) count++; } spin_unlock(&inode->i_lock); INIT_LIST_HEAD(&locks_to_send); /* * Allocating count locks is enough because no FL_POSIX locks can be * added to the list while we are holding cinode->lock_sem that * protects locking operations of this inode. */ for (; i < count; i++) { lck = kmalloc(sizeof(struct lock_to_push), GFP_KERNEL); if (!lck) { rc = -ENOMEM; goto err_out; } list_add_tail(&lck->llist, &locks_to_send); } el = locks_to_send.next; spin_lock(&inode->i_lock); cifs_for_each_lock(inode, before) { flock = *before; if ((flock->fl_flags & FL_POSIX) == 0) continue; if (el == &locks_to_send) { /* * The list ended. We don't have enough allocated * structures - something is really wrong. */ cifs_dbg(VFS, ""Can't push all brlocks!\n""); break; } length = 1 + flock->fl_end - flock->fl_start; if (flock->fl_type == F_RDLCK || flock->fl_type == F_SHLCK) type = CIFS_RDLCK; else type = CIFS_WRLCK; lck = list_entry(el, struct lock_to_push, llist); lck->pid = flock->fl_pid; lck->netfid = cfile->fid.netfid; lck->length = length; lck->type = type; lck->offset = flock->fl_start; el = el->next; } spin_unlock(&inode->i_lock); list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) { int stored_rc; stored_rc = CIFSSMBPosixLock(xid, tcon, lck->netfid, lck->pid, lck->offset, lck->length, NULL, lck->type, 0); if (stored_rc) rc = stored_rc; list_del(&lck->llist); kfree(lck); } out: free_xid(xid); return rc; err_out: list_for_each_entry_safe(lck, tmp, &locks_to_send, llist) { list_del(&lck->llist); kfree(lck); } goto out; } ",0 " SearchProviderTest() : default_t_url_(NULL), term1_(UTF8ToUTF16(""term1"")), keyword_t_url_(NULL), keyword_term_(UTF8ToUTF16(""keyword"")), io_thread_(ChromeThread::IO), quit_when_done_(false) { io_thread_.Start(); } ",0 "SecurityOrigin* BlobOriginCache::cachedOrigin(const KURL& url) { if (url.protocolIs(""blob"")) return originMap()->get(url.string()); return 0; } ",0 "static void ImportCMYKQuantum(const Image *image,QuantumInfo *quantum_info, const MagickSizeType number_pixels,const unsigned char *magick_restrict p, Quantum *magick_restrict q,ExceptionInfo *exception) { QuantumAny range; register ssize_t x; unsigned int pixel; if (image->colorspace != CMYKColorspace) { (void) ThrowMagickException(exception,GetMagickModule(),ImageError, ""ColorSeparatedImageRequired"",""`%s'"",image->filename); return; } switch (quantum_info->depth) { case 8: { unsigned char pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushCharPixel(p,&pixel); SetPixelRed(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelGreen(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelBlue(image,ScaleCharToQuantum(pixel),q); p=PushCharPixel(p,&pixel); SetPixelBlack(image,ScaleCharToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 16: { unsigned short pixel; if (quantum_info->format == FloatingPointQuantumFormat) { for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlack(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ScaleShortToQuantum(pixel),q); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelBlack(image,ScaleShortToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 32: { unsigned int pixel; if (quantum_info->format == FloatingPointQuantumFormat) { float pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushFloatPixel(quantum_info,p,&pixel); SetPixelRed(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelGreen(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelBlue(image,ClampToQuantum(pixel),q); p=PushFloatPixel(quantum_info,p,&pixel); SetPixelBlack(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelRed(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelGreen(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelBlue(image,ScaleLongToQuantum(pixel),q); p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelBlack(image,ScaleLongToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 64: { if (quantum_info->format == FloatingPointQuantumFormat) { double pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushDoublePixel(quantum_info,p,&pixel); SetPixelRed(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelGreen(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelBlue(image,ClampToQuantum(pixel),q); p=PushDoublePixel(quantum_info,p,&pixel); SetPixelBlack(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } } default: { range=GetQuantumRange(quantum_info->depth); for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelRed(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGreen(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelBlue(image,ScaleAnyToQuantum(pixel,range),q); p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelBlack(image,ScaleAnyToQuantum(pixel,range),q); q+=GetPixelChannels(image); } break; } } } ",0 "void Browser::TabDeactivated(TabContents* contents) { fullscreen_controller_->OnTabDeactivated(contents); search_delegate_->OnTabDeactivated(contents->web_contents()); window_->GetLocationBar()->SaveStateToContents(contents->web_contents()); } ",0 " AudioTrack::AudioTrack(Segment* pSegment, long long element_start, long long element_size) : Track(pSegment, element_start, element_size) {} ",0 "int EventFlagsFromXState(unsigned int state) { return (state & LockMask ? ui::EF_CAPS_LOCK_DOWN : 0) | (state & ControlMask ? ui::EF_CONTROL_DOWN : 0) | (state & ShiftMask ? ui::EF_SHIFT_DOWN : 0) | (state & Mod1Mask ? ui::EF_ALT_DOWN : 0) | (state & Button1Mask ? ui::EF_LEFT_MOUSE_BUTTON : 0) | (state & Button2Mask ? ui::EF_MIDDLE_MOUSE_BUTTON : 0) | (state & Button3Mask ? ui::EF_RIGHT_MOUSE_BUTTON : 0); } ",0 "long AudioTrack::Parse(Segment* pSegment, const Info& info, long long element_start, long long element_size, AudioTrack*& pResult) { if (pResult) return -1; if (info.type != Track::kAudio) return -1; IMkvReader* const pReader = pSegment->m_pReader; const Settings& s = info.settings; assert(s.start >= 0); assert(s.size >= 0); long long pos = s.start; assert(pos >= 0); const long long stop = pos + s.size; double rate = 8000.0; // MKV default long long channels = 1; long long bit_depth = 0; while (pos < stop) { long long id, size; long status = ParseElementHeader(pReader, pos, stop, id, size); if (status < 0) // error return status; if (id == 0x35) { // Sample Rate status = UnserializeFloat(pReader, pos, size, rate); if (status < 0) return status; if (rate <= 0) return E_FILE_FORMAT_INVALID; } else if (id == 0x1F) { // Channel Count channels = UnserializeUInt(pReader, pos, size); if (channels <= 0) return E_FILE_FORMAT_INVALID; } else if (id == 0x2264) { // Bit Depth bit_depth = UnserializeUInt(pReader, pos, size); if (bit_depth <= 0) return E_FILE_FORMAT_INVALID; } pos += size; // consume payload if (pos > stop) return E_FILE_FORMAT_INVALID; } if (pos != stop) return E_FILE_FORMAT_INVALID; AudioTrack* const pTrack = new (std::nothrow) AudioTrack(pSegment, element_start, element_size); if (pTrack == NULL) return -1; // generic error const int status = info.Copy(pTrack->m_info); if (status) { delete pTrack; return status; } pTrack->m_rate = rate; pTrack->m_channels = channels; pTrack->m_bitDepth = bit_depth; pResult = pTrack; return 0; // success } ",0 "bool PanelBrowserView::CanResize() const { return true; } ",0 "void LoadInfoUpdateCallback(const LoadInfoMap& info_map) { LoadInfoMap::const_iterator i; for (i = info_map.begin(); i != info_map.end(); ++i) { RenderViewHostImpl* view = RenderViewHostImpl::FromID(i->first.first, i->first.second); if (view) // The view could be gone at this point. view->LoadStateChanged(i->second.url, i->second.load_state, i->second.upload_position, i->second.upload_size); } } ",0 "static int adf_ctl_is_device_in_use(int id) { struct list_head *itr, *head = adf_devmgr_get_head(); list_for_each(itr, head) { struct adf_accel_dev *dev = list_entry(itr, struct adf_accel_dev, list); if (id == dev->accel_id || id == ADF_CFG_ALL_DEVICES) { if (adf_devmgr_in_reset(dev) || adf_dev_in_use(dev)) { pr_info(""QAT: device qat_dev%d is busy\n"", dev->accel_id); return -EBUSY; } } } return 0; } ",0 "static void snd_usbmidi_emagic_init_out(struct snd_usb_midi_out_endpoint *ep) { static const u8 init_data[] = { /* initialization magic: ""get version"" */ 0xf0, 0x00, 0x20, 0x31, /* Emagic */ 0x64, /* Unitor8 */ 0x0b, /* version number request */ 0x00, /* command version */ 0x00, /* EEPROM, box 0 */ 0xf7 }; send_bulk_static_data(ep, init_data, sizeof(init_data)); /* while we're at it, pour on more magic */ send_bulk_static_data(ep, init_data, sizeof(init_data)); } ",0 "UNCURL_EXPORT int8_t uncurl_check_header(struct uncurl_conn *ucc, char *name, char *subval) { int32_t e; char *val = NULL; e = uncurl_get_header_str(ucc, name, &val); if (e == UNCURL_OK && strstr(http_lc(val), subval)) return 1; return 0; } ",0 " void PaymentRequest::NoUpdatedPaymentDetails() { spec_->RecomputeSpecForDetails(); } ",1 "static void doubleAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValue(info, imp->doubleAttribute()); } ",0 "static int dvb_usbv2_remote_exit(struct dvb_usb_device *d) { dev_dbg(&d->udev->dev, ""%s:\n"", __func__); if (d->rc_dev) { cancel_delayed_work_sync(&d->rc_query_work); rc_unregister_device(d->rc_dev); d->rc_dev = NULL; } return 0; } ",0 "void gdImageWebpEx (gdImagePtr im, FILE * outFile, int quantization) { gdIOCtx *out = gdNewFileCtx(outFile); gdImageWebpCtx(im, out, quantization); out->gd_free(out); } ",0 "XML_SetDoctypeDeclHandler(XML_Parser parser, XML_StartDoctypeDeclHandler start, XML_EndDoctypeDeclHandler end) { if (parser == NULL) return; parser->m_startDoctypeDeclHandler = start; parser->m_endDoctypeDeclHandler = end; } ",0 "static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct crypto_sparc64_aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; int err; blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; ctx->ops->load_encrypt_keys(&ctx->key[0]); while ((nbytes = walk.nbytes)) { unsigned int block_len = nbytes & AES_BLOCK_MASK; if (likely(block_len)) { ctx->ops->ecb_encrypt(&ctx->key[0], (const u64 *)walk.src.virt.addr, (u64 *) walk.dst.virt.addr, block_len); } nbytes &= AES_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } fprs_write(0); return err; } ",0 "ALWAYS_INLINE void WebFrame::traceFramesImpl(VisitorDispatcher visitor, WebFrame* frame) { DCHECK(frame); traceFrame(visitor, frame->m_parent); for (WebFrame* child = frame->firstChild(); child; child = child->nextSibling()) traceFrame(visitor, child); frame->m_openedFrameTracker->traceFrames(visitor); } ",0 "static int get_moov_size(AVFormatContext *s) { int ret; AVIOContext *moov_buf; MOVMuxContext *mov = s->priv_data; if ((ret = ffio_open_null_buf(&moov_buf)) < 0) return ret; if ((ret = mov_write_moov_tag(moov_buf, mov, s)) < 0) return ret; return ffio_close_null_buf(moov_buf); } ",0 "inline bool colorSpaceHasAlpha(J_COLOR_SPACE) { return false; } ",0 "static void *mergeable_ctx_to_buf_address(unsigned long mrg_ctx) { return (void *)(mrg_ctx & -MERGEABLE_BUFFER_ALIGN); } ",0 "int dev_change_net_namespace(struct net_device *dev, struct net *net, const char *pat) { int err; ASSERT_RTNL(); /* Don't allow namespace local devices to be moved. */ err = -EINVAL; if (dev->features & NETIF_F_NETNS_LOCAL) goto out; /* Ensure the device has been registrered */ if (dev->reg_state != NETREG_REGISTERED) goto out; /* Get out if there is nothing todo */ err = 0; if (net_eq(dev_net(dev), net)) goto out; /* Pick the destination device name, and ensure * we can use it in the destination network namespace. */ err = -EEXIST; if (__dev_get_by_name(net, dev->name)) { /* We get here if we can't use the current device name */ if (!pat) goto out; if (dev_get_valid_name(net, dev, pat) < 0) goto out; } /* * And now a mini version of register_netdevice unregister_netdevice. */ /* If device is running close it first. */ dev_close(dev); /* And unlink it from device chain */ err = -ENODEV; unlist_netdevice(dev); synchronize_net(); /* Shutdown queueing discipline. */ dev_shutdown(dev); /* Notify protocols, that we are about to destroy this device. They should clean all the things. Note that dev->reg_state stays at NETREG_REGISTERED. This is wanted because this way 8021q and macvlan know the device is just moving and can keep their slaves up. */ call_netdevice_notifiers(NETDEV_UNREGISTER, dev); rcu_barrier(); call_netdevice_notifiers(NETDEV_UNREGISTER_FINAL, dev); rtmsg_ifinfo(RTM_DELLINK, dev, ~0U, GFP_KERNEL); /* * Flush the unicast and multicast chains */ dev_uc_flush(dev); dev_mc_flush(dev); /* Send a netdev-removed uevent to the old namespace */ kobject_uevent(&dev->dev.kobj, KOBJ_REMOVE); netdev_adjacent_del_links(dev); /* Actually switch the network namespace */ dev_net_set(dev, net); /* If there is an ifindex conflict assign a new one */ if (__dev_get_by_index(net, dev->ifindex)) dev->ifindex = dev_new_index(net); /* Send a netdev-add uevent to the new namespace */ kobject_uevent(&dev->dev.kobj, KOBJ_ADD); netdev_adjacent_add_links(dev); /* Fixup kobjects */ err = device_rename(&dev->dev, dev->name); WARN_ON(err); /* Add the device back in the hashes */ list_netdevice(dev); /* Notify protocols, that a new device appeared. */ call_netdevice_notifiers(NETDEV_REGISTER, dev); /* * Prevent userspace races by waiting until the network * device is fully setup before sending notifications. */ rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U, GFP_KERNEL); synchronize_net(); err = 0; out: return err; } ",0 "int ptrace_setxregs(struct task_struct *child, void __user *uregs) { struct thread_info *ti = task_thread_info(child); struct pt_regs *regs = task_pt_regs(child); elf_xtregs_t *xtregs = uregs; int ret = 0; #if XTENSA_HAVE_COPROCESSORS /* Flush all coprocessors before we overwrite them. */ coprocessor_flush_all(ti); coprocessor_release_all(ti); ret |= __copy_from_user(&ti->xtregs_cp, &xtregs->cp0, sizeof(xtregs_coprocessor_t)); #endif ret |= __copy_from_user(®s->xtregs_opt, &xtregs->opt, sizeof(xtregs->opt)); ret |= __copy_from_user(&ti->xtregs_user, &xtregs->user, sizeof(xtregs->user)); return ret ? -EFAULT : 0; } ",1 "void PreconnectManager::StartPreresolveHosts( const std::vector& hostnames) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); for (auto it = hostnames.rbegin(); it != hostnames.rend(); ++it) { PreresolveJobId job_id = preresolve_jobs_.Add(std::make_unique( GURL(""http://"" + *it), 0, kAllowCredentialsOnPreconnectByDefault, net::NetworkIsolationKey(), nullptr)); queued_jobs_.push_front(job_id); } TryToLaunchPreresolveJobs(); } ",0 "static inline void die_if_kernel(const char *str, struct pt_regs *regs, long err) { if (!user_mode(regs)) die(str, regs, err); } ",0 "TestNamedConstructor* toTestNamedConstructor(JSC::JSValue value) { return value.inherits(&JSTestNamedConstructor::s_info) ? jsCast(asObject(value))->impl() : 0; } ",0 "static void intel_pebs_aliases_snb(struct perf_event *event) { if ((event->hw.config & X86_RAW_EVENT_MASK) == 0x003c) { /* * Use an alternative encoding for CPU_CLK_UNHALTED.THREAD_P * (0x003c) so that we can use it with PEBS. * * The regular CPU_CLK_UNHALTED.THREAD_P event (0x003c) isn't * PEBS capable. However we can use UOPS_RETIRED.ALL * (0x01c2), which is a PEBS capable event, to get the same * count. * * UOPS_RETIRED.ALL counts the number of cycles that retires * CNTMASK micro-ops. By setting CNTMASK to a value (16) * larger than the maximum number of micro-ops that can be * retired per cycle (4) and then inverting the condition, we * count all cycles that retire 16 or less micro-ops, which * is every cycle. * * Thereby we gain a PEBS capable cycle counter. */ u64 alt_config = X86_CONFIG(.event=0xc2, .umask=0x01, .inv=1, .cmask=16); alt_config |= (event->hw.config & ~X86_RAW_EVENT_MASK); event->hw.config = alt_config; } } ",0 "bool RenderThreadImpl::IsDistanceFieldTextEnabled() { return is_distance_field_text_enabled_; } ",0 "xfs_sbversion_add_attr2(xfs_mount_t *mp, xfs_trans_t *tp) { if ((mp->m_flags & XFS_MOUNT_ATTR2) && !(xfs_sb_version_hasattr2(&mp->m_sb))) { spin_lock(&mp->m_sb_lock); if (!xfs_sb_version_hasattr2(&mp->m_sb)) { xfs_sb_version_addattr2(&mp->m_sb); spin_unlock(&mp->m_sb_lock); xfs_mod_sb(tp, XFS_SB_VERSIONNUM | XFS_SB_FEATURES2); } else spin_unlock(&mp->m_sb_lock); } } ",0 "gplotWrite(const char *filename, GPLOT *gplot) { FILE *fp; PROCNAME(""gplotWrite""); if (!filename) return ERROR_INT(""filename not defined"", procName, 1); if (!gplot) return ERROR_INT(""gplot not defined"", procName, 1); if ((fp = fopenWriteStream(filename, ""wb"")) == NULL) return ERROR_INT(""stream not opened"", procName, 1); fprintf(fp, ""Gplot Version %d\n"", GPLOT_VERSION_NUMBER); fprintf(fp, ""Rootname: %s\n"", gplot->rootname); fprintf(fp, ""Output format: %d\n"", gplot->outformat); fprintf(fp, ""Title: %s\n"", gplot->title); fprintf(fp, ""X axis label: %s\n"", gplot->xlabel); fprintf(fp, ""Y axis label: %s\n"", gplot->ylabel); fprintf(fp, ""Commandfile name: %s\n"", gplot->cmdname); fprintf(fp, ""\nCommandfile data:""); sarrayWriteStream(fp, gplot->cmddata); fprintf(fp, ""\nDatafile names:""); sarrayWriteStream(fp, gplot->datanames); fprintf(fp, ""\nPlot data:""); sarrayWriteStream(fp, gplot->plotdata); fprintf(fp, ""\nPlot titles:""); sarrayWriteStream(fp, gplot->plottitles); fprintf(fp, ""\nPlot styles:""); numaWriteStream(fp, gplot->plotstyles); fprintf(fp, ""Number of plots: %d\n"", gplot->nplots); fprintf(fp, ""Output file name: %s\n"", gplot->outname); fprintf(fp, ""Axis scaling: %d\n"", gplot->scaling); fclose(fp); return 0; } ",0 "static int cdrom_mrw_open_write(struct cdrom_device_info *cdi) { disc_information di; int ret; /* * always reset to DMA lba space on open */ if (cdrom_mrw_set_lba_space(cdi, MRW_LBA_DMA)) { pr_err(""failed setting lba address space\n""); return 1; } ret = cdrom_get_disc_info(cdi, &di); if (ret < 0 || ret < offsetof(typeof(di),disc_type)) return 1; if (!di.erasable) return 1; /* * mrw_status * 0 - not MRW formatted * 1 - MRW bgformat started, but not running or complete * 2 - MRW bgformat in progress * 3 - MRW formatting complete */ ret = 0; pr_info(""open: mrw_status '%s'\n"", mrw_format_status[di.mrw_status]); if (!di.mrw_status) ret = 1; else if (di.mrw_status == CDM_MRW_BGFORMAT_INACTIVE && mrw_format_restart) ret = cdrom_mrw_bgformat(cdi, 1); return ret; } ",0 "GahpClient::cream_set_lease(const char *service, const char *lease_id, time_t &lease_expiry) { static const char* command = ""CREAM_SET_LEASE""; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!service) service=NULLSTRING; if (!lease_id) lease_id=NULLSTRING; std::string reqline; char *esc1 = strdup( escapeGahpString(service) ); char *esc2 = strdup( escapeGahpString(lease_id) ); int x = sprintf(reqline, ""%s %s %ld"", esc1, esc2, (long)lease_expiry); free( esc1 ); free( esc2 ); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,normal_proxy,high_prio); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { int rc = 0; if ( result->argc == 2 ) { if ( !strcmp( result->argv[1], NULLSTRING ) ) { EXCEPT( ""Bad %s result"", command ); } error_string = result->argv[1]; rc = 1; } else if ( result->argc == 3 ) { if ( strcmp( result->argv[1], NULLSTRING ) ) { EXCEPT( ""Bad %s result"", command ); } if ( strcasecmp(result->argv[2], NULLSTRING) ) { lease_expiry = atoi( result->argv[2] ); } rc = 0; } else { EXCEPT( ""Bad %s result"", command ); } delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 "NetworkSelectionView* NetworkScreen::AllocateView() { return new NetworkSelectionView(this); } ",0 "void RootWindow::OnKeyboardMappingChanged() { FOR_EACH_OBSERVER(RootWindowObserver, observers_, OnKeyboardMappingChanged(this)); } ",0 "void RGBGrayEncoder::reset() { str->reset(); bufPtr = bufEnd = buf; eof = gFalse; } ",0 "static struct ffs_dev *_ffs_do_find_dev(const char *name) { struct ffs_dev *dev; list_for_each_entry(dev, &ffs_devices, entry) { if (!dev->name || !name) continue; if (strcmp(dev->name, name) == 0) return dev; } return NULL; } ",0 "static void TIFFSetEXIFProperties(TIFF *tiff,Image *image, ExceptionInfo *exception) { #if defined(MAGICKCORE_HAVE_TIFFREADEXIFDIRECTORY) const char *value; register ssize_t i; uint32 offset; /* Write EXIF properties. */ offset=0; (void) TIFFSetField(tiff,TIFFTAG_SUBIFD,1,&offset); for (i=0; exif_info[i].tag != 0; i++) { value=GetImageProperty(image,exif_info[i].property,exception); if (value == (const char *) NULL) continue; switch (exif_info[i].type) { case TIFF_ASCII: { (void) TIFFSetField(tiff,exif_info[i].tag,value); break; } case TIFF_SHORT: { uint16 field; field=(uint16) StringToLong(value); (void) TIFFSetField(tiff,exif_info[i].tag,field); break; } case TIFF_LONG: { uint16 field; field=(uint16) StringToLong(value); (void) TIFFSetField(tiff,exif_info[i].tag,field); break; } case TIFF_RATIONAL: case TIFF_SRATIONAL: { float field; field=StringToDouble(value,(char **) NULL); (void) TIFFSetField(tiff,exif_info[i].tag,field); break; } default: break; } } /* (void) TIFFSetField(tiff,TIFFTAG_EXIFIFD,offset); */ #else (void) tiff; (void) image; #endif } ",0 "static inline void *____cache_alloc(struct kmem_cache *cachep, gfp_t flags) { void *objp; struct array_cache *ac; check_irq_off(); ac = cpu_cache_get(cachep); if (likely(ac->avail)) { ac->touched = 1; objp = ac->entry[--ac->avail]; STATS_INC_ALLOCHIT(cachep); goto out; } STATS_INC_ALLOCMISS(cachep); objp = cache_alloc_refill(cachep, flags); /* * the 'ac' may be updated by cache_alloc_refill(), * and kmemleak_erase() requires its correct value. */ ac = cpu_cache_get(cachep); out: /* * To avoid a false negative, if an object that is in one of the * per-CPU caches is leaked, we need to make sure kmemleak doesn't * treat the array pointers as a reference to the object. */ if (objp) kmemleak_erase(&ac->entry[ac->avail]); return objp; } ",0 "static int bindText( sqlite3_stmt *pStmt, /* The statement to bind against */ int i, /* Index of the parameter to bind */ const void *zData, /* Pointer to the data to be bound */ int nData, /* Number of bytes of data to be bound */ void (*xDel)(void*), /* Destructor for the data */ u8 encoding /* Encoding for the data */ ){ Vdbe *p = (Vdbe *)pStmt; Mem *pVar; int rc; rc = vdbeUnbind(p, i); if( rc==SQLITE_OK ){ if( zData!=0 ){ pVar = &p->aVar[i-1]; rc = sqlite3VdbeMemSetStr(pVar, zData, nData, encoding, xDel); if( rc==SQLITE_OK && encoding!=0 ){ rc = sqlite3VdbeChangeEncoding(pVar, ENC(p->db)); } if( rc ){ sqlite3Error(p->db, rc); rc = sqlite3ApiExit(p->db, rc); } } sqlite3_mutex_leave(p->db->mutex); }else if( xDel!=SQLITE_STATIC && xDel!=SQLITE_TRANSIENT ){ xDel((void*)zData); } return rc; } ",0 "PHPAPI void var_destroy(php_unserialize_data_t *var_hashx) { void *next; zend_long i; var_entries *var_hash = (*var_hashx)->first; var_dtor_entries *var_dtor_hash = (*var_hashx)->first_dtor; zend_bool wakeup_failed = 0; zval wakeup_name; ZVAL_UNDEF(&wakeup_name); #if VAR_ENTRIES_DBG fprintf(stderr, ""var_destroy(%ld)\n"", var_hash?var_hash->used_slots:-1L); #endif while (var_hash) { next = var_hash->next; efree_size(var_hash, sizeof(var_entries)); var_hash = next; } while (var_dtor_hash) { for (i = 0; i < var_dtor_hash->used_slots; i++) { zval *zv = &var_dtor_hash->data[i]; #if VAR_ENTRIES_DBG fprintf(stderr, ""var_destroy dtor(%p, %ld)\n"", var_dtor_hash->data[i], Z_REFCOUNT_P(var_dtor_hash->data[i])); #endif /* Perform delayed __wakeup calls */ if (Z_VAR_FLAGS_P(zv) == VAR_WAKEUP_FLAG) { if (!wakeup_failed) { zval retval; if (Z_ISUNDEF(wakeup_name)) { ZVAL_STRINGL(&wakeup_name, ""__wakeup"", sizeof(""__wakeup"") - 1); } BG(serialize_lock)++; if (call_user_function_ex(CG(function_table), zv, &wakeup_name, &retval, 0, 0, 1, NULL) == FAILURE || Z_ISUNDEF(retval)) { wakeup_failed = 1; GC_FLAGS(Z_OBJ_P(zv)) |= IS_OBJ_DESTRUCTOR_CALLED; } BG(serialize_lock)--; zval_ptr_dtor(&retval); } else { GC_FLAGS(Z_OBJ_P(zv)) |= IS_OBJ_DESTRUCTOR_CALLED; } } zval_ptr_dtor(zv); } next = var_dtor_hash->next; efree_size(var_dtor_hash, sizeof(var_dtor_entries)); var_dtor_hash = next; } zval_ptr_dtor(&wakeup_name); } ",0 "sf_current_byterate (SNDFILE *sndfile) { SF_PRIVATE *psf ; if ((psf = (SF_PRIVATE*) sndfile) == NULL) return -1 ; if (psf->Magick != SNDFILE_MAGICK) return -1 ; /* This should cover all PCM and floating point formats. */ if (psf->bytewidth) return psf->sf.samplerate * psf->sf.channels * psf->bytewidth ; if (psf->byterate) return psf->byterate (psf) ; switch (SF_CODEC (psf->sf.format)) { case SF_FORMAT_IMA_ADPCM : case SF_FORMAT_MS_ADPCM : case SF_FORMAT_VOX_ADPCM : return (psf->sf.samplerate * psf->sf.channels) / 2 ; case SF_FORMAT_GSM610 : return (psf->sf.samplerate * psf->sf.channels * 13000) / 8000 ; case SF_FORMAT_G721_32 : /* 32kbs G721 ADPCM encoding. */ return (psf->sf.samplerate * psf->sf.channels) / 2 ; case SF_FORMAT_G723_24 : /* 24kbs G723 ADPCM encoding. */ return (psf->sf.samplerate * psf->sf.channels * 3) / 8 ; case SF_FORMAT_G723_40 : /* 40kbs G723 ADPCM encoding. */ return (psf->sf.samplerate * psf->sf.channels * 5) / 8 ; default : break ; } ; return -1 ; } /* sf_current_byterate */ ",0 "static int crypto_cbc_decrypt_inplace(struct blkcipher_desc *desc, struct blkcipher_walk *walk, struct crypto_cipher *tfm) { void (*fn)(struct crypto_tfm *, u8 *, const u8 *) = crypto_cipher_alg(tfm)->cia_decrypt; int bsize = crypto_cipher_blocksize(tfm); unsigned int nbytes = walk->nbytes; u8 *src = walk->src.virt.addr; u8 last_iv[bsize]; /* Start of the last block. */ src += nbytes - (nbytes & (bsize - 1)) - bsize; memcpy(last_iv, src, bsize); for (;;) { fn(crypto_cipher_tfm(tfm), src, src); if ((nbytes -= bsize) < bsize) break; crypto_xor(src, src - bsize, bsize); src -= bsize; } crypto_xor(src, walk->iv, bsize); memcpy(walk->iv, last_iv, bsize); return nbytes; } ",0 "void ImageBitmapFactories::ImageBitmapLoader::loadBlobAsync(ExecutionContext* context, Blob* blob) { m_loader.start(context, blob->blobDataHandle()); } ",0 "static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { int rc; if (inet_sk(sk)->inet_daddr) sock_rps_save_rxhash(sk, skb); rc = sock_queue_rcv_skb(sk, skb); if (rc < 0) { int is_udplite = IS_UDPLITE(sk); /* Note that an ENOMEM error is charged twice */ if (rc == -ENOMEM) UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, is_udplite); UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); kfree_skb(skb); trace_udp_fail_queue_rcv_skb(rc, sk); return -1; } return 0; } ",0 "static void dump_thread(Backtrace* backtrace, log_t* log) { dump_registers(log, backtrace->Tid()); dump_backtrace_and_stack(backtrace, log); dump_memory_and_code(log, backtrace->Tid()); dump_nearby_maps(backtrace->GetMap(), log, backtrace->Tid()); } ",0 "void RenderWidgetHostImpl::DragTargetDrop(const DropData& drop_data, const gfx::PointF& client_pt, const gfx::PointF& screen_pt, int key_modifiers) { DropData drop_data_with_permissions(drop_data); GrantFileAccessFromDropData(&drop_data_with_permissions); Send(new DragMsg_TargetDrop(GetRoutingID(), drop_data_with_permissions, client_pt, screen_pt, key_modifiers)); } ",0 " bool CreateInputAndSetText(const std::string& text) { return ExecuteScript(interstitial_->GetMainFrame(), ""create_input_and_set_text('"" + text + ""')""); } ",0 "LayoutBlockFlow::~LayoutBlockFlow() { } ",0 "static int ldm_parse_hexbyte (const u8 *src) { unsigned int x; /* For correct wrapping */ int h; /* high part */ x = h = hex_to_bin(src[0]); if (h < 0) return -1; /* low part */ h = hex_to_bin(src[1]); if (h < 0) return -1; return (x << 4) + h; } ",0 "size_t Curl_nss_version(char *buffer, size_t size) { return snprintf(buffer, size, ""NSS/%s"", NSS_VERSION); } ",0 "static void set_api_wants_to_log(bool value) { logging_enabled_via_api = value; update_logging(); } ",0 "static int mov_read_ares(MOVContext *c, AVIOContext *pb, MOVAtom atom) { if (c->fc->nb_streams >= 1) { AVCodecParameters *par = c->fc->streams[c->fc->nb_streams-1]->codecpar; if (par->codec_tag == MKTAG('A', 'V', 'i', 'n') && par->codec_id == AV_CODEC_ID_H264 && atom.size > 11) { int cid; avio_skip(pb, 10); cid = avio_rb16(pb); /* For AVID AVCI50, force width of 1440 to be able to select the correct SPS and PPS */ if (cid == 0xd4d || cid == 0xd4e) par->width = 1440; return 0; } else if ((par->codec_tag == MKTAG('A', 'V', 'd', '1') || par->codec_tag == MKTAG('A', 'V', 'd', 'n')) && atom.size >= 24) { int num, den; avio_skip(pb, 12); num = avio_rb32(pb); den = avio_rb32(pb); if (num <= 0 || den <= 0) return 0; switch (avio_rb32(pb)) { case 2: if (den >= INT_MAX / 2) return 0; den *= 2; case 1: c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.num = num; c->fc->streams[c->fc->nb_streams-1]->display_aspect_ratio.den = den; default: return 0; } } } return mov_read_avid(c, pb, atom); } ",0 "ASN1_OCTET_STRING *PKCS7_digest_from_attributes(STACK_OF(X509_ATTRIBUTE) *sk) { ASN1_TYPE *astype; if ((astype = get_attribute(sk, NID_pkcs9_messageDigest)) == NULL) return NULL; return astype->value.octet_string; } ",0 "void ResourceFetcher::preCacheDataURIImage(const FetchRequest& request) { const KURL& url = request.resourceRequest().url(); ASSERT(url.protocolIsData()); if (memoryCache()->resourceForURL(url)) return; if (Resource* resource = resourceFromDataURIRequest(request.resourceRequest(), request.options())) { memoryCache()->add(resource); scheduleDocumentResourcesGC(); } } ",0 "status_t Parcel::writeCString(const char* str) { return write(str, strlen(str)+1); } ",0 "void nf_ct_frag6_cleanup(void) { unregister_pernet_subsys(&nf_ct_net_ops); inet_frags_fini(&nf_frags); } ",0 "void PDFiumEngine::ScrolledToXPosition(int position) { CancelPaints(); int old_x = position_.x(); position_.set_x(position); CalculateVisiblePages(); client_->Scroll(pp::Point(old_x - position, 0)); } ",0 "static int may_open(struct path *path, int acc_mode, int flag) { struct dentry *dentry = path->dentry; struct inode *inode = dentry->d_inode; int error; /* O_PATH? */ if (!acc_mode) return 0; if (!inode) return -ENOENT; switch (inode->i_mode & S_IFMT) { case S_IFLNK: return -ELOOP; case S_IFDIR: if (acc_mode & MAY_WRITE) return -EISDIR; break; case S_IFBLK: case S_IFCHR: if (path->mnt->mnt_flags & MNT_NODEV) return -EACCES; /*FALLTHRU*/ case S_IFIFO: case S_IFSOCK: flag &= ~O_TRUNC; break; } error = inode_permission(inode, acc_mode); if (error) return error; /* * An append-only file must be opened in append mode for writing. */ if (IS_APPEND(inode)) { if ((flag & O_ACCMODE) != O_RDONLY && !(flag & O_APPEND)) return -EPERM; if (flag & O_TRUNC) return -EPERM; } /* O_NOATIME can only be set by the owner or superuser */ if (flag & O_NOATIME && !inode_owner_or_capable(inode)) return -EPERM; return 0; } ",0 "void TabStripModel::GetIndicesWithSameOpener(int index, std::vector* indices) { NavigationController* opener = contents_data_[index]->group; if (!opener) { opener = &(GetTabContentsAt(index)->controller()); if (!opener) return; } for (int i = 0; i < count(); ++i) { if (i == index) continue; if (contents_data_[i]->group == opener || &(GetTabContentsAt(i)->controller()) == opener) { indices->push_back(i); } } } ",0 "bool BitReaderCore::ReadBitsInternal(int num_bits, uint64_t* out) { DCHECK_GE(num_bits, 0); if (num_bits == 0) { *out = 0; return true; } if (num_bits > nbits_ && !Refill(num_bits)) { nbits_ = 0; reg_ = 0; return false; } bits_read_ += num_bits; if (num_bits == kRegWidthInBits) { *out = reg_; reg_ = 0; nbits_ = 0; return true; } *out = reg_ >> (kRegWidthInBits - num_bits); reg_ <<= num_bits; nbits_ -= num_bits; return true; } ",1 "static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) { zend_long datalen; datalen = parse_iv2((*p) + 2, p); (*p) += 2; if (datalen < 0 || (max - (*p)) <= datalen) { zend_error(E_WARNING, ""Insufficient data for unserializing - %pd required, %pd present"", datalen, (zend_long)(max - (*p))); return 0; } if (ce->unserialize == NULL) { zend_error(E_WARNING, ""Class %s has no unserializer"", ZSTR_VAL(ce->name)); object_init_ex(rval, ce); } else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash) != SUCCESS) { return 0; } (*p) += datalen; return finish_nested_data(UNSERIALIZE_PASSTHRU); } ",0 "static int _c2s_sx_sasl_callback(int cb, void *arg, void **res, sx_t s, void *cbarg) { c2s_t c2s = (c2s_t) cbarg; const char *my_realm, *mech; sx_sasl_creds_t creds; static char buf[3072]; char mechbuf[256]; struct jid_st jid; jid_static_buf jid_buf; int i, r; sess_t sess; char skey[44]; host_t host; /* init static jid */ jid_static(&jid,&jid_buf); /* retrieve our session */ assert(s != NULL); sprintf(skey, ""%d"", s->tag); /* * Retrieve the session, note that depending on the operation, * session may be null. */ sess = xhash_get(c2s->sessions, skey); switch(cb) { case sx_sasl_cb_GET_REALM: if(s->req_to == NULL) /* this shouldn't happen */ my_realm = """"; else { /* get host for request */ host = xhash_get(c2s->hosts, s->req_to); if(host == NULL) { log_write(c2s->log, LOG_ERR, ""SASL callback for non-existing host: %s"", s->req_to); *res = (void *)NULL; return sx_sasl_ret_FAIL; } my_realm = host->realm; if(my_realm == NULL) my_realm = s->req_to; } strncpy(buf, my_realm, 256); *res = (void *)buf; log_debug(ZONE, ""sx sasl callback: get realm: realm is '%s'"", buf); return sx_sasl_ret_OK; break; case sx_sasl_cb_GET_PASS: assert(sess != NULL); creds = (sx_sasl_creds_t) arg; log_debug(ZONE, ""sx sasl callback: get pass (authnid=%s, realm=%s)"", creds->authnid, creds->realm); if(sess->host->ar->get_password && (sess->host->ar->get_password)( sess->host->ar, sess, (char *)creds->authnid, (creds->realm != NULL) ? (char *)creds->realm: """", buf) == 0) { *res = buf; return sx_sasl_ret_OK; } return sx_sasl_ret_FAIL; case sx_sasl_cb_CHECK_PASS: assert(sess != NULL); creds = (sx_sasl_creds_t) arg; log_debug(ZONE, ""sx sasl callback: check pass (authnid=%s, realm=%s)"", creds->authnid, creds->realm); if(sess->host->ar->check_password != NULL) { if ((sess->host->ar->check_password)( sess->host->ar, sess, (char *)creds->authnid, (creds->realm != NULL) ? (char *)creds->realm : """", (char *)creds->pass) == 0) return sx_sasl_ret_OK; else return sx_sasl_ret_FAIL; } if(sess->host->ar->get_password != NULL) { if ((sess->host->ar->get_password)(sess->host->ar, sess, (char *)creds->authnid, (creds->realm != NULL) ? (char *)creds->realm : """", buf) != 0) return sx_sasl_ret_FAIL; if (strcmp(creds->pass, buf)==0) return sx_sasl_ret_OK; } return sx_sasl_ret_FAIL; break; case sx_sasl_cb_CHECK_AUTHZID: assert(sess != NULL); creds = (sx_sasl_creds_t) arg; /* we need authzid to validate */ if(creds->authzid == NULL || creds->authzid[0] == '\0') return sx_sasl_ret_FAIL; /* authzid must be a valid jid */ if(jid_reset(&jid, creds->authzid, -1) == NULL) return sx_sasl_ret_FAIL; /* and have domain == stream to addr */ if(!s->req_to || (strcmp(jid.domain, s->req_to) != 0)) return sx_sasl_ret_FAIL; /* and have no resource */ if(jid.resource[0] != '\0') return sx_sasl_ret_FAIL; /* and user has right to authorize as */ if (sess->host->ar->user_authz_allowed) { if (sess->host->ar->user_authz_allowed(sess->host->ar, sess, (char *)creds->authnid, (char *)creds->realm, (char *)creds->authzid)) return sx_sasl_ret_OK; } else { if (strcmp(creds->authnid, jid.node) == 0 && (sess->host->ar->user_exists)(sess->host->ar, sess, jid.node, jid.domain)) return sx_sasl_ret_OK; } return sx_sasl_ret_FAIL; case sx_sasl_cb_GEN_AUTHZID: /* generate a jid for SASL ANONYMOUS */ jid_reset(&jid, s->req_to, -1); /* make node a random string */ jid_random_part(&jid, jid_NODE); strcpy(buf, jid.node); *res = (void *)buf; return sx_sasl_ret_OK; break; case sx_sasl_cb_CHECK_MECH: mech = (char *)arg; strncpy(mechbuf, mech, sizeof(mechbuf)); mechbuf[sizeof(mechbuf)-1]='\0'; for(i = 0; mechbuf[i]; i++) mechbuf[i] = tolower(mechbuf[i]); /* get host for request */ host = xhash_get(c2s->hosts, s->req_to); if(host == NULL) { log_write(c2s->log, LOG_WARNING, ""SASL callback for non-existing host: %s"", s->req_to); return sx_sasl_ret_FAIL; } /* Determine if our configuration will let us use this mechanism. * We support different mechanisms for both SSL and normal use */ if (strcmp(mechbuf, ""digest-md5"") == 0) { /* digest-md5 requires that our authreg support get_password */ if (host->ar->get_password == NULL) return sx_sasl_ret_FAIL; } else if (strcmp(mechbuf, ""plain"") == 0) { /* plain requires either get_password or check_password */ if (host->ar->get_password == NULL && host->ar->check_password == NULL) return sx_sasl_ret_FAIL; } /* Using SSF is potentially dangerous, as SASL can also set the * SSF of the connection. However, SASL shouldn't do so until after * we've finished mechanism establishment */ if (s->ssf>0) { r = snprintf(buf, sizeof(buf), ""authreg.ssl-mechanisms.sasl.%s"",mechbuf); if (r < -1 || r > sizeof(buf)) return sx_sasl_ret_FAIL; if(config_get(c2s->config,buf) != NULL) return sx_sasl_ret_OK; } r = snprintf(buf, sizeof(buf), ""authreg.mechanisms.sasl.%s"",mechbuf); if (r < -1 || r > sizeof(buf)) return sx_sasl_ret_FAIL; /* Work out if our configuration will let us use this mechanism */ if(config_get(c2s->config,buf) != NULL) return sx_sasl_ret_OK; else return sx_sasl_ret_FAIL; default: break; } return sx_sasl_ret_FAIL; } ",1 "bool GestureSequence::ScrollUpdate(const TouchEvent& event, const GesturePoint& point, Gestures* gestures) { DCHECK(state_ == GS_SCROLL); if (!point.DidScroll(event, 0)) return false; AppendScrollGestureUpdate(point, point.last_touch_position(), gestures); return true; } ",0 "void Curl_cookie_loadfiles(struct SessionHandle *data) { struct curl_slist *list = data->change.cookielist; if(list) { Curl_share_lock(data, CURL_LOCK_DATA_COOKIE, CURL_LOCK_ACCESS_SINGLE); while(list) { data->cookies = Curl_cookie_init(data, list->data, data->cookies, data->set.cookiesession); list = list->next; } curl_slist_free_all(data->change.cookielist); /* clean up list */ data->change.cookielist = NULL; /* don't do this again! */ Curl_share_unlock(data, CURL_LOCK_DATA_COOKIE); } } ",0 "WORD32 ihevcd_parse_transform_tree(codec_t *ps_codec, WORD32 x0, WORD32 y0, WORD32 cu_x_base, WORD32 cu_y_base, WORD32 log2_trafo_size, WORD32 trafo_depth, WORD32 blk_idx, WORD32 intra_pred_mode) { IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; sps_t *ps_sps; pps_t *ps_pps; WORD32 value; WORD32 x1, y1; WORD32 max_trafo_depth; bitstrm_t *ps_bitstrm = &ps_codec->s_parse.s_bitstrm; WORD32 intra_split_flag; WORD32 split_transform_flag; WORD32 ctxt_idx; cab_ctxt_t *ps_cabac = &ps_codec->s_parse.s_cabac; max_trafo_depth = ps_codec->s_parse.s_cu.i4_max_trafo_depth; ps_sps = ps_codec->s_parse.ps_sps; ps_pps = ps_codec->s_parse.ps_pps; intra_split_flag = ps_codec->s_parse.s_cu.i4_intra_split_flag; { split_transform_flag = 0; if((log2_trafo_size <= ps_sps->i1_log2_max_transform_block_size) && (log2_trafo_size > ps_sps->i1_log2_min_transform_block_size) && (trafo_depth < max_trafo_depth) && !(intra_split_flag && (trafo_depth == 0))) { /* encode the split transform flag, context derived as per Table9-37 */ ctxt_idx = IHEVC_CAB_SPLIT_TFM + (5 - log2_trafo_size); TRACE_CABAC_CTXT(""split_transform_flag"", ps_cabac->u4_range, ctxt_idx); split_transform_flag = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""split_transform_flag"", split_transform_flag, ps_cabac->u4_range); } else { WORD32 inter_split_flag = 0; if((0 == ps_sps->i1_max_transform_hierarchy_depth_inter) && (PRED_MODE_INTER == ps_codec->s_parse.s_cu.i4_pred_mode) && (PART_2Nx2N != ps_codec->s_parse.s_cu.i4_part_mode) && (0 == trafo_depth)) { inter_split_flag = 1; } if((log2_trafo_size > ps_sps->i1_log2_max_transform_block_size) || ((1 == intra_split_flag) && (0 == trafo_depth)) || (1 == inter_split_flag)) { split_transform_flag = 1; } } if(0 == trafo_depth) { ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth] = 0; ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth] = 0; } else { ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth] = ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth - 1]; ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth] = ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth - 1]; } if(trafo_depth == 0 || log2_trafo_size > 2) { ctxt_idx = IHEVC_CAB_CBCR_IDX + trafo_depth; /* CBF for Cb/Cr is sent only if the parent CBF for Cb/Cr is non-zero */ if((trafo_depth == 0) || ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth - 1]) { TRACE_CABAC_CTXT(""cbf_cb"", ps_cabac->u4_range, ctxt_idx); value = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""cbf_cb"", value, ps_cabac->u4_range); ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth] = value; } if((trafo_depth == 0) || ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth - 1]) { TRACE_CABAC_CTXT(""cbf_cr"", ps_cabac->u4_range, ctxt_idx); value = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""cbf_cr"", value, ps_cabac->u4_range); ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth] = value; } } if(split_transform_flag) { WORD32 intra_pred_mode_tmp; x1 = x0 + ((1 << log2_trafo_size) >> 1); y1 = y0 + ((1 << log2_trafo_size) >> 1); /* For transform depth of zero, intra pred mode as decoded at CU */ /* level is sent to the transform tree nodes */ /* When depth is non-zero intra pred mode of parent node is sent */ /* This takes care of passing correct mode to all the child nodes */ intra_pred_mode_tmp = trafo_depth ? intra_pred_mode : ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[0]; ihevcd_parse_transform_tree(ps_codec, x0, y0, x0, y0, log2_trafo_size - 1, trafo_depth + 1, 0, intra_pred_mode_tmp); intra_pred_mode_tmp = trafo_depth ? intra_pred_mode : ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[1]; ihevcd_parse_transform_tree(ps_codec, x1, y0, x0, y0, log2_trafo_size - 1, trafo_depth + 1, 1, intra_pred_mode_tmp); intra_pred_mode_tmp = trafo_depth ? intra_pred_mode : ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[2]; ihevcd_parse_transform_tree(ps_codec, x0, y1, x0, y0, log2_trafo_size - 1, trafo_depth + 1, 2, intra_pred_mode_tmp); intra_pred_mode_tmp = trafo_depth ? intra_pred_mode : ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[3]; ihevcd_parse_transform_tree(ps_codec, x1, y1, x0, y0, log2_trafo_size - 1, trafo_depth + 1, 3, intra_pred_mode_tmp); } else { WORD32 ctb_x_base; WORD32 ctb_y_base; WORD32 cu_qp_delta_abs; tu_t *ps_tu = ps_codec->s_parse.ps_tu; cu_qp_delta_abs = 0; ctb_x_base = ps_codec->s_parse.i4_ctb_x << ps_sps->i1_log2_ctb_size; ctb_y_base = ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size; if((ps_codec->s_parse.s_cu.i4_pred_mode == PRED_MODE_INTRA) || (trafo_depth != 0) || (ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth]) || (ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth])) { ctxt_idx = IHEVC_CAB_CBF_LUMA_IDX; ctxt_idx += (trafo_depth == 0) ? 1 : 0; TRACE_CABAC_CTXT(""cbf_luma"", ps_cabac->u4_range, ctxt_idx); value = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""cbf_luma"", value, ps_cabac->u4_range); ps_codec->s_parse.s_cu.i1_cbf_luma = value; } else { ps_codec->s_parse.s_cu.i1_cbf_luma = 1; } /* Initialize ps_tu to default values */ /* If required change this to WORD32 packed write */ ps_tu->b1_cb_cbf = 0; ps_tu->b1_cr_cbf = 0; ps_tu->b1_y_cbf = 0; ps_tu->b4_pos_x = ((x0 - ctb_x_base) >> 2); ps_tu->b4_pos_y = ((y0 - ctb_y_base) >> 2); ps_tu->b1_transquant_bypass = ps_codec->s_parse.s_cu.i4_cu_transquant_bypass; ps_tu->b3_size = (log2_trafo_size - 2); ps_tu->b7_qp = ps_codec->s_parse.u4_qp; ps_tu->b6_luma_intra_mode = intra_pred_mode; ps_tu->b3_chroma_intra_mode_idx = ps_codec->s_parse.s_cu.i4_intra_chroma_pred_mode_idx; /* Section:7.3.12 Transform unit syntax inlined here */ if(ps_codec->s_parse.s_cu.i1_cbf_luma || ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth] || ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth]) { WORD32 intra_pred_mode_chroma; if(ps_pps->i1_cu_qp_delta_enabled_flag && !ps_codec->s_parse.i4_is_cu_qp_delta_coded) { WORD32 c_max = TU_MAX_QP_DELTA_ABS; WORD32 ctxt_inc = IHEVC_CAB_QP_DELTA_ABS; WORD32 ctxt_inc_max = CTXT_MAX_QP_DELTA_ABS; TRACE_CABAC_CTXT(""cu_qp_delta_abs"", ps_cabac->u4_range, ctxt_inc); /* qp_delta_abs is coded as combination of tunary and eg0 code */ /* See Table 9-32 and Table 9-37 for details on cu_qp_delta_abs */ cu_qp_delta_abs = ihevcd_cabac_decode_bins_tunary(ps_cabac, ps_bitstrm, c_max, ctxt_inc, 0, ctxt_inc_max); if(cu_qp_delta_abs >= c_max) { value = ihevcd_cabac_decode_bypass_bins_egk(ps_cabac, ps_bitstrm, 0); cu_qp_delta_abs += value; } AEV_TRACE(""cu_qp_delta_abs"", cu_qp_delta_abs, ps_cabac->u4_range); ps_codec->s_parse.i4_is_cu_qp_delta_coded = 1; if(cu_qp_delta_abs) { value = ihevcd_cabac_decode_bypass_bin(ps_cabac, ps_bitstrm); AEV_TRACE(""cu_qp_delta_sign"", value, ps_cabac->u4_range); if(value) cu_qp_delta_abs = -cu_qp_delta_abs; } ps_codec->s_parse.s_cu.i4_cu_qp_delta = cu_qp_delta_abs; } if(ps_codec->s_parse.s_cu.i1_cbf_luma) { ps_tu->b1_y_cbf = 1; ihevcd_parse_residual_coding(ps_codec, x0, y0, log2_trafo_size, 0, intra_pred_mode); } if(4 == ps_codec->s_parse.s_cu.i4_intra_chroma_pred_mode_idx) intra_pred_mode_chroma = ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[0]; else { intra_pred_mode_chroma = gau1_intra_pred_chroma_modes[ps_codec->s_parse.s_cu.i4_intra_chroma_pred_mode_idx]; if(intra_pred_mode_chroma == ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[0]) { intra_pred_mode_chroma = INTRA_ANGULAR(34); } } if(log2_trafo_size > 2) { if(ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth]) { ps_tu->b1_cb_cbf = 1; ihevcd_parse_residual_coding(ps_codec, x0, y0, log2_trafo_size - 1, 1, intra_pred_mode_chroma); } if(ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth]) { ps_tu->b1_cr_cbf = 1; ihevcd_parse_residual_coding(ps_codec, x0, y0, log2_trafo_size - 1, 2, intra_pred_mode_chroma); } } else if(blk_idx == 3) { if(ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth]) { ps_tu->b1_cb_cbf = 1; ihevcd_parse_residual_coding(ps_codec, cu_x_base, cu_y_base, log2_trafo_size, 1, intra_pred_mode_chroma); } if(ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth]) { ps_tu->b1_cr_cbf = 1; ihevcd_parse_residual_coding(ps_codec, cu_x_base, cu_y_base, log2_trafo_size, 2, intra_pred_mode_chroma); } } else { ps_tu->b3_chroma_intra_mode_idx = INTRA_PRED_CHROMA_IDX_NONE; } } else { if((3 != blk_idx) && (2 == log2_trafo_size)) { ps_tu->b3_chroma_intra_mode_idx = INTRA_PRED_CHROMA_IDX_NONE; } } /* Set the first TU in CU flag */ { if((ps_codec->s_parse.s_cu.i4_pos_x << 3) == (ps_tu->b4_pos_x << 2) && (ps_codec->s_parse.s_cu.i4_pos_y << 3) == (ps_tu->b4_pos_y << 2)) { ps_tu->b1_first_tu_in_cu = 1; } else { ps_tu->b1_first_tu_in_cu = 0; } } ps_codec->s_parse.ps_tu++; ps_codec->s_parse.s_cu.i4_tu_cnt++; ps_codec->s_parse.i4_pic_tu_idx++; } } return ret; } ",1 "pk_copy_error(krb5_context context, hx509_context hx509ctx, int hxret, const char *fmt, ...) { va_list va; char *s, *f; int ret; va_start(va, fmt); ret = vasprintf(&f, fmt, va); va_end(va); if (ret == -1 || f == NULL) { krb5_clear_error_message(context); return; } s = hx509_get_error_string(hx509ctx, hxret); if (s == NULL) { krb5_clear_error_message(context); free(f); return; } krb5_set_error_message(context, hxret, ""%s: %s"", f, s); free(s); free(f); } ",0 "QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, QQuickItem* parent) : QQuickItem(parent) , d_ptr(createPrivateObject(this)) , m_experimental(new QQuickWebViewExperimental(this)) { Q_D(QQuickWebView); d->initialize(contextRef, pageGroupRef); } ",0 "static inline short vmcs_field_to_offset(unsigned long field) { BUILD_BUG_ON(ARRAY_SIZE(vmcs_field_to_offset_table) > SHRT_MAX); if (field >= ARRAY_SIZE(vmcs_field_to_offset_table) || vmcs_field_to_offset_table[field] == 0) return -ENOENT; return vmcs_field_to_offset_table[field]; } ",0 "MagickExport EndianType GetQuantumEndian(const QuantumInfo *quantum_info) { assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickSignature); return(quantum_info->endian); } ",0 "void Pack(const float* source, float* destination, unsigned pixels_per_row) { for (unsigned i = 0; i < pixels_per_row; ++i) { float scale_factor = source[3] ? 1.0f / source[3] : 1.0f; destination[0] = source[0] * scale_factor; source += 4; destination += 1; } } ",0 "frobnicate_signal_handler_2 (DBusGProxy *proxy, int val, void *user_data) { n_times_frobnicate_received_2 += 1; g_assert (val == 42); g_print (""Got Frobnicate signal (again)\n""); } ",0 "std::string GetDocumentOrigin(FrameTreeNode* ftn) { std::string origin; EXPECT_TRUE(ExecuteScriptAndExtractString( ftn, ""domAutomationController.send(document.origin)"", &origin)); return origin; } ",0 "int kvm_mmu_create(struct kvm_vcpu *vcpu) { ASSERT(vcpu); vcpu->arch.walk_mmu = &vcpu->arch.mmu; vcpu->arch.mmu.root_hpa = INVALID_PAGE; vcpu->arch.mmu.translate_gpa = translate_gpa; vcpu->arch.nested_mmu.translate_gpa = translate_nested_gpa; return alloc_mmu_pages(vcpu); } ",0 "void __raise_softirq_irqoff(unsigned int nr) { trace_softirq_raise(nr); or_softirq_pending(1UL << nr); } ",0 "static inline bool is_exception(u32 intr_info) { return (intr_info & (INTR_INFO_INTR_TYPE_MASK | INTR_INFO_VALID_MASK)) == (INTR_TYPE_HARD_EXCEPTION | INTR_INFO_VALID_MASK); } ",1 "void touch_softlockup_watchdog_sync(void) { __raw_get_cpu_var(softlockup_touch_sync) = true; __raw_get_cpu_var(watchdog_touch_ts) = 0; } ",0 "void SQLiteDatabase::SetBusyTimeout(int ms) { if (db_) sqlite3_busy_timeout(db_, ms); else SQL_DVLOG(1) << ""BusyTimeout set on non-open database""; } ",0 "static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src) { struct sock *sk = NULL; struct hlist_node *node; sk_for_each(sk, node, &rfcomm_sk_list.head) { if (rfcomm_pi(sk)->channel == channel && !bacmp(&bt_sk(sk)->src, src)) break; } return node ? sk : NULL; } ",0 "int tty_release(struct inode *inode, struct file *filp) { struct tty_struct *tty = file_tty(filp); struct tty_struct *o_tty = NULL; int do_sleep, final; int idx; long timeout = 0; int once = 1; if (tty_paranoia_check(tty, inode, __func__)) return 0; tty_lock(tty); check_tty_count(tty, __func__); __tty_fasync(-1, filp, 0); idx = tty->index; if (tty->driver->type == TTY_DRIVER_TYPE_PTY && tty->driver->subtype == PTY_TYPE_MASTER) o_tty = tty->link; if (tty_release_checks(tty, idx)) { tty_unlock(tty); return 0; } tty_debug_hangup(tty, ""releasing (count=%d)\n"", tty->count); if (tty->ops->close) tty->ops->close(tty, filp); /* If tty is pty master, lock the slave pty (stable lock order) */ tty_lock_slave(o_tty); /* * Sanity check: if tty->count is going to zero, there shouldn't be * any waiters on tty->read_wait or tty->write_wait. We test the * wait queues and kick everyone out _before_ actually starting to * close. This ensures that we won't block while releasing the tty * structure. * * The test for the o_tty closing is necessary, since the master and * slave sides may close in any order. If the slave side closes out * first, its count will be one, since the master side holds an open. * Thus this test wouldn't be triggered at the time the slave closed, * so we do it now. */ while (1) { do_sleep = 0; if (tty->count <= 1) { if (waitqueue_active(&tty->read_wait)) { wake_up_poll(&tty->read_wait, POLLIN); do_sleep++; } if (waitqueue_active(&tty->write_wait)) { wake_up_poll(&tty->write_wait, POLLOUT); do_sleep++; } } if (o_tty && o_tty->count <= 1) { if (waitqueue_active(&o_tty->read_wait)) { wake_up_poll(&o_tty->read_wait, POLLIN); do_sleep++; } if (waitqueue_active(&o_tty->write_wait)) { wake_up_poll(&o_tty->write_wait, POLLOUT); do_sleep++; } } if (!do_sleep) break; if (once) { once = 0; tty_warn(tty, ""read/write wait queue active!\n""); } schedule_timeout_killable(timeout); if (timeout < 120 * HZ) timeout = 2 * timeout + 1; else timeout = MAX_SCHEDULE_TIMEOUT; } if (o_tty) { if (--o_tty->count < 0) { tty_warn(tty, ""bad slave count (%d)\n"", o_tty->count); o_tty->count = 0; } } if (--tty->count < 0) { tty_warn(tty, ""bad tty->count (%d)\n"", tty->count); tty->count = 0; } /* * We've decremented tty->count, so we need to remove this file * descriptor off the tty->tty_files list; this serves two * purposes: * - check_tty_count sees the correct number of file descriptors * associated with this tty. * - do_tty_hangup no longer sees this file descriptor as * something that needs to be handled for hangups. */ tty_del_file(filp); /* * Perform some housekeeping before deciding whether to return. * * If _either_ side is closing, make sure there aren't any * processes that still think tty or o_tty is their controlling * tty. */ if (!tty->count) { read_lock(&tasklist_lock); session_clear_tty(tty->session); if (o_tty) session_clear_tty(o_tty->session); read_unlock(&tasklist_lock); } /* check whether both sides are closing ... */ final = !tty->count && !(o_tty && o_tty->count); tty_unlock_slave(o_tty); tty_unlock(tty); /* At this point, the tty->count == 0 should ensure a dead tty cannot be re-opened by a racing opener */ if (!final) return 0; tty_debug_hangup(tty, ""final close\n""); /* * Ask the line discipline code to release its structures */ tty_ldisc_release(tty); /* Wait for pending work before tty destruction commmences */ tty_flush_works(tty); tty_debug_hangup(tty, ""freeing structure\n""); /* * The release_tty function takes care of the details of clearing * the slots and preserving the termios structure. The tty_unlock_pair * should be safe as we keep a kref while the tty is locked (so the * unlock never unlocks a freed tty). */ mutex_lock(&tty_mutex); release_tty(tty, idx); mutex_unlock(&tty_mutex); return 0; } ",0 "void acquire_object(const sp& proc, const flat_binder_object& obj, const void* who) { acquire_object(proc, obj, who, NULL); } ",0 "xmlXPathCompOpEvalPredicate(xmlXPathParserContextPtr ctxt, xmlXPathStepOpPtr op, xmlNodeSetPtr set, int contextSize, int hasNsNodes) { if (op->ch1 != -1) { xmlXPathCompExprPtr comp = ctxt->comp; /* * Process inner predicates first. */ if (comp->steps[op->ch1].op != XPATH_OP_PREDICATE) { /* * TODO: raise an internal error. */ } contextSize = xmlXPathCompOpEvalPredicate(ctxt, &comp->steps[op->ch1], set, contextSize, hasNsNodes); CHECK_ERROR0; if (contextSize <= 0) return(0); } if (op->ch2 != -1) { xmlXPathContextPtr xpctxt = ctxt->context; xmlNodePtr contextNode, oldContextNode; xmlDocPtr oldContextDoc; int i, res, contextPos = 0, newContextSize; xmlXPathStepOpPtr exprOp; xmlXPathObjectPtr contextObj = NULL, exprRes = NULL; #ifdef LIBXML_XPTR_ENABLED /* * URGENT TODO: Check the following: * We don't expect location sets if evaluating prediates, right? * Only filters should expect location sets, right? */ #endif /* * SPEC XPath 1.0: * ""For each node in the node-set to be filtered, the * PredicateExpr is evaluated with that node as the * context node, with the number of nodes in the * node-set as the context size, and with the proximity * position of the node in the node-set with respect to * the axis as the context position;"" * @oldset is the node-set"" to be filtered. * * SPEC XPath 1.0: * ""only predicates change the context position and * context size (see [2.4 Predicates])."" * Example: * node-set context pos * nA 1 * nB 2 * nC 3 * After applying predicate [position() > 1] : * node-set context pos * nB 1 * nC 2 */ oldContextNode = xpctxt->node; oldContextDoc = xpctxt->doc; /* * Get the expression of this predicate. */ exprOp = &ctxt->comp->steps[op->ch2]; newContextSize = 0; for (i = 0; i < set->nodeNr; i++) { if (set->nodeTab[i] == NULL) continue; contextNode = set->nodeTab[i]; xpctxt->node = contextNode; xpctxt->contextSize = contextSize; xpctxt->proximityPosition = ++contextPos; /* * Also set the xpath document in case things like * key() are evaluated in the predicate. */ if ((contextNode->type != XML_NAMESPACE_DECL) && (contextNode->doc != NULL)) xpctxt->doc = contextNode->doc; /* * Evaluate the predicate expression with 1 context node * at a time; this node is packaged into a node set; this * node set is handed over to the evaluation mechanism. */ if (contextObj == NULL) contextObj = xmlXPathCacheNewNodeSet(xpctxt, contextNode); else xmlXPathNodeSetAddUnique(contextObj->nodesetval, contextNode); valuePush(ctxt, contextObj); res = xmlXPathCompOpEvalToBoolean(ctxt, exprOp, 1); if ((ctxt->error != XPATH_EXPRESSION_OK) || (res == -1)) { xmlXPathNodeSetClear(set, hasNsNodes); newContextSize = 0; goto evaluation_exit; } if (res != 0) { newContextSize++; } else { /* * Remove the entry from the initial node set. */ set->nodeTab[i] = NULL; if (contextNode->type == XML_NAMESPACE_DECL) xmlXPathNodeSetFreeNs((xmlNsPtr) contextNode); } if (ctxt->value == contextObj) { /* * Don't free the temporary XPath object holding the * context node, in order to avoid massive recreation * inside this loop. */ valuePop(ctxt); xmlXPathNodeSetClear(contextObj->nodesetval, hasNsNodes); } else { /* * TODO: The object was lost in the evaluation machinery. * Can this happen? Maybe in internal-error cases. */ contextObj = NULL; } } if (contextObj != NULL) { if (ctxt->value == contextObj) valuePop(ctxt); xmlXPathReleaseObject(xpctxt, contextObj); } evaluation_exit: if (exprRes != NULL) xmlXPathReleaseObject(ctxt->context, exprRes); /* * Reset/invalidate the context. */ xpctxt->node = oldContextNode; xpctxt->doc = oldContextDoc; xpctxt->contextSize = -1; xpctxt->proximityPosition = -1; return(newContextSize); } return(contextSize); } ",0 "static void pdf_run_cm(fz_context *ctx, pdf_processor *proc, float a, float b, float c, float d, float e, float f) { pdf_run_processor *pr = (pdf_run_processor *)proc; pdf_gstate *gstate = pdf_flush_text(ctx, pr); fz_matrix m; m.a = a; m.b = b; m.c = c; m.d = d; m.e = e; m.f = f; fz_concat(&gstate->ctm, &m, &gstate->ctm); } ",0 " FakeRenderWidgetHostViewAura(RenderWidgetHost* widget, bool is_guest_view_hack) : RenderWidgetHostViewAura(widget, is_guest_view_hack, false /* is_mus_browser_plugin_guest */), is_guest_view_hack_(is_guest_view_hack), delegated_frame_host_client_( new FakeDelegatedFrameHostClientAura(this)) { InstallDelegatedFrameHostClient( this, base::WrapUnique(delegated_frame_host_client_)); CreateNewRendererCompositorFrameSink(); } ",0 "int path_is_under(struct path *path1, struct path *path2) { int res; br_read_lock(&vfsmount_lock); res = is_path_reachable(real_mount(path1->mnt), path1->dentry, path2); br_read_unlock(&vfsmount_lock); return res; } ",0 "aspath_count (void) { return ashash->count; } ",0 "HeadlessBrowserImpl* HeadlessWebContentsImpl::browser() const { return browser_context_->browser(); } ",0 "file_badread(struct magic_set *ms) { file_error(ms, errno, ""error reading""); } ",0 "void SBEntry::Destroy() { free(this); } ",0 " SignInIsolationBrowserTest() : https_server_(net::EmbeddedTestServer::TYPE_HTTPS) {} ",0 "bool RenderProcessHostImpl::HasConnection() const { return is_initialized_ && !is_dead_; } ",0 "static inline size_t GetPSDPacketSize(Image *image) { if (image->storage_class == PseudoClass) { if (image->colors > 256) return(2); else if (image->depth > 8) return(2); } else if (image->depth > 8) return(2); return(1); } ",0 "void IsPinnedToTaskbarHelper::OnConnectionError() { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); error_callback_.Run(); delete this; } ",0 "static void netlink_increment_head(struct netlink_ring *ring) { ring->head = ring->head != ring->frame_max ? ring->head + 1 : 0; } ",0 "void RenderThreadImpl::PendingFrameCreate::OnConnectionError() { size_t erased = RenderThreadImpl::current()->pending_frame_creates_.erase(routing_id_); DCHECK_EQ(1u, erased); } ",0 "void IndexedDBDatabase::DeleteIndex(IndexedDBTransaction* transaction, int64_t object_store_id, int64_t index_id) { DCHECK(transaction); IDB_TRACE1(""IndexedDBDatabase::DeleteIndex"", ""txn.id"", transaction->id()); DCHECK_EQ(transaction->mode(), blink::mojom::IDBTransactionMode::VersionChange); if (!ValidateObjectStoreIdAndIndexId(object_store_id, index_id)) return; transaction->ScheduleTask( base::BindOnce(&IndexedDBDatabase::DeleteIndexOperation, this, object_store_id, index_id)); } ",0 "bool SiteInstanceImpl::HasWrongProcessForURL(const GURL& url) { if (!HasProcess()) return false; if (IsRendererDebugURL(url)) return false; if (url.IsAboutBlank() && site_ != GURL(kUnreachableWebDataURL)) return false; GURL site_url = SiteInstance::GetSiteForURL(browsing_instance_->browser_context(), url); GURL origin_lock = DetermineProcessLockURL(browsing_instance_->browser_context(), url); return !RenderProcessHostImpl::IsSuitableHost( GetProcess(), browsing_instance_->browser_context(), site_url, origin_lock); } ",0 "void V8TestObject::GetMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_get""); test_object_v8_internal::GetMethod(info); } ",0 "void RenderFrameHostImpl::ProcessBeforeUnloadACK( bool proceed, bool treat_as_final_ack, const base::TimeTicks& renderer_before_unload_start_time, const base::TimeTicks& renderer_before_unload_end_time) { TRACE_EVENT_ASYNC_END1(""navigation"", ""RenderFrameHostImpl BeforeUnload"", this, ""FrameTreeNode id"", frame_tree_node_->frame_tree_node_id()); RenderFrameHostImpl* initiator = GetBeforeUnloadInitiator(); if (!initiator) return; initiator->ProcessBeforeUnloadACKFromFrame( proceed, treat_as_final_ack, this, false /* is_frame_being_destroyed */, renderer_before_unload_start_time, renderer_before_unload_end_time); } ",0 "void RenderWidgetHostViewAura::SwapDelegatedFrame( uint32 output_surface_id, scoped_ptr frame_data, float frame_device_scale_factor, const std::vector& latency_info) { DCHECK_NE(0u, frame_data->render_pass_list.size()); cc::RenderPass* root_pass = frame_data->render_pass_list.back(); gfx::Size frame_size = root_pass->output_rect.size(); gfx::Size frame_size_in_dip = ConvertSizeToDIP(frame_device_scale_factor, frame_size); gfx::Rect damage_rect = gfx::ToEnclosingRect(root_pass->damage_rect); damage_rect.Intersect(gfx::Rect(frame_size)); gfx::Rect damage_rect_in_dip = ConvertRectToDIP(frame_device_scale_factor, damage_rect); software_frame_manager_->DiscardCurrentFrame(); if (ShouldSkipFrame(frame_size_in_dip)) { cc::CompositorFrameAck ack; cc::TransferableResource::ReturnResources(frame_data->resource_list, &ack.resources); RenderWidgetHostImpl::SendSwapCompositorFrameAck( host_->GetRoutingID(), output_surface_id, host_->GetProcess()->GetID(), ack); skipped_frames_ = true; return; } if (skipped_frames_) { skipped_frames_ = false; damage_rect = gfx::Rect(frame_size); damage_rect_in_dip = gfx::Rect(frame_size_in_dip); cc::RenderPass* root_pass = frame_data->render_pass_list.back(); root_pass->damage_rect = damage_rect; } if (output_surface_id != last_output_surface_id_) { EvictDelegatedFrame(); if (resource_collection_.get()) { resource_collection_->SetClient(NULL); if (resource_collection_->LoseAllResources()) SendReturnedDelegatedResources(last_output_surface_id_); resource_collection_ = NULL; } last_output_surface_id_ = output_surface_id; } if (frame_size.IsEmpty()) { DCHECK_EQ(0u, frame_data->resource_list.size()); EvictDelegatedFrame(); } else { if (!resource_collection_) { resource_collection_ = new cc::DelegatedFrameResourceCollection; resource_collection_->SetClient(this); } if (!frame_provider_.get() || frame_size != frame_provider_->frame_size() || frame_size_in_dip != current_frame_size_) { frame_provider_ = new cc::DelegatedFrameProvider( resource_collection_.get(), frame_data.Pass()); window_->layer()->SetShowDelegatedContent(frame_provider_.get(), frame_size_in_dip); } else { frame_provider_->SetFrameData(frame_data.Pass()); } } released_front_lock_ = NULL; current_frame_size_ = frame_size_in_dip; CheckResizeLock(); if (paint_observer_) paint_observer_->OnUpdateCompositorContent(); window_->SchedulePaintInRect(damage_rect_in_dip); pending_delegated_ack_count_++; ui::Compositor* compositor = GetCompositor(); if (!compositor) { SendDelegatedFrameAck(output_surface_id); } else { for (size_t i = 0; i < latency_info.size(); i++) compositor->SetLatencyInfo(latency_info[i]); AddOnCommitCallbackAndDisableLocks( base::Bind(&RenderWidgetHostViewAura::SendDelegatedFrameAck, AsWeakPtr(), output_surface_id)); } DidReceiveFrameFromRenderer(); if (frame_provider_.get()) delegated_frame_evictor_->SwappedFrame(!host_->is_hidden()); } ",0 "unsigned HTMLFormElement::length() const { unsigned len = 0; for (const auto& element : ListedElements()) { if (element->IsEnumeratable()) ++len; } return len; } ",0 "MagickExport Image *MergeImageLayers(Image *image, const ImageLayerMethod method,ExceptionInfo *exception) { #define MergeLayersTag ""Merge/Layers"" Image *canvas; MagickBooleanType proceed; RectangleInfo page; register const Image *next; size_t number_images, height, width; ssize_t scene; 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); /* Determine canvas image size, and its virtual canvas size and offset. */ page=image->page; width=image->columns; height=image->rows; switch (method) { case TrimBoundsLayer: case MergeLayer: default: { next=GetNextImageInList(image); for ( ; next != (Image *) NULL; next=GetNextImageInList(next)) { if (page.x > next->page.x) { width+=page.x-next->page.x; page.x=next->page.x; } if (page.y > next->page.y) { height+=page.y-next->page.y; page.y=next->page.y; } if ((ssize_t) width < (next->page.x+(ssize_t) next->columns-page.x)) width=(size_t) next->page.x+(ssize_t) next->columns-page.x; if ((ssize_t) height < (next->page.y+(ssize_t) next->rows-page.y)) height=(size_t) next->page.y+(ssize_t) next->rows-page.y; } break; } case FlattenLayer: { if (page.width > 0) width=page.width; if (page.height > 0) height=page.height; page.x=0; page.y=0; break; } case MosaicLayer: { if (page.width > 0) width=page.width; if (page.height > 0) height=page.height; for (next=image; next != (Image *) NULL; next=GetNextImageInList(next)) { if ((ssize_t) width < (next->page.x+(ssize_t) next->columns)) width=(size_t) next->page.x+next->columns; if ((ssize_t) height < (next->page.y+(ssize_t) next->rows)) height=(size_t) next->page.y+next->rows; } page.width=width; page.height=height; page.x=0; page.y=0; break; } } /* Set virtual canvas size if not defined. */ if (page.width == 0) page.width=page.x < 0 ? width : width+page.x; if (page.height == 0) page.height=page.y < 0 ? height : height+page.y; /* Handle ""TrimBoundsLayer"" method separately to normal 'layer merge'. */ if (method == TrimBoundsLayer) { number_images=GetImageListLength(image); for (scene=0; scene < (ssize_t) number_images; scene++) { image->page.x-=page.x; image->page.y-=page.y; image->page.width=width; image->page.height=height; proceed=SetImageProgress(image,MergeLayersTag,(MagickOffsetType) scene, number_images); if (proceed == MagickFalse) break; image=GetNextImageInList(image); if (image == (Image *) NULL) break; } return((Image *) NULL); } /* Create canvas size of width and height, and background color. */ canvas=CloneImage(image,width,height,MagickTrue,exception); if (canvas == (Image *) NULL) return((Image *) NULL); (void) SetImageBackgroundColor(canvas); canvas->page=page; canvas->dispose=UndefinedDispose; /* Compose images onto canvas, with progress monitor */ number_images=GetImageListLength(image); for (scene=0; scene < (ssize_t) number_images; scene++) { (void) CompositeImage(canvas,image->compose,image,image->page.x- canvas->page.x,image->page.y-canvas->page.y); proceed=SetImageProgress(image,MergeLayersTag,(MagickOffsetType) scene, number_images); if (proceed == MagickFalse) break; image=GetNextImageInList(image); if (image == (Image *) NULL) break; } return(canvas); } ",0 "void TestingAutomationProvider::ClickAppModalDialogButton(int button, bool* success) { *success = false; NativeAppModalDialog* native_dialog = AppModalDialogQueue::GetInstance()->active_dialog()->native_dialog(); if (native_dialog && (native_dialog->GetAppModalDialogButtons() & button) == button) { if ((button & ui::DIALOG_BUTTON_OK) == ui::DIALOG_BUTTON_OK) { native_dialog->AcceptAppModalDialog(); *success = true; } if ((button & ui::DIALOG_BUTTON_CANCEL) == ui::DIALOG_BUTTON_CANCEL) { DCHECK(!*success) << ""invalid param, OK and CANCEL specified""; native_dialog->CancelAppModalDialog(); *success = true; } } } ",0 "cdio_generic_unimplemented_set_blocksize (void *p_user_data, uint16_t i_blocksize) { /* Sort of a stub here. Perhaps log a message? */ return DRIVER_OP_UNSUPPORTED; } ",0 "nfsd4_set_closestateid(struct nfsd4_compound_state *cstate, struct nfsd4_close *close) { put_stateid(cstate, &close->cl_stateid); } ",0 "int shmem_unuse(swp_entry_t swap, struct page *page) { struct list_head *this, *next; struct shmem_inode_info *info; int found = 0; int error = 0; /* * There's a faint possibility that swap page was replaced before * caller locked it: caller will come back later with the right page. */ if (unlikely(!PageSwapCache(page) || page_private(page) != swap.val)) goto out; /* * Charge page using GFP_KERNEL while we can wait, before taking * the shmem_swaplist_mutex which might hold up shmem_writepage(). * Charged back to the user (not to caller) when swap account is used. */ error = mem_cgroup_cache_charge(page, current->mm, GFP_KERNEL); if (error) goto out; /* No radix_tree_preload: swap entry keeps a place for page in tree */ mutex_lock(&shmem_swaplist_mutex); list_for_each_safe(this, next, &shmem_swaplist) { info = list_entry(this, struct shmem_inode_info, swaplist); if (info->swapped) found = shmem_unuse_inode(info, swap, &page); else list_del_init(&info->swaplist); cond_resched(); if (found) break; } mutex_unlock(&shmem_swaplist_mutex); if (found < 0) error = found; out: unlock_page(page); page_cache_release(page); return error; } ",0 "status_t SampleIterator::seekTo(uint32_t sampleIndex) { ALOGV(""seekTo(%d)"", sampleIndex); if (sampleIndex >= mTable->mNumSampleSizes) { return ERROR_END_OF_STREAM; } if (mTable->mSampleToChunkOffset < 0 || mTable->mChunkOffsetOffset < 0 || mTable->mSampleSizeOffset < 0 || mTable->mTimeToSampleCount == 0) { return ERROR_MALFORMED; } if (mInitialized && mCurrentSampleIndex == sampleIndex) { return OK; } if (!mInitialized || sampleIndex < mFirstChunkSampleIndex) { reset(); } if (sampleIndex >= mStopChunkSampleIndex) { status_t err; if ((err = findChunkRange(sampleIndex)) != OK) { ALOGE(""findChunkRange failed""); return err; } } CHECK(sampleIndex < mStopChunkSampleIndex); if (mSamplesPerChunk == 0) { ALOGE(""b/22802344""); return ERROR_MALFORMED; } uint32_t chunk = (sampleIndex - mFirstChunkSampleIndex) / mSamplesPerChunk + mFirstChunk; if (!mInitialized || chunk != mCurrentChunkIndex) { mCurrentChunkIndex = chunk; status_t err; if ((err = getChunkOffset(chunk, &mCurrentChunkOffset)) != OK) { ALOGE(""getChunkOffset return error""); return err; } mCurrentChunkSampleSizes.clear(); uint32_t firstChunkSampleIndex = mFirstChunkSampleIndex + mSamplesPerChunk * (mCurrentChunkIndex - mFirstChunk); for (uint32_t i = 0; i < mSamplesPerChunk; ++i) { size_t sampleSize; if ((err = getSampleSizeDirect( firstChunkSampleIndex + i, &sampleSize)) != OK) { ALOGE(""getSampleSizeDirect return error""); return err; } mCurrentChunkSampleSizes.push(sampleSize); } } uint32_t chunkRelativeSampleIndex = (sampleIndex - mFirstChunkSampleIndex) % mSamplesPerChunk; mCurrentSampleOffset = mCurrentChunkOffset; for (uint32_t i = 0; i < chunkRelativeSampleIndex; ++i) { mCurrentSampleOffset += mCurrentChunkSampleSizes[i]; } mCurrentSampleSize = mCurrentChunkSampleSizes[chunkRelativeSampleIndex]; if (sampleIndex < mTTSSampleIndex) { mTimeToSampleIndex = 0; mTTSSampleIndex = 0; mTTSSampleTime = 0; mTTSCount = 0; mTTSDuration = 0; } status_t err; if ((err = findSampleTimeAndDuration( sampleIndex, &mCurrentSampleTime, &mCurrentSampleDuration)) != OK) { ALOGE(""findSampleTime return error""); return err; } mCurrentSampleIndex = sampleIndex; mInitialized = true; return OK; } ",1 "void BuildTabSpecifics(const std::string& tag, int window_id, int tab_id, sync_pb::SessionSpecifics* tab_base) { tab_base->set_session_tag(tag); sync_pb::SessionTab* tab = tab_base->mutable_tab(); tab->set_tab_id(tab_id); tab->set_tab_visual_index(1); tab->set_current_navigation_index(0); tab->set_pinned(true); tab->set_extension_app_id(""app_id""); sync_pb::TabNavigation* navigation = tab->add_navigation(); navigation->set_index(12); navigation->set_virtual_url(""http://foo/1""); navigation->set_referrer(""referrer""); navigation->set_title(""title""); navigation->set_page_transition(sync_pb::TabNavigation_PageTransition_TYPED); } ",0 "void WebGL2RenderingContextBase::uniform2iv( const WebGLUniformLocation* location, const FlexibleInt32ArrayView& v) { WebGLRenderingContextBase::uniform2iv(location, v); } ",0 "_gcry_register_pk_ecc_progress (void (*cb) (void *, const char *, int, int, int), void *cb_data) { progress_cb = cb; progress_cb_data = cb_data; } ",0 "void Browser::TabPinnedStateChanged(WebContents* contents, int index) { SessionService* session_service = SessionServiceFactory::GetForProfileIfExisting(profile()); if (session_service) { SessionTabHelper* session_tab_helper = SessionTabHelper::FromWebContents(contents); session_service->SetPinnedState(session_id(), session_tab_helper->session_id(), tab_strip_model_->IsTabPinned(index)); } } ",0 "static void NPN_PushPopupsEnabledState(NPP instance, NPBool enabled) { notImplemented(); } ",0 "static int cbcmac_create(struct crypto_template *tmpl, struct rtattr **tb) { struct shash_instance *inst; struct crypto_alg *alg; int err; err = crypto_check_attr_type(tb, CRYPTO_ALG_TYPE_SHASH); if (err) return err; alg = crypto_get_attr_alg(tb, CRYPTO_ALG_TYPE_CIPHER, CRYPTO_ALG_TYPE_MASK); if (IS_ERR(alg)) return PTR_ERR(alg); inst = shash_alloc_instance(""cbcmac"", alg); err = PTR_ERR(inst); if (IS_ERR(inst)) goto out_put_alg; err = crypto_init_spawn(shash_instance_ctx(inst), alg, shash_crypto_instance(inst), CRYPTO_ALG_TYPE_MASK); if (err) goto out_free_inst; inst->alg.base.cra_priority = alg->cra_priority; inst->alg.base.cra_blocksize = 1; inst->alg.digestsize = alg->cra_blocksize; inst->alg.descsize = ALIGN(sizeof(struct cbcmac_desc_ctx), alg->cra_alignmask + 1) + alg->cra_blocksize; inst->alg.base.cra_ctxsize = sizeof(struct cbcmac_tfm_ctx); inst->alg.base.cra_init = cbcmac_init_tfm; inst->alg.base.cra_exit = cbcmac_exit_tfm; inst->alg.init = crypto_cbcmac_digest_init; inst->alg.update = crypto_cbcmac_digest_update; inst->alg.final = crypto_cbcmac_digest_final; inst->alg.setkey = crypto_cbcmac_digest_setkey; err = shash_register_instance(tmpl, inst); out_free_inst: if (err) shash_free_instance(shash_crypto_instance(inst)); out_put_alg: crypto_mod_put(alg); return err; } ",0 "bool TabStrip::IsPointInTab(Tab* tab, const gfx::Point& point_in_tabstrip_coords) { gfx::Point point_in_tab_coords(point_in_tabstrip_coords); View::ConvertPointToTarget(this, tab, &point_in_tab_coords); return tab->HitTestPoint(point_in_tab_coords); } ",0 "void Document::dispatchEventsForPrinting() { if (!m_scriptedAnimationController) return; m_scriptedAnimationController->dispatchEventsAndCallbacksForPrinting(); } ",0 "void gd_stderr_error(int priority, const char *format, va_list args) { switch (priority) { case GD_ERROR: fputs(""GD Error: "", stderr); break; case GD_WARNING: fputs(""GD Warning: "", stderr); break; case GD_NOTICE: fputs(""GD Notice: "", stderr); break; case GD_INFO: fputs(""GD Info: "", stderr); break; case GD_DEBUG: fputs(""GD Debug: "", stderr); break; } vfprintf(stderr, format, args); fflush(stderr); } ",0 "static int v9fs_xattr_set_acl(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, const void *value, size_t size, int flags) { int retval; struct posix_acl *acl; struct v9fs_session_info *v9ses; v9ses = v9fs_dentry2v9ses(dentry); /* * set the attribute on the remote. Without even looking at the * xattr value. We leave it to the server to validate */ if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) return v9fs_xattr_set(dentry, handler->name, value, size, flags); if (S_ISLNK(inode->i_mode)) return -EOPNOTSUPP; if (!inode_owner_or_capable(inode)) return -EPERM; if (value) { /* update the cached acl value */ acl = posix_acl_from_xattr(&init_user_ns, value, size); if (IS_ERR(acl)) return PTR_ERR(acl); else if (acl) { retval = posix_acl_valid(inode->i_sb->s_user_ns, acl); if (retval) goto err_out; } } else acl = NULL; switch (handler->flags) { case ACL_TYPE_ACCESS: if (acl) { umode_t mode = inode->i_mode; retval = posix_acl_equiv_mode(acl, &mode); if (retval < 0) goto err_out; else { struct iattr iattr; if (retval == 0) { /* * ACL can be represented * by the mode bits. So don't * update ACL. */ acl = NULL; value = NULL; size = 0; } /* Updte the mode bits */ iattr.ia_mode = ((mode & S_IALLUGO) | (inode->i_mode & ~S_IALLUGO)); iattr.ia_valid = ATTR_MODE; /* FIXME should we update ctime ? * What is the following setxattr update the * mode ? */ v9fs_vfs_setattr_dotl(dentry, &iattr); } } break; case ACL_TYPE_DEFAULT: if (!S_ISDIR(inode->i_mode)) { retval = acl ? -EINVAL : 0; goto err_out; } break; default: BUG(); } retval = v9fs_xattr_set(dentry, handler->name, value, size, flags); if (!retval) set_cached_acl(inode, handler->flags, acl); err_out: posix_acl_release(acl); return retval; } ",1 "static u64 compute_guest_tsc(struct kvm_vcpu *vcpu, s64 kernel_ns) { u64 tsc = pvclock_scale_delta(kernel_ns-vcpu->arch.last_tsc_nsec, vcpu->kvm->arch.virtual_tsc_mult, vcpu->kvm->arch.virtual_tsc_shift); tsc += vcpu->arch.last_tsc_write; return tsc; } ",0 "asmlinkage void __kprobes do_page_fault(struct pt_regs *regs, unsigned long writeaccess, unsigned long address) { unsigned long vec; struct task_struct *tsk; struct mm_struct *mm; struct vm_area_struct * vma; int si_code; int fault; siginfo_t info; tsk = current; mm = tsk->mm; si_code = SEGV_MAPERR; vec = lookup_exception_vector(); /* * We fault-in kernel-space virtual memory on-demand. The * 'reference' page table is init_mm.pgd. * * NOTE! We MUST NOT take any locks for this case. We may * be in an interrupt or a critical region, and should * only copy the information from the master page table, * nothing more. */ if (unlikely(fault_in_kernel_space(address))) { if (vmalloc_fault(address) >= 0) return; if (notify_page_fault(regs, vec)) return; goto bad_area_nosemaphore; } if (unlikely(notify_page_fault(regs, vec))) return; /* Only enable interrupts if they were on before the fault */ if ((regs->sr & SR_IMASK) != SR_IMASK) local_irq_enable(); perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, 0, regs, address); /* * If we're in an interrupt, have no user context or are running * in an atomic region then we must not take the fault: */ if (in_atomic() || !mm) goto no_context; down_read(&mm->mmap_sem); vma = find_vma(mm, address); if (!vma) goto bad_area; if (vma->vm_start <= address) goto good_area; if (!(vma->vm_flags & VM_GROWSDOWN)) goto bad_area; if (expand_stack(vma, address)) goto bad_area; /* * Ok, we have a good vm_area for this memory access, so * we can handle it.. */ good_area: si_code = SEGV_ACCERR; if (writeaccess) { if (!(vma->vm_flags & VM_WRITE)) goto bad_area; } else { if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) goto bad_area; } /* * If for any reason at all we couldn't handle the fault, * make sure we exit gracefully rather than endlessly redo * the fault. */ fault = handle_mm_fault(mm, vma, address, writeaccess ? FAULT_FLAG_WRITE : 0); if (unlikely(fault & VM_FAULT_ERROR)) { if (fault & VM_FAULT_OOM) goto out_of_memory; else if (fault & VM_FAULT_SIGBUS) goto do_sigbus; BUG(); } if (fault & VM_FAULT_MAJOR) { tsk->maj_flt++; perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MAJ, 1, 0, regs, address); } else { tsk->min_flt++; perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS_MIN, 1, 0, regs, address); } up_read(&mm->mmap_sem); return; /* * Something tried to access memory that isn't in our memory map.. * Fix it, but check if it's kernel or user first.. */ bad_area: up_read(&mm->mmap_sem); bad_area_nosemaphore: if (user_mode(regs)) { info.si_signo = SIGSEGV; info.si_errno = 0; info.si_code = si_code; info.si_addr = (void *) address; force_sig_info(SIGSEGV, &info, tsk); return; } no_context: /* Are we prepared to handle this kernel fault? */ if (fixup_exception(regs)) return; if (handle_trapped_io(regs, address)) return; /* * Oops. The kernel tried to access some bad page. We'll have to * terminate things with extreme prejudice. * */ bust_spinlocks(1); if (oops_may_print()) { unsigned long page; if (address < PAGE_SIZE) printk(KERN_ALERT ""Unable to handle kernel NULL "" ""pointer dereference""); else printk(KERN_ALERT ""Unable to handle kernel paging "" ""request""); printk("" at virtual address %08lx\n"", address); printk(KERN_ALERT ""pc = %08lx\n"", regs->pc); page = (unsigned long)get_TTB(); if (page) { page = ((__typeof__(page) *)page)[address >> PGDIR_SHIFT]; printk(KERN_ALERT ""*pde = %08lx\n"", page); if (page & _PAGE_PRESENT) { page &= PAGE_MASK; address &= 0x003ff000; page = ((__typeof__(page) *) __va(page))[address >> PAGE_SHIFT]; printk(KERN_ALERT ""*pte = %08lx\n"", page); } } } die(""Oops"", regs, writeaccess); bust_spinlocks(0); do_exit(SIGKILL); /* * We ran out of memory, or some other thing happened to us that made * us unable to handle the page fault gracefully. */ out_of_memory: up_read(&mm->mmap_sem); if (!user_mode(regs)) goto no_context; pagefault_out_of_memory(); return; do_sigbus: up_read(&mm->mmap_sem); /* * Send a sigbus, regardless of whether we were in kernel * or user mode. */ info.si_signo = SIGBUS; info.si_errno = 0; info.si_code = BUS_ADRERR; info.si_addr = (void *)address; force_sig_info(SIGBUS, &info, tsk); /* Kernel mode? Handle exceptions or die */ if (!user_mode(regs)) goto no_context; } ",1 "static struct task *h2_timeout_task(struct task *t) { struct h2c *h2c = t->context; int expired = tick_is_expired(t->expire, now_ms); if (!expired && h2c) return t; task_delete(t); task_free(t); if (!h2c) { /* resources were already deleted */ return NULL; } h2c->task = NULL; h2c_error(h2c, H2_ERR_NO_ERROR); h2_wake_some_streams(h2c, 0, 0); if (h2c->mbuf->o) { /* don't even try to send a GOAWAY, the buffer is stuck */ h2c->flags |= H2_CF_GOAWAY_FAILED; } /* try to send but no need to insist */ h2c->last_sid = h2c->max_id; if (h2c_send_goaway_error(h2c, NULL) <= 0) h2c->flags |= H2_CF_GOAWAY_FAILED; if (h2c->mbuf->o && !(h2c->flags & H2_CF_GOAWAY_FAILED) && conn_xprt_ready(h2c->conn)) h2c->conn->xprt->snd_buf(h2c->conn, h2c->mbuf, 0); /* either we can release everything now or it will be done later once * the last stream closes. */ if (eb_is_empty(&h2c->streams_by_id)) h2_release(h2c->conn); return NULL; } ",0 "vmxnet3_io_bar0_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { VMXNET3State *s = opaque; if (VMW_IS_MULTIREG_ADDR(addr, VMXNET3_REG_TXPROD, VMXNET3_DEVICE_MAX_TX_QUEUES, VMXNET3_REG_ALIGN)) { int tx_queue_idx = return; } if (VMW_IS_MULTIREG_ADDR(addr, VMXNET3_REG_IMR, VMXNET3_MAX_INTRS, VMXNET3_REG_ALIGN)) { int l = VMW_MULTIREG_IDX_BY_ADDR(addr, VMXNET3_REG_IMR, VMXNET3_REG_ALIGN); VMW_CBPRN(""Interrupt mask for line %d written: 0x%"" PRIx64, l, val); vmxnet3_on_interrupt_mask_changed(s, l, val); return; } if (VMW_IS_MULTIREG_ADDR(addr, VMXNET3_REG_RXPROD, VMXNET3_DEVICE_MAX_RX_QUEUES, VMXNET3_REG_ALIGN) || VMW_IS_MULTIREG_ADDR(addr, VMXNET3_REG_RXPROD2, VMXNET3_DEVICE_MAX_RX_QUEUES, VMXNET3_REG_ALIGN)) { return; } VMW_WRPRN(""BAR0 unknown write [%"" PRIx64 ""] = %"" PRIx64 "", size %d"", (uint64_t) addr, val, size); } ",1 "QtBuiltinBundlePage::QtBuiltinBundlePage(QtBuiltinBundle* bundle, WKBundlePageRef page) : m_bundle(bundle) , m_page(page) , m_navigatorQtObject(0) , m_navigatorQtObjectEnabled(false) { WKBundlePageLoaderClient loaderClient = { kWKBundlePageLoaderClientCurrentVersion, this, 0, // didStartProvisionalLoadForFrame 0, // didReceiveServerRedirectForProvisionalLoadForFrame 0, // didFailProvisionalLoadWithErrorForFrame 0, // didCommitLoadForFrame 0, // didFinishDocumentLoadForFrame 0, // didFinishLoadForFrame 0, // didFailLoadWithErrorForFrame 0, // didSameDocumentNavigationForFrame 0, // didReceiveTitleForFrame 0, // didFirstLayoutForFrame 0, // didFirstVisuallyNonEmptyLayoutForFrame 0, // didRemoveFrameFromHierarchy 0, // didDisplayInsecureContentForFrame 0, // didRunInsecureContentForFrame didClearWindowForFrame, 0, // didCancelClientRedirectForFrame 0, // willPerformClientRedirectForFrame 0, // didHandleOnloadEventsForFrame 0, // didLayoutForFrame 0, // didNewFirstVisuallyNonEmptyLayoutForFrame 0, // didDetectXSSForFrame 0, // shouldGoToBackForwardListItem 0, // didCreateGlobalObjectForFrame 0, // willDisconnectDOMWindowExtensionFromGlobalObject 0, // didReconnectDOMWindowExtensionToGlobalObject 0, // willDestroyGlobalObjectForDOMWindowExtension 0, // didFinishProgress 0, // shouldForceUniversalAccessFromLocalURL 0, // didLayout }; WKBundlePageSetPageLoaderClient(m_page, &loaderClient); } ",1 "void limit_string(char *name) { int i; if (!name) return; if (strlen(name) < NAME_LENGTH_LIMIT) return; i = NAME_LENGTH_LIMIT-4; name[i++] = '.'; name[i++] = '.'; name[i++] = '.'; name[i] = '\0'; return; } ",0 "void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) { Send(new AccessibilityMsg_SetFocus(GetRoutingID(), object_id)); } ",0 "void GLES2DecoderImpl::DoUniform1iv( GLint fake_location, GLsizei count, const GLint *value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation( fake_location, ""glUniform1iv"", &real_location, &type, &count)) { return; } if (type == GL_SAMPLER_2D || type == GL_SAMPLER_2D_RECT_ARB || type == GL_SAMPLER_CUBE || type == GL_SAMPLER_EXTERNAL_OES) { if (!current_program_->SetSamplers( group_->max_texture_units(), fake_location, count, value)) { SetGLError(GL_INVALID_VALUE, ""glUniform1iv"", ""texture unit out of range""); return; } } glUniform1iv(real_location, count, value); } ",0 "void VRDisplay::OnVSyncConnectionError() { vr_v_sync_provider_.reset(); if (v_sync_connection_failed_) return; ConnectVSyncProvider(); v_sync_connection_failed_ = true; } ",0 "static void VoidMethodShortArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""voidMethodShortArg""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } int16_t short_arg; short_arg = NativeValueTraits::NativeValue(info.GetIsolate(), info[0], exception_state); if (exception_state.HadException()) return; impl->voidMethodShortArg(short_arg); } ",0 "int handle_mm_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, unsigned int flags) { pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t *pte; __set_current_state(TASK_RUNNING); count_vm_event(PGFAULT); mem_cgroup_count_vm_event(mm, PGFAULT); /* do counter updates before entering really critical section. */ check_sync_rss_stat(current); if (unlikely(is_vm_hugetlb_page(vma))) return hugetlb_fault(mm, vma, address, flags); pgd = pgd_offset(mm, address); pud = pud_alloc(mm, pgd, address); if (!pud) return VM_FAULT_OOM; pmd = pmd_alloc(mm, pud, address); if (!pmd) return VM_FAULT_OOM; if (pmd_none(*pmd) && transparent_hugepage_enabled(vma)) { if (!vma->vm_ops) return do_huge_pmd_anonymous_page(mm, vma, address, pmd, flags); } else { pmd_t orig_pmd = *pmd; barrier(); if (pmd_trans_huge(orig_pmd)) { if (flags & FAULT_FLAG_WRITE && !pmd_write(orig_pmd) && !pmd_trans_splitting(orig_pmd)) return do_huge_pmd_wp_page(mm, vma, address, pmd, orig_pmd); return 0; } } /* * Use __pte_alloc instead of pte_alloc_map, because we can't * run pte_offset_map on the pmd, if an huge pmd could * materialize from under us from a different thread. */ if (unlikely(pmd_none(*pmd)) && __pte_alloc(mm, vma, pmd, address)) return VM_FAULT_OOM; /* if an huge pmd materialized from under us just retry later */ if (unlikely(pmd_trans_huge(*pmd))) return 0; /* * A regular pmd is established and it can't morph into a huge pmd * from under us anymore at this point because we hold the mmap_sem * read mode and khugepaged takes it in write mode. So now it's * safe to run pte_offset_map(). */ pte = pte_offset_map(pmd, address); return handle_pte_fault(mm, vma, address, pte, pmd, flags); } ",0 "static void rt_add_uncached_list(struct rtable *rt) { struct uncached_list *ul = raw_cpu_ptr(&rt_uncached_list); rt->rt_uncached_list = ul; spin_lock_bh(&ul->lock); list_add_tail(&rt->rt_uncached, &ul->head); spin_unlock_bh(&ul->lock); } ",0 "IHEVCD_ERROR_T ihevcd_get_tile_pos(pps_t *ps_pps, sps_t *ps_sps, WORD32 ctb_x, WORD32 ctb_y, WORD32 *pi4_ctb_tile_x, WORD32 *pi4_ctb_tile_y, WORD32 *pi4_tile_idx) { tile_t *ps_tile_tmp; WORD32 i; WORD32 tile_row, tile_col; if(ctb_x < 0 || ctb_y < 0) { *pi4_ctb_tile_x = 0; *pi4_ctb_tile_y = 0; *pi4_tile_idx = 0; return (IHEVCD_ERROR_T)IHEVCD_SUCCESS; } tile_row = 0; tile_col = 0; ps_tile_tmp = ps_pps->ps_tile; if(0 == ps_pps->i1_tiles_enabled_flag) { *pi4_ctb_tile_x = ctb_x; *pi4_ctb_tile_y = ctb_y; *pi4_tile_idx = 0; } else { for(i = 0; i < ps_pps->i1_num_tile_columns; i++) { WORD16 next_tile_ctb_x; ps_tile_tmp = ps_pps->ps_tile + i; //* ps_pps->i1_num_tile_rows; if((ps_pps->i1_num_tile_columns - 1) == i) { next_tile_ctb_x = ps_sps->i2_pic_wd_in_ctb; } else { tile_t *ps_tile_next_tmp; ps_tile_next_tmp = ps_pps->ps_tile + i + 1; next_tile_ctb_x = ps_tile_next_tmp->u1_pos_x; } if((ctb_x >= ps_tile_tmp->u1_pos_x) && (ctb_x < next_tile_ctb_x)) { tile_col = i; break; } } *pi4_ctb_tile_x = ctb_x - ps_tile_tmp->u1_pos_x; for(i = 0; i < ps_pps->i1_num_tile_rows; i++) { WORD16 next_tile_ctb_y; ps_tile_tmp = ps_pps->ps_tile + i * ps_pps->i1_num_tile_columns; if((ps_pps->i1_num_tile_rows - 1) == i) { next_tile_ctb_y = ps_sps->i2_pic_ht_in_ctb; } else { tile_t *ps_tile_next_tmp; ps_tile_next_tmp = ps_pps->ps_tile + ((i + 1) * ps_pps->i1_num_tile_columns); next_tile_ctb_y = ps_tile_next_tmp->u1_pos_y; } if((ctb_y >= ps_tile_tmp->u1_pos_y) && (ctb_y < next_tile_ctb_y)) { tile_row = i; break; } } *pi4_ctb_tile_y = ctb_y - ps_tile_tmp->u1_pos_y; *pi4_tile_idx = tile_row * ps_pps->i1_num_tile_columns + tile_col; } return (IHEVCD_ERROR_T)IHEVCD_SUCCESS; } ",0 "static void php_array_element_export(zval *zv, zend_ulong index, zend_string *key, int level, smart_str *buf) /* {{{ */ { if (key == NULL) { /* numeric key */ buffer_append_spaces(buf, level+1); smart_str_append_long(buf, (zend_long) index); smart_str_appendl(buf, "" => "", 4); } else { /* string key */ zend_string *tmp_str; zend_string *ckey = php_addcslashes(key, 0, ""'\\"", 2); tmp_str = php_str_to_str(ZSTR_VAL(ckey), ZSTR_LEN(ckey), ""\0"", 1, ""' . \""\\0\"" . '"", 12); buffer_append_spaces(buf, level + 1); smart_str_appendc(buf, '\''); smart_str_append(buf, tmp_str); smart_str_appendl(buf, ""' => "", 5); zend_string_free(ckey); zend_string_free(tmp_str); } php_var_export_ex(zv, level + 2, buf); smart_str_appendc(buf, ','); smart_str_appendc(buf, '\n'); } /* }}} */ ",0 "header_newc(struct archive_read *a, struct cpio *cpio, struct archive_entry *entry, size_t *namelength, size_t *name_pad) { const void *h; const char *header; int r; r = find_newc_header(a); if (r < ARCHIVE_WARN) return (r); /* Read fixed-size portion of header. */ h = __archive_read_ahead(a, newc_header_size, NULL); if (h == NULL) return (ARCHIVE_FATAL); /* Parse out hex fields. */ header = (const char *)h; if (memcmp(header + newc_magic_offset, ""070701"", 6) == 0) { a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_NOCRC; a->archive.archive_format_name = ""ASCII cpio (SVR4 with no CRC)""; } else if (memcmp(header + newc_magic_offset, ""070702"", 6) == 0) { a->archive.archive_format = ARCHIVE_FORMAT_CPIO_SVR4_CRC; a->archive.archive_format_name = ""ASCII cpio (SVR4 with CRC)""; } else { /* TODO: Abort here? */ } archive_entry_set_devmajor(entry, (dev_t)atol16(header + newc_devmajor_offset, newc_devmajor_size)); archive_entry_set_devminor(entry, (dev_t)atol16(header + newc_devminor_offset, newc_devminor_size)); archive_entry_set_ino(entry, atol16(header + newc_ino_offset, newc_ino_size)); archive_entry_set_mode(entry, (mode_t)atol16(header + newc_mode_offset, newc_mode_size)); archive_entry_set_uid(entry, atol16(header + newc_uid_offset, newc_uid_size)); archive_entry_set_gid(entry, atol16(header + newc_gid_offset, newc_gid_size)); archive_entry_set_nlink(entry, (unsigned int)atol16(header + newc_nlink_offset, newc_nlink_size)); archive_entry_set_rdevmajor(entry, (dev_t)atol16(header + newc_rdevmajor_offset, newc_rdevmajor_size)); archive_entry_set_rdevminor(entry, (dev_t)atol16(header + newc_rdevminor_offset, newc_rdevminor_size)); archive_entry_set_mtime(entry, atol16(header + newc_mtime_offset, newc_mtime_size), 0); *namelength = (size_t)atol16(header + newc_namesize_offset, newc_namesize_size); /* Pad name to 2 more than a multiple of 4. */ *name_pad = (2 - *namelength) & 3; /* * Note: entry_bytes_remaining is at least 64 bits and * therefore guaranteed to be big enough for a 33-bit file * size. */ cpio->entry_bytes_remaining = atol16(header + newc_filesize_offset, newc_filesize_size); archive_entry_set_size(entry, cpio->entry_bytes_remaining); /* Pad file contents to a multiple of 4. */ cpio->entry_padding = 3 & -cpio->entry_bytes_remaining; __archive_read_consume(a, newc_header_size); return (r); } ",0 " static void TerminateWorkerOnIOThread(scoped_refptr worker_data) { if (WorkerService::GetInstance()->TerminateWorker( worker_data->worker_process_id, worker_data->worker_route_id)) { WorkerService::GetInstance()->AddObserver( new WorkerTerminationObserver(worker_data.get())); return; } FAIL() << ""Failed to terminate worker.\n""; } ",0 "void TabStrip::GetCurrentTabWidths(double* unselected_width, double* selected_width) const { *unselected_width = current_unselected_width_; *selected_width = current_selected_width_; } ",0 "PassRefPtr HTMLSelectElement::create(const QualifiedName& tagName, Document* document, HTMLFormElement* form, bool createdByParser) { ASSERT(tagName.matches(selectTag)); return adoptRef(new HTMLSelectElement(tagName, document, form, createdByParser)); } ",0 "void TabletModeWindowManager::RemoveWindowCreationObservers() { for (aura::Window* window : observed_container_windows_) window->RemoveObserver(this); observed_container_windows_.clear(); } ",0 "bool PictureLayerImpl::ShouldAdjustRasterScale() const { if (was_screen_space_transform_animating_ != draw_properties().screen_space_transform_is_animating) return true; if (draw_properties().screen_space_transform_is_animating && raster_contents_scale_ != ideal_contents_scale_ && ShouldAdjustRasterScaleDuringScaleAnimations()) return true; bool is_pinching = layer_tree_impl()->PinchGestureActive(); if (is_pinching && raster_page_scale_) { float ratio = ideal_page_scale_ / raster_page_scale_; if (raster_page_scale_ > ideal_page_scale_ || ratio > kMaxScaleRatioDuringPinch) return true; } if (!is_pinching) { if (raster_page_scale_ != ideal_page_scale_) return true; } if (raster_device_scale_ != ideal_device_scale_) return true; if (!draw_properties().screen_space_transform_is_animating && !raster_source_scale_is_fixed_ && raster_source_scale_ != ideal_source_scale_) return true; return false; } ",0 "record_peer_stats( sockaddr_u *addr, int status, double offset, /* offset */ double delay, /* delay */ double dispersion, /* dispersion */ double jitter /* jitter */ ) { l_fp now; u_long day; if (!stats_control) return; get_systime(&now); filegen_setup(&peerstats, now.l_ui); day = now.l_ui / 86400 + MJD_1900; now.l_ui %= 86400; if (peerstats.fp != NULL) { fprintf(peerstats.fp, ""%lu %s %s %x %.9f %.9f %.9f %.9f\n"", day, ulfptoa(&now, 3), stoa(addr), status, offset, delay, dispersion, jitter); fflush(peerstats.fp); } } ",0 "int ShelfLayoutManager::GetWorkAreaInsets(const State& state, int size) const { if (IsKeyboardShown()) return 0; if (state.visibility_state == SHELF_VISIBLE) return size; return 0; } ",0 "int64 MakeNodeWithParent(UserShare* share, ModelType model_type, const std::string& client_tag, int64 parent_id) { WriteTransaction trans(FROM_HERE, share); ReadNode parent_node(&trans); EXPECT_TRUE(parent_node.InitByIdLookup(parent_id)); WriteNode node(&trans); EXPECT_TRUE(node.InitUniqueByCreation(model_type, parent_node, client_tag)); node.SetIsFolder(false); return node.GetId(); } ",0 "FetchManager::Loader::~Loader() { DCHECK(!threadable_loader_); } ",0 "CanvasRenderingContextFactory* HTMLCanvasElement::GetRenderingContextFactory( int type) { DCHECK_LE(type, CanvasRenderingContext::kMaxValue); return RenderingContextFactories()[type].get(); } ",0 " render_state_set_resolution( RenderState state, int resolution ) { state->resolution = resolution; state->need_rescale = 1; } ",0 "CString TextCodecUTF8::Encode(const LChar* characters, wtf_size_t length, UnencodableHandling) { return EncodeCommon(characters, length); } ",0 "void RenderWidgetHostViewGtk::CopyFromCompositingSurface( const gfx::Rect& src_subrect, const gfx::Size& /* dst_size */, const base::Callback& callback, skia::PlatformBitmap* output) { base::ScopedClosureRunner scoped_callback_runner(base::Bind(callback, false)); gfx::Rect src_subrect_in_view = src_subrect; src_subrect_in_view.Offset(GetViewBounds().OffsetFromOrigin()); ui::XScopedImage image(XGetImage(ui::GetXDisplay(), ui::GetX11RootWindow(), src_subrect_in_view.x(), src_subrect_in_view.y(), src_subrect_in_view.width(), src_subrect_in_view.height(), AllPlanes, ZPixmap)); if (!image.get()) return; if (!output->Allocate(src_subrect.width(), src_subrect.height(), true)) return; const SkBitmap& bitmap = output->GetBitmap(); const size_t bitmap_size = bitmap.getSize(); DCHECK_EQ(bitmap_size, static_cast(image->height * image->bytes_per_line)); unsigned char* pixels = static_cast(bitmap.getPixels()); memcpy(pixels, image->data, bitmap_size); scoped_callback_runner.Release(); callback.Run(true); } ",0 "void RenderWidgetHostImpl::SetView(RenderWidgetHostViewBase* view) { if (view) { view_ = view->GetWeakPtr(); if (enable_viz_) { if (!create_frame_sink_callback_.is_null()) std::move(create_frame_sink_callback_).Run(view_->GetFrameSinkId()); } else { if (renderer_compositor_frame_sink_.is_bound()) { view->DidCreateNewRendererCompositorFrameSink( renderer_compositor_frame_sink_.get()); } if (needs_begin_frames_) view_->SetNeedsBeginFrames(needs_begin_frames_); } } else { view_.reset(); } synthetic_gesture_controller_.reset(); } ",0 "static int set_hid_interface(struct libusb_context* ctx, struct libusb_device* dev, char* dev_interface_path) { int i; struct windows_device_priv *priv = _device_priv(dev); if (priv->hid == NULL) { usbi_err(ctx, ""program assertion failed: parent is not HID""); return LIBUSB_ERROR_NO_DEVICE; } if (priv->hid->nb_interfaces == USB_MAXINTERFACES) { usbi_err(ctx, ""program assertion failed: max USB interfaces reached for HID device""); return LIBUSB_ERROR_NO_DEVICE; } for (i=0; ihid->nb_interfaces; i++) { if (safe_strcmp(priv->usb_interface[i].path, dev_interface_path) == 0) { usbi_dbg(""interface[%d] already set to %s"", i, dev_interface_path); return LIBUSB_SUCCESS; } } priv->usb_interface[priv->hid->nb_interfaces].path = dev_interface_path; priv->usb_interface[priv->hid->nb_interfaces].apib = &usb_api_backend[USB_API_HID]; usbi_dbg(""interface[%d] = %s"", priv->hid->nb_interfaces, dev_interface_path); priv->hid->nb_interfaces++; return LIBUSB_SUCCESS; } ",1 "void ChromeDownloadManagerDelegate::SetDownloadManager(DownloadManager* dm) { download_manager_ = dm; safe_browsing::SafeBrowsingService* sb_service = g_browser_process->safe_browsing_service(); if (sb_service && !profile_->IsOffTheRecord()) { sb_service->AddDownloadManager(dm); } } ",0 "static int zend_merge_property(zval **value TSRMLS_DC, int num_args, va_list args, const zend_hash_key *hash_key) /* {{{ */ { /* which name should a numeric property have ? */ if (hash_key->nKeyLength) { zval *obj = va_arg(args, zval *); zend_object_handlers *obj_ht = va_arg(args, zend_object_handlers *); zval *member; MAKE_STD_ZVAL(member); ZVAL_STRINGL(member, hash_key->arKey, hash_key->nKeyLength-1, 1); obj_ht->write_property(obj, member, *value, 0 TSRMLS_CC); zval_ptr_dtor(&member); } return ZEND_HASH_APPLY_KEEP; } /* }}} */ ",0 "SYSCALL_DEFINE3(socket, int, family, int, type, int, protocol) { return __sys_socket(family, type, protocol); } ",0 "int virtqueue_pop(VirtQueue *vq, VirtQueueElement *elem) { unsigned int i, head, max; hwaddr desc_pa = vq->vring.desc; if (!virtqueue_num_heads(vq, vq->last_avail_idx)) return 0; /* When we start there are none of either input nor output. */ elem->out_num = elem->in_num = 0; max = vq->vring.num; i = head = virtqueue_get_head(vq, vq->last_avail_idx++); if (vq->vdev->guest_features & (1 << VIRTIO_RING_F_EVENT_IDX)) { vring_avail_event(vq, vring_avail_idx(vq)); } if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_INDIRECT) { if (vring_desc_len(desc_pa, i) % sizeof(VRingDesc)) { error_report(""Invalid size for indirect buffer table""); exit(1); } /* loop over the indirect descriptor table */ max = vring_desc_len(desc_pa, i) / sizeof(VRingDesc); desc_pa = vring_desc_addr(desc_pa, i); i = 0; } /* Collect all the descriptors */ do { struct iovec *sg; if (vring_desc_flags(desc_pa, i) & VRING_DESC_F_WRITE) { if (elem->in_num >= ARRAY_SIZE(elem->in_sg)) { error_report(""Too many write descriptors in indirect table""); exit(1); } elem->in_addr[elem->in_num] = vring_desc_addr(desc_pa, i); sg = &elem->in_sg[elem->in_num++]; } else { if (elem->out_num >= ARRAY_SIZE(elem->out_sg)) { error_report(""Too many read descriptors in indirect table""); exit(1); } elem->out_addr[elem->out_num] = vring_desc_addr(desc_pa, i); sg = &elem->out_sg[elem->out_num++]; } sg->iov_len = vring_desc_len(desc_pa, i); /* If we've got too many, that implies a descriptor loop. */ if ((elem->in_num + elem->out_num) > max) { error_report(""Looped descriptor""); exit(1); } } while ((i = virtqueue_next_desc(desc_pa, i, max)) != max); /* Now map what we have collected */ virtqueue_map_sg(elem->in_sg, elem->in_addr, elem->in_num, 1); virtqueue_map_sg(elem->out_sg, elem->out_addr, elem->out_num, 0); elem->index = head; vq->inuse++; trace_virtqueue_pop(vq, elem, elem->in_num, elem->out_num); return elem->in_num + elem->out_num; } ",0 "static void vapic_write(void *opaque, hwaddr addr, uint64_t data, unsigned int size) { VAPICROMState *s = opaque; X86CPU *cpu; CPUX86State *env; hwaddr rom_paddr; if (!current_cpu) { return; } cpu_synchronize_state(current_cpu); cpu = X86_CPU(current_cpu); env = &cpu->env; /* * The VAPIC supports two PIO-based hypercalls, both via port 0x7E. * o 16-bit write access: * Reports the option ROM initialization to the hypervisor. Written * value is the offset of the state structure in the ROM. * o 8-bit write access: * Reactivates the VAPIC after a guest hibernation, i.e. after the * option ROM content has been re-initialized by a guest power cycle. * o 32-bit write access: * Poll for pending IRQs, considering the current VAPIC state. */ switch (size) { case 2: if (s->state == VAPIC_INACTIVE) { rom_paddr = (env->segs[R_CS].base + env->eip) & ROM_BLOCK_MASK; s->rom_state_paddr = rom_paddr + data; s->state = VAPIC_STANDBY; } if (vapic_prepare(s) < 0) { s->state = VAPIC_INACTIVE; s->rom_state_paddr = 0; break; } break; case 1: if (kvm_enabled()) { /* * Disable triggering instruction in ROM by writing a NOP. * * We cannot do this in TCG mode as the reported IP is not * accurate. */ pause_all_vcpus(); patch_byte(cpu, env->eip - 2, 0x66); patch_byte(cpu, env->eip - 1, 0x90); resume_all_vcpus(); } if (s->state == VAPIC_ACTIVE) { break; } if (update_rom_mapping(s, env, env->eip) < 0) { break; } if (find_real_tpr_addr(s, env) < 0) { break; } vapic_enable(s, cpu); break; default: case 4: if (!kvm_irqchip_in_kernel()) { apic_poll_irq(cpu->apic_state); } break; } } ",0 "nfs_update_shareopts(sa_share_impl_t impl_share, const char *resource, const char *shareopts) { char *shareopts_dup; boolean_t needs_reshare = B_FALSE; char *old_shareopts; FSINFO(impl_share, nfs_fstype)->active = nfs_is_share_active(impl_share); old_shareopts = FSINFO(impl_share, nfs_fstype)->shareopts; if (strcmp(shareopts, ""on"") == 0) shareopts = ""rw""; if (FSINFO(impl_share, nfs_fstype)->active && old_shareopts != NULL && strcmp(old_shareopts, shareopts) != 0) { needs_reshare = B_TRUE; nfs_disable_share(impl_share); } shareopts_dup = strdup(shareopts); if (shareopts_dup == NULL) return (SA_NO_MEMORY); if (old_shareopts != NULL) free(old_shareopts); FSINFO(impl_share, nfs_fstype)->shareopts = shareopts_dup; if (needs_reshare) nfs_enable_share(impl_share); return (SA_OK); } ",0 "static void update_flush(rdpContext* context) { rdpUpdate* update = context->update; if (update->numberOrders > 0) { update->EndPaint(context); update->BeginPaint(context); } } ",0 "static int __init hmac_module_init(void) { return crypto_register_template(&hmac_tmpl); } ",0 "void IndexedDBDatabase::FilterObservation(IndexedDBTransaction* transaction, int64_t object_store_id, blink::mojom::IDBOperationType type, const IndexedDBKeyRange& key_range, const IndexedDBValue* value) { for (auto* connection : connections_) { bool recorded = false; for (const auto& observer : connection->active_observers()) { if (!observer->IsRecordingType(type) || !observer->IsRecordingObjectStore(object_store_id)) continue; if (!recorded) { auto observation = blink::mojom::IDBObservation::New(); observation->object_store_id = object_store_id; observation->type = type; if (type != blink::mojom::IDBOperationType::Clear) observation->key_range = key_range; transaction->AddObservation(connection->id(), std::move(observation)); recorded = true; } blink::mojom::IDBObserverChangesPtr& changes = *transaction->GetPendingChangesForConnection(connection->id()); changes->observation_index_map[observer->id()].push_back( changes->observations.size() - 1); if (value && observer->values() && !changes->observations.back()->value) { IndexedDBValue copy = *value; changes->observations.back()->value = IndexedDBValue::ConvertAndEraseValue(©); } } } } ",0 "void GpuChannelHost::AddRoute( int route_id, base::WeakPtr listener) { DCHECK(MessageLoopProxy::current()); scoped_refptr io_loop = factory_->GetIOLoopProxy(); io_loop->PostTask(FROM_HERE, base::Bind(&GpuChannelHost::MessageFilter::AddRoute, channel_filter_.get(), route_id, listener, MessageLoopProxy::current())); } ",0 "ui::PageTransition GetTransitionType(blink::WebDocumentLoader* document_loader, bool is_main_frame, bool loading) { NavigationState* navigation_state = NavigationState::FromDocumentLoader(document_loader); ui::PageTransition default_transition = navigation_state->IsContentInitiated() ? ui::PAGE_TRANSITION_LINK : navigation_state->common_params().transition; if (navigation_state->WasWithinSameDocument()) return default_transition; if (loading || document_loader->GetResponse().IsNull()) { return GetTransitionType( default_transition, document_loader->ReplacesCurrentHistoryItem(), is_main_frame, document_loader->GetNavigationType()); } return default_transition; } ",0 "buf_matches_at_pos(const buf_pos_t *pos, const char *s, size_t n) { buf_pos_t p; if (!n) return 1; memcpy(&p, pos, sizeof(p)); while (1) { char ch = p.chunk->data[p.pos]; if (ch != *s) return 0; ++s; /* If we're out of characters that don't match, we match. Check this * _before_ we test incrementing pos, in case we're at the end of the * string. */ if (--n == 0) return 1; if (buf_pos_inc(&p)<0) return 0; } } ",0 "void BinaryUploadService::ValidateDataUploadRequestCallback( BinaryUploadService::Result result, DeepScanningClientResponse response) { pending_validate_data_upload_request_ = false; can_upload_data_ = result == BinaryUploadService::Result::SUCCESS; RunAuthorizationCallbacks(); } ",0 "void gnra_del(GF_Box *s) { GF_GenericAudioSampleEntryBox *ptr = (GF_GenericAudioSampleEntryBox *)s; gf_isom_sample_entry_predestroy((GF_SampleEntryBox *)ptr); if (ptr->data) gf_free(ptr->data); gf_free(ptr); } ",0 "PositionWithAffinity RenderBlock::positionForPointWithInlineChildren(const LayoutPoint& pointInLogicalContents) { ASSERT(childrenInline()); if (!firstRootBox()) return createPositionWithAffinity(0, DOWNSTREAM); bool linesAreFlipped = style()->isFlippedLinesWritingMode(); bool blocksAreFlipped = style()->isFlippedBlocksWritingMode(); InlineBox* closestBox = 0; RootInlineBox* firstRootBoxWithChildren = 0; RootInlineBox* lastRootBoxWithChildren = 0; for (RootInlineBox* root = firstRootBox(); root; root = root->nextRootBox()) { if (!root->firstLeafChild()) continue; if (!firstRootBoxWithChildren) firstRootBoxWithChildren = root; if (!linesAreFlipped && root->isFirstAfterPageBreak() && (pointInLogicalContents.y() < root->lineTopWithLeading() || (blocksAreFlipped && pointInLogicalContents.y() == root->lineTopWithLeading()))) break; lastRootBoxWithChildren = root; if (pointInLogicalContents.y() < root->selectionBottom() || (blocksAreFlipped && pointInLogicalContents.y() == root->selectionBottom())) { if (linesAreFlipped) { RootInlineBox* nextRootBoxWithChildren = root->nextRootBox(); while (nextRootBoxWithChildren && !nextRootBoxWithChildren->firstLeafChild()) nextRootBoxWithChildren = nextRootBoxWithChildren->nextRootBox(); if (nextRootBoxWithChildren && nextRootBoxWithChildren->isFirstAfterPageBreak() && (pointInLogicalContents.y() > nextRootBoxWithChildren->lineTopWithLeading() || (!blocksAreFlipped && pointInLogicalContents.y() == nextRootBoxWithChildren->lineTopWithLeading()))) continue; } closestBox = root->closestLeafChildForLogicalLeftPosition(pointInLogicalContents.x()); if (closestBox) break; } } bool moveCaretToBoundary = document().frame()->editor().behavior().shouldMoveCaretToHorizontalBoundaryWhenPastTopOrBottom(); if (!moveCaretToBoundary && !closestBox && lastRootBoxWithChildren) { closestBox = lastRootBoxWithChildren->closestLeafChildForLogicalLeftPosition(pointInLogicalContents.x()); } if (closestBox) { if (moveCaretToBoundary) { LayoutUnit firstRootBoxWithChildrenTop = min(firstRootBoxWithChildren->selectionTop(), firstRootBoxWithChildren->logicalTop()); if (pointInLogicalContents.y() < firstRootBoxWithChildrenTop || (blocksAreFlipped && pointInLogicalContents.y() == firstRootBoxWithChildrenTop)) { InlineBox* box = firstRootBoxWithChildren->firstLeafChild(); if (box->isLineBreak()) { if (InlineBox* newBox = box->nextLeafChildIgnoringLineBreak()) box = newBox; } return PositionWithAffinity(positionForBox(box, true), DOWNSTREAM); } } LayoutPoint point(pointInLogicalContents.x(), closestBox->root().blockDirectionPointInLine()); if (!isHorizontalWritingMode()) point = point.transposedPoint(); if (closestBox->renderer().isReplaced()) return positionForPointRespectingEditingBoundaries(this, &toRenderBox(closestBox->renderer()), point); return closestBox->renderer().positionForPoint(point); } if (lastRootBoxWithChildren) { ASSERT(moveCaretToBoundary); InlineBox* logicallyLastBox; if (lastRootBoxWithChildren->getLogicalEndBoxWithNode(logicallyLastBox)) return PositionWithAffinity(positionForBox(logicallyLastBox, false), DOWNSTREAM); } return createPositionWithAffinity(0, DOWNSTREAM); } ",0 "struct sctp_transport *sctp_assoc_is_match(struct sctp_association *asoc, struct net *net, const union sctp_addr *laddr, const union sctp_addr *paddr) { struct sctp_transport *transport; if ((htons(asoc->base.bind_addr.port) == laddr->v4.sin_port) && (htons(asoc->peer.port) == paddr->v4.sin_port) && net_eq(sock_net(asoc->base.sk), net)) { transport = sctp_assoc_lookup_paddr(asoc, paddr); if (!transport) goto out; if (sctp_bind_addr_match(&asoc->base.bind_addr, laddr, sctp_sk(asoc->base.sk))) goto out; } transport = NULL; out: return transport; } ",0 " base::WeakPtr FinishStreamRequest() { FakeStream* fake_stream = new FakeStream(priority_); base::WeakPtr weak_stream = fake_stream->AsWeakPtr(); delegate_->OnStreamReady(SSLConfig(), ProxyInfo(), fake_stream); return weak_stream; } ",0 "static void make_response(struct xen_blkif *blkif, u64 id, unsigned short op, int st) { struct blkif_response resp; unsigned long flags; union blkif_back_rings *blk_rings = &blkif->blk_rings; int notify; resp.id = id; resp.operation = op; resp.status = st; spin_lock_irqsave(&blkif->blk_ring_lock, flags); /* Place on the response ring for the relevant domain. */ switch (blkif->blk_protocol) { case BLKIF_PROTOCOL_NATIVE: memcpy(RING_GET_RESPONSE(&blk_rings->native, blk_rings->native.rsp_prod_pvt), &resp, sizeof(resp)); break; case BLKIF_PROTOCOL_X86_32: memcpy(RING_GET_RESPONSE(&blk_rings->x86_32, blk_rings->x86_32.rsp_prod_pvt), &resp, sizeof(resp)); break; case BLKIF_PROTOCOL_X86_64: memcpy(RING_GET_RESPONSE(&blk_rings->x86_64, blk_rings->x86_64.rsp_prod_pvt), &resp, sizeof(resp)); break; default: BUG(); } blk_rings->common.rsp_prod_pvt++; RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&blk_rings->common, notify); spin_unlock_irqrestore(&blkif->blk_ring_lock, flags); if (notify) notify_remote_via_irq(blkif->irq); } ",0 "bool QueryManager::HavePendingQueries() { return !pending_queries_.empty(); } ",0 "do_auxv_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type, int swap, uint32_t namesz __attribute__((__unused__)), uint32_t descsz __attribute__((__unused__)), size_t noff __attribute__((__unused__)), size_t doff, int *flags, size_t size __attribute__((__unused__)), int clazz, int fd, off_t ph_off, int ph_num, off_t fsize) { #ifdef ELFCORE Aux32Info auxv32; Aux64Info auxv64; size_t elsize = xauxv_sizeof; const char *tag; int is_string; size_t nval; if ((*flags & (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) != (FLAGS_IS_CORE|FLAGS_DID_CORE_STYLE)) return 0; switch (*flags & FLAGS_CORE_STYLE) { case OS_STYLE_SVR4: if (type != NT_AUXV) return 0; break; #ifdef notyet case OS_STYLE_NETBSD: if (type != NT_NETBSD_CORE_AUXV) return 0; break; case OS_STYLE_FREEBSD: if (type != NT_FREEBSD_PROCSTAT_AUXV) return 0; break; #endif default: return 0; } *flags |= FLAGS_DID_AUXV; nval = 0; for (size_t off = 0; off + elsize <= descsz; off += elsize) { (void)memcpy(xauxv_addr, &nbuf[doff + off], xauxv_sizeof); /* Limit processing to 50 vector entries to prevent DoS */ if (nval++ >= 50) { file_error(ms, 0, ""Too many ELF Auxv elements""); return 1; } switch(xauxv_type) { case AT_LINUX_EXECFN: is_string = 1; tag = ""execfn""; break; case AT_LINUX_PLATFORM: is_string = 1; tag = ""platform""; break; case AT_LINUX_UID: is_string = 0; tag = ""real uid""; break; case AT_LINUX_GID: is_string = 0; tag = ""real gid""; break; case AT_LINUX_EUID: is_string = 0; tag = ""effective uid""; break; case AT_LINUX_EGID: is_string = 0; tag = ""effective gid""; break; default: is_string = 0; tag = NULL; break; } if (tag == NULL) continue; if (is_string) { char buf[256]; ssize_t buflen; buflen = get_string_on_virtaddr(ms, swap, clazz, fd, ph_off, ph_num, fsize, xauxv_val, buf, sizeof(buf)); if (buflen == 0) continue; if (file_printf(ms, "", %s: '%s'"", tag, buf) == -1) return 0; } else { if (file_printf(ms, "", %s: %d"", tag, (int) xauxv_val) == -1) return 0; } } return 1; #else return 0; #endif } ",0 "int fpm_stdio_prepare_pipes(struct fpm_child_s *child) /* {{{ */ { if (0 == child->wp->config->catch_workers_output) { /* not required */ return 0; } if (0 > pipe(fd_stdout)) { zlog(ZLOG_SYSERROR, ""failed to prepare the stdout pipe""); return -1; } if (0 > pipe(fd_stderr)) { zlog(ZLOG_SYSERROR, ""failed to prepare the stderr pipe""); close(fd_stdout[0]); close(fd_stdout[1]); return -1; } if (0 > fd_set_blocked(fd_stdout[0], 0) || 0 > fd_set_blocked(fd_stderr[0], 0)) { zlog(ZLOG_SYSERROR, ""failed to unblock pipes""); close(fd_stdout[0]); close(fd_stdout[1]); close(fd_stderr[0]); close(fd_stderr[1]); return -1; } return 0; } /* }}} */ ",0 "xsltStylePreCompute(xsltStylesheetPtr style, xmlNodePtr inst) { /* * URGENT TODO: Normally inst->psvi Should never be reserved here, * BUT: since if we include the same stylesheet from * multiple imports, then the stylesheet will be parsed * again. We simply must not try to compute the stylesheet again. * TODO: Get to the point where we don't need to query the * namespace- and local-name of the node, but can evaluate this * using cctxt->style->inode->category; */ if ((inst == NULL) || (inst->type != XML_ELEMENT_NODE) || (inst->psvi != NULL)) return; if (IS_XSLT_ELEM(inst)) { xsltStylePreCompPtr cur; if (IS_XSLT_NAME(inst, ""apply-templates"")) { xsltCheckInstructionElement(style, inst); xsltApplyTemplatesComp(style, inst); } else if (IS_XSLT_NAME(inst, ""with-param"")) { xsltCheckParentElement(style, inst, BAD_CAST ""apply-templates"", BAD_CAST ""call-template""); xsltWithParamComp(style, inst); } else if (IS_XSLT_NAME(inst, ""value-of"")) { xsltCheckInstructionElement(style, inst); xsltValueOfComp(style, inst); } else if (IS_XSLT_NAME(inst, ""copy"")) { xsltCheckInstructionElement(style, inst); xsltCopyComp(style, inst); } else if (IS_XSLT_NAME(inst, ""copy-of"")) { xsltCheckInstructionElement(style, inst); xsltCopyOfComp(style, inst); } else if (IS_XSLT_NAME(inst, ""if"")) { xsltCheckInstructionElement(style, inst); xsltIfComp(style, inst); } else if (IS_XSLT_NAME(inst, ""when"")) { xsltCheckParentElement(style, inst, BAD_CAST ""choose"", NULL); xsltWhenComp(style, inst); } else if (IS_XSLT_NAME(inst, ""choose"")) { xsltCheckInstructionElement(style, inst); xsltChooseComp(style, inst); } else if (IS_XSLT_NAME(inst, ""for-each"")) { xsltCheckInstructionElement(style, inst); xsltForEachComp(style, inst); } else if (IS_XSLT_NAME(inst, ""apply-imports"")) { xsltCheckInstructionElement(style, inst); xsltApplyImportsComp(style, inst); } else if (IS_XSLT_NAME(inst, ""attribute"")) { xmlNodePtr parent = inst->parent; if ((parent == NULL) || (parent->ns == NULL) || ((parent->ns != inst->ns) && (!xmlStrEqual(parent->ns->href, inst->ns->href))) || (!xmlStrEqual(parent->name, BAD_CAST ""attribute-set""))) { xsltCheckInstructionElement(style, inst); } xsltAttributeComp(style, inst); } else if (IS_XSLT_NAME(inst, ""element"")) { xsltCheckInstructionElement(style, inst); xsltElementComp(style, inst); } else if (IS_XSLT_NAME(inst, ""text"")) { xsltCheckInstructionElement(style, inst); xsltTextComp(style, inst); } else if (IS_XSLT_NAME(inst, ""sort"")) { xsltCheckParentElement(style, inst, BAD_CAST ""apply-templates"", BAD_CAST ""for-each""); xsltSortComp(style, inst); } else if (IS_XSLT_NAME(inst, ""comment"")) { xsltCheckInstructionElement(style, inst); xsltCommentComp(style, inst); } else if (IS_XSLT_NAME(inst, ""number"")) { xsltCheckInstructionElement(style, inst); xsltNumberComp(style, inst); } else if (IS_XSLT_NAME(inst, ""processing-instruction"")) { xsltCheckInstructionElement(style, inst); xsltProcessingInstructionComp(style, inst); } else if (IS_XSLT_NAME(inst, ""call-template"")) { xsltCheckInstructionElement(style, inst); xsltCallTemplateComp(style, inst); } else if (IS_XSLT_NAME(inst, ""param"")) { if (xsltCheckTopLevelElement(style, inst, 0) == 0) xsltCheckInstructionElement(style, inst); xsltParamComp(style, inst); } else if (IS_XSLT_NAME(inst, ""variable"")) { if (xsltCheckTopLevelElement(style, inst, 0) == 0) xsltCheckInstructionElement(style, inst); xsltVariableComp(style, inst); } else if (IS_XSLT_NAME(inst, ""otherwise"")) { xsltCheckParentElement(style, inst, BAD_CAST ""choose"", NULL); xsltCheckInstructionElement(style, inst); return; } else if (IS_XSLT_NAME(inst, ""template"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""output"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""preserve-space"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""strip-space"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if ((IS_XSLT_NAME(inst, ""stylesheet"")) || (IS_XSLT_NAME(inst, ""transform""))) { xmlNodePtr parent = inst->parent; if ((parent == NULL) || (parent->type != XML_DOCUMENT_NODE)) { xsltTransformError(NULL, style, inst, ""element %s only allowed only as root element\n"", inst->name); style->errors++; } return; } else if (IS_XSLT_NAME(inst, ""key"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""message"")) { xsltCheckInstructionElement(style, inst); return; } else if (IS_XSLT_NAME(inst, ""attribute-set"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""namespace-alias"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""include"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""import"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""decimal-format"")) { xsltCheckTopLevelElement(style, inst, 1); return; } else if (IS_XSLT_NAME(inst, ""fallback"")) { xsltCheckInstructionElement(style, inst); return; } else if (IS_XSLT_NAME(inst, ""document"")) { xsltCheckInstructionElement(style, inst); inst->psvi = (void *) xsltDocumentComp(style, inst, (xsltTransformFunction) xsltDocumentElem); } else { xsltTransformError(NULL, style, inst, ""xsltStylePreCompute: unknown xsl:%s\n"", inst->name); if (style != NULL) style->warnings++; } cur = (xsltStylePreCompPtr) inst->psvi; /* * A ns-list is build for every XSLT item in the * node-tree. This is needed for XPath expressions. */ if (cur != NULL) { int i = 0; cur->nsList = xmlGetNsList(inst->doc, inst); if (cur->nsList != NULL) { while (cur->nsList[i] != NULL) i++; } cur->nsNr = i; } } else { inst->psvi = (void *) xsltPreComputeExtModuleElement(style, inst); /* * Unknown element, maybe registered at the context * level. Mark it for later recognition. */ if (inst->psvi == NULL) inst->psvi = (void *) xsltExtMarker; } } ",1 "static int rsa_item_sign(EVP_MD_CTX *ctx, const ASN1_ITEM *it, void *asn, X509_ALGOR *alg1, X509_ALGOR *alg2, ASN1_BIT_STRING *sig) { int pad_mode; EVP_PKEY_CTX *pkctx = ctx->pctx; if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0) return 0; if (pad_mode == RSA_PKCS1_PADDING) return 2; if (pad_mode == RSA_PKCS1_PSS_PADDING) { const EVP_MD *sigmd, *mgf1md; RSA_PSS_PARAMS *pss = NULL; X509_ALGOR *mgf1alg = NULL; ASN1_STRING *os1 = NULL, *os2 = NULL; EVP_PKEY *pk = EVP_PKEY_CTX_get0_pkey(pkctx); int saltlen, rv = 0; sigmd = EVP_MD_CTX_md(ctx); if (EVP_PKEY_CTX_get_rsa_mgf1_md(pkctx, &mgf1md) <= 0) goto err; if (!EVP_PKEY_CTX_get_rsa_pss_saltlen(pkctx, &saltlen)) goto err; if (saltlen == -1) saltlen = EVP_MD_size(sigmd); else if (saltlen == -2) { saltlen = EVP_PKEY_size(pk) - EVP_MD_size(sigmd) - 2; if (((EVP_PKEY_bits(pk) - 1) & 0x7) == 0) saltlen--; } pss = RSA_PSS_PARAMS_new(); if (!pss) goto err; if (saltlen != 20) { pss->saltLength = ASN1_INTEGER_new(); if (!pss->saltLength) goto err; if (!ASN1_INTEGER_set(pss->saltLength, saltlen)) goto err; } if (EVP_MD_type(sigmd) != NID_sha1) { pss->hashAlgorithm = X509_ALGOR_new(); if (!pss->hashAlgorithm) goto err; X509_ALGOR_set_md(pss->hashAlgorithm, sigmd); } if (EVP_MD_type(mgf1md) != NID_sha1) { ASN1_STRING *stmp = NULL; /* need to embed algorithm ID inside another */ mgf1alg = X509_ALGOR_new(); X509_ALGOR_set_md(mgf1alg, mgf1md); if (!ASN1_item_pack(mgf1alg, ASN1_ITEM_rptr(X509_ALGOR), &stmp)) goto err; pss->maskGenAlgorithm = X509_ALGOR_new(); if (!pss->maskGenAlgorithm) goto err; X509_ALGOR_set0(pss->maskGenAlgorithm, OBJ_nid2obj(NID_mgf1), V_ASN1_SEQUENCE, stmp); } /* Finally create string with pss parameter encoding. */ if (!ASN1_item_pack(pss, ASN1_ITEM_rptr(RSA_PSS_PARAMS), &os1)) goto err; if (alg2) { os2 = ASN1_STRING_dup(os1); if (!os2) goto err; X509_ALGOR_set0(alg2, OBJ_nid2obj(NID_rsassaPss), V_ASN1_SEQUENCE, os2); } X509_ALGOR_set0(alg1, OBJ_nid2obj(NID_rsassaPss), V_ASN1_SEQUENCE, os1); os1 = os2 = NULL; rv = 3; err: if (mgf1alg) X509_ALGOR_free(mgf1alg); if (pss) RSA_PSS_PARAMS_free(pss); if (os1) ASN1_STRING_free(os1); return rv; } return 2; } ",0 "v8::Handle DialogHandler::returnValue() const { if (!m_scriptStateForDialogFrame) return v8Undefined(); ASSERT(m_scriptStateForDialogFrame->contextIsValid()); v8::Isolate* isolate = m_scriptStateForDialogFrame->isolate(); v8::EscapableHandleScope handleScope(isolate); ScriptState::Scope scope(m_scriptStateForDialogFrame.get()); v8::Local returnValue = m_scriptStateForDialogFrame->context()->Global()->Get(v8AtomicString(isolate, ""returnValue"")); if (returnValue.IsEmpty()) return v8Undefined(); return handleScope.Escape(returnValue); } ",0 "static Image *ReadGROUP4Image(const ImageInfo *image_info, ExceptionInfo *exception) { char filename[MaxTextExtent]; FILE *file; Image *image; ImageInfo *read_info; int c, unique_file; MagickBooleanType status; size_t length; ssize_t offset, strip_offset; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Write raw CCITT Group 4 wrapped as a TIFF image file. */ file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(filename); if (unique_file != -1) file=fdopen(unique_file,""wb""); if ((unique_file == -1) || (file == (FILE *) NULL)) ThrowImageException(FileOpenError,""UnableToCreateTemporaryFile""); length=fwrite(""\111\111\052\000\010\000\000\000\016\000"",1,10,file); if (length != 10) ThrowReaderException(CorruptImageError,""UnexpectedEndOfFile""); length=fwrite(""\376\000\003\000\001\000\000\000\000\000\000\000"",1,12,file); length=fwrite(""\000\001\004\000\001\000\000\000"",1,8,file); length=WriteLSBLong(file,image->columns); length=fwrite(""\001\001\004\000\001\000\000\000"",1,8,file); length=WriteLSBLong(file,image->rows); length=fwrite(""\002\001\003\000\001\000\000\000\001\000\000\000"",1,12,file); length=fwrite(""\003\001\003\000\001\000\000\000\004\000\000\000"",1,12,file); length=fwrite(""\006\001\003\000\001\000\000\000\000\000\000\000"",1,12,file); length=fwrite(""\021\001\003\000\001\000\000\000"",1,8,file); strip_offset=10+(12*14)+4+8; length=WriteLSBLong(file,(unsigned int) strip_offset); length=fwrite(""\022\001\003\000\001\000\000\000"",1,8,file); length=WriteLSBLong(file,(unsigned int) image_info->orientation); length=fwrite(""\025\001\003\000\001\000\000\000\001\000\000\000"",1,12,file); length=fwrite(""\026\001\004\000\001\000\000\000"",1,8,file); length=WriteLSBLong(file,image->rows); length=fwrite(""\027\001\004\000\001\000\000\000\000\000\000\000"",1,12,file); offset=(ssize_t) ftell(file)-4; length=fwrite(""\032\001\005\000\001\000\000\000"",1,8,file); length=WriteLSBLong(file,(unsigned int) (strip_offset-8)); length=fwrite(""\033\001\005\000\001\000\000\000"",1,8,file); length=WriteLSBLong(file,(unsigned int) (strip_offset-8)); length=fwrite(""\050\001\003\000\001\000\000\000\002\000\000\000"",1,12,file); length=fwrite(""\000\000\000\000"",1,4,file); length=WriteLSBLong(file,(unsigned int) image->x_resolution); length=WriteLSBLong(file,1); status=MagickTrue; for (length=0; (c=ReadBlobByte(image)) != EOF; length++) if (fputc(c,file) != c) status=MagickFalse; offset=(ssize_t) fseek(file,(ssize_t) offset,SEEK_SET); length=WriteLSBLong(file,(unsigned int) length); if (ferror(file) != 0) { (void) fclose(file); ThrowImageException(FileOpenError,""UnableToCreateTemporaryFile""); } (void) fclose(file); (void) CloseBlob(image); image=DestroyImage(image); /* Read TIFF image. */ read_info=CloneImageInfo((ImageInfo *) NULL); (void) FormatLocaleString(read_info->filename,MaxTextExtent,""%s"",filename); image=ReadTIFFImage(read_info,exception); read_info=DestroyImageInfo(read_info); if (image != (Image *) NULL) { (void) CopyMagickString(image->filename,image_info->filename, MaxTextExtent); (void) CopyMagickString(image->magick_filename,image_info->filename, MaxTextExtent); (void) CopyMagickString(image->magick,""GROUP4"",MaxTextExtent); } (void) RelinquishUniqueFileResource(filename); if (status == MagickFalse) image=DestroyImage(image); return(image); } ",0 "static void kvp_update_file(int pool) { FILE *filep; size_t bytes_written; /* * We are going to write our in-memory registry out to * disk; acquire the lock first. */ kvp_acquire_lock(pool); filep = fopen(kvp_file_info[pool].fname, ""w""); if (!filep) { kvp_release_lock(pool); syslog(LOG_ERR, ""Failed to open file, pool: %d"", pool); exit(-1); } bytes_written = fwrite(kvp_file_info[pool].records, sizeof(struct kvp_record), kvp_file_info[pool].num_records, filep); fflush(filep); kvp_release_lock(pool); } ",0 "static int iucv_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct iucv_sock *iucv = iucv_sk(sk); struct sk_buff *skb; struct iucv_message txmsg; struct cmsghdr *cmsg; int cmsg_done; long timeo; char user_id[9]; char appl_id[9]; int err; int noblock = msg->msg_flags & MSG_DONTWAIT; err = sock_error(sk); if (err) return err; if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; /* SOCK_SEQPACKET: we do not support segmented records */ if (sk->sk_type == SOCK_SEQPACKET && !(msg->msg_flags & MSG_EOR)) return -EOPNOTSUPP; lock_sock(sk); if (sk->sk_shutdown & SEND_SHUTDOWN) { err = -EPIPE; goto out; } /* Return if the socket is not in connected state */ if (sk->sk_state != IUCV_CONNECTED) { err = -ENOTCONN; goto out; } /* initialize defaults */ cmsg_done = 0; /* check for duplicate headers */ txmsg.class = 0; /* iterate over control messages */ for (cmsg = CMSG_FIRSTHDR(msg); cmsg; cmsg = CMSG_NXTHDR(msg, cmsg)) { if (!CMSG_OK(msg, cmsg)) { err = -EINVAL; goto out; } if (cmsg->cmsg_level != SOL_IUCV) continue; if (cmsg->cmsg_type & cmsg_done) { err = -EINVAL; goto out; } cmsg_done |= cmsg->cmsg_type; switch (cmsg->cmsg_type) { case SCM_IUCV_TRGCLS: if (cmsg->cmsg_len != CMSG_LEN(TRGCLS_SIZE)) { err = -EINVAL; goto out; } /* set iucv message target class */ memcpy(&txmsg.class, (void *) CMSG_DATA(cmsg), TRGCLS_SIZE); break; default: err = -EINVAL; goto out; break; } } /* allocate one skb for each iucv message: * this is fine for SOCK_SEQPACKET (unless we want to support * segmented records using the MSG_EOR flag), but * for SOCK_STREAM we might want to improve it in future */ if (iucv->transport == AF_IUCV_TRANS_HIPER) skb = sock_alloc_send_skb(sk, len + sizeof(struct af_iucv_trans_hdr) + ETH_HLEN, noblock, &err); else skb = sock_alloc_send_skb(sk, len, noblock, &err); if (!skb) { err = -ENOMEM; goto out; } if (iucv->transport == AF_IUCV_TRANS_HIPER) skb_reserve(skb, sizeof(struct af_iucv_trans_hdr) + ETH_HLEN); if (memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len)) { err = -EFAULT; goto fail; } /* wait if outstanding messages for iucv path has reached */ timeo = sock_sndtimeo(sk, noblock); err = iucv_sock_wait(sk, iucv_below_msglim(sk), timeo); if (err) goto fail; /* return -ECONNRESET if the socket is no longer connected */ if (sk->sk_state != IUCV_CONNECTED) { err = -ECONNRESET; goto fail; } /* increment and save iucv message tag for msg_completion cbk */ txmsg.tag = iucv->send_tag++; memcpy(CB_TAG(skb), &txmsg.tag, CB_TAG_LEN); if (iucv->transport == AF_IUCV_TRANS_HIPER) { atomic_inc(&iucv->msg_sent); err = afiucv_hs_send(&txmsg, sk, skb, 0); if (err) { atomic_dec(&iucv->msg_sent); goto fail; } goto release; } skb_queue_tail(&iucv->send_skb_q, skb); if (((iucv->path->flags & IUCV_IPRMDATA) & iucv->flags) && skb->len <= 7) { err = iucv_send_iprm(iucv->path, &txmsg, skb); /* on success: there is no message_complete callback * for an IPRMDATA msg; remove skb from send queue */ if (err == 0) { skb_unlink(skb, &iucv->send_skb_q); kfree_skb(skb); } /* this error should never happen since the * IUCV_IPRMDATA path flag is set... sever path */ if (err == 0x15) { pr_iucv->path_sever(iucv->path, NULL); skb_unlink(skb, &iucv->send_skb_q); err = -EPIPE; goto fail; } } else err = pr_iucv->message_send(iucv->path, &txmsg, 0, 0, (void *) skb->data, skb->len); if (err) { if (err == 3) { user_id[8] = 0; memcpy(user_id, iucv->dst_user_id, 8); appl_id[8] = 0; memcpy(appl_id, iucv->dst_name, 8); pr_err(""Application %s on z/VM guest %s"" "" exceeds message limit\n"", appl_id, user_id); err = -EAGAIN; } else err = -EPIPE; skb_unlink(skb, &iucv->send_skb_q); goto fail; } release: release_sock(sk); return len; fail: kfree_skb(skb); out: release_sock(sk); return err; } ",0 "static int __d_unalias(struct inode *inode, struct dentry *dentry, struct dentry *alias) { struct mutex *m1 = NULL, *m2 = NULL; int ret = -ESTALE; /* If alias and dentry share a parent, then no extra locks required */ if (alias->d_parent == dentry->d_parent) goto out_unalias; /* See lock_rename() */ if (!mutex_trylock(&dentry->d_sb->s_vfs_rename_mutex)) goto out_err; m1 = &dentry->d_sb->s_vfs_rename_mutex; if (!mutex_trylock(&alias->d_parent->d_inode->i_mutex)) goto out_err; m2 = &alias->d_parent->d_inode->i_mutex; out_unalias: __d_move(alias, dentry, false); ret = 0; out_err: spin_unlock(&inode->i_lock); if (m2) mutex_unlock(m2); if (m1) mutex_unlock(m1); return ret; } ",0 "AudioRendererHost::~AudioRendererHost() { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(delegates_.empty()); } ",0 "static void fast_bgr_to_gray(fz_context *ctx, fz_pixmap *dst, fz_pixmap *src, fz_colorspace *prf, const fz_default_colorspaces *default_cs, const fz_color_params *color_params, int copy_spots) { unsigned char *s = src->samples; unsigned char *d = dst->samples; size_t w = src->w; int h = src->h; int sn = src->n; int ss = src->s; int sa = src->alpha; int dn = dst->n; int ds = dst->s; int da = dst->alpha; ptrdiff_t d_line_inc = dst->stride - w * dn; ptrdiff_t s_line_inc = src->stride - w * sn; /* If copying spots, they must match, and we can never drop alpha (but we can invent it) */ if ((copy_spots && ss != ds) || (!da && sa)) { assert(""This should never happen"" == NULL); fz_throw(ctx, FZ_ERROR_GENERIC, ""Cannot convert between incompatible pixmaps""); } if ((int)w < 0 || h < 0) return; if (d_line_inc == 0 && s_line_inc == 0) { w *= h; h = 1; } if (ss == 0 && ds == 0) { /* Common, no spots case */ if (da) { if (sa) { while (h--) { size_t ww = w; while (ww--) { d[0] = ((s[0]+1) * 28 + (s[1]+1) * 150 + (s[2]+1) * 77) >> 8; d[1] = s[3]; s += 4; d += 2; } d += d_line_inc; s += s_line_inc; } } else { while (h--) { size_t ww = w; while (ww--) { d[0] = ((s[0]+1) * 28 + (s[1]+1) * 150 + (s[2]+1) * 77) >> 8; d[1] = 255; s += 3; d += 2; } d += d_line_inc; s += s_line_inc; } } } else { int si = 3 + src->alpha; while (h--) { size_t ww = w; while (ww--) { d[0] = ((s[0]+1) * 28 + (s[1]+1) * 150 + (s[2]+1) * 77) >> 8; s += si; d++; } d += d_line_inc; s += s_line_inc; } } } else if (copy_spots) { /* Slower, spots capable version */ while (h--) { int i; size_t ww = w; while (ww--) { d[0] = ((s[0]+1) * 28 + (s[1]+1) * 150 + (s[2]+1) * 77) >> 8; s += 3; d++; for (i=ss; i > 0; i--) *d++ = *s++; if (da) *d++ = sa ? *s++ : 255; } d += d_line_inc; s += s_line_inc; } } else { /* Slower, spots capable version */ while (h--) { size_t ww = w; while (ww--) { d[0] = ((s[0]+1) * 28 + (s[1]+1) * 150 + (s[2]+1) * 77) >> 8; s += sn; d += dn; if (da) d[-1] = sa ? s[-1] : 255; } d += d_line_inc; s += s_line_inc; } } } ",0 "static inline int tcp_sequence(const struct tcp_sock *tp, u32 seq, u32 end_seq) { return !before(end_seq, tp->rcv_wup) && !after(seq, tp->rcv_nxt + tcp_receive_window(tp)); } ",0 "double js_tonumber(js_State *J, int idx) { return jsV_tonumber(J, stackidx(J, idx)); } ",0 " void CloseDevToolsWindow() { Browser* browser = window_->browser(); browser->tab_strip_model()->CloseAllTabs(); BrowserClosedObserver close_observer(browser); } ",0 "LocalFileSystem::~LocalFileSystem() { } ",0 "int nfs_initiate_commit(struct rpc_clnt *clnt, struct nfs_commit_data *data, const struct rpc_call_ops *call_ops, int how, int flags) { struct rpc_task *task; int priority = flush_task_priority(how); struct rpc_message msg = { .rpc_argp = &data->args, .rpc_resp = &data->res, .rpc_cred = data->cred, }; struct rpc_task_setup task_setup_data = { .task = &data->task, .rpc_client = clnt, .rpc_message = &msg, .callback_ops = call_ops, .callback_data = data, .workqueue = nfsiod_workqueue, .flags = RPC_TASK_ASYNC | flags, .priority = priority, }; /* Set up the initial task struct. */ NFS_PROTO(data->inode)->commit_setup(data, &msg); dprintk(""NFS: %5u initiated commit call\n"", data->task.tk_pid); nfs4_state_protect(NFS_SERVER(data->inode)->nfs_client, NFS_SP4_MACH_CRED_COMMIT, &task_setup_data.rpc_client, &msg); task = rpc_run_task(&task_setup_data); if (IS_ERR(task)) return PTR_ERR(task); if (how & FLUSH_SYNC) rpc_wait_for_completion_task(task); rpc_put_task(task); return 0; } ",0 "std::string Browser::GetWindowPlacementKey() const { std::string name(prefs::kBrowserWindowPlacement); if (!app_name_.empty()) { name.append(""_""); name.append(app_name_); } return name; } ",0 "long get_user_pages_locked(unsigned long start, unsigned long nr_pages, int write, int force, struct page **pages, int *locked) { return __get_user_pages_locked(current, current->mm, start, nr_pages, write, force, pages, NULL, locked, true, FOLL_TOUCH); } ",0 "static void virtio_gpu_handle_ctrl_cb(VirtIODevice *vdev, VirtQueue *vq) { VirtIOGPU *g = VIRTIO_GPU(vdev); qemu_bh_schedule(g->ctrl_bh); } ",0 "bt_status_t btif_dm_get_remote_services_by_transport(bt_bdaddr_t *remote_addr, const int transport) { BTIF_TRACE_EVENT(""%s"", __func__); /* Set the mask extension */ tBTA_SERVICE_MASK_EXT mask_ext; mask_ext.num_uuid = 0; mask_ext.p_uuid = NULL; mask_ext.srvc_mask = BTA_ALL_SERVICE_MASK; BTA_DmDiscoverByTransport(remote_addr->address, &mask_ext, bte_dm_search_services_evt, TRUE, transport); return BT_STATUS_SUCCESS; } ",0 "inline bool colorSpaceHasAlpha(J_COLOR_SPACE colorSpace) { return turboSwizzled(colorSpace); } ",0 "void RenderWidgetHostViewGuest::SpeakSelection() { NOTIMPLEMENTED(); } ",0 "PepperMediaDeviceManager::~PepperMediaDeviceManager() { DCHECK(enumerate_callbacks_.empty()); DCHECK(open_callbacks_.empty()); } ",0 "const CameraMetadata& Camera3Device::info() const { ALOGVV(""%s: E"", __FUNCTION__); if (CC_UNLIKELY(mStatus == STATUS_UNINITIALIZED || mStatus == STATUS_ERROR)) { ALOGW(""%s: Access to static info %s!"", __FUNCTION__, mStatus == STATUS_ERROR ? ""when in error state"" : ""before init""); } return mDeviceInfo; } ",0 "void BnDrm::readVector(const Parcel &data, Vector &vector) const { uint32_t size = data.readInt32(); vector.insertAt((size_t)0, size); data.read(vector.editArray(), size); } ",0 "WebElement RenderFrameImpl::GetFocusedElement() const { WebDocument doc = frame_->document(); if (!doc.isNull()) return doc.focusedElement(); return WebElement(); } ",0 "void EqualizerSetBandLevel(EffectContext *pContext, int band, short Gain){ int gainRounded; if(Gain > 0){ gainRounded = (int)((Gain+50)/100); }else{ gainRounded = (int)((Gain-50)/100); } pContext->pBundledContext->bandGaindB[band] = gainRounded; pContext->pBundledContext->CurPreset = PRESET_CUSTOM; EqualizerLimitBandLevels(pContext); } ",0 "static char *TraceSVGClippath(const unsigned char *blob,size_t length, const size_t columns,const size_t rows) { char *path, *message; MagickBooleanType in_subpath; PointInfo first[3], last[3], point[3]; register ssize_t i; ssize_t knot_count, selector, x, y; path=AcquireString((char *) NULL); if (path == (char *) NULL) return((char *) NULL); message=AcquireString((char *) NULL); (void) FormatLocaleString(message,MagickPathExtent, (""\n"" ""\n"" ""\n"" "" 2147483647) x=(ssize_t) xx-4294967295U-1; y=(ssize_t) yy; if (yy > 2147483647) y=(ssize_t) yy-4294967295U-1; point[i].x=(double) x*columns/4096/4096; point[i].y=(double) y*rows/4096/4096; } if (in_subpath == MagickFalse) { (void) FormatLocaleString(message,MagickPathExtent,""M %g %g\n"", point[1].x,point[1].y); for (i=0; i < 3; i++) { first[i]=point[i]; last[i]=point[i]; } } else { /* Handle special cases when Bezier curves are used to describe corners and straight lines. */ if ((last[1].x == last[2].x) && (last[1].y == last[2].y) && (point[0].x == point[1].x) && (point[0].y == point[1].y)) (void) FormatLocaleString(message,MagickPathExtent, ""L %g %g\n"",point[1].x,point[1].y); else (void) FormatLocaleString(message,MagickPathExtent, ""C %g %g %g %g %g %g\n"",last[2].x, last[2].y,point[0].x,point[0].y,point[1].x,point[1].y); for (i=0; i < 3; i++) last[i]=point[i]; } (void) ConcatenateString(&path,message); in_subpath=MagickTrue; knot_count--; /* Close the subpath if there are no more knots. */ if (knot_count == 0) { /* Same special handling as above except we compare to the first point in the path and close the path. */ if ((last[1].x == last[2].x) && (last[1].y == last[2].y) && (first[0].x == first[1].x) && (first[0].y == first[1].y)) (void) FormatLocaleString(message,MagickPathExtent, ""L %g %g Z\n"",first[1].x,first[1].y); else (void) FormatLocaleString(message,MagickPathExtent, ""C %g %g %g %g %g %g Z\n"",last[2].x, last[2].y,first[0].x,first[0].y,first[1].x,first[1].y); (void) ConcatenateString(&path,message); in_subpath=MagickFalse; } break; } case 6: case 7: case 8: default: { blob+=24; length-=MagickMin(24,(ssize_t) length); break; } } } /* Return an empty SVG image if the path does not have knots. */ (void) ConcatenateString(&path,""\""/>\n\n\n""); message=DestroyString(message); return(path); } ",0 "void *virtqueue_alloc_element(size_t sz, unsigned out_num, unsigned in_num) { VirtQueueElement *elem; size_t in_addr_ofs = QEMU_ALIGN_UP(sz, __alignof__(elem->in_addr[0])); size_t out_addr_ofs = in_addr_ofs + in_num * sizeof(elem->in_addr[0]); size_t out_addr_end = out_addr_ofs + out_num * sizeof(elem->out_addr[0]); size_t in_sg_ofs = QEMU_ALIGN_UP(out_addr_end, __alignof__(elem->in_sg[0])); size_t out_sg_ofs = in_sg_ofs + in_num * sizeof(elem->in_sg[0]); size_t out_sg_end = out_sg_ofs + out_num * sizeof(elem->out_sg[0]); assert(sz >= sizeof(VirtQueueElement)); elem = g_malloc(out_sg_end); elem->out_num = out_num; elem->in_num = in_num; elem->in_addr = (void *)elem + in_addr_ofs; elem->out_addr = (void *)elem + out_addr_ofs; elem->in_sg = (void *)elem + in_sg_ofs; elem->out_sg = (void *)elem + out_sg_ofs; return elem; } ",0 "long Cues::GetCount() const { if (m_cue_points == NULL) return -1; return m_count; // TODO: really ignore preload count? } ",0 "static int userfaultfd_unregister(struct userfaultfd_ctx *ctx, unsigned long arg) { struct mm_struct *mm = ctx->mm; struct vm_area_struct *vma, *prev, *cur; int ret; struct uffdio_range uffdio_unregister; unsigned long new_flags; bool found; unsigned long start, end, vma_end; const void __user *buf = (void __user *)arg; ret = -EFAULT; if (copy_from_user(&uffdio_unregister, buf, sizeof(uffdio_unregister))) goto out; ret = validate_range(mm, uffdio_unregister.start, uffdio_unregister.len); if (ret) goto out; start = uffdio_unregister.start; end = start + uffdio_unregister.len; ret = -ENOMEM; if (!mmget_not_zero(mm)) goto out; down_write(&mm->mmap_sem); vma = find_vma_prev(mm, start, &prev); if (!vma) goto out_unlock; /* check that there's at least one vma in the range */ ret = -EINVAL; if (vma->vm_start >= end) goto out_unlock; /* * If the first vma contains huge pages, make sure start address * is aligned to huge page size. */ if (is_vm_hugetlb_page(vma)) { unsigned long vma_hpagesize = vma_kernel_pagesize(vma); if (start & (vma_hpagesize - 1)) goto out_unlock; } /* * Search for not compatible vmas. */ found = false; ret = -EINVAL; for (cur = vma; cur && cur->vm_start < end; cur = cur->vm_next) { cond_resched(); BUG_ON(!!cur->vm_userfaultfd_ctx.ctx ^ !!(cur->vm_flags & (VM_UFFD_MISSING | VM_UFFD_WP))); /* * Check not compatible vmas, not strictly required * here as not compatible vmas cannot have an * userfaultfd_ctx registered on them, but this * provides for more strict behavior to notice * unregistration errors. */ if (!vma_can_userfault(cur)) goto out_unlock; found = true; } BUG_ON(!found); if (vma->vm_start < start) prev = vma; ret = 0; do { cond_resched(); BUG_ON(!vma_can_userfault(vma)); /* * Nothing to do: this vma is already registered into this * userfaultfd and with the right tracking mode too. */ if (!vma->vm_userfaultfd_ctx.ctx) goto skip; WARN_ON(!(vma->vm_flags & VM_MAYWRITE)); if (vma->vm_start > start) start = vma->vm_start; vma_end = min(end, vma->vm_end); if (userfaultfd_missing(vma)) { /* * Wake any concurrent pending userfault while * we unregister, so they will not hang * permanently and it avoids userland to call * UFFDIO_WAKE explicitly. */ struct userfaultfd_wake_range range; range.start = start; range.len = vma_end - start; wake_userfault(vma->vm_userfaultfd_ctx.ctx, &range); } new_flags = vma->vm_flags & ~(VM_UFFD_MISSING | VM_UFFD_WP); prev = vma_merge(mm, prev, start, vma_end, new_flags, vma->anon_vma, vma->vm_file, vma->vm_pgoff, vma_policy(vma), NULL_VM_UFFD_CTX); if (prev) { vma = prev; goto next; } if (vma->vm_start < start) { ret = split_vma(mm, vma, start, 1); if (ret) break; } if (vma->vm_end > end) { ret = split_vma(mm, vma, end, 0); if (ret) break; } next: /* * In the vma_merge() successful mprotect-like case 8: * the next vma was merged into the current one and * the current one has not been updated yet. */ vma->vm_flags = new_flags; vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; skip: prev = vma; start = vma->vm_end; vma = vma->vm_next; } while (vma && vma->vm_start < end); out_unlock: up_write(&mm->mmap_sem); mmput(mm); out: return ret; } ",1 "MediaControlOverlayPlayButtonElement::MediaControlOverlayPlayButtonElement( MediaControls& mediaControls) : MediaControlInputElement(mediaControls, MediaOverlayPlayButton) {} ",0 "static int cxusb_aver_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff) { if (onoff) cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_ON, NULL, 0, NULL, 0); else cxusb_ctrl_msg(adap->dev, CMD_AVER_STREAM_OFF, NULL, 0, NULL, 0); return 0; } ",0 "bool ShellWindow::IsFullscreenOrPending() const { return false; } ",0 "void kvm_set_apic_base(struct kvm_vcpu *vcpu, u64 data) { /* TODO: reserve bits check */ if (irqchip_in_kernel(vcpu->kvm)) kvm_lapic_set_base(vcpu, data); else vcpu->arch.apic_base = data; } ",0 "int inet_release(struct socket *sock) { struct sock *sk = sock->sk; if (sk) { long timeout; sock_rps_reset_flow(sk); /* Applications forget to leave groups before exiting */ ip_mc_drop_socket(sk); /* If linger is set, we don't return until the close * is complete. Otherwise we return immediately. The * actually closing is done the same either way. * * If the close is due to the process exiting, we never * linger.. */ timeout = 0; if (sock_flag(sk, SOCK_LINGER) && !(current->flags & PF_EXITING)) timeout = sk->sk_lingertime; sock->sk = NULL; sk->sk_prot->close(sk, timeout); } return 0; } ",0 "get_results(struct iperf_test *test) { int r = 0; cJSON *j; cJSON *j_cpu_util_total; cJSON *j_cpu_util_user; cJSON *j_cpu_util_system; cJSON *j_sender_has_retransmits; int result_has_retransmits; cJSON *j_streams; int n, i; cJSON *j_stream; cJSON *j_id; cJSON *j_bytes; cJSON *j_retransmits; cJSON *j_jitter; cJSON *j_errors; cJSON *j_packets; cJSON *j_server_output; int sid, cerror, pcount; double jitter; iperf_size_t bytes_transferred; int retransmits; struct iperf_stream *sp; j = JSON_read(test->ctrl_sck); if (j == NULL) { i_errno = IERECVRESULTS; r = -1; } else { j_cpu_util_total = cJSON_GetObjectItem(j, ""cpu_util_total""); j_cpu_util_user = cJSON_GetObjectItem(j, ""cpu_util_user""); j_cpu_util_system = cJSON_GetObjectItem(j, ""cpu_util_system""); j_sender_has_retransmits = cJSON_GetObjectItem(j, ""sender_has_retransmits""); if (j_cpu_util_total == NULL || j_cpu_util_user == NULL || j_cpu_util_system == NULL || j_sender_has_retransmits == NULL) { i_errno = IERECVRESULTS; r = -1; } else { if (test->debug) { printf(""get_results\n%s\n"", cJSON_Print(j)); } test->remote_cpu_util[0] = j_cpu_util_total->valuefloat; test->remote_cpu_util[1] = j_cpu_util_user->valuefloat; test->remote_cpu_util[2] = j_cpu_util_system->valuefloat; result_has_retransmits = j_sender_has_retransmits->valueint; if (! test->sender) test->sender_has_retransmits = result_has_retransmits; j_streams = cJSON_GetObjectItem(j, ""streams""); if (j_streams == NULL) { i_errno = IERECVRESULTS; r = -1; } else { n = cJSON_GetArraySize(j_streams); for (i=0; ivalueint; bytes_transferred = j_bytes->valueint; retransmits = j_retransmits->valueint; jitter = j_jitter->valuefloat; cerror = j_errors->valueint; pcount = j_packets->valueint; SLIST_FOREACH(sp, &test->streams, streams) if (sp->id == sid) break; if (sp == NULL) { i_errno = IESTREAMID; r = -1; } else { if (test->sender) { sp->jitter = jitter; sp->cnt_error = cerror; sp->packet_count = pcount; sp->result->bytes_received = bytes_transferred; } else { sp->result->bytes_sent = bytes_transferred; sp->result->stream_retrans = retransmits; } } } } } /* * If we're the client and we're supposed to get remote results, * look them up and process accordingly. */ if (test->role == 'c' && iperf_get_test_get_server_output(test)) { /* Look for JSON. If we find it, grab the object so it doesn't get deleted. */ j_server_output = cJSON_DetachItemFromObject(j, ""server_output_json""); if (j_server_output != NULL) { test->json_server_output = j_server_output; } else { /* No JSON, look for textual output. Make a copy of the text for later. */ j_server_output = cJSON_GetObjectItem(j, ""server_output_text""); if (j_server_output != NULL) { test->server_output_text = strdup(j_server_output->valuestring); } } } } } cJSON_Delete(j); } return r; } ",1 "bool GDataDirectory::RemoveChild(GDataEntry* entry) { DCHECK(entry); const std::string file_name(entry->file_name()); GDataEntry* found_entry = FindChild(file_name); if (!found_entry) return false; DCHECK_EQ(entry, found_entry); if (root_) root_->RemoveEntryFromResourceMap(entry); child_files_.erase(file_name); child_directories_.erase(file_name); return true; } ",0 "dump_xml_attr(xmlAttrPtr attr, int options, char **buffer, int *offset, int *max) { char *p_value = NULL; const char *p_name = NULL; CRM_ASSERT(buffer != NULL); if (attr == NULL || attr->children == NULL) { return; } p_name = (const char *)attr->name; p_value = crm_xml_escape((const char *)attr->children->content); buffer_print(*buffer, *max, *offset, "" %s=\""%s\"""", p_name, p_value); free(p_value); } ",0 "static int ext4_remove_blocks(handle_t *handle, struct inode *inode, struct ext4_extent *ex, ext4_lblk_t from, ext4_lblk_t to) { unsigned short ee_len = ext4_ext_get_actual_len(ex); int flags = EXT4_FREE_BLOCKS_FORGET; if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) flags |= EXT4_FREE_BLOCKS_METADATA; #ifdef EXTENTS_STATS { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); spin_lock(&sbi->s_ext_stats_lock); sbi->s_ext_blocks += ee_len; sbi->s_ext_extents++; if (ee_len < sbi->s_ext_min) sbi->s_ext_min = ee_len; if (ee_len > sbi->s_ext_max) sbi->s_ext_max = ee_len; if (ext_depth(inode) > sbi->s_depth_max) sbi->s_depth_max = ext_depth(inode); spin_unlock(&sbi->s_ext_stats_lock); } #endif if (from >= le32_to_cpu(ex->ee_block) && to == le32_to_cpu(ex->ee_block) + ee_len - 1) { /* tail removal */ ext4_lblk_t num; ext4_fsblk_t start; num = le32_to_cpu(ex->ee_block) + ee_len - from; start = ext_pblock(ex) + ee_len - num; ext_debug(""free last %u blocks starting %llu\n"", num, start); ext4_free_blocks(handle, inode, 0, start, num, flags); } else if (from == le32_to_cpu(ex->ee_block) && to <= le32_to_cpu(ex->ee_block) + ee_len - 1) { printk(KERN_INFO ""strange request: removal %u-%u from %u:%u\n"", from, to, le32_to_cpu(ex->ee_block), ee_len); } else { printk(KERN_INFO ""strange request: removal(2) "" ""%u-%u from %u:%u\n"", from, to, le32_to_cpu(ex->ee_block), ee_len); } return 0; } ",0 "void Player::cancel() { if (!m_content) return; ASSERT(m_content->player() == this); m_content->detach(); m_content = 0; } ",0 "void RenderWidgetHostImpl::ForwardKeyboardEventWithCommands( const NativeWebKeyboardEvent& key_event, const ui::LatencyInfo& latency, const std::vector* commands, bool* update_event) { TRACE_EVENT0(""input"", ""RenderWidgetHostImpl::ForwardKeyboardEvent""); if (owner_delegate_ && !owner_delegate_->MayRenderWidgetForwardKeyboardEvent(key_event)) { return; } if (ShouldDropInputEvents()) return; if (!process_->HasConnection()) return; if (KeyPressListenersHandleEvent(key_event)) { if (key_event.GetType() == WebKeyboardEvent::kRawKeyDown) suppress_events_until_keydown_ = true; return; } if (!WebInputEvent::IsKeyboardEventType(key_event.GetType())) return; if (suppress_events_until_keydown_) { if (key_event.GetType() == WebKeyboardEvent::kKeyUp || key_event.GetType() == WebKeyboardEvent::kChar) return; DCHECK(key_event.GetType() == WebKeyboardEvent::kRawKeyDown || key_event.GetType() == WebKeyboardEvent::kKeyDown); suppress_events_until_keydown_ = false; } bool is_shortcut = false; if (delegate_ && !key_event.skip_in_browser) { if (key_event.GetType() == WebKeyboardEvent::kRawKeyDown) suppress_events_until_keydown_ = true; switch (delegate_->PreHandleKeyboardEvent(key_event)) { case KeyboardEventProcessingResult::HANDLED: return; #if defined(USE_AURA) case KeyboardEventProcessingResult::HANDLED_DONT_UPDATE_EVENT: if (update_event) *update_event = false; return; #endif case KeyboardEventProcessingResult::NOT_HANDLED: break; case KeyboardEventProcessingResult::NOT_HANDLED_IS_SHORTCUT: is_shortcut = true; break; } if (key_event.GetType() == WebKeyboardEvent::kRawKeyDown) suppress_events_until_keydown_ = false; } if (touch_emulator_ && touch_emulator_->HandleKeyboardEvent(key_event)) return; NativeWebKeyboardEventWithLatencyInfo key_event_with_latency(key_event, latency); key_event_with_latency.event.is_browser_shortcut = is_shortcut; DispatchInputEventWithLatencyInfo(key_event, &key_event_with_latency.latency); if (commands && !commands->empty()) { GetWidgetInputHandler()->SetEditCommandsForNextKeyEvent(*commands); } input_router_->SendKeyboardEvent(key_event_with_latency); } ",0 "struct page *vm_normal_page(struct vm_area_struct *vma, unsigned long addr, pte_t pte) { unsigned long pfn = pte_pfn(pte); if (HAVE_PTE_SPECIAL) { if (likely(!pte_special(pte))) goto check_pfn; if (vma->vm_ops && vma->vm_ops->find_special_page) return vma->vm_ops->find_special_page(vma, addr); if (vma->vm_flags & (VM_PFNMAP | VM_MIXEDMAP)) return NULL; if (!is_zero_pfn(pfn)) print_bad_pte(vma, addr, pte, NULL); return NULL; } /* !HAVE_PTE_SPECIAL case follows: */ if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) { if (vma->vm_flags & VM_MIXEDMAP) { if (!pfn_valid(pfn)) return NULL; goto out; } else { unsigned long off; off = (addr - vma->vm_start) >> PAGE_SHIFT; if (pfn == vma->vm_pgoff + off) return NULL; if (!is_cow_mapping(vma->vm_flags)) return NULL; } } if (is_zero_pfn(pfn)) return NULL; check_pfn: if (unlikely(pfn > highest_memmap_pfn)) { print_bad_pte(vma, addr, pte, NULL); return NULL; } /* * NOTE! We still have PageReserved() pages in the page tables. * eg. VDSO mappings can cause them to exist. */ out: return pfn_to_page(pfn); } ",0 "SPICE_GNUC_VISIBLE int spice_server_set_channel_security(SpiceServer *s, const char *channel, int security) { static const char *names[] = { [ SPICE_CHANNEL_MAIN ] = ""main"", [ SPICE_CHANNEL_DISPLAY ] = ""display"", [ SPICE_CHANNEL_INPUTS ] = ""inputs"", [ SPICE_CHANNEL_CURSOR ] = ""cursor"", [ SPICE_CHANNEL_PLAYBACK ] = ""playback"", [ SPICE_CHANNEL_RECORD ] = ""record"", #ifdef USE_SMARTCARD [ SPICE_CHANNEL_SMARTCARD] = ""smartcard"", #endif [ SPICE_CHANNEL_USBREDIR ] = ""usbredir"", }; int i; spice_assert(reds == s); if (channel == NULL) { default_channel_security = security; return 0; } for (i = 0; i < SPICE_N_ELEMENTS(names); i++) { if (names[i] && strcmp(names[i], channel) == 0) { set_one_channel_security(i, security); return 0; } } return -1; } ",0 "static const StringImpl* tagImplFor(const HTMLToken::DataVector& data) { AtomicString tagName(data); const StringImpl* result = tagName.impl(); if (result->isStatic()) return result; return nullptr; } ",0 "control_client_sighandler(int signo) { muxclient_terminate = signo; } ",0 "isdn_net_type_trans(struct sk_buff *skb, struct net_device *dev) { struct ethhdr *eth; unsigned char *rawp; skb_reset_mac_header(skb); skb_pull(skb, ETH_HLEN); eth = eth_hdr(skb); if (*eth->h_dest & 1) { if (memcmp(eth->h_dest, dev->broadcast, ETH_ALEN) == 0) skb->pkt_type = PACKET_BROADCAST; else skb->pkt_type = PACKET_MULTICAST; } /* * This ALLMULTI check should be redundant by 1.4 * so don't forget to remove it. */ else if (dev->flags & (IFF_PROMISC /*| IFF_ALLMULTI*/)) { if (memcmp(eth->h_dest, dev->dev_addr, ETH_ALEN)) skb->pkt_type = PACKET_OTHERHOST; } if (ntohs(eth->h_proto) >= 1536) return eth->h_proto; rawp = skb->data; /* * This is a magic hack to spot IPX packets. Older Novell breaks * the protocol design and runs IPX over 802.3 without an 802.2 LLC * layer. We look for FFFF which isn't a used 802.2 SSAP/DSAP. This * won't work for fault tolerant netware but does for the rest. */ if (*(unsigned short *) rawp == 0xFFFF) return htons(ETH_P_802_3); /* * Real 802.2 LLC */ return htons(ETH_P_802_2); } ",0 "bool InputMethodTSF::OnUntranslatedIMEMessage( const base::NativeEvent& event, InputMethod::NativeEventResult* result) { LRESULT original_result = 0; BOOL handled = FALSE; switch (event.message) { case WM_IME_REQUEST: original_result = OnImeRequest( event.message, event.wParam, event.lParam, &handled); break; case WM_CHAR: case WM_SYSCHAR: original_result = OnChar( event.hwnd, event.message, event.wParam, event.lParam, &handled); break; case WM_DEADCHAR: case WM_SYSDEADCHAR: original_result = OnDeadChar( event.message, event.wParam, event.lParam, &handled); break; } if (result) *result = original_result; return !!handled; } ",0 "void AsyncFileSystemChromium::removeRecursively(const KURL& path, PassOwnPtr callbacks) { m_webFileSystem->removeRecursively(path, new WebKit::WebFileSystemCallbacksImpl(callbacks)); } ",0 "RenderObject::SelectionState InlineTextBox::selectionState() { RenderObject::SelectionState state = renderer()->selectionState(); if (state == RenderObject::SelectionStart || state == RenderObject::SelectionEnd || state == RenderObject::SelectionBoth) { int startPos, endPos; renderer()->selectionStartEnd(startPos, endPos); int lastSelectable = start() + len() - (isLineBreak() ? 1 : 0); bool start = (state != RenderObject::SelectionEnd && startPos >= m_start && startPos < m_start + m_len); bool end = (state != RenderObject::SelectionStart && endPos > m_start && endPos <= lastSelectable); if (start && end) state = RenderObject::SelectionBoth; else if (start) state = RenderObject::SelectionStart; else if (end) state = RenderObject::SelectionEnd; else if ((state == RenderObject::SelectionEnd || startPos < m_start) && (state == RenderObject::SelectionStart || endPos > lastSelectable)) state = RenderObject::SelectionInside; else if (state == RenderObject::SelectionBoth) state = RenderObject::SelectionNone; } if (m_truncation != cNoTruncation && root()->ellipsisBox()) { EllipsisBox* ellipsis = root()->ellipsisBox(); if (state != RenderObject::SelectionNone) { int start, end; selectionStartEnd(start, end); ellipsis->setSelectionState(end >= m_truncation && start <= m_truncation ? RenderObject::SelectionInside : RenderObject::SelectionNone); } else ellipsis->setSelectionState(RenderObject::SelectionNone); } return state; } ",0 "static void nfs4_xdr_enc_reclaim_complete(struct rpc_rqst *req, struct xdr_stream *xdr, struct nfs41_reclaim_complete_args *args) { struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args) }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_reclaim_complete(xdr, args, &hdr); encode_nops(&hdr); } ",0 "bool HttpProxyClientSocket::GetSSLInfo(SSLInfo* ssl_info) { if (transport_.get() && transport_->socket()) { return transport_->socket()->GetSSLInfo(ssl_info); } NOTREACHED(); return false; } ",0 "void HTMLFormElement::InvalidateDefaultButtonStyle() const { for (const auto& control : ListedElements()) { if (!control->IsFormControlElement()) continue; if (ToHTMLFormControlElement(control)->CanBeSuccessfulSubmitButton()) { ToHTMLFormControlElement(control)->PseudoStateChanged( CSSSelector::kPseudoDefault); } } } ",0 "static int checkMutexInit(void){ pGlobalMutexMethods = sqlite3DefaultMutex(); return SQLITE_OK; } ",0 "void SimpleSoftOMXComponent::onPortEnable(OMX_U32 portIndex, bool enable) { CHECK_LT(portIndex, mPorts.size()); PortInfo *port = &mPorts.editItemAt(portIndex); CHECK_EQ((int)port->mTransition, (int)PortInfo::NONE); CHECK(port->mDef.bEnabled == !enable); if (!enable) { port->mDef.bEnabled = OMX_FALSE; port->mTransition = PortInfo::DISABLING; for (size_t i = 0; i < port->mBuffers.size(); ++i) { BufferInfo *buffer = &port->mBuffers.editItemAt(i); if (buffer->mOwnedByUs) { buffer->mOwnedByUs = false; if (port->mDef.eDir == OMX_DirInput) { notifyEmptyBufferDone(buffer->mHeader); } else { CHECK_EQ(port->mDef.eDir, OMX_DirOutput); notifyFillBufferDone(buffer->mHeader); } } } port->mQueue.clear(); } else { port->mTransition = PortInfo::ENABLING; } checkTransitions(); } ",1 "bool OmniboxViewWin::OnInlineAutocompleteTextMaybeChanged( const string16& display_text, size_t user_text_length) { if (display_text == GetText()) return false; ScopedFreeze freeze(this, GetTextObjectModel()); SetWindowText(display_text.c_str()); SetSelection(static_cast(display_text.length()), static_cast(user_text_length)); TextChanged(); return true; } ",0 "dbus_send_reload_signal(void) { gchar *path; if (global_connection == NULL) return; path = dbus_object_create_path_vrrp(); dbus_emit_signal(global_connection, path, DBUS_VRRP_INTERFACE, ""VrrpReloaded"", NULL); g_free(path); } ",0 "print_map (int flags) { int i; for (i = 0; i < M_NFLAGS; i++) if ( flags & (1 << i) ) printf(""%s,"", map_names[i].name); printf(""\n""); } ",0 "static int midi_setup_channelprefix(struct _mdi *mdi, uint32_t setting) { MIDI_EVENT_DEBUG(__FUNCTION__,0, setting); _WM_CheckEventMemoryPool(mdi); mdi->events[mdi->event_count].do_event = *_WM_do_meta_channelprefix; mdi->events[mdi->event_count].event_data.channel = 0; mdi->events[mdi->event_count].event_data.data.value = setting; mdi->events[mdi->event_count].samples_to_next = 0; mdi->event_count++; return (0); } ",0 "static void unsignedIntSequenceAttrAttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.unsignedIntSequenceAttr._set""); TestObj* imp = V8TestObj::toNative(info.Holder()); Vector v = toNativeArray(value); imp->setUnsignedIntSequenceAttr(v); return; } ",0 "status_t OggSource::start(MetaData * /* params */) { if (mStarted) { return INVALID_OPERATION; } mStarted = true; return OK; } ",0 "static int fuse_copy_ioctl_iovec(struct iovec *dst, void *src, size_t transferred, unsigned count, bool is_compat) { #ifdef CONFIG_COMPAT if (count * sizeof(struct compat_iovec) == transferred) { struct compat_iovec *ciov = src; unsigned i; /* * With this interface a 32bit server cannot support * non-compat (i.e. ones coming from 64bit apps) ioctl * requests */ if (!is_compat) return -EINVAL; for (i = 0; i < count; i++) { dst[i].iov_base = compat_ptr(ciov[i].iov_base); dst[i].iov_len = ciov[i].iov_len; } return 0; } #endif if (count * sizeof(struct iovec) != transferred) return -EIO; memcpy(dst, src, transferred); return 0; } ",0 "void ClipboardMessageFilter::OnReadText(ui::ClipboardType type, base::string16* result) { GetClipboard()->ReadText(type, result); } ",0 "static void csnmp_host_open_session(host_definition_t *host) { struct snmp_session sess; int error; if (host->sess_handle != NULL) csnmp_host_close_session(host); snmp_sess_init(&sess); sess.peername = host->address; switch (host->version) { case 1: sess.version = SNMP_VERSION_1; break; case 3: sess.version = SNMP_VERSION_3; break; default: sess.version = SNMP_VERSION_2c; break; } if (host->version == 3) { sess.securityName = host->username; sess.securityNameLen = strlen(host->username); sess.securityLevel = host->security_level; if (sess.securityLevel == SNMP_SEC_LEVEL_AUTHNOPRIV || sess.securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) { sess.securityAuthProto = host->auth_protocol; sess.securityAuthProtoLen = host->auth_protocol_len; sess.securityAuthKeyLen = USM_AUTH_KU_LEN; error = generate_Ku(sess.securityAuthProto, sess.securityAuthProtoLen, (u_char *)host->auth_passphrase, strlen(host->auth_passphrase), sess.securityAuthKey, &sess.securityAuthKeyLen); if (error != SNMPERR_SUCCESS) { ERROR(""snmp plugin: host %s: Error generating Ku from auth_passphrase. "" ""(Error %d)"", host->name, error); } } if (sess.securityLevel == SNMP_SEC_LEVEL_AUTHPRIV) { sess.securityPrivProto = host->priv_protocol; sess.securityPrivProtoLen = host->priv_protocol_len; sess.securityPrivKeyLen = USM_PRIV_KU_LEN; error = generate_Ku(sess.securityAuthProto, sess.securityAuthProtoLen, (u_char *)host->priv_passphrase, strlen(host->priv_passphrase), sess.securityPrivKey, &sess.securityPrivKeyLen); if (error != SNMPERR_SUCCESS) { ERROR(""snmp plugin: host %s: Error generating Ku from priv_passphrase. "" ""(Error %d)"", host->name, error); } } if (host->context != NULL) { sess.contextName = host->context; sess.contextNameLen = strlen(host->context); } } else /* SNMPv1/2 ""authenticates"" with community string */ { sess.community = (u_char *)host->community; sess.community_len = strlen(host->community); } /* snmp_sess_open will copy the `struct snmp_session *'. */ host->sess_handle = snmp_sess_open(&sess); if (host->sess_handle == NULL) { char *errstr = NULL; snmp_error(&sess, NULL, NULL, &errstr); ERROR(""snmp plugin: host %s: snmp_sess_open failed: %s"", host->name, (errstr == NULL) ? ""Unknown problem"" : errstr); sfree(errstr); } } /* void csnmp_host_open_session */ ",0 "void WriteOutput(FILE *fid, u8 *data, u32 picSize) { if (fid) fwrite(data, 1, picSize, fid); } ",0 " virtual void Unregister(const std::vector& oids) { } ",0 "static void VoidMethodDictionaryArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""voidMethodDictionaryArg""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } Dictionary dictionary_arg; if (!info[0]->IsNullOrUndefined() && !info[0]->IsObject()) { exception_state.ThrowTypeError(""parameter 1 ('dictionaryArg') is not an object.""); return; } dictionary_arg = NativeValueTraits::NativeValue(info.GetIsolate(), info[0], exception_state); if (exception_state.HadException()) return; impl->voidMethodDictionaryArg(dictionary_arg); } ",0 "void cgm_lock(void) { lock_mutex(&cgm_mutex); } ",0 "static void init_reg_state(struct bpf_verifier_env *env, struct bpf_func_state *state) { struct bpf_reg_state *regs = state->regs; int i; for (i = 0; i < MAX_BPF_REG; i++) { mark_reg_not_init(env, regs, i); regs[i].live = REG_LIVE_NONE; regs[i].parent = NULL; } /* frame pointer */ regs[BPF_REG_FP].type = PTR_TO_STACK; mark_reg_known_zero(env, regs, BPF_REG_FP); regs[BPF_REG_FP].frameno = state->frameno; /* 1st arg to a function */ regs[BPF_REG_1].type = PTR_TO_CTX; mark_reg_known_zero(env, regs, BPF_REG_1); } ",0 "xmlParseElementDecl(xmlParserCtxtPtr ctxt) { const xmlChar *name; int ret = -1; xmlElementContentPtr content = NULL; /* GROW; done in the caller */ if (CMP9(CUR_PTR, '<', '!', 'E', 'L', 'E', 'M', 'E', 'N', 'T')) { int inputid = ctxt->input->id; SKIP(9); if (SKIP_BLANKS == 0) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, ""Space required after 'ELEMENT'\n""); return(-1); } name = xmlParseName(ctxt); if (name == NULL) { xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, ""xmlParseElementDecl: no name for Element\n""); return(-1); } if (SKIP_BLANKS == 0) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, ""Space required after the element name\n""); } if (CMP5(CUR_PTR, 'E', 'M', 'P', 'T', 'Y')) { SKIP(5); /* * Element must always be empty. */ ret = XML_ELEMENT_TYPE_EMPTY; } else if ((RAW == 'A') && (NXT(1) == 'N') && (NXT(2) == 'Y')) { SKIP(3); /* * Element is a generic container. */ ret = XML_ELEMENT_TYPE_ANY; } else if (RAW == '(') { ret = xmlParseElementContentDecl(ctxt, name, &content); } else { /* * [ WFC: PEs in Internal Subset ] error handling. */ if ((RAW == '%') && (ctxt->external == 0) && (ctxt->inputNr == 1)) { xmlFatalErrMsg(ctxt, XML_ERR_PEREF_IN_INT_SUBSET, ""PEReference: forbidden within markup decl in internal subset\n""); } else { xmlFatalErrMsg(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, ""xmlParseElementDecl: 'EMPTY', 'ANY' or '(' expected\n""); } return(-1); } SKIP_BLANKS; if (RAW != '>') { xmlFatalErr(ctxt, XML_ERR_GT_REQUIRED, NULL); if (content != NULL) { xmlFreeDocElementContent(ctxt->myDoc, content); } } else { if (inputid != ctxt->input->id) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, ""Element declaration doesn't start and stop in"" "" the same entity\n""); } NEXT; if ((ctxt->sax != NULL) && (!ctxt->disableSAX) && (ctxt->sax->elementDecl != NULL)) { if (content != NULL) content->parent = NULL; ctxt->sax->elementDecl(ctxt->userData, name, ret, content); if ((content != NULL) && (content->parent == NULL)) { /* * this is a trick: if xmlAddElementDecl is called, * instead of copying the full tree it is plugged directly * if called from the parser. Avoid duplicating the * interfaces or change the API/ABI */ xmlFreeDocElementContent(ctxt->myDoc, content); } } else if (content != NULL) { xmlFreeDocElementContent(ctxt->myDoc, content); } } } return(ret); } ",0 "TraceEvent::TraceEvent() : duration_(TimeDelta::FromInternalValue(-1)), id_(0u), category_group_enabled_(NULL), name_(NULL), thread_id_(0), phase_(TRACE_EVENT_PHASE_BEGIN), flags_(0) { for (int i = 0; i < kTraceMaxNumArgs; ++i) arg_names_[i] = NULL; memset(arg_values_, 0, sizeof(arg_values_)); } ",0 "HTMLImportLoader* Document::importLoader() const { if (!m_importsController) return 0; return m_importsController->loaderFor(*this); } ",0 "static int set_msr_hyperv_pw(struct kvm_vcpu *vcpu, u32 msr, u64 data) { struct kvm *kvm = vcpu->kvm; switch (msr) { case HV_X64_MSR_GUEST_OS_ID: kvm->arch.hv_guest_os_id = data; /* setting guest os id to zero disables hypercall page */ if (!kvm->arch.hv_guest_os_id) kvm->arch.hv_hypercall &= ~HV_X64_MSR_HYPERCALL_ENABLE; break; case HV_X64_MSR_HYPERCALL: { u64 gfn; unsigned long addr; u8 instructions[4]; /* if guest os id is not set hypercall should remain disabled */ if (!kvm->arch.hv_guest_os_id) break; if (!(data & HV_X64_MSR_HYPERCALL_ENABLE)) { kvm->arch.hv_hypercall = data; break; } gfn = data >> HV_X64_MSR_HYPERCALL_PAGE_ADDRESS_SHIFT; addr = gfn_to_hva(kvm, gfn); if (kvm_is_error_hva(addr)) return 1; kvm_x86_ops->patch_hypercall(vcpu, instructions); ((unsigned char *)instructions)[3] = 0xc3; /* ret */ if (__copy_to_user((void __user *)addr, instructions, 4)) return 1; kvm->arch.hv_hypercall = data; break; } default: vcpu_unimpl(vcpu, ""HYPER-V unimplemented wrmsr: 0x%x "" ""data 0x%llx\n"", msr, data); return 1; } return 0; } ",0 "void Tab::GetAccessibleNodeData(ui::AXNodeData* node_data) { node_data->role = ax::mojom::Role::kTab; node_data->AddState(ax::mojom::State::kMultiselectable); node_data->AddBoolAttribute(ax::mojom::BoolAttribute::kSelected, IsSelected()); base::string16 name = controller_->GetAccessibleTabName(this); if (!name.empty()) { node_data->SetName(name); } else { node_data->SetNameExplicitlyEmpty(); } } ",0 "void __exit rfcomm_cleanup_sockets(void) { debugfs_remove(rfcomm_sock_debugfs); if (bt_sock_unregister(BTPROTO_RFCOMM) < 0) BT_ERR(""RFCOMM socket layer unregistration failed""); proto_unregister(&rfcomm_proto); } ",0 " explicit FakeRegistrationManager( invalidation::InvalidationClient* invalidation_client) : RegistrationManager(invalidation_client), jitter_(0.0) {} ",0 "static struct slave *bond_find_best_slave(struct bonding *bond) { struct slave *new_active, *old_active; struct slave *bestslave = NULL; int mintime = bond->params.updelay; int i; new_active = bond->curr_active_slave; if (!new_active) { /* there were no active slaves left */ if (bond->slave_cnt > 0) /* found one slave */ new_active = bond->first_slave; else return NULL; /* still no slave, return NULL */ } if ((bond->primary_slave) && bond->primary_slave->link == BOND_LINK_UP && bond_should_change_active(bond)) { new_active = bond->primary_slave; } /* remember where to stop iterating over the slaves */ old_active = new_active; bond_for_each_slave_from(bond, new_active, i, old_active) { if (new_active->link == BOND_LINK_UP) { return new_active; } else if (new_active->link == BOND_LINK_BACK && IS_UP(new_active->dev)) { /* link up, but waiting for stabilization */ if (new_active->delay < mintime) { mintime = new_active->delay; bestslave = new_active; } } } return bestslave; } ",0 "UChar TextIterator::characterAt(unsigned index) const { ASSERT_WITH_SECURITY_IMPLICATION(index < static_cast(length())); if (!(index < static_cast(length()))) return 0; if (!m_textCharacters) return string()[startOffset() + index]; return m_textCharacters[index]; } ",0 "SPL_METHOD(SplMaxHeap, compare) { zval *a, *b; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""zz"", &a, &b) == FAILURE) { return; } RETURN_LONG(spl_ptr_heap_zval_max_cmp(a, b, NULL TSRMLS_CC)); } ",0 "static struct net_device *rose_ax25_dev_find(char *devname) { struct net_device *dev; if ((dev = __dev_get_by_name(&init_net, devname)) == NULL) return NULL; if ((dev->flags & IFF_UP) && dev->type == ARPHRD_AX25) return dev; return NULL; } ",0 "static void sctp_bucket_destroy(struct sctp_bind_bucket *pp) { if (pp && hlist_empty(&pp->owner)) { __hlist_del(&pp->node); kmem_cache_free(sctp_bucket_cachep, pp); SCTP_DBG_OBJCNT_DEC(bind_bucket); } } ",0 "static void sas_probe_devices(struct work_struct *work) { struct domain_device *dev, *n; struct sas_discovery_event *ev = to_sas_discovery_event(work); struct asd_sas_port *port = ev->port; clear_bit(DISCE_PROBE, &port->disc.pending); /* devices must be domain members before link recovery and probe */ list_for_each_entry(dev, &port->disco_list, disco_list_node) { spin_lock_irq(&port->dev_list_lock); list_add_tail(&dev->dev_list_node, &port->dev_list); spin_unlock_irq(&port->dev_list_lock); } sas_probe_sata(port); list_for_each_entry_safe(dev, n, &port->disco_list, disco_list_node) { int err; err = sas_rphy_add(dev->rphy); if (err) sas_fail_probe(dev, __func__, err); else list_del_init(&dev->disco_list_node); } } ",1 "bool FrameSelection::Contains(const LayoutPoint& point) { if (GetDocument().GetLayoutViewItem().IsNull()) return false; const VisibleSelectionInFlatTree& visible_selection = ComputeVisibleSelectionInFlatTree(); if (!visible_selection.IsRange()) return false; HitTestRequest request(HitTestRequest::kReadOnly | HitTestRequest::kActive); HitTestResult result(request, point); GetDocument().GetLayoutViewItem().HitTest(result); Node* inner_node = result.InnerNode(); if (!inner_node || !inner_node->GetLayoutObject()) return false; const VisiblePositionInFlatTree& visible_pos = CreateVisiblePosition(FromPositionInDOMTree( inner_node->GetLayoutObject()->PositionForPoint( result.LocalPoint()))); if (visible_pos.IsNull()) return false; const VisiblePositionInFlatTree& visible_start = visible_selection.VisibleStart(); const VisiblePositionInFlatTree& visible_end = visible_selection.VisibleEnd(); if (visible_start.IsNull() || visible_end.IsNull()) return false; const PositionInFlatTree& start = visible_start.DeepEquivalent(); const PositionInFlatTree& end = visible_end.DeepEquivalent(); const PositionInFlatTree& pos = visible_pos.DeepEquivalent(); return start.CompareTo(pos) <= 0 && pos.CompareTo(end) <= 0; } ",0 "int reserve_new_block(struct dnode_of_data *dn) { unsigned int ofs_in_node = dn->ofs_in_node; int ret; ret = reserve_new_blocks(dn, 1); dn->ofs_in_node = ofs_in_node; return ret; } ",0 "void HTMLFormElement::disassociate(HTMLImageElement& e) { m_imageElementsAreDirty = true; m_imageElements.clear(); removeFromPastNamesMap(e); } ",0 "static void nf_tables_commit_release(struct nft_trans *trans) { switch (trans->msg_type) { case NFT_MSG_DELTABLE: nf_tables_table_destroy(&trans->ctx); break; case NFT_MSG_DELCHAIN: nf_tables_chain_destroy(trans->ctx.chain); break; case NFT_MSG_DELRULE: nf_tables_rule_destroy(&trans->ctx, nft_trans_rule(trans)); break; case NFT_MSG_DELSET: nft_set_destroy(nft_trans_set(trans)); break; } kfree(trans); } ",0 "xmlXPathCacheConvertBoolean(xmlXPathContextPtr ctxt, xmlXPathObjectPtr val) { xmlXPathObjectPtr ret; if (val == NULL) return(xmlXPathCacheNewBoolean(ctxt, 0)); if (val->type == XPATH_BOOLEAN) return(val); ret = xmlXPathCacheNewBoolean(ctxt, xmlXPathCastToBoolean(val)); xmlXPathReleaseObject(ctxt, val); return(ret); } ",0 "static TPM_RC AddSession( SESSION_LIST_ENTRY **sessionEntry ) { SESSION_LIST_ENTRY **newEntry; for( newEntry = &local_sessions_list; *newEntry != 0; *newEntry = ( (SESSION_LIST_ENTRY *)*newEntry)->nextEntry ) ; *newEntry = malloc( sizeof( SESSION_LIST_ENTRY ) ); if( *newEntry != 0 ) { *sessionEntry = *newEntry; (*sessionEntry)->nextEntry = 0; local_session_entries_used++; return TPM_RC_SUCCESS; } else { return TSS2_APP_RC_SESSION_SLOT_NOT_FOUND; } } ",0 "bool IRCView::search(const QString& pattern, bool caseSensitive, bool wholeWords, bool forward, bool fromCursor) { if (pattern.isEmpty()) return true; m_pattern = pattern; m_forward = forward; m_searchFlags = 0; if (caseSensitive) m_searchFlags |= QTextDocument::FindCaseSensitively; if (wholeWords) m_searchFlags |= QTextDocument::FindWholeWords; if (!fromCursor) m_forward ? moveCursor(QTextCursor::Start) : moveCursor(QTextCursor::End); return searchNext(); } ",0 "static void saa7164_bus_dumpmsg(struct saa7164_dev *dev, struct tmComResInfo *m, void *buf) { dprintk(DBGLVL_BUS, ""Dumping msg structure:\n""); dprintk(DBGLVL_BUS, "" .id = %d\n"", m->id); dprintk(DBGLVL_BUS, "" .flags = 0x%x\n"", m->flags); dprintk(DBGLVL_BUS, "" .size = 0x%x\n"", m->size); dprintk(DBGLVL_BUS, "" .command = 0x%x\n"", m->command); dprintk(DBGLVL_BUS, "" .controlselector = 0x%x\n"", m->controlselector); dprintk(DBGLVL_BUS, "" .seqno = %d\n"", m->seqno); if (buf) dprintk(DBGLVL_BUS, "" .buffer (ignored)\n""); } ",0 " tt_cmap10_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p = table + 4; FT_ULong length, count; if ( table + 20 > valid->limit ) FT_INVALID_TOO_SHORT; length = TT_NEXT_ULONG( p ); p = table + 16; count = TT_NEXT_ULONG( p ); if ( table + length > valid->limit || length < 20 + count * 2 ) FT_INVALID_TOO_SHORT; /* check glyph indices */ { FT_UInt gindex; for ( ; count > 0; count-- ) { gindex = TT_NEXT_USHORT( p ); if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) ) FT_INVALID_GLYPH_ID; } } return SFNT_Err_Ok; } ",1 "fbStore_a4r4g4b4 (FbBits *bits, const CARD32 *values, int x, int width, miIndexedPtr indexed) { int i; CARD16 *pixel = ((CARD16 *) bits) + x; for (i = 0; i < width; ++i) { Splita(READ(values + i)); WRITE(pixel++, ((a << 8) & 0xf000) | ((r << 4) & 0x0f00) | ((g ) & 0x00f0) | ((b >> 4) )); } } ",0 " bool readDOMFileSystem(v8::Handle* value) { uint32_t type; String name; String url; if (!doReadUint32(&type)) return false; if (!readWebCoreString(&name)) return false; if (!readWebCoreString(&url)) return false; DOMFileSystem* fs = DOMFileSystem::create(m_scriptState->executionContext(), name, static_cast(type), KURL(ParsedURLString, url)); *value = toV8(fs, m_scriptState->context()->Global(), isolate()); return true; } ",0 "const Vector& Document::AnnotatedRegions() const { return annotated_regions_; } ",0 "void Browser::OnStateChanged() { DCHECK(profile_->GetProfileSyncService()); #if !defined(OS_MACOSX) const bool show_main_ui = is_type_tabbed() && !window_->IsFullscreen(); #else const bool show_main_ui = is_type_tabbed(); #endif command_updater_.UpdateCommandEnabled(IDC_SYNC_BOOKMARKS, show_main_ui && profile_->GetOriginalProfile()->IsSyncAccessible()); } ",0 "MagickExport MagickBooleanType LevelizeImage(Image *image, const double black_point,const double white_point,const double gamma, ExceptionInfo *exception) { #define LevelizeImageTag ""Levelize/Image"" #define LevelizeValue(x) ClampToQuantum(((MagickRealType) gamma_pow((double) \ (QuantumScale*(x)),gamma))*(white_point-black_point)+black_point) CacheView *image_view; MagickBooleanType status; MagickOffsetType progress; register ssize_t i; ssize_t y; /* Allocate and initialize levels map. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if (image->storage_class == PseudoClass) for (i=0; i < (ssize_t) image->colors; i++) { /* Level colormap. */ if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].red=(double) LevelizeValue(image->colormap[i].red); if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].green=(double) LevelizeValue( image->colormap[i].green); if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].blue=(double) LevelizeValue(image->colormap[i].blue); if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].alpha=(double) LevelizeValue( image->colormap[i].alpha); } /* Level image. */ status=MagickTrue; progress=0; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static) shared(progress,status) \ magick_number_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++) { register ssize_t j; for (j=0; j < (ssize_t) GetPixelChannels(image); j++) { PixelChannel channel = GetPixelChannelChannel(image,j); PixelTrait traits = GetPixelChannelTraits(image,channel); if ((traits & UpdatePixelTrait) == 0) continue; q[j]=LevelizeValue(q[j]); } q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp atomic #endif progress++; proceed=SetImageProgress(image,LevelizeImageTag,progress,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); return(status); } ",0 "status_t AudioFlinger::EffectModule::stop() { Mutex::Autolock _l(mLock); return stop_l(); } ",0 "void OneClickSigninSyncStarter::CompleteInitForNewProfile( chrome::HostDesktopType desktop_type, Profile* new_profile, Profile::CreateStatus status) { DCHECK_NE(profile_, new_profile); switch (status) { case Profile::CREATE_STATUS_LOCAL_FAIL: { NOTREACHED() << ""Error creating new profile""; CancelSigninAndDelete(); return; } case Profile::CREATE_STATUS_CREATED: { break; } case Profile::CREATE_STATUS_INITIALIZED: { SigninManager* old_signin_manager = SigninManagerFactory::GetForProfile(profile_); SigninManager* new_signin_manager = SigninManagerFactory::GetForProfile(new_profile); DCHECK(!old_signin_manager->GetUsernameForAuthInProgress().empty()); DCHECK(old_signin_manager->GetAuthenticatedUsername().empty()); DCHECK(new_signin_manager->GetAuthenticatedUsername().empty()); DCHECK(policy_client_); new_signin_manager->CopyCredentialsFrom(*old_signin_manager); FinishProfileSyncServiceSetup(); Initialize(new_profile, NULL); DCHECK_EQ(profile_, new_profile); old_signin_manager->SignOut(); LoadPolicyWithCachedClient(); ProfileManager::FindOrCreateNewWindowForProfile( new_profile, chrome::startup::IS_PROCESS_STARTUP, chrome::startup::IS_FIRST_RUN, desktop_type, false); break; } case Profile::CREATE_STATUS_REMOTE_FAIL: case Profile::CREATE_STATUS_CANCELED: case Profile::MAX_CREATE_STATUS: { NOTREACHED() << ""Invalid profile creation status""; CancelSigninAndDelete(); return; } } } ",0 "struct inode *ilookup(struct super_block *sb, unsigned long ino) { struct hlist_head *head = inode_hashtable + hash(sb, ino); struct inode *inode; spin_lock(&inode_hash_lock); inode = find_inode_fast(sb, head, ino); spin_unlock(&inode_hash_lock); if (inode) wait_on_inode(inode); return inode; } ",0 "void WebTransformOperations::appendScale(double x, double y, double z) { WebTransformOperation toAdd; toAdd.matrix.scale3d(x, y, z); toAdd.type = WebTransformOperation::WebTransformOperationScale; toAdd.scale.x = x; toAdd.scale.y = y; toAdd.scale.z = z; m_private->operations.append(toAdd); } ",0 "static void scale_rgn(SkRegion* dst, const SkRegion& src, float scale) { SkRegion tmp; SkRegion::Iterator iter(src); for (; !iter.done(); iter.next()) { SkIRect r; scale_rect(&r, iter.rect(), scale); tmp.op(r, SkRegion::kUnion_Op); } dst->swap(tmp); } ",0 "GLvoid StubGLAttachShader(GLuint program, GLuint shader) { glAttachShader(program, shader); } ",0 "static void scsi_write_complete(void * opaque, int ret) { SCSIDiskReq *r = (SCSIDiskReq *)opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; bdrv_acct_done(s->bs, &r->acct); } if (ret) { if (scsi_handle_rw_error(r, -ret, SCSI_REQ_STATUS_RETRY_WRITE)) { return; } } n = r->qiov.size / 512; r->sector += n; r->sector_count -= n; if (r->sector_count == 0) { scsi_req_complete(&r->req, GOOD); } else { scsi_init_iovec(r); DPRINTF(""Write complete tag=0x%x more=%d\n"", r->req.tag, r->qiov.size); scsi_req_data(&r->req, r->qiov.size); } } ",0 "static inline struct array_cache *cpu_cache_get(struct kmem_cache *cachep) { return this_cpu_ptr(cachep->cpu_cache); } ",0 "void V8TestObject::ElementAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_elementAttribute_Getter""); test_object_v8_internal::ElementAttributeAttributeGetter(info); } ",0 "bool ResourceDispatcherHostImpl::allow_cross_origin_auth_prompt() { return allow_cross_origin_auth_prompt_; } ",0 "void ContextualSearchDelegate::StartSearchTermResolutionRequest( const std::string& selection, bool use_resolved_search_term, content::WebContents* web_contents, bool may_send_base_page_url) { GatherSurroundingTextWithCallback( selection, use_resolved_search_term, web_contents, may_send_base_page_url, base::Bind(&ContextualSearchDelegate::StartSearchTermRequestFromSelection, AsWeakPtr())); } ",0 " virtual void didFailRedirectCheck() { m_callback->sendFailure(""Loading resource for inspector failed redirect check""); dispose(); } ",0 "bool Document::NeedsFullLayoutTreeUpdate() const { if (!IsActive() || !View()) return false; if (style_engine_->NeedsActiveStyleUpdate()) return true; if (style_engine_->NeedsWhitespaceReattachment()) return true; if (!use_elements_needing_update_.IsEmpty()) return true; if (NeedsStyleRecalc()) return true; if (NeedsStyleInvalidation()) return true; if (ChildNeedsDistributionRecalc()) return true; if (DocumentAnimations::NeedsAnimationTimingUpdate(*this)) return true; return false; } ",0 "static int mov_write_tkhd_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, AVStream *st) { int64_t duration = av_rescale_rnd(track->track_duration, MOV_TIMESCALE, track->timescale, AV_ROUND_UP); int version = duration < INT32_MAX ? 0 : 1; int flags = MOV_TKHD_FLAG_IN_MOVIE; int rotation = 0; int group = 0; uint32_t *display_matrix = NULL; int display_matrix_size, i; if (st) { if (mov->per_stream_grouping) group = st->index; else group = st->codecpar->codec_type; display_matrix = (uint32_t*)av_stream_get_side_data(st, AV_PKT_DATA_DISPLAYMATRIX, &display_matrix_size); if (display_matrix && display_matrix_size < 9 * sizeof(*display_matrix)) display_matrix = NULL; } if (track->flags & MOV_TRACK_ENABLED) flags |= MOV_TKHD_FLAG_ENABLED; if (track->mode == MODE_ISM) version = 1; (version == 1) ? avio_wb32(pb, 104) : avio_wb32(pb, 92); /* size */ ffio_wfourcc(pb, ""tkhd""); avio_w8(pb, version); avio_wb24(pb, flags); if (version == 1) { avio_wb64(pb, track->time); avio_wb64(pb, track->time); } else { avio_wb32(pb, track->time); /* creation time */ avio_wb32(pb, track->time); /* modification time */ } avio_wb32(pb, track->track_id); /* track-id */ avio_wb32(pb, 0); /* reserved */ if (!track->entry && mov->mode == MODE_ISM) (version == 1) ? avio_wb64(pb, UINT64_C(0xffffffffffffffff)) : avio_wb32(pb, 0xffffffff); else if (!track->entry) (version == 1) ? avio_wb64(pb, 0) : avio_wb32(pb, 0); else (version == 1) ? avio_wb64(pb, duration) : avio_wb32(pb, duration); avio_wb32(pb, 0); /* reserved */ avio_wb32(pb, 0); /* reserved */ avio_wb16(pb, 0); /* layer */ avio_wb16(pb, group); /* alternate group) */ /* Volume, only for audio */ if (track->par->codec_type == AVMEDIA_TYPE_AUDIO) avio_wb16(pb, 0x0100); else avio_wb16(pb, 0); avio_wb16(pb, 0); /* reserved */ /* Matrix structure */ #if FF_API_OLD_ROTATE_API if (st && st->metadata) { AVDictionaryEntry *rot = av_dict_get(st->metadata, ""rotate"", NULL, 0); rotation = (rot && rot->value) ? atoi(rot->value) : 0; } #endif if (display_matrix) { for (i = 0; i < 9; i++) avio_wb32(pb, display_matrix[i]); #if FF_API_OLD_ROTATE_API } else if (rotation == 90) { write_matrix(pb, 0, 1, -1, 0, track->par->height, 0); } else if (rotation == 180) { write_matrix(pb, -1, 0, 0, -1, track->par->width, track->par->height); } else if (rotation == 270) { write_matrix(pb, 0, -1, 1, 0, 0, track->par->width); #endif } else { write_matrix(pb, 1, 0, 0, 1, 0, 0); } /* Track width and height, for visual only */ if (st && (track->par->codec_type == AVMEDIA_TYPE_VIDEO || track->par->codec_type == AVMEDIA_TYPE_SUBTITLE)) { int64_t track_width_1616; if (track->mode == MODE_MOV) { track_width_1616 = track->par->width * 0x10000ULL; } else { track_width_1616 = av_rescale(st->sample_aspect_ratio.num, track->par->width * 0x10000LL, st->sample_aspect_ratio.den); if (!track_width_1616 || track->height != track->par->height || track_width_1616 > UINT32_MAX) track_width_1616 = track->par->width * 0x10000ULL; } if (track_width_1616 > UINT32_MAX) { av_log(mov->fc, AV_LOG_WARNING, ""track width is too large\n""); track_width_1616 = 0; } avio_wb32(pb, track_width_1616); if (track->height > 0xFFFF) { av_log(mov->fc, AV_LOG_WARNING, ""track height is too large\n""); avio_wb32(pb, 0); } else avio_wb32(pb, track->height * 0x10000U); } else { avio_wb32(pb, 0); avio_wb32(pb, 0); } return 0x5c; } ",0 "static void tg3_frob_aux_power_5717(struct tg3 *tp, bool wol_enable) { u32 msg = 0; /* Serialize power state transitions */ if (tg3_ape_lock(tp, TG3_APE_LOCK_GPIO)) return; if (tg3_flag(tp, ENABLE_ASF) || tg3_flag(tp, ENABLE_APE) || wol_enable) msg = TG3_GPIO_MSG_NEED_VAUX; msg = tg3_set_function_status(tp, msg); if (msg & TG3_GPIO_MSG_ALL_DRVR_PRES_MASK) goto done; if (msg & TG3_GPIO_MSG_ALL_NEED_VAUX_MASK) tg3_pwrsrc_switch_to_vaux(tp); else tg3_pwrsrc_die_with_vmain(tp); done: tg3_ape_unlock(tp, TG3_APE_LOCK_GPIO); } ",0 "cmsBool GrowMLUtable(cmsMLU* mlu) { int AllocatedEntries; _cmsMLUentry *NewPtr; if (mlu == NULL) return FALSE; AllocatedEntries = mlu ->AllocatedEntries * 2; if (AllocatedEntries / 2 != mlu ->AllocatedEntries) return FALSE; NewPtr = (_cmsMLUentry*)_cmsRealloc(mlu ->ContextID, mlu ->Entries, AllocatedEntries*sizeof(_cmsMLUentry)); if (NewPtr == NULL) return FALSE; mlu ->Entries = NewPtr; mlu ->AllocatedEntries = AllocatedEntries; return TRUE; } ",0 "void CellularNetwork::Clear() { WirelessNetwork::Clear(); activation_state_ = ACTIVATION_STATE_UNKNOWN; roaming_state_ = ROAMING_STATE_UNKNOWN; network_technology_ = NETWORK_TECHNOLOGY_UNKNOWN; restricted_pool_ = false; service_name_.clear(); operator_name_.clear(); operator_code_.clear(); payment_url_.clear(); meid_.clear(); imei_.clear(); imsi_.clear(); esn_.clear(); mdn_.clear(); min_.clear(); model_id_.clear(); manufacturer_.clear(); firmware_revision_.clear(); hardware_revision_.clear(); last_update_.clear(); prl_version_ = 0; } ",0 "void V8TestObject::PartiallyRuntimeEnabledOverloadedVoidMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_partiallyRuntimeEnabledOverloadedVoidMethod""); test_object_v8_internal::PartiallyRuntimeEnabledOverloadedVoidMethodMethod(info); } ",0 "daemon_linux_lvm2_vg_set_name (Daemon *daemon, const gchar *uuid, const gchar *new_name, DBusGMethodInvocation *context) { daemon_local_check_auth (daemon, NULL, ""org.freedesktop.udisks.linux-lvm2"", ""LinuxLvm2VGSetName"", TRUE, daemon_linux_lvm2_vg_set_name_authorized_cb, context, 2, g_strdup (uuid), g_free, g_strdup (new_name), g_free); return TRUE; } ",0 "static void vmx_vcpu_put(struct kvm_vcpu *vcpu) { __vmx_load_host_state(to_vmx(vcpu)); if (!vmm_exclusive) { __loaded_vmcs_clear(to_vmx(vcpu)->loaded_vmcs); vcpu->cpu = -1; kvm_cpu_vmxoff(); } } ",0 "static bool svm_cpu_has_accelerated_tpr(void) { return false; } ",0 "DownloadRequestLimiter::TabDownloadState::TabDownloadState( DownloadRequestLimiter* host, content::WebContents* contents, content::WebContents* originating_web_contents) : content::WebContentsObserver(contents), web_contents_(contents), host_(host), status_(DownloadRequestLimiter::ALLOW_ONE_DOWNLOAD), ui_status_(DownloadRequestLimiter::DOWNLOAD_UI_DEFAULT), download_count_(0), download_seen_(false), observer_(this), factory_(this) { observer_.Add(GetContentSettings(contents)); NavigationEntry* last_entry = originating_web_contents ? originating_web_contents->GetController().GetLastCommittedEntry() : contents->GetController().GetLastCommittedEntry(); if (last_entry) initial_page_host_ = last_entry->GetURL().host(); } ",0 "hfs_file_read_compressed_attr(TSK_FS_FILE* fs_file, uint8_t cmpType, char* buffer, uint32_t attributeLength, uint64_t uncSize, int (*decompress_attr)(char* rawBuf, uint32_t rawSize, uint64_t uncSize, char** dstBuf, uint64_t* dstSize, int* dstBufFree)) { if (tsk_verbose) tsk_fprintf(stderr, ""%s: Compressed data is inline in the attribute, will load this as the default DATA attribute.\n"", __func__); if (attributeLength <= 16) { if (tsk_verbose) tsk_fprintf(stderr, ""%s: WARNING, Compression Record of type %u is not followed by"" "" compressed data. No data will be loaded into the DATA"" "" attribute.\n"", __func__, cmpType); return 1; } TSK_FS_ATTR *fs_attr_unc; if ((fs_attr_unc = tsk_fs_attrlist_getnew( fs_file->meta->attr, TSK_FS_ATTR_RES)) == NULL) { error_returned("" - %s, FS_ATTR for uncompressed data"", __func__); return 0; } char* dstBuf; uint64_t dstSize; int dstBufFree = FALSE; if (!decompress_attr(buffer + 16, attributeLength - 16, uncSize, &dstBuf, &dstSize, &dstBufFree)) { return 0; } if (dstSize != uncSize) { error_detected(TSK_ERR_FS_READ, "" %s, actual uncompressed size not equal to the size in the compression record"", __func__); goto on_error; } if (tsk_verbose) tsk_fprintf(stderr, ""%s: Loading decompressed data as default DATA attribute."", __func__); if (tsk_fs_attr_set_str(fs_file, fs_attr_unc, ""DATA"", TSK_FS_ATTR_TYPE_HFS_DATA, HFS_FS_ATTR_ID_DATA, dstBuf, dstSize)) { error_returned("" - %s"", __func__); goto on_error; } if (dstBufFree) { free(dstBuf); } return 1; on_error: if (dstBufFree) { free(dstBuf); } return 0; } ",0 "std::wstring GetHeaderParamValue(const std::wstring& field, const std::wstring& param_name) { return GetHeaderParamValueT(field, param_name); } ",0 "static int qib_open(struct inode *in, struct file *fp) { /* The real work is performed later in qib_assign_ctxt() */ fp->private_data = kzalloc(sizeof(struct qib_filedata), GFP_KERNEL); if (fp->private_data) /* no cpu affinity by default */ ((struct qib_filedata *)fp->private_data)->rec_cpu_num = -1; return fp->private_data ? 0 : -ENOMEM; } ",0 "struct sock *dn_find_by_skb(struct sk_buff *skb) { struct dn_skb_cb *cb = DN_SKB_CB(skb); struct sock *sk; struct dn_scp *scp; read_lock(&dn_hash_lock); sk_for_each(sk, &dn_sk_hash[le16_to_cpu(cb->dst_port) & DN_SK_HASH_MASK]) { scp = DN_SK(sk); if (cb->src != dn_saddr2dn(&scp->peer)) continue; if (cb->dst_port != scp->addrloc) continue; if (scp->addrrem && (cb->src_port != scp->addrrem)) continue; sock_hold(sk); goto found; } sk = NULL; found: read_unlock(&dn_hash_lock); return sk; } ",0 "void ShelfLayoutManager::StopAutoHideTimer() { auto_hide_timer_.Stop(); mouse_over_shelf_when_auto_hide_timer_started_ = false; } ",0 "void kvm_define_shared_msr(unsigned slot, u32 msr) { if (slot >= shared_msrs_global.nr) shared_msrs_global.nr = slot + 1; shared_msrs_global.msrs[slot] = msr; /* we need ensured the shared_msr_global have been updated */ smp_wmb(); } ",0 "_gcry_mpi_point_snatch_set (mpi_point_t point, gcry_mpi_t x, gcry_mpi_t y, gcry_mpi_t z) { if (!point) point = mpi_point_new (0); if (x) mpi_snatch (point->x, x); else mpi_clear (point->x); if (y) mpi_snatch (point->y, y); else mpi_clear (point->y); if (z) mpi_snatch (point->z, z); else mpi_clear (point->z); return point; } ",0 "init_nodelist(void) { if (PREDICT_UNLIKELY(the_nodelist == NULL)) { the_nodelist = tor_malloc_zero(sizeof(nodelist_t)); HT_INIT(nodelist_map, &the_nodelist->nodes_by_id); the_nodelist->nodes = smartlist_new(); } } ",0 "static void ActivityLoggingGetterForAllWorldsLongAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueInt(info, impl->activityLoggingGetterForAllWorldsLongAttribute()); } ",0 "opj_pi_iterator_t *opj_pi_initialise_encode(const opj_image_t *p_image, opj_cp_t *p_cp, OPJ_UINT32 p_tile_no, J2K_T2_MODE p_t2_mode ) { /* loop*/ OPJ_UINT32 pino; OPJ_UINT32 compno, resno; /* to store w, h, dx and dy fro all components and resolutions*/ OPJ_UINT32 * l_tmp_data; OPJ_UINT32 ** l_tmp_ptr; /* encoding prameters to set*/ OPJ_UINT32 l_max_res; OPJ_UINT32 l_max_prec; OPJ_INT32 l_tx0,l_tx1,l_ty0,l_ty1; OPJ_UINT32 l_dx_min,l_dy_min; OPJ_UINT32 l_bound; OPJ_UINT32 l_step_p , l_step_c , l_step_r , l_step_l ; OPJ_UINT32 l_data_stride; /* pointers*/ opj_pi_iterator_t *l_pi = 00; opj_tcp_t *l_tcp = 00; const opj_tccp_t *l_tccp = 00; opj_pi_comp_t *l_current_comp = 00; opj_image_comp_t * l_img_comp = 00; opj_pi_iterator_t * l_current_pi = 00; OPJ_UINT32 * l_encoding_value_ptr = 00; /* preconditions in debug*/ assert(p_cp != 00); assert(p_image != 00); assert(p_tile_no < p_cp->tw * p_cp->th); /* initializations*/ l_tcp = &p_cp->tcps[p_tile_no]; l_bound = l_tcp->numpocs+1; l_data_stride = 4 * OPJ_J2K_MAXRLVLS; l_tmp_data = (OPJ_UINT32*)opj_malloc( l_data_stride * p_image->numcomps * sizeof(OPJ_UINT32)); if (! l_tmp_data) { return 00; } l_tmp_ptr = (OPJ_UINT32**)opj_malloc( p_image->numcomps * sizeof(OPJ_UINT32 *)); if (! l_tmp_ptr) { opj_free(l_tmp_data); return 00; } /* memory allocation for pi*/ l_pi = opj_pi_create(p_image,p_cp,p_tile_no); if (!l_pi) { opj_free(l_tmp_data); opj_free(l_tmp_ptr); return 00; } l_encoding_value_ptr = l_tmp_data; /* update pointer array*/ for (compno = 0; compno < p_image->numcomps; ++compno) { l_tmp_ptr[compno] = l_encoding_value_ptr; l_encoding_value_ptr += l_data_stride; } /* get encoding parameters*/ opj_get_all_encoding_parameters(p_image,p_cp,p_tile_no,&l_tx0,&l_tx1,&l_ty0,&l_ty1,&l_dx_min,&l_dy_min,&l_max_prec,&l_max_res,l_tmp_ptr); /* step calculations*/ l_step_p = 1; l_step_c = l_max_prec * l_step_p; l_step_r = p_image->numcomps * l_step_c; l_step_l = l_max_res * l_step_r; /* set values for first packet iterator*/ l_pi->tp_on = p_cp->m_specific_param.m_enc.m_tp_on; l_current_pi = l_pi; /* memory allocation for include*/ l_current_pi->include = (OPJ_INT16*) opj_calloc(l_tcp->numlayers * l_step_l, sizeof(OPJ_INT16)); if (!l_current_pi->include) { opj_free(l_tmp_data); opj_free(l_tmp_ptr); opj_pi_destroy(l_pi, l_bound); return 00; } /* special treatment for the first packet iterator*/ l_current_comp = l_current_pi->comps; l_img_comp = p_image->comps; l_tccp = l_tcp->tccps; l_current_pi->tx0 = l_tx0; l_current_pi->ty0 = l_ty0; l_current_pi->tx1 = l_tx1; l_current_pi->ty1 = l_ty1; l_current_pi->dx = l_dx_min; l_current_pi->dy = l_dy_min; l_current_pi->step_p = l_step_p; l_current_pi->step_c = l_step_c; l_current_pi->step_r = l_step_r; l_current_pi->step_l = l_step_l; /* allocation for components and number of components has already been calculated by opj_pi_create */ for (compno = 0; compno < l_current_pi->numcomps; ++compno) { opj_pi_resolution_t *l_res = l_current_comp->resolutions; l_encoding_value_ptr = l_tmp_ptr[compno]; l_current_comp->dx = l_img_comp->dx; l_current_comp->dy = l_img_comp->dy; /* resolutions have already been initialized */ for (resno = 0; resno < l_current_comp->numresolutions; resno++) { l_res->pdx = *(l_encoding_value_ptr++); l_res->pdy = *(l_encoding_value_ptr++); l_res->pw = *(l_encoding_value_ptr++); l_res->ph = *(l_encoding_value_ptr++); ++l_res; } ++l_current_comp; ++l_img_comp; ++l_tccp; } ++l_current_pi; for (pino = 1 ; pinocomps; l_img_comp = p_image->comps; l_tccp = l_tcp->tccps; l_current_pi->tx0 = l_tx0; l_current_pi->ty0 = l_ty0; l_current_pi->tx1 = l_tx1; l_current_pi->ty1 = l_ty1; l_current_pi->dx = l_dx_min; l_current_pi->dy = l_dy_min; l_current_pi->step_p = l_step_p; l_current_pi->step_c = l_step_c; l_current_pi->step_r = l_step_r; l_current_pi->step_l = l_step_l; /* allocation for components and number of components has already been calculated by opj_pi_create */ for (compno = 0; compno < l_current_pi->numcomps; ++compno) { opj_pi_resolution_t *l_res = l_current_comp->resolutions; l_encoding_value_ptr = l_tmp_ptr[compno]; l_current_comp->dx = l_img_comp->dx; l_current_comp->dy = l_img_comp->dy; /* resolutions have already been initialized */ for (resno = 0; resno < l_current_comp->numresolutions; resno++) { l_res->pdx = *(l_encoding_value_ptr++); l_res->pdy = *(l_encoding_value_ptr++); l_res->pw = *(l_encoding_value_ptr++); l_res->ph = *(l_encoding_value_ptr++); ++l_res; } ++l_current_comp; ++l_img_comp; ++l_tccp; } /* special treatment*/ l_current_pi->include = (l_current_pi-1)->include; ++l_current_pi; } opj_free(l_tmp_data); l_tmp_data = 00; opj_free(l_tmp_ptr); l_tmp_ptr = 00; if (l_tcp->POC && (OPJ_IS_CINEMA(p_cp->rsiz) || p_t2_mode == FINAL_PASS)) { opj_pi_update_encode_poc_and_final(p_cp,p_tile_no,l_tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min); } else { opj_pi_update_encode_not_poc(p_cp,p_image->numcomps,p_tile_no,l_tx0,l_tx1,l_ty0,l_ty1,l_max_prec,l_max_res,l_dx_min,l_dy_min); } return l_pi; } ",0 "openssl_callback(int ok, X509_STORE_CTX * ctx) { #ifdef DEBUG if (!ok) { char buf[DN_BUF_LEN]; X509_NAME_oneline(X509_get_subject_name(ctx->current_cert), buf, sizeof(buf)); pkiDebug(""cert = %s\n"", buf); pkiDebug(""callback function: %d (%s)\n"", ctx->error, X509_verify_cert_error_string(ctx->error)); } #endif return ok; } ",0 "get_aix_arch( struct utsname *buf ) { char *ret = ""UNK""; char d[3]; int model; /* The model number is encoded in the last two non zero digits of the model code. */ d[0] = buf->machine[ strlen( buf->machine ) - 4 ]; d[1] = buf->machine[ strlen( buf->machine ) - 3 ]; d[2] = '\0'; model = strtol(d, NULL, 16); /* ok, group the model numbers into processor families: */ switch(model) { case 0x10: /* Model 530/730 */ break; case 0x11: case 0x14: /* Model 540 */ break; case 0x18: /* Model 530H */ break; case 0x1C: /* Model 550 */ break; case 0x20: /* Model 930 */ break; case 0x2E: /* Model 950/950E */ break; case 0x30: /* Model 520 or 740/741 */ break; case 0x31: /* Model 320 */ break; case 0x34: /* Model 520H */ break; case 0x35: /* Model 32H/320E */ break; case 0x37: /* Model 340/34H */ break; case 0x38: /* Model 350 */ break; case 0x41: /* Model 220/22W/22G/230 */ break; case 0x42: /* Model 41T/41W */ break; case 0x43: /* Model M20 */ break; case 0x45: /* Model 220/M20/230/23W */ break; case 0x46: case 0x49: /* Model 250 */ break; case 0x47: /* Model 230 */ break; case 0x48: /* Model C10 */ break; case 0x4C: /* PowerPC 603/604 model, and later */ ret = strdup(""PWR3II""); break; case 0x4D: /* Model 40P */ break; case 0x57: /* Model 390/3AT/3BT */ break; case 0x58: /* Model 380/3AT/3BT */ break; case 0x59: /* Model 39H/3CT */ break; case 0x5C: /* Model 560 */ break; case 0x63: /* Model 970/97B */ break; case 0x64: /* Model 980/98B */ break; case 0x66: /* Model 580/58F */ break; case 0x67: /* Model 570/770/R10 */ break; case 0x70: /* Model 590 */ break; case 0x71: /* Model 58H */ break; case 0x72: /* Model 59H/58H/R12/R20 */ break; case 0x75: /* Model 370/375/37T */ break; case 0x76: /* Model 360/365/36T */ break; case 0x77: /* Model 315/350/355/510/550H/550L */ break; case 0x79: /* Model 591 */ break; case 0x80: /* Model 990 */ break; case 0x81: /* Model R24 */ break; case 0x82: /* Model R00/R24 */ break; case 0x89: /* Model 595 */ break; case 0x90: /* Model C20 */ break; case 0x91: /* Model 42T */ break; case 0x94: /* Model 397 */ break; case 0xA0: /* Model J30 */ break; case 0xA1: /* Model J40 */ break; case 0xA3: /* Model R30 */ break; case 0xA4: /* Model R40 */ break; case 0xA6: /* Model G30 */ break; case 0xA7: /* Model G40 */ break; case 0xC4: /* Model F30 */ break; default: /* unknown model, use default value of ret */ break; } return ret; } ",0 "std::unique_ptr ProfilingService::CreateService() { return base::MakeUnique(); } ",0 "SYSCALL_DEFINE3(get_robust_list, int, pid, struct robust_list_head __user * __user *, head_ptr, size_t __user *, len_ptr) { struct robust_list_head __user *head; unsigned long ret; struct task_struct *p; if (!futex_cmpxchg_enabled) return -ENOSYS; WARN_ONCE(1, ""deprecated: get_robust_list will be deleted in 2013.\n""); rcu_read_lock(); ret = -ESRCH; if (!pid) p = current; else { p = find_task_by_vpid(pid); if (!p) goto err_unlock; } ret = -EPERM; if (!ptrace_may_access(p, PTRACE_MODE_READ)) goto err_unlock; head = p->robust_list; rcu_read_unlock(); if (put_user(sizeof(*head), len_ptr)) return -EFAULT; return put_user(head, head_ptr); err_unlock: rcu_read_unlock(); return ret; } ",0 "static int ext4_index_trans_blocks(struct inode *inode, int nrblocks, int chunk) { if (!(EXT4_I(inode)->i_flags & EXT4_EXTENTS_FL)) return ext4_indirect_trans_blocks(inode, nrblocks, chunk); return ext4_ext_index_trans_blocks(inode, nrblocks, chunk); } ",0 "get_dfs_path(const unsigned int xid, struct cifs_ses *ses, const char *old_path, const struct nls_table *nls_codepage, unsigned int *num_referrals, struct dfs_info3_param **referrals, int remap) { char *temp_unc; int rc = 0; if (!ses->server->ops->tree_connect || !ses->server->ops->get_dfs_refer) return -ENOSYS; *num_referrals = 0; *referrals = NULL; if (ses->ipc_tid == 0) { temp_unc = kmalloc(2 /* for slashes */ + strnlen(ses->serverName, SERVER_NAME_LEN_WITH_NULL * 2) + 1 + 4 /* slash IPC$ */ + 2, GFP_KERNEL); if (temp_unc == NULL) return -ENOMEM; temp_unc[0] = '\\'; temp_unc[1] = '\\'; strcpy(temp_unc + 2, ses->serverName); strcpy(temp_unc + 2 + strlen(ses->serverName), ""\\IPC$""); rc = ses->server->ops->tree_connect(xid, ses, temp_unc, NULL, nls_codepage); cifs_dbg(FYI, ""Tcon rc = %d ipc_tid = %d\n"", rc, ses->ipc_tid); kfree(temp_unc); } if (rc == 0) rc = ses->server->ops->get_dfs_refer(xid, ses, old_path, referrals, num_referrals, nls_codepage, remap); /* * BB - map targetUNCs to dfs_info3 structures, here or in * ses->server->ops->get_dfs_refer. */ return rc; } ",0 "static int cmd_pointer(void *data, const char *input) { RCore *core = (RCore*) data; int ret = true; char *str, *eq; while (*input == ' ') input++; if (!*input || *input == '?') { const char* help_msg[] = { ""Usage:"", ""*[=[0x]value]"", ""Pointer read/write data/values"", ""*"", ""entry0=cc"", ""write trap in entrypoint"", ""*"", ""entry0+10=0x804800"", ""write value in delta address"", ""*"", ""entry0"", ""read byte at given address"", ""TODO: last command should honor asm.bits"", """", """", NULL}; r_core_cmd_help (core, help_msg); return ret; } str = strdup (input); eq = strchr (str, '='); if (eq) { *eq++ = 0; if (!strncmp (eq, ""0x"", 2)) { ret = r_core_cmdf (core, ""wv %s@%s"", eq, str); } else { ret = r_core_cmdf (core, ""wx %s@%s"", eq, str); } } else { ret = r_core_cmdf (core, ""?v [%s]"", input); } free (str); return ret; } ",0 "void QuitMessageLoop(PP_Instance instance) { MessageLoop::current()->QuitNow(); } ",0 "GLvoid StubGLUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { glUniformMatrix4fv(location, count, transpose, value); } ",0 "SPL_METHOD(SplObjectStorage, valid) { spl_SplObjectStorage *intern = (spl_SplObjectStorage*)zend_object_store_get_object(getThis() TSRMLS_CC); if (zend_parse_parameters_none() == FAILURE) { return; } RETURN_BOOL(zend_hash_has_more_elements_ex(&intern->storage, &intern->pos) == SUCCESS); } /* }}} */ /* {{{ proto mixed SplObjectStorage::key() ",0 "bool TestRenderWidgetHostView::LockMouse() { return false; } ",0 "static int mailimf_time_parse(const char * message, size_t length, size_t * indx, int * phour, int * pmin, int * psec, int * pzone) { size_t cur_token; int hour; int min; int sec; int zone; int r; cur_token = * indx; r = mailimf_cfws_parse(message, length, &cur_token); if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) return r; r = mailimf_time_of_day_parse(message, length, &cur_token, &hour, &min, &sec); if (r != MAILIMF_NO_ERROR) return r; r = mailimf_fws_parse(message, length, &cur_token); if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) return r; r = mailimf_zone_parse(message, length, &cur_token, &zone); if (r == MAILIMF_NO_ERROR) { /* do nothing */ } else if (r == MAILIMF_ERROR_PARSE) { zone = 0; } else { return r; } * phour = hour; * pmin = min; * psec = sec; * pzone = zone; * indx = cur_token; return MAILIMF_NO_ERROR; } ",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; } ",0 "static void comedi_set_subdevice_runflags(struct comedi_subdevice *s, unsigned mask, unsigned bits) { unsigned long flags; spin_lock_irqsave(&s->spin_lock, flags); s->runflags &= ~mask; s->runflags |= (bits & mask); spin_unlock_irqrestore(&s->spin_lock, flags); } ",0 "static u16 llcp_tlv16(u8 *tlv, u8 type) { if (tlv[0] != type || tlv[1] != llcp_tlv_length[tlv[0]]) return 0; return be16_to_cpu(*((__be16 *)(tlv + 2))); } ",0 "static void countEditingEvent(ExecutionContext* executionContext, const Event* event, UseCounter::Feature featureOnInput, UseCounter::Feature featureOnTextArea, UseCounter::Feature featureOnContentEditable, UseCounter::Feature featureOnNonNode) { EventTarget* eventTarget = event->target(); Node* node = eventTarget->toNode(); if (!node) { UseCounter::count(executionContext, featureOnNonNode); return; } if (isHTMLInputElement(node)) { UseCounter::count(executionContext, featureOnInput); return; } if (isHTMLTextAreaElement(node)) { UseCounter::count(executionContext, featureOnTextArea); return; } TextControlElement* control = enclosingTextControl(node); if (isHTMLInputElement(control)) { UseCounter::count(executionContext, featureOnInput); return; } if (isHTMLTextAreaElement(control)) { UseCounter::count(executionContext, featureOnTextArea); return; } UseCounter::count(executionContext, featureOnContentEditable); } ",0 "void AppCacheUpdateJob::OnResponseInfoLoaded( AppCacheResponseInfo* response_info, int64_t response_id) { const net::HttpResponseInfo* http_info = response_info ? &response_info->http_response_info() : nullptr; if (internal_state_ == FETCH_MANIFEST) { if (http_info) manifest_fetcher_->set_existing_response_headers( http_info->headers.get()); manifest_fetcher_->Start(); return; } auto found = loading_responses_.find(response_id); DCHECK(found != loading_responses_.end()); const GURL& url = found->second; if (!http_info) { LoadFromNewestCacheFailed(url, nullptr); // no response found } else if (!CanUseExistingResource(http_info)) { LoadFromNewestCacheFailed(url, response_info); } else { DCHECK(group_->newest_complete_cache()); AppCacheEntry* copy_me = group_->newest_complete_cache()->GetEntry(url); DCHECK(copy_me); DCHECK_EQ(copy_me->response_id(), response_id); auto it = url_file_list_.find(url); DCHECK(it != url_file_list_.end()); AppCacheEntry& entry = it->second; entry.set_response_id(response_id); entry.set_response_size(copy_me->response_size()); inprogress_cache_->AddOrModifyEntry(url, entry); NotifyAllProgress(url); ++url_fetches_completed_; } loading_responses_.erase(found); MaybeCompleteUpdate(); } ",1 "parse_SET_IP_ECN(char *arg, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols OVS_UNUSED) { uint8_t ecn; char *error; error = str_to_u8(arg, ""ECN"", &ecn); if (error) { return error; } if (ecn & ~IP_ECN_MASK) { return xasprintf(""%s: not a valid ECN"", arg); } ofpact_put_SET_IP_ECN(ofpacts)->ecn = ecn; return NULL; } ",0 "static int edge_remove_sysfs_attrs(struct usb_serial_port *port) { device_remove_file(&port->dev, &dev_attr_uart_mode); return 0; } ",0 "XItoCoreType(int xitype) { int coretype = 0; if (xitype == DeviceMotionNotify) coretype = MotionNotify; else if (xitype == DeviceButtonPress) coretype = ButtonPress; else if (xitype == DeviceButtonRelease) coretype = ButtonRelease; else if (xitype == DeviceKeyPress) coretype = KeyPress; else if (xitype == DeviceKeyRelease) coretype = KeyRelease; return coretype; } ",0 "GF_Err moof_Size(GF_Box *s) { GF_Err e; GF_MovieFragmentBox *ptr = (GF_MovieFragmentBox *)s; if (ptr->mfhd) { e = gf_isom_box_size((GF_Box *)ptr->mfhd); if (e) return e; ptr->size += ptr->mfhd->size; } return gf_isom_box_array_size(s, ptr->TrackList); } ",0 "GF_Err stsz_Size(GF_Box *s) { u32 i, fieldSize, size; GF_SampleSizeBox *ptr = (GF_SampleSizeBox *)s; ptr->size += 8; if (!ptr->sampleCount) return GF_OK; if (ptr->type == GF_ISOM_BOX_TYPE_STSZ) { if (ptr->sampleSize) return GF_OK; ptr->size += (4 * ptr->sampleCount); return GF_OK; } fieldSize = 4; size = ptr->sizes[0]; for (i=0; i < ptr->sampleCount; i++) { if (ptr->sizes[i] <= 0xF) continue; else if (ptr->sizes[i] <= 0xFF) { fieldSize = 8; } else if (ptr->sizes[i] <= 0xFFFF) { fieldSize = 16; } else { fieldSize = 32; } if (size != ptr->sizes[i]) size = 0; } if (size) { ptr->type = GF_ISOM_BOX_TYPE_STSZ; ptr->sampleSize = size; gf_free(ptr->sizes); ptr->sizes = NULL; } if (fieldSize == 32) { ptr->type = GF_ISOM_BOX_TYPE_STSZ; ptr->size += (4 * ptr->sampleCount); return GF_OK; } ptr->type = GF_ISOM_BOX_TYPE_STZ2; ptr->sampleSize = fieldSize; if (fieldSize == 4) { ptr->size += (ptr->sampleCount + 1) / 2; } else { ptr->size += (ptr->sampleCount) * (fieldSize/8); } return GF_OK; } ",0 "ModuleExport void UnregisterPNMImage(void) { (void) UnregisterMagickInfo(""PAM""); (void) UnregisterMagickInfo(""PBM""); (void) UnregisterMagickInfo(""PGM""); (void) UnregisterMagickInfo(""PNM""); (void) UnregisterMagickInfo(""PPM""); } ",0 "base::string16 OmniboxEditModel::DisplayTextFromUserText( const base::string16& text) const { return KeywordIsSelected() ? KeywordProvider::SplitReplacementStringFromInput(text, false) : text; } ",0 "void UkmPageLoadMetricsObserver::ReportLayoutStability( const page_load_metrics::PageLoadExtraInfo& info) { if (!base::FeatureList::IsEnabled(blink::features::kJankTracking)) return; float jank_score = info.main_frame_render_data.layout_jank_score; int64_t ukm_value = static_cast(roundf(std::min(jank_score, 10.0f) * 100.0f)); ukm::builders::PageLoad builder(info.source_id); builder.SetLayoutStability_JankScore(ukm_value); builder.Record(ukm::UkmRecorder::Get()); int32_t uma_value = static_cast(roundf(std::min(jank_score, 10.0f) * 10.0f)); UMA_HISTOGRAM_COUNTS_100(""PageLoad.Experimental.LayoutStability.JankScore"", uma_value); } ",0 "int sb_prepare_remount_readonly(struct super_block *sb) { struct mount *mnt; int err = 0; /* Racy optimization. Recheck the counter under MNT_WRITE_HOLD */ if (atomic_long_read(&sb->s_remove_count)) return -EBUSY; br_write_lock(&vfsmount_lock); list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) { if (!(mnt->mnt.mnt_flags & MNT_READONLY)) { mnt->mnt.mnt_flags |= MNT_WRITE_HOLD; smp_mb(); if (mnt_get_writers(mnt) > 0) { err = -EBUSY; break; } } } if (!err && atomic_long_read(&sb->s_remove_count)) err = -EBUSY; if (!err) { sb->s_readonly_remount = 1; smp_wmb(); } list_for_each_entry(mnt, &sb->s_mounts, mnt_instance) { if (mnt->mnt.mnt_flags & MNT_WRITE_HOLD) mnt->mnt.mnt_flags &= ~MNT_WRITE_HOLD; } br_write_unlock(&vfsmount_lock); return err; } ",0 "void DevToolsUIBindings::Reload() { reloading_ = true; web_contents_->GetController().Reload(content::ReloadType::NORMAL, false); } ",0 "Size GetDPI() { static int dpi_x = 0; static int dpi_y = 0; static bool should_initialize = true; if (should_initialize) { should_initialize = false; base::win::ScopedGetDC screen_dc(NULL); dpi_x = GetDeviceCaps(screen_dc, LOGPIXELSX); dpi_y = GetDeviceCaps(screen_dc, LOGPIXELSY); } return Size(dpi_x, dpi_y); } ",0 "static inline void net_tx_pkt_sendv(struct NetTxPkt *pkt, NetClientState *nc, const struct iovec *iov, int iov_cnt) { if (pkt->is_loopback) { nc->info->receive_iov(nc, iov, iov_cnt); } else { qemu_sendv_packet(nc, iov, iov_cnt); } } ",0 " ft_glyphslot_init( FT_GlyphSlot slot ) { FT_Driver driver = slot->face->driver; FT_Driver_Class clazz = driver->clazz; FT_Memory memory = driver->root.memory; FT_Error error = FT_Err_Ok; FT_Slot_Internal internal = NULL; slot->library = driver->root.library; if ( FT_NEW( internal ) ) goto Exit; slot->internal = internal; if ( FT_DRIVER_USES_OUTLINES( driver ) ) error = FT_GlyphLoader_New( memory, &internal->loader ); if ( !error && clazz->init_slot ) error = clazz->init_slot( slot ); Exit: return error; } ",0 "struct tcp_md5sig_pool *__tcp_get_md5sig_pool(int cpu) { struct tcp_md5sig_pool * __percpu *p; spin_lock_bh(&tcp_md5sig_pool_lock); p = tcp_md5sig_pool; if (p) tcp_md5sig_users++; spin_unlock_bh(&tcp_md5sig_pool_lock); return (p ? *per_cpu_ptr(p, cpu) : NULL); } ",0 "ZEND_API void * __zend_calloc(size_t nmemb, size_t len) { void *tmp = _safe_malloc(nmemb, len, 0); memset(tmp, 0, nmemb * len); return tmp; } ",0 "static int mov_write_tfhd_tag(AVIOContext *pb, MOVMuxContext *mov, MOVTrack *track, int64_t moof_offset) { int64_t pos = avio_tell(pb); uint32_t flags = MOV_TFHD_DEFAULT_SIZE | MOV_TFHD_DEFAULT_DURATION | MOV_TFHD_BASE_DATA_OFFSET; if (!track->entry) { flags |= MOV_TFHD_DURATION_IS_EMPTY; } else { flags |= MOV_TFHD_DEFAULT_FLAGS; } if (mov->flags & FF_MOV_FLAG_OMIT_TFHD_OFFSET) flags &= ~MOV_TFHD_BASE_DATA_OFFSET; if (mov->flags & FF_MOV_FLAG_DEFAULT_BASE_MOOF) { flags &= ~MOV_TFHD_BASE_DATA_OFFSET; flags |= MOV_TFHD_DEFAULT_BASE_IS_MOOF; } /* Don't set a default sample size, the silverlight player refuses * to play files with that set. Don't set a default sample duration, * WMP freaks out if it is set. Don't set a base data offset, PIFF * file format says it MUST NOT be set. */ if (track->mode == MODE_ISM) flags &= ~(MOV_TFHD_DEFAULT_SIZE | MOV_TFHD_DEFAULT_DURATION | MOV_TFHD_BASE_DATA_OFFSET); avio_wb32(pb, 0); /* size placeholder */ ffio_wfourcc(pb, ""tfhd""); avio_w8(pb, 0); /* version */ avio_wb24(pb, flags); avio_wb32(pb, track->track_id); /* track-id */ if (flags & MOV_TFHD_BASE_DATA_OFFSET) avio_wb64(pb, moof_offset); if (flags & MOV_TFHD_DEFAULT_DURATION) { track->default_duration = get_cluster_duration(track, 0); avio_wb32(pb, track->default_duration); } if (flags & MOV_TFHD_DEFAULT_SIZE) { track->default_size = track->entry ? track->cluster[0].size : 1; avio_wb32(pb, track->default_size); } else track->default_size = -1; if (flags & MOV_TFHD_DEFAULT_FLAGS) { /* Set the default flags based on the second sample, if available. * If the first sample is different, that can be signaled via a separate field. */ if (track->entry > 1) track->default_sample_flags = get_sample_flags(track, &track->cluster[1]); else track->default_sample_flags = track->par->codec_type == AVMEDIA_TYPE_VIDEO ? (MOV_FRAG_SAMPLE_FLAG_DEPENDS_YES | MOV_FRAG_SAMPLE_FLAG_IS_NON_SYNC) : MOV_FRAG_SAMPLE_FLAG_DEPENDS_NO; avio_wb32(pb, track->default_sample_flags); } return update_size(pb, pos); } ",0 "static int yy_get_next_buffer (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf; char *source = yyg->yytext_ptr; yy_size_t number_to_move, i; int ret_val; if ( yyg->yy_c_buf_p > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] ) YY_FATAL_ERROR( ""fatal flex scanner internal error--end of buffer missed"" ); if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 ) { /* Don't try to fill the buffer, so this is an EOF. */ if ( yyg->yy_c_buf_p - yyg->yytext_ptr - YY_MORE_ADJ == 1 ) { /* We matched a single character, the EOB, so * treat this as a final EOF. */ return EOB_ACT_END_OF_FILE; } else { /* We matched some text prior to the EOB, first * process it. */ return EOB_ACT_LAST_MATCH; } } /* Try to read more data. */ /* First move last chars to start of buffer. */ number_to_move = (yy_size_t) (yyg->yy_c_buf_p - yyg->yytext_ptr) - 1; for ( i = 0; i < number_to_move; ++i ) *(dest++) = *(source++); if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING ) /* don't do the read, it's not guaranteed to return an EOF, * just force an EOF */ YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars = 0; else { yy_size_t num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; while ( num_to_read <= 0 ) { /* Not enough room in the buffer - grow it. */ /* just a shorter name for the current buffer */ YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE; int yy_c_buf_p_offset = (int) (yyg->yy_c_buf_p - b->yy_ch_buf); if ( b->yy_is_our_buffer ) { yy_size_t new_size = b->yy_buf_size * 2; if ( new_size <= 0 ) b->yy_buf_size += b->yy_buf_size / 8; else b->yy_buf_size *= 2; b->yy_ch_buf = (char *) /* Include room in for 2 EOB chars. */ re_yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 ,yyscanner ); } else /* Can't grow it, we don't own it. */ b->yy_ch_buf = 0; if ( ! b->yy_ch_buf ) YY_FATAL_ERROR( ""fatal error - scanner input buffer overflow"" ); yyg->yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset]; num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1; } if ( num_to_read > YY_READ_BUF_SIZE ) num_to_read = YY_READ_BUF_SIZE; /* Read in more data. */ YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]), yyg->yy_n_chars, num_to_read ); YY_CURRENT_BUFFER_LVALUE->yy_n_chars = yyg->yy_n_chars; } if ( yyg->yy_n_chars == 0 ) { if ( number_to_move == YY_MORE_ADJ ) { ret_val = EOB_ACT_END_OF_FILE; re_yyrestart(yyin ,yyscanner); } else { ret_val = EOB_ACT_LAST_MATCH; YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_EOF_PENDING; } } else ret_val = EOB_ACT_CONTINUE_SCAN; if ((yy_size_t) (yyg->yy_n_chars + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) { /* Extend the array by 50%, plus the number we really need. */ yy_size_t new_size = yyg->yy_n_chars + number_to_move + (yyg->yy_n_chars >> 1); YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) re_yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size ,yyscanner ); if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf ) YY_FATAL_ERROR( ""out of dynamic memory in yy_get_next_buffer()"" ); } yyg->yy_n_chars += number_to_move; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars] = YY_END_OF_BUFFER_CHAR; YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[yyg->yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR; yyg->yytext_ptr = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0]; return ret_val; } ",0 "static void OverloadedMethodE2Method(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); TestInterfaceEmpty* test_interface_empty_or_null_arg; test_interface_empty_or_null_arg = V8TestInterfaceEmpty::ToImplWithTypeCheck(info.GetIsolate(), info[0]); if (!test_interface_empty_or_null_arg && !IsUndefinedOrNull(info[0])) { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute(""overloadedMethodE"", ""TestObject"", ExceptionMessages::ArgumentNotOfType(0, ""TestInterfaceEmpty""))); return; } impl->overloadedMethodE(test_interface_empty_or_null_arg); } ",0 "void WebContentsImpl::RenderViewDeleted(RenderViewHost* rvh) { ClearPowerSaveBlockers(rvh); GetRenderManager()->RenderViewDeleted(rvh); FOR_EACH_OBSERVER(WebContentsObserver, observers_, RenderViewDeleted(rvh)); } ",0 "static int key_notify_policy_expire(struct xfrm_policy *xp, const struct km_event *c) { return 0; } ",0 " void BookmarkManagerView::OnDoubleClick() { std::vector nodes = GetSelectedTableNodes(); if (nodes.empty()) return; if (nodes.size() == 1 && nodes[0]->is_folder()) { SelectInTree(nodes[0]); return; } bookmark_utils::OpenAll( GetWidget()->GetNativeView(), profile_, NULL, nodes, CURRENT_TAB); } ",0 "void RenderWidgetHostViewGtk::DestroyPluginContainer( gfx::PluginWindowHandle id) { plugin_container_manager_.DestroyPluginContainer(id); } ",0 "static int proc_readdir(const char *path, void *buf, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info *fi) { if (filler(buf, ""cpuinfo"", NULL, 0) != 0 || filler(buf, ""meminfo"", NULL, 0) != 0 || filler(buf, ""stat"", NULL, 0) != 0 || filler(buf, ""uptime"", NULL, 0) != 0 || filler(buf, ""diskstats"", NULL, 0) != 0) return -EINVAL; return 0; } ",0 "static int process_bf_mask(struct iwbmprcontext *rctx, int k) { rctx->bf_high_bit[k] = find_high_bit(rctx->bf_mask[k]); rctx->bf_low_bit[k] = find_low_bit(rctx->bf_mask[k]); rctx->bf_bits_count[k] = 1+rctx->bf_high_bit[k]-rctx->bf_low_bit[k]; if(rctx->bf_high_bit[k] > (int)(rctx->bitcount-1)) return 0; if(rctx->bf_bits_count[k]>16) { rctx->bf_low_bit[k] = rctx->bf_high_bit[k]-15; rctx->bf_bits_count[k] = 16; } if(rctx->bf_bits_count[k]>8) { rctx->need_16bit = 1; } return 1; } ",0 "void UiSceneCreator::CreateToasts() { auto* parent = AddTransientParent(kExclusiveScreenToastTransientParent, k2dBrowsingForeground, kToastTimeoutSeconds, false, scene_); parent->AddBinding(VR_BIND_FUNC(bool, Model, model_, fullscreen && !model->web_vr_mode, UiElement, parent, SetVisible)); auto element = base::MakeUnique(512); element->SetName(kExclusiveScreenToast); element->SetDrawPhase(kPhaseForeground); element->SetSize(kToastWidthDMM, kToastHeightDMM); element->SetTranslate( 0, kFullscreenVerticalOffset + kFullscreenHeight / 2 + (kToastOffsetDMM + kToastHeightDMM) * kFullscreenToastDistance, -kFullscreenToastDistance); element->SetScale(kFullscreenToastDistance, kFullscreenToastDistance, 1); element->set_hit_testable(false); BindColor(model_, element.get(), &ColorScheme::exclusive_screen_toast_background, &TexturedElement::SetBackgroundColor); BindColor(model_, element.get(), &ColorScheme::exclusive_screen_toast_foreground, &TexturedElement::SetForegroundColor); scene_->AddUiElement(kExclusiveScreenToastTransientParent, std::move(element)); parent = AddTransientParent(kExclusiveScreenToastViewportAwareTransientParent, kWebVrViewportAwareRoot, kToastTimeoutSeconds, false, scene_); parent->AddBinding( VR_BIND_FUNC(bool, Model, model_, web_vr_has_produced_frames() && model->web_vr_show_toast, UiElement, parent, SetVisible)); element = base::MakeUnique(512); element->SetName(kExclusiveScreenToastViewportAware); element->SetDrawPhase(kPhaseOverlayForeground); element->SetSize(kToastWidthDMM, kToastHeightDMM); element->SetTranslate(0, kWebVrToastDistance * sin(kWebVrAngleRadians), -kWebVrToastDistance * cos(kWebVrAngleRadians)); element->SetRotate(1, 0, 0, kWebVrAngleRadians); element->SetScale(kWebVrToastDistance, kWebVrToastDistance, 1); element->set_hit_testable(false); BindColor(model_, element.get(), &ColorScheme::exclusive_screen_toast_background, &TexturedElement::SetBackgroundColor); BindColor(model_, element.get(), &ColorScheme::exclusive_screen_toast_foreground, &TexturedElement::SetForegroundColor); scene_->AddUiElement(kExclusiveScreenToastViewportAwareTransientParent, std::move(element)); } ",0 "void WebContentsImpl::OnDidDownloadImage( int id, int http_status_code, const GURL& image_url, int requested_size, const std::vector& bitmaps) { ImageDownloadMap::iterator iter = image_download_map_.find(id); if (iter == image_download_map_.end()) { return; } if (!iter->second.is_null()) { iter->second.Run(id, http_status_code, image_url, requested_size, bitmaps); } image_download_map_.erase(id); } ",0 " virtual void Destruct() const { delete this; } ",0 "encode_OUTPUT_REG(const struct ofpact_output_reg *output_reg, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { /* If 'output_reg' came in as an NXAST_RAW_OUTPUT_REG2 action, or if it * cannot be encoded in the older form, encode it as * NXAST_RAW_OUTPUT_REG2. */ if (output_reg->ofpact.raw == NXAST_RAW_OUTPUT_REG2 || !mf_nxm_header(output_reg->src.field->id)) { struct nx_action_output_reg2 *naor = put_NXAST_OUTPUT_REG2(out); size_t size = out->size; naor->ofs_nbits = nxm_encode_ofs_nbits(output_reg->src.ofs, output_reg->src.n_bits); naor->max_len = htons(output_reg->max_len); out->size = size - sizeof naor->pad; nx_put_mff_header(out, output_reg->src.field, 0, false); out->size = size; } else { struct nx_action_output_reg *naor = put_NXAST_OUTPUT_REG(out); naor->ofs_nbits = nxm_encode_ofs_nbits(output_reg->src.ofs, output_reg->src.n_bits); naor->src = htonl(nxm_header_from_mff(output_reg->src.field)); naor->max_len = htons(output_reg->max_len); } } ",0 "static int futex_lock_pi_atomic(u32 __user *uaddr, struct futex_hash_bucket *hb, union futex_key *key, struct futex_pi_state **ps, struct task_struct *task, int set_waiters) { int lock_taken, ret, force_take = 0; u32 uval, newval, curval, vpid = task_pid_vnr(task); retry: ret = lock_taken = 0; /* * To avoid races, we attempt to take the lock here again * (by doing a 0 -> TID atomic cmpxchg), while holding all * the locks. It will most likely not succeed. */ newval = vpid; if (set_waiters) newval |= FUTEX_WAITERS; if (unlikely(cmpxchg_futex_value_locked(&curval, uaddr, 0, newval))) return -EFAULT; /* * Detect deadlocks. */ if ((unlikely((curval & FUTEX_TID_MASK) == vpid))) return -EDEADLK; /* * Surprise - we got the lock. Just return to userspace: */ if (unlikely(!curval)) return 1; uval = curval; /* * Set the FUTEX_WAITERS flag, so the owner will know it has someone * to wake at the next unlock. */ newval = curval | FUTEX_WAITERS; /* * Should we force take the futex? See below. */ if (unlikely(force_take)) { /* * Keep the OWNER_DIED and the WAITERS bit and set the * new TID value. */ newval = (curval & ~FUTEX_TID_MASK) | vpid; force_take = 0; lock_taken = 1; } if (unlikely(cmpxchg_futex_value_locked(&curval, uaddr, uval, newval))) return -EFAULT; if (unlikely(curval != uval)) goto retry; /* * We took the lock due to forced take over. */ if (unlikely(lock_taken)) return 1; /* * We dont have the lock. Look up the PI state (or create it if * we are the first waiter): */ ret = lookup_pi_state(uval, hb, key, ps, task); if (unlikely(ret)) { switch (ret) { case -ESRCH: /* * We failed to find an owner for this * futex. So we have no pi_state to block * on. This can happen in two cases: * * 1) The owner died * 2) A stale FUTEX_WAITERS bit * * Re-read the futex value. */ if (get_futex_value_locked(&curval, uaddr)) return -EFAULT; /* * If the owner died or we have a stale * WAITERS bit the owner TID in the user space * futex is 0. */ if (!(curval & FUTEX_TID_MASK)) { force_take = 1; goto retry; } default: break; } } return ret; } ",0 "static void destroy_victim_secmap(struct f2fs_sb_info *sbi) { struct dirty_seglist_info *dirty_i = DIRTY_I(sbi); kvfree(dirty_i->victim_secmap); } ",0 "int __sk_mem_schedule(struct sock *sk, int size, int kind) { struct proto *prot = sk->sk_prot; int amt = sk_mem_pages(size); long allocated; int parent_status = UNDER_LIMIT; sk->sk_forward_alloc += amt * SK_MEM_QUANTUM; allocated = sk_memory_allocated_add(sk, amt, &parent_status); /* Under limit. */ if (parent_status == UNDER_LIMIT && allocated <= sk_prot_mem_limits(sk, 0)) { sk_leave_memory_pressure(sk); return 1; } /* Under pressure. (we or our parents) */ if ((parent_status > SOFT_LIMIT) || allocated > sk_prot_mem_limits(sk, 1)) sk_enter_memory_pressure(sk); /* Over hard limit (we or our parents) */ if ((parent_status == OVER_LIMIT) || (allocated > sk_prot_mem_limits(sk, 2))) goto suppress_allocation; /* guarantee minimum buffer size under pressure */ if (kind == SK_MEM_RECV) { if (atomic_read(&sk->sk_rmem_alloc) < prot->sysctl_rmem[0]) return 1; } else { /* SK_MEM_SEND */ if (sk->sk_type == SOCK_STREAM) { if (sk->sk_wmem_queued < prot->sysctl_wmem[0]) return 1; } else if (atomic_read(&sk->sk_wmem_alloc) < prot->sysctl_wmem[0]) return 1; } if (sk_has_memory_pressure(sk)) { int alloc; if (!sk_under_memory_pressure(sk)) return 1; alloc = sk_sockets_allocated_read_positive(sk); if (sk_prot_mem_limits(sk, 2) > alloc * sk_mem_pages(sk->sk_wmem_queued + atomic_read(&sk->sk_rmem_alloc) + sk->sk_forward_alloc)) return 1; } suppress_allocation: if (kind == SK_MEM_SEND && sk->sk_type == SOCK_STREAM) { sk_stream_moderate_sndbuf(sk); /* Fail only if socket is _under_ its sndbuf. * In this case we cannot block, so that we have to fail. */ if (sk->sk_wmem_queued + size >= sk->sk_sndbuf) return 1; } trace_sock_exceed_buf_limit(sk, prot, allocated); /* Alas. Undo changes. */ sk->sk_forward_alloc -= amt * SK_MEM_QUANTUM; sk_memory_allocated_sub(sk, amt); return 0; } ",0 "void DelegatedFrameHost::OnCompositingStarted(ui::Compositor* compositor, base::TimeTicks start_time) { last_draw_ended_ = start_time; } ",0 "void Layer::SetBounds(const gfx::Size& size) { DCHECK(IsPropertyChangeAllowed()); if (bounds() == size) return; bounds_ = size; SetNeedsCommit(); } ",0 "gpk_select_key(sc_card_t *card, int key_sfi, const u8 *buf, size_t buflen) { struct gpk_private_data *priv = DRVDATA(card); sc_apdu_t apdu; u8 rnd[8], resp[258]; int r; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (buflen != 16) return SC_ERROR_INVALID_ARGUMENTS; /* now do the SelFk */ RAND_bytes(rnd, sizeof(rnd)); memset(&apdu, 0, sizeof(apdu)); apdu.cla = 0x80; apdu.cse = SC_APDU_CASE_4_SHORT; apdu.ins = 0x28; apdu.p1 = 0; apdu.p2 = key_sfi; apdu.data = rnd; apdu.datalen = sizeof(rnd); apdu.lc = apdu.datalen; apdu.resp = resp; apdu.resplen = sizeof(resp); apdu.le = 12; r = sc_transmit_apdu(card, &apdu); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""APDU transmit failed""); r = sc_check_sw(card, apdu.sw1, apdu.sw2); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""Card returned error""); if (apdu.resplen != 12) { r = SC_ERROR_UNKNOWN_DATA_RECEIVED; } else if ((r = gpk_set_filekey(buf, rnd, resp, priv->key)) == 0) { priv->key_set = 1; priv->key_reference = key_sfi; } sc_mem_clear(resp, sizeof(resp)); return r; } ",0 "PHPAPI int php_date_initialize(php_date_obj *dateobj, /*const*/ char *time_str, int time_str_len, char *format, zval *timezone_object, int ctor TSRMLS_DC) { timelib_time *now; timelib_tzinfo *tzi = NULL; timelib_error_container *err = NULL; int type = TIMELIB_ZONETYPE_ID, new_dst = 0; char *new_abbr = NULL; timelib_sll new_offset; if (dateobj->time) { timelib_time_dtor(dateobj->time); } if (format) { dateobj->time = timelib_parse_from_format(format, time_str_len ? time_str : """", time_str_len ? time_str_len : 0, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); } else { dateobj->time = timelib_strtotime(time_str_len ? time_str : ""now"", time_str_len ? time_str_len : sizeof(""now"") -1, &err, DATE_TIMEZONEDB, php_date_parse_tzfile_wrapper); } /* update last errors and warnings */ update_errors_warnings(err TSRMLS_CC); if (ctor && err && err->error_count) { /* spit out the first library error message, at least */ php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Failed to parse time string (%s) at position %d (%c): %s"", time_str, err->error_messages[0].position, err->error_messages[0].character, err->error_messages[0].message); } if (err && err->error_count) { timelib_time_dtor(dateobj->time); dateobj->time = 0; return 0; } if (timezone_object) { php_timezone_obj *tzobj; tzobj = (php_timezone_obj *) zend_object_store_get_object(timezone_object TSRMLS_CC); switch (tzobj->type) { case TIMELIB_ZONETYPE_ID: tzi = tzobj->tzi.tz; break; case TIMELIB_ZONETYPE_OFFSET: new_offset = tzobj->tzi.utc_offset; break; case TIMELIB_ZONETYPE_ABBR: new_offset = tzobj->tzi.z.utc_offset; new_dst = tzobj->tzi.z.dst; new_abbr = strdup(tzobj->tzi.z.abbr); break; } type = tzobj->type; } else if (dateobj->time->tz_info) { tzi = dateobj->time->tz_info; } else { tzi = get_timezone_info(TSRMLS_C); } now = timelib_time_ctor(); now->zone_type = type; switch (type) { case TIMELIB_ZONETYPE_ID: now->tz_info = tzi; break; case TIMELIB_ZONETYPE_OFFSET: now->z = new_offset; break; case TIMELIB_ZONETYPE_ABBR: now->z = new_offset; now->dst = new_dst; now->tz_abbr = new_abbr; break; } timelib_unixtime2local(now, (timelib_sll) time(NULL)); timelib_fill_holes(dateobj->time, now, TIMELIB_NO_CLONE); timelib_update_ts(dateobj->time, tzi); timelib_update_from_sse(dateobj->time); dateobj->time->have_relative = 0; timelib_time_dtor(now); return 1; } ",0 "int regulator_list_voltage(struct regulator *regulator, unsigned selector) { struct regulator_dev *rdev = regulator->rdev; const struct regulator_ops *ops = rdev->desc->ops; int ret; if (rdev->desc->fixed_uV && rdev->desc->n_voltages == 1 && !selector) return rdev->desc->fixed_uV; if (ops->list_voltage) { if (selector >= rdev->desc->n_voltages) return -EINVAL; mutex_lock(&rdev->mutex); ret = ops->list_voltage(rdev, selector); mutex_unlock(&rdev->mutex); } else if (rdev->supply) { ret = regulator_list_voltage(rdev->supply, selector); } else { return -EINVAL; } if (ret > 0) { if (ret < rdev->constraints->min_uV) ret = 0; else if (ret > rdev->constraints->max_uV) ret = 0; } return ret; } ",0 "Settings* DocumentInit::GetSettings() const { DCHECK(MasterDocumentLoader()); return MasterDocumentLoader()->GetFrame()->GetSettings(); } ",0 "int32 RenderThreadImpl::CreateViewCommandBuffer( int32 surface_id, const GPUCreateCommandBufferConfig& init_params) { int32 route_id = MSG_ROUTING_NONE; IPC::Message* message = new GpuHostMsg_CreateViewCommandBuffer( surface_id, init_params, &route_id); if (MessageLoop::current() == message_loop()) ChildThread::Send(message); else sync_message_filter()->Send(message); return route_id; } ",0 "ofproto_port_set_state(struct ofport *port, enum ofputil_port_state state) { if (port->pp.state != state) { port->pp.state = state; connmgr_send_port_status(port->ofproto->connmgr, NULL, &port->pp, OFPPR_MODIFY); } } ",0 "void blk_mq_stop_hw_queue(struct blk_mq_hw_ctx *hctx) { cancel_delayed_work(&hctx->run_work); cancel_delayed_work(&hctx->delay_work); set_bit(BLK_MQ_S_STOPPED, &hctx->state); } ",0 "void PrintPreviewUI::SetSourceIsModifiable(TabContents* print_preview_tab, bool source_is_modifiable) { if (!print_preview_tab || !print_preview_tab->web_contents()->GetWebUI()) return; PrintPreviewUI* print_preview_ui = static_cast( print_preview_tab->web_contents()->GetWebUI()->GetController()); print_preview_ui->source_is_modifiable_ = source_is_modifiable; } ",0 "find_intro_circuit(rend_intro_point_t *intro, const char *pk_digest) { origin_circuit_t *circ = NULL; tor_assert(intro); while ((circ = circuit_get_next_by_pk_and_purpose(circ, (uint8_t *) pk_digest, CIRCUIT_PURPOSE_S_INTRO))) { if (tor_memeq(circ->build_state->chosen_exit->identity_digest, intro->extend_info->identity_digest, DIGEST_LEN) && circ->rend_data) { return circ; } } circ = NULL; while ((circ = circuit_get_next_by_pk_and_purpose(circ, (uint8_t *) pk_digest, CIRCUIT_PURPOSE_S_ESTABLISH_INTRO))) { if (tor_memeq(circ->build_state->chosen_exit->identity_digest, intro->extend_info->identity_digest, DIGEST_LEN) && circ->rend_data) { return circ; } } return NULL; } ",0 "void ResourceMultiBufferDataProvider::SetDeferred(bool deferred) { if (active_loader_) active_loader_->SetDefersLoading(deferred); } ",0 "void LayoutBlockFlow::setStaticInlinePositionForChild(LayoutBox& child, LayoutUnit inlinePosition) { child.layer()->setStaticInlinePosition(inlinePosition); } ",0 "SCTP_STATIC int sctp_ioctl(struct sock *sk, int cmd, unsigned long arg) { int rc = -ENOTCONN; sctp_lock_sock(sk); /* * SEQPACKET-style sockets in LISTENING state are valid, for * SCTP, so only discard TCP-style sockets in LISTENING state. */ if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) goto out; switch (cmd) { case SIOCINQ: { struct sk_buff *skb; unsigned int amount = 0; skb = skb_peek(&sk->sk_receive_queue); if (skb != NULL) { /* * We will only return the amount of this packet since * that is all that will be read. */ amount = skb->len; } rc = put_user(amount, (int __user *)arg); break; } default: rc = -ENOIOCTLCMD; break; } out: sctp_release_sock(sk); return rc; } ",0 "void ssl_set_sni( ssl_context *ssl, int (*f_sni)(void *, ssl_context *, const unsigned char *, size_t), void *p_sni ) { ssl->f_sni = f_sni; ssl->p_sni = p_sni; } ",0 "void NavigatorImpl::DidNavigate( RenderFrameHostImpl* render_frame_host, const FrameHostMsg_DidCommitProvisionalLoad_Params& params, std::unique_ptr navigation_handle) { FrameTreeNode* frame_tree_node = render_frame_host->frame_tree_node(); FrameTree* frame_tree = frame_tree_node->frame_tree(); bool is_navigation_within_page = controller_->IsURLInPageNavigation( params.url, params.origin, params.was_within_same_document, render_frame_host); if (is_navigation_within_page && render_frame_host != frame_tree_node->render_manager()->current_frame_host()) { bad_message::ReceivedBadMessage(render_frame_host->GetProcess(), bad_message::NI_IN_PAGE_NAVIGATION); is_navigation_within_page = false; } if (ui::PageTransitionIsMainFrame(params.transition)) { if (delegate_) { if (delegate_->CanOverscrollContent()) { if (!params.was_within_same_document) controller_->TakeScreenshot(); } delegate_->DidNavigateMainFramePreCommit(is_navigation_within_page); } } frame_tree_node->SetCurrentOrigin( params.origin, params.has_potentially_trustworthy_unique_origin); frame_tree_node->SetInsecureRequestPolicy(params.insecure_request_policy); if (!is_navigation_within_page) { render_frame_host->ResetContentSecurityPolicies(); frame_tree_node->ResetCspHeaders(); frame_tree_node->ResetFeaturePolicyHeader(); } frame_tree_node->render_manager()->DidNavigateFrame( render_frame_host, params.gesture == NavigationGestureUser); SiteInstanceImpl* site_instance = render_frame_host->GetSiteInstance(); if (!site_instance->HasSite() && ShouldAssignSiteForURL(params.url) && !params.url_is_unreachable) { site_instance->SetSite(params.url); } if (ui::PageTransitionIsMainFrame(params.transition) && delegate_) delegate_->SetMainFrameMimeType(params.contents_mime_type); int old_entry_count = controller_->GetEntryCount(); LoadCommittedDetails details; bool did_navigate = controller_->RendererDidNavigate( render_frame_host, params, &details, is_navigation_within_page, navigation_handle.get()); if (old_entry_count != controller_->GetEntryCount() || details.previous_entry_index != controller_->GetLastCommittedEntryIndex()) { frame_tree->root()->render_manager()->SendPageMessage( new PageMsg_SetHistoryOffsetAndLength( MSG_ROUTING_NONE, controller_->GetLastCommittedEntryIndex(), controller_->GetEntryCount()), site_instance); } frame_tree_node->SetCurrentURL(params.url); render_frame_host->SetLastCommittedOrigin(params.origin); if (!params.url_is_unreachable) render_frame_host->set_last_successful_url(params.url); if (!is_navigation_within_page) render_frame_host->ResetFeaturePolicy(); if (details.type != NAVIGATION_TYPE_NAV_IGNORE && delegate_) { DCHECK_EQ(!render_frame_host->GetParent(), did_navigate ? details.is_main_frame : false); navigation_handle->DidCommitNavigation(params, did_navigate, details.did_replace_entry, details.previous_url, details.type, render_frame_host); navigation_handle.reset(); } if (!did_navigate) return; // No navigation happened. RecordNavigationMetrics(details, params, site_instance); if (delegate_) { if (details.is_main_frame) { delegate_->DidNavigateMainFramePostCommit(render_frame_host, details, params); } delegate_->DidNavigateAnyFramePostCommit( render_frame_host, details, params); } } ",0 "int __glXDisp_CreateGLXPbufferSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXCreateGLXPbufferSGIXReq *req = (xGLXCreateGLXPbufferSGIXReq *) pc; return DoCreatePbuffer(cl->client, req->screen, req->fbconfig, req->width, req->height, req->pbuffer); } ",0 "static int dcbnl_setall(struct net_device *netdev, struct nlmsghdr *nlh, u32 seq, struct nlattr **tb, struct sk_buff *skb) { int ret; if (!tb[DCB_ATTR_SET_ALL]) return -EINVAL; if (!netdev->dcbnl_ops->setall) return -EOPNOTSUPP; ret = nla_put_u8(skb, DCB_ATTR_SET_ALL, netdev->dcbnl_ops->setall(netdev)); dcbnl_cee_notify(netdev, RTM_SETDCB, DCB_CMD_SET_ALL, seq, 0); return ret; } ",0 "static void convert1MethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectV8Internal::convert1Method(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "getCPS2(struct rx_call *call, afs_int32 aid, afs_uint32 ahost, prlist *alist, afs_int32 *over, afs_int32 *cid) { afs_int32 code; struct ubik_trans *tt; afs_int32 temp; struct prentry tentry; struct prentry host_tentry; afs_int32 hostid; int host_list = 0; struct in_addr iaddr; char hoststr[16]; *over = 0; iaddr.s_addr = ntohl(ahost); alist->prlist_len = 0; alist->prlist_val = NULL; code = Initdb(); if (code != PRSUCCESS) return code; code = ubik_BeginTransReadAny(dbase, UBIK_READTRANS, &tt); if (code) return code; code = ubik_SetLock(tt, 1, 1, LOCKREAD); if (code) ABORT_WITH(tt, code); code = read_DbHeader(tt); if (code) ABORT_WITH(tt, code); if (aid != PRBADID) { temp = FindByID(tt, aid); if (!temp) ABORT_WITH(tt, PRNOENT); code = pr_ReadEntry(tt, 0, temp, &tentry); if (code) ABORT_WITH(tt, code); /* afs does authenticate now */ code = WhoIsThis(call, tt, cid); if (code || !AccessOK(tt, *cid, &tentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY)) ABORT_WITH(tt, PRPERM); } code = NameToID(tt, afs_inet_ntoa_r(iaddr.s_addr, hoststr), &hostid); if (code == PRSUCCESS && hostid != 0) { temp = FindByID(tt, hostid); if (temp) { code = pr_ReadEntry(tt, 0, temp, &host_tentry); if (code == PRSUCCESS) host_list = 1; else fprintf(stderr, ""pr_ReadEntry returned %d\n"", code); } else fprintf(stderr, ""FindByID Failed -- Not found\n""); } if (host_list) code = GetList2(tt, &tentry, &host_tentry, alist, 1); else code = GetList(tt, &tentry, alist, 1); if (!code) code = addWildCards(tt, alist, ntohl(ahost)); if (code != PRSUCCESS) ABORT_WITH(tt, code); code = ubik_EndTrans(tt); return code; } ",0 "static int cma_iw_listen(struct rdma_id_private *id_priv, int backlog) { int ret; struct iw_cm_id *id; id = iw_create_cm_id(id_priv->id.device, iw_conn_req_handler, id_priv); if (IS_ERR(id)) return PTR_ERR(id); id_priv->cm_id.iw = id; memcpy(&id_priv->cm_id.iw->local_addr, cma_src_addr(id_priv), rdma_addr_size(cma_src_addr(id_priv))); ret = iw_cm_listen(id_priv->cm_id.iw, backlog); if (ret) { iw_destroy_cm_id(id_priv->cm_id.iw); id_priv->cm_id.iw = NULL; } return ret; } ",0 "htmlstartElementDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar **atts) { int i; fprintf(SAXdebug, ""SAX.startElement(%s"", (char *) name); if (atts != NULL) { for (i = 0;(atts[i] != NULL);i++) { fprintf(SAXdebug, "", %s"", atts[i++]); if (atts[i] != NULL) { unsigned char output[40]; const unsigned char *att = atts[i]; int outlen, attlen; fprintf(SAXdebug, ""='""); while ((attlen = strlen((char*)att)) > 0) { outlen = sizeof output - 1; htmlEncodeEntities(output, &outlen, att, &attlen, '\''); output[outlen] = 0; fprintf(SAXdebug, ""%s"", (char *) output); att += attlen; } fprintf(SAXdebug, ""'""); } } } fprintf(SAXdebug, "")\n""); } ",0 "int ext4_can_truncate(struct inode *inode) { if (S_ISREG(inode->i_mode)) return 1; if (S_ISDIR(inode->i_mode)) return 1; if (S_ISLNK(inode->i_mode)) return !ext4_inode_is_fast_symlink(inode); return 0; } ",0 "static int init_port_console(struct port *port) { int ret; /* * The Host's telling us this port is a console port. Hook it * up with an hvc console. * * To set up and manage our virtual console, we call * hvc_alloc(). * * The first argument of hvc_alloc() is the virtual console * number. The second argument is the parameter for the * notification mechanism (like irq number). We currently * leave this as zero, virtqueues have implicit notifications. * * The third argument is a ""struct hv_ops"" containing the * put_chars() get_chars(), notifier_add() and notifier_del() * pointers. The final argument is the output buffer size: we * can do any size, so we put PAGE_SIZE here. */ port->cons.vtermno = pdrvdata.next_vtermno; port->cons.hvc = hvc_alloc(port->cons.vtermno, 0, &hv_ops, PAGE_SIZE); if (IS_ERR(port->cons.hvc)) { ret = PTR_ERR(port->cons.hvc); dev_err(port->dev, ""error %d allocating hvc for port\n"", ret); port->cons.hvc = NULL; return ret; } spin_lock_irq(&pdrvdata_lock); pdrvdata.next_vtermno++; list_add_tail(&port->cons.list, &pdrvdata.consoles); spin_unlock_irq(&pdrvdata_lock); port->guest_connected = true; /* * Start using the new console output if this is the first * console to come up. */ if (early_put_chars) early_put_chars = NULL; /* Notify host of port being opened */ send_control_msg(port, VIRTIO_CONSOLE_PORT_OPEN, 1); return 0; } ",0 "bool TabStrip::ShouldPaintAsActiveFrame() const { return controller_->ShouldPaintAsActiveFrame(); } ",0 "void OmniboxViewWin::SelectAllIfNecessary(MouseButton button, const CPoint& point) { if (tracking_click_[button] && !IsDrag(click_point_[button], point)) { SelectAll(true); possible_drag_ = false; } } ",0 "static double clip(void *opaque, double val) { LutContext *s = opaque; double minval = s->var_values[VAR_MINVAL]; double maxval = s->var_values[VAR_MAXVAL]; return av_clip(val, minval, maxval); } ",0 "static int inSymtab(SdbHash *hash, struct symbol_t *symbols, const char *name, ut64 addr) { bool found; const char *key = sdb_fmt (0, ""%s.%""PFMT64x, name, addr); (void)sdb_ht_find (hash, key, &found); if (found) { return true; } sdb_ht_insert (hash, key, ""1""); return false; } ",0 "void RenderFrameImpl::SimulateImeCommitText( const base::string16& text, const std::vector& ime_text_spans, const gfx::Range& replacement_range) { GetMainFrameRenderWidget()->OnImeCommitText(text, ime_text_spans, replacement_range, 0); } ",0 "int g_input_add_poll(int fd, int priority, int condition, GInputFunction function, void *data) { GIOChannel *source = g_io_channel_unix_new(fd); int ret = g_input_add_full(source, priority, condition, function, data); g_io_channel_unref(source); return ret; } ",0 " bool IsSystemModal(aura::Window* window) { return window->transient_parent() && window->GetProperty(aura::client::kModalKey) == ui::MODAL_TYPE_SYSTEM; } ",1 "void page_put_link(void *arg) { put_page(arg); } ",0 "bool OSExchangeData::GetHtml(base::string16* html, GURL* base_url) const { return provider_->GetHtml(html, base_url); } ",0 "static int jpc_dec_process_eoc(jpc_dec_t *dec, jpc_ms_t *ms) { int tileno; jpc_dec_tile_t *tile; /* Eliminate compiler warnings about unused variables. */ ms = 0; for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno, ++tile) { if (tile->state == JPC_TILE_ACTIVE) { if (jpc_dec_tiledecode(dec, tile)) { return -1; } } /* If the tile has not yet been finalized, finalize it. */ if (tile->state != JPC_TILE_DONE) { jpc_dec_tilefini(dec, tile); } } /* We are done processing the code stream. */ dec->state = JPC_MT; return 1; } ",0 "static int em_vmcall(struct x86_emulate_ctxt *ctxt) { int rc = ctxt->ops->fix_hypercall(ctxt); if (rc != X86EMUL_CONTINUE) return rc; /* Let the processor re-execute the fixed hypercall */ ctxt->_eip = ctxt->eip; /* Disable writeback. */ ctxt->dst.type = OP_NONE; return X86EMUL_CONTINUE; } ",0 "static ssize_t nfs_idmap_lookup_name(__u32 id, const char *type, char *buf, size_t buflen, struct idmap *idmap) { char id_str[NFS_UINT_MAXLEN]; int id_len; ssize_t ret; id_len = snprintf(id_str, sizeof(id_str), ""%u"", id); ret = nfs_idmap_get_key(id_str, id_len, type, buf, buflen, idmap); if (ret < 0) return -EINVAL; return ret; } ",0 "void UWriteHeaderNormal( SQLHSTMT hStmt, SQLTCHAR *szSepLine ) { SQLINTEGER nCol = 0; SQLSMALLINT nColumns = 0; SQLULEN nMaxLength = 10; SQLTCHAR szColumn[MAX_DATA_WIDTH+20]; SQLTCHAR szColumnName[MAX_DATA_WIDTH+1]; SQLTCHAR szHdrLine[32001]; szColumn[ 0 ] = 0; szColumnName[ 0 ] = 0; szHdrLine[ 0 ] = 0; if ( SQLNumResultCols( hStmt, &nColumns ) != SQL_SUCCESS ) nColumns = -1; for ( nCol = 1; nCol <= nColumns; nCol++ ) { SQLColAttribute( hStmt, nCol, SQL_DESC_DISPLAY_SIZE, NULL, 0, NULL, (SQLLEN*)&nMaxLength ); SQLColAttribute( hStmt, nCol, SQL_DESC_LABEL, szColumnName, sizeof(szColumnName), NULL, NULL ); if ( nMaxLength > MAX_DATA_WIDTH ) nMaxLength = MAX_DATA_WIDTH; uc_to_ascii( szColumnName ); /* SEP */ memset( szColumn, '\0', sizeof(szColumn) ); memset( szColumn, '-', max( nMaxLength, strlen((char*)szColumnName) ) + 1 ); strcat((char*) szSepLine, ""+"" ); strcat((char*) szSepLine,(char*) szColumn ); /* HDR */ sprintf((char*) szColumn, ""| %-*s"", (int)max( nMaxLength, strlen((char*)szColumnName) ), (char*)szColumnName ); strcat((char*) szHdrLine,(char*) szColumn ); } strcat((char*) szSepLine, ""+\n"" ); strcat((char*) szHdrLine, ""|\n"" ); puts((char*) szSepLine ); puts((char*) szHdrLine ); puts((char*) szSepLine ); } ",0 "static int emulator_cmpxchg_emulated(struct x86_emulate_ctxt *ctxt, unsigned long addr, const void *old, const void *new, unsigned int bytes, struct x86_exception *exception) { struct kvm_vcpu *vcpu = emul_to_vcpu(ctxt); gpa_t gpa; struct page *page; char *kaddr; bool exchanged; /* guests cmpxchg8b have to be emulated atomically */ if (bytes > 8 || (bytes & (bytes - 1))) goto emul_write; gpa = kvm_mmu_gva_to_gpa_write(vcpu, addr, NULL); if (gpa == UNMAPPED_GVA || (gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE) goto emul_write; if (((gpa + bytes - 1) & PAGE_MASK) != (gpa & PAGE_MASK)) goto emul_write; page = kvm_vcpu_gfn_to_page(vcpu, gpa >> PAGE_SHIFT); if (is_error_page(page)) goto emul_write; kaddr = kmap_atomic(page); kaddr += offset_in_page(gpa); switch (bytes) { case 1: exchanged = CMPXCHG_TYPE(u8, kaddr, old, new); break; case 2: exchanged = CMPXCHG_TYPE(u16, kaddr, old, new); break; case 4: exchanged = CMPXCHG_TYPE(u32, kaddr, old, new); break; case 8: exchanged = CMPXCHG64(kaddr, old, new); break; default: BUG(); } kunmap_atomic(kaddr); kvm_release_page_dirty(page); if (!exchanged) return X86EMUL_CMPXCHG_FAILED; kvm_vcpu_mark_page_dirty(vcpu, gpa >> PAGE_SHIFT); kvm_mmu_pte_write(vcpu, gpa, new, bytes); return X86EMUL_CONTINUE; emul_write: printk_once(KERN_WARNING ""kvm: emulating exchange as write\n""); return emulator_write_emulated(ctxt, addr, new, bytes, exception); } ",0 "long __sys_sendmsg(int fd, struct user_msghdr __user *msg, unsigned int flags, bool forbid_cmsg_compat) { int fput_needed, err; struct msghdr msg_sys; struct socket *sock; if (forbid_cmsg_compat && (flags & MSG_CMSG_COMPAT)) return -EINVAL; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) goto out; err = ___sys_sendmsg(sock, msg, &msg_sys, flags, NULL, 0); fput_light(sock->file, fput_needed); out: return err; } ",0 "status_t MediaPlayerService::Client::getParameter(int key, Parcel *reply) { ALOGV(""[%d] getParameter(%d)"", mConnId, key); sp p = getPlayer(); if (p == 0) return UNKNOWN_ERROR; return p->getParameter(key, reply); } ",0 "void js_unref(js_State *J, const char *ref) { js_delregistry(J, ref); } ",0 "static int32_t scalarproduct_and_madd_int16_c(int16_t *v1, const int16_t *v2, const int16_t *v3, int order, int mul) { int res = 0; while (order--) { res += *v1 * *v2++; *v1++ += mul * *v3++; } return res; } ",0 "Platform::WebContext WebPage::webContext(TargetDetectionStrategy strategy) const { return d->webContext(strategy); } ",0 "alloc_global_data(void) { data_t *new; if (global_data) return global_data; new = (data_t *) MALLOC(sizeof(data_t)); new->email = alloc_list(free_email, dump_email); new->smtp_alert = -1; #ifdef _WITH_VRRP_ new->smtp_alert_vrrp = -1; #endif #ifdef _WITH_LVS_ new->smtp_alert_checker = -1; #endif #ifdef _WITH_VRRP_ set_default_mcast_group(new); set_vrrp_defaults(new); #endif new->notify_fifo.fd = -1; #ifdef _WITH_VRRP_ new->vrrp_notify_fifo.fd = -1; #if HAVE_DECL_RLIMIT_RTTIME == 1 new->vrrp_rlimit_rt = RT_RLIMIT_DEFAULT; #endif new->vrrp_rx_bufs_multiples = 3; #endif #ifdef _WITH_LVS_ new->lvs_notify_fifo.fd = -1; #if HAVE_DECL_RLIMIT_RTTIME == 1 new->checker_rlimit_rt = RT_RLIMIT_DEFAULT; #endif #ifdef _WITH_BFD_ #if HAVE_DECL_RLIMIT_RTTIME == 1 new->bfd_rlimit_rt = RT_RLIMIT_DEFAULT; #endif #endif #endif #ifdef _WITH_SNMP_ if (snmp) { #ifdef _WITH_SNMP_VRRP_ new->enable_snmp_vrrp = true; #endif #ifdef _WITH_SNMP_RFCV2_ new->enable_snmp_rfcv2 = true; #endif #ifdef _WITH_SNMP_RFCV3_ new->enable_snmp_rfcv3 = true; #endif #ifdef _WITH_SNMP_CHECKER_ new->enable_snmp_checker = true; #endif } if (snmp_socket) { new->snmp_socket = MALLOC(strlen(snmp_socket + 1)); strcpy(new->snmp_socket, snmp_socket); } #endif #ifdef _WITH_LVS_ #ifdef _WITH_VRRP_ new->lvs_syncd.syncid = PARAMETER_UNSET; #ifdef _HAVE_IPVS_SYNCD_ATTRIBUTES_ new->lvs_syncd.mcast_group.ss_family = AF_UNSPEC; #endif #endif #endif return new; } ",0 "static int current_led_state(VncState *vs) { int ledstate = 0; if (vs->modifiers_state[0x46]) { ledstate |= QEMU_SCROLL_LOCK_LED; } if (vs->modifiers_state[0x45]) { ledstate |= QEMU_NUM_LOCK_LED; } if (vs->modifiers_state[0x3a]) { ledstate |= QEMU_CAPS_LOCK_LED; } return ledstate; } ",0 "static inline void cma_deref_dev(struct cma_device *cma_dev) { if (atomic_dec_and_test(&cma_dev->refcount)) complete(&cma_dev->comp); } ",0 "bool WebPage::setInputSelection(unsigned start, unsigned end) { if (d->m_page->defersLoading()) return false; return d->m_inputHandler->setSelection(start, end); } ",0 "WebSecurityOrigin WebFrame::getSecurityOrigin() const { return WebSecurityOrigin(toImplBase()->frame()->securityContext()->getSecurityOrigin()); } ",0 "ServiceWorkerDevToolsAgentHost::~ServiceWorkerDevToolsAgentHost() { ServiceWorkerDevToolsManager::GetInstance()->AgentHostDestroyed(this); } ",0 "void FrameView::adjustViewSize() { RenderView* renderView = this->renderView(); if (!renderView) return; ASSERT(m_frame->view() == this); const IntRect rect = renderView->documentRect(); const IntSize& size = rect.size(); ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize()); setContentsSize(size); } ",0 "void CommandBufferProxyImpl::OnBufferPresented( uint64_t swap_id, const gfx::PresentationFeedback& feedback) { DCHECK(gl::IsPresentationCallbackEnabled()); if (presentation_callback_) presentation_callback_.Run(swap_id, feedback); if (update_vsync_parameters_completion_callback_ && feedback.timestamp != base::TimeTicks()) { update_vsync_parameters_completion_callback_.Run(feedback.timestamp, feedback.interval); } } ",0 "static int padlock_sha1_init_nano(struct shash_desc *desc) { struct sha1_state *sctx = shash_desc_ctx(desc); *sctx = (struct sha1_state){ .state = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 }, }; return 0; } ",0 "static int rtl8150_resume(struct usb_interface *intf) { rtl8150_t *dev = usb_get_intfdata(intf); netif_device_attach(dev->netdev); if (netif_running(dev->netdev)) { dev->rx_urb->status = 0; dev->rx_urb->actual_length = 0; read_bulk_callback(dev->rx_urb); dev->intr_urb->status = 0; dev->intr_urb->actual_length = 0; intr_callback(dev->intr_urb); } return 0; } ",0 " static v8::Handle GetNextRequestId(const v8::Arguments& args) { static int next_request_id = 0; return v8::Integer::New(next_request_id++); } ",0 "void SearchEngineTabHelper::DidNavigateMainFrame( const content::LoadCommittedDetails& /*details*/, const content::FrameNavigateParams& params) { GenerateKeywordIfNecessary(params); } ",0 "static void dump_error_msg(struct nl_msg *msg, FILE *ofd) { struct nlmsghdr *hdr = nlmsg_hdr(msg); struct nlmsgerr *err = nlmsg_data(hdr); fprintf(ofd, "" [ERRORMSG] %zu octets\n"", sizeof(*err)); if (nlmsg_len(hdr) >= sizeof(*err)) { struct nl_msg *errmsg; fprintf(ofd, "" .error = %d \""%s\""\n"", err->error, nl_strerror_l(-err->error)); fprintf(ofd, "" [ORIGINAL MESSAGE] %zu octets\n"", sizeof(*hdr)); errmsg = nlmsg_inherit(&err->msg); print_hdr(ofd, errmsg); nlmsg_free(errmsg); } } ",0 "PassRefPtr ShadowRoot::create(Element* element, ExceptionCode& ec) { return create(element, CreatingAuthorShadowRoot, ec); } ",0 " static bool IsCancelled(const internal::BindStateBase*, internal::BindStateBase::CancellationQueryMode mode) { switch (mode) { case internal::BindStateBase::IS_CANCELLED: return false; case internal::BindStateBase::MAYBE_VALID: return true; } NOTREACHED(); } ",0 "static int send_break(struct tty_struct *tty, unsigned int duration) { int retval; if (tty->ops->break_ctl == NULL) return 0; if (tty->driver->flags & TTY_DRIVER_HARDWARE_BREAK) retval = tty->ops->break_ctl(tty, duration); else { /* Do the work ourselves */ if (tty_write_lock(tty, 0) < 0) return -EINTR; retval = tty->ops->break_ctl(tty, -1); if (retval) goto out; if (!signal_pending(current)) msleep_interruptible(duration); retval = tty->ops->break_ctl(tty, 0); out: tty_write_unlock(tty); if (signal_pending(current)) retval = -EINTR; } return retval; } ",0 "xmlXPtrCmpPoints(xmlNodePtr node1, int index1, xmlNodePtr node2, int index2) { if ((node1 == NULL) || (node2 == NULL)) return(-2); /* * a couple of optimizations which will avoid computations in most cases */ if (node1 == node2) { if (index1 < index2) return(1); if (index1 > index2) return(-1); return(0); } return(xmlXPathCmpNodes(node1, node2)); } ",0 "ModuleExport void UnregisterTIFFImage(void) { (void) UnregisterMagickInfo(""TIFF64""); (void) UnregisterMagickInfo(""TIFF""); (void) UnregisterMagickInfo(""TIF""); (void) UnregisterMagickInfo(""PTIF""); #if defined(MAGICKCORE_TIFF_DELEGATE) if (tiff_semaphore == (SemaphoreInfo *) NULL) ActivateSemaphoreInfo(&tiff_semaphore); LockSemaphoreInfo(tiff_semaphore); if (instantiate_key != MagickFalse) { if (DeleteMagickThreadKey(tiff_exception) == MagickFalse) ThrowFatalException(ResourceLimitFatalError,""MemoryAllocationFailed""); #if defined(MAGICKCORE_HAVE_TIFFMERGEFIELDINFO) && defined(MAGICKCORE_HAVE_TIFFSETTAGEXTENDER) if (tag_extender == (TIFFExtendProc) NULL) (void) TIFFSetTagExtender(tag_extender); #endif (void) TIFFSetWarningHandler(warning_handler); (void) TIFFSetErrorHandler(error_handler); instantiate_key=MagickFalse; } UnlockSemaphoreInfo(tiff_semaphore); DestroySemaphoreInfo(&tiff_semaphore); #endif } ",0 "int hns_get_gid_index(struct hns_roce_dev *hr_dev, u8 port, int gid_index) { return gid_index * hr_dev->caps.num_ports + port; } ",0 "static void reject_rx_queue(struct sock *sk) { struct sk_buff *buf; while ((buf = __skb_dequeue(&sk->sk_receive_queue))) tipc_reject_msg(buf, TIPC_ERR_NO_PORT); } ",0 "void Document::SetFeaturePolicy(const String& feature_policy_header) { if (!RuntimeEnabledFeatures::FeaturePolicyEnabled()) return; if (!feature_policy_header.IsEmpty()) UseCounter::Count(*this, WebFeature::kFeaturePolicyHeader); WebFeaturePolicy* parent_feature_policy = nullptr; WebParsedFeaturePolicy container_policy; Vector messages; const WebParsedFeaturePolicy& parsed_header = ParseFeaturePolicyHeader( feature_policy_header, GetSecurityOrigin(), &messages); if (frame_) { if (!frame_->IsMainFrame()) { parent_feature_policy = frame_->Tree().Parent()->GetSecurityContext()->GetFeaturePolicy(); } if (frame_->Owner()) container_policy = frame_->Owner()->ContainerPolicy(); } InitializeFeaturePolicy(parsed_header, container_policy, parent_feature_policy); for (const auto& message : messages) { AddConsoleMessage( ConsoleMessage::Create(kOtherMessageSource, kErrorMessageLevel, ""Error with Feature-Policy header: "" + message)); } if (frame_ && !parsed_header.empty()) frame_->Client()->DidSetFeaturePolicyHeader(parsed_header); } ",0 "static int windows_reset_device(struct libusb_device_handle *dev_handle) { struct windows_device_priv *priv = _device_priv(dev_handle->dev); return priv->apib->reset_device(SUB_API_NOTSET, dev_handle); } ",0 "static int sync_helper(struct ImapData *idata, int right, int flag, const char *name) { int count = 0; int rc; char buf[LONG_STRING]; if (!idata->ctx) return -1; if (!mutt_bit_isset(idata->ctx->rights, right)) return 0; if (right == MUTT_ACL_WRITE && !imap_has_flag(&idata->flags, name)) return 0; snprintf(buf, sizeof(buf), ""+FLAGS.SILENT (%s)"", name); rc = imap_exec_msgset(idata, ""UID STORE"", buf, flag, 1, 0); if (rc < 0) return rc; count += rc; buf[0] = '-'; rc = imap_exec_msgset(idata, ""UID STORE"", buf, flag, 1, 1); if (rc < 0) return rc; count += rc; return count; } ",0 "xfs_queue_eofblocks( struct xfs_mount *mp) { rcu_read_lock(); if (radix_tree_tagged(&mp->m_perag_tree, XFS_ICI_EOFBLOCKS_TAG)) queue_delayed_work(mp->m_eofblocks_workqueue, &mp->m_eofblocks_work, msecs_to_jiffies(xfs_eofb_secs * 1000)); rcu_read_unlock(); } ",0 "static int __init set_graph_function(char *str) { strlcpy(ftrace_graph_buf, str, FTRACE_FILTER_SIZE); return 1; } ",0 "void ContentSettingsStore::NotifyOfContentSettingChanged( const std::string& extension_id, bool incognito) { FOR_EACH_OBSERVER( ContentSettingsStore::Observer, observers_, OnContentSettingChanged(extension_id, incognito)); } ",0 "void InFlightBackendIO::WaitForPendingIO() { InFlightIO::WaitForPendingIO(); } ",0 "static inline int test_time_stamp(u64 delta) { if (delta & TS_DELTA_TEST) return 1; return 0; } ",0 "static ssize_t handle_pwritev(FsContext *ctx, V9fsFidOpenState *fs, const struct iovec *iov, int iovcnt, off_t offset) { ssize_t ret; #ifdef CONFIG_PREADV ret = pwritev(fs->fd, iov, iovcnt, offset); #else int err = lseek(fs->fd, offset, SEEK_SET); if (err == -1) { return err; } else { ret = writev(fs->fd, iov, iovcnt); } #endif #ifdef CONFIG_SYNC_FILE_RANGE if (ret > 0 && ctx->export_flags & V9FS_IMMEDIATE_WRITEOUT) { /* * Initiate a writeback. This is not a data integrity sync. * We want to ensure that we don't leave dirty pages in the cache * after write when writeout=immediate is sepcified. */ sync_file_range(fs->fd, offset, ret, SYNC_FILE_RANGE_WAIT_BEFORE | SYNC_FILE_RANGE_WRITE); } #endif return ret; } ",0 "int do_huge_pmd_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pmd_t *pmd, pmd_t orig_pmd) { int ret = 0; struct page *page, *new_page; unsigned long haddr; VM_BUG_ON(!vma->anon_vma); spin_lock(&mm->page_table_lock); if (unlikely(!pmd_same(*pmd, orig_pmd))) goto out_unlock; page = pmd_page(orig_pmd); VM_BUG_ON(!PageCompound(page) || !PageHead(page)); haddr = address & HPAGE_PMD_MASK; if (page_mapcount(page) == 1) { pmd_t entry; entry = pmd_mkyoung(orig_pmd); entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); if (pmdp_set_access_flags(vma, haddr, pmd, entry, 1)) update_mmu_cache(vma, address, entry); ret |= VM_FAULT_WRITE; goto out_unlock; } get_page(page); spin_unlock(&mm->page_table_lock); if (transparent_hugepage_enabled(vma) && !transparent_hugepage_debug_cow()) new_page = alloc_hugepage_vma(transparent_hugepage_defrag(vma), vma, haddr, numa_node_id(), 0); else new_page = NULL; if (unlikely(!new_page)) { count_vm_event(THP_FAULT_FALLBACK); ret = do_huge_pmd_wp_page_fallback(mm, vma, address, pmd, orig_pmd, page, haddr); put_page(page); goto out; } count_vm_event(THP_FAULT_ALLOC); if (unlikely(mem_cgroup_newpage_charge(new_page, mm, GFP_KERNEL))) { put_page(new_page); put_page(page); ret |= VM_FAULT_OOM; goto out; } copy_user_huge_page(new_page, page, haddr, vma, HPAGE_PMD_NR); __SetPageUptodate(new_page); spin_lock(&mm->page_table_lock); put_page(page); if (unlikely(!pmd_same(*pmd, orig_pmd))) { mem_cgroup_uncharge_page(new_page); put_page(new_page); } else { pmd_t entry; VM_BUG_ON(!PageHead(page)); entry = mk_pmd(new_page, vma->vm_page_prot); entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma); entry = pmd_mkhuge(entry); pmdp_clear_flush_notify(vma, haddr, pmd); page_add_new_anon_rmap(new_page, vma, haddr); set_pmd_at(mm, haddr, pmd, entry); update_mmu_cache(vma, address, entry); page_remove_rmap(page); put_page(page); ret |= VM_FAULT_WRITE; } out_unlock: spin_unlock(&mm->page_table_lock); out: return ret; } ",0 "void WebSocketExperimentRunner::Cancel() { next_state_ = STATE_NONE; ChromeThread::PostTask( ChromeThread::IO, FROM_HERE, NewRunnableMethod(this, &WebSocketExperimentRunner::DoLoop)); } ",0 "static inline int check_pgd_range(struct vm_area_struct *vma, unsigned long addr, unsigned long end, const nodemask_t *nodes, unsigned long flags, void *private) { pgd_t *pgd; unsigned long next; pgd = pgd_offset(vma->vm_mm, addr); do { next = pgd_addr_end(addr, end); if (pgd_none_or_clear_bad(pgd)) continue; if (check_pud_range(vma, pgd, addr, next, nodes, flags, private)) return -EIO; } while (pgd++, addr = next, addr != end); return 0; } ",0 "bool HTMLFormControlElement::shouldHaveFocusAppearance() const { ASSERT(focused()); return shouldShowFocusRingOnMouseFocus() || !m_wasFocusedByMouse; } ",0 "static void destroy_phar_data(void *pDest) /* {{{ */ { phar_archive_data *phar_data = *(phar_archive_data **) pDest; TSRMLS_FETCH(); if (PHAR_GLOBALS->request_ends) { /* first, iterate over the manifest and close all PHAR_TMP entry fp handles, this prevents unnecessary unfreed stream resources */ zend_hash_apply(&(phar_data->manifest), phar_tmpclose_apply TSRMLS_CC); destroy_phar_data_only(pDest); return; } zend_hash_apply_with_argument(&(PHAR_GLOBALS->phar_alias_map), phar_unalias_apply, phar_data TSRMLS_CC); if (--phar_data->refcount < 0) { phar_destroy_phar_data(phar_data TSRMLS_CC); } } /* }}}*/ ",0 "status_t MediaPlayer::getDuration(int *msec) { Mutex::Autolock _l(mLock); return getDuration_l(msec); } ",0 "int curl_msprintf(char *buffer, const char *format, ...) { va_list ap_save; /* argument pointer */ int retcode; va_start(ap_save, format); retcode = dprintf_formatf(&buffer, storebuffer, format, ap_save); va_end(ap_save); *buffer=0; /* we terminate this with a zero byte */ return retcode; } ",0 "void ip_send_unicast_reply(struct net *net, struct sk_buff *skb, __be32 daddr, __be32 saddr, const struct ip_reply_arg *arg, unsigned int len) { struct ip_options_data replyopts; struct ipcm_cookie ipc; struct flowi4 fl4; struct rtable *rt = skb_rtable(skb); struct sk_buff *nskb; struct sock *sk; struct inet_sock *inet; if (ip_options_echo(&replyopts.opt.opt, skb)) return; ipc.addr = daddr; ipc.opt = NULL; ipc.tx_flags = 0; if (replyopts.opt.opt.optlen) { ipc.opt = &replyopts.opt; if (replyopts.opt.opt.srr) daddr = replyopts.opt.opt.faddr; } flowi4_init_output(&fl4, arg->bound_dev_if, 0, RT_TOS(arg->tos), RT_SCOPE_UNIVERSE, ip_hdr(skb)->protocol, ip_reply_arg_flowi_flags(arg), daddr, saddr, tcp_hdr(skb)->source, tcp_hdr(skb)->dest); security_skb_classify_flow(skb, flowi4_to_flowi(&fl4)); rt = ip_route_output_key(net, &fl4); if (IS_ERR(rt)) return; inet = &get_cpu_var(unicast_sock); inet->tos = arg->tos; sk = &inet->sk; sk->sk_priority = skb->priority; sk->sk_protocol = ip_hdr(skb)->protocol; sk->sk_bound_dev_if = arg->bound_dev_if; sock_net_set(sk, net); __skb_queue_head_init(&sk->sk_write_queue); sk->sk_sndbuf = sysctl_wmem_default; ip_append_data(sk, &fl4, ip_reply_glue_bits, arg->iov->iov_base, len, 0, &ipc, &rt, MSG_DONTWAIT); nskb = skb_peek(&sk->sk_write_queue); if (nskb) { if (arg->csumoffset >= 0) *((__sum16 *)skb_transport_header(nskb) + arg->csumoffset) = csum_fold(csum_add(nskb->csum, arg->csum)); nskb->ip_summed = CHECKSUM_NONE; skb_orphan(nskb); skb_set_queue_mapping(nskb, skb_get_queue_mapping(skb)); ip_push_pending_frames(sk, &fl4); } put_cpu_var(unicast_sock); ip_rt_put(rt); } ",0 " virtual void Init() { #if defined(OS_WIN) CoInitialize(NULL); #endif render_process_ = new RenderProcessImpl(); render_process_->set_main_thread(new RenderThread(channel_id_)); base::Thread::SetThreadWasQuitProperly(true); } ",0 "static int exofs_file_fsync(struct file *filp, loff_t start, loff_t end, int datasync) { struct inode *inode = filp->f_mapping->host; int ret; ret = filemap_write_and_wait_range(inode->i_mapping, start, end); if (ret) return ret; mutex_lock(&inode->i_mutex); ret = sync_inode_metadata(filp->f_mapping->host, 1); mutex_unlock(&inode->i_mutex); return ret; } ",0 "static void nested_free_vmcs02(struct vcpu_vmx *vmx, gpa_t vmptr) { struct vmcs02_list *item; list_for_each_entry(item, &vmx->nested.vmcs02_pool, list) if (item->vmptr == vmptr) { free_loaded_vmcs(&item->vmcs02); list_del(&item->list); kfree(item); vmx->nested.vmcs02_num--; return; } } ",0 "static int rtnl_net_fill(struct sk_buff *skb, struct net_fill_args *args) { struct nlmsghdr *nlh; struct rtgenmsg *rth; nlh = nlmsg_put(skb, args->portid, args->seq, args->cmd, sizeof(*rth), args->flags); if (!nlh) return -EMSGSIZE; rth = nlmsg_data(nlh); rth->rtgen_family = AF_UNSPEC; if (nla_put_s32(skb, NETNSA_NSID, args->nsid)) goto nla_put_failure; if (args->add_ref && nla_put_s32(skb, NETNSA_CURRENT_NSID, args->ref_nsid)) goto nla_put_failure; nlmsg_end(skb, nlh); return 0; nla_put_failure: nlmsg_cancel(skb, nlh); return -EMSGSIZE; } ",0 "status_t OMXNodeInstance::updateNativeHandleInMeta( OMX_U32 portIndex, const sp& nativeHandle, OMX::buffer_id buffer) { Mutex::Autolock autoLock(mLock); OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer, portIndex); if (header == NULL) { ALOGE(""b/25884056""); return BAD_VALUE; } if (portIndex != kPortIndexInput && portIndex != kPortIndexOutput) { return BAD_VALUE; } BufferMeta *bufferMeta = (BufferMeta *)(header->pAppPrivate); sp data = bufferMeta->getBuffer( header, false /* backup */, false /* limit */); bufferMeta->setNativeHandle(nativeHandle); if (mMetadataType[portIndex] == kMetadataBufferTypeNativeHandleSource && data->capacity() >= sizeof(VideoNativeHandleMetadata)) { VideoNativeHandleMetadata &metadata = *(VideoNativeHandleMetadata *)(data->data()); metadata.eType = mMetadataType[portIndex]; metadata.pHandle = nativeHandle == NULL ? NULL : const_cast(nativeHandle->handle()); } else { CLOG_ERROR(updateNativeHandleInMeta, BAD_VALUE, ""%s:%u, %#x bad type (%d) or size (%zu)"", portString(portIndex), portIndex, buffer, mMetadataType[portIndex], data->capacity()); return BAD_VALUE; } CLOG_BUFFER(updateNativeHandleInMeta, ""%s:%u, %#x := %p"", portString(portIndex), portIndex, buffer, nativeHandle == NULL ? NULL : nativeHandle->handle()); return OK; } ",1 "static void snd_usbmidi_emagic_input(struct snd_usb_midi_in_endpoint *ep, uint8_t *buffer, int buffer_length) { int i; /* FF indicates end of valid data */ for (i = 0; i < buffer_length; ++i) if (buffer[i] == 0xff) { buffer_length = i; break; } /* handle F5 at end of last buffer */ if (ep->seen_f5) goto switch_port; while (buffer_length > 0) { /* determine size of data until next F5 */ for (i = 0; i < buffer_length; ++i) if (buffer[i] == 0xf5) break; snd_usbmidi_input_data(ep, ep->current_port, buffer, i); buffer += i; buffer_length -= i; if (buffer_length <= 0) break; /* assert(buffer[0] == 0xf5); */ ep->seen_f5 = 1; ++buffer; --buffer_length; switch_port: if (buffer_length <= 0) break; if (buffer[0] < 0x80) { ep->current_port = (buffer[0] - 1) & 15; ++buffer; --buffer_length; } ep->seen_f5 = 0; } } ",0 "static int f_midi_set_alt(struct usb_function *f, unsigned intf, unsigned alt) { struct f_midi *midi = func_to_midi(f); unsigned i; int err; /* we only set alt for MIDIStreaming interface */ if (intf != midi->ms_id) return 0; err = f_midi_start_ep(midi, f, midi->in_ep); if (err) return err; err = f_midi_start_ep(midi, f, midi->out_ep); if (err) return err; /* pre-allocate write usb requests to use on f_midi_transmit. */ while (kfifo_avail(&midi->in_req_fifo)) { struct usb_request *req = midi_alloc_ep_req(midi->in_ep, midi->buflen); if (req == NULL) return -ENOMEM; req->length = 0; req->complete = f_midi_complete; kfifo_put(&midi->in_req_fifo, req); } /* allocate a bunch of read buffers and queue them all at once. */ for (i = 0; i < midi->qlen && err == 0; i++) { struct usb_request *req = midi_alloc_ep_req(midi->out_ep, midi->buflen); if (req == NULL) return -ENOMEM; req->complete = f_midi_complete; err = usb_ep_queue(midi->out_ep, req, GFP_ATOMIC); if (err) { ERROR(midi, ""%s: couldn't enqueue request: %d\n"", midi->out_ep->name, err); free_ep_req(midi->out_ep, req); return err; } } return 0; } ",1 "static inline int qeth_get_initial_mtu_for_card(struct qeth_card *card) { switch (card->info.type) { case QETH_CARD_TYPE_UNKNOWN: return 1500; case QETH_CARD_TYPE_IQD: return card->info.max_mtu; case QETH_CARD_TYPE_OSD: switch (card->info.link_type) { case QETH_LINK_TYPE_HSTR: case QETH_LINK_TYPE_LANE_TR: return 2000; default: return card->options.layer2 ? 1500 : 1492; } case QETH_CARD_TYPE_OSM: case QETH_CARD_TYPE_OSX: return card->options.layer2 ? 1500 : 1492; default: return 1500; } } ",0 "WindowXI2MaskIsset(DeviceIntPtr dev, WindowPtr win, xEvent *ev) { OtherInputMasks *inputMasks = wOtherInputMasks(win); int evtype; if (!inputMasks || xi2_get_type(ev) == 0) return 0; evtype = ((xGenericEvent *) ev)->evtype; return xi2mask_isset(inputMasks->xi2mask, dev, evtype); } ",0 "rsvp_obj_print(netdissect_options *ndo, const u_char *pptr, u_int plen, const u_char *tptr, const char *ident, u_int tlen, const struct rsvp_common_header *rsvp_com_header) { const struct rsvp_object_header *rsvp_obj_header; const u_char *obj_tptr; union { const struct rsvp_obj_integrity_t *rsvp_obj_integrity; const struct rsvp_obj_frr_t *rsvp_obj_frr; } obj_ptr; u_short rsvp_obj_len,rsvp_obj_ctype,obj_tlen,intserv_serv_tlen; int hexdump,processed,padbytes,error_code,error_value,i,sigcheck; union { float f; uint32_t i; } bw; uint8_t namelen; u_int action, subchannel; while(tlen>=sizeof(struct rsvp_object_header)) { /* did we capture enough for fully decoding the object header ? */ ND_TCHECK2(*tptr, sizeof(struct rsvp_object_header)); rsvp_obj_header = (const struct rsvp_object_header *)tptr; rsvp_obj_len=EXTRACT_16BITS(rsvp_obj_header->length); rsvp_obj_ctype=rsvp_obj_header->ctype; if(rsvp_obj_len % 4) { ND_PRINT((ndo, ""%sERROR: object header size %u not a multiple of 4"", ident, rsvp_obj_len)); return -1; } if(rsvp_obj_len < sizeof(struct rsvp_object_header)) { ND_PRINT((ndo, ""%sERROR: object header too short %u < %lu"", ident, rsvp_obj_len, (unsigned long)sizeof(const struct rsvp_object_header))); return -1; } ND_PRINT((ndo, ""%s%s Object (%u) Flags: [%s"", ident, tok2str(rsvp_obj_values, ""Unknown"", rsvp_obj_header->class_num), rsvp_obj_header->class_num, ((rsvp_obj_header->class_num) & 0x80) ? ""ignore"" : ""reject"")); if (rsvp_obj_header->class_num > 128) ND_PRINT((ndo, "" %s"", ((rsvp_obj_header->class_num) & 0x40) ? ""and forward"" : ""silently"")); ND_PRINT((ndo, "" if unknown], Class-Type: %s (%u), length: %u"", tok2str(rsvp_ctype_values, ""Unknown"", ((rsvp_obj_header->class_num)<<8)+rsvp_obj_ctype), rsvp_obj_ctype, rsvp_obj_len)); if(tlen < rsvp_obj_len) { ND_PRINT((ndo, ""%sERROR: object goes past end of objects TLV"", ident)); return -1; } obj_tptr=tptr+sizeof(struct rsvp_object_header); obj_tlen=rsvp_obj_len-sizeof(struct rsvp_object_header); /* did we capture enough for fully decoding the object ? */ if (!ND_TTEST2(*tptr, rsvp_obj_len)) return -1; hexdump=FALSE; switch(rsvp_obj_header->class_num) { case RSVP_OBJ_SESSION: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return -1; ND_PRINT((ndo, ""%s IPv4 DestAddress: %s, Protocol ID: 0x%02x"", ident, ipaddr_string(ndo, obj_tptr), *(obj_tptr + sizeof(struct in_addr)))); ND_PRINT((ndo, ""%s Flags: [0x%02x], DestPort %u"", ident, *(obj_tptr+5), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return -1; ND_PRINT((ndo, ""%s IPv6 DestAddress: %s, Protocol ID: 0x%02x"", ident, ip6addr_string(ndo, obj_tptr), *(obj_tptr + sizeof(struct in6_addr)))); ND_PRINT((ndo, ""%s Flags: [0x%02x], DestPort %u"", ident, *(obj_tptr+sizeof(struct in6_addr)+1), EXTRACT_16BITS(obj_tptr + sizeof(struct in6_addr) + 2))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_TUNNEL_IPV6: if (obj_tlen < 36) return -1; ND_PRINT((ndo, ""%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), ip6addr_string(ndo, obj_tptr + 20))); obj_tlen-=36; obj_tptr+=36; break; case RSVP_CTYPE_14: /* IPv6 p2mp LSP Tunnel */ if (obj_tlen < 26) return -1; ND_PRINT((ndo, ""%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s"", ident, EXTRACT_32BITS(obj_tptr), EXTRACT_16BITS(obj_tptr+6), ip6addr_string(ndo, obj_tptr + 8))); obj_tlen-=26; obj_tptr+=26; break; case RSVP_CTYPE_13: /* IPv4 p2mp LSP Tunnel */ if (obj_tlen < 12) return -1; ND_PRINT((ndo, ""%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ipaddr_string(ndo, obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; case RSVP_CTYPE_TUNNEL_IPV4: case RSVP_CTYPE_UNI_IPV4: if (obj_tlen < 12) return -1; ND_PRINT((ndo, ""%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ipaddr_string(ndo, obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; default: hexdump=TRUE; } break; case RSVP_OBJ_CONFIRM: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < sizeof(struct in_addr)) return -1; ND_PRINT((ndo, ""%s IPv4 Receiver Address: %s"", ident, ipaddr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in_addr); obj_tptr+=sizeof(struct in_addr); break; case RSVP_CTYPE_IPV6: if (obj_tlen < sizeof(struct in6_addr)) return -1; ND_PRINT((ndo, ""%s IPv6 Receiver Address: %s"", ident, ip6addr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in6_addr); obj_tptr+=sizeof(struct in6_addr); break; default: hexdump=TRUE; } break; case RSVP_OBJ_NOTIFY_REQ: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < sizeof(struct in_addr)) return -1; ND_PRINT((ndo, ""%s IPv4 Notify Node Address: %s"", ident, ipaddr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in_addr); obj_tptr+=sizeof(struct in_addr); break; case RSVP_CTYPE_IPV6: if (obj_tlen < sizeof(struct in6_addr)) return-1; ND_PRINT((ndo, ""%s IPv6 Notify Node Address: %s"", ident, ip6addr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in6_addr); obj_tptr+=sizeof(struct in6_addr); break; default: hexdump=TRUE; } break; case RSVP_OBJ_SUGGESTED_LABEL: /* fall through */ case RSVP_OBJ_UPSTREAM_LABEL: /* fall through */ case RSVP_OBJ_RECOVERY_LABEL: /* fall through */ case RSVP_OBJ_LABEL: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: while(obj_tlen >= 4 ) { ND_PRINT((ndo, ""%s Label: %u"", ident, EXTRACT_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; } break; case RSVP_CTYPE_2: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Generalized Label: %u"", ident, EXTRACT_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; case RSVP_CTYPE_3: if (obj_tlen < 12) return-1; ND_PRINT((ndo, ""%s Waveband ID: %u%s Start Label: %u, Stop Label: %u"", ident, EXTRACT_32BITS(obj_tptr), ident, EXTRACT_32BITS(obj_tptr+4), EXTRACT_32BITS(obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; default: hexdump=TRUE; } break; case RSVP_OBJ_STYLE: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Reservation Style: %s, Flags: [0x%02x]"", ident, tok2str(rsvp_resstyle_values, ""Unknown"", EXTRACT_24BITS(obj_tptr+1)), *(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; case RSVP_OBJ_SENDER_TEMPLATE: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Source Port: %u"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Source Port: %u"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_13: /* IPv6 p2mp LSP tunnel */ if (obj_tlen < 40) return-1; ND_PRINT((ndo, ""%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"" ""%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), ident, ip6addr_string(ndo, obj_tptr+20), EXTRACT_16BITS(obj_tptr + 38))); obj_tlen-=40; obj_tptr+=40; break; case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_12: /* IPv4 p2mp LSP tunnel */ if (obj_tlen < 16) return-1; ND_PRINT((ndo, ""%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"" ""%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ident, ipaddr_string(ndo, obj_tptr+8), EXTRACT_16BITS(obj_tptr + 12))); obj_tlen-=16; obj_tptr+=16; break; default: hexdump=TRUE; } break; case RSVP_OBJ_LABEL_REQ: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: while(obj_tlen >= 4 ) { ND_PRINT((ndo, ""%s L3 Protocol ID: %s"", ident, tok2str(ethertype_values, ""Unknown Protocol (0x%04x)"", EXTRACT_16BITS(obj_tptr + 2)))); obj_tlen-=4; obj_tptr+=4; } break; case RSVP_CTYPE_2: if (obj_tlen < 12) return-1; ND_PRINT((ndo, ""%s L3 Protocol ID: %s"", ident, tok2str(ethertype_values, ""Unknown Protocol (0x%04x)"", EXTRACT_16BITS(obj_tptr + 2)))); ND_PRINT((ndo, "",%s merge capability"",((*(obj_tptr + 4)) & 0x80) ? ""no"" : """" )); ND_PRINT((ndo, ""%s Minimum VPI/VCI: %u/%u"", ident, (EXTRACT_16BITS(obj_tptr+4))&0xfff, (EXTRACT_16BITS(obj_tptr + 6)) & 0xfff)); ND_PRINT((ndo, ""%s Maximum VPI/VCI: %u/%u"", ident, (EXTRACT_16BITS(obj_tptr+8))&0xfff, (EXTRACT_16BITS(obj_tptr + 10)) & 0xfff)); obj_tlen-=12; obj_tptr+=12; break; case RSVP_CTYPE_3: if (obj_tlen < 12) return-1; ND_PRINT((ndo, ""%s L3 Protocol ID: %s"", ident, tok2str(ethertype_values, ""Unknown Protocol (0x%04x)"", EXTRACT_16BITS(obj_tptr + 2)))); ND_PRINT((ndo, ""%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI"", ident, (EXTRACT_32BITS(obj_tptr+4))&0x7fffff, (EXTRACT_32BITS(obj_tptr+8))&0x7fffff, (((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 0 ) ? ""10"" : """", (((EXTRACT_16BITS(obj_tptr + 4) >> 7) & 3) == 2 ) ? ""23"" : """")); obj_tlen-=12; obj_tptr+=12; break; case RSVP_CTYPE_4: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s LSP Encoding Type: %s (%u)"", ident, tok2str(gmpls_encoding_values, ""Unknown"", *obj_tptr), *obj_tptr)); ND_PRINT((ndo, ""%s Switching Type: %s (%u), Payload ID: %s (0x%04x)"", ident, tok2str(gmpls_switch_cap_values, ""Unknown"", *(obj_tptr+1)), *(obj_tptr+1), tok2str(gmpls_payload_values, ""Unknown"", EXTRACT_16BITS(obj_tptr+2)), EXTRACT_16BITS(obj_tptr + 2))); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; case RSVP_OBJ_RRO: case RSVP_OBJ_ERO: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: while(obj_tlen >= 4 ) { u_char length; ND_TCHECK2(*obj_tptr, 4); length = *(obj_tptr + 1); ND_PRINT((ndo, ""%s Subobject Type: %s, length %u"", ident, tok2str(rsvp_obj_xro_values, ""Unknown %u"", RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)), length)); if (length == 0) { /* prevent infinite loops */ ND_PRINT((ndo, ""%s ERROR: zero length ERO subtype"", ident)); break; } switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)) { u_char prefix_length; case RSVP_OBJ_XRO_IPV4: if (length != 8) { ND_PRINT((ndo, "" ERROR: length != 8"")); goto invalid; } ND_TCHECK2(*obj_tptr, 8); prefix_length = *(obj_tptr+6); if (prefix_length != 32) { ND_PRINT((ndo, "" ERROR: Prefix length %u != 32"", prefix_length)); goto invalid; } ND_PRINT((ndo, "", %s, %s/%u, Flags: [%s]"", RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr) ? ""Loose"" : ""Strict"", ipaddr_string(ndo, obj_tptr+2), *(obj_tptr+6), bittok2str(rsvp_obj_rro_flag_values, ""none"", *(obj_tptr + 7)))); /* rfc3209 says that this field is rsvd. */ break; case RSVP_OBJ_XRO_LABEL: if (length != 8) { ND_PRINT((ndo, "" ERROR: length != 8"")); goto invalid; } ND_TCHECK2(*obj_tptr, 8); ND_PRINT((ndo, "", Flags: [%s] (%#x), Class-Type: %s (%u), %u"", bittok2str(rsvp_obj_rro_label_flag_values, ""none"", *(obj_tptr+2)), *(obj_tptr+2), tok2str(rsvp_ctype_values, ""Unknown"", *(obj_tptr+3) + 256*RSVP_OBJ_RRO), *(obj_tptr+3), EXTRACT_32BITS(obj_tptr + 4))); } obj_tlen-=*(obj_tptr+1); obj_tptr+=*(obj_tptr+1); } break; default: hexdump=TRUE; } break; case RSVP_OBJ_HELLO: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: case RSVP_CTYPE_2: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Source Instance: 0x%08x, Destination Instance: 0x%08x"", ident, EXTRACT_32BITS(obj_tptr), EXTRACT_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; break; default: hexdump=TRUE; } break; case RSVP_OBJ_RESTART_CAPABILITY: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Restart Time: %ums, Recovery Time: %ums"", ident, EXTRACT_32BITS(obj_tptr), EXTRACT_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; break; default: hexdump=TRUE; } break; case RSVP_OBJ_SESSION_ATTRIBUTE: switch(rsvp_obj_ctype) { case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 4) return-1; namelen = *(obj_tptr+3); if (obj_tlen < 4+namelen) return-1; ND_PRINT((ndo, ""%s Session Name: "", ident)); for (i = 0; i < namelen; i++) safeputchar(ndo, *(obj_tptr + 4 + i)); ND_PRINT((ndo, ""%s Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)"", ident, (int)*obj_tptr, (int)*(obj_tptr+1), bittok2str(rsvp_session_attribute_flag_values, ""none"", *(obj_tptr+2)), *(obj_tptr + 2))); obj_tlen-=4+*(obj_tptr+3); obj_tptr+=4+*(obj_tptr+3); break; default: hexdump=TRUE; } break; case RSVP_OBJ_GENERALIZED_UNI: switch(rsvp_obj_ctype) { int subobj_type,af,subobj_len,total_subobj_len; case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; /* read variable length subobjects */ total_subobj_len = obj_tlen; while(total_subobj_len > 0) { subobj_len = EXTRACT_16BITS(obj_tptr); subobj_type = (EXTRACT_16BITS(obj_tptr+2))>>8; af = (EXTRACT_16BITS(obj_tptr+2))&0x00FF; ND_PRINT((ndo, ""%s Subobject Type: %s (%u), AF: %s (%u), length: %u"", ident, tok2str(rsvp_obj_generalized_uni_values, ""Unknown"", subobj_type), subobj_type, tok2str(af_values, ""Unknown"", af), af, subobj_len)); if(subobj_len == 0) goto invalid; switch(subobj_type) { case RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS: case RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS: switch(af) { case AFNUM_INET: if (subobj_len < 8) return -1; ND_PRINT((ndo, ""%s UNI IPv4 TNA address: %s"", ident, ipaddr_string(ndo, obj_tptr + 4))); break; case AFNUM_INET6: if (subobj_len < 20) return -1; ND_PRINT((ndo, ""%s UNI IPv6 TNA address: %s"", ident, ip6addr_string(ndo, obj_tptr + 4))); break; case AFNUM_NSAP: if (subobj_len) { /* unless we have a TLV parser lets just hexdump */ hexdump=TRUE; } break; } break; case RSVP_GEN_UNI_SUBOBJ_DIVERSITY: if (subobj_len) { /* unless we have a TLV parser lets just hexdump */ hexdump=TRUE; } break; case RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL: if (subobj_len < 16) { return -1; } ND_PRINT((ndo, ""%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u"", ident, ((EXTRACT_32BITS(obj_tptr+4))>>31), ((EXTRACT_32BITS(obj_tptr+4))&0xFF), EXTRACT_32BITS(obj_tptr+8), EXTRACT_32BITS(obj_tptr + 12))); break; case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL: if (subobj_len < 8) { return -1; } ND_PRINT((ndo, ""%s Service level: %u"", ident, (EXTRACT_32BITS(obj_tptr + 4)) >> 24)); break; default: hexdump=TRUE; break; } total_subobj_len-=subobj_len; obj_tptr+=subobj_len; obj_tlen+=subobj_len; } if (total_subobj_len) { /* unless we have a TLV parser lets just hexdump */ hexdump=TRUE; } break; default: hexdump=TRUE; } break; case RSVP_OBJ_RSVP_HOP: switch(rsvp_obj_ctype) { case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; if (obj_tlen) hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */ break; case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr + 16))); obj_tlen-=20; obj_tptr+=20; hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */ break; default: hexdump=TRUE; } break; case RSVP_OBJ_TIME_VALUES: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Refresh Period: %ums"", ident, EXTRACT_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; /* those three objects do share the same semantics */ case RSVP_OBJ_SENDER_TSPEC: case RSVP_OBJ_ADSPEC: case RSVP_OBJ_FLOWSPEC: switch(rsvp_obj_ctype) { case RSVP_CTYPE_2: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Msg-Version: %u, length: %u"", ident, (*obj_tptr & 0xf0) >> 4, EXTRACT_16BITS(obj_tptr + 2) << 2)); obj_tptr+=4; /* get to the start of the service header */ obj_tlen-=4; while (obj_tlen >= 4) { intserv_serv_tlen=EXTRACT_16BITS(obj_tptr+2)<<2; ND_PRINT((ndo, ""%s Service Type: %s (%u), break bit %s set, Service length: %u"", ident, tok2str(rsvp_intserv_service_type_values,""unknown"",*(obj_tptr)), *(obj_tptr), (*(obj_tptr+1)&0x80) ? """" : ""not"", intserv_serv_tlen)); obj_tptr+=4; /* get to the start of the parameter list */ obj_tlen-=4; while (intserv_serv_tlen>=4) { processed = rsvp_intserv_print(ndo, obj_tptr, obj_tlen); if (processed == 0) break; obj_tlen-=processed; intserv_serv_tlen-=processed; obj_tptr+=processed; } } break; default: hexdump=TRUE; } break; case RSVP_OBJ_FILTERSPEC: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Source Port: %u"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Source Port: %u"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_3: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Flow Label: %u"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_24BITS(obj_tptr + 17))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_TUNNEL_IPV6: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Source Address: %s, LSP-ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_13: /* IPv6 p2mp LSP tunnel */ if (obj_tlen < 40) return-1; ND_PRINT((ndo, ""%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"" ""%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), ident, ip6addr_string(ndo, obj_tptr+20), EXTRACT_16BITS(obj_tptr + 38))); obj_tlen-=40; obj_tptr+=40; break; case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Source Address: %s, LSP-ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_12: /* IPv4 p2mp LSP tunnel */ if (obj_tlen < 16) return-1; ND_PRINT((ndo, ""%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"" ""%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ident, ipaddr_string(ndo, obj_tptr+8), EXTRACT_16BITS(obj_tptr + 12))); obj_tlen-=16; obj_tptr+=16; break; default: hexdump=TRUE; } break; case RSVP_OBJ_FASTREROUTE: /* the differences between c-type 1 and 7 are minor */ obj_ptr.rsvp_obj_frr = (const struct rsvp_obj_frr_t *)obj_tptr; bw.i = EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: /* new style */ if (obj_tlen < sizeof(struct rsvp_obj_frr_t)) return-1; ND_PRINT((ndo, ""%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps"", ident, (int)obj_ptr.rsvp_obj_frr->setup_prio, (int)obj_ptr.rsvp_obj_frr->hold_prio, (int)obj_ptr.rsvp_obj_frr->hop_limit, bw.f * 8 / 1000000)); ND_PRINT((ndo, ""%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x"", ident, EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any), EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any), EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_all))); obj_tlen-=sizeof(struct rsvp_obj_frr_t); obj_tptr+=sizeof(struct rsvp_obj_frr_t); break; case RSVP_CTYPE_TUNNEL_IPV4: /* old style */ if (obj_tlen < 16) return-1; ND_PRINT((ndo, ""%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps"", ident, (int)obj_ptr.rsvp_obj_frr->setup_prio, (int)obj_ptr.rsvp_obj_frr->hold_prio, (int)obj_ptr.rsvp_obj_frr->hop_limit, bw.f * 8 / 1000000)); ND_PRINT((ndo, ""%s Include Colors: 0x%08x, Exclude Colors: 0x%08x"", ident, EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any), EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any))); obj_tlen-=16; obj_tptr+=16; break; default: hexdump=TRUE; } break; case RSVP_OBJ_DETOUR: switch(rsvp_obj_ctype) { case RSVP_CTYPE_TUNNEL_IPV4: while(obj_tlen >= 8) { ND_PRINT((ndo, ""%s PLR-ID: %s, Avoid-Node-ID: %s"", ident, ipaddr_string(ndo, obj_tptr), ipaddr_string(ndo, obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; } break; default: hexdump=TRUE; } break; case RSVP_OBJ_CLASSTYPE: case RSVP_OBJ_CLASSTYPE_OLD: /* fall through */ switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: ND_PRINT((ndo, ""%s CT: %u"", ident, EXTRACT_32BITS(obj_tptr) & 0x7)); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; case RSVP_OBJ_ERROR_SPEC: switch(rsvp_obj_ctype) { case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; error_code=*(obj_tptr+5); error_value=EXTRACT_16BITS(obj_tptr+6); ND_PRINT((ndo, ""%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)"", ident, ipaddr_string(ndo, obj_tptr), *(obj_tptr+4), ident, tok2str(rsvp_obj_error_code_values,""unknown"",error_code), error_code)); switch (error_code) { case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING: ND_PRINT((ndo, "", Error Value: %s (%u)"", tok2str(rsvp_obj_error_code_routing_values,""unknown"",error_value), error_value)); break; case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE: /* fall through */ case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD: ND_PRINT((ndo, "", Error Value: %s (%u)"", tok2str(rsvp_obj_error_code_diffserv_te_values,""unknown"",error_value), error_value)); break; default: ND_PRINT((ndo, "", Unknown Error Value (%u)"", error_value)); break; } obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; error_code=*(obj_tptr+17); error_value=EXTRACT_16BITS(obj_tptr+18); ND_PRINT((ndo, ""%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)"", ident, ip6addr_string(ndo, obj_tptr), *(obj_tptr+16), ident, tok2str(rsvp_obj_error_code_values,""unknown"",error_code), error_code)); switch (error_code) { case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING: ND_PRINT((ndo, "", Error Value: %s (%u)"", tok2str(rsvp_obj_error_code_routing_values,""unknown"",error_value), error_value)); break; default: break; } obj_tlen-=20; obj_tptr+=20; break; default: hexdump=TRUE; } break; case RSVP_OBJ_PROPERTIES: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; padbytes = EXTRACT_16BITS(obj_tptr+2); ND_PRINT((ndo, ""%s TLV count: %u, padding bytes: %u"", ident, EXTRACT_16BITS(obj_tptr), padbytes)); obj_tlen-=4; obj_tptr+=4; /* loop through as long there is anything longer than the TLV header (2) */ while(obj_tlen >= 2 + padbytes) { ND_PRINT((ndo, ""%s %s TLV (0x%02x), length: %u"", /* length includes header */ ident, tok2str(rsvp_obj_prop_tlv_values,""unknown"",*obj_tptr), *obj_tptr, *(obj_tptr + 1))); if (obj_tlen < *(obj_tptr+1)) return-1; if (*(obj_tptr+1) < 2) return -1; print_unknown_data(ndo, obj_tptr + 2, ""\n\t\t"", *(obj_tptr + 1) - 2); obj_tlen-=*(obj_tptr+1); obj_tptr+=*(obj_tptr+1); } break; default: hexdump=TRUE; } break; case RSVP_OBJ_MESSAGE_ID: /* fall through */ case RSVP_OBJ_MESSAGE_ID_ACK: /* fall through */ case RSVP_OBJ_MESSAGE_ID_LIST: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: case RSVP_CTYPE_2: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Flags [0x%02x], epoch: %u"", ident, *obj_tptr, EXTRACT_24BITS(obj_tptr + 1))); obj_tlen-=4; obj_tptr+=4; /* loop through as long there are no messages left */ while(obj_tlen >= 4) { ND_PRINT((ndo, ""%s Message-ID 0x%08x (%u)"", ident, EXTRACT_32BITS(obj_tptr), EXTRACT_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; } break; default: hexdump=TRUE; } break; case RSVP_OBJ_INTEGRITY: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < sizeof(struct rsvp_obj_integrity_t)) return-1; obj_ptr.rsvp_obj_integrity = (const struct rsvp_obj_integrity_t *)obj_tptr; ND_PRINT((ndo, ""%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]"", ident, EXTRACT_16BITS(obj_ptr.rsvp_obj_integrity->key_id), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->key_id+2), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence+4), bittok2str(rsvp_obj_integrity_flag_values, ""none"", obj_ptr.rsvp_obj_integrity->flags))); ND_PRINT((ndo, ""%s MD5-sum 0x%08x%08x%08x%08x "", ident, EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+4), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+8), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest + 12))); sigcheck = signature_verify(ndo, pptr, plen, obj_ptr.rsvp_obj_integrity->digest, rsvp_clear_checksum, rsvp_com_header); ND_PRINT((ndo, "" (%s)"", tok2str(signature_check_values, ""Unknown"", sigcheck))); obj_tlen+=sizeof(struct rsvp_obj_integrity_t); obj_tptr+=sizeof(struct rsvp_obj_integrity_t); break; default: hexdump=TRUE; } break; case RSVP_OBJ_ADMIN_STATUS: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Flags [%s]"", ident, bittok2str(rsvp_obj_admin_status_flag_values, ""none"", EXTRACT_32BITS(obj_tptr)))); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; case RSVP_OBJ_LABEL_SET: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; action = (EXTRACT_16BITS(obj_tptr)>>8); ND_PRINT((ndo, ""%s Action: %s (%u), Label type: %u"", ident, tok2str(rsvp_obj_label_set_action_values, ""Unknown"", action), action, ((EXTRACT_32BITS(obj_tptr) & 0x7F)))); switch (action) { case LABEL_SET_INCLUSIVE_RANGE: case LABEL_SET_EXCLUSIVE_RANGE: /* fall through */ /* only a couple of subchannels are expected */ if (obj_tlen < 12) return -1; ND_PRINT((ndo, ""%s Start range: %u, End range: %u"", ident, EXTRACT_32BITS(obj_tptr+4), EXTRACT_32BITS(obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; default: obj_tlen-=4; obj_tptr+=4; subchannel = 1; while(obj_tlen >= 4 ) { ND_PRINT((ndo, ""%s Subchannel #%u: %u"", ident, subchannel, EXTRACT_32BITS(obj_tptr))); obj_tptr+=4; obj_tlen-=4; subchannel++; } break; } break; default: hexdump=TRUE; } break; case RSVP_OBJ_S2L: switch (rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Sub-LSP destination address: %s"", ident, ipaddr_string(ndo, obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; case RSVP_CTYPE_IPV6: if (obj_tlen < 16) return-1; ND_PRINT((ndo, ""%s Sub-LSP destination address: %s"", ident, ip6addr_string(ndo, obj_tptr))); obj_tlen-=16; obj_tptr+=16; break; default: hexdump=TRUE; } break; /* * FIXME those are the defined objects that lack a decoder * you are welcome to contribute code ;-) */ case RSVP_OBJ_SCOPE: case RSVP_OBJ_POLICY_DATA: case RSVP_OBJ_ACCEPT_LABEL_SET: case RSVP_OBJ_PROTECTION: default: if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, obj_tptr, ""\n\t "", obj_tlen); /* FIXME indentation */ break; } /* do we also want to see a hex dump ? */ if (ndo->ndo_vflag > 1 || hexdump == TRUE) print_unknown_data(ndo, tptr + sizeof(struct rsvp_object_header), ""\n\t "", /* FIXME indentation */ rsvp_obj_len - sizeof(struct rsvp_object_header)); tptr+=rsvp_obj_len; tlen-=rsvp_obj_len; } return 0; invalid: ND_PRINT((ndo, ""%s"", istr)); return -1; trunc: ND_PRINT((ndo, ""\n\t\t"")); ND_PRINT((ndo, ""%s"", tstr)); return -1; } ",1 "void PDFiumEngine::OnDocumentComplete() { if (!doc_ || !form_) { file_access_.m_FileLen = doc_loader_.document_size(); if (!fpdf_availability_) { fpdf_availability_ = FPDFAvail_Create(&file_availability_, &file_access_); DCHECK(fpdf_availability_); } LoadDocument(); return; } FinishLoadingDocument(); } ",0 "int *X509_REQ_get_extension_nids(void) { return ext_nids; } ",0 "selftest (void) { const char *r; if ( (r = selftest_basic_128 ()) || (r = selftest_basic_192 ()) || (r = selftest_basic_256 ()) ) return r; if ( (r = selftest_ctr_128 ()) ) return r; if ( (r = selftest_cbc_128 ()) ) return r; if ( (r = selftest_cfb_128 ()) ) return r; return r; } ",0 "static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) { struct sk_buff *msg; struct cfg80211_registered_device *dev = info->user_ptr[0]; struct net_device *netdev = info->user_ptr[1]; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) return -ENOMEM; if (nl80211_send_iface(msg, info->snd_pid, info->snd_seq, 0, dev, netdev) < 0) { nlmsg_free(msg); return -ENOBUFS; } return genlmsg_reply(msg, info); } ",0 "static void split_certinfo(char *string, zval *hash) { char *org = estrdup(string); char *s = org; char *split; if(org) { do { char *key; char *val; char *tmp; split = strstr(s, ""; ""); if(split) *split = '\0'; key = s; tmp = memchr(key, '=', 64); if(tmp) { *tmp = '\0'; val = tmp+1; add_assoc_string(hash, key, val); } s = split+2; } while(split); efree(org); } } ",0 "int drm_connector_attach_property(struct drm_connector *connector, struct drm_property *property, uint64_t init_val) { int i; for (i = 0; i < DRM_CONNECTOR_MAX_PROPERTY; i++) { if (connector->property_ids[i] == 0) { connector->property_ids[i] = property->base.id; connector->property_values[i] = init_val; break; } } if (i == DRM_CONNECTOR_MAX_PROPERTY) return -EINVAL; return 0; } ",0 "void AXObjectCacheImpl::remove(AXID axID) { if (!axID) return; AXObject* obj = m_objects.at(axID); if (!obj) return; obj->detach(); removeAXID(obj); if (!m_objects.take(axID)) return; DCHECK(m_objects.size() >= m_idsInUse.size()); } ",0 " Ins_MUL( INS_ARG ) { DO_MUL } ",0 "void PrintWebViewHelper::Print(blink::WebLocalFrame* frame, const blink::WebNode& node, bool is_scripted) { if (prep_frame_view_) return; FrameReference frame_ref(frame); int expected_page_count = 0; if (!CalculateNumberOfPages(frame, node, &expected_page_count)) { DidFinishPrinting(FAIL_PRINT_INIT); return; // Failed to init print page settings. } if (!expected_page_count) { DidFinishPrinting(FAIL_PRINT); return; } if (delegate_->IsAskPrintSettingsEnabled() && !GetPrintSettingsFromUser(frame_ref.GetFrame(), node, expected_page_count, is_scripted)) { DidFinishPrinting(OK); // Release resources and fail silently. return; } if (!RenderPagesForPrint(frame_ref.GetFrame(), node)) { LOG(ERROR) << ""RenderPagesForPrint failed""; DidFinishPrinting(FAIL_PRINT); } scripting_throttler_.Reset(); } ",0 "void WebRuntimeFeatures::EnableLayoutNG(bool enable) { RuntimeEnabledFeatures::SetLayoutNGEnabled(enable); } ",0 "static int __init rose_proto_init(void) { int i; int rc; if (rose_ndevs > 0x7FFFFFFF/sizeof(struct net_device *)) { printk(KERN_ERR ""ROSE: rose_proto_init - rose_ndevs parameter to large\n""); rc = -EINVAL; goto out; } rc = proto_register(&rose_proto, 0); if (rc != 0) goto out; rose_callsign = null_ax25_address; dev_rose = kzalloc(rose_ndevs * sizeof(struct net_device *), GFP_KERNEL); if (dev_rose == NULL) { printk(KERN_ERR ""ROSE: rose_proto_init - unable to allocate device structure\n""); rc = -ENOMEM; goto out_proto_unregister; } for (i = 0; i < rose_ndevs; i++) { struct net_device *dev; char name[IFNAMSIZ]; sprintf(name, ""rose%d"", i); dev = alloc_netdev(0, name, rose_setup); if (!dev) { printk(KERN_ERR ""ROSE: rose_proto_init - unable to allocate memory\n""); rc = -ENOMEM; goto fail; } rc = register_netdev(dev); if (rc) { printk(KERN_ERR ""ROSE: netdevice registration failed\n""); free_netdev(dev); goto fail; } rose_set_lockdep_key(dev); dev_rose[i] = dev; } sock_register(&rose_family_ops); register_netdevice_notifier(&rose_dev_notifier); ax25_register_pid(&rose_pid); ax25_linkfail_register(&rose_linkfail_notifier); #ifdef CONFIG_SYSCTL rose_register_sysctl(); #endif rose_loopback_init(); rose_add_loopback_neigh(); proc_net_fops_create(&init_net, ""rose"", S_IRUGO, &rose_info_fops); proc_net_fops_create(&init_net, ""rose_neigh"", S_IRUGO, &rose_neigh_fops); proc_net_fops_create(&init_net, ""rose_nodes"", S_IRUGO, &rose_nodes_fops); proc_net_fops_create(&init_net, ""rose_routes"", S_IRUGO, &rose_routes_fops); out: return rc; fail: while (--i >= 0) { unregister_netdev(dev_rose[i]); free_netdev(dev_rose[i]); } kfree(dev_rose); out_proto_unregister: proto_unregister(&rose_proto); goto out; } ",0 " TestWCDelegateForDialogsAndFullscreen() : is_fullscreen_(false), message_loop_runner_(new MessageLoopRunner) {} ",1 "static size_t elf_core_vma_data_size(struct vm_area_struct *gate_vma, unsigned long mm_flags) { struct vm_area_struct *vma; size_t size = 0; for (vma = first_vma(current, gate_vma); vma != NULL; vma = next_vma(vma, gate_vma)) size += vma_dump_size(vma, mm_flags); return size; } ",0 "bool SyncBackendHost::EncryptEverythingEnabled() const { if (initialization_state_ == NOT_INITIALIZED) { NOTREACHED() << ""Cannot check encryption status without first "" << ""initializing backend.""; return false; } return core_->sync_manager()->EncryptEverythingEnabled(); } ",0 "static int try_8x8basis_c(int16_t rem[64], int16_t weight[64], int16_t basis[64], int scale){ int i; unsigned int sum=0; for(i=0; i<8*8; i++){ int b= rem[i] + ((basis[i]*scale + (1<<(BASIS_SHIFT - RECON_SHIFT-1)))>>(BASIS_SHIFT - RECON_SHIFT)); int w= weight[i]; b>>= RECON_SHIFT; av_assert2(-512>4; } return sum>>2; } ",0 " t42_parse_sfnts( T42_Face face, T42_Loader loader ) { T42_Parser parser = &loader->parser; FT_Memory memory = parser->root.memory; FT_Byte* cur; FT_Byte* limit = parser->root.limit; FT_Error error; FT_Int num_tables = 0; FT_ULong count, ttf_size = 0; FT_Long n, string_size, old_string_size, real_size; FT_Byte* string_buf = NULL; FT_Bool allocated = 0; T42_Load_Status status; /* The format is */ /* */ /* /sfnts [ ... ] def */ /* */ /* or */ /* */ /* /sfnts [ */ /* RD */ /* RD */ /* ... */ /* ] def */ /* */ /* with exactly one space after the `RD' token. */ T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit || *parser->root.cursor++ != '[' ) { FT_ERROR(( ""t42_parse_sfnts: can't find begin of sfnts vector\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_Spaces( parser ); status = BEFORE_START; string_size = 0; old_string_size = 0; count = 0; while ( parser->root.cursor < limit ) { cur = parser->root.cursor; if ( *cur == ']' ) { parser->root.cursor++; goto Exit; } else if ( *cur == '<' ) { T1_Skip_PS_Token( parser ); if ( parser->root.error ) goto Exit; /* don't include delimiters */ string_size = (FT_Long)( ( parser->root.cursor - cur - 2 + 1 ) / 2 ); if ( FT_REALLOC( string_buf, old_string_size, string_size ) ) goto Fail; allocated = 1; parser->root.cursor = cur; (void)T1_ToBytes( parser, string_buf, string_size, &real_size, 1 ); old_string_size = string_size; string_size = real_size; } else if ( ft_isdigit( *cur ) ) { if ( allocated ) { FT_ERROR(( ""t42_parse_sfnts: "" ""can't handle mixed binary and hex strings\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } string_size = T1_ToInt( parser ); if ( string_size < 0 ) { FT_ERROR(( ""t42_parse_sfnts: invalid string size\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } T1_Skip_PS_Token( parser ); /* `RD' */ if ( parser->root.error ) return; string_buf = parser->root.cursor + 1; /* one space after `RD' */ if ( limit - parser->root.cursor < string_size ) { FT_ERROR(( ""t42_parse_sfnts: too many binary data\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } else parser->root.cursor += string_size + 1; } if ( !string_buf ) { FT_ERROR(( ""t42_parse_sfnts: invalid data in sfnts array\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } /* A string can have a trailing zero (odd) byte for padding. */ /* Ignore it. */ if ( ( string_size & 1 ) && string_buf[string_size - 1] == 0 ) string_size--; if ( !string_size ) { FT_ERROR(( ""t42_parse_sfnts: invalid string\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } for ( n = 0; n < string_size; n++ ) { switch ( status ) { case BEFORE_START: /* load offset table, 12 bytes */ if ( count < 12 ) { face->ttf_data[count++] = string_buf[n]; continue; } else { num_tables = 16 * face->ttf_data[4] + face->ttf_data[5]; status = BEFORE_TABLE_DIR; ttf_size = 12 + 16 * num_tables; if ( FT_REALLOC( face->ttf_data, 12, ttf_size ) ) goto Fail; } /* fall through */ case BEFORE_TABLE_DIR: /* the offset table is read; read the table directory */ if ( count < ttf_size ) { face->ttf_data[count++] = string_buf[n]; continue; } else { int i; FT_ULong len; for ( i = 0; i < num_tables; i++ ) { FT_Byte* p = face->ttf_data + 12 + 16 * i + 12; len = FT_PEEK_ULONG( p ); /* Pad to a 4-byte boundary length */ ttf_size += ( len + 3 ) & ~3; } status = OTHER_TABLES; face->ttf_size = ttf_size; /* there are no more than 256 tables, so no size check here */ if ( FT_REALLOC( face->ttf_data, 12 + 16 * num_tables, ttf_size + 1 ) ) goto Fail; } /* fall through */ case OTHER_TABLES: /* all other tables are just copied */ if ( count >= ttf_size ) { FT_ERROR(( ""t42_parse_sfnts: too many binary data\n"" )); error = FT_THROW( Invalid_File_Format ); goto Fail; } face->ttf_data[count++] = string_buf[n]; } } T1_Skip_Spaces( parser ); } /* if control reaches this point, the format was not valid */ error = FT_THROW( Invalid_File_Format ); Fail: parser->root.error = error; Exit: if ( allocated ) FT_FREE( string_buf ); } ",0 "void V8TestObject::ReflectBooleanAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_reflectBooleanAttribute_Getter""); test_object_v8_internal::ReflectBooleanAttributeAttributeGetter(info); } ",0 "main(int argc, char * * argv) { const char command0[] = { 0x00, 0x00 }; char command1[] = ""\x01\x00urn:schemas-upnp-org:device:InternetGatewayDevice""; char command2[] = ""\x02\x00uuid:fc4ec57e-b051-11db-88f8-0060085db3f6::upnp:rootdevice""; const char command3[] = { 0x03, 0x00 }; /* old versions of minissdpd would reject a command with * a zero length string argument */ char command3compat[] = ""\x03\x00ssdp:all""; char command4[] = ""\x04\x00test:test:test""; const char bad_command[] = { 0xff, 0xff }; const char overflow[] = { 0x01, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; const char command5[] = { 0x05, 0x00 }; int s; int i; void * tmp; unsigned char * resp = NULL; size_t respsize = 0; unsigned char buf[4096]; ssize_t n; int total = 0; const char * sockpath = ""/var/run/minissdpd.sock""; for(i=0; i 0) { printversion(buf, n); } else { printf(""Command 0 (get version) not supported\n""); close(s); s = connect_unix_socket(sockpath); } n = SENDCOMMAND(command1, sizeof(command1) - 1); n = read(s, buf, sizeof(buf)); printf(""Response received %d bytes\n"", (int)n); printresponse(buf, n); if(n == 0) { close(s); s = connect_unix_socket(sockpath); } n = SENDCOMMAND(command2, sizeof(command2) - 1); n = read(s, buf, sizeof(buf)); printf(""Response received %d bytes\n"", (int)n); printresponse(buf, n); if(n == 0) { close(s); s = connect_unix_socket(sockpath); } buf[0] = 0; /* Slight hack for printing num devices when 0 */ n = SENDCOMMAND(command3, sizeof(command3)); n = read(s, buf, sizeof(buf)); if(n == 0) { printf(""command3 failed, testing compatible one\n""); close(s); s = connect_unix_socket(sockpath); n = SENDCOMMAND(command3compat, sizeof(command3compat) - 1); n = read(s, buf, sizeof(buf)); } printf(""Response received %d bytes\n"", (int)n); printf(""Number of devices %d\n"", (int)buf[0]); while(n > 0) { tmp = realloc(resp, respsize + n); if(tmp == NULL) { fprintf(stderr, ""memory allocation error\n""); break; } resp = tmp; respsize += n; if (n > 0) { memcpy(resp + total, buf, n); total += n; } if (n < (ssize_t)sizeof(buf)) { break; } n = read(s, buf, sizeof(buf)); printf(""response received %d bytes\n"", (int)n); } if(resp != NULL) { printresponse(resp, total); free(resp); resp = NULL; } if(n == 0) { close(s); s = connect_unix_socket(sockpath); } n = SENDCOMMAND(command4, sizeof(command4)); /* no response for request type 4 */ n = SENDCOMMAND(bad_command, sizeof(bad_command)); n = read(s, buf, sizeof(buf)); printf(""Response received %d bytes\n"", (int)n); printresponse(buf, n); if(n == 0) { close(s); s = connect_unix_socket(sockpath); } n = SENDCOMMAND(overflow, sizeof(overflow)); n = read(s, buf, sizeof(buf)); printf(""Response received %d bytes\n"", (int)n); printresponse(buf, n); if(n == 0) { close(s); s = connect_unix_socket(sockpath); } n = SENDCOMMAND(command5, sizeof(command5)); n = read(s, buf, sizeof(buf)); printf(""Response received %d bytes\n"", (int)n); printresponse(buf, n); close(s); return 0; } ",1 "ofputil_append_meter_stats(struct ovs_list *replies, const struct ofputil_meter_stats *ms) { struct ofp13_meter_stats *reply; uint16_t n = 0; uint16_t len; len = sizeof *reply + ms->n_bands * sizeof(struct ofp13_meter_band_stats); reply = ofpmp_append(replies, len); reply->meter_id = htonl(ms->meter_id); reply->len = htons(len); memset(reply->pad, 0, sizeof reply->pad); reply->flow_count = htonl(ms->flow_count); reply->packet_in_count = htonll(ms->packet_in_count); reply->byte_in_count = htonll(ms->byte_in_count); reply->duration_sec = htonl(ms->duration_sec); reply->duration_nsec = htonl(ms->duration_nsec); for (n = 0; n < ms->n_bands; ++n) { const struct ofputil_meter_band_stats *src = &ms->bands[n]; struct ofp13_meter_band_stats *dst = &reply->band_stats[n]; dst->packet_band_count = htonll(src->packet_count); dst->byte_band_count = htonll(src->byte_count); } } ",0 "static void unsignedShortAttrAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueUnsigned(info, imp->unsignedShortAttr()); } ",0 "static MagickBooleanType WritePCDTile(Image *image,const char *page_geometry, const size_t tile_columns,const size_t tile_rows,ExceptionInfo *exception) { GeometryInfo geometry_info; Image *downsample_image, *tile_image; MagickBooleanType status; MagickStatusType flags; RectangleInfo geometry; register const Quantum *p, *q; register ssize_t i, x; ssize_t y; /* Scale image to tile size. */ SetGeometry(image,&geometry); (void) ParseMetaGeometry(page_geometry,&geometry.x,&geometry.y, &geometry.width,&geometry.height); if ((geometry.width % 2) != 0) geometry.width--; if ((geometry.height % 2) != 0) geometry.height--; tile_image=ResizeImage(image,geometry.width,geometry.height,TriangleFilter, exception); if (tile_image == (Image *) NULL) return(MagickFalse); flags=ParseGeometry(page_geometry,&geometry_info); geometry.width=(size_t) geometry_info.rho; geometry.height=(size_t) geometry_info.sigma; if ((flags & SigmaValue) == 0) geometry.height=geometry.width; if ((tile_image->columns != geometry.width) || (tile_image->rows != geometry.height)) { Image *bordered_image; RectangleInfo border_info; /* Put a border around the image. */ border_info.width=(geometry.width-tile_image->columns+1) >> 1; border_info.height=(geometry.height-tile_image->rows+1) >> 1; bordered_image=BorderImage(tile_image,&border_info,image->compose, exception); if (bordered_image == (Image *) NULL) return(MagickFalse); tile_image=DestroyImage(tile_image); tile_image=bordered_image; } if ((tile_image->columns != tile_columns) || (tile_image->rows != tile_rows)) { Image *resize_image; resize_image=ResizeImage(tile_image,tile_columns,tile_rows, tile_image->filter,exception); if (resize_image != (Image *) NULL) { tile_image=DestroyImage(tile_image); tile_image=resize_image; } } (void) TransformImageColorspace(tile_image,YCCColorspace,exception); downsample_image=ResizeImage(tile_image,tile_image->columns/2, tile_image->rows/2,TriangleFilter,exception); if (downsample_image == (Image *) NULL) return(MagickFalse); /* Write tile to PCD file. */ for (y=0; y < (ssize_t) tile_image->rows; y+=2) { p=GetVirtualPixels(tile_image,0,y,tile_image->columns,2,exception); if (p == (const Quantum *) NULL) break; for (x=0; x < (ssize_t) (tile_image->columns << 1); x++) { (void) WriteBlobByte(image,ScaleQuantumToChar(GetPixelRed(tile_image,p))); p+=GetPixelChannels(tile_image); } q=GetVirtualPixels(downsample_image,0,y >> 1,downsample_image->columns,1, exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) downsample_image->columns; x++) { (void) WriteBlobByte(image,ScaleQuantumToChar( GetPixelGreen(tile_image,q))); q+=GetPixelChannels(tile_image); } q=GetVirtualPixels(downsample_image,0,y >> 1,downsample_image->columns,1, exception); if (q == (Quantum *) NULL) break; for (x=0; x < (ssize_t) downsample_image->columns; x++) { (void) WriteBlobByte(image,ScaleQuantumToChar( GetPixelBlue(tile_image,q))); q+=GetPixelChannels(tile_image); } status=SetImageProgress(image,SaveImageTag,y,tile_image->rows); if (status == MagickFalse) break; } for (i=0; i < 0x800; i++) (void) WriteBlobByte(image,'\0'); downsample_image=DestroyImage(downsample_image); tile_image=DestroyImage(tile_image); return(MagickTrue); } ",0 "static bool kvm_vcpu_eligible_for_directed_yield(struct kvm_vcpu *vcpu) { #ifdef CONFIG_HAVE_KVM_CPU_RELAX_INTERCEPT bool eligible; eligible = !vcpu->spin_loop.in_spin_loop || vcpu->spin_loop.dy_eligible; if (vcpu->spin_loop.in_spin_loop) kvm_vcpu_set_dy_eligible(vcpu, !vcpu->spin_loop.dy_eligible); return eligible; #else return true; #endif } ",0 "void VideoCaptureManager::DestroyControllerIfNoClients( VideoCaptureController* controller) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!controller->HasActiveClient() && !controller->HasPausedClient()) { std::ostringstream string_stream; string_stream << ""VideoCaptureManager stopping device (stream_type = "" << controller->stream_type() << "", device_id = "" << controller->device_id() << "")""; EmitLogMessage(string_stream.str(), 1); DoStopDevice(controller); auto controller_iter = std::find_if( controllers_.begin(), controllers_.end(), [controller]( const scoped_refptr& device_entry) { return device_entry.get() == controller; }); controllers_.erase(controller_iter); } } ",0 "static zend_object_value spl_filesystem_object_new_check(zend_class_entry *class_type TSRMLS_DC) { zend_object_value ret = spl_filesystem_object_new_ex(class_type, NULL TSRMLS_CC); ret.handlers = &spl_filesystem_object_check_handlers; return ret; } ",0 " void InitializeAura() { view_->InitAsChild(nullptr); view_->Show(); } ",0 "static const char *code2name(int keycode) { return QKeyCode_lookup[qemu_input_key_number_to_qcode(keycode)]; } ",0 "void RenderWidgetHostViewAura::OnWindowTreeHostMoved( const aura::RootWindow* root, const gfx::Point& new_origin) { TRACE_EVENT1(""ui"", ""RenderWidgetHostViewAura::OnWindowTreeHostMoved"", ""new_origin"", new_origin.ToString()); UpdateScreenInfo(window_); } ",0 "void RenderFrameImpl::frameDetached(blink::WebFrame* frame, DetachType type) { CHECK(!is_detaching_); DCHECK(!frame_ || frame_ == frame); FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FrameDetached()); FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), FrameDetached(frame)); if (type == DetachType::Remove) Send(new FrameHostMsg_Detach(routing_id_)); is_detaching_ = true; if (render_widget_) { render_widget_->UnregisterRenderFrame(this); render_widget_->CloseForFrame(); } FrameMap::iterator it = g_frame_map.Get().find(frame); CHECK(it != g_frame_map.Get().end()); CHECK_EQ(it->second, this); g_frame_map.Get().erase(it); if (is_subframe_ && type == DetachType::Remove) frame->parent()->removeChild(frame); frame->close(); frame_ = nullptr; delete this; } ",0 "static int prctl_set_vma(unsigned long opt, unsigned long start, unsigned long len_in, unsigned long arg) { struct mm_struct *mm = current->mm; int error; unsigned long len; unsigned long end; if (start & ~PAGE_MASK) return -EINVAL; len = (len_in + ~PAGE_MASK) & PAGE_MASK; /* Check to see whether len was rounded up from small -ve to zero */ if (len_in && !len) return -EINVAL; end = start + len; if (end < start) return -EINVAL; if (end == start) return 0; down_write(&mm->mmap_sem); switch (opt) { case PR_SET_VMA_ANON_NAME: error = prctl_set_vma_anon_name(start, end, arg); break; default: error = -EINVAL; } up_write(&mm->mmap_sem); return error; } ",0 "Document& Document::EnsureTemplateDocument() { if (IsTemplateDocument()) return *this; if (template_document_) return *template_document_; if (IsHTMLDocument()) { template_document_ = HTMLDocument::Create(DocumentInit::Create() .WithContextDocument(ContextDocument()) .WithURL(BlankURL()) .WithNewRegistrationContext()); } else { template_document_ = Document::Create(DocumentInit::Create().WithURL(BlankURL())); } template_document_->template_document_host_ = this; // balanced in dtor. return *template_document_.Get(); } ",0 "ChromeBrowserMainPartsChromeos::ChromeBrowserMainPartsChromeos( const content::MainFunctionParams& parameters) : ChromeBrowserMainPartsLinux(parameters) { } ",0 "void dccp_v4_send_check(struct sock *sk, struct sk_buff *skb) { const struct inet_sock *inet = inet_sk(sk); struct dccp_hdr *dh = dccp_hdr(skb); dccp_csum_outgoing(skb); dh->dccph_checksum = dccp_v4_csum_finish(skb, inet->inet_saddr, inet->inet_daddr); } ",0 "void FrameLoader::setDefersLoading(bool defers) { if (m_documentLoader) m_documentLoader->setDefersLoading(defers); if (m_provisionalDocumentLoader) m_provisionalDocumentLoader->setDefersLoading(defers); if (m_policyDocumentLoader) m_policyDocumentLoader->setDefersLoading(defers); if (!defers) { m_frame->redirectScheduler()->startTimer(); startCheckCompleteTimer(); } } ",0 "void BrowserWindowGtk::SetGeometryHints() { gfx::Rect bounds; chrome::GetSavedWindowBoundsAndShowState(browser_.get(), &bounds, &show_state_after_show_); bool is_popup_or_panel = browser_->is_type_popup() || browser_->is_type_panel(); bool popup_without_position = is_popup_or_panel && bounds.x() == 0 && bounds.y() == 0; bool move = browser_->bounds_overridden() && !popup_without_position; SetBoundsImpl(bounds, !is_popup_or_panel, move); } ",0 "fm_mgr_pm_cfg_query ( IN p_fm_config_conx_hdlt hdl, IN fm_mgr_action_t action, OUT pm_config_t *info, OUT fm_msg_ret_code_t *ret_code ) { p_hsm_com_client_hdl_t client_hdl; if ( (client_hdl = get_mgr_hdl(hdl,FM_MGR_PM)) != NULL ) { return fm_mgr_general_query(client_hdl,action,FM_DT_PM_CFG,sizeof(pm_config_t),info,ret_code); } return FM_CONF_ERROR; } ",0 "SnapCoordinator* Document::snapCoordinator() { if (RuntimeEnabledFeatures::cssScrollSnapPointsEnabled() && !m_snapCoordinator) m_snapCoordinator = SnapCoordinator::create(); return m_snapCoordinator.get(); } ",0 " gfx::Rect GetRectFromString(const std::string& str) { std::vector tokens = base::SplitString( str, "","", base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY); EXPECT_EQ(4U, tokens.size()); double x = 0.0, y = 0.0, width = 0.0, height = 0.0; EXPECT_TRUE(base::StringToDouble(tokens[0], &x)); EXPECT_TRUE(base::StringToDouble(tokens[1], &y)); EXPECT_TRUE(base::StringToDouble(tokens[2], &width)); EXPECT_TRUE(base::StringToDouble(tokens[3], &height)); return {static_cast(x), static_cast(y), static_cast(width), static_cast(height)}; } ",0 "INST_HANDLER (rcall) { // RCALL k op->jump = (op->addr + (((((buf[1] & 0xf) << 8) | buf[0]) << 1) | (((buf[1] & 0x8) ? ~((int) 0x1fff) : 0))) + 2) & CPU_PC_MASK (cpu); op->fail = op->addr + op->size; ESIL_A (""pc,""); // esil already points to next __generic_push (op, CPU_PC_SIZE (cpu)); // push @ret addr ESIL_A (""%""PFMT64d"",pc,=,"", op->jump); // jump! if (!strncasecmp (cpu->model, ""ATtiny"", 6)) { op->cycles = 4; // ATtiny is always slow } else { op->cycles = cpu->pc <= 16 ? 3 : 4; if (!STR_BEGINS (cpu->model, ""ATxmega"")) { op->cycles--; // ATxmega optimizes one cycle } } } ",0 "static void xen_netbk_rx_action(struct xen_netbk *netbk) { struct xenvif *vif = NULL, *tmp; s8 status; u16 irq, flags; struct xen_netif_rx_response *resp; struct sk_buff_head rxq; struct sk_buff *skb; LIST_HEAD(notify); int ret; int nr_frags; int count; unsigned long offset; struct skb_cb_overlay *sco; struct netrx_pending_operations npo = { .copy = netbk->grant_copy_op, .meta = netbk->meta, }; skb_queue_head_init(&rxq); count = 0; while ((skb = skb_dequeue(&netbk->rx_queue)) != NULL) { vif = netdev_priv(skb->dev); nr_frags = skb_shinfo(skb)->nr_frags; sco = (struct skb_cb_overlay *)skb->cb; sco->meta_slots_used = netbk_gop_skb(skb, &npo); count += nr_frags + 1; __skb_queue_tail(&rxq, skb); /* Filled the batch queue? */ if (count + MAX_SKB_FRAGS >= XEN_NETIF_RX_RING_SIZE) break; } BUG_ON(npo.meta_prod > ARRAY_SIZE(netbk->meta)); if (!npo.copy_prod) return; BUG_ON(npo.copy_prod > ARRAY_SIZE(netbk->grant_copy_op)); gnttab_batch_copy(netbk->grant_copy_op, npo.copy_prod); while ((skb = __skb_dequeue(&rxq)) != NULL) { sco = (struct skb_cb_overlay *)skb->cb; vif = netdev_priv(skb->dev); if (netbk->meta[npo.meta_cons].gso_size && vif->gso_prefix) { resp = RING_GET_RESPONSE(&vif->rx, vif->rx.rsp_prod_pvt++); resp->flags = XEN_NETRXF_gso_prefix | XEN_NETRXF_more_data; resp->offset = netbk->meta[npo.meta_cons].gso_size; resp->id = netbk->meta[npo.meta_cons].id; resp->status = sco->meta_slots_used; npo.meta_cons++; sco->meta_slots_used--; } vif->dev->stats.tx_bytes += skb->len; vif->dev->stats.tx_packets++; status = netbk_check_gop(vif, sco->meta_slots_used, &npo); if (sco->meta_slots_used == 1) flags = 0; else flags = XEN_NETRXF_more_data; if (skb->ip_summed == CHECKSUM_PARTIAL) /* local packet? */ flags |= XEN_NETRXF_csum_blank | XEN_NETRXF_data_validated; else if (skb->ip_summed == CHECKSUM_UNNECESSARY) /* remote but checksummed. */ flags |= XEN_NETRXF_data_validated; offset = 0; resp = make_rx_response(vif, netbk->meta[npo.meta_cons].id, status, offset, netbk->meta[npo.meta_cons].size, flags); if (netbk->meta[npo.meta_cons].gso_size && !vif->gso_prefix) { struct xen_netif_extra_info *gso = (struct xen_netif_extra_info *) RING_GET_RESPONSE(&vif->rx, vif->rx.rsp_prod_pvt++); resp->flags |= XEN_NETRXF_extra_info; gso->u.gso.size = netbk->meta[npo.meta_cons].gso_size; gso->u.gso.type = XEN_NETIF_GSO_TYPE_TCPV4; gso->u.gso.pad = 0; gso->u.gso.features = 0; gso->type = XEN_NETIF_EXTRA_TYPE_GSO; gso->flags = 0; } netbk_add_frag_responses(vif, status, netbk->meta + npo.meta_cons + 1, sco->meta_slots_used); RING_PUSH_RESPONSES_AND_CHECK_NOTIFY(&vif->rx, ret); irq = vif->irq; if (ret && list_empty(&vif->notify_list)) list_add_tail(&vif->notify_list, ¬ify); xenvif_notify_tx_completion(vif); xenvif_put(vif); npo.meta_cons += sco->meta_slots_used; dev_kfree_skb(skb); } list_for_each_entry_safe(vif, tmp, ¬ify, notify_list) { notify_remote_via_irq(vif->irq); list_del_init(&vif->notify_list); } /* More work to do? */ if (!skb_queue_empty(&netbk->rx_queue) && !timer_pending(&netbk->net_timer)) xen_netbk_kick_thread(netbk); } ",0 "void InputMethodBase::SetFocusedTextInputClient(TextInputClient* client) { if (is_sticky_text_input_client_) return; SetFocusedTextInputClientInternal(client); } ",0 "void WebLocalFrameImpl::DidFail(const ResourceError& error, bool was_provisional, WebHistoryCommitType web_commit_type) { if (!Client()) return; WebURLError web_error = error; if (WebPluginContainerImpl* plugin = GetFrame()->GetWebPluginContainer()) plugin->DidFailLoading(error); if (was_provisional) Client()->DidFailProvisionalLoad(web_error, web_commit_type); else Client()->DidFailLoad(web_error, web_commit_type); } ",0 "static int pdf_barcode_128a_ch(struct pdf_doc *pdf, struct pdf_object *page, int x, int y, int width, int height, uint32_t colour, int index, int code_len) { uint32_t code = code_128a_encoding[index].code; int i; int line_width = width / 11; for (i = 0; i < code_len; i++) { uint8_t shift = (code_len - 1 - i) * 4; uint8_t mask = (code >> shift) & 0xf; if (!(i % 2)) { int j; for (j = 0; j < mask; j++) { pdf_add_line(pdf, page, x, y, x, y + height, line_width, colour); x += line_width; } } else x += line_width * mask; } return x; } ",0 "static char *make_output_option(struct output_struct *words, short *levels, uchar where) { char *str = words == info_words ? ""--info="" : ""--debug=""; int j, counts[MAX_OUT_LEVEL+1], pos, skipped = 0, len = 0, max = 0, lev = 0; int word_count = words == info_words ? COUNT_INFO : COUNT_DEBUG; char *buf; memset(counts, 0, sizeof counts); for (j = 0; words[j].name; j++) { if (words[j].flag != j) { rprintf(FERROR, ""rsync: internal error on %s%s: %d != %d\n"", words == info_words ? ""INFO_"" : ""DEBUG_"", words[j].name, words[j].flag, j); exit_cleanup(RERR_UNSUPPORTED); } if (!(words[j].where & where)) continue; if (words[j].priority == DEFAULT_PRIORITY) { /* Implied items don't need to be mentioned. */ skipped++; continue; } len += len ? 1 : strlen(str); len += strlen(words[j].name); len += levels[j] == 1 ? 0 : 1; if (words[j].priority == HELP_PRIORITY) continue; /* no abbreviating for help */ assert(levels[j] <= MAX_OUT_LEVEL); if (++counts[levels[j]] > max) { /* Determine which level has the most items. */ lev = levels[j]; max = counts[lev]; } } /* Sanity check the COUNT_* define against the length of the table. */ if (j != word_count) { rprintf(FERROR, ""rsync: internal error: %s is wrong! (%d != %d)\n"", words == info_words ? ""COUNT_INFO"" : ""COUNT_DEBUG"", j, word_count); exit_cleanup(RERR_UNSUPPORTED); } if (!len) return NULL; len++; if (!(buf = new_array(char, len))) out_of_memory(""make_output_option""); pos = 0; if (skipped || max < 5) lev = -1; else { if (lev == 0) pos += snprintf(buf, len, ""%sNONE"", str); else if (lev == 1) pos += snprintf(buf, len, ""%sALL"", str); else pos += snprintf(buf, len, ""%sALL%d"", str, lev); } for (j = 0; words[j].name && pos < len; j++) { if (words[j].priority == DEFAULT_PRIORITY || levels[j] == lev || !(words[j].where & where)) continue; if (pos) buf[pos++] = ','; else pos += strlcpy(buf+pos, str, len-pos); if (pos < len) pos += strlcpy(buf+pos, words[j].name, len-pos); /* Level 1 is implied by the name alone. */ if (levels[j] != 1 && pos < len) buf[pos++] = '0' + levels[j]; } buf[pos] = '\0'; return buf; } ",0 "SPICE_GNUC_VISIBLE int spice_server_migrate_client_state(SpiceServer *s) { spice_assert(reds == s); if (!reds_main_channel_connected()) { return SPICE_MIGRATE_CLIENT_NONE; } else if (reds->mig_wait_connect) { return SPICE_MIGRATE_CLIENT_WAITING; } else { return SPICE_MIGRATE_CLIENT_READY; } return 0; } ",0 "static void local_cleanup(struct nfc_llcp_local *local) { nfc_llcp_socket_release(local, false, ENXIO); del_timer_sync(&local->link_timer); skb_queue_purge(&local->tx_queue); cancel_work_sync(&local->tx_work); cancel_work_sync(&local->rx_work); cancel_work_sync(&local->timeout_work); kfree_skb(local->rx_pending); del_timer_sync(&local->sdreq_timer); cancel_work_sync(&local->sdreq_timeout_work); nfc_llcp_free_sdp_tlv_list(&local->pending_sdreqs); } ",0 "TestEventTarget* toTestEventTarget(JSC::JSValue value) { return value.inherits(&JSTestEventTarget::s_info) ? jsCast(asObject(value))->impl() : 0; } ",0 "static int virtnet_set_mac_address(struct net_device *dev, void *p) { struct virtnet_info *vi = netdev_priv(dev); struct virtio_device *vdev = vi->vdev; int ret; struct sockaddr *addr = p; struct scatterlist sg; ret = eth_prepare_mac_addr_change(dev, p); if (ret) return ret; if (virtio_has_feature(vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) { sg_init_one(&sg, addr->sa_data, dev->addr_len); if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, VIRTIO_NET_CTRL_MAC_ADDR_SET, &sg)) { dev_warn(&vdev->dev, ""Failed to set mac address by vq command.\n""); return -EINVAL; } } else if (virtio_has_feature(vdev, VIRTIO_NET_F_MAC) && !virtio_has_feature(vdev, VIRTIO_F_VERSION_1)) { unsigned int i; /* Naturally, this has an atomicity problem. */ for (i = 0; i < dev->addr_len; i++) virtio_cwrite8(vdev, offsetof(struct virtio_net_config, mac) + i, addr->sa_data[i]); } eth_commit_mac_addr_change(dev, p); return 0; } ",0 "void icmp_out_count(struct net *net, unsigned char type) { ICMPMSGOUT_INC_STATS(net, type); ICMP_INC_STATS(net, ICMP_MIB_OUTMSGS); } ",0 "status_t OMXCodec::setVideoOutputFormat( const char *mime, const sp& meta) { int32_t width, height; bool success = meta->findInt32(kKeyWidth, &width); success = success && meta->findInt32(kKeyHeight, &height); CHECK(success); CODEC_LOGV(""setVideoOutputFormat width=%d, height=%d"", width, height); OMX_VIDEO_CODINGTYPE compressionFormat = OMX_VIDEO_CodingUnused; if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_AVC, mime)) { compressionFormat = OMX_VIDEO_CodingAVC; } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_MPEG4, mime)) { compressionFormat = OMX_VIDEO_CodingMPEG4; } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_HEVC, mime)) { compressionFormat = OMX_VIDEO_CodingHEVC; } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_H263, mime)) { compressionFormat = OMX_VIDEO_CodingH263; } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_VP8, mime)) { compressionFormat = OMX_VIDEO_CodingVP8; } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_VP9, mime)) { compressionFormat = OMX_VIDEO_CodingVP9; } else if (!strcasecmp(MEDIA_MIMETYPE_VIDEO_MPEG2, mime)) { compressionFormat = OMX_VIDEO_CodingMPEG2; } else { ALOGE(""Not a supported video mime type: %s"", mime); CHECK(!""Should not be here. Not a supported video mime type.""); } status_t err = setVideoPortFormatType( kPortIndexInput, compressionFormat, OMX_COLOR_FormatUnused); if (err != OK) { return err; } #if 1 { OMX_VIDEO_PARAM_PORTFORMATTYPE format; InitOMXParams(&format); format.nPortIndex = kPortIndexOutput; format.nIndex = 0; status_t err = mOMX->getParameter( mNode, OMX_IndexParamVideoPortFormat, &format, sizeof(format)); CHECK_EQ(err, (status_t)OK); CHECK_EQ((int)format.eCompressionFormat, (int)OMX_VIDEO_CodingUnused); int32_t colorFormat; if (meta->findInt32(kKeyColorFormat, &colorFormat) && colorFormat != OMX_COLOR_FormatUnused && colorFormat != format.eColorFormat) { while (OMX_ErrorNoMore != err) { format.nIndex++; err = mOMX->getParameter( mNode, OMX_IndexParamVideoPortFormat, &format, sizeof(format)); if (format.eColorFormat == colorFormat) { break; } } if (format.eColorFormat != colorFormat) { CODEC_LOGE(""Color format %d is not supported"", colorFormat); return ERROR_UNSUPPORTED; } } err = mOMX->setParameter( mNode, OMX_IndexParamVideoPortFormat, &format, sizeof(format)); if (err != OK) { return err; } } #endif OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = kPortIndexInput; OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &def.format.video; err = mOMX->getParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); CHECK_EQ(err, (status_t)OK); #if 1 const size_t X = 64 * 1024; if (def.nBufferSize < X) { def.nBufferSize = X; } #endif CHECK_EQ((int)def.eDomain, (int)OMX_PortDomainVideo); video_def->nFrameWidth = width; video_def->nFrameHeight = height; video_def->eCompressionFormat = compressionFormat; video_def->eColorFormat = OMX_COLOR_FormatUnused; err = mOMX->setParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); if (err != OK) { return err; } InitOMXParams(&def); def.nPortIndex = kPortIndexOutput; err = mOMX->getParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); CHECK_EQ(err, (status_t)OK); CHECK_EQ((int)def.eDomain, (int)OMX_PortDomainVideo); #if 0 def.nBufferSize = (((width + 15) & -16) * ((height + 15) & -16) * 3) / 2; // YUV420 #endif video_def->nFrameWidth = width; video_def->nFrameHeight = height; err = mOMX->setParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); return err; } ",0 "MagickExport MagickBooleanType SetImageExtent(Image *image,const size_t columns, const size_t rows,ExceptionInfo *exception) { if ((columns == 0) || (rows == 0)) return(MagickFalse); image->columns=columns; image->rows=rows; if (image->depth > (8*sizeof(MagickSizeType))) ThrowBinaryException(ImageError,""ImageDepthNotSupported"",image->filename); return(SyncImagePixelCache(image,exception)); } ",0 "static int v9fs_path_is_ancestor(V9fsPath *s1, V9fsPath *s2) { if (!strncmp(s1->data, s2->data, s1->size - 1)) { if (s2->data[s1->size - 1] == '\0' || s2->data[s1->size - 1] == '/') { return 1; } } return 0; } ",0 "cms_envelopeddata_create(krb5_context context, pkinit_plg_crypto_context plgctx, pkinit_req_crypto_context reqctx, pkinit_identity_crypto_context idctx, krb5_preauthtype pa_type, int include_certchain, unsigned char *key_pack, unsigned int key_pack_len, unsigned char **out, unsigned int *out_len) { krb5_error_code retval = ENOMEM; PKCS7 *p7 = NULL; BIO *in = NULL; unsigned char *p = NULL, *signed_data = NULL, *enc_data = NULL; int signed_data_len = 0, enc_data_len = 0, flags = PKCS7_BINARY; STACK_OF(X509) *encerts = NULL; const EVP_CIPHER *cipher = NULL; int cms_msg_type; /* create the PKCS7 SignedData portion of the PKCS7 EnvelopedData */ switch ((int)pa_type) { case KRB5_PADATA_PK_AS_REQ_OLD: case KRB5_PADATA_PK_AS_REP_OLD: cms_msg_type = CMS_SIGN_DRAFT9; break; case KRB5_PADATA_PK_AS_REQ: cms_msg_type = CMS_ENVEL_SERVER; break; default: goto cleanup; } retval = cms_signeddata_create(context, plgctx, reqctx, idctx, cms_msg_type, include_certchain, key_pack, key_pack_len, &signed_data, (unsigned int *)&signed_data_len); if (retval) { pkiDebug(""failed to create pkcs7 signed data\n""); goto cleanup; } /* check we have client's certificate */ if (reqctx->received_cert == NULL) { retval = KRB5KDC_ERR_PREAUTH_FAILED; goto cleanup; } encerts = sk_X509_new_null(); sk_X509_push(encerts, reqctx->received_cert); cipher = EVP_des_ede3_cbc(); in = BIO_new(BIO_s_mem()); switch (pa_type) { case KRB5_PADATA_PK_AS_REQ: prepare_enc_data(signed_data, signed_data_len, &enc_data, &enc_data_len); retval = BIO_write(in, enc_data, enc_data_len); if (retval != enc_data_len) { pkiDebug(""BIO_write only wrote %d\n"", retval); goto cleanup; } break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: retval = BIO_write(in, signed_data, signed_data_len); if (retval != signed_data_len) { pkiDebug(""BIO_write only wrote %d\n"", retval); goto cleanup; } break; default: retval = -1; goto cleanup; } p7 = PKCS7_encrypt(encerts, in, cipher, flags); if (p7 == NULL) { retval = oerr(context, 0, _(""Failed to encrypt PKCS7 object"")); goto cleanup; } switch (pa_type) { case KRB5_PADATA_PK_AS_REQ: p7->d.enveloped->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_signed); break; case KRB5_PADATA_PK_AS_REP_OLD: case KRB5_PADATA_PK_AS_REQ_OLD: p7->d.enveloped->enc_data->content_type = OBJ_nid2obj(NID_pkcs7_data); break; break; break; break; } *out_len = i2d_PKCS7(p7, NULL); if (!*out_len || (p = *out = malloc(*out_len)) == NULL) { retval = ENOMEM; goto cleanup; } retval = i2d_PKCS7(p7, &p); if (!retval) { retval = oerr(context, 0, _(""Failed to DER encode PKCS7"")); goto cleanup; } retval = 0; #ifdef DEBUG_ASN1 print_buffer_bin(*out, *out_len, ""/tmp/kdc_enveloped_data""); #endif cleanup: if (p7 != NULL) PKCS7_free(p7); if (in != NULL) BIO_free(in); free(signed_data); free(enc_data); if (encerts != NULL) sk_X509_free(encerts); return retval; } ",0 "int ssl3_get_key_exchange(SSL *s) { #ifndef OPENSSL_NO_RSA unsigned char *q,md_buf[EVP_MAX_MD_SIZE*2]; #endif EVP_MD_CTX md_ctx; unsigned char *param,*p; int al,j,ok; long i,param_len,n,alg_k,alg_a; EVP_PKEY *pkey=NULL; const EVP_MD *md = NULL; #ifndef OPENSSL_NO_RSA RSA *rsa=NULL; #endif #ifndef OPENSSL_NO_DH DH *dh=NULL; #endif #ifndef OPENSSL_NO_ECDH EC_KEY *ecdh = NULL; BN_CTX *bn_ctx = NULL; EC_POINT *srvr_ecpoint = NULL; int curve_nid = 0; int encoded_pt_len = 0; #endif /* use same message size as in ssl3_get_certificate_request() * as ServerKeyExchange message may be skipped */ n=s->method->ssl_get_message(s, SSL3_ST_CR_KEY_EXCH_A, SSL3_ST_CR_KEY_EXCH_B, -1, s->max_cert_list, &ok); if (!ok) return((int)n); if (s->s3->tmp.message_type != SSL3_MT_SERVER_KEY_EXCHANGE) { #ifndef OPENSSL_NO_PSK /* In plain PSK ciphersuite, ServerKeyExchange can be omitted if no identity hint is sent. Set session->sess_cert anyway to avoid problems later.*/ if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK) { s->session->sess_cert=ssl_sess_cert_new(); if (s->ctx->psk_identity_hint) OPENSSL_free(s->ctx->psk_identity_hint); s->ctx->psk_identity_hint = NULL; } #endif s->s3->tmp.reuse_message=1; return(1); } param=p=(unsigned char *)s->init_msg; if (s->session->sess_cert != NULL) { #ifndef OPENSSL_NO_RSA if (s->session->sess_cert->peer_rsa_tmp != NULL) { RSA_free(s->session->sess_cert->peer_rsa_tmp); s->session->sess_cert->peer_rsa_tmp=NULL; } #endif #ifndef OPENSSL_NO_DH if (s->session->sess_cert->peer_dh_tmp) { DH_free(s->session->sess_cert->peer_dh_tmp); s->session->sess_cert->peer_dh_tmp=NULL; } #endif #ifndef OPENSSL_NO_ECDH if (s->session->sess_cert->peer_ecdh_tmp) { EC_KEY_free(s->session->sess_cert->peer_ecdh_tmp); s->session->sess_cert->peer_ecdh_tmp=NULL; } #endif } else { s->session->sess_cert=ssl_sess_cert_new(); } /* Total length of the parameters including the length prefix */ param_len=0; alg_k=s->s3->tmp.new_cipher->algorithm_mkey; alg_a=s->s3->tmp.new_cipher->algorithm_auth; EVP_MD_CTX_init(&md_ctx); al=SSL_AD_DECODE_ERROR; #ifndef OPENSSL_NO_PSK if (alg_k & SSL_kPSK) { char tmp_id_hint[PSK_MAX_IDENTITY_LEN+1]; param_len = 2; if (param_len > n) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } n2s(p,i); /* Store PSK identity hint for later use, hint is used * in ssl3_send_client_key_exchange. Assume that the * maximum length of a PSK identity hint can be as * long as the maximum length of a PSK identity. */ if (i > PSK_MAX_IDENTITY_LEN) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_DATA_LENGTH_TOO_LONG); goto f_err; } if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_BAD_PSK_IDENTITY_HINT_LENGTH); goto f_err; } param_len += i; /* If received PSK identity hint contains NULL * characters, the hint is truncated from the first * NULL. p may not be ending with NULL, so create a * NULL-terminated string. */ memcpy(tmp_id_hint, p, i); memset(tmp_id_hint+i, 0, PSK_MAX_IDENTITY_LEN+1-i); if (s->ctx->psk_identity_hint != NULL) OPENSSL_free(s->ctx->psk_identity_hint); s->ctx->psk_identity_hint = BUF_strdup(tmp_id_hint); if (s->ctx->psk_identity_hint == NULL) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto f_err; } p+=i; n-=param_len; } else #endif /* !OPENSSL_NO_PSK */ #ifndef OPENSSL_NO_SRP if (alg_k & SSL_kSRP) { param_len = 2; if (param_len > n) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } n2s(p,i); if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_N_LENGTH); goto f_err; } param_len += i; if (!(s->srp_ctx.N=BN_bin2bn(p,i,NULL))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; if (2 > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } param_len += 2; n2s(p,i); if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_G_LENGTH); goto f_err; } param_len += i; if (!(s->srp_ctx.g=BN_bin2bn(p,i,NULL))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; if (1 > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } param_len += 1; i = (unsigned int)(p[0]); p++; if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_S_LENGTH); goto f_err; } param_len += i; if (!(s->srp_ctx.s=BN_bin2bn(p,i,NULL))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; if (2 > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } param_len += 2; n2s(p,i); if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_B_LENGTH); goto f_err; } param_len += i; if (!(s->srp_ctx.B=BN_bin2bn(p,i,NULL))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; n-=param_len; if (!srp_verify_server_param(s, &al)) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SRP_PARAMETERS); goto f_err; } /* We must check if there is a certificate */ #ifndef OPENSSL_NO_RSA if (alg_a & SSL_aRSA) pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC].x509); #else if (0) ; #endif #ifndef OPENSSL_NO_DSA else if (alg_a & SSL_aDSS) pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_DSA_SIGN].x509); #endif } else #endif /* !OPENSSL_NO_SRP */ #ifndef OPENSSL_NO_RSA if (alg_k & SSL_kRSA) { if ((rsa=RSA_new()) == NULL) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } param_len = 2; if (param_len > n) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } n2s(p,i); if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_RSA_MODULUS_LENGTH); goto f_err; } param_len += i; if (!(rsa->n=BN_bin2bn(p,i,rsa->n))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; if (2 > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } param_len += 2; n2s(p,i); if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_RSA_E_LENGTH); goto f_err; } param_len += i; if (!(rsa->e=BN_bin2bn(p,i,rsa->e))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; n-=param_len; /* this should be because we are using an export cipher */ if (alg_a & SSL_aRSA) pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC].x509); else { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR); goto err; } s->session->sess_cert->peer_rsa_tmp=rsa; rsa=NULL; } #else /* OPENSSL_NO_RSA */ if (0) ; #endif #ifndef OPENSSL_NO_DH else if (alg_k & SSL_kDHE) { if ((dh=DH_new()) == NULL) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_DH_LIB); goto err; } param_len = 2; if (param_len > n) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } n2s(p,i); if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_DH_P_LENGTH); goto f_err; } param_len += i; if (!(dh->p=BN_bin2bn(p,i,NULL))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; if (2 > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } param_len += 2; n2s(p,i); if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_DH_G_LENGTH); goto f_err; } param_len += i; if (!(dh->g=BN_bin2bn(p,i,NULL))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; if (2 > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } param_len += 2; n2s(p,i); if (i > n - param_len) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_DH_PUB_KEY_LENGTH); goto f_err; } param_len += i; if (!(dh->pub_key=BN_bin2bn(p,i,NULL))) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_BN_LIB); goto err; } p+=i; n-=param_len; if (!ssl_security(s, SSL_SECOP_TMP_DH, DH_security_bits(dh), 0, dh)) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_DH_KEY_TOO_SMALL); goto f_err; } #ifndef OPENSSL_NO_RSA if (alg_a & SSL_aRSA) pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC].x509); #else if (0) ; #endif #ifndef OPENSSL_NO_DSA else if (alg_a & SSL_aDSS) pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_DSA_SIGN].x509); #endif /* else anonymous DH, so no certificate or pkey. */ s->session->sess_cert->peer_dh_tmp=dh; dh=NULL; } else if ((alg_k & SSL_kDHr) || (alg_k & SSL_kDHd)) { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_TRIED_TO_USE_UNSUPPORTED_CIPHER); goto f_err; } #endif /* !OPENSSL_NO_DH */ #ifndef OPENSSL_NO_ECDH else if (alg_k & SSL_kECDHE) { EC_GROUP *ngroup; const EC_GROUP *group; if ((ecdh=EC_KEY_new()) == NULL) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } /* Extract elliptic curve parameters and the * server's ephemeral ECDH public key. * Keep accumulating lengths of various components in * param_len and make sure it never exceeds n. */ /* XXX: For now we only support named (not generic) curves * and the ECParameters in this case is just three bytes. We * also need one byte for the length of the encoded point */ param_len=4; if (param_len > n) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } /* Check curve is one of our preferences, if not server has * sent an invalid curve. ECParameters is 3 bytes. */ if (!tls1_check_curve(s, p, 3)) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_WRONG_CURVE); goto f_err; } if ((curve_nid = tls1_ec_curve_id2nid(*(p + 2))) == 0) { al=SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_UNABLE_TO_FIND_ECDH_PARAMETERS); goto f_err; } ngroup = EC_GROUP_new_by_curve_name(curve_nid); if (ngroup == NULL) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_EC_LIB); goto err; } if (EC_KEY_set_group(ecdh, ngroup) == 0) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_EC_LIB); goto err; } EC_GROUP_free(ngroup); group = EC_KEY_get0_group(ecdh); if (SSL_C_IS_EXPORT(s->s3->tmp.new_cipher) && (EC_GROUP_get_degree(group) > 163)) { al=SSL_AD_EXPORT_RESTRICTION; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_ECGROUP_TOO_LARGE_FOR_CIPHER); goto f_err; } p+=3; /* Next, get the encoded ECPoint */ if (((srvr_ecpoint = EC_POINT_new(group)) == NULL) || ((bn_ctx = BN_CTX_new()) == NULL)) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_MALLOC_FAILURE); goto err; } encoded_pt_len = *p; /* length of encoded point */ p+=1; if ((encoded_pt_len > n - param_len) || (EC_POINT_oct2point(group, srvr_ecpoint, p, encoded_pt_len, bn_ctx) == 0)) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_ECPOINT); goto f_err; } param_len += encoded_pt_len; n-=param_len; p+=encoded_pt_len; /* The ECC/TLS specification does not mention * the use of DSA to sign ECParameters in the server * key exchange message. We do support RSA and ECDSA. */ if (0) ; #ifndef OPENSSL_NO_RSA else if (alg_a & SSL_aRSA) pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC].x509); #endif #ifndef OPENSSL_NO_ECDSA else if (alg_a & SSL_aECDSA) pkey=X509_get_pubkey(s->session->sess_cert->peer_pkeys[SSL_PKEY_ECC].x509); #endif /* else anonymous ECDH, so no certificate or pkey. */ EC_KEY_set_public_key(ecdh, srvr_ecpoint); s->session->sess_cert->peer_ecdh_tmp=ecdh; ecdh=NULL; BN_CTX_free(bn_ctx); bn_ctx = NULL; EC_POINT_free(srvr_ecpoint); srvr_ecpoint = NULL; } else if (alg_k) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_UNEXPECTED_MESSAGE); goto f_err; } #endif /* !OPENSSL_NO_ECDH */ /* p points to the next byte, there are 'n' bytes left */ /* if it was signed, check the signature */ if (pkey != NULL) { if (SSL_USE_SIGALGS(s)) { int rv; if (2 > n) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } rv = tls12_check_peer_sigalg(&md, s, p, pkey); if (rv == -1) goto err; else if (rv == 0) { goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, ""USING TLSv1.2 HASH %s\n"", EVP_MD_name(md)); #endif p += 2; n -= 2; } else md = EVP_sha1(); if (2 > n) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE, SSL_R_LENGTH_TOO_SHORT); goto f_err; } n2s(p,i); n-=2; j=EVP_PKEY_size(pkey); /* Check signature length. If n is 0 then signature is empty */ if ((i != n) || (n > j) || (n <= 0)) { /* wrong packet length */ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_WRONG_SIGNATURE_LENGTH); goto f_err; } #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA && !SSL_USE_SIGALGS(s)) { int num; unsigned int size; j=0; q=md_buf; for (num=2; num > 0; num--) { EVP_MD_CTX_set_flags(&md_ctx, EVP_MD_CTX_FLAG_NON_FIPS_ALLOW); EVP_DigestInit_ex(&md_ctx,(num == 2) ?s->ctx->md5:s->ctx->sha1, NULL); EVP_DigestUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); EVP_DigestUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE); EVP_DigestUpdate(&md_ctx,param,param_len); EVP_DigestFinal_ex(&md_ctx,q,&size); q+=size; j+=size; } i=RSA_verify(NID_md5_sha1, md_buf, j, p, n, pkey->pkey.rsa); if (i < 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { /* bad signature */ al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SIGNATURE); goto f_err; } } else #endif { EVP_VerifyInit_ex(&md_ctx, md, NULL); EVP_VerifyUpdate(&md_ctx,&(s->s3->client_random[0]),SSL3_RANDOM_SIZE); EVP_VerifyUpdate(&md_ctx,&(s->s3->server_random[0]),SSL3_RANDOM_SIZE); EVP_VerifyUpdate(&md_ctx,param,param_len); if (EVP_VerifyFinal(&md_ctx,p,(int)n,pkey) <= 0) { /* bad signature */ al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_BAD_SIGNATURE); goto f_err; } } } else { /* aNULL, aSRP or kPSK do not need public keys */ if (!(alg_a & (SSL_aNULL|SSL_aSRP)) && !(alg_k & SSL_kPSK)) { /* Might be wrong key type, check it */ if (ssl3_check_cert_and_algorithm(s)) /* Otherwise this shouldn't happen */ SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,ERR_R_INTERNAL_ERROR); goto err; } /* still data left over */ if (n != 0) { SSLerr(SSL_F_SSL3_GET_KEY_EXCHANGE,SSL_R_EXTRA_DATA_IN_MESSAGE); goto f_err; } } EVP_PKEY_free(pkey); EVP_MD_CTX_cleanup(&md_ctx); return(1); f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); err: EVP_PKEY_free(pkey); #ifndef OPENSSL_NO_RSA if (rsa != NULL) RSA_free(rsa); #endif #ifndef OPENSSL_NO_DH if (dh != NULL) DH_free(dh); #endif #ifndef OPENSSL_NO_ECDH BN_CTX_free(bn_ctx); EC_POINT_free(srvr_ecpoint); if (ecdh != NULL) EC_KEY_free(ecdh); #endif EVP_MD_CTX_cleanup(&md_ctx); return(-1); } ",1 "ZEND_API int ZEND_FASTCALL zend_hash_get_current_key_type_ex(HashTable *ht, HashPosition *pos) { uint32_t idx = *pos; Bucket *p; IS_CONSISTENT(ht); if (idx != HT_INVALID_IDX) { p = ht->arData + idx; if (p->key) { return HASH_KEY_IS_STRING; } else { return HASH_KEY_IS_LONG; } } return HASH_KEY_NON_EXISTENT; } ",0 "void SecureProxyChecker::OnURLLoaderRedirect( const net::RedirectInfo& redirect_info, const network::ResourceResponseHead& response_head, std::vector* to_be_removed_headers) { OnURLLoadCompleteOrRedirect(std::string(), net::ERR_ABORTED, redirect_info.status_code); } ",0 "void WebRuntimeFeatures::EnableAdTagging(bool enable) { RuntimeEnabledFeatures::SetAdTaggingEnabled(enable); } ",0 "static void mark_stack_slot_read(struct bpf_verifier_env *env, const struct bpf_verifier_state *state, struct bpf_verifier_state *parent, int slot, int frameno) { bool writes = parent == state->parent; /* Observe write marks */ while (parent) { if (parent->frame[frameno]->allocated_stack <= slot * BPF_REG_SIZE) /* since LIVE_WRITTEN mark is only done for full 8-byte * write the read marks are conservative and parent * state may not even have the stack allocated. In such case * end the propagation, since the loop reached beginning * of the function */ break; /* if read wasn't screened by an earlier write ... */ if (writes && state->frame[frameno]->stack[slot].spilled_ptr.live & REG_LIVE_WRITTEN) break; /* ... then we depend on parent's value */ parent->frame[frameno]->stack[slot].spilled_ptr.live |= REG_LIVE_READ; state = parent; parent = state->parent; writes = true; } } ",0 "void RenderWidgetHostViewAura::InitAsChild( gfx::NativeView parent_view) { window_->Init(ui::LAYER_TEXTURED); window_->SetName(""RenderWidgetHostViewAura""); } ",0 "void XMLTokenizer::stopParsing() { Tokenizer::stopParsing(); xmlStopParser(m_context); } ",0 "bt_status_t btif_set_remote_device_property(bt_bdaddr_t *remote_addr, const bt_property_t *property) { btif_storage_req_t req; if (!btif_is_enabled()) return BT_STATUS_NOT_READY; memcpy(&(req.write_req.bd_addr), remote_addr, sizeof(bt_bdaddr_t)); memcpy(&(req.write_req.prop), property, sizeof(bt_property_t)); return btif_transfer_context(execute_storage_remote_request, BTIF_CORE_STORAGE_REMOTE_WRITE, (char*)&req, sizeof(btif_storage_req_t)+property->len, btif_in_storage_request_copy_cb); } ",0 "cleanup_exit(int i) { cleanup_socket(); _exit(i); } ",0 "void zend_unset_timeout(void) /* {{{ */ { #ifdef ZEND_WIN32 if (NULL != tq_timer) { if (!DeleteTimerQueueTimer(NULL, tq_timer, NULL)) { EG(timed_out) = 0; tq_timer = NULL; zend_error_noreturn(E_ERROR, ""Could not delete queued timer""); return; } tq_timer = NULL; } EG(timed_out) = 0; #else # ifdef HAVE_SETITIMER if (EG(timeout_seconds)) { struct itimerval no_timeout; no_timeout.it_value.tv_sec = no_timeout.it_value.tv_usec = no_timeout.it_interval.tv_sec = no_timeout.it_interval.tv_usec = 0; #ifdef __CYGWIN__ setitimer(ITIMER_REAL, &no_timeout, NULL); #else setitimer(ITIMER_PROF, &no_timeout, NULL); #endif } # endif #endif } /* }}} */ ",0 "int _gnutls_user_hello_func( gnutls_session session, gnutls_protocol_t adv_version) { int ret; if (session->internals.user_hello_func != NULL) { ret = session->internals.user_hello_func( session); if (ret < 0) { gnutls_assert(); return ret; } /* Here we need to renegotiate the version since the callee might * have disabled some TLS versions. */ ret = _gnutls_negotiate_version( session, adv_version); if (ret < 0) { gnutls_assert(); return ret; } } return 0; } ",0 "void ContainerNode::cloneChildNodes(ContainerNode *clone) { TrackExceptionState es; for (Node* n = firstChild(); n && !es.hadException(); n = n->nextSibling()) clone->appendChild(n->cloneNode(true), es); } ",0 "TIFFNumberOfStrips(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; uint32 nstrips; /* If the value was already computed and store in td_nstrips, then return it, since ChopUpSingleUncompressedStrip might have altered and resized the since the td_stripbytecount and td_stripoffset arrays to the new value after the initial affectation of td_nstrips = TIFFNumberOfStrips() in tif_dirread.c ~line 3612. See http://bugzilla.maptools.org/show_bug.cgi?id=2587 */ if( td->td_nstrips ) return td->td_nstrips; nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 : TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip)); if (td->td_planarconfig == PLANARCONFIG_SEPARATE) nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel, ""TIFFNumberOfStrips""); return (nstrips); } ",1 "void wake_q_add(struct wake_q_head *head, struct task_struct *task) { struct wake_q_node *node = &task->wake_q; /* * Atomically grab the task, if ->wake_q is !nil already it means * its already queued (either by us or someone else) and will get the * wakeup due to that. * * This cmpxchg() implies a full barrier, which pairs with the write * barrier implied by the wakeup in wake_up_q(). */ if (cmpxchg(&node->next, NULL, WAKE_Q_TAIL)) return; get_task_struct(task); /* * The head is context local, there can be no concurrency. */ *head->lastp = node; head->lastp = &node->next; } ",0 "void HTMLMediaElement::DidMoveToNewDocument(Document& old_document) { BLINK_MEDIA_LOG << ""didMoveToNewDocument("" << (void*)this << "")""; load_timer_.MoveToNewTaskRunner( GetDocument().GetTaskRunner(TaskType::kInternalMedia)); progress_event_timer_.MoveToNewTaskRunner( GetDocument().GetTaskRunner(TaskType::kInternalMedia)); playback_progress_timer_.MoveToNewTaskRunner( GetDocument().GetTaskRunner(TaskType::kInternalMedia)); audio_tracks_timer_.MoveToNewTaskRunner( GetDocument().GetTaskRunner(TaskType::kInternalMedia)); check_viewport_intersection_timer_.MoveToNewTaskRunner( GetDocument().GetTaskRunner(TaskType::kInternalMedia)); deferred_load_timer_.MoveToNewTaskRunner( GetDocument().GetTaskRunner(TaskType::kInternalMedia)); removed_from_document_timer_.MoveToNewTaskRunner( GetDocument().GetTaskRunner(TaskType::kInternalMedia)); autoplay_policy_->DidMoveToNewDocument(old_document); if (should_delay_load_event_) { GetDocument().IncrementLoadEventDelayCount(); } else { old_document.IncrementLoadEventDelayCount(); } RemoveElementFromDocumentMap(this, &old_document); AddElementToDocumentMap(this, &GetDocument()); ignore_preload_none_ = false; InvokeLoadAlgorithm(); old_document.DecrementLoadEventDelayCount(); PausableObject::DidMoveToNewExecutionContext(&GetDocument()); HTMLElement::DidMoveToNewDocument(old_document); } ",0 "void InspectorController::drawHighlight(GraphicsContext& context) const { m_overlay->paint(context); } ",0 " WarmingObserver() { NetworkLibrary *netlib = CrosLibrary::Get()->GetNetworkLibrary(); netlib->AddNetworkManagerObserver(this); } ",0 "void NavigationControllerImpl::Reload(bool check_for_repost) { ReloadInternal(check_for_repost, RELOAD); } ",0 "static int vmx_set_cr4(struct kvm_vcpu *vcpu, unsigned long cr4) { /* * Pass through host's Machine Check Enable value to hw_cr4, which * is in force while we are in guest mode. Do not let guests control * this bit, even if host CR4.MCE == 0. */ unsigned long hw_cr4; hw_cr4 = (cr4_read_shadow() & X86_CR4_MCE) | (cr4 & ~X86_CR4_MCE); if (enable_unrestricted_guest) hw_cr4 |= KVM_VM_CR4_ALWAYS_ON_UNRESTRICTED_GUEST; else if (to_vmx(vcpu)->rmode.vm86_active) hw_cr4 |= KVM_RMODE_VM_CR4_ALWAYS_ON; else hw_cr4 |= KVM_PMODE_VM_CR4_ALWAYS_ON; if (!boot_cpu_has(X86_FEATURE_UMIP) && vmx_umip_emulated()) { if (cr4 & X86_CR4_UMIP) { vmcs_set_bits(SECONDARY_VM_EXEC_CONTROL, SECONDARY_EXEC_DESC); hw_cr4 &= ~X86_CR4_UMIP; } else if (!is_guest_mode(vcpu) || !nested_cpu_has2(get_vmcs12(vcpu), SECONDARY_EXEC_DESC)) vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL, SECONDARY_EXEC_DESC); } if (cr4 & X86_CR4_VMXE) { /* * To use VMXON (and later other VMX instructions), a guest * must first be able to turn on cr4.VMXE (see handle_vmon()). * So basically the check on whether to allow nested VMX * is here. */ if (!nested_vmx_allowed(vcpu)) return 1; } if (to_vmx(vcpu)->nested.vmxon && !nested_cr4_valid(vcpu, cr4)) return 1; vcpu->arch.cr4 = cr4; if (!enable_unrestricted_guest) { if (enable_ept) { if (!is_paging(vcpu)) { hw_cr4 &= ~X86_CR4_PAE; hw_cr4 |= X86_CR4_PSE; } else if (!(cr4 & X86_CR4_PAE)) { hw_cr4 &= ~X86_CR4_PAE; } } /* * SMEP/SMAP/PKU is disabled if CPU is in non-paging mode in * hardware. To emulate this behavior, SMEP/SMAP/PKU needs * to be manually disabled when guest switches to non-paging * mode. * * If !enable_unrestricted_guest, the CPU is always running * with CR0.PG=1 and CR4 needs to be modified. * If enable_unrestricted_guest, the CPU automatically * disables SMEP/SMAP/PKU when the guest sets CR0.PG=0. */ if (!is_paging(vcpu)) hw_cr4 &= ~(X86_CR4_SMEP | X86_CR4_SMAP | X86_CR4_PKE); } vmcs_writel(CR4_READ_SHADOW, cr4); vmcs_writel(GUEST_CR4, hw_cr4); return 0; } ",0 "bool Block::IsInvisible() const { return bool(int(m_flags & 0x08) != 0); } ",1 "void Com_StartupVariable( const char *match ) { int i; char *s; for ( i = 0 ; i < com_numConsoleLines ; i++ ) { Cmd_TokenizeString( com_consoleLines[i] ); if ( strcmp( Cmd_Argv( 0 ), ""set"" ) ) { continue; } s = Cmd_Argv( 1 ); if(!match || !strcmp(s, match)) { if(Cvar_Flags(s) == CVAR_NONEXISTENT) Cvar_Get(s, Cmd_ArgsFrom(2), CVAR_USER_CREATED); else Cvar_Set2(s, Cmd_ArgsFrom(2), qfalse); } } } ",0 "static int sigignore(int sig) { struct sigaction sa = { .sa_handler = SIG_IGN, .sa_flags = 0 }; if (sigemptyset(&sa.sa_mask) == -1 || sigaction(sig, &sa, 0) == -1) { return -1; } return 0; } ",0 "gc_interval_ratio_set(mrb_state *mrb, mrb_value obj) { mrb_int ratio; mrb_get_args(mrb, ""i"", &ratio); mrb->gc.interval_ratio = ratio; return mrb_nil_value(); } ",0 " void SetEnabled(bool enabled) { controller_->SetEnabled(ImmersiveFullscreenController::WINDOW_TYPE_OTHER, enabled); } ",0 "gdImagePtr gdImageCreateFromGd2Part (FILE * inFile, int srcx, int srcy, int w, int h) { gdImagePtr im; gdIOCtx *in = gdNewFileCtx(inFile); im = gdImageCreateFromGd2PartCtx(in, srcx, srcy, w, h); in->gd_free(in); return im; } ",0 "IDNSpoofChecker::IDNSpoofChecker() { UErrorCode status = U_ZERO_ERROR; checker_ = uspoof_open(&status); if (U_FAILURE(status)) { checker_ = nullptr; return; } uspoof_setRestrictionLevel(checker_, USPOOF_HIGHLY_RESTRICTIVE); SetAllowedUnicodeSet(&status); int32_t checks = uspoof_getChecks(checker_, &status) | USPOOF_AUX_INFO; uspoof_setChecks(checker_, checks, &status); deviation_characters_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[\\u00df\\u03c2\\u200c\\u200d]""), status); deviation_characters_.freeze(); non_ascii_latin_letters_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[[:Latin:] - [a-zA-Z]]""), status); non_ascii_latin_letters_.freeze(); kana_letters_exceptions_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[\\u3078-\\u307a\\u30d8-\\u30da\\u30fb-\\u30fe]""), status); kana_letters_exceptions_.freeze(); combining_diacritics_exceptions_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[\\u0300-\\u0339]""), status); combining_diacritics_exceptions_.freeze(); cyrillic_letters_latin_alike_ = icu::UnicodeSet( icu::UnicodeString::fromUTF8(""[асԁеһіјӏорԗԛѕԝхуъЬҽпгѵѡ]""), status); cyrillic_letters_latin_alike_.freeze(); cyrillic_letters_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[[:Cyrl:]]""), status); cyrillic_letters_.freeze(); DCHECK(U_SUCCESS(status)); lgc_letters_n_ascii_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[[:Latin:][:Greek:][:Cyrillic:][0-9\\u002e_"" ""\\u002d][\\u0300-\\u0339]]""), status); lgc_letters_n_ascii_.freeze(); UParseError parse_error; diacritic_remover_.reset(icu::Transliterator::createFromRules( UNICODE_STRING_SIMPLE(""DropAcc""), icu::UnicodeString::fromUTF8(""::NFD; ::[:Nonspacing Mark:] Remove; ::NFC;"" "" ł > l; ø > o; đ > d;""), UTRANS_FORWARD, parse_error, status)); extra_confusable_mapper_.reset(icu::Transliterator::createFromRules( UNICODE_STRING_SIMPLE(""ExtraConf""), icu::UnicodeString::fromUTF8( ""[æӕ] > ae; [þϼҏ] > p; [ħнћңҥӈӊԋԧԩ] > h;"" ""[ĸκкқҝҟҡӄԟ] > k; [ŋпԥก] > n; œ > ce;"" ""[ŧтҭԏ] > t; [ƅьҍв] > b; [ωшщพฟພຟ] > w;"" ""[мӎ] > m; [єҽҿၔ] > e; ґ > r; [ғӻ] > f;"" ""[ҫင] > c; ұ > y; [χҳӽӿ] > x;"" ""ԃ > d; [ԍဌ] > g; [ടรຣຮ] > s; ၂ > j;"" ""[०০੦૦ଠ୦೦] > o;"" ""[৭੧૧] > q;"" ""[บບ] > u;"" ""[२২੨੨૨೩೭] > 2;"" ""[зҙӡउওਤ੩૩౩ဒვპ] > 3;"" ""[੫] > 4;"" ""[৪੪୫] > 8;"" ""[૭୨౨] > 9;"" ), UTRANS_FORWARD, parse_error, status)); DCHECK(U_SUCCESS(status)) << ""Spoofchecker initalization failed due to an error: "" << u_errorName(status); } ",0 "dissect_spoolss_relstr(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep, int hf_index, int struct_start, char **data) { proto_item *item; proto_tree *subtree; guint32 relstr_offset, relstr_start, relstr_end; char *text; /* Peek ahead to read the string. We need this for the proto_tree_add_string() call so filtering will work. */ offset = dissect_ndr_uint32( tvb, offset, pinfo, NULL, di, drep, hf_offset, &relstr_offset); relstr_start = relstr_offset + struct_start; if (relstr_offset) { relstr_end = dissect_spoolss_uint16uni( tvb, relstr_start, pinfo, NULL, drep, &text, hf_relative_string); } else { /* relstr_offset == 0 is a NULL string */ text = g_strdup(""""); relstr_end = relstr_start; } /* OK now add the proto item with the string value */ item = proto_tree_add_string(tree, hf_index, tvb, relstr_start, relstr_end - relstr_start, text); subtree = proto_item_add_subtree(item, ett_RELSTR); dissect_ndr_uint32( tvb, offset - 4, pinfo, subtree, di, drep, hf_offset, NULL); if (relstr_offset) dissect_spoolss_uint16uni( tvb, relstr_start, pinfo, subtree, drep, NULL, hf_relative_string); if (data) *data = text; else g_free(text); return offset; } ",0 "static void uvesafb_vbe_getstatesize(struct uvesafb_ktask *task, struct uvesafb_par *par) { int err; uvesafb_reset(task); /* * Get the VBE state buffer size. We want all available * hardware state data (CL = 0x0f). */ task->t.regs.eax = 0x4f04; task->t.regs.ecx = 0x000f; task->t.regs.edx = 0x0000; task->t.flags = 0; err = uvesafb_exec(task); if (err || (task->t.regs.eax & 0xffff) != 0x004f) { pr_warn(""VBE state buffer size cannot be determined (eax=0x%x, err=%d)\n"", task->t.regs.eax, err); par->vbe_state_size = 0; return; } par->vbe_state_size = 64 * (task->t.regs.ebx & 0xffff); } ",0 "hx_pass_prompter(void *data, const hx509_prompt *prompter) { krb5_error_code ret; krb5_prompt prompt; krb5_data password_data; struct prompter *p = data; password_data.data = prompter->reply.data; password_data.length = prompter->reply.length; prompt.prompt = prompter->prompt; prompt.hidden = hx509_prompt_hidden(prompter->type); prompt.reply = &password_data; switch (prompter->type) { case HX509_PROMPT_TYPE_INFO: prompt.type = KRB5_PROMPT_TYPE_INFO; break; case HX509_PROMPT_TYPE_PASSWORD: case HX509_PROMPT_TYPE_QUESTION: default: prompt.type = KRB5_PROMPT_TYPE_PASSWORD; break; } ret = (*p->prompter)(p->context, p->prompter_data, NULL, NULL, 1, &prompt); if (ret) { memset (prompter->reply.data, 0, prompter->reply.length); return 1; } return 0; } ",0 " gray_cubic_to( const FT_Vector* control1, const FT_Vector* control2, const FT_Vector* to, PWorker worker ) { gray_render_cubic( RAS_VAR_ control1, control2, to ); return 0; } ",0 "static void TimeCodeToString(const size_t timestamp,char *code) { #define TimeFields 7 unsigned int shift; register ssize_t i; *code='\0'; shift=4*TimeFields; for (i=0; i <= TimeFields; i++) { (void) FormatLocaleString(code,MaxTextExtent-strlen(code),""%x"", (unsigned int) ((timestamp >> shift) & 0x0fU)); code++; if (((i % 2) != 0) && (i < TimeFields)) *code++=':'; shift-=4; *code='\0'; } } ",0 "int ceph_encrypt2(struct ceph_crypto_key *secret, void *dst, size_t *dst_len, const void *src1, size_t src1_len, const void *src2, size_t src2_len) { switch (secret->type) { case CEPH_CRYPTO_NONE: if (*dst_len < src1_len + src2_len) return -ERANGE; memcpy(dst, src1, src1_len); memcpy(dst + src1_len, src2, src2_len); *dst_len = src1_len + src2_len; return 0; case CEPH_CRYPTO_AES: return ceph_aes_encrypt2(secret->key, secret->len, dst, dst_len, src1, src1_len, src2, src2_len); default: return -EINVAL; } } ",0 "void SyncBackendHost::Core::OnSyncCycleCompleted( const SyncSessionSnapshot* snapshot) { host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &Core::HandleSyncCycleCompletedOnFrontendLoop, new SyncSessionSnapshot(*snapshot))); } ",0 "LayoutRect RenderBox::clipRect(const LayoutPoint& location) { LayoutRect borderBoxRect = this->borderBoxRect(); LayoutRect clipRect = LayoutRect(borderBoxRect.location() + location, borderBoxRect.size()); if (!style()->clipLeft().isAuto()) { LayoutUnit c = valueForLength(style()->clipLeft(), borderBoxRect.width()); clipRect.move(c, 0); clipRect.contract(c, 0); } if (!style()->clipRight().isAuto()) clipRect.contract(width() - valueForLength(style()->clipRight(), width()), 0); if (!style()->clipTop().isAuto()) { LayoutUnit c = valueForLength(style()->clipTop(), borderBoxRect.height()); clipRect.move(0, c); clipRect.contract(0, c); } if (!style()->clipBottom().isAuto()) clipRect.contract(0, height() - valueForLength(style()->clipBottom(), height())); return clipRect; } ",0 "void PasswordAccessoryControllerImpl::OnFillingTriggered( bool is_password, const base::string16& text_to_fill) { password_manager::ContentPasswordManagerDriverFactory* factory = password_manager::ContentPasswordManagerDriverFactory::FromWebContents( web_contents_); DCHECK(factory); password_manager::ContentPasswordManagerDriver* driver = factory->GetDriverForFrame(web_contents_->GetMainFrame()); if (!driver) { return; } // |driver| can be NULL if the tab is being closed. driver->FillIntoFocusedField( is_password, text_to_fill, base::BindOnce(&PasswordAccessoryControllerImpl::OnFilledIntoFocusedField, base::AsWeakPtr(this))); } ",0 "void FileReaderLoader::Failed(FileError::ErrorCode error_code) { if (error_code_ != FileError::kOK) return; error_code_ = error_code; Cleanup(); if (client_) client_->DidFail(error_code_); } ",0 "vc4_reset(struct drm_device *dev) { struct vc4_dev *vc4 = to_vc4_dev(dev); DRM_INFO(""Resetting GPU.\n""); mutex_lock(&vc4->power_lock); if (vc4->power_refcount) { /* Power the device off and back on the by dropping the * reference on runtime PM. */ pm_runtime_put_sync_suspend(&vc4->v3d->pdev->dev); pm_runtime_get_sync(&vc4->v3d->pdev->dev); } mutex_unlock(&vc4->power_lock); vc4_irq_reset(dev); /* Rearm the hangcheck -- another job might have been waiting * for our hung one to get kicked off, and vc4_irq_reset() * would have started it. */ vc4_queue_hangcheck(dev); } ",0 " void PartialMagnificationController::OnWidgetDestroying(views::Widget* widget) { DCHECK_EQ(widget, zoom_widget_); RemoveZoomWidgetObservers(); zoom_widget_ = NULL; } ",1 "static void dccp_v4_ctl_send_reset(struct sock *sk, struct sk_buff *rxskb) { int err; const struct iphdr *rxiph; struct sk_buff *skb; struct dst_entry *dst; struct net *net = dev_net(skb_dst(rxskb)->dev); struct sock *ctl_sk = net->dccp.v4_ctl_sk; /* Never send a reset in response to a reset. */ if (dccp_hdr(rxskb)->dccph_type == DCCP_PKT_RESET) return; if (skb_rtable(rxskb)->rt_type != RTN_LOCAL) return; dst = dccp_v4_route_skb(net, ctl_sk, rxskb); if (dst == NULL) return; skb = dccp_ctl_make_reset(ctl_sk, rxskb); if (skb == NULL) goto out; rxiph = ip_hdr(rxskb); dccp_hdr(skb)->dccph_checksum = dccp_v4_csum_finish(skb, rxiph->saddr, rxiph->daddr); skb_dst_set(skb, dst_clone(dst)); bh_lock_sock(ctl_sk); err = ip_build_and_send_pkt(skb, ctl_sk, rxiph->daddr, rxiph->saddr, NULL); bh_unlock_sock(ctl_sk); if (net_xmit_eval(err) == 0) { DCCP_INC_STATS_BH(DCCP_MIB_OUTSEGS); DCCP_INC_STATS_BH(DCCP_MIB_OUTRSTS); } out: dst_release(dst); } ",0 "void AppCacheUpdateJob::ClearPendingMasterEntries() { for (auto& pair : pending_master_entries_) { PendingHosts& hosts = pair.second; for (AppCacheHost* host : hosts) host->RemoveObserver(this); } pending_master_entries_.clear(); } ",0 "static DoublePixelPacket **DestroyPixelThreadSet(DoublePixelPacket **pixels) { register ssize_t i; assert(pixels != (DoublePixelPacket **) NULL); for (i=0; i < (ssize_t) GetMagickResourceLimit(ThreadResource); i++) if (pixels[i] != (DoublePixelPacket *) NULL) pixels[i]=(DoublePixelPacket *) RelinquishMagickMemory(pixels[i]); pixels=(DoublePixelPacket **) RelinquishMagickMemory(pixels); return(pixels); } ",0 "int ip6_xmit(const struct sock *sk, struct sk_buff *skb, struct flowi6 *fl6, __u32 mark, struct ipv6_txoptions *opt, int tclass) { struct net *net = sock_net(sk); const struct ipv6_pinfo *np = inet6_sk(sk); struct in6_addr *first_hop = &fl6->daddr; struct dst_entry *dst = skb_dst(skb); struct ipv6hdr *hdr; u8 proto = fl6->flowi6_proto; int seg_len = skb->len; int hlimit = -1; u32 mtu; if (opt) { unsigned int head_room; /* First: exthdrs may take lots of space (~8K for now) MAX_HEADER is not enough. */ head_room = opt->opt_nflen + opt->opt_flen; seg_len += head_room; head_room += sizeof(struct ipv6hdr) + LL_RESERVED_SPACE(dst->dev); if (skb_headroom(skb) < head_room) { struct sk_buff *skb2 = skb_realloc_headroom(skb, head_room); if (!skb2) { IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_OUTDISCARDS); kfree_skb(skb); return -ENOBUFS; } consume_skb(skb); skb = skb2; /* skb_set_owner_w() changes sk->sk_wmem_alloc atomically, * it is safe to call in our context (socket lock not held) */ skb_set_owner_w(skb, (struct sock *)sk); } if (opt->opt_flen) ipv6_push_frag_opts(skb, opt, &proto); if (opt->opt_nflen) ipv6_push_nfrag_opts(skb, opt, &proto, &first_hop, &fl6->saddr); } skb_push(skb, sizeof(struct ipv6hdr)); skb_reset_network_header(skb); hdr = ipv6_hdr(skb); /* * Fill in the IPv6 header */ if (np) hlimit = np->hop_limit; if (hlimit < 0) hlimit = ip6_dst_hoplimit(dst); ip6_flow_hdr(hdr, tclass, ip6_make_flowlabel(net, skb, fl6->flowlabel, np->autoflowlabel, fl6)); hdr->payload_len = htons(seg_len); hdr->nexthdr = proto; hdr->hop_limit = hlimit; hdr->saddr = fl6->saddr; hdr->daddr = *first_hop; skb->protocol = htons(ETH_P_IPV6); skb->priority = sk->sk_priority; skb->mark = mark; mtu = dst_mtu(dst); if ((skb->len <= mtu) || skb->ignore_df || skb_is_gso(skb)) { IP6_UPD_PO_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_OUT, skb->len); /* if egress device is enslaved to an L3 master device pass the * skb to its handler for processing */ skb = l3mdev_ip6_out((struct sock *)sk, skb); if (unlikely(!skb)) return 0; /* hooks should never assume socket lock is held. * we promote our socket to non const */ return NF_HOOK(NFPROTO_IPV6, NF_INET_LOCAL_OUT, net, (struct sock *)sk, skb, NULL, dst->dev, dst_output); } skb->dev = dst->dev; /* ipv6_local_error() does not require socket lock, * we promote our socket to non const */ ipv6_local_error((struct sock *)sk, EMSGSIZE, fl6, mtu); IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS); kfree_skb(skb); return -EMSGSIZE; } ",0 "void GLES2DecoderImpl::DoLinkProgram(GLuint program_id) { TRACE_EVENT0(""gpu"", ""GLES2DecoderImpl::DoLinkProgram""); Program* program = GetProgramInfoNotShader( program_id, ""glLinkProgram""); if (!program) { return; } LogClientServiceForInfo(program, program_id, ""glLinkProgram""); if (program->Link(shader_manager(), workarounds().count_all_in_varyings_packing ? Program::kCountAll : Program::kCountOnlyStaticallyUsed, shader_cache_callback_)) { if (program == state_.current_program.get()) { if (workarounds().use_current_program_after_successful_link) glUseProgram(program->service_id()); if (workarounds().clear_uniforms_before_first_program_use) program_manager()->ClearUniforms(program); } } ExitCommandProcessingEarly(); }; ",0 "void TopSitesImpl::ResetThreadSafeCache() { base::AutoLock lock(lock_); MostVisitedURLList cached; ApplyBlacklist(cache_->top_sites(), &cached); thread_safe_cache_->SetTopSites(cached); } ",0 "void FragmentPaintPropertyTreeBuilder::UpdatePaintOffset() { const auto* enclosing_pagination_layer = full_context_.painting_layer->EnclosingPaginationLayer(); if (enclosing_pagination_layer && !context_.current.paint_offset_root->PaintingLayer() ->EnclosingPaginationLayer()) { LayoutPoint paint_offset = PaintOffsetInPaginationContainer(object_, *enclosing_pagination_layer); paint_offset.MoveBy(fragment_data_.PaginationOffset()); paint_offset.Move(context_.repeating_paint_offset_adjustment); paint_offset.MoveBy( VisualOffsetFromPaintOffsetRoot(context_, enclosing_pagination_layer)); paint_offset.MoveBy( context_.current.paint_offset_root->FirstFragment().PaintOffset()); context_.current.paint_offset = paint_offset; return; } if (object_.IsFloating()) context_.current.paint_offset = context_.paint_offset_for_float; if (object_.IsColumnSpanAll()) { context_.current.paint_offset = object_.Container()->FirstFragment().PaintOffset(); } if (object_.IsBoxModelObject()) { const LayoutBoxModelObject& box_model_object = ToLayoutBoxModelObject(object_); switch (box_model_object.StyleRef().GetPosition()) { case EPosition::kStatic: break; case EPosition::kRelative: context_.current.paint_offset += box_model_object.OffsetForInFlowPosition(); break; case EPosition::kAbsolute: { DCHECK(full_context_.container_for_absolute_position == box_model_object.Container()); context_.current = context_.absolute_position; const auto* container = full_context_.container_for_absolute_position; if (container && container->IsLayoutInline()) { DCHECK(container->CanContainAbsolutePositionObjects()); DCHECK(box_model_object.IsBox()); context_.current.paint_offset += ToLayoutInline(container)->OffsetForInFlowPositionedInline( ToLayoutBox(box_model_object)); } break; } case EPosition::kSticky: context_.current.paint_offset += box_model_object.OffsetForInFlowPosition(); break; case EPosition::kFixed: { DCHECK(full_context_.container_for_fixed_position == box_model_object.Container()); context_.current = context_.fixed_position; if (context_.fixed_position.fixed_position_children_fixed_to_root) context_.current.paint_offset_root = &box_model_object; const auto* container = full_context_.container_for_fixed_position; if (container && container->IsLayoutInline()) { DCHECK(container->CanContainFixedPositionObjects()); DCHECK(box_model_object.IsBox()); context_.current.paint_offset += ToLayoutInline(container)->OffsetForInFlowPositionedInline( ToLayoutBox(box_model_object)); } break; } default: NOTREACHED(); } } if (object_.IsBox()) { context_.current.paint_offset.MoveBy( ToLayoutBox(object_).PhysicalLocation()); if (object_.IsTableCell()) { LayoutObject* parent_row = object_.Parent(); DCHECK(parent_row && parent_row->IsTableRow()); context_.current.paint_offset.MoveBy( -ToLayoutBox(parent_row)->PhysicalLocation()); } } context_.current.paint_offset.Move( context_.repeating_paint_offset_adjustment); } ",0 "int CALLBACK WinMain(HINSTANCE instance, HINSTANCE previous_instance, LPSTR command_line, int show_command) { #ifdef OFFICIAL_BUILD if (remoting::IsUsageStatsAllowed()) { remoting::InitializeCrashReporting(); } #endif // OFFICIAL_BUILD g_hModule = instance; INITCOMMONCONTROLSEX info; info.dwSize = sizeof(info); info.dwICC = ICC_STANDARD_CLASSES; InitCommonControlsEx(&info); if (base::win::GetVersion() >= base::win::VERSION_VISTA) { FilePath path(base::GetNativeLibraryName(UTF8ToUTF16(""user32""))); base::ScopedNativeLibrary user32(path); CHECK(user32.is_valid()); typedef BOOL (WINAPI * SetProcessDPIAwareFn)(); SetProcessDPIAwareFn set_process_dpi_aware = static_cast( user32.GetFunctionPointer(""SetProcessDPIAware"")); set_process_dpi_aware(); } return main(0, NULL); } ",0 "static int atl2_get_eeprom(struct net_device *netdev, struct ethtool_eeprom *eeprom, u8 *bytes) { struct atl2_adapter *adapter = netdev_priv(netdev); struct atl2_hw *hw = &adapter->hw; u32 *eeprom_buff; int first_dword, last_dword; int ret_val = 0; int i; if (eeprom->len == 0) return -EINVAL; if (atl2_check_eeprom_exist(hw)) return -EINVAL; eeprom->magic = hw->vendor_id | (hw->device_id << 16); first_dword = eeprom->offset >> 2; last_dword = (eeprom->offset + eeprom->len - 1) >> 2; eeprom_buff = kmalloc(sizeof(u32) * (last_dword - first_dword + 1), GFP_KERNEL); if (!eeprom_buff) return -ENOMEM; for (i = first_dword; i < last_dword; i++) { if (!atl2_read_eeprom(hw, i*4, &(eeprom_buff[i-first_dword]))) { ret_val = -EIO; goto free; } } memcpy(bytes, (u8 *)eeprom_buff + (eeprom->offset & 3), eeprom->len); free: kfree(eeprom_buff); return ret_val; } ",0 " void PlatformSensorProviderAndroid::CreateRelativeOrientationEulerAnglesSensor( JNIEnv* env, mojo::ScopedSharedBufferMapping mapping, const CreateSensorCallback& callback) { if (static_cast(Java_PlatformSensorProvider_hasSensorType( env, j_object_, static_cast( mojom::SensorType::RELATIVE_ORIENTATION_QUATERNION)))) { auto sensor_fusion_algorithm = std::make_unique( false /* absolute */); PlatformSensorFusion::Create(std::move(mapping), this, std::move(sensor_fusion_algorithm), callback); } else { callback.Run(nullptr); } } ",1 "void RenderWidgetHostViewAndroid::AcceleratedSurfaceSuspend() { NOTREACHED(); } ",0 "void rds_ib_advertise_credits(struct rds_connection *conn, unsigned int posted) { struct rds_ib_connection *ic = conn->c_transport_data; if (posted == 0) return; atomic_add(IB_SET_POST_CREDITS(posted), &ic->i_credits); /* Decide whether to send an update to the peer now. * If we would send a credit update for every single buffer we * post, we would end up with an ACK storm (ACK arrives, * consumes buffer, we refill the ring, send ACK to remote * advertising the newly posted buffer... ad inf) * * Performance pretty much depends on how often we send * credit updates - too frequent updates mean lots of ACKs. * Too infrequent updates, and the peer will run out of * credits and has to throttle. * For the time being, 16 seems to be a good compromise. */ if (IB_GET_POST_CREDITS(atomic_read(&ic->i_credits)) >= 16) set_bit(IB_ACK_REQUESTED, &ic->i_ack_flags); } ",0 "static int snd_seq_ioctl_create_port(struct snd_seq_client *client, void __user *arg) { struct snd_seq_client_port *port; struct snd_seq_port_info info; struct snd_seq_port_callback *callback; if (copy_from_user(&info, arg, sizeof(info))) return -EFAULT; /* it is not allowed to create the port for an another client */ if (info.addr.client != client->number) return -EPERM; port = snd_seq_create_port(client, (info.flags & SNDRV_SEQ_PORT_FLG_GIVEN_PORT) ? info.addr.port : -1); if (port == NULL) return -ENOMEM; if (client->type == USER_CLIENT && info.kernel) { snd_seq_delete_port(client, port->addr.port); return -EINVAL; } if (client->type == KERNEL_CLIENT) { if ((callback = info.kernel) != NULL) { if (callback->owner) port->owner = callback->owner; port->private_data = callback->private_data; port->private_free = callback->private_free; port->event_input = callback->event_input; port->c_src.open = callback->subscribe; port->c_src.close = callback->unsubscribe; port->c_dest.open = callback->use; port->c_dest.close = callback->unuse; } } info.addr = port->addr; snd_seq_set_port_info(port, &info); snd_seq_system_client_ev_port_start(port->addr.client, port->addr.port); if (copy_to_user(arg, &info, sizeof(info))) return -EFAULT; return 0; } ",0 "void do_syscall_trace_leave(struct pt_regs *regs) { if ((test_thread_flag(TIF_SYSCALL_TRACE)) && (current->ptrace & PT_PTRACED)) do_syscall_trace(); } ",0 "static unsigned long get_vma_private_data(struct vm_area_struct *vma) { return (unsigned long)vma->vm_private_data; } ",0 "void MojoVideoEncodeAcceleratorService::Initialize( VideoPixelFormat input_format, const gfx::Size& input_visible_size, VideoCodecProfile output_profile, uint32_t initial_bitrate, mojom::VideoEncodeAcceleratorClientPtr client, InitializeCallback success_callback) { DVLOG(1) << __func__ << "" input_format="" << VideoPixelFormatToString(input_format) << "", input_visible_size="" << input_visible_size.ToString() << "", output_profile="" << GetProfileName(output_profile) << "", initial_bitrate="" << initial_bitrate; DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(!encoder_); DCHECK_EQ(PIXEL_FORMAT_I420, input_format) << ""Only I420 format supported""; if (!client) { DLOG(ERROR) << __func__ << ""null |client|""; std::move(success_callback).Run(false); return; } vea_client_ = std::move(client); if (input_visible_size.width() > limits::kMaxDimension || input_visible_size.height() > limits::kMaxDimension || input_visible_size.GetArea() > limits::kMaxCanvas) { DLOG(ERROR) << __func__ << ""too large input_visible_size "" << input_visible_size.ToString(); std::move(success_callback).Run(false); return; } encoder_ = create_vea_callback_.Run(input_format, input_visible_size, output_profile, initial_bitrate, this, gpu_preferences_); if (!encoder_) { DLOG(ERROR) << __func__ << "" Error creating or initializing VEA""; std::move(success_callback).Run(false); return; } std::move(success_callback).Run(true); return; } ",0 " void SynchronousCompositorOutputSurface::InvokeComposite( const gfx::Transform& transform, gfx::Rect viewport, gfx::Rect clip, gfx::Rect viewport_rect_for_tile_priority, gfx::Transform transform_for_tile_priority, bool hardware_draw) { DCHECK(!frame_holder_.get()); gfx::Transform adjusted_transform = transform; adjusted_transform.matrix().postTranslate(-viewport.x(), -viewport.y(), 0); SetExternalDrawConstraints(adjusted_transform, viewport, clip, viewport_rect_for_tile_priority, transform_for_tile_priority, !hardware_draw); if (!hardware_draw || next_hardware_draw_needs_damage_) { next_hardware_draw_needs_damage_ = false; SetNeedsRedrawRect(gfx::Rect(viewport.size())); } client_->OnDraw(); if (hardware_draw) { cached_hw_transform_ = adjusted_transform; cached_hw_viewport_ = viewport; cached_hw_clip_ = clip; cached_hw_viewport_rect_for_tile_priority_ = viewport_rect_for_tile_priority; cached_hw_transform_for_tile_priority_ = transform_for_tile_priority; } else { bool resourceless_software_draw = false; SetExternalDrawConstraints(cached_hw_transform_, cached_hw_viewport_, cached_hw_clip_, cached_hw_viewport_rect_for_tile_priority_, cached_hw_transform_for_tile_priority_, resourceless_software_draw); next_hardware_draw_needs_damage_ = true; } if (frame_holder_.get()) client_->DidSwapBuffersComplete(); } ",1 "ssize_t proc_projid_map_write(struct file *file, const char __user *buf, size_t size, loff_t *ppos) { struct seq_file *seq = file->private_data; struct user_namespace *ns = seq->private; struct user_namespace *seq_ns = seq_user_ns(seq); if (!ns->parent) return -EPERM; if ((seq_ns != ns) && (seq_ns != ns->parent)) return -EPERM; /* Anyone can set any valid project id no capability needed */ return map_write(file, buf, size, ppos, -1, &ns->projid_map, &ns->parent->projid_map); } ",0 "form_write_from_file(FILE * f, char *boundary, char *name, char *filename, char *file) { FILE *fd; struct stat st; int c; char *type; fprintf(f, ""--%s\r\n"", boundary); fprintf(f, ""Content-Disposition: form-data; name=\""%s\""; filename=\""%s\""\r\n"", name, mybasename(filename)); type = guessContentType(file); fprintf(f, ""Content-Type: %s\r\n\r\n"", type ? type : ""application/octet-stream""); if (lstat(file, &st) < 0) goto write_end; if (S_ISDIR(st.st_mode)) goto write_end; fd = fopen(file, ""r""); if (fd != NULL) { while ((c = fgetc(fd)) != EOF) fputc(c, f); fclose(fd); } write_end: fprintf(f, ""\r\n""); } ",0 "bool RenderLayerCompositor::supportsFixedRootBackgroundCompositing() const { if (Settings* settings = m_renderView->document().settings()) { if (settings->acceleratedCompositingForFixedRootBackgroundEnabled()) return true; } return false; } ",0 "long long Block::GetDiscardPadding() const { return m_discard_padding; } ",0 "static unsigned readChunk_tRNS(LodePNGColorMode* color, const unsigned char* data, size_t chunkLength) { unsigned i; if(color->colortype == LCT_PALETTE) { /*error: more alpha values given than there are palette entries*/ if(chunkLength > color->palettesize) return 38; for(i = 0; i < chunkLength; i++) color->palette[4 * i + 3] = data[i]; } else if(color->colortype == LCT_GREY) { /*error: this chunk must be 2 bytes for greyscale image*/ if(chunkLength != 2) return 30; color->key_defined = 1; color->key_r = color->key_g = color->key_b = 256u * data[0] + data[1]; } else if(color->colortype == LCT_RGB) { /*error: this chunk must be 6 bytes for RGB image*/ if(chunkLength != 6) return 41; color->key_defined = 1; color->key_r = 256u * data[0] + data[1]; color->key_g = 256u * data[2] + data[3]; color->key_b = 256u * data[4] + data[5]; } else return 42; /*error: tRNS chunk not allowed for other color models*/ return 0; /* OK */ } ",0 "static bool fanout_flow_is_huge(struct packet_sock *po, struct sk_buff *skb) { u32 rxhash; int i, count = 0; rxhash = skb_get_hash(skb); for (i = 0; i < ROLLOVER_HLEN; i++) if (po->rollover->history[i] == rxhash) count++; po->rollover->history[prandom_u32() % ROLLOVER_HLEN] = rxhash; return count > (ROLLOVER_HLEN >> 1); } ",0 "static void rtc_status_pending_eoi_check_valid(struct kvm_ioapic *ioapic) { if (WARN_ON(ioapic->rtc_status.pending_eoi < 0)) kvm_rtc_eoi_tracking_restore_all(ioapic); } ",0 "std::unique_ptr PersistentHistogramAllocator::GetHistogram( Reference ref) { PersistentHistogramData* data = memory_allocator_->GetAsObject(ref); const size_t length = memory_allocator_->GetAllocSize(ref); if (!data || data->name[0] == '\0' || reinterpret_cast(data)[length - 1] != '\0' || data->samples_metadata.id == 0 || data->logged_metadata.id == 0 || (data->logged_metadata.id != data->samples_metadata.id && data->logged_metadata.id != data->samples_metadata.id + 1) || HashMetricName(data->name) != data->samples_metadata.id) { RecordCreateHistogramResult(CREATE_HISTOGRAM_INVALID_METADATA); NOTREACHED(); return nullptr; } return CreateHistogram(data); } ",1 "void _WM_do_meta_tempo(struct _mdi *mdi, struct _event_data *data) { /* placeholder function so we can record tempo in the event stream * for conversion function _WM_Event2Midi */ #ifdef DEBUG_MIDI uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__, ch, data->data.value); #else UNUSED(data); #endif UNUSED(mdi); return; } ",0 "static void simple_fill_buf(struct urb *urb) { unsigned i; u8 *buf = urb->transfer_buffer; unsigned len = urb->transfer_buffer_length; unsigned maxpacket; switch (pattern) { default: /* FALLTHROUGH */ case 0: memset(buf, 0, len); break; case 1: /* mod63 */ maxpacket = get_maxpacket(urb->dev, urb->pipe); for (i = 0; i < len; i++) *buf++ = (u8) ((i % maxpacket) % 63); break; } } ",0 "fep_client_get_poll_fd (FepClient *client) { return client->control; } ",0 "int ssl_fetch_input( ssl_context *ssl, size_t nb_want ) { int ret; size_t len; SSL_DEBUG_MSG( 2, ( ""=> fetch input"" ) ); while( ssl->in_left < nb_want ) { len = nb_want - ssl->in_left; ret = ssl->f_recv( ssl->p_recv, ssl->in_hdr + ssl->in_left, len ); SSL_DEBUG_MSG( 2, ( ""in_left: %d, nb_want: %d"", ssl->in_left, nb_want ) ); SSL_DEBUG_RET( 2, ""ssl->f_recv"", ret ); if( ret == 0 ) return( POLARSSL_ERR_SSL_CONN_EOF ); if( ret < 0 ) return( ret ); ssl->in_left += ret; } SSL_DEBUG_MSG( 2, ( ""<= fetch input"" ) ); return( 0 ); } ",0 "int crypto_register_alg(struct crypto_alg *alg) { struct crypto_larval *larval; int err; err = crypto_check_alg(alg); if (err) return err; down_write(&crypto_alg_sem); larval = __crypto_register_alg(alg); up_write(&crypto_alg_sem); if (IS_ERR(larval)) return PTR_ERR(larval); crypto_wait_for_test(larval); return 0; } ",0 "void Com_RandomBytes( byte *string, int len ) { int i; if( Sys_RandomBytes( string, len ) ) return; Com_Printf( ""Com_RandomBytes: using weak randomization\n"" ); for( i = 0; i < len; i++ ) string[i] = (unsigned char)( rand() % 256 ); } ",0 " SitePerProcessProgrammaticScrollTest() : kInfinity(1000000U), kPositiveXYPlane(0, 0, kInfinity, kInfinity) {} ",0 "int acpi_os_map_generic_address(struct acpi_generic_address *gas) { u64 addr; void __iomem *virt; if (gas->space_id != ACPI_ADR_SPACE_SYSTEM_MEMORY) return 0; /* Handle possible alignment issues */ memcpy(&addr, &gas->address, sizeof(addr)); if (!addr || !gas->bit_width) return -EINVAL; virt = acpi_os_map_iomem(addr, gas->bit_width / 8); if (!virt) return -EIO; return 0; } ",0 "pvscsi_on_cmd_adapter_reset(PVSCSIState *s) { trace_pvscsi_on_cmd_arrived(""PVSCSI_CMD_ADAPTER_RESET""); pvscsi_reset_adapter(s); return PVSCSI_COMMAND_PROCESSING_SUCCEEDED; } ",0 "v8::Handle V8TestObj::constructorCallback(const v8::Arguments& args) { INC_STATS(""DOM.TestObj.Constructor""); if (!args.IsConstructCall()) return V8Proxy::throwTypeError(""DOM object constructor cannot be called as a function.""); if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) return args.Holder(); if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(); if (args.Length() <= 0 || !args[0]->IsFunction()) return throwError(TYPE_MISMATCH_ERR, args.GetIsolate()); RefPtr testCallback = V8TestCallback::create(args[0], getScriptExecutionContext()); RefPtr impl = TestObj::create(testCallback); v8::Handle wrapper = args.Holder(); V8DOMWrapper::setDOMWrapper(wrapper, &info, impl.get()); V8DOMWrapper::setJSWrapperForDOMObject(impl.release(), v8::Persistent::New(wrapper), args.GetIsolate()); return args.Holder(); } ",1 "net::NetworkIsolationKey CreateNetworkIsolationKey(const GURL& main_frame_url) { url::Origin origin = url::Origin::Create(main_frame_url); return net::NetworkIsolationKey(origin, origin); } ",0 "std::string ConvertViewIntToViewString(unsigned long view_int) { switch (view_int) { case PDFDEST_VIEW_XYZ: return ""XYZ""; case PDFDEST_VIEW_FIT: return ""Fit""; case PDFDEST_VIEW_FITH: return ""FitH""; case PDFDEST_VIEW_FITV: return ""FitV""; case PDFDEST_VIEW_FITR: return ""FitR""; case PDFDEST_VIEW_FITB: return ""FitB""; case PDFDEST_VIEW_FITBH: return ""FitBH""; case PDFDEST_VIEW_FITBV: return ""FitBV""; case PDFDEST_VIEW_UNKNOWN_MODE: return """"; default: NOTREACHED(); return """"; } } ",0 "static int perf_event_period(struct perf_event *event, u64 __user *arg) { struct perf_event_context *ctx = event->ctx; int ret = 0, active; u64 value; if (!is_sampling_event(event)) return -EINVAL; if (copy_from_user(&value, arg, sizeof(value))) return -EFAULT; if (!value) return -EINVAL; raw_spin_lock_irq(&ctx->lock); if (event->attr.freq) { if (value > sysctl_perf_event_sample_rate) { ret = -EINVAL; goto unlock; } event->attr.sample_freq = value; } else { event->attr.sample_period = value; event->hw.sample_period = value; } active = (event->state == PERF_EVENT_STATE_ACTIVE); if (active) { perf_pmu_disable(ctx->pmu); event->pmu->stop(event, PERF_EF_UPDATE); } local64_set(&event->hw.period_left, 0); if (active) { event->pmu->start(event, PERF_EF_RELOAD); perf_pmu_enable(ctx->pmu); } unlock: raw_spin_unlock_irq(&ctx->lock); return ret; } ",0 " explicit MountState(DriveFsHost* host) : host_(host), mojo_connection_delegate_( host_->delegate_->CreateMojoConnectionDelegate()), pending_token_(base::UnguessableToken::Create()), binding_(this) { source_path_ = base::StrCat({kMountScheme, pending_token_.ToString()}); std::string datadir_option = base::StrCat( {""datadir="", host_->profile_path_.Append(kDataPath) .Append(host_->delegate_->GetAccountId().GetAccountIdKey()) .value()}); chromeos::disks::DiskMountManager::GetInstance()->MountPath( source_path_, """", base::StrCat( {""drivefs-"", host_->delegate_->GetAccountId().GetAccountIdKey()}), {datadir_option}, chromeos::MOUNT_TYPE_NETWORK_STORAGE, chromeos::MOUNT_ACCESS_MODE_READ_WRITE); auto bootstrap = mojo::MakeProxy(mojo_connection_delegate_->InitializeMojoConnection()); mojom::DriveFsDelegatePtr delegate; binding_.Bind(mojo::MakeRequest(&delegate)); bootstrap->Init( {base::in_place, host_->delegate_->GetAccountId().GetUserEmail()}, mojo::MakeRequest(&drivefs_), std::move(delegate)); PendingConnectionManager::Get().ExpectOpenIpcChannel( pending_token_, base::BindOnce(&DriveFsHost::MountState::AcceptMojoConnection, base::Unretained(this))); } ",1 "status_t CameraService::getCameraInfo(int cameraId, struct CameraInfo* cameraInfo) { if (!mModule) { return -ENODEV; } if (cameraId < 0 || cameraId >= mNumberOfCameras) { return BAD_VALUE; } struct camera_info info; status_t rc = mModule->get_camera_info(cameraId, &info); cameraInfo->facing = info.facing; cameraInfo->orientation = info.orientation; return rc; } ",0 "nvmet_fc_free_tgt_pgs(struct nvmet_fc_fcp_iod *fod) { struct scatterlist *sg; int count; if (!fod->data_sg || !fod->data_sg_cnt) return; fc_dma_unmap_sg(fod->tgtport->dev, fod->data_sg, fod->data_sg_cnt, ((fod->io_dir == NVMET_FCP_WRITE) ? DMA_FROM_DEVICE : DMA_TO_DEVICE)); for_each_sg(fod->data_sg, sg, fod->data_sg_cnt, count) __free_page(sg_page(sg)); kfree(fod->data_sg); fod->data_sg = NULL; fod->data_sg_cnt = 0; } ",0 "void Con_PageDown( void ) { con.display += 2; if ( con.display > con.current ) { con.display = con.current; } } ",0 "int dom_document_format_output_read(dom_object *obj, zval **retval TSRMLS_DC) { dom_doc_propsptr doc_prop; ALLOC_ZVAL(*retval); if (obj->document) { doc_prop = dom_get_doc_props(obj->document); ZVAL_BOOL(*retval, doc_prop->formatoutput); } else { ZVAL_FALSE(*retval); } return SUCCESS; } ",0 "static png_free_ptr Magick_png_free(png_structp png_ptr,png_voidp ptr) { (void) png_ptr; ptr=RelinquishMagickMemory(ptr); return((png_free_ptr) NULL); } ",0 "static int dump_data (FILE *dumpfile, int format, char *dump_tag, unsigned char *data, uint32 count) { int j, k; uint32 i; char dump_array[10]; unsigned char bitset; if (dumpfile == NULL) { TIFFError ("""", ""Invalid FILE pointer for dump file""); return (1); } if (format == DUMP_TEXT) { fprintf (dumpfile,"" %s "", dump_tag); for (i = 0; i < count; i++) { for (j = 0, k = 7; j < 8; j++, k--) { bitset = (*(data + i)) & (((unsigned char)1 << k)) ? 1 : 0; sprintf(&dump_array[j], (bitset) ? ""1"" : ""0""); } dump_array[8] = '\0'; fprintf (dumpfile,"" %s"", dump_array); } fprintf (dumpfile,""\n""); } else { if ((fwrite (data, 1, count, dumpfile)) != count) { TIFFError ("""", ""Unable to write binary data to dump file""); return (1); } } return (0); } ",0 "int detect_ramfs_rootfs(void) { char buf[LINELEN], *p; FILE *f; int i; char *p2; f = fopen(""/proc/self/mountinfo"", ""r""); if (!f) return 0; while (fgets(buf, LINELEN, f)) { for (p = buf, i=0; p && i < 4; i++) p = strchr(p+1, ' '); if (!p) continue; p2 = strchr(p+1, ' '); if (!p2) continue; *p2 = '\0'; if (strcmp(p+1, ""/"") == 0) { p = strchr(p2+1, '-'); if (p && strncmp(p, ""- rootfs rootfs "", 16) == 0) { fclose(f); return 1; } } } fclose(f); return 0; } ",0 "skia::RefPtr PictureLayerImpl::GetPicture() { return raster_source_->GetFlattenedPicture(); } ",0 "static void vga_update_memory_access(VGACommonState *s) { hwaddr base, offset, size; if (s->legacy_address_space == NULL) { return; } if (s->has_chain4_alias) { memory_region_del_subregion(s->legacy_address_space, &s->chain4_alias); object_unparent(OBJECT(&s->chain4_alias)); s->has_chain4_alias = false; s->plane_updated = 0xf; } if ((sr(s, VGA_SEQ_PLANE_WRITE) & VGA_SR02_ALL_PLANES) == VGA_SR02_ALL_PLANES && sr(s, VGA_SEQ_MEMORY_MODE) & VGA_SR04_CHN_4M) { offset = 0; switch ((s->gr[VGA_GFX_MISC] >> 2) & 3) { case 0: base = 0xa0000; size = 0x20000; break; case 1: base = 0xa0000; size = 0x10000; offset = s->bank_offset; break; case 2: base = 0xb0000; size = 0x8000; break; case 3: default: base = 0xb8000; size = 0x8000; break; } assert(offset + size <= s->vram_size); memory_region_init_alias(&s->chain4_alias, memory_region_owner(&s->vram), ""vga.chain4"", &s->vram, offset, size); memory_region_add_subregion_overlap(s->legacy_address_space, base, &s->chain4_alias, 2); s->has_chain4_alias = true; } } ",0 "INT_PTR CALLBACK AboutCallback(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) { int i, dy; const int edit_id[2] = {IDC_ABOUT_BLURB, IDC_ABOUT_COPYRIGHTS}; char about_blurb[2048]; const char* edit_text[2] = {about_blurb, additional_copyrights}; HWND hEdit[2]; TEXTRANGEW tr; ENLINK* enl; RECT rect; REQRESIZE* rsz; wchar_t wUrl[256]; static BOOL resized_already = TRUE; switch (message) { case WM_INITDIALOG: resized_already = FALSE; apply_localization(IDD_ABOUTBOX, hDlg); SetTitleBarIcon(hDlg); CenterDialog(hDlg); if (settings_commcheck) ShowWindow(GetDlgItem(hDlg, IDC_ABOUT_UPDATES), SW_SHOW); static_sprintf(about_blurb, about_blurb_format, lmprintf(MSG_174|MSG_RTF), lmprintf(MSG_175|MSG_RTF, rufus_version[0], rufus_version[1], rufus_version[2]), right_to_left_mode?""Akeo \\\\ Pete Batard 2011-2017 © Copyright"":""Copyright © 2011-2017 Pete Batard / Akeo"", lmprintf(MSG_176|MSG_RTF), lmprintf(MSG_177|MSG_RTF), lmprintf(MSG_178|MSG_RTF)); for (i=0; icode) { case EN_REQUESTRESIZE: if (!resized_already) { resized_already = TRUE; GetWindowRect(GetDlgItem(hDlg, edit_id[0]), &rect); dy = rect.bottom - rect.top; rsz = (REQRESIZE *)lParam; dy -= rsz->rc.bottom - rsz->rc.top; ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, edit_id[0]), 0, 0, 0, -dy, 1.0f); ResizeMoveCtrl(hDlg, GetDlgItem(hDlg, edit_id[1]), 0, -dy, 0, dy, 1.0f); } break; case EN_LINK: enl = (ENLINK*) lParam; if (enl->msg == WM_LBUTTONUP) { tr.lpstrText = wUrl; tr.chrg.cpMin = enl->chrg.cpMin; tr.chrg.cpMax = enl->chrg.cpMax; SendMessageW(enl->nmhdr.hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr); wUrl[ARRAYSIZE(wUrl)-1] = 0; ShellExecuteW(hDlg, L""open"", wUrl, NULL, NULL, SW_SHOWNORMAL); } break; } break; case WM_COMMAND: switch (LOWORD(wParam)) { case IDOK: case IDCANCEL: reset_localization(IDD_ABOUTBOX); EndDialog(hDlg, LOWORD(wParam)); return (INT_PTR)TRUE; case IDC_ABOUT_LICENSE: MyDialogBox(hMainInstance, IDD_LICENSE, hDlg, LicenseCallback); break; case IDC_ABOUT_UPDATES: MyDialogBox(hMainInstance, IDD_UPDATE_POLICY, hDlg, UpdateCallback); break; } break; } return (INT_PTR)FALSE; } ",0 "int kvm_hv_vapic_msr_write(struct kvm_vcpu *vcpu, u32 reg, u64 data) { struct kvm_lapic *apic = vcpu->arch.apic; if (!kvm_vcpu_has_lapic(vcpu)) return 1; /* if this is ICR write vector before command */ if (reg == APIC_ICR) apic_reg_write(apic, APIC_ICR2, (u32)(data >> 32)); return apic_reg_write(apic, reg, (u32)data); } ",0 "void __init tcp_v4_init(void) { inet_hashinfo_init(&tcp_hashinfo); if (register_pernet_subsys(&tcp_sk_ops)) panic(""Failed to create the TCP control socket.\n""); } ",0 "xmlXPathSubstringAfterFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr str; xmlXPathObjectPtr find; xmlBufferPtr target; const xmlChar *point; int offset; CHECK_ARITY(2); CAST_TO_STRING; find = valuePop(ctxt); CAST_TO_STRING; str = valuePop(ctxt); target = xmlBufferCreate(); if (target) { point = xmlStrstr(str->stringval, find->stringval); if (point) { offset = (int)(point - str->stringval) + xmlStrlen(find->stringval); xmlBufferAdd(target, &str->stringval[offset], xmlStrlen(str->stringval) - offset); } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, xmlBufferContent(target))); xmlBufferFree(target); } xmlXPathReleaseObject(ctxt->context, str); xmlXPathReleaseObject(ctxt->context, find); } ",0 "bool PrintWebViewHelper::CheckForCancel() { const PrintMsg_Print_Params& print_params = print_pages_params_->params; bool cancel = false; Send(new PrintHostMsg_CheckForCancel(routing_id(), print_params.preview_ui_id, print_params.preview_request_id, &cancel)); if (cancel) notify_browser_of_print_failure_ = false; return cancel; } ",0 "ImportSingleTIFF_SLong ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian, SXMPMeta * xmp, const char * xmpNS, const char * xmpProp ) { try { // Don't let errors with one stop the others. XMP_Int32 binValue = *((XMP_Int32*)tagInfo.dataPtr); if ( ! nativeEndian ) Flip4 ( &binValue ); char strValue[20]; snprintf ( strValue, sizeof(strValue), ""%ld"", (long)binValue ); // AUDIT: Using sizeof(strValue) is safe. xmp->SetProperty ( xmpNS, xmpProp, strValue ); } catch ( ... ) { } } // ImportSingleTIFF_SLong ",0 "int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt) { struct svc_serv *serv; struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; int ret; struct net *net = xprt->xprt_net; mutex_lock(&nfs_callback_mutex); serv = nfs_callback_create_svc(minorversion); if (IS_ERR(serv)) { ret = PTR_ERR(serv); goto err_create; } ret = nfs_callback_up_net(minorversion, serv, net, xprt); if (ret < 0) goto err_net; ret = nfs_callback_start_svc(minorversion, xprt, serv); if (ret < 0) goto err_start; cb_info->users++; /* * svc_create creates the svc_serv with sv_nrthreads == 1, and then * svc_prepare_thread increments that. So we need to call svc_destroy * on both success and failure so that the refcount is 1 when the * thread exits. */ err_net: if (!cb_info->users) cb_info->serv = NULL; svc_destroy(serv); err_create: mutex_unlock(&nfs_callback_mutex); return ret; err_start: nfs_callback_down_net(minorversion, serv, net); dprintk(""NFS: Couldn't create server thread; err = %d\n"", ret); goto err_net; } ",0 "ar6000_pmkid_list_event(void *devt, u8 numPMKID, WMI_PMKID *pmkidList, u8 *bssidList) { u8 i, j; A_PRINTF(""Number of Cached PMKIDs is %d\n"", numPMKID); for (i = 0; i < numPMKID; i++) { A_PRINTF(""\nBSSID %d "", i); for (j = 0; j < ATH_MAC_LEN; j++) { A_PRINTF(""%2.2x"", bssidList[j]); } bssidList += (ATH_MAC_LEN + WMI_PMKID_LEN); A_PRINTF(""\nPMKID %d "", i); for (j = 0; j < WMI_PMKID_LEN; j++) { A_PRINTF(""%2.2x"", pmkidList->pmkid[j]); } pmkidList = (WMI_PMKID *)((u8 *)pmkidList + ATH_MAC_LEN + WMI_PMKID_LEN); } } ",0 "static int fixup_owner(u32 __user *uaddr, struct futex_q *q, int locked) { struct task_struct *owner; int ret = 0; if (locked) { /* * Got the lock. We might not be the anticipated owner if we * did a lock-steal - fix up the PI-state in that case: */ if (q->pi_state->owner != current) ret = fixup_pi_state_owner(uaddr, q, current); goto out; } /* * Catch the rare case, where the lock was released when we were on the * way back before we locked the hash bucket. */ if (q->pi_state->owner == current) { /* * Try to get the rt_mutex now. This might fail as some other * task acquired the rt_mutex after we removed ourself from the * rt_mutex waiters list. */ if (rt_mutex_trylock(&q->pi_state->pi_mutex)) { locked = 1; goto out; } /* * pi_state is incorrect, some other task did a lock steal and * we returned due to timeout or signal without taking the * rt_mutex. Too late. */ raw_spin_lock(&q->pi_state->pi_mutex.wait_lock); owner = rt_mutex_owner(&q->pi_state->pi_mutex); if (!owner) owner = rt_mutex_next_owner(&q->pi_state->pi_mutex); raw_spin_unlock(&q->pi_state->pi_mutex.wait_lock); ret = fixup_pi_state_owner(uaddr, q, owner); goto out; } /* * Paranoia check. If we did not take the lock, then we should not be * the owner of the rt_mutex. */ if (rt_mutex_owner(&q->pi_state->pi_mutex) == current) printk(KERN_ERR ""fixup_owner: ret = %d pi-mutex: %p "" ""pi-state %p\n"", ret, q->pi_state->pi_mutex.owner, q->pi_state->owner); out: return ret ? ret : locked; } ",0 "static void tcp_send_challenge_ack(struct sock *sk, const struct sk_buff *skb) { /* unprotected vars, we dont care of overwrites */ static u32 challenge_timestamp; static unsigned int challenge_count; struct tcp_sock *tp = tcp_sk(sk); u32 now; /* First check our per-socket dupack rate limit. */ if (tcp_oow_rate_limited(sock_net(sk), skb, LINUX_MIB_TCPACKSKIPPEDCHALLENGE, &tp->last_oow_ack_time)) return; /* Then check the check host-wide RFC 5961 rate limit. */ now = jiffies / HZ; if (now != challenge_timestamp) { challenge_timestamp = now; challenge_count = 0; } if (++challenge_count <= sysctl_tcp_challenge_ack_limit) { NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPCHALLENGEACK); tcp_send_ack(sk); } } ",0 "virDomainGetBlockJobInfo(virDomainPtr dom, const char *disk, virDomainBlockJobInfoPtr info, unsigned int flags) { virConnectPtr conn; VIR_DOMAIN_DEBUG(dom, ""disk=%s, info=%p, flags=%x"", disk, info, flags); virResetLastError(); if (info) memset(info, 0, sizeof(*info)); virCheckDomainReturn(dom, -1); conn = dom->conn; virCheckNonNullArgGoto(disk, error); virCheckNonNullArgGoto(info, error); if (conn->driver->domainGetBlockJobInfo) { int ret; ret = conn->driver->domainGetBlockJobInfo(dom, disk, info, flags); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(dom->conn); return -1; } ",0 "static inline u32 armv7pmu_read_counter(int idx) { unsigned long value = 0; if (idx == ARMV7_CYCLE_COUNTER) asm volatile(""mrc p15, 0, %0, c9, c13, 0"" : ""=r"" (value)); else if ((idx >= ARMV7_COUNTER0) && (idx <= ARMV7_COUNTER_LAST)) { if (armv7_pmnc_select_counter(idx) == idx) asm volatile(""mrc p15, 0, %0, c9, c13, 2"" : ""=r"" (value)); } else pr_err(""CPU%u reading wrong counter %d\n"", smp_processor_id(), idx); return value; } ",0 " void StopAnimation(Tab* tab) { ASSERT_TRUE(tab->alert_indicator_->fade_animation_); tab->alert_indicator_->fade_animation_->Stop(); } ",0 "static bool NeedsPerspective(const LayoutObject& object) { return object.IsBox() && object.StyleRef().HasPerspective(); } ",0 "pdf_clear_stack(fz_context *ctx, pdf_csi *csi) { int i; pdf_drop_obj(ctx, csi->obj); csi->obj = NULL; csi->name[0] = 0; csi->string_len = 0; for (i = 0; i < csi->top; i++) csi->stack[i] = 0; csi->top = 0; } ",0 "void Document::disableEval(const String& errorMessage) { if (!frame()) return; frame()->script()->disableEval(errorMessage); } ",0 "std::string GetProfileName(VideoCodecProfile profile) { switch (profile) { case VIDEO_CODEC_PROFILE_UNKNOWN: return ""unknown""; case H264PROFILE_BASELINE: return ""h264 baseline""; case H264PROFILE_MAIN: return ""h264 main""; case H264PROFILE_EXTENDED: return ""h264 extended""; case H264PROFILE_HIGH: return ""h264 high""; case H264PROFILE_HIGH10PROFILE: return ""h264 high 10""; case H264PROFILE_HIGH422PROFILE: return ""h264 high 4:2:2""; case H264PROFILE_HIGH444PREDICTIVEPROFILE: return ""h264 high 4:4:4 predictive""; case H264PROFILE_SCALABLEBASELINE: return ""h264 scalable baseline""; case H264PROFILE_SCALABLEHIGH: return ""h264 scalable high""; case H264PROFILE_STEREOHIGH: return ""h264 stereo high""; case H264PROFILE_MULTIVIEWHIGH: return ""h264 multiview high""; case HEVCPROFILE_MAIN: return ""hevc main""; case HEVCPROFILE_MAIN10: return ""hevc main 10""; case HEVCPROFILE_MAIN_STILL_PICTURE: return ""hevc main still-picture""; case VP8PROFILE_ANY: return ""vp8""; case VP9PROFILE_PROFILE0: return ""vp9 profile0""; case VP9PROFILE_PROFILE1: return ""vp9 profile1""; case VP9PROFILE_PROFILE2: return ""vp9 profile2""; case VP9PROFILE_PROFILE3: return ""vp9 profile3""; case DOLBYVISION_PROFILE0: return ""dolby vision profile 0""; case DOLBYVISION_PROFILE4: return ""dolby vision profile 4""; case DOLBYVISION_PROFILE5: return ""dolby vision profile 5""; case DOLBYVISION_PROFILE7: return ""dolby vision profile 7""; } NOTREACHED(); return """"; } ",0 " ~PrintPreviewRequestIdMapWithLock() {} ",0 "int cifs_negotiate_protocol(unsigned int xid, struct cifsSesInfo *ses) { int rc = 0; struct TCP_Server_Info *server = ses->server; /* only send once per connect */ if (server->maxBuf != 0) return 0; rc = CIFSSMBNegotiate(xid, ses); if (rc == -EAGAIN) { /* retry only once on 1st time connection */ rc = CIFSSMBNegotiate(xid, ses); if (rc == -EAGAIN) rc = -EHOSTDOWN; } if (rc == 0) { spin_lock(&GlobalMid_Lock); if (server->tcpStatus != CifsExiting) server->tcpStatus = CifsGood; else rc = -EHOSTDOWN; spin_unlock(&GlobalMid_Lock); } return rc; } ",0 "bool MatchesFilter(const std::string* device_name, const UUIDSet& device_uuids, const blink::mojom::WebBluetoothLeScanFilterPtr& filter) { if (filter->name) { if (device_name == nullptr) return false; if (filter->name.value() != *device_name) return false; } if (filter->name_prefix && filter->name_prefix->size()) { if (device_name == nullptr) return false; if (!base::StartsWith(*device_name, filter->name_prefix.value(), base::CompareCase::SENSITIVE)) return false; } if (filter->services) { for (const auto& service : filter->services.value()) { if (!base::Contains(device_uuids, service)) { return false; } } } return true; } ",0 "keyeq(KEY s1, KEY s2) { for (; *s1 == *s2; s1++, s2++) if (*s1 == 0) return XML_TRUE; return XML_FALSE; } ",0 "static int handle_dependencies(BlockDriverState *bs, uint64_t guest_offset, uint64_t *cur_bytes, QCowL2Meta **m) { BDRVQcowState *s = bs->opaque; QCowL2Meta *old_alloc; uint64_t bytes = *cur_bytes; QLIST_FOREACH(old_alloc, &s->cluster_allocs, next_in_flight) { uint64_t start = guest_offset; uint64_t end = start + bytes; uint64_t old_start = l2meta_cow_start(old_alloc); uint64_t old_end = l2meta_cow_end(old_alloc); if (end <= old_start || start >= old_end) { /* No intersection */ } else { if (start < old_start) { /* Stop at the start of a running allocation */ bytes = old_start - start; } else { bytes = 0; } /* Stop if already an l2meta exists. After yielding, it wouldn't * be valid any more, so we'd have to clean up the old L2Metas * and deal with requests depending on them before starting to * gather new ones. Not worth the trouble. */ if (bytes == 0 && *m) { *cur_bytes = 0; return 0; } if (bytes == 0) { /* Wait for the dependency to complete. We need to recheck * the free/allocated clusters when we continue. */ qemu_co_mutex_unlock(&s->lock); qemu_co_queue_wait(&old_alloc->dependent_requests); qemu_co_mutex_lock(&s->lock); return -EAGAIN; } } } /* Make sure that existing clusters and new allocations are only used up to * the next dependency if we shortened the request above */ *cur_bytes = bytes; return 0; } ",0 "void RenderView::OnExecuteEditCommand(const std::string& name, const std::string& value) { if (!webview() || !webview()->focusedFrame()) return; webview()->focusedFrame()->executeCommand( WebString::fromUTF8(name), WebString::fromUTF8(value)); } ",0 "bool GLES2DecoderImpl::CheckDrawingFeedbackLoops() { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_FRAMEBUFFER); if (!framebuffer) return false; const Framebuffer::Attachment* attachment = framebuffer->GetAttachment(GL_COLOR_ATTACHMENT0); if (!attachment) return false; DCHECK(state_.current_program.get()); const Program::SamplerIndices& sampler_indices = state_.current_program->sampler_indices(); for (size_t ii = 0; ii < sampler_indices.size(); ++ii) { const Program::UniformInfo* uniform_info = state_.current_program->GetUniformInfo(sampler_indices[ii]); DCHECK(uniform_info); if (uniform_info->type != GL_SAMPLER_2D) continue; for (size_t jj = 0; jj < uniform_info->texture_units.size(); ++jj) { GLuint texture_unit_index = uniform_info->texture_units[jj]; if (texture_unit_index >= state_.texture_units.size()) continue; TextureUnit& texture_unit = state_.texture_units[texture_unit_index]; TextureRef* texture_ref = texture_unit.GetInfoForSamplerType(GL_SAMPLER_2D).get(); if (attachment->IsTexture(texture_ref)) return true; } } return false; } ",0 "bool WebGLRenderingContextBase::CopyRenderingResultsFromDrawingBuffer( AcceleratedImageBufferSurface* webgl_buffer, SourceDrawingBuffer source_buffer) const { if (!drawing_buffer_) return false; std::unique_ptr provider = Platform::Current()->CreateSharedOffscreenGraphicsContext3DProvider(); if (!provider) return false; gpu::gles2::GLES2Interface* gl = provider->ContextGL(); GLuint texture_id = webgl_buffer->GetBackingTextureHandleForOverwrite(); if (!texture_id) return false; gl->Flush(); return drawing_buffer_->CopyToPlatformTexture( gl, GL_TEXTURE_2D, texture_id, true, false, IntPoint(0, 0), IntRect(IntPoint(0, 0), drawing_buffer_->Size()), source_buffer); } ",0 "void RenderFrameHostImpl::OnEnterFullscreen( const blink::WebFullscreenOptions& options) { std::set notified_instances; notified_instances.insert(GetSiteInstance()); for (FrameTreeNode* node = frame_tree_node_; node->parent(); node = node->parent()) { SiteInstance* parent_site_instance = node->parent()->current_frame_host()->GetSiteInstance(); if (ContainsKey(notified_instances, parent_site_instance)) continue; RenderFrameProxyHost* child_proxy = node->render_manager()->GetRenderFrameProxyHost(parent_site_instance); child_proxy->Send( new FrameMsg_WillEnterFullscreen(child_proxy->GetRoutingID())); notified_instances.insert(parent_site_instance); } delegate_->EnterFullscreenMode(GetLastCommittedURL().GetOrigin()); render_view_host_->GetWidget()->SynchronizeVisualProperties(); } ",0 "void RenderFrameImpl::DidChangeFramePolicy( blink::WebFrame* child_frame, blink::WebSandboxFlags flags, const blink::ParsedFeaturePolicy& container_policy) { Send(new FrameHostMsg_DidChangeFramePolicy( routing_id_, RenderFrame::GetRoutingIdForWebFrame(child_frame), {flags, container_policy})); } ",0 "int sas_register_ports(struct sas_ha_struct *sas_ha) { int i; /* initialize the ports and discovery */ for (i = 0; i < sas_ha->num_phys; i++) { struct asd_sas_port *port = sas_ha->sas_port[i]; sas_init_port(port, sas_ha, i); sas_init_disc(&port->disc, port); } return 0; } ",0 "SyncSocket::~SyncSocket() { Close(); } ",0 "static int tcm_loop_write_pending_status(struct se_cmd *se_cmd) { return 0; } ",0 "static void addrconf_dev_config(struct net_device *dev) { struct inet6_dev *idev; ASSERT_RTNL(); if ((dev->type != ARPHRD_ETHER) && (dev->type != ARPHRD_FDDI) && (dev->type != ARPHRD_ARCNET) && (dev->type != ARPHRD_INFINIBAND) && (dev->type != ARPHRD_IEEE802154) && (dev->type != ARPHRD_IEEE1394) && (dev->type != ARPHRD_TUNNEL6) && (dev->type != ARPHRD_6LOWPAN)) { /* Alas, we support only Ethernet autoconfiguration. */ return; } idev = addrconf_add_dev(dev); if (IS_ERR(idev)) return; addrconf_addr_gen(idev, false); } ",0 "void Player::setCurrentTime(double newCurrentTime) { if (!std::isfinite(newCurrentTime)) return; updateTimingState(newCurrentTime); m_timeline.serviceAnimations(); } ",0 "PHPAPI void php_register_variable(char *var, char *strval, zval *track_vars_array TSRMLS_DC) { php_register_variable_safe(var, strval, strlen(strval), track_vars_array TSRMLS_CC); } ",0 "void CrosLibrary::TestApi::SetLoginLibrary( LoginLibrary* library, bool own) { library_->login_lib_.SetImpl(library, own); } ",1 "static const char *baseFilename(const char *filename) { const char *cur; if (filename == NULL) return(NULL); cur = &filename[strlen(filename)]; while ((cur > filename) && (*cur != '/')) cur--; if (*cur == '/') return(cur + 1); return(cur); } ",0 "CuePoint::CuePoint(long idx, long long pos) : m_element_start(0), m_element_size(0), m_index(idx), m_timecode(-1 * pos), m_track_positions(NULL), m_track_positions_count(0) { assert(pos > 0); } ",0 "void Browser::TabClosingAt(TabStripModel* tab_strip_model, TabContentsWrapper* contents, int index) { NotificationService::current()->Notify( NotificationType::TAB_CLOSING, Source(&contents->controller()), NotificationService::NoDetails()); SetAsDelegate(contents, NULL); } ",0 "int mp_unpack_limit(lua_State *L) { int limit = luaL_checkinteger(L, 2); int offset = luaL_optinteger(L, 3, 0); /* Variable pop because offset may not exist */ lua_pop(L, lua_gettop(L)-1); return mp_unpack_full(L, limit, offset); } ",0 "png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length) { png_bytep ptr; if (png_ptr == NULL) return; ptr = buffer; if (png_ptr->save_buffer_size) { png_size_t save_size; if (length < png_ptr->save_buffer_size) save_size = length; else save_size = png_ptr->save_buffer_size; png_memcpy(ptr, png_ptr->save_buffer_ptr, save_size); length -= save_size; ptr += save_size; png_ptr->buffer_size -= save_size; png_ptr->save_buffer_size -= save_size; png_ptr->save_buffer_ptr += save_size; } if (length && png_ptr->current_buffer_size) { png_size_t save_size; if (length < png_ptr->current_buffer_size) save_size = length; else save_size = png_ptr->current_buffer_size; png_memcpy(ptr, png_ptr->current_buffer_ptr, save_size); png_ptr->buffer_size -= save_size; png_ptr->current_buffer_size -= save_size; png_ptr->current_buffer_ptr += save_size; } } ",0 "bool FormAssociatedElement::rangeOverflow() const { return false; } ",0 "XcursorXcFileLoad (XcursorFile *file, XcursorComments **commentsp, XcursorImages **imagesp) { XcursorFileHeader *fileHeader; int nimage; int ncomment; XcursorImages *images; XcursorImage *image; XcursorComment *comment; XcursorComments *comments; int toc; if (!file) return 0; fileHeader = _XcursorReadFileHeader (file); if (!fileHeader) return 0; nimage = 0; ncomment = 0; for (toc = 0; toc < fileHeader->ntoc; toc++) { switch (fileHeader->tocs[toc].type) { case XCURSOR_COMMENT_TYPE: ncomment++; break; case XCURSOR_IMAGE_TYPE: nimage++; break; } } images = XcursorImagesCreate (nimage); if (!images) return 0; comments = XcursorCommentsCreate (ncomment); if (!comments) { XcursorImagesDestroy (images); return 0; } for (toc = 0; toc < fileHeader->ntoc; toc++) { switch (fileHeader->tocs[toc].type) { case XCURSOR_COMMENT_TYPE: comment = _XcursorReadComment (file, fileHeader, toc); if (comment) { comments->comments[comments->ncomment] = comment; comments->ncomment++; } break; case XCURSOR_IMAGE_TYPE: image = _XcursorReadImage (file, fileHeader, toc); if (image) { images->images[images->nimage] = image; images->nimage++; } break; } } _XcursorFileHeaderDestroy (fileHeader); if (images->nimage != nimage || comments->ncomment != ncomment) { XcursorImagesDestroy (images); XcursorCommentsDestroy (comments); images = NULL; comments = NULL; return XcursorFalse; } *imagesp = images; *commentsp = comments; return XcursorTrue; } ",0 "static int ubifs_readpage(struct file *file, struct page *page) { if (ubifs_bulk_read(page)) return 0; do_readpage(page); unlock_page(page); return 0; } ",0 "bool kvm_vcpu_yield_to(struct kvm_vcpu *target) { struct pid *pid; struct task_struct *task = NULL; bool ret = false; rcu_read_lock(); pid = rcu_dereference(target->pid); if (pid) task = get_pid_task(target->pid, PIDTYPE_PID); rcu_read_unlock(); if (!task) return ret; if (task->flags & PF_VCPU) { put_task_struct(task); return ret; } ret = yield_to(task, 1); put_task_struct(task); return ret; } ",0 "static enum test_return test_binary_incr_impl(const char* key, uint8_t cmd) { union { protocol_binary_request_no_extras request; protocol_binary_response_no_extras response_header; protocol_binary_response_incr response; char bytes[1024]; } send, receive; size_t len = arithmetic_command(send.bytes, sizeof(send.bytes), cmd, key, strlen(key), 1, 0, 0); int ii; for (ii = 0; ii < 10; ++ii) { safe_send(send.bytes, len, false); if (cmd == PROTOCOL_BINARY_CMD_INCREMENT) { safe_recv_packet(receive.bytes, sizeof(receive.bytes)); validate_response_header(&receive.response_header, cmd, PROTOCOL_BINARY_RESPONSE_SUCCESS); assert(ntohll(receive.response.message.body.value) == ii); } } if (cmd == PROTOCOL_BINARY_CMD_INCREMENTQ) { test_binary_noop(); } return TEST_PASS; } ",0 " static Handle GetArguments(Isolate* isolate, FixedArrayBase* backing_store) { FixedArray* parameter_map = FixedArray::cast(backing_store); return Handle(FixedArray::cast(parameter_map->get(1)), isolate); } ",0 " void Activate() { is_activated_ = true; } ",0 "bool GLES2DecoderImpl::GenSamplersHelper(GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { if (GetSampler(client_ids[ii])) { return false; } } std::unique_ptr service_ids(new GLuint[n]); api()->glGenSamplersFn(n, service_ids.get()); for (GLsizei ii = 0; ii < n; ++ii) { CreateSampler(client_ids[ii], service_ids[ii]); } return true; } ",0 "static void _php_image_convert(INTERNAL_FUNCTION_PARAMETERS, int image_type ) { char *f_org, *f_dest; int f_org_len, f_dest_len; long height, width, threshold; gdImagePtr im_org, im_dest, im_tmp; char *fn_org = NULL; char *fn_dest = NULL; FILE *org, *dest; int dest_height = -1; int dest_width = -1; int org_height, org_width; int white, black; int color, color_org, median; int int_threshold; int x, y; float x_ratio, y_ratio; #ifdef HAVE_GD_JPG long ignore_warning; #endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""pplll"", &f_org, &f_org_len, &f_dest, &f_dest_len, &height, &width, &threshold) == FAILURE) { return; } fn_org = f_org; fn_dest = f_dest; dest_height = height; dest_width = width; int_threshold = threshold; /* Check threshold value */ if (int_threshold < 0 || int_threshold > 8) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Invalid threshold value '%d'"", int_threshold); RETURN_FALSE; } /* Check origin file */ PHP_GD_CHECK_OPEN_BASEDIR(fn_org, ""Invalid origin filename""); /* Check destination file */ PHP_GD_CHECK_OPEN_BASEDIR(fn_dest, ""Invalid destination filename""); /* Open origin file */ org = VCWD_FOPEN(fn_org, ""rb""); if (!org) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to open '%s' for reading"", fn_org); RETURN_FALSE; } /* Open destination file */ dest = VCWD_FOPEN(fn_dest, ""wb""); if (!dest) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to open '%s' for writing"", fn_dest); RETURN_FALSE; } switch (image_type) { #ifdef HAVE_GD_GIF_READ case PHP_GDIMG_TYPE_GIF: im_org = gdImageCreateFromGif(org); if (im_org == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to open '%s' Not a valid GIF file"", fn_dest); RETURN_FALSE; } break; #endif /* HAVE_GD_GIF_READ */ #ifdef HAVE_GD_JPG case PHP_GDIMG_TYPE_JPG: ignore_warning = INI_INT(""gd.jpeg_ignore_warning""); #ifdef HAVE_GD_BUNDLED im_org = gdImageCreateFromJpeg(org, ignore_warning); #else im_org = gdImageCreateFromJpeg(org); #endif if (im_org == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to open '%s' Not a valid JPEG file"", fn_dest); RETURN_FALSE; } break; #endif /* HAVE_GD_JPG */ #ifdef HAVE_GD_PNG case PHP_GDIMG_TYPE_PNG: im_org = gdImageCreateFromPng(org); if (im_org == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to open '%s' Not a valid PNG file"", fn_dest); RETURN_FALSE; } break; #endif /* HAVE_GD_PNG */ default: php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Format not supported""); RETURN_FALSE; break; } org_width = gdImageSX (im_org); org_height = gdImageSY (im_org); x_ratio = (float) org_width / (float) dest_width; y_ratio = (float) org_height / (float) dest_height; if (x_ratio > 1 && y_ratio > 1) { if (y_ratio > x_ratio) { x_ratio = y_ratio; } else { y_ratio = x_ratio; } dest_width = (int) (org_width / x_ratio); dest_height = (int) (org_height / y_ratio); } else { x_ratio = (float) dest_width / (float) org_width; y_ratio = (float) dest_height / (float) org_height; if (y_ratio < x_ratio) { x_ratio = y_ratio; } else { y_ratio = x_ratio; } dest_width = (int) (org_width * x_ratio); dest_height = (int) (org_height * y_ratio); } im_tmp = gdImageCreate (dest_width, dest_height); if (im_tmp == NULL ) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to allocate temporary buffer""); RETURN_FALSE; } gdImageCopyResized (im_tmp, im_org, 0, 0, 0, 0, dest_width, dest_height, org_width, org_height); gdImageDestroy(im_org); fclose(org); im_dest = gdImageCreate(dest_width, dest_height); if (im_dest == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to allocate destination buffer""); RETURN_FALSE; } white = gdImageColorAllocate(im_dest, 255, 255, 255); if (white == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to allocate the colors for the destination buffer""); RETURN_FALSE; } black = gdImageColorAllocate(im_dest, 0, 0, 0); if (black == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to allocate the colors for the destination buffer""); RETURN_FALSE; } int_threshold = int_threshold * 32; for (y = 0; y < dest_height; y++) { for (x = 0; x < dest_width; x++) { color_org = gdImageGetPixel (im_tmp, x, y); median = (im_tmp->red[color_org] + im_tmp->green[color_org] + im_tmp->blue[color_org]) / 3; if (median < int_threshold) { color = black; } else { color = white; } gdImageSetPixel (im_dest, x, y, color); } } gdImageDestroy (im_tmp ); gdImageWBMP(im_dest, black , dest); fflush(dest); fclose(dest); gdImageDestroy(im_dest); RETURN_TRUE; } ",0 "static bool shouldOpenInNewWindow(Frame* targetFrame, const FrameLoadRequest& request, const NavigationAction& action) { if (!targetFrame && !request.frameName().isEmpty()) return true; if (!request.formState()) return false; NavigationPolicy navigationPolicy = NavigationPolicyCurrentTab; if (!action.specifiesNavigationPolicy(&navigationPolicy)) return false; return navigationPolicy != NavigationPolicyCurrentTab; } ",0 "void CLASS merror (void *ptr, const char *where) { if (ptr) return; dcraw_message (DCRAW_ERROR,_(""%s: Out of memory in %s\n""), ifname_display, where); longjmp (failure, 1); } ",0 "bool omx_vdec::allocate_color_convert_buf::update_buffer_req() { bool status = true; unsigned int src_size = 0, destination_size = 0; OMX_COLOR_FORMATTYPE drv_color_format; if (!omx) { DEBUG_PRINT_ERROR(""Invalid client in color convert""); return false; } if (!enabled) { DEBUG_PRINT_HIGH(""No color conversion required""); return status; } pthread_mutex_lock(&omx->c_lock); if (omx->drv_ctx.output_format != VDEC_YUV_FORMAT_NV12 && ColorFormat != OMX_COLOR_FormatYUV420Planar) { DEBUG_PRINT_ERROR(""update_buffer_req: Unsupported color conversion""); status = false; goto fail_update_buf_req; } c2d.close(); status = c2d.open(omx->drv_ctx.video_resolution.frame_height, omx->drv_ctx.video_resolution.frame_width, NV12_128m,dest_format); if (status) { status = c2d.get_buffer_size(C2D_INPUT,src_size); if (status) status = c2d.get_buffer_size(C2D_OUTPUT,destination_size); } if (status) { if (!src_size || src_size > omx->drv_ctx.op_buf.buffer_size || !destination_size) { DEBUG_PRINT_ERROR(""ERROR: Size mismatch in C2D src_size %d"" ""driver size %u destination size %d"", src_size, (unsigned int)omx->drv_ctx.op_buf.buffer_size, destination_size); status = false; c2d.close(); buffer_size_req = 0; } else { buffer_size_req = destination_size; if (buffer_size_req < omx->drv_ctx.op_buf.buffer_size) buffer_size_req = omx->drv_ctx.op_buf.buffer_size; if (buffer_alignment_req < omx->drv_ctx.op_buf.alignment) buffer_alignment_req = omx->drv_ctx.op_buf.alignment; } } fail_update_buf_req: pthread_mutex_unlock(&omx->c_lock); return status; } ",0 "static apr_status_t session_pool_cleanup(void *data) { h2_session *session = data; /* On a controlled connection shutdown, this gets never * called as we deregister and destroy our pool manually. * However when we have an async mpm, and handed it our idle * connection, it will just cleanup once the connection is closed * from the other side (and sometimes even from out side) and * here we arrive then. */ ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, session->c, ""session(%ld): pool_cleanup"", session->id); if (session->state != H2_SESSION_ST_DONE) { /* Not good. The connection is being torn down and we have * not sent a goaway. This is considered a protocol error and * the client has to assume that any streams ""in flight"" may have * been processed and are not safe to retry. * As clients with idle connection may only learn about a closed * connection when sending the next request, this has the effect * that at least this one request will fail. */ ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, session->c, APLOGNO(03199) ""session(%ld): connection disappeared without proper "" ""goodbye, clients will be confused, should not happen"", session->id); } /* keep us from destroying the pool, since that is already ongoing. */ session->pool = NULL; h2_session_destroy(session); return APR_SUCCESS; } ",0 "static int get_qcx(Jpeg2000DecoderContext *s, int n, Jpeg2000QuantStyle *q) { int i, x; if (bytestream2_get_bytes_left(&s->g) < 1) return AVERROR_INVALIDDATA; x = bytestream2_get_byteu(&s->g); // Sqcd q->nguardbits = x >> 5; q->quantsty = x & 0x1f; if (q->quantsty == JPEG2000_QSTY_NONE) { n -= 3; if (bytestream2_get_bytes_left(&s->g) < n || n > JPEG2000_MAX_DECLEVELS*3) return AVERROR_INVALIDDATA; for (i = 0; i < n; i++) q->expn[i] = bytestream2_get_byteu(&s->g) >> 3; } else if (q->quantsty == JPEG2000_QSTY_SI) { if (bytestream2_get_bytes_left(&s->g) < 2) return AVERROR_INVALIDDATA; x = bytestream2_get_be16u(&s->g); q->expn[0] = x >> 11; q->mant[0] = x & 0x7ff; for (i = 1; i < JPEG2000_MAX_DECLEVELS * 3; i++) { int curexpn = FFMAX(0, q->expn[0] - (i - 1) / 3); q->expn[i] = curexpn; q->mant[i] = q->mant[0]; } } else { n = (n - 3) >> 1; if (bytestream2_get_bytes_left(&s->g) < 2 * n || n > JPEG2000_MAX_DECLEVELS*3) return AVERROR_INVALIDDATA; for (i = 0; i < n; i++) { x = bytestream2_get_be16u(&s->g); q->expn[i] = x >> 11; q->mant[i] = x & 0x7ff; } } return 0; } ",0 "static void nfs4_free_lockowner(struct nfs4_stateowner *sop) { struct nfs4_lockowner *lo = lockowner(sop); kmem_cache_free(lockowner_slab, lo); } ",0 "EC_KEY *o2i_ECPublicKey(EC_KEY **a, const unsigned char **in, long len) { EC_KEY *ret = NULL; if (a == NULL || (*a) == NULL || (*a)->group == NULL) { /* * sorry, but a EC_GROUP-structur is necessary to set the public key */ ECerr(EC_F_O2I_ECPUBLICKEY, ERR_R_PASSED_NULL_PARAMETER); return 0; } ret = *a; if (ret->pub_key == NULL && (ret->pub_key = EC_POINT_new(ret->group)) == NULL) { ECerr(EC_F_O2I_ECPUBLICKEY, ERR_R_MALLOC_FAILURE); return 0; } if (!EC_POINT_oct2point(ret->group, ret->pub_key, *in, len, NULL)) { ECerr(EC_F_O2I_ECPUBLICKEY, ERR_R_EC_LIB); return 0; } /* save the point conversion form */ ret->conv_form = (point_conversion_form_t) (*in[0] & ~0x01); *in += len; return ret; } ",0 "TestInterfaceNode* V8TestInterfaceNode::toImplWithTypeCheck(v8::Isolate* isolate, v8::Local value) { return hasInstance(value, isolate) ? toImpl(v8::Local::Cast(value)) : nullptr; } ",0 "static int chainiv_init_common(struct crypto_tfm *tfm) { tfm->crt_ablkcipher.reqsize = sizeof(struct ablkcipher_request); return skcipher_geniv_init(tfm); } ",0 "static int rock_ridge_symlink_readpage(struct file *file, struct page *page) { struct inode *inode = page->mapping->host; struct iso_inode_info *ei = ISOFS_I(inode); struct isofs_sb_info *sbi = ISOFS_SB(inode->i_sb); char *link = page_address(page); unsigned long bufsize = ISOFS_BUFFER_SIZE(inode); struct buffer_head *bh; char *rpnt = link; unsigned char *pnt; struct iso_directory_record *raw_de; unsigned long block, offset; int sig; struct rock_ridge *rr; struct rock_state rs; int ret; if (!sbi->s_rock) goto error; init_rock_state(&rs, inode); block = ei->i_iget5_block; bh = sb_bread(inode->i_sb, block); if (!bh) goto out_noread; offset = ei->i_iget5_offset; pnt = (unsigned char *)bh->b_data + offset; raw_de = (struct iso_directory_record *)pnt; /* * If we go past the end of the buffer, there is some sort of error. */ if (offset + *pnt > bufsize) goto out_bad_span; /* * Now test for possible Rock Ridge extensions which will override * some of these numbers in the inode structure. */ setup_rock_ridge(raw_de, inode, &rs); repeat: while (rs.len > 2) { /* There may be one byte for padding somewhere */ rr = (struct rock_ridge *)rs.chr; if (rr->len < 3) goto out; /* Something got screwed up here */ sig = isonum_721(rs.chr); if (rock_check_overflow(&rs, sig)) goto out; rs.chr += rr->len; rs.len -= rr->len; if (rs.len < 0) goto out; /* corrupted isofs */ switch (sig) { case SIG('R', 'R'): if ((rr->u.RR.flags[0] & RR_SL) == 0) goto out; break; case SIG('S', 'P'): if (check_sp(rr, inode)) goto out; break; case SIG('S', 'L'): rpnt = get_symlink_chunk(rpnt, rr, link + (PAGE_SIZE - 1)); if (rpnt == NULL) goto out; break; case SIG('C', 'E'): /* This tells is if there is a continuation record */ rs.cont_extent = isonum_733(rr->u.CE.extent); rs.cont_offset = isonum_733(rr->u.CE.offset); rs.cont_size = isonum_733(rr->u.CE.size); default: break; } } ret = rock_continue(&rs); if (ret == 0) goto repeat; if (ret < 0) goto fail; if (rpnt == link) goto fail; brelse(bh); *rpnt = '\0'; SetPageUptodate(page); unlock_page(page); return 0; /* error exit from macro */ out: kfree(rs.buffer); goto fail; out_noread: printk(""unable to read i-node block""); goto fail; out_bad_span: printk(""symlink spans iso9660 blocks\n""); fail: brelse(bh); error: SetPageError(page); unlock_page(page); return -EIO; } ",0 "std::string TestURLLoader::ReadEntireResponseBody(pp::URLLoader* loader, std::string* body) { TestCompletionCallback callback(instance_->pp_instance(), callback_type()); char buf[2]; // Small so that multiple reads are needed. for (;;) { callback.WaitForResult( loader->ReadResponseBody(buf, sizeof(buf), callback.GetCallback())); if (callback.result() < 0) return ReportError(""URLLoader::ReadResponseBody"", callback.result()); if (callback.result() == 0) break; body->append(buf, callback.result()); } PASS(); } ",0 "struct kvm_vcpu __percpu **kvm_get_running_vcpus(void) { return &kvm_arm_running_vcpu; } ",0 "static void runtimeEnabledVoidMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::runtimeEnabledVoidMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "unsigned long ImageBitmap::height() const { if (!m_image) return 0; ASSERT(m_image->height() > 0); return m_image->height(); } ",0 "ModuleExport void UnregisterFPXImage(void) { (void) UnregisterMagickInfo(""FPX""); } ",0 "const AtomicString& HTMLInputElement::Alt() const { return FastGetAttribute(altAttr); } ",0 "void ieee80211_csa_finish(struct ieee80211_vif *vif) { struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); ieee80211_queue_work(&sdata->local->hw, &sdata->csa_finalize_work); } ",0 "MagickBooleanType SyncExifProfile(Image *image,StringInfo *profile) { #define MaxDirectoryStack 16 #define EXIF_DELIMITER ""\n"" #define EXIF_NUM_FORMATS 12 #define TAG_EXIF_OFFSET 0x8769 #define TAG_INTEROP_OFFSET 0xa005 typedef struct _DirectoryInfo { unsigned char *directory; size_t entry; } DirectoryInfo; DirectoryInfo directory_stack[MaxDirectoryStack]; EndianType endian; size_t entry, length, number_entries; ssize_t id, level, offset; static int format_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8}; unsigned char *directory, *exif; /* Set EXIF resolution tag. */ length=GetStringInfoLength(profile); exif=GetStringInfoDatum(profile); if (length < 16) return(MagickFalse); id=(ssize_t) ReadProfileShort(LSBEndian,exif); if ((id != 0x4949) && (id != 0x4D4D)) { while (length != 0) { if (ReadProfileByte(&exif,&length) != 0x45) continue; if (ReadProfileByte(&exif,&length) != 0x78) continue; if (ReadProfileByte(&exif,&length) != 0x69) continue; if (ReadProfileByte(&exif,&length) != 0x66) continue; if (ReadProfileByte(&exif,&length) != 0x00) continue; if (ReadProfileByte(&exif,&length) != 0x00) continue; break; } if (length < 16) return(MagickFalse); id=(ssize_t) ReadProfileShort(LSBEndian,exif); } endian=LSBEndian; if (id == 0x4949) endian=LSBEndian; else if (id == 0x4D4D) endian=MSBEndian; else return(MagickFalse); if (ReadProfileShort(endian,exif+2) != 0x002a) return(MagickFalse); /* This the offset to the first IFD. */ offset=(ssize_t) ReadProfileLong(endian,exif+4); if ((offset < 0) || (size_t) offset >= length) return(MagickFalse); directory=exif+offset; level=0; entry=0; do { if (level > 0) { level--; directory=directory_stack[level].directory; entry=directory_stack[level].entry; } if ((directory < exif) || (directory > (exif+length-2))) break; /* Determine how many entries there are in the current IFD. */ number_entries=ReadProfileShort(endian,directory); for ( ; entry < number_entries; entry++) { int components; register unsigned char *p, *q; size_t number_bytes; ssize_t format, tag_value; q=(unsigned char *) (directory+2+(12*entry)); if (q > (exif+length-12)) break; /* corrupt EXIF */ tag_value=(ssize_t) ReadProfileShort(endian,q); format=(ssize_t) ReadProfileShort(endian,q+2); if ((format-1) >= EXIF_NUM_FORMATS) break; components=(ssize_t) ReadProfileLong(endian,q+4); if (components < 0) break; /* corrupt EXIF */ number_bytes=(size_t) components*format_bytes[format]; if ((ssize_t) number_bytes < components) break; /* prevent overflow */ if (number_bytes <= 4) p=q+8; else { /* The directory entry contains an offset. */ offset=(ssize_t) ReadProfileLong(endian,q+8); if ((size_t) (offset+number_bytes) > length) continue; if (~length < number_bytes) continue; /* prevent overflow */ p=(unsigned char *) (exif+offset); } switch (tag_value) { case 0x011a: { (void) WriteProfileLong(endian,(size_t) (image->resolution.x+0.5),p); (void) WriteProfileLong(endian,1UL,p+4); break; } case 0x011b: { (void) WriteProfileLong(endian,(size_t) (image->resolution.y+0.5),p); (void) WriteProfileLong(endian,1UL,p+4); break; } case 0x0112: { if (number_bytes == 4) { (void) WriteProfileLong(endian,(size_t) image->orientation,p); break; } (void) WriteProfileShort(endian,(unsigned short) image->orientation, p); break; } case 0x0128: { if (number_bytes == 4) { (void) WriteProfileLong(endian,(size_t) (image->units+1),p); break; } (void) WriteProfileShort(endian,(unsigned short) (image->units+1),p); break; } default: break; } if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET)) { offset=(ssize_t) ReadProfileLong(endian,p); if (((size_t) offset < length) && (level < (MaxDirectoryStack-2))) { directory_stack[level].directory=directory; entry++; directory_stack[level].entry=entry; level++; directory_stack[level].directory=exif+offset; directory_stack[level].entry=0; level++; if ((directory+2+(12*number_entries)) > (exif+length)) break; offset=(ssize_t) ReadProfileLong(endian,directory+2+(12* number_entries)); if ((offset != 0) && ((size_t) offset < length) && (level < (MaxDirectoryStack-2))) { directory_stack[level].directory=exif+offset; directory_stack[level].entry=0; level++; } } break; } } } while (level > 0); return(MagickTrue); } ",1 "void UtilityServiceFactory::RegisterServices(ServiceMap* services) { GetContentClient()->utility()->RegisterServices(services); service_manager::EmbeddedServiceInfo video_capture_info; video_capture_info.factory = base::Bind(&CreateVideoCaptureService); services->insert( std::make_pair(video_capture::mojom::kServiceName, video_capture_info)); #if BUILDFLAG(ENABLE_PEPPER_CDMS) service_manager::EmbeddedServiceInfo info; info.factory = base::Bind(&CreateMediaService); services->insert(std::make_pair(media::mojom::kMediaServiceName, info)); #endif service_manager::EmbeddedServiceInfo shape_detection_info; shape_detection_info.factory = base::Bind(&shape_detection::ShapeDetectionService::Create); services->insert(std::make_pair(shape_detection::mojom::kServiceName, shape_detection_info)); service_manager::EmbeddedServiceInfo data_decoder_info; data_decoder_info.factory = base::Bind(&CreateDataDecoderService); services->insert( std::make_pair(data_decoder::mojom::kServiceName, data_decoder_info)); if (base::FeatureList::IsEnabled(features::kNetworkService)) { GetContentClient()->utility()->RegisterNetworkBinders( network_registry_.get()); service_manager::EmbeddedServiceInfo network_info; network_info.factory = base::Bind( &UtilityServiceFactory::CreateNetworkService, base::Unretained(this)); network_info.task_runner = ChildProcess::current()->io_task_runner(); services->insert( std::make_pair(content::mojom::kNetworkServiceName, network_info)); } } ",1 "static int cryptd_blkcipher_init_tfm(struct crypto_tfm *tfm) { struct crypto_instance *inst = crypto_tfm_alg_instance(tfm); struct cryptd_instance_ctx *ictx = crypto_instance_ctx(inst); struct crypto_spawn *spawn = &ictx->spawn; struct cryptd_blkcipher_ctx *ctx = crypto_tfm_ctx(tfm); struct crypto_blkcipher *cipher; cipher = crypto_spawn_blkcipher(spawn); if (IS_ERR(cipher)) return PTR_ERR(cipher); ctx->child = cipher; tfm->crt_ablkcipher.reqsize = sizeof(struct cryptd_blkcipher_request_ctx); return 0; } ",0 "static NDIS_STATUS ParaNdis_VirtIONetInit(PARANDIS_ADAPTER *pContext) { NDIS_STATUS status = NDIS_STATUS_RESOURCES; DEBUG_ENTRY(0); UINT i; USHORT nVirtIOQueues = pContext->nHardwareQueues * 2 + 2; pContext->nPathBundles = DetermineQueueNumber(pContext); if (pContext->nPathBundles == 0) { DPrintf(0, (""[%s] - no I/O pathes\n"", __FUNCTION__)); return NDIS_STATUS_RESOURCES; } if (nVirtIOQueues > pContext->IODevice->maxQueues) { ULONG IODeviceSize = VirtIODeviceSizeRequired(nVirtIOQueues); NdisFreeMemoryWithTagPriority(pContext->MiniportHandle, pContext->IODevice, PARANDIS_MEMORY_TAG); pContext->IODevice = (VirtIODevice *)NdisAllocateMemoryWithTagPriority( pContext->MiniportHandle, IODeviceSize, PARANDIS_MEMORY_TAG, NormalPoolPriority); if (pContext->IODevice == nullptr) { DPrintf(0, (""[%s] - IODevice allocation failed\n"", __FUNCTION__)); return NDIS_STATUS_RESOURCES; } VirtIODeviceInitialize(pContext->IODevice, pContext->AdapterResources.ulIOAddress, IODeviceSize); VirtIODeviceSetMSIXUsed(pContext->IODevice, pContext->bUsingMSIX ? true : false); DPrintf(0, (""[%s] %u queues' slots reallocated for size %lu\n"", __FUNCTION__, pContext->IODevice->maxQueues, IODeviceSize)); } new (&pContext->CXPath, PLACEMENT_NEW) CParaNdisCX(); pContext->bCXPathAllocated = TRUE; if (!pContext->CXPath.Create(pContext, 2 * pContext->nHardwareQueues)) { DPrintf(0, (""[%s] The Control vQueue does not work!\n"", __FUNCTION__)); pContext->bHasHardwareFilters = FALSE; pContext->bCtrlMACAddrSupported = FALSE; } else { pContext->bCXPathCreated = TRUE; } pContext->pPathBundles = (CPUPathesBundle *)NdisAllocateMemoryWithTagPriority(pContext->MiniportHandle, pContext->nPathBundles * sizeof(*pContext->pPathBundles), PARANDIS_MEMORY_TAG, NormalPoolPriority); if (pContext->pPathBundles == nullptr) { DPrintf(0, (""[%s] Path bundles allocation failed\n"", __FUNCTION__)); return status; } for (i = 0; i < pContext->nPathBundles; i++) { new (pContext->pPathBundles + i, PLACEMENT_NEW) CPUPathesBundle(); if (!pContext->pPathBundles[i].rxPath.Create(pContext, i * 2)) { DPrintf(0, (""%s: CParaNdisRX creation failed\n"", __FUNCTION__)); return status; } pContext->pPathBundles[i].rxCreated = true; if (!pContext->pPathBundles[i].txPath.Create(pContext, i * 2 + 1)) { DPrintf(0, (""%s: CParaNdisTX creation failed\n"", __FUNCTION__)); return status; } pContext->pPathBundles[i].txCreated = true; } if (pContext->bCXPathCreated) { pContext->pPathBundles[0].cxPath = &pContext->CXPath; } status = NDIS_STATUS_SUCCESS; return status; } ",0 "static int rm_from_queue_full(sigset_t *mask, struct sigpending *s) { struct sigqueue *q, *n; sigset_t m; sigandsets(&m, mask, &s->signal); if (sigisemptyset(&m)) return 0; signandsets(&s->signal, &s->signal, mask); list_for_each_entry_safe(q, n, &s->list, list) { if (sigismember(mask, q->info.si_signo)) { list_del_init(&q->list); __sigqueue_free(q); } } return 1; } ",0 "int propagate_umount(struct list_head *list) { struct mount *mnt; list_for_each_entry_reverse(mnt, list, mnt_list) mark_umount_candidates(mnt); list_for_each_entry(mnt, list, mnt_list) __propagate_umount(mnt); return 0; } ",0 "dophn_core(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, size_t size, off_t fsize, int *flags, uint16_t *notecount) { Elf32_Phdr ph32; Elf64_Phdr ph64; size_t offset, len; unsigned char nbuf[BUFSIZ]; ssize_t bufsize; if (size != xph_sizeof) { if (file_printf(ms, "", corrupted program header size"") == -1) return -1; return 0; } /* * Loop through all the program headers. */ for ( ; num; num--) { if (pread(fd, xph_addr, xph_sizeof, off) < (ssize_t)xph_sizeof) { file_badread(ms); return -1; } off += size; if (fsize != SIZE_UNKNOWN && xph_offset > fsize) { /* Perhaps warn here */ continue; } if (xph_type != PT_NOTE) continue; /* * This is a PT_NOTE section; loop through all the notes * in the section. */ len = xph_filesz < sizeof(nbuf) ? xph_filesz : sizeof(nbuf); if ((bufsize = pread(fd, nbuf, len, xph_offset)) == -1) { file_badread(ms); return -1; } offset = 0; for (;;) { if (offset >= (size_t)bufsize) break; offset = donote(ms, nbuf, offset, (size_t)bufsize, clazz, swap, 4, flags, notecount); if (offset == 0) break; } } return 0; } ",0 "static void process_gitlink(struct rev_info *revs, const unsigned char *sha1, show_object_fn show, struct strbuf *path, const char *name, void *cb_data) { /* Nothing to do */ } ",0 "static unsigned int tower_poll (struct file *file, poll_table *wait) { struct lego_usb_tower *dev; unsigned int mask = 0; dev = file->private_data; if (!dev->udev) return POLLERR | POLLHUP; poll_wait(file, &dev->read_wait, wait); poll_wait(file, &dev->write_wait, wait); tower_check_for_read_packet(dev); if (dev->read_packet_length > 0) { mask |= POLLIN | POLLRDNORM; } if (!dev->interrupt_out_busy) { mask |= POLLOUT | POLLWRNORM; } return mask; } ",0 "XcursorLibraryPath (void) { static const char *path; if (!path) { path = getenv (""XCURSOR_PATH""); if (!path) path = XCURSORPATH; } return path; } ",0 "static Vector* visibleWebPages() { static Vector* s_visibleWebPages = 0; // Initially, no web page is visible. if (!s_visibleWebPages) s_visibleWebPages = new Vector; return s_visibleWebPages; } ",0 "static int dcbnl_getperm_hwaddr(struct net_device *netdev, struct nlmsghdr *nlh, u32 seq, struct nlattr **tb, struct sk_buff *skb) { u8 perm_addr[MAX_ADDR_LEN]; if (!netdev->dcbnl_ops->getpermhwaddr) return -EOPNOTSUPP; netdev->dcbnl_ops->getpermhwaddr(netdev, perm_addr); return nla_put(skb, DCB_ATTR_PERM_HWADDR, sizeof(perm_addr), perm_addr); } ",1 "int migrate_pages(struct list_head *from, new_page_t get_new_page, free_page_t put_new_page, unsigned long private, enum migrate_mode mode, int reason) { int retry = 1; int nr_failed = 0; int nr_succeeded = 0; int pass = 0; struct page *page; struct page *page2; int swapwrite = current->flags & PF_SWAPWRITE; int rc; if (!swapwrite) current->flags |= PF_SWAPWRITE; for(pass = 0; pass < 10 && retry; pass++) { retry = 0; list_for_each_entry_safe(page, page2, from, lru) { cond_resched(); if (PageHuge(page)) rc = unmap_and_move_huge_page(get_new_page, put_new_page, private, page, pass > 2, mode, reason); else rc = unmap_and_move(get_new_page, put_new_page, private, page, pass > 2, mode, reason); switch(rc) { case -ENOMEM: nr_failed++; goto out; case -EAGAIN: retry++; break; case MIGRATEPAGE_SUCCESS: nr_succeeded++; break; default: /* * Permanent failure (-EBUSY, -ENOSYS, etc.): * unlike -EAGAIN case, the failed page is * removed from migration page list and not * retried in the next outer loop. */ nr_failed++; break; } } } nr_failed += retry; rc = nr_failed; out: if (nr_succeeded) count_vm_events(PGMIGRATE_SUCCESS, nr_succeeded); if (nr_failed) count_vm_events(PGMIGRATE_FAIL, nr_failed); trace_mm_migrate_pages(nr_succeeded, nr_failed, mode, reason); if (!swapwrite) current->flags &= ~PF_SWAPWRITE; return rc; } ",0 "static EC_PRE_COMP *ec_pre_comp_new(const EC_GROUP *group) { EC_PRE_COMP *ret = NULL; if (!group) return NULL; ret = OPENSSL_zalloc(sizeof(*ret)); if (ret == NULL) { ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); return ret; } ret->group = group; ret->blocksize = 8; /* default */ ret->w = 4; /* default */ ret->references = 1; ret->lock = CRYPTO_THREAD_lock_new(); if (ret->lock == NULL) { ECerr(EC_F_EC_PRE_COMP_NEW, ERR_R_MALLOC_FAILURE); OPENSSL_free(ret); return NULL; } return ret; } ",0 "void AppLauncherHandler::HandleUninstallApp(const base::ListValue* args) { std::string extension_id; CHECK(args->GetString(0, &extension_id)); const Extension* extension = extension_service_->GetInstalledExtension( extension_id); if (!extension) return; if (!extensions::ExtensionSystem::Get(extension_service_->profile())-> management_policy()->UserMayModifySettings(extension, NULL)) { LOG(ERROR) << ""Attempt to uninstall an extension that is non-usermanagable "" << ""was made. Extension id : "" << extension->id(); return; } if (!extension_id_prompting_.empty()) return; // Only one prompt at a time. extension_id_prompting_ = extension_id; bool dont_confirm = false; if (args->GetBoolean(1, &dont_confirm) && dont_confirm) { base::AutoReset auto_reset(&ignore_changes_, true); ExtensionUninstallAccepted(); } else { GetExtensionUninstallDialog()->ConfirmUninstall(extension); } } ",0 "bool WebContentsImpl::IsHidden() { return !IsBeingCaptured() && visibility_ != Visibility::VISIBLE; } ",0 "void DesktopWindowTreeHostX11::SetOpacity(float opacity) { unsigned long opacity_8bit = static_cast(opacity * 255.0f) & 0xFF; const unsigned long channel_multiplier = 0x1010101; unsigned long cardinality = opacity_8bit * channel_multiplier; if (cardinality == 0xffffffff) { XDeleteProperty(xdisplay_, xwindow_, gfx::GetAtom(""_NET_WM_WINDOW_OPACITY"")); } else { XChangeProperty(xdisplay_, xwindow_, gfx::GetAtom(""_NET_WM_WINDOW_OPACITY""), XA_CARDINAL, 32, PropModeReplace, reinterpret_cast(&cardinality), 1); } } ",0 "static u8 tg3_resolve_flowctrl_1000X(u16 lcladv, u16 rmtadv) { u8 cap = 0; if (lcladv & rmtadv & ADVERTISE_1000XPAUSE) { cap = FLOW_CTRL_TX | FLOW_CTRL_RX; } else if (lcladv & rmtadv & ADVERTISE_1000XPSE_ASYM) { if (lcladv & ADVERTISE_1000XPAUSE) cap = FLOW_CTRL_RX; if (rmtadv & ADVERTISE_1000XPAUSE) cap = FLOW_CTRL_TX; } return cap; } ",0 "int uv__make_pipe(int fds[2], int flags) { #if defined(__linux__) static int no_pipe2; if (no_pipe2) goto skip; if (uv__pipe2(fds, flags | UV__O_CLOEXEC) == 0) return 0; if (errno != ENOSYS) return -errno; no_pipe2 = 1; skip: #endif if (pipe(fds)) return -errno; uv__cloexec(fds[0], 1); uv__cloexec(fds[1], 1); if (flags & UV__F_NONBLOCK) { uv__nonblock(fds[0], 1); uv__nonblock(fds[1], 1); } return 0; } ",0 "static int cpuacct_populate(struct cgroup_subsys *ss, struct cgroup *cgrp) { return cgroup_add_files(cgrp, ss, files, ARRAY_SIZE(files)); } ",0 "static int fuse_writepage(struct page *page, struct writeback_control *wbc) { int err; err = fuse_writepage_locked(page); unlock_page(page); return err; } ",0 " void CastCastView::ButtonPressed(views::Button* sender, const ui::Event& event) { DCHECK(sender == stop_button_); StopCast(); } ",1 "void HTMLMediaElement::timeChanged() { BLINK_MEDIA_LOG << ""timeChanged("" << (void*)this << "")""; cueTimeline().updateActiveCues(currentTime()); if (m_seeking && m_readyState >= kHaveCurrentData && !webMediaPlayer()->seeking()) finishSeek(); scheduleTimeupdateEvent(false); double now = currentPlaybackPosition(); double dur = duration(); if (!std::isnan(dur) && dur && now >= dur && getDirectionOfPlayback() == Forward) { if (loop()) { seek(earliestPossiblePosition()); } else { if (!m_paused) { m_paused = true; scheduleEvent(EventTypeNames::pause); scheduleRejectPlayPromises(AbortError); } scheduleEvent(EventTypeNames::ended); } } updatePlayState(); } ",0 "void __audit_mq_getsetattr(mqd_t mqdes, struct mq_attr *mqstat) { struct audit_context *context = current->audit_context; context->mq_getsetattr.mqdes = mqdes; context->mq_getsetattr.mqstat = *mqstat; context->type = AUDIT_MQ_GETSETATTR; } ",0 "bool RenderThreadImpl::OnControlMessageReceived(const IPC::Message& msg) { ObserverListBase::Iterator it(observers_); RenderProcessObserver* observer; while ((observer = it.GetNext()) != NULL) { if (observer->OnControlMessageReceived(msg)) return true; } if (appcache_dispatcher_->OnMessageReceived(msg)) return true; bool handled = true; IPC_BEGIN_MESSAGE_MAP(RenderThreadImpl, msg) IPC_MESSAGE_HANDLER(ViewMsg_SetZoomLevelForCurrentURL, OnSetZoomLevelForCurrentURL) IPC_MESSAGE_HANDLER(ViewMsg_SetCSSColors, OnSetCSSColors) IPC_MESSAGE_HANDLER(ViewMsg_New, OnCreateNewView) IPC_MESSAGE_HANDLER(ViewMsg_PurgePluginListCache, OnPurgePluginListCache) IPC_MESSAGE_HANDLER(ViewMsg_NetworkStateChanged, OnNetworkStateChanged) IPC_MESSAGE_HANDLER(DOMStorageMsg_Event, OnDOMStorageEvent) IPC_MESSAGE_HANDLER(ViewMsg_TempCrashWithData, OnTempCrashWithData) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() return handled; } ",0 "void SoftVideoDecoderOMXComponent::copyYV12FrameToOutputBuffer( uint8_t *dst, const uint8_t *srcY, const uint8_t *srcU, const uint8_t *srcV, size_t srcYStride, size_t srcUStride, size_t srcVStride) { size_t dstYStride = outputBufferWidth(); size_t dstUVStride = dstYStride / 2; size_t dstHeight = outputBufferHeight(); uint8_t *dstStart = dst; for (size_t i = 0; i < mHeight; ++i) { memcpy(dst, srcY, mWidth); srcY += srcYStride; dst += dstYStride; } dst = dstStart + dstYStride * dstHeight; for (size_t i = 0; i < mHeight / 2; ++i) { memcpy(dst, srcU, mWidth / 2); srcU += srcUStride; dst += dstUVStride; } dst = dstStart + (5 * dstYStride * dstHeight) / 4; for (size_t i = 0; i < mHeight / 2; ++i) { memcpy(dst, srcV, mWidth / 2); srcV += srcVStride; dst += dstUVStride; } } ",0 "void AutofillManager::DisambiguateAddressUploadTypes(FormStructure* form, size_t current_index) { ServerFieldTypeSet matching_types; size_t next_index = current_index + 1; if (next_index < form->field_count() && form->field(next_index)->Type().GetStorableType() == ADDRESS_HOME_LINE2 && form->field(next_index)->possible_types().count(EMPTY_TYPE)) { matching_types.insert(ADDRESS_HOME_LINE1); } else { matching_types.insert(ADDRESS_HOME_STREET_ADDRESS); } AutofillField* field = form->field(current_index); field->set_possible_types(matching_types); } ",0 "zone_set_bounds(int zone_index, rect_t bounds) { struct map_zone* zone; zone = vector_get(s_map->zones, zone_index); rect_normalize(&bounds); zone->bounds = bounds; } ",0 "otp_init(krb5_context context, krb5_kdcpreauth_moddata *moddata_out, const char **realmnames) { krb5_error_code retval; otp_state *state; retval = otp_state_new(context, &state); if (retval) return retval; *moddata_out = (krb5_kdcpreauth_moddata)state; return 0; } ",0 "bgp_notification_print(netdissect_options *ndo, const u_char *dat, int length) { struct bgp_notification bgpn; const u_char *tptr; uint8_t shutdown_comm_length; uint8_t remainder_offset; ND_TCHECK2(dat[0], BGP_NOTIFICATION_SIZE); memcpy(&bgpn, dat, BGP_NOTIFICATION_SIZE); /* some little sanity checking */ if (length= BGP_NOTIFICATION_SIZE + 7) { tptr = dat + BGP_NOTIFICATION_SIZE; ND_TCHECK2(*tptr, 7); ND_PRINT((ndo, "", AFI %s (%u), SAFI %s (%u), Max Prefixes: %u"", tok2str(af_values, ""Unknown"", EXTRACT_16BITS(tptr)), EXTRACT_16BITS(tptr), tok2str(bgp_safi_values, ""Unknown"", *(tptr+2)), *(tptr+2), EXTRACT_32BITS(tptr+3))); } /* * draft-ietf-idr-shutdown describes a method to send a communication * intended for human consumption regarding the Administrative Shutdown */ if ((bgpn.bgpn_minor == BGP_NOTIFY_MINOR_CEASE_SHUT || bgpn.bgpn_minor == BGP_NOTIFY_MINOR_CEASE_RESET) && length >= BGP_NOTIFICATION_SIZE + 1) { tptr = dat + BGP_NOTIFICATION_SIZE; ND_TCHECK2(*tptr, 1); shutdown_comm_length = *(tptr); remainder_offset = 0; /* garbage, hexdump it all */ if (shutdown_comm_length > BGP_NOTIFY_MINOR_CEASE_ADMIN_SHUTDOWN_LEN || shutdown_comm_length > length - (BGP_NOTIFICATION_SIZE + 1)) { ND_PRINT((ndo, "", invalid Shutdown Communication length"")); } else if (shutdown_comm_length == 0) { ND_PRINT((ndo, "", empty Shutdown Communication"")); remainder_offset += 1; } /* a proper shutdown communication */ else { ND_TCHECK2(*(tptr+1), shutdown_comm_length); ND_PRINT((ndo, "", Shutdown Communication (length: %u): \"""", shutdown_comm_length)); (void)fn_printn(ndo, tptr+1, shutdown_comm_length, NULL); ND_PRINT((ndo, ""\"""")); remainder_offset += shutdown_comm_length + 1; } /* if there is trailing data, hexdump it */ if(length - (remainder_offset + BGP_NOTIFICATION_SIZE) > 0) { ND_PRINT((ndo, "", Data: (length: %u)"", length - (remainder_offset + BGP_NOTIFICATION_SIZE))); hex_print(ndo, ""\n\t\t"", tptr + remainder_offset, length - (remainder_offset + BGP_NOTIFICATION_SIZE)); } } break; default: break; } return; trunc: ND_PRINT((ndo, ""[|BGP]"")); } ",0 "xsltGetKey(xsltTransformContextPtr ctxt, const xmlChar *name, const xmlChar *nameURI, const xmlChar *value) { xmlNodeSetPtr ret; xsltKeyTablePtr table; int init_table = 0; if ((ctxt == NULL) || (name == NULL) || (value == NULL) || (ctxt->document == NULL)) return(NULL); #ifdef WITH_XSLT_DEBUG_KEYS xsltGenericDebug(xsltGenericDebugContext, ""Get key %s, value %s\n"", name, value); #endif /* * keys are computed only on-demand on first key access for a document */ if ((ctxt->document->nbKeysComputed < ctxt->nbKeys) && (ctxt->keyInitLevel == 0)) { /* * If non-recursive behaviour, just try to initialize all keys */ if (xsltInitAllDocKeys(ctxt)) return(NULL); } retry: table = (xsltKeyTablePtr) ctxt->document->keys; while (table != NULL) { if (((nameURI != NULL) == (table->nameURI != NULL)) && xmlStrEqual(table->name, name) && xmlStrEqual(table->nameURI, nameURI)) { ret = (xmlNodeSetPtr)xmlHashLookup(table->keys, value); return(ret); } table = table->next; } if ((ctxt->keyInitLevel != 0) && (init_table == 0)) { /* * Apparently one key is recursive and this one is needed, * initialize just it, that time and retry */ xsltInitDocKeyTable(ctxt, name, nameURI); init_table = 1; goto retry; } return(NULL); } ",0 "Strcat_charp(Str x, const char *y) { if (y == NULL) return; Strcat_charp_n(x, y, strlen(y)); } ",0 "static int uio_release(struct inode *inode, struct file *filep) { int ret = 0; struct uio_listener *listener = filep->private_data; struct uio_device *idev = listener->dev; if (idev->info->release) ret = idev->info->release(idev->info, inode); module_put(idev->owner); kfree(listener); return ret; } ",0 "SampleTable::SampleTable(const sp &source) : mDataSource(source), mChunkOffsetOffset(-1), mChunkOffsetType(0), mNumChunkOffsets(0), mSampleToChunkOffset(-1), mNumSampleToChunkOffsets(0), mSampleSizeOffset(-1), mSampleSizeFieldSize(0), mDefaultSampleSize(0), mNumSampleSizes(0), mTimeToSampleCount(0), mTimeToSample(), mSampleTimeEntries(NULL), mCompositionTimeDeltaEntries(NULL), mNumCompositionTimeDeltaEntries(0), mCompositionDeltaLookup(new CompositionDeltaLookup), mSyncSampleOffset(-1), mNumSyncSamples(0), mSyncSamples(NULL), mLastSyncSampleIndex(0), mSampleToChunkEntries(NULL) { mSampleIterator = new SampleIterator(this); } ",1 "void GraphicsContext::setImageInterpolationQuality(InterpolationQuality q) { platformContext()->setInterpolationQuality(q); } ",0 "int xt_check_target(struct xt_tgchk_param *par, unsigned int size, u_int8_t proto, bool inv_proto) { int ret; if (XT_ALIGN(par->target->targetsize) != size) { pr_err(""%s_tables: %s.%u target: invalid size "" ""%u (kernel) != (user) %u\n"", xt_prefix[par->family], par->target->name, par->target->revision, XT_ALIGN(par->target->targetsize), size); return -EINVAL; } if (par->target->table != NULL && strcmp(par->target->table, par->table) != 0) { pr_err(""%s_tables: %s target: only valid in %s table, not %s\n"", xt_prefix[par->family], par->target->name, par->target->table, par->table); return -EINVAL; } if (par->target->hooks && (par->hook_mask & ~par->target->hooks) != 0) { char used[64], allow[64]; pr_err(""%s_tables: %s target: used from hooks %s, but only "" ""usable from %s\n"", xt_prefix[par->family], par->target->name, textify_hooks(used, sizeof(used), par->hook_mask, par->family), textify_hooks(allow, sizeof(allow), par->target->hooks, par->family)); return -EINVAL; } if (par->target->proto && (par->target->proto != proto || inv_proto)) { pr_err(""%s_tables: %s target: only valid for protocol %u\n"", xt_prefix[par->family], par->target->name, par->target->proto); return -EINVAL; } if (par->target->checkentry != NULL) { ret = par->target->checkentry(par); if (ret < 0) return ret; else if (ret > 0) /* Flag up potential errors. */ return -EIO; } return 0; } ",0 "void RenderProcessHostImpl::Resume() {} ",0 "void HTMLFormControlElement::dispatchBlurEvent(Element* newFocusedElement, WebFocusType type, InputDeviceCapabilities* sourceCapabilities) { if (type != WebFocusTypePage) m_wasFocusedByMouse = false; HTMLElement::dispatchBlurEvent(newFocusedElement, type, sourceCapabilities); hideVisibleValidationMessage(); } ",0 "PassScriptInstance ScriptController::createScriptInstanceForWidget(Widget* widget) { ASSERT(widget); if (!widget->isPluginView()) return 0; NPObject* npObject = toPluginView(widget)->scriptableObject(); if (!npObject) return 0; v8::Local wrapper = createV8ObjectForNPObject(npObject, 0); m_pluginObjects.set(widget, npObject); return V8ScriptInstance::create(wrapper); } ",0 " DownloadController::GetJavaObject() { if (!java_object_) { JNIEnv* env = base::android::AttachCurrentThread(); Java_DownloadController_getInstance(env); } DCHECK(java_object_); return java_object_; } ",0 "DEFUN(susp, INTERRUPT SUSPEND, ""Suspend w3m to background"") { #ifndef SIGSTOP char *shell; #endif /* not SIGSTOP */ move(LASTLINE, 0); clrtoeolx(); refresh(); fmTerm(); #ifndef SIGSTOP shell = getenv(""SHELL""); if (shell == NULL) shell = ""/bin/sh""; system(shell); #else /* SIGSTOP */ #ifdef SIGTSTP signal(SIGTSTP, SIG_DFL); /* just in case */ /* * Note: If susp() was called from SIGTSTP handler, * unblocking SIGTSTP would be required here. * Currently not. */ kill(0, SIGTSTP); /* stop whole job, not a single process */ #else kill((pid_t) 0, SIGSTOP); #endif #endif /* SIGSTOP */ fmInit(); displayBuffer(Currentbuf, B_FORCE_REDRAW); } ",0 "void BlobURLRequestJob::AdvanceBytesRead(int result) { DCHECK_GT(result, 0); current_item_offset_ += result; if (current_item_offset_ == item_length_list_[item_index_]) AdvanceItem(); remaining_bytes_ -= result; DCHECK_GE(remaining_bytes_, 0); read_buf_offset_ += result; read_buf_remaining_bytes_ -= result; DCHECK_GE(read_buf_remaining_bytes_, 0); } ",0 "const String& ContentSecurityPolicy::GetSelfProtocol() const { return self_protocol_; } ",0 "box_poly(PG_FUNCTION_ARGS) { BOX *box = PG_GETARG_BOX_P(0); POLYGON *poly; int size; /* map four corners of the box to a polygon */ size = offsetof(POLYGON, p[0]) +sizeof(poly->p[0]) * 4; poly = (POLYGON *) palloc(size); SET_VARSIZE(poly, size); poly->npts = 4; poly->p[0].x = box->low.x; poly->p[0].y = box->low.y; poly->p[1].x = box->low.x; poly->p[1].y = box->high.y; poly->p[2].x = box->high.x; poly->p[2].y = box->high.y; poly->p[3].x = box->high.x; poly->p[3].y = box->low.y; box_fill(&poly->boundbox, box->high.x, box->low.x, box->high.y, box->low.y); PG_RETURN_POLYGON_P(poly); } ",0 "float WebPageProxy::footerHeight(WebFrameProxy* frame) { return m_uiClient.footerHeight(this, frame); } ",0 "void RenderWidgetHostImpl::ProcessWheelAck(bool processed) { mouse_wheel_pending_ = false; if (overscroll_controller_.get()) overscroll_controller_->ReceivedEventACK(current_wheel_event_, processed); if (!coalesced_mouse_wheel_events_.empty()) { WebMouseWheelEvent next_wheel_event = coalesced_mouse_wheel_events_.front(); coalesced_mouse_wheel_events_.pop_front(); ForwardWheelEvent(next_wheel_event); } if (!processed && !is_hidden_ && view_) view_->UnhandledWheelEvent(current_wheel_event_); } ",0 "static loff_t null_lseek(struct file *file, loff_t offset, int orig) { return file->f_pos = 0; } ",0 "static void free_thread_info(struct thread_info *ti) { kmem_cache_free(thread_info_cache, ti); } ",0 "static void vmci_transport_destruct(struct vsock_sock *vsk) { if (vmci_trans(vsk)->attach_sub_id != VMCI_INVALID_ID) { vmci_event_unsubscribe(vmci_trans(vsk)->attach_sub_id); vmci_trans(vsk)->attach_sub_id = VMCI_INVALID_ID; } if (vmci_trans(vsk)->detach_sub_id != VMCI_INVALID_ID) { vmci_event_unsubscribe(vmci_trans(vsk)->detach_sub_id); vmci_trans(vsk)->detach_sub_id = VMCI_INVALID_ID; } if (!vmci_handle_is_invalid(vmci_trans(vsk)->qp_handle)) { vmci_qpair_detach(&vmci_trans(vsk)->qpair); vmci_trans(vsk)->qp_handle = VMCI_INVALID_HANDLE; vmci_trans(vsk)->produce_size = 0; vmci_trans(vsk)->consume_size = 0; } if (vmci_trans(vsk)->notify_ops) vmci_trans(vsk)->notify_ops->socket_destruct(vsk); kfree(vsk->trans); vsk->trans = NULL; } ",0 "bool WebGraphicsContext3DCommandBufferImpl::IsCommandBufferContextLost() { if (host_ && host_->state() == GpuChannelHost::kLost) return true; gpu::CommandBuffer::State state = command_buffer_->GetLastState(); return state.error == gpu::error::kLostContext; } ",0 "void AudioRendererHost::OnCreateStream(int stream_id, int render_frame_id, const media::AudioParameters& params) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DVLOG(1) << ""AudioRendererHost@"" << this << ""::OnCreateStream"" << ""(stream_id="" << stream_id << "")""; std::string device_unique_id; const auto& auth_data = authorizations_.find(stream_id); if (auth_data != authorizations_.end()) { if (!auth_data->second.first) { content::bad_message::ReceivedBadMessage( this, bad_message::ARH_CREATED_STREAM_WITHOUT_AUTHORIZATION); return; } device_unique_id.swap(auth_data->second.second); authorizations_.erase(auth_data); } if (LookupById(stream_id)) { SendErrorMessage(stream_id); return; } if (render_frame_id <= 0) { SendErrorMessage(stream_id); return; } BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(validate_render_frame_id_function_, render_process_id_, render_frame_id, base::Bind(&AudioRendererHost::DidValidateRenderFrame, this, stream_id))); MediaObserver* const media_observer = GetContentClient()->browser()->GetMediaObserver(); MediaInternals* const media_internals = MediaInternals::GetInstance(); std::unique_ptr audio_log = media_internals->CreateAudioLog( media::AudioLogFactory::AUDIO_OUTPUT_CONTROLLER); media_internals->SetWebContentsTitleForAudioLogEntry( stream_id, render_process_id_, render_frame_id, audio_log.get()); delegates_.push_back( base::WrapUnique(new AudioOutputDelegateImpl( this, audio_manager_, std::move(audio_log), mirroring_manager_, media_observer, stream_id, render_frame_id, render_process_id_, params, device_unique_id))); } ",0 "static netdev_tx_t gs_can_start_xmit(struct sk_buff *skb, struct net_device *netdev) { struct gs_can *dev = netdev_priv(netdev); struct net_device_stats *stats = &dev->netdev->stats; struct urb *urb; struct gs_host_frame *hf; struct can_frame *cf; int rc; unsigned int idx; struct gs_tx_context *txc; if (can_dropped_invalid_skb(netdev, skb)) return NETDEV_TX_OK; /* find an empty context to keep track of transmission */ txc = gs_alloc_tx_context(dev); if (!txc) return NETDEV_TX_BUSY; /* create a URB, and a buffer for it */ urb = usb_alloc_urb(0, GFP_ATOMIC); if (!urb) goto nomem_urb; hf = usb_alloc_coherent(dev->udev, sizeof(*hf), GFP_ATOMIC, &urb->transfer_dma); if (!hf) { netdev_err(netdev, ""No memory left for USB buffer\n""); goto nomem_hf; } idx = txc->echo_id; if (idx >= GS_MAX_TX_URBS) { netdev_err(netdev, ""Invalid tx context %d\n"", idx); goto badidx; } hf->echo_id = idx; hf->channel = dev->channel; cf = (struct can_frame *)skb->data; hf->can_id = cf->can_id; hf->can_dlc = cf->can_dlc; memcpy(hf->data, cf->data, cf->can_dlc); usb_fill_bulk_urb(urb, dev->udev, usb_sndbulkpipe(dev->udev, GSUSB_ENDPOINT_OUT), hf, sizeof(*hf), gs_usb_xmit_callback, txc); urb->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; usb_anchor_urb(urb, &dev->tx_submitted); can_put_echo_skb(skb, netdev, idx); atomic_inc(&dev->active_tx_urbs); rc = usb_submit_urb(urb, GFP_ATOMIC); if (unlikely(rc)) { /* usb send failed */ atomic_dec(&dev->active_tx_urbs); can_free_echo_skb(netdev, idx); gs_free_tx_context(txc); usb_unanchor_urb(urb); usb_free_coherent(dev->udev, sizeof(*hf), hf, urb->transfer_dma); if (rc == -ENODEV) { netif_device_detach(netdev); } else { netdev_err(netdev, ""usb_submit failed (err=%d)\n"", rc); stats->tx_dropped++; } } else { /* Slow down tx path */ if (atomic_read(&dev->active_tx_urbs) >= GS_MAX_TX_URBS) netif_stop_queue(netdev); } /* let usb core take care of this urb */ usb_free_urb(urb); return NETDEV_TX_OK; badidx: usb_free_coherent(dev->udev, sizeof(*hf), hf, urb->transfer_dma); nomem_hf: usb_free_urb(urb); nomem_urb: gs_free_tx_context(txc); dev_kfree_skb(skb); stats->tx_dropped++; return NETDEV_TX_OK; } ",0 "LIBOPENMPT_MODPLUG_API char ModPlug_ExportXM(ModPlugFile* file, const char* filepath) { (void)file; /* not implemented */ fprintf(stderr,""libopenmpt-modplug: error: ModPlug_ExportXM(%s) not implemented.\n"",filepath); return 0; } ",0 "FloatRect ChromeClientImpl::pageRect() { return windowRect(); } ",0 "void SystemClipboard::WriteDataObject(DataObject* data_object) { HashMap custom_data; WebDragData data = data_object->ToWebDragData(); for (const WebDragData::Item& item : data.Items()) { if (item.storage_type == WebDragData::Item::kStorageTypeString) { if (item.string_type == blink::kMimeTypeTextPlain) { clipboard_->WriteText(mojom::ClipboardBuffer::kStandard, NonNullString(item.string_data)); } else if (item.string_type == blink::kMimeTypeTextHTML) { clipboard_->WriteHtml(mojom::ClipboardBuffer::kStandard, NonNullString(item.string_data), KURL()); } else if (item.string_type != blink::kMimeTypeDownloadURL) { custom_data.insert(item.string_type, NonNullString(item.string_data)); } } } if (!custom_data.IsEmpty()) { clipboard_->WriteCustomData(mojom::ClipboardBuffer::kStandard, std::move(custom_data)); } clipboard_->CommitWrite(mojom::ClipboardBuffer::kStandard); } ",0 "GSList *gslist_remove_string (GSList *list, const char *str) { GSList *l; l = g_slist_find_custom(list, str, (GCompareFunc) g_strcmp0); if (l != NULL) return g_slist_remove_link(list, l); return list; } ",0 "static int __init i8042_check_aux(void) { int retval = -1; bool irq_registered = false; bool aux_loop_broken = false; unsigned long flags; unsigned char param; /* * Get rid of bytes in the queue. */ i8042_flush(); /* * Internal loopback test - filters out AT-type i8042's. Unfortunately * SiS screwed up and their 5597 doesn't support the LOOP command even * though it has an AUX port. */ param = 0x5a; retval = i8042_command(¶m, I8042_CMD_AUX_LOOP); if (retval || param != 0x5a) { /* * External connection test - filters out AT-soldered PS/2 i8042's * 0x00 - no error, 0x01-0x03 - clock/data stuck, 0xff - general error * 0xfa - no error on some notebooks which ignore the spec * Because it's common for chipsets to return error on perfectly functioning * AUX ports, we test for this only when the LOOP command failed. */ if (i8042_command(¶m, I8042_CMD_AUX_TEST) || (param && param != 0xfa && param != 0xff)) return -1; /* * If AUX_LOOP completed without error but returned unexpected data * mark it as broken */ if (!retval) aux_loop_broken = true; } /* * Bit assignment test - filters out PS/2 i8042's in AT mode */ if (i8042_toggle_aux(false)) { pr_warn(""Failed to disable AUX port, but continuing anyway... Is this a SiS?\n""); pr_warn(""If AUX port is really absent please use the 'i8042.noaux' option\n""); } if (i8042_toggle_aux(true)) return -1; /* * Reset keyboard (needed on some laptops to successfully detect * touchpad, e.g., some Gigabyte laptop models with Elantech * touchpads). */ if (i8042_kbdreset) { pr_warn(""Attempting to reset device connected to KBD port\n""); i8042_kbd_write(NULL, (unsigned char) 0xff); } /* * Test AUX IRQ delivery to make sure BIOS did not grab the IRQ and * used it for a PCI card or somethig else. */ if (i8042_noloop || i8042_bypass_aux_irq_test || aux_loop_broken) { /* * Without LOOP command we can't test AUX IRQ delivery. Assume the port * is working and hope we are right. */ retval = 0; goto out; } if (request_irq(I8042_AUX_IRQ, i8042_aux_test_irq, IRQF_SHARED, ""i8042"", i8042_platform_device)) goto out; irq_registered = true; if (i8042_enable_aux_port()) goto out; spin_lock_irqsave(&i8042_lock, flags); init_completion(&i8042_aux_irq_delivered); i8042_irq_being_tested = true; param = 0xa5; retval = __i8042_command(¶m, I8042_CMD_AUX_LOOP & 0xf0ff); spin_unlock_irqrestore(&i8042_lock, flags); if (retval) goto out; if (wait_for_completion_timeout(&i8042_aux_irq_delivered, msecs_to_jiffies(250)) == 0) { /* * AUX IRQ was never delivered so we need to flush the controller to * get rid of the byte we put there; otherwise keyboard may not work. */ dbg("" -- i8042 (aux irq test timeout)\n""); i8042_flush(); retval = -1; } out: /* * Disable the interface. */ i8042_ctr |= I8042_CTR_AUXDIS; i8042_ctr &= ~I8042_CTR_AUXINT; if (i8042_command(&i8042_ctr, I8042_CMD_CTL_WCTR)) retval = -1; if (irq_registered) free_irq(I8042_AUX_IRQ, i8042_platform_device); return retval; } ",0 "int GfxColorSpace::getNumColorSpaceModes() { return nGfxColorSpaceModes; } ",0 "void BrowserActionButton::ButtonPressed( views::Button* sender, const views::Event& event) { panel_->OnBrowserActionExecuted(this); } ",0 "status_t FLACParser::init() { mDecoder = FLAC__stream_decoder_new(); if (mDecoder == NULL) { ALOGE(""new failed""); return NO_INIT; } FLAC__stream_decoder_set_md5_checking(mDecoder, false); FLAC__stream_decoder_set_metadata_ignore_all(mDecoder); FLAC__stream_decoder_set_metadata_respond( mDecoder, FLAC__METADATA_TYPE_STREAMINFO); FLAC__stream_decoder_set_metadata_respond( mDecoder, FLAC__METADATA_TYPE_PICTURE); FLAC__stream_decoder_set_metadata_respond( mDecoder, FLAC__METADATA_TYPE_VORBIS_COMMENT); FLAC__StreamDecoderInitStatus initStatus; initStatus = FLAC__stream_decoder_init_stream( mDecoder, read_callback, seek_callback, tell_callback, length_callback, eof_callback, write_callback, metadata_callback, error_callback, (void *) this); if (initStatus != FLAC__STREAM_DECODER_INIT_STATUS_OK) { ALOGE(""init_stream failed %d"", initStatus); return NO_INIT; } if (!FLAC__stream_decoder_process_until_end_of_metadata(mDecoder)) { ALOGE(""end_of_metadata failed""); return NO_INIT; } if (mStreamInfoValid) { if (getChannels() == 0 || getChannels() > 8) { ALOGE(""unsupported channel count %u"", getChannels()); return NO_INIT; } switch (getBitsPerSample()) { case 8: case 16: case 24: break; default: ALOGE(""unsupported bits per sample %u"", getBitsPerSample()); return NO_INIT; } switch (getSampleRate()) { case 8000: case 11025: case 12000: case 16000: case 22050: case 24000: case 32000: case 44100: case 48000: case 88200: case 96000: break; default: ALOGE(""unsupported sample rate %u"", getSampleRate()); return NO_INIT; } static const struct { unsigned mChannels; unsigned mBitsPerSample; void (*mCopy)(short *dst, const int *const *src, unsigned nSamples, unsigned nChannels); } table[] = { { 1, 8, copyMono8 }, { 2, 8, copyStereo8 }, { 8, 8, copyMultiCh8 }, { 1, 16, copyMono16 }, { 2, 16, copyStereo16 }, { 8, 16, copyMultiCh16 }, { 1, 24, copyMono24 }, { 2, 24, copyStereo24 }, { 8, 24, copyMultiCh24 }, }; for (unsigned i = 0; i < sizeof(table)/sizeof(table[0]); ++i) { if (table[i].mChannels >= getChannels() && table[i].mBitsPerSample == getBitsPerSample()) { mCopy = table[i].mCopy; break; } } if (mTrackMetadata != 0) { mTrackMetadata->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_RAW); mTrackMetadata->setInt32(kKeyChannelCount, getChannels()); mTrackMetadata->setInt32(kKeySampleRate, getSampleRate()); mTrackMetadata->setInt32(kKeyPcmEncoding, kAudioEncodingPcm16bit); mTrackMetadata->setInt64(kKeyDuration, (getTotalSamples() * 1000000LL) / getSampleRate()); } } else { ALOGE(""missing STREAMINFO""); return NO_INIT; } if (mFileMetadata != 0) { mFileMetadata->setCString(kKeyMIMEType, MEDIA_MIMETYPE_AUDIO_FLAC); } return OK; } ",1 "int __init igmp_mc_proc_init(void) { return register_pernet_subsys(&igmp_net_ops); } ",0 "xfs_attr3_leaf_toosmall( struct xfs_da_state *state, int *action) { struct xfs_attr_leafblock *leaf; struct xfs_da_state_blk *blk; struct xfs_attr3_icleaf_hdr ichdr; struct xfs_buf *bp; xfs_dablk_t blkno; int bytes; int forward; int error; int retval; int i; trace_xfs_attr_leaf_toosmall(state->args); /* * Check for the degenerate case of the block being over 50% full. * If so, it's not worth even looking to see if we might be able * to coalesce with a sibling. */ blk = &state->path.blk[ state->path.active-1 ]; leaf = blk->bp->b_addr; xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr, leaf); bytes = xfs_attr3_leaf_hdr_size(leaf) + ichdr.count * sizeof(xfs_attr_leaf_entry_t) + ichdr.usedbytes; if (bytes > (state->args->geo->blksize >> 1)) { *action = 0; /* blk over 50%, don't try to join */ return 0; } /* * Check for the degenerate case of the block being empty. * If the block is empty, we'll simply delete it, no need to * coalesce it with a sibling block. We choose (arbitrarily) * to merge with the forward block unless it is NULL. */ if (ichdr.count == 0) { /* * Make altpath point to the block we want to keep and * path point to the block we want to drop (this one). */ forward = (ichdr.forw != 0); memcpy(&state->altpath, &state->path, sizeof(state->path)); error = xfs_da3_path_shift(state, &state->altpath, forward, 0, &retval); if (error) return error; if (retval) { *action = 0; } else { *action = 2; } return 0; } /* * Examine each sibling block to see if we can coalesce with * at least 25% free space to spare. We need to figure out * whether to merge with the forward or the backward block. * We prefer coalescing with the lower numbered sibling so as * to shrink an attribute list over time. */ /* start with smaller blk num */ forward = ichdr.forw < ichdr.back; for (i = 0; i < 2; forward = !forward, i++) { struct xfs_attr3_icleaf_hdr ichdr2; if (forward) blkno = ichdr.forw; else blkno = ichdr.back; if (blkno == 0) continue; error = xfs_attr3_leaf_read(state->args->trans, state->args->dp, blkno, -1, &bp); if (error) return error; xfs_attr3_leaf_hdr_from_disk(state->args->geo, &ichdr2, bp->b_addr); bytes = state->args->geo->blksize - (state->args->geo->blksize >> 2) - ichdr.usedbytes - ichdr2.usedbytes - ((ichdr.count + ichdr2.count) * sizeof(xfs_attr_leaf_entry_t)) - xfs_attr3_leaf_hdr_size(leaf); xfs_trans_brelse(state->args->trans, bp); if (bytes >= 0) break; /* fits with at least 25% to spare */ } if (i >= 2) { *action = 0; return 0; } /* * Make altpath point to the block we want to keep (the lower * numbered block) and path point to the block we want to drop. */ memcpy(&state->altpath, &state->path, sizeof(state->path)); if (blkno < blk->blkno) { error = xfs_da3_path_shift(state, &state->altpath, forward, 0, &retval); } else { error = xfs_da3_path_shift(state, &state->path, forward, 0, &retval); } if (error) return error; if (retval) { *action = 0; } else { *action = 1; } return 0; } ",0 " GestureEventForTest(int x, int y, ui::GestureEventDetails details) : GestureEvent(x, y, 0, base::TimeTicks(), details) {} ",0 "fmov_mem_reg(struct sh_fpu_soft_struct *fregs, struct pt_regs *regs, int m, int n) { if (FPSCR_SZ) { FMOV_EXT(n); READ(FRn, Rm + 4); n++; READ(FRn, Rm); } else { READ(FRn, Rm); } return 0; } ",0 "ssize_t MediaPlayerService::AudioOutput::channelCount() const { Mutex::Autolock lock(mLock); if (mTrack == 0) return NO_INIT; return mTrack->channelCount(); } ",0 " Ins_JROT( INS_ARG ) { DO_JROT } ",0 "static enum test_return test_binary_appendq(void) { return test_binary_concat_impl(""test_binary_appendq"", PROTOCOL_BINARY_CMD_APPENDQ); } ",0 "release_context (compress_filter_context_t *ctx) { xfree (ctx); } ",0 "long PKCS7_ctrl(PKCS7 *p7, int cmd, long larg, char *parg) { int nid; long ret; nid = OBJ_obj2nid(p7->type); switch (cmd) { case PKCS7_OP_SET_DETACHED_SIGNATURE: if (nid == NID_pkcs7_signed) { ret = p7->detached = (int)larg; ASN1_OCTET_STRING *os; os = p7->d.sign->contents->d.data; ASN1_OCTET_STRING_free(os); p7->d.sign->contents->d.data = NULL; } } else { PKCS7err(PKCS7_F_PKCS7_CTRL, PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE); ret = 0; } break; case PKCS7_OP_GET_DETACHED_SIGNATURE: if (nid == NID_pkcs7_signed) { if (!p7->d.sign || !p7->d.sign->contents->d.ptr) ret = 1; else ret = 0; p7->detached = ret; } else { PKCS7err(PKCS7_F_PKCS7_CTRL, PKCS7_R_OPERATION_NOT_SUPPORTED_ON_THIS_TYPE); ret = 0; } break; default: PKCS7err(PKCS7_F_PKCS7_CTRL, PKCS7_R_UNKNOWN_OPERATION); ret = 0; } ",1 "void WebProcessProxy::frameCreated(uint64_t frameID, WebFrameProxy* frameProxy) { ASSERT(canCreateFrame(frameID)); m_frameMap.set(frameID, frameProxy); } ",0 "path_encode(enum path_delim path_delim, int npts, Point *pt) { int size = npts * (P_MAXLEN + 3) + 2; char *result; char *cp; int i; /* Check for integer overflow */ if ((size - 2) / npts != (P_MAXLEN + 3)) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg(""too many points requested""))); result = palloc(size); cp = result; switch (path_delim) { case PATH_CLOSED: *cp++ = LDELIM; break; case PATH_OPEN: *cp++ = LDELIM_EP; break; case PATH_NONE: break; } for (i = 0; i < npts; i++) { *cp++ = LDELIM; if (!pair_encode(pt->x, pt->y, cp)) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg(""could not format \""path\"" value""))); cp += strlen(cp); *cp++ = RDELIM; *cp++ = DELIM; pt++; } cp--; switch (path_delim) { case PATH_CLOSED: *cp++ = RDELIM; break; case PATH_OPEN: *cp++ = RDELIM_EP; break; case PATH_NONE: break; } *cp = '\0'; return result; } /* path_encode() */ ",0 "static int do_proc_dointvec_minmax_conv(bool *negp, unsigned long *lvalp, int *valp, int write, void *data) { struct do_proc_dointvec_minmax_conv_param *param = data; if (write) { int val = *negp ? -*lvalp : *lvalp; if ((param->min && *param->min > val) || (param->max && *param->max < val)) return -EINVAL; *valp = val; } else { int val = *valp; if (val < 0) { *negp = true; *lvalp = -(unsigned long)val; } else { *negp = false; *lvalp = (unsigned long)val; } } return 0; } ",0 "test_bson_reserve_buffer (void) { bson_t src = BSON_INITIALIZER; bson_t stack_alloced; bson_t *heap_alloced; uint8_t *buf; /* inline, stack-allocated */ bson_init (&stack_alloced); BSON_APPEND_UTF8 (&src, ""key"", ""value""); ASSERT ((buf = bson_reserve_buffer (&stack_alloced, src.len))); ASSERT_CMPUINT32 (src.len, ==, stack_alloced.len); ASSERT (stack_alloced.flags & BSON_FLAG_INLINE); memcpy (buf, ((bson_impl_inline_t *) &src)->data, src.len); /* data was transferred */ BSON_ASSERT_KEY_AND_VALUE (&stack_alloced); bson_destroy (&stack_alloced); /* spilled over, stack-allocated */ bloat (&src); bson_init (&stack_alloced); ASSERT ((buf = bson_reserve_buffer (&stack_alloced, src.len))); ASSERT_CMPUINT32 (src.len, ==, stack_alloced.len); ASSERT (!(stack_alloced.flags & BSON_FLAG_INLINE)); memcpy (buf, ((bson_impl_alloc_t *) &src)->alloc, src.len); BSON_ASSERT_KEY_AND_VALUE (&stack_alloced); ASSERT (bson_has_field (&stack_alloced, ""99"")); bson_destroy (&src); bson_destroy (&stack_alloced); /* inline, heap-allocated */ heap_alloced = bson_new (); bson_init (&src); BSON_APPEND_UTF8 (&src, ""key"", ""value""); ASSERT ((buf = bson_reserve_buffer (heap_alloced, src.len))); ASSERT_CMPUINT32 (src.len, ==, heap_alloced->len); ASSERT (heap_alloced->flags & BSON_FLAG_INLINE); memcpy (buf, ((bson_impl_inline_t *) &src)->data, src.len); BSON_ASSERT_KEY_AND_VALUE (heap_alloced); bson_destroy (heap_alloced); /* spilled over, heap-allocated */ heap_alloced = bson_new (); bloat (&src); ASSERT ((buf = bson_reserve_buffer (heap_alloced, src.len))); ASSERT_CMPUINT32 (src.len, ==, heap_alloced->len); ASSERT (!(heap_alloced->flags & BSON_FLAG_INLINE)); memcpy (buf, ((bson_impl_alloc_t *) &src)->alloc, src.len); BSON_ASSERT_KEY_AND_VALUE (heap_alloced); ASSERT (bson_has_field (heap_alloced, ""99"")); bson_destroy (&src); bson_destroy (heap_alloced); } ",0 "bool BrowserCommandController::IsCommandEnabled(int id) const { return command_updater_.IsCommandEnabled(id); } ",0 "Browser::CreateParams::CreateParams(Type type, Profile* profile) : type(type), profile(profile) { } ",0 "static int vm_stat_get(void *_offset, u64 *val) { unsigned offset = (long)_offset; struct kvm *kvm; struct kvm_stat_data stat_tmp = {.offset = offset}; u64 tmp_val; *val = 0; spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) { stat_tmp.kvm = kvm; vm_stat_get_per_vm((void *)&stat_tmp, &tmp_val); *val += tmp_val; } spin_unlock(&kvm_lock); return 0; } ",0 "static int tls1_generate_key_block(SSL *s, unsigned char *km, unsigned char *tmp, int num) { int ret; ret = tls1_PRF(ssl_get_algorithm2(s), TLS_MD_KEY_EXPANSION_CONST,TLS_MD_KEY_EXPANSION_CONST_SIZE, s->s3->server_random,SSL3_RANDOM_SIZE, s->s3->client_random,SSL3_RANDOM_SIZE, NULL,0,NULL,0, s->session->master_key,s->session->master_key_length, km,tmp,num); #ifdef KSSL_DEBUG printf(""tls1_generate_key_block() ==> %d byte master_key =\n\t"", s->session->master_key_length); { int i; for (i=0; i < s->session->master_key_length; i++) { printf(""%02X"", s->session->master_key[i]); } printf(""\n""); } #endif /* KSSL_DEBUG */ return ret; } ",0 " bool IsMutating() const { return drag_controller_ && drag_controller_->is_mutating(); } ",0 "static u16 __netdev_pick_tx(struct net_device *dev, struct sk_buff *skb) { struct sock *sk = skb->sk; int queue_index = sk_tx_queue_get(sk); if (queue_index < 0 || skb->ooo_okay || queue_index >= dev->real_num_tx_queues) { int new_index = get_xps_queue(dev, skb); if (new_index < 0) new_index = skb_tx_hash(dev, skb); if (queue_index != new_index && sk && sk_fullsock(sk) && rcu_access_pointer(sk->sk_dst_cache)) sk_tx_queue_set(sk, new_index); queue_index = new_index; } return queue_index; } ",0 "sp Camera3Device::setUpRequestLocked( const CameraMetadata &request) { status_t res; if (mStatus == STATUS_UNCONFIGURED || mNeedConfig) { res = configureStreamsLocked(); if (res == BAD_VALUE && mStatus == STATUS_UNCONFIGURED) { CLOGE(""No streams configured""); return NULL; } if (res != OK) { SET_ERR_L(""Can't set up streams: %s (%d)"", strerror(-res), res); return NULL; } if (mStatus == STATUS_UNCONFIGURED) { CLOGE(""No streams configured""); return NULL; } } sp newRequest = createCaptureRequest(request); return newRequest; } ",0 "void DeleteChannel(IPC::Channel* channel) { delete channel; } ",0 "void RenderWidgetHostViewGuest::OnAcceleratedCompositingStateChange() { NOTIMPLEMENTED(); } ",0 " cff_charset_done( CFF_Charset charset, FT_Stream stream ) { FT_Memory memory = stream->memory; cff_charset_free_cids( charset, memory ); FT_FREE( charset->sids ); charset->format = 0; charset->offset = 0; } ",0 "extractContigSamplesShifted32bits (uint8 *in, uint8 *out, uint32 cols, tsample_t sample, uint16 spp, uint16 bps, tsample_t count, uint32 start, uint32 end, int shift) { int ready_bits = 0, sindex = 0 /*, shift_width = 0 */; uint32 col, src_byte, src_bit, bit_offset; uint32 longbuff1 = 0, longbuff2 = 0; uint64 maskbits = 0, matchbits = 0; uint64 buff1 = 0, buff2 = 0, buff3 = 0; uint8 bytebuff1 = 0, bytebuff2 = 0, bytebuff3 = 0, bytebuff4 = 0; uint8 *src = in; uint8 *dst = out; if ((in == NULL) || (out == NULL)) { TIFFError(""extractContigSamplesShifted32bits"",""Invalid input or output buffer""); return (1); } if ((start > end) || (start > cols)) { TIFFError (""extractContigSamplesShifted32bits"", ""Invalid start column value %d ignored"", start); start = 0; } if ((end == 0) || (end > cols)) { TIFFError (""extractContigSamplesShifted32bits"", ""Invalid end column value %d ignored"", end); end = cols; } /* shift_width = ((bps + 7) / 8) + 1; */ ready_bits = shift; maskbits = (uint64)-1 >> ( 64 - bps); for (col = start; col < end; col++) { /* Compute src byte(s) and bits within byte(s) */ bit_offset = col * bps * spp; for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++) { if (sindex == 0) { src_byte = bit_offset / 8; src_bit = bit_offset % 8; } else { src_byte = (bit_offset + (sindex * bps)) / 8; src_bit = (bit_offset + (sindex * bps)) % 8; } src = in + src_byte; matchbits = maskbits << (64 - src_bit - bps); if (little_endian) { longbuff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; longbuff2 = longbuff1; } else { longbuff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0]; longbuff2 = longbuff1; } buff3 = ((uint64)longbuff1 << 32) | longbuff2; if ((col == start) && (sindex == sample)) buff2 = buff3 & ((uint64)-1) << (32 - shift); buff1 = (buff3 & matchbits) << (src_bit); if (ready_bits < 32) { /* add another bps bits to the buffer */ bytebuff1 = bytebuff2 = bytebuff3 = bytebuff4 = 0; buff2 = (buff2 | (buff1 >> ready_bits)); } else /* If we have a full buffer's worth, write it out */ { bytebuff1 = (buff2 >> 56); *dst++ = bytebuff1; bytebuff2 = (buff2 >> 48); *dst++ = bytebuff2; bytebuff3 = (buff2 >> 40); *dst++ = bytebuff3; bytebuff4 = (buff2 >> 32); *dst++ = bytebuff4; ready_bits -= 32; /* shift in new bits */ buff2 = ((buff2 << 32) | (buff1 >> ready_bits)); } ready_bits += bps; } } while (ready_bits > 0) { bytebuff1 = (buff2 >> 56); *dst++ = bytebuff1; buff2 = (buff2 << 8); ready_bits -= 8; } return (0); } /* end extractContigSamplesShifted32bits */ ",0 "static int ext4_ext_remove_space(struct inode *inode, ext4_lblk_t start, ext4_lblk_t end) { struct super_block *sb = inode->i_sb; int depth = ext_depth(inode); struct ext4_ext_path *path = NULL; ext4_fsblk_t partial_cluster = 0; handle_t *handle; int i = 0, err = 0; ext_debug(""truncate since %u to %u\n"", start, end); /* probably first extent we're gonna free will be last in block */ handle = ext4_journal_start(inode, depth + 1); if (IS_ERR(handle)) return PTR_ERR(handle); again: ext4_ext_invalidate_cache(inode); trace_ext4_ext_remove_space(inode, start, depth); /* * Check if we are removing extents inside the extent tree. If that * is the case, we are going to punch a hole inside the extent tree * so we have to check whether we need to split the extent covering * the last block to remove so we can easily remove the part of it * in ext4_ext_rm_leaf(). */ if (end < EXT_MAX_BLOCKS - 1) { struct ext4_extent *ex; ext4_lblk_t ee_block; /* find extent for this block */ path = ext4_ext_find_extent(inode, end, NULL); if (IS_ERR(path)) { ext4_journal_stop(handle); return PTR_ERR(path); } depth = ext_depth(inode); /* Leaf not may not exist only if inode has no blocks at all */ ex = path[depth].p_ext; if (!ex) { if (depth) { EXT4_ERROR_INODE(inode, ""path[%d].p_hdr == NULL"", depth); err = -EIO; } goto out; } ee_block = le32_to_cpu(ex->ee_block); /* * See if the last block is inside the extent, if so split * the extent at 'end' block so we can easily remove the * tail of the first part of the split extent in * ext4_ext_rm_leaf(). */ if (end >= ee_block && end < ee_block + ext4_ext_get_actual_len(ex) - 1) { int split_flag = 0; if (ext4_ext_is_uninitialized(ex)) split_flag = EXT4_EXT_MARK_UNINIT1 | EXT4_EXT_MARK_UNINIT2; /* * Split the extent in two so that 'end' is the last * block in the first new extent */ err = ext4_split_extent_at(handle, inode, path, end + 1, split_flag, EXT4_GET_BLOCKS_PRE_IO | EXT4_GET_BLOCKS_PUNCH_OUT_EXT); if (err < 0) goto out; } } /* * We start scanning from right side, freeing all the blocks * after i_size and walking into the tree depth-wise. */ depth = ext_depth(inode); if (path) { int k = i = depth; while (--k > 0) path[k].p_block = le16_to_cpu(path[k].p_hdr->eh_entries)+1; } else { path = kzalloc(sizeof(struct ext4_ext_path) * (depth + 1), GFP_NOFS); if (path == NULL) { ext4_journal_stop(handle); return -ENOMEM; } path[0].p_depth = depth; path[0].p_hdr = ext_inode_hdr(inode); i = 0; if (ext4_ext_check(inode, path[0].p_hdr, depth)) { err = -EIO; goto out; } } err = 0; while (i >= 0 && err == 0) { if (i == depth) { /* this is leaf block */ err = ext4_ext_rm_leaf(handle, inode, path, &partial_cluster, start, end); /* root level has p_bh == NULL, brelse() eats this */ brelse(path[i].p_bh); path[i].p_bh = NULL; i--; continue; } /* this is index block */ if (!path[i].p_hdr) { ext_debug(""initialize header\n""); path[i].p_hdr = ext_block_hdr(path[i].p_bh); } if (!path[i].p_idx) { /* this level hasn't been touched yet */ path[i].p_idx = EXT_LAST_INDEX(path[i].p_hdr); path[i].p_block = le16_to_cpu(path[i].p_hdr->eh_entries)+1; ext_debug(""init index ptr: hdr 0x%p, num %d\n"", path[i].p_hdr, le16_to_cpu(path[i].p_hdr->eh_entries)); } else { /* we were already here, see at next index */ path[i].p_idx--; } ext_debug(""level %d - index, first 0x%p, cur 0x%p\n"", i, EXT_FIRST_INDEX(path[i].p_hdr), path[i].p_idx); if (ext4_ext_more_to_rm(path + i)) { struct buffer_head *bh; /* go to the next level */ ext_debug(""move to level %d (block %llu)\n"", i + 1, ext4_idx_pblock(path[i].p_idx)); memset(path + i + 1, 0, sizeof(*path)); bh = sb_bread(sb, ext4_idx_pblock(path[i].p_idx)); if (!bh) { /* should we reset i_size? */ err = -EIO; break; } if (WARN_ON(i + 1 > depth)) { err = -EIO; break; } if (ext4_ext_check_block(inode, ext_block_hdr(bh), depth - i - 1, bh)) { err = -EIO; break; } path[i + 1].p_bh = bh; /* save actual number of indexes since this * number is changed at the next iteration */ path[i].p_block = le16_to_cpu(path[i].p_hdr->eh_entries); i++; } else { /* we finished processing this index, go up */ if (path[i].p_hdr->eh_entries == 0 && i > 0) { /* index is empty, remove it; * handle must be already prepared by the * truncatei_leaf() */ err = ext4_ext_rm_idx(handle, inode, path + i); } /* root level has p_bh == NULL, brelse() eats this */ brelse(path[i].p_bh); path[i].p_bh = NULL; i--; ext_debug(""return to level %d\n"", i); } } trace_ext4_ext_remove_space_done(inode, start, depth, partial_cluster, path->p_hdr->eh_entries); /* If we still have something in the partial cluster and we have removed * even the first extent, then we should free the blocks in the partial * cluster as well. */ if (partial_cluster && path->p_hdr->eh_entries == 0) { int flags = EXT4_FREE_BLOCKS_FORGET; if (S_ISDIR(inode->i_mode) || S_ISLNK(inode->i_mode)) flags |= EXT4_FREE_BLOCKS_METADATA; ext4_free_blocks(handle, inode, NULL, EXT4_C2B(EXT4_SB(sb), partial_cluster), EXT4_SB(sb)->s_cluster_ratio, flags); partial_cluster = 0; } /* TODO: flexible tree reduction should be here */ if (path->p_hdr->eh_entries == 0) { /* * truncate to zero freed all the tree, * so we need to correct eh_depth */ err = ext4_ext_get_access(handle, inode, path); if (err == 0) { ext_inode_hdr(inode)->eh_depth = 0; ext_inode_hdr(inode)->eh_max = cpu_to_le16(ext4_ext_space_root(inode, 0)); err = ext4_ext_dirty(handle, inode, path); } } out: ext4_ext_drop_refs(path); kfree(path); if (err == -EAGAIN) { path = NULL; goto again; } ext4_journal_stop(handle); return err; } ",0 "void WebContentsImpl::RenderFrameForInterstitialPageCreated( RenderFrameHost* render_frame_host) { for (auto& observer : observers_) observer.RenderFrameForInterstitialPageCreated(render_frame_host); } ",0 "open_patch_file (char const *filename) { file_offset file_pos = 0; struct stat st; if (!filename || !*filename || strEQ (filename, ""-"")) { file_offset stdin_pos; #if HAVE_SETMODE_DOS if (binary_transput) { if (isatty (STDIN_FILENO)) fatal (""cannot read binary data from tty on this platform""); setmode (STDIN_FILENO, O_BINARY); } #endif if (fstat (STDIN_FILENO, &st) != 0) pfatal (""fstat""); if (S_ISREG (st.st_mode) && (stdin_pos = file_tell (stdin)) != -1) { pfp = stdin; file_pos = stdin_pos; } else { size_t charsread; int fd = make_tempfile (&TMPPATNAME, 'p', NULL, O_RDWR | O_BINARY, 0); TMPPATNAME_needs_removal = 1; pfp = fdopen (fd, ""w+b""); if (! pfp) pfatal (""Can't open stream for file %s"", quotearg (TMPPATNAME)); for (st.st_size = 0; (charsread = fread (buf, 1, bufsize, stdin)) != 0; st.st_size += charsread) if (fwrite (buf, 1, charsread, pfp) != charsread) write_fatal (); if (ferror (stdin) || fclose (stdin) != 0) read_fatal (); if (fflush (pfp) != 0 || file_seek (pfp, (file_offset) 0, SEEK_SET) != 0) write_fatal (); } } else { pfp = fopen (filename, binary_transput ? ""rb"" : ""r""); if (!pfp) pfatal (""Can't open patch file %s"", quotearg (filename)); if (fstat (fileno (pfp), &st) != 0) pfatal (""fstat""); } p_filesize = st.st_size; if (p_filesize != (file_offset) p_filesize) fatal (""patch file is too long""); next_intuit_at (file_pos, 1); set_hunkmax(); } ",0 "static void __exit eseqiv_module_exit(void) { crypto_unregister_template(&eseqiv_tmpl); } ",0 "s4u_identify_user(krb5_context context, krb5_creds *in_creds, krb5_data *subject_cert, krb5_principal *canon_user) { krb5_error_code code; krb5_preauthtype ptypes[1] = { KRB5_PADATA_S4U_X509_USER }; krb5_creds creds; int use_master = 0; krb5_get_init_creds_opt *opts = NULL; krb5_principal_data client; krb5_s4u_userid userid; *canon_user = NULL; if (in_creds->client == NULL && subject_cert == NULL) { return EINVAL; } if (in_creds->client != NULL && in_creds->client->type != KRB5_NT_ENTERPRISE_PRINCIPAL) { int anonymous; anonymous = krb5_principal_compare(context, in_creds->client, krb5_anonymous_principal()); return krb5_copy_principal(context, anonymous ? in_creds->server : in_creds->client, canon_user); } memset(&creds, 0, sizeof(creds)); memset(&userid, 0, sizeof(userid)); if (subject_cert != NULL) userid.subject_cert = *subject_cert; code = krb5_get_init_creds_opt_alloc(context, &opts); if (code != 0) goto cleanup; krb5_get_init_creds_opt_set_tkt_life(opts, 15); krb5_get_init_creds_opt_set_renew_life(opts, 0); krb5_get_init_creds_opt_set_forwardable(opts, 0); krb5_get_init_creds_opt_set_proxiable(opts, 0); krb5_get_init_creds_opt_set_canonicalize(opts, 1); krb5_get_init_creds_opt_set_preauth_list(opts, ptypes, 1); if (in_creds->client != NULL) { client = *in_creds->client; client.realm = in_creds->server->realm; } else { client.magic = KV5M_PRINCIPAL; client.realm = in_creds->server->realm; /* should this be NULL, empty or a fixed string? XXX */ client.data = NULL; client.length = 0; client.type = KRB5_NT_ENTERPRISE_PRINCIPAL; } code = k5_get_init_creds(context, &creds, &client, NULL, NULL, 0, NULL, opts, krb5_get_as_key_noop, &userid, &use_master, NULL); if (code == 0 || code == KRB5_PREAUTH_FAILED) { *canon_user = userid.user; userid.user = NULL; code = 0; } cleanup: krb5_free_cred_contents(context, &creds); if (opts != NULL) krb5_get_init_creds_opt_free(context, opts); if (userid.user != NULL) krb5_free_principal(context, userid.user); return code; } ",1 "static void userfaultfd_event_wait_completion(struct userfaultfd_ctx *ctx, struct userfaultfd_wait_queue *ewq) { struct userfaultfd_ctx *release_new_ctx; if (WARN_ON_ONCE(current->flags & PF_EXITING)) goto out; ewq->ctx = ctx; init_waitqueue_entry(&ewq->wq, current); release_new_ctx = NULL; spin_lock(&ctx->event_wqh.lock); /* * After the __add_wait_queue the uwq is visible to userland * through poll/read(). */ __add_wait_queue(&ctx->event_wqh, &ewq->wq); for (;;) { set_current_state(TASK_KILLABLE); if (ewq->msg.event == 0) break; if (READ_ONCE(ctx->released) || fatal_signal_pending(current)) { /* * &ewq->wq may be queued in fork_event, but * __remove_wait_queue ignores the head * parameter. It would be a problem if it * didn't. */ __remove_wait_queue(&ctx->event_wqh, &ewq->wq); if (ewq->msg.event == UFFD_EVENT_FORK) { struct userfaultfd_ctx *new; new = (struct userfaultfd_ctx *) (unsigned long) ewq->msg.arg.reserved.reserved1; release_new_ctx = new; } break; } spin_unlock(&ctx->event_wqh.lock); wake_up_poll(&ctx->fd_wqh, EPOLLIN); schedule(); spin_lock(&ctx->event_wqh.lock); } __set_current_state(TASK_RUNNING); spin_unlock(&ctx->event_wqh.lock); if (release_new_ctx) { struct vm_area_struct *vma; struct mm_struct *mm = release_new_ctx->mm; /* the various vma->vm_userfaultfd_ctx still points to it */ down_write(&mm->mmap_sem); for (vma = mm->mmap; vma; vma = vma->vm_next) if (vma->vm_userfaultfd_ctx.ctx == release_new_ctx) { vma->vm_userfaultfd_ctx = NULL_VM_UFFD_CTX; vma->vm_flags &= ~(VM_UFFD_WP | VM_UFFD_MISSING); } up_write(&mm->mmap_sem); userfaultfd_ctx_put(release_new_ctx); } /* * ctx may go away after this if the userfault pseudo fd is * already released. */ out: WRITE_ONCE(ctx->mmap_changing, false); userfaultfd_ctx_put(ctx); } ",0 "static struct usb_device *testdev_to_usbdev(struct usbtest_dev *test) { return interface_to_usbdev(test->intf); } ",0 "nm_setting_vpn_get_secret (NMSettingVPN *setting, const char *key) { g_return_val_if_fail (NM_IS_SETTING_VPN (setting), NULL); return (const char *) g_hash_table_lookup (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, key); } ",0 "struct nfc_llcp_sdp_tlv *nfc_llcp_build_sdres_tlv(u8 tid, u8 sap) { struct nfc_llcp_sdp_tlv *sdres; u8 value[2]; sdres = kzalloc(sizeof(struct nfc_llcp_sdp_tlv), GFP_KERNEL); if (sdres == NULL) return NULL; value[0] = tid; value[1] = sap; sdres->tlv = nfc_llcp_build_tlv(LLCP_TLV_SDRES, value, 2, &sdres->tlv_len); if (sdres->tlv == NULL) { kfree(sdres); return NULL; } sdres->tid = tid; sdres->sap = sap; INIT_HLIST_NODE(&sdres->node); return sdres; } ",0 "void WebGLRenderingContextBase::sampleCoverage(GLfloat value, GLboolean invert) { if (isContextLost()) return; ContextGL()->SampleCoverage(value, invert); } ",0 "ofputil_packet_in_reason_to_string(enum ofp_packet_in_reason reason, char *reasonbuf, size_t bufsize) { switch (reason) { case OFPR_NO_MATCH: return ""no_match""; case OFPR_ACTION: return ""action""; case OFPR_INVALID_TTL: return ""invalid_ttl""; case OFPR_ACTION_SET: return ""action_set""; case OFPR_GROUP: return ""group""; case OFPR_PACKET_OUT: return ""packet_out""; case OFPR_EXPLICIT_MISS: case OFPR_IMPLICIT_MISS: return """"; case OFPR_N_REASONS: default: snprintf(reasonbuf, bufsize, ""%d"", (int) reason); return reasonbuf; } } ",0 " TT_Clear_CodeRange( TT_ExecContext exec, FT_Int range ) { FT_ASSERT( range >= 1 && range <= 3 ); exec->codeRangeTable[range - 1].base = NULL; exec->codeRangeTable[range - 1].size = 0; return TT_Err_Ok; } ",0 "static inline int ip6_ufo_append_data(struct sock *sk, int getfrag(void *from, char *to, int offset, int len, int odd, struct sk_buff *skb), void *from, int length, int hh_len, int fragheaderlen, int transhdrlen, int mtu,unsigned int flags) { struct sk_buff *skb; int err; /* There is support for UDP large send offload by network * device, so create one single skb packet containing complete * udp datagram */ if ((skb = skb_peek_tail(&sk->sk_write_queue)) == NULL) { skb = sock_alloc_send_skb(sk, hh_len + fragheaderlen + transhdrlen + 20, (flags & MSG_DONTWAIT), &err); if (skb == NULL) return -ENOMEM; /* reserve space for Hardware header */ skb_reserve(skb, hh_len); /* create space for UDP/IP header */ skb_put(skb,fragheaderlen + transhdrlen); /* initialize network header pointer */ skb_reset_network_header(skb); /* initialize protocol header pointer */ skb->transport_header = skb->network_header + fragheaderlen; skb->ip_summed = CHECKSUM_PARTIAL; skb->csum = 0; } err = skb_append_datato_frags(sk,skb, getfrag, from, (length - transhdrlen)); if (!err) { struct frag_hdr fhdr; /* Specify the length of each IPv6 datagram fragment. * It has to be a multiple of 8. */ skb_shinfo(skb)->gso_size = (mtu - fragheaderlen - sizeof(struct frag_hdr)) & ~7; skb_shinfo(skb)->gso_type = SKB_GSO_UDP; ipv6_select_ident(&fhdr); skb_shinfo(skb)->ip6_frag_id = fhdr.identification; __skb_queue_tail(&sk->sk_write_queue, skb); return 0; } /* There is not enough support do UPD LSO, * so follow normal path */ kfree_skb(skb); return err; } ",1 "void PrintViewManagerBase::OnNotifyPrintJobEvent( const JobEventDetails& event_details) { switch (event_details.type()) { case JobEventDetails::FAILED: { TerminatePrintJob(true); content::NotificationService::current()->Notify( chrome::NOTIFICATION_PRINT_JOB_RELEASED, content::Source(web_contents()), content::NotificationService::NoDetails()); break; } case JobEventDetails::USER_INIT_DONE: case JobEventDetails::DEFAULT_INIT_DONE: case JobEventDetails::USER_INIT_CANCELED: { NOTREACHED(); break; } case JobEventDetails::ALL_PAGES_REQUESTED: { ShouldQuitFromInnerMessageLoop(); break; } case JobEventDetails::NEW_DOC: case JobEventDetails::NEW_PAGE: case JobEventDetails::PAGE_DONE: case JobEventDetails::DOC_DONE: { break; } case JobEventDetails::JOB_DONE: { printing_succeeded_ = true; ReleasePrintJob(); content::NotificationService::current()->Notify( chrome::NOTIFICATION_PRINT_JOB_RELEASED, content::Source(web_contents()), content::NotificationService::NoDetails()); break; } default: { NOTREACHED(); break; } } } ",0 "process_colour_pointer_pdu(STREAM s) { logger(Protocol, Debug, ""%s()"", __func__); process_colour_pointer_common(s, 24); } ",0 "static MagickBooleanType WritePSDImage(const ImageInfo *image_info, Image *image,ExceptionInfo *exception) { const StringInfo *icc_profile; MagickBooleanType status; PSDInfo psd_info; register ssize_t i; size_t length, num_channels, packet_size; StringInfo *bim_profile; /* Open 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); packet_size=(size_t) (image->depth > 8 ? 6 : 3); if (image->alpha_trait != UndefinedPixelTrait) packet_size+=image->depth > 8 ? 2 : 1; psd_info.version=1; if ((LocaleCompare(image_info->magick,""PSB"") == 0) || (image->columns > 30000) || (image->rows > 30000)) psd_info.version=2; (void) WriteBlob(image,4,(const unsigned char *) ""8BPS""); (void) WriteBlobMSBShort(image,psd_info.version); /* version */ for (i=1; i <= 6; i++) (void) WriteBlobByte(image, 0); /* 6 bytes of reserved */ /* When the image has a color profile it won't be converted to gray scale */ if ((GetImageProfile(image,""icc"") == (StringInfo *) NULL) && (SetImageGray(image,exception) != MagickFalse)) num_channels=(image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL); else if ((image_info->type != TrueColorType) && (image_info->type != TrueColorAlphaType) && (image->storage_class == PseudoClass)) num_channels=(image->alpha_trait != UndefinedPixelTrait ? 2UL : 1UL); else { if (image->storage_class == PseudoClass) (void) SetImageStorageClass(image,DirectClass,exception); if (image->colorspace != CMYKColorspace) num_channels=(image->alpha_trait != UndefinedPixelTrait ? 4UL : 3UL); else num_channels=(image->alpha_trait != UndefinedPixelTrait ? 5UL : 4UL); } (void) WriteBlobMSBShort(image,(unsigned short) num_channels); (void) WriteBlobMSBLong(image,(unsigned int) image->rows); (void) WriteBlobMSBLong(image,(unsigned int) image->columns); if (IsImageGray(image) != MagickFalse) { MagickBooleanType monochrome; /* Write depth & mode. */ monochrome=IsImageMonochrome(image) && (image->depth == 1) ? MagickTrue : MagickFalse; (void) WriteBlobMSBShort(image,(unsigned short) (monochrome != MagickFalse ? 1 : image->depth > 8 ? 16 : 8)); (void) WriteBlobMSBShort(image,(unsigned short) (monochrome != MagickFalse ? BitmapMode : GrayscaleMode)); } else { (void) WriteBlobMSBShort(image,(unsigned short) (image->storage_class == PseudoClass ? 8 : image->depth > 8 ? 16 : 8)); if (((image_info->colorspace != UndefinedColorspace) || (image->colorspace != CMYKColorspace)) && (image_info->colorspace != CMYKColorspace)) { (void) TransformImageColorspace(image,sRGBColorspace,exception); (void) WriteBlobMSBShort(image,(unsigned short) (image->storage_class == PseudoClass ? IndexedMode : RGBMode)); } else { if (image->colorspace != CMYKColorspace) (void) TransformImageColorspace(image,CMYKColorspace,exception); (void) WriteBlobMSBShort(image,CMYKMode); } } if ((IsImageGray(image) != MagickFalse) || (image->storage_class == DirectClass) || (image->colors > 256)) (void) WriteBlobMSBLong(image,0); else { /* Write PSD raster colormap. */ (void) WriteBlobMSBLong(image,768); for (i=0; i < (ssize_t) image->colors; i++) (void) WriteBlobByte(image,ScaleQuantumToChar(ClampToQuantum( image->colormap[i].red))); for ( ; i < 256; i++) (void) WriteBlobByte(image,0); for (i=0; i < (ssize_t) image->colors; i++) (void) WriteBlobByte(image,ScaleQuantumToChar(ClampToQuantum( image->colormap[i].green))); for ( ; i < 256; i++) (void) WriteBlobByte(image,0); for (i=0; i < (ssize_t) image->colors; i++) (void) WriteBlobByte(image,ScaleQuantumToChar(ClampToQuantum( image->colormap[i].blue))); for ( ; i < 256; i++) (void) WriteBlobByte(image,0); } /* Image resource block. */ length=28; /* 0x03EB */ bim_profile=(StringInfo *) GetImageProfile(image,""8bim""); icc_profile=GetImageProfile(image,""icc""); if (bim_profile != (StringInfo *) NULL) { bim_profile=CloneStringInfo(bim_profile); if (icc_profile != (StringInfo *) NULL) RemoveICCProfileFromResourceBlock(bim_profile); RemoveResolutionFromResourceBlock(bim_profile); length+=PSDQuantum(GetStringInfoLength(bim_profile)); } if (icc_profile != (const StringInfo *) NULL) length+=PSDQuantum(GetStringInfoLength(icc_profile))+12; (void) WriteBlobMSBLong(image,(unsigned int) length); WriteResolutionResourceBlock(image); if (bim_profile != (StringInfo *) NULL) { (void) WriteBlob(image,GetStringInfoLength(bim_profile), GetStringInfoDatum(bim_profile)); bim_profile=DestroyStringInfo(bim_profile); } if (icc_profile != (StringInfo *) NULL) { (void) WriteBlob(image,4,(const unsigned char *) ""8BIM""); (void) WriteBlobMSBShort(image,0x0000040F); (void) WriteBlobMSBShort(image,0); (void) WriteBlobMSBLong(image,(unsigned int) GetStringInfoLength( icc_profile)); (void) WriteBlob(image,GetStringInfoLength(icc_profile), GetStringInfoDatum(icc_profile)); if ((ssize_t) GetStringInfoLength(icc_profile) != PSDQuantum(GetStringInfoLength(icc_profile))) (void) WriteBlobByte(image,0); } if (status != MagickFalse) { MagickOffsetType size_offset; size_t size; size_offset=TellBlob(image); (void) SetPSDSize(&psd_info,image,0); status=WritePSDLayersInternal(image,image_info,&psd_info,&size, exception); size_offset+=WritePSDSize(&psd_info,image,size+ (psd_info.version == 1 ? 8 : 12),size_offset); } (void) WriteBlobMSBLong(image,0); /* user mask data */ /* Write composite image. */ if (status != MagickFalse) { CompressionType compression; compression=image->compression; if (image->compression == ZipCompression) image->compression=RLECompression; if (image_info->compression != UndefinedCompression) image->compression=image_info->compression; if (WritePSDChannels(&psd_info,image_info,image,image,0,MagickFalse, exception) == 0) status=MagickFalse; image->compression=compression; } (void) CloseBlob(image); return(status); } ",0 "static int fabs(struct sh_fpu_soft_struct *fregs, int n) { FRn &= ~(1 << (_FP_W_TYPE_SIZE - 1)); return 0; } ",0 "bool find_numa_distance(int distance) { int i; if (distance == node_distance(0, 0)) return true; for (i = 0; i < sched_domains_numa_levels; i++) { if (sched_domains_numa_distance[i] == distance) return true; } return false; } ",0 "static int handle_rst_stream_frame(h2o_http2_conn_t *conn, h2o_http2_frame_t *frame, const char **err_desc) { h2o_http2_rst_stream_payload_t payload; h2o_http2_stream_t *stream; int ret; if ((ret = h2o_http2_decode_rst_stream_payload(&payload, frame, err_desc)) != 0) return ret; if (is_idle_stream_id(conn, frame->stream_id)) { *err_desc = ""unexpected stream id in RST_STREAM frame""; return H2O_HTTP2_ERROR_PROTOCOL; } stream = h2o_http2_conn_get_stream(conn, frame->stream_id); if (stream != NULL) { /* reset the stream */ h2o_http2_stream_reset(conn, stream); } /* TODO log */ return 0; } ",0 "WebView* RenderViewImpl::createView( WebFrame* creator, const WebURLRequest& request, const WebWindowFeatures& features, const WebString& frame_name, WebNavigationPolicy policy) { if (shared_popup_counter_->data > kMaximumNumberOfUnacknowledgedPopups) return NULL; ViewHostMsg_CreateWindow_Params params; params.opener_id = routing_id_; params.user_gesture = creator->isProcessingUserGesture(); params.window_container_type = WindowFeaturesToContainerType(features); params.session_storage_namespace_id = session_storage_namespace_id_; params.frame_name = frame_name; params.opener_frame_id = creator->identifier(); params.opener_url = creator->document().url(); params.opener_security_origin = creator->document().securityOrigin().toString().utf8(); params.opener_suppressed = creator->willSuppressOpenerInNewFrame(); params.disposition = NavigationPolicyToDisposition(policy); if (!request.isNull()) params.target_url = request.url(); int32 routing_id = MSG_ROUTING_NONE; int32 surface_id = 0; int64 cloned_session_storage_namespace_id; RenderThread::Get()->Send( new ViewHostMsg_CreateWindow(params, &routing_id, &surface_id, &cloned_session_storage_namespace_id)); if (routing_id == MSG_ROUTING_NONE) return NULL; RenderViewImpl* view = RenderViewImpl::Create( 0, routing_id_, renderer_preferences_, webkit_preferences_, shared_popup_counter_, routing_id, surface_id, cloned_session_storage_namespace_id, frame_name, 1, screen_info_, guest_); view->opened_by_user_gesture_ = params.user_gesture; view->opener_suppressed_ = params.opener_suppressed; GURL creator_url(creator->document().securityOrigin().toString().utf8()); if (!creator_url.is_valid() || !creator_url.IsStandard()) creator_url = GURL(); view->creator_url_ = creator_url; view->alternate_error_page_url_ = alternate_error_page_url_; return view->webview(); } ",0 "void ChildProcessSecurityPolicyImpl::GrantSendMidiSysExMessage(int child_id) { base::AutoLock lock(lock_); SecurityStateMap::iterator state = security_state_.find(child_id); if (state == security_state_.end()) return; state->second->GrantPermissionForMidiSysEx(); } ",0 "n_tty_receive_buf_common(struct tty_struct *tty, const unsigned char *cp, char *fp, int count, int flow) { struct n_tty_data *ldata = tty->disc_data; int room, n, rcvd = 0; down_read(&tty->termios_rwsem); while (1) { room = receive_room(tty); n = min(count, room); if (!n) { if (flow && !room) ldata->no_room = 1; break; } __receive_buf(tty, cp, fp, n); cp += n; if (fp) fp += n; count -= n; rcvd += n; } tty->receive_room = room; n_tty_check_throttle(tty); up_read(&tty->termios_rwsem); return rcvd; } ",0 "TestRenderFrame::~TestRenderFrame() {} ",0 " virtual size_t GetNumActiveInputMethods() { scoped_ptr input_methods(GetActiveInputMethods()); return input_methods->size(); } ",1 "void dev_queue_xmit_nit(struct sk_buff *skb, struct net_device *dev) { struct packet_type *ptype; struct sk_buff *skb2 = NULL; struct packet_type *pt_prev = NULL; struct list_head *ptype_list = &ptype_all; rcu_read_lock(); again: list_for_each_entry_rcu(ptype, ptype_list, list) { /* Never send packets back to the socket * they originated from - MvS (miquels@drinkel.ow.org) */ if (skb_loop_sk(ptype, skb)) continue; if (pt_prev) { deliver_skb(skb2, pt_prev, skb->dev); pt_prev = ptype; continue; } /* need to clone skb, done only once */ skb2 = skb_clone(skb, GFP_ATOMIC); if (!skb2) goto out_unlock; net_timestamp_set(skb2); /* skb->nh should be correctly * set by sender, so that the second statement is * just protection against buggy protocols. */ skb_reset_mac_header(skb2); if (skb_network_header(skb2) < skb2->data || skb_network_header(skb2) > skb_tail_pointer(skb2)) { net_crit_ratelimited(""protocol %04x is buggy, dev %s\n"", ntohs(skb2->protocol), dev->name); skb_reset_network_header(skb2); } skb2->transport_header = skb2->network_header; skb2->pkt_type = PACKET_OUTGOING; pt_prev = ptype; } if (ptype_list == &ptype_all) { ptype_list = &dev->ptype_all; goto again; } out_unlock: if (pt_prev) { if (!skb_orphan_frags_rx(skb2, GFP_ATOMIC)) pt_prev->func(skb2, skb->dev, pt_prev, skb->dev); else kfree_skb(skb2); } rcu_read_unlock(); } ",0 "static void add_workflow_buttons(GtkBox *box, GHashTable *workflows, GCallback func) { gtk_container_foreach(GTK_CONTAINER(box), &remove_child_widget, NULL); GList *possible_workflows = list_possible_events_glist(g_dump_dir_name, ""workflow""); GHashTable *workflow_table = load_workflow_config_data_from_list( possible_workflows, WORKFLOWS_DIR); g_list_free_full(possible_workflows, free); g_object_set_data_full(G_OBJECT(box), ""workflows"", workflow_table, (GDestroyNotify)g_hash_table_destroy); GList *wf_list = g_hash_table_get_values(workflow_table); wf_list = g_list_sort(wf_list, (GCompareFunc)wf_priority_compare); for (GList *wf_iter = wf_list; wf_iter; wf_iter = g_list_next(wf_iter)) { workflow_t *w = (workflow_t *)wf_iter->data; char *btn_label = xasprintf(""%s\n%s"", wf_get_screen_name(w), wf_get_description(w)); GtkWidget *button = gtk_button_new_with_label(btn_label); GList *children = gtk_container_get_children(GTK_CONTAINER(button)); GtkWidget *label = (GtkWidget *)children->data; gtk_label_set_use_markup(GTK_LABEL(label), true); gtk_widget_set_halign(label, GTK_ALIGN_START); gtk_widget_set_margin_top(label, 10); #if ((GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 11) || (GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION == 11 && GTK_MICRO_VERSION < 2)) gtk_widget_set_margin_left(label, 40); #else gtk_widget_set_margin_start(label, 40); #endif gtk_widget_set_margin_bottom(label, 10); g_list_free(children); free(btn_label); g_signal_connect(button, ""clicked"", func, w); gtk_box_pack_start(box, button, true, false, 2); } g_list_free(wf_list); } ",0 "int lxc_attach_run_shell(void* payload) { uid_t uid; struct passwd *passwd; char *user_shell; /* ignore payload parameter */ (void)payload; uid = getuid(); passwd = getpwuid(uid); /* this probably happens because of incompatible nss * implementations in host and container (remember, this * code is still using the host's glibc but our mount * namespace is in the container) * we may try to get the information by spawning a * [getent passwd uid] process and parsing the result */ if (!passwd) user_shell = lxc_attach_getpwshell(uid); else user_shell = passwd->pw_shell; if (user_shell) execlp(user_shell, user_shell, (char *)NULL); /* executed if either no passwd entry or execvp fails, * we will fall back on /bin/sh as a default shell */ execlp(""/bin/sh"", ""/bin/sh"", (char *)NULL); SYSERROR(""failed to exec shell""); return -1; } ",0 "void WindowTreeHostManager::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } ",0 "ProcClearToBackground(ClientPtr client) { REQUEST(xClearAreaReq); WindowPtr pWin; int rc; REQUEST_SIZE_MATCH(xClearAreaReq); rc = dixLookupWindow(&pWin, stuff->window, client, DixWriteAccess); if (rc != Success) return rc; if (pWin->drawable.class == InputOnly) { client->errorValue = stuff->window; return BadMatch; } if ((stuff->exposures != xTrue) && (stuff->exposures != xFalse)) { client->errorValue = stuff->exposures; return BadValue; } (*pWin->drawable.pScreen->ClearToBackground) (pWin, stuff->x, stuff->y, stuff->width, stuff->height, (Bool) stuff->exposures); return Success; } ",0 "static int qib_user_event_ack(struct qib_ctxtdata *rcd, int subctxt, unsigned long events) { int ret = 0, i; for (i = 0; i <= _QIB_MAX_EVENT_BIT; i++) { if (!test_bit(i, &events)) continue; if (i == _QIB_EVENT_DISARM_BUFS_BIT) { (void)qib_disarm_piobufs_ifneeded(rcd); ret = disarm_req_delay(rcd); } else clear_bit(i, &rcd->user_event_mask[subctxt]); } return ret; } ",0 "static int DecodeGifImg(struct ngiflib_img * i) { struct ngiflib_decode_context context; long npix; u8 * stackp; u8 * stack_top; u16 clr; u16 eof; u16 free; u16 act_code = 0; u16 old_code = 0; u16 read_byt; u16 ab_prfx[4096]; u8 ab_suffx[4096]; u8 ab_stack[4096]; u8 flags; u8 casspecial = 0; if(!i) return -1; i->posX = GetWord(i->parent); /* offsetX */ i->posY = GetWord(i->parent); /* offsetY */ i->width = GetWord(i->parent); /* SizeX */ i->height = GetWord(i->parent); /* SizeY */ context.Xtogo = i->width; context.curY = i->posY; #ifdef NGIFLIB_INDEXED_ONLY #ifdef NGIFLIB_ENABLE_CALLBACKS context.line_p.p8 = i->parent->frbuff.p8 + (u32)i->posY*i->parent->width; context.frbuff_p.p8 = context.line_p.p8 + i->posX; #else context.frbuff_p.p8 = i->parent->frbuff.p8 + (u32)i->posY*i->parent->width + i->posX; #endif /* NGIFLIB_ENABLE_CALLBACKS */ #else if(i->parent->mode & NGIFLIB_MODE_INDEXED) { #ifdef NGIFLIB_ENABLE_CALLBACKS context.line_p.p8 = i->parent->frbuff.p8 + (u32)i->posY*i->parent->width; context.frbuff_p.p8 = context.line_p.p8 + i->posX; #else context.frbuff_p.p8 = i->parent->frbuff.p8 + (u32)i->posY*i->parent->width + i->posX; #endif /* NGIFLIB_ENABLE_CALLBACKS */ } else { #ifdef NGIFLIB_ENABLE_CALLBACKS context.line_p.p32 = i->parent->frbuff.p32 + (u32)i->posY*i->parent->width; context.frbuff_p.p32 = context.line_p.p32 + i->posX; #else context.frbuff_p.p32 = i->parent->frbuff.p32 + (u32)i->posY*i->parent->width + i->posX; #endif /* NGIFLIB_ENABLE_CALLBACKS */ } #endif /* NGIFLIB_INDEXED_ONLY */ npix = (long)i->width * i->height; flags = GetByte(i->parent); i->interlaced = (flags & 64) >> 6; context.pass = i->interlaced ? 1 : 0; i->sort_flag = (flags & 32) >> 5; /* is local palette sorted by color frequency ? */ i->localpalbits = (flags & 7) + 1; if(flags&128) { /* palette locale */ int k; int localpalsize = 1 << i->localpalbits; #if !defined(NGIFLIB_NO_FILE) if(i->parent && i->parent->log) fprintf(i->parent->log, ""Local palette\n""); #endif /* !defined(NGIFLIB_NO_FILE) */ i->palette = (struct ngiflib_rgb *)ngiflib_malloc(sizeof(struct ngiflib_rgb)*localpalsize); for(k=0; kpalette[k].r = GetByte(i->parent); i->palette[k].g = GetByte(i->parent); i->palette[k].b = GetByte(i->parent); } #ifdef NGIFLIB_ENABLE_CALLBACKS if(i->parent->palette_cb) i->parent->palette_cb(i->parent, i->palette, localpalsize); #endif /* NGIFLIB_ENABLE_CALLBACKS */ } else { i->palette = i->parent->palette; i->localpalbits = i->parent->imgbits; } i->ncolors = 1 << i->localpalbits; i->imgbits = GetByte(i->parent); /* LZW Minimum Code Size */ #if !defined(NGIFLIB_NO_FILE) if(i->parent && i->parent->log) { if(i->interlaced) fprintf(i->parent->log, ""interlaced ""); fprintf(i->parent->log, ""img pos(%hu,%hu) size %hux%hu palbits=%hhu imgbits=%hhu ncolors=%hu\n"", i->posX, i->posY, i->width, i->height, i->localpalbits, i->imgbits, i->ncolors); } #endif /* !defined(NGIFLIB_NO_FILE) */ if(i->imgbits==1) { /* fix for 1bit images ? */ i->imgbits = 2; } clr = 1 << i->imgbits; eof = clr + 1; free = clr + 2; context.nbbit = i->imgbits + 1; context.max = clr + clr - 1; /* (1 << context.nbbit) - 1 */ stackp = stack_top = ab_stack + 4096; context.restbits = 0; /* initialise le ""buffer"" de lecture */ context.restbyte = 0; /* des codes LZW */ context.lbyte = 0; for(;;) { act_code = GetGifWord(i, &context); if(act_code==eof) { #if !defined(NGIFLIB_NO_FILE) if(i->parent && i->parent->log) fprintf(i->parent->log, ""End of image code\n""); #endif /* !defined(NGIFLIB_NO_FILE) */ return 0; } if(npix==0) { #if !defined(NGIFLIB_NO_FILE) if(i->parent && i->parent->log) fprintf(i->parent->log, ""assez de pixels, On se casse !\n""); #endif /* !defined(NGIFLIB_NO_FILE) */ return 1; } if(act_code==clr) { #if !defined(NGIFLIB_NO_FILE) if(i->parent && i->parent->log) fprintf(i->parent->log, ""Code clear (free=%hu) npix=%ld\n"", free, npix); #endif /* !defined(NGIFLIB_NO_FILE) */ /* clear */ free = clr + 2; context.nbbit = i->imgbits + 1; context.max = clr + clr - 1; /* (1 << context.nbbit) - 1 */ act_code = GetGifWord(i, &context); casspecial = (u8)act_code; old_code = act_code; WritePixel(i, &context, casspecial); npix--; } else { read_byt = act_code; if(act_code >= free) { /* code pas encore dans alphabet */ /* printf(""Code pas dans alphabet : %d>=%d push %d\n"", act_code, free, casspecial); */ *(--stackp) = casspecial; /* dernier debut de chaine ! */ act_code = old_code; } /* printf(""actcode=%d\n"", act_code); */ while(act_code > clr) { /* code non concret */ /* fillstackloop empile les suffixes ! */ *(--stackp) = ab_suffx[act_code]; act_code = ab_prfx[act_code]; /* prefixe */ } /* act_code est concret */ casspecial = (u8)act_code; /* dernier debut de chaine ! */ *(--stackp) = casspecial; /* push on stack */ WritePixels(i, &context, stackp, stack_top - stackp); /* unstack all pixels at once */ npix -= (stack_top - stackp); stackp = stack_top; /* putchar('\n'); */ if(free < 4096) { /* la taille du dico est 4096 max ! */ ab_prfx[free] = old_code; ab_suffx[free] = (u8)act_code; free++; if((free > context.max) && (context.nbbit < 12)) { context.nbbit++; /* 1 bit de plus pour les codes LZW */ context.max += context.max + 1; } } old_code = read_byt; } } return 0; } ",1 "rdp_send_input(uint32 time, uint16 message_type, uint16 device_flags, uint16 param1, uint16 param2) { STREAM s; logger(Protocol, Debug, ""%s()"", __func__); s = rdp_init_data(16); out_uint16_le(s, 1); /* number of events */ out_uint16(s, 0); /* pad */ out_uint32_le(s, time); out_uint16_le(s, message_type); out_uint16_le(s, device_flags); out_uint16_le(s, param1); out_uint16_le(s, param2); s_mark_end(s); rdp_send_data(s, RDP_DATA_PDU_INPUT); } ",0 "keepalived_alloc_log(bool final) { unsigned int overrun = 0, badptr = 0, zero_size = 0; size_t sum = 0; MEMCHECK *entry; if (final) { /* If this is a forked child, we don't want the dump */ if (skip_mem_check_final) return; fprintf(log_op, ""\n---[ Keepalived memory dump for (%s) ]---\n\n"", terminate_banner); } else fprintf(log_op, ""\n---[ Keepalived memory dump for (%s) at %s ]---\n\n"", terminate_banner, format_time()); /* List the blocks currently allocated */ if (!RB_EMPTY_ROOT(&alloc_list)) { fprintf(log_op, ""Entries %s\n\n"", final ? ""not released"" : ""currently allocated""); rb_for_each_entry(entry, &alloc_list, t) { sum += entry->size; fprintf(log_op, ""%9p [%3d:%3d], %4zu at %s, %3d, %s"", entry->ptr, entry->seq_num, number_alloc_list, entry->size, entry->file, entry->line, entry->func); if (entry->type != ALLOCATED) fprintf(log_op, "" type = %d"", entry->type); fprintf(log_op, ""\n""); } } if (!list_empty(&bad_list)) { if (!RB_EMPTY_ROOT(&alloc_list)) fprintf(log_op, ""\n""); fprintf(log_op, ""Bad entry list\n\n""); list_for_each_entry(entry, &bad_list, l) { switch (entry->type) { case FREE_NULL: badptr++; fprintf(log_op, ""%9s %9s, %4s at %s, %3d, %s - null pointer to free\n"", ""NULL"", """", """", entry->file, entry->line, entry->func); break; case REALLOC_NULL: badptr++; fprintf(log_op, ""%9s %9s, %4zu at %s, %3d, %s - null pointer to realloc (converted to malloc)\n"", ""NULL"", """", entry->size, entry->file, entry->line, entry->func); break; case FREE_NOT_ALLOC: badptr++; fprintf(log_op, ""%9p %9s, %4s at %s, %3d, %s - pointer not found for free\n"", entry->ptr, """", """", entry->file, entry->line, entry->func); break; case REALLOC_NOT_ALLOC: badptr++; fprintf(log_op, ""%9p %9s, %4zu at %s, %3d, %s - pointer not found for realloc\n"", entry->ptr, """", entry->size, entry->file, entry->line, entry->func); break; case DOUBLE_FREE: badptr++; fprintf(log_op, ""%9p %9s, %4s at %s, %3d, %s - double free of pointer\n"", entry->ptr, """", """", entry->file, entry->line, entry->func); break; case REALLOC_DOUBLE_FREE: badptr++; fprintf(log_op, ""%9p %9s, %4zu at %s, %3d, %s - realloc 0 size already freed\n"", entry->ptr, """", entry->size, entry->file, entry->line, entry->func); break; case OVERRUN: overrun++; fprintf(log_op, ""%9p [%3d:%3d], %4zu at %s, %3d, %s - buffer overrun\n"", entry->ptr, entry->seq_num, number_alloc_list, entry->size, entry->file, entry->line, entry->func); break; case MALLOC_ZERO_SIZE: zero_size++; fprintf(log_op, ""%9p [%3d:%3d], %4zu at %s, %3d, %s - malloc zero size\n"", entry->ptr, entry->seq_num, number_alloc_list, entry->size, entry->file, entry->line, entry->func); break; case REALLOC_ZERO_SIZE: zero_size++; fprintf(log_op, ""%9p [%3d:%3d], %4zu at %s, %3d, %s - realloc zero size (handled as free)\n"", entry->ptr, entry->seq_num, number_alloc_list, entry->size, entry->file, entry->line, entry->func); break; case ALLOCATED: /* not used - avoid compiler warning */ case FREE_SLOT: case LAST_FREE: break; } } } fprintf(log_op, ""\n\n---[ Keepalived memory dump summary for (%s) ]---\n"", terminate_banner); fprintf(log_op, ""Total number of bytes %s...: %zu\n"", final ? ""not freed"" : ""allocated"", sum); fprintf(log_op, ""Number of entries %s.......: %d\n"", final ? ""not freed"" : ""allocated"", number_alloc_list); fprintf(log_op, ""Maximum allocated entries.........: %d\n"", max_alloc_list); fprintf(log_op, ""Maximum memory allocated..........: %zu\n"", max_mem_allocated); fprintf(log_op, ""Number of mallocs.................: %d\n"", num_mallocs); fprintf(log_op, ""Number of reallocs................: %d\n"", num_reallocs); fprintf(log_op, ""Number of bad entries.............: %d\n"", badptr); fprintf(log_op, ""Number of buffer overrun..........: %d\n"", overrun); fprintf(log_op, ""Number of 0 size allocations......: %d\n\n"", zero_size); if (sum != mem_allocated) fprintf(log_op, ""ERROR - sum of allocated %zu != mem_allocated %zu\n"", sum, mem_allocated); if (final) { if (sum || number_alloc_list || badptr || overrun) fprintf(log_op, ""=> Program seems to have some memory problem !!!\n\n""); else fprintf(log_op, ""=> Program seems to be memory allocation safe...\n\n""); } } ",0 "GF_Err subs_Read(GF_Box *s, GF_BitStream *bs) { GF_SubSampleInformationBox *ptr = (GF_SubSampleInformationBox *)s; u32 entry_count, i, j; u16 subsample_count; entry_count = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 4); for (i=0; iSubSamples = gf_list_new(); pSamp->sample_delta = gf_bs_read_u32(bs); subsample_count = gf_bs_read_u16(bs); subs_size=6; for (j=0; jversion==1) { pSubSamp->subsample_size = gf_bs_read_u32(bs); subs_size+=4; } else { pSubSamp->subsample_size = gf_bs_read_u16(bs); subs_size+=2; } pSubSamp->subsample_priority = gf_bs_read_u8(bs); pSubSamp->discardable = gf_bs_read_u8(bs); pSubSamp->reserved = gf_bs_read_u32(bs); subs_size+=6; gf_list_add(pSamp->SubSamples, pSubSamp); } gf_list_add(ptr->Samples, pSamp); ISOM_DECREASE_SIZE(ptr, subs_size); } return GF_OK; } ",0 "void DelegatedFrameHost::OnBeginFrame(const viz::BeginFrameArgs& args) { if (renderer_compositor_frame_sink_) renderer_compositor_frame_sink_->OnBeginFrame(args); client_->OnBeginFrame(); } ",0 "static int get_option_gid(substring_t args[], kgid_t *result) { unsigned long value; kgid_t gid; int rc; rc = get_option_ul(args, &value); if (rc) return rc; gid = make_kgid(current_user_ns(), value); if (!gid_valid(gid)) return -EINVAL; *result = gid; return 0; } ",0 "static ssize_t aio_setup_single_vector(struct kiocb *kiocb, int rw, char __user *buf, unsigned long *nr_segs, struct iovec *iovec) { if (unlikely(!access_ok(!rw, buf, kiocb->ki_nbytes))) return -EFAULT; iovec->iov_base = buf; iovec->iov_len = kiocb->ki_nbytes; *nr_segs = 1; return 0; } ",1 " void DoAuthCallback(const AuthCallback& callback, AuthCredentials* credentials) { if (auth_callback_retval_ == NetworkDelegate::AUTH_REQUIRED_RESPONSE_SET_AUTH) { *credentials = auth_credentials_; } callback.Run(auth_callback_retval_); } ",0 " OVS_REQUIRES(ofproto_mutex) { struct ofproto *ofproto = rule->ofproto; struct oftable *table = &ofproto->tables[rule->table_id]; bool has_timeout; /* Timeouts may be modified only when holding 'ofproto_mutex'. We have it * so no additional protection is needed. */ has_timeout = rule->hard_timeout || rule->idle_timeout; if (table->eviction && has_timeout) { struct eviction_group *evg; evg = eviction_group_find(table, eviction_group_hash_rule(rule)); rule->eviction_group = evg; heap_insert(&evg->rules, &rule->evg_node, rule_eviction_priority(ofproto, rule)); eviction_group_resized(table, evg); } } ",0 " explicit HostComponentTransform(bool trim_trivial_subdomains) : trim_trivial_subdomains_(trim_trivial_subdomains) {} ",0 "static void locationWithExceptionAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueFast(info, WTF::getPtr(imp->locationWithException()), imp); } ",0 "SpeechRecognitionManagerImpl::GetSessionContext(int session_id) const { return GetSession(session_id)->context; } ",0 "nfs4_init_uniquifier_client_string(struct nfs_client *clp) { int result; size_t len; char *str; len = 10 + 10 + 1 + 10 + 1 + strlen(nfs4_client_id_uniquifier) + 1 + strlen(clp->cl_rpcclient->cl_nodename) + 1; if (len > NFS4_OPAQUE_LIMIT + 1) return -EINVAL; /* * Since this string is allocated at mount time, and held until the * nfs_client is destroyed, we can use GFP_KERNEL here w/o worrying * about a memory-reclaim deadlock. */ str = kmalloc(len, GFP_KERNEL); if (!str) return -ENOMEM; result = scnprintf(str, len, ""Linux NFSv%u.%u %s/%s"", clp->rpc_ops->version, clp->cl_minorversion, nfs4_client_id_uniquifier, clp->cl_rpcclient->cl_nodename); if (result >= len) { kfree(str); return -EINVAL; } clp->cl_owner_id = str; return 0; } ",0 "static int ext4_freeze(struct super_block *sb) { int error = 0; journal_t *journal; if (sb->s_flags & MS_RDONLY) return 0; journal = EXT4_SB(sb)->s_journal; /* Now we set up the journal barrier. */ jbd2_journal_lock_updates(journal); /* * Don't clear the needs_recovery flag if we failed to flush * the journal. */ error = jbd2_journal_flush(journal); if (error < 0) goto out; /* Journal blocked and flushed, clear needs_recovery flag. */ EXT4_CLEAR_INCOMPAT_FEATURE(sb, EXT4_FEATURE_INCOMPAT_RECOVER); error = ext4_commit_super(sb, 1); out: /* we rely on s_frozen to stop further updates */ jbd2_journal_unlock_updates(EXT4_SB(sb)->s_journal); return error; } ",0 "static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action, void *hcpu) { switch (action) { case CPU_ONLINE_FROZEN: case CPU_DOWN_FAILED_FROZEN: /* * num_cpus_frozen tracks how many CPUs are involved in suspend * resume sequence. As long as this is not the last online * operation in the resume sequence, just build a single sched * domain, ignoring cpusets. */ num_cpus_frozen--; if (likely(num_cpus_frozen)) { partition_sched_domains(1, NULL, NULL); break; } /* * This is the last CPU online operation. So fall through and * restore the original sched domains by considering the * cpuset configurations. */ case CPU_ONLINE: case CPU_DOWN_FAILED: cpuset_update_active_cpus(true); break; default: return NOTIFY_DONE; } return NOTIFY_OK; } ",0 "ipmi_addr_equal(struct ipmi_addr *addr1, struct ipmi_addr *addr2) { if (addr1->addr_type != addr2->addr_type) return 0; if (addr1->channel != addr2->channel) return 0; if (addr1->addr_type == IPMI_SYSTEM_INTERFACE_ADDR_TYPE) { struct ipmi_system_interface_addr *smi_addr1 = (struct ipmi_system_interface_addr *) addr1; struct ipmi_system_interface_addr *smi_addr2 = (struct ipmi_system_interface_addr *) addr2; return (smi_addr1->lun == smi_addr2->lun); } if (is_ipmb_addr(addr1) || is_ipmb_bcast_addr(addr1)) { struct ipmi_ipmb_addr *ipmb_addr1 = (struct ipmi_ipmb_addr *) addr1; struct ipmi_ipmb_addr *ipmb_addr2 = (struct ipmi_ipmb_addr *) addr2; return ((ipmb_addr1->slave_addr == ipmb_addr2->slave_addr) && (ipmb_addr1->lun == ipmb_addr2->lun)); } if (is_lan_addr(addr1)) { struct ipmi_lan_addr *lan_addr1 = (struct ipmi_lan_addr *) addr1; struct ipmi_lan_addr *lan_addr2 = (struct ipmi_lan_addr *) addr2; return ((lan_addr1->remote_SWID == lan_addr2->remote_SWID) && (lan_addr1->local_SWID == lan_addr2->local_SWID) && (lan_addr1->session_handle == lan_addr2->session_handle) && (lan_addr1->lun == lan_addr2->lun)); } return 1; } ",0 "vcard_response_new_status_bytes(unsigned char sw1, unsigned char sw2) { VCardResponse *new_response; new_response = g_new(VCardResponse, 1); new_response->b_data = &new_response->b_sw1; new_response->b_len = 0; new_response->b_total_len = 2; new_response->b_type = VCARD_MALLOC_STRUCT; vcard_response_set_status_bytes(new_response, sw1, sw2); return new_response; } ",0 "static inline int proto_to_npindex(int proto) { switch (proto) { case PPP_IP: return NP_IP; case PPP_IPV6: return NP_IPV6; case PPP_IPX: return NP_IPX; case PPP_AT: return NP_AT; case PPP_MPLS_UC: return NP_MPLS_UC; case PPP_MPLS_MC: return NP_MPLS_MC; } return -EINVAL; } ",0 "static void voidMethodStringArgLongArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""voidMethodStringArgLongArg"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 2)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(2, info.Length())); exceptionState.throwIfNeeded(); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, stringArg, info[0]); V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[1], exceptionState), exceptionState); imp->voidMethodStringArgLongArg(stringArg, longArg); } ",0 "static phys_addr_t hns_rcb_common_get_paddr(struct rcb_common_cb *rcb_common) { struct dsaf_device *dsaf_dev = rcb_common->dsaf_dev; return dsaf_dev->ppe_paddr + RCB_COMMON_REG_OFFSET; } ",0 "static void free_sched_domain(struct rcu_head *rcu) { struct sched_domain *sd = container_of(rcu, struct sched_domain, rcu); /* * If its an overlapping domain it has private groups, iterate and * nuke them all. */ if (sd->flags & SD_OVERLAP) { free_sched_groups(sd->groups, 1); } else if (atomic_dec_and_test(&sd->groups->ref)) { kfree(sd->groups->sgc); kfree(sd->groups); } kfree(sd); } ",0 "receive_self_carbon(void **state) { prof_input(""/carbons on""); prof_connect(); assert_true(stbbr_received( """" )); stbbr_send( """" ""10"" ""On my mobile"" """" ); assert_true(prof_output_exact(""Buddy1 (mobile) is online, \""On my mobile\"""")); prof_input(""/msg Buddy1""); assert_true(prof_output_exact(""unencrypted"")); stbbr_send( """" """" """" """" ""self sent carbon"" """" """" """" """" ); assert_true(prof_output_regex(""me: .+self sent carbon"")); } ",0 "int ff_side_data_update_matrix_encoding(AVFrame *frame, enum AVMatrixEncoding matrix_encoding) { AVFrameSideData *side_data; enum AVMatrixEncoding *data; side_data = av_frame_get_side_data(frame, AV_FRAME_DATA_MATRIXENCODING); if (!side_data) side_data = av_frame_new_side_data(frame, AV_FRAME_DATA_MATRIXENCODING, sizeof(enum AVMatrixEncoding)); if (!side_data) return AVERROR(ENOMEM); data = (enum AVMatrixEncoding*)side_data->data; *data = matrix_encoding; return 0; } ",0 "CIFSSMBRead(const int xid, struct cifs_io_parms *io_parms, unsigned int *nbytes, char **buf, int *pbuf_type) { int rc = -EACCES; READ_REQ *pSMB = NULL; READ_RSP *pSMBr = NULL; char *pReadData = NULL; int wct; int resp_buf_type = 0; struct kvec iov[1]; __u32 pid = io_parms->pid; __u16 netfid = io_parms->netfid; __u64 offset = io_parms->offset; struct cifs_tcon *tcon = io_parms->tcon; unsigned int count = io_parms->length; cFYI(1, ""Reading %d bytes on fid %d"", count, netfid); if (tcon->ses->capabilities & CAP_LARGE_FILES) wct = 12; else { wct = 10; /* old style read */ if ((offset >> 32) > 0) { /* can not handle this big offset for old */ return -EIO; } } *nbytes = 0; rc = small_smb_init(SMB_COM_READ_ANDX, wct, tcon, (void **) &pSMB); if (rc) return rc; pSMB->hdr.Pid = cpu_to_le16((__u16)pid); pSMB->hdr.PidHigh = cpu_to_le16((__u16)(pid >> 16)); /* tcon and ses pointer are checked in smb_init */ if (tcon->ses->server == NULL) return -ECONNABORTED; pSMB->AndXCommand = 0xFF; /* none */ pSMB->Fid = netfid; pSMB->OffsetLow = cpu_to_le32(offset & 0xFFFFFFFF); if (wct == 12) pSMB->OffsetHigh = cpu_to_le32(offset >> 32); pSMB->Remaining = 0; pSMB->MaxCount = cpu_to_le16(count & 0xFFFF); pSMB->MaxCountHigh = cpu_to_le32(count >> 16); if (wct == 12) pSMB->ByteCount = 0; /* no need to do le conversion since 0 */ else { /* old style read */ struct smb_com_readx_req *pSMBW = (struct smb_com_readx_req *)pSMB; pSMBW->ByteCount = 0; } iov[0].iov_base = (char *)pSMB; iov[0].iov_len = be32_to_cpu(pSMB->hdr.smb_buf_length) + 4; rc = SendReceive2(xid, tcon->ses, iov, 1 /* num iovecs */, &resp_buf_type, CIFS_LOG_ERROR); cifs_stats_inc(&tcon->num_reads); pSMBr = (READ_RSP *)iov[0].iov_base; if (rc) { cERROR(1, ""Send error in read = %d"", rc); } else { int data_length = le16_to_cpu(pSMBr->DataLengthHigh); data_length = data_length << 16; data_length += le16_to_cpu(pSMBr->DataLength); *nbytes = data_length; /*check that DataLength would not go beyond end of SMB */ if ((data_length > CIFSMaxBufSize) || (data_length > count)) { cFYI(1, ""bad length %d for count %d"", data_length, count); rc = -EIO; *nbytes = 0; } else { pReadData = (char *) (&pSMBr->hdr.Protocol) + le16_to_cpu(pSMBr->DataOffset); /* if (rc = copy_to_user(buf, pReadData, data_length)) { cERROR(1, ""Faulting on read rc = %d"",rc); rc = -EFAULT; }*/ /* can not use copy_to_user when using page cache*/ if (*buf) memcpy(*buf, pReadData, data_length); } } /* cifs_small_buf_release(pSMB); */ /* Freed earlier now in SendReceive2 */ if (*buf) { if (resp_buf_type == CIFS_SMALL_BUFFER) cifs_small_buf_release(iov[0].iov_base); else if (resp_buf_type == CIFS_LARGE_BUFFER) cifs_buf_release(iov[0].iov_base); } else if (resp_buf_type != CIFS_NO_BUFFER) { /* return buffer to caller to free */ *buf = iov[0].iov_base; if (resp_buf_type == CIFS_SMALL_BUFFER) *pbuf_type = CIFS_SMALL_BUFFER; else if (resp_buf_type == CIFS_LARGE_BUFFER) *pbuf_type = CIFS_LARGE_BUFFER; } /* else no valid buffer on return - leave as null */ /* Note: On -EAGAIN error only caller can retry on handle based calls since file handle passed in no longer valid */ return rc; } ",0 "bool TaskQueue::PostDelayedTaskImpl(const tracked_objects::Location& from_here, const base::Closure& task, base::TimeDelta delay, TaskType task_type) { base::AutoLock lock(lock_); if (!task_queue_manager_) return false; base::PendingTask pending_task(from_here, task, base::TimeTicks(), task_type != TaskType::NON_NESTABLE); task_queue_manager_->DidQueueTask(&pending_task); if (delay > base::TimeDelta()) { base::TimeTicks now = task_queue_manager_->Now(); pending_task.delayed_run_time = now + delay; delayed_task_queue_.push(pending_task); TraceQueueSize(true); if (delayed_task_queue_.top().task.Equals(pending_task.task)) { LazyNow lazy_now(now); ScheduleDelayedWorkLocked(&lazy_now); } return true; } EnqueueTaskLocked(pending_task); return true; } ",0 "int ssl3_client_hello(SSL *s) { unsigned char *buf; unsigned char *p, *d; int i; unsigned long l; int al = 0; #ifndef OPENSSL_NO_COMP int j; SSL_COMP *comp; #endif buf = (unsigned char *)s->init_buf->data; if (s->state == SSL3_ST_CW_CLNT_HELLO_A) { SSL_SESSION *sess = s->session; /* Work out what SSL/TLS/DTLS version to use */ if (ssl_set_version(s) == 0) goto err; if ((sess == NULL) || (sess->ssl_version != s->version) || /* * In the case of EAP-FAST, we can have a pre-shared * ""ticket"" without a session ID. */ (!sess->session_id_length && !sess->tlsext_tick) || (sess->not_resumable)) { if (!ssl_get_new_session(s, 0)) goto err; } /* else use the pre-loaded session */ p = s->s3->client_random; /* * for DTLS if client_random is initialized, reuse it, we are * required to use same upon reply to HelloVerify */ if (SSL_IS_DTLS(s)) { size_t idx; i = 1; for (idx = 0; idx < sizeof(s->s3->client_random); idx++) { if (p[idx]) { i = 0; break; } } } else i = 1; if (i && ssl_fill_hello_random(s, 0, p, sizeof(s->s3->client_random)) <= 0) goto err; /* Do the message type and length last */ d = p = ssl_handshake_start(s); /*- * version indicates the negotiated version: for example from * an SSLv2/v3 compatible client hello). The client_version * field is the maximum version we permit and it is also * used in RSA encrypted premaster secrets. Some servers can * choke if we initially report a higher version then * renegotiate to a lower one in the premaster secret. This * didn't happen with TLS 1.0 as most servers supported it * but it can with TLS 1.1 or later if the server only supports * 1.0. * * Possible scenario with previous logic: * 1. Client hello indicates TLS 1.2 * 2. Server hello says TLS 1.0 * 3. RSA encrypted premaster secret uses 1.2. * 4. Handhaked proceeds using TLS 1.0. * 5. Server sends hello request to renegotiate. * 6. Client hello indicates TLS v1.0 as we now * know that is maximum server supports. * 7. Server chokes on RSA encrypted premaster secret * containing version 1.0. * * For interoperability it should be OK to always use the * maximum version we support in client hello and then rely * on the checking of version to ensure the servers isn't * being inconsistent: for example initially negotiating with * TLS 1.0 and renegotiating with TLS 1.2. We do this by using * client_version in client hello and not resetting it to * the negotiated version. */ *(p++) = s->client_version >> 8; *(p++) = s->client_version & 0xff; /* Random stuff */ memcpy(p, s->s3->client_random, SSL3_RANDOM_SIZE); p += SSL3_RANDOM_SIZE; /* Session ID */ if (s->new_session) i = 0; else i = s->session->session_id_length; *(p++) = i; if (i != 0) { if (i > (int)sizeof(s->session->session_id)) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } memcpy(p, s->session->session_id, i); p += i; } /* cookie stuff for DTLS */ if (SSL_IS_DTLS(s)) { if (s->d1->cookie_len > sizeof(s->d1->cookie)) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } *(p++) = s->d1->cookie_len; memcpy(p, s->d1->cookie, s->d1->cookie_len); p += s->d1->cookie_len; } /* Ciphers supported */ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0); if (i == 0) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, SSL_R_NO_CIPHERS_AVAILABLE); goto err; } #ifdef OPENSSL_MAX_TLS1_2_CIPHER_LENGTH /* * Some servers hang if client hello > 256 bytes as hack workaround * chop number of supported ciphers to keep it well below this if we * use TLS v1.2 */ if (TLS1_get_version(s) >= TLS1_2_VERSION && i > OPENSSL_MAX_TLS1_2_CIPHER_LENGTH) i = OPENSSL_MAX_TLS1_2_CIPHER_LENGTH & ~1; #endif s2n(i, p); p += i; /* COMPRESSION */ #ifdef OPENSSL_NO_COMP *(p++) = 1; #else if (!ssl_allow_compression(s) || !s->ctx->comp_methods) j = 0; else j = sk_SSL_COMP_num(s->ctx->comp_methods); *(p++) = 1 + j; for (i = 0; i < j; i++) { comp = sk_SSL_COMP_value(s->ctx->comp_methods, i); *(p++) = comp->id; } #endif *(p++) = 0; /* Add the NULL method */ /* TLS extensions */ if (ssl_prepare_clienthello_tlsext(s) <= 0) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); goto err; } if ((p = ssl_add_clienthello_tlsext(s, p, buf + SSL3_RT_MAX_PLAIN_LENGTH, &al)) == NULL) { ssl3_send_alert(s, SSL3_AL_FATAL, al); SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } l = p - d; if (!ssl_set_handshake_header(s, SSL3_MT_CLIENT_HELLO, l)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } s->state = SSL3_ST_CW_CLNT_HELLO_B; } /* SSL3_ST_CW_CLNT_HELLO_B */ return ssl_do_write(s); err: s->state = SSL_ST_ERR; return (-1); } ",0 "static int apic_reg_read(struct kvm_lapic *apic, u32 offset, int len, void *data) { unsigned char alignment = offset & 0xf; u32 result; /* this bitmask has a bit cleared for each reserved register */ static const u64 rmask = 0x43ff01ffffffe70cULL; if ((alignment + len) > 4) { apic_debug(""KVM_APIC_READ: alignment error %x %d\n"", offset, len); return 1; } if (offset > 0x3f0 || !(rmask & (1ULL << (offset >> 4)))) { apic_debug(""KVM_APIC_READ: read reserved register %x\n"", offset); return 1; } result = __apic_read(apic, offset & ~0xf); trace_kvm_apic_read(offset, result); switch (len) { case 1: case 2: case 4: memcpy(data, (char *)&result + alignment, len); break; default: printk(KERN_ERR ""Local APIC read with len = %x, "" ""should be 1,2, or 4 instead\n"", len); break; } return 0; } ",0 "struct posix_acl *jfs_get_acl(struct inode *inode, int type) { struct posix_acl *acl; char *ea_name; int size; char *value = NULL; switch(type) { case ACL_TYPE_ACCESS: ea_name = XATTR_NAME_POSIX_ACL_ACCESS; break; case ACL_TYPE_DEFAULT: ea_name = XATTR_NAME_POSIX_ACL_DEFAULT; break; default: return ERR_PTR(-EINVAL); } size = __jfs_getxattr(inode, ea_name, NULL, 0); if (size > 0) { value = kmalloc(size, GFP_KERNEL); if (!value) return ERR_PTR(-ENOMEM); size = __jfs_getxattr(inode, ea_name, value, size); } if (size < 0) { if (size == -ENODATA) acl = NULL; else acl = ERR_PTR(size); } else { acl = posix_acl_from_xattr(&init_user_ns, value, size); } kfree(value); return acl; } ",0 "ecc_verify (gcry_sexp_t s_sig, gcry_sexp_t s_data, gcry_sexp_t s_keyparms) { gcry_err_code_t rc; struct pk_encoding_ctx ctx; gcry_sexp_t l1 = NULL; char *curvename = NULL; gcry_mpi_t mpi_g = NULL; gcry_mpi_t mpi_q = NULL; gcry_mpi_t sig_r = NULL; gcry_mpi_t sig_s = NULL; gcry_mpi_t data = NULL; ECC_public_key pk; int sigflags; memset (&pk, 0, sizeof pk); _gcry_pk_util_init_encoding_ctx (&ctx, PUBKEY_OP_VERIFY, ecc_get_nbits (s_keyparms)); /* Extract the data. */ rc = _gcry_pk_util_data_to_mpi (s_data, &data, &ctx); if (rc) goto leave; if (DBG_CIPHER) log_mpidump (""ecc_verify data"", data); /* * Extract the signature value. */ rc = _gcry_pk_util_preparse_sigval (s_sig, ecc_names, &l1, &sigflags); if (rc) goto leave; rc = sexp_extract_param (l1, NULL, (sigflags & PUBKEY_FLAG_EDDSA)? ""/rs"":""rs"", &sig_r, &sig_s, NULL); if (rc) goto leave; if (DBG_CIPHER) { log_mpidump (""ecc_verify s_r"", sig_r); log_mpidump (""ecc_verify s_s"", sig_s); } if ((ctx.flags & PUBKEY_FLAG_EDDSA) ^ (sigflags & PUBKEY_FLAG_EDDSA)) { rc = GPG_ERR_CONFLICT; /* Inconsistent use of flag/algoname. */ goto leave; } /* * Extract the key. */ if ((ctx.flags & PUBKEY_FLAG_PARAM)) rc = sexp_extract_param (s_keyparms, NULL, ""-p?a?b?g?n?h?/q"", &pk.E.p, &pk.E.a, &pk.E.b, &mpi_g, &pk.E.n, &pk.E.h, &mpi_q, NULL); else rc = sexp_extract_param (s_keyparms, NULL, ""/q"", &mpi_q, NULL); if (rc) goto leave; if (mpi_g) { point_init (&pk.E.G); rc = _gcry_ecc_os2ec (&pk.E.G, mpi_g); if (rc) goto leave; } /* Add missing parameters using the optional curve parameter. */ sexp_release (l1); l1 = sexp_find_token (s_keyparms, ""curve"", 5); if (l1) { curvename = sexp_nth_string (l1, 1); if (curvename) { rc = _gcry_ecc_fill_in_curve (0, curvename, &pk.E, NULL); if (rc) goto leave; } } /* Guess required fields if a curve parameter has not been given. FIXME: This is a crude hacks. We need to fix that. */ if (!curvename) { pk.E.model = ((sigflags & PUBKEY_FLAG_EDDSA) ? MPI_EC_EDWARDS : MPI_EC_WEIERSTRASS); pk.E.dialect = ((sigflags & PUBKEY_FLAG_EDDSA) ? ECC_DIALECT_ED25519 : ECC_DIALECT_STANDARD); if (!pk.E.h) pk.E.h = mpi_const (MPI_C_ONE); } if (DBG_CIPHER) { log_debug (""ecc_verify info: %s/%s%s\n"", _gcry_ecc_model2str (pk.E.model), _gcry_ecc_dialect2str (pk.E.dialect), (sigflags & PUBKEY_FLAG_EDDSA)? ""+EdDSA"":""""); if (pk.E.name) log_debug (""ecc_verify name: %s\n"", pk.E.name); log_printmpi (""ecc_verify p"", pk.E.p); log_printmpi (""ecc_verify a"", pk.E.a); log_printmpi (""ecc_verify b"", pk.E.b); log_printpnt (""ecc_verify g"", &pk.E.G, NULL); log_printmpi (""ecc_verify n"", pk.E.n); log_printmpi (""ecc_verify h"", pk.E.h); log_printmpi (""ecc_verify q"", mpi_q); } if (!pk.E.p || !pk.E.a || !pk.E.b || !pk.E.G.x || !pk.E.n || !pk.E.h || !mpi_q) { rc = GPG_ERR_NO_OBJ; goto leave; } /* * Verify the signature. */ if ((sigflags & PUBKEY_FLAG_EDDSA)) { rc = _gcry_ecc_eddsa_verify (data, &pk, sig_r, sig_s, ctx.hash_algo, mpi_q); } else if ((sigflags & PUBKEY_FLAG_GOST)) { point_init (&pk.Q); rc = _gcry_ecc_os2ec (&pk.Q, mpi_q); if (rc) goto leave; rc = _gcry_ecc_gost_verify (data, &pk, sig_r, sig_s); } else { point_init (&pk.Q); if (pk.E.dialect == ECC_DIALECT_ED25519) { mpi_ec_t ec; /* Fixme: Factor the curve context setup out of eddsa_verify and ecdsa_verify. So that we don't do it twice. */ ec = _gcry_mpi_ec_p_internal_new (pk.E.model, pk.E.dialect, 0, pk.E.p, pk.E.a, pk.E.b); rc = _gcry_ecc_eddsa_decodepoint (mpi_q, ec, &pk.Q, NULL, NULL); _gcry_mpi_ec_free (ec); } else { rc = _gcry_ecc_os2ec (&pk.Q, mpi_q); } if (rc) goto leave; if (mpi_is_opaque (data)) { const void *abuf; unsigned int abits, qbits; gcry_mpi_t a; qbits = mpi_get_nbits (pk.E.n); abuf = mpi_get_opaque (data, &abits); rc = _gcry_mpi_scan (&a, GCRYMPI_FMT_USG, abuf, (abits+7)/8, NULL); if (!rc) { if (abits > qbits) mpi_rshift (a, a, abits - qbits); rc = _gcry_ecc_ecdsa_verify (a, &pk, sig_r, sig_s); _gcry_mpi_release (a); } } else rc = _gcry_ecc_ecdsa_verify (data, &pk, sig_r, sig_s); } leave: _gcry_mpi_release (pk.E.p); _gcry_mpi_release (pk.E.a); _gcry_mpi_release (pk.E.b); _gcry_mpi_release (mpi_g); point_free (&pk.E.G); _gcry_mpi_release (pk.E.n); _gcry_mpi_release (pk.E.h); _gcry_mpi_release (mpi_q); point_free (&pk.Q); _gcry_mpi_release (data); _gcry_mpi_release (sig_r); _gcry_mpi_release (sig_s); xfree (curvename); sexp_release (l1); _gcry_pk_util_free_encoding_ctx (&ctx); if (DBG_CIPHER) log_debug (""ecc_verify => %s\n"", rc?gpg_strerror (rc):""Good""); return rc; } ",0 "static void adapter_properties_callback(bt_status_t status, int num_properties, bt_property_t *properties) { jobjectArray props; jintArray types; jbyteArray val; jclass mclass; if (!checkCallbackThread()) { ALOGE(""Callback: '%s' is not called on the correct thread"", __FUNCTION__); return; } ALOGV(""%s: Status is: %d, Properties: %d"", __FUNCTION__, status, num_properties); if (status != BT_STATUS_SUCCESS) { ALOGE(""%s: Status %d is incorrect"", __FUNCTION__, status); return; } val = (jbyteArray) callbackEnv->NewByteArray(num_properties); if (val == NULL) { ALOGE(""%s: Error allocating byteArray"", __FUNCTION__); return; } mclass = callbackEnv->GetObjectClass(val); /* (BT) Initialize the jobjectArray and jintArray here itself and send the initialized array pointers alone to get_properties */ props = callbackEnv->NewObjectArray(num_properties, mclass, NULL); if (props == NULL) { ALOGE(""%s: Error allocating object Array for properties"", __FUNCTION__); return; } types = (jintArray)callbackEnv->NewIntArray(num_properties); if (types == NULL) { ALOGE(""%s: Error allocating int Array for values"", __FUNCTION__); return; } callbackEnv->DeleteLocalRef(mclass); callbackEnv->DeleteLocalRef(val); if (get_properties(num_properties, properties, &types, &props) < 0) { if (props) callbackEnv->DeleteLocalRef(props); if (types) callbackEnv->DeleteLocalRef(types); return; } callbackEnv->CallVoidMethod(sJniCallbacksObj, method_adapterPropertyChangedCallback, types, props); checkAndClearExceptionFromCallback(callbackEnv, __FUNCTION__); callbackEnv->DeleteLocalRef(props); callbackEnv->DeleteLocalRef(types); return; } ",0 " IndexedDBDispatcher::~IndexedDBDispatcher() { g_idb_dispatcher_tls.Pointer()->Set(NULL); } ",1 "void SetPreferencesFromJson(Profile* profile, const std::string& json) { base::DictionaryValue* dict = nullptr; std::unique_ptr parsed = base::JSONReader::Read(json); if (!parsed || !parsed->GetAsDictionary(&dict)) return; DictionaryPrefUpdate update(profile->GetPrefs(), prefs::kDevToolsPreferences); for (base::DictionaryValue::Iterator it(*dict); !it.IsAtEnd(); it.Advance()) { if (!it.value().IsType(base::Value::TYPE_STRING)) continue; update.Get()->SetWithoutPathExpansion( it.key(), it.value().CreateDeepCopy()); } } ",0 " void HTMLFormControlElement::setAutofilled(bool autofilled) { if (autofilled == m_isAutofilled) return; m_isAutofilled = autofilled; setNeedsStyleRecalc(); } ",0 "armv6_pmcr_read(void) { u32 val; asm volatile(""mrc p15, 0, %0, c15, c12, 0"" : ""=r""(val)); return val; } ",0 "onig_initialize(OnigEncoding encodings[], int n) { int i; int r; if (onig_inited != 0) return 0; onigenc_init(); onig_inited = 1; for (i = 0; i < n; i++) { OnigEncoding enc = encodings[i]; r = onig_initialize_encoding(enc); if (r != 0) return r; } return ONIG_NORMAL; } ",0 "bool ExtensionDevToolsClientHost::MayAttachToRenderer( content::RenderFrameHost* render_frame_host, bool is_webui) { if (is_webui) return false; if (!render_frame_host) return true; std::string error; const GURL& site_instance_url = render_frame_host->GetSiteInstance()->GetSiteURL(); if (site_instance_url.is_empty() || site_instance_url == ""about:"") { return true; } return ExtensionCanAttachToURL(*extension_, site_instance_url, profile_, &error); } ",0 "bool AppCacheDatabase::GetDeletableResponseIds( std::vector* response_ids, int64_t max_rowid, int limit) { if (!LazyOpen(kDontCreate)) return false; static const char kSql[] = ""SELECT response_id FROM DeletableResponseIds "" "" WHERE rowid <= ?"" "" LIMIT ?""; sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql)); statement.BindInt64(0, max_rowid); statement.BindInt64(1, limit); while (statement.Step()) response_ids->push_back(statement.ColumnInt64(0)); return statement.Succeeded(); } ",0 "void HostNPScriptObject::LogDebugInfo(const std::string& message) { if (log_debug_info_func_.get()) { am_currently_logging_ = true; NPVariant log_message; STRINGZ_TO_NPVARIANT(message.c_str(), log_message); bool is_good = InvokeAndIgnoreResult(log_debug_info_func_.get(), &log_message, 1); if (!is_good) { LOG(ERROR) << ""ERROR - LogDebugInfo failed\n""; } am_currently_logging_ = false; } } ",0 "static int jpc_dec_dump(jpc_dec_t *dec, FILE *out) { jpc_dec_tile_t *tile; int tileno; jpc_dec_tcomp_t *tcomp; int compno; jpc_dec_rlvl_t *rlvl; int rlvlno; jpc_dec_band_t *band; int bandno; jpc_dec_prc_t *prc; int prcno; jpc_dec_cblk_t *cblk; int cblkno; assert(!dec->numtiles || dec->tiles); for (tileno = 0, tile = dec->tiles; tileno < dec->numtiles; ++tileno, ++tile) { assert(!dec->numcomps || tile->tcomps); for (compno = 0, tcomp = tile->tcomps; compno < dec->numcomps; ++compno, ++tcomp) { for (rlvlno = 0, rlvl = tcomp->rlvls; rlvlno < tcomp->numrlvls; ++rlvlno, ++rlvl) { fprintf(out, ""RESOLUTION LEVEL %d\n"", rlvlno); fprintf(out, ""xs = %""PRIuFAST32"", ys = %""PRIuFAST32"", xe = %""PRIuFAST32"", ye = %""PRIuFAST32"", w = %""PRIuFAST32"", h = %""PRIuFAST32""\n"", rlvl->xstart, rlvl->ystart, rlvl->xend, rlvl->yend, rlvl->xend - rlvl->xstart, rlvl->yend - rlvl->ystart); assert(!rlvl->numbands || rlvl->bands); for (bandno = 0, band = rlvl->bands; bandno < rlvl->numbands; ++bandno, ++band) { fprintf(out, ""BAND %d\n"", bandno); if (!band->data) { fprintf(out, ""band has no data (null pointer)\n""); assert(!band->prcs); continue; } fprintf(out, ""xs = %""PRIiFAST32"", ys = %""PRIiFAST32"", xe = %""PRIiFAST32"", ye = %""PRIiFAST32"", w = %""PRIiFAST32"", h = %""PRIiFAST32""\n"", jas_seq2d_xstart(band->data), jas_seq2d_ystart(band->data), jas_seq2d_xend(band->data), jas_seq2d_yend(band->data), jas_seq2d_xend(band->data) - jas_seq2d_xstart(band->data), jas_seq2d_yend(band->data) - jas_seq2d_ystart(band->data)); assert(!rlvl->numprcs || band->prcs); for (prcno = 0, prc = band->prcs; prcno < rlvl->numprcs; ++prcno, ++prc) { fprintf(out, ""CODE BLOCK GROUP %d\n"", prcno); fprintf(out, ""xs = %""PRIuFAST32"", ys = %""PRIuFAST32"", xe = %""PRIuFAST32"", ye = %""PRIuFAST32"", w = %""PRIuFAST32"", h = %""PRIuFAST32""\n"", prc->xstart, prc->ystart, prc->xend, prc->yend, prc->xend - prc->xstart, prc->yend - prc->ystart); assert(!prc->numcblks || prc->cblks); for (cblkno = 0, cblk = prc->cblks; cblkno < prc->numcblks; ++cblkno, ++cblk) { fprintf(out, ""CODE BLOCK %d\n"", cblkno); fprintf(out, ""xs = %""PRIiFAST32"", ys = %""PRIiFAST32"", xe = %""PRIiFAST32"", ye = %""PRIiFAST32"", w = %""PRIiFAST32"", h = %""PRIiFAST32""\n"", jas_seq2d_xstart(cblk->data), jas_seq2d_ystart(cblk->data), jas_seq2d_xend(cblk->data), jas_seq2d_yend(cblk->data), jas_seq2d_xend(cblk->data) - jas_seq2d_xstart(cblk->data), jas_seq2d_yend(cblk->data) - jas_seq2d_ystart(cblk->data)); } } } } } } return 0; } ",0 "AddLedMap(CompatInfo *info, LedInfo *new, bool same_file) { enum led_field collide; const int verbosity = xkb_context_get_log_verbosity(info->ctx); const bool report = (same_file && verbosity > 0) || verbosity > 9; for (xkb_led_index_t i = 0; i < info->num_leds; i++) { LedInfo *old = &info->leds[i]; if (old->led.name != new->led.name) continue; if (old->led.mods.mods == new->led.mods.mods && old->led.groups == new->led.groups && old->led.ctrls == new->led.ctrls && old->led.which_mods == new->led.which_mods && old->led.which_groups == new->led.which_groups) { old->defined |= new->defined; return true; } if (new->merge == MERGE_REPLACE) { if (report) log_warn(info->ctx, ""Map for indicator %s redefined; "" ""Earlier definition ignored\n"", xkb_atom_text(info->ctx, old->led.name)); *old = *new; return true; } collide = 0; if (UseNewLEDField(LED_FIELD_MODS, old, new, report, &collide)) { old->led.which_mods = new->led.which_mods; old->led.mods = new->led.mods; old->defined |= LED_FIELD_MODS; } if (UseNewLEDField(LED_FIELD_GROUPS, old, new, report, &collide)) { old->led.which_groups = new->led.which_groups; old->led.groups = new->led.groups; old->defined |= LED_FIELD_GROUPS; } if (UseNewLEDField(LED_FIELD_CTRLS, old, new, report, &collide)) { old->led.ctrls = new->led.ctrls; old->defined |= LED_FIELD_CTRLS; } if (collide) { log_warn(info->ctx, ""Map for indicator %s redefined; "" ""Using %s definition for duplicate fields\n"", xkb_atom_text(info->ctx, old->led.name), (new->merge == MERGE_AUGMENT ? ""first"" : ""last"")); } return true; } if (info->num_leds >= XKB_MAX_LEDS) { log_err(info->ctx, ""Too many LEDs defined (maximum %d)\n"", XKB_MAX_LEDS); return false; } info->leds[info->num_leds++] = *new; return true; } ",0 "static void vga_draw_blank(VGACommonState *s, int full_update) { DisplaySurface *surface = qemu_console_surface(s->con); int i, w; uint8_t *d; if (!full_update) return; if (s->last_scr_width <= 0 || s->last_scr_height <= 0) return; w = s->last_scr_width * surface_bytes_per_pixel(surface); d = surface_data(surface); for(i = 0; i < s->last_scr_height; i++) { memset(d, 0, w); d += surface_stride(surface); } dpy_gfx_update(s->con, 0, 0, s->last_scr_width, s->last_scr_height); } ",0 "get_tilde() { init_tilde(); return tilde; } ",0 "Eina_Bool ewk_view_zoom_animated_mark_stop(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); _ewk_view_zoom_animated_mark_stop(smartData); return true; } ",0 "device_local_get_object_path (Device *device) { return device->priv->object_path; } ",0 "static inline MagickBooleanType IsAuthenticPixel(const Image *image, const ssize_t x,const ssize_t y) { if ((x < 0) || (x >= (ssize_t) image->columns)) return(MagickFalse); if ((y < 0) || (y >= (ssize_t) image->rows)) return(MagickFalse); return(MagickTrue); } ",0 "CGLContextObj WebPluginAcceleratedSurfaceProxy::context() { return surface_ ? surface_->context() : NULL; } ",0 "static int composite_exit(int sub_api) { return LIBUSB_SUCCESS; } ",0 "static inline bool vrend_format_can_sample(enum virgl_formats format) { return tex_conv_table[format].bindings & VREND_BIND_SAMPLER; } ",0 "static int stringnicmp(const char *p,const char *q,size_t n) { register ssize_t i, j; if (p == q) return(0); if (p == (char *) NULL) return(-1); if (q == (char *) NULL) return(1); while ((*p != '\0') && (*q != '\0')) { if ((*p == '\0') || (*q == '\0')) break; i=(*p); if (islower(i)) i=toupper(i); j=(*q); if (islower(j)) j=toupper(j); if (i != j) break; n--; if (n == 0) break; p++; q++; } return(toupper((int) *p)-toupper((int) *q)); } ",0 " static void GetFilePathWithHostAndPortReplacement( const std::string& original_file_path, const net::HostPortPair& host_port_pair, std::string* replacement_path) { base::StringPairs replacement_text; replacement_text.push_back( make_pair(""REPLACE_WITH_HOST_AND_PORT"", host_port_pair.ToString())); net::test_server::GetFilePathWithReplacements( original_file_path, replacement_text, replacement_path); } ",0 "ossl_cipher_set_padding(VALUE self, VALUE padding) { EVP_CIPHER_CTX *ctx; int pad = NUM2INT(padding); GetCipher(self, ctx); if (EVP_CIPHER_CTX_set_padding(ctx, pad) != 1) ossl_raise(eCipherError, NULL); return padding; } ",0 " void OnClientConnectionLost() { client_.reset(); binding_.Close(); } ",0 "static struct se_portal_group *srpt_make_tpg(struct se_wwn *wwn, struct config_group *group, const char *name) { struct srpt_port *sport = container_of(wwn, struct srpt_port, port_wwn); int res; /* Initialize sport->port_wwn and sport->port_tpg_1 */ res = core_tpg_register(&sport->port_wwn, &sport->port_tpg_1, SCSI_PROTOCOL_SRP); if (res) return ERR_PTR(res); return &sport->port_tpg_1; } ",0 "status_t MediaPlayerService::Client::attachAuxEffect(int effectId) { ALOGV(""[%d] attachAuxEffect(%d)"", mConnId, effectId); Mutex::Autolock l(mLock); if (mAudioOutput != 0) return mAudioOutput->attachAuxEffect(effectId); return NO_ERROR; } ",0 "bool LocalFrame::IsLocalRoot() const { if (!Tree().Parent()) return true; return Tree().Parent()->IsRemoteFrame(); } ",0 "void Com_Shutdown (void) { if (logfile) { FS_FCloseFile (logfile); logfile = 0; } if ( com_journalFile ) { FS_FCloseFile( com_journalFile ); com_journalFile = 0; } if( pipefile ) { FS_FCloseFile( pipefile ); FS_HomeRemove( com_pipefile->string ); } } ",0 "void ResetScreenHandler::HandleOnPowerwash(bool rollback_checked) { if (rollback_available_ && (rollback_checked || reboot_was_requested_)) { CallJS(""updateViewOnRollbackCall""); DBusThreadManager::Get()->GetUpdateEngineClient()->AddObserver(this); chromeos::DBusThreadManager::Get()->GetUpdateEngineClient()->Rollback(); } else { if (rollback_checked && !rollback_available_) { NOTREACHED() << ""Rollback was checked but not available. Starting powerwash.""; } chromeos::DBusThreadManager::Get()->GetSessionManagerClient()-> StartDeviceWipe(); } } ",0 "bool DrawingBuffer::FinishPrepareTextureMailboxSoftware( viz::TextureMailbox* out_mailbox, std::unique_ptr* out_release_callback) { DCHECK(state_restorer_); std::unique_ptr bitmap = CreateOrRecycleBitmap(); if (!bitmap) return false; { unsigned char* pixels = bitmap->pixels(); DCHECK(pixels); bool need_premultiply = want_alpha_channel_ && !premultiplied_alpha_; WebGLImageConversion::AlphaOp op = need_premultiply ? WebGLImageConversion::kAlphaDoPremultiply : WebGLImageConversion::kAlphaDoNothing; state_restorer_->SetFramebufferBindingDirty(); gl_->BindFramebuffer(GL_FRAMEBUFFER, fbo_); ReadBackFramebuffer(pixels, Size().Width(), Size().Height(), kReadbackSkia, op); } *out_mailbox = viz::TextureMailbox(bitmap.get(), size_); out_mailbox->set_color_space(color_space_); auto func = WTF::Bind(&DrawingBuffer::MailboxReleasedSoftware, RefPtr(this), WTF::Passed(std::move(bitmap)), size_); *out_release_callback = cc::SingleReleaseCallback::Create(ConvertToBaseCallback(std::move(func))); if (preserve_drawing_buffer_ == kDiscard) { SetBufferClearNeeded(true); } return true; } ",0 "static SQLITE_NOINLINE int btreePrevious(BtCursor *pCur){ int rc; MemPage *pPage; assert( cursorOwnsBtShared(pCur) ); assert( (pCur->curFlags & (BTCF_AtLast|BTCF_ValidOvfl|BTCF_ValidNKey))==0 ); assert( pCur->info.nSize==0 ); if( pCur->eState!=CURSOR_VALID ){ rc = restoreCursorPosition(pCur); if( rc!=SQLITE_OK ){ return rc; } if( CURSOR_INVALID==pCur->eState ){ return SQLITE_DONE; } if( CURSOR_SKIPNEXT==pCur->eState ){ pCur->eState = CURSOR_VALID; if( pCur->skipNext<0 ) return SQLITE_OK; } } pPage = pCur->pPage; assert( pPage->isInit ); if( !pPage->leaf ){ int idx = pCur->ix; rc = moveToChild(pCur, get4byte(findCell(pPage, idx))); if( rc ) return rc; rc = moveToRightmost(pCur); }else{ while( pCur->ix==0 ){ if( pCur->iPage==0 ){ pCur->eState = CURSOR_INVALID; return SQLITE_DONE; } moveToParent(pCur); } assert( pCur->info.nSize==0 ); assert( (pCur->curFlags & (BTCF_ValidOvfl))==0 ); pCur->ix--; pPage = pCur->pPage; if( pPage->intKey && !pPage->leaf ){ rc = sqlite3BtreePrevious(pCur, 0); }else{ rc = SQLITE_OK; } } return rc; } ",0 "static PE_DWord bin_pe_rva_to_va(RBinPEObj* bin, PE_DWord rva) { return PE_(r_bin_pe_get_image_base) (bin) + rva; } ",0 "static int des3_ede_x86_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { struct des3_ede_x86_ctx *ctx = crypto_tfm_ctx(tfm); u32 i, j, tmp; int err; /* Generate encryption context using generic implementation. */ err = __des3_ede_setkey(ctx->enc_expkey, &tfm->crt_flags, key, keylen); if (err < 0) return err; /* Fix encryption context for this implementation and form decryption * context. */ j = DES3_EDE_EXPKEY_WORDS - 2; for (i = 0; i < DES3_EDE_EXPKEY_WORDS; i += 2, j -= 2) { tmp = ror32(ctx->enc_expkey[i + 1], 4); ctx->enc_expkey[i + 1] = tmp; ctx->dec_expkey[j + 0] = ctx->enc_expkey[i + 0]; ctx->dec_expkey[j + 1] = tmp; } return 0; } ",0 "static void camellia_decrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) { const struct camellia_ctx *cctx = crypto_tfm_ctx(tfm); const __be32 *src = (const __be32 *)in; __be32 *dst = (__be32 *)out; unsigned int max; u32 tmp[4]; tmp[0] = be32_to_cpu(src[0]); tmp[1] = be32_to_cpu(src[1]); tmp[2] = be32_to_cpu(src[2]); tmp[3] = be32_to_cpu(src[3]); if (cctx->key_length == 16) max = 24; else max = 32; /* for key lengths of 24 and 32 */ camellia_do_decrypt(cctx->key_table, tmp, max); /* do_decrypt returns 0,1 swapped with 2,3 */ dst[0] = cpu_to_be32(tmp[2]); dst[1] = cpu_to_be32(tmp[3]); dst[2] = cpu_to_be32(tmp[0]); dst[3] = cpu_to_be32(tmp[1]); } ",0 "static int read_wrapper_data (WavpackContext *wpc, WavpackMetadata *wpmd) { if ((wpc->open_flags & OPEN_WRAPPER) && wpc->wrapper_bytes < MAX_WRAPPER_BYTES && wpmd->byte_length) { wpc->wrapper_data = (unsigned char *)realloc (wpc->wrapper_data, wpc->wrapper_bytes + wpmd->byte_length); if (!wpc->wrapper_data) return FALSE; memcpy (wpc->wrapper_data + wpc->wrapper_bytes, wpmd->data, wpmd->byte_length); wpc->wrapper_bytes += wpmd->byte_length; } return TRUE; } ",0 "bool Browser::CanReloadContents(content::WebContents* web_contents) const { return chrome::CanReload(this); } ",0 "void WebContentsImpl::PassiveInsecureContentFound(const GURL& resource_url) { GetDelegate()->PassiveInsecureContentFound(resource_url); } ",0 "static ssize_t lbs_host_sleep_read(struct file *file, char __user *userbuf, size_t count, loff_t *ppos) { struct lbs_private *priv = file->private_data; ssize_t ret; size_t pos = 0; unsigned long addr = get_zeroed_page(GFP_KERNEL); char *buf = (char *)addr; if (!buf) return -ENOMEM; pos += snprintf(buf, len, ""%d\n"", priv->is_host_sleep_activated); ret = simple_read_from_buffer(userbuf, count, ppos, buf, pos); free_page(addr); return ret; } ",0 "RenderView* RenderFrameImpl::GetRenderView() { return render_view_; } ",0 "xmlXPathCmpNodes(xmlNodePtr node1, xmlNodePtr node2) { int depth1, depth2; int attr1 = 0, attr2 = 0; xmlNodePtr attrNode1 = NULL, attrNode2 = NULL; xmlNodePtr cur, root; if ((node1 == NULL) || (node2 == NULL)) return(-2); /* * a couple of optimizations which will avoid computations in most cases */ if (node1 == node2) /* trivial case */ return(0); if (node1->type == XML_ATTRIBUTE_NODE) { attr1 = 1; attrNode1 = node1; node1 = node1->parent; } if (node2->type == XML_ATTRIBUTE_NODE) { attr2 = 1; attrNode2 = node2; node2 = node2->parent; } if (node1 == node2) { if (attr1 == attr2) { /* not required, but we keep attributes in order */ if (attr1 != 0) { cur = attrNode2->prev; while (cur != NULL) { if (cur == attrNode1) return (1); cur = cur->prev; } return (-1); } return(0); } if (attr2 == 1) return(1); return(-1); } if ((node1->type == XML_NAMESPACE_DECL) || (node2->type == XML_NAMESPACE_DECL)) return(1); if (node1 == node2->prev) return(1); if (node1 == node2->next) return(-1); /* * Speedup using document order if availble. */ if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && (0 > (long) node1->content) && (0 > (long) node2->content) && (node1->doc == node2->doc)) { long l1, l2; l1 = -((long) node1->content); l2 = -((long) node2->content); if (l1 < l2) return(1); if (l1 > l2) return(-1); } /* * compute depth to root */ for (depth2 = 0, cur = node2;cur->parent != NULL;cur = cur->parent) { if (cur == node1) return(1); depth2++; } root = cur; for (depth1 = 0, cur = node1;cur->parent != NULL;cur = cur->parent) { if (cur == node2) return(-1); depth1++; } /* * Distinct document (or distinct entities :-( ) case. */ if (root != cur) { return(-2); } /* * get the nearest common ancestor. */ while (depth1 > depth2) { depth1--; node1 = node1->parent; } while (depth2 > depth1) { depth2--; node2 = node2->parent; } while (node1->parent != node2->parent) { node1 = node1->parent; node2 = node2->parent; /* should not happen but just in case ... */ if ((node1 == NULL) || (node2 == NULL)) return(-2); } /* * Find who's first. */ if (node1 == node2->prev) return(1); if (node1 == node2->next) return(-1); /* * Speedup using document order if availble. */ if ((node1->type == XML_ELEMENT_NODE) && (node2->type == XML_ELEMENT_NODE) && (0 > (long) node1->content) && (0 > (long) node2->content) && (node1->doc == node2->doc)) { long l1, l2; l1 = -((long) node1->content); l2 = -((long) node2->content); if (l1 < l2) return(1); if (l1 > l2) return(-1); } for (cur = node1->next;cur != NULL;cur = cur->next) if (cur == node2) return(1); return(-1); /* assume there is no sibling list corruption */ } ",0 "void Document::resumeScriptedAnimationControllerCallbacks() { if (m_scriptedAnimationController) m_scriptedAnimationController->resume(); } ",0 "static int tcos_decipher(sc_card_t *card, const u8 * crgram, size_t crgram_len, u8 * out, size_t outlen) { sc_context_t *ctx; sc_apdu_t apdu; u8 rbuf[SC_MAX_APDU_BUFFER_SIZE]; u8 sbuf[SC_MAX_APDU_BUFFER_SIZE]; tcos_data *data; int tcos3, r; assert(card != NULL && crgram != NULL && out != NULL); ctx = card->ctx; tcos3=(card->type==SC_CARD_TYPE_TCOS_V3); data=(tcos_data *)card->drv_data; SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_NORMAL); sc_debug(ctx, SC_LOG_DEBUG_NORMAL, ""TCOS3:%d PKCS1:%d\n"",tcos3, !!(data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1)); sc_format_apdu(card, &apdu, crgram_len>255 ? SC_APDU_CASE_4_EXT : SC_APDU_CASE_4_SHORT, 0x2A, 0x80, 0x86); apdu.resp = rbuf; apdu.resplen = sizeof(rbuf); apdu.le = crgram_len; apdu.data = sbuf; apdu.lc = apdu.datalen = crgram_len+1; sbuf[0] = tcos3 ? 0x00 : ((data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) ? 0x81 : 0x02); memcpy(sbuf+1, crgram, crgram_len); r = sc_transmit_apdu(card, &apdu); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""APDU transmit failed""); if (apdu.sw1==0x90 && apdu.sw2==0x00) { size_t len= (apdu.resplen>outlen) ? outlen : apdu.resplen; unsigned int offset=0; if(tcos3 && (data->pad_flags & SC_ALGORITHM_RSA_PAD_PKCS1) && apdu.resp[0]==0 && apdu.resp[1]==2){ offset=2; while(offsetctx, SC_LOG_DEBUG_VERBOSE, len-offset); } SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, sc_check_sw(card, apdu.sw1, apdu.sw2)); } ",0 " bool ScriptAllowedExclusivelyOnTab( const Extension* extension, const std::set& allowed_urls, int tab_id) { bool result = true; for (std::set::iterator it = urls_.begin(); it != urls_.end(); ++it) { const GURL& url = *it; if (allowed_urls.count(url)) result &= AllowedScript(extension, url, url, tab_id); else result &= Blocked(extension, url, tab_id); } return result; } ",0 "void WT_Interpolate (S_WT_VOICE *pWTVoice, S_WT_INT_FRAME *pWTIntFrame) { EAS_PCM *pOutputBuffer; EAS_I32 phaseInc; EAS_I32 phaseFrac; EAS_I32 acc0; const EAS_SAMPLE *pSamples; const EAS_SAMPLE *loopEnd; EAS_I32 samp1; EAS_I32 samp2; EAS_I32 numSamples; /* initialize some local variables */ numSamples = pWTIntFrame->numSamples; if (numSamples <= 0) { ALOGE(""b/26366256""); return; } pOutputBuffer = pWTIntFrame->pAudioBuffer; loopEnd = (const EAS_SAMPLE*) pWTVoice->loopEnd + 1; pSamples = (const EAS_SAMPLE*) pWTVoice->phaseAccum; /*lint -e{713} truncation is OK */ phaseFrac = pWTVoice->phaseFrac; phaseInc = pWTIntFrame->frame.phaseIncrement; /* fetch adjacent samples */ #if defined(_8_BIT_SAMPLES) /*lint -e{701} */ samp1 = pSamples[0] << 8; /*lint -e{701} */ samp2 = pSamples[1] << 8; #else samp1 = pSamples[0]; samp2 = pSamples[1]; #endif while (numSamples--) { /* linear interpolation */ acc0 = samp2 - samp1; acc0 = acc0 * phaseFrac; /*lint -e{704} */ acc0 = samp1 + (acc0 >> NUM_PHASE_FRAC_BITS); /* save new output sample in buffer */ /*lint -e{704} */ *pOutputBuffer++ = (EAS_I16)(acc0 >> 2); /* increment phase */ phaseFrac += phaseInc; /*lint -e{704} */ acc0 = phaseFrac >> NUM_PHASE_FRAC_BITS; /* next sample */ if (acc0 > 0) { /* advance sample pointer */ pSamples += acc0; phaseFrac = (EAS_I32)((EAS_U32)phaseFrac & PHASE_FRAC_MASK); /* check for loop end */ acc0 = (EAS_I32) (pSamples - loopEnd); if (acc0 >= 0) pSamples = (const EAS_SAMPLE*) pWTVoice->loopStart + acc0; /* fetch new samples */ #if defined(_8_BIT_SAMPLES) /*lint -e{701} */ samp1 = pSamples[0] << 8; /*lint -e{701} */ samp2 = pSamples[1] << 8; #else samp1 = pSamples[0]; samp2 = pSamples[1]; #endif } } /* save pointer and phase */ pWTVoice->phaseAccum = (EAS_U32) pSamples; pWTVoice->phaseFrac = (EAS_U32) phaseFrac; } ",1 " tt_size_init( FT_Size ttsize ) /* TT_Size */ { TT_Size size = (TT_Size)ttsize; FT_Error error = FT_Err_Ok; #ifdef TT_USE_BYTECODE_INTERPRETER size->bytecode_ready = -1; size->cvt_ready = -1; #endif size->ttmetrics.valid = FALSE; size->strike_index = 0xFFFFFFFFUL; return error; } ",0 "xmlXPathLeadingSorted (xmlNodeSetPtr nodes1, xmlNodeSetPtr nodes2) { if (xmlXPathNodeSetIsEmpty(nodes2)) return(nodes1); return(xmlXPathNodeLeadingSorted(nodes1, xmlXPathNodeSetItem(nodes2, 1))); } ",0 "DOMTokenList* HTMLMediaElement::controlsList() const { return controls_list_.Get(); } ",0 "struct crypto_instance *skcipher_geniv_alloc(struct crypto_template *tmpl, struct rtattr **tb, u32 type, u32 mask) { struct { int (*setkey)(struct crypto_ablkcipher *tfm, const u8 *key, unsigned int keylen); int (*encrypt)(struct ablkcipher_request *req); int (*decrypt)(struct ablkcipher_request *req); unsigned int min_keysize; unsigned int max_keysize; unsigned int ivsize; const char *geniv; } balg; const char *name; struct crypto_skcipher_spawn *spawn; struct crypto_attr_type *algt; struct crypto_instance *inst; struct crypto_alg *alg; int err; algt = crypto_get_attr_type(tb); if (IS_ERR(algt)) return ERR_CAST(algt); if ((algt->type ^ (CRYPTO_ALG_TYPE_GIVCIPHER | CRYPTO_ALG_GENIV)) & algt->mask) return ERR_PTR(-EINVAL); name = crypto_attr_alg_name(tb[1]); if (IS_ERR(name)) return ERR_CAST(name); inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); if (!inst) return ERR_PTR(-ENOMEM); spawn = crypto_instance_ctx(inst); /* Ignore async algorithms if necessary. */ mask |= crypto_requires_sync(algt->type, algt->mask); crypto_set_skcipher_spawn(spawn, inst); err = crypto_grab_nivcipher(spawn, name, type, mask); if (err) goto err_free_inst; alg = crypto_skcipher_spawn_alg(spawn); if ((alg->cra_flags & CRYPTO_ALG_TYPE_MASK) == CRYPTO_ALG_TYPE_BLKCIPHER) { balg.ivsize = alg->cra_blkcipher.ivsize; balg.min_keysize = alg->cra_blkcipher.min_keysize; balg.max_keysize = alg->cra_blkcipher.max_keysize; balg.setkey = async_setkey; balg.encrypt = async_encrypt; balg.decrypt = async_decrypt; balg.geniv = alg->cra_blkcipher.geniv; } else { balg.ivsize = alg->cra_ablkcipher.ivsize; balg.min_keysize = alg->cra_ablkcipher.min_keysize; balg.max_keysize = alg->cra_ablkcipher.max_keysize; balg.setkey = alg->cra_ablkcipher.setkey; balg.encrypt = alg->cra_ablkcipher.encrypt; balg.decrypt = alg->cra_ablkcipher.decrypt; balg.geniv = alg->cra_ablkcipher.geniv; } err = -EINVAL; if (!balg.ivsize) goto err_drop_alg; /* * This is only true if we're constructing an algorithm with its * default IV generator. For the default generator we elide the * template name and double-check the IV generator. */ if (algt->mask & CRYPTO_ALG_GENIV) { if (!balg.geniv) balg.geniv = crypto_default_geniv(alg); err = -EAGAIN; if (strcmp(tmpl->name, balg.geniv)) goto err_drop_alg; memcpy(inst->alg.cra_name, alg->cra_name, CRYPTO_MAX_ALG_NAME); memcpy(inst->alg.cra_driver_name, alg->cra_driver_name, CRYPTO_MAX_ALG_NAME); } else { err = -ENAMETOOLONG; if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME, ""%s(%s)"", tmpl->name, alg->cra_name) >= CRYPTO_MAX_ALG_NAME) goto err_drop_alg; if (snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, ""%s(%s)"", tmpl->name, alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME) goto err_drop_alg; } inst->alg.cra_flags = CRYPTO_ALG_TYPE_GIVCIPHER | CRYPTO_ALG_GENIV; inst->alg.cra_flags |= alg->cra_flags & CRYPTO_ALG_ASYNC; inst->alg.cra_priority = alg->cra_priority; inst->alg.cra_blocksize = alg->cra_blocksize; inst->alg.cra_alignmask = alg->cra_alignmask; inst->alg.cra_type = &crypto_givcipher_type; inst->alg.cra_ablkcipher.ivsize = balg.ivsize; inst->alg.cra_ablkcipher.min_keysize = balg.min_keysize; inst->alg.cra_ablkcipher.max_keysize = balg.max_keysize; inst->alg.cra_ablkcipher.geniv = balg.geniv; inst->alg.cra_ablkcipher.setkey = balg.setkey; inst->alg.cra_ablkcipher.encrypt = balg.encrypt; inst->alg.cra_ablkcipher.decrypt = balg.decrypt; out: return inst; err_drop_alg: crypto_drop_skcipher(spawn); err_free_inst: kfree(inst); inst = ERR_PTR(err); goto out; } ",0 "void WebPageProxy::backForwardAddItem(uint64_t itemID) { m_backForwardList->addItem(process()->webBackForwardItem(itemID)); } ",0 "TIFFReadDirectoryFindFieldInfo(TIFF* tif, uint16 tagid, uint32* fii) { int32 ma,mb,mc; ma=-1; mc=(int32)tif->tif_nfields; while (1) { if (ma+1==mc) { *fii = FAILED_FII; return; } mb=(ma+mc)/2; if (tif->tif_fields[mb]->field_tag==(uint32)tagid) break; if (tif->tif_fields[mb]->field_tag<(uint32)tagid) ma=mb; else mc=mb; } while (1) { if (mb==0) break; if (tif->tif_fields[mb-1]->field_tag!=(uint32)tagid) break; mb--; } *fii=mb; } ",0 "void HTMLMediaElement::updatePlaybackRate() { if (m_webMediaPlayer && potentiallyPlaying()) webMediaPlayer()->setRate(playbackRate()); } ",0 "sd_parent_degenerate(struct sched_domain *sd, struct sched_domain *parent) { unsigned long cflags = sd->flags, pflags = parent->flags; if (sd_degenerate(parent)) return 1; if (!cpumask_equal(sched_domain_span(sd), sched_domain_span(parent))) return 0; /* Flags needing groups don't count if only 1 group in parent */ if (parent->groups == parent->groups->next) { pflags &= ~(SD_LOAD_BALANCE | SD_BALANCE_NEWIDLE | SD_BALANCE_FORK | SD_BALANCE_EXEC | SD_SHARE_CPUCAPACITY | SD_SHARE_PKG_RESOURCES | SD_PREFER_SIBLING | SD_SHARE_POWERDOMAIN); if (nr_node_ids == 1) pflags &= ~SD_SERIALIZE; } if (~cflags & pflags) return 0; return 1; } ",0 "int lxc_clear_groups(struct lxc_conf *c) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &c->groups, next) { lxc_list_del(it); free(it->elem); free(it); } return 0; } ",0 "void RenderFrameImpl::OnWriteMHTMLComplete( SerializeAsMHTMLCallback callback, std::unordered_set serialized_resources_uri_digests, base::TimeDelta main_thread_use_time, mojom::MhtmlSaveStatus save_status) { TRACE_EVENT1(""page-serialization"", ""RenderFrameImpl::OnWriteMHTMLComplete"", ""frame save status"", save_status); DCHECK(RenderThread::IsMainThread()) << ""Must run in the main renderer thread""; std::vector digests_of_new_parts( std::make_move_iterator(serialized_resources_uri_digests.begin()), std::make_move_iterator(serialized_resources_uri_digests.end())); std::move(callback).Run(save_status, std::move(digests_of_new_parts), main_thread_use_time); } ",0 "NO_INLINE JsVar *jspeFactorFunctionCall() { /* The parent if we're executing a method call */ bool isConstructor = false; if (lex->tk==LEX_R_NEW) { JSP_ASSERT_MATCH(LEX_R_NEW); isConstructor = true; if (lex->tk==LEX_R_NEW) { jsExceptionHere(JSET_ERROR, ""Nesting 'new' operators is unsupported""); jspSetError(false); return 0; } } JsVar *parent = 0; #ifndef SAVE_ON_FLASH bool wasSuper = lex->tk==LEX_R_SUPER; #endif JsVar *a = jspeFactorMember(jspeFactor(), &parent); #ifndef SAVE_ON_FLASH if (wasSuper) { /* if this was 'super.something' then we need * to overwrite the parent, because it'll be * set to the prototype otherwise. */ jsvUnLock(parent); parent = jsvLockAgainSafe(execInfo.thisVar); } #endif while ((lex->tk=='(' || (isConstructor && JSP_SHOULD_EXECUTE)) && !jspIsInterrupted()) { JsVar *funcName = a; JsVar *func = jsvSkipName(funcName); /* The constructor function doesn't change parsing, so if we're * not executing, just short-cut it. */ if (isConstructor && JSP_SHOULD_EXECUTE) { bool parseArgs = lex->tk=='('; a = jspeConstruct(func, funcName, parseArgs); isConstructor = false; // don't treat subsequent brackets as constructors } else a = jspeFunctionCall(func, funcName, parent, true, 0, 0); jsvUnLock3(funcName, func, parent); parent=0; a = jspeFactorMember(a, &parent); } #ifndef SAVE_ON_FLASH /* If we've got something that we care about the parent of (eg. a getter/setter) * then we repackage it into a 'NewChild' name that references the parent before * we leave. Note: You can't do this on everything because normally NewChild * forces a new child to be blindly created. It works on Getters/Setters because * we *always* run those rather than adding them. */ if (parent && jsvIsName(a) && !jsvIsNewChild(a)) { JsVar *value = jsvGetValueOfName(a); if (jsvIsGetterOrSetter(value)) { // no need to do this for functions since we've just executed whatever we needed to JsVar *nameVar = jsvCopyNameOnly(a,false,true); JsVar *newChild = jsvCreateNewChild(parent, nameVar, value); jsvUnLock2(nameVar, a); a = newChild; } jsvUnLock(value); } #endif jsvUnLock(parent); return a; } ",0 "void vcpu_put(struct kvm_vcpu *vcpu) { preempt_disable(); kvm_arch_vcpu_put(vcpu); preempt_notifier_unregister(&vcpu->preempt_notifier); preempt_enable(); } ",0 "SessionCommand* SessionService::CreateSetWindowBoundsCommand( const SessionID& window_id, const gfx::Rect& bounds, ui::WindowShowState show_state) { WindowBoundsPayload3 payload = { 0 }; payload.window_id = window_id.id(); payload.x = bounds.x(); payload.y = bounds.y(); payload.w = bounds.width(); payload.h = bounds.height(); payload.show_state = AdjustShowState(show_state); SessionCommand* command = new SessionCommand(kCommandSetWindowBounds3, sizeof(payload)); memcpy(command->contents(), &payload, sizeof(payload)); return command; } ",0 "static int decode_frame_apng(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { PNGDecContext *const s = avctx->priv_data; int ret; AVFrame *p; ff_thread_release_buffer(avctx, &s->last_picture); FFSWAP(ThreadFrame, s->picture, s->last_picture); p = s->picture.f; if (!(s->state & PNG_IHDR)) { if (!avctx->extradata_size) return AVERROR_INVALIDDATA; /* only init fields, there is no zlib use in extradata */ s->zstream.zalloc = ff_png_zalloc; s->zstream.zfree = ff_png_zfree; bytestream2_init(&s->gb, avctx->extradata, avctx->extradata_size); if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0) goto end; } /* reset state for a new frame */ if ((ret = inflateInit(&s->zstream)) != Z_OK) { av_log(avctx, AV_LOG_ERROR, ""inflateInit returned error %d\n"", ret); ret = AVERROR_EXTERNAL; goto end; } s->y = 0; s->state &= ~(PNG_IDAT | PNG_ALLIMAGE); bytestream2_init(&s->gb, avpkt->data, avpkt->size); if ((ret = decode_frame_common(avctx, s, p, avpkt)) < 0) goto end; if (!(s->state & PNG_ALLIMAGE)) av_log(avctx, AV_LOG_WARNING, ""Frame did not contain a complete image\n""); if (!(s->state & (PNG_ALLIMAGE|PNG_IDAT))) { ret = AVERROR_INVALIDDATA; goto end; } if ((ret = av_frame_ref(data, s->picture.f)) < 0) goto end; *got_frame = 1; ret = bytestream2_tell(&s->gb); end: inflateEnd(&s->zstream); return ret; } ",0 "bool WebPagePrivate::respectViewport() const { return m_forceRespectViewportArguments || contentsSize().width() <= m_virtualViewportSize.width(); } ",0 "void complete_request_key(struct key_construction *cons, int error) { kenter(""{%d,%d},%d"", cons->key->serial, cons->authkey->serial, error); if (error < 0) key_negate_and_link(cons->key, key_negative_timeout, NULL, cons->authkey); else key_revoke(cons->authkey); key_put(cons->key); key_put(cons->authkey); kfree(cons); } ",0 "void Document::didRemoveTouchEventHandler(Node* handler) { #if ENABLE(TOUCH_EVENTS) if (!m_touchEventTargets.get()) return; ASSERT(m_touchEventTargets->contains(handler)); m_touchEventTargets->remove(handler); if (Document* parent = parentDocument()) { parent->didRemoveTouchEventHandler(this); return; } Page* page = this->page(); if (!page) return; #if ENABLE(TOUCH_EVENT_TRACKING) if (ScrollingCoordinator* scrollingCoordinator = page->scrollingCoordinator()) scrollingCoordinator->touchEventTargetRectsDidChange(this); #endif if (m_touchEventTargets->size()) return; for (const Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { if (frame->document() && frame->document()->hasTouchEventHandlers()) return; } page->chrome()->client()->needTouchEvents(false); #else UNUSED_PARAM(handler); #endif } ",0 "void mlx4_unregister_mac(struct mlx4_dev *dev, u8 port, int index) { struct mlx4_mac_table *table = &mlx4_priv(dev)->port[port].mac_table; mutex_lock(&table->mutex); if (!table->refs[index]) { mlx4_warn(dev, ""No MAC entry for index %d\n"", index); goto out; } if (--table->refs[index]) { mlx4_warn(dev, ""Have more references for index %d,"" ""no need to modify MAC table\n"", index); goto out; } table->entries[index] = 0; mlx4_set_port_mac_table(dev, port, table->entries); --table->total; out: mutex_unlock(&table->mutex); } ",0 "int RenderFlexibleBox::inlineBlockBaseline(LineDirectionMode direction) const { int baseline = firstLineBoxBaseline(); if (baseline != -1) return baseline; int marginAscent = direction == HorizontalLine ? marginTop() : marginRight(); return synthesizedBaselineFromContentBox(this, direction) + marginAscent; } ",0 "void Editor::tidyUpHTMLStructure(Document& document) { document.updateStyleAndLayoutTree(); bool needsValidStructure = hasEditableStyle(document) || (document.documentElement() && hasEditableStyle(*document.documentElement())); if (!needsValidStructure) return; Element* existingHead = nullptr; Element* existingBody = nullptr; Element* currentRoot = document.documentElement(); if (currentRoot) { if (isHTMLHtmlElement(currentRoot)) return; if (isHTMLHeadElement(currentRoot)) existingHead = currentRoot; else if (isHTMLBodyElement(currentRoot)) existingBody = currentRoot; else if (isHTMLFrameSetElement(currentRoot)) existingBody = currentRoot; } document.addConsoleMessage(ConsoleMessage::create( JSMessageSource, WarningMessageLevel, ""document.execCommand() doesn't work with an invalid HTML structure. It "" ""is corrected automatically."")); UseCounter::count(document, UseCounter::ExecCommandAltersHTMLStructure); Element* root = HTMLHtmlElement::create(document); if (existingHead) root->appendChild(existingHead); Element* body = nullptr; if (existingBody) body = existingBody; else body = HTMLBodyElement::create(document); if (document.documentElement() && body != document.documentElement()) body->appendChild(document.documentElement()); root->appendChild(body); DCHECK(!document.documentElement()); document.appendChild(root); } ",0 "static void btif_dm_data_copy(uint16_t event, char *dst, char *src) { tBTA_DM_SEC *dst_dm_sec = (tBTA_DM_SEC*)dst; tBTA_DM_SEC *src_dm_sec = (tBTA_DM_SEC*)src; if (!src_dm_sec) return; assert(dst_dm_sec); memcpy(dst_dm_sec, src_dm_sec, sizeof(tBTA_DM_SEC)); if (event == BTA_DM_BLE_KEY_EVT) { dst_dm_sec->ble_key.p_key_value = osi_malloc(sizeof(tBTM_LE_KEY_VALUE)); assert(src_dm_sec->ble_key.p_key_value); assert(dst_dm_sec->ble_key.p_key_value); memcpy(dst_dm_sec->ble_key.p_key_value, src_dm_sec->ble_key.p_key_value, sizeof(tBTM_LE_KEY_VALUE)); } } ",0 "void Document::popCurrentScript() { ASSERT(!m_currentScriptStack.isEmpty()); m_currentScriptStack.removeLast(); } ",0 "SMB2_close_flags(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, int flags) { struct smb_rqst rqst; struct smb2_close_rsp *rsp = NULL; struct cifs_ses *ses = tcon->ses; struct kvec iov[1]; struct kvec rsp_iov; int resp_buftype = CIFS_NO_BUFFER; int rc = 0; cifs_dbg(FYI, ""Close\n""); if (!ses || !(ses->server)) return -EIO; if (smb3_encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; memset(&rqst, 0, sizeof(struct smb_rqst)); memset(&iov, 0, sizeof(iov)); rqst.rq_iov = iov; rqst.rq_nvec = 1; rc = SMB2_close_init(tcon, &rqst, persistent_fid, volatile_fid); if (rc) goto close_exit; rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); rsp = (struct smb2_close_rsp *)rsp_iov.iov_base; if (rc != 0) { cifs_stats_fail_inc(tcon, SMB2_CLOSE_HE); trace_smb3_close_err(xid, persistent_fid, tcon->tid, ses->Suid, rc); goto close_exit; } atomic_dec(&tcon->num_remote_opens); /* BB FIXME - decode close response, update inode for caching */ close_exit: SMB2_close_free(&rqst); free_rsp_buf(resp_buftype, rsp); return rc; } ",0 "void SessionService::BuildCommandsForTab( const SessionID& window_id, TabContentsWrapper* tab, int index_in_window, bool is_pinned, std::vector* commands, IdToRange* tab_to_available_range) { DCHECK(tab && commands && window_id.id()); const SessionID& session_id(tab->restore_tab_helper()->session_id()); commands->push_back(CreateSetTabWindowCommand(window_id, session_id)); const int current_index = tab->web_contents()->GetController().GetCurrentEntryIndex(); const int min_index = std::max(0, current_index - max_persist_navigation_count); const int max_index = std::min(current_index + max_persist_navigation_count, tab->web_contents()->GetController().GetEntryCount()); const int pending_index = tab->web_contents()->GetController().GetPendingEntryIndex(); if (tab_to_available_range) { (*tab_to_available_range)[session_id.id()] = std::pair(min_index, max_index); } if (is_pinned) { commands->push_back(CreatePinnedStateCommand(session_id, true)); } TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(tab->web_contents()); if (wrapper->extension_tab_helper()->extension_app()) { commands->push_back( CreateSetTabExtensionAppIDCommand( kCommandSetExtensionAppID, session_id.id(), wrapper->extension_tab_helper()->extension_app()->id())); } for (int i = min_index; i < max_index; ++i) { const NavigationEntry* entry = (i == pending_index) ? tab->web_contents()->GetController().GetPendingEntry() : tab->web_contents()->GetController().GetEntryAtIndex(i); DCHECK(entry); if (ShouldTrackEntry(entry->GetVirtualURL())) { commands->push_back( CreateUpdateTabNavigationCommand( kCommandUpdateTabNavigation, session_id.id(), i, *entry)); } } commands->push_back( CreateSetSelectedNavigationIndexCommand(session_id, current_index)); if (index_in_window != -1) { commands->push_back( CreateSetTabIndexInWindowCommand(session_id, index_in_window)); } } ",0 "WebURLRequest::RequestContext ResourceFetcher::DetermineRequestContext( Resource::Type type) const { return DetermineRequestContext(type, Context().IsMainFrame()); } ",0 "struct dst_entry *ip6_sk_dst_lookup_flow(struct sock *sk, struct flowi6 *fl6, const struct in6_addr *final_dst, bool can_sleep) { struct dst_entry *dst = sk_dst_check(sk, inet6_sk(sk)->dst_cookie); int err; dst = ip6_sk_dst_check(sk, dst, fl6); err = ip6_dst_lookup_tail(sk, &dst, fl6); if (err) return ERR_PTR(err); if (final_dst) fl6->daddr = *final_dst; if (can_sleep) fl6->flowi6_flags |= FLOWI_FLAG_CAN_SLEEP; return xfrm_lookup(sock_net(sk), dst, flowi6_to_flowi(fl6), sk, 0); } ",0 " static void copyMono16( short *dst, const int *const *src, unsigned nSamples, unsigned /* nChannels */) { for (unsigned i = 0; i < nSamples; ++i) { *dst++ = src[0][i]; } } ",1 "BrowserContext* RenderFrameDevToolsAgentHost::GetBrowserContext() { WebContents* contents = web_contents(); return contents ? contents->GetBrowserContext() : nullptr; } ",0 "static ssize_t picolcd_operation_mode_delay_show(struct device *dev, struct device_attribute *attr, char *buf) { struct picolcd_data *data = dev_get_drvdata(dev); return snprintf(buf, PAGE_SIZE, ""%hu\n"", data->opmode_delay); } ",0 "InlineBoxPosition ComputeInlineBoxPositionForTextNode( LayoutObject* layout_object, int caret_offset, TextAffinity affinity, TextDirection primary_direction) { InlineBox* inline_box = nullptr; LayoutText* text_layout_object = ToLayoutText(layout_object); InlineTextBox* candidate = nullptr; for (InlineTextBox* box : InlineTextBoxesOf(*text_layout_object)) { int caret_min_offset = box->CaretMinOffset(); int caret_max_offset = box->CaretMaxOffset(); if (caret_offset < caret_min_offset || caret_offset > caret_max_offset || (caret_offset == caret_max_offset && box->IsLineBreak())) continue; if (caret_offset > caret_min_offset && caret_offset < caret_max_offset) return InlineBoxPosition(box, caret_offset); if (IsCaretAtEdgeOfInlineTextBox(caret_offset, *box, affinity)) { inline_box = box; break; } candidate = box; } if (candidate && candidate == text_layout_object->LastTextBox() && affinity == TextAffinity::kDownstream) { inline_box = SearchAheadForBetterMatch(text_layout_object); if (inline_box) caret_offset = inline_box->CaretMinOffset(); } if (!inline_box) inline_box = candidate; if (!inline_box) return InlineBoxPosition(); return AdjustInlineBoxPositionForTextDirection( inline_box, caret_offset, layout_object->Style()->GetUnicodeBidi(), primary_direction); } ",0 "void BluetoothOptionsHandler::DiscoveryEnded(const std::string& adapter_id) { VLOG(2) << ""Discovery ended on "" << adapter_id; web_ui_->CallJavascriptFunction( ""options.SystemOptions.notifyBluetoothSearchComplete""); chromeos::BluetoothManager* bluetooth_manager = chromeos::BluetoothManager::GetInstance(); DCHECK(bluetooth_manager); chromeos::BluetoothAdapter* default_adapter = bluetooth_manager->DefaultAdapter(); ValidateDefaultAdapter(default_adapter); if (default_adapter == NULL) { VLOG(1) << ""DiscoveryEnded: no default adapter""; return; } default_adapter->StopDiscovery(); } ",0 " void CallOnReceivedResponse( const network::ResourceResponseHead& head, network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints, std::unique_ptr cloned_navigation_data, bool is_download, bool is_stream, PreviewsState previews_state) { scoped_refptr response( new network::ResourceResponse()); response->head = head; base::PostTaskWithTraits( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&NavigationURLLoaderImpl::OnReceiveResponse, owner_, response->DeepCopy(), std::move(url_loader_client_endpoints), std::move(cloned_navigation_data), global_request_id_, is_download, is_stream, previews_state)); } ",0 " TT_Run_Context( TT_ExecContext exec ) { TT_Goto_CodeRange( exec, tt_coderange_glyph, 0 ); exec->zp0 = exec->pts; exec->zp1 = exec->pts; exec->zp2 = exec->pts; exec->GS.gep0 = 1; exec->GS.gep1 = 1; exec->GS.gep2 = 1; exec->GS.projVector.x = 0x4000; exec->GS.projVector.y = 0x0000; exec->GS.freeVector = exec->GS.projVector; exec->GS.dualVector = exec->GS.projVector; exec->GS.round_state = 1; exec->GS.loop = 1; /* some glyphs leave something on the stack. so we clean it */ /* before a new execution. */ exec->top = 0; exec->callTop = 0; return exec->face->interpreter( exec ); } ",0 "ZEND_API void ZEND_FASTCALL zend_hash_packed_to_hash(HashTable *ht) { void *new_data, *old_data = HT_GET_DATA_ADDR(ht); Bucket *old_buckets = ht->arData; HT_ASSERT(GC_REFCOUNT(ht) == 1); HANDLE_BLOCK_INTERRUPTIONS(); ht->u.flags &= ~HASH_FLAG_PACKED; new_data = pemalloc(HT_SIZE_EX(ht->nTableSize, -ht->nTableSize), (ht)->u.flags & HASH_FLAG_PERSISTENT); ht->nTableMask = -ht->nTableSize; HT_SET_DATA_ADDR(ht, new_data); memcpy(ht->arData, old_buckets, sizeof(Bucket) * ht->nNumUsed); pefree(old_data, (ht)->u.flags & HASH_FLAG_PERSISTENT); zend_hash_rehash(ht); HANDLE_UNBLOCK_INTERRUPTIONS(); } ",0 " std::vector GetAllPanelBounds() { return GetPanelBounds(PanelManager::GetInstance()->panels()); } ",0 "static void v9fs_fix_path(V9fsPath *dst, V9fsPath *src, int len) { V9fsPath str; v9fs_path_init(&str); v9fs_path_copy(&str, dst); v9fs_string_sprintf((V9fsString *)dst, ""%s%s"", src->data, str.data+len); v9fs_path_free(&str); /* +1 to include terminating NULL */ dst->size++; } ",0 "void WebContentsImpl::DetachInterstitialPage() { if (node_.OuterContentsFrameTreeNode()) { if (GetRenderManager()->GetProxyToOuterDelegate()) { DCHECK(static_cast( GetRenderManager()->current_frame_host()->GetView()) ->IsRenderWidgetHostViewChildFrame()); RenderWidgetHostViewChildFrame* view = static_cast( GetRenderManager()->current_frame_host()->GetView()); GetRenderManager()->SetRWHViewForInnerContents(view); } } bool interstitial_pausing_throbber = ShowingInterstitialPage() && GetRenderManager()->interstitial_page()->pause_throbber(); if (ShowingInterstitialPage()) GetRenderManager()->remove_interstitial_page(); for (auto& observer : observers_) observer.DidDetachInterstitialPage(); if (interstitial_pausing_throbber && frame_tree_.IsLoading()) LoadingStateChanged(true, true, nullptr); } ",1 "void PluginHelper::Observe(NotificationType type, const NotificationSource& source, const NotificationDetails& details) { DCHECK(CalledOnValidThread()); DCHECK(type == NotificationType::CHROME_PLUGIN_UNLOADED); DCHECK(plugin_ == Source(source).ptr()); delete this; } ",0 "static struct dentry *start_creating(const char *name, struct dentry *parent) { struct dentry *dentry; int error; pr_debug(""debugfs: creating file '%s'\n"",name); if (IS_ERR(parent)) return parent; error = simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count); if (error) return ERR_PTR(error); /* If the parent is not specified, we create it in the root. * We need the root dentry to do this, which is in the super * block. A pointer to that is in the struct vfsmount that we * have around. */ if (!parent) parent = debugfs_mount->mnt_root; inode_lock(d_inode(parent)); dentry = lookup_one_len(name, parent, strlen(name)); if (!IS_ERR(dentry) && d_really_is_positive(dentry)) { dput(dentry); dentry = ERR_PTR(-EEXIST); } if (IS_ERR(dentry)) { inode_unlock(d_inode(parent)); simple_release_fs(&debugfs_mount, &debugfs_mount_count); } return dentry; } ",0 "String AXObjectCacheImpl::computedNameForNode(Node* node) { AXObject* obj = getOrCreate(node); if (!obj) return """"; return obj->computedName(); } ",0 "static void rxrpc_rxk5_free(struct rxk5_key *rxk5) { int loop; rxrpc_free_krb5_principal(&rxk5->client); rxrpc_free_krb5_principal(&rxk5->server); rxrpc_free_krb5_tagged(&rxk5->session); if (rxk5->addresses) { for (loop = rxk5->n_addresses - 1; loop >= 0; loop--) rxrpc_free_krb5_tagged(&rxk5->addresses[loop]); kfree(rxk5->addresses); } if (rxk5->authdata) { for (loop = rxk5->n_authdata - 1; loop >= 0; loop--) rxrpc_free_krb5_tagged(&rxk5->authdata[loop]); kfree(rxk5->authdata); } kfree(rxk5->ticket); kfree(rxk5->ticket2); kfree(rxk5); } ",0 "static struct btrfs_dir_item *btrfs_match_dir_item_name(struct btrfs_root *root, struct btrfs_path *path, const char *name, int name_len) { struct btrfs_dir_item *dir_item; unsigned long name_ptr; u32 total_len; u32 cur = 0; u32 this_len; struct extent_buffer *leaf; leaf = path->nodes[0]; dir_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_dir_item); if (verify_dir_item(root, leaf, dir_item)) return NULL; total_len = btrfs_item_size_nr(leaf, path->slots[0]); while (cur < total_len) { this_len = sizeof(*dir_item) + btrfs_dir_name_len(leaf, dir_item) + btrfs_dir_data_len(leaf, dir_item); name_ptr = (unsigned long)(dir_item + 1); if (btrfs_dir_name_len(leaf, dir_item) == name_len && memcmp_extent_buffer(leaf, name, name_ptr, name_len) == 0) return dir_item; cur += this_len; dir_item = (struct btrfs_dir_item *)((char *)dir_item + this_len); } return NULL; } ",1 "void ExtensionInstallDialogView::InitView() { int left_column_width = (prompt_->ShouldShowPermissions() || prompt_->GetRetainedFileCount() > 0) ? kPermissionsLeftColumnWidth : kNoPermissionsLeftColumnWidth; if (is_external_install()) left_column_width = kExternalInstallLeftColumnWidth; int column_set_id = 0; views::GridLayout* layout = CreateLayout(left_column_width, column_set_id); ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); if (prompt_->has_webstore_data()) { layout->StartRow(0, column_set_id); views::View* rating = new views::View(); rating->SetLayoutManager(new views::BoxLayout( views::BoxLayout::kHorizontal, 0, 0, 0)); layout->AddView(rating); prompt_->AppendRatingStars(AddResourceIcon, rating); const gfx::FontList& small_font_list = rb.GetFontList(ui::ResourceBundle::SmallFont); views::Label* rating_count = new views::Label(prompt_->GetRatingCount(), small_font_list); rating_count->SetBorder(views::Border::CreateEmptyBorder(0, 2, 0, 0)); rating->AddChildView(rating_count); layout->StartRow(0, column_set_id); views::Label* user_count = new views::Label(prompt_->GetUserCount(), small_font_list); user_count->SetAutoColorReadabilityEnabled(false); user_count->SetEnabledColor(SK_ColorGRAY); layout->AddView(user_count); layout->StartRow(0, column_set_id); views::Link* store_link = new views::Link( l10n_util::GetStringUTF16(IDS_EXTENSION_PROMPT_STORE_LINK)); store_link->SetFontList(small_font_list); store_link->set_listener(this); layout->AddView(store_link); if (prompt_->ShouldShowPermissions()) { layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); layout->StartRow(0, column_set_id); layout->AddView(new views::Separator(views::Separator::HORIZONTAL), 3, 1, views::GridLayout::FILL, views::GridLayout::FILL); } } int content_width = left_column_width + views::kPanelHorizMargin + kIconSize; CustomScrollableView* scrollable = new CustomScrollableView(); views::GridLayout* scroll_layout = new views::GridLayout(scrollable); scrollable->SetLayoutManager(scroll_layout); views::ColumnSet* scrollable_column_set = scroll_layout->AddColumnSet(column_set_id); int scrollable_width = prompt_->has_webstore_data() ? content_width : left_column_width; scrollable_column_set->AddColumn(views::GridLayout::LEADING, views::GridLayout::LEADING, 0, // no resizing views::GridLayout::USE_PREF, scrollable_width, scrollable_width); int padding_width = content_width + views::kButtonHEdgeMarginNew - scrollable_width; scrollable_column_set->AddPaddingColumn(0, padding_width); layout->StartRow(0, column_set_id); scroll_view_ = new views::ScrollView(); scroll_view_->set_hide_horizontal_scrollbar(true); scroll_view_->SetContents(scrollable); layout->AddView(scroll_view_, 4, 1); if (is_bundle_install()) { BundleInstaller::ItemList items = prompt_->bundle()->GetItemsWithState( BundleInstaller::Item::STATE_PENDING); scroll_layout->AddPaddingRow(0, views::kRelatedControlSmallVerticalSpacing); for (const BundleInstaller::Item& item : items) { scroll_layout->StartRow(0, column_set_id); views::Label* extension_label = new views::Label(item.GetNameForDisplay()); extension_label->SetMultiLine(true); extension_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); extension_label->SizeToFit( scrollable_width - kSmallIconSize - kSmallIconPadding); gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(item.icon); scroll_layout->AddView(new IconedView(extension_label, image)); } scroll_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); } if (prompt_->ShouldShowPermissions()) { bool has_permissions = prompt_->GetPermissionCount( ExtensionInstallPrompt::PermissionsType::ALL_PERMISSIONS) > 0; if (has_permissions) { AddPermissions( scroll_layout, rb, column_set_id, scrollable_width, ExtensionInstallPrompt::PermissionsType::REGULAR_PERMISSIONS); AddPermissions( scroll_layout, rb, column_set_id, scrollable_width, ExtensionInstallPrompt::PermissionsType::WITHHELD_PERMISSIONS); } else { scroll_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); scroll_layout->StartRow(0, column_set_id); views::Label* permission_label = new views::Label( l10n_util::GetStringUTF16(IDS_EXTENSION_NO_SPECIAL_PERMISSIONS)); permission_label->SetMultiLine(true); permission_label->SetHorizontalAlignment(gfx::ALIGN_LEFT); permission_label->SizeToFit(scrollable_width); scroll_layout->AddView(permission_label); } } if (prompt_->GetRetainedFileCount()) { scroll_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); scroll_layout->StartRow(0, column_set_id); views::Label* retained_files_header = new views::Label(prompt_->GetRetainedFilesHeading()); retained_files_header->SetMultiLine(true); retained_files_header->SetHorizontalAlignment(gfx::ALIGN_LEFT); retained_files_header->SizeToFit(scrollable_width); scroll_layout->AddView(retained_files_header); scroll_layout->StartRow(0, column_set_id); PermissionDetails details; for (size_t i = 0; i < prompt_->GetRetainedFileCount(); ++i) { details.push_back(prompt_->GetRetainedFile(i)); } ExpandableContainerView* issue_advice_view = new ExpandableContainerView(this, base::string16(), details, scrollable_width, false); scroll_layout->AddView(issue_advice_view); } if (prompt_->GetRetainedDeviceCount()) { scroll_layout->AddPaddingRow(0, views::kRelatedControlVerticalSpacing); scroll_layout->StartRow(0, column_set_id); views::Label* retained_devices_header = new views::Label(prompt_->GetRetainedDevicesHeading()); retained_devices_header->SetMultiLine(true); retained_devices_header->SetHorizontalAlignment(gfx::ALIGN_LEFT); retained_devices_header->SizeToFit(scrollable_width); scroll_layout->AddView(retained_devices_header); scroll_layout->StartRow(0, column_set_id); PermissionDetails details; for (size_t i = 0; i < prompt_->GetRetainedDeviceCount(); ++i) { details.push_back(prompt_->GetRetainedDeviceMessageString(i)); } ExpandableContainerView* issue_advice_view = new ExpandableContainerView(this, base::string16(), details, scrollable_width, false); scroll_layout->AddView(issue_advice_view); } DCHECK(prompt_->type() >= 0); UMA_HISTOGRAM_ENUMERATION(""Extensions.InstallPrompt.Type"", prompt_->type(), ExtensionInstallPrompt::NUM_PROMPT_TYPES); scroll_view_->ClipHeightTo( 0, std::min(kScrollViewMaxHeight, scrollable->GetPreferredSize().height())); dialog_size_ = gfx::Size( content_width + 2 * views::kButtonHEdgeMarginNew, container_->GetPreferredSize().height()); std::string event_name = ExperienceSamplingEvent::kExtensionInstallDialog; event_name.append( ExtensionInstallPrompt::PromptTypeToString(prompt_->type())); sampling_event_ = ExperienceSamplingEvent::Create(event_name); } ",1 "void Plugin::HistogramStartupTimeSmall(const std::string& name, float dt) { if (nexe_size_ > 0) { float size_in_MB = static_cast(nexe_size_) / (1024.f * 1024.f); HistogramTimeSmall(name, static_cast(dt)); HistogramTimeSmall(name + ""PerMB"", static_cast(dt / size_in_MB)); } } ",0 " void set_layout_on_completion(bool layout_on_completion) { layout_on_completion_ = layout_on_completion; } ",0 "void impeg2d_dec_pnb_mb_params(dec_state_t *ps_dec) { stream_t *ps_stream = &ps_dec->s_bit_stream; UWORD16 u2_mb_addr_incr; UWORD16 u2_total_len; UWORD16 u2_len; UWORD16 u2_mb_type; UWORD32 u4_next_word; const dec_mb_params_t *ps_dec_mb_params; if(impeg2d_bit_stream_nxt(ps_stream,1) == 1) { impeg2d_bit_stream_flush(ps_stream,1); } else { u2_mb_addr_incr = impeg2d_get_mb_addr_incr(ps_stream); if(ps_dec->u2_first_mb) { /****************************************************************/ /* Section 6.3.17 */ /* The first MB of a slice cannot be skipped */ /* But the mb_addr_incr can be > 1, because at the beginning of */ /* a slice, it indicates the offset from the last MB in the */ /* previous row. Hence for the first slice in a row, the */ /* mb_addr_incr needs to be 1. */ /****************************************************************/ /* MB_x is set to zero whenever MB_y changes. */ ps_dec->u2_mb_x = u2_mb_addr_incr - 1; /* For error resilience */ ps_dec->u2_mb_x = MIN(ps_dec->u2_mb_x, (ps_dec->u2_num_horiz_mb - 1)); /****************************************************************/ /* mb_addr_incr is forced to 1 because in this decoder it is used */ /* more as an indicator of the number of MBs skipped than the */ /* as defined by the standard (Section 6.3.17) */ /****************************************************************/ u2_mb_addr_incr = 1; ps_dec->u2_first_mb = 0; } else { /****************************************************************/ /* In MPEG-2, the last MB of the row cannot be skipped and the */ /* mb_addr_incr cannot be such that it will take the current MB */ /* beyond the current row */ /* In MPEG-1, the slice could start and end anywhere and is not */ /* restricted to a row like in MPEG-2. Hence this check should */ /* not be done for MPEG-1 streams. */ /****************************************************************/ if(ps_dec->u2_is_mpeg2 && ((ps_dec->u2_mb_x + u2_mb_addr_incr) > ps_dec->u2_num_horiz_mb)) { u2_mb_addr_incr = ps_dec->u2_num_horiz_mb - ps_dec->u2_mb_x; } impeg2d_dec_skip_mbs(ps_dec, (UWORD16)(u2_mb_addr_incr - 1)); } } u4_next_word = (UWORD16)impeg2d_bit_stream_nxt(ps_stream,16); /*-----------------------------------------------------------------------*/ /* MB type */ /*-----------------------------------------------------------------------*/ { u2_mb_type = ps_dec->pu2_mb_type[BITS((UWORD16)u4_next_word,15,10)]; u2_len = BITS(u2_mb_type,15,8); u2_total_len = u2_len; u4_next_word = (UWORD16)LSW((UWORD16)u4_next_word << u2_len); } /*-----------------------------------------------------------------------*/ /* motion type */ /*-----------------------------------------------------------------------*/ { WORD32 i4_motion_type = ps_dec->u2_motion_type; if((u2_mb_type & MB_FORW_OR_BACK) && ps_dec->u2_read_motion_type) { ps_dec->u2_motion_type = BITS((UWORD16)u4_next_word,15,14); u2_total_len += MB_MOTION_TYPE_LEN; u4_next_word = (UWORD16)LSW((UWORD16)u4_next_word << MB_MOTION_TYPE_LEN); i4_motion_type = ps_dec->u2_motion_type; } if ((u2_mb_type & MB_FORW_OR_BACK) && ((i4_motion_type == 0) || (i4_motion_type == 3) || (i4_motion_type == 4) || (i4_motion_type >= 7))) { i4_motion_type = 1; } } /*-----------------------------------------------------------------------*/ /* dct type */ /*-----------------------------------------------------------------------*/ { if((u2_mb_type & MB_CODED) && ps_dec->u2_read_dct_type) { ps_dec->u2_field_dct = BIT((UWORD16)u4_next_word,15); u2_total_len += MB_DCT_TYPE_LEN; u4_next_word = (UWORD16)LSW((UWORD16)u4_next_word << MB_DCT_TYPE_LEN); } } /*-----------------------------------------------------------------------*/ /* Quant scale code */ /*-----------------------------------------------------------------------*/ if(u2_mb_type & MB_QUANT) { UWORD16 u2_quant_scale_code; u2_quant_scale_code = BITS((UWORD16)u4_next_word,15,11); ps_dec->u1_quant_scale = (ps_dec->u2_q_scale_type) ? gau1_impeg2_non_linear_quant_scale[u2_quant_scale_code] : (u2_quant_scale_code << 1); u2_total_len += MB_QUANT_SCALE_CODE_LEN; } impeg2d_bit_stream_flush(ps_stream,u2_total_len); /*-----------------------------------------------------------------------*/ /* Set the function pointers */ /*-----------------------------------------------------------------------*/ ps_dec->u2_coded_mb = (UWORD16)(u2_mb_type & MB_CODED); if(u2_mb_type & MB_BIDRECT) { UWORD16 u2_index = (ps_dec->u2_motion_type); ps_dec->u2_prev_intra_mb = 0; ps_dec->e_mb_pred = BIDIRECT; ps_dec_mb_params = &ps_dec->ps_func_bi_direct[u2_index]; ps_dec->s_mb_type = ps_dec_mb_params->s_mb_type; ps_dec_mb_params->pf_func_mb_params(ps_dec); } else if(u2_mb_type & MB_FORW_OR_BACK) { UWORD16 u2_refPic = !(u2_mb_type & MB_MV_FORW); UWORD16 u2_index = (ps_dec->u2_motion_type); ps_dec->u2_prev_intra_mb = 0; ps_dec->e_mb_pred = (e_pred_direction_t)u2_refPic; ps_dec_mb_params = &ps_dec->ps_func_forw_or_back[u2_index]; ps_dec->s_mb_type = ps_dec_mb_params->s_mb_type; ps_dec_mb_params->pf_func_mb_params(ps_dec); } else if(u2_mb_type & MB_TYPE_INTRA) { ps_dec->u2_prev_intra_mb = 1; impeg2d_dec_intra_mb(ps_dec); } else { ps_dec->u2_prev_intra_mb =0; ps_dec->e_mb_pred = FORW; ps_dec->u2_motion_type = 0; impeg2d_dec_0mv_coded_mb(ps_dec); } /*-----------------------------------------------------------------------*/ /* decode cbp */ /*-----------------------------------------------------------------------*/ if((u2_mb_type & MB_TYPE_INTRA)) { ps_dec->u2_cbp = 0x3f; ps_dec->u2_prev_intra_mb = 1; } else { ps_dec->u2_prev_intra_mb = 0; ps_dec->u2_def_dc_pred[Y_LUMA] = 128 << ps_dec->u2_intra_dc_precision; ps_dec->u2_def_dc_pred[U_CHROMA] = 128 << ps_dec->u2_intra_dc_precision; ps_dec->u2_def_dc_pred[V_CHROMA] = 128 << ps_dec->u2_intra_dc_precision; if((ps_dec->u2_coded_mb)) { UWORD16 cbpValue; cbpValue = gau2_impeg2d_cbp_code[impeg2d_bit_stream_nxt(ps_stream,MB_CBP_LEN)]; ps_dec->u2_cbp = cbpValue & 0xFF; impeg2d_bit_stream_flush(ps_stream,(cbpValue >> 8) & 0x0FF); } else { ps_dec->u2_cbp = 0; } } } ",1 "bool PostScript_MetaHandler::FindLastPacket() { size_t bufPos, bufLen; XMP_IO* fileRef = this->parent->ioRef; XMP_Int64 fileLen = fileRef->Length(); XMP_PacketInfo & packetInfo = this->packetInfo; XMPScanner scanner ( fileLen ); enum { kBufferSize = 64*1024 }; XMP_Uns8 buffer [kBufferSize]; XMP_AbortProc abortProc = this->parent->abortProc; void * abortArg = this->parent->abortArg; const bool checkAbort = (abortProc != 0); fileRef->Rewind(); // Seek back to the beginning of the file. for ( bufPos = 0; bufPos < (size_t)fileLen; bufPos += bufLen ) { if ( checkAbort && abortProc(abortArg) ) { XMP_Throw ( ""PostScript_MetaHandler::FindLastPacket - User abort"", kXMPErr_UserAbort ); } bufLen = fileRef->Read ( buffer, kBufferSize ); if ( bufLen == 0 ) XMP_Throw ( ""PostScript_MetaHandler::FindLastPacket: Read failure"", kXMPErr_ExternalFailure ); scanner.Scan ( buffer, bufPos, bufLen ); } int snipCount = scanner.GetSnipCount(); XMPScanner::SnipInfoVector snips ( snipCount ); scanner.Report ( snips ); bool lastfound=false; for ( int i = 0; i < snipCount; ++i ) { if ( snips[i].fState == XMPScanner::eValidPacketSnip ) { if (!lastfound) { if ( snips[i].fLength > 0x7FFFFFFF ) XMP_Throw ( ""PostScript_MetaHandler::FindLastPacket: Oversize packet"", kXMPErr_BadXMP ); packetInfo.offset = snips[i].fOffset; packetInfo.length = (XMP_Int32)snips[i].fLength; packetInfo.charForm = snips[i].fCharForm; packetInfo.writeable = (snips[i].fAccess == 'w'); firstPacketInfo=packetInfo; lastPacketInfo=packetInfo; lastfound=true; } else { lastPacketInfo.offset = snips[i].fOffset; lastPacketInfo.length = (XMP_Int32)snips[i].fLength; lastPacketInfo.charForm = snips[i].fCharForm; lastPacketInfo.writeable = (snips[i].fAccess == 'w'); packetInfo=lastPacketInfo; } } } return lastfound; } // PostScript_MetaHandler::FindLastPacket ",0 "void WebPluginDelegateProxy::OnGetPluginElement(int route_id, bool* success) { *success = false; NPObject* npobject = NULL; if (plugin_) npobject = plugin_->GetPluginElement(); if (!npobject) return; new NPObjectStub( npobject, channel_host_.get(), route_id, 0, page_url_); *success = true; } ",0 "static int check_vma_flags(struct vm_area_struct *vma, unsigned long gup_flags) { vm_flags_t vm_flags = vma->vm_flags; int write = (gup_flags & FOLL_WRITE); int foreign = (gup_flags & FOLL_REMOTE); if (vm_flags & (VM_IO | VM_PFNMAP)) return -EFAULT; if (gup_flags & FOLL_ANON && !vma_is_anonymous(vma)) return -EFAULT; if (write) { if (!(vm_flags & VM_WRITE)) { if (!(gup_flags & FOLL_FORCE)) return -EFAULT; /* * We used to let the write,force case do COW in a * VM_MAYWRITE VM_SHARED !VM_WRITE vma, so ptrace could * set a breakpoint in a read-only mapping of an * executable, without corrupting the file (yet only * when that file had been opened for writing!). * Anon pages in shared mappings are surprising: now * just reject it. */ if (!is_cow_mapping(vm_flags)) return -EFAULT; } } else if (!(vm_flags & VM_READ)) { if (!(gup_flags & FOLL_FORCE)) return -EFAULT; /* * Is there actually any vma we can reach here which does not * have VM_MAYREAD set? */ if (!(vm_flags & VM_MAYREAD)) return -EFAULT; } /* * gups are always data accesses, not instruction * fetches, so execute=false here */ if (!arch_vma_access_permitted(vma, write, false, foreign)) return -EFAULT; return 0; } ",0 "X509_VERIFY_PARAM *X509_VERIFY_PARAM_lookup(const char *name) { X509_VERIFY_PARAM pm; unsigned int i, limit; pm.name = (char *)name; if (param_table) { size_t idx; if ((idx = sk_X509_VERIFY_PARAM_find(param_table, &pm)) != -1) return sk_X509_VERIFY_PARAM_value(param_table, idx); } limit = sizeof(default_table) / sizeof(X509_VERIFY_PARAM); for (i = 0; i < limit; i++) { if (strcmp(default_table[i].name, name) == 0) { return &default_table[i]; } } return NULL; } ",0 "void InfoBar::RemoveInfoBar() const { if (container_) container_->RemoveDelegate(delegate()); } ",0 "bool HTMLFormElement::isURLAttribute(const Attribute& attribute) const { return attribute.name() == actionAttr || HTMLElement::isURLAttribute(attribute); } ",0 "void ChromeDownloadManagerDelegate::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { DCHECK(type == chrome::NOTIFICATION_CRX_INSTALLER_DONE); registrar_.Remove(this, chrome::NOTIFICATION_CRX_INSTALLER_DONE, source); scoped_refptr installer = content::Source(source).ptr(); content::DownloadOpenDelayedCallback callback = crx_installers_[installer]; crx_installers_.erase(installer.get()); callback.Run(installer->did_handle_successfully()); } ",0 "static int _nfs4_do_fsinfo(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *fsinfo) { struct nfs4_fsinfo_arg args = { .fh = fhandle, .bitmask = server->attr_bitmask, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_FSINFO], .rpc_argp = &args, .rpc_resp = fsinfo, }; return rpc_call_sync(server->client, &msg, 0); } ",0 "void V8TestObject::LongMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_longMethod""); test_object_v8_internal::LongMethodMethod(info); } ",0 "std::unique_ptr CustomHistogram::PersistentCreate( const std::string& name, const BucketRanges* ranges, HistogramBase::AtomicCount* counts, HistogramBase::AtomicCount* logged_counts, uint32_t counts_size, HistogramSamples::Metadata* meta, HistogramSamples::Metadata* logged_meta) { return WrapUnique(new CustomHistogram( name, ranges, counts, logged_counts, counts_size, meta, logged_meta)); } ",0 "void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height, int linesize_align[AV_NUM_DATA_POINTERS]) { int i; int w_align = 1; int h_align = 1; AVPixFmtDescriptor const *desc = av_pix_fmt_desc_get(s->pix_fmt); if (desc) { w_align = 1 << desc->log2_chroma_w; h_align = 1 << desc->log2_chroma_h; } switch (s->pix_fmt) { case AV_PIX_FMT_YUV420P: case AV_PIX_FMT_YUYV422: case AV_PIX_FMT_YVYU422: case AV_PIX_FMT_UYVY422: case AV_PIX_FMT_YUV422P: case AV_PIX_FMT_YUV440P: case AV_PIX_FMT_YUV444P: case AV_PIX_FMT_GBRP: case AV_PIX_FMT_GBRAP: case AV_PIX_FMT_GRAY8: case AV_PIX_FMT_GRAY16BE: case AV_PIX_FMT_GRAY16LE: case AV_PIX_FMT_YUVJ420P: case AV_PIX_FMT_YUVJ422P: case AV_PIX_FMT_YUVJ440P: case AV_PIX_FMT_YUVJ444P: case AV_PIX_FMT_YUVA420P: case AV_PIX_FMT_YUVA422P: case AV_PIX_FMT_YUVA444P: case AV_PIX_FMT_YUV420P9LE: case AV_PIX_FMT_YUV420P9BE: case AV_PIX_FMT_YUV420P10LE: case AV_PIX_FMT_YUV420P10BE: case AV_PIX_FMT_YUV420P12LE: case AV_PIX_FMT_YUV420P12BE: case AV_PIX_FMT_YUV420P14LE: case AV_PIX_FMT_YUV420P14BE: case AV_PIX_FMT_YUV420P16LE: case AV_PIX_FMT_YUV420P16BE: case AV_PIX_FMT_YUVA420P9LE: case AV_PIX_FMT_YUVA420P9BE: case AV_PIX_FMT_YUVA420P10LE: case AV_PIX_FMT_YUVA420P10BE: case AV_PIX_FMT_YUVA420P16LE: case AV_PIX_FMT_YUVA420P16BE: case AV_PIX_FMT_YUV422P9LE: case AV_PIX_FMT_YUV422P9BE: case AV_PIX_FMT_YUV422P10LE: case AV_PIX_FMT_YUV422P10BE: case AV_PIX_FMT_YUV422P12LE: case AV_PIX_FMT_YUV422P12BE: case AV_PIX_FMT_YUV422P14LE: case AV_PIX_FMT_YUV422P14BE: case AV_PIX_FMT_YUV422P16LE: case AV_PIX_FMT_YUV422P16BE: case AV_PIX_FMT_YUVA422P9LE: case AV_PIX_FMT_YUVA422P9BE: case AV_PIX_FMT_YUVA422P10LE: case AV_PIX_FMT_YUVA422P10BE: case AV_PIX_FMT_YUVA422P12LE: case AV_PIX_FMT_YUVA422P12BE: case AV_PIX_FMT_YUVA422P16LE: case AV_PIX_FMT_YUVA422P16BE: case AV_PIX_FMT_YUV440P10LE: case AV_PIX_FMT_YUV440P10BE: case AV_PIX_FMT_YUV440P12LE: case AV_PIX_FMT_YUV440P12BE: case AV_PIX_FMT_YUV444P9LE: case AV_PIX_FMT_YUV444P9BE: case AV_PIX_FMT_YUV444P10LE: case AV_PIX_FMT_YUV444P10BE: case AV_PIX_FMT_YUV444P12LE: case AV_PIX_FMT_YUV444P12BE: case AV_PIX_FMT_YUV444P14LE: case AV_PIX_FMT_YUV444P14BE: case AV_PIX_FMT_YUV444P16LE: case AV_PIX_FMT_YUV444P16BE: case AV_PIX_FMT_YUVA444P9LE: case AV_PIX_FMT_YUVA444P9BE: case AV_PIX_FMT_YUVA444P10LE: case AV_PIX_FMT_YUVA444P10BE: case AV_PIX_FMT_YUVA444P12LE: case AV_PIX_FMT_YUVA444P12BE: case AV_PIX_FMT_YUVA444P16LE: case AV_PIX_FMT_YUVA444P16BE: case AV_PIX_FMT_GBRP9LE: case AV_PIX_FMT_GBRP9BE: case AV_PIX_FMT_GBRP10LE: case AV_PIX_FMT_GBRP10BE: case AV_PIX_FMT_GBRP12LE: case AV_PIX_FMT_GBRP12BE: case AV_PIX_FMT_GBRP14LE: case AV_PIX_FMT_GBRP14BE: case AV_PIX_FMT_GBRP16LE: case AV_PIX_FMT_GBRP16BE: case AV_PIX_FMT_GBRAP12LE: case AV_PIX_FMT_GBRAP12BE: case AV_PIX_FMT_GBRAP16LE: case AV_PIX_FMT_GBRAP16BE: w_align = 16; //FIXME assume 16 pixel per macroblock h_align = 16 * 2; // interlaced needs 2 macroblocks height break; case AV_PIX_FMT_YUV411P: case AV_PIX_FMT_YUVJ411P: case AV_PIX_FMT_UYYVYY411: w_align = 32; h_align = 16 * 2; break; case AV_PIX_FMT_YUV410P: if (s->codec_id == AV_CODEC_ID_SVQ1) { w_align = 64; h_align = 64; } break; case AV_PIX_FMT_RGB555: if (s->codec_id == AV_CODEC_ID_RPZA) { w_align = 4; h_align = 4; } if (s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) { w_align = 8; h_align = 8; } break; case AV_PIX_FMT_PAL8: case AV_PIX_FMT_BGR8: case AV_PIX_FMT_RGB8: if (s->codec_id == AV_CODEC_ID_SMC || s->codec_id == AV_CODEC_ID_CINEPAK) { w_align = 4; h_align = 4; } if (s->codec_id == AV_CODEC_ID_JV || s->codec_id == AV_CODEC_ID_INTERPLAY_VIDEO) { w_align = 8; h_align = 8; } break; case AV_PIX_FMT_BGR24: if ((s->codec_id == AV_CODEC_ID_MSZH) || (s->codec_id == AV_CODEC_ID_ZLIB)) { w_align = 4; h_align = 4; } break; case AV_PIX_FMT_RGB24: if (s->codec_id == AV_CODEC_ID_CINEPAK) { w_align = 4; h_align = 4; } break; default: break; } if (s->codec_id == AV_CODEC_ID_IFF_ILBM) { w_align = FFMAX(w_align, 8); } *width = FFALIGN(*width, w_align); *height = FFALIGN(*height, h_align); if (s->codec_id == AV_CODEC_ID_H264 || s->lowres || s->codec_id == AV_CODEC_ID_VP5 || s->codec_id == AV_CODEC_ID_VP6 || s->codec_id == AV_CODEC_ID_VP6F || s->codec_id == AV_CODEC_ID_VP6A ) { *height += 2; *width = FFMAX(*width, 32); } for (i = 0; i < 4; i++) linesize_align[i] = STRIDE_ALIGN; } ",0 "static json_t * oidc_get_state_from_cookie(request_rec *r, oidc_cfg *c, const char *cookieValue) { json_t *result = NULL; oidc_util_jwt_verify(r, c->crypto_passphrase, cookieValue, &result); return result; } ",0 "int snd_timer_global_register(struct snd_timer *timer) { struct snd_device dev; memset(&dev, 0, sizeof(dev)); dev.device_data = timer; return snd_timer_dev_register(&dev); } ",0 "static void fwnet_init_dev(struct net_device *net) { net->header_ops = &fwnet_header_ops; net->netdev_ops = &fwnet_netdev_ops; net->watchdog_timeo = 2 * HZ; net->flags = IFF_BROADCAST | IFF_MULTICAST; net->features = NETIF_F_HIGHDMA; net->addr_len = FWNET_ALEN; net->hard_header_len = FWNET_HLEN; net->type = ARPHRD_IEEE1394; net->tx_queue_len = FWNET_TX_QUEUE_LEN; net->ethtool_ops = &fwnet_ethtool_ops; } ",0 "static void MSLExternalSubset(void *context,const xmlChar *name, const xmlChar *external_id,const xmlChar *system_id) { MSLInfo *msl_info; xmlParserCtxt parser_context; xmlParserCtxtPtr parser; xmlParserInputPtr input; /* Does this document has an external subset? */ (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" SAX.externalSubset(%s %s %s)"",name, (external_id != (const xmlChar *) NULL ? (const char *) external_id : "" ""), (system_id != (const xmlChar *) NULL ? (const char *) system_id : "" "")); msl_info=(MSLInfo *) context; (void) msl_info; parser=msl_info->parser; if (((external_id == NULL) && (system_id == NULL)) || ((parser->validate == 0) || (parser->wellFormed == 0) || (msl_info->document == 0))) return; input=MSLResolveEntity(context,external_id,system_id); if (input == NULL) return; (void) xmlNewDtd(msl_info->document,name,external_id,system_id); parser_context=(*parser); parser->inputTab=(xmlParserInputPtr *) xmlMalloc(5*sizeof(*parser->inputTab)); if (parser->inputTab == (xmlParserInputPtr *) NULL) { parser->errNo=XML_ERR_NO_MEMORY; parser->input=parser_context.input; parser->inputNr=parser_context.inputNr; parser->inputMax=parser_context.inputMax; parser->inputTab=parser_context.inputTab; return; } parser->inputNr=0; parser->inputMax=5; parser->input=NULL; xmlPushInput(parser,input); (void) xmlSwitchEncoding(parser,xmlDetectCharEncoding(parser->input->cur,4)); if (input->filename == (char *) NULL) input->filename=(char *) xmlStrdup(system_id); input->line=1; input->col=1; input->base=parser->input->cur; input->cur=parser->input->cur; input->free=NULL; xmlParseExternalSubset(parser,external_id,system_id); while (parser->inputNr > 1) (void) xmlPopInput(parser); xmlFreeInputStream(parser->input); xmlFree(parser->inputTab); parser->input=parser_context.input; parser->inputNr=parser_context.inputNr; parser->inputMax=parser_context.inputMax; parser->inputTab=parser_context.inputTab; } ",0 "get_default_magic(void) { static const char hmagic[] = ""/.magic/magic.mgc""; static char *default_magic; char *home, *hmagicpath; #ifndef WIN32 struct stat st; if (default_magic) { free(default_magic); default_magic = NULL; } if ((home = getenv(""HOME"")) == NULL) return MAGIC; if (asprintf(&hmagicpath, ""%s/.magic.mgc"", home) < 0) return MAGIC; if (stat(hmagicpath, &st) == -1) { free(hmagicpath); if (asprintf(&hmagicpath, ""%s/.magic"", home) < 0) return MAGIC; if (stat(hmagicpath, &st) == -1) goto out; if (S_ISDIR(st.st_mode)) { free(hmagicpath); if (asprintf(&hmagicpath, ""%s/%s"", home, hmagic) < 0) return MAGIC; if (access(hmagicpath, R_OK) == -1) goto out; } } if (asprintf(&default_magic, ""%s:%s"", hmagicpath, MAGIC) < 0) goto out; free(hmagicpath); return default_magic; out: default_magic = NULL; free(hmagicpath); return MAGIC; #else char *hmagicp; char *tmppath = NULL; LPTSTR dllpath; hmagicpath = NULL; #define APPENDPATH() \ do { \ if (tmppath && access(tmppath, R_OK) != -1) { \ if (hmagicpath == NULL) \ hmagicpath = tmppath; \ else { \ if (asprintf(&hmagicp, ""%s%c%s"", hmagicpath, \ PATHSEP, tmppath) >= 0) { \ free(hmagicpath); \ hmagicpath = hmagicp; \ } \ free(tmppath); \ } \ tmppath = NULL; \ } \ } while (/*CONSTCOND*/0) if (default_magic) { free(default_magic); default_magic = NULL; } /* First, try to get user-specific magic file */ if ((home = getenv(""LOCALAPPDATA"")) == NULL) { if ((home = getenv(""USERPROFILE"")) != NULL) if (asprintf(&tmppath, ""%s/Local Settings/Application Data%s"", home, hmagic) < 0) tmppath = NULL; } else { if (asprintf(&tmppath, ""%s%s"", home, hmagic) < 0) tmppath = NULL; } APPENDPATH(); /* Second, try to get a magic file from Common Files */ if ((home = getenv(""COMMONPROGRAMFILES"")) != NULL) { if (asprintf(&tmppath, ""%s%s"", home, hmagic) >= 0) APPENDPATH(); } /* Third, try to get magic file relative to dll location */ dllpath = malloc(sizeof(*dllpath) * (MAX_PATH + 1)); dllpath[MAX_PATH] = 0; /* just in case long path gets truncated and not null terminated */ if (GetModuleFileNameA(NULL, dllpath, MAX_PATH)){ PathRemoveFileSpecA(dllpath); if (strlen(dllpath) > 3 && stricmp(&dllpath[strlen(dllpath) - 3], ""bin"") == 0) { if (asprintf(&tmppath, ""%s/../share/misc/magic.mgc"", dllpath) >= 0) APPENDPATH(); } else { if (asprintf(&tmppath, ""%s/share/misc/magic.mgc"", dllpath) >= 0) APPENDPATH(); else if (asprintf(&tmppath, ""%s/magic.mgc"", dllpath) >= 0) APPENDPATH(); } } /* Don't put MAGIC constant - it likely points to a file within MSys tree */ default_magic = hmagicpath; return default_magic; #endif } ",0 "bool IsResizeComplete(aura::test::WindowEventDispatcherTestApi* dispatcher_test, RenderWidgetHostImpl* widget_host) { dispatcher_test->WaitUntilPointerMovesDispatched(); widget_host->SynchronizeVisualProperties(); return !widget_host->resize_ack_pending_for_testing(); } ",0 "static struct srpt_port *srpt_lookup_port(const char *name) { struct srpt_port *sport; spin_lock(&srpt_dev_lock); sport = __srpt_lookup_port(name); spin_unlock(&srpt_dev_lock); return sport; } ",0 " void setTextureMapper(TextureMapperGL* texmap) { m_textureMapper = texmap; } ",0 "static sctp_disposition_t sctp_sf_do_dupcook_c(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, struct sctp_chunk *chunk, sctp_cmd_seq_t *commands, struct sctp_association *new_asoc) { /* The cookie should be silently discarded. * The endpoint SHOULD NOT change states and should leave * any timers running. */ return SCTP_DISPOSITION_DISCARD; } ",0 "static int imapd_canon_user(sasl_conn_t *conn, void *context, const char *user, unsigned ulen, unsigned flags, const char *user_realm, char *out, unsigned out_max, unsigned *out_ulen) { char userbuf[MAX_MAILBOX_BUFFER], *p; size_t n; int r; if (!ulen) ulen = strlen(user); if (config_getswitch(IMAPOPT_IMAPMAGICPLUS)) { /* make a working copy of the auth[z]id */ if (ulen >= MAX_MAILBOX_BUFFER) { sasl_seterror(conn, 0, ""buffer overflow while canonicalizing""); return SASL_BUFOVER; } memcpy(userbuf, user, ulen); userbuf[ulen] = '\0'; user = userbuf; /* See if we're using the magic plus */ if ((p = strchr(userbuf, '+'))) { n = config_virtdomains ? strcspn(p, ""@"") : strlen(p); if (flags & SASL_CU_AUTHZID) { /* make a copy of the magic plus */ if (imapd_magicplus) free(imapd_magicplus); imapd_magicplus = xstrndup(p, n); } /* strip the magic plus from the auth[z]id */ memmove(p, p+n, strlen(p+n)+1); ulen -= n; } } r = mysasl_canon_user(conn, context, user, ulen, flags, user_realm, out, out_max, out_ulen); if (!r && imapd_magicplus && flags == SASL_CU_AUTHZID) { /* If we're only doing the authzid, put back the magic plus in case its used in the challenge/response calculation */ n = strlen(imapd_magicplus); if (*out_ulen + n > out_max) { sasl_seterror(conn, 0, ""buffer overflow while canonicalizing""); r = SASL_BUFOVER; } else { p = (config_virtdomains && (p = strchr(out, '@'))) ? p : out + *out_ulen; memmove(p+n, p, strlen(p)+1); memcpy(p, imapd_magicplus, n); *out_ulen += n; } } return r; } ",0 "xmlXPathNodeSetMergeAndClear(xmlNodeSetPtr set1, xmlNodeSetPtr set2, int hasNullEntries) { if ((set1 == NULL) && (hasNullEntries == 0)) { /* * Note that doing a memcpy of the list, namespace nodes are * just assigned to set1, since set2 is cleared anyway. */ set1 = xmlXPathNodeSetCreateSize(set2->nodeNr); if (set1 == NULL) return(NULL); if (set2->nodeNr != 0) { memcpy(set1->nodeTab, set2->nodeTab, set2->nodeNr * sizeof(xmlNodePtr)); set1->nodeNr = set2->nodeNr; } } else { int i, j, initNbSet1; xmlNodePtr n1, n2; if (set1 == NULL) set1 = xmlXPathNodeSetCreate(NULL); if (set1 == NULL) return (NULL); initNbSet1 = set1->nodeNr; for (i = 0;i < set2->nodeNr;i++) { n2 = set2->nodeTab[i]; /* * Skip NULLed entries. */ if (n2 == NULL) continue; /* * Skip duplicates. */ for (j = 0; j < initNbSet1; j++) { n1 = set1->nodeTab[j]; if (n1 == n2) { goto skip_node; } else if ((n1->type == XML_NAMESPACE_DECL) && (n2->type == XML_NAMESPACE_DECL)) { if ((((xmlNsPtr) n1)->next == ((xmlNsPtr) n2)->next) && (xmlStrEqual(((xmlNsPtr) n1)->prefix, ((xmlNsPtr) n2)->prefix))) { /* * Free the namespace node. */ set2->nodeTab[i] = NULL; xmlXPathNodeSetFreeNs((xmlNsPtr) n2); goto skip_node; } } } /* * grow the nodeTab if needed */ if (set1->nodeMax == 0) { set1->nodeTab = (xmlNodePtr *) xmlMalloc( XML_NODESET_DEFAULT * sizeof(xmlNodePtr)); if (set1->nodeTab == NULL) { xmlXPathErrMemory(NULL, ""merging nodeset\n""); return(NULL); } memset(set1->nodeTab, 0, XML_NODESET_DEFAULT * (size_t) sizeof(xmlNodePtr)); set1->nodeMax = XML_NODESET_DEFAULT; } else if (set1->nodeNr >= set1->nodeMax) { xmlNodePtr *temp; set1->nodeMax *= 2; temp = (xmlNodePtr *) xmlRealloc( set1->nodeTab, set1->nodeMax * sizeof(xmlNodePtr)); if (temp == NULL) { xmlXPathErrMemory(NULL, ""merging nodeset\n""); return(NULL); } set1->nodeTab = temp; } if (n2->type == XML_NAMESPACE_DECL) { xmlNsPtr ns = (xmlNsPtr) n2; set1->nodeTab[set1->nodeNr++] = xmlXPathNodeSetDupNs((xmlNodePtr) ns->next, ns); } else set1->nodeTab[set1->nodeNr++] = n2; skip_node: {} } } set2->nodeNr = 0; return(set1); } ",0 "static int rfcomm_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; struct bt_security sec; int len, err = 0; BT_DBG(""sk %p"", sk); if (level == SOL_RFCOMM) return rfcomm_sock_getsockopt_old(sock, optname, optval, optlen); if (level != SOL_BLUETOOTH) return -ENOPROTOOPT; if (get_user(len, optlen)) return -EFAULT; lock_sock(sk); switch (optname) { case BT_SECURITY: if (sk->sk_type != SOCK_STREAM) { err = -EINVAL; break; } sec.level = rfcomm_pi(sk)->sec_level; len = min_t(unsigned int, len, sizeof(sec)); if (copy_to_user(optval, (char *) &sec, len)) err = -EFAULT; break; case BT_DEFER_SETUP: if (sk->sk_state != BT_BOUND && sk->sk_state != BT_LISTEN) { err = -EINVAL; break; } if (put_user(test_bit(BT_SK_DEFER_SETUP, &bt_sk(sk)->flags), (u32 __user *) optval)) err = -EFAULT; break; default: err = -ENOPROTOOPT; break; } release_sock(sk); return err; } ",1 "void Document::WillInsertBody() { if (auto* loader = Loader()) loader->Fetcher()->LoosenLoadThrottlingPolicy(); BeginLifecycleUpdatesIfRenderingReady(); } ",0 " void OnPolicyUpdate(scoped_ptr policies) { if (!context_->network_task_runner()->BelongsToCurrentThread()) { context_->network_task_runner()->PostTask(FROM_HERE, base::Bind( &HostProcess::OnPolicyUpdate, base::Unretained(this), base::Passed(&policies))); return; } bool restart_required = false; bool bool_value; std::string string_value; if (policies->GetString(policy_hack::PolicyWatcher::kHostDomainPolicyName, &string_value)) { restart_required |= OnHostDomainPolicyUpdate(string_value); } if (policies->GetBoolean(policy_hack::PolicyWatcher::kNatPolicyName, &bool_value)) { restart_required |= OnNatPolicyUpdate(bool_value); } if (policies->GetString( policy_hack::PolicyWatcher::kHostTalkGadgetPrefixPolicyName, &string_value)) { restart_required |= OnHostTalkGadgetPrefixPolicyUpdate(string_value); } if (policies->GetBoolean( policy_hack::PolicyWatcher::kHostRequireCurtainPolicyName, &bool_value)) { restart_required |= OnCurtainPolicyUpdate(bool_value); } if (!host_) { StartHost(); } else if (restart_required) { RestartHost(); } } ",0 "static void *pool_alloc(size_t len) { struct mem_pool *p; void *r; /* round up to a 'uintmax_t' alignment */ if (len & (sizeof(uintmax_t) - 1)) len += sizeof(uintmax_t) - (len & (sizeof(uintmax_t) - 1)); for (p = mem_pool; p; p = p->next_pool) if ((p->end - p->next_free >= len)) break; if (!p) { if (len >= (mem_pool_alloc/2)) { total_allocd += len; return xmalloc(len); } total_allocd += sizeof(struct mem_pool) + mem_pool_alloc; p = xmalloc(sizeof(struct mem_pool) + mem_pool_alloc); p->next_pool = mem_pool; p->next_free = (char *) p->space; p->end = p->next_free + mem_pool_alloc; mem_pool = p; } r = p->next_free; p->next_free += len; return r; } ",0 "static int usb_set_lpm_timeout(struct usb_device *udev, enum usb3_link_state state, int timeout) { int ret; int feature; switch (state) { case USB3_LPM_U1: feature = USB_PORT_FEAT_U1_TIMEOUT; break; case USB3_LPM_U2: feature = USB_PORT_FEAT_U2_TIMEOUT; break; default: dev_warn(&udev->dev, ""%s: Can't set timeout for non-U1 or U2 state.\n"", __func__); return -EINVAL; } if (state == USB3_LPM_U1 && timeout > USB3_LPM_U1_MAX_TIMEOUT && timeout != USB3_LPM_DEVICE_INITIATED) { dev_warn(&udev->dev, ""Failed to set %s timeout to 0x%x, "" ""which is a reserved value.\n"", usb3_lpm_names[state], timeout); return -EINVAL; } ret = set_port_feature(udev->parent, USB_PORT_LPM_TIMEOUT(timeout) | udev->portnum, feature); if (ret < 0) { dev_warn(&udev->dev, ""Failed to set %s timeout to 0x%x,"" ""error code %i\n"", usb3_lpm_names[state], timeout, ret); return -EBUSY; } if (state == USB3_LPM_U1) udev->u1_params.timeout = timeout; else udev->u2_params.timeout = timeout; return 0; } ",0 "void TabsUpdateFunction::OnExecuteCodeFinished(const std::string& error, int32 on_page_id, const GURL& url, const ListValue& script_result) { if (error.empty()) PopulateResult(); else error_ = error; SendResponse(error.empty()); } ",0 "void sctp_icmp_proto_unreachable(struct sock *sk, struct sctp_association *asoc, struct sctp_transport *t) { SCTP_DEBUG_PRINTK(""%s\n"", __func__); sctp_do_sm(SCTP_EVENT_T_OTHER, SCTP_ST_OTHER(SCTP_EVENT_ICMP_PROTO_UNREACH), asoc->state, asoc->ep, asoc, t, GFP_ATOMIC); } ",0 "static inline void strip_header(char *header_bag, char *lc_header_bag, const char *lc_header_name) { char *lc_header_start = strstr(lc_header_bag, lc_header_name); char *header_start = header_bag + (lc_header_start - lc_header_bag); if (lc_header_start && (lc_header_start == lc_header_bag || *(lc_header_start-1) == '\n') ) { char *lc_eol = strchr(lc_header_start, '\n'); char *eol = header_start + (lc_eol - lc_header_start); if (lc_eol) { size_t eollen = strlen(lc_eol); memmove(lc_header_start, lc_eol+1, eollen); memmove(header_start, eol+1, eollen); } else { *lc_header_start = '\0'; *header_start = '\0'; } } } ",0 "void RootWindow::SetHostBounds(const gfx::Rect& bounds_in_pixel) { DispatchHeldMouseMove(); host_->SetBounds(bounds_in_pixel); last_mouse_location_ = ui::ConvertPointToDIP(layer(), host_->QueryMouseLocation()); synthesize_mouse_move_ = false; } ",0 "static int policy_vma(struct vm_area_struct *vma, struct mempolicy *new) { int err = 0; struct mempolicy *old = vma->vm_policy; pr_debug(""vma %lx-%lx/%lx vm_ops %p vm_file %p set_policy %p\n"", vma->vm_start, vma->vm_end, vma->vm_pgoff, vma->vm_ops, vma->vm_file, vma->vm_ops ? vma->vm_ops->set_policy : NULL); if (vma->vm_ops && vma->vm_ops->set_policy) err = vma->vm_ops->set_policy(vma, new); if (!err) { mpol_get(new); vma->vm_policy = new; mpol_put(old); } return err; } ",0 "keydirection2ascii (int kd, bool remote) { if (kd == KEY_DIRECTION_BIDIRECTIONAL) return NULL; else if (kd == KEY_DIRECTION_NORMAL) return remote ? ""1"" : ""0""; else if (kd == KEY_DIRECTION_INVERSE) return remote ? ""0"" : ""1""; else { ASSERT (0); } return NULL; /* NOTREACHED */ } ",0 "static void null_endofword(char *word) { while (*word && *word != ' ' && *word != '\t') word++; *word = '\0'; } ",0 " Renderbuffer* GetRenderbuffer(GLuint client_id) { return renderbuffer_manager()->GetRenderbuffer(client_id); } ",0 "bool isDocumentCrossOrigin(Document& document) { const LocalFrame* frame = document.frame(); return frame && frame->isCrossOriginSubframe(); } ",0 "static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid) { vpid_sync_context(vpid); if (enable_ept) { if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) return; ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa)); } } ",0 "static void mptsas_save_request(QEMUFile *f, SCSIRequest *sreq) { MPTSASRequest *req = sreq->hba_private; int i; qemu_put_buffer(f, (unsigned char *)&req->scsi_io, sizeof(req->scsi_io)); qemu_put_be32(f, req->qsg.nsg); for (i = 0; i < req->qsg.nsg; i++) { qemu_put_be64(f, req->qsg.sg[i].base); qemu_put_be64(f, req->qsg.sg[i].len); } } ",0 "RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost( RenderWidgetHostImpl* receiving_widget) { if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) return receiving_widget; if (receiving_widget != GetMainFrame()->GetRenderWidgetHost()) return receiving_widget; WebContentsImpl* focused_contents = GetFocusedWebContents(); if (focused_contents->ShowingInterstitialPage()) { return static_cast( focused_contents->GetRenderManager() ->interstitial_page() ->GetMainFrame()) ->GetRenderWidgetHost(); } FrameTreeNode* focused_frame = nullptr; if (focused_contents->browser_plugin_guest_ && !GuestMode::IsCrossProcessFrameGuest(focused_contents)) { focused_frame = frame_tree_.GetFocusedFrame(); } else { focused_frame = GetFocusedWebContents()->frame_tree_.GetFocusedFrame(); } if (!focused_frame) return receiving_widget; RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView(); if (!view) return nullptr; return RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); } ",1 "bool InputDispatcher::isWindowObscuredAtPointLocked( const sp& windowHandle, int32_t x, int32_t y) const { int32_t displayId = windowHandle->getInfo()->displayId; size_t numWindows = mWindowHandles.size(); for (size_t i = 0; i < numWindows; i++) { sp otherHandle = mWindowHandles.itemAt(i); if (otherHandle == windowHandle) { break; } const InputWindowInfo* otherInfo = otherHandle->getInfo(); if (otherInfo->displayId == displayId && otherInfo->visible && !otherInfo->isTrustedOverlay() && otherInfo->frameContainsPoint(x, y)) { return true; } } return false; } ",0 "NOINLINE void ResetThread_PROCESS_LAUNCHER( std::unique_ptr thread) { volatile int inhibit_comdat = __LINE__; ALLOW_UNUSED_LOCAL(inhibit_comdat); thread.reset(); } ",0 "void PluginInstance::RequestRead(NPStream* stream, NPByteRange* range_list) { std::string range_info = ""bytes=""; while (range_list) { range_info += IntToString(range_list->offset); range_info += ""-""; range_info += IntToString(range_list->offset + range_list->length - 1); range_list = range_list->next; if (range_list) { range_info += "",""; } } if (plugin_data_stream_) { if (plugin_data_stream_->stream() == stream) { webplugin_->CancelDocumentLoad(); plugin_data_stream_ = NULL; } } std::vector >::iterator stream_index; for (stream_index = open_streams_.begin(); stream_index != open_streams_.end(); ++stream_index) { PluginStream* plugin_stream = *stream_index; if (plugin_stream->stream() == stream) { plugin_stream->set_seekable(true); webplugin_->InitiateHTTPRangeRequest( stream->url, range_info.c_str(), reinterpret_cast(plugin_stream), plugin_stream->notify_needed(), reinterpret_cast(plugin_stream->notify_data())); break; } } } ",1 "void GLES2DecoderImpl::SetMsgCallback(const MsgCallback& callback) { msg_callback_ = callback; } ",0 "extractContigSamplesShifted24bits (uint8 *in, uint8 *out, uint32 cols, tsample_t sample, uint16 spp, uint16 bps, tsample_t count, uint32 start, uint32 end, int shift) { int ready_bits = 0, sindex = 0; uint32 col, src_byte, src_bit, bit_offset; uint32 maskbits = 0, matchbits = 0; uint32 buff1 = 0, buff2 = 0; uint8 bytebuff1 = 0, bytebuff2 = 0; uint8 *src = in; uint8 *dst = out; if ((in == NULL) || (out == NULL)) { TIFFError(""extractContigSamplesShifted24bits"",""Invalid input or output buffer""); return (1); } if ((start > end) || (start > cols)) { TIFFError (""extractContigSamplesShifted24bits"", ""Invalid start column value %d ignored"", start); start = 0; } if ((end == 0) || (end > cols)) { TIFFError (""extractContigSamplesShifted24bits"", ""Invalid end column value %d ignored"", end); end = cols; } ready_bits = shift; maskbits = (uint32)-1 >> ( 32 - bps); for (col = start; col < end; col++) { /* Compute src byte(s) and bits within byte(s) */ bit_offset = col * bps * spp; for (sindex = sample; (sindex < spp) && (sindex < (sample + count)); sindex++) { if (sindex == 0) { src_byte = bit_offset / 8; src_bit = bit_offset % 8; } else { src_byte = (bit_offset + (sindex * bps)) / 8; src_bit = (bit_offset + (sindex * bps)) % 8; } src = in + src_byte; matchbits = maskbits << (32 - src_bit - bps); if (little_endian) buff1 = (src[0] << 24) | (src[1] << 16) | (src[2] << 8) | src[3]; else buff1 = (src[3] << 24) | (src[2] << 16) | (src[1] << 8) | src[0]; if ((col == start) && (sindex == sample)) buff2 = buff1 & ((uint32)-1) << (16 - shift); buff1 = (buff1 & matchbits) << (src_bit); if (ready_bits < 16) /* add another bps bits to the buffer */ { bytebuff1 = bytebuff2 = 0; buff2 = (buff2 | (buff1 >> ready_bits)); } else /* If we have a full buffer's worth, write it out */ { bytebuff1 = (buff2 >> 24); *dst++ = bytebuff1; bytebuff2 = (buff2 >> 16); *dst++ = bytebuff2; ready_bits -= 16; /* shift in new bits */ buff2 = ((buff2 << 16) | (buff1 >> ready_bits)); } ready_bits += bps; } } /* catch any trailing bits at the end of the line */ while (ready_bits > 0) { bytebuff1 = (buff2 >> 24); *dst++ = bytebuff1; buff2 = (buff2 << 8); bytebuff2 = bytebuff1; ready_bits -= 8; } return (0); } /* end extractContigSamplesShifted24bits */ ",0 "void InputHandler::setInputValue(const WTF::String& value) { if (!isActiveTextPopup()) return; HTMLInputElement* inputElement = static_cast(m_currentFocusElement.get()); inputElement->setValue(value); clearCurrentFocusElement(); } ",0 "void BrowserTabStripController::ShowContextMenuForTab(BaseTab* tab, const gfx::Point& p) { context_menu_contents_.reset(new TabContextMenuContents(tab, this)); context_menu_contents_->RunMenuAt(p); } ",0 "static int emulator_write_emulated_onepage(unsigned long addr, const void *val, unsigned int bytes, struct x86_exception *exception, struct kvm_vcpu *vcpu) { gpa_t gpa; gpa = kvm_mmu_gva_to_gpa_write(vcpu, addr, exception); if (gpa == UNMAPPED_GVA) return X86EMUL_PROPAGATE_FAULT; /* For APIC access vmexit */ if ((gpa & PAGE_MASK) == APIC_DEFAULT_PHYS_BASE) goto mmio; if (emulator_write_phys(vcpu, gpa, val, bytes)) return X86EMUL_CONTINUE; mmio: trace_kvm_mmio(KVM_TRACE_MMIO_WRITE, bytes, gpa, *(u64 *)val); /* * Is this MMIO handled locally? */ if (!vcpu_mmio_write(vcpu, gpa, bytes, val)) return X86EMUL_CONTINUE; vcpu->mmio_needed = 1; vcpu->run->exit_reason = KVM_EXIT_MMIO; vcpu->run->mmio.phys_addr = vcpu->mmio_phys_addr = gpa; vcpu->run->mmio.len = vcpu->mmio_size = bytes; vcpu->run->mmio.is_write = vcpu->mmio_is_write = 1; memcpy(vcpu->run->mmio.data, val, bytes); return X86EMUL_CONTINUE; } ",0 "decode_NXAST_RAW_NAT(const struct nx_action_nat *nan, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { struct ofpact_nat *nat; uint16_t range_present = ntohs(nan->range_present); const char *opts = (char *)(nan + 1); uint16_t len = ntohs(nan->len) - sizeof *nan; nat = ofpact_put_NAT(out); nat->flags = ntohs(nan->flags); /* Check for unknown or mutually exclusive flags. */ if ((nat->flags & ~NX_NAT_F_MASK) || (nat->flags & NX_NAT_F_SRC && nat->flags & NX_NAT_F_DST) || (nat->flags & NX_NAT_F_PROTO_HASH && nat->flags & NX_NAT_F_PROTO_RANDOM)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } #define NX_NAT_GET_OPT(DST, SRC, LEN, TYPE) \ (LEN >= sizeof(TYPE) \ ? (memcpy(DST, SRC, sizeof(TYPE)), LEN -= sizeof(TYPE), \ SRC += sizeof(TYPE)) \ : NULL) nat->range_af = AF_UNSPEC; if (range_present & NX_NAT_RANGE_IPV4_MIN) { if (range_present & (NX_NAT_RANGE_IPV6_MIN | NX_NAT_RANGE_IPV6_MAX)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (!NX_NAT_GET_OPT(&nat->range.addr.ipv4.min, opts, len, ovs_be32) || !nat->range.addr.ipv4.min) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range_af = AF_INET; if (range_present & NX_NAT_RANGE_IPV4_MAX) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv4.max, opts, len, ovs_be32)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (ntohl(nat->range.addr.ipv4.max) < ntohl(nat->range.addr.ipv4.min)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_IPV4_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } else if (range_present & NX_NAT_RANGE_IPV6_MIN) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv6.min, opts, len, struct in6_addr) || ipv6_mask_is_any(&nat->range.addr.ipv6.min)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range_af = AF_INET6; if (range_present & NX_NAT_RANGE_IPV6_MAX) { if (!NX_NAT_GET_OPT(&nat->range.addr.ipv6.max, opts, len, struct in6_addr)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (memcmp(&nat->range.addr.ipv6.max, &nat->range.addr.ipv6.min, sizeof(struct in6_addr)) < 0) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_IPV6_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (range_present & NX_NAT_RANGE_PROTO_MIN) { ovs_be16 proto; if (nat->range_af == AF_UNSPEC) { return OFPERR_OFPBAC_BAD_ARGUMENT; } if (!NX_NAT_GET_OPT(&proto, opts, len, ovs_be16) || proto == 0) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range.proto.min = ntohs(proto); if (range_present & NX_NAT_RANGE_PROTO_MAX) { if (!NX_NAT_GET_OPT(&proto, opts, len, ovs_be16)) { return OFPERR_OFPBAC_BAD_ARGUMENT; } nat->range.proto.max = ntohs(proto); if (nat->range.proto.max < nat->range.proto.min) { return OFPERR_OFPBAC_BAD_ARGUMENT; } } } else if (range_present & NX_NAT_RANGE_PROTO_MAX) { return OFPERR_OFPBAC_BAD_ARGUMENT; } return 0; } ",0 "int dm_deleting_md(struct mapped_device *md) { return test_bit(DMF_DELETING, &md->flags); } ",0 "bfd_rt_priority_handler(vector_t *strvec) { int priority = get_realtime_priority(strvec, ""BFD""); if (priority >= 0) global_data->bfd_realtime_priority = priority; } ",0 "cifs_reconnect(struct TCP_Server_Info *server) { int rc = 0; struct list_head *tmp, *tmp2; struct cifsSesInfo *ses; struct cifsTconInfo *tcon; struct mid_q_entry *mid_entry; spin_lock(&GlobalMid_Lock); if (server->tcpStatus == CifsExiting) { /* the demux thread will exit normally next time through the loop */ spin_unlock(&GlobalMid_Lock); return rc; } else server->tcpStatus = CifsNeedReconnect; spin_unlock(&GlobalMid_Lock); server->maxBuf = 0; cFYI(1, ""Reconnecting tcp session""); /* before reconnecting the tcp session, mark the smb session (uid) and the tid bad so they are not used until reconnected */ read_lock(&cifs_tcp_ses_lock); list_for_each(tmp, &server->smb_ses_list) { ses = list_entry(tmp, struct cifsSesInfo, smb_ses_list); ses->need_reconnect = true; ses->ipc_tid = 0; list_for_each(tmp2, &ses->tcon_list) { tcon = list_entry(tmp2, struct cifsTconInfo, tcon_list); tcon->need_reconnect = true; } } read_unlock(&cifs_tcp_ses_lock); /* do not want to be sending data on a socket we are freeing */ mutex_lock(&server->srv_mutex); if (server->ssocket) { cFYI(1, ""State: 0x%x Flags: 0x%lx"", server->ssocket->state, server->ssocket->flags); kernel_sock_shutdown(server->ssocket, SHUT_WR); cFYI(1, ""Post shutdown state: 0x%x Flags: 0x%lx"", server->ssocket->state, server->ssocket->flags); sock_release(server->ssocket); server->ssocket = NULL; } spin_lock(&GlobalMid_Lock); list_for_each(tmp, &server->pending_mid_q) { mid_entry = list_entry(tmp, struct mid_q_entry, qhead); if (mid_entry->midState == MID_REQUEST_SUBMITTED) { /* Mark other intransit requests as needing retry so we do not immediately mark the session bad again (ie after we reconnect below) as they timeout too */ mid_entry->midState = MID_RETRY_NEEDED; } } spin_unlock(&GlobalMid_Lock); mutex_unlock(&server->srv_mutex); while ((server->tcpStatus != CifsExiting) && (server->tcpStatus != CifsGood)) { try_to_freeze(); if (server->addr.sockAddr6.sin6_family == AF_INET6) rc = ipv6_connect(server); else rc = ipv4_connect(server); if (rc) { cFYI(1, ""reconnect error %d"", rc); msleep(3000); } else { atomic_inc(&tcpSesReconnectCount); spin_lock(&GlobalMid_Lock); if (server->tcpStatus != CifsExiting) server->tcpStatus = CifsGood; server->sequence_number = 0; spin_unlock(&GlobalMid_Lock); /* atomic_set(&server->inFlight,0);*/ wake_up(&server->response_q); } } return rc; } ",0 "int jas_memdump(FILE *out, void *data, size_t len) { size_t i; size_t j; uchar *dp; dp = data; for (i = 0; i < len; i += 16) { fprintf(out, ""%04zx:"", i); for (j = 0; j < 16; ++j) { if (i + j < len) { fprintf(out, "" %02x"", dp[i + j]); } } fprintf(out, ""\n""); } return 0; } ",0 "int __legitimize_mnt(struct vfsmount *bastard, unsigned seq) { struct mount *mnt; if (read_seqretry(&mount_lock, seq)) return 1; if (bastard == NULL) return 0; mnt = real_mount(bastard); mnt_add_count(mnt, 1); if (likely(!read_seqretry(&mount_lock, seq))) return 0; if (bastard->mnt_flags & MNT_SYNC_UMOUNT) { mnt_add_count(mnt, -1); return 1; } return -1; } ",0 "void AudioRendererAlgorithm::EnqueueBuffer(Buffer* buffer_in) { DCHECK(!buffer_in->IsEndOfStream()); audio_buffer_.Append(buffer_in); needs_more_data_ = false; if (!IsQueueFull()) request_read_cb_.Run(); } ",0 "QQuickWebViewPrivate::QQuickWebViewPrivate(QQuickWebView* viewport) : q_ptr(viewport) , flickProvider(0) , alertDialog(0) , confirmDialog(0) , promptDialog(0) , authenticationDialog(0) , certificateVerificationDialog(0) , itemSelector(0) , proxyAuthenticationDialog(0) , userDidOverrideContentWidth(false) , userDidOverrideContentHeight(false) , m_navigatorQtObjectEnabled(false) , m_renderToOffscreenBuffer(false) , m_loadStartedSignalSent(false) , m_dialogRunnerActive(false) { viewport->setFlags(QQuickItem::ItemClipsChildrenToShape); QObject::connect(viewport, SIGNAL(visibleChanged()), viewport, SLOT(_q_onVisibleChanged())); QObject::connect(viewport, SIGNAL(urlChanged()), viewport, SLOT(_q_onUrlChanged())); pageView.reset(new QQuickWebPage(viewport)); } ",0 "int ip6_nd_hdr(struct sock *sk, struct sk_buff *skb, struct net_device *dev, const struct in6_addr *saddr, const struct in6_addr *daddr, int proto, int len) { struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6hdr *hdr; skb->protocol = htons(ETH_P_IPV6); skb->dev = dev; skb_reset_network_header(skb); skb_put(skb, sizeof(struct ipv6hdr)); hdr = ipv6_hdr(skb); *(__be32*)hdr = htonl(0x60000000); hdr->payload_len = htons(len); hdr->nexthdr = proto; hdr->hop_limit = np->hop_limit; ipv6_addr_copy(&hdr->saddr, saddr); ipv6_addr_copy(&hdr->daddr, daddr); return 0; } ",0 "static void free_StringTable(StringTable* stringTable) { if (stringTable) { free (stringTable->szKey); if (stringTable->Children) { ut32 childrenST = 0; for (; childrenST < stringTable->numOfChildren; childrenST++) { free_String (stringTable->Children[childrenST]); } free (stringTable->Children); } free (stringTable); } } ",0 "static unsigned long shm_get_unmapped_area(struct file *file, unsigned long addr, unsigned long len, unsigned long pgoff, unsigned long flags) { struct shm_file_data *sfd = shm_file_data(file); return sfd->file->f_op->get_unmapped_area(sfd->file, addr, len, pgoff, flags); } ",0 "static int ext4_convert_unwritten_extents_endio(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, struct ext4_ext_path **ppath) { struct ext4_ext_path *path = *ppath; struct ext4_extent *ex; ext4_lblk_t ee_block; unsigned int ee_len; int depth; int err = 0; depth = ext_depth(inode); ex = path[depth].p_ext; ee_block = le32_to_cpu(ex->ee_block); ee_len = ext4_ext_get_actual_len(ex); ext_debug(""ext4_convert_unwritten_extents_endio: inode %lu, logical"" ""block %llu, max_blocks %u\n"", inode->i_ino, (unsigned long long)ee_block, ee_len); /* If extent is larger than requested it is a clear sign that we still * have some extent state machine issues left. So extent_split is still * required. * TODO: Once all related issues will be fixed this situation should be * illegal. */ if (ee_block != map->m_lblk || ee_len > map->m_len) { #ifdef EXT4_DEBUG ext4_warning(""Inode (%ld) finished: extent logical block %llu,"" "" len %u; IO logical block %llu, len %u\n"", inode->i_ino, (unsigned long long)ee_block, ee_len, (unsigned long long)map->m_lblk, map->m_len); #endif err = ext4_split_convert_extents(handle, inode, map, ppath, EXT4_GET_BLOCKS_CONVERT); if (err < 0) return err; path = ext4_find_extent(inode, map->m_lblk, ppath, 0); if (IS_ERR(path)) return PTR_ERR(path); depth = ext_depth(inode); ex = path[depth].p_ext; } err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto out; /* first mark the extent as initialized */ ext4_ext_mark_initialized(ex); /* note: ext4_ext_correct_indexes() isn't needed here because * borders are not changed */ ext4_ext_try_to_merge(handle, inode, path, ex); /* Mark modified extent as dirty */ err = ext4_ext_dirty(handle, inode, path + path->p_depth); out: ext4_ext_show_leaf(inode, path); return err; } ",0 "void ReleaseMailbox(scoped_refptr frame, uint32 sync_point, bool lost_resource) {} ",0 "error::Error GLES2DecoderImpl::HandleGetActiveUniformsiv( uint32_t immediate_data_size, const volatile void* cmd_data) { if (!feature_info_->IsWebGL2OrES3Context()) return error::kUnknownCommand; const volatile gles2::cmds::GetActiveUniformsiv& c = *static_cast(cmd_data); GLuint program_id = c.program; GLenum pname = static_cast(c.pname); Bucket* bucket = GetBucket(c.indices_bucket_id); if (!bucket) { return error::kInvalidArguments; } if (!validators_->uniform_parameter.IsValid(pname)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(""glGetActiveUniformsiv"", pname, ""pname""); return error::kNoError; } GLsizei count = static_cast(bucket->size() / sizeof(GLuint)); const GLuint* indices = bucket->GetDataAs(0, bucket->size()); typedef cmds::GetActiveUniformsiv::Result Result; Result* result = GetSharedMemoryAs( c.params_shm_id, c.params_shm_offset, Result::ComputeSize(count)); GLint* params = result ? result->GetData() : nullptr; if (params == nullptr) { return error::kOutOfBounds; } if (result->size != 0) { return error::kInvalidArguments; } Program* program = GetProgramInfoNotShader( program_id, ""glGetActiveUniformsiv""); if (!program) { return error::kNoError; } GLint activeUniforms = 0; program->GetProgramiv(GL_ACTIVE_UNIFORMS, &activeUniforms); for (int i = 0; i < count; i++) { if (indices[i] >= static_cast(activeUniforms)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, ""glGetActiveUniformsiv"", ""index >= active uniforms""); return error::kNoError; } } GLuint service_id = program->service_id(); GLint link_status = GL_FALSE; api()->glGetProgramivFn(service_id, GL_LINK_STATUS, &link_status); if (link_status != GL_TRUE) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glGetActiveUniformsiv"", ""program not linked""); return error::kNoError; } api()->glGetActiveUniformsivFn(service_id, count, indices, pname, params); result->SetNumResults(count); return error::kNoError; } ",0 "static void parse_sec_attr_44(sc_file_t *file, const u8 *buf, size_t len) { /* OpenSc Operation values for each command operation-type */ const int df_idx[8] = { /* byte 1 = OpenSC type of AC Bit0, byte 2 = OpenSC type of AC Bit1 ...*/ SC_AC_OP_DELETE, SC_AC_OP_CREATE, SC_AC_OP_CREATE, SC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE, SC_AC_OP_LOCK, SC_AC_OP_DELETE, -1}; const int ef_idx[8] = { SC_AC_OP_READ, SC_AC_OP_UPDATE, SC_AC_OP_WRITE, SC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE, -1, SC_AC_OP_ERASE, -1}; const int efi_idx[8] = { /* internal EF used for RSA keys */ SC_AC_OP_READ, SC_AC_OP_ERASE, SC_AC_OP_UPDATE, SC_AC_OP_INVALIDATE, SC_AC_OP_REHABILITATE, -1, SC_AC_OP_ERASE, -1}; u8 bValue; int i; int iKeyRef = 0; int iMethod; int iPinCount; int iOffset = 0; int iOperation; const int* p_idx; /* Check all sub-AC definitions within the total AC */ while (len > 1) { /* minimum length = 2 */ int iACLen = buf[iOffset] & 0x0F; iPinCount = -1; /* default no pin required */ iMethod = SC_AC_NONE; /* default no authentication required */ if (buf[iOffset] & 0X80) { /* AC in adaptive coding */ /* Evaluates only the command-byte, not the optional P1/P2/Option bytes */ int iParmLen = 1; /* command-byte is always present */ int iKeyLen = 0; /* Encryption key is optional */ if (buf[iOffset] & 0x20) iKeyLen++; if (buf[iOffset+1] & 0x40) iParmLen++; if (buf[iOffset+1] & 0x20) iParmLen++; if (buf[iOffset+1] & 0x10) iParmLen++; if (buf[iOffset+1] & 0x08) iParmLen++; /* Get KeyNumber if available */ if(iKeyLen) { int iSC = buf[iOffset+iACLen]; switch( (iSC>>5) & 0x03 ){ case 0: iMethod = SC_AC_TERM; /* key authentication */ break; case 1: iMethod = SC_AC_AUT; /* key authentication */ break; case 2: case 3: iMethod = SC_AC_PRO; /* secure messaging */ break; } iKeyRef = iSC & 0x1F; /* get key number */ } /* Get PinNumber if available */ if (iACLen > (1+iParmLen+iKeyLen)) { /* check via total length if pin is present */ iKeyRef = buf[iOffset+1+1+iParmLen]; /* PTL + AM-header + parameter-bytes */ iMethod = SC_AC_CHV; } /* Convert SETCOS command to OpenSC command group */ switch(buf[iOffset+2]){ case 0x2A: /* crypto operation */ iOperation = SC_AC_OP_CRYPTO; break; case 0x46: /* key-generation operation */ iOperation = SC_AC_OP_UPDATE; break; default: iOperation = SC_AC_OP_SELECT; break; } sc_file_add_acl_entry(file, iOperation, iMethod, iKeyRef); } else { /* AC in simple coding */ /* Initial AC is treated as an operational AC */ /* Get specific Cmd groups for specified file-type */ switch (file->type) { case SC_FILE_TYPE_DF: /* DF */ p_idx = df_idx; break; case SC_FILE_TYPE_INTERNAL_EF: /* EF for RSA keys */ p_idx = efi_idx; break; default: /* EF */ p_idx = ef_idx; break; } /* Encryption key present ? */ iPinCount = iACLen - 1; if (buf[iOffset] & 0x20) { int iSC = buf[iOffset + iACLen]; switch( (iSC>>5) & 0x03 ) { case 0: iMethod = SC_AC_TERM; /* key authentication */ break; case 1: iMethod = SC_AC_AUT; /* key authentication */ break; case 2: case 3: iMethod = SC_AC_PRO; /* secure messaging */ break; } iKeyRef = iSC & 0x1F; /* get key number */ iPinCount--; /* one byte used for keyReference */ } /* Pin present ? */ if ( iPinCount > 0 ) { iKeyRef = buf[iOffset + 2]; /* pin ref */ iMethod = SC_AC_CHV; } /* Add AC for each command-operationType into OpenSc structure */ bValue = buf[iOffset + 1]; for (i = 0; i < 8; i++) { if((bValue & 1) && (p_idx[i] >= 0)) sc_file_add_acl_entry(file, p_idx[i], iMethod, iKeyRef); bValue >>= 1; } } /* Current field treated, get next AC sub-field */ iOffset += iACLen +1; /* AC + PTL-byte */ len -= iACLen +1; } } ",1 "BGD_DECLARE(void) gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) { if (x1 < 0) { x1 = 0; } if (x1 >= im->sx) { x1 = im->sx - 1; } if (x2 < 0) { x2 = 0; } if (x2 >= im->sx) { x2 = im->sx - 1; } if (y1 < 0) { y1 = 0; } if (y1 >= im->sy) { y1 = im->sy - 1; } if (y2 < 0) { y2 = 0; } if (y2 >= im->sy) { y2 = im->sy - 1; } im->cx1 = x1; im->cy1 = y1; im->cx2 = x2; im->cy2 = y2; } ",0 "void ResourceDispatcherHostImpl::UpdateLoadInfo() { std::unique_ptr infos(GetInterestingPerFrameLoadInfos()); DCHECK(!waiting_on_load_state_ack_); waiting_on_load_state_ack_ = true; main_thread_task_runner_->PostTaskAndReply( FROM_HERE, base::BindOnce(UpdateLoadStateOnUI, loader_delegate_, std::move(infos)), base::BindOnce(&ResourceDispatcherHostImpl::AckUpdateLoadInfo, weak_factory_on_io_.GetWeakPtr())); } ",0 "bool TabStrip::IsTabSelected(const Tab* tab) const { int model_index = GetModelIndexOfTab(tab); return IsValidModelIndex(model_index) && controller_->IsTabSelected(model_index); } ",0 "static inline int task_running(struct rq *rq, struct task_struct *p) { #ifdef CONFIG_SMP return p->on_cpu; #else return task_current(rq, p); #endif } ",0 "static long process_cpu_nsleep_restart(struct restart_block *restart_block) { return -EINVAL; } ",0 "void ResourceDispatcherHost::Shutdown() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); ChromeThread::PostTask(ChromeThread::IO, FROM_HERE, new ShutdownTask(this)); } ",0 "handle_pap(netdissect_options *ndo, const u_char *p, int length) { u_int code, len; int peerid_len, passwd_len, msg_len; const u_char *p0; int i; p0 = p; if (length < 1) { ND_PRINT((ndo, ""[|pap]"")); return; } else if (length < 4) { ND_TCHECK(*p); ND_PRINT((ndo, ""[|pap 0x%02x]"", *p)); return; } ND_TCHECK(*p); code = *p; ND_PRINT((ndo, ""PAP, %s (0x%02x)"", tok2str(papcode_values, ""unknown"", code), code)); p++; ND_TCHECK(*p); ND_PRINT((ndo, "", id %u"", *p)); /* ID */ p++; ND_TCHECK2(*p, 2); len = EXTRACT_16BITS(p); p += 2; if ((int)len > length) { ND_PRINT((ndo, "", length %u > packet size"", len)); return; } length = len; if (length < (p - p0)) { ND_PRINT((ndo, "", length %u < PAP header length"", length)); return; } switch (code) { case PAP_AREQ: /* A valid Authenticate-Request is 6 or more octets long. */ if (len < 6) goto trunc; if (length - (p - p0) < 1) return; ND_TCHECK(*p); peerid_len = *p; /* Peer-ID Length */ p++; if (length - (p - p0) < peerid_len) return; ND_PRINT((ndo, "", Peer "")); for (i = 0; i < peerid_len; i++) { ND_TCHECK(*p); safeputchar(ndo, *p++); } if (length - (p - p0) < 1) return; ND_TCHECK(*p); passwd_len = *p; /* Password Length */ p++; if (length - (p - p0) < passwd_len) return; ND_PRINT((ndo, "", Name "")); for (i = 0; i < passwd_len; i++) { ND_TCHECK(*p); safeputchar(ndo, *p++); } break; case PAP_AACK: case PAP_ANAK: /* Although some implementations ignore truncation at * this point and at least one generates a truncated * packet, RFC 1334 section 2.2.2 clearly states that * both AACK and ANAK are at least 5 bytes long. */ if (len < 5) goto trunc; if (length - (p - p0) < 1) return; ND_TCHECK(*p); msg_len = *p; /* Msg-Length */ p++; if (length - (p - p0) < msg_len) return; ND_PRINT((ndo, "", Msg "")); for (i = 0; i< msg_len; i++) { ND_TCHECK(*p); safeputchar(ndo, *p++); } break; } return; trunc: ND_PRINT((ndo, ""[|pap]"")); } ",0 "static int64_t mxf_compute_sample_count(MXFContext *mxf, AVStream *st, int64_t edit_unit) { int i, total = 0, size = 0; MXFTrack *track = st->priv_data; AVRational time_base = av_inv_q(track->edit_rate); AVRational sample_rate = av_inv_q(st->time_base); const MXFSamplesPerFrame *spf = NULL; int64_t sample_count; if (st->codecpar->codec_type != AVMEDIA_TYPE_AUDIO) return edit_unit; if ((sample_rate.num / sample_rate.den) == 48000) spf = ff_mxf_get_samples_per_frame(mxf->fc, time_base); if (!spf) { int remainder = (sample_rate.num * time_base.num) % (time_base.den * sample_rate.den); if (remainder) av_log(mxf->fc, AV_LOG_WARNING, ""seeking detected on stream #%d with time base (%d/%d) and "" ""sample rate (%d/%d), audio pts won't be accurate.\n"", st->index, time_base.num, time_base.den, sample_rate.num, sample_rate.den); return av_rescale_q(edit_unit, sample_rate, track->edit_rate); } while (spf->samples_per_frame[size]) { total += spf->samples_per_frame[size]; size++; } av_assert2(size); sample_count = (edit_unit / size) * (uint64_t)total; for (i = 0; i < edit_unit % size; i++) { sample_count += spf->samples_per_frame[i]; } return sample_count; } ",0 "static bool tg3_phy_copper_an_config_ok(struct tg3 *tp, u32 *lcladv) { u32 advmsk, tgtadv, advertising; advertising = tp->link_config.advertising; tgtadv = ethtool_adv_to_mii_adv_t(advertising) & ADVERTISE_ALL; advmsk = ADVERTISE_ALL; if (tp->link_config.active_duplex == DUPLEX_FULL) { tgtadv |= mii_advertise_flowctrl(tp->link_config.flowctrl); advmsk |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM; } if (tg3_readphy(tp, MII_ADVERTISE, lcladv)) return false; if ((*lcladv & advmsk) != tgtadv) return false; if (!(tp->phy_flags & TG3_PHYFLG_10_100_ONLY)) { u32 tg3_ctrl; tgtadv = ethtool_adv_to_mii_ctrl1000_t(advertising); if (tg3_readphy(tp, MII_CTRL1000, &tg3_ctrl)) return false; if (tgtadv && (tg3_chip_rev_id(tp) == CHIPREV_ID_5701_A0 || tg3_chip_rev_id(tp) == CHIPREV_ID_5701_B0)) { tgtadv |= CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER; tg3_ctrl &= (ADVERTISE_1000HALF | ADVERTISE_1000FULL | CTL1000_AS_MASTER | CTL1000_ENABLE_MASTER); } else { tg3_ctrl &= (ADVERTISE_1000HALF | ADVERTISE_1000FULL); } if (tg3_ctrl != tgtadv) return false; } return true; } ",0 "void LayerTreeHost::SetEventListenerProperties( EventListenerClass event_class, EventListenerProperties properties) { const size_t index = static_cast(event_class); if (event_listener_properties_[index] == properties) return; event_listener_properties_[index] = properties; SetNeedsCommit(); } ",0 "exsltCryptoSha1Function (xmlXPathParserContextPtr ctxt, int nargs) { int str_len = 0; xmlChar *str = NULL, *ret = NULL; unsigned char hash[HASH_DIGEST_LENGTH]; unsigned char hex[SHA1_DIGEST_LENGTH * 2 + 1]; str_len = exsltCryptoPopString (ctxt, nargs, &str); if (str_len == 0) { xmlXPathReturnEmptyString (ctxt); xmlFree (str); return; } PLATFORM_HASH (ctxt, PLATFORM_SHA1, (const char *) str, str_len, (char *) hash); exsltCryptoBin2Hex (hash, sizeof (hash) - 1, hex, sizeof (hex) - 1); ret = xmlStrdup ((xmlChar *) hex); xmlXPathReturnString (ctxt, ret); if (str != NULL) xmlFree (str); } ",0 "void Document::scheduleLayoutTreeUpdate() { ASSERT(!hasPendingStyleRecalc()); ASSERT(shouldScheduleLayoutTreeUpdate()); ASSERT(needsLayoutTreeUpdate()); if (!view()->shouldThrottleRendering()) page()->animator().scheduleVisualUpdate(frame()); m_lifecycle.ensureStateAtMost(DocumentLifecycle::VisualUpdatePending); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT(""devtools.timeline""), ""ScheduleStyleRecalculation"", TRACE_EVENT_SCOPE_THREAD, ""data"", InspectorRecalculateStylesEvent::data(frame())); InspectorInstrumentation::didScheduleStyleRecalculation(this); ++m_styleVersion; } ",0 "int PKCS7_set_attributes(PKCS7_SIGNER_INFO *p7si, STACK_OF(X509_ATTRIBUTE) *sk) { int i; sk_X509_ATTRIBUTE_pop_free(p7si->unauth_attr, X509_ATTRIBUTE_free); p7si->unauth_attr = sk_X509_ATTRIBUTE_dup(sk); if (p7si->unauth_attr == NULL) return 0; for (i = 0; i < sk_X509_ATTRIBUTE_num(sk); i++) { if ((sk_X509_ATTRIBUTE_set(p7si->unauth_attr, i, X509_ATTRIBUTE_dup(sk_X509_ATTRIBUTE_value (sk, i)))) == NULL) return (0); } return (1); } ",0 "FileTransfer::AddDownloadFilenameRemaps(char const *remaps) { if(!download_filename_remaps.IsEmpty()) { download_filename_remaps += "";""; } download_filename_remaps += remaps; } ",0 "static void S_AL_BufferUseDefault(sfxHandle_t sfx) { if(sfx == default_sfx) Com_Error(ERR_FATAL, ""Can't load default sound effect %s"", knownSfx[sfx].filename); Com_Printf( S_COLOR_YELLOW ""WARNING: Using default sound for %s\n"", knownSfx[sfx].filename); knownSfx[sfx].isDefault = qtrue; knownSfx[sfx].buffer = knownSfx[default_sfx].buffer; } ",0 "nfsd4_get_delegreturnstateid(struct nfsd4_compound_state *cstate, struct nfsd4_delegreturn *drp) { get_stateid(cstate, &drp->dr_stateid); } ",0 "static void serializedValueMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""serializedValue"", ""TestObject"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); RefPtr serializedArg = SerializedScriptValue::create(info[0], 0, 0, exceptionState, info.GetIsolate()); if (exceptionState.throwIfNeeded()) return; imp->serializedValue(serializedArg); } ",0 "QuicErrorCode QuicStreamSequencerBuffer::Readv(const iovec* dest_iov, size_t dest_count, size_t* bytes_read, string* error_details) { CHECK_EQ(destruction_indicator_, 123456) << ""This object has been destructed""; *bytes_read = 0; for (size_t i = 0; i < dest_count && ReadableBytes() > 0; ++i) { char* dest = reinterpret_cast(dest_iov[i].iov_base); CHECK_NE(dest, nullptr); size_t dest_remaining = dest_iov[i].iov_len; while (dest_remaining > 0 && ReadableBytes() > 0) { size_t block_idx = NextBlockToRead(); size_t start_offset_in_block = ReadOffset(); size_t block_capacity = GetBlockCapacity(block_idx); size_t bytes_available_in_block = std::min( ReadableBytes(), block_capacity - start_offset_in_block); size_t bytes_to_copy = std::min(bytes_available_in_block, dest_remaining); DCHECK_GT(bytes_to_copy, 0UL); if (blocks_[block_idx] == nullptr || dest == nullptr) { *error_details = QuicStrCat( ""QuicStreamSequencerBuffer error:"" "" Readv() dest == nullptr: "", (dest == nullptr), "" blocks_["", block_idx, ""] == nullptr: "", (blocks_[block_idx] == nullptr), "" Gaps: "", GapsDebugString(), "" Remaining frames: "", ReceivedFramesDebugString(), "" total_bytes_read_ = "", total_bytes_read_); return QUIC_STREAM_SEQUENCER_INVALID_STATE; } memcpy(dest, blocks_[block_idx]->buffer + start_offset_in_block, bytes_to_copy); dest += bytes_to_copy; dest_remaining -= bytes_to_copy; num_bytes_buffered_ -= bytes_to_copy; total_bytes_read_ += bytes_to_copy; *bytes_read += bytes_to_copy; if (bytes_to_copy == bytes_available_in_block) { bool retire_successfully = RetireBlockIfEmpty(block_idx); if (!retire_successfully) { *error_details = QuicStrCat( ""QuicStreamSequencerBuffer error: fail to retire block "", block_idx, "" as the block is already released, total_bytes_read_ = "", total_bytes_read_, "" Gaps: "", GapsDebugString()); return QUIC_STREAM_SEQUENCER_INVALID_STATE; } } } } if (*bytes_read > 0) { UpdateFrameArrivalMap(total_bytes_read_); } return QUIC_NO_ERROR; } ",0 "void DevToolsWindow::DoAction() { UpdateFrontendDockSide(); switch (action_on_load_.type()) { case DevToolsToggleAction::kShowConsole: CallClientFunction(""InspectorFrontendAPI.showConsole"", NULL, NULL, NULL); break; case DevToolsToggleAction::kInspect: CallClientFunction(""InspectorFrontendAPI.enterInspectElementMode"", NULL, NULL, NULL); break; case DevToolsToggleAction::kShow: case DevToolsToggleAction::kToggle: break; case DevToolsToggleAction::kReveal: { const DevToolsToggleAction::RevealParams* params = action_on_load_.params(); CHECK(params); base::StringValue url_value(params->url); base::FundamentalValue line_value(static_cast(params->line_number)); base::FundamentalValue column_value( static_cast(params->column_number)); CallClientFunction(""InspectorFrontendAPI.revealSourceLine"", &url_value, &line_value, &column_value); break; } default: NOTREACHED(); break; } action_on_load_ = DevToolsToggleAction::Show(); } ",0 "int effect_process(effect_handle_t self, audio_buffer_t *inBuffer __unused, audio_buffer_t *outBuffer __unused) { effect_context_t * context = (effect_context_t *)self; int status = 0; ALOGW(""%s Called ?????"", __func__); pthread_mutex_lock(&lock); if (!effect_exists(context)) { status = -ENOSYS; goto exit; } if (context->state != EFFECT_STATE_ACTIVE) { status = -ENODATA; goto exit; } exit: pthread_mutex_unlock(&lock); return status; } ",0 "static void cswitch(JF, js_Ast *ref, js_Ast *head) { js_Ast *node, *clause, *def = NULL; int end; cexp(J, F, ref); /* emit an if-else chain of tests for the case clause expressions */ for (node = head; node; node = node->b) { clause = node->a; if (clause->type == STM_DEFAULT) { if (def) jsC_error(J, clause, ""more than one default label in switch""); def = clause; } else { cexp(J, F, clause->a); clause->casejump = emitjump(J, F, OP_JCASE); } } emit(J, F, OP_POP); if (def) { def->casejump = emitjump(J, F, OP_JUMP); end = 0; } else { end = emitjump(J, F, OP_JUMP); } /* emit the casue clause bodies */ for (node = head; node; node = node->b) { clause = node->a; label(J, F, clause->casejump); if (clause->type == STM_DEFAULT) cstmlist(J, F, clause->a); else cstmlist(J, F, clause->b); } if (end) label(J, F, end); } ",0 " ftc_snode_load( FTC_SNode snode, FTC_Manager manager, FT_UInt gindex, FT_ULong *asize ) { FT_Error error; FTC_GNode gnode = FTC_GNODE( snode ); FTC_Family family = gnode->family; FT_Memory memory = manager->memory; FT_Face face; FTC_SBit sbit; FTC_SFamilyClass clazz; if ( (FT_UInt)(gindex - gnode->gindex) >= snode->count ) { FT_ERROR(( ""ftc_snode_load: invalid glyph index"" )); return FT_THROW( Invalid_Argument ); } sbit = snode->sbits + ( gindex - gnode->gindex ); clazz = (FTC_SFamilyClass)family->clazz; sbit->buffer = 0; error = clazz->family_load_glyph( family, gindex, manager, &face ); if ( error ) goto BadGlyph; { FT_Int temp; FT_GlyphSlot slot = face->glyph; FT_Bitmap* bitmap = &slot->bitmap; FT_Pos xadvance, yadvance; /* FT_GlyphSlot->advance.{x|y} */ if ( slot->format != FT_GLYPH_FORMAT_BITMAP ) { FT_TRACE0(( ""ftc_snode_load:"" "" glyph loaded didn't return a bitmap\n"" )); goto BadGlyph; } /* Check that our values fit into 8-bit containers! */ /* If this is not the case, our bitmap is too large */ /* and we will leave it as `missing' with sbit.buffer = 0 */ #define CHECK_CHAR( d ) ( temp = (FT_Char)d, temp == d ) #define CHECK_BYTE( d ) ( temp = (FT_Byte)d, temp == d ) /* horizontal advance in pixels */ xadvance = ( slot->advance.x + 32 ) >> 6; yadvance = ( slot->advance.y + 32 ) >> 6; if ( !CHECK_BYTE( bitmap->rows ) || !CHECK_BYTE( bitmap->width ) || !CHECK_CHAR( bitmap->pitch ) || !CHECK_CHAR( slot->bitmap_left ) || !CHECK_CHAR( slot->bitmap_top ) || !CHECK_CHAR( xadvance ) || !CHECK_CHAR( yadvance ) ) { FT_TRACE2(( ""ftc_snode_load:"" "" glyph too large for small bitmap cache\n"")); goto BadGlyph; } sbit->width = (FT_Byte)bitmap->width; sbit->height = (FT_Byte)bitmap->rows; sbit->pitch = (FT_Char)bitmap->pitch; sbit->left = (FT_Char)slot->bitmap_left; sbit->top = (FT_Char)slot->bitmap_top; sbit->xadvance = (FT_Char)xadvance; sbit->yadvance = (FT_Char)yadvance; sbit->format = (FT_Byte)bitmap->pixel_mode; sbit->max_grays = (FT_Byte)(bitmap->num_grays - 1); /* copy the bitmap into a new buffer -- ignore error */ error = ftc_sbit_copy_bitmap( sbit, bitmap, memory ); /* now, compute size */ if ( asize ) *asize = FT_ABS( sbit->pitch ) * sbit->height; } /* glyph loading successful */ /* ignore the errors that might have occurred -- */ /* we mark unloaded glyphs with `sbit.buffer == 0' */ /* and `width == 255', `height == 0' */ /* */ if ( error && FT_ERR_NEQ( error, Out_Of_Memory ) ) { BadGlyph: sbit->width = 255; sbit->height = 0; sbit->buffer = NULL; error = FT_Err_Ok; if ( asize ) *asize = 0; } return error; } ",1 "static void conn_reset_postponed_data(struct connectdata *conn, int num) { struct postponed_data * const psnd = &(conn->postponed[num]); if(psnd->buffer) { DEBUGASSERT(psnd->allocated_size > 0); DEBUGASSERT(psnd->recv_size <= psnd->allocated_size); DEBUGASSERT(psnd->recv_size ? (psnd->recv_processed < psnd->recv_size) : (psnd->recv_processed == 0)); DEBUGASSERT(psnd->bindsock != CURL_SOCKET_BAD); free(psnd->buffer); psnd->buffer = NULL; psnd->allocated_size = 0; psnd->recv_size = 0; psnd->recv_processed = 0; #ifdef DEBUGBUILD psnd->bindsock = CURL_SOCKET_BAD; /* used only for DEBUGASSERT */ #endif /* DEBUGBUILD */ } else { DEBUGASSERT(psnd->allocated_size == 0); DEBUGASSERT(psnd->recv_size == 0); DEBUGASSERT(psnd->recv_processed == 0); DEBUGASSERT(psnd->bindsock == CURL_SOCKET_BAD); } } ",0 "std::unique_ptr HandlePrefixedRequest( const std::string& prefix, const EmbeddedTestServer::HandleRequestCallback& handler, const HttpRequest& request) { if (ShouldHandle(request, prefix)) return handler.Run(request); return nullptr; } ",0 "SYSCALL_DEFINE6(mbind, unsigned long, start, unsigned long, len, unsigned long, mode, const unsigned long __user *, nmask, unsigned long, maxnode, unsigned, flags) { nodemask_t nodes; int err; unsigned short mode_flags; mode_flags = mode & MPOL_MODE_FLAGS; mode &= ~MPOL_MODE_FLAGS; if (mode >= MPOL_MAX) return -EINVAL; if ((mode_flags & MPOL_F_STATIC_NODES) && (mode_flags & MPOL_F_RELATIVE_NODES)) return -EINVAL; err = get_nodes(&nodes, nmask, maxnode); if (err) return err; return do_mbind(start, len, mode, mode_flags, &nodes, flags); } ",0 "static int aes_ocb_ctrl(EVP_CIPHER_CTX *c, int type, int arg, void *ptr) { EVP_AES_OCB_CTX *octx = EVP_C_DATA(EVP_AES_OCB_CTX,c); EVP_CIPHER_CTX *newc; EVP_AES_OCB_CTX *new_octx; switch (type) { case EVP_CTRL_INIT: octx->key_set = 0; octx->iv_set = 0; octx->ivlen = EVP_CIPHER_CTX_iv_length(c); octx->iv = EVP_CIPHER_CTX_iv_noconst(c); octx->taglen = 16; octx->data_buf_len = 0; octx->aad_buf_len = 0; return 1; case EVP_CTRL_AEAD_SET_IVLEN: /* IV len must be 1 to 15 */ if (arg <= 0 || arg > 15) return 0; octx->ivlen = arg; return 1; case EVP_CTRL_AEAD_SET_TAG: if (!ptr) { /* Tag len must be 0 to 16 */ if (arg < 0 || arg > 16) return 0; octx->taglen = arg; return 1; } if (arg != octx->taglen || EVP_CIPHER_CTX_encrypting(c)) return 0; memcpy(octx->tag, ptr, arg); return 1; case EVP_CTRL_AEAD_GET_TAG: if (arg != octx->taglen || !EVP_CIPHER_CTX_encrypting(c)) return 0; memcpy(ptr, octx->tag, arg); return 1; case EVP_CTRL_COPY: newc = (EVP_CIPHER_CTX *)ptr; new_octx = EVP_C_DATA(EVP_AES_OCB_CTX,newc); return CRYPTO_ocb128_copy_ctx(&new_octx->ocb, &octx->ocb, &new_octx->ksenc.ks, &new_octx->ksdec.ks); default: return -1; } } ",0 "static void snd_usbmidi_ftdi_input(struct snd_usb_midi_in_endpoint *ep, uint8_t *buffer, int buffer_length) { if (buffer_length > 2) snd_usbmidi_input_data(ep, 0, buffer + 2, buffer_length - 2); } ",0 " WebContentsImpl::GetRootBrowserAccessibilityManager() { RenderFrameHostImpl* rfh = GetMainFrame(); return rfh ? rfh->browser_accessibility_manager() : nullptr; } ",0 "BGD_DECLARE(void) gdImageChar (gdImagePtr im, gdFontPtr f, int x, int y, int c, int color) { int cx, cy; int px, py; int fline; cx = 0; cy = 0; #ifdef CHARSET_EBCDIC c = ASC (c); #endif /*CHARSET_EBCDIC */ if ((c < f->offset) || (c >= (f->offset + f->nchars))) { return; } fline = (c - f->offset) * f->h * f->w; for (py = y; (py < (y + f->h)); py++) { for (px = x; (px < (x + f->w)); px++) { if (f->data[fline + cy * f->w + cx]) { gdImageSetPixel (im, px, py, color); } cx++; } cx = 0; cy++; } } ",0 "void CStarter::FinalCleanup() { RemoveRecoveryFile(); removeTempExecuteDir(); } ",0 "int CRYPTO_THREAD_run_once(CRYPTO_ONCE *once, void (*init)(void)) { if (*once != 0) return 1; init(); *once = 1; return 1; } ",0 "GF_Err mhac_Size(GF_Box *s) { GF_MHAConfigBox *ptr = (GF_MHAConfigBox *) s; s->size += 5; if (ptr->mha_config_size && ptr->mha_config) s->size += ptr->mha_config_size; return GF_OK; } ",0 "void FrameLoaderClient::dispatchDidFailLoading(WebCore::DocumentLoader* loader, unsigned long identifier, const ResourceError& error) { static_cast(loader)->decreaseLoadCount(identifier); notImplemented(); } ",0 "gsicc_get_srcprofile(gsicc_colorbuffer_t data_cs, gs_graphics_type_tag_t graphics_type_tag, cmm_srcgtag_profile_t *srcgtag_profile, cmm_profile_t **profile, gsicc_rendering_param_t *render_cond) { (*profile) = NULL; (*render_cond).rendering_intent = gsPERCEPTUAL; switch (graphics_type_tag & ~GS_DEVICE_ENCODES_TAGS) { case GS_UNKNOWN_TAG: case GS_UNTOUCHED_TAG: default: break; case GS_PATH_TAG: if (data_cs == gsRGB) { (*profile) = srcgtag_profile->rgb_profiles[gsSRC_GRAPPRO]; *render_cond = srcgtag_profile->rgb_rend_cond[gsSRC_GRAPPRO]; } else if (data_cs == gsCMYK) { (*profile) = srcgtag_profile->cmyk_profiles[gsSRC_GRAPPRO]; *render_cond = srcgtag_profile->cmyk_rend_cond[gsSRC_GRAPPRO]; } else if (data_cs == gsGRAY) { (*profile) = srcgtag_profile->gray_profiles[gsSRC_GRAPPRO]; *render_cond = srcgtag_profile->gray_rend_cond[gsSRC_GRAPPRO]; } break; case GS_IMAGE_TAG: if (data_cs == gsRGB) { (*profile) = srcgtag_profile->rgb_profiles[gsSRC_IMAGPRO]; *render_cond = srcgtag_profile->rgb_rend_cond[gsSRC_IMAGPRO]; } else if (data_cs == gsCMYK) { (*profile) = srcgtag_profile->cmyk_profiles[gsSRC_IMAGPRO]; *render_cond = srcgtag_profile->cmyk_rend_cond[gsSRC_IMAGPRO]; } else if (data_cs == gsGRAY) { (*profile) = srcgtag_profile->gray_profiles[gsSRC_IMAGPRO]; *render_cond = srcgtag_profile->gray_rend_cond[gsSRC_IMAGPRO]; } break; case GS_TEXT_TAG: if (data_cs == gsRGB) { (*profile) = srcgtag_profile->rgb_profiles[gsSRC_TEXTPRO]; *render_cond = srcgtag_profile->rgb_rend_cond[gsSRC_TEXTPRO]; } else if (data_cs == gsCMYK) { (*profile) = srcgtag_profile->cmyk_profiles[gsSRC_TEXTPRO]; *render_cond = srcgtag_profile->cmyk_rend_cond[gsSRC_TEXTPRO]; } else if (data_cs == gsGRAY) { (*profile) = srcgtag_profile->gray_profiles[gsSRC_TEXTPRO]; *render_cond = srcgtag_profile->gray_rend_cond[gsSRC_TEXTPRO]; } break; } } ",0 "void AutocompleteController::OnProviderUpdate(bool updated_matches) { CheckIfDone(); if (!in_start_ && (updated_matches || done_)) UpdateResult(false); } ",0 "get_time_t_min(void) { #if defined(TIME_T_MIN) return TIME_T_MIN; #else if (((time_t)0) < ((time_t)-1)) { /* Time_t is unsigned */ return (time_t)0; } else { /* Time_t is signed. */ if (sizeof(time_t) == sizeof(int64_t)) { return (time_t)INT64_MIN; } else { return (time_t)INT32_MIN; } } #endif } ",0 "static size_t QuantizeErrorFlatten(const CubeInfo *cube_info, const NodeInfo *node_info,const ssize_t offset, MagickRealType *quantize_error) { register ssize_t i; size_t n, number_children; if (offset >= (ssize_t) cube_info->nodes) return(0); quantize_error[offset]=node_info->quantize_error; n=1; number_children=cube_info->associate_alpha == MagickFalse ? 8UL : 16UL; for (i=0; i < (ssize_t) number_children ; i++) if (node_info->child[i] != (NodeInfo *) NULL) n+=QuantizeErrorFlatten(cube_info,node_info->child[i],offset+n, quantize_error); return(n); } ",0 "cmsPipeline* BlackPreservingKOnlyIntents(cmsContext ContextID, cmsUInt32Number nProfiles, cmsUInt32Number TheIntents[], cmsHPROFILE hProfiles[], cmsBool BPC[], cmsFloat64Number AdaptationStates[], cmsUInt32Number dwFlags) { GrayOnlyParams bp; cmsPipeline* Result; cmsUInt32Number ICCIntents[256]; cmsStage* CLUT; cmsUInt32Number i, nGridPoints; if (nProfiles < 1 || nProfiles > 255) return NULL; for (i=0; i < nProfiles; i++) ICCIntents[i] = TranslateNonICCIntents(TheIntents[i]); if (cmsGetColorSpace(hProfiles[0]) != cmsSigCmykData || cmsGetColorSpace(hProfiles[nProfiles-1]) != cmsSigCmykData) return DefaultICCintents(ContextID, nProfiles, ICCIntents, hProfiles, BPC, AdaptationStates, dwFlags); memset(&bp, 0, sizeof(bp)); Result = cmsPipelineAlloc(ContextID, 4, 4); if (Result == NULL) return NULL; bp.cmyk2cmyk = DefaultICCintents(ContextID, nProfiles, ICCIntents, hProfiles, BPC, AdaptationStates, dwFlags); if (bp.cmyk2cmyk == NULL) goto Error; bp.KTone = _cmsBuildKToneCurve(ContextID, 4096, nProfiles, ICCIntents, hProfiles, BPC, AdaptationStates, dwFlags); if (bp.KTone == NULL) goto Error; nGridPoints = _cmsReasonableGridpointsByColorspace(cmsSigCmykData, dwFlags); CLUT = cmsStageAllocCLut16bit(ContextID, nGridPoints, 4, 4, NULL); if (CLUT == NULL) goto Error; if (!cmsPipelineInsertStage(Result, cmsAT_BEGIN, CLUT)) goto Error; if (!cmsStageSampleCLut16bit(CLUT, BlackPreservingGrayOnlySampler, (void*) &bp, 0)) goto Error; cmsPipelineFree(bp.cmyk2cmyk); cmsFreeToneCurve(bp.KTone); return Result; Error: if (bp.cmyk2cmyk != NULL) cmsPipelineFree(bp.cmyk2cmyk); if (bp.KTone != NULL) cmsFreeToneCurve(bp.KTone); if (Result != NULL) cmsPipelineFree(Result); return NULL; } ",0 "void HTMLInputElement::setChecked(bool nowChecked, TextFieldEventBehavior eventBehavior) { if (checked() == nowChecked) return; m_reflectsCheckedAttribute = false; m_isChecked = nowChecked; setNeedsStyleRecalc(); if (CheckedRadioButtons* buttons = checkedRadioButtons()) buttons->updateCheckedState(this); if (renderer() && renderer()->style()->hasAppearance()) RenderTheme::theme().stateChanged(renderer(), CheckedState); setNeedsValidityCheck(); if (renderer()) { if (AXObjectCache* cache = renderer()->document().existingAXObjectCache()) cache->checkedStateChanged(this); } if (eventBehavior != DispatchNoEvent && inDocument() && m_inputType->shouldSendChangeEventAfterCheckedChanged()) { setTextAsOfLastFormControlChangeEvent(String()); dispatchFormControlChangeEvent(); } didAffectSelector(AffectedSelectorChecked); } ",0 "void CheckContentEncodingMatching(SpdySessionDependencies* session_deps, const std::string& accept_encoding, const std::string& content_encoding, const std::string& location, bool should_match) { HttpRequestInfo request; request.method = ""GET""; request.url = GURL(""http://www.foo.com/""); request.extra_headers.SetHeader(HttpRequestHeaders::kAcceptEncoding, accept_encoding); request.traffic_annotation = net::MutableNetworkTrafficAnnotationTag(TRAFFIC_ANNOTATION_FOR_TESTS); std::unique_ptr session(CreateSession(session_deps)); HttpNetworkTransaction trans(DEFAULT_PRIORITY, session.get()); MockWrite data_writes[] = { MockWrite(""GET / HTTP/1.1\r\n"" ""Host: www.foo.com\r\n"" ""Connection: keep-alive\r\n"" ""Accept-Encoding: ""), MockWrite(accept_encoding.data()), MockWrite(""\r\n\r\n""), }; std::string response_code = ""200 OK""; std::string extra; if (!location.empty()) { response_code = ""301 Redirect\r\nLocation: ""; response_code.append(location); } MockRead data_reads[] = { MockRead(""HTTP/1.0 ""), MockRead(response_code.data()), MockRead(""\r\nContent-Encoding: ""), MockRead(content_encoding.data()), MockRead(""\r\n\r\n""), MockRead(SYNCHRONOUS, OK), }; StaticSocketDataProvider data(data_reads, data_writes); session_deps->socket_factory->AddSocketDataProvider(&data); TestCompletionCallback callback; int rv = trans.Start(&request, callback.callback(), NetLogWithSource()); EXPECT_THAT(rv, IsError(ERR_IO_PENDING)); rv = callback.WaitForResult(); if (should_match) { EXPECT_THAT(rv, IsOk()); } else { EXPECT_THAT(rv, IsError(ERR_CONTENT_DECODING_FAILED)); } } ",0 "mojom::StoragePartitionService* RenderThreadImpl::GetStoragePartitionService() { return storage_partition_service_.get(); } ",0 " TestURLRequestContextWithDataReductionProxy(const net::ProxyServer& origin, net::NetworkDelegate* delegate) : net::TestURLRequestContext(true) { context_storage_.set_proxy_resolution_service( net::ProxyResolutionService::CreateFixed(origin.ToURI(), TRAFFIC_ANNOTATION_FOR_TESTS)); set_network_delegate(delegate); } ",0 "void Document::setWindowAttributeEventListener(const AtomicString& eventType, EventListener* listener) { LocalDOMWindow* domWindow = this->domWindow(); if (!domWindow) return; domWindow->setAttributeEventListener(eventType, listener); } ",0 "int WebPluginDelegateProxy::GetProcessId() { return channel_host_->peer_pid(); } ",0 "static inline void free_signal_struct(struct signal_struct *sig) { taskstats_tgid_free(sig); sched_autogroup_exit(sig); /* * __mmdrop is not safe to call from softirq context on x86 due to * pgd_dtor so postpone it to the async context */ if (sig->oom_mm) mmdrop_async(sig->oom_mm); kmem_cache_free(signal_cachep, sig); } ",0 "__nvme_fc_parse_u64(substring_t *sstr, u64 *val) { u64 token64; if (match_u64(sstr, &token64)) return -EINVAL; *val = token64; return 0; } ",0 "void RenderFrameImpl::didCommitProvisionalLoad( blink::WebLocalFrame* frame, const blink::WebHistoryItem& item, blink::WebHistoryCommitType commit_type) { DCHECK(!frame_ || frame_ == frame); DocumentState* document_state = DocumentState::FromDataSource(frame->dataSource()); NavigationState* navigation_state = document_state->navigation_state(); render_view_->history_controller()->UpdateForCommit(this, item, commit_type, navigation_state->was_within_same_page()); InternalDocumentStateData* internal_data = InternalDocumentStateData::FromDocumentState(document_state); if (document_state->commit_load_time().is_null()) document_state->set_commit_load_time(Time::Now()); if (internal_data->must_reset_scroll_and_scale_state()) { render_view_->webview()->resetScrollAndScaleState(); internal_data->set_must_reset_scroll_and_scale_state(false); } internal_data->set_use_error_page(false); bool is_new_navigation = commit_type == blink::WebStandardCommit; if (is_new_navigation) { render_view_->UpdateSessionHistory(frame); render_view_->page_id_ = render_view_->next_page_id_++; if (render_view_->GetLoadingUrl(frame) != GURL(kSwappedOutURL)) { render_view_->history_list_offset_++; if (render_view_->history_list_offset_ >= kMaxSessionHistoryEntries) render_view_->history_list_offset_ = kMaxSessionHistoryEntries - 1; render_view_->history_list_length_ = render_view_->history_list_offset_ + 1; render_view_->history_page_ids_.resize( render_view_->history_list_length_, -1); render_view_->history_page_ids_[render_view_->history_list_offset_] = render_view_->page_id_; } } else { if (navigation_state->pending_page_id() != -1 && navigation_state->pending_page_id() != render_view_->page_id_ && !navigation_state->request_committed()) { render_view_->UpdateSessionHistory(frame); render_view_->page_id_ = navigation_state->pending_page_id(); render_view_->history_list_offset_ = navigation_state->pending_history_list_offset(); DCHECK(render_view_->history_list_length_ <= 0 || render_view_->history_list_offset_ < 0 || render_view_->history_list_offset_ >= render_view_->history_list_length_ || render_view_->history_page_ids_[render_view_->history_list_offset_] == render_view_->page_id_); } } render_view_->FrameDidCommitProvisionalLoad(frame, is_new_navigation); FOR_EACH_OBSERVER(RenderFrameObserver, observers_, DidCommitProvisionalLoad(is_new_navigation)); navigation_state->set_request_committed(true); UpdateURL(frame); render_view_->UpdateEncoding(frame, frame->view()->pageEncoding().utf8()); } ",0 " GLES2DecoderRGBBackbufferTest() { } ",0 "bool RenderFrameImpl::Send(IPC::Message* message) { if (is_detaching_) { delete message; return false; } if (is_swapped_out_) { if (!SwappedOutMessages::CanSendWhileSwappedOut(message)) { delete message; return false; } } return RenderThread::Get()->Send(message); } ",0 "WebMediaPlayer::TrackId HTMLMediaElement::addVideoTrack( const WebString& id, WebMediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) { AtomicString kindString = VideoKindToString(kind); BLINK_MEDIA_LOG << ""addVideoTrack("" << (void*)this << "", '"" << (String)id << ""', '"" << (AtomicString)kindString << ""', '"" << (String)label << ""', '"" << (String)language << ""', "" << boolString(selected) << "")""; if (selected && videoTracks().selectedIndex() != -1) selected = false; VideoTrack* videoTrack = VideoTrack::create(id, kindString, label, language, selected); videoTracks().add(videoTrack); return videoTrack->id(); } ",0 "ofputil_protocols_to_version_bitmap(enum ofputil_protocol protocols) { uint32_t bitmap = 0; for (; protocols; protocols = zero_rightmost_1bit(protocols)) { enum ofputil_protocol protocol = rightmost_1bit(protocols); bitmap |= 1u << ofputil_protocol_to_ofp_version(protocol); } return bitmap; } ",0 " CompositedLayerRasterInvalidatorTest& Properties( const TransformPaintPropertyNode* t, const ClipPaintPropertyNode* c = ClipPaintPropertyNode::Root(), const EffectPaintPropertyNode* e = EffectPaintPropertyNode::Root()) { auto& state = data_.chunks.back().properties; state.SetTransform(t); state.SetClip(c); state.SetEffect(e); return *this; } ",1 "void RenderViewImpl::DidChangeFocusForWidget() { if (BrowserPluginManager::Get()) BrowserPluginManager::Get()->UpdateFocusState(); } ",0 "static int big_key_crypt(enum big_key_op op, u8 *data, size_t datalen, u8 *key) { int ret; struct scatterlist sgio; struct aead_request *aead_req; /* We always use a zero nonce. The reason we can get away with this is * because we're using a different randomly generated key for every * different encryption. Notably, too, key_type_big_key doesn't define * an .update function, so there's no chance we'll wind up reusing the * key to encrypt updated data. Simply put: one key, one encryption. */ u8 zero_nonce[crypto_aead_ivsize(big_key_aead)]; aead_req = aead_request_alloc(big_key_aead, GFP_KERNEL); if (!aead_req) return -ENOMEM; memset(zero_nonce, 0, sizeof(zero_nonce)); sg_init_one(&sgio, data, datalen + (op == BIG_KEY_ENC ? ENC_AUTHTAG_SIZE : 0)); aead_request_set_crypt(aead_req, &sgio, &sgio, datalen, zero_nonce); aead_request_set_callback(aead_req, CRYPTO_TFM_REQ_MAY_SLEEP, NULL, NULL); aead_request_set_ad(aead_req, 0); mutex_lock(&big_key_aead_lock); if (crypto_aead_setkey(big_key_aead, key, ENC_KEY_SIZE)) { ret = -EAGAIN; goto error; } if (op == BIG_KEY_ENC) ret = crypto_aead_encrypt(aead_req); else ret = crypto_aead_decrypt(aead_req); error: mutex_unlock(&big_key_aead_lock); aead_request_free(aead_req); return ret; } ",0 "std::unique_ptr NavigationState::CreateContentInitiated() { return base::WrapUnique(new NavigationState( CommonNavigationParams(), CommitNavigationParams(), base::TimeTicks(), true, content::mojom::FrameNavigationControl::CommitNavigationCallback(), content::mojom::NavigationClient::CommitNavigationCallback(), nullptr, true)); } ",0 "static int am_unhex_digit(char c) { if (c >= '0' && c <= '9') { return c - '0'; } else if (c >= 'a' && c <= 'f') { return c - 'a' + 0xa; } else if (c >= 'A' && c <= 'F') { return c - 'A' + 0xa; } else { return -1; } } ",0 "GF_Err dimm_dump(GF_Box *a, FILE * trace) { GF_DIMMBox *p; p = (GF_DIMMBox *)a; gf_isom_box_dump_start(a, ""ImmediateDataBytesBox"", trace); fprintf(trace, ""BytesSent=\""""LLD""\"">\n"", LLD_CAST p->nbBytes); gf_isom_box_dump_done(""ImmediateDataBytesBox"", a, trace); return GF_OK; } ",0 "bool WebPagePrivate::dispatchTouchEventToFullScreenPlugin(PluginView* plugin, const Platform::TouchEvent& event) { if (!event.neverHadMultiTouch()) return false; if (event.isDoubleTap() || event.isTouchHold() || event.m_type == Platform::TouchEvent::TouchCancel) { NPTouchEvent npTouchEvent; if (event.isDoubleTap()) npTouchEvent.type = TOUCH_EVENT_DOUBLETAP; else if (event.isTouchHold()) npTouchEvent.type = TOUCH_EVENT_TOUCHHOLD; else if (event.m_type == Platform::TouchEvent::TouchCancel) npTouchEvent.type = TOUCH_EVENT_CANCEL; npTouchEvent.points = 0; npTouchEvent.size = event.m_points.size(); if (npTouchEvent.size) { npTouchEvent.points = new NPTouchPoint[npTouchEvent.size]; for (int i = 0; i < npTouchEvent.size; i++) { npTouchEvent.points[i].touchId = event.m_points[i].m_id; npTouchEvent.points[i].clientX = event.m_points[i].m_screenPos.x(); npTouchEvent.points[i].clientY = event.m_points[i].m_screenPos.y(); npTouchEvent.points[i].screenX = event.m_points[i].m_screenPos.x(); npTouchEvent.points[i].screenY = event.m_points[i].m_screenPos.y(); npTouchEvent.points[i].pageX = event.m_points[i].m_pos.x(); npTouchEvent.points[i].pageY = event.m_points[i].m_pos.y(); } } NPEvent npEvent; npEvent.type = NP_TouchEvent; npEvent.data = &npTouchEvent; plugin->dispatchFullScreenNPEvent(npEvent); delete[] npTouchEvent.points; return true; } dispatchTouchPointAsMouseEventToFullScreenPlugin(plugin, event.m_points[0]); return true; } ",1 "void StreamTcpIncrMemuse(uint64_t size) { (void) SC_ATOMIC_ADD(st_memuse, size); SCLogDebug(""STREAM %""PRIu64"", incr %""PRIu64, StreamTcpMemuseCounter(), size); return; } ",0 "reactor_object_t *reactor_register(reactor_t *reactor, int fd, void *context, void (*read_ready)(void *context), void (*write_ready)(void *context)) { assert(reactor != NULL); assert(fd != INVALID_FD); reactor_object_t *object = (reactor_object_t *)osi_calloc(sizeof(reactor_object_t)); if (!object) { LOG_ERROR(""%s unable to allocate reactor object: %s"", __func__, strerror(errno)); return NULL; } object->reactor = reactor; object->fd = fd; object->context = context; object->read_ready = read_ready; object->write_ready = write_ready; pthread_mutex_init(&object->lock, NULL); struct epoll_event event; memset(&event, 0, sizeof(event)); if (read_ready) event.events |= (EPOLLIN | EPOLLRDHUP); if (write_ready) event.events |= EPOLLOUT; event.data.ptr = object; if (epoll_ctl(reactor->epoll_fd, EPOLL_CTL_ADD, fd, &event) == -1) { LOG_ERROR(""%s unable to register fd %d to epoll set: %s"", __func__, fd, strerror(errno)); pthread_mutex_destroy(&object->lock); osi_free(object); return NULL; } return object; } ",0 "inline gl::GLApi* BackRenderbuffer::api() const { return decoder_->api(); } ",0 "int fixup_user_fault(struct task_struct *tsk, struct mm_struct *mm, unsigned long address, unsigned int fault_flags) { struct vm_area_struct *vma; int ret; vma = find_extend_vma(mm, address); if (!vma || address < vma->vm_start) return -EFAULT; ret = handle_mm_fault(mm, vma, address, fault_flags); if (ret & VM_FAULT_ERROR) { if (ret & VM_FAULT_OOM) return -ENOMEM; if (ret & (VM_FAULT_HWPOISON | VM_FAULT_HWPOISON_LARGE)) return -EHWPOISON; if (ret & VM_FAULT_SIGBUS) return -EFAULT; BUG(); } if (tsk) { if (ret & VM_FAULT_MAJOR) tsk->maj_flt++; else tsk->min_flt++; } return 0; } ",0 "int nfc_genl_tm_deactivated(struct nfc_dev *dev) { struct sk_buff *msg; void *hdr; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) return -ENOMEM; hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, NFC_EVENT_TM_DEACTIVATED); if (!hdr) goto free_msg; if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, dev->idx)) goto nla_put_failure; genlmsg_end(msg, hdr); genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); return 0; nla_put_failure: free_msg: nlmsg_free(msg); return -EMSGSIZE; } ",0 "void RenderView::OnToggleSpellPanel(bool is_currently_visible) { if (!webview()) return; spelling_panel_visible_ = is_currently_visible; webview()->focusedFrame()->executeCommand( WebString::fromUTF8(""ToggleSpellPanel"")); } ",0 "pdf14_recreate_device(gs_memory_t *mem, gs_gstate * pgs, gx_device * dev, const gs_pdf14trans_t * pdf14pct) { pdf14_device * pdev = (pdf14_device *)dev; gx_device * target = pdev->target; pdf14_device * dev_proto; pdf14_device temp_dev_proto; bool has_tags = device_encodes_tags(dev); int code; if_debug0m('v', dev->memory, ""[v]pdf14_recreate_device\n""); /* * We will not use the entire prototype device but we will set the * color related info and the device procs to match the prototype. */ code = get_pdf14_device_proto(target, &dev_proto, &temp_dev_proto, pgs, pdf14pct, false); if (code < 0) return code; pdev->color_info = dev_proto->color_info; pdev->pad = target->pad; pdev->log2_align_mod = target->log2_align_mod; pdev->is_planar = target->is_planar; pdev->procs = dev_proto->procs; if (has_tags) { set_dev_proc(pdev, encode_color, pdf14_encode_color_tag); pdev->color_info.comp_shift[pdev->color_info.num_components] = pdev->color_info.depth; pdev->color_info.depth += 8; } dev->static_procs = dev_proto->static_procs; gx_device_set_procs(dev); gx_device_fill_in_procs(dev); check_device_separable(dev); return dev_proc(pdev, open_device)(dev); } ",0 "gdImagePtr gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor) { float _angle = ((float) (-degrees / 180.0f) * (float)M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const unsigned int new_width = (unsigned int)(abs((int)(src_w * cos(_angle))) + abs((int)(src_h * sin(_angle))) + 0.5f); const unsigned int new_height = (unsigned int)(abs((int)(src_w * sin(_angle))) + abs((int)(src_h * cos(_angle))) + 0.5f); const gdFixed f_0_5 = gd_ftofx(0.5f); const gdFixed f_H = gd_itofx(src_h/2); const gdFixed f_W = gd_itofx(src_w/2); const gdFixed f_cos = gd_ftofx(cos(-_angle)); const gdFixed f_sin = gd_ftofx(sin(-_angle)); unsigned int dst_offset_x; unsigned int dst_offset_y = 0; unsigned int i; gdImagePtr dst; const gdFixed f_slop_y = f_sin; const gdFixed f_slop_x = f_cos; const gdFixed f_slop = f_slop_x > 0 && f_slop_x > 0 ? f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y) : 0; if (bgColor < 0) { return NULL; } /* impact perf a bit, but not that much. Implementation for palette images can be done at a later point. */ if (src->trueColor == 0) { gdImagePaletteToTrueColor(src); } dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; } dst->saveAlphaFlag = 1; for (i = 0; i < new_height; i++) { unsigned int j; dst_offset_x = 0; for (j = 0; j < new_width; j++) { gdFixed f_i = gd_itofx((int)i - (int)new_height / 2); gdFixed f_j = gd_itofx((int)j - (int)new_width / 2); gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H; gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W; long m = gd_fxtoi(f_m); long n = gd_fxtoi(f_n); if ((n <= 0) || (m <= 0) || (m >= src_h) || (n >= src_w)) { dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor; } else if ((n <= 1) || (m <= 1) || (m >= src_h - 1) || (n >= src_w - 1)) { register int c = getPixelInterpolated(src, n, m, bgColor); c = c | (( gdTrueColorGetAlpha(c) + ((int)(127* gd_fxtof(f_slop)))) << 24); dst->tpixels[dst_offset_y][dst_offset_x++] = _color_blend(bgColor, c); } else { dst->tpixels[dst_offset_y][dst_offset_x++] = getPixelInterpolated(src, n, m, bgColor); } } dst_offset_y++; } return dst; } ",0 " OnRejected(ScriptState* script_state, ReadableStreamBytesConsumer* consumer) : ScriptFunction(script_state), consumer_(consumer) {} ",0 "static void get_base_point(DBBox *bbox, int alignment, double *bx, double *by) { const int halign = alignment & 3; const int valign = alignment & 12; if (bx) switch (halign) { case HALIGN_LEFT: *bx = bbox->xMin; break; case HALIGN_CENTER: *bx = (bbox->xMax + bbox->xMin) / 2.0; break; case HALIGN_RIGHT: *bx = bbox->xMax; break; } if (by) switch (valign) { case VALIGN_TOP: *by = bbox->yMin; break; case VALIGN_CENTER: *by = (bbox->yMax + bbox->yMin) / 2.0; break; case VALIGN_SUB: *by = bbox->yMax; break; } } ",0 "void Document::CancelAnimationFrame(int id) { if (!scripted_animation_controller_) return; scripted_animation_controller_->CancelCallback(id); } ",0 " void StopOnIOThread() { ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::IO)); EXPECT_EQ(EmbeddedWorkerInstance::RUNNING, worker_->status()); ServiceWorkerStatusCode status = worker_->Stop(); last_worker_status_ = worker_->status(); EXPECT_EQ(SERVICE_WORKER_OK, status); EXPECT_EQ(EmbeddedWorkerInstance::STOPPING, last_worker_status_); if (status != SERVICE_WORKER_OK && !done_closure_.is_null()) done_closure_.Run(); } ",0 "void ChromeClientImpl::ShowMouseOverURL(const HitTestResult& result) { if (!web_view_->Client()) return; WebURL url; if (!result.GetScrollbar()) { if (result.IsLiveLink() && !result.AbsoluteLinkURL().GetString().IsEmpty()) { url = result.AbsoluteLinkURL(); } else if (result.InnerNode() && (isHTMLObjectElement(*result.InnerNode()) || isHTMLEmbedElement(*result.InnerNode()))) { LayoutObject* object = result.InnerNode()->GetLayoutObject(); if (object && object->IsLayoutEmbeddedContent()) { PluginView* plugin_view = ToLayoutEmbeddedContent(object)->Plugin(); if (plugin_view && plugin_view->IsPluginContainer()) { WebPluginContainerImpl* plugin = ToWebPluginContainerImpl(plugin_view); url = plugin->Plugin()->LinkAtPosition( result.RoundedPointInInnerNodeFrame()); } } } } web_view_->Client()->SetMouseOverURL(url); } ",0 "static int mov_imm_reg(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_MOV; op->dst = anal_fill_ai_rg (anal, GET_TARGET_REG(code)); op->src[0] = anal_fill_im (anal, (st8)(code & 0xFF)); return op->size; } ",0 "bool OmniboxViewViews::IsDropCursorForInsertion() const { return HasTextBeingDragged(); } ",0 "static inline bool cpu_has_vmx_apicv(void) { return cpu_has_vmx_apic_register_virt() && cpu_has_vmx_virtual_intr_delivery() && cpu_has_vmx_posted_intr(); } ",0 "std::vector PageHandler::ForAgentHost( DevToolsAgentHostImpl* host) { return DevToolsSession::HandlersForAgentHost( host, Page::Metainfo::domainName); } ",0 "PassRefPtr AccessibilityUIElement::ariaFlowToElementAtIndex(unsigned index) { return 0; } ",0 "static int osap(struct tpm_buf *tb, struct osapsess *s, const unsigned char *key, uint16_t type, uint32_t handle) { unsigned char enonce[TPM_NONCE_SIZE]; unsigned char ononce[TPM_NONCE_SIZE]; int ret; ret = tpm_get_random(TPM_ANY_NUM, ononce, TPM_NONCE_SIZE); if (ret != TPM_NONCE_SIZE) return ret; INIT_BUF(tb); store16(tb, TPM_TAG_RQU_COMMAND); store32(tb, TPM_OSAP_SIZE); store32(tb, TPM_ORD_OSAP); store16(tb, type); store32(tb, handle); storebytes(tb, ononce, TPM_NONCE_SIZE); ret = trusted_tpm_send(TPM_ANY_NUM, tb->data, MAX_BUF_SIZE); if (ret < 0) return ret; s->handle = LOAD32(tb->data, TPM_DATA_OFFSET); memcpy(s->enonce, &(tb->data[TPM_DATA_OFFSET + sizeof(uint32_t)]), TPM_NONCE_SIZE); memcpy(enonce, &(tb->data[TPM_DATA_OFFSET + sizeof(uint32_t) + TPM_NONCE_SIZE]), TPM_NONCE_SIZE); return TSS_rawhmac(s->secret, key, SHA1_DIGEST_SIZE, TPM_NONCE_SIZE, enonce, TPM_NONCE_SIZE, ononce, 0, 0); } ",0 "psf_f2s_clip_array (const float *src, short *dest, int count, int normalize) { float normfact, scaled_value ; normfact = normalize ? (1.0 * 0x8000) : 1.0 ; while (--count >= 0) { scaled_value = src [count] * normfact ; if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFF)) { dest [count] = 0x7FFF ; continue ; } ; if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x1000)) { dest [count] = 0x8000 ; continue ; } ; dest [count] = lrintf (scaled_value) ; } ; return ; } /* psf_f2s_clip_array */ ",0 "void snd_ctl_free_one(struct snd_kcontrol *kcontrol) { if (kcontrol) { if (kcontrol->private_free) kcontrol->private_free(kcontrol); kfree(kcontrol); } } ",0 "void InterstitialPage::CancelForNavigation() { Disable(); if (new_navigation_) TakeActionOnResourceDispatcher(RESUME); else TakeActionOnResourceDispatcher(CANCEL); } ",0 "kg_unseal_v1(context, minor_status, ctx, ptr, bodysize, message_buffer, conf_state, qop_state, toktype) krb5_context context; OM_uint32 *minor_status; krb5_gss_ctx_id_rec *ctx; unsigned char *ptr; int bodysize; gss_buffer_t message_buffer; int *conf_state; gss_qop_t *qop_state; int toktype; { krb5_error_code code; int conflen = 0; int signalg; int sealalg; int bad_pad = 0; gss_buffer_desc token; krb5_checksum cksum; krb5_checksum md5cksum; krb5_data plaind; char *data_ptr; unsigned char *plain; unsigned int cksum_len = 0; size_t plainlen; int direction; krb5_ui_4 seqnum; OM_uint32 retval; size_t sumlen; size_t padlen; krb5_keyusage sign_usage = KG_USAGE_SIGN; if (toktype == KG_TOK_SEAL_MSG) { message_buffer->length = 0; message_buffer->value = NULL; } /* Sanity checks */ if (ctx->seq == NULL) { /* ctx was established using a newer enctype, and cannot process RFC * 1964 tokens. */ *minor_status = 0; return GSS_S_DEFECTIVE_TOKEN; } if ((bodysize < 22) || (ptr[4] != 0xff) || (ptr[5] != 0xff)) { *minor_status = 0; return GSS_S_DEFECTIVE_TOKEN; } signalg = ptr[0] + (ptr[1]<<8); sealalg = ptr[2] + (ptr[3]<<8); if ((toktype != KG_TOK_SEAL_MSG) && (sealalg != 0xffff)) { *minor_status = 0; return GSS_S_DEFECTIVE_TOKEN; } /* in the current spec, there is only one valid seal algorithm per key type, so a simple comparison is ok */ if ((toktype == KG_TOK_SEAL_MSG) && !((sealalg == 0xffff) || (sealalg == ctx->sealalg))) { *minor_status = 0; return GSS_S_DEFECTIVE_TOKEN; } /* there are several mappings of seal algorithms to sign algorithms, but few enough that we can try them all. */ if ((ctx->sealalg == SEAL_ALG_NONE && signalg > 1) || (ctx->sealalg == SEAL_ALG_1 && signalg != SGN_ALG_3) || (ctx->sealalg == SEAL_ALG_DES3KD && signalg != SGN_ALG_HMAC_SHA1_DES3_KD)|| (ctx->sealalg == SEAL_ALG_MICROSOFT_RC4 && signalg != SGN_ALG_HMAC_MD5)) { *minor_status = 0; return GSS_S_DEFECTIVE_TOKEN; } switch (signalg) { case SGN_ALG_DES_MAC_MD5: case SGN_ALG_MD2_5: case SGN_ALG_HMAC_MD5: cksum_len = 8; if (toktype != KG_TOK_SEAL_MSG) sign_usage = 15; break; case SGN_ALG_3: cksum_len = 16; break; case SGN_ALG_HMAC_SHA1_DES3_KD: cksum_len = 20; break; default: *minor_status = 0; return GSS_S_DEFECTIVE_TOKEN; } if ((size_t)bodysize < 14 + cksum_len) { *minor_status = 0; return GSS_S_DEFECTIVE_TOKEN; } /* get the token parameters */ if ((code = kg_get_seq_num(context, ctx->seq, ptr+14, ptr+6, &direction, &seqnum))) { *minor_status = code; return(GSS_S_BAD_SIG); } /* decode the message, if SEAL */ if (toktype == KG_TOK_SEAL_MSG) { size_t tmsglen = bodysize-(14+cksum_len); if (sealalg != 0xffff) { if ((plain = (unsigned char *) xmalloc(tmsglen)) == NULL) { *minor_status = ENOMEM; return(GSS_S_FAILURE); } if (ctx->sealalg == SEAL_ALG_MICROSOFT_RC4) { unsigned char bigend_seqnum[4]; krb5_keyblock *enc_key; int i; store_32_be(seqnum, bigend_seqnum); code = krb5_k_key_keyblock(context, ctx->enc, &enc_key); if (code) { xfree(plain); *minor_status = code; return(GSS_S_FAILURE); } assert (enc_key->length == 16); for (i = 0; i <= 15; i++) ((char *) enc_key->contents)[i] ^=0xf0; code = kg_arcfour_docrypt (enc_key, 0, &bigend_seqnum[0], 4, ptr+14+cksum_len, tmsglen, plain); krb5_free_keyblock (context, enc_key); } else { code = kg_decrypt(context, ctx->enc, KG_USAGE_SEAL, NULL, ptr+14+cksum_len, plain, tmsglen); } if (code) { xfree(plain); *minor_status = code; return(GSS_S_FAILURE); } } else { plain = ptr+14+cksum_len; } plainlen = tmsglen; conflen = kg_confounder_size(context, ctx->enc->keyblock.enctype); if (tmsglen < conflen) { if (sealalg != 0xffff) xfree(plain); *minor_status = 0; return(GSS_S_DEFECTIVE_TOKEN); } padlen = plain[tmsglen - 1]; if (tmsglen - conflen < padlen) { /* Don't error out yet, to avoid padding oracle attacks. We will * treat this as a checksum failure later on. */ padlen = 0; bad_pad = 1; } token.length = tmsglen - conflen - padlen; if (token.length) { if ((token.value = (void *) gssalloc_malloc(token.length)) == NULL) { if (sealalg != 0xffff) xfree(plain); *minor_status = ENOMEM; return(GSS_S_FAILURE); } memcpy(token.value, plain+conflen, token.length); } else { token.value = NULL; } } else if (toktype == KG_TOK_SIGN_MSG) { token = *message_buffer; plain = token.value; plainlen = token.length; } else { token.length = 0; token.value = NULL; plain = token.value; plainlen = token.length; } /* compute the checksum of the message */ /* initialize the the cksum */ switch (signalg) { case SGN_ALG_DES_MAC_MD5: case SGN_ALG_MD2_5: case SGN_ALG_DES_MAC: case SGN_ALG_3: md5cksum.checksum_type = CKSUMTYPE_RSA_MD5; break; case SGN_ALG_HMAC_MD5: md5cksum.checksum_type = CKSUMTYPE_HMAC_MD5_ARCFOUR; break; case SGN_ALG_HMAC_SHA1_DES3_KD: md5cksum.checksum_type = CKSUMTYPE_HMAC_SHA1_DES3; break; default: abort (); } code = krb5_c_checksum_length(context, md5cksum.checksum_type, &sumlen); if (code) return(code); md5cksum.length = sumlen; switch (signalg) { case SGN_ALG_DES_MAC_MD5: case SGN_ALG_3: /* compute the checksum of the message */ /* 8 = bytes of token body to be checksummed according to spec */ if (! (data_ptr = xmalloc(8 + plainlen))) { if (sealalg != 0xffff) xfree(plain); if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = ENOMEM; return(GSS_S_FAILURE); } (void) memcpy(data_ptr, ptr-2, 8); (void) memcpy(data_ptr+8, plain, plainlen); plaind.length = 8 + plainlen; plaind.data = data_ptr; code = krb5_k_make_checksum(context, md5cksum.checksum_type, ctx->seq, sign_usage, &plaind, &md5cksum); xfree(data_ptr); if (code) { if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = code; return(GSS_S_FAILURE); } code = kg_encrypt_inplace(context, ctx->seq, KG_USAGE_SEAL, (g_OID_equal(ctx->mech_used, gss_mech_krb5_old) ? ctx->seq->keyblock.contents : NULL), md5cksum.contents, 16); if (code) { krb5_free_checksum_contents(context, &md5cksum); if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = code; return GSS_S_FAILURE; } if (signalg == 0) cksum.length = 8; else cksum.length = 16; cksum.contents = md5cksum.contents + 16 - cksum.length; code = k5_bcmp(cksum.contents, ptr + 14, cksum.length); break; case SGN_ALG_MD2_5: if (!ctx->seed_init && (code = kg_make_seed(context, ctx->subkey, ctx->seed))) { krb5_free_checksum_contents(context, &md5cksum); if (sealalg != 0xffff) xfree(plain); if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = code; return GSS_S_FAILURE; } if (! (data_ptr = xmalloc(sizeof(ctx->seed) + 8 + plainlen))) { krb5_free_checksum_contents(context, &md5cksum); if (sealalg == 0) xfree(plain); if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = ENOMEM; return(GSS_S_FAILURE); } (void) memcpy(data_ptr, ptr-2, 8); (void) memcpy(data_ptr+8, ctx->seed, sizeof(ctx->seed)); (void) memcpy(data_ptr+8+sizeof(ctx->seed), plain, plainlen); plaind.length = 8 + sizeof(ctx->seed) + plainlen; plaind.data = data_ptr; krb5_free_checksum_contents(context, &md5cksum); code = krb5_k_make_checksum(context, md5cksum.checksum_type, ctx->seq, sign_usage, &plaind, &md5cksum); xfree(data_ptr); if (code) { if (sealalg == 0) xfree(plain); if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = code; return(GSS_S_FAILURE); } code = k5_bcmp(md5cksum.contents, ptr + 14, 8); /* Falls through to defective-token?? */ default: *minor_status = 0; return(GSS_S_DEFECTIVE_TOKEN); case SGN_ALG_HMAC_SHA1_DES3_KD: case SGN_ALG_HMAC_MD5: /* compute the checksum of the message */ /* 8 = bytes of token body to be checksummed according to spec */ if (! (data_ptr = xmalloc(8 + plainlen))) { if (sealalg != 0xffff) xfree(plain); if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = ENOMEM; return(GSS_S_FAILURE); } (void) memcpy(data_ptr, ptr-2, 8); (void) memcpy(data_ptr+8, plain, plainlen); plaind.length = 8 + plainlen; plaind.data = data_ptr; code = krb5_k_make_checksum(context, md5cksum.checksum_type, ctx->seq, sign_usage, &plaind, &md5cksum); xfree(data_ptr); if (code) { if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = code; return(GSS_S_FAILURE); } code = k5_bcmp(md5cksum.contents, ptr + 14, cksum_len); break; } krb5_free_checksum_contents(context, &md5cksum); if (sealalg != 0xffff) xfree(plain); /* compare the computed checksum against the transmitted checksum */ if (code || bad_pad) { if (toktype == KG_TOK_SEAL_MSG) gssalloc_free(token.value); *minor_status = 0; return(GSS_S_BAD_SIG); } /* it got through unscathed. Make sure the context is unexpired */ if (toktype == KG_TOK_SEAL_MSG) *message_buffer = token; if (conf_state) *conf_state = (sealalg != 0xffff); if (qop_state) *qop_state = GSS_C_QOP_DEFAULT; /* do sequencing checks */ if ((ctx->initiate && direction != 0xff) || (!ctx->initiate && direction != 0)) { if (toktype == KG_TOK_SEAL_MSG) { gssalloc_free(token.value); message_buffer->value = NULL; message_buffer->length = 0; } *minor_status = (OM_uint32)G_BAD_DIRECTION; return(GSS_S_BAD_SIG); } retval = g_seqstate_check(ctx->seqstate, (uint64_t)seqnum); /* success or ordering violation */ *minor_status = 0; return(retval); } ",0 "RenderFrameImpl* RenderFrameImpl::FromRoutingID(int routing_id) { DCHECK(RenderThread::IsMainThread()); auto iter = g_routing_id_frame_map.Get().find(routing_id); if (iter != g_routing_id_frame_map.Get().end()) return iter->second; return nullptr; } ",0 "static void free_thread_stack(struct task_struct *tsk) { kmem_cache_free(thread_stack_cache, tsk->stack); } ",0 "bool RenderViewImpl::isPointerLocked() { return mouse_lock_dispatcher_->IsMouseLockedTo( webwidget_mouse_lock_target_.get()); } ",0 "isdn_net_ciscohdlck_slarp_send_reply(isdn_net_local *lp) { struct sk_buff *skb; unsigned char *p; struct in_device *in_dev = NULL; __be32 addr = 0; /* local ipv4 address */ __be32 mask = 0; /* local netmask */ if ((in_dev = lp->netdev->dev->ip_ptr) != NULL) { /* take primary(first) address of interface */ struct in_ifaddr *ifa = in_dev->ifa_list; if (ifa != NULL) { addr = ifa->ifa_local; mask = ifa->ifa_mask; } } skb = isdn_net_ciscohdlck_alloc_skb(lp, 4 + 14); if (!skb) return; p = skb_put(skb, 4 + 14); /* cisco header */ *(u8 *)(p + 0) = CISCO_ADDR_UNICAST; *(u8 *)(p + 1) = CISCO_CTRL; *(__be16 *)(p + 2) = cpu_to_be16(CISCO_TYPE_SLARP); /* slarp reply, send own ip/netmask; if values are nonsense remote * should think we are unable to provide it with an address via SLARP */ *(__be32 *)(p + 4) = cpu_to_be32(CISCO_SLARP_REPLY); *(__be32 *)(p + 8) = addr; // address *(__be32 *)(p + 12) = mask; // netmask *(__be16 *)(p + 16) = cpu_to_be16(0); // unused p += 18; isdn_net_write_super(lp, skb); } ",0 "SWFShape_getOutput(SWFShape shape) { return shape->out; } ",0 "bool jsvGetBool(const JsVar *v) { if (jsvIsString(v)) return jsvGetStringLength((JsVar*)v)!=0; if (jsvIsFunction(v) || jsvIsArray(v) || jsvIsObject(v) || jsvIsArrayBuffer(v)) return true; if (jsvIsFloat(v)) { JsVarFloat f = jsvGetFloat(v); return !isnan(f) && f!=0.0; } return jsvGetInteger(v)!=0; } ",0 "static void conditionalMethod2Method(const v8::FunctionCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); imp->conditionalMethod2(); } ",0 "static ssize_t tun_get_user(struct tun_struct *tun, void *msg_control, const struct iovec *iv, size_t total_len, size_t count, int noblock) { struct tun_pi pi = { 0, cpu_to_be16(ETH_P_IP) }; struct sk_buff *skb; size_t len = total_len, align = NET_SKB_PAD; struct virtio_net_hdr gso = { 0 }; int offset = 0; int copylen; bool zerocopy = false; int err; if (!(tun->flags & TUN_NO_PI)) { if ((len -= sizeof(pi)) > total_len) return -EINVAL; if (memcpy_fromiovecend((void *)&pi, iv, 0, sizeof(pi))) return -EFAULT; offset += sizeof(pi); } if (tun->flags & TUN_VNET_HDR) { if ((len -= tun->vnet_hdr_sz) > total_len) return -EINVAL; if (memcpy_fromiovecend((void *)&gso, iv, offset, sizeof(gso))) return -EFAULT; if ((gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && gso.csum_start + gso.csum_offset + 2 > gso.hdr_len) gso.hdr_len = gso.csum_start + gso.csum_offset + 2; if (gso.hdr_len > len) return -EINVAL; offset += tun->vnet_hdr_sz; } if ((tun->flags & TUN_TYPE_MASK) == TUN_TAP_DEV) { align += NET_IP_ALIGN; if (unlikely(len < ETH_HLEN || (gso.hdr_len && gso.hdr_len < ETH_HLEN))) return -EINVAL; } if (msg_control) zerocopy = true; if (zerocopy) { /* Userspace may produce vectors with count greater than * MAX_SKB_FRAGS, so we need to linearize parts of the skb * to let the rest of data to be fit in the frags. */ if (count > MAX_SKB_FRAGS) { copylen = iov_length(iv, count - MAX_SKB_FRAGS); if (copylen < offset) copylen = 0; else copylen -= offset; } else copylen = 0; /* There are 256 bytes to be copied in skb, so there is enough * room for skb expand head in case it is used. * The rest of the buffer is mapped from userspace. */ if (copylen < gso.hdr_len) copylen = gso.hdr_len; if (!copylen) copylen = GOODCOPY_LEN; } else copylen = len; skb = tun_alloc_skb(tun, align, copylen, gso.hdr_len, noblock); if (IS_ERR(skb)) { if (PTR_ERR(skb) != -EAGAIN) tun->dev->stats.rx_dropped++; return PTR_ERR(skb); } if (zerocopy) err = zerocopy_sg_from_iovec(skb, iv, offset, count); else err = skb_copy_datagram_from_iovec(skb, 0, iv, offset, len); if (err) { tun->dev->stats.rx_dropped++; kfree_skb(skb); return -EFAULT; } if (gso.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) { if (!skb_partial_csum_set(skb, gso.csum_start, gso.csum_offset)) { tun->dev->stats.rx_frame_errors++; kfree_skb(skb); return -EINVAL; } } switch (tun->flags & TUN_TYPE_MASK) { case TUN_TUN_DEV: if (tun->flags & TUN_NO_PI) { switch (skb->data[0] & 0xf0) { case 0x40: pi.proto = htons(ETH_P_IP); break; case 0x60: pi.proto = htons(ETH_P_IPV6); break; default: tun->dev->stats.rx_dropped++; kfree_skb(skb); return -EINVAL; } } skb_reset_mac_header(skb); skb->protocol = pi.proto; skb->dev = tun->dev; break; case TUN_TAP_DEV: skb->protocol = eth_type_trans(skb, tun->dev); break; } if (gso.gso_type != VIRTIO_NET_HDR_GSO_NONE) { pr_debug(""GSO!\n""); switch (gso.gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { case VIRTIO_NET_HDR_GSO_TCPV4: skb_shinfo(skb)->gso_type = SKB_GSO_TCPV4; break; case VIRTIO_NET_HDR_GSO_TCPV6: skb_shinfo(skb)->gso_type = SKB_GSO_TCPV6; break; case VIRTIO_NET_HDR_GSO_UDP: skb_shinfo(skb)->gso_type = SKB_GSO_UDP; break; default: tun->dev->stats.rx_frame_errors++; kfree_skb(skb); return -EINVAL; } if (gso.gso_type & VIRTIO_NET_HDR_GSO_ECN) skb_shinfo(skb)->gso_type |= SKB_GSO_TCP_ECN; skb_shinfo(skb)->gso_size = gso.gso_size; if (skb_shinfo(skb)->gso_size == 0) { tun->dev->stats.rx_frame_errors++; kfree_skb(skb); return -EINVAL; } /* Header must be checked, and gso_segs computed. */ skb_shinfo(skb)->gso_type |= SKB_GSO_DODGY; skb_shinfo(skb)->gso_segs = 0; } /* copy skb_ubuf_info for callback when skb has no error */ if (zerocopy) { skb_shinfo(skb)->destructor_arg = msg_control; skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; } netif_rx_ni(skb); tun->dev->stats.rx_packets++; tun->dev->stats.rx_bytes += len; return total_len; } ",0 "static void cpu_cgroup_css_offline(struct cgroup_subsys_state *css) { struct task_group *tg = css_tg(css); sched_offline_group(tg); } ",0 "UWORD32 ih264d_uev(UWORD32 *pu4_bitstrm_ofst, UWORD32 *pu4_bitstrm_buf) { UWORD32 u4_bitstream_offset = *pu4_bitstrm_ofst; UWORD32 u4_word, u4_ldz; /***************************************************************/ /* Find leading zeros in next 32 bits */ /***************************************************************/ NEXTBITS_32(u4_word, u4_bitstream_offset, pu4_bitstrm_buf); u4_ldz = CLZ(u4_word); /* Flush the ps_bitstrm */ u4_bitstream_offset += (u4_ldz + 1); /* Read the suffix from the ps_bitstrm */ u4_word = 0; if(u4_ldz) GETBITS(u4_word, u4_bitstream_offset, pu4_bitstrm_buf, u4_ldz); *pu4_bitstrm_ofst = u4_bitstream_offset; return ((1 << u4_ldz) + u4_word - 1); } ",0 " void Wait() { browser_closed_observer_.Wait(); } ",0 "void WebBluetoothServiceImpl::OnCharacteristicReadValueFailed( RemoteCharacteristicReadValueCallback callback, device::BluetoothRemoteGattService::GattErrorCode error_code) { DCHECK_CURRENTLY_ON(BrowserThread::UI); std::move(callback).Run( TranslateGATTErrorAndRecord(error_code, UMAGATTOperation::CHARACTERISTIC_READ), base::nullopt /* value */); } ",0 "SplashPattern *Splash::getFillPattern() { return state->fillPattern; } ",0 "png_handle_unknown(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_uint_32 skip = 0; png_debug(1, ""in png_handle_unknown""); #ifdef PNG_USER_LIMITS_SUPPORTED if (png_ptr->user_chunk_cache_max != 0) { if (png_ptr->user_chunk_cache_max == 1) { png_crc_finish(png_ptr, length); return; } if (--png_ptr->user_chunk_cache_max == 1) { png_warning(png_ptr, ""No space in chunk cache for unknown chunk""); png_crc_finish(png_ptr, length); return; } } #endif if (png_ptr->mode & PNG_HAVE_IDAT) { #ifdef PNG_USE_LOCAL_ARRAYS PNG_CONST PNG_IDAT; #endif if (png_memcmp(png_ptr->chunk_name, png_IDAT, 4)) /* Not an IDAT */ png_ptr->mode |= PNG_AFTER_IDAT; } if (!(png_ptr->chunk_name[0] & 0x20)) { #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != PNG_HANDLE_CHUNK_ALWAYS #ifdef PNG_READ_USER_CHUNKS_SUPPORTED && png_ptr->read_user_chunk_fn == NULL #endif ) #endif png_chunk_error(png_ptr, ""unknown critical chunk""); } #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED if ((png_ptr->flags & PNG_FLAG_KEEP_UNKNOWN_CHUNKS) #ifdef PNG_READ_USER_CHUNKS_SUPPORTED || (png_ptr->read_user_chunk_fn != NULL) #endif ) { #ifdef PNG_MAX_MALLOC_64K if (length > (png_uint_32)65535L) { png_warning(png_ptr, ""unknown chunk too large to fit in memory""); skip = length - (png_uint_32)65535L; length = (png_uint_32)65535L; } #endif png_memcpy((png_charp)png_ptr->unknown_chunk.name, (png_charp)png_ptr->chunk_name, png_sizeof(png_ptr->unknown_chunk.name)); png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] = '\0'; png_ptr->unknown_chunk.size = (png_size_t)length; if (length == 0) png_ptr->unknown_chunk.data = NULL; else { png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); } #ifdef PNG_READ_USER_CHUNKS_SUPPORTED if (png_ptr->read_user_chunk_fn != NULL) { /* Callback to user unknown chunk handler */ int ret; ret = (*(png_ptr->read_user_chunk_fn)) (png_ptr, &png_ptr->unknown_chunk); if (ret < 0) png_chunk_error(png_ptr, ""error in user chunk""); if (ret == 0) { if (!(png_ptr->chunk_name[0] & 0x20)) #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED if (png_handle_as_unknown(png_ptr, png_ptr->chunk_name) != PNG_HANDLE_CHUNK_ALWAYS) #endif png_chunk_error(png_ptr, ""unknown critical chunk""); png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); } } else #endif png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); png_free(png_ptr, png_ptr->unknown_chunk.data); png_ptr->unknown_chunk.data = NULL; } else #endif skip = length; png_crc_finish(png_ptr, skip); #ifndef PNG_READ_USER_CHUNKS_SUPPORTED PNG_UNUSED(info_ptr) /* Quiet compiler warnings about unused info_ptr */ #endif } ",0 "void PaletteTray::OnBeforeBubbleWidgetInit( views::Widget* anchor_widget, views::Widget* bubble_widget, views::Widget::InitParams* params) const { WmLookup::Get() ->GetWindowForWidget(anchor_widget) ->GetRootWindowController() ->ConfigureWidgetInitParamsForContainer( bubble_widget, kShellWindowId_SettingBubbleContainer, params); } ",0 "int netdev_rx_handler_register(struct net_device *dev, rx_handler_func_t *rx_handler, void *rx_handler_data) { ASSERT_RTNL(); if (dev->rx_handler) return -EBUSY; /* Note: rx_handler_data must be set before rx_handler */ rcu_assign_pointer(dev->rx_handler_data, rx_handler_data); rcu_assign_pointer(dev->rx_handler, rx_handler); return 0; } ",0 "bool Document::HasSVGRootNode() const { return isSVGSVGElement(documentElement()); } ",0 "juniper_parse_header(netdissect_options *ndo, const u_char *p, const struct pcap_pkthdr *h, struct juniper_l2info_t *l2info) { const struct juniper_cookie_table_t *lp = juniper_cookie_table; u_int idx, jnx_ext_len, jnx_header_len = 0; uint8_t tlv_type,tlv_len; uint32_t control_word; int tlv_value; const u_char *tptr; l2info->header_len = 0; l2info->cookie_len = 0; l2info->proto = 0; l2info->length = h->len; l2info->caplen = h->caplen; ND_TCHECK2(p[0], 4); l2info->flags = p[3]; l2info->direction = p[3]&JUNIPER_BPF_PKT_IN; if (EXTRACT_24BITS(p) != JUNIPER_MGC_NUMBER) { /* magic number found ? */ ND_PRINT((ndo, ""no magic-number found!"")); return 0; } if (ndo->ndo_eflag) /* print direction */ ND_PRINT((ndo, ""%3s "", tok2str(juniper_direction_values, ""---"", l2info->direction))); /* magic number + flags */ jnx_header_len = 4; if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""\n\tJuniper PCAP Flags [%s]"", bittok2str(jnx_flag_values, ""none"", l2info->flags))); /* extensions present ? - calculate how much bytes to skip */ if ((l2info->flags & JUNIPER_BPF_EXT ) == JUNIPER_BPF_EXT ) { tptr = p+jnx_header_len; /* ok to read extension length ? */ ND_TCHECK2(tptr[0], 2); jnx_ext_len = EXTRACT_16BITS(tptr); jnx_header_len += 2; tptr +=2; /* nail up the total length - * just in case something goes wrong * with TLV parsing */ jnx_header_len += jnx_ext_len; if (ndo->ndo_vflag > 1) ND_PRINT((ndo, "", PCAP Extension(s) total length %u"", jnx_ext_len)); ND_TCHECK2(tptr[0], jnx_ext_len); while (jnx_ext_len > JUNIPER_EXT_TLV_OVERHEAD) { tlv_type = *(tptr++); tlv_len = *(tptr++); tlv_value = 0; /* sanity checks */ if (tlv_type == 0 || tlv_len == 0) break; if (tlv_len+JUNIPER_EXT_TLV_OVERHEAD > jnx_ext_len) goto trunc; if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""\n\t %s Extension TLV #%u, length %u, value "", tok2str(jnx_ext_tlv_values,""Unknown"",tlv_type), tlv_type, tlv_len)); tlv_value = juniper_read_tlv_value(tptr, tlv_type, tlv_len); switch (tlv_type) { case JUNIPER_EXT_TLV_IFD_NAME: /* FIXME */ break; case JUNIPER_EXT_TLV_IFD_MEDIATYPE: case JUNIPER_EXT_TLV_TTP_IFD_MEDIATYPE: if (tlv_value != -1) { if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""%s (%u)"", tok2str(juniper_ifmt_values, ""Unknown"", tlv_value), tlv_value)); } break; case JUNIPER_EXT_TLV_IFL_ENCAPS: case JUNIPER_EXT_TLV_TTP_IFL_ENCAPS: if (tlv_value != -1) { if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""%s (%u)"", tok2str(juniper_ifle_values, ""Unknown"", tlv_value), tlv_value)); } break; case JUNIPER_EXT_TLV_IFL_IDX: /* fall through */ case JUNIPER_EXT_TLV_IFL_UNIT: case JUNIPER_EXT_TLV_IFD_IDX: default: if (tlv_value != -1) { if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""%u"", tlv_value)); } break; } tptr+=tlv_len; jnx_ext_len -= tlv_len+JUNIPER_EXT_TLV_OVERHEAD; } if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""\n\t-----original packet-----\n\t"")); } if ((l2info->flags & JUNIPER_BPF_NO_L2 ) == JUNIPER_BPF_NO_L2 ) { if (ndo->ndo_eflag) ND_PRINT((ndo, ""no-L2-hdr, "")); /* there is no link-layer present - * perform the v4/v6 heuristics * to figure out what it is */ ND_TCHECK2(p[jnx_header_len + 4], 1); if (ip_heuristic_guess(ndo, p + jnx_header_len + 4, l2info->length - (jnx_header_len + 4)) == 0) ND_PRINT((ndo, ""no IP-hdr found!"")); l2info->header_len=jnx_header_len+4; return 0; /* stop parsing the output further */ } l2info->header_len = jnx_header_len; p+=l2info->header_len; l2info->length -= l2info->header_len; l2info->caplen -= l2info->header_len; /* search through the cookie table and copy values matching for our PIC type */ ND_TCHECK(p[0]); while (lp->s != NULL) { if (lp->pictype == l2info->pictype) { l2info->cookie_len += lp->cookie_len; switch (p[0]) { case LS_COOKIE_ID: l2info->cookie_type = LS_COOKIE_ID; l2info->cookie_len += 2; break; case AS_COOKIE_ID: l2info->cookie_type = AS_COOKIE_ID; l2info->cookie_len = 8; break; default: l2info->bundle = l2info->cookie[0]; break; } #ifdef DLT_JUNIPER_MFR /* MFR child links don't carry cookies */ if (l2info->pictype == DLT_JUNIPER_MFR && (p[0] & MFR_BE_MASK) == MFR_BE_MASK) { l2info->cookie_len = 0; } #endif l2info->header_len += l2info->cookie_len; l2info->length -= l2info->cookie_len; l2info->caplen -= l2info->cookie_len; if (ndo->ndo_eflag) ND_PRINT((ndo, ""%s-PIC, cookie-len %u"", lp->s, l2info->cookie_len)); if (l2info->cookie_len > 0) { ND_TCHECK2(p[0], l2info->cookie_len); if (ndo->ndo_eflag) ND_PRINT((ndo, "", cookie 0x"")); for (idx = 0; idx < l2info->cookie_len; idx++) { l2info->cookie[idx] = p[idx]; /* copy cookie data */ if (ndo->ndo_eflag) ND_PRINT((ndo, ""%02x"", p[idx])); } } if (ndo->ndo_eflag) ND_PRINT((ndo, "": "")); /* print demarc b/w L2/L3*/ l2info->proto = EXTRACT_16BITS(p+l2info->cookie_len); break; } ++lp; } p+=l2info->cookie_len; /* DLT_ specific parsing */ switch(l2info->pictype) { #ifdef DLT_JUNIPER_MLPPP case DLT_JUNIPER_MLPPP: switch (l2info->cookie_type) { case LS_COOKIE_ID: l2info->bundle = l2info->cookie[1]; break; case AS_COOKIE_ID: l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: l2info->bundle = l2info->cookie[0]; break; } break; #endif #ifdef DLT_JUNIPER_MLFR case DLT_JUNIPER_MLFR: switch (l2info->cookie_type) { case LS_COOKIE_ID: ND_TCHECK2(p[0], 2); l2info->bundle = l2info->cookie[1]; l2info->proto = EXTRACT_16BITS(p); l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; case AS_COOKIE_ID: l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: l2info->bundle = l2info->cookie[0]; l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; } break; #endif #ifdef DLT_JUNIPER_MFR case DLT_JUNIPER_MFR: switch (l2info->cookie_type) { case LS_COOKIE_ID: ND_TCHECK2(p[0], 2); l2info->bundle = l2info->cookie[1]; l2info->proto = EXTRACT_16BITS(p); l2info->header_len += 2; l2info->length -= 2; l2info->caplen -= 2; break; case AS_COOKIE_ID: l2info->bundle = (EXTRACT_16BITS(&l2info->cookie[6])>>3)&0xfff; l2info->proto = (l2info->cookie[5])&JUNIPER_LSQ_L3_PROTO_MASK; break; default: l2info->bundle = l2info->cookie[0]; break; } break; #endif #ifdef DLT_JUNIPER_ATM2 case DLT_JUNIPER_ATM2: ND_TCHECK2(p[0], 4); /* ATM cell relay control word present ? */ if (l2info->cookie[7] & ATM2_PKT_TYPE_MASK) { control_word = EXTRACT_32BITS(p); /* some control word heuristics */ switch(control_word) { case 0: /* zero control word */ case 0x08000000: /* < JUNOS 7.4 control-word */ case 0x08380000: /* cntl word plus cell length (56) >= JUNOS 7.4*/ l2info->header_len += 4; break; default: break; } if (ndo->ndo_eflag) ND_PRINT((ndo, ""control-word 0x%08x "", control_word)); } break; #endif #ifdef DLT_JUNIPER_GGSN case DLT_JUNIPER_GGSN: break; #endif #ifdef DLT_JUNIPER_ATM1 case DLT_JUNIPER_ATM1: break; #endif #ifdef DLT_JUNIPER_PPP case DLT_JUNIPER_PPP: break; #endif #ifdef DLT_JUNIPER_CHDLC case DLT_JUNIPER_CHDLC: break; #endif #ifdef DLT_JUNIPER_ETHER case DLT_JUNIPER_ETHER: break; #endif #ifdef DLT_JUNIPER_FRELAY case DLT_JUNIPER_FRELAY: break; #endif default: ND_PRINT((ndo, ""Unknown Juniper DLT_ type %u: "", l2info->pictype)); break; } if (ndo->ndo_eflag > 1) ND_PRINT((ndo, ""hlen %u, proto 0x%04x, "", l2info->header_len, l2info->proto)); return 1; /* everything went ok so far. continue parsing */ trunc: ND_PRINT((ndo, ""[|juniper_hdr], length %u"", h->len)); return 0; } ",1 "void ScreenRecorder::DoRemoveClient( scoped_refptr connection) { DCHECK(network_loop_->BelongsToCurrentThread()); ConnectionToClientList::iterator it = std::find(connections_.begin(), connections_.end(), connection); if (it != connections_.end()) { connections_.erase(it); } } ",1 "static void attach_task(struct rq *rq, struct task_struct *p) { lockdep_assert_held(&rq->lock); BUG_ON(task_rq(p) != rq); activate_task(rq, p, ENQUEUE_NOCLOCK); p->on_rq = TASK_ON_RQ_QUEUED; check_preempt_curr(rq, p, 0); } ",0 "get_owner_match_rule (const gchar *name) { return g_strdup_printf (""type='signal',sender='"" DBUS_SERVICE_DBUS ""',path='"" DBUS_PATH_DBUS ""',interface='"" DBUS_INTERFACE_DBUS ""',member='NameOwnerChanged'"" "",arg0='%s'"", name); } ",0 "static int khazad_setkey(struct crypto_tfm *tfm, const u8 *in_key, unsigned int key_len) { struct khazad_ctx *ctx = crypto_tfm_ctx(tfm); const __be32 *key = (const __be32 *)in_key; int r; const u64 *S = T7; u64 K2, K1; /* key is supposed to be 32-bit aligned */ K2 = ((u64)be32_to_cpu(key[0]) << 32) | be32_to_cpu(key[1]); K1 = ((u64)be32_to_cpu(key[2]) << 32) | be32_to_cpu(key[3]); /* setup the encrypt key */ for (r = 0; r <= KHAZAD_ROUNDS; r++) { ctx->E[r] = T0[(int)(K1 >> 56) ] ^ T1[(int)(K1 >> 48) & 0xff] ^ T2[(int)(K1 >> 40) & 0xff] ^ T3[(int)(K1 >> 32) & 0xff] ^ T4[(int)(K1 >> 24) & 0xff] ^ T5[(int)(K1 >> 16) & 0xff] ^ T6[(int)(K1 >> 8) & 0xff] ^ T7[(int)(K1 ) & 0xff] ^ c[r] ^ K2; K2 = K1; K1 = ctx->E[r]; } /* Setup the decrypt key */ ctx->D[0] = ctx->E[KHAZAD_ROUNDS]; for (r = 1; r < KHAZAD_ROUNDS; r++) { K1 = ctx->E[KHAZAD_ROUNDS - r]; ctx->D[r] = T0[(int)S[(int)(K1 >> 56) ] & 0xff] ^ T1[(int)S[(int)(K1 >> 48) & 0xff] & 0xff] ^ T2[(int)S[(int)(K1 >> 40) & 0xff] & 0xff] ^ T3[(int)S[(int)(K1 >> 32) & 0xff] & 0xff] ^ T4[(int)S[(int)(K1 >> 24) & 0xff] & 0xff] ^ T5[(int)S[(int)(K1 >> 16) & 0xff] & 0xff] ^ T6[(int)S[(int)(K1 >> 8) & 0xff] & 0xff] ^ T7[(int)S[(int)(K1 ) & 0xff] & 0xff]; } ctx->D[KHAZAD_ROUNDS] = ctx->E[0]; return 0; } ",0 "static int handle_pause(struct kvm_vcpu *vcpu) { skip_emulated_instruction(vcpu); kvm_vcpu_on_spin(vcpu); return 1; } ",0 "int vtnr_from_tty(const char *tty) { int i, r; assert(tty); tty = skip_dev_prefix(tty); if (!startswith(tty, ""tty"") ) return -EINVAL; if (tty[3] < '0' || tty[3] > '9') return -EINVAL; r = safe_atoi(tty+3, &i); if (r < 0) return r; if (i < 0 || i > 63) return -EINVAL; return i; } ",0 "bool alloc_nid(struct f2fs_sb_info *sbi, nid_t *nid) { struct f2fs_nm_info *nm_i = NM_I(sbi); struct free_nid *i = NULL; retry: #ifdef CONFIG_F2FS_FAULT_INJECTION if (time_to_inject(sbi, FAULT_ALLOC_NID)) { f2fs_show_injection_info(FAULT_ALLOC_NID); return false; } #endif spin_lock(&nm_i->nid_list_lock); if (unlikely(nm_i->available_nids == 0)) { spin_unlock(&nm_i->nid_list_lock); return false; } /* We should not use stale free nids created by build_free_nids */ if (nm_i->nid_cnt[FREE_NID_LIST] && !on_build_free_nids(nm_i)) { f2fs_bug_on(sbi, list_empty(&nm_i->nid_list[FREE_NID_LIST])); i = list_first_entry(&nm_i->nid_list[FREE_NID_LIST], struct free_nid, list); *nid = i->nid; __remove_nid_from_list(sbi, i, FREE_NID_LIST, true); i->state = NID_ALLOC; __insert_nid_to_list(sbi, i, ALLOC_NID_LIST, false); nm_i->available_nids--; update_free_nid_bitmap(sbi, *nid, false, false); spin_unlock(&nm_i->nid_list_lock); return true; } spin_unlock(&nm_i->nid_list_lock); /* Let's scan nat pages and its caches to get free nids */ build_free_nids(sbi, true, false); goto retry; } ",0 "SendSSDPMSEARCHResponse(int s, const struct sockaddr * sockname, const char * st, size_t st_len, const char * usn, const char * server, const char * location) { int l, n; char buf[1024]; socklen_t sockname_len; /* * follow guideline from document ""UPnP Device Architecture 1.0"" * uppercase is recommended. * DATE: is recommended * SERVER: OS/ver UPnP/1.0 miniupnpd/1.0 * - check what to put in the 'Cache-Control' header * * have a look at the document ""UPnP Device Architecture v1.1 */ l = snprintf(buf, sizeof(buf), ""HTTP/1.1 200 OK\r\n"" ""CACHE-CONTROL: max-age=120\r\n"" /*""DATE: ...\r\n""*/ ""ST: %.*s\r\n"" ""USN: %s\r\n"" ""EXT:\r\n"" ""SERVER: %s\r\n"" ""LOCATION: %s\r\n"" ""OPT: \""http://schemas.upnp.org/upnp/1/0/\""; ns=01\r\n"" /* UDA v1.1 */ ""01-NLS: %u\r\n"" /* same as BOOTID. UDA v1.1 */ ""BOOTID.UPNP.ORG: %u\r\n"" /* UDA v1.1 */ ""CONFIGID.UPNP.ORG: %u\r\n"" /* UDA v1.1 */ ""\r\n"", (int)st_len, st, usn, server, location, upnp_bootid, upnp_bootid, upnp_configid); #ifdef ENABLE_IPV6 sockname_len = (sockname->sa_family == PF_INET6) ? sizeof(struct sockaddr_in6) : sizeof(struct sockaddr_in); #else /* ENABLE_IPV6 */ sockname_len = sizeof(struct sockaddr_in); #endif /* ENABLE_IPV6 */ n = sendto_or_schedule(s, buf, l, 0, sockname, sockname_len); if(n < 0) { syslog(LOG_ERR, ""%s: sendto(udp): %m"", __func__); } } ",0 " AppModeTest() {} ",0 "static int setcos_generate_store_key(sc_card_t *card, struct sc_cardctl_setcos_gen_store_key_info *data) { struct sc_apdu apdu; u8 sbuf[SC_MAX_APDU_BUFFER_SIZE]; int r, len; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); /* Setup key-generation parameters */ len = 0; if (data->op_type == OP_TYPE_GENERATE) sbuf[len++] = 0x92; /* algo ID: RSA CRT */ else sbuf[len++] = 0x9A; /* algo ID: EXTERNALLY GENERATED RSA CRT */ sbuf[len++] = 0x00; sbuf[len++] = data->mod_len / 256; /* 2 bytes for modulus bitlength */ sbuf[len++] = data->mod_len % 256; sbuf[len++] = data->pubexp_len / 256; /* 2 bytes for pubexp bitlength */ sbuf[len++] = data->pubexp_len % 256; memcpy(sbuf + len, data->pubexp, (data->pubexp_len + 7) / 8); len += (data->pubexp_len + 7) / 8; if (data->op_type == OP_TYPE_STORE) { sbuf[len++] = data->primep_len / 256; sbuf[len++] = data->primep_len % 256; memcpy(sbuf + len, data->primep, (data->primep_len + 7) / 8); len += (data->primep_len + 7) / 8; sbuf[len++] = data->primeq_len / 256; sbuf[len++] = data->primeq_len % 256; memcpy(sbuf + len, data->primeq, (data->primeq_len + 7) / 8); len += (data->primeq_len + 7) / 8; } sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x46, 0x00, 0x00); apdu.cla = 0x00; apdu.data = sbuf; apdu.datalen = len; apdu.lc = len; r = sc_transmit_apdu(card, &apdu); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""APDU transmit failed""); r = sc_check_sw(card, apdu.sw1, apdu.sw2); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""STORE/GENERATE_KEY returned error""); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, r); } ",0 "void AutofillPopupViewViews::CreateChildViews() { RemoveAllChildViews(true /* delete_children */); int set_size = controller_->GetLineCount(); for (int i = 0; i < set_size; ++i) { AddChildView(new AutofillPopupChildView(controller_->GetSuggestionAt(i), set_size, i + 1)); } } ",0 "static int tiocgwinsz(struct tty_struct *tty, struct winsize __user *arg) { int err; mutex_lock(&tty->termios_mutex); err = copy_to_user(arg, &tty->winsize, sizeof(*arg)); mutex_unlock(&tty->termios_mutex); return err ? -EFAULT: 0; } ",0 "static int php_stream_memory_stat(php_stream *stream, php_stream_statbuf *ssb TSRMLS_DC) /* {{{ */ { time_t timestamp = 0; php_stream_memory_data *ms = (php_stream_memory_data*)stream->abstract; assert(ms != NULL); memset(ssb, 0, sizeof(php_stream_statbuf)); /* read-only across the board */ ssb->sb.st_mode = ms->mode & TEMP_STREAM_READONLY ? 0444 : 0666; ssb->sb.st_size = ms->fsize; ssb->sb.st_mode |= S_IFREG; /* regular file */ #ifdef NETWARE ssb->sb.st_mtime.tv_sec = timestamp; ssb->sb.st_atime.tv_sec = timestamp; ssb->sb.st_ctime.tv_sec = timestamp; #else ssb->sb.st_mtime = timestamp; ssb->sb.st_atime = timestamp; ssb->sb.st_ctime = timestamp; #endif ssb->sb.st_nlink = 1; ssb->sb.st_rdev = -1; /* this is only for APC, so use /dev/null device - no chance of conflict there! */ ssb->sb.st_dev = 0xC; /* generate unique inode number for alias/filename, so no phars will conflict */ ssb->sb.st_ino = 0; #ifndef PHP_WIN32 ssb->sb.st_blksize = -1; #endif #if !defined(PHP_WIN32) && !defined(__BEOS__) ssb->sb.st_blocks = -1; #endif return 0; } /* }}} */ ",1 "static void RunAutofocusTask(ExecutionContext* context) { if (!context) return; Document* document = To(context); if (Element* element = document->AutofocusElement()) { document->SetAutofocusElement(nullptr); element->focus(); } } ",0 "scale10_round_decimal_double (double x, int n) { int e IF_LINT(= 0); mpn_t m; void *memory = decode_double (x, &e, &m); return scale10_round_decimal_decoded (e, m, memory, n); } ",0 " bool NPJSObject::NP_Enumerate(NPObject* npObject, NPIdentifier** identifiers, uint32_t* identifierCount) { return toNPJSObject(npObject)->enumerate(identifiers, identifierCount); } ",0 "static int assign_cfs_rq_runtime(struct cfs_rq *cfs_rq) { struct task_group *tg = cfs_rq->tg; struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(tg); u64 amount = 0, min_amount, expires; int expires_seq; /* note: this is a positive sum as runtime_remaining <= 0 */ min_amount = sched_cfs_bandwidth_slice() - cfs_rq->runtime_remaining; raw_spin_lock(&cfs_b->lock); if (cfs_b->quota == RUNTIME_INF) amount = min_amount; else { start_cfs_bandwidth(cfs_b); if (cfs_b->runtime > 0) { amount = min(cfs_b->runtime, min_amount); cfs_b->runtime -= amount; cfs_b->idle = 0; } } expires_seq = cfs_b->expires_seq; expires = cfs_b->runtime_expires; raw_spin_unlock(&cfs_b->lock); cfs_rq->runtime_remaining += amount; /* * we may have advanced our local expiration to account for allowed * spread between our sched_clock and the one on which runtime was * issued. */ if (cfs_rq->expires_seq != expires_seq) { cfs_rq->expires_seq = expires_seq; cfs_rq->runtime_expires = expires; } return cfs_rq->runtime_remaining > 0; } ",0 "WebPluginImpl::~WebPluginImpl() { } ",0 "standard_display_init(standard_display *dp, png_store* ps, png_uint_32 id, int do_interlace, int use_update_info) { memset(dp, 0, sizeof *dp); dp->ps = ps; dp->colour_type = COL_FROM_ID(id); dp->bit_depth = DEPTH_FROM_ID(id); if (dp->bit_depth < 1 || dp->bit_depth > 16) internal_error(ps, ""internal: bad bit depth""); if (dp->colour_type == 3) dp->red_sBIT = dp->blue_sBIT = dp->green_sBIT = dp->alpha_sBIT = 8; else dp->red_sBIT = dp->blue_sBIT = dp->green_sBIT = dp->alpha_sBIT = dp->bit_depth; dp->interlace_type = INTERLACE_FROM_ID(id); check_interlace_type(dp->interlace_type); dp->id = id; /* All the rest are filled in after the read_info: */ dp->w = 0; dp->h = 0; dp->npasses = 0; dp->pixel_size = 0; dp->bit_width = 0; dp->cbRow = 0; dp->do_interlace = do_interlace; dp->is_transparent = 0; dp->speed = ps->speed; dp->use_update_info = use_update_info; dp->npalette = 0; /* Preset the transparent color to black: */ memset(&dp->transparent, 0, sizeof dp->transparent); /* Preset the palette to full intensity/opaque througout: */ memset(dp->palette, 0xff, sizeof dp->palette); } ",1 "static void seed_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) { const struct seed_ctx *ctx = crypto_tfm_ctx(tfm); const __be32 *src = (const __be32 *)in; __be32 *dst = (__be32 *)out; u32 x1, x2, x3, x4, t0, t1; const u32 *ks = ctx->keysched; x1 = be32_to_cpu(src[0]); x2 = be32_to_cpu(src[1]); x3 = be32_to_cpu(src[2]); x4 = be32_to_cpu(src[3]); OP(x1, x2, x3, x4, 0); OP(x3, x4, x1, x2, 2); OP(x1, x2, x3, x4, 4); OP(x3, x4, x1, x2, 6); OP(x1, x2, x3, x4, 8); OP(x3, x4, x1, x2, 10); OP(x1, x2, x3, x4, 12); OP(x3, x4, x1, x2, 14); OP(x1, x2, x3, x4, 16); OP(x3, x4, x1, x2, 18); OP(x1, x2, x3, x4, 20); OP(x3, x4, x1, x2, 22); OP(x1, x2, x3, x4, 24); OP(x3, x4, x1, x2, 26); OP(x1, x2, x3, x4, 28); OP(x3, x4, x1, x2, 30); dst[0] = cpu_to_be32(x3); dst[1] = cpu_to_be32(x4); dst[2] = cpu_to_be32(x1); dst[3] = cpu_to_be32(x2); } ",0 "void SyncManager::SyncInternal::ShutdownOnSyncThread() { DCHECK(thread_checker_.CalledOnValidThread()); weak_ptr_factory_.InvalidateWeakPtrs(); js_mutation_event_observer_.InvalidateWeakPtrs(); scheduler_.reset(); SetJsEventHandler(WeakHandle()); RemoveObserver(&js_sync_manager_observer_); RemoveObserver(&debug_info_event_listener_); if (sync_notifier_.get()) { sync_notifier_->RemoveObserver(this); } sync_notifier_.reset(); if (connection_manager_.get()) { connection_manager_->RemoveListener(this); } connection_manager_.reset(); net::NetworkChangeNotifier::RemoveIPAddressObserver(this); observing_ip_address_changes_ = false; if (initialized_ && dir_manager()) { { ReadTransaction trans(FROM_HERE, GetUserShare()); trans.GetCryptographer()->RemoveObserver(this); } dir_manager()->FinalSaveChangesForAll(); dir_manager()->Close(username_for_share()); } share_.dir_manager.reset(); setup_for_test_mode_ = false; change_delegate_ = NULL; registrar_ = NULL; initialized_ = false; change_observer_.Reset(); weak_handle_this_.Reset(); } ",0 "printing::PrintDialogGtkInterface* PrintDialogGtk::CreatePrintDialog( PrintingContextCairo* context) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); return new PrintDialogGtk(context); } ",0 "psf_rand_int32 (void) { static uint64_t value = 0 ; int k, count ; if (value == 0) { #if HAVE_GETTIMEOFDAY struct timeval tv ; gettimeofday (&tv, NULL) ; value = tv.tv_sec + tv.tv_usec ; #else value = time (NULL) ; #endif } ; count = 4 + (value & 7) ; for (k = 0 ; k < count ; k++) value = (11117 * value + 211231) & 0x7fffffff ; return (int32_t) value ; } /* psf_rand_int32 */ ",0 "RenderFrameHostImpl::TakeNavigationRequestForSameDocumentCommit( const FrameHostMsg_DidCommitProvisionalLoad_Params& params) { bool is_browser_initiated = (params.nav_entry_id != 0); if (is_browser_initiated && same_document_navigation_request_ && same_document_navigation_request_->common_params().url == params.url) { return std::move(same_document_navigation_request_); } bool is_renderer_initiated = true; int pending_nav_entry_id = 0; NavigationEntryImpl* pending_entry = NavigationEntryImpl::FromNavigationEntry( frame_tree_node()->navigator()->GetController()->GetPendingEntry()); if (pending_entry && pending_entry->GetUniqueID() == params.nav_entry_id) { pending_nav_entry_id = params.nav_entry_id; is_renderer_initiated = pending_entry->is_renderer_initiated(); } return NavigationRequest::CreateForCommit( frame_tree_node_, pending_entry, params, is_renderer_initiated, true /* was_within_same_document */); } ",0 "static WebCore::ViewportAttributes _ewk_view_viewport_attributes_compute(const Ewk_View_Private_Data* priv) { int desktopWidth = 980; int deviceDPI = ewk_util_dpi_get(); WebCore::IntRect availableRect = enclosingIntRect(priv->page->chrome()->client()->pageRect()); WebCore::IntRect deviceRect = enclosingIntRect(priv->page->chrome()->client()->windowRect()); WebCore::ViewportAttributes attributes = WebCore::computeViewportAttributes(priv->viewportArguments, desktopWidth, deviceRect.width(), deviceRect.height(), deviceDPI, availableRect.size()); WebCore::restrictMinimumScaleFactorToViewportSize(attributes, availableRect.size()); WebCore::restrictScaleFactorToInitialScaleIfNotUserScalable(attributes); return attributes; } ",0 "bool SendGetCookiesJSONRequest( AutomationMessageSender* sender, const std::string& url, ListValue** cookies, std::string* error_msg) { DictionaryValue dict; dict.SetString(""command"", ""GetCookies""); dict.SetString(""url"", url); DictionaryValue reply_dict; if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) return false; Value* cookies_unscoped_value; if (!reply_dict.Remove(""cookies"", &cookies_unscoped_value)) return false; scoped_ptr cookies_value(cookies_unscoped_value); if (!cookies_value->IsType(Value::TYPE_LIST)) return false; *cookies = static_cast(cookies_value.release()); return true; } ",0 "static void php_zlib_cleanup_ob_gzhandler_mess(TSRMLS_D) { if (ZLIBG(ob_gzhandler)) { deflateEnd(&(ZLIBG(ob_gzhandler)->Z)); php_zlib_output_handler_context_dtor(ZLIBG(ob_gzhandler) TSRMLS_CC); ZLIBG(ob_gzhandler) = NULL; } } ",0 "void importFunction(const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); RELEASE_ASSERT(isolate && (args.Length() >= 1)); String resourceFileName = toCoreString(args[0]->ToString(isolate->GetCurrentContext()).ToLocalChecked()); String resourceData = loadResourceAsASCIIString(resourceFileName.utf8().data()); RELEASE_ASSERT(resourceData.length()); bool compileAndRunScript = true; if (args.Length() == 2) { RELEASE_ASSERT(args[1]->IsBoolean()); compileAndRunScript = args[1].As()->Value(); } if (resourceFileName.endsWith("".js"") && compileAndRunScript) compileAndRunPrivateScript(ScriptState::current(isolate), resourceFileName.replace("".js"", """"), resourceData.utf8().data(), resourceData.length()); args.GetReturnValue().Set(v8String(isolate, resourceData)); } ",0 "void hv_kvp_deinit(void) { cn_del_callback(&kvp_id); cancel_delayed_work_sync(&kvp_work); cancel_work_sync(&kvp_sendkey_work); } ",0 "v8::Handle V8Proxy::throwNotEnoughArgumentsError() { return throwError(TypeError, ""Not enough arguments""); } ",1 " int dns_read_name(unsigned char *buffer, unsigned char *bufend, unsigned char *name, char *destination, int dest_len, int *offset) { int nb_bytes = 0, n = 0; int label_len; unsigned char *reader = name; char *dest = destination; while (1) { /* Name compression is in use */ if ((*reader & 0xc0) == 0xc0) { /* Must point BEFORE current position */ if ((buffer + reader[1]) > reader) goto err; n = dns_read_name(buffer, bufend, buffer + reader[1], dest, dest_len - nb_bytes, offset); if (n == 0) goto err; } label_len = *reader; if (label_len == 0) goto out; /* Check if: * - we won't read outside the buffer * - there is enough place in the destination */ if ((reader + label_len >= bufend) || (nb_bytes + label_len >= dest_len)) goto err; /* +1 to take label len + label string */ label_len++; memcpy(dest, reader, label_len); dest += label_len; nb_bytes += label_len; reader += label_len; } out: /* offset computation: * parse from until finding either NULL or a pointer ""c0xx"" */ reader = name; *offset = 0; while (reader < bufend) { if ((reader[0] & 0xc0) == 0xc0) { *offset += 2; break; } else if (*reader == 0) { *offset += 1; break; } *offset += 1; ++reader; } return nb_bytes; err: return 0; } ",1 "v8::Local V8ValueConverterImpl::ToV8ValueImpl( v8::Isolate* isolate, v8::Local creation_context, const base::Value* value) const { CHECK(value); switch (value->GetType()) { case base::Value::TYPE_NULL: return v8::Null(isolate); case base::Value::TYPE_BOOLEAN: { bool val = false; CHECK(value->GetAsBoolean(&val)); return v8::Boolean::New(isolate, val); } case base::Value::TYPE_INTEGER: { int val = 0; CHECK(value->GetAsInteger(&val)); return v8::Integer::New(isolate, val); } case base::Value::TYPE_DOUBLE: { double val = 0.0; CHECK(value->GetAsDouble(&val)); return v8::Number::New(isolate, val); } case base::Value::TYPE_STRING: { std::string val; CHECK(value->GetAsString(&val)); return v8::String::NewFromUtf8( isolate, val.c_str(), v8::String::kNormalString, val.length()); } case base::Value::TYPE_LIST: return ToV8Array(isolate, creation_context, static_cast(value)); case base::Value::TYPE_DICTIONARY: return ToV8Object(isolate, creation_context, static_cast(value)); case base::Value::TYPE_BINARY: return ToArrayBuffer(isolate, creation_context, static_cast(value)); default: LOG(ERROR) << ""Unexpected value type: "" << value->GetType(); return v8::Null(isolate); } } ",0 "static void sock_rmem_free(struct sk_buff *skb) { struct sock *sk = skb->sk; atomic_sub(skb->truesize, &sk->sk_rmem_alloc); } ",0 "void WebSocketExperimentTask::SetTimeout(int64 deadline_ms) { bool r = ChromeThread::PostDelayedTask( ChromeThread::IO, FROM_HERE, method_factory_.NewRunnableMethod(&WebSocketExperimentTask::OnTimedOut), deadline_ms); DCHECK(r) << ""No IO thread running?""; } ",0 "void ChromotingInstance::SendTrappedKey(uint32 usb_keycode, bool pressed) { scoped_ptr data(new base::DictionaryValue()); data->SetInteger(""usbKeycode"", usb_keycode); data->SetBoolean(""pressed"", pressed); PostLegacyJsonMessage(""trappedKeyEvent"", data.Pass()); } ",0 "bool Textfield::GetDropFormats( int* formats, std::set* format_types) { if (!enabled() || read_only()) return false; *formats = ui::OSExchangeData::STRING; if (controller_) controller_->AppendDropFormats(formats, format_types); return true; } ",0 "void WebContext::setDoNotTrack(bool dnt) { if (IsInitialized()) { context_->SetDoNotTrack(dnt); } else { construct_props_->do_not_track = dnt; } } ",0 "ZEND_API void zend_update_property_double(zend_class_entry *scope, zval *object, const char *name, int name_length, double value TSRMLS_DC) /* {{{ */ { zval *tmp; ALLOC_ZVAL(tmp); Z_UNSET_ISREF_P(tmp); Z_SET_REFCOUNT_P(tmp, 0); ZVAL_DOUBLE(tmp, value); zend_update_property(scope, object, name, name_length, tmp TSRMLS_CC); } /* }}} */ ",0 "static int jas_icctxt_output(jas_iccattrval_t *attrval, jas_stream_t *out) { jas_icctxt_t *txt = &attrval->data.txt; if (jas_stream_puts(out, txt->string) || jas_stream_putc(out, 0) == EOF) return -1; return 0; } ",0 "static void ImportGrayQuantum(const Image *image,QuantumInfo *quantum_info, const MagickSizeType number_pixels,const unsigned char *magick_restrict p, Quantum *magick_restrict q,ExceptionInfo *exception) { QuantumAny range; register ssize_t x; ssize_t bit; unsigned int pixel; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); switch (quantum_info->depth) { case 1: { register Quantum black, white; black=0; white=QuantumRange; if (quantum_info->min_is_white != MagickFalse) { black=QuantumRange; white=0; } for (x=0; x < ((ssize_t) number_pixels-7); x+=8) { for (bit=0; bit < 8; bit++) { SetPixelGray(image,((*p) & (1 << (7-bit))) == 0 ? black : white,q); q+=GetPixelChannels(image); } p++; } for (bit=0; bit < (ssize_t) (number_pixels % 8); bit++) { SetPixelGray(image,((*p) & (0x01 << (7-bit))) == 0 ? black : white,q); q+=GetPixelChannels(image); } if (bit != 0) p++; break; } case 4: { register unsigned char pixel; range=GetQuantumRange(quantum_info->depth); for (x=0; x < ((ssize_t) number_pixels-1); x+=2) { pixel=(unsigned char) ((*p >> 4) & 0xf); SetPixelGray(image,ScaleAnyToQuantum(pixel,range),q); q+=GetPixelChannels(image); pixel=(unsigned char) ((*p) & 0xf); SetPixelGray(image,ScaleAnyToQuantum(pixel,range),q); p++; q+=GetPixelChannels(image); } for (bit=0; bit < (ssize_t) (number_pixels % 2); bit++) { pixel=(unsigned char) (*p++ >> 4); SetPixelGray(image,ScaleAnyToQuantum(pixel,range),q); q+=GetPixelChannels(image); } break; } case 8: { unsigned char pixel; if (quantum_info->min_is_white != MagickFalse) { for (x=0; x < (ssize_t) number_pixels; x++) { p=PushCharPixel(p,&pixel); SetPixelGray(image,ScaleCharToQuantum(pixel),q); SetPixelAlpha(image,OpaqueAlpha,q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushCharPixel(p,&pixel); SetPixelGray(image,ScaleCharToQuantum(pixel),q); SetPixelAlpha(image,OpaqueAlpha,q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 10: { range=GetQuantumRange(quantum_info->depth); if (quantum_info->pack == MagickFalse) { if (image->endian == LSBEndian) { for (x=0; x < (ssize_t) (number_pixels-2); x+=3) { p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ScaleAnyToQuantum((pixel >> 22) & 0x3ff, range),q); q+=GetPixelChannels(image); SetPixelGray(image,ScaleAnyToQuantum((pixel >> 12) & 0x3ff, range),q); q+=GetPixelChannels(image); SetPixelGray(image,ScaleAnyToQuantum((pixel >> 2) & 0x3ff, range),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } p=PushLongPixel(quantum_info->endian,p,&pixel); if (x++ < (ssize_t) (number_pixels-1)) { SetPixelGray(image,ScaleAnyToQuantum((pixel >> 22) & 0x3ff, range),q); q+=GetPixelChannels(image); } if (x++ < (ssize_t) number_pixels) { SetPixelGray(image,ScaleAnyToQuantum((pixel >> 12) & 0x3ff, range),q); q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) (number_pixels-2); x+=3) { p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ScaleAnyToQuantum((pixel >> 2) & 0x3ff,range), q); q+=GetPixelChannels(image); SetPixelGray(image,ScaleAnyToQuantum((pixel >> 12) & 0x3ff,range), q); q+=GetPixelChannels(image); SetPixelGray(image,ScaleAnyToQuantum((pixel >> 22) & 0x3ff,range), q); p+=quantum_info->pad; q+=GetPixelChannels(image); } p=PushLongPixel(quantum_info->endian,p,&pixel); if (x++ < (ssize_t) (number_pixels-1)) { SetPixelGray(image,ScaleAnyToQuantum((pixel >> 2) & 0x3ff, range),q); q+=GetPixelChannels(image); } if (x++ < (ssize_t) number_pixels) { SetPixelGray(image,ScaleAnyToQuantum((pixel >> 12) & 0x3ff, range),q); q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGray(image,ScaleAnyToQuantum(pixel,range),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 12: { range=GetQuantumRange(quantum_info->depth); if (quantum_info->pack == MagickFalse) { unsigned short pixel; for (x=0; x < (ssize_t) (number_pixels-1); x+=2) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ScaleAnyToQuantum((QuantumAny) (pixel >> 4), range),q); q+=GetPixelChannels(image); p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ScaleAnyToQuantum((QuantumAny) (pixel >> 4), range),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } for (bit=0; bit < (ssize_t) (number_pixels % 2); bit++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ScaleAnyToQuantum((QuantumAny) (pixel >> 4), range),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } if (bit != 0) p++; break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGray(image,ScaleAnyToQuantum(pixel,range),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 16: { unsigned short pixel; if (quantum_info->min_is_white != MagickFalse) { for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ScaleShortToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } if (quantum_info->format == FloatingPointQuantumFormat) { for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ClampToQuantum(QuantumRange* HalfToSinglePrecision(pixel)),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushShortPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ScaleShortToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 32: { unsigned int pixel; if (quantum_info->format == FloatingPointQuantumFormat) { float pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushFloatPixel(quantum_info,p,&pixel); SetPixelGray(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { p=PushLongPixel(quantum_info->endian,p,&pixel); SetPixelGray(image,ScaleLongToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } case 64: { if (quantum_info->format == FloatingPointQuantumFormat) { double pixel; for (x=0; x < (ssize_t) number_pixels; x++) { p=PushDoublePixel(quantum_info,p,&pixel); SetPixelGray(image,ClampToQuantum(pixel),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } } default: { range=GetQuantumRange(quantum_info->depth); for (x=0; x < (ssize_t) number_pixels; x++) { p=PushQuantumPixel(quantum_info,p,&pixel); SetPixelGray(image,ScaleAnyToQuantum(pixel,range),q); p+=quantum_info->pad; q+=GetPixelChannels(image); } break; } } } ",1 "PHPAPI int php_copy_file_ctx(char *src, char *dest, int src_flg, php_stream_context *ctx TSRMLS_DC) { php_stream *srcstream = NULL, *deststream = NULL; int ret = FAILURE; php_stream_statbuf src_s, dest_s; switch (php_stream_stat_path_ex(src, 0, &src_s, ctx)) { case -1: /* non-statable stream */ goto safe_to_copy; break; case 0: break; default: /* failed to stat file, does not exist? */ return ret; } if (S_ISDIR(src_s.sb.st_mode)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""The first argument to copy() function cannot be a directory""); return FAILURE; } switch (php_stream_stat_path_ex(dest, PHP_STREAM_URL_STAT_QUIET | PHP_STREAM_URL_STAT_NOCACHE, &dest_s, ctx)) { case -1: /* non-statable stream */ goto safe_to_copy; break; case 0: break; default: /* failed to stat file, does not exist? */ return ret; } if (S_ISDIR(dest_s.sb.st_mode)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""The second argument to copy() function cannot be a directory""); return FAILURE; } if (!src_s.sb.st_ino || !dest_s.sb.st_ino) { goto no_stat; } if (src_s.sb.st_ino == dest_s.sb.st_ino && src_s.sb.st_dev == dest_s.sb.st_dev) { return ret; } else { goto safe_to_copy; } no_stat: { char *sp, *dp; int res; if ((sp = expand_filepath(src, NULL TSRMLS_CC)) == NULL) { return ret; } if ((dp = expand_filepath(dest, NULL TSRMLS_CC)) == NULL) { efree(sp); goto safe_to_copy; } res = #ifndef PHP_WIN32 !strcmp(sp, dp); #else !strcasecmp(sp, dp); #endif efree(sp); efree(dp); if (res) { return ret; } } safe_to_copy: srcstream = php_stream_open_wrapper_ex(src, ""rb"", src_flg | REPORT_ERRORS, NULL, ctx); if (!srcstream) { return ret; } deststream = php_stream_open_wrapper_ex(dest, ""wb"", REPORT_ERRORS, NULL, ctx); if (srcstream && deststream) { ret = php_stream_copy_to_stream_ex(srcstream, deststream, PHP_STREAM_COPY_ALL, NULL); } if (srcstream) { php_stream_close(srcstream); } if (deststream) { php_stream_close(deststream); } return ret; } ",0 "void BrowserViewRenderer::ClearView() { TRACE_EVENT_INSTANT0(""android_webview"", ""BrowserViewRenderer::ClearView"", TRACE_EVENT_SCOPE_THREAD); if (clear_view_) return; clear_view_ = true; PostInvalidateWithFallback(); } ",0 "void vm_stat_account(struct mm_struct *mm, vm_flags_t flags, long npages) { mm->total_vm += npages; if (is_exec_mapping(flags)) mm->exec_vm += npages; else if (is_stack_mapping(flags)) mm->stack_vm += npages; else if (is_data_mapping(flags)) mm->data_vm += npages; } ",0 "void GLES2DecoderPassthroughImpl::PerformIdleWork() { gpu_tracer_->ProcessTraces(); ProcessReadPixels(false); } ",0 "void OmniboxViewViews::SetTextAndSelectedRange(const base::string16& text, const gfx::Range& range) { SetText(text); SelectRange(range); } ",0 " void CheckDownloadStatesForBrowser(Browser* browser, size_t num, DownloadItem::DownloadState state) { std::vector download_items; GetDownloads(browser, &download_items); EXPECT_EQ(num, download_items.size()); for (size_t i = 0; i < download_items.size(); ++i) { EXPECT_EQ(state, download_items[i]->GetState()) << "" Item "" << i; } } ",0 "void WebContentsImpl::NotifyPreferencesChanged() { std::set render_view_host_set; for (FrameTreeNode* node : frame_tree_.Nodes()) { render_view_host_set.insert( node->current_frame_host()->GetRenderViewHost()); } for (RenderViewHost* render_view_host : render_view_host_set) render_view_host->OnWebkitPreferencesChanged(); } ",0 "initiate_exit(void) { int active = 0; xmlNode *leaving = NULL; active = crm_active_peers(); if (active < 2) { terminate_cib(__FUNCTION__, FALSE); return; } crm_info(""Sending disconnect notification to %d peers..."", active); leaving = create_xml_node(NULL, ""exit-notification""); crm_xml_add(leaving, F_TYPE, ""cib""); crm_xml_add(leaving, F_CIB_OPERATION, ""cib_shutdown_req""); send_cluster_message(NULL, crm_msg_cib, leaving, TRUE); free_xml(leaving); g_timeout_add(crm_get_msec(""5s""), cib_force_exit, NULL); } ",0 "inline void HTMLInputElement::AddToRadioButtonGroup() { if (RadioButtonGroupScope* scope = GetRadioButtonGroupScope()) scope->AddButton(this); } ",0 "void AutofillPopupBaseView::AddExtraInitParams( views::Widget::InitParams* params) { params->opacity = views::Widget::InitParams::TRANSLUCENT_WINDOW; params->shadow_type = views::Widget::InitParams::SHADOW_TYPE_NONE; } ",1 "static int udp_lib_lport_inuse2(struct net *net, __u16 num, struct udp_hslot *hslot2, struct sock *sk, int (*saddr_comp)(const struct sock *sk1, const struct sock *sk2)) { struct sock *sk2; struct hlist_nulls_node *node; kuid_t uid = sock_i_uid(sk); int res = 0; spin_lock(&hslot2->lock); udp_portaddr_for_each_entry(sk2, node, &hslot2->head) if (net_eq(sock_net(sk2), net) && sk2 != sk && (udp_sk(sk2)->udp_port_hash == num) && (!sk2->sk_reuse || !sk->sk_reuse) && (!sk2->sk_bound_dev_if || !sk->sk_bound_dev_if || sk2->sk_bound_dev_if == sk->sk_bound_dev_if) && (!sk2->sk_reuseport || !sk->sk_reuseport || !uid_eq(uid, sock_i_uid(sk2))) && (*saddr_comp)(sk, sk2)) { res = 1; break; } spin_unlock(&hslot2->lock); return res; } ",0 "BaseMultipleFieldsDateAndTimeInputType::~BaseMultipleFieldsDateAndTimeInputType() { if (SpinButtonElement* element = spinButtonElement()) element->removeSpinButtonOwner(); if (ClearButtonElement* element = clearButtonElement()) element->removeClearButtonOwner(); if (DateTimeEditElement* element = dateTimeEditElement()) element->removeEditControlOwner(); if (PickerIndicatorElement* element = pickerIndicatorElement()) element->removePickerIndicatorOwner(); } ",0 "bool Browser::ShouldOpenNewTabForWindowDisposition( WindowOpenDisposition disposition) { return (disposition == NEW_FOREGROUND_TAB || disposition == NEW_BACKGROUND_TAB); } ",0 "const char* XMLRPC_GetResponseFaultString (XMLRPC_REQUEST response) { return XMLRPC_GetValueFaultString( XMLRPC_RequestGetData(response) ); } ",0 "mrb_io_fileno(mrb_state *mrb, mrb_value io) { struct mrb_io *fptr; fptr = (struct mrb_io *)mrb_get_datatype(mrb, io, &mrb_io_type); return mrb_fixnum_value(fptr->fd); } ",0 "static irqreturn_t vfio_intx_handler(int irq, void *dev_id) { struct vfio_pci_device *vdev = dev_id; unsigned long flags; int ret = IRQ_NONE; spin_lock_irqsave(&vdev->irqlock, flags); if (!vdev->pci_2_3) { disable_irq_nosync(vdev->pdev->irq); vdev->ctx[0].masked = true; ret = IRQ_HANDLED; } else if (!vdev->ctx[0].masked && /* may be shared */ pci_check_and_mask_intx(vdev->pdev)) { vdev->ctx[0].masked = true; ret = IRQ_HANDLED; } spin_unlock_irqrestore(&vdev->irqlock, flags); if (ret == IRQ_HANDLED) vfio_send_intx_eventfd(vdev, NULL); return ret; } ",0 " OVS_REQUIRES(ofproto_mutex) { struct rule *rule = rule_collection_rules(&ofm->new_rules)[0]; /* If learning on a different bridge, must bump its version * number and flush connmgr afterwards. */ if (rule->ofproto != orig_ofproto) { ofproto_bump_tables_version(rule->ofproto); } ofproto_flow_mod_finish(rule->ofproto, ofm, NULL); if (rule->ofproto != orig_ofproto) { ofmonitor_flush(rule->ofproto->connmgr); } } ",0 "void LockContentsView::OnShowEasyUnlockIcon( const AccountId& user, const mojom::EasyUnlockIconOptionsPtr& icon) { UserState* state = FindStateForUser(user); if (!state) return; state->easy_unlock_state = icon->Clone(); UpdateEasyUnlockIconForUser(user); LoginBigUserView* big_user = TryToFindBigUser(user, true /*require_auth_active*/); if (!big_user || !big_user->auth_user()) return; tooltip_bubble_->Close(); if (icon->autoshow_tooltip) { tooltip_bubble_->ShowTooltip( icon->tooltip, big_user->auth_user()->password_view() /*anchor_view*/); } } ",0 "void kvm_resched(struct kvm_vcpu *vcpu) { if (!need_resched()) return; cond_resched(); } ",0 "virDomainManagedSave(virDomainPtr dom, unsigned int flags) { virConnectPtr conn; VIR_DOMAIN_DEBUG(dom, ""flags=%x"", flags); virResetLastError(); virCheckDomainReturn(dom, -1); conn = dom->conn; virCheckReadOnlyGoto(conn->flags, error); VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING, VIR_DOMAIN_SAVE_PAUSED, error); if (conn->driver->domainManagedSave) { int ret; ret = conn->driver->domainManagedSave(dom, flags); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(conn); return -1; } ",0 " void SoftVPX::onQueueFilled(OMX_U32 /* portIndex */) { if (mOutputPortSettingsChange != NONE || mEOSStatus == OUTPUT_FRAMES_FLUSHED) { return; } List &inQueue = getPortQueue(0); List &outQueue = getPortQueue(1); bool EOSseen = false; bool portWillReset = false; while ((mEOSStatus == INPUT_EOS_SEEN || !inQueue.empty()) && !outQueue.empty()) { if (mEOSStatus == INPUT_EOS_SEEN || mImg != NULL) { if (!outputBuffers( mEOSStatus == INPUT_EOS_SEEN, true /* display */, mEOSStatus == INPUT_EOS_SEEN, &portWillReset)) { ALOGE(""on2 decoder failed to output frame.""); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } if (portWillReset || mEOSStatus == OUTPUT_FRAMES_FLUSHED || mEOSStatus == INPUT_EOS_SEEN) { return; } continue; } BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { if (mMode == MODE_VP9) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); continue; } else { ALOGW(""WARNING: Got CSD buffer for VP8.""); } } mTimeStamps[mTimeStampIdx] = inHeader->nTimeStamp; if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { mEOSStatus = INPUT_EOS_SEEN; EOSseen = true; } if (inHeader->nFilledLen > 0) { vpx_codec_err_t err = vpx_codec_decode( (vpx_codec_ctx_t *)mCtx, inHeader->pBuffer + inHeader->nOffset, inHeader->nFilledLen, &mTimeStamps[mTimeStampIdx], 0); if (err == VPX_CODEC_OK) { inInfo->mOwnedByUs = false; inQueue.erase(inQueue.begin()); inInfo = NULL; notifyEmptyBufferDone(inHeader); inHeader = NULL; } else { ALOGE(""on2 decoder failed to decode frame. err: %d"", err); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } } mTimeStampIdx = (mTimeStampIdx + 1) % kNumBuffers; if (!outputBuffers( EOSseen /* flushDecoder */, true /* display */, EOSseen, &portWillReset)) { ALOGE(""on2 decoder failed to output frame.""); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } if (portWillReset) { return; } } } ",0 "int runqueue_is_locked(int cpu) { return raw_spin_is_locked(&cpu_rq(cpu)->lock); } ",0 "int RenderFrameHostImpl::GetProxyCount() { if (this != frame_tree_node_->current_frame_host()) return 0; return frame_tree_node_->render_manager()->GetProxyCount(); } ",0 "void ParamTraits::Write(Message* m, const param_type& p) { ParamTraits::Write(m, p.ToInternalValue()); } ",0 "static jpc_dec_cp_t *jpc_dec_cp_copy(jpc_dec_cp_t *cp) { jpc_dec_cp_t *newcp; jpc_dec_ccp_t *newccp; jpc_dec_ccp_t *ccp; int compno; if (!(newcp = jpc_dec_cp_create(cp->numcomps))) { return 0; } newcp->flags = cp->flags; newcp->prgord = cp->prgord; newcp->numlyrs = cp->numlyrs; newcp->mctid = cp->mctid; newcp->csty = cp->csty; jpc_pchglist_destroy(newcp->pchglist); newcp->pchglist = 0; if (!(newcp->pchglist = jpc_pchglist_copy(cp->pchglist))) { jas_free(newcp); return 0; } for (compno = 0, newccp = newcp->ccps, ccp = cp->ccps; compno < cp->numcomps; ++compno, ++newccp, ++ccp) { *newccp = *ccp; } return newcp; } ",0 "void IRCView::wipeLineParagraphs() { m_rememberLine = m_lastMarkerLine = 0; } ",0 "static int jpc_cox_getcompparms(jpc_ms_t *ms, jpc_cstate_t *cstate, jas_stream_t *in, int prtflag, jpc_coxcp_t *compparms) { uint_fast8_t tmp; int i; /* Eliminate compiler warning about unused variables. */ ms = 0; cstate = 0; if (jpc_getuint8(in, &compparms->numdlvls) || jpc_getuint8(in, &compparms->cblkwidthval) || jpc_getuint8(in, &compparms->cblkheightval) || jpc_getuint8(in, &compparms->cblksty) || jpc_getuint8(in, &compparms->qmfbid)) { return -1; } compparms->numrlvls = compparms->numdlvls + 1; if (prtflag) { for (i = 0; i < compparms->numrlvls; ++i) { if (jpc_getuint8(in, &tmp)) { jpc_cox_destroycompparms(compparms); return -1; } compparms->rlvls[i].parwidthval = tmp & 0xf; compparms->rlvls[i].parheightval = (tmp >> 4) & 0xf; } /* Sigh. This bit should be in the same field in both COC and COD mrk segs. */ compparms->csty |= JPC_COX_PRT; } else { } if (jas_stream_eof(in)) { jpc_cox_destroycompparms(compparms); return -1; } return 0; } ",0 "static int wait_for_msg_done(struct smi_info *smi_info) { enum si_sm_result smi_result; smi_result = smi_info->handlers->event(smi_info->si_sm, 0); for (;;) { if (smi_result == SI_SM_CALL_WITH_DELAY || smi_result == SI_SM_CALL_WITH_TICK_DELAY) { schedule_timeout_uninterruptible(1); smi_result = smi_info->handlers->event( smi_info->si_sm, jiffies_to_usecs(1)); } else if (smi_result == SI_SM_CALL_WITHOUT_DELAY) { smi_result = smi_info->handlers->event( smi_info->si_sm, 0); } else break; } if (smi_result == SI_SM_HOSED) /* * We couldn't get the state machine to run, so whatever's at * the port is probably not an IPMI SMI interface. */ return -ENODEV; return 0; } ",0 "NTSTATUS cli_dfs_get_referral(TALLOC_CTX *ctx, struct cli_state *cli, const char *path, struct client_dfs_referral **refs, size_t *num_refs, size_t *consumed) { unsigned int param_len = 0; uint16_t recv_flags2; uint8_t *param = NULL; uint8_t *rdata = NULL; char *p; char *endp; smb_ucs2_t *path_ucs; char *consumed_path = NULL; uint16_t consumed_ucs; uint16_t num_referrals; struct client_dfs_referral *referrals = NULL; NTSTATUS status; TALLOC_CTX *frame = talloc_stackframe(); *num_refs = 0; *refs = NULL; param = talloc_array(talloc_tos(), uint8_t, 2); if (!param) { status = NT_STATUS_NO_MEMORY; goto out; } SSVAL(param, 0, 0x03); /* max referral level */ param = trans2_bytes_push_str(param, smbXcli_conn_use_unicode(cli->conn), path, strlen(path)+1, NULL); if (!param) { status = NT_STATUS_NO_MEMORY; goto out; } param_len = talloc_get_size(param); path_ucs = (smb_ucs2_t *)¶m[2]; if (smbXcli_conn_protocol(cli->conn) >= PROTOCOL_SMB2_02) { DATA_BLOB in_input_buffer; DATA_BLOB in_output_buffer = data_blob_null; DATA_BLOB out_input_buffer = data_blob_null; DATA_BLOB out_output_buffer = data_blob_null; in_input_buffer.data = param; in_input_buffer.length = param_len; status = smb2cli_ioctl(cli->conn, cli->timeout, cli->smb2.session, cli->smb2.tcon, UINT64_MAX, /* in_fid_persistent */ UINT64_MAX, /* in_fid_volatile */ FSCTL_DFS_GET_REFERRALS, 0, /* in_max_input_length */ &in_input_buffer, CLI_BUFFER_SIZE, /* in_max_output_length */ &in_output_buffer, SMB2_IOCTL_FLAG_IS_FSCTL, talloc_tos(), &out_input_buffer, &out_output_buffer); if (!NT_STATUS_IS_OK(status)) { goto out; } if (out_output_buffer.length < 4) { status = NT_STATUS_INVALID_NETWORK_RESPONSE; goto out; } recv_flags2 = FLAGS2_UNICODE_STRINGS; rdata = out_output_buffer.data; endp = (char *)rdata + out_output_buffer.length; } else { unsigned int data_len = 0; uint16_t setup[1]; SSVAL(setup, 0, TRANSACT2_GET_DFS_REFERRAL); status = cli_trans(talloc_tos(), cli, SMBtrans2, NULL, 0xffff, 0, 0, setup, 1, 0, param, param_len, 2, NULL, 0, CLI_BUFFER_SIZE, &recv_flags2, NULL, 0, NULL, /* rsetup */ NULL, 0, NULL, &rdata, 4, &data_len); if (!NT_STATUS_IS_OK(status)) { goto out; } endp = (char *)rdata + data_len; } consumed_ucs = SVAL(rdata, 0); num_referrals = SVAL(rdata, 2); /* consumed_ucs is the number of bytes * of the UCS2 path consumed not counting any * terminating null. We need to convert * back to unix charset and count again * to get the number of bytes consumed from * the incoming path. */ errno = 0; if (pull_string_talloc(talloc_tos(), NULL, 0, &consumed_path, path_ucs, consumed_ucs, STR_UNICODE) == 0) { if (errno != 0) { status = map_nt_error_from_unix(errno); } else { status = NT_STATUS_INVALID_NETWORK_RESPONSE; } goto out; } if (consumed_path == NULL) { status = map_nt_error_from_unix(errno); goto out; } *consumed = strlen(consumed_path); if (num_referrals != 0) { uint16_t ref_version; uint16_t ref_size; int i; uint16_t node_offset; referrals = talloc_array(ctx, struct client_dfs_referral, num_referrals); if (!referrals) { status = NT_STATUS_NO_MEMORY; goto out; } /* start at the referrals array */ p = (char *)rdata+8; for (i=0; i endp) { goto out; } ref_version = SVAL(p, 0); ref_size = SVAL(p, 2); node_offset = SVAL(p, 16); if (ref_version != 3) { p += ref_size; continue; } referrals[i].proximity = SVAL(p, 8); referrals[i].ttl = SVAL(p, 10); if (p + node_offset > endp) { status = NT_STATUS_INVALID_NETWORK_RESPONSE; goto out; } clistr_pull_talloc(referrals, (const char *)rdata, recv_flags2, &referrals[i].dfspath, p+node_offset, PTR_DIFF(endp, p+node_offset), STR_TERMINATE|STR_UNICODE); if (!referrals[i].dfspath) { status = map_nt_error_from_unix(errno); goto out; } p += ref_size; } if (i < num_referrals) { status = NT_STATUS_INVALID_NETWORK_RESPONSE; goto out; } } *num_refs = num_referrals; *refs = referrals; out: TALLOC_FREE(frame); return status; } ",0 "static void netlink_set_status(struct nl_mmap_hdr *hdr, enum nl_mmap_status status) { hdr->nm_status = status; flush_dcache_page(pgvec_to_page(hdr)); smp_wmb(); } ",0 "static void prb_freeze_queue(struct tpacket_kbdq_core *pkc, struct packet_sock *po) { pkc->reset_pending_on_curr_blk = 1; po->stats.stats3.tp_freeze_q_cnt++; } ",0 "static void nfs4_xdr_enc_readlink(struct rpc_rqst *req, struct xdr_stream *xdr, const struct nfs4_readlink *args) { struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_readlink(xdr, args, req, &hdr); xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages, args->pgbase, args->pglen); encode_nops(&hdr); } ",0 "void BaseRenderingContext2D::ClipInternal(const Path& path, const String& winding_rule_string) { PaintCanvas* c = DrawingCanvas(); if (!c) { return; } if (!GetState().IsTransformInvertible()) { return; } SkPath sk_path = path.GetSkPath(); sk_path.setFillType(ParseWinding(winding_rule_string)); ModifiableState().ClipPath(sk_path, clip_antialiasing_); c->clipPath(sk_path, SkClipOp::kIntersect, clip_antialiasing_ == kAntiAliased); } ",0 "static int cuse_release(struct inode *inode, struct file *file) { struct fuse_file *ff = file->private_data; struct fuse_conn *fc = ff->fc; fuse_sync_release(ff, file->f_flags); fuse_conn_put(fc); return 0; } ",0 "v8::Local RectToV8Object(v8::Isolate* isolate, const gfx::Rect& rect) { v8::Local result(v8::Object::New(isolate)); result->Set(CreateV8String(isolate, ""left""), v8::Integer::New(isolate, rect.x())); result->Set(CreateV8String(isolate, ""top""), v8::Integer::New(isolate, rect.y())); result->Set(CreateV8String(isolate, ""width""), v8::Integer::New(isolate, rect.width())); result->Set(CreateV8String(isolate, ""height""), v8::Integer::New(isolate, rect.height())); return result; } ",0 "void tls1_set_cert_validity(SSL *s) { tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_RSA_ENC); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_RSA_SIGN); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_DSA_SIGN); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_DH_RSA); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_DH_DSA); tls1_check_chain(s, NULL, NULL, NULL, SSL_PKEY_ECC); } ",0 "static unsigned long ifname_compare(const char *_a, const char *_b, const char *_mask) { #ifdef CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS unsigned long ret = ifname_compare_aligned(_a, _b, _mask); #else unsigned long ret = 0; const u16 *a = (const u16 *)_a; const u16 *b = (const u16 *)_b; const u16 *mask = (const u16 *)_mask; int i; for (i = 0; i < IFNAMSIZ/sizeof(u16); i++) ret |= (a[i] ^ b[i]) & mask[i]; #endif return ret; } ",0 "bool ExtensionPrefs::IsBlacklistedExtensionAcknowledged( const std::string& extension_id) { return ReadExtensionPrefBoolean(extension_id, kPrefBlacklistAcknowledged); } ",0 "void Cache::addToLiveResourcesSize(CachedResource* resource) { m_liveSize += resource->size(); m_deadSize -= resource->size(); } ",0 "FLAC__bool read_metadata_seektable_(FLAC__StreamDecoder *decoder, FLAC__bool is_last, unsigned length) { FLAC__uint32 i, x; FLAC__uint64 xx; FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); decoder->private_->seek_table.type = FLAC__METADATA_TYPE_SEEKTABLE; decoder->private_->seek_table.is_last = is_last; decoder->private_->seek_table.length = length; decoder->private_->seek_table.data.seek_table.num_points = length / FLAC__STREAM_METADATA_SEEKPOINT_LENGTH; /* use realloc since we may pass through here several times (e.g. after seeking) */ if(0 == (decoder->private_->seek_table.data.seek_table.points = safe_realloc_mul_2op_(decoder->private_->seek_table.data.seek_table.points, decoder->private_->seek_table.data.seek_table.num_points, /*times*/sizeof(FLAC__StreamMetadata_SeekPoint)))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } for(i = 0; i < decoder->private_->seek_table.data.seek_table.num_points; i++) { if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_SAMPLE_NUMBER_LEN)) return false; /* read_callback_ sets the state for us */ decoder->private_->seek_table.data.seek_table.points[i].sample_number = xx; if(!FLAC__bitreader_read_raw_uint64(decoder->private_->input, &xx, FLAC__STREAM_METADATA_SEEKPOINT_STREAM_OFFSET_LEN)) return false; /* read_callback_ sets the state for us */ decoder->private_->seek_table.data.seek_table.points[i].stream_offset = xx; if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, FLAC__STREAM_METADATA_SEEKPOINT_FRAME_SAMPLES_LEN)) return false; /* read_callback_ sets the state for us */ decoder->private_->seek_table.data.seek_table.points[i].frame_samples = x; } length -= (decoder->private_->seek_table.data.seek_table.num_points * FLAC__STREAM_METADATA_SEEKPOINT_LENGTH); /* if there is a partial point left, skip over it */ if(length > 0) { /*@@@ do a send_error_to_client_() here? there's an argument for either way */ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length)) return false; /* read_callback_ sets the state for us */ } return true; } ",0 "DevToolsWindow::DevToolsWindow(Profile* profile, WebContents* main_web_contents, DevToolsUIBindings* bindings, WebContents* inspected_web_contents, bool can_dock) : profile_(profile), main_web_contents_(main_web_contents), toolbox_web_contents_(nullptr), bindings_(bindings), browser_(nullptr), is_docked_(true), can_dock_(can_dock), close_on_detach_(true), life_stage_(can_dock ? kNotLoaded : kIsDockedSet), action_on_load_(DevToolsToggleAction::NoOp()), intercepted_page_beforeunload_(false), ready_for_test_(false) { main_web_contents_->SetDelegate(this); bindings_->SetDelegate(this); data_use_measurement::DataUseWebContentsObserver::CreateForWebContents( main_web_contents_); zoom::ZoomController::CreateForWebContents(main_web_contents_); zoom::ZoomController::FromWebContents(main_web_contents_) ->SetShowsNotificationBubble(false); g_instances.Get().push_back(this); if (inspected_web_contents) inspected_contents_observer_.reset( new ObserverWithAccessor(inspected_web_contents)); if (can_dock_ && inspected_web_contents) { content::RenderWidgetHostView* inspected_view = inspected_web_contents->GetRenderWidgetHostView(); if (inspected_view && main_web_contents_->GetRenderWidgetHostView()) { gfx::Size size = inspected_view->GetViewBounds().size(); main_web_contents_->GetRenderWidgetHostView()->SetSize(size); } } event_forwarder_.reset(new DevToolsEventForwarder(this)); task_manager::WebContentsTags::CreateForDevToolsContents(main_web_contents_); std::vector> copy( g_creation_callbacks.Get()); for (const auto& callback : copy) callback.Run(this); } ",0 "void P2PQuicTransportImpl::set_crypto_client_config( std::unique_ptr crypto_client_config) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); crypto_client_config_ = std::move(crypto_client_config); } ",0 "static int ext4_quota_off(struct super_block *sb, int type) { struct inode *inode = sb_dqopt(sb)->files[type]; handle_t *handle; /* Force all delayed allocation blocks to be allocated. * Caller already holds s_umount sem */ if (test_opt(sb, DELALLOC)) sync_filesystem(sb); if (!inode) goto out; /* Update modification times of quota files when userspace can * start looking at them */ handle = ext4_journal_start(inode, 1); if (IS_ERR(handle)) goto out; inode->i_mtime = inode->i_ctime = CURRENT_TIME; ext4_mark_inode_dirty(handle, inode); ext4_journal_stop(handle); out: return dquot_quota_off(sb, type); } ",0 "void RenderViewImpl::PopulateDocumentStateFromPending( DocumentState* document_state) { const ViewMsg_Navigate_Params& params = *pending_navigation_params_.get(); document_state->set_request_time(params.request_time); if (!params.url.SchemeIs(chrome::kJavaScriptScheme) && params.navigation_type == ViewMsg_Navigate_Type::RESTORE) { document_state->set_cache_policy_override( WebURLRequest::UseProtocolCachePolicy); } if (IsReload(params)) document_state->set_load_type(DocumentState::RELOAD); else if (!params.state.empty()) document_state->set_load_type(DocumentState::HISTORY_LOAD); else document_state->set_load_type(DocumentState::NORMAL_LOAD); document_state->set_referrer_policy(params.referrer.policy); document_state->set_is_overriding_user_agent(params.is_overriding_user_agent); document_state->set_must_reset_scroll_and_scale_state( params.navigation_type == ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); document_state->set_can_load_local_resources(params.can_load_local_resources); } ",0 "void notifyFormRemovedFromTree(const T& elements, Node& root) { for (const auto& element : elements) element->formRemovedFromTree(root); } ",0 "error::Error GLES2DecoderImpl::HandleGetAttachedShaders( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::GetAttachedShaders& c = *static_cast(cmd_data); uint32 result_size = c.result_size; GLuint program_id = static_cast(c.program); Program* program = GetProgramInfoNotShader( program_id, ""glGetAttachedShaders""); if (!program) { return error::kNoError; } typedef cmds::GetAttachedShaders::Result Result; uint32 max_count = Result::ComputeMaxResults(result_size); Result* result = GetSharedMemoryAs( c.result_shm_id, c.result_shm_offset, Result::ComputeSize(max_count)); if (!result) { return error::kOutOfBounds; } if (result->size != 0) { return error::kInvalidArguments; } GLsizei count = 0; glGetAttachedShaders( program->service_id(), max_count, &count, result->GetData()); for (GLsizei ii = 0; ii < count; ++ii) { if (!shader_manager()->GetClientId(result->GetData()[ii], &result->GetData()[ii])) { NOTREACHED(); return error::kGenericError; } } result->SetNumResults(count); return error::kNoError; } ",0 "static int nfc_genl_send_target(struct sk_buff *msg, struct nfc_target *target, struct netlink_callback *cb, int flags) { void *hdr; hdr = genlmsg_put(msg, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, &nfc_genl_family, flags, NFC_CMD_GET_TARGET); if (!hdr) return -EMSGSIZE; genl_dump_check_consistent(cb, hdr); if (nla_put_u32(msg, NFC_ATTR_TARGET_INDEX, target->idx) || nla_put_u32(msg, NFC_ATTR_PROTOCOLS, target->supported_protocols) || nla_put_u16(msg, NFC_ATTR_TARGET_SENS_RES, target->sens_res) || nla_put_u8(msg, NFC_ATTR_TARGET_SEL_RES, target->sel_res)) goto nla_put_failure; if (target->nfcid1_len > 0 && nla_put(msg, NFC_ATTR_TARGET_NFCID1, target->nfcid1_len, target->nfcid1)) goto nla_put_failure; if (target->sensb_res_len > 0 && nla_put(msg, NFC_ATTR_TARGET_SENSB_RES, target->sensb_res_len, target->sensb_res)) goto nla_put_failure; if (target->sensf_res_len > 0 && nla_put(msg, NFC_ATTR_TARGET_SENSF_RES, target->sensf_res_len, target->sensf_res)) goto nla_put_failure; if (target->is_iso15693) { if (nla_put_u8(msg, NFC_ATTR_TARGET_ISO15693_DSFID, target->iso15693_dsfid) || nla_put(msg, NFC_ATTR_TARGET_ISO15693_UID, sizeof(target->iso15693_uid), target->iso15693_uid)) goto nla_put_failure; } genlmsg_end(msg, hdr); return 0; nla_put_failure: genlmsg_cancel(msg, hdr); return -EMSGSIZE; } ",0 "ar6000_init_module(void) { static int probed = 0; int r; OSDRV_CALLBACKS osdrvCallbacks; a_module_debug_support_init(); #ifdef DEBUG /* check for debug mask overrides */ if (debughtc != 0) { ATH_DEBUG_SET_DEBUG_MASK(htc,debughtc); } if (debugbmi != 0) { ATH_DEBUG_SET_DEBUG_MASK(bmi,debugbmi); } if (debughif != 0) { ATH_DEBUG_SET_DEBUG_MASK(hif,debughif); } if (debugdriver != 0) { ATH_DEBUG_SET_DEBUG_MASK(driver,debugdriver); } #endif A_REGISTER_MODULE_DEBUG_INFO(driver); A_MEMZERO(&osdrvCallbacks,sizeof(osdrvCallbacks)); osdrvCallbacks.deviceInsertedHandler = ar6000_avail_ev; osdrvCallbacks.deviceRemovedHandler = ar6000_unavail_ev; #ifdef CONFIG_PM osdrvCallbacks.deviceSuspendHandler = ar6000_suspend_ev; osdrvCallbacks.deviceResumeHandler = ar6000_resume_ev; osdrvCallbacks.devicePowerChangeHandler = ar6000_power_change_ev; #endif #ifdef DEBUG /* Set the debug flags if specified at load time */ if(debugflags != 0) { g_dbg_flags = debugflags; } #endif if (probed) { return -ENODEV; } probed++; #ifdef ADAPTIVE_POWER_THROUGHPUT_CONTROL memset(&aptcTR, 0, sizeof(APTC_TRAFFIC_RECORD)); #endif /* ADAPTIVE_POWER_THROUGHPUT_CONTROL */ r = HIFInit(&osdrvCallbacks); if (r) return r; return 0; } ",0 "static CURLcode smtp_disconnect(struct connectdata *conn, bool dead_connection) { struct smtp_conn *smtpc = &conn->proto.smtpc; /* We cannot send quit unconditionally. If this connection is stale or bad in any way, sending quit and waiting around here will make the disconnect wait in vain and cause more problems than we need to. */ /* The SMTP session may or may not have been allocated/setup at this point! */ if(!dead_connection && smtpc->pp.conn && smtpc->pp.conn->bits.protoconnstart) if(!smtp_perform_quit(conn)) (void)smtp_block_statemach(conn); /* ignore errors on QUIT */ /* Disconnect from the server */ Curl_pp_disconnect(&smtpc->pp); /* Cleanup the SASL module */ Curl_sasl_cleanup(conn, smtpc->sasl.authused); /* Cleanup our connection based variables */ Curl_safefree(smtpc->domain); return CURLE_OK; } ",0 "generate_x931 (RSA_secret_key *sk, unsigned int nbits, unsigned long e_value, gcry_sexp_t deriveparms, int *swapped) { gcry_mpi_t p, q; /* The two primes. */ gcry_mpi_t e; /* The public exponent. */ gcry_mpi_t n; /* The public key. */ gcry_mpi_t d; /* The private key */ gcry_mpi_t u; /* The inverse of p and q. */ gcry_mpi_t pm1; /* p - 1 */ gcry_mpi_t qm1; /* q - 1 */ gcry_mpi_t phi; /* Euler totient. */ gcry_mpi_t f, g; /* Helper. */ *swapped = 0; if (e_value == 1) /* Alias for a secure value. */ e_value = 65537; /* Point 1 of section 4.1: k = 1024 + 256s with S >= 0 */ if (nbits < 1024 || (nbits % 256)) return GPG_ERR_INV_VALUE; /* Point 2: 2 <= bitlength(e) < 2^{k-2} Note that we do not need to check the upper bound because we use an unsigned long for E and thus there is no way for E to reach that limit. */ if (e_value < 3) return GPG_ERR_INV_VALUE; /* Our implementation requires E to be odd. */ if (!(e_value & 1)) return GPG_ERR_INV_VALUE; /* Point 3: e > 0 or e 0 if it is to be randomly generated. We support only a fixed E and thus there is no need for an extra test. */ /* Compute or extract the derive parameters. */ { gcry_mpi_t xp1 = NULL; gcry_mpi_t xp2 = NULL; gcry_mpi_t xp = NULL; gcry_mpi_t xq1 = NULL; gcry_mpi_t xq2 = NULL; gcry_mpi_t xq = NULL; gcry_mpi_t tmpval; if (!deriveparms) { /* Not given: Generate them. */ xp = gen_x931_parm_xp (nbits/2); /* Make sure that |xp - xq| > 2^{nbits - 100} holds. */ tmpval = mpi_snew (nbits/2); do { _gcry_mpi_release (xq); xq = gen_x931_parm_xp (nbits/2); mpi_sub (tmpval, xp, xq); } while (mpi_get_nbits (tmpval) <= (nbits/2 - 100)); _gcry_mpi_release (tmpval); xp1 = gen_x931_parm_xi (); xp2 = gen_x931_parm_xi (); xq1 = gen_x931_parm_xi (); xq2 = gen_x931_parm_xi (); } else { /* Parameters to derive the key are given. */ /* Note that we explicitly need to setup the values of tbl because some compilers (e.g. OpenWatcom, IRIX) don't allow to initialize a structure with automatic variables. */ struct { const char *name; gcry_mpi_t *value; } tbl[] = { { ""Xp1"" }, { ""Xp2"" }, { ""Xp"" }, { ""Xq1"" }, { ""Xq2"" }, { ""Xq"" }, { NULL } }; int idx; gcry_sexp_t oneparm; tbl[0].value = &xp1; tbl[1].value = &xp2; tbl[2].value = &xp; tbl[3].value = &xq1; tbl[4].value = &xq2; tbl[5].value = &xq; for (idx=0; tbl[idx].name; idx++) { oneparm = sexp_find_token (deriveparms, tbl[idx].name, 0); if (oneparm) { *tbl[idx].value = sexp_nth_mpi (oneparm, 1, GCRYMPI_FMT_USG); sexp_release (oneparm); } } for (idx=0; tbl[idx].name; idx++) if (!*tbl[idx].value) break; if (tbl[idx].name) { /* At least one parameter is missing. */ for (idx=0; tbl[idx].name; idx++) _gcry_mpi_release (*tbl[idx].value); return GPG_ERR_MISSING_VALUE; } } e = mpi_alloc_set_ui (e_value); /* Find two prime numbers. */ p = _gcry_derive_x931_prime (xp, xp1, xp2, e, NULL, NULL); q = _gcry_derive_x931_prime (xq, xq1, xq2, e, NULL, NULL); _gcry_mpi_release (xp); xp = NULL; _gcry_mpi_release (xp1); xp1 = NULL; _gcry_mpi_release (xp2); xp2 = NULL; _gcry_mpi_release (xq); xq = NULL; _gcry_mpi_release (xq1); xq1 = NULL; _gcry_mpi_release (xq2); xq2 = NULL; if (!p || !q) { _gcry_mpi_release (p); _gcry_mpi_release (q); _gcry_mpi_release (e); return GPG_ERR_NO_PRIME; } } /* Compute the public modulus. We make sure that p is smaller than q to allow the use of the CRT. */ if (mpi_cmp (p, q) > 0 ) { mpi_swap (p, q); *swapped = 1; } n = mpi_new (nbits); mpi_mul (n, p, q); /* Compute the Euler totient: phi = (p-1)(q-1) */ pm1 = mpi_snew (nbits/2); qm1 = mpi_snew (nbits/2); phi = mpi_snew (nbits); mpi_sub_ui (pm1, p, 1); mpi_sub_ui (qm1, q, 1); mpi_mul (phi, pm1, qm1); g = mpi_snew (nbits); gcry_assert (mpi_gcd (g, e, phi)); /* Compute: f = lcm(p-1,q-1) = phi / gcd(p-1,q-1) */ mpi_gcd (g, pm1, qm1); f = pm1; pm1 = NULL; _gcry_mpi_release (qm1); qm1 = NULL; mpi_fdiv_q (f, phi, g); _gcry_mpi_release (phi); phi = NULL; d = g; g = NULL; /* Compute the secret key: d = e^{-1} mod lcm(p-1,q-1) */ mpi_invm (d, e, f); /* Compute the inverse of p and q. */ u = f; f = NULL; mpi_invm (u, p, q ); if( DBG_CIPHER ) { if (*swapped) log_debug (""p and q are swapped\n""); log_mpidump("" p"", p ); log_mpidump("" q"", q ); log_mpidump("" n"", n ); log_mpidump("" e"", e ); log_mpidump("" d"", d ); log_mpidump("" u"", u ); } sk->n = n; sk->e = e; sk->p = p; sk->q = q; sk->d = d; sk->u = u; /* Now we can test our keys. */ if (test_keys (sk, nbits - 64)) { _gcry_mpi_release (sk->n); sk->n = NULL; _gcry_mpi_release (sk->e); sk->e = NULL; _gcry_mpi_release (sk->p); sk->p = NULL; _gcry_mpi_release (sk->q); sk->q = NULL; _gcry_mpi_release (sk->d); sk->d = NULL; _gcry_mpi_release (sk->u); sk->u = NULL; fips_signal_error (""self-test after key generation failed""); return GPG_ERR_SELFTEST_FAILED; } return 0; } ",0 "static bool cmd_nop(IDEState *s, uint8_t cmd) { return true; } ",0 "xmlXPathDebugDumpNodeList(FILE *output, xmlNodePtr cur, int depth) { xmlNodePtr tmp; int i; char shift[100]; for (i = 0;((i < depth) && (i < 25));i++) shift[2 * i] = shift[2 * i + 1] = ' '; shift[2 * i] = shift[2 * i + 1] = 0; if (cur == NULL) { fprintf(output, ""%s"", shift); fprintf(output, ""Node is NULL !\n""); return; } while (cur != NULL) { tmp = cur; cur = cur->next; xmlDebugDumpOneNode(output, tmp, depth); } } ",0 "std::unique_ptr LayerTreeHostImpl::Create( const LayerTreeSettings& settings, LayerTreeHostImplClient* client, TaskRunnerProvider* task_runner_provider, RenderingStatsInstrumentation* rendering_stats_instrumentation, TaskGraphRunner* task_graph_runner, std::unique_ptr mutator_host, int id, scoped_refptr image_worker_task_runner) { return base::WrapUnique(new LayerTreeHostImpl( settings, client, task_runner_provider, rendering_stats_instrumentation, task_graph_runner, std::move(mutator_host), id, std::move(image_worker_task_runner))); } ",0 "bson_iter_overwrite_date_time (bson_iter_t *iter, int64_t value) { BSON_ASSERT (iter); if (ITER_TYPE (iter) == BSON_TYPE_DATE_TIME) { value = BSON_UINT64_TO_LE (value); memcpy ((void *) (iter->raw + iter->d1), &value, sizeof (value)); } } ",0 "static void nfs4_proc_read_setup(struct nfs_read_data *data, struct rpc_message *msg) { data->timestamp = jiffies; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_READ]; } ",0 "static void nfs_inode_remove_request(struct nfs_page *req) { struct inode *inode = req->wb_context->dentry->d_inode; struct nfs_inode *nfsi = NFS_I(inode); spin_lock(&inode->i_lock); if (likely(!PageSwapCache(req->wb_page))) { set_page_private(req->wb_page, 0); ClearPagePrivate(req->wb_page); clear_bit(PG_MAPPED, &req->wb_flags); } nfsi->npages--; spin_unlock(&inode->i_lock); nfs_release_request(req); } ",0 "void BubbleHeaderView::SetDetails(const base::string16& details_text) { std::vector subst; subst.push_back(details_text); subst.push_back(l10n_util::GetStringUTF16(IDS_LEARN_MORE)); std::vector offsets; base::string16 text = base::ReplaceStringPlaceholders( base::ASCIIToUTF16(""$1 $2""), subst, &offsets); security_details_label_->SetText(text); gfx::Range details_range(offsets[1], text.length()); views::StyledLabel::RangeStyleInfo link_style = views::StyledLabel::RangeStyleInfo::CreateForLink(); link_style.disable_line_wrapping = false; security_details_label_->AddStyleRange(details_range, link_style); } ",0 "static bool dprintf_IsQualifierNoDollar(const char *fmt) { #if defined(MP_HAVE_INT_EXTENSIONS) if(!strncmp(fmt, ""I32"", 3) || !strncmp(fmt, ""I64"", 3)) { return TRUE; } #endif switch(*fmt) { case '-': case '+': case ' ': case '#': case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'h': case 'l': case 'L': case 'z': case 'q': case '*': case 'O': #if defined(MP_HAVE_INT_EXTENSIONS) case 'I': #endif return TRUE; default: return FALSE; } } ",0 "void RenderView::zoomLimitsChanged(double minimum_level, double maximum_level) { bool remember = !webview()->mainFrame()->document().isPluginDocument(); int minimum_percent = static_cast( WebView::zoomLevelToZoomFactor(minimum_level) * 100); int maximum_percent = static_cast( WebView::zoomLevelToZoomFactor(maximum_level) * 100); Send(new ViewHostMsg_UpdateZoomLimits( routing_id_, minimum_percent, maximum_percent, remember)); } ",0 "static void DocumentAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueFast(info, WTF::GetPtr(impl->documentAttribute()), impl); } ",0 "void GLES2Implementation::WaitSyncTokenCHROMIUM(const GLbyte* sync_token) { ImplementationBase::WaitSyncToken(sync_token); } ",0 "ScriptProcessorNode* ScriptProcessorNode::Create( BaseAudioContext& context, size_t buffer_size, unsigned number_of_input_channels, unsigned number_of_output_channels, ExceptionState& exception_state) { DCHECK(IsMainThread()); if (context.IsContextClosed()) { context.ThrowExceptionForClosedState(exception_state); return nullptr; } if (number_of_input_channels == 0 && number_of_output_channels == 0) { exception_state.ThrowDOMException( kIndexSizeError, ""number of input channels and output channels cannot both be zero.""); return nullptr; } if (number_of_input_channels > BaseAudioContext::MaxNumberOfChannels()) { exception_state.ThrowDOMException( kIndexSizeError, ""number of input channels ("" + String::Number(number_of_input_channels) + "") exceeds maximum ("" + String::Number(BaseAudioContext::MaxNumberOfChannels()) + "").""); return nullptr; } if (number_of_output_channels > BaseAudioContext::MaxNumberOfChannels()) { exception_state.ThrowDOMException( kIndexSizeError, ""number of output channels ("" + String::Number(number_of_output_channels) + "") exceeds maximum ("" + String::Number(BaseAudioContext::MaxNumberOfChannels()) + "").""); return nullptr; } switch (buffer_size) { case 0: buffer_size = context.HasRealtimeConstraint() ? ChooseBufferSize(context.destination()->CallbackBufferSize()) : 256; break; case 256: case 512: case 1024: case 2048: case 4096: case 8192: case 16384: break; default: exception_state.ThrowDOMException( kIndexSizeError, ""buffer size ("" + String::Number(buffer_size) + "") must be 0 or a power of two between 256 and 16384.""); return nullptr; } ScriptProcessorNode* node = new ScriptProcessorNode( context, context.sampleRate(), buffer_size, number_of_input_channels, number_of_output_channels); if (!node) return nullptr; context.NotifySourceNodeStartedProcessing(node); return node; } ",0 "void AudioHandler::AdjustVolumeByPercent(double adjust_by_percent) { if (!VerifyMixerConnection()) return; DVLOG(1) << ""Adjusting Volume by "" << adjust_by_percent << "" percent""; double volume = mixer_->GetVolumeDb(); double pct = VolumeDbToPercent(volume); if (pct < 0) pct = 0; pct = pct + adjust_by_percent; if (pct > 100.0) pct = 100.0; double new_volume; if (pct <= 0.1) new_volume = kSilenceDb; else new_volume = PercentToVolumeDb(pct); if (new_volume != volume) mixer_->SetVolumeDb(new_volume); } ",1 "bool WebMediaPlayerImpl::IsPrerollAttemptNeeded() { if (highest_ready_state_ >= ReadyState::kReadyStateHaveFutureData) return false; if (highest_ready_state_ <= ReadyState::kReadyStateHaveMetadata && network_state_ != WebMediaPlayer::kNetworkStateLoading) { return true; } if (preroll_attempt_pending_) return true; if (preroll_attempt_start_time_.is_null()) return false; base::TimeDelta preroll_attempt_duration = tick_clock_->NowTicks() - preroll_attempt_start_time_; return preroll_attempt_duration < kPrerollAttemptTimeout; } ",0 "v8::Local ObjectBackedNativeHandler::NewInstance() { return v8::Local::New(GetIsolate(), object_template_) ->NewInstance(); } ",0 "SyncManager::ChangeDelegate::~ChangeDelegate() {} ",0 "static ssize_t free_hugepages_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { struct hstate *h; unsigned long free_huge_pages; int nid; h = kobj_to_hstate(kobj, &nid); if (nid == NUMA_NO_NODE) free_huge_pages = h->free_huge_pages; else free_huge_pages = h->free_huge_pages_node[nid]; return sprintf(buf, ""%lu\n"", free_huge_pages); } ",0 "struct key *request_key_async(struct key_type *type, const char *description, const void *callout_info, size_t callout_len) { return request_key_and_link(type, description, callout_info, callout_len, NULL, NULL, KEY_ALLOC_IN_QUOTA); } ",0 "ZEND_API void zend_ts_hash_apply_with_arguments(TsHashTable *ht TSRMLS_DC, apply_func_args_t apply_func, int num_args, ...) { va_list args; va_start(args, num_args); begin_write(ht); zend_hash_apply_with_arguments(TS_HASH(ht) TSRMLS_CC, apply_func, num_args, args); end_write(ht); va_end(args); } ",0 "void HTMLScriptRunner::executeParsingBlockingScript() { ASSERT(m_document); ASSERT(!isExecutingScript()); ASSERT(m_document->isScriptExecutionReady()); ASSERT(isPendingScriptReady(m_parserBlockingScript)); InsertionPointRecord insertionPointRecord(m_host->inputStream()); executePendingScriptAndDispatchEvent(m_parserBlockingScript, PendingScript::ParsingBlocking); } ",0 "bool Editor::ExecuteCommand(const String& command_name, const String& value) { DCHECK(GetFrame().GetDocument()->IsActive()); if (!CanEdit() && command_name == ""moveToBeginningOfDocument"") return GetFrame().GetEventHandler().BubblingScroll( kScrollUpIgnoringWritingMode, kScrollByDocument); if (!CanEdit() && command_name == ""moveToEndOfDocument"") return GetFrame().GetEventHandler().BubblingScroll( kScrollDownIgnoringWritingMode, kScrollByDocument); if (command_name == ""showGuessPanel"") { GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); GetSpellChecker().ShowSpellingGuessPanel(); return true; } return CreateCommand(command_name).Execute(value); } ",0 "static void __exit michael_mic_exit(void) { crypto_unregister_shash(&alg); } ",0 "String XMLHttpRequest::getResponseHeader(const AtomicString& name, ExceptionState& es) const { if (m_state < HEADERS_RECEIVED) { es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute(""getResponseHeader"", ""XMLHttpRequest"", ""the object's state must not be UNSENT or OPENED."")); return String(); } if (isSetCookieHeader(name) && !securityOrigin()->canLoadLocalResources()) { logConsoleError(scriptExecutionContext(), ""Refused to get unsafe header \"""" + name + ""\""""); return String(); } HTTPHeaderSet accessControlExposeHeaderSet; parseAccessControlExposeHeadersAllowList(m_response.httpHeaderField(""Access-Control-Expose-Headers""), accessControlExposeHeaderSet); if (!m_sameOriginRequest && !isOnAccessControlResponseHeaderWhitelist(name) && !accessControlExposeHeaderSet.contains(name)) { logConsoleError(scriptExecutionContext(), ""Refused to get unsafe header \"""" + name + ""\""""); return String(); } return m_response.httpHeaderField(name); } ",0 "WidgetThumbnail* GetDataForHost(RenderWidgetHost* host) { WidgetThumbnail* wt = GetThumbnailAccessor()->GetProperty( host->property_bag()); if (wt) return wt; GetThumbnailAccessor()->SetProperty(host->property_bag(), WidgetThumbnail()); return GetThumbnailAccessor()->GetProperty(host->property_bag()); } ",0 "bool V8ValueConverter::Strategy::FromV8Number(v8::Local value, base::Value** out) const { return false; } ",0 "void ExtensionSettingsHandler::ExtensionUninstallCanceled() { extension_id_prompting_ = """"; } ",0 "ExtensionFunction::ResponseAction TabsCaptureVisibleTabFunction::Run() { using api::extension_types::ImageDetails; EXTENSION_FUNCTION_VALIDATE(args_); int context_id = extension_misc::kCurrentWindowId; args_->GetInteger(0, &context_id); std::unique_ptr image_details; if (args_->GetSize() > 1) { base::Value* spec = NULL; EXTENSION_FUNCTION_VALIDATE(args_->Get(1, &spec) && spec); image_details = ImageDetails::FromValue(*spec); } std::string error; WebContents* contents = GetWebContentsForID(context_id, &error); if (!contents) return RespondNow(Error(error)); const CaptureResult capture_result = CaptureAsync( contents, image_details.get(), base::BindOnce(&TabsCaptureVisibleTabFunction::CopyFromSurfaceComplete, this)); if (capture_result == OK) { return did_respond() ? AlreadyResponded() : RespondLater(); } return RespondNow(Error(CaptureResultToErrorMessage(capture_result))); } ",0 "static int cpu_cgroup_css_online(struct cgroup_subsys_state *css) { struct task_group *tg = css_tg(css); struct task_group *parent = css_tg(css_parent(css)); if (parent) sched_online_group(tg, parent); return 0; } ",0 "bool Document::haveRenderBlockingStylesheetsLoaded() const { if (RuntimeEnabledFeatures::cssInBodyDoesNotBlockPaintEnabled()) return m_styleEngine->haveRenderBlockingStylesheetsLoaded(); return m_styleEngine->haveScriptBlockingStylesheetsLoaded(); } ",0 "static int ext4_link(struct dentry *old_dentry, struct inode *dir, struct dentry *dentry) { handle_t *handle; struct inode *inode = old_dentry->d_inode; int err, retries = 0; if (inode->i_nlink >= EXT4_LINK_MAX) return -EMLINK; dquot_initialize(dir); retry: handle = ext4_journal_start(dir, EXT4_DATA_TRANS_BLOCKS(dir->i_sb) + EXT4_INDEX_EXTRA_TRANS_BLOCKS); if (IS_ERR(handle)) return PTR_ERR(handle); if (IS_DIRSYNC(dir)) ext4_handle_sync(handle); inode->i_ctime = ext4_current_time(inode); ext4_inc_count(handle, inode); ihold(inode); err = ext4_add_entry(handle, dentry, inode); if (!err) { ext4_mark_inode_dirty(handle, inode); d_instantiate(dentry, inode); } else { drop_nlink(inode); iput(inode); } ext4_journal_stop(handle); if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries)) goto retry; return err; } ",0 "static inline bool empty_bucket(const struct tcp_iter_state *st) { return hlist_nulls_empty(&tcp_hashinfo.ehash[st->bucket].chain); } ",0 "static bool register_is_null(struct bpf_reg_state *reg) { return reg->type == SCALAR_VALUE && tnum_equals_const(reg->var_off, 0); } ",0 "int sm_looptest_stop(p_fm_config_conx_hdlt hdl, fm_mgr_type_t mgr, int argc, char *argv[]) { fm_mgr_config_errno_t res; fm_msg_ret_code_t ret_code; uint8_t data[BUF_SZ]; if((res = fm_mgr_simple_query(hdl, FM_ACT_GET, FM_DT_SM_LOOP_TEST_STOP, mgr, BUF_SZ, data, &ret_code)) != FM_CONF_OK) { fprintf(stderr, ""sm_looptest_stop: Failed to retrieve data: \n"" ""\tError:(%d) %s \n\tRet code:(%d) %s\n"", res, fm_mgr_get_error_str(res),ret_code, fm_mgr_get_resp_error_str(ret_code)); } else { printf(""Successfully sent Loop Test STOP control to local SM instance\n""); data[BUF_SZ-1]=0; printf(""%s"", (char*) data); } return 0; } ",0 "SplashCoord Splash::getLineDashPhase() { return state->lineDashPhase; } ",0 "void GraphicsContext::platformDestroy() { } ",0 "DevToolsDownloadManagerDelegate::DevToolsDownloadManagerDelegate() : download_manager_(nullptr), proxy_download_delegate_(nullptr) { g_devtools_manager_delegate = this; } ",0 "xfs_vn_get_link( struct dentry *dentry, struct inode *inode, struct delayed_call *done) { char *link; int error = -ENOMEM; if (!dentry) return ERR_PTR(-ECHILD); link = kmalloc(XFS_SYMLINK_MAXLEN+1, GFP_KERNEL); if (!link) goto out_err; error = xfs_readlink(XFS_I(d_inode(dentry)), link); if (unlikely(error)) goto out_kfree; set_delayed_call(done, kfree_link, link); return link; out_kfree: kfree(link); out_err: return ERR_PTR(error); } ",0 "static void virtio_gpu_reset(VirtIODevice *vdev) { VirtIOGPU *g = VIRTIO_GPU(vdev); struct virtio_gpu_simple_resource *res, *tmp; int i; g->enable = 0; QTAILQ_FOREACH_SAFE(res, &g->reslist, next, tmp) { virtio_gpu_resource_destroy(g, res); } for (i = 0; i < g->conf.max_outputs; i++) { #if 0 g->req_state[i].x = 0; g->req_state[i].y = 0; if (i == 0) { g->req_state[0].width = 1024; g->req_state[0].height = 768; } else { g->req_state[i].width = 0; g->req_state[i].height = 0; } #endif g->scanout[i].resource_id = 0; g->scanout[i].width = 0; g->scanout[i].height = 0; g->scanout[i].x = 0; g->scanout[i].y = 0; g->scanout[i].ds = NULL; } g->enabled_output_bitmask = 1; #ifdef CONFIG_VIRGL if (g->use_virgl_renderer) { virtio_gpu_virgl_reset(g); g->use_virgl_renderer = 0; } #endif } ",0 "void AutoFillManager::OnLoadedAutoFillHeuristics( const std::string& heuristic_xml) { UploadRequired upload_required; FormStructure::ParseQueryResponse(heuristic_xml, form_structures_.get(), &upload_required); } ",0 "static void kvp_update_file(int pool) { FILE *filep; size_t bytes_written; /* * We are going to write our in-memory registry out to * disk; acquire the lock first. */ kvp_acquire_lock(pool); filep = fopen(kvp_file_info[pool].fname, ""w""); if (!filep) { kvp_release_lock(pool); syslog(LOG_ERR, ""Failed to open file, pool: %d"", pool); exit(EXIT_FAILURE); } bytes_written = fwrite(kvp_file_info[pool].records, sizeof(struct kvp_record), kvp_file_info[pool].num_records, filep); if (ferror(filep) || fclose(filep)) { kvp_release_lock(pool); syslog(LOG_ERR, ""Failed to write file, pool: %d"", pool); exit(EXIT_FAILURE); } kvp_release_lock(pool); } ",0 "static struct mempolicy *mpol_new(unsigned short mode, unsigned short flags, nodemask_t *nodes) { struct mempolicy *policy; pr_debug(""setting mode %d flags %d nodes[0] %lx\n"", mode, flags, nodes ? nodes_addr(*nodes)[0] : NUMA_NO_NODE); if (mode == MPOL_DEFAULT) { if (nodes && !nodes_empty(*nodes)) return ERR_PTR(-EINVAL); return NULL; } VM_BUG_ON(!nodes); /* * MPOL_PREFERRED cannot be used with MPOL_F_STATIC_NODES or * MPOL_F_RELATIVE_NODES if the nodemask is empty (local allocation). * All other modes require a valid pointer to a non-empty nodemask. */ if (mode == MPOL_PREFERRED) { if (nodes_empty(*nodes)) { if (((flags & MPOL_F_STATIC_NODES) || (flags & MPOL_F_RELATIVE_NODES))) return ERR_PTR(-EINVAL); } } else if (mode == MPOL_LOCAL) { if (!nodes_empty(*nodes) || (flags & MPOL_F_STATIC_NODES) || (flags & MPOL_F_RELATIVE_NODES)) return ERR_PTR(-EINVAL); mode = MPOL_PREFERRED; } else if (nodes_empty(*nodes)) return ERR_PTR(-EINVAL); policy = kmem_cache_alloc(policy_cache, GFP_KERNEL); if (!policy) return ERR_PTR(-ENOMEM); atomic_set(&policy->refcnt, 1); policy->mode = mode; policy->flags = flags; return policy; } ",0 "dbus_g_proxy_manager_unregister (DBusGProxyManager *manager, DBusGProxy *proxy) { DBusGProxyList *list; DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy); char *tri; LOCK_MANAGER (manager); #ifndef G_DISABLE_CHECKS if (manager->proxy_lists == NULL) { g_warning (""Trying to unregister a proxy but there aren't any registered""); return; } #endif tri = tristring_from_proxy (proxy); list = g_hash_table_lookup (manager->proxy_lists, tri); #ifndef G_DISABLE_CHECKS if (list == NULL) { g_warning (""Trying to unregister a proxy but it isn't registered""); return; } #endif g_assert (g_slist_find (list->proxies, proxy) != NULL); list->proxies = g_slist_remove (list->proxies, proxy); g_assert (g_slist_find (list->proxies, proxy) == NULL); if (!priv->for_owner) { if (!priv->associated) { GSList *link; if (priv->name_call != 0) { dbus_g_proxy_cancel_call (manager->bus_proxy, priv->name_call); priv->name_call = 0; } else { link = g_slist_find (manager->unassociated_proxies, proxy); if (link != NULL) { manager->unassociated_proxies = g_slist_delete_link ( manager->unassociated_proxies, link); } } } else { g_assert (priv->name_call == 0); dbus_g_proxy_manager_unmonitor_name_owner (manager, priv->name); } } if (list->proxies == NULL) { char *rule; g_hash_table_remove (manager->proxy_lists, tri); rule = g_proxy_get_signal_match_rule (proxy); dbus_bus_remove_match (manager->connection, rule, NULL); g_free (rule); if (priv->name) { guint *refcount; refcount = g_hash_table_lookup (manager->owner_match_rules, priv->name); (*refcount)--; if (*refcount == 0) { rule = get_owner_match_rule (priv->name); dbus_bus_remove_match (manager->connection, rule, NULL); g_free (rule); g_hash_table_remove (manager->owner_match_rules, priv->name); } } } if (g_hash_table_size (manager->proxy_lists) == 0) { g_hash_table_destroy (manager->proxy_lists); manager->proxy_lists = NULL; } if (manager->owner_match_rules != NULL && g_hash_table_size (manager->owner_match_rules) == 0) { g_hash_table_destroy (manager->owner_match_rules); manager->owner_match_rules = NULL; } g_free (tri); UNLOCK_MANAGER (manager); } ",0 "static void tg3_mem_rx_release(struct tg3 *tp) { int i; for (i = 0; i < tp->irq_max; i++) { struct tg3_napi *tnapi = &tp->napi[i]; tg3_rx_prodring_fini(tp, &tnapi->prodring); if (!tnapi->rx_rcb) continue; dma_free_coherent(&tp->pdev->dev, TG3_RX_RCB_RING_BYTES(tp), tnapi->rx_rcb, tnapi->rx_rcb_mapping); tnapi->rx_rcb = NULL; } } ",0 "int fuse_dev_release(struct inode *inode, struct file *file) { struct fuse_dev *fud = fuse_get_dev(file); if (fud) { struct fuse_conn *fc = fud->fc; struct fuse_pqueue *fpq = &fud->pq; LIST_HEAD(to_end); unsigned int i; spin_lock(&fpq->lock); WARN_ON(!list_empty(&fpq->io)); for (i = 0; i < FUSE_PQ_HASH_SIZE; i++) list_splice_init(&fpq->processing[i], &to_end); spin_unlock(&fpq->lock); end_requests(fc, &to_end); /* Are we the last open device? */ if (atomic_dec_and_test(&fc->dev_count)) { WARN_ON(fc->iq.fasync != NULL); fuse_abort_conn(fc, false); } fuse_dev_free(fud); } return 0; } ",0 " bool CheckDownload(Browser* browser, const base::FilePath& downloaded_filename, const base::FilePath& origin_filename) { base::FilePath downloaded_file( DestinationFile(browser, downloaded_filename)); base::FilePath origin_file(OriginFile(origin_filename)); return CheckDownloadFullPaths(browser, downloaded_file, origin_file); } ",0 "size_t NtlmClient::GetNtlmResponseLength(size_t updated_target_info_len) const { if (IsNtlmV2()) { return kNtlmResponseHeaderLenV2 + updated_target_info_len + 4; } return kResponseLenV1; } ",0 "xfs_map_blocks( struct inode *inode, loff_t offset, struct xfs_bmbt_irec *imap, int type) { struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; ssize_t count = 1 << inode->i_blkbits; xfs_fileoff_t offset_fsb, end_fsb; int error = 0; int bmapi_flags = XFS_BMAPI_ENTIRE; int nimaps = 1; if (XFS_FORCED_SHUTDOWN(mp)) return -EIO; ASSERT(type != XFS_IO_COW); if (type == XFS_IO_UNWRITTEN) bmapi_flags |= XFS_BMAPI_IGSTATE; xfs_ilock(ip, XFS_ILOCK_SHARED); ASSERT(ip->i_d.di_format != XFS_DINODE_FMT_BTREE || (ip->i_df.if_flags & XFS_IFEXTENTS)); ASSERT(offset <= mp->m_super->s_maxbytes); if (offset + count > mp->m_super->s_maxbytes) count = mp->m_super->s_maxbytes - offset; end_fsb = XFS_B_TO_FSB(mp, (xfs_ufsize_t)offset + count); offset_fsb = XFS_B_TO_FSBT(mp, offset); error = xfs_bmapi_read(ip, offset_fsb, end_fsb - offset_fsb, imap, &nimaps, bmapi_flags); /* * Truncate an overwrite extent if there's a pending CoW * reservation before the end of this extent. This forces us * to come back to writepage to take care of the CoW. */ if (nimaps && type == XFS_IO_OVERWRITE) xfs_reflink_trim_irec_to_next_cow(ip, offset_fsb, imap); xfs_iunlock(ip, XFS_ILOCK_SHARED); if (error) return error; if (type == XFS_IO_DELALLOC && (!nimaps || isnullstartblock(imap->br_startblock))) { error = xfs_iomap_write_allocate(ip, XFS_DATA_FORK, offset, imap); if (!error) trace_xfs_map_blocks_alloc(ip, offset, count, type, imap); return error; } #ifdef DEBUG if (type == XFS_IO_UNWRITTEN) { ASSERT(nimaps); ASSERT(imap->br_startblock != HOLESTARTBLOCK); ASSERT(imap->br_startblock != DELAYSTARTBLOCK); } #endif if (nimaps) trace_xfs_map_blocks_found(ip, offset, count, type, imap); return 0; } ",0 "void EnableHotwordEffect(const StreamControls& controls, int* effects) { DCHECK(effects); if (controls.hotword_enabled) { #if defined(OS_CHROMEOS) chromeos::AudioDeviceList devices; chromeos::CrasAudioHandler::Get()->GetAudioDevices(&devices); for (const chromeos::AudioDevice& device : devices) { if (device.type == chromeos::AUDIO_TYPE_HOTWORD) { DCHECK(device.is_input); *effects |= media::AudioParameters::HOTWORD; } } #endif } } ",0 "int xt_find_revision(u8 af, const char *name, u8 revision, int target, int *err) { int have_rev, best = -1; mutex_lock(&xt[af].mutex); if (target == 1) have_rev = target_revfn(af, name, revision, &best); else have_rev = match_revfn(af, name, revision, &best); mutex_unlock(&xt[af].mutex); /* Nothing at all? Return 0 to try loading module. */ if (best == -1) { *err = -ENOENT; return 0; } *err = best; if (!have_rev) *err = -EPROTONOSUPPORT; return 1; } ",0 "long long Segment::ParseHeaders() { long long total, available; const int status = m_pReader->Length(&total, &available); if (status < 0) //error return status; assert((total < 0) || (available <= total)); const long long segment_stop = (m_size < 0) ? -1 : m_start + m_size; assert((segment_stop < 0) || (total < 0) || (segment_stop <= total)); assert((segment_stop < 0) || (m_pos <= segment_stop)); for (;;) { if ((total >= 0) && (m_pos >= total)) break; if ((segment_stop >= 0) && (m_pos >= segment_stop)) break; long long pos = m_pos; const long long element_start = pos; if ((pos + 1) > available) return (pos + 1); long len; long long result = GetUIntLength(m_pReader, pos, len); if (result < 0) //error return result; if (result > 0) //underflow (weird) return (pos + 1); if ((segment_stop >= 0) && ((pos + len) > segment_stop)) return E_FILE_FORMAT_INVALID; if ((pos + len) > available) return pos + len; const long long idpos = pos; const long long id = ReadUInt(m_pReader, idpos, len); if (id < 0) //error return id; if (id == 0x0F43B675) //Cluster ID break; pos += len; //consume ID if ((pos + 1) > available) return (pos + 1); result = GetUIntLength(m_pReader, pos, len); if (result < 0) //error return result; if (result > 0) //underflow (weird) return (pos + 1); if ((segment_stop >= 0) && ((pos + len) > segment_stop)) return E_FILE_FORMAT_INVALID; if ((pos + len) > available) return pos + len; const long long size = ReadUInt(m_pReader, pos, len); if (size < 0) //error return size; pos += len; //consume length of size of element const long long element_size = size + pos - element_start; if ((segment_stop >= 0) && ((pos + size) > segment_stop)) return E_FILE_FORMAT_INVALID; if ((pos + size) > available) return pos + size; if (id == 0x0549A966) //Segment Info ID { if (m_pInfo) return E_FILE_FORMAT_INVALID; m_pInfo = new (std::nothrow) SegmentInfo( this, pos, size, element_start, element_size); if (m_pInfo == NULL) return -1; const long status = m_pInfo->Parse(); if (status) return status; } else if (id == 0x0654AE6B) //Tracks ID { if (m_pTracks) return E_FILE_FORMAT_INVALID; m_pTracks = new (std::nothrow) Tracks(this, pos, size, element_start, element_size); if (m_pTracks == NULL) return -1; const long status = m_pTracks->Parse(); if (status) return status; } else if (id == 0x0C53BB6B) //Cues ID { if (m_pCues == NULL) { m_pCues = new (std::nothrow) Cues( this, pos, size, element_start, element_size); if (m_pCues == NULL) return -1; } } else if (id == 0x014D9B74) //SeekHead ID { if (m_pSeekHead == NULL) { m_pSeekHead = new (std::nothrow) SeekHead( this, pos, size, element_start, element_size); if (m_pSeekHead == NULL) return -1; const long status = m_pSeekHead->Parse(); if (status) return status; } } else if (id == 0x0043A770) //Chapters ID { if (m_pChapters == NULL) { m_pChapters = new (std::nothrow) Chapters( this, pos, size, element_start, element_size); if (m_pChapters == NULL) return -1; const long status = m_pChapters->Parse(); if (status) return status; } } m_pos = pos + size; //consume payload } assert((segment_stop < 0) || (m_pos <= segment_stop)); if (m_pInfo == NULL) //TODO: liberalize this behavior return E_FILE_FORMAT_INVALID; if (m_pTracks == NULL) return E_FILE_FORMAT_INVALID; return 0; //success } ",1 "void WebMediaPlayerImpl::ScheduleIdlePauseTimer() { if ((paused_ && !paused_when_hidden_) || !pipeline_controller_.IsSuspended() || !HasAudio()) { return; } #if defined(OS_ANDROID) if (IsRemote()) return; #endif background_pause_timer_.Start(FROM_HERE, base::TimeDelta::FromSeconds(5), this, &WebMediaPlayerImpl::OnPause); } ",0 "static int tg3_ptp_adjtime(struct ptp_clock_info *ptp, s64 delta) { struct tg3 *tp = container_of(ptp, struct tg3, ptp_info); tg3_full_lock(tp, 0); tp->ptp_adjust += delta; tg3_full_unlock(tp); return 0; } ",0 "void ReportAnyInsecureContent( const security_state::VisibleSecurityState& visible_security_state, PageInfo::SiteConnectionStatus* connection_status, base::string16* connection_details) { bool displayed_insecure_content = visible_security_state.displayed_mixed_content; bool ran_insecure_content = visible_security_state.ran_mixed_content; if (!net::IsCertStatusError(visible_security_state.cert_status) || net::IsCertStatusMinorError(visible_security_state.cert_status)) { displayed_insecure_content = displayed_insecure_content || visible_security_state.displayed_content_with_cert_errors; ran_insecure_content = ran_insecure_content || visible_security_state.ran_content_with_cert_errors; } if (ran_insecure_content) { *connection_status = PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE; connection_details->assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, *connection_details, l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR))); return; } if (visible_security_state.contained_mixed_form) { *connection_status = PageInfo::SITE_CONNECTION_STATUS_INSECURE_FORM_ACTION; connection_details->assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, *connection_details, l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_FORM_WARNING))); return; } if (displayed_insecure_content) { *connection_status = PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE; connection_details->assign(l10n_util::GetStringFUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, *connection_details, l10n_util::GetStringUTF16( IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); } } ",0 "sf_readf_int (SNDFILE *sndfile, int *ptr, sf_count_t frames) { SF_PRIVATE *psf ; sf_count_t count, extra ; VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; if (psf->file.mode == SFM_WRITE) { psf->error = SFE_NOT_READMODE ; return 0 ; } ; if (frames <= 0 || psf->read_current >= psf->sf.frames) { psf_memset (ptr, 0, frames * psf->sf.channels * sizeof (int)) ; return 0 ; } ; if (psf->read_int == NULL || psf->seek == NULL) { psf->error = SFE_UNIMPLEMENTED ; return 0 ; } ; if (psf->last_op != SFM_READ) if (psf->seek (psf, SFM_READ, psf->read_current) < 0) return 0 ; count = psf->read_int (psf, ptr, frames * psf->sf.channels) ; if (psf->read_current + count / psf->sf.channels <= psf->sf.frames) psf->read_current += count / psf->sf.channels ; else { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; extra = frames * psf->sf.channels - count ; psf_memset (ptr + count, 0, extra * sizeof (int)) ; psf->read_current = psf->sf.frames ; } ; psf->last_op = SFM_READ ; return count / psf->sf.channels ; } /* sf_readf_int */ ",0 "RenderBlockFlow::~RenderBlockFlow() { } ",0 "bool PrintWebViewHelper::InitPrintSettings(bool fit_to_paper_size) { PrintMsg_PrintPages_Params settings; Send(new PrintHostMsg_GetDefaultPrintSettings(routing_id(), &settings.params)); bool result = true; if (!PrintMsg_Print_Params_IsValid(settings.params)) result = false; ignore_css_margins_ = false; settings.pages.clear(); settings.params.print_scaling_option = blink::WebPrintScalingOptionSourceSize; if (fit_to_paper_size) { settings.params.print_scaling_option = blink::WebPrintScalingOptionFitToPrintableArea; } SetPrintPagesParams(settings); return result; } ",0 "void connect_to_remote(asocket* s, const char* destination) { D(""Connect_to_remote call RS(%d) fd=%d"", s->id, s->fd); apacket* p = get_apacket(); size_t len = strlen(destination) + 1; if (len > (s->get_max_payload() - 1)) { fatal(""destination oversized""); } D(""LS(%d): connect('%s')"", s->id, destination); p->msg.command = A_OPEN; p->msg.arg0 = s->id; p->msg.data_length = len; strcpy((char*)p->data, destination); send_packet(p, s->transport); } ",0 "droproot(const char *username, const char *chroot_dir) { struct passwd *pw = NULL; if (chroot_dir && !username) { fprintf(stderr, ""%s: Chroot without dropping root is insecure\n"", program_name); exit_tcpdump(1); } pw = getpwnam(username); if (pw) { if (chroot_dir) { if (chroot(chroot_dir) != 0 || chdir (""/"") != 0) { fprintf(stderr, ""%s: Couldn't chroot/chdir to '%.64s': %s\n"", program_name, chroot_dir, pcap_strerror(errno)); exit_tcpdump(1); } } #ifdef HAVE_LIBCAP_NG { int ret = capng_change_id(pw->pw_uid, pw->pw_gid, CAPNG_NO_FLAG); if (ret < 0) error(""capng_change_id(): return %d\n"", ret); else fprintf(stderr, ""dropped privs to %s\n"", username); } #else if (initgroups(pw->pw_name, pw->pw_gid) != 0 || setgid(pw->pw_gid) != 0 || setuid(pw->pw_uid) != 0) { fprintf(stderr, ""%s: Couldn't change to '%.32s' uid=%lu gid=%lu: %s\n"", program_name, username, (unsigned long)pw->pw_uid, (unsigned long)pw->pw_gid, pcap_strerror(errno)); exit_tcpdump(1); } else { fprintf(stderr, ""dropped privs to %s\n"", username); } #endif /* HAVE_LIBCAP_NG */ } else { fprintf(stderr, ""%s: Couldn't find user '%.32s'\n"", program_name, username); exit_tcpdump(1); } #ifdef HAVE_LIBCAP_NG /* We don't need CAP_SETUID, CAP_SETGID and CAP_SYS_CHROOT any more. */ capng_updatev( CAPNG_DROP, CAPNG_EFFECTIVE | CAPNG_PERMITTED, CAP_SETUID, CAP_SETGID, CAP_SYS_CHROOT, -1); capng_apply(CAPNG_SELECT_BOTH); #endif /* HAVE_LIBCAP_NG */ } ",0 "void AdjustComponent(int delta, url_parse::Component* component) { if (!component->is_valid()) return; DCHECK(delta >= 0 || component->begin >= -delta); component->begin += delta; } ",0 "status_t HevcParameterSets::parseSps(const uint8_t* data, size_t size) { NALBitReader reader(data, size); reader.skipBits(4); uint8_t maxSubLayersMinus1 = reader.getBitsWithFallback(3, 0); reader.skipBits(1); reader.skipBits(96); if (maxSubLayersMinus1 > 0) { bool subLayerProfilePresentFlag[8]; bool subLayerLevelPresentFlag[8]; for (int i = 0; i < maxSubLayersMinus1; ++i) { subLayerProfilePresentFlag[i] = reader.getBitsWithFallback(1, 0); subLayerLevelPresentFlag[i] = reader.getBitsWithFallback(1, 0); } reader.skipBits(2 * (8 - maxSubLayersMinus1)); for (int i = 0; i < maxSubLayersMinus1; ++i) { if (subLayerProfilePresentFlag[i]) { reader.skipBits(88); } if (subLayerLevelPresentFlag[i]) { reader.skipBits(8); } } } skipUE(&reader); uint8_t chromaFormatIdc = parseUEWithFallback(&reader, 0); mParams.add(kChromaFormatIdc, chromaFormatIdc); if (chromaFormatIdc == 3) { reader.skipBits(1); } skipUE(&reader); skipUE(&reader); if (reader.getBitsWithFallback(1, 0) /* i.e. conformance_window_flag */) { skipUE(&reader); skipUE(&reader); skipUE(&reader); skipUE(&reader); } mParams.add(kBitDepthLumaMinus8, parseUEWithFallback(&reader, 0)); mParams.add(kBitDepthChromaMinus8, parseUEWithFallback(&reader, 0)); size_t log2MaxPicOrderCntLsb = parseUEWithFallback(&reader, 0) + (size_t)4; bool spsSubLayerOrderingInfoPresentFlag = reader.getBitsWithFallback(1, 0); for (uint32_t i = spsSubLayerOrderingInfoPresentFlag ? 0 : maxSubLayersMinus1; i <= maxSubLayersMinus1; ++i) { skipUE(&reader); // sps_max_dec_pic_buffering_minus1[i] skipUE(&reader); // sps_max_num_reorder_pics[i] skipUE(&reader); // sps_max_latency_increase_plus1[i] } skipUE(&reader); // log2_min_luma_coding_block_size_minus3 skipUE(&reader); // log2_diff_max_min_luma_coding_block_size skipUE(&reader); // log2_min_luma_transform_block_size_minus2 skipUE(&reader); // log2_diff_max_min_luma_transform_block_size skipUE(&reader); // max_transform_hierarchy_depth_inter skipUE(&reader); // max_transform_hierarchy_depth_intra if (reader.getBitsWithFallback(1, 0)) { // scaling_list_enabled_flag u(1) if (reader.getBitsWithFallback(1, 0)) { // sps_scaling_list_data_present_flag for (uint32_t sizeId = 0; sizeId < 4; ++sizeId) { for (uint32_t matrixId = 0; matrixId < 6; matrixId += (sizeId == 3) ? 3 : 1) { if (!reader.getBitsWithFallback(1, 1)) { skipUE(&reader); // scaling_list_pred_matrix_id_delta[sizeId][matrixId] } else { uint32_t coefNum = std::min(64, (1 << (4 + (sizeId << 1)))); if (sizeId > 1) { skipSE(&reader); // scaling_list_dc_coef_minus8[sizeId − 2][matrixId] } for (uint32_t i = 0; i < coefNum; ++i) { skipSE(&reader); // scaling_list_delta_coef } } } } } } reader.skipBits(1); // amp_enabled_flag reader.skipBits(1); // sample_adaptive_offset_enabled_flag u(1) if (reader.getBitsWithFallback(1, 0)) { // pcm_enabled_flag reader.skipBits(4); // pcm_sample_bit_depth_luma_minus1 reader.skipBits(4); // pcm_sample_bit_depth_chroma_minus1 u(4) skipUE(&reader); // log2_min_pcm_luma_coding_block_size_minus3 skipUE(&reader); // log2_diff_max_min_pcm_luma_coding_block_size reader.skipBits(1); // pcm_loop_filter_disabled_flag } uint32_t numShortTermRefPicSets = parseUEWithFallback(&reader, 0); uint32_t numPics = 0; for (uint32_t i = 0; i < numShortTermRefPicSets; ++i) { if (i != 0 && reader.getBitsWithFallback(1, 0)) { // inter_ref_pic_set_prediction_flag reader.skipBits(1); // delta_rps_sign skipUE(&reader); // abs_delta_rps_minus1 uint32_t nextNumPics = 0; for (uint32_t j = 0; j <= numPics; ++j) { if (reader.getBitsWithFallback(1, 0) // used_by_curr_pic_flag[j] || reader.getBitsWithFallback(1, 0)) { // use_delta_flag[j] ++nextNumPics; } } numPics = nextNumPics; } else { uint32_t numNegativePics = parseUEWithFallback(&reader, 0); uint32_t numPositivePics = parseUEWithFallback(&reader, 0); if (numNegativePics > UINT32_MAX - numPositivePics) { return ERROR_MALFORMED; } numPics = numNegativePics + numPositivePics; for (uint32_t j = 0; j < numPics; ++j) { skipUE(&reader); // delta_poc_s0|1_minus1[i] reader.skipBits(1); // used_by_curr_pic_s0|1_flag[i] } } } if (reader.getBitsWithFallback(1, 0)) { // long_term_ref_pics_present_flag uint32_t numLongTermRefPicSps = parseUEWithFallback(&reader, 0); for (uint32_t i = 0; i < numLongTermRefPicSps; ++i) { reader.skipBits(log2MaxPicOrderCntLsb); // lt_ref_pic_poc_lsb_sps[i] reader.skipBits(1); // used_by_curr_pic_lt_sps_flag[i] } } reader.skipBits(1); // sps_temporal_mvp_enabled_flag reader.skipBits(1); // strong_intra_smoothing_enabled_flag if (reader.getBitsWithFallback(1, 0)) { // vui_parameters_present_flag if (reader.getBitsWithFallback(1, 0)) { // aspect_ratio_info_present_flag uint32_t aspectRatioIdc = reader.getBitsWithFallback(8, 0); if (aspectRatioIdc == 0xFF /* EXTENDED_SAR */) { reader.skipBits(16); // sar_width reader.skipBits(16); // sar_height } } if (reader.getBitsWithFallback(1, 0)) { // overscan_info_present_flag reader.skipBits(1); // overscan_appropriate_flag } if (reader.getBitsWithFallback(1, 0)) { // video_signal_type_present_flag reader.skipBits(3); // video_format uint32_t videoFullRangeFlag; if (reader.getBitsGraceful(1, &videoFullRangeFlag)) { mParams.add(kVideoFullRangeFlag, videoFullRangeFlag); } if (reader.getBitsWithFallback(1, 0)) { // colour_description_present_flag mInfo = (Info)(mInfo | kInfoHasColorDescription); uint32_t colourPrimaries, transferCharacteristics, matrixCoeffs; if (reader.getBitsGraceful(8, &colourPrimaries)) { mParams.add(kColourPrimaries, colourPrimaries); } if (reader.getBitsGraceful(8, &transferCharacteristics)) { mParams.add(kTransferCharacteristics, transferCharacteristics); if (transferCharacteristics == 16 /* ST 2084 */ || transferCharacteristics == 18 /* ARIB STD-B67 HLG */) { mInfo = (Info)(mInfo | kInfoIsHdr); } } if (reader.getBitsGraceful(8, &matrixCoeffs)) { mParams.add(kMatrixCoeffs, matrixCoeffs); } } } } return reader.overRead() ? ERROR_MALFORMED : OK; } ",0 "int dom_document_preserve_whitespace_read(dom_object *obj, zval **retval TSRMLS_DC) { dom_doc_propsptr doc_prop; ALLOC_ZVAL(*retval); if (obj->document) { doc_prop = dom_get_doc_props(obj->document); ZVAL_BOOL(*retval, doc_prop->preservewhitespace); } else { ZVAL_FALSE(*retval); } return SUCCESS; } ",0 "void ih264d_form_pred_weight_matrix(dec_struct_t *ps_dec) { dec_slice_params_t *ps_cur_slice; UWORD8 uc_num_ref_idx_l0_active, uc_num_ref_idx_l1_active; UWORD8 i, j; UWORD32 *pu4_mat_iwt_ofst; UWORD16 i2_idx; UWORD32 *pui32_weight_offset_l0, *pui32_weight_offset_l1; UWORD32 u4_temp; ps_cur_slice = ps_dec->ps_cur_slice; uc_num_ref_idx_l0_active = ps_cur_slice->u1_num_ref_idx_lx_active[0]; uc_num_ref_idx_l1_active = ps_cur_slice->u1_num_ref_idx_lx_active[1]; pu4_mat_iwt_ofst = ps_dec->pu4_wts_ofsts_mat; if(ps_cur_slice->u1_slice_type == B_SLICE) { for(i = 0; i < uc_num_ref_idx_l0_active; i++) { pui32_weight_offset_l0 = ps_cur_slice->u4_wt_ofst_lx[0][i]; for(j = 0; j < uc_num_ref_idx_l1_active; j++) { pui32_weight_offset_l1 = ps_cur_slice->u4_wt_ofst_lx[1][j]; i2_idx = i * uc_num_ref_idx_l0_active + j; i2_idx = X3(i2_idx); /* u4_temp = (pui32_weight_offset_l0[0] | (pui32_weight_offset_l1[0] << 16)); pu4_mat_iwt_ofst[0] = u4_temp; u4_temp = (pui32_weight_offset_l0[1] | (pui32_weight_offset_l1[1] << 16)); pu4_mat_iwt_ofst[1] = u4_temp; u4_temp = (pui32_weight_offset_l0[2] | (pui32_weight_offset_l1[2] << 16)); pu4_mat_iwt_ofst[2] = u4_temp; pu4_mat_iwt_ofst += 3;*/ pu4_mat_iwt_ofst[0] = pui32_weight_offset_l0[0]; pu4_mat_iwt_ofst[1] = pui32_weight_offset_l1[0]; pu4_mat_iwt_ofst[2] = pui32_weight_offset_l0[1]; pu4_mat_iwt_ofst[3] = pui32_weight_offset_l1[1]; pu4_mat_iwt_ofst[4] = pui32_weight_offset_l0[2]; pu4_mat_iwt_ofst[5] = pui32_weight_offset_l1[2]; pu4_mat_iwt_ofst += 6; } } } else { for(i = 0; i < uc_num_ref_idx_l0_active; i++) { pui32_weight_offset_l0 = ps_cur_slice->u4_wt_ofst_lx[0][i]; i2_idx = X3(i); u4_temp = (UWORD32)pui32_weight_offset_l0[0]; pu4_mat_iwt_ofst[0] = u4_temp; u4_temp = (UWORD32)pui32_weight_offset_l0[1]; pu4_mat_iwt_ofst[2] = u4_temp; u4_temp = (UWORD32)pui32_weight_offset_l0[2]; pu4_mat_iwt_ofst[4] = u4_temp; pu4_mat_iwt_ofst += 6; } } } ",0 "void reference_16x16_dct_2d(int16_t input[256], double output[256]) { for (int i = 0; i < 16; ++i) { double temp_in[16], temp_out[16]; for (int j = 0; j < 16; ++j) temp_in[j] = input[j * 16 + i]; butterfly_16x16_dct_1d(temp_in, temp_out); for (int j = 0; j < 16; ++j) output[j * 16 + i] = temp_out[j]; } for (int i = 0; i < 16; ++i) { double temp_in[16], temp_out[16]; for (int j = 0; j < 16; ++j) temp_in[j] = output[j + i * 16]; butterfly_16x16_dct_1d(temp_in, temp_out); for (int j = 0; j < 16; ++j) output[j + i * 16] = temp_out[j]/2; } } ",0 "void PepperPlatformAudioInput::StartCapture() { DCHECK(main_message_loop_proxy_->BelongsToCurrentThread()); io_message_loop_proxy_->PostTask( FROM_HERE, base::Bind(&PepperPlatformAudioInput::StartCaptureOnIOThread, this)); } ",0 "void WebPagePrivate::enterFullScreenForElement(Element* element) { #if ENABLE(VIDEO) if (!element || (!element->hasTagName(HTMLNames::videoTag) && !containsVideoTags(element))) return; if (m_webSettings->fullScreenVideoCapable()) { enterFullscreenForNode(element); } else { if (transformedActualVisibleSize() != transformedViewportSize()) { m_scaleBeforeFullScreen = currentScale(); m_scrollPositionBeforeFullScreen = m_mainFrame->view()->scrollPosition(); } client()->fullscreenStart(); m_fullscreenVideoNode = element; } #endif } ",0 "static int uvesafb_setup(char *options) { char *this_opt; if (!options || !*options) return 0; while ((this_opt = strsep(&options, "","")) != NULL) { if (!*this_opt) continue; if (!strcmp(this_opt, ""redraw"")) ypan = 0; else if (!strcmp(this_opt, ""ypan"")) ypan = 1; else if (!strcmp(this_opt, ""ywrap"")) ypan = 2; else if (!strcmp(this_opt, ""vgapal"")) pmi_setpal = 0; else if (!strcmp(this_opt, ""pmipal"")) pmi_setpal = 1; else if (!strncmp(this_opt, ""mtrr:"", 5)) mtrr = simple_strtoul(this_opt+5, NULL, 0); else if (!strcmp(this_opt, ""nomtrr"")) mtrr = 0; else if (!strcmp(this_opt, ""nocrtc"")) nocrtc = 1; else if (!strcmp(this_opt, ""noedid"")) noedid = 1; else if (!strcmp(this_opt, ""noblank"")) blank = 0; else if (!strncmp(this_opt, ""vtotal:"", 7)) vram_total = simple_strtoul(this_opt + 7, NULL, 0); else if (!strncmp(this_opt, ""vremap:"", 7)) vram_remap = simple_strtoul(this_opt + 7, NULL, 0); else if (!strncmp(this_opt, ""maxhf:"", 6)) maxhf = simple_strtoul(this_opt + 6, NULL, 0); else if (!strncmp(this_opt, ""maxvf:"", 6)) maxvf = simple_strtoul(this_opt + 6, NULL, 0); else if (!strncmp(this_opt, ""maxclk:"", 7)) maxclk = simple_strtoul(this_opt + 7, NULL, 0); else if (!strncmp(this_opt, ""vbemode:"", 8)) vbemode = simple_strtoul(this_opt + 8, NULL, 0); else if (this_opt[0] >= '0' && this_opt[0] <= '9') { mode_option = this_opt; } else { pr_warn(""unrecognized option %s\n"", this_opt); } } if (mtrr != 3 && mtrr != 0) pr_warn(""uvesafb: mtrr should be set to 0 or 3; %d is unsupported"", mtrr); return 0; } ",0 "grab_cache_page_nowait(struct address_space *mapping, pgoff_t index) { struct page *page = find_get_page(mapping, index); if (page) { if (!TestSetPageLocked(page)) return page; page_cache_release(page); return NULL; } page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~__GFP_FS); if (page && add_to_page_cache_lru(page, mapping, index, GFP_KERNEL)) { page_cache_release(page); page = NULL; } return page; } ",0 "void GLES2DecoderImpl::DoSetDrawRectangleCHROMIUM(GLint x, GLint y, GLint width, GLint height) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER); if (framebuffer) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glSetDrawRectangleCHROMIUM"", ""framebuffer must not be bound""); return; } if (!supports_dc_layers_) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glSetDrawRectangleCHROMIUM"", ""surface doesn't support SetDrawRectangle""); return; } gfx::Rect rect(x, y, width, height); if (!surface_->SetDrawRectangle(rect)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glSetDrawRectangleCHROMIUM"", ""failed on surface""); LOG(ERROR) << ""Context lost because SetDrawRectangleCHROMIUM failed.""; MarkContextLost(error::kUnknown); group_->LoseContexts(error::kUnknown); } OnFboChanged(); } ",0 "mwifiex_update_uap_custom_ie(struct mwifiex_private *priv, struct mwifiex_ie *beacon_ie, u16 *beacon_idx, struct mwifiex_ie *pr_ie, u16 *probe_idx, struct mwifiex_ie *ar_ie, u16 *assoc_idx) { struct mwifiex_ie_list *ap_custom_ie; u8 *pos; u16 len; int ret; ap_custom_ie = kzalloc(sizeof(*ap_custom_ie), GFP_KERNEL); if (!ap_custom_ie) return -ENOMEM; ap_custom_ie->type = cpu_to_le16(TLV_TYPE_MGMT_IE); pos = (u8 *)ap_custom_ie->ie_list; if (beacon_ie) { len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE + le16_to_cpu(beacon_ie->ie_length); memcpy(pos, beacon_ie, len); pos += len; le16_unaligned_add_cpu(&ap_custom_ie->len, len); } if (pr_ie) { len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE + le16_to_cpu(pr_ie->ie_length); memcpy(pos, pr_ie, len); pos += len; le16_unaligned_add_cpu(&ap_custom_ie->len, len); } if (ar_ie) { len = sizeof(struct mwifiex_ie) - IEEE_MAX_IE_SIZE + le16_to_cpu(ar_ie->ie_length); memcpy(pos, ar_ie, len); pos += len; le16_unaligned_add_cpu(&ap_custom_ie->len, len); } ret = mwifiex_update_autoindex_ies(priv, ap_custom_ie); pos = (u8 *)(&ap_custom_ie->ie_list[0].ie_index); if (beacon_ie && *beacon_idx == MWIFIEX_AUTO_IDX_MASK) { /* save beacon ie index after auto-indexing */ *beacon_idx = le16_to_cpu(ap_custom_ie->ie_list[0].ie_index); len = sizeof(*beacon_ie) - IEEE_MAX_IE_SIZE + le16_to_cpu(beacon_ie->ie_length); pos += len; } if (pr_ie && le16_to_cpu(pr_ie->ie_index) == MWIFIEX_AUTO_IDX_MASK) { /* save probe resp ie index after auto-indexing */ *probe_idx = *((u16 *)pos); len = sizeof(*pr_ie) - IEEE_MAX_IE_SIZE + le16_to_cpu(pr_ie->ie_length); pos += len; } if (ar_ie && le16_to_cpu(ar_ie->ie_index) == MWIFIEX_AUTO_IDX_MASK) /* save assoc resp ie index after auto-indexing */ *assoc_idx = *((u16 *)pos); kfree(ap_custom_ie); return ret; } ",0 "void AutocompleteController::UpdateAssociatedKeywords( AutocompleteResult* result) { if (!keyword_provider_) return; std::set keywords; for (ACMatches::iterator match(result->begin()); match != result->end(); ++match) { string16 keyword(match->GetSubstitutingExplicitlyInvokedKeyword(profile_)); if (!keyword.empty()) { keywords.insert(keyword); } else { string16 keyword = match->associated_keyword.get() ? match->associated_keyword->keyword : keyword_provider_->GetKeywordForText(match->fill_into_edit); if (!keyword.empty() && !keywords.count(keyword)) { keywords.insert(keyword); if (!match->associated_keyword.get()) match->associated_keyword.reset(new AutocompleteMatch( keyword_provider_->CreateAutocompleteMatch(match->fill_into_edit, keyword, input_))); } else { match->associated_keyword.reset(); } } } } ",0 "static void megasas_scsi_uninit(PCIDevice *d) { MegasasState *s = MEGASAS(d); if (megasas_use_msix(s)) { msix_uninit(d, &s->mmio_io, &s->mmio_io); } if (megasas_use_msi(s)) { msi_uninit(d); } } ",0 "ExternalProtocolDialog::ExternalProtocolDialog( std::unique_ptr delegate, int render_process_host_id, int routing_id) : delegate_(std::move(delegate)), render_process_host_id_(render_process_host_id), routing_id_(routing_id), creation_time_(base::TimeTicks::Now()) { ChromeLayoutProvider* provider = ChromeLayoutProvider::Get(); set_margins( provider->GetDialogInsetsForContentType(views::TEXT, views::TEXT)); SetLayoutManager(std::make_unique()); DCHECK(delegate_->GetMessageText().empty()); remember_decision_checkbox_ = new views::Checkbox(delegate_->GetCheckboxText()); AddChildView(remember_decision_checkbox_); WebContents* web_contents = tab_util::GetWebContentsByID( render_process_host_id_, routing_id_); if (web_contents) constrained_window::ShowWebModalDialogViews(this, web_contents); chrome::RecordDialogCreation(chrome::DialogIdentifier::EXTERNAL_PROTOCOL); } ",0 "long long Cluster::GetPosition() const { const long long pos = m_element_start - m_pSegment->m_start; assert(pos >= 0); return pos; } ",1 "SplashError Splash::restoreState() { SplashState *oldState; if (!state->next) { return splashErrNoSave; } oldState = state; state = state->next; delete oldState; return splashOk; } ",0 "rdp_process_general_caps(STREAM s) { uint16 pad2octetsB; /* rdp5 flags? */ logger(Protocol, Debug, ""%s()"", __func__); in_uint8s(s, 10); in_uint16_le(s, pad2octetsB); if (!pad2octetsB) g_rdp_version = RDP_V4; } ",0 "void MultibufferDataSource::StopLoader() { DCHECK(render_task_runner_->BelongsToCurrentThread()); SetReader(nullptr); } ",0 " gray_line_to( const FT_Vector* to, PWorker worker ) { gray_render_line( RAS_VAR_ UPSCALE( to->x ), UPSCALE( to->y ) ); return 0; } ",0 "evdns_resolv_conf_parse(int flags, const char *const filename) { if (!current_base) current_base = evdns_base_new(NULL, 0); return evdns_base_resolv_conf_parse(current_base, flags, filename); } ",0 "bool RenderWidgetHostViewGtk::IsPopup() const { return popup_type_ != WebKit::WebPopupTypeNone; } ",0 "GF_Err cprt_dump(GF_Box *a, FILE * trace) { GF_CopyrightBox *p; p = (GF_CopyrightBox *)a; gf_isom_box_dump_start(a, ""CopyrightBox"", trace); fprintf(trace, ""LanguageCode=\""%s\"" CopyrightNotice=\""%s\"">\n"", p->packedLanguageCode, p->notice); gf_isom_box_dump_done(""CopyrightBox"", a, trace); return GF_OK; } ",0 "void Camera3Device::sProcessCaptureResult(const camera3_callback_ops *cb, const camera3_capture_result *result) { Camera3Device *d = const_cast(static_cast(cb)); d->processCaptureResult(result); } ",0 " virtual ~CaptureVideoDecoderTest() { message_loop_->RunAllPending(); } ",0 "SkCodec* SkIcoCodec::NewFromStream(SkStream* stream, Result* result) { std::unique_ptr inputStream(stream); static const uint32_t kIcoDirectoryBytes = 6; static const uint32_t kIcoDirEntryBytes = 16; std::unique_ptr dirBuffer(new uint8_t[kIcoDirectoryBytes]); if (inputStream.get()->read(dirBuffer.get(), kIcoDirectoryBytes) != kIcoDirectoryBytes) { SkCodecPrintf(""Error: unable to read ico directory header.\n""); *result = kIncompleteInput; return nullptr; } const uint16_t numImages = get_short(dirBuffer.get(), 4); if (0 == numImages) { SkCodecPrintf(""Error: No images embedded in ico.\n""); *result = kInvalidInput; return nullptr; } struct Entry { uint32_t offset; uint32_t size; }; SkAutoFree dirEntryBuffer(sk_malloc_flags(sizeof(Entry) * numImages, SK_MALLOC_TEMP)); if (!dirEntryBuffer) { SkCodecPrintf(""Error: OOM allocating ICO directory for %i images.\n"", numImages); *result = kInternalError; return nullptr; } auto* directoryEntries = reinterpret_cast(dirEntryBuffer.get()); for (uint32_t i = 0; i < numImages; i++) { uint8_t entryBuffer[kIcoDirEntryBytes]; if (inputStream->read(entryBuffer, kIcoDirEntryBytes) != kIcoDirEntryBytes) { SkCodecPrintf(""Error: Dir entries truncated in ico.\n""); *result = kIncompleteInput; return nullptr; } uint32_t size = get_int(entryBuffer, 8); uint32_t offset = get_int(entryBuffer, 12); directoryEntries[i].offset = offset; directoryEntries[i].size = size; } *result = kInvalidInput; struct EntryLessThan { bool operator() (Entry a, Entry b) const { return a.offset < b.offset; } }; EntryLessThan lessThan; SkTQSort(directoryEntries, &directoryEntries[numImages - 1], lessThan); uint32_t bytesRead = kIcoDirectoryBytes + numImages * kIcoDirEntryBytes; std::unique_ptr, true>> codecs( new (SkTArray, true>)(numImages)); for (uint32_t i = 0; i < numImages; i++) { uint32_t offset = directoryEntries[i].offset; uint32_t size = directoryEntries[i].size; if (offset < bytesRead) { SkCodecPrintf(""Warning: invalid ico offset.\n""); continue; } if (inputStream.get()->skip(offset - bytesRead) != offset - bytesRead) { SkCodecPrintf(""Warning: could not skip to ico offset.\n""); break; } bytesRead = offset; SkAutoFree buffer(sk_malloc_flags(size, 0)); if (!buffer) { SkCodecPrintf(""Warning: OOM trying to create embedded stream.\n""); break; } if (inputStream->read(buffer.get(), size) != size) { SkCodecPrintf(""Warning: could not create embedded stream.\n""); *result = kIncompleteInput; break; } sk_sp data(SkData::MakeFromMalloc(buffer.release(), size)); std::unique_ptr embeddedStream(new SkMemoryStream(data)); bytesRead += size; SkCodec* codec = nullptr; Result dummyResult; if (SkPngCodec::IsPng((const char*) data->bytes(), data->size())) { codec = SkPngCodec::NewFromStream(embeddedStream.release(), &dummyResult); } else { codec = SkBmpCodec::NewFromIco(embeddedStream.release(), &dummyResult); } if (nullptr != codec) { codecs->push_back().reset(codec); } } if (0 == codecs->count()) { SkCodecPrintf(""Error: could not find any valid embedded ico codecs.\n""); return nullptr; } size_t maxSize = 0; int maxIndex = 0; for (int i = 0; i < codecs->count(); i++) { SkImageInfo info = codecs->operator[](i)->getInfo(); size_t size = info.getSafeSize(info.minRowBytes()); if (size > maxSize) { maxSize = size; maxIndex = i; } } int width = codecs->operator[](maxIndex)->getInfo().width(); int height = codecs->operator[](maxIndex)->getInfo().height(); SkEncodedInfo info = codecs->operator[](maxIndex)->getEncodedInfo(); SkColorSpace* colorSpace = codecs->operator[](maxIndex)->getInfo().colorSpace(); *result = kSuccess; return new SkIcoCodec(width, height, info, codecs.release(), sk_ref_sp(colorSpace)); } ",1 "ExecutionContext* BaseAudioContext::GetExecutionContext() const { return PausableObject::GetExecutionContext(); } ",0 "static gboolean webkitWebViewBaseScrollEvent(GtkWidget* widget, GdkEventScroll* event) { WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); WebKitWebViewBasePrivate* priv = webViewBase->priv; priv->pageProxy->handleWheelEvent(NativeWebWheelEvent(reinterpret_cast(event))); return TRUE; } ",0 "Document* AXNodeObject::getDocument() const { if (!getNode()) return 0; return &getNode()->document(); } ",0 "void RenderFrameHostImpl::ExecuteJavaScriptInIsolatedWorld( const base::string16& javascript, const JavaScriptResultCallback& callback, int world_id) { if (world_id <= ISOLATED_WORLD_ID_GLOBAL || world_id > ISOLATED_WORLD_ID_MAX) { NOTREACHED(); return; } int key = 0; bool request_reply = false; if (!callback.is_null()) { request_reply = true; key = g_next_javascript_callback_id++; javascript_callbacks_.insert(std::make_pair(key, callback)); } Send(new FrameMsg_JavaScriptExecuteRequestInIsolatedWorld( routing_id_, javascript, key, request_reply, world_id)); } ",0 "void RenderView::closeWidgetSoon() { translate_helper_.CancelPendingTranslation(); if (script_can_close_) RenderWidget::closeWidgetSoon(); } ",0 "static inline MagickOffsetType WritePixelCacheRegion( const CacheInfo *magick_restrict cache_info,const MagickOffsetType offset, const MagickSizeType length,const unsigned char *magick_restrict buffer) { register MagickOffsetType i; ssize_t count; #if !defined(MAGICKCORE_HAVE_PWRITE) if (lseek(cache_info->file,offset,SEEK_SET) < 0) return((MagickOffsetType) -1); #endif count=0; for (i=0; i < (MagickOffsetType) length; i+=count) { #if !defined(MAGICKCORE_HAVE_PWRITE) count=write(cache_info->file,buffer+i,(size_t) MagickMin(length-i,(size_t) SSIZE_MAX)); #else count=pwrite(cache_info->file,buffer+i,(size_t) MagickMin(length-i,(size_t) SSIZE_MAX),(off_t) (offset+i)); #endif if (count <= 0) { count=0; if (errno != EINTR) break; } } return(i); } ",0 "static RBinElfSymbol* Elf_(_r_bin_elf_get_symbols_imports)(ELFOBJ *bin, int type) { ut32 shdr_size; int tsize, nsym, ret_ctr = 0, i, j, r, k, newsize; ut64 toffset; ut32 size = 0; RBinElfSymbol *ret = NULL; Elf_(Shdr) *strtab_section = NULL; Elf_(Sym) *sym = NULL; ut8 s[sizeof (Elf_(Sym))] = { 0 }; char *strtab = NULL; if (!bin || !bin->shdr || !bin->ehdr.e_shnum || bin->ehdr.e_shnum == 0xffff) { return (type == R_BIN_ELF_SYMBOLS) ? Elf_(r_bin_elf_get_phdr_symbols) (bin) : Elf_(r_bin_elf_get_phdr_imports) (bin); } if (!UT32_MUL (&shdr_size, bin->ehdr.e_shnum, sizeof (Elf_(Shdr)))) { return false; } if (shdr_size + 8 > bin->size) { return false; } for (i = 0; i < bin->ehdr.e_shnum; i++) { if ((type == R_BIN_ELF_IMPORTS && bin->shdr[i].sh_type == (bin->ehdr.e_type == ET_REL ? SHT_SYMTAB : SHT_DYNSYM)) || (type == R_BIN_ELF_SYMBOLS && bin->shdr[i].sh_type == (Elf_(r_bin_elf_get_stripped) (bin) ? SHT_DYNSYM : SHT_SYMTAB))) { if (bin->shdr[i].sh_link < 1) { /* oops. fix out of range pointers */ continue; } if ((bin->shdr[i].sh_link * sizeof(Elf_(Shdr))) >= shdr_size) { /* oops. fix out of range pointers */ continue; } strtab_section = &bin->shdr[bin->shdr[i].sh_link]; if (strtab_section->sh_size > ST32_MAX || strtab_section->sh_size+8 > bin->size) { bprintf (""size (syms strtab)""); free (ret); free (strtab); return NULL; } if (!strtab) { if (!(strtab = (char *)calloc (1, 8 + strtab_section->sh_size))) { bprintf (""malloc (syms strtab)""); goto beach; } if (strtab_section->sh_offset > bin->size || strtab_section->sh_offset + strtab_section->sh_size > bin->size) { goto beach; } if (r_buf_read_at (bin->b, strtab_section->sh_offset, (ut8*)strtab, strtab_section->sh_size) == -1) { bprintf (""Warning: read (syms strtab)\n""); goto beach; } } newsize = 1 + bin->shdr[i].sh_size; if (newsize < 0 || newsize > bin->size) { bprintf (""invalid shdr %d size\n"", i); goto beach; } nsym = (int)(bin->shdr[i].sh_size / sizeof (Elf_(Sym))); if (nsym < 0) { goto beach; } if (!(sym = (Elf_(Sym) *)calloc (nsym, sizeof (Elf_(Sym))))) { bprintf (""calloc (syms)""); goto beach; } if (!UT32_MUL (&size, nsym, sizeof (Elf_(Sym)))) { goto beach; } if (size < 1 || size > bin->size) { goto beach; } if (bin->shdr[i].sh_offset > bin->size) { goto beach; } if (bin->shdr[i].sh_offset + size > bin->size) { goto beach; } for (j = 0; j < nsym; j++) { int k = 0; r = r_buf_read_at (bin->b, bin->shdr[i].sh_offset + j * sizeof (Elf_(Sym)), s, sizeof (Elf_(Sym))); if (r < 1) { bprintf (""Warning: read (sym)\n""); goto beach; } #if R_BIN_ELF64 sym[j].st_name = READ32 (s, k) sym[j].st_info = READ8 (s, k) sym[j].st_other = READ8 (s, k) sym[j].st_shndx = READ16 (s, k) sym[j].st_value = READ64 (s, k) sym[j].st_size = READ64 (s, k) #else sym[j].st_name = READ32 (s, k) sym[j].st_value = READ32 (s, k) sym[j].st_size = READ32 (s, k) sym[j].st_info = READ8 (s, k) sym[j].st_other = READ8 (s, k) sym[j].st_shndx = READ16 (s, k) #endif } free (ret); ret = calloc (nsym, sizeof (RBinElfSymbol)); if (!ret) { bprintf (""Cannot allocate %d symbols\n"", nsym); goto beach; } for (k = 1, ret_ctr = 0; k < nsym; k++) { if (type == R_BIN_ELF_IMPORTS && sym[k].st_shndx == STN_UNDEF) { if (sym[k].st_value) { toffset = sym[k].st_value; } else if ((toffset = get_import_addr (bin, k)) == -1){ toffset = 0; } tsize = 16; } else if (type == R_BIN_ELF_SYMBOLS && sym[k].st_shndx != STN_UNDEF && ELF_ST_TYPE (sym[k].st_info) != STT_SECTION && ELF_ST_TYPE (sym[k].st_info) != STT_FILE) { tsize = sym[k].st_size; toffset = (ut64)sym[k].st_value; } else { continue; } if (bin->ehdr.e_type == ET_REL) { if (sym[k].st_shndx < bin->ehdr.e_shnum) ret[ret_ctr].offset = sym[k].st_value + bin->shdr[sym[k].st_shndx].sh_offset; } else { ret[ret_ctr].offset = Elf_(r_bin_elf_v2p) (bin, toffset); } ret[ret_ctr].size = tsize; if (sym[k].st_name + 2 > strtab_section->sh_size) { bprintf (""Warning: index out of strtab range\n""); goto beach; } { int rest = ELF_STRING_LENGTH - 1; int st_name = sym[k].st_name; int maxsize = R_MIN (bin->b->length, strtab_section->sh_size); if (st_name < 0 || st_name >= maxsize) { ret[ret_ctr].name[0] = 0; } else { const size_t len = __strnlen (strtab + sym[k].st_name, rest); memcpy (ret[ret_ctr].name, &strtab[sym[k].st_name], len); } } ret[ret_ctr].ordinal = k; ret[ret_ctr].name[ELF_STRING_LENGTH - 2] = '\0'; fill_symbol_bind_and_type (&ret[ret_ctr], &sym[k]); ret[ret_ctr].last = 0; ret_ctr++; } ret[ret_ctr].last = 1; // ugly dirty hack :D R_FREE (strtab); R_FREE (sym); } } if (!ret) { return (type == R_BIN_ELF_SYMBOLS) ? Elf_(r_bin_elf_get_phdr_symbols) (bin) : Elf_(r_bin_elf_get_phdr_imports) (bin); } int max = -1; RBinElfSymbol *aux = NULL; nsym = Elf_(fix_symbols) (bin, ret_ctr, type, &ret); if (nsym == -1) { goto beach; } aux = ret; while (!aux->last) { if ((int)aux->ordinal > max) { max = aux->ordinal; } aux++; } nsym = max; if (type == R_BIN_ELF_IMPORTS) { R_FREE (bin->imports_by_ord); bin->imports_by_ord_size = nsym + 1; bin->imports_by_ord = (RBinImport**)calloc (R_MAX (1, nsym + 1), sizeof (RBinImport*)); } else if (type == R_BIN_ELF_SYMBOLS) { R_FREE (bin->symbols_by_ord); bin->symbols_by_ord_size = nsym + 1; bin->symbols_by_ord = (RBinSymbol**)calloc (R_MAX (1, nsym + 1), sizeof (RBinSymbol*)); } return ret; beach: free (ret); free (sym); free (strtab); return NULL; } ",0 "static int netbk_count_requests(struct xenvif *vif, struct xen_netif_tx_request *first, struct xen_netif_tx_request *txp, int work_to_do) { RING_IDX cons = vif->tx.req_cons; int frags = 0; if (!(first->flags & XEN_NETTXF_more_data)) return 0; do { if (frags >= work_to_do) { netdev_err(vif->dev, ""Need more frags\n""); netbk_fatal_tx_err(vif); return -frags; } if (unlikely(frags >= MAX_SKB_FRAGS)) { netdev_err(vif->dev, ""Too many frags\n""); netbk_fatal_tx_err(vif); return -frags; } memcpy(txp, RING_GET_REQUEST(&vif->tx, cons + frags), sizeof(*txp)); if (txp->size > first->size) { netdev_err(vif->dev, ""Frag is bigger than frame.\n""); netbk_fatal_tx_err(vif); return -frags; } first->size -= txp->size; frags++; if (unlikely((txp->offset + txp->size) > PAGE_SIZE)) { netdev_err(vif->dev, ""txp->offset: %x, size: %u\n"", txp->offset, txp->size); netbk_fatal_tx_err(vif); return -frags; } } while ((txp++)->flags & XEN_NETTXF_more_data); return frags; } ",0 "int kvm_arch_init_vm(struct kvm *kvm, unsigned long type) { if (type) return -EINVAL; INIT_LIST_HEAD(&kvm->arch.active_mmu_pages); INIT_LIST_HEAD(&kvm->arch.assigned_dev_head); /* Reserve bit 0 of irq_sources_bitmap for userspace irq source */ set_bit(KVM_USERSPACE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); /* Reserve bit 1 of irq_sources_bitmap for irqfd-resampler */ set_bit(KVM_IRQFD_RESAMPLE_IRQ_SOURCE_ID, &kvm->arch.irq_sources_bitmap); raw_spin_lock_init(&kvm->arch.tsc_write_lock); mutex_init(&kvm->arch.apic_map_lock); spin_lock_init(&kvm->arch.pvclock_gtod_sync_lock); pvclock_update_vm_gtod_copy(kvm); return 0; } ",0 "bool FrameLoaderClient::shouldGoToHistoryItem(HistoryItem* item) const { return item != 0; } ",0 "RenderWidgetHostImpl* WebContentsImpl::GetFocusedRenderWidgetHost( RenderWidgetHostImpl* receiving_widget) { if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) return receiving_widget; if (receiving_widget != GetMainFrame()->GetRenderWidgetHost()) return receiving_widget; FrameTreeNode* focused_frame = frame_tree_.GetFocusedFrame(); if (!focused_frame) return receiving_widget; RenderWidgetHostView* view = focused_frame->current_frame_host()->GetView(); if (!view) return nullptr; return RenderWidgetHostImpl::From(view->GetRenderWidgetHost()); } ",0 "net::Error ResourceDispatcherHostImpl::BeginDownload( scoped_ptr request, bool is_content_initiated, ResourceContext* context, int child_id, int route_id, bool prefer_cache, scoped_ptr save_info, content::DownloadId download_id, const DownloadStartedCallback& started_callback) { if (is_shutdown_) return CallbackAndReturn(started_callback, net::ERR_INSUFFICIENT_RESOURCES); const GURL& url = request->original_url(); char url_buf[128]; base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); base::debug::Alias(url_buf); CHECK(ContainsKey(active_resource_contexts_, context)); request->set_referrer(MaybeStripReferrer(GURL(request->referrer())).spec()); int extra_load_flags = net::LOAD_IS_DOWNLOAD; if (prefer_cache) { if (request->get_upload() != NULL) extra_load_flags |= net::LOAD_ONLY_FROM_CACHE; else extra_load_flags |= net::LOAD_PREFERRING_CACHE; } else { extra_load_flags |= net::LOAD_DISABLE_CACHE; } request->set_load_flags(request->load_flags() | extra_load_flags); if (!ChildProcessSecurityPolicyImpl::GetInstance()-> CanRequestURL(child_id, url)) { VLOG(1) << ""Denied unauthorized download request for "" << url.possibly_invalid_spec(); return CallbackAndReturn(started_callback, net::ERR_ACCESS_DENIED); } request_id_--; const net::URLRequestContext* request_context = context->GetRequestContext(); if (!request_context->job_factory()->IsHandledURL(url)) { VLOG(1) << ""Download request for unsupported protocol: "" << url.possibly_invalid_spec(); return CallbackAndReturn(started_callback, net::ERR_ACCESS_DENIED); } ResourceRequestInfoImpl* extra_info = CreateRequestInfo(child_id, route_id, true, context); extra_info->AssociateWithRequest(request.get()); // Request takes ownership. scoped_ptr handler( CreateResourceHandlerForDownload(request.get(), is_content_initiated, true, download_id, save_info.Pass(), started_callback)); BeginRequestInternal(request.Pass(), handler.Pass()); return net::OK; } ",0 "static void reflectedTreatNullAsNullStringCustomURLAttrAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; TestObjectV8Internal::reflectedTreatNullAsNullStringCustomURLAttrAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " void ResetCounts() { sockets_.clear(); } ",0 "static void reds_handle_main_link(RedLinkInfo *link) { RedClient *client; RedsStream *stream; SpiceLinkMess *link_mess; uint32_t *caps; uint32_t connection_id; MainChannelClient *mcc; int mig_target = FALSE; spice_info(NULL); spice_assert(reds->main_channel); link_mess = link->link_mess; if (!reds->allow_multiple_clients) { reds_disconnect(); } if (link_mess->connection_id == 0) { reds_send_link_result(link, SPICE_LINK_ERR_OK); while((connection_id = rand()) == 0); mig_target = FALSE; } else { reds_send_link_result(link, SPICE_LINK_ERR_OK); connection_id = link_mess->connection_id; mig_target = TRUE; } reds->mig_inprogress = FALSE; reds->mig_wait_connect = FALSE; reds->mig_wait_disconnect = FALSE; reds_info_new_channel(link, connection_id); stream = link->stream; reds_stream_remove_watch(stream); link->stream = NULL; link->link_mess = NULL; reds_link_free(link); caps = (uint32_t *)((uint8_t *)link_mess + link_mess->caps_offset); client = red_client_new(mig_target); ring_add(&reds->clients, &client->link); reds->num_clients++; mcc = main_channel_link(reds->main_channel, client, stream, connection_id, mig_target, link_mess->num_common_caps, link_mess->num_common_caps ? caps : NULL, link_mess->num_channel_caps, link_mess->num_channel_caps ? caps + link_mess->num_common_caps : NULL); spice_info(""NEW Client %p mcc %p connect-id %d"", client, mcc, connection_id); free(link_mess); red_client_set_main(client, mcc); if (vdagent) { if (mig_target) { spice_warning(""unexpected: vdagent attached to destination during migration""); } reds->agent_state.read_filter.discard_all = FALSE; reds->agent_state.plug_generation++; } if (!mig_target) { main_channel_push_init(mcc, red_dispatcher_count(), reds->mouse_mode, reds->is_client_mouse_allowed, reds_get_mm_time() - MM_TIME_DELTA, red_dispatcher_qxl_ram_size()); if (spice_name) main_channel_push_name(mcc, spice_name); if (spice_uuid_is_set) main_channel_push_uuid(mcc, spice_uuid); } else { reds_mig_target_client_add(client); } main_channel_client_start_net_test(mcc, !mig_target); } ",0 "static void activityLoggedInIsolatedWorldsAttrSetterAttributeGetterForMainWorld(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttrSetter()); } ",0 "void Splash::pipeRunAAXBGR8(SplashPipe *pipe) { Guchar aSrc, aDest, alpha2, aResult; SplashColor cDest; Guchar cResult0, cResult1, cResult2; cDest[0] = pipe->destColorPtr[2]; cDest[1] = pipe->destColorPtr[1]; cDest[2] = pipe->destColorPtr[0]; aDest = *pipe->destAlphaPtr; aSrc = div255(pipe->aInput * pipe->shape); aResult = aSrc + aDest - div255(aSrc * aDest); alpha2 = aResult; if (alpha2 == 0) { cResult0 = 0; cResult1 = 0; cResult2 = 0; } else { cResult0 = state->rgbTransferR[(Guchar)(((alpha2 - aSrc) * cDest[0] + aSrc * pipe->cSrc[0]) / alpha2)]; cResult1 = state->rgbTransferG[(Guchar)(((alpha2 - aSrc) * cDest[1] + aSrc * pipe->cSrc[1]) / alpha2)]; cResult2 = state->rgbTransferB[(Guchar)(((alpha2 - aSrc) * cDest[2] + aSrc * pipe->cSrc[2]) / alpha2)]; } *pipe->destColorPtr++ = cResult2; *pipe->destColorPtr++ = cResult1; *pipe->destColorPtr++ = cResult0; *pipe->destColorPtr++ = 255; *pipe->destAlphaPtr++ = aResult; ++pipe->x; } ",0 "static inline void really_put_req(struct kioctx *ctx, struct kiocb *req) { assert_spin_locked(&ctx->ctx_lock); if (req->ki_eventfd != NULL) eventfd_ctx_put(req->ki_eventfd); if (req->ki_dtor) req->ki_dtor(req); if (req->ki_iovec != &req->ki_inline_vec) kfree(req->ki_iovec); kmem_cache_free(kiocb_cachep, req); ctx->reqs_active--; if (unlikely(!ctx->reqs_active && ctx->dead)) wake_up_all(&ctx->wait); } ",0 "Framebuffer::Framebuffer( FramebufferManager* manager, GLuint service_id) : manager_(manager), deleted_(false), service_id_(service_id), has_been_bound_(false), framebuffer_complete_state_count_id_(0) { manager->StartTracking(this); DCHECK_GT(manager->max_draw_buffers_, 0u); draw_buffers_.reset(new GLenum[manager->max_draw_buffers_]); draw_buffers_[0] = GL_COLOR_ATTACHMENT0; for (uint32 i = 1; i < manager->max_draw_buffers_; ++i) draw_buffers_[i] = GL_NONE; } ",0 "void InlineTextBox::paintSpellingOrGrammarMarker(GraphicsContext* pt, int tx, int ty, const DocumentMarker& marker, RenderStyle* style, const Font& font, bool grammar) { if (textRenderer()->document()->printing()) return; if (m_truncation == cFullTruncation) return; int start = 0; // start of line to draw, relative to tx int width = m_logicalWidth; // how much line to draw bool markerSpansWholeBox = true; if (m_start <= (int)marker.startOffset) markerSpansWholeBox = false; if ((end() + 1) != marker.endOffset) // end points at the last char, not past it markerSpansWholeBox = false; if (m_truncation != cNoTruncation) markerSpansWholeBox = false; if (!markerSpansWholeBox || grammar) { int startPosition = max(marker.startOffset - m_start, 0); int endPosition = min(marker.endOffset - m_start, m_len); if (m_truncation != cNoTruncation) endPosition = min(endPosition, m_truncation); IntPoint startPoint(tx + m_x, ty + selectionTop()); TextRun run(textRenderer()->text()->characters() + m_start, m_len, textRenderer()->allowTabs(), textPos(), m_toAdd, !isLeftToRightDirection(), m_dirOverride || style->visuallyOrdered()); int h = selectionHeight(); IntRect markerRect = enclosingIntRect(font.selectionRectForText(run, startPoint, h, startPosition, endPosition)); start = markerRect.x() - startPoint.x(); width = markerRect.width(); if (grammar) { markerRect.move(-tx, -ty); markerRect = renderer()->localToAbsoluteQuad(FloatRect(markerRect)).enclosingBoundingBox(); renderer()->document()->markers()->setRenderedRectForMarker(renderer()->node(), marker, markerRect); } } int lineThickness = cMisspellingLineThickness; int baseline = renderer()->style(m_firstLine)->font().ascent(); int descent = logicalHeight() - baseline; int underlineOffset; if (descent <= (2 + lineThickness)) { underlineOffset = logicalHeight() - lineThickness; } else { underlineOffset = baseline + 2; } pt->drawLineForTextChecking(IntPoint(tx + m_x + start, ty + m_y + underlineOffset), width, textCheckingLineStyleForMarkerType(marker.type)); } ",0 "int vfs_path_lookup(struct dentry *dentry, struct vfsmount *mnt, const char *name, unsigned int flags, struct nameidata *nd) { int retval; /* same as do_path_lookup */ nd->last_type = LAST_ROOT; nd->flags = flags; nd->depth = 0; nd->path.dentry = dentry; nd->path.mnt = mnt; path_get(&nd->path); nd->root = nd->path; path_get(&nd->root); retval = path_walk(name, nd); if (unlikely(!retval && !audit_dummy_context() && nd->path.dentry && nd->path.dentry->d_inode)) audit_inode(name, nd->path.dentry); path_put(&nd->root); nd->root.mnt = NULL; return retval; } ",0 "WebPluginDelegateProxy::SharedBitmap::~SharedBitmap() {} ",0 "bool ExtensionService::IsExtensionEnabled( const std::string& extension_id) const { return extension_prefs_->GetExtensionState(extension_id) == Extension::ENABLED; } ",0 "String SystemClipboard::ReadPlainText(mojom::ClipboardBuffer buffer) { if (!IsValidBufferType(buffer)) return String(); String text; clipboard_->ReadText(buffer, &text); return text; } ",0 "static bool __same_bdev(struct f2fs_sb_info *sbi, block_t blk_addr, struct bio *bio) { return f2fs_target_device(sbi, blk_addr, NULL) == bio->bi_bdev; } ",0 "ssh_packet_read_poll1(struct ssh *ssh, u_char *typep) { struct session_state *state = ssh->state; u_int len, padded_len; const char *emsg; const u_char *cp; u_char *p; u_int checksum, stored_checksum; int r; *typep = SSH_MSG_NONE; /* Check if input size is less than minimum packet size. */ if (sshbuf_len(state->input) < 4 + 8) return 0; /* Get length of incoming packet. */ len = PEEK_U32(sshbuf_ptr(state->input)); if (len < 1 + 2 + 2 || len > 256 * 1024) { if ((r = sshpkt_disconnect(ssh, ""Bad packet length %u"", len)) != 0) return r; return SSH_ERR_CONN_CORRUPT; } padded_len = (len + 8) & ~7; /* Check if the packet has been entirely received. */ if (sshbuf_len(state->input) < 4 + padded_len) return 0; /* The entire packet is in buffer. */ /* Consume packet length. */ if ((r = sshbuf_consume(state->input, 4)) != 0) goto out; /* * Cryptographic attack detector for ssh * (C)1998 CORE-SDI, Buenos Aires Argentina * Ariel Futoransky(futo@core-sdi.com) */ if (!cipher_ctx_is_plaintext(state->receive_context)) { emsg = NULL; switch (detect_attack(&state->deattack, sshbuf_ptr(state->input), padded_len)) { case DEATTACK_OK: break; case DEATTACK_DETECTED: emsg = ""crc32 compensation attack detected""; break; case DEATTACK_DOS_DETECTED: emsg = ""deattack denial of service detected""; break; default: emsg = ""deattack error""; break; } if (emsg != NULL) { error(""%s"", emsg); if ((r = sshpkt_disconnect(ssh, ""%s"", emsg)) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) return r; return SSH_ERR_CONN_CORRUPT; } } /* Decrypt data to incoming_packet. */ sshbuf_reset(state->incoming_packet); if ((r = sshbuf_reserve(state->incoming_packet, padded_len, &p)) != 0) goto out; if ((r = cipher_crypt(state->receive_context, 0, p, sshbuf_ptr(state->input), padded_len, 0, 0)) != 0) goto out; if ((r = sshbuf_consume(state->input, padded_len)) != 0) goto out; #ifdef PACKET_DEBUG fprintf(stderr, ""read_poll plain: ""); sshbuf_dump(state->incoming_packet, stderr); #endif /* Compute packet checksum. */ checksum = ssh_crc32(sshbuf_ptr(state->incoming_packet), sshbuf_len(state->incoming_packet) - 4); /* Skip padding. */ if ((r = sshbuf_consume(state->incoming_packet, 8 - len % 8)) != 0) goto out; /* Test check bytes. */ if (len != sshbuf_len(state->incoming_packet)) { error(""%s: len %d != sshbuf_len %zd"", __func__, len, sshbuf_len(state->incoming_packet)); if ((r = sshpkt_disconnect(ssh, ""invalid packet length"")) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) return r; return SSH_ERR_CONN_CORRUPT; } cp = sshbuf_ptr(state->incoming_packet) + len - 4; stored_checksum = PEEK_U32(cp); if (checksum != stored_checksum) { error(""Corrupted check bytes on input""); if ((r = sshpkt_disconnect(ssh, ""connection corrupted"")) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) return r; return SSH_ERR_CONN_CORRUPT; } if ((r = sshbuf_consume_end(state->incoming_packet, 4)) < 0) goto out; if (state->packet_compression) { sshbuf_reset(state->compression_buffer); if ((r = uncompress_buffer(ssh, state->incoming_packet, state->compression_buffer)) != 0) goto out; sshbuf_reset(state->incoming_packet); if ((r = sshbuf_putb(state->incoming_packet, state->compression_buffer)) != 0) goto out; } state->p_read.packets++; state->p_read.bytes += padded_len + 4; if ((r = sshbuf_get_u8(state->incoming_packet, typep)) != 0) goto out; if (*typep < SSH_MSG_MIN || *typep > SSH_MSG_MAX) { error(""Invalid ssh1 packet type: %d"", *typep); if ((r = sshpkt_disconnect(ssh, ""invalid packet type"")) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) return r; return SSH_ERR_PROTOCOL_ERROR; } r = 0; out: return r; } ",0 "static void pdf_resize_xref(fz_context *ctx, pdf_document *doc, int newlen) { int i; pdf_xref *xref = &doc->xref_sections[doc->xref_base]; pdf_xref_subsec *sub; assert(xref != NULL); sub = xref->subsec; assert(sub->next == NULL && sub->start == 0 && sub->len == xref->num_objects); assert(newlen > xref->num_objects); sub->table = fz_resize_array(ctx, sub->table, newlen, sizeof(pdf_xref_entry)); for (i = xref->num_objects; i < newlen; i++) { sub->table[i].type = 0; sub->table[i].ofs = 0; sub->table[i].gen = 0; sub->table[i].num = 0; sub->table[i].stm_ofs = 0; sub->table[i].stm_buf = NULL; sub->table[i].obj = NULL; } xref->num_objects = newlen; sub->len = newlen; if (doc->max_xref_len < newlen) extend_xref_index(ctx, doc, newlen); } ",0 "BlameContext* LocalFrameClientImpl::GetFrameBlameContext() { if (WebLocalFrameClient* client = web_frame_->Client()) return client->GetFrameBlameContext(); return nullptr; } ",0 "gdImageRotateGeneric(gdImagePtr src, const float degrees, const int bgColor) { float _angle = ((float) (-degrees / 180.0f) * (float)M_PI); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const unsigned int new_width = (unsigned int)(abs((int)(src_w * cos(_angle))) + abs((int)(src_h * sin(_angle))) + 0.5f); const unsigned int new_height = (unsigned int)(abs((int)(src_w * sin(_angle))) + abs((int)(src_h * cos(_angle))) + 0.5f); const gdFixed f_0_5 = gd_ftofx(0.5f); const gdFixed f_H = gd_itofx(src_h/2); const gdFixed f_W = gd_itofx(src_w/2); const gdFixed f_cos = gd_ftofx(cos(-_angle)); const gdFixed f_sin = gd_ftofx(sin(-_angle)); unsigned int dst_offset_x; unsigned int dst_offset_y = 0; unsigned int i; gdImagePtr dst; const gdFixed f_slop_y = f_sin; const gdFixed f_slop_x = f_cos; const gdFixed f_slop = f_slop_x > 0 && f_slop_x > 0 ? f_slop_x > f_slop_y ? gd_divfx(f_slop_y, f_slop_x) : gd_divfx(f_slop_x, f_slop_y) : 0; if (bgColor < 0) { return NULL; } /* impact perf a bit, but not that much. Implementation for palette images can be done at a later point. */ if (src->trueColor == 0) { gdImagePaletteToTrueColor(src); } dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; } dst->saveAlphaFlag = 1; for (i = 0; i < new_height; i++) { unsigned int j; dst_offset_x = 0; for (j = 0; j < new_width; j++) { gdFixed f_i = gd_itofx((int)i - (int)new_height / 2); gdFixed f_j = gd_itofx((int)j - (int)new_width / 2); gdFixed f_m = gd_mulfx(f_j,f_sin) + gd_mulfx(f_i,f_cos) + f_0_5 + f_H; gdFixed f_n = gd_mulfx(f_j,f_cos) - gd_mulfx(f_i,f_sin) + f_0_5 + f_W; long m = gd_fxtoi(f_m); long n = gd_fxtoi(f_n); if ((n <= 0) || (m <= 0) || (m >= src_h) || (n >= src_w)) { dst->tpixels[dst_offset_y][dst_offset_x++] = bgColor; } else if ((n <= 1) || (m <= 1) || (m >= src_h - 1) || (n >= src_w - 1)) { register int c = getPixelInterpolated(src, n, m, bgColor); c = c | (( gdTrueColorGetAlpha(c) + ((int)(127* gd_fxtof(f_slop)))) << 24); dst->tpixels[dst_offset_y][dst_offset_x++] = _color_blend(bgColor, c); } else { dst->tpixels[dst_offset_y][dst_offset_x++] = getPixelInterpolated(src, n, m, bgColor); } } dst_offset_y++; } return dst; } ",0 "SCTP_STATIC int sctp_init_sock(struct sock *sk) { struct net *net = sock_net(sk); struct sctp_endpoint *ep; struct sctp_sock *sp; SCTP_DEBUG_PRINTK(""sctp_init_sock(sk: %p)\n"", sk); sp = sctp_sk(sk); /* Initialize the SCTP per socket area. */ switch (sk->sk_type) { case SOCK_SEQPACKET: sp->type = SCTP_SOCKET_UDP; break; case SOCK_STREAM: sp->type = SCTP_SOCKET_TCP; break; default: return -ESOCKTNOSUPPORT; } /* Initialize default send parameters. These parameters can be * modified with the SCTP_DEFAULT_SEND_PARAM socket option. */ sp->default_stream = 0; sp->default_ppid = 0; sp->default_flags = 0; sp->default_context = 0; sp->default_timetolive = 0; sp->default_rcv_context = 0; sp->max_burst = net->sctp.max_burst; sp->sctp_hmac_alg = net->sctp.sctp_hmac_alg; /* Initialize default setup parameters. These parameters * can be modified with the SCTP_INITMSG socket option or * overridden by the SCTP_INIT CMSG. */ sp->initmsg.sinit_num_ostreams = sctp_max_outstreams; sp->initmsg.sinit_max_instreams = sctp_max_instreams; sp->initmsg.sinit_max_attempts = net->sctp.max_retrans_init; sp->initmsg.sinit_max_init_timeo = net->sctp.rto_max; /* Initialize default RTO related parameters. These parameters can * be modified for with the SCTP_RTOINFO socket option. */ sp->rtoinfo.srto_initial = net->sctp.rto_initial; sp->rtoinfo.srto_max = net->sctp.rto_max; sp->rtoinfo.srto_min = net->sctp.rto_min; /* Initialize default association related parameters. These parameters * can be modified with the SCTP_ASSOCINFO socket option. */ sp->assocparams.sasoc_asocmaxrxt = net->sctp.max_retrans_association; sp->assocparams.sasoc_number_peer_destinations = 0; sp->assocparams.sasoc_peer_rwnd = 0; sp->assocparams.sasoc_local_rwnd = 0; sp->assocparams.sasoc_cookie_life = net->sctp.valid_cookie_life; /* Initialize default event subscriptions. By default, all the * options are off. */ memset(&sp->subscribe, 0, sizeof(struct sctp_event_subscribe)); /* Default Peer Address Parameters. These defaults can * be modified via SCTP_PEER_ADDR_PARAMS */ sp->hbinterval = net->sctp.hb_interval; sp->pathmaxrxt = net->sctp.max_retrans_path; sp->pathmtu = 0; // allow default discovery sp->sackdelay = net->sctp.sack_timeout; sp->sackfreq = 2; sp->param_flags = SPP_HB_ENABLE | SPP_PMTUD_ENABLE | SPP_SACKDELAY_ENABLE; /* If enabled no SCTP message fragmentation will be performed. * Configure through SCTP_DISABLE_FRAGMENTS socket option. */ sp->disable_fragments = 0; /* Enable Nagle algorithm by default. */ sp->nodelay = 0; /* Enable by default. */ sp->v4mapped = 1; /* Auto-close idle associations after the configured * number of seconds. A value of 0 disables this * feature. Configure through the SCTP_AUTOCLOSE socket option, * for UDP-style sockets only. */ sp->autoclose = 0; /* User specified fragmentation limit. */ sp->user_frag = 0; sp->adaptation_ind = 0; sp->pf = sctp_get_pf_specific(sk->sk_family); /* Control variables for partial data delivery. */ atomic_set(&sp->pd_mode, 0); skb_queue_head_init(&sp->pd_lobby); sp->frag_interleave = 0; /* Create a per socket endpoint structure. Even if we * change the data structure relationships, this may still * be useful for storing pre-connect address information. */ ep = sctp_endpoint_new(sk, GFP_KERNEL); if (!ep) return -ENOMEM; sp->ep = ep; sp->hmac = NULL; SCTP_DBG_OBJCNT_INC(sock); local_bh_disable(); percpu_counter_inc(&sctp_sockets_allocated); sock_prot_inuse_add(net, sk->sk_prot, 1); if (net->sctp.default_auto_asconf) { list_add_tail(&sp->auto_asconf_list, &net->sctp.auto_asconf_splist); sp->do_auto_asconf = 1; } else sp->do_auto_asconf = 0; local_bh_enable(); return 0; } ",0 "static void __wait_discard_cmd(struct f2fs_sb_info *sbi, bool wait_cond) { struct discard_cmd_control *dcc = SM_I(sbi)->dcc_info; struct list_head *wait_list = &(dcc->wait_list); struct discard_cmd *dc, *tmp; bool need_wait; next: need_wait = false; mutex_lock(&dcc->cmd_lock); list_for_each_entry_safe(dc, tmp, wait_list, list) { if (!wait_cond || (dc->state == D_DONE && !dc->ref)) { wait_for_completion_io(&dc->wait); __remove_discard_cmd(sbi, dc); } else { dc->ref++; need_wait = true; break; } } mutex_unlock(&dcc->cmd_lock); if (need_wait) { wait_for_completion_io(&dc->wait); mutex_lock(&dcc->cmd_lock); f2fs_bug_on(sbi, dc->state != D_DONE); dc->ref--; if (!dc->ref) __remove_discard_cmd(sbi, dc); mutex_unlock(&dcc->cmd_lock); goto next; } } ",0 "MYSQLND_METHOD(mysqlnd_conn_data, error)(const MYSQLND_CONN_DATA * const conn TSRMLS_DC) { return conn->error_info->error; } ",0 "WORD32 ih264d_mark_err_slice_skip(dec_struct_t * ps_dec, WORD32 num_mb_skip, UWORD8 u1_is_idr_slice, UWORD16 u2_frame_num, pocstruct_t *ps_cur_poc, WORD32 prev_slice_err) { WORD32 i2_cur_mb_addr; UWORD32 u1_num_mbs, u1_num_mbsNby2; UWORD32 u1_mb_idx = ps_dec->u1_mb_idx; UWORD32 i2_mb_skip_run; UWORD32 u1_num_mbs_next, u1_end_of_row; const UWORD32 i2_pic_wdin_mbs = ps_dec->u2_frm_wd_in_mbs; UWORD32 u1_slice_end; UWORD32 u1_tfr_n_mb; UWORD32 u1_decode_nmb; dec_bit_stream_t * const ps_bitstrm = ps_dec->ps_bitstrm; dec_slice_params_t * ps_slice = ps_dec->ps_cur_slice; UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst; deblk_mb_t *ps_cur_deblk_mb; dec_mb_info_t *ps_cur_mb_info; parse_pmbarams_t *ps_parse_mb_data; UWORD32 u1_inter_mb_type; UWORD32 u1_deblk_mb_type; UWORD16 u2_total_mbs_coded; UWORD32 u1_mbaff = ps_slice->u1_mbaff_frame_flag; parse_part_params_t *ps_part_info; WORD32 ret; if(ps_dec->ps_dec_err_status->u1_err_flag & REJECT_CUR_PIC) { ih264d_err_pic_dispbuf_mgr(ps_dec); return 0; } ps_dec->ps_dpb_cmds->u1_long_term_reference_flag = 0; if(prev_slice_err == 1) { /* first slice - missing/header corruption */ ps_dec->ps_cur_slice->u2_frame_num = u2_frame_num; if(!ps_dec->u1_first_slice_in_stream) { ih264d_end_of_pic(ps_dec, u1_is_idr_slice, ps_dec->ps_cur_slice->u2_frame_num); ps_dec->s_cur_pic_poc.u2_frame_num = ps_dec->ps_cur_slice->u2_frame_num; } { WORD32 i, j, poc = 0; ps_dec->ps_cur_slice->u2_first_mb_in_slice = 0; ps_dec->pf_mvpred = ih264d_mvpred_nonmbaff; ps_dec->p_form_mb_part_info = ih264d_form_mb_part_info_bp; ps_dec->p_motion_compensate = ih264d_motion_compensate_bp; if(ps_dec->ps_cur_pic != NULL) poc = ps_dec->ps_cur_pic->i4_poc + 2; j = 0; for(i = 0; i < MAX_NUM_PIC_PARAMS; i++) if(ps_dec->ps_pps[i].u1_is_valid == TRUE) j = i; { ps_dec->ps_cur_slice->u1_bottom_field_flag = 0; ps_dec->ps_cur_slice->u1_field_pic_flag = 0; ps_dec->ps_cur_slice->u1_slice_type = P_SLICE; ps_dec->ps_cur_slice->u1_nal_ref_idc = 1; ps_dec->ps_cur_slice->u1_nal_unit_type = 1; ret = ih264d_start_of_pic(ps_dec, poc, ps_cur_poc, ps_dec->ps_cur_slice->u2_frame_num, &ps_dec->ps_pps[j]); if(ret != OK) { return ret; } } ps_dec->ps_ref_pic_buf_lx[0][0]->u1_pic_buf_id = 0; ps_dec->u4_output_present = 0; { ih264d_get_next_display_field(ps_dec, ps_dec->ps_out_buffer, &(ps_dec->s_disp_op)); /* If error code is non-zero then there is no buffer available for display, hence avoid format conversion */ if(0 != ps_dec->s_disp_op.u4_error_code) { ps_dec->u4_fmt_conv_cur_row = ps_dec->s_disp_frame_info.u4_y_ht; } else ps_dec->u4_output_present = 1; } if(ps_dec->u1_separate_parse == 1) { if(ps_dec->u4_dec_thread_created == 0) { ithread_create(ps_dec->pv_dec_thread_handle, NULL, (void *)ih264d_decode_picture_thread, (void *)ps_dec); ps_dec->u4_dec_thread_created = 1; } if((ps_dec->u4_num_cores == 3) && ((ps_dec->u4_app_disable_deblk_frm == 0) || ps_dec->i1_recon_in_thread3_flag) && (ps_dec->u4_bs_deblk_thread_created == 0)) { ps_dec->u4_start_recon_deblk = 0; ithread_create(ps_dec->pv_bs_deblk_thread_handle, NULL, (void *)ih264d_recon_deblk_thread, (void *)ps_dec); ps_dec->u4_bs_deblk_thread_created = 1; } } } } else { dec_slice_struct_t *ps_parse_cur_slice; ps_parse_cur_slice = ps_dec->ps_dec_slice_buf + ps_dec->u2_cur_slice_num; if(ps_dec->u1_slice_header_done && ps_parse_cur_slice == ps_dec->ps_parse_cur_slice) { u1_num_mbs = ps_dec->u4_num_mbs_cur_nmb; if(u1_num_mbs) { ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs - 1; } else { if(ps_dec->u1_separate_parse) { ps_cur_mb_info = ps_dec->ps_nmb_info - 1; } else { ps_cur_mb_info = ps_dec->ps_nmb_info + ps_dec->u4_num_mbs_prev_nmb - 1; } } ps_dec->u2_mby = ps_cur_mb_info->u2_mby; ps_dec->u2_mbx = ps_cur_mb_info->u2_mbx; ps_dec->u1_mb_ngbr_availablity = ps_cur_mb_info->u1_mb_ngbr_availablity; ps_dec->pv_parse_tu_coeff_data = ps_dec->pv_prev_mb_parse_tu_coeff_data; ps_dec->u2_cur_mb_addr--; ps_dec->i4_submb_ofst -= SUB_BLK_SIZE; if(u1_num_mbs) { if (ps_dec->u1_pr_sl_type == P_SLICE || ps_dec->u1_pr_sl_type == B_SLICE) { ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs); ps_dec->ps_part = ps_dec->ps_parse_part_params; } u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1; u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01))); u1_slice_end = 1; u1_tfr_n_mb = 1; ps_cur_mb_info->u1_end_of_slice = u1_slice_end; if(ps_dec->u1_separate_parse) { ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row); ps_dec->ps_nmb_info += u1_num_mbs; } else { ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row); } ps_dec->u2_total_mbs_coded += u1_num_mbs; ps_dec->u1_mb_idx = 0; ps_dec->u4_num_mbs_cur_nmb = 0; } if(ps_dec->u2_total_mbs_coded >= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) { ps_dec->u1_pic_decode_done = 1; return 0; } ps_dec->u2_cur_slice_num++; ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx; ps_dec->i2_prev_slice_mby = ps_dec->u2_mby; ps_dec->ps_parse_cur_slice++; } else { ps_dec->ps_parse_cur_slice = ps_dec->ps_dec_slice_buf + ps_dec->u2_cur_slice_num; } } /******************************************************/ /* Initializations to new slice */ /******************************************************/ { WORD32 num_entries; WORD32 size; UWORD8 *pu1_buf; num_entries = MAX_FRAMES; if((1 >= ps_dec->ps_cur_sps->u1_num_ref_frames) && (0 == ps_dec->i4_display_delay)) { num_entries = 1; } num_entries = ((2 * num_entries) + 1); if(BASE_PROFILE_IDC != ps_dec->ps_cur_sps->u1_profile_idc) { num_entries *= 2; } size = num_entries * sizeof(void *); size += PAD_MAP_IDX_POC * sizeof(void *); pu1_buf = (UWORD8 *)ps_dec->pv_map_ref_idx_to_poc_buf; pu1_buf += size * ps_dec->u2_cur_slice_num; ps_dec->ps_parse_cur_slice->ppv_map_ref_idx_to_poc = (volatile void **)pu1_buf; } ps_dec->ps_cur_slice->u2_first_mb_in_slice = ps_dec->u2_total_mbs_coded << u1_mbaff; ps_dec->ps_cur_slice->i1_slice_alpha_c0_offset = 0; ps_dec->ps_cur_slice->i1_slice_beta_offset = 0; if(ps_dec->ps_cur_slice->u1_field_pic_flag) ps_dec->u2_prv_frame_num = ps_dec->ps_cur_slice->u2_frame_num; ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice = ps_dec->u2_total_mbs_coded << u1_mbaff; ps_dec->ps_parse_cur_slice->u2_log2Y_crwd = ps_dec->ps_cur_slice->u2_log2Y_crwd; if(ps_dec->u1_separate_parse) { ps_dec->ps_parse_cur_slice->pv_tu_coeff_data_start = ps_dec->pv_parse_tu_coeff_data; } else { ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_parse_tu_coeff_data; } /******************************************************/ /* Initializations specific to P slice */ /******************************************************/ u1_inter_mb_type = P_MB; u1_deblk_mb_type = D_INTER_MB; ps_dec->ps_cur_slice->u1_slice_type = P_SLICE; ps_dec->ps_parse_cur_slice->slice_type = P_SLICE; ps_dec->pf_mvpred_ref_tfr_nby2mb = ih264d_mv_pred_ref_tfr_nby2_pmb; ps_dec->ps_part = ps_dec->ps_parse_part_params; /******************************************************/ /* Parsing / decoding the slice */ /******************************************************/ ps_dec->u1_slice_header_done = 2; ps_dec->u1_qp = ps_slice->u1_slice_qp; ih264d_update_qp(ps_dec, 0); u1_mb_idx = ps_dec->u1_mb_idx; ps_parse_mb_data = ps_dec->ps_parse_mb_data; u1_num_mbs = u1_mb_idx; u1_slice_end = 0; u1_tfr_n_mb = 0; u1_decode_nmb = 0; u1_num_mbsNby2 = 0; i2_cur_mb_addr = ps_dec->u2_total_mbs_coded; i2_mb_skip_run = num_mb_skip; while(!u1_slice_end) { UWORD8 u1_mb_type; if(i2_cur_mb_addr > ps_dec->ps_cur_sps->u2_max_mb_addr) break; ps_cur_mb_info = ps_dec->ps_nmb_info + u1_num_mbs; ps_dec->u4_num_mbs_cur_nmb = u1_num_mbs; ps_cur_mb_info->u1_Mux = 0; ps_dec->u4_num_pmbair = (u1_num_mbs >> u1_mbaff); ps_cur_deblk_mb = ps_dec->ps_deblk_mbn + u1_num_mbs; ps_cur_mb_info->u1_end_of_slice = 0; /* Storing Default partition info */ ps_parse_mb_data->u1_num_part = 1; ps_parse_mb_data->u1_isI_mb = 0; /**************************************************************/ /* Get the required information for decoding of MB */ /**************************************************************/ /* mb_x, mb_y, neighbor availablity, */ if (u1_mbaff) ih264d_get_mb_info_cavlc_mbaff(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, i2_mb_skip_run); else ih264d_get_mb_info_cavlc_nonmbaff(ps_dec, i2_cur_mb_addr, ps_cur_mb_info, i2_mb_skip_run); /* Set the deblocking parameters for this MB */ if(ps_dec->u4_app_disable_deblk_frm == 0) { ih264d_set_deblocking_parameters(ps_cur_deblk_mb, ps_slice, ps_dec->u1_mb_ngbr_availablity, ps_dec->u1_cur_mb_fld_dec_flag); } /* Set appropriate flags in ps_cur_mb_info and ps_dec */ ps_dec->i1_prev_mb_qp_delta = 0; ps_dec->u1_sub_mb_num = 0; ps_cur_mb_info->u1_mb_type = MB_SKIP; ps_cur_mb_info->u1_mb_mc_mode = PRED_16x16; ps_cur_mb_info->u1_cbp = 0; /* Storing Skip partition info */ ps_part_info = ps_dec->ps_part; ps_part_info->u1_is_direct = PART_DIRECT_16x16; ps_part_info->u1_sub_mb_num = 0; ps_dec->ps_part++; /* Update Nnzs */ ih264d_update_nnz_for_skipmb(ps_dec, ps_cur_mb_info, CAVLC); ps_cur_mb_info->ps_curmb->u1_mb_type = u1_inter_mb_type; ps_cur_deblk_mb->u1_mb_type |= u1_deblk_mb_type; i2_mb_skip_run--; ps_cur_deblk_mb->u1_mb_qp = ps_dec->u1_qp; if (u1_mbaff) { ih264d_update_mbaff_left_nnz(ps_dec, ps_cur_mb_info); } /**************************************************************/ /* Get next Macroblock address */ /**************************************************************/ i2_cur_mb_addr++; u1_num_mbs++; u1_num_mbsNby2++; ps_parse_mb_data++; /****************************************************************/ /* Check for End Of Row and other flags that determine when to */ /* do DMA setup for N/2-Mb, Decode for N-Mb, and Transfer for */ /* N-Mb */ /****************************************************************/ u1_num_mbs_next = i2_pic_wdin_mbs - ps_dec->u2_mbx - 1; u1_end_of_row = (!u1_num_mbs_next) && (!(u1_mbaff && (u1_num_mbs & 0x01))); u1_slice_end = !i2_mb_skip_run; u1_tfr_n_mb = (u1_num_mbs == ps_dec->u1_recon_mb_grp) || u1_end_of_row || u1_slice_end; u1_decode_nmb = u1_tfr_n_mb || u1_slice_end; ps_cur_mb_info->u1_end_of_slice = u1_slice_end; if(u1_decode_nmb) { ps_dec->pf_mvpred_ref_tfr_nby2mb(ps_dec, u1_mb_idx, u1_num_mbs); u1_num_mbsNby2 = 0; ps_parse_mb_data = ps_dec->ps_parse_mb_data; ps_dec->ps_part = ps_dec->ps_parse_part_params; if(ps_dec->u1_separate_parse) { ih264d_parse_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row); ps_dec->ps_nmb_info += u1_num_mbs; } else { ih264d_decode_recon_tfr_nmb(ps_dec, u1_mb_idx, u1_num_mbs, u1_num_mbs_next, u1_tfr_n_mb, u1_end_of_row); } ps_dec->u2_total_mbs_coded += u1_num_mbs; if(u1_tfr_n_mb) u1_num_mbs = 0; u1_mb_idx = u1_num_mbs; ps_dec->u1_mb_idx = u1_num_mbs; } } ps_dec->u4_num_mbs_cur_nmb = 0; ps_dec->ps_cur_slice->u4_mbs_in_slice = i2_cur_mb_addr - ps_dec->ps_parse_cur_slice->u4_first_mb_in_slice; H264_DEC_DEBUG_PRINT(""Mbs in slice: %d\n"", ps_dec->ps_cur_slice->u4_mbs_in_slice); ps_dec->u2_cur_slice_num++; /* incremented here only if first slice is inserted */ if(ps_dec->u4_first_slice_in_pic != 0) ps_dec->ps_parse_cur_slice++; ps_dec->i2_prev_slice_mbx = ps_dec->u2_mbx; ps_dec->i2_prev_slice_mby = ps_dec->u2_mby; if(ps_dec->u2_total_mbs_coded >= ps_dec->u2_frm_ht_in_mbs * ps_dec->u2_frm_wd_in_mbs) { ps_dec->u1_pic_decode_done = 1; } return 0; } ",1 "IDNSpoofChecker::IDNSpoofChecker() { UErrorCode status = U_ZERO_ERROR; checker_ = uspoof_open(&status); if (U_FAILURE(status)) { checker_ = nullptr; return; } uspoof_setRestrictionLevel(checker_, USPOOF_HIGHLY_RESTRICTIVE); SetAllowedUnicodeSet(&status); int32_t checks = uspoof_getChecks(checker_, &status) | USPOOF_AUX_INFO; uspoof_setChecks(checker_, checks, &status); deviation_characters_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[\\u00df\\u03c2\\u200c\\u200d]""), status); deviation_characters_.freeze(); non_ascii_latin_letters_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[[:Latin:] - [a-zA-Z]]""), status); non_ascii_latin_letters_.freeze(); kana_letters_exceptions_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[\\u3078-\\u307a\\u30d8-\\u30da\\u30fb-\\u30fe]""), status); kana_letters_exceptions_.freeze(); combining_diacritics_exceptions_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[\\u0300-\\u0339]""), status); combining_diacritics_exceptions_.freeze(); cyrillic_letters_latin_alike_ = icu::UnicodeSet( icu::UnicodeString::fromUTF8(""[асԁеһіјӏорԛѕԝхуъЬҽпгѵѡ]""), status); cyrillic_letters_latin_alike_.freeze(); cyrillic_letters_ = icu::UnicodeSet(UNICODE_STRING_SIMPLE(""[[:Cyrl:]]""), status); cyrillic_letters_.freeze(); DCHECK(U_SUCCESS(status)); lgc_letters_n_ascii_ = icu::UnicodeSet( UNICODE_STRING_SIMPLE(""[[:Latin:][:Greek:][:Cyrillic:][0-9\\u002e_"" ""\\u002d][\\u0300-\\u0339]]""), status); lgc_letters_n_ascii_.freeze(); UParseError parse_error; diacritic_remover_.reset(icu::Transliterator::createFromRules( UNICODE_STRING_SIMPLE(""DropAcc""), icu::UnicodeString::fromUTF8(""::NFD; ::[:Nonspacing Mark:] Remove; ::NFC;"" "" ł > l; ø > o; đ > d;""), UTRANS_FORWARD, parse_error, status)); UNICODE_STRING_SIMPLE(""ExtraConf""), icu::UnicodeString::fromUTF8(""[þϼҏ] > p; [ħнћңҥӈԧԩ] > h;"" ""[ĸκкқҝҟҡӄԟ] > k; [ŧтҭ] > t;"" ""[ƅьҍв] > b; [ωшщ] > w; [мӎ] > m;"" ""п > n; ћ > h; ґ > r; ғ > f; ҫ > c;"" ""ұ > y; [χҳӽӿ] > x; [ҽҿ] > e;"" #if defined(OS_WIN) ""ӏ > i;"" #else ""ӏ > l;"" #endif ""ԃ > d; ԍ > g; ട > s""), UTRANS_FORWARD, parse_error, status)); DCHECK(U_SUCCESS(status)) << ""Spoofchecker initalization failed due to an error: "" << u_errorName(status); } ",1 "void ParamTraits::Write(Message* m, const param_type& p) { WriteParam(m, p.channel); WriteParam(m, p.routing_id); WriteParam(m, p.type); WriteParam(m, p.flags); WriteParam(m, p.sent); WriteParam(m, p.receive); WriteParam(m, p.dispatch); WriteParam(m, p.message_name); WriteParam(m, p.params); } ",0 "static void get_current_time(struct timeval *t) { #if defined(_WIN32) SYSTEMTIME st; union { unsigned __int64 ul; FILETIME ft; } now; GetSystemTime(&st); SystemTimeToFileTime(&st, &now.ft); # ifdef __MINGW32__ now.ul -= 116444736000000000ULL; # else now.ul -= 116444736000000000UI64; /* re-bias to 1/1/1970 */ # endif t->tv_sec = (long)(now.ul / 10000000); t->tv_usec = ((int)(now.ul % 10000000)) / 10; #elif defined(OPENSSL_SYS_VMS) struct timeb tb; ftime(&tb); t->tv_sec = (long)tb.time; t->tv_usec = (long)tb.millitm * 1000; #else gettimeofday(t, NULL); #endif } ",0 "void V8TestObject::ActivityLoggingAccessForAllWorldsLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_activityLoggingAccessForAllWorldsLongAttribute_Getter""); ScriptState* script_state = ScriptState::ForRelevantRealm(info); V8PerContextData* context_data = script_state->PerContextData(); if (context_data && context_data->ActivityLogger()) { context_data->ActivityLogger()->LogGetter(""TestObject.activityLoggingAccessForAllWorldsLongAttribute""); } test_object_v8_internal::ActivityLoggingAccessForAllWorldsLongAttributeAttributeGetter(info); } ",0 "static void wait_worker_and_cache_frame(vpx_codec_alg_priv_t *ctx) { YV12_BUFFER_CONFIG sd; vp9_ppflags_t flags = {0, 0, 0}; const VPxWorkerInterface *const winterface = vpx_get_worker_interface(); VPxWorker *const worker = &ctx->frame_workers[ctx->next_output_worker_id]; FrameWorkerData *const frame_worker_data = (FrameWorkerData *)worker->data1; ctx->next_output_worker_id = (ctx->next_output_worker_id + 1) % ctx->num_frame_workers; winterface->sync(worker); frame_worker_data->received_frame = 0; ++ctx->available_threads; check_resync(ctx, frame_worker_data->pbi); if (vp9_get_raw_frame(frame_worker_data->pbi, &sd, &flags) == 0) { VP9_COMMON *const cm = &frame_worker_data->pbi->common; RefCntBuffer *const frame_bufs = cm->buffer_pool->frame_bufs; ctx->frame_cache[ctx->frame_cache_write].fb_idx = cm->new_fb_idx; yuvconfig2image(&ctx->frame_cache[ctx->frame_cache_write].img, &sd, frame_worker_data->user_priv); ctx->frame_cache[ctx->frame_cache_write].img.fb_priv = frame_bufs[cm->new_fb_idx].raw_frame_buffer.priv; ctx->frame_cache_write = (ctx->frame_cache_write + 1) % FRAME_CACHE_SIZE; ++ctx->num_cache_frames; } } ",0 "cmsBool Type_ColorantOrderType_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsUInt8Number* ColorantOrder = (cmsUInt8Number*) Ptr; cmsUInt32Number i, sz, Count; for (Count=i=0; i < cmsMAXCHANNELS; i++) { if (ColorantOrder[i] != 0xFF) Count++; } if (!_cmsWriteUInt32Number(io, Count)) return FALSE; sz = Count * sizeof(cmsUInt8Number); if (!io -> Write(io, sz, ColorantOrder)) return FALSE; return TRUE; cmsUNUSED_PARAMETER(nItems); cmsUNUSED_PARAMETER(self); } ",0 "int sc_pkcs15emu_sc_hsm_encode_cvc(sc_pkcs15_card_t * p15card, sc_cvc_t *cvc, u8 ** buf, size_t *buflen) { sc_card_t *card = p15card->card; struct sc_asn1_entry asn1_cvc[C_ASN1_CVC_SIZE]; struct sc_asn1_entry asn1_cvcert[C_ASN1_CVCERT_SIZE]; struct sc_asn1_entry asn1_cvc_body[C_ASN1_CVC_BODY_SIZE]; struct sc_asn1_entry asn1_cvc_pubkey[C_ASN1_CVC_PUBKEY_SIZE]; size_t lenchr; size_t lencar; int r; sc_copy_asn1_entry(c_asn1_cvc, asn1_cvc); sc_copy_asn1_entry(c_asn1_cvcert, asn1_cvcert); sc_copy_asn1_entry(c_asn1_cvc_body, asn1_cvc_body); sc_copy_asn1_entry(c_asn1_cvc_pubkey, asn1_cvc_pubkey); asn1_cvc_pubkey[1].flags = SC_ASN1_OPTIONAL; asn1_cvcert[1].flags = SC_ASN1_OPTIONAL; sc_format_asn1_entry(asn1_cvc_pubkey , &cvc->pukoid, NULL, 1); if (cvc->primeOrModulus && (cvc->primeOrModuluslen > 0)) { sc_format_asn1_entry(asn1_cvc_pubkey + 1, cvc->primeOrModulus, &cvc->primeOrModuluslen, 1); } sc_format_asn1_entry(asn1_cvc_pubkey + 2, cvc->coefficientAorExponent, &cvc->coefficientAorExponentlen, 1); if (cvc->coefficientB && (cvc->coefficientBlen > 0)) { sc_format_asn1_entry(asn1_cvc_pubkey + 3, cvc->coefficientB, &cvc->coefficientBlen, 1); sc_format_asn1_entry(asn1_cvc_pubkey + 4, cvc->basePointG, &cvc->basePointGlen, 1); sc_format_asn1_entry(asn1_cvc_pubkey + 5, cvc->order, &cvc->orderlen, 1); if (cvc->publicPoint && (cvc->publicPointlen > 0)) { sc_format_asn1_entry(asn1_cvc_pubkey + 6, cvc->publicPoint, &cvc->publicPointlen, 1); } sc_format_asn1_entry(asn1_cvc_pubkey + 7, cvc->cofactor, &cvc->cofactorlen, 1); } if (cvc->modulusSize > 0) { sc_format_asn1_entry(asn1_cvc_pubkey + 8, &cvc->modulusSize, NULL, 1); } sc_format_asn1_entry(asn1_cvc_body , &cvc->cpi, NULL, 1); lencar = strnlen(cvc->car, sizeof cvc->car); sc_format_asn1_entry(asn1_cvc_body + 1, &cvc->car, &lencar, 1); sc_format_asn1_entry(asn1_cvc_body + 2, &asn1_cvc_pubkey, NULL, 1); lenchr = strnlen(cvc->chr, sizeof cvc->chr); sc_format_asn1_entry(asn1_cvc_body + 3, &cvc->chr, &lenchr, 1); sc_format_asn1_entry(asn1_cvcert , &asn1_cvc_body, NULL, 1); if (cvc->signature && (cvc->signatureLen > 0)) { sc_format_asn1_entry(asn1_cvcert + 1, cvc->signature, &cvc->signatureLen, 1); } sc_format_asn1_entry(asn1_cvc , &asn1_cvcert, NULL, 1); r = sc_asn1_encode(card->ctx, asn1_cvc, buf, buflen); LOG_TEST_RET(card->ctx, r, ""Could not encode card verifiable certificate""); LOG_FUNC_RETURN(card->ctx, SC_SUCCESS); } ",0 "int rtnl_configure_link(struct net_device *dev, const struct ifinfomsg *ifm) { unsigned int old_flags; int err; old_flags = dev->flags; if (ifm && (ifm->ifi_flags || ifm->ifi_change)) { err = __dev_change_flags(dev, rtnl_dev_combine_flags(dev, ifm)); if (err < 0) return err; } dev->rtnl_link_state = RTNL_LINK_INITIALIZED; rtmsg_ifinfo(RTM_NEWLINK, dev, ~0U); __dev_notify_flags(dev, old_flags); return 0; } ",0 "AP_DECLARE(const char *) ap_context_document_root(request_rec *r) { core_request_config *conf = ap_get_core_module_config(r->request_config); if (conf->context_document_root) return conf->context_document_root; else return ap_document_root(r); } ",0 "void __init postgresql_init(void) { dissect_add(""postgresql"", APP_LAYER_TCP, 5432, dissector_postgresql); } ",0 " static void Direct_Move_X( EXEC_OPS PGlyph_Zone zone, Int point, TT_F26Dot6 distance ) { (void)exc; zone->cur_x[point] += distance; zone->touch[point] |= TT_Flag_Touched_X; } ",0 "static void mmu_spte_clear_no_track(u64 *sptep) { __update_clear_spte_fast(sptep, 0ull); } ",0 "static inline spl_dllist_object *spl_dllist_from_obj(zend_object *obj) /* {{{ */ { return (spl_dllist_object*)((char*)(obj) - XtOffsetOf(spl_dllist_object, std)); } /* }}} */ ",0 "static bool isValidNameNonASCII(const UChar* characters, unsigned length) { unsigned i = 0; UChar32 c; U16_NEXT(characters, i, length, c) if (!isValidNameStart(c)) return false; while (i < length) { U16_NEXT(characters, i, length, c) if (!isValidNamePart(c)) return false; } return true; } ",0 "char *msPostGISBuildSQLSRID(layerObj *layer) { char *strSRID = NULL; msPostGISLayerInfo *layerinfo = NULL; if (layer->debug) { msDebug(""msPostGISBuildSQLSRID called.\n""); } assert( layer->layerinfo != NULL); layerinfo = (msPostGISLayerInfo *)layer->layerinfo; /* An SRID was already provided in the DATA line. */ if ( layerinfo->srid && (strlen(layerinfo->srid) > 0) ) { strSRID = msStrdup(layerinfo->srid); if( layer->debug > 1 ) { msDebug(""msPostGISBuildSQLSRID: SRID provided (%s)\n"", strSRID); } } /* ** No SRID in data line, so extract target table from the 'fromsource'. ** Either of form ""thetable"" (one word) or ""(select ... from thetable)"" ** or ""(select ... from thetable where ...)"". */ else { char *f_table_name; char *strSRIDTemplate = ""find_srid('','%s','%s')""; char *pos = strstr(layerinfo->fromsource, "" ""); if( layer->debug > 1 ) { msDebug(""msPostGISBuildSQLSRID: Building find_srid line.\n"", strSRID); } if ( ! pos ) { /* target table is one word */ f_table_name = msStrdup(layerinfo->fromsource); if( layer->debug > 1 ) { msDebug(""msPostGISBuildSQLSRID: Found table (%s)\n"", f_table_name); } } else { /* target table is hiding in sub-select clause */ pos = strcasestr(layerinfo->fromsource, "" from ""); if ( pos ) { char *pos_paren; char *pos_space; pos += 6; /* should be start of table name */ pos_paren = strstr(pos, "")""); /* first ) after table name */ pos_space = strstr(pos, "" ""); /* first space after table name */ if ( pos_space < pos_paren ) { /* found space first */ f_table_name = (char*)msSmallMalloc(pos_space - pos + 1); strlcpy(f_table_name, pos, pos_space - pos+1); } else { /* found ) first */ f_table_name = (char*)msSmallMalloc(pos_paren - pos + 1); strlcpy(f_table_name, pos, pos_paren - pos+1); } } else { /* should not happen */ return NULL; } } strSRID = msSmallMalloc(strlen(strSRIDTemplate) + strlen(f_table_name) + strlen(layerinfo->geomcolumn)); sprintf(strSRID, strSRIDTemplate, f_table_name, layerinfo->geomcolumn); if ( f_table_name ) free(f_table_name); } return strSRID; } ",0 " static PassOwnPtr create() { return adoptPtr(new CheckFocusedElementTask()); } ",0 "static HB_Error Load_PosClassSet( HB_ContextPosFormat2* cpf2, HB_PosClassSet* pcs, HB_Stream stream ) { HB_Error error; HB_UShort n, m, count; HB_UInt cur_offset, new_offset, base_offset; HB_PosClassRule* pcr; base_offset = FILE_Pos(); if ( ACCESS_Frame( 2L ) ) return error; count = pcs->PosClassRuleCount = GET_UShort(); FORGET_Frame(); pcs->PosClassRule = NULL; if ( ALLOC_ARRAY( pcs->PosClassRule, count, HB_PosClassRule ) ) return error; pcr = pcs->PosClassRule; for ( n = 0; n < count; n++ ) { if ( ACCESS_Frame( 2L ) ) goto Fail; new_offset = GET_UShort() + base_offset; FORGET_Frame(); cur_offset = FILE_Pos(); if ( FILE_Seek( new_offset ) || ( error = Load_PosClassRule( cpf2, &pcr[n], stream ) ) != HB_Err_Ok ) goto Fail; (void)FILE_Seek( cur_offset ); } return HB_Err_Ok; Fail: for ( m = 0; m < n; m++ ) Free_PosClassRule( &pcr[m] ); FREE( pcr ); return error; } ",0 "static int listen(struct socket *sock, int len) { struct sock *sk = sock->sk; int res; lock_sock(sk); if (sock->state != SS_UNCONNECTED) res = -EINVAL; else { sock->state = SS_LISTENING; res = 0; } release_sock(sk); return res; } ",0 "static int nfs4_xdr_dec_setclientid(struct rpc_rqst *req, __be32 *p, struct nfs_client *clp) { struct xdr_stream xdr; struct compound_hdr hdr; int status; xdr_init_decode(&xdr, &req->rq_rcv_buf, p); status = decode_compound_hdr(&xdr, &hdr); if (!status) status = decode_setclientid(&xdr, clp); if (!status) status = nfs4_stat_to_errno(hdr.status); return status; } ",0 "long VideoTrack::Seek(long long time_ns, const BlockEntry*& pResult) const { const long status = GetFirst(pResult); if (status < 0) // buffer underflow, etc return status; assert(pResult); if (pResult->EOS()) return 0; const Cluster* pCluster = pResult->GetCluster(); assert(pCluster); assert(pCluster->GetIndex() >= 0); if (time_ns <= pResult->GetBlock()->GetTime(pCluster)) return 0; Cluster** const clusters = m_pSegment->m_clusters; assert(clusters); const long count = m_pSegment->GetCount(); // loaded only, not pre-loaded assert(count > 0); Cluster** const i = clusters + pCluster->GetIndex(); assert(i); assert(*i == pCluster); assert(pCluster->GetTime() <= time_ns); Cluster** const j = clusters + count; Cluster** lo = i; Cluster** hi = j; while (lo < hi) { Cluster** const mid = lo + (hi - lo) / 2; assert(mid < hi); pCluster = *mid; assert(pCluster); assert(pCluster->GetIndex() >= 0); assert(pCluster->GetIndex() == long(mid - m_pSegment->m_clusters)); const long long t = pCluster->GetTime(); if (t <= time_ns) lo = mid + 1; else hi = mid; assert(lo <= hi); } assert(lo == hi); assert(lo > i); assert(lo <= j); pCluster = *--lo; assert(pCluster); assert(pCluster->GetTime() <= time_ns); pResult = pCluster->GetEntry(this, time_ns); if ((pResult != 0) && !pResult->EOS()) // found a keyframe return 0; while (lo != i) { pCluster = *--lo; assert(pCluster); assert(pCluster->GetTime() <= time_ns); #if 0 pResult = pCluster->GetMaxKey(this); #else pResult = pCluster->GetEntry(this, time_ns); #endif if ((pResult != 0) && !pResult->EOS()) return 0; } pResult = GetEOS(); return 0; } ",1 "kadm5_get_principal(void *server_handle, krb5_principal principal, kadm5_principal_ent_t entry, long in_mask) { krb5_db_entry *kdb; osa_princ_ent_rec adb; krb5_error_code ret = 0; long mask; int i; kadm5_server_handle_t handle = server_handle; CHECK_HANDLE(server_handle); krb5_clear_error_message(handle->context); /* * In version 1, all the defined fields are always returned. * entry is a pointer to a kadm5_principal_ent_t_v1 that should be * filled with allocated memory. */ mask = in_mask; memset(entry, 0, sizeof(*entry)); if (principal == NULL) return EINVAL; if ((ret = kdb_get_entry(handle, principal, &kdb, &adb))) return ret; if ((mask & KADM5_POLICY) && adb.policy && (adb.aux_attributes & KADM5_POLICY)) { if ((entry->policy = strdup(adb.policy)) == NULL) { ret = ENOMEM; goto done; } } if (mask & KADM5_AUX_ATTRIBUTES) entry->aux_attributes = adb.aux_attributes; if ((mask & KADM5_PRINCIPAL) && (ret = krb5_copy_principal(handle->context, kdb->princ, &entry->principal))) { goto done; } if (mask & KADM5_PRINC_EXPIRE_TIME) entry->princ_expire_time = kdb->expiration; if ((mask & KADM5_LAST_PWD_CHANGE) && (ret = krb5_dbe_lookup_last_pwd_change(handle->context, kdb, &(entry->last_pwd_change)))) { goto done; } if (mask & KADM5_PW_EXPIRATION) entry->pw_expiration = kdb->pw_expiration; if (mask & KADM5_MAX_LIFE) entry->max_life = kdb->max_life; /* this is a little non-sensical because the function returns two */ /* values that must be checked separately against the mask */ if ((mask & KADM5_MOD_NAME) || (mask & KADM5_MOD_TIME)) { ret = krb5_dbe_lookup_mod_princ_data(handle->context, kdb, &(entry->mod_date), &(entry->mod_name)); if (ret) { goto done; } if (! (mask & KADM5_MOD_TIME)) entry->mod_date = 0; if (! (mask & KADM5_MOD_NAME)) { krb5_free_principal(handle->context, entry->mod_name); entry->mod_name = NULL; } } if (mask & KADM5_ATTRIBUTES) entry->attributes = kdb->attributes; if (mask & KADM5_KVNO) for (entry->kvno = 0, i=0; in_key_data; i++) if ((krb5_kvno) kdb->key_data[i].key_data_kvno > entry->kvno) entry->kvno = kdb->key_data[i].key_data_kvno; if (mask & KADM5_MKVNO) { ret = krb5_dbe_get_mkvno(handle->context, kdb, &entry->mkvno); if (ret) goto done; } if (mask & KADM5_MAX_RLIFE) entry->max_renewable_life = kdb->max_renewable_life; if (mask & KADM5_LAST_SUCCESS) entry->last_success = kdb->last_success; if (mask & KADM5_LAST_FAILED) entry->last_failed = kdb->last_failed; if (mask & KADM5_FAIL_AUTH_COUNT) entry->fail_auth_count = kdb->fail_auth_count; if (mask & KADM5_TL_DATA) { krb5_tl_data *tl, *tl2; entry->tl_data = NULL; tl = kdb->tl_data; while (tl) { if (tl->tl_data_type > 255) { if ((tl2 = dup_tl_data(tl)) == NULL) { ret = ENOMEM; goto done; } tl2->tl_data_next = entry->tl_data; entry->tl_data = tl2; entry->n_tl_data++; } tl = tl->tl_data_next; } } if (mask & KADM5_KEY_DATA) { entry->n_key_data = kdb->n_key_data; if(entry->n_key_data) { entry->key_data = k5calloc(entry->n_key_data, sizeof(krb5_key_data), &ret); if (entry->key_data == NULL) goto done; } else entry->key_data = NULL; for (i = 0; i < entry->n_key_data; i++) ret = krb5_copy_key_data_contents(handle->context, &kdb->key_data[i], &entry->key_data[i]); if (ret) goto done; } ret = KADM5_OK; done: if (ret && entry->principal) { krb5_free_principal(handle->context, entry->principal); entry->principal = NULL; } kdb_free_entry(handle, kdb, &adb); return ret; } ",0 "PHPAPI PHP_FUNCTION(ftell) { zval *arg1; long ret; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &arg1) == FAILURE) { RETURN_FALSE; } PHP_STREAM_TO_ZVAL(stream, &arg1); ret = php_stream_tell(stream); if (ret == -1) { RETURN_FALSE; } RETURN_LONG(ret); } ",0 "static PassRefPtr buildObjectForSize(const IntSize& size) { RefPtr result = JSONObject::create(); result->setNumber(""width"", size.width()); result->setNumber(""height"", size.height()); return result.release(); } ",0 "OMX_ERRORTYPE omx_video::allocate_buffer(OMX_IN OMX_HANDLETYPE hComp, OMX_INOUT OMX_BUFFERHEADERTYPE** bufferHdr, OMX_IN OMX_U32 port, OMX_IN OMX_PTR appData, OMX_IN OMX_U32 bytes) { OMX_ERRORTYPE eRet = OMX_ErrorNone; // OMX return type DEBUG_PRINT_LOW(""Allocate buffer of size = %u on port %d"", (unsigned int)bytes, (int)port); if (m_state == OMX_StateInvalid) { DEBUG_PRINT_ERROR(""ERROR: Allocate Buf in Invalid State""); return OMX_ErrorInvalidState; } if (port == PORT_INDEX_IN) { #ifdef _ANDROID_ICS_ if (meta_mode_enable) eRet = allocate_input_meta_buffer(hComp,bufferHdr,appData,bytes); else #endif eRet = allocate_input_buffer(hComp,bufferHdr,port,appData,bytes); } else if (port == PORT_INDEX_OUT) { eRet = allocate_output_buffer(hComp,bufferHdr,port,appData,bytes); } else { DEBUG_PRINT_ERROR(""ERROR: Invalid Port Index received %d"",(int)port); eRet = OMX_ErrorBadPortIndex; } DEBUG_PRINT_LOW(""Checking for Output Allocate buffer Done""); if (eRet == OMX_ErrorNone) { if (allocate_done()) { if (BITMASK_PRESENT(&m_flags,OMX_COMPONENT_IDLE_PENDING)) { BITMASK_CLEAR((&m_flags),OMX_COMPONENT_IDLE_PENDING); post_event(OMX_CommandStateSet,OMX_StateIdle, OMX_COMPONENT_GENERATE_EVENT); } } if (port == PORT_INDEX_IN && m_sInPortDef.bPopulated) { if (BITMASK_PRESENT(&m_flags,OMX_COMPONENT_INPUT_ENABLE_PENDING)) { BITMASK_CLEAR((&m_flags),OMX_COMPONENT_INPUT_ENABLE_PENDING); post_event(OMX_CommandPortEnable, PORT_INDEX_IN, OMX_COMPONENT_GENERATE_EVENT); } } if (port == PORT_INDEX_OUT && m_sOutPortDef.bPopulated) { if (BITMASK_PRESENT(&m_flags,OMX_COMPONENT_OUTPUT_ENABLE_PENDING)) { BITMASK_CLEAR((&m_flags),OMX_COMPONENT_OUTPUT_ENABLE_PENDING); post_event(OMX_CommandPortEnable, PORT_INDEX_OUT, OMX_COMPONENT_GENERATE_EVENT); m_event_port_settings_sent = false; } } } DEBUG_PRINT_LOW(""Allocate Buffer exit with ret Code %d"",eRet); return eRet; } ",0 "static int netlink_bind(struct socket *sock, struct sockaddr *addr, int addr_len) { struct sock *sk = sock->sk; struct net *net = sock_net(sk); struct netlink_sock *nlk = nlk_sk(sk); struct sockaddr_nl *nladdr = (struct sockaddr_nl *)addr; int err; long unsigned int groups = nladdr->nl_groups; bool bound; if (addr_len < sizeof(struct sockaddr_nl)) return -EINVAL; if (nladdr->nl_family != AF_NETLINK) return -EINVAL; /* Only superuser is allowed to listen multicasts */ if (groups) { if (!netlink_allowed(sock, NL_CFG_F_NONROOT_RECV)) return -EPERM; err = netlink_realloc_groups(sk); if (err) return err; } bound = nlk->bound; if (bound) { /* Ensure nlk->portid is up-to-date. */ smp_rmb(); if (nladdr->nl_pid != nlk->portid) return -EINVAL; } if (nlk->netlink_bind && groups) { int group; for (group = 0; group < nlk->ngroups; group++) { if (!test_bit(group, &groups)) continue; err = nlk->netlink_bind(net, group + 1); if (!err) continue; netlink_undo_bind(group, groups, sk); return err; } } /* No need for barriers here as we return to user-space without * using any of the bound attributes. */ if (!bound) { err = nladdr->nl_pid ? netlink_insert(sk, nladdr->nl_pid) : netlink_autobind(sock); if (err) { netlink_undo_bind(nlk->ngroups, groups, sk); return err; } } if (!groups && (nlk->groups == NULL || !(u32)nlk->groups[0])) return 0; netlink_table_grab(); netlink_update_subscriptions(sk, nlk->subscriptions + hweight32(groups) - hweight32(nlk->groups[0])); nlk->groups[0] = (nlk->groups[0] & ~0xffffffffUL) | groups; netlink_update_listeners(sk); netlink_table_ungrab(); return 0; } ",0 " void AddLaunched(Profile* profile) { launched_profiles_.insert(profile); if (chrome::FindBrowserWithProfile(profile)) { opened_profiles_.insert(profile); } } ",0 "xsltDebugDumpExtModulesCallback(void *function ATTRIBUTE_UNUSED, FILE * output, const xmlChar * URI, const xmlChar * not_used ATTRIBUTE_UNUSED, const xmlChar * not_used2 ATTRIBUTE_UNUSED) { if (!URI) return; fprintf(output, ""%s\n"", URI); } ",0 "void RenderWidgetHostViewAndroid::TextInputStateChanged( const ViewHostMsg_TextInputState_Params& params) { if (!IsShowing()) return; content_view_core_->ImeUpdateAdapter( GetNativeImeAdapter(), static_cast(params.type), params.value, params.selection_start, params.selection_end, params.composition_start, params.composition_end, params.show_ime_if_needed); } ",0 "CSSPropertyID SVGElement::CssPropertyIdForSVGAttributeName( const QualifiedName& attr_name) { if (!attr_name.NamespaceURI().IsNull()) return CSSPropertyInvalid; static HashMap* property_name_to_id_map = nullptr; if (!property_name_to_id_map) { property_name_to_id_map = new HashMap; const QualifiedName* const attr_names[] = { &kAlignmentBaselineAttr, &kBaselineShiftAttr, &kBufferedRenderingAttr, &kClipAttr, &kClipPathAttr, &kClipRuleAttr, &svg_names::kColorAttr, &kColorInterpolationAttr, &kColorInterpolationFiltersAttr, &kColorRenderingAttr, &kCursorAttr, &svg_names::kDirectionAttr, &kDisplayAttr, &kDominantBaselineAttr, &kFillAttr, &kFillOpacityAttr, &kFillRuleAttr, &kFilterAttr, &kFloodColorAttr, &kFloodOpacityAttr, &kFontFamilyAttr, &kFontSizeAttr, &kFontStretchAttr, &kFontStyleAttr, &kFontVariantAttr, &kFontWeightAttr, &kImageRenderingAttr, &kLetterSpacingAttr, &kLightingColorAttr, &kMarkerEndAttr, &kMarkerMidAttr, &kMarkerStartAttr, &kMaskAttr, &kMaskTypeAttr, &kOpacityAttr, &kOverflowAttr, &kPaintOrderAttr, &kPointerEventsAttr, &kShapeRenderingAttr, &kStopColorAttr, &kStopOpacityAttr, &kStrokeAttr, &kStrokeDasharrayAttr, &kStrokeDashoffsetAttr, &kStrokeLinecapAttr, &kStrokeLinejoinAttr, &kStrokeMiterlimitAttr, &kStrokeOpacityAttr, &kStrokeWidthAttr, &kTextAnchorAttr, &kTextDecorationAttr, &kTextRenderingAttr, &kTransformOriginAttr, &kUnicodeBidiAttr, &kVectorEffectAttr, &kVisibilityAttr, &kWordSpacingAttr, &kWritingModeAttr, }; for (size_t i = 0; i < arraysize(attr_names); i++) { CSSPropertyID property_id = cssPropertyID(attr_names[i]->LocalName()); DCHECK_GT(property_id, 0); property_name_to_id_map->Set(attr_names[i]->LocalName().Impl(), property_id); } } return property_name_to_id_map->at(attr_name.LocalName().Impl()); } ",0 "virDomainMigrateToURI3(virDomainPtr domain, const char *dconnuri, virTypedParameterPtr params, unsigned int nparams, unsigned int flags) { VIR_DOMAIN_DEBUG(domain, ""dconnuri=%s, params=%p, nparms=%u flags=%x"", NULLSTR(dconnuri), params, nparams, flags); VIR_TYPED_PARAMS_DEBUG(params, nparams); virResetLastError(); /* First checkout the source */ virCheckDomainReturn(domain, -1); virCheckReadOnlyGoto(domain->conn->flags, error); if (virDomainMigrateUnmanagedCheckCompat(domain, flags) < 0) goto error; if (flags & VIR_MIGRATE_PEER2PEER) virCheckNonNullArgGoto(dconnuri, error); else dconnuri = NULL; if (virDomainMigrateUnmanagedParams(domain, dconnuri, params, nparams, flags) < 0) goto error; return 0; error: virDispatchError(domain->conn); return -1; } ",0 "short * CLASS foveon_make_curve (double max, double mul, double filt) { short *curve; unsigned i, size; double x; if (!filt) filt = 0.8; size = 4*M_PI*max / filt; if (size == UINT_MAX) size--; curve = (short *) calloc (size+1, sizeof *curve); merror (curve, ""foveon_make_curve()""); curve[0] = size; for (i=0; i < size; i++) { x = i*filt/max/4; curve[i+1] = (cos(x)+1)/2 * tanh(i*filt/mul) * mul + 0.5; } return curve; } ",0 "void _WM_do_meta_channelprefix(struct _mdi *mdi, struct _event_data *data) { /* placeholder function so we can record tempo in the event stream * for conversion function _WM_Event2Midi */ #ifdef DEBUG_MIDI uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__, ch, data->data.value); #else UNUSED(data); #endif UNUSED(mdi); return; } ",0 "static int rdp_recv_fastpath_pdu(rdpRdp* rdp, STREAM* s) { UINT16 length; rdpFastPath* fastpath; fastpath = rdp->fastpath; if (!fastpath_read_header_rdp(fastpath, s, &length)) return -1; if ((length == 0) || (length > stream_get_left(s))) { printf(""incorrect FastPath PDU header length %d\n"", length); return -1; } if (fastpath->encryptionFlags & FASTPATH_OUTPUT_ENCRYPTED) { UINT16 flags = (fastpath->encryptionFlags & FASTPATH_OUTPUT_SECURE_CHECKSUM) ? SEC_SECURE_CHECKSUM : 0; if (!rdp_decrypt(rdp, s, length, flags)) return -1; } return fastpath_recv_updates(rdp->fastpath, s); } ",0 "MagickExport void GetImageException(Image *image,ExceptionInfo *exception) { register Image *next; assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); for (next=image; next != (Image *) NULL; next=GetNextImageInList(next)) { if (next->exception.severity == UndefinedException) continue; if (next->exception.severity > exception->severity) InheritException(exception,&next->exception); next->exception.severity=UndefinedException; } } ",0 "void OMXNodeInstance::onGetHandleFailed() { delete this; } ",0 "aspath_delete_confed_seq (struct aspath *aspath) { struct assegment *seg; if (!(aspath && aspath->segments)) return aspath; seg = aspath->segments; /* ""if the first path segment of the AS_PATH is * of type AS_CONFED_SEQUENCE,"" */ if (aspath->segments->type != AS_CONFED_SEQUENCE) return aspath; /* ""... that segment and any immediately following segments * of the type AS_CONFED_SET or AS_CONFED_SEQUENCE are removed * from the AS_PATH attribute,"" */ while (seg && (seg->type == AS_CONFED_SEQUENCE || seg->type == AS_CONFED_SET)) { aspath->segments = seg->next; assegment_free (seg); seg = aspath->segments; } aspath_str_update (aspath); return aspath; } ",0 "bool AutofillManager::IsAutofillEnabled() const { return ::autofill::IsAutofillEnabled(client_->GetPrefs()) && client_->IsAutofillSupported(); } ",0 "static void Bitmap_reconfigure(JNIEnv* env, jobject clazz, jlong bitmapHandle, jint width, jint height, jint configHandle, jint allocSize, jboolean requestPremul) { SkBitmap* bitmap = reinterpret_cast(bitmapHandle); SkColorType colorType = GraphicsJNI::legacyBitmapConfigToColorType(configHandle); if (colorType == kARGB_4444_SkColorType) { colorType = kN32_SkColorType; } if (width * height * SkColorTypeBytesPerPixel(colorType) > allocSize) { doThrowIAE(env, ""Bitmap not large enough to support new configuration""); return; } SkPixelRef* ref = bitmap->pixelRef(); ref->ref(); SkAlphaType alphaType; if (bitmap->colorType() != kRGB_565_SkColorType && bitmap->alphaType() == kOpaque_SkAlphaType) { alphaType = kOpaque_SkAlphaType; } else { alphaType = requestPremul ? kPremul_SkAlphaType : kUnpremul_SkAlphaType; } bitmap->setInfo(SkImageInfo::Make(width, height, colorType, alphaType)); SkImageInfo& info = const_cast(ref->info()); info = bitmap->info(); bitmap->setPixelRef(ref); ref->notifyPixelsChanged(); ref->unref(); } ",0 "static void analyzeOneTable( Parse *pParse, /* Parser context */ Table *pTab, /* Table whose indices are to be analyzed */ Index *pOnlyIdx, /* If not NULL, only analyze this one index */ int iStatCur, /* Index of VdbeCursor that writes the sqlite_stat1 table */ int iMem, /* Available memory locations begin here */ int iTab /* Next available cursor */ ){ sqlite3 *db = pParse->db; /* Database handle */ Index *pIdx; /* An index to being analyzed */ int iIdxCur; /* Cursor open on index being analyzed */ int iTabCur; /* Table cursor */ Vdbe *v; /* The virtual machine being built up */ int i; /* Loop counter */ int jZeroRows = -1; /* Jump from here if number of rows is zero */ int iDb; /* Index of database containing pTab */ u8 needTableCnt = 1; /* True to count the table */ int regNewRowid = iMem++; /* Rowid for the inserted record */ int regStat4 = iMem++; /* Register to hold Stat4Accum object */ int regChng = iMem++; /* Index of changed index field */ #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 int regRowid = iMem++; /* Rowid argument passed to stat_push() */ #endif int regTemp = iMem++; /* Temporary use register */ int regTabname = iMem++; /* Register containing table name */ int regIdxname = iMem++; /* Register containing index name */ int regStat1 = iMem++; /* Value for the stat column of sqlite_stat1 */ int regPrev = iMem; /* MUST BE LAST (see below) */ #ifdef SQLITE_ENABLE_PREUPDATE_HOOK Table *pStat1 = 0; #endif pParse->nMem = MAX(pParse->nMem, iMem); v = sqlite3GetVdbe(pParse); if( v==0 || NEVER(pTab==0) ){ return; } if( pTab->tnum==0 ){ /* Do not gather statistics on views or virtual tables */ return; } if( sqlite3_strlike(""sqlite\\_%"", pTab->zName, '\\')==0 ){ /* Do not gather statistics on system tables */ return; } assert( sqlite3BtreeHoldsAllMutexes(db) ); iDb = sqlite3SchemaToIndex(db, pTab->pSchema); assert( iDb>=0 ); assert( sqlite3SchemaMutexHeld(db, iDb, 0) ); #ifndef SQLITE_OMIT_AUTHORIZATION if( sqlite3AuthCheck(pParse, SQLITE_ANALYZE, pTab->zName, 0, db->aDb[iDb].zDbSName ) ){ return; } #endif #ifdef SQLITE_ENABLE_PREUPDATE_HOOK if( db->xPreUpdateCallback ){ pStat1 = (Table*)sqlite3DbMallocZero(db, sizeof(Table) + 13); if( pStat1==0 ) return; pStat1->zName = (char*)&pStat1[1]; memcpy(pStat1->zName, ""sqlite_stat1"", 13); pStat1->nCol = 3; pStat1->iPKey = -1; sqlite3VdbeAddOp4(pParse->pVdbe, OP_Noop, 0, 0, 0,(char*)pStat1,P4_DYNBLOB); } #endif /* Establish a read-lock on the table at the shared-cache level. ** Open a read-only cursor on the table. Also allocate a cursor number ** to use for scanning indexes (iIdxCur). No index cursor is opened at ** this time though. */ sqlite3TableLock(pParse, iDb, pTab->tnum, 0, pTab->zName); iTabCur = iTab++; iIdxCur = iTab++; pParse->nTab = MAX(pParse->nTab, iTab); sqlite3OpenTable(pParse, iTabCur, iDb, pTab, OP_OpenRead); sqlite3VdbeLoadString(v, regTabname, pTab->zName); for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int nCol; /* Number of columns in pIdx. ""N"" */ int addrRewind; /* Address of ""OP_Rewind iIdxCur"" */ int addrNextRow; /* Address of ""next_row:"" */ const char *zIdxName; /* Name of the index */ int nColTest; /* Number of columns to test for changes */ if( pOnlyIdx && pOnlyIdx!=pIdx ) continue; if( pIdx->pPartIdxWhere==0 ) needTableCnt = 0; if( !HasRowid(pTab) && IsPrimaryKeyIndex(pIdx) ){ nCol = pIdx->nKeyCol; zIdxName = pTab->zName; nColTest = nCol - 1; }else{ nCol = pIdx->nColumn; zIdxName = pIdx->zName; nColTest = pIdx->uniqNotNull ? pIdx->nKeyCol-1 : nCol-1; } /* Populate the register containing the index name. */ sqlite3VdbeLoadString(v, regIdxname, zIdxName); VdbeComment((v, ""Analysis for %s.%s"", pTab->zName, zIdxName)); /* ** Pseudo-code for loop that calls stat_push(): ** ** Rewind csr ** if eof(csr) goto end_of_scan; ** regChng = 0 ** goto chng_addr_0; ** ** next_row: ** regChng = 0 ** if( idx(0) != regPrev(0) ) goto chng_addr_0 ** regChng = 1 ** if( idx(1) != regPrev(1) ) goto chng_addr_1 ** ... ** regChng = N ** goto chng_addr_N ** ** chng_addr_0: ** regPrev(0) = idx(0) ** chng_addr_1: ** regPrev(1) = idx(1) ** ... ** ** endDistinctTest: ** regRowid = idx(rowid) ** stat_push(P, regChng, regRowid) ** Next csr ** if !eof(csr) goto next_row; ** ** end_of_scan: */ /* Make sure there are enough memory cells allocated to accommodate ** the regPrev array and a trailing rowid (the rowid slot is required ** when building a record to insert into the sample column of ** the sqlite_stat4 table. */ pParse->nMem = MAX(pParse->nMem, regPrev+nColTest); /* Open a read-only cursor on the index being analyzed. */ assert( iDb==sqlite3SchemaToIndex(db, pIdx->pSchema) ); sqlite3VdbeAddOp3(v, OP_OpenRead, iIdxCur, pIdx->tnum, iDb); sqlite3VdbeSetP4KeyInfo(pParse, pIdx); VdbeComment((v, ""%s"", pIdx->zName)); /* Invoke the stat_init() function. The arguments are: ** ** (1) the number of columns in the index including the rowid ** (or for a WITHOUT ROWID table, the number of PK columns), ** (2) the number of columns in the key without the rowid/pk ** (3) the number of rows in the index, ** ** ** The third argument is only used for STAT3 and STAT4 */ #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 sqlite3VdbeAddOp2(v, OP_Count, iIdxCur, regStat4+3); #endif sqlite3VdbeAddOp2(v, OP_Integer, nCol, regStat4+1); sqlite3VdbeAddOp2(v, OP_Integer, pIdx->nKeyCol, regStat4+2); sqlite3VdbeAddOp4(v, OP_Function0, 0, regStat4+1, regStat4, (char*)&statInitFuncdef, P4_FUNCDEF); sqlite3VdbeChangeP5(v, 2+IsStat34); /* Implementation of the following: ** ** Rewind csr ** if eof(csr) goto end_of_scan; ** regChng = 0 ** goto next_push_0; ** */ addrRewind = sqlite3VdbeAddOp1(v, OP_Rewind, iIdxCur); VdbeCoverage(v); sqlite3VdbeAddOp2(v, OP_Integer, 0, regChng); addrNextRow = sqlite3VdbeCurrentAddr(v); if( nColTest>0 ){ int endDistinctTest = sqlite3VdbeMakeLabel(pParse); int *aGotoChng; /* Array of jump instruction addresses */ aGotoChng = sqlite3DbMallocRawNN(db, sizeof(int)*nColTest); if( aGotoChng==0 ) continue; /* ** next_row: ** regChng = 0 ** if( idx(0) != regPrev(0) ) goto chng_addr_0 ** regChng = 1 ** if( idx(1) != regPrev(1) ) goto chng_addr_1 ** ... ** regChng = N ** goto endDistinctTest */ sqlite3VdbeAddOp0(v, OP_Goto); addrNextRow = sqlite3VdbeCurrentAddr(v); if( nColTest==1 && pIdx->nKeyCol==1 && IsUniqueIndex(pIdx) ){ /* For a single-column UNIQUE index, once we have found a non-NULL ** row, we know that all the rest will be distinct, so skip ** subsequent distinctness tests. */ sqlite3VdbeAddOp2(v, OP_NotNull, regPrev, endDistinctTest); VdbeCoverage(v); } for(i=0; iazColl[i]); sqlite3VdbeAddOp2(v, OP_Integer, i, regChng); sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, i, regTemp); aGotoChng[i] = sqlite3VdbeAddOp4(v, OP_Ne, regTemp, 0, regPrev+i, pColl, P4_COLLSEQ); sqlite3VdbeChangeP5(v, SQLITE_NULLEQ); VdbeCoverage(v); } sqlite3VdbeAddOp2(v, OP_Integer, nColTest, regChng); sqlite3VdbeGoto(v, endDistinctTest); /* ** chng_addr_0: ** regPrev(0) = idx(0) ** chng_addr_1: ** regPrev(1) = idx(1) ** ... */ sqlite3VdbeJumpHere(v, addrNextRow-1); for(i=0; ipTable); int j, k, regKey; regKey = sqlite3GetTempRange(pParse, pPk->nKeyCol); for(j=0; jnKeyCol; j++){ k = sqlite3ColumnOfIndex(pIdx, pPk->aiColumn[j]); assert( k>=0 && knColumn ); sqlite3VdbeAddOp3(v, OP_Column, iIdxCur, k, regKey+j); VdbeComment((v, ""%s"", pTab->aCol[pPk->aiColumn[j]].zName)); } sqlite3VdbeAddOp3(v, OP_MakeRecord, regKey, pPk->nKeyCol, regRowid); sqlite3ReleaseTempRange(pParse, regKey, pPk->nKeyCol); } #endif assert( regChng==(regStat4+1) ); sqlite3VdbeAddOp4(v, OP_Function0, 1, regStat4, regTemp, (char*)&statPushFuncdef, P4_FUNCDEF); sqlite3VdbeChangeP5(v, 2+IsStat34); sqlite3VdbeAddOp2(v, OP_Next, iIdxCur, addrNextRow); VdbeCoverage(v); /* Add the entry to the stat1 table. */ callStatGet(v, regStat4, STAT_GET_STAT1, regStat1); assert( ""BBB""[0]==SQLITE_AFF_TEXT ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, ""BBB"", 0); sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK sqlite3VdbeChangeP4(v, -1, (char*)pStat1, P4_TABLE); #endif sqlite3VdbeChangeP5(v, OPFLAG_APPEND); /* Add the entries to the stat3 or stat4 table. */ #ifdef SQLITE_ENABLE_STAT3_OR_STAT4 { int regEq = regStat1; int regLt = regStat1+1; int regDLt = regStat1+2; int regSample = regStat1+3; int regCol = regStat1+4; int regSampleRowid = regCol + nCol; int addrNext; int addrIsNull; u8 seekOp = HasRowid(pTab) ? OP_NotExists : OP_NotFound; pParse->nMem = MAX(pParse->nMem, regCol+nCol); addrNext = sqlite3VdbeCurrentAddr(v); callStatGet(v, regStat4, STAT_GET_ROWID, regSampleRowid); addrIsNull = sqlite3VdbeAddOp1(v, OP_IsNull, regSampleRowid); VdbeCoverage(v); callStatGet(v, regStat4, STAT_GET_NEQ, regEq); callStatGet(v, regStat4, STAT_GET_NLT, regLt); callStatGet(v, regStat4, STAT_GET_NDLT, regDLt); sqlite3VdbeAddOp4Int(v, seekOp, iTabCur, addrNext, regSampleRowid, 0); VdbeCoverage(v); #ifdef SQLITE_ENABLE_STAT3 sqlite3ExprCodeLoadIndexColumn(pParse, pIdx, iTabCur, 0, regSample); #else for(i=0; izName)); sqlite3VdbeAddOp2(v, OP_Count, iTabCur, regStat1); jZeroRows = sqlite3VdbeAddOp1(v, OP_IfNot, regStat1); VdbeCoverage(v); sqlite3VdbeAddOp2(v, OP_Null, 0, regIdxname); assert( ""BBB""[0]==SQLITE_AFF_TEXT ); sqlite3VdbeAddOp4(v, OP_MakeRecord, regTabname, 3, regTemp, ""BBB"", 0); sqlite3VdbeAddOp2(v, OP_NewRowid, iStatCur, regNewRowid); sqlite3VdbeAddOp3(v, OP_Insert, iStatCur, regTemp, regNewRowid); sqlite3VdbeChangeP5(v, OPFLAG_APPEND); #ifdef SQLITE_ENABLE_PREUPDATE_HOOK sqlite3VdbeChangeP4(v, -1, (char*)pStat1, P4_TABLE); #endif sqlite3VdbeJumpHere(v, jZeroRows); } } ",0 "int iwlagn_add_bssid_station(struct iwl_priv *priv, struct iwl_rxon_context *ctx, const u8 *addr, u8 *sta_id_r) { int ret; u8 sta_id; struct iwl_link_quality_cmd *link_cmd; unsigned long flags; if (sta_id_r) *sta_id_r = IWL_INVALID_STATION; ret = iwl_add_station_common(priv, ctx, addr, 0, NULL, &sta_id); if (ret) { IWL_ERR(priv, ""Unable to add station %pM\n"", addr); return ret; } if (sta_id_r) *sta_id_r = sta_id; spin_lock_irqsave(&priv->shrd->sta_lock, flags); priv->stations[sta_id].used |= IWL_STA_LOCAL; spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); /* Set up default rate scaling table in device's station table */ link_cmd = iwl_sta_alloc_lq(priv, ctx, sta_id); if (!link_cmd) { IWL_ERR(priv, ""Unable to initialize rate scaling for station %pM.\n"", addr); return -ENOMEM; } ret = iwl_send_lq_cmd(priv, ctx, link_cmd, CMD_SYNC, true); if (ret) IWL_ERR(priv, ""Link quality command failed (%d)\n"", ret); spin_lock_irqsave(&priv->shrd->sta_lock, flags); priv->stations[sta_id].lq = link_cmd; spin_unlock_irqrestore(&priv->shrd->sta_lock, flags); return 0; } ",0 "WM_SYMBOL void WildMidi_ClearError (void) { _WM_Global_ErrorI = 0; if (_WM_Global_ErrorS != NULL) { free(_WM_Global_ErrorS); _WM_Global_ErrorS = NULL; } return; } ",0 "void __put_task_struct(struct task_struct *tsk) { WARN_ON(!tsk->exit_state); WARN_ON(atomic_read(&tsk->usage)); WARN_ON(tsk == current); exit_creds(tsk); delayacct_tsk_free(tsk); if (!profile_handoff_task(tsk)) free_task(tsk); } ",0 "static void myexit(int rv) { logmsg(""exiting...""); if (!arg_command && !arg_quiet) printf(""\nParent is shutting down, bye...\n""); EUID_ROOT(); clear_run_files(sandbox_pid); appimage_clear(); flush_stdin(); exit(rv); } ",0 "base::string16 GetDisplaySize(int64_t display_id) { display::DisplayManager* display_manager = GetDisplayManager(); const display::Display* display = &display_manager->GetDisplayForId(display_id); bool mirroring = display_manager->mirroring_display_id() == display_id; DCHECK(!mirroring); if (mirroring) return base::string16(); DCHECK(display->is_valid()); return base::UTF8ToUTF16(display->size().ToString()); } ",0 "static int cpuusage_write(struct cgroup *cgrp, struct cftype *cftype, u64 reset) { struct cpuacct *ca = cgroup_ca(cgrp); int err = 0; int i; if (reset) { err = -EINVAL; goto out; } for_each_present_cpu(i) cpuacct_cpuusage_write(ca, i, 0); out: return err; } ",0 "void ChromeContentBrowserClient::SelectClientCertificate( content::WebContents* web_contents, net::SSLCertRequestInfo* cert_request_info, net::ClientCertIdentityList client_certs, std::unique_ptr delegate) { prerender::PrerenderContents* prerender_contents = prerender::PrerenderContents::FromWebContents(web_contents); if (prerender_contents) { prerender_contents->Destroy( prerender::FINAL_STATUS_SSL_CLIENT_CERTIFICATE_REQUESTED); return; } GURL requesting_url(""https://"" + cert_request_info->host_and_port.ToString()); DCHECK(requesting_url.is_valid()) << ""Invalid URL string: https://"" << cert_request_info->host_and_port.ToString(); bool may_show_cert_selection = true; Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); #if defined(OS_CHROMEOS) if (chromeos::ProfileHelper::IsSigninProfile(profile)) { may_show_cert_selection = chromeos::switches::IsSigninFrameClientCertUserSelectionEnabled(); content::StoragePartition* storage_partition = content::BrowserContext::GetStoragePartition( profile, web_contents->GetSiteInstance()); chromeos::login::SigninPartitionManager* signin_partition_manager = chromeos::login::SigninPartitionManager::Factory::GetForBrowserContext( profile); if (!signin_partition_manager->IsCurrentSigninStoragePartition( storage_partition)) { LOG(WARNING) << ""Client cert requested in sign-in profile in wrong context.""; delegate->ContinueWithCertificate(nullptr, nullptr); return; } VLOG(1) << ""Client cert requested in sign-in profile.""; } #endif // defined(OS_CHROMEOS) std::unique_ptr auto_selected_identity = AutoSelectCertificate(profile, requesting_url, client_certs); if (auto_selected_identity) { scoped_refptr cert = auto_selected_identity->certificate(); net::ClientCertIdentity::SelfOwningAcquirePrivateKey( std::move(auto_selected_identity), base::Bind(&content::ClientCertificateDelegate::ContinueWithCertificate, base::Passed(&delegate), std::move(cert))); return; } if (!may_show_cert_selection) { LOG(WARNING) << ""No client cert matched by policy and user selection is "" ""not allowed.""; delegate->ContinueWithCertificate(nullptr, nullptr); return; } chrome::ShowSSLClientCertificateSelector(web_contents, cert_request_info, std::move(client_certs), std::move(delegate)); } ",0 "bool OSExchangeDataProviderAura::GetFilenames( std::vector* filenames) const { if ((formats_ & OSExchangeData::FILE_NAME) == 0) return false; *filenames = filenames_; return true; } ",0 "static void fill_note(struct memelfnote *note, const char *name, int type, unsigned int sz, void *data) { note->name = name; note->type = type; note->datasz = sz; note->data = data; return; } ",0 "static CURLcode smtp_state_starttls_resp(struct connectdata *conn, int smtpcode, smtpstate instate) { CURLcode result = CURLE_OK; struct Curl_easy *data = conn->data; (void)instate; /* no use for this yet */ if(smtpcode != 220) { if(data->set.use_ssl != CURLUSESSL_TRY) { failf(data, ""STARTTLS denied, code %d"", smtpcode); result = CURLE_USE_SSL_FAILED; } else result = smtp_perform_authentication(conn); } else result = smtp_perform_upgrade_tls(conn); return result; } ",0 "static void usbfs_decrease_memory_usage(unsigned amount) { atomic_sub(amount, &usbfs_memory_usage); } ",0 "set_reply_serial (DBusMessage *message) { if (message == NULL) _dbus_assert_not_reached (""oom""); if (!dbus_message_set_reply_serial (message, 100)) _dbus_assert_not_reached (""oom""); } ",0 "proc_do_defense_mode(ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { struct net *net = current->nsproxy->net_ns; int *valp = table->data; int val = *valp; int rc; rc = proc_dointvec(table, write, buffer, lenp, ppos); if (write && (*valp != val)) { if ((*valp < 0) || (*valp > 3)) { /* Restore the correct value */ *valp = val; } else { update_defense_level(net_ipvs(net)); } } return rc; } ",0 "ReadUserLogFileState::InitState( ReadUserLog::FileState &state ) { state.buf = (void *) new ReadUserLogState::FileStatePub; state.size = sizeof( ReadUserLogState::FileStatePub ); ReadUserLogFileState::FileState *istate; if ( !convertState(state, istate) ) { return false; } memset( istate, 0, sizeof(ReadUserLogState::FileStatePub) ); istate->m_log_type = LOG_TYPE_UNKNOWN; strncpy( istate->m_signature, FileStateSignature, sizeof(istate->m_signature) ); istate->m_signature[sizeof(istate->m_signature) - 1] = '\0'; istate->m_version = FILESTATE_VERSION; return true; } ",0 "GraphicsLayer* RenderLayerScrollableArea::layerForVerticalScrollbar() const { DisableCompositingQueryAsserts disabler; return layer()->hasCompositedLayerMapping() ? layer()->compositedLayerMapping()->layerForVerticalScrollbar() : 0; } ",0 "void RunCallbacks(std::vector callbacks) { for (base::OnceClosure& callback : callbacks) { std::move(callback).Run(); } } ",0 " void set_install_result_target( std::unique_ptr* install_result_target) { install_result_target_ = install_result_target; } ",0 "static struct sock *unix_next_socket(struct seq_file *seq, struct sock *sk, loff_t *pos) { unsigned long bucket; while (sk > (struct sock *)SEQ_START_TOKEN) { sk = sk_next(sk); if (!sk) goto next_bucket; if (sock_net(sk) == seq_file_net(seq)) return sk; } do { sk = unix_from_bucket(seq, pos); if (sk) return sk; next_bucket: bucket = get_bucket(*pos) + 1; *pos = set_bucket_offset(bucket, 1); } while (bucket < ARRAY_SIZE(unix_socket_table)); return NULL; } ",0 "static unsigned long capacity_of(int cpu) { return cpu_rq(cpu)->cpu_capacity; } ",0 "void linuxMemoryWarnings(void) { if (linuxOvercommitMemoryValue() == 0) { serverLog(LL_WARNING,""WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.""); } if (THPIsEnabled()) { serverLog(LL_WARNING,""WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.""); } } ",0 "void BrowserRenderProcessHost::CreateMessageFilters() { scoped_refptr render_message_filter( new RenderMessageFilter( id(), PluginService::GetInstance(), profile(), profile()->GetRequestContextForRenderProcess(id()), widget_helper_)); channel_->AddFilter(render_message_filter); ResourceMessageFilter* resource_message_filter = new ResourceMessageFilter( id(), ChildProcessInfo::RENDER_PROCESS, &profile()->GetResourceContext(), new RendererURLRequestContextSelector(profile(), id()), content::GetContentClient()->browser()->GetResourceDispatcherHost()); channel_->AddFilter(resource_message_filter); channel_->AddFilter(new AudioInputRendererHost()); channel_->AddFilter(new AudioRendererHost(&profile()->GetResourceContext())); channel_->AddFilter(new VideoCaptureHost()); channel_->AddFilter( new AppCacheDispatcherHost(&profile()->GetResourceContext(), id())); channel_->AddFilter(new ClipboardMessageFilter()); channel_->AddFilter( new DOMStorageMessageFilter(id(), profile()->GetWebKitContext())); channel_->AddFilter( new IndexedDBDispatcherHost(id(), profile()->GetWebKitContext())); channel_->AddFilter( GeolocationDispatcherHost::New( id(), profile()->GetGeolocationPermissionContext())); channel_->AddFilter(new GpuMessageFilter(id(), widget_helper_.get())); channel_->AddFilter(new media_stream::MediaStreamDispatcherHost(id())); channel_->AddFilter(new PepperFileMessageFilter(id(), profile())); channel_->AddFilter( new PepperMessageFilter(&profile()->GetResourceContext())); channel_->AddFilter(new speech_input::SpeechInputDispatcherHost(id())); channel_->AddFilter( new FileSystemDispatcherHost(&profile()->GetResourceContext())); channel_->AddFilter(new device_orientation::MessageFilter()); channel_->AddFilter( new BlobMessageFilter(id(), profile()->GetBlobStorageContext())); channel_->AddFilter(new FileUtilitiesMessageFilter(id())); channel_->AddFilter(new MimeRegistryMessageFilter()); channel_->AddFilter(new DatabaseMessageFilter( profile()->GetDatabaseTracker())); SocketStreamDispatcherHost* socket_stream_dispatcher_host = new SocketStreamDispatcherHost( new RendererURLRequestContextSelector(profile(), id()), &profile()->GetResourceContext()); channel_->AddFilter(socket_stream_dispatcher_host); channel_->AddFilter( new WorkerMessageFilter( id(), &profile()->GetResourceContext(), content::GetContentClient()->browser()->GetResourceDispatcherHost(), NewCallbackWithReturnValue( widget_helper_.get(), &RenderWidgetHelper::GetNextRoutingID))); #if defined(ENABLE_P2P_APIS) channel_->AddFilter(new P2PSocketDispatcherHost()); #endif channel_->AddFilter(new TraceMessageFilter()); channel_->AddFilter(new ResolveProxyMsgHelper(NULL)); channel_->AddFilter(new QuotaDispatcherHost( id(), profile()->GetQuotaManager(), content::GetContentClient()->browser()->CreateQuotaPermissionContext())); } ",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; } ",0 "void OfflinePageModelImpl::GetPagesByRequestOrigin( const std::string& request_origin, const MultipleOfflinePageItemCallback& callback) { OfflinePageModelQueryBuilder builder; builder.SetRequestOrigin(OfflinePageModelQuery::Requirement::INCLUDE_MATCHING, request_origin); RunWhenLoaded( base::Bind(&OfflinePageModelImpl::GetPagesMatchingQueryWhenLoadDone, weak_ptr_factory_.GetWeakPtr(), base::Passed(builder.Build(GetPolicyController())), callback)); } ",0 "static void StreamTcp3whsSynAckUpdate(TcpSession *ssn, Packet *p, TcpStateQueue *q) { TcpStateQueue update; if (likely(q == NULL)) { StreamTcp3whsSynAckToStateQueue(p, &update); q = &update; } if (ssn->state != TCP_SYN_RECV) { /* update state */ StreamTcpPacketSetState(p, ssn, TCP_SYN_RECV); SCLogDebug(""ssn %p: =~ ssn state is now TCP_SYN_RECV"", ssn); } /* sequence number & window */ ssn->server.isn = q->seq; STREAMTCP_SET_RA_BASE_SEQ(&ssn->server, ssn->server.isn); ssn->server.next_seq = ssn->server.isn + 1; ssn->client.window = q->win; SCLogDebug(""ssn %p: window %"" PRIu32 """", ssn, ssn->server.window); /* Set the timestamp values used to validate the timestamp of * received packets.*/ if ((q->flags & STREAMTCP_QUEUE_FLAG_TS) && (ssn->client.flags & STREAMTCP_STREAM_FLAG_TIMESTAMP)) { ssn->server.last_ts = q->ts; SCLogDebug(""ssn %p: ssn->server.last_ts %"" PRIu32"" "" ""ssn->client.last_ts %"" PRIu32"""", ssn, ssn->server.last_ts, ssn->client.last_ts); ssn->flags |= STREAMTCP_FLAG_TIMESTAMP; ssn->server.last_pkt_ts = q->pkt_ts; if (ssn->server.last_ts == 0) ssn->server.flags |= STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP; } else { ssn->client.last_ts = 0; ssn->server.last_ts = 0; ssn->client.flags &= ~STREAMTCP_STREAM_FLAG_ZERO_TIMESTAMP; } ssn->client.last_ack = q->ack; ssn->server.last_ack = ssn->server.isn + 1; /** check for the presense of the ws ptr to determine if we * support wscale at all */ if ((ssn->flags & STREAMTCP_FLAG_SERVER_WSCALE) && (q->flags & STREAMTCP_QUEUE_FLAG_WS)) { ssn->client.wscale = q->wscale; } else { ssn->client.wscale = 0; } if ((ssn->flags & STREAMTCP_FLAG_CLIENT_SACKOK) && (q->flags & STREAMTCP_QUEUE_FLAG_SACK)) { ssn->flags |= STREAMTCP_FLAG_SACKOK; SCLogDebug(""ssn %p: SACK permitted for session"", ssn); } else { ssn->flags &= ~STREAMTCP_FLAG_SACKOK; } ssn->server.next_win = ssn->server.last_ack + ssn->server.window; ssn->client.next_win = ssn->client.last_ack + ssn->client.window; SCLogDebug(""ssn %p: ssn->server.next_win %"" PRIu32 """", ssn, ssn->server.next_win); SCLogDebug(""ssn %p: ssn->client.next_win %"" PRIu32 """", ssn, ssn->client.next_win); SCLogDebug(""ssn %p: ssn->server.isn %"" PRIu32 "", "" ""ssn->server.next_seq %"" PRIu32 "", "" ""ssn->server.last_ack %"" PRIu32 "" "" ""(ssn->client.last_ack %"" PRIu32 "")"", ssn, ssn->server.isn, ssn->server.next_seq, ssn->server.last_ack, ssn->client.last_ack); /* unset the 4WHS flag as we received this SYN/ACK as part of a * (so far) valid 3WHS */ if (ssn->flags & STREAMTCP_FLAG_4WHS) SCLogDebug(""ssn %p: STREAMTCP_FLAG_4WHS unset, normal SYN/ACK"" "" so considering 3WHS"", ssn); ssn->flags &=~ STREAMTCP_FLAG_4WHS; } ",0 "void WebMediaPlayerMS::SetGpuMemoryBufferVideoForTesting( media::GpuMemoryBufferVideoFramePool* gpu_memory_buffer_pool) { CHECK(frame_deliverer_); frame_deliverer_->gpu_memory_buffer_pool_.reset(gpu_memory_buffer_pool); } ",0 "decode_rd_as (u_char *pnt, struct rd_as *rd_as) { rd_as->as = (u_int16_t) *pnt++ << 8; rd_as->as |= (u_int16_t) *pnt++; rd_as->val = ((u_int32_t) *pnt++ << 24); rd_as->val |= ((u_int32_t) *pnt++ << 16); rd_as->val |= ((u_int32_t) *pnt++ << 8); rd_as->val |= (u_int32_t) *pnt; } ",0 "void disable_write_zeroes(struct mapped_device *md) { struct queue_limits *limits = dm_get_queue_limits(md); /* device doesn't really support WRITE ZEROES, disable it */ limits->max_write_zeroes_sectors = 0; } ",0 "zend_object_iterator *spl_heap_get_iterator(zend_class_entry *ce, zval *object, int by_ref TSRMLS_DC) /* {{{ */ { spl_heap_it *iterator; spl_heap_object *heap_object = (spl_heap_object*)zend_object_store_get_object(object TSRMLS_CC); if (by_ref) { zend_throw_exception(spl_ce_RuntimeException, ""An iterator cannot be used with foreach by reference"", 0 TSRMLS_CC); return NULL; } Z_ADDREF_P(object); iterator = emalloc(sizeof(spl_heap_it)); iterator->intern.it.data = (void*)object; iterator->intern.it.funcs = &spl_heap_it_funcs; iterator->intern.ce = ce; iterator->intern.value = NULL; iterator->flags = heap_object->flags; iterator->object = heap_object; return (zend_object_iterator*)iterator; } /* }}} */ ",0 "static HistoryCommitType LoadTypeToCommitType(FrameLoadType type) { switch (type) { case kFrameLoadTypeStandard: return kStandardCommit; case kFrameLoadTypeInitialInChildFrame: case kFrameLoadTypeInitialHistoryLoad: return kInitialCommitInChildFrame; case kFrameLoadTypeBackForward: return kBackForwardCommit; default: break; } return kHistoryInertCommit; } ",0 "static int lua_ap_regex(lua_State *L) { request_rec *r; int i, rv, flags; const char *pattern, *source; char *err; ap_regex_t regex; ap_regmatch_t matches[MODLUA_MAX_REG_MATCH+1]; luaL_checktype(L, 1, LUA_TUSERDATA); luaL_checktype(L, 2, LUA_TSTRING); luaL_checktype(L, 3, LUA_TSTRING); r = ap_lua_check_request_rec(L, 1); source = lua_tostring(L, 2); pattern = lua_tostring(L, 3); flags = luaL_optinteger(L, 4, 0); rv = ap_regcomp(®ex, pattern, flags); if (rv) { lua_pushboolean(L, 0); err = apr_palloc(r->pool, 256); ap_regerror(rv, ®ex, err, 256); lua_pushstring(L, err); return 2; } if (regex.re_nsub > MODLUA_MAX_REG_MATCH) { lua_pushboolean(L, 0); err = apr_palloc(r->pool, 64); apr_snprintf(err, 64, ""regcomp found %d matches; only %d allowed."", regex.re_nsub, MODLUA_MAX_REG_MATCH); lua_pushstring(L, err); return 2; } rv = ap_regexec(®ex, source, MODLUA_MAX_REG_MATCH, matches, 0); if (rv == AP_REG_NOMATCH) { lua_pushboolean(L, 0); return 1; } lua_newtable(L); for (i = 0; i <= regex.re_nsub; i++) { lua_pushinteger(L, i); if (matches[i].rm_so >= 0 && matches[i].rm_eo >= 0) lua_pushstring(L, apr_pstrndup(r->pool, source + matches[i].rm_so, matches[i].rm_eo - matches[i].rm_so)); else lua_pushnil(L); lua_settable(L, -3); } return 1; } ",0 "xmlBufResetInput(xmlBufPtr buf, xmlParserInputPtr input) { if ((input == NULL) || (buf == NULL) || (buf->error)) return(-1); CHECK_COMPAT(buf) input->base = input->cur = buf->content; input->end = &buf->content[buf->use]; return(0); } ",0 "static int sctp_getsockopt_context(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_assoc_value params; struct sctp_sock *sp; struct sctp_association *asoc; if (len != sizeof(struct sctp_assoc_value)) return -EINVAL; if (copy_from_user(¶ms, optval, len)) return -EFAULT; sp = sctp_sk(sk); if (params.assoc_id != 0) { asoc = sctp_id2assoc(sk, params.assoc_id); if (!asoc) return -EINVAL; params.assoc_value = asoc->default_rcv_context; } else { params.assoc_value = sp->default_rcv_context; } if (put_user(len, optlen)) return -EFAULT; if (copy_to_user(optval, ¶ms, len)) return -EFAULT; return 0; } ",0 "static int shutdown_interception(struct vcpu_svm *svm) { struct kvm_run *kvm_run = svm->vcpu.run; /* * VMCB is undefined after a SHUTDOWN intercept * so reinitialize it. */ clear_page(svm->vmcb); init_vmcb(svm); kvm_run->exit_reason = KVM_EXIT_SHUTDOWN; return 0; } ",0 "int dm_lock_for_deletion(struct mapped_device *md, bool mark_deferred, bool only_deferred) { int r = 0; spin_lock(&_minor_lock); if (dm_open_count(md)) { r = -EBUSY; if (mark_deferred) set_bit(DMF_DEFERRED_REMOVE, &md->flags); } else if (only_deferred && !test_bit(DMF_DEFERRED_REMOVE, &md->flags)) r = -EEXIST; else set_bit(DMF_DELETING, &md->flags); spin_unlock(&_minor_lock); return r; } ",0 "int RenderProcessHostImpl::GetID() const { return id_; } ",0 "gfx::Size ImageView::GetPreferredSize() { gfx::Insets insets = GetInsets(); if (image_size_set_) { gfx::Size image_size; GetImageSize(&image_size); image_size.Enlarge(insets.width(), insets.height()); return image_size; } return gfx::Size(image_.width() + insets.width(), image_.height() + insets.height()); } ",0 "void AutofillDialogViews::SetValidityForInput( T* input, const base::string16& message) { bool invalid = !message.empty(); input->SetInvalid(invalid); if (invalid) { validity_map_[input] = message; } else { validity_map_.erase(input); if (error_bubble_ && error_bubble_->anchor()->GetAncestorWithClassName( input->GetClassName()) == input) { validity_map_.erase(input); HideErrorBubble(); } } } ",0 "bool HFSBTreeIterator::Init(ReadStream* stream) { DCHECK(!stream_); stream_ = stream; if (stream_->Seek(0, SEEK_SET) != 0) { DLOG(ERROR) << ""Failed to seek to header node""; return false; } BTNodeDescriptor node; if (!stream_->ReadType(&node)) { DLOG(ERROR) << ""Failed to read BTNodeDescriptor""; return false; } ConvertBigEndian(&node); if (node.kind != kBTHeaderNode) { DLOG(ERROR) << ""Initial node is not a header node""; return false; } if (!stream_->ReadType(&header_)) { DLOG(ERROR) << ""Failed to read BTHeaderRec""; return false; } ConvertBigEndian(&header_); current_leaf_number_ = header_.firstLeafNode; leaf_data_.resize(header_.nodeSize); return true; } ",0 "nfsd4_encode_secinfo_no_name(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_secinfo_no_name *secinfo) { struct xdr_stream *xdr = &resp->xdr; return nfsd4_do_encode_secinfo(xdr, nfserr, secinfo->sin_exp); } ",0 "void MediaRecorder::resume(ExceptionState& exception_state) { if (state_ == State::kInactive) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, ""The MediaRecorder's state is '"" + StateToString(state_) + ""'.""); return; } if (state_ == State::kRecording) return; state_ = State::kRecording; recorder_handler_->Resume(); ScheduleDispatchEvent(Event::Create(event_type_names::kResume)); } ",0 "static inline bool isValidRegionStyleProperty(CSSPropertyID id) { switch (id) { case CSSPropertyBackgroundColor: case CSSPropertyColor: return true; default: break; } return false; } ",0 "cmsBool _cmsRegisterMultiProcessElementPlugin(cmsContext id, cmsPluginBase* Data) { return RegisterTypesPlugin(id, Data,MPEPlugin); } ",0 "static int sctp_sf_send_restart_abort(struct net *net, union sctp_addr *ssa, struct sctp_chunk *init, sctp_cmd_seq_t *commands) { int len; struct sctp_packet *pkt; union sctp_addr_param *addrparm; struct sctp_errhdr *errhdr; struct sctp_endpoint *ep; char buffer[sizeof(struct sctp_errhdr)+sizeof(union sctp_addr_param)]; struct sctp_af *af = sctp_get_af_specific(ssa->v4.sin_family); /* Build the error on the stack. We are way to malloc crazy * throughout the code today. */ errhdr = (struct sctp_errhdr *)buffer; addrparm = (union sctp_addr_param *)errhdr->variable; /* Copy into a parm format. */ len = af->to_addr_param(ssa, addrparm); len += sizeof(sctp_errhdr_t); errhdr->cause = SCTP_ERROR_RESTART; errhdr->length = htons(len); /* Assign to the control socket. */ ep = sctp_sk(net->sctp.ctl_sock)->ep; /* Association is NULL since this may be a restart attack and we * want to send back the attacker's vtag. */ pkt = sctp_abort_pkt_new(net, ep, NULL, init, errhdr, len); if (!pkt) goto out; sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, SCTP_PACKET(pkt)); SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS); /* Discard the rest of the inbound packet. */ sctp_add_cmd_sf(commands, SCTP_CMD_DISCARD_PACKET, SCTP_NULL()); out: /* Even if there is no memory, treat as a failure so * the packet will get dropped. */ return 0; } ",0 "static int zlib_compress_setup(struct crypto_pcomp *tfm, void *params, unsigned int len) { struct zlib_ctx *ctx = crypto_tfm_ctx(crypto_pcomp_tfm(tfm)); struct z_stream_s *stream = &ctx->comp_stream; struct nlattr *tb[ZLIB_COMP_MAX + 1]; int window_bits, mem_level; size_t workspacesize; int ret; ret = nla_parse(tb, ZLIB_COMP_MAX, params, len, NULL); if (ret) return ret; zlib_comp_exit(ctx); window_bits = tb[ZLIB_COMP_WINDOWBITS] ? nla_get_u32(tb[ZLIB_COMP_WINDOWBITS]) : MAX_WBITS; mem_level = tb[ZLIB_COMP_MEMLEVEL] ? nla_get_u32(tb[ZLIB_COMP_MEMLEVEL]) : DEF_MEM_LEVEL; workspacesize = zlib_deflate_workspacesize(window_bits, mem_level); stream->workspace = vzalloc(workspacesize); if (!stream->workspace) return -ENOMEM; ret = zlib_deflateInit2(stream, tb[ZLIB_COMP_LEVEL] ? nla_get_u32(tb[ZLIB_COMP_LEVEL]) : Z_DEFAULT_COMPRESSION, tb[ZLIB_COMP_METHOD] ? nla_get_u32(tb[ZLIB_COMP_METHOD]) : Z_DEFLATED, window_bits, mem_level, tb[ZLIB_COMP_STRATEGY] ? nla_get_u32(tb[ZLIB_COMP_STRATEGY]) : Z_DEFAULT_STRATEGY); if (ret != Z_OK) { vfree(stream->workspace); stream->workspace = NULL; return -EINVAL; } return 0; } ",0 " DownloadSBClient( const content::DownloadItem& item, const DownloadProtectionService::CheckDownloadCallback& callback, const scoped_refptr& ui_manager, SBStatsType total_type, SBStatsType dangerous_type) : sha256_hash_(item.GetHash()), url_chain_(item.GetUrlChain()), referrer_url_(item.GetReferrerUrl()), callback_(callback), ui_manager_(ui_manager), start_time_(base::TimeTicks::Now()), total_type_(total_type), dangerous_type_(dangerous_type) { Profile* profile = Profile::FromBrowserContext(item.GetBrowserContext()); is_extended_reporting_ = profile && profile->GetPrefs()->GetBoolean( prefs::kSafeBrowsingExtendedReportingEnabled); } ",0 "SYSCALL_DEFINE2(listen, int, fd, int, backlog) { struct socket *sock; int err, fput_needed; int somaxconn; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (sock) { somaxconn = sock_net(sock->sk)->core.sysctl_somaxconn; if ((unsigned)backlog > somaxconn) backlog = somaxconn; err = security_socket_listen(sock, backlog); if (!err) err = sock->ops->listen(sock, backlog); fput_light(sock->file, fput_needed); } return err; } ",0 "COMPS_COPY_u(objrtree, COMPS_ObjRTree) /*comps_utils.h macro*/ void comps_objrtree_copy_shallow(COMPS_ObjRTree *rt1, COMPS_ObjRTree *rt2){ COMPS_HSList *to_clone, *tmplist, *new_subnodes; COMPS_HSListItem *it, *it2; COMPS_ObjRTreeData *rtdata; COMPS_Object *new_data; rt1->subnodes = comps_hslist_create(); comps_hslist_init(rt1->subnodes, NULL, NULL, &comps_objrtree_data_destroy_v); if (rt1->subnodes == NULL) { COMPS_OBJECT_DESTROY(rt1); return; } rt1->len = 0; to_clone = comps_hslist_create(); comps_hslist_init(to_clone, NULL, NULL, NULL); for (it = rt2->subnodes->first; it != NULL; it = it->next) { rtdata = comps_objrtree_data_create( ((COMPS_ObjRTreeData*)it->data)->key, NULL); if (((COMPS_ObjRTreeData*)it->data)->data != NULL) new_data = COMPS_OBJECT_INCREF(((COMPS_ObjRTreeData*)it->data)->data); else new_data = NULL; comps_hslist_destroy(&rtdata->subnodes); rtdata->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes; rtdata->data = new_data; comps_hslist_append(rt1->subnodes, rtdata, 0); comps_hslist_append(to_clone, rtdata, 0); } while (to_clone->first) { it2 = to_clone->first; tmplist = ((COMPS_ObjRTreeData*)it2->data)->subnodes; comps_hslist_remove(to_clone, to_clone->first); new_subnodes = comps_hslist_create(); comps_hslist_init(new_subnodes, NULL, NULL, &comps_objrtree_data_destroy_v); for (it = tmplist->first; it != NULL; it = it->next) { rtdata = comps_objrtree_data_create( ((COMPS_ObjRTreeData*)it->data)->key, NULL); if (((COMPS_ObjRTreeData*)it->data)->data != NULL) new_data = comps_object_incref(((COMPS_ObjRTreeData*)it->data)->data); else new_data = NULL; comps_hslist_destroy(&rtdata->subnodes); rtdata->subnodes = ((COMPS_ObjRTreeData*)it->data)->subnodes; rtdata->data = new_data; comps_hslist_append(new_subnodes, rtdata, 0); comps_hslist_append(to_clone, rtdata, 0); } ((COMPS_ObjRTreeData*)it2->data)->subnodes = new_subnodes; free(it2); } comps_hslist_destroy(&to_clone); } ",0 "static int unmap_ref_private(struct mm_struct *mm, struct vm_area_struct *vma, struct page *page, unsigned long address) { struct hstate *h = hstate_vma(vma); struct vm_area_struct *iter_vma; struct address_space *mapping; struct prio_tree_iter iter; pgoff_t pgoff; /* * vm_pgoff is in PAGE_SIZE units, hence the different calculation * from page cache lookup which is in HPAGE_SIZE units. */ address = address & huge_page_mask(h); pgoff = vma_hugecache_offset(h, vma, address); mapping = (struct address_space *)page_private(page); /* * Take the mapping lock for the duration of the table walk. As * this mapping should be shared between all the VMAs, * __unmap_hugepage_range() is called as the lock is already held */ mutex_lock(&mapping->i_mmap_mutex); vma_prio_tree_foreach(iter_vma, &iter, &mapping->i_mmap, pgoff, pgoff) { /* Do not unmap the current VMA */ if (iter_vma == vma) continue; /* * Unmap the page from other VMAs without their own reserves. * They get marked to be SIGKILLed if they fault in these * areas. This is because a future no-page fault on this VMA * could insert a zeroed page instead of the data existing * from the time of fork. This would look like data corruption */ if (!is_vma_resv_set(iter_vma, HPAGE_RESV_OWNER)) __unmap_hugepage_range(iter_vma, address, address + huge_page_size(h), page); } mutex_unlock(&mapping->i_mmap_mutex); return 1; } ",1 "status_t ProCamera2Client::getCameraInfo(int cameraId, /*out*/ camera_metadata** info) { if (cameraId != mCameraId) { return INVALID_OPERATION; } Mutex::Autolock icl(mBinderSerializationLock); if (!mDevice.get()) return DEAD_OBJECT; CameraMetadata deviceInfo = mDevice->info(); *info = deviceInfo.release(); return OK; } ",0 "void big_key_free_preparse(struct key_preparsed_payload *prep) { if (prep->datalen > BIG_KEY_FILE_THRESHOLD) { struct path *path = (struct path *)&prep->payload.data[big_key_path]; path_put(path); } kzfree(prep->payload.data[big_key_data]); } ",0 "bool SimplifiedBackwardsTextIterator::handleReplacedElement() { unsigned index = m_node->nodeIndex(); emitCharacter(',', m_node->parentNode(), index, index + 1); return true; } ",0 "static void voidMethodSequenceStringArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodSequenceStringArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "status_t SoftMPEG2::setFlushMode() { IV_API_CALL_STATUS_T status; ivd_ctl_flush_ip_t s_video_flush_ip; ivd_ctl_flush_op_t s_video_flush_op; s_video_flush_ip.e_cmd = IVD_CMD_VIDEO_CTL; s_video_flush_ip.e_sub_cmd = IVD_CMD_CTL_FLUSH; s_video_flush_ip.u4_size = sizeof(ivd_ctl_flush_ip_t); s_video_flush_op.u4_size = sizeof(ivd_ctl_flush_op_t); /* Set the decoder in Flush mode, subsequent decode() calls will flush */ status = ivdec_api_function( mCodecCtx, (void *)&s_video_flush_ip, (void *)&s_video_flush_op); if (status != IV_SUCCESS) { ALOGE(""Error in setting the decoder in flush mode: (%d) 0x%x"", status, s_video_flush_op.u4_error_code); return UNKNOWN_ERROR; } mWaitForI = true; mIsInFlush = true; return OK; } ",0 "const Chapters::Edition* Chapters::GetEdition(int idx) const { if (idx < 0) return NULL; if (idx >= m_editions_count) return NULL; return m_editions + idx; } ",0 "static inline int attributes_need_mount(u32 *bmval) { if (bmval[0] & ~(FATTR4_WORD0_RDATTR_ERROR | FATTR4_WORD0_LEASE_TIME)) return 1; if (bmval[1] & ~FATTR4_WORD1_MOUNTED_ON_FILEID) return 1; return 0; } ",0 "void PDFiumEngine::PaintPageShadow(int progressive_index, pp::ImageData* image_data) { DCHECK_GE(progressive_index, 0); DCHECK_LT(static_cast(progressive_index), progressive_paints_.size()); DCHECK(image_data); int page_index = progressive_paints_[progressive_index].page_index; pp::Rect dirty_in_screen = progressive_paints_[progressive_index].rect; pp::Rect page_rect = pages_[page_index]->rect(); pp::Rect shadow_rect(page_rect); shadow_rect.Inset(-kPageShadowLeft, -kPageShadowTop, -kPageShadowRight, -kPageShadowBottom); shadow_rect = GetScreenRect(shadow_rect); page_rect = shadow_rect; page_rect.Inset(static_cast(ceil(kPageShadowLeft * current_zoom_)), static_cast(ceil(kPageShadowTop * current_zoom_)), static_cast(ceil(kPageShadowRight * current_zoom_)), static_cast(ceil(kPageShadowBottom * current_zoom_))); DrawPageShadow(page_rect, shadow_rect, dirty_in_screen, image_data); } ",0 "bool InspectorPageAgent::CachedResourceContent(Resource* cached_resource, String* result, bool* base64_encoded) { bool has_zero_size; if (!PrepareResourceBuffer(cached_resource, &has_zero_size)) return false; if (!HasTextContent(cached_resource)) { RefPtr buffer = has_zero_size ? SharedBuffer::Create() : cached_resource->ResourceBuffer(); if (!buffer) return false; const SharedBuffer::DeprecatedFlatData flat_buffer(std::move(buffer)); *result = Base64Encode(flat_buffer.Data(), flat_buffer.size()); *base64_encoded = true; return true; } if (has_zero_size) { *result = """"; *base64_encoded = false; return true; } DCHECK(cached_resource); switch (cached_resource->GetType()) { case Resource::kCSSStyleSheet: MaybeEncodeTextContent( ToCSSStyleSheetResource(cached_resource) ->SheetText(CSSStyleSheetResource::MIMETypeCheck::kLax), cached_resource->ResourceBuffer(), result, base64_encoded); return true; case Resource::kScript: MaybeEncodeTextContent( cached_resource->ResourceBuffer() ? ToScriptResource(cached_resource)->DecodedText() : ToScriptResource(cached_resource)->SourceText(), cached_resource->ResourceBuffer(), result, base64_encoded); return true; default: String text_encoding_name = cached_resource->GetResponse().TextEncodingName(); if (text_encoding_name.IsEmpty() && cached_resource->GetType() != Resource::kRaw) text_encoding_name = ""WinLatin1""; return InspectorPageAgent::SharedBufferContent( cached_resource->ResourceBuffer(), cached_resource->GetResponse().MimeType(), text_encoding_name, result, base64_encoded); } } ",0 "static uint32_t ne2000_reset_ioport_read(void *opaque, uint32_t addr) { NE2000State *s = opaque; ne2000_reset(s); return 0; } ",0 "message_send_chat_otr(const char *const barejid, const char *const msg, gboolean request_receipt) { xmpp_ctx_t * const ctx = connection_get_ctx(); char *state = chat_session_get_state(barejid); char *jid = chat_session_get_jid(barejid); char *id = create_unique_id(""msg""); xmpp_stanza_t *message = xmpp_message_new(ctx, STANZA_TYPE_CHAT, barejid, id); xmpp_message_set_body(message, msg); free(jid); if (state) { stanza_attach_state(ctx, message, state); } stanza_attach_carbons_private(ctx, message); stanza_attach_hints_no_copy(ctx, message); stanza_attach_hints_no_store(ctx, message); if (request_receipt) { stanza_attach_receipt_request(ctx, message); } _send_message_stanza(message); xmpp_stanza_release(message); return id; } ",0 "void UiSceneCreator::CreateScene() { Create2dBrowsingSubtreeRoots(); CreateWebVrRoot(); CreateBackground(); CreateViewportAwareRoot(); CreateContentQuad(); CreateExitPrompt(); CreateAudioPermissionPrompt(); CreateWebVRExitWarning(); CreateSystemIndicators(); CreateUrlBar(); CreateOmnibox(); CreateWebVrUrlToast(); CreateCloseButton(); CreateToasts(); CreateSplashScreenForDirectWebVrLaunch(); CreateWebVrTimeoutScreen(); CreateUnderDevelopmentNotice(); CreateVoiceSearchUiGroup(); CreateController(); CreateKeyboard(); } ",0 "static inline bool nested_vmx_allowed(struct kvm_vcpu *vcpu) { return nested && guest_cpuid_has_vmx(vcpu); } ",0 "WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, const WebPluginParams& params) { WebPluginInfo info; bool found; std::string mime_type; Send(new ViewHostMsg_GetPluginInfo( params.url, frame->top()->url(), params.mimeType.utf8(), &found, &info, &mime_type)); if (!found || !info.enabled) return NULL; scoped_refptr pepper_module = PepperPluginRegistry::GetInstance()->GetModule(info.path); if (pepper_module) return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); else return CreateNPAPIPlugin(frame, params, info.path, mime_type); } ",0 "void SyncTest::DisableNetwork(Profile* profile) { DisableNotificationsImpl(); net::ProxyConfig config; config.proxy_rules().ParseFromString(""http=127.0.0.1:0""); SetProxyConfig(profile->GetRequestContext(), config); net::NetworkChangeNotifier::NotifyObserversOfIPAddressChangeForTests(); } ",0 "void PlatformSensorProviderLinux::SetFileTaskRunner( scoped_refptr file_task_runner) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (!file_task_runner_) file_task_runner_ = file_task_runner; } ",0 "ProcessingInstruction* Document::createProcessingInstruction(const String& target, const String& data, ExceptionState& exceptionState) { if (!isValidName(target)) { exceptionState.throwDOMException(InvalidCharacterError, ""The target provided ('"" + target + ""') is not a valid name.""); return nullptr; } if (data.contains(""?>"")) { exceptionState.throwDOMException(InvalidCharacterError, ""The data provided ('"" + data + ""') contains '?>'.""); return nullptr; } return ProcessingInstruction::create(*this, target, data); } ",0 "void InfoBarContainer::InfoBarAnimated(bool completed) { if (delegate_) delegate_->InfoBarContainerSizeChanged(!completed); } ",0 "static void __exit snd_msnd_exit(void) { #ifdef CONFIG_PNP if (pnp_registered) pnp_unregister_card_driver(&msnd_pnpc_driver); if (isa_registered) #endif isa_unregister_driver(&snd_msnd_driver); } ",0 "file_regcomp(file_regex_t *rx, const char *pat, int flags) { #ifdef USE_C_LOCALE rx->c_lc_ctype = newlocale(LC_CTYPE_MASK, ""C"", 0); assert(rx->c_lc_ctype != NULL); rx->old_lc_ctype = uselocale(rx->c_lc_ctype); assert(rx->old_lc_ctype != NULL); #endif rx->pat = pat; return rx->rc = regcomp(&rx->rx, pat, flags); } ",0 "void RenderViewImpl::didFailLoad(WebFrame* frame, const WebURLError& error) { WebDataSource* ds = frame->dataSource(); DCHECK(ds); FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidFailLoad(frame, error)); const WebURLRequest& failed_request = ds->request(); string16 error_description; GetContentClient()->renderer()->GetNavigationErrorStrings( failed_request, error, NULL, &error_description); Send(new ViewHostMsg_DidFailLoadWithError(routing_id_, frame->identifier(), failed_request.url(), !frame->parent(), error.reason, error_description)); } ",0 "ossl_cipher_initialize(VALUE self, VALUE str) { EVP_CIPHER_CTX *ctx; const EVP_CIPHER *cipher; char *name; unsigned char dummy_key[EVP_MAX_KEY_LENGTH] = { 0 }; name = StringValueCStr(str); GetCipherInit(self, ctx); if (ctx) { ossl_raise(rb_eRuntimeError, ""Cipher already inititalized!""); } AllocCipher(self, ctx); if (!(cipher = EVP_get_cipherbyname(name))) { ossl_raise(rb_eRuntimeError, ""unsupported cipher algorithm (%""PRIsVALUE"")"", str); } /* * EVP_CipherInit_ex() allows to specify NULL to key and IV, however some * ciphers don't handle well (OpenSSL's bug). [Bug #2768] * * The EVP which has EVP_CIPH_RAND_KEY flag (such as DES3) allows * uninitialized key, but other EVPs (such as AES) does not allow it. * Calling EVP_CipherUpdate() without initializing key causes SEGV so we * set the data filled with ""\0"" as the key by default. */ if (EVP_CipherInit_ex(ctx, cipher, NULL, dummy_key, NULL, -1) != 1) ossl_raise(eCipherError, NULL); return self; } ",1 "sysapi_translate_opsys( const char *sysname, const char *release, const char *version, int append_version) { char tmp[64]; char ver[24]; const char * pver=""""; char *tmpopsys; if( !strcmp(sysname, ""Linux"") ) { sprintf( tmp, ""LINUX"" ); } else if( !strcmp(sysname, ""linux"") ) { //LDAP entry sprintf( tmp, ""LINUX"" ); } else if( !strcmp(sysname, ""SunOS"") || !strcmp(sysname, ""solaris"" ) ) //LDAP entry { sprintf( tmp, ""SOLARIS"" ); if ( !strcmp(release, ""2.10"") //LDAP entry || !strcmp(release, ""5.10"") ) { pver = ""210""; } else if ( !strcmp(release, ""2.9"") //LDAP entry || !strcmp(release, ""5.9"") ) { pver = ""29""; } else if ( !strcmp(release, ""2.8"") //LDAP entry || !strcmp(release, ""5.8"") ) { pver = ""28""; } else if ( !strcmp(release, ""2.7"") //LDAP entry || !strcmp(release, ""5.7"") ) { pver = ""27""; } else if( !strcmp(release, ""5.6"") || !strcmp(release, ""2.6"") ) //LDAP entry { pver = ""26""; } else if ( !strcmp(release, ""5.5.1"") || !strcmp(release, ""2.5.1"") ) //LDAP entry { pver = ""251""; } else if ( !strcmp(release, ""5.5"") || !strcmp(release, ""2.5"") ) //LDAP entry { pver = ""25""; } else { pver = release; } } else if( !strcmp(sysname, ""HP-UX"") ) { sprintf( tmp, ""HPUX"" ); if( !strcmp(release, ""B.10.20"") ) { pver = ""10""; } else if( !strcmp(release, ""B.11.00"") ) { pver = ""11""; } else if( !strcmp(release, ""B.11.11"") ) { pver = ""11""; } else { pver = release; } } else if ( !strncmp(sysname, ""Darwin"", 6) ) { sprintf( tmp, ""OSX""); } else if ( !strncmp(sysname, ""AIX"", 3) ) { sprintf(tmp, ""%s"", sysname); if ( !strcmp(version, ""5"") ) { sprintf(ver, ""%s%s"", version, release); pver = ver; } } else if ( !strncmp(sysname, ""FreeBSD"", 7) ) { sprintf( tmp, ""FREEBSD"" ); sprintf( ver, ""%c"", release[0]); pver = ver; } else { sprintf( tmp, ""%s"", sysname); pver = release; } if (append_version && pver) { strcat( tmp, pver ); } tmpopsys = strdup( tmp ); if( !tmpopsys ) { EXCEPT( ""Out of memory!"" ); } return( tmpopsys ); } ",0 "newSWFInput_input(SWFInput in, unsigned int length) { SWFInput input; struct SWFInputPtr *data; if (in == NULL) return NULL; input = (SWFInput)malloc(sizeof(struct SWFInput_s)); /* If malloc failed, return NULL to signify this */ if (NULL == input) return NULL; input->getChar = SWFInput_input_getChar; input->destroy = SWFInput_input_dtor; input->eof = SWFInput_input_eof; input->read = SWFInput_input_read; input->seek = SWFInput_input_seek; data = (struct SWFInputPtr *)malloc(sizeof(struct SWFInputPtr)); /* If malloc failed, free memory allocated for input and return NULL to signify the failure */ if (NULL == data) { free(input); return NULL; } data->offset = SWFInput_tell(in); data->input = in; input->offset = 0; input->length = length; input->data = (void *)data; input->buffer = 0; input->bufbits = 0; #if TRACK_ALLOCS input->gcnode = ming_gc_add_node(input, (dtorfunctype) destroySWFInput); #endif return input; } ",0 "void CCLayerTreeHost::applyScrollDeltas(const CCScrollUpdateSet& info) { for (size_t i = 0; i < info.size(); ++i) { int layerId = info[i].layerId; IntSize scrollDelta = info[i].scrollDelta; if (rootLayer()->id() == layerId) m_client->applyScrollDelta(scrollDelta); else ASSERT_NOT_REACHED(); } } ",0 "static int __init gre_offload_init(void) { return inet_add_offload(&gre_offload, IPPROTO_GRE); } ",0 "unsigned long iov_iter_alignment(const struct iov_iter *i) { const struct iovec *iov = i->iov; unsigned long res; size_t size = i->count; size_t n; if (!size) return 0; res = (unsigned long)iov->iov_base + i->iov_offset; n = iov->iov_len - i->iov_offset; if (n >= size) return res | size; size -= n; res |= n; while (size > (++iov)->iov_len) { res |= (unsigned long)iov->iov_base | iov->iov_len; size -= iov->iov_len; } res |= (unsigned long)iov->iov_base | size; return res; } ",0 " void SetJitter(double jitter) { jitter_ = jitter; } ",0 "nfsd4_encode_exchange_id(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_exchange_id *exid) { struct xdr_stream *xdr = &resp->xdr; __be32 *p; char *major_id; char *server_scope; int major_id_sz; int server_scope_sz; int status = 0; uint64_t minor_id = 0; if (nfserr) return nfserr; major_id = utsname()->nodename; major_id_sz = strlen(major_id); server_scope = utsname()->nodename; server_scope_sz = strlen(server_scope); p = xdr_reserve_space(xdr, 8 /* eir_clientid */ + 4 /* eir_sequenceid */ + 4 /* eir_flags */ + 4 /* spr_how */); if (!p) return nfserr_resource; p = xdr_encode_opaque_fixed(p, &exid->clientid, 8); *p++ = cpu_to_be32(exid->seqid); *p++ = cpu_to_be32(exid->flags); *p++ = cpu_to_be32(exid->spa_how); switch (exid->spa_how) { case SP4_NONE: break; case SP4_MACH_CRED: /* spo_must_enforce bitmap: */ status = nfsd4_encode_bitmap(xdr, exid->spo_must_enforce[0], exid->spo_must_enforce[1], exid->spo_must_enforce[2]); if (status) goto out; /* spo_must_allow bitmap: */ status = nfsd4_encode_bitmap(xdr, exid->spo_must_allow[0], exid->spo_must_allow[1], exid->spo_must_allow[2]); if (status) goto out; break; default: WARN_ON_ONCE(1); } p = xdr_reserve_space(xdr, 8 /* so_minor_id */ + 4 /* so_major_id.len */ + (XDR_QUADLEN(major_id_sz) * 4) + 4 /* eir_server_scope.len */ + (XDR_QUADLEN(server_scope_sz) * 4) + 4 /* eir_server_impl_id.count (0) */); if (!p) return nfserr_resource; /* The server_owner struct */ p = xdr_encode_hyper(p, minor_id); /* Minor id */ /* major id */ p = xdr_encode_opaque(p, major_id, major_id_sz); /* Server scope */ p = xdr_encode_opaque(p, server_scope, server_scope_sz); /* Implementation id */ *p++ = cpu_to_be32(0); /* zero length nfs_impl_id4 array */ return 0; out: return status; } ",0 "yyparse (void *YYPARSE_PARAM) #else int yyparse (YYPARSE_PARAM) void *YYPARSE_PARAM; #endif #else /* ! YYPARSE_PARAM */ #if (defined __STDC__ || defined __C99__FUNC__ \ || defined __cplusplus || defined _MSC_VER) int yyparse (void) #else int yyparse () #endif #endif { int yystate; /* Number of tokens to shift before error messages enabled. */ int yyerrstatus; /* The stacks and their tools: `yyss': related to states. `yyvs': related to semantic values. Refer to the stacks thru separate pointers, to allow yyoverflow to reallocate them elsewhere. */ /* The state stack. */ yytype_int16 yyssa[YYINITDEPTH]; yytype_int16 *yyss; yytype_int16 *yyssp; /* The semantic value stack. */ YYSTYPE yyvsa[YYINITDEPTH]; YYSTYPE *yyvs; YYSTYPE *yyvsp; YYSIZE_T yystacksize; int yyn; int yyresult; /* Lookahead token as an internal (translated) token number. */ int yytoken; /* The variables used to return semantic value and location from the action routines. */ YYSTYPE yyval; #if YYERROR_VERBOSE /* Buffer for error messages, and its allocated size. */ char yymsgbuf[128]; char *yymsg = yymsgbuf; YYSIZE_T yymsg_alloc = sizeof yymsgbuf; #endif #define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N)) /* The number of symbols on the RHS of the reduced rule. Keep to zero when no symbol should be popped. */ int yylen = 0; yytoken = 0; yyss = yyssa; yyvs = yyvsa; yystacksize = YYINITDEPTH; YYDPRINTF ((stderr, ""Starting parse\n"")); yystate = 0; yyerrstatus = 0; yynerrs = 0; yychar = YYEMPTY; /* Cause a token to be read. */ /* Initialize stack pointers. Waste one element of value and location stack so that they stay on the same level as the state stack. The wasted elements are never initialized. */ yyssp = yyss; yyvsp = yyvs; goto yysetstate; /*------------------------------------------------------------. | yynewstate -- Push a new state, which is found in yystate. | `------------------------------------------------------------*/ yynewstate: /* In all cases, when you get here, the value and location stacks have just been pushed. So pushing a state here evens the stacks. */ yyssp++; yysetstate: *yyssp = yystate; if (yyss + yystacksize - 1 <= yyssp) { /* Get the current used size of the three stacks, in elements. */ YYSIZE_T yysize = yyssp - yyss + 1; #ifdef yyoverflow { /* Give user a chance to reallocate the stack. Use copies of these so that the &'s don't force the real ones into memory. */ YYSTYPE *yyvs1 = yyvs; yytype_int16 *yyss1 = yyss; /* Each stack pointer address is followed by the size of the data in use in that stack, in bytes. This used to be a conditional around just the two extra args, but that might be undefined if yyoverflow is a macro. */ yyoverflow (YY_(""memory exhausted""), &yyss1, yysize * sizeof (*yyssp), &yyvs1, yysize * sizeof (*yyvsp), &yystacksize); yyss = yyss1; yyvs = yyvs1; } #else /* no yyoverflow */ # ifndef YYSTACK_RELOCATE goto yyexhaustedlab; # else /* Extend the stack our own way. */ if (YYMAXDEPTH <= yystacksize) goto yyexhaustedlab; yystacksize *= 2; if (YYMAXDEPTH < yystacksize) yystacksize = YYMAXDEPTH; { yytype_int16 *yyss1 = yyss; union yyalloc *yyptr = (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize)); if (! yyptr) goto yyexhaustedlab; YYSTACK_RELOCATE (yyss_alloc, yyss); YYSTACK_RELOCATE (yyvs_alloc, yyvs); # undef YYSTACK_RELOCATE if (yyss1 != yyssa) YYSTACK_FREE (yyss1); } # endif #endif /* no yyoverflow */ yyssp = yyss + yysize - 1; yyvsp = yyvs + yysize - 1; YYDPRINTF ((stderr, ""Stack size increased to %lu\n"", (unsigned long int) yystacksize)); if (yyss + yystacksize - 1 <= yyssp) YYABORT; } YYDPRINTF ((stderr, ""Entering state %d\n"", yystate)); if (yystate == YYFINAL) YYACCEPT; goto yybackup; /*-----------. | yybackup. | `-----------*/ yybackup: /* Do appropriate processing given the current state. Read a lookahead token if we need one and don't already have one. */ /* First try to decide what to do without reference to lookahead token. */ yyn = yypact[yystate]; if (yyn == YYPACT_NINF) goto yydefault; /* Not known => get a lookahead token if don't already have one. */ /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */ if (yychar == YYEMPTY) { YYDPRINTF ((stderr, ""Reading a token: "")); yychar = YYLEX; } if (yychar <= YYEOF) { yychar = yytoken = YYEOF; YYDPRINTF ((stderr, ""Now at end of input.\n"")); } else { yytoken = YYTRANSLATE (yychar); YY_SYMBOL_PRINT (""Next token is"", yytoken, &yylval, &yylloc); } /* If the proper action on seeing token YYTOKEN is to reduce or to detect an error, take that action. */ yyn += yytoken; if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken) goto yydefault; yyn = yytable[yyn]; if (yyn <= 0) { if (yyn == 0 || yyn == YYTABLE_NINF) goto yyerrlab; yyn = -yyn; goto yyreduce; } /* Count tokens shifted since error; after three, turn off error status. */ if (yyerrstatus) yyerrstatus--; /* Shift the lookahead token. */ YY_SYMBOL_PRINT (""Shifting"", yytoken, &yylval, &yylloc); /* Discard the shifted token. */ yychar = YYEMPTY; yystate = yyn; *++yyvsp = yylval; goto yynewstate; /*-----------------------------------------------------------. | yydefault -- do the default action for the current state. | `-----------------------------------------------------------*/ yydefault: yyn = yydefact[yystate]; if (yyn == 0) goto yyerrlab; goto yyreduce; /*-----------------------------. | yyreduce -- Do a reduction. | `-----------------------------*/ yyreduce: /* yyn is the number of a rule to reduce with. */ yylen = yyr2[yyn]; /* If YYLEN is nonzero, implement the default value of the action: `$$ = $1'. Otherwise, the following line sets YYVAL to garbage. This behavior is undocumented and Bison users should not rely upon it. Assigning to YYVAL unconditionally makes the parser a bit smaller, and it avoids a GCC warning that YYVAL may be used uninitialized. */ yyval = yyvsp[1-yylen]; YY_REDUCE_PRINT (yyn); switch (yyn) { case 5: /* Line 1455 of yacc.c */ #line 320 ""ntp_parser.y"" { /* I will need to incorporate much more fine grained * error messages. The following should suffice for * the time being. */ msyslog(LOG_ERR, ""syntax error in %s line %d, column %d"", ip_file->fname, ip_file->err_line_no, ip_file->err_col_no); } break; case 19: /* Line 1455 of yacc.c */ #line 354 ""ntp_parser.y"" { struct peer_node *my_node = create_peer_node((yyvsp[(1) - (3)].Integer), (yyvsp[(2) - (3)].Address_node), (yyvsp[(3) - (3)].Queue)); if (my_node) enqueue(cfgt.peers, my_node); } break; case 20: /* Line 1455 of yacc.c */ #line 360 ""ntp_parser.y"" { struct peer_node *my_node = create_peer_node((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Address_node), NULL); if (my_node) enqueue(cfgt.peers, my_node); } break; case 27: /* Line 1455 of yacc.c */ #line 377 ""ntp_parser.y"" { (yyval.Address_node) = create_address_node((yyvsp[(2) - (2)].String), AF_INET); } break; case 28: /* Line 1455 of yacc.c */ #line 378 ""ntp_parser.y"" { (yyval.Address_node) = create_address_node((yyvsp[(2) - (2)].String), AF_INET6); } break; case 29: /* Line 1455 of yacc.c */ #line 382 ""ntp_parser.y"" { (yyval.Address_node) = create_address_node((yyvsp[(1) - (1)].String), 0); } break; case 30: /* Line 1455 of yacc.c */ #line 386 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 31: /* Line 1455 of yacc.c */ #line 387 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 32: /* Line 1455 of yacc.c */ #line 391 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 33: /* Line 1455 of yacc.c */ #line 392 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 34: /* Line 1455 of yacc.c */ #line 393 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 35: /* Line 1455 of yacc.c */ #line 394 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 36: /* Line 1455 of yacc.c */ #line 395 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 37: /* Line 1455 of yacc.c */ #line 396 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 38: /* Line 1455 of yacc.c */ #line 397 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 39: /* Line 1455 of yacc.c */ #line 398 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 40: /* Line 1455 of yacc.c */ #line 399 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 41: /* Line 1455 of yacc.c */ #line 400 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 42: /* Line 1455 of yacc.c */ #line 401 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 43: /* Line 1455 of yacc.c */ #line 402 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 44: /* Line 1455 of yacc.c */ #line 403 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 45: /* Line 1455 of yacc.c */ #line 404 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 46: /* Line 1455 of yacc.c */ #line 405 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 47: /* Line 1455 of yacc.c */ #line 415 ""ntp_parser.y"" { struct unpeer_node *my_node = create_unpeer_node((yyvsp[(2) - (2)].Address_node)); if (my_node) enqueue(cfgt.unpeers, my_node); } break; case 50: /* Line 1455 of yacc.c */ #line 434 ""ntp_parser.y"" { cfgt.broadcastclient = 1; } break; case 51: /* Line 1455 of yacc.c */ #line 436 ""ntp_parser.y"" { append_queue(cfgt.manycastserver, (yyvsp[(2) - (2)].Queue)); } break; case 52: /* Line 1455 of yacc.c */ #line 438 ""ntp_parser.y"" { append_queue(cfgt.multicastclient, (yyvsp[(2) - (2)].Queue)); } break; case 53: /* Line 1455 of yacc.c */ #line 449 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer))); } break; case 54: /* Line 1455 of yacc.c */ #line 451 ""ntp_parser.y"" { cfgt.auth.control_key = (yyvsp[(2) - (2)].Integer); } break; case 55: /* Line 1455 of yacc.c */ #line 453 ""ntp_parser.y"" { cfgt.auth.cryptosw++; append_queue(cfgt.auth.crypto_cmd_list, (yyvsp[(2) - (2)].Queue)); } break; case 56: /* Line 1455 of yacc.c */ #line 458 ""ntp_parser.y"" { cfgt.auth.keys = (yyvsp[(2) - (2)].String); } break; case 57: /* Line 1455 of yacc.c */ #line 460 ""ntp_parser.y"" { cfgt.auth.keysdir = (yyvsp[(2) - (2)].String); } break; case 58: /* Line 1455 of yacc.c */ #line 462 ""ntp_parser.y"" { cfgt.auth.request_key = (yyvsp[(2) - (2)].Integer); } break; case 59: /* Line 1455 of yacc.c */ #line 464 ""ntp_parser.y"" { cfgt.auth.revoke = (yyvsp[(2) - (2)].Integer); } break; case 60: /* Line 1455 of yacc.c */ #line 466 ""ntp_parser.y"" { cfgt.auth.trusted_key_list = (yyvsp[(2) - (2)].Queue); } break; case 61: /* Line 1455 of yacc.c */ #line 468 ""ntp_parser.y"" { cfgt.auth.ntp_signd_socket = (yyvsp[(2) - (2)].String); } break; case 63: /* Line 1455 of yacc.c */ #line 474 ""ntp_parser.y"" { (yyval.Queue) = create_queue(); } break; case 64: /* Line 1455 of yacc.c */ #line 479 ""ntp_parser.y"" { if ((yyvsp[(2) - (2)].Attr_val) != NULL) (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); else (yyval.Queue) = (yyvsp[(1) - (2)].Queue); } break; case 65: /* Line 1455 of yacc.c */ #line 486 ""ntp_parser.y"" { if ((yyvsp[(1) - (1)].Attr_val) != NULL) (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); else (yyval.Queue) = create_queue(); } break; case 66: /* Line 1455 of yacc.c */ #line 496 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); } break; case 67: /* Line 1455 of yacc.c */ #line 498 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); } break; case 68: /* Line 1455 of yacc.c */ #line 500 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); } break; case 69: /* Line 1455 of yacc.c */ #line 502 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); } break; case 70: /* Line 1455 of yacc.c */ #line 504 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); } break; case 71: /* Line 1455 of yacc.c */ #line 506 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); } break; case 72: /* Line 1455 of yacc.c */ #line 508 ""ntp_parser.y"" { (yyval.Attr_val) = NULL; cfgt.auth.revoke = (yyvsp[(2) - (2)].Integer); msyslog(LOG_WARNING, ""'crypto revoke %d' is deprecated, "" ""please use 'revoke %d' instead."", cfgt.auth.revoke, cfgt.auth.revoke); } break; case 73: /* Line 1455 of yacc.c */ #line 525 ""ntp_parser.y"" { append_queue(cfgt.orphan_cmds,(yyvsp[(2) - (2)].Queue)); } break; case 74: /* Line 1455 of yacc.c */ #line 529 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 75: /* Line 1455 of yacc.c */ #line 530 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 76: /* Line 1455 of yacc.c */ #line 535 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); } break; case 77: /* Line 1455 of yacc.c */ #line 537 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); } break; case 78: /* Line 1455 of yacc.c */ #line 539 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); } break; case 79: /* Line 1455 of yacc.c */ #line 541 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); } break; case 80: /* Line 1455 of yacc.c */ #line 543 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); } break; case 81: /* Line 1455 of yacc.c */ #line 545 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 82: /* Line 1455 of yacc.c */ #line 547 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 83: /* Line 1455 of yacc.c */ #line 549 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 84: /* Line 1455 of yacc.c */ #line 551 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 85: /* Line 1455 of yacc.c */ #line 553 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); } break; case 86: /* Line 1455 of yacc.c */ #line 555 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (double)(yyvsp[(2) - (2)].Integer)); } break; case 87: /* Line 1455 of yacc.c */ #line 565 ""ntp_parser.y"" { append_queue(cfgt.stats_list, (yyvsp[(2) - (2)].Queue)); } break; case 88: /* Line 1455 of yacc.c */ #line 567 ""ntp_parser.y"" { if (input_from_file) cfgt.stats_dir = (yyvsp[(2) - (2)].String); else { free((yyvsp[(2) - (2)].String)); yyerror(""statsdir remote configuration ignored""); } } break; case 89: /* Line 1455 of yacc.c */ #line 576 ""ntp_parser.y"" { enqueue(cfgt.filegen_opts, create_filegen_node((yyvsp[(2) - (3)].Integer), (yyvsp[(3) - (3)].Queue))); } break; case 90: /* Line 1455 of yacc.c */ #line 583 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), create_ival((yyvsp[(2) - (2)].Integer))); } break; case 91: /* Line 1455 of yacc.c */ #line 584 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue(create_ival((yyvsp[(1) - (1)].Integer))); } break; case 100: /* Line 1455 of yacc.c */ #line 600 ""ntp_parser.y"" { if ((yyvsp[(2) - (2)].Attr_val) != NULL) (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); else (yyval.Queue) = (yyvsp[(1) - (2)].Queue); } break; case 101: /* Line 1455 of yacc.c */ #line 607 ""ntp_parser.y"" { if ((yyvsp[(1) - (1)].Attr_val) != NULL) (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); else (yyval.Queue) = create_queue(); } break; case 102: /* Line 1455 of yacc.c */ #line 617 ""ntp_parser.y"" { if (input_from_file) (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); else { (yyval.Attr_val) = NULL; free((yyvsp[(2) - (2)].String)); yyerror(""filegen file remote configuration ignored""); } } break; case 103: /* Line 1455 of yacc.c */ #line 627 ""ntp_parser.y"" { if (input_from_file) (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); else { (yyval.Attr_val) = NULL; yyerror(""filegen type remote configuration ignored""); } } break; case 104: /* Line 1455 of yacc.c */ #line 636 ""ntp_parser.y"" { if (input_from_file) (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); else { (yyval.Attr_val) = NULL; yyerror(""filegen link remote configuration ignored""); } } break; case 105: /* Line 1455 of yacc.c */ #line 645 ""ntp_parser.y"" { if (input_from_file) (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); else { (yyval.Attr_val) = NULL; yyerror(""filegen nolink remote configuration ignored""); } } break; case 106: /* Line 1455 of yacc.c */ #line 653 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 107: /* Line 1455 of yacc.c */ #line 654 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 115: /* Line 1455 of yacc.c */ #line 674 ""ntp_parser.y"" { append_queue(cfgt.discard_opts, (yyvsp[(2) - (2)].Queue)); } break; case 116: /* Line 1455 of yacc.c */ #line 678 ""ntp_parser.y"" { append_queue(cfgt.mru_opts, (yyvsp[(2) - (2)].Queue)); } break; case 117: /* Line 1455 of yacc.c */ #line 682 ""ntp_parser.y"" { enqueue(cfgt.restrict_opts, create_restrict_node((yyvsp[(2) - (3)].Address_node), NULL, (yyvsp[(3) - (3)].Queue), ip_file->line_no)); } break; case 118: /* Line 1455 of yacc.c */ #line 687 ""ntp_parser.y"" { enqueue(cfgt.restrict_opts, create_restrict_node((yyvsp[(2) - (5)].Address_node), (yyvsp[(4) - (5)].Address_node), (yyvsp[(5) - (5)].Queue), ip_file->line_no)); } break; case 119: /* Line 1455 of yacc.c */ #line 692 ""ntp_parser.y"" { enqueue(cfgt.restrict_opts, create_restrict_node(NULL, NULL, (yyvsp[(3) - (3)].Queue), ip_file->line_no)); } break; case 120: /* Line 1455 of yacc.c */ #line 697 ""ntp_parser.y"" { enqueue(cfgt.restrict_opts, create_restrict_node( create_address_node( estrdup(""0.0.0.0""), AF_INET), create_address_node( estrdup(""0.0.0.0""), AF_INET), (yyvsp[(4) - (4)].Queue), ip_file->line_no)); } break; case 121: /* Line 1455 of yacc.c */ #line 710 ""ntp_parser.y"" { enqueue(cfgt.restrict_opts, create_restrict_node( create_address_node( estrdup(""::""), AF_INET6), create_address_node( estrdup(""::""), AF_INET6), (yyvsp[(4) - (4)].Queue), ip_file->line_no)); } break; case 122: /* Line 1455 of yacc.c */ #line 723 ""ntp_parser.y"" { enqueue(cfgt.restrict_opts, create_restrict_node( NULL, NULL, enqueue((yyvsp[(3) - (3)].Queue), create_ival((yyvsp[(2) - (3)].Integer))), ip_file->line_no)); } break; case 123: /* Line 1455 of yacc.c */ #line 734 ""ntp_parser.y"" { (yyval.Queue) = create_queue(); } break; case 124: /* Line 1455 of yacc.c */ #line 736 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), create_ival((yyvsp[(2) - (2)].Integer))); } break; case 139: /* Line 1455 of yacc.c */ #line 758 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 140: /* Line 1455 of yacc.c */ #line 760 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 141: /* Line 1455 of yacc.c */ #line 764 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 142: /* Line 1455 of yacc.c */ #line 765 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 143: /* Line 1455 of yacc.c */ #line 766 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 144: /* Line 1455 of yacc.c */ #line 771 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 145: /* Line 1455 of yacc.c */ #line 773 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 146: /* Line 1455 of yacc.c */ #line 777 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 147: /* Line 1455 of yacc.c */ #line 778 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 148: /* Line 1455 of yacc.c */ #line 779 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 149: /* Line 1455 of yacc.c */ #line 780 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 150: /* Line 1455 of yacc.c */ #line 781 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 151: /* Line 1455 of yacc.c */ #line 782 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 152: /* Line 1455 of yacc.c */ #line 783 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 153: /* Line 1455 of yacc.c */ #line 784 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 154: /* Line 1455 of yacc.c */ #line 793 ""ntp_parser.y"" { enqueue(cfgt.fudge, create_addr_opts_node((yyvsp[(2) - (3)].Address_node), (yyvsp[(3) - (3)].Queue))); } break; case 155: /* Line 1455 of yacc.c */ #line 798 ""ntp_parser.y"" { enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 156: /* Line 1455 of yacc.c */ #line 800 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 157: /* Line 1455 of yacc.c */ #line 804 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 158: /* Line 1455 of yacc.c */ #line 805 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 159: /* Line 1455 of yacc.c */ #line 806 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 160: /* Line 1455 of yacc.c */ #line 807 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String)); } break; case 161: /* Line 1455 of yacc.c */ #line 808 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 162: /* Line 1455 of yacc.c */ #line 809 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 163: /* Line 1455 of yacc.c */ #line 810 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 164: /* Line 1455 of yacc.c */ #line 811 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 165: /* Line 1455 of yacc.c */ #line 820 ""ntp_parser.y"" { append_queue(cfgt.enable_opts, (yyvsp[(2) - (2)].Queue)); } break; case 166: /* Line 1455 of yacc.c */ #line 822 ""ntp_parser.y"" { append_queue(cfgt.disable_opts, (yyvsp[(2) - (2)].Queue)); } break; case 167: /* Line 1455 of yacc.c */ #line 827 ""ntp_parser.y"" { if ((yyvsp[(2) - (2)].Attr_val) != NULL) (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); else (yyval.Queue) = (yyvsp[(1) - (2)].Queue); } break; case 168: /* Line 1455 of yacc.c */ #line 834 ""ntp_parser.y"" { if ((yyvsp[(1) - (1)].Attr_val) != NULL) (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); else (yyval.Queue) = create_queue(); } break; case 169: /* Line 1455 of yacc.c */ #line 843 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 170: /* Line 1455 of yacc.c */ #line 844 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 171: /* Line 1455 of yacc.c */ #line 845 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 172: /* Line 1455 of yacc.c */ #line 846 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 173: /* Line 1455 of yacc.c */ #line 847 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 174: /* Line 1455 of yacc.c */ #line 848 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); } break; case 175: /* Line 1455 of yacc.c */ #line 850 ""ntp_parser.y"" { if (input_from_file) (yyval.Attr_val) = create_attr_ival(T_Flag, (yyvsp[(1) - (1)].Integer)); else { (yyval.Attr_val) = NULL; yyerror(""enable/disable stats remote configuration ignored""); } } break; case 176: /* Line 1455 of yacc.c */ #line 865 ""ntp_parser.y"" { append_queue(cfgt.tinker, (yyvsp[(2) - (2)].Queue)); } break; case 177: /* Line 1455 of yacc.c */ #line 869 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 178: /* Line 1455 of yacc.c */ #line 870 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 179: /* Line 1455 of yacc.c */ #line 874 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 180: /* Line 1455 of yacc.c */ #line 875 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 181: /* Line 1455 of yacc.c */ #line 876 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 182: /* Line 1455 of yacc.c */ #line 877 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 183: /* Line 1455 of yacc.c */ #line 878 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 184: /* Line 1455 of yacc.c */ #line 879 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 185: /* Line 1455 of yacc.c */ #line 880 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double)); } break; case 187: /* Line 1455 of yacc.c */ #line 891 ""ntp_parser.y"" { if (curr_include_level >= MAXINCLUDELEVEL) { fprintf(stderr, ""getconfig: Maximum include file level exceeded.\n""); msyslog(LOG_ERR, ""getconfig: Maximum include file level exceeded.""); } else { fp[curr_include_level + 1] = F_OPEN(FindConfig((yyvsp[(2) - (3)].String)), ""r""); if (fp[curr_include_level + 1] == NULL) { fprintf(stderr, ""getconfig: Couldn't open <%s>\n"", FindConfig((yyvsp[(2) - (3)].String))); msyslog(LOG_ERR, ""getconfig: Couldn't open <%s>"", FindConfig((yyvsp[(2) - (3)].String))); } else ip_file = fp[++curr_include_level]; } } break; case 188: /* Line 1455 of yacc.c */ #line 907 ""ntp_parser.y"" { while (curr_include_level != -1) FCLOSE(fp[curr_include_level--]); } break; case 189: /* Line 1455 of yacc.c */ #line 913 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double))); } break; case 190: /* Line 1455 of yacc.c */ #line 915 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer))); } break; case 191: /* Line 1455 of yacc.c */ #line 917 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_dval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Double))); } break; case 192: /* Line 1455 of yacc.c */ #line 919 ""ntp_parser.y"" { /* Null action, possibly all null parms */ } break; case 193: /* Line 1455 of yacc.c */ #line 921 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String))); } break; case 194: /* Line 1455 of yacc.c */ #line 924 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String))); } break; case 195: /* Line 1455 of yacc.c */ #line 926 ""ntp_parser.y"" { if (input_from_file) enqueue(cfgt.vars, create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String))); else { free((yyvsp[(2) - (2)].String)); yyerror(""logfile remote configuration ignored""); } } break; case 196: /* Line 1455 of yacc.c */ #line 937 ""ntp_parser.y"" { append_queue(cfgt.logconfig, (yyvsp[(2) - (2)].Queue)); } break; case 197: /* Line 1455 of yacc.c */ #line 939 ""ntp_parser.y"" { append_queue(cfgt.phone, (yyvsp[(2) - (2)].Queue)); } break; case 198: /* Line 1455 of yacc.c */ #line 941 ""ntp_parser.y"" { if (input_from_file) enqueue(cfgt.vars, create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String))); else { free((yyvsp[(2) - (2)].String)); yyerror(""saveconfigdir remote configuration ignored""); } } break; case 199: /* Line 1455 of yacc.c */ #line 951 ""ntp_parser.y"" { enqueue(cfgt.setvar, (yyvsp[(2) - (2)].Set_var)); } break; case 200: /* Line 1455 of yacc.c */ #line 953 ""ntp_parser.y"" { enqueue(cfgt.trap, create_addr_opts_node((yyvsp[(2) - (2)].Address_node), NULL)); } break; case 201: /* Line 1455 of yacc.c */ #line 955 ""ntp_parser.y"" { enqueue(cfgt.trap, create_addr_opts_node((yyvsp[(2) - (3)].Address_node), (yyvsp[(3) - (3)].Queue))); } break; case 202: /* Line 1455 of yacc.c */ #line 957 ""ntp_parser.y"" { append_queue(cfgt.ttl, (yyvsp[(2) - (2)].Queue)); } break; case 203: /* Line 1455 of yacc.c */ #line 959 ""ntp_parser.y"" { enqueue(cfgt.qos, create_attr_sval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].String))); } break; case 204: /* Line 1455 of yacc.c */ #line 964 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_sval(T_Driftfile, (yyvsp[(1) - (1)].String))); } break; case 205: /* Line 1455 of yacc.c */ #line 966 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_dval(T_WanderThreshold, (yyvsp[(2) - (2)].Double))); enqueue(cfgt.vars, create_attr_sval(T_Driftfile, (yyvsp[(1) - (2)].String))); } break; case 206: /* Line 1455 of yacc.c */ #line 969 ""ntp_parser.y"" { enqueue(cfgt.vars, create_attr_sval(T_Driftfile, ""\0"")); } break; case 207: /* Line 1455 of yacc.c */ #line 974 ""ntp_parser.y"" { (yyval.Set_var) = create_setvar_node((yyvsp[(1) - (4)].String), (yyvsp[(3) - (4)].String), (yyvsp[(4) - (4)].Integer)); } break; case 208: /* Line 1455 of yacc.c */ #line 976 ""ntp_parser.y"" { (yyval.Set_var) = create_setvar_node((yyvsp[(1) - (3)].String), (yyvsp[(3) - (3)].String), 0); } break; case 209: /* Line 1455 of yacc.c */ #line 981 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 210: /* Line 1455 of yacc.c */ #line 982 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 211: /* Line 1455 of yacc.c */ #line 986 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Integer)); } break; case 212: /* Line 1455 of yacc.c */ #line 987 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_pval((yyvsp[(1) - (2)].Integer), (yyvsp[(2) - (2)].Address_node)); } break; case 213: /* Line 1455 of yacc.c */ #line 991 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 214: /* Line 1455 of yacc.c */ #line 992 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 215: /* Line 1455 of yacc.c */ #line 997 ""ntp_parser.y"" { char prefix = (yyvsp[(1) - (1)].String)[0]; char *type = (yyvsp[(1) - (1)].String) + 1; if (prefix != '+' && prefix != '-' && prefix != '=') { yyerror(""Logconfig prefix is not '+', '-' or '='\n""); } else (yyval.Attr_val) = create_attr_sval(prefix, estrdup(type)); YYFREE((yyvsp[(1) - (1)].String)); } break; case 216: /* Line 1455 of yacc.c */ #line 1012 ""ntp_parser.y"" { enqueue(cfgt.nic_rules, create_nic_rule_node((yyvsp[(3) - (3)].Integer), NULL, (yyvsp[(2) - (3)].Integer))); } break; case 217: /* Line 1455 of yacc.c */ #line 1017 ""ntp_parser.y"" { enqueue(cfgt.nic_rules, create_nic_rule_node(0, (yyvsp[(3) - (3)].String), (yyvsp[(2) - (3)].Integer))); } break; case 227: /* Line 1455 of yacc.c */ #line 1048 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), create_ival((yyvsp[(2) - (2)].Integer))); } break; case 228: /* Line 1455 of yacc.c */ #line 1049 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue(create_ival((yyvsp[(1) - (1)].Integer))); } break; case 229: /* Line 1455 of yacc.c */ #line 1054 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Attr_val)); } break; case 230: /* Line 1455 of yacc.c */ #line 1056 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Attr_val)); } break; case 231: /* Line 1455 of yacc.c */ #line 1061 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_ival('i', (yyvsp[(1) - (1)].Integer)); } break; case 233: /* Line 1455 of yacc.c */ #line 1067 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_shorts('-', (yyvsp[(2) - (5)].Integer), (yyvsp[(4) - (5)].Integer)); } break; case 234: /* Line 1455 of yacc.c */ #line 1071 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), create_pval((yyvsp[(2) - (2)].String))); } break; case 235: /* Line 1455 of yacc.c */ #line 1072 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue(create_pval((yyvsp[(1) - (1)].String))); } break; case 236: /* Line 1455 of yacc.c */ #line 1076 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Address_node)); } break; case 237: /* Line 1455 of yacc.c */ #line 1077 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Address_node)); } break; case 238: /* Line 1455 of yacc.c */ #line 1082 ""ntp_parser.y"" { if ((yyvsp[(1) - (1)].Integer) != 0 && (yyvsp[(1) - (1)].Integer) != 1) { yyerror(""Integer value is not boolean (0 or 1). Assuming 1""); (yyval.Integer) = 1; } else (yyval.Integer) = (yyvsp[(1) - (1)].Integer); } break; case 239: /* Line 1455 of yacc.c */ #line 1090 ""ntp_parser.y"" { (yyval.Integer) = 1; } break; case 240: /* Line 1455 of yacc.c */ #line 1091 ""ntp_parser.y"" { (yyval.Integer) = 0; } break; case 241: /* Line 1455 of yacc.c */ #line 1095 ""ntp_parser.y"" { (yyval.Double) = (double)(yyvsp[(1) - (1)].Integer); } break; case 243: /* Line 1455 of yacc.c */ #line 1106 ""ntp_parser.y"" { cfgt.sim_details = create_sim_node((yyvsp[(3) - (5)].Queue), (yyvsp[(4) - (5)].Queue)); /* Reset the old_config_style variable */ old_config_style = 1; } break; case 244: /* Line 1455 of yacc.c */ #line 1120 ""ntp_parser.y"" { old_config_style = 0; } break; case 245: /* Line 1455 of yacc.c */ #line 1124 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (3)].Queue), (yyvsp[(2) - (3)].Attr_val)); } break; case 246: /* Line 1455 of yacc.c */ #line 1125 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (2)].Attr_val)); } break; case 247: /* Line 1455 of yacc.c */ #line 1129 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); } break; case 248: /* Line 1455 of yacc.c */ #line 1130 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); } break; case 249: /* Line 1455 of yacc.c */ #line 1134 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Sim_server)); } break; case 250: /* Line 1455 of yacc.c */ #line 1135 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Sim_server)); } break; case 251: /* Line 1455 of yacc.c */ #line 1140 ""ntp_parser.y"" { (yyval.Sim_server) = create_sim_server((yyvsp[(1) - (5)].Address_node), (yyvsp[(3) - (5)].Double), (yyvsp[(4) - (5)].Queue)); } break; case 252: /* Line 1455 of yacc.c */ #line 1144 ""ntp_parser.y"" { (yyval.Double) = (yyvsp[(3) - (4)].Double); } break; case 253: /* Line 1455 of yacc.c */ #line 1148 ""ntp_parser.y"" { (yyval.Address_node) = (yyvsp[(3) - (3)].Address_node); } break; case 254: /* Line 1455 of yacc.c */ #line 1152 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (2)].Queue), (yyvsp[(2) - (2)].Sim_script)); } break; case 255: /* Line 1455 of yacc.c */ #line 1153 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (1)].Sim_script)); } break; case 256: /* Line 1455 of yacc.c */ #line 1158 ""ntp_parser.y"" { (yyval.Sim_script) = create_sim_script_info((yyvsp[(3) - (6)].Double), (yyvsp[(5) - (6)].Queue)); } break; case 257: /* Line 1455 of yacc.c */ #line 1162 ""ntp_parser.y"" { (yyval.Queue) = enqueue((yyvsp[(1) - (3)].Queue), (yyvsp[(2) - (3)].Attr_val)); } break; case 258: /* Line 1455 of yacc.c */ #line 1163 ""ntp_parser.y"" { (yyval.Queue) = enqueue_in_new_queue((yyvsp[(1) - (2)].Attr_val)); } break; case 259: /* Line 1455 of yacc.c */ #line 1168 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); } break; case 260: /* Line 1455 of yacc.c */ #line 1170 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); } break; case 261: /* Line 1455 of yacc.c */ #line 1172 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); } break; case 262: /* Line 1455 of yacc.c */ #line 1174 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); } break; case 263: /* Line 1455 of yacc.c */ #line 1176 ""ntp_parser.y"" { (yyval.Attr_val) = create_attr_dval((yyvsp[(1) - (3)].Integer), (yyvsp[(3) - (3)].Double)); } break; /* Line 1455 of yacc.c */ #line 3826 ""ntp_parser.c"" default: break; } YY_SYMBOL_PRINT (""-> $$ ="", yyr1[yyn], &yyval, &yyloc); YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); *++yyvsp = yyval; /* Now `shift' the result of the reduction. Determine what state that goes to, based on the state we popped back to and the rule number reduced by. */ yyn = yyr1[yyn]; yystate = yypgoto[yyn - YYNTOKENS] + *yyssp; if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp) yystate = yytable[yystate]; else yystate = yydefgoto[yyn - YYNTOKENS]; goto yynewstate; /*------------------------------------. | yyerrlab -- here on detecting error | `------------------------------------*/ yyerrlab: /* If not already recovering from an error, report this error. */ if (!yyerrstatus) { ++yynerrs; #if ! YYERROR_VERBOSE yyerror (YY_(""syntax error"")); #else { YYSIZE_T yysize = yysyntax_error (0, yystate, yychar); if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM) { YYSIZE_T yyalloc = 2 * yysize; if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM)) yyalloc = YYSTACK_ALLOC_MAXIMUM; if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); yymsg = (char *) YYSTACK_ALLOC (yyalloc); if (yymsg) yymsg_alloc = yyalloc; else { yymsg = yymsgbuf; yymsg_alloc = sizeof yymsgbuf; } } if (0 < yysize && yysize <= yymsg_alloc) { (void) yysyntax_error (yymsg, yystate, yychar); yyerror (yymsg); } else { yyerror (YY_(""syntax error"")); if (yysize != 0) goto yyexhaustedlab; } } #endif } if (yyerrstatus == 3) { /* If just tried and failed to reuse lookahead token after an error, discard it. */ if (yychar <= YYEOF) { /* Return failure if at end of input. */ if (yychar == YYEOF) YYABORT; } else { yydestruct (""Error: discarding"", yytoken, &yylval); yychar = YYEMPTY; } } /* Else will try to reuse lookahead token after shifting the error token. */ goto yyerrlab1; /*---------------------------------------------------. | yyerrorlab -- error raised explicitly by YYERROR. | `---------------------------------------------------*/ yyerrorlab: /* Pacify compilers like GCC when the user code never invokes YYERROR and the label yyerrorlab therefore never appears in user code. */ if (/*CONSTCOND*/ 0) goto yyerrorlab; /* Do not reclaim the symbols of the rule which action triggered this YYERROR. */ YYPOPSTACK (yylen); yylen = 0; YY_STACK_PRINT (yyss, yyssp); yystate = *yyssp; goto yyerrlab1; /*-------------------------------------------------------------. | yyerrlab1 -- common code for both syntax error and YYERROR. | `-------------------------------------------------------------*/ yyerrlab1: yyerrstatus = 3; /* Each real token shifted decrements this. */ for (;;) { yyn = yypact[yystate]; if (yyn != YYPACT_NINF) { yyn += YYTERROR; if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR) { yyn = yytable[yyn]; if (0 < yyn) break; } } /* Pop the current state because it cannot handle the error token. */ if (yyssp == yyss) YYABORT; yydestruct (""Error: popping"", yystos[yystate], yyvsp); YYPOPSTACK (1); yystate = *yyssp; YY_STACK_PRINT (yyss, yyssp); } *++yyvsp = yylval; /* Shift the error token. */ YY_SYMBOL_PRINT (""Shifting"", yystos[yyn], yyvsp, yylsp); yystate = yyn; goto yynewstate; /*-------------------------------------. | yyacceptlab -- YYACCEPT comes here. | `-------------------------------------*/ yyacceptlab: yyresult = 0; goto yyreturn; /*-----------------------------------. | yyabortlab -- YYABORT comes here. | `-----------------------------------*/ yyabortlab: yyresult = 1; goto yyreturn; #if !defined(yyoverflow) || YYERROR_VERBOSE /*-------------------------------------------------. | yyexhaustedlab -- memory exhaustion comes here. | `-------------------------------------------------*/ yyexhaustedlab: yyerror (YY_(""memory exhausted"")); yyresult = 2; /* Fall through. */ #endif yyreturn: if (yychar != YYEMPTY) yydestruct (""Cleanup: discarding lookahead"", yytoken, &yylval); /* Do not reclaim the symbols of the rule which action triggered this YYABORT or YYACCEPT. */ YYPOPSTACK (yylen); YY_STACK_PRINT (yyss, yyssp); while (yyssp != yyss) { yydestruct (""Cleanup: popping"", yystos[*yyssp], yyvsp); YYPOPSTACK (1); } #ifndef yyoverflow if (yyss != yyssa) YYSTACK_FREE (yyss); #endif #if YYERROR_VERBOSE if (yymsg != yymsgbuf) YYSTACK_FREE (yymsg); #endif /* Make sure YYID is used. */ return YYID (yyresult); } ",1 "void Document::DetachParser() { if (!parser_) return; parser_->Detach(); parser_.Clear(); DocumentParserTiming::From(*this).MarkParserDetached(); } ",0 "static void WriteDDSInfo(Image *image, const size_t pixelFormat, const size_t compression, const size_t mipmaps) { char software[MaxTextExtent]; register ssize_t i; unsigned int format, caps, flags; flags=(unsigned int) (DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT | DDSD_PIXELFORMAT | DDSD_LINEARSIZE); caps=(unsigned int) DDSCAPS_TEXTURE; format=(unsigned int) pixelFormat; if (mipmaps > 0) { flags=flags | (unsigned int) DDSD_MIPMAPCOUNT; caps=caps | (unsigned int) (DDSCAPS_MIPMAP | DDSCAPS_COMPLEX); } if (format != DDPF_FOURCC && image->matte) format=format | DDPF_ALPHAPIXELS; (void) WriteBlob(image,4,(unsigned char *) ""DDS ""); (void) WriteBlobLSBLong(image,124); (void) WriteBlobLSBLong(image,flags); (void) WriteBlobLSBLong(image,image->rows); (void) WriteBlobLSBLong(image,image->columns); if (compression == FOURCC_DXT1) (void) WriteBlobLSBLong(image, (unsigned int) (Max(1,(image->columns+3)/4) * 8)); else (void) WriteBlobLSBLong(image, (unsigned int) (Max(1,(image->columns+3)/4) * 16)); (void) WriteBlobLSBLong(image,0x00); (void) WriteBlobLSBLong(image,(unsigned int) mipmaps+1); (void) ResetMagickMemory(software,0,sizeof(software)); (void) strcpy(software,""IMAGEMAGICK""); (void) WriteBlob(image,44,(unsigned char *) software); (void) WriteBlobLSBLong(image,32); (void) WriteBlobLSBLong(image,format); if (pixelFormat == DDPF_FOURCC) { (void) WriteBlobLSBLong(image,(unsigned int) compression); for(i=0;i < 5;i++) // bitcount / masks (void) WriteBlobLSBLong(image,0x00); } else { (void) WriteBlobLSBLong(image,0x00); if (image->matte) { (void) WriteBlobLSBLong(image,32); (void) WriteBlobLSBLong(image,0xff0000); (void) WriteBlobLSBLong(image,0xff00); (void) WriteBlobLSBLong(image,0xff); (void) WriteBlobLSBLong(image,0xff000000); } else { (void) WriteBlobLSBLong(image,24); (void) WriteBlobLSBLong(image,0xff); (void) WriteBlobLSBLong(image,0x00); (void) WriteBlobLSBLong(image,0x00); (void) WriteBlobLSBLong(image,0x00); } } (void) WriteBlobLSBLong(image,caps); for(i=0;i < 4;i++) // ddscaps2 + reserved region (void) WriteBlobLSBLong(image,0x00); } ",0 "queue_local_notify(xmlNode * notify_src, const char *client_id, gboolean sync_reply, gboolean from_peer) { cib_local_notify_t *notify = calloc(1, sizeof(cib_local_notify_t)); notify->notify_src = notify_src; notify->client_id = strdup(client_id); notify->sync_reply = sync_reply; notify->from_peer = from_peer; if (!local_notify_queue) { local_notify_queue = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, local_notify_destroy_callback); } g_hash_table_insert(local_notify_queue, GINT_TO_POINTER(cib_local_bcast_num), notify); } ",0 "LayoutUnit RenderBox::computeReplacedLogicalWidth(ShouldComputePreferred shouldComputePreferred) const { return computeReplacedLogicalWidthRespectingMinMaxWidth(computeReplacedLogicalWidthUsing(style()->logicalWidth()), shouldComputePreferred); } ",0 " void CreateGroupInEmptyOrigin() { storage()->LoadOrCreateGroup(kManifestUrl, delegate()); Verify_CreateGroup(); } ",0 "static void OverloadedMethodCMethod(const v8::FunctionCallbackInfo& info) { scheduler::CooperativeSchedulingManager::Instance()->Safepoint(); bool is_arity_error = false; switch (std::min(1, info.Length())) { case 1: if (V8TestInterfaceEmpty::HasInstance(info[0], info.GetIsolate())) { OverloadedMethodC2Method(info); return; } if (info[0]->IsNumber()) { OverloadedMethodC1Method(info); return; } if (true) { OverloadedMethodC1Method(info); return; } break; default: is_arity_error = true; } ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""overloadedMethodC""); if (is_arity_error) { if (info.Length() < 1) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } } exception_state.ThrowTypeError(""No function was found that matched the signature provided.""); } ",0 "void GM2TabStyle::PaintTab(gfx::Canvas* canvas, const SkPath& clip) const { int active_tab_fill_id = 0; int active_tab_y_inset = 0; if (tab_->GetThemeProvider()->HasCustomImage(IDR_THEME_TOOLBAR)) { active_tab_fill_id = IDR_THEME_TOOLBAR; active_tab_y_inset = GetStrokeThickness(true); } if (tab_->IsActive()) { PaintTabBackground(canvas, true /* active */, active_tab_fill_id, active_tab_y_inset, nullptr /* clip */); } else { PaintInactiveTabBackground(canvas, clip); const float throb_value = GetThrobValue(); if (throb_value > 0) { canvas->SaveLayerAlpha(gfx::ToRoundedInt(throb_value * 0xff), tab_->GetLocalBounds()); PaintTabBackground(canvas, true /* active */, active_tab_fill_id, active_tab_y_inset, nullptr /* clip */); canvas->Restore(); } } } ",1 "static void v9fs_getlock(void *opaque) { size_t offset = 7; struct stat stbuf; V9fsFidState *fidp; V9fsGetlock glock; int32_t fid, err = 0; V9fsPDU *pdu = opaque; v9fs_string_init(&glock.client_id); err = pdu_unmarshal(pdu, offset, ""dbqqds"", &fid, &glock.type, &glock.start, &glock.length, &glock.proc_id, &glock.client_id); if (err < 0) { goto out_nofid; } trace_v9fs_getlock(pdu->tag, pdu->id, fid, glock.type, glock.start, glock.length); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } err = v9fs_co_fstat(pdu, fidp, &stbuf); if (err < 0) { goto out; } glock.type = P9_LOCK_TYPE_UNLCK; err = pdu_marshal(pdu, offset, ""bqqds"", glock.type, glock.start, glock.length, glock.proc_id, &glock.client_id); if (err < 0) { goto out; } err += offset; trace_v9fs_getlock_return(pdu->tag, pdu->id, glock.type, glock.start, glock.length, glock.proc_id); out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&glock.client_id); } ",0 "int __init nfc_genl_init(void) { int rc; rc = genl_register_family(&nfc_genl_family); if (rc) return rc; netlink_register_notifier(&nl_notifier); return 0; } ",0 "evdns_base_resolv_conf_parse_impl(struct evdns_base *base, int flags, const char *const filename) { size_t n; char *resolv; char *start; int err = 0; log(EVDNS_LOG_DEBUG, ""Parsing resolv.conf file %s"", filename); if (flags & DNS_OPTION_HOSTSFILE) { char *fname = evdns_get_default_hosts_filename(); evdns_base_load_hosts(base, fname); if (fname) mm_free(fname); } if ((err = evutil_read_file_(filename, &resolv, &n, 0)) < 0) { if (err == -1) { /* No file. */ evdns_resolv_set_defaults(base, flags); return 1; } else { return 2; } } start = resolv; for (;;) { char *const newline = strchr(start, '\n'); if (!newline) { resolv_conf_parse_line(base, start, flags); break; } else { *newline = 0; resolv_conf_parse_line(base, start, flags); start = newline + 1; } } if (!base->server_head && (flags & DNS_OPTION_NAMESERVERS)) { /* no nameservers were configured. */ evdns_base_nameserver_ip_add(base, ""127.0.0.1""); err = 6; } if (flags & DNS_OPTION_SEARCH && (!base->global_search_state || base->global_search_state->num_domains == 0)) { search_set_from_hostname(base); } mm_free(resolv); return err; } ",0 "static int setkey_unaligned(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { struct blkcipher_alg *cipher = &tfm->__crt_alg->cra_blkcipher; unsigned long alignmask = crypto_tfm_alg_alignmask(tfm); int ret; u8 *buffer, *alignbuffer; unsigned long absize; absize = keylen + alignmask; buffer = kmalloc(absize, GFP_ATOMIC); if (!buffer) return -ENOMEM; alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1); memcpy(alignbuffer, key, keylen); ret = cipher->setkey(tfm, alignbuffer, keylen); memset(alignbuffer, 0, keylen); kfree(buffer); return ret; } ",0 "static void emulator_get_fpu(struct x86_emulate_ctxt *ctxt) { preempt_disable(); kvm_load_guest_fpu(emul_to_vcpu(ctxt)); /* * CR0.TS may reference the host fpu state, not the guest fpu state, * so it may be clear at this point. */ clts(); } ",0 "zgetuseciecolor(i_ctx_t * i_ctx_p) { os_ptr op = osp; push(1); *op = istate->use_cie_color; return 0; } ",0 "Strsubstr(Str s, int beg, int len) { Str new_s; int i; STR_LENGTH_CHECK(s); new_s = Strnew(); if (beg >= s->length) return new_s; for (i = 0; i < len && beg + i < s->length; i++) Strcat_char(new_s, s->ptr[beg + i]); return new_s; } ",0 "int RenderMenuList::clientInsetRight() const { return 0; } ",0 "void RenderWidgetHostViewGtk::SetBounds(const gfx::Rect& rect) { if (IsPopup()) { gtk_window_move(GTK_WINDOW(gtk_widget_get_toplevel(view_.get())), rect.x(), rect.y()); } SetSize(rect.size()); } ",0 "XfrmController::XfrmController(void) {} ",0 "int __remove_suid(struct dentry *dentry, int kill) { struct iattr newattrs; newattrs.ia_valid = ATTR_FORCE | kill; return notify_change(dentry, &newattrs); } ",0 "static int proc_sys_revalidate(struct dentry *dentry, unsigned int flags) { if (flags & LOOKUP_RCU) return -ECHILD; return !PROC_I(d_inode(dentry))->sysctl->unregistering; } ",0 "NPError NPN_GetURL(NPP id, const char* url, const char* target) { return GetURLNotify(id, url, target, false, 0); } ",0 "png_read_filter_row_paeth_1byte_pixel(png_row_infop row_info, png_bytep row, png_const_bytep prev_row) { png_bytep rp_end = row + row_info->rowbytes; int a, c; /* First pixel/byte */ c = *prev_row++; a = *row + c; *row++ = (png_byte)a; /* Remainder */ while (row < rp_end) { int b, pa, pb, pc, p; a &= 0xff; /* From previous iteration or start */ b = *prev_row++; p = b - c; pc = a - c; #ifdef PNG_USE_ABS pa = abs(p); pb = abs(pc); pc = abs(p + pc); #else pa = p < 0 ? -p : p; pb = pc < 0 ? -pc : pc; pc = (p + pc) < 0 ? -(p + pc) : p + pc; #endif /* Find the best predictor, the least of pa, pb, pc favoring the earlier * ones in the case of a tie. */ if (pb < pa) { pa = pb; a = b; } if (pc < pa) a = c; /* Calculate the current pixel in a, and move the previous row pixel to c * for the next time round the loop */ c = b; a += *row; *row++ = (png_byte)a; } } ",0 "void SoftMPEG4::onQueueFilled(OMX_U32 /* portIndex */) { if (mSignalledError || mOutputPortSettingsChange != NONE) { return; } List &inQueue = getPortQueue(0); List &outQueue = getPortQueue(1); while (!inQueue.empty() && outQueue.size() == kNumOutputBuffers) { BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; if (inHeader == NULL) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; continue; } PortInfo *port = editPortInfo(1); OMX_BUFFERHEADERTYPE *outHeader = port->mBuffers.editItemAt(mNumSamplesOutput & 1).mHeader; if (inHeader->nFilledLen == 0) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); ++mInputBufferCount; if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { outHeader->nFilledLen = 0; outHeader->nFlags = OMX_BUFFERFLAG_EOS; List::iterator it = outQueue.begin(); while ((*it)->mHeader != outHeader) { ++it; } BufferInfo *outInfo = *it; outInfo->mOwnedByUs = false; outQueue.erase(it); outInfo = NULL; notifyFillBufferDone(outHeader); outHeader = NULL; } return; } uint8_t *bitstream = inHeader->pBuffer + inHeader->nOffset; uint32_t *start_code = (uint32_t *)bitstream; bool volHeader = *start_code == 0xB0010000; if (volHeader) { PVCleanUpVideoDecoder(mHandle); mInitialized = false; } if (!mInitialized) { uint8_t *vol_data[1]; int32_t vol_size = 0; vol_data[0] = NULL; if ((inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) || volHeader) { vol_data[0] = bitstream; vol_size = inHeader->nFilledLen; } MP4DecodingMode mode = (mMode == MODE_MPEG4) ? MPEG4_MODE : H263_MODE; Bool success = PVInitVideoDecoder( mHandle, vol_data, &vol_size, 1, outputBufferWidth(), outputBufferHeight(), mode); if (!success) { ALOGW(""PVInitVideoDecoder failed. Unsupported content?""); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); mSignalledError = true; return; } MP4DecodingMode actualMode = PVGetDecBitstreamMode(mHandle); if (mode != actualMode) { notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); mSignalledError = true; return; } PVSetPostProcType((VideoDecControls *) mHandle, 0); bool hasFrameData = false; if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { inInfo->mOwnedByUs = false; inQueue.erase(inQueue.begin()); inInfo = NULL; notifyEmptyBufferDone(inHeader); inHeader = NULL; } else if (volHeader) { hasFrameData = true; } mInitialized = true; if (mode == MPEG4_MODE && handlePortSettingsChange()) { return; } if (!hasFrameData) { continue; } } if (!mFramesConfigured) { PortInfo *port = editPortInfo(1); OMX_BUFFERHEADERTYPE *outHeader = port->mBuffers.editItemAt(1).mHeader; PVSetReferenceYUV(mHandle, outHeader->pBuffer); mFramesConfigured = true; } uint32_t useExtTimestamp = (inHeader->nOffset == 0); uint32_t timestamp = 0xFFFFFFFF; if (useExtTimestamp) { mPvToOmxTimeMap.add(mPvTime, inHeader->nTimeStamp); timestamp = mPvTime; mPvTime++; } int32_t bufferSize = inHeader->nFilledLen; int32_t tmp = bufferSize; if (PVDecodeVideoFrame( mHandle, &bitstream, ×tamp, &tmp, &useExtTimestamp, outHeader->pBuffer) != PV_TRUE) { ALOGE(""failed to decode video frame.""); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); mSignalledError = true; return; } if (handlePortSettingsChange()) { return; } outHeader->nTimeStamp = mPvToOmxTimeMap.valueFor(timestamp); mPvToOmxTimeMap.removeItem(timestamp); inHeader->nOffset += bufferSize; inHeader->nFilledLen = 0; if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { outHeader->nFlags = OMX_BUFFERFLAG_EOS; } else { outHeader->nFlags = 0; } if (inHeader->nFilledLen == 0) { inInfo->mOwnedByUs = false; inQueue.erase(inQueue.begin()); inInfo = NULL; notifyEmptyBufferDone(inHeader); inHeader = NULL; } ++mInputBufferCount; outHeader->nOffset = 0; outHeader->nFilledLen = (mWidth * mHeight * 3) / 2; List::iterator it = outQueue.begin(); while ((*it)->mHeader != outHeader) { ++it; } BufferInfo *outInfo = *it; outInfo->mOwnedByUs = false; outQueue.erase(it); outInfo = NULL; notifyFillBufferDone(outHeader); outHeader = NULL; ++mNumSamplesOutput; } } ",1 "void tims_del(GF_Box *s) { GF_TSHintEntryBox *tims = (GF_TSHintEntryBox *)s; gf_free(tims); } ",0 "static int __init ipsec_pfkey_init(void) { int err = proto_register(&key_proto, 0); if (err != 0) goto out; err = register_pernet_subsys(&pfkey_net_ops); if (err != 0) goto out_unregister_key_proto; err = sock_register(&pfkey_family_ops); if (err != 0) goto out_unregister_pernet; err = xfrm_register_km(&pfkeyv2_mgr); if (err != 0) goto out_sock_unregister; out: return err; out_sock_unregister: sock_unregister(PF_KEY); out_unregister_pernet: unregister_pernet_subsys(&pfkey_net_ops); out_unregister_key_proto: proto_unregister(&key_proto); goto out; } ",0 "read_eeprom (long ioaddr, int eep_addr) { int i = 1000; outw (EEP_READ | (eep_addr & 0xff), ioaddr + EepromCtrl); while (i-- > 0) { if (!(inw (ioaddr + EepromCtrl) & EEP_BUSY)) { return inw (ioaddr + EepromData); } } return 0; } ",0 "int yr_scan_verify_match( YR_SCAN_CONTEXT* context, YR_AC_MATCH* ac_match, uint8_t* data, size_t data_size, size_t data_base, size_t offset) { YR_STRING* string = ac_match->string; #ifdef PROFILING_ENABLED clock_t start = clock(); #endif if (data_size - offset <= 0) return ERROR_SUCCESS; if (context->flags & SCAN_FLAGS_FAST_MODE && STRING_IS_SINGLE_MATCH(string) && string->matches[context->tidx].head != NULL) return ERROR_SUCCESS; if (STRING_IS_FIXED_OFFSET(string) && string->fixed_offset != data_base + offset) return ERROR_SUCCESS; if (STRING_IS_LITERAL(string)) { FAIL_ON_ERROR(_yr_scan_verify_literal_match( context, ac_match, data, data_size, data_base, offset)); } else { FAIL_ON_ERROR(_yr_scan_verify_re_match( context, ac_match, data, data_size, data_base, offset)); } #ifdef PROFILING_ENABLED string->clock_ticks += clock() - start; #endif return ERROR_SUCCESS; } ",0 "void AuthenticatorSheetModelBase::OnCancel() { if (dialog_model()) dialog_model()->Cancel(); } ",0 "static int jas_icccurv_input(jas_iccattrval_t *attrval, jas_stream_t *in, int cnt) { jas_icccurv_t *curv = &attrval->data.curv; unsigned int i; curv->numents = 0; curv->ents = 0; if (jas_iccgetuint32(in, &curv->numents)) goto error; if (!(curv->ents = jas_alloc2(curv->numents, sizeof(jas_iccuint16_t)))) goto error; for (i = 0; i < curv->numents; ++i) { if (jas_iccgetuint16(in, &curv->ents[i])) goto error; } if (JAS_CAST(int, 4 + 2 * curv->numents) != cnt) goto error; return 0; error: jas_icccurv_destroy(attrval); return -1; } ",0 "static unsigned hid_lookup_collection(struct hid_parser *parser, unsigned type) { struct hid_collection *collection = parser->device->collection; int n; for (n = parser->collection_stack_ptr - 1; n >= 0; n--) { unsigned index = parser->collection_stack[n]; if (collection[index].type == type) return collection[index].usage; } return 0; /* we know nothing about this usage type */ } ",0 "void BassSetStrength(EffectContext *pContext, uint32_t strength){ pContext->pBundledContext->BassStrengthSaved = (int)strength; LVM_ControlParams_t ActiveParams; /* Current control Parameters */ LVM_ReturnStatus_en LvmStatus=LVM_SUCCESS; /* Function call status */ /* Get the current settings */ LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVM_GetControlParameters"", ""BassSetStrength"") /* Bass Enhancement parameters */ ActiveParams.BE_EffectLevel = (LVM_INT16)((15*strength)/1000); ActiveParams.BE_CentreFreq = LVM_BE_CENTRE_90Hz; /* Activate the initial settings */ LvmStatus = LVM_SetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVM_SetControlParameters"", ""BassSetStrength"") } /* end BassSetStrength */ ",0 "int dtls1_shutdown(SSL *s) { int ret; #ifndef OPENSSL_NO_SCTP if (BIO_dgram_is_sctp(SSL_get_wbio(s)) && !(s->shutdown & SSL_SENT_SHUTDOWN)) { ret = BIO_dgram_sctp_wait_for_dry(SSL_get_wbio(s)); if (ret < 0) return -1; if (ret == 0) BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN, 1, NULL); } #endif ret = ssl3_shutdown(s); #ifndef OPENSSL_NO_SCTP BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SCTP_SAVE_SHUTDOWN, 0, NULL); #endif return ret; } ",0 "isSuperUser( const char* user ) { if( ! (user)) { return false; } super_users.rewind(); char * next; while ((next = super_users.next())) { if (strcmp (user, next ) == 0) { return true; } } return false; } ",0 "void Document::open(Document* entered_document, ExceptionState& exception_state) { if (ImportLoader()) { exception_state.ThrowDOMException( kInvalidStateError, ""Imported document doesn't support open().""); return; } if (!IsHTMLDocument()) { exception_state.ThrowDOMException(kInvalidStateError, ""Only HTML documents support open().""); return; } if (throw_on_dynamic_markup_insertion_count_) { exception_state.ThrowDOMException( kInvalidStateError, ""Custom Element constructor should not use open().""); return; } if (entered_document) { if (!GetSecurityOrigin()->IsSameSchemeHostPortAndSuborigin( entered_document->GetSecurityOrigin())) { exception_state.ThrowSecurityError( ""Can only call open() on same-origin documents.""); return; } SetSecurityOrigin(entered_document->GetSecurityOrigin()); if (this != entered_document) { KURL new_url = entered_document->Url(); new_url.SetFragmentIdentifier(String()); SetURL(new_url); SetReferrerPolicy(entered_document->GetReferrerPolicy()); } cookie_url_ = entered_document->CookieURL(); } open(); } ",0 "int cap_inode_killpriv(struct dentry *dentry) { struct inode *inode = dentry->d_inode; if (!inode->i_op->removexattr) return 0; return inode->i_op->removexattr(dentry, XATTR_NAME_CAPS); } ",0 "void V8TestObject::derefObject(void* object) { fromInternalPointer(object)->deref(); } ",0 "static Image *ReadWEBPImage(const ImageInfo *image_info, ExceptionInfo *exception) { Image *image; int webp_status; MagickBooleanType status; register unsigned char *p; size_t length; ssize_t count, y; unsigned char header[12], *stream; WebPDecoderConfig configure; WebPDecBuffer *restrict webp_image = &configure.output; WebPBitstreamFeatures *restrict features = &configure.input; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } if (WebPInitDecoderConfig(&configure) == 0) ThrowReaderException(ResourceLimitError,""UnableToDecodeImageFile""); webp_image->colorspace=MODE_RGBA; count=ReadBlob(image,12,header); if (count != 12) ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); status=IsWEBP(header,count); if (status == MagickFalse) ThrowReaderException(CorruptImageError,""CorruptImage""); length=(size_t) (ReadWebPLSBWord(header+4)+8); if (length < 12) ThrowReaderException(CorruptImageError,""CorruptImage""); stream=(unsigned char *) AcquireQuantumMemory(length,sizeof(*stream)); if (stream == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); (void) memcpy(stream,header,12); count=ReadBlob(image,length-12,stream+12); if (count != (ssize_t) (length-12)) ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); webp_status=WebPGetFeatures(stream,length,features); if (webp_status == VP8_STATUS_OK) { image->columns=(size_t) features->width; image->rows=(size_t) features->height; image->depth=8; image->matte=features->has_alpha != 0 ? MagickTrue : MagickFalse; if (IsWEBPImageLossless(stream,length) != MagickFalse) image->quality=100; if (image_info->ping != MagickFalse) { stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(GetFirstImageInList(image)); } webp_status=WebPDecode(stream,length,&configure); } if (webp_status != VP8_STATUS_OK) { stream=(unsigned char*) RelinquishMagickMemory(stream); switch (webp_status) { case VP8_STATUS_OUT_OF_MEMORY: { ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); break; } case VP8_STATUS_INVALID_PARAM: { ThrowReaderException(CorruptImageError,""invalid parameter""); break; } case VP8_STATUS_BITSTREAM_ERROR: { ThrowReaderException(CorruptImageError,""CorruptImage""); break; } case VP8_STATUS_UNSUPPORTED_FEATURE: { ThrowReaderException(CoderError,""DataEncodingSchemeIsNotSupported""); break; } case VP8_STATUS_SUSPENDED: { ThrowReaderException(CorruptImageError,""decoder suspended""); break; } case VP8_STATUS_USER_ABORT: { ThrowReaderException(CorruptImageError,""user abort""); break; } case VP8_STATUS_NOT_ENOUGH_DATA: { ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); break; } default: ThrowReaderException(CorruptImageError,""CorruptImage""); } } p=(unsigned char *) webp_image->u.RGBA.rgba; for (y=0; y < (ssize_t) image->rows; y++) { register PixelPacket *q; register ssize_t x; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ScaleCharToQuantum(*p++)); SetPixelGreen(q,ScaleCharToQuantum(*p++)); SetPixelBlue(q,ScaleCharToQuantum(*p++)); SetPixelAlpha(q,ScaleCharToQuantum(*p++)); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } WebPFreeDecBuffer(webp_image); stream=(unsigned char*) RelinquishMagickMemory(stream); return(image); } ",1 "bool OmniboxViewWin::CanPasteAndGo(const string16& text) const { return !popup_window_mode_ && model_->CanPasteAndGo(text); } ",0 "cib_notify_client(gpointer key, gpointer value, gpointer user_data) { const char *type = NULL; gboolean do_send = FALSE; cib_client_t *client = value; xmlNode *update_msg = user_data; CRM_CHECK(client != NULL, return TRUE); CRM_CHECK(update_msg != NULL, return TRUE); if (client->ipc == NULL) { crm_warn(""Skipping client with NULL channel""); return FALSE; } type = crm_element_value(update_msg, F_SUBTYPE); CRM_LOG_ASSERT(type != NULL); if (client->diffs && safe_str_eq(type, T_CIB_DIFF_NOTIFY)) { do_send = TRUE; } else if (client->replace && safe_str_eq(type, T_CIB_REPLACE_NOTIFY)) { do_send = TRUE; } else if (client->confirmations && safe_str_eq(type, T_CIB_UPDATE_CONFIRM)) { do_send = TRUE; } else if (client->pre_notify && safe_str_eq(type, T_CIB_PRE_NOTIFY)) { do_send = TRUE; } else if (client->post_notify && safe_str_eq(type, T_CIB_POST_NOTIFY)) { do_send = TRUE; } if (do_send) { if (client->ipc) { if(crm_ipcs_send(client->ipc, 0, update_msg, TRUE) == FALSE) { crm_warn(""Notification of client %s/%s failed"", client->name, client->id); } #ifdef HAVE_GNUTLS_GNUTLS_H } else if (client->session) { crm_debug(""Sent %s notification to client %s/%s"", type, client->name, client->id); crm_send_remote_msg(client->session, update_msg, client->encrypted); #endif } else { crm_err(""Unknown transport for %s"", client->name); } } return FALSE; } ",1 " void HTMLStyleElement::ChildrenChanged(const ChildrenChange& change) { HTMLElement::ChildrenChanged(change); if (StyleElement::ChildrenChanged(*this) == StyleElement::kProcessingFatalError) NotifyLoadedSheetAndAllCriticalSubresources( kErrorOccurredLoadingSubresource); } ",0 "bool TabStripModel::IsAppTab(int index) const { TabContentsWrapper* contents = GetTabContentsAt(index); return contents && contents->extension_tab_helper()->is_app(); } ",0 "htmlNewParserCtxt(void) { xmlParserCtxtPtr ctxt; ctxt = (xmlParserCtxtPtr) xmlMalloc(sizeof(xmlParserCtxt)); if (ctxt == NULL) { htmlErrMemory(NULL, ""NewParserCtxt: out of memory\n""); return(NULL); } memset(ctxt, 0, sizeof(xmlParserCtxt)); if (htmlInitParserCtxt(ctxt) < 0) { htmlFreeParserCtxt(ctxt); return(NULL); } return(ctxt); } ",0 "void OutOfProcessInstance::IsSelectingChanged(bool is_selecting) { pp::VarDictionary message; message.Set(kType, kJSSetIsSelectingType); message.Set(kJSIsSelecting, pp::Var(is_selecting)); PostMessage(message); } ",0 "void GLES2DecoderImpl::DoTexImageIOSurface2DCHROMIUM( GLenum target, GLsizei width, GLsizei height, GLuint io_surface_id, GLuint plane) { #if defined(OS_MACOSX) if (gfx::GetGLImplementation() != gfx::kGLImplementationDesktopGL) { SetGLError( GL_INVALID_OPERATION, ""glTexImageIOSurface2DCHROMIUM"", ""only supported on desktop GL.""); return; } IOSurfaceSupport* surface_support = IOSurfaceSupport::Initialize(); if (!surface_support) { SetGLError(GL_INVALID_OPERATION, ""glTexImageIOSurface2DCHROMIUM"", ""only supported on 10.6.""); return; } if (target != GL_TEXTURE_RECTANGLE_ARB) { SetGLError( GL_INVALID_OPERATION, ""glTexImageIOSurface2DCHROMIUM"", ""requires TEXTURE_RECTANGLE_ARB target""); return; } TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); if (!info) { SetGLError(GL_INVALID_OPERATION, ""glTexImageIOSurface2DCHROMIUM"", ""no rectangle texture bound""); return; } if (info == texture_manager()->GetDefaultTextureInfo(target)) { SetGLError(GL_INVALID_OPERATION, ""glTexImageIOSurface2DCHROMIUM"", ""can't bind default texture""); return; } CFTypeRef surface = surface_support->IOSurfaceLookup(io_surface_id); if (!surface) { SetGLError( GL_INVALID_OPERATION, ""glTexImageIOSurface2DCHROMIUM"", ""no IOSurface with the given ID""); return; } ReleaseIOSurfaceForTexture(info->service_id()); texture_to_io_surface_map_.insert( std::make_pair(info->service_id(), surface)); CGLContextObj context = static_cast(context_->GetHandle()); CGLError err = surface_support->CGLTexImageIOSurface2D( context, target, GL_RGBA, width, height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, surface, plane); if (err != kCGLNoError) { SetGLError( GL_INVALID_OPERATION, ""glTexImageIOSurface2DCHROMIUM"", ""error in CGLTexImageIOSurface2D""); return; } texture_manager()->SetLevelInfo( info, target, 0, GL_RGBA, width, height, 1, 0, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV, true); #else SetGLError(GL_INVALID_OPERATION, ""glTexImageIOSurface2DCHROMIUM"", ""not supported.""); #endif } ",0 "static void release_maps(struct bpf_verifier_env *env) { int i; for (i = 0; i < env->used_map_cnt; i++) bpf_map_put(env->used_maps[i]); } ",0 " static uint32_t encode(uint32_t value) { if (value & (1U << 31)) value = ((~value) << 1) + 1; else value <<= 1; return value; } ",0 "gc_start(mrb_state *mrb, mrb_value obj) { mrb_full_gc(mrb); return mrb_nil_value(); } ",0 "ofport_install(struct ofproto *p, struct netdev *netdev, const struct ofputil_phy_port *pp) { const char *netdev_name = netdev_get_name(netdev); struct ofport *ofport; int error; /* Create ofport. */ ofport = p->ofproto_class->port_alloc(); if (!ofport) { error = ENOMEM; goto error; } ofport->ofproto = p; ofport->netdev = netdev; ofport->change_seq = netdev_get_change_seq(netdev); ofport->pp = *pp; ofport->ofp_port = pp->port_no; ofport->created = time_msec(); /* Add port to 'p'. */ hmap_insert(&p->ports, &ofport->hmap_node, hash_ofp_port(ofport->ofp_port)); shash_add(&p->port_by_name, netdev_name, ofport); update_mtu(p, ofport); /* Let the ofproto_class initialize its private data. */ error = p->ofproto_class->port_construct(ofport); if (error) { goto error; } connmgr_send_port_status(p->connmgr, NULL, pp, OFPPR_ADD); return 0; error: VLOG_WARN_RL(&rl, ""%s: could not add port %s (%s)"", p->name, netdev_name, ovs_strerror(error)); if (ofport) { ofport_destroy__(ofport); } else { netdev_close(netdev); } return error; } ",0 "int do_get_thread_area(struct task_struct *p, int idx, struct user_desc __user *u_info) { struct user_desc info; if (idx == -1 && get_user(idx, &u_info->entry_number)) return -EFAULT; if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) return -EINVAL; fill_user_desc(&info, idx, &p->thread.tls_array[idx - GDT_ENTRY_TLS_MIN]); if (copy_to_user(u_info, &info, sizeof(info))) return -EFAULT; return 0; } ",0 "void RenderFrameImpl::RunModalAlertDialog(const blink::WebString& message) { RunJavaScriptDialog(JAVASCRIPT_DIALOG_TYPE_ALERT, message.Utf16(), base::string16(), frame_->GetDocument().Url(), nullptr); } ",0 "bool PrintWebViewHelper::UpdatePrintSettings( blink::WebLocalFrame* frame, const blink::WebNode& node, const base::DictionaryValue& passed_job_settings) { const base::DictionaryValue* job_settings = &passed_job_settings; base::DictionaryValue modified_job_settings; if (job_settings->empty()) { if (!print_for_preview_) print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); return false; } bool source_is_html = true; if (print_for_preview_) { if (!job_settings->GetBoolean(kSettingPreviewModifiable, &source_is_html)) { NOTREACHED(); } } else { source_is_html = !PrintingNodeOrPdfFrame(frame, node); } if (print_for_preview_ || !source_is_html) { modified_job_settings.MergeDictionary(job_settings); modified_job_settings.SetBoolean(kSettingHeaderFooterEnabled, false); modified_job_settings.SetInteger(kSettingMarginsType, NO_MARGINS); job_settings = &modified_job_settings; } int cookie = print_pages_params_ ? print_pages_params_->params.document_cookie : 0; PrintMsg_PrintPages_Params settings; bool canceled = false; Send(new PrintHostMsg_UpdatePrintSettings(routing_id(), cookie, *job_settings, &settings, &canceled)); if (canceled) { notify_browser_of_print_failure_ = false; return false; } if (!job_settings->GetInteger(kPreviewUIID, &settings.params.preview_ui_id)) { NOTREACHED(); print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); return false; } if (!print_for_preview_) { if (!job_settings->GetInteger(kPreviewRequestID, &settings.params.preview_request_id) || !job_settings->GetBoolean(kIsFirstRequest, &settings.params.is_first_request)) { NOTREACHED(); print_preview_context_.set_error(PREVIEW_ERROR_BAD_SETTING); return false; } settings.params.print_to_pdf = IsPrintToPdfRequested(*job_settings); UpdateFrameMarginsCssInfo(*job_settings); settings.params.print_scaling_option = GetPrintScalingOption( frame, node, source_is_html, *job_settings, settings.params); } SetPrintPagesParams(settings); if (!PrintMsg_Print_Params_IsValid(settings.params)) { if (!print_for_preview_) print_preview_context_.set_error(PREVIEW_ERROR_INVALID_PRINTER_SETTINGS); else Send(new PrintHostMsg_ShowInvalidPrinterSettingsError(routing_id())); return false; } return true; } ",0 "void PrintRenderFrameHelper::UpdateFrameMarginsCssInfo( const base::DictionaryValue& settings) { int margins_type = 0; if (!settings.GetInteger(kSettingMarginsType, &margins_type)) margins_type = DEFAULT_MARGINS; ignore_css_margins_ = (margins_type != DEFAULT_MARGINS); } ",0 " static int jas_iccgetuint64(jas_stream_t *in, jas_iccuint64_t *val) { ulonglong tmp; if (jas_iccgetuint(in, 8, &tmp)) return -1; *val = tmp; return 0; } ",1 "VisibleSelection Editor::SelectionForCommand(Event* event) { VisibleSelection selection = GetFrame().Selection().ComputeVisibleSelectionInDOMTree(); if (!event) return selection; TextControlElement* text_control_of_selection_start = EnclosingTextControl(selection.Start()); TextControlElement* text_control_of_target = IsTextControlElement(*event->target()->ToNode()) ? ToTextControlElement(event->target()->ToNode()) : nullptr; if (text_control_of_target && (selection.Start().IsNull() || text_control_of_target != text_control_of_selection_start)) { const SelectionInDOMTree& select = text_control_of_target->Selection(); if (!select.IsNone()) return CreateVisibleSelection(select); } return selection; } ",0 "struct hsr_node *hsr_add_node(struct list_head *node_db, unsigned char addr[], u16 seq_out) { struct hsr_node *node; unsigned long now; int i; node = kzalloc(sizeof(*node), GFP_ATOMIC); if (!node) return NULL; ether_addr_copy(node->MacAddressA, addr); /* We are only interested in time diffs here, so use current jiffies * as initialization. (0 could trigger an spurious ring error warning). */ now = jiffies; for (i = 0; i < HSR_PT_PORTS; i++) node->time_in[i] = now; for (i = 0; i < HSR_PT_PORTS; i++) node->seq_out[i] = seq_out; list_add_tail_rcu(&node->mac_list, node_db); return node; } ",0 "nodePush(xmlParserCtxtPtr ctxt, xmlNodePtr value) { if (ctxt == NULL) return(0); if (ctxt->nodeNr >= ctxt->nodeMax) { xmlNodePtr *tmp; tmp = (xmlNodePtr *) xmlRealloc(ctxt->nodeTab, ctxt->nodeMax * 2 * sizeof(ctxt->nodeTab[0])); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); return (-1); } ctxt->nodeTab = tmp; ctxt->nodeMax *= 2; } if ((((unsigned int) ctxt->nodeNr) > xmlParserMaxDepth) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErrMsgInt(ctxt, XML_ERR_INTERNAL_ERROR, ""Excessive depth in document: %d use XML_PARSE_HUGE option\n"", xmlParserMaxDepth); xmlHaltParser(ctxt); return(-1); } ctxt->nodeTab[ctxt->nodeNr] = value; ctxt->node = value; return (ctxt->nodeNr++); } ",0 "int XMLRPC_GetValueStringLen(XMLRPC_VALUE value) { return ((value) ? value->str.len : 0); } ",0 "static int h263p_decode_umotion(MpegEncContext * s, int pred) { int code = 0, sign; if (get_bits1(&s->gb)) /* Motion difference = 0 */ return pred; code = 2 + get_bits1(&s->gb); while (get_bits1(&s->gb)) { code <<= 1; code += get_bits1(&s->gb); } sign = code & 1; code >>= 1; code = (sign) ? (pred - code) : (pred + code); ff_dlog(s->avctx,""H.263+ UMV Motion = %d\n"", code); return code; } ",0 "static int may_o_create(const struct path *dir, struct dentry *dentry, umode_t mode) { struct user_namespace *s_user_ns; int error = security_path_mknod(dir, dentry, mode, 0); if (error) return error; s_user_ns = dir->dentry->d_sb->s_user_ns; if (!kuid_has_mapping(s_user_ns, current_fsuid()) || !kgid_has_mapping(s_user_ns, current_fsgid())) return -EOVERFLOW; error = inode_permission(dir->dentry->d_inode, MAY_WRITE | MAY_EXEC); if (error) return error; return security_inode_create(dir->dentry->d_inode, dentry, mode); } ",0 "force_removal (Device *device, ForceRemovalCompleteFunc callback, gpointer user_data) { /* Device is going bye bye. If this device is * * - Mounted by us, then forcibly unmount it. * * - If it's a luks device, check if there's cleartext * companion. If so, tear it down if it was setup by us. * */ if (device->priv->device_is_mounted && device->priv->device_mount_paths->len > 0) { gboolean remove_dir_on_unmount; if (mount_file_has_device (device->priv->device_file, NULL, &remove_dir_on_unmount) || is_device_in_fstab (device, NULL)) { g_print (""**** NOTE: Force unmounting device %s\n"", device->priv->device_file); force_unmount (device, callback, user_data); goto pending; } } if (device->priv->id_usage != NULL && strcmp (device->priv->id_usage, ""crypto"") == 0) { GList *devices; GList *l; /* look for cleartext device */ devices = daemon_local_get_all_devices (device->priv->daemon); for (l = devices; l != NULL; l = l->next) { Device *d = DEVICE (l->data); if (d->priv->device_is_luks_cleartext && d->priv->luks_cleartext_slave != NULL && strcmp (d->priv->luks_cleartext_slave, device->priv->object_path) == 0) { /* Check whether it is set up by us */ if (d->priv->dm_name != NULL && g_str_has_prefix (d->priv->dm_name, ""udisks-luks-uuid-"")) { g_print (""**** NOTE: Force luks teardown device %s (cleartext %s)\n"", device->priv->device_file, d->priv->device_file); /* Gotcha */ force_luks_teardown (device, d, callback, user_data); goto pending; } } } } /* nothing to force remove */ if (callback != NULL) callback (device, TRUE, user_data); pending: ; } ",0 "GahpClient::condor_job_stage_out(const char *schedd_name, PROC_ID job_id) { static const char* command = ""CONDOR_JOB_STAGE_OUT""; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!schedd_name) schedd_name=NULLSTRING; std::string reqline; char *esc1 = strdup( escapeGahpString(schedd_name) ); int x = sprintf(reqline, ""%s %d.%d"", esc1, job_id.cluster, job_id.proc); free( esc1 ); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,deleg_proxy); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { if (result->argc != 3) { EXCEPT(""Bad %s Result"",command); } int rc = 1; if ( result->argv[1][0] == 'S' ) { rc = 0; } if ( strcasecmp(result->argv[2], NULLSTRING) ) { error_string = result->argv[2]; } else { error_string = """"; } delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 "static int mboxlist_find_category(struct find_rock *rock, const char *prefix, size_t len) { int r = 0; if (!rock->issubs && !rock->isadmin && !cyrusdb_fetch(rock->db, ""$RACL"", 5, NULL, NULL, NULL)) { /* we're using reverse ACLs */ struct buf buf = BUF_INITIALIZER; strarray_t matches = STRARRAY_INITIALIZER; mboxlist_racl_key(rock->mb_category == MBNAME_OTHERUSER, rock->userid, NULL, &buf); /* this is the prefix */ struct raclrock raclrock = { buf.len, &matches }; /* we only need to look inside the prefix still, but we keep the length * in raclrock pointing to the start of the mboxname part of the key so * we get correct names in matches */ if (len) buf_appendmap(&buf, prefix, len); r = cyrusdb_foreach(rock->db, buf.s, buf.len, NULL, racl_cb, &raclrock, NULL); /* XXX - later we need to sort the array when we've added groups */ int i; for (i = 0; !r && i < strarray_size(&matches); i++) { const char *key = strarray_nth(&matches, i); r = cyrusdb_forone(rock->db, key, strlen(key), &find_p, &find_cb, rock, NULL); } strarray_fini(&matches); } else { r = cyrusdb_foreach(rock->db, prefix, len, &find_p, &find_cb, rock, NULL); } if (r == CYRUSDB_DONE) r = 0; return r; } ",0 "void RenderFrameImpl::OnCopyImageAt(int x, int y) { blink::WebFloatRect viewport_position(x, y, 0, 0); GetLocalRootRenderWidget()->ConvertWindowToViewport(&viewport_position); frame_->CopyImageAt(WebPoint(viewport_position.x, viewport_position.y)); } ",0 "static int ctdb_tcp_listen_automatic(struct ctdb_context *ctdb) { struct ctdb_tcp *ctcp = talloc_get_type(ctdb->private_data, struct ctdb_tcp); ctdb_sock_addr sock; int lock_fd, i; const char *lock_path = ""/tmp/.ctdb_socket_lock""; struct flock lock; int one = 1; int sock_size; struct tevent_fd *fde; /* If there are no nodes, then it won't be possible to find * the first one. Log a failure and short circuit the whole * process. */ if (ctdb->num_nodes == 0) { DEBUG(DEBUG_CRIT,(""No nodes available to attempt bind to - is the nodes file empty?\n"")); return -1; } /* in order to ensure that we don't get two nodes with the same adddress, we must make the bind() and listen() calls atomic. The SO_REUSEADDR setsockopt only prevents double binds if the first socket is in LISTEN state */ lock_fd = open(lock_path, O_RDWR|O_CREAT, 0666); if (lock_fd == -1) { DEBUG(DEBUG_CRIT,(""Unable to open %s\n"", lock_path)); return -1; } lock.l_type = F_WRLCK; lock.l_whence = SEEK_SET; lock.l_start = 0; lock.l_len = 1; lock.l_pid = 0; if (fcntl(lock_fd, F_SETLKW, &lock) != 0) { DEBUG(DEBUG_CRIT,(""Unable to lock %s\n"", lock_path)); close(lock_fd); return -1; } for (i=0; i < ctdb->num_nodes; i++) { if (ctdb->nodes[i]->flags & NODE_FLAGS_DELETED) { continue; } ZERO_STRUCT(sock); if (ctdb_tcp_get_address(ctdb, ctdb->nodes[i]->address.address, &sock) != 0) { continue; } switch (sock.sa.sa_family) { case AF_INET: sock.ip.sin_port = htons(ctdb->nodes[i]->address.port); sock_size = sizeof(sock.ip); break; case AF_INET6: sock.ip6.sin6_port = htons(ctdb->nodes[i]->address.port); sock_size = sizeof(sock.ip6); break; default: DEBUG(DEBUG_ERR, (__location__ "" unknown family %u\n"", sock.sa.sa_family)); continue; } #ifdef HAVE_SOCK_SIN_LEN sock.ip.sin_len = sock_size; #endif ctcp->listen_fd = socket(sock.sa.sa_family, SOCK_STREAM, IPPROTO_TCP); if (ctcp->listen_fd == -1) { ctdb_set_error(ctdb, ""socket failed\n""); continue; } set_close_on_exec(ctcp->listen_fd); setsockopt(ctcp->listen_fd,SOL_SOCKET,SO_REUSEADDR,(char *)&one,sizeof(one)); if (bind(ctcp->listen_fd, (struct sockaddr * )&sock, sock_size) == 0) { break; } if (errno == EADDRNOTAVAIL) { DEBUG(DEBUG_DEBUG,(__location__ "" Failed to bind() to socket. %s(%d)\n"", strerror(errno), errno)); } else { DEBUG(DEBUG_ERR,(__location__ "" Failed to bind() to socket. %s(%d)\n"", strerror(errno), errno)); } } if (i == ctdb->num_nodes) { DEBUG(DEBUG_CRIT,(""Unable to bind to any of the node addresses - giving up\n"")); goto failed; } ctdb->address.address = talloc_strdup(ctdb, ctdb->nodes[i]->address.address); ctdb->address.port = ctdb->nodes[i]->address.port; ctdb->name = talloc_asprintf(ctdb, ""%s:%u"", ctdb->address.address, ctdb->address.port); ctdb->pnn = ctdb->nodes[i]->pnn; DEBUG(DEBUG_INFO,(""ctdb chose network address %s:%u pnn %u\n"", ctdb->address.address, ctdb->address.port, ctdb->pnn)); if (listen(ctcp->listen_fd, 10) == -1) { goto failed; } fde = event_add_fd(ctdb->ev, ctcp, ctcp->listen_fd, EVENT_FD_READ, ctdb_listen_event, ctdb); tevent_fd_set_auto_close(fde); close(lock_fd); return 0; failed: close(lock_fd); close(ctcp->listen_fd); ctcp->listen_fd = -1; return -1; } ",1 "static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { return glue_ecb_crypt_128bit(&twofish_dec, desc, dst, src, nbytes); } ",0 "void Browser::CloseFrame() { window_->Close(); } ",0 "flatpak_proxy_client_finalize (GObject *object) { FlatpakProxyClient *client = FLATPAK_PROXY_CLIENT (object); client->proxy->clients = g_list_remove (client->proxy->clients, client); g_clear_object (&client->proxy); g_hash_table_destroy (client->rewrite_reply); g_hash_table_destroy (client->get_owner_reply); g_hash_table_destroy (client->unique_id_policy); free_side (&client->client_side); free_side (&client->bus_side); G_OBJECT_CLASS (flatpak_proxy_client_parent_class)->finalize (object); } ",1 "int skb_append_pagefrags(struct sk_buff *skb, struct page *page, int offset, size_t size) { int i = skb_shinfo(skb)->nr_frags; if (skb_can_coalesce(skb, i, page, offset)) { skb_frag_size_add(&skb_shinfo(skb)->frags[i - 1], size); } else if (i < MAX_SKB_FRAGS) { get_page(page); skb_fill_page_desc(skb, i, page, offset, size); } else { return -EMSGSIZE; } return 0; } ",0 "void WebGL2RenderingContextBase::uniformMatrix3fv( const WebGLUniformLocation* location, GLboolean transpose, MaybeShared v) { WebGLRenderingContextBase::uniformMatrix3fv(location, transpose, v); } ",0 "void ScrollableShelfView::Init() { shelf_view_->Init(); SetPaintToLayer(); layer()->SetFillsBoundsOpaquely(false); left_arrow_ = AddChildView(std::make_unique( ScrollArrowView::kLeft, GetShelf()->IsHorizontalAlignment(), GetShelf(), this)); right_arrow_ = AddChildView(std::make_unique( ScrollArrowView::kRight, GetShelf()->IsHorizontalAlignment(), GetShelf(), this)); shelf_container_view_ = AddChildView(std::make_unique(shelf_view_)); shelf_container_view_->Initialize(); gradient_layer_delegate_ = std::make_unique(); layer()->SetMaskLayer(gradient_layer_delegate_->layer()); focus_search_ = std::make_unique(this); GetShelf()->tooltip()->set_shelf_tooltip_delegate(shelf_view_); } ",0 "static inline u64 global_rt_period(void) { return (u64)sysctl_sched_rt_period * NSEC_PER_USEC; } ",0 "void Document::updateFocusAppearanceSoon(bool restorePreviousSelection) { m_updateFocusAppearanceRestoresSelection = restorePreviousSelection; if (!m_updateFocusAppearanceTimer.isActive()) m_updateFocusAppearanceTimer.startOneShot(0, FROM_HERE); } ",0 "static Image *ReadRLEImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define SkipLinesOp 0x01 #define SetColorOp 0x02 #define SkipPixelsOp 0x03 #define ByteDataOp 0x05 #define RunDataOp 0x06 #define EOFOp 0x07 char magick[12]; Image *image; IndexPacket index; int opcode, operand, status; MagickStatusType flags; MagickSizeType number_pixels; MemoryInfo *pixel_info; register IndexPacket *indexes; register ssize_t x; register PixelPacket *q; register ssize_t i; register unsigned char *p; size_t bits_per_pixel, map_length, number_colormaps, number_planes, number_planes_filled, one, offset, pixel_info_length; ssize_t count, y; unsigned char background_color[256], *colormap, pixel, plane, *pixels; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) return(DestroyImageList(image)); /* Determine if this a RLE file. */ count=ReadBlob(image,2,(unsigned char *) magick); if ((count != 2) || (memcmp(magick,""\122\314"",2) != 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); do { /* Read image header. */ image->page.x=ReadBlobLSBShort(image); image->page.y=ReadBlobLSBShort(image); image->columns=ReadBlobLSBShort(image); image->rows=ReadBlobLSBShort(image); flags=(MagickStatusType) ReadBlobByte(image); image->matte=flags & 0x04 ? MagickTrue : MagickFalse; number_planes=(size_t) ReadBlobByte(image); bits_per_pixel=(size_t) ReadBlobByte(image); number_colormaps=(size_t) ReadBlobByte(image); map_length=(unsigned char) ReadBlobByte(image); if (map_length >= 32) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); one=1; map_length=one << map_length; if ((number_planes == 0) || (number_planes == 2) || ((flags & 0x04) && (number_colormaps > 254)) || (bits_per_pixel != 8) || (image->columns == 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (flags & 0x02) { /* No background color-- initialize to black. */ for (i=0; i < (ssize_t) number_planes; i++) background_color[i]=0; (void) ReadBlobByte(image); } else { /* Initialize background color. */ p=background_color; for (i=0; i < (ssize_t) number_planes; i++) *p++=(unsigned char) ReadBlobByte(image); } if ((number_planes & 0x01) == 0) (void) ReadBlobByte(image); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); break; } colormap=(unsigned char *) NULL; if (number_colormaps != 0) { /* Read image colormaps. */ colormap=(unsigned char *) AcquireQuantumMemory(number_colormaps, 3*map_length*sizeof(*colormap)); if (colormap == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); p=colormap; for (i=0; i < (ssize_t) number_colormaps; i++) for (x=0; x < (ssize_t) map_length; x++) *p++=(unsigned char) ScaleShortToQuantum(ReadBlobLSBShort(image)); } if ((flags & 0x08) != 0) { char *comment; size_t length; /* Read image comment. */ length=ReadBlobLSBShort(image); if (length != 0) { comment=(char *) AcquireQuantumMemory(length,sizeof(*comment)); if (comment == (char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); (void) ReadBlob(image,length-1,(unsigned char *) comment); comment[length-1]='\0'; (void) SetImageProperty(image,""comment"",comment); comment=DestroyString(comment); if ((length & 0x01) == 0) (void) ReadBlobByte(image); } } if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } /* Allocate RLE pixels. */ if (image->matte != MagickFalse) number_planes++; number_pixels=(MagickSizeType) image->columns*image->rows; number_planes_filled=(number_planes % 2 == 0) ? number_planes : number_planes+1; if ((number_pixels*number_planes_filled) != (size_t) (number_pixels* number_planes_filled)) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); pixel_info=AcquireVirtualMemory(image->columns,image->rows* number_planes_filled*sizeof(*pixels)); if (pixel_info == (MemoryInfo *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); pixel_info_length=image->columns*image->rows*number_planes_filled; pixels=(unsigned char *) GetVirtualMemoryBlob(pixel_info); if ((flags & 0x01) && !(flags & 0x02)) { ssize_t j; /* Set background color. */ p=pixels; for (i=0; i < (ssize_t) number_pixels; i++) { if (image->matte == MagickFalse) for (j=0; j < (ssize_t) number_planes; j++) *p++=background_color[j]; else { for (j=0; j < (ssize_t) (number_planes-1); j++) *p++=background_color[j]; *p++=0; /* initialize matte channel */ } } } /* Read runlength-encoded image. */ plane=0; x=0; y=0; opcode=ReadBlobByte(image); do { switch (opcode & 0x3f) { case SkipLinesOp: { operand=ReadBlobByte(image); if (opcode & 0x40) operand=ReadBlobLSBSignedShort(image); x=0; y+=operand; break; } case SetColorOp: { operand=ReadBlobByte(image); plane=(unsigned char) operand; if (plane == 255) plane=(unsigned char) (number_planes-1); x=0; break; } case SkipPixelsOp: { operand=ReadBlobByte(image); if (opcode & 0x40) operand=ReadBlobLSBSignedShort(image); x+=operand; break; } case ByteDataOp: { operand=ReadBlobByte(image); if (opcode & 0x40) operand=ReadBlobLSBSignedShort(image); offset=((image->rows-y-1)*image->columns*number_planes)+x* number_planes+plane; operand++; if (offset+((size_t) operand*number_planes) > pixel_info_length) { if (number_colormaps != 0) colormap=(unsigned char *) RelinquishMagickMemory(colormap); pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError,""UnableToReadImageData""); } p=pixels+offset; for (i=0; i < (ssize_t) operand; i++) { pixel=(unsigned char) ReadBlobByte(image); if ((y < (ssize_t) image->rows) && ((x+i) < (ssize_t) image->columns)) *p=pixel; p+=number_planes; } if (operand & 0x01) (void) ReadBlobByte(image); x+=operand; break; } case RunDataOp: { operand=ReadBlobByte(image); if (opcode & 0x40) operand=ReadBlobLSBSignedShort(image); pixel=(unsigned char) ReadBlobByte(image); (void) ReadBlobByte(image); operand++; offset=((image->rows-y-1)*image->columns*number_planes)+x* number_planes+plane; p=pixels+offset; if (offset+((size_t) operand*number_planes) > pixel_info_length) { if (number_colormaps != 0) colormap=(unsigned char *) RelinquishMagickMemory(colormap); pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError,""UnableToReadImageData""); } for (i=0; i < (ssize_t) operand; i++) { if ((y < (ssize_t) image->rows) && ((x+i) < (ssize_t) image->columns)) *p=pixel; p+=number_planes; } x+=operand; break; } default: break; } opcode=ReadBlobByte(image); } while (((opcode & 0x3f) != EOFOp) && (opcode != EOF)); if (number_colormaps != 0) { MagickStatusType mask; /* Apply colormap affineation to image. */ mask=(MagickStatusType) (map_length-1); p=pixels; x=(ssize_t) number_planes; if (number_colormaps == 1) for (i=0; i < (ssize_t) number_pixels; i++) { if (IsValidColormapIndex(image,*p & mask,&index,exception) == MagickFalse) break; *p=colormap[(ssize_t) index]; p++; } else if ((number_planes >= 3) && (number_colormaps >= 3)) for (i=0; i < (ssize_t) number_pixels; i++) for (x=0; x < (ssize_t) number_planes; x++) { if (IsValidColormapIndex(image,(size_t) (x*map_length+ (*p & mask)),&index,exception) == MagickFalse) break; *p=colormap[(ssize_t) index]; p++; } if ((i < (ssize_t) number_pixels) || (x < (ssize_t) number_planes)) { colormap=(unsigned char *) RelinquishMagickMemory(colormap); pixel_info=RelinquishVirtualMemory(pixel_info); ThrowReaderException(CorruptImageError,""UnableToReadImageData""); } } /* Initialize image structure. */ if (number_planes >= 3) { /* Convert raster image to DirectClass pixel packets. */ p=pixels; for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ScaleCharToQuantum(*p++)); SetPixelGreen(q,ScaleCharToQuantum(*p++)); SetPixelBlue(q,ScaleCharToQuantum(*p++)); if (image->matte != MagickFalse) SetPixelAlpha(q,ScaleCharToQuantum(*p++)); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } } else { /* Create colormap. */ if (number_colormaps == 0) map_length=256; if (AcquireImageColormap(image,map_length) == MagickFalse) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); p=colormap; if (number_colormaps == 1) for (i=0; i < (ssize_t) image->colors; i++) { /* Pseudocolor. */ image->colormap[i].red=ScaleCharToQuantum((unsigned char) i); image->colormap[i].green=ScaleCharToQuantum((unsigned char) i); image->colormap[i].blue=ScaleCharToQuantum((unsigned char) i); } else if (number_colormaps > 1) for (i=0; i < (ssize_t) image->colors; i++) { image->colormap[i].red=ScaleCharToQuantum(*p); image->colormap[i].green=ScaleCharToQuantum(*(p+map_length)); image->colormap[i].blue=ScaleCharToQuantum(*(p+map_length*2)); p++; } p=pixels; if (image->matte == MagickFalse) { /* Convert raster image to PseudoClass pixel packets. */ for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) SetPixelIndex(indexes+x,*p++); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } (void) SyncImage(image); } else { /* Image has a matte channel-- promote to DirectClass. */ for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { if (IsValidColormapIndex(image,*p++,&index,exception) == MagickFalse) break; SetPixelRed(q,image->colormap[(ssize_t) index].red); if (IsValidColormapIndex(image,*p++,&index,exception) == MagickFalse) break; SetPixelGreen(q,image->colormap[(ssize_t) index].green); if (IsValidColormapIndex(image,*p++,&index,exception) == MagickFalse) break; SetPixelBlue(q,image->colormap[(ssize_t) index].blue); SetPixelAlpha(q,ScaleCharToQuantum(*p++)); q++; } if (x < (ssize_t) image->columns) break; if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,image->rows); if (status == MagickFalse) break; } } image->colormap=(PixelPacket *) RelinquishMagickMemory( image->colormap); image->storage_class=DirectClass; image->colors=0; } } if (number_colormaps != 0) colormap=(unsigned char *) RelinquishMagickMemory(colormap); pixel_info=RelinquishVirtualMemory(pixel_info); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); break; } /* Proceed to next image. */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; (void) ReadBlobByte(image); count=ReadBlob(image,2,(unsigned char *) magick); if ((count != 0) && (memcmp(magick,""\122\314"",2) == 0)) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while ((count != 0) && (memcmp(magick,""\122\314"",2) == 0)); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 " static void get_image_md5(const vpx_image_t *img, unsigned char digest[16]) { int plane, y; MD5Context md5; MD5Init(&md5); for (plane = 0; plane < 3; ++plane) { const unsigned char *buf = img->planes[plane]; const int stride = img->stride[plane]; const int w = plane ? (img->d_w + 1) >> 1 : img->d_w; const int h = plane ? (img->d_h + 1) >> 1 : img->d_h; for (y = 0; y < h; ++y) { MD5Update(&md5, buf, w); buf += stride; } } MD5Final(digest, &md5); } ",0 " Line_To( RAS_ARGS Long x, Long y ) { /* First, detect a change of direction */ switch ( ras.state ) { case Unknown_State: if ( y > ras.lastY ) { if ( New_Profile( RAS_VARS Ascending_State, IS_BOTTOM_OVERSHOOT( ras.lastY ) ) ) return FAILURE; } else { if ( y < ras.lastY ) if ( New_Profile( RAS_VARS Descending_State, IS_TOP_OVERSHOOT( ras.lastY ) ) ) return FAILURE; } break; case Ascending_State: if ( y < ras.lastY ) { if ( End_Profile( RAS_VARS IS_TOP_OVERSHOOT( ras.lastY ) ) || New_Profile( RAS_VARS Descending_State, IS_TOP_OVERSHOOT( ras.lastY ) ) ) return FAILURE; } break; case Descending_State: if ( y > ras.lastY ) { if ( End_Profile( RAS_VARS IS_BOTTOM_OVERSHOOT( ras.lastY ) ) || New_Profile( RAS_VARS Ascending_State, IS_BOTTOM_OVERSHOOT( ras.lastY ) ) ) return FAILURE; } break; default: ; } /* Then compute the lines */ switch ( ras.state ) { case Ascending_State: if ( Line_Up( RAS_VARS ras.lastX, ras.lastY, x, y, ras.minY, ras.maxY ) ) return FAILURE; break; case Descending_State: if ( Line_Down( RAS_VARS ras.lastX, ras.lastY, x, y, ras.minY, ras.maxY ) ) return FAILURE; break; default: ; } ras.lastX = x; ras.lastY = y; return SUCCESS; } ",0 "gama_modify(png_modifier *pm, png_modification *me, int add) { UNUSED(add) /* This simply dumps the given gamma value into the buffer. */ png_save_uint_32(pm->buffer, 4); png_save_uint_32(pm->buffer+4, CHUNK_gAMA); png_save_uint_32(pm->buffer+8, ((gama_modification*)me)->gamma); return 1; } ",0 "static void fdctrl_start_transfer(FDCtrl *fdctrl, int direction) { FDrive *cur_drv; uint8_t kh, kt, ks; SET_CUR_DRV(fdctrl, fdctrl->fifo[1] & FD_DOR_SELMASK); cur_drv = get_cur_drv(fdctrl); kt = fdctrl->fifo[2]; kh = fdctrl->fifo[3]; ks = fdctrl->fifo[4]; FLOPPY_DPRINTF(""Start transfer at %d %d %02x %02x (%d)\n"", GET_CUR_DRV(fdctrl), kh, kt, ks, fd_sector_calc(kh, kt, ks, cur_drv->last_sect, NUM_SIDES(cur_drv))); switch (fd_seek(cur_drv, kh, kt, ks, fdctrl->config & FD_CONFIG_EIS)) { case 2: /* sect too big */ fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM, 0x00, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 3: /* track too big */ fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM, FD_SR1_EC, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 4: /* No seek enabled */ fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM, 0x00, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; case 1: fdctrl->status0 |= FD_SR0_SEEK; break; default: break; } /* Check the data rate. If the programmed data rate does not match * the currently inserted medium, the operation has to fail. */ if (fdctrl->check_media_rate && (fdctrl->dsr & FD_DSR_DRATEMASK) != cur_drv->media_rate) { FLOPPY_DPRINTF(""data rate mismatch (fdc=%d, media=%d)\n"", fdctrl->dsr & FD_DSR_DRATEMASK, cur_drv->media_rate); fdctrl_stop_transfer(fdctrl, FD_SR0_ABNTERM, FD_SR1_MA, 0x00); fdctrl->fifo[3] = kt; fdctrl->fifo[4] = kh; fdctrl->fifo[5] = ks; return; } /* Set the FIFO state */ fdctrl->data_dir = direction; fdctrl->data_pos = 0; assert(fdctrl->msr & FD_MSR_CMDBUSY); if (fdctrl->fifo[0] & 0x80) fdctrl->data_state |= FD_STATE_MULTI; else fdctrl->data_state &= ~FD_STATE_MULTI; if (fdctrl->fifo[5] == 0) { fdctrl->data_len = fdctrl->fifo[8]; } else { int tmp; fdctrl->data_len = 128 << (fdctrl->fifo[5] > 7 ? 7 : fdctrl->fifo[5]); tmp = (fdctrl->fifo[6] - ks + 1); if (fdctrl->fifo[0] & 0x80) tmp += fdctrl->fifo[6]; fdctrl->data_len *= tmp; } fdctrl->eot = fdctrl->fifo[6]; if (fdctrl->dor & FD_DOR_DMAEN) { int dma_mode; /* DMA transfer are enabled. Check if DMA channel is well programmed */ dma_mode = DMA_get_channel_mode(fdctrl->dma_chann); dma_mode = (dma_mode >> 2) & 3; FLOPPY_DPRINTF(""dma_mode=%d direction=%d (%d - %d)\n"", dma_mode, direction, (128 << fdctrl->fifo[5]) * (cur_drv->last_sect - ks + 1), fdctrl->data_len); if (((direction == FD_DIR_SCANE || direction == FD_DIR_SCANL || direction == FD_DIR_SCANH) && dma_mode == 0) || (direction == FD_DIR_WRITE && dma_mode == 2) || (direction == FD_DIR_READ && dma_mode == 1) || (direction == FD_DIR_VERIFY)) { /* No access is allowed until DMA transfer has completed */ fdctrl->msr &= ~FD_MSR_RQM; if (direction != FD_DIR_VERIFY) { /* Now, we just have to wait for the DMA controller to * recall us... */ DMA_hold_DREQ(fdctrl->dma_chann); DMA_schedule(fdctrl->dma_chann); } else { /* Start transfer */ fdctrl_transfer_handler(fdctrl, fdctrl->dma_chann, 0, fdctrl->data_len); } return; } else { FLOPPY_DPRINTF(""bad dma_mode=%d direction=%d\n"", dma_mode, direction); } } FLOPPY_DPRINTF(""start non-DMA transfer\n""); fdctrl->msr |= FD_MSR_NONDMA; if (direction != FD_DIR_WRITE) fdctrl->msr |= FD_MSR_DIO; /* IO based transfer: calculate len */ fdctrl_raise_irq(fdctrl); } ",0 "void NavigationController::InsertEntriesFrom( const NavigationController& source, int max_index) { DCHECK_LE(max_index, source.entry_count()); size_t insert_index = 0; for (int i = 0; i < max_index; i++) { if (source.entries_[i].get()->page_type() != INTERSTITIAL_PAGE) { entries_.insert(entries_.begin() + insert_index++, linked_ptr( new NavigationEntry(*source.entries_[i]))); } } } ",0 "proto_reg_handoff_rpcap (void) { static gboolean rpcap_prefs_initialized = FALSE; if (!rpcap_prefs_initialized) { data_handle = find_dissector (""data""); rpcap_prefs_initialized = TRUE; heur_dissector_add (""tcp"", dissect_rpcap_heur_tcp, ""RPCAP over TCP"", ""rpcap_tcp"", proto_rpcap, HEURISTIC_ENABLE); heur_dissector_add (""udp"", dissect_rpcap_heur_udp, ""RPCAP over UDP"", ""rpcap_udp"", proto_rpcap, HEURISTIC_ENABLE); } info_added = FALSE; linktype = global_linktype; } ",0 "void OffscreenCanvas::setWidth(unsigned width) { IntSize new_size = size_; new_size.SetWidth(clampTo(width)); SetSize(new_size); } ",0 "PeopleHandler::~PeopleHandler() { if (!web_ui()) return; CloseSyncSetup(); } ",0 "bool CheckBasicProxyAuth(const AuthChallengeInfo* auth_challenge) { if (!auth_challenge) return false; EXPECT_TRUE(auth_challenge->is_proxy); EXPECT_EQ(""myproxy:70"", auth_challenge->challenger.ToString()); EXPECT_EQ(""MyRealm1"", auth_challenge->realm); EXPECT_EQ(""basic"", auth_challenge->scheme); return true; } ",0 "CJSON_PUBLIC(cJSON *) cJSON_Parse(const char *value) { return cJSON_ParseWithOpts(value, 0, 0); } ",0 "static inline bool sanity_check_area_boundary(struct f2fs_sb_info *sbi, struct buffer_head *bh) { struct f2fs_super_block *raw_super = (struct f2fs_super_block *) (bh->b_data + F2FS_SUPER_OFFSET); struct super_block *sb = sbi->sb; u32 segment0_blkaddr = le32_to_cpu(raw_super->segment0_blkaddr); u32 cp_blkaddr = le32_to_cpu(raw_super->cp_blkaddr); u32 sit_blkaddr = le32_to_cpu(raw_super->sit_blkaddr); u32 nat_blkaddr = le32_to_cpu(raw_super->nat_blkaddr); u32 ssa_blkaddr = le32_to_cpu(raw_super->ssa_blkaddr); u32 main_blkaddr = le32_to_cpu(raw_super->main_blkaddr); u32 segment_count_ckpt = le32_to_cpu(raw_super->segment_count_ckpt); u32 segment_count_sit = le32_to_cpu(raw_super->segment_count_sit); u32 segment_count_nat = le32_to_cpu(raw_super->segment_count_nat); u32 segment_count_ssa = le32_to_cpu(raw_super->segment_count_ssa); u32 segment_count_main = le32_to_cpu(raw_super->segment_count_main); u32 segment_count = le32_to_cpu(raw_super->segment_count); u32 log_blocks_per_seg = le32_to_cpu(raw_super->log_blocks_per_seg); u64 main_end_blkaddr = main_blkaddr + (segment_count_main << log_blocks_per_seg); u64 seg_end_blkaddr = segment0_blkaddr + (segment_count << log_blocks_per_seg); if (segment0_blkaddr != cp_blkaddr) { f2fs_msg(sb, KERN_INFO, ""Mismatch start address, segment0(%u) cp_blkaddr(%u)"", segment0_blkaddr, cp_blkaddr); return true; } if (cp_blkaddr + (segment_count_ckpt << log_blocks_per_seg) != sit_blkaddr) { f2fs_msg(sb, KERN_INFO, ""Wrong CP boundary, start(%u) end(%u) blocks(%u)"", cp_blkaddr, sit_blkaddr, segment_count_ckpt << log_blocks_per_seg); return true; } if (sit_blkaddr + (segment_count_sit << log_blocks_per_seg) != nat_blkaddr) { f2fs_msg(sb, KERN_INFO, ""Wrong SIT boundary, start(%u) end(%u) blocks(%u)"", sit_blkaddr, nat_blkaddr, segment_count_sit << log_blocks_per_seg); return true; } if (nat_blkaddr + (segment_count_nat << log_blocks_per_seg) != ssa_blkaddr) { f2fs_msg(sb, KERN_INFO, ""Wrong NAT boundary, start(%u) end(%u) blocks(%u)"", nat_blkaddr, ssa_blkaddr, segment_count_nat << log_blocks_per_seg); return true; } if (ssa_blkaddr + (segment_count_ssa << log_blocks_per_seg) != main_blkaddr) { f2fs_msg(sb, KERN_INFO, ""Wrong SSA boundary, start(%u) end(%u) blocks(%u)"", ssa_blkaddr, main_blkaddr, segment_count_ssa << log_blocks_per_seg); return true; } if (main_end_blkaddr > seg_end_blkaddr) { f2fs_msg(sb, KERN_INFO, ""Wrong MAIN_AREA boundary, start(%u) end(%u) block(%u)"", main_blkaddr, segment0_blkaddr + (segment_count << log_blocks_per_seg), segment_count_main << log_blocks_per_seg); return true; } else if (main_end_blkaddr < seg_end_blkaddr) { int err = 0; char *res; /* fix in-memory information all the time */ raw_super->segment_count = cpu_to_le32((main_end_blkaddr - segment0_blkaddr) >> log_blocks_per_seg); if (f2fs_readonly(sb) || bdev_read_only(sb->s_bdev)) { set_sbi_flag(sbi, SBI_NEED_SB_WRITE); res = ""internally""; } else { err = __f2fs_commit_super(bh, NULL); res = err ? ""failed"" : ""done""; } f2fs_msg(sb, KERN_INFO, ""Fix alignment : %s, start(%u) end(%u) block(%u)"", res, main_blkaddr, segment0_blkaddr + (segment_count << log_blocks_per_seg), segment_count_main << log_blocks_per_seg); if (err) return true; } return false; } ",0 "void LayerTreeHost::UpdateTopControlsState(TopControlsState constraints, TopControlsState current, bool animate) { if (!settings_.calculate_top_controls_position) return; proxy_->ImplThreadTaskRunner()->PostTask( FROM_HERE, base::Bind(&TopControlsManager::UpdateTopControlsState, top_controls_manager_weak_ptr_, constraints, current, animate)); } ",0 "ar6000_snrThresholdEvent_rx(void *devt, WMI_SNR_THRESHOLD_VAL newThreshold, u8 snr) { WMI_SNR_THRESHOLD_EVENT event; event.range = newThreshold; event.snr = snr; } ",0 " explicit CreateBookmarkBucketMapper(Profile* profile) : profile_(profile) {} ",0 "static void AssertWaitForStateOrDeleted(ClientStateNotification* note, EglRenderingVDAClient* client, ClientState expected_state) { ClientState state = note->Wait(); if (state == expected_state) return; ASSERT_TRUE(client->decoder_deleted()) << ""Decoder not deleted but Wait() returned "" << state << "", instead of "" << expected_state; } ",0 " virtual void SetUpCommandLine(CommandLine* command_line) { GpuFeatureTest::SetUpCommandLine(command_line); command_line->AppendSwitch(switches::kEnableAccelerated2dCanvas); } ",0 "static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct serpent_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); be128 buf[SERPENT_AVX2_PARALLEL_BLOCKS]; struct crypt_priv crypt_ctx = { .ctx = &ctx->serpent_ctx, .fpu_enabled = false, }; struct lrw_crypt_req req = { .tbuf = buf, .tbuflen = sizeof(buf), .table_ctx = &ctx->lrw_table, .crypt_ctx = &crypt_ctx, .crypt_fn = encrypt_callback, }; int ret; desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; ret = lrw_crypt(desc, dst, src, nbytes, &req); serpent_fpu_end(crypt_ctx.fpu_enabled); return ret; } ",0 "static int dccp_v6_conn_request(struct sock *sk, struct sk_buff *skb) { struct request_sock *req; struct dccp_request_sock *dreq; struct inet_request_sock *ireq; struct ipv6_pinfo *np = inet6_sk(sk); const __be32 service = dccp_hdr_request(skb)->dccph_req_service; struct dccp_skb_cb *dcb = DCCP_SKB_CB(skb); if (skb->protocol == htons(ETH_P_IP)) return dccp_v4_conn_request(sk, skb); if (!ipv6_unicast_destination(skb)) return 0; /* discard, don't send a reset here */ if (dccp_bad_service_code(sk, service)) { dcb->dccpd_reset_code = DCCP_RESET_CODE_BAD_SERVICE_CODE; goto drop; } /* * There are no SYN attacks on IPv6, yet... */ dcb->dccpd_reset_code = DCCP_RESET_CODE_TOO_BUSY; if (inet_csk_reqsk_queue_is_full(sk)) goto drop; if (sk_acceptq_is_full(sk) && inet_csk_reqsk_queue_young(sk) > 1) goto drop; req = inet_reqsk_alloc(&dccp6_request_sock_ops, sk, true); if (req == NULL) goto drop; if (dccp_reqsk_init(req, dccp_sk(sk), skb)) goto drop_and_free; dreq = dccp_rsk(req); if (dccp_parse_options(sk, dreq, skb)) goto drop_and_free; if (security_inet_conn_request(sk, skb, req)) goto drop_and_free; ireq = inet_rsk(req); ireq->ir_v6_rmt_addr = ipv6_hdr(skb)->saddr; ireq->ir_v6_loc_addr = ipv6_hdr(skb)->daddr; ireq->ireq_family = AF_INET6; if (ipv6_opt_accepted(sk, skb, IP6CB(skb)) || np->rxopt.bits.rxinfo || np->rxopt.bits.rxoinfo || np->rxopt.bits.rxhlim || np->rxopt.bits.rxohlim) { atomic_inc(&skb->users); ireq->pktopts = skb; } ireq->ir_iif = sk->sk_bound_dev_if; /* So that link locals have meaning */ if (!sk->sk_bound_dev_if && ipv6_addr_type(&ireq->ir_v6_rmt_addr) & IPV6_ADDR_LINKLOCAL) ireq->ir_iif = inet6_iif(skb); /* * Step 3: Process LISTEN state * * Set S.ISR, S.GSR, S.SWL, S.SWH from packet or Init Cookie * * Setting S.SWL/S.SWH to is deferred to dccp_create_openreq_child(). */ dreq->dreq_isr = dcb->dccpd_seq; dreq->dreq_gsr = dreq->dreq_isr; dreq->dreq_iss = dccp_v6_init_sequence(skb); dreq->dreq_gss = dreq->dreq_iss; dreq->dreq_service = service; if (dccp_v6_send_response(sk, req)) goto drop_and_free; inet_csk_reqsk_queue_hash_add(sk, req, DCCP_TIMEOUT_INIT); return 0; drop_and_free: reqsk_free(req); drop: DCCP_INC_STATS_BH(DCCP_MIB_ATTEMPTFAILS); return -1; } ",0 "static inline int throttled_hierarchy(struct cfs_rq *cfs_rq) { return cfs_bandwidth_used() && cfs_rq->throttle_count; } ",0 "Color Document::ThemeColor() const { auto root_element = documentElement(); if (!root_element) return Color(); for (HTMLMetaElement& meta_element : Traversal::DescendantsOf(*root_element)) { Color color = Color::kTransparent; if (DeprecatedEqualIgnoringCase(meta_element.GetName(), ""theme-color"") && CSSParser::ParseColor( color, meta_element.Content().GetString().StripWhiteSpace(), true)) return color; } return Color(); } ",0 "ChromeNetworkDelegate::ChromeNetworkDelegate( extensions::EventRouterForwarder* event_router, BooleanPrefMember* enable_referrers) : event_router_(event_router), profile_(NULL), enable_referrers_(enable_referrers), enable_do_not_track_(NULL), force_google_safe_search_(NULL), url_blacklist_manager_(NULL), load_time_stats_(NULL), received_content_length_(0), original_content_length_(0) { DCHECK(event_router); DCHECK(enable_referrers); } ",0 "const std::string& PlatformFontSkia::GetFontName() const { return font_family_; } ",0 "static void put_sample_convert_from_linear_flt(struct iw_context *ctx, iw_tmpsample samp_lin, int x, int y, int channel, const struct iw_csdescr *csdescr) { put_raw_sample_flt32(ctx,(double)samp_lin,x,y,channel); } ",0 "ntp_exit(int retval) { msyslog(LOG_ERR, ""EXITING with return code %d"", retval); exit(retval); } ",0 "sp AudioFlinger::EffectChain::getEffectFromType_l( const effect_uuid_t *type) { size_t size = mEffects.size(); for (size_t i = 0; i < size; i++) { if (memcmp(&mEffects[i]->desc().type, type, sizeof(effect_uuid_t)) == 0) { return mEffects[i]; } } return 0; } ",0 "void HTMLMediaElement::deferLoad() { DCHECK(!m_deferredLoadTimer.isActive()); DCHECK_EQ(m_deferredLoadState, NotDeferred); changeNetworkStateFromLoadingToIdle(); m_deferredLoadTimer.startOneShot(0, BLINK_FROM_HERE); m_deferredLoadState = WaitingForStopDelayingLoadEventTask; } ",0 "void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument) { WillBeHeapHashSet> nodeIteratorsList = m_nodeIterators; for (NodeIterator* ni : nodeIteratorsList) { if (ni->root() == node) { detachNodeIterator(ni); newDocument.attachNodeIterator(ni); } } } ",0 "static void __net_exit netlink_net_exit(struct net *net) { #ifdef CONFIG_PROC_FS remove_proc_entry(""netlink"", net->proc_net); #endif } ",0 " ProfileSyncService* sync_service() { return sync_service_.get(); } ",0 "bool Histogram::PrintEmptyBucket(uint32_t index) const { return true; } ",0 " void ExpectCanDiscardFalseTrivialAllReasons( const LifecycleUnit* lifecycle_unit) { ExpectCanDiscardFalseTrivial(lifecycle_unit, DiscardReason::kExternal); ExpectCanDiscardFalseTrivial(lifecycle_unit, DiscardReason::kProactive); ExpectCanDiscardFalseTrivial(lifecycle_unit, DiscardReason::kUrgent); } ",0 "__rpc_disable_timer(struct rpc_wait_queue *queue, struct rpc_task *task) { if (task->tk_timeout == 0) return; dprintk(""RPC: %5u disabling timer\n"", task->tk_pid); task->tk_timeout = 0; list_del(&task->u.tk_wait.timer_list); if (list_empty(&queue->timer_list.list)) del_timer(&queue->timer_list.timer); } ",0 " gray_render_line( RAS_ARG_ TPos to_x, TPos to_y ) { TCoord ey1, ey2, fy1, fy2, mod; TPos dx, dy, x, x2; long p, first; int delta, rem, lift, incr; ey1 = TRUNC( ras.last_ey ); ey2 = TRUNC( to_y ); /* if (ey2 >= ras.max_ey) ey2 = ras.max_ey-1; */ fy1 = (TCoord)( ras.y - ras.last_ey ); fy2 = (TCoord)( to_y - SUBPIXELS( ey2 ) ); dx = to_x - ras.x; dy = to_y - ras.y; /* XXX: we should do something about the trivial case where dx == 0, */ /* as it happens very often! */ /* perform vertical clipping */ { TCoord min, max; min = ey1; max = ey2; if ( ey1 > ey2 ) { min = ey2; max = ey1; } if ( min >= ras.max_ey || max < ras.min_ey ) goto End; } /* everything is on a single scanline */ if ( ey1 == ey2 ) { gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, to_x, fy2 ); goto End; } /* vertical line - avoid calling gray_render_scanline */ incr = 1; if ( dx == 0 ) { TCoord ex = TRUNC( ras.x ); TCoord two_fx = (TCoord)( ( ras.x - SUBPIXELS( ex ) ) << 1 ); TArea area; first = ONE_PIXEL; if ( dy < 0 ) { first = 0; incr = -1; } delta = (int)( first - fy1 ); ras.area += (TArea)two_fx * delta; ras.cover += delta; ey1 += incr; gray_set_cell( RAS_VAR_ ex, ey1 ); delta = (int)( first + first - ONE_PIXEL ); area = (TArea)two_fx * delta; while ( ey1 != ey2 ) { ras.area += area; ras.cover += delta; ey1 += incr; gray_set_cell( RAS_VAR_ ex, ey1 ); } delta = (int)( fy2 - ONE_PIXEL + first ); ras.area += (TArea)two_fx * delta; ras.cover += delta; goto End; } /* ok, we have to render several scanlines */ p = ( ONE_PIXEL - fy1 ) * dx; first = ONE_PIXEL; incr = 1; if ( dy < 0 ) { p = fy1 * dx; first = 0; incr = -1; dy = -dy; } delta = (int)( p / dy ); mod = (int)( p % dy ); if ( mod < 0 ) { delta--; mod += (TCoord)dy; } x = ras.x + delta; gray_render_scanline( RAS_VAR_ ey1, ras.x, fy1, x, (TCoord)first ); ey1 += incr; gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 ); if ( ey1 != ey2 ) { p = ONE_PIXEL * dx; lift = (int)( p / dy ); rem = (int)( p % dy ); if ( rem < 0 ) { lift--; rem += (int)dy; } mod -= (int)dy; while ( ey1 != ey2 ) { delta = lift; mod += rem; if ( mod >= 0 ) { mod -= (int)dy; delta++; } x2 = x + delta; gray_render_scanline( RAS_VAR_ ey1, x, (TCoord)( ONE_PIXEL - first ), x2, (TCoord)first ); x = x2; ey1 += incr; gray_set_cell( RAS_VAR_ TRUNC( x ), ey1 ); } } gray_render_scanline( RAS_VAR_ ey1, x, (TCoord)( ONE_PIXEL - first ), to_x, fy2 ); End: ras.x = to_x; ras.y = to_y; ras.last_ey = SUBPIXELS( ey2 ); } ",0 "void HostCache::Set(const Key& key, const Entry& entry, base::TimeTicks now, base::TimeDelta ttl) { TRACE_EVENT0(kNetTracingCategory, ""HostCache::Set""); DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (caching_is_disabled()) return; auto it = entries_.find(key); if (it != entries_.end()) { bool is_stale = it->second.IsStale(now, network_changes_); RecordSet(is_stale ? SET_UPDATE_STALE : SET_UPDATE_VALID, now, &it->second, entry); entries_.erase(it); } else { if (size() == max_entries_) EvictOneEntry(now); RecordSet(SET_INSERT, now, nullptr, entry); } AddEntry(Key(key), Entry(entry, now, ttl, network_changes_)); } ",1 "void Browser::TabDetachedAt(TabContents* contents, int index) { TabDetachedAtImpl(contents, index, DETACH_TYPE_DETACH); } ",1 "GF_Err pasp_Read(GF_Box *s, GF_BitStream *bs) { GF_PixelAspectRatioBox *ptr = (GF_PixelAspectRatioBox*)s; ptr->hSpacing = gf_bs_read_u32(bs); ptr->vSpacing = gf_bs_read_u32(bs); ISOM_DECREASE_SIZE(ptr, 8); return GF_OK; } ",0 "static LayoutPoint PaintOffsetInPaginationContainer( const LayoutObject& object, const PaintLayer& enclosing_pagination_layer) { if (!object.IsBox() && !object.HasLayer()) { return PaintOffsetInPaginationContainer(*object.ContainingBlock(), enclosing_pagination_layer); } TransformState transform_state(TransformState::kApplyTransformDirection, FloatPoint()); object.MapLocalToAncestor(&enclosing_pagination_layer.GetLayoutObject(), transform_state, kApplyContainerFlip); transform_state.Flatten(); return LayoutPoint(transform_state.LastPlanarPoint()); } ",0 "static void queue_autoload_drivers(void) { schedule_work(&autoload_work); } ",0 "void RenderFrameHostImpl::SetBeforeUnloadTimeoutDelayForTesting( const base::TimeDelta& timeout) { beforeunload_timeout_delay_ = timeout; } ",0 "ChromeContentBrowserClient::GetAdditionalSiteIsolationModes() { if (SiteIsolationPolicy::IsIsolationForPasswordSitesEnabled()) return {""Isolate Password Sites""}; else return {}; } ",0 "static int em_sysenter(struct x86_emulate_ctxt *ctxt) { struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct cs, ss; u64 msr_data; u16 cs_sel, ss_sel; u64 efer = 0; ops->get_msr(ctxt, MSR_EFER, &efer); /* inject #GP if in real mode */ if (ctxt->mode == X86EMUL_MODE_REAL) return emulate_gp(ctxt, 0); /* XXX sysenter/sysexit have not been tested in 64bit mode. * Therefore, we inject an #UD. */ if (ctxt->mode == X86EMUL_MODE_PROT64) return emulate_ud(ctxt); setup_syscalls_segments(ctxt, &cs, &ss); ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data); switch (ctxt->mode) { case X86EMUL_MODE_PROT32: if ((msr_data & 0xfffc) == 0x0) return emulate_gp(ctxt, 0); break; case X86EMUL_MODE_PROT64: if (msr_data == 0x0) return emulate_gp(ctxt, 0); break; } ctxt->eflags &= ~(EFLG_VM | EFLG_IF | EFLG_RF); cs_sel = (u16)msr_data; cs_sel &= ~SELECTOR_RPL_MASK; ss_sel = cs_sel + 8; ss_sel &= ~SELECTOR_RPL_MASK; if (ctxt->mode == X86EMUL_MODE_PROT64 || (efer & EFER_LMA)) { cs.d = 0; cs.l = 1; } ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS); ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data); ctxt->_eip = msr_data; ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data); ctxt->regs[VCPU_REGS_RSP] = msr_data; return X86EMUL_CONTINUE; } ",0 "static void snd_timer_notify1(struct snd_timer_instance *ti, int event) { struct snd_timer *timer; unsigned long resolution = 0; struct snd_timer_instance *ts; struct timespec tstamp; if (timer_tstamp_monotonic) ktime_get_ts(&tstamp); else getnstimeofday(&tstamp); if (snd_BUG_ON(event < SNDRV_TIMER_EVENT_START || event > SNDRV_TIMER_EVENT_PAUSE)) return; if (event == SNDRV_TIMER_EVENT_START || event == SNDRV_TIMER_EVENT_CONTINUE) resolution = snd_timer_resolution(ti); if (ti->ccallback) ti->ccallback(ti, event, &tstamp, resolution); if (ti->flags & SNDRV_TIMER_IFLG_SLAVE) return; timer = ti->timer; if (timer == NULL) return; if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE) return; list_for_each_entry(ts, &ti->slave_active_head, active_list) if (ts->ccallback) ts->ccallback(ts, event + 100, &tstamp, resolution); } ",0 "static char **DestroyXMLTreeAttributes(char **attributes) { register ssize_t i; /* Destroy a tag attribute list. */ if ((attributes == (char **) NULL) || (attributes == sentinel)) return((char **) NULL); for (i=0; attributes[i] != (char *) NULL; i+=2) { /* Destroy attribute tag and value. */ if (attributes[i] != (char *) NULL) attributes[i]=DestroyString(attributes[i]); if (attributes[i+1] != (char *) NULL) attributes[i+1]=DestroyString(attributes[i+1]); } attributes=(char **) RelinquishMagickMemory(attributes); return((char **) NULL); } ",0 "bool Layer::TransformIsAnimating() const { return layer_animation_controller_->IsAnimatingProperty(Animation::Transform); } ",0 "struct md_thread *md_register_thread(void (*run) (struct md_thread *), struct mddev *mddev, const char *name) { struct md_thread *thread; thread = kzalloc(sizeof(struct md_thread), GFP_KERNEL); if (!thread) return NULL; init_waitqueue_head(&thread->wqueue); thread->run = run; thread->mddev = mddev; thread->timeout = MAX_SCHEDULE_TIMEOUT; thread->tsk = kthread_run(md_thread, thread, ""%s_%s"", mdname(thread->mddev), name); if (IS_ERR(thread->tsk)) { kfree(thread); return NULL; } return thread; } ",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, phnum, shnum; 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; } if (S_ISREG(st.st_mode) || st.st_size != 0) fsize = st.st_size; else fsize = SIZE_UNKNOWN; 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; } ",0 "static int open_will_truncate(int flag, struct inode *inode) { /* * We'll never write to the fs underlying * a device file. */ if (special_file(inode->i_mode)) return 0; return (flag & O_TRUNC); } ",0 "static int do_hidp_sock_ioctl(struct socket *sock, unsigned int cmd, void __user *argp) { struct hidp_connadd_req ca; struct hidp_conndel_req cd; struct hidp_connlist_req cl; struct hidp_conninfo ci; struct socket *csock; struct socket *isock; int err; BT_DBG(""cmd %x arg %p"", cmd, argp); switch (cmd) { case HIDPCONNADD: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (copy_from_user(&ca, argp, sizeof(ca))) return -EFAULT; csock = sockfd_lookup(ca.ctrl_sock, &err); if (!csock) return err; isock = sockfd_lookup(ca.intr_sock, &err); if (!isock) { sockfd_put(csock); return err; } err = hidp_connection_add(&ca, csock, isock); if (!err && copy_to_user(argp, &ca, sizeof(ca))) err = -EFAULT; sockfd_put(csock); sockfd_put(isock); return err; case HIDPCONNDEL: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (copy_from_user(&cd, argp, sizeof(cd))) return -EFAULT; return hidp_connection_del(&cd); case HIDPGETCONNLIST: if (copy_from_user(&cl, argp, sizeof(cl))) return -EFAULT; if (cl.cnum <= 0) return -EINVAL; err = hidp_get_connlist(&cl); if (!err && copy_to_user(argp, &cl, sizeof(cl))) return -EFAULT; return err; case HIDPGETCONNINFO: if (copy_from_user(&ci, argp, sizeof(ci))) return -EFAULT; err = hidp_get_conninfo(&ci); if (!err && copy_to_user(argp, &ci, sizeof(ci))) return -EFAULT; return err; } return -EINVAL; } ",1 "cancel_directory_count_for_file (NautilusDirectory *directory, NautilusFile *file) { if (directory->details->count_in_progress != NULL && directory->details->count_in_progress->count_file == file) { directory_count_cancel (directory); } } ",0 "int rdma_set_afonly(struct rdma_cm_id *id, int afonly) { struct rdma_id_private *id_priv; unsigned long flags; int ret; id_priv = container_of(id, struct rdma_id_private, id); spin_lock_irqsave(&id_priv->lock, flags); if (id_priv->state == RDMA_CM_IDLE || id_priv->state == RDMA_CM_ADDR_BOUND) { id_priv->options |= (1 << CMA_OPTION_AFONLY); id_priv->afonly = afonly; ret = 0; } else { ret = -EINVAL; } spin_unlock_irqrestore(&id_priv->lock, flags); return ret; } ",0 "void OmniboxViewViews::GetAccessibleNodeData(ui::AXNodeData* node_data) { node_data->role = ui::AX_ROLE_TEXT_FIELD; node_data->SetName(l10n_util::GetStringUTF8(IDS_ACCNAME_LOCATION)); node_data->SetValue(GetText()); node_data->html_attributes.push_back(std::make_pair(""type"", ""url"")); base::string16::size_type entry_start; base::string16::size_type entry_end; if (saved_selection_for_focus_change_.IsValid()) { entry_start = saved_selection_for_focus_change_.start(); entry_end = saved_selection_for_focus_change_.end(); } else { GetSelectionBounds(&entry_start, &entry_end); } node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_START, entry_start); node_data->AddIntAttribute(ui::AX_ATTR_TEXT_SEL_END, entry_end); if (popup_window_mode_) { node_data->AddIntAttribute(ui::AX_ATTR_RESTRICTION, ui::AX_RESTRICTION_READ_ONLY); } else { node_data->AddState(ui::AX_STATE_EDITABLE); } } ",0 "void RunMessageLoop(PP_Instance instance) { MessageLoop::ScopedNestableTaskAllower allow(MessageLoop::current()); MessageLoop::current()->Run(); } ",0 "GamepadProvider::GamepadProvider( GamepadConnectionChangeClient* connection_change_client) : is_paused_(true), have_scheduled_do_poll_(false), devices_changed_(true), ever_had_user_gesture_(false), sanitize_(true), gamepad_shared_buffer_(new GamepadSharedBuffer()), connection_change_client_(connection_change_client) { Initialize(std::unique_ptr()); } ",0 "nextproto4_cksum(netdissect_options *ndo, const struct ip *ip, const uint8_t *data, u_int len, u_int covlen, u_int next_proto) { struct phdr { uint32_t src; uint32_t dst; u_char mbz; u_char proto; uint16_t len; } ph; struct cksum_vec vec[2]; /* pseudo-header.. */ ph.len = htons((uint16_t)len); ph.mbz = 0; ph.proto = next_proto; UNALIGNED_MEMCPY(&ph.src, &ip->ip_src, sizeof(uint32_t)); if (IP_HL(ip) == 5) UNALIGNED_MEMCPY(&ph.dst, &ip->ip_dst, sizeof(uint32_t)); else ph.dst = ip_finddst(ndo, ip); vec[0].ptr = (const uint8_t *)(void *)&ph; vec[0].len = sizeof(ph); vec[1].ptr = data; vec[1].len = covlen; return (in_cksum(vec, 2)); } ",0 "int QQuickWebViewExperimental::deviceHeight() const { Q_D(const QQuickWebView); return d->webPageProxy->pageGroup()->preferences()->deviceHeight(); } ",0 "static bool bpf_map_is_cgroup_storage(struct bpf_map *map) { return (map->map_type == BPF_MAP_TYPE_CGROUP_STORAGE || map->map_type == BPF_MAP_TYPE_PERCPU_CGROUP_STORAGE); } ",0 "bool omx_venc::dev_get_peak_bitrate(OMX_U32 *peakbitrate) { #ifdef _MSM8974_ return handle->venc_get_peak_bitrate(peakbitrate); #else DEBUG_PRINT_ERROR(""Get peak bitrate is not supported""); return false; #endif } ",0 "void InfoBar::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { if (child == this) { if (is_add) { InfoBarAdded(); } else { InfoBarRemoved(); } } if (GetWidget() && GetWidget()->IsAccessibleWidget()) { if (parent == this && child != close_button_ && HasChildView(close_button_) && GetChildViewAt(GetChildViewCount() - 1) != close_button_) { RemoveChildView(close_button_); AddChildView(close_button_); } close_button_->SetFocusable(true); } } ",0 "static ParseQualifiedNameResult ParseQualifiedNameInternal( const AtomicString& qualified_name, const CharType* characters, unsigned length, AtomicString& prefix, AtomicString& local_name) { bool name_start = true; bool saw_colon = false; unsigned colon_pos = 0; for (unsigned i = 0; i < length;) { UChar32 c; U16_NEXT(characters, i, length, c) if (c == ':') { if (saw_colon) return ParseQualifiedNameResult(kQNMultipleColons); name_start = true; saw_colon = true; colon_pos = i - 1; } else if (name_start) { if (!IsValidNameStart(c)) return ParseQualifiedNameResult(kQNInvalidStartChar, c); name_start = false; } else { if (!IsValidNamePart(c)) return ParseQualifiedNameResult(kQNInvalidChar, c); } } if (!saw_colon) { prefix = g_null_atom; local_name = qualified_name; } else { prefix = AtomicString(characters, colon_pos); if (prefix.IsEmpty()) return ParseQualifiedNameResult(kQNEmptyPrefix); int prefix_start = colon_pos + 1; local_name = AtomicString(characters + prefix_start, length - prefix_start); } if (local_name.IsEmpty()) return ParseQualifiedNameResult(kQNEmptyLocalName); return ParseQualifiedNameResult(kQNValid); } ",0 "static int skcipher_prepare_alg(struct skcipher_alg *alg) { struct crypto_alg *base = &alg->base; if (alg->ivsize > PAGE_SIZE / 8 || alg->chunksize > PAGE_SIZE / 8 || alg->walksize > PAGE_SIZE / 8) return -EINVAL; if (!alg->chunksize) alg->chunksize = base->cra_blocksize; if (!alg->walksize) alg->walksize = alg->chunksize; base->cra_type = &crypto_skcipher_type2; base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK; base->cra_flags |= CRYPTO_ALG_TYPE_SKCIPHER; return 0; } ",0 "static void testInterfaceEmptyArrayAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValue(info, v8Array(imp->testInterfaceEmptyArrayAttribute(), info.GetIsolate())); } ",0 " ~PrintWebViewHelperTestBase() {} ",0 "vmnc_handle_hextile_rectangle (GstVMncDec * dec, struct RfbRectangle *rect, const guint8 * data, int len, gboolean decode) { int tilesx = GST_ROUND_UP_16 (rect->width) / 16; int tilesy = GST_ROUND_UP_16 (rect->height) / 16; int x, y, z; int off = 0; int subrects; int coloured; int width, height; guint32 fg = 0, bg = 0, colour; guint8 flags; for (y = 0; y < tilesy; y++) { if (y == tilesy - 1) height = rect->height - (tilesy - 1) * 16; else height = 16; for (x = 0; x < tilesx; x++) { if (x == tilesx - 1) width = rect->width - (tilesx - 1) * 16; else width = 16; if (off >= len) { return ERROR_INSUFFICIENT_DATA; } flags = data[off++]; if (flags & 0x1) { if (off + width * height * dec->format.bytes_per_pixel > len) { return ERROR_INSUFFICIENT_DATA; } if (decode) render_raw_tile (dec, data + off, rect->x + x * 16, rect->y + y * 16, width, height); off += width * height * dec->format.bytes_per_pixel; } else { if (flags & 0x2) { READ_PIXEL (bg, data, off, len) } if (flags & 0x4) { READ_PIXEL (fg, data, off, len) } subrects = 0; if (flags & 0x8) { if (off >= len) { return ERROR_INSUFFICIENT_DATA; } subrects = data[off++]; } /* Paint background colour on entire tile */ if (decode) render_subrect (dec, rect->x + x * 16, rect->y + y * 16, width, height, bg); coloured = flags & 0x10; for (z = 0; z < subrects; z++) { if (coloured) { READ_PIXEL (colour, data, off, len); } else colour = fg; if (off + 2 > len) return ERROR_INSUFFICIENT_DATA; { int off_x = (data[off] & 0xf0) >> 4; int off_y = (data[off] & 0x0f); int w = ((data[off + 1] & 0xf0) >> 4) + 1; int h = (data[off + 1] & 0x0f) + 1; off += 2; /* Ensure we don't have out of bounds coordinates */ if (off_x + w > width || off_y + h > height) { GST_WARNING_OBJECT (dec, ""Subrect out of bounds: %d-%d x %d-%d "" ""extends outside %dx%d"", off_x, w, off_y, h, width, height); return ERROR_INVALID; } if (decode) render_subrect (dec, rect->x + x * 16 + off_x, rect->y + y * 16 + off_y, w, h, colour); } } } } } return off; } ",0 "UtilityServiceFactory::CreateNetworkService() { return base::MakeUnique(std::move(network_registry_)); } ",0 "static int nfs4_verify_fore_channel_attrs(struct nfs41_create_session_args *args, struct nfs4_session *session) { struct nfs4_channel_attrs *sent = &args->fc_attrs; struct nfs4_channel_attrs *rcvd = &session->fc_attrs; if (rcvd->max_resp_sz > sent->max_resp_sz) return -EINVAL; /* * Our requested max_ops is the minimum we need; we're not * prepared to break up compounds into smaller pieces than that. * So, no point even trying to continue if the server won't * cooperate: */ if (rcvd->max_ops < sent->max_ops) return -EINVAL; if (rcvd->max_reqs == 0) return -EINVAL; if (rcvd->max_reqs > NFS4_MAX_SLOT_TABLE) rcvd->max_reqs = NFS4_MAX_SLOT_TABLE; return 0; } ",0 "void ext4_kvfree(void *ptr) { if (is_vmalloc_addr(ptr)) vfree(ptr); else kfree(ptr); } ",0 "void NavigationController::FinishRestore(int selected_index, bool from_last_session) { DCHECK(selected_index >= 0 && selected_index < entry_count()); ConfigureEntriesForRestore(&entries_, from_last_session); set_max_restored_page_id(static_cast(entry_count())); last_committed_entry_index_ = selected_index; } ",0 "void WebGLRenderingContextBase::enableVertexAttribArray(GLuint index) { if (isContextLost()) return; if (index >= max_vertex_attribs_) { SynthesizeGLError(GL_INVALID_VALUE, ""enableVertexAttribArray"", ""index out of range""); return; } bound_vertex_array_object_->SetAttribEnabled(index, true); ContextGL()->EnableVertexAttribArray(index); } ",0 "bool ContainerNode::checkAcceptChild(const Node* newChild, const Node* oldChild, ExceptionState& exceptionState) const { if (!newChild) { exceptionState.throwDOMException(NotFoundError, ""The new child element is null.""); return false; } if ((newChild->isElementNode() || newChild->isTextNode()) && isElementNode()) { ASSERT(isChildTypeAllowed(*newChild)); if (containsConsideringHostElements(*newChild)) { exceptionState.throwDOMException(HierarchyRequestError, ""The new child element contains the parent.""); return false; } return true; } ASSERT(!newChild->isPseudoElement()); if (newChild->isPseudoElement()) { exceptionState.throwDOMException(HierarchyRequestError, ""The new child element is a pseudo-element.""); return false; } return checkAcceptChildGuaranteedNodeTypes(*newChild, oldChild, exceptionState); } ",0 "void jpc_qmfb_split_row(jpc_fix_t *a, int numcols, int parity) { int bufsize = JPC_CEILDIVPOW2(numcols, 1); jpc_fix_t splitbuf[QMFB_SPLITBUFSIZE]; jpc_fix_t *buf = splitbuf; register jpc_fix_t *srcptr; register jpc_fix_t *dstptr; register int n; register int m; int hstartcol; /* Get a buffer. */ if (bufsize > QMFB_SPLITBUFSIZE) { if (!(buf = jas_alloc2(bufsize, sizeof(jpc_fix_t)))) { /* We have no choice but to commit suicide in this case. */ abort(); } } if (numcols >= 2) { hstartcol = (numcols + 1 - parity) >> 1; m = numcols - hstartcol; /* Save the samples destined for the highpass channel. */ n = m; dstptr = buf; srcptr = &a[1 - parity]; while (n-- > 0) { *dstptr = *srcptr; ++dstptr; srcptr += 2; } /* Copy the appropriate samples into the lowpass channel. */ dstptr = &a[1 - parity]; srcptr = &a[2 - parity]; n = numcols - m - (!parity); while (n-- > 0) { *dstptr = *srcptr; ++dstptr; srcptr += 2; } /* Copy the saved samples into the highpass channel. */ dstptr = &a[hstartcol]; srcptr = buf; n = m; while (n-- > 0) { *dstptr = *srcptr; ++dstptr; ++srcptr; } } /* If the split buffer was allocated on the heap, free this memory. */ if (buf != splitbuf) { jas_free(buf); } } ",0 "GF_Err dlay_dump(GF_Box *a, FILE * trace) { GF_TextScrollDelayBox*p = (GF_TextScrollDelayBox*)a; gf_isom_box_dump_start(a, ""TextScrollDelayBox"", trace); fprintf(trace, ""scroll_delay=\""%d\"">\n"", p->scroll_delay); gf_isom_box_dump_done(""TextScrollDelayBox"", a, trace); return GF_OK; } ",0 "static void destroy_rt_bandwidth(struct rt_bandwidth *rt_b) { hrtimer_cancel(&rt_b->rt_period_timer); } ",0 " void doWriteFile(const File& file) { doWriteWebCoreString(file.hasBackingFile() ? file.path() : """"); doWriteWebCoreString(file.name()); doWriteWebCoreString(file.webkitRelativePath()); doWriteWebCoreString(file.uuid()); doWriteWebCoreString(file.type()); if (file.hasValidSnapshotMetadata()) { doWriteUint32(static_cast(1)); long long size; double lastModified; file.captureSnapshot(size, lastModified); doWriteUint64(static_cast(size)); doWriteNumber(lastModified); } else { append(static_cast(0)); } } ",0 "static int handle_unlinkat(FsContext *ctx, V9fsPath *dir, const char *name, int flags) { int dirfd, ret; struct handle_data *data = (struct handle_data *)ctx->private; int rflags; dirfd = open_by_handle(data->mountfd, dir->data, O_PATH); if (dirfd < 0) { return dirfd; } rflags = 0; if (flags & P9_DOTL_AT_REMOVEDIR) { rflags |= AT_REMOVEDIR; } ret = unlinkat(dirfd, name, rflags); close(dirfd); return ret; } ",0 "ScriptPromise BaseAudioContext::decodeAudioData( ScriptState* script_state, DOMArrayBuffer* audio_data, ExceptionState& exception_state) { return decodeAudioData(script_state, audio_data, nullptr, nullptr, exception_state); } ",0 "static struct dentry *shmem_fh_to_dentry(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { struct inode *inode; struct dentry *dentry = NULL; u64 inum; if (fh_len < 3) return NULL; inum = fid->raw[2]; inum = (inum << 32) | fid->raw[1]; inode = ilookup5(sb, (unsigned long)(inum + fid->raw[0]), shmem_match, fid->raw); if (inode) { dentry = d_find_alias(inode); iput(inode); } return dentry; } ",0 "bool GetNextTest(const CommandLine::StringVector& args, size_t* position, std::string* test) { if (*position >= args.size()) return false; if (args[*position] == FILE_PATH_LITERAL(""-"")) return !!std::getline(std::cin, *test, '\n'); #if defined(OS_WIN) *test = WideToUTF8(args[(*position)++]); #else *test = args[(*position)++]; #endif return true; } ",0 "bool GuestViewBase::IsAutoSizeSupported() const { return false; } ",0 "static ssize_t fuse_dev_read(struct kiocb *iocb, struct iov_iter *to) { struct fuse_copy_state cs; struct file *file = iocb->ki_filp; struct fuse_dev *fud = fuse_get_dev(file); if (!fud) return -EPERM; if (!iter_is_iovec(to)) return -EINVAL; fuse_copy_init(&cs, 1, to); return fuse_dev_do_read(fud, file, &cs, iov_iter_count(to)); } ",0 "void rpc_prepare_task(struct rpc_task *task) { task->tk_ops->rpc_call_prepare(task, task->tk_calldata); } ",0 "int AutomationProvider::AddExtension(const Extension* extension) { DCHECK(extension); return extension_tracker_->Add(extension); } ",0 "void MenuGtk::Popup(GtkWidget* widget, gint button_type, guint32 timestamp) { gtk_menu_popup(GTK_MENU(menu_.get()), NULL, NULL, MenuPositionFunc, widget, button_type, timestamp); } ",0 "static int arcmsr_hbaA_handle_isr(struct AdapterControlBlock *acb) { uint32_t outbound_intstatus; struct MessageUnit_A __iomem *reg = acb->pmuA; outbound_intstatus = readl(®->outbound_intstatus) & acb->outbound_int_enable; if (!(outbound_intstatus & ARCMSR_MU_OUTBOUND_HANDLE_INT)) return IRQ_NONE; do { writel(outbound_intstatus, ®->outbound_intstatus); if (outbound_intstatus & ARCMSR_MU_OUTBOUND_DOORBELL_INT) arcmsr_hbaA_doorbell_isr(acb); if (outbound_intstatus & ARCMSR_MU_OUTBOUND_POSTQUEUE_INT) arcmsr_hbaA_postqueue_isr(acb); if (outbound_intstatus & ARCMSR_MU_OUTBOUND_MESSAGE0_INT) arcmsr_hbaA_message_isr(acb); outbound_intstatus = readl(®->outbound_intstatus) & acb->outbound_int_enable; } while (outbound_intstatus & (ARCMSR_MU_OUTBOUND_DOORBELL_INT | ARCMSR_MU_OUTBOUND_POSTQUEUE_INT | ARCMSR_MU_OUTBOUND_MESSAGE0_INT)); return IRQ_HANDLED; } ",0 "static int select_idle_sibling(struct task_struct *p, int prev, int target) { struct sched_domain *sd; int i, recent_used_cpu; if (available_idle_cpu(target)) return target; /* * If the previous CPU is cache affine and idle, don't be stupid: */ if (prev != target && cpus_share_cache(prev, target) && available_idle_cpu(prev)) return prev; /* Check a recently used CPU as a potential idle candidate: */ recent_used_cpu = p->recent_used_cpu; if (recent_used_cpu != prev && recent_used_cpu != target && cpus_share_cache(recent_used_cpu, target) && available_idle_cpu(recent_used_cpu) && cpumask_test_cpu(p->recent_used_cpu, &p->cpus_allowed)) { /* * Replace recent_used_cpu with prev as it is a potential * candidate for the next wake: */ p->recent_used_cpu = prev; return recent_used_cpu; } sd = rcu_dereference(per_cpu(sd_llc, target)); if (!sd) return target; i = select_idle_core(p, sd, target); if ((unsigned)i < nr_cpumask_bits) return i; i = select_idle_cpu(p, sd, target); if ((unsigned)i < nr_cpumask_bits) return i; i = select_idle_smt(p, sd, target); if ((unsigned)i < nr_cpumask_bits) return i; return target; } ",0 "bool Extension::IsComponentOnlyPermission( const ExtensionAPIPermission* api) const { if (location() == Extension::COMPONENT) return true; if (api == NULL) return true; return !api->is_component_only(); } ",0 "static _INLINE_ unsigned int serial_in(struct mp_port *mtpt, int offset) { return inb(mtpt->port.iobase + offset); } ",0 "static void cryptd_hash_final(struct crypto_async_request *req_async, int err) { struct ahash_request *req = ahash_request_cast(req_async); struct cryptd_hash_request_ctx *rctx = ahash_request_ctx(req); if (unlikely(err == -EINPROGRESS)) goto out; err = crypto_shash_final(&rctx->desc, req->result); req->base.complete = rctx->complete; out: local_bh_disable(); rctx->complete(&req->base, err); local_bh_enable(); } ",0 " T1_New_Parser( T1_Parser parser, FT_Stream stream, FT_Memory memory, PSAux_Service psaux ) { FT_Error error; FT_UShort tag; FT_ULong size; psaux->ps_parser_funcs->init( &parser->root, NULL, NULL, memory ); parser->stream = stream; parser->base_len = 0; parser->base_dict = NULL; parser->private_len = 0; parser->private_dict = NULL; parser->in_pfb = 0; parser->in_memory = 0; parser->single_block = 0; /* check the header format */ error = check_type1_format( stream, ""%!PS-AdobeFont"", 14 ); if ( error ) { if ( FT_ERR_NEQ( error, Unknown_File_Format ) ) goto Exit; error = check_type1_format( stream, ""%!FontType"", 10 ); if ( error ) { FT_TRACE2(( "" not a Type 1 font\n"" )); goto Exit; } } /******************************************************************/ /* */ /* Here a short summary of what is going on: */ /* */ /* When creating a new Type 1 parser, we try to locate and load */ /* the base dictionary if this is possible (i.e., for PFB */ /* files). Otherwise, we load the whole font into memory. */ /* */ /* When `loading' the base dictionary, we only setup pointers */ /* in the case of a memory-based stream. Otherwise, we */ /* allocate and load the base dictionary in it. */ /* */ /* parser->in_pfb is set if we are in a binary (`.pfb') font. */ /* parser->in_memory is set if we have a memory stream. */ /* */ /* try to compute the size of the base dictionary; */ /* look for a Postscript binary file tag, i.e., 0x8001 */ if ( FT_STREAM_SEEK( 0L ) ) goto Exit; error = read_pfb_tag( stream, &tag, &size ); if ( error ) goto Exit; if ( tag != 0x8001U ) { /* assume that this is a PFA file for now; an error will */ /* be produced later when more things are checked */ if ( FT_STREAM_SEEK( 0L ) ) goto Exit; size = stream->size; } else parser->in_pfb = 1; /* now, try to load `size' bytes of the `base' dictionary we */ /* found previously */ /* if it is a memory-based resource, set up pointers */ if ( !stream->read ) { parser->base_dict = (FT_Byte*)stream->base + stream->pos; parser->base_len = size; parser->in_memory = 1; /* check that the `size' field is valid */ if ( FT_STREAM_SKIP( size ) ) goto Exit; } else { /* read segment in memory -- this is clumsy, but so does the format */ if ( FT_ALLOC( parser->base_dict, size ) || FT_STREAM_READ( parser->base_dict, size ) ) goto Exit; parser->base_len = size; } parser->root.base = parser->base_dict; parser->root.cursor = parser->base_dict; parser->root.limit = parser->root.cursor + parser->base_len; Exit: if ( error && !parser->in_memory ) FT_FREE( parser->base_dict ); return error; } ",0 "convert_to_enterprise(krb5_context context, krb5_principal princ, krb5_principal *eprinc_out) { krb5_error_code code; char *str; *eprinc_out = NULL; code = krb5_unparse_name(context, princ, &str); if (code != 0) return code; code = krb5_parse_name_flags(context, str, KRB5_PRINCIPAL_PARSE_ENTERPRISE | KRB5_PRINCIPAL_PARSE_IGNORE_REALM, eprinc_out); krb5_free_unparsed_name(context, str); return code; } ",0 "DocumentParser* Document::ImplicitOpen( ParserSynchronizationPolicy parser_sync_policy) { RemoveChildren(); DCHECK(!focused_element_); SetCompatibilityMode(kNoQuirksMode); if (!ThreadedParsingEnabledForTesting()) { parser_sync_policy = kForceSynchronousParsing; } else if (parser_sync_policy == kAllowAsynchronousParsing && IsPrefetchOnly()) { parser_sync_policy = kForceSynchronousParsing; } DetachParser(); parser_sync_policy_ = parser_sync_policy; parser_ = CreateParser(); DocumentParserTiming::From(*this).MarkParserStart(); SetParsingState(kParsing); SetReadyState(kLoading); if (load_event_progress_ != kLoadEventInProgress && PageDismissalEventBeingDispatched() == kNoDismissal) { load_event_progress_ = kLoadEventNotRun; } return parser_; } ",0 "int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, const git_remote_head * const *wants, size_t count) { transport_smart *t = (transport_smart *)transport; gitno_buffer *buf = &t->buffer; git_buf data = GIT_BUF_INIT; git_revwalk *walk = NULL; int error = -1, pkt_type; unsigned int i; git_oid oid; if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0) return error; if ((error = fetch_setup_walk(&walk, repo)) < 0) goto on_error; /* * Our support for ACK extensions is simply to parse them. On * the first ACK we will accept that as enough common * objects. We give up if we haven't found an answer in the * first 256 we send. */ i = 0; while (i < 256) { error = git_revwalk_next(&oid, walk); if (error < 0) { if (GIT_ITEROVER == error) break; goto on_error; } git_pkt_buffer_have(&oid, &data); i++; if (i % 20 == 0) { if (t->cancelled.val) { giterr_set(GITERR_NET, ""The fetch was cancelled by the user""); error = GIT_EUSER; goto on_error; } git_pkt_buffer_flush(&data); if (git_buf_oom(&data)) { error = -1; goto on_error; } if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0) goto on_error; git_buf_clear(&data); if (t->caps.multi_ack || t->caps.multi_ack_detailed) { if ((error = store_common(t)) < 0) goto on_error; } else { pkt_type = recv_pkt(NULL, buf); if (pkt_type == GIT_PKT_ACK) { break; } else if (pkt_type == GIT_PKT_NAK) { continue; } else if (pkt_type < 0) { /* recv_pkt returned an error */ error = pkt_type; goto on_error; } else { giterr_set(GITERR_NET, ""Unexpected pkt type""); error = -1; goto on_error; } } } if (t->common.length > 0) break; if (i % 20 == 0 && t->rpc) { git_pkt_ack *pkt; unsigned int j; if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0) goto on_error; git_vector_foreach(&t->common, j, pkt) { if ((error = git_pkt_buffer_have(&pkt->oid, &data)) < 0) goto on_error; } if (git_buf_oom(&data)) { error = -1; goto on_error; } } } /* Tell the other end that we're done negotiating */ if (t->rpc && t->common.length > 0) { git_pkt_ack *pkt; unsigned int j; if ((error = git_pkt_buffer_wants(wants, count, &t->caps, &data)) < 0) goto on_error; git_vector_foreach(&t->common, j, pkt) { if ((error = git_pkt_buffer_have(&pkt->oid, &data)) < 0) goto on_error; } if (git_buf_oom(&data)) { error = -1; goto on_error; } } if ((error = git_pkt_buffer_done(&data)) < 0) goto on_error; if (t->cancelled.val) { giterr_set(GITERR_NET, ""The fetch was cancelled by the user""); error = GIT_EUSER; goto on_error; } if ((error = git_smart__negotiation_step(&t->parent, data.ptr, data.size)) < 0) goto on_error; git_buf_free(&data); git_revwalk_free(walk); /* Now let's eat up whatever the server gives us */ if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) { pkt_type = recv_pkt(NULL, buf); if (pkt_type < 0) { return pkt_type; } else if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) { giterr_set(GITERR_NET, ""Unexpected pkt type""); return -1; } } else { error = wait_while_ack(buf); } return error; on_error: git_revwalk_free(walk); git_buf_free(&data); return error; } ",0 "IHEVCD_ERROR_T ihevcd_parse_sps(codec_t *ps_codec) { IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; WORD32 value; WORD32 i; WORD32 vps_id; WORD32 sps_max_sub_layers; WORD32 sps_id; WORD32 sps_temporal_id_nesting_flag; sps_t *ps_sps; profile_tier_lvl_info_t s_ptl; bitstrm_t *ps_bitstrm = &ps_codec->s_parse.s_bitstrm; WORD32 ctb_log2_size_y = 0; BITS_PARSE(""video_parameter_set_id"", value, ps_bitstrm, 4); vps_id = value; vps_id = CLIP3(vps_id, 0, MAX_VPS_CNT - 1); BITS_PARSE(""sps_max_sub_layers_minus1"", value, ps_bitstrm, 3); sps_max_sub_layers = value + 1; sps_max_sub_layers = CLIP3(sps_max_sub_layers, 1, 7); BITS_PARSE(""sps_temporal_id_nesting_flag"", value, ps_bitstrm, 1); sps_temporal_id_nesting_flag = value; ret = ihevcd_profile_tier_level(ps_bitstrm, &(s_ptl), 1, (sps_max_sub_layers - 1)); UEV_PARSE(""seq_parameter_set_id"", value, ps_bitstrm); sps_id = value; if((sps_id >= MAX_SPS_CNT) || (sps_id < 0)) { if(ps_codec->i4_sps_done) return IHEVCD_UNSUPPORTED_SPS_ID; else sps_id = 0; } ps_sps = (ps_codec->s_parse.ps_sps_base + MAX_SPS_CNT - 1); ps_sps->i1_sps_id = sps_id; ps_sps->i1_vps_id = vps_id; ps_sps->i1_sps_max_sub_layers = sps_max_sub_layers; ps_sps->i1_sps_temporal_id_nesting_flag = sps_temporal_id_nesting_flag; /* This is used only during initialization to get reorder count etc */ ps_codec->i4_sps_id = sps_id; memcpy(&ps_sps->s_ptl, &s_ptl, sizeof(profile_tier_lvl_info_t)); UEV_PARSE(""chroma_format_idc"", value, ps_bitstrm); ps_sps->i1_chroma_format_idc = value; if(ps_sps->i1_chroma_format_idc != CHROMA_FMT_IDC_YUV420) { ps_codec->s_parse.i4_error_code = IHEVCD_UNSUPPORTED_CHROMA_FMT_IDC; return (IHEVCD_ERROR_T)IHEVCD_UNSUPPORTED_CHROMA_FMT_IDC; } if(CHROMA_FMT_IDC_YUV444_PLANES == ps_sps->i1_chroma_format_idc) { BITS_PARSE(""separate_colour_plane_flag"", value, ps_bitstrm, 1); ps_sps->i1_separate_colour_plane_flag = value; } else { ps_sps->i1_separate_colour_plane_flag = 0; } UEV_PARSE(""pic_width_in_luma_samples"", value, ps_bitstrm); ps_sps->i2_pic_width_in_luma_samples = value; UEV_PARSE(""pic_height_in_luma_samples"", value, ps_bitstrm); ps_sps->i2_pic_height_in_luma_samples = value; if((0 >= ps_sps->i2_pic_width_in_luma_samples) || (0 >= ps_sps->i2_pic_height_in_luma_samples)) return IHEVCD_INVALID_PARAMETER; /* i2_pic_width_in_luma_samples and i2_pic_height_in_luma_samples should be multiples of min_cb_size. Here these are aligned to 8, i.e. smallest CB size */ ps_sps->i2_pic_width_in_luma_samples = ALIGN8(ps_sps->i2_pic_width_in_luma_samples); ps_sps->i2_pic_height_in_luma_samples = ALIGN8(ps_sps->i2_pic_height_in_luma_samples); BITS_PARSE(""pic_cropping_flag"", value, ps_bitstrm, 1); ps_sps->i1_pic_cropping_flag = value; if(ps_sps->i1_pic_cropping_flag) { UEV_PARSE(""pic_crop_left_offset"", value, ps_bitstrm); ps_sps->i2_pic_crop_left_offset = value; UEV_PARSE(""pic_crop_right_offset"", value, ps_bitstrm); ps_sps->i2_pic_crop_right_offset = value; UEV_PARSE(""pic_crop_top_offset"", value, ps_bitstrm); ps_sps->i2_pic_crop_top_offset = value; UEV_PARSE(""pic_crop_bottom_offset"", value, ps_bitstrm); ps_sps->i2_pic_crop_bottom_offset = value; } else { ps_sps->i2_pic_crop_left_offset = 0; ps_sps->i2_pic_crop_right_offset = 0; ps_sps->i2_pic_crop_top_offset = 0; ps_sps->i2_pic_crop_bottom_offset = 0; } UEV_PARSE(""bit_depth_luma_minus8"", value, ps_bitstrm); if(0 != value) return IHEVCD_UNSUPPORTED_BIT_DEPTH; UEV_PARSE(""bit_depth_chroma_minus8"", value, ps_bitstrm); if(0 != value) return IHEVCD_UNSUPPORTED_BIT_DEPTH; UEV_PARSE(""log2_max_pic_order_cnt_lsb_minus4"", value, ps_bitstrm); ps_sps->i1_log2_max_pic_order_cnt_lsb = value + 4; BITS_PARSE(""sps_sub_layer_ordering_info_present_flag"", value, ps_bitstrm, 1); ps_sps->i1_sps_sub_layer_ordering_info_present_flag = value; i = (ps_sps->i1_sps_sub_layer_ordering_info_present_flag ? 0 : (ps_sps->i1_sps_max_sub_layers - 1)); for(; i < ps_sps->i1_sps_max_sub_layers; i++) { UEV_PARSE(""max_dec_pic_buffering"", value, ps_bitstrm); ps_sps->ai1_sps_max_dec_pic_buffering[i] = value + 1; if(ps_sps->ai1_sps_max_dec_pic_buffering[i] > MAX_DPB_SIZE) { return IHEVCD_INVALID_PARAMETER; } UEV_PARSE(""num_reorder_pics"", value, ps_bitstrm); ps_sps->ai1_sps_max_num_reorder_pics[i] = value; if(ps_sps->ai1_sps_max_num_reorder_pics[i] > ps_sps->ai1_sps_max_dec_pic_buffering[i]) { return IHEVCD_INVALID_PARAMETER; } UEV_PARSE(""max_latency_increase"", value, ps_bitstrm); ps_sps->ai1_sps_max_latency_increase[i] = value; } UEV_PARSE(""log2_min_coding_block_size_minus3"", value, ps_bitstrm); ps_sps->i1_log2_min_coding_block_size = value + 3; UEV_PARSE(""log2_diff_max_min_coding_block_size"", value, ps_bitstrm); ps_sps->i1_log2_diff_max_min_coding_block_size = value; ctb_log2_size_y = ps_sps->i1_log2_min_coding_block_size + ps_sps->i1_log2_diff_max_min_coding_block_size; UEV_PARSE(""log2_min_transform_block_size_minus2"", value, ps_bitstrm); ps_sps->i1_log2_min_transform_block_size = value + 2; UEV_PARSE(""log2_diff_max_min_transform_block_size"", value, ps_bitstrm); ps_sps->i1_log2_diff_max_min_transform_block_size = value; ps_sps->i1_log2_max_transform_block_size = ps_sps->i1_log2_min_transform_block_size + ps_sps->i1_log2_diff_max_min_transform_block_size; if ((ps_sps->i1_log2_max_transform_block_size < 0) || (ps_sps->i1_log2_max_transform_block_size > MIN(ctb_log2_size_y, 5))) { return IHEVCD_INVALID_PARAMETER; } ps_sps->i1_log2_ctb_size = ps_sps->i1_log2_min_coding_block_size + ps_sps->i1_log2_diff_max_min_coding_block_size; if((ps_sps->i1_log2_min_coding_block_size < 3) || (ps_sps->i1_log2_min_transform_block_size < 2) || (ps_sps->i1_log2_diff_max_min_transform_block_size < 0) || (ps_sps->i1_log2_max_transform_block_size > ps_sps->i1_log2_ctb_size) || (ps_sps->i1_log2_ctb_size < 4) || (ps_sps->i1_log2_ctb_size > 6)) { return IHEVCD_INVALID_PARAMETER; } ps_sps->i1_log2_min_pcm_coding_block_size = 0; ps_sps->i1_log2_diff_max_min_pcm_coding_block_size = 0; UEV_PARSE(""max_transform_hierarchy_depth_inter"", value, ps_bitstrm); ps_sps->i1_max_transform_hierarchy_depth_inter = value; UEV_PARSE(""max_transform_hierarchy_depth_intra"", value, ps_bitstrm); ps_sps->i1_max_transform_hierarchy_depth_intra = value; /* String has a d (enabled) in order to match with HM */ BITS_PARSE(""scaling_list_enabled_flag"", value, ps_bitstrm, 1); ps_sps->i1_scaling_list_enable_flag = value; if(ps_sps->i1_scaling_list_enable_flag) { COPY_DEFAULT_SCALING_LIST(ps_sps->pi2_scaling_mat); BITS_PARSE(""sps_scaling_list_data_present_flag"", value, ps_bitstrm, 1); ps_sps->i1_sps_scaling_list_data_present_flag = value; if(ps_sps->i1_sps_scaling_list_data_present_flag) ihevcd_scaling_list_data(ps_codec, ps_sps->pi2_scaling_mat); } else { COPY_FLAT_SCALING_LIST(ps_sps->pi2_scaling_mat); } /* String is asymmetric_motion_partitions_enabled_flag instead of amp_enabled_flag in order to match with HM */ BITS_PARSE(""asymmetric_motion_partitions_enabled_flag"", value, ps_bitstrm, 1); ps_sps->i1_amp_enabled_flag = value; BITS_PARSE(""sample_adaptive_offset_enabled_flag"", value, ps_bitstrm, 1); ps_sps->i1_sample_adaptive_offset_enabled_flag = value; BITS_PARSE(""pcm_enabled_flag"", value, ps_bitstrm, 1); ps_sps->i1_pcm_enabled_flag = value; if(ps_sps->i1_pcm_enabled_flag) { BITS_PARSE(""pcm_sample_bit_depth_luma"", value, ps_bitstrm, 4); ps_sps->i1_pcm_sample_bit_depth_luma = value + 1; BITS_PARSE(""pcm_sample_bit_depth_chroma"", value, ps_bitstrm, 4); ps_sps->i1_pcm_sample_bit_depth_chroma = value + 1; UEV_PARSE(""log2_min_pcm_coding_block_size_minus3"", value, ps_bitstrm); ps_sps->i1_log2_min_pcm_coding_block_size = value + 3; UEV_PARSE(""log2_diff_max_min_pcm_coding_block_size"", value, ps_bitstrm); ps_sps->i1_log2_diff_max_min_pcm_coding_block_size = value; BITS_PARSE(""pcm_loop_filter_disable_flag"", value, ps_bitstrm, 1); ps_sps->i1_pcm_loop_filter_disable_flag = value; } UEV_PARSE(""num_short_term_ref_pic_sets"", value, ps_bitstrm); ps_sps->i1_num_short_term_ref_pic_sets = value; ps_sps->i1_num_short_term_ref_pic_sets = CLIP3(ps_sps->i1_num_short_term_ref_pic_sets, 0, MAX_STREF_PICS_SPS); for(i = 0; i < ps_sps->i1_num_short_term_ref_pic_sets; i++) ihevcd_short_term_ref_pic_set(ps_bitstrm, &ps_sps->as_stref_picset[0], ps_sps->i1_num_short_term_ref_pic_sets, i, &ps_sps->as_stref_picset[i]); BITS_PARSE(""long_term_ref_pics_present_flag"", value, ps_bitstrm, 1); ps_sps->i1_long_term_ref_pics_present_flag = value; if(ps_sps->i1_long_term_ref_pics_present_flag) { UEV_PARSE(""num_long_term_ref_pics_sps"", value, ps_bitstrm); ps_sps->i1_num_long_term_ref_pics_sps = value; for(i = 0; i < ps_sps->i1_num_long_term_ref_pics_sps; i++) { BITS_PARSE(""lt_ref_pic_poc_lsb_sps[ i ]"", value, ps_bitstrm, ps_sps->i1_log2_max_pic_order_cnt_lsb); ps_sps->ai1_lt_ref_pic_poc_lsb_sps[i] = value; BITS_PARSE(""used_by_curr_pic_lt_sps_flag[ i ]"", value, ps_bitstrm, 1); ps_sps->ai1_used_by_curr_pic_lt_sps_flag[i] = value; } } BITS_PARSE(""sps_temporal_mvp_enable_flag"", value, ps_bitstrm, 1); ps_sps->i1_sps_temporal_mvp_enable_flag = value; /* Print matches HM 8-2 */ BITS_PARSE(""sps_strong_intra_smoothing_enable_flag"", value, ps_bitstrm, 1); ps_sps->i1_strong_intra_smoothing_enable_flag = value; BITS_PARSE(""vui_parameters_present_flag"", value, ps_bitstrm, 1); ps_sps->i1_vui_parameters_present_flag = value; if(ps_sps->i1_vui_parameters_present_flag) ihevcd_parse_vui_parameters(ps_bitstrm, &ps_sps->s_vui_parameters, ps_sps->i1_sps_max_sub_layers - 1); BITS_PARSE(""sps_extension_flag"", value, ps_bitstrm, 1); { WORD32 numerator; WORD32 ceil_offset; ceil_offset = (1 << ps_sps->i1_log2_ctb_size) - 1; numerator = ps_sps->i2_pic_width_in_luma_samples; ps_sps->i2_pic_wd_in_ctb = ((numerator + ceil_offset) / (1 << ps_sps->i1_log2_ctb_size)); numerator = ps_sps->i2_pic_height_in_luma_samples; ps_sps->i2_pic_ht_in_ctb = ((numerator + ceil_offset) / (1 << ps_sps->i1_log2_ctb_size)); ps_sps->i4_pic_size_in_ctb = ps_sps->i2_pic_ht_in_ctb * ps_sps->i2_pic_wd_in_ctb; if(0 == ps_codec->i4_sps_done) ps_codec->s_parse.i4_next_ctb_indx = ps_sps->i4_pic_size_in_ctb; numerator = ps_sps->i2_pic_width_in_luma_samples; ps_sps->i2_pic_wd_in_min_cb = numerator / (1 << ps_sps->i1_log2_min_coding_block_size); numerator = ps_sps->i2_pic_height_in_luma_samples; ps_sps->i2_pic_ht_in_min_cb = numerator / (1 << ps_sps->i1_log2_min_coding_block_size); } if((0 != ps_codec->i4_first_pic_done) && ((ps_codec->i4_wd != ps_sps->i2_pic_width_in_luma_samples) || (ps_codec->i4_ht != ps_sps->i2_pic_height_in_luma_samples))) { ps_codec->i4_reset_flag = 1; return (IHEVCD_ERROR_T)IVD_RES_CHANGED; } /* Update display width and display height */ { WORD32 disp_wd, disp_ht; WORD32 crop_unit_x, crop_unit_y; crop_unit_x = 1; crop_unit_y = 1; if(CHROMA_FMT_IDC_YUV420 == ps_sps->i1_chroma_format_idc) { crop_unit_x = 2; crop_unit_y = 2; } disp_wd = ps_sps->i2_pic_width_in_luma_samples; disp_wd -= ps_sps->i2_pic_crop_left_offset * crop_unit_x; disp_wd -= ps_sps->i2_pic_crop_right_offset * crop_unit_x; disp_ht = ps_sps->i2_pic_height_in_luma_samples; disp_ht -= ps_sps->i2_pic_crop_top_offset * crop_unit_y; disp_ht -= ps_sps->i2_pic_crop_bottom_offset * crop_unit_y; if((0 >= disp_wd) || (0 >= disp_ht)) return IHEVCD_INVALID_PARAMETER; ps_codec->i4_disp_wd = disp_wd; ps_codec->i4_disp_ht = disp_ht; ps_codec->i4_wd = ps_sps->i2_pic_width_in_luma_samples; ps_codec->i4_ht = ps_sps->i2_pic_height_in_luma_samples; { WORD32 ref_strd; ref_strd = ALIGN32(ps_sps->i2_pic_width_in_luma_samples + PAD_WD); if(ps_codec->i4_strd < ref_strd) { ps_codec->i4_strd = ref_strd; } } if(0 == ps_codec->i4_share_disp_buf) { if(ps_codec->i4_disp_strd < ps_codec->i4_disp_wd) { ps_codec->i4_disp_strd = ps_codec->i4_disp_wd; } } else { if(ps_codec->i4_disp_strd < ps_codec->i4_strd) { ps_codec->i4_disp_strd = ps_codec->i4_strd; } } } ps_codec->i4_sps_done = 1; return ret; } ",1 "AffineTransform& AffineTransform::shear(double sx, double sy) { double a = m_transform[0]; double b = m_transform[1]; m_transform[0] += sy * m_transform[2]; m_transform[1] += sy * m_transform[3]; m_transform[2] += sx * a; m_transform[3] += sx * b; return *this; } ",0 "int __kvm_set_memory_region(struct kvm *kvm, const struct kvm_userspace_memory_region *mem) { int r; gfn_t base_gfn; unsigned long npages; struct kvm_memory_slot *slot; struct kvm_memory_slot old, new; struct kvm_memslots *slots = NULL, *old_memslots; int as_id, id; enum kvm_mr_change change; r = check_memory_region_flags(mem); if (r) goto out; r = -EINVAL; as_id = mem->slot >> 16; id = (u16)mem->slot; /* General sanity checks */ if (mem->memory_size & (PAGE_SIZE - 1)) goto out; if (mem->guest_phys_addr & (PAGE_SIZE - 1)) goto out; /* We can read the guest memory with __xxx_user() later on. */ if ((id < KVM_USER_MEM_SLOTS) && ((mem->userspace_addr & (PAGE_SIZE - 1)) || !access_ok(VERIFY_WRITE, (void __user *)(unsigned long)mem->userspace_addr, mem->memory_size))) goto out; if (as_id >= KVM_ADDRESS_SPACE_NUM || id >= KVM_MEM_SLOTS_NUM) goto out; if (mem->guest_phys_addr + mem->memory_size < mem->guest_phys_addr) goto out; slot = id_to_memslot(__kvm_memslots(kvm, as_id), id); base_gfn = mem->guest_phys_addr >> PAGE_SHIFT; npages = mem->memory_size >> PAGE_SHIFT; if (npages > KVM_MEM_MAX_NR_PAGES) goto out; new = old = *slot; new.id = id; new.base_gfn = base_gfn; new.npages = npages; new.flags = mem->flags; if (npages) { if (!old.npages) change = KVM_MR_CREATE; else { /* Modify an existing slot. */ if ((mem->userspace_addr != old.userspace_addr) || (npages != old.npages) || ((new.flags ^ old.flags) & KVM_MEM_READONLY)) goto out; if (base_gfn != old.base_gfn) change = KVM_MR_MOVE; else if (new.flags != old.flags) change = KVM_MR_FLAGS_ONLY; else { /* Nothing to change. */ r = 0; goto out; } } } else { if (!old.npages) goto out; change = KVM_MR_DELETE; new.base_gfn = 0; new.flags = 0; } if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { /* Check for overlaps */ r = -EEXIST; kvm_for_each_memslot(slot, __kvm_memslots(kvm, as_id)) { if ((slot->id >= KVM_USER_MEM_SLOTS) || (slot->id == id)) continue; if (!((base_gfn + npages <= slot->base_gfn) || (base_gfn >= slot->base_gfn + slot->npages))) goto out; } } /* Free page dirty bitmap if unneeded */ if (!(new.flags & KVM_MEM_LOG_DIRTY_PAGES)) new.dirty_bitmap = NULL; r = -ENOMEM; if (change == KVM_MR_CREATE) { new.userspace_addr = mem->userspace_addr; if (kvm_arch_create_memslot(kvm, &new, npages)) goto out_free; } /* Allocate page dirty bitmap if needed */ if ((new.flags & KVM_MEM_LOG_DIRTY_PAGES) && !new.dirty_bitmap) { if (kvm_create_dirty_bitmap(&new) < 0) goto out_free; } slots = kvm_kvzalloc(sizeof(struct kvm_memslots)); if (!slots) goto out_free; memcpy(slots, __kvm_memslots(kvm, as_id), sizeof(struct kvm_memslots)); if ((change == KVM_MR_DELETE) || (change == KVM_MR_MOVE)) { slot = id_to_memslot(slots, id); slot->flags |= KVM_MEMSLOT_INVALID; old_memslots = install_new_memslots(kvm, as_id, slots); /* slot was deleted or moved, clear iommu mapping */ kvm_iommu_unmap_pages(kvm, &old); /* From this point no new shadow pages pointing to a deleted, * or moved, memslot will be created. * * validation of sp->gfn happens in: * - gfn_to_hva (kvm_read_guest, gfn_to_pfn) * - kvm_is_visible_gfn (mmu_check_roots) */ kvm_arch_flush_shadow_memslot(kvm, slot); /* * We can re-use the old_memslots from above, the only difference * from the currently installed memslots is the invalid flag. This * will get overwritten by update_memslots anyway. */ slots = old_memslots; } r = kvm_arch_prepare_memory_region(kvm, &new, mem, change); if (r) goto out_slots; /* actual memory is freed via old in kvm_free_memslot below */ if (change == KVM_MR_DELETE) { new.dirty_bitmap = NULL; memset(&new.arch, 0, sizeof(new.arch)); } update_memslots(slots, &new); old_memslots = install_new_memslots(kvm, as_id, slots); kvm_arch_commit_memory_region(kvm, mem, &old, &new, change); kvm_free_memslot(kvm, &old, &new); kvfree(old_memslots); /* * IOMMU mapping: New slots need to be mapped. Old slots need to be * un-mapped and re-mapped if their base changes. Since base change * unmapping is handled above with slot deletion, mapping alone is * needed here. Anything else the iommu might care about for existing * slots (size changes, userspace addr changes and read-only flag * changes) is disallowed above, so any other attribute changes getting * here can be skipped. */ if ((change == KVM_MR_CREATE) || (change == KVM_MR_MOVE)) { r = kvm_iommu_map_pages(kvm, &new); return r; } return 0; out_slots: kvfree(slots); out_free: kvm_free_memslot(kvm, &new, &old); out: return r; } ",0 "static u32 nested_vmx_load_msr(struct kvm_vcpu *vcpu, u64 gpa, u32 count) { u32 i; struct vmx_msr_entry e; struct msr_data msr; msr.host_initiated = false; for (i = 0; i < count; i++) { if (kvm_vcpu_read_guest(vcpu, gpa + i * sizeof(e), &e, sizeof(e))) { pr_warn_ratelimited( ""%s cannot read MSR entry (%u, 0x%08llx)\n"", __func__, i, gpa + i * sizeof(e)); goto fail; } if (nested_vmx_load_msr_check(vcpu, &e)) { pr_warn_ratelimited( ""%s check failed (%u, 0x%x, 0x%x)\n"", __func__, i, e.index, e.reserved); goto fail; } msr.index = e.index; msr.data = e.value; if (kvm_set_msr(vcpu, &msr)) { pr_warn_ratelimited( ""%s cannot write MSR (%u, 0x%x, 0x%llx)\n"", __func__, i, e.index, e.value); goto fail; } } return 0; fail: return i + 1; } ",0 " AsyncPixelTransferCompletionObserverImpl(base::subtle::Atomic32 submit_count) : submit_count_(submit_count), cancelled_(false) {} ",0 " ResizeLock(aura::RootWindow* root_window, const gfx::Size new_size, bool defer_compositor_lock) : root_window_(root_window), new_size_(new_size), compositor_lock_(defer_compositor_lock ? NULL : root_window_->compositor()->GetCompositorLock()), weak_ptr_factory_(this), defer_compositor_lock_(defer_compositor_lock) { root_window_->HoldMouseMoves(); BrowserThread::PostDelayedTask( BrowserThread::UI, FROM_HERE, base::Bind(&RenderWidgetHostViewAura::ResizeLock::CancelLock, weak_ptr_factory_.GetWeakPtr()), base::TimeDelta::FromMilliseconds(kResizeLockTimeoutMs)); } ",0 "void RenderBox::clearLayoutOverflow() { if (!m_overflow) return; if (!hasVisualOverflow() && contentsVisualOverflowRect().isEmpty()) { m_overflow.clear(); return; } m_overflow->setLayoutOverflow(noOverflowRect()); } ",0 "static void nfs_init_cinfo_from_inode(struct nfs_commit_info *cinfo, struct inode *inode) { } ",0 " void cipso_v4_req_delattr(struct request_sock *req) { struct ip_options *opt; struct inet_request_sock *req_inet; req_inet = inet_rsk(req); opt = req_inet->opt; if (opt == NULL || opt->cipso == 0) return; cipso_v4_delopt(&req_inet->opt); } ",1 "DOMHighResTimeStamp GetUnixAtZeroMonotonic() { DEFINE_THREAD_SAFE_STATIC_LOCAL( DOMHighResTimeStamp, unix_at_zero_monotonic, {ConvertSecondsToDOMHighResTimeStamp(CurrentTime() - CurrentTimeTicksInSeconds())}); return unix_at_zero_monotonic; } ",0 "struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb, u32 user) { struct sk_buff *clone; struct net_device *dev = skb->dev; struct frag_hdr *fhdr; struct nf_ct_frag6_queue *fq; struct ipv6hdr *hdr; int fhoff, nhoff; u8 prevhdr; struct sk_buff *ret_skb = NULL; /* Jumbo payload inhibits frag. header */ if (ipv6_hdr(skb)->payload_len == 0) { pr_debug(""payload len = 0\n""); return skb; } if (find_prev_fhdr(skb, &prevhdr, &nhoff, &fhoff) < 0) return skb; clone = skb_clone(skb, GFP_ATOMIC); if (clone == NULL) { pr_debug(""Can't clone skb\n""); return skb; } NFCT_FRAG6_CB(clone)->orig = skb; if (!pskb_may_pull(clone, fhoff + sizeof(*fhdr))) { pr_debug(""message is too short.\n""); goto ret_orig; } skb_set_transport_header(clone, fhoff); hdr = ipv6_hdr(clone); fhdr = (struct frag_hdr *)skb_transport_header(clone); if (!(fhdr->frag_off & htons(0xFFF9))) { pr_debug(""Invalid fragment offset\n""); /* It is not a fragmented frame */ goto ret_orig; } if (atomic_read(&nf_init_frags.mem) > nf_init_frags.high_thresh) nf_ct_frag6_evictor(); fq = fq_find(fhdr->identification, user, &hdr->saddr, &hdr->daddr); if (fq == NULL) { pr_debug(""Can't find and can't create new queue\n""); goto ret_orig; } spin_lock_bh(&fq->q.lock); if (nf_ct_frag6_queue(fq, clone, fhdr, nhoff) < 0) { spin_unlock_bh(&fq->q.lock); pr_debug(""Can't insert skb to queue\n""); fq_put(fq); goto ret_orig; } if (fq->q.last_in == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) && fq->q.meat == fq->q.len) { ret_skb = nf_ct_frag6_reasm(fq, dev); if (ret_skb == NULL) pr_debug(""Can't reassemble fragmented packets\n""); } spin_unlock_bh(&fq->q.lock); fq_put(fq); return ret_skb; ret_orig: kfree_skb(clone); return skb; } ",1 "static inline void ModulateLCHab(const double percent_luma, const double percent_chroma,const double percent_hue,double *red, double *green,double *blue) { double hue, luma, chroma; /* Increase or decrease color luma, chroma, or hue. */ ConvertRGBToLCHab(*red,*green,*blue,&luma,&chroma,&hue); luma*=0.01*percent_luma; chroma*=0.01*percent_chroma; hue+=0.5*(0.01*percent_hue-1.0); while (hue < 0.0) hue+=1.0; while (hue >= 1.0) hue-=1.0; ConvertLCHabToRGB(luma,chroma,hue,red,green,blue); } ",0 "RenderProcessHost* RenderProcessHostImpl::CreateOrUseSpareRenderProcessHost( BrowserContext* browser_context, StoragePartitionImpl* storage_partition_impl, SiteInstance* site_instance, bool is_for_guests_only) { RenderProcessHost* render_process_host = g_spare_render_process_host_manager.Get().MaybeTakeSpareRenderProcessHost( browser_context, storage_partition_impl, site_instance, is_for_guests_only); if (!render_process_host) { render_process_host = CreateRenderProcessHost(browser_context, storage_partition_impl, site_instance, is_for_guests_only); } DCHECK(render_process_host); return render_process_host; } ",0 "u32 OutputPicture(dpbStorage_t *dpb) { /* Variables */ dpbPicture_t *tmp; /* Code */ ASSERT(dpb); if (dpb->noReordering) return(HANTRO_NOK); tmp = FindSmallestPicOrderCnt(dpb); /* no pictures to be displayed */ if (tmp == NULL) return(HANTRO_NOK); dpb->outBuf[dpb->numOut].data = tmp->data; dpb->outBuf[dpb->numOut].isIdr = tmp->isIdr; dpb->outBuf[dpb->numOut].picId = tmp->picId; dpb->outBuf[dpb->numOut].numErrMbs = tmp->numErrMbs; dpb->numOut++; tmp->toBeDisplayed = HANTRO_FALSE; if (!IS_REFERENCE(*tmp)) { dpb->fullness--; } return(HANTRO_OK); } ",0 "void ScreenOrientationDispatcherHost::NotifyLockSuccess(int request_id) { RenderFrameHost* render_frame_host = GetRenderFrameHostForRequestID(request_id); if (!render_frame_host) return; render_frame_host->Send(new ScreenOrientationMsg_LockSuccess( render_frame_host->GetRoutingID(), request_id)); ResetCurrentLock(); } ",0 "enum AVCodecID ff_mov_get_lpcm_codec_id(int bps, int flags) { /* lpcm flags: * 0x1 = float * 0x2 = big-endian * 0x4 = signed */ return ff_get_pcm_codec_id(bps, flags & 1, flags & 2, flags & 4 ? -1 : 0); } ",0 "static int AppLayerProtoDetectTest11(void) { AppLayerProtoDetectUnittestCtxBackup(); AppLayerProtoDetectSetup(); uint8_t l7data[] = ""CONNECT www.ssllabs.com:443 HTTP/1.0\r\n""; uint8_t l7data_resp[] = ""HTTP/1.1 405 Method Not Allowed\r\n""; int r = 0; Flow f; AppProto pm_results[ALPROTO_MAX]; AppLayerProtoDetectThreadCtx *alpd_tctx; memset(&f, 0x00, sizeof(f)); f.protomap = FlowGetProtoMapping(IPPROTO_TCP); memset(pm_results, 0, sizeof(pm_results)); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, ""HTTP"", 4, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, ""GET"", 3, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, ""PUT"", 3, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, ""POST"", 4, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, ""TRACE"", 5, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, ""OPTIONS"", 7, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, ""CONNECT"", 7, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_TCP, ALPROTO_HTTP, ""HTTP"", 4, 0, STREAM_TOCLIENT); AppLayerProtoDetectPrepareState(); /* AppLayerProtoDetectGetCtxThread() should be called post AppLayerProtoDetectPrepareState(), since * it sets internal structures which depends on the above function. */ alpd_tctx = AppLayerProtoDetectGetCtxThread(); if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].max_pat_id != 7) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].max_pat_id != 7\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].max_pat_id != 1) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].max_pat_id != 1\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map == NULL) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map != NULL\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map == NULL) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map != NULL\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map[0]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map[1]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map[2]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map[3]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map[4]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map[5]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[0].map[6]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_TCP].ctx_pm[1].map[0]->alproto != ALPROTO_HTTP) { printf(""failure 1\n""); goto end; } memset(pm_results, 0, sizeof(pm_results)); uint32_t cnt = AppLayerProtoDetectPMGetProto(alpd_tctx, &f, l7data, sizeof(l7data), STREAM_TOSERVER, IPPROTO_TCP, pm_results); if (cnt != 1 && pm_results[0] != ALPROTO_HTTP) { printf(""l7data - cnt != 1 && pm_results[0] != AlPROTO_HTTP\n""); goto end; } memset(pm_results, 0, sizeof(pm_results)); cnt = AppLayerProtoDetectPMGetProto(alpd_tctx, &f, l7data_resp, sizeof(l7data_resp), STREAM_TOCLIENT, IPPROTO_TCP, pm_results); if (cnt != 1 && pm_results[0] != ALPROTO_HTTP) { printf(""l7data_resp - cnt != 1 && pm_results[0] != AlPROTO_HTTP\n""); goto end; } r = 1; end: if (alpd_tctx != NULL) AppLayerProtoDetectDestroyCtxThread(alpd_tctx); AppLayerProtoDetectDeSetup(); AppLayerProtoDetectUnittestCtxRestore(); return r; } ",0 "static int tg3_ape_wait_for_event(struct tg3 *tp, u32 timeout_us) { u32 i, apedata; for (i = 0; i < timeout_us / 10; i++) { apedata = tg3_ape_read32(tp, TG3_APE_EVENT_STATUS); if (!(apedata & APE_EVENT_STATUS_EVENT_PENDING)) break; udelay(10); } return i == timeout_us / 10; } ",0 "static int vlan_dev_neigh_setup(struct net_device *dev, struct neigh_parms *pa) { struct net_device *real_dev = vlan_dev_info(dev)->real_dev; const struct net_device_ops *ops = real_dev->netdev_ops; int err = 0; if (netif_device_present(real_dev) && ops->ndo_neigh_setup) err = ops->ndo_neigh_setup(real_dev, pa); return err; } ",0 "kex_derive_keys_bn(struct ssh *ssh, u_char *hash, u_int hashlen, const BIGNUM *secret) { struct sshbuf *shared_secret; int r; if ((shared_secret = sshbuf_new()) == NULL) return SSH_ERR_ALLOC_FAIL; if ((r = sshbuf_put_bignum2(shared_secret, secret)) == 0) r = kex_derive_keys(ssh, hash, hashlen, shared_secret); sshbuf_free(shared_secret); return r; } ",0 "bool ConfirmInfoBarDelegate::EqualsDelegate(InfoBarDelegate* delegate) const { ConfirmInfoBarDelegate* confirm_delegate = delegate->AsConfirmInfoBarDelegate(); return confirm_delegate && (confirm_delegate->GetMessageText() == GetMessageText()); } ",0 "void nfs_commit_free(struct nfs_commit_data *p) { mempool_free(p, nfs_commit_mempool); } ",0 "void HTMLMediaElement::setSrc(const AtomicString& url) { setAttribute(srcAttr, url); } ",0 "v8::Handle V8WebKitMutationObserver::observeCallback(const v8::Arguments& args) { INC_STATS(""DOM.WebKitMutationObserver.observe""); if (args.Length() < 2) return V8Proxy::throwNotEnoughArgumentsError(); WebKitMutationObserver* imp = V8WebKitMutationObserver::toNative(args.Holder()); EXCEPTION_BLOCK(Node*, target, V8Node::HasInstance(args[0]) ? V8Node::toNative(v8::Handle::Cast(args[0])) : 0); if (!args[1]->IsObject()) return throwError(TYPE_MISMATCH_ERR, args.GetIsolate()); Dictionary optionsObject(args[1]); unsigned options = 0; HashSet attributeFilter; bool option; if (optionsObject.get(""childList"", option) && option) options |= WebKitMutationObserver::ChildList; if (optionsObject.get(""attributes"", option) && option) options |= WebKitMutationObserver::Attributes; if (optionsObject.get(""attributeFilter"", attributeFilter)) options |= WebKitMutationObserver::AttributeFilter; if (optionsObject.get(""characterData"", option) && option) options |= WebKitMutationObserver::CharacterData; if (optionsObject.get(""subtree"", option) && option) options |= WebKitMutationObserver::Subtree; if (optionsObject.get(""attributeOldValue"", option) && option) options |= WebKitMutationObserver::AttributeOldValue; if (optionsObject.get(""characterDataOldValue"", option) && option) options |= WebKitMutationObserver::CharacterDataOldValue; ExceptionCode ec = 0; imp->observe(target, options, attributeFilter, ec); if (ec) V8Proxy::setDOMException(ec, args.GetIsolate()); return v8::Handle(); } ",1 "void ServiceWorkerContextCore::OnControlleeAdded( ServiceWorkerVersion* version, const std::string& client_uuid, const ServiceWorkerClientInfo& client_info) { observer_list_->Notify( FROM_HERE, &ServiceWorkerContextCoreObserver::OnControlleeAdded, version->version_id(), version->scope(), client_uuid, client_info); } ",0 "int dtls1_read_bytes(SSL *s, int type, int *recvd_type, unsigned char *buf, int len, int peek) { int al, i, j, ret; unsigned int n; SSL3_RECORD *rr; void (*cb) (const SSL *ssl, int type2, int val) = NULL; if (!SSL3_BUFFER_is_initialised(&s->rlayer.rbuf)) { /* Not initialized yet */ if (!ssl3_setup_buffers(s)) return (-1); } if ((type && (type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE)) || (peek && (type != SSL3_RT_APPLICATION_DATA))) { SSLerr(SSL_F_DTLS1_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } /* * check whether there's a handshake message (client hello?) waiting */ if ((ret = have_handshake_fragment(s, type, buf, len))) return ret; /* * Now s->rlayer.d->handshake_fragment_len == 0 if * type == SSL3_RT_HANDSHAKE. */ #ifndef OPENSSL_NO_SCTP /* * Continue handshake if it had to be interrupted to read app data with * SCTP. */ if ((!ossl_statem_get_in_handshake(s) && SSL_in_init(s)) || (BIO_dgram_is_sctp(SSL_get_rbio(s)) && ossl_statem_in_sctp_read_sock(s) && s->s3->in_read_app_data != 2)) #else if (!ossl_statem_get_in_handshake(s) && SSL_in_init(s)) #endif { /* type == SSL3_RT_APPLICATION_DATA */ i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_DTLS1_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } } start: s->rwstate = SSL_NOTHING; /*- * s->s3->rrec.type - is the type of record * s->s3->rrec.data, - data * s->s3->rrec.off, - offset into 'data' for next read * s->s3->rrec.length, - number of bytes. */ rr = s->rlayer.rrec; /* * We are not handshaking and have no data yet, so process data buffered * during the last handshake in advance, if any. */ if (SSL_is_init_finished(s) && SSL3_RECORD_get_length(rr) == 0) { pitem *item; item = pqueue_pop(s->rlayer.d->buffered_app_data.q); if (item) { #ifndef OPENSSL_NO_SCTP /* Restore bio_dgram_sctp_rcvinfo struct */ if (BIO_dgram_is_sctp(SSL_get_rbio(s))) { DTLS1_RECORD_DATA *rdata = (DTLS1_RECORD_DATA *)item->data; BIO_ctrl(SSL_get_rbio(s), BIO_CTRL_DGRAM_SCTP_SET_RCVINFO, sizeof(rdata->recordinfo), &rdata->recordinfo); } #endif dtls1_copy_record(s, item); OPENSSL_free(item->data); pitem_free(item); } } /* Check for timeout */ if (dtls1_handle_timeout(s) > 0) goto start; /* get new packet if necessary */ if ((SSL3_RECORD_get_length(rr) == 0) || (s->rlayer.rstate == SSL_ST_READ_BODY)) { ret = dtls1_get_record(s); if (ret <= 0) { ret = dtls1_read_failed(s, ret); /* anything other than a timeout is an error */ if (ret <= 0) return (ret); else goto start; } } /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, SSL3_RECORD_get_seq_num(rr)) < 0) { SSLerr(SSL_F_DTLS1_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } SSL3_RECORD_set_length(rr, 0); goto start; } ",1 "void regulator_bulk_unregister_supply_alias(struct device *dev, const char *const *id, int num_id) { int i; for (i = 0; i < num_id; ++i) regulator_unregister_supply_alias(dev, id[i]); } ",0 "int perf_event_refresh(struct perf_event *event, int refresh) { struct perf_event_context *ctx; int ret; ctx = perf_event_ctx_lock(event); ret = _perf_event_refresh(event, refresh); perf_event_ctx_unlock(event, ctx); return ret; } ",0 "bool IsEnterpriseManaged() { policy::BrowserPolicyConnectorChromeOS* connector = g_browser_process->platform_part()->browser_policy_connector_chromeos(); return connector->IsEnterpriseManaged(); } ",0 "xsltParseStylesheetInclude(xsltStylesheetPtr style, xmlNodePtr cur) { int ret = -1; xmlDocPtr oldDoc; xmlChar *base = NULL; xmlChar *uriRef = NULL; xmlChar *URI = NULL; xsltStylesheetPtr result; xsltDocumentPtr include; xsltDocumentPtr docptr; int oldNopreproc; if ((cur == NULL) || (style == NULL)) return (ret); uriRef = xmlGetNsProp(cur, (const xmlChar *)""href"", NULL); if (uriRef == NULL) { xsltTransformError(NULL, style, cur, ""xsl:include : missing href attribute\n""); goto error; } base = xmlNodeGetBase(style->doc, cur); URI = xmlBuildURI(uriRef, base); if (URI == NULL) { xsltTransformError(NULL, style, cur, ""xsl:include : invalid URI reference %s\n"", uriRef); goto error; } /* * in order to detect recursion, we check all previously included * stylesheets. */ docptr = style->includes; while (docptr != NULL) { if (xmlStrEqual(docptr->doc->URL, URI)) { xsltTransformError(NULL, style, cur, ""xsl:include : recursion detected on included URL %s\n"", URI); goto error; } docptr = docptr->includes; } include = xsltLoadStyleDocument(style, URI); if (include == NULL) { xsltTransformError(NULL, style, cur, ""xsl:include : unable to load %s\n"", URI); goto error; } #ifdef XSLT_REFACTORED if (IS_XSLT_ELEM_FAST(cur) && (cur->psvi != NULL)) { ((xsltStyleItemIncludePtr) cur->psvi)->include = include; } else { xsltTransformError(NULL, style, cur, ""Internal error: (xsltParseStylesheetInclude) "" ""The xsl:include element was not compiled.\n"", URI); style->errors++; } #endif oldDoc = style->doc; style->doc = include->doc; /* chain to stylesheet for recursion checking */ include->includes = style->includes; style->includes = include; oldNopreproc = style->nopreproc; style->nopreproc = include->preproc; /* * TODO: This will change some values of the * including stylesheet with every included module * (e.g. excluded-result-prefixes) * We need to strictly seperate such stylesheet-owned values. */ result = xsltParseStylesheetProcess(style, include->doc); style->nopreproc = oldNopreproc; include->preproc = 1; style->includes = include->includes; style->doc = oldDoc; if (result == NULL) { ret = -1; goto error; } ret = 0; error: if (uriRef != NULL) xmlFree(uriRef); if (base != NULL) xmlFree(base); if (URI != NULL) xmlFree(URI); return (ret); } ",0 "static RAnalValue *anal_fill_r0_reg_ref(RAnal *anal, int reg, st64 size){ RAnalValue *ret = anal_fill_ai_rg (anal, 0); ret->regdelta = r_reg_get (anal->reg, regs[reg], R_REG_TYPE_GPR); ret->memref = size; return ret; } ",0 "void mem_cgroup_uncharge_cache_page(struct page *page) { VM_BUG_ON(page_mapped(page)); VM_BUG_ON(page->mapping); __mem_cgroup_uncharge_common(page, MEM_CGROUP_CHARGE_TYPE_CACHE); } ",0 "struct dentry *d_alloc(struct dentry * parent, const struct qstr *name) { struct dentry *dentry = __d_alloc(parent->d_sb, name); if (!dentry) return NULL; dentry->d_flags |= DCACHE_RCUACCESS; spin_lock(&parent->d_lock); /* * don't need child lock because it is not subject * to concurrency here */ __dget_dlock(parent); dentry->d_parent = parent; list_add(&dentry->d_child, &parent->d_subdirs); spin_unlock(&parent->d_lock); return dentry; } ",0 "static void writeExifTagAndData(int tag, int format, long components, long value, int valueInString, char* Buffer, int* DirIndex, int* DataWriteIndex) { void* componentsPosition = NULL; // for saving component position Put16u(Buffer+ (*DirIndex), tag); // Tag Put16u(Buffer+(*DirIndex) + 2, format); // Format if (format == FMT_STRING && components == -1) { components = strlen((char*)value) + 1; // account for null terminator if (components & 1) ++components; // no odd lengths } else if (format == FMT_SSHORT && components == -1) { components = 1; } if (format == FMT_UNDEFINED && components == -1) { if(memcmp((char*)value, ExifAsciiPrefix, sizeof(ExifAsciiPrefix)) == 0) { components = sizeof(ExifAsciiPrefix) + strlen((char*)value + sizeof(ExifAsciiPrefix)) + 1; if (components & 1) ++components; // no odd lengths } } Put32u(Buffer+(*DirIndex) + 4, components); // Components componentsPosition = Buffer+(*DirIndex) + 4; // components # can change for lists printf(""# components: %ld"", components); if (format == FMT_STRING) { if (components <= 4) { strcpy(Buffer+(*DirIndex) + 8, (char*)value); } else { Put32u(Buffer+(*DirIndex) + 8, (*DataWriteIndex)-8); // Pointer printf(""copying value %s to %d"", (char*)value, (*DataWriteIndex)); strncpy(Buffer+(*DataWriteIndex), (char*)value, components); (*DataWriteIndex) += components; } } else if ((format == FMT_UNDEFINED) && (memcmp((char*)value, ExifAsciiPrefix, sizeof(ExifAsciiPrefix)) == 0)) { if (components <= 4) { memcpy(Buffer+(*DirIndex) + 8, (char*)value, components); } else { Put32u(Buffer+(*DirIndex) + 8, (*DataWriteIndex)-8); // Pointer printf(""copying %s to %d"", (char*)value + sizeof(ExifAsciiPrefix), (*DataWriteIndex)); memcpy(Buffer+(*DataWriteIndex), (char*)value, components); (*DataWriteIndex) += components; } } else if (!valueInString) { Put32u(Buffer+(*DirIndex) + 8, value); // Value } else { Put32u(Buffer+(*DirIndex) + 8, (*DataWriteIndex)-8); // Pointer char* curElement = strtok((char*)value, "",:""); int i; for (i = 0; ((i < components) || (components == -1)) && curElement != NULL; i++) { #ifdef SUPERDEBUG printf(""processing component %s format %s"", curElement, formatStr(format)); #endif if (format == FMT_URATIONAL) { unsigned int numerator; unsigned int denominator; char* separator = strchr(curElement, '/'); if (separator) { numerator = atoi(curElement); denominator = atoi(separator + 1); } else { double value = atof(curElement); ConvertDoubleToURational(value, &numerator, &denominator); } Put32u(Buffer+(*DataWriteIndex), numerator); Put32u(Buffer+(*DataWriteIndex) + 4, denominator); (*DataWriteIndex) += 8; } else if (format == FMT_SRATIONAL) { int numerator; int denominator; char* separator = strchr(curElement, '/'); if (separator) { numerator = atoi(curElement); denominator = atoi(separator + 1); } else { double value = atof(curElement); ConvertDoubleToSRational(value, &numerator, &denominator); } Put32u(Buffer+(*DataWriteIndex), numerator); Put32u(Buffer+(*DataWriteIndex) + 4, denominator); (*DataWriteIndex) += 8; } else if ((components == -1) && ((format == FMT_USHORT) || (format == FMT_SSHORT))) { value = atoi(curElement); Put16u(Buffer+(*DataWriteIndex), value); (*DataWriteIndex) += 4; } else { value = atoi(curElement); Put32u(Buffer+(*DirIndex) + 8, value); // Value } curElement = strtok(NULL, "",:""); } if (components == -1) Put32u(componentsPosition, i); // update component # for unknowns } (*DirIndex) += 12; } ",0 "v8::Handle V8WebGLRenderingContext::uniform4ivCallback(const v8::Arguments& args) { INC_STATS(""DOM.WebGLRenderingContext.uniform4iv()""); return uniformHelperi(args, kUniform4v); } ",0 "AudioFlinger::EffectChain::EffectChain(ThreadBase *thread, audio_session_t sessionId) : mThread(thread), mSessionId(sessionId), mActiveTrackCnt(0), mTrackCnt(0), mTailBufferCount(0), mOwnInBuffer(false), mVolumeCtrlIdx(-1), mLeftVolume(UINT_MAX), mRightVolume(UINT_MAX), mNewLeftVolume(UINT_MAX), mNewRightVolume(UINT_MAX), mForceVolume(false) { mStrategy = AudioSystem::getStrategyForStream(AUDIO_STREAM_MUSIC); if (thread == NULL) { return; } mMaxTailBuffers = ((kProcessTailDurationMs * thread->sampleRate()) / 1000) / thread->frameCount(); } ",0 "void GLES2DecoderImpl::DoVertexAttribI4uiv(GLuint index, const volatile GLuint* v) { GLuint t[4] = {v[0], v[1], v[2], v[3]}; if (SetVertexAttribValue(""glVertexAttribI4uiv"", index, t)) { state_.SetGenericVertexAttribBaseType( index, SHADER_VARIABLE_UINT); api()->glVertexAttribI4uivFn(index, t); } } ",0 "static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, zval * dn, zval * attribs TSRMLS_DC) { STACK_OF(CONF_VALUE) * dn_sk, *attr_sk = NULL; char * str, *dn_sect, *attr_sect; dn_sect = CONF_get_string(req->req_config, req->section_name, ""distinguished_name""); if (dn_sect == NULL) { return FAILURE; } dn_sk = CONF_get_section(req->req_config, dn_sect); if (dn_sk == NULL) { return FAILURE; } attr_sect = CONF_get_string(req->req_config, req->section_name, ""attributes""); if (attr_sect == NULL) { attr_sk = NULL; } else { attr_sk = CONF_get_section(req->req_config, attr_sect); if (attr_sk == NULL) { return FAILURE; } } /* setup the version number: version 1 */ if (X509_REQ_set_version(csr, 0L)) { int i, nid; char * type; CONF_VALUE * v; X509_NAME * subj; HashPosition hpos; zval ** item; subj = X509_REQ_get_subject_name(csr); /* apply values from the dn hash */ zend_hash_internal_pointer_reset_ex(HASH_OF(dn), &hpos); while(zend_hash_get_current_data_ex(HASH_OF(dn), (void**)&item, &hpos) == SUCCESS) { char * strindex = NULL; uint strindexlen = 0; ulong intindex; zend_hash_get_current_key_ex(HASH_OF(dn), &strindex, &strindexlen, &intindex, 0, &hpos); convert_to_string_ex(item); if (strindex) { int nid; nid = OBJ_txt2nid(strindex); if (nid != NID_undef) { if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_UTF8, (unsigned char*)Z_STRVAL_PP(item), -1, -1, 0)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""dn: add_entry_by_NID %d -> %s (failed; check error"" "" queue and value of string_mask OpenSSL option "" ""if illegal characters are reported)"", nid, Z_STRVAL_PP(item)); return FAILURE; } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""dn: %s is not a recognized name"", strindex); } } zend_hash_move_forward_ex(HASH_OF(dn), &hpos); } /* Finally apply defaults from config file */ for(i = 0; i < sk_CONF_VALUE_num(dn_sk); i++) { int len; char buffer[200 + 1]; /*200 + \0 !*/ v = sk_CONF_VALUE_value(dn_sk, i); type = v->name; len = strlen(type); if (len < sizeof(""_default"")) { continue; } len -= sizeof(""_default"") - 1; if (strcmp(""_default"", type + len) != 0) { continue; } if (len > 200) { len = 200; } memcpy(buffer, type, len); buffer[len] = '\0'; type = buffer; /* Skip past any leading X. X: X, etc to allow for multiple * instances */ for (str = type; *str; str++) { if (*str == ':' || *str == ',' || *str == '.') { str++; if (*str) { type = str; } break; } } /* if it is already set, skip this */ nid = OBJ_txt2nid(type); if (X509_NAME_get_index_by_NID(subj, nid, -1) >= 0) { continue; } if (!X509_NAME_add_entry_by_txt(subj, type, MBSTRING_UTF8, (unsigned char*)v->value, -1, -1, 0)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""add_entry_by_txt %s -> %s (failed)"", type, v->value); return FAILURE; } if (!X509_NAME_entry_count(subj)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""no objects specified in config file""); return FAILURE; } } if (attribs) { zend_hash_internal_pointer_reset_ex(HASH_OF(attribs), &hpos); while(zend_hash_get_current_data_ex(HASH_OF(attribs), (void**)&item, &hpos) == SUCCESS) { char *strindex = NULL; uint strindexlen; ulong intindex; zend_hash_get_current_key_ex(HASH_OF(attribs), &strindex, &strindexlen, &intindex, 0, &hpos); convert_to_string_ex(item); if (strindex) { int nid; nid = OBJ_txt2nid(strindex); if (nid != NID_undef) { if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_UTF8, (unsigned char*)Z_STRVAL_PP(item), -1, -1, 0)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""attribs: add_entry_by_NID %d -> %s (failed)"", nid, Z_STRVAL_PP(item)); return FAILURE; } } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""dn: %s is not a recognized name"", strindex); } } zend_hash_move_forward_ex(HASH_OF(attribs), &hpos); } for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++) { v = sk_CONF_VALUE_value(attr_sk, i); /* if it is already set, skip this */ nid = OBJ_txt2nid(v->name); if (X509_REQ_get_attr_by_NID(csr, nid, -1) >= 0) { continue; } if (!X509_REQ_add1_attr_by_txt(csr, v->name, MBSTRING_UTF8, (unsigned char*)v->value, -1)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""add1_attr_by_txt %s -> %s (failed; check error queue "" ""and value of string_mask OpenSSL option if illegal "" ""characters are reported)"", v->name, v->value); return FAILURE; } } } } X509_REQ_set_pubkey(csr, req->priv_key); return SUCCESS; } ",0 "static void UseToImpl4ArgumentsCheckingIfPossibleWithOptionalArgMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute(""useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg"", ""TestObject"", ExceptionMessages::NotEnoughArguments(1, info.Length()))); return; } Node* node_1; Node* node_2; int num_args_passed = info.Length(); while (num_args_passed > 0) { if (!info[num_args_passed - 1]->IsUndefined()) break; --num_args_passed; } node_1 = V8Node::ToImplWithTypeCheck(info.GetIsolate(), info[0]); if (!node_1) { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute(""useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg"", ""TestObject"", ExceptionMessages::ArgumentNotOfType(0, ""Node""))); return; } if (UNLIKELY(num_args_passed <= 1)) { impl->useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg(node_1); return; } node_2 = V8Node::ToImplWithTypeCheck(info.GetIsolate(), info[1]); if (!node_2) { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute(""useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg"", ""TestObject"", ExceptionMessages::ArgumentNotOfType(1, ""Node""))); return; } impl->useToImpl4ArgumentsCheckingIfPossibleWithOptionalArg(node_1, node_2); } ",0 "void SSLManager::DidChangeSSLInternalState() { UpdateEntry( NavigationEntryImpl::FromNavigationEntry(controller_->GetActiveEntry())); } ",0 "pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags) { return _do_fork(flags|CLONE_VM|CLONE_UNTRACED, (unsigned long)fn, (unsigned long)arg, NULL, NULL, 0); } ",0 "GLuint GLES2DecoderImpl::DoGetMaxValueInBufferCHROMIUM( GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { GLuint max_vertex_accessed = 0; BufferManager::BufferInfo* info = GetBufferInfo(buffer_id); if (!info) { SetGLError(GL_INVALID_VALUE, ""GetMaxValueInBufferCHROMIUM: unknown buffer""); } else { if (!info->GetMaxValueForRange(offset, count, type, &max_vertex_accessed)) { SetGLError( GL_INVALID_OPERATION, ""GetMaxValueInBufferCHROMIUM: range out of bounds for buffer""); } } return max_vertex_accessed; } ",0 "struct hd_struct *disk_get_part(struct gendisk *disk, int partno) { struct hd_struct *part = NULL; struct disk_part_tbl *ptbl; if (unlikely(partno < 0)) return NULL; rcu_read_lock(); ptbl = rcu_dereference(disk->part_tbl); if (likely(partno < ptbl->len)) { part = rcu_dereference(ptbl->part[partno]); if (part) get_device(part_to_dev(part)); } rcu_read_unlock(); return part; } ",0 "static void free_utc(struct user_ta_ctx *utc) { struct user_ta_elf *elf; tee_pager_rem_uta_areas(utc); TAILQ_FOREACH(elf, &utc->elfs, link) release_ta_memory_by_mobj(elf->mobj_code); release_ta_memory_by_mobj(utc->mobj_stack); release_ta_memory_by_mobj(utc->mobj_exidx); /* * Close sessions opened by this TA * Note that tee_ta_close_session() removes the item * from the utc->open_sessions list. */ while (!TAILQ_EMPTY(&utc->open_sessions)) { tee_ta_close_session(TAILQ_FIRST(&utc->open_sessions), &utc->open_sessions, KERN_IDENTITY); } vm_info_final(utc); mobj_free(utc->mobj_stack); mobj_free(utc->mobj_exidx); free_elfs(&utc->elfs); /* Free cryp states created by this TA */ tee_svc_cryp_free_states(utc); /* Close cryp objects opened by this TA */ tee_obj_close_all(utc); /* Free emums created by this TA */ tee_svc_storage_close_all_enum(utc); free(utc); } ",0 "double ConvertTemperature(const double tValue, const unsigned char tSign) { if (tSign=='C') return tValue; return RoundDouble(ConvertToFahrenheit(tValue),1); } ",0 "do_general_protection(struct pt_regs *regs, long error_code) { struct task_struct *tsk; RCU_LOCKDEP_WARN(!rcu_is_watching(), ""entry code didn't wake RCU""); cond_local_irq_enable(regs); if (static_cpu_has(X86_FEATURE_UMIP)) { if (user_mode(regs) && fixup_umip_exception(regs)) return; } if (v8086_mode(regs)) { local_irq_enable(); handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code); return; } tsk = current; if (!user_mode(regs)) { if (fixup_exception(regs, X86_TRAP_GP)) return; tsk->thread.error_code = error_code; tsk->thread.trap_nr = X86_TRAP_GP; if (notify_die(DIE_GPF, ""general protection fault"", regs, error_code, X86_TRAP_GP, SIGSEGV) != NOTIFY_STOP) die(""general protection fault"", regs, error_code); return; } tsk->thread.error_code = error_code; tsk->thread.trap_nr = X86_TRAP_GP; if (show_unhandled_signals && unhandled_signal(tsk, SIGSEGV) && printk_ratelimit()) { pr_info(""%s[%d] general protection ip:%lx sp:%lx error:%lx"", tsk->comm, task_pid_nr(tsk), regs->ip, regs->sp, error_code); print_vma_addr(KERN_CONT "" in "", regs->ip); pr_cont(""\n""); } force_sig_info(SIGSEGV, SEND_SIG_PRIV, tsk); } ",0 "AsyncPixelTransfersCompletedQuery::~AsyncPixelTransfersCompletedQuery() { if (observer_) observer_->Cancel(); } ",0 "ZEND_API size_t ZEND_FASTCALL _zend_mem_block_size(void *ptr ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { if (UNEXPECTED(AG(mm_heap)->use_custom_heap)) { return 0; } return zend_mm_size(AG(mm_heap), ptr ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC); } ",0 "long do_io_submit(aio_context_t ctx_id, long nr, struct iocb __user *__user *iocbpp, bool compat) { struct kioctx *ctx; long ret = 0; int i = 0; struct blk_plug plug; struct kiocb_batch batch; if (unlikely(nr < 0)) return -EINVAL; if (unlikely(nr > LONG_MAX/sizeof(*iocbpp))) nr = LONG_MAX/sizeof(*iocbpp); if (unlikely(!access_ok(VERIFY_READ, iocbpp, (nr*sizeof(*iocbpp))))) return -EFAULT; ctx = lookup_ioctx(ctx_id); if (unlikely(!ctx)) { pr_debug(""EINVAL: io_submit: invalid context id\n""); return -EINVAL; } kiocb_batch_init(&batch, nr); blk_start_plug(&plug); /* * AKPM: should this return a partial result if some of the IOs were * successfully submitted? */ for (i=0; iflags & JPC_COC)) { ccp->numrlvls = compparms->numdlvls + 1; ccp->cblkwidthexpn = JPC_COX_GETCBLKSIZEEXPN( compparms->cblkwidthval); ccp->cblkheightexpn = JPC_COX_GETCBLKSIZEEXPN( compparms->cblkheightval); ccp->qmfbid = compparms->qmfbid; ccp->cblkctx = compparms->cblksty; ccp->csty = compparms->csty & JPC_COX_PRT; for (rlvlno = 0; rlvlno < compparms->numrlvls; ++rlvlno) { ccp->prcwidthexpns[rlvlno] = compparms->rlvls[rlvlno].parwidthval; ccp->prcheightexpns[rlvlno] = compparms->rlvls[rlvlno].parheightval; } ccp->flags |= flags | JPC_CSET; } return 0; } ",0 "int jsvGetChildren(const JsVar *v) { int children = 0; JsVarRef childref = jsvGetFirstChild(v); while (childref) { JsVar *child = jsvLock(childref); children++; childref = jsvGetNextSibling(child); jsvUnLock(child); } return children; } ",0 "bash_push_line () { if (push_to_readline) { rl_insert_text (push_to_readline); free (push_to_readline); push_to_readline = (char *)NULL; rl_startup_hook = old_rl_startup_hook; } return 0; } ",0 "void HTMLMediaElement::Seek(double time) { BLINK_MEDIA_LOG << ""seek("" << (void*)this << "", "" << time << "")""; if (!web_media_player_ || ready_state_ == kHaveNothing) return; SetIgnorePreloadNone(); double now = currentTime(); seeking_ = true; time = std::min(time, duration()); time = std::max(time, EarliestPossiblePosition()); double media_time = GetWebMediaPlayer()->MediaTimeForTimeValue(time); if (time != media_time) { BLINK_MEDIA_LOG << ""seek("" << (void*)this << "", "" << time << "") - media timeline equivalent is "" << media_time; time = media_time; } TimeRanges* seekable_ranges = seekable(); if (!seekable_ranges->length()) { seeking_ = false; return; } time = seekable_ranges->Nearest(time, now); if (playing_ && last_seek_time_ < now) AddPlayedRange(last_seek_time_, now); last_seek_time_ = time; ScheduleEvent(event_type_names::kSeeking); GetWebMediaPlayer()->Seek(time); } ",0 "ofpact_encode_hmap(void) { static struct ovsthread_once once = OVSTHREAD_ONCE_INITIALIZER; static struct hmap hmap; if (ovsthread_once_start(&once)) { struct ofpact_raw_instance *inst; hmap_init(&hmap); for (inst = all_raw_instances; inst < &all_raw_instances[ARRAY_SIZE(all_raw_instances)]; inst++) { hmap_insert(&hmap, &inst->encode_node, hash_2words(inst->raw, inst->hdrs.ofp_version)); } ovsthread_once_done(&once); } return &hmap; } ",0 "unknowntag_start(struct archive_read *a, struct xar *xar, const char *name) { struct unknown_tag *tag; tag = malloc(sizeof(*tag)); if (tag == NULL) { archive_set_error(&a->archive, ENOMEM, ""Out of memory""); return (ARCHIVE_FATAL); } tag->next = xar->unknowntags; archive_string_init(&(tag->name)); archive_strcpy(&(tag->name), name); if (xar->unknowntags == NULL) { #if DEBUG fprintf(stderr, ""UNKNOWNTAG_START:%s\n"", name); #endif xar->xmlsts_unknown = xar->xmlsts; xar->xmlsts = UNKNOWN; } xar->unknowntags = tag; return (ARCHIVE_OK); } ",0 "void perf_sched_cb_inc(struct pmu *pmu) { struct perf_cpu_context *cpuctx = this_cpu_ptr(pmu->pmu_cpu_context); if (!cpuctx->sched_cb_usage++) list_add(&cpuctx->sched_cb_entry, this_cpu_ptr(&sched_cb_list)); this_cpu_inc(perf_sched_cb_usages); } ",0 "void SyncBackendHost::FinishConfigureDataTypesOnFrontendLoop() { DCHECK_EQ(MessageLoop::current(), frontend_loop_); VLOG(1) << ""Syncer in config mode. SBH executing"" << ""FinishConfigureDataTypesOnFrontendLoop""; if (pending_config_mode_state_->deleted_type) { core_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DeferNudgeForCleanup)); } if (pending_config_mode_state_->added_types.none() && !core_->syncapi()->InitialSyncEndedForAllEnabledTypes()) { LOG(WARNING) << ""No new types, but initial sync not finished."" << ""Possible sync db corruption / removal.""; pending_config_mode_state_->added_types = syncable::ModelTypeBitSetFromSet( pending_config_mode_state_->initial_types); } if (pending_config_mode_state_->added_types.none()) { VLOG(1) << ""SyncBackendHost("" << this << ""): No new types added. "" << ""Calling ready_task directly""; pending_config_mode_state_->ready_task->Run(); } else { pending_download_state_.reset(pending_config_mode_state_.release()); syncable::ModelTypeBitSet types_copy(pending_download_state_->added_types); if (IsNigoriEnabled()) types_copy.set(syncable::NIGORI); VLOG(1) << ""SyncBackendHost("" << this << ""):New Types added. "" << ""Calling DoRequestConfig""; core_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoRequestConfig, types_copy, pending_download_state_->reason)); } pending_config_mode_state_.reset(); core_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoUpdateEnabledTypes)); } ",0 "static int proc_alloc_streams(struct usb_dev_state *ps, void __user *arg) { unsigned num_streams, num_eps; struct usb_host_endpoint **eps; struct usb_interface *intf; int r; r = parse_usbdevfs_streams(ps, arg, &num_streams, &num_eps, &eps, &intf); if (r) return r; destroy_async_on_interface(ps, intf->altsetting[0].desc.bInterfaceNumber); r = usb_alloc_streams(intf, eps, num_eps, num_streams, GFP_KERNEL); kfree(eps); return r; } ",0 "val_unwrap_aead_args( OM_uint32 *minor_status, gss_ctx_id_t context_handle, gss_buffer_t input_message_buffer, gss_buffer_t input_assoc_buffer, gss_buffer_t output_payload_buffer, int *conf_state, gss_qop_t *qop_state) { /* Initialize outputs. */ if (minor_status != NULL) *minor_status = 0; /* Validate arguments. */ if (minor_status == NULL) return (GSS_S_CALL_INACCESSIBLE_WRITE); if (context_handle == GSS_C_NO_CONTEXT) return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); if (input_message_buffer == GSS_C_NO_BUFFER) return (GSS_S_CALL_INACCESSIBLE_READ); if (output_payload_buffer == GSS_C_NO_BUFFER) return (GSS_S_CALL_INACCESSIBLE_WRITE); return (GSS_S_COMPLETE); } ",0 "static int skinit_interception(struct vcpu_svm *svm) { trace_kvm_skinit(svm->vmcb->save.rip, kvm_register_read(&svm->vcpu, VCPU_REGS_RAX)); kvm_queue_exception(&svm->vcpu, UD_VECTOR); return 1; } ",0 "static void deprecatedAddMidpoint(LineMidpointState& lineMidpointState, const InlineIterator& midpoint) { if (lineMidpointState.midpoints.size() <= lineMidpointState.numMidpoints) lineMidpointState.midpoints.grow(lineMidpointState.numMidpoints + 10); InlineIterator* midpoints = lineMidpointState.midpoints.data(); midpoints[lineMidpointState.numMidpoints++] = midpoint; } ",0 "count_to_stopped(i_ctx_t *i_ctx_p, long mask) { ref_stack_enum_t rsenum; uint scanned = 0; ref_stack_enum_begin(&rsenum, &e_stack); do { uint used = rsenum.size; es_ptr ep = rsenum.ptr + used - 1; uint count = used; for (; count; count--, ep--) { if (r_is_estack_mark(ep)) { if (estack_mark_index(ep) == es_stopped && (ep[2].value.intval & mask) != 0) return scanned + (used - count + 1); } } scanned += used; } while (ref_stack_enum_next(&rsenum)); return 0; } ",0 "void sctp_assoc_rwnd_increase(struct sctp_association *asoc, unsigned int len) { struct sctp_chunk *sack; struct timer_list *timer; if (asoc->rwnd_over) { if (asoc->rwnd_over >= len) { asoc->rwnd_over -= len; } else { asoc->rwnd += (len - asoc->rwnd_over); asoc->rwnd_over = 0; } } else { asoc->rwnd += len; } /* If we had window pressure, start recovering it * once our rwnd had reached the accumulated pressure * threshold. The idea is to recover slowly, but up * to the initial advertised window. */ if (asoc->rwnd_press && asoc->rwnd >= asoc->rwnd_press) { int change = min(asoc->pathmtu, asoc->rwnd_press); asoc->rwnd += change; asoc->rwnd_press -= change; } pr_debug(""%s: asoc:%p rwnd increased by %d to (%u, %u) - %u\n"", __func__, asoc, len, asoc->rwnd, asoc->rwnd_over, asoc->a_rwnd); /* Send a window update SACK if the rwnd has increased by at least the * minimum of the association's PMTU and half of the receive buffer. * The algorithm used is similar to the one described in * Section 4.2.3.3 of RFC 1122. */ if (sctp_peer_needs_update(asoc)) { asoc->a_rwnd = asoc->rwnd; pr_debug(""%s: sending window update SACK- asoc:%p rwnd:%u "" ""a_rwnd:%u\n"", __func__, asoc, asoc->rwnd, asoc->a_rwnd); sack = sctp_make_sack(asoc); if (!sack) return; asoc->peer.sack_needed = 0; sctp_outq_tail(&asoc->outqueue, sack); /* Stop the SACK timer. */ timer = &asoc->timers[SCTP_EVENT_TIMEOUT_SACK]; if (del_timer(timer)) sctp_association_put(asoc); } } ",0 "static void __set_se_shares(struct sched_entity *se, unsigned long shares) { struct cfs_rq *cfs_rq = se->cfs_rq; int on_rq; on_rq = se->on_rq; if (on_rq) dequeue_entity(cfs_rq, se, 0); se->load.weight = shares; se->load.inv_weight = 0; if (on_rq) enqueue_entity(cfs_rq, se, 0); } ",0 "void WebSocket::AddToReadBuffer(const char* data, int len) { DCHECK(current_read_buf_); if (len >= current_read_buf_->RemainingCapacity()) { current_read_buf_->SetCapacity( current_read_buf_->offset() + len); } DCHECK(current_read_buf_->RemainingCapacity() >= len); memcpy(current_read_buf_->data(), data, len); current_read_buf_->set_offset(current_read_buf_->offset() + len); } ",0 "void BackendImpl::OnRead(int32_t bytes) { DCHECK_GE(bytes, 0); byte_count_ += bytes; if (byte_count_ < 0) byte_count_ = std::numeric_limits::max(); } ",0 " void SetResponseStringAndFetch(const std::string& selected_text, const std::string& mentions_start, const std::string& mentions_end) { fetcher()->set_response_code(200); fetcher()->SetResponseString( "")]}'\n"" ",0 "static inline void debugt(const char *func, const char *msg) { if (DP->flags & DEBUGT) pr_info(""%s:%s dtime=%lu\n"", func, msg, jiffies - debugtimer); } ",0 "struct pipe_inode_info *alloc_pipe_info(void) { struct pipe_inode_info *pipe; unsigned long pipe_bufs = PIPE_DEF_BUFFERS; struct user_struct *user = get_current_user(); unsigned long user_bufs; unsigned int max_size = READ_ONCE(pipe_max_size); pipe = kzalloc(sizeof(struct pipe_inode_info), GFP_KERNEL_ACCOUNT); if (pipe == NULL) goto out_free_uid; if (pipe_bufs * PAGE_SIZE > max_size && !capable(CAP_SYS_RESOURCE)) pipe_bufs = max_size >> PAGE_SHIFT; user_bufs = account_pipe_buffers(user, 0, pipe_bufs); if (too_many_pipe_buffers_soft(user_bufs) && is_unprivileged_user()) { user_bufs = account_pipe_buffers(user, pipe_bufs, 1); pipe_bufs = 1; } if (too_many_pipe_buffers_hard(user_bufs) && is_unprivileged_user()) goto out_revert_acct; pipe->bufs = kcalloc(pipe_bufs, sizeof(struct pipe_buffer), GFP_KERNEL_ACCOUNT); if (pipe->bufs) { init_waitqueue_head(&pipe->wait); pipe->r_counter = pipe->w_counter = 1; pipe->buffers = pipe_bufs; pipe->user = user; mutex_init(&pipe->mutex); return pipe; } out_revert_acct: (void) account_pipe_buffers(user, pipe_bufs, 0); kfree(pipe); out_free_uid: free_uid(user); return NULL; } ",0 "Xfree(void *ptr) { free(ptr); } ",0 "static void msg_rcu_free(struct rcu_head *head) { struct ipc_rcu *p = container_of(head, struct ipc_rcu, rcu); struct msg_queue *msq = ipc_rcu_to_struct(p); security_msg_queue_free(msq); ipc_rcu_free(head); } ",0 "const u8 *sc_asn1_verify_tag(sc_context_t *ctx, const u8 * buf, size_t buflen, unsigned int tag_in, size_t *taglen_out) { return sc_asn1_skip_tag(ctx, &buf, &buflen, tag_in, taglen_out); } ",0 "static inline void lxc_clear_includes(struct lxc_conf *conf) { struct lxc_list *it,*next; lxc_list_for_each_safe(it, &conf->includes, next) { lxc_list_del(it); free(it->elem); free(it); } } ",0 " void NavigationController::UpdateVirtualURLToURL( NavigationEntry* entry, const GURL& new_url) { GURL new_virtual_url(new_url); if (BrowserURLHandler::GetInstance()->ReverseURLRewrite( &new_virtual_url, entry->virtual_url(), browser_context_)) { entry->set_virtual_url(new_virtual_url); } } ",0 " WebView* webView() const { return m_helper.webView(); } ",0 "box_above_eq(PG_FUNCTION_ARGS) { BOX *box1 = PG_GETARG_BOX_P(0); BOX *box2 = PG_GETARG_BOX_P(1); PG_RETURN_BOOL(FPge(box1->low.y, box2->high.y)); } ",0 "bool QuotaManager::ResetUsageTracker(StorageType type) { DCHECK(GetUsageTracker(type)); if (GetUsageTracker(type)->IsWorking()) return false; switch (type) { case kStorageTypeTemporary: temporary_usage_tracker_.reset( new UsageTracker(clients_, kStorageTypeTemporary, special_storage_policy_)); return true; case kStorageTypePersistent: persistent_usage_tracker_.reset( new UsageTracker(clients_, kStorageTypePersistent, special_storage_policy_)); return true; default: NOTREACHED(); } return true; } ",0 "int tls_construct_client_key_exchange(SSL *s) { unsigned char *p; int len; size_t pskhdrlen = 0; unsigned long alg_k; int al = -1; alg_k = s->s3->tmp.new_cipher->algorithm_mkey; p = ssl_handshake_start(s); if ((alg_k & SSL_PSK) && !tls_construct_cke_psk_preamble(s, &p, &pskhdrlen, &al)) goto err; if (alg_k & SSL_kPSK) { len = 0; } else if (alg_k & (SSL_kRSA | SSL_kRSAPSK)) { if (!tls_construct_cke_rsa(s, &p, &len, &al)) goto err; } else if (alg_k & (SSL_kDHE | SSL_kDHEPSK)) { if (!tls_construct_cke_dhe(s, &p, &len, &al)) goto err; } else if (alg_k & (SSL_kECDHE | SSL_kECDHEPSK)) { if (!tls_construct_cke_ecdhe(s, &p, &len, &al)) goto err; } else if (alg_k & SSL_kGOST) { if (!tls_construct_cke_gost(s, &p, &len, &al)) goto err; } else if (alg_k & SSL_kSRP) { if (!tls_construct_cke_srp(s, &p, &len, &al)) goto err; } else { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } len += pskhdrlen; if (!ssl_set_handshake_header(s, SSL3_MT_CLIENT_KEY_EXCHANGE, len)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } return 1; err: if (al != -1) ssl3_send_alert(s, SSL3_AL_FATAL, al); OPENSSL_clear_free(s->s3->tmp.pms, s->s3->tmp.pmslen); s->s3->tmp.pms = NULL; #ifndef OPENSSL_NO_PSK OPENSSL_clear_free(s->s3->tmp.psk, s->s3->tmp.psklen); s->s3->tmp.psk = NULL; #endif ossl_statem_set_error(s); return 0; } ",0 "static bool has_byte(const eager_reader_t *reader) { assert(reader != NULL); fd_set read_fds; FD_ZERO(&read_fds); FD_SET(reader->bytes_available_fd, &read_fds); struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 0; select(reader->bytes_available_fd + 1, &read_fds, NULL, NULL, &timeout); return FD_ISSET(reader->bytes_available_fd, &read_fds); } ",1 "BackgroundContentsService::BackgroundContentsService( Profile* profile, const CommandLine* command_line) : prefs_(NULL) { if (!profile->IsOffTheRecord() && !command_line->HasSwitch(switches::kDisableRestoreBackgroundContents)) prefs_ = profile->GetPrefs(); StartObserving(profile); } ",0 "device_linux_md_stop_authorized_cb (Daemon *daemon, Device *device, DBusGMethodInvocation *context, const gchar *action_id, guint num_user_data, gpointer *user_data_elements) { /* TODO: use options */ int n; char *argv[10]; GError *error; n = 0; argv[n++] = ""mdadm""; argv[n++] = ""--stop""; argv[n++] = device->priv->device_file; argv[n++] = NULL; error = NULL; if (!job_new (context, ""LinuxMdStop"", TRUE, device, argv, NULL, linux_md_stop_completed_cb, FALSE, NULL, NULL)) { goto out; } out: ; } ",0 "static int get_mailbox(const char *path, struct ImapData **hidata, char *buf, size_t blen) { struct ImapMbox mx; if (imap_parse_path(path, &mx)) { mutt_debug(1, ""Error parsing %s\n"", path); return -1; } if (!(*hidata = imap_conn_find(&(mx.account), ImapPassive ? MUTT_IMAP_CONN_NONEW : 0)) || (*hidata)->state < IMAP_AUTHENTICATED) { FREE(&mx.mbox); return -1; } imap_fix_path(*hidata, mx.mbox, buf, blen); if (!*buf) mutt_str_strfcpy(buf, ""INBOX"", blen); FREE(&mx.mbox); return 0; } ",0 "static void dwc3_process_event_entry(struct dwc3 *dwc, const union dwc3_event *event) { trace_dwc3_event(event->raw, dwc); if (!event->type.is_devspec) dwc3_endpoint_interrupt(dwc, &event->depevt); else if (event->type.type == DWC3_EVENT_TYPE_DEV) dwc3_gadget_interrupt(dwc, &event->devt); else dev_err(dwc->dev, ""UNKNOWN IRQ type %d\n"", event->raw); } ",0 "put_table_instruction_features( struct ofpbuf *reply, const struct ofputil_table_instruction_features *tif, int miss_offset, enum ofp_version version) { size_t start_ofs; uint8_t table_id; ofpprop_put_bitmap(reply, OFPTFPT13_INSTRUCTIONS + miss_offset, ntohl(ovsinst_bitmap_to_openflow(tif->instructions, version))); start_ofs = ofpprop_start(reply, OFPTFPT13_NEXT_TABLES + miss_offset); BITMAP_FOR_EACH_1 (table_id, 255, tif->next) { ofpbuf_put(reply, &table_id, 1); } ofpprop_end(reply, start_ofs); put_table_action_features(reply, &tif->write, OFPTFPT13_WRITE_ACTIONS, OFPTFPT13_WRITE_SETFIELD, miss_offset, version); put_table_action_features(reply, &tif->apply, OFPTFPT13_APPLY_ACTIONS, OFPTFPT13_APPLY_SETFIELD, miss_offset, version); } ",0 "bool PermissionsData::HasAPIPermission(APIPermission::ID permission) const { base::AutoLock auto_lock(runtime_lock_); return active_permissions_unsafe_->HasAPIPermission(permission); } ",0 "static int cryptd_hash_update_enqueue(struct ahash_request *req) { return cryptd_hash_enqueue(req, cryptd_hash_update); } ",0 "void HTMLInputElement::setHeight(unsigned height) { setAttribute(heightAttr, String::number(height)); } ",0 "static void shm_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp) { struct file *shm_file; shm_file = shp->shm_file; shp->shm_file = NULL; ns->shm_tot -= (shp->shm_segsz + PAGE_SIZE - 1) >> PAGE_SHIFT; shm_rmid(ns, shp); shm_unlock(shp); if (!is_file_hugepages(shm_file)) shmem_lock(shm_file, 0, shp->mlock_user); else if (shp->mlock_user) user_shm_unlock(i_size_read(file_inode(shm_file)), shp->mlock_user); fput(shm_file); ipc_rcu_putref(shp, shm_rcu_free); } ",0 "int gdImageColorClosestHWB (gdImagePtr im, int r, int g, int b) { int i; /* long rd, gd, bd; */ int ct = (-1); int first = 1; float mindist = 0; if (im->trueColor) { return gdTrueColor(r, g, b); } for (i = 0; i < im->colorsTotal; i++) { float dist; if (im->open[i]) { continue; } dist = HWB_Diff(im->red[i], im->green[i], im->blue[i], r, g, b); if (first || (dist < mindist)) { mindist = dist; ct = i; first = 0; } } return ct; } ",0 "static void calc_global_load_remove(struct rq *rq) { atomic_long_sub(rq->calc_load_active, &calc_load_tasks); rq->calc_load_active = 0; } ",0 "static Image *DecompressBlock(Image *orig, MagickOffsetType Size, ImageInfo *clone_info, ExceptionInfo *exception) { Image *image2; void *CacheBlock, *DecompressBlock; z_stream zip_info; FILE *mat_file; size_t magick_size; size_t extent; int file; int status; if(clone_info==NULL) return NULL; if(clone_info->file) /* Close file opened from previous transaction. */ { fclose(clone_info->file); clone_info->file = NULL; (void) remove_utf8(clone_info->filename); } CacheBlock = AcquireQuantumMemory((size_t)((Size<16384)?Size:16384),sizeof(unsigned char *)); if(CacheBlock==NULL) return NULL; DecompressBlock = AcquireQuantumMemory((size_t)(4096),sizeof(unsigned char *)); if(DecompressBlock==NULL) { RelinquishMagickMemory(CacheBlock); return NULL; } mat_file=0; file = AcquireUniqueFileResource(clone_info->filename); if (file != -1) mat_file = fdopen(file,""w""); if(!mat_file) { RelinquishMagickMemory(CacheBlock); RelinquishMagickMemory(DecompressBlock); (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Gannot create file stream for PS image""); return NULL; } zip_info.zalloc=AcquireZIPMemory; zip_info.zfree=RelinquishZIPMemory; zip_info.opaque = (voidpf) NULL; inflateInit(&zip_info); /* zip_info.next_out = 8*4;*/ zip_info.avail_in = 0; zip_info.total_out = 0; while(Size>0 && !EOFBlob(orig)) { magick_size = ReadBlob(orig, (Size<16384)?Size:16384, (unsigned char *) CacheBlock); zip_info.next_in = (Bytef *) CacheBlock; zip_info.avail_in = (uInt) magick_size; while(zip_info.avail_in>0) { zip_info.avail_out = 4096; zip_info.next_out = (Bytef *) DecompressBlock; status = inflate(&zip_info,Z_NO_FLUSH); extent=fwrite(DecompressBlock, 4096-zip_info.avail_out, 1, mat_file); (void) extent; if(status == Z_STREAM_END) goto DblBreak; } Size -= magick_size; } DblBreak: (void)fclose(mat_file); RelinquishMagickMemory(CacheBlock); RelinquishMagickMemory(DecompressBlock); if((clone_info->file=fopen(clone_info->filename,""rb""))==NULL) goto UnlinkFile; if( (image2 = AcquireImage(clone_info))==NULL ) goto EraseFile; status = OpenBlob(clone_info,image2,ReadBinaryBlobMode,exception); if (status == MagickFalse) { DeleteImageFromList(&image2); EraseFile: fclose(clone_info->file); clone_info->file = NULL; UnlinkFile: (void) remove_utf8(clone_info->filename); return NULL; } return image2; } ",0 "PixarLogClose(TIFF* tif) { TIFFDirectory *td = &tif->tif_dir; /* In a really sneaky (and really incorrect, and untruthful, and * troublesome, and error-prone) maneuver that completely goes against * the spirit of TIFF, and breaks TIFF, on close, we covertly * modify both bitspersample and sampleformat in the directory to * indicate 8-bit linear. This way, the decode ""just works"" even for * readers that don't know about PixarLog, or how to set * the PIXARLOGDATFMT pseudo-tag. */ td->td_bitspersample = 8; td->td_sampleformat = SAMPLEFORMAT_UINT; } ",0 "void Segment::AppendCluster(Cluster* pCluster) { assert(pCluster); assert(pCluster->m_index >= 0); const long count = m_clusterCount + m_clusterPreloadCount; long& size = m_clusterSize; assert(size >= count); const long idx = pCluster->m_index; assert(idx == m_clusterCount); if (count >= size) { const long n = (size <= 0) ? 2048 : 2 * size; Cluster** const qq = new Cluster* [n]; Cluster** q = qq; Cluster** p = m_clusters; Cluster** const pp = p + count; while (p != pp) *q++ = *p++; delete[] m_clusters; m_clusters = qq; size = n; } if (m_clusterPreloadCount > 0) { assert(m_clusters); Cluster** const p = m_clusters + m_clusterCount; assert(*p); assert((*p)->m_index < 0); Cluster** q = p + m_clusterPreloadCount; assert(q < (m_clusters + size)); for (;;) { Cluster** const qq = q - 1; assert((*qq)->m_index < 0); *q = *qq; q = qq; if (q == p) break; } } m_clusters[idx] = pCluster; ++m_clusterCount; } ",1 "getHostCPS(struct rx_call *call, afs_uint32 ahost, prlist *alist, afs_int32 *over) { afs_int32 code, temp; struct ubik_trans *tt; struct prentry host_tentry; afs_int32 hostid; struct in_addr iaddr; char hoststr[16]; *over = 0; iaddr.s_addr = ntohl(ahost); alist->prlist_len = 0; alist->prlist_val = NULL; code = Initdb(); if (code != PRSUCCESS) return code; code = ubik_BeginTransReadAny(dbase, UBIK_READTRANS, &tt); if (code) return code; code = ubik_SetLock(tt, 1, 1, LOCKREAD); if (code) ABORT_WITH(tt, code); code = read_DbHeader(tt); if (code) ABORT_WITH(tt, code); code = NameToID(tt, afs_inet_ntoa_r(iaddr.s_addr, hoststr), &hostid); if (code == PRSUCCESS && hostid != 0) { temp = FindByID(tt, hostid); if (temp) { code = pr_ReadEntry(tt, 0, temp, &host_tentry); if (code == PRSUCCESS) { code = GetList(tt, &host_tentry, alist, 0); if (code) goto bad; } else fprintf(stderr, ""pr_ReadEntry returned %d\n"", code); } else fprintf(stderr, ""FindByID Failed -- Not found\n""); } code = addWildCards(tt, alist, ntohl(ahost)); bad: if (code != PRSUCCESS) ABORT_WITH(tt, code); code = ubik_EndTrans(tt); return code; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoFlushDriverCachesCHROMIUM() { if (feature_info_->workarounds().unbind_egl_context_to_flush_driver_caches) { context_->ReleaseCurrent(nullptr); context_->MakeCurrent(surface_.get()); } return error::kNoError; } ",0 "static bool requiresCompositing(CompositingReasons reasons) { return reasons & ~CompositingReasonComboSquashableReasons; } ",0 "void d_rehash(struct dentry * entry) { spin_lock(&entry->d_lock); _d_rehash(entry); spin_unlock(&entry->d_lock); } ",0 "int __filemap_fdatawrite_range(struct address_space *mapping, loff_t start, loff_t end, int sync_mode) { int ret; struct writeback_control wbc = { .sync_mode = sync_mode, .nr_to_write = mapping->nrpages * 2, .range_start = start, .range_end = end, }; if (!mapping_cap_writeback_dirty(mapping)) return 0; ret = do_writepages(mapping, &wbc); return ret; } ",0 "static long snd_timer_user_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct snd_timer_user *tu; void __user *argp = (void __user *)arg; int __user *p = argp; tu = file->private_data; switch (cmd) { case SNDRV_TIMER_IOCTL_PVERSION: return put_user(SNDRV_TIMER_VERSION, p) ? -EFAULT : 0; case SNDRV_TIMER_IOCTL_NEXT_DEVICE: return snd_timer_user_next_device(argp); case SNDRV_TIMER_IOCTL_TREAD: { int xarg; mutex_lock(&tu->tread_sem); if (tu->timeri) { /* too late */ mutex_unlock(&tu->tread_sem); return -EBUSY; } if (get_user(xarg, p)) { mutex_unlock(&tu->tread_sem); return -EFAULT; } tu->tread = xarg ? 1 : 0; mutex_unlock(&tu->tread_sem); return 0; } case SNDRV_TIMER_IOCTL_GINFO: return snd_timer_user_ginfo(file, argp); case SNDRV_TIMER_IOCTL_GPARAMS: return snd_timer_user_gparams(file, argp); case SNDRV_TIMER_IOCTL_GSTATUS: return snd_timer_user_gstatus(file, argp); case SNDRV_TIMER_IOCTL_SELECT: return snd_timer_user_tselect(file, argp); case SNDRV_TIMER_IOCTL_INFO: return snd_timer_user_info(file, argp); case SNDRV_TIMER_IOCTL_PARAMS: return snd_timer_user_params(file, argp); case SNDRV_TIMER_IOCTL_STATUS: return snd_timer_user_status(file, argp); case SNDRV_TIMER_IOCTL_START: case SNDRV_TIMER_IOCTL_START_OLD: return snd_timer_user_start(file); case SNDRV_TIMER_IOCTL_STOP: case SNDRV_TIMER_IOCTL_STOP_OLD: return snd_timer_user_stop(file); case SNDRV_TIMER_IOCTL_CONTINUE: case SNDRV_TIMER_IOCTL_CONTINUE_OLD: return snd_timer_user_continue(file); case SNDRV_TIMER_IOCTL_PAUSE: case SNDRV_TIMER_IOCTL_PAUSE_OLD: return snd_timer_user_pause(file); } return -ENOTTY; } ",0 "bool Document::haveScriptBlockingStylesheetsLoaded() const { return m_styleEngine->haveScriptBlockingStylesheetsLoaded(); } ",0 "static zend_object *spl_object_storage_new_ex(zend_class_entry *class_type, zval *orig) /* {{{ */ { spl_SplObjectStorage *intern; zend_class_entry *parent = class_type; intern = emalloc(sizeof(spl_SplObjectStorage) + zend_object_properties_size(parent)); memset(intern, 0, sizeof(spl_SplObjectStorage) - sizeof(zval)); intern->pos = HT_INVALID_IDX; zend_object_std_init(&intern->std, class_type); object_properties_init(&intern->std, class_type); zend_hash_init(&intern->storage, 0, NULL, spl_object_storage_dtor, 0); intern->std.handlers = &spl_handler_SplObjectStorage; while (parent) { if (parent == spl_ce_SplObjectStorage) { if (class_type != spl_ce_SplObjectStorage) { intern->fptr_get_hash = zend_hash_str_find_ptr(&class_type->function_table, ""gethash"", sizeof(""gethash"") - 1); if (intern->fptr_get_hash->common.scope == spl_ce_SplObjectStorage) { intern->fptr_get_hash = NULL; } } break; } parent = parent->parent; } if (orig) { spl_SplObjectStorage *other = Z_SPLOBJSTORAGE_P(orig); spl_object_storage_addall(intern, orig, other); } return &intern->std; } /* }}} */ ",0 "bool Document::wasDiscarded() const { return was_discarded_; } ",0 "static void ib_uverbs_remove_one(struct ib_device *device, void *client_data) { struct ib_uverbs_device *uverbs_dev = client_data; int wait_clients = 1; if (!uverbs_dev) return; cdev_device_del(&uverbs_dev->cdev, &uverbs_dev->dev); ida_free(&uverbs_ida, uverbs_dev->devnum); if (device->ops.disassociate_ucontext) { /* We disassociate HW resources and immediately return. * Userspace will see a EIO errno for all future access. * Upon returning, ib_device may be freed internally and is not * valid any more. * uverbs_device is still available until all clients close * their files, then the uverbs device ref count will be zero * and its resources will be freed. * Note: At this point no more files can be opened since the * cdev was deleted, however active clients can still issue * commands and close their open files. */ ib_uverbs_free_hw_resources(uverbs_dev, device); wait_clients = 0; } if (atomic_dec_and_test(&uverbs_dev->refcount)) ib_uverbs_comp_dev(uverbs_dev); if (wait_clients) wait_for_completion(&uverbs_dev->comp); put_device(&uverbs_dev->dev); } ",0 "static const char *parse_object(cJSON *item,const char *value,const char **ep) { cJSON *child; if (*value!='{') {*ep=value;return 0;} /* not an object! */ item->type=cJSON_Object; value=skip(value+1); if (*value=='}') return value+1; /* empty array. */ item->child=child=cJSON_New_Item(); if (!item->child) return 0; value=skip(parse_string(child,skip(value),ep)); if (!value) return 0; child->string=child->valuestring;child->valuestring=0; if (*value!=':') {*ep=value;return 0;} /* fail! */ value=skip(parse_value(child,skip(value+1),ep)); /* skip any spacing, get the value. */ if (!value) return 0; while (*value==',') { cJSON *new_item; if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */ child->next=new_item;new_item->prev=child;child=new_item; value=skip(parse_string(child,skip(value+1),ep)); if (!value) return 0; child->string=child->valuestring;child->valuestring=0; if (*value!=':') {*ep=value;return 0;} /* fail! */ value=skip(parse_value(child,skip(value+1),ep)); /* skip any spacing, get the value. */ if (!value) return 0; } if (*value=='}') return value+1; /* end of array */ ",0 "static int sweep(void) { int modified = 0; struct ifsock *ifs, *tmp; LIST_FOREACH_SAFE(ifs, &il, link, tmp) { if (!ifs->stale) continue; modified++; logit(LOG_DEBUG, ""Removing stale ifs %s"", inet_ntoa(ifs->addr.sin_addr)); LIST_REMOVE(ifs, link); close(ifs->out); free(ifs); } return modified; } ",0 "unsigned int kvm_mmu_calculate_mmu_pages(struct kvm *kvm) { unsigned int nr_mmu_pages; unsigned int nr_pages = 0; struct kvm_memslots *slots; struct kvm_memory_slot *memslot; slots = kvm_memslots(kvm); kvm_for_each_memslot(memslot, slots) nr_pages += memslot->npages; nr_mmu_pages = nr_pages * KVM_PERMILLE_MMU_PAGES / 1000; nr_mmu_pages = max(nr_mmu_pages, (unsigned int) KVM_MIN_ALLOC_MMU_PAGES); return nr_mmu_pages; } ",0 "int fiemap_fill_next_extent(struct fiemap_extent_info *fieinfo, u64 logical, u64 phys, u64 len, u32 flags) { struct fiemap_extent extent; struct fiemap_extent __user *dest = fieinfo->fi_extents_start; /* only count the extents */ if (fieinfo->fi_extents_max == 0) { fieinfo->fi_extents_mapped++; return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; } if (fieinfo->fi_extents_mapped >= fieinfo->fi_extents_max) return 1; if (flags & SET_UNKNOWN_FLAGS) flags |= FIEMAP_EXTENT_UNKNOWN; if (flags & SET_NO_UNMOUNTED_IO_FLAGS) flags |= FIEMAP_EXTENT_ENCODED; if (flags & SET_NOT_ALIGNED_FLAGS) flags |= FIEMAP_EXTENT_NOT_ALIGNED; memset(&extent, 0, sizeof(extent)); extent.fe_logical = logical; extent.fe_physical = phys; extent.fe_length = len; extent.fe_flags = flags; dest += fieinfo->fi_extents_mapped; if (copy_to_user(dest, &extent, sizeof(extent))) return -EFAULT; fieinfo->fi_extents_mapped++; if (fieinfo->fi_extents_mapped == fieinfo->fi_extents_max) return 1; return (flags & FIEMAP_EXTENT_LAST) ? 1 : 0; } ",0 "int test_rshift1(BIO *bp) { BIGNUM *a,*b,*c; int i; a=BN_new(); b=BN_new(); c=BN_new(); BN_bntest_rand(a,200,0,0); /**/ a->neg=rand_neg(); for (i=0; ibinary_header.request.extlen; int keylen = c->binary_header.request.keylen; uint32_t bodylen = c->binary_header.request.bodylen; if (settings.sasl && !authenticated(c)) { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_AUTH_ERROR, 0); c->write_and_go = conn_closing; return; } MEMCACHED_PROCESS_COMMAND_START(c->sfd, c->rcurr, c->rbytes); c->noreply = true; /* binprot supports 16bit keys, but internals are still 8bit */ if (keylen > KEY_MAX_LENGTH) { handle_binary_protocol_error(c); return; } switch (c->cmd) { case PROTOCOL_BINARY_CMD_SETQ: c->cmd = PROTOCOL_BINARY_CMD_SET; break; case PROTOCOL_BINARY_CMD_ADDQ: c->cmd = PROTOCOL_BINARY_CMD_ADD; break; case PROTOCOL_BINARY_CMD_REPLACEQ: c->cmd = PROTOCOL_BINARY_CMD_REPLACE; break; case PROTOCOL_BINARY_CMD_DELETEQ: c->cmd = PROTOCOL_BINARY_CMD_DELETE; break; case PROTOCOL_BINARY_CMD_INCREMENTQ: c->cmd = PROTOCOL_BINARY_CMD_INCREMENT; break; case PROTOCOL_BINARY_CMD_DECREMENTQ: c->cmd = PROTOCOL_BINARY_CMD_DECREMENT; break; case PROTOCOL_BINARY_CMD_QUITQ: c->cmd = PROTOCOL_BINARY_CMD_QUIT; break; case PROTOCOL_BINARY_CMD_FLUSHQ: c->cmd = PROTOCOL_BINARY_CMD_FLUSH; break; case PROTOCOL_BINARY_CMD_APPENDQ: c->cmd = PROTOCOL_BINARY_CMD_APPEND; break; case PROTOCOL_BINARY_CMD_PREPENDQ: c->cmd = PROTOCOL_BINARY_CMD_PREPEND; break; case PROTOCOL_BINARY_CMD_GETQ: c->cmd = PROTOCOL_BINARY_CMD_GET; break; case PROTOCOL_BINARY_CMD_GETKQ: c->cmd = PROTOCOL_BINARY_CMD_GETK; break; default: c->noreply = false; } switch (c->cmd) { case PROTOCOL_BINARY_CMD_VERSION: if (extlen == 0 && keylen == 0 && bodylen == 0) { write_bin_response(c, VERSION, 0, 0, strlen(VERSION)); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_FLUSH: if (keylen == 0 && bodylen == extlen && (extlen == 0 || extlen == 4)) { bin_read_key(c, bin_read_flush_exptime, extlen); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_NOOP: if (extlen == 0 && keylen == 0 && bodylen == 0) { write_bin_response(c, NULL, 0, 0, 0); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_SET: /* FALLTHROUGH */ case PROTOCOL_BINARY_CMD_ADD: /* FALLTHROUGH */ case PROTOCOL_BINARY_CMD_REPLACE: if (extlen == 8 && keylen != 0 && bodylen >= (keylen + 8)) { bin_read_key(c, bin_reading_set_header, 8); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_GETQ: /* FALLTHROUGH */ case PROTOCOL_BINARY_CMD_GET: /* FALLTHROUGH */ case PROTOCOL_BINARY_CMD_GETKQ: /* FALLTHROUGH */ case PROTOCOL_BINARY_CMD_GETK: if (extlen == 0 && bodylen == keylen && keylen > 0) { bin_read_key(c, bin_reading_get_key, 0); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_DELETE: if (keylen > 0 && extlen == 0 && bodylen == keylen) { bin_read_key(c, bin_reading_del_header, extlen); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_INCREMENT: case PROTOCOL_BINARY_CMD_DECREMENT: if (keylen > 0 && extlen == 20 && bodylen == (keylen + extlen)) { bin_read_key(c, bin_reading_incr_header, 20); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_APPEND: case PROTOCOL_BINARY_CMD_PREPEND: if (keylen > 0 && extlen == 0) { bin_read_key(c, bin_reading_set_header, 0); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_STAT: if (extlen == 0) { bin_read_key(c, bin_reading_stat, 0); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_QUIT: if (keylen == 0 && extlen == 0 && bodylen == 0) { write_bin_response(c, NULL, 0, 0, 0); c->write_and_go = conn_closing; if (c->noreply) { conn_set_state(c, conn_closing); } } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_SASL_LIST_MECHS: if (extlen == 0 && keylen == 0 && bodylen == 0) { bin_list_sasl_mechs(c); } else { protocol_error = 1; } break; case PROTOCOL_BINARY_CMD_SASL_AUTH: case PROTOCOL_BINARY_CMD_SASL_STEP: if (extlen == 0 && keylen != 0) { bin_read_key(c, bin_reading_sasl_auth, 0); } else { protocol_error = 1; } break; default: write_bin_error(c, PROTOCOL_BINARY_RESPONSE_UNKNOWN_COMMAND, bodylen); } if (protocol_error) handle_binary_protocol_error(c); } ",0 "bool InputMethodController::FinishComposingText( ConfirmCompositionBehavior confirm_behavior) { if (!HasComposition()) return false; const bool is_too_long = IsTextTooLongAt(composition_range_->StartPosition()); const String& composing = ComposingText(); if (confirm_behavior == kKeepSelection) { const bool is_handle_visible = GetFrame().Selection().IsHandleVisible(); const PlainTextRange& old_offsets = GetSelectionOffsets(); Editor::RevealSelectionScope reveal_selection_scope(&GetEditor()); if (is_too_long) { ReplaceComposition(ComposingText()); } else { Clear(); DispatchCompositionEndEvent(GetFrame(), composing); } GetDocument().UpdateStyleAndLayoutIgnorePendingStylesheets(); const EphemeralRange& old_selection_range = EphemeralRangeForOffsets(old_offsets); if (old_selection_range.IsNull()) return false; const SelectionInDOMTree& selection = SelectionInDOMTree::Builder() .SetBaseAndExtent(old_selection_range) .SetIsHandleVisible(is_handle_visible) .Build(); GetFrame().Selection().SetSelection( selection, SetSelectionData::Builder().SetShouldCloseTyping(true).Build()); return true; } Element* root_editable_element = GetFrame() .Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .RootEditableElement(); if (!root_editable_element) return false; PlainTextRange composition_range = PlainTextRange::Create(*root_editable_element, *composition_range_); if (composition_range.IsNull()) return false; if (is_too_long) { ReplaceComposition(ComposingText()); } else { Clear(); } if (!MoveCaret(composition_range.End())) return false; DispatchCompositionEndEvent(GetFrame(), composing); return true; } ",1 "static int vnc_qdict_remote_addr(QDict *qdict, int fd) { struct sockaddr_storage sa; socklen_t salen; salen = sizeof(sa); if (getpeername(fd, (struct sockaddr*)&sa, &salen) < 0) { return -1; } return put_addr_qdict(qdict, &sa, salen); } ",0 " LoginUtilsWrapper() {} ",0 "status_t BufferQueueConsumer::setConsumerUsageBits(uint32_t usage) { ATRACE_CALL(); BQ_LOGV(""setConsumerUsageBits: %#x"", usage); Mutex::Autolock lock(mCore->mMutex); mCore->mConsumerUsageBits = usage; return NO_ERROR; } ",0 "rdpdr_init() { rdpdr_channel = channel_register(""rdpdr"", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_COMPRESS_RDP, rdpdr_process); return (rdpdr_channel != NULL); } ",0 "PHP_FUNCTION(openssl_pbkdf2) { zend_long key_length = 0, iterations = 0; char *password; size_t password_len; char *salt; size_t salt_len; char *method; size_t method_len = 0; zend_string *out_buffer; const EVP_MD *digest; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""ssll|s"", &password, &password_len, &salt, &salt_len, &key_length, &iterations, &method, &method_len) == FAILURE) { return; } if (key_length <= 0) { RETURN_FALSE; } if (method_len) { digest = EVP_get_digestbyname(method); } else { digest = EVP_sha1(); } if (!digest) { php_error_docref(NULL, E_WARNING, ""Unknown signature algorithm""); RETURN_FALSE; } PHP_OPENSSL_CHECK_LONG_TO_INT(key_length, key); PHP_OPENSSL_CHECK_LONG_TO_INT(iterations, iterations); PHP_OPENSSL_CHECK_SIZE_T_TO_INT(password_len, password); PHP_OPENSSL_CHECK_SIZE_T_TO_INT(salt_len, salt); out_buffer = zend_string_alloc(key_length, 0); if (PKCS5_PBKDF2_HMAC(password, (int)password_len, (unsigned char *)salt, (int)salt_len, (int)iterations, digest, (int)key_length, (unsigned char*)ZSTR_VAL(out_buffer)) == 1) { ZSTR_VAL(out_buffer)[key_length] = 0; RETURN_NEW_STR(out_buffer); } else { php_openssl_store_errors(); zend_string_release(out_buffer); RETURN_FALSE; } } ",0 " cf2_getScaleAndHintFlag( CFF_Decoder* decoder, CF2_Fixed* x_scale, CF2_Fixed* y_scale, FT_Bool* hinted, FT_Bool* scaled ) { FT_ASSERT( decoder && decoder->builder.glyph ); /* note: FreeType scale includes a factor of 64 */ *hinted = decoder->builder.glyph->hint; *scaled = decoder->builder.glyph->scaled; if ( *hinted ) { *x_scale = FT_DivFix( decoder->builder.glyph->x_scale, cf2_intToFixed( 64 ) ); *y_scale = FT_DivFix( decoder->builder.glyph->y_scale, cf2_intToFixed( 64 ) ); } else { /* for unhinted outlines, `cff_slot_load' does the scaling, */ /* thus render at `unity' scale */ *x_scale = 0x0400; /* 1/64 as 16.16 */ *y_scale = 0x0400; } } ",0 "png_get_mmx_flagmask (int flag_select, int *compilerID) { /* Obsolete, to be removed from libpng-1.4.0 */ PNG_UNUSED(flag_select) *compilerID = -1; /* unknown (i.e., no asm/MMX code compiled) */ return 0L; } ",0 "static ssize_t ext4_quota_write(struct super_block *sb, int type, const char *data, size_t len, loff_t off) { struct inode *inode = sb_dqopt(sb)->files[type]; ext4_lblk_t blk = off >> EXT4_BLOCK_SIZE_BITS(sb); int err, offset = off & (sb->s_blocksize - 1); int retries = 0; struct buffer_head *bh; handle_t *handle = journal_current_handle(); if (EXT4_SB(sb)->s_journal && !handle) { ext4_msg(sb, KERN_WARNING, ""Quota write (off=%llu, len=%llu)"" "" cancelled because transaction is not started"", (unsigned long long)off, (unsigned long long)len); return -EIO; } /* * Since we account only one data block in transaction credits, * then it is impossible to cross a block boundary. */ if (sb->s_blocksize - offset < len) { ext4_msg(sb, KERN_WARNING, ""Quota write (off=%llu, len=%llu)"" "" cancelled because not block aligned"", (unsigned long long)off, (unsigned long long)len); return -EIO; } do { bh = ext4_bread(handle, inode, blk, EXT4_GET_BLOCKS_CREATE | EXT4_GET_BLOCKS_METADATA_NOFAIL); } while (IS_ERR(bh) && (PTR_ERR(bh) == -ENOSPC) && ext4_should_retry_alloc(inode->i_sb, &retries)); if (IS_ERR(bh)) return PTR_ERR(bh); if (!bh) goto out; BUFFER_TRACE(bh, ""get write access""); err = ext4_journal_get_write_access(handle, bh); if (err) { brelse(bh); return err; } lock_buffer(bh); memcpy(bh->b_data+offset, data, len); flush_dcache_page(bh->b_page); unlock_buffer(bh); err = ext4_handle_dirty_metadata(handle, NULL, bh); brelse(bh); out: if (inode->i_size < off + len) { i_size_write(inode, off + len); EXT4_I(inode)->i_disksize = inode->i_size; ext4_mark_inode_dirty(handle, inode); } return len; } ",0 "static int dump_one_state(struct xfrm_state *x, int count, void *ptr) { struct xfrm_dump_info *sp = ptr; struct sk_buff *in_skb = sp->in_skb; struct sk_buff *skb = sp->out_skb; struct xfrm_usersa_info *p; struct nlmsghdr *nlh; int err; nlh = nlmsg_put(skb, NETLINK_CB(in_skb).portid, sp->nlmsg_seq, XFRM_MSG_NEWSA, sizeof(*p), sp->nlmsg_flags); if (nlh == NULL) return -EMSGSIZE; p = nlmsg_data(nlh); err = copy_to_user_state_extra(x, p, skb); if (err) { nlmsg_cancel(skb, nlh); return err; } nlmsg_end(skb, nlh); return 0; } ",0 "static TEE_Result tee_svc_obj_generate_key_rsa( struct tee_obj *o, const struct tee_cryp_obj_type_props *type_props, uint32_t key_size, const TEE_Attribute *params, uint32_t param_count) { TEE_Result res; struct rsa_keypair *key = o->attr; uint32_t e = TEE_U32_TO_BIG_ENDIAN(65537); /* Copy the present attributes into the obj before starting */ res = tee_svc_cryp_obj_populate_type(o, type_props, params, param_count); if (res != TEE_SUCCESS) return res; if (!get_attribute(o, type_props, TEE_ATTR_RSA_PUBLIC_EXPONENT)) crypto_bignum_bin2bn((const uint8_t *)&e, sizeof(e), key->e); res = crypto_acipher_gen_rsa_key(key, key_size); if (res != TEE_SUCCESS) return res; /* Set bits for all known attributes for this object type */ o->have_attrs = (1 << type_props->num_type_attrs) - 1; return TEE_SUCCESS; } ",0 "bool CustomButton::OnMouseDragged(const ui::MouseEvent& event) { if (state_ != STATE_DISABLED) { if (HitTestPoint(event.location())) SetState(ShouldEnterPushedState(event) ? STATE_PRESSED : STATE_HOVERED); else SetState(STATE_NORMAL); } return true; } ",0 "void nohz_balance_enter_idle(int cpu) { struct rq *rq = cpu_rq(cpu); SCHED_WARN_ON(cpu != smp_processor_id()); /* If this CPU is going down, then nothing needs to be done: */ if (!cpu_active(cpu)) return; /* Spare idle load balancing on CPUs that don't want to be disturbed: */ if (!housekeeping_cpu(cpu, HK_FLAG_SCHED)) return; /* * Can be set safely without rq->lock held * If a clear happens, it will have evaluated last additions because * rq->lock is held during the check and the clear */ rq->has_blocked_load = 1; /* * The tick is still stopped but load could have been added in the * meantime. We set the nohz.has_blocked flag to trig a check of the * *_avg. The CPU is already part of nohz.idle_cpus_mask so the clear * of nohz.has_blocked can only happen after checking the new load */ if (rq->nohz_tick_stopped) goto out; /* If we're a completely isolated CPU, we don't play: */ if (on_null_domain(rq)) return; rq->nohz_tick_stopped = 1; cpumask_set_cpu(cpu, nohz.idle_cpus_mask); atomic_inc(&nohz.nr_cpus); /* * Ensures that if nohz_idle_balance() fails to observe our * @idle_cpus_mask store, it must observe the @has_blocked * store. */ smp_mb__after_atomic(); set_cpu_sd_state_idle(cpu); out: /* * Each time a cpu enter idle, we assume that it has blocked load and * enable the periodic update of the load of idle cpus */ WRITE_ONCE(nohz.has_blocked, 1); } ",0 "int symlink_atomic(const char *from, const char *to) { _cleanup_free_ char *t = NULL; int r; assert(from); assert(to); r = tempfn_random(to, NULL, &t); if (r < 0) return r; if (symlink(from, t) < 0) return -errno; if (rename(t, to) < 0) { unlink_noerrno(t); return -errno; } return 0; } ",0 "static inline ssize_t do_tty_write( ssize_t (*write)(struct tty_struct *, struct file *, const unsigned char *, size_t), struct tty_struct *tty, struct file *file, const char __user *buf, size_t count) { ssize_t ret, written = 0; unsigned int chunk; ret = tty_write_lock(tty, file->f_flags & O_NDELAY); if (ret < 0) return ret; /* * We chunk up writes into a temporary buffer. This * simplifies low-level drivers immensely, since they * don't have locking issues and user mode accesses. * * But if TTY_NO_WRITE_SPLIT is set, we should use a * big chunk-size.. * * The default chunk-size is 2kB, because the NTTY * layer has problems with bigger chunks. It will * claim to be able to handle more characters than * it actually does. * * FIXME: This can probably go away now except that 64K chunks * are too likely to fail unless switched to vmalloc... */ chunk = 2048; if (test_bit(TTY_NO_WRITE_SPLIT, &tty->flags)) chunk = 65536; if (count < chunk) chunk = count; /* write_buf/write_cnt is protected by the atomic_write_lock mutex */ if (tty->write_cnt < chunk) { unsigned char *buf_chunk; if (chunk < 1024) chunk = 1024; buf_chunk = kmalloc(chunk, GFP_KERNEL); if (!buf_chunk) { ret = -ENOMEM; goto out; } kfree(tty->write_buf); tty->write_cnt = chunk; tty->write_buf = buf_chunk; } /* Do the write .. */ for (;;) { size_t size = count; if (size > chunk) size = chunk; ret = -EFAULT; if (copy_from_user(tty->write_buf, buf, size)) break; ret = write(tty, file, tty->write_buf, size); if (ret <= 0) break; written += ret; buf += ret; count -= ret; if (!count) break; ret = -ERESTARTSYS; if (signal_pending(current)) break; cond_resched(); } if (written) { struct inode *inode = file->f_path.dentry->d_inode; inode->i_mtime = current_fs_time(inode->i_sb); ret = written; } out: tty_write_unlock(tty); return ret; } ",0 "DOMWindow::~DOMWindow() { DCHECK(!frame_); } ",0 "void GamepadProvider::ScheduleDoPoll() { DCHECK(polling_thread_->task_runner()->BelongsToCurrentThread()); if (have_scheduled_do_poll_) return; { base::AutoLock lock(is_paused_lock_); if (is_paused_) return; } base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( FROM_HERE, base::Bind(&GamepadProvider::DoPoll, Unretained(this)), base::TimeDelta::FromMilliseconds(kDesiredSamplingIntervalMs)); have_scheduled_do_poll_ = true; } ",0 "GahpClient::blah_job_cancel(const char *job_id) { static const char* command = ""BLAH_JOB_CANCEL""; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!job_id) job_id=NULLSTRING; std::string reqline; int x = sprintf( reqline, ""%s"", escapeGahpString( job_id ) ); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,deleg_proxy); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { if (result->argc != 3) { EXCEPT(""Bad %s Result"",command); } int rc = atoi( result->argv[1] ); if ( strcasecmp(result->argv[2], NULLSTRING) ) { error_string = result->argv[2]; } else { error_string = """"; } delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 "getGnashExecutable() { std::string procname; bool process_found = false; struct stat procstats; char *gnash_env = std::getenv(""GNASH_PLAYER""); if (gnash_env) { procname = gnash_env; process_found = (0 == stat(procname.c_str(), &procstats)); if (!process_found) { gnash::log_error(""Invalid path to gnash executable: ""); return """"; } } if (!process_found) { procname = GNASHBINDIR ""/gtk-gnash""; process_found = (0 == stat(procname.c_str(), &procstats)); } if (!process_found) { procname = GNASHBINDIR ""/qt4-gnash""; process_found = (0 == stat(procname.c_str(), &procstats)); } if (!process_found) { gnash::log_error(std::string(""Unable to find Gnash in "") + GNASHBINDIR); return """"; } return procname; } ",0 " EGLDisplay egl_display() { return egl_display_; } ",0 "JsVar *jspeBinaryExpression() { return __jspeBinaryExpression(jspeUnaryExpression(),0); } ",0 "static MXFDescriptor* mxf_resolve_multidescriptor(MXFContext *mxf, MXFDescriptor *descriptor, int track_id) { MXFDescriptor *sub_descriptor = NULL; int i; if (!descriptor) return NULL; if (descriptor->type == MultipleDescriptor) { for (i = 0; i < descriptor->sub_descriptors_count; i++) { sub_descriptor = mxf_resolve_strong_ref(mxf, &descriptor->sub_descriptors_refs[i], Descriptor); if (!sub_descriptor) { av_log(mxf->fc, AV_LOG_ERROR, ""could not resolve sub descriptor strong ref\n""); continue; } if (sub_descriptor->linked_track_id == track_id) { return sub_descriptor; } } } else if (descriptor->type == Descriptor) return descriptor; return NULL; } ",0 " virtual ~MessageList() { } ",0 "static void ipmi_request_event(struct ipmi_smi *intf) { /* No event requests when in maintenance mode. */ if (intf->maintenance_mode_enable) return; if (!intf->in_shutdown) intf->handlers->request_events(intf->send_info); } ",0 "cmsMLU* CMSEXPORT cmsMLUalloc(cmsContext ContextID, cmsUInt32Number nItems) { cmsMLU* mlu; if (nItems <= 0) nItems = 2; mlu = (cmsMLU*) _cmsMallocZero(ContextID, sizeof(cmsMLU)); if (mlu == NULL) return NULL; mlu ->ContextID = ContextID; mlu ->Entries = (_cmsMLUentry*) _cmsCalloc(ContextID, nItems, sizeof(_cmsMLUentry)); if (mlu ->Entries == NULL) { _cmsFree(ContextID, mlu); return NULL; } mlu ->AllocatedEntries = nItems; mlu ->UsedEntries = 0; return mlu; } ",0 "static void inv_predict_5(uint8_t *p, const uint8_t *p_l, const uint8_t *p_tl, const uint8_t *p_t, const uint8_t *p_tr) { p[0] = p_t[0] + (p_l[0] + p_tr[0] >> 1) >> 1; p[1] = p_t[1] + (p_l[1] + p_tr[1] >> 1) >> 1; p[2] = p_t[2] + (p_l[2] + p_tr[2] >> 1) >> 1; p[3] = p_t[3] + (p_l[3] + p_tr[3] >> 1) >> 1; } ",0 "void btrfs_run_delayed_iputs(struct btrfs_root *root) { LIST_HEAD(list); struct btrfs_fs_info *fs_info = root->fs_info; struct delayed_iput *delayed; int empty; spin_lock(&fs_info->delayed_iput_lock); empty = list_empty(&fs_info->delayed_iputs); spin_unlock(&fs_info->delayed_iput_lock); if (empty) return; spin_lock(&fs_info->delayed_iput_lock); list_splice_init(&fs_info->delayed_iputs, &list); spin_unlock(&fs_info->delayed_iput_lock); while (!list_empty(&list)) { delayed = list_entry(list.next, struct delayed_iput, list); list_del(&delayed->list); iput(delayed->inode); kfree(delayed); } } ",0 "static struct sock *ping_lookup(struct net *net, struct sk_buff *skb, u16 ident) { struct hlist_nulls_head *hslot = ping_hashslot(&ping_table, net, ident); struct sock *sk = NULL; struct inet_sock *isk; struct hlist_nulls_node *hnode; int dif = skb->dev->ifindex; if (skb->protocol == htons(ETH_P_IP)) { pr_debug(""try to find: num = %d, daddr = %pI4, dif = %d\n"", (int)ident, &ip_hdr(skb)->daddr, dif); #if IS_ENABLED(CONFIG_IPV6) } else if (skb->protocol == htons(ETH_P_IPV6)) { pr_debug(""try to find: num = %d, daddr = %pI6c, dif = %d\n"", (int)ident, &ipv6_hdr(skb)->daddr, dif); #endif } read_lock_bh(&ping_table.lock); ping_portaddr_for_each_entry(sk, hnode, hslot) { isk = inet_sk(sk); pr_debug(""iterate\n""); if (isk->inet_num != ident) continue; if (skb->protocol == htons(ETH_P_IP) && sk->sk_family == AF_INET) { pr_debug(""found: %p: num=%d, daddr=%pI4, dif=%d\n"", sk, (int) isk->inet_num, &isk->inet_rcv_saddr, sk->sk_bound_dev_if); if (isk->inet_rcv_saddr && isk->inet_rcv_saddr != ip_hdr(skb)->daddr) continue; #if IS_ENABLED(CONFIG_IPV6) } else if (skb->protocol == htons(ETH_P_IPV6) && sk->sk_family == AF_INET6) { pr_debug(""found: %p: num=%d, daddr=%pI6c, dif=%d\n"", sk, (int) isk->inet_num, &sk->sk_v6_rcv_saddr, sk->sk_bound_dev_if); if (!ipv6_addr_any(&sk->sk_v6_rcv_saddr) && !ipv6_addr_equal(&sk->sk_v6_rcv_saddr, &ipv6_hdr(skb)->daddr)) continue; #endif } if (sk->sk_bound_dev_if && sk->sk_bound_dev_if != dif) continue; sock_hold(sk); goto exit; } sk = NULL; exit: read_unlock_bh(&ping_table.lock); return sk; } ",0 "void WebLocalFrameImpl::SetCanHaveScrollbars(bool can_have_scrollbars) { if (LocalFrameView* view = GetFrameView()) view->SetCanHaveScrollbars(can_have_scrollbars); } ",0 "int php_openssl_x509_fingerprint(X509 *peer, const char *method, zend_bool raw, char **out, int *out_len TSRMLS_DC) { unsigned char md[EVP_MAX_MD_SIZE]; const EVP_MD *mdtype; unsigned int n; if (!(mdtype = EVP_get_digestbyname(method))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unknown signature algorithm""); return FAILURE; } else if (!X509_digest(peer, mdtype, md, &n)) { php_error_docref(NULL TSRMLS_CC, E_ERROR, ""Could not generate signature""); return FAILURE; } if (raw) { *out_len = n; *out = estrndup((char *) md, n); } else { *out_len = n * 2; *out = emalloc(*out_len + 1); make_digest_ex(*out, md, n); } return SUCCESS; } ",0 "bool initiate_stratum(struct pool *pool) { bool ret = false, recvd = false, noresume = false, sockd = false; char s[RBUFSIZE], *sret = NULL, *nonce1, *sessionid; json_t *val = NULL, *res_val, *err_val; json_error_t err; int n2size; resend: if (!setup_stratum_socket(pool)) { /* FIXME: change to LOG_DEBUG when issue #88 resolved */ applog(LOG_INFO, ""setup_stratum_socket() on %s failed"", get_pool_name(pool)); sockd = false; goto out; } sockd = true; if (recvd) { /* Get rid of any crap lying around if we're resending */ clear_sock(pool); sprintf(s, ""{\""id\"": %d, \""method\"": \""mining.subscribe\"", \""params\"": []}"", swork_id++); } else { if (pool->sessionid) sprintf(s, ""{\""id\"": %d, \""method\"": \""mining.subscribe\"", \""params\"": [\""""PACKAGE""/""VERSION""\"", \""%s\""]}"", swork_id++, pool->sessionid); else sprintf(s, ""{\""id\"": %d, \""method\"": \""mining.subscribe\"", \""params\"": [\""""PACKAGE""/""VERSION""\""]}"", swork_id++); } if (__stratum_send(pool, s, strlen(s)) != SEND_OK) { applog(LOG_DEBUG, ""Failed to send s in initiate_stratum""); goto out; } if (!socket_full(pool, DEFAULT_SOCKWAIT)) { applog(LOG_DEBUG, ""Timed out waiting for response in initiate_stratum""); goto out; } sret = recv_line(pool); if (!sret) goto out; recvd = true; val = JSON_LOADS(sret, &err); free(sret); if (!val) { applog(LOG_INFO, ""JSON decode failed(%d): %s"", err.line, err.text); goto out; } res_val = json_object_get(val, ""result""); err_val = json_object_get(val, ""error""); if (!res_val || json_is_null(res_val) || (err_val && !json_is_null(err_val))) { char *ss; if (err_val) ss = json_dumps(err_val, JSON_INDENT(3)); else ss = strdup(""(unknown reason)""); applog(LOG_INFO, ""JSON-RPC decode failed: %s"", ss); free(ss); goto out; } sessionid = get_sessionid(res_val); if (!sessionid) applog(LOG_DEBUG, ""Failed to get sessionid in initiate_stratum""); nonce1 = json_array_string(res_val, 1); if (!nonce1) { applog(LOG_INFO, ""Failed to get nonce1 in initiate_stratum""); free(sessionid); goto out; } n2size = json_integer_value(json_array_get(res_val, 2)); if (n2size < 1) { applog(LOG_INFO, ""Failed to get n2size in initiate_stratum""); free(sessionid); free(nonce1); goto out; } cg_wlock(&pool->data_lock); pool->sessionid = sessionid; pool->nonce1 = nonce1; pool->n1_len = strlen(nonce1) / 2; free(pool->nonce1bin); pool->nonce1bin = (unsigned char *)calloc(pool->n1_len, 1); if (unlikely(!pool->nonce1bin)) quithere(1, ""Failed to calloc pool->nonce1bin""); hex2bin(pool->nonce1bin, pool->nonce1, pool->n1_len); pool->n2size = n2size; cg_wunlock(&pool->data_lock); if (sessionid) applog(LOG_DEBUG, ""%s stratum session id: %s"", get_pool_name(pool), pool->sessionid); ret = true; out: if (ret) { if (!pool->stratum_url) pool->stratum_url = pool->sockaddr_url; pool->stratum_active = true; pool->swork.diff = 1; if (opt_protocol) { applog(LOG_DEBUG, ""%s confirmed mining.subscribe with extranonce1 %s extran2size %d"", get_pool_name(pool), pool->nonce1, pool->n2size); } } else { if (recvd && !noresume) { /* Reset the sessionid used for stratum resuming in case the pool * does not support it, or does not know how to respond to the * presence of the sessionid parameter. */ cg_wlock(&pool->data_lock); free(pool->sessionid); free(pool->nonce1); pool->sessionid = pool->nonce1 = NULL; cg_wunlock(&pool->data_lock); applog(LOG_DEBUG, ""Failed to resume stratum, trying afresh""); noresume = true; json_decref(val); goto resend; } applog(LOG_DEBUG, ""Initiating stratum failed on %s"", get_pool_name(pool)); if (sockd) { applog(LOG_DEBUG, ""Suspending stratum on %s"", get_pool_name(pool)); suspend_stratum(pool); } } json_decref(val); return ret; } ",0 "virDomainGetOSType(virDomainPtr domain) { virConnectPtr conn; VIR_DOMAIN_DEBUG(domain); virResetLastError(); virCheckDomainReturn(domain, NULL); conn = domain->conn; if (conn->driver->domainGetOSType) { char *ret; ret = conn->driver->domainGetOSType(domain); if (!ret) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(domain->conn); return NULL; } ",0 "int tls1_process_ticket(SSL *s, unsigned char *session_id, int len, const unsigned char *limit, SSL_SESSION **ret) { /* Point after session ID in client hello */ const unsigned char *p = session_id + len; unsigned short i; *ret = NULL; s->tlsext_ticket_expected = 0; /* * If tickets disabled behave as if no ticket present to permit stateful * resumption. */ if (SSL_get_options(s) & SSL_OP_NO_TICKET) return 0; if ((s->version <= SSL3_VERSION) || !limit) return 0; if (p >= limit) return -1; /* Skip past DTLS cookie */ if (SSL_IS_DTLS(s)) { i = *(p++); p += i; if (p >= limit) return -1; } /* Skip past cipher list */ n2s(p, i); p += i; if (p >= limit) return -1; /* Skip past compression algorithm list */ i = *(p++); p += i; if (p > limit) return -1; /* Now at start of extensions */ if ((p + 2) >= limit) return 0; n2s(p, i); while ((p + 4) <= limit) { unsigned short type, size; n2s(p, type); n2s(p, size); if (p + size > limit) return 0; if (type == TLSEXT_TYPE_session_ticket) { int r; */ s->tlsext_ticket_expected = 1; return 1; } if (s->tls_session_secret_cb) { /* * Indicate that the ticket couldn't be decrypted rather than * generating the session from ticket now, trigger * abbreviated handshake based on external mechanism to * calculate the master secret later. */ return 2; } r = tls_decrypt_ticket(s, p, size, session_id, len, ret); switch (r) { case 2: /* ticket couldn't be decrypted */ s->tlsext_ticket_expected = 1; return 2; case 3: /* ticket was decrypted */ return r; case 4: /* ticket decrypted but need to renew */ s->tlsext_ticket_expected = 1; return 3; default: /* fatal error */ return -1; } } p += size; } ",1 "JSObject* JSTestActiveDOMObjectPrototype::self(ExecState* exec, JSGlobalObject* globalObject) { return getDOMPrototype(exec, globalObject); } ",0 "int tls1_set_server_sigalgs(SSL *s) { int al; size_t i; /* Clear any shared signature algorithms */ OPENSSL_free(s->cert->shared_sigalgs); s->cert->shared_sigalgs = NULL; s->cert->shared_sigalgslen = 0; /* Clear certificate digests and validity flags */ for (i = 0; i < SSL_PKEY_NUM; i++) { s->s3->tmp.md[i] = NULL; s->s3->tmp.valid_flags[i] = 0; } /* If sigalgs received process it. */ if (s->s3->tmp.peer_sigalgs) { if (!tls1_process_sigalgs(s)) { SSLerr(SSL_F_TLS1_SET_SERVER_SIGALGS, ERR_R_MALLOC_FAILURE); al = SSL_AD_INTERNAL_ERROR; goto err; } /* Fatal error is no shared signature algorithms */ if (!s->cert->shared_sigalgs) { SSLerr(SSL_F_TLS1_SET_SERVER_SIGALGS, SSL_R_NO_SHARED_SIGNATURE_ALGORITHMS); al = SSL_AD_ILLEGAL_PARAMETER; goto err; } } else { ssl_set_default_md(s); } return 1; err: ssl3_send_alert(s, SSL3_AL_FATAL, al); return 0; } ",0 " virtual status_t releaseSecureStops(Vector const &ssRelease) { Parcel data, reply; data.writeInterfaceToken(IDrm::getInterfaceDescriptor()); writeVector(data, ssRelease); status_t status = remote()->transact(RELEASE_SECURE_STOPS, data, &reply); if (status != OK) { return status; } return reply.readInt32(); } ",0 "bool ChromeMetricsServiceClient::SyncStateAllowsUkm() { return SyncDisableObserver::SyncStateAllowsUkm(); } ",0 "static inline unsigned interleave_nid(struct mempolicy *pol, struct vm_area_struct *vma, unsigned long addr, int shift) { if (vma) { unsigned long off; /* * for small pages, there is no difference between * shift and PAGE_SHIFT, so the bit-shift is safe. * for huge pages, since vm_pgoff is in units of small * pages, we need to shift off the always 0 bits to get * a useful offset. */ BUG_ON(shift < PAGE_SHIFT); off = vma->vm_pgoff >> (shift - PAGE_SHIFT); off += (addr - vma->vm_start) >> shift; return offset_il_node(pol, vma, off); } else return interleave_nodes(pol); } ",0 " base::TaskQueue& work_queue() { return work_queue_; } ",0 "int kvm_mmu_unprotect_page(struct kvm *kvm, gfn_t gfn) { struct kvm_mmu_page *sp; LIST_HEAD(invalid_list); int r; pgprintk(""%s: looking for gfn %llx\n"", __func__, gfn); r = 0; spin_lock(&kvm->mmu_lock); for_each_gfn_indirect_valid_sp(kvm, sp, gfn) { pgprintk(""%s: gfn %llx role %x\n"", __func__, gfn, sp->role.word); r = 1; kvm_mmu_prepare_zap_page(kvm, sp, &invalid_list); } kvm_mmu_commit_zap_page(kvm, &invalid_list); spin_unlock(&kvm->mmu_lock); return r; } ",0 "static bool brcmf_valid_wpa_oui(u8 *oui, bool is_rsn_ie) { if (is_rsn_ie) return (memcmp(oui, RSN_OUI, TLV_OUI_LEN) == 0); return (memcmp(oui, WPA_OUI, TLV_OUI_LEN) == 0); } ",0 "align_column_to_tab (parser_line_counter_t column) /**< current column */ { /* Tab aligns to zero column start position. */ return (parser_line_counter_t) (((column + (8u - 1u)) & ~ECMA_STRING_CONTAINER_MASK) + 1u); } /* align_column_to_tab */ ",0 "void Document::processHttpEquiv(const String& equiv, const String& content) { ASSERT(!equiv.isNull() && !content.isNull()); if (equalIgnoringCase(equiv, ""default-style"")) processHttpEquivDefaultStyle(content); else if (equalIgnoringCase(equiv, ""refresh"")) processHttpEquivRefresh(content); else if (equalIgnoringCase(equiv, ""set-cookie"")) processHttpEquivSetCookie(content); else if (equalIgnoringCase(equiv, ""content-language"")) setContentLanguage(content); else if (equalIgnoringCase(equiv, ""x-dns-prefetch-control"")) parseDNSPrefetchControlHeader(content); else if (equalIgnoringCase(equiv, ""x-frame-options"")) processHttpEquivXFrameOptions(content); else if (equalIgnoringCase(equiv, ""content-security-policy"") || equalIgnoringCase(equiv, ""content-security-policy-report-only"") || equalIgnoringCase(equiv, ""x-webkit-csp"") || equalIgnoringCase(equiv, ""x-webkit-csp-report-only"")) processHttpEquivContentSecurityPolicy(equiv, content); } ",0 "static void udf_free_partition(struct udf_part_map *map) { int i; struct udf_meta_data *mdata; if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) iput(map->s_uspace.s_table); if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) iput(map->s_fspace.s_table); if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) udf_sb_free_bitmap(map->s_uspace.s_bitmap); if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) udf_sb_free_bitmap(map->s_fspace.s_bitmap); if (map->s_partition_type == UDF_SPARABLE_MAP15) for (i = 0; i < 4; i++) brelse(map->s_type_specific.s_sparing.s_spar_map[i]); else if (map->s_partition_type == UDF_METADATA_MAP25) { mdata = &map->s_type_specific.s_metadata; iput(mdata->s_metadata_fe); mdata->s_metadata_fe = NULL; iput(mdata->s_mirror_fe); mdata->s_mirror_fe = NULL; iput(mdata->s_bitmap_fe); mdata->s_bitmap_fe = NULL; } } ",0 "drop_connection(int startups) { int p, r; if (startups < options.max_startups_begin) return 0; if (startups >= options.max_startups) return 1; if (options.max_startups_rate == 100) return 1; p = 100 - options.max_startups_rate; p *= startups - options.max_startups_begin; p /= options.max_startups - options.max_startups_begin; p += options.max_startups_rate; r = arc4random_uniform(100); debug(""drop_connection: p %d, r %d"", p, r); return (r < p) ? 1 : 0; } ",0 "int HTMLInputElement::size() const { return m_size; } ",0 "int unregister_netdevice_notifier(struct notifier_block *nb) { int err; rtnl_lock(); err = raw_notifier_chain_unregister(&netdev_chain, nb); rtnl_unlock(); return err; } ",0 "static void flush_arg_page(struct linux_binprm *bprm, unsigned long pos, struct page *page) { } ",0 "static inline wchar_t vfat_replace_char(wchar_t w) { return (w == '[') || (w == ']') || (w == ';') || (w == ',') || (w == '+') || (w == '='); } ",0 "int search_binary_handler(struct linux_binprm *bprm) { bool need_retry = IS_ENABLED(CONFIG_MODULES); struct linux_binfmt *fmt; int retval; /* This allows 4 levels of binfmt rewrites before failing hard. */ if (bprm->recursion_depth > 5) return -ELOOP; retval = security_bprm_check(bprm); if (retval) return retval; retval = audit_bprm(bprm); if (retval) return retval; retval = -ENOENT; retry: read_lock(&binfmt_lock); list_for_each_entry(fmt, &formats, lh) { if (!try_module_get(fmt->module)) continue; read_unlock(&binfmt_lock); bprm->recursion_depth++; retval = fmt->load_binary(bprm); bprm->recursion_depth--; if (retval >= 0 || retval != -ENOEXEC || bprm->mm == NULL || bprm->file == NULL) { put_binfmt(fmt); return retval; } read_lock(&binfmt_lock); put_binfmt(fmt); } read_unlock(&binfmt_lock); if (need_retry && retval == -ENOEXEC) { if (printable(bprm->buf[0]) && printable(bprm->buf[1]) && printable(bprm->buf[2]) && printable(bprm->buf[3])) return retval; if (request_module(""binfmt-%04x"", *(ushort *)(bprm->buf + 2)) < 0) return retval; need_retry = false; goto retry; } return retval; } ",0 "bool fontAntialiasingEnabledForTest() { return LayoutTestSupport::isFontAntialiasingEnabledForTest(); } ",0 "static int bt_alloc(struct blk_mq_bitmap_tags *bt, unsigned int depth, int node, bool reserved) { int i; bt->bits_per_word = ilog2(BITS_PER_LONG); /* * Depth can be zero for reserved tags, that's not a failure * condition. */ if (depth) { unsigned int nr, tags_per_word; tags_per_word = (1 << bt->bits_per_word); /* * If the tag space is small, shrink the number of tags * per word so we spread over a few cachelines, at least. * If less than 4 tags, just forget about it, it's not * going to work optimally anyway. */ if (depth >= 4) { while (tags_per_word * 4 > depth) { bt->bits_per_word--; tags_per_word = (1 << bt->bits_per_word); } } nr = ALIGN(depth, tags_per_word) / tags_per_word; bt->map = kzalloc_node(nr * sizeof(struct blk_align_bitmap), GFP_KERNEL, node); if (!bt->map) return -ENOMEM; bt->map_nr = nr; } bt->bs = kzalloc(BT_WAIT_QUEUES * sizeof(*bt->bs), GFP_KERNEL); if (!bt->bs) { kfree(bt->map); bt->map = NULL; return -ENOMEM; } bt_update_count(bt, depth); for (i = 0; i < BT_WAIT_QUEUES; i++) { init_waitqueue_head(&bt->bs[i].wait); atomic_set(&bt->bs[i].wait_cnt, bt->wake_cnt); } return 0; } ",0 "krb5_decode_krbsecretkey(krb5_context context, krb5_db_entry *entries, struct berval **bvalues, krb5_tl_data *userinfo_tl_data, krb5_kvno *mkvno) { char *user=NULL; int i=0, j=0, noofkeys=0; krb5_key_data *key_data=NULL, *tmp; krb5_error_code st=0; if ((st=krb5_unparse_name(context, entries->princ, &user)) != 0) goto cleanup; for (i=0; bvalues[i] != NULL; ++i) { krb5_int16 n_kd; krb5_key_data *kd; krb5_data in; if (bvalues[i]->bv_len == 0) continue; in.length = bvalues[i]->bv_len; in.data = bvalues[i]->bv_val; st = asn1_decode_sequence_of_keys (&in, &kd, &n_kd, mkvno); if (st != 0) { const char *msg = error_message(st); st = -1; /* Something more appropriate ? */ krb5_set_error_message(context, st, _(""unable to decode stored "" ""principal key data (%s)""), msg); goto cleanup; } noofkeys += n_kd; tmp = key_data; /* Allocate an extra key data to avoid allocating zero bytes. */ key_data = realloc(key_data, (noofkeys + 1) * sizeof (krb5_key_data)); if (key_data == NULL) { key_data = tmp; st = ENOMEM; goto cleanup; } for (j = 0; j < n_kd; j++) key_data[noofkeys - n_kd + j] = kd[j]; free (kd); } entries->n_key_data = noofkeys; entries->key_data = key_data; cleanup: ldap_value_free_len(bvalues); free (user); return st; } ",0 "PassRefPtr CSSComputedStyleDeclaration::copyPropertiesInSet(const CSSPropertyID* set, unsigned length) const { Vector list; list.reserveInitialCapacity(length); for (unsigned i = 0; i < length; ++i) { RefPtr value = getPropertyCSSValue(set[i]); if (value) list.append(CSSProperty(set[i], value.release(), false)); } return StylePropertySet::create(list.data(), list.size()); } ",0 "fbCombineAtopReverseU (CARD32 *dest, const CARD32 *src, int width) { int i; for (i = 0; i < width; ++i) { CARD32 s = READ(src + i); CARD32 d = READ(dest + i); CARD32 src_a = Alpha(s); CARD32 dest_ia = Alpha(~d); FbByteAddMul(s, dest_ia, d, src_a); WRITE(dest + i, s); } } ",0 "static char *build_hash_string(int mode, const char *chksum, ut8 *data, ut32 datalen) { char *chkstr = NULL, *aux, *ret = NULL; const char *ptr = chksum; char tmp[128]; int i; do { for (i = 0; *ptr && *ptr != ',' && i < sizeof (tmp) -1; i++) { tmp[i] = *ptr++; } tmp[i] = '\0'; r_str_trim_head_tail (tmp); chkstr = r_hash_to_string (NULL, tmp, data, datalen); if (!chkstr) { if (*ptr && *ptr == ',') { ptr++; } continue; } if (IS_MODE_SIMPLE (mode)) { aux = r_str_newf (""%s "", chkstr); } else if (IS_MODE_JSON (mode)) { aux = r_str_newf (""\""%s\"":\""%s\"","", tmp, chkstr); } else { aux = r_str_newf (""%s=%s "", tmp, chkstr); } ret = r_str_append (ret, aux); free (chkstr); free (aux); if (*ptr && *ptr == ',') { ptr++; } } while (*ptr); return ret; } ",0 "static inline int splashRound(SplashCoord x) { return (int)floor(x + 0.5); } ",0 "static int eth_can_rx(NetClientState *nc) { struct xlx_ethlite *s = qemu_get_nic_opaque(nc); unsigned int rxbase = s->rxbuf * (0x800 / 4); return !(s->regs[rxbase + R_RX_CTRL0] & CTRL_S); } ",0 "content::WebContents* WebUILoginView::GetWebContents() { return webui_login_->web_contents(); } ",0 "static void setterRaisesExceptionLongAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectPythonV8Internal::setterRaisesExceptionLongAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "IntRect RenderBox::absoluteContentBox() const { IntRect rect = contentBoxRect(); FloatPoint absPos = localToAbsolute(FloatPoint()); rect.move(absPos.x(), absPos.y()); return rect; } ",0 "static int hci_sock_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; void __user *argp = (void __user *) arg; int err; BT_DBG(""cmd %x arg %lx"", cmd, arg); switch (cmd) { case HCIGETDEVLIST: return hci_get_dev_list(argp); case HCIGETDEVINFO: return hci_get_dev_info(argp); case HCIGETCONNLIST: return hci_get_conn_list(argp); case HCIDEVUP: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_open(arg); case HCIDEVDOWN: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_close(arg); case HCIDEVRESET: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_reset(arg); case HCIDEVRESTAT: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_reset_stat(arg); case HCISETSCAN: case HCISETAUTH: case HCISETENCRYPT: case HCISETPTYPE: case HCISETLINKPOL: case HCISETLINKMODE: case HCISETACLMTU: case HCISETSCOMTU: if (!capable(CAP_NET_ADMIN)) return -EACCES; return hci_dev_cmd(cmd, argp); case HCIINQUIRY: return hci_inquiry(argp); default: lock_sock(sk); err = hci_sock_bound_ioctl(sk, cmd, arg); release_sock(sk); return err; } } ",0 " render_state_init( RenderState state, Display display ) { memset( state, 0, sizeof ( *state ) ); state->text = default_text; state->filepath = state->filepath0; state->filename = """"; state->filepath0[0] = 0; state->resolution = 72; state->char_size = 16; state->display = display[0]; state->columns[0].use_kerning = 1; state->columns[0].use_deltas = 1; state->columns[0].use_lcd_filter = 1; state->columns[0].use_global_advance_width = 1; state->columns[0].lcd_filter = FT_LCD_FILTER_DEFAULT; state->columns[0].hint_mode = HINT_MODE_BYTECODE; state->columns[0].use_custom_lcd_filter = 0; state->columns[0].fw_index = 2; /* freetype default filter weights */ memcpy( state->columns[0].filter_weights, ""\x10\x40\x70\x40\x10"", 5); state->columns[1] = state->columns[0]; state->columns[1].hint_mode = HINT_MODE_AUTOHINT; state->columns[1].use_custom_lcd_filter = 1; state->columns[2] = state->columns[0]; state->columns[2].hint_mode = HINT_MODE_UNHINTED; state->col = 1; if ( FT_Init_FreeType( &state->library ) != 0 ) panic( ""could not initialize FreeType library. Check your code\n"" ); } ",0 "static int tcm_loop_proc_info(struct Scsi_Host *host, char *buffer, char **start, off_t offset, int length, int inout) { return sprintf(buffer, ""tcm_loop_proc_info()\n""); } ",0 "GahpClient::is_pending(const char *command, const char * /* buf */) { if ( command && pending_command && strcmp(command,pending_command)==0 ) { return true; } return false; } ",0 "UNCURL_EXPORT void uncurl_free_info(struct uncurl_info *uci) { free(uci->host); free(uci->path); } ",0 "WORD32 ihevcd_parse_transform_tree(codec_t *ps_codec, WORD32 x0, WORD32 y0, WORD32 cu_x_base, WORD32 cu_y_base, WORD32 log2_trafo_size, WORD32 trafo_depth, WORD32 blk_idx, WORD32 intra_pred_mode) { IHEVCD_ERROR_T ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; sps_t *ps_sps; pps_t *ps_pps; WORD32 value; WORD32 x1, y1; WORD32 max_trafo_depth; bitstrm_t *ps_bitstrm = &ps_codec->s_parse.s_bitstrm; WORD32 intra_split_flag; WORD32 split_transform_flag; WORD32 ctxt_idx; cab_ctxt_t *ps_cabac = &ps_codec->s_parse.s_cabac; max_trafo_depth = ps_codec->s_parse.s_cu.i4_max_trafo_depth; ps_sps = ps_codec->s_parse.ps_sps; ps_pps = ps_codec->s_parse.ps_pps; intra_split_flag = ps_codec->s_parse.s_cu.i4_intra_split_flag; { split_transform_flag = 0; if((log2_trafo_size <= ps_sps->i1_log2_max_transform_block_size) && (log2_trafo_size > ps_sps->i1_log2_min_transform_block_size) && (trafo_depth < max_trafo_depth) && !(intra_split_flag && (trafo_depth == 0))) { /* encode the split transform flag, context derived as per Table9-37 */ ctxt_idx = IHEVC_CAB_SPLIT_TFM + (5 - log2_trafo_size); TRACE_CABAC_CTXT(""split_transform_flag"", ps_cabac->u4_range, ctxt_idx); split_transform_flag = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""split_transform_flag"", split_transform_flag, ps_cabac->u4_range); } else { WORD32 inter_split_flag = 0; if((0 == ps_sps->i1_max_transform_hierarchy_depth_inter) && (PRED_MODE_INTER == ps_codec->s_parse.s_cu.i4_pred_mode) && (PART_2Nx2N != ps_codec->s_parse.s_cu.i4_part_mode) && (0 == trafo_depth)) { inter_split_flag = 1; } if((log2_trafo_size > ps_sps->i1_log2_max_transform_block_size) || ((1 == intra_split_flag) && (0 == trafo_depth)) || (1 == inter_split_flag)) { split_transform_flag = 1; } } if(0 == trafo_depth) { ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth] = 0; ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth] = 0; } else { ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth] = ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth - 1]; ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth] = ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth - 1]; } if(trafo_depth == 0 || log2_trafo_size > 2) { ctxt_idx = IHEVC_CAB_CBCR_IDX + trafo_depth; /* CBF for Cb/Cr is sent only if the parent CBF for Cb/Cr is non-zero */ if((trafo_depth == 0) || ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth - 1]) { TRACE_CABAC_CTXT(""cbf_cb"", ps_cabac->u4_range, ctxt_idx); value = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""cbf_cb"", value, ps_cabac->u4_range); ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth] = value; } if((trafo_depth == 0) || ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth - 1]) { TRACE_CABAC_CTXT(""cbf_cr"", ps_cabac->u4_range, ctxt_idx); value = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""cbf_cr"", value, ps_cabac->u4_range); ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth] = value; } } if(split_transform_flag) { WORD32 intra_pred_mode_tmp; x1 = x0 + ((1 << log2_trafo_size) >> 1); y1 = y0 + ((1 << log2_trafo_size) >> 1); /* For transform depth of zero, intra pred mode as decoded at CU */ /* level is sent to the transform tree nodes */ /* When depth is non-zero intra pred mode of parent node is sent */ /* This takes care of passing correct mode to all the child nodes */ intra_pred_mode_tmp = trafo_depth ? intra_pred_mode : ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[0]; ret = ihevcd_parse_transform_tree(ps_codec, x0, y0, x0, y0, log2_trafo_size - 1, trafo_depth + 1, 0, intra_pred_mode_tmp); RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret); intra_pred_mode_tmp = trafo_depth ? intra_pred_mode : ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[1]; ret = ihevcd_parse_transform_tree(ps_codec, x1, y0, x0, y0, log2_trafo_size - 1, trafo_depth + 1, 1, intra_pred_mode_tmp); RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret); intra_pred_mode_tmp = trafo_depth ? intra_pred_mode : ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[2]; ret = ihevcd_parse_transform_tree(ps_codec, x0, y1, x0, y0, log2_trafo_size - 1, trafo_depth + 1, 2, intra_pred_mode_tmp); RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret); intra_pred_mode_tmp = trafo_depth ? intra_pred_mode : ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[3]; ret = ihevcd_parse_transform_tree(ps_codec, x1, y1, x0, y0, log2_trafo_size - 1, trafo_depth + 1, 3, intra_pred_mode_tmp); RETURN_IF((IHEVCD_ERROR_T)IHEVCD_SUCCESS != ret, ret); } else { WORD32 ctb_x_base; WORD32 ctb_y_base; WORD32 cu_qp_delta_abs; tu_t *ps_tu = ps_codec->s_parse.ps_tu; cu_qp_delta_abs = 0; ctb_x_base = ps_codec->s_parse.i4_ctb_x << ps_sps->i1_log2_ctb_size; ctb_y_base = ps_codec->s_parse.i4_ctb_y << ps_sps->i1_log2_ctb_size; if((ps_codec->s_parse.s_cu.i4_pred_mode == PRED_MODE_INTRA) || (trafo_depth != 0) || (ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth]) || (ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth])) { ctxt_idx = IHEVC_CAB_CBF_LUMA_IDX; ctxt_idx += (trafo_depth == 0) ? 1 : 0; TRACE_CABAC_CTXT(""cbf_luma"", ps_cabac->u4_range, ctxt_idx); value = ihevcd_cabac_decode_bin(ps_cabac, ps_bitstrm, ctxt_idx); AEV_TRACE(""cbf_luma"", value, ps_cabac->u4_range); ps_codec->s_parse.s_cu.i1_cbf_luma = value; } else { ps_codec->s_parse.s_cu.i1_cbf_luma = 1; } /* Initialize ps_tu to default values */ /* If required change this to WORD32 packed write */ ps_tu->b1_cb_cbf = 0; ps_tu->b1_cr_cbf = 0; ps_tu->b1_y_cbf = 0; ps_tu->b4_pos_x = ((x0 - ctb_x_base) >> 2); ps_tu->b4_pos_y = ((y0 - ctb_y_base) >> 2); ps_tu->b1_transquant_bypass = ps_codec->s_parse.s_cu.i4_cu_transquant_bypass; ps_tu->b3_size = (log2_trafo_size - 2); ps_tu->b7_qp = ps_codec->s_parse.u4_qp; ps_tu->b6_luma_intra_mode = intra_pred_mode; ps_tu->b3_chroma_intra_mode_idx = ps_codec->s_parse.s_cu.i4_intra_chroma_pred_mode_idx; /* Section:7.3.12 Transform unit syntax inlined here */ if(ps_codec->s_parse.s_cu.i1_cbf_luma || ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth] || ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth]) { WORD32 intra_pred_mode_chroma; if(ps_pps->i1_cu_qp_delta_enabled_flag && !ps_codec->s_parse.i4_is_cu_qp_delta_coded) { WORD32 c_max = TU_MAX_QP_DELTA_ABS; WORD32 ctxt_inc = IHEVC_CAB_QP_DELTA_ABS; WORD32 ctxt_inc_max = CTXT_MAX_QP_DELTA_ABS; TRACE_CABAC_CTXT(""cu_qp_delta_abs"", ps_cabac->u4_range, ctxt_inc); /* qp_delta_abs is coded as combination of tunary and eg0 code */ /* See Table 9-32 and Table 9-37 for details on cu_qp_delta_abs */ cu_qp_delta_abs = ihevcd_cabac_decode_bins_tunary(ps_cabac, ps_bitstrm, c_max, ctxt_inc, 0, ctxt_inc_max); if(cu_qp_delta_abs >= c_max) { value = ihevcd_cabac_decode_bypass_bins_egk(ps_cabac, ps_bitstrm, 0); cu_qp_delta_abs += value; } AEV_TRACE(""cu_qp_delta_abs"", cu_qp_delta_abs, ps_cabac->u4_range); ps_codec->s_parse.i4_is_cu_qp_delta_coded = 1; if(cu_qp_delta_abs) { value = ihevcd_cabac_decode_bypass_bin(ps_cabac, ps_bitstrm); AEV_TRACE(""cu_qp_delta_sign"", value, ps_cabac->u4_range); if(value) cu_qp_delta_abs = -cu_qp_delta_abs; } if (cu_qp_delta_abs < MIN_CU_QP_DELTA_ABS(ps_sps->i1_bit_depth_luma_minus8) || cu_qp_delta_abs > MAX_CU_QP_DELTA_ABS(ps_sps->i1_bit_depth_luma_minus8)) { return IHEVCD_INVALID_PARAMETER; } ps_codec->s_parse.s_cu.i4_cu_qp_delta = cu_qp_delta_abs; } if(ps_codec->s_parse.s_cu.i1_cbf_luma) { ps_tu->b1_y_cbf = 1; ihevcd_parse_residual_coding(ps_codec, x0, y0, log2_trafo_size, 0, intra_pred_mode); } if(4 == ps_codec->s_parse.s_cu.i4_intra_chroma_pred_mode_idx) intra_pred_mode_chroma = ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[0]; else { intra_pred_mode_chroma = gau1_intra_pred_chroma_modes[ps_codec->s_parse.s_cu.i4_intra_chroma_pred_mode_idx]; if(intra_pred_mode_chroma == ps_codec->s_parse.s_cu.ai4_intra_luma_pred_mode[0]) { intra_pred_mode_chroma = INTRA_ANGULAR(34); } } if(log2_trafo_size > 2) { if(ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth]) { ps_tu->b1_cb_cbf = 1; ihevcd_parse_residual_coding(ps_codec, x0, y0, log2_trafo_size - 1, 1, intra_pred_mode_chroma); } if(ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth]) { ps_tu->b1_cr_cbf = 1; ihevcd_parse_residual_coding(ps_codec, x0, y0, log2_trafo_size - 1, 2, intra_pred_mode_chroma); } } else if(blk_idx == 3) { if(ps_codec->s_parse.s_cu.ai1_cbf_cb[trafo_depth]) { ps_tu->b1_cb_cbf = 1; ihevcd_parse_residual_coding(ps_codec, cu_x_base, cu_y_base, log2_trafo_size, 1, intra_pred_mode_chroma); } if(ps_codec->s_parse.s_cu.ai1_cbf_cr[trafo_depth]) { ps_tu->b1_cr_cbf = 1; ihevcd_parse_residual_coding(ps_codec, cu_x_base, cu_y_base, log2_trafo_size, 2, intra_pred_mode_chroma); } } else { ps_tu->b3_chroma_intra_mode_idx = INTRA_PRED_CHROMA_IDX_NONE; } } else { if((3 != blk_idx) && (2 == log2_trafo_size)) { ps_tu->b3_chroma_intra_mode_idx = INTRA_PRED_CHROMA_IDX_NONE; } } /* Set the first TU in CU flag */ { if((ps_codec->s_parse.s_cu.i4_pos_x << 3) == (ps_tu->b4_pos_x << 2) && (ps_codec->s_parse.s_cu.i4_pos_y << 3) == (ps_tu->b4_pos_y << 2)) { ps_tu->b1_first_tu_in_cu = 1; } else { ps_tu->b1_first_tu_in_cu = 0; } } ps_codec->s_parse.ps_tu++; ps_codec->s_parse.s_cu.i4_tu_cnt++; ps_codec->s_parse.i4_pic_tu_idx++; } } return ret; } ",0 " void WebPluginProxy::SetWindowlessPumpEvent(HANDLE pump_messages_event) { HANDLE pump_messages_event_for_renderer = NULL; DuplicateHandle(GetCurrentProcess(), pump_messages_event, channel_->renderer_handle(), &pump_messages_event_for_renderer, 0, FALSE, DUPLICATE_SAME_ACCESS); DCHECK(pump_messages_event_for_renderer != NULL); Send(new PluginHostMsg_SetWindowlessPumpEvent( route_id_, pump_messages_event_for_renderer)); } ",1 "static inline const unsigned char *ReadResourceLong(const unsigned char *p, unsigned int *quantum) { *quantum=(unsigned int) (*p++) << 24; *quantum|=(unsigned int) (*p++) << 16; *quantum|=(unsigned int) (*p++) << 8; *quantum|=(unsigned int) (*p++); return(p); } ",0 "static struct tun_struct *tun_enable_queue(struct tun_file *tfile) { struct tun_struct *tun = tfile->detached; tfile->detached = NULL; list_del_init(&tfile->next); --tun->numdisabled; return tun; } ",0 "bool PPB_URLLoader_Impl::RecordUploadProgress() const { return request_data_.record_upload_progress; } ",0 "int AgcGetParameter(preproc_effect_t *effect, void *pParam, uint32_t *pValueSize, void *pValue) { int status = 0; uint32_t param = *(uint32_t *)pParam; t_agc_settings *pProperties = (t_agc_settings *)pValue; webrtc::GainControl *agc = static_cast(effect->engine); switch (param) { case AGC_PARAM_TARGET_LEVEL: case AGC_PARAM_COMP_GAIN: if (*pValueSize < sizeof(int16_t)) { *pValueSize = 0; return -EINVAL; } break; case AGC_PARAM_LIMITER_ENA: if (*pValueSize < sizeof(bool)) { *pValueSize = 0; return -EINVAL; } break; case AGC_PARAM_PROPERTIES: if (*pValueSize < sizeof(t_agc_settings)) { *pValueSize = 0; return -EINVAL; } break; default: ALOGW(""AgcGetParameter() unknown param %08x"", param); status = -EINVAL; break; } switch (param) { case AGC_PARAM_TARGET_LEVEL: *(int16_t *) pValue = (int16_t)(agc->target_level_dbfs() * -100); ALOGV(""AgcGetParameter() target level %d milliBels"", *(int16_t *) pValue); break; case AGC_PARAM_COMP_GAIN: *(int16_t *) pValue = (int16_t)(agc->compression_gain_db() * 100); ALOGV(""AgcGetParameter() comp gain %d milliBels"", *(int16_t *) pValue); break; case AGC_PARAM_LIMITER_ENA: *(bool *) pValue = (bool)agc->is_limiter_enabled(); ALOGV(""AgcGetParameter() limiter enabled %s"", (*(int16_t *) pValue != 0) ? ""true"" : ""false""); break; case AGC_PARAM_PROPERTIES: pProperties->targetLevel = (int16_t)(agc->target_level_dbfs() * -100); pProperties->compGain = (int16_t)(agc->compression_gain_db() * 100); pProperties->limiterEnabled = (bool)agc->is_limiter_enabled(); break; default: ALOGW(""AgcGetParameter() unknown param %d"", param); status = -EINVAL; break; } return status; } ",0 "const views::ProgressBar* MediaControlsProgressView::progress_bar_for_testing() const { return progress_bar_; } ",0 "static int genregs32_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { int ret = 0; if (kbuf) { const compat_ulong_t *k = kbuf; while (count >= sizeof(*k) && !ret) { ret = putreg32(target, pos, *k++); count -= sizeof(*k); pos += sizeof(*k); } } else { const compat_ulong_t __user *u = ubuf; while (count >= sizeof(*u) && !ret) { compat_ulong_t word; ret = __get_user(word, u++); if (ret) break; ret = putreg32(target, pos, word); count -= sizeof(*u); pos += sizeof(*u); } } return ret; } ",0 " virtual void CheckThrottleResults( NavigationThrottle::ThrottleCheckResult result1, NavigationThrottle::ThrottleCheckResult result2, NavigationThrottle::ThrottleCheckResult result3, size_t loading_slots) { EXPECT_EQ(content::NavigationThrottle::PROCEED, result1); switch (loading_slots) { case 1: EXPECT_EQ(content::NavigationThrottle::DEFER, result2); EXPECT_EQ(content::NavigationThrottle::DEFER, result3); break; case 2: EXPECT_EQ(content::NavigationThrottle::PROCEED, result2); EXPECT_EQ(content::NavigationThrottle::DEFER, result3); break; case 3: EXPECT_EQ(content::NavigationThrottle::PROCEED, result2); EXPECT_EQ(content::NavigationThrottle::PROCEED, result3); break; default: NOTREACHED(); } } ",0 "PDFiumEngine::MouseDownState::MouseDownState( const PDFiumPage::Area& area, const PDFiumPage::LinkTarget& target) : area_(area), target_(target) { } ",0 "static int ignoring_children(struct sighand_struct *sigh) { int ret; spin_lock(&sigh->siglock); ret = (sigh->action[SIGCHLD-1].sa.sa_handler == SIG_IGN) || (sigh->action[SIGCHLD-1].sa.sa_flags & SA_NOCLDWAIT); spin_unlock(&sigh->siglock); return ret; } ",0 "static void ext4_handle_error(struct super_block *sb) { struct ext4_super_block *es = EXT4_SB(sb)->s_es; EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; es->s_state |= cpu_to_le16(EXT4_ERROR_FS); if (sb->s_flags & MS_RDONLY) return; if (!test_opt(sb, ERRORS_CONT)) { journal_t *journal = EXT4_SB(sb)->s_journal; EXT4_SB(sb)->s_mount_flags |= EXT4_MF_FS_ABORTED; if (journal) jbd2_journal_abort(journal, -EIO); } if (test_opt(sb, ERRORS_RO)) { ext4_msg(sb, KERN_CRIT, ""Remounting filesystem read-only""); sb->s_flags |= MS_RDONLY; } ext4_commit_super(sb, 1); if (test_opt(sb, ERRORS_PANIC)) panic(""EXT4-fs (device %s): panic forced after error\n"", sb->s_id); } ",0 "static int parse_check_truncation(struct jv_parser* p) { return ((p->flags & JV_PARSE_SEQ) && !p->last_ch_was_ws && (p->stackpos > 0 || p->tokenpos > 0 || jv_get_kind(p->next) == JV_KIND_NUMBER)); } ",0 " static void qp_event_handler(struct ib_event *event, void *context) { struct svc_xprt *xprt = context; switch (event->event) { /* These are considered benign events */ case IB_EVENT_PATH_MIG: case IB_EVENT_COMM_EST: case IB_EVENT_SQ_DRAINED: case IB_EVENT_QP_LAST_WQE_REACHED: dprintk(""svcrdma: QP event %s (%d) received for QP=%p\n"", ib_event_msg(event->event), event->event, event->element.qp); break; /* These are considered fatal events */ case IB_EVENT_PATH_MIG_ERR: case IB_EVENT_QP_FATAL: case IB_EVENT_QP_REQ_ERR: case IB_EVENT_QP_ACCESS_ERR: case IB_EVENT_DEVICE_FATAL: default: dprintk(""svcrdma: QP ERROR event %s (%d) received for QP=%p, "" ""closing transport\n"", ib_event_msg(event->event), event->event, event->element.qp); set_bit(XPT_CLOSE, &xprt->xpt_flags); break; } } ",0 "void DevToolsClient::sendMessageToBackend(const WebString& message) { SendToAgent(DevToolsAgentMsg_DispatchOnInspectorBackend(MSG_ROUTING_NONE, message.utf8())); } ",0 "map_engine_on_map_event(map_op_t op, script_t* script) { script_t* old_script; old_script = s_def_map_scripts[op]; s_def_map_scripts[op] = script_ref(script); script_unref(old_script); } ",0 "SelectionInDOMTree createSelection(const size_t start, const size_t end, const bool isDirectional, Element* element) { const EphemeralRange& startRange = PlainTextRange(0, static_cast(start)).createRange(*element); DCHECK(startRange.isNotNull()); const Position& startPosition = startRange.endPosition(); const EphemeralRange& endRange = PlainTextRange(0, static_cast(end)).createRange(*element); DCHECK(endRange.isNotNull()); const Position& endPosition = endRange.endPosition(); const SelectionInDOMTree& selection = SelectionInDOMTree::Builder() .setBaseAndExtent(startPosition, endPosition) .setIsDirectional(isDirectional) .build(); return selection; } ",0 "DropData* WebContentsImpl::GetDropData() { return view_->GetDropData(); } ",0 " ShelfDragCallback(const gfx::Rect& auto_hidden_shelf_bounds, const gfx::Rect& visible_shelf_bounds) : auto_hidden_shelf_bounds_(auto_hidden_shelf_bounds), visible_shelf_bounds_(visible_shelf_bounds), was_visible_on_drag_start_(false) { EXPECT_EQ(auto_hidden_shelf_bounds_.size(), visible_shelf_bounds_.size()); } ",0 "static enum hrtimer_restart posix_timer_fn(struct hrtimer *timer) { struct k_itimer *timr; unsigned long flags; int si_private = 0; enum hrtimer_restart ret = HRTIMER_NORESTART; timr = container_of(timer, struct k_itimer, it.real.timer); spin_lock_irqsave(&timr->it_lock, flags); timr->it_active = 0; if (timr->it_interval != 0) si_private = ++timr->it_requeue_pending; if (posix_timer_event(timr, si_private)) { /* * signal was not sent because of sig_ignor * we will not get a call back to restart it AND * it should be restarted. */ if (timr->it_interval != 0) { ktime_t now = hrtimer_cb_get_time(timer); /* * FIXME: What we really want, is to stop this * timer completely and restart it in case the * SIG_IGN is removed. This is a non trivial * change which involves sighand locking * (sigh !), which we don't want to do late in * the release cycle. * * For now we just let timers with an interval * less than a jiffie expire every jiffie to * avoid softirq starvation in case of SIG_IGN * and a very small interval, which would put * the timer right back on the softirq pending * list. By moving now ahead of time we trick * hrtimer_forward() to expire the timer * later, while we still maintain the overrun * accuracy, but have some inconsistency in * the timer_gettime() case. This is at least * better than a starved softirq. A more * complex fix which solves also another related * inconsistency is already in the pipeline. */ #ifdef CONFIG_HIGH_RES_TIMERS { ktime_t kj = NSEC_PER_SEC / HZ; if (timr->it_interval < kj) now = ktime_add(now, kj); } #endif timr->it_overrun += (unsigned int) hrtimer_forward(timer, now, timr->it_interval); ret = HRTIMER_RESTART; ++timr->it_requeue_pending; timr->it_active = 1; } } unlock_timer(timr, flags); return ret; } ",1 "int pit_has_pending_timer(struct kvm_vcpu *vcpu) { struct kvm_pit *pit = vcpu->kvm->arch.vpit; if (pit && kvm_vcpu_is_bsp(vcpu) && pit->pit_state.irq_ack) return atomic_read(&pit->pit_state.pit_timer.pending); return 0; } ",0 "__releases(bitlock) __acquires(bitlock) { struct va_format vaf; va_list args; struct ext4_super_block *es = EXT4_SB(sb)->s_es; es->s_last_error_ino = cpu_to_le32(ino); es->s_last_error_block = cpu_to_le64(block); __save_error_info(sb, function, line); va_start(args, fmt); vaf.fmt = fmt; vaf.va = &args; printk(KERN_CRIT ""EXT4-fs error (device %s): %s:%d: group %u, "", sb->s_id, function, line, grp); if (ino) printk(KERN_CONT ""inode %lu: "", ino); if (block) printk(KERN_CONT ""block %llu:"", (unsigned long long) block); printk(KERN_CONT ""%pV\n"", &vaf); va_end(args); if (test_opt(sb, ERRORS_CONT)) { ext4_commit_super(sb, 0); return; } ext4_unlock_group(sb, grp); ext4_handle_error(sb); /* * We only get here in the ERRORS_RO case; relocking the group * may be dangerous, but nothing bad will happen since the * filesystem will have already been marked read/only and the * journal has been aborted. We return 1 as a hint to callers * who might what to use the return value from * ext4_grp_locked_error() to distinguish beween the * ERRORS_CONT and ERRORS_RO case, and perhaps return more * aggressively from the ext4 function in question, with a * more appropriate error code. */ ext4_lock_group(sb, grp); return; } ",0 "std::string AutomationProvider::GetProtocolVersion() { chrome::VersionInfo version_info; return version_info.Version().c_str(); } ",0 "static int ecp_select_comb( const mbedtls_ecp_group *grp, mbedtls_ecp_point *R, const mbedtls_ecp_point T[], unsigned char t_len, unsigned char i ) { int ret; unsigned char ii, j; /* Ignore the ""sign"" bit and scale down */ ii = ( i & 0x7Fu ) >> 1; /* Read the whole table to thwart cache-based timing attacks */ for( j = 0; j < t_len; j++ ) { MBEDTLS_MPI_CHK( mbedtls_mpi_safe_cond_assign( &R->X, &T[j].X, j == ii ) ); MBEDTLS_MPI_CHK( mbedtls_mpi_safe_cond_assign( &R->Y, &T[j].Y, j == ii ) ); } /* Safely invert result if i is ""negative"" */ MBEDTLS_MPI_CHK( ecp_safe_invert_jac( grp, R, i >> 7 ) ); cleanup: return( ret ); } ",0 "static size_t PIDLSize(LPITEMIDLIST pidl) { size_t s = 0; while (pidl->mkid.cb > 0) { s += pidl->mkid.cb; pidl = PIDLNext(pidl); } return 2 + s; } ",0 " scoped_refptr LoadAndExpectSuccess(const std::string& name) { std::string error; scoped_refptr extension = LoadExtension(name, &error); EXPECT_TRUE(extension) << name; EXPECT_EQ("""", error) << name; return extension; } ",0 "same_owner_str(struct nfs4_stateowner *sop, struct xdr_netobj *owner) { return (sop->so_owner.len == owner->len) && 0 == memcmp(sop->so_owner.data, owner->data, owner->len); } ",0 "static inline void h2_release_buf(struct h2c *h2c, struct buffer **bptr) { if ((*bptr)->size) { b_free(bptr); offer_buffers(h2c->buf_wait.target, tasks_run_queue + applets_active_queue); } } ",0 "static int bin_main(RCore *r, int mode, int va) { RBinAddr *binmain = r_bin_get_sym (r->bin, R_BIN_SYM_MAIN); ut64 addr; if (!binmain) { return false; } addr = va ? r_bin_a2b (r->bin, binmain->vaddr) : binmain->paddr; if (IS_MODE_SET (mode)) { r_flag_space_set (r->flags, ""symbols""); r_flag_set (r->flags, ""main"", addr, r->blocksize); } else if (IS_MODE_SIMPLE (mode)) { r_cons_printf (""%""PFMT64d, addr); } else if (IS_MODE_RAD (mode)) { r_cons_printf (""fs symbols\n""); r_cons_printf (""f main @ 0x%08""PFMT64x""\n"", addr); } else if (IS_MODE_JSON (mode)) { r_cons_printf (""{\""vaddr\"":%"" PFMT64d "",\""paddr\"":%"" PFMT64d ""}"", addr, binmain->paddr); } else { r_cons_printf (""[Main]\n""); r_cons_printf (""vaddr=0x%08""PFMT64x"" paddr=0x%08""PFMT64x""\n"", addr, binmain->paddr); } return true; } ",0 "void GpuCommandBufferStub::OnRegisterTransferBuffer( base::SharedMemoryHandle transfer_buffer, size_t size, int32 id_request, IPC::Message* reply_message) { #if defined(OS_WIN) base::SharedMemory shared_memory(transfer_buffer, false, channel_->renderer_process()); #else #endif if (command_buffer_.get()) { int32 id = command_buffer_->RegisterTransferBuffer(&shared_memory, size, id_request); GpuCommandBufferMsg_RegisterTransferBuffer::WriteReplyParams(reply_message, id); } else { reply_message->set_reply_error(); } Send(reply_message); } ",1 "status_t SoftAVC::resetDecoder() { ivd_ctl_reset_ip_t s_ctl_ip; ivd_ctl_reset_op_t s_ctl_op; IV_API_CALL_STATUS_T status; s_ctl_ip.e_cmd = IVD_CMD_VIDEO_CTL; s_ctl_ip.e_sub_cmd = IVD_CMD_CTL_RESET; s_ctl_ip.u4_size = sizeof(ivd_ctl_reset_ip_t); s_ctl_op.u4_size = sizeof(ivd_ctl_reset_op_t); status = ivdec_api_function(mCodecCtx, (void *)&s_ctl_ip, (void *)&s_ctl_op); if (IV_SUCCESS != status) { ALOGE(""Error in reset: 0x%x"", s_ctl_op.u4_error_code); return UNKNOWN_ERROR; } mSignalledError = false; /* Set number of cores/threads to be used by the codec */ setNumCores(); mStride = 0; return OK; } ",0 "static void voidMethodDefaultNullStringStringArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodDefaultNullStringStringArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void RenderViewTest::SendWebMouseEvent( const blink::WebMouseEvent& mouse_event) { SendInputEvent(mouse_event); } ",0 "JSValue jsTestObjXMLObjAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* impl = static_cast(castedThis->impl()); JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->xmlObjAttr())); return result; } ",0 "path_length(PG_FUNCTION_ARGS) { PATH *path = PG_GETARG_PATH_P(0); float8 result = 0.0; int i; for (i = 0; i < path->npts; i++) { int iprev; if (i > 0) iprev = i - 1; else { if (!path->closed) continue; iprev = path->npts - 1; /* include the closure segment */ } result += point_dt(&path->p[iprev], &path->p[i]); } PG_RETURN_FLOAT8(result); } ",0 "sp BufferQueueConsumer::getSidebandStream() const { return mCore->mSidebandStream; } ",0 "handle_t *ext3_journal_start_sb(struct super_block *sb, int nblocks) { journal_t *journal; if (sb->s_flags & MS_RDONLY) return ERR_PTR(-EROFS); /* Special case here: if the journal has aborted behind our * backs (eg. EIO in the commit thread), then we still need to * take the FS itself readonly cleanly. */ journal = EXT3_SB(sb)->s_journal; if (is_journal_aborted(journal)) { ext3_abort(sb, __func__, ""Detected aborted journal""); return ERR_PTR(-EROFS); } return journal_start(journal, nblocks); } ",0 "base::string16 AuthenticatorTimeoutErrorModel::GetStepDescription() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_ERROR_TIMEOUT_DESCRIPTION); } ",0 "megasas_adp_reset_xscale(struct megasas_instance *instance, struct megasas_register_set __iomem *regs) { u32 i; u32 pcidata; writel(MFI_ADP_RESET, ®s->inbound_doorbell); for (i = 0; i < 3; i++) msleep(1000); /* sleep for 3 secs */ pcidata = 0; pci_read_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET, &pcidata); dev_notice(&instance->pdev->dev, ""pcidata = %x\n"", pcidata); if (pcidata & 0x2) { dev_notice(&instance->pdev->dev, ""mfi 1068 offset read=%x\n"", pcidata); pcidata &= ~0x2; pci_write_config_dword(instance->pdev, MFI_1068_PCSR_OFFSET, pcidata); for (i = 0; i < 2; i++) msleep(1000); /* need to wait 2 secs again */ pcidata = 0; pci_read_config_dword(instance->pdev, MFI_1068_FW_HANDSHAKE_OFFSET, &pcidata); dev_notice(&instance->pdev->dev, ""1068 offset handshake read=%x\n"", pcidata); if ((pcidata & 0xffff0000) == MFI_1068_FW_READY) { dev_notice(&instance->pdev->dev, ""1068 offset pcidt=%x\n"", pcidata); pcidata = 0; pci_write_config_dword(instance->pdev, MFI_1068_FW_HANDSHAKE_OFFSET, pcidata); } } return 0; } ",0 "void ExtensionInstalledBubble::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { const Extension* extension = content::Details(details).ptr(); if (extension == extension_) { animation_wait_retries_ = 0; MessageLoopForUI::current()->PostTask( FROM_HERE, base::Bind(&ExtensionInstalledBubble::ShowInternal, base::Unretained(this))); } } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const Extension* extension = content::Details(details)->extension; if (extension == extension_) extension_ = NULL; } else { NOTREACHED() << L""Received unexpected notification""; } } ",0 "size_t mptsas_config_ioc_3(MPTSASState *s, uint8_t **data, int address) { return MPTSAS_CONFIG_PACK(3, MPI_CONFIG_PAGETYPE_IOC, 0x00, ""*b*b*w""); } ",0 "static void destroy_super(struct super_block *s) { int i; list_lru_destroy(&s->s_dentry_lru); list_lru_destroy(&s->s_inode_lru); #ifdef CONFIG_SMP free_percpu(s->s_files); #endif for (i = 0; i < SB_FREEZE_LEVELS; i++) percpu_counter_destroy(&s->s_writers.counter[i]); security_sb_free(s); WARN_ON(!list_empty(&s->s_mounts)); kfree(s->s_subtype); kfree(s->s_options); kfree_rcu(s, rcu); } ",1 "static int should_retry(AVIOContext *pb, int error_code) { if (error_code == AVERROR_EOF || avio_feof(pb)) return 0; return 1; } ",0 "static int decode_pkg(nw_ses *ses, void *data, size_t max) { struct clt_info *info = ses->privdata; if (!info->upgrade) { return max; } if (max < 2) return 0; uint8_t *p = data; size_t pkg_size = 0; memset(&info->frame, 0, sizeof(info->frame)); info->frame.fin = p[0] & 0x80; info->frame.opcode = p[0] & 0x0f; if (!is_good_opcode(info->frame.opcode)) return -1; uint8_t mask = p[1] & 0x80; if (mask == 0) return -1; uint8_t len = p[1] & 0x7f; if (len < 126) { pkg_size = 2; info->frame.payload_len = len; } else if (len == 126) { pkg_size = 2 + 2; if (max < pkg_size) return 0; info->frame.payload_len = be16toh(*(uint16_t *)(p + 2)); } else if (len == 127) { pkg_size = 2 + 8; if (max < pkg_size) return 0; info->frame.payload_len = be64toh(*(uint64_t *)(p + 2)); } uint8_t masks[4]; memcpy(masks, p + pkg_size, sizeof(masks)); pkg_size += sizeof(masks); info->frame.payload = p + pkg_size; pkg_size += info->frame.payload_len; if (max < pkg_size) return 0; p = info->frame.payload; for (size_t i = 0; i < info->frame.payload_len; ++i) { p[i] = p[i] ^ masks[i & 3]; } return pkg_size; } ",0 "void ewk_frame_load_committed(Evas_Object* ewkFrame) { evas_object_smart_callback_call(ewkFrame, ""load,committed"", 0); } ",0 "static std::map getMimeTypeToDownloadTextMap() { return {{""text/plain"", DOWNLOAD_TEXT_PLAIN}, {""text/css"", DOWNLOAD_TEXT_CSS}, {""text/csv"", DOWNLOAD_TEXT_CSV}, {""text/html"", DOWNLOAD_TEXT_HTML}, {""text/calendar"", DOWNLOAD_TEXT_CALENDAR}}; } ",0 "static int core_create_proxy_req(request_rec *r, request_rec *pr) { return core_create_req(pr); } ",0 "MagickExport MagickBooleanType SetImageClipMask(Image *image, const Image *clip_mask) { assert(image != (Image *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); assert(image->signature == MagickSignature); if (clip_mask != (const Image *) NULL) if ((clip_mask->columns != image->columns) || (clip_mask->rows != image->rows)) ThrowBinaryException(ImageError,""ImageSizeDiffers"",image->filename); if (image->clip_mask != (Image *) NULL) image->clip_mask=DestroyImage(image->clip_mask); image->clip_mask=NewImageList(); if (clip_mask == (Image *) NULL) return(MagickTrue); if (SetImageStorageClass(image,DirectClass) == MagickFalse) return(MagickFalse); image->clip_mask=CloneImage(clip_mask,0,0,MagickTrue,&image->exception); if (image->clip_mask == (Image *) NULL) return(MagickFalse); return(MagickTrue); } ",0 "static int devm_mdiobus_match(struct device *dev, void *res, void *data) { struct mii_bus **r = res; if (WARN_ON(!r || !*r)) return 0; return *r == data; } ",0 "static void gtco_input_close(struct input_dev *inputdev) { struct gtco *device = input_get_drvdata(inputdev); usb_kill_urb(device->urbinfo); } ",0 " bool IDNSpoofChecker::SimilarToTopDomains(base::StringPiece16 hostname) { size_t hostname_length = hostname.length() - (hostname.back() == '.' ? 1 : 0); icu::UnicodeString ustr_host(FALSE, hostname.data(), hostname_length); if (lgc_letters_n_ascii_.span(ustr_host, 0, USET_SPAN_CONTAINED) == ustr_host.length()) diacritic_remover_.get()->transliterate(ustr_host); extra_confusable_mapper_.get()->transliterate(ustr_host); UErrorCode status = U_ZERO_ERROR; icu::UnicodeString ustr_skeleton; uspoof_getSkeletonUnicodeString(checker_, 0, ustr_host, ustr_skeleton, &status); if (U_FAILURE(status)) return false; std::string skeleton; return LookupMatchInTopDomains(ustr_skeleton.toUTF8String(skeleton)); } ",1 "void efx_schedule_slow_fill(struct efx_rx_queue *rx_queue) { mod_timer(&rx_queue->slow_fill, jiffies + msecs_to_jiffies(100)); } ",0 "RenderProcessHostPrivilege GetProcessPrivilege( content::RenderProcessHost* process_host, ProcessMap* process_map, ExtensionRegistry* registry) { std::set extension_ids = process_map->GetExtensionsInProcess(process_host->GetID()); if (extension_ids.empty()) return PRIV_NORMAL; for (const std::string& extension_id : extension_ids) { const Extension* extension = registry->enabled_extensions().GetByID(extension_id); if (extension && AppIsolationInfo::HasIsolatedStorage(extension)) return PRIV_ISOLATED; if (extension && extension->is_hosted_app()) return PRIV_HOSTED; } return PRIV_EXTENSION; } ",0 "ExtensionsAPIClient* ExtensionsAPIClient::Get() { return g_instance; } ",0 "static void ceph_x_destroy(struct ceph_auth_client *ac) { struct ceph_x_info *xi = ac->private; struct rb_node *p; dout(""ceph_x_destroy %p\n"", ac); ceph_crypto_key_destroy(&xi->secret); while ((p = rb_first(&xi->ticket_handlers)) != NULL) { struct ceph_x_ticket_handler *th = rb_entry(p, struct ceph_x_ticket_handler, node); remove_ticket_handler(ac, th); } if (xi->auth_authorizer.buf) ceph_buffer_put(xi->auth_authorizer.buf); kfree(ac->private); ac->private = NULL; } ",0 "static PHP_FUNCTION(session_module_name) { char *name = NULL; int name_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""|s"", &name, &name_len) == FAILURE) { return; } /* Set return_value to current module name */ if (PS(mod) && PS(mod)->s_name) { RETVAL_STRING(safe_estrdup(PS(mod)->s_name), 0); } else { RETVAL_EMPTY_STRING(); } if (name) { if (!_php_find_ps_module(name TSRMLS_CC)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Cannot find named PHP session module (%s)"", name); zval_dtor(return_value); RETURN_FALSE; } if (PS(mod_data) || PS(mod_user_implemented)) { PS(mod)->s_close(&PS(mod_data) TSRMLS_CC); } PS(mod_data) = NULL; zend_alter_ini_entry(""session.save_handler"", sizeof(""session.save_handler""), name, name_len, PHP_INI_USER, PHP_INI_STAGE_RUNTIME); } } ",0 "bool HttpResponseHeaders::GetMimeType(std::string* mime_type) const { std::string unused; GetMimeTypeAndCharset(mime_type, &unused); return !mime_type->empty(); } ",0 "static void hub_irq(struct urb *urb) { struct usb_hub *hub = urb->context; int status = urb->status; unsigned i; unsigned long bits; switch (status) { case -ENOENT: /* synchronous unlink */ case -ECONNRESET: /* async unlink */ case -ESHUTDOWN: /* hardware going away */ return; default: /* presumably an error */ /* Cause a hub reset after 10 consecutive errors */ dev_dbg(hub->intfdev, ""transfer --> %d\n"", status); if ((++hub->nerrors < 10) || hub->error) goto resubmit; hub->error = status; /* FALL THROUGH */ /* let hub_wq handle things */ case 0: /* we got data: port status changed */ bits = 0; for (i = 0; i < urb->actual_length; ++i) bits |= ((unsigned long) ((*hub->buffer)[i])) << (i*8); hub->event_bits[0] = bits; break; } hub->nerrors = 0; /* Something happened, let hub_wq figure it out */ kick_hub_wq(hub); resubmit: if (hub->quiescing) return; status = usb_submit_urb(hub->urb, GFP_ATOMIC); if (status != 0 && status != -ENODEV && status != -EPERM) dev_err(hub->intfdev, ""resubmit --> %d\n"", status); } ",0 "void AppCacheHost::CompleteTransfer(int host_id, AppCacheFrontend* frontend) { host_id_ = host_id; frontend_ = frontend; } ",0 "static int __vsock_core_init(void) { int err; vsock_init_tables(); err = misc_register(&vsock_device); if (err) { pr_err(""Failed to register misc device\n""); return -ENOENT; } err = proto_register(&vsock_proto, 1); /* we want our slab */ if (err) { pr_err(""Cannot register vsock protocol\n""); goto err_misc_deregister; } err = sock_register(&vsock_family_ops); if (err) { pr_err(""could not register af_vsock (%d) address family: %d\n"", AF_VSOCK, err); goto err_unregister_proto; } return 0; err_unregister_proto: proto_unregister(&vsock_proto); err_misc_deregister: misc_deregister(&vsock_device); return err; } ",0 "static void __exit exit_nfs_fs(void) { nfs_destroy_directcache(); nfs_destroy_writepagecache(); nfs_destroy_readpagecache(); nfs_destroy_inodecache(); nfs_destroy_nfspagecache(); #ifdef CONFIG_PROC_FS rpc_proc_unregister(""nfs""); #endif unregister_nfs_fs(); nfs_fs_proc_exit(); nfsiod_stop(); } ",0 "void BaseRenderingContext2D::setGlobalAlpha(double alpha) { if (!(alpha >= 0 && alpha <= 1)) return; if (GetState().GlobalAlpha() == alpha) return; ModifiableState().SetGlobalAlpha(alpha); } ",0 "void notrace __ppc64_runlatch_on(void) { struct thread_info *ti = current_thread_info(); unsigned long ctrl; ctrl = mfspr(SPRN_CTRLF); ctrl |= CTRL_RUNLATCH; mtspr(SPRN_CTRLT, ctrl); ti->local_flags |= _TLF_RUNLATCH; } ",0 "Address NormalPageArena::allocateFromFreeList(size_t allocationSize, size_t gcInfoIndex) { size_t bucketSize = static_cast(1) << m_freeList.m_biggestFreeListIndex; int index = m_freeList.m_biggestFreeListIndex; for (; index > 0; --index, bucketSize >>= 1) { FreeListEntry* entry = m_freeList.m_freeLists[index]; if (allocationSize > bucketSize) { if (!entry || entry->size() < allocationSize) break; } if (entry) { entry->unlink(&m_freeList.m_freeLists[index]); setAllocationPoint(entry->getAddress(), entry->size()); ASSERT(hasCurrentAllocationArea()); ASSERT(remainingAllocationSize() >= allocationSize); m_freeList.m_biggestFreeListIndex = index; return allocateObject(allocationSize, gcInfoIndex); } } m_freeList.m_biggestFreeListIndex = index; return nullptr; } ",0 "static jboolean getAdapterPropertyNative(JNIEnv *env, jobject obj, jint type) { ALOGV(""%s:"",__FUNCTION__); jboolean result = JNI_FALSE; if (!sBluetoothInterface) return result; int ret = sBluetoothInterface->get_adapter_property((bt_property_type_t) type); result = (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; return result; } ",0 "static int smart_socket_enqueue(asocket* s, apacket* p) { unsigned len; #if ADB_HOST char* service = nullptr; char* serial = nullptr; TransportType type = kTransportAny; #endif D(""SS(%d): enqueue %d"", s->id, p->len); if (s->pkt_first == 0) { s->pkt_first = p; s->pkt_last = p; } else { if ((s->pkt_first->len + p->len) > s->get_max_payload()) { D(""SS(%d): overflow"", s->id); put_apacket(p); goto fail; } memcpy(s->pkt_first->data + s->pkt_first->len, p->data, p->len); s->pkt_first->len += p->len; put_apacket(p); p = s->pkt_first; } /* don't bother if we can't decode the length */ if (p->len < 4) { return 0; } len = unhex(p->data, 4); if ((len < 1) || (len > MAX_PAYLOAD_V1)) { D(""SS(%d): bad size (%d)"", s->id, len); goto fail; } D(""SS(%d): len is %d"", s->id, len); /* can't do anything until we have the full header */ if ((len + 4) > p->len) { D(""SS(%d): waiting for %d more bytes"", s->id, len + 4 - p->len); return 0; } p->data[len + 4] = 0; D(""SS(%d): '%s'"", s->id, (char*)(p->data + 4)); #if ADB_HOST service = (char*)p->data + 4; if (!strncmp(service, ""host-serial:"", strlen(""host-serial:""))) { char* serial_end; service += strlen(""host-serial:""); serial_end = internal::skip_host_serial(service); if (serial_end) { *serial_end = 0; // terminate string serial = service; service = serial_end + 1; } } else if (!strncmp(service, ""host-usb:"", strlen(""host-usb:""))) { type = kTransportUsb; service += strlen(""host-usb:""); } else if (!strncmp(service, ""host-local:"", strlen(""host-local:""))) { type = kTransportLocal; service += strlen(""host-local:""); } else if (!strncmp(service, ""host:"", strlen(""host:""))) { type = kTransportAny; service += strlen(""host:""); } else { service = nullptr; } if (service) { asocket* s2; /* some requests are handled immediately -- in that ** case the handle_host_request() routine has sent ** the OKAY or FAIL message and all we have to do ** is clean up. */ if (handle_host_request(service, type, serial, s->peer->fd, s) == 0) { /* XXX fail message? */ D(""SS(%d): handled host service '%s'"", s->id, service); goto fail; } if (!strncmp(service, ""transport"", strlen(""transport""))) { D(""SS(%d): okay transport"", s->id); p->len = 0; return 0; } /* try to find a local service with this name. ** if no such service exists, we'll fail out ** and tear down here. */ s2 = create_host_service_socket(service, serial); if (s2 == 0) { D(""SS(%d): couldn't create host service '%s'"", s->id, service); SendFail(s->peer->fd, ""unknown host service""); goto fail; } /* we've connected to a local host service, ** so we make our peer back into a regular ** local socket and bind it to the new local ** service socket, acknowledge the successful ** connection, and close this smart socket now ** that its work is done. */ SendOkay(s->peer->fd); s->peer->ready = local_socket_ready; s->peer->shutdown = nullptr; s->peer->close = local_socket_close; s->peer->peer = s2; s2->peer = s->peer; s->peer = 0; D(""SS(%d): okay"", s->id); s->close(s); /* initial state is ""ready"" */ s2->ready(s2); return 0; } #else /* !ADB_HOST */ if (s->transport == nullptr) { std::string error_msg = ""unknown failure""; s->transport = acquire_one_transport(kTransportAny, nullptr, nullptr, &error_msg); if (s->transport == nullptr) { SendFail(s->peer->fd, error_msg); goto fail; } } #endif if (!(s->transport) || (s->transport->connection_state == kCsOffline)) { /* if there's no remote we fail the connection ** right here and terminate it */ SendFail(s->peer->fd, ""device offline (x)""); goto fail; } /* instrument our peer to pass the success or fail ** message back once it connects or closes, then ** detach from it, request the connection, and ** tear down */ s->peer->ready = local_socket_ready_notify; s->peer->shutdown = nullptr; s->peer->close = local_socket_close_notify; s->peer->peer = 0; /* give him our transport and upref it */ s->peer->transport = s->transport; connect_to_remote(s->peer, (char*)(p->data + 4)); s->peer = 0; s->close(s); return 1; fail: /* we're going to close our peer as a side-effect, so ** return -1 to signal that state to the local socket ** who is enqueueing against us */ s->close(s); return -1; } ",0 "static void DocumentAttributeAttributeSetter( v8::Local v8_value, const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(isolate, ExceptionState::kSetterContext, ""TestObject"", ""documentAttribute""); Document* cpp_value = V8Document::ToImplWithTypeCheck(info.GetIsolate(), v8_value); if (!cpp_value) { exception_state.ThrowTypeError(""The provided value is not of type 'Document'.""); return; } impl->setDocumentAttribute(cpp_value); } ",0 "static int cac_select_file_by_type(sc_card_t *card, const sc_path_t *in_path, sc_file_t **file_out, int type) { struct sc_context *ctx; struct sc_apdu apdu; unsigned char buf[SC_MAX_APDU_BUFFER_SIZE]; unsigned char pathbuf[SC_MAX_PATH_SIZE], *path = pathbuf; int r, pathlen, pathtype; struct sc_file *file = NULL; cac_private_data_t * priv = CAC_DATA(card); assert(card != NULL && in_path != NULL); ctx = card->ctx; SC_FUNC_CALLED(ctx, SC_LOG_DEBUG_VERBOSE); memcpy(path, in_path->value, in_path->len); pathlen = in_path->len; pathtype = in_path->type; sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""path->aid=%x %x %x %x %x %x %x len=%""SC_FORMAT_LEN_SIZE_T""u, path->value = %x %x %x %x len=%""SC_FORMAT_LEN_SIZE_T""u path->type=%d (%x)"", in_path->aid.value[0], in_path->aid.value[1], in_path->aid.value[2], in_path->aid.value[3], in_path->aid.value[4], in_path->aid.value[5], in_path->aid.value[6], in_path->aid.len, in_path->value[0], in_path->value[1], in_path->value[2], in_path->value[3], in_path->len, in_path->type, in_path->type); sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""file_out=%p index=%d count=%d\n"", file_out, in_path->index, in_path->count); /* Sigh, sc_key_select expects paths to keys to have specific formats. There is no override. * we have to add some bytes to the path to make it happy. A better fix would be to give sc_key_file * a flag that says 'no, really this path is fine'. We only need to do this for private keys */ if ((pathlen > 2) && (pathlen <= 4) && memcmp(path, ""\x3F\x00"", 2) == 0) { if (pathlen > 2) { path += 2; pathlen -= 2; } } /* CAC has multiple different type of objects that aren't PKCS #15. When we read * them we need convert them to something PKCS #15 would understand. Find the object * and object type here: */ if (priv) { /* don't record anything if we haven't been initialized yet */ priv->object_type = CAC_OBJECT_TYPE_GENERIC; if (cac_is_cert(priv, in_path)) { priv->object_type = CAC_OBJECT_TYPE_CERT; } /* forget any old cached values */ if (priv->cache_buf) { free(priv->cache_buf); priv->cache_buf = NULL; } priv->cache_buf_len = 0; priv->cached = 0; } if (in_path->aid.len) { if (!pathlen) { memcpy(path, in_path->aid.value, in_path->aid.len); pathlen = in_path->aid.len; pathtype = SC_PATH_TYPE_DF_NAME; } else { /* First, select the application */ sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE,""select application"" ); sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xA4, 4, 0); apdu.data = in_path->aid.value; apdu.datalen = in_path->aid.len; apdu.lc = in_path->aid.len; r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, r, ""APDU transmit failed""); r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r) LOG_FUNC_RETURN(ctx, r); } } sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xA4, 0, 0); switch (pathtype) { /* ideally we would had SC_PATH_TYPE_OBJECT_ID and add code to the iso7816 select. * Unfortunately we'd also need to update the caching code as well. For now just * use FILE_ID and change p1 here */ case SC_PATH_TYPE_FILE_ID: apdu.p1 = 2; if (pathlen != 2) return SC_ERROR_INVALID_ARGUMENTS; break; case SC_PATH_TYPE_DF_NAME: apdu.p1 = 4; break; default: LOG_FUNC_RETURN(ctx, SC_ERROR_INVALID_ARGUMENTS); } apdu.lc = pathlen; apdu.data = path; apdu.datalen = pathlen; apdu.resp = buf; apdu.resplen = sizeof(buf); apdu.le = sc_get_max_recv_size(card) < 256 ? sc_get_max_recv_size(card) : 256; if (file_out != NULL) { apdu.p2 = 0; /* first record, return FCI */ } else { apdu.p2 = 0x0C; } r = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, r, ""APDU transmit failed""); if (file_out == NULL) { /* For some cards 'SELECT' can be only with request to return FCI/FCP. */ r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (apdu.sw1 == 0x6A && apdu.sw2 == 0x86) { apdu.p2 = 0x00; apdu.resplen = sizeof(buf); if (sc_transmit_apdu(card, &apdu) == SC_SUCCESS) r = sc_check_sw(card, apdu.sw1, apdu.sw2); } if (apdu.sw1 == 0x61) LOG_FUNC_RETURN(ctx, SC_SUCCESS); LOG_FUNC_RETURN(ctx, r); } r = sc_check_sw(card, apdu.sw1, apdu.sw2); if (r) LOG_FUNC_RETURN(ctx, r); /* This needs to come after the applet selection */ if (priv && in_path->len >= 2) { /* get applet properties to know if we can treat the * buffer as SimpleLTV and if we have PKI applet. * * Do this only if we select applets for reading * (not during driver initialization) */ cac_properties_t prop; size_t i = -1; r = cac_get_properties(card, &prop); if (r == SC_SUCCESS) { for (i = 0; i < prop.num_objects; i++) { sc_log(card->ctx, ""Searching for our OID: 0x%02x 0x%02x = 0x%02x 0x%02x"", prop.objects[i].oid[0], prop.objects[i].oid[1], in_path->value[0], in_path->value[1]); if (memcmp(prop.objects[i].oid, in_path->value, 2) == 0) break; } } if (i < prop.num_objects) { if (prop.objects[i].privatekey) priv->object_type = CAC_OBJECT_TYPE_CERT; else if (prop.objects[i].simpletlv == 0) priv->object_type = CAC_OBJECT_TYPE_TLV_FILE; } } /* CAC cards never return FCI, fake one */ file = sc_file_new(); if (file == NULL) LOG_FUNC_RETURN(ctx, SC_ERROR_OUT_OF_MEMORY); file->path = *in_path; file->size = CAC_MAX_SIZE; /* we don't know how big, just give a large size until we can read the file */ *file_out = file; SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_NORMAL, SC_SUCCESS); } ",0 " ExtensionsQuotaServiceTest() : extension_a_(""a""), extension_b_(""b""), extension_c_(""c""), loop_(), ui_thread_(BrowserThread::UI, &loop_) { } ",0 "int MockNetworkTransaction::ResumeNetworkStart() { return ERR_FAILED; } ",0 "static int kvm_is_user_mode(void) { int user_mode = 3; if (percpu_read(current_vcpu)) user_mode = kvm_x86_ops->get_cpl(percpu_read(current_vcpu)); return user_mode != 0; } ",0 "dump_pair(gpointer data, gpointer user_data) { name_value_t *pair = data; xmlNode *parent = user_data; crm_xml_add(parent, pair->name, pair->value); } ",0 "void AutofillPopupBaseView::VisibilityChanged(View* starting_from, bool is_visible) { if (is_visible) { ui::AXPlatformNode::OnInputSuggestionsAvailable(); NotifyAccessibilityEvent(ax::mojom::Event::kMenuStart, true); } else { ui::AXPlatformNode::OnInputSuggestionsUnavailable(); NotifyAccessibilityEvent(ax::mojom::Event::kMenuEnd, true); } } ",0 "void btpan_close_handle(btpan_conn_t *p) { BTIF_TRACE_DEBUG(""btpan_close_handle : close handle %d"", p->handle); p->handle = -1; p->local_role = -1; p->remote_role = -1; memset(&p->peer, 0, 6); } ",0 "static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track, AVStream *st) { int i, width = 720, height = 480; int have_palette = 0, have_size = 0; uint32_t palette[16]; char *cur = st->codecpar->extradata; while (cur && *cur) { if (strncmp(""palette:"", cur, 8) == 0) { int i, count; count = sscanf(cur + 8, ""%06""PRIx32"", %06""PRIx32"", %06""PRIx32"", %06""PRIx32"", "" ""%06""PRIx32"", %06""PRIx32"", %06""PRIx32"", %06""PRIx32"", "" ""%06""PRIx32"", %06""PRIx32"", %06""PRIx32"", %06""PRIx32"", "" ""%06""PRIx32"", %06""PRIx32"", %06""PRIx32"", %06""PRIx32"""", &palette[ 0], &palette[ 1], &palette[ 2], &palette[ 3], &palette[ 4], &palette[ 5], &palette[ 6], &palette[ 7], &palette[ 8], &palette[ 9], &palette[10], &palette[11], &palette[12], &palette[13], &palette[14], &palette[15]); for (i = 0; i < count; i++) { palette[i] = rgb_to_yuv(palette[i]); } have_palette = 1; } else if (!strncmp(""size:"", cur, 5)) { sscanf(cur + 5, ""%dx%d"", &width, &height); have_size = 1; } if (have_palette && have_size) break; cur += strcspn(cur, ""\n\r""); cur += strspn(cur, ""\n\r""); } if (have_palette) { track->vos_data = av_malloc(16*4); if (!track->vos_data) return AVERROR(ENOMEM); for (i = 0; i < 16; i++) { AV_WB32(track->vos_data + i * 4, palette[i]); } track->vos_len = 16 * 4; } st->codecpar->width = width; st->codecpar->height = track->height = height; return 0; } ",0 "void js_delregistry(js_State *J, const char *name) { jsR_delproperty(J, J->R, name); } ",0 " load_mac_face( FT_Library library, FT_Stream stream, FT_Long face_index, FT_Face *aface, const FT_Open_Args *args ) { FT_Error error; FT_UNUSED( args ); error = IsMacBinary( library, stream, face_index, aface ); if ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format ) { #undef FT_COMPONENT #define FT_COMPONENT trace_raccess FT_TRACE3(( ""Try as dfont: %s ..."", args->pathname )); error = IsMacResource( library, stream, 0, face_index, aface ); FT_TRACE3(( ""%s\n"", error ? ""failed"" : ""successful"" )); #undef FT_COMPONENT #define FT_COMPONENT trace_objs } if ( ( FT_ERROR_BASE( error ) == FT_Err_Unknown_File_Format || FT_ERROR_BASE( error ) == FT_Err_Invalid_Stream_Operation ) && ( args->flags & FT_OPEN_PATHNAME ) ) error = load_face_in_embedded_rfork( library, stream, face_index, aface, args ); return error; } ",0 "void TabStrip::RemoveAndDeleteTab(Tab* tab) { std::unique_ptr deleter(tab); FindClosingTabResult res(FindClosingTab(tab)); res.first->second.erase(res.second); if (res.first->second.empty()) tabs_closing_map_.erase(res.first); } ",0 "static int megasas_reset_bus_host(struct scsi_cmnd *scmd) { int ret; struct megasas_instance *instance; instance = (struct megasas_instance *)scmd->device->host->hostdata; scmd_printk(KERN_INFO, scmd, ""Controller reset is requested due to IO timeout\n"" ""SCSI command pointer: (%p)\t SCSI host state: %d\t"" "" SCSI host busy: %d\t FW outstanding: %d\n"", scmd, scmd->device->host->shost_state, scsi_host_busy(scmd->device->host), atomic_read(&instance->fw_outstanding)); /* * First wait for all commands to complete */ if (instance->adapter_type == MFI_SERIES) { ret = megasas_generic_reset(scmd); } else { struct megasas_cmd_fusion *cmd; cmd = (struct megasas_cmd_fusion *)scmd->SCp.ptr; if (cmd) megasas_dump_frame(cmd->io_request, MEGA_MPI2_RAID_DEFAULT_IO_FRAME_SIZE); ret = megasas_reset_fusion(scmd->device->host, SCSIIO_TIMEOUT_OCR); } return ret; } ",0 "xsltCheckTopLevelElement(xsltStylesheetPtr style, xmlNodePtr inst, int err) { xmlNodePtr parent; if ((style == NULL) || (inst == NULL) || (inst->ns == NULL)) return(-1); parent = inst->parent; if (parent == NULL) { if (err) { xsltTransformError(NULL, style, inst, ""internal problem: element has no parent\n""); style->errors++; } return(0); } if ((parent->ns == NULL) || (parent->type != XML_ELEMENT_NODE) || ((parent->ns != inst->ns) && (!xmlStrEqual(parent->ns->href, inst->ns->href))) || ((!xmlStrEqual(parent->name, BAD_CAST ""stylesheet"")) && (!xmlStrEqual(parent->name, BAD_CAST ""transform"")))) { if (err) { xsltTransformError(NULL, style, inst, ""element %s only allowed as child of stylesheet\n"", inst->name); style->errors++; } return(0); } return(1); } ",0 "static int nfsd4_register_conn(struct nfsd4_conn *conn) { conn->cn_xpt_user.callback = nfsd4_conn_lost; return register_xpt_user(conn->cn_xprt, &conn->cn_xpt_user); } ",0 "void GfxDeviceCMYKColorSpace::getDefaultColor(GfxColor *color) { color->c[0] = 0; color->c[1] = 0; color->c[2] = 0; color->c[3] = gfxColorComp1; } ",0 "static int iscsi_check_acceptor_state(struct iscsi_param *param, char *value, struct iscsi_conn *conn) { u8 acceptor_boolean_value = 0, proposer_boolean_value = 0; char *negoitated_value = NULL; if (IS_PSTATE_ACCEPTOR(param)) { pr_err(""Received key \""%s\"" twice, protocol error.\n"", param->name); return -1; } if (IS_PSTATE_REJECT(param)) return 0; if (IS_TYPE_BOOL_AND(param)) { if (!strcmp(value, YES)) proposer_boolean_value = 1; if (!strcmp(param->value, YES)) acceptor_boolean_value = 1; if (acceptor_boolean_value && proposer_boolean_value) do {} while (0); else { if (iscsi_update_param_value(param, NO) < 0) return -1; if (!proposer_boolean_value) SET_PSTATE_REPLY_OPTIONAL(param); } } else if (IS_TYPE_BOOL_OR(param)) { if (!strcmp(value, YES)) proposer_boolean_value = 1; if (!strcmp(param->value, YES)) acceptor_boolean_value = 1; if (acceptor_boolean_value || proposer_boolean_value) { if (iscsi_update_param_value(param, YES) < 0) return -1; if (proposer_boolean_value) SET_PSTATE_REPLY_OPTIONAL(param); } } else if (IS_TYPE_NUMBER(param)) { char *tmpptr, buf[11]; u32 acceptor_value = simple_strtoul(param->value, &tmpptr, 0); u32 proposer_value = simple_strtoul(value, &tmpptr, 0); memset(buf, 0, sizeof(buf)); if (!strcmp(param->name, MAXCONNECTIONS) || !strcmp(param->name, MAXBURSTLENGTH) || !strcmp(param->name, FIRSTBURSTLENGTH) || !strcmp(param->name, MAXOUTSTANDINGR2T) || !strcmp(param->name, DEFAULTTIME2RETAIN) || !strcmp(param->name, ERRORRECOVERYLEVEL)) { if (proposer_value > acceptor_value) { sprintf(buf, ""%u"", acceptor_value); if (iscsi_update_param_value(param, &buf[0]) < 0) return -1; } else { if (iscsi_update_param_value(param, value) < 0) return -1; } } else if (!strcmp(param->name, DEFAULTTIME2WAIT)) { if (acceptor_value > proposer_value) { sprintf(buf, ""%u"", acceptor_value); if (iscsi_update_param_value(param, &buf[0]) < 0) return -1; } else { if (iscsi_update_param_value(param, value) < 0) return -1; } } else { if (iscsi_update_param_value(param, value) < 0) return -1; } if (!strcmp(param->name, MAXRECVDATASEGMENTLENGTH)) { struct iscsi_param *param_mxdsl; unsigned long long tmp; int rc; rc = strict_strtoull(param->value, 0, &tmp); if (rc < 0) return -1; conn->conn_ops->MaxRecvDataSegmentLength = tmp; pr_debug(""Saving op->MaxRecvDataSegmentLength from"" "" original initiator received value: %u\n"", conn->conn_ops->MaxRecvDataSegmentLength); param_mxdsl = iscsi_find_param_from_key( MAXXMITDATASEGMENTLENGTH, conn->param_list); if (!param_mxdsl) return -1; rc = iscsi_update_param_value(param, param_mxdsl->value); if (rc < 0) return -1; pr_debug(""Updated %s to target MXDSL value: %s\n"", param->name, param->value); } } else if (IS_TYPE_NUMBER_RANGE(param)) { negoitated_value = iscsi_get_value_from_number_range( param, value); if (!negoitated_value) return -1; if (iscsi_update_param_value(param, negoitated_value) < 0) return -1; } else if (IS_TYPE_VALUE_LIST(param)) { negoitated_value = iscsi_check_valuelist_for_support( param, value); if (!negoitated_value) { pr_err(""Proposer's value list \""%s\"" contains"" "" no valid values from Acceptor's value list"" "" \""%s\"".\n"", value, param->value); return -1; } if (iscsi_update_param_value(param, negoitated_value) < 0) return -1; } else if (IS_PHASE_DECLARATIVE(param)) { if (iscsi_update_param_value(param, value) < 0) return -1; SET_PSTATE_REPLY_OPTIONAL(param); } return 0; } ",0 "SimplifyMarkupCommand::SimplifyMarkupCommand(Document& document, Node* firstNode, Node* nodeAfterLast) : CompositeEditCommand(document), m_firstNode(firstNode), m_nodeAfterLast(nodeAfterLast) { } ",0 "xmlXPathFloorFunction(xmlXPathParserContextPtr ctxt, int nargs) { double f; CHECK_ARITY(1); CAST_TO_NUMBER; CHECK_TYPE(XPATH_NUMBER); XTRUNC(f, ctxt->value->floatval); if (f != ctxt->value->floatval) { if (ctxt->value->floatval > 0) ctxt->value->floatval = f; else ctxt->value->floatval = f - 1; } } ",0 "static void Free_MarkArray( HB_MarkArray* ma ) { HB_UShort n, count; HB_MarkRecord* mr; if ( ma->MarkRecord ) { count = ma->MarkCount; mr = ma->MarkRecord; for ( n = 0; n < count; n++ ) Free_Anchor( &mr[n].MarkAnchor ); FREE( mr ); } } ",0 "load(ImlibImage * im, ImlibProgressFunction progress, char progress_granularity, char immediate_load) { int rc; char p = ' ', numbers = 3, count = 0; int w = 0, h = 0, v = 255, c = 0; char buf[256]; FILE *f = NULL; if (im->data) return 0; f = fopen(im->real_file, ""rb""); if (!f) return 0; /* can't use fgets(), because there might be * binary data after the header and there * needn't be a newline before the data, so * no chance to distinguish between end of buffer * and a binary 0. */ /* read the header info */ rc = 0; /* Error */ c = fgetc(f); if (c != 'P') goto quit; p = fgetc(f); if (p == '1' || p == '4') numbers = 2; /* bitimages don't have max value */ if ((p < '1') || (p > '8')) goto quit; count = 0; while (count < numbers) { c = fgetc(f); if (c == EOF) goto quit; /* eat whitespace */ while (isspace(c)) c = fgetc(f); /* if comment, eat that */ if (c == '#') { do c = fgetc(f); while (c != '\n' && c != EOF); } /* no comment -> proceed */ else { int i = 0; /* read numbers */ while (c != EOF && !isspace(c) && (i < 255)) { buf[i++] = c; c = fgetc(f); } if (i) { buf[i] = 0; count++; switch (count) { /* width */ case 1: w = atoi(buf); break; /* height */ case 2: h = atoi(buf); break; /* max value, only for color and greyscale */ case 3: v = atoi(buf); break; } } } } if ((v < 0) || (v > 255)) goto quit; im->w = w; im->h = h; if (!IMAGE_DIMENSIONS_OK(w, h)) goto quit; if (!im->format) { if (p == '8') SET_FLAG(im->flags, F_HAS_ALPHA); else UNSET_FLAG(im->flags, F_HAS_ALPHA); im->format = strdup(""pnm""); } rc = 1; /* Ok */ if (((!im->data) && (im->loader)) || (immediate_load) || (progress)) { DATA8 *data = NULL; /* for the binary versions */ DATA8 *ptr = NULL; int *idata = NULL; /* for the ASCII versions */ int *iptr; char buf2[256]; DATA32 *ptr2; int i, j, x, y, pl = 0; char pper = 0; /* must set the im->data member before callign progress function */ ptr2 = im->data = malloc(w * h * sizeof(DATA32)); if (!im->data) goto quit_error; /* start reading the data */ switch (p) { case '1': /* ASCII monochrome */ buf[0] = 0; i = 0; for (y = 0; y < h; y++) { x = 0; while (x < w) { if (!buf[i]) /* fill buffer */ { if (!fgets(buf, 255, f)) goto quit_error; i = 0; } while (buf[i] && isspace(buf[i])) i++; if (buf[i]) { if (buf[i] == '1') *ptr2 = 0xff000000; else if (buf[i] == '0') *ptr2 = 0xffffffff; else goto quit_error; ptr2++; i++; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '2': /* ASCII greyscale */ idata = malloc(sizeof(int) * w); if (!idata) goto quit_error; buf[0] = 0; i = 0; j = 0; for (y = 0; y < h; y++) { iptr = idata; x = 0; while (x < w) { int k; /* check 4 chars ahead to see if we need to * fill the buffer */ for (k = 0; k < 4; k++) { if (!buf[i + k]) /* fill buffer */ { if (fseek(f, -k, SEEK_CUR) == -1 || !fgets(buf, 255, f)) goto quit_error; i = 0; break; } } while (buf[i] && isspace(buf[i])) i++; while (buf[i] && !isspace(buf[i])) buf2[j++] = buf[i++]; if (j) { buf2[j] = 0; *(iptr++) = atoi(buf2); j = 0; x++; } } iptr = idata; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (iptr[0] << 16) | (iptr[0] << 8) | iptr[0]; ptr2++; iptr++; } } else { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (((iptr[0] * 255) / v) << 16) | (((iptr[0] * 255) / v) << 8) | ((iptr[0] * 255) / v); ptr2++; iptr++; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '3': /* ASCII RGB */ idata = malloc(3 * sizeof(int) * w); if (!idata) goto quit_error; buf[0] = 0; i = 0; j = 0; for (y = 0; y < h; y++) { int w3 = 3 * w; iptr = idata; x = 0; while (x < w3) { int k; /* check 4 chars ahead to see if we need to * fill the buffer */ for (k = 0; k < 4; k++) { if (!buf[i + k]) /* fill buffer */ { if (fseek(f, -k, SEEK_CUR) == -1 || !fgets(buf, 255, f)) goto quit_error; i = 0; break; } } while (buf[i] && isspace(buf[i])) i++; while (buf[i] && !isspace(buf[i])) buf2[j++] = buf[i++]; if (j) { buf2[j] = 0; *(iptr++) = atoi(buf2); j = 0; x++; } } iptr = idata; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (iptr[0] << 16) | (iptr[1] << 8) | iptr[2]; ptr2++; iptr += 3; } } else { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (((iptr[0] * 255) / v) << 16) | (((iptr[1] * 255) / v) << 8) | ((iptr[2] * 255) / v); ptr2++; iptr += 3; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '4': /* binary 1bit monochrome */ data = malloc((w + 7) / 8 * sizeof(DATA8)); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, (w + 7) / 8, 1, f)) goto quit_error; ptr = data; for (x = 0; x < w; x += 8) { j = (w - x >= 8) ? 8 : w - x; for (i = 0; i < j; i++) { if (ptr[0] & (0x80 >> i)) *ptr2 = 0xff000000; else *ptr2 = 0xffffffff; ptr2++; } ptr++; } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '5': /* binary 8bit grayscale GGGGGGGG */ data = malloc(1 * sizeof(DATA8) * w); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, w * 1, 1, f)) break; ptr = data; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (ptr[0] << 16) | (ptr[0] << 8) | ptr[0]; ptr2++; ptr++; } } else { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (((ptr[0] * 255) / v) << 16) | (((ptr[0] * 255) / v) << 8) | ((ptr[0] * 255) / v); ptr2++; ptr++; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '6': /* 24bit binary RGBRGBRGB */ data = malloc(3 * sizeof(DATA8) * w); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, w * 3, 1, f)) break; ptr = data; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (ptr[0] << 16) | (ptr[1] << 8) | ptr[2]; ptr2++; ptr += 3; } } else { for (x = 0; x < w; x++) { *ptr2 = 0xff000000 | (((ptr[0] * 255) / v) << 16) | (((ptr[1] * 255) / v) << 8) | ((ptr[2] * 255) / v); ptr2++; ptr += 3; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '7': /* XV's 8bit 332 format */ data = malloc(1 * sizeof(DATA8) * w); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, w * 1, 1, f)) break; ptr = data; for (x = 0; x < w; x++) { int r, g, b; r = (*ptr >> 5) & 0x7; g = (*ptr >> 2) & 0x7; b = (*ptr) & 0x3; *ptr2 = 0xff000000 | (((r << 21) | (r << 18) | (r << 15)) & 0xff0000) | (((g << 13) | (g << 10) | (g << 7)) & 0xff00) | ((b << 6) | (b << 4) | (b << 2) | (b << 0)); ptr2++; ptr++; } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; case '8': /* 24bit binary RGBARGBARGBA */ data = malloc(4 * sizeof(DATA8) * w); if (!data) goto quit_error; ptr2 = im->data; for (y = 0; y < h; y++) { if (!fread(data, w * 4, 1, f)) break; ptr = data; if (v == 255) { for (x = 0; x < w; x++) { *ptr2 = (ptr[3] << 24) | (ptr[0] << 16) | (ptr[1] << 8) | ptr[2]; ptr2++; ptr += 4; } } else { for (x = 0; x < w; x++) { *ptr2 = (((ptr[3] * 255) / v) << 24) | (((ptr[0] * 255) / v) << 16) | (((ptr[1] * 255) / v) << 8) | ((ptr[2] * 255) / v); ptr2++; ptr += 4; } } if (progress && do_progress(im, progress, progress_granularity, &pper, &pl, y)) goto quit_progress; } break; default: quit_error: rc = 0; break; quit_progress: rc = 2; break; } if (idata) free(idata); if (data) free(data); } quit: fclose(f); return rc; } ",1 "void RenderThread::RemoveFilter(IPC::ChannelProxy::MessageFilter* filter) { channel()->RemoveFilter(filter); } ",0 "error::Error GLES2DecoderImpl::HandleTexSubImage3D(uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::TexSubImage3D& c = *static_cast(cmd_data); TRACE_EVENT2(""gpu"", ""GLES2DecoderImpl::HandleTexSubImage3D"", ""widthXheight"", c.width * c.height, ""depth"", c.depth); GLenum target = static_cast(c.target); GLint level = static_cast(c.level); GLint xoffset = static_cast(c.xoffset); GLint yoffset = static_cast(c.yoffset); GLint zoffset = static_cast(c.zoffset); GLsizei width = static_cast(c.width); GLsizei height = static_cast(c.height); GLsizei depth = static_cast(c.depth); GLenum format = static_cast(c.format); GLenum type = static_cast(c.type); uint32 data_size; if (!GLES2Util::ComputeImageDataSizes( width, height, depth, format, type, state_.unpack_alignment, &data_size, NULL, NULL)) { return error::kOutOfBounds; } const void* pixels = GetSharedMemoryAs( c.pixels_shm_id, c.pixels_shm_offset, data_size); glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); return error::kNoError; } ",0 "void SyncBackendHost::RefreshNigori(const base::Closure& done_callback) { DCHECK_EQ(MessageLoop::current(), frontend_loop_); base::Closure sync_thread_done_callback = base::Bind(&PostClosure, MessageLoop::current(), FROM_HERE, done_callback); sync_thread_.message_loop()->PostTask( FROM_HERE, base::Bind(&SyncBackendHost::Core::DoRefreshNigori, core_.get(), sync_thread_done_callback)); } ",0 "void ChromotingInstance::NotifyClientDimensions(int width, int height) { if (!IsConnected()) { return; } protocol::ClientDimensions client_dimensions; client_dimensions.set_width(width); client_dimensions.set_height(height); host_connection_->host_stub()->NotifyClientDimensions(client_dimensions); } ",0 "static jboolean android_net_wifi_start_logging_ring_buffer(JNIEnv *env, jclass cls, jint iface, jint verbose_level,jint flags, jint max_interval,jint min_data_size, jstring ring_name) { JNIHelper helper(env); wifi_interface_handle handle = getIfaceHandle(helper, cls, iface); ALOGD(""android_net_wifi_start_logging_ring_buffer = %p"", handle); if (handle == 0) { return false; } ScopedUtfChars chars(env, ring_name); const char* ring_name_const_char = chars.c_str(); int ret = hal_fn.wifi_start_logging(handle, verbose_level, flags, max_interval, min_data_size, const_cast(ring_name_const_char)); if (ret != WIFI_SUCCESS) { ALOGE(""Fail to start logging for ring %s"", ring_name_const_char); } else { ALOGD(""start logging for ring %s"", ring_name_const_char); } return ret == WIFI_SUCCESS; } ",0 "gpk_init_hashed(sc_card_t *card, const u8 *digest, unsigned int len) { sc_apdu_t apdu; u8 tsegid[64]; int r; r = reverse(tsegid, sizeof(tsegid), digest, len); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""Failed to reverse buffer""); memset(&apdu, 0, sizeof(apdu)); apdu.cse = SC_APDU_CASE_3_SHORT; apdu.cla = 0x80; apdu.ins = 0xEA; apdu.lc = len; apdu.data= tsegid; apdu.datalen = len; r = sc_transmit_apdu(card, &apdu); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""APDU transmit failed""); r = sc_check_sw(card, apdu.sw1, apdu.sw2); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""Card returned error""); return r; } ",0 "LIBOPENMPT_MODPLUG_API int ModPlug_GetCurrentOrder(ModPlugFile* file) { if(!file) return 0; return openmpt_module_get_current_order(file->mod); } ",0 "static int get_info(struct net *net, void __user *user, const int *len, int compat) { char name[XT_TABLE_MAXNAMELEN]; struct xt_table *t; int ret; if (*len != sizeof(struct arpt_getinfo)) { duprintf(""length %u != %Zu\n"", *len, sizeof(struct arpt_getinfo)); return -EINVAL; } if (copy_from_user(name, user, sizeof(name)) != 0) return -EFAULT; name[XT_TABLE_MAXNAMELEN-1] = '\0'; #ifdef CONFIG_COMPAT if (compat) xt_compat_lock(NFPROTO_ARP); #endif t = try_then_request_module(xt_find_table_lock(net, NFPROTO_ARP, name), ""arptable_%s"", name); if (!IS_ERR_OR_NULL(t)) { struct arpt_getinfo info; const struct xt_table_info *private = t->private; #ifdef CONFIG_COMPAT struct xt_table_info tmp; if (compat) { ret = compat_table_info(private, &tmp); xt_compat_flush_offsets(NFPROTO_ARP); private = &tmp; } #endif memset(&info, 0, sizeof(info)); info.valid_hooks = t->valid_hooks; memcpy(info.hook_entry, private->hook_entry, sizeof(info.hook_entry)); memcpy(info.underflow, private->underflow, sizeof(info.underflow)); info.num_entries = private->number; info.size = private->size; strcpy(info.name, name); if (copy_to_user(user, &info, *len) != 0) ret = -EFAULT; else ret = 0; xt_table_unlock(t); module_put(t->me); } else ret = t ? PTR_ERR(t) : -ENOENT; #ifdef CONFIG_COMPAT if (compat) xt_compat_unlock(NFPROTO_ARP); #endif return ret; } ",0 "void DatabaseImpl::RenameIndex(int64_t transaction_id, int64_t object_store_id, int64_t index_id, const base::string16& new_name) { idb_runner_->PostTask( FROM_HERE, base::Bind(&IDBThreadHelper::RenameIndex, base::Unretained(helper_), transaction_id, object_store_id, index_id, new_name)); } ",0 "blink::WebInputEvent::Type GetTouchEventType(const std::string& type) { if (type == Input::DispatchTouchEvent::TypeEnum::TouchStart) return blink::WebInputEvent::kTouchStart; if (type == Input::DispatchTouchEvent::TypeEnum::TouchEnd) return blink::WebInputEvent::kTouchEnd; if (type == Input::DispatchTouchEvent::TypeEnum::TouchMove) return blink::WebInputEvent::kTouchMove; if (type == Input::DispatchTouchEvent::TypeEnum::TouchCancel) return blink::WebInputEvent::kTouchCancel; return blink::WebInputEvent::kUndefined; } ",0 "_asn1_set_value (asn1_node node, const void *value, unsigned int len) { if (node == NULL) return node; if (node->value) { if (node->value != node->small_value) free (node->value); node->value = NULL; node->value_len = 0; } if (!len) return node; if (len < sizeof (node->small_value)) { node->value = node->small_value; } else { node->value = malloc (len); if (node->value == NULL) return NULL; } node->value_len = len; memcpy (node->value, value, len); return node; } ",0 " static v8::Handle SetIconCommon( const v8::Arguments& args) { Value* bitmap_value = NULL; if (!ConvertImageDataToBitmapValue(args, &bitmap_value)) return v8::Undefined(); v8::Local extension_args = args[1]->ToObject(); v8::Local details = extension_args->Get(v8::String::New(""0""))->ToObject(); DictionaryValue* dict = new DictionaryValue(); dict->Set(""imageData"", bitmap_value); if (details->Has(v8::String::New(""tabId""))) { dict->SetInteger(""tabId"", details->Get(v8::String::New(""tabId""))->Int32Value()); } ListValue list_value; list_value.Append(dict); return StartRequestCommon(args, &list_value); } ",0 "static int raw_cmd_copyin(int cmd, void __user *param, struct floppy_raw_cmd **rcmd) { struct floppy_raw_cmd *ptr; int ret; int i; *rcmd = NULL; loop: ptr = kmalloc(sizeof(struct floppy_raw_cmd), GFP_USER); if (!ptr) return -ENOMEM; *rcmd = ptr; ret = copy_from_user(ptr, param, sizeof(*ptr)); if (ret) return -EFAULT; ptr->next = NULL; ptr->buffer_length = 0; param += sizeof(struct floppy_raw_cmd); if (ptr->cmd_count > 33) /* the command may now also take up the space * initially intended for the reply & the * reply count. Needed for long 82078 commands * such as RESTORE, which takes ... 17 command * bytes. Murphy's law #137: When you reserve * 16 bytes for a structure, you'll one day * discover that you really need 17... */ return -EINVAL; for (i = 0; i < 16; i++) ptr->reply[i] = 0; ptr->resultcode = 0; ptr->kernel_data = NULL; if (ptr->flags & (FD_RAW_READ | FD_RAW_WRITE)) { if (ptr->length <= 0) return -EINVAL; ptr->kernel_data = (char *)fd_dma_mem_alloc(ptr->length); fallback_on_nodma_alloc(&ptr->kernel_data, ptr->length); if (!ptr->kernel_data) return -ENOMEM; ptr->buffer_length = ptr->length; } if (ptr->flags & FD_RAW_WRITE) { ret = fd_copyin(ptr->data, ptr->kernel_data, ptr->length); if (ret) return ret; } if (ptr->flags & FD_RAW_MORE) { rcmd = &(ptr->next); ptr->rate &= 0x43; goto loop; } return 0; } ",1 "GF_Err trgt_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; GF_TrackGroupTypeBox *ptr = (GF_TrackGroupTypeBox *) s; if (!s) return GF_BAD_PARAM; s->type = ptr->group_type; e = gf_isom_full_box_write(s, bs); s->type = GF_ISOM_BOX_TYPE_TRGT; if (e) return e; gf_bs_write_u32(bs, ptr->track_group_id); return GF_OK; } ",0 "GLint WebGLRenderingContextBase::getAttribLocation(WebGLProgram* program, const String& name) { if (isContextLost() || !ValidateWebGLObject(""getAttribLocation"", program)) return -1; if (!ValidateLocationLength(""getAttribLocation"", name)) return -1; if (!ValidateString(""getAttribLocation"", name)) return -1; if (IsPrefixReserved(name)) return -1; if (!program->LinkStatus(this)) { SynthesizeGLError(GL_INVALID_OPERATION, ""getAttribLocation"", ""program not linked""); return 0; } return ContextGL()->GetAttribLocation(ObjectOrZero(program), name.Utf8().data()); } ",0 "int ssl3_send_next_proto(SSL *s) { unsigned int len, padding_len; unsigned char *d; if (s->state == SSL3_ST_CW_NEXT_PROTO_A) { len = s->next_proto_negotiated_len; padding_len = 32 - ((len + 2) % 32); d = (unsigned char *)s->init_buf->data; d[4] = len; memcpy(d + 5, s->next_proto_negotiated, len); d[5 + len] = padding_len; memset(d + 6 + len, 0, padding_len); *(d++)=SSL3_MT_NEXT_PROTO; l2n3(2 + len + padding_len, d); s->state = SSL3_ST_CW_NEXT_PROTO_B; s->init_num = 4 + 2 + len + padding_len; s->init_off = 0; } return ssl3_do_write(s, SSL3_RT_HANDSHAKE); } ",0 "void TabStripGtk::SetBounds(const gfx::Rect& bounds) { bounds_ = bounds; } ",0 "static inline int arp_checkentry(const struct arpt_arp *arp) { if (arp->flags & ~ARPT_F_MASK) return 0; if (arp->invflags & ~ARPT_INV_MASK) return 0; return 1; } ",0 "static int mac80211_hwsim_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) { wiphy_dbg(hw->wiphy, ""%s (type=%d mac_addr=%pM)\n"", __func__, ieee80211_vif_type_p2p(vif), vif->addr); hwsim_set_magic(vif); vif->cab_queue = 0; vif->hw_queue[IEEE80211_AC_VO] = 0; vif->hw_queue[IEEE80211_AC_VI] = 1; vif->hw_queue[IEEE80211_AC_BE] = 2; vif->hw_queue[IEEE80211_AC_BK] = 3; return 0; } ",0 "_dbus_disable_sigpipe (void) { } ",0 "fbFetchPixel_a2r2g2b2 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 a,r,g,b; a = ((pixel & 0xc0) * 0x55) << 18; r = ((pixel & 0x30) * 0x55) << 12; g = ((pixel & 0x0c) * 0x55) << 6; b = ((pixel & 0x03) * 0x55); return a|r|g|b; } ",0 "static void svc_rdma_bc_detach(struct svc_xprt *xprt) { dprintk(""svcrdma: %s(%p)\n"", __func__, xprt); } ",0 " void MessageLoop::RunTask(PendingTask* pending_task) { DCHECK(nestable_tasks_allowed_); current_pending_task_ = pending_task; #if defined(OS_WIN) DecrementHighResTaskCountIfNeeded(*pending_task); #endif nestable_tasks_allowed_ = false; TRACE_TASK_EXECUTION(""MessageLoop::RunTask"", *pending_task); for (auto& observer : task_observers_) observer.WillProcessTask(*pending_task); task_annotator_.RunTask(""MessageLoop::PostTask"", pending_task); for (auto& observer : task_observers_) observer.DidProcessTask(*pending_task); nestable_tasks_allowed_ = true; current_pending_task_ = nullptr; } ",1 "static void send_hsr_supervision_frame(struct hsr_port *master, u8 type, u8 hsrVer) { struct sk_buff *skb; int hlen, tlen; struct hsr_tag *hsr_tag; struct hsr_sup_tag *hsr_stag; struct hsr_sup_payload *hsr_sp; unsigned long irqflags; hlen = LL_RESERVED_SPACE(master->dev); tlen = master->dev->needed_tailroom; skb = dev_alloc_skb( sizeof(struct hsr_tag) + sizeof(struct hsr_sup_tag) + sizeof(struct hsr_sup_payload) + hlen + tlen); if (skb == NULL) return; skb_reserve(skb, hlen); skb->dev = master->dev; skb->protocol = htons(hsrVer ? ETH_P_HSR : ETH_P_PRP); skb->priority = TC_PRIO_CONTROL; if (dev_hard_header(skb, skb->dev, (hsrVer ? ETH_P_HSR : ETH_P_PRP), master->hsr->sup_multicast_addr, skb->dev->dev_addr, skb->len) <= 0) goto out; skb_reset_mac_header(skb); if (hsrVer > 0) { hsr_tag = skb_put(skb, sizeof(struct hsr_tag)); hsr_tag->encap_proto = htons(ETH_P_PRP); set_hsr_tag_LSDU_size(hsr_tag, HSR_V1_SUP_LSDUSIZE); } hsr_stag = skb_put(skb, sizeof(struct hsr_sup_tag)); set_hsr_stag_path(hsr_stag, (hsrVer ? 0x0 : 0xf)); set_hsr_stag_HSR_Ver(hsr_stag, hsrVer); /* From HSRv1 on we have separate supervision sequence numbers. */ spin_lock_irqsave(&master->hsr->seqnr_lock, irqflags); if (hsrVer > 0) { hsr_stag->sequence_nr = htons(master->hsr->sup_sequence_nr); hsr_tag->sequence_nr = htons(master->hsr->sequence_nr); master->hsr->sup_sequence_nr++; master->hsr->sequence_nr++; } else { hsr_stag->sequence_nr = htons(master->hsr->sequence_nr); master->hsr->sequence_nr++; } spin_unlock_irqrestore(&master->hsr->seqnr_lock, irqflags); hsr_stag->HSR_TLV_Type = type; /* TODO: Why 12 in HSRv0? */ hsr_stag->HSR_TLV_Length = hsrVer ? sizeof(struct hsr_sup_payload) : 12; /* Payload: MacAddressA */ hsr_sp = skb_put(skb, sizeof(struct hsr_sup_payload)); ether_addr_copy(hsr_sp->MacAddressA, master->dev->dev_addr); if (skb_put_padto(skb, ETH_ZLEN + HSR_HLEN)) return; hsr_forward_skb(skb, master); return; out: WARN_ONCE(1, ""HSR: Could not send supervision frame\n""); kfree_skb(skb); } ",0 "static int dn_hash_sock(struct sock *sk) { struct dn_scp *scp = DN_SK(sk); struct hlist_head *list; int rv = -EUSERS; BUG_ON(sk_hashed(sk)); write_lock_bh(&dn_hash_lock); if (!scp->addrloc && !port_alloc(sk)) goto out; rv = -EADDRINUSE; if ((list = dn_find_list(sk)) == NULL) goto out; sk_add_node(sk, list); rv = 0; out: write_unlock_bh(&dn_hash_lock); return rv; } ",0 "void GDataFileSystem::OnSearch(const SearchCallback& callback, GetDocumentsParams* params, GDataFileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(error, GURL(), scoped_ptr >()); return; } std::vector* results(new std::vector()); DCHECK_EQ(1u, params->feed_list->size()); DocumentFeed* feed = params->feed_list->at(0); GURL next_feed; feed->GetNextFeedURL(&next_feed); if (feed->entries().empty()) { scoped_ptr > result_vec(results); if (!callback.is_null()) callback.Run(error, next_feed, result_vec.Pass()); return; } for (size_t i = 0; i < feed->entries().size(); ++i) { DocumentEntry* doc = const_cast(feed->entries()[i]); scoped_ptr entry( GDataEntry::FromDocumentEntry(NULL, doc, directory_service_.get())); if (!entry.get()) continue; DCHECK_EQ(doc->resource_id(), entry->resource_id()); DCHECK(!entry->is_deleted()); std::string entry_resource_id = entry->resource_id(); if (entry->AsGDataFile()) { scoped_ptr entry_as_file(entry.release()->AsGDataFile()); directory_service_->RefreshFile(entry_as_file.Pass()); DCHECK(!entry.get()); } directory_service_->GetEntryByResourceIdAsync(entry_resource_id, base::Bind(&AddEntryToSearchResults, results, callback, base::Bind(&GDataFileSystem::CheckForUpdates, ui_weak_ptr_), error, i+1 == feed->entries().size(), next_feed)); } } ",1 "Document* Document::ParentDocument() const { if (!frame_) return nullptr; auto* parent_local_frame = DynamicTo(frame_->Tree().Parent()); if (!parent_local_frame) return nullptr; return parent_local_frame->GetDocument(); } ",0 "static struct sk_buff *inet_gso_segment(struct sk_buff *skb, netdev_features_t features) { struct sk_buff *segs = ERR_PTR(-EINVAL); const struct net_offload *ops; unsigned int offset = 0; bool udpfrag, encap; struct iphdr *iph; int proto; int nhoff; int ihl; int id; if (unlikely(skb_shinfo(skb)->gso_type & ~(SKB_GSO_TCPV4 | SKB_GSO_UDP | SKB_GSO_DODGY | SKB_GSO_TCP_ECN | SKB_GSO_GRE | SKB_GSO_GRE_CSUM | SKB_GSO_IPIP | SKB_GSO_SIT | SKB_GSO_TCPV6 | SKB_GSO_UDP_TUNNEL | SKB_GSO_UDP_TUNNEL_CSUM | SKB_GSO_TUNNEL_REMCSUM | 0))) goto out; skb_reset_network_header(skb); nhoff = skb_network_header(skb) - skb_mac_header(skb); if (unlikely(!pskb_may_pull(skb, sizeof(*iph)))) goto out; iph = ip_hdr(skb); ihl = iph->ihl * 4; if (ihl < sizeof(*iph)) goto out; id = ntohs(iph->id); proto = iph->protocol; /* Warning: after this point, iph might be no longer valid */ if (unlikely(!pskb_may_pull(skb, ihl))) goto out; __skb_pull(skb, ihl); encap = SKB_GSO_CB(skb)->encap_level > 0; if (encap) features &= skb->dev->hw_enc_features; SKB_GSO_CB(skb)->encap_level += ihl; skb_reset_transport_header(skb); segs = ERR_PTR(-EPROTONOSUPPORT); if (skb->encapsulation && skb_shinfo(skb)->gso_type & (SKB_GSO_SIT|SKB_GSO_IPIP)) udpfrag = proto == IPPROTO_UDP && encap; else udpfrag = proto == IPPROTO_UDP && !skb->encapsulation; ops = rcu_dereference(inet_offloads[proto]); if (likely(ops && ops->callbacks.gso_segment)) segs = ops->callbacks.gso_segment(skb, features); if (IS_ERR_OR_NULL(segs)) goto out; skb = segs; do { iph = (struct iphdr *)(skb_mac_header(skb) + nhoff); if (udpfrag) { iph->id = htons(id); iph->frag_off = htons(offset >> 3); if (skb->next) iph->frag_off |= htons(IP_MF); offset += skb->len - nhoff - ihl; } else { iph->id = htons(id++); } iph->tot_len = htons(skb->len - nhoff); ip_send_check(iph); if (encap) skb_reset_inner_headers(skb); skb->network_header = (u8 *)iph - skb->head; } while ((skb = skb->next)); out: return segs; } ",0 "QuotaTaskObserver::~QuotaTaskObserver() { std::for_each(running_quota_tasks_.begin(), running_quota_tasks_.end(), std::mem_fun(&QuotaTask::Abort)); } ",0 " void CreatePersistentHistogramAllocator() { allocator_memory_.reset(new char[kAllocatorMemorySize]); GlobalHistogramAllocator::ReleaseForTesting(); memset(allocator_memory_.get(), 0, kAllocatorMemorySize); GlobalHistogramAllocator::GetCreateHistogramResultHistogram(); GlobalHistogramAllocator::CreateWithPersistentMemory( allocator_memory_.get(), kAllocatorMemorySize, 0, 0, ""PersistentHistogramAllocatorTest""); allocator_ = GlobalHistogramAllocator::Get()->memory_allocator(); } ",1 "static int uio_mmap(struct file *filep, struct vm_area_struct *vma) { struct uio_listener *listener = filep->private_data; struct uio_device *idev = listener->dev; int mi; unsigned long requested_pages, actual_pages; int ret = 0; if (vma->vm_end < vma->vm_start) return -EINVAL; vma->vm_private_data = idev; mi = uio_find_mem_index(vma); if (mi < 0) return -EINVAL; requested_pages = vma_pages(vma); actual_pages = ((idev->info->mem[mi].addr & ~PAGE_MASK) + idev->info->mem[mi].size + PAGE_SIZE -1) >> PAGE_SHIFT; if (requested_pages > actual_pages) return -EINVAL; if (idev->info->mmap) { ret = idev->info->mmap(idev->info, vma); return ret; } switch (idev->info->mem[mi].memtype) { case UIO_MEM_PHYS: return uio_mmap_physical(vma); case UIO_MEM_LOGICAL: case UIO_MEM_VIRTUAL: return uio_mmap_logical(vma); default: return -EINVAL; } } ",0 "ZEND_API void zend_objects_store_del_ref(zval *zobject TSRMLS_DC) { zend_object_handle handle; handle = Z_OBJ_HANDLE_P(zobject); Z_ADDREF_P(zobject); zend_objects_store_del_ref_by_handle_ex(handle, Z_OBJ_HT_P(zobject) TSRMLS_CC); Z_DELREF_P(zobject); GC_ZOBJ_CHECK_POSSIBLE_ROOT(zobject); } ",0 "void ClipboardMessageFilter::OnReadText( ui::Clipboard::Buffer buffer, string16* result) { GetClipboard()->ReadText(buffer, result); } ",0 " Ins_DEBUG( TT_ExecContext exc ) { exc->error = FT_THROW( Debug_OpCode ); } ",0 "static int aes_get_sizes(void) { struct crypto_skcipher *tfm; tfm = crypto_alloc_skcipher(blkcipher_alg, 0, CRYPTO_ALG_ASYNC); if (IS_ERR(tfm)) { pr_err(""encrypted_key: failed to alloc_cipher (%ld)\n"", PTR_ERR(tfm)); return PTR_ERR(tfm); } ivsize = crypto_skcipher_ivsize(tfm); blksize = crypto_skcipher_blocksize(tfm); crypto_free_skcipher(tfm); return 0; } ",0 "static void btrfs_run_delalloc_work(struct btrfs_work *work) { struct btrfs_delalloc_work *delalloc_work; delalloc_work = container_of(work, struct btrfs_delalloc_work, work); if (delalloc_work->wait) btrfs_wait_ordered_range(delalloc_work->inode, 0, (u64)-1); else filemap_flush(delalloc_work->inode->i_mapping); if (delalloc_work->delay_iput) btrfs_add_delayed_iput(delalloc_work->inode); else iput(delalloc_work->inode); complete(&delalloc_work->completion); } ",0 "_warc_rdrtm(const char *buf, size_t bsz) { static const char _key[] = ""\r\nWARC-Date:""; const char *val, *eol; char *on = NULL; time_t res; if ((val = xmemmem(buf, bsz, _key, sizeof(_key) - 1U)) == NULL) { /* no bother */ return (time_t)-1; } val += sizeof(_key) - 1U; if ((eol = _warc_find_eol(val, buf + bsz - val)) == NULL ) { /* no end of line */ return -1; } /* xstrpisotime() kindly overreads whitespace for us, so use that */ res = xstrpisotime(val, &on); if (on != eol) { /* line must end here */ return -1; } return res; } ",0 "void HTMLInputElement::SetSuggestedValue(const String& value) { if (!input_type_->CanSetSuggestedValue()) return; needs_to_update_view_value_ = true; TextControlElement::SetSuggestedValue(SanitizeValue(value)); SetNeedsStyleRecalc( kSubtreeStyleChange, StyleChangeReasonForTracing::Create(StyleChangeReason::kControlValue)); input_type_view_->UpdateView(); } ",0 "static void signal_init(void) { signal(SIGTERM, exit_handler); signal(SIGINT, exit_handler); signal(SIGHUP, exit_handler); signal(SIGQUIT, exit_handler); } ",0 "AXObject* AXLayoutObject::elementAccessibilityHitTest( const IntPoint& point) const { if (isSVGImage()) return remoteSVGElementHitTest(point); return AXObject::elementAccessibilityHitTest(point); } ",0 "l2tp_avp_print(netdissect_options *ndo, const u_char *dat, int length) { u_int len; const uint16_t *ptr = (const uint16_t *)dat; uint16_t attr_type; int hidden = FALSE; if (length <= 0) { return; } ND_PRINT((ndo, "" "")); ND_TCHECK(*ptr); /* Flags & Length */ len = EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_LEN_MASK; /* If it is not long enough to contain the header, we'll give up. */ if (len < 6) goto trunc; /* If it goes past the end of the remaining length of the packet, we'll give up. */ if (len > (u_int)length) goto trunc; /* If it goes past the end of the remaining length of the captured data, we'll give up. */ ND_TCHECK2(*ptr, len); /* After this point, no need to worry about truncation */ if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_MANDATORY) { ND_PRINT((ndo, ""*"")); } if (EXTRACT_16BITS(ptr) & L2TP_AVP_HDR_FLAG_HIDDEN) { hidden = TRUE; ND_PRINT((ndo, ""?"")); } ptr++; if (EXTRACT_16BITS(ptr)) { /* Vendor Specific Attribute */ ND_PRINT((ndo, ""VENDOR%04x:"", EXTRACT_16BITS(ptr))); ptr++; ND_PRINT((ndo, ""ATTR%04x"", EXTRACT_16BITS(ptr))); ptr++; ND_PRINT((ndo, ""("")); print_octets(ndo, (const u_char *)ptr, len-6); ND_PRINT((ndo, "")"")); } else { /* IETF-defined Attributes */ ptr++; attr_type = EXTRACT_16BITS(ptr); ptr++; ND_PRINT((ndo, ""%s"", tok2str(l2tp_avp2str, ""AVP-#%u"", attr_type))); ND_PRINT((ndo, ""("")); if (hidden) { ND_PRINT((ndo, ""???"")); } else { switch (attr_type) { case L2TP_AVP_MSGTYPE: l2tp_msgtype_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_RESULT_CODE: l2tp_result_code_print(ndo, (const u_char *)ptr, len-6); break; case L2TP_AVP_PROTO_VER: l2tp_proto_ver_print(ndo, ptr); break; case L2TP_AVP_FRAMING_CAP: l2tp_framing_cap_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_BEARER_CAP: l2tp_bearer_cap_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_TIE_BREAKER: print_octets(ndo, (const u_char *)ptr, 8); break; case L2TP_AVP_FIRM_VER: case L2TP_AVP_ASSND_TUN_ID: case L2TP_AVP_RECV_WIN_SIZE: case L2TP_AVP_ASSND_SESS_ID: print_16bits_val(ndo, ptr); break; case L2TP_AVP_HOST_NAME: case L2TP_AVP_VENDOR_NAME: case L2TP_AVP_CALLING_NUMBER: case L2TP_AVP_CALLED_NUMBER: case L2TP_AVP_SUB_ADDRESS: case L2TP_AVP_PROXY_AUTH_NAME: case L2TP_AVP_PRIVATE_GRP_ID: print_string(ndo, (const u_char *)ptr, len-6); break; case L2TP_AVP_CHALLENGE: case L2TP_AVP_INI_RECV_LCP: case L2TP_AVP_LAST_SENT_LCP: case L2TP_AVP_LAST_RECV_LCP: case L2TP_AVP_PROXY_AUTH_CHAL: case L2TP_AVP_PROXY_AUTH_RESP: case L2TP_AVP_RANDOM_VECTOR: print_octets(ndo, (const u_char *)ptr, len-6); break; case L2TP_AVP_Q931_CC: l2tp_q931_cc_print(ndo, (const u_char *)ptr, len-6); break; case L2TP_AVP_CHALLENGE_RESP: print_octets(ndo, (const u_char *)ptr, 16); break; case L2TP_AVP_CALL_SER_NUM: case L2TP_AVP_MINIMUM_BPS: case L2TP_AVP_MAXIMUM_BPS: case L2TP_AVP_TX_CONN_SPEED: case L2TP_AVP_PHY_CHANNEL_ID: case L2TP_AVP_RX_CONN_SPEED: print_32bits_val(ndo, (const uint32_t *)ptr); break; case L2TP_AVP_BEARER_TYPE: l2tp_bearer_type_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_FRAMING_TYPE: l2tp_framing_type_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_PACKET_PROC_DELAY: l2tp_packet_proc_delay_print(ndo); break; case L2TP_AVP_PROXY_AUTH_TYPE: l2tp_proxy_auth_type_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_PROXY_AUTH_ID: l2tp_proxy_auth_id_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_CALL_ERRORS: l2tp_call_errors_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_ACCM: l2tp_accm_print(ndo, (const u_char *)ptr); break; case L2TP_AVP_SEQ_REQUIRED: break; /* No Attribute Value */ case L2TP_AVP_PPP_DISCON_CC: l2tp_ppp_discon_cc_print(ndo, (const u_char *)ptr, len-6); break; default: break; } } ND_PRINT((ndo, "")"")); } l2tp_avp_print(ndo, dat+len, length-len); return; trunc: ND_PRINT((ndo, ""|..."")); } ",1 "bool InputHandler::PointIsWithinContents(gfx::PointF point) const { gfx::Rect bounds = host_->GetView()->GetViewBounds(); bounds -= bounds.OffsetFromOrigin(); // Translate the bounds to (0,0). return bounds.Contains(point.x(), point.y()); } ",0 "IntRect RenderLayerScrollableArea::scrollCornerAndResizerRect() const { IntRect scrollCornerAndResizer = scrollCornerRect(); if (scrollCornerAndResizer.isEmpty()) scrollCornerAndResizer = resizerCornerRect(box().pixelSnappedBorderBoxRect(), ResizerForPointer); return scrollCornerAndResizer; } ",0 "scoped_refptr ResourceTracker::GetResource(PP_Resource res) const { DLOG_IF(ERROR, !CheckIdType(res, PP_ID_TYPE_RESOURCE)) << res << "" is not a PP_Resource.""; ResourceMap::const_iterator result = live_resources_.find(res); if (result == live_resources_.end()) { return scoped_refptr(); } return result->second.first; } ",0 "static MagickBooleanType WriteGROUP4Image(const ImageInfo *image_info, Image *image,ExceptionInfo *exception) { char filename[MagickPathExtent]; FILE *file; Image *huffman_image; ImageInfo *write_info; int unique_file; MagickBooleanType status; register ssize_t i; ssize_t count; TIFF *tiff; toff_t *byte_count, strip_size; unsigned char *buffer; /* Write image as CCITT Group4 TIFF image to a temporary 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); huffman_image=CloneImage(image,0,0,MagickTrue,exception); if (huffman_image == (Image *) NULL) { (void) CloseBlob(image); return(MagickFalse); } huffman_image->endian=MSBEndian; file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(filename); if (unique_file != -1) file=fdopen(unique_file,""wb""); if ((unique_file == -1) || (file == (FILE *) NULL)) { ThrowFileException(exception,FileOpenError,""UnableToCreateTemporaryFile"", filename); return(MagickFalse); } (void) FormatLocaleString(huffman_image->filename,MagickPathExtent,""tiff:%s"", filename); (void) SetImageType(huffman_image,BilevelType,exception); write_info=CloneImageInfo((ImageInfo *) NULL); SetImageInfoFile(write_info,file); (void) SetImageDepth(image,1,exception); (void) SetImageType(image,BilevelType,exception); write_info->compression=Group4Compression; write_info->type=BilevelType; (void) SetImageOption(write_info,""quantum:polarity"",""min-is-white""); status=WriteTIFFImage(write_info,huffman_image,exception); (void) fflush(file); write_info=DestroyImageInfo(write_info); if (status == MagickFalse) { huffman_image=DestroyImage(huffman_image); (void) fclose(file); (void) RelinquishUniqueFileResource(filename); return(MagickFalse); } tiff=TIFFOpen(filename,""rb""); if (tiff == (TIFF *) NULL) { huffman_image=DestroyImage(huffman_image); (void) fclose(file); (void) RelinquishUniqueFileResource(filename); ThrowFileException(exception,FileOpenError,""UnableToOpenFile"", image_info->filename); return(MagickFalse); } /* Allocate raw strip buffer. */ if (TIFFGetField(tiff,TIFFTAG_STRIPBYTECOUNTS,&byte_count) != 1) { TIFFClose(tiff); huffman_image=DestroyImage(huffman_image); (void) fclose(file); (void) RelinquishUniqueFileResource(filename); return(MagickFalse); } strip_size=byte_count[0]; for (i=1; i < (ssize_t) TIFFNumberOfStrips(tiff); i++) if (byte_count[i] > strip_size) strip_size=byte_count[i]; buffer=(unsigned char *) AcquireQuantumMemory((size_t) strip_size, sizeof(*buffer)); if (buffer == (unsigned char *) NULL) { TIFFClose(tiff); huffman_image=DestroyImage(huffman_image); (void) fclose(file); (void) RelinquishUniqueFileResource(filename); ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image_info->filename); } /* Compress runlength encoded to 2D Huffman pixels. */ for (i=0; i < (ssize_t) TIFFNumberOfStrips(tiff); i++) { count=(ssize_t) TIFFReadRawStrip(tiff,(uint32) i,buffer,strip_size); if (WriteBlob(image,(size_t) count,buffer) != count) status=MagickFalse; } buffer=(unsigned char *) RelinquishMagickMemory(buffer); TIFFClose(tiff); huffman_image=DestroyImage(huffman_image); (void) fclose(file); (void) RelinquishUniqueFileResource(filename); (void) CloseBlob(image); return(status); } ",0 "void _WM_do_sysex_roland_drum_track(struct _mdi *mdi, struct _event_data *data) { uint8_t ch = data->channel; MIDI_EVENT_DEBUG(__FUNCTION__,ch, data->data.value); if (data->data.value > 0) { mdi->channel[ch].isdrum = 1; mdi->channel[ch].patch = NULL; } else { mdi->channel[ch].isdrum = 0; mdi->channel[ch].patch = _WM_get_patch_data(mdi, 0); } } ",0 "int lxc_create_tty(const char *name, struct lxc_conf *conf) { struct lxc_tty_info *tty_info = &conf->tty_info; int i, ret; /* no tty in the configuration */ if (!conf->tty) return 0; tty_info->pty_info = malloc(sizeof(*tty_info->pty_info)*conf->tty); if (!tty_info->pty_info) { SYSERROR(""failed to allocate pty_info""); return -1; } for (i = 0; i < conf->tty; i++) { struct lxc_pty_info *pty_info = &tty_info->pty_info[i]; process_lock(); ret = openpty(&pty_info->master, &pty_info->slave, pty_info->name, NULL, NULL); process_unlock(); if (ret) { SYSERROR(""failed to create pty #%d"", i); tty_info->nbtty = i; lxc_delete_tty(tty_info); return -1; } DEBUG(""allocated pty '%s' (%d/%d)"", pty_info->name, pty_info->master, pty_info->slave); /* Prevent leaking the file descriptors to the container */ fcntl(pty_info->master, F_SETFD, FD_CLOEXEC); fcntl(pty_info->slave, F_SETFD, FD_CLOEXEC); pty_info->busy = 0; } tty_info->nbtty = conf->tty; INFO(""tty's configured""); return 0; } ",0 "static enum test_return test_issue_92(void) { char buffer[1024]; close(sock); sock = connect_server(""127.0.0.1"", port, false); send_ascii_command(""stats cachedump 1 0 0\r\n""); read_ascii_response(buffer, sizeof(buffer)); assert(strncmp(buffer, ""END"", strlen(""END"")) == 0); send_ascii_command(""stats cachedump 200 0 0\r\n""); read_ascii_response(buffer, sizeof(buffer)); assert(strncmp(buffer, ""CLIENT_ERROR"", strlen(""CLIENT_ERROR"")) == 0); close(sock); sock = connect_server(""127.0.0.1"", port, false); return TEST_PASS; } ",0 "static void account_freq_event(void) { if (tick_nohz_full_enabled()) account_freq_event_nohz(); else atomic_inc(&nr_freq_events); } ",0 "ChunkedUploadDataStream::Writer::~Writer() {} ",0 "int __init_or_module __platform_driver_probe(struct platform_driver *drv, int (*probe)(struct platform_device *), struct module *module) { int retval, code; if (drv->driver.probe_type == PROBE_PREFER_ASYNCHRONOUS) { pr_err(""%s: drivers registered with %s can not be probed asynchronously\n"", drv->driver.name, __func__); return -EINVAL; } /* * We have to run our probes synchronously because we check if * we find any devices to bind to and exit with error if there * are any. */ drv->driver.probe_type = PROBE_FORCE_SYNCHRONOUS; /* * Prevent driver from requesting probe deferral to avoid further * futile probe attempts. */ drv->prevent_deferred_probe = true; /* make sure driver won't have bind/unbind attributes */ drv->driver.suppress_bind_attrs = true; /* temporary section violation during probe() */ drv->probe = probe; retval = code = __platform_driver_register(drv, module); /* * Fixup that section violation, being paranoid about code scanning * the list of drivers in order to probe new devices. Check to see * if the probe was successful, and make sure any forced probes of * new devices fail. */ spin_lock(&drv->driver.bus->p->klist_drivers.k_lock); drv->probe = NULL; if (code == 0 && list_empty(&drv->driver.p->klist_devices.k_list)) retval = -ENODEV; drv->driver.probe = platform_drv_probe_fail; spin_unlock(&drv->driver.bus->p->klist_drivers.k_lock); if (code != retval) platform_driver_unregister(drv); return retval; } ",0 " void SpoolAllPagesWithBoundariesForTesting( cc::PaintCanvas* canvas, const FloatSize& page_size_in_pixels) { DispatchEventsForPrintingOnAllFrames(); if (!GetFrame()->GetDocument() || !GetFrame()->GetDocument()->GetLayoutView()) return; GetFrame()->View()->UpdateLifecyclePhasesForPrinting(); if (!GetFrame()->GetDocument() || !GetFrame()->GetDocument()->GetLayoutView()) return; ComputePageRects(page_size_in_pixels); const float page_width = page_size_in_pixels.Width(); size_t num_pages = PageRects().size(); int total_height = num_pages * (page_size_in_pixels.Height() + 1) - 1; FloatRect all_pages_rect(0, 0, page_width, total_height); PaintRecordBuilder builder(&canvas->getMetaData()); GraphicsContext& context = builder.Context(); context.SetPrinting(true); context.BeginRecording(all_pages_rect); context.FillRect(all_pages_rect, Color::kWhite); int current_height = 0; for (size_t page_index = 0; page_index < num_pages; page_index++) { if (page_index > 0) { context.Save(); context.SetStrokeThickness(1); context.SetStrokeColor(Color(0, 0, 255)); context.DrawLine(IntPoint(0, current_height - 1), IntPoint(page_width, current_height - 1)); context.Restore(); } AffineTransform transform; transform.Translate(0, current_height); #if defined(OS_WIN) || defined(OS_MACOSX) float scale = GetPageShrink(page_index); transform.Scale(scale, scale); #endif context.Save(); context.ConcatCTM(transform); SpoolPage(context, page_index); context.Restore(); current_height += page_size_in_pixels.Height() + 1; } canvas->drawPicture(context.EndRecording()); } ",0 "DoCreateContext(__GLXclientState *cl, GLXContextID gcId, GLXContextID shareList, __GLXconfig *config, __GLXscreen *pGlxScreen, GLboolean isDirect) { ClientPtr client = cl->client; __GLXcontext *glxc, *shareglxc; int err; LEGAL_NEW_RESOURCE(gcId, client); /* ** Find the display list space that we want to share. ** ** NOTE: In a multithreaded X server, we would need to keep a reference ** count for each display list so that if one client detroyed a list that ** another client was using, the list would not really be freed until it ** was no longer in use. Since this sample implementation has no support ** for multithreaded servers, we don't do this. */ if (shareList == None) { shareglxc = 0; } else { if (!validGlxContext(client, shareList, DixReadAccess, &shareglxc, &err)) return err; if (shareglxc->isDirect) { /* ** NOTE: no support for sharing display lists between direct ** contexts, even if they are in the same address space. */ #if 0 /* Disabling this code seems to allow shared display lists * and texture objects to work. We'll leave it disabled for now. */ client->errorValue = shareList; return BadMatch; #endif } else { /* ** Create an indirect context regardless of what the client asked ** for; this way we can share display list space with shareList. */ isDirect = GL_FALSE; } } /* ** Allocate memory for the new context */ if (!isDirect) glxc = pGlxScreen->createContext(pGlxScreen, config, shareglxc); else glxc = __glXdirectContextCreate(pGlxScreen, config, shareglxc); if (!glxc) { return BadAlloc; } /* ** Initially, setup the part of the context that could be used by ** a GL core that needs windowing information (e.g., Mesa). */ glxc->pGlxScreen = pGlxScreen; glxc->config = config; /* ** Register this context as a resource. */ if (!AddResource(gcId, __glXContextRes, (pointer)glxc)) { (*glxc->destroy)(glxc); client->errorValue = gcId; return BadAlloc; } /* ** Finally, now that everything is working, setup the rest of the ** context. */ glxc->id = gcId; glxc->share_id = shareList; glxc->idExists = GL_TRUE; glxc->isCurrent = GL_FALSE; glxc->isDirect = isDirect; glxc->renderMode = GL_RENDER; __glXAddToContextList(glxc); return Success; } ",0 "DXVAVideoDecodeAccelerator::DXVAPictureBuffer::DXVAPictureBuffer( const media::PictureBuffer& buffer) : available_(true), picture_buffer_(buffer), decoding_surface_(NULL) { } ",0 "static int name_from_dns(struct address buf[static MAXADDRS], char canon[static 256], const char *name, int family, const struct resolvconf *conf) { unsigned char qbuf[2][280], abuf[2][512]; const unsigned char *qp[2] = { qbuf[0], qbuf[1] }; unsigned char *ap[2] = { abuf[0], abuf[1] }; int qlens[2], alens[2]; int i, nq = 0; struct dpc_ctx ctx = { .addrs = buf, .canon = canon }; static const struct { int af; int rr; } afrr[2] = { { .af = AF_INET6, .rr = RR_A }, { .af = AF_INET, .rr = RR_AAAA }, }; for (i=0; i<2; i++) { if (family != afrr[i].af) { qlens[nq] = __res_mkquery(0, name, 1, afrr[i].rr, 0, 0, 0, qbuf[nq], sizeof *qbuf); if (qlens[nq] == -1) return EAI_NONAME; nq++; } } if (__res_msend_rc(nq, qp, qlens, ap, alens, sizeof *abuf, conf) < 0) return EAI_SYSTEM; for (i=0; iops; struct b43_dmadesc_generic *desc; struct b43_dmadesc_meta *meta; struct b43_rxhdr_fw4 *rxhdr; struct sk_buff *skb; u16 len; int err; dma_addr_t dmaaddr; desc = ops->idx2desc(ring, *slot, &meta); sync_descbuffer_for_cpu(ring, meta->dmaaddr, ring->rx_buffersize); skb = meta->skb; rxhdr = (struct b43_rxhdr_fw4 *)skb->data; len = le16_to_cpu(rxhdr->frame_len); if (len == 0) { int i = 0; do { udelay(2); barrier(); len = le16_to_cpu(rxhdr->frame_len); } while (len == 0 && i++ < 5); if (unlikely(len == 0)) { dmaaddr = meta->dmaaddr; goto drop_recycle_buffer; } } if (unlikely(b43_rx_buffer_is_poisoned(ring, skb))) { /* Something went wrong with the DMA. * The device did not touch the buffer and did not overwrite the poison. */ b43dbg(ring->dev->wl, ""DMA RX: Dropping poisoned buffer.\n""); dmaaddr = meta->dmaaddr; goto drop_recycle_buffer; } if (unlikely(len > ring->rx_buffersize)) { /* The data did not fit into one descriptor buffer * and is split over multiple buffers. * This should never happen, as we try to allocate buffers * big enough. So simply ignore this packet. */ int cnt = 0; s32 tmp = len; while (1) { desc = ops->idx2desc(ring, *slot, &meta); /* recycle the descriptor buffer. */ b43_poison_rx_buffer(ring, meta->skb); sync_descbuffer_for_device(ring, meta->dmaaddr, ring->rx_buffersize); *slot = next_slot(ring, *slot); cnt++; tmp -= ring->rx_buffersize; if (tmp <= 0) break; } b43err(ring->dev->wl, ""DMA RX buffer too small "" ""(len: %u, buffer: %u, nr-dropped: %d)\n"", len, ring->rx_buffersize, cnt); goto drop; } dmaaddr = meta->dmaaddr; err = setup_rx_descbuffer(ring, desc, meta, GFP_ATOMIC); if (unlikely(err)) { b43dbg(ring->dev->wl, ""DMA RX: setup_rx_descbuffer() failed\n""); goto drop_recycle_buffer; } unmap_descbuffer(ring, dmaaddr, ring->rx_buffersize, 0); skb_put(skb, len + ring->frameoffset); skb_pull(skb, ring->frameoffset); b43_rx(ring->dev, skb, rxhdr); drop: return; drop_recycle_buffer: /* Poison and recycle the RX buffer. */ b43_poison_rx_buffer(ring, skb); sync_descbuffer_for_device(ring, dmaaddr, ring->rx_buffersize); } ",1 "int fuse_do_open(struct fuse_conn *fc, u64 nodeid, struct file *file, bool isdir) { struct fuse_open_out outarg; struct fuse_file *ff; int err; int opcode = isdir ? FUSE_OPENDIR : FUSE_OPEN; ff = fuse_file_alloc(fc); if (!ff) return -ENOMEM; err = fuse_send_open(fc, nodeid, file, opcode, &outarg); if (err) { fuse_file_free(ff); return err; } if (isdir) outarg.open_flags &= ~FOPEN_DIRECT_IO; ff->fh = outarg.fh; ff->nodeid = nodeid; ff->open_flags = outarg.open_flags; file->private_data = fuse_file_get(ff); return 0; } ",0 "dtls1_reassemble_fragment(SSL *s, struct hm_header_st* msg_hdr, int *ok) { hm_fragment *frag = NULL; pitem *item = NULL; int i = -1, is_complete; unsigned char seq64be[8]; unsigned long frag_len = msg_hdr->frag_len, max_len; if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len) goto err; /* Determine maximum allowed message size. Depends on (user set) * maximum certificate length, but 16k is minimum. */ if (DTLS1_HM_HEADER_LENGTH + SSL3_RT_MAX_ENCRYPTED_LENGTH < s->max_cert_list) max_len = s->max_cert_list; else max_len = DTLS1_HM_HEADER_LENGTH + SSL3_RT_MAX_ENCRYPTED_LENGTH; if ((msg_hdr->frag_off+frag_len) > max_len) goto err; /* Try to find item in queue */ memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char) (msg_hdr->seq>>8); seq64be[7] = (unsigned char) msg_hdr->seq; item = pqueue_find(s->d1->buffered_messages, seq64be); if (item == NULL) { frag = dtls1_hm_fragment_new(msg_hdr->msg_len, 1); if ( frag == NULL) goto err; memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); frag->msg_header.frag_len = frag->msg_header.msg_len; frag->msg_header.frag_off = 0; } else frag = (hm_fragment*) item->data; /* If message is already reassembled, this must be a * retransmit and can be dropped. */ if (frag->reassembly == NULL) { unsigned char devnull [256]; while (frag_len) { i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, devnull, frag_len>sizeof(devnull)?sizeof(devnull):frag_len,0); if (i<=0) goto err; frag_len -= i; } return DTLS1_HM_FRAGMENT_RETRY; } /* read the body of the fragment (header has already been read */ i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, frag->fragment + msg_hdr->frag_off,frag_len,0); if (i<=0 || (unsigned long)i!=frag_len) goto err; RSMBLY_BITMASK_MARK(frag->reassembly, (long)msg_hdr->frag_off, (long)(msg_hdr->frag_off + frag_len)); RSMBLY_BITMASK_IS_COMPLETE(frag->reassembly, (long)msg_hdr->msg_len, is_complete); if (is_complete) { OPENSSL_free(frag->reassembly); frag->reassembly = NULL; } if (item == NULL) { memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char)(msg_hdr->seq>>8); seq64be[7] = (unsigned char)(msg_hdr->seq); item = pitem_new(seq64be, frag); if (item == NULL) { goto err; i = -1; } pqueue_insert(s->d1->buffered_messages, item); } return DTLS1_HM_FRAGMENT_RETRY; err: if (frag != NULL) dtls1_hm_fragment_free(frag); if (item != NULL) OPENSSL_free(item); *ok = 0; return i; } ",0 "png_process_some_data(png_structp png_ptr, png_infop info_ptr) { if (png_ptr == NULL) return; switch (png_ptr->process_mode) { case PNG_READ_SIG_MODE: { png_push_read_sig(png_ptr, info_ptr); break; } case PNG_READ_CHUNK_MODE: { png_push_read_chunk(png_ptr, info_ptr); break; } case PNG_READ_IDAT_MODE: { png_push_read_IDAT(png_ptr); break; } case PNG_SKIP_MODE: { png_push_crc_finish(png_ptr); break; } default: { png_ptr->buffer_size = 0; break; } } } ",0 "fbFetchPixel_b2g3r3 (const FbBits *bits, int offset, miIndexedPtr indexed) { CARD32 pixel = READ((CARD8 *) bits + offset); CARD32 r,g,b; b = (((pixel & 0xc0) ) | ((pixel & 0xc0) >> 2) | ((pixel & 0xc0) >> 4) | ((pixel & 0xc0) >> 6)); g = ((pixel & 0x38) | ((pixel & 0x38) >> 3) | ((pixel & 0x30) << 2)) << 8; r = (((pixel & 0x07) ) | ((pixel & 0x07) << 3) | ((pixel & 0x06) << 6)) << 16; return (0xff000000 | r | g | b); } ",0 " static void CloseTestWindow(aura::Window* window) { views::Widget::GetWidgetForNativeWindow(window)->Close(); } ",0 " void SetOnError(const base::Callback& callback) { on_error_ = callback; } ",0 "void WorkerThread::didStopRunLoop() { ASSERT(isCurrentThread()); Platform::current()->didStopWorkerRunLoop(); } ",0 "void post_init_entity_util_avg(struct sched_entity *se) { struct cfs_rq *cfs_rq = cfs_rq_of(se); struct sched_avg *sa = &se->avg; long cpu_scale = arch_scale_cpu_capacity(NULL, cpu_of(rq_of(cfs_rq))); long cap = (long)(cpu_scale - cfs_rq->avg.util_avg) / 2; if (cap > 0) { if (cfs_rq->avg.util_avg != 0) { sa->util_avg = cfs_rq->avg.util_avg * se->load.weight; sa->util_avg /= (cfs_rq->avg.load_avg + 1); if (sa->util_avg > cap) sa->util_avg = cap; } else { sa->util_avg = cap; } } if (entity_is_task(se)) { struct task_struct *p = task_of(se); if (p->sched_class != &fair_sched_class) { /* * For !fair tasks do: * update_cfs_rq_load_avg(now, cfs_rq); attach_entity_load_avg(cfs_rq, se, 0); switched_from_fair(rq, p); * * such that the next switched_to_fair() has the * expected state. */ se->avg.last_update_time = cfs_rq_clock_task(cfs_rq); return; } } attach_entity_cfs_rq(se); } ",0 "static void vmx_set_interrupt_shadow(struct kvm_vcpu *vcpu, int mask) { u32 interruptibility_old = vmcs_read32(GUEST_INTERRUPTIBILITY_INFO); u32 interruptibility = interruptibility_old; interruptibility &= ~(GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS); if (mask & KVM_X86_SHADOW_INT_MOV_SS) interruptibility |= GUEST_INTR_STATE_MOV_SS; else if (mask & KVM_X86_SHADOW_INT_STI) interruptibility |= GUEST_INTR_STATE_STI; if ((interruptibility != interruptibility_old)) vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, interruptibility); } ",0 "static int alloc_urbs(pegasus_t *pegasus) { int res = -ENOMEM; pegasus->rx_urb = usb_alloc_urb(0, GFP_KERNEL); if (!pegasus->rx_urb) { return res; } pegasus->tx_urb = usb_alloc_urb(0, GFP_KERNEL); if (!pegasus->tx_urb) { usb_free_urb(pegasus->rx_urb); return res; } pegasus->intr_urb = usb_alloc_urb(0, GFP_KERNEL); if (!pegasus->intr_urb) { usb_free_urb(pegasus->tx_urb); usb_free_urb(pegasus->rx_urb); return res; } return 0; } ",0 " static zval *xml_call_handler(xml_parser *parser, zval *handler, zend_function *function_ptr, int argc, zval **argv) { int i; TSRMLS_FETCH(); if (parser && handler && !EG(exception)) { zval ***args; zval *retval; int result; zend_fcall_info fci; args = safe_emalloc(sizeof(zval **), argc, 0); for (i = 0; i < argc; i++) { args[i] = &argv[i]; } fci.size = sizeof(fci); fci.function_table = EG(function_table); fci.function_name = handler; fci.symbol_table = NULL; fci.object_ptr = parser->object; fci.retval_ptr_ptr = &retval; fci.param_count = argc; fci.params = args; fci.no_separation = 0; /*fci.function_handler_cache = &function_ptr;*/ result = zend_call_function(&fci, NULL TSRMLS_CC); if (result == FAILURE) { zval **method; zval **obj; if (Z_TYPE_P(handler) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to call handler %s()"", Z_STRVAL_P(handler)); } else if (zend_hash_index_find(Z_ARRVAL_P(handler), 0, (void **) &obj) == SUCCESS && zend_hash_index_find(Z_ARRVAL_P(handler), 1, (void **) &method) == SUCCESS && Z_TYPE_PP(obj) == IS_OBJECT && Z_TYPE_PP(method) == IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to call handler %s::%s()"", Z_OBJCE_PP(obj)->name, Z_STRVAL_PP(method)); } else php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to call handler""); } for (i = 0; i < argc; i++) { zval_ptr_dtor(args[i]); } efree(args); if (result == FAILURE) { return NULL; } else { return EG(exception) ? NULL : retval; } } else { for (i = 0; i < argc; i++) { zval_ptr_dtor(&argv[i]); } return NULL; } } ",1 "int sctp_has_association(const union sctp_addr *laddr, const union sctp_addr *paddr) { struct sctp_association *asoc; struct sctp_transport *transport; if ((asoc = sctp_lookup_association(laddr, paddr, &transport))) { sctp_association_put(asoc); return 1; } return 0; } ",0 "void AudioRendererHost::DoHandleError(media::AudioOutputController* controller, int error_code) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); AudioEntry* entry = LookupByController(controller); if (!entry) return; DeleteEntryOnError(entry); } ",0 "GF_Err urn_Read(GF_Box *s, GF_BitStream *bs) { u32 i, to_read; char *tmpName; GF_DataEntryURNBox *ptr = (GF_DataEntryURNBox *)s; if (! ptr->size ) return GF_OK; to_read = (u32) ptr->size; tmpName = (char*)gf_malloc(sizeof(char) * to_read); if (!tmpName) return GF_OUT_OF_MEM; gf_bs_read_data(bs, tmpName, to_read); i = 0; while ( (tmpName[i] != 0) && (i < to_read) ) { i++; } if (i == to_read) { gf_free(tmpName); return GF_ISOM_INVALID_FILE; } if (i == to_read - 1) { ptr->nameURN = tmpName; ptr->location = NULL; return GF_OK; } ptr->nameURN = (char*)gf_malloc(sizeof(char) * (i+1)); if (!ptr->nameURN) { gf_free(tmpName); return GF_OUT_OF_MEM; } ptr->location = (char*)gf_malloc(sizeof(char) * (to_read - i - 1)); if (!ptr->location) { gf_free(tmpName); gf_free(ptr->nameURN); ptr->nameURN = NULL; return GF_OUT_OF_MEM; } memcpy(ptr->nameURN, tmpName, i + 1); memcpy(ptr->location, tmpName + i + 1, (to_read - i - 1)); gf_free(tmpName); return GF_OK; } ",1 "static int need_fallback(unsigned int key_len) { switch (key_len) { case 16: if (!(keylen_flag & AES_KEYLEN_128)) return 1; break; case 24: if (!(keylen_flag & AES_KEYLEN_192)) return 1; break; case 32: if (!(keylen_flag & AES_KEYLEN_256)) return 1; break; default: return -1; break; } return 0; } ",0 "bool Document::importContainerNodeChildren(ContainerNode* oldContainerNode, PassRefPtrWillBeRawPtr newContainerNode, ExceptionState& exceptionState) { for (Node& oldChild : NodeTraversal::childrenOf(*oldContainerNode)) { RefPtrWillBeRawPtr newChild = importNode(&oldChild, true, exceptionState); if (exceptionState.hadException()) return false; newContainerNode->appendChild(newChild.release(), exceptionState); if (exceptionState.hadException()) return false; } return true; } ",0 " static gboolean OnRealize(GtkWidget* widget, RenderWidgetHostViewGtk* host_view) { host_view->signals_.Connect(gtk_widget_get_toplevel(widget), ""configure-event"", G_CALLBACK(OnConfigureEvent), host_view); return FALSE; } ",0 "void Type_ColorantTable_Free(struct _cms_typehandler_struct* self, void* Ptr) { cmsFreeNamedColorList((cmsNAMEDCOLORLIST*) Ptr); return; cmsUNUSED_PARAMETER(self); } ",0 "static struct regulator *create_regulator(struct regulator_dev *rdev, struct device *dev, const char *supply_name) { struct regulator *regulator; char buf[REG_STR_SIZE]; int err, size; regulator = kzalloc(sizeof(*regulator), GFP_KERNEL); if (regulator == NULL) return NULL; mutex_lock(&rdev->mutex); regulator->rdev = rdev; list_add(®ulator->list, &rdev->consumer_list); if (dev) { regulator->dev = dev; /* Add a link to the device sysfs entry */ size = scnprintf(buf, REG_STR_SIZE, ""%s-%s"", dev->kobj.name, supply_name); if (size >= REG_STR_SIZE) goto overflow_err; regulator->supply_name = kstrdup(buf, GFP_KERNEL); if (regulator->supply_name == NULL) goto overflow_err; err = sysfs_create_link(&rdev->dev.kobj, &dev->kobj, buf); if (err) { rdev_warn(rdev, ""could not add device link %s err %d\n"", dev->kobj.name, err); /* non-fatal */ } } else { regulator->supply_name = kstrdup(supply_name, GFP_KERNEL); if (regulator->supply_name == NULL) goto overflow_err; } regulator->debugfs = debugfs_create_dir(regulator->supply_name, rdev->debugfs); if (!regulator->debugfs) { rdev_warn(rdev, ""Failed to create debugfs directory\n""); } else { debugfs_create_u32(""uA_load"", 0444, regulator->debugfs, ®ulator->uA_load); debugfs_create_u32(""min_uV"", 0444, regulator->debugfs, ®ulator->min_uV); debugfs_create_u32(""max_uV"", 0444, regulator->debugfs, ®ulator->max_uV); } /* * Check now if the regulator is an always on regulator - if * it is then we don't need to do nearly so much work for * enable/disable calls. */ if (!_regulator_can_change_status(rdev) && _regulator_is_enabled(rdev)) regulator->always_on = true; mutex_unlock(&rdev->mutex); return regulator; overflow_err: list_del(®ulator->list); kfree(regulator); mutex_unlock(&rdev->mutex); return NULL; } ",0 "void ip_vs_control_cleanup(void) { EnterFunction(2); ip_vs_trash_cleanup(); cancel_rearming_delayed_work(&defense_work); cancel_work_sync(&defense_work.work); ip_vs_kill_estimator(&ip_vs_stats); unregister_sysctl_table(sysctl_header); proc_net_remove(&init_net, ""ip_vs_stats""); proc_net_remove(&init_net, ""ip_vs""); ip_vs_genl_unregister(); nf_unregister_sockopt(&ip_vs_sockopts); LeaveFunction(2); } ",0 "ZEND_API void ZEND_FASTCALL _zend_hash_init_ex(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent, zend_bool bApplyProtection ZEND_FILE_LINE_DC) { _zend_hash_init(ht, nSize, pDestructor, persistent ZEND_FILE_LINE_RELAY_CC); if (!bApplyProtection) { ht->u.flags &= ~HASH_FLAG_APPLY_PROTECTION; } } ",0 "user_set_language (AccountsUser *auser, GDBusMethodInvocation *context, const gchar *language) { User *user = (User*)auser; int uid; const gchar *action_id; if (!get_caller_uid (context, &uid)) { throw_error (context, ERROR_FAILED, ""identifying caller failed""); return FALSE; } if (accounts_user_get_uid (ACCOUNTS_USER (user)) == (uid_t) uid) action_id = ""org.freedesktop.accounts.change-own-user-data""; else action_id = ""org.freedesktop.accounts.user-administration""; daemon_local_check_auth (user->daemon, user, action_id, TRUE, user_change_language_authorized_cb, context, g_strdup (language), (GDestroyNotify)g_free); return TRUE; } ",0 " virtual void SetUp() { AllocationTestHarness::SetUp(); pipe(pipefd); done = semaphore_new(0); } ",0 "static bool hal_open() { LOG_INFO(""%s"", __func__); int number_of_ports = vendor->send_command(VENDOR_OPEN_USERIAL, &uart_fds); if (number_of_ports != 2 && number_of_ports != 4) { LOG_ERROR(""%s opened the wrong number of ports: got %d, expected 2 or 4."", __func__, number_of_ports); goto error; } LOG_INFO(""%s got uart fds: CMD=%d, EVT=%d, ACL_OUT=%d, ACL_IN=%d"", __func__, uart_fds[CH_CMD], uart_fds[CH_EVT], uart_fds[CH_ACL_OUT], uart_fds[CH_ACL_IN]); if (uart_fds[CH_CMD] == INVALID_FD) { LOG_ERROR(""%s unable to open the command uart serial port."", __func__); goto error; } if (uart_fds[CH_EVT] == INVALID_FD) { LOG_ERROR(""%s unable to open the event uart serial port."", __func__); goto error; } if (uart_fds[CH_ACL_OUT] == INVALID_FD) { LOG_ERROR(""%s unable to open the acl-out uart serial port."", __func__); goto error; } if (uart_fds[CH_ACL_IN] == INVALID_FD) { LOG_ERROR(""%s unable to open the acl-in uart serial port."", __func__); goto error; } event_stream = eager_reader_new(uart_fds[CH_EVT], &allocator_malloc, HCI_HAL_SERIAL_BUFFER_SIZE, SIZE_MAX, ""hci_mct""); if (!event_stream) { LOG_ERROR(""%s unable to create eager reader for the event uart serial port."", __func__); goto error; } acl_stream = eager_reader_new(uart_fds[CH_ACL_IN], &allocator_malloc, HCI_HAL_SERIAL_BUFFER_SIZE, SIZE_MAX, ""hci_mct""); if (!event_stream) { LOG_ERROR(""%s unable to create eager reader for the acl-in uart serial port."", __func__); goto error; } eager_reader_register(event_stream, thread_get_reactor(thread), event_event_stream_has_bytes, NULL); eager_reader_register(acl_stream, thread_get_reactor(thread), event_acl_stream_has_bytes, NULL); return true; error:; interface.close(); return false; } ",0 "static enum TIFFReadDirEntryErr TIFFReadDirEntryArray(TIFF* tif, TIFFDirEntry* direntry, uint32* count, uint32 desttypesize, void** value) { int typesize; uint32 datasize; void* data; typesize=TIFFDataWidth(direntry->tdir_type); if ((direntry->tdir_count==0)||(typesize==0)) { *value=0; return(TIFFReadDirEntryErrOk); } (void) desttypesize; /* * As a sanity check, make sure we have no more than a 2GB tag array * in either the current data type or the dest data type. This also * avoids problems with overflow of tmsize_t on 32bit systems. */ if ((uint64)(2147483647/typesize)tdir_count) return(TIFFReadDirEntryErrSizesan); if ((uint64)(2147483647/desttypesize)tdir_count) return(TIFFReadDirEntryErrSizesan); *count=(uint32)direntry->tdir_count; datasize=(*count)*typesize; assert((tmsize_t)datasize>0); data=_TIFFCheckMalloc(tif, *count, typesize, ""ReadDirEntryArray""); if (data==0) return(TIFFReadDirEntryErrAlloc); if (!(tif->tif_flags&TIFF_BIGTIFF)) { if (datasize<=4) _TIFFmemcpy(data,&direntry->tdir_offset,datasize); else { enum TIFFReadDirEntryErr err; uint32 offset = direntry->tdir_offset.toff_long; if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong(&offset); err=TIFFReadDirEntryData(tif,(uint64)offset,(tmsize_t)datasize,data); if (err!=TIFFReadDirEntryErrOk) { _TIFFfree(data); return(err); } } } else { if (datasize<=8) _TIFFmemcpy(data,&direntry->tdir_offset,datasize); else { enum TIFFReadDirEntryErr err; uint64 offset = direntry->tdir_offset.toff_long8; if (tif->tif_flags&TIFF_SWAB) TIFFSwabLong8(&offset); err=TIFFReadDirEntryData(tif,offset,(tmsize_t)datasize,data); if (err!=TIFFReadDirEntryErrOk) { _TIFFfree(data); return(err); } } } *value=data; return(TIFFReadDirEntryErrOk); } ",0 "static void activityLoggedInIsolatedWorldsAttrSetterAttributeSetterCallbackForMainWorld(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectV8Internal::activityLoggedInIsolatedWorldsAttrSetterAttributeSetterForMainWorld(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " void Get(const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(static_cast(counter_)); } ",0 "bool Document::importContainerNodeChildren(ContainerNode* oldContainerNode, ContainerNode* newContainerNode, ExceptionState& exceptionState) { for (Node& oldChild : NodeTraversal::childrenOf(*oldContainerNode)) { Node* newChild = importNode(&oldChild, true, exceptionState); if (exceptionState.hadException()) return false; newContainerNode->appendChild(newChild, exceptionState); if (exceptionState.hadException()) return false; } return true; } ",0 "static int ext4_split_unwritten_extents(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, struct ext4_ext_path *path, int flags) { ext4_lblk_t eof_block; ext4_lblk_t ee_block; struct ext4_extent *ex; unsigned int ee_len; int split_flag = 0, depth; ext_debug(""ext4_split_unwritten_extents: inode %lu, logical"" ""block %llu, max_blocks %u\n"", inode->i_ino, (unsigned long long)map->m_lblk, map->m_len); eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; if (eof_block < map->m_lblk + map->m_len) eof_block = map->m_lblk + map->m_len; /* * It is safe to convert extent to initialized via explicit * zeroout only if extent is fully insde i_size or new_size. */ depth = ext_depth(inode); ex = path[depth].p_ext; ee_block = le32_to_cpu(ex->ee_block); ee_len = ext4_ext_get_actual_len(ex); split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0; split_flag |= EXT4_EXT_MARK_UNINIT2; flags |= EXT4_GET_BLOCKS_PRE_IO; return ext4_split_extent(handle, inode, path, map, split_flag, flags); } ",1 "free_regex_ext(RegexExt* ext) { if (IS_NOT_NULL(ext)) { if (IS_NOT_NULL(ext->pattern)) xfree((void* )ext->pattern); #ifdef USE_CALLOUT if (IS_NOT_NULL(ext->tag_table)) onig_callout_tag_table_free(ext->tag_table); if (IS_NOT_NULL(ext->callout_list)) onig_free_reg_callout_list(ext->callout_num, ext->callout_list); #endif xfree(ext); } } ",0 "static void spl_array_write_dimension_ex(int check_inherited, zval *object, zval *offset, zval *value TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); long index; HashTable *ht; if (check_inherited && intern->fptr_offset_set) { if (!offset) { ALLOC_INIT_ZVAL(offset); } else { SEPARATE_ARG_IF_REF(offset); } zend_call_method_with_2_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_set, ""offsetSet"", NULL, offset, value); zval_ptr_dtor(&offset); return; } if (!offset) { ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->nApplyCount > 0) { zend_error(E_WARNING, ""Modification of ArrayObject during sorting is prohibited""); return; } Z_ADDREF_P(value); zend_hash_next_index_insert(ht, (void**)&value, sizeof(void*), NULL); return; } switch(Z_TYPE_P(offset)) { case IS_STRING: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->nApplyCount > 0) { zend_error(E_WARNING, ""Modification of ArrayObject during sorting is prohibited""); return; } Z_ADDREF_P(value); zend_symtable_update(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void**)&value, sizeof(void*), NULL); return; case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->nApplyCount > 0) { zend_error(E_WARNING, ""Modification of ArrayObject during sorting is prohibited""); return; } if (offset->type == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); } else { index = Z_LVAL_P(offset); } Z_ADDREF_P(value); zend_hash_index_update(ht, index, (void**)&value, sizeof(void*), NULL); return; case IS_NULL: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->nApplyCount > 0) { zend_error(E_WARNING, ""Modification of ArrayObject during sorting is prohibited""); return; } Z_ADDREF_P(value); zend_hash_next_index_insert(ht, (void**)&value, sizeof(void*), NULL); return; default: zend_error(E_WARNING, ""Illegal offset type""); return; } } /* }}} */ ",0 "int hfsplus_find_cat(struct super_block *sb, u32 cnid, struct hfs_find_data *fd) { hfsplus_cat_entry tmp; int err; u16 type; hfsplus_cat_build_key(sb, fd->search_key, cnid, NULL); err = hfs_brec_read(fd, &tmp, sizeof(hfsplus_cat_entry)); if (err) return err; type = be16_to_cpu(tmp.type); if (type != HFSPLUS_FOLDER_THREAD && type != HFSPLUS_FILE_THREAD) { printk(KERN_ERR ""hfs: found bad thread record in catalog\n""); return -EIO; } if (be16_to_cpu(tmp.thread.nodeName.length) > 255) { printk(KERN_ERR ""hfs: catalog name length corrupted\n""); return -EIO; } hfsplus_cat_build_key_uni(fd->search_key, be32_to_cpu(tmp.thread.parentID), &tmp.thread.nodeName); return hfs_brec_find(fd); } ",0 "void SyncManager::SyncInternal::OnIPAddressChanged() { DVLOG(1) << ""IP address change detected""; if (!observing_ip_address_changes_) { DVLOG(1) << ""IP address change dropped.""; return; } #if defined (OS_CHROMEOS) MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&SyncInternal::OnIPAddressChangedImpl, weak_ptr_factory_.GetWeakPtr()), kChromeOSNetworkChangeReactionDelayHackMsec); #else OnIPAddressChangedImpl(); #endif // defined(OS_CHROMEOS) } ",1 "SECURITY_STATUS ntlm_read_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buffer) { wStream* s; int length; PBYTE StartOffset; PBYTE PayloadOffset; NTLM_AV_PAIR* AvTimestamp; NTLM_CHALLENGE_MESSAGE* message; ntlm_generate_client_challenge(context); message = &context->CHALLENGE_MESSAGE; ZeroMemory(message, sizeof(NTLM_CHALLENGE_MESSAGE)); s = Stream_New((BYTE*) buffer->pvBuffer, buffer->cbBuffer); if (!s) return SEC_E_INTERNAL_ERROR; StartOffset = Stream_Pointer(s); if (ntlm_read_message_header(s, (NTLM_MESSAGE_HEADER*) message) < 0) { Stream_Free(s, FALSE); return SEC_E_INVALID_TOKEN; } if (message->MessageType != MESSAGE_TYPE_CHALLENGE) { Stream_Free(s, FALSE); return SEC_E_INVALID_TOKEN; } if (ntlm_read_message_fields(s, &(message->TargetName)) < 0) /* TargetNameFields (8 bytes) */ { Stream_Free(s, FALSE); return SEC_E_INVALID_TOKEN; } if (Stream_GetRemainingLength(s) < 4) { Stream_Free(s, FALSE); return SEC_E_INVALID_TOKEN; } Stream_Read_UINT32(s, message->NegotiateFlags); /* NegotiateFlags (4 bytes) */ context->NegotiateFlags = message->NegotiateFlags; if (Stream_GetRemainingLength(s) < 8) { Stream_Free(s, FALSE); return SEC_E_INVALID_TOKEN; } Stream_Read(s, message->ServerChallenge, 8); /* ServerChallenge (8 bytes) */ CopyMemory(context->ServerChallenge, message->ServerChallenge, 8); if (Stream_GetRemainingLength(s) < 8) { Stream_Free(s, FALSE); return SEC_E_INVALID_TOKEN; } Stream_Read(s, message->Reserved, 8); /* Reserved (8 bytes), should be ignored */ if (ntlm_read_message_fields(s, &(message->TargetInfo)) < 0) /* TargetInfoFields (8 bytes) */ { Stream_Free(s, FALSE); return SEC_E_INVALID_TOKEN; } if (context->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION) { if (ntlm_read_version_info(s, &(message->Version)) < 0) /* Version (8 bytes) */ { Stream_Free(s, FALSE); return SEC_E_INVALID_TOKEN; } } /* Payload (variable) */ PayloadOffset = Stream_Pointer(s); if (message->TargetName.Len > 0) { if (ntlm_read_message_fields_buffer(s, &(message->TargetName)) < 0) { Stream_Free(s, FALSE); return SEC_E_INTERNAL_ERROR; } } if (message->TargetInfo.Len > 0) { if (ntlm_read_message_fields_buffer(s, &(message->TargetInfo)) < 0) { Stream_Free(s, FALSE); return SEC_E_INTERNAL_ERROR; } context->ChallengeTargetInfo.pvBuffer = message->TargetInfo.Buffer; context->ChallengeTargetInfo.cbBuffer = message->TargetInfo.Len; AvTimestamp = ntlm_av_pair_get((NTLM_AV_PAIR*) message->TargetInfo.Buffer, MsvAvTimestamp); if (AvTimestamp) { if (context->NTLMv2) context->UseMIC = TRUE; CopyMemory(context->ChallengeTimestamp, ntlm_av_pair_get_value_pointer(AvTimestamp), 8); } } length = (PayloadOffset - StartOffset) + message->TargetName.Len + message->TargetInfo.Len; if (!sspi_SecBufferAlloc(&context->ChallengeMessage, length)) { Stream_Free(s, FALSE); return SEC_E_INTERNAL_ERROR; } CopyMemory(context->ChallengeMessage.pvBuffer, StartOffset, length); #ifdef WITH_DEBUG_NTLM WLog_DBG(TAG, ""CHALLENGE_MESSAGE (length = %d)"", length); winpr_HexDump(TAG, WLOG_DEBUG, context->ChallengeMessage.pvBuffer, context->ChallengeMessage.cbBuffer); ntlm_print_negotiate_flags(context->NegotiateFlags); if (context->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION) ntlm_print_version_info(&(message->Version)); ntlm_print_message_fields(&(message->TargetName), ""TargetName""); ntlm_print_message_fields(&(message->TargetInfo), ""TargetInfo""); if (context->ChallengeTargetInfo.cbBuffer > 0) { WLog_DBG(TAG, ""ChallengeTargetInfo (%""PRIu32""):"", context->ChallengeTargetInfo.cbBuffer); ntlm_print_av_pair_list(context->ChallengeTargetInfo.pvBuffer); } #endif /* AV_PAIRs */ if (context->NTLMv2) { if (ntlm_construct_authenticate_target_info(context) < 0) { Stream_Free(s, FALSE); return SEC_E_INTERNAL_ERROR; } sspi_SecBufferFree(&context->ChallengeTargetInfo); context->ChallengeTargetInfo.pvBuffer = context->AuthenticateTargetInfo.pvBuffer; context->ChallengeTargetInfo.cbBuffer = context->AuthenticateTargetInfo.cbBuffer; } ntlm_generate_timestamp(context); /* Timestamp */ if (ntlm_compute_lm_v2_response(context) < 0) /* LmChallengeResponse */ { Stream_Free(s, FALSE); return SEC_E_INTERNAL_ERROR; } if (ntlm_compute_ntlm_v2_response(context) < 0) /* NtChallengeResponse */ { Stream_Free(s, FALSE); return SEC_E_INTERNAL_ERROR; } ntlm_generate_key_exchange_key(context); /* KeyExchangeKey */ ntlm_generate_random_session_key(context); /* RandomSessionKey */ ntlm_generate_exported_session_key(context); /* ExportedSessionKey */ ntlm_encrypt_random_session_key(context); /* EncryptedRandomSessionKey */ /* Generate signing keys */ ntlm_generate_client_signing_key(context); ntlm_generate_server_signing_key(context); /* Generate sealing keys */ ntlm_generate_client_sealing_key(context); ntlm_generate_server_sealing_key(context); /* Initialize RC4 seal state using client sealing key */ ntlm_init_rc4_seal_states(context); #ifdef WITH_DEBUG_NTLM WLog_DBG(TAG, ""ClientChallenge""); winpr_HexDump(TAG, WLOG_DEBUG, context->ClientChallenge, 8); WLog_DBG(TAG, ""ServerChallenge""); winpr_HexDump(TAG, WLOG_DEBUG, context->ServerChallenge, 8); WLog_DBG(TAG, ""SessionBaseKey""); winpr_HexDump(TAG, WLOG_DEBUG, context->SessionBaseKey, 16); WLog_DBG(TAG, ""KeyExchangeKey""); winpr_HexDump(TAG, WLOG_DEBUG, context->KeyExchangeKey, 16); WLog_DBG(TAG, ""ExportedSessionKey""); winpr_HexDump(TAG, WLOG_DEBUG, context->ExportedSessionKey, 16); WLog_DBG(TAG, ""RandomSessionKey""); winpr_HexDump(TAG, WLOG_DEBUG, context->RandomSessionKey, 16); WLog_DBG(TAG, ""ClientSigningKey""); winpr_HexDump(TAG, WLOG_DEBUG, context->ClientSigningKey, 16); WLog_DBG(TAG, ""ClientSealingKey""); winpr_HexDump(TAG, WLOG_DEBUG, context->ClientSealingKey, 16); WLog_DBG(TAG, ""ServerSigningKey""); winpr_HexDump(TAG, WLOG_DEBUG, context->ServerSigningKey, 16); WLog_DBG(TAG, ""ServerSealingKey""); winpr_HexDump(TAG, WLOG_DEBUG, context->ServerSealingKey, 16); WLog_DBG(TAG, ""Timestamp""); winpr_HexDump(TAG, WLOG_DEBUG, context->Timestamp, 8); #endif context->state = NTLM_STATE_AUTHENTICATE; ntlm_free_message_fields_buffer(&(message->TargetName)); Stream_Free(s, FALSE); return SEC_I_CONTINUE_NEEDED; } ",0 "mrb_io_closed(mrb_state *mrb, mrb_value io) { struct mrb_io *fptr; fptr = (struct mrb_io *)mrb_get_datatype(mrb, io, &mrb_io_type); if (fptr->fd >= 0) { return mrb_false_value(); } return mrb_true_value(); } ",0 "auth_check( httpd_conn* hc, char* dirname ) { if ( hc->hs->global_passwd ) { char* topdir; if ( hc->hs->vhost && hc->hostdir[0] != '\0' ) topdir = hc->hostdir; else topdir = "".""; switch ( auth_check2( hc, topdir ) ) { case -1: return -1; case 1: return 1; } } return auth_check2( hc, dirname ); } ",0 "static void log_request_response_communication(const char *request, const char *response, struct analyze_event_data *evd) { char *message = xasprintf(response ? ""%s '%s'"" : ""%s"", request, response); update_command_run_log(message, evd); free(message); } ",0 "void BrowserLauncherItemController::ActiveTabChanged( TabContents* old_contents, TabContents* new_contents, int index, bool user_gesture) { if (old_contents) UpdateAppState(old_contents->web_contents()); UpdateAppState(new_contents->web_contents()); UpdateLauncher(new_contents); } ",0 "void RenderBox::addOverflowFromChild(RenderBox* child, const LayoutSize& delta) { if (child->isRenderFlowThread()) return; LayoutRect childLayoutOverflowRect = child->layoutOverflowRectForPropagation(style()); childLayoutOverflowRect.move(delta); addLayoutOverflow(childLayoutOverflowRect); if (child->hasSelfPaintingLayer()) return; LayoutRect childVisualOverflowRect = child->visualOverflowRectForPropagation(style()); childVisualOverflowRect.move(delta); addContentsVisualOverflow(childVisualOverflowRect); } ",0 " void writeTransferredMessagePort(uint32_t index) { append(MessagePortTag); doWriteUint32(index); } ",0 "bool Document::allowInlineEventHandlers(Node* node, EventListener* listener, const String& contextURL, const WTF::OrdinalNumber& contextLine) { if (!contentSecurityPolicy()->allowInlineEventHandlers(contextURL, contextLine)) return false; LocalFrame* frame = executingFrame(); if (!frame) return false; if (!frame->script().canExecuteScripts(NotAboutToExecuteScript)) return false; if (node && node->document() != this && !node->document().allowInlineEventHandlers(node, listener, contextURL, contextLine)) return false; return true; } ",0 "sf_read_raw (SNDFILE *sndfile, void *ptr, sf_count_t bytes) { SF_PRIVATE *psf ; sf_count_t count, extra ; int bytewidth, blockwidth ; VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; bytewidth = (psf->bytewidth > 0) ? psf->bytewidth : 1 ; blockwidth = (psf->blockwidth > 0) ? psf->blockwidth : 1 ; if (psf->file.mode == SFM_WRITE) { psf->error = SFE_NOT_READMODE ; return 0 ; } ; if (bytes < 0 || psf->read_current >= psf->sf.frames) { psf_memset (ptr, 0, bytes) ; return 0 ; } ; if (bytes % (psf->sf.channels * bytewidth)) { psf->error = SFE_BAD_READ_ALIGN ; return 0 ; } ; if (psf->last_op != SFM_READ) if (psf->seek (psf, SFM_READ, psf->read_current) < 0) return 0 ; count = psf_fread (ptr, 1, bytes, psf) ; if (psf->read_current + count / blockwidth <= psf->sf.frames) psf->read_current += count / blockwidth ; else { count = (psf->sf.frames - psf->read_current) * blockwidth ; extra = bytes - count ; psf_memset (((char *) ptr) + count, 0, extra) ; psf->read_current = psf->sf.frames ; } ; psf->last_op = SFM_READ ; return count ; } /* sf_read_raw */ ",0 "void BlinkTestRunner::CloseDevTools() { Send(new ShellViewHostMsg_CloseDevTools(routing_id())); WebDevToolsAgent* agent = render_view()->GetMainRenderFrame()->GetWebFrame()->devToolsAgent(); if (agent) agent->detach(); } ",0 "static unsigned lodepng_deflatev(ucvector* out, const unsigned char* in, size_t insize, const LodePNGCompressSettings* settings) { unsigned error = 0; size_t i, blocksize, numdeflateblocks; size_t bp = 0; /*the bit pointer*/ Hash hash; if(settings->btype > 2) return 61; else if(settings->btype == 0) return deflateNoCompression(out, in, insize); else if(settings->btype == 1) blocksize = insize; else /*if(settings->btype == 2)*/ { blocksize = insize / 8 + 8; if(blocksize < 65535) blocksize = 65535; } numdeflateblocks = (insize + blocksize - 1) / blocksize; if(numdeflateblocks == 0) numdeflateblocks = 1; error = hash_init(&hash, settings->windowsize); if(error) goto fail; for(i = 0; i < numdeflateblocks && !error; i++) { unsigned final = (i == numdeflateblocks - 1); size_t start = i * blocksize; size_t end = start + blocksize; if(end > insize) end = insize; if(settings->btype == 1) error = deflateFixed(out, &bp, &hash, in, start, end, settings, final); else if(settings->btype == 2) error = deflateDynamic(out, &bp, &hash, in, start, end, settings, final); } fail: hash_cleanup(&hash); return error; } ",0 "static void coroutine_fn v9fs_setattr(void *opaque) { int err = 0; int32_t fid; V9fsFidState *fidp; size_t offset = 7; V9fsIattr v9iattr; V9fsPDU *pdu = opaque; err = pdu_unmarshal(pdu, offset, ""dI"", &fid, &v9iattr); if (err < 0) { goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (v9iattr.valid & P9_ATTR_MODE) { err = v9fs_co_chmod(pdu, &fidp->path, v9iattr.mode); if (err < 0) { goto out; } } if (v9iattr.valid & (P9_ATTR_ATIME | P9_ATTR_MTIME)) { struct timespec times[2]; if (v9iattr.valid & P9_ATTR_ATIME) { if (v9iattr.valid & P9_ATTR_ATIME_SET) { times[0].tv_sec = v9iattr.atime_sec; times[0].tv_nsec = v9iattr.atime_nsec; } else { times[0].tv_nsec = UTIME_NOW; } } else { times[0].tv_nsec = UTIME_OMIT; } if (v9iattr.valid & P9_ATTR_MTIME) { if (v9iattr.valid & P9_ATTR_MTIME_SET) { times[1].tv_sec = v9iattr.mtime_sec; times[1].tv_nsec = v9iattr.mtime_nsec; } else { times[1].tv_nsec = UTIME_NOW; } } else { times[1].tv_nsec = UTIME_OMIT; } err = v9fs_co_utimensat(pdu, &fidp->path, times); if (err < 0) { goto out; } } /* * If the only valid entry in iattr is ctime we can call * chown(-1,-1) to update the ctime of the file */ if ((v9iattr.valid & (P9_ATTR_UID | P9_ATTR_GID)) || ((v9iattr.valid & P9_ATTR_CTIME) && !((v9iattr.valid & P9_ATTR_MASK) & ~P9_ATTR_CTIME))) { if (!(v9iattr.valid & P9_ATTR_UID)) { v9iattr.uid = -1; } if (!(v9iattr.valid & P9_ATTR_GID)) { v9iattr.gid = -1; } err = v9fs_co_chown(pdu, &fidp->path, v9iattr.uid, v9iattr.gid); if (err < 0) { goto out; } } if (v9iattr.valid & (P9_ATTR_SIZE)) { err = v9fs_co_truncate(pdu, &fidp->path, v9iattr.size); if (err < 0) { goto out; } } err = offset; out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); } ",0 "static RtreeDValue cellOverlap( Rtree *pRtree, RtreeCell *p, RtreeCell *aCell, int nCell ){ int ii; RtreeDValue overlap = RTREE_ZERO; for(ii=0; iinDim2; jj+=2){ RtreeDValue x1, x2; x1 = MAX(DCOORD(p->aCoord[jj]), DCOORD(aCell[ii].aCoord[jj])); x2 = MIN(DCOORD(p->aCoord[jj+1]), DCOORD(aCell[ii].aCoord[jj+1])); if( x2GetCachedStatement(SQL_FROM_HERE, kSql)); statement.BindString(0, manifest_url.spec()); if (!statement.Step()) return false; ReadGroupRecord(statement, record); DCHECK(record->manifest_url == manifest_url); return true; } ",0 "map_activate(map_op_t op, bool use_default) { if (use_default) script_run(s_def_map_scripts[op], false); script_run(s_map->scripts[op], false); } ",0 "job_cancel (Device *device) { g_return_if_fail (device->priv->job != NULL); device->priv->job->was_cancelled = TRUE; /* TODO: maybe wait and user a bigger hammer? (SIGKILL) */ kill (device->priv->job->pid, SIGTERM); } ",0 "PHPAPI PHP_FUNCTION(fgetc) { zval *arg1; char buf[2]; int result; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &arg1) == FAILURE) { RETURN_FALSE; } PHP_STREAM_TO_ZVAL(stream, &arg1); result = php_stream_getc(stream); if (result == EOF) { RETVAL_FALSE; } else { buf[0] = result; buf[1] = '\0'; RETURN_STRINGL(buf, 1, 1); } } ",0 " static void TerminateWorker(scoped_refptr worker_data) { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&TerminateWorkerOnIOThread, worker_data)); content::RunMessageLoop(); } ",0 "static bool EnabledRangeInEditableText(LocalFrame& frame, Event*, EditorCommandSource source) { frame.GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (source == kCommandFromMenuOrKeyBinding && !frame.Selection().SelectionHasFocus()) return false; return frame.Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .IsRange() && frame.Selection() .ComputeVisibleSelectionInDOMTreeDeprecated() .IsContentEditable(); } ",0 " int64_t max_buffer_backward() { return loader()->max_buffer_backward_; } ",0 "void ExtensionPrefs::SetAppLaunchIndex(const std::string& extension_id, int index) { DCHECK_GE(index, 0); UpdateExtensionPref(extension_id, kPrefAppLaunchIndex, Value::CreateIntegerValue(index)); } ",0 "static struct sock *__rfcomm_get_sock_by_addr(u8 channel, bdaddr_t *src) { struct sock *sk = NULL; sk_for_each(sk, &rfcomm_sk_list.head) { if (rfcomm_pi(sk)->channel == channel && !bacmp(&rfcomm_pi(sk)->src, src)) break; } return sk ? sk : NULL; } ",0 "METHODDEF(JDIMENSION) get_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading raw-byte-format PPM files with any maxval */ { ppm_source_ptr source = (ppm_source_ptr)sinfo; register JSAMPROW ptr; register U_CHAR *bufferptr; register JSAMPLE *rescale = source->rescale; JDIMENSION col; unsigned int maxval = source->maxval; register int rindex = rgb_red[cinfo->in_color_space]; register int gindex = rgb_green[cinfo->in_color_space]; register int bindex = rgb_blue[cinfo->in_color_space]; register int aindex = alpha_index[cinfo->in_color_space]; register int ps = rgb_pixelsize[cinfo->in_color_space]; if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width)) ERREXIT(cinfo, JERR_INPUT_EOF); ptr = source->pub.buffer[0]; bufferptr = source->iobuffer; if (maxval == MAXJSAMPLE) { if (aindex >= 0) RGB_READ_LOOP(*bufferptr++, ptr[aindex] = 0xFF;) else RGB_READ_LOOP(*bufferptr++,) } else { if (aindex >= 0) RGB_READ_LOOP(rescale[UCH(*bufferptr++)], ptr[aindex] = 0xFF;) else RGB_READ_LOOP(rescale[UCH(*bufferptr++)],) } return 1; } ",0 "static int add_ref_from_push_spec(git_vector *refs, push_spec *push_spec) { git_pkt_ref *added = git__calloc(1, sizeof(git_pkt_ref)); GITERR_CHECK_ALLOC(added); added->type = GIT_PKT_REF; git_oid_cpy(&added->head.oid, &push_spec->loid); added->head.name = git__strdup(push_spec->refspec.dst); if (!added->head.name || git_vector_insert(refs, added) < 0) { git_pkt_free((git_pkt *)added); return -1; } return 0; } ",0 "void LayerTreeHost::DidStopFlinging() { proxy_->MainThreadHasStoppedFlinging(); } ",0 "void Instance::ConfigureNumberImageGenerator() { std::vector num_images = GetThumbnailResources(); pp::ImageData number_background = CreateResourceImage( PP_RESOURCEIMAGE_PDF_BUTTON_THUMBNAIL_NUM_BACKGROUND); number_image_generator_->Configure(number_background, num_images, device_scale_); } ",0 "gpgsm_getauditlog (void *engine, gpgme_data_t output, unsigned int flags) { engine_gpgsm_t gpgsm = engine; gpgme_error_t err = 0; if (!gpgsm || !output) return gpg_error (GPG_ERR_INV_VALUE); #if USE_DESCRIPTOR_PASSING gpgsm->output_cb.data = output; err = gpgsm_set_fd (gpgsm, OUTPUT_FD, 0); if (err) return err; gpgsm_clear_fd (gpgsm, INPUT_FD); gpgsm_clear_fd (gpgsm, MESSAGE_FD); gpgsm->inline_data = NULL; # define CMD ""GETAUDITLOG"" #else gpgsm_clear_fd (gpgsm, OUTPUT_FD); gpgsm_clear_fd (gpgsm, INPUT_FD); gpgsm_clear_fd (gpgsm, MESSAGE_FD); gpgsm->inline_data = output; # define CMD ""GETAUDITLOG --data"" #endif err = start (gpgsm, (flags & GPGME_AUDITLOG_HTML)? CMD "" --html"" : CMD); return err; } ",0 "void addReplyLongLongWithPrefix(client *c, long long ll, char prefix) { char buf[128]; int len; /* Things like $3\r\n or *2\r\n are emitted very often by the protocol * so we have a few shared objects to use if the integer is small * like it is most of the times. */ if (prefix == '*' && ll < OBJ_SHARED_BULKHDR_LEN && ll >= 0) { addReply(c,shared.mbulkhdr[ll]); return; } else if (prefix == '$' && ll < OBJ_SHARED_BULKHDR_LEN && ll >= 0) { addReply(c,shared.bulkhdr[ll]); return; } buf[0] = prefix; len = ll2string(buf+1,sizeof(buf)-1,ll); buf[len+1] = '\r'; buf[len+2] = '\n'; addReplyString(c,buf,len+3); } ",0 "SYSCALL_DEFINE2(sched_setattr, pid_t, pid, struct sched_attr __user *, uattr) { struct sched_attr attr; struct task_struct *p; int retval; if (!uattr || pid < 0) return -EINVAL; if (sched_copy_attr(uattr, &attr)) return -EFAULT; rcu_read_lock(); retval = -ESRCH; p = find_process_by_pid(pid); if (p != NULL) retval = sched_setattr(p, &attr); rcu_read_unlock(); return retval; } ",0 "base::string16 CardUnmaskPromptViews::GetDialogButtonLabel( ui::DialogButton button) const { if (button == ui::DIALOG_BUTTON_OK) return l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_UNMASK_CONFIRM_BUTTON); return DialogDelegateView::GetDialogButtonLabel(button); } ",0 "static void nfs4_xdr_enc_exchange_id(struct rpc_rqst *req, struct xdr_stream *xdr, struct nfs41_exchange_id_args *args) { struct compound_hdr hdr = { .minorversion = args->client->cl_mvops->minor_version, }; encode_compound_hdr(xdr, req, &hdr); encode_exchange_id(xdr, args, &hdr); encode_nops(&hdr); } ",0 " void RegisterFunction() { factories_[T::function_name()] = &NewExtensionFunction; } ",0 "int fd_columns(int fd) { struct winsize ws = {}; if (ioctl(fd, TIOCGWINSZ, &ws) < 0) return -errno; if (ws.ws_col <= 0) return -EIO; return ws.ws_col; } ",0 "GF_Err gf_isom_hevc_config_update(GF_ISOFile *the_file, u32 trackNumber, u32 DescriptionIndex, GF_HEVCConfig *cfg) { return gf_isom_hevc_config_update_ex(the_file, trackNumber, DescriptionIndex, cfg, GF_ISOM_HVCC_UPDATE); } ",0 "static void *tcmur_cmdproc_thread(void *arg) { struct tcmu_device *dev = arg; struct tcmur_handler *rhandler = tcmu_get_runner_handler(dev); struct pollfd pfd; int ret; pthread_cleanup_push(cmdproc_thread_cleanup, dev); while (1) { int completed = 0; struct tcmulib_cmd *cmd; tcmulib_processing_start(dev); while ((cmd = tcmulib_get_next_command(dev)) != NULL) { if (tcmu_get_log_level() == TCMU_LOG_DEBUG_SCSI_CMD) tcmu_cdb_debug_info(cmd); if (tcmur_handler_is_passthrough_only(rhandler)) ret = tcmur_cmd_passthrough_handler(dev, cmd); else ret = tcmur_generic_handle_cmd(dev, cmd); if (ret == TCMU_NOT_HANDLED) tcmu_warn(""Command 0x%x not supported\n"", cmd->cdb[0]); /* * command (processing) completion is called in the following * scenarios: * - handle_cmd: synchronous handlers * - generic_handle_cmd: non tcmur handler calls (see generic_cmd()) * and on errors when calling tcmur handler. */ if (ret != TCMU_ASYNC_HANDLED) { completed = 1; tcmur_command_complete(dev, cmd, ret); } } if (completed) tcmulib_processing_complete(dev); pfd.fd = tcmu_get_dev_fd(dev); pfd.events = POLLIN; pfd.revents = 0; poll(&pfd, 1, -1); if (pfd.revents != POLLIN) { tcmu_err(""poll received unexpected revent: 0x%x\n"", pfd.revents); break; } } tcmu_err(""thread terminating, should never happen\n""); pthread_cleanup_pop(1); return NULL; } ",0 "user_get_system_account (User *user) { return accounts_user_get_system_account (ACCOUNTS_USER (user)); } ",0 "static int mov_write_udta_tag(AVIOContext *pb, MOVMuxContext *mov, AVFormatContext *s) { AVIOContext *pb_buf; int ret, size; uint8_t *buf; ret = avio_open_dyn_buf(&pb_buf); if (ret < 0) return ret; if (mov->mode & MODE_3GP) { mov_write_3gp_udta_tag(pb_buf, s, ""perf"", ""artist""); mov_write_3gp_udta_tag(pb_buf, s, ""titl"", ""title""); mov_write_3gp_udta_tag(pb_buf, s, ""auth"", ""author""); mov_write_3gp_udta_tag(pb_buf, s, ""gnre"", ""genre""); mov_write_3gp_udta_tag(pb_buf, s, ""dscp"", ""comment""); mov_write_3gp_udta_tag(pb_buf, s, ""albm"", ""album""); mov_write_3gp_udta_tag(pb_buf, s, ""cprt"", ""copyright""); mov_write_3gp_udta_tag(pb_buf, s, ""yrrc"", ""date""); mov_write_loci_tag(s, pb_buf); } else if (mov->mode == MODE_MOV && !(mov->flags & FF_MOV_FLAG_USE_MDTA)) { // the title field breaks gtkpod with mp4 and my suspicion is that stuff is not valid in mp4 mov_write_string_metadata(s, pb_buf, ""\251ART"", ""artist"", 0); mov_write_string_metadata(s, pb_buf, ""\251nam"", ""title"", 0); mov_write_string_metadata(s, pb_buf, ""\251aut"", ""author"", 0); mov_write_string_metadata(s, pb_buf, ""\251alb"", ""album"", 0); mov_write_string_metadata(s, pb_buf, ""\251day"", ""date"", 0); mov_write_string_metadata(s, pb_buf, ""\251swr"", ""encoder"", 0); mov_write_string_metadata(s, pb_buf, ""\251des"", ""comment"", 0); mov_write_string_metadata(s, pb_buf, ""\251cmt"", ""comment"", 0); mov_write_string_metadata(s, pb_buf, ""\251gen"", ""genre"", 0); mov_write_string_metadata(s, pb_buf, ""\251cpy"", ""copyright"", 0); mov_write_string_metadata(s, pb_buf, ""\251mak"", ""make"", 0); mov_write_string_metadata(s, pb_buf, ""\251mod"", ""model"", 0); mov_write_string_metadata(s, pb_buf, ""\251xyz"", ""location"", 0); mov_write_string_metadata(s, pb_buf, ""\251key"", ""keywords"", 0); mov_write_raw_metadata_tag(s, pb_buf, ""XMP_"", ""xmp""); } else { /* iTunes meta data */ mov_write_meta_tag(pb_buf, mov, s); mov_write_loci_tag(s, pb_buf); } if (s->nb_chapters && !(mov->flags & FF_MOV_FLAG_DISABLE_CHPL)) mov_write_chpl_tag(pb_buf, s); if ((size = avio_close_dyn_buf(pb_buf, &buf)) > 0) { avio_wb32(pb, size + 8); ffio_wfourcc(pb, ""udta""); avio_write(pb, buf, size); } av_free(buf); return 0; } ",0 "ResourceDispatcherHostImpl::GetTrafficAnnotation() { return net::DefineNetworkTrafficAnnotation(""resource_dispatcher_host"", R""( semantics { sender: ""Resource Dispatcher Host"" description: ""Navigation-initiated request or renderer process initiated "" ""request, which includes all resources for normal page loads, "" ""chrome URLs, resources for installed extensions, as well as "" ""downloads."" trigger: ""Navigating to a URL or downloading a file. A webpage, "" ""ServiceWorker, chrome:// page, or extension may also initiate "" ""requests in the background."" data: ""Anything the initiator wants to send."" destination: OTHER } policy { cookies_allowed: YES cookies_store: ""user or per-app cookie store"" setting: ""These requests cannot be disabled."" policy_exception_justification: ""Not implemented. Without these requests, Chrome will be unable to "" ""load any webpage."" })""); } ",0 "static int mov_write_gama_tag(AVIOContext *pb, MOVTrack *track, double gamma) { uint32_t gama = 0; if (gamma <= 0.0) { gamma = avpriv_get_gamma_from_trc(track->par->color_trc); } av_log(pb, AV_LOG_DEBUG, ""gamma value %g\n"", gamma); if (gamma > 1e-6) { gama = (uint32_t)lrint((double)(1<<16) * gamma); av_log(pb, AV_LOG_DEBUG, ""writing gama value %""PRId32""\n"", gama); av_assert0(track->mode == MODE_MOV); avio_wb32(pb, 12); ffio_wfourcc(pb, ""gama""); avio_wb32(pb, gama); return 12; } else { av_log(pb, AV_LOG_WARNING, ""gamma value unknown, unable to write gama atom\n""); } return 0; } ",0 "void kvm_release_pfn_clean(pfn_t pfn) { if (!kvm_is_mmio_pfn(pfn)) put_page(pfn_to_page(pfn)); } ",0 "static void t1_subset_end(void) { if (t1_synthetic) { /* copy to ""dup /FontName get exch definefont pop"" */ while (!strstr(t1_line_array, ""definefont"")) { t1_getline(); t1_putline(); } while (!t1_end_eexec()) t1_getline(); /* ignore the rest */ t1_putline(); /* write ""mark currentfile closefile"" */ } else while (!t1_end_eexec()) { /* copy to ""mark currentfile closefile"" */ t1_getline(); t1_putline(); } t1_stop_eexec(); if (fixedcontent) { /* copy 512 zeros (not needed for PDF) */ while (!t1_cleartomark()) { t1_getline(); t1_putline(); } if (!t1_synthetic) /* don't check ""{restore}if"" for synthetic fonts */ t1_check_end(); /* write ""{restore}if"" if found */ } get_length3(); } ",0 "int FS_FTell( fileHandle_t f ) { int pos; if (fsh[f].zipFile == qtrue) { pos = unztell(fsh[f].handleFiles.file.z); } else { pos = ftell(fsh[f].handleFiles.file.o); } return pos; } ",0 "MagickExport void *RelinquishMagickMemory(void *memory) { if (memory == (void *) NULL) return((void *) NULL); #if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT) memory_methods.destroy_memory_handler(memory); #else LockSemaphoreInfo(memory_semaphore); assert((SizeOfBlock(memory) % (4*sizeof(size_t))) == 0); assert((*BlockHeader(NextBlock(memory)) & PreviousBlockBit) != 0); if ((*BlockHeader(memory) & PreviousBlockBit) == 0) { void *previous; /* Coalesce with previous adjacent block. */ previous=PreviousBlock(memory); RemoveFreeBlock(previous,AllocationPolicy(SizeOfBlock(previous))); *BlockHeader(previous)=(SizeOfBlock(previous)+SizeOfBlock(memory)) | (*BlockHeader(previous) & ~SizeMask); memory=previous; } if ((*BlockHeader(NextBlock(NextBlock(memory))) & PreviousBlockBit) == 0) { void *next; /* Coalesce with next adjacent block. */ next=NextBlock(memory); RemoveFreeBlock(next,AllocationPolicy(SizeOfBlock(next))); *BlockHeader(memory)=(SizeOfBlock(memory)+SizeOfBlock(next)) | (*BlockHeader(memory) & ~SizeMask); } *BlockFooter(memory,SizeOfBlock(memory))=SizeOfBlock(memory); *BlockHeader(NextBlock(memory))&=(~PreviousBlockBit); InsertFreeBlock(memory,AllocationPolicy(SizeOfBlock(memory))); UnlockSemaphoreInfo(memory_semaphore); #endif return((void *) NULL); } ",0 "MagickExport const char *GetMagickReleaseDate(void) { return(MagickReleaseDate); } ",0 "set_bound_node_opt_info(OptNode* opt, MinMax* plen) { copy_mml(&(opt->sb.mmd), plen); copy_mml(&(opt->spr.mmd), plen); copy_mml(&(opt->map.mmd), plen); } ",0 "error::Error GLES2DecoderImpl::HandleGetShaderPrecisionFormat( uint32 immediate_data_size, const cmds::GetShaderPrecisionFormat& c) { GLenum shader_type = static_cast(c.shadertype); GLenum precision_type = static_cast(c.precisiontype); typedef cmds::GetShaderPrecisionFormat::Result Result; Result* result = GetSharedMemoryAs( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } if (result->success != 0) { return error::kInvalidArguments; } if (!validators_->shader_type.IsValid(shader_type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( ""glGetShaderPrecisionFormat"", shader_type, ""shader_type""); return error::kNoError; } if (!validators_->shader_precision.IsValid(precision_type)) { LOCAL_SET_GL_ERROR_INVALID_ENUM( ""glGetShaderPrecisionFormat"", precision_type, ""precision_type""); return error::kNoError; } result->success = 1; // true GLint range[2] = { 0, 0 }; GLint precision = 0; GetShaderPrecisionFormatImpl(shader_type, precision_type, range, &precision); result->min_range = range[0]; result->max_range = range[1]; result->precision = precision; return error::kNoError; } ",0 "void truncate_data_blocks(struct dnode_of_data *dn) { truncate_data_blocks_range(dn, ADDRS_PER_BLOCK); } ",0 "bool RenderFrameImpl::ShouldReportDetailedMessageForSource( const blink::WebString& source) { return GetContentClient()->renderer()->ShouldReportDetailedMessageForSource( source.Utf16()); } ",0 " bool btsock_thread_remove_fd_and_close(int thread_handle, int fd) { if (thread_handle < 0 || thread_handle >= MAX_THREAD) { APPL_TRACE_ERROR(""%s invalid thread handle: %d"", __func__, thread_handle); return false; } if (fd == -1) { APPL_TRACE_ERROR(""%s invalid file descriptor."", __func__); return false; } sock_cmd_t cmd = {CMD_REMOVE_FD, fd, 0, 0, 0}; return send(ts[thread_handle].cmd_fdw, &cmd, sizeof(cmd), 0) == sizeof(cmd); } ",1 "RendererPreferences WebContentsImpl::GetRendererPrefs( BrowserContext* browser_context) const { return renderer_preferences_; } ",0 "ACodec::BufferInfo *ACodec::findBufferByID( uint32_t portIndex, IOMX::buffer_id bufferID, ssize_t *index) { for (size_t i = 0; i < mBuffers[portIndex].size(); ++i) { BufferInfo *info = &mBuffers[portIndex].editItemAt(i); if (info->mBufferID == bufferID) { if (index != NULL) { *index = i; } return info; } } ALOGE(""Could not find buffer with ID %u"", bufferID); return NULL; } ",0 "void Shell::UpdateAfterLoginStatusChange(user::LoginStatus status) { RootWindowControllerList controllers = GetAllRootWindowControllers(); for (RootWindowControllerList::iterator iter = controllers.begin(); iter != controllers.end(); ++iter) (*iter)->UpdateAfterLoginStatusChange(status); } ",0 "Function::Function() { } ",0 "error::Error GLES2DecoderImpl::HandlePixelStorei( uint32_t immediate_data_size, const volatile void* cmd_data) { const volatile gles2::cmds::PixelStorei& c = *static_cast(cmd_data); GLenum pname = c.pname; GLint param = c.param; if (!validators_->pixel_store.IsValid(pname)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(""glPixelStorei"", pname, ""pname""); return error::kNoError; } switch (pname) { case GL_PACK_ALIGNMENT: case GL_UNPACK_ALIGNMENT: if (!validators_->pixel_store_alignment.IsValid(param)) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, ""glPixelStorei"", ""invalid param""); return error::kNoError; } break; case GL_PACK_ROW_LENGTH: case GL_UNPACK_ROW_LENGTH: case GL_UNPACK_IMAGE_HEIGHT: if (param < 0) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, ""glPixelStorei"", ""invalid param""); return error::kNoError; } break; case GL_PACK_SKIP_PIXELS: case GL_PACK_SKIP_ROWS: case GL_UNPACK_SKIP_PIXELS: case GL_UNPACK_SKIP_ROWS: case GL_UNPACK_SKIP_IMAGES: return error::kInvalidArguments; default: break; } switch (pname) { case GL_PACK_ROW_LENGTH: if (state_.bound_pixel_pack_buffer.get()) api()->glPixelStoreiFn(pname, param); break; case GL_UNPACK_ROW_LENGTH: case GL_UNPACK_IMAGE_HEIGHT: if (state_.bound_pixel_unpack_buffer.get()) api()->glPixelStoreiFn(pname, param); break; default: api()->glPixelStoreiFn(pname, param); break; } switch (pname) { case GL_PACK_ALIGNMENT: state_.pack_alignment = param; break; case GL_PACK_ROW_LENGTH: state_.pack_row_length = param; break; case GL_UNPACK_ALIGNMENT: state_.unpack_alignment = param; break; case GL_UNPACK_ROW_LENGTH: state_.unpack_row_length = param; break; case GL_UNPACK_IMAGE_HEIGHT: state_.unpack_image_height = param; break; default: NOTREACHED(); break; } return error::kNoError; } ",0 "GF_Err rtpo_Read(GF_Box *s, GF_BitStream *bs) { GF_RTPOBox *ptr = (GF_RTPOBox *)s; ptr->timeOffset = gf_bs_read_u32(bs); return GF_OK; } ",0 "void setSansSerifFontFamilyWrapper(WebSettings* settings, const string16& font, UScriptCode script) { settings->setSansSerifFontFamily(font, script); } ",0 "bool Document::IsInWebAppScope() const { if (!GetSettings()) return false; const String& web_app_scope = GetSettings()->GetWebAppScope(); if (web_app_scope.IsNull() || web_app_scope.IsEmpty()) return false; DCHECK_EQ(KURL(web_app_scope).GetString(), web_app_scope); return Url().GetString().StartsWith(web_app_scope); } ",0 "void PresentationConnection::tearDown() { if (m_blobLoader) { m_blobLoader->cancel(); m_blobLoader.clear(); } m_messages.clear(); } ",0 "bgp_attr_as4_path (struct bgp_attr_parser_args *args, struct aspath **as4_path) { struct peer *const peer = args->peer; struct attr *const attr = args->attr; const bgp_size_t length = args->length; *as4_path = aspath_parse (peer->ibuf, length, 1); /* In case of IBGP, length will be zero. */ if (!*as4_path) { zlog (peer->log, LOG_ERR, ""Malformed AS4 path from %s, length is %d"", peer->host, length); return bgp_attr_malformed (args, BGP_NOTIFY_UPDATE_MAL_AS_PATH, 0); } /* Set aspath attribute flag. */ if (as4_path) attr->flag |= ATTR_FLAG_BIT (BGP_ATTR_AS4_PATH); return BGP_ATTR_PARSE_PROCEED; } ",0 "static int btreeCreateTable(Btree *p, int *piTable, int createTabFlags){ BtShared *pBt = p->pBt; MemPage *pRoot; Pgno pgnoRoot; int rc; int ptfFlags; /* Page-type flage for the root page of new table */ assert( sqlite3BtreeHoldsMutex(p) ); assert( pBt->inTransaction==TRANS_WRITE ); assert( (pBt->btsFlags & BTS_READ_ONLY)==0 ); #ifdef SQLITE_OMIT_AUTOVACUUM rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0); if( rc ){ return rc; } #else if( pBt->autoVacuum ){ Pgno pgnoMove; /* Move a page here to make room for the root-page */ MemPage *pPageMove; /* The page to move to. */ /* Creating a new table may probably require moving an existing database ** to make room for the new tables root page. In case this page turns ** out to be an overflow page, delete all overflow page-map caches ** held by open cursors. */ invalidateAllOverflowCache(pBt); /* Read the value of meta[3] from the database to determine where the ** root page of the new table should go. meta[3] is the largest root-page ** created so far, so the new root-page is (meta[3]+1). */ sqlite3BtreeGetMeta(p, BTREE_LARGEST_ROOT_PAGE, &pgnoRoot); pgnoRoot++; /* The new root-page may not be allocated on a pointer-map page, or the ** PENDING_BYTE page. */ while( pgnoRoot==PTRMAP_PAGENO(pBt, pgnoRoot) || pgnoRoot==PENDING_BYTE_PAGE(pBt) ){ pgnoRoot++; } assert( pgnoRoot>=3 || CORRUPT_DB ); testcase( pgnoRoot<3 ); /* Allocate a page. The page that currently resides at pgnoRoot will ** be moved to the allocated page (unless the allocated page happens ** to reside at pgnoRoot). */ rc = allocateBtreePage(pBt, &pPageMove, &pgnoMove, pgnoRoot, BTALLOC_EXACT); if( rc!=SQLITE_OK ){ return rc; } if( pgnoMove!=pgnoRoot ){ /* pgnoRoot is the page that will be used for the root-page of ** the new table (assuming an error did not occur). But we were ** allocated pgnoMove. If required (i.e. if it was not allocated ** by extending the file), the current page at position pgnoMove ** is already journaled. */ u8 eType = 0; Pgno iPtrPage = 0; /* Save the positions of any open cursors. This is required in ** case they are holding a reference to an xFetch reference ** corresponding to page pgnoRoot. */ rc = saveAllCursors(pBt, 0, 0); releasePage(pPageMove); if( rc!=SQLITE_OK ){ return rc; } /* Move the page currently at pgnoRoot to pgnoMove. */ rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0); if( rc!=SQLITE_OK ){ return rc; } rc = ptrmapGet(pBt, pgnoRoot, &eType, &iPtrPage); if( eType==PTRMAP_ROOTPAGE || eType==PTRMAP_FREEPAGE ){ rc = SQLITE_CORRUPT_BKPT; } if( rc!=SQLITE_OK ){ releasePage(pRoot); return rc; } assert( eType!=PTRMAP_ROOTPAGE ); assert( eType!=PTRMAP_FREEPAGE ); rc = relocatePage(pBt, pRoot, eType, iPtrPage, pgnoMove, 0); releasePage(pRoot); /* Obtain the page at pgnoRoot */ if( rc!=SQLITE_OK ){ return rc; } rc = btreeGetPage(pBt, pgnoRoot, &pRoot, 0); if( rc!=SQLITE_OK ){ return rc; } rc = sqlite3PagerWrite(pRoot->pDbPage); if( rc!=SQLITE_OK ){ releasePage(pRoot); return rc; } }else{ pRoot = pPageMove; } /* Update the pointer-map and meta-data with the new root-page number. */ ptrmapPut(pBt, pgnoRoot, PTRMAP_ROOTPAGE, 0, &rc); if( rc ){ releasePage(pRoot); return rc; } /* When the new root page was allocated, page 1 was made writable in ** order either to increase the database filesize, or to decrement the ** freelist count. Hence, the sqlite3BtreeUpdateMeta() call cannot fail. */ assert( sqlite3PagerIswriteable(pBt->pPage1->pDbPage) ); rc = sqlite3BtreeUpdateMeta(p, 4, pgnoRoot); if( NEVER(rc) ){ releasePage(pRoot); return rc; } }else{ rc = allocateBtreePage(pBt, &pRoot, &pgnoRoot, 1, 0); if( rc ) return rc; } #endif assert( sqlite3PagerIswriteable(pRoot->pDbPage) ); if( createTabFlags & BTREE_INTKEY ){ ptfFlags = PTF_INTKEY | PTF_LEAFDATA | PTF_LEAF; }else{ ptfFlags = PTF_ZERODATA | PTF_LEAF; } zeroPage(pRoot, ptfFlags); sqlite3PagerUnref(pRoot->pDbPage); assert( (pBt->openFlags & BTREE_SINGLE)==0 || pgnoRoot==2 ); *piTable = (int)pgnoRoot; return SQLITE_OK; } ",0 "nvmet_fc_getqueueid(u64 connectionid) { return (u16)(connectionid & NVMET_FC_QUEUEID_MASK); } ",0 "static void _ewk_view_scrolls_flush(Ewk_View_Private_Data* priv) { priv->scrolls.count = 0; if (priv->scrolls.allocated <= EWK_VIEW_SCROLLS_SIZE_MAX_FREE) return; _ewk_view_scrolls_resize(priv, EWK_VIEW_SCROLLS_SIZE_MAX_FREE); } ",0 "compile_call(CallNode* node, regex_t* reg, ScanEnv* env) { int r; int offset; r = add_op(reg, OP_CALL); if (r != 0) return r; COP(reg)->call.addr = 0; /* dummy addr. */ offset = COP_CURR_OFFSET_BYTES(reg, call.addr); r = unset_addr_list_add(env->unset_addr_list, offset, NODE_CALL_BODY(node)); return r; } ",0 "void LocalFrameClientImpl::DidDetectXSS(const KURL& insecure_url, bool did_block_entire_page) { if (web_frame_->Client()) web_frame_->Client()->DidDetectXSS(insecure_url, did_block_entire_page); } ",0 "static uint8_t arcmsr_hbaA_wait_msgint_ready(struct AdapterControlBlock *acb) { struct MessageUnit_A __iomem *reg = acb->pmuA; int i; for (i = 0; i < 2000; i++) { if (readl(®->outbound_intstatus) & ARCMSR_MU_OUTBOUND_MESSAGE0_INT) { writel(ARCMSR_MU_OUTBOUND_MESSAGE0_INT, ®->outbound_intstatus); return true; } msleep(10); } /* max 20 seconds */ return false; } ",0 "static int common_perm_create(int op, const struct path *dir, struct dentry *dentry, u32 mask, umode_t mode) { struct path_cond cond = { current_fsuid(), mode }; if (!mediated_filesystem(dir->dentry)) return 0; return common_perm_dir_dentry(op, dir, dentry, mask, &cond); } ",0 "bool PrintWebViewHelper::CopyMetafileDataToSharedMem( printing::Metafile* metafile, base::SharedMemoryHandle* shared_mem_handle) { uint32 buf_size = metafile->GetDataSize(); base::SharedMemoryHandle mem_handle = render_view()->HostAllocateSharedMemoryBuffer(buf_size); if (base::SharedMemory::IsHandleValid(mem_handle)) { base::SharedMemory shared_buf(mem_handle, false); if (shared_buf.Map(buf_size)) { metafile->GetData(shared_buf.memory(), buf_size); shared_buf.GiveToProcess(base::GetCurrentProcessHandle(), shared_mem_handle); return true; } } NOTREACHED(); return false; } ",0 "int dns_packet_append_blob(DnsPacket *p, const void *d, size_t l, size_t *start) { void *q; int r; assert(p); r = dns_packet_extend(p, l, &q, start); if (r < 0) return r; memcpy(q, d, l); return 0; } ",0 "void Document::UpdateStyleInvalidationIfNeeded() { DCHECK(IsActive()); ScriptForbiddenScope forbid_script; if (!ChildNeedsStyleInvalidation() && !NeedsStyleInvalidation()) return; TRACE_EVENT0(""blink"", ""Document::updateStyleInvalidationIfNeeded""); SCOPED_BLINK_UMA_HISTOGRAM_TIMER_HIGHRES(""Style.InvalidationTime""); GetStyleEngine().InvalidateStyle(); } ",0 "void ExtensionService::SetIsIncognitoEnabled( const std::string& extension_id, bool enabled) { const Extension* extension = GetInstalledExtension(extension_id); if (extension && extension->location() == Extension::COMPONENT) { NOTREACHED(); return; } bool old_enabled = extension_prefs_->IsIncognitoEnabled(extension_id); if (enabled == old_enabled) return; extension_prefs_->SetIsIncognitoEnabled(extension_id, enabled); const Extension* enabled_extension = GetExtensionById(extension_id, false); if (enabled_extension) { NotifyExtensionUnloaded( enabled_extension, extension_misc::UNLOAD_REASON_DISABLE); NotifyExtensionLoaded(enabled_extension); } if (extension) SyncExtensionChangeIfNeeded(*extension); } ",0 "WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec, WORD32 i4_poc, pocstruct_t *ps_temp_poc, UWORD16 u2_frame_num, dec_pic_params_t *ps_pps) { pocstruct_t *ps_prev_poc = &ps_dec->s_cur_pic_poc; pocstruct_t *ps_cur_poc = ps_temp_poc; pic_buffer_t *pic_buf; ivd_video_decode_op_t * ps_dec_output = (ivd_video_decode_op_t *)ps_dec->pv_dec_out; dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice; dec_seq_params_t *ps_seq = ps_pps->ps_sps; UWORD8 u1_bottom_field_flag = ps_cur_slice->u1_bottom_field_flag; UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag; /* high profile related declarations */ high_profile_tools_t s_high_profile; WORD32 ret; H264_MUTEX_LOCK(&ps_dec->process_disp_mutex); ps_prev_poc->i4_pic_order_cnt_lsb = ps_cur_poc->i4_pic_order_cnt_lsb; ps_prev_poc->i4_pic_order_cnt_msb = ps_cur_poc->i4_pic_order_cnt_msb; ps_prev_poc->i4_delta_pic_order_cnt_bottom = ps_cur_poc->i4_delta_pic_order_cnt_bottom; ps_prev_poc->i4_delta_pic_order_cnt[0] = ps_cur_poc->i4_delta_pic_order_cnt[0]; ps_prev_poc->i4_delta_pic_order_cnt[1] = ps_cur_poc->i4_delta_pic_order_cnt[1]; ps_prev_poc->u1_bot_field = ps_dec->ps_cur_slice->u1_bottom_field_flag; ps_prev_poc->i4_prev_frame_num_ofst = ps_cur_poc->i4_prev_frame_num_ofst; ps_prev_poc->u2_frame_num = u2_frame_num; ps_dec->i1_prev_mb_qp_delta = 0; ps_dec->i1_next_ctxt_idx = 0; ps_dec->u4_nmb_deblk = 0; if(ps_dec->u4_num_cores == 1) ps_dec->u4_nmb_deblk = 1; if(ps_seq->u1_mb_aff_flag == 1) { ps_dec->u4_nmb_deblk = 0; if(ps_dec->u4_num_cores > 2) ps_dec->u4_num_cores = 2; } ps_dec->u4_use_intrapred_line_copy = 0; if (ps_seq->u1_mb_aff_flag == 0) { ps_dec->u4_use_intrapred_line_copy = 1; } ps_dec->u4_app_disable_deblk_frm = 0; /* If degrade is enabled, set the degrade flags appropriately */ if(ps_dec->i4_degrade_type && ps_dec->i4_degrade_pics) { WORD32 degrade_pic; ps_dec->i4_degrade_pic_cnt++; degrade_pic = 0; /* If degrade is to be done in all frames, then do not check further */ switch(ps_dec->i4_degrade_pics) { case 4: { degrade_pic = 1; break; } case 3: { if(ps_cur_slice->u1_slice_type != I_SLICE) degrade_pic = 1; break; } case 2: { /* If pic count hits non-degrade interval or it is an islice, then do not degrade */ if((ps_cur_slice->u1_slice_type != I_SLICE) && (ps_dec->i4_degrade_pic_cnt != ps_dec->i4_nondegrade_interval)) degrade_pic = 1; break; } case 1: { /* Check if the current picture is non-ref */ if(0 == ps_cur_slice->u1_nal_ref_idc) { degrade_pic = 1; } break; } } if(degrade_pic) { if(ps_dec->i4_degrade_type & 0x2) ps_dec->u4_app_disable_deblk_frm = 1; /* MC degrading is done only for non-ref pictures */ if(0 == ps_cur_slice->u1_nal_ref_idc) { if(ps_dec->i4_degrade_type & 0x4) ps_dec->i4_mv_frac_mask = 0; if(ps_dec->i4_degrade_type & 0x8) ps_dec->i4_mv_frac_mask = 0; } } else ps_dec->i4_degrade_pic_cnt = 0; } { dec_err_status_t * ps_err = ps_dec->ps_dec_err_status; if(ps_dec->u1_sl_typ_5_9 && ((ps_cur_slice->u1_slice_type == I_SLICE) || (ps_cur_slice->u1_slice_type == SI_SLICE))) ps_err->u1_cur_pic_type = PIC_TYPE_I; else ps_err->u1_cur_pic_type = PIC_TYPE_UNKNOWN; if(ps_err->u1_pic_aud_i == PIC_TYPE_I) { ps_err->u1_cur_pic_type = PIC_TYPE_I; ps_err->u1_pic_aud_i = PIC_TYPE_UNKNOWN; } if(ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL) { if(ps_err->u1_err_flag) ih264d_reset_ref_bufs(ps_dec->ps_dpb_mgr); ps_err->u1_err_flag = ACCEPT_ALL_PICS; } } if(ps_dec->u1_init_dec_flag && ps_dec->s_prev_seq_params.u1_eoseq_pending) { /* Reset the decoder picture buffers */ WORD32 j; for(j = 0; j < MAX_DISP_BUFS_NEW; j++) { ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, j, BUF_MGR_REF); ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, ps_dec->au1_pic_buf_id_mv_buf_id_map[j], BUF_MGR_REF); ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, j, BUF_MGR_IO); } /* reset the decoder structure parameters related to buffer handling */ ps_dec->u1_second_field = 0; ps_dec->i4_cur_display_seq = 0; /********************************************************************/ /* indicate in the decoder output i4_status that some frames are being */ /* dropped, so that it resets timestamp and wait for a new sequence */ /********************************************************************/ ps_dec->s_prev_seq_params.u1_eoseq_pending = 0; } ret = ih264d_init_pic(ps_dec, u2_frame_num, i4_poc, ps_pps); if(ret != OK) return ret; ps_dec->pv_parse_tu_coeff_data = ps_dec->pv_pic_tu_coeff_data; ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_pic_tu_coeff_data; ps_dec->ps_nmb_info = ps_dec->ps_frm_mb_info; if(ps_dec->u1_separate_parse) { UWORD16 pic_wd; UWORD16 pic_ht; UWORD32 num_mbs; pic_wd = ps_dec->u2_pic_wd; pic_ht = ps_dec->u2_pic_ht; num_mbs = (pic_wd * pic_ht) >> 8; if(ps_dec->pu1_dec_mb_map) { memset((void *)ps_dec->pu1_dec_mb_map, 0, num_mbs); } if(ps_dec->pu1_recon_mb_map) { memset((void *)ps_dec->pu1_recon_mb_map, 0, num_mbs); } if(ps_dec->pu2_slice_num_map) { memset((void *)ps_dec->pu2_slice_num_map, 0, (num_mbs * sizeof(UWORD16))); } } ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); /* Initialize all the HP toolsets to zero */ ps_dec->s_high_profile.u1_scaling_present = 0; ps_dec->s_high_profile.u1_transform8x8_present = 0; /* Get Next Free Picture */ if(1 == ps_dec->u4_share_disp_buf) { UWORD32 i; /* Free any buffer that is in the queue to be freed */ for(i = 0; i < MAX_DISP_BUFS_NEW; i++) { if(0 == ps_dec->u4_disp_buf_to_be_freed[i]) continue; ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, i, BUF_MGR_IO); ps_dec->u4_disp_buf_to_be_freed[i] = 0; ps_dec->u4_disp_buf_mapping[i] = 0; } } if(!(u1_field_pic_flag && 0 != ps_dec->u1_top_bottom_decoded)) //ps_dec->u1_second_field)) { pic_buffer_t *ps_cur_pic; WORD32 cur_pic_buf_id, cur_mv_buf_id; col_mv_buf_t *ps_col_mv; while(1) { ps_cur_pic = (pic_buffer_t *)ih264_buf_mgr_get_next_free( (buf_mgr_t *)ps_dec->pv_pic_buf_mgr, &cur_pic_buf_id); if(ps_cur_pic == NULL) { ps_dec->i4_error_code = ERROR_UNAVAIL_PICBUF_T; return ERROR_UNAVAIL_PICBUF_T; } if(0 == ps_dec->u4_disp_buf_mapping[cur_pic_buf_id]) { break; } } ps_col_mv = (col_mv_buf_t *)ih264_buf_mgr_get_next_free((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, &cur_mv_buf_id); if(ps_col_mv == NULL) { ps_dec->i4_error_code = ERROR_UNAVAIL_MVBUF_T; return ERROR_UNAVAIL_MVBUF_T; } ps_dec->ps_cur_pic = ps_cur_pic; ps_dec->u1_pic_buf_id = cur_pic_buf_id; ps_cur_pic->u4_ts = ps_dec->u4_ts; ps_cur_pic->u1_mv_buf_id = cur_mv_buf_id; ps_dec->au1_pic_buf_id_mv_buf_id_map[cur_pic_buf_id] = cur_mv_buf_id; ps_cur_pic->pu1_col_zero_flag = (UWORD8 *)ps_col_mv->pv_col_zero_flag; ps_cur_pic->ps_mv = (mv_pred_t *)ps_col_mv->pv_mv; ps_dec->au1_pic_buf_ref_flag[cur_pic_buf_id] = 0; if(ps_dec->u1_first_slice_in_stream) { /*make first entry of list0 point to cur pic,so that if first Islice is in error, ref pic struct will have valid entries*/ ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_init_dpb[0]; *(ps_dec->ps_dpb_mgr->ps_init_dpb[0][0]) = *ps_cur_pic; } if(!ps_dec->ps_cur_pic) { WORD32 j; H264_DEC_DEBUG_PRINT(""------- Display Buffers Reset --------\n""); for(j = 0; j < MAX_DISP_BUFS_NEW; j++) { ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, j, BUF_MGR_REF); ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, ps_dec->au1_pic_buf_id_mv_buf_id_map[j], BUF_MGR_REF); ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, j, BUF_MGR_IO); } ps_dec->i4_cur_display_seq = 0; ps_dec->i4_prev_max_display_seq = 0; ps_dec->i4_max_poc = 0; ps_cur_pic = (pic_buffer_t *)ih264_buf_mgr_get_next_free( (buf_mgr_t *)ps_dec->pv_pic_buf_mgr, &cur_pic_buf_id); if(ps_cur_pic == NULL) { ps_dec->i4_error_code = ERROR_UNAVAIL_PICBUF_T; return ERROR_UNAVAIL_PICBUF_T; } ps_col_mv = (col_mv_buf_t *)ih264_buf_mgr_get_next_free((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, &cur_mv_buf_id); if(ps_col_mv == NULL) { ps_dec->i4_error_code = ERROR_UNAVAIL_MVBUF_T; return ERROR_UNAVAIL_MVBUF_T; } ps_dec->ps_cur_pic = ps_cur_pic; ps_dec->u1_pic_buf_id = cur_pic_buf_id; ps_cur_pic->u4_ts = ps_dec->u4_ts; ps_dec->apv_buf_id_pic_buf_map[cur_pic_buf_id] = (void *)ps_cur_pic; ps_cur_pic->u1_mv_buf_id = cur_mv_buf_id; ps_dec->au1_pic_buf_id_mv_buf_id_map[cur_pic_buf_id] = cur_mv_buf_id; ps_cur_pic->pu1_col_zero_flag = (UWORD8 *)ps_col_mv->pv_col_zero_flag; ps_cur_pic->ps_mv = (mv_pred_t *)ps_col_mv->pv_mv; ps_dec->au1_pic_buf_ref_flag[cur_pic_buf_id] = 0; } ps_dec->ps_cur_pic->u1_picturetype = u1_field_pic_flag; ps_dec->ps_cur_pic->u4_pack_slc_typ = SKIP_NONE; H264_DEC_DEBUG_PRINT(""got a buffer\n""); } else { H264_DEC_DEBUG_PRINT(""did not get a buffer\n""); } ps_dec->u4_pic_buf_got = 1; ps_dec->ps_cur_pic->i4_poc = i4_poc; ps_dec->ps_cur_pic->i4_frame_num = u2_frame_num; ps_dec->ps_cur_pic->i4_pic_num = u2_frame_num; ps_dec->ps_cur_pic->i4_top_field_order_cnt = ps_pps->i4_top_field_order_cnt; ps_dec->ps_cur_pic->i4_bottom_field_order_cnt = ps_pps->i4_bottom_field_order_cnt; ps_dec->ps_cur_pic->i4_avg_poc = ps_pps->i4_avg_poc; ps_dec->ps_cur_pic->u4_time_stamp = ps_dec->u4_pts; ps_dec->s_cur_pic = *(ps_dec->ps_cur_pic); if(u1_field_pic_flag && u1_bottom_field_flag) { WORD32 i4_temp_poc; WORD32 i4_top_field_order_poc, i4_bot_field_order_poc; /* Point to odd lines, since it's bottom field */ ps_dec->s_cur_pic.pu1_buf1 += ps_dec->s_cur_pic.u2_frm_wd_y; ps_dec->s_cur_pic.pu1_buf2 += ps_dec->s_cur_pic.u2_frm_wd_uv; ps_dec->s_cur_pic.pu1_buf3 += ps_dec->s_cur_pic.u2_frm_wd_uv; ps_dec->s_cur_pic.ps_mv += ((ps_dec->u2_pic_ht * ps_dec->u2_pic_wd) >> 5); ps_dec->s_cur_pic.pu1_col_zero_flag += ((ps_dec->u2_pic_ht * ps_dec->u2_pic_wd) >> 5); ps_dec->ps_cur_pic->u1_picturetype |= BOT_FLD; i4_top_field_order_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt; i4_bot_field_order_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt; i4_temp_poc = MIN(i4_top_field_order_poc, i4_bot_field_order_poc); ps_dec->ps_cur_pic->i4_avg_poc = i4_temp_poc; } ps_cur_slice->u1_mbaff_frame_flag = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag); ps_dec->ps_cur_pic->u1_picturetype |= (ps_cur_slice->u1_mbaff_frame_flag << 2); ps_dec->ps_cur_mb_row = ps_dec->ps_nbr_mb_row; //[0]; ps_dec->ps_cur_mb_row += 2; ps_dec->ps_top_mb_row = ps_dec->ps_nbr_mb_row; ps_dec->ps_top_mb_row += ((ps_dec->u2_frm_wd_in_mbs + 2) << (1 - ps_dec->ps_cur_sps->u1_frame_mbs_only_flag)); ps_dec->ps_top_mb_row += 2; /* CHANGED CODE */ ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv; ps_dec->ps_mv_top = ps_dec->ps_mv_top_p[0]; /* CHANGED CODE */ ps_dec->u1_mv_top_p = 0; ps_dec->u1_mb_idx = 0; /* CHANGED CODE */ ps_dec->ps_mv_left = ps_dec->s_cur_pic.ps_mv; ps_dec->u2_total_mbs_coded = 0; ps_dec->i4_submb_ofst = -(SUB_BLK_SIZE); ps_dec->u4_pred_info_idx = 0; ps_dec->u4_pred_info_pkd_idx = 0; ps_dec->u4_dma_buf_idx = 0; ps_dec->ps_mv = ps_dec->s_cur_pic.ps_mv; ps_dec->ps_mv_bank_cur = ps_dec->s_cur_pic.ps_mv; ps_dec->pu1_col_zero_flag = ps_dec->s_cur_pic.pu1_col_zero_flag; ps_dec->ps_part = ps_dec->ps_parse_part_params; ps_dec->i2_prev_slice_mbx = -1; ps_dec->i2_prev_slice_mby = 0; ps_dec->u2_mv_2mb[0] = 0; ps_dec->u2_mv_2mb[1] = 0; ps_dec->u1_last_pic_not_decoded = 0; ps_dec->u2_cur_slice_num = 0; ps_dec->u2_cur_slice_num_dec_thread = 0; ps_dec->u2_cur_slice_num_bs = 0; ps_dec->u4_intra_pred_line_ofst = 0; ps_dec->pu1_cur_y_intra_pred_line = ps_dec->pu1_y_intra_pred_line; ps_dec->pu1_cur_u_intra_pred_line = ps_dec->pu1_u_intra_pred_line; ps_dec->pu1_cur_v_intra_pred_line = ps_dec->pu1_v_intra_pred_line; ps_dec->pu1_cur_y_intra_pred_line_base = ps_dec->pu1_y_intra_pred_line; ps_dec->pu1_cur_u_intra_pred_line_base = ps_dec->pu1_u_intra_pred_line; ps_dec->pu1_cur_v_intra_pred_line_base = ps_dec->pu1_v_intra_pred_line; ps_dec->pu1_prev_y_intra_pred_line = ps_dec->pu1_y_intra_pred_line + (ps_dec->u2_frm_wd_in_mbs * MB_SIZE); ps_dec->pu1_prev_u_intra_pred_line = ps_dec->pu1_u_intra_pred_line + ps_dec->u2_frm_wd_in_mbs * BLK8x8SIZE * YUV420SP_FACTOR; ps_dec->pu1_prev_v_intra_pred_line = ps_dec->pu1_v_intra_pred_line + ps_dec->u2_frm_wd_in_mbs * BLK8x8SIZE; ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic; /* Initialize The Function Pointer Depending Upon the Entropy and MbAff Flag */ { if(ps_cur_slice->u1_mbaff_frame_flag) { ps_dec->pf_compute_bs = ih264d_compute_bs_mbaff; ps_dec->pf_mvpred = ih264d_mvpred_mbaff; } else { ps_dec->pf_compute_bs = ih264d_compute_bs_non_mbaff; ps_dec->u1_cur_mb_fld_dec_flag = ps_cur_slice->u1_field_pic_flag; } } /* Set up the Parameter for DMA transfer */ { UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; UWORD8 u1_mbaff = ps_cur_slice->u1_mbaff_frame_flag; UWORD8 uc_lastmbs = (((ps_dec->u2_pic_wd) >> 4) % (ps_dec->u1_recon_mb_grp >> u1_mbaff)); UWORD16 ui16_lastmbs_widthY = (uc_lastmbs ? (uc_lastmbs << 4) : ((ps_dec->u1_recon_mb_grp >> u1_mbaff) << 4)); UWORD16 ui16_lastmbs_widthUV = uc_lastmbs ? (uc_lastmbs << 3) : ((ps_dec->u1_recon_mb_grp >> u1_mbaff) << 3); ps_dec->s_tran_addrecon.pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1; ps_dec->s_tran_addrecon.pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2; ps_dec->s_tran_addrecon.pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3; ps_dec->s_tran_addrecon.u2_frm_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag; ps_dec->s_tran_addrecon.u2_frm_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag; if(u1_field_pic_flag) { ui16_lastmbs_widthY += ps_dec->u2_frm_wd_y; ui16_lastmbs_widthUV += ps_dec->u2_frm_wd_uv; } /* Normal Increment of Pointer */ ps_dec->s_tran_addrecon.u4_inc_y[0] = ((ps_dec->u1_recon_mb_grp << 4) >> u1_mbaff); ps_dec->s_tran_addrecon.u4_inc_uv[0] = ((ps_dec->u1_recon_mb_grp << 4) >> u1_mbaff); /* End of Row Increment */ ps_dec->s_tran_addrecon.u4_inc_y[1] = (ui16_lastmbs_widthY + (PAD_LEN_Y_H << 1) + ps_dec->s_tran_addrecon.u2_frm_wd_y * ((15 << u1_mbaff) + u1_mbaff)); ps_dec->s_tran_addrecon.u4_inc_uv[1] = (ui16_lastmbs_widthUV + (PAD_LEN_UV_H << 2) + ps_dec->s_tran_addrecon.u2_frm_wd_uv * ((15 << u1_mbaff) + u1_mbaff)); /* Assign picture numbers to each frame/field */ /* only once per picture. */ ih264d_assign_pic_num(ps_dec); ps_dec->s_tran_addrecon.u2_mv_top_left_inc = (ps_dec->u1_recon_mb_grp << 2) - 1 - (u1_mbaff << 2); ps_dec->s_tran_addrecon.u2_mv_left_inc = ((ps_dec->u1_recon_mb_grp >> u1_mbaff) - 1) << (4 + u1_mbaff); } /**********************************************************************/ /* High profile related initialization at pictrue level */ /**********************************************************************/ if(ps_seq->u1_profile_idc == HIGH_PROFILE_IDC) { if((ps_seq->i4_seq_scaling_matrix_present_flag) || (ps_pps->i4_pic_scaling_matrix_present_flag)) { ih264d_form_scaling_matrix_picture(ps_seq, ps_pps, ps_dec); ps_dec->s_high_profile.u1_scaling_present = 1; } else { ih264d_form_default_scaling_matrix(ps_dec); } if(ps_pps->i4_transform_8x8_mode_flag) { ps_dec->s_high_profile.u1_transform8x8_present = 1; } } else { ih264d_form_default_scaling_matrix(ps_dec); } /* required while reading the transform_size_8x8 u4_flag */ ps_dec->s_high_profile.u1_direct_8x8_inference_flag = ps_seq->u1_direct_8x8_inference_flag; ps_dec->s_high_profile.s_cavlc_ctxt = ps_dec->s_cavlc_ctxt; ps_dec->i1_recon_in_thread3_flag = 1; ps_dec->ps_frame_buf_ip_recon = &ps_dec->s_tran_addrecon; if(ps_dec->u1_separate_parse) { memcpy(&ps_dec->s_tran_addrecon_parse, &ps_dec->s_tran_addrecon, sizeof(tfr_ctxt_t)); if(ps_dec->u4_num_cores >= 3 && ps_dec->i1_recon_in_thread3_flag) { memcpy(&ps_dec->s_tran_iprecon, &ps_dec->s_tran_addrecon, sizeof(tfr_ctxt_t)); ps_dec->ps_frame_buf_ip_recon = &ps_dec->s_tran_iprecon; } } ih264d_init_deblk_tfr_ctxt(ps_dec,&(ps_dec->s_pad_mgr), &(ps_dec->s_tran_addrecon), ps_dec->u2_frm_wd_in_mbs, 0); ps_dec->ps_cur_deblk_mb = ps_dec->ps_deblk_pic; ps_dec->u4_cur_deblk_mb_num = 0; ps_dec->u4_deblk_mb_x = 0; ps_dec->u4_deblk_mb_y = 0; H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex); return OK; } ",1 "WebCookieJar* RenderView::GetCookieJar() { return &cookie_jar_; } ",0 "void kvm_lapic_sync_from_vapic(struct kvm_vcpu *vcpu) { u32 data; void *vapic; if (test_bit(KVM_APIC_PV_EOI_PENDING, &vcpu->arch.apic_attention)) apic_sync_pv_eoi_from_guest(vcpu, vcpu->arch.apic); if (!test_bit(KVM_APIC_CHECK_VAPIC, &vcpu->arch.apic_attention)) return; vapic = kmap_atomic(vcpu->arch.apic->vapic_page); data = *(u32 *)(vapic + offset_in_page(vcpu->arch.apic->vapic_addr)); kunmap_atomic(vapic); apic_set_tpr(vcpu->arch.apic, data & 0xff); } ",0 "bool HTMLSelectElement::anonymousIndexedSetterRemove(unsigned index, ExceptionState& exceptionState) { remove(index); return true; } ",0 "void SendProcessKeyEvent(ui::EventType type, aura::WindowTreeHost* host) { ui::KeyEvent event(type, ui::VKEY_PROCESSKEY, ui::DomCode::NONE, ui::EF_NONE, ui::DomKey::PROCESS, 0, ui::EventTimeForNow()); event.SetTranslated(true); ui::EventDispatchDetails details = host->event_processor()->OnEventFromSource(&event); CHECK(!details.dispatcher_destroyed); } ",0 " ~ChromeContentBrowserClientExtensionsPart() { } ",0 "rend_consider_services_upload(time_t now) { int i; rend_service_t *service; const or_options_t *options = get_options(); int rendpostperiod = options->RendPostPeriod; int rendinitialpostdelay = (options->TestingTorNetwork ? MIN_REND_INITIAL_POST_DELAY_TESTING : MIN_REND_INITIAL_POST_DELAY); for (i=0; i < smartlist_len(rend_service_list); ++i) { service = smartlist_get(rend_service_list, i); if (!service->next_upload_time) { /* never been uploaded yet */ /* The fixed lower bound of rendinitialpostdelay seconds ensures that * the descriptor is stable before being published. See comment below. */ service->next_upload_time = now + rendinitialpostdelay + crypto_rand_int(2*rendpostperiod); /* Single Onion Services prioritise availability over hiding their * startup time, as their IP address is publicly discoverable anyway. */ if (rend_service_reveal_startup_time(options)) { service->next_upload_time = now + rendinitialpostdelay; } } /* Does every introduction points have been established? */ unsigned int intro_points_ready = count_established_intro_points(service) >= service->n_intro_points_wanted; if (intro_points_ready && (service->next_upload_time < now || (service->desc_is_dirty && service->desc_is_dirty < now-rendinitialpostdelay))) { /* if it's time, or if the directory servers have a wrong service * descriptor and ours has been stable for rendinitialpostdelay seconds, * upload a new one of each format. */ rend_service_update_descriptor(service); upload_service_descriptor(service); } } } ",0 "static void enabledPerContextAttrAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectV8Internal::enabledPerContextAttrAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "sctp_disposition_t sctp_sf_do_no_pending_tsn( struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_ulpevent *event; event = sctp_ulpevent_make_sender_dry_event(asoc, GFP_ATOMIC); if (!event) return SCTP_DISPOSITION_NOMEM; sctp_add_cmd_sf(commands, SCTP_CMD_EVENT_ULP, SCTP_ULPEVENT(event)); return SCTP_DISPOSITION_CONSUME; } ",0 "isis_print_mt_port_cap_subtlv(netdissect_options *ndo, const uint8_t *tptr, int len) { int stlv_type, stlv_len; const struct isis_subtlv_spb_mcid *subtlv_spb_mcid; int i; while (len > 2) { stlv_type = *(tptr++); stlv_len = *(tptr++); /* first lets see if we know the subTLVs name*/ ND_PRINT((ndo, ""\n\t %s subTLV #%u, length: %u"", tok2str(isis_mt_port_cap_subtlv_values, ""unknown"", stlv_type), stlv_type, stlv_len)); /*len -= TLV_TYPE_LEN_OFFSET;*/ len = len -2; switch (stlv_type) { case ISIS_SUBTLV_SPB_MCID: { ND_TCHECK2(*(tptr), ISIS_SUBTLV_SPB_MCID_MIN_LEN); subtlv_spb_mcid = (const struct isis_subtlv_spb_mcid *)tptr; ND_PRINT((ndo, ""\n\t MCID: "")); isis_print_mcid(ndo, &(subtlv_spb_mcid->mcid)); /*tptr += SPB_MCID_MIN_LEN; len -= SPB_MCID_MIN_LEN; */ ND_PRINT((ndo, ""\n\t AUX-MCID: "")); isis_print_mcid(ndo, &(subtlv_spb_mcid->aux_mcid)); /*tptr += SPB_MCID_MIN_LEN; len -= SPB_MCID_MIN_LEN; */ tptr = tptr + sizeof(struct isis_subtlv_spb_mcid); len = len - sizeof(struct isis_subtlv_spb_mcid); break; } case ISIS_SUBTLV_SPB_DIGEST: { ND_TCHECK2(*(tptr), ISIS_SUBTLV_SPB_DIGEST_MIN_LEN); ND_PRINT((ndo, ""\n\t RES: %d V: %d A: %d D: %d"", (*(tptr) >> 5), (((*tptr)>> 4) & 0x01), ((*(tptr) >> 2) & 0x03), ((*tptr) & 0x03))); tptr++; ND_PRINT((ndo, ""\n\t Digest: "")); for(i=1;i<=8; i++) { ND_PRINT((ndo, ""%08x "", EXTRACT_32BITS(tptr))); if (i%4 == 0 && i != 8) ND_PRINT((ndo, ""\n\t "")); tptr = tptr + 4; } len = len - ISIS_SUBTLV_SPB_DIGEST_MIN_LEN; break; } case ISIS_SUBTLV_SPB_BVID: { ND_TCHECK2(*(tptr), stlv_len); while (len >= ISIS_SUBTLV_SPB_BVID_MIN_LEN) { ND_TCHECK2(*(tptr), ISIS_SUBTLV_SPB_BVID_MIN_LEN); ND_PRINT((ndo, ""\n\t ECT: %08x"", EXTRACT_32BITS(tptr))); tptr = tptr+4; ND_PRINT((ndo, "" BVID: %d, U:%01x M:%01x "", (EXTRACT_16BITS (tptr) >> 4) , (EXTRACT_16BITS (tptr) >> 3) & 0x01, (EXTRACT_16BITS (tptr) >> 2) & 0x01)); tptr = tptr + 2; len = len - ISIS_SUBTLV_SPB_BVID_MIN_LEN; } break; } default: break; } } return 0; trunc: ND_PRINT((ndo, ""\n\t\t"")); ND_PRINT((ndo, ""%s"", tstr)); return(1); } ",0 " void PrintJobWorker::GetSettings(bool ask_user_for_settings, gfx::NativeWindow parent_window, int document_page_count, bool has_selection, bool use_overlays) { DCHECK_EQ(message_loop(), MessageLoop::current()); DCHECK_EQ(page_number_, PageNumber::npos()); MessageLoop::current()->SetNestableTasksAllowed(true); printing_context_.SetUseOverlays(use_overlays); if (ask_user_for_settings) { #if defined(OS_MACOSX) ChromeThread::PostTask( ChromeThread::UI, FROM_HERE, NewRunnableMethod(this, &PrintJobWorker::GetSettingsWithUI, parent_window, document_page_count, has_selection)); #else PrintingContext::Result result = printing_context_.AskUserForSettings( parent_window, document_page_count, has_selection); GetSettingsDone(result); #endif } else { PrintingContext::Result result = printing_context_.UseDefaultSettings(); GetSettingsDone(result); } } ",1 "hook_completion_exec (struct t_weechat_plugin *plugin, const char *completion_item, struct t_gui_buffer *buffer, struct t_gui_completion *completion) { struct t_hook *ptr_hook, *next_hook; /* make C compiler happy */ (void) plugin; hook_exec_start (); ptr_hook = weechat_hooks[HOOK_TYPE_COMPLETION]; while (ptr_hook) { next_hook = ptr_hook->next_hook; if (!ptr_hook->deleted && !ptr_hook->running && (string_strcasecmp (HOOK_COMPLETION(ptr_hook, completion_item), completion_item) == 0)) { ptr_hook->running = 1; (void) (HOOK_COMPLETION(ptr_hook, callback)) (ptr_hook->callback_data, completion_item, buffer, completion); ptr_hook->running = 0; } ptr_hook = next_hook; } hook_exec_end (); } ",0 "static void efx_netpoll(struct net_device *net_dev) { struct efx_nic *efx = netdev_priv(net_dev); struct efx_channel *channel; efx_for_each_channel(channel, efx) efx_schedule_channel(channel); } ",0 "juniper_monitor_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { struct juniper_l2info_t l2info; struct juniper_monitor_header { uint8_t pkt_type; uint8_t padding; uint8_t iif[2]; uint8_t service_id[4]; }; const struct juniper_monitor_header *mh; l2info.pictype = DLT_JUNIPER_MONITOR; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; mh = (const struct juniper_monitor_header *)p; if (ndo->ndo_eflag) ND_PRINT((ndo, ""service-id %u, iif %u, pkt-type %u: "", EXTRACT_32BITS(&mh->service_id), EXTRACT_16BITS(&mh->iif), mh->pkt_type)); /* no proto field - lets guess by first byte of IP header*/ ip_heuristic_guess (ndo, p, l2info.length); return l2info.header_len; } ",1 "gst_pngdec_base_init (gpointer g_class) { GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_pngdec_src_pad_template)); gst_element_class_add_pad_template (element_class, gst_static_pad_template_get (&gst_pngdec_sink_pad_template)); gst_element_class_set_details (element_class, &gst_pngdec_details); } ",0 "BaseShadow::mockTerminateJob( MyString exit_reason, bool exited_by_signal, int exit_code, int exit_signal, bool core_dumped ) { if (exit_reason == """") { exit_reason = ""Exited normally""; } dprintf( D_ALWAYS, ""Mock terminating job %d.%d: "" ""exited_by_signal=%s, exit_code=%d OR exit_signal=%d, "" ""core_dumped=%s, exit_reason=\""%s\""\n"", getCluster(), getProc(), exited_by_signal ? ""TRUE"" : ""FALSE"", exit_code, exit_signal, core_dumped ? ""TRUE"" : ""FALSE"", exit_reason.Value()); if( ! jobAd ) { dprintf(D_ALWAYS, ""BaseShadow::mockTerminateJob(): NULL JobAd! "" ""Holding Job!""); DC_Exit( JOB_SHOULD_HOLD ); } jobAd->Assign( ATTR_JOB_CORE_DUMPED, core_dumped ); jobAd->Assign( ATTR_ON_EXIT_BY_SIGNAL, exited_by_signal ); if (exited_by_signal) { jobAd->Assign( ATTR_ON_EXIT_SIGNAL, exit_signal ); } else { jobAd->Assign( ATTR_ON_EXIT_CODE, exit_code ); } jobAd->Assign( ATTR_EXIT_REASON, exit_reason ); if( !updateJobInQueue(U_TERMINATE) ) { dprintf( D_ALWAYS, ""Failed to update job queue!\n"" ); } } ",0 "static int usb_enumerate_device_otg(struct usb_device *udev) { int err = 0; #ifdef CONFIG_USB_OTG /* * OTG-aware devices on OTG-capable root hubs may be able to use SRP, * to wake us after we've powered off VBUS; and HNP, switching roles * ""host"" to ""peripheral"". The OTG descriptor helps figure this out. */ if (!udev->bus->is_b_host && udev->config && udev->parent == udev->bus->root_hub) { struct usb_otg_descriptor *desc = NULL; struct usb_bus *bus = udev->bus; unsigned port1 = udev->portnum; /* descriptor may appear anywhere in config */ err = __usb_get_extra_descriptor(udev->rawdescriptors[0], le16_to_cpu(udev->config[0].desc.wTotalLength), USB_DT_OTG, (void **) &desc); if (err || !(desc->bmAttributes & USB_OTG_HNP)) return 0; dev_info(&udev->dev, ""Dual-Role OTG device on %sHNP port\n"", (port1 == bus->otg_port) ? """" : ""non-""); /* enable HNP before suspend, it's simpler */ if (port1 == bus->otg_port) { bus->b_hnp_enable = 1; err = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), USB_REQ_SET_FEATURE, 0, USB_DEVICE_B_HNP_ENABLE, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); if (err < 0) { /* * OTG MESSAGE: report errors here, * customize to match your product. */ dev_err(&udev->dev, ""can't set HNP mode: %d\n"", err); bus->b_hnp_enable = 0; } } else if (desc->bLength == sizeof (struct usb_otg_descriptor)) { /* Set a_alt_hnp_support for legacy otg device */ err = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), USB_REQ_SET_FEATURE, 0, USB_DEVICE_A_ALT_HNP_SUPPORT, 0, NULL, 0, USB_CTRL_SET_TIMEOUT); if (err < 0) dev_err(&udev->dev, ""set a_alt_hnp_support failed: %d\n"", err); } } #endif return err; } ",0 "daemon_seraddr(struct sockaddr_storage *sockaddrin, struct rpcap_sockaddr *sockaddrout) { memset(sockaddrout, 0, sizeof(struct sockaddr_storage)); if (sockaddrin == NULL) return; switch (sockaddrin->ss_family) { case AF_INET: { struct sockaddr_in *sockaddrin_ipv4; struct rpcap_sockaddr_in *sockaddrout_ipv4; sockaddrin_ipv4 = (struct sockaddr_in *) sockaddrin; sockaddrout_ipv4 = (struct rpcap_sockaddr_in *) sockaddrout; sockaddrout_ipv4->family = htons(RPCAP_AF_INET); sockaddrout_ipv4->port = htons(sockaddrin_ipv4->sin_port); memcpy(&sockaddrout_ipv4->addr, &sockaddrin_ipv4->sin_addr, sizeof(sockaddrout_ipv4->addr)); memset(sockaddrout_ipv4->zero, 0, sizeof(sockaddrout_ipv4->zero)); break; } #ifdef AF_INET6 case AF_INET6: { struct sockaddr_in6 *sockaddrin_ipv6; struct rpcap_sockaddr_in6 *sockaddrout_ipv6; sockaddrin_ipv6 = (struct sockaddr_in6 *) sockaddrin; sockaddrout_ipv6 = (struct rpcap_sockaddr_in6 *) sockaddrout; sockaddrout_ipv6->family = htons(RPCAP_AF_INET6); sockaddrout_ipv6->port = htons(sockaddrin_ipv6->sin6_port); sockaddrout_ipv6->flowinfo = htonl(sockaddrin_ipv6->sin6_flowinfo); memcpy(&sockaddrout_ipv6->addr, &sockaddrin_ipv6->sin6_addr, sizeof(sockaddrout_ipv6->addr)); sockaddrout_ipv6->scope_id = htonl(sockaddrin_ipv6->sin6_scope_id); break; } #endif } } ",0 "Resource* DocumentLoader::StartPreload(Resource::Type type, FetchParameters& params, CSSPreloaderResourceClient* client) { Resource* resource = nullptr; DCHECK(!client || type == Resource::kCSSStyleSheet); switch (type) { case Resource::kImage: if (frame_) frame_->MaybeAllowImagePlaceholder(params); resource = ImageResource::Fetch(params, Fetcher()); break; case Resource::kScript: resource = ScriptResource::Fetch(params, Fetcher(), nullptr); break; case Resource::kCSSStyleSheet: resource = CSSStyleSheetResource::Fetch(params, Fetcher(), client); break; case Resource::kFont: resource = FontResource::Fetch(params, Fetcher(), nullptr); break; case Resource::kAudio: case Resource::kVideo: resource = RawResource::FetchMedia(params, Fetcher(), nullptr); break; case Resource::kTextTrack: resource = RawResource::FetchTextTrack(params, Fetcher(), nullptr); break; case Resource::kImportResource: resource = RawResource::FetchImport(params, Fetcher(), nullptr); break; case Resource::kRaw: resource = RawResource::Fetch(params, Fetcher(), nullptr); break; default: NOTREACHED(); } return resource; } ",0 "int FlateStream::getCodeWord(int bits) { int c; while (codeSize < bits) { if ((c = str->getChar()) == EOF) return EOF; codeBuf |= (c & 0xff) << codeSize; codeSize += 8; } c = codeBuf & ((1 << bits) - 1); codeBuf >>= bits; codeSize -= bits; return c; } ",0 "static inline int perf_intr_is_nmi(struct pt_regs *regs) { return 0; } ",0 "struct ndp_msg_opt_type_info *ndp_msg_opt_type_info_by_raw_type(uint8_t raw_type) { struct ndp_msg_opt_type_info *info; int i; for (i = 0; i < NDP_MSG_OPT_TYPE_LIST_SIZE; i++) { info = &ndp_msg_opt_type_info_list[i]; if (info->raw_type == raw_type) return info; } return NULL; } ",0 "void HTMLInputElement::defaultEventHandler(Event* evt) { if (evt->isMouseEvent() && evt->type() == eventNames().clickEvent && static_cast(evt)->button() == LeftButton) { m_inputType->handleClickEvent(static_cast(evt)); if (evt->defaultHandled()) return; } if (evt->isTouchEvent()) { m_inputType->handleTouchEvent(static_cast(evt)); if (evt->defaultHandled()) return; } if (evt->isKeyboardEvent() && evt->type() == eventNames().keydownEvent) { m_inputType->handleKeydownEvent(static_cast(evt)); if (evt->defaultHandled()) return; } bool callBaseClassEarly = isTextField() && (evt->type() == eventNames().keydownEvent || evt->type() == eventNames().keypressEvent); if (callBaseClassEarly) { HTMLTextFormControlElement::defaultEventHandler(evt); if (evt->defaultHandled()) return; } if (evt->type() == eventNames().DOMActivateEvent) { m_inputType->handleDOMActivateEvent(evt); if (evt->defaultHandled()) return; } if (evt->isKeyboardEvent() && evt->type() == eventNames().keypressEvent) { m_inputType->handleKeypressEvent(static_cast(evt)); if (evt->defaultHandled()) return; } if (evt->isKeyboardEvent() && evt->type() == eventNames().keyupEvent) { m_inputType->handleKeyupEvent(static_cast(evt)); if (evt->defaultHandled()) return; } if (m_inputType->shouldSubmitImplicitly(evt)) { if (isSearchField()) onSearch(); if (wasChangedSinceLastFormControlChangeEvent()) dispatchFormControlChangeEvent(); RefPtr formForSubmission = m_inputType->formForSubmission(); if (formForSubmission) formForSubmission->submitImplicitly(evt, canTriggerImplicitSubmission()); evt->setDefaultHandled(); return; } if (evt->isBeforeTextInsertedEvent()) m_inputType->handleBeforeTextInsertedEvent(static_cast(evt)); if (evt->isMouseEvent() && evt->type() == eventNames().mousedownEvent) { m_inputType->handleMouseDownEvent(static_cast(evt)); if (evt->defaultHandled()) return; } m_inputType->forwardEvent(evt); if (!callBaseClassEarly && !evt->defaultHandled()) HTMLTextFormControlElement::defaultEventHandler(evt); } ",0 "static void mem_cgroup_cancel_attach(struct cgroup_subsys *ss, struct cgroup *cgroup, struct cgroup_taskset *tset) { } ",0 "static void *__alloc_remap_buffer(struct device *dev, size_t size, gfp_t gfp, pgprot_t prot, struct page **ret_page, const void *caller) { struct page *page; void *ptr; page = __dma_alloc_buffer(dev, size, gfp); if (!page) return NULL; ptr = __dma_alloc_remap(page, size, gfp, prot, caller); if (!ptr) { __dma_free_buffer(page, size); return NULL; } *ret_page = page; return ptr; } ",0 "void OxideQQuickWebViewPrivate::RequestMediaAccessPermission( OxideQMediaAccessPermissionRequest* request) { Q_Q(OxideQQuickWebView); QQmlEngine* engine = qmlEngine(q); if (!engine) { delete request; return; } { QJSValue val = engine->newQObject(request); if (!val.isQObject()) { delete request; return; } emit q->mediaAccessPermissionRequested(val); } engine->collectGarbage(); } ",0 "int virtio_gpu_object_create(struct virtio_gpu_device *vgdev, unsigned long size, bool kernel, bool pinned, struct virtio_gpu_object **bo_ptr) { struct virtio_gpu_object *bo; enum ttm_bo_type type; size_t acc_size; int ret; if (kernel) type = ttm_bo_type_kernel; else type = ttm_bo_type_device; *bo_ptr = NULL; acc_size = ttm_bo_dma_acc_size(&vgdev->mman.bdev, size, sizeof(struct virtio_gpu_object)); bo = kzalloc(sizeof(struct virtio_gpu_object), GFP_KERNEL); if (bo == NULL) return -ENOMEM; size = roundup(size, PAGE_SIZE); ret = drm_gem_object_init(vgdev->ddev, &bo->gem_base, size); if (ret != 0) return ret; bo->dumb = false; virtio_gpu_init_ttm_placement(bo, pinned); ret = ttm_bo_init(&vgdev->mman.bdev, &bo->tbo, size, type, &bo->placement, 0, !kernel, NULL, acc_size, NULL, NULL, &virtio_gpu_ttm_bo_destroy); /* ttm_bo_init failure will call the destroy */ if (ret != 0) return ret; *bo_ptr = bo; return 0; } ",1 "void WebPluginDelegateProxy::DidReceiveManualData(const char* buffer, int length) { DCHECK_GT(length, 0); std::vector data; data.resize(static_cast(length)); memcpy(&data.front(), buffer, length); Send(new PluginMsg_DidReceiveManualData(instance_id_, data)); } ",0 "ikev2_ID_print(netdissect_options *ndo, u_char tpay, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct ikev2_id id; int id_len, idtype_len, i; unsigned int dumpascii, dumphex; const unsigned char *typedata; ND_TCHECK(*ext); UNALIGNED_MEMCPY(&id, ext, sizeof(id)); ikev2_pay_print(ndo, NPSTR(tpay), id.h.critical); id_len = ntohs(id.h.len); ND_PRINT((ndo,"" len=%d"", id_len - 4)); if (2 < ndo->ndo_vflag && 4 < id_len) { ND_PRINT((ndo,"" "")); if (!rawprint(ndo, (const uint8_t *)(ext + 1), id_len - 4)) goto trunc; } idtype_len =id_len - sizeof(struct ikev2_id); dumpascii = 0; dumphex = 0; typedata = (const unsigned char *)(ext)+sizeof(struct ikev2_id); switch(id.type) { case ID_IPV4_ADDR: ND_PRINT((ndo, "" ipv4:"")); dumphex=1; break; case ID_FQDN: ND_PRINT((ndo, "" fqdn:"")); dumpascii=1; break; case ID_RFC822_ADDR: ND_PRINT((ndo, "" rfc822:"")); dumpascii=1; break; case ID_IPV6_ADDR: ND_PRINT((ndo, "" ipv6:"")); dumphex=1; break; case ID_DER_ASN1_DN: ND_PRINT((ndo, "" dn:"")); dumphex=1; break; case ID_DER_ASN1_GN: ND_PRINT((ndo, "" gn:"")); dumphex=1; break; case ID_KEY_ID: ND_PRINT((ndo, "" keyid:"")); dumphex=1; break; } if(dumpascii) { ND_TCHECK2(*typedata, idtype_len); for(i=0; iescan_info.escan_buf; if (bss_list->count != 0 && bss_list->version != BRCMF_BSS_INFO_VERSION) { brcmf_err(""Version %d != WL_BSS_INFO_VERSION\n"", bss_list->version); return -EOPNOTSUPP; } brcmf_dbg(SCAN, ""scanned AP count (%d)\n"", bss_list->count); for (i = 0; i < bss_list->count; i++) { bi = next_bss_le(bss_list, bi); err = brcmf_inform_single_bss(cfg, bi); if (err) break; } return err; } ",0 "kill_orphaned_pgrp(struct task_struct *tsk, struct task_struct *parent) { struct pid *pgrp = task_pgrp(tsk); struct task_struct *ignored_task = tsk; if (!parent) /* exit: our father is in a different pgrp than * we are and we were the only connection outside. */ parent = tsk->real_parent; else /* reparent: our child is in a different pgrp than * we are, and it was the only connection outside. */ ignored_task = NULL; if (task_pgrp(parent) != pgrp && task_session(parent) == task_session(tsk) && will_become_orphaned_pgrp(pgrp, ignored_task) && has_stopped_jobs(pgrp)) { __kill_pgrp_info(SIGHUP, SEND_SIG_PRIV, pgrp); __kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp); } } ",0 "EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows(ExecState* exec) { JSValue thisValue = exec->hostThisValue(); if (!thisValue.inherits(&JSTestObj::s_info)) return throwVMTypeError(exec); JSTestObj* castedThis = jsCast(asObject(thisValue)); ASSERT_GC_OBJECT_INHERITS(castedThis, &JSTestObj::s_info); TestObj* impl = static_cast(castedThis->impl()); if (exec->argumentCount() < 2) return throwVMError(exec, createTypeError(exec, ""Not enough arguments"")); ExceptionCode ec = 0; const String& strArg(ustringToString(MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).isEmpty() ? UString() : MAYBE_MISSING_PARAMETER(exec, 0, DefaultIsUndefined).toString(exec)->value(exec))); if (exec->hadException()) return JSValue::encode(jsUndefined()); TestObj* objArg(toTestObj(MAYBE_MISSING_PARAMETER(exec, 1, DefaultIsUndefined))); if (exec->hadException()) return JSValue::encode(jsUndefined()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec))); setDOMException(exec, ec); return JSValue::encode(result); } ",1 "int ip_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) { struct iphdr *iph; int ptr; struct net_device *dev; struct sk_buff *skb2; unsigned int mtu, hlen, left, len, ll_rs; int offset; __be16 not_last_frag; struct rtable *rt = skb_rtable(skb); int err = 0; dev = rt->dst.dev; /* * Point into the IP datagram header. */ iph = ip_hdr(skb); if (unlikely(((iph->frag_off & htons(IP_DF)) && !skb->local_df) || (IPCB(skb)->frag_max_size && IPCB(skb)->frag_max_size > dst_mtu(&rt->dst)))) { IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); icmp_send(skb, ICMP_DEST_UNREACH, ICMP_FRAG_NEEDED, htonl(ip_skb_dst_mtu(skb))); kfree_skb(skb); return -EMSGSIZE; } /* * Setup starting values. */ hlen = iph->ihl * 4; mtu = dst_mtu(&rt->dst) - hlen; /* Size of data space */ #ifdef CONFIG_BRIDGE_NETFILTER if (skb->nf_bridge) mtu -= nf_bridge_mtu_reduction(skb); #endif IPCB(skb)->flags |= IPSKB_FRAG_COMPLETE; /* When frag_list is given, use it. First, check its validity: * some transformers could create wrong frag_list or break existing * one, it is not prohibited. In this case fall back to copying. * * LATER: this step can be merged to real generation of fragments, * we can switch to copy when see the first bad fragment. */ if (skb_has_frag_list(skb)) { struct sk_buff *frag, *frag2; int first_len = skb_pagelen(skb); if (first_len - hlen > mtu || ((first_len - hlen) & 7) || ip_is_fragment(iph) || skb_cloned(skb)) goto slow_path; skb_walk_frags(skb, frag) { /* Correct geometry. */ if (frag->len > mtu || ((frag->len & 7) && frag->next) || skb_headroom(frag) < hlen) goto slow_path_clean; /* Partially cloned skb? */ if (skb_shared(frag)) goto slow_path_clean; BUG_ON(frag->sk); if (skb->sk) { frag->sk = skb->sk; frag->destructor = sock_wfree; } skb->truesize -= frag->truesize; } /* Everything is OK. Generate! */ err = 0; offset = 0; frag = skb_shinfo(skb)->frag_list; skb_frag_list_init(skb); skb->data_len = first_len - skb_headlen(skb); skb->len = first_len; iph->tot_len = htons(first_len); iph->frag_off = htons(IP_MF); ip_send_check(iph); for (;;) { /* Prepare header of the next frame, * before previous one went down. */ if (frag) { frag->ip_summed = CHECKSUM_NONE; skb_reset_transport_header(frag); __skb_push(frag, hlen); skb_reset_network_header(frag); memcpy(skb_network_header(frag), iph, hlen); iph = ip_hdr(frag); iph->tot_len = htons(frag->len); ip_copy_metadata(frag, skb); if (offset == 0) ip_options_fragment(frag); offset += skb->len - hlen; iph->frag_off = htons(offset>>3); if (frag->next != NULL) iph->frag_off |= htons(IP_MF); /* Ready, complete checksum */ ip_send_check(iph); } err = output(skb); if (!err) IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES); if (err || !frag) break; skb = frag; frag = skb->next; skb->next = NULL; } if (err == 0) { IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS); return 0; } while (frag) { skb = frag->next; kfree_skb(frag); frag = skb; } IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); return err; slow_path_clean: skb_walk_frags(skb, frag2) { if (frag2 == frag) break; frag2->sk = NULL; frag2->destructor = NULL; skb->truesize += frag2->truesize; } } slow_path: /* for offloaded checksums cleanup checksum before fragmentation */ if ((skb->ip_summed == CHECKSUM_PARTIAL) && skb_checksum_help(skb)) goto fail; iph = ip_hdr(skb); left = skb->len - hlen; /* Space per frame */ ptr = hlen; /* Where to start from */ /* for bridged IP traffic encapsulated inside f.e. a vlan header, * we need to make room for the encapsulating header */ ll_rs = LL_RESERVED_SPACE_EXTRA(rt->dst.dev, nf_bridge_pad(skb)); /* * Fragment the datagram. */ offset = (ntohs(iph->frag_off) & IP_OFFSET) << 3; not_last_frag = iph->frag_off & htons(IP_MF); /* * Keep copying data until we run out. */ while (left > 0) { len = left; /* IF: it doesn't fit, use 'mtu' - the data space left */ if (len > mtu) len = mtu; /* IF: we are not sending up to and including the packet end then align the next start on an eight byte boundary */ if (len < left) { len &= ~7; } /* * Allocate buffer. */ if ((skb2 = alloc_skb(len+hlen+ll_rs, GFP_ATOMIC)) == NULL) { NETDEBUG(KERN_INFO ""IP: frag: no memory for new fragment!\n""); err = -ENOMEM; goto fail; } /* * Set up data on packet */ ip_copy_metadata(skb2, skb); skb_reserve(skb2, ll_rs); skb_put(skb2, len + hlen); skb_reset_network_header(skb2); skb2->transport_header = skb2->network_header + hlen; /* * Charge the memory for the fragment to any owner * it might possess */ if (skb->sk) skb_set_owner_w(skb2, skb->sk); /* * Copy the packet header into the new buffer. */ skb_copy_from_linear_data(skb, skb_network_header(skb2), hlen); /* * Copy a block of the IP datagram. */ if (skb_copy_bits(skb, ptr, skb_transport_header(skb2), len)) BUG(); left -= len; /* * Fill in the new header fields. */ iph = ip_hdr(skb2); iph->frag_off = htons((offset >> 3)); /* ANK: dirty, but effective trick. Upgrade options only if * the segment to be fragmented was THE FIRST (otherwise, * options are already fixed) and make it ONCE * on the initial skb, so that all the following fragments * will inherit fixed options. */ if (offset == 0) ip_options_fragment(skb); /* * Added AC : If we are fragmenting a fragment that's not the * last fragment then keep MF on each bit */ if (left > 0 || not_last_frag) iph->frag_off |= htons(IP_MF); ptr += len; offset += len; /* * Put this fragment into the sending queue. */ iph->tot_len = htons(len + hlen); ip_send_check(iph); err = output(skb2); if (err) goto fail; IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGCREATES); } consume_skb(skb); IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGOKS); return err; fail: kfree_skb(skb); IP_INC_STATS(dev_net(dev), IPSTATS_MIB_FRAGFAILS); return err; } ",0 "DownloadInterruptReason ResourceDispatcherHostImpl::BeginDownload( scoped_ptr request, const Referrer& referrer, bool is_content_initiated, ResourceContext* context, int child_id, int render_view_route_id, int render_frame_route_id, bool prefer_cache, bool do_not_prompt_for_login, scoped_ptr save_info, uint32_t download_id, const DownloadStartedCallback& started_callback) { if (is_shutdown_) return CallbackAndReturn(started_callback, DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN); const GURL& url = request->original_url(); char url_buf[128]; base::strlcpy(url_buf, url.spec().c_str(), arraysize(url_buf)); base::debug::Alias(url_buf); CHECK(ContainsKey(active_resource_contexts_, context)); SetReferrerForRequest(request.get(), referrer); int extra_load_flags = net::LOAD_NORMAL; if (prefer_cache) { if (request->get_upload() != NULL) extra_load_flags |= net::LOAD_ONLY_FROM_CACHE; else extra_load_flags |= net::LOAD_PREFERRING_CACHE; } else { extra_load_flags |= net::LOAD_DISABLE_CACHE; } request->SetLoadFlags(request->load_flags() | extra_load_flags); request->set_first_party_url_policy( net::URLRequest::UPDATE_FIRST_PARTY_URL_ON_REDIRECT); if (!ChildProcessSecurityPolicyImpl::GetInstance()-> CanRequestURL(child_id, url)) { VLOG(1) << ""Denied unauthorized download request for "" << url.possibly_invalid_spec(); return CallbackAndReturn(started_callback, DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST); } request_id_--; const net::URLRequestContext* request_context = context->GetRequestContext(); if (!request_context->job_factory()->IsHandledURL(url)) { VLOG(1) << ""Download request for unsupported protocol: "" << url.possibly_invalid_spec(); return CallbackAndReturn(started_callback, DOWNLOAD_INTERRUPT_REASON_NETWORK_INVALID_REQUEST); } ResourceRequestInfoImpl* extra_info = CreateRequestInfo(child_id, render_view_route_id, render_frame_route_id, true, context); extra_info->set_do_not_prompt_for_login(do_not_prompt_for_login); extra_info->AssociateWithRequest(request.get()); // Request takes ownership. if (request->url().SchemeIs(url::kBlobScheme)) { ChromeBlobStorageContext* blob_context = GetChromeBlobStorageContextForResourceContext(context); storage::BlobProtocolHandler::SetRequestedBlobDataHandle( request.get(), blob_context->context()->GetBlobDataFromPublicURL(request->url())); } scoped_ptr handler(CreateResourceHandlerForDownload( request.get(), is_content_initiated, true, download_id, std::move(save_info), started_callback)); BeginRequestInternal(std::move(request), std::move(handler)); return DOWNLOAD_INTERRUPT_REASON_NONE; } ",0 "static void sched_free_group_rcu(struct rcu_head *rhp) { /* now it should be safe to free those cfs_rqs */ sched_free_group(container_of(rhp, struct task_group, rcu)); } ",0 " IsMacResource( FT_Library library, FT_Stream stream, FT_Long resource_offset, FT_Long face_index, FT_Face *aface ) { FT_Memory memory = library->memory; FT_Error error; FT_Long map_offset, rdara_pos; FT_Long *data_offsets; FT_Long count; error = FT_Raccess_Get_HeaderInfo( library, stream, resource_offset, &map_offset, &rdara_pos ); if ( error ) return error; error = FT_Raccess_Get_DataOffsets( library, stream, map_offset, rdara_pos, TTAG_POST, &data_offsets, &count ); if ( !error ) { error = Mac_Read_POST_Resource( library, stream, data_offsets, count, face_index, aface ); FT_FREE( data_offsets ); /* POST exists in an LWFN providing a single face */ if ( !error ) (*aface)->num_faces = 1; return error; } error = FT_Raccess_Get_DataOffsets( library, stream, map_offset, rdara_pos, TTAG_sfnt, &data_offsets, &count ); if ( !error ) { FT_Long face_index_internal = face_index % count; error = Mac_Read_sfnt_Resource( library, stream, data_offsets, count, face_index_internal, aface ); FT_FREE( data_offsets ); if ( !error ) (*aface)->num_faces = count; } return error; } ",0 "static int rtmp_packet_read_one_chunk(URLContext *h, RTMPPacket *p, int chunk_size, RTMPPacket **prev_pkt_ptr, int *nb_prev_pkt, uint8_t hdr) { uint8_t buf[16]; int channel_id, timestamp, size; uint32_t ts_field; // non-extended timestamp or delta field uint32_t extra = 0; enum RTMPPacketType type; int written = 0; int ret, toread; RTMPPacket *prev_pkt; written++; channel_id = hdr & 0x3F; if (channel_id < 2) { //special case for channel number >= 64 buf[1] = 0; if (ffurl_read_complete(h, buf, channel_id + 1) != channel_id + 1) return AVERROR(EIO); written += channel_id + 1; channel_id = AV_RL16(buf) + 64; } if ((ret = ff_rtmp_check_alloc_array(prev_pkt_ptr, nb_prev_pkt, channel_id)) < 0) return ret; prev_pkt = *prev_pkt_ptr; size = prev_pkt[channel_id].size; type = prev_pkt[channel_id].type; extra = prev_pkt[channel_id].extra; hdr >>= 6; // header size indicator if (hdr == RTMP_PS_ONEBYTE) { ts_field = prev_pkt[channel_id].ts_field; } else { if (ffurl_read_complete(h, buf, 3) != 3) return AVERROR(EIO); written += 3; ts_field = AV_RB24(buf); if (hdr != RTMP_PS_FOURBYTES) { if (ffurl_read_complete(h, buf, 3) != 3) return AVERROR(EIO); written += 3; size = AV_RB24(buf); if (ffurl_read_complete(h, buf, 1) != 1) return AVERROR(EIO); written++; type = buf[0]; if (hdr == RTMP_PS_TWELVEBYTES) { if (ffurl_read_complete(h, buf, 4) != 4) return AVERROR(EIO); written += 4; extra = AV_RL32(buf); } } } if (ts_field == 0xFFFFFF) { if (ffurl_read_complete(h, buf, 4) != 4) return AVERROR(EIO); timestamp = AV_RB32(buf); } else { timestamp = ts_field; } if (hdr != RTMP_PS_TWELVEBYTES) timestamp += prev_pkt[channel_id].timestamp; if (!prev_pkt[channel_id].read) { if ((ret = ff_rtmp_packet_create(p, channel_id, type, timestamp, size)) < 0) return ret; p->read = written; p->offset = 0; prev_pkt[channel_id].ts_field = ts_field; prev_pkt[channel_id].timestamp = timestamp; } else { RTMPPacket *prev = &prev_pkt[channel_id]; p->data = prev->data; p->size = prev->size; p->channel_id = prev->channel_id; p->type = prev->type; p->ts_field = prev->ts_field; p->extra = prev->extra; p->offset = prev->offset; p->read = prev->read + written; p->timestamp = prev->timestamp; prev->data = NULL; } p->extra = extra; prev_pkt[channel_id].channel_id = channel_id; prev_pkt[channel_id].type = type; prev_pkt[channel_id].size = size; prev_pkt[channel_id].extra = extra; size = size - p->offset; toread = FFMIN(size, chunk_size); if (ffurl_read_complete(h, p->data + p->offset, toread) != toread) { ff_rtmp_packet_destroy(p); return AVERROR(EIO); } size -= toread; p->read += toread; p->offset += toread; if (size > 0) { RTMPPacket *prev = &prev_pkt[channel_id]; prev->data = p->data; prev->read = p->read; prev->offset = p->offset; p->data = NULL; return AVERROR(EAGAIN); } prev_pkt[channel_id].read = 0; // read complete; reset if needed return p->read; } ",1 "pmcraid_release_control_blocks( struct pmcraid_instance *pinstance, int max_index ) { int i; if (pinstance->control_pool == NULL) return; for (i = 0; i < max_index; i++) { pci_pool_free(pinstance->control_pool, pinstance->cmd_list[i]->ioa_cb, pinstance->cmd_list[i]->ioa_cb_bus_addr); pinstance->cmd_list[i]->ioa_cb = NULL; pinstance->cmd_list[i]->ioa_cb_bus_addr = 0; } pci_pool_destroy(pinstance->control_pool); pinstance->control_pool = NULL; } ",0 "void address_space_stl(AddressSpace *as, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) { address_space_stl_internal(as, addr, val, attrs, result, DEVICE_NATIVE_ENDIAN); } ",0 "void WebContentsImpl::DidProceedOnInterstitial() { DCHECK(!(ShowingInterstitialPage() && GetRenderManager()->interstitial_page()->pause_throbber())); if (ShowingInterstitialPage() && frame_tree_.IsLoading()) LoadingStateChanged(true, true, nullptr); } ",0 "static jpc_bitstream_t *jpc_bitstream_alloc() { jpc_bitstream_t *bitstream; /* Allocate memory for the new bit stream object. */ if (!(bitstream = jas_malloc(sizeof(jpc_bitstream_t)))) { return 0; } /* Initialize all of the data members. */ bitstream->stream_ = 0; bitstream->cnt_ = 0; bitstream->flags_ = 0; bitstream->openmode_ = 0; return bitstream; } ",0 "static int pf_start(struct pf_unit *pf, int cmd, int b, int c) { int i; char io_cmd[12] = { cmd, pf->lun << 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; for (i = 0; i < 4; i++) { io_cmd[5 - i] = b & 0xff; b = b >> 8; } io_cmd[8] = c & 0xff; io_cmd[7] = (c >> 8) & 0xff; i = pf_command(pf, io_cmd, c * 512, ""start i/o""); mdelay(1); return i; } ",0 "void FrameLoader::startCheckCompleteTimer() { if (!m_shouldCallCheckCompleted) return; if (m_checkTimer.isActive()) return; m_checkTimer.startOneShot(0); } ",0 "set_directory_record(unsigned char *p, size_t n, struct isoent *isoent, struct iso9660 *iso9660, enum dir_rec_type t, enum vdd_type vdd_type) { unsigned char *bp; size_t dr_len; size_t fi_len; if (p != NULL) { /* * Check whether a write buffer size is less than the * saved size which is needed to write this Directory * Record. */ switch (t) { case DIR_REC_VD: dr_len = isoent->dr_len.vd; break; case DIR_REC_SELF: dr_len = isoent->dr_len.self; break; case DIR_REC_PARENT: dr_len = isoent->dr_len.parent; break; case DIR_REC_NORMAL: default: dr_len = isoent->dr_len.normal; break; } if (dr_len > n) return (0);/* Needs more buffer size. */ } if (t == DIR_REC_NORMAL && isoent->identifier != NULL) fi_len = isoent->id_len; else fi_len = 1; if (p != NULL) { struct isoent *xisoent; struct isofile *file; unsigned char flag; if (t == DIR_REC_PARENT) xisoent = isoent->parent; else xisoent = isoent; file = isoent->file; if (file->hardlink_target != NULL) file = file->hardlink_target; /* Make a file flag. */ if (xisoent->dir) flag = FILE_FLAG_DIRECTORY; else { if (file->cur_content->next != NULL) flag = FILE_FLAG_MULTI_EXTENT; else flag = 0; } bp = p -1; /* Extended Attribute Record Length */ set_num_711(bp+2, 0); /* Location of Extent */ if (xisoent->dir) set_num_733(bp+3, xisoent->dir_location); else set_num_733(bp+3, file->cur_content->location); /* Data Length */ if (xisoent->dir) set_num_733(bp+11, xisoent->dir_block * LOGICAL_BLOCK_SIZE); else set_num_733(bp+11, (uint32_t)file->cur_content->size); /* Recording Date and Time */ /* NOTE: * If a file type is symbolic link, you are seeing this * field value is different from a value mkisofs makes. * libarchive uses lstat to get this one, but it * seems mkisofs uses stat to get. */ set_time_915(bp+19, archive_entry_mtime(xisoent->file->entry)); /* File Flags */ bp[26] = flag; /* File Unit Size */ set_num_711(bp+27, 0); /* Interleave Gap Size */ set_num_711(bp+28, 0); /* Volume Sequence Number */ set_num_723(bp+29, iso9660->volume_sequence_number); /* Length of File Identifier */ set_num_711(bp+33, (unsigned char)fi_len); /* File Identifier */ switch (t) { case DIR_REC_VD: case DIR_REC_SELF: set_num_711(bp+34, 0); break; case DIR_REC_PARENT: set_num_711(bp+34, 1); break; case DIR_REC_NORMAL: if (isoent->identifier != NULL) memcpy(bp+34, isoent->identifier, fi_len); else set_num_711(bp+34, 0); break; } } else bp = NULL; dr_len = 33 + fi_len; /* Padding Field */ if (dr_len & 0x01) { dr_len ++; if (p != NULL) bp[dr_len] = 0; } /* Volume Descriptor does not record extension. */ if (t == DIR_REC_VD) { if (p != NULL) /* Length of Directory Record */ set_num_711(p, (unsigned char)dr_len); else isoent->dr_len.vd = (int)dr_len; return ((int)dr_len); } /* Rockridge */ if (iso9660->opt.rr && vdd_type != VDD_JOLIET) dr_len = set_directory_record_rr(bp, (int)dr_len, isoent, iso9660, t); if (p != NULL) /* Length of Directory Record */ set_num_711(p, (unsigned char)dr_len); else { /* * Save the size which is needed to write this * Directory Record. */ switch (t) { case DIR_REC_VD: /* This case does not come, but compiler * complains that DIR_REC_VD not handled * in switch .... */ break; case DIR_REC_SELF: isoent->dr_len.self = (int)dr_len; break; case DIR_REC_PARENT: isoent->dr_len.parent = (int)dr_len; break; case DIR_REC_NORMAL: isoent->dr_len.normal = (int)dr_len; break; } } return ((int)dr_len); } ",0 "static void php_putenv_destructor(putenv_entry *pe) /* {{{ */ { if (pe->previous_value) { #if _MSC_VER >= 1300 /* VS.Net has a bug in putenv() when setting a variable that * is already set; if the SetEnvironmentVariable() API call * fails, the Crt will double free() a string. * We try to avoid this by setting our own value first */ SetEnvironmentVariable(pe->key, ""bugbug""); #endif putenv(pe->previous_value); # if defined(PHP_WIN32) efree(pe->previous_value); # endif } else { # if HAVE_UNSETENV unsetenv(pe->key); # elif defined(PHP_WIN32) SetEnvironmentVariable(pe->key, NULL); # else char **env; for (env = environ; env != NULL && *env != NULL; env++) { if (!strncmp(*env, pe->key, pe->key_len) && (*env)[pe->key_len] == '=') { /* found it */ *env = """"; break; } } # endif } #ifdef HAVE_TZSET /* don't forget to reset the various libc globals that * we might have changed by an earlier call to tzset(). */ if (!strncmp(pe->key, ""TZ"", pe->key_len)) { tzset(); } #endif efree(pe->putenv_string); efree(pe->key); } /* }}} */ ",0 "static int fsmBackup(rpmfi fi, rpmFileAction action) { int rc = 0; const char *suffix = NULL; if (!(rpmfiFFlags(fi) & RPMFILE_GHOST)) { switch (action) { case FA_SAVE: suffix = SUFFIX_RPMSAVE; break; case FA_BACKUP: suffix = SUFFIX_RPMORIG; break; default: break; } } if (suffix) { char * opath = fsmFsPath(fi, NULL); char * path = fsmFsPath(fi, suffix); rc = fsmRename(opath, path); if (!rc) { rpmlog(RPMLOG_WARNING, _(""%s saved as %s\n""), opath, path); } free(path); free(opath); } return rc; } ",0 "static int init_thread_copy(AVCodecContext *avctx) { FFV1Context *f = avctx->priv_data; f->picture.f = NULL; f->last_picture.f = NULL; f->sample_buffer = NULL; f->quant_table_count = 0; f->slice_count = 0; return 0; } ",0 "dealloc_ofp_port(struct ofproto *ofproto, ofp_port_t ofp_port) { if (ofp_to_u16(ofp_port) < ofproto->max_ports) { ofport_set_usage(ofproto, ofp_port, time_msec()); } } ",0 "static bt_status_t set_volume(uint8_t volume) { BTIF_TRACE_DEBUG(""%s"", __FUNCTION__); CHECK_RC_CONNECTED tAVRC_STS status = BT_STATUS_UNSUPPORTED; rc_transaction_t *p_transaction=NULL; if(btif_rc_cb.rc_volume==volume) { status=BT_STATUS_DONE; BTIF_TRACE_ERROR(""%s: volume value already set earlier: 0x%02x"",__FUNCTION__, volume); return status; } if ((btif_rc_cb.rc_features & BTA_AV_FEAT_RCTG) && (btif_rc_cb.rc_features & BTA_AV_FEAT_ADV_CTRL)) { tAVRC_COMMAND avrc_cmd = {0}; BT_HDR *p_msg = NULL; BTIF_TRACE_DEBUG(""%s: Peer supports absolute volume. newVolume=%d"", __FUNCTION__, volume); avrc_cmd.volume.opcode = AVRC_OP_VENDOR; avrc_cmd.volume.pdu = AVRC_PDU_SET_ABSOLUTE_VOLUME; avrc_cmd.volume.status = AVRC_STS_NO_ERROR; avrc_cmd.volume.volume = volume; if (AVRC_BldCommand(&avrc_cmd, &p_msg) == AVRC_STS_NO_ERROR) { bt_status_t tran_status=get_transaction(&p_transaction); if(BT_STATUS_SUCCESS == tran_status && NULL!=p_transaction) { BTIF_TRACE_DEBUG(""%s msgreq being sent out with label %d"", __FUNCTION__,p_transaction->lbl); BTA_AvMetaCmd(btif_rc_cb.rc_handle,p_transaction->lbl, AVRC_CMD_CTRL, p_msg); status = BT_STATUS_SUCCESS; } else { if(NULL!=p_msg) GKI_freebuf(p_msg); BTIF_TRACE_ERROR(""%s: failed to obtain transaction details. status: 0x%02x"", __FUNCTION__, tran_status); status = BT_STATUS_FAIL; } } else { BTIF_TRACE_ERROR(""%s: failed to build absolute volume command. status: 0x%02x"", __FUNCTION__, status); status = BT_STATUS_FAIL; } } else status=BT_STATUS_NOT_READY; return status; } ",0 "void BrowserRenderProcessHost::WidgetHidden() { if (backgrounded_) return; DCHECK_EQ(backgrounded_, (visible_widgets_ == 0)); visible_widgets_--; DCHECK_GE(visible_widgets_, 0); if (visible_widgets_ == 0) { DCHECK(!backgrounded_); SetBackgrounded(true); } } ",0 "void BrowserViewRenderer::EnableOnNewPicture(bool enabled) { on_new_picture_enable_ = enabled; } ",0 "static inline int object_common2(UNSERIALIZE_PARAMETER, zend_long elements) { zval retval; zval fname; HashTable *ht; zend_bool has_wakeup; if (Z_TYPE_P(rval) != IS_OBJECT) { return 0; } has_wakeup = Z_OBJCE_P(rval) != PHP_IC_ENTRY && zend_hash_str_exists(&Z_OBJCE_P(rval)->function_table, ""__wakeup"", sizeof(""__wakeup"")-1); ht = Z_OBJPROP_P(rval); zend_hash_extend(ht, zend_hash_num_elements(ht) + elements, (ht->u.flags & HASH_FLAG_PACKED)); if (!process_nested_data(UNSERIALIZE_PASSTHRU, ht, elements, 1)) { if (has_wakeup) { ZVAL_DEREF(rval); GC_FLAGS(Z_OBJ_P(rval)) |= IS_OBJ_DESTRUCTOR_CALLED; } return 0; } ZVAL_DEREF(rval); if (has_wakeup) { ZVAL_STRINGL(&fname, ""__wakeup"", sizeof(""__wakeup"") - 1); BG(serialize_lock)++; if (call_user_function_ex(CG(function_table), rval, &fname, &retval, 0, 0, 1, NULL) == FAILURE || Z_ISUNDEF(retval)) { GC_FLAGS(Z_OBJ_P(rval)) |= IS_OBJ_DESTRUCTOR_CALLED; } BG(serialize_lock)--; zval_dtor(&fname); zval_dtor(&retval); } if (EG(exception)) { return 0; } return finish_nested_data(UNSERIALIZE_PASSTHRU); } ",0 "static int decode_cblk(Jpeg2000DecoderContext *s, Jpeg2000CodingStyle *codsty, Jpeg2000T1Context *t1, Jpeg2000Cblk *cblk, int width, int height, int bandpos) { int passno = cblk->npasses, pass_t = 2, bpno = cblk->nonzerobits - 1, y; int clnpass_cnt = 0; int bpass_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_BYPASS; int vert_causal_ctx_csty_symbol = codsty->cblk_style & JPEG2000_CBLK_VSC; for (y = 0; y < height; y++) memset(t1->data[y], 0, width * sizeof(**t1->data)); /* If code-block contains no compressed data: nothing to do. */ if (!cblk->length) return 0; for (y = 0; y < height + 2; y++) memset(t1->flags[y], 0, (width + 2) * sizeof(**t1->flags)); cblk->data[cblk->length] = 0xff; cblk->data[cblk->length+1] = 0xff; ff_mqc_initdec(&t1->mqc, cblk->data); while (passno--) { switch(pass_t) { case 0: decode_sigpass(t1, width, height, bpno + 1, bandpos, bpass_csty_symbol && (clnpass_cnt >= 4), vert_causal_ctx_csty_symbol); break; case 1: decode_refpass(t1, width, height, bpno + 1); if (bpass_csty_symbol && clnpass_cnt >= 4) ff_mqc_initdec(&t1->mqc, cblk->data); break; case 2: decode_clnpass(s, t1, width, height, bpno + 1, bandpos, codsty->cblk_style & JPEG2000_CBLK_SEGSYM, vert_causal_ctx_csty_symbol); clnpass_cnt = clnpass_cnt + 1; if (bpass_csty_symbol && clnpass_cnt >= 4) ff_mqc_initdec(&t1->mqc, cblk->data); break; } pass_t++; if (pass_t == 3) { bpno--; pass_t = 0; } } return 0; } ",1 "void nfs_fattr_map_and_free_names(struct nfs_server *server, struct nfs_fattr *fattr) { if (nfs_fattr_map_owner_name(server, fattr)) nfs_fattr_free_owner_name(fattr); if (nfs_fattr_map_group_name(server, fattr)) nfs_fattr_free_group_name(fattr); } ",0 "SmartScheduleInit (void) { struct sigaction act; if (SmartScheduleDisable) return; memset((char *) &act, 0, sizeof(struct sigaction)); /* Set up the timer signal function */ act.sa_handler = SmartScheduleTimer; sigemptyset (&act.sa_mask); sigaddset (&act.sa_mask, SIGALRM); if (sigaction (SIGALRM, &act, 0) < 0) { perror (""sigaction for smart scheduler""); SmartScheduleDisable = TRUE; } } ",0 "bool TabStrip::IsPositionInWindowCaption(const gfx::Point& point) { return IsRectInWindowCaption(gfx::Rect(point, gfx::Size(1, 1))); } ",0 "String Editor::SelectionStartCSSPropertyValue(CSSPropertyID property_id) { EditingStyle* selection_style = EditingStyleUtilities::CreateStyleAtSelectionStart( GetFrame().Selection().ComputeVisibleSelectionInDOMTreeDeprecated(), property_id == CSSPropertyBackgroundColor); if (!selection_style || !selection_style->Style()) return String(); if (property_id == CSSPropertyFontSize) return String::Number( selection_style->LegacyFontSize(GetFrame().GetDocument())); return selection_style->Style()->GetPropertyValue(property_id); } ",0 "static void macvlan_change_rx_flags(struct net_device *dev, int change) { struct macvlan_dev *vlan = netdev_priv(dev); struct net_device *lowerdev = vlan->lowerdev; if (change & IFF_ALLMULTI) dev_set_allmulti(lowerdev, dev->flags & IFF_ALLMULTI ? 1 : -1); } ",0 " parse_design_coords( char *s ) { for ( requested_cnt = 0; requested_cnt < T1_MAX_MM_AXIS && *s; requested_cnt++ ) { requested_pos[requested_cnt] = (FT_Fixed)( strtod( s, &s ) * 65536.0 ); while ( *s==' ' ) ++s; } } ",0 "static JSValueRef zoomPageOutCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { notImplemented(); return JSValueMakeUndefined(context); } ",0 "void V8TestObject::PerWorldBindingsVoidMethodTestInterfaceEmptyArgMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_perWorldBindingsVoidMethodTestInterfaceEmptyArg""); test_object_v8_internal::PerWorldBindingsVoidMethodTestInterfaceEmptyArgMethod(info); } ",0 "PHP_METHOD(Phar, delMetadata) { char *error; PHAR_ARCHIVE_OBJECT(); if (PHAR_G(readonly) && !phar_obj->arc.archive->is_data) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, ""Write operations disabled by the php.ini setting phar.readonly""); return; } if (phar_obj->arc.archive->metadata) { zval_ptr_dtor(&phar_obj->arc.archive->metadata); phar_obj->arc.archive->metadata = NULL; phar_obj->arc.archive->is_modified = 1; phar_flush(phar_obj->arc.archive, 0, 0, 0, &error TSRMLS_CC); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, ""%s"", error); efree(error); RETURN_FALSE; } else { RETURN_TRUE; } } else { RETURN_TRUE; } } ",0 "static bool packet_use_direct_xmit(const struct packet_sock *po) { return po->xmit == packet_direct_xmit; } ",0 "void SyncManager::SyncInternal::StoreState( const std::string& state) { syncable::ScopedDirLookup lookup(dir_manager(), username_for_share()); if (!lookup.good()) { LOG(ERROR) << ""Could not write notification state""; return; } if (VLOG_IS_ON(1)) { std::string encoded_state; base::Base64Encode(state, &encoded_state); DVLOG(1) << ""Writing notification state: "" << encoded_state; } lookup->SetNotificationState(state); lookup->SaveChanges(); } ",0 "static void computeYMD_HMS(DateTime *p){ computeYMD(p); computeHMS(p); } ",0 "skia::RefPtr PictureLayer::GetPicture() const { if (!DrawsContent()) return skia::RefPtr(); int width = bounds().width(); int height = bounds().height(); SkPictureRecorder recorder; SkCanvas* canvas = recorder.beginRecording(width, height, nullptr, 0); client_->PaintContents(canvas, gfx::Rect(width, height), ContentLayerClient::GRAPHICS_CONTEXT_ENABLED); skia::RefPtr picture = skia::AdoptRef(recorder.endRecording()); return picture; } ",0 "static int serdes_init_s1g(struct regmap *regmap, u8 serdes) { int ret; ret = serdes_update_mcb_s1g(regmap, serdes); if (ret) return ret; regmap_update_bits(regmap, HSIO_S1G_COMMON_CFG, HSIO_S1G_COMMON_CFG_SYS_RST | HSIO_S1G_COMMON_CFG_ENA_LANE | HSIO_S1G_COMMON_CFG_ENA_ELOOP | HSIO_S1G_COMMON_CFG_ENA_FLOOP, HSIO_S1G_COMMON_CFG_ENA_LANE); regmap_update_bits(regmap, HSIO_S1G_PLL_CFG, HSIO_S1G_PLL_CFG_PLL_FSM_ENA | HSIO_S1G_PLL_CFG_PLL_FSM_CTRL_DATA_M, HSIO_S1G_PLL_CFG_PLL_FSM_CTRL_DATA(200) | HSIO_S1G_PLL_CFG_PLL_FSM_ENA); regmap_update_bits(regmap, HSIO_S1G_MISC_CFG, HSIO_S1G_MISC_CFG_DES_100FX_CPMD_ENA | HSIO_S1G_MISC_CFG_LANE_RST, HSIO_S1G_MISC_CFG_LANE_RST); ret = serdes_commit_mcb_s1g(regmap, serdes); if (ret) return ret; regmap_update_bits(regmap, HSIO_S1G_COMMON_CFG, HSIO_S1G_COMMON_CFG_SYS_RST, HSIO_S1G_COMMON_CFG_SYS_RST); regmap_update_bits(regmap, HSIO_S1G_MISC_CFG, HSIO_S1G_MISC_CFG_LANE_RST, 0); ret = serdes_commit_mcb_s1g(regmap, serdes); if (ret) return ret; return 0; } ",0 "send_handle(u_int32_t id, int handle) { u_char *string; int hlen; handle_to_string(handle, &string, &hlen); debug(""request %u: sent handle handle %d"", id, handle); send_data_or_handle(SSH2_FXP_HANDLE, id, string, hlen); free(string); } ",0 "static MagickBooleanType SetMSLAttributes(MSLInfo *msl_info,const char *keyword, const char *value) { Image *attributes; DrawInfo *draw_info; ExceptionInfo *exception; GeometryInfo geometry_info; Image *image; ImageInfo *image_info; int flags; ssize_t n; assert(msl_info != (MSLInfo *) NULL); if (keyword == (const char *) NULL) return(MagickTrue); if (value == (const char *) NULL) return(MagickTrue); exception=msl_info->exception; n=msl_info->n; attributes=msl_info->attributes[n]; image_info=msl_info->image_info[n]; draw_info=msl_info->draw_info[n]; image=msl_info->image[n]; switch (*keyword) { case 'A': case 'a': { if (LocaleCompare(keyword,""adjoin"") == 0) { ssize_t adjoin; adjoin=ParseCommandOption(MagickBooleanOptions,MagickFalse,value); if (adjoin < 0) ThrowMSLException(OptionError,""UnrecognizedType"",value); image_info->adjoin=(MagickBooleanType) adjoin; break; } if (LocaleCompare(keyword,""alpha"") == 0) { ssize_t alpha; alpha=ParseCommandOption(MagickAlphaOptions,MagickFalse,value); if (alpha < 0) ThrowMSLException(OptionError,""UnrecognizedType"",value); if (image != (Image *) NULL) (void) SetImageAlphaChannel(image,(AlphaChannelType) alpha); break; } if (LocaleCompare(keyword,""antialias"") == 0) { ssize_t antialias; antialias=ParseCommandOption(MagickBooleanOptions,MagickFalse,value); if (antialias < 0) ThrowMSLException(OptionError,""UnrecognizedGravityType"",value); image_info->antialias=(MagickBooleanType) antialias; break; } if (LocaleCompare(keyword,""area-limit"") == 0) { MagickSizeType limit; limit=MagickResourceInfinity; if (LocaleCompare(value,""unlimited"") != 0) limit=(MagickSizeType) StringToDoubleInterval(value,100.0); (void) SetMagickResourceLimit(AreaResource,limit); break; } if (LocaleCompare(keyword,""attenuate"") == 0) { (void) SetImageOption(image_info,keyword,value); break; } if (LocaleCompare(keyword,""authenticate"") == 0) { (void) CloneString(&image_info->density,value); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } case 'B': case 'b': { if (LocaleCompare(keyword,""background"") == 0) { (void) QueryColorDatabase(value,&image_info->background_color, exception); break; } if (LocaleCompare(keyword,""bias"") == 0) { if (image == (Image *) NULL) break; image->bias=StringToDoubleInterval(value,(double) QuantumRange+1.0); break; } if (LocaleCompare(keyword,""blue-primary"") == 0) { if (image == (Image *) NULL) break; flags=ParseGeometry(value,&geometry_info); image->chromaticity.blue_primary.x=geometry_info.rho; image->chromaticity.blue_primary.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->chromaticity.blue_primary.y= image->chromaticity.blue_primary.x; break; } if (LocaleCompare(keyword,""bordercolor"") == 0) { (void) QueryColorDatabase(value,&image_info->border_color, exception); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } case 'D': case 'd': { if (LocaleCompare(keyword,""density"") == 0) { (void) CloneString(&image_info->density,value); (void) CloneString(&draw_info->density,value); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } case 'F': case 'f': { if (LocaleCompare(keyword,""fill"") == 0) { (void) QueryColorDatabase(value,&draw_info->fill,exception); (void) SetImageOption(image_info,keyword,value); break; } if (LocaleCompare(keyword,""filename"") == 0) { (void) CopyMagickString(image_info->filename,value,MaxTextExtent); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } case 'G': case 'g': { if (LocaleCompare(keyword,""gravity"") == 0) { ssize_t gravity; gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,value); if (gravity < 0) ThrowMSLException(OptionError,""UnrecognizedGravityType"",value); (void) SetImageOption(image_info,keyword,value); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } case 'I': case 'i': { if (LocaleCompare(keyword,""id"") == 0) { (void) SetImageProperty(attributes,keyword,value); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } case 'M': case 'm': { if (LocaleCompare(keyword,""magick"") == 0) { (void) CopyMagickString(image_info->magick,value,MaxTextExtent); break; } if (LocaleCompare(keyword,""mattecolor"") == 0) { (void) QueryColorDatabase(value,&image_info->matte_color, exception); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } case 'P': case 'p': { if (LocaleCompare(keyword,""pointsize"") == 0) { image_info->pointsize=StringToDouble(value,(char **) NULL); draw_info->pointsize=StringToDouble(value,(char **) NULL); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } case 'Q': case 'q': { if (LocaleCompare(keyword,""quality"") == 0) { image_info->quality=StringToLong(value); if (image == (Image *) NULL) break; image->quality=StringToLong(value); break; } break; } case 'S': case 's': { if (LocaleCompare(keyword,""size"") == 0) { (void) CloneString(&image_info->size,value); break; } if (LocaleCompare(keyword,""stroke"") == 0) { (void) QueryColorDatabase(value,&draw_info->stroke,exception); (void) SetImageOption(image_info,keyword,value); break; } ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } default: { ThrowMSLException(OptionError,""UnrecognizedAttribute"",keyword); break; } } return(MagickTrue); } ",0 " void AcceleratedSurfaceBuffersSwappedCompleted(int host_id, int route_id, int surface_id, bool alive, base::TimeTicks timebase, base::TimeDelta interval) { AcceleratedSurfaceBuffersSwappedCompletedForGPU(host_id, route_id, alive, true /* presented */); AcceleratedSurfaceBuffersSwappedCompletedForRenderer(surface_id, timebase, interval); } ",1 "static const unsigned char *sha1_access(size_t pos, void *table) { struct pack_idx_entry **index = table; return index[pos]->sha1; } ",0 "void HandleToggleMirrorMode() { base::RecordAction(UserMetricsAction(""Accel_Toggle_Mirror_Mode"")); bool mirror = !Shell::GetInstance()->display_manager()->IsInMirrorMode(); Shell::GetInstance()->display_configuration_controller()->SetMirrorMode( mirror, true /* user_action */); } ",0 "static void activityLoggedInIsolatedWorldsAttrGetterAttributeGetterForMainWorld(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueInt(info, imp->activityLoggedInIsolatedWorldsAttrGetter()); } ",0 " void OnInit(const PluginMsg_Init_Params& params, IPC::Message* reply_msg) { base::AutoLock auto_lock(modal_dialog_event_map_lock_); if (modal_dialog_event_map_.count(params.containing_window)) { modal_dialog_event_map_[params.containing_window].refcount++; return; } WaitableEventWrapper wrapper; wrapper.event = new base::WaitableEvent(true, false); wrapper.refcount = 1; modal_dialog_event_map_[params.containing_window] = wrapper; } ",0 "bool AutoFillCCInfoBarDelegate::LinkClicked(WindowOpenDisposition disposition) { host_->tab_contents()->OpenURL(GURL(kAutoFillLearnMoreUrl), GURL(), NEW_FOREGROUND_TAB, PageTransition::TYPED); return false; } ",0 "lha_replace_path_separator(struct lha *lha, struct archive_entry *entry) { const wchar_t *wp; size_t i; if ((wp = archive_entry_pathname_w(entry)) != NULL) { archive_wstrcpy(&(lha->ws), wp); for (i = 0; i < archive_strlen(&(lha->ws)); i++) { if (lha->ws.s[i] == L'\\') lha->ws.s[i] = L'/'; } archive_entry_copy_pathname_w(entry, lha->ws.s); } if ((wp = archive_entry_symlink_w(entry)) != NULL) { archive_wstrcpy(&(lha->ws), wp); for (i = 0; i < archive_strlen(&(lha->ws)); i++) { if (lha->ws.s[i] == L'\\') lha->ws.s[i] = L'/'; } archive_entry_copy_symlink_w(entry, lha->ws.s); } } ",0 "int get_stat_xattr(const char *fname, int fd, STRUCT_STAT *fst, STRUCT_STAT *xst) { int mode, rdev_major, rdev_minor, uid, gid, len; char buf[256]; if (am_root >= 0 || IS_DEVICE(fst->st_mode) || IS_SPECIAL(fst->st_mode)) return -1; if (xst) *xst = *fst; else xst = fst; if (fname) { fd = -1; len = sys_lgetxattr(fname, XSTAT_ATTR, buf, sizeof buf - 1); } else { fname = ""fd""; len = sys_fgetxattr(fd, XSTAT_ATTR, buf, sizeof buf - 1); } if (len >= (int)sizeof buf) { len = -1; errno = ERANGE; } if (len < 0) { if (errno == ENOTSUP || errno == ENOATTR) return -1; if (errno == EPERM && S_ISLNK(fst->st_mode)) { xst->st_uid = 0; xst->st_gid = 0; return 0; } rsyserr(FERROR_XFER, errno, ""failed to read xattr %s for %s"", XSTAT_ATTR, full_fname(fname)); return -1; } buf[len] = '\0'; if (sscanf(buf, ""%o %d,%d %d:%d"", &mode, &rdev_major, &rdev_minor, &uid, &gid) != 5) { rprintf(FERROR, ""Corrupt %s xattr attached to %s: \""%s\""\n"", XSTAT_ATTR, full_fname(fname), buf); exit_cleanup(RERR_FILEIO); } xst->st_mode = from_wire_mode(mode); xst->st_rdev = MAKEDEV(rdev_major, rdev_minor); xst->st_uid = uid; xst->st_gid = gid; return 0; } ",0 "SQLRETURN SQLSetDescField( SQLHDESC descriptor_handle, SQLSMALLINT rec_number, SQLSMALLINT field_identifier, SQLPOINTER value, SQLINTEGER buffer_length ) { /* * not quite sure how the descriptor can be * allocated to a statement, all the documentation talks * about state transitions on statement states, but the * descriptor may be allocated with more than one statement * at one time. Which one should I check ? */ DMHDESC descriptor = (DMHDESC) descriptor_handle; SQLRETURN ret; SQLCHAR s1[ 100 + LOG_MESSAGE_LEN ]; int isStrField = 0; /* * check descriptor */ if ( !__validate_desc( descriptor )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, ""Error: SQL_INVALID_HANDLE"" ); return SQL_INVALID_HANDLE; } function_entry( descriptor ); if ( log_info.log_flag ) { sprintf( descriptor -> msg, ""\n\t\tEntry:\ \n\t\t\tDescriptor = %p\ \n\t\t\tRec Number = %d\ \n\t\t\tField Ident = %s\ \n\t\t\tValue = %p\ \n\t\t\tBuffer Length = %d"", descriptor, rec_number, __desc_attr_as_string( s1, field_identifier ), value, (int)buffer_length ); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, descriptor -> msg ); } thread_protect( SQL_HANDLE_DESC, descriptor ); if ( descriptor -> connection -> state < STATE_C4 ) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, ""Error: HY010"" ); __post_internal_error( &descriptor -> error, ERROR_HY010, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } /* * check status of statements associated with this descriptor */ if( __check_stmt_from_desc( descriptor, STATE_S8 ) || __check_stmt_from_desc( descriptor, STATE_S9 ) || __check_stmt_from_desc( descriptor, STATE_S10 ) || __check_stmt_from_desc( descriptor, STATE_S11 ) || __check_stmt_from_desc( descriptor, STATE_S12 ) || __check_stmt_from_desc( descriptor, STATE_S13 ) || __check_stmt_from_desc( descriptor, STATE_S14 ) || __check_stmt_from_desc( descriptor, STATE_S15 )) { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, ""Error: HY010"" ); __post_internal_error( &descriptor -> error, ERROR_HY010, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( rec_number < 0 ) { __post_internal_error( &descriptor -> error, ERROR_07009, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } switch ( field_identifier ) { /* Fixed-length fields: buffer_length is ignored */ case SQL_DESC_ALLOC_TYPE: case SQL_DESC_ARRAY_SIZE: case SQL_DESC_ARRAY_STATUS_PTR: case SQL_DESC_BIND_OFFSET_PTR: case SQL_DESC_BIND_TYPE: case SQL_DESC_COUNT: case SQL_DESC_ROWS_PROCESSED_PTR: case SQL_DESC_AUTO_UNIQUE_VALUE: case SQL_DESC_CASE_SENSITIVE: case SQL_DESC_CONCISE_TYPE: case SQL_DESC_DATA_PTR: case SQL_DESC_DATETIME_INTERVAL_CODE: case SQL_DESC_DATETIME_INTERVAL_PRECISION: case SQL_DESC_DISPLAY_SIZE: case SQL_DESC_FIXED_PREC_SCALE: case SQL_DESC_INDICATOR_PTR: case SQL_DESC_LENGTH: case SQL_DESC_NULLABLE: case SQL_DESC_NUM_PREC_RADIX: case SQL_DESC_OCTET_LENGTH: case SQL_DESC_OCTET_LENGTH_PTR: case SQL_DESC_PARAMETER_TYPE: case SQL_DESC_PRECISION: case SQL_DESC_ROWVER: case SQL_DESC_SCALE: case SQL_DESC_SEARCHABLE: case SQL_DESC_TYPE: case SQL_DESC_UNNAMED: case SQL_DESC_UNSIGNED: case SQL_DESC_UPDATABLE: isStrField = 0; break; /* Pointer to data: buffer_length must be valid */ case SQL_DESC_BASE_COLUMN_NAME: case SQL_DESC_BASE_TABLE_NAME: case SQL_DESC_CATALOG_NAME: case SQL_DESC_LABEL: case SQL_DESC_LITERAL_PREFIX: case SQL_DESC_LITERAL_SUFFIX: case SQL_DESC_LOCAL_TYPE_NAME: case SQL_DESC_NAME: case SQL_DESC_SCHEMA_NAME: case SQL_DESC_TABLE_NAME: case SQL_DESC_TYPE_NAME: isStrField = 1; break; default: isStrField = buffer_length != SQL_IS_POINTER && buffer_length != SQL_IS_INTEGER && buffer_length != SQL_IS_UINTEGER && buffer_length != SQL_IS_SMALLINT && buffer_length != SQL_IS_USMALLINT; } if ( isStrField && buffer_length < 0 && buffer_length != SQL_NTS) { __post_internal_error( &descriptor -> error, ERROR_HY090, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( field_identifier == SQL_DESC_COUNT && (SQLINTEGER)value < 0 ) { __post_internal_error( &descriptor -> error, ERROR_07009, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( field_identifier == SQL_DESC_PARAMETER_TYPE && value != SQL_PARAM_INPUT && value != SQL_PARAM_OUTPUT && value != SQL_PARAM_INPUT_OUTPUT && value != SQL_PARAM_INPUT_OUTPUT_STREAM && value != SQL_PARAM_OUTPUT_STREAM ) { __post_internal_error( &descriptor -> error, ERROR_HY105, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( CHECK_SQLSETDESCFIELD( descriptor -> connection )) { ret = SQLSETDESCFIELD( descriptor -> connection, descriptor -> driver_desc, rec_number, field_identifier, value, buffer_length ); } else if ( CHECK_SQLSETDESCFIELDW( descriptor -> connection )) { SQLWCHAR *s1 = NULL; if (isStrField) { s1 = ansi_to_unicode_alloc( value, buffer_length, descriptor -> connection, NULL ); if (SQL_NTS != buffer_length) { buffer_length *= sizeof(SQLWCHAR); } } else { s1 = value; } ret = SQLSETDESCFIELDW( descriptor -> connection, descriptor -> driver_desc, rec_number, field_identifier, s1, buffer_length ); if (isStrField) { if (s1) free(s1); } } else { dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, ""Error: IM001"" ); __post_internal_error( &descriptor -> error, ERROR_IM001, NULL, descriptor -> connection -> environment -> requested_version ); return function_return_nodrv( SQL_HANDLE_DESC, descriptor, SQL_ERROR ); } if ( log_info.log_flag ) { sprintf( descriptor -> msg, ""\n\t\tExit:[%s]"", __get_return_status( ret, s1 )); dm_log_write( __FILE__, __LINE__, LOG_INFO, LOG_INFO, descriptor -> msg ); } return function_return( SQL_HANDLE_DESC, descriptor, ret ); } ",1 "static TRBCCode xhci_enable_ep(XHCIState *xhci, unsigned int slotid, unsigned int epid, dma_addr_t pctx, uint32_t *ctx) { XHCISlot *slot; XHCIEPContext *epctx; trace_usb_xhci_ep_enable(slotid, epid); assert(slotid >= 1 && slotid <= xhci->numslots); assert(epid >= 1 && epid <= 31); slot = &xhci->slots[slotid-1]; if (slot->eps[epid-1]) { xhci_disable_ep(xhci, slotid, epid); } epctx = xhci_alloc_epctx(xhci, slotid, epid); slot->eps[epid-1] = epctx; xhci_init_epctx(epctx, pctx, ctx); epctx->mfindex_last = 0; epctx->state = EP_RUNNING; ctx[0] &= ~EP_STATE_MASK; ctx[0] |= EP_RUNNING; return CC_SUCCESS; } ",0 "static int adjust_ptr_min_max_vals(struct bpf_verifier_env *env, struct bpf_insn *insn, const struct bpf_reg_state *ptr_reg, const struct bpf_reg_state *off_reg) { struct bpf_verifier_state *vstate = env->cur_state; struct bpf_func_state *state = vstate->frame[vstate->curframe]; struct bpf_reg_state *regs = state->regs, *dst_reg; bool known = tnum_is_const(off_reg->var_off); s64 smin_val = off_reg->smin_value, smax_val = off_reg->smax_value, smin_ptr = ptr_reg->smin_value, smax_ptr = ptr_reg->smax_value; u64 umin_val = off_reg->umin_value, umax_val = off_reg->umax_value, umin_ptr = ptr_reg->umin_value, umax_ptr = ptr_reg->umax_value; u32 dst = insn->dst_reg, src = insn->src_reg; u8 opcode = BPF_OP(insn->code); dst_reg = ®s[dst]; if ((known && (smin_val != smax_val || umin_val != umax_val)) || smin_val > smax_val || umin_val > umax_val) { /* Taint dst register if offset had invalid bounds derived from * e.g. dead branches. */ __mark_reg_unknown(dst_reg); return 0; } if (BPF_CLASS(insn->code) != BPF_ALU64) { /* 32-bit ALU ops on pointers produce (meaningless) scalars */ verbose(env, ""R%d 32-bit pointer arithmetic prohibited\n"", dst); return -EACCES; } switch (ptr_reg->type) { case PTR_TO_MAP_VALUE_OR_NULL: verbose(env, ""R%d pointer arithmetic on %s prohibited, null-check it first\n"", dst, reg_type_str[ptr_reg->type]); return -EACCES; case CONST_PTR_TO_MAP: case PTR_TO_PACKET_END: case PTR_TO_SOCKET: case PTR_TO_SOCKET_OR_NULL: verbose(env, ""R%d pointer arithmetic on %s prohibited\n"", dst, reg_type_str[ptr_reg->type]); return -EACCES; case PTR_TO_MAP_VALUE: if (!env->allow_ptr_leaks && !known && (smin_val < 0) != (smax_val < 0)) { verbose(env, ""R%d has unknown scalar with mixed signed bounds, pointer arithmetic with it prohibited for !root\n"", off_reg == dst_reg ? dst : src); return -EACCES; } /* fall-through */ default: break; } /* In case of 'scalar += pointer', dst_reg inherits pointer type and id. * The id may be overwritten later if we create a new variable offset. */ dst_reg->type = ptr_reg->type; dst_reg->id = ptr_reg->id; if (!check_reg_sane_offset(env, off_reg, ptr_reg->type) || !check_reg_sane_offset(env, ptr_reg, ptr_reg->type)) return -EINVAL; switch (opcode) { case BPF_ADD: /* We can take a fixed offset as long as it doesn't overflow * the s32 'off' field */ if (known && (ptr_reg->off + smin_val == (s64)(s32)(ptr_reg->off + smin_val))) { /* pointer += K. Accumulate it into fixed offset */ dst_reg->smin_value = smin_ptr; dst_reg->smax_value = smax_ptr; dst_reg->umin_value = umin_ptr; dst_reg->umax_value = umax_ptr; dst_reg->var_off = ptr_reg->var_off; dst_reg->off = ptr_reg->off + smin_val; dst_reg->raw = ptr_reg->raw; break; } /* A new variable offset is created. Note that off_reg->off * == 0, since it's a scalar. * dst_reg gets the pointer type and since some positive * integer value was added to the pointer, give it a new 'id' * if it's a PTR_TO_PACKET. * this creates a new 'base' pointer, off_reg (variable) gets * added into the variable offset, and we copy the fixed offset * from ptr_reg. */ if (signed_add_overflows(smin_ptr, smin_val) || signed_add_overflows(smax_ptr, smax_val)) { dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { dst_reg->smin_value = smin_ptr + smin_val; dst_reg->smax_value = smax_ptr + smax_val; } if (umin_ptr + umin_val < umin_ptr || umax_ptr + umax_val < umax_ptr) { dst_reg->umin_value = 0; dst_reg->umax_value = U64_MAX; } else { dst_reg->umin_value = umin_ptr + umin_val; dst_reg->umax_value = umax_ptr + umax_val; } dst_reg->var_off = tnum_add(ptr_reg->var_off, off_reg->var_off); dst_reg->off = ptr_reg->off; dst_reg->raw = ptr_reg->raw; if (reg_is_pkt_pointer(ptr_reg)) { dst_reg->id = ++env->id_gen; /* something was added to pkt_ptr, set range to zero */ dst_reg->raw = 0; } break; case BPF_SUB: if (dst_reg == off_reg) { /* scalar -= pointer. Creates an unknown scalar */ verbose(env, ""R%d tried to subtract pointer from scalar\n"", dst); return -EACCES; } /* We don't allow subtraction from FP, because (according to * test_verifier.c test ""invalid fp arithmetic"", JITs might not * be able to deal with it. */ if (ptr_reg->type == PTR_TO_STACK) { verbose(env, ""R%d subtraction from stack pointer prohibited\n"", dst); return -EACCES; } if (known && (ptr_reg->off - smin_val == (s64)(s32)(ptr_reg->off - smin_val))) { /* pointer -= K. Subtract it from fixed offset */ dst_reg->smin_value = smin_ptr; dst_reg->smax_value = smax_ptr; dst_reg->umin_value = umin_ptr; dst_reg->umax_value = umax_ptr; dst_reg->var_off = ptr_reg->var_off; dst_reg->id = ptr_reg->id; dst_reg->off = ptr_reg->off - smin_val; dst_reg->raw = ptr_reg->raw; break; } /* A new variable offset is created. If the subtrahend is known * nonnegative, then any reg->range we had before is still good. */ if (signed_sub_overflows(smin_ptr, smax_val) || signed_sub_overflows(smax_ptr, smin_val)) { /* Overflow possible, we know nothing */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { dst_reg->smin_value = smin_ptr - smax_val; dst_reg->smax_value = smax_ptr - smin_val; } if (umin_ptr < umax_val) { /* Overflow possible, we know nothing */ dst_reg->umin_value = 0; dst_reg->umax_value = U64_MAX; } else { /* Cannot overflow (as long as bounds are consistent) */ dst_reg->umin_value = umin_ptr - umax_val; dst_reg->umax_value = umax_ptr - umin_val; } dst_reg->var_off = tnum_sub(ptr_reg->var_off, off_reg->var_off); dst_reg->off = ptr_reg->off; dst_reg->raw = ptr_reg->raw; if (reg_is_pkt_pointer(ptr_reg)) { dst_reg->id = ++env->id_gen; /* something was added to pkt_ptr, set range to zero */ if (smin_val < 0) dst_reg->raw = 0; } break; case BPF_AND: case BPF_OR: case BPF_XOR: /* bitwise ops on pointers are troublesome, prohibit. */ verbose(env, ""R%d bitwise operator %s on pointer prohibited\n"", dst, bpf_alu_string[opcode >> 4]); return -EACCES; default: /* other operators (e.g. MUL,LSH) produce non-pointer results */ verbose(env, ""R%d pointer arithmetic with %s operator prohibited\n"", dst, bpf_alu_string[opcode >> 4]); return -EACCES; } if (!check_reg_sane_offset(env, dst_reg, ptr_reg->type)) return -EINVAL; __update_reg_bounds(dst_reg); __reg_deduce_bounds(dst_reg); __reg_bound_offset(dst_reg); /* For unprivileged we require that resulting offset must be in bounds * in order to be able to sanitize access later on. */ if (!env->allow_ptr_leaks) { if (dst_reg->type == PTR_TO_MAP_VALUE && check_map_access(env, dst, dst_reg->off, 1, false)) { verbose(env, ""R%d pointer arithmetic of map value goes out of range, "" ""prohibited for !root\n"", dst); return -EACCES; } else if (dst_reg->type == PTR_TO_STACK && check_stack_access(env, dst_reg, dst_reg->off + dst_reg->var_off.value, 1)) { verbose(env, ""R%d stack pointer arithmetic goes out of range, "" ""prohibited for !root\n"", dst); return -EACCES; } } return 0; } ",1 "bool GLES2DecoderImpl::CheckCurrentValuebufferForSubscription( GLenum subscription, const char* function_name) { if (!CheckCurrentValuebuffer(function_name)) { return false; } if (!state_.bound_valuebuffer.get()->IsSubscribed(subscription)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, ""valuebuffer is not subscribed""); return false; } return true; } ",0 "bool WebGLRenderingContextBase::ValidateTexFuncData( const char* function_name, TexImageDimension tex_dimension, GLint level, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, DOMArrayBufferView* pixels, NullDisposition disposition, GLuint src_offset) { if (!pixels) { DCHECK_NE(disposition, kNullNotReachable); if (disposition == kNullAllowed) return true; SynthesizeGLError(GL_INVALID_VALUE, function_name, ""no pixels""); return false; } if (!ValidateSettableTexFormat(function_name, format)) return false; switch (type) { case GL_BYTE: if (pixels->GetType() != DOMArrayBufferView::kTypeInt8) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""type BYTE but ArrayBufferView not Int8Array""); return false; } break; case GL_UNSIGNED_BYTE: if (pixels->GetType() != DOMArrayBufferView::kTypeUint8) { SynthesizeGLError( GL_INVALID_OPERATION, function_name, ""type UNSIGNED_BYTE but ArrayBufferView not Uint8Array""); return false; } break; case GL_SHORT: if (pixels->GetType() != DOMArrayBufferView::kTypeInt16) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""type SHORT but ArrayBufferView not Int16Array""); return false; } break; case GL_UNSIGNED_SHORT: case GL_UNSIGNED_SHORT_5_6_5: case GL_UNSIGNED_SHORT_4_4_4_4: case GL_UNSIGNED_SHORT_5_5_5_1: if (pixels->GetType() != DOMArrayBufferView::kTypeUint16) { SynthesizeGLError( GL_INVALID_OPERATION, function_name, ""type UNSIGNED_SHORT but ArrayBufferView not Uint16Array""); return false; } break; case GL_INT: if (pixels->GetType() != DOMArrayBufferView::kTypeInt32) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""type INT but ArrayBufferView not Int32Array""); return false; } break; case GL_UNSIGNED_INT: case GL_UNSIGNED_INT_2_10_10_10_REV: case GL_UNSIGNED_INT_10F_11F_11F_REV: case GL_UNSIGNED_INT_5_9_9_9_REV: case GL_UNSIGNED_INT_24_8: if (pixels->GetType() != DOMArrayBufferView::kTypeUint32) { SynthesizeGLError( GL_INVALID_OPERATION, function_name, ""type UNSIGNED_INT but ArrayBufferView not Uint32Array""); return false; } break; case GL_FLOAT: // OES_texture_float if (pixels->GetType() != DOMArrayBufferView::kTypeFloat32) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""type FLOAT but ArrayBufferView not Float32Array""); return false; } break; case GL_HALF_FLOAT: case GL_HALF_FLOAT_OES: // OES_texture_half_float if (pixels->GetType() != DOMArrayBufferView::kTypeUint16) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""type HALF_FLOAT_OES but ArrayBufferView is not NULL "" ""and not Uint16Array""); return false; } break; case GL_FLOAT_32_UNSIGNED_INT_24_8_REV: SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""type FLOAT_32_UNSIGNED_INT_24_8_REV but "" ""ArrayBufferView is not NULL""); return false; default: NOTREACHED(); } unsigned total_bytes_required, skip_bytes; GLenum error = WebGLImageConversion::ComputeImageSizeInBytes( format, type, width, height, depth, GetUnpackPixelStoreParams(tex_dimension), &total_bytes_required, nullptr, &skip_bytes); if (error != GL_NO_ERROR) { SynthesizeGLError(error, function_name, ""invalid texture dimensions""); return false; } base::CheckedNumeric total = src_offset; total *= pixels->TypeSize(); total += total_bytes_required; total += skip_bytes; if (!total.IsValid() || pixels->byteLength() < total.ValueOrDie()) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""ArrayBufferView not big enough for request""); return false; } return true; } ",0 "void udpv6_destroy_sock(struct sock *sk) { struct udp_sock *up = udp_sk(sk); lock_sock(sk); udp_v6_flush_pending_frames(sk); release_sock(sk); if (static_key_false(&udpv6_encap_needed) && up->encap_type) { void (*encap_destroy)(struct sock *sk); encap_destroy = ACCESS_ONCE(up->encap_destroy); if (encap_destroy) encap_destroy(sk); } inet6_destroy_sock(sk); } ",0 "static void cm_format_dreq(struct cm_dreq_msg *dreq_msg, struct cm_id_private *cm_id_priv, const void *private_data, u8 private_data_len) { cm_format_mad_hdr(&dreq_msg->hdr, CM_DREQ_ATTR_ID, cm_form_tid(cm_id_priv, CM_MSG_SEQUENCE_DREQ)); dreq_msg->local_comm_id = cm_id_priv->id.local_id; dreq_msg->remote_comm_id = cm_id_priv->id.remote_id; cm_dreq_set_remote_qpn(dreq_msg, cm_id_priv->remote_qpn); if (private_data && private_data_len) memcpy(dreq_msg->private_data, private_data, private_data_len); } ",0 "static int sysvipc_proc_show(struct seq_file *s, void *it) { struct ipc_proc_iter *iter = s->private; struct ipc_proc_iface *iface = iter->iface; if (it == SEQ_START_TOKEN) { seq_puts(s, iface->header); return 0; } return iface->show(s, it); } ",0 "WebGLRenderingContextBase::GetUnpackPixelStoreParams(TexImageDimension) { WebGLImageConversion::PixelStoreParams params; params.alignment = unpack_alignment_; return params; } ",0 " cff_parse_num( CFF_Parser parser, FT_Byte** d ) { if ( **d == 30 ) { /* binary-coded decimal is truncated to integer */ return cff_parse_real( *d, parser->limit, 0, NULL ) >> 16; } else if ( **d == 255 ) { /* 16.16 fixed point is used internally for CFF2 blend results. */ /* Since these are trusted values, a limit check is not needed. */ /* After the 255, 4 bytes are in host order. */ /* Blend result is rounded to integer. */ return (FT_Long)( *( (FT_UInt32 *) ( d[0] + 1 ) ) + 0x8000U ) >> 16; } else return cff_parse_integer( *d, parser->limit ); } ",0 "blink::WebDragOperationsMask ConvertToWeb(int drag_op) { int web_drag_op = blink::WebDragOperationNone; if (drag_op & ui::DragDropTypes::DRAG_COPY) web_drag_op |= blink::WebDragOperationCopy; if (drag_op & ui::DragDropTypes::DRAG_MOVE) web_drag_op |= blink::WebDragOperationMove; if (drag_op & ui::DragDropTypes::DRAG_LINK) web_drag_op |= blink::WebDragOperationLink; return (blink::WebDragOperationsMask) web_drag_op; } ",0 " WebsiteSettings* website_settings() { if (!website_settings_.get()) { website_settings_.reset(new WebsiteSettings( mock_ui(), profile(), tab_specific_content_settings(), infobar_service(), url(), ssl(), cert_store())); } return website_settings_.get(); } ",1 "views::BubbleBorder* AutofillDialogViews::OverlayView::GetBubbleBorder() { views::View* frame = GetWidget()->non_client_view()->frame_view(); std::string bubble_frame_view_name(views::BubbleFrameView::kViewClassName); if (frame->GetClassName() == bubble_frame_view_name) return static_cast(frame)->bubble_border(); NOTREACHED(); return NULL; } ",0 "int snd_pcm_hw_param_last(struct snd_pcm_substream *pcm, struct snd_pcm_hw_params *params, snd_pcm_hw_param_t var, int *dir) { int changed = _snd_pcm_hw_param_last(params, var); if (changed < 0) return changed; if (params->rmask) { int err = snd_pcm_hw_refine(pcm, params); if (snd_BUG_ON(err < 0)) return err; } return snd_pcm_hw_param_value(params, var, dir); } ",0 "adjust_poll(int count) { G.polladj_count += count; if (G.polladj_count > POLLADJ_LIMIT) { G.polladj_count = 0; if (G.poll_exp < MAXPOLL) { G.poll_exp++; VERB4 bb_error_msg(""polladj: discipline_jitter:%f ++poll_exp=%d"", G.discipline_jitter, G.poll_exp); } } else if (G.polladj_count < -POLLADJ_LIMIT || (count < 0 && G.poll_exp > BIGPOLL)) { G.polladj_count = 0; if (G.poll_exp > MINPOLL) { llist_t *item; G.poll_exp--; /* Correct p->next_action_time in each peer * which waits for sending, so that they send earlier. * Old pp->next_action_time are on the order * of t + (1 << old_poll_exp) + small_random, * we simply need to subtract ~half of that. */ for (item = G.ntp_peers; item != NULL; item = item->link) { peer_t *pp = (peer_t *) item->data; if (pp->p_fd < 0) pp->next_action_time -= (1 << G.poll_exp); } VERB4 bb_error_msg(""polladj: discipline_jitter:%f --poll_exp=%d"", G.discipline_jitter, G.poll_exp); } } else { VERB4 bb_error_msg(""polladj: count:%d"", G.polladj_count); } } ",0 "struct net_device *dev_getfirstbyhwtype(struct net *net, unsigned short type) { struct net_device *dev, *ret = NULL; rcu_read_lock(); for_each_netdev_rcu(net, dev) if (dev->type == type) { dev_hold(dev); ret = dev; break; } rcu_read_unlock(); return ret; } ",0 "Section::~Section() { } ",0 "jbig2_global_ctx_free(Jbig2GlobalCtx *global_ctx) { jbig2_ctx_free((Jbig2Ctx *) global_ctx); } ",0 "static int acm_tty_install(struct tty_driver *driver, struct tty_struct *tty) { struct acm *acm; int retval; dev_dbg(tty->dev, ""%s\n"", __func__); acm = acm_get_by_minor(tty->index); if (!acm) return -ENODEV; retval = tty_standard_install(driver, tty); if (retval) goto error_init_termios; tty->driver_data = acm; return 0; error_init_termios: tty_port_put(&acm->port); return retval; } ",0 "void FrameLoader::load(const ResourceRequest& request, const String& frameName, bool lockHistory) { if (frameName.isEmpty()) { load(request, lockHistory); return; } Frame* frame = findFrameForNavigation(frameName); if (frame) { frame->loader()->load(request, lockHistory); return; } policyChecker()->checkNewWindowPolicy(NavigationAction(request.url(), NavigationTypeOther), FrameLoader::callContinueLoadAfterNewWindowPolicy, request, 0, frameName, this); } ",0 "cifs_find_tcon(struct cifs_ses *ses, const char *unc) { struct list_head *tmp; struct cifs_tcon *tcon; spin_lock(&cifs_tcp_ses_lock); list_for_each(tmp, &ses->tcon_list) { tcon = list_entry(tmp, struct cifs_tcon, tcon_list); if (!match_tcon(tcon, unc)) continue; ++tcon->tc_count; spin_unlock(&cifs_tcp_ses_lock); return tcon; } spin_unlock(&cifs_tcp_ses_lock); return NULL; } ",0 "HRESULT DataObjectImpl::EndOperation( HRESULT result, IBindCtx* reserved, DWORD effects) { async_operation_started_ = false; return S_OK; } ",0 "static void sctp_generate_autoclose_event(unsigned long data) { struct sctp_association *asoc = (struct sctp_association *) data; sctp_generate_timeout_event(asoc, SCTP_EVENT_TIMEOUT_AUTOCLOSE); } ",0 "static inline void compat_release_entry(struct compat_arpt_entry *e) { struct xt_entry_target *t; t = compat_arpt_get_target(e); module_put(t->u.kernel.target->me); } ",0 "void ContentSettingsStore::RegisterExtension( const std::string& ext_id, const base::Time& install_time, bool is_enabled) { base::AutoLock lock(lock_); ExtensionEntryMap::iterator i = FindEntry(ext_id); if (i != entries_.end()) { delete i->second; entries_.erase(i); } ExtensionEntry* entry = new ExtensionEntry; entry->id = ext_id; entry->enabled = is_enabled; entries_.insert(std::make_pair(install_time, entry)); } ",0 "int max_name_length(struct name_list *names) { int max_len = 0; while (names != NULL) { struct name_list *next = names->next; int len = strlen(names->name); if (len > max_len) max_len = len; names = next; } return max_len; } ",0 "static void __glXdirectContextDestroy(__GLXcontext *context) { __glXContextDestroy(context); free(context); } ",0 "void bpf_map_inc(struct bpf_map *map, bool uref) { atomic_inc(&map->refcnt); if (uref) atomic_inc(&map->usercnt); } ",1 "PassRefPtr Document::forms() { return ensureCachedCollection(DocForms); } ",0 "static irqreturn_t au1200fb_handle_irq(int irq, void* dev_id) { /* Nothing to do for now, just clear any pending interrupt */ lcd->intstatus = lcd->intstatus; au_sync(); return IRQ_HANDLED; } ",0 "AutofillDialogViews::SuggestedButton::SuggestedButton( views::MenuButtonListener* listener) : views::MenuButton(NULL, base::string16(), listener, false) { const int kFocusBorderWidth = 1; SetBorder(views::Border::CreateEmptyBorder(kMenuButtonTopInset, kFocusBorderWidth, kMenuButtonBottomInset, kFocusBorderWidth)); gfx::Insets insets = GetInsets(); insets += gfx::Insets(-kFocusBorderWidth, -kFocusBorderWidth, -kFocusBorderWidth, -kFocusBorderWidth); SetFocusPainter( views::Painter::CreateDashedFocusPainterWithInsets(insets)); SetFocusable(true); } ",0 "void BasePrefsChange::IgnorePrefChanges() { pref_observer_.reset(); } ",0 "BIO *cms_EnvelopedData_init_bio(CMS_ContentInfo *cms) { CMS_EncryptedContentInfo *ec; STACK_OF(CMS_RecipientInfo) *rinfos; CMS_RecipientInfo *ri; int i, ok = 0; BIO *ret; /* Get BIO first to set up key */ ec = cms->d.envelopedData->encryptedContentInfo; ret = cms_EncryptedContent_init_bio(ec); /* If error or no cipher end of processing */ if (!ret || !ec->cipher) return ret; /* Now encrypt content key according to each RecipientInfo type */ rinfos = cms->d.envelopedData->recipientInfos; for (i = 0; i < sk_CMS_RecipientInfo_num(rinfos); i++) { ri = sk_CMS_RecipientInfo_value(rinfos, i); if (CMS_RecipientInfo_encrypt(cms, ri) <= 0) { CMSerr(CMS_F_CMS_ENVELOPEDDATA_INIT_BIO, CMS_R_ERROR_SETTING_RECIPIENTINFO); goto err; } } cms_env_set_version(cms->d.envelopedData); ok = 1; err: ec->cipher = NULL; OPENSSL_clear_free(ec->key, ec->keylen); ec->key = NULL; ec->keylen = 0; if (ok) return ret; BIO_free(ret); return NULL; } ",0 "LocationBar* BrowserView::GetLocationBar() const { return GetLocationBarView(); } ",0 "void DocumentLoader::clearMainResourceLoader() { m_loadingMainResource = false; if (this == frameLoader()->activeDocumentLoader()) checkLoadComplete(); } ",0 "void Document::enqueueWindowEvent(PassRefPtr event) { event->setTarget(domWindow()); m_eventQueue->enqueueEvent(event); } ",0 "apply_printer_defaults( cupsd_printer_t *printer, /* I - Printer */ cupsd_job_t *job) /* I - Job */ { int i, /* Looping var */ num_options; /* Number of default options */ cups_option_t *options, /* Default options */ *option; /* Current option */ cupsdLogJob(job, CUPSD_LOG_DEBUG, ""Applying default options...""); /* * Collect all of the default options and add the missing ones to the * job object... */ for (i = printer->num_options, num_options = 0, options = NULL, option = printer->options; i > 0; i --, option ++) if (!ippFindAttribute(job->attrs, option->name, IPP_TAG_ZERO)) { if (!strcmp(option->name, ""print-quality"") && ippFindAttribute(job->attrs, ""cupsPrintQuality"", IPP_TAG_NAME)) continue; /* Don't override cupsPrintQuality */ cupsdLogJob(job, CUPSD_LOG_DEBUG, ""Adding default %s=%s"", option->name, option->value); num_options = cupsAddOption(option->name, option->value, num_options, &options); } /* * Encode these options as attributes in the job object... */ cupsEncodeOptions2(job->attrs, num_options, options, IPP_TAG_JOB); cupsFreeOptions(num_options, options); } ",0 "dissect_dch_timing_adjustment(proto_tree *tree, packet_info *pinfo, tvbuff_t *tvb, int offset) { guint8 control_cfn; gint16 toa; proto_item *toa_ti; /* CFN control */ control_cfn = tvb_get_guint8(tvb, offset); proto_tree_add_item(tree, hf_fp_cfn_control, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; /* ToA */ toa = tvb_get_ntohs(tvb, offset); toa_ti = proto_tree_add_item(tree, hf_fp_toa, tvb, offset, 2, ENC_BIG_ENDIAN); offset += 2; expert_add_info_format(pinfo, toa_ti, &ei_fp_timing_adjustmentment_reported, ""Timing adjustmentment reported (%f ms)"", (float)(toa / 8)); col_append_fstr(pinfo->cinfo, COL_INFO, "" CFN = %u, ToA = %d"", control_cfn, toa); return offset; } ",0 "int _dbus_printf_string_upper_bound (const char *format, va_list args) { /* MSVCRT's vsnprintf semantics are a bit different */ char buf[1024]; int bufsize; int len; bufsize = sizeof (buf); len = _vsnprintf (buf, bufsize - 1, format, args); while (len == -1) /* try again */ { p = malloc (bufsize); if (p == NULL) return -1; if (p == NULL) return -1; len = _vsnprintf (p, bufsize - 1, format, args); free (p); } * Returns the UTF-16 form of a UTF-8 string. The result should be * freed with dbus_free() when no longer needed. * * @param str the UTF-8 string * @param error return location for error code */ wchar_t * _dbus_win_utf8_to_utf16 (const char *str, DBusError *error) { DBusString s; int n; wchar_t *retval; _dbus_string_init_const (&s, str); if (!_dbus_string_validate_utf8 (&s, 0, _dbus_string_get_length (&s))) { dbus_set_error_const (error, DBUS_ERROR_FAILED, ""Invalid UTF-8""); return NULL; } n = MultiByteToWideChar (CP_UTF8, 0, str, -1, NULL, 0); if (n == 0) { _dbus_win_set_error_from_win_error (error, GetLastError ()); return NULL; } retval = dbus_new (wchar_t, n); if (!retval) { _DBUS_SET_OOM (error); return NULL; } if (MultiByteToWideChar (CP_UTF8, 0, str, -1, retval, n) != n) { dbus_free (retval); dbus_set_error_const (error, DBUS_ERROR_FAILED, ""MultiByteToWideChar inconsistency""); return NULL; } return retval; } /** * Returns the UTF-8 form of a UTF-16 string. The result should be * freed with dbus_free() when no longer needed. * * @param str the UTF-16 string * @param error return location for error code */ char * _dbus_win_utf16_to_utf8 (const wchar_t *str, DBusError *error) { int n; char *retval; n = WideCharToMultiByte (CP_UTF8, 0, str, -1, NULL, 0, NULL, NULL); if (n == 0) { _dbus_win_set_error_from_win_error (error, GetLastError ()); return NULL; } retval = dbus_malloc (n); if (!retval) { _DBUS_SET_OOM (error); return NULL; } if (WideCharToMultiByte (CP_UTF8, 0, str, -1, retval, n, NULL, NULL) != n) { dbus_free (retval); dbus_set_error_const (error, DBUS_ERROR_FAILED, ""WideCharToMultiByte inconsistency""); return NULL; } return retval; } /************************************************************************ ************************************************************************/ dbus_bool_t _dbus_win_account_to_sid (const wchar_t *waccount, void **ppsid, DBusError *error) { dbus_bool_t retval = FALSE; DWORD sid_length, wdomain_length; SID_NAME_USE use; wchar_t *wdomain; *ppsid = NULL; sid_length = 0; wdomain_length = 0; if (!LookupAccountNameW (NULL, waccount, NULL, &sid_length, NULL, &wdomain_length, &use) && GetLastError () != ERROR_INSUFFICIENT_BUFFER) { _dbus_win_set_error_from_win_error (error, GetLastError ()); return FALSE; } *ppsid = dbus_malloc (sid_length); if (!*ppsid) { _DBUS_SET_OOM (error); return FALSE; } wdomain = dbus_new (wchar_t, wdomain_length); if (!wdomain) { _DBUS_SET_OOM (error); goto out1; } if (!LookupAccountNameW (NULL, waccount, (PSID) *ppsid, &sid_length, wdomain, &wdomain_length, &use)) { _dbus_win_set_error_from_win_error (error, GetLastError ()); goto out2; } if (!IsValidSid ((PSID) *ppsid)) { dbus_set_error_const (error, DBUS_ERROR_FAILED, ""Invalid SID""); goto out2; } retval = TRUE; out2: dbus_free (wdomain); out1: if (!retval) { dbus_free (*ppsid); *ppsid = NULL; } return retval; } /** @} end of sysdeps-win */ ",1 "void loadDataFromDisk(void) { long long start = ustime(); if (server.aof_state == AOF_ON) { if (loadAppendOnlyFile(server.aof_filename) == C_OK) serverLog(LL_NOTICE,""DB loaded from append only file: %.3f seconds"",(float)(ustime()-start)/1000000); } else { if (rdbLoad(server.rdb_filename) == C_OK) { serverLog(LL_NOTICE,""DB loaded from disk: %.3f seconds"", (float)(ustime()-start)/1000000); } else if (errno != ENOENT) { serverLog(LL_WARNING,""Fatal error loading the DB: %s. Exiting."",strerror(errno)); exit(1); } } } ",0 "int usb_disable_ltm(struct usb_device *udev) { return 0; } ",0 "void bgp_attr_undup(struct attr *new, struct attr *old) { if (new->aspath != old->aspath) aspath_free(new->aspath); if (new->community != old->community) community_free(&new->community); if (new->ecommunity != old->ecommunity) ecommunity_free(&new->ecommunity); if (new->lcommunity != old->lcommunity) lcommunity_free(&new->lcommunity); } ",0 "static void overloadedMethodHMethod(const v8::FunctionCallbackInfo& info) { if (((info.Length() == 0))) { overloadedMethodH1Method(info); return; } if (((info.Length() == 1) && (info[0]->IsNull() || info[0]->IsFunction()))) { overloadedMethodH2Method(info); return; } throwTypeError(ExceptionMessages::failedToExecute(""overloadedMethodH"", ""TestObjectPython"", ""No function was found that matched the signature provided.""), info.GetIsolate()); } ",0 "static int dup_mmap(struct mm_struct *mm, struct mm_struct *oldmm) { struct vm_area_struct *mpnt, *tmp, **pprev; struct rb_node **rb_link, *rb_parent; int retval; unsigned long charge; struct mempolicy *pol; down_write(&oldmm->mmap_sem); flush_cache_dup_mm(oldmm); /* * Not linked in yet - no deadlock potential: */ down_write_nested(&mm->mmap_sem, SINGLE_DEPTH_NESTING); mm->locked_vm = 0; mm->mmap = NULL; mm->mmap_cache = NULL; mm->free_area_cache = oldmm->mmap_base; mm->cached_hole_size = ~0UL; mm->map_count = 0; cpumask_clear(mm_cpumask(mm)); mm->mm_rb = RB_ROOT; rb_link = &mm->mm_rb.rb_node; rb_parent = NULL; pprev = &mm->mmap; retval = ksm_fork(mm, oldmm); if (retval) goto out; for (mpnt = oldmm->mmap; mpnt; mpnt = mpnt->vm_next) { struct file *file; if (mpnt->vm_flags & VM_DONTCOPY) { long pages = vma_pages(mpnt); mm->total_vm -= pages; vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file, -pages); continue; } charge = 0; if (mpnt->vm_flags & VM_ACCOUNT) { unsigned int len = (mpnt->vm_end - mpnt->vm_start) >> PAGE_SHIFT; if (security_vm_enough_memory(len)) goto fail_nomem; charge = len; } tmp = kmem_cache_alloc(vm_area_cachep, GFP_KERNEL); if (!tmp) goto fail_nomem; *tmp = *mpnt; INIT_LIST_HEAD(&tmp->anon_vma_chain); pol = mpol_dup(vma_policy(mpnt)); retval = PTR_ERR(pol); if (IS_ERR(pol)) goto fail_nomem_policy; vma_set_policy(tmp, pol); if (anon_vma_fork(tmp, mpnt)) goto fail_nomem_anon_vma_fork; tmp->vm_flags &= ~VM_LOCKED; tmp->vm_mm = mm; tmp->vm_next = NULL; file = tmp->vm_file; if (file) { struct inode *inode = file->f_path.dentry->d_inode; struct address_space *mapping = file->f_mapping; get_file(file); if (tmp->vm_flags & VM_DENYWRITE) atomic_dec(&inode->i_writecount); spin_lock(&mapping->i_mmap_lock); if (tmp->vm_flags & VM_SHARED) mapping->i_mmap_writable++; tmp->vm_truncate_count = mpnt->vm_truncate_count; flush_dcache_mmap_lock(mapping); /* insert tmp into the share list, just after mpnt */ vma_prio_tree_add(tmp, mpnt); flush_dcache_mmap_unlock(mapping); spin_unlock(&mapping->i_mmap_lock); } /* * Clear hugetlb-related page reserves for children. This only * affects MAP_PRIVATE mappings. Faults generated by the child * are not guaranteed to succeed, even if read-only */ if (is_vm_hugetlb_page(tmp)) reset_vma_resv_huge_pages(tmp); /* * Link in the new vma and copy the page table entries. */ *pprev = tmp; pprev = &tmp->vm_next; __vma_link_rb(mm, tmp, rb_link, rb_parent); rb_link = &tmp->vm_rb.rb_right; rb_parent = &tmp->vm_rb; mm->map_count++; retval = copy_page_range(mm, oldmm, mpnt); if (tmp->vm_ops && tmp->vm_ops->open) tmp->vm_ops->open(tmp); if (retval) goto out; } /* a new mm has just been created */ arch_dup_mmap(oldmm, mm); retval = 0; out: up_write(&mm->mmap_sem); flush_tlb_mm(oldmm); up_write(&oldmm->mmap_sem); return retval; fail_nomem_anon_vma_fork: mpol_put(pol); fail_nomem_policy: kmem_cache_free(vm_area_cachep, tmp); fail_nomem: retval = -ENOMEM; vm_unacct_memory(charge); goto out; } ",0 "bool GesturePoint::IsInFlickWindow(const TouchEvent& event) { return IsOverMinFlickSpeed() && event.type() != ui::ET_TOUCH_CANCELLED; } ",0 "static void vsock_sk_destruct(struct sock *sk) { struct vsock_sock *vsk = vsock_sk(sk); transport->destruct(vsk); /* When clearing these addresses, there's no need to set the family and * possibly register the address family with the kernel. */ vsock_addr_init(&vsk->local_addr, VMADDR_CID_ANY, VMADDR_PORT_ANY); vsock_addr_init(&vsk->remote_addr, VMADDR_CID_ANY, VMADDR_PORT_ANY); put_cred(vsk->owner); } ",0 "static int __init sha512_sparc64_mod_init(void) { if (sparc64_has_sha512_opcode()) { int ret = crypto_register_shash(&sha384); if (ret < 0) return ret; ret = crypto_register_shash(&sha512); if (ret < 0) { crypto_unregister_shash(&sha384); return ret; } pr_info(""Using sparc64 sha512 opcode optimized SHA-512/SHA-384 implementation\n""); return 0; } pr_info(""sparc64 sha512 opcode not available.\n""); return -ENODEV; } ",0 "KURL HTMLMediaElement::SelectNextSourceChild( String* content_type, InvalidURLAction action_if_invalid) { bool should_log = action_if_invalid != kDoNothing; if (should_log) BLINK_MEDIA_LOG << ""selectNextSourceChild("" << (void*)this << "")""; if (!next_child_node_to_consider_) { if (should_log) { BLINK_MEDIA_LOG << ""selectNextSourceChild("" << (void*)this << "") -> 0x0000, \""\""""; } return KURL(); } KURL media_url; Node* node; HTMLSourceElement* source = nullptr; String type; bool looking_for_start_node = next_child_node_to_consider_; bool can_use_source_element = false; NodeVector potential_source_nodes; GetChildNodes(*this, potential_source_nodes); for (unsigned i = 0; !can_use_source_element && i < potential_source_nodes.size(); ++i) { node = potential_source_nodes[i].Get(); if (looking_for_start_node && next_child_node_to_consider_ != node) continue; looking_for_start_node = false; if (!IsHTMLSourceElement(*node)) continue; if (node->parentNode() != this) continue; source = ToHTMLSourceElement(node); const AtomicString& src_value = source->FastGetAttribute(srcAttr); if (should_log) { BLINK_MEDIA_LOG << ""selectNextSourceChild("" << (void*)this << "") - 'src' is "" << UrlForLoggingMedia(media_url); } if (src_value.IsEmpty()) goto checkAgain; media_url = source->GetDocument().CompleteURL(src_value); if (!IsSafeToLoadURL(media_url, action_if_invalid)) goto checkAgain; type = source->type(); if (type.IsEmpty() && media_url.ProtocolIsData()) type = MimeTypeFromDataURL(media_url); if (!type.IsEmpty()) { if (should_log) { BLINK_MEDIA_LOG << ""selectNextSourceChild("" << (void*)this << "") - 'type' is '"" << type << ""'""; } if (!GetSupportsType(ContentType(type))) goto checkAgain; } can_use_source_element = true; checkAgain: if (!can_use_source_element && action_if_invalid == kComplain && source) source->ScheduleErrorEvent(); } if (can_use_source_element) { if (content_type) *content_type = type; current_source_node_ = source; next_child_node_to_consider_ = source->nextSibling(); } else { current_source_node_ = nullptr; next_child_node_to_consider_ = nullptr; } if (should_log) { BLINK_MEDIA_LOG << ""selectNextSourceChild("" << (void*)this << "") -> "" << current_source_node_.Get() << "", "" << (can_use_source_element ? UrlForLoggingMedia(media_url) : """"); } return can_use_source_element ? media_url : KURL(); } ",0 "void PasswordAutofillAgent::UpdateStateForTextChange( const WebInputElement& element) { if (!element.IsTextField()) return; WebInputElement mutable_element = element; // We need a non-const. const base::string16 element_value = element.Value().Utf16(); field_data_manager_.UpdateFieldDataMap(element, element_value, FieldPropertiesFlags::USER_TYPED); ProvisionallySavePassword(element.Form(), element, RESTRICTION_NONE); if (element.IsPasswordFieldForAutofill()) { auto iter = password_to_username_.find(element); if (iter != password_to_username_.end()) { web_input_to_password_info_[iter->second].password_was_edited_last = true; mutable_element.SetAutofillState(WebAutofillState::kNotFilled); } GetPasswordManagerDriver()->UserModifiedPasswordField(); } else { GetPasswordManagerDriver()->UserModifiedNonPasswordField( element.UniqueRendererFormControlId(), element_value); } } ",0 "String FileReaderLoader::ConvertToText() { if (!bytes_loaded_) return """"; StringBuilder builder; if (!decoder_) { decoder_ = TextResourceDecoder::Create(TextResourceDecoderOptions( TextResourceDecoderOptions::kPlainTextContent, encoding_.IsValid() ? encoding_ : UTF8Encoding())); } builder.Append(decoder_->Decode(static_cast(raw_data_->Data()), raw_data_->ByteLength())); if (finished_loading_) builder.Append(decoder_->Flush()); return builder.ToString(); } ",0 "void ProfileDependencyManager::AddComponent( ProfileKeyedBaseFactory* component) { all_components_.push_back(component); destruction_order_.clear(); } ",0 "coroutine_fn iscsi_co_write_zeroes(BlockDriverState *bs, int64_t sector_num, int nb_sectors, BdrvRequestFlags flags) { IscsiLun *iscsilun = bs->opaque; struct IscsiTask iTask; uint64_t lba; uint32_t nb_blocks; bool use_16_for_ws = iscsilun->use_16_for_rw; if (!is_request_lun_aligned(sector_num, nb_sectors, iscsilun)) { return -EINVAL; } if (flags & BDRV_REQ_MAY_UNMAP) { if (!use_16_for_ws && !iscsilun->lbp.lbpws10) { /* WRITESAME10 with UNMAP is unsupported try WRITESAME16 */ use_16_for_ws = true; } if (use_16_for_ws && !iscsilun->lbp.lbpws) { /* WRITESAME16 with UNMAP is not supported by the target, * fall back and try WRITESAME10/16 without UNMAP */ flags &= ~BDRV_REQ_MAY_UNMAP; use_16_for_ws = iscsilun->use_16_for_rw; } } if (!(flags & BDRV_REQ_MAY_UNMAP) && !iscsilun->has_write_same) { /* WRITESAME without UNMAP is not supported by the target */ return -ENOTSUP; } lba = sector_qemu2lun(sector_num, iscsilun); nb_blocks = sector_qemu2lun(nb_sectors, iscsilun); if (iscsilun->zeroblock == NULL) { iscsilun->zeroblock = g_try_malloc0(iscsilun->block_size); if (iscsilun->zeroblock == NULL) { return -ENOMEM; } } iscsi_co_init_iscsitask(iscsilun, &iTask); retry: if (use_16_for_ws) { iTask.task = iscsi_writesame16_task(iscsilun->iscsi, iscsilun->lun, lba, iscsilun->zeroblock, iscsilun->block_size, nb_blocks, 0, !!(flags & BDRV_REQ_MAY_UNMAP), 0, 0, iscsi_co_generic_cb, &iTask); } else { iTask.task = iscsi_writesame10_task(iscsilun->iscsi, iscsilun->lun, lba, iscsilun->zeroblock, iscsilun->block_size, nb_blocks, 0, !!(flags & BDRV_REQ_MAY_UNMAP), 0, 0, iscsi_co_generic_cb, &iTask); } if (iTask.task == NULL) { return -ENOMEM; } while (!iTask.complete) { iscsi_set_events(iscsilun); qemu_coroutine_yield(); } if (iTask.status == SCSI_STATUS_CHECK_CONDITION && iTask.task->sense.key == SCSI_SENSE_ILLEGAL_REQUEST && (iTask.task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_OPERATION_CODE || iTask.task->sense.ascq == SCSI_SENSE_ASCQ_INVALID_FIELD_IN_CDB)) { /* WRITE SAME is not supported by the target */ iscsilun->has_write_same = false; scsi_free_scsi_task(iTask.task); return -ENOTSUP; } if (iTask.task != NULL) { scsi_free_scsi_task(iTask.task); iTask.task = NULL; } if (iTask.do_retry) { iTask.complete = 0; goto retry; } if (iTask.status != SCSI_STATUS_GOOD) { return iTask.err_code; } if (flags & BDRV_REQ_MAY_UNMAP) { iscsi_allocationmap_clear(iscsilun, sector_num, nb_sectors); } else { iscsi_allocationmap_set(iscsilun, sector_num, nb_sectors); } return 0; } ",0 " void DevToolsDomainHandler::Wire(UberDispatcher* dispatcher) { } ",0 "set_runtime_config(char *admin, char *config) { int i; if (!admin || !admin[0] || !enable_runtime) { if (admin) { free(admin); } if (config) { free(config); } return -1; } if (config && config[0]) { for (i=0; i <= rArray.getlast(); i++) { if (strcmp(rArray[i].admin, admin) == MATCH) { free(admin); free(rArray[i].config); rArray[i].config = config; return 0; } } rArray[i].admin = admin; rArray[i].config = config; } else { for (i=0; i <= rArray.getlast(); i++) { if (strcmp(rArray[i].admin, admin) == MATCH) { free(admin); if (config) free(config); free(rArray[i].admin); free(rArray[i].config); rArray[i] = rArray[rArray.getlast()]; rArray[rArray.getlast()].initialize(); rArray.truncate(rArray.getlast()-1); return 0; } } } return 0; } ",0 "PassRefPtr BackwardsCharacterIterator::range() const { RefPtr r = m_textIterator.range(); if (!m_textIterator.atEnd()) { if (m_textIterator.length() <= 1) ASSERT(m_runOffset == 0); else { Node* n = r->startContainer(); ASSERT(n == r->endContainer()); int offset = r->endOffset() - m_runOffset; r->setStart(n, offset - 1, ASSERT_NO_EXCEPTION); r->setEnd(n, offset, ASSERT_NO_EXCEPTION); } } return r.release(); } ",0 "MagickExport Quantum *GetAuthenticPixels(Image *image,const ssize_t x, const ssize_t y,const size_t columns,const size_t rows, ExceptionInfo *exception) { CacheInfo *magick_restrict cache_info; const int id = GetOpenMPThreadId(); Quantum *pixels; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickCoreSignature); if (cache_info->methods.get_authentic_pixels_handler != (GetAuthenticPixelsHandler) NULL) { pixels=cache_info->methods.get_authentic_pixels_handler(image,x,y,columns, rows,exception); return(pixels); } assert(id < (int) cache_info->number_threads); pixels=GetAuthenticPixelCacheNexus(image,x,y,columns,rows, cache_info->nexus_info[id],exception); return(pixels); } ",0 "MagickExport ImageInfo *CloneImageInfo(const ImageInfo *image_info) { ImageInfo *clone_info; clone_info=AcquireImageInfo(); if (image_info == (ImageInfo *) NULL) return(clone_info); clone_info->compression=image_info->compression; clone_info->temporary=image_info->temporary; clone_info->adjoin=image_info->adjoin; clone_info->antialias=image_info->antialias; clone_info->scene=image_info->scene; clone_info->number_scenes=image_info->number_scenes; clone_info->depth=image_info->depth; (void) CloneString(&clone_info->size,image_info->size); (void) CloneString(&clone_info->extract,image_info->extract); (void) CloneString(&clone_info->scenes,image_info->scenes); (void) CloneString(&clone_info->page,image_info->page); clone_info->interlace=image_info->interlace; clone_info->endian=image_info->endian; clone_info->units=image_info->units; clone_info->quality=image_info->quality; (void) CloneString(&clone_info->sampling_factor,image_info->sampling_factor); (void) CloneString(&clone_info->server_name,image_info->server_name); (void) CloneString(&clone_info->font,image_info->font); (void) CloneString(&clone_info->texture,image_info->texture); (void) CloneString(&clone_info->density,image_info->density); clone_info->pointsize=image_info->pointsize; clone_info->fuzz=image_info->fuzz; clone_info->pen=image_info->pen; clone_info->background_color=image_info->background_color; clone_info->border_color=image_info->border_color; clone_info->matte_color=image_info->matte_color; clone_info->transparent_color=image_info->transparent_color; clone_info->dither=image_info->dither; clone_info->monochrome=image_info->monochrome; clone_info->colors=image_info->colors; clone_info->colorspace=image_info->colorspace; clone_info->type=image_info->type; clone_info->orientation=image_info->orientation; clone_info->preview_type=image_info->preview_type; clone_info->group=image_info->group; clone_info->ping=image_info->ping; clone_info->verbose=image_info->verbose; (void) CloneString(&clone_info->view,image_info->view); (void) CloneString(&clone_info->authenticate,image_info->authenticate); (void) CloneImageOptions(clone_info,image_info); clone_info->progress_monitor=image_info->progress_monitor; clone_info->client_data=image_info->client_data; clone_info->cache=image_info->cache; if (image_info->cache != (void *) NULL) clone_info->cache=ReferencePixelCache(image_info->cache); if (image_info->profile != (void *) NULL) clone_info->profile=(void *) CloneStringInfo((StringInfo *) image_info->profile); SetImageInfoFile(clone_info,image_info->file); SetImageInfoBlob(clone_info,image_info->blob,image_info->length); clone_info->stream=image_info->stream; clone_info->virtual_pixel_method=image_info->virtual_pixel_method; (void) CopyMagickString(clone_info->magick,image_info->magick,MaxTextExtent); (void) CopyMagickString(clone_info->unique,image_info->unique,MaxTextExtent); (void) CopyMagickString(clone_info->zero,image_info->zero,MaxTextExtent); (void) CopyMagickString(clone_info->filename,image_info->filename, MaxTextExtent); clone_info->subimage=image_info->scene; /* deprecated */ clone_info->subrange=image_info->number_scenes; /* deprecated */ clone_info->channel=image_info->channel; clone_info->debug=IsEventLogging(); clone_info->signature=image_info->signature; return(clone_info); } ",0 "void CairoOutputDev::updateMiterLimit(GfxState *state) { cairo_set_miter_limit (cairo, state->getMiterLimit()); if (cairo_shape) cairo_set_miter_limit (cairo_shape, state->getMiterLimit()); } ",0 "static int tcp_send_mss(struct sock *sk, int *size_goal, int flags) { int mss_now; mss_now = tcp_current_mss(sk); *size_goal = tcp_xmit_size_goal(sk, mss_now, !(flags & MSG_OOB)); return mss_now; } ",0 "bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, bool recursive) { base::ThreadRestrictions::AssertIOAllowed(); DCHECK(to_path.value().find('*') == std::string::npos); DCHECK(from_path.value().find('*') == std::string::npos); char top_dir[PATH_MAX]; if (base::strlcpy(top_dir, from_path.value().c_str(), arraysize(top_dir)) >= arraysize(top_dir)) { return false; } FilePath real_to_path = to_path; if (PathExists(real_to_path)) { if (!AbsolutePath(&real_to_path)) return false; } else { real_to_path = real_to_path.DirName(); if (!AbsolutePath(&real_to_path)) return false; } FilePath real_from_path = from_path; if (!AbsolutePath(&real_from_path)) return false; if (real_to_path.value().size() >= real_from_path.value().size() && real_to_path.value().compare(0, real_from_path.value().size(), real_from_path.value()) == 0) return false; bool success = true; int traverse_type = FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS; if (recursive) traverse_type |= FileEnumerator::DIRECTORIES; FileEnumerator traversal(from_path, recursive, traverse_type); FileEnumerator::FindInfo info; FilePath current = from_path; if (stat(from_path.value().c_str(), &info.stat) < 0) { DLOG(ERROR) << ""CopyDirectory() couldn't stat source directory: "" << from_path.value() << "" errno = "" << errno; success = false; } struct stat to_path_stat; FilePath from_path_base = from_path; if (recursive && stat(to_path.value().c_str(), &to_path_stat) == 0 && S_ISDIR(to_path_stat.st_mode)) { from_path_base = from_path.DirName(); } DCHECK(recursive || S_ISDIR(info.stat.st_mode)); while (success && !current.empty()) { std::string suffix(¤t.value().c_str()[from_path_base.value().size()]); if (!suffix.empty()) { DCHECK_EQ('/', suffix[0]); suffix.erase(0, 1); } const FilePath target_path = to_path.Append(suffix); if (S_ISDIR(info.stat.st_mode)) { if (mkdir(target_path.value().c_str(), info.stat.st_mode & 01777) != 0 && errno != EEXIST) { DLOG(ERROR) << ""CopyDirectory() couldn't create directory: "" << target_path.value() << "" errno = "" << errno; success = false; } } else if (S_ISREG(info.stat.st_mode)) { if (!CopyFile(current, target_path)) { DLOG(ERROR) << ""CopyDirectory() couldn't create file: "" << target_path.value(); success = false; } } else { DLOG(WARNING) << ""CopyDirectory() skipping non-regular file: "" << current.value(); } current = traversal.Next(); traversal.GetFindInfo(&info); } return success; } ",1 "int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) { struct passwd *pw = NULL, pw_s; const char *user = NULL; cfg_t cfg_st; cfg_t *cfg = &cfg_st; char buffer[BUFSIZE]; char *buf = NULL; char *authfile_dir; size_t authfile_dir_len; int pgu_ret, gpn_ret; int retval = PAM_IGNORE; device_t *devices = NULL; unsigned n_devices = 0; int openasuser; int should_free_origin = 0; int should_free_appid = 0; int should_free_auth_file = 0; int should_free_authpending_file = 0; parse_cfg(flags, argc, argv, cfg); if (!cfg->origin) { strcpy(buffer, DEFAULT_ORIGIN_PREFIX); if (gethostname(buffer + strlen(DEFAULT_ORIGIN_PREFIX), BUFSIZE - strlen(DEFAULT_ORIGIN_PREFIX)) == -1) { DBG(""Unable to get host name""); goto done; } DBG(""Origin not specified, using \""%s\"""", buffer); cfg->origin = strdup(buffer); if (!cfg->origin) { DBG(""Unable to allocate memory""); goto done; } else { should_free_origin = 1; } } if (!cfg->appid) { DBG(""Appid not specified, using the same value of origin (%s)"", cfg->origin); cfg->appid = strdup(cfg->origin); if (!cfg->appid) { DBG(""Unable to allocate memory"") goto done; } else { should_free_appid = 1; } } if (cfg->max_devs == 0) { DBG(""Maximum devices number not set. Using default (%d)"", MAX_DEVS); cfg->max_devs = MAX_DEVS; } devices = malloc(sizeof(device_t) * cfg->max_devs); if (!devices) { DBG(""Unable to allocate memory""); retval = PAM_IGNORE; goto done; } pgu_ret = pam_get_user(pamh, &user, NULL); if (pgu_ret != PAM_SUCCESS || user == NULL) { DBG(""Unable to access user %s"", user); retval = PAM_CONV_ERR; goto done; } DBG(""Requesting authentication for user %s"", user); gpn_ret = getpwnam_r(user, &pw_s, buffer, sizeof(buffer), &pw); if (gpn_ret != 0 || pw == NULL || pw->pw_dir == NULL || pw->pw_dir[0] != '/') { DBG(""Unable to retrieve credentials for user %s, (%s)"", user, strerror(errno)); retval = PAM_USER_UNKNOWN; goto done; } DBG(""Found user %s"", user); DBG(""Home directory for %s is %s"", user, pw->pw_dir); if (!cfg->auth_file) { buf = NULL; authfile_dir = secure_getenv(DEFAULT_AUTHFILE_DIR_VAR); if (!authfile_dir) { DBG(""Variable %s is not set. Using default value ($HOME/.config/)"", DEFAULT_AUTHFILE_DIR_VAR); authfile_dir_len = strlen(pw->pw_dir) + strlen(""/.config"") + strlen(DEFAULT_AUTHFILE) + 1; buf = malloc(sizeof(char) * (authfile_dir_len)); if (!buf) { DBG(""Unable to allocate memory""); retval = PAM_IGNORE; goto done; } snprintf(buf, authfile_dir_len, ""%s/.config%s"", pw->pw_dir, DEFAULT_AUTHFILE); } else { DBG(""Variable %s set to %s"", DEFAULT_AUTHFILE_DIR_VAR, authfile_dir); authfile_dir_len = strlen(authfile_dir) + strlen(DEFAULT_AUTHFILE) + 1; buf = malloc(sizeof(char) * (authfile_dir_len)); if (!buf) { DBG(""Unable to allocate memory""); retval = PAM_IGNORE; goto done; } snprintf(buf, authfile_dir_len, ""%s%s"", authfile_dir, DEFAULT_AUTHFILE); } DBG(""Using default authentication file %s"", buf); cfg->auth_file = buf; /* cfg takes ownership */ should_free_auth_file = 1; buf = NULL; } else { DBG(""Using authentication file %s"", cfg->auth_file); } openasuser = geteuid() == 0 && cfg->openasuser; if (openasuser) { if (seteuid(pw_s.pw_uid)) { DBG(""Unable to switch user to uid %i"", pw_s.pw_uid); retval = PAM_IGNORE; goto done; } DBG(""Switched to uid %i"", pw_s.pw_uid); } retval = get_devices_from_authfile(cfg->auth_file, user, cfg->max_devs, cfg->debug, cfg->debug_file, devices, &n_devices); if (openasuser) { if (seteuid(0)) { DBG(""Unable to switch back to uid 0""); retval = PAM_IGNORE; goto done; } DBG(""Switched back to uid 0""); } if (retval != 1) { n_devices = 0; } if (n_devices == 0) { if (cfg->nouserok) { DBG(""Found no devices but nouserok specified. Skipping authentication""); retval = PAM_SUCCESS; goto done; } else if (retval != 1) { DBG(""Unable to get devices from file %s"", cfg->auth_file); retval = PAM_AUTHINFO_UNAVAIL; goto done; } else { DBG(""Found no devices. Aborting.""); retval = PAM_AUTHINFO_UNAVAIL; goto done; } } if (!cfg->authpending_file) { int actual_size = snprintf(buffer, BUFSIZE, DEFAULT_AUTHPENDING_FILE_PATH, getuid()); if (actual_size >= 0 && actual_size < BUFSIZE) { cfg->authpending_file = strdup(buffer); } if (!cfg->authpending_file) { DBG(""Unable to allocate memory for the authpending_file, touch request notifications will not be emitted""); } else { should_free_authpending_file = 1; } } else { if (strlen(cfg->authpending_file) == 0) { DBG(""authpending_file is set to an empty value, touch request notifications will be disabled""); cfg->authpending_file = NULL; } } int authpending_file_descriptor = -1; if (cfg->authpending_file) { DBG(""Using file '%s' for emitting touch request notifications"", cfg->authpending_file); authpending_file_descriptor = open(cfg->authpending_file, O_RDONLY | O_CREAT, 0664); if (authpending_file_descriptor < 0) { DBG(""Unable to emit 'authentication started' notification by opening the file '%s', (%s)"", cfg->authpending_file, strerror(errno)); } } if (cfg->manual == 0) { if (cfg->interactive) { converse(pamh, PAM_PROMPT_ECHO_ON, cfg->prompt != NULL ? cfg->prompt : DEFAULT_PROMPT); } retval = do_authentication(cfg, devices, n_devices, pamh); } else { retval = do_manual_authentication(cfg, devices, n_devices, pamh); } if (authpending_file_descriptor >= 0) { if (close(authpending_file_descriptor) < 0) { DBG(""Unable to emit 'authentication stopped' notification by closing the file '%s', (%s)"", cfg->authpending_file, strerror(errno)); } } if (retval != 1) { DBG(""do_authentication returned %d"", retval); retval = PAM_AUTH_ERR; goto done; } retval = PAM_SUCCESS; done: free_devices(devices, n_devices); if (buf) { free(buf); buf = NULL; } if (should_free_origin) { free((char *) cfg->origin); cfg->origin = NULL; } if (should_free_appid) { free((char *) cfg->appid); cfg->appid = NULL; } if (should_free_auth_file) { free((char *) cfg->auth_file); cfg->auth_file = NULL; } if (should_free_authpending_file) { free((char *) cfg->authpending_file); cfg->authpending_file = NULL; } if (cfg->alwaysok && retval != PAM_SUCCESS) { DBG(""alwaysok needed (otherwise return with %d)"", retval); retval = PAM_SUCCESS; } DBG(""done. [%s]"", pam_strerror(pamh, retval)); return retval; } ",1 "void BlockedPlugin::ShowContextMenu(const WebKit::WebMouseEvent& event) { WebContextMenuData menu_data; WebVector custom_items(static_cast(4)); WebMenuItemInfo name_item; name_item.label = name_; custom_items[0] = name_item; WebMenuItemInfo separator_item; separator_item.type = WebMenuItemInfo::Separator; custom_items[1] = separator_item; WebMenuItemInfo run_item; run_item.action = kMenuActionLoad; run_item.enabled = true; run_item.label = WebString::fromUTF8( l10n_util::GetStringUTF8(IDS_CONTENT_CONTEXT_PLUGIN_RUN).c_str()); custom_items[2] = run_item; WebMenuItemInfo hide_item; hide_item.action = kMenuActionRemove; hide_item.enabled = true; hide_item.label = WebString::fromUTF8( l10n_util::GetStringUTF8(IDS_CONTENT_CONTEXT_PLUGIN_HIDE).c_str()); custom_items[3] = hide_item; menu_data.customItems.swap(custom_items); menu_data.mousePosition = WebPoint(event.windowX, event.windowY); render_view()->showContextMenu(NULL, menu_data); gLastActiveMenu = this; } ",0 "static inline int getPixelOverflowPalette(gdImagePtr im, const int x, const int y, const int bgColor) { if (gdImageBoundsSafe(im, x, y)) { const int c = im->pixels[y][x]; if (c == im->transparent) { return bgColor == -1 ? gdTrueColorAlpha(0, 0, 0, 127) : bgColor; } return colorIndex2RGBA(c); } else { return bgColor; } } ",0 "png_get_pHYs_dpi(png_structp png_ptr, png_infop info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, int *unit_type) { png_uint_32 retval = 0; if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs)) { png_debug1(1, ""in %s retrieval function"", ""pHYs""); if (res_x != NULL) { *res_x = info_ptr->x_pixels_per_unit; retval |= PNG_INFO_pHYs; } if (res_y != NULL) { *res_y = info_ptr->y_pixels_per_unit; retval |= PNG_INFO_pHYs; } if (unit_type != NULL) { *unit_type = (int)info_ptr->phys_unit_type; retval |= PNG_INFO_pHYs; if (*unit_type == 1) { if (res_x != NULL) *res_x = (png_uint_32)(*res_x * .0254 + .50); if (res_y != NULL) *res_y = (png_uint_32)(*res_y * .0254 + .50); } } } return (retval); } ",0 " void RemoveProcess(RenderProcessHost* host) { std::set sites; for (SiteToProcessMap::const_iterator i = map_.begin(); i != map_.end(); i++) { if (i->second == host) sites.insert(i->first); } for (std::set::iterator i = sites.begin(); i != sites.end(); i++) { SiteToProcessMap::iterator iter = map_.find(*i); if (iter != map_.end()) { DCHECK_EQ(iter->second, host); map_.erase(iter); } } } ",0 "static void IRQ_check(OpenPICState *opp, IRQQueue *q) { int irq = -1; int next = -1; int priority = -1; for (;;) { irq = find_next_bit(q->queue, opp->max_irq, irq + 1); if (irq == opp->max_irq) { break; } DPRINTF(""IRQ_check: irq %d set ivpr_pr=%d pr=%d\n"", irq, IVPR_PRIORITY(opp->src[irq].ivpr), priority); if (IVPR_PRIORITY(opp->src[irq].ivpr) > priority) { next = irq; priority = IVPR_PRIORITY(opp->src[irq].ivpr); } } q->next = next; q->priority = priority; } ",0 "void OmniboxViewViews::AppendDropFormats( int* formats, std::set* custom_formats) { *formats = *formats | ui::OSExchangeData::URL; } ",0 "long Tags::Parse() { IMkvReader* const pReader = m_pSegment->m_pReader; long long pos = m_start; // payload start const long long stop = pos + m_size; // payload stop while (pos < stop) { long long id, size; long status = ParseElementHeader(pReader, pos, stop, id, size); if (status < 0) return status; if (size == 0) // 0 length tag, read another continue; if (id == 0x3373) { // Tag ID status = ParseTag(pos, size); if (status < 0) return status; } pos += size; if (pos > stop) return E_FILE_FORMAT_INVALID; } if (pos != stop) return E_FILE_FORMAT_INVALID; return 0; } ",0 "static void DetectRunTx(ThreadVars *tv, DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, Packet *p, Flow *f, DetectRunScratchpad *scratch) { const uint8_t flow_flags = scratch->flow_flags; const SigGroupHead * const sgh = scratch->sgh; void * const alstate = f->alstate; const uint8_t ipproto = f->proto; const AppProto alproto = f->alproto; const uint64_t total_txs = AppLayerParserGetTxCnt(f, alstate); uint64_t tx_id_min = AppLayerParserGetTransactionInspectId(f->alparser, flow_flags); const int tx_end_state = AppLayerParserGetStateProgressCompletionStatus(alproto, flow_flags); AppLayerGetTxIteratorFunc IterFunc = AppLayerGetTxIterator(ipproto, alproto); AppLayerGetTxIterState state; memset(&state, 0, sizeof(state)); while (1) { AppLayerGetTxIterTuple ires = IterFunc(ipproto, alproto, alstate, tx_id_min, total_txs, &state); if (ires.tx_ptr == NULL) break; DetectTransaction tx = GetDetectTx(ipproto, alproto, alstate, ires.tx_id, ires.tx_ptr, tx_end_state, flow_flags); if (tx.tx_ptr == NULL) { SCLogDebug(""%p/%""PRIu64"" no transaction to inspect"", tx.tx_ptr, tx_id_min); tx_id_min++; // next (if any) run look for +1 goto next; } tx_id_min = tx.tx_id + 1; // next look for cur + 1 uint32_t array_idx = 0; uint32_t total_rules = det_ctx->match_array_cnt; total_rules += (tx.de_state ? tx.de_state->cnt : 0); /* run prefilter engines and merge results into a candidates array */ if (sgh->tx_engines) { PACKET_PROFILING_DETECT_START(p, PROF_DETECT_PF_TX); DetectRunPrefilterTx(det_ctx, sgh, p, ipproto, flow_flags, alproto, alstate, &tx); PACKET_PROFILING_DETECT_END(p, PROF_DETECT_PF_TX); SCLogDebug(""%p/%""PRIu64"" rules added from prefilter: %u candidates"", tx.tx_ptr, tx.tx_id, det_ctx->pmq.rule_id_array_cnt); total_rules += det_ctx->pmq.rule_id_array_cnt; if (!(RuleMatchCandidateTxArrayHasSpace(det_ctx, total_rules))) { RuleMatchCandidateTxArrayExpand(det_ctx, total_rules); } for (uint32_t i = 0; i < det_ctx->pmq.rule_id_array_cnt; i++) { const Signature *s = de_ctx->sig_array[det_ctx->pmq.rule_id_array[i]]; const SigIntId id = s->num; det_ctx->tx_candidates[array_idx].s = s; det_ctx->tx_candidates[array_idx].id = id; det_ctx->tx_candidates[array_idx].flags = NULL; det_ctx->tx_candidates[array_idx].stream_reset = 0; array_idx++; } } else { if (!(RuleMatchCandidateTxArrayHasSpace(det_ctx, total_rules))) { RuleMatchCandidateTxArrayExpand(det_ctx, total_rules); } } /* merge 'state' rules from the regular prefilter */ uint32_t x = array_idx; for (uint32_t i = 0; i < det_ctx->match_array_cnt; i++) { const Signature *s = det_ctx->match_array[i]; if (s->app_inspect != NULL) { const SigIntId id = s->num; det_ctx->tx_candidates[array_idx].s = s; det_ctx->tx_candidates[array_idx].id = id; det_ctx->tx_candidates[array_idx].flags = NULL; det_ctx->tx_candidates[array_idx].stream_reset = 0; array_idx++; SCLogDebug(""%p/%""PRIu64"" rule %u (%u) added from 'match' list"", tx.tx_ptr, tx.tx_id, s->id, id); } } SCLogDebug(""%p/%""PRIu64"" rules added from 'match' list: %u"", tx.tx_ptr, tx.tx_id, array_idx - x); (void)x; /* merge stored state into results */ if (tx.de_state != NULL) { const uint32_t old = array_idx; /* if tx.de_state->flags has 'new file' set and sig below has * 'file inspected' flag, reset the file part of the state */ const bool have_new_file = (tx.de_state->flags & DETECT_ENGINE_STATE_FLAG_FILE_NEW); if (have_new_file) { SCLogDebug(""%p/%""PRIu64"" destate: need to consider new file"", tx.tx_ptr, tx.tx_id); tx.de_state->flags &= ~DETECT_ENGINE_STATE_FLAG_FILE_NEW; } SigIntId state_cnt = 0; DeStateStore *tx_store = tx.de_state->head; for (; tx_store != NULL; tx_store = tx_store->next) { SCLogDebug(""tx_store %p"", tx_store); SigIntId store_cnt = 0; for (store_cnt = 0; store_cnt < DE_STATE_CHUNK_SIZE && state_cnt < tx.de_state->cnt; store_cnt++, state_cnt++) { DeStateStoreItem *item = &tx_store->store[store_cnt]; SCLogDebug(""rule id %u, inspect_flags %u"", item->sid, item->flags); if (have_new_file && (item->flags & DE_STATE_FLAG_FILE_INSPECT)) { /* remove part of the state. File inspect engine will now * be able to run again */ item->flags &= ~(DE_STATE_FLAG_SIG_CANT_MATCH|DE_STATE_FLAG_FULL_INSPECT|DE_STATE_FLAG_FILE_INSPECT); SCLogDebug(""rule id %u, post file reset inspect_flags %u"", item->sid, item->flags); } det_ctx->tx_candidates[array_idx].s = de_ctx->sig_array[item->sid]; det_ctx->tx_candidates[array_idx].id = item->sid; det_ctx->tx_candidates[array_idx].flags = &item->flags; det_ctx->tx_candidates[array_idx].stream_reset = 0; array_idx++; } } if (old && old != array_idx) { qsort(det_ctx->tx_candidates, array_idx, sizeof(RuleMatchCandidateTx), DetectRunTxSortHelper); SCLogDebug(""%p/%""PRIu64"" rules added from 'continue' list: %u"", tx.tx_ptr, tx.tx_id, array_idx - old); } } det_ctx->tx_id = tx.tx_id; det_ctx->tx_id_set = 1; det_ctx->p = p; /* run rules: inspect the match candidates */ for (uint32_t i = 0; i < array_idx; i++) { RuleMatchCandidateTx *can = &det_ctx->tx_candidates[i]; const Signature *s = det_ctx->tx_candidates[i].s; uint32_t *inspect_flags = det_ctx->tx_candidates[i].flags; /* deduplicate: rules_array is sorted, but not deduplicated: * both mpm and stored state could give us the same sid. * As they are back to back in that case we can check for it * here. We select the stored state one. */ if ((i + 1) < array_idx) { if (det_ctx->tx_candidates[i].s == det_ctx->tx_candidates[i+1].s) { if (det_ctx->tx_candidates[i].flags != NULL) { i++; SCLogDebug(""%p/%""PRIu64"" inspecting SKIP NEXT: sid %u (%u), flags %08x"", tx.tx_ptr, tx.tx_id, s->id, s->num, inspect_flags ? *inspect_flags : 0); } else if (det_ctx->tx_candidates[i+1].flags != NULL) { SCLogDebug(""%p/%""PRIu64"" inspecting SKIP CURRENT: sid %u (%u), flags %08x"", tx.tx_ptr, tx.tx_id, s->id, s->num, inspect_flags ? *inspect_flags : 0); continue; } else { i++; SCLogDebug(""%p/%""PRIu64"" inspecting SKIP NEXT: sid %u (%u), flags %08x"", tx.tx_ptr, tx.tx_id, s->id, s->num, inspect_flags ? *inspect_flags : 0); } } } SCLogDebug(""%p/%""PRIu64"" inspecting: sid %u (%u), flags %08x"", tx.tx_ptr, tx.tx_id, s->id, s->num, inspect_flags ? *inspect_flags : 0); if (inspect_flags) { if (*inspect_flags & (DE_STATE_FLAG_FULL_INSPECT|DE_STATE_FLAG_SIG_CANT_MATCH)) { SCLogDebug(""%p/%""PRIu64"" inspecting: sid %u (%u), flags %08x ALREADY COMPLETE"", tx.tx_ptr, tx.tx_id, s->id, s->num, *inspect_flags); continue; } } if (inspect_flags) { /* continue previous inspection */ SCLogDebug(""%p/%""PRIu64"" Continueing sid %u"", tx.tx_ptr, tx.tx_id, s->id); } else { /* start new inspection */ SCLogDebug(""%p/%""PRIu64"" Start sid %u"", tx.tx_ptr, tx.tx_id, s->id); } /* call individual rule inspection */ RULE_PROFILING_START(p); const int r = DetectRunTxInspectRule(tv, de_ctx, det_ctx, p, f, flow_flags, alstate, &tx, s, inspect_flags, can, scratch); if (r == 1) { /* match */ DetectRunPostMatch(tv, det_ctx, p, s); uint8_t alert_flags = (PACKET_ALERT_FLAG_STATE_MATCH|PACKET_ALERT_FLAG_TX); if (s->action & ACTION_DROP) alert_flags |= PACKET_ALERT_FLAG_DROP_FLOW; SCLogDebug(""%p/%""PRIu64"" sig %u (%u) matched"", tx.tx_ptr, tx.tx_id, s->id, s->num); if (!(s->flags & SIG_FLAG_NOALERT)) { PacketAlertAppend(det_ctx, s, p, tx.tx_id, alert_flags); } else { DetectSignatureApplyActions(p, s, alert_flags); } } DetectVarProcessList(det_ctx, p->flow, p); RULE_PROFILING_END(det_ctx, s, r, p); } det_ctx->tx_id = 0; det_ctx->tx_id_set = 0; det_ctx->p = NULL; /* see if we have any updated state to store in the tx */ uint64_t new_detect_flags = 0; /* this side of the tx is done */ if (tx.tx_progress >= tx.tx_end_state) { new_detect_flags |= APP_LAYER_TX_INSPECTED_FLAG; SCLogDebug(""%p/%""PRIu64"" tx is done for direction %s. Flag %016""PRIx64, tx.tx_ptr, tx.tx_id, flow_flags & STREAM_TOSERVER ? ""toserver"" : ""toclient"", new_detect_flags); } if (tx.prefilter_flags != tx.prefilter_flags_orig) { new_detect_flags |= tx.prefilter_flags; SCLogDebug(""%p/%""PRIu64"" updated prefilter flags %016""PRIx64"" "" ""(was: %016""PRIx64"") for direction %s. Flag %016""PRIx64, tx.tx_ptr, tx.tx_id, tx.prefilter_flags, tx.prefilter_flags_orig, flow_flags & STREAM_TOSERVER ? ""toserver"" : ""toclient"", new_detect_flags); } if (new_detect_flags != 0 && (new_detect_flags | tx.detect_flags) != tx.detect_flags) { new_detect_flags |= tx.detect_flags; SCLogDebug(""%p/%""PRIu64"" Storing new flags %016""PRIx64"" (was %016""PRIx64"")"", tx.tx_ptr, tx.tx_id, new_detect_flags, tx.detect_flags); AppLayerParserSetTxDetectFlags(ipproto, alproto, tx.tx_ptr, flow_flags, new_detect_flags); } next: InspectionBufferClean(det_ctx); if (!ires.has_next) break; } } ",0 "static void airo_end_xmit11(struct net_device *dev) { u16 status; int i; struct airo_info *priv = dev->ml_priv; struct sk_buff *skb = priv->xmit11.skb; int fid = priv->xmit11.fid; u32 *fids = priv->fids; clear_bit(JOB_XMIT11, &priv->jobs); clear_bit(FLAG_PENDING_XMIT11, &priv->flags); status = transmit_802_11_packet (priv, fids[fid], skb->data); up(&priv->sem); i = MAX_FIDS / 2; if ( status == SUCCESS ) { dev->trans_start = jiffies; for (; i < MAX_FIDS && (priv->fids[i] & 0xffff0000); i++); } else { priv->fids[fid] &= 0xffff; dev->stats.tx_window_errors++; } if (i < MAX_FIDS) netif_wake_queue(dev); dev_kfree_skb(skb); } ",0 "sctp_disposition_t sctp_sf_timer_ignore(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { SCTP_DEBUG_PRINTK(""Timer %d ignored.\n"", type.chunk); return SCTP_DISPOSITION_CONSUME; } ",0 "poll_interval(int upper_bound) { unsigned interval, r, mask; interval = 1 << G.poll_exp; if (interval > upper_bound) interval = upper_bound; mask = ((interval-1) >> 4) | 1; r = rand(); interval += r & mask; /* ~ random(0..1) * interval/16 */ VERB4 bb_error_msg(""chose poll interval:%u (poll_exp:%d)"", interval, G.poll_exp); return interval; } ",0 "void xlenCommand(client *c) { robj *o; if ((o = lookupKeyReadOrReply(c,c->argv[1],shared.czero)) == NULL || checkType(c,o,OBJ_STREAM)) return; stream *s = o->ptr; addReplyLongLong(c,s->length); } ",0 "void NetworkThrottleManagerImpl::ThrottleImpl::NotifyUnblocked() { DCHECK_EQ(State::BLOCKED, state_); state_ = State::OUTSTANDING; delegate_->OnThrottleUnblocked(this); } ",0 "static const char *set_expect_strict(cmd_parms *cmd, void *dummy, int arg) { core_server_config *conf = ap_get_core_module_config(cmd->server->module_config); if (arg) { conf->http_expect_strict = AP_HTTP_EXPECT_STRICT_ENABLE; } else { conf->http_expect_strict = AP_HTTP_EXPECT_STRICT_DISABLE; } return NULL; } ",0 "void ScriptController::updateSecurityOrigin() { m_windowShell->updateSecurityOrigin(); } ",0 "static int ReadBlobLZWByte(LZWInfo *lzw_info) { int code; size_t one, value; ssize_t count; if (lzw_info->stack->index != lzw_info->stack->codes) return(PopLZWStack(lzw_info->stack)); if (lzw_info->genesis != MagickFalse) { lzw_info->genesis=MagickFalse; do { lzw_info->first_code=(size_t) GetNextLZWCode(lzw_info,lzw_info->bits); lzw_info->last_code=lzw_info->first_code; } while (lzw_info->first_code == lzw_info->clear_code); return((int) lzw_info->first_code); } code=GetNextLZWCode(lzw_info,lzw_info->bits); if (code < 0) return(code); if ((size_t) code == lzw_info->clear_code) { ResetLZWInfo(lzw_info); return(ReadBlobLZWByte(lzw_info)); } if ((size_t) code == lzw_info->end_code) return(-1); if ((size_t) code < lzw_info->slot) value=(size_t) code; else { PushLZWStack(lzw_info->stack,lzw_info->first_code); value=lzw_info->last_code; } count=0; while (value > lzw_info->maximum_data_value) { if ((size_t) count > MaximumLZWCode) return(-1); count++; if ((size_t) value > MaximumLZWCode) return(-1); PushLZWStack(lzw_info->stack,lzw_info->table[1][value]); value=lzw_info->table[0][value]; } lzw_info->first_code=lzw_info->table[1][value]; PushLZWStack(lzw_info->stack,lzw_info->first_code); one=1; if (lzw_info->slot < MaximumLZWCode) { lzw_info->table[0][lzw_info->slot]=lzw_info->last_code; lzw_info->table[1][lzw_info->slot]=lzw_info->first_code; lzw_info->slot++; if ((lzw_info->slot >= lzw_info->maximum_code) && (lzw_info->bits < MaximumLZWBits)) { lzw_info->bits++; lzw_info->maximum_code=one << lzw_info->bits; } } lzw_info->last_code=(size_t) code; return(PopLZWStack(lzw_info->stack)); } ",0 "int hfi1_device_create(struct hfi1_devdata *dd) { int r, ret; r = user_add(dd); ret = hfi1_diag_add(dd); if (r && !ret) ret = r; return ret; } ",0 "void Browser::TabStripEmpty() { MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&Browser::CloseFrame, weak_factory_.GetWeakPtr())); } ",0 "ProcXFixesChangeCursorByName(ClientPtr client) { CursorPtr pSource; Atom name; char *tchar; REQUEST(xXFixesChangeCursorByNameReq); REQUEST_FIXED_SIZE(xXFixesChangeCursorByNameReq, stuff->nbytes); VERIFY_CURSOR(pSource, stuff->source, client, DixReadAccess | DixGetAttrAccess); tchar = (char *) &stuff[1]; name = MakeAtom(tchar, stuff->nbytes, FALSE); if (name) ReplaceCursor(pSource, TestForCursorName, &name); return Success; } ",0 "void DelegatedFrameHost::CopyFromCompositingSurfaceHasResultForVideo( base::WeakPtr dfh, scoped_refptr subscriber_texture, scoped_refptr video_frame, const base::Callback& callback, std::unique_ptr result) { base::ScopedClosureRunner scoped_callback_runner( base::Bind(callback, gfx::Rect(), false)); base::ScopedClosureRunner scoped_return_subscriber_texture(base::Bind( &ReturnSubscriberTexture, dfh, subscriber_texture, gpu::SyncToken())); if (!dfh) return; if (result->IsEmpty()) return; if (result->size().IsEmpty()) return; gfx::Rect region_in_frame = media::ComputeLetterboxRegion( video_frame->visible_rect(), result->size()); region_in_frame = gfx::Rect(region_in_frame.x() & ~1, region_in_frame.y() & ~1, region_in_frame.width() & ~1, region_in_frame.height() & ~1); if (region_in_frame.IsEmpty()) return; if (!result->HasTexture()) { DCHECK(result->HasBitmap()); std::unique_ptr bitmap = result->TakeBitmap(); SkBitmap scaled_bitmap; if (result->size() != region_in_frame.size()) { skia::ImageOperations::ResizeMethod method = skia::ImageOperations::RESIZE_GOOD; scaled_bitmap = skia::ImageOperations::Resize(*bitmap.get(), method, region_in_frame.width(), region_in_frame.height()); } else { scaled_bitmap = *bitmap.get(); } media::CopyRGBToVideoFrame( reinterpret_cast(scaled_bitmap.getPixels()), scaled_bitmap.rowBytes(), region_in_frame, video_frame.get()); ignore_result(scoped_callback_runner.Release()); callback.Run(region_in_frame, true); return; } ImageTransportFactory* factory = ImageTransportFactory::GetInstance(); viz::GLHelper* gl_helper = factory->GetGLHelper(); if (!gl_helper) return; if (subscriber_texture.get() && !subscriber_texture->texture_id()) return; viz::TextureMailbox texture_mailbox; std::unique_ptr release_callback; result->TakeTexture(&texture_mailbox, &release_callback); DCHECK(texture_mailbox.IsTexture()); gfx::Rect result_rect(result->size()); viz::ReadbackYUVInterface* yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); if (yuv_readback_pipeline == NULL || yuv_readback_pipeline->scaler()->SrcSize() != result_rect.size() || yuv_readback_pipeline->scaler()->SrcSubrect() != result_rect || yuv_readback_pipeline->scaler()->DstSize() != region_in_frame.size()) { viz::GLHelper::ScalerQuality quality = ((result_rect.size().width() < region_in_frame.size().width()) && (result_rect.size().height() < region_in_frame.size().height())) ? viz::GLHelper::SCALER_QUALITY_BEST : viz::GLHelper::SCALER_QUALITY_FAST; DVLOG(1) << ""Re-creating YUV readback pipeline for source rect "" << result_rect.ToString() << "" and destination size "" << region_in_frame.size().ToString(); dfh->yuv_readback_pipeline_.reset(gl_helper->CreateReadbackPipelineYUV( quality, result_rect.size(), result_rect, region_in_frame.size(), true, true)); yuv_readback_pipeline = dfh->yuv_readback_pipeline_.get(); } ignore_result(scoped_callback_runner.Release()); ignore_result(scoped_return_subscriber_texture.Release()); base::Callback finished_callback = base::Bind( &DelegatedFrameHost::CopyFromCompositingSurfaceFinishedForVideo, video_frame, dfh->AsWeakPtr(), base::Bind(callback, region_in_frame), subscriber_texture, base::Passed(&release_callback)); yuv_readback_pipeline->ReadbackYUV( texture_mailbox.mailbox(), texture_mailbox.sync_token(), video_frame->visible_rect(), video_frame->stride(media::VideoFrame::kYPlane), video_frame->data(media::VideoFrame::kYPlane), video_frame->stride(media::VideoFrame::kUPlane), video_frame->data(media::VideoFrame::kUPlane), video_frame->stride(media::VideoFrame::kVPlane), video_frame->data(media::VideoFrame::kVPlane), region_in_frame.origin(), finished_callback); media::LetterboxYUV(video_frame.get(), region_in_frame); } ",0 "void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, size_t datalen, RIL_SOCKET_ID socket_id) #else extern ""C"" void RIL_onUnsolicitedResponse(int unsolResponse, const void *data, size_t datalen) #endif { int unsolResponseIndex; int ret; int64_t timeReceived = 0; bool shouldScheduleTimeout = false; RIL_RadioState newState; RIL_SOCKET_ID soc_id = RIL_SOCKET_1; #if defined(ANDROID_MULTI_SIM) soc_id = socket_id; #endif if (s_registerCalled == 0) { RLOGW(""RIL_onUnsolicitedResponse called before RIL_register""); return; } unsolResponseIndex = unsolResponse - RIL_UNSOL_RESPONSE_BASE; if ((unsolResponseIndex < 0) || (unsolResponseIndex >= (int32_t)NUM_ELEMS(s_unsolResponses))) { RLOGE(""unsupported unsolicited response code %d"", unsolResponse); return; } switch (s_unsolResponses[unsolResponseIndex].wakeType) { case WAKE_PARTIAL: grabPartialWakeLock(); shouldScheduleTimeout = true; break; case DONT_WAKE: default: shouldScheduleTimeout = false; break; } if (unsolResponse == RIL_UNSOL_NITZ_TIME_RECEIVED) { timeReceived = elapsedRealtime(); } appendPrintBuf(""[UNSL]< %s"", requestToString(unsolResponse)); Parcel p; if (s_callbacks.version >= 13 && s_unsolResponses[unsolResponseIndex].wakeType == WAKE_PARTIAL) { p.writeInt32 (RESPONSE_UNSOLICITED_ACK_EXP); } else { p.writeInt32 (RESPONSE_UNSOLICITED); } p.writeInt32 (unsolResponse); ret = s_unsolResponses[unsolResponseIndex] .responseFunction(p, const_cast(data), datalen); if (ret != 0) { goto error_exit; } switch(unsolResponse) { case RIL_UNSOL_RESPONSE_RADIO_STATE_CHANGED: newState = processRadioState(CALL_ONSTATEREQUEST(soc_id), soc_id); p.writeInt32(newState); appendPrintBuf(""%s {%s}"", printBuf, radioStateToString(CALL_ONSTATEREQUEST(soc_id))); break; case RIL_UNSOL_NITZ_TIME_RECEIVED: p.writeInt64(timeReceived); break; } if (s_callbacks.version < 13) { if (shouldScheduleTimeout) { UserCallbackInfo *p_info = internalRequestTimedCallback(wakeTimeoutCallback, NULL, &TIMEVAL_WAKE_TIMEOUT); if (p_info == NULL) { goto error_exit; } else { if (s_last_wake_timeout_info != NULL) { s_last_wake_timeout_info->userParam = (void *)1; } s_last_wake_timeout_info = p_info; } } } #if VDBG RLOGI(""%s UNSOLICITED: %s length:%d"", rilSocketIdToString(soc_id), requestToString(unsolResponse), p.dataSize()); #endif ret = sendResponse(p, soc_id); if (ret != 0 && unsolResponse == RIL_UNSOL_NITZ_TIME_RECEIVED) { if (s_lastNITZTimeData != NULL) { free (s_lastNITZTimeData); s_lastNITZTimeData = NULL; } s_lastNITZTimeData = calloc(p.dataSize(), 1); if (s_lastNITZTimeData == NULL) { RLOGE(""Memory allocation failed in RIL_onUnsolicitedResponse""); goto error_exit; } s_lastNITZTimeDataSize = p.dataSize(); memcpy(s_lastNITZTimeData, p.data(), p.dataSize()); } return; error_exit: if (shouldScheduleTimeout) { releaseWakeLock(); } } ",0 "static struct tun_flow_entry *tun_flow_create(struct tun_struct *tun, struct hlist_head *head, u32 rxhash, u16 queue_index) { struct tun_flow_entry *e = kmalloc(sizeof(*e), GFP_ATOMIC); if (e) { tun_debug(KERN_INFO, tun, ""create flow: hash %u index %u\n"", rxhash, queue_index); e->updated = jiffies; e->rxhash = rxhash; e->rps_rxhash = 0; e->queue_index = queue_index; e->tun = tun; hlist_add_head_rcu(&e->hash_link, head); ++tun->flow_count; } return e; } ",0 "struct chunk *http_error_message(struct session *s, int msgnum) { if (s->be->errmsg[msgnum].str) return &s->be->errmsg[msgnum]; else if (s->fe->errmsg[msgnum].str) return &s->fe->errmsg[msgnum]; else return &http_err_chunks[msgnum]; } ",0 "int32_t ReverbGetDiffusion(ReverbContext *pContext){ LVREV_ControlParams_st ActiveParams; /* Current control Parameters */ LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */ LVM_INT16 Temp; /* Get the current settings */ LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVREV_GetControlParameters"", ""ReverbGetDiffusion"") Temp = (LVM_INT16)(pContext->SavedDiffusion/10); if(ActiveParams.Density != Temp){ ALOGV(""\tLVM_ERROR : ReverbGetDiffusion invalid value %d %d"", Temp, ActiveParams.Density); } return pContext->SavedDiffusion; } ",0 "static int packet_sendmsg_spkt(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct sockaddr_pkt *saddr = (struct sockaddr_pkt *)msg->msg_name; struct sk_buff *skb = NULL; struct net_device *dev; __be16 proto = 0; int err; int extra_len = 0; /* * Get and verify the address. */ if (saddr) { if (msg->msg_namelen < sizeof(struct sockaddr)) return -EINVAL; if (msg->msg_namelen == sizeof(struct sockaddr_pkt)) proto = saddr->spkt_protocol; } else return -ENOTCONN; /* SOCK_PACKET must be sent giving an address */ /* * Find the device first to size check it */ saddr->spkt_device[sizeof(saddr->spkt_device) - 1] = 0; retry: rcu_read_lock(); dev = dev_get_by_name_rcu(sock_net(sk), saddr->spkt_device); err = -ENODEV; if (dev == NULL) goto out_unlock; err = -ENETDOWN; if (!(dev->flags & IFF_UP)) goto out_unlock; /* * You may not queue a frame bigger than the mtu. This is the lowest level * raw protocol and you must do your own fragmentation at this level. */ if (unlikely(sock_flag(sk, SOCK_NOFCS))) { if (!netif_supports_nofcs(dev)) { err = -EPROTONOSUPPORT; goto out_unlock; } extra_len = 4; /* We're doing our own CRC */ } err = -EMSGSIZE; if (len > dev->mtu + dev->hard_header_len + VLAN_HLEN + extra_len) goto out_unlock; if (!skb) { size_t reserved = LL_RESERVED_SPACE(dev); int tlen = dev->needed_tailroom; unsigned int hhlen = dev->header_ops ? dev->hard_header_len : 0; rcu_read_unlock(); skb = sock_wmalloc(sk, len + reserved + tlen, 0, GFP_KERNEL); if (skb == NULL) return -ENOBUFS; /* FIXME: Save some space for broken drivers that write a hard * header at transmission time by themselves. PPP is the notable * one here. This should really be fixed at the driver level. */ skb_reserve(skb, reserved); skb_reset_network_header(skb); /* Try to align data part correctly */ if (hhlen) { skb->data -= hhlen; skb->tail -= hhlen; if (len < hhlen) skb_reset_network_header(skb); } err = memcpy_fromiovec(skb_put(skb, len), msg->msg_iov, len); if (err) goto out_free; goto retry; } if (len > (dev->mtu + dev->hard_header_len + extra_len)) { /* Earlier code assumed this would be a VLAN pkt, * double-check this now that we have the actual * packet in hand. */ struct ethhdr *ehdr; skb_reset_mac_header(skb); ehdr = eth_hdr(skb); if (ehdr->h_proto != htons(ETH_P_8021Q)) { err = -EMSGSIZE; goto out_unlock; } } skb->protocol = proto; skb->dev = dev; skb->priority = sk->sk_priority; skb->mark = sk->sk_mark; sock_tx_timestamp(sk, &skb_shinfo(skb)->tx_flags); if (unlikely(extra_len == 4)) skb->no_fcs = 1; skb_probe_transport_header(skb, 0); dev_queue_xmit(skb); rcu_read_unlock(); return len; out_unlock: rcu_read_unlock(); out_free: kfree_skb(skb); return err; } ",0 "void h2o_http2_accept(h2o_accept_ctx_t *ctx, h2o_socket_t *sock, struct timeval connected_at) { h2o_http2_conn_t *conn = create_conn(ctx->ctx, ctx->hosts, sock, connected_at); sock->data = conn; h2o_socket_read_start(conn->sock, on_read); update_idle_timeout(conn); if (sock->input->size != 0) on_read(sock, 0); } ",0 "static int edge_ioctl(struct tty_struct *tty, unsigned int cmd, unsigned long arg) { struct usb_serial_port *port = tty->driver_data; struct edgeport_port *edge_port = usb_get_serial_port_data(port); switch (cmd) { case TIOCGSERIAL: dev_dbg(&port->dev, ""%s - TIOCGSERIAL\n"", __func__); return get_serial_info(edge_port, (struct serial_struct __user *) arg); } return -ENOIOCTLCMD; } ",0 "status_t Parcel::writeBoolVector(const std::unique_ptr>& val) { return writeNullableTypedVector(val, &Parcel::writeBool); } ",0 " tt_cmap8_char_next( TT_CMap cmap, FT_UInt32 *pchar_code ) { FT_Face face = cmap->cmap.charmap.face; FT_UInt32 result = 0; FT_UInt32 char_code; FT_UInt gindex = 0; FT_Byte* table = cmap->data; FT_Byte* p = table + 8204; FT_UInt32 num_groups = TT_NEXT_ULONG( p ); FT_UInt32 start, end, start_id; if ( *pchar_code >= 0xFFFFFFFFUL ) return 0; char_code = *pchar_code + 1; p = table + 8208; for ( ; num_groups > 0; num_groups-- ) { start = TT_NEXT_ULONG( p ); end = TT_NEXT_ULONG( p ); start_id = TT_NEXT_ULONG( p ); if ( char_code < start ) char_code = start; Again: if ( char_code <= end ) { /* ignore invalid group */ if ( start_id > 0xFFFFFFFFUL - ( char_code - start ) ) continue; gindex = (FT_UInt)( start_id + ( char_code - start ) ); /* does first element of group point to `.notdef' glyph? */ if ( gindex == 0 ) { if ( char_code >= 0xFFFFFFFFUL ) break; char_code++; goto Again; } /* if `gindex' is invalid, the remaining values */ /* in this group are invalid, too */ if ( gindex >= (FT_UInt)face->num_glyphs ) { gindex = 0; continue; } result = char_code; break; } } *pchar_code = result; return gindex; } ",0 "bool RenderFrameHostImpl::IsRenderFrameCreated() { return render_frame_created_; } ",0 "TestingPlatformSupport::TestingPlatformSupport(const Config& config) : m_config(config) , m_oldPlatform(Platform::current()) { Platform::initialize(this); } ",0 "static int perf_read_one(struct perf_event *event, u64 read_format, char __user *buf) { u64 enabled, running; u64 values[4]; int n = 0; values[n++] = perf_event_read_value(event, &enabled, &running); if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) values[n++] = enabled; if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) values[n++] = running; if (read_format & PERF_FORMAT_ID) values[n++] = primary_event_id(event); if (copy_to_user(buf, values, n * sizeof(u64))) return -EFAULT; return n * sizeof(u64); } ",0 "PageInfoUI::PageFeatureInfo::PageFeatureInfo() : is_vr_presentation_in_headset(false) {} ",0 "String Document::referrer() const { if (loader()) return loader()->request().httpReferrer(); return String(); } ",0 "static bool NeedsScrollOrScrollTranslation(const LayoutObject& object) { if (!object.HasOverflowClip()) return false; IntSize scroll_offset = ToLayoutBox(object).ScrolledContentOffset(); return !scroll_offset.IsZero() || NeedsScrollNode(object); } ",0 "static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *p) { memcpy(&x->id, &p->id, sizeof(x->id)); memcpy(&x->sel, &p->sel, sizeof(x->sel)); memcpy(&x->lft, &p->lft, sizeof(x->lft)); x->props.mode = p->mode; x->props.replay_window = p->replay_window; x->props.reqid = p->reqid; x->props.family = p->family; memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr)); x->props.flags = p->flags; if (!x->sel.family && !(p->flags & XFRM_STATE_AF_UNSPEC)) x->sel.family = p->family; } ",0 "void ExtensionHelper::OnInlineWebstoreInstallResponse( int install_id, bool success, const std::string& error) { ChromeWebstoreExtension::HandleInstallResponse(install_id, success, error); } ",0 "static void shortAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""shortAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt16(jsValue, exceptionState), exceptionState); imp->setShortAttribute(cppValue); } ",0 "void Camera3Device::PreparerThread::setNotificationListener(NotificationListener *listener) { Mutex::Autolock l(mLock); mListener = listener; } ",0 "static void sctp_v6_addr_v4map(struct sctp_sock *sp, union sctp_addr *addr) { if (sp->v4mapped && AF_INET == addr->sa.sa_family) sctp_v4_map_v6(addr); } ",0 "void LocalSiteCharacteristicsDataImpl::NotifyUsesAudioInBackground() { NotifyFeatureUsage(site_characteristics_.mutable_uses_audio_in_background()); } ",0 "static int common_hrtimer_try_to_cancel(struct k_itimer *timr) { return hrtimer_try_to_cancel(&timr->it.real.timer); } ",0 "void ahci_reset(AHCIState *s) { AHCIPortRegs *pr; int i; s->control_regs.irqstatus = 0; /* AHCI Enable (AE) * The implementation of this bit is dependent upon the value of the * CAP.SAM bit. If CAP.SAM is '0', then GHC.AE shall be read-write and * shall have a reset value of '0'. If CAP.SAM is '1', then AE shall be * read-only and shall have a reset value of '1'. * * We set HOST_CAP_AHCI so we must enable AHCI at reset. */ s->control_regs.ghc = HOST_CTL_AHCI_EN; for (i = 0; i < s->ports; i++) { pr = &s->dev[i].port_regs; pr->irq_stat = 0; pr->irq_mask = 0; pr->scr_ctl = 0; pr->cmd = PORT_CMD_SPIN_UP | PORT_CMD_POWER_ON; ahci_reset_port(s, i); } } ",0 "static unsigned int __cbc_decrypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk) { struct cast5_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); const unsigned int bsize = CAST5_BLOCK_SIZE; unsigned int nbytes = walk->nbytes; u64 *src = (u64 *)walk->src.virt.addr; u64 *dst = (u64 *)walk->dst.virt.addr; u64 last_iv; /* Start of the last block. */ src += nbytes / bsize - 1; dst += nbytes / bsize - 1; last_iv = *src; /* Process multi-block batch */ if (nbytes >= bsize * CAST5_PARALLEL_BLOCKS) { do { nbytes -= bsize * (CAST5_PARALLEL_BLOCKS - 1); src -= CAST5_PARALLEL_BLOCKS - 1; dst -= CAST5_PARALLEL_BLOCKS - 1; cast5_cbc_dec_16way(ctx, (u8 *)dst, (u8 *)src); nbytes -= bsize; if (nbytes < bsize) goto done; *dst ^= *(src - 1); src -= 1; dst -= 1; } while (nbytes >= bsize * CAST5_PARALLEL_BLOCKS); } /* Handle leftovers */ for (;;) { __cast5_decrypt(ctx, (u8 *)dst, (u8 *)src); nbytes -= bsize; if (nbytes < bsize) break; *dst ^= *(src - 1); src -= 1; dst -= 1; } done: *dst ^= *(u64 *)walk->iv; *(u64 *)walk->iv = last_iv; return nbytes; } ",0 "asmlinkage void __sched schedule(void) { struct task_struct *prev, *next; unsigned long *switch_count; struct rq *rq; int cpu; need_resched: preempt_disable(); cpu = smp_processor_id(); rq = cpu_rq(cpu); rcu_note_context_switch(cpu); prev = rq->curr; release_kernel_lock(prev); need_resched_nonpreemptible: schedule_debug(prev); if (sched_feat(HRTICK)) hrtick_clear(rq); raw_spin_lock_irq(&rq->lock); clear_tsk_need_resched(prev); switch_count = &prev->nivcsw; if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) { if (unlikely(signal_pending_state(prev->state, prev))) { prev->state = TASK_RUNNING; } else { /* * If a worker is going to sleep, notify and * ask workqueue whether it wants to wake up a * task to maintain concurrency. If so, wake * up the task. */ if (prev->flags & PF_WQ_WORKER) { struct task_struct *to_wakeup; to_wakeup = wq_worker_sleeping(prev, cpu); if (to_wakeup) try_to_wake_up_local(to_wakeup); } deactivate_task(rq, prev, DEQUEUE_SLEEP); } switch_count = &prev->nvcsw; } pre_schedule(rq, prev); if (unlikely(!rq->nr_running)) idle_balance(cpu, rq); put_prev_task(rq, prev); next = pick_next_task(rq); if (likely(prev != next)) { sched_info_switch(prev, next); perf_event_task_sched_out(prev, next); rq->nr_switches++; rq->curr = next; ++*switch_count; context_switch(rq, prev, next); /* unlocks the rq */ /* * The context switch have flipped the stack from under us * and restored the local variables which were saved when * this task called schedule() in the past. prev == current * is still correct, but it can be moved to another cpu/rq. */ cpu = smp_processor_id(); rq = cpu_rq(cpu); } else raw_spin_unlock_irq(&rq->lock); post_schedule(rq); if (unlikely(reacquire_kernel_lock(prev))) goto need_resched_nonpreemptible; preempt_enable_no_resched(); if (need_resched()) goto need_resched; } ",1 "void Browser::WebContentsCreated(WebContents* source_contents, int opener_render_process_id, int opener_render_frame_id, const std::string& frame_name, const GURL& target_url, WebContents* new_contents) { TabHelpers::AttachTabHelpers(new_contents); task_manager::WebContentsTags::CreateForTabContents(new_contents); } ",0 "create_property_node(Node **np, ScanEnv* env, const char* propname) { int r; CClassNode* cc; *np = node_new_cclass(); if (IS_NULL(*np)) return ONIGERR_MEMORY; cc = NCCLASS(*np); r = add_property_to_cc(cc, propname, 0, env); if (r != 0) onig_node_free(*np); return r; } ",0 "static int dvb_usbv2_adapter_exit(struct dvb_usb_device *d) { int i; dev_dbg(&d->udev->dev, ""%s:\n"", __func__); for (i = MAX_NO_OF_ADAPTER_PER_DEVICE - 1; i >= 0; i--) { if (d->adapter[i].props) { dvb_usbv2_adapter_dvb_exit(&d->adapter[i]); dvb_usbv2_adapter_stream_exit(&d->adapter[i]); dvb_usbv2_adapter_frontend_exit(&d->adapter[i]); dvb_usbv2_media_device_unregister(&d->adapter[i]); } } return 0; } ",0 "static int64_t coroutine_fn qcow2_co_get_block_status(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int *pnum) { BDRVQcowState *s = bs->opaque; uint64_t cluster_offset; int index_in_cluster, ret; int64_t status = 0; *pnum = nb_sectors; qemu_co_mutex_lock(&s->lock); ret = qcow2_get_cluster_offset(bs, sector_num << 9, pnum, &cluster_offset); qemu_co_mutex_unlock(&s->lock); if (ret < 0) { return ret; } if (cluster_offset != 0 && ret != QCOW2_CLUSTER_COMPRESSED && !s->crypt_method) { index_in_cluster = sector_num & (s->cluster_sectors - 1); cluster_offset |= (index_in_cluster << BDRV_SECTOR_BITS); status |= BDRV_BLOCK_OFFSET_VALID | cluster_offset; } if (ret == QCOW2_CLUSTER_ZERO) { status |= BDRV_BLOCK_ZERO; } else if (ret != QCOW2_CLUSTER_UNALLOCATED) { status |= BDRV_BLOCK_DATA; } return status; } ",0 "void Browser::OnWindowDidShow() { if (window_has_shown_) return; window_has_shown_ = true; #if defined(OS_MACOSX) || defined(OS_WIN) static bool is_first_browser_window = true; if (is_first_browser_window && !startup_metric_utils::WasNonBrowserUIDisplayed()) { is_first_browser_window = false; const base::Time* process_creation_time = base::CurrentProcessInfo::CreationTime(); if (process_creation_time) { UMA_HISTOGRAM_LONG_TIMES( ""Startup.BrowserWindowDisplay"", base::Time::Now() - *process_creation_time); } } #endif // defined(OS_MACOSX) || defined(OS_WIN) if (!is_type_tabbed()) return; GlobalErrorService* service = GlobalErrorServiceFactory::GetForProfile(profile()); GlobalError* error = service->GetFirstGlobalErrorWithBubbleView(); if (error) error->ShowBubbleView(this); } ",0 "void BrowserMainLoop::MainMessageLoopRun() { #if defined(OS_ANDROID) NOTREACHED(); #else DCHECK(base::MessageLoopForUI::IsCurrent()); if (parameters_.ui_task) { base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, *parameters_.ui_task); } base::RunLoop run_loop; run_loop.Run(); #endif } ",0 "GLuint GLES2Implementation::CreateImageCHROMIUM(ClientBuffer buffer, GLsizei width, GLsizei height, GLenum internalformat) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG(""["" << GetLogPrefix() << ""] glCreateImageCHROMIUM("" << width << "", "" << height << "", "" << GLES2Util::GetStringImageInternalFormat(internalformat) << "")""); GLuint image_id = CreateImageCHROMIUMHelper(buffer, width, height, internalformat); CheckGLError(); return image_id; } ",0 "static vpx_codec_err_t decoder_set_fb_fn( vpx_codec_alg_priv_t *ctx, vpx_get_frame_buffer_cb_fn_t cb_get, vpx_release_frame_buffer_cb_fn_t cb_release, void *cb_priv) { if (cb_get == NULL || cb_release == NULL) { return VPX_CODEC_INVALID_PARAM; } else if (ctx->frame_workers == NULL) { ctx->get_ext_fb_cb = cb_get; ctx->release_ext_fb_cb = cb_release; ctx->ext_priv = cb_priv; return VPX_CODEC_OK; } return VPX_CODEC_ERROR; } ",0 "static const char *ifsection(cmd_parms *cmd, void *mconfig, const char *arg) { const char *errmsg; const char *endp = ap_strrchr_c(arg, '>'); int old_overrides = cmd->override; char *old_path = cmd->path; core_dir_config *conf; const command_rec *thiscmd = cmd->cmd; ap_conf_vector_t *new_if_conf = ap_create_per_dir_config(cmd->pool); const char *err = ap_check_cmd_context(cmd, NOT_IN_LIMIT); const char *condition; const char *expr_err; if (err != NULL) { return err; } if (endp == NULL) { return unclosed_directive(cmd); } arg = apr_pstrndup(cmd->temp_pool, arg, endp - arg); /* * Set a dummy value so that other directives notice that they are inside * a config section. */ cmd->path = ""*If""; /* Only if not an .htaccess file */ if (!old_path) { cmd->override = OR_ALL|ACCESS_CONF; } /* initialize our config and fetch it */ conf = ap_set_config_vectors(cmd->server, new_if_conf, cmd->path, &core_module, cmd->pool); if (cmd->cmd->cmd_data == COND_IF) conf->condition_ifelse = AP_CONDITION_IF; else if (cmd->cmd->cmd_data == COND_ELSEIF) conf->condition_ifelse = AP_CONDITION_ELSEIF; else if (cmd->cmd->cmd_data == COND_ELSE) conf->condition_ifelse = AP_CONDITION_ELSE; else ap_assert(0); if (conf->condition_ifelse == AP_CONDITION_ELSE) { if (arg[0]) return "" does not take an argument""; } else { if (!arg[0]) return missing_container_arg(cmd); condition = ap_getword_conf(cmd->pool, &arg); conf->condition = ap_expr_parse_cmd(cmd, condition, 0, &expr_err, NULL); if (expr_err) return apr_psprintf(cmd->pool, ""Cannot parse condition clause: %s"", expr_err); } errmsg = ap_walk_config(cmd->directive->first_child, cmd, new_if_conf); if (errmsg != NULL) return errmsg; conf->d = cmd->path; conf->d_is_fnmatch = 0; conf->r = NULL; errmsg = ap_add_if_conf(cmd->pool, (core_dir_config *)mconfig, new_if_conf); if (errmsg != NULL) return errmsg; if (*arg != '\0') { return apr_pstrcat(cmd->pool, ""Multiple "", thiscmd->name, ""> arguments not supported."", NULL); } cmd->path = old_path; cmd->override = old_overrides; return NULL; } ",0 "BaseShadow::evictJob( int reason ) { MyString from_where; MyString machine; if( getMachineName(machine) ) { from_where.sprintf("" from %s"",machine.Value()); } dprintf( D_ALWAYS, ""Job %d.%d is being evicted%s\n"", getCluster(), getProc(), from_where.Value() ); if( ! jobAd ) { dprintf( D_ALWAYS, ""In evictJob() w/ NULL JobAd!"" ); DC_Exit( reason ); } cleanUp(); logEvictEvent( reason ); char buf[64]; sprintf( buf, ""%s = %d"", ATTR_LAST_VACATE_TIME, (int)time(0) ); jobAd->Insert( buf ); if( !updateJobInQueue(U_EVICT) ) { dprintf( D_ALWAYS, ""Failed to update job queue!\n"" ); } DC_Exit( reason ); } ",0 "static bool blk_update_bidi_request(struct request *rq, blk_status_t error, unsigned int nr_bytes, unsigned int bidi_bytes) { if (blk_update_request(rq, error, nr_bytes)) return true; /* Bidi request must be completed as a whole */ if (unlikely(blk_bidi_rq(rq)) && blk_update_request(rq->next_rq, error, bidi_bytes)) return true; if (blk_queue_add_random(rq->q)) add_disk_randomness(rq->rq_disk); return false; } ",0 "void DiskCacheBackendTest::BackendShutdownWithPendingIO(bool fast) { net::TestCompletionCallback cb; { ASSERT_TRUE(CleanupCacheDir()); uint32_t flags = disk_cache::kNoBuffering; if (!fast) flags |= disk_cache::kNoRandom; CreateBackend(flags); disk_cache::Entry* entry; int rv = cache_->CreateEntry(""some key"", &entry, cb.callback()); ASSERT_THAT(cb.GetResult(rv), IsOk()); entry->Close(); cache_.reset(); } base::RunLoop().RunUntilIdle(); EXPECT_FALSE(cb.have_result()); } ",0 "static void longArrayMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::longArrayMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "gsicc_set_device_profile_colorants(gx_device *dev, char *name_str) { int code; cmm_dev_profile_t *profile_struct; gsicc_colorname_t *name_entry; gsicc_colorname_t **curr_entry; gs_memory_t *mem; char *temp_ptr, *last = NULL; int done; gsicc_namelist_t *spot_names; char *pch; int str_len; int k; bool free_str = false; code = dev_proc(dev, get_profile)((gx_device *)dev, &profile_struct); if (profile_struct != NULL) { int count = 0; if (name_str == NULL) { /* Create a default name string that we can use */ int total_len; int kk; int num_comps = profile_struct->device_profile[0]->num_comps; char temp_str[DEFAULT_ICC_COLORANT_LENGTH+2]; /* If names are already set then we do not want to set default ones */ if (profile_struct->spotnames != NULL) return 0; free_str = true; /* Assume first 4 are CMYK */ total_len = ((DEFAULT_ICC_COLORANT_LENGTH + 1) * (num_comps-4)) + DEFAULT_ICC_PROCESS_LENGTH - 1; /* -1 due to no comma at end */ name_str = (char*) gs_alloc_bytes(dev->memory, total_len+1, ""gsicc_set_device_profile_colorants""); if (name_str == NULL) return gs_throw(gs_error_VMerror, ""Insufficient memory for colorant name""); gs_sprintf(name_str, DEFAULT_ICC_PROCESS); for (kk = 0; kk < num_comps-5; kk++) { gs_sprintf(temp_str,""ICC_COLOR_%d,"",kk); strcat(name_str,temp_str); } /* Last one no comma */ gs_sprintf(temp_str,""ICC_COLOR_%d"",kk); strcat(name_str,temp_str); } str_len = strlen(name_str); if (profile_struct->spotnames != NULL && profile_struct->spotnames->name_str != NULL && strlen(profile_struct->spotnames->name_str) == str_len) { /* Here we check if the names are the same */ if (strncmp(name_str, profile_struct->spotnames->name_str, str_len) == 0) { if (free_str) gs_free_object(dev->memory, name_str, ""gsicc_set_device_profile_colorants""); return 0; } } mem = dev->memory->non_gc_memory; /* We need to free the existing one if there was one */ if (profile_struct->spotnames != NULL) { /* Free the linked list in this object */ gsicc_free_spotnames(profile_struct->spotnames, mem); /* Free the main object */ gs_free_object(mem, profile_struct->spotnames, ""gsicc_set_device_profile_colorants""); } /* Allocate structure for managing names */ spot_names = gsicc_new_namelist(mem); profile_struct->spotnames = spot_names; spot_names->name_str = (char*) gs_alloc_bytes(mem, str_len+1, ""gsicc_set_device_profile_colorants""); if (spot_names->name_str == NULL) return gs_throw(gs_error_VMerror, ""Insufficient memory for spot name""); memcpy(spot_names->name_str, name_str, strlen(name_str)); spot_names->name_str[str_len] = 0; curr_entry = &(spot_names->head); /* Go ahead and tokenize now */ pch = gs_strtok(name_str, "","", &last); count = 0; while (pch != NULL) { temp_ptr = pch; done = 0; /* Remove any leading spaces */ while (!done) { if (*temp_ptr == 0x20) { temp_ptr++; } else { done = 1; } } /* Allocate a new name object */ name_entry = gsicc_new_colorname(mem); /* Set our current entry to this one */ *curr_entry = name_entry; name_entry->length = strlen(temp_ptr); name_entry->name = (char *) gs_alloc_bytes(mem, name_entry->length, ""gsicc_set_device_profile_colorants""); if (spot_names->name_str == NULL) return gs_throw(gs_error_VMerror, ""Insufficient memory for spot name""); memcpy(name_entry->name, temp_ptr, name_entry->length); /* Get the next entry location */ curr_entry = &((*curr_entry)->next); count += 1; pch = gs_strtok(NULL, "","", &last); } spot_names->count = count; /* Create the color map. Query the device to find out where these colorants are located. It is possible that the device may not be opened yet. In which case, we need to make sure that when it is opened that it checks this entry and gets itself properly initialized if it is a separation device. */ spot_names->color_map = (gs_devicen_color_map*) gs_alloc_bytes(mem, sizeof(gs_devicen_color_map), ""gsicc_set_device_profile_colorants""); if (spot_names->color_map == NULL) return gs_throw(gs_error_VMerror, ""Insufficient memory for spot color map""); spot_names->color_map->num_colorants = count; spot_names->color_map->num_components = count; name_entry = spot_names->head; for (k = 0; k < count; k++) { int colorant_number = (*dev_proc(dev, get_color_comp_index)) (dev, (const char *)name_entry->name, name_entry->length, SEPARATION_NAME); name_entry = name_entry->next; spot_names->color_map->color_map[k] = colorant_number; } /* We need to set the equivalent CMYK color for this colorant. This is done by faking out the update spot equivalent call with a special gs_gstate and color space that makes it seem like the spot color is a separation color space. Unfortunately, we need the graphic state to do this so we save it for later when we try to do our first mapping. We then use this flag to know if we did it yet */ spot_names->equiv_cmyk_set = false; if (free_str) gs_free_object(dev->memory, name_str, ""gsicc_set_device_profile_colorants""); } return code; } ",0 "int usb_lock_device_for_reset(struct usb_device *udev, const struct usb_interface *iface) { unsigned long jiffies_expire = jiffies + HZ; if (udev->state == USB_STATE_NOTATTACHED) return -ENODEV; if (udev->state == USB_STATE_SUSPENDED) return -EHOSTUNREACH; if (iface && (iface->condition == USB_INTERFACE_UNBINDING || iface->condition == USB_INTERFACE_UNBOUND)) return -EINTR; while (!usb_trylock_device(udev)) { /* If we can't acquire the lock after waiting one second, * we're probably deadlocked */ if (time_after(jiffies, jiffies_expire)) return -EBUSY; msleep(15); if (udev->state == USB_STATE_NOTATTACHED) return -ENODEV; if (udev->state == USB_STATE_SUSPENDED) return -EHOSTUNREACH; if (iface && (iface->condition == USB_INTERFACE_UNBINDING || iface->condition == USB_INTERFACE_UNBOUND)) return -EINTR; } return 0; } ",0 "bool PermissionsData::ShouldSkipPermissionWarnings( const std::string& extension_id) { return extension_id == extension_misc::kProdHangoutsExtensionId; } ",0 "static void spl_array_unset_dimension_ex(int check_inherited, zval *object, zval *offset TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); long index; HashTable *ht; if (check_inherited && intern->fptr_offset_del) { SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_del, ""offsetUnset"", NULL, offset); zval_ptr_dtor(&offset); return; } switch(Z_TYPE_P(offset)) { case IS_STRING: ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->nApplyCount > 0) { zend_error(E_WARNING, ""Modification of ArrayObject during sorting is prohibited""); return; } if (ht == &EG(symbol_table)) { if (zend_delete_global_variable(Z_STRVAL_P(offset), Z_STRLEN_P(offset) TSRMLS_CC)) { zend_error(E_NOTICE,""Undefined index: %s"", Z_STRVAL_P(offset)); } } else { if (zend_symtable_del(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1) == FAILURE) { zend_error(E_NOTICE,""Undefined index: %s"", Z_STRVAL_P(offset)); } else { spl_array_object *obj = intern; while (1) { if ((obj->ar_flags & SPL_ARRAY_IS_SELF) != 0) { break; } else if (Z_TYPE_P(obj->array) == IS_OBJECT) { if ((obj->ar_flags & SPL_ARRAY_USE_OTHER) == 0) { obj = (spl_array_object*)zend_object_store_get_object(obj->array TSRMLS_CC); break; } else { obj = (spl_array_object*)zend_object_store_get_object(obj->array TSRMLS_CC); } } else { obj = NULL; break; } } if (obj) { zend_property_info *property_info = zend_get_property_info(obj->std.ce, offset, 1 TSRMLS_CC); if (property_info && (property_info->flags & ZEND_ACC_STATIC) == 0 && property_info->offset >= 0) { obj->std.properties_table[property_info->offset] = NULL; } } } } break; case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: if (offset->type == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); } else { index = Z_LVAL_P(offset); } ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (ht->nApplyCount > 0) { zend_error(E_WARNING, ""Modification of ArrayObject during sorting is prohibited""); return; } if (zend_hash_index_del(ht, index) == FAILURE) { zend_error(E_NOTICE,""Undefined offset: %ld"", Z_LVAL_P(offset)); } break; default: zend_error(E_WARNING, ""Illegal offset type""); return; } spl_hash_verify_pos(intern TSRMLS_CC); /* call rewind on FAILURE */ } /* }}} */ ",0 "static inline double MagickMax(const double x,const double y) { if (x > y) return(x); return(y); } ",0 "void DevToolsAgentHostImpl::InnerAttachClient(DevToolsAgentHostClient* client) { scoped_refptr protect(this); DevToolsSession* session = new DevToolsSession(this, client); sessions_.insert(session); session_by_client_[client].reset(session); AttachSession(session); if (sessions_.size() == 1) NotifyAttached(); DevToolsManager* manager = DevToolsManager::GetInstance(); if (manager->delegate()) manager->delegate()->ClientAttached(this, client); } ",1 "int x86_decode_insn(struct x86_emulate_ctxt *ctxt, void *insn, int insn_len) { int rc = X86EMUL_CONTINUE; int mode = ctxt->mode; int def_op_bytes, def_ad_bytes, goffset, simd_prefix; bool op_prefix = false; bool has_seg_override = false; struct opcode opcode; ctxt->memop.type = OP_NONE; ctxt->memopp = NULL; ctxt->_eip = ctxt->eip; ctxt->fetch.ptr = ctxt->fetch.data; ctxt->fetch.end = ctxt->fetch.data + insn_len; ctxt->opcode_len = 1; if (insn_len > 0) memcpy(ctxt->fetch.data, insn, insn_len); else { rc = __do_insn_fetch_bytes(ctxt, 1); if (rc != X86EMUL_CONTINUE) return rc; } switch (mode) { case X86EMUL_MODE_REAL: case X86EMUL_MODE_VM86: case X86EMUL_MODE_PROT16: def_op_bytes = def_ad_bytes = 2; break; case X86EMUL_MODE_PROT32: def_op_bytes = def_ad_bytes = 4; break; #ifdef CONFIG_X86_64 case X86EMUL_MODE_PROT64: def_op_bytes = 4; def_ad_bytes = 8; break; #endif default: return EMULATION_FAILED; } ctxt->op_bytes = def_op_bytes; ctxt->ad_bytes = def_ad_bytes; /* Legacy prefixes. */ for (;;) { switch (ctxt->b = insn_fetch(u8, ctxt)) { case 0x66: /* operand-size override */ op_prefix = true; /* switch between 2/4 bytes */ ctxt->op_bytes = def_op_bytes ^ 6; break; case 0x67: /* address-size override */ if (mode == X86EMUL_MODE_PROT64) /* switch between 4/8 bytes */ ctxt->ad_bytes = def_ad_bytes ^ 12; else /* switch between 2/4 bytes */ ctxt->ad_bytes = def_ad_bytes ^ 6; break; case 0x26: /* ES override */ case 0x2e: /* CS override */ case 0x36: /* SS override */ case 0x3e: /* DS override */ has_seg_override = true; ctxt->seg_override = (ctxt->b >> 3) & 3; break; case 0x64: /* FS override */ case 0x65: /* GS override */ has_seg_override = true; ctxt->seg_override = ctxt->b & 7; break; case 0x40 ... 0x4f: /* REX */ if (mode != X86EMUL_MODE_PROT64) goto done_prefixes; ctxt->rex_prefix = ctxt->b; continue; case 0xf0: /* LOCK */ ctxt->lock_prefix = 1; break; case 0xf2: /* REPNE/REPNZ */ case 0xf3: /* REP/REPE/REPZ */ ctxt->rep_prefix = ctxt->b; break; default: goto done_prefixes; } /* Any legacy prefix after a REX prefix nullifies its effect. */ ctxt->rex_prefix = 0; } done_prefixes: /* REX prefix. */ if (ctxt->rex_prefix & 8) ctxt->op_bytes = 8; /* REX.W */ /* Opcode byte(s). */ opcode = opcode_table[ctxt->b]; /* Two-byte opcode? */ if (ctxt->b == 0x0f) { ctxt->opcode_len = 2; ctxt->b = insn_fetch(u8, ctxt); opcode = twobyte_table[ctxt->b]; /* 0F_38 opcode map */ if (ctxt->b == 0x38) { ctxt->opcode_len = 3; ctxt->b = insn_fetch(u8, ctxt); opcode = opcode_map_0f_38[ctxt->b]; } } ctxt->d = opcode.flags; if (ctxt->d & ModRM) ctxt->modrm = insn_fetch(u8, ctxt); /* vex-prefix instructions are not implemented */ if (ctxt->opcode_len == 1 && (ctxt->b == 0xc5 || ctxt->b == 0xc4) && (mode == X86EMUL_MODE_PROT64 || (ctxt->modrm & 0xc0) == 0xc0)) { ctxt->d = NotImpl; } while (ctxt->d & GroupMask) { switch (ctxt->d & GroupMask) { case Group: goffset = (ctxt->modrm >> 3) & 7; opcode = opcode.u.group[goffset]; break; case GroupDual: goffset = (ctxt->modrm >> 3) & 7; if ((ctxt->modrm >> 6) == 3) opcode = opcode.u.gdual->mod3[goffset]; else opcode = opcode.u.gdual->mod012[goffset]; break; case RMExt: goffset = ctxt->modrm & 7; opcode = opcode.u.group[goffset]; break; case Prefix: if (ctxt->rep_prefix && op_prefix) return EMULATION_FAILED; simd_prefix = op_prefix ? 0x66 : ctxt->rep_prefix; switch (simd_prefix) { case 0x00: opcode = opcode.u.gprefix->pfx_no; break; case 0x66: opcode = opcode.u.gprefix->pfx_66; break; case 0xf2: opcode = opcode.u.gprefix->pfx_f2; break; case 0xf3: opcode = opcode.u.gprefix->pfx_f3; break; } break; case Escape: if (ctxt->modrm > 0xbf) opcode = opcode.u.esc->high[ctxt->modrm - 0xc0]; else opcode = opcode.u.esc->op[(ctxt->modrm >> 3) & 7]; break; case InstrDual: if ((ctxt->modrm >> 6) == 3) opcode = opcode.u.idual->mod3; else opcode = opcode.u.idual->mod012; break; case ModeDual: if (ctxt->mode == X86EMUL_MODE_PROT64) opcode = opcode.u.mdual->mode64; else opcode = opcode.u.mdual->mode32; break; default: return EMULATION_FAILED; } ctxt->d &= ~(u64)GroupMask; ctxt->d |= opcode.flags; } /* Unrecognised? */ if (ctxt->d == 0) return EMULATION_FAILED; ctxt->execute = opcode.u.execute; if (unlikely(ctxt->ud) && likely(!(ctxt->d & EmulateOnUD))) return EMULATION_FAILED; if (unlikely(ctxt->d & (NotImpl|Stack|Op3264|Sse|Mmx|Intercept|CheckPerm|NearBranch| No16))) { /* * These are copied unconditionally here, and checked unconditionally * in x86_emulate_insn. */ ctxt->check_perm = opcode.check_perm; ctxt->intercept = opcode.intercept; if (ctxt->d & NotImpl) return EMULATION_FAILED; if (mode == X86EMUL_MODE_PROT64) { if (ctxt->op_bytes == 4 && (ctxt->d & Stack)) ctxt->op_bytes = 8; else if (ctxt->d & NearBranch) ctxt->op_bytes = 8; } if (ctxt->d & Op3264) { if (mode == X86EMUL_MODE_PROT64) ctxt->op_bytes = 8; else ctxt->op_bytes = 4; } if ((ctxt->d & No16) && ctxt->op_bytes == 2) ctxt->op_bytes = 4; if (ctxt->d & Sse) ctxt->op_bytes = 16; else if (ctxt->d & Mmx) ctxt->op_bytes = 8; } /* ModRM and SIB bytes. */ if (ctxt->d & ModRM) { rc = decode_modrm(ctxt, &ctxt->memop); if (!has_seg_override) { has_seg_override = true; ctxt->seg_override = ctxt->modrm_seg; } } else if (ctxt->d & MemAbs) rc = decode_abs(ctxt, &ctxt->memop); if (rc != X86EMUL_CONTINUE) goto done; if (!has_seg_override) ctxt->seg_override = VCPU_SREG_DS; ctxt->memop.addr.mem.seg = ctxt->seg_override; /* * Decode and fetch the source operand: register, memory * or immediate. */ rc = decode_operand(ctxt, &ctxt->src, (ctxt->d >> SrcShift) & OpMask); if (rc != X86EMUL_CONTINUE) goto done; /* * Decode and fetch the second source operand: register, memory * or immediate. */ rc = decode_operand(ctxt, &ctxt->src2, (ctxt->d >> Src2Shift) & OpMask); if (rc != X86EMUL_CONTINUE) goto done; /* Decode and fetch the destination operand: register or memory. */ rc = decode_operand(ctxt, &ctxt->dst, (ctxt->d >> DstShift) & OpMask); if (ctxt->rip_relative) ctxt->memopp->addr.mem.ea = address_mask(ctxt, ctxt->memopp->addr.mem.ea + ctxt->_eip); done: return (rc != X86EMUL_CONTINUE) ? EMULATION_FAILED : EMULATION_OK; } ",1 " void doWriteKeyUsages(const blink::WebCryptoKeyUsageMask usages, bool extractable) { COMPILE_ASSERT(blink::EndOfWebCryptoKeyUsage == (1 << 7) + 1, UpdateMe); uint32_t value = 0; if (extractable) value |= ExtractableUsage; if (usages & blink::WebCryptoKeyUsageEncrypt) value |= EncryptUsage; if (usages & blink::WebCryptoKeyUsageDecrypt) value |= DecryptUsage; if (usages & blink::WebCryptoKeyUsageSign) value |= SignUsage; if (usages & blink::WebCryptoKeyUsageVerify) value |= VerifyUsage; if (usages & blink::WebCryptoKeyUsageDeriveKey) value |= DeriveKeyUsage; if (usages & blink::WebCryptoKeyUsageWrapKey) value |= WrapKeyUsage; if (usages & blink::WebCryptoKeyUsageUnwrapKey) value |= UnwrapKeyUsage; if (usages & blink::WebCryptoKeyUsageDeriveBits) value |= DeriveBitsUsage; doWriteUint32(value); } ",0 "static void __iriap_close(struct iriap_cb *self) { IRDA_DEBUG(4, ""%s()\n"", __func__); IRDA_ASSERT(self != NULL, return;); IRDA_ASSERT(self->magic == IAS_MAGIC, return;); del_timer(&self->watchdog_timer); if (self->request_skb) dev_kfree_skb(self->request_skb); self->magic = 0; kfree(self); } ",0 "static bool inotify_should_send_event(struct fsnotify_group *group, struct inode *inode, struct fsnotify_mark *inode_mark, struct fsnotify_mark *vfsmount_mark, __u32 mask, void *data, int data_type) { if ((inode_mark->mask & FS_EXCL_UNLINK) && (data_type == FSNOTIFY_EVENT_PATH)) { struct path *path = data; if (d_unlinked(path->dentry)) return false; } return true; } ",0 "void ScriptController::clearWindowShell(bool) { m_proxy->clearForNavigation(); } ",0 "static void sctp_inet6_skb_msgname(struct sk_buff *skb, char *msgname, int *addr_len) { union sctp_addr *addr; struct sctphdr *sh; if (!msgname) return; addr = (union sctp_addr *)msgname; sh = sctp_hdr(skb); if (ip_hdr(skb)->version == 4) { addr->v4.sin_family = AF_INET; addr->v4.sin_port = sh->source; addr->v4.sin_addr.s_addr = ip_hdr(skb)->saddr; } else { addr->v6.sin6_family = AF_INET6; addr->v6.sin6_flowinfo = 0; addr->v6.sin6_port = sh->source; addr->v6.sin6_addr = ipv6_hdr(skb)->saddr; if (ipv6_addr_type(&addr->v6.sin6_addr) & IPV6_ADDR_LINKLOCAL) { addr->v6.sin6_scope_id = sctp_v6_skb_iif(skb); } } *addr_len = sctp_v6_addr_to_user(sctp_sk(skb->sk), addr); } ",0 "static void update_params(struct sock *sk) { struct tcp_sock *tp = tcp_sk(sk); struct illinois *ca = inet_csk_ca(sk); if (tp->snd_cwnd < win_thresh) { ca->alpha = ALPHA_BASE; ca->beta = BETA_BASE; } else if (ca->cnt_rtt > 0) { u32 dm = max_delay(ca); u32 da = avg_delay(ca); ca->alpha = alpha(ca, da, dm); ca->beta = beta(da, dm); } rtt_reset(sk); } ",0 "void RenderLayerScrollableArea::updateNeedsCompositedScrolling() { const bool needsCompositedScrolling = layerNeedsCompositedScrolling(layer()); if (static_cast(m_needsCompositedScrolling) != needsCompositedScrolling) { m_needsCompositedScrolling = needsCompositedScrolling; layer()->didUpdateNeedsCompositedScrolling(); } } ",0 " bool shouldApplyWrappingStyle(Node* node) const { return m_highestNodeToBeSerialized && m_highestNodeToBeSerialized->parentNode() == node->parentNode() && m_wrappingStyle && m_wrappingStyle->style(); } ",0 "LayoutRect RenderMenuList::controlClipRect(const LayoutPoint& additionalOffset) const { LayoutRect outerBox(additionalOffset.x() + borderLeft() + paddingLeft(), additionalOffset.y() + borderTop() + paddingTop(), contentWidth(), contentHeight()); LayoutRect innerBox(additionalOffset.x() + m_innerBlock->x() + m_innerBlock->paddingLeft(), additionalOffset.y() + m_innerBlock->y() + m_innerBlock->paddingTop(), m_innerBlock->contentWidth(), m_innerBlock->contentHeight()); return intersection(outerBox, innerBox); } ",0 "void AppLauncherHandler::HandleGetApps(const base::ListValue* args) { base::DictionaryValue dictionary; Profile* profile = Profile::FromWebUI(web_ui()); if (!has_loaded_apps_) { ExtensionRegistry* registry = ExtensionRegistry::Get(profile); const ExtensionSet& enabled_set = registry->enabled_extensions(); for (extensions::ExtensionSet::const_iterator it = enabled_set.begin(); it != enabled_set.end(); ++it) { visible_apps_.insert((*it)->id()); } const ExtensionSet& disabled_set = registry->disabled_extensions(); for (ExtensionSet::const_iterator it = disabled_set.begin(); it != disabled_set.end(); ++it) { visible_apps_.insert((*it)->id()); } const ExtensionSet& terminated_set = registry->terminated_extensions(); for (ExtensionSet::const_iterator it = terminated_set.begin(); it != terminated_set.end(); ++it) { visible_apps_.insert((*it)->id()); } } SetAppToBeHighlighted(); FillAppDictionary(&dictionary); web_ui()->CallJavascriptFunction(""ntp.getAppsCallback"", dictionary); if (!has_loaded_apps_) { base::Closure callback = base::Bind( &AppLauncherHandler::OnExtensionPreferenceChanged, base::Unretained(this)); extension_pref_change_registrar_.Init( ExtensionPrefs::Get(profile)->pref_service()); extension_pref_change_registrar_.Add( extensions::pref_names::kExtensions, callback); extension_pref_change_registrar_.Add(prefs::kNtpAppPageNames, callback); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, content::Source(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNLOADED_DEPRECATED, content::Source(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UNINSTALLED, content::Source(profile)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LAUNCHER_REORDERED, content::Source( ExtensionPrefs::Get(profile)->app_sorting())); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, content::Source(NULL)); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOAD_ERROR, content::Source(profile)); } has_loaded_apps_ = true; } ",0 "void FileBrowserPrivateRequestDriveShareFunction::OnAddPermission( drive::FileError error) { SendResponse(error == drive::FILE_ERROR_OK); } ",0 "static qboolean S_AL_BufferEvict( void ) { int i, oldestBuffer = -1; int oldestTime = Sys_Milliseconds( ); for( i = 0; i < numSfx; i++ ) { if( !knownSfx[ i ].filename[ 0 ] ) continue; if( !knownSfx[ i ].inMemory ) continue; if( knownSfx[ i ].lastUsedTime < oldestTime ) { oldestTime = knownSfx[ i ].lastUsedTime; oldestBuffer = i; } } if( oldestBuffer >= 0 ) { S_AL_BufferUnload( oldestBuffer ); return qtrue; } else return qfalse; } ",0 "static void ReadBlobFloatsMSB(Image * image, size_t len, float *data) { while (len >= 4) { *data++ = ReadBlobFloat(image); len -= sizeof(float); } if (len > 0) (void) SeekBlob(image, len, SEEK_CUR); } ",0 "int kvm_iommu_map_pages(struct kvm *kvm, struct kvm_memory_slot *slot) { gfn_t gfn, end_gfn; pfn_t pfn; int r = 0; struct iommu_domain *domain = kvm->arch.iommu_domain; int flags; /* check if iommu exists and in use */ if (!domain) return 0; gfn = slot->base_gfn; end_gfn = gfn + slot->npages; flags = IOMMU_READ; if (!(slot->flags & KVM_MEM_READONLY)) flags |= IOMMU_WRITE; if (!kvm->arch.iommu_noncoherent) flags |= IOMMU_CACHE; while (gfn < end_gfn) { unsigned long page_size; /* Check if already mapped */ if (iommu_iova_to_phys(domain, gfn_to_gpa(gfn))) { gfn += 1; continue; } /* Get the page size we could use to map */ page_size = kvm_host_page_size(kvm, gfn); /* Make sure the page_size does not exceed the memslot */ while ((gfn + (page_size >> PAGE_SHIFT)) > end_gfn) page_size >>= 1; /* Make sure gfn is aligned to the page size we want to map */ while ((gfn << PAGE_SHIFT) & (page_size - 1)) page_size >>= 1; /* Make sure hva is aligned to the page size we want to map */ while (__gfn_to_hva_memslot(slot, gfn) & (page_size - 1)) page_size >>= 1; /* * Pin all pages we are about to map in memory. This is * important because we unmap and unpin in 4kb steps later. */ pfn = kvm_pin_pages(slot, gfn, page_size); if (is_error_noslot_pfn(pfn)) { gfn += 1; continue; } /* Map into IO address space */ r = iommu_map(domain, gfn_to_gpa(gfn), pfn_to_hpa(pfn), page_size, flags); if (r) { printk(KERN_ERR ""kvm_iommu_map_address:"" ""iommu failed to map pfn=%llx\n"", pfn); kvm_unpin_pages(kvm, pfn, page_size); goto unmap_pages; } gfn += page_size >> PAGE_SHIFT; } return 0; unmap_pages: kvm_iommu_put_pages(kvm, slot->base_gfn, gfn - slot->base_gfn); return r; } ",1 " void WaitForState(State state) { while (state_ != state) MessageLoop::current()->RunAllPending(); } ",0 "static int usb_bus_notify(struct notifier_block *nb, unsigned long action, void *data) { struct device *dev = data; switch (action) { case BUS_NOTIFY_ADD_DEVICE: if (dev->type == &usb_device_type) (void) usb_create_sysfs_dev_files(to_usb_device(dev)); else if (dev->type == &usb_if_device_type) usb_create_sysfs_intf_files(to_usb_interface(dev)); break; case BUS_NOTIFY_DEL_DEVICE: if (dev->type == &usb_device_type) usb_remove_sysfs_dev_files(to_usb_device(dev)); else if (dev->type == &usb_if_device_type) usb_remove_sysfs_intf_files(to_usb_interface(dev)); break; } return 0; } ",0 "static bool init_cpuset_if_needed(struct cgroup_mount_point *mp, const char *path) { /* the files we have to handle here are only in cpuset hierarchies */ if (!lxc_string_in_array(""cpuset"", (const char **)mp->hierarchy->subsystems)) return true; if (!mp->need_cpuset_init) return true; return (do_init_cpuset_file(mp, path, ""/cpuset.cpus"") && do_init_cpuset_file(mp, path, ""/cpuset.mems"") ); } ",0 "static int rtnl_fdb_del(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) { struct net *net = sock_net(skb->sk); struct ndmsg *ndm; struct nlattr *tb[NDA_MAX+1]; struct net_device *dev; int err = -EINVAL; __u8 *addr; if (!capable(CAP_NET_ADMIN)) return -EPERM; err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL); if (err < 0) return err; ndm = nlmsg_data(nlh); if (ndm->ndm_ifindex == 0) { pr_info(""PF_BRIDGE: RTM_DELNEIGH with invalid ifindex\n""); return -EINVAL; } dev = __dev_get_by_index(net, ndm->ndm_ifindex); if (dev == NULL) { pr_info(""PF_BRIDGE: RTM_DELNEIGH with unknown ifindex\n""); return -ENODEV; } if (!tb[NDA_LLADDR] || nla_len(tb[NDA_LLADDR]) != ETH_ALEN) { pr_info(""PF_BRIDGE: RTM_DELNEIGH with invalid address\n""); return -EINVAL; } addr = nla_data(tb[NDA_LLADDR]); if (!is_valid_ether_addr(addr)) { pr_info(""PF_BRIDGE: RTM_DELNEIGH with invalid ether address\n""); return -EINVAL; } err = -EOPNOTSUPP; /* Support fdb on master device the net/bridge default case */ if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) && (dev->priv_flags & IFF_BRIDGE_PORT)) { struct net_device *br_dev = netdev_master_upper_dev_get(dev); const struct net_device_ops *ops = br_dev->netdev_ops; if (ops->ndo_fdb_del) err = ops->ndo_fdb_del(ndm, tb, dev, addr); if (err) goto out; else ndm->ndm_flags &= ~NTF_MASTER; } /* Embedded bridge, macvlan, and any other device support */ if ((ndm->ndm_flags & NTF_SELF) && dev->netdev_ops->ndo_fdb_del) { err = dev->netdev_ops->ndo_fdb_del(ndm, tb, dev, addr); if (!err) { rtnl_fdb_notify(dev, addr, RTM_DELNEIGH); ndm->ndm_flags &= ~NTF_SELF; } } out: return err; } ",0 "__inline double png_strtod(png_structp png_ptr, PNG_CONST char *nptr, char **endptr) { double result = 0; int len; wchar_t *str, *end; len = MultiByteToWideChar(CP_ACP, 0, nptr, -1, NULL, 0); str = (wchar_t *)png_malloc(png_ptr, len * png_sizeof(wchar_t)); if ( NULL != str ) { MultiByteToWideChar(CP_ACP, 0, nptr, -1, str, len); result = wcstod(str, &end); len = WideCharToMultiByte(CP_ACP, 0, end, -1, NULL, 0, NULL, NULL); *endptr = (char *)nptr + (png_strlen(nptr) - len + 1); png_free(png_ptr, str); } return result; } ",0 "get_rt_rlimit(vector_t *strvec, const char *process) { unsigned limit; rlim_t rlim; if (!read_unsigned_strvec(strvec, 1, &limit, 1, UINT32_MAX, true)) { report_config_error(CONFIG_GENERAL_ERROR, ""Invalid %s real-time limit - %s"", process, FMT_STR_VSLOT(strvec, 1)); return 0; } rlim = limit; return rlim; } ",0 "void Document::RecordUkmOutliveTimeAfterShutdown(int outlive_time_count) { if (!needs_to_record_ukm_outlive_time_) return; DCHECK(ukm_recorder_); DCHECK(ukm_source_id_ != ukm::kInvalidSourceId); ukm::builders::Document_OutliveTimeAfterShutdown(ukm_source_id_) .SetGCCount(outlive_time_count) .Record(ukm_recorder_.get()); } ",0 "MOCK_IMPL(consensus_path_type_t, router_have_consensus_path, (void)) { return have_consensus_path; } ",0 "bool AXObject::supportsARIAAttributes() const { return isLiveRegion() || supportsARIADragging() || supportsARIADropping() || supportsARIAFlowTo() || supportsARIAOwns() || hasAttribute(aria_labelAttr); } ",0 "EventDispatchHandlingState* HTMLInputElement::PreDispatchEventHandler( Event* event) { if (event->type() == EventTypeNames::textInput && input_type_view_->ShouldSubmitImplicitly(event)) { event->stopPropagation(); return nullptr; } if (event->type() != EventTypeNames::click) return nullptr; if (!event->IsMouseEvent() || ToMouseEvent(event)->button() != static_cast(WebPointerProperties::Button::kLeft)) return nullptr; return input_type_view_->WillDispatchClick(); } ",0 "void CloudPolicySubsystem::StopAutoRetry() { cloud_policy_controller_->StopAutoRetry(); device_token_fetcher_->StopAutoRetry(); data_store_->Reset(); } ",1 "static int snd_timer_s_stop(struct snd_timer * timer) { struct snd_timer_system_private *priv; unsigned long jiff; priv = (struct snd_timer_system_private *) timer->private_data; del_timer(&priv->tlist); jiff = jiffies; if (time_before(jiff, priv->last_expires)) timer->sticks = priv->last_expires - jiff; else timer->sticks = 1; priv->correction = 0; return 0; } ",0 "void js_setglobal(js_State *J, const char *name) { jsR_setproperty(J, J->G, name); js_pop(J, 1); } ",0 "XfrmController::ipSecRemoveTransportModeTransform(const android::base::unique_fd& socket) { ALOGD(""XfrmController::%s, line=%d"", __FUNCTION__, __LINE__); StatusOr ret = getSyscallInstance().getsockname(Fd(socket)); if (!isOk(ret)) { ALOGE(""Failed to get socket info in %s! (%s)"", __FUNCTION__, toString(ret).c_str()); return ret; } int sockOpt, sockLayer; switch (ret.value().ss_family) { case AF_INET: sockOpt = IP_XFRM_POLICY; sockLayer = SOL_IP; break; case AF_INET6: sockOpt = IPV6_XFRM_POLICY; sockLayer = SOL_IPV6; break; default: return netdutils::statusFromErrno(EAFNOSUPPORT, ""Invalid address family""); } netdutils::Status status = getSyscallInstance().setsockopt(Fd(socket), sockLayer, sockOpt, NULL, 0); if (!isOk(status)) { ALOGE(""Error removing socket option for XFRM! (%s)"", toString(status).c_str()); } return status; } ",0 "static void tcp_sack_maybe_coalesce(struct tcp_sock *tp) { int this_sack; struct tcp_sack_block *sp = &tp->selective_acks[0]; struct tcp_sack_block *swalk = sp + 1; /* See if the recent change to the first SACK eats into * or hits the sequence space of other SACK blocks, if so coalesce. */ for (this_sack = 1; this_sack < tp->rx_opt.num_sacks;) { if (tcp_sack_extend(sp, swalk->start_seq, swalk->end_seq)) { int i; /* Zap SWALK, by moving every further SACK up by one slot. * Decrease num_sacks. */ tp->rx_opt.num_sacks--; for (i = this_sack; i < tp->rx_opt.num_sacks; i++) sp[i] = sp[i + 1]; continue; } this_sack++, swalk++; } } ",0 " void DeleteTexture() { if (texture_id_) { host_context_->deleteTexture(texture_id_); texture_id_ = 0; } } ",0 "static const char *register_filter_function_hook(const char *filter, cmd_parms *cmd, void *_cfg, const char *file, const char *function, int direction) { ap_lua_filter_handler_spec *spec; ap_lua_dir_cfg *cfg = (ap_lua_dir_cfg *) _cfg; spec = apr_pcalloc(cmd->pool, sizeof(ap_lua_filter_handler_spec)); spec->file_name = apr_pstrdup(cmd->pool, file); spec->function_name = apr_pstrdup(cmd->pool, function); spec->filter_name = filter; *(ap_lua_filter_handler_spec **) apr_array_push(cfg->mapped_filters) = spec; /* TODO: Make it work on other types than just AP_FTYPE_RESOURCE? */ if (direction == AP_LUA_FILTER_OUTPUT) { spec->direction = AP_LUA_FILTER_OUTPUT; ap_register_output_filter_protocol(filter, lua_output_filter_handle, NULL, AP_FTYPE_RESOURCE, AP_FILTER_PROTO_CHANGE|AP_FILTER_PROTO_CHANGE_LENGTH); } else { spec->direction = AP_LUA_FILTER_INPUT; ap_register_input_filter(filter, lua_input_filter_handle, NULL, AP_FTYPE_RESOURCE); } return NULL; } ",0 "re_input (void) { if (using_plan_a) { if (i_buffer) { free (i_buffer); i_buffer = 0; free (i_ptr); } } else { if (tifd >= 0) close (tifd); tifd = -1; if (tibuf[0]) { free (tibuf[0]); tibuf[0] = 0; } tiline[0] = tiline[1] = -1; tireclen = 0; } } ",0 "int cipso_v4_sock_setattr(struct sock *sk, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val = -EPERM; unsigned char *buf = NULL; u32 buf_len; u32 opt_len; struct ip_options_rcu *old, *opt = NULL; struct inet_sock *sk_inet; struct inet_connection_sock *sk_conn; /* In the case of sock_create_lite(), the sock->sk field is not * defined yet but it is not a problem as the only users of these * ""lite"" PF_INET sockets are functions which do an accept() call * afterwards so we will label the socket as part of the accept(). */ if (sk == NULL) return 0; /* We allocate the maximum CIPSO option size here so we are probably * being a little wasteful, but it makes our life _much_ easier later * on and after all we are only talking about 40 bytes. */ buf_len = CIPSO_V4_OPT_LEN_MAX; buf = kmalloc(buf_len, GFP_ATOMIC); if (buf == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) goto socket_setattr_failure; buf_len = ret_val; /* We can't use ip_options_get() directly because it makes a call to * ip_options_get_alloc() which allocates memory with GFP_KERNEL and * we won't always have CAP_NET_RAW even though we _always_ want to * set the IPOPT_CIPSO option. */ opt_len = (buf_len + 3) & ~3; opt = kzalloc(sizeof(*opt) + opt_len, GFP_ATOMIC); if (opt == NULL) { ret_val = -ENOMEM; goto socket_setattr_failure; } memcpy(opt->opt.__data, buf, buf_len); opt->opt.optlen = opt_len; opt->opt.cipso = sizeof(struct iphdr); kfree(buf); buf = NULL; sk_inet = inet_sk(sk); old = rcu_dereference_protected(sk_inet->inet_opt, sock_owned_by_user(sk)); if (sk_inet->is_icsk) { sk_conn = inet_csk(sk); if (old) sk_conn->icsk_ext_hdr_len -= old->opt.optlen; sk_conn->icsk_ext_hdr_len += opt->opt.optlen; sk_conn->icsk_sync_mss(sk, sk_conn->icsk_pmtu_cookie); } rcu_assign_pointer(sk_inet->inet_opt, opt); if (old) kfree_rcu(old, rcu); return 0; socket_setattr_failure: kfree(buf); kfree(opt); return ret_val; } ",0 "void DateTimeChooserImpl::didClosePopup() { ASSERT(m_client); m_popup = 0; m_client->didEndChooser(); } ",0 "void WebPage::notifyAppActivationStateChange(ActivationStateType activationState) { #if ENABLE(VIDEO) MediaPlayerPrivate::notifyAppActivatedEvent(activationState == ActivationActive); #endif FOR_EACH_PLUGINVIEW(d->m_pluginViews) { switch (activationState) { case ActivationActive: (*it)->handleAppActivatedEvent(); break; case ActivationInactive: (*it)->handleAppDeactivatedEvent(); break; case ActivationStandby: (*it)->handleAppStandbyEvent(); break; } } d->notifyAppActivationStateChange(activationState); } ",0 "int32_t MemBackendImpl::GetEntryCount() const { return static_cast(entries_.size()); } ",0 "static TEE_Result set_tmem_param(const struct optee_msg_param_tmem *tmem, uint32_t attr, struct param_mem *mem) { struct mobj __maybe_unused **mobj; paddr_t pa = READ_ONCE(tmem->buf_ptr); size_t sz = READ_ONCE(tmem->size); /* NULL Memory Rerefence? */ if (!pa && !sz) { mem->mobj = NULL; mem->offs = 0; mem->size = 0; return TEE_SUCCESS; } /* Non-contigous buffer from non sec DDR? */ if (attr & OPTEE_MSG_ATTR_NONCONTIG) { uint64_t shm_ref = READ_ONCE(tmem->shm_ref); mem->mobj = msg_param_mobj_from_noncontig(pa, sz, shm_ref, false); if (!mem->mobj) return TEE_ERROR_BAD_PARAMETERS; mem->offs = 0; mem->size = sz; return TEE_SUCCESS; } /* Belongs to nonsecure shared memory? */ if (param_mem_from_mobj(mem, shm_mobj, pa, sz)) return TEE_SUCCESS; #ifdef CFG_SECURE_DATA_PATH /* Belongs to SDP memories? */ for (mobj = sdp_mem_mobjs; *mobj; mobj++) if (param_mem_from_mobj(mem, *mobj, pa, sz)) return TEE_SUCCESS; #endif return TEE_ERROR_BAD_PARAMETERS; } ",0 "static int kvm_dev_ioctl_create_vm(unsigned long type) { int r; struct kvm *kvm; struct file *file; kvm = kvm_create_vm(type); if (IS_ERR(kvm)) return PTR_ERR(kvm); #ifdef CONFIG_KVM_MMIO r = kvm_coalesced_mmio_init(kvm); if (r < 0) goto put_kvm; #endif r = get_unused_fd_flags(O_CLOEXEC); if (r < 0) goto put_kvm; file = anon_inode_getfile(""kvm-vm"", &kvm_vm_fops, kvm, O_RDWR); if (IS_ERR(file)) { put_unused_fd(r); r = PTR_ERR(file); goto put_kvm; } /* * Don't call kvm_put_kvm anymore at this point; file->f_op is * already set, with ->release() being kvm_vm_release(). In error * cases it will be called by the final fput(file) and will take * care of doing kvm_put_kvm(kvm). */ if (kvm_create_vm_debugfs(kvm, r) < 0) { put_unused_fd(r); fput(file); return -ENOMEM; } kvm_uevent_notify_change(KVM_EVENT_CREATE_VM, kvm); fd_install(r, file); return r; put_kvm: kvm_put_kvm(kvm); return r; } ",0 "static int ext4_add_entry(handle_t *handle, struct dentry *dentry, struct inode *inode) { struct inode *dir = dentry->d_parent->d_inode; struct buffer_head *bh; struct ext4_dir_entry_2 *de; struct ext4_dir_entry_tail *t; struct super_block *sb; int retval; int dx_fallback=0; unsigned blocksize; ext4_lblk_t block, blocks; int csum_size = 0; if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) csum_size = sizeof(struct ext4_dir_entry_tail); sb = dir->i_sb; blocksize = sb->s_blocksize; if (!dentry->d_name.len) return -EINVAL; if (ext4_has_inline_data(dir)) { retval = ext4_try_add_inline_entry(handle, dentry, inode); if (retval < 0) return retval; if (retval == 1) { retval = 0; return retval; } } if (is_dx(dir)) { retval = ext4_dx_add_entry(handle, dentry, inode); if (!retval || (retval != ERR_BAD_DX_DIR)) return retval; ext4_clear_inode_flag(dir, EXT4_INODE_INDEX); dx_fallback++; ext4_mark_inode_dirty(handle, dir); } blocks = dir->i_size >> sb->s_blocksize_bits; for (block = 0; block < blocks; block++) { if (!(bh = ext4_bread(handle, dir, block, 0, &retval))) { if (!retval) { retval = -EIO; ext4_error(inode->i_sb, ""Directory hole detected on inode %lu\n"", inode->i_ino); } return retval; } if (!buffer_verified(bh) && !ext4_dirent_csum_verify(dir, (struct ext4_dir_entry *)bh->b_data)) return -EIO; set_buffer_verified(bh); retval = add_dirent_to_buf(handle, dentry, inode, NULL, bh); if (retval != -ENOSPC) { brelse(bh); return retval; } if (blocks == 1 && !dx_fallback && EXT4_HAS_COMPAT_FEATURE(sb, EXT4_FEATURE_COMPAT_DIR_INDEX)) return make_indexed_dir(handle, dentry, inode, bh); brelse(bh); } bh = ext4_append(handle, dir, &block, &retval); if (!bh) return retval; de = (struct ext4_dir_entry_2 *) bh->b_data; de->inode = 0; de->rec_len = ext4_rec_len_to_disk(blocksize - csum_size, blocksize); if (csum_size) { t = EXT4_DIRENT_TAIL(bh->b_data, blocksize); initialize_dirent_tail(t, blocksize); } retval = add_dirent_to_buf(handle, dentry, inode, de, bh); brelse(bh); if (retval == 0) ext4_set_inode_state(inode, EXT4_STATE_NEWENTRY); return retval; } ",0 "static int rsa_cms_encrypt(CMS_RecipientInfo *ri) { const EVP_MD *md, *mgf1md; RSA_OAEP_PARAMS *oaep = NULL; ASN1_STRING *os = NULL; X509_ALGOR *alg; EVP_PKEY_CTX *pkctx = CMS_RecipientInfo_get0_pkey_ctx(ri); int pad_mode = RSA_PKCS1_PADDING, rv = 0, labellen; unsigned char *label; CMS_RecipientInfo_ktri_get0_algs(ri, NULL, NULL, &alg); if (pkctx) { if (EVP_PKEY_CTX_get_rsa_padding(pkctx, &pad_mode) <= 0) return 0; } if (pad_mode == RSA_PKCS1_PADDING) { X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsaEncryption), V_ASN1_NULL, 0); return 1; } /* Not supported */ if (pad_mode != RSA_PKCS1_OAEP_PADDING) return 0; if (EVP_PKEY_CTX_get_rsa_oaep_md(pkctx, &md) <= 0) goto err; if (EVP_PKEY_CTX_get_rsa_mgf1_md(pkctx, &mgf1md) <= 0) goto err; labellen = EVP_PKEY_CTX_get0_rsa_oaep_label(pkctx, &label); if (labellen < 0) goto err; oaep = RSA_OAEP_PARAMS_new(); if (!oaep) goto err; if (!rsa_md_to_algor(&oaep->hashFunc, md)) goto err; if (!rsa_md_to_mgf1(&oaep->maskGenFunc, mgf1md)) goto err; if (labellen > 0) { ASN1_OCTET_STRING *los = ASN1_OCTET_STRING_new(); oaep->pSourceFunc = X509_ALGOR_new(); if (!oaep->pSourceFunc) goto err; if (!los) goto err; if (!ASN1_OCTET_STRING_set(los, label, labellen)) { ASN1_OCTET_STRING_free(los); goto err; } X509_ALGOR_set0(oaep->pSourceFunc, OBJ_nid2obj(NID_pSpecified), V_ASN1_OCTET_STRING, los); } /* create string with pss parameter encoding. */ if (!ASN1_item_pack(oaep, ASN1_ITEM_rptr(RSA_OAEP_PARAMS), &os)) goto err; X509_ALGOR_set0(alg, OBJ_nid2obj(NID_rsaesOaep), V_ASN1_SEQUENCE, os); os = NULL; rv = 1; err: if (oaep) RSA_OAEP_PARAMS_free(oaep); if (os) ASN1_STRING_free(os); return rv; } ",0 "Chapters::~Chapters() { while (m_editions_count > 0) { Edition& e = m_editions[--m_editions_count]; e.Clear(); } delete[] m_editions; } ",0 "static void DoubleMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8SetReturnValue(info, impl->doubleMethod()); } ",0 "static int mxf_probe(AVProbeData *p) { const uint8_t *bufp = p->buf; const uint8_t *end = p->buf + p->buf_size; if (p->buf_size < sizeof(mxf_header_partition_pack_key)) return 0; /* Must skip Run-In Sequence and search for MXF header partition pack key SMPTE 377M 5.5 */ end -= sizeof(mxf_header_partition_pack_key); for (; bufp < end;) { if (!((bufp[13] - 1) & 0xF2)){ if (AV_RN32(bufp ) == AV_RN32(mxf_header_partition_pack_key ) && AV_RN32(bufp+ 4) == AV_RN32(mxf_header_partition_pack_key+ 4) && AV_RN32(bufp+ 8) == AV_RN32(mxf_header_partition_pack_key+ 8) && AV_RN16(bufp+12) == AV_RN16(mxf_header_partition_pack_key+12)) return AVPROBE_SCORE_MAX; bufp ++; } else bufp += 10; } return 0; } ",0 "bool WebKitTestController::PrepareForLayoutTest( const GURL& test_url, const base::FilePath& current_working_directory, bool enable_pixel_dumping, const std::string& expected_pixel_hash) { DCHECK(CalledOnValidThread()); test_phase_ = DURING_TEST; current_working_directory_ = current_working_directory; enable_pixel_dumping_ = enable_pixel_dumping; expected_pixel_hash_ = expected_pixel_hash; test_url_ = test_url; printer_->reset(); ShellBrowserContext* browser_context = ShellContentBrowserClient::Get()->browser_context(); if (test_url.spec().find(""compositing/"") != std::string::npos) is_compositing_test_ = true; initial_size_ = Shell::GetShellDefaultSize(); if (test_url.spec().find(""W3C-SVG-1.1"") != std::string::npos) initial_size_ = gfx::Size(kTestSVGWindowWidthDip, kTestSVGWindowHeightDip); if (!main_window_) { main_window_ = content::Shell::CreateNewWindow( browser_context, GURL(), NULL, initial_size_); WebContentsObserver::Observe(main_window_->web_contents()); send_configuration_to_next_host_ = true; current_pid_ = base::kNullProcessId; main_window_->LoadURL(test_url); } else { #if defined(OS_MACOSX) main_window_->SizeTo(initial_size_); #endif main_window_->web_contents()->GetRenderViewHost()->GetView() ->SetSize(initial_size_); main_window_->web_contents()->GetRenderViewHost()->WasResized(); RenderViewHost* render_view_host = main_window_->web_contents()->GetRenderViewHost(); WebPreferences prefs = render_view_host->GetWebkitPreferences(); OverrideWebkitPrefs(&prefs); render_view_host->UpdateWebkitPreferences(prefs); SendTestConfiguration(); NavigationController::LoadURLParams params(test_url); params.transition_type = ui::PageTransitionFromInt( ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_FROM_ADDRESS_BAR); params.should_clear_history_list = true; main_window_->web_contents()->GetController().LoadURLWithParams(params); main_window_->web_contents()->Focus(); } main_window_->web_contents()->GetRenderViewHost()->SetActive(true); main_window_->web_contents()->GetRenderViewHost()->Focus(); return true; } ",0 "static int rds_loop_recv(struct rds_connection *conn) { return 0; } ",0 "sparse_add_map (struct tar_stat_info *st, struct sp_array const *sp) { struct sp_array *sparse_map = st->sparse_map; size_t avail = st->sparse_map_avail; if (avail == st->sparse_map_size) st->sparse_map = sparse_map = x2nrealloc (sparse_map, &st->sparse_map_size, sizeof *sparse_map); sparse_map[avail] = *sp; st->sparse_map_avail = avail + 1; } ",0 "static bool caller_may_see_dir(pid_t pid, const char *contrl, const char *cg) { bool answer = false; char *c2, *task_cg; size_t target_len, task_len; if (strcmp(cg, ""/"") == 0) return true; c2 = get_pid_cgroup(pid, contrl); if (!c2) return false; task_cg = c2 + 1; target_len = strlen(cg); task_len = strlen(task_cg); if (strcmp(cg, task_cg) == 0) { answer = true; goto out; } if (target_len < task_len) { /* looking up a parent dir */ if (strncmp(task_cg, cg, target_len) == 0 && task_cg[target_len] == '/') answer = true; goto out; } if (target_len > task_len) { /* looking up a child dir */ if (strncmp(task_cg, cg, task_len) == 0 && cg[task_len] == '/') answer = true; goto out; } out: free(c2); return answer; } ",0 "static int decompress_i(AVCodecContext *avctx, uint32_t *dst, int linesize) { SCPRContext *s = avctx->priv_data; GetByteContext *gb = &s->gb; int cx = 0, cx1 = 0, k = 0, clr = 0; int run, r, g, b, off, y = 0, x = 0, z, ret; unsigned backstep = linesize - avctx->width; const int cxshift = s->cxshift; unsigned lx, ly, ptype; reinit_tables(s); bytestream2_skip(gb, 2); init_rangecoder(&s->rc, gb); while (k < avctx->width + 1) { ret = decode_unit(s, &s->pixel_model[0][cx + cx1], 400, &r); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = r >> cxshift; ret = decode_unit(s, &s->pixel_model[1][cx + cx1], 400, &g); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = g >> cxshift; ret = decode_unit(s, &s->pixel_model[2][cx + cx1], 400, &b); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = b >> cxshift; ret = decode_value(s, s->run_model[0], 256, 400, &run); if (ret < 0) return ret; clr = (b << 16) + (g << 8) + r; k += run; while (run-- > 0) { dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } } off = -linesize - 1; ptype = 0; while (x < avctx->width && y < avctx->height) { ret = decode_value(s, s->op_model[ptype], 6, 1000, &ptype); if (ret < 0) return ret; if (ptype == 0) { ret = decode_unit(s, &s->pixel_model[0][cx + cx1], 400, &r); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = r >> cxshift; ret = decode_unit(s, &s->pixel_model[1][cx + cx1], 400, &g); if (ret < 0) return ret; cx1 = (cx << 6) & 0xFC0; cx = g >> cxshift; ret = decode_unit(s, &s->pixel_model[2][cx + cx1], 400, &b); if (ret < 0) return ret; clr = (b << 16) + (g << 8) + r; } if (ptype > 5) return AVERROR_INVALIDDATA; ret = decode_value(s, s->run_model[ptype], 256, 400, &run); if (ret < 0) return ret; switch (ptype) { case 0: while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 1: while (run-- > 0) { if (y >= avctx->height) return AVERROR_INVALIDDATA; dst[y * linesize + x] = dst[ly * linesize + lx]; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } clr = dst[ly * linesize + lx]; break; case 2: while (run-- > 0) { if (y < 1 || y >= avctx->height) return AVERROR_INVALIDDATA; clr = dst[y * linesize + x + off + 1]; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 4: while (run-- > 0) { uint8_t *odst = (uint8_t *)dst; if (y < 1 || y >= avctx->height || (y == 1 && x == 0)) return AVERROR_INVALIDDATA; if (x == 0) { z = backstep; } else { z = 0; } r = odst[(ly * linesize + lx) * 4] + odst[((y * linesize + x) + off - z) * 4 + 4] - odst[((y * linesize + x) + off - z) * 4]; g = odst[(ly * linesize + lx) * 4 + 1] + odst[((y * linesize + x) + off - z) * 4 + 5] - odst[((y * linesize + x) + off - z) * 4 + 1]; b = odst[(ly * linesize + lx) * 4 + 2] + odst[((y * linesize + x) + off - z) * 4 + 6] - odst[((y * linesize + x) + off - z) * 4 + 2]; clr = ((b & 0xFF) << 16) + ((g & 0xFF) << 8) + (r & 0xFF); dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; case 5: while (run-- > 0) { if (y < 1 || y >= avctx->height || (y == 1 && x == 0)) return AVERROR_INVALIDDATA; if (x == 0) { z = backstep; } else { z = 0; } clr = dst[y * linesize + x + off - z]; dst[y * linesize + x] = clr; lx = x; ly = y; x++; if (x >= avctx->width) { x = 0; y++; } } break; } if (avctx->bits_per_coded_sample == 16) { cx1 = (clr & 0x3F00) >> 2; cx = (clr & 0xFFFFFF) >> 16; } else { cx1 = (clr & 0xFC00) >> 4; cx = (clr & 0xFFFFFF) >> 18; } } return 0; } ",1 "void Core::AcceptBrokerClientInvitation(ConnectionParams connection_params) { RequestContext request_context; GetNodeController()->AcceptBrokerClientInvitation( std::move(connection_params)); } ",0 " RasterizeWithGpuRasterizationCreatesResources() {} ",0 "static size_t StringSize(const uint8_t *start, uint8_t encoding) { if (encoding == 0x00 || encoding == 0x03) { return strlen((const char *)start) + 1; } size_t n = 0; while (start[n] != '\0' || start[n + 1] != '\0') { n += 2; } return n + 2; } ",0 "nameNsPop(xmlParserCtxtPtr ctxt) { const xmlChar *ret; if (ctxt->nameNr <= 0) return (NULL); ctxt->nameNr--; if (ctxt->nameNr > 0) ctxt->name = ctxt->nameTab[ctxt->nameNr - 1]; else ctxt->name = NULL; ret = ctxt->nameTab[ctxt->nameNr]; ctxt->nameTab[ctxt->nameNr] = NULL; return (ret); } ",0 "const EVP_CIPHER *EVP_aes_192_wrap_pad(void) { return &aes_192_wrap_pad; } ",0 "static int proc_task_instantiate(struct inode *dir, struct dentry *dentry, struct task_struct *task, const void *ptr) { struct inode *inode; inode = proc_pid_make_inode(dir->i_sb, task); if (!inode) goto out; inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; inode->i_op = &proc_tid_base_inode_operations; inode->i_fop = &proc_tid_base_operations; inode->i_flags|=S_IMMUTABLE; set_nlink(inode, 2 + pid_entry_count_dirs(tid_base_stuff, ARRAY_SIZE(tid_base_stuff))); d_set_d_op(dentry, &pid_dentry_operations); d_add(dentry, inode); /* Close the race of the process dying before we return the dentry */ if (pid_revalidate(dentry, 0)) return 0; out: return -ENOENT; } ",0 "PredictorEncodeRow(TIFF* tif, uint8* bp, tmsize_t cc, uint16 s) { TIFFPredictorState *sp = PredictorState(tif); assert(sp != NULL); assert(sp->encodepfunc != NULL); assert(sp->encoderow != NULL); /* XXX horizontal differencing alters user's data XXX */ (*sp->encodepfunc)(tif, bp, cc); return (*sp->encoderow)(tif, bp, cc, s); } ",1 "eb_create(int size) { struct eb_objects *eb; int count = PAGE_SIZE / sizeof(struct hlist_head) / 2; while (count > size) count >>= 1; eb = kzalloc(count*sizeof(struct hlist_head) + sizeof(struct eb_objects), GFP_KERNEL); if (eb == NULL) return eb; eb->and = count - 1; return eb; } ",0 " tbGetBuffer(unsigned size) { char *rtrn; if (size >= BUFFER_SIZE) return NULL; if ((BUFFER_SIZE - tbNext) <= size) tbNext = 0; rtrn = &textBuffer[tbNext]; tbNext += size; return rtrn; } ",1 "HeadlessDevToolsManagerDelegate::HeadlessDevToolsManagerDelegate( base::WeakPtr browser) : browser_(std::move(browser)) { command_map_[""Target.createTarget""] = base::Bind( &HeadlessDevToolsManagerDelegate::CreateTarget, base::Unretained(this)); command_map_[""Target.closeTarget""] = base::Bind( &HeadlessDevToolsManagerDelegate::CloseTarget, base::Unretained(this)); command_map_[""Target.createBrowserContext""] = base::Bind(&HeadlessDevToolsManagerDelegate::CreateBrowserContext, base::Unretained(this)); command_map_[""Target.disposeBrowserContext""] = base::Bind(&HeadlessDevToolsManagerDelegate::DisposeBrowserContext, base::Unretained(this)); command_map_[""Browser.close""] = base::Bind( &HeadlessDevToolsManagerDelegate::Close, base::Unretained(this)); command_map_[""Browser.getWindowForTarget""] = base::Bind(&HeadlessDevToolsManagerDelegate::GetWindowForTarget, base::Unretained(this)); command_map_[""Browser.getWindowBounds""] = base::Bind(&HeadlessDevToolsManagerDelegate::GetWindowBounds, base::Unretained(this)); command_map_[""Browser.setWindowBounds""] = base::Bind(&HeadlessDevToolsManagerDelegate::SetWindowBounds, base::Unretained(this)); command_map_[""HeadlessExperimental.enable""] = base::Bind(&HeadlessDevToolsManagerDelegate::EnableHeadlessExperimental, base::Unretained(this)); command_map_[""HeadlessExperimental.disable""] = base::Bind(&HeadlessDevToolsManagerDelegate::DisableHeadlessExperimental, base::Unretained(this)); unhandled_command_map_[""Network.emulateNetworkConditions""] = base::Bind(&HeadlessDevToolsManagerDelegate::EmulateNetworkConditions, base::Unretained(this)); unhandled_command_map_[""Network.disable""] = base::Bind( &HeadlessDevToolsManagerDelegate::NetworkDisable, base::Unretained(this)); async_command_map_[""Page.printToPDF""] = base::Bind( &HeadlessDevToolsManagerDelegate::PrintToPDF, base::Unretained(this)); async_command_map_[""HeadlessExperimental.beginFrame""] = base::Bind( &HeadlessDevToolsManagerDelegate::BeginFrame, base::Unretained(this)); } ",0 "MagickExport const char *GetMagickProperty(ImageInfo *image_info, Image *image,const char *property,ExceptionInfo *exception) { char value[MagickPathExtent]; const char *string; assert(property[0] != '\0'); assert(image != (Image *) NULL || image_info != (ImageInfo *) NULL ); if (property[1] == '\0') /* single letter property request */ return(GetMagickPropertyLetter(image_info,image,*property,exception)); if ((image != (Image *) NULL) && (image->debug != MagickFalse)) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); else if ((image_info != (ImageInfo *) NULL) && (image_info->debug != MagickFalse)) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",""no-images""); *value='\0'; /* formated string */ string=(char *) NULL; /* constant string reference */ switch (*property) { case 'b': { if (LocaleCompare(""basename"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); GetPathComponent(image->magick_filename,BasePath,value); if (*value == '\0') string=""""; break; } if (LocaleCompare(""bit-depth"",property) == 0) { (void) FormatLocaleString(value,MagickPathExtent,""%.20g"",(double) GetImageDepth(image,exception)); break; } break; } case 'c': { if (LocaleCompare(""channels"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); /* FUTURE: return actual image channels */ (void) FormatLocaleString(value,MagickPathExtent,""%s"", CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t) image->colorspace)); LocaleLower(value); if( image->alpha_trait != UndefinedPixelTrait ) (void) ConcatenateMagickString(value,""a"",MagickPathExtent); break; } if (LocaleCompare(""colorspace"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); /* FUTURE: return actual colorspace - no 'gray' stuff */ string=CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t) image->colorspace); break; } if (LocaleCompare(""compose"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); string=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t) image->compose); break; } if (LocaleCompare(""copyright"",property) == 0) { (void) CopyMagickString(value,GetMagickCopyright(),MagickPathExtent); break; } break; } case 'd': { if (LocaleCompare(""depth"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatLocaleString(value,MagickPathExtent,""%.20g"",(double) image->depth); break; } if (LocaleCompare(""directory"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); GetPathComponent(image->magick_filename,HeadPath,value); if (*value == '\0') string=""""; break; } break; } case 'e': { if (LocaleCompare(""entropy"",property) == 0) { double entropy; WarnNoImageReturn(""\""%%[%s]\"""",property); (void) GetImageEntropy(image,&entropy,exception); (void) FormatLocaleString(value,MagickPathExtent,""%.*g"", GetMagickPrecision(),entropy); break; } if (LocaleCompare(""extension"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); GetPathComponent(image->magick_filename,ExtensionPath,value); if (*value == '\0') string=""""; break; } break; } case 'g': { if (LocaleCompare(""gamma"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatLocaleString(value,MagickPathExtent,""%.*g"", GetMagickPrecision(),image->gamma); break; } break; } case 'h': { if (LocaleCompare(""height"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatLocaleString(value,MagickPathExtent,""%.20g"", image->magick_rows != 0 ? (double) image->magick_rows : 256.0); break; } break; } case 'i': { if (LocaleCompare(""input"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); string=image->filename; break; } break; } case 'k': { if (LocaleCompare(""kurtosis"",property) == 0) { double kurtosis, skewness; WarnNoImageReturn(""\""%%[%s]\"""",property); (void) GetImageKurtosis(image,&kurtosis,&skewness,exception); (void) FormatLocaleString(value,MagickPathExtent,""%.*g"", GetMagickPrecision(),kurtosis); break; } break; } case 'm': { if (LocaleCompare(""magick"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); string=image->magick; break; } if ((LocaleCompare(""maxima"",property) == 0) || (LocaleCompare(""max"",property) == 0)) { double maximum, minimum; WarnNoImageReturn(""\""%%[%s]\"""",property); (void) GetImageRange(image,&minimum,&maximum,exception); (void) FormatLocaleString(value,MagickPathExtent,""%.*g"", GetMagickPrecision(),maximum); break; } if (LocaleCompare(""mean"",property) == 0) { double mean, standard_deviation; WarnNoImageReturn(""\""%%[%s]\"""",property); (void) GetImageMean(image,&mean,&standard_deviation,exception); (void) FormatLocaleString(value,MagickPathExtent,""%.*g"", GetMagickPrecision(),mean); break; } if ((LocaleCompare(""minima"",property) == 0) || (LocaleCompare(""min"",property) == 0)) { double maximum, minimum; WarnNoImageReturn(""\""%%[%s]\"""",property); (void) GetImageRange(image,&minimum,&maximum,exception); (void) FormatLocaleString(value,MagickPathExtent,""%.*g"", GetMagickPrecision(),minimum); break; } break; } case 'o': { if (LocaleCompare(""opaque"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); string=CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) IsImageOpaque(image,exception)); break; } if (LocaleCompare(""orientation"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); string=CommandOptionToMnemonic(MagickOrientationOptions,(ssize_t) image->orientation); break; } if (LocaleCompare(""output"",property) == 0) { WarnNoImageInfoReturn(""\""%%[%s]\"""",property); (void) CopyMagickString(value,image_info->filename,MagickPathExtent); break; } break; } case 'p': { #if defined(MAGICKCORE_LCMS_DELEGATE) if (LocaleCompare(""profile:icc"",property) == 0 || LocaleCompare(""profile:icm"",property) == 0) { #if !defined(LCMS_VERSION) || (LCMS_VERSION < 2000) #define cmsUInt32Number DWORD #endif const StringInfo *profile; cmsHPROFILE icc_profile; profile=GetImageProfile(image,property+8); if (profile == (StringInfo *) NULL) break; icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile), (cmsUInt32Number) GetStringInfoLength(profile)); if (icc_profile != (cmsHPROFILE *) NULL) { #if defined(LCMS_VERSION) && (LCMS_VERSION < 2000) string=cmsTakeProductName(icc_profile); #else (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription, ""en"",""US"",value,MagickPathExtent); #endif (void) cmsCloseProfile(icc_profile); } } #endif if (LocaleCompare(""profiles"",property) == 0) { const char *name; ResetImageProfileIterator(image); name=GetNextImageProfile(image); if (name != (char *) NULL) { (void) CopyMagickString(value,name,MagickPathExtent); name=GetNextImageProfile(image); while (name != (char *) NULL) { ConcatenateMagickString(value,"","",MagickPathExtent); ConcatenateMagickString(value,name,MagickPathExtent); name=GetNextImageProfile(image); } } break; } break; } case 'r': { if (LocaleCompare(""resolution.x"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatLocaleString(value,MagickPathExtent,""%g"", image->resolution.x); break; } if (LocaleCompare(""resolution.y"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatLocaleString(value,MagickPathExtent,""%g"", image->resolution.y); break; } break; } case 's': { if (LocaleCompare(""scene"",property) == 0) { WarnNoImageInfoReturn(""\""%%[%s]\"""",property); if (image_info->number_scenes != 0) (void) FormatLocaleString(value,MagickPathExtent,""%.20g"",(double) image_info->scene); else { WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatLocaleString(value,MagickPathExtent,""%.20g"",(double) image->scene); } break; } if (LocaleCompare(""scenes"",property) == 0) { /* FUTURE: equivelent to %n? */ WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatLocaleString(value,MagickPathExtent,""%.20g"",(double) GetImageListLength(image)); break; } if (LocaleCompare(""size"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatMagickSize(GetBlobSize(image),MagickFalse,""B"", MagickPathExtent,value); break; } if (LocaleCompare(""skewness"",property) == 0) { double kurtosis, skewness; WarnNoImageReturn(""\""%%[%s]\"""",property); (void) GetImageKurtosis(image,&kurtosis,&skewness,exception); (void) FormatLocaleString(value,MagickPathExtent,""%.*g"", GetMagickPrecision(),skewness); break; } if (LocaleCompare(""standard-deviation"",property) == 0) { double mean, standard_deviation; WarnNoImageReturn(""\""%%[%s]\"""",property); (void) GetImageMean(image,&mean,&standard_deviation,exception); (void) FormatLocaleString(value,MagickPathExtent,""%.*g"", GetMagickPrecision(),standard_deviation); break; } break; } case 't': { if (LocaleCompare(""type"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); string=CommandOptionToMnemonic(MagickTypeOptions,(ssize_t) IdentifyImageType(image,exception)); break; } break; } case 'u': { if (LocaleCompare(""unique"",property) == 0) { WarnNoImageInfoReturn(""\""%%[%s]\"""",property); string=image_info->unique; break; } if (LocaleCompare(""units"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); string=CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t) image->units); break; } break; } case 'v': { if (LocaleCompare(""version"",property) == 0) { string=GetMagickVersion((size_t *) NULL); break; } break; } case 'w': { if (LocaleCompare(""width"",property) == 0) { WarnNoImageReturn(""\""%%[%s]\"""",property); (void) FormatLocaleString(value,MagickPathExtent,""%.20g"",(double) (image->magick_columns != 0 ? image->magick_columns : 256)); break; } break; } } if (string != (char *) NULL) return(string); if (*value != '\0') { /* Create a cloned copy of result, that will get cleaned up, eventually. */ if (image != (Image *) NULL) { (void) SetImageArtifact(image,""get-property"",value); return(GetImageArtifact(image,""get-property"")); } else { (void) SetImageOption(image_info,""get-property"",value); return(GetImageOption(image_info,""get-property"")); } } return((char *) NULL); } ",0 "check_sparse_region (struct tar_sparse_file *file, off_t beg, off_t end) { if (!lseek_or_error (file, beg)) return false; while (beg < end) { size_t bytes_read; size_t rdsize = BLOCKSIZE < end - beg ? BLOCKSIZE : end - beg; char diff_buffer[BLOCKSIZE]; bytes_read = safe_read (file->fd, diff_buffer, rdsize); if (bytes_read == SAFE_READ_ERROR) { read_diag_details (file->stat_info->orig_file_name, beg, rdsize); return false; } if (!zero_block_p (diff_buffer, bytes_read)) { char begbuf[INT_BUFSIZE_BOUND (off_t)]; report_difference (file->stat_info, _(""File fragment at %s is not a hole""), offtostr (beg, begbuf)); return false; } beg += bytes_read; } return true; } ",0 "OJPEGPreDecodeSkipRaw(TIFF* tif) { OJPEGState* sp=(OJPEGState*)tif->tif_data; uint32 m; m=sp->lines_per_strile; if (sp->subsampling_convert_state!=0) { if (sp->subsampling_convert_clines-sp->subsampling_convert_state>=m) { sp->subsampling_convert_state+=m; if (sp->subsampling_convert_state==sp->subsampling_convert_clines) sp->subsampling_convert_state=0; return(1); } m-=sp->subsampling_convert_clines-sp->subsampling_convert_state; sp->subsampling_convert_state=0; } while (m>=sp->subsampling_convert_clines) { if (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0) return(0); m-=sp->subsampling_convert_clines; } if (m>0) { if (jpeg_read_raw_data_encap(sp,&(sp->libjpeg_jpeg_decompress_struct),sp->subsampling_convert_ycbcrimage,sp->subsampling_ver*8)==0) return(0); sp->subsampling_convert_state=m; } return(1); } ",0 "process_triblt(STREAM s, TRIBLT_ORDER * os, uint32 present, RD_BOOL delta) { RD_HBITMAP bitmap; BRUSH brush; if (present & 0x000001) { in_uint8(s, os->cache_id); in_uint8(s, os->colour_table); } if (present & 0x000002) rdp_in_coord(s, &os->x, delta); if (present & 0x000004) rdp_in_coord(s, &os->y, delta); if (present & 0x000008) rdp_in_coord(s, &os->cx, delta); if (present & 0x000010) rdp_in_coord(s, &os->cy, delta); if (present & 0x000020) in_uint8(s, os->opcode); if (present & 0x000040) rdp_in_coord(s, &os->srcx, delta); if (present & 0x000080) rdp_in_coord(s, &os->srcy, delta); if (present & 0x000100) rdp_in_colour(s, &os->bgcolour); if (present & 0x000200) rdp_in_colour(s, &os->fgcolour); rdp_parse_brush(s, &os->brush, present >> 10); if (present & 0x008000) in_uint16_le(s, os->cache_idx); if (present & 0x010000) in_uint16_le(s, os->unknown); logger(Graphics, Debug, ""process_triblt(), op=0x%x, x=%d, y=%d, cx=%d, cy=%d, id=%d, idx=%d, bs=%d, bg=0x%x, fg=0x%x"", os->opcode, os->x, os->y, os->cx, os->cy, os->cache_id, os->cache_idx, os->brush.style, os->bgcolour, os->fgcolour); bitmap = cache_get_bitmap(os->cache_id, os->cache_idx); if (bitmap == NULL) return; setup_brush(&brush, &os->brush); ui_triblt(os->opcode, os->x, os->y, os->cx, os->cy, bitmap, os->srcx, os->srcy, &brush, os->bgcolour, os->fgcolour); } ",0 "scoped_refptr UrlIndex::NewUrlData(const GURL& url, UrlData::CORSMode cors_mode) { return new UrlData(url, cors_mode, this); } ",0 "ikev2_ke_print(netdissect_options *ndo, u_char tpay, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct ikev2_ke ke; const struct ikev2_ke *k; k = (const struct ikev2_ke *)ext; ND_TCHECK(*ext); UNALIGNED_MEMCPY(&ke, ext, sizeof(ke)); ikev2_pay_print(ndo, NPSTR(tpay), ke.h.critical); ND_PRINT((ndo,"" len=%u group=%s"", ntohs(ke.h.len) - 8, STR_OR_ID(ntohs(ke.ke_group), dh_p_map))); if (2 < ndo->ndo_vflag && 8 < ntohs(ke.h.len)) { ND_PRINT((ndo,"" "")); if (!rawprint(ndo, (const uint8_t *)(k + 1), ntohs(ke.h.len) - 8)) goto trunc; } return (const u_char *)ext + ntohs(ke.h.len); trunc: ND_PRINT((ndo,"" [|%s]"", NPSTR(tpay))); return NULL; } ",1 " tt_slot_init( FT_GlyphSlot slot ) { return FT_GlyphLoader_CreateExtra( slot->internal->loader ); } ",0 "struct anon_vma *find_mergeable_anon_vma(struct vm_area_struct *vma) { struct anon_vma *anon_vma; struct vm_area_struct *near; near = vma->vm_next; if (!near) goto try_prev; anon_vma = reusable_anon_vma(near, vma, near); if (anon_vma) return anon_vma; try_prev: near = vma->vm_prev; if (!near) goto none; anon_vma = reusable_anon_vma(near, near, vma); if (anon_vma) return anon_vma; none: /* * There's no absolute need to look only at touching neighbours: * we could search further afield for ""compatible"" anon_vmas. * But it would probably just be a waste of time searching, * or lead to too many vmas hanging off the same anon_vma. * We're trying to allow mprotect remerging later on, * not trying to minimize memory used for anon_vmas. */ return NULL; } ",0 "int ParseCaffHeaderConfig (FILE *infile, char *infilename, char *fourcc, WavpackContext *wpc, WavpackConfig *config) { uint32_t chan_chunk = 0, channel_layout = 0, bcount; unsigned char *channel_identities = NULL; unsigned char *channel_reorder = NULL; int64_t total_samples = 0, infilesize; CAFFileHeader caf_file_header; CAFChunkHeader caf_chunk_header; CAFAudioFormat caf_audio_format; int i; infilesize = DoGetFileSize (infile); memcpy (&caf_file_header, fourcc, 4); if ((!DoReadFile (infile, ((char *) &caf_file_header) + 4, sizeof (CAFFileHeader) - 4, &bcount) || bcount != sizeof (CAFFileHeader) - 4)) { error_line (""%s is not a valid .CAF file!"", infilename); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &caf_file_header, sizeof (CAFFileHeader))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } WavpackBigEndianToNative (&caf_file_header, CAFFileHeaderFormat); if (caf_file_header.mFileVersion != 1) { error_line (""%s: can't handle version %d .CAF files!"", infilename, caf_file_header.mFileVersion); return WAVPACK_SOFT_ERROR; } while (1) { if (!DoReadFile (infile, &caf_chunk_header, sizeof (CAFChunkHeader), &bcount) || bcount != sizeof (CAFChunkHeader)) { error_line (""%s is not a valid .CAF file!"", infilename); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &caf_chunk_header, sizeof (CAFChunkHeader))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } WavpackBigEndianToNative (&caf_chunk_header, CAFChunkHeaderFormat); if (!strncmp (caf_chunk_header.mChunkType, ""desc"", 4)) { int supported = TRUE; if (caf_chunk_header.mChunkSize != sizeof (CAFAudioFormat) || !DoReadFile (infile, &caf_audio_format, (uint32_t) caf_chunk_header.mChunkSize, &bcount) || bcount != caf_chunk_header.mChunkSize) { error_line (""%s is not a valid .CAF file!"", infilename); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &caf_audio_format, (uint32_t) caf_chunk_header.mChunkSize)) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } WavpackBigEndianToNative (&caf_audio_format, CAFAudioFormatFormat); if (debug_logging_mode) { char formatstr [5]; memcpy (formatstr, caf_audio_format.mFormatID, 4); formatstr [4] = 0; error_line (""format = %s, flags = %x, sampling rate = %g"", formatstr, caf_audio_format.mFormatFlags, caf_audio_format.mSampleRate); error_line (""packet = %d bytes and %d frames"", caf_audio_format.mBytesPerPacket, caf_audio_format.mFramesPerPacket); error_line (""channels per frame = %d, bits per channel = %d"", caf_audio_format.mChannelsPerFrame, caf_audio_format.mBitsPerChannel); } if (strncmp (caf_audio_format.mFormatID, ""lpcm"", 4) || (caf_audio_format.mFormatFlags & ~3)) supported = FALSE; else if (caf_audio_format.mSampleRate < 1.0 || caf_audio_format.mSampleRate > 16777215.0 || caf_audio_format.mSampleRate != floor (caf_audio_format.mSampleRate)) supported = FALSE; else if (!caf_audio_format.mChannelsPerFrame || caf_audio_format.mChannelsPerFrame > 256) supported = FALSE; else if (caf_audio_format.mBitsPerChannel < 1 || caf_audio_format.mBitsPerChannel > 32 || ((caf_audio_format.mFormatFlags & CAF_FORMAT_FLOAT) && caf_audio_format.mBitsPerChannel != 32)) supported = FALSE; else if (caf_audio_format.mFramesPerPacket != 1 || caf_audio_format.mBytesPerPacket / caf_audio_format.mChannelsPerFrame < (caf_audio_format.mBitsPerChannel + 7) / 8 || caf_audio_format.mBytesPerPacket / caf_audio_format.mChannelsPerFrame > 4 || caf_audio_format.mBytesPerPacket % caf_audio_format.mChannelsPerFrame) supported = FALSE; if (!supported) { error_line (""%s is an unsupported .CAF format!"", infilename); return WAVPACK_SOFT_ERROR; } config->bytes_per_sample = caf_audio_format.mBytesPerPacket / caf_audio_format.mChannelsPerFrame; config->float_norm_exp = (caf_audio_format.mFormatFlags & CAF_FORMAT_FLOAT) ? 127 : 0; config->bits_per_sample = caf_audio_format.mBitsPerChannel; config->num_channels = caf_audio_format.mChannelsPerFrame; config->sample_rate = (int) caf_audio_format.mSampleRate; if (!(caf_audio_format.mFormatFlags & CAF_FORMAT_LITTLE_ENDIAN) && config->bytes_per_sample > 1) config->qmode |= QMODE_BIG_ENDIAN; if (config->bytes_per_sample == 1) config->qmode |= QMODE_SIGNED_BYTES; if (debug_logging_mode) { if (config->float_norm_exp == 127) error_line (""data format: 32-bit %s-endian floating point"", (config->qmode & QMODE_BIG_ENDIAN) ? ""big"" : ""little""); else error_line (""data format: %d-bit %s-endian integers stored in %d byte(s)"", config->bits_per_sample, (config->qmode & QMODE_BIG_ENDIAN) ? ""big"" : ""little"", config->bytes_per_sample); } } else if (!strncmp (caf_chunk_header.mChunkType, ""chan"", 4)) { CAFChannelLayout *caf_channel_layout = malloc ((size_t) caf_chunk_header.mChunkSize); if (caf_chunk_header.mChunkSize < sizeof (CAFChannelLayout) || !DoReadFile (infile, caf_channel_layout, (uint32_t) caf_chunk_header.mChunkSize, &bcount) || bcount != caf_chunk_header.mChunkSize) { error_line (""%s is not a valid .CAF file!"", infilename); free (caf_channel_layout); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, caf_channel_layout, (uint32_t) caf_chunk_header.mChunkSize)) { error_line (""%s"", WavpackGetErrorMessage (wpc)); free (caf_channel_layout); return WAVPACK_SOFT_ERROR; } WavpackBigEndianToNative (caf_channel_layout, CAFChannelLayoutFormat); chan_chunk = 1; if (config->channel_mask || (config->qmode & QMODE_CHANS_UNASSIGNED)) { error_line (""this CAF file already has channel order information!""); free (caf_channel_layout); return WAVPACK_SOFT_ERROR; } switch (caf_channel_layout->mChannelLayoutTag) { case kCAFChannelLayoutTag_UseChannelDescriptions: { CAFChannelDescription *descriptions = (CAFChannelDescription *) (caf_channel_layout + 1); int num_descriptions = caf_channel_layout->mNumberChannelDescriptions; int label, cindex = 0, idents = 0; if (caf_chunk_header.mChunkSize != sizeof (CAFChannelLayout) + sizeof (CAFChannelDescription) * num_descriptions || num_descriptions != config->num_channels) { error_line (""channel descriptions in 'chan' chunk are the wrong size!""); free (caf_channel_layout); return WAVPACK_SOFT_ERROR; } if (num_descriptions >= 256) { error_line (""%d channel descriptions is more than we can handle...ignoring!""); break; } channel_reorder = malloc (num_descriptions); memset (channel_reorder, -1, num_descriptions); channel_identities = malloc (num_descriptions+1); for (i = 0; i < num_descriptions; ++i) { WavpackBigEndianToNative (descriptions + i, CAFChannelDescriptionFormat); if (debug_logging_mode) error_line (""chan %d --> %d"", i + 1, descriptions [i].mChannelLabel); } for (label = 1; label <= 18; ++label) for (i = 0; i < num_descriptions; ++i) if (descriptions [i].mChannelLabel == label) { config->channel_mask |= 1 << (label - 1); channel_reorder [i] = cindex++; break; } for (i = 0; i < num_descriptions; ++i) if (channel_reorder [i] == (unsigned char) -1) { uint32_t clabel = descriptions [i].mChannelLabel; if (clabel == 0 || clabel == 0xffffffff || clabel == 100) channel_identities [idents++] = 0xff; else if ((clabel >= 33 && clabel <= 44) || (clabel >= 200 && clabel <= 207) || (clabel >= 301 && clabel <= 305)) channel_identities [idents++] = clabel >= 301 ? clabel - 80 : clabel; else { error_line (""warning: unknown channel descriptions label: %d"", clabel); channel_identities [idents++] = 0xff; } channel_reorder [i] = cindex++; } for (i = 0; i < num_descriptions; ++i) if (channel_reorder [i] != i) break; if (i == num_descriptions) { free (channel_reorder); // no reordering required, so don't channel_reorder = NULL; } else { config->qmode |= QMODE_REORDERED_CHANS; // reordering required, put channel count into layout channel_layout = num_descriptions; } if (!idents) { // if no non-MS channels, free the identities string free (channel_identities); channel_identities = NULL; } else channel_identities [idents] = 0; // otherwise NULL terminate it if (debug_logging_mode) { error_line (""layout_tag = 0x%08x, so generated bitmap of 0x%08x from %d descriptions, %d non-MS"", caf_channel_layout->mChannelLayoutTag, config->channel_mask, caf_channel_layout->mNumberChannelDescriptions, idents); if (channel_reorder && num_descriptions <= 8) { char reorder_string [] = ""12345678""; for (i = 0; i < num_descriptions; ++i) reorder_string [i] = channel_reorder [i] + '1'; reorder_string [i] = 0; error_line (""reordering string = \""%s\""\n"", reorder_string); } } } break; case kCAFChannelLayoutTag_UseChannelBitmap: config->channel_mask = caf_channel_layout->mChannelBitmap; if (debug_logging_mode) error_line (""layout_tag = 0x%08x, so using supplied bitmap of 0x%08x"", caf_channel_layout->mChannelLayoutTag, caf_channel_layout->mChannelBitmap); break; default: for (i = 0; i < NUM_LAYOUTS; ++i) if (caf_channel_layout->mChannelLayoutTag == layouts [i].mChannelLayoutTag) { config->channel_mask = layouts [i].mChannelBitmap; channel_layout = layouts [i].mChannelLayoutTag; if (layouts [i].mChannelReorder) { channel_reorder = (unsigned char *) strdup (layouts [i].mChannelReorder); config->qmode |= QMODE_REORDERED_CHANS; } if (layouts [i].mChannelIdentities) channel_identities = (unsigned char *) strdup (layouts [i].mChannelIdentities); if (debug_logging_mode) error_line (""layout_tag 0x%08x found in table, bitmap = 0x%08x, reorder = %s, identities = %s"", channel_layout, config->channel_mask, channel_reorder ? ""yes"" : ""no"", channel_identities ? ""yes"" : ""no""); break; } if (i == NUM_LAYOUTS && debug_logging_mode) error_line (""layout_tag 0x%08x not found in table...all channels unassigned"", caf_channel_layout->mChannelLayoutTag); break; } free (caf_channel_layout); } else if (!strncmp (caf_chunk_header.mChunkType, ""data"", 4)) { // on the data chunk, get size and exit loop uint32_t mEditCount; if (!DoReadFile (infile, &mEditCount, sizeof (mEditCount), &bcount) || bcount != sizeof (mEditCount)) { error_line (""%s is not a valid .CAF file!"", infilename); return WAVPACK_SOFT_ERROR; } else if (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, &mEditCount, sizeof (mEditCount))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } if ((config->qmode & QMODE_IGNORE_LENGTH) || caf_chunk_header.mChunkSize == -1) { config->qmode |= QMODE_IGNORE_LENGTH; if (infilesize && DoGetFilePosition (infile) != -1) total_samples = (infilesize - DoGetFilePosition (infile)) / caf_audio_format.mBytesPerPacket; else total_samples = -1; } else { if (infilesize && infilesize - caf_chunk_header.mChunkSize > 16777216) { error_line ("".CAF file %s has over 16 MB of extra CAFF data, probably is corrupt!"", infilename); return WAVPACK_SOFT_ERROR; } if ((caf_chunk_header.mChunkSize - 4) % caf_audio_format.mBytesPerPacket) { error_line ("".CAF file %s has an invalid data chunk size, probably is corrupt!"", infilename); return WAVPACK_SOFT_ERROR; } total_samples = (caf_chunk_header.mChunkSize - 4) / caf_audio_format.mBytesPerPacket; if (!total_samples) { error_line (""this .CAF file has no audio samples, probably is corrupt!""); return WAVPACK_SOFT_ERROR; } if (total_samples > MAX_WAVPACK_SAMPLES) { error_line (""%s has too many samples for WavPack!"", infilename); return WAVPACK_SOFT_ERROR; } } break; } else { // just copy unknown chunks to output file int bytes_to_copy = (uint32_t) caf_chunk_header.mChunkSize; char *buff = malloc (bytes_to_copy); if (debug_logging_mode) error_line (""extra unknown chunk \""%c%c%c%c\"" of %d bytes"", caf_chunk_header.mChunkType [0], caf_chunk_header.mChunkType [1], caf_chunk_header.mChunkType [2], caf_chunk_header.mChunkType [3], caf_chunk_header.mChunkSize); if (!DoReadFile (infile, buff, bytes_to_copy, &bcount) || bcount != bytes_to_copy || (!(config->qmode & QMODE_NO_STORE_WRAPPER) && !WavpackAddWrapper (wpc, buff, bytes_to_copy))) { error_line (""%s"", WavpackGetErrorMessage (wpc)); free (buff); return WAVPACK_SOFT_ERROR; } free (buff); } } if (!chan_chunk && !config->channel_mask && config->num_channels <= 2 && !(config->qmode & QMODE_CHANS_UNASSIGNED)) config->channel_mask = 0x5 - config->num_channels; if (!WavpackSetConfiguration64 (wpc, config, total_samples, channel_identities)) { error_line (""%s"", WavpackGetErrorMessage (wpc)); return WAVPACK_SOFT_ERROR; } if (channel_identities) free (channel_identities); if (channel_layout || channel_reorder) { if (!WavpackSetChannelLayout (wpc, channel_layout, channel_reorder)) { error_line (""problem with setting channel layout (should not happen)""); return WAVPACK_SOFT_ERROR; } if (channel_reorder) free (channel_reorder); } return WAVPACK_NO_ERROR; } ",1 "acc_ctx_cont(OM_uint32 *minstat, gss_buffer_t buf, gss_ctx_id_t *ctx, gss_buffer_t *responseToken, gss_buffer_t *mechListMIC, OM_uint32 *negState, send_token_flag *return_token) { OM_uint32 ret, tmpmin; gss_OID supportedMech; spnego_gss_ctx_id_t sc; unsigned int len; unsigned char *ptr, *bufstart; sc = (spnego_gss_ctx_id_t)*ctx; ret = GSS_S_DEFECTIVE_TOKEN; *negState = REJECT; *minstat = 0; supportedMech = GSS_C_NO_OID; *return_token = ERROR_TOKEN_SEND; *responseToken = *mechListMIC = GSS_C_NO_BUFFER; ptr = bufstart = buf->value; #define REMAIN (buf->length - (ptr - bufstart)) if (REMAIN == 0 || REMAIN > INT_MAX) return GSS_S_DEFECTIVE_TOKEN; /* * Attempt to work with old Sun SPNEGO. */ if (*ptr == HEADER_ID) { ret = g_verify_token_header(gss_mech_spnego, &len, &ptr, 0, REMAIN); if (ret) { *minstat = ret; return GSS_S_DEFECTIVE_TOKEN; } } if (*ptr != (CONTEXT | 0x01)) { return GSS_S_DEFECTIVE_TOKEN; } ret = get_negTokenResp(minstat, ptr, REMAIN, negState, &supportedMech, responseToken, mechListMIC); if (ret != GSS_S_COMPLETE) goto cleanup; if (*responseToken == GSS_C_NO_BUFFER && *mechListMIC == GSS_C_NO_BUFFER) { ret = GSS_S_DEFECTIVE_TOKEN; goto cleanup; } if (supportedMech != GSS_C_NO_OID) { ret = GSS_S_DEFECTIVE_TOKEN; goto cleanup; } sc->firstpass = 0; *negState = ACCEPT_INCOMPLETE; *return_token = CONT_TOKEN_SEND; cleanup: if (supportedMech != GSS_C_NO_OID) { generic_gss_release_oid(&tmpmin, &supportedMech); } return ret; #undef REMAIN } ",0 "static kadm5_ret_t new_server_handle(krb5_ui_4 api_version, struct svc_req *rqstp, kadm5_server_handle_t *out_handle) { kadm5_server_handle_t handle; *out_handle = NULL; if (! (handle = (kadm5_server_handle_t) malloc(sizeof(*handle)))) return ENOMEM; *handle = *(kadm5_server_handle_t)global_server_handle; handle->api_version = api_version; if (! gss_to_krb5_name(handle, rqst2name(rqstp), &handle->current_caller)) { free(handle); return KADM5_FAILURE; } *out_handle = handle; return 0; } ",0 "void CheckGetNodesByIdReturnArgs(const SyncManager& sync_manager, const JsArgList& return_args, int64 id, bool is_detailed) { EXPECT_EQ(1u, return_args.Get().GetSize()); ListValue* nodes = NULL; ASSERT_TRUE(return_args.Get().GetList(0, &nodes)); ASSERT_TRUE(nodes); EXPECT_EQ(1u, nodes->GetSize()); DictionaryValue* node_info = NULL; EXPECT_TRUE(nodes->GetDictionary(0, &node_info)); ASSERT_TRUE(node_info); ReadTransaction trans(FROM_HERE, sync_manager.GetUserShare()); ReadNode node(&trans); EXPECT_EQ(BaseNode::INIT_OK, node.InitByIdLookup(id)); CheckNodeValue(node, *node_info, is_detailed); } ",0 "static int emulator_do_task_switch(struct x86_emulate_ctxt *ctxt, u16 tss_selector, int idt_index, int reason, bool has_error_code, u32 error_code) { const struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct curr_tss_desc, next_tss_desc; int ret; u16 old_tss_sel = get_segment_selector(ctxt, VCPU_SREG_TR); ulong old_tss_base = ops->get_cached_segment_base(ctxt, VCPU_SREG_TR); u32 desc_limit; ulong desc_addr; /* FIXME: old_tss_base == ~0 ? */ ret = read_segment_descriptor(ctxt, tss_selector, &next_tss_desc, &desc_addr); if (ret != X86EMUL_CONTINUE) return ret; ret = read_segment_descriptor(ctxt, old_tss_sel, &curr_tss_desc, &desc_addr); if (ret != X86EMUL_CONTINUE) return ret; /* FIXME: check that next_tss_desc is tss */ /* * Check privileges. The three cases are task switch caused by... * * 1. jmp/call/int to task gate: Check against DPL of the task gate * 2. Exception/IRQ/iret: No check is performed * 3. jmp/call to TSS/task-gate: No check is performed since the * hardware checks it before exiting. */ if (reason == TASK_SWITCH_GATE) { if (idt_index != -1) { /* Software interrupts */ struct desc_struct task_gate_desc; int dpl; ret = read_interrupt_descriptor(ctxt, idt_index, &task_gate_desc); if (ret != X86EMUL_CONTINUE) return ret; dpl = task_gate_desc.dpl; if ((tss_selector & 3) > dpl || ops->cpl(ctxt) > dpl) return emulate_gp(ctxt, (idt_index << 3) | 0x2); } } desc_limit = desc_limit_scaled(&next_tss_desc); if (!next_tss_desc.p || ((desc_limit < 0x67 && (next_tss_desc.type & 8)) || desc_limit < 0x2b)) { return emulate_ts(ctxt, tss_selector & 0xfffc); } if (reason == TASK_SWITCH_IRET || reason == TASK_SWITCH_JMP) { curr_tss_desc.type &= ~(1 << 1); /* clear busy flag */ write_segment_descriptor(ctxt, old_tss_sel, &curr_tss_desc); } if (reason == TASK_SWITCH_IRET) ctxt->eflags = ctxt->eflags & ~X86_EFLAGS_NT; /* set back link to prev task only if NT bit is set in eflags note that old_tss_sel is not used after this point */ if (reason != TASK_SWITCH_CALL && reason != TASK_SWITCH_GATE) old_tss_sel = 0xffff; if (next_tss_desc.type & 8) ret = task_switch_32(ctxt, tss_selector, old_tss_sel, old_tss_base, &next_tss_desc); else ret = task_switch_16(ctxt, tss_selector, old_tss_sel, old_tss_base, &next_tss_desc); if (ret != X86EMUL_CONTINUE) return ret; if (reason == TASK_SWITCH_CALL || reason == TASK_SWITCH_GATE) ctxt->eflags = ctxt->eflags | X86_EFLAGS_NT; if (reason != TASK_SWITCH_IRET) { next_tss_desc.type |= (1 << 1); /* set busy flag */ write_segment_descriptor(ctxt, tss_selector, &next_tss_desc); } ops->set_cr(ctxt, 0, ops->get_cr(ctxt, 0) | X86_CR0_TS); ops->set_segment(ctxt, tss_selector, &next_tss_desc, 0, VCPU_SREG_TR); if (has_error_code) { ctxt->op_bytes = ctxt->ad_bytes = (next_tss_desc.type & 8) ? 4 : 2; ctxt->lock_prefix = 0; ctxt->src.val = (unsigned long) error_code; ret = em_push(ctxt); } return ret; } ",0 "bool AppCacheDatabase::DeleteEntriesForCache(int64_t cache_id) { if (!LazyOpen(kDontCreate)) return false; static const char kSql[] = ""DELETE FROM Entries WHERE cache_id = ?""; sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql)); statement.BindInt64(0, cache_id); return statement.Run(); } ",0 "static bool __vsock_in_connected_table(struct vsock_sock *vsk) { return !list_empty(&vsk->connected_table); } ",0 "XML_SetStartElementHandler(XML_Parser parser, XML_StartElementHandler start) { if (parser != NULL) parser->m_startElementHandler = start; } ",0 "static void vmxnet3_pci_uninit(PCIDevice *pci_dev) { DeviceState *dev = DEVICE(pci_dev); VMXNET3State *s = VMXNET3(pci_dev); VMW_CBPRN(""Starting uninit...""); unregister_savevm(dev, ""vmxnet3-msix"", s); vmxnet3_net_uninit(s); vmxnet3_cleanup_msix(s); vmxnet3_cleanup_msi(s); memory_region_destroy(&s->bar0); memory_region_destroy(&s->bar1); memory_region_destroy(&s->msix_bar); } ",0 "_kdc_tgs_rep(krb5_context context, krb5_kdc_configuration *config, KDC_REQ *req, krb5_data *data, const char *from, struct sockaddr *from_addr, int datagram_reply) { AuthorizationData *auth_data = NULL; krb5_error_code ret; int i = 0; const PA_DATA *tgs_req; hdb_entry_ex *krbtgt = NULL; krb5_ticket *ticket = NULL; const char *e_text = NULL; krb5_enctype krbtgt_etype = ETYPE_NULL; krb5_keyblock *replykey = NULL; int rk_is_subkey = 0; time_t *csec = NULL; int *cusec = NULL; if(req->padata == NULL){ ret = KRB5KDC_ERR_PREAUTH_REQUIRED; /* XXX ??? */ kdc_log(context, config, 0, ""TGS-REQ from %s without PA-DATA"", from); goto out; } tgs_req = _kdc_find_padata(req, &i, KRB5_PADATA_TGS_REQ); if(tgs_req == NULL){ ret = KRB5KDC_ERR_PADATA_TYPE_NOSUPP; kdc_log(context, config, 0, ""TGS-REQ from %s without PA-TGS-REQ"", from); goto out; } ret = tgs_parse_request(context, config, &req->req_body, tgs_req, &krbtgt, &krbtgt_etype, &ticket, &e_text, from, from_addr, &csec, &cusec, &auth_data, &replykey, &rk_is_subkey); if (ret == HDB_ERR_NOT_FOUND_HERE) { /* kdc_log() is called in tgs_parse_request() */ goto out; } if (ret) { kdc_log(context, config, 0, ""Failed parsing TGS-REQ from %s"", from); goto out; } { const PA_DATA *pa = _kdc_find_padata(req, &i, KRB5_PADATA_FX_FAST); if (pa) kdc_log(context, config, 10, ""Got TGS FAST request""); } ret = tgs_build_reply(context, config, req, &req->req_body, krbtgt, krbtgt_etype, replykey, rk_is_subkey, ticket, data, from, &e_text, &auth_data, from_addr); if (ret) { kdc_log(context, config, 0, ""Failed building TGS-REP to %s"", from); goto out; } /* */ if (datagram_reply && data->length > config->max_datagram_reply_length) { krb5_data_free(data); ret = KRB5KRB_ERR_RESPONSE_TOO_BIG; e_text = ""Reply packet too large""; } out: if (replykey) krb5_free_keyblock(context, replykey); if(ret && ret != HDB_ERR_NOT_FOUND_HERE && data->data == NULL){ /* XXX add fast wrapping on the error */ METHOD_DATA error_method = { 0, NULL }; kdc_log(context, config, 10, ""tgs-req: sending error: %d to client"", ret); ret = _kdc_fast_mk_error(context, NULL, &error_method, NULL, NULL, ret, NULL, NULL, NULL, NULL, csec, cusec, data); free_METHOD_DATA(&error_method); } free(csec); free(cusec); if (ticket) krb5_free_ticket(context, ticket); if(krbtgt) _kdc_free_ent(context, krbtgt); if (auth_data) { free_AuthorizationData(auth_data); free(auth_data); } return ret; } ",0 "const gfx::Rect LayerTreeHostImpl::ViewportRectForTilePriority() const { if (viewport_rect_for_tile_priority_.IsEmpty()) return DeviceViewport(); return viewport_rect_for_tile_priority_; } ",0 "newSWFInput_filename(const char *filename) { FILE *file; SWFInput input; file = fopen(filename, ""rb""); if(file == NULL) { SWF_warn(""newSWFInput_filename: %s: %s\n"", filename, strerror(errno)); return NULL; } input = newSWFInput_file(file); if(input == NULL) return NULL; input->destroy = SWFInput_dtor_close; return input; } ",0 "void PrintPreviewHandler::HandleGetPrinters(const ListValue* /*args*/) { scoped_refptr task = new PrintSystemTaskProxy(AsWeakPtr(), print_backend_.get(), has_logged_printers_count_); has_logged_printers_count_ = true; BrowserThread::PostTask( BrowserThread::FILE, FROM_HERE, base::Bind(&PrintSystemTaskProxy::EnumeratePrinters, task.get())); } ",0 "long Segment::Load() { assert(m_clusters == NULL); assert(m_clusterSize == 0); assert(m_clusterCount == 0); const long long header_status = ParseHeaders(); if (header_status < 0) //error return static_cast(header_status); if (header_status > 0) //underflow return E_BUFFER_NOT_FULL; assert(m_pInfo); assert(m_pTracks); for (;;) { const int status = LoadCluster(); if (status < 0) //error return status; if (status >= 1) //no more clusters return 0; } } ",1 "static int show_stat(struct kmem_cache *s, char *buf, enum stat_item si) { unsigned long sum = 0; int cpu; int len; int *data = kmalloc(nr_cpu_ids * sizeof(int), GFP_KERNEL); if (!data) return -ENOMEM; for_each_online_cpu(cpu) { unsigned x = get_cpu_slab(s, cpu)->stat[si]; data[cpu] = x; sum += x; } len = sprintf(buf, ""%lu"", sum); #ifdef CONFIG_SMP for_each_online_cpu(cpu) { if (data[cpu] && len < PAGE_SIZE - 20) len += sprintf(buf + len, "" C%d=%u"", cpu, data[cpu]); } #endif kfree(data); return len + sprintf(buf + len, ""\n""); } ",0 "static int __remove_section(struct zone *zone, struct mem_section *ms) { unsigned long flags; struct pglist_data *pgdat = zone->zone_pgdat; int ret = -EINVAL; if (!valid_section(ms)) return ret; ret = unregister_memory_section(ms); if (ret) return ret; pgdat_resize_lock(pgdat, &flags); sparse_remove_one_section(zone, ms); pgdat_resize_unlock(pgdat, &flags); return 0; } ",0 "static void intr_callback(struct urb *urb) { rtl8150_t *dev; __u8 *d; int status = urb->status; int res; dev = urb->context; if (!dev) return; switch (status) { case 0: /* success */ break; case -ECONNRESET: /* unlink */ case -ENOENT: case -ESHUTDOWN: return; /* -EPIPE: should clear the halt */ default: dev_info(&urb->dev->dev, ""%s: intr status %d\n"", dev->netdev->name, status); goto resubmit; } d = urb->transfer_buffer; if (d[0] & TSR_ERRORS) { dev->netdev->stats.tx_errors++; if (d[INT_TSR] & (TSR_ECOL | TSR_JBR)) dev->netdev->stats.tx_aborted_errors++; if (d[INT_TSR] & TSR_LCOL) dev->netdev->stats.tx_window_errors++; if (d[INT_TSR] & TSR_LOSS_CRS) dev->netdev->stats.tx_carrier_errors++; } /* Report link status changes to the network stack */ if ((d[INT_MSR] & MSR_LINK) == 0) { if (netif_carrier_ok(dev->netdev)) { netif_carrier_off(dev->netdev); netdev_dbg(dev->netdev, ""%s: LINK LOST\n"", __func__); } } else { if (!netif_carrier_ok(dev->netdev)) { netif_carrier_on(dev->netdev); netdev_dbg(dev->netdev, ""%s: LINK CAME BACK\n"", __func__); } } resubmit: res = usb_submit_urb (urb, GFP_ATOMIC); if (res == -ENODEV) netif_device_detach(dev->netdev); else if (res) dev_err(&dev->udev->dev, ""can't resubmit intr, %s-%s/input0, status %d\n"", dev->udev->bus->bus_name, dev->udev->devpath, res); } ",0 "static int copy_user_offload(struct xfrm_state_offload *xso, struct sk_buff *skb) { struct xfrm_user_offload *xuo; struct nlattr *attr; attr = nla_reserve(skb, XFRMA_OFFLOAD_DEV, sizeof(*xuo)); if (attr == NULL) return -EMSGSIZE; xuo = nla_data(attr); memset(xuo, 0, sizeof(*xuo)); xuo->ifindex = xso->dev->ifindex; xuo->flags = xso->flags; return 0; } ",0 "static GF_ESD *FFD_GetESDescriptor(FFDemux *ffd, Bool for_audio) { GF_BitStream *bs; Bool dont_use_sl; GF_ESD *esd = (GF_ESD *) gf_odf_desc_esd_new(0); esd->ESID = 1 + (for_audio ? ffd->audio_st : ffd->video_st); esd->decoderConfig->streamType = for_audio ? GF_STREAM_AUDIO : GF_STREAM_VISUAL; esd->decoderConfig->avgBitrate = esd->decoderConfig->maxBitrate = 0; /*remap std object types - depending on input formats, FFMPEG may not have separate DSI from initial frame. In this case we have no choice but using FFMPEG decoders*/ if (for_audio) { AVCodecContext *dec = ffd->ctx->streams[ffd->audio_st]->codec; esd->slConfig->timestampResolution = ffd->audio_tscale.den; switch (dec->codec_id) { case CODEC_ID_MP2: esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_MPEG1; break; case CODEC_ID_MP3: esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_MPEG2_PART3; break; case CODEC_ID_AAC: if (!dec->extradata_size) goto opaque_audio; esd->decoderConfig->objectTypeIndication = GPAC_OTI_AUDIO_AAC_MPEG4; esd->decoderConfig->decoderSpecificInfo->dataLength = dec->extradata_size; esd->decoderConfig->decoderSpecificInfo->data = (char*)gf_malloc(sizeof(char)*dec->extradata_size); memcpy(esd->decoderConfig->decoderSpecificInfo->data, dec->extradata, sizeof(char)*dec->extradata_size); break; default: opaque_audio: esd->decoderConfig->objectTypeIndication = GPAC_OTI_MEDIA_FFMPEG; bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); gf_bs_write_u32(bs, dec->codec_id); gf_bs_write_u32(bs, dec->sample_rate); gf_bs_write_u16(bs, dec->channels); gf_bs_write_u16(bs, dec->frame_size); gf_bs_write_u8(bs, 16); gf_bs_write_u8(bs, 0); /*ffmpeg specific*/ gf_bs_write_u16(bs, dec->block_align); gf_bs_write_u32(bs, dec->bit_rate); gf_bs_write_u32(bs, dec->codec_tag); if (dec->extradata_size) { gf_bs_write_data(bs, (char *) dec->extradata, dec->extradata_size); } gf_bs_get_content(bs, (char **) &esd->decoderConfig->decoderSpecificInfo->data, &esd->decoderConfig->decoderSpecificInfo->dataLength); gf_bs_del(bs); break; } dont_use_sl = ffd->unreliable_audio_timing; } else { AVCodecContext *dec = ffd->ctx->streams[ffd->video_st]->codec; esd->slConfig->timestampResolution = ffd->video_tscale.den; switch (dec->codec_id) { case CODEC_ID_MPEG4: /*there is a bug in fragmentation of raw H264 in ffmpeg, the NALU startcode (0x00000001) is split across two frames - we therefore force internal ffmpeg codec ID to avoid NALU size recompute at the decoder level*/ /*if dsi not detected force use ffmpeg*/ if (!dec->extradata_size) goto opaque_video; /*otherwise use any MPEG-4 Visual*/ esd->decoderConfig->objectTypeIndication = (dec->codec_id==CODEC_ID_H264) ? GPAC_OTI_VIDEO_AVC : GPAC_OTI_VIDEO_MPEG4_PART2; esd->decoderConfig->decoderSpecificInfo->dataLength = dec->extradata_size; esd->decoderConfig->decoderSpecificInfo->data = (char*)gf_malloc(sizeof(char)*dec->extradata_size); memcpy(esd->decoderConfig->decoderSpecificInfo->data, dec->extradata, sizeof(char)*dec->extradata_size); break; case CODEC_ID_MPEG1VIDEO: esd->decoderConfig->objectTypeIndication = GPAC_OTI_VIDEO_MPEG1; break; case CODEC_ID_MPEG2VIDEO: esd->decoderConfig->objectTypeIndication = GPAC_OTI_VIDEO_MPEG2_MAIN; break; case CODEC_ID_H263: esd->decoderConfig->objectTypeIndication = GPAC_OTI_MEDIA_GENERIC; bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); gf_bs_write_u32(bs, GF_4CC('s', '2', '6', '3') ); gf_bs_write_u16(bs, dec->width); gf_bs_write_u16(bs, dec->height); gf_bs_get_content(bs, (char **) &esd->decoderConfig->decoderSpecificInfo->data, &esd->decoderConfig->decoderSpecificInfo->dataLength); gf_bs_del(bs); break; default: opaque_video: esd->decoderConfig->objectTypeIndication = GPAC_OTI_MEDIA_FFMPEG; bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); gf_bs_write_u32(bs, dec->codec_id); gf_bs_write_u16(bs, dec->width); gf_bs_write_u16(bs, dec->height); /*ffmpeg specific*/ gf_bs_write_u32(bs, dec->bit_rate); gf_bs_write_u32(bs, dec->codec_tag); gf_bs_write_u32(bs, dec->pix_fmt); if (dec->extradata_size) { gf_bs_write_data(bs, (char *) dec->extradata, dec->extradata_size); } gf_bs_get_content(bs, (char **) &esd->decoderConfig->decoderSpecificInfo->data, &esd->decoderConfig->decoderSpecificInfo->dataLength); gf_bs_del(bs); break; } dont_use_sl = GF_FALSE; } if (dont_use_sl) { esd->slConfig->predefined = SLPredef_SkipSL; } else { /*only send full AUs*/ esd->slConfig->useAccessUnitStartFlag = esd->slConfig->useAccessUnitEndFlag = 0; if (for_audio) { esd->slConfig->hasRandomAccessUnitsOnlyFlag = 1; } else { esd->slConfig->useRandomAccessPointFlag = 1; } esd->slConfig->useTimestampsFlag = 1; } return esd; } ",0 "contains_required_value(ITEM *curitem) { /* since this function recurses, it could be driven to stack overflow */ check_stack_depth(); if (curitem->type == VAL) return true; else if (curitem->val == (int32) '!') { /* * Assume anything under a NOT is non-required. For some cases with * nested NOTs, we could prove there's a required value, but it seems * unlikely to be worth the trouble. */ return false; } else if (curitem->val == (int32) '&') { /* If either side has a required value, we're good */ if (contains_required_value(curitem + curitem->left)) return true; else return contains_required_value(curitem - 1); } else { /* |-operator */ /* Both sides must have required values */ if (contains_required_value(curitem + curitem->left)) return contains_required_value(curitem - 1); else return false; } } ",0 "setup_server_realm(krb5_principal sprinc) { krb5_error_code kret; kdc_realm_t *newrealm; kret = 0; if (kdc_numrealms > 1) { if (!(newrealm = find_realm_data(sprinc->realm.data, (krb5_ui_4) sprinc->realm.length))) kret = ENOENT; else kdc_active_realm = newrealm; } else kdc_active_realm = kdc_realmlist[0]; return(kret); } ",1 "int udp_rcv(struct sk_buff *skb) { return __udp4_lib_rcv(skb, &udp_table, IPPROTO_UDP); } ",0 "bool jslIsIDOrReservedWord() { return lex->tk == LEX_ID || (lex->tk >= _LEX_R_LIST_START && lex->tk <= _LEX_R_LIST_END); } ",0 "static int mwifiex_cmd_uap_sta_deauth(struct mwifiex_private *priv, struct host_cmd_ds_command *cmd, u8 *mac) { struct host_cmd_ds_sta_deauth *sta_deauth = &cmd->params.sta_deauth; cmd->command = cpu_to_le16(HostCmd_CMD_UAP_STA_DEAUTH); memcpy(sta_deauth->mac, mac, ETH_ALEN); sta_deauth->reason = cpu_to_le16(WLAN_REASON_DEAUTH_LEAVING); cmd->size = cpu_to_le16(sizeof(struct host_cmd_ds_sta_deauth) + S_DS_GEN); return 0; } ",0 "static bt_status_t btpan_disconnect(const bt_bdaddr_t *bd_addr) { btpan_conn_t* conn = btpan_find_conn_addr(bd_addr->address); if (conn && conn->handle >= 0) { /* Inform the application that the disconnect has been initiated successfully */ btif_transfer_context(btif_in_pan_generic_evt, BTIF_PAN_CB_DISCONNECTING, (char *)bd_addr, sizeof(bt_bdaddr_t), NULL); BTA_PanClose(conn->handle); return BT_STATUS_SUCCESS; } return BT_STATUS_FAIL; } ",0 "void WebURLLoaderImpl::Context::Cancel() { if (bridge_) bridge_->Cancel(); if (multipart_delegate_) multipart_delegate_->Cancel(); client_ = NULL; loader_ = NULL; } ",0 "_steps_completed_now(uint32_t jobid) { List steps; ListIterator i; step_loc_t *stepd; bool rc = true; steps = stepd_available(conf->spooldir, conf->node_name); i = list_iterator_create(steps); while ((stepd = list_next(i))) { if (stepd->jobid == jobid) { int fd; fd = stepd_connect(stepd->directory, stepd->nodename, stepd->jobid, stepd->stepid, &stepd->protocol_version); if (fd == -1) continue; if (stepd_state(fd, stepd->protocol_version) != SLURMSTEPD_NOT_RUNNING) { rc = false; close(fd); break; } close(fd); } } list_iterator_destroy(i); FREE_NULL_LIST(steps); return rc; } ",0 "static void print_verifier_state(struct bpf_verifier_state *state) { struct bpf_reg_state *reg; enum bpf_reg_type t; int i; for (i = 0; i < MAX_BPF_REG; i++) { reg = &state->regs[i]; t = reg->type; if (t == NOT_INIT) continue; verbose("" R%d=%s"", i, reg_type_str[t]); if (t == CONST_IMM || t == PTR_TO_STACK) verbose(""%lld"", reg->imm); else if (t == PTR_TO_PACKET) verbose(""(id=%d,off=%d,r=%d)"", reg->id, reg->off, reg->range); else if (t == UNKNOWN_VALUE && reg->imm) verbose(""%lld"", reg->imm); else if (t == CONST_PTR_TO_MAP || t == PTR_TO_MAP_VALUE || t == PTR_TO_MAP_VALUE_OR_NULL || t == PTR_TO_MAP_VALUE_ADJ) verbose(""(ks=%d,vs=%d,id=%u)"", reg->map_ptr->key_size, reg->map_ptr->value_size, reg->id); if (reg->min_value != BPF_REGISTER_MIN_RANGE) verbose("",min_value=%lld"", (long long)reg->min_value); if (reg->max_value != BPF_REGISTER_MAX_RANGE) verbose("",max_value=%llu"", (unsigned long long)reg->max_value); } for (i = 0; i < MAX_BPF_STACK; i += BPF_REG_SIZE) { if (state->stack_slot_type[i] == STACK_SPILL) verbose("" fp%d=%s"", -MAX_BPF_STACK + i, reg_type_str[state->spilled_regs[i / BPF_REG_SIZE].type]); } verbose(""\n""); } ",0 "error::Error GLES2DecoderImpl::HandleDeleteSharedIdsCHROMIUM( uint32 immediate_data_size, const cmds::DeleteSharedIdsCHROMIUM& c) { GLuint namespace_id = static_cast(c.namespace_id); GLsizei n = static_cast(c.n); uint32 data_size; if (!SafeMultiplyUint32(n, sizeof(GLuint), &data_size)) { return error::kOutOfBounds; } const GLuint* ids = GetSharedMemoryAs( c.ids_shm_id, c.ids_shm_offset, data_size); if (n < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, ""DeleteSharedIdsCHROMIUM"", ""n < 0""); return error::kNoError; } if (ids == NULL) { return error::kOutOfBounds; } DoDeleteSharedIdsCHROMIUM(namespace_id, n, ids); return error::kNoError; } ",0 " MediaRecorderHandler::~MediaRecorderHandler() { DCHECK(main_render_thread_checker_.CalledOnValidThread()); if (client_) client_->WriteData( nullptr, 0u, true, (TimeTicks::Now() - TimeTicks::UnixEpoch()).InMillisecondsF()); } ",1 "void ScreenRecorder::FrameSentCallback(VideoPacket* packet) { delete packet; if (network_stopped_) return; capture_loop_->PostTask( FROM_HERE, base::Bind(&ScreenRecorder::DoFinishOneRecording, this)); } ",0 "fm_mgr_config_clear_error_map ( IN p_fm_config_conx_hdlt hdl ) { if(hdl->error_map.err_set) memset(&hdl->error_map,0,sizeof(hdl->error_map)); return FM_CONF_OK; } ",0 "void DragController::DragExited(DragData* drag_data, LocalFrame& local_root) { DCHECK(drag_data); LocalFrameView* frame_view(local_root.View()); if (frame_view) { DataTransferAccessPolicy policy = kDataTransferTypesReadable; DataTransfer* data_transfer = CreateDraggingDataTransfer(policy, drag_data); data_transfer->SetSourceOperation(drag_data->DraggingSourceOperationMask()); local_root.GetEventHandler().CancelDragAndDrop(CreateMouseEvent(drag_data), data_transfer); data_transfer->SetAccessPolicy( kDataTransferNumb); // invalidate clipboard here for security } MouseMovedIntoDocument(nullptr); if (file_input_element_under_mouse_) file_input_element_under_mouse_->SetCanReceiveDroppedFiles(false); file_input_element_under_mouse_ = nullptr; } ",0 "bool HasPendingUncleanExit(Profile* profile) { return profile->GetLastSessionExitType() == Profile::EXIT_CRASHED && !profile_launch_observer.Get().HasBeenLaunched(profile); } ",0 "base::FilePath WallpaperManagerBase::GetCustomWallpaperDir( const char* sub_dir) { base::FilePath custom_wallpaper_dir; DCHECK(dir_chromeos_custom_wallpapers_path_id != -1); CHECK(PathService::Get(dir_chromeos_custom_wallpapers_path_id, &custom_wallpaper_dir)); return custom_wallpaper_dir.Append(sub_dir); } ",0 "static MagickBooleanType Get8BIMProperty(const Image *image,const char *key, ExceptionInfo *exception) { char *attribute, format[MagickPathExtent], name[MagickPathExtent], *resource; const StringInfo *profile; const unsigned char *info; long start, stop; MagickBooleanType status; register ssize_t i; size_t length; ssize_t count, id, sub_number; /* There are no newlines in path names, so it's safe as terminator. */ profile=GetImageProfile(image,""8bim""); if (profile == (StringInfo *) NULL) return(MagickFalse); count=(ssize_t) sscanf(key,""8BIM:%ld,%ld:%1024[^\n]\n%1024[^\n]"",&start,&stop, name,format); if ((count != 2) && (count != 3) && (count != 4)) return(MagickFalse); if (count < 4) (void) CopyMagickString(format,""SVG"",MagickPathExtent); if (count < 3) *name='\0'; sub_number=1; if (*name == '#') sub_number=(ssize_t) StringToLong(&name[1]); sub_number=MagickMax(sub_number,1L); resource=(char *) NULL; status=MagickFalse; length=GetStringInfoLength(profile); info=GetStringInfoDatum(profile); while ((length > 0) && (status == MagickFalse)) { if (ReadPropertyByte(&info,&length) != (unsigned char) '8') continue; if (ReadPropertyByte(&info,&length) != (unsigned char) 'B') continue; if (ReadPropertyByte(&info,&length) != (unsigned char) 'I') continue; if (ReadPropertyByte(&info,&length) != (unsigned char) 'M') continue; id=(ssize_t) ReadPropertyMSBShort(&info,&length); if (id < (ssize_t) start) continue; if (id > (ssize_t) stop) continue; if (resource != (char *) NULL) resource=DestroyString(resource); count=(ssize_t) ReadPropertyByte(&info,&length); if ((count != 0) && ((size_t) count <= length)) { resource=(char *) NULL; if (~((size_t) count) >= (MagickPathExtent-1)) resource=(char *) AcquireQuantumMemory((size_t) count+ MagickPathExtent,sizeof(*resource)); if (resource != (char *) NULL) { for (i=0; i < (ssize_t) count; i++) resource[i]=(char) ReadPropertyByte(&info,&length); resource[count]='\0'; } } if ((count & 0x01) == 0) (void) ReadPropertyByte(&info,&length); count=(ssize_t) ReadPropertyMSBLong(&info,&length); if ((count < 0) || ((size_t) count > length)) { length=0; continue; } if ((*name != '\0') && (*name != '#')) if ((resource == (char *) NULL) || (LocaleCompare(name,resource) != 0)) { /* No name match, scroll forward and try next. */ info+=count; length-=MagickMin(count,(ssize_t) length); continue; } if ((*name == '#') && (sub_number != 1)) { /* No numbered match, scroll forward and try next. */ sub_number--; info+=count; length-=MagickMin(count,(ssize_t) length); continue; } /* We have the resource of interest. */ attribute=(char *) NULL; if (~((size_t) count) >= (MagickPathExtent-1)) attribute=(char *) AcquireQuantumMemory((size_t) count+MagickPathExtent, sizeof(*attribute)); if (attribute != (char *) NULL) { (void) CopyMagickMemory(attribute,(char *) info,(size_t) count); attribute[count]='\0'; info+=count; length-=MagickMin(count,(ssize_t) length); if ((id <= 1999) || (id >= 2999)) (void) SetImageProperty((Image *) image,key,(const char *) attribute,exception); else { char *path; if (LocaleCompare(format,""svg"") == 0) path=TraceSVGClippath((unsigned char *) attribute,(size_t) count, image->columns,image->rows); else path=TracePSClippath((unsigned char *) attribute,(size_t) count); (void) SetImageProperty((Image *) image,key,(const char *) path, exception); path=DestroyString(path); } attribute=DestroyString(attribute); status=MagickTrue; } } if (resource != (char *) NULL) resource=DestroyString(resource); return(status); } ",0 "static void process_bin_flush(conn *c) { time_t exptime = 0; protocol_binary_request_flush* req = binary_get_request(c); rel_time_t new_oldest = 0; if (!settings.flush_enabled) { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_AUTH_ERROR, NULL, 0); return; } if (c->binary_header.request.extlen == sizeof(req->message.body)) { exptime = ntohl(req->message.body.expiration); } if (exptime > 0) { new_oldest = realtime(exptime); } else { new_oldest = current_time; } if (settings.use_cas) { settings.oldest_live = new_oldest - 1; if (settings.oldest_live <= current_time) settings.oldest_cas = get_cas_id(); } else { settings.oldest_live = new_oldest; } pthread_mutex_lock(&c->thread->stats.mutex); c->thread->stats.flush_cmds++; pthread_mutex_unlock(&c->thread->stats.mutex); write_bin_response(c, NULL, 0, 0, 0); } ",0 "int vfs_readlink(struct dentry *dentry, char __user *buffer, int buflen, const char *link) { int len; len = PTR_ERR(link); if (IS_ERR(link)) goto out; len = strlen(link); if (len > (unsigned) buflen) len = buflen; if (copy_to_user(buffer, link, len)) len = -EFAULT; out: return len; } ",0 "static int netlink_create(struct net *net, struct socket *sock, int protocol, int kern) { struct module *module = NULL; struct mutex *cb_mutex; struct netlink_sock *nlk; int (*bind)(struct net *net, int group); void (*unbind)(struct net *net, int group); int err = 0; sock->state = SS_UNCONNECTED; if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) return -ESOCKTNOSUPPORT; if (protocol < 0 || protocol >= MAX_LINKS) return -EPROTONOSUPPORT; netlink_lock_table(); #ifdef CONFIG_MODULES if (!nl_table[protocol].registered) { netlink_unlock_table(); request_module(""net-pf-%d-proto-%d"", PF_NETLINK, protocol); netlink_lock_table(); } #endif if (nl_table[protocol].registered && try_module_get(nl_table[protocol].module)) module = nl_table[protocol].module; else err = -EPROTONOSUPPORT; cb_mutex = nl_table[protocol].cb_mutex; bind = nl_table[protocol].bind; unbind = nl_table[protocol].unbind; netlink_unlock_table(); if (err < 0) goto out; err = __netlink_create(net, sock, cb_mutex, protocol, kern); if (err < 0) goto out_module; local_bh_disable(); sock_prot_inuse_add(net, &netlink_proto, 1); local_bh_enable(); nlk = nlk_sk(sock->sk); nlk->module = module; nlk->netlink_bind = bind; nlk->netlink_unbind = unbind; out: return err; out_module: module_put(module); goto out; } ",0 "void FrameLoader::finishedParsing() { if (m_stateMachine.creatingInitialEmptyDocument()) return; m_frame->injectUserScripts(InjectAtDocumentEnd); RefPtr protector = m_frame->view() ? m_frame : 0; m_client->dispatchDidFinishDocumentLoad(); checkCompleted(); if (!m_frame->view()) return; // We are being destroyed by something checkCompleted called. m_frame->view()->restoreScrollbar(); m_frame->view()->scrollToFragment(m_URL); } ",0 "const BlockEntry* Segment::GetBlock(const CuePoint& cp, const CuePoint::TrackPosition& tp) { Cluster** const ii = m_clusters; Cluster** i = ii; const long count = m_clusterCount + m_clusterPreloadCount; Cluster** const jj = ii + count; Cluster** j = jj; while (i < j) { Cluster** const k = i + (j - i) / 2; assert(k < jj); Cluster* const pCluster = *k; assert(pCluster); const long long pos = pCluster->GetPosition(); assert(pos >= 0); if (pos < tp.m_pos) i = k + 1; else if (pos > tp.m_pos) j = k; else return pCluster->GetEntry(cp, tp); } assert(i == j); Cluster* const pCluster = Cluster::Create(this, -1, tp.m_pos); //, -1); if (pCluster == NULL) return NULL; const ptrdiff_t idx = i - m_clusters; if (!PreloadCluster(pCluster, idx)) { delete pCluster; return NULL; } assert(m_clusters); assert(m_clusterPreloadCount > 0); assert(m_clusters[idx] == pCluster); return pCluster->GetEntry(cp, tp); } ",0 "void bio_chain(struct bio *bio, struct bio *parent) { BUG_ON(bio->bi_private || bio->bi_end_io); bio->bi_private = parent; bio->bi_end_io = bio_chain_endio; bio_inc_remaining(parent); } ",0 "void FileReaderLoader::Cleanup() { handle_watcher_.Cancel(); consumer_handle_.reset(); if (error_code_) { raw_data_.reset(); string_result_ = """"; is_raw_data_converted_ = true; decoder_.reset(); array_buffer_result_ = nullptr; UnadjustReportedMemoryUsageToV8(); } } ",0 "int ssl3_do_uncompress(SSL *ssl) { #ifndef OPENSSL_NO_COMP int i; SSL3_RECORD *rr; rr = &(ssl->s3->rrec); i = COMP_expand_block(ssl->expand, rr->comp, SSL3_RT_MAX_PLAIN_LENGTH, rr->data, (int)rr->length); if (i < 0) return (0); else rr->length = i; rr->data = rr->comp; #endif return (1); } ",0 "PHP_METHOD(PharFileInfo, chmod) { char *error; long perms; PHAR_ENTRY_OBJECT(); if (entry_obj->ent.entry->is_temp_dir) { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0 TSRMLS_CC, \ ""Phar entry \""%s\"" is a temporary directory (not an actual entry in the archive), cannot chmod"", entry_obj->ent.entry->filename); \ return; } if (PHAR_G(readonly) && !entry_obj->ent.entry->phar->is_data) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, ""Cannot modify permissions for file \""%s\"" in phar \""%s\"", write operations are prohibited"", entry_obj->ent.entry->filename, entry_obj->ent.entry->phar->fname); return; } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""l"", &perms) == FAILURE) { return; } if (entry_obj->ent.entry->is_persistent) { phar_archive_data *phar = entry_obj->ent.entry->phar; if (FAILURE == phar_copy_on_write(&phar TSRMLS_CC)) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, ""phar \""%s\"" is persistent, unable to copy on write"", phar->fname); return; } /* re-populate after copy-on-write */ zend_hash_find(&phar->manifest, entry_obj->ent.entry->filename, entry_obj->ent.entry->filename_len, (void **)&entry_obj->ent.entry); } /* clear permissions */ entry_obj->ent.entry->flags &= ~PHAR_ENT_PERM_MASK; perms &= 0777; entry_obj->ent.entry->flags |= perms; entry_obj->ent.entry->old_flags = entry_obj->ent.entry->flags; entry_obj->ent.entry->phar->is_modified = 1; entry_obj->ent.entry->is_modified = 1; /* hackish cache in php_stat needs to be cleared */ /* if this code fails to work, check main/streams/streams.c, _php_stream_stat_path */ if (BG(CurrentLStatFile)) { efree(BG(CurrentLStatFile)); } if (BG(CurrentStatFile)) { efree(BG(CurrentStatFile)); } BG(CurrentLStatFile) = NULL; BG(CurrentStatFile) = NULL; phar_flush(entry_obj->ent.entry->phar, 0, 0, 0, &error TSRMLS_CC); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0 TSRMLS_CC, ""%s"", error); efree(error); } } ",0 "void WebContentsImpl::SetPageScale(float page_scale_factor) { Send(new ViewMsg_SetPageScale(GetRenderViewHost()->GetRoutingID(), page_scale_factor)); } ",0 "status_t writeByteVectorInternal(Parcel* parcel, const std::vector& val) { status_t status; if (val.size() > std::numeric_limits::max()) { status = BAD_VALUE; return status; } status = parcel->writeInt32(val.size()); if (status != OK) { return status; } void* data = parcel->writeInplace(val.size()); if (!data) { status = BAD_VALUE; return status; } memcpy(data, val.data(), val.size()); return status; } ",0 "void generic_xdp_tx(struct sk_buff *skb, struct bpf_prog *xdp_prog) { struct net_device *dev = skb->dev; struct netdev_queue *txq; bool free_skb = true; int cpu, rc; txq = netdev_pick_tx(dev, skb, NULL); cpu = smp_processor_id(); HARD_TX_LOCK(dev, txq, cpu); if (!netif_xmit_stopped(txq)) { rc = netdev_start_xmit(skb, dev, txq, 0); if (dev_xmit_complete(rc)) free_skb = false; } HARD_TX_UNLOCK(dev, txq); if (free_skb) { trace_xdp_exception(dev, xdp_prog, XDP_TX); kfree_skb(skb); } } ",0 "static int vhost_scsi_queue_data_in(struct se_cmd *se_cmd) { struct vhost_scsi_cmd *cmd = container_of(se_cmd, struct vhost_scsi_cmd, tvc_se_cmd); vhost_scsi_complete_cmd(cmd); return 0; } ",0 "void VideoCaptureManager::Close(int capture_session_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); std::ostringstream string_stream; string_stream << ""VideoCaptureManager::Close, capture_session_id = "" << capture_session_id; EmitLogMessage(string_stream.str(), 1); auto session_it = sessions_.find(capture_session_id); if (session_it == sessions_.end()) { return; } VideoCaptureController* const existing_device = LookupControllerByMediaTypeAndDeviceId(session_it->second.type, session_it->second.id); if (existing_device) { existing_device->StopSession(capture_session_id); DestroyControllerIfNoClients(existing_device); } base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&VideoCaptureManager::OnClosed, this, session_it->second.type, capture_session_id)); sessions_.erase(session_it); } ",0 "int32_t TestURLLoader::OpenWithPrefetchBufferThreshold(int32_t lower, int32_t upper) { pp::URLRequestInfo request(instance_); request.SetURL(""test_url_loader_data/hello.txt""); request.SetPrefetchBufferLowerThreshold(lower); request.SetPrefetchBufferUpperThreshold(upper); return OpenUntrusted(request, NULL); } ",0 "void* ImageDataPlatformBackend::Map() { if (!mapped_canvas_.get()) { mapped_canvas_.reset(platform_image_->Map()); if (!mapped_canvas_.get()) return NULL; } const SkBitmap& bitmap = skia::GetTopDevice(*mapped_canvas_)->accessBitmap(true); const_cast(bitmap).setIsOpaque(false); bitmap.lockPixels(); return bitmap.getAddr32(0, 0); } ",0 " PrintPreviewUI::~PrintPreviewUI() { print_preview_data_service()->RemoveEntry(preview_ui_addr_str_); g_print_preview_request_id_map.Get().Erase(preview_ui_addr_str_); } ",1 "static void ib_uverbs_add_one(struct ib_device *device) { int devnum; dev_t base; struct ib_uverbs_device *uverbs_dev; int ret; if (!device->alloc_ucontext) return; uverbs_dev = kzalloc(sizeof *uverbs_dev, GFP_KERNEL); if (!uverbs_dev) return; ret = init_srcu_struct(&uverbs_dev->disassociate_srcu); if (ret) { kfree(uverbs_dev); return; } atomic_set(&uverbs_dev->refcount, 1); init_completion(&uverbs_dev->comp); uverbs_dev->xrcd_tree = RB_ROOT; mutex_init(&uverbs_dev->xrcd_tree_mutex); kobject_init(&uverbs_dev->kobj, &ib_uverbs_dev_ktype); mutex_init(&uverbs_dev->lists_mutex); INIT_LIST_HEAD(&uverbs_dev->uverbs_file_list); INIT_LIST_HEAD(&uverbs_dev->uverbs_events_file_list); spin_lock(&map_lock); devnum = find_first_zero_bit(dev_map, IB_UVERBS_MAX_DEVICES); if (devnum >= IB_UVERBS_MAX_DEVICES) { spin_unlock(&map_lock); devnum = find_overflow_devnum(); if (devnum < 0) goto err; spin_lock(&map_lock); uverbs_dev->devnum = devnum + IB_UVERBS_MAX_DEVICES; base = devnum + overflow_maj; set_bit(devnum, overflow_map); } else { uverbs_dev->devnum = devnum; base = devnum + IB_UVERBS_BASE_DEV; set_bit(devnum, dev_map); } spin_unlock(&map_lock); rcu_assign_pointer(uverbs_dev->ib_dev, device); uverbs_dev->num_comp_vectors = device->num_comp_vectors; cdev_init(&uverbs_dev->cdev, NULL); uverbs_dev->cdev.owner = THIS_MODULE; uverbs_dev->cdev.ops = device->mmap ? &uverbs_mmap_fops : &uverbs_fops; uverbs_dev->cdev.kobj.parent = &uverbs_dev->kobj; kobject_set_name(&uverbs_dev->cdev.kobj, ""uverbs%d"", uverbs_dev->devnum); if (cdev_add(&uverbs_dev->cdev, base, 1)) goto err_cdev; uverbs_dev->dev = device_create(uverbs_class, device->dma_device, uverbs_dev->cdev.dev, uverbs_dev, ""uverbs%d"", uverbs_dev->devnum); if (IS_ERR(uverbs_dev->dev)) goto err_cdev; if (device_create_file(uverbs_dev->dev, &dev_attr_ibdev)) goto err_class; if (device_create_file(uverbs_dev->dev, &dev_attr_abi_version)) goto err_class; ib_set_client_data(device, &uverbs_client, uverbs_dev); return; err_class: device_destroy(uverbs_class, uverbs_dev->cdev.dev); err_cdev: cdev_del(&uverbs_dev->cdev); if (uverbs_dev->devnum < IB_UVERBS_MAX_DEVICES) clear_bit(devnum, dev_map); else clear_bit(devnum, overflow_map); err: if (atomic_dec_and_test(&uverbs_dev->refcount)) ib_uverbs_comp_dev(uverbs_dev); wait_for_completion(&uverbs_dev->comp); kobject_put(&uverbs_dev->kobj); return; } ",0 "static void rle8_write_unc_and_run(struct rle_context *rlectx) { iw_byte dstbuf[2]; rle8_write_unc(rlectx); if(rlectx->run_len<1) { return; } if(rlectx->run_len>255) { iw_set_error(rlectx->ctx,""Internal: RLE encode error 6""); return; } dstbuf[0] = (iw_byte)rlectx->run_len; dstbuf[1] = rlectx->run_byte; iwbmp_write(rlectx->wctx,dstbuf,2); rlectx->total_bytes_written+=2; rlectx->pending_data_start+=rlectx->run_len; rlectx->run_len=0; } ",0 "GetCarryOverWindowsInSplitView() { base::flat_map windows; MruWindowTracker::WindowList mru_windows = Shell::Get()->mru_window_tracker()->BuildWindowForCycleList(kAllDesks); if (IsCarryOverCandidateForSplitView(mru_windows, 0u)) { if (wm::GetWindowState(mru_windows[0])->GetStateType() == WindowStateType::kLeftSnapped) { windows.emplace(mru_windows[0], WindowStateType::kLeftSnapped); if (IsCarryOverCandidateForSplitView(mru_windows, 1u) && wm::GetWindowState(mru_windows[1])->GetStateType() == WindowStateType::kRightSnapped) { windows.emplace(mru_windows[1], WindowStateType::kRightSnapped); } } else if (wm::GetWindowState(mru_windows[0])->GetStateType() == WindowStateType::kRightSnapped) { windows.emplace(mru_windows[0], WindowStateType::kRightSnapped); if (IsCarryOverCandidateForSplitView(mru_windows, 1u) && wm::GetWindowState(mru_windows[1])->GetStateType() == WindowStateType::kLeftSnapped) { windows.emplace(mru_windows[1], WindowStateType::kLeftSnapped); } } } return windows; } ",0 "void Document::removeFocusedElementOfSubtree(Node* node, bool amongChildrenOnly) { if (!m_focusedElement) return; if (!node->inDocument()) return; bool contains = node->containsIncludingShadowDOM(m_focusedElement.get()); if (contains && (m_focusedElement != node || !amongChildrenOnly)) clearFocusedElement(); } ",0 "loff_t mem_lseek(struct file *file, loff_t offset, int orig) { switch (orig) { case 0: file->f_pos = offset; break; case 1: file->f_pos += offset; break; default: return -EINVAL; } force_successful_syscall_return(); return file->f_pos; } ",0 "static inline bool si_fromuser(const struct siginfo *info) { return info == SEND_SIG_NOINFO || (!is_si_special(info) && SI_FROMUSER(info)); } ",0 "struct dentry *ovl_entry_real(struct ovl_entry *oe, bool *is_upper) { struct dentry *realdentry; realdentry = ovl_upperdentry_dereference(oe); if (realdentry) { *is_upper = true; } else { realdentry = oe->lowerdentry; *is_upper = false; } return realdentry; } ",0 "static int php_openssl_load_rand_file(const char * file, int *egdsocket, int *seeded) /* {{{ */ { char buffer[MAXPATHLEN]; *egdsocket = 0; *seeded = 0; if (file == NULL) { file = RAND_file_name(buffer, sizeof(buffer)); #ifdef HAVE_RAND_EGD } else if (RAND_egd(file) > 0) { /* if the given filename is an EGD socket, don't * write anything back to it */ *egdsocket = 1; return SUCCESS; #endif } if (file == NULL || !RAND_load_file(file, -1)) { if (RAND_status() == 0) { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, ""unable to load random state; not enough random data!""); return FAILURE; } return FAILURE; } *seeded = 1; return SUCCESS; } /* }}} */ ",0 "void AudioParam::calculateFinalValues(float* values, unsigned numberOfValues, bool sampleAccurate) { bool isGood = context() && context()->isAudioThread() && values && numberOfValues; ASSERT(isGood); if (!isGood) return; if (sampleAccurate) { calculateTimelineValues(values, numberOfValues); } else { bool hasValue; float timelineValue = m_timeline.valueForContextTime(context(), narrowPrecisionToFloat(m_value), hasValue); if (hasValue) m_value = timelineValue; values[0] = narrowPrecisionToFloat(m_value); } RefPtr summingBus = AudioBus::create(1, numberOfValues, false); summingBus->setChannelMemory(0, values, numberOfValues); for (unsigned i = 0; i < numberOfRenderingConnections(); ++i) { AudioNodeOutput* output = renderingOutput(i); ASSERT(output); AudioBus* connectionBus = output->pull(0, AudioNode::ProcessingSizeInFrames); summingBus->sumFrom(*connectionBus); } } ",0 "ia64_patch_imm64 (u64 insn_addr, u64 val) { /* The assembler may generate offset pointing to either slot 1 or slot 2 for a long (2-slot) instruction, occupying slots 1 and 2. */ insn_addr &= -16UL; ia64_patch(insn_addr + 2, 0x01fffefe000UL, ( ((val & 0x8000000000000000UL) >> 27) /* bit 63 -> 36 */ | ((val & 0x0000000000200000UL) << 0) /* bit 21 -> 21 */ | ((val & 0x00000000001f0000UL) << 6) /* bit 16 -> 22 */ | ((val & 0x000000000000ff80UL) << 20) /* bit 7 -> 27 */ | ((val & 0x000000000000007fUL) << 13) /* bit 0 -> 13 */)); ia64_patch(insn_addr + 1, 0x1ffffffffffUL, val >> 22); } ",0 " float scroll_x() const { return scroll_x_; } ",0 "static int nfs_commit_set_lock(struct nfs_inode *nfsi, int may_wait) { int ret; if (!test_and_set_bit(NFS_INO_COMMIT, &nfsi->flags)) return 1; if (!may_wait) return 0; ret = out_of_line_wait_on_bit_lock(&nfsi->flags, NFS_INO_COMMIT, nfs_wait_bit_killable, TASK_KILLABLE); return (ret < 0) ? ret : 1; } ",0 "static void qeth_configure_unitaddr(struct qeth_card *card, char *prcd) { QETH_DBF_TEXT(SETUP, 2, ""cfgunit""); card->info.chpid = prcd[30]; card->info.unit_addr2 = prcd[31]; card->info.cula = prcd[63]; card->info.guestlan = ((prcd[0x10] == _ascebc['V']) && (prcd[0x11] == _ascebc['M'])); } ",0 "tBTA_HH_RPT_CACHE_ENTRY * bta_hh_le_co_cache_load (BD_ADDR remote_bda, UINT8 *p_num_rpt, UINT8 app_id) { UNUSED(app_id); unsigned idx = 0; bdstr_t bdstr; sprintf(bdstr, ""%02x:%02x:%02x:%02x:%02x:%02x"", remote_bda[0], remote_bda[1], remote_bda[2], remote_bda[3], remote_bda[4], remote_bda[5]); size_t len = btif_config_get_bin_length(bdstr, ""HidReport""); if (!p_num_rpt && len < sizeof(tBTA_HH_RPT_CACHE_ENTRY)) return NULL; if (len > sizeof(sReportCache)) len = sizeof(sReportCache); btif_config_get_bin(bdstr, ""HidReport"", (uint8_t *)sReportCache, &len); *p_num_rpt = len / sizeof(tBTA_HH_RPT_CACHE_ENTRY); BTIF_TRACE_DEBUG(""%s() - Loaded %d reports; dev=%s"", __FUNCTION__, *p_num_rpt, bdstr); return sReportCache; } ",0 "ResetDraggingStateDelegate::~ResetDraggingStateDelegate() {} ",0 "static int backupOnePage( sqlite3_backup *p, /* Backup handle */ Pgno iSrcPg, /* Source database page to backup */ const u8 *zSrcData, /* Source database page data */ int bUpdate /* True for an update, false otherwise */ ){ Pager * const pDestPager = sqlite3BtreePager(p->pDest); const int nSrcPgsz = sqlite3BtreeGetPageSize(p->pSrc); int nDestPgsz = sqlite3BtreeGetPageSize(p->pDest); const int nCopy = MIN(nSrcPgsz, nDestPgsz); const i64 iEnd = (i64)iSrcPg*(i64)nSrcPgsz; #ifdef SQLITE_HAS_CODEC /* Use BtreeGetReserveNoMutex() for the source b-tree, as although it is ** guaranteed that the shared-mutex is held by this thread, handle ** p->pSrc may not actually be the owner. */ int nSrcReserve = sqlite3BtreeGetReserveNoMutex(p->pSrc); int nDestReserve = sqlite3BtreeGetOptimalReserve(p->pDest); #endif int rc = SQLITE_OK; i64 iOff; assert( sqlite3BtreeGetReserveNoMutex(p->pSrc)>=0 ); assert( p->bDestLocked ); assert( !isFatalError(p->rc) ); assert( iSrcPg!=PENDING_BYTE_PAGE(p->pSrc->pBt) ); assert( zSrcData ); /* Catch the case where the destination is an in-memory database and the ** page sizes of the source and destination differ. */ if( nSrcPgsz!=nDestPgsz && sqlite3PagerIsMemdb(pDestPager) ){ rc = SQLITE_READONLY; } #ifdef SQLITE_HAS_CODEC /* Backup is not possible if the page size of the destination is changing ** and a codec is in use. */ if( nSrcPgsz!=nDestPgsz && sqlite3PagerGetCodec(pDestPager)!=0 ){ rc = SQLITE_READONLY; } /* Backup is not possible if the number of bytes of reserve space differ ** between source and destination. If there is a difference, try to ** fix the destination to agree with the source. If that is not possible, ** then the backup cannot proceed. */ if( nSrcReserve!=nDestReserve ){ u32 newPgsz = nSrcPgsz; rc = sqlite3PagerSetPagesize(pDestPager, &newPgsz, nSrcReserve); if( rc==SQLITE_OK && newPgsz!=nSrcPgsz ) rc = SQLITE_READONLY; } #endif /* This loop runs once for each destination page spanned by the source ** page. For each iteration, variable iOff is set to the byte offset ** of the destination page. */ for(iOff=iEnd-(i64)nSrcPgsz; rc==SQLITE_OK && iOffpDest->pBt) ) continue; if( SQLITE_OK==(rc = sqlite3PagerGet(pDestPager, iDest, &pDestPg, 0)) && SQLITE_OK==(rc = sqlite3PagerWrite(pDestPg)) ){ const u8 *zIn = &zSrcData[iOff%nSrcPgsz]; u8 *zDestData = sqlite3PagerGetData(pDestPg); u8 *zOut = &zDestData[iOff%nDestPgsz]; /* Copy the data from the source page into the destination page. ** Then clear the Btree layer MemPage.isInit flag. Both this module ** and the pager code use this trick (clearing the first byte ** of the page 'extra' space to invalidate the Btree layers ** cached parse of the page). MemPage.isInit is marked ** ""MUST BE FIRST"" for this purpose. */ memcpy(zOut, zIn, nCopy); ((u8 *)sqlite3PagerGetExtra(pDestPg))[0] = 0; if( iOff==0 && bUpdate==0 ){ sqlite3Put4byte(&zOut[28], sqlite3BtreeLastPage(p->pSrc)); } } sqlite3PagerUnref(pDestPg); } return rc; } ",0 "session_by_x11_channel(int id) { int i, j; for (i = 0; i < sessions_nalloc; i++) { Session *s = &sessions[i]; if (s->x11_chanids == NULL || !s->used) continue; for (j = 0; s->x11_chanids[j] != -1; j++) { if (s->x11_chanids[j] == id) { debug(""session_by_x11_channel: session %d "" ""channel %d"", s->self, id); return s; } } } debug(""session_by_x11_channel: unknown channel %d"", id); session_dump(); return NULL; } ",0 "void PacketFreeOrRelease(Packet *p) { if (p->flags & PKT_ALLOC) PacketFree(p); else PacketPoolReturnPacket(p); } ",0 "void GfxLabColorSpace::getDefaultRanges(double *decodeLow, double *decodeRange, int maxImgPixel) { decodeLow[0] = 0; decodeRange[0] = 100; decodeLow[1] = aMin; decodeRange[1] = aMax - aMin; decodeLow[2] = bMin; decodeRange[2] = bMax - bMin; } ",0 " bool ApplyConfig() { DCHECK(context_->ui_task_runner()->BelongsToCurrentThread()); if (!config_.GetString(kHostIdConfigPath, &host_id_)) { LOG(ERROR) << ""host_id is not defined in the config.""; return false; } if (!key_pair_.Load(config_)) { return false; } std::string host_secret_hash_string; if (!config_.GetString(kHostSecretHashConfigPath, &host_secret_hash_string)) { host_secret_hash_string = ""plain:""; } if (!host_secret_hash_.Parse(host_secret_hash_string)) { LOG(ERROR) << ""Invalid host_secret_hash.""; return false; } if (!config_.GetString(kXmppLoginConfigPath, &xmpp_login_) || !(config_.GetString(kXmppAuthTokenConfigPath, &xmpp_auth_token_) || config_.GetString(kOAuthRefreshTokenConfigPath, &oauth_refresh_token_))) { LOG(ERROR) << ""XMPP credentials are not defined in the config.""; return false; } config_.GetBoolean(kOAuthUseOfficialClientIdConfigPath, &oauth_use_official_client_id_); if (!oauth_refresh_token_.empty()) { xmpp_auth_token_ = """"; // This will be set to the access token later. xmpp_auth_service_ = ""oauth2""; } else if (!config_.GetString(kXmppAuthServiceConfigPath, &xmpp_auth_service_)) { xmpp_auth_service_ = kChromotingTokenDefaultServiceName; } return true; } ",0 " virtual WebGLId createShader(WGC3Denum) { return 1; } ",0 "sess_auth_kerberos(struct sess_data *sess_data) { int rc = 0; struct smb_hdr *smb_buf; SESSION_SETUP_ANDX *pSMB; char *bcc_ptr; struct cifs_ses *ses = sess_data->ses; __u32 capabilities; __u16 bytes_remaining; struct key *spnego_key = NULL; struct cifs_spnego_msg *msg; u16 blob_len; /* extended security */ /* wct = 12 */ rc = sess_alloc_buffer(sess_data, 12); if (rc) goto out; pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; bcc_ptr = sess_data->iov[2].iov_base; capabilities = cifs_ssetup_hdr(ses, pSMB); spnego_key = cifs_get_spnego_key(ses); if (IS_ERR(spnego_key)) { rc = PTR_ERR(spnego_key); spnego_key = NULL; goto out; } msg = spnego_key->payload.data[0]; /* * check version field to make sure that cifs.upcall is * sending us a response in an expected form */ if (msg->version != CIFS_SPNEGO_UPCALL_VERSION) { cifs_dbg(VFS, ""incorrect version of cifs.upcall (expected %d but got %d)"", CIFS_SPNEGO_UPCALL_VERSION, msg->version); rc = -EKEYREJECTED; goto out_put_spnego_key; } ses->auth_key.response = kmemdup(msg->data, msg->sesskey_len, GFP_KERNEL); if (!ses->auth_key.response) { cifs_dbg(VFS, ""Kerberos can't allocate (%u bytes) memory"", msg->sesskey_len); rc = -ENOMEM; goto out_put_spnego_key; } ses->auth_key.len = msg->sesskey_len; pSMB->req.hdr.Flags2 |= SMBFLG2_EXT_SEC; capabilities |= CAP_EXTENDED_SECURITY; pSMB->req.Capabilities = cpu_to_le32(capabilities); sess_data->iov[1].iov_base = msg->data + msg->sesskey_len; sess_data->iov[1].iov_len = msg->secblob_len; pSMB->req.SecurityBlobLength = cpu_to_le16(sess_data->iov[1].iov_len); if (ses->capabilities & CAP_UNICODE) { /* unicode strings must be word aligned */ if ((sess_data->iov[0].iov_len + sess_data->iov[1].iov_len) % 2) { *bcc_ptr = 0; bcc_ptr++; } unicode_oslm_strings(&bcc_ptr, sess_data->nls_cp); unicode_domain_string(&bcc_ptr, ses, sess_data->nls_cp); } else { /* BB: is this right? */ ascii_ssetup_strings(&bcc_ptr, ses, sess_data->nls_cp); } sess_data->iov[2].iov_len = (long) bcc_ptr - (long) sess_data->iov[2].iov_base; rc = sess_sendreceive(sess_data); if (rc) goto out_put_spnego_key; pSMB = (SESSION_SETUP_ANDX *)sess_data->iov[0].iov_base; smb_buf = (struct smb_hdr *)sess_data->iov[0].iov_base; if (smb_buf->WordCount != 4) { rc = -EIO; cifs_dbg(VFS, ""bad word count %d\n"", smb_buf->WordCount); goto out_put_spnego_key; } if (le16_to_cpu(pSMB->resp.Action) & GUEST_LOGIN) cifs_dbg(FYI, ""Guest login\n""); /* BB mark SesInfo struct? */ ses->Suid = smb_buf->Uid; /* UID left in wire format (le) */ cifs_dbg(FYI, ""UID = %llu\n"", ses->Suid); bytes_remaining = get_bcc(smb_buf); bcc_ptr = pByteArea(smb_buf); blob_len = le16_to_cpu(pSMB->resp.SecurityBlobLength); if (blob_len > bytes_remaining) { cifs_dbg(VFS, ""bad security blob length %d\n"", blob_len); rc = -EINVAL; goto out_put_spnego_key; } bcc_ptr += blob_len; bytes_remaining -= blob_len; /* BB check if Unicode and decode strings */ if (bytes_remaining == 0) { /* no string area to decode, do nothing */ } else if (smb_buf->Flags2 & SMBFLG2_UNICODE) { /* unicode string area must be word-aligned */ if (((unsigned long) bcc_ptr - (unsigned long) smb_buf) % 2) { ++bcc_ptr; --bytes_remaining; } decode_unicode_ssetup(&bcc_ptr, bytes_remaining, ses, sess_data->nls_cp); } else { decode_ascii_ssetup(&bcc_ptr, bytes_remaining, ses, sess_data->nls_cp); } rc = sess_establish_session(sess_data); out_put_spnego_key: key_invalidate(spnego_key); key_put(spnego_key); out: sess_data->result = rc; sess_data->func = NULL; sess_free_buffer(sess_data); kfree(ses->auth_key.response); ses->auth_key.response = NULL; } ",0 "PassRefPtr createFragmentFromMarkupWithContext(Document* document, const String& markup, unsigned fragmentStart, unsigned fragmentEnd, const String& baseURL, FragmentScriptingPermission scriptingPermission) { StringBuilder taggedMarkup; taggedMarkup.append(markup.left(fragmentStart)); MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag); taggedMarkup.append(markup.substring(fragmentStart, fragmentEnd - fragmentStart)); MarkupAccumulator::appendComment(taggedMarkup, fragmentMarkerTag); taggedMarkup.append(markup.substring(fragmentEnd)); RefPtr taggedFragment = createFragmentFromMarkup(document, taggedMarkup.toString(), baseURL, scriptingPermission); RefPtr taggedDocument = Document::create(0, KURL()); taggedDocument->takeAllChildrenFrom(taggedFragment.get()); RefPtr nodeBeforeContext; RefPtr nodeAfterContext; if (!findNodesSurroundingContext(taggedDocument.get(), nodeBeforeContext, nodeAfterContext)) return 0; RefPtr range = Range::create(taggedDocument.get(), positionAfterNode(nodeBeforeContext.get()).parentAnchoredEquivalent(), positionBeforeNode(nodeAfterContext.get()).parentAnchoredEquivalent()); ExceptionCode ec = 0; Node* commonAncestor = range->commonAncestorContainer(ec); ASSERT(!ec); Node* specialCommonAncestor = ancestorToRetainStructureAndAppearanceWithNoRenderer(commonAncestor); RefPtr fragment = DocumentFragment::create(document); if (specialCommonAncestor) { fragment->appendChild(specialCommonAncestor, ec); ASSERT(!ec); } else fragment->takeAllChildrenFrom(static_cast(commonAncestor)); trimFragment(fragment.get(), nodeBeforeContext.get(), nodeAfterContext.get()); return fragment; } ",0 "gsicc_check_device_link(cmm_profile_t *icc_profile) { bool value; value = gscms_is_device_link(icc_profile->profile_handle); icc_profile->isdevlink = value; return value; } ",0 "bool Textfield::PasteSelectionClipboard() { DCHECK(performing_user_action_); DCHECK(!read_only()); const base::string16 selection_clipboard_text = GetSelectionClipboardText(); if (selection_clipboard_text.empty()) return false; model_->InsertText(selection_clipboard_text); return true; } ",0 "bool WebContext::popupBlockerEnabled() const { if (IsInitialized()) { return context_->IsPopupBlockerEnabled(); } return construct_props_->popup_blocker_enabled; } ",0 "void WebContentsImpl::Copy() { RenderFrameHost* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->Send(new InputMsg_Copy(focused_frame->GetRoutingID())); RecordAction(base::UserMetricsAction(""Copy"")); } ",0 "static int comm_open(struct inode *inode, struct file *filp) { int ret; ret = single_open(filp, comm_show, NULL); if (!ret) { struct seq_file *m = filp->private_data; m->private = inode; } return ret; } ",0 " void MetalayerMode::UpdateState() { if (enabled() && !selectable()) delegate()->DisableTool(GetToolId()); if (!loading()) Shell::Get()->toast_manager()->Cancel(kToastId); UpdateView(); } ",0 "int ServiceWorkerContextCore::GetNextEmbeddedWorkerId() { return next_embedded_worker_id_++; } ",0 "std::string VariationsService::GetDefaultVariationsServerURLForTesting() { return kDefaultServerUrl; } ",0 " adisplay_done( ADisplay display ) { grDoneBitmap( display->bitmap ); grDoneSurface( display->surface ); display->bitmap = NULL; display->surface = NULL; grDoneDevices(); } ",0 "ListValue* TestingAutomationProvider::GetInfobarsInfo(WebContents* wc) { ListValue* infobars = new ListValue; InfoBarTabHelper* infobar_helper = TabContentsWrapper::GetCurrentWrapperForContents(wc)-> infobar_tab_helper(); for (size_t i = 0; i < infobar_helper->infobar_count(); ++i) { DictionaryValue* infobar_item = new DictionaryValue; InfoBarDelegate* infobar = infobar_helper->GetInfoBarDelegateAt(i); if (infobar->AsConfirmInfoBarDelegate()) { infobar_item->SetString(""type"", ""confirm_infobar""); ConfirmInfoBarDelegate* confirm_infobar = infobar->AsConfirmInfoBarDelegate(); infobar_item->SetString(""text"", confirm_infobar->GetMessageText()); infobar_item->SetString(""link_text"", confirm_infobar->GetLinkText()); ListValue* buttons_list = new ListValue; int buttons = confirm_infobar->GetButtons(); if (buttons & ConfirmInfoBarDelegate::BUTTON_OK) { StringValue* button_label = new StringValue( confirm_infobar->GetButtonLabel( ConfirmInfoBarDelegate::BUTTON_OK)); buttons_list->Append(button_label); } if (buttons & ConfirmInfoBarDelegate::BUTTON_CANCEL) { StringValue* button_label = new StringValue( confirm_infobar->GetButtonLabel( ConfirmInfoBarDelegate::BUTTON_CANCEL)); buttons_list->Append(button_label); } infobar_item->Set(""buttons"", buttons_list); } else if (infobar->AsLinkInfoBarDelegate()) { infobar_item->SetString(""type"", ""link_infobar""); LinkInfoBarDelegate* link_infobar = infobar->AsLinkInfoBarDelegate(); infobar_item->SetString(""link_text"", link_infobar->GetLinkText()); } else if (infobar->AsTranslateInfoBarDelegate()) { infobar_item->SetString(""type"", ""translate_infobar""); TranslateInfoBarDelegate* translate_infobar = infobar->AsTranslateInfoBarDelegate(); infobar_item->SetString(""original_lang_code"", translate_infobar->GetOriginalLanguageCode()); infobar_item->SetString(""target_lang_code"", translate_infobar->GetTargetLanguageCode()); } else if (infobar->AsExtensionInfoBarDelegate()) { infobar_item->SetString(""type"", ""extension_infobar""); } else { infobar_item->SetString(""type"", ""unknown_infobar""); } infobars->Append(infobar_item); } return infobars; } ",0 "void RenderFrameImpl::CheckIfAudioSinkExistsAndIsAuthorized( const blink::WebString& sink_id, blink::WebSetSinkIdCompleteCallback completion_callback) { std::move( media::ConvertToOutputDeviceStatusCB(std::move(completion_callback))) .Run(AudioDeviceFactory::GetOutputDeviceInfo( GetRoutingID(), media::AudioSinkParameters(0, sink_id.Utf8())) .device_status()); } ",0 "static int fsmUtime(const char *path, mode_t mode, time_t mtime) { int rc = 0; struct timeval stamps[2] = { { .tv_sec = mtime, .tv_usec = 0 }, { .tv_sec = mtime, .tv_usec = 0 }, }; #if HAVE_LUTIMES rc = lutimes(path, stamps); #else if (!S_ISLNK(mode)) rc = utimes(path, stamps); #endif if (_fsm_debug) rpmlog(RPMLOG_DEBUG, "" %8s (%s, 0x%x) %s\n"", __func__, path, (unsigned)mtime, (rc < 0 ? strerror(errno) : """")); if (rc < 0) rc = RPMERR_UTIME_FAILED; /* ...but utime error is not critical for directories */ if (rc && S_ISDIR(mode)) rc = 0; return rc; } ",0 " base::RefCountedBytes* bytes() { return bytes_.get(); } ",0 "int HTMLSelectElement::lastSelectedListIndex() const { const Vector& items = listItems(); for (size_t i = items.size(); i;) { HTMLElement* element = items[--i]; if (element->hasTagName(optionTag) && toHTMLOptionElement(element)->selected()) return i; } return -1; } ",0 " JSRetainPtr AccessibilityUIElement::language() { return JSStringCreateWithCharacters(0, 0); } ",0 "void Document::Initialize() { DCHECK_EQ(lifecycle_.GetState(), DocumentLifecycle::kInactive); DCHECK(!ax_object_cache_ || this != &AXObjectCacheOwner()); layout_view_ = new LayoutView(this); SetLayoutObject(layout_view_); layout_view_->SetIsInWindow(true); layout_view_->SetStyle(StyleResolver::StyleForViewport(*this)); layout_view_->Compositor()->SetNeedsCompositingUpdate( kCompositingUpdateAfterCompositingInputChange); { ReattachLegacyLayoutObjectList legacy_layout_objects(*this); AttachContext context; ContainerNode::AttachLayoutTree(context); legacy_layout_objects.ForceLegacyLayoutIfNeeded(); } if (TextAutosizer* autosizer = GetTextAutosizer()) autosizer->UpdatePageInfo(); frame_->DidAttachDocument(); lifecycle_.AdvanceTo(DocumentLifecycle::kStyleClean); if (View()) View()->DidAttachDocument(); network_state_observer_ = MakeGarbageCollected(*this); } ",0 "void free_metadata (WavpackMetadata *wpmd) { if (wpmd->data) { free (wpmd->data); wpmd->data = NULL; } } ",0 "static void lo_rw_aio_complete(struct kiocb *iocb, long ret, long ret2) { struct loop_cmd *cmd = container_of(iocb, struct loop_cmd, iocb); if (cmd->css) css_put(cmd->css); cmd->ret = ret; lo_rw_aio_do_completion(cmd); } ",0 "bool Extension::LoadBackgroundScripts(string16* error) { const std::string& key = is_platform_app() ? keys::kPlatformAppBackgroundScripts : keys::kBackgroundScripts; return LoadBackgroundScripts(key, error); } ",0 "void synchronize_sched_expedited(void) { int snap, trycount = 0; smp_mb(); /* ensure prior mod happens before capturing snap. */ snap = atomic_read(&synchronize_sched_expedited_count) + 1; get_online_cpus(); while (try_stop_cpus(cpu_online_mask, synchronize_sched_expedited_cpu_stop, NULL) == -EAGAIN) { put_online_cpus(); if (trycount++ < 10) udelay(trycount * num_online_cpus()); else { synchronize_sched(); return; } if (atomic_read(&synchronize_sched_expedited_count) - snap > 0) { smp_mb(); /* ensure test happens before caller kfree */ return; } get_online_cpus(); } atomic_inc(&synchronize_sched_expedited_count); smp_mb__after_atomic_inc(); /* ensure post-GP actions seen after GP. */ put_online_cpus(); } ",0 "void TerminateServiceWorkerOnIO( base::WeakPtr context_weak, int64_t version_id) { if (ServiceWorkerContextCore* context = context_weak.get()) { if (ServiceWorkerVersion* version = context->GetLiveVersion(version_id)) version->StopWorker(base::DoNothing()); } } ",0 "gs_main_run_string_end(gs_main_instance * minst, int user_errors, int *pexit_code, ref * perror_object) { ref rstr; make_empty_const_string(&rstr, avm_foreign | a_readonly); return gs_main_interpret(minst, &rstr, user_errors, pexit_code, perror_object); } ",0 "int drm_mode_detachmode_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_object *obj; struct drm_mode_mode_cmd *mode_cmd = data; struct drm_connector *connector; struct drm_display_mode mode; struct drm_mode_modeinfo *umode = &mode_cmd->mode; int ret = 0; if (!drm_core_check_feature(dev, DRIVER_MODESET)) return -EINVAL; mutex_lock(&dev->mode_config.mutex); obj = drm_mode_object_find(dev, mode_cmd->connector_id, DRM_MODE_OBJECT_CONNECTOR); if (!obj) { ret = -EINVAL; goto out; } connector = obj_to_connector(obj); drm_crtc_convert_umode(&mode, umode); ret = drm_mode_detachmode(dev, connector, &mode); out: mutex_unlock(&dev->mode_config.mutex); return ret; } ",0 "int btrfs_truncate_page(struct inode *inode, loff_t from, loff_t len, int front) { struct address_space *mapping = inode->i_mapping; struct btrfs_root *root = BTRFS_I(inode)->root; struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct btrfs_ordered_extent *ordered; struct extent_state *cached_state = NULL; char *kaddr; u32 blocksize = root->sectorsize; pgoff_t index = from >> PAGE_CACHE_SHIFT; unsigned offset = from & (PAGE_CACHE_SIZE-1); struct page *page; gfp_t mask = btrfs_alloc_write_mask(mapping); int ret = 0; u64 page_start; u64 page_end; if ((offset & (blocksize - 1)) == 0 && (!len || ((len & (blocksize - 1)) == 0))) goto out; ret = btrfs_delalloc_reserve_space(inode, PAGE_CACHE_SIZE); if (ret) goto out; again: page = find_or_create_page(mapping, index, mask); if (!page) { btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE); ret = -ENOMEM; goto out; } page_start = page_offset(page); page_end = page_start + PAGE_CACHE_SIZE - 1; if (!PageUptodate(page)) { ret = btrfs_readpage(NULL, page); lock_page(page); if (page->mapping != mapping) { unlock_page(page); page_cache_release(page); goto again; } if (!PageUptodate(page)) { ret = -EIO; goto out_unlock; } } wait_on_page_writeback(page); lock_extent_bits(io_tree, page_start, page_end, 0, &cached_state); set_page_extent_mapped(page); ordered = btrfs_lookup_ordered_extent(inode, page_start); if (ordered) { unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS); unlock_page(page); page_cache_release(page); btrfs_start_ordered_extent(inode, ordered, 1); btrfs_put_ordered_extent(ordered); goto again; } clear_extent_bit(&BTRFS_I(inode)->io_tree, page_start, page_end, EXTENT_DIRTY | EXTENT_DELALLOC | EXTENT_DO_ACCOUNTING | EXTENT_DEFRAG, 0, 0, &cached_state, GFP_NOFS); ret = btrfs_set_extent_delalloc(inode, page_start, page_end, &cached_state); if (ret) { unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS); goto out_unlock; } if (offset != PAGE_CACHE_SIZE) { if (!len) len = PAGE_CACHE_SIZE - offset; kaddr = kmap(page); if (front) memset(kaddr, 0, offset); else memset(kaddr + offset, 0, len); flush_dcache_page(page); kunmap(page); } ClearPageChecked(page); set_page_dirty(page); unlock_extent_cached(io_tree, page_start, page_end, &cached_state, GFP_NOFS); out_unlock: if (ret) btrfs_delalloc_release_space(inode, PAGE_CACHE_SIZE); unlock_page(page); page_cache_release(page); out: return ret; } ",0 "void mp_encode_bytes(lua_State *L, mp_buf *buf, const unsigned char *s, size_t len) { unsigned char hdr[5]; int hdrlen; if (len < 32) { hdr[0] = 0xa0 | (len&0xff); /* fix raw */ hdrlen = 1; } else if (len <= 0xff) { hdr[0] = 0xd9; hdr[1] = len; hdrlen = 2; } else if (len <= 0xffff) { hdr[0] = 0xda; hdr[1] = (len&0xff00)>>8; hdr[2] = len&0xff; hdrlen = 3; } else { hdr[0] = 0xdb; hdr[1] = (len&0xff000000)>>24; hdr[2] = (len&0xff0000)>>16; hdr[3] = (len&0xff00)>>8; hdr[4] = len&0xff; hdrlen = 5; } mp_buf_append(L,buf,hdr,hdrlen); mp_buf_append(L,buf,s,len); } ",0 "handle_nxt_set_flow_format(struct ofconn *ofconn, const struct ofp_header *oh) { const struct nx_set_flow_format *msg = ofpmsg_body(oh); enum ofputil_protocol cur, next; enum ofputil_protocol next_base; next_base = ofputil_nx_flow_format_to_protocol(ntohl(msg->format)); if (!next_base) { return OFPERR_OFPBRC_EPERM; } cur = ofconn_get_protocol(ofconn); next = ofputil_protocol_set_base(cur, next_base); ofconn_set_protocol(ofconn, next); return 0; } ",0 "int32_t HashCode(int32_t platform_id, int32_t encoding_id, int32_t language_id, int32_t name_id) { int32_t result = platform_id << 24 | encoding_id << 16 | language_id << 8; if (name_id == NameId::kFullFontName) { result |= 0xff; } else if (name_id == NameId::kPreferredFamily || name_id == NameId::kPreferredSubfamily) { result |= 0xf; } else if (name_id == NameId::kWWSFamilyName || name_id == NameId::kWWSSubfamilyName) { result |= 1; } return result; } ",0 "void WebGLRenderingContextBase::BufferDataImpl(GLenum target, long long size, const void* data, GLenum usage) { WebGLBuffer* buffer = ValidateBufferDataTarget(""bufferData"", target); if (!buffer) return; if (!ValidateBufferDataUsage(""bufferData"", usage)) return; if (!ValidateValueFitNonNegInt32(""bufferData"", ""size"", size)) return; buffer->SetSize(size); ContextGL()->BufferData(target, static_cast(size), data, usage); } ",0 "void StatusBubbleGtk::UserChangedTheme() { if (theme_provider_->UseGtkTheme()) { gtk_widget_modify_fg(label_, GTK_STATE_NORMAL, NULL); gtk_widget_modify_bg(container_.get(), GTK_STATE_NORMAL, NULL); } else { GdkColor bookmark_text = theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_BOOKMARK_TEXT); gtk_widget_modify_fg(label_, GTK_STATE_NORMAL, &bookmark_text); GdkColor toolbar_color = theme_provider_->GetGdkColor(BrowserThemeProvider::COLOR_TOOLBAR); gtk_widget_modify_bg(container_.get(), GTK_STATE_NORMAL, &toolbar_color); } gtk_util::SetRoundedWindowBorderColor(container_.get(), theme_provider_->GetBorderColor()); } ",0 "int vnc_display_password(DisplayState *ds, const char *password) { VncDisplay *vs = vnc_display; if (!vs) { return -EINVAL; } if (vs->auth == VNC_AUTH_NONE) { error_printf_unless_qmp(""If you want use passwords please enable "" ""password auth using '-vnc ${dpy},password'.""); return -EINVAL; } g_free(vs->password); vs->password = g_strdup(password); return 0; } ",0 "ReferrerPolicy WorkerFetchContext::GetReferrerPolicy() const { return global_scope_->GetReferrerPolicy(); } ",0 "void FrameLoader::iconLoadDecisionAvailable() { if (!m_mayLoadIconLater) return; LOG(IconDatabase, ""FrameLoader %p was told a load decision is available for its icon"", this); startIconLoader(); m_mayLoadIconLater = false; } ",0 "void NavigationControllerImpl::SetPendingEntry( std::unique_ptr entry) { DiscardNonCommittedEntriesInternal(); pending_entry_ = entry.release(); NotificationService::current()->Notify( NOTIFICATION_NAV_ENTRY_PENDING, Source(this), Details(pending_entry_)); } ",0 "bool BluetoothAdapterChromeOS::IsPresent() const { return !object_path_.value().empty(); } ",0 "xmlCtxtReadDoc(xmlParserCtxtPtr ctxt, const xmlChar * cur, const char *URL, const char *encoding, int options) { xmlParserInputPtr stream; if (cur == NULL) return (NULL); if (ctxt == NULL) return (NULL); xmlCtxtReset(ctxt); stream = xmlNewStringInputStream(ctxt, cur); if (stream == NULL) { return (NULL); } inputPush(ctxt, stream); return (xmlDoRead(ctxt, URL, encoding, options, 1)); } ",0 "static int enable_irq_window(struct kvm_vcpu *vcpu) { u32 cpu_based_vm_exec_control; if (is_guest_mode(vcpu) && nested_exit_on_intr(vcpu)) /* * We get here if vmx_interrupt_allowed() said we can't * inject to L1 now because L2 must run. The caller will have * to make L2 exit right after entry, so we can inject to L1 * more promptly. */ return -EBUSY; cpu_based_vm_exec_control = vmcs_read32(CPU_BASED_VM_EXEC_CONTROL); cpu_based_vm_exec_control |= CPU_BASED_VIRTUAL_INTR_PENDING; vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, cpu_based_vm_exec_control); return 0; } ",0 "evdns_base_search_ndots_set(struct evdns_base *base, const int ndots) { EVDNS_LOCK(base); if (!base->global_search_state) base->global_search_state = search_state_new(); if (base->global_search_state) base->global_search_state->ndots = ndots; EVDNS_UNLOCK(base); } ",0 "static struct dentry *proc_fd_instantiate(struct inode *dir, struct dentry *dentry, struct task_struct *task, const void *ptr) { unsigned fd = *(const unsigned *)ptr; struct file *file; struct files_struct *files; struct inode *inode; struct proc_inode *ei; struct dentry *error = ERR_PTR(-ENOENT); inode = proc_pid_make_inode(dir->i_sb, task); if (!inode) goto out; ei = PROC_I(inode); ei->fd = fd; files = get_files_struct(task); if (!files) goto out_iput; inode->i_mode = S_IFLNK; /* * We are not taking a ref to the file structure, so we must * hold ->file_lock. */ spin_lock(&files->file_lock); file = fcheck_files(files, fd); if (!file) goto out_unlock; if (file->f_mode & FMODE_READ) inode->i_mode |= S_IRUSR | S_IXUSR; if (file->f_mode & FMODE_WRITE) inode->i_mode |= S_IWUSR | S_IXUSR; spin_unlock(&files->file_lock); put_files_struct(files); inode->i_op = &proc_pid_link_inode_operations; inode->i_size = 64; ei->op.proc_get_link = proc_fd_link; dentry->d_op = &tid_fd_dentry_operations; d_add(dentry, inode); /* Close the race of the process dying before we return the dentry */ if (tid_fd_revalidate(dentry, NULL)) error = NULL; out: return error; out_unlock: spin_unlock(&files->file_lock); put_files_struct(files); out_iput: iput(inode); goto out; } ",0 "static void sit_add_v4_addrs(struct inet6_dev *idev) { struct in6_addr addr; struct net_device *dev; struct net *net = dev_net(idev->dev); int scope, plen; u32 pflags = 0; ASSERT_RTNL(); memset(&addr, 0, sizeof(struct in6_addr)); memcpy(&addr.s6_addr32[3], idev->dev->dev_addr, 4); if (idev->dev->flags&IFF_POINTOPOINT) { addr.s6_addr32[0] = htonl(0xfe800000); scope = IFA_LINK; plen = 64; } else { scope = IPV6_ADDR_COMPATv4; plen = 96; pflags |= RTF_NONEXTHOP; } if (addr.s6_addr32[3]) { add_addr(idev, &addr, plen, scope); addrconf_prefix_route(&addr, plen, idev->dev, 0, pflags); return; } for_each_netdev(net, dev) { struct in_device *in_dev = __in_dev_get_rtnl(dev); if (in_dev && (dev->flags & IFF_UP)) { struct in_ifaddr *ifa; int flag = scope; for (ifa = in_dev->ifa_list; ifa; ifa = ifa->ifa_next) { addr.s6_addr32[3] = ifa->ifa_local; if (ifa->ifa_scope == RT_SCOPE_LINK) continue; if (ifa->ifa_scope >= RT_SCOPE_HOST) { if (idev->dev->flags&IFF_POINTOPOINT) continue; flag |= IFA_HOST; } add_addr(idev, &addr, plen, flag); addrconf_prefix_route(&addr, plen, idev->dev, 0, pflags); } } } } ",0 "file_showstr(FILE *fp, const char *s, size_t len) { char c; for (;;) { if (len == ~0U) { c = *s++; if (c == '\0') break; } else { if (len-- == 0) break; c = *s++; } if (c >= 040 && c <= 0176) /* TODO isprint && !iscntrl */ (void) fputc(c, fp); else { (void) fputc('\\', fp); switch (c) { case '\a': (void) fputc('a', fp); break; case '\b': (void) fputc('b', fp); break; case '\f': (void) fputc('f', fp); break; case '\n': (void) fputc('n', fp); break; case '\r': (void) fputc('r', fp); break; case '\t': (void) fputc('t', fp); break; case '\v': (void) fputc('v', fp); break; default: (void) fprintf(fp, ""%.3o"", c & 0377); break; } } } } ",0 "void comps_objmrtree_values_walk(COMPS_ObjMRTree * rt, void* udata, void (*walk_f)(void*, void*)) { COMPS_HSList *tmplist, *tmp_subnodes; COMPS_HSListItem *it, *it2; tmplist = comps_hslist_create(); comps_hslist_init(tmplist, NULL, NULL, NULL); comps_hslist_append(tmplist, rt->subnodes, 0); while (tmplist->first != NULL) { it = tmplist->first; comps_hslist_remove(tmplist, tmplist->first); tmp_subnodes = (COMPS_HSList*)it->data; free(it); for (it = tmp_subnodes->first; it != NULL; it=it->next) { if (((COMPS_ObjMRTreeData*)it->data)->subnodes->first) { comps_hslist_append(tmplist, ((COMPS_ObjMRTreeData*)it->data)->subnodes, 0); } for (it2 = (COMPS_HSListItem*)((COMPS_ObjMRTreeData*)it->data)->data->first; it2 != NULL; it2 = it2->next) { walk_f(udata, it2->data); } } } comps_hslist_destroy(&tmplist); } ",0 "static int __init skcipher_module_init(void) { skcipher_default_geniv = num_possible_cpus() > 1 ? ""eseqiv"" : ""chainiv""; return 0; } ",0 "static uint32_t fdctrl_read_tape(FDCtrl *fdctrl) { uint32_t retval = fdctrl->tdr; FLOPPY_DPRINTF(""tape drive register: 0x%02x\n"", retval); return retval; } ",0 "bool jsvIsNativeString(const JsVar *v) { return v && (v->flags&JSV_VARTYPEMASK)==JSV_NATIVE_STRING; } ",0 "static inline int vmcs_field_readonly(unsigned long field) { return (((field >> 10) & 0x3) == 1); } ",0 "static TEE_Result tee_svc_obj_generate_key_dh( struct tee_obj *o, const struct tee_cryp_obj_type_props *type_props, uint32_t key_size __unused, const TEE_Attribute *params, uint32_t param_count) { TEE_Result res; struct dh_keypair *tee_dh_key; struct bignum *dh_q = NULL; uint32_t dh_xbits = 0; /* Copy the present attributes into the obj before starting */ res = tee_svc_cryp_obj_populate_type(o, type_props, params, param_count); if (res != TEE_SUCCESS) return res; tee_dh_key = (struct dh_keypair *)o->attr; if (get_attribute(o, type_props, TEE_ATTR_DH_SUBPRIME)) dh_q = tee_dh_key->q; if (get_attribute(o, type_props, TEE_ATTR_DH_X_BITS)) dh_xbits = tee_dh_key->xbits; res = crypto_acipher_gen_dh_key(tee_dh_key, dh_q, dh_xbits); if (res != TEE_SUCCESS) return res; /* Set bits for the generated public and private key */ set_attribute(o, type_props, TEE_ATTR_DH_PUBLIC_VALUE); set_attribute(o, type_props, TEE_ATTR_DH_PRIVATE_VALUE); set_attribute(o, type_props, TEE_ATTR_DH_X_BITS); return TEE_SUCCESS; } ",0 " static AwContents* GetContents(WebContents* web_contents) { if (!web_contents) return NULL; AwContentsUserData* data = static_cast( web_contents->GetUserData(kAwContentsUserDataKey)); return data ? data->contents_ : NULL; } ",0 "void RegisterForAllNavNotifications(TestNotificationTracker* tracker, NavigationController* controller) { tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source(controller)); tracker->ListenFor(content::NOTIFICATION_NAV_LIST_PRUNED, content::Source(controller)); tracker->ListenFor(content::NOTIFICATION_NAV_ENTRY_CHANGED, content::Source(controller)); } ",0 "void PrintPreviewMessageHandler::OnPrintPreviewCancelled(int document_cookie) { StopWorker(document_cookie); } ",0 "DEFINE_TRACE(Frame) { visitor->trace(m_treeNode); visitor->trace(m_host); visitor->trace(m_owner); visitor->trace(m_client); } ",0 "jsonb_array_elements(PG_FUNCTION_ARGS) { return elements_worker_jsonb(fcinfo, ""jsonb_array_elements"", false); } ",0 "static inline int SlabDebug(struct page *page) { return page->flags & SLABDEBUG; } ",0 "PlatformSensorProviderLinux::~PlatformSensorProviderLinux() { DCHECK(!sensor_device_manager_); } ",0 "bittoint4(PG_FUNCTION_ARGS) { VarBit *arg = PG_GETARG_VARBIT_P(0); uint32 result; bits8 *r; /* Check that the bit string is not too long */ if (VARBITLEN(arg) > sizeof(result) * BITS_PER_BYTE) ereport(ERROR, (errcode(ERRCODE_NUMERIC_VALUE_OUT_OF_RANGE), errmsg(""integer out of range""))); result = 0; for (r = VARBITS(arg); r < VARBITEND(arg); r++) { result <<= BITS_PER_BYTE; result |= *r; } /* Now shift the result to take account of the padding at the end */ result >>= VARBITPAD(arg); PG_RETURN_INT32(result); } ",0 " void CWebServer::RType_SetUsed(WebEmSession & session, const request& req, Json::Value &root) { if (session.rights != 2) { session.reply_status = reply::forbidden; return; //Only admin user allowed } std::string idx = request::findValue(&req, ""idx""); std::string deviceid = request::findValue(&req, ""deviceid""); std::string name = request::findValue(&req, ""name""); std::string description = request::findValue(&req, ""description""); std::string sused = request::findValue(&req, ""used""); std::string sswitchtype = request::findValue(&req, ""switchtype""); std::string maindeviceidx = request::findValue(&req, ""maindeviceidx""); std::string addjvalue = request::findValue(&req, ""addjvalue""); std::string addjmulti = request::findValue(&req, ""addjmulti""); std::string addjvalue2 = request::findValue(&req, ""addjvalue2""); std::string addjmulti2 = request::findValue(&req, ""addjmulti2""); std::string setPoint = request::findValue(&req, ""setpoint""); std::string state = request::findValue(&req, ""state""); std::string mode = request::findValue(&req, ""mode""); std::string until = request::findValue(&req, ""until""); std::string clock = request::findValue(&req, ""clock""); std::string tmode = request::findValue(&req, ""tmode""); std::string fmode = request::findValue(&req, ""fmode""); std::string sCustomImage = request::findValue(&req, ""customimage""); std::string strunit = request::findValue(&req, ""unit""); std::string strParam1 = base64_decode(request::findValue(&req, ""strparam1"")); std::string strParam2 = base64_decode(request::findValue(&req, ""strparam2"")); std::string tmpstr = request::findValue(&req, ""protected""); bool bHasstrParam1 = request::hasValue(&req, ""strparam1""); int iProtected = (tmpstr == ""true"") ? 1 : 0; std::string sOptions = base64_decode(request::findValue(&req, ""options"")); std::string devoptions = CURLEncode::URLDecode(request::findValue(&req, ""devoptions"")); std::string EnergyMeterMode = CURLEncode::URLDecode(request::findValue(&req, ""EnergyMeterMode"")); char szTmp[200]; bool bHaveUser = (session.username != """"); int iUser = -1; if (bHaveUser) { iUser = FindUser(session.username.c_str()); } int switchtype = -1; if (sswitchtype != """") switchtype = atoi(sswitchtype.c_str()); if ((idx.empty()) || (sused.empty())) return; int used = (sused == ""true"") ? 1 : 0; if (maindeviceidx != """") used = 0; int CustomImage = 0; if (sCustomImage != """") CustomImage = atoi(sCustomImage.c_str()); name = stdstring_trim(name); description = stdstring_trim(description); std::vector > result; result = m_sql.safe_query(""SELECT Type,SubType,HardwareID FROM DeviceStatus WHERE (ID == '%q')"", idx.c_str()); if (result.empty()) return; std::vector sd = result[0]; unsigned char dType = atoi(sd[0].c_str()); int HwdID = atoi(sd[2].c_str()); std::string sHwdID = sd[2]; if (setPoint != """" || state != """") { double tempcelcius = atof(setPoint.c_str()); if (m_sql.m_tempunit == TEMPUNIT_F) { tempcelcius = ConvertToCelsius(tempcelcius); } sprintf(szTmp, ""%.2f"", tempcelcius); if (dType != pTypeEvohomeZone && dType != pTypeEvohomeWater)//sql update now done in setsetpoint for evohome devices { m_sql.safe_query(""UPDATE DeviceStatus SET Used=%d, sValue='%q' WHERE (ID == '%q')"", used, szTmp, idx.c_str()); } } if (name.empty()) { m_sql.safe_query(""UPDATE DeviceStatus SET Used=%d WHERE (ID == '%q')"", used, idx.c_str()); } else { if (switchtype == -1) { m_sql.safe_query(""UPDATE DeviceStatus SET Used=%d, Name='%q', Description='%q' WHERE (ID == '%q')"", used, name.c_str(), description.c_str(), idx.c_str()); } else { m_sql.safe_query( ""UPDATE DeviceStatus SET Used=%d, Name='%q', Description='%q', SwitchType=%d, CustomImage=%d WHERE (ID == '%q')"", used, name.c_str(), description.c_str(), switchtype, CustomImage, idx.c_str()); } } if (bHasstrParam1) { m_sql.safe_query(""UPDATE DeviceStatus SET StrParam1='%q', StrParam2='%q' WHERE (ID == '%q')"", strParam1.c_str(), strParam2.c_str(), idx.c_str()); } m_sql.safe_query(""UPDATE DeviceStatus SET Protected=%d WHERE (ID == '%q')"", iProtected, idx.c_str()); if (!setPoint.empty() || !state.empty()) { int urights = 3; if (bHaveUser) { int iUser = FindUser(session.username.c_str()); if (iUser != -1) { urights = static_cast(m_users[iUser].userrights); _log.Log(LOG_STATUS, ""User: %s initiated a SetPoint command"", m_users[iUser].Username.c_str()); } } if (urights < 1) return; if (dType == pTypeEvohomeWater) m_mainworker.SetSetPoint(idx, (state == ""On"") ? 1.0f : 0.0f, mode, until);//FIXME float not guaranteed precise? else if (dType == pTypeEvohomeZone) m_mainworker.SetSetPoint(idx, static_cast(atof(setPoint.c_str())), mode, until); else m_mainworker.SetSetPoint(idx, static_cast(atof(setPoint.c_str()))); } else if (!clock.empty()) { int urights = 3; if (bHaveUser) { int iUser = FindUser(session.username.c_str()); if (iUser != -1) { urights = static_cast(m_users[iUser].userrights); _log.Log(LOG_STATUS, ""User: %s initiated a SetClock command"", m_users[iUser].Username.c_str()); } } if (urights < 1) return; m_mainworker.SetClock(idx, clock); } else if (!tmode.empty()) { int urights = 3; if (bHaveUser) { int iUser = FindUser(session.username.c_str()); if (iUser != -1) { urights = static_cast(m_users[iUser].userrights); _log.Log(LOG_STATUS, ""User: %s initiated a Thermostat Mode command"", m_users[iUser].Username.c_str()); } } if (urights < 1) return; m_mainworker.SetZWaveThermostatMode(idx, atoi(tmode.c_str())); } else if (!fmode.empty()) { int urights = 3; if (bHaveUser) { int iUser = FindUser(session.username.c_str()); if (iUser != -1) { urights = static_cast(m_users[iUser].userrights); _log.Log(LOG_STATUS, ""User: %s initiated a Thermostat Fan Mode command"", m_users[iUser].Username.c_str()); } } if (urights < 1) return; m_mainworker.SetZWaveThermostatFanMode(idx, atoi(fmode.c_str())); } if (!strunit.empty()) { bool bUpdateUnit = true; #ifdef ENABLE_PYTHON std::vector > result; result = m_sql.safe_query(""SELECT Type FROM Hardware WHERE (ID == %d)"", HwdID); if (!result.empty()) { std::vector sd = result[0]; _eHardwareTypes Type = (_eHardwareTypes)atoi(sd[0].c_str()); if (Type == HTYPE_PythonPlugin) { bUpdateUnit = false; _log.Log(LOG_ERROR, ""CWebServer::RType_SetUsed: Not allowed to change unit of device owned by plugin %u!"", HwdID); } } #endif if (bUpdateUnit) { m_sql.safe_query(""UPDATE DeviceStatus SET Unit='%q' WHERE (ID == '%q')"", strunit.c_str(), idx.c_str()); } } if (!deviceid.empty()) { m_sql.safe_query(""UPDATE DeviceStatus SET DeviceID='%q' WHERE (ID == '%q')"", deviceid.c_str(), idx.c_str()); } if (!addjvalue.empty()) { double faddjvalue = atof(addjvalue.c_str()); m_sql.safe_query(""UPDATE DeviceStatus SET AddjValue=%f WHERE (ID == '%q')"", faddjvalue, idx.c_str()); } if (!addjmulti.empty()) { double faddjmulti = atof(addjmulti.c_str()); if (faddjmulti == 0) faddjmulti = 1; m_sql.safe_query(""UPDATE DeviceStatus SET AddjMulti=%f WHERE (ID == '%q')"", faddjmulti, idx.c_str()); } if (!addjvalue2.empty()) { double faddjvalue2 = atof(addjvalue2.c_str()); m_sql.safe_query(""UPDATE DeviceStatus SET AddjValue2=%f WHERE (ID == '%q')"", faddjvalue2, idx.c_str()); } if (!addjmulti2.empty()) { double faddjmulti2 = atof(addjmulti2.c_str()); if (faddjmulti2 == 0) faddjmulti2 = 1; m_sql.safe_query(""UPDATE DeviceStatus SET AddjMulti2=%f WHERE (ID == '%q')"", faddjmulti2, idx.c_str()); } if (!EnergyMeterMode.empty()) { auto options = m_sql.GetDeviceOptions(idx); options[""EnergyMeterMode""] = EnergyMeterMode; uint64_t ullidx = std::strtoull(idx.c_str(), nullptr, 10); m_sql.SetDeviceOptions(ullidx, options); } if (!devoptions.empty()) { m_sql.safe_query(""UPDATE DeviceStatus SET Options='%q' WHERE (ID == '%q')"", devoptions.c_str(), idx.c_str()); } if (used == 0) { bool bRemoveSubDevices = (request::findValue(&req, ""RemoveSubDevices"") == ""true""); if (bRemoveSubDevices) { m_sql.safe_query(""DELETE FROM LightSubDevices WHERE (DeviceRowID == '%q')"", idx.c_str()); } m_sql.safe_query(""DELETE FROM LightSubDevices WHERE (ParentID == '%q')"", idx.c_str()); m_sql.safe_query(""DELETE FROM Timers WHERE (DeviceRowID == '%q')"", idx.c_str()); } if (!sOptions.empty()) { uint64_t ullidx = std::strtoull(idx.c_str(), nullptr, 10); m_sql.SetDeviceOptions(ullidx, m_sql.BuildDeviceOptions(sOptions, false)); } if (maindeviceidx != """") { if (maindeviceidx != idx) { result = m_sql.safe_query(""SELECT ID FROM LightSubDevices WHERE (DeviceRowID=='%q') AND (ParentID =='%q')"", idx.c_str(), maindeviceidx.c_str()); if (result.empty()) { m_sql.safe_query( ""INSERT INTO LightSubDevices (DeviceRowID, ParentID) VALUES ('%q','%q')"", idx.c_str(), maindeviceidx.c_str() ); } } } if ((used == 0) && (maindeviceidx.empty())) { m_sql.DeleteDevices(idx); } else { #ifdef ENABLE_PYTHON m_mainworker.m_pluginsystem.DeviceModified(atoi(idx.c_str())); #endif } if (!result.empty()) { root[""status""] = ""OK""; root[""title""] = ""SetUsed""; } if (m_sql.m_bEnableEventSystem) m_mainworker.m_eventsystem.GetCurrentStates(); } ",0 " aura::Window* GetOverviewWindowForMinimizedState(int index, aura::Window* window) { WindowSelectorItem* selector = GetWindowItemForWindow(index, window); return selector->GetOverviewWindowForMinimizedStateForTest(); } ",0 "static inline void shift_rfc5988(php_http_buffer_t *buf, char *key_str, size_t key_len, const char *ass, size_t asl, unsigned flags TSRMLS_DC) { char *str; size_t len; if (buf->used) { php_http_buffer_append(buf, ass, asl); } prepare_key(flags, key_str, key_len, &str, &len TSRMLS_CC); php_http_buffer_appends(buf, ""<""); php_http_buffer_append(buf, str, len); php_http_buffer_appends(buf, "">""); efree(str); } ",0 "SpoolssGetPrinterDriverDirectory_r(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { /* Parse packet */ offset = dissect_spoolss_string_parm( tvb, offset, pinfo, tree, di, drep, ""Directory""); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_needed, NULL); offset = dissect_doserror( tvb, offset, pinfo, tree, di, drep, hf_rc, NULL); return offset; } ",0 " PHP_FUNCTION(utf8_encode) { char *arg; XML_Char *encoded; int arg_len, len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &arg, &arg_len) == FAILURE) { return; } encoded = xml_utf8_encode(arg, arg_len, &len, ""ISO-8859-1""); if (encoded == NULL) { RETURN_FALSE; } RETVAL_STRINGL(encoded, len, 0); } ",0 "void FileManagerBrowserTestBase::LaunchExtension(const base::FilePath& path, const char* manifest_name) { base::FilePath source_dir; CHECK(base::PathService::Get(base::DIR_SOURCE_ROOT, &source_dir)); const base::FilePath source_path = source_dir.Append(path); const extensions::Extension* const extension_launched = LoadExtensionAsComponentWithManifest(source_path, manifest_name); CHECK(extension_launched) << ""Launching: "" << manifest_name; } ",0 "static enum send_ret __stratum_send(struct pool *pool, char *s, ssize_t len) { SOCKETTYPE sock = pool->sock; ssize_t ssent = 0; strcat(s, ""\n""); len++; while (len > 0 ) { struct timeval timeout = {1, 0}; ssize_t sent; fd_set wd; retry: FD_ZERO(&wd); FD_SET(sock, &wd); if (select(sock + 1, NULL, &wd, NULL, &timeout) < 1) { if (interrupted()) goto retry; return SEND_SELECTFAIL; } #ifdef __APPLE__ sent = send(pool->sock, s + ssent, len, SO_NOSIGPIPE); #elif WIN32 sent = send(pool->sock, s + ssent, len, 0); #else sent = send(pool->sock, s + ssent, len, MSG_NOSIGNAL); #endif if (sent < 0) { if (!sock_blocks()) return SEND_SENDFAIL; sent = 0; } ssent += sent; len -= sent; } pool->cgminer_pool_stats.times_sent++; pool->cgminer_pool_stats.bytes_sent += ssent; pool->cgminer_pool_stats.net_bytes_sent += ssent; return SEND_OK; } ",0 "static int chksum_digest(struct shash_desc *desc, const u8 *data, unsigned int length, u8 *out) { struct chksum_ctx *mctx = crypto_shash_ctx(desc->tfm); return __chksum_finup(&mctx->key, data, length, out); } ",0 "static void testInterfaceWillBeGarbageCollectedAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); bool isNull = false; RefPtrWillBeRawPtr jsValue = imp->testInterfaceWillBeGarbageCollectedAttribute(isNull); if (isNull) { v8SetReturnValueNull(info); return; } v8SetReturnValueFast(info, WTF::getPtr(jsValue.release()), imp); } ",0 "void BrowserWindowGtk::OnMainWindowDestroy(GtkWidget* widget) { extension_keybinding_registry_.reset(); MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&base::DeletePointer, this)); } ",0 "static rsRetVal initZMQ(instanceData* pData) { DEFiRet; /* create the context if necessary. */ if (NULL == s_context) { zsys_handler_set(NULL); s_context = zctx_new(); if (s_workerThreads > 0) zctx_set_iothreads(s_context, s_workerThreads); } pData->socket = zsocket_new(s_context, pData->type); if (NULL == pData->socket) { errmsg.LogError(0, RS_RET_NO_ERRCODE, ""omzmq3: zsocket_new failed for %s: %s"", pData->description, zmq_strerror(errno)); ABORT_FINALIZE(RS_RET_NO_ERRCODE); } /* use czmq defaults for these, unless set to non-default values */ if(pData->identity) zsocket_set_identity(pData->socket, (char*)pData->identity); if(pData->sndBuf > -1) zsocket_set_sndbuf(pData->socket, pData->sndBuf); if(pData->rcvBuf > -1) zsocket_set_sndbuf(pData->socket, pData->rcvBuf); if(pData->linger > -1) zsocket_set_linger(pData->socket, pData->linger); if(pData->backlog > -1) zsocket_set_backlog(pData->socket, pData->backlog); if(pData->sndTimeout > -1) zsocket_set_sndtimeo(pData->socket, pData->sndTimeout); if(pData->rcvTimeout > -1) zsocket_set_rcvtimeo(pData->socket, pData->rcvTimeout); if(pData->maxMsgSize > -1) zsocket_set_maxmsgsize(pData->socket, pData->maxMsgSize); if(pData->rate > -1) zsocket_set_rate(pData->socket, pData->rate); if(pData->recoveryIVL > -1) zsocket_set_recovery_ivl(pData->socket, pData->recoveryIVL); if(pData->multicastHops > -1) zsocket_set_multicast_hops(pData->socket, pData->multicastHops); if(pData->reconnectIVL > -1) zsocket_set_reconnect_ivl(pData->socket, pData->reconnectIVL); if(pData->reconnectIVLMax > -1) zsocket_set_reconnect_ivl_max(pData->socket, pData->reconnectIVLMax); if(pData->ipv4Only > -1) zsocket_set_ipv4only(pData->socket, pData->ipv4Only); if(pData->affinity != 1) zsocket_set_affinity(pData->socket, pData->affinity); if(pData->rcvHWM > -1) zsocket_set_rcvhwm(pData->socket, pData->rcvHWM); if(pData->sndHWM > -1) zsocket_set_sndhwm(pData->socket, pData->sndHWM); /* bind or connect to it */ if (pData->action == ACTION_BIND) { /* bind asserts, so no need to test return val here which isn't the greatest api -- oh well */ if(-1 == zsocket_bind(pData->socket, (char*)pData->description)) { errmsg.LogError(0, RS_RET_NO_ERRCODE, ""omzmq3: bind failed for %s: %s"", pData->description, zmq_strerror(errno)); ABORT_FINALIZE(RS_RET_NO_ERRCODE); } DBGPRINTF(""omzmq3: bind to %s successful\n"",pData->description); } else { if(-1 == zsocket_connect(pData->socket, (char*)pData->description)) { errmsg.LogError(0, RS_RET_NO_ERRCODE, ""omzmq3: connect failed for %s: %s"", pData->description, zmq_strerror(errno)); ABORT_FINALIZE(RS_RET_NO_ERRCODE); } DBGPRINTF(""omzmq3: connect to %s successful"", pData->description); } finalize_it: RETiRet; } ",1 "INST_HANDLER (muls) { // MULS Rd, Rr int d = (buf[0] >> 4 & 0x0f) + 16; int r = (buf[0] & 0x0f) + 16; ESIL_A (""r%d,DUP,0x80,&,?{,0xffff00,|,},"", r); // sign extension 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 } ",0 "static void __exit dm_multipath_exit(void) { destroy_workqueue(kmpath_handlerd); destroy_workqueue(kmultipathd); dm_unregister_target(&multipath_target); kmem_cache_destroy(_mpio_cache); } ",0 "void NavigationController::Reload(bool check_for_repost) { if (transient_entry_index_ != -1) return; DiscardNonCommittedEntriesInternal(); int current_index = GetCurrentEntryIndex(); if (check_for_repost_ && check_for_repost && current_index != -1 && GetEntryAtIndex(current_index)->has_post_data()) { tab_contents_->Activate(); tab_contents_->delegate()->ShowRepostFormWarningDialog(tab_contents_); } else { int current_index = GetCurrentEntryIndex(); if (current_index == -1) return; DiscardNonCommittedEntriesInternal(); pending_entry_index_ = current_index; entries_[pending_entry_index_]->set_transition_type(PageTransition::RELOAD); NavigateToPendingEntry(true); } } ",0 "ZEND_API int _zend_get_parameters_array_ex(int param_count, zval ***argument_array TSRMLS_DC) /* {{{ */ { void **p; int arg_count; p = zend_vm_stack_top(TSRMLS_C) - 1; arg_count = (int)(zend_uintptr_t) *p; if (param_count>arg_count) { return FAILURE; } while (param_count-->0) { zval **value = (zval**)(p-arg_count); *(argument_array++) = value; arg_count--; } return SUCCESS; } /* }}} */ ",0 "Text* GranularityStrategyTest::SetupRotate(String str) { SetInnerHTML( """" """" """" """" """" ""
"" """" """"); Text* text = GetDocument().createTextNode(str); Element* div = GetDocument().getElementById(""mytext""); div->AppendChild(text); GetDocument().View()->UpdateAllLifecyclePhases(); ParseText(text); return text; } ",0 " explicit DownloadTestContentBrowserClient(bool must_download) : must_download_(must_download) {} ",0 "void jbd2_journal_lock_updates(journal_t *journal) { DEFINE_WAIT(wait); write_lock(&journal->j_state_lock); ++journal->j_barrier_count; /* Wait until there are no running updates */ while (1) { transaction_t *transaction = journal->j_running_transaction; if (!transaction) break; spin_lock(&transaction->t_handle_lock); prepare_to_wait(&journal->j_wait_updates, &wait, TASK_UNINTERRUPTIBLE); if (!atomic_read(&transaction->t_updates)) { spin_unlock(&transaction->t_handle_lock); finish_wait(&journal->j_wait_updates, &wait); break; } spin_unlock(&transaction->t_handle_lock); write_unlock(&journal->j_state_lock); schedule(); finish_wait(&journal->j_wait_updates, &wait); write_lock(&journal->j_state_lock); } write_unlock(&journal->j_state_lock); /* * We have now established a barrier against other normal updates, but * we also need to barrier against other jbd2_journal_lock_updates() calls * to make sure that we serialise special journal-locked operations * too. */ mutex_lock(&journal->j_barrier); } ",0 "static struct dentry *proc_tgid_base_lookup(struct inode *dir, struct dentry *dentry, struct nameidata *nd){ return proc_pident_lookup(dir, dentry, tgid_base_stuff, ARRAY_SIZE(tgid_base_stuff)); } ",0 "ring_buffer_init(struct ring_buffer *rb, long watermark, int flags) { long max_size = perf_data_size(rb); if (watermark) rb->watermark = min(max_size, watermark); if (!rb->watermark) rb->watermark = max_size / 2; if (flags & RING_BUFFER_WRITABLE) rb->writable = 1; atomic_set(&rb->refcount, 1); } ",0 "void udp_flush_pending_frames(struct sock *sk) { struct udp_sock *up = udp_sk(sk); if (up->pending) { up->len = 0; up->pending = 0; ip_flush_pending_frames(sk); } } ",0 "bool ChromePluginServiceFilter::CanLoadPlugin(int render_process_id, const FilePath& path) { if (!render_process_id) return true; base::AutoLock auto_lock(lock_); const ProcessDetails* details = GetProcess(render_process_id); if (!details) return false; if (details->authorized_plugins.find(path) == details->authorized_plugins.end() && details->authorized_plugins.find(FilePath()) == details->authorized_plugins.end()) { return false; } return true; } ",0 "new_files_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { NautilusDirectory *directory; GFileInfo *info; NewFilesState *state; state = user_data; if (state->directory == NULL) { /* Operation was cancelled. Bail out */ new_files_state_unref (state); return; } directory = nautilus_directory_ref (state->directory); /* Queue up the new file. */ info = g_file_query_info_finish (G_FILE (source_object), res, NULL); if (info != NULL) { directory_load_one (directory, info); g_object_unref (info); } new_files_state_unref (state); nautilus_directory_unref (directory); } ",0 "close_and_restore(const struct magic_set *ms, const char *name, int fd, const struct stat *sb) { if (fd == STDIN_FILENO || name == NULL) return; (void) close(fd); if ((ms->flags & MAGIC_PRESERVE_ATIME) != 0) { /* * Try to restore access, modification times if read it. * This is really *bad* because it will modify the status * time of the file... And of course this will affect * backup programs */ #ifdef HAVE_UTIMES struct timeval utsbuf[2]; (void)memset(utsbuf, 0, sizeof(utsbuf)); utsbuf[0].tv_sec = sb->st_atime; utsbuf[1].tv_sec = sb->st_mtime; (void) utimes(name, utsbuf); /* don't care if loses */ #elif defined(HAVE_UTIME_H) || defined(HAVE_SYS_UTIME_H) struct utimbuf utbuf; (void)memset(&utbuf, 0, sizeof(utbuf)); utbuf.actime = sb->st_atime; utbuf.modtime = sb->st_mtime; (void) utime(name, &utbuf); /* don't care if loses */ #endif } } ",0 " explicit EmptyDataReader(WebDataConsumerHandle::Client* client) : m_factory(this) { Platform::current()->currentThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&EmptyDataReader::notify, m_factory.createWeakPtr(), client)); } ",0 "unsigned int arg_parse_uint(const struct arg *arg) { long int rawval; char *endptr; rawval = strtol(arg->val, &endptr, 10); if (arg->val[0] != '\0' && endptr[0] == '\0') { if (rawval >= 0 && rawval <= UINT_MAX) return rawval; die(""Option %s: Value %ld out of range for unsigned int\n"", arg->name, rawval); } die(""Option %s: Invalid character '%c'\n"", arg->name, *endptr); return 0; } ",0 "ReadUserLogState::ReadUserLogState( const char *path, int max_rotations, int recent_thresh ) : ReadUserLogFileState( ) { Reset( RESET_INIT ); m_max_rotations = max_rotations; m_recent_thresh = recent_thresh; if ( path ) { m_base_path = path; } m_initialized = true; m_update_time = 0; } ",0 " virtual InputMethodDescriptor current_input_method() const { if (current_input_method_.id.empty()) { return input_method::GetFallbackInputMethodDescriptor(); } return current_input_method_; } ",1 "v8::Local V8Proxy::callFunction(v8::Handle function, v8::Handle receiver, int argc, v8::Handle args[]) { RefPtr protect(frame()); return V8Proxy::instrumentedCallFunction(frame(), function, receiver, argc, args); } ",0 "void OobeUI::OnCurrentScreenChanged(const std::string& screen) { previous_screen_ = current_screen_; DCHECK(screen_ids_.count(screen)) << ""Screen should be registered in InitializeScreenMaps()""; Screen new_screen = screen_ids_[screen]; FOR_EACH_OBSERVER(Observer, observer_list_, OnCurrentScreenChanged(current_screen_, new_screen)); current_screen_ = new_screen; } ",0 "static inline u16 trans_tx_rate_flags_ieee2hwsim(struct ieee80211_tx_rate *rate) { u16 result = 0; if (rate->flags & IEEE80211_TX_RC_USE_RTS_CTS) result |= MAC80211_HWSIM_TX_RC_USE_RTS_CTS; if (rate->flags & IEEE80211_TX_RC_USE_CTS_PROTECT) result |= MAC80211_HWSIM_TX_RC_USE_CTS_PROTECT; if (rate->flags & IEEE80211_TX_RC_USE_SHORT_PREAMBLE) result |= MAC80211_HWSIM_TX_RC_USE_SHORT_PREAMBLE; if (rate->flags & IEEE80211_TX_RC_MCS) result |= MAC80211_HWSIM_TX_RC_MCS; if (rate->flags & IEEE80211_TX_RC_GREEN_FIELD) result |= MAC80211_HWSIM_TX_RC_GREEN_FIELD; if (rate->flags & IEEE80211_TX_RC_40_MHZ_WIDTH) result |= MAC80211_HWSIM_TX_RC_40_MHZ_WIDTH; if (rate->flags & IEEE80211_TX_RC_DUP_DATA) result |= MAC80211_HWSIM_TX_RC_DUP_DATA; if (rate->flags & IEEE80211_TX_RC_SHORT_GI) result |= MAC80211_HWSIM_TX_RC_SHORT_GI; if (rate->flags & IEEE80211_TX_RC_VHT_MCS) result |= MAC80211_HWSIM_TX_RC_VHT_MCS; if (rate->flags & IEEE80211_TX_RC_80_MHZ_WIDTH) result |= MAC80211_HWSIM_TX_RC_80_MHZ_WIDTH; if (rate->flags & IEEE80211_TX_RC_160_MHZ_WIDTH) result |= MAC80211_HWSIM_TX_RC_160_MHZ_WIDTH; return result; } ",0 "bool AuthenticatorBlePairingBeginSheetModel::IsAcceptButtonEnabled() const { return true; } ",0 "CWD_API void realpath_cache_clean(TSRMLS_D) /* {{{ */ { int i; for (i = 0; i < sizeof(CWDG(realpath_cache))/sizeof(CWDG(realpath_cache)[0]); i++) { realpath_cache_bucket *p = CWDG(realpath_cache)[i]; while (p != NULL) { realpath_cache_bucket *r = p; p = p->next; free(r); } CWDG(realpath_cache)[i] = NULL; } CWDG(realpath_cache_size) = 0; } /* }}} */ ",0 "bool RenderWidgetHostImpl::ScheduleComposite() { if (is_hidden_ || current_size_.IsEmpty() || repaint_ack_pending_ || resize_ack_pending_) { return false; } repaint_start_time_ = TimeTicks::Now(); repaint_ack_pending_ = true; TRACE_EVENT_ASYNC_BEGIN0( ""renderer_host"", ""RenderWidgetHostImpl::repaint_ack_pending_"", this); Send(new ViewMsg_Repaint(routing_id_, current_size_)); return true; } ",0 "bool GLES2Implementation::IsExtensionAvailableHelper(const char* extension, ExtensionStatus* status) { switch (*status) { case kAvailableExtensionStatus: return true; case kUnavailableExtensionStatus: return false; default: { bool available = IsExtensionAvailable(extension); *status = available ? kAvailableExtensionStatus : kUnavailableExtensionStatus; return available; } } } ",0 " void RootWindowHostWin::UnConfineCursor() { ClipCursor(NULL); } ",0 "void BrowserView::InitStatusBubble() { status_bubble_.reset( new StatusBubbleViews(contents_web_view_, HasClientEdge())); contents_web_view_->SetStatusBubble(status_bubble_.get()); } ",0 "void GLES2DecoderImpl::DoVertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) { GLfloat v[4] = { v0, v1, 0.0f, 1.0f, }; if (SetVertexAttribValue(""glVertexAttrib2f"", index, v)) { state_.SetGenericVertexAttribBaseType( index, SHADER_VARIABLE_FLOAT); api()->glVertexAttrib2fFn(index, v0, v1); } } ",0 "error::Error GLES2DecoderPassthroughImpl::DoCommitOverlayPlanesCHROMIUM( uint64_t swap_id, GLbitfield flags) { if (!surface_->SupportsCommitOverlayPlanes()) { InsertError(GL_INVALID_OPERATION, ""glCommitOverlayPlanes not supported by surface.""); return error::kNoError; } client()->OnSwapBuffers(swap_id, flags); return CheckSwapBuffersResult( surface_->CommitOverlayPlanes(base::DoNothing()), ""CommitOverlayPlanes""); } ",0 "static void cmd_changesub(char *tag, char *namespace, char *name, int add) { const char *cmd = add ? ""Subscribe"" : ""Unsubscribe""; int r = 0; int force = config_getswitch(IMAPOPT_ALLOWALLSUBSCRIBE); if (backend_inbox || (backend_inbox = proxy_findinboxserver(imapd_userid))) { /* remote INBOX */ if (add) { char *intname = mboxname_from_external(name, &imapd_namespace, imapd_userid); r = mlookup(NULL, NULL, intname, NULL); free(intname); /* Doesn't exist on murder */ } imapd_check(backend_inbox, 0); if (!r) { if (namespace) { prot_printf(backend_inbox->out, ""%s %s {"" SIZE_T_FMT ""+}\r\n%s"" "" {"" SIZE_T_FMT ""+}\r\n%s\r\n"", tag, cmd, strlen(namespace), namespace, strlen(name), name); } else { prot_printf(backend_inbox->out, ""%s %s {"" SIZE_T_FMT ""+}\r\n%s\r\n"", tag, cmd, strlen(name), name); } pipe_including_tag(backend_inbox, tag, 0); } else { prot_printf(imapd_out, ""%s NO %s\r\n"", tag, error_message(r)); } return; } /* local INBOX */ if (namespace) lcase(namespace); if (!namespace || !strcmp(namespace, ""mailbox"")) { size_t len = strlen(name); if (force && imapd_namespace.isalt && (((len == strlen(imapd_namespace.prefix[NAMESPACE_USER]) - 1) && !strncmp(name, imapd_namespace.prefix[NAMESPACE_USER], len)) || ((len == strlen(imapd_namespace.prefix[NAMESPACE_SHARED]) - 1) && !strncmp(name, imapd_namespace.prefix[NAMESPACE_SHARED], len)))) { r = 0; } else { char *intname = mboxname_from_external(name, &imapd_namespace, imapd_userid); r = mboxlist_changesub(intname, imapd_userid, imapd_authstate, add, force, 1); free(intname); } } else if (!strcmp(namespace, ""bboard"")) { r = add ? IMAP_MAILBOX_NONEXISTENT : 0; } else { prot_printf(imapd_out, ""%s BAD Invalid %s subcommand\r\n"", tag, cmd); return; } imapd_check(NULL, 0); if (r) { prot_printf(imapd_out, ""%s NO %s: %s\r\n"", tag, cmd, error_message(r)); } else { prot_printf(imapd_out, ""%s OK %s\r\n"", tag, error_message(IMAP_OK_COMPLETED)); } } ",0 "int MACH0_(is_pie)(struct MACH0_(obj_t)* bin) { return (bin && bin->hdr.filetype == MH_EXECUTE && bin->hdr.flags & MH_PIE); } ",0 "void Browser::OpenCurrentURL() { UserMetrics::RecordAction(UserMetricsAction(""LoadURL""), profile_); LocationBar* location_bar = window_->GetLocationBar(); if (!location_bar) return; WindowOpenDisposition open_disposition = location_bar->GetWindowOpenDisposition(); if (OpenInstant(open_disposition)) return; GURL url(WideToUTF8(location_bar->GetInputString())); if (open_disposition == CURRENT_TAB && TabFinder::IsEnabled()) { Browser* existing_browser = NULL; TabContents* existing_tab = TabFinder::GetInstance()->FindTab( this, url, &existing_browser); if (existing_tab) { existing_browser->ActivateContents(existing_tab); return; } } browser::NavigateParams params(this, url, location_bar->GetPageTransition()); params.disposition = open_disposition; params.tabstrip_add_types = TabStripModel::ADD_FORCE_INDEX | TabStripModel::ADD_INHERIT_OPENER; browser::Navigate(¶ms); DCHECK(profile_->GetExtensionService()); if (profile_->GetExtensionService()->IsInstalledApp(url)) { UMA_HISTOGRAM_ENUMERATION(extension_misc::kAppLaunchHistogram, extension_misc::APP_LAUNCH_OMNIBOX_LOCATION, extension_misc::APP_LAUNCH_BUCKET_BOUNDARY); } } ",0 "static void add_timer_randomness(struct timer_rand_state *state, unsigned num) { struct { cycles_t cycles; long jiffies; unsigned num; } sample; long delta, delta2, delta3; preempt_disable(); /* if over the trickle threshold, use only 1 in 4096 samples */ if (input_pool.entropy_count > trickle_thresh && ((__this_cpu_inc_return(trickle_count) - 1) & 0xfff)) goto out; sample.jiffies = jiffies; sample.cycles = get_cycles(); sample.num = num; mix_pool_bytes(&input_pool, &sample, sizeof(sample)); /* * Calculate number of bits of randomness we probably added. * We take into account the first, second and third-order deltas * in order to make our estimate. */ if (!state->dont_count_entropy) { delta = sample.jiffies - state->last_time; state->last_time = sample.jiffies; delta2 = delta - state->last_delta; state->last_delta = delta; delta3 = delta2 - state->last_delta2; state->last_delta2 = delta2; if (delta < 0) delta = -delta; if (delta2 < 0) delta2 = -delta2; if (delta3 < 0) delta3 = -delta3; if (delta > delta2) delta = delta2; if (delta > delta3) delta = delta3; /* * delta is now minimum absolute delta. * Round down by 1 bit on general principles, * and limit entropy entimate to 12 bits. */ credit_entropy_bits(&input_pool, min_t(int, fls(delta>>1), 11)); } out: preempt_enable(); } ",0 "static void iucv_process_message_q(struct sock *sk) { struct iucv_sock *iucv = iucv_sk(sk); struct sk_buff *skb; struct sock_msg_q *p, *n; list_for_each_entry_safe(p, n, &iucv->message_q.list, list) { skb = alloc_skb(iucv_msg_length(&p->msg), GFP_ATOMIC | GFP_DMA); if (!skb) break; iucv_process_message(sk, skb, p->path, &p->msg); list_del(&p->list); kfree(p); if (!skb_queue_empty(&iucv->backlog_skb_q)) break; } } ",0 "bool Extension::ParsePermissions(const char* key, string16* error, APIPermissionSet* api_permissions, URLPatternSet* host_permissions) { if (manifest_->HasKey(key)) { ListValue* permissions = NULL; if (!manifest_->GetList(key, &permissions)) { *error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidPermissions, """"); return false; } std::vector host_data; if (!APIPermissionSet::ParseFromJSON(permissions, api_permissions, error, &host_data)) return false; std::vector to_remove; FeatureProvider* permission_features = BaseFeatureProvider::GetPermissionFeatures(); for (APIPermissionSet::const_iterator it = api_permissions->begin(); it != api_permissions->end(); ++it) { extensions::Feature* feature = permission_features->GetFeature(it->name()); CHECK(feature); Feature::Availability availability = feature->IsAvailableToManifest( id(), GetType(), Feature::ConvertLocation(location()), manifest_version()); if (!availability.is_available()) { install_warnings_.push_back(InstallWarning(InstallWarning::FORMAT_TEXT, availability.message())); to_remove.push_back(it->id()); continue; } if (it->id() == APIPermission::kExperimental) { if (!CanSpecifyExperimentalPermission()) { *error = ASCIIToUTF16(errors::kExperimentalFlagRequired); return false; } } } for (std::vector::const_iterator it = to_remove.begin(); it != to_remove.end(); ++it) { api_permissions->erase(*it); } const int kAllowedSchemes = CanExecuteScriptEverywhere() ? URLPattern::SCHEME_ALL : kValidHostPermissionSchemes; for (std::vector::const_iterator it = host_data.begin(); it != host_data.end(); ++it) { const std::string& permission_str = *it; URLPattern pattern = URLPattern(kAllowedSchemes); URLPattern::ParseResult parse_result = pattern.Parse(permission_str); if (parse_result == URLPattern::PARSE_SUCCESS) { if (!CanSpecifyHostPermission(pattern, *api_permissions)) { *error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidPermissionScheme, permission_str); return false; } pattern.SetPath(""/*""); if (pattern.MatchesScheme(chrome::kFileScheme) && !CanExecuteScriptEverywhere()) { wants_file_access_ = true; if (!(creation_flags_ & ALLOW_FILE_ACCESS)) { pattern.SetValidSchemes( pattern.valid_schemes() & ~URLPattern::SCHEME_FILE); } } host_permissions->AddPattern(pattern); continue; } install_warnings_.push_back(InstallWarning( InstallWarning::FORMAT_TEXT, base::StringPrintf( ""Permission '%s' is unknown or URL pattern is malformed."", permission_str.c_str()))); } } return true; } ",0 "static void setup_msrs(struct vcpu_vmx *vmx) { int save_nmsrs, index; save_nmsrs = 0; #ifdef CONFIG_X86_64 if (is_long_mode(&vmx->vcpu)) { index = __find_msr_index(vmx, MSR_SYSCALL_MASK); if (index >= 0) move_msr_up(vmx, index, save_nmsrs++); index = __find_msr_index(vmx, MSR_LSTAR); if (index >= 0) move_msr_up(vmx, index, save_nmsrs++); index = __find_msr_index(vmx, MSR_CSTAR); if (index >= 0) move_msr_up(vmx, index, save_nmsrs++); index = __find_msr_index(vmx, MSR_TSC_AUX); if (index >= 0 && guest_cpuid_has(&vmx->vcpu, X86_FEATURE_RDTSCP)) move_msr_up(vmx, index, save_nmsrs++); /* * MSR_STAR is only needed on long mode guests, and only * if efer.sce is enabled. */ index = __find_msr_index(vmx, MSR_STAR); if ((index >= 0) && (vmx->vcpu.arch.efer & EFER_SCE)) move_msr_up(vmx, index, save_nmsrs++); } #endif index = __find_msr_index(vmx, MSR_EFER); if (index >= 0 && update_transition_efer(vmx, index)) move_msr_up(vmx, index, save_nmsrs++); vmx->save_nmsrs = save_nmsrs; if (cpu_has_vmx_msr_bitmap()) vmx_set_msr_bitmap(&vmx->vcpu); } ",0 "MagickExport MagickBooleanType SetImageProperty(Image *image, const char *property,const char *value,ExceptionInfo *exception) { MagickBooleanType status; MagickStatusType flags; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if (image->properties == (void *) NULL) image->properties=NewSplayTree(CompareSplayTreeString, RelinquishMagickMemory,RelinquishMagickMemory); /* create splay-tree */ if (value == (const char *) NULL) return(DeleteImageProperty(image,property)); /* delete if NULL */ status=MagickTrue; if (strlen(property) <= 1) { /* Do not 'set' single letter properties - read only shorthand. */ (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } /* FUTURE: binary chars or quotes in key should produce a error */ /* Set attributes with known names or special prefixes return result is found, or break to set a free form properity */ switch (*property) { #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case '8': { if (LocaleNCompare(""8bim:"",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; } #endif case 'B': case 'b': { if (LocaleCompare(""background"",property) == 0) { (void) QueryColorCompliance(value,AllCompliance, &image->background_color,exception); /* check for FUTURE: value exception?? */ /* also add user input to splay tree */ } break; /* not an attribute, add as a property */ } case 'C': case 'c': { if (LocaleCompare(""channels"",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } if (LocaleCompare(""colorspace"",property) == 0) { ssize_t colorspace; colorspace=ParseCommandOption(MagickColorspaceOptions,MagickFalse, value); if (colorspace < 0) return(MagickFalse); /* FUTURE: value exception?? */ return(SetImageColorspace(image,(ColorspaceType) colorspace,exception)); } if (LocaleCompare(""compose"",property) == 0) { ssize_t compose; compose=ParseCommandOption(MagickComposeOptions,MagickFalse,value); if (compose < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->compose=(CompositeOperator) compose; return(MagickTrue); } if (LocaleCompare(""compress"",property) == 0) { ssize_t compression; compression=ParseCommandOption(MagickCompressOptions,MagickFalse, value); if (compression < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->compression=(CompressionType) compression; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'D': case 'd': { if (LocaleCompare(""delay"",property) == 0) { GeometryInfo geometry_info; flags=ParseGeometry(value,&geometry_info); if ((flags & GreaterValue) != 0) { if (image->delay > (size_t) floor(geometry_info.rho+0.5)) image->delay=(size_t) floor(geometry_info.rho+0.5); } else if ((flags & LessValue) != 0) { if (image->delay < (size_t) floor(geometry_info.rho+0.5)) image->delay=(ssize_t) floor(geometry_info.sigma+0.5); } else image->delay=(size_t) floor(geometry_info.rho+0.5); if ((flags & SigmaValue) != 0) image->ticks_per_second=(ssize_t) floor(geometry_info.sigma+0.5); return(MagickTrue); } if (LocaleCompare(""delay_units"",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } if (LocaleCompare(""density"",property) == 0) { GeometryInfo geometry_info; flags=ParseGeometry(value,&geometry_info); image->resolution.x=geometry_info.rho; image->resolution.y=geometry_info.sigma; if ((flags & SigmaValue) == 0) image->resolution.y=image->resolution.x; return(MagickTrue); } if (LocaleCompare(""depth"",property) == 0) { image->depth=StringToUnsignedLong(value); return(MagickTrue); } if (LocaleCompare(""dispose"",property) == 0) { ssize_t dispose; dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,value); if (dispose < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->dispose=(DisposeType) dispose; return(MagickTrue); } break; /* not an attribute, add as a property */ } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case 'E': case 'e': { if (LocaleNCompare(""exif:"",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'F': case 'f': { if (LocaleNCompare(""fx:"",property,3) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #endif case 'G': case 'g': { if (LocaleCompare(""gamma"",property) == 0) { image->gamma=StringToDouble(value,(char **) NULL); return(MagickTrue); } if (LocaleCompare(""gravity"",property) == 0) { ssize_t gravity; gravity=ParseCommandOption(MagickGravityOptions,MagickFalse,value); if (gravity < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->gravity=(GravityType) gravity; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'H': case 'h': { if (LocaleCompare(""height"",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'I': case 'i': { if (LocaleCompare(""intensity"",property) == 0) { ssize_t intensity; intensity=ParseCommandOption(MagickIntentOptions,MagickFalse,value); if (intensity < 0) return(MagickFalse); image->intensity=(PixelIntensityMethod) intensity; return(MagickTrue); } if (LocaleCompare(""intent"",property) == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse, value); if (rendering_intent < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->rendering_intent=(RenderingIntent) rendering_intent; return(MagickTrue); } if (LocaleCompare(""interpolate"",property) == 0) { ssize_t interpolate; interpolate=ParseCommandOption(MagickInterpolateOptions,MagickFalse, value); if (interpolate < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->interpolate=(PixelInterpolateMethod) interpolate; return(MagickTrue); } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ if (LocaleNCompare(""iptc:"",property,5) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } #endif break; /* not an attribute, add as a property */ } case 'K': case 'k': if (LocaleCompare(""kurtosis"",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'L': case 'l': { if (LocaleCompare(""loop"",property) == 0) { image->iterations=StringToUnsignedLong(value); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'M': case 'm': if ((LocaleCompare(""magick"",property) == 0) || (LocaleCompare(""max"",property) == 0) || (LocaleCompare(""mean"",property) == 0) || (LocaleCompare(""min"",property) == 0) || (LocaleCompare(""min"",property) == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'O': case 'o': if (LocaleCompare(""opaque"",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'P': case 'p': { if (LocaleCompare(""page"",property) == 0) { char *geometry; geometry=GetPageGeometry(value); flags=ParseAbsoluteGeometry(geometry,&image->page); geometry=DestroyString(geometry); return(MagickTrue); } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ if (LocaleNCompare(""pixel:"",property,6) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } #endif if (LocaleCompare(""profile"",property) == 0) { ImageInfo *image_info; StringInfo *profile; image_info=AcquireImageInfo(); (void) CopyMagickString(image_info->filename,value,MagickPathExtent); (void) SetImageInfo(image_info,1,exception); profile=FileToStringInfo(image_info->filename,~0UL,exception); if (profile != (StringInfo *) NULL) status=SetImageProfile(image,image_info->magick,profile,exception); image_info=DestroyImageInfo(image_info); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'R': case 'r': { if (LocaleCompare(""rendering-intent"",property) == 0) { ssize_t rendering_intent; rendering_intent=ParseCommandOption(MagickIntentOptions,MagickFalse, value); if (rendering_intent < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->rendering_intent=(RenderingIntent) rendering_intent; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'S': case 's': if ((LocaleCompare(""size"",property) == 0) || (LocaleCompare(""skewness"",property) == 0) || (LocaleCompare(""scenes"",property) == 0) || (LocaleCompare(""standard-deviation"",property) == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ case 'T': case 't': { if (LocaleCompare(""tile-offset"",property) == 0) { char *geometry; geometry=GetPageGeometry(value); flags=ParseAbsoluteGeometry(geometry,&image->tile_offset); geometry=DestroyString(geometry); return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'U': case 'u': { if (LocaleCompare(""units"",property) == 0) { ssize_t units; units=ParseCommandOption(MagickResolutionOptions,MagickFalse,value); if (units < 0) return(MagickFalse); /* FUTURE: value exception?? */ image->units=(ResolutionType) units; return(MagickTrue); } break; /* not an attribute, add as a property */ } case 'V': case 'v': { if (LocaleCompare(""version"",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } case 'W': case 'w': { if (LocaleCompare(""width"",property) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #if 0 /* Percent escape's sets values with this prefix: for later use Throwing an exception causes this setting to fail */ case 'X': case 'x': { if (LocaleNCompare(""xmp:"",property,4) == 0) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""SetReadOnlyProperty"",""`%s'"",property); return(MagickFalse); } break; /* not an attribute, add as a property */ } #endif } /* Default: not an attribute, add as a property */ status=AddValueToSplayTree((SplayTreeInfo *) image->properties, ConstantString(property),ConstantString(value)); /* FUTURE: error if status is bad? */ return(status); } ",1 "emnc10_opaque_binary_attr(tvbuff_t *tvb, guint32 offset, guint8 token, guint8 codepage, guint32 *length) { guint32 data_len = tvb_get_guintvar(tvb, offset, length); char *str = NULL; switch (codepage) { case 0: /* Only valid codepage for EMN */ switch (token) { case 0x05: /* timestamp= */ str = date_time_from_opaque(tvb, offset + *length, data_len); break; default: break; } break; default: break; } if (str == NULL) { /* Error, or not parsed */ str = wmem_strdup_printf(wmem_packet_scope(), ""(%d bytes of unparsed opaque data)"", data_len); } *length += data_len; return str; } ",0 "int get_files_in_directory(const char *path, char ***list) { _cleanup_closedir_ DIR *d = NULL; size_t bufsize = 0, n = 0; _cleanup_strv_free_ char **l = NULL; assert(path); /* Returns all files in a directory in *list, and the number * of files as return value. If list is NULL returns only the * number. */ d = opendir(path); if (!d) return -errno; for (;;) { struct dirent *de; errno = 0; de = readdir(d); if (!de && errno > 0) return -errno; if (!de) break; dirent_ensure_type(d, de); if (!dirent_is_file(de)) continue; if (list) { /* one extra slot is needed for the terminating NULL */ if (!GREEDY_REALLOC(l, bufsize, n + 2)) return -ENOMEM; l[n] = strdup(de->d_name); if (!l[n]) return -ENOMEM; l[++n] = NULL; } else n++; } if (list) { *list = l; l = NULL; /* avoid freeing */ } return n; } ",0 "static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) { __be32 *p; int status = 0; *res = 0; if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_AVAIL - 1U))) return -EIO; if (likely(bitmap[1] & FATTR4_WORD1_SPACE_AVAIL)) { READ_BUF(8); READ64(*res); bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; } dprintk(""%s: space avail=%Lu\n"", __func__, (unsigned long long)*res); return status; } ",0 "void HTMLMediaElement::StartPlayerLoad() { DCHECK(!web_media_player_); WebMediaPlayerSource source; if (src_object_) { source = WebMediaPlayerSource(WebMediaStream(src_object_)); } else { KURL request_url = current_src_; if (!request_url.User().IsEmpty()) request_url.SetUser(String()); if (!request_url.Pass().IsEmpty()) request_url.SetPass(String()); KURL kurl(request_url); source = WebMediaPlayerSource(WebURL(kurl)); } LocalFrame* frame = GetDocument().GetFrame(); if (!frame) { MediaLoadingFailed( WebMediaPlayer::kNetworkStateFormatError, BuildElementErrorMessage(""Player load failure: document has no frame"")); return; } web_media_player_ = frame->Client()->CreateWebMediaPlayer( *this, source, this, frame->GetPage()->GetChromeClient().GetWebLayerTreeView(frame)); if (!web_media_player_) { MediaLoadingFailed(WebMediaPlayer::kNetworkStateFormatError, BuildElementErrorMessage( ""Player load failure: error creating media player"")); return; } if (GetLayoutObject()) GetLayoutObject()->SetShouldDoFullPaintInvalidation(); audio_source_provider_.Wrap(web_media_player_->GetAudioSourceProvider()); web_media_player_->SetVolume(EffectiveMediaVolume()); web_media_player_->SetPoster(PosterImageURL()); web_media_player_->SetPreload(EffectivePreloadType()); web_media_player_->RequestRemotePlaybackDisabled( FastHasAttribute(disableremoteplaybackAttr)); web_media_player_->Load(GetLoadType(), source, CorsMode()); if (IsFullscreen()) web_media_player_->EnteredFullscreen(); web_media_player_->BecameDominantVisibleContent(mostly_filling_viewport_); } ",0 "int Center(int size, int item_size) { int extra_space = size - item_size; if (extra_space > 0) ++extra_space; return extra_space / 2; } ",0 "static __be32 *xdr_check_reply_chunk(__be32 *p, __be32 *end) { __be32 *next; if (*p++ != xdr_zero) { next = p + 1 + be32_to_cpup(p) * rpcrdma_segment_maxsz; if (next > end) return NULL; p = next; } return p; } ",0 "ops_expand(regex_t* reg, int n) { #define MIN_OPS_EXPAND_SIZE 4 #ifdef USE_DIRECT_THREADED_CODE enum OpCode* cp; #endif Operation* p; size_t size; if (n <= 0) n = MIN_OPS_EXPAND_SIZE; n += reg->ops_alloc; size = sizeof(Operation) * n; p = (Operation* )xrealloc(reg->ops, size); CHECK_NULL_RETURN_MEMERR(p); #ifdef USE_DIRECT_THREADED_CODE size = sizeof(enum OpCode) * n; cp = (enum OpCode* )xrealloc(reg->ocs, size); CHECK_NULL_RETURN_MEMERR(cp); reg->ocs = cp; #endif reg->ops = p; reg->ops_alloc = n; if (reg->ops_used == 0) reg->ops_curr = 0; else reg->ops_curr = reg->ops + (reg->ops_used - 1); return ONIG_NORMAL; } ",0 "void DrawArrow(gfx::Canvas* canvas, int tip_x, const SkColor& fill_color, const SkColor& stroke_color) { const int arrow_half_width = kArrowWidth / 2.0f; SkPath arrow; arrow.moveTo(tip_x - arrow_half_width, kArrowHeight); arrow.lineTo(tip_x, 0); arrow.lineTo(tip_x + arrow_half_width, kArrowHeight); SkPaint fill_paint; fill_paint.setColor(fill_color); canvas->DrawPath(arrow, fill_paint); if (stroke_color != SK_ColorTRANSPARENT) { SkPaint stroke_paint; stroke_paint.setColor(stroke_color); stroke_paint.setStyle(SkPaint::kStroke_Style); canvas->DrawPath(arrow, stroke_paint); } } ",0 " int startLoadingCount() const { return m_startLoadingCount; } ",0 "void red_channel_client_pipe_add_push(RedChannelClient *rcc, PipeItem *item) { red_channel_client_pipe_add(rcc, item); red_channel_client_push(rcc); } ",0 "static void __save_error_info(struct super_block *sb, const char *func, unsigned int line) { struct ext4_super_block *es = EXT4_SB(sb)->s_es; EXT4_SB(sb)->s_mount_state |= EXT4_ERROR_FS; es->s_state |= cpu_to_le16(EXT4_ERROR_FS); es->s_last_error_time = cpu_to_le32(get_seconds()); strncpy(es->s_last_error_func, func, sizeof(es->s_last_error_func)); es->s_last_error_line = cpu_to_le32(line); if (!es->s_first_error_time) { es->s_first_error_time = es->s_last_error_time; strncpy(es->s_first_error_func, func, sizeof(es->s_first_error_func)); es->s_first_error_line = cpu_to_le32(line); es->s_first_error_ino = es->s_last_error_ino; es->s_first_error_block = es->s_last_error_block; } /* * Start the daily error reporting function if it hasn't been * started already */ if (!es->s_error_count) mod_timer(&EXT4_SB(sb)->s_err_report, jiffies + 24*60*60*HZ); es->s_error_count = cpu_to_le32(le32_to_cpu(es->s_error_count) + 1); } ",0 "newkeys_to_blob(struct sshbuf *m, struct ssh *ssh, int mode) { struct sshbuf *b; struct sshcipher_ctx *cc; struct sshcomp *comp; struct sshenc *enc; struct sshmac *mac; struct newkeys *newkey; int r; if ((newkey = ssh->state->newkeys[mode]) == NULL) return SSH_ERR_INTERNAL_ERROR; enc = &newkey->enc; mac = &newkey->mac; comp = &newkey->comp; cc = (mode == MODE_OUT) ? &ssh->state->send_context : &ssh->state->receive_context; if ((r = cipher_get_keyiv(cc, enc->iv, enc->iv_len)) != 0) return r; if ((b = sshbuf_new()) == NULL) return SSH_ERR_ALLOC_FAIL; /* The cipher struct is constant and shared, you export pointer */ if ((r = sshbuf_put_cstring(b, enc->name)) != 0 || (r = sshbuf_put(b, &enc->cipher, sizeof(enc->cipher))) != 0 || (r = sshbuf_put_u32(b, enc->enabled)) != 0 || (r = sshbuf_put_u32(b, enc->block_size)) != 0 || (r = sshbuf_put_string(b, enc->key, enc->key_len)) != 0 || (r = sshbuf_put_string(b, enc->iv, enc->iv_len)) != 0) goto out; if (cipher_authlen(enc->cipher) == 0) { if ((r = sshbuf_put_cstring(b, mac->name)) != 0 || (r = sshbuf_put_u32(b, mac->enabled)) != 0 || (r = sshbuf_put_string(b, mac->key, mac->key_len)) != 0) goto out; } if ((r = sshbuf_put_u32(b, comp->type)) != 0 || (r = sshbuf_put_u32(b, comp->enabled)) != 0 || (r = sshbuf_put_cstring(b, comp->name)) != 0) goto out; r = sshbuf_put_stringb(m, b); out: if (b != NULL) sshbuf_free(b); return r; } ",0 "ScriptPromise ServiceWorkerContainer::ready(ScriptState* callerState) { if (!getExecutionContext()) return ScriptPromise(); if (!callerState->world().isMainWorld()) { return ScriptPromise::rejectWithDOMException(callerState, DOMException::create(NotSupportedError, ""'ready' is only supported in pages."")); } if (!m_ready) { m_ready = createReadyProperty(); if (m_provider) m_provider->getRegistrationForReady(new GetRegistrationForReadyCallback(m_ready.get())); } return m_ready->promise(callerState->world()); } ",0 " TestCase& EnableDriveFs() { enable_drivefs.emplace(true); return *this; } ",0 "static void hugetlbfs_i_callback(struct rcu_head *head) { struct inode *inode = container_of(head, struct inode, i_rcu); kmem_cache_free(hugetlbfs_inode_cachep, HUGETLBFS_I(inode)); } ",0 "int ip_mc_leave_group(struct sock *sk, struct ip_mreqn *imr) { struct inet_sock *inet = inet_sk(sk); struct ip_mc_socklist *iml; struct ip_mc_socklist __rcu **imlp; struct in_device *in_dev; struct net *net = sock_net(sk); __be32 group = imr->imr_multiaddr.s_addr; u32 ifindex; int ret = -EADDRNOTAVAIL; rtnl_lock(); in_dev = ip_mc_find_dev(net, imr); ifindex = imr->imr_ifindex; for (imlp = &inet->mc_list; (iml = rtnl_dereference(*imlp)) != NULL; imlp = &iml->next_rcu) { if (iml->multi.imr_multiaddr.s_addr != group) continue; if (ifindex) { if (iml->multi.imr_ifindex != ifindex) continue; } else if (imr->imr_address.s_addr && imr->imr_address.s_addr != iml->multi.imr_address.s_addr) continue; (void) ip_mc_leave_src(sk, iml, in_dev); *imlp = iml->next_rcu; if (in_dev) ip_mc_dec_group(in_dev, group); rtnl_unlock(); /* decrease mem now to avoid the memleak warning */ atomic_sub(sizeof(*iml), &sk->sk_omem_alloc); kfree_rcu(iml, rcu); return 0; } if (!in_dev) ret = -ENODEV; rtnl_unlock(); return ret; } ",0 "load_ucode_intel_bsp(void) { u64 ramdisk_image, ramdisk_size; unsigned long initrd_start_early, initrd_end_early; struct ucode_cpu_info uci; #ifdef CONFIG_X86_32 struct boot_params *boot_params_p; boot_params_p = (struct boot_params *)__pa_nodebug(&boot_params); ramdisk_image = boot_params_p->hdr.ramdisk_image; ramdisk_size = boot_params_p->hdr.ramdisk_size; initrd_start_early = ramdisk_image; initrd_end_early = initrd_start_early + ramdisk_size; _load_ucode_intel_bsp( (struct mc_saved_data *)__pa_nodebug(&mc_saved_data), (unsigned long *)__pa_nodebug(&mc_saved_in_initrd), initrd_start_early, initrd_end_early, &uci); #else ramdisk_image = boot_params.hdr.ramdisk_image; ramdisk_size = boot_params.hdr.ramdisk_size; initrd_start_early = ramdisk_image + PAGE_OFFSET; initrd_end_early = initrd_start_early + ramdisk_size; _load_ucode_intel_bsp(&mc_saved_data, mc_saved_in_initrd, initrd_start_early, initrd_end_early, &uci); #endif } ",0 "static int inet6_addr_del(struct net *net, int ifindex, u32 ifa_flags, const struct in6_addr *pfx, unsigned int plen) { struct inet6_ifaddr *ifp; struct inet6_dev *idev; struct net_device *dev; if (plen > 128) return -EINVAL; dev = __dev_get_by_index(net, ifindex); if (!dev) return -ENODEV; idev = __in6_dev_get(dev); if (idev == NULL) return -ENXIO; read_lock_bh(&idev->lock); list_for_each_entry(ifp, &idev->addr_list, if_list) { if (ifp->prefix_len == plen && ipv6_addr_equal(pfx, &ifp->addr)) { in6_ifa_hold(ifp); read_unlock_bh(&idev->lock); if (!(ifp->flags & IFA_F_TEMPORARY) && (ifa_flags & IFA_F_MANAGETEMPADDR)) manage_tempaddrs(idev, ifp, 0, 0, false, jiffies); ipv6_del_addr(ifp); addrconf_verify_rtnl(); return 0; } } read_unlock_bh(&idev->lock); return -EADDRNOTAVAIL; } ",0 "GapRects RenderBlock::selectionGapRectsForRepaint(const RenderLayerModelObject* repaintContainer) { ASSERT(!needsLayout()); if (!shouldPaintSelectionGaps()) return GapRects(); TransformState transformState(TransformState::ApplyTransformDirection, FloatPoint()); mapLocalToContainer(repaintContainer, transformState, ApplyContainerFlip | UseTransforms); LayoutPoint offsetFromRepaintContainer = roundedLayoutPoint(transformState.mappedPoint()); if (hasOverflowClip()) offsetFromRepaintContainer -= scrolledContentOffset(); LayoutUnit lastTop = 0; LayoutUnit lastLeft = logicalLeftSelectionOffset(this, lastTop); LayoutUnit lastRight = logicalRightSelectionOffset(this, lastTop); return selectionGaps(this, offsetFromRepaintContainer, IntSize(), lastTop, lastLeft, lastRight); } ",0 "UNCURL_EXPORT void uncurl_set_option(struct uncurl_conn *ucc, int32_t opt, int32_t val) { switch (opt) { case UNCURL_OPT_MAX_HEADER: ucc->opts.max_header = (uint32_t) val; break; case UNCURL_OPT_MAX_BODY: ucc->opts.max_body = (uint32_t) val; break; case UNCURL_NOPT_READ_TIMEOUT: ucc->nopts.read_timeout = val; break; case UNCURL_NOPT_CONNECT_TIMEOUT: ucc->nopts.connect_timeout = val; break; case UNCURL_NOPT_ACCEPT_TIMEOUT: ucc->nopts.accept_timeout = val; break; case UNCURL_NOPT_READ_BUF: ucc->nopts.read_buf = val; break; case UNCURL_NOPT_WRITE_BUF: ucc->nopts.write_buf = val; break; case UNCURL_NOPT_KEEPALIVE: ucc->nopts.keepalive = val; break; case UNCURL_NOPT_TCP_NODELAY: ucc->nopts.tcp_nodelay = val; break; case UNCURL_NOPT_REUSEADDR: ucc->nopts.reuseaddr = val; break; case UNCURL_TOPT_VERIFY_HOST: ucc->topts.verify_host = val; break; } } ",0 "static bool uas_evaluate_response_iu(struct response_iu *riu, struct scsi_cmnd *cmnd) { u8 response_code = riu->response_code; switch (response_code) { case RC_INCORRECT_LUN: cmnd->result = DID_BAD_TARGET << 16; break; case RC_TMF_SUCCEEDED: cmnd->result = DID_OK << 16; break; case RC_TMF_NOT_SUPPORTED: cmnd->result = DID_TARGET_FAILURE << 16; break; default: uas_log_cmd_state(cmnd, ""response iu"", response_code); cmnd->result = DID_ERROR << 16; break; } return response_code == RC_TMF_SUCCEEDED; } ",0 "static int mailimf_date_parse(const char * message, size_t length, size_t * indx, int * pday, int * pmonth, int * pyear) { size_t cur_token; int day; int month; int year; int r; cur_token = * indx; day = 1; r = mailimf_day_parse(message, length, &cur_token, &day); if (r != MAILIMF_NO_ERROR) return r; month = 1; r = mailimf_month_parse(message, length, &cur_token, &month); if (r != MAILIMF_NO_ERROR) return r; year = 2001; r = mailimf_year_parse(message, length, &cur_token, &year); if (r != MAILIMF_NO_ERROR) return r; * pday = day; * pmonth = month; * pyear = year; * indx = cur_token; return MAILIMF_NO_ERROR; } ",0 "xsltNewCompMatch(void) { xsltCompMatchPtr cur; cur = (xsltCompMatchPtr) xmlMalloc(sizeof(xsltCompMatch)); if (cur == NULL) { xsltTransformError(NULL, NULL, NULL, ""xsltNewCompMatch : out of memory error\n""); return(NULL); } memset(cur, 0, sizeof(xsltCompMatch)); cur->maxStep = 10; cur->nbStep = 0; cur-> steps = (xsltStepOpPtr) xmlMalloc(sizeof(xsltStepOp) * cur->maxStep); if (cur->steps == NULL) { xsltTransformError(NULL, NULL, NULL, ""xsltNewCompMatch : out of memory error\n""); xmlFree(cur); return(NULL); } cur->nsNr = 0; cur->nsList = NULL; cur->direct = 0; return(cur); } ",0 "mget(struct magic_set *ms, const unsigned char *s, struct magic *m, size_t nbytes, size_t o, unsigned int cont_level, int mode, int text, int flip, int recursion_level, int *printed_something, int *need_separator, int *returnval) { uint32_t soffset, offset = ms->offset; uint32_t lhs; int rv, oneed_separator, in_type; char *sbuf, *rbuf; union VALUETYPE *p = &ms->ms_value; struct mlist ml; if (recursion_level >= 20) { file_error(ms, 0, ""recursion nesting exceeded""); return -1; } if (mcopy(ms, p, m->type, m->flag & INDIR, s, (uint32_t)(offset + o), (uint32_t)nbytes, m) == -1) return -1; if ((ms->flags & MAGIC_DEBUG) != 0) { fprintf(stderr, ""mget(type=%d, flag=%x, offset=%u, o=%zu, "" ""nbytes=%zu)\n"", m->type, m->flag, offset, o, nbytes); mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE)); #ifndef COMPILE_ONLY file_mdump(m); #endif } if (m->flag & INDIR) { int off = m->in_offset; if (m->in_op & FILE_OPINDIRECT) { const union VALUETYPE *q = CAST(const union VALUETYPE *, ((const void *)(s + offset + off))); switch (cvt_flip(m->in_type, flip)) { case FILE_BYTE: off = q->b; break; case FILE_SHORT: off = q->h; break; case FILE_BESHORT: off = (short)((q->hs[0]<<8)|(q->hs[1])); break; case FILE_LESHORT: off = (short)((q->hs[1]<<8)|(q->hs[0])); break; case FILE_LONG: off = q->l; break; case FILE_BELONG: case FILE_BEID3: off = (int32_t)((q->hl[0]<<24)|(q->hl[1]<<16)| (q->hl[2]<<8)|(q->hl[3])); break; case FILE_LEID3: case FILE_LELONG: off = (int32_t)((q->hl[3]<<24)|(q->hl[2]<<16)| (q->hl[1]<<8)|(q->hl[0])); break; case FILE_MELONG: off = (int32_t)((q->hl[1]<<24)|(q->hl[0]<<16)| (q->hl[3]<<8)|(q->hl[2])); break; } if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, ""indirect offs=%u\n"", off); } switch (in_type = cvt_flip(m->in_type, flip)) { case FILE_BYTE: if (OFFSET_OOB(nbytes, offset, 1)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = p->b & off; break; case FILE_OPOR: offset = p->b | off; break; case FILE_OPXOR: offset = p->b ^ off; break; case FILE_OPADD: offset = p->b + off; break; case FILE_OPMINUS: offset = p->b - off; break; case FILE_OPMULTIPLY: offset = p->b * off; break; case FILE_OPDIVIDE: offset = p->b / off; break; case FILE_OPMODULO: offset = p->b % off; break; } } else offset = p->b; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_BESHORT: if (OFFSET_OOB(nbytes, offset, 2)) return 0; lhs = (p->hs[0] << 8) | p->hs[1]; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = lhs & off; break; case FILE_OPOR: offset = lhs | off; break; case FILE_OPXOR: offset = lhs ^ off; break; case FILE_OPADD: offset = lhs + off; break; case FILE_OPMINUS: offset = lhs - off; break; case FILE_OPMULTIPLY: offset = lhs * off; break; case FILE_OPDIVIDE: offset = lhs / off; break; case FILE_OPMODULO: offset = lhs % off; break; } } else offset = lhs; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LESHORT: if (OFFSET_OOB(nbytes, offset, 2)) return 0; lhs = (p->hs[1] << 8) | p->hs[0]; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = lhs & off; break; case FILE_OPOR: offset = lhs | off; break; case FILE_OPXOR: offset = lhs ^ off; break; case FILE_OPADD: offset = lhs + off; break; case FILE_OPMINUS: offset = lhs - off; break; case FILE_OPMULTIPLY: offset = lhs * off; break; case FILE_OPDIVIDE: offset = lhs / off; break; case FILE_OPMODULO: offset = lhs % off; break; } } else offset = lhs; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_SHORT: if (OFFSET_OOB(nbytes, offset, 2)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = p->h & off; break; case FILE_OPOR: offset = p->h | off; break; case FILE_OPXOR: offset = p->h ^ off; break; case FILE_OPADD: offset = p->h + off; break; case FILE_OPMINUS: offset = p->h - off; break; case FILE_OPMULTIPLY: offset = p->h * off; break; case FILE_OPDIVIDE: offset = p->h / off; break; case FILE_OPMODULO: offset = p->h % off; break; } } else offset = p->h; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_BELONG: case FILE_BEID3: if (OFFSET_OOB(nbytes, offset, 4)) return 0; lhs = (p->hl[0] << 24) | (p->hl[1] << 16) | (p->hl[2] << 8) | p->hl[3]; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = lhs & off; break; case FILE_OPOR: offset = lhs | off; break; case FILE_OPXOR: offset = lhs ^ off; break; case FILE_OPADD: offset = lhs + off; break; case FILE_OPMINUS: offset = lhs - off; break; case FILE_OPMULTIPLY: offset = lhs * off; break; case FILE_OPDIVIDE: offset = lhs / off; break; case FILE_OPMODULO: offset = lhs % off; break; } } else offset = lhs; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LELONG: case FILE_LEID3: if (OFFSET_OOB(nbytes, offset, 4)) return 0; lhs = (p->hl[3] << 24) | (p->hl[2] << 16) | (p->hl[1] << 8) | p->hl[0]; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = lhs & off; break; case FILE_OPOR: offset = lhs | off; break; case FILE_OPXOR: offset = lhs ^ off; break; case FILE_OPADD: offset = lhs + off; break; case FILE_OPMINUS: offset = lhs - off; break; case FILE_OPMULTIPLY: offset = lhs * off; break; case FILE_OPDIVIDE: offset = lhs / off; break; case FILE_OPMODULO: offset = lhs % off; break; } } else offset = lhs; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_MELONG: if (OFFSET_OOB(nbytes, offset, 4)) return 0; lhs = (p->hl[1] << 24) | (p->hl[0] << 16) | (p->hl[3] << 8) | p->hl[2]; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = lhs & off; break; case FILE_OPOR: offset = lhs | off; break; case FILE_OPXOR: offset = lhs ^ off; break; case FILE_OPADD: offset = lhs + off; break; case FILE_OPMINUS: offset = lhs - off; break; case FILE_OPMULTIPLY: offset = lhs * off; break; case FILE_OPDIVIDE: offset = lhs / off; break; case FILE_OPMODULO: offset = lhs % off; break; } } else offset = lhs; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; case FILE_LONG: if (OFFSET_OOB(nbytes, offset, 4)) return 0; if (off) { switch (m->in_op & FILE_OPS_MASK) { case FILE_OPAND: offset = p->l & off; break; case FILE_OPOR: offset = p->l | off; break; case FILE_OPXOR: offset = p->l ^ off; break; case FILE_OPADD: offset = p->l + off; break; case FILE_OPMINUS: offset = p->l - off; break; case FILE_OPMULTIPLY: offset = p->l * off; break; case FILE_OPDIVIDE: offset = p->l / off; break; case FILE_OPMODULO: offset = p->l % off; break; } } else offset = p->l; if (m->in_op & FILE_OPINVERSE) offset = ~offset; break; default: break; } switch (in_type) { case FILE_LEID3: case FILE_BEID3: offset = ((((offset >> 0) & 0x7f) << 0) | (((offset >> 8) & 0x7f) << 7) | (((offset >> 16) & 0x7f) << 14) | (((offset >> 24) & 0x7f) << 21)) + 10; break; default: break; } if (m->flag & INDIROFFADD) { offset += ms->c.li[cont_level-1].off; if (offset == 0) { if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, ""indirect *zero* offset\n""); return 0; } if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, ""indirect +offs=%u\n"", offset); } if (mcopy(ms, p, m->type, 0, s, offset, nbytes, m) == -1) return -1; ms->offset = offset; if ((ms->flags & MAGIC_DEBUG) != 0) { mdebug(offset, (char *)(void *)p, sizeof(union VALUETYPE)); #ifndef COMPILE_ONLY file_mdump(m); #endif } } /* Verify we have enough data to match magic type */ switch (m->type) { case FILE_BYTE: if (OFFSET_OOB(nbytes, offset, 1)) return 0; break; case FILE_SHORT: case FILE_BESHORT: case FILE_LESHORT: if (OFFSET_OOB(nbytes, offset, 2)) return 0; break; case FILE_LONG: case FILE_BELONG: case FILE_LELONG: case FILE_MELONG: case FILE_DATE: case FILE_BEDATE: case FILE_LEDATE: case FILE_MEDATE: case FILE_LDATE: case FILE_BELDATE: case FILE_LELDATE: case FILE_MELDATE: case FILE_FLOAT: case FILE_BEFLOAT: case FILE_LEFLOAT: if (OFFSET_OOB(nbytes, offset, 4)) return 0; break; case FILE_DOUBLE: case FILE_BEDOUBLE: case FILE_LEDOUBLE: if (OFFSET_OOB(nbytes, offset, 8)) return 0; break; case FILE_STRING: case FILE_PSTRING: case FILE_SEARCH: if (OFFSET_OOB(nbytes, offset, m->vallen)) return 0; break; case FILE_REGEX: if (nbytes < offset) return 0; break; case FILE_INDIRECT: if (offset == 0) return 0; if (nbytes < offset) return 0; sbuf = ms->o.buf; soffset = ms->offset; ms->o.buf = NULL; ms->offset = 0; rv = file_softmagic(ms, s + offset, nbytes - offset, recursion_level, BINTEST, text); if ((ms->flags & MAGIC_DEBUG) != 0) fprintf(stderr, ""indirect @offs=%u[%d]\n"", offset, rv); rbuf = ms->o.buf; ms->o.buf = sbuf; ms->offset = soffset; if (rv == 1) { if ((ms->flags & (MAGIC_MIME|MAGIC_APPLE)) == 0 && file_printf(ms, F(ms, m, ""%u""), offset) == -1) { free(rbuf); return -1; } if (file_printf(ms, ""%s"", rbuf) == -1) { free(rbuf); return -1; } } free(rbuf); return rv; case FILE_USE: if (nbytes < offset) return 0; sbuf = m->value.s; if (*sbuf == '^') { sbuf++; flip = !flip; } if (file_magicfind(ms, sbuf, &ml) == -1) { file_error(ms, 0, ""cannot find entry `%s'"", sbuf); return -1; } oneed_separator = *need_separator; if (m->flag & NOSPACE) *need_separator = 0; rv = match(ms, ml.magic, ml.nmagic, s, nbytes, offset + o, mode, text, flip, recursion_level, printed_something, need_separator, returnval); if (rv != 1) *need_separator = oneed_separator; return rv; case FILE_NAME: if (file_printf(ms, ""%s"", m->desc) == -1) return -1; return 1; case FILE_DEFAULT: /* nothing to check */ case FILE_CLEAR: default: break; } if (!mconvert(ms, m, flip)) return 0; return 1; } ",0 "data_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) { struct sockaddr_mISDN *maddr = (struct sockaddr_mISDN *) addr; struct sock *sk = sock->sk; struct sock *csk; int err = 0; if (*debug & DEBUG_SOCKET) printk(KERN_DEBUG ""%s(%p) sk=%p\n"", __func__, sock, sk); if (addr_len != sizeof(struct sockaddr_mISDN)) return -EINVAL; if (!maddr || maddr->family != AF_ISDN) return -EINVAL; lock_sock(sk); if (_pms(sk)->dev) { err = -EALREADY; goto done; } _pms(sk)->dev = get_mdevice(maddr->dev); if (!_pms(sk)->dev) { err = -ENODEV; goto done; } if (sk->sk_protocol < ISDN_P_B_START) { read_lock_bh(&data_sockets.lock); sk_for_each(csk, &data_sockets.head) { if (sk == csk) continue; if (_pms(csk)->dev != _pms(sk)->dev) continue; if (csk->sk_protocol >= ISDN_P_B_START) continue; if (IS_ISDN_P_TE(csk->sk_protocol) == IS_ISDN_P_TE(sk->sk_protocol)) continue; read_unlock_bh(&data_sockets.lock); err = -EBUSY; goto done; } read_unlock_bh(&data_sockets.lock); } _pms(sk)->ch.send = mISDN_send; _pms(sk)->ch.ctrl = mISDN_ctrl; switch (sk->sk_protocol) { case ISDN_P_TE_S0: case ISDN_P_NT_S0: case ISDN_P_TE_E1: case ISDN_P_NT_E1: mISDN_sock_unlink(&data_sockets, sk); err = connect_layer1(_pms(sk)->dev, &_pms(sk)->ch, sk->sk_protocol, maddr); if (err) mISDN_sock_link(&data_sockets, sk); break; case ISDN_P_LAPD_TE: case ISDN_P_LAPD_NT: err = create_l2entity(_pms(sk)->dev, &_pms(sk)->ch, sk->sk_protocol, maddr); break; case ISDN_P_B_RAW: case ISDN_P_B_HDLC: case ISDN_P_B_X75SLP: case ISDN_P_B_L2DTMF: case ISDN_P_B_L2DSP: case ISDN_P_B_L2DSPHDLC: err = connect_Bstack(_pms(sk)->dev, &_pms(sk)->ch, sk->sk_protocol, maddr); break; default: err = -EPROTONOSUPPORT; } if (err) goto done; sk->sk_state = MISDN_BOUND; _pms(sk)->ch.protocol = sk->sk_protocol; done: release_sock(sk); return err; } ",0 "decode_OFPAT_RAW11_PUSH_VLAN(ovs_be16 eth_type, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { if (eth_type != htons(ETH_TYPE_VLAN_8021Q)) { /* XXX 802.1AD(QinQ) isn't supported at the moment */ return OFPERR_OFPBAC_BAD_ARGUMENT; } ofpact_put_PUSH_VLAN(out); return 0; } ",0 "static int assoc_array_subtree_iterate(const struct assoc_array_ptr *root, const struct assoc_array_ptr *stop, int (*iterator)(const void *leaf, void *iterator_data), void *iterator_data) { const struct assoc_array_shortcut *shortcut; const struct assoc_array_node *node; const struct assoc_array_ptr *cursor, *ptr, *parent; unsigned long has_meta; int slot, ret; cursor = root; begin_node: if (assoc_array_ptr_is_shortcut(cursor)) { /* Descend through a shortcut */ shortcut = assoc_array_ptr_to_shortcut(cursor); smp_read_barrier_depends(); cursor = ACCESS_ONCE(shortcut->next_node); } node = assoc_array_ptr_to_node(cursor); smp_read_barrier_depends(); slot = 0; /* We perform two passes of each node. * * The first pass does all the leaves in this node. This means we * don't miss any leaves if the node is split up by insertion whilst * we're iterating over the branches rooted here (we may, however, see * some leaves twice). */ has_meta = 0; for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { ptr = ACCESS_ONCE(node->slots[slot]); has_meta |= (unsigned long)ptr; if (ptr && assoc_array_ptr_is_leaf(ptr)) { /* We need a barrier between the read of the pointer * and dereferencing the pointer - but only if we are * actually going to dereference it. */ smp_read_barrier_depends(); /* Invoke the callback */ ret = iterator(assoc_array_ptr_to_leaf(ptr), iterator_data); if (ret) return ret; } } /* The second pass attends to all the metadata pointers. If we follow * one of these we may find that we don't come back here, but rather go * back to a replacement node with the leaves in a different layout. * * We are guaranteed to make progress, however, as the slot number for * a particular portion of the key space cannot change - and we * continue at the back pointer + 1. */ if (!(has_meta & ASSOC_ARRAY_PTR_META_TYPE)) goto finished_node; slot = 0; continue_node: node = assoc_array_ptr_to_node(cursor); smp_read_barrier_depends(); for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { ptr = ACCESS_ONCE(node->slots[slot]); if (assoc_array_ptr_is_meta(ptr)) { cursor = ptr; goto begin_node; } } finished_node: /* Move up to the parent (may need to skip back over a shortcut) */ parent = ACCESS_ONCE(node->back_pointer); slot = node->parent_slot; if (parent == stop) return 0; if (assoc_array_ptr_is_shortcut(parent)) { shortcut = assoc_array_ptr_to_shortcut(parent); smp_read_barrier_depends(); cursor = parent; parent = ACCESS_ONCE(shortcut->back_pointer); slot = shortcut->parent_slot; if (parent == stop) return 0; } /* Ascend to next slot in parent node */ cursor = parent; slot++; goto continue_node; } ",0 "bool DefaultBrowserInfoBarDelegate::ShouldExpire( const content::LoadCommittedDetails& details) const { return details.is_navigation_to_different_page() && should_expire_; } ",0 "void Con_Close( void ) { if ( !com_cl_running->integer ) { return; } Field_Clear( &g_consoleField ); Con_ClearNotify(); Key_SetCatcher( Key_GetCatcher( ) & ~KEYCATCH_CONSOLE ); con.finalFrac = 0; // none visible con.displayFrac = 0; } ",0 " void FileSelectionCanceled() { proxy_ = nullptr; if (!render_frame_host_) return; std::move(callback_).Run(nullptr); } ",0 "bool ShouldHandle(const HttpRequest& request, const std::string& path_prefix) { GURL url = request.GetURL(); return url.path() == path_prefix || base::StartsWith(url.path(), path_prefix + ""/"", base::CompareCase::SENSITIVE); } ",0 "ofputil_bucket_check_duplicate_id(const struct ovs_list *buckets) { struct ofputil_bucket *i, *j; LIST_FOR_EACH (i, list_node, buckets) { LIST_FOR_EACH_REVERSE (j, list_node, buckets) { if (i == j) { break; } if (i->bucket_id == j->bucket_id) { return true; } } } return false; } ",0 "const DSA_METHOD *DSA_OpenSSL(void) { return &openssl_dsa_meth; } ",0 "void RenderViewImpl::FrameDidStartLoading(WebFrame* frame) { DCHECK_GE(frames_in_progress_, 0); if (frames_in_progress_ == 0) { for (auto& observer : observers_) observer.DidStartLoading(); } frames_in_progress_++; } ",0 "String LocalFrameClientImpl::evaluateInInspectorOverlayForTesting( const String& script) { if (WebDevToolsAgentImpl* devtools = DevToolsAgent()) return devtools->EvaluateInOverlayForTesting(script); return g_empty_string; } ",0 "print_simple_status(pe_working_set_t * data_set) { node_t *dc = NULL; GListPtr gIter = NULL; int nodes_online = 0; int nodes_standby = 0; dc = data_set->dc_node; if (dc == NULL) { mon_warn(""No DC ""); } for (gIter = data_set->nodes; gIter != NULL; gIter = gIter->next) { node_t *node = (node_t *) gIter->data; if (node->details->standby && node->details->online) { nodes_standby++; } else if (node->details->online) { nodes_online++; } else { mon_warn(""offline node: %s"", node->details->uname); } } if (!has_warnings) { print_as(""Ok: %d nodes online"", nodes_online); if (nodes_standby > 0) { print_as("", %d standby nodes"", nodes_standby); } print_as("", %d resources configured"", count_resources(data_set, NULL)); } print_as(""\n""); return 0; } ",0 "static ssize_t ap_control_domain_mask_show(struct bus_type *bus, char *buf) { if (ap_configuration != NULL) { /* QCI not supported */ if (test_facility(76)) { /* format 1 - 256 bit domain field */ return snprintf(buf, PAGE_SIZE, ""0x%08x%08x%08x%08x%08x%08x%08x%08x\n"", ap_configuration->adm[0], ap_configuration->adm[1], ap_configuration->adm[2], ap_configuration->adm[3], ap_configuration->adm[4], ap_configuration->adm[5], ap_configuration->adm[6], ap_configuration->adm[7]); } else { /* format 0 - 16 bit domain field */ return snprintf(buf, PAGE_SIZE, ""%08x%08x\n"", ap_configuration->adm[0], ap_configuration->adm[1]); } } else { return snprintf(buf, PAGE_SIZE, ""not supported\n""); } } ",0 "void PPB_Widget_Impl::SetLocation(const PP_Rect* location) { location_ = *location; SetLocationInternal(location); } ",0 "static void cvarinit(JF, js_Ast *list) { while (list) { js_Ast *var = list->a; if (var->b) { cexp(J, F, var->b); emitlocal(J, F, OP_SETLOCAL, OP_SETVAR, var->a); emit(J, F, OP_POP); } list = list->b; } } ",0 "static int flashsv2_prime(FlashSVContext *s, uint8_t *src, int size) { z_stream zs; int zret; // Zlib return code if (!src) return AVERROR_INVALIDDATA; zs.zalloc = NULL; zs.zfree = NULL; zs.opaque = NULL; s->zstream.next_in = src; s->zstream.avail_in = size; s->zstream.next_out = s->tmpblock; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); if (deflateInit(&zs, 0) != Z_OK) return -1; zs.next_in = s->tmpblock; zs.avail_in = s->block_size * 3 - s->zstream.avail_out; zs.next_out = s->deflate_block; zs.avail_out = s->deflate_block_size; deflate(&zs, Z_SYNC_FLUSH); deflateEnd(&zs); if ((zret = inflateReset(&s->zstream)) != Z_OK) { av_log(s->avctx, AV_LOG_ERROR, ""Inflate reset error: %d\n"", zret); return AVERROR_UNKNOWN; } s->zstream.next_in = s->deflate_block; s->zstream.avail_in = s->deflate_block_size - zs.avail_out; s->zstream.next_out = s->tmpblock; s->zstream.avail_out = s->block_size * 3; inflate(&s->zstream, Z_SYNC_FLUSH); return 0; } ",0 "void LoadingDataCollector::CleanupAbandonedNavigations( const NavigationID& navigation_id) { if (stats_collector_) stats_collector_->CleanupAbandonedStats(); static const base::TimeDelta max_navigation_age = base::TimeDelta::FromSeconds(config_.max_navigation_lifetime_seconds); base::TimeTicks time_now = base::TimeTicks::Now(); for (auto it = inflight_navigations_.begin(); it != inflight_navigations_.end();) { if ((it->first.tab_id == navigation_id.tab_id) || (time_now - it->first.creation_time > max_navigation_age)) { inflight_navigations_.erase(it++); } else { ++it; } } } ",0 "COMPAT_SYSCALL_DEFINE2(mq_notify, mqd_t, mqdes, const struct compat_sigevent __user *, u_notification) { struct sigevent n, *p = NULL; if (u_notification) { if (get_compat_sigevent(&n, u_notification)) return -EFAULT; if (n.sigev_notify == SIGEV_THREAD) n.sigev_value.sival_ptr = compat_ptr(n.sigev_value.sival_int); p = &n; } return do_mq_notify(mqdes, p); } ",0 "bool PrintingContext::GetPrinterSettings(HANDLE printer, const std::wstring& device_name) { DCHECK(!in_print_job_); scoped_array buffer; GetPrinterHelper(printer, 9, &buffer); if (buffer.get()) { PRINTER_INFO_9* info_9 = reinterpret_cast(buffer.get()); if (info_9->pDevMode != NULL) { if (!AllocateContext(device_name, info_9->pDevMode)) { ResetSettings(); return false; } return InitializeSettings(*info_9->pDevMode, device_name, NULL, 0, false); } buffer.reset(); } GetPrinterHelper(printer, 8, &buffer); if (buffer.get()) { PRINTER_INFO_8* info_8 = reinterpret_cast(buffer.get()); if (info_8->pDevMode != NULL) { if (!AllocateContext(device_name, info_8->pDevMode)) { ResetSettings(); return false; } return InitializeSettings(*info_8->pDevMode, device_name, NULL, 0, false); } buffer.reset(); } GetPrinterHelper(printer, 2, &buffer); if (buffer.get()) { PRINTER_INFO_2* info_2 = reinterpret_cast(buffer.get()); if (info_2->pDevMode != NULL) { if (!AllocateContext(device_name, info_2->pDevMode)) { ResetSettings(); return false; } return InitializeSettings(*info_2->pDevMode, device_name, NULL, 0, false); } buffer.reset(); } ResetSettings(); return false; } ",0 "static void check_preempt_wakeup(struct rq *rq, struct task_struct *p, int wake_flags) { struct task_struct *curr = rq->curr; struct sched_entity *se = &curr->se, *pse = &p->se; struct cfs_rq *cfs_rq = task_cfs_rq(curr); int scale = cfs_rq->nr_running >= sched_nr_latency; int next_buddy_marked = 0; if (unlikely(se == pse)) return; /* * This is possible from callers such as attach_tasks(), in which we * unconditionally check_prempt_curr() after an enqueue (which may have * lead to a throttle). This both saves work and prevents false * next-buddy nomination below. */ if (unlikely(throttled_hierarchy(cfs_rq_of(pse)))) return; if (sched_feat(NEXT_BUDDY) && scale && !(wake_flags & WF_FORK)) { set_next_buddy(pse); next_buddy_marked = 1; } /* * We can come here with TIF_NEED_RESCHED already set from new task * wake up path. * * Note: this also catches the edge-case of curr being in a throttled * group (e.g. via set_curr_task), since update_curr() (in the * enqueue of curr) will have resulted in resched being set. This * prevents us from potentially nominating it as a false LAST_BUDDY * below. */ if (test_tsk_need_resched(curr)) return; /* Idle tasks are by definition preempted by non-idle tasks. */ if (unlikely(task_has_idle_policy(curr)) && likely(!task_has_idle_policy(p))) goto preempt; /* * Batch and idle tasks do not preempt non-idle tasks (their preemption * is driven by the tick): */ if (unlikely(p->policy != SCHED_NORMAL) || !sched_feat(WAKEUP_PREEMPTION)) return; find_matching_se(&se, &pse); update_curr(cfs_rq_of(se)); BUG_ON(!pse); if (wakeup_preempt_entity(se, pse) == 1) { /* * Bias pick_next to pick the sched entity that is * triggering this preemption. */ if (!next_buddy_marked) set_next_buddy(pse); goto preempt; } return; preempt: resched_curr(rq); /* * Only set the backward buddy when the current task is still * on the rq. This can happen when a wakeup gets interleaved * with schedule on the ->pre_schedule() or idle_balance() * point, either of which can * drop the rq lock. * * Also, during early boot the idle thread is in the fair class, * for obvious reasons its a bad idea to schedule back to it. */ if (unlikely(!se->on_rq || curr == rq->idle)) return; if (sched_feat(LAST_BUDDY) && scale && entity_is_task(se)) set_last_buddy(se); } ",0 "void BrowserChildProcessHostImpl::BindInterface( const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!child_connection_) return; child_connection_->BindInterface(interface_name, std::move(interface_pipe)); } ",0 "static int pl_input_mapping(struct hid_device *hdev, struct hid_input *hi, struct hid_field *field, struct hid_usage *usage, unsigned long **bit, int *max) { if ((usage->hid & HID_USAGE_PAGE) == HID_UP_LOGIVENDOR) { switch (usage->hid & HID_USAGE) { case 0x05a: pl_map_key_clear(KEY_TEXT); break; case 0x05b: pl_map_key_clear(KEY_RED); break; case 0x05c: pl_map_key_clear(KEY_GREEN); break; case 0x05d: pl_map_key_clear(KEY_YELLOW); break; case 0x05e: pl_map_key_clear(KEY_BLUE); break; default: return 0; } return 1; } if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) { switch (usage->hid & HID_USAGE) { case 0x0f6: pl_map_key_clear(KEY_NEXT); break; case 0x0fa: pl_map_key_clear(KEY_BACK); break; default: return 0; } return 1; } return 0; } ",0 "void FilePathWatcherImpl::CancelOnMessageLoopThread() { if (!is_cancelled()) set_cancelled(); if (delegate_) { MessageLoop::current()->RemoveDestructionObserver(this); delegate_ = NULL; } for (WatchVector::iterator watch_entry(watches_.begin()); watch_entry != watches_.end(); ++watch_entry) { if (watch_entry->watch_ != InotifyReader::kInvalidWatch) g_inotify_reader.Get().RemoveWatch(watch_entry->watch_, this); } watches_.clear(); target_.clear(); } ",0 " OVS_REQUIRES(ofproto_mutex) { struct ofgroup *group; if (ogm->gm.group_id == OFPG_ALL) { CMAP_FOR_EACH (group, cmap_node, &ofproto->groups) { if (versions_visible_in_version(&group->versions, ogm->version)) { delete_group_start(ofproto, ogm->version, &ogm->old_groups, group); } } } else { group = ofproto_group_lookup__(ofproto, ogm->gm.group_id, ogm->version); if (group) { delete_group_start(ofproto, ogm->version, &ogm->old_groups, group); } } } ",0 "PHPAPI void var_push_dtor_no_addref(php_unserialize_data_t *var_hashx, zval **rval) { var_entries *var_hash; if (!var_hashx || !*var_hashx) { return; } var_hash = (*var_hashx)->last_dtor; #if VAR_ENTRIES_DBG fprintf(stderr, ""var_push_dtor_no_addref(%p, %ld): %d (%d)\n"", *rval, var_hash?var_hash->used_slots:-1L, Z_TYPE_PP(rval), Z_REFCOUNT_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; } var_hash->data[var_hash->used_slots++] = *rval; } ",0 "static int __init des_s390_init(void) { int ret; if (!crypt_s390_func_available(KM_DEA_ENCRYPT, CRYPT_S390_MSA) || !crypt_s390_func_available(KM_TDEA_192_ENCRYPT, CRYPT_S390_MSA)) return -EOPNOTSUPP; ret = crypto_register_alg(&des_alg); if (ret) goto des_err; ret = crypto_register_alg(&ecb_des_alg); if (ret) goto ecb_des_err; ret = crypto_register_alg(&cbc_des_alg); if (ret) goto cbc_des_err; ret = crypto_register_alg(&des3_alg); if (ret) goto des3_err; ret = crypto_register_alg(&ecb_des3_alg); if (ret) goto ecb_des3_err; ret = crypto_register_alg(&cbc_des3_alg); if (ret) goto cbc_des3_err; if (crypt_s390_func_available(KMCTR_DEA_ENCRYPT, CRYPT_S390_MSA | CRYPT_S390_MSA4) && crypt_s390_func_available(KMCTR_TDEA_192_ENCRYPT, CRYPT_S390_MSA | CRYPT_S390_MSA4)) { ret = crypto_register_alg(&ctr_des_alg); if (ret) goto ctr_des_err; ret = crypto_register_alg(&ctr_des3_alg); if (ret) goto ctr_des3_err; ctrblk = (u8 *) __get_free_page(GFP_KERNEL); if (!ctrblk) { ret = -ENOMEM; goto ctr_mem_err; } } out: return ret; ctr_mem_err: crypto_unregister_alg(&ctr_des3_alg); ctr_des3_err: crypto_unregister_alg(&ctr_des_alg); ctr_des_err: crypto_unregister_alg(&cbc_des3_alg); cbc_des3_err: crypto_unregister_alg(&ecb_des3_alg); ecb_des3_err: crypto_unregister_alg(&des3_alg); des3_err: crypto_unregister_alg(&cbc_des_alg); cbc_des_err: crypto_unregister_alg(&ecb_des_alg); ecb_des_err: crypto_unregister_alg(&des_alg); des_err: goto out; } ",0 "static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct usb_host_interface *desc; struct usb_device *hdev; struct usb_hub *hub; desc = intf->cur_altsetting; hdev = interface_to_usbdev(intf); /* * Set default autosuspend delay as 0 to speedup bus suspend, * based on the below considerations: * * - Unlike other drivers, the hub driver does not rely on the * autosuspend delay to provide enough time to handle a wakeup * event, and the submitted status URB is just to check future * change on hub downstream ports, so it is safe to do it. * * - The patch might cause one or more auto supend/resume for * below very rare devices when they are plugged into hub * first time: * * devices having trouble initializing, and disconnect * themselves from the bus and then reconnect a second * or so later * * devices just for downloading firmware, and disconnects * themselves after completing it * * For these quite rare devices, their drivers may change the * autosuspend delay of their parent hub in the probe() to one * appropriate value to avoid the subtle problem if someone * does care it. * * - The patch may cause one or more auto suspend/resume on * hub during running 'lsusb', but it is probably too * infrequent to worry about. * * - Change autosuspend delay of hub can avoid unnecessary auto * suspend timer for hub, also may decrease power consumption * of USB bus. * * - If user has indicated to prevent autosuspend by passing * usbcore.autosuspend = -1 then keep autosuspend disabled. */ #ifdef CONFIG_PM if (hdev->dev.power.autosuspend_delay >= 0) pm_runtime_set_autosuspend_delay(&hdev->dev, 0); #endif /* * Hubs have proper suspend/resume support, except for root hubs * where the controller driver doesn't have bus_suspend and * bus_resume methods. */ if (hdev->parent) { /* normal device */ usb_enable_autosuspend(hdev); } else { /* root hub */ const struct hc_driver *drv = bus_to_hcd(hdev->bus)->driver; if (drv->bus_suspend && drv->bus_resume) usb_enable_autosuspend(hdev); } if (hdev->level == MAX_TOPO_LEVEL) { dev_err(&intf->dev, ""Unsupported bus topology: hub nested too deep\n""); return -E2BIG; } #ifdef CONFIG_USB_OTG_BLACKLIST_HUB if (hdev->parent) { dev_warn(&intf->dev, ""ignoring external hub\n""); return -ENODEV; } #endif if (!hub_descriptor_is_sane(desc)) { dev_err(&intf->dev, ""bad descriptor, ignoring hub\n""); return -EIO; } /* We found a hub */ dev_info(&intf->dev, ""USB hub found\n""); hub = kzalloc(sizeof(*hub), GFP_KERNEL); if (!hub) return -ENOMEM; kref_init(&hub->kref); hub->intfdev = &intf->dev; hub->hdev = hdev; INIT_DELAYED_WORK(&hub->leds, led_work); INIT_DELAYED_WORK(&hub->init_work, NULL); INIT_WORK(&hub->events, hub_event); usb_get_intf(intf); usb_get_dev(hdev); usb_set_intfdata(intf, hub); intf->needs_remote_wakeup = 1; pm_suspend_ignore_children(&intf->dev, true); if (hdev->speed == USB_SPEED_HIGH) highspeed_hubs++; if (id->driver_info & HUB_QUIRK_CHECK_PORT_AUTOSUSPEND) hub->quirk_check_port_auto_suspend = 1; if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) return 0; hub_disconnect(intf); return -ENODEV; } ",0 "void ChromeContentBrowserClient::NavigationRequestRedirected( int frame_tree_node_id, const GURL& url, base::Optional* modified_request_headers) { WebContents* web_contents = WebContents::FromFrameTreeNodeId(frame_tree_node_id); content::BrowserContext* browser_context = web_contents->GetBrowserContext(); if (!browser_context->IsOffTheRecord()) { policy::PolicyHeaderService* policy_header_service = policy::PolicyHeaderServiceFactory::GetForBrowserContext( browser_context); if (policy_header_service) { std::unique_ptr extra_headers; policy_header_service->AddPolicyHeaders(url, &extra_headers); if (extra_headers) *modified_request_headers = std::move(*extra_headers); } } } ",0 "void GLES2DecoderImpl::DoUniform1fv( GLint location, GLsizei count, const GLfloat* value) { GLenum type = 0; if (!PrepForSetUniformByLocation(location, ""glUniform1fv"", &type, &count)) { return; } if (type == GL_BOOL) { scoped_array temp(new GLint[count]); for (GLsizei ii = 0; ii < count; ++ii) { temp[ii] = static_cast(value[ii] != 0.0f); } DoUniform1iv(location, count, temp.get()); } else { glUniform1fv(location, count, value); } } ",0 "transform_end(png_structp ppIn, png_infop pi) { png_const_structp pp = ppIn; transform_display *dp = voidcast(transform_display*, png_get_progressive_ptr(pp)); if (!dp->this.speed) transform_image_validate(dp, pp, pi); else dp->this.ps->validated = 1; } ",0 "static int nfs_do_write(struct nfs_write_data *data, const struct rpc_call_ops *call_ops, int how) { struct inode *inode = data->header->inode; return nfs_initiate_write(NFS_CLIENT(inode), data, call_ops, how, 0); } ",0 "void tracing_snapshot_cond(struct trace_array *tr, void *cond_data) { tracing_snapshot_instance_cond(tr, cond_data); } ",0 "void TestController::handleGeolocationPermissionRequest(WKGeolocationPermissionRequestRef geolocationPermissionRequest) { m_geolocationPermissionRequests.append(geolocationPermissionRequest); decidePolicyForGeolocationPermissionRequestIfPossible(); } ",0 "bool V8Window::indexedSecurityCheckCustom(v8::Local host, uint32_t index, v8::AccessType type, v8::Local) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Handle window = V8Window::findInstanceInPrototypeChain(host, isolate); if (window.IsEmpty()) return false; DOMWindow* targetWindow = V8Window::toImpl(window); ASSERT(targetWindow); if (!targetWindow->isLocalDOMWindow()) return false; LocalFrame* target = toLocalDOMWindow(targetWindow)->frame(); if (!target) return false; if (target->loader().stateMachine()->isDisplayingInitialEmptyDocument()) target->loader().didAccessInitialDocument(); Frame* childFrame = target->tree().scopedChild(index); if (type == v8::ACCESS_HAS && childFrame) return true; if (type == v8::ACCESS_GET && childFrame && !host->HasRealIndexedProperty(index) && !window->HasRealIndexedProperty(index)) return true; return BindingSecurity::shouldAllowAccessToFrame(isolate, target, DoNotReportSecurityError); } ",0 "static void nfs4_release_lockowner_prepare(struct rpc_task *task, void *calldata) { struct nfs_release_lockowner_data *data = calldata; struct nfs_server *server = data->server; nfs40_setup_sequence(server->nfs_client->cl_slot_tbl, &data->args.seq_args, &data->res.seq_res, task); data->args.lock_owner.clientid = server->nfs_client->cl_clientid; data->timestamp = jiffies; } ",0 "void credssp_encode_ts_credentials(rdpCredssp* credssp) { wStream* s; int length; length = ber_sizeof_sequence(credssp_sizeof_ts_credentials(credssp)); sspi_SecBufferAlloc(&credssp->ts_credentials, length); s = Stream_New(credssp->ts_credentials.pvBuffer, length); credssp_write_ts_credentials(credssp, s); Stream_Free(s, FALSE); } ",0 "void mm_release(struct task_struct *tsk, struct mm_struct *mm) { struct completion *vfork_done = tsk->vfork_done; /* Get rid of any cached register state */ deactivate_mm(tsk, mm); /* notify parent sleeping on vfork() */ if (vfork_done) { tsk->vfork_done = NULL; complete(vfork_done); } /* * If we're exiting normally, clear a user-space tid field if * requested. We leave this alone when dying by signal, to leave * the value intact in a core dump, and to save the unnecessary * trouble otherwise. Userland only wants this done for a sys_exit. */ if (tsk->clear_child_tid && !(tsk->flags & PF_SIGNALED) && atomic_read(&mm->mm_users) > 1) { u32 __user * tidptr = tsk->clear_child_tid; tsk->clear_child_tid = NULL; /* * We don't check the error code - if userspace has * not set up a proper pointer then tough luck. */ put_user(0, tidptr); sys_futex(tidptr, FUTEX_WAKE, 1, NULL, NULL, 0); } } ",1 " OVS_REQUIRES(ofproto_mutex) { struct rule *old_rule = rule_collection_n(&ofm->old_rules) ? rule_collection_rules(&ofm->old_rules)[0] : NULL; struct rule *new_rule = rule_collection_rules(&ofm->new_rules)[0]; replace_rule_revert(ofproto, old_rule, new_rule); } ",0 "void Automation::MouseButtonDown(int tab_id, const gfx::Point& p, Error** error) { *error = CheckAdvancedInteractionsSupported(); if (*error) return; int windex = 0, tab_index = 0; *error = GetIndicesForTab(tab_id, &windex, &tab_index); if (*error) return; std::string error_msg; if (!SendMouseButtonDownJSONRequest( automation(), windex, tab_index, p.x(), p.y(), &error_msg)) { *error = new Error(kUnknownError, error_msg); } } ",0 "nfs41_find_root_sec(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *info) { int err; struct page *page; rpc_authflavor_t flavor; struct nfs4_secinfo_flavors *flavors; page = alloc_page(GFP_KERNEL); if (!page) { err = -ENOMEM; goto out; } flavors = page_address(page); err = nfs41_proc_secinfo_no_name(server, fhandle, info, flavors); /* * Fall back on ""guess and check"" method if * the server doesn't support SECINFO_NO_NAME */ if (err == -NFS4ERR_WRONGSEC || err == -NFS4ERR_NOTSUPP) { err = nfs4_find_root_sec(server, fhandle, info); goto out_freepage; } if (err) goto out_freepage; flavor = nfs_find_best_sec(flavors); if (err == 0) err = nfs4_lookup_root_sec(server, fhandle, info, flavor); out_freepage: put_page(page); if (err == -EACCES) return -EPERM; out: return err; } ",0 " void FileAPIMessageFilter::RegisterFileAsBlob(const GURL& blob_url, const FilePath& virtual_path, const FilePath& platform_path) { FilePath::StringType extension = virtual_path.Extension(); if (!extension.empty()) extension = extension.substr(1); // Strip leading ""."". scoped_refptr shareable_file = webkit_blob::ShareableFileReference::Get(platform_path); if (shareable_file && !ChildProcessSecurityPolicyImpl::GetInstance()->CanReadFile( process_id_, platform_path)) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( process_id_, platform_path); shareable_file->AddFinalReleaseCallback( base::Bind(&RevokeFilePermission, process_id_)); } std::string mime_type; net::GetWellKnownMimeTypeFromExtension(extension, &mime_type); BlobData::Item item; item.SetToFilePathRange(platform_path, 0, -1, base::Time()); BlobStorageController* controller = blob_storage_context_->controller(); controller->StartBuildingBlob(blob_url); controller->AppendBlobDataItem(blob_url, item); controller->FinishBuildingBlob(blob_url, mime_type); blob_urls_.insert(blob_url.spec()); } ",1 "nf_nat_redirect_ipv4(struct sk_buff *skb, const struct nf_nat_ipv4_multi_range_compat *mr, unsigned int hooknum) { struct nf_conn *ct; enum ip_conntrack_info ctinfo; __be32 newdst; struct nf_nat_range newrange; NF_CT_ASSERT(hooknum == NF_INET_PRE_ROUTING || hooknum == NF_INET_LOCAL_OUT); ct = nf_ct_get(skb, &ctinfo); NF_CT_ASSERT(ct && (ctinfo == IP_CT_NEW || ctinfo == IP_CT_RELATED)); /* Local packets: make them go to loopback */ if (hooknum == NF_INET_LOCAL_OUT) { newdst = htonl(0x7F000001); } else { struct in_device *indev; struct in_ifaddr *ifa; newdst = 0; rcu_read_lock(); indev = __in_dev_get_rcu(skb->dev); if (indev != NULL) { ifa = indev->ifa_list; newdst = ifa->ifa_local; } rcu_read_unlock(); if (!newdst) return NF_DROP; } /* Transfer from original range. */ memset(&newrange.min_addr, 0, sizeof(newrange.min_addr)); memset(&newrange.max_addr, 0, sizeof(newrange.max_addr)); newrange.flags = mr->range[0].flags | NF_NAT_RANGE_MAP_IPS; newrange.min_addr.ip = newdst; newrange.max_addr.ip = newdst; newrange.min_proto = mr->range[0].min; newrange.max_proto = mr->range[0].max; /* Hand modified range to generic setup. */ return nf_nat_setup_info(ct, &newrange, NF_NAT_MANIP_DST); } ",1 "void tracing_snapshot_alloc(void) { int ret; ret = tracing_alloc_snapshot(); if (ret < 0) return; tracing_snapshot(); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) { api()->glStencilFuncSeparateFn(face, func, ref, mask); return error::kNoError; } ",0 "void Framebuffer::OnTextureRefDetached(TextureRef* texture) { manager_->OnTextureRefDetached(texture); } ",0 " OVS_REQUIRES(ofproto_mutex) { struct rule_collection *rules = &ofm->old_rules; enum ofperr error; error = collect_rules_strict(ofproto, &ofm->criteria, rules); if (!error) { delete_flows_start__(ofproto, ofm->version, rules); } return error; } ",0 "static inline int ebt_match_to_user(const struct ebt_entry_match *m, const char *base, char __user *ubase) { return ebt_obj_to_user(ubase + ((char *)m - base), m->u.match->name, m->data, sizeof(*m), m->u.match->usersize, m->match_size); } ",0 "_TIFFSwab64BitData(TIFF* tif, uint8* buf, tmsize_t cc) { (void) tif; assert((cc & 7) == 0); TIFFSwabArrayOfDouble((double*) buf, cc/8); } ",0 "static unsigned int mqueue_poll_file(struct file *filp, struct poll_table_struct *poll_tab) { struct mqueue_inode_info *info = MQUEUE_I(file_inode(filp)); int retval = 0; poll_wait(filp, &info->wait_q, poll_tab); spin_lock(&info->lock); if (info->attr.mq_curmsgs) retval = POLLIN | POLLRDNORM; if (info->attr.mq_curmsgs < info->attr.mq_maxmsg) retval |= POLLOUT | POLLWRNORM; spin_unlock(&info->lock); return retval; } ",0 "void AppListControllerDelegate::OnCloseChildDialog() { } ",0 "void RenderBlock::getSelectionGapInfo(SelectionState state, bool& leftGap, bool& rightGap) { bool ltr = style()->isLeftToRightDirection(); leftGap = (state == RenderObject::SelectionInside) || (state == RenderObject::SelectionEnd && ltr) || (state == RenderObject::SelectionStart && !ltr); rightGap = (state == RenderObject::SelectionInside) || (state == RenderObject::SelectionStart && ltr) || (state == RenderObject::SelectionEnd && !ltr); } ",0 "int Condor_Auth_SSL :: receive_message( int &status, int &len, char *buf ) { ouch(""Receive message.\n""); mySock_ ->decode( ); if( !(mySock_ ->code( status )) || !(mySock_ ->code( len )) || !(len == (mySock_ ->get_bytes( buf, len ))) || !(mySock_ ->end_of_message( )) ) { ouch( ""Error communicating with peer.\n"" ); return AUTH_SSL_ERROR; } dprintf(D_SECURITY,""Received message (%d).\n"", status ); return AUTH_SSL_A_OK; } ",0 "InputEventAckState RenderWidgetHostImpl::FilterInputEvent( const blink::WebInputEvent& event, const ui::LatencyInfo& latency_info) { if (ShouldDropInputEvents() && event.GetType() != WebInputEvent::kTouchCancel) return INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS; if (!process_->HasConnection()) return INPUT_EVENT_ACK_STATE_UNKNOWN; if (delegate_) { if (event.GetType() == WebInputEvent::kMouseDown || event.GetType() == WebInputEvent::kTouchStart) { delegate_->FocusOwningWebContents(this); } if (event.GetType() == WebInputEvent::kMouseDown || event.GetType() == WebInputEvent::kGestureScrollBegin || event.GetType() == WebInputEvent::kTouchStart || event.GetType() == WebInputEvent::kRawKeyDown) { delegate_->OnUserInteraction(this, event.GetType()); } } return view_ ? view_->FilterInputEvent(event) : INPUT_EVENT_ACK_STATE_NOT_CONSUMED; } ",0 "ResourceError WebFrameLoaderClient::cannotShowURLError(const ResourceRequest&) { return ResourceError(); } ",0 "static void CopyDoubleToDoubleElements(FixedArrayBase* from_base, uint32_t from_start, FixedArrayBase* to_base, uint32_t to_start, int raw_copy_size) { DisallowHeapAllocation no_allocation; int copy_size = raw_copy_size; if (raw_copy_size < 0) { DCHECK(raw_copy_size == ElementsAccessor::kCopyToEnd || raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole); copy_size = Min(from_base->length() - from_start, to_base->length() - to_start); if (raw_copy_size == ElementsAccessor::kCopyToEndAndInitializeToHole) { for (int i = to_start + copy_size; i < to_base->length(); ++i) { FixedDoubleArray::cast(to_base)->set_the_hole(i); } } } DCHECK((copy_size + static_cast(to_start)) <= to_base->length() && (copy_size + static_cast(from_start)) <= from_base->length()); if (copy_size == 0) return; FixedDoubleArray* from = FixedDoubleArray::cast(from_base); FixedDoubleArray* to = FixedDoubleArray::cast(to_base); Address to_address = to->address() + FixedDoubleArray::kHeaderSize; Address from_address = from->address() + FixedDoubleArray::kHeaderSize; to_address += kDoubleSize * to_start; from_address += kDoubleSize * from_start; int words_per_double = (kDoubleSize / kPointerSize); CopyWords(reinterpret_cast(to_address), reinterpret_cast(from_address), static_cast(words_per_double * copy_size)); } ",0 "static struct sctp_chunk *_sctp_make_chunk(const struct sctp_association *asoc, __u8 type, __u8 flags, int paylen) { struct sctp_chunk *retval; sctp_chunkhdr_t *chunk_hdr; struct sk_buff *skb; struct sock *sk; /* No need to allocate LL here, as this is only a chunk. */ skb = alloc_skb(WORD_ROUND(sizeof(sctp_chunkhdr_t) + paylen), GFP_ATOMIC); if (!skb) goto nodata; /* Make room for the chunk header. */ chunk_hdr = (sctp_chunkhdr_t *)skb_put(skb, sizeof(sctp_chunkhdr_t)); chunk_hdr->type = type; chunk_hdr->flags = flags; chunk_hdr->length = htons(sizeof(sctp_chunkhdr_t)); sk = asoc ? asoc->base.sk : NULL; retval = sctp_chunkify(skb, asoc, sk); if (!retval) { kfree_skb(skb); goto nodata; } retval->chunk_hdr = chunk_hdr; retval->chunk_end = ((__u8 *)chunk_hdr) + sizeof(struct sctp_chunkhdr); /* Determine if the chunk needs to be authenticated */ if (sctp_auth_send_cid(type, asoc)) retval->auth = 1; return retval; nodata: return NULL; } ",0 "static void reset_packet_state(AVFormatContext *s) { ASFContext *asf = s->priv_data; int i; asf->state = PARSE_PACKET_HEADER; asf->offset = 0; asf->return_subpayload = 0; asf->sub_left = 0; asf->sub_header_offset = 0; asf->packet_offset = asf->first_packet_offset; asf->pad_len = 0; asf->rep_data_len = 0; asf->dts_delta = 0; asf->mult_sub_len = 0; asf->nb_mult_left = 0; asf->nb_sub = 0; asf->prop_flags = 0; asf->sub_dts = 0; for (i = 0; i < asf->nb_streams; i++) { ASFPacket *pkt = &asf->asf_st[i]->pkt; pkt->size_left = 0; pkt->data_size = 0; pkt->duration = 0; pkt->flags = 0; pkt->dts = 0; pkt->duration = 0; av_packet_unref(&pkt->avpkt); av_init_packet(&pkt->avpkt); } } ",0 "rboolop(PG_FUNCTION_ARGS) { /* just reverse the operands */ return DirectFunctionCall2(boolop, PG_GETARG_DATUM(1), PG_GETARG_DATUM(0)); } ",0 "void GlobalHistogramAllocator::SetPersistentLocation(const FilePath& location) { persistent_location_ = location; } ",0 "gst_asf_demux_mark_discont (GstASFDemux * demux) { guint n; GST_DEBUG_OBJECT (demux, ""Mark stream discont""); for (n = 0; n < demux->num_streams; n++) demux->stream[n].discont = TRUE; } ",0 "GLvoid StubGLStencilMask(GLuint mask) { glStencilMask(mask); } ",0 "void pdo_row_free_storage(pdo_stmt_t *stmt TSRMLS_DC) { if (stmt) { ZVAL_NULL(&stmt->lazy_object_ref); if (--stmt->refcount == 0) { free_statement(stmt TSRMLS_CC); } } } ",0 "COMPS_RTree * comps_rtree_create(void* (*data_constructor)(void*), void* (*data_cloner)(void*), void (*data_destructor)(void*)) { COMPS_RTree *ret; if ((ret = malloc(sizeof(COMPS_RTree))) == NULL) return NULL; ret->subnodes = comps_hslist_create(); comps_hslist_init(ret->subnodes, NULL, NULL, &comps_rtree_data_destroy_v); if (ret->subnodes == NULL) { free(ret); return NULL; } ret->data_constructor = data_constructor; ret->data_cloner = data_cloner; ret->data_destructor = data_destructor; return ret; } ",0 "void SyncManager::SyncInternal::OnIPAddressChangedImpl() { DCHECK(thread_checker_.CalledOnValidThread()); if (scheduler()) scheduler()->OnConnectionStatusChange(); } ",0 "static inline int get_numa_group(struct numa_group *grp) { return atomic_inc_not_zero(&grp->refcount); } ",0 "ModuleExport size_t RegisterPNGImage(void) { char version[MaxTextExtent]; MagickInfo *entry; static const char *PNGNote= { ""See http://www.libpng.org/ for details about the PNG format."" }, *JNGNote= { ""See http://www.libpng.org/pub/mng/ for details about the JNG\n"" ""format."" }, *MNGNote= { ""See http://www.libpng.org/pub/mng/ for details about the MNG\n"" ""format."" }; *version='\0'; #if defined(PNG_LIBPNG_VER_STRING) (void) ConcatenateMagickString(version,""libpng "",MaxTextExtent); (void) ConcatenateMagickString(version,PNG_LIBPNG_VER_STRING,MaxTextExtent); if (LocaleCompare(PNG_LIBPNG_VER_STRING,png_get_header_ver(NULL)) != 0) { (void) ConcatenateMagickString(version,"","",MaxTextExtent); (void) ConcatenateMagickString(version,png_get_libpng_ver(NULL), MaxTextExtent); } #endif entry=SetMagickInfo(""MNG""); entry->seekable_stream=MagickTrue; /* To do: eliminate this. */ #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadMNGImage; entry->encoder=(EncodeImageHandler *) WriteMNGImage; #endif entry->magick=(IsImageFormatHandler *) IsMNG; entry->description=ConstantString(""Multiple-image Network Graphics""); if (*version != '\0') entry->version=ConstantString(version); entry->mime_type=ConstantString(""video/x-mng""); entry->module=ConstantString(""PNG""); entry->note=ConstantString(MNGNote); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""PNG""); #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadPNGImage; entry->encoder=(EncodeImageHandler *) WritePNGImage; #endif entry->magick=(IsImageFormatHandler *) IsPNG; entry->adjoin=MagickFalse; entry->description=ConstantString(""Portable Network Graphics""); entry->mime_type=ConstantString(""image/png""); entry->module=ConstantString(""PNG""); if (*version != '\0') entry->version=ConstantString(version); entry->note=ConstantString(PNGNote); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""PNG8""); #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadPNGImage; entry->encoder=(EncodeImageHandler *) WritePNGImage; #endif entry->magick=(IsImageFormatHandler *) IsPNG; entry->adjoin=MagickFalse; entry->description=ConstantString( ""8-bit indexed with optional binary transparency""); entry->mime_type=ConstantString(""image/png""); entry->module=ConstantString(""PNG""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""PNG24""); *version='\0'; #if defined(ZLIB_VERSION) (void) ConcatenateMagickString(version,""zlib "",MaxTextExtent); (void) ConcatenateMagickString(version,ZLIB_VERSION,MaxTextExtent); if (LocaleCompare(ZLIB_VERSION,zlib_version) != 0) { (void) ConcatenateMagickString(version,"","",MaxTextExtent); (void) ConcatenateMagickString(version,zlib_version,MaxTextExtent); } #endif if (*version != '\0') entry->version=ConstantString(version); #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadPNGImage; entry->encoder=(EncodeImageHandler *) WritePNGImage; #endif entry->magick=(IsImageFormatHandler *) IsPNG; entry->adjoin=MagickFalse; entry->description=ConstantString(""opaque or binary transparent 24-bit RGB""); entry->mime_type=ConstantString(""image/png""); entry->module=ConstantString(""PNG""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""PNG32""); #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadPNGImage; entry->encoder=(EncodeImageHandler *) WritePNGImage; #endif entry->magick=(IsImageFormatHandler *) IsPNG; entry->adjoin=MagickFalse; entry->description=ConstantString(""opaque or transparent 32-bit RGBA""); entry->mime_type=ConstantString(""image/png""); entry->module=ConstantString(""PNG""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""PNG48""); #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadPNGImage; entry->encoder=(EncodeImageHandler *) WritePNGImage; #endif entry->magick=(IsImageFormatHandler *) IsPNG; entry->adjoin=MagickFalse; entry->description=ConstantString(""opaque or binary transparent 48-bit RGB""); entry->mime_type=ConstantString(""image/png""); entry->module=ConstantString(""PNG""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""PNG64""); #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadPNGImage; entry->encoder=(EncodeImageHandler *) WritePNGImage; #endif entry->magick=(IsImageFormatHandler *) IsPNG; entry->adjoin=MagickFalse; entry->description=ConstantString(""opaque or transparent 64-bit RGBA""); entry->mime_type=ConstantString(""image/png""); entry->module=ConstantString(""PNG""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""PNG00""); #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadPNGImage; entry->encoder=(EncodeImageHandler *) WritePNGImage; #endif entry->magick=(IsImageFormatHandler *) IsPNG; entry->adjoin=MagickFalse; entry->description=ConstantString( ""PNG inheriting bit-depth, color-type from original if possible""); entry->mime_type=ConstantString(""image/png""); entry->module=ConstantString(""PNG""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""JNG""); #if defined(JNG_SUPPORTED) #if defined(MAGICKCORE_PNG_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadJNGImage; entry->encoder=(EncodeImageHandler *) WriteJNGImage; #endif #endif entry->magick=(IsImageFormatHandler *) IsJNG; entry->adjoin=MagickFalse; entry->description=ConstantString(""JPEG Network Graphics""); entry->mime_type=ConstantString(""image/x-jng""); entry->module=ConstantString(""PNG""); entry->note=ConstantString(JNGNote); (void) RegisterMagickInfo(entry); #ifdef IMPNG_SETJMP_NOT_THREAD_SAFE ping_semaphore=AllocateSemaphoreInfo(); #endif return(MagickImageCoderSignature); } ",1 "void InputType::DispatchSearchEvent() {} ",0 " ikev1_n_print(netdissect_options *ndo, u_char tpay _U_, const struct isakmp_gen *ext, u_int item_len, const u_char *ep, uint32_t phase, uint32_t doi0 _U_, uint32_t proto0 _U_, int depth) { const struct ikev1_pl_n *p; struct ikev1_pl_n n; const u_char *cp; const u_char *ep2; uint32_t doi; uint32_t proto; static const char *notify_error_str[] = { NULL, ""INVALID-PAYLOAD-TYPE"", ""DOI-NOT-SUPPORTED"", ""SITUATION-NOT-SUPPORTED"", ""INVALID-COOKIE"", ""INVALID-MAJOR-VERSION"", ""INVALID-MINOR-VERSION"", ""INVALID-EXCHANGE-TYPE"", ""INVALID-FLAGS"", ""INVALID-MESSAGE-ID"", ""INVALID-PROTOCOL-ID"", ""INVALID-SPI"", ""INVALID-TRANSFORM-ID"", ""ATTRIBUTES-NOT-SUPPORTED"", ""NO-PROPOSAL-CHOSEN"", ""BAD-PROPOSAL-SYNTAX"", ""PAYLOAD-MALFORMED"", ""INVALID-KEY-INFORMATION"", ""INVALID-ID-INFORMATION"", ""INVALID-CERT-ENCODING"", ""INVALID-CERTIFICATE"", ""CERT-TYPE-UNSUPPORTED"", ""INVALID-CERT-AUTHORITY"", ""INVALID-HASH-INFORMATION"", ""AUTHENTICATION-FAILED"", ""INVALID-SIGNATURE"", ""ADDRESS-NOTIFICATION"", ""NOTIFY-SA-LIFETIME"", ""CERTIFICATE-UNAVAILABLE"", ""UNSUPPORTED-EXCHANGE-TYPE"", ""UNEQUAL-PAYLOAD-LENGTHS"", }; static const char *ipsec_notify_error_str[] = { ""RESERVED"", }; static const char *notify_status_str[] = { ""CONNECTED"", }; static const char *ipsec_notify_status_str[] = { ""RESPONDER-LIFETIME"", ""REPLAY-STATUS"", ""INITIAL-CONTACT"", }; /* NOTE: these macro must be called with x in proper range */ /* 0 - 8191 */ #define NOTIFY_ERROR_STR(x) \ STR_OR_ID((x), notify_error_str) /* 8192 - 16383 */ #define IPSEC_NOTIFY_ERROR_STR(x) \ STR_OR_ID((u_int)((x) - 8192), ipsec_notify_error_str) /* 16384 - 24575 */ #define NOTIFY_STATUS_STR(x) \ STR_OR_ID((u_int)((x) - 16384), notify_status_str) /* 24576 - 32767 */ #define IPSEC_NOTIFY_STATUS_STR(x) \ STR_OR_ID((u_int)((x) - 24576), ipsec_notify_status_str) ND_PRINT((ndo,""%s:"", NPSTR(ISAKMP_NPTYPE_N))); p = (const struct ikev1_pl_n *)ext; ND_TCHECK(*p); UNALIGNED_MEMCPY(&n, ext, sizeof(n)); doi = ntohl(n.doi); proto = n.prot_id; if (doi != 1) { ND_PRINT((ndo,"" doi=%d"", doi)); ND_PRINT((ndo,"" proto=%d"", proto)); if (ntohs(n.type) < 8192) ND_PRINT((ndo,"" type=%s"", NOTIFY_ERROR_STR(ntohs(n.type)))); else if (ntohs(n.type) < 16384) ND_PRINT((ndo,"" type=%s"", numstr(ntohs(n.type)))); else if (ntohs(n.type) < 24576) ND_PRINT((ndo,"" type=%s"", NOTIFY_STATUS_STR(ntohs(n.type)))); else ND_PRINT((ndo,"" type=%s"", numstr(ntohs(n.type)))); if (n.spi_size) { ND_PRINT((ndo,"" spi="")); if (!rawprint(ndo, (const uint8_t *)(p + 1), n.spi_size)) goto trunc; } return (const u_char *)(p + 1) + n.spi_size; } ND_PRINT((ndo,"" doi=ipsec"")); ND_PRINT((ndo,"" proto=%s"", PROTOIDSTR(proto))); if (ntohs(n.type) < 8192) ND_PRINT((ndo,"" type=%s"", NOTIFY_ERROR_STR(ntohs(n.type)))); else if (ntohs(n.type) < 16384) ND_PRINT((ndo,"" type=%s"", IPSEC_NOTIFY_ERROR_STR(ntohs(n.type)))); else if (ntohs(n.type) < 24576) ND_PRINT((ndo,"" type=%s"", NOTIFY_STATUS_STR(ntohs(n.type)))); else if (ntohs(n.type) < 32768) ND_PRINT((ndo,"" type=%s"", IPSEC_NOTIFY_STATUS_STR(ntohs(n.type)))); else ND_PRINT((ndo,"" type=%s"", numstr(ntohs(n.type)))); if (n.spi_size) { ND_PRINT((ndo,"" spi="")); if (!rawprint(ndo, (const uint8_t *)(p + 1), n.spi_size)) goto trunc; } cp = (const u_char *)(p + 1) + n.spi_size; ep2 = (const u_char *)p + item_len; if (cp < ep) { ND_PRINT((ndo,"" orig=("")); switch (ntohs(n.type)) { case IPSECDOI_NTYPE_RESPONDER_LIFETIME: { const struct attrmap *map = oakley_t_map; size_t nmap = sizeof(oakley_t_map)/sizeof(oakley_t_map[0]); while (cp < ep && cp < ep2) { cp = ikev1_attrmap_print(ndo, cp, (ep < ep2) ? ep : ep2, map, nmap); } break; } case IPSECDOI_NTYPE_REPLAY_STATUS: ND_PRINT((ndo,""replay detection %sabled"", EXTRACT_32BITS(cp) ? ""en"" : ""dis"")); break; case ISAKMP_NTYPE_NO_PROPOSAL_CHOSEN: if (ikev1_sub_print(ndo, ISAKMP_NPTYPE_SA, (const struct isakmp_gen *)cp, ep, phase, doi, proto, depth) == NULL) return NULL; break; default: /* NULL is dummy */ isakmp_print(ndo, cp, item_len - sizeof(*p) - n.spi_size, NULL); } ND_PRINT((ndo,"")"")); } return (const u_char *)ext + item_len; trunc: ND_PRINT((ndo,"" [|%s]"", NPSTR(ISAKMP_NPTYPE_N))); return NULL; } ",1 "int tls12_get_sigandhash(unsigned char *p, const EVP_PKEY *pk, const EVP_MD *md) { int sig_id, md_id; if (!md) return 0; md_id = tls12_find_id(EVP_MD_type(md), tls12_md, OSSL_NELEM(tls12_md)); if (md_id == -1) return 0; sig_id = tls12_get_sigid(pk); if (sig_id == -1) return 0; p[0] = (unsigned char)md_id; p[1] = (unsigned char)sig_id; return 1; } ",0 "application_unhandled_file_install (GtkDialog *dialog, gint response_id, ActivateParametersInstall *parameters_install) { char *mime_type; gtk_widget_destroy (GTK_WIDGET (dialog)); parameters_install->dialog = NULL; if (response_id == GTK_RESPONSE_YES) { mime_type = nautilus_file_get_mime_type (parameters_install->file); search_for_application_mime_type (parameters_install, mime_type); g_free (mime_type); } else { /* free as we're not going to get the async dbus callback */ activate_parameters_install_free (parameters_install); } } ",0 "String BaseRenderingContext2D::textAlign() const { return TextAlignName(GetState().GetTextAlign()); } ",0 "GBool RunLengthStream::fillBuf() { int c; int n, i; if (eof) return gFalse; c = str->getChar(); if (c == 0x80 || c == EOF) { eof = gTrue; return gFalse; } if (c < 0x80) { n = c + 1; for (i = 0; i < n; ++i) buf[i] = (char)str->getChar(); } else { n = 0x101 - c; c = str->getChar(); for (i = 0; i < n; ++i) buf[i] = (char)c; } bufPtr = buf; bufEnd = buf + n; return gTrue; } ",0 "base::CommandLine::StringType GetSwitchString(const std::string& flag) { base::CommandLine cmd_line(base::CommandLine::NO_PROGRAM); cmd_line.AppendSwitch(flag); DCHECK_EQ(2U, cmd_line.argv().size()); return cmd_line.argv()[1]; } ",0 "bool BubbleManager::CloseAllMatchingBubbles( BubbleController* bubble, const content::RenderFrameHost* owner, BubbleCloseReason reason) { DCHECK(!bubble || !owner); std::vector> close_queue; ManagerState original_state = manager_state_; manager_state_ = ITERATING_BUBBLES; for (auto i = controllers_.begin(); i != controllers_.end();) { if ((!bubble || bubble == (*i).get()) && (!owner || (*i)->OwningFrameIs(owner)) && (*i)->ShouldClose(reason)) { close_queue.push_back(std::move(*i)); i = controllers_.erase(i); } else { ++i; } } manager_state_ = original_state; for (auto& controller : close_queue) { controller->DoClose(reason); for (auto& observer : observers_) observer.OnBubbleClosed(controller->AsWeakPtr(), reason); } return !close_queue.empty(); } ",0 "ExtensionGlobalError::ExtensionGlobalError( base::WeakPtr extension_service) : current_browser_(NULL), should_delete_self_on_close_(true), extension_service_(extension_service), external_extension_ids_(new ExtensionIdSet), blacklisted_extension_ids_(new ExtensionIdSet), orphaned_extension_ids_(new ExtensionIdSet) { } ",0 "static int __vcc_connect(struct atm_vcc *vcc, struct atm_dev *dev, short vpi, int vci) { struct sock *sk = sk_atm(vcc); int error; if ((vpi != ATM_VPI_UNSPEC && vpi != ATM_VPI_ANY && vpi >> dev->ci_range.vpi_bits) || (vci != ATM_VCI_UNSPEC && vci != ATM_VCI_ANY && vci >> dev->ci_range.vci_bits)) return -EINVAL; if (vci > 0 && vci < ATM_NOT_RSV_VCI && !capable(CAP_NET_BIND_SERVICE)) return -EPERM; error = -ENODEV; if (!try_module_get(dev->ops->owner)) return error; vcc->dev = dev; write_lock_irq(&vcc_sklist_lock); if (test_bit(ATM_DF_REMOVED, &dev->flags) || (error = find_ci(vcc, &vpi, &vci))) { write_unlock_irq(&vcc_sklist_lock); goto fail_module_put; } vcc->vpi = vpi; vcc->vci = vci; __vcc_insert_socket(sk); write_unlock_irq(&vcc_sklist_lock); switch (vcc->qos.aal) { case ATM_AAL0: error = atm_init_aal0(vcc); vcc->stats = &dev->stats.aal0; break; case ATM_AAL34: error = atm_init_aal34(vcc); vcc->stats = &dev->stats.aal34; break; case ATM_NO_AAL: /* ATM_AAL5 is also used in the ""0 for default"" case */ vcc->qos.aal = ATM_AAL5; /* fall through */ case ATM_AAL5: error = atm_init_aal5(vcc); vcc->stats = &dev->stats.aal5; break; default: error = -EPROTOTYPE; } if (!error) error = adjust_tp(&vcc->qos.txtp, vcc->qos.aal); if (!error) error = adjust_tp(&vcc->qos.rxtp, vcc->qos.aal); if (error) goto fail; pr_debug(""VCC %d.%d, AAL %d\n"", vpi, vci, vcc->qos.aal); pr_debug("" TX: %d, PCR %d..%d, SDU %d\n"", vcc->qos.txtp.traffic_class, vcc->qos.txtp.min_pcr, vcc->qos.txtp.max_pcr, vcc->qos.txtp.max_sdu); pr_debug("" RX: %d, PCR %d..%d, SDU %d\n"", vcc->qos.rxtp.traffic_class, vcc->qos.rxtp.min_pcr, vcc->qos.rxtp.max_pcr, vcc->qos.rxtp.max_sdu); if (dev->ops->open) { error = dev->ops->open(vcc); if (error) goto fail; } return 0; fail: vcc_remove_socket(sk); fail_module_put: module_put(dev->ops->owner); /* ensure we get dev module ref count correct */ vcc->dev = NULL; return error; } ",0 "SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, u32 pid, __le64 *eof, bool is_falloc) { struct smb2_file_eof_info info; void *data; unsigned int size; info.EndOfFile = *eof; data = &info; size = sizeof(struct smb2_file_eof_info); if (is_falloc) return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid, FILE_ALLOCATION_INFORMATION, 1, &data, &size); else return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid, FILE_END_OF_FILE_INFORMATION, 1, &data, &size); } ",0 "static void mov_metadata_creation_time(AVDictionary **metadata, time_t time) { char buffer[32]; if (time) { struct tm *ptm; time -= 2082844800; /* seconds between 1904-01-01 and Epoch */ ptm = gmtime(&time); if (!ptm) return; strftime(buffer, sizeof(buffer), ""%Y-%m-%d %H:%M:%S"", ptm); av_dict_set(metadata, ""creation_time"", buffer, 0); } } ",0 "void itostr_extra(JsVarInt vals,char *str,bool signedVal, unsigned int base) { JsVarIntUnsigned val; if (signedVal && vals<0) { *(str++)='-'; val = (JsVarIntUnsigned)(-vals); } else { val = (JsVarIntUnsigned)vals; } JsVarIntUnsigned tmp = val; int digits = 1; while (tmp>=base) { digits++; tmp /= base; } int i; for (i=digits-1;i>=0;i--) { str[i] = itoch((int)(val % base)); val /= base; } str[digits] = 0; } ",0 "void RemoveDuplicateElements( std::vector* elements, std::vector* unique_ids) { DCHECK_EQ(elements->size(), unique_ids->size()); std::vector elements_copy; std::vector unique_ids_copy; for (size_t i = 0; i < elements->size(); ++i) { const string16& element = (*elements)[i]; bool unique = true; for (std::vector::const_iterator copy_iter = elements_copy.begin(); copy_iter != elements_copy.end(); ++copy_iter) { if (element == *copy_iter) { unique = false; break; } } if (unique) { elements_copy.push_back(element); unique_ids_copy.push_back((*unique_ids)[i]); } } elements->assign(elements_copy.begin(), elements_copy.end()); unique_ids->assign(unique_ids_copy.begin(), unique_ids_copy.end()); } ",0 "gpu::ContextResult GLES2DecoderPassthroughImpl::Initialize( const scoped_refptr& surface, const scoped_refptr& context, bool offscreen, const DisallowedFeatures& disallowed_features, const ContextCreationAttribs& attrib_helper) { TRACE_EVENT0(""gpu"", ""GLES2DecoderPassthroughImpl::Initialize""); DCHECK(context->IsCurrent(surface.get())); api_ = gl::g_current_gl_context; context_ = context; surface_ = surface; offscreen_ = offscreen; bool log_non_errors = group_->gpu_preferences().enable_gpu_driver_debug_logging; InitializeGLDebugLogging(log_non_errors, PassthroughGLDebugMessageCallback, this); gpu_tracer_.reset(new GPUTracer(this)); gpu_fence_manager_.reset(new GpuFenceManager()); multi_draw_manager_.reset( new MultiDrawManager(MultiDrawManager::IndexStorageType::Pointer)); auto result = group_->Initialize(this, attrib_helper.context_type, disallowed_features); if (result != gpu::ContextResult::kSuccess) { group_ = nullptr; Destroy(true); return result; } if (IsWebGLContextType(attrib_helper.context_type)) { gfx::ExtensionSet requestable_extensions( gl::GetRequestableGLExtensionsFromCurrentContext()); static constexpr const char* kRequiredFunctionalityExtensions[] = { ""GL_ANGLE_memory_size"", ""GL_CHROMIUM_bind_uniform_location"", ""GL_CHROMIUM_sync_query"", ""GL_EXT_debug_marker"", ""GL_KHR_debug"", ""GL_NV_fence"", }; RequestExtensions(api(), requestable_extensions, kRequiredFunctionalityExtensions, base::size(kRequiredFunctionalityExtensions)); if (request_optional_extensions_) { static constexpr const char* kOptionalFunctionalityExtensions[] = { ""GL_ANGLE_depth_texture"", ""GL_ANGLE_framebuffer_blit"", ""GL_ANGLE_framebuffer_multisample"", ""GL_ANGLE_instanced_arrays"", ""GL_ANGLE_pack_reverse_row_order"", ""GL_ANGLE_texture_compression_dxt1"", ""GL_ANGLE_texture_compression_dxt3"", ""GL_ANGLE_texture_compression_dxt5"", ""GL_ANGLE_texture_usage"", ""GL_ANGLE_translated_shader_source"", ""GL_CHROMIUM_framebuffer_mixed_samples"", ""GL_CHROMIUM_path_rendering"", ""GL_EXT_blend_minmax"", ""GL_EXT_discard_framebuffer"", ""GL_EXT_disjoint_timer_query"", ""GL_EXT_occlusion_query_boolean"", ""GL_EXT_sRGB"", ""GL_EXT_sRGB_write_control"", ""GL_EXT_texture_compression_dxt1"", ""GL_EXT_texture_compression_s3tc_srgb"", ""GL_EXT_texture_format_BGRA8888"", ""GL_EXT_texture_norm16"", ""GL_EXT_texture_rg"", ""GL_EXT_texture_sRGB_decode"", ""GL_EXT_texture_storage"", ""GL_EXT_unpack_subimage"", ""GL_KHR_parallel_shader_compile"", ""GL_KHR_robust_buffer_access_behavior"", ""GL_KHR_texture_compression_astc_hdr"", ""GL_KHR_texture_compression_astc_ldr"", ""GL_NV_pack_subimage"", ""GL_OES_compressed_ETC1_RGB8_texture"", ""GL_OES_depth32"", ""GL_OES_EGL_image"", ""GL_OES_EGL_image_external"", ""GL_OES_EGL_image_external_essl3"", ""GL_OES_packed_depth_stencil"", ""GL_OES_rgb8_rgba8"", ""GL_OES_vertex_array_object"", ""NV_EGL_stream_consumer_external"", }; RequestExtensions(api(), requestable_extensions, kOptionalFunctionalityExtensions, base::size(kOptionalFunctionalityExtensions)); } context->ReinitializeDynamicBindings(); } feature_info_->Initialize(attrib_helper.context_type, true /* is_passthrough_cmd_decoder */, DisallowedFeatures()); #define FAIL_INIT_IF_NOT(feature, message) \ if (!(feature)) { \ Destroy(true); \ LOG(ERROR) << ""ContextResult::kFatalFailure: "" << (message); \ return gpu::ContextResult::kFatalFailure; \ } FAIL_INIT_IF_NOT(feature_info_->feature_flags().angle_robust_client_memory, ""missing GL_ANGLE_robust_client_memory""); FAIL_INIT_IF_NOT( feature_info_->feature_flags().chromium_bind_generates_resource, ""missing GL_CHROMIUM_bind_generates_resource""); FAIL_INIT_IF_NOT(feature_info_->feature_flags().chromium_copy_texture, ""missing GL_CHROMIUM_copy_texture""); FAIL_INIT_IF_NOT(feature_info_->feature_flags().angle_client_arrays, ""missing GL_ANGLE_client_arrays""); FAIL_INIT_IF_NOT(api()->glIsEnabledFn(GL_CLIENT_ARRAYS_ANGLE) == GL_FALSE, ""GL_ANGLE_client_arrays shouldn't be enabled""); FAIL_INIT_IF_NOT(feature_info_->feature_flags().angle_webgl_compatibility == IsWebGLContextType(attrib_helper.context_type), ""missing GL_ANGLE_webgl_compatibility""); FAIL_INIT_IF_NOT(feature_info_->feature_flags().angle_request_extension, ""missing GL_ANGLE_request_extension""); FAIL_INIT_IF_NOT(feature_info_->feature_flags().khr_debug, ""missing GL_KHR_debug""); FAIL_INIT_IF_NOT( !IsWebGL2ComputeContextType(attrib_helper.context_type) || feature_info_->feature_flags().khr_robust_buffer_access_behavior, ""missing GL_KHR_robust_buffer_access_behavior""); FAIL_INIT_IF_NOT(!attrib_helper.enable_oop_rasterization, ""oop rasterization not supported""); #undef FAIL_INIT_IF_NOT bind_generates_resource_ = group_->bind_generates_resource(); resources_ = group_->passthrough_resources(); mailbox_manager_ = group_->mailbox_manager(); GLint num_texture_units = 0; api()->glGetIntegervFn(GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS, &num_texture_units); if (num_texture_units > static_cast(kMaxTextureUnits)) { Destroy(true); LOG(ERROR) << ""kMaxTextureUnits ("" << kMaxTextureUnits << "") must be at least GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS ("" << num_texture_units << "").""; return gpu::ContextResult::kFatalFailure; } active_texture_unit_ = 0; bound_buffers_[GL_ARRAY_BUFFER] = 0; bound_buffers_[GL_ELEMENT_ARRAY_BUFFER] = 0; if (feature_info_->gl_version_info().IsAtLeastGLES(3, 0) || feature_info_->feature_flags().ext_pixel_buffer_object) { bound_buffers_[GL_PIXEL_PACK_BUFFER] = 0; bound_buffers_[GL_PIXEL_UNPACK_BUFFER] = 0; } if (feature_info_->gl_version_info().IsAtLeastGLES(3, 0)) { bound_buffers_[GL_COPY_READ_BUFFER] = 0; bound_buffers_[GL_COPY_WRITE_BUFFER] = 0; bound_buffers_[GL_TRANSFORM_FEEDBACK_BUFFER] = 0; bound_buffers_[GL_UNIFORM_BUFFER] = 0; } if (feature_info_->gl_version_info().IsAtLeastGLES(3, 1)) { bound_buffers_[GL_ATOMIC_COUNTER_BUFFER] = 0; bound_buffers_[GL_SHADER_STORAGE_BUFFER] = 0; bound_buffers_[GL_DRAW_INDIRECT_BUFFER] = 0; bound_buffers_[GL_DISPATCH_INDIRECT_BUFFER] = 0; } if (feature_info_->feature_flags().chromium_texture_filtering_hint && feature_info_->feature_flags().is_swiftshader) { api()->glHintFn(GL_TEXTURE_FILTERING_HINT_CHROMIUM, GL_NICEST); } has_robustness_extension_ = feature_info_->feature_flags().khr_robustness || feature_info_->feature_flags().ext_robustness; lose_context_when_out_of_memory_ = attrib_helper.lose_context_when_out_of_memory; api()->glGetIntegervFn(GL_MAX_TEXTURE_SIZE, &max_2d_texture_size_); api()->glGetIntegervFn(GL_MAX_RENDERBUFFER_SIZE, &max_renderbuffer_size_); max_offscreen_framebuffer_size_ = std::min(max_2d_texture_size_, max_renderbuffer_size_); if (offscreen_) { offscreen_single_buffer_ = attrib_helper.single_buffer; offscreen_target_buffer_preserved_ = attrib_helper.buffer_preserved; const bool multisampled_framebuffers_supported = feature_info_->feature_flags().chromium_framebuffer_multisample; if (attrib_helper.samples > 0 && attrib_helper.sample_buffers > 0 && multisampled_framebuffers_supported && !offscreen_single_buffer_) { GLint max_sample_count = 0; api()->glGetIntegervFn(GL_MAX_SAMPLES_EXT, &max_sample_count); emulated_default_framebuffer_format_.samples = std::min(attrib_helper.samples, max_sample_count); } const bool rgb8_supported = feature_info_->feature_flags().oes_rgb8_rgba8; const bool alpha_channel_requested = attrib_helper.alpha_size > 0; if (rgb8_supported && emulated_default_framebuffer_format_.samples > 0) { emulated_default_framebuffer_format_.color_renderbuffer_internal_format = alpha_channel_requested ? GL_RGBA8 : GL_RGB8; } else { emulated_default_framebuffer_format_.samples = 0; } emulated_default_framebuffer_format_.color_texture_internal_format = alpha_channel_requested ? GL_RGBA : GL_RGB; emulated_default_framebuffer_format_.color_texture_format = emulated_default_framebuffer_format_.color_texture_internal_format; emulated_default_framebuffer_format_.color_texture_type = GL_UNSIGNED_BYTE; const bool depth24_stencil8_supported = feature_info_->feature_flags().packed_depth24_stencil8; if ((attrib_helper.depth_size > 0 || attrib_helper.stencil_size > 0) && depth24_stencil8_supported) { emulated_default_framebuffer_format_.depth_stencil_internal_format = GL_DEPTH24_STENCIL8; } else { if (attrib_helper.depth_size > 0) { emulated_default_framebuffer_format_.depth_internal_format = GL_DEPTH_COMPONENT16; } if (attrib_helper.stencil_size > 0) { emulated_default_framebuffer_format_.stencil_internal_format = GL_STENCIL_INDEX8; } } CheckErrorCallbackState(); emulated_back_buffer_ = std::make_unique( api(), emulated_default_framebuffer_format_, feature_info_.get(), supports_separate_fbo_bindings_); gfx::Size initial_size( std::max(1, attrib_helper.offscreen_framebuffer_size.width()), std::max(1, attrib_helper.offscreen_framebuffer_size.height())); if (!emulated_back_buffer_->Resize(initial_size, feature_info_.get())) { bool was_lost = CheckResetStatus(); Destroy(true); LOG(ERROR) << (was_lost ? ""ContextResult::kTransientFailure: "" : ""ContextResult::kFatalFailure: "") << ""Resize of emulated back buffer failed""; return was_lost ? gpu::ContextResult::kTransientFailure : gpu::ContextResult::kFatalFailure; } if (CheckErrorCallbackState()) { Destroy(true); LOG(ERROR) << ""ContextResult::kFatalFailure: "" ""Creation of the offscreen framebuffer failed because errors were "" ""generated.""; return gpu::ContextResult::kFatalFailure; } framebuffer_id_map_.SetIDMapping( 0, emulated_back_buffer_->framebuffer_service_id); api()->glBindFramebufferEXTFn( GL_FRAMEBUFFER, emulated_back_buffer_->framebuffer_service_id); api()->glViewportFn(0, 0, attrib_helper.offscreen_framebuffer_size.width(), attrib_helper.offscreen_framebuffer_size.height()); } api()->glGetIntegervFn(GL_VIEWPORT, viewport_); api()->glGetIntegervFn(GL_SCISSOR_BOX, scissor_); ApplySurfaceDrawOffset(); set_initialized(); return gpu::ContextResult::kSuccess; } ",0 "static int jas_icclut16_input(jas_iccattrval_t *attrval, jas_stream_t *in, int cnt) { int i; int j; int clutsize; jas_icclut16_t *lut16 = &attrval->data.lut16; lut16->clut = 0; lut16->intabs = 0; lut16->intabsbuf = 0; lut16->outtabs = 0; lut16->outtabsbuf = 0; if (jas_iccgetuint8(in, &lut16->numinchans) || jas_iccgetuint8(in, &lut16->numoutchans) || jas_iccgetuint8(in, &lut16->clutlen) || jas_stream_getc(in) == EOF) goto error; for (i = 0; i < 3; ++i) { for (j = 0; j < 3; ++j) { if (jas_iccgetsint32(in, &lut16->e[i][j])) goto error; } } if (jas_iccgetuint16(in, &lut16->numintabents) || jas_iccgetuint16(in, &lut16->numouttabents)) goto error; clutsize = jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans; if (!(lut16->clut = jas_alloc2(clutsize, sizeof(jas_iccuint16_t))) || !(lut16->intabsbuf = jas_alloc3(lut16->numinchans, lut16->numintabents, sizeof(jas_iccuint16_t))) || !(lut16->intabs = jas_alloc2(lut16->numinchans, sizeof(jas_iccuint16_t *)))) goto error; for (i = 0; i < lut16->numinchans; ++i) lut16->intabs[i] = &lut16->intabsbuf[i * lut16->numintabents]; if (!(lut16->outtabsbuf = jas_alloc3(lut16->numoutchans, lut16->numouttabents, sizeof(jas_iccuint16_t))) || !(lut16->outtabs = jas_alloc2(lut16->numoutchans, sizeof(jas_iccuint16_t *)))) goto error; for (i = 0; i < lut16->numoutchans; ++i) lut16->outtabs[i] = &lut16->outtabsbuf[i * lut16->numouttabents]; for (i = 0; i < lut16->numinchans; ++i) { for (j = 0; j < JAS_CAST(int, lut16->numintabents); ++j) { if (jas_iccgetuint16(in, &lut16->intabs[i][j])) goto error; } } for (i = 0; i < lut16->numoutchans; ++i) { for (j = 0; j < JAS_CAST(int, lut16->numouttabents); ++j) { if (jas_iccgetuint16(in, &lut16->outtabs[i][j])) goto error; } } for (i = 0; i < clutsize; ++i) { if (jas_iccgetuint16(in, &lut16->clut[i])) goto error; } if (JAS_CAST(int, 44 + 2 * (lut16->numinchans * lut16->numintabents + lut16->numoutchans * lut16->numouttabents + jas_iccpowi(lut16->clutlen, lut16->numinchans) * lut16->numoutchans)) != cnt) goto error; return 0; error: jas_icclut16_destroy(attrval); return -1; } ",0 "BrowserTabStripController::~BrowserTabStripController() { if (context_menu_contents_.get()) context_menu_contents_->Cancel(); model_->RemoveObserver(this); } ",0 "static int proc_get_capabilities(struct usb_dev_state *ps, void __user *arg) { __u32 caps; caps = USBDEVFS_CAP_ZERO_PACKET | USBDEVFS_CAP_NO_PACKET_SIZE_LIM | USBDEVFS_CAP_REAP_AFTER_DISCONNECT | USBDEVFS_CAP_MMAP | USBDEVFS_CAP_DROP_PRIVILEGES; if (!ps->dev->bus->no_stop_on_short) caps |= USBDEVFS_CAP_BULK_CONTINUATION; if (ps->dev->bus->sg_tablesize) caps |= USBDEVFS_CAP_BULK_SCATTER_GATHER; if (put_user(caps, (__u32 __user *)arg)) return -EFAULT; return 0; } ",0 "bool HTMLFormControlElement::willValidate() const { if (!m_willValidateInitialized || m_dataListAncestorState == Unknown) { const_cast(this)->setNeedsWillValidateCheck(); } else { ASSERT(m_willValidate == recalcWillValidate()); } return m_willValidate; } ",0 "void VideoCaptureImpl::OnDeviceFormatsInUse( const VideoCaptureDeviceFormatsCB& callback, const media::VideoCaptureFormats& formats_in_use) { DCHECK(io_thread_checker_.CalledOnValidThread()); callback.Run(formats_in_use); } ",0 "RenderMessageFilter::RenderMessageFilter( int render_process_id, PluginServiceImpl* plugin_service, BrowserContext* browser_context, net::URLRequestContextGetter* request_context, RenderWidgetHelper* render_widget_helper, MediaInternals* media_internals, DOMStorageContextImpl* dom_storage_context) : resource_dispatcher_host_(ResourceDispatcherHostImpl::Get()), plugin_service_(plugin_service), profile_data_directory_(browser_context->GetPath()), request_context_(request_context), resource_context_(browser_context->GetResourceContext()), render_widget_helper_(render_widget_helper), incognito_(browser_context->IsOffTheRecord()), dom_storage_context_(dom_storage_context), render_process_id_(render_process_id), cpu_usage_(0), media_internals_(media_internals) { DCHECK(request_context_); render_widget_helper_->Init(render_process_id_, resource_dispatcher_host_); } ",0 "void RenderBlock::adjustLinePositionForPagination(RootInlineBox* lineBox, LayoutUnit& delta, RenderFlowThread* flowThread) { LayoutRect logicalVisualOverflow = lineBox->logicalVisualOverflowRect(lineBox->lineTop(), lineBox->lineBottom()); LayoutUnit logicalOffset = min(lineBox->lineTopWithLeading(), logicalVisualOverflow.y()); LayoutUnit logicalBottom = max(lineBox->lineBottomWithLeading(), logicalVisualOverflow.maxY()); LayoutUnit lineHeight = logicalBottom - logicalOffset; updateMinimumPageHeight(logicalOffset, calculateMinimumPageHeight(style(), lineBox, logicalOffset, logicalBottom)); logicalOffset += delta; lineBox->setPaginationStrut(0); lineBox->setIsFirstAfterPageBreak(false); LayoutUnit pageLogicalHeight = pageLogicalHeightForOffset(logicalOffset); bool hasUniformPageLogicalHeight = !flowThread || flowThread->regionsHaveUniformLogicalHeight(); if (!pageLogicalHeight || (hasUniformPageLogicalHeight && logicalVisualOverflow.height() > pageLogicalHeight)) return; LayoutUnit remainingLogicalHeight = pageRemainingLogicalHeightForOffset(logicalOffset, ExcludePageBoundary); int lineIndex = lineCount(lineBox); if (remainingLogicalHeight < lineHeight || (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex)) { if (shouldBreakAtLineToAvoidWidow() && lineBreakToAvoidWidow() == lineIndex) { clearShouldBreakAtLineToAvoidWidow(); setDidBreakAtLineToAvoidWidow(); } if (lineHeight > pageLogicalHeight) { remainingLogicalHeight -= min(lineHeight - pageLogicalHeight, max(0, logicalVisualOverflow.y() - lineBox->lineTopWithLeading())); } LayoutUnit totalLogicalHeight = lineHeight + max(0, logicalOffset); LayoutUnit pageLogicalHeightAtNewOffset = hasUniformPageLogicalHeight ? pageLogicalHeight : pageLogicalHeightForOffset(logicalOffset + remainingLogicalHeight); setPageBreak(logicalOffset, lineHeight - remainingLogicalHeight); if (((lineBox == firstRootBox() && totalLogicalHeight < pageLogicalHeightAtNewOffset) || (!style()->hasAutoOrphans() && style()->orphans() >= lineIndex)) && !isOutOfFlowPositioned() && !isTableCell()) setPaginationStrut(remainingLogicalHeight + max(0, logicalOffset)); else { delta += remainingLogicalHeight; lineBox->setPaginationStrut(remainingLogicalHeight); lineBox->setIsFirstAfterPageBreak(true); } } else if (remainingLogicalHeight == pageLogicalHeight) { if (lineBox != firstRootBox()) lineBox->setIsFirstAfterPageBreak(true); if (lineBox != firstRootBox() || offsetFromLogicalTopOfFirstPage()) setPageBreak(logicalOffset, lineHeight); } } ",0 "static void tower_abort_transfers (struct lego_usb_tower *dev) { if (dev == NULL) return; /* shutdown transfer */ if (dev->interrupt_in_running) { dev->interrupt_in_running = 0; mb(); if (dev->udev) usb_kill_urb (dev->interrupt_in_urb); } if (dev->interrupt_out_busy && dev->udev) usb_kill_urb(dev->interrupt_out_urb); } ",0 "BaseAudioContext::BaseAudioContext(Document* document, enum ContextType context_type) : PausableObject(document), destination_node_(nullptr), uuid_(CreateCanonicalUUIDString()), is_cleared_(false), is_resolving_resume_promises_(false), has_posted_cleanup_task_(false), deferred_task_handler_(DeferredTaskHandler::Create()), context_state_(kSuspended), periodic_wave_sine_(nullptr), periodic_wave_square_(nullptr), periodic_wave_sawtooth_(nullptr), periodic_wave_triangle_(nullptr), output_position_() {} ",0 "static const char *aac_info(struct Scsi_Host *shost) { struct aac_dev *dev = (struct aac_dev *)shost->hostdata; return aac_drivers[dev->cardtype].name; } ",0 "bool NetworkThrottleManagerImpl::ConditionallyTriggerTimerForTesting() { if (!outstanding_recomputation_timer_->IsRunning() || (tick_clock_->NowTicks() < outstanding_recomputation_timer_->desired_run_time())) { return false; } base::Closure timer_callback(outstanding_recomputation_timer_->user_task()); outstanding_recomputation_timer_->Stop(); timer_callback.Run(); return true; } ",0 "static int dm_pr_preempt(struct block_device *bdev, u64 old_key, u64 new_key, enum pr_type type, bool abort) { struct mapped_device *md = bdev->bd_disk->private_data; const struct pr_ops *ops; fmode_t mode; int r; r = dm_grab_bdev_for_ioctl(md, &bdev, &mode); if (r < 0) return r; ops = bdev->bd_disk->fops->pr_ops; if (ops && ops->pr_preempt) r = ops->pr_preempt(bdev, old_key, new_key, type, abort); else r = -EOPNOTSUPP; bdput(bdev); return r; } ",0 "PaletteDelegateChromeOS::PaletteDelegateChromeOS() {} ",0 "static inline void end_dir_add(struct inode *dir, unsigned n) { smp_store_release(&dir->i_dir_seq, n + 2); } ",0 "long Chapters::ParseEdition( long long pos, long long size) { if (!ExpandEditionsArray()) return -1; Edition& e = m_editions[m_editions_count++]; e.Init(); return e.Parse(m_pSegment->m_pReader, pos, size); } ",1 " long vorbis_book_decodevv_add(codebook *book,ogg_int32_t **a, long offset,int ch, oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ ogg_int32_t *v = book->dec_buf;//(ogg_int32_t *)alloca(sizeof(*v)*book->dim); long i,j; int chptr=0; if (!v) return -1; for(i=offset;idim;j++){ a[chptr++][i]+=v[j]; if(chptr==ch){ chptr=0; i++; } } } } return 0; } ",1 "static inline int vop_vdev_inited(struct vop_vdev *vdev) { if (!vdev) return -EINVAL; /* Device has not been created yet */ if (!vdev->dd || !vdev->dd->type) { dev_err(vop_dev(vdev), ""%s %d err %d\n"", __func__, __LINE__, -EINVAL); return -EINVAL; } /* Device has been removed/deleted */ if (vdev->dd->type == -1) { dev_dbg(vop_dev(vdev), ""%s %d err %d\n"", __func__, __LINE__, -ENODEV); return -ENODEV; } return 0; } ",0 "int ZLIB_INTERNAL inflate_table(type, lens, codes, table, bits, work) codetype type; unsigned short FAR *lens; unsigned codes; code FAR * FAR *table; unsigned FAR *bits; unsigned short FAR *work; { unsigned len; /* a code's length in bits */ unsigned sym; /* index of code symbols */ unsigned min, max; /* minimum and maximum code lengths */ unsigned root; /* number of index bits for root table */ unsigned curr; /* number of index bits for current table */ unsigned drop; /* code bits to drop for sub-table */ int left; /* number of prefix codes available */ unsigned used; /* code entries in table used */ unsigned huff; /* Huffman code */ unsigned incr; /* for incrementing code, index */ unsigned fill; /* index for replicating entries */ unsigned low; /* low bits for current root entry */ unsigned mask; /* mask for low root bits */ code here; /* table entry for duplication */ code FAR *next; /* next available space in table */ const unsigned short FAR *base; /* base value table to use */ const unsigned short FAR *extra; /* extra bits table to use */ int end; /* use base and extra for symbol > end */ unsigned short count[MAXBITS+1]; /* number of codes of each length */ unsigned short offs[MAXBITS+1]; /* offsets in table for each length */ static const unsigned short lbase[31] = { /* Length codes 257..285 base */ 3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51, 59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0}; static const unsigned short lext[31] = { /* Length codes 257..285 extra */ 16, 16, 16, 16, 16, 16, 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 21, 21, 21, 21, 16, 203, 198}; static const unsigned short dbase[32] = { /* Distance codes 0..29 base */ 1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385, 513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577, 0, 0}; static const unsigned short dext[32] = { /* Distance codes 0..29 extra */ 16, 16, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 64, 64}; /* Process a set of code lengths to create a canonical Huffman code. The code lengths are lens[0..codes-1]. Each length corresponds to the symbols 0..codes-1. The Huffman code is generated by first sorting the symbols by length from short to long, and retaining the symbol order for codes with equal lengths. Then the code starts with all zero bits for the first code of the shortest length, and the codes are integer increments for the same length, and zeros are appended as the length increases. For the deflate format, these bits are stored backwards from their more natural integer increment ordering, and so when the decoding tables are built in the large loop below, the integer codes are incremented backwards. This routine assumes, but does not check, that all of the entries in lens[] are in the range 0..MAXBITS. The caller must assure this. 1..MAXBITS is interpreted as that code length. zero means that that symbol does not occur in this code. The codes are sorted by computing a count of codes for each length, creating from that a table of starting indices for each length in the sorted table, and then entering the symbols in order in the sorted table. The sorted table is work[], with that space being provided by the caller. The length counts are used for other purposes as well, i.e. finding the minimum and maximum length codes, determining if there are any codes at all, checking for a valid set of lengths, and looking ahead at length counts to determine sub-table sizes when building the decoding tables. */ /* accumulate lengths for codes (assumes lens[] all in 0..MAXBITS) */ for (len = 0; len <= MAXBITS; len++) count[len] = 0; for (sym = 0; sym < codes; sym++) count[lens[sym]]++; /* bound code lengths, force root to be within code lengths */ root = *bits; for (max = MAXBITS; max >= 1; max--) if (count[max] != 0) break; if (root > max) root = max; if (max == 0) { /* no symbols to code at all */ here.op = (unsigned char)64; /* invalid code marker */ here.bits = (unsigned char)1; here.val = (unsigned short)0; *(*table)++ = here; /* make a table to force an error */ *(*table)++ = here; *bits = 1; return 0; /* no symbols, but wait for decoding to report error */ } for (min = 1; min < max; min++) if (count[min] != 0) break; if (root < min) root = min; /* check for an over-subscribed or incomplete set of lengths */ left = 1; for (len = 1; len <= MAXBITS; len++) { left <<= 1; left -= count[len]; if (left < 0) return -1; /* over-subscribed */ } if (left > 0 && (type == CODES || max != 1)) return -1; /* incomplete set */ /* generate offsets into symbol table for each length for sorting */ offs[1] = 0; for (len = 1; len < MAXBITS; len++) offs[len + 1] = offs[len] + count[len]; /* sort symbols by length, by symbol order within each length */ for (sym = 0; sym < codes; sym++) if (lens[sym] != 0) work[offs[lens[sym]]++] = (unsigned short)sym; /* Create and fill in decoding tables. In this loop, the table being filled is at next and has curr index bits. The code being used is huff with length len. That code is converted to an index by dropping drop bits off of the bottom. For codes where len is less than drop + curr, those top drop + curr - len bits are incremented through all values to fill the table with replicated entries. root is the number of index bits for the root table. When len exceeds root, sub-tables are created pointed to by the root entry with an index of the low root bits of huff. This is saved in low to check for when a new sub-table should be started. drop is zero when the root table is being filled, and drop is root when sub-tables are being filled. When a new sub-table is needed, it is necessary to look ahead in the code lengths to determine what size sub-table is needed. The length counts are used for this, and so count[] is decremented as codes are entered in the tables. used keeps track of how many table entries have been allocated from the provided *table space. It is checked for LENS and DIST tables against the constants ENOUGH_LENS and ENOUGH_DISTS to guard against changes in the initial root table size constants. See the comments in inftrees.h for more information. sym increments through all symbols, and the loop terminates when all codes of length max, i.e. all codes, have been processed. This routine permits incomplete codes, so another loop after this one fills in the rest of the decoding tables with invalid code markers. */ /* set up for code type */ switch (type) { case CODES: base = extra = work; /* dummy value--not used */ end = 19; break; case LENS: base = lbase; base -= 257; extra = lext; extra -= 257; end = 256; break; default: /* DISTS */ base = dbase; extra = dext; end = -1; } /* initialize state for loop */ huff = 0; /* starting code */ sym = 0; /* starting code symbol */ len = min; /* starting code length */ next = *table; /* current table to fill in */ curr = root; /* current table index bits */ drop = 0; /* current bits to drop from code for index */ low = (unsigned)(-1); /* trigger new sub-table when len > root */ used = 1U << root; /* use root table entries */ mask = used - 1; /* mask for comparing low */ /* check available table space */ if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS)) return 1; /* process all codes and make table entries */ for (;;) { /* create table entry */ here.bits = (unsigned char)(len - drop); if ((int)(work[sym]) < end) { here.op = (unsigned char)0; here.val = work[sym]; } else if ((int)(work[sym]) > end) { here.op = (unsigned char)(extra[work[sym]]); here.val = base[work[sym]]; } else { here.op = (unsigned char)(32 + 64); /* end of block */ here.val = 0; } /* replicate for those indices with low len bits equal to huff */ incr = 1U << (len - drop); fill = 1U << curr; min = fill; /* save offset to next table */ do { fill -= incr; next[(huff >> drop) + fill] = here; } while (fill != 0); /* backwards increment the len-bit code huff */ incr = 1U << (len - 1); while (huff & incr) incr >>= 1; if (incr != 0) { huff &= incr - 1; huff += incr; } else huff = 0; /* go to next symbol, update count, len */ sym++; if (--(count[len]) == 0) { if (len == max) break; len = lens[work[sym]]; } /* create new sub-table if needed */ if (len > root && (huff & mask) != low) { /* if first time, transition to sub-tables */ if (drop == 0) drop = root; /* increment past last table */ next += min; /* here min is 1 << curr */ /* determine length of next table */ curr = len - drop; left = (int)(1 << curr); while (curr + drop < max) { left -= count[curr + drop]; if (left <= 0) break; curr++; left <<= 1; } /* check for enough space */ used += 1U << curr; if ((type == LENS && used > ENOUGH_LENS) || (type == DISTS && used > ENOUGH_DISTS)) return 1; /* point entry in root table to sub-table */ low = huff & mask; (*table)[low].op = (unsigned char)curr; (*table)[low].bits = (unsigned char)root; (*table)[low].val = (unsigned short)(next - *table); } } /* fill in remaining table entry if code is incomplete (guaranteed to have at most one remaining entry, since if the code is incomplete, the maximum code length that was allowed to get this far is one bit) */ if (huff != 0) { here.op = (unsigned char)64; /* invalid code marker */ here.bits = (unsigned char)(len - drop); here.val = (unsigned short)0; next[huff] = here; } /* set return parameters */ *table += used; *bits = root; return 0; } ",1 "bool TabsRemoveFunction::RemoveTab(int tab_id, std::string* error) { Browser* browser = NULL; WebContents* contents = NULL; if (!GetTabById(tab_id, browser_context(), include_incognito(), &browser, nullptr, &contents, nullptr, error)) { return false; } if (!browser->window()->IsTabStripEditable()) { *error = keys::kTabStripNotEditableError; return false; } contents->Close(); return true; } ",0 "UnloadController::UnloadController(Browser* browser) : browser_(browser), is_attempting_to_close_browser_(false), ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { browser_->tab_strip_model()->AddObserver(this); } ",0 "void ExtensionService::LoadExtensionFromCommandLine( const FilePath& path_in) { base::ThreadRestrictions::ScopedAllowIO allow_io; FilePath extension_path = path_in; file_util::AbsolutePath(&extension_path); std::string id = Extension::GenerateIdForPath(extension_path); bool allow_file_access = Extension::ShouldAlwaysAllowFileAccess(Extension::LOAD); if (extension_prefs()->HasAllowFileAccessSetting(id)) allow_file_access = extension_prefs()->AllowFileAccess(id); int flags = Extension::NO_FLAGS; if (allow_file_access) flags |= Extension::ALLOW_FILE_ACCESS; if (Extension::ShouldDoStrictErrorChecking(Extension::LOAD)) flags |= Extension::STRICT_ERROR_CHECKS; std::string error; scoped_refptr extension(extension_file_util::LoadExtension( extension_path, Extension::LOAD, flags, &error)); if (!extension) { ReportExtensionLoadError( extension_path, error, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, true); return; } OnLoadSingleExtension(extension, false); } ",0 "box_in(PG_FUNCTION_ARGS) { char *str = PG_GETARG_CSTRING(0); BOX *box = (BOX *) palloc(sizeof(BOX)); int isopen; char *s; double x, y; if ((!path_decode(FALSE, 2, str, &isopen, &s, &(box->high))) || (*s != '\0')) ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg(""invalid input syntax for type box: \""%s\"""", str))); /* reorder corners if necessary... */ if (box->high.x < box->low.x) { x = box->high.x; box->high.x = box->low.x; box->low.x = x; } if (box->high.y < box->low.y) { y = box->high.y; box->high.y = box->low.y; box->low.y = y; } PG_RETURN_BOX_P(box); } ",0 "convert_fname (char *fname) { char *converted_fname = fname; const char *from_encoding = opt.encoding_remote; const char *to_encoding = opt.locale; iconv_t cd; size_t len, done, inlen, outlen; char *s; const char *orig_fname = fname; /* Defaults for remote and local encodings. */ if (!from_encoding) from_encoding = ""UTF-8""; if (!to_encoding) to_encoding = nl_langinfo (CODESET); cd = iconv_open (to_encoding, from_encoding); if (cd == (iconv_t)(-1)) logprintf (LOG_VERBOSE, _(""Conversion from %s to %s isn't supported\n""), quote (from_encoding), quote (to_encoding)); else { inlen = strlen (fname); len = outlen = inlen * 2; converted_fname = s = xmalloc (outlen + 1); done = 0; for (;;) { if (iconv (cd, (ICONV_CONST char **) &fname, &inlen, &s, &outlen) != (size_t)(-1) && iconv (cd, NULL, NULL, &s, &outlen) != (size_t)(-1)) { *(converted_fname + len - outlen - done) = '\0'; iconv_close(cd); DEBUGP ((""Converted file name '%s' (%s) -> '%s' (%s)\n"", orig_fname, from_encoding, converted_fname, to_encoding)); xfree (orig_fname); return converted_fname; } /* Incomplete or invalid multibyte sequence */ if (errno == EINVAL || errno == EILSEQ) { logprintf (LOG_VERBOSE, _(""Incomplete or invalid multibyte sequence encountered\n"")); xfree (converted_fname); converted_fname = (char *)orig_fname; break; } else if (errno == E2BIG) /* Output buffer full */ { done = len; len = outlen = done + inlen * 2; converted_fname = xrealloc (converted_fname, outlen + 1); s = converted_fname + done; } else /* Weird, we got an unspecified error */ { logprintf (LOG_VERBOSE, _(""Unhandled errno %d\n""), errno); xfree (converted_fname); converted_fname = (char *)orig_fname; break; } } DEBUGP ((""Failed to convert file name '%s' (%s) -> '?' (%s)\n"", orig_fname, from_encoding, to_encoding)); } iconv_close(cd); return converted_fname; } ",0 "static int sysfs_slab_add(struct kmem_cache *s) { int err; const char *name; int unmergeable; if (slab_state < SYSFS) /* Defer until later */ return 0; unmergeable = slab_unmergeable(s); if (unmergeable) { /* * Slabcache can never be merged so we can use the name proper. * This is typically the case for debug situations. In that * case we can catch duplicate names easily. */ sysfs_remove_link(&slab_kset->kobj, s->name); name = s->name; } else { /* * Create a unique name for the slab as a target * for the symlinks. */ name = create_unique_id(s); } s->kobj.kset = slab_kset; err = kobject_init_and_add(&s->kobj, &slab_ktype, NULL, name); if (err) { kobject_put(&s->kobj); return err; } err = sysfs_create_group(&s->kobj, &slab_attr_group); if (err) return err; kobject_uevent(&s->kobj, KOBJ_ADD); if (!unmergeable) { /* Setup first alias */ sysfs_slab_alias(s, s->name); kfree(name); } return 0; } ",0 "void *writer(void *arg) { int i; while(1) { struct squashfs_file *file = queue_get(to_writer); int file_fd; long long hole = 0; int failed = FALSE; int error; if(file == NULL) { queue_put(from_writer, NULL); continue; } else if(file->fd == -1) { /* write attributes for directory file->pathname */ set_attributes(file->pathname, file->mode, file->uid, file->gid, file->time, file->xattr, TRUE); free(file->pathname); free(file); continue; } TRACE(""writer: regular file, blocks %d\n"", file->blocks); file_fd = file->fd; for(i = 0; i < file->blocks; i++, cur_blocks ++) { struct file_entry *block = queue_get(to_writer); if(block->buffer == 0) { /* sparse file */ hole += block->size; free(block); continue; } cache_block_wait(block->buffer); if(block->buffer->error) FAILED = failed = TRUE; if(failed) continue; error = write_block(file_fd, block->buffer->data + block->offset, block->size, hole, file->sparse); if(error == FALSE) { ERROR(""writer: failed to write data block %d\n"", i); FAILED = failed = TRUE; } hole = 0; cache_block_put(block->buffer); free(block); } if(hole && failed == FALSE) { /* * corner case for hole extending to end of file */ if(file->sparse == FALSE || lseek(file_fd, hole, SEEK_CUR) == -1) { /* * for files which we don't want to write * sparsely, or for broken lseeks which cannot * seek beyond end of file, write_block will do * the right thing */ hole --; if(write_block(file_fd, ""\0"", 1, hole, file->sparse) == FALSE) { ERROR(""writer: failed to write sparse "" ""data block\n""); FAILED = failed = TRUE; } } else if(ftruncate(file_fd, file->file_size) == -1) { ERROR(""writer: failed to write sparse data "" ""block\n""); FAILED = failed = TRUE; } } close_wake(file_fd); if(failed == FALSE) set_attributes(file->pathname, file->mode, file->uid, file->gid, file->time, file->xattr, force); else { ERROR(""Failed to write %s, skipping\n"", file->pathname); unlink(file->pathname); } free(file->pathname); free(file); } } ",0 "void Document::setVisualUpdatesAllowed(bool visualUpdatesAllowed) { if (m_visualUpdatesAllowed == visualUpdatesAllowed) return; m_visualUpdatesAllowed = visualUpdatesAllowed; if (!visualUpdatesAllowed) return; FrameView* frameView = view(); bool needsLayout = frameView && renderer() && (frameView->layoutPending() || renderer()->needsLayout()); if (needsLayout) { return; } #if USE(ACCELERATED_COMPOSITING) if (view()) view()->updateCompositingLayersAfterLayout(); #endif if (renderer()) renderer()->repaint(); } ",0 "LocalReaderProxy::~LocalReaderProxy() { } ",0 "void ChromeContentBrowserClient::ShowClientCertificateRequestDialog( int render_process_id, int render_view_id, SSLClientAuthHandler* handler) { TabContents* tab = tab_util::GetTabContentsByID( render_process_id, render_view_id); if (!tab) { NOTREACHED(); return; } TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(tab); wrapper->ssl_helper()->ShowClientCertificateRequestDialog(handler); } ",0 "void Browser::NewTab() { UserMetrics::RecordAction(UserMetricsAction(""NewTab"")); if (is_type_tabbed()) { AddBlankTab(true); GetSelectedTabContentsWrapper()->view()->RestoreFocus(); } else { Browser* b = GetOrCreateTabbedBrowser(profile_); b->AddBlankTab(true); b->window()->Show(); b->GetSelectedTabContentsWrapper()->view()->RestoreFocus(); } } ",0 "void WebContentsImpl::OnBrowserPluginMessage(const IPC::Message& message) { CHECK(!browser_plugin_embedder_.get()); browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this)); browser_plugin_embedder_->OnMessageReceived(message); } ",0 "static void coroutine_fn v9fs_create(void *opaque) { int32_t fid; int err = 0; size_t offset = 7; V9fsFidState *fidp; V9fsQID qid; int32_t perm; int8_t mode; V9fsPath path; struct stat stbuf; V9fsString name; V9fsString extension; int iounit; V9fsPDU *pdu = opaque; v9fs_path_init(&path); v9fs_string_init(&name); v9fs_string_init(&extension); err = pdu_unmarshal(pdu, offset, ""dsdbs"", &fid, &name, &perm, &mode, &extension); if (err < 0) { goto out_nofid; } trace_v9fs_create(pdu->tag, pdu->id, fid, name.data, perm, mode); if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(""."", name.data) || !strcmp("".."", name.data)) { err = -EEXIST; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (perm & P9_STAT_MODE_DIR) { err = v9fs_co_mkdir(pdu, fidp, &name, perm & 0777, fidp->uid, -1, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_opendir(pdu, fidp); if (err < 0) { goto out; } fidp->fid_type = P9_FID_DIR; } else if (perm & P9_STAT_MODE_SYMLINK) { err = v9fs_co_symlink(pdu, fidp, &name, extension.data, -1 , &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_LINK) { int32_t ofid = atoi(extension.data); V9fsFidState *ofidp = get_fid(pdu, ofid); if (ofidp == NULL) { err = -EINVAL; goto out; } err = v9fs_co_link(pdu, ofidp, fidp, &name); put_fid(pdu, ofidp); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } v9fs_path_copy(&fidp->path, &path); err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { fidp->fid_type = P9_FID_NONE; goto out; } } else if (perm & P9_STAT_MODE_DEVICE) { char ctype; uint32_t major, minor; mode_t nmode = 0; if (sscanf(extension.data, ""%c %u %u"", &ctype, &major, &minor) != 3) { err = -errno; goto out; } switch (ctype) { case 'c': nmode = S_IFCHR; break; case 'b': nmode = S_IFBLK; break; default: err = -EIO; goto out; } nmode |= perm & 0777; err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, makedev(major, minor), nmode, &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_NAMED_PIPE) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFIFO | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else if (perm & P9_STAT_MODE_SOCKET) { err = v9fs_co_mknod(pdu, fidp, &name, fidp->uid, -1, 0, S_IFSOCK | (perm & 0777), &stbuf); if (err < 0) { goto out; } err = v9fs_co_name_to_path(pdu, &fidp->path, name.data, &path); if (err < 0) { goto out; } v9fs_path_copy(&fidp->path, &path); } else { err = v9fs_co_open2(pdu, fidp, &name, -1, omode_to_uflags(mode)|O_CREAT, perm, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = omode_to_uflags(mode); if (fidp->open_flags & O_EXCL) { /* * We let the host file system do O_EXCL check * We should not reclaim such fd */ fidp->flags |= FID_NON_RECLAIMABLE; } } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); err = pdu_marshal(pdu, offset, ""Qd"", &qid, iounit); if (err < 0) { goto out; } err += offset; trace_v9fs_create_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit); out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); v9fs_string_free(&extension); v9fs_path_free(&path); } ",0 "PHP_METHOD(Phar, isValidPharFilename) { char *fname; const char *ext_str; int fname_len, ext_len, is_executable; zend_bool executable = 1; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s|b"", &fname, &fname_len, &executable) == FAILURE) { return; } is_executable = executable; RETVAL_BOOL(phar_detect_phar_fname_ext(fname, fname_len, &ext_str, &ext_len, is_executable, 2, 1 TSRMLS_CC) == SUCCESS); } ",0 "void perf_event_fork(struct task_struct *task) { perf_event_task(task, NULL, 1); } ",0 "set_persistent_config(char *admin, char *config) { int fd, rval; char *tmp; MyString filename; MyString tmp_filename; priv_state priv; if (!admin || !admin[0] || !enable_persistent) { if (!enable_persistent) { dprintf( D_ALWAYS, ""set_persistent_config(): "" ""ENABLE_PERSISTENT_CONFIG is false. "" ""Not setting persistent config file param: "" ""Name = %s, Value = %s\n"", admin?admin:""(null pointer)"", config?config:""(null pointer)""); } if (admin) { free(admin); } if (config) { free(config); } return -1; } init_dynamic_config(); if( ! toplevel_persistent_config.Length() ) { EXCEPT( ""Impossible: programmer error: toplevel_persistent_config "" ""is 0-length, but we already initialized, enable_persistent "" ""is TRUE, and set_persistent_config() has been called"" ); } priv = set_root_priv(); if (config && config[0]) { // (re-)set config filename.sprintf( ""%s.%s"", toplevel_persistent_config.Value(), admin ); tmp_filename.sprintf( ""%s.tmp"", filename.Value() ); do { unlink( tmp_filename.Value() ); fd = safe_open_wrapper_follow( tmp_filename.Value(), O_WRONLY|O_CREAT|O_EXCL, 0644 ); } while (fd == -1 && errno == EEXIST); if( fd < 0 ) { dprintf( D_ALWAYS, ""safe_open_wrapper(%s) returned %d '%s' (errno %d) in "" ""set_persistent_config()\n"", tmp_filename.Value(), fd, strerror(errno), errno ); ABORT; } if (write(fd, config, strlen(config)) != (ssize_t)strlen(config)) { dprintf( D_ALWAYS, ""write() failed with '%s' (errno %d) in "" ""set_persistent_config()\n"", strerror(errno), errno ); ABORT; } if (close(fd) < 0) { dprintf( D_ALWAYS, ""close() failed with '%s' (errno %d) in "" ""set_persistent_config()\n"", strerror(errno), errno ); ABORT; } if (rotate_file(tmp_filename.Value(), filename.Value()) < 0) { dprintf( D_ALWAYS, ""rotate_file(%s,%s) failed with '%s' "" ""(errno %d) in set_persistent_config()\n"", tmp_filename.Value(), filename.Value(), strerror(errno), errno ); ABORT; } if (!PersistAdminList.contains(admin)) { PersistAdminList.append(admin); } else { free(admin); free(config); set_priv(priv); return 0; // if no update is required, then we are done } } else { // clear config PersistAdminList.remove(admin); if (config) { free(config); config = NULL; } } tmp_filename.sprintf( ""%s.tmp"", toplevel_persistent_config.Value() ); do { unlink( tmp_filename.Value() ); fd = safe_open_wrapper_follow( tmp_filename.Value(), O_WRONLY|O_CREAT|O_EXCL, 0644 ); } while (fd == -1 && errno == EEXIST); if( fd < 0 ) { dprintf( D_ALWAYS, ""safe_open_wrapper(%s) returned %d '%s' (errno %d) in "" ""set_persistent_config()\n"", tmp_filename.Value(), fd, strerror(errno), errno ); ABORT; } const char param[] = ""RUNTIME_CONFIG_ADMIN = ""; if (write(fd, param, strlen(param)) != (ssize_t)strlen(param)) { dprintf( D_ALWAYS, ""write() failed with '%s' (errno %d) in "" ""set_persistent_config()\n"", strerror(errno), errno ); ABORT; } PersistAdminList.rewind(); bool first_time = true; while( (tmp = PersistAdminList.next()) ) { if (!first_time) { if (write(fd, "", "", 2) != 2) { dprintf( D_ALWAYS, ""write() failed with '%s' (errno %d) in "" ""set_persistent_config()\n"", strerror(errno), errno ); ABORT; } } else { first_time = false; } if (write(fd, tmp, strlen(tmp)) != (ssize_t)strlen(tmp)) { dprintf( D_ALWAYS, ""write() failed with '%s' (errno %d) in "" ""set_persistent_config()\n"", strerror(errno), errno ); ABORT; } } if (write(fd, ""\n"", 1) != 1) { dprintf( D_ALWAYS, ""write() failed with '%s' (errno %d) in "" ""set_persistent_config()\n"", strerror(errno), errno ); ABORT; } if (close(fd) < 0) { dprintf( D_ALWAYS, ""close() failed with '%s' (errno %d) in "" ""set_persistent_config()\n"", strerror(errno), errno ); ABORT; } rval = rotate_file( tmp_filename.Value(), toplevel_persistent_config.Value() ); if (rval < 0) { dprintf( D_ALWAYS, ""rotate_file(%s,%s) failed with '%s' (errno %d) "" ""in set_persistent_config()\n"", tmp_filename.Value(), filename.Value(), strerror(errno), errno ); ABORT; } if (!config || !config[0]) { filename.sprintf( ""%s.%s"", toplevel_persistent_config.Value(), admin ); unlink( filename.Value() ); if (PersistAdminList.number() == 0) { unlink( toplevel_persistent_config.Value() ); } } set_priv( priv ); free( admin ); if (config) { free( config ); } return 0; } ",0 "static inline bool isObservable(JSTestNamedConstructor* jsTestNamedConstructor) { if (jsTestNamedConstructor->hasCustomProperties()) return true; return false; } ",0 "static int ext3_quota_on_mount(struct super_block *sb, int type) { return dquot_quota_on_mount(sb, EXT3_SB(sb)->s_qf_names[type], EXT3_SB(sb)->s_jquota_fmt, type); } ",0 "bool ChromotingInstance::HandleInputEvent(const pp::InputEvent& event) { DCHECK(plugin_task_runner_->BelongsToCurrentThread()); if (!IsConnected()) return false; return input_handler_.HandleInputEvent(event); } ",0 "brcmf_cfg80211_change_iface(struct wiphy *wiphy, struct net_device *ndev, enum nl80211_iftype type, u32 *flags, struct vif_params *params) { struct brcmf_cfg80211_info *cfg = wiphy_priv(wiphy); struct brcmf_if *ifp = netdev_priv(ndev); struct brcmf_cfg80211_vif *vif = ifp->vif; s32 infra = 0; s32 ap = 0; s32 err = 0; brcmf_dbg(TRACE, ""Enter, bsscfgidx=%d, type=%d\n"", ifp->bsscfgidx, type); /* WAR: There are a number of p2p interface related problems which * need to be handled initially (before doing the validate). * wpa_supplicant tends to do iface changes on p2p device/client/go * which are not always possible/allowed. However we need to return * OK otherwise the wpa_supplicant wont start. The situation differs * on configuration and setup (p2pon=1 module param). The first check * is to see if the request is a change to station for p2p iface. */ if ((type == NL80211_IFTYPE_STATION) && ((vif->wdev.iftype == NL80211_IFTYPE_P2P_CLIENT) || (vif->wdev.iftype == NL80211_IFTYPE_P2P_GO) || (vif->wdev.iftype == NL80211_IFTYPE_P2P_DEVICE))) { brcmf_dbg(TRACE, ""Ignoring cmd for p2p if\n""); /* Now depending on whether module param p2pon=1 was used the * response needs to be either 0 or EOPNOTSUPP. The reason is * that if p2pon=1 is used, but a newer supplicant is used then * we should return an error, as this combination wont work. * In other situations 0 is returned and supplicant will start * normally. It will give a trace in cfg80211, but it is the * only way to get it working. Unfortunately this will result * in situation where we wont support new supplicant in * combination with module param p2pon=1, but that is the way * it is. If the user tries this then unloading of driver might * fail/lock. */ if (cfg->p2p.p2pdev_dynamically) return -EOPNOTSUPP; else return 0; } err = brcmf_vif_change_validate(wiphy_to_cfg(wiphy), vif, type); if (err) { brcmf_err(""iface validation failed: err=%d\n"", err); return err; } switch (type) { case NL80211_IFTYPE_MONITOR: case NL80211_IFTYPE_WDS: brcmf_err(""type (%d) : currently we do not support this type\n"", type); return -EOPNOTSUPP; case NL80211_IFTYPE_ADHOC: infra = 0; break; case NL80211_IFTYPE_STATION: infra = 1; break; case NL80211_IFTYPE_AP: case NL80211_IFTYPE_P2P_GO: ap = 1; break; default: err = -EINVAL; goto done; } if (ap) { if (type == NL80211_IFTYPE_P2P_GO) { brcmf_dbg(INFO, ""IF Type = P2P GO\n""); err = brcmf_p2p_ifchange(cfg, BRCMF_FIL_P2P_IF_GO); } if (!err) { brcmf_dbg(INFO, ""IF Type = AP\n""); } } else { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, infra); if (err) { brcmf_err(""WLC_SET_INFRA error (%d)\n"", err); err = -EAGAIN; goto done; } brcmf_dbg(INFO, ""IF Type = %s\n"", brcmf_is_ibssmode(vif) ? ""Adhoc"" : ""Infra""); } ndev->ieee80211_ptr->iftype = type; brcmf_cfg80211_update_proto_addr_mode(&vif->wdev); done: brcmf_dbg(TRACE, ""Exit\n""); return err; } ",0 "void FreeInputMethodNames(GList* engines) { if (engines) { for (GList* cursor = engines; cursor; cursor = g_list_next(cursor)) { g_object_unref(IBUS_ENGINE_DESC(cursor->data)); } g_list_free(engines); } } ",0 "static int apparmor_inode_getattr(struct vfsmount *mnt, struct dentry *dentry) { if (!mediated_filesystem(dentry->d_inode)) return 0; return common_perm_mnt_dentry(OP_GETATTR, mnt, dentry, AA_MAY_META_READ); } ",0 "bool SyncBackendHost::Core::processing_passphrase() const { DCHECK(MessageLoop::current() == host_->frontend_loop_); return processing_passphrase_; } ",0 "static void gain_control_data(bitfile *ld, ic_stream *ics) { uint8_t bd, wd, ad; ssr_info *ssr = &(ics->ssr); ssr->max_band = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1000,""gain_control_data(): max_band"")); if (ics->window_sequence == ONLY_LONG_SEQUENCE) { for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 1; wd++) { ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,""gain_control_data(): adjust_num"")); for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,""gain_control_data(): alevcode"")); ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,1003,""gain_control_data(): aloccode"")); } } } } else if (ics->window_sequence == LONG_START_SEQUENCE) { for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 2; wd++) { ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,""gain_control_data(): adjust_num"")); for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,""gain_control_data(): alevcode"")); if (wd == 0) { ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1003,""gain_control_data(): aloccode"")); } else { ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1003,""gain_control_data(): aloccode"")); } } } } } else if (ics->window_sequence == EIGHT_SHORT_SEQUENCE) { for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 8; wd++) { ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,""gain_control_data(): adjust_num"")); for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,""gain_control_data(): alevcode"")); ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,1003,""gain_control_data(): aloccode"")); } } } } else if (ics->window_sequence == LONG_STOP_SEQUENCE) { for (bd = 1; bd <= ssr->max_band; bd++) { for (wd = 0; wd < 2; wd++) { ssr->adjust_num[bd][wd] = (uint8_t)faad_getbits(ld, 3 DEBUGVAR(1,1001,""gain_control_data(): adjust_num"")); for (ad = 0; ad < ssr->adjust_num[bd][wd]; ad++) { ssr->alevcode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1002,""gain_control_data(): alevcode"")); if (wd == 0) { ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 4 DEBUGVAR(1,1003,""gain_control_data(): aloccode"")); } else { ssr->aloccode[bd][wd][ad] = (uint8_t)faad_getbits(ld, 5 DEBUGVAR(1,1003,""gain_control_data(): aloccode"")); } } } } } } ",0 "bool venc_dev::venc_set_session_qp(OMX_U32 i_frame_qp, OMX_U32 p_frame_qp,OMX_U32 b_frame_qp) { int rc; struct v4l2_control control; control.id = V4L2_CID_MPEG_VIDEO_H264_I_FRAME_QP; control.value = i_frame_qp; DEBUG_PRINT_LOW(""Calling IOCTL set control for id=%d, val=%d"", control.id, control.value); rc = ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control); if (rc) { DEBUG_PRINT_ERROR(""Failed to set control""); return false; } DEBUG_PRINT_LOW(""Success IOCTL set control for id=%d, value=%d"", control.id, control.value); session_qp.iframeqp = control.value; control.id = V4L2_CID_MPEG_VIDEO_H264_P_FRAME_QP; control.value = p_frame_qp; DEBUG_PRINT_LOW(""Calling IOCTL set control for id=%d, val=%d"", control.id, control.value); rc = ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control); if (rc) { DEBUG_PRINT_ERROR(""Failed to set control""); return false; } DEBUG_PRINT_LOW(""Success IOCTL set control for id=%d, value=%d"", control.id, control.value); session_qp.pframeqp = control.value; if ((codec_profile.profile == V4L2_MPEG_VIDEO_H264_PROFILE_MAIN) || (codec_profile.profile == V4L2_MPEG_VIDEO_H264_PROFILE_HIGH)) { control.id = V4L2_CID_MPEG_VIDEO_H264_B_FRAME_QP; control.value = b_frame_qp; DEBUG_PRINT_LOW(""Calling IOCTL set control for id=%d, val=%d"", control.id, control.value); rc = ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control); if (rc) { DEBUG_PRINT_ERROR(""Failed to set control""); return false; } DEBUG_PRINT_LOW(""Success IOCTL set control for id=%d, value=%d"", control.id, control.value); session_qp.bframeqp = control.value; } return true; } ",0 "static void prism2_tx_timeout(struct net_device *dev) { struct hostap_interface *iface; local_info_t *local; struct hfa384x_regs regs; iface = netdev_priv(dev); local = iface->local; printk(KERN_WARNING ""%s Tx timed out! Resetting card\n"", dev->name); netif_stop_queue(local->dev); local->func->read_regs(dev, ®s); printk(KERN_DEBUG ""%s: CMD=%04x EVSTAT=%04x "" ""OFFSET0=%04x OFFSET1=%04x SWSUPPORT0=%04x\n"", dev->name, regs.cmd, regs.evstat, regs.offset0, regs.offset1, regs.swsupport0); local->func->schedule_reset(local); } ",0 " MockJSBindings() : my_ip_address_count(0), my_ip_address_ex_count(0) {} ",0 " explicit InterceptAndCancelDidCommitProvisionalLoad(WebContents* web_contents) : DidCommitProvisionalLoadInterceptor(web_contents) {} ",0 "void WebContentsImpl::DecrementCapturerCount() { --capturer_count_; DVLOG(1) << ""There are now "" << capturer_count_ << "" capturing(s) of WebContentsImpl@"" << this; DCHECK_LE(0, capturer_count_); if (is_being_destroyed_) return; if (capturer_count_ == 0) { const gfx::Size old_size = preferred_size_for_capture_; preferred_size_for_capture_ = gfx::Size(); OnPreferredSizeChanged(old_size); if (IsHidden()) { DVLOG(1) << ""Executing delayed WasHidden().""; WasHidden(); } if (should_normally_be_occluded_) WasOccluded(); } } ",0 "void __netif_schedule(struct Qdisc *q) { if (!test_and_set_bit(__QDISC_STATE_SCHED, &q->state)) __netif_reschedule(q); } ",0 "std::string WrapForJavascriptAndExtract(const char* javascript_expression) { return std::string(""window.domAutomationController.send("") + javascript_expression + "")""; } ",0 "ConfirmInfoBar::~ConfirmInfoBar() { if (!initialized_) { delete ok_button_; delete cancel_button_; delete link_; } } ",0 "int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, int len, int reset) { return ftrace_set_regex(ops, buf, len, reset, 0); } ",0 "GLuint GLES2Implementation::GetMaxValueInBufferCHROMIUM(GLuint buffer_id, GLsizei count, GLenum type, GLuint offset) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG(""["" << GetLogPrefix() << ""] glGetMaxValueInBufferCHROMIUM("" << buffer_id << "", "" << count << "", "" << GLES2Util::GetStringGetMaxIndexType(type) << "", "" << offset << "")""); GLuint result = GetMaxValueInBufferCHROMIUMHelper(buffer_id, count, type, offset); GPU_CLIENT_LOG(""returned "" << result); CheckGLError(); return result; } ",0 "void Performance::TraceWrappers(ScriptWrappableVisitor* visitor) const { for (const auto& observer : observers_) visitor->TraceWrappers(observer); EventTargetWithInlineData::TraceWrappers(visitor); } ",0 "bool TabStrip::ShouldTabBeVisible(const Tab* tab) const { if (tab->detached()) return false; if (stacked_layout_) return true; const int right_edge = tab->bounds().right(); const int tabstrip_right = tab->dragging() ? drag_context_->TabDragAreaEndX() : GetTabAreaWidth(); if (right_edge > tabstrip_right) return false; if (tab->dragging()) return true; if (tab->closing()) return true; if (tab->data().pinned) return true; if (controller_->GetActiveIndex() <= GetModelIndexOfTab(tab)) return true; return (right_edge + GetActiveTabWidth() - GetInactiveTabWidth()) <= tabstrip_right; } ",0 "bloat (bson_t *b) { uint32_t i; char buf[16]; const char *key; for (i = 0; i < 100; i++) { bson_uint32_to_string (i, &key, buf, sizeof buf); BSON_APPEND_UTF8 (b, key, ""long useless value foo bar baz quux quizzle""); } /* spilled over */ ASSERT (!(b->flags & BSON_FLAG_INLINE)); } ",0 "mrb_io_close(mrb_state *mrb, mrb_value self) { struct mrb_io *fptr; fptr = io_get_open_fptr(mrb, self); fptr_finalize(mrb, fptr, FALSE); return mrb_nil_value(); } ",0 "void netif_napi_add(struct net_device *dev, struct napi_struct *napi, int (*poll)(struct napi_struct *, int), int weight) { INIT_LIST_HEAD(&napi->poll_list); hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED); napi->timer.function = napi_watchdog; napi->gro_count = 0; napi->gro_list = NULL; napi->skb = NULL; napi->poll = poll; if (weight > NAPI_POLL_WEIGHT) pr_err_once(""netif_napi_add() called with weight %d on device %s\n"", weight, dev->name); napi->weight = weight; list_add(&napi->dev_list, &dev->napi_list); napi->dev = dev; #ifdef CONFIG_NETPOLL napi->poll_owner = -1; #endif set_bit(NAPI_STATE_SCHED, &napi->state); napi_hash_add(napi); } ",0 "static enum TIFFReadDirEntryErr TIFFReadDirEntryFloat(TIFF* tif, TIFFDirEntry* direntry, float* value) { enum TIFFReadDirEntryErr err; if (direntry->tdir_count!=1) return(TIFFReadDirEntryErrCount); switch (direntry->tdir_type) { case TIFF_BYTE: { uint8 m; TIFFReadDirEntryCheckedByte(tif,direntry,&m); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_SBYTE: { int8 m; TIFFReadDirEntryCheckedSbyte(tif,direntry,&m); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_SHORT: { uint16 m; TIFFReadDirEntryCheckedShort(tif,direntry,&m); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_SSHORT: { int16 m; TIFFReadDirEntryCheckedSshort(tif,direntry,&m); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_LONG: { uint32 m; TIFFReadDirEntryCheckedLong(tif,direntry,&m); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_SLONG: { int32 m; TIFFReadDirEntryCheckedSlong(tif,direntry,&m); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_LONG8: { uint64 m; err=TIFFReadDirEntryCheckedLong8(tif,direntry,&m); if (err!=TIFFReadDirEntryErrOk) return(err); #if defined(__WIN32__) && (_MSC_VER < 1500) /* * XXX: MSVC 6.0 does not support conversion * of 64-bit integers into floating point * values. */ *value = _TIFFUInt64ToFloat(m); #else *value=(float)m; #endif return(TIFFReadDirEntryErrOk); } case TIFF_SLONG8: { int64 m; err=TIFFReadDirEntryCheckedSlong8(tif,direntry,&m); if (err!=TIFFReadDirEntryErrOk) return(err); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_RATIONAL: { double m; err=TIFFReadDirEntryCheckedRational(tif,direntry,&m); if (err!=TIFFReadDirEntryErrOk) return(err); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_SRATIONAL: { double m; err=TIFFReadDirEntryCheckedSrational(tif,direntry,&m); if (err!=TIFFReadDirEntryErrOk) return(err); *value=(float)m; return(TIFFReadDirEntryErrOk); } case TIFF_FLOAT: TIFFReadDirEntryCheckedFloat(tif,direntry,value); return(TIFFReadDirEntryErrOk); case TIFF_DOUBLE: { double m; err=TIFFReadDirEntryCheckedDouble(tif,direntry,&m); if (err!=TIFFReadDirEntryErrOk) return(err); *value=(float)m; return(TIFFReadDirEntryErrOk); } default: return(TIFFReadDirEntryErrType); } } ",0 "void EnumFonts(struct _FPDF_SYSFONTINFO* sysfontinfo, void* mapper) { FPDF_AddInstalledFont(mapper, ""Arial"", FXFONT_DEFAULT_CHARSET); const FPDF_CharsetFontMap* font_map = FPDF_GetDefaultTTFMap(); for (; font_map->charset != -1; ++font_map) { FPDF_AddInstalledFont(mapper, font_map->fontname, font_map->charset); } } ",0 "R_API RBinClass *r_bin_class_get(RBinFile *binfile, const char *name) { if (!binfile || !binfile->o || !name) { return NULL; } RBinClass *c; RListIter *iter; RList *list = binfile->o->classes; r_list_foreach (list, iter, c) { if (!strcmp (c->name, name)) { return c; } } return NULL; } ",0 "static void tcp_send_challenge_ack(struct sock *sk, const struct sk_buff *skb) { /* unprotected vars, we dont care of overwrites */ static u32 challenge_timestamp; static unsigned int challenge_count; struct tcp_sock *tp = tcp_sk(sk); u32 now; /* First check our per-socket dupack rate limit. */ if (tcp_oow_rate_limited(sock_net(sk), skb, LINUX_MIB_TCPACKSKIPPEDCHALLENGE, &tp->last_oow_ack_time)) return; /* Then check the check host-wide RFC 5961 rate limit. */ now = jiffies / HZ; if (now != challenge_timestamp) { challenge_timestamp = now; challenge_count = 0; } if (++challenge_count <= sysctl_tcp_challenge_ack_limit) { NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPCHALLENGEACK); tcp_send_ack(sk); } } ",1 "static BOOLEAN btif_hl_proc_dch_reconnect_cfm(tBTA_HL *p_data) { btif_hl_mdl_cb_t *p_dcb; btif_hl_pending_chan_cb_t *p_pcb; UINT8 app_idx, mcl_idx, mdl_idx, mdep_cfg_idx; BOOLEAN status = FALSE; BOOLEAN close_dch = FALSE; BTIF_TRACE_DEBUG(""%s"", __FUNCTION__); btif_hl_find_app_idx_using_mdepId(p_data->dch_reconnect_cfm.local_mdep_id,&app_idx); if (btif_hl_find_mcl_idx_using_app_idx(p_data->dch_reconnect_cfm.mcl_handle, app_idx, &mcl_idx )) { BTIF_HL_GET_APP_CB_PTR(app_idx); BTIF_HL_GET_MCL_CB_PTR(app_idx, mcl_idx); p_pcb = BTIF_HL_GET_PCB_PTR(app_idx, mcl_idx); if (btif_hl_find_avail_mdl_idx(app_idx, mcl_idx, &mdl_idx)) { p_dcb = BTIF_HL_GET_MDL_CB_PTR(app_idx, mcl_idx, mdl_idx); if (btif_hl_find_mdep_cfg_idx(app_idx, p_data->dch_reconnect_cfm.local_mdep_id, &mdep_cfg_idx)) { p_dcb->in_use = TRUE; p_dcb->mdl_handle = p_data->dch_reconnect_cfm.mdl_handle; p_dcb->local_mdep_cfg_idx = mdep_cfg_idx; p_dcb->local_mdep_id = p_data->dch_reconnect_cfm.local_mdep_id; p_dcb->mdl_id = p_data->dch_reconnect_cfm.mdl_id; p_dcb->dch_mode = p_data->dch_reconnect_cfm.dch_mode; p_dcb->is_the_first_reliable= p_data->dch_reconnect_cfm.first_reliable; p_dcb->mtu = p_data->dch_reconnect_cfm.mtu; p_dcb->channel_id = p_pcb->channel_id; BTIF_TRACE_DEBUG(""app_idx=%d mcl_idx=%d mdl_idx=%d"", app_idx, mcl_idx, mdl_idx ); btif_hl_send_setup_connecting_cb(app_idx, mcl_idx); if (btif_hl_create_socket(app_idx, mcl_idx, mdl_idx)) { status = TRUE; BTIF_TRACE_DEBUG(""app_idx=%d mcl_idx=%d mdl_idx=%d p_dcb->channel_id=0x%08x"", app_idx, mcl_idx, mdl_idx, p_dcb->channel_id); btif_hl_clean_pcb(p_pcb); } else { BTIF_TRACE_ERROR(""Unable to create socket""); close_dch = TRUE; } } else { BTIF_TRACE_ERROR(""INVALID_LOCAL_MDEP_ID mdep_id=%d"",p_data->dch_open_cfm.local_mdep_id); close_dch = TRUE; } if (close_dch) { btif_hl_clean_mdl_cb(p_dcb); BTA_HlDchClose(p_data->dch_reconnect_cfm.mdl_handle); } } } return status; } ",0 "static void LogPrimitiveInfo(const PrimitiveInfo *primitive_info) { const char *methods[] = { ""point"", ""replace"", ""floodfill"", ""filltoborder"", ""reset"", ""?"" }; PointInfo p, q, point; register ssize_t i, x; ssize_t coordinates, y; x=(ssize_t) ceil(primitive_info->point.x-0.5); y=(ssize_t) ceil(primitive_info->point.y-0.5); switch (primitive_info->primitive) { case AlphaPrimitive: { (void) LogMagickEvent(DrawEvent,GetMagickModule(), ""AlphaPrimitive %.20g,%.20g %s"",(double) x,(double) y, methods[primitive_info->method]); return; } case ColorPrimitive: { (void) LogMagickEvent(DrawEvent,GetMagickModule(), ""ColorPrimitive %.20g,%.20g %s"",(double) x,(double) y, methods[primitive_info->method]); return; } case ImagePrimitive: { (void) LogMagickEvent(DrawEvent,GetMagickModule(), ""ImagePrimitive %.20g,%.20g"",(double) x,(double) y); return; } case PointPrimitive: { (void) LogMagickEvent(DrawEvent,GetMagickModule(), ""PointPrimitive %.20g,%.20g %s"",(double) x,(double) y, methods[primitive_info->method]); return; } case TextPrimitive: { (void) LogMagickEvent(DrawEvent,GetMagickModule(), ""TextPrimitive %.20g,%.20g"",(double) x,(double) y); return; } default: break; } coordinates=0; p=primitive_info[0].point; q.x=(-1.0); q.y=(-1.0); for (i=0; primitive_info[i].primitive != UndefinedPrimitive; i++) { point=primitive_info[i].point; if (coordinates <= 0) { coordinates=(ssize_t) primitive_info[i].coordinates; (void) LogMagickEvent(DrawEvent,GetMagickModule(), "" begin open (%.20g)"",(double) coordinates); p=point; } point=primitive_info[i].point; if ((fabs(q.x-point.x) >= MagickEpsilon) || (fabs(q.y-point.y) >= MagickEpsilon)) (void) LogMagickEvent(DrawEvent,GetMagickModule(), "" %.20g: %.18g,%.18g"",(double) coordinates,point.x,point.y); else (void) LogMagickEvent(DrawEvent,GetMagickModule(), "" %.20g: %g %g (duplicate)"",(double) coordinates,point.x,point.y); q=point; coordinates--; if (coordinates > 0) continue; if ((fabs(p.x-point.x) >= MagickEpsilon) || (fabs(p.y-point.y) >= MagickEpsilon)) (void) LogMagickEvent(DrawEvent,GetMagickModule(),"" end last (%.20g)"", (double) coordinates); else (void) LogMagickEvent(DrawEvent,GetMagickModule(),"" end open (%.20g)"", (double) coordinates); } } ",0 "void construct_reply_common_req(struct smb_request *req, char *outbuf) { construct_reply_common(req, (char *)req->inbuf, outbuf); } ",0 "static int tag_tree_decode(Jpeg2000DecoderContext *s, Jpeg2000TgtNode *node, int threshold) { Jpeg2000TgtNode *stack[30]; int sp = -1, curval = 0; if (!node) return AVERROR_INVALIDDATA; while (node && !node->vis) { stack[++sp] = node; node = node->parent; } if (node) curval = node->val; else curval = stack[sp]->val; while (curval < threshold && sp >= 0) { if (curval < stack[sp]->val) curval = stack[sp]->val; while (curval < threshold) { int ret; if ((ret = get_bits(s, 1)) > 0) { stack[sp]->vis++; break; } else if (!ret) curval++; else return ret; } stack[sp]->val = curval; sp--; } return curval; } ",0 "xmlXPtrAdvanceChar(xmlNodePtr *node, int *indx, int bytes) { xmlNodePtr cur; int pos; int len; if ((node == NULL) || (indx == NULL)) return(-1); cur = *node; if (cur == NULL) return(-1); pos = *indx; while (bytes >= 0) { /* * First position to the beginning of the first text node * corresponding to this point */ while ((cur != NULL) && ((cur->type == XML_ELEMENT_NODE) || (cur->type == XML_DOCUMENT_NODE) || (cur->type == XML_HTML_DOCUMENT_NODE))) { if (pos > 0) { cur = xmlXPtrGetNthChild(cur, pos); pos = 0; } else { cur = xmlXPtrAdvanceNode(cur, NULL); pos = 0; } } if (cur == NULL) { *node = NULL; *indx = 0; return(-1); } /* * if there is no move needed return the current value. */ if (pos == 0) pos = 1; if (bytes == 0) { *node = cur; *indx = pos; return(0); } /* * We should have a text (or cdata) node ... */ len = 0; if ((cur->type != XML_ELEMENT_NODE) && (cur->content != NULL)) { len = xmlStrlen(cur->content); } if (pos > len) { /* Strange, the indx in the text node is greater than it's len */ STRANGE pos = len; } if (pos + bytes >= len) { bytes -= (len - pos); cur = xmlXPtrAdvanceNode(cur, NULL); pos = 0; } else if (pos + bytes < len) { pos += bytes; *node = cur; *indx = pos; return(0); } } return(-1); } ",0 "static int su_pam_conv(int num_msg, const struct pam_message **msg, struct pam_response **resp, void *appdata_ptr) { if (suppress_pam_info && num_msg == 1 && msg && msg[0]->msg_style == PAM_TEXT_INFO) return PAM_SUCCESS; #ifdef HAVE_SECURITY_PAM_MISC_H return misc_conv(num_msg, msg, resp, appdata_ptr); #elif defined(HAVE_SECURITY_OPENPAM_H) return openpam_ttyconv(num_msg, msg, resp, appdata_ptr); #endif } ",0 "sg_build_indirect(Sg_scatter_hold * schp, Sg_fd * sfp, int buff_size) { int ret_sz = 0, i, k, rem_sz, num, mx_sc_elems; int sg_tablesize = sfp->parentdp->sg_tablesize; int blk_size = buff_size, order; gfp_t gfp_mask = GFP_ATOMIC | __GFP_COMP | __GFP_NOWARN; struct sg_device *sdp = sfp->parentdp; if (blk_size < 0) return -EFAULT; if (0 == blk_size) ++blk_size; /* don't know why */ /* round request up to next highest SG_SECTOR_SZ byte boundary */ blk_size = ALIGN(blk_size, SG_SECTOR_SZ); SCSI_LOG_TIMEOUT(4, sg_printk(KERN_INFO, sfp->parentdp, ""sg_build_indirect: buff_size=%d, blk_size=%d\n"", buff_size, blk_size)); /* N.B. ret_sz carried into this block ... */ mx_sc_elems = sg_build_sgat(schp, sfp, sg_tablesize); if (mx_sc_elems < 0) return mx_sc_elems; /* most likely -ENOMEM */ num = scatter_elem_sz; if (unlikely(num != scatter_elem_sz_prev)) { if (num < PAGE_SIZE) { scatter_elem_sz = PAGE_SIZE; scatter_elem_sz_prev = PAGE_SIZE; } else scatter_elem_sz_prev = num; } if (sdp->device->host->unchecked_isa_dma) gfp_mask |= GFP_DMA; if (!capable(CAP_SYS_ADMIN) || !capable(CAP_SYS_RAWIO)) gfp_mask |= __GFP_ZERO; order = get_order(num); retry: ret_sz = 1 << (PAGE_SHIFT + order); for (k = 0, rem_sz = blk_size; rem_sz > 0 && k < mx_sc_elems; k++, rem_sz -= ret_sz) { num = (rem_sz > scatter_elem_sz_prev) ? scatter_elem_sz_prev : rem_sz; schp->pages[k] = alloc_pages(gfp_mask, order); if (!schp->pages[k]) goto out; if (num == scatter_elem_sz_prev) { if (unlikely(ret_sz > scatter_elem_sz_prev)) { scatter_elem_sz = ret_sz; scatter_elem_sz_prev = ret_sz; } } SCSI_LOG_TIMEOUT(5, sg_printk(KERN_INFO, sfp->parentdp, ""sg_build_indirect: k=%d, num=%d, ret_sz=%d\n"", k, num, ret_sz)); } /* end of for loop */ schp->page_order = order; schp->k_use_sg = k; SCSI_LOG_TIMEOUT(5, sg_printk(KERN_INFO, sfp->parentdp, ""sg_build_indirect: k_use_sg=%d, rem_sz=%d\n"", k, rem_sz)); schp->bufflen = blk_size; if (rem_sz > 0) /* must have failed */ return -ENOMEM; return 0; out: for (i = 0; i < k; i++) __free_pages(schp->pages[i], order); if (--order >= 0) goto retry; return -ENOMEM; } ",1 " tt_cmap_init( TT_CMap cmap, FT_Byte* table ) { cmap->data = table; return SFNT_Err_Ok; } ",0 "static void tcp_ratehalving_spur_to_response(struct sock *sk) { tcp_enter_cwr(sk, 0); } ",0 "static int getresult(struct protstream *p, const char *tag) { char buf[4096]; char *str = (char *) buf; while(1) { if (!prot_fgets(str, sizeof(buf), p)) { return IMAP_SERVER_UNAVAILABLE; } if (!strncmp(str, tag, strlen(tag))) { str += strlen(tag); if(!*str) { /* We got a tag, but no response */ return IMAP_SERVER_UNAVAILABLE; } str++; if (!strncasecmp(str, ""OK "", 3)) { return 0; } if (!strncasecmp(str, ""NO "", 3)) { return IMAP_REMOTE_DENIED; } return IMAP_SERVER_UNAVAILABLE; /* huh? */ } /* skip this line, we don't really care */ } } ",0 "void InputConnectionImpl::CommitText(const base::string16& text, int new_cursor_pos) { StartStateUpdateTimer(); std::string error; if (!ime_engine_->ClearComposition(input_context_id_, &error)) LOG(ERROR) << ""ClearComposition failed: error=\"""" << error << ""\""""; if (IsControlChar(text)) { SendControlKeyEvent(text); return; } if (!ime_engine_->CommitText(input_context_id_, base::UTF16ToUTF8(text).c_str(), &error)) LOG(ERROR) << ""CommitText failed: error=\"""" << error << ""\""""; } ",1 "void Frame::didChangeVisibilityState() { HeapVector> childFrames; for (Frame* child = tree().firstChild(); child; child = child->tree().nextSibling()) childFrames.append(child); for (size_t i = 0; i < childFrames.size(); ++i) childFrames[i]->didChangeVisibilityState(); } ",0 "static int ccid3_hc_tx_init(struct ccid *ccid, struct sock *sk) { struct ccid3_hc_tx_sock *hc = ccid_priv(ccid); hc->tx_state = TFRC_SSTATE_NO_SENT; hc->tx_hist = NULL; setup_timer(&hc->tx_no_feedback_timer, ccid3_hc_tx_no_feedback_timer, (unsigned long)sk); return 0; } ",0 "create_var_to_name_hash() { const struct var_name_to_ptr_t *n2v_p = var_name_to_ptr; uzbl.comm.proto_var = g_hash_table_new(g_str_hash, g_str_equal); while(n2v_p->name) { g_hash_table_insert(uzbl.comm.proto_var, (gpointer) n2v_p->name, (gpointer) &n2v_p->cp); n2v_p++; } } ",0 "ProcRenderCreateCursor(ClientPtr client) { REQUEST(xRenderCreateCursorReq); PicturePtr pSrc; ScreenPtr pScreen; unsigned short width, height; CARD32 *argbbits, *argb; unsigned char *srcbits, *srcline; unsigned char *mskbits, *mskline; int stride; int x, y; int nbytes_mono; CursorMetricRec cm; CursorPtr pCursor; CARD32 twocolor[3]; int rc, ncolor; REQUEST_SIZE_MATCH(xRenderCreateCursorReq); LEGAL_NEW_RESOURCE(stuff->cid, client); VERIFY_PICTURE(pSrc, stuff->src, client, DixReadAccess); if (!pSrc->pDrawable) return BadDrawable; pScreen = pSrc->pDrawable->pScreen; width = pSrc->pDrawable->width; height = pSrc->pDrawable->height; if (height && width > UINT32_MAX / (height * sizeof(CARD32))) return BadAlloc; if (stuff->x > width || stuff->y > height) return BadMatch; argbbits = malloc(width * height * sizeof(CARD32)); if (!argbbits) return BadAlloc; stride = BitmapBytePad(width); nbytes_mono = stride * height; srcbits = calloc(1, nbytes_mono); if (!srcbits) { free(argbbits); return BadAlloc; } mskbits = calloc(1, nbytes_mono); if (!mskbits) { free(argbbits); free(srcbits); return BadAlloc; } if (pSrc->format == PICT_a8r8g8b8) { (*pScreen->GetImage) (pSrc->pDrawable, 0, 0, width, height, ZPixmap, 0xffffffff, (void *) argbbits); } else { PixmapPtr pPixmap; PicturePtr pPicture; PictFormatPtr pFormat; int error; pFormat = PictureMatchFormat(pScreen, 32, PICT_a8r8g8b8); if (!pFormat) { free(argbbits); free(srcbits); free(mskbits); return BadImplementation; } pPixmap = (*pScreen->CreatePixmap) (pScreen, width, height, 32, CREATE_PIXMAP_USAGE_SCRATCH); if (!pPixmap) { free(argbbits); free(srcbits); free(mskbits); return BadAlloc; } pPicture = CreatePicture(0, &pPixmap->drawable, pFormat, 0, 0, client, &error); if (!pPicture) { free(argbbits); free(srcbits); free(mskbits); return error; } (*pScreen->DestroyPixmap) (pPixmap); CompositePicture(PictOpSrc, pSrc, 0, pPicture, 0, 0, 0, 0, 0, 0, width, height); (*pScreen->GetImage) (pPicture->pDrawable, 0, 0, width, height, ZPixmap, 0xffffffff, (void *) argbbits); FreePicture(pPicture, 0); } /* * Check whether the cursor can be directly supported by * the core cursor code */ ncolor = 0; argb = argbbits; for (y = 0; ncolor <= 2 && y < height; y++) { for (x = 0; ncolor <= 2 && x < width; x++) { CARD32 p = *argb++; CARD32 a = (p >> 24); if (a == 0) /* transparent */ continue; if (a == 0xff) { /* opaque */ int n; for (n = 0; n < ncolor; n++) if (p == twocolor[n]) break; if (n == ncolor) twocolor[ncolor++] = p; } else ncolor = 3; } } /* * Convert argb image to two plane cursor */ srcline = srcbits; mskline = mskbits; argb = argbbits; for (y = 0; y < height; y++) { for (x = 0; x < width; x++) { CARD32 p = *argb++; if (ncolor <= 2) { CARD32 a = ((p >> 24)); RenderSetBit(mskline, x, a != 0); RenderSetBit(srcline, x, a != 0 && p == twocolor[0]); } else { CARD32 a = ((p >> 24) * DITHER_SIZE + 127) / 255; CARD32 i = ((CvtR8G8B8toY15(p) >> 7) * DITHER_SIZE + 127) / 255; CARD32 d = orderedDither[y & (DITHER_DIM - 1)][x & (DITHER_DIM - 1)]; /* Set mask from dithered alpha value */ RenderSetBit(mskline, x, a > d); /* Set src from dithered intensity value */ RenderSetBit(srcline, x, a > d && i <= d); } } srcline += stride; mskline += stride; } /* * Dither to white and black if the cursor has more than two colors */ if (ncolor > 2) { twocolor[0] = 0xff000000; twocolor[1] = 0xffffffff; } else { free(argbbits); argbbits = 0; } #define GetByte(p,s) (((p) >> (s)) & 0xff) #define GetColor(p,s) (GetByte(p,s) | (GetByte(p,s) << 8)) cm.width = width; cm.height = height; cm.xhot = stuff->x; cm.yhot = stuff->y; rc = AllocARGBCursor(srcbits, mskbits, argbbits, &cm, GetColor(twocolor[0], 16), GetColor(twocolor[0], 8), GetColor(twocolor[0], 0), GetColor(twocolor[1], 16), GetColor(twocolor[1], 8), GetColor(twocolor[1], 0), &pCursor, client, stuff->cid); if (rc != Success) goto bail; if (!AddResource(stuff->cid, RT_CURSOR, (void *) pCursor)) { rc = BadAlloc; goto bail; } return Success; bail: free(srcbits); free(mskbits); return rc; } ",0 "bool OutOfProcessInstance::Init(uint32_t argc, const char* argn[], const char* argv[]) { pp::Var document_url_var = pp::URLUtil_Dev::Get()->GetDocumentURL(this); std::string document_url = document_url_var.is_string() ? document_url_var.AsString() : std::string(); std::string extension_url = std::string(kChromeExtension); bool in_extension = !document_url.compare(0, extension_url.size(), extension_url); if (in_extension) { for (uint32_t i = 0; i < argc; ++i) { if (strcmp(argn[i], ""full-frame"") == 0) { full_ = true; break; } } } if (full_) SetPluginToHandleFindRequests(); pp::VarDictionary translated_strings; translated_strings.Set(kType, kJSSetTranslatedStringsType); translated_strings.Set(kJSGetPasswordString, GetLocalizedString(PP_RESOURCESTRING_PDFGETPASSWORD)); translated_strings.Set(kJSLoadingString, GetLocalizedString(PP_RESOURCESTRING_PDFLOADING)); translated_strings.Set(kJSLoadFailedString, GetLocalizedString(PP_RESOURCESTRING_PDFLOAD_FAILED)); PostMessage(translated_strings); text_input_.reset(new pp::TextInput_Dev(this)); const char* stream_url = nullptr; const char* original_url = nullptr; const char* headers = nullptr; bool is_material = false; for (uint32_t i = 0; i < argc; ++i) { if (strcmp(argn[i], ""src"") == 0) original_url = argv[i]; else if (strcmp(argn[i], ""stream-url"") == 0) stream_url = argv[i]; else if (strcmp(argn[i], ""headers"") == 0) headers = argv[i]; else if (strcmp(argn[i], ""is-material"") == 0) is_material = true; else if (strcmp(argn[i], ""top-toolbar-height"") == 0) base::StringToInt(argv[i], &top_toolbar_height_); } if (is_material) background_color_ = kBackgroundColorMaterial; else background_color_ = kBackgroundColor; if (!original_url) return false; if (!stream_url) stream_url = original_url; if (IsPrintPreviewUrl(original_url)) return true; LoadUrl(stream_url); url_ = original_url; return engine_->New(original_url, headers); } ",1 "PHP_FUNCTION(openssl_pkcs7_verify) { X509_STORE * store = NULL; zval * cainfo = NULL; STACK_OF(X509) *signers= NULL; STACK_OF(X509) *others = NULL; PKCS7 * p7 = NULL; BIO * in = NULL, * datain = NULL, * dataout = NULL; zend_long flags = 0; char * filename; size_t filename_len; char * extracerts = NULL; size_t extracerts_len = 0; char * signersfilename = NULL; size_t signersfilename_len = 0; char * datafilename = NULL; size_t datafilename_len = 0; RETVAL_LONG(-1); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""pl|papp"", &filename, &filename_len, &flags, &signersfilename, &signersfilename_len, &cainfo, &extracerts, &extracerts_len, &datafilename, &datafilename_len) == FAILURE) { return; } if (extracerts) { others = load_all_certs_from_file(extracerts); if (others == NULL) { goto clean_exit; } } flags = flags & ~PKCS7_DETACHED; store = setup_verify(cainfo); if (!store) { goto clean_exit; } if (php_openssl_open_base_dir_chk(filename)) { goto clean_exit; } in = BIO_new_file(filename, PHP_OPENSSL_BIO_MODE_R(flags)); if (in == NULL) { php_openssl_store_errors(); goto clean_exit; } p7 = SMIME_read_PKCS7(in, &datain); if (p7 == NULL) { #if DEBUG_SMIME zend_printf(""SMIME_read_PKCS7 failed\n""); #endif php_openssl_store_errors(); goto clean_exit; } if (datafilename) { if (php_openssl_open_base_dir_chk(datafilename)) { goto clean_exit; } dataout = BIO_new_file(datafilename, ""w""); if (dataout == NULL) { php_openssl_store_errors(); goto clean_exit; } } #if DEBUG_SMIME zend_printf(""Calling PKCS7 verify\n""); #endif if (PKCS7_verify(p7, others, store, datain, dataout, (int)flags)) { RETVAL_TRUE; if (signersfilename) { BIO *certout; if (php_openssl_open_base_dir_chk(signersfilename)) { goto clean_exit; } certout = BIO_new_file(signersfilename, ""w""); if (certout) { int i; signers = PKCS7_get0_signers(p7, NULL, (int)flags); if (signers != NULL) { for (i = 0; i < sk_X509_num(signers); i++) { if (!PEM_write_bio_X509(certout, sk_X509_value(signers, i))) { php_openssl_store_errors(); RETVAL_LONG(-1); php_error_docref(NULL, E_WARNING, ""failed to write signer %d"", i); } } sk_X509_free(signers); } else { RETVAL_LONG(-1); php_openssl_store_errors(); } BIO_free(certout); } else { php_openssl_store_errors(); php_error_docref(NULL, E_WARNING, ""signature OK, but cannot open %s for writing"", signersfilename); RETVAL_LONG(-1); } } } else { php_openssl_store_errors(); RETVAL_FALSE; } clean_exit: X509_STORE_free(store); BIO_free(datain); BIO_free(in); BIO_free(dataout); PKCS7_free(p7); sk_X509_free(others); } ",0 "xsltParseStylesheetAttributeSet(xsltStylesheetPtr style, xmlNodePtr cur) { const xmlChar *ncname; const xmlChar *prefix; xmlChar *value; xmlNodePtr child; xsltAttrElemPtr attrItems; if ((cur == NULL) || (style == NULL) || (cur->type != XML_ELEMENT_NODE)) return; value = xmlGetNsProp(cur, (const xmlChar *)""name"", NULL); if (value == NULL) { xsltGenericError(xsltGenericErrorContext, ""xsl:attribute-set : name is missing\n""); return; } ncname = xsltSplitQName(style->dict, value, &prefix); xmlFree(value); value = NULL; if (style->attributeSets == NULL) { #ifdef WITH_XSLT_DEBUG_ATTRIBUTES xsltGenericDebug(xsltGenericDebugContext, ""creating attribute set table\n""); #endif style->attributeSets = xmlHashCreate(10); } if (style->attributeSets == NULL) return; attrItems = xmlHashLookup2(style->attributeSets, ncname, prefix); /* * Parse the content. Only xsl:attribute elements are allowed. */ child = cur->children; while (child != NULL) { /* * Report invalid nodes. */ if ((child->type != XML_ELEMENT_NODE) || (child->ns == NULL) || (! IS_XSLT_ELEM(child))) { if (child->type == XML_ELEMENT_NODE) xsltTransformError(NULL, style, child, ""xsl:attribute-set : unexpected child %s\n"", child->name); else xsltTransformError(NULL, style, child, ""xsl:attribute-set : child of unexpected type\n""); } else if (!IS_XSLT_NAME(child, ""attribute"")) { xsltTransformError(NULL, style, child, ""xsl:attribute-set : unexpected child xsl:%s\n"", child->name); } else { #ifdef XSLT_REFACTORED xsltAttrElemPtr nextAttr, curAttr; /* * Process xsl:attribute * --------------------- */ #ifdef WITH_XSLT_DEBUG_ATTRIBUTES xsltGenericDebug(xsltGenericDebugContext, ""add attribute to list %s\n"", ncname); #endif /* * The following was taken over from * xsltAddAttrElemList(). */ if (attrItems == NULL) { attrItems = xsltNewAttrElem(child); } else { curAttr = attrItems; while (curAttr != NULL) { nextAttr = curAttr->next; if (curAttr->attr == child) { /* * URGENT TODO: Can somebody explain * why attrItems is set to curAttr * here? Is this somehow related to * avoidance of recursions? */ attrItems = curAttr; goto next_child; } if (curAttr->next == NULL) curAttr->next = xsltNewAttrElem(child); curAttr = nextAttr; } } /* * Parse the xsl:attribute and its content. */ xsltParseAnyXSLTElem(XSLT_CCTXT(style), child); #else #ifdef WITH_XSLT_DEBUG_ATTRIBUTES xsltGenericDebug(xsltGenericDebugContext, ""add attribute to list %s\n"", ncname); #endif /* * OLD behaviour: */ attrItems = xsltAddAttrElemList(attrItems, child); #endif } #ifdef XSLT_REFACTORED next_child: #endif child = child->next; } /* * Process attribue ""use-attribute-sets"". */ /* TODO check recursion */ value = xmlGetNsProp(cur, (const xmlChar *)""use-attribute-sets"", NULL); if (value != NULL) { const xmlChar *curval, *endval; curval = value; while (*curval != 0) { while (IS_BLANK(*curval)) curval++; if (*curval == 0) break; endval = curval; while ((*endval != 0) && (!IS_BLANK(*endval))) endval++; curval = xmlDictLookup(style->dict, curval, endval - curval); if (curval) { const xmlChar *ncname2 = NULL; const xmlChar *prefix2 = NULL; xsltAttrElemPtr refAttrItems; #ifdef WITH_XSLT_DEBUG_ATTRIBUTES xsltGenericDebug(xsltGenericDebugContext, ""xsl:attribute-set : %s adds use %s\n"", ncname, curval); #endif ncname2 = xsltSplitQName(style->dict, curval, &prefix2); refAttrItems = xsltNewAttrElem(NULL); if (refAttrItems != NULL) { refAttrItems->set = ncname2; refAttrItems->ns = prefix2; attrItems = xsltMergeAttrElemList(style, attrItems, refAttrItems); xsltFreeAttrElem(refAttrItems); } } curval = endval; } xmlFree(value); value = NULL; } /* * Update the value */ /* * TODO: Why is this dummy entry needed.? */ if (attrItems == NULL) attrItems = xsltNewAttrElem(NULL); xmlHashUpdateEntry2(style->attributeSets, ncname, prefix, attrItems, NULL); #ifdef WITH_XSLT_DEBUG_ATTRIBUTES xsltGenericDebug(xsltGenericDebugContext, ""updated attribute list %s\n"", ncname); #endif } ",1 "int i2d_RSA_PUBKEY_bio(BIO *bp, RSA *rsa) { return ASN1_i2d_bio_of(RSA,i2d_RSA_PUBKEY,bp,rsa); } ",0 "bt_status_t btsock_rfc_connect(const bt_bdaddr_t *bd_addr, const uint8_t *service_uuid, int channel, int *sock_fd, int flags) { assert(sock_fd != NULL); assert(service_uuid != NULL || (channel >= 1 && channel <= MAX_RFC_CHANNEL)); *sock_fd = INVALID_FD; if (!is_init_done()) return BT_STATUS_NOT_READY; int status = BT_STATUS_FAIL; pthread_mutex_lock(&slot_lock); rfc_slot_t *slot = alloc_rfc_slot(bd_addr, NULL, service_uuid, channel, flags, false); if (!slot) { LOG_ERROR(""%s unable to allocate RFCOMM slot."", __func__); goto out; } if (is_uuid_empty(service_uuid)) { tBTA_JV_STATUS ret = BTA_JvRfcommConnect(slot->security, slot->role, slot->scn, slot->addr.address, rfcomm_cback, (void *)(uintptr_t)slot->id); if (ret != BTA_JV_SUCCESS) { LOG_ERROR(""%s unable to initiate RFCOMM connection: %d"", __func__, ret); cleanup_rfc_slot(slot); goto out; } if (!send_app_scn(slot)) { LOG_ERROR(""%s unable to send channel number."", __func__); cleanup_rfc_slot(slot); goto out; } } else { tSDP_UUID sdp_uuid; sdp_uuid.len = 16; memcpy(sdp_uuid.uu.uuid128, service_uuid, sizeof(sdp_uuid.uu.uuid128)); if (!is_requesting_sdp()) { BTA_JvStartDiscovery((uint8_t *)bd_addr->address, 1, &sdp_uuid, (void *)(uintptr_t)slot->id); slot->f.pending_sdp_request = false; slot->f.doing_sdp_request = true; } else { slot->f.pending_sdp_request = true; slot->f.doing_sdp_request = false; } } *sock_fd = slot->app_fd; // Transfer ownership of fd to caller. slot->app_fd = INVALID_FD; // Drop our reference to the fd. btsock_thread_add_fd(pth, slot->fd, BTSOCK_RFCOMM, SOCK_THREAD_FD_RD, slot->id); status = BT_STATUS_SUCCESS; out:; pthread_mutex_unlock(&slot_lock); return status; } ",0 "static int AppLayerProtoDetectTest13(void) { AppLayerProtoDetectUnittestCtxBackup(); AppLayerProtoDetectSetup(); uint8_t l7data[] = ""CONNECT www.ssllabs.com:443 HTTP/1.0\r\n""; uint8_t l7data_resp[] = ""HTTP/1.1 405 Method Not Allowed\r\n""; int r = 0; Flow f; AppProto pm_results[ALPROTO_MAX]; AppLayerProtoDetectThreadCtx *alpd_tctx; uint32_t cnt; memset(&f, 0x00, sizeof(f)); f.protomap = FlowGetProtoMapping(IPPROTO_TCP); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_UDP, ALPROTO_HTTP, ""HTTP"", 4, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_UDP, ALPROTO_HTTP, ""GET"", 3, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_UDP, ALPROTO_HTTP, ""PUT"", 3, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_UDP, ALPROTO_HTTP, ""POST"", 4, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_UDP, ALPROTO_HTTP, ""TRACE"", 5, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_UDP, ALPROTO_HTTP, ""OPTIONS"", 7, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_UDP, ALPROTO_HTTP, ""CONNECT"", 7, 0, STREAM_TOSERVER); AppLayerProtoDetectPMRegisterPatternCS(IPPROTO_UDP, ALPROTO_HTTP, ""HTTP"", 4, 0, STREAM_TOCLIENT); AppLayerProtoDetectPrepareState(); /* AppLayerProtoDetectGetCtxThread() should be called post AppLayerProtoDetectPrepareState(), since * it sets internal structures which depends on the above function. */ alpd_tctx = AppLayerProtoDetectGetCtxThread(); if (alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].max_pat_id != 7) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].max_pat_id != 7\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[1].max_pat_id != 1) { printf(""alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[1].max_pat_id != 1\n""); goto end; } if (alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].map[0]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].map[1]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].map[2]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].map[3]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].map[4]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].map[5]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[0].map[6]->alproto != ALPROTO_HTTP || alpd_ctx.ctx_ipp[FLOW_PROTO_UDP].ctx_pm[1].map[0]->alproto != ALPROTO_HTTP) { printf(""failure 1\n""); goto end; } memset(pm_results, 0, sizeof(pm_results)); cnt = AppLayerProtoDetectPMGetProto(alpd_tctx, &f, l7data, sizeof(l7data), STREAM_TOSERVER, IPPROTO_TCP, pm_results); if (cnt != 0) { printf(""l7data - cnt != 0\n""); goto end; } memset(pm_results, 0, sizeof(pm_results)); cnt = AppLayerProtoDetectPMGetProto(alpd_tctx, &f, l7data_resp, sizeof(l7data_resp), STREAM_TOCLIENT, IPPROTO_TCP, pm_results); if (cnt != 0) { printf(""l7data_resp - cnt != 0\n""); goto end; } r = 1; end: if (alpd_tctx != NULL) AppLayerProtoDetectDestroyCtxThread(alpd_tctx); AppLayerProtoDetectDeSetup(); AppLayerProtoDetectUnittestCtxRestore(); return r; } ",0 " LayerTreeHostTestReadyToDrawEmpty() : did_notify_ready_to_draw_(false), all_tiles_required_for_draw_are_ready_to_draw_(false), required_for_draw_count_(0) {} ",0 "static u64 primary_event_id(struct perf_event *event) { u64 id = event->id; if (event->parent) id = event->parent->id; return id; } ",0 "int udf_add_aext(struct inode *inode, struct extent_position *epos, struct kernel_lb_addr *eloc, uint32_t elen, int inc) { int adsize; struct short_ad *sad = NULL; struct long_ad *lad = NULL; struct allocExtDesc *aed; uint8_t *ptr; struct udf_inode_info *iinfo = UDF_I(inode); if (!epos->bh) ptr = iinfo->i_ext.i_data + epos->offset - udf_file_entry_alloc_offset(inode) + iinfo->i_lenEAttr; else ptr = epos->bh->b_data + epos->offset; if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_SHORT) adsize = sizeof(struct short_ad); else if (iinfo->i_alloc_type == ICBTAG_FLAG_AD_LONG) adsize = sizeof(struct long_ad); else return -EIO; if (epos->offset + (2 * adsize) > inode->i_sb->s_blocksize) { unsigned char *sptr, *dptr; struct buffer_head *nbh; int err, loffset; struct kernel_lb_addr obloc = epos->block; epos->block.logicalBlockNum = udf_new_block(inode->i_sb, NULL, obloc.partitionReferenceNum, obloc.logicalBlockNum, &err); if (!epos->block.logicalBlockNum) return -ENOSPC; nbh = udf_tgetblk(inode->i_sb, udf_get_lb_pblock(inode->i_sb, &epos->block, 0)); if (!nbh) return -EIO; lock_buffer(nbh); memset(nbh->b_data, 0x00, inode->i_sb->s_blocksize); set_buffer_uptodate(nbh); unlock_buffer(nbh); mark_buffer_dirty_inode(nbh, inode); aed = (struct allocExtDesc *)(nbh->b_data); if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT)) aed->previousAllocExtLocation = cpu_to_le32(obloc.logicalBlockNum); if (epos->offset + adsize > inode->i_sb->s_blocksize) { loffset = epos->offset; aed->lengthAllocDescs = cpu_to_le32(adsize); sptr = ptr - adsize; dptr = nbh->b_data + sizeof(struct allocExtDesc); memcpy(dptr, sptr, adsize); epos->offset = sizeof(struct allocExtDesc) + adsize; } else { loffset = epos->offset + adsize; aed->lengthAllocDescs = cpu_to_le32(0); sptr = ptr; epos->offset = sizeof(struct allocExtDesc); if (epos->bh) { aed = (struct allocExtDesc *)epos->bh->b_data; le32_add_cpu(&aed->lengthAllocDescs, adsize); } else { iinfo->i_lenAlloc += adsize; mark_inode_dirty(inode); } } if (UDF_SB(inode->i_sb)->s_udfrev >= 0x0200) udf_new_tag(nbh->b_data, TAG_IDENT_AED, 3, 1, epos->block.logicalBlockNum, sizeof(struct tag)); else udf_new_tag(nbh->b_data, TAG_IDENT_AED, 2, 1, epos->block.logicalBlockNum, sizeof(struct tag)); switch (iinfo->i_alloc_type) { case ICBTAG_FLAG_AD_SHORT: sad = (struct short_ad *)sptr; sad->extLength = cpu_to_le32(EXT_NEXT_EXTENT_ALLOCDECS | inode->i_sb->s_blocksize); sad->extPosition = cpu_to_le32(epos->block.logicalBlockNum); break; case ICBTAG_FLAG_AD_LONG: lad = (struct long_ad *)sptr; lad->extLength = cpu_to_le32(EXT_NEXT_EXTENT_ALLOCDECS | inode->i_sb->s_blocksize); lad->extLocation = cpu_to_lelb(epos->block); memset(lad->impUse, 0x00, sizeof(lad->impUse)); break; } if (epos->bh) { if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) udf_update_tag(epos->bh->b_data, loffset); else udf_update_tag(epos->bh->b_data, sizeof(struct allocExtDesc)); mark_buffer_dirty_inode(epos->bh, inode); brelse(epos->bh); } else { mark_inode_dirty(inode); } epos->bh = nbh; } udf_write_aext(inode, epos, eloc, elen, inc); if (!epos->bh) { iinfo->i_lenAlloc += adsize; mark_inode_dirty(inode); } else { aed = (struct allocExtDesc *)epos->bh->b_data; le32_add_cpu(&aed->lengthAllocDescs, adsize); if (!UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_STRICT) || UDF_SB(inode->i_sb)->s_udfrev >= 0x0201) udf_update_tag(epos->bh->b_data, epos->offset + (inc ? 0 : adsize)); else udf_update_tag(epos->bh->b_data, sizeof(struct allocExtDesc)); mark_buffer_dirty_inode(epos->bh, inode); } return 0; } ",0 "NavigationControllerRestoredObserver::~NavigationControllerRestoredObserver() { } ",0 "void ewk_view_viewport_attributes_set(Evas_Object* ewkView, const WebCore::ViewportArguments& arguments) { EWK_VIEW_SD_GET(ewkView, smartData); EWK_VIEW_PRIV_GET(smartData, priv); priv->viewportArguments = arguments; evas_object_smart_callback_call(ewkView, ""viewport,changed"", 0); } ",0 "more_files_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { DirectoryLoadState *state; NautilusDirectory *directory; GError *error; GList *files, *l; GFileInfo *info; state = user_data; if (state->directory == NULL) { /* Operation was cancelled. Bail out */ directory_load_state_free (state); return; } directory = nautilus_directory_ref (state->directory); g_assert (directory->details->directory_load_in_progress != NULL); g_assert (directory->details->directory_load_in_progress == state); error = NULL; files = g_file_enumerator_next_files_finish (state->enumerator, res, &error); for (l = files; l != NULL; l = l->next) { info = l->data; directory_load_one (directory, info); g_object_unref (info); } if (files == NULL) { directory_load_done (directory, error); directory_load_state_free (state); } else { g_file_enumerator_next_files_async (state->enumerator, DIRECTORY_LOAD_ITEMS_PER_CALLBACK, G_PRIORITY_DEFAULT, state->cancellable, more_files_callback, state); } nautilus_directory_unref (directory); if (error) { g_error_free (error); } g_list_free (files); } ",0 "void md_wakeup_thread(struct md_thread *thread) { if (thread) { pr_debug(""md: waking up MD thread %s.\n"", thread->tsk->comm); set_bit(THREAD_WAKEUP, &thread->flags); wake_up(&thread->wqueue); } } ",0 " void btif_config_flush(void) { assert(config != NULL); assert(alarm_timer != NULL); alarm_cancel(alarm_timer); pthread_mutex_lock(&lock); config_save(config, CONFIG_FILE_PATH); pthread_mutex_unlock(&lock); } ",1 "int vmw_surface_destroy_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_vmw_surface_arg *arg = (struct drm_vmw_surface_arg *)data; struct ttm_object_file *tfile = vmw_fpriv(file_priv)->tfile; return ttm_ref_object_base_unref(tfile, arg->sid, TTM_REF_USAGE); } ",0 "static void config_parse(FILE *fp, config_t *config) { assert(fp != NULL); assert(config != NULL); int line_num = 0; char line[1024]; char section[1024]; strcpy(section, CONFIG_DEFAULT_SECTION); while (fgets(line, sizeof(line), fp)) { char *line_ptr = trim(line); ++line_num; if (*line_ptr == '\0' || *line_ptr == '#') continue; if (*line_ptr == '[') { size_t len = strlen(line_ptr); if (line_ptr[len - 1] != ']') { LOG_DEBUG(""%s unterminated section name on line %d."", __func__, line_num); continue; } strncpy(section, line_ptr + 1, len - 2); section[len - 2] = '\0'; } else { char *split = strchr(line_ptr, '='); if (!split) { LOG_DEBUG(""%s no key/value separator found on line %d."", __func__, line_num); continue; } *split = '\0'; config_set_string(config, section, trim(line_ptr), trim(split + 1)); } } } ",0 "static void bin_elf_versioninfo(RCore *r, int mode) { const char *format = ""bin/cur/info/versioninfo/%s%d""; char path[256] = {0}; int num_versym = 0; int num_verneed = 0; int num_version = 0; Sdb *sdb = NULL; const char *oValue = NULL; bool firstit_for_versym = true; if (IS_MODE_JSON (mode)) { r_cons_printf (""{\""versym\"":[""); } for (;; num_versym++) { snprintf (path, sizeof (path), format, ""versym"", num_versym); if (!(sdb = sdb_ns_path (r->sdb, path, 0))) { break; } ut64 addr = sdb_num_get (sdb, ""addr"", 0); ut64 offset = sdb_num_get (sdb, ""offset"", 0); ut64 link = sdb_num_get (sdb, ""link"", 0); ut64 num_entries = sdb_num_get (sdb, ""num_entries"", 0); const char *section_name = sdb_const_get (sdb, ""section_name"", 0); const char *link_section_name = sdb_const_get (sdb, ""link_section_name"", 0); if (IS_MODE_JSON (mode)) { if (!firstit_for_versym) { r_cons_printf ("",""); } r_cons_printf (""{\""section_name\"":\""%s\"",\""address\"":%""PFMT64u"",\""offset\"":%""PFMT64u"","", section_name, (ut64)addr, (ut64)offset); r_cons_printf (""\""link\"":%""PFMT64u"",\""link_section_name\"":\""%s\"",\""entries\"":["", (ut32)link, link_section_name); } else { r_cons_printf (""Version symbols section '%s' contains %""PFMT64u"" entries:\n"", section_name, num_entries); r_cons_printf ("" Addr: 0x%08""PFMT64x"" Offset: 0x%08""PFMT64x"" Link: %x (%s)\n"", (ut64)addr, (ut64)offset, (ut32)link, link_section_name); } int i; for (i = 0; i < num_entries; i++) { char key[32] = R_EMPTY; snprintf (key, sizeof (key), ""entry%d"", i); const char *value = sdb_const_get (sdb, key, 0); if (value) { if (oValue && !strcmp (value, oValue)) { continue; } if (IS_MODE_JSON (mode)) { if (i > 0) { r_cons_printf ("",""); } char *escaped_value = r_str_escape (value); r_cons_printf (""{\""idx\"":%""PFMT64u"",\""value\"":\""%s\""}"", (ut64) i, escaped_value); free (escaped_value); } else { r_cons_printf ("" 0x%08""PFMT64x"": "", (ut64) i); r_cons_printf (""%s\n"", value); } oValue = value; } } if (IS_MODE_JSON (mode)) { r_cons_printf (""]}""); } else { r_cons_printf (""\n\n""); } firstit_for_versym = false; } if (IS_MODE_JSON (mode)) { r_cons_printf (""],\""verneed\"":[""); } bool firstit_dowhile_verneed = true; do { char path_version[256] = R_EMPTY; snprintf (path, sizeof (path), format, ""verneed"", num_verneed++); if (!(sdb = sdb_ns_path (r->sdb, path, 0))) { break; } if (IS_MODE_JSON (mode)) { if (!firstit_dowhile_verneed) { r_cons_printf ("",""); } r_cons_printf (""{\""section_name\"":\""%s\"",\""address\"":%""PFMT64u"",\""offset\"":%""PFMT64u"","", sdb_const_get (sdb, ""section_name"", 0), sdb_num_get (sdb, ""addr"", 0), sdb_num_get (sdb, ""offset"", 0)); r_cons_printf (""\""link\"":%""PFMT64u"",\""link_section_name\"":\""%s\"",\""entries\"":["", sdb_num_get (sdb, ""link"", 0), sdb_const_get (sdb, ""link_section_name"", 0)); } else { r_cons_printf (""Version need section '%s' contains %d entries:\n"", sdb_const_get (sdb, ""section_name"", 0), (int)sdb_num_get (sdb, ""num_entries"", 0)); r_cons_printf ("" Addr: 0x%08""PFMT64x, sdb_num_get (sdb, ""addr"", 0)); r_cons_printf ("" Offset: 0x%08""PFMT64x"" Link to section: %""PFMT64d"" (%s)\n"", sdb_num_get (sdb, ""offset"", 0), sdb_num_get (sdb, ""link"", 0), sdb_const_get (sdb, ""link_section_name"", 0)); } bool firstit_for_verneed = true; for (num_version = 0;; num_version++) { snprintf (path_version, sizeof (path_version), ""%s/version%d"", path, num_version); const char *filename = NULL; char path_vernaux[256] = R_EMPTY; int num_vernaux = 0; if (!(sdb = sdb_ns_path (r->sdb, path_version, 0))) { break; } if (IS_MODE_JSON (mode)) { if (!firstit_for_verneed) { r_cons_printf ("",""); } r_cons_printf (""{\""idx\"":%""PFMT64u"",\""vn_version\"":%d,"", sdb_num_get (sdb, ""idx"", 0), (int)sdb_num_get (sdb, ""vn_version"", 0)); } else { r_cons_printf ("" 0x%08""PFMT64x"": Version: %d"", sdb_num_get (sdb, ""idx"", 0), (int)sdb_num_get (sdb, ""vn_version"", 0)); } if ((filename = sdb_const_get (sdb, ""file_name"", 0))) { if (IS_MODE_JSON (mode)) { char *escaped_filename = r_str_escape (filename); r_cons_printf (""\""file_name\"":\""%s\"","", escaped_filename); free (escaped_filename); } else { r_cons_printf ("" File: %s"", filename); } } if (IS_MODE_JSON (mode)) { r_cons_printf (""\""cnt\"":%d,"", (int)sdb_num_get (sdb, ""cnt"", 0)); } else { r_cons_printf ("" Cnt: %d\n"", (int)sdb_num_get (sdb, ""cnt"", 0)); } if (IS_MODE_JSON (mode)) { r_cons_printf (""\""vernaux\"":[""); } bool firstit_dowhile_vernaux = true; do { snprintf (path_vernaux, sizeof (path_vernaux), ""%s/vernaux%d"", path_version, num_vernaux++); if (!(sdb = sdb_ns_path (r->sdb, path_vernaux, 0))) { break; } if (IS_MODE_JSON (mode)) { if (!firstit_dowhile_vernaux) { r_cons_printf ("",""); } r_cons_printf (""{\""idx\"":%""PFMT64x"",\""name\"":\""%s\"","", sdb_num_get (sdb, ""idx"", 0), sdb_const_get (sdb, ""name"", 0)); r_cons_printf (""\""flags\"":\""%s\"",\""version\"":%d}"", sdb_const_get (sdb, ""flags"", 0), (int)sdb_num_get (sdb, ""version"", 0)); } else { r_cons_printf ("" 0x%08""PFMT64x"": Name: %s"", sdb_num_get (sdb, ""idx"", 0), sdb_const_get (sdb, ""name"", 0)); r_cons_printf ("" Flags: %s Version: %d\n"", sdb_const_get (sdb, ""flags"", 0), (int)sdb_num_get (sdb, ""version"", 0)); } firstit_dowhile_vernaux = false; } while (sdb); if (IS_MODE_JSON (mode)) { r_cons_printf (""]}""); }; firstit_for_verneed = false; } if (IS_MODE_JSON (mode)) { r_cons_printf (""]}""); }; firstit_dowhile_verneed = false; } while (sdb); if (IS_MODE_JSON (mode)) { r_cons_printf (""]}""); } } ",0 "static void reds_mig_release(void) { if (reds->mig_spice) { free(reds->mig_spice->cert_subject); free(reds->mig_spice->host); free(reds->mig_spice); reds->mig_spice = NULL; } } ",0 "static MagickBooleanType WriteJPEGImage(const ImageInfo *image_info, Image *image) { const char *option, *sampling_factor, *value; ErrorManager error_manager; ExceptionInfo *exception; Image *volatile volatile_image; int colorspace, quality; JSAMPLE *volatile jpeg_pixels; JSAMPROW scanline[1]; MagickBooleanType status; MemoryInfo *memory_info; register JSAMPLE *q; register ssize_t i; ssize_t y; struct jpeg_compress_struct jpeg_info; struct jpeg_error_mgr jpeg_error; unsigned short scale; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); exception=(&image->exception); if ((LocaleCompare(image_info->magick,""JPS"") == 0) && (image->next != (Image *) NULL)) image=AppendImages(image,MagickFalse,exception); status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception); if (status == MagickFalse) return(status); /* Initialize JPEG parameters. */ (void) ResetMagickMemory(&error_manager,0,sizeof(error_manager)); (void) ResetMagickMemory(&jpeg_info,0,sizeof(jpeg_info)); (void) ResetMagickMemory(&jpeg_error,0,sizeof(jpeg_error)); volatile_image=image; jpeg_info.client_data=(void *) volatile_image; jpeg_info.err=jpeg_std_error(&jpeg_error); jpeg_info.err->emit_message=(void (*)(j_common_ptr,int)) JPEGWarningHandler; jpeg_info.err->error_exit=(void (*)(j_common_ptr)) JPEGErrorHandler; error_manager.image=volatile_image; memory_info=(MemoryInfo *) NULL; if (setjmp(error_manager.error_recovery) != 0) { jpeg_destroy_compress(&jpeg_info); (void) CloseBlob(volatile_image); return(MagickFalse); } jpeg_info.client_data=(void *) &error_manager; jpeg_create_compress(&jpeg_info); JPEGDestinationManager(&jpeg_info,image); if ((image->columns != (unsigned int) image->columns) || (image->rows != (unsigned int) image->rows)) ThrowWriterException(ImageError,""WidthOrHeightExceedsLimit""); jpeg_info.image_width=(unsigned int) image->columns; jpeg_info.image_height=(unsigned int) image->rows; jpeg_info.input_components=3; jpeg_info.data_precision=8; jpeg_info.in_color_space=JCS_RGB; switch (image->colorspace) { case CMYKColorspace: { jpeg_info.input_components=4; jpeg_info.in_color_space=JCS_CMYK; break; } case YCbCrColorspace: case Rec601YCbCrColorspace: case Rec709YCbCrColorspace: { jpeg_info.in_color_space=JCS_YCbCr; break; } case GRAYColorspace: case Rec601LumaColorspace: case Rec709LumaColorspace: { if (image_info->type == TrueColorType) break; jpeg_info.input_components=1; jpeg_info.in_color_space=JCS_GRAYSCALE; break; } default: { (void) TransformImageColorspace(image,sRGBColorspace); if (image_info->type == TrueColorType) break; if (SetImageGray(image,&image->exception) != MagickFalse) { jpeg_info.input_components=1; jpeg_info.in_color_space=JCS_GRAYSCALE; } break; } } jpeg_set_defaults(&jpeg_info); if (jpeg_info.in_color_space == JCS_CMYK) jpeg_set_colorspace(&jpeg_info,JCS_YCCK); if ((jpeg_info.data_precision != 12) && (image->depth <= 8)) jpeg_info.data_precision=8; else jpeg_info.data_precision=BITS_IN_JSAMPLE; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Image resolution: %.20g,%.20g"",image->x_resolution,image->y_resolution); if ((image->x_resolution != 0.0) && (image->y_resolution != 0.0)) { /* Set image resolution. */ jpeg_info.write_JFIF_header=TRUE; jpeg_info.X_density=(UINT16) image->x_resolution; jpeg_info.Y_density=(UINT16) image->y_resolution; /* Set image resolution units. */ if (image->units == PixelsPerInchResolution) jpeg_info.density_unit=(UINT8) 1; if (image->units == PixelsPerCentimeterResolution) jpeg_info.density_unit=(UINT8) 2; } jpeg_info.dct_method=JDCT_FLOAT; option=GetImageOption(image_info,""jpeg:dct-method""); if (option != (const char *) NULL) switch (*option) { case 'D': case 'd': { if (LocaleCompare(option,""default"") == 0) jpeg_info.dct_method=JDCT_DEFAULT; break; } case 'F': case 'f': { if (LocaleCompare(option,""fastest"") == 0) jpeg_info.dct_method=JDCT_FASTEST; if (LocaleCompare(option,""float"") == 0) jpeg_info.dct_method=JDCT_FLOAT; break; } case 'I': case 'i': { if (LocaleCompare(option,""ifast"") == 0) jpeg_info.dct_method=JDCT_IFAST; if (LocaleCompare(option,""islow"") == 0) jpeg_info.dct_method=JDCT_ISLOW; break; } } option=GetImageOption(image_info,""jpeg:optimize-coding""); if (option != (const char *) NULL) jpeg_info.optimize_coding=IsStringTrue(option) != MagickFalse ? TRUE : FALSE; else { MagickSizeType length; length=(MagickSizeType) jpeg_info.input_components*image->columns* image->rows*sizeof(JSAMPLE); if (length == (MagickSizeType) ((size_t) length)) { /* Perform optimization only if available memory resources permit it. */ status=AcquireMagickResource(MemoryResource,length); RelinquishMagickResource(MemoryResource,length); jpeg_info.optimize_coding=status == MagickFalse ? FALSE : TRUE; } } #if (JPEG_LIB_VERSION >= 61) && defined(C_PROGRESSIVE_SUPPORTED) if ((LocaleCompare(image_info->magick,""PJPEG"") == 0) || (image_info->interlace != NoInterlace)) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Interlace: progressive""); jpeg_simple_progression(&jpeg_info); } else if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Interlace: non-progressive""); #else if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Interlace: nonprogressive""); #endif quality=92; if ((image_info->compression != LosslessJPEGCompression) && (image->quality <= 100)) { if (image->quality != UndefinedCompressionQuality) quality=(int) image->quality; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Quality: %.20g"", (double) image->quality); } else { #if !defined(C_LOSSLESS_SUPPORTED) quality=100; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Quality: 100""); #else if (image->quality < 100) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderWarning,""LosslessToLossyJPEGConversion"",image->filename); else { int point_transform, predictor; predictor=image->quality/100; /* range 1-7 */ point_transform=image->quality % 20; /* range 0-15 */ jpeg_simple_lossless(&jpeg_info,predictor,point_transform); if (image->debug != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Compression: lossless""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Predictor: %d"",predictor); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Point Transform: %d"",point_transform); } } #endif } option=GetImageOption(image_info,""jpeg:extent""); if (option != (const char *) NULL) { Image *jpeg_image; ImageInfo *jpeg_info; jpeg_info=CloneImageInfo(image_info); jpeg_info->blob=NULL; jpeg_image=CloneImage(image,0,0,MagickTrue,&image->exception); if (jpeg_image != (Image *) NULL) { MagickSizeType extent; size_t maximum, minimum; /* Search for compression quality that does not exceed image extent. */ jpeg_image->quality=0; extent=(MagickSizeType) SiPrefixToDoubleInterval(option,100.0); (void) DeleteImageOption(jpeg_info,""jpeg:extent""); (void) DeleteImageArtifact(jpeg_image,""jpeg:extent""); maximum=image_info->quality; if (maximum < 2) maximum=101; for (minimum=2; minimum < maximum; ) { (void) AcquireUniqueFilename(jpeg_image->filename); jpeg_image->quality=minimum+(maximum-minimum+1)/2; (void) WriteJPEGImage(jpeg_info,jpeg_image); if (GetBlobSize(jpeg_image) <= extent) minimum=jpeg_image->quality+1; else maximum=jpeg_image->quality-1; (void) RelinquishUniqueFileResource(jpeg_image->filename); } quality=(int) minimum-1; jpeg_image=DestroyImage(jpeg_image); } jpeg_info=DestroyImageInfo(jpeg_info); } jpeg_set_quality(&jpeg_info,quality,TRUE); #if (JPEG_LIB_VERSION >= 70) option=GetImageOption(image_info,""quality""); if (option != (const char *) NULL) { GeometryInfo geometry_info; int flags; /* Set quality scaling for luminance and chrominance separately. */ flags=ParseGeometry(option,&geometry_info); if (((flags & RhoValue) != 0) && ((flags & SigmaValue) != 0)) { jpeg_info.q_scale_factor[0]=jpeg_quality_scaling((int) (geometry_info.rho+0.5)); jpeg_info.q_scale_factor[1]=jpeg_quality_scaling((int) (geometry_info.sigma+0.5)); jpeg_default_qtables(&jpeg_info,TRUE); } } #endif colorspace=jpeg_info.in_color_space; value=GetImageOption(image_info,""jpeg:colorspace""); if (value == (char *) NULL) value=GetImageProperty(image,""jpeg:colorspace""); if (value != (char *) NULL) colorspace=StringToInteger(value); sampling_factor=(const char *) NULL; if (colorspace == jpeg_info.in_color_space) { value=GetImageOption(image_info,""jpeg:sampling-factor""); if (value == (char *) NULL) value=GetImageProperty(image,""jpeg:sampling-factor""); if (value != (char *) NULL) { sampling_factor=value; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Input sampling-factors=%s"",sampling_factor); } } if (image_info->sampling_factor != (char *) NULL) sampling_factor=image_info->sampling_factor; if (sampling_factor == (const char *) NULL) { if (quality >= 90) for (i=0; i < MAX_COMPONENTS; i++) { jpeg_info.comp_info[i].h_samp_factor=1; jpeg_info.comp_info[i].v_samp_factor=1; } } else { char **factors; GeometryInfo geometry_info; MagickStatusType flags; /* Set sampling factor. */ i=0; factors=SamplingFactorToList(sampling_factor); if (factors != (char **) NULL) { for (i=0; i < MAX_COMPONENTS; i++) { if (factors[i] == (char *) NULL) break; flags=ParseGeometry(factors[i],&geometry_info); if ((flags & SigmaValue) == 0) geometry_info.sigma=geometry_info.rho; jpeg_info.comp_info[i].h_samp_factor=(int) geometry_info.rho; jpeg_info.comp_info[i].v_samp_factor=(int) geometry_info.sigma; factors[i]=(char *) RelinquishMagickMemory(factors[i]); } factors=(char **) RelinquishMagickMemory(factors); } for ( ; i < MAX_COMPONENTS; i++) { jpeg_info.comp_info[i].h_samp_factor=1; jpeg_info.comp_info[i].v_samp_factor=1; } } option=GetImageOption(image_info,""jpeg:q-table""); if (option != (const char *) NULL) { QuantizationTable *table; /* Custom quantization tables. */ table=GetQuantizationTable(option,""0"",&image->exception); if (table != (QuantizationTable *) NULL) { for (i=0; i < MAX_COMPONENTS; i++) jpeg_info.comp_info[i].quant_tbl_no=0; jpeg_add_quant_table(&jpeg_info,0,table->levels, jpeg_quality_scaling(quality),0); table=DestroyQuantizationTable(table); } table=GetQuantizationTable(option,""1"",&image->exception); if (table != (QuantizationTable *) NULL) { for (i=1; i < MAX_COMPONENTS; i++) jpeg_info.comp_info[i].quant_tbl_no=1; jpeg_add_quant_table(&jpeg_info,1,table->levels, jpeg_quality_scaling(quality),0); table=DestroyQuantizationTable(table); } table=GetQuantizationTable(option,""2"",&image->exception); if (table != (QuantizationTable *) NULL) { for (i=2; i < MAX_COMPONENTS; i++) jpeg_info.comp_info[i].quant_tbl_no=2; jpeg_add_quant_table(&jpeg_info,2,table->levels, jpeg_quality_scaling(quality),0); table=DestroyQuantizationTable(table); } table=GetQuantizationTable(option,""3"",&image->exception); if (table != (QuantizationTable *) NULL) { for (i=3; i < MAX_COMPONENTS; i++) jpeg_info.comp_info[i].quant_tbl_no=3; jpeg_add_quant_table(&jpeg_info,3,table->levels, jpeg_quality_scaling(quality),0); table=DestroyQuantizationTable(table); } } jpeg_start_compress(&jpeg_info,TRUE); if (image->debug != MagickFalse) { if (image->storage_class == PseudoClass) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Storage class: PseudoClass""); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Storage class: DirectClass""); (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Depth: %.20g"", (double) image->depth); if (image->colors != 0) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Number of colors: %.20g"",(double) image->colors); else (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Number of colors: unspecified""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""JPEG data precision: %d"",(int) jpeg_info.data_precision); switch (image->colorspace) { case CMYKColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Storage class: DirectClass""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: CMYK""); break; } case YCbCrColorspace: case Rec601YCbCrColorspace: case Rec709YCbCrColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: YCbCr""); break; } default: break; } switch (image->colorspace) { case CMYKColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: CMYK""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d,%dx%d,%dx%d,%dx%d"", jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor, jpeg_info.comp_info[1].h_samp_factor, jpeg_info.comp_info[1].v_samp_factor, jpeg_info.comp_info[2].h_samp_factor, jpeg_info.comp_info[2].v_samp_factor, jpeg_info.comp_info[3].h_samp_factor, jpeg_info.comp_info[3].v_samp_factor); break; } case GRAYColorspace: case Rec601LumaColorspace: case Rec709LumaColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: GRAY""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d"",jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor); break; } case sRGBColorspace: case RGBColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Image colorspace is RGB""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d,%dx%d,%dx%d"", jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor, jpeg_info.comp_info[1].h_samp_factor, jpeg_info.comp_info[1].v_samp_factor, jpeg_info.comp_info[2].h_samp_factor, jpeg_info.comp_info[2].v_samp_factor); break; } case YCbCrColorspace: case Rec601YCbCrColorspace: case Rec709YCbCrColorspace: { (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Colorspace: YCbCr""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d,%dx%d,%dx%d"", jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor, jpeg_info.comp_info[1].h_samp_factor, jpeg_info.comp_info[1].v_samp_factor, jpeg_info.comp_info[2].h_samp_factor, jpeg_info.comp_info[2].v_samp_factor); break; } default: { (void) LogMagickEvent(CoderEvent,GetMagickModule(),""Colorspace: %d"", image->colorspace); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Sampling factors: %dx%d,%dx%d,%dx%d,%dx%d"", jpeg_info.comp_info[0].h_samp_factor, jpeg_info.comp_info[0].v_samp_factor, jpeg_info.comp_info[1].h_samp_factor, jpeg_info.comp_info[1].v_samp_factor, jpeg_info.comp_info[2].h_samp_factor, jpeg_info.comp_info[2].v_samp_factor, jpeg_info.comp_info[3].h_samp_factor, jpeg_info.comp_info[3].v_samp_factor); break; } } } /* Write JPEG profiles. */ value=GetImageProperty(image,""comment""); if (value != (char *) NULL) for (i=0; i < (ssize_t) strlen(value); i+=65533L) jpeg_write_marker(&jpeg_info,JPEG_COM,(unsigned char *) value+i, (unsigned int) MagickMin((size_t) strlen(value+i),65533L)); if (image->profiles != (void *) NULL) WriteProfile(&jpeg_info,image); /* Convert MIFF to JPEG raster pixels. */ memory_info=AcquireVirtualMemory((size_t) image->columns, jpeg_info.input_components*sizeof(*jpeg_pixels)); if (memory_info == (MemoryInfo *) NULL) ThrowWriterException(ResourceLimitError,""MemoryAllocationFailed""); jpeg_pixels=(JSAMPLE *) GetVirtualMemoryBlob(memory_info); if (setjmp(error_manager.error_recovery) != 0) { jpeg_destroy_compress(&jpeg_info); if (memory_info != (MemoryInfo *) NULL) memory_info=RelinquishVirtualMemory(memory_info); (void) CloseBlob(image); return(MagickFalse); } scanline[0]=(JSAMPROW) jpeg_pixels; scale=65535/(unsigned short) GetQuantumRange((size_t) jpeg_info.data_precision); if (scale == 0) scale=1; if (jpeg_info.data_precision <= 8) { if ((jpeg_info.in_color_space == JCS_RGB) || (jpeg_info.in_color_space == JCS_YCbCr)) for (y=0; y < (ssize_t) image->rows; y++) { register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(JSAMPLE) ScaleQuantumToChar(GetPixelRed(p)); *q++=(JSAMPLE) ScaleQuantumToChar(GetPixelGreen(p)); *q++=(JSAMPLE) ScaleQuantumToChar(GetPixelBlue(p)); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } else if (jpeg_info.in_color_space == JCS_GRAYSCALE) for (y=0; y < (ssize_t) image->rows; y++) { register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(JSAMPLE) ScaleQuantumToChar(ClampToQuantum( GetPixelLuma(image,p))); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } else for (y=0; y < (ssize_t) image->rows; y++) { register const IndexPacket *indexes; register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; indexes=GetVirtualIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) { /* Convert DirectClass packets to contiguous CMYK scanlines. */ *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange- GetPixelCyan(p)))); *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange- GetPixelMagenta(p)))); *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange- GetPixelYellow(p)))); *q++=(JSAMPLE) (ScaleQuantumToChar((Quantum) (QuantumRange- GetPixelBlack(indexes+x)))); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } else if (jpeg_info.in_color_space == JCS_GRAYSCALE) for (y=0; y < (ssize_t) image->rows; y++) { register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(JSAMPLE) (ScaleQuantumToShort(ClampToQuantum( GetPixelLuma(image,p)))/scale); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } else if ((jpeg_info.in_color_space == JCS_RGB) || (jpeg_info.in_color_space == JCS_YCbCr)) for (y=0; y < (ssize_t) image->rows; y++) { register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; for (x=0; x < (ssize_t) image->columns; x++) { *q++=(JSAMPLE) (ScaleQuantumToShort(GetPixelRed(p))/scale); *q++=(JSAMPLE) (ScaleQuantumToShort(GetPixelGreen(p))/scale); *q++=(JSAMPLE) (ScaleQuantumToShort(GetPixelBlue(p))/scale); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } else for (y=0; y < (ssize_t) image->rows; y++) { register const IndexPacket *indexes; register const PixelPacket *p; register ssize_t x; p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; q=jpeg_pixels; indexes=GetVirtualIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) { /* Convert DirectClass packets to contiguous CMYK scanlines. */ *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelRed(p))/ scale); *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelGreen(p))/ scale); *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange-GetPixelBlue(p))/ scale); *q++=(JSAMPLE) (ScaleQuantumToShort(QuantumRange- GetPixelIndex(indexes+x))/scale); p++; } (void) jpeg_write_scanlines(&jpeg_info,scanline,1); status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } if (y == (ssize_t) image->rows) jpeg_finish_compress(&jpeg_info); /* Relinquish resources. */ jpeg_destroy_compress(&jpeg_info); memory_info=RelinquishVirtualMemory(memory_info); (void) CloseBlob(image); return(MagickTrue); } ",0 " void ExpectLabels(const char* html, const std::vector& id_attributes, const std::vector& name_attributes, const std::vector& labels, const std::vector& names, const std::vector& values) { std::vector control_types(labels.size(), ""text""); ExpectLabelsAndTypes(html, id_attributes, name_attributes, labels, names, values, control_types); } ",0 "static enum rdma_link_layer hns_roce_get_link_layer(struct ib_device *device, u8 port_num) { return IB_LINK_LAYER_ETHERNET; } ",0 "static int emulate_branch(unsigned short inst, struct pt_regs *regs) { /* * bfs: 8fxx: PC+=d*2+4; * bts: 8dxx: PC+=d*2+4; * bra: axxx: PC+=D*2+4; * bsr: bxxx: PC+=D*2+4 after PR=PC+4; * braf:0x23: PC+=Rn*2+4; * bsrf:0x03: PC+=Rn*2+4 after PR=PC+4; * jmp: 4x2b: PC=Rn; * jsr: 4x0b: PC=Rn after PR=PC+4; * rts: 000b: PC=PR; */ if (((inst & 0xf000) == 0xb000) || /* bsr */ ((inst & 0xf0ff) == 0x0003) || /* bsrf */ ((inst & 0xf0ff) == 0x400b)) /* jsr */ regs->pr = regs->pc + 4; if ((inst & 0xfd00) == 0x8d00) { /* bfs, bts */ regs->pc += SH_PC_8BIT_OFFSET(inst); return 0; } if ((inst & 0xe000) == 0xa000) { /* bra, bsr */ regs->pc += SH_PC_12BIT_OFFSET(inst); return 0; } if ((inst & 0xf0df) == 0x0003) { /* braf, bsrf */ regs->pc += regs->regs[(inst & 0x0f00) >> 8] + 4; return 0; } if ((inst & 0xf0df) == 0x400b) { /* jmp, jsr */ regs->pc = regs->regs[(inst & 0x0f00) >> 8]; return 0; } if ((inst & 0xffff) == 0x000b) { /* rts */ regs->pc = regs->pr; return 0; } return 1; } ",0 "hash_data(const unsigned char *data, size_t datalen, unsigned char *hash, unsigned int mechanismType) { if ((NULL == data) || (NULL == hash)) return SC_ERROR_INVALID_ARGUMENTS; if(mechanismType & SC_ALGORITHM_ECDSA_HASH_SHA1) { unsigned char data_hash[24] = { 0 }; size_t len = 0; sha1_digest(data, datalen, data_hash); len = REVERSE_ORDER4(datalen); memcpy(&data_hash[20], &len, 4); memcpy(hash, data_hash, 24); } else if(mechanismType & SC_ALGORITHM_ECDSA_HASH_SHA256) { unsigned char data_hash[36] = { 0 }; size_t len = 0; sha256_digest(data, datalen, data_hash); len = REVERSE_ORDER4(datalen); memcpy(&data_hash[32], &len, 4); memcpy(hash, data_hash, 36); } else { return SC_ERROR_NOT_SUPPORTED; } return SC_SUCCESS; } ",0 "v8::Local PrivateScriptRunner::runDOMMethod( ScriptState* scriptState, ScriptState* scriptStateInUserScript, const char* className, const char* methodName, v8::Local holder, int argc, v8::Local argv[]) { v8::Local classObject = classObjectOfPrivateScript(scriptState, className); v8::Local method; if (!classObject ->Get(scriptState->context(), v8String(scriptState->isolate(), methodName)) .ToLocal(&method) || !method->IsFunction()) { LOG(FATAL) << ""Private script error: Target DOM method was not found. (Class "" ""name = "" << className << "", Method name = "" << methodName << "")""; } initializeHolderIfNeeded(scriptState, classObject, holder); v8::TryCatch block(scriptState->isolate()); v8::Local result; if (!V8ScriptRunner::callInternalFunction( v8::Local::Cast(method), holder, argc, argv, scriptState->isolate()) .ToLocal(&result)) { rethrowExceptionInPrivateScript( scriptState->isolate(), block, scriptStateInUserScript, ExceptionState::ExecutionContext, methodName, className); block.ReThrow(); return v8::Local(); } return result; } ",0 "static ssize_t ucma_listen(struct ucma_file *file, const char __user *inbuf, int in_len, int out_len) { struct rdma_ucm_listen cmd; struct ucma_context *ctx; int ret; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; ctx = ucma_get_ctx(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); ctx->backlog = cmd.backlog > 0 && cmd.backlog < max_backlog ? cmd.backlog : max_backlog; ret = rdma_listen(ctx->cm_id, ctx->backlog); ucma_put_ctx(ctx); return ret; } ",0 "static inline int x86_pmu_addr_offset(int index) { if (boot_cpu_has(X86_FEATURE_PERFCTR_CORE)) return index << 1; return index; } ",0 "PHP_FUNCTION(openssl_random_pseudo_bytes) { long buffer_length; unsigned char *buffer = NULL; zval *zstrong_result_returned = NULL; int strong_result = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""l|z"", &buffer_length, &zstrong_result_returned) == FAILURE) { return; return; } if (buffer_length <= 0) { RETURN_FALSE; } if (zstrong_result_returned) { zval_dtor(zstrong_result_returned); ZVAL_BOOL(zstrong_result_returned, 0); } buffer = emalloc(buffer_length + 1); #ifdef PHP_WIN32 strong_result = 1; /* random/urandom equivalent on Windows */ if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE) { efree(buffer); if (php_win32_get_random_bytes(buffer, (size_t) buffer_length) == FAILURE) { efree(buffer); if (zstrong_result_returned) { RETURN_FALSE; } #else if ((strong_result = RAND_pseudo_bytes(buffer, buffer_length)) < 0) { efree(buffer); if (zstrong_result_returned) { ZVAL_BOOL(zstrong_result_returned, 0); if (zstrong_result_returned) { ZVAL_BOOL(zstrong_result_returned, 0); } RETURN_FALSE; } #endif RETVAL_STRINGL((char *)buffer, buffer_length, 0); if (zstrong_result_returned) { ZVAL_BOOL(zstrong_result_returned, strong_result); } } /* }}} */ ",1 "void InspectorController::initializeDeferredAgents() { if (m_deferredAgentsInitialized) return; m_deferredAgentsInitialized = true; InjectedScriptManager* injectedScriptManager = m_injectedScriptManager.get(); InspectorOverlay* overlay = m_overlay.get(); OwnPtr resourceAgentPtr(InspectorResourceAgent::create(m_pageAgent, m_inspectorClient)); InspectorResourceAgent* resourceAgent = resourceAgentPtr.get(); m_agents.append(resourceAgentPtr.release()); m_agents.append(InspectorCSSAgent::create(m_domAgent, m_pageAgent, resourceAgent)); m_agents.append(InspectorDOMStorageAgent::create(m_pageAgent)); m_agents.append(InspectorMemoryAgent::create()); m_agents.append(InspectorApplicationCacheAgent::create(m_pageAgent)); PageScriptDebugServer* pageScriptDebugServer = &PageScriptDebugServer::shared(); OwnPtr debuggerAgentPtr(PageDebuggerAgent::create(pageScriptDebugServer, m_pageAgent, injectedScriptManager, overlay)); InspectorDebuggerAgent* debuggerAgent = debuggerAgentPtr.get(); m_agents.append(debuggerAgentPtr.release()); m_agents.append(InspectorDOMDebuggerAgent::create(m_domAgent, debuggerAgent)); m_agents.append(InspectorProfilerAgent::create(injectedScriptManager, overlay)); m_agents.append(InspectorHeapProfilerAgent::create(injectedScriptManager)); m_agents.append(InspectorCanvasAgent::create(m_pageAgent, injectedScriptManager)); m_agents.append(InspectorInputAgent::create(m_page, m_inspectorClient)); } ",1 "int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock, int flags, int *addr_len) { struct ipv6_pinfo *np = inet6_sk(sk); struct inet_sock *inet = inet_sk(sk); struct sk_buff *skb; unsigned int ulen, copied; int peeked, off = 0; int err; int is_udplite = IS_UDPLITE(sk); int is_udp4; bool slow; if (flags & MSG_ERRQUEUE) return ipv6_recv_error(sk, msg, len, addr_len); if (np->rxpmtu && np->rxopt.bits.rxpmtu) return ipv6_recv_rxpmtu(sk, msg, len, addr_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; is_udp4 = (skb->protocol == htons(ETH_P_IP)); /* * 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_msg(skb, sizeof(struct udphdr), msg, copied); else { err = skb_copy_and_csum_datagram_msg(skb, sizeof(struct udphdr), msg); if (err == -EINVAL) goto csum_copy_err; } if (unlikely(err)) { trace_kfree_skb(skb, udpv6_recvmsg); if (!peeked) { atomic_inc(&sk->sk_drops); if (is_udp4) UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); else UDP6_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); } goto out_free; } if (!peeked) { if (is_udp4) UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INDATAGRAMS, is_udplite); else UDP6_INC_STATS_USER(sock_net(sk), UDP_MIB_INDATAGRAMS, is_udplite); } sock_recv_ts_and_drops(msg, sk, skb); /* Copy the address. */ if (msg->msg_name) { DECLARE_SOCKADDR(struct sockaddr_in6 *, sin6, msg->msg_name); sin6->sin6_family = AF_INET6; sin6->sin6_port = udp_hdr(skb)->source; sin6->sin6_flowinfo = 0; if (is_udp4) { ipv6_addr_set_v4mapped(ip_hdr(skb)->saddr, &sin6->sin6_addr); sin6->sin6_scope_id = 0; } else { sin6->sin6_addr = ipv6_hdr(skb)->saddr; sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr, inet6_iif(skb)); } *addr_len = sizeof(*sin6); } if (np->rxopt.all) ip6_datagram_recv_common_ctl(sk, msg, skb); if (is_udp4) { if (inet->cmsg_flags) ip_cmsg_recv(msg, skb); } else { if (np->rxopt.all) ip6_datagram_recv_specific_ctl(sk, 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)) { if (is_udp4) { UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); UDP_INC_STATS_USER(sock_net(sk), UDP_MIB_INERRORS, is_udplite); } else { UDP6_INC_STATS_USER(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); UDP6_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; } ",1 "static void sycc_to_rgb(int offset, int upb, int y, int cb, int cr, int *out_r, int *out_g, int *out_b) { int r, g, b; cb -= offset; cr -= offset; r = y + (int)(1.402 * (float)cr); if (r < 0) { r = 0; } else if (r > upb) { r = upb; } *out_r = r; g = y - (int)(0.344 * (float)cb + 0.714 * (float)cr); if (g < 0) { g = 0; } else if (g > upb) { g = upb; } *out_g = g; b = y + (int)(1.772 * (float)cb); if (b < 0) { b = 0; } else if (b > upb) { b = upb; } *out_b = b; } ",0 "s32 brcmf_notify_escan_complete(struct brcmf_cfg80211_info *cfg, struct brcmf_if *ifp, bool aborted, bool fw_abort) { struct brcmf_scan_params_le params_le; struct cfg80211_scan_request *scan_request; s32 err = 0; brcmf_dbg(SCAN, ""Enter\n""); /* clear scan request, because the FW abort can cause a second call */ /* to this functon and might cause a double cfg80211_scan_done */ scan_request = cfg->scan_request; cfg->scan_request = NULL; if (timer_pending(&cfg->escan_timeout)) del_timer_sync(&cfg->escan_timeout); if (fw_abort) { /* Do a scan abort to stop the driver's scan engine */ brcmf_dbg(SCAN, ""ABORT scan in firmware\n""); memset(¶ms_le, 0, sizeof(params_le)); eth_broadcast_addr(params_le.bssid); params_le.bss_type = DOT11_BSSTYPE_ANY; params_le.scan_type = 0; params_le.channel_num = cpu_to_le32(1); params_le.nprobes = cpu_to_le32(1); params_le.active_time = cpu_to_le32(-1); params_le.passive_time = cpu_to_le32(-1); params_le.home_time = cpu_to_le32(-1); /* Scan is aborted by setting channel_list[0] to -1 */ params_le.channel_list[0] = cpu_to_le16(-1); /* E-Scan (or anyother type) can be aborted by SCAN */ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SCAN, ¶ms_le, sizeof(params_le)); if (err) brcmf_err(""Scan abort failed\n""); } brcmf_scan_config_mpc(ifp, 1); /* * e-scan can be initiated by scheduled scan * which takes precedence. */ if (cfg->sched_escan) { brcmf_dbg(SCAN, ""scheduled scan completed\n""); cfg->sched_escan = false; if (!aborted) cfg80211_sched_scan_results(cfg_to_wiphy(cfg)); } else if (scan_request) { struct cfg80211_scan_info info = { .aborted = aborted, }; brcmf_dbg(SCAN, ""ESCAN Completed scan: %s\n"", aborted ? ""Aborted"" : ""Done""); cfg80211_scan_done(scan_request, &info); } if (!test_and_clear_bit(BRCMF_SCAN_STATUS_BUSY, &cfg->scan_status)) brcmf_dbg(SCAN, ""Scan complete, probably P2P scan\n""); return err; } ",0 "void FindModuleHandlesForAddresses(const void* const addresses[], HMODULE module_handles[], int stack_depth) { for (int i = 0; i < stack_depth; ++i) { HMODULE module_handle = NULL; if (GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, reinterpret_cast(addresses[i]), &module_handle)) { DCHECK_LE(reinterpret_cast(module_handle), addresses[i]); module_handles[i] = module_handle; } } } ",0 "static void br_multicast_start_querier(struct net_bridge *br) { struct net_bridge_port *port; br_multicast_open(br); list_for_each_entry(port, &br->port_list, list) { if (port->state == BR_STATE_DISABLED || port->state == BR_STATE_BLOCKING) continue; __br_multicast_enable_port(port); } } ",0 "Operator *Gfx::findOp(char *name) { int a, b, m, cmp; a = -1; b = numOps; while (b - a > 1) { m = (a + b) / 2; cmp = strcmp(opTab[m].name, name); if (cmp < 0) a = m; else if (cmp > 0) b = m; else a = b = m; } if (cmp != 0) return NULL; return &opTab[a]; } ",0 "static void disconnect_timer_handler(unsigned long ptr) { struct net_device *dev = (struct net_device *)ptr; struct ar6_softc *ar = (struct ar6_softc *)ar6k_priv(dev); A_UNTIMEOUT(&ar->disconnect_timer); ar6000_init_profile_info(ar); ar6000_disconnect(ar); } ",0 "BlobStorageContext::BlobSlice::BlobSlice(const BlobEntry& source, uint64_t slice_offset, uint64_t slice_size) { const auto& source_items = source.items(); const auto& offsets = source.offsets(); DCHECK_LE(slice_offset + slice_size, source.total_size()); size_t item_index = std::upper_bound(offsets.begin(), offsets.end(), slice_offset) - offsets.begin(); uint64_t item_offset = item_index == 0 ? slice_offset : slice_offset - offsets[item_index - 1]; size_t num_items = source_items.size(); size_t first_item_index = item_index; for (uint64_t total_sliced = 0; item_index < num_items && total_sliced < slice_size; item_index++) { const scoped_refptr& source_item = source_items[item_index]->item(); uint64_t source_length = source_item->length(); DataElement::Type type = source_item->type(); DCHECK_NE(source_length, std::numeric_limits::max()); DCHECK_NE(source_length, 0ull); uint64_t read_size = std::min(source_length - item_offset, slice_size - total_sliced); total_sliced += read_size; bool reusing_blob_item = (read_size == source_length); UMA_HISTOGRAM_BOOLEAN(""Storage.Blob.ReusedItem"", reusing_blob_item); if (reusing_blob_item) { dest_items.push_back(source_items[item_index]); if (IsBytes(type)) { total_memory_size += source_length; } continue; } scoped_refptr data_item; ShareableBlobDataItem::State state = ShareableBlobDataItem::POPULATED_WITHOUT_QUOTA; switch (type) { case DataElement::TYPE_BYTES_DESCRIPTION: case DataElement::TYPE_BYTES: { UMA_HISTOGRAM_COUNTS_1M(""Storage.BlobItemSize.BlobSlice.Bytes"", read_size / 1024); if (item_index == first_item_index) { first_item_slice_offset = item_offset; first_source_item = source_items[item_index]; } else { last_source_item = source_items[item_index]; } copying_memory_size += read_size; total_memory_size += read_size; std::unique_ptr element(new DataElement()); element->SetToBytesDescription(base::checked_cast(read_size)); data_item = new BlobDataItem(std::move(element)); state = ShareableBlobDataItem::QUOTA_NEEDED; break; } case DataElement::TYPE_FILE: { UMA_HISTOGRAM_COUNTS_1M(""Storage.BlobItemSize.BlobSlice.File"", read_size / 1024); std::unique_ptr element(new DataElement()); element->SetToFilePathRange( source_item->path(), source_item->offset() + item_offset, read_size, source_item->expected_modification_time()); data_item = new BlobDataItem(std::move(element), source_item->data_handle_); if (BlobDataBuilder::IsFutureFileItem(source_item->data_element())) { if (item_index == first_item_index) { first_item_slice_offset = item_offset; first_source_item = source_items[item_index]; } else { last_source_item = source_items[item_index]; } } break; } case DataElement::TYPE_FILE_FILESYSTEM: { UMA_HISTOGRAM_COUNTS_1M(""Storage.BlobItemSize.BlobSlice.FileSystem"", read_size / 1024); std::unique_ptr element(new DataElement()); element->SetToFileSystemUrlRange( source_item->filesystem_url(), source_item->offset() + item_offset, read_size, source_item->expected_modification_time()); data_item = new BlobDataItem(std::move(element)); break; } case DataElement::TYPE_DISK_CACHE_ENTRY: { UMA_HISTOGRAM_COUNTS_1M(""Storage.BlobItemSize.BlobSlice.CacheEntry"", read_size / 1024); std::unique_ptr element(new DataElement()); element->SetToDiskCacheEntryRange(source_item->offset() + item_offset, read_size); data_item = new BlobDataItem(std::move(element), source_item->data_handle_, source_item->disk_cache_entry(), source_item->disk_cache_stream_index(), source_item->disk_cache_side_stream_index()); break; } case DataElement::TYPE_BLOB: case DataElement::TYPE_DATA_PIPE: case DataElement::TYPE_UNKNOWN: CHECK(false) << ""Illegal blob item type: "" << type; } dest_items.push_back( new ShareableBlobDataItem(std::move(data_item), state)); item_offset = 0; } } ",0 "void WebContentsImpl::RunJavaScriptDialog(RenderFrameHost* render_frame_host, const base::string16& message, const base::string16& default_prompt, const GURL& frame_url, JavaScriptDialogType dialog_type, IPC::Message* reply_msg) { if (IsFullscreenForCurrentTab()) ExitFullscreen(true); bool suppress_this_message = ShowingInterstitialPage() || !delegate_ || delegate_->ShouldSuppressDialogs(this) || !delegate_->GetJavaScriptDialogManager(this); if (!suppress_this_message) { is_showing_javascript_dialog_ = true; dialog_manager_ = delegate_->GetJavaScriptDialogManager(this); dialog_manager_->RunJavaScriptDialog( this, frame_url, dialog_type, message, default_prompt, base::Bind(&WebContentsImpl::OnDialogClosed, base::Unretained(this), render_frame_host->GetProcess()->GetID(), render_frame_host->GetRoutingID(), reply_msg, false), &suppress_this_message); } if (suppress_this_message) { OnDialogClosed(render_frame_host->GetProcess()->GetID(), render_frame_host->GetRoutingID(), reply_msg, true, false, base::string16()); } } ",0 "bool Document::isEffectiveRootScroller(const Element& element) const { return m_rootScrollerController->effectiveRootScroller() == element; } ",0 "static void maximize_sndbuf(const int sfd) { socklen_t intsize = sizeof(int); int last_good = 0; int min, max, avg; int old_size; /* Start with the default size. */ if (getsockopt(sfd, SOL_SOCKET, SO_SNDBUF, &old_size, &intsize) != 0) { if (settings.verbose > 0) perror(""getsockopt(SO_SNDBUF)""); return; } /* Binary-search for the real maximum. */ min = old_size; max = MAX_SENDBUF_SIZE; while (min <= max) { avg = ((unsigned int)(min + max)) / 2; if (setsockopt(sfd, SOL_SOCKET, SO_SNDBUF, (void *)&avg, intsize) == 0) { last_good = avg; min = avg + 1; } else { max = avg - 1; } } if (settings.verbose > 1) fprintf(stderr, ""<%d send buffer was %d, now %d\n"", sfd, old_size, last_good); } ",0 "static apr_status_t init_callbacks(conn_rec *c, nghttp2_session_callbacks **pcb) { int rv = nghttp2_session_callbacks_new(pcb); if (rv != 0) { ap_log_cerror(APLOG_MARK, APLOG_ERR, 0, c, APLOGNO(02926) ""nghttp2_session_callbacks_new: %s"", nghttp2_strerror(rv)); return APR_EGENERAL; } NGH2_SET_CALLBACK(*pcb, send, send_cb); NGH2_SET_CALLBACK(*pcb, on_frame_recv, on_frame_recv_cb); NGH2_SET_CALLBACK(*pcb, on_invalid_frame_recv, on_invalid_frame_recv_cb); NGH2_SET_CALLBACK(*pcb, on_data_chunk_recv, on_data_chunk_recv_cb); NGH2_SET_CALLBACK(*pcb, on_stream_close, on_stream_close_cb); NGH2_SET_CALLBACK(*pcb, on_begin_headers, on_begin_headers_cb); NGH2_SET_CALLBACK(*pcb, on_header, on_header_cb); NGH2_SET_CALLBACK(*pcb, send_data, on_send_data_cb); NGH2_SET_CALLBACK(*pcb, on_frame_send, on_frame_send_cb); #ifdef H2_NG2_INVALID_HEADER_CB NGH2_SET_CALLBACK(*pcb, on_invalid_header, on_invalid_header_cb); #endif return APR_SUCCESS; } ",0 "_dbus_delete_directory (const DBusString *filename, DBusError *error) { const char *filename_c; _DBUS_ASSERT_ERROR_IS_CLEAR (error); filename_c = _dbus_string_get_const_data (filename); if (RemoveDirectoryA (filename_c) == 0) { char *emsg = _dbus_win_error_string (GetLastError ()); dbus_set_error (error, _dbus_win_error_from_last_error (), ""Failed to remove directory %s: %s"", filename_c, emsg); _dbus_win_free_error_string (emsg); return FALSE; } return TRUE; } ",0 "void __exit isi_unregister(void) { phonet_proto_unregister(PN_PROTO_PHONET, &pn_dgram_proto); } ",0 "static inline void p4_pmu_disable_event(struct perf_event *event) { struct hw_perf_event *hwc = &event->hw; /* * If event gets disabled while counter is in overflowed * state we need to clear P4_CCCR_OVF, otherwise interrupt get * asserted again and again */ (void)checking_wrmsrl(hwc->config_base, (u64)(p4_config_unpack_cccr(hwc->config)) & ~P4_CCCR_ENABLE & ~P4_CCCR_OVF & ~P4_CCCR_RESERVED); } ",0 "void ChromeClientImpl::InvalidateRect(const IntRect& update_rect) { if (!update_rect.IsEmpty()) web_view_->InvalidateRect(update_rect); } ",0 "static UINT drdynvc_send(drdynvcPlugin* drdynvc, wStream* s) { UINT status; if (!drdynvc) status = CHANNEL_RC_BAD_CHANNEL_HANDLE; else { status = drdynvc->channelEntryPoints.pVirtualChannelWriteEx(drdynvc->InitHandle, drdynvc->OpenHandle, Stream_Buffer(s), (UINT32) Stream_GetPosition(s), s); } switch (status) { case CHANNEL_RC_OK: return CHANNEL_RC_OK; case CHANNEL_RC_NOT_CONNECTED: Stream_Free(s, TRUE); return CHANNEL_RC_OK; case CHANNEL_RC_BAD_CHANNEL_HANDLE: Stream_Free(s, TRUE); WLog_ERR(TAG, ""VirtualChannelWriteEx failed with CHANNEL_RC_BAD_CHANNEL_HANDLE""); return status; default: Stream_Free(s, TRUE); WLog_Print(drdynvc->log, WLOG_ERROR, ""VirtualChannelWriteEx failed with %s [%08""PRIX32""]"", WTSErrorToString(status), status); return status; } } ",0 "static int __rb_allocate_pages(long nr_pages, struct list_head *pages, int cpu) { struct buffer_page *bpage, *tmp; long i; for (i = 0; i < nr_pages; i++) { struct page *page; /* * __GFP_NORETRY flag makes sure that the allocation fails * gracefully without invoking oom-killer and the system is * not destabilized. */ bpage = kzalloc_node(ALIGN(sizeof(*bpage), cache_line_size()), GFP_KERNEL | __GFP_NORETRY, cpu_to_node(cpu)); if (!bpage) goto free_pages; list_add(&bpage->list, pages); page = alloc_pages_node(cpu_to_node(cpu), GFP_KERNEL | __GFP_NORETRY, 0); if (!page) goto free_pages; bpage->page = page_address(page); rb_init_page(bpage->page); } return 0; free_pages: list_for_each_entry_safe(bpage, tmp, pages, list) { list_del_init(&bpage->list); free_buffer_page(bpage); } return -ENOMEM; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoTexStorage3D(GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height, GLsizei depth) { CheckErrorCallbackState(); api()->glTexStorage3DFn(target, levels, internalFormat, width, height, depth); if (CheckErrorCallbackState()) { return error::kNoError; } UpdateTextureSizeFromTarget(target); return error::kNoError; } ",0 "YR_OBJECT* _yr_object_lookup( YR_OBJECT* object, int flags, const char* pattern, va_list args) { YR_OBJECT* obj = object; const char* p = pattern; const char* key = NULL; char str[256]; int i; int index = -1; while (obj != NULL) { i = 0; while(*p != '\0' && *p != '.' && *p != '[' && i < sizeof(str) - 1) { str[i++] = *p++; } str[i] = '\0'; if (obj->type != OBJECT_TYPE_STRUCTURE) return NULL; obj = yr_object_lookup_field(obj, str); if (obj == NULL) return NULL; if (*p == '[') { p++; if (*p == '%') { p++; switch(*p++) { case 'i': index = va_arg(args, int); break; case 's': key = va_arg(args, const char*); break; default: return NULL; } } else if (*p >= '0' && *p <= '9') { index = (int) strtol(p, (char**) &p, 10); } else if (*p == '""') { i = 0; p++; // skip the opening quotation mark while (*p != '""' && *p != '\0' && i < sizeof(str)) str[i++] = *p++; str[i] = '\0'; p++; // skip the closing quotation mark key = str; } else { return NULL; } assert(*p == ']'); p++; assert(*p == '.' || *p == '\0'); switch(obj->type) { case OBJECT_TYPE_ARRAY: assert(index != -1); obj = yr_object_array_get_item(obj, flags, index); break; case OBJECT_TYPE_DICTIONARY: assert(key != NULL); obj = yr_object_dict_get_item(obj, flags, key); break; } } if (*p == '\0') break; p++; } return obj; } ",0 "int Track::Info::CopyStr(char* Info::*str, Info& dst_) const { if (str == static_cast(NULL)) return -1; char*& dst = dst_.*str; if (dst) // should be NULL already return -1; const char* const src = this->*str; if (src == NULL) return 0; const size_t len = strlen(src); dst = new (std::nothrow) char[len + 1]; if (dst == NULL) return -1; strcpy(dst, src); return 0; } ",1 "static void tx_add_credit(struct xenvif *vif) { unsigned long max_burst, max_credit; /* * Allow a burst big enough to transmit a jumbo packet of up to 128kB. * Otherwise the interface can seize up due to insufficient credit. */ max_burst = RING_GET_REQUEST(&vif->tx, vif->tx.req_cons)->size; max_burst = min(max_burst, 131072UL); max_burst = max(max_burst, vif->credit_bytes); /* Take care that adding a new chunk of credit doesn't wrap to zero. */ max_credit = vif->remaining_credit + vif->credit_bytes; if (max_credit < vif->remaining_credit) max_credit = ULONG_MAX; /* wrapped: clamp to ULONG_MAX */ vif->remaining_credit = min(max_credit, max_burst); } ",0 "void Navigate(NavigateParams* params) { Browser* source_browser = params->browser; AdjustNavigateParamsForURL(params); if (params->disposition == NEW_POPUP && (source_browser && source_browser->window())) { params->disposition = source_browser->window()->GetDispositionForPopupBounds( params->window_bounds); } params->browser = GetBrowserForDisposition(params); if (!params->browser) return; if (params->browser->tab_count() >= browser_defaults::kMaxTabCount && (params->disposition == NEW_POPUP || params->disposition == NEW_FOREGROUND_TAB || params->disposition == NEW_BACKGROUND_TAB)) { return; } if (GetSourceProfile(params, source_browser) != params->browser->profile()) { params->source_contents = NULL; params->referrer = GURL(); } ScopedBrowserDisplayer displayer(params); ScopedTargetContentsOwner target_contents_owner(params); NormalizeDisposition(params); if (params->window_action == browser::NavigateParams::NO_ACTION && source_browser != params->browser && params->browser->tabstrip_model()->empty()) { params->window_action = browser::NavigateParams::SHOW_WINDOW; } if (params->window_action == browser::NavigateParams::SHOW_WINDOW && params->disposition == NEW_POPUP && params->user_gesture == false) { params->window_action = browser::NavigateParams::SHOW_WINDOW_INACTIVE; } content::PageTransition base_transition = content::PageTransitionStripQualifier(params->transition); bool user_initiated = params->transition & content::PAGE_TRANSITION_FROM_ADDRESS_BAR || base_transition == content::PAGE_TRANSITION_TYPED || base_transition == content::PAGE_TRANSITION_AUTO_BOOKMARK || base_transition == content::PAGE_TRANSITION_GENERATED || base_transition == content::PAGE_TRANSITION_START_PAGE || base_transition == content::PAGE_TRANSITION_RELOAD || base_transition == content::PAGE_TRANSITION_KEYWORD; std::string extra_headers; int singleton_index = GetIndexOfSingletonTab(params); if (!params->target_contents && singleton_index < 0) { GURL url; if (params->url.is_empty()) { url = params->browser->GetHomePage(); params->transition = content::PageTransitionFromInt( params->transition | content::PAGE_TRANSITION_HOME_PAGE); } else { url = params->url; } if (params->disposition != CURRENT_TAB) { TabContents* source_contents = params->source_contents ? params->source_contents->tab_contents() : NULL; params->target_contents = Browser::TabContentsFactory( params->browser->profile(), tab_util::GetSiteInstanceForNewTab( source_contents, params->browser->profile(), url), MSG_ROUTING_NONE, source_contents, NULL); target_contents_owner.TakeOwnership(); params->target_contents->extension_tab_helper()-> SetExtensionAppById(params->extension_app_id); if ((params->tabstrip_add_types & TabStripModel::ADD_ACTIVE) == 0) { params->target_contents->tab_contents()->WasHidden(); } } else { params->target_contents = params->source_contents; DCHECK(params->target_contents); } if (user_initiated) { static_cast(params->target_contents-> tab_contents())->OnUserGesture(); } InitializeExtraHeaders(params, params->target_contents->profile(), &extra_headers); if (!HandleNonNavigationAboutURL(url)) { if (params->is_renderer_initiated) { params->target_contents->controller().LoadURLFromRenderer( url, params->referrer, params->transition, extra_headers); } else { params->target_contents->controller().LoadURL( url, params->referrer, params->transition, extra_headers); } } } else { } if (params->source_contents && (params->disposition == NEW_FOREGROUND_TAB || params->disposition == NEW_WINDOW) && (params->tabstrip_add_types & TabStripModel::ADD_INHERIT_OPENER)) params->source_contents->tab_contents()->Focus(); if (params->source_contents == params->target_contents) { params->browser->UpdateUIForNavigationInTab( params->target_contents, params->transition, user_initiated); } else if (singleton_index == -1) { if (params->tabstrip_index != -1) params->tabstrip_add_types |= TabStripModel::ADD_FORCE_INDEX; params->browser->tabstrip_model()->AddTabContents( params->target_contents, params->tabstrip_index, params->transition, params->tabstrip_add_types); target_contents_owner.ReleaseOwnership(); } if (singleton_index >= 0) { TabContents* target = params->browser->GetTabContentsAt(singleton_index); if (target->is_crashed()) { target->controller().Reload(true); } else if (params->path_behavior == NavigateParams::IGNORE_AND_NAVIGATE && target->GetURL() != params->url) { InitializeExtraHeaders(params, NULL, &extra_headers); if (params->is_renderer_initiated) { target->controller().LoadURLFromRenderer( params->url, params->referrer, params->transition, extra_headers); } else { target->controller().LoadURL( params->url, params->referrer, params->transition, extra_headers); } } if (params->source_contents != params->target_contents) params->browser->ActivateTabAt(singleton_index, user_initiated); } if (params->disposition != CURRENT_TAB) { NotificationService::current()->Notify( content::NOTIFICATION_TAB_ADDED, Source(params->browser), Details(params->target_contents->tab_contents())); } } ",0 "static int devicenbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int *cont, int *stack_depth) { os_ptr op = osp; /* required by ""push"" macro */ int code, use, n_comp; ref narray; code = devicentransform(i_ctx_p, space, &use, stage, stack_depth); if (code != 0) return code; if (!use) { *stage = 0; *cont = 0; code = array_get(imemory, space, 1, &narray); if (code < 0) return code; n_comp = r_size(&narray); pop(n_comp); op = osp; switch(base) { case 0: push(1); make_real(op, 0.0); break; case 1: case 2: push(3); make_real(&op[-2], 0.0); make_real(&op[-1], 0.0); make_real(op, 0.0); break; case 3: push(4); make_real(&op[-3], 0.0); make_real(&op[-2], 0.0); make_real(&op[-1], 0.0); make_real(op, 0.0); break; } } else { *stage = 0; *cont = 1; } return 0; } ",0 "void Browser::UpdateCommandsForTabState() { TabContents* current_tab = GetSelectedTabContents(); if (!current_tab) // May be NULL during tab restore. return; NavigationController& nc = current_tab->controller(); command_updater_.UpdateCommandEnabled(IDC_BACK, nc.CanGoBack()); command_updater_.UpdateCommandEnabled(IDC_FORWARD, nc.CanGoForward()); command_updater_.UpdateCommandEnabled(IDC_RELOAD, CanReloadContents(current_tab)); command_updater_.UpdateCommandEnabled(IDC_RELOAD_IGNORING_CACHE, CanReloadContents(current_tab)); bool non_app_window = !(type() & TYPE_APP); command_updater_.UpdateCommandEnabled(IDC_DUPLICATE_TAB, non_app_window && CanDuplicateContentsAt(selected_index())); command_updater_.UpdateCommandEnabled(IDC_SELECT_NEXT_TAB, non_app_window && tab_count() > 1); command_updater_.UpdateCommandEnabled(IDC_SELECT_PREVIOUS_TAB, non_app_window && tab_count() > 1); window_->SetStarredState(current_tab->is_starred()); command_updater_.UpdateCommandEnabled(IDC_BOOKMARK_ALL_TABS, browser_defaults::bookmarks_enabled && CanBookmarkAllTabs()); command_updater_.UpdateCommandEnabled(IDC_VIEW_SOURCE, current_tab->controller().CanViewSource()); command_updater_.UpdateCommandEnabled(IDC_EMAIL_PAGE_LOCATION, current_tab->ShouldDisplayURL() && current_tab->GetURL().is_valid()); NavigationEntry* active_entry = nc.GetActiveEntry(); bool is_chrome_internal = (active_entry ? active_entry->url().SchemeIs(chrome::kChromeUIScheme) : false); command_updater_.UpdateCommandEnabled(IDC_ENCODING_MENU, !is_chrome_internal && SavePackage::IsSavableContents( current_tab->contents_mime_type())); #if !defined(OS_MACOSX) command_updater_.UpdateCommandEnabled(IDC_CREATE_SHORTCUTS, web_app::IsValidUrl(current_tab->GetURL())); #endif UpdateCommandsForContentRestrictionState(); } ",0 "png_save_uint_16(png_bytep buf, unsigned int i) { buf[0] = (png_byte)((i >> 8) & 0xff); buf[1] = (png_byte)(i & 0xff); } ",0 "static void __init evm_init_config(void) { #ifdef CONFIG_EVM_ATTR_FSUUID evm_hmac_attrs |= EVM_ATTR_FSUUID; #endif pr_info(""HMAC attrs: 0x%x\n"", evm_hmac_attrs); } ",0 " void AccountReady(const AccountInfo& info, const identity::AccountState& state) { GetIdentityManager().GetAccessToken( host_->delegate_->GetAccountId().GetUserEmail(), {}, kIdentityConsumerId, base::BindOnce(&AccountTokenDelegate::GotChromeAccessToken, base::Unretained(this))); } ",0 "void Compositor::DidUpdateLayers() { VLOG(3) << ""After updating layers:\n"" << ""property trees:\n"" << host_->property_trees()->ToString() << ""\n"" << ""cc::Layers:\n"" << host_->LayersAsString(); } ",0 "static long mem_cgroup_read_stat(struct mem_cgroup *memcg, enum mem_cgroup_stat_index idx) { long val = 0; int cpu; get_online_cpus(); for_each_online_cpu(cpu) val += per_cpu(memcg->stat->count[idx], cpu); #ifdef CONFIG_HOTPLUG_CPU spin_lock(&memcg->pcp_counter_lock); val += memcg->nocpu_base.count[idx]; spin_unlock(&memcg->pcp_counter_lock); #endif put_online_cpus(); return val; } ",0 "void MessageLoop::SetNestableTasksAllowed(bool allowed) { if (allowed) { CHECK(RunLoop::IsNestingAllowedOnCurrentThread()); pump_->ScheduleWork(); } nestable_tasks_allowed_ = allowed; } ",1 "get_counters(const struct xt_table_info *t, struct xt_counters counters[]) { struct ip6t_entry *iter; unsigned int cpu; unsigned int i; for_each_possible_cpu(cpu) { seqcount_t *s = &per_cpu(xt_recseq, cpu); i = 0; xt_entry_foreach(iter, t->entries, t->size) { struct xt_counters *tmp; u64 bcnt, pcnt; unsigned int start; tmp = xt_get_per_cpu_counter(&iter->counters, cpu); do { start = read_seqcount_begin(s); bcnt = tmp->bcnt; pcnt = tmp->pcnt; } while (read_seqcount_retry(s, start)); ADD_COUNTER(counters[i], bcnt, pcnt); ++i; } } } ",0 "void UserSelectionScreen::HardLockPod(const AccountId& account_id) { view_->SetAuthType(account_id, proximity_auth::mojom::AuthType::OFFLINE_PASSWORD, base::string16()); EasyUnlockService* service = GetEasyUnlockServiceForUser(account_id); if (!service) return; service->SetHardlockState(EasyUnlockScreenlockStateHandler::USER_HARDLOCK); } ",0 "static void ucma_copy_ud_event(struct rdma_ucm_ud_param *dst, struct rdma_ud_param *src) { if (src->private_data_len) memcpy(dst->private_data, src->private_data, src->private_data_len); dst->private_data_len = src->private_data_len; ib_copy_ah_attr_to_user(&dst->ah_attr, &src->ah_attr); dst->qp_num = src->qp_num; dst->qkey = src->qkey; } ",0 "static void voidMethodStringArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodStringArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "create_attr_ival( int attr, int value ) { attr_val *my_val; my_val = emalloc_zero(sizeof(*my_val)); my_val->attr = attr; my_val->value.i = value; my_val->type = T_Integer; return my_val; } ",0 "void WebRuntimeFeatures::EnablePushMessaging(bool enable) { RuntimeEnabledFeatures::SetPushMessagingEnabled(enable); } ",0 "static void drawPageBackground(HDC dc, const RECT& rect) { ::FillRect(dc, &rect, reinterpret_cast(COLOR_WINDOW + 1)); } ",0 "int jpc_bitstream_putbit_func(jpc_bitstream_t *bitstream, int b) { int ret; JAS_DBGLOG(1000, (""jpc_bitstream_putbit_func(%p, %d)\n"", bitstream, b)); ret = jpc_bitstream_putbit_macro(bitstream, b); JAS_DBGLOG(1000, (""jpc_bitstream_putbit_func() -> %d\n"", ret)); return ret; } ",0 " SecurityState() : enabled_bindings_(0), can_read_raw_cookies_(false), can_send_midi_sysex_(false) { } ",0 "void bpf_map_put(struct bpf_map *map) { if (atomic_dec_and_test(&map->refcnt)) { INIT_WORK(&map->work, bpf_map_free_deferred); schedule_work(&map->work); } } ",0 "gpu::CommandBuffer::State CommandBufferProxyImpl::GetLastState() { return last_state_; } ",0 "static STACK_OF(X509) * load_all_certs_from_file(char *certfile) { STACK_OF(X509_INFO) *sk=NULL; STACK_OF(X509) *stack=NULL, *ret=NULL; BIO *in=NULL; X509_INFO *xi; TSRMLS_FETCH(); if(!(stack = sk_X509_new_null())) { php_error_docref(NULL TSRMLS_CC, E_ERROR, ""memory allocation failure""); goto end; } if (php_openssl_open_base_dir_chk(certfile TSRMLS_CC)) { sk_X509_free(stack); goto end; } if(!(in=BIO_new_file(certfile, ""r""))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""error opening the file, %s"", certfile); sk_X509_free(stack); goto end; } /* This loads from a file, a stack of x509/crl/pkey sets */ if(!(sk=PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""error reading the file, %s"", certfile); sk_X509_free(stack); goto end; } /* scan over it and pull out the certs */ while (sk_X509_INFO_num(sk)) { xi=sk_X509_INFO_shift(sk); if (xi->x509 != NULL) { sk_X509_push(stack,xi->x509); xi->x509=NULL; } X509_INFO_free(xi); } if(!sk_X509_num(stack)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""no certificates in file, %s"", certfile); sk_X509_free(stack); goto end; } ret=stack; end: BIO_free(in); sk_X509_INFO_free(sk); return ret; } ",0 "RenderViewHostManager::~RenderViewHostManager() { if (pending_render_view_host_) CancelPending(); RenderViewHostImpl* render_view_host = render_view_host_; render_view_host_ = NULL; if (render_view_host) render_view_host->Shutdown(); for (RenderViewHostMap::iterator iter = swapped_out_hosts_.begin(); iter != swapped_out_hosts_.end(); ++iter) { iter->second->Shutdown(); } } ",0 "int64 BaseNode::GetFirstChildId() const { syncable::Directory* dir = GetTransaction()->GetLookup(); syncable::BaseTransaction* trans = GetTransaction()->GetWrappedTrans(); syncable::Id id_string = dir->GetFirstChildId(trans, GetEntry()->Get(syncable::ID)); if (id_string.IsRoot()) return kInvalidId; return IdToMetahandle(GetTransaction()->GetWrappedTrans(), id_string); } ",0 "static int nfs4_xdr_enc_close(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) { struct xdr_stream xdr; struct compound_hdr hdr = { .nops = 3, }; int status; xdr_init_encode(&xdr, &req->rq_snd_buf, p); encode_compound_hdr(&xdr, &hdr); status = encode_putfh(&xdr, args->fh); if(status) goto out; status = encode_close(&xdr, args); if (status != 0) goto out; status = encode_getfattr(&xdr, args->bitmask); out: return status; } ",0 "bool WebRequestPermissions::CanExtensionAccessInitiator( const extensions::InfoMap* extension_info_map, const extensions::ExtensionId extension_id, const base::Optional& initiator, int tab_id, bool crosses_incognito) { PermissionsData::AccessType access = PermissionsData::ACCESS_ALLOWED; if (initiator) { access = CanExtensionAccessURL( extension_info_map, extension_id, initiator->GetURL(), tab_id, crosses_incognito, WebRequestPermissions::REQUIRE_HOST_PERMISSION, base::nullopt); } return access == PermissionsData::ACCESS_ALLOWED; } ",0 "AuthenticatorNoAvailableTransportsErrorModel::GetCancelButtonLabel() const { return l10n_util::GetStringUTF16(IDS_CLOSE); } ",0 "static tBTM_SEC_SERV_REC *btm_sec_find_next_serv (tBTM_SEC_SERV_REC *p_cur) { tBTM_SEC_SERV_REC *p_serv_rec = &btm_cb.sec_serv_rec[0]; int i; for (i = 0; i < BTM_SEC_MAX_SERVICE_RECORDS; i++, p_serv_rec++) { if ((p_serv_rec->security_flags & BTM_SEC_IN_USE) && (p_serv_rec->psm == p_cur->psm) ) { if (p_cur != p_serv_rec) { return(p_serv_rec); } } } return(NULL); } ",0 "void AppCacheGroup::RemoveUpdateObserver(UpdateObserver* observer) { observers_.RemoveObserver(observer); queued_observers_.RemoveObserver(observer); } ",0 "brcmf_cfg80211_start_ap(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_ap_settings *settings) { s32 ie_offset; struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_if *ifp = netdev_priv(ndev); const struct brcmf_tlv *ssid_ie; const struct brcmf_tlv *country_ie; struct brcmf_ssid_le ssid_le; s32 err = -EPERM; const struct brcmf_tlv *rsn_ie; const struct brcmf_vs_tlv *wpa_ie; struct brcmf_join_params join_params; enum nl80211_iftype dev_role; struct brcmf_fil_bss_enable_le bss_enable; u16 chanspec = chandef_to_chanspec(&cfg->d11inf, &settings->chandef); bool mbss; int is_11d; brcmf_dbg(TRACE, ""ctrlchn=%d, center=%d, bw=%d, beacon_interval=%d, dtim_period=%d,\n"", settings->chandef.chan->hw_value, settings->chandef.center_freq1, settings->chandef.width, settings->beacon_interval, settings->dtim_period); brcmf_dbg(TRACE, ""ssid=%s(%zu), auth_type=%d, inactivity_timeout=%d\n"", settings->ssid, settings->ssid_len, settings->auth_type, settings->inactivity_timeout); dev_role = ifp->vif->wdev.iftype; mbss = ifp->vif->mbss; /* store current 11d setting */ brcmf_fil_cmd_int_get(ifp, BRCMF_C_GET_REGULATORY, &ifp->vif->is_11d); country_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, settings->beacon.tail_len, WLAN_EID_COUNTRY); is_11d = country_ie ? 1 : 0; memset(&ssid_le, 0, sizeof(ssid_le)); if (settings->ssid == NULL || settings->ssid_len == 0) { ie_offset = DOT11_MGMT_HDR_LEN + DOT11_BCN_PRB_FIXED_LEN; ssid_ie = brcmf_parse_tlvs( (u8 *)&settings->beacon.head[ie_offset], settings->beacon.head_len - ie_offset, WLAN_EID_SSID); if (!ssid_ie) return -EINVAL; memcpy(ssid_le.SSID, ssid_ie->data, ssid_ie->len); ssid_le.SSID_len = cpu_to_le32(ssid_ie->len); brcmf_dbg(TRACE, ""SSID is (%s) in Head\n"", ssid_le.SSID); } else { memcpy(ssid_le.SSID, settings->ssid, settings->ssid_len); ssid_le.SSID_len = cpu_to_le32((u32)settings->ssid_len); } if (!mbss) { brcmf_set_mpc(ifp, 0); brcmf_configure_arp_nd_offload(ifp, false); } /* find the RSN_IE */ rsn_ie = brcmf_parse_tlvs((u8 *)settings->beacon.tail, settings->beacon.tail_len, WLAN_EID_RSN); /* find the WPA_IE */ wpa_ie = brcmf_find_wpaie((u8 *)settings->beacon.tail, settings->beacon.tail_len); if ((wpa_ie != NULL || rsn_ie != NULL)) { brcmf_dbg(TRACE, ""WPA(2) IE is found\n""); if (wpa_ie != NULL) { /* WPA IE */ err = brcmf_configure_wpaie(ifp, wpa_ie, false); if (err < 0) goto exit; } else { struct brcmf_vs_tlv *tmp_ie; tmp_ie = (struct brcmf_vs_tlv *)rsn_ie; /* RSN IE */ err = brcmf_configure_wpaie(ifp, tmp_ie, true); if (err < 0) goto exit; } } else { brcmf_dbg(TRACE, ""No WPA(2) IEs found\n""); brcmf_configure_opensecurity(ifp); } brcmf_config_ap_mgmt_ie(ifp->vif, &settings->beacon); /* Parameters shared by all radio interfaces */ if (!mbss) { if (is_11d != ifp->vif->is_11d) { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, is_11d); if (err < 0) { brcmf_err(""Regulatory Set Error, %d\n"", err); goto exit; } } if (settings->beacon_interval) { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_BCNPRD, settings->beacon_interval); if (err < 0) { brcmf_err(""Beacon Interval Set Error, %d\n"", err); goto exit; } } if (settings->dtim_period) { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_DTIMPRD, settings->dtim_period); if (err < 0) { brcmf_err(""DTIM Interval Set Error, %d\n"", err); goto exit; } } if ((dev_role == NL80211_IFTYPE_AP) && ((ifp->ifidx == 0) || !brcmf_feat_is_enabled(ifp, BRCMF_FEAT_RSDB))) { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); if (err < 0) { brcmf_err(""BRCMF_C_DOWN error %d\n"", err); goto exit; } brcmf_fil_iovar_int_set(ifp, ""apsta"", 0); } err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_INFRA, 1); if (err < 0) { brcmf_err(""SET INFRA error %d\n"", err); goto exit; } } else if (WARN_ON(is_11d != ifp->vif->is_11d)) { /* Multiple-BSS should use same 11d configuration */ err = -EINVAL; goto exit; } /* Interface specific setup */ if (dev_role == NL80211_IFTYPE_AP) { if ((brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) && (!mbss)) brcmf_fil_iovar_int_set(ifp, ""mbss"", 1); err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 1); if (err < 0) { brcmf_err(""setting AP mode failed %d\n"", err); goto exit; } if (!mbss) { /* Firmware 10.x requires setting channel after enabling * AP and before bringing interface up. */ err = brcmf_fil_iovar_int_set(ifp, ""chanspec"", chanspec); if (err < 0) { brcmf_err(""Set Channel failed: chspec=%d, %d\n"", chanspec, err); goto exit; } } err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); if (err < 0) { brcmf_err(""BRCMF_C_UP error (%d)\n"", err); goto exit; } /* On DOWN the firmware removes the WEP keys, reconfigure * them if they were set. */ brcmf_cfg80211_reconfigure_wep(ifp); memset(&join_params, 0, sizeof(join_params)); /* join parameters starts with ssid */ memcpy(&join_params.ssid_le, &ssid_le, sizeof(ssid_le)); /* create softap */ err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, &join_params, sizeof(join_params)); if (err < 0) { brcmf_err(""SET SSID error (%d)\n"", err); goto exit; } if (settings->hidden_ssid) { err = brcmf_fil_iovar_int_set(ifp, ""closednet"", 1); if (err) { brcmf_err(""closednet error (%d)\n"", err); goto exit; } } brcmf_dbg(TRACE, ""AP mode configuration complete\n""); } else if (dev_role == NL80211_IFTYPE_P2P_GO) { err = brcmf_fil_iovar_int_set(ifp, ""chanspec"", chanspec); if (err < 0) { brcmf_err(""Set Channel failed: chspec=%d, %d\n"", chanspec, err); goto exit; } err = brcmf_fil_bsscfg_data_set(ifp, ""ssid"", &ssid_le, sizeof(ssid_le)); if (err < 0) { brcmf_err(""setting ssid failed %d\n"", err); goto exit; } bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); bss_enable.enable = cpu_to_le32(1); err = brcmf_fil_iovar_data_set(ifp, ""bss"", &bss_enable, sizeof(bss_enable)); if (err < 0) { brcmf_err(""bss_enable config failed %d\n"", err); goto exit; } brcmf_dbg(TRACE, ""GO mode configuration complete\n""); } else { WARN_ON(1); } set_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); brcmf_net_setcarrier(ifp, true); exit: if ((err) && (!mbss)) { brcmf_set_mpc(ifp, 1); brcmf_configure_arp_nd_offload(ifp, true); } return err; } ",1 "void TaskQueue::QueueAsValueInto(const base::TaskQueue& queue, base::trace_event::TracedValue* state) { base::TaskQueue queue_copy(queue); while (!queue_copy.empty()) { TaskAsValueInto(queue_copy.front(), state); queue_copy.pop(); } } ",0 "void Document::CheckCompleted() { if (!ShouldComplete()) return; if (frame_) { frame_->Client()->RunScriptsAtDocumentIdle(); if (!frame_) return; if (!ShouldComplete()) return; } SetReadyState(kComplete); if (LoadEventStillNeeded()) ImplicitClose(); if (!frame_ || !frame_->IsAttached()) return; if (frame_->GetSettings()->GetSavePreviousDocumentResources() == SavePreviousDocumentResources::kUntilOnLoad) { fetcher_->ClearResourcesFromPreviousFetcher(); } frame_->GetNavigationScheduler().StartTimer(); View()->HandleLoadCompleted(); if (!AllDescendantsAreComplete(frame_)) return; if (!Loader()->SentDidFinishLoad()) { if (frame_->IsMainFrame()) GetViewportDescription().ReportMobilePageStats(frame_); Loader()->SetSentDidFinishLoad(); frame_->Client()->DispatchDidFinishLoad(); if (!frame_) return; if (frame_->Client()->GetRemoteNavigationAssociatedInterfaces()) { mojom::blink::UkmSourceIdFrameHostAssociatedPtr ukm_binding; frame_->Client()->GetRemoteNavigationAssociatedInterfaces()->GetInterface( &ukm_binding); DCHECK(ukm_binding.is_bound()); ukm_binding->SetDocumentSourceId(ukm_source_id_); } } frame_->Loader().DidFinishNavigation(); } ",0 "void LayoutBlockFlow::moveChildrenTo(LayoutBoxModelObject* toBoxModelObject, LayoutObject* startChild, LayoutObject* endChild, LayoutObject* beforeChild, bool fullRemoveInsert) { if (childrenInline()) deleteLineBoxTree(); LayoutBoxModelObject::moveChildrenTo(toBoxModelObject, startChild, endChild, beforeChild, fullRemoveInsert); } ",0 "AXObject* AXLayoutObject::rawNextSibling() const { if (!m_layoutObject) return 0; LayoutObject* nextSibling = 0; LayoutInline* inlineContinuation = m_layoutObject->isLayoutBlockFlow() ? toLayoutBlockFlow(m_layoutObject)->inlineElementContinuation() : nullptr; if (inlineContinuation) { nextSibling = firstChildConsideringContinuation(inlineContinuation); } else if (m_layoutObject->isAnonymousBlock() && lastChildHasContinuation(m_layoutObject)) { LayoutObject* lastParent = endOfContinuations(toLayoutBlock(m_layoutObject)->lastChild()) ->parent(); while (lastChildHasContinuation(lastParent)) lastParent = endOfContinuations(lastParent->slowLastChild())->parent(); nextSibling = lastParent->nextSibling(); } else if (LayoutObject* ns = m_layoutObject->nextSibling()) { nextSibling = ns; } else if (isInlineWithContinuation(m_layoutObject)) { nextSibling = endOfContinuations(m_layoutObject)->nextSibling(); } else if (m_layoutObject->parent() && isInlineWithContinuation(m_layoutObject->parent())) { LayoutObject* continuation = toLayoutInline(m_layoutObject->parent())->continuation(); if (continuation->isLayoutBlock()) { nextSibling = continuation; } else { nextSibling = firstChildConsideringContinuation(continuation); } } if (!nextSibling) return 0; return axObjectCache().getOrCreate(nextSibling); } ",0 "test_run_handler_expand (void) { uzbl.net.useragent = ""Test uzbl uzr agent""; run_handler(""sync_spawn echo @useragent"", ""result:""); assert(uzbl.comm.sync_stdout); /* the result should begin with the standard handler arguments */ gchar *rest = assert_sync_beginswith_stdarg(); /* the rest of the result should be the arguments passed to run_handler. */ /* the user-specified arguments to the handler should have been expanded */ g_assert_cmpstr(""result: Test uzbl uzr agent\n"", ==, rest); } ",0 "static void cfunbody(JF, js_Ast *name, js_Ast *params, js_Ast *body) { F->lightweight = 1; F->arguments = 0; if (F->script) F->lightweight = 0; /* Check if first statement is 'use strict': */ if (body && body->type == AST_LIST && body->a && body->a->type == EXP_STRING) if (!strcmp(body->a->string, ""use strict"")) F->strict = 1; F->lastline = F->line; cparams(J, F, params, name); if (body) { cvardecs(J, F, body); cfundecs(J, F, body); } if (name) { checkfutureword(J, F, name); if (findlocal(J, F, name->string) < 0) { emit(J, F, OP_CURRENT); emit(J, F, OP_SETLOCAL); emitarg(J, F, addlocal(J, F, name, 0)); emit(J, F, OP_POP); } } if (F->script) { emit(J, F, OP_UNDEF); cstmlist(J, F, body); emit(J, F, OP_RETURN); } else { cstmlist(J, F, body); emit(J, F, OP_UNDEF); emit(J, F, OP_RETURN); } } ",0 "void ClearCookiesOnIO(net::URLRequestContextGetter* context_getter, std::unique_ptr callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); net::URLRequestContext* request_context = context_getter->GetURLRequestContext(); request_context->cookie_store()->DeleteAllAsync( base::BindOnce(&ClearedCookiesOnIO, base::Passed(std::move(callback)))); } ",0 "static int find_snapshot_by_id_and_name(BlockDriverState *bs, const char *id, const char *name) { BDRVQcowState *s = bs->opaque; int i; if (id && name) { for (i = 0; i < s->nb_snapshots; i++) { if (!strcmp(s->snapshots[i].id_str, id) && !strcmp(s->snapshots[i].name, name)) { return i; } } } else if (id) { for (i = 0; i < s->nb_snapshots; i++) { if (!strcmp(s->snapshots[i].id_str, id)) { return i; } } } else if (name) { for (i = 0; i < s->nb_snapshots; i++) { if (!strcmp(s->snapshots[i].name, name)) { return i; } } } return -1; } ",0 "PHP_NAMED_FUNCTION(php_if_fopen) { char *filename, *mode; int filename_len, mode_len; zend_bool use_include_path = 0; zval *zcontext = NULL; php_stream *stream; php_stream_context *context = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""ps|br"", &filename, &filename_len, &mode, &mode_len, &use_include_path, &zcontext) == FAILURE) { RETURN_FALSE; } context = php_stream_context_from_zval(zcontext, 0); stream = php_stream_open_wrapper_ex(filename, mode, (use_include_path ? USE_PATH : 0) | REPORT_ERRORS, NULL, context); if (stream == NULL) { RETURN_FALSE; } php_stream_to_zval(stream, return_value); } ",0 "static void ccid3_hc_rx_exit(struct sock *sk) { struct ccid3_hc_rx_sock *hc = ccid3_hc_rx_sk(sk); tfrc_rx_hist_purge(&hc->rx_hist); tfrc_lh_cleanup(&hc->rx_li_hist); } ",0 "void Browser::SetWebContentsBlocked(content::WebContents* web_contents, bool blocked) { int index = tab_strip_model_->GetIndexOfWebContents(web_contents); if (index == TabStripModel::kNoTab) { return; } tab_strip_model_->SetTabBlocked(index, blocked); bool browser_active = BrowserList::GetInstance()->GetLastActive() == this; bool contents_is_active = tab_strip_model_->GetActiveWebContents() == web_contents; if (!blocked && contents_is_active && browser_active) web_contents->Focus(); } ",1 "void OfflinePageModelImpl::ClearStorageIfNeeded( const ClearStorageCallback& callback) { if (!storage_manager_) { storage_manager_.reset(new OfflinePageStorageManager( this, GetPolicyController(), archive_manager_.get())); } storage_manager_->ClearPagesIfNeeded(callback); } ",0 "static void efx_fini_channels(struct efx_nic *efx) { struct efx_channel *channel; struct efx_tx_queue *tx_queue; struct efx_rx_queue *rx_queue; int rc; EFX_ASSERT_RESET_SERIALISED(efx); BUG_ON(efx->port_enabled); rc = efx_nic_flush_queues(efx); if (rc && EFX_WORKAROUND_7803(efx)) { /* Schedule a reset to recover from the flush failure. The * descriptor caches reference memory we're about to free, * but falcon_reconfigure_mac_wrapper() won't reconnect * the MACs because of the pending reset. */ netif_err(efx, drv, efx->net_dev, ""Resetting to recover from flush failure\n""); efx_schedule_reset(efx, RESET_TYPE_ALL); } else if (rc) { netif_err(efx, drv, efx->net_dev, ""failed to flush queues\n""); } else { netif_dbg(efx, drv, efx->net_dev, ""successfully flushed all queues\n""); } efx_for_each_channel(channel, efx) { netif_dbg(channel->efx, drv, channel->efx->net_dev, ""shut down chan %d\n"", channel->channel); efx_for_each_channel_rx_queue(rx_queue, channel) efx_fini_rx_queue(rx_queue); efx_for_each_possible_channel_tx_queue(tx_queue, channel) efx_fini_tx_queue(tx_queue); efx_fini_eventq(channel); } } ",0 "static uint32_t timer_is_periodic(HPETTimer *t) { return t->config & HPET_TN_PERIODIC; } ",0 "void add_index_objects_to_pending(struct rev_info *revs, unsigned flags) { int i; read_cache(); for (i = 0; i < active_nr; i++) { struct cache_entry *ce = active_cache[i]; struct blob *blob; if (S_ISGITLINK(ce->ce_mode)) continue; blob = lookup_blob(ce->sha1); if (!blob) die(""unable to add index blob to traversal""); add_pending_object_with_path(revs, &blob->object, """", ce->ce_mode, ce->name); } if (active_cache_tree) { struct strbuf path = STRBUF_INIT; add_cache_tree(active_cache_tree, revs, &path); strbuf_release(&path); } } ",0 "void Browser::MoveContents(TabContents* source, const gfx::Rect& pos) { if ((type() & TYPE_POPUP) == 0) { NOTREACHED() << ""moving invalid browser type""; return; } window_->SetBounds(pos); } ",0 "static int sctp_getsockopt_paddr_thresholds(struct sock *sk, char __user *optval, int len, int __user *optlen) { struct sctp_paddrthlds val; struct sctp_transport *trans; struct sctp_association *asoc; if (len < sizeof(struct sctp_paddrthlds)) return -EINVAL; len = sizeof(struct sctp_paddrthlds); if (copy_from_user(&val, (struct sctp_paddrthlds __user *)optval, len)) return -EFAULT; if (sctp_is_any(sk, (const union sctp_addr *)&val.spt_address)) { asoc = sctp_id2assoc(sk, val.spt_assoc_id); if (!asoc) return -ENOENT; val.spt_pathpfthld = asoc->pf_retrans; val.spt_pathmaxrxt = asoc->pathmaxrxt; } else { trans = sctp_addr_id2transport(sk, &val.spt_address, val.spt_assoc_id); if (!trans) return -ENOENT; val.spt_pathmaxrxt = trans->pathmaxrxt; val.spt_pathpfthld = trans->pf_retrans; } if (put_user(len, optlen) || copy_to_user(optval, &val, len)) return -EFAULT; return 0; } ",0 "OJPEGLibjpegJpegSourceMgrSkipInputData(jpeg_decompress_struct* cinfo, long num_bytes) { TIFF* tif=(TIFF*)cinfo->client_data; (void)num_bytes; TIFFErrorExt(tif->tif_clientdata,""LibJpeg"",""Unexpected error""); jpeg_encap_unwind(tif); } ",0 "void gdImageString16 (gdImagePtr im, gdFontPtr f, int x, int y, unsigned short *s, int color) { int i; int l; l = strlen16(s); for (i = 0; (i < l); i++) { gdImageChar(im, f, x, y, s[i], color); x += f->w; } } ",0 "void PageInfoBubbleView::LinkClicked(views::Link* source, int event_flags) { content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::BindOnce(&PageInfoBubbleView::HandleLinkClickedAsync, weak_factory_.GetWeakPtr(), source)); } ",0 "bool AppCacheDatabase::FindCachesForOrigin(const url::Origin& origin, std::vector* records) { DCHECK(records); std::vector group_records; if (!FindGroupsForOrigin(origin, &group_records)) return false; CacheRecord cache_record; for (const auto& record : group_records) { if (FindCacheForGroup(record.group_id, &cache_record)) records->push_back(cache_record); } return true; } ",0 "int virtio_queue_get_num(VirtIODevice *vdev, int n) { return vdev->vq[n].vring.num; } ",0 "static int tcp_v4_send_synack(struct sock *sk, struct dst_entry *dst, struct request_sock *req, struct request_values *rvp) { const struct inet_request_sock *ireq = inet_rsk(req); struct flowi4 fl4; int err = -1; struct sk_buff * skb; /* First, grab a route. */ if (!dst && (dst = inet_csk_route_req(sk, &fl4, req)) == NULL) return -1; skb = tcp_make_synack(sk, dst, req, rvp); if (skb) { __tcp_v4_send_check(skb, ireq->loc_addr, ireq->rmt_addr); err = ip_build_and_send_pkt(skb, sk, ireq->loc_addr, ireq->rmt_addr, ireq->opt); err = net_xmit_eval(err); } dst_release(dst); return err; } ",0 "status_t ProCamera2Client::exclusiveLock() { ATRACE_CALL(); ALOGV(""%s"", __FUNCTION__); Mutex::Autolock icl(mBinderSerializationLock); SharedCameraCallbacks::Lock l(mSharedCameraCallbacks); if (!mDevice.get()) return PERMISSION_DENIED; /** * TODO: this should asynchronously 'wait' until the lock becomes available * if another client already has an exclusive lock. * * once we have proper sharing support this will need to do * more than just return immediately */ if (!mExclusiveLock) { mExclusiveLock = true; if (mRemoteCallback != NULL) { mRemoteCallback->onLockStatusChanged(IProCameraCallbacks::LOCK_ACQUIRED); } ALOGV(""%s: exclusive lock acquired"", __FUNCTION__); return OK; } ALOGW(""%s: exclusive lock already exists - recursive locking is not allowed"" , __FUNCTION__); return ALREADY_EXISTS; } ",0 "OMX_ERRORTYPE SoftVorbis::internalGetParameter( OMX_INDEXTYPE index, OMX_PTR params) { switch (index) { case OMX_IndexParamAudioVorbis: { OMX_AUDIO_PARAM_VORBISTYPE *vorbisParams = (OMX_AUDIO_PARAM_VORBISTYPE *)params; if (!isValidOMXParam(vorbisParams)) { return OMX_ErrorBadParameter; } if (vorbisParams->nPortIndex != 0) { return OMX_ErrorUndefined; } vorbisParams->nBitRate = 0; vorbisParams->nMinBitRate = 0; vorbisParams->nMaxBitRate = 0; vorbisParams->nAudioBandWidth = 0; vorbisParams->nQuality = 3; vorbisParams->bManaged = OMX_FALSE; vorbisParams->bDownmix = OMX_FALSE; if (!isConfigured()) { vorbisParams->nChannels = 1; vorbisParams->nSampleRate = 44100; } else { vorbisParams->nChannels = mVi->channels; vorbisParams->nSampleRate = mVi->rate; vorbisParams->nBitRate = mVi->bitrate_nominal; vorbisParams->nMinBitRate = mVi->bitrate_lower; vorbisParams->nMaxBitRate = mVi->bitrate_upper; } return OMX_ErrorNone; } case OMX_IndexParamAudioPcm: { OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams = (OMX_AUDIO_PARAM_PCMMODETYPE *)params; if (!isValidOMXParam(pcmParams)) { return OMX_ErrorBadParameter; } if (pcmParams->nPortIndex != 1) { return OMX_ErrorUndefined; } pcmParams->eNumData = OMX_NumericalDataSigned; pcmParams->eEndian = OMX_EndianBig; pcmParams->bInterleaved = OMX_TRUE; pcmParams->nBitPerSample = 16; pcmParams->ePCMMode = OMX_AUDIO_PCMModeLinear; pcmParams->eChannelMapping[0] = OMX_AUDIO_ChannelLF; pcmParams->eChannelMapping[1] = OMX_AUDIO_ChannelRF; if (!isConfigured()) { pcmParams->nChannels = 1; pcmParams->nSamplingRate = 44100; } else { pcmParams->nChannels = mVi->channels; pcmParams->nSamplingRate = mVi->rate; } return OMX_ErrorNone; } default: return SimpleSoftOMXComponent::internalGetParameter(index, params); } } ",0 "void RenderFrameImpl::willSendSubmitEvent(blink::WebLocalFrame* frame, const blink::WebFormElement& form) { DCHECK(!frame_ || frame_ == frame); FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers(), WillSendSubmitEvent(frame, form)); } ",0 "static void spawn_reactor_thread(reactor_t *reactor) { int ret = pthread_create(&thread, NULL, reactor_thread, reactor); EXPECT_EQ(ret, 0); } ",0 "void gMemReport(FILE *f) { GMemHdr *p; fprintf(f, ""%d memory allocations in all\n"", gMemIndex); if (gMemAlloc > 0) { fprintf(f, ""%d memory blocks left allocated:\n"", gMemAlloc); fprintf(f, "" index size\n""); fprintf(f, ""-------- --------\n""); for (p = gMemHead; p; p = p->next) { fprintf(f, ""%8d %8d\n"", p->index, p->size); } } else { fprintf(f, ""No memory blocks left allocated\n""); } } ",0 "static int add_dirent_to_buf(handle_t *handle, struct dentry *dentry, struct inode *inode, struct ext4_dir_entry_2 *de, struct buffer_head *bh) { struct inode *dir = dentry->d_parent->d_inode; const char *name = dentry->d_name.name; int namelen = dentry->d_name.len; unsigned int offset = 0; unsigned int blocksize = dir->i_sb->s_blocksize; unsigned short reclen; int nlen, rlen, err; char *top; int csum_size = 0; if (EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) csum_size = sizeof(struct ext4_dir_entry_tail); reclen = EXT4_DIR_REC_LEN(namelen); if (!de) { de = (struct ext4_dir_entry_2 *)bh->b_data; top = bh->b_data + (blocksize - csum_size) - reclen; while ((char *) de <= top) { if (ext4_check_dir_entry(dir, NULL, de, bh, offset)) return -EIO; if (ext4_match(namelen, name, de)) return -EEXIST; nlen = EXT4_DIR_REC_LEN(de->name_len); rlen = ext4_rec_len_from_disk(de->rec_len, blocksize); if ((de->inode? rlen - nlen: rlen) >= reclen) break; de = (struct ext4_dir_entry_2 *)((char *)de + rlen); offset += rlen; } if ((char *) de > top) return -ENOSPC; } BUFFER_TRACE(bh, ""get_write_access""); err = ext4_journal_get_write_access(handle, bh); if (err) { ext4_std_error(dir->i_sb, err); return err; } /* By now the buffer is marked for journaling */ nlen = EXT4_DIR_REC_LEN(de->name_len); rlen = ext4_rec_len_from_disk(de->rec_len, blocksize); if (de->inode) { struct ext4_dir_entry_2 *de1 = (struct ext4_dir_entry_2 *)((char *)de + nlen); de1->rec_len = ext4_rec_len_to_disk(rlen - nlen, blocksize); de->rec_len = ext4_rec_len_to_disk(nlen, blocksize); de = de1; } de->file_type = EXT4_FT_UNKNOWN; de->inode = cpu_to_le32(inode->i_ino); ext4_set_de_type(dir->i_sb, de, inode->i_mode); de->name_len = namelen; memcpy(de->name, name, namelen); /* * XXX shouldn't update any times until successful * completion of syscall, but too many callers depend * on this. * * XXX similarly, too many callers depend on * ext4_new_inode() setting the times, but error * recovery deletes the inode, so the worst that can * happen is that the times are slightly out of date * and/or different from the directory change time. */ dir->i_mtime = dir->i_ctime = ext4_current_time(dir); ext4_update_dx_flag(dir); dir->i_version++; ext4_mark_inode_dirty(handle, dir); BUFFER_TRACE(bh, ""call ext4_handle_dirty_metadata""); err = ext4_handle_dirty_dirent_node(handle, dir, bh); if (err) ext4_std_error(dir->i_sb, err); return 0; } ",0 "bool ContentSecurityPolicy::allowFontFromSource( const KURL& url, RedirectStatus redirectStatus, SecurityViolationReportingPolicy reportingPolicy) const { return isAllowedByAll<&CSPDirectiveList::allowFontFromSource>( m_policies, url, redirectStatus, reportingPolicy); } ",0 "mountopts_check(const char *opts) { char buf[64]; const char *p; char *end; unsigned long muid; Eina_Bool nosuid, nodev, noexec, nuid; nosuid = nodev = noexec = nuid = EINA_FALSE; /* these are the only possible options which can be present here; check them strictly */ if (eina_strlcpy(buf, opts, sizeof(buf)) >= sizeof(buf)) return EINA_FALSE; for (p = buf; p && p[1]; p = strchr(p + 1, ',')) { if (p[0] == ',') p++; #define CMP(OPT) \ if (!strncmp(p, OPT, sizeof(OPT) - 1)) CMP(""nosuid,"") { nosuid = EINA_TRUE; continue; } CMP(""nodev,"") { nodev = EINA_TRUE; continue; } CMP(""noexec,"") { noexec = EINA_TRUE; continue; } CMP(""utf8,"") continue; CMP(""utf8=0,"") continue; CMP(""utf8=1,"") continue; CMP(""iocharset=utf8,"") continue; CMP(""uid="") { p += 4; errno = 0; muid = strtoul(p, &end, 10); if (muid == ULONG_MAX) return EINA_FALSE; if (errno) return EINA_FALSE; if (end[0] != ',') return EINA_FALSE; if (muid != uid) return EINA_FALSE; nuid = EINA_TRUE; continue; } return EINA_FALSE; } if ((!nosuid) || (!nodev) || (!noexec) || (!nuid)) return EINA_FALSE; return EINA_TRUE; } ",0 "void RenderFrameImpl::BeginNavigationInternal( std::unique_ptr info) { if (!CreatePlaceholderDocumentLoader(*info)) return; WebDocumentLoader* document_loader = frame_->GetProvisionalDocumentLoader(); NavigationState* navigation_state = NavigationState::FromDocumentLoader(document_loader); browser_side_navigation_pending_ = true; browser_side_navigation_pending_url_ = info->url_request.Url(); blink::WebURLRequest& request = info->url_request; WebDocument frame_document = frame_->GetDocument(); if (request.GetFrameType() == network::mojom::RequestContextFrameType::kTopLevel) request.SetSiteForCookies(request.Url()); else request.SetSiteForCookies(frame_document.SiteForCookies()); WillSendRequest(request); if (!info->url_request.GetExtraData()) info->url_request.SetExtraData(std::make_unique()); if (info->is_client_redirect) { RequestExtraData* extra_data = static_cast(info->url_request.GetExtraData()); extra_data->set_transition_type(ui::PageTransitionFromInt( extra_data->transition_type() | ui::PAGE_TRANSITION_CLIENT_REDIRECT)); } DCHECK_EQ(network::mojom::FetchRequestMode::kNavigate, info->url_request.GetFetchRequestMode()); DCHECK_EQ(network::mojom::FetchCredentialsMode::kInclude, info->url_request.GetFetchCredentialsMode()); DCHECK_EQ(network::mojom::FetchRedirectMode::kManual, info->url_request.GetFetchRedirectMode()); DCHECK(frame_->Parent() || info->url_request.GetFrameType() == network::mojom::RequestContextFrameType::kTopLevel); DCHECK(!frame_->Parent() || info->url_request.GetFrameType() == network::mojom::RequestContextFrameType::kNested); bool is_form_submission = info->navigation_type == blink::kWebNavigationTypeFormSubmitted || info->navigation_type == blink::kWebNavigationTypeFormResubmitted; GURL searchable_form_url; std::string searchable_form_encoding; if (!info->form.IsNull()) { WebSearchableFormData web_searchable_form_data(info->form); searchable_form_url = web_searchable_form_data.Url(); searchable_form_encoding = web_searchable_form_data.Encoding().Utf8(); } GURL client_side_redirect_url; if (info->is_client_redirect) client_side_redirect_url = frame_->GetDocument().Url(); blink::mojom::BlobURLTokenPtr blob_url_token( CloneBlobURLToken(info->blob_url_token.get())); int load_flags = GetLoadFlagsForWebURLRequest(info->url_request); std::unique_ptr initiator = GetDevToolsInitiator(info->devtools_initiator_info); mojom::BeginNavigationParamsPtr begin_navigation_params = mojom::BeginNavigationParams::New( GetWebURLRequestHeadersAsString(info->url_request), load_flags, info->url_request.GetSkipServiceWorker(), GetRequestContextTypeForWebURLRequest(info->url_request), GetMixedContentContextTypeForWebURLRequest(info->url_request), is_form_submission, searchable_form_url, searchable_form_encoding, client_side_redirect_url, initiator ? base::make_optional(std::move(*initiator)) : base::nullopt); mojom::NavigationClientAssociatedPtrInfo navigation_client_info; if (IsPerNavigationMojoInterfaceEnabled()) { BindNavigationClient(mojo::MakeRequest(&navigation_client_info)); navigation_state->set_navigation_client(std::move(navigation_client_impl_)); } blink::mojom::NavigationInitiatorPtr initiator_ptr( blink::mojom::NavigationInitiatorPtrInfo( std::move(info->navigation_initiator_handle), 0)); bool prevent_sandboxed_download = (frame_->EffectiveSandboxFlags() & blink::WebSandboxFlags::kDownloads) != blink::WebSandboxFlags::kNone && info->blocking_downloads_in_sandbox_enabled; GetFrameHost()->BeginNavigation( MakeCommonNavigationParams(frame_->GetSecurityOrigin(), std::move(info), load_flags, prevent_sandboxed_download), std::move(begin_navigation_params), std::move(blob_url_token), std::move(navigation_client_info), std::move(initiator_ptr)); DCHECK(navigation_state->IsContentInitiated()); for (auto& observer : observers_) { observer.DidStartProvisionalLoad(document_loader, true /* is_content_initiated */); } } ",0 "static void d_wait_lookup(struct dentry *dentry) { if (d_in_lookup(dentry)) { DECLARE_WAITQUEUE(wait, current); add_wait_queue(dentry->d_wait, &wait); do { set_current_state(TASK_UNINTERRUPTIBLE); spin_unlock(&dentry->d_lock); schedule(); spin_lock(&dentry->d_lock); } while (d_in_lookup(dentry)); } } ",0 "void tst_QQuickWebView::cleanup() { m_window.reset(); } ",0 "void out_flush_domain_queues(s2s_t s2s, const char *domain) { char *rkey; int rkeylen; char *c; int c_len; if (xhash_iter_first(s2s->outq)) { do { xhash_iter_get(s2s->outq, (const char **) &rkey, &rkeylen, NULL); c = memchr(rkey, '/', rkeylen); c++; c_len = rkeylen - (c - rkey); if (strncmp(domain, c, c_len) == 0) out_flush_route_queue(s2s, rkey, rkeylen); } while(xhash_iter_next(s2s->outq)); } } ",0 "int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) { struct page *page; struct kvm *kvm; int r; BUG_ON(vcpu->kvm == NULL); kvm = vcpu->kvm; vcpu->arch.emulate_ctxt.ops = &emulate_ops; vcpu->arch.walk_mmu = &vcpu->arch.mmu; vcpu->arch.mmu.root_hpa = INVALID_PAGE; vcpu->arch.mmu.translate_gpa = translate_gpa; vcpu->arch.nested_mmu.translate_gpa = translate_nested_gpa; if (!irqchip_in_kernel(kvm) || kvm_vcpu_is_bsp(vcpu)) vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE; else vcpu->arch.mp_state = KVM_MP_STATE_UNINITIALIZED; page = alloc_page(GFP_KERNEL | __GFP_ZERO); if (!page) { r = -ENOMEM; goto fail; } vcpu->arch.pio_data = page_address(page); if (!kvm->arch.virtual_tsc_khz) kvm_arch_set_tsc_khz(kvm, max_tsc_khz); r = kvm_mmu_create(vcpu); if (r < 0) goto fail_free_pio_data; if (irqchip_in_kernel(kvm)) { r = kvm_create_lapic(vcpu); if (r < 0) goto fail_mmu_destroy; } vcpu->arch.mce_banks = kzalloc(KVM_MAX_MCE_BANKS * sizeof(u64) * 4, GFP_KERNEL); if (!vcpu->arch.mce_banks) { r = -ENOMEM; goto fail_free_lapic; } vcpu->arch.mcg_cap = KVM_MAX_MCE_BANKS; if (!zalloc_cpumask_var(&vcpu->arch.wbinvd_dirty_mask, GFP_KERNEL)) goto fail_free_mce_banks; kvm_async_pf_hash_reset(vcpu); return 0; fail_free_mce_banks: kfree(vcpu->arch.mce_banks); fail_free_lapic: kvm_free_lapic(vcpu); fail_mmu_destroy: kvm_mmu_destroy(vcpu); fail_free_pio_data: free_page((unsigned long)vcpu->arch.pio_data); fail: return r; } ",0 "bool WebContentsImpl::IsFullscreen() { return IsFullscreenForCurrentTab(); } ",0 "static bool parse_signature(struct MACH0_(obj_t) *bin, ut64 off) { int i,len; ut32 data; bin->signature = NULL; struct linkedit_data_command link = {}; ut8 lit[sizeof (struct linkedit_data_command)] = {0}; struct blob_index_t idx = {}; struct super_blob_t super = {}; if (off > bin->size || off + sizeof (struct linkedit_data_command) > bin->size) { return false; } len = r_buf_read_at (bin->b, off, lit, sizeof (struct linkedit_data_command)); if (len != sizeof (struct linkedit_data_command)) { bprintf (""Failed to get data while parsing LC_CODE_SIGNATURE command\n""); return false; } link.cmd = r_read_ble32 (&lit[0], bin->big_endian); link.cmdsize = r_read_ble32 (&lit[4], bin->big_endian); link.dataoff = r_read_ble32 (&lit[8], bin->big_endian); link.datasize = r_read_ble32 (&lit[12], bin->big_endian); data = link.dataoff; if (data > bin->size || data + sizeof (struct super_blob_t) > bin->size) { bin->signature = (ut8 *)strdup (""Malformed entitlement""); return true; } super.blob.magic = r_read_ble32 (bin->b->buf + data, little_); super.blob.length = r_read_ble32 (bin->b->buf + data + 4, little_); super.count = r_read_ble32 (bin->b->buf + data + 8, little_); for (i = 0; i < super.count; ++i) { if ((ut8 *)(bin->b->buf + data + i) > (ut8 *)(bin->b->buf + bin->size)) { bin->signature = (ut8 *)strdup (""Malformed entitlement""); break; } struct blob_index_t bi; if (r_buf_read_at (bin->b, data + 12 + (i * sizeof (struct blob_index_t)), (ut8*)&bi, sizeof (struct blob_index_t)) < sizeof (struct blob_index_t)) { break; } idx.type = r_read_ble32 (&bi.type, little_); idx.offset = r_read_ble32 (&bi.offset, little_); if (idx.type == CSSLOT_ENTITLEMENTS) { ut64 off = data + idx.offset; if (off > bin->size || off + sizeof (struct blob_t) > bin->size) { bin->signature = (ut8 *)strdup (""Malformed entitlement""); break; } struct blob_t entitlements = {}; entitlements.magic = r_read_ble32 (bin->b->buf + off, little_); entitlements.length = r_read_ble32 (bin->b->buf + off + 4, little_); len = entitlements.length - sizeof(struct blob_t); if (len <= bin->size && len > 1) { bin->signature = calloc (1, len + 1); if (bin->signature) { ut8 *src = bin->b->buf + off + sizeof (struct blob_t); if (off + sizeof (struct blob_t) + len < bin->b->length) { memcpy (bin->signature, src, len); bin->signature[len] = '\0'; return true; } bin->signature = (ut8 *)strdup (""Malformed entitlement""); return true; } } else { bin->signature = (ut8 *)strdup (""Malformed entitlement""); } } } if (!bin->signature) { bin->signature = (ut8 *)strdup (""No entitlement found""); } return true; } ",0 "void AudioHandler::EnableOutputsIfNecessary() { if (is_disabled_ && connection_ref_count_ > 0) { DCHECK(IsMainThread()); BaseAudioContext::GraphAutoLocker locker(Context()); is_disabled_ = false; for (auto& output : outputs_) output->Enable(); } } ",0 "static void armv7pmu_disable_event(struct hw_perf_event *hwc, int idx) { unsigned long flags; /* * Disable counter and interrupt */ raw_spin_lock_irqsave(&pmu_lock, flags); /* * Disable counter */ armv7_pmnc_disable_counter(idx); /* * Disable interrupt for this counter */ armv7_pmnc_disable_intens(idx); raw_spin_unlock_irqrestore(&pmu_lock, flags); } ",0 " static int ldb_dn_escape_internal(char *dst, const char *src, int len) { const char *p, *s; char *d; size_t l; p = s = src; d = dst; while (p - src < len) { p += strcspn(p, "",=\n\r+<>#;\\\"" ""); if (p - src == len) /* found no escapable chars */ break; /* copy the part of the string before the stop */ memcpy(d, s, p - s); d += (p - s); /* move to current position */ switch (*p) { case ' ': if (p == src || (p-src)==(len-1)) { /* if at the beginning or end * of the string then escape */ *d++ = '\\'; *d++ = *p++; } else { /* otherwise don't escape */ *d++ = *p++; } break; /* if at the beginning or end * of the string then escape */ *d++ = '\\'; *d++ = *p++; } else { /* otherwise don't escape */ *d++ = *p++; } break; case '?': /* these must be escaped using \c form */ *d++ = '\\'; *d++ = *p++; break; default: { /* any others get \XX form */ unsigned char v; const char *hexbytes = ""0123456789ABCDEF""; v = *(const unsigned char *)p; *d++ = '\\'; *d++ = hexbytes[v>>4]; *d++ = hexbytes[v&0xF]; p++; break; } } s = p; /* move forward */ } ",1 "void SyncManager::SyncInternal::UpdateCryptographerAndNigoriCallback( const base::Callback& done_callback, const std::string& session_name) { syncable::ScopedDirLookup lookup(dir_manager(), username_for_share()); if (!lookup.good()) { NOTREACHED() << ""UpdateCryptographerAndNigori: lookup not good so bailing out""; done_callback.Run(false); return; } if (!lookup->initial_sync_ended_for_type(syncable::NIGORI)) { done_callback.Run(false); // Should only happen during first time sync. return; } bool success = false; { WriteTransaction trans(FROM_HERE, GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); WriteNode node(&trans); if (node.InitByTagLookup(kNigoriTag)) { sync_pb::NigoriSpecifics nigori(node.GetNigoriSpecifics()); Cryptographer::UpdateResult result = cryptographer->Update(nigori); if (result == Cryptographer::NEEDS_PASSPHRASE) { sync_pb::EncryptedData pending_keys; if (cryptographer->has_pending_keys()) pending_keys = cryptographer->GetPendingKeys(); FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnPassphraseRequired(sync_api::REASON_DECRYPTION, pending_keys)); } if (!nigori.has_encrypted() && cryptographer->is_ready()) { if (!cryptographer->GetKeys(nigori.mutable_encrypted())) { NOTREACHED(); } } chrome::VersionInfo version_info; bool contains_this_device = false; for (int i = 0; i < nigori.device_information_size(); ++i) { const sync_pb::DeviceInformation& device_information = nigori.device_information(i); if (device_information.cache_guid() == lookup->cache_guid()) { if (device_information.chrome_version() != version_info.CreateVersionString()) { sync_pb::DeviceInformation* mutable_device_information = nigori.mutable_device_information(i); mutable_device_information->set_chrome_version( version_info.CreateVersionString()); } contains_this_device = true; } } if (!contains_this_device) { sync_pb::DeviceInformation* device_information = nigori.add_device_information(); device_information->set_cache_guid(lookup->cache_guid()); #if defined(OS_CHROMEOS) device_information->set_platform(""ChromeOS""); #elif defined(OS_LINUX) device_information->set_platform(""Linux""); #elif defined(OS_MACOSX) device_information->set_platform(""Mac""); #elif defined(OS_WIN) device_information->set_platform(""Windows""); #endif device_information->set_name(session_name); chrome::VersionInfo version_info; device_information->set_chrome_version( version_info.CreateVersionString()); } cryptographer->UpdateNigoriFromEncryptedTypes(&nigori); node.SetNigoriSpecifics(nigori); allstatus_.SetCryptographerReady(cryptographer->is_ready()); allstatus_.SetCryptoHasPendingKeys(cryptographer->has_pending_keys()); allstatus_.SetEncryptedTypes(cryptographer->GetEncryptedTypes()); success = cryptographer->is_ready(); } else { NOTREACHED(); } } done_callback.Run(success); } ",0 "const AtomicString& ScreenOrientation::orientation(Screen& screen) { ScreenOrientation& screenOrientation = ScreenOrientation::from(screen); if (!screenOrientation.document()) { return orientationToString(blink::WebScreenOrientationPortraitPrimary); } ScreenOrientationController& controller = ScreenOrientationController::from(*screenOrientation.document()); return orientationToString(controller.orientation()); } ",0 "void RunGetCacheEntryCallback( const GDataCache::GetCacheEntryCallback& callback, bool* success, GDataCache::CacheEntry* cache_entry) { DCHECK(success); DCHECK(cache_entry); if (!callback.is_null()) callback.Run(*success, *cache_entry); } ",0 "bool FrameSelection::Contains(const LayoutPoint& point) { if (!GetDocument().GetLayoutView()) return false; const VisibleSelectionInFlatTree& visible_selection = ComputeVisibleSelectionInFlatTree(); if (!visible_selection.IsRange()) return false; HitTestRequest request(HitTestRequest::kReadOnly | HitTestRequest::kActive); HitTestResult result(request, point); GetDocument().GetLayoutView()->HitTest(result); Node* inner_node = result.InnerNode(); if (!inner_node || !inner_node->GetLayoutObject()) return false; const VisiblePositionInFlatTree& visible_pos = CreateVisiblePosition(FromPositionInDOMTree( inner_node->GetLayoutObject()->PositionForPoint( result.LocalPoint()))); if (visible_pos.IsNull()) return false; const VisiblePositionInFlatTree& visible_start = visible_selection.VisibleStart(); const VisiblePositionInFlatTree& visible_end = visible_selection.VisibleEnd(); if (visible_start.IsNull() || visible_end.IsNull()) return false; const PositionInFlatTree& start = visible_start.DeepEquivalent(); const PositionInFlatTree& end = visible_end.DeepEquivalent(); const PositionInFlatTree& pos = visible_pos.DeepEquivalent(); return start.CompareTo(pos) <= 0 && pos.CompareTo(end) <= 0; } ",0 "xsltInit (void) { if (initialized == 0) { initialized = 1; #ifdef XSLT_LOCALE_WINAPI xsltLocaleMutex = xmlNewRMutex(); #endif xsltRegisterAllExtras(); } } ",0 "int Reverb_setConfig(ReverbContext *pContext, effect_config_t *pConfig){ LVM_Fs_en SampleRate; CHECK_ARG(pContext != NULL); CHECK_ARG(pConfig != NULL); CHECK_ARG(pConfig->inputCfg.samplingRate == pConfig->outputCfg.samplingRate); CHECK_ARG(pConfig->inputCfg.format == pConfig->outputCfg.format); CHECK_ARG((pContext->auxiliary && pConfig->inputCfg.channels == AUDIO_CHANNEL_OUT_MONO) || ((!pContext->auxiliary) && pConfig->inputCfg.channels == AUDIO_CHANNEL_OUT_STEREO)); CHECK_ARG(pConfig->outputCfg.channels == AUDIO_CHANNEL_OUT_STEREO); CHECK_ARG(pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_WRITE || pConfig->outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE); CHECK_ARG(pConfig->inputCfg.format == AUDIO_FORMAT_PCM_16_BIT); pContext->config = *pConfig; switch (pConfig->inputCfg.samplingRate) { case 8000: SampleRate = LVM_FS_8000; break; case 16000: SampleRate = LVM_FS_16000; break; case 22050: SampleRate = LVM_FS_22050; break; case 32000: SampleRate = LVM_FS_32000; break; case 44100: SampleRate = LVM_FS_44100; break; case 48000: SampleRate = LVM_FS_48000; break; default: ALOGV(""\rReverb_setConfig invalid sampling rate %d"", pConfig->inputCfg.samplingRate); return -EINVAL; } if (pContext->SampleRate != SampleRate) { LVREV_ControlParams_st ActiveParams; LVREV_ReturnStatus_en LvmStatus = LVREV_SUCCESS; /* Get the current settings */ LvmStatus = LVREV_GetControlParameters(pContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVREV_GetControlParameters"", ""Reverb_setConfig"") if(LvmStatus != LVREV_SUCCESS) return -EINVAL; ActiveParams.SampleRate = SampleRate; LvmStatus = LVREV_SetControlParameters(pContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVREV_SetControlParameters"", ""Reverb_setConfig"") if(LvmStatus != LVREV_SUCCESS) return -EINVAL; pContext->SampleRate = SampleRate; }else{ } return 0; } /* end Reverb_setConfig */ ",0 "static int __init ftrace_dyn_table_alloc(unsigned long num_to_init) { int cnt; if (!num_to_init) { pr_info(""ftrace: No functions to be traced?\n""); return -1; } cnt = num_to_init / ENTRIES_PER_PAGE; pr_info(""ftrace: allocating %ld entries in %d pages\n"", num_to_init, cnt + 1); return 0; } ",0 "static void bta_pan_callback_transfer(UINT16 event, char *p_param) { tBTA_PAN *p_data = (tBTA_PAN *)p_param; switch(event) { case BTA_PAN_ENABLE_EVT: BTIF_TRACE_DEBUG(""BTA_PAN_ENABLE_EVT""); break; case BTA_PAN_SET_ROLE_EVT: { int btpan_role = bta_role_to_btpan(p_data->set_role.role); bt_status_t status = p_data->set_role.status == BTA_PAN_SUCCESS ? BT_STATUS_SUCCESS : BT_STATUS_FAIL; btpan_control_state_t state = btpan_role == 0 ? BTPAN_STATE_DISABLED : BTPAN_STATE_ENABLED; callback.control_state_cb(state, btpan_role, status, TAP_IF_NAME); break; } case BTA_PAN_OPENING_EVT: { btpan_conn_t* conn; bdstr_t bds; bdaddr_to_string((bt_bdaddr_t *)p_data->opening.bd_addr, bds, sizeof(bds)); BTIF_TRACE_DEBUG(""BTA_PAN_OPENING_EVT handle %d, addr: %s"", p_data->opening.handle, bds); conn = btpan_find_conn_addr(p_data->opening.bd_addr); asrt(conn != NULL); if (conn) { conn->handle = p_data->opening.handle; int btpan_conn_local_role = bta_role_to_btpan(conn->local_role); int btpan_remote_role = bta_role_to_btpan(conn->remote_role); callback.connection_state_cb(BTPAN_STATE_CONNECTING, BT_STATUS_SUCCESS, (const bt_bdaddr_t*)p_data->opening.bd_addr, btpan_conn_local_role, btpan_remote_role); } else BTIF_TRACE_ERROR(""connection not found""); break; } case BTA_PAN_OPEN_EVT: { btpan_connection_state_t state; bt_status_t status; btpan_conn_t *conn = btpan_find_conn_handle(p_data->open.handle); LOG_VERBOSE(""%s pan connection open status: %d"", __func__, p_data->open.status); if (p_data->open.status == BTA_PAN_SUCCESS) { state = BTPAN_STATE_CONNECTED; status = BT_STATUS_SUCCESS; btpan_open_conn(conn, p_data); } else { state = BTPAN_STATE_DISCONNECTED; status = BT_STATUS_FAIL; btpan_cleanup_conn(conn); } /* debug(""BTA_PAN_OPEN_EVT handle:%d, conn:%p"", p_data->open.handle, conn); */ /* debug(""conn bta local_role:%d, bta remote role:%d"", conn->local_role, conn->remote_role); */ int btpan_conn_local_role = bta_role_to_btpan(p_data->open.local_role); int btpan_remote_role = bta_role_to_btpan(p_data->open.peer_role); callback.connection_state_cb(state, status, (const bt_bdaddr_t*)p_data->open.bd_addr, btpan_conn_local_role, btpan_remote_role); break; } case BTA_PAN_CLOSE_EVT: { btpan_conn_t* conn = btpan_find_conn_handle(p_data->close.handle); LOG_INFO(""%s: event = BTA_PAN_CLOSE_EVT handle %d"", __FUNCTION__, p_data->close.handle); btpan_close_conn(conn); if (conn && conn->handle >= 0) { int btpan_conn_local_role = bta_role_to_btpan(conn->local_role); int btpan_remote_role = bta_role_to_btpan(conn->remote_role); callback.connection_state_cb(BTPAN_STATE_DISCONNECTED, 0, (const bt_bdaddr_t*)conn->peer, btpan_conn_local_role, btpan_remote_role); btpan_cleanup_conn(conn); } else BTIF_TRACE_ERROR(""pan handle not found (%d)"", p_data->close.handle); break; } default: BTIF_TRACE_WARNING(""Unknown pan event %d"", event); break; } } ",0 "hfs_file_read_zlib_rsrc(const TSK_FS_ATTR * a_fs_attr, TSK_OFF_T a_offset, char *a_buf, size_t a_len) { return hfs_file_read_compressed_rsrc( a_fs_attr, a_offset, a_buf, a_len, hfs_read_zlib_block_table, hfs_decompress_zlib_block ); } ",0 "int Instance::GetToolbarBottomOffset() { int scrollbar_thickness = GetScrollbarThickness(); return GetScaled(kToolbarFadingOffsetBottom) + scrollbar_thickness; } ",0 "static inline bool got_nohz_idle_kick(void) { int cpu = smp_processor_id(); if (!test_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu))) return false; if (idle_cpu(cpu) && !need_resched()) return true; /* * We can't run Idle Load Balance on this CPU for this time so we * cancel it and clear NOHZ_BALANCE_KICK */ clear_bit(NOHZ_BALANCE_KICK, nohz_flags(cpu)); return false; } ",0 "get_scalar(void *state, char *token, JsonTokenType tokentype) { GetState *_state = (GetState *) state; int lex_level = _state->lex->lex_level; /* Check for whole-object match */ if (lex_level == 0 && _state->npath == 0) { if (_state->normalize_results && tokentype == JSON_TOKEN_STRING) { /* we want the de-escaped string */ _state->next_scalar = true; } else if (_state->normalize_results && tokentype == JSON_TOKEN_NULL) { _state->tresult = (text *) NULL; } else { /* * This is a bit hokey: we will suppress whitespace after the * scalar token, but not whitespace before it. Probably not worth * doing our own space-skipping to avoid that. */ char *start = _state->lex->input; int len = _state->lex->prev_token_terminator - start; _state->tresult = cstring_to_text_with_len(start, len); } } if (_state->next_scalar) { /* a de-escaped text value is wanted, so supply it */ _state->tresult = cstring_to_text(token); /* make sure the next call to get_scalar doesn't overwrite it */ _state->next_scalar = false; } } ",0 "status_t AMRSource::read( MediaBuffer **out, const ReadOptions *options) { *out = NULL; int64_t seekTimeUs; ReadOptions::SeekMode mode; if (options && options->getSeekTo(&seekTimeUs, &mode)) { size_t size; int64_t seekFrame = seekTimeUs / 20000ll; // 20ms per frame. mCurrentTimeUs = seekFrame * 20000ll; size_t index = seekFrame < 0 ? 0 : seekFrame / 50; if (index >= mOffsetTableLength) { index = mOffsetTableLength - 1; } mOffset = mOffsetTable[index] + (mIsWide ? 9 : 6); for (size_t i = 0; i< seekFrame - index * 50; i++) { status_t err; if ((err = getFrameSizeByOffset(mDataSource, mOffset, mIsWide, &size)) != OK) { return err; } mOffset += size; } } uint8_t header; ssize_t n = mDataSource->readAt(mOffset, &header, 1); if (n < 1) { return ERROR_END_OF_STREAM; } if (header & 0x83) { ALOGE(""padding bits must be 0, header is 0x%02x"", header); return ERROR_MALFORMED; } unsigned FT = (header >> 3) & 0x0f; size_t frameSize = getFrameSize(mIsWide, FT); if (frameSize == 0) { return ERROR_MALFORMED; } MediaBuffer *buffer; status_t err = mGroup->acquire_buffer(&buffer); if (err != OK) { return err; } n = mDataSource->readAt(mOffset, buffer->data(), frameSize); if (n != (ssize_t)frameSize) { buffer->release(); buffer = NULL; if (n < 0) { return ERROR_IO; } else { mOffset += n; return ERROR_END_OF_STREAM; } } buffer->set_range(0, frameSize); buffer->meta_data()->setInt64(kKeyTime, mCurrentTimeUs); buffer->meta_data()->setInt32(kKeyIsSyncFrame, 1); mOffset += frameSize; mCurrentTimeUs += 20000; // Each frame is 20ms *out = buffer; return OK; } ",1 "ofpact_init(struct ofpact *ofpact, enum ofpact_type type, size_t len) { memset(ofpact, 0, len); ofpact->type = type; ofpact->raw = -1; ofpact->len = len; } ",0 "static LayoutRect RelativeBounds(const LayoutObject* layout_object, const ScrollableArea* scroller) { PhysicalRect local_bounds; if (layout_object->IsBox()) { local_bounds = ToLayoutBox(layout_object)->PhysicalBorderBoxRect(); if (!layout_object->HasOverflowClip()) { LayoutUnit max_y = std::max(local_bounds.Bottom(), ToLayoutBox(layout_object)->LayoutOverflowRect().MaxY()); auto* layout_block_flow = DynamicTo(layout_object); if (layout_block_flow && layout_block_flow->ContainsFloats()) { max_y = std::max(max_y, layout_block_flow->LowestFloatLogicalBottom()); } local_bounds.ShiftBottomEdgeTo(max_y); } } else if (layout_object->IsText()) { const auto* text = ToLayoutText(layout_object); local_bounds.Unite(text->PhysicalLinesBoundingBox()); } else { NOTREACHED(); } LayoutRect relative_bounds = LayoutRect( scroller ->LocalToVisibleContentQuad(FloatRect(local_bounds), layout_object) .BoundingBox()); return relative_bounds; } ",0 "GF_Err padb_Read(GF_Box *s,GF_BitStream *bs) { u32 i; GF_PaddingBitsBox *ptr = (GF_PaddingBitsBox *)s; ptr->SampleCount = gf_bs_read_u32(bs); ptr->padbits = (u8 *)gf_malloc(sizeof(u8)*ptr->SampleCount); for (i=0; iSampleCount; i += 2) { gf_bs_read_int(bs, 1); if (i+1 < ptr->SampleCount) { ptr->padbits[i+1] = gf_bs_read_int(bs, 3); } else { gf_bs_read_int(bs, 3); } gf_bs_read_int(bs, 1); ptr->padbits[i] = gf_bs_read_int(bs, 3); } return GF_OK; } ",0 "AuthenticatorClientPinTapAgainSheetModel::GetStepIllustration( ImageColorScheme color_scheme) const { return color_scheme == ImageColorScheme::kDark ? kWebauthnUsbDarkIcon : kWebauthnUsbIcon; } ",0 "static int dtls1_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) { int n; unsigned char *p; n=i2d_X509(x,NULL); if (!BUF_MEM_grow_clean(buf,(int)(n+(*l)+3))) { SSLerr(SSL_F_DTLS1_ADD_CERT_TO_BUF,ERR_R_BUF_LIB); return 0; } p=(unsigned char *)&(buf->data[*l]); l2n3(n,p); i2d_X509(x,&p); *l+=n+3; return 1; } ",0 "void AudioMixerAlsa::RegisterPrefs(PrefService* local_state) { if (!local_state->FindPreference(prefs::kAudioVolume)) local_state->RegisterDoublePref(prefs::kAudioVolume, kDefaultVolumeDb, PrefService::UNSYNCABLE_PREF); if (!local_state->FindPreference(prefs::kAudioMute)) local_state->RegisterIntegerPref(prefs::kAudioMute, kPrefMuteOff, PrefService::UNSYNCABLE_PREF); } ",0 "ZEND_API void zend_hash_bucket_swap(Bucket *p, Bucket *q) { zval val; zend_ulong h; zend_string *key; ZVAL_COPY_VALUE(&val, &p->val); h = p->h; key = p->key; ZVAL_COPY_VALUE(&p->val, &q->val); p->h = q->h; p->key = q->key; ZVAL_COPY_VALUE(&q->val, &val); q->h = h; q->key = key; } ",0 "jas_stream_t *jas_stream_memopen2(char *buf, size_t bufsize) { jas_stream_t *stream; jas_stream_memobj_t *obj; JAS_DBGLOG(100, (""jas_stream_memopen2(%p, %zu)\n"", buf, bufsize)); assert((buf && bufsize > 0) || (!buf)); if (!(stream = jas_stream_create())) { return 0; } /* A stream associated with a memory buffer is always opened for both reading and writing in binary mode. */ stream->openmode_ = JAS_STREAM_READ | JAS_STREAM_WRITE | JAS_STREAM_BINARY; /* Since the stream data is already resident in memory, buffering is not necessary. */ /* But... It still may be faster to use buffering anyways. */ jas_stream_initbuf(stream, JAS_STREAM_FULLBUF, 0, 0); /* Select the operations for a memory stream. */ stream->ops_ = &jas_stream_memops; /* Allocate memory for the underlying memory stream object. */ if (!(obj = jas_malloc(sizeof(jas_stream_memobj_t)))) { jas_stream_destroy(stream); return 0; } stream->obj_ = (void *) obj; /* Initialize a few important members of the memory stream object. */ obj->myalloc_ = 0; obj->buf_ = 0; /* If the buffer size specified is nonpositive, then the buffer is allocated internally and automatically grown as needed. */ if (!bufsize) { obj->bufsize_ = 1024; obj->growable_ = 1; } else { obj->bufsize_ = bufsize; obj->growable_ = 0; } if (buf) { obj->buf_ = JAS_CAST(unsigned char *, buf); } else { obj->buf_ = jas_malloc(obj->bufsize_); obj->myalloc_ = 1; } if (!obj->buf_) { jas_stream_close(stream); return 0; } JAS_DBGLOG(100, (""jas_stream_memopen2 buffer buf=%p myalloc=%d\n"", obj->buf_, obj->myalloc_)); if (bufsize > 0 && buf) { /* If a buffer was supplied by the caller and its length is positive, make the associated buffer data appear in the stream initially. */ obj->len_ = bufsize; } else { /* The stream is initially empty. */ obj->len_ = 0; } obj->pos_ = 0; return stream; } ",0 "vrrp_auth_type_handler(vector_t *strvec) { vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); char *str = strvec_slot(strvec, 1); if (!strcmp(str, ""AH"")) vrrp->auth_type = VRRP_AUTH_AH; else if (!strcmp(str, ""PASS"")) vrrp->auth_type = VRRP_AUTH_PASS; else report_config_error(CONFIG_GENERAL_ERROR, ""(%s) unknown authentication type '%s'"", vrrp->iname, str); } ",0 "void conn_worker_readd(conn *c) { c->ev_flags = EV_READ | EV_PERSIST; event_set(&c->event, c->sfd, c->ev_flags, event_handler, (void *)c); event_base_set(c->thread->base, &c->event); c->state = conn_new_cmd; if (event_add(&c->event, 0) == -1) { perror(""event_add""); } } ",0 "TimeDelta AVeryLongTimeDelta() { return TimeDelta::FromDays(1); } ",0 "ProcXF86DRIGetDeviceInfo(register ClientPtr client) { xXF86DRIGetDeviceInfoReply rep = { .type = X_Reply, .sequenceNumber = client->sequence, .length = 0 }; drm_handle_t hFrameBuffer; void *pDevPrivate; REQUEST(xXF86DRIGetDeviceInfoReq); REQUEST_SIZE_MATCH(xXF86DRIGetDeviceInfoReq); if (stuff->screen >= screenInfo.numScreens) { client->errorValue = stuff->screen; return BadValue; } if (!DRIGetDeviceInfo(screenInfo.screens[stuff->screen], &hFrameBuffer, (int *) &rep.framebufferOrigin, (int *) &rep.framebufferSize, (int *) &rep.framebufferStride, (int *) &rep.devPrivateSize, &pDevPrivate)) { return BadValue; } rep.hFrameBufferLow = (CARD32) (hFrameBuffer & 0xffffffff); #if defined(LONG64) && !defined(__linux__) rep.hFrameBufferHigh = (CARD32) (hFrameBuffer >> 32); #else rep.hFrameBufferHigh = 0; #endif if (rep.devPrivateSize) { rep.length = bytes_to_int32(SIZEOF(xXF86DRIGetDeviceInfoReply) - SIZEOF(xGenericReply) + pad_to_int32(rep.devPrivateSize)); } WriteToClient(client, sizeof(xXF86DRIGetDeviceInfoReply), &rep); if (rep.length) { WriteToClient(client, rep.devPrivateSize, pDevPrivate); } return Success; } ",0 "static int em_out(struct x86_emulate_ctxt *ctxt) { ctxt->ops->pio_out_emulated(ctxt, ctxt->src.bytes, ctxt->dst.val, &ctxt->src.val, 1); /* Disable writeback. */ ctxt->dst.type = OP_NONE; return X86EMUL_CONTINUE; } ",0 "void ResourceDispatcherHostImpl::DidStartRequest(ResourceLoader* loader) { MaybeStartUpdateLoadInfoTimer(); } ",0 "PHP_FUNCTION(imagecolorat) { zval *IM; long x, y; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rll"", &IM, &x, &y) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, ""Image"", le_gd); if (gdImageTrueColor(im)) { if (im->tpixels && gdImageBoundsSafe(im, x, y)) { RETURN_LONG(gdImageTrueColorPixel(im, x, y)); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""%ld,%ld is out of bounds"", x, y); RETURN_FALSE; } } else { if (im->pixels && gdImageBoundsSafe(im, x, y)) { RETURN_LONG(im->pixels[y][x]); } else { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""%ld,%ld is out of bounds"", x, y); RETURN_FALSE; } } } ",0 "void AutocompletePopupViewGtk::StackWindow() { gfx::NativeView edit_view = edit_view_->GetNativeView(); DCHECK(GTK_IS_WIDGET(edit_view)); GtkWidget* toplevel = gtk_widget_get_toplevel(edit_view); DCHECK(GTK_WIDGET_TOPLEVEL(toplevel)); gtk_util::StackPopupWindow(window_, toplevel); } ",0 "xsltGetXIncludeDefault(void) { return(xsltDoXIncludeDefault); } ",0 " virtual ~FakeDownloadItem() { FOR_EACH_OBSERVER(Observer, observers_, OnDownloadDestroyed(this)); EXPECT_EQ(0u, observers_.size()); } ",0 "void ChromeClientImpl::ResizeAfterLayout() const { web_view_->ResizeAfterLayout(); } ",0 "static bool find_cgroup_subsystems(char ***kernel_subsystems) { FILE *proc_cgroups; bool bret = false; char *line = NULL; size_t sz = 0; size_t kernel_subsystems_count = 0; size_t kernel_subsystems_capacity = 0; int r; proc_cgroups = fopen_cloexec(""/proc/cgroups"", ""r""); if (!proc_cgroups) return false; while (getline(&line, &sz, proc_cgroups) != -1) { char *tab1; char *tab2; int hierarchy_number; if (line[0] == '#') continue; if (!line[0]) continue; tab1 = strchr(line, '\t'); if (!tab1) continue; *tab1++ = '\0'; tab2 = strchr(tab1, '\t'); if (!tab2) continue; *tab2 = '\0'; tab2 = NULL; hierarchy_number = strtoul(tab1, &tab2, 10); if (!tab2 || *tab2) continue; (void)hierarchy_number; r = lxc_grow_array((void ***)kernel_subsystems, &kernel_subsystems_capacity, kernel_subsystems_count + 1, 12); if (r < 0) goto out; (*kernel_subsystems)[kernel_subsystems_count] = strdup(line); if (!(*kernel_subsystems)[kernel_subsystems_count]) goto out; kernel_subsystems_count++; } bret = true; out: fclose(proc_cgroups); free(line); return bret; } ",0 "static void Bitmap_setHasMipMap(JNIEnv* env, jobject, jlong bitmapHandle, jboolean hasMipMap) { SkBitmap* bitmap = reinterpret_cast(bitmapHandle); bitmap->setHasHardwareMipMap(hasMipMap); } ",0 "static int buffer_chain_size(void) { struct bio_vec bv; int size; struct req_iterator iter; char *base; base = bio_data(current_req->bio); size = 0; rq_for_each_segment(bv, current_req, iter) { if (page_address(bv.bv_page) + bv.bv_offset != base + size) break; size += bv.bv_len; } return size >> 9; } ",0 "void V8TestObject::UnsignedShortMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_unsignedShortMethod""); test_object_v8_internal::UnsignedShortMethodMethod(info); } ",0 "static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk, *other; unsigned int mask, writable; sock_poll_wait(file, sk_sleep(sk), wait); mask = 0; /* exceptional events? */ if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= POLLERR | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? POLLPRI : 0); if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= POLLRDHUP | POLLIN | POLLRDNORM; if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; /* readable? */ if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= POLLIN | POLLRDNORM; /* Connection-based need to check for termination and startup */ if (sk->sk_type == SOCK_SEQPACKET) { if (sk->sk_state == TCP_CLOSE) mask |= POLLHUP; /* connection hasn't started yet? */ if (sk->sk_state == TCP_SYN_SENT) return mask; } /* No write status requested, avoid expensive OUT tests. */ if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT))) return mask; writable = unix_writable(sk); other = unix_peer_get(sk); if (other) { if (unix_peer(other) != sk) { sock_poll_wait(file, &unix_sk(other)->peer_wait, wait); if (unix_recvq_full(other)) writable = 0; } sock_put(other); } if (writable) mask |= POLLOUT | POLLWRNORM | POLLWRBAND; else set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); return mask; } ",0 "pick_datapath_id(const struct ofproto *ofproto) { const struct ofport *port; port = ofproto_get_port(ofproto, OFPP_LOCAL); if (port) { struct eth_addr ea; int error; error = netdev_get_etheraddr(port->netdev, &ea); if (!error) { return eth_addr_to_uint64(ea); } VLOG_WARN(""%s: could not get MAC address for %s (%s)"", ofproto->name, netdev_get_name(port->netdev), ovs_strerror(error)); } return ofproto->fallback_dpid; } ",0 "void WebContentsImpl::LoadStateChanged( const GURL& url, const net::LoadStateWithParam& load_state, uint64_t upload_position, uint64_t upload_size) { tracked_objects::ScopedTracker tracking_profile1( FROM_HERE_WITH_EXPLICIT_FUNCTION( ""466285 WebContentsImpl::LoadStateChanged::Start"")); load_state_ = load_state; upload_position_ = upload_position; upload_size_ = upload_size; load_state_host_ = url_formatter::IDNToUnicode( url.host(), GetContentClient()->browser()->GetAcceptLangs(GetBrowserContext())); if (load_state_.state == net::LOAD_STATE_READING_RESPONSE) SetNotWaitingForResponse(); if (IsLoading()) { NotifyNavigationStateChanged(static_cast( INVALIDATE_TYPE_LOAD | INVALIDATE_TYPE_TAB)); } } ",0 "static int spri_cmp(int sid1, nghttp2_stream *s1, int sid2, nghttp2_stream *s2, h2_session *session) { nghttp2_stream *p1, *p2; p1 = nghttp2_stream_get_parent(s1); p2 = nghttp2_stream_get_parent(s2); if (p1 == p2) { int32_t w1, w2; w1 = nghttp2_stream_get_weight(s1); w2 = nghttp2_stream_get_weight(s2); return w2 - w1; } else if (!p1) { /* stream 1 closer to root */ return -1; } else if (!p2) { /* stream 2 closer to root */ return 1; } return spri_cmp(sid1, p1, sid2, p2, session); } ",0 "static void cifs_convert_ace(posix_acl_xattr_entry *ace, struct cifs_posix_ace *cifs_ace) { /* u8 cifs fields do not need le conversion */ ace->e_perm = cpu_to_le16(cifs_ace->cifs_e_perm); ace->e_tag = cpu_to_le16(cifs_ace->cifs_e_tag); ace->e_id = cpu_to_le32(le64_to_cpu(cifs_ace->cifs_uid)); /* cFYI(1, ""perm %d tag %d id %d"",ace->e_perm,ace->e_tag,ace->e_id); */ return; } ",0 "void GLES2DecoderImpl::DoFinish() { glFinish(); ProcessPendingQueries(); } ",0 "void aes_crypt_cfb( aes_context *ctx, int mode, int length, int *iv_off, unsigned char iv[16], const unsigned char *input, unsigned char *output ) { int c, n = *iv_off; if( mode == AES_DECRYPT ) { while( length-- ) { if( n == 0 ) aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv ); c = *input++; *output++ = (unsigned char)( c ^ iv[n] ); iv[n] = (unsigned char) c; n = (n + 1) & 0x0F; } } else { while( length-- ) { if( n == 0 ) aes_crypt_ecb( ctx, AES_ENCRYPT, iv, iv ); iv[n] = *output++ = (unsigned char)( iv[n] ^ *input++ ); n = (n + 1) & 0x0F; } } *iv_off = n; } ",0 "void OmniboxViewViews::DoInsertChar(base::char16 ch) { if ((model()->focus_state() == OMNIBOX_FOCUS_INVISIBLE) && base::IsUnicodeWhitespace(ch)) { return; } if (insert_char_time_.is_null()) { DCHECK_EQ(latency_histogram_state_, NOT_ACTIVE); latency_histogram_state_ = CHAR_TYPED; insert_char_time_ = base::TimeTicks::Now(); } Textfield::DoInsertChar(ch); } ",0 "static long iowarrior_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct iowarrior *dev = NULL; __u8 *buffer; __u8 __user *user_buffer; int retval; int io_res; /* checks for bytes read/written and copy_to/from_user results */ dev = file->private_data; if (dev == NULL) { return -ENODEV; } buffer = kzalloc(dev->report_size, GFP_KERNEL); if (!buffer) return -ENOMEM; /* lock this object */ mutex_lock(&iowarrior_mutex); mutex_lock(&dev->mutex); /* verify that the device wasn't unplugged */ if (!dev->present) { retval = -ENODEV; goto error_out; } dev_dbg(&dev->interface->dev, ""minor %d, cmd 0x%.4x, arg %ld\n"", dev->minor, cmd, arg); retval = 0; io_res = 0; switch (cmd) { case IOW_WRITE: if (dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW24 || dev->product_id == USB_DEVICE_ID_CODEMERCS_IOWPV1 || dev->product_id == USB_DEVICE_ID_CODEMERCS_IOWPV2 || dev->product_id == USB_DEVICE_ID_CODEMERCS_IOW40) { user_buffer = (__u8 __user *)arg; io_res = copy_from_user(buffer, user_buffer, dev->report_size); if (io_res) { retval = -EFAULT; } else { io_res = usb_set_report(dev->interface, 2, 0, buffer, dev->report_size); if (io_res < 0) retval = io_res; } } else { retval = -EINVAL; dev_err(&dev->interface->dev, ""ioctl 'IOW_WRITE' is not supported for product=0x%x.\n"", dev->product_id); } break; case IOW_READ: user_buffer = (__u8 __user *)arg; io_res = usb_get_report(dev->udev, dev->interface->cur_altsetting, 1, 0, buffer, dev->report_size); if (io_res < 0) retval = io_res; else { io_res = copy_to_user(user_buffer, buffer, dev->report_size); if (io_res) retval = -EFAULT; } break; case IOW_GETINFO: { /* Report available information for the device */ struct iowarrior_info info; /* needed for power consumption */ struct usb_config_descriptor *cfg_descriptor = &dev->udev->actconfig->desc; memset(&info, 0, sizeof(info)); /* directly from the descriptor */ info.vendor = le16_to_cpu(dev->udev->descriptor.idVendor); info.product = dev->product_id; info.revision = le16_to_cpu(dev->udev->descriptor.bcdDevice); /* 0==UNKNOWN, 1==LOW(usb1.1) ,2=FULL(usb1.1), 3=HIGH(usb2.0) */ info.speed = le16_to_cpu(dev->udev->speed); info.if_num = dev->interface->cur_altsetting->desc.bInterfaceNumber; info.report_size = dev->report_size; /* serial number string has been read earlier 8 chars or empty string */ memcpy(info.serial, dev->chip_serial, sizeof(dev->chip_serial)); if (cfg_descriptor == NULL) { info.power = -1; /* no information available */ } else { /* the MaxPower is stored in units of 2mA to make it fit into a byte-value */ info.power = cfg_descriptor->bMaxPower * 2; } io_res = copy_to_user((struct iowarrior_info __user *)arg, &info, sizeof(struct iowarrior_info)); if (io_res) retval = -EFAULT; break; } default: /* return that we did not understand this ioctl call */ retval = -ENOTTY; break; } error_out: /* unlock the device */ mutex_unlock(&dev->mutex); mutex_unlock(&iowarrior_mutex); kfree(buffer); return retval; } ",0 "static struct sk_buff *tcp_shift_skb_data(struct sock *sk, struct sk_buff *skb, struct tcp_sacktag_state *state, u32 start_seq, u32 end_seq, bool dup_sack) { struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *prev; int mss; int pcount = 0; int len; int in_sack; if (!sk_can_gso(sk)) goto fallback; /* Normally R but no L won't result in plain S */ if (!dup_sack && (TCP_SKB_CB(skb)->sacked & (TCPCB_LOST|TCPCB_SACKED_RETRANS)) == TCPCB_SACKED_RETRANS) goto fallback; if (!skb_can_shift(skb)) goto fallback; /* This frame is about to be dropped (was ACKed). */ if (!after(TCP_SKB_CB(skb)->end_seq, tp->snd_una)) goto fallback; /* Can only happen with delayed DSACK + discard craziness */ if (unlikely(skb == tcp_write_queue_head(sk))) goto fallback; prev = tcp_write_queue_prev(sk, skb); if ((TCP_SKB_CB(prev)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED) goto fallback; if (!tcp_skb_can_collapse_to(prev)) goto fallback; in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq) && !before(end_seq, TCP_SKB_CB(skb)->end_seq); if (in_sack) { len = skb->len; pcount = tcp_skb_pcount(skb); mss = tcp_skb_seglen(skb); /* TODO: Fix DSACKs to not fragment already SACKed and we can * drop this restriction as unnecessary */ if (mss != tcp_skb_seglen(prev)) goto fallback; } else { if (!after(TCP_SKB_CB(skb)->end_seq, start_seq)) goto noop; /* CHECKME: This is non-MSS split case only?, this will * cause skipped skbs due to advancing loop btw, original * has that feature too */ if (tcp_skb_pcount(skb) <= 1) goto noop; in_sack = !after(start_seq, TCP_SKB_CB(skb)->seq); if (!in_sack) { /* TODO: head merge to next could be attempted here * if (!after(TCP_SKB_CB(skb)->end_seq, end_seq)), * though it might not be worth of the additional hassle * * ...we can probably just fallback to what was done * previously. We could try merging non-SACKed ones * as well but it probably isn't going to buy off * because later SACKs might again split them, and * it would make skb timestamp tracking considerably * harder problem. */ goto fallback; } len = end_seq - TCP_SKB_CB(skb)->seq; BUG_ON(len < 0); BUG_ON(len > skb->len); /* MSS boundaries should be honoured or else pcount will * severely break even though it makes things bit trickier. * Optimize common case to avoid most of the divides */ mss = tcp_skb_mss(skb); /* TODO: Fix DSACKs to not fragment already SACKed and we can * drop this restriction as unnecessary */ if (mss != tcp_skb_seglen(prev)) goto fallback; if (len == mss) { pcount = 1; } else if (len < mss) { goto noop; } else { pcount = len / mss; len = pcount * mss; } } /* tcp_sacktag_one() won't SACK-tag ranges below snd_una */ if (!after(TCP_SKB_CB(skb)->seq + len, tp->snd_una)) goto fallback; if (!skb_shift(prev, skb, len)) goto fallback; if (!tcp_shifted_skb(sk, skb, state, pcount, len, mss, dup_sack)) goto out; /* Hole filled allows collapsing with the next as well, this is very * useful when hole on every nth skb pattern happens */ if (prev == tcp_write_queue_tail(sk)) goto out; skb = tcp_write_queue_next(sk, prev); if (!skb_can_shift(skb) || (skb == tcp_send_head(sk)) || ((TCP_SKB_CB(skb)->sacked & TCPCB_TAGBITS) != TCPCB_SACKED_ACKED) || (mss != tcp_skb_seglen(skb))) goto out; len = skb->len; if (skb_shift(prev, skb, len)) { pcount += tcp_skb_pcount(skb); tcp_shifted_skb(sk, skb, state, tcp_skb_pcount(skb), len, mss, 0); } out: state->fack_count += pcount; return prev; noop: return skb; fallback: NET_INC_STATS(sock_net(sk), LINUX_MIB_SACKSHIFTFALLBACK); return NULL; } ",0 "static int nfs4_xdr_dec_layoutget(struct rpc_rqst *rqstp, struct xdr_stream *xdr, struct nfs4_layoutget_res *res) { struct compound_hdr hdr; int status; status = decode_compound_hdr(xdr, &hdr); if (status) goto out; status = decode_sequence(xdr, &res->seq_res, rqstp); if (status) goto out; status = decode_putfh(xdr); if (status) goto out; status = decode_layoutget(xdr, rqstp, res); out: return status; } ",0 "static struct wdm_device *wdm_find_device(struct usb_interface *intf) { struct wdm_device *desc; spin_lock(&wdm_device_list_lock); list_for_each_entry(desc, &wdm_device_list, device_list) if (desc->intf == intf) goto found; desc = NULL; found: spin_unlock(&wdm_device_list_lock); return desc; } ",0 " void CWebServer::Cmd_SystemReboot(WebEmSession & session, const request& req, Json::Value &root) { if (session.rights != 2) { session.reply_status = reply::forbidden; return; //Only admin user allowed } #ifdef WIN32 int ret = system(""shutdown -r -f -t 1 -d up:125:1""); #else int ret = system(""sudo shutdown -r now""); #endif if (ret != 0) { _log.Log(LOG_ERROR, ""Error executing reboot command. returned: %d"", ret); return; } root[""title""] = ""SystemReboot""; root[""status""] = ""OK""; } ",0 "static int udf_load_partdesc(struct super_block *sb, sector_t block) { struct buffer_head *bh; struct partitionDesc *p; struct udf_part_map *map; struct udf_sb_info *sbi = UDF_SB(sb); int i, type1_idx; uint16_t partitionNumber; uint16_t ident; int ret = 0; bh = udf_read_tagged(sb, block, block, &ident); if (!bh) return 1; if (ident != TAG_IDENT_PD) goto out_bh; p = (struct partitionDesc *)bh->b_data; partitionNumber = le16_to_cpu(p->partitionNumber); /* First scan for TYPE1, SPARABLE and METADATA partitions */ for (i = 0; i < sbi->s_partitions; i++) { map = &sbi->s_partmaps[i]; udf_debug(""Searching map: (%d == %d)\n"", map->s_partition_num, partitionNumber); if (map->s_partition_num == partitionNumber && (map->s_partition_type == UDF_TYPE1_MAP15 || map->s_partition_type == UDF_SPARABLE_MAP15)) break; } if (i >= sbi->s_partitions) { udf_debug(""Partition (%d) not found in partition map\n"", partitionNumber); goto out_bh; } ret = udf_fill_partdesc_info(sb, p, i); /* * Now rescan for VIRTUAL or METADATA partitions when SPARABLE and * PHYSICAL partitions are already set up */ type1_idx = i; for (i = 0; i < sbi->s_partitions; i++) { map = &sbi->s_partmaps[i]; if (map->s_partition_num == partitionNumber && (map->s_partition_type == UDF_VIRTUAL_MAP15 || map->s_partition_type == UDF_VIRTUAL_MAP20 || map->s_partition_type == UDF_METADATA_MAP25)) break; } if (i >= sbi->s_partitions) goto out_bh; ret = udf_fill_partdesc_info(sb, p, i); if (ret) goto out_bh; if (map->s_partition_type == UDF_METADATA_MAP25) { ret = udf_load_metadata_files(sb, i); if (ret) { udf_err(sb, ""error loading MetaData partition map %d\n"", i); goto out_bh; } } else { ret = udf_load_vat(sb, i, type1_idx); if (ret) goto out_bh; /* * Mark filesystem read-only if we have a partition with * virtual map since we don't handle writing to it (we * overwrite blocks instead of relocating them). */ sb->s_flags |= MS_RDONLY; pr_notice(""Filesystem marked read-only because writing to pseudooverwrite partition is not implemented\n""); } out_bh: /* In case loading failed, we handle cleanup in udf_fill_super */ brelse(bh); return ret; } ",0 "AuthenticatorPaaskSheetModel::AuthenticatorPaaskSheetModel( AuthenticatorRequestDialogModel* dialog_model) : AuthenticatorSheetModelBase(dialog_model), other_transports_menu_model_(std::make_unique( dialog_model, AuthenticatorTransport::kCloudAssistedBluetoothLowEnergy)) {} ",0 "static struct mount *clone_mnt(struct mount *old, struct dentry *root, int flag) { struct super_block *sb = old->mnt.mnt_sb; struct mount *mnt; int err; mnt = alloc_vfsmnt(old->mnt_devname); if (!mnt) return ERR_PTR(-ENOMEM); if (flag & (CL_SLAVE | CL_PRIVATE | CL_SHARED_TO_SLAVE)) mnt->mnt_group_id = 0; /* not a peer of original */ else mnt->mnt_group_id = old->mnt_group_id; if ((flag & CL_MAKE_SHARED) && !mnt->mnt_group_id) { err = mnt_alloc_group_id(mnt); if (err) goto out_free; } mnt->mnt.mnt_flags = old->mnt.mnt_flags & ~(MNT_WRITE_HOLD|MNT_MARKED); /* Don't allow unprivileged users to change mount flags */ if ((flag & CL_UNPRIVILEGED) && (mnt->mnt.mnt_flags & MNT_READONLY)) mnt->mnt.mnt_flags |= MNT_LOCK_READONLY; /* Don't allow unprivileged users to reveal what is under a mount */ if ((flag & CL_UNPRIVILEGED) && list_empty(&old->mnt_expire)) mnt->mnt.mnt_flags |= MNT_LOCKED; atomic_inc(&sb->s_active); mnt->mnt.mnt_sb = sb; mnt->mnt.mnt_root = dget(root); mnt->mnt_mountpoint = mnt->mnt.mnt_root; mnt->mnt_parent = mnt; lock_mount_hash(); list_add_tail(&mnt->mnt_instance, &sb->s_mounts); unlock_mount_hash(); if ((flag & CL_SLAVE) || ((flag & CL_SHARED_TO_SLAVE) && IS_MNT_SHARED(old))) { list_add(&mnt->mnt_slave, &old->mnt_slave_list); mnt->mnt_master = old; CLEAR_MNT_SHARED(mnt); } else if (!(flag & CL_PRIVATE)) { if ((flag & CL_MAKE_SHARED) || IS_MNT_SHARED(old)) list_add(&mnt->mnt_share, &old->mnt_share); if (IS_MNT_SLAVE(old)) list_add(&mnt->mnt_slave, &old->mnt_slave); mnt->mnt_master = old->mnt_master; } if (flag & CL_MAKE_SHARED) set_mnt_shared(mnt); /* stick the duplicate mount on the same expiry list * as the original if that was on one */ if (flag & CL_EXPIRE) { if (!list_empty(&old->mnt_expire)) list_add(&mnt->mnt_expire, &old->mnt_expire); } return mnt; out_free: mnt_free_id(mnt); free_vfsmnt(mnt); return ERR_PTR(err); } ",1 "bool ReplacePathURL(const char* base, const Parsed& base_parsed, const Replacements& replacements, CanonOutput* output, Parsed* new_parsed) { URLComponentSource source(base); Parsed parsed(base_parsed); SetupOverrideComponents(base, replacements, &source, &parsed); return DoCanonicalizePathURL( source, parsed, output, new_parsed); } ",0 "void WebGLRenderingContextBase::VertexAttribDivisorANGLE(GLuint index, GLuint divisor) { if (isContextLost()) return; if (index >= max_vertex_attribs_) { SynthesizeGLError(GL_INVALID_VALUE, ""vertexAttribDivisorANGLE"", ""index out of range""); return; } ContextGL()->VertexAttribDivisorANGLE(index, divisor); } ",0 "gdImageScaleBicubicFixed(gdImagePtr src, const unsigned int width, const unsigned int height) { const long new_width = MAX(1, width); const long new_height = MAX(1, height); const int src_w = gdImageSX(src); const int src_h = gdImageSY(src); const gdFixed f_dx = gd_ftofx((float)src_w / (float)new_width); const gdFixed f_dy = gd_ftofx((float)src_h / (float)new_height); const gdFixed f_1 = gd_itofx(1); const gdFixed f_2 = gd_itofx(2); const gdFixed f_4 = gd_itofx(4); const gdFixed f_6 = gd_itofx(6); const gdFixed f_gamma = gd_ftofx(1.04f); gdImagePtr dst; unsigned int dst_offset_x; unsigned int dst_offset_y = 0; long i; /* impact perf a bit, but not that much. Implementation for palette images can be done at a later point. */ if (src->trueColor == 0) { gdImagePaletteToTrueColor(src); } dst = gdImageCreateTrueColor(new_width, new_height); if (!dst) { return NULL; } dst->saveAlphaFlag = 1; for (i=0; i < new_height; i++) { long j; dst_offset_x = 0; for (j=0; j < new_width; j++) { const gdFixed f_a = gd_mulfx(gd_itofx(i), f_dy); const gdFixed f_b = gd_mulfx(gd_itofx(j), f_dx); const long m = gd_fxtoi(f_a); const long n = gd_fxtoi(f_b); const gdFixed f_f = f_a - gd_itofx(m); const gdFixed f_g = f_b - gd_itofx(n); unsigned int src_offset_x[16], src_offset_y[16]; long k; register gdFixed f_red = 0, f_green = 0, f_blue = 0, f_alpha = 0; unsigned char red, green, blue, alpha = 0; int *dst_row = dst->tpixels[dst_offset_y]; if ((m < 1) || (n < 1)) { src_offset_x[0] = n; src_offset_y[0] = m; } else { src_offset_x[0] = n - 1; src_offset_y[0] = m; } if (m < 1) { src_offset_x[1] = n; src_offset_y[1] = m; } else { src_offset_x[1] = n; src_offset_y[1] = m; } if ((m < 1) || (n >= src_w - 1)) { src_offset_x[2] = n; src_offset_y[2] = m; } else { src_offset_x[2] = n + 1; src_offset_y[2] = m; } if ((m < 1) || (n >= src_w - 2)) { src_offset_x[3] = n; src_offset_y[3] = m; } else { src_offset_x[3] = n + 1 + 1; src_offset_y[3] = m; } if (n < 1) { src_offset_x[4] = n; src_offset_y[4] = m; } else { src_offset_x[4] = n - 1; src_offset_y[4] = m; } src_offset_x[5] = n; src_offset_y[5] = m; if (n >= src_w-1) { src_offset_x[6] = n; src_offset_y[6] = m; } else { src_offset_x[6] = n + 1; src_offset_y[6] = m; } if (n >= src_w - 2) { src_offset_x[7] = n; src_offset_y[7] = m; } else { src_offset_x[7] = n + 1 + 1; src_offset_y[7] = m; } if ((m >= src_h - 1) || (n < 1)) { src_offset_x[8] = n; src_offset_y[8] = m; } else { src_offset_x[8] = n - 1; src_offset_y[8] = m; } if (m >= src_h - 1) { src_offset_x[8] = n; src_offset_y[8] = m; } else { src_offset_x[9] = n; src_offset_y[9] = m; } if ((m >= src_h-1) || (n >= src_w-1)) { src_offset_x[10] = n; src_offset_y[10] = m; } else { src_offset_x[10] = n + 1; src_offset_y[10] = m; } if ((m >= src_h - 1) || (n >= src_w - 2)) { src_offset_x[11] = n; src_offset_y[11] = m; } else { src_offset_x[11] = n + 1 + 1; src_offset_y[11] = m; } if ((m >= src_h - 2) || (n < 1)) { src_offset_x[12] = n; src_offset_y[12] = m; } else { src_offset_x[12] = n - 1; src_offset_y[12] = m; } if (m >= src_h - 2) { src_offset_x[13] = n; src_offset_y[13] = m; } else { src_offset_x[13] = n; src_offset_y[13] = m; } if ((m >= src_h - 2) || (n >= src_w - 1)) { src_offset_x[14] = n; src_offset_y[14] = m; } else { src_offset_x[14] = n + 1; src_offset_y[14] = m; } if ((m >= src_h - 2) || (n >= src_w - 2)) { src_offset_x[15] = n; src_offset_y[15] = m; } else { src_offset_x[15] = n + 1 + 1; src_offset_y[15] = m; } for (k = -1; k < 3; k++) { const gdFixed f = gd_itofx(k)-f_f; const gdFixed f_fm1 = f - f_1; const gdFixed f_fp1 = f + f_1; const gdFixed f_fp2 = f + f_2; register gdFixed f_a = 0, f_b = 0, f_d = 0, f_c = 0; register gdFixed f_RY; int l; if (f_fp2 > 0) f_a = gd_mulfx(f_fp2, gd_mulfx(f_fp2,f_fp2)); if (f_fp1 > 0) f_b = gd_mulfx(f_fp1, gd_mulfx(f_fp1,f_fp1)); if (f > 0) f_c = gd_mulfx(f, gd_mulfx(f,f)); if (f_fm1 > 0) f_d = gd_mulfx(f_fm1, gd_mulfx(f_fm1,f_fm1)); f_RY = gd_divfx((f_a - gd_mulfx(f_4,f_b) + gd_mulfx(f_6,f_c) - gd_mulfx(f_4,f_d)),f_6); for (l = -1; l < 3; l++) { const gdFixed f = gd_itofx(l) - f_g; const gdFixed f_fm1 = f - f_1; const gdFixed f_fp1 = f + f_1; const gdFixed f_fp2 = f + f_2; register gdFixed f_a = 0, f_b = 0, f_c = 0, f_d = 0; register gdFixed f_RX, f_R, f_rs, f_gs, f_bs, f_ba; register int c; const int _k = ((k+1)*4) + (l+1); if (f_fp2 > 0) f_a = gd_mulfx(f_fp2,gd_mulfx(f_fp2,f_fp2)); if (f_fp1 > 0) f_b = gd_mulfx(f_fp1,gd_mulfx(f_fp1,f_fp1)); if (f > 0) f_c = gd_mulfx(f,gd_mulfx(f,f)); if (f_fm1 > 0) f_d = gd_mulfx(f_fm1,gd_mulfx(f_fm1,f_fm1)); f_RX = gd_divfx((f_a-gd_mulfx(f_4,f_b)+gd_mulfx(f_6,f_c)-gd_mulfx(f_4,f_d)),f_6); f_R = gd_mulfx(f_RY,f_RX); c = src->tpixels[*(src_offset_y + _k)][*(src_offset_x + _k)]; f_rs = gd_itofx(gdTrueColorGetRed(c)); f_gs = gd_itofx(gdTrueColorGetGreen(c)); f_bs = gd_itofx(gdTrueColorGetBlue(c)); f_ba = gd_itofx(gdTrueColorGetAlpha(c)); f_red += gd_mulfx(f_rs,f_R); f_green += gd_mulfx(f_gs,f_R); f_blue += gd_mulfx(f_bs,f_R); f_alpha += gd_mulfx(f_ba,f_R); } } red = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_red, f_gamma)), 0, 255); green = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_green, f_gamma)), 0, 255); blue = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_blue, f_gamma)), 0, 255); alpha = (unsigned char) CLAMP(gd_fxtoi(gd_mulfx(f_alpha, f_gamma)), 0, 127); *(dst_row + dst_offset_x) = gdTrueColorAlpha(red, green, blue, alpha); dst_offset_x++; } dst_offset_y++; } return dst; } ",0 "void BlinkTestRunner::OnSessionHistory( const std::vector& routing_ids, const std::vector>& session_histories, const std::vector& current_entry_indexes) { routing_ids_ = routing_ids; session_histories_ = session_histories; current_entry_indexes_ = current_entry_indexes; CaptureDump(); } ",0 "void ath_tx_aggr_resume(struct ath_softc *sc, struct ieee80211_sta *sta, u16 tidno) { struct ath_atx_tid *tid; struct ath_node *an; struct ath_txq *txq; an = (struct ath_node *)sta->drv_priv; tid = ATH_AN_2_TID(an, tidno); txq = tid->ac->txq; ath_txq_lock(sc, txq); tid->baw_size = IEEE80211_MIN_AMPDU_BUF << sta->ht_cap.ampdu_factor; tid->paused = false; if (ath_tid_has_buffered(tid)) { ath_tx_queue_tid(txq, tid); ath_txq_schedule(sc, txq); } ath_txq_unlock_complete(sc, txq); } ",0 "perf_output_sample_regs(struct perf_output_handle *handle, struct pt_regs *regs, u64 mask) { int bit; for_each_set_bit(bit, (const unsigned long *) &mask, sizeof(mask) * BITS_PER_BYTE) { u64 val; val = perf_reg_value(regs, bit); perf_output_put(handle, val); } } ",0 "error::Error GLES2DecoderPassthroughImpl::DoVertexAttribI4ui(GLuint indx, GLuint x, GLuint y, GLuint z, GLuint w) { api()->glVertexAttribI4uiFn(indx, x, y, z, w); return error::kNoError; } ",0 "void ExtensionFunctionDispatcher::ResetFunctions() { ExtensionFunctionRegistry::GetInstance()->ResetFunctions(); } ",0 " void RenderWidgetHostImpl::AcknowledgeBufferPresent( int32 route_id, int gpu_host_id, bool presented, uint32 sync_point) { GpuProcessHostUIShim* ui_shim = GpuProcessHostUIShim::FromID(gpu_host_id); if (ui_shim) ui_shim->Send(new AcceleratedSurfaceMsg_BufferPresented(route_id, presented, sync_point)); } ",1 "zgethardwareparams(i_ctx_t *i_ctx_p) { return zget_device_params(i_ctx_p, true); } ",0 " IW_IMPL(unsigned int) iw_get_ui16be(const iw_byte *b) { return (b[0]<<8) | b[1]; } ",1 "ofputil_encode_set_async_config(const struct ofputil_async_cfg *ac, uint32_t oams, enum ofp_version ofp_version) { enum ofpraw raw = (ofp_version >= OFP14_VERSION ? OFPRAW_OFPT14_SET_ASYNC : oams & OAM_EXTENSIONS ? OFPRAW_NXT_SET_ASYNC_CONFIG2 : ofp_version >= OFP13_VERSION ? OFPRAW_OFPT13_SET_ASYNC : OFPRAW_NXT_SET_ASYNC_CONFIG); struct ofpbuf *request = ofpraw_alloc(raw, ofp_version, 0); ofputil_put_async_config__(ac, request, (raw == OFPRAW_OFPT14_SET_ASYNC || raw == OFPRAW_NXT_SET_ASYNC_CONFIG2), ofp_version, oams); return request; } ",0 "void DiscardableSharedMemoryManager::AllocateLockedDiscardableSharedMemory( int client_id, size_t size, int32_t id, base::SharedMemoryHandle* shared_memory_handle) { base::AutoLock lock(lock_); MemorySegmentMap& client_segments = clients_[client_id]; if (client_segments.find(id) != client_segments.end()) { LOG(ERROR) << ""Invalid discardable shared memory ID""; *shared_memory_handle = base::SharedMemoryHandle(); return; } size_t limit = 0; if (size < memory_limit_) limit = memory_limit_ - size; if (bytes_allocated_ > limit) ReduceMemoryUsageUntilWithinLimit(limit); std::unique_ptr memory( new base::DiscardableSharedMemory); if (!memory->CreateAndMap(size)) { *shared_memory_handle = base::SharedMemoryHandle(); return; } base::CheckedNumeric checked_bytes_allocated = bytes_allocated_; checked_bytes_allocated += memory->mapped_size(); if (!checked_bytes_allocated.IsValid()) { *shared_memory_handle = base::SharedMemoryHandle(); return; } bytes_allocated_ = checked_bytes_allocated.ValueOrDie(); BytesAllocatedChanged(bytes_allocated_); *shared_memory_handle = base::SharedMemory::DuplicateHandle(memory->handle()); memory->Close(); scoped_refptr segment(new MemorySegment(std::move(memory))); client_segments[id] = segment.get(); segments_.push_back(segment.get()); std::push_heap(segments_.begin(), segments_.end(), CompareMemoryUsageTime); if (bytes_allocated_ > memory_limit_) ScheduleEnforceMemoryPolicy(); } ",0 "static TriState StateItalic(LocalFrame& frame, Event*) { return StateStyle(frame, CSSPropertyFontStyle, ""italic""); } ",0 "static int crypto_init_blkcipher_ops_async(struct crypto_tfm *tfm) { struct ablkcipher_tfm *crt = &tfm->crt_ablkcipher; struct blkcipher_alg *alg = &tfm->__crt_alg->cra_blkcipher; crt->setkey = async_setkey; crt->encrypt = async_encrypt; crt->decrypt = async_decrypt; if (!alg->ivsize) { crt->givencrypt = skcipher_null_givencrypt; crt->givdecrypt = skcipher_null_givdecrypt; } crt->base = __crypto_ablkcipher_cast(tfm); crt->ivsize = alg->ivsize; return 0; } ",0 "void AutoFillHelper::DidAcceptAutoFillSuggestion(const WebNode& node, const WebString& value, const WebString& label, int unique_id, unsigned index) { if (suggestions_options_index_ != -1 && index == static_cast(suggestions_options_index_)) { render_view_->Send(new ViewHostMsg_ShowAutoFillDialog( render_view_->routing_id())); } else if (suggestions_clear_index_ != -1 && index == static_cast(suggestions_clear_index_)) { form_manager_.ClearFormWithNode(node); } else if (form_manager_.FormWithNodeIsAutoFilled(node) || !unique_id) { WebInputElement element = node.toConst(); element.setSuggestedValue(value); element.setValue(value); WebFrame* webframe = node.document().frame(); if (webframe) webframe->notifiyPasswordListenerOfAutocomplete(element); } else { QueryAutoFillFormData(node, value, label, unique_id, AUTOFILL_FILL); } suggestions_clear_index_ = -1; suggestions_options_index_ = -1; } ",0 "void SynchronousCompositorImpl::OnComputeScroll( base::TimeTicks animation_time) { if (need_animate_input_) { need_animate_input_ = false; synchronous_input_handler_proxy_->SynchronouslyAnimate(animation_time); } } ",0 "static inline bool cpu_has_vmx_invvpid(void) { return vmx_capability.vpid & VMX_VPID_INVVPID_BIT; } ",0 "LIBOPENMPT_MODPLUG_API char* ModPlug_GetMessage(ModPlugFile* file) { if(!file) return NULL; return file->message; } ",0 "void ForwardRequestStatus( RequestStatus status, net::URLRequest* request, void* profile_id) { const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request); if (!info) return; int process_id, render_view_id; if (info->GetAssociatedRenderView(&process_id, &render_view_id)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&NotifyEPMRequestStatus, status, profile_id, process_id, render_view_id)); } } ",0 "void ff_avg_rv40_qpel8_mc33_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) { avg_pixels8_xy2_8_c(dst, src, stride, 8); } ",0 "void MediaRecorder::doCleanUp() { ALOGV(""doCleanUp""); mIsAudioSourceSet = false; mIsVideoSourceSet = false; mIsAudioEncoderSet = false; mIsVideoEncoderSet = false; mIsOutputFileSet = false; } ",0 "static apr_byte_t oidc_check_cookie_domain(request_rec *r, oidc_cfg *cfg, oidc_session_t *session) { const char *c_cookie_domain = cfg->cookie_domain ? cfg->cookie_domain : oidc_get_current_url_host(r); const char *s_cookie_domain = oidc_session_get_cookie_domain(r, session); if ((s_cookie_domain == NULL) || (apr_strnatcmp(c_cookie_domain, s_cookie_domain) != 0)) { oidc_warn(r, ""aborting: detected attempt to play cookie against a different domain/host than issued for! (issued=%s, current=%s)"", s_cookie_domain, c_cookie_domain); return FALSE; } return TRUE; } ",0 "static void reflectTestInterfaceAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; TestObjectPythonV8Internal::reflectTestInterfaceAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "xmlCanonicPath(const xmlChar *path) { /* * For Windows implementations, additional work needs to be done to * replace backslashes in pathnames with ""forward slashes"" */ #if defined(_WIN32) && !defined(__CYGWIN__) int len = 0; int i = 0; xmlChar *p = NULL; #endif xmlURIPtr uri; xmlChar *ret; const xmlChar *absuri; if (path == NULL) return(NULL); #if defined(_WIN32) /* * We must not change the backslashes to slashes if the the path * starts with \\?\ * Those paths can be up to 32k characters long. * Was added specifically for OpenOffice, those paths can't be converted * to URIs anyway. */ if ((path[0] == '\\') && (path[1] == '\\') && (path[2] == '?') && (path[3] == '\\') ) return xmlStrdup((const xmlChar *) path); #endif /* sanitize filename starting with // so it can be used as URI */ if ((path[0] == '/') && (path[1] == '/') && (path[2] != '/')) path++; if ((uri = xmlParseURI((const char *) path)) != NULL) { xmlFreeURI(uri); return xmlStrdup(path); } /* Check if this is an ""absolute uri"" */ absuri = xmlStrstr(path, BAD_CAST ""://""); if (absuri != NULL) { int l, j; unsigned char c; xmlChar *escURI; /* * this looks like an URI where some parts have not been * escaped leading to a parsing problem. Check that the first * part matches a protocol. */ l = absuri - path; /* Bypass if first part (part before the '://') is > 20 chars */ if ((l <= 0) || (l > 20)) goto path_processing; /* Bypass if any non-alpha characters are present in first part */ for (j = 0;j < l;j++) { c = path[j]; if (!(((c >= 'a') && (c <= 'z')) || ((c >= 'A') && (c <= 'Z')))) goto path_processing; } /* Escape all except the characters specified in the supplied path */ escURI = xmlURIEscapeStr(path, BAD_CAST "":/?_.#&;=""); if (escURI != NULL) { /* Try parsing the escaped path */ uri = xmlParseURI((const char *) escURI); /* If successful, return the escaped string */ if (uri != NULL) { xmlFreeURI(uri); return escURI; } } } path_processing: /* For Windows implementations, replace backslashes with 'forward slashes' */ #if defined(_WIN32) && !defined(__CYGWIN__) /* * Create a URI structure */ uri = xmlCreateURI(); if (uri == NULL) { /* Guard against 'out of memory' */ return(NULL); } len = xmlStrlen(path); if ((len > 2) && IS_WINDOWS_PATH(path)) { /* make the scheme 'file' */ uri->scheme = xmlStrdup(BAD_CAST ""file""); /* allocate space for leading '/' + path + string terminator */ uri->path = xmlMallocAtomic(len + 2); if (uri->path == NULL) { xmlFreeURI(uri); /* Guard agains 'out of memory' */ return(NULL); } /* Put in leading '/' plus path */ uri->path[0] = '/'; p = uri->path + 1; strncpy(p, path, len + 1); } else { uri->path = xmlStrdup(path); if (uri->path == NULL) { xmlFreeURI(uri); return(NULL); } p = uri->path; } /* Now change all occurences of '\' to '/' */ while (*p != '\0') { if (*p == '\\') *p = '/'; p++; } if (uri->scheme == NULL) { ret = xmlStrdup((const xmlChar *) uri->path); } else { ret = xmlSaveUri(uri); } xmlFreeURI(uri); #else ret = xmlStrdup((const xmlChar *) path); #endif return(ret); } ",0 "static void gf_sm_delete_stream(GF_StreamContext *sc) { gf_sm_reset_stream(sc); gf_list_del(sc->AUs); if (sc->name) gf_free(sc->name); if (sc->dec_cfg) gf_free(sc->dec_cfg); gf_free(sc); } ",0 "static int padzero(unsigned long elf_bss) { unsigned long nbyte; nbyte = ELF_PAGEOFFSET(elf_bss); if (nbyte) { nbyte = ELF_MIN_ALIGN - nbyte; if (clear_user((void __user *) elf_bss, nbyte)) return -EFAULT; } return 0; } ",0 " GC_INNER void * GC_core_malloc_atomic(size_t lb) #else GC_API void * GC_CALL GC_malloc_atomic(size_t lb) #endif { void *op; void ** opp; size_t lg; DCL_LOCK_STATE; if(SMALL_OBJ(lb)) { lg = GC_size_map[lb]; opp = &(GC_aobjfreelist[lg]); LOCK(); if (EXPECT((op = *opp) == 0, FALSE)) { UNLOCK(); return(GENERAL_MALLOC((word)lb, PTRFREE)); } *opp = obj_link(op); GC_bytes_allocd += GRANULES_TO_BYTES(lg); UNLOCK(); return((void *) op); } else { return(GENERAL_MALLOC((word)lb, PTRFREE)); } } ",0 "BnMemoryHeap::~BnMemoryHeap() { } ",0 "int usb_authorize_device(struct usb_device *usb_dev) { int result = 0, c; usb_lock_device(usb_dev); if (usb_dev->authorized == 1) goto out_authorized; result = usb_autoresume_device(usb_dev); if (result < 0) { dev_err(&usb_dev->dev, ""can't autoresume for authorization: %d\n"", result); goto error_autoresume; } if (usb_dev->wusb) { result = usb_get_device_descriptor(usb_dev, sizeof(usb_dev->descriptor)); if (result < 0) { dev_err(&usb_dev->dev, ""can't re-read device descriptor for "" ""authorization: %d\n"", result); goto error_device_descriptor; } } usb_dev->authorized = 1; /* Choose and set the configuration. This registers the interfaces * with the driver core and lets interface drivers bind to them. */ c = usb_choose_configuration(usb_dev); if (c >= 0) { result = usb_set_configuration(usb_dev, c); if (result) { dev_err(&usb_dev->dev, ""can't set config #%d, error %d\n"", c, result); /* This need not be fatal. The user can try to * set other configurations. */ } } dev_info(&usb_dev->dev, ""authorized to connect\n""); error_device_descriptor: usb_autosuspend_device(usb_dev); error_autoresume: out_authorized: usb_unlock_device(usb_dev); /* complements locktree */ return result; } ",0 "GF_Err stri_dump(GF_Box *a, FILE * trace) { u32 i; GF_SubTrackInformationBox *p = (GF_SubTrackInformationBox *)a; gf_isom_box_dump_start(a, ""SubTrackInformationBox"", trace); fprintf(trace, ""switch_group=\""%d\"" alternate_group=\""%d\"" sub_track_id=\""%d\"">\n"", p->switch_group, p->alternate_group, p->sub_track_id); for (i = 0; i < p->attribute_count; i++) { fprintf(trace, ""\n"", gf_4cc_to_str(p->attribute_list[i]) ); } if (!p->size) fprintf(trace, ""\n""); gf_isom_box_dump_done(""SubTrackInformationBox"", a, trace); return GF_OK; } ",0 "static struct rb_entry *__lookup_rb_tree_fast(struct rb_entry *cached_re, unsigned int ofs) { if (cached_re) { if (cached_re->ofs <= ofs && cached_re->ofs + cached_re->len > ofs) { return cached_re; } } return NULL; } ",0 "void PaintLayerScrollableArea::InvalidateStickyConstraintsFor( PaintLayer* layer, bool needs_compositing_update) { if (PaintLayerScrollableAreaRareData* d = RareData()) { d->sticky_constraints_map_.erase(layer); if (needs_compositing_update && layer->GetLayoutObject().StyleRef().HasStickyConstrainedPosition()) { layer->SetNeedsCompositingInputsUpdate(); layer->GetLayoutObject().SetNeedsPaintPropertyUpdate(); } } } ",0 "void webkitWebViewBaseSetTooltipText(WebKitWebViewBase* webViewBase, const char* tooltip) { WebKitWebViewBasePrivate* priv = webViewBase->priv; if (tooltip && tooltip[0] != '\0') { priv->tooltipText = tooltip; gtk_widget_set_has_tooltip(GTK_WIDGET(webViewBase), TRUE); } else { priv->tooltipText = """"; gtk_widget_set_has_tooltip(GTK_WIDGET(webViewBase), FALSE); } gtk_widget_trigger_tooltip_query(GTK_WIDGET(webViewBase)); } ",0 " static void zgfx_history_buffer_ring_write(ZGFX_CONTEXT* zgfx, const BYTE* src, size_t count) { UINT32 front; if (count <= 0) return; if (count > zgfx->HistoryBufferSize) { const size_t residue = count - zgfx->HistoryBufferSize; count = zgfx->HistoryBufferSize; src += residue; zgfx->HistoryIndex = (zgfx->HistoryIndex + residue) % zgfx->HistoryBufferSize; } if (zgfx->HistoryIndex + count <= zgfx->HistoryBufferSize) { CopyMemory(&(zgfx->HistoryBuffer[zgfx->HistoryIndex]), src, count); if ((zgfx->HistoryIndex += count) == zgfx->HistoryBufferSize) zgfx->HistoryIndex = 0; } else { front = zgfx->HistoryBufferSize - zgfx->HistoryIndex; CopyMemory(&(zgfx->HistoryBuffer[zgfx->HistoryIndex]), src, front); CopyMemory(zgfx->HistoryBuffer, &src[front], count - front); zgfx->HistoryIndex = count - front; } } ",0 "void BinaryUploadService::RecordRequestMetrics( Request* request, Result result, const DeepScanningClientResponse& response) { base::UmaHistogramEnumeration(""SafeBrowsingBinaryUploadRequest.Result"", result); base::UmaHistogramCustomTimes(""SafeBrowsingBinaryUploadRequest.Duration"", base::TimeTicks::Now() - start_times_[request], base::TimeDelta::FromMilliseconds(1), base::TimeDelta::FromMinutes(6), 50); if (response.has_malware_scan_verdict()) { base::UmaHistogramBoolean(""SafeBrowsingBinaryUploadRequest.MalwareResult"", response.malware_scan_verdict().verdict() != MalwareDeepScanningVerdict::CLEAN); } if (response.has_dlp_scan_verdict()) { base::UmaHistogramBoolean(""SafeBrowsingBinaryUploadRequest.DlpResult"", response.dlp_scan_verdict().status() == DlpDeepScanningVerdict::SUCCESS); } } ",0 "static void btif_in_pan_generic_evt(UINT16 event, char *p_param) { BTIF_TRACE_EVENT(""%s: event=%d"", __FUNCTION__, event); switch (event) { case BTIF_PAN_CB_DISCONNECTING: { bt_bdaddr_t *bd_addr = (bt_bdaddr_t*)p_param; btpan_conn_t* conn = btpan_find_conn_addr(bd_addr->address); int btpan_conn_local_role; int btpan_remote_role; asrt(conn != NULL); if (conn) { btpan_conn_local_role = bta_role_to_btpan(conn->local_role); btpan_remote_role = bta_role_to_btpan(conn->remote_role); callback.connection_state_cb(BTPAN_STATE_DISCONNECTING, BT_STATUS_SUCCESS, (const bt_bdaddr_t*)conn->peer, btpan_conn_local_role, btpan_remote_role); } } break; default: { BTIF_TRACE_WARNING(""%s : Unknown event 0x%x"", __FUNCTION__, event); } break; } } ",0 "void WebGL2RenderingContextBase::uniformMatrix3x4fv( const WebGLUniformLocation* location, GLboolean transpose, Vector& value, GLuint src_offset, GLuint src_length) { if (isContextLost() || !ValidateUniformMatrixParameters(""uniformMatrix3x4fv"", location, transpose, value.data(), value.size(), 12, src_offset, src_length)) return; ContextGL()->UniformMatrix3x4fv( location->Location(), (src_length ? src_length : (value.size() - src_offset)) / 12, transpose, value.data() + src_offset); } ",0 "xfs_check_page_type( struct page *page, unsigned int type, bool check_all_buffers) { struct buffer_head *bh; struct buffer_head *head; if (PageWriteback(page)) return false; if (!page->mapping) return false; if (!page_has_buffers(page)) return false; bh = head = page_buffers(page); do { if (buffer_unwritten(bh)) { if (type == XFS_IO_UNWRITTEN) return true; } else if (buffer_delay(bh)) { if (type == XFS_IO_DELALLOC) return true; } else if (buffer_dirty(bh) && buffer_mapped(bh)) { if (type == XFS_IO_OVERWRITE) return true; } /* If we are only checking the first buffer, we are done now. */ if (!check_all_buffers) break; } while ((bh = bh->b_this_page) != head); return false; } ",0 "static void mem_cgroup_threshold(struct mem_cgroup *memcg) { while (memcg) { __mem_cgroup_threshold(memcg, false); if (do_swap_account) __mem_cgroup_threshold(memcg, true); memcg = parent_mem_cgroup(memcg); } } ",0 "pdf14_get_buffer_information(const gx_device * dev, gx_pattern_trans_t *transbuff, gs_memory_t *mem, bool free_device) { const pdf14_device * pdev = (pdf14_device *)dev; pdf14_buf *buf; gs_int_rect rect; int x1,y1,width,height; if ( pdev->ctx == NULL){ return 0; /* this can occur if the pattern is a clist */ } #ifdef DEBUG pdf14_debug_mask_stack_state(pdev->ctx); #endif buf = pdev->ctx->stack; rect = buf->rect; transbuff->dirty = &buf->dirty; x1 = min(pdev->width, rect.q.x); y1 = min(pdev->height, rect.q.y); width = x1 - rect.p.x; height = y1 - rect.p.y; if (width <= 0 || height <= 0 || buf->data == NULL) return 0; transbuff->n_chan = buf->n_chan; transbuff->has_tags = buf->has_tags; transbuff->has_shape = buf->has_shape; transbuff->width = buf->rect.q.x - buf->rect.p.x; transbuff->height = buf->rect.q.y - buf->rect.p.y; if (free_device) { transbuff->pdev14 = NULL; transbuff->rect = rect; if ((width < transbuff->width) || (height < transbuff->height)) { /* If the bbox is smaller than the whole buffer than go ahead and create a new one to use. This can occur if we drew in a smaller area than was specified by the transparency group rect. */ int rowstride = (width + 3) & -4; int planestride = rowstride * height; int k, j; byte *buff_ptr_src, *buff_ptr_des; transbuff->planestride = planestride; transbuff->rowstride = rowstride; transbuff->transbytes = gs_alloc_bytes(mem, planestride*(buf->n_chan + buf->has_tags ? 1 : 0), ""pdf14_get_buffer_information""); if (transbuff->transbytes == NULL) return gs_error_VMerror; transbuff->mem = mem; for (j = 0; j < transbuff->n_chan; j++) { buff_ptr_src = buf->data + j * buf->planestride + buf->rowstride * rect.p.y + rect.p.x; buff_ptr_des = transbuff->transbytes + j * planestride; for (k = 0; k < height; k++) { memcpy(buff_ptr_des, buff_ptr_src,rowstride); buff_ptr_des += rowstride; buff_ptr_src += buf->rowstride; } } } else { /* The entire buffer is used. Go ahead and grab the pointer and clear the pointer in the pdf14 device data buffer so it is not freed when we close the device */ transbuff->planestride = buf->planestride; transbuff->rowstride = buf->rowstride; transbuff->transbytes = buf->data; transbuff->mem = buf->memory; buf->data = NULL; /* So that the buffer is not freed */ } /* Go ahead and free up the pdf14 device */ dev_proc(dev, close_device)((gx_device *)dev); #if RAW_DUMP /* Dump the buffer that should be going into the pattern */; dump_raw_buffer(height, width, transbuff->n_chan, transbuff->planestride, transbuff->rowstride, ""pdf14_pattern_buff"", transbuff->transbytes); global_index++; #endif } else { /* Here we are coming from one of the fill image / pattern / mask operations */ transbuff->pdev14 = dev; transbuff->planestride = buf->planestride; transbuff->rowstride = buf->rowstride; transbuff->transbytes = buf->data; transbuff->mem = buf->memory; transbuff->rect = rect; #if RAW_DUMP /* Dump the buffer that should be going into the pattern */; dump_raw_buffer(height, width, buf->n_chan, pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride, ""pdf14_pattern_buff"", buf->data + transbuff->rowstride * transbuff->rect.p.y + transbuff->rect.p.x); global_index++; #endif } return(0); } ",0 "enum act_parse_ret parse_http_action_reject(const char **args, int *orig_arg, struct proxy *px, struct act_rule *rule, char **err) { rule->action = ACT_CUSTOM; rule->action_ptr = http_action_reject; return ACT_RET_PRS_OK; } ",0 "AfterTranslateInfoBar::~AfterTranslateInfoBar() { } ",0 "bool StyleResolver::checkRegionStyle(Element* regionElement) { if (ScopedStyleResolver* scopedResolver = m_styleTree.scopedStyleResolverForDocument()) { if (scopedResolver->checkRegionStyle(regionElement)) return true; } return false; } ",0 "char *Sys_DefaultAppPath(void) { return Sys_BinaryPath(); } ",0 " void OnUpdateViewportIntersection(const gfx::Rect& viewport_intersection, const gfx::Rect& compositing_rect) { content::BrowserThread::PostTask( content::BrowserThread::IO, FROM_HERE, base::BindOnce(&UpdateViewportIntersectionMessageFilter:: OnUpdateViewportIntersectionPostOnIO, this, viewport_intersection, compositing_rect)); } ",0 "static int phar_analyze_path(const char *fname, const char *ext, int ext_len, int for_create) /* {{{ */ { php_stream_statbuf ssb; char *realpath; char *filename = estrndup(fname, (ext - fname) + ext_len); if ((realpath = expand_filepath(filename, NULL))) { #ifdef PHP_WIN32 phar_unixify_path_separators(realpath, strlen(realpath)); #endif if (zend_hash_str_exists(&(PHAR_G(phar_fname_map)), realpath, strlen(realpath))) { efree(realpath); efree(filename); return SUCCESS; } if (PHAR_G(manifest_cached) && zend_hash_str_exists(&cached_phars, realpath, strlen(realpath))) { efree(realpath); efree(filename); return SUCCESS; } efree(realpath); } if (SUCCESS == php_stream_stat_path((char *) filename, &ssb)) { efree(filename); if (ssb.sb.st_mode & S_IFDIR) { return FAILURE; } if (for_create == 1) { return FAILURE; } return SUCCESS; } else { char *slash; if (!for_create) { efree(filename); return FAILURE; } slash = (char *) strrchr(filename, '/'); if (slash) { *slash = '\0'; } if (SUCCESS != php_stream_stat_path((char *) filename, &ssb)) { if (!slash) { if (!(realpath = expand_filepath(filename, NULL))) { efree(filename); return FAILURE; } #ifdef PHP_WIN32 phar_unixify_path_separators(realpath, strlen(realpath)); #endif slash = strstr(realpath, filename); if (slash) { slash += ((ext - fname) + ext_len); *slash = '\0'; } slash = strrchr(realpath, '/'); if (slash) { *slash = '\0'; } else { efree(realpath); efree(filename); return FAILURE; } if (SUCCESS != php_stream_stat_path(realpath, &ssb)) { efree(realpath); efree(filename); return FAILURE; } efree(realpath); if (ssb.sb.st_mode & S_IFDIR) { efree(filename); return SUCCESS; } } efree(filename); return FAILURE; } efree(filename); if (ssb.sb.st_mode & S_IFDIR) { return SUCCESS; } return FAILURE; } } /* }}} */ ",0 "void iov_iter_init(struct iov_iter *i, int direction, const struct iovec *iov, unsigned long nr_segs, size_t count) { /* It will get better. Eventually... */ if (segment_eq(get_fs(), KERNEL_DS)) { direction |= ITER_KVEC; i->type = direction; i->kvec = (struct kvec *)iov; } else { i->type = direction; i->iov = iov; } i->nr_segs = nr_segs; i->iov_offset = 0; i->count = count; } ",0 "bool writeAll(std::ostream& out, const BigBuffer& buffer) { for (const auto& b : buffer) { if (!out.write(reinterpret_cast(b.buffer.get()), b.size)) { return false; } } return true; } ",0 "XML_ExpatVersion(void) { /* V1 is used to string-ize the version number. However, it would string-ize the actual version macro *names* unless we get them substituted before being passed to V1. CPP is defined to expand a macro, then rescan for more expansions. Thus, we use V2 to expand the version macros, then CPP will expand the resulting V1() macro with the correct numerals. */ /* ### I'm assuming cpp is portable in this respect... */ #define V1(a, b, c) XML_L(#a) XML_L(""."") XML_L(#b) XML_L(""."") XML_L(#c) #define V2(a, b, c) XML_L(""expat_"") V1(a, b, c) return V2(XML_MAJOR_VERSION, XML_MINOR_VERSION, XML_MICRO_VERSION); #undef V1 #undef V2 } ",0 "void* Type_Data_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n) { cmsICCData* BinData = (cmsICCData*) Ptr; return _cmsDupMem(self ->ContextID, Ptr, sizeof(cmsICCData) + BinData ->len - 1); cmsUNUSED_PARAMETER(n); } ",0 "static int ldb_match_present(struct ldb_context *ldb, const struct ldb_message *msg, const struct ldb_parse_tree *tree, enum ldb_scope scope, bool *matched) { const struct ldb_schema_attribute *a; struct ldb_message_element *el; if (ldb_attr_dn(tree->u.present.attr) == 0) { *matched = true; return LDB_SUCCESS; } el = ldb_msg_find_element(msg, tree->u.present.attr); if (el == NULL) { *matched = false; return LDB_SUCCESS; } a = ldb_schema_attribute_by_name(ldb, el->name); if (!a) { return LDB_ERR_INVALID_ATTRIBUTE_SYNTAX; } if (a->syntax->operator_fn) { unsigned int i; for (i = 0; i < el->num_values; i++) { int ret = a->syntax->operator_fn(ldb, LDB_OP_PRESENT, a, &el->values[i], NULL, matched); if (ret != LDB_SUCCESS) return ret; if (*matched) return LDB_SUCCESS; } *matched = false; return LDB_SUCCESS; } *matched = true; return LDB_SUCCESS; } ",0 "void FakeCentral::StopScan(DiscoverySessionResultCallback callback) { if (!IsPresent()) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce( std::move(callback), /*is_error=*/false, device::UMABluetoothDiscoverySessionOutcome::ADAPTER_NOT_PRESENT)); return; } base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce( std::move(callback), /*is_error=*/false, device::UMABluetoothDiscoverySessionOutcome::ADAPTER_NOT_PRESENT)); } ",0 "BOOL rectangles_intersects(const RECTANGLE_16* r1, const RECTANGLE_16* r2) { RECTANGLE_16 tmp; return rectangles_intersection(r1, r2, &tmp); } ",0 "BGD_DECLARE(void) gdClearErrorMethod(void) { gd_error_method = gd_stderr_error; } ",0 "static int ehci_cancel_queue(EHCIQueue *q) { EHCIPacket *p; int packets = 0; p = QTAILQ_FIRST(&q->packets); if (p == NULL) { goto leave; } trace_usb_ehci_queue_action(q, ""cancel""); do { ehci_free_packet(p); packets++; } while ((p = QTAILQ_FIRST(&q->packets)) != NULL); leave: ehci_queue_stopped(q); return packets; } ",0 "GF_Err chpl_Read(GF_Box *s,GF_BitStream *bs) { GF_ChapterEntry *ce; u32 nb_chaps, len, i, count; GF_ChapterListBox *ptr = (GF_ChapterListBox *)s; /*reserved or ???*/ gf_bs_read_u32(bs); nb_chaps = gf_bs_read_u8(bs); count = 0; while (nb_chaps) { GF_SAFEALLOC(ce, GF_ChapterEntry); if (!ce) return GF_OUT_OF_MEM; ce->start_time = gf_bs_read_u64(bs); len = gf_bs_read_u8(bs); if (len) { ce->name = (char *)gf_malloc(sizeof(char)*(len+1)); gf_bs_read_data(bs, ce->name, len); ce->name[len] = 0; } else { ce->name = gf_strdup(""""); } for (i=0; ilist, i); if (ace->start_time >= ce->start_time) { gf_list_insert(ptr->list, ce, i); ce = NULL; break; } } if (ce) gf_list_add(ptr->list, ce); count++; nb_chaps--; } return GF_OK; } ",0 "evdns_getaddrinfo_set_timeout(struct evdns_base *evdns_base, struct evdns_getaddrinfo_request *data) { return event_add(&data->timeout, &evdns_base->global_getaddrinfo_allow_skew); } ",0 "static struct crypto_instance *crypto_rfc4309_alloc(struct rtattr **tb) { struct crypto_attr_type *algt; struct crypto_instance *inst; struct crypto_aead_spawn *spawn; struct crypto_alg *alg; const char *ccm_name; int err; algt = crypto_get_attr_type(tb); if (IS_ERR(algt)) return ERR_CAST(algt); if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) return ERR_PTR(-EINVAL); ccm_name = crypto_attr_alg_name(tb[1]); if (IS_ERR(ccm_name)) return ERR_CAST(ccm_name); inst = kzalloc(sizeof(*inst) + sizeof(*spawn), GFP_KERNEL); if (!inst) return ERR_PTR(-ENOMEM); spawn = crypto_instance_ctx(inst); crypto_set_aead_spawn(spawn, inst); err = crypto_grab_aead(spawn, ccm_name, 0, crypto_requires_sync(algt->type, algt->mask)); if (err) goto out_free_inst; alg = crypto_aead_spawn_alg(spawn); err = -EINVAL; /* We only support 16-byte blocks. */ if (alg->cra_aead.ivsize != 16) goto out_drop_alg; /* Not a stream cipher? */ if (alg->cra_blocksize != 1) goto out_drop_alg; err = -ENAMETOOLONG; if (snprintf(inst->alg.cra_name, CRYPTO_MAX_ALG_NAME, ""rfc4309(%s)"", alg->cra_name) >= CRYPTO_MAX_ALG_NAME || snprintf(inst->alg.cra_driver_name, CRYPTO_MAX_ALG_NAME, ""rfc4309(%s)"", alg->cra_driver_name) >= CRYPTO_MAX_ALG_NAME) goto out_drop_alg; inst->alg.cra_flags = CRYPTO_ALG_TYPE_AEAD; inst->alg.cra_flags |= alg->cra_flags & CRYPTO_ALG_ASYNC; inst->alg.cra_priority = alg->cra_priority; inst->alg.cra_blocksize = 1; inst->alg.cra_alignmask = alg->cra_alignmask; inst->alg.cra_type = &crypto_nivaead_type; inst->alg.cra_aead.ivsize = 8; inst->alg.cra_aead.maxauthsize = 16; inst->alg.cra_ctxsize = sizeof(struct crypto_rfc4309_ctx); inst->alg.cra_init = crypto_rfc4309_init_tfm; inst->alg.cra_exit = crypto_rfc4309_exit_tfm; inst->alg.cra_aead.setkey = crypto_rfc4309_setkey; inst->alg.cra_aead.setauthsize = crypto_rfc4309_setauthsize; inst->alg.cra_aead.encrypt = crypto_rfc4309_encrypt; inst->alg.cra_aead.decrypt = crypto_rfc4309_decrypt; inst->alg.cra_aead.geniv = ""seqiv""; out: return inst; out_drop_alg: crypto_drop_aead(spawn); out_free_inst: kfree(inst); inst = ERR_PTR(err); goto out; } ",0 "bool VaapiVideoDecodeAccelerator::GetInputBuffer_Locked() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); lock_.AssertAcquired(); if (curr_input_buffer_.get()) return true; while (input_buffers_.empty() && (state_ == kDecoding || state_ == kIdle)) { input_ready_.Wait(); } switch (state_) { case kFlushing: if (input_buffers_.empty()) return false; case kDecoding: case kIdle: DCHECK(!input_buffers_.empty()); curr_input_buffer_ = input_buffers_.front(); input_buffers_.pop(); DVLOG(4) << ""New current bitstream buffer, id: "" << curr_input_buffer_->id << "" size: "" << curr_input_buffer_->size; decoder_->SetStream( static_cast(curr_input_buffer_->shm->memory()), curr_input_buffer_->size); return true; default: return false; } } ",0 "isakmp_rfc3948_print(netdissect_options *ndo, const u_char *bp, u_int length, const u_char *bp2) { if(length == 1 && bp[0]==0xff) { ND_PRINT((ndo, ""isakmp-nat-keep-alive"")); return; } if(length < 4) { goto trunc; } /* * see if this is an IKE packet */ if(bp[0]==0 && bp[1]==0 && bp[2]==0 && bp[3]==0) { ND_PRINT((ndo, ""NONESP-encap: "")); isakmp_print(ndo, bp+4, length-4, bp2); return; } /* must be an ESP packet */ { int nh, enh, padlen; int advance; ND_PRINT((ndo, ""UDP-encap: "")); advance = esp_print(ndo, bp, length, bp2, &enh, &padlen); if(advance <= 0) return; bp += advance; length -= advance + padlen; nh = enh & 0xff; ip_print_inner(ndo, bp, length, nh, bp2); return; } trunc: ND_PRINT((ndo,""[|isakmp]"")); return; } ",1 "int http_find_full_header2(const char *name, int len, char *sol, struct hdr_idx *idx, struct hdr_ctx *ctx) { char *eol, *sov; int cur_idx, old_idx; cur_idx = ctx->idx; if (cur_idx) { /* We have previously returned a header, let's search another one */ sol = ctx->line; eol = sol + idx->v[cur_idx].len; goto next_hdr; } /* first request for this header */ sol += hdr_idx_first_pos(idx); old_idx = 0; cur_idx = hdr_idx_first_idx(idx); while (cur_idx) { eol = sol + idx->v[cur_idx].len; if (len == 0) { /* No argument was passed, we want any header. * To achieve this, we simply build a fake request. */ while (sol + len < eol && sol[len] != ':') len++; name = sol; } if ((len < eol - sol) && (sol[len] == ':') && (strncasecmp(sol, name, len) == 0)) { ctx->del = len; sov = sol + len + 1; while (sov < eol && HTTP_IS_LWS(*sov)) sov++; ctx->line = sol; ctx->prev = old_idx; ctx->idx = cur_idx; ctx->val = sov - sol; ctx->tws = 0; while (eol > sov && HTTP_IS_LWS(*(eol - 1))) { eol--; ctx->tws++; } ctx->vlen = eol - sov; return 1; } next_hdr: sol = eol + idx->v[cur_idx].cr + 1; old_idx = cur_idx; cur_idx = idx->v[cur_idx].next; } return 0; } ",0 " void CheckWindowAndItemPlacement(aura::Window* first, aura::Window* second) { Shelf* shelf = GetPrimaryShelf(); const gfx::Rect first_item_bounds = shelf->GetScreenBoundsOfItemIconForWindow(first); const gfx::Rect second_item_bounds = shelf->GetScreenBoundsOfItemIconForWindow(second); if (!base::i18n::IsRTL()) { EXPECT_TRUE((first->bounds().x() < second->bounds().x()) || (first->bounds().y() < second->bounds().y())); EXPECT_TRUE((first_item_bounds.x() < second_item_bounds.x()) || (first_item_bounds.y() < second_item_bounds.y())); } else { EXPECT_TRUE((first->bounds().x() > second->bounds().x()) || (first->bounds().y() < second->bounds().y())); EXPECT_TRUE((first_item_bounds.x() > second_item_bounds.x()) || (first_item_bounds.y() < second_item_bounds.y())); } } ",0 " static void gdImageClipRectangle(gdImagePtr im, gdRectPtr r) { int c1x, c1y, c2x, c2y; int x1,y1; gdImageGetClip(im, &c1x, &c1y, &c2x, &c2y); x1 = r->x + r->width - 1; y1 = r->y + r->height - 1; r->x = CLAMP(r->x, c1x, c2x); r->y = CLAMP(r->y, c1y, c2y); r->width = CLAMP(x1, c1x, c2x) - r->x + 1; r->height = CLAMP(y1, c1y, c2y) - r->y + 1; } ",0 "bool RenderFrameImpl::RunJavaScriptDialog(JavaScriptDialogType type, const base::string16& message, const base::string16& default_value, base::string16* result) { if (suppress_further_dialogs_) return false; int32_t message_length = static_cast(message.length()); if (WebUserGestureIndicator::ProcessedUserGestureSinceLoad(frame_)) { UMA_HISTOGRAM_COUNTS_1M(""JSDialogs.CharacterCount.UserGestureSinceLoad"", message_length); } else { UMA_HISTOGRAM_COUNTS_1M(""JSDialogs.CharacterCount.NoUserGestureSinceLoad"", message_length); } if (is_main_frame_) UMA_HISTOGRAM_COUNTS_1M(""JSDialogs.CharacterCount.MainFrame"", message_length); else UMA_HISTOGRAM_COUNTS_1M(""JSDialogs.CharacterCount.Subframe"", message_length); const base::string16::size_type kMaxMessageSize = 10 * 1024; base::string16 truncated_message = message.substr(0, kMaxMessageSize); bool success = false; base::string16 result_temp; if (!result) result = &result_temp; Send(new FrameHostMsg_RunJavaScriptDialog( routing_id_, truncated_message, default_value, type, &success, result)); return success; } ",0 "bool InputMethodIBus::ExecuteCharacterComposer(uint32 ibus_keyval, uint32 ibus_keycode, uint32 ibus_state) { bool consumed = character_composer_.FilterKeyPress( ibus_keyval, ibus_keycode, EventFlagsFromXState(ibus_state)); suppress_next_result_ = false; chromeos::IBusText preedit; preedit.set_text( UTF16ToUTF8(character_composer_.preedit_string())); UpdatePreeditText(preedit, preedit.text().size(), !preedit.text().empty()); std::string commit_text = UTF16ToUTF8(character_composer_.composed_character()); if (!commit_text.empty()) { CommitText(commit_text); } return consumed; } ",0 "static int xfrm_get_policy(struct sk_buff *skb, struct nlmsghdr *nlh, struct nlattr **attrs) { struct net *net = sock_net(skb->sk); struct xfrm_policy *xp; struct xfrm_userpolicy_id *p; u8 type = XFRM_POLICY_TYPE_MAIN; int err; struct km_event c; int delete; struct xfrm_mark m; u32 mark = xfrm_mark_get(attrs, &m); p = nlmsg_data(nlh); delete = nlh->nlmsg_type == XFRM_MSG_DELPOLICY; err = copy_from_user_policy_type(&type, attrs); if (err) return err; err = verify_policy_dir(p->dir); if (err) return err; if (p->index) xp = xfrm_policy_byid(net, mark, type, p->dir, p->index, delete, &err); else { struct nlattr *rt = attrs[XFRMA_SEC_CTX]; struct xfrm_sec_ctx *ctx; err = verify_sec_ctx_len(attrs); if (err) return err; ctx = NULL; if (rt) { struct xfrm_user_sec_ctx *uctx = nla_data(rt); err = security_xfrm_policy_alloc(&ctx, uctx, GFP_KERNEL); if (err) return err; } xp = xfrm_policy_bysel_ctx(net, mark, type, p->dir, &p->sel, ctx, delete, &err); security_xfrm_policy_free(ctx); } if (xp == NULL) return -ENOENT; if (!delete) { struct sk_buff *resp_skb; resp_skb = xfrm_policy_netlink(skb, xp, p->dir, nlh->nlmsg_seq); if (IS_ERR(resp_skb)) { err = PTR_ERR(resp_skb); } else { err = nlmsg_unicast(net->xfrm.nlsk, resp_skb, NETLINK_CB(skb).portid); } } else { xfrm_audit_policy_delete(xp, err ? 0 : 1, true); if (err != 0) goto out; c.data.byid = p->index; c.event = nlh->nlmsg_type; c.seq = nlh->nlmsg_seq; c.portid = nlh->nlmsg_pid; km_policy_notify(xp, p->dir, &c); } out: xfrm_pol_put(xp); return err; } ",0 "Condor_Auth_SSL::encrypt_or_decrypt(bool want_encrypt, unsigned char* input, int input_len, unsigned char* &output, int &output_len) { bool result; if ( output ) free(output); output = NULL; output_len = 0; if (!input || input_len < 1) { return false; } if (!m_crypto) { return false; } m_crypto->resetState(); if (want_encrypt) { result = m_crypto->encrypt(input,input_len,output,output_len); } else { result = m_crypto->decrypt(input,input_len,output,output_len); } if (!result) { output_len = 0; } if ( output_len == 0 ) { if ( output ) free(output); output = NULL; return false; } return true; } ",0 "void* Type_Chromaticity_Dup(struct _cms_typehandler_struct* self, const void *Ptr, cmsUInt32Number n) { return _cmsDupMem(self ->ContextID, Ptr, sizeof(cmsCIExyYTRIPLE)); cmsUNUSED_PARAMETER(n); } ",0 "std::string HttpUtil::Unquote(const std::string& str) { return Unquote(str.begin(), str.end()); } ",0 "static int http_stream_read( git_smart_subtransport_stream *stream, char *buffer, size_t buf_size, size_t *bytes_read) { http_stream *s = (http_stream *)stream; http_subtransport *t = OWNING_SUBTRANSPORT(s); parser_context ctx; size_t bytes_parsed; replay: *bytes_read = 0; assert(t->connected); if (!s->sent_request) { git_buf request = GIT_BUF_INIT; clear_parser_state(t); if (gen_request(&request, s, 0) < 0) return -1; if (git_stream_write(t->io, request.ptr, request.size, 0) < 0) { git_buf_free(&request); return -1; } git_buf_free(&request); s->sent_request = 1; } if (!s->received_response) { if (s->chunked) { assert(s->verb == post_verb); /* Flush, if necessary */ if (s->chunk_buffer_len > 0 && write_chunk(t->io, s->chunk_buffer, s->chunk_buffer_len) < 0) return -1; s->chunk_buffer_len = 0; /* Write the final chunk. */ if (git_stream_write(t->io, ""0\r\n\r\n"", 5, 0) < 0) return -1; } s->received_response = 1; } while (!*bytes_read && !t->parse_finished) { size_t data_offset; int error; /* * Make the parse_buffer think it's as full of data as * the buffer, so it won't try to recv more data than * we can put into it. * * data_offset is the actual data offset from which we * should tell the parser to start reading. */ if (buf_size >= t->parse_buffer.len) { t->parse_buffer.offset = 0; } else { t->parse_buffer.offset = t->parse_buffer.len - buf_size; } data_offset = t->parse_buffer.offset; if (gitno_recv(&t->parse_buffer) < 0) return -1; /* This call to http_parser_execute will result in invocations of the * on_* family of callbacks. The most interesting of these is * on_body_fill_buffer, which is called when data is ready to be copied * into the target buffer. We need to marshal the buffer, buf_size, and * bytes_read parameters to this callback. */ ctx.t = t; ctx.s = s; ctx.buffer = buffer; ctx.buf_size = buf_size; ctx.bytes_read = bytes_read; /* Set the context, call the parser, then unset the context. */ t->parser.data = &ctx; bytes_parsed = http_parser_execute(&t->parser, &t->settings, t->parse_buffer.data + data_offset, t->parse_buffer.offset - data_offset); t->parser.data = NULL; /* If there was a handled authentication failure, then parse_error * will have signaled us that we should replay the request. */ if (PARSE_ERROR_REPLAY == t->parse_error) { s->sent_request = 0; if ((error = http_connect(t)) < 0) return error; goto replay; } if (t->parse_error == PARSE_ERROR_EXT) { return t->error; } if (t->parse_error < 0) return -1; if (bytes_parsed != t->parse_buffer.offset - data_offset) { giterr_set(GITERR_NET, ""HTTP parser error: %s"", http_errno_description((enum http_errno)t->parser.http_errno)); return -1; } } return 0; } ",0 "static void rsm_set_desc_flags(struct desc_struct *desc, u32 flags) { desc->g = (flags >> 23) & 1; desc->d = (flags >> 22) & 1; desc->l = (flags >> 21) & 1; desc->avl = (flags >> 20) & 1; desc->p = (flags >> 15) & 1; desc->dpl = (flags >> 13) & 3; desc->s = (flags >> 12) & 1; desc->type = (flags >> 8) & 15; } ",0 "static void limitedWithInvalidMissingDefaultAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; TestObjectV8Internal::limitedWithInvalidMissingDefaultAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " CompositorDependencies() : frame_sink_id_allocator(kDefaultClientId) { DCHECK_CURRENTLY_ON(BrowserThread::UI); bool enable_viz = base::FeatureList::IsEnabled(features::kVizDisplayCompositor); if (!enable_viz) { frame_sink_manager_impl = std::make_unique( /*shared_bitmap_manager=*/nullptr); surface_utils::ConnectWithLocalFrameSinkManager( &host_frame_sink_manager, frame_sink_manager_impl.get()); } else { CreateVizFrameSinkManager(); } } ",0 "static void unkeep_all_packs(void) { static char name[PATH_MAX]; int k; for (k = 0; k < pack_id; k++) { struct packed_git *p = all_packs[k]; snprintf(name, sizeof(name), ""%s/pack/pack-%s.keep"", get_object_directory(), sha1_to_hex(p->sha1)); unlink_or_warn(name); } } ",0 "static void ext4_dec_count(handle_t *handle, struct inode *inode) { if (!S_ISDIR(inode->i_mode) || inode->i_nlink > 2) drop_nlink(inode); } ",0 "static void kvm_cpu_vmxon(u64 addr) { intel_pt_handle_vmx(1); asm volatile (ASM_VMX_VMXON_RAX : : ""a""(&addr), ""m""(addr) : ""memory"", ""cc""); } ",0 "static int __init crypto_authenc_module_init(void) { return crypto_register_template(&crypto_authenc_tmpl); } ",0 " rtc::scoped_refptr certificate() { return certificate_; } ",0 "evdns_server_request_add_a_reply(struct evdns_server_request *req, const char *name, int n, const void *addrs, int ttl) { return evdns_server_request_add_reply( req, EVDNS_ANSWER_SECTION, name, TYPE_A, CLASS_INET, ttl, n*4, 0, addrs); } ",0 "static int xt_source_create(void) { if (++xt_source_count > 1 && xt_source != NULL) return 0; if ((xt_source = g_source_new(&xt_event_funcs, sizeof(GSource))) == NULL) { npw_printf(""ERROR: failed to initialize Xt events listener\n""); return -1; } g_source_set_priority(xt_source, GDK_PRIORITY_EVENTS); g_source_set_can_recurse(xt_source, TRUE); g_source_attach(xt_source, NULL); xt_event_poll_fd.fd = ConnectionNumber(x_display); xt_event_poll_fd.events = G_IO_IN; xt_event_poll_fd.revents = 0; g_source_add_poll(xt_source, &xt_event_poll_fd); return 0; } ",0 "ofputil_format_port(ofp_port_t port, struct ds *s) { char name[OFP_MAX_PORT_NAME_LEN]; ofputil_port_to_string(port, name, sizeof name); ds_put_cstr(s, name); } ",0 "bool Extension::LoadRequiredFeatures(string16* error) { if (!LoadName(error) || !LoadVersion(error)) return false; return true; } ",0 "Vector > Element::webkitGetRegionFlowRanges() const { document()->updateLayoutIgnorePendingStylesheets(); Vector > rangeObjects; if (RuntimeEnabledFeatures::cssRegionsEnabled() && renderer() && renderer()->isRenderRegion()) { RenderRegion* region = toRenderRegion(renderer()); if (region->isValid()) region->getRanges(rangeObjects); } return rangeObjects; } ",0 "json_lex(JsonLexContext *lex) { char *s; int len; /* Skip leading whitespace. */ s = lex->token_terminator; len = s - lex->input; while (len < lex->input_length && (*s == ' ' || *s == '\t' || *s == '\n' || *s == '\r')) { if (*s == '\n') ++lex->line_number; ++s; ++len; } lex->token_start = s; /* Determine token type. */ if (len >= lex->input_length) { lex->token_start = NULL; lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = s; lex->token_type = JSON_TOKEN_END; } else switch (*s) { /* Single-character token, some kind of punctuation mark. */ case '{': lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = s + 1; lex->token_type = JSON_TOKEN_OBJECT_START; break; case '}': lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = s + 1; lex->token_type = JSON_TOKEN_OBJECT_END; break; case '[': lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = s + 1; lex->token_type = JSON_TOKEN_ARRAY_START; break; case ']': lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = s + 1; lex->token_type = JSON_TOKEN_ARRAY_END; break; case ',': lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = s + 1; lex->token_type = JSON_TOKEN_COMMA; break; case ':': lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = s + 1; lex->token_type = JSON_TOKEN_COLON; break; case '""': /* string */ json_lex_string(lex); lex->token_type = JSON_TOKEN_STRING; break; case '-': /* Negative number. */ json_lex_number(lex, s + 1, NULL); lex->token_type = JSON_TOKEN_NUMBER; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': /* Positive number. */ json_lex_number(lex, s, NULL); lex->token_type = JSON_TOKEN_NUMBER; break; default: { char *p; /* * We're not dealing with a string, number, legal * punctuation mark, or end of string. The only legal * tokens we might find here are true, false, and null, * but for error reporting purposes we scan until we see a * non-alphanumeric character. That way, we can report * the whole word as an unexpected token, rather than just * some unintuitive prefix thereof. */ for (p = s; p - s < lex->input_length - len && JSON_ALPHANUMERIC_CHAR(*p); p++) /* skip */ ; /* * We got some sort of unexpected punctuation or an * otherwise unexpected character, so just complain about * that one character. */ if (p == s) { lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = s + 1; report_invalid_token(lex); } /* * We've got a real alphanumeric token here. If it * happens to be true, false, or null, all is well. If * not, error out. */ lex->prev_token_terminator = lex->token_terminator; lex->token_terminator = p; if (p - s == 4) { if (memcmp(s, ""true"", 4) == 0) lex->token_type = JSON_TOKEN_TRUE; else if (memcmp(s, ""null"", 4) == 0) lex->token_type = JSON_TOKEN_NULL; else report_invalid_token(lex); } else if (p - s == 5 && memcmp(s, ""false"", 5) == 0) lex->token_type = JSON_TOKEN_FALSE; else report_invalid_token(lex); } } /* end of switch */ } ",0 "void DownloadItemImpl::Delegate::Attach() { ++count_; } ",0 "static bool __in_atomic_pool(void *start, size_t size) { struct dma_pool *pool = &atomic_pool; void *end = start + size; void *pool_start = pool->vaddr; void *pool_end = pool->vaddr + pool->size; if (start < pool_start || start >= pool_end) return false; if (end <= pool_end) return true; WARN(1, ""Wrong coherent size(%p-%p) from atomic pool(%p-%p)\n"", start, end - 1, pool_start, pool_end - 1); return false; } ",0 "bool WebGraphicsContext3DCommandBufferImpl::makeContextCurrent() { if (!MaybeInitializeGL(NULL)) return false; gles2::SetGLContext(gl_); if (command_buffer_->GetLastError() != gpu::error::kNoError) return false; return true; } ",0 "MD5Final(md5byte digest[16], struct MD5Context *ctx) { int count = ctx->bytes[0] & 0x3f; /* Number of bytes in ctx->in */ md5byte *p = (md5byte *)ctx->in + count; /* Set the first char of padding to 0x80. There is always room. */ *p++ = 0x80; /* Bytes of padding needed to make 56 bytes (-8..55) */ count = 56 - 1 - count; if (count < 0) { /* Padding forces an extra block */ memset(p, 0, count + 8); byteSwap(ctx->in, 16); MD5Transform(ctx->buf, ctx->in); p = (md5byte *)ctx->in; count = 56; } memset(p, 0, count); byteSwap(ctx->in, 14); /* Append length in bits and transform */ ctx->in[14] = ctx->bytes[0] << 3; ctx->in[15] = ctx->bytes[1] << 3 | ctx->bytes[0] >> 29; MD5Transform(ctx->buf, ctx->in); byteSwap(ctx->buf, 4); memcpy(digest, ctx->buf, 16); memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } ",0 "bool smp_proc_ltk_request(const RawAddress& bda) { SMP_TRACE_DEBUG(""%s state = %d"", __func__, smp_cb.state); bool match = false; if (bda == smp_cb.pairing_bda) { match = true; } else { tBTM_SEC_DEV_REC* p_dev_rec = btm_find_dev(bda); if (p_dev_rec != NULL && p_dev_rec->ble.pseudo_addr == smp_cb.pairing_bda && p_dev_rec->ble.pseudo_addr != RawAddress::kEmpty) { match = true; } } if (match && smp_cb.state == SMP_STATE_ENCRYPTION_PENDING) { smp_sm_event(&smp_cb, SMP_ENC_REQ_EVT, NULL); return true; } return false; } ",0 "long FrameSequenceState_gif::drawFrame(int frameNr, Color8888* outputPtr, int outputPixelStride, int previousFrameNr) { GifFileType* gif = mFrameSequence.getGif(); if (!gif) { ALOGD(""Cannot drawFrame, mGif is NULL""); return -1; } #if GIF_DEBUG ALOGD("" drawFrame on %p nr %d on addr %p, previous frame nr %d"", this, frameNr, outputPtr, previousFrameNr); #endif const int height = mFrameSequence.getHeight(); const int width = mFrameSequence.getWidth(); GraphicsControlBlock gcb; int start = max(previousFrameNr + 1, 0); for (int i = max(start - 1, 0); i < frameNr; i++) { int neededPreservedFrame = mFrameSequence.getRestoringFrame(i); if (neededPreservedFrame >= 0 && (mPreserveBufferFrame != neededPreservedFrame)) { #if GIF_DEBUG ALOGD(""frame %d needs frame %d preserved, but %d is currently, so drawing from scratch"", i, neededPreservedFrame, mPreserveBufferFrame); #endif start = 0; } } for (int i = start; i <= frameNr; i++) { DGifSavedExtensionToGCB(gif, i, &gcb); const SavedImage& frame = gif->SavedImages[i]; #if GIF_DEBUG bool frameOpaque = gcb.TransparentColor == NO_TRANSPARENT_COLOR; ALOGD(""producing frame %d, drawing frame %d (opaque %d, disp %d, del %d)"", frameNr, i, frameOpaque, gcb.DisposalMode, gcb.DelayTime); #endif if (i == 0) { Color8888 bgColor = mFrameSequence.getBackgroundColor(); for (int y = 0; y < height; y++) { for (int x = 0; x < width; x++) { outputPtr[y * outputPixelStride + x] = bgColor; } } } else { GraphicsControlBlock prevGcb; DGifSavedExtensionToGCB(gif, i - 1, &prevGcb); const SavedImage& prevFrame = gif->SavedImages[i - 1]; bool prevFrameDisposed = willBeCleared(prevGcb); bool newFrameOpaque = gcb.TransparentColor == NO_TRANSPARENT_COLOR; bool prevFrameCompletelyCovered = newFrameOpaque && checkIfCover(frame.ImageDesc, prevFrame.ImageDesc); if (prevFrameDisposed && !prevFrameCompletelyCovered) { switch (prevGcb.DisposalMode) { case DISPOSE_BACKGROUND: { Color8888* dst = outputPtr + prevFrame.ImageDesc.Left + prevFrame.ImageDesc.Top * outputPixelStride; GifWord copyWidth, copyHeight; getCopySize(prevFrame.ImageDesc, width, height, copyWidth, copyHeight); for (; copyHeight > 0; copyHeight--) { setLineColor(dst, TRANSPARENT, copyWidth); dst += outputPixelStride; } } break; case DISPOSE_PREVIOUS: { restorePreserveBuffer(outputPtr, outputPixelStride); } break; } } if (mFrameSequence.getPreservedFrame(i - 1)) { savePreserveBuffer(outputPtr, outputPixelStride, i - 1); } } bool willBeCleared = gcb.DisposalMode == DISPOSE_BACKGROUND || gcb.DisposalMode == DISPOSE_PREVIOUS; if (i == frameNr || !willBeCleared) { const ColorMapObject* cmap = gif->SColorMap; if (frame.ImageDesc.ColorMap) { cmap = frame.ImageDesc.ColorMap; } if (cmap == NULL || cmap->ColorCount != (1 << cmap->BitsPerPixel)) { ALOGW(""Warning: potentially corrupt color map""); } const unsigned char* src = (unsigned char*)frame.RasterBits; Color8888* dst = outputPtr + frame.ImageDesc.Left + frame.ImageDesc.Top * outputPixelStride; GifWord copyWidth, copyHeight; getCopySize(frame.ImageDesc, width, height, copyWidth, copyHeight); for (; copyHeight > 0; copyHeight--) { copyLine(dst, src, cmap, gcb.TransparentColor, copyWidth); src += frame.ImageDesc.Width; dst += outputPixelStride; } } } const int maxFrame = gif->ImageCount; const int lastFrame = (frameNr + maxFrame - 1) % maxFrame; DGifSavedExtensionToGCB(gif, lastFrame, &gcb); return getDelayMs(gcb); } ",1 "long fuse_do_ioctl(struct file *file, unsigned int cmd, unsigned long arg, unsigned int flags) { struct fuse_file *ff = file->private_data; struct fuse_conn *fc = ff->fc; struct fuse_ioctl_in inarg = { .fh = ff->fh, .cmd = cmd, .arg = arg, .flags = flags }; struct fuse_ioctl_out outarg; struct fuse_req *req = NULL; struct page **pages = NULL; struct iovec *iov_page = NULL; struct iovec *in_iov = NULL, *out_iov = NULL; unsigned int in_iovs = 0, out_iovs = 0, num_pages = 0, max_pages; size_t in_size, out_size, transferred; int err; #if BITS_PER_LONG == 32 inarg.flags |= FUSE_IOCTL_32BIT; #else if (flags & FUSE_IOCTL_COMPAT) inarg.flags |= FUSE_IOCTL_32BIT; #endif /* assume all the iovs returned by client always fits in a page */ BUILD_BUG_ON(sizeof(struct fuse_ioctl_iovec) * FUSE_IOCTL_MAX_IOV > PAGE_SIZE); err = -ENOMEM; pages = kcalloc(FUSE_MAX_PAGES_PER_REQ, sizeof(pages[0]), GFP_KERNEL); iov_page = (struct iovec *) __get_free_page(GFP_KERNEL); if (!pages || !iov_page) goto out; /* * If restricted, initialize IO parameters as encoded in @cmd. * RETRY from server is not allowed. */ if (!(flags & FUSE_IOCTL_UNRESTRICTED)) { struct iovec *iov = iov_page; iov->iov_base = (void __user *)arg; iov->iov_len = _IOC_SIZE(cmd); if (_IOC_DIR(cmd) & _IOC_WRITE) { in_iov = iov; in_iovs = 1; } if (_IOC_DIR(cmd) & _IOC_READ) { out_iov = iov; out_iovs = 1; } } retry: inarg.in_size = in_size = iov_length(in_iov, in_iovs); inarg.out_size = out_size = iov_length(out_iov, out_iovs); /* * Out data can be used either for actual out data or iovs, * make sure there always is at least one page. */ out_size = max_t(size_t, out_size, PAGE_SIZE); max_pages = DIV_ROUND_UP(max(in_size, out_size), PAGE_SIZE); /* make sure there are enough buffer pages and init request with them */ err = -ENOMEM; if (max_pages > FUSE_MAX_PAGES_PER_REQ) goto out; while (num_pages < max_pages) { pages[num_pages] = alloc_page(GFP_KERNEL | __GFP_HIGHMEM); if (!pages[num_pages]) goto out; num_pages++; } req = fuse_get_req(fc, num_pages); if (IS_ERR(req)) { err = PTR_ERR(req); req = NULL; goto out; } memcpy(req->pages, pages, sizeof(req->pages[0]) * num_pages); req->num_pages = num_pages; fuse_page_descs_length_init(req, 0, req->num_pages); /* okay, let's send it to the client */ req->in.h.opcode = FUSE_IOCTL; req->in.h.nodeid = ff->nodeid; req->in.numargs = 1; req->in.args[0].size = sizeof(inarg); req->in.args[0].value = &inarg; if (in_size) { req->in.numargs++; req->in.args[1].size = in_size; req->in.argpages = 1; err = fuse_ioctl_copy_user(pages, in_iov, in_iovs, in_size, false); if (err) goto out; } req->out.numargs = 2; req->out.args[0].size = sizeof(outarg); req->out.args[0].value = &outarg; req->out.args[1].size = out_size; req->out.argpages = 1; req->out.argvar = 1; fuse_request_send(fc, req); err = req->out.h.error; transferred = req->out.args[1].size; fuse_put_request(fc, req); req = NULL; if (err) goto out; /* did it ask for retry? */ if (outarg.flags & FUSE_IOCTL_RETRY) { void *vaddr; /* no retry if in restricted mode */ err = -EIO; if (!(flags & FUSE_IOCTL_UNRESTRICTED)) goto out; in_iovs = outarg.in_iovs; out_iovs = outarg.out_iovs; /* * Make sure things are in boundary, separate checks * are to protect against overflow. */ err = -ENOMEM; if (in_iovs > FUSE_IOCTL_MAX_IOV || out_iovs > FUSE_IOCTL_MAX_IOV || in_iovs + out_iovs > FUSE_IOCTL_MAX_IOV) goto out; vaddr = kmap_atomic(pages[0]); err = fuse_copy_ioctl_iovec(fc, iov_page, vaddr, transferred, in_iovs + out_iovs, (flags & FUSE_IOCTL_COMPAT) != 0); kunmap_atomic(vaddr); if (err) goto out; in_iov = iov_page; out_iov = in_iov + in_iovs; err = fuse_verify_ioctl_iov(in_iov, in_iovs); if (err) goto out; err = fuse_verify_ioctl_iov(out_iov, out_iovs); if (err) goto out; goto retry; } err = -EIO; if (transferred > inarg.out_size) goto out; err = fuse_ioctl_copy_user(pages, out_iov, out_iovs, transferred, true); out: if (req) fuse_put_request(fc, req); free_page((unsigned long) iov_page); while (num_pages) __free_page(pages[--num_pages]); kfree(pages); return err ? err : outarg.result; } ",0 "static int set_user_msr(struct task_struct *task, unsigned long msr) { task->thread.regs->msr &= ~MSR_DEBUGCHANGE; task->thread.regs->msr |= msr & MSR_DEBUGCHANGE; return 0; } ",0 "bool WebMediaPlayerImpl::IsHidden() const { DCHECK(main_task_runner_->BelongsToCurrentThread()); return delegate_->IsFrameHidden() && !delegate_->IsFrameClosed(); } ",0 "static inline int check_sticky(struct inode *dir, struct inode *inode) { kuid_t fsuid = current_fsuid(); if (!(dir->i_mode & S_ISVTX)) return 0; if (uid_eq(inode->i_uid, fsuid)) return 0; if (uid_eq(dir->i_uid, fsuid)) return 0; return !inode_capable(inode, CAP_FOWNER); } ",1 "static uint16_t tsc210x_read(TSC210xState *s) { uint16_t ret = 0x0000; if (!s->command) fprintf(stderr, ""tsc210x_read: SPI underrun!\n""); switch (s->page) { case TSC_DATA_REGISTERS_PAGE: ret = tsc2102_data_register_read(s, s->offset); if (!s->dav) qemu_irq_raise(s->davint); break; case TSC_CONTROL_REGISTERS_PAGE: ret = tsc2102_control_register_read(s, s->offset); break; case TSC_AUDIO_REGISTERS_PAGE: ret = tsc2102_audio_register_read(s, s->offset); break; default: hw_error(""tsc210x_read: wrong memory page\n""); } tsc210x_pin_update(s); /* Allow sequential reads. */ s->offset ++; s->state = 0; return ret; } ",0 "void PermissionsRequestFunction::InstallUIProceed() { PermissionsUpdater perms_updater(profile()); perms_updater.AddPermissions(GetExtension(), requested_permissions_.get()); results_ = Request::Results::Create(true); SendResponse(true); Release(); // Balanced in RunImpl(). } ",0 "base::Thread* CreateInProcessGpuThreadForSynchronousCompositor( const InProcessChildThreadParams& params) { return g_factory.Get().CreateInProcessGpuThread(params); } ",0 "const GritResourceMap* GetKeyboardExtensionResources(size_t* size) { static const GritResourceMap kKeyboardResources[] = { {""keyboard/locales/en.js"", IDR_KEYBOARD_LOCALES_EN}, {""keyboard/config/m-emoji.js"", IDR_KEYBOARD_CONFIG_EMOJI}, {""keyboard/config/m-hwt.js"", IDR_KEYBOARD_CONFIG_HWT}, {""keyboard/config/us.js"", IDR_KEYBOARD_CONFIG_US}, {""keyboard/emoji.css"", IDR_KEYBOARD_CSS_EMOJI}, {""keyboard/images/backspace.png"", IDR_KEYBOARD_IMAGES_BACKSPACE}, {""keyboard/images/car.png"", IDR_KEYBOARD_IMAGES_CAR}, {""keyboard/images/check.png"", IDR_KEYBOARD_IMAGES_CHECK}, {""keyboard/images/compact.png"", IDR_KEYBOARD_IMAGES_COMPACT}, {""keyboard/images/down.png"", IDR_KEYBOARD_IMAGES_DOWN}, {""keyboard/images/emoji.png"", IDR_KEYBOARD_IMAGES_EMOJI}, {""keyboard/images/emoji_cat_items.png"", IDR_KEYBOARD_IMAGES_CAT}, {""keyboard/images/emoticon.png"", IDR_KEYBOARD_IMAGES_EMOTICON}, {""keyboard/images/enter.png"", IDR_KEYBOARD_IMAGES_RETURN}, {""keyboard/images/error.png"", IDR_KEYBOARD_IMAGES_ERROR}, {""keyboard/images/favorit.png"", IDR_KEYBOARD_IMAGES_FAVORITE}, {""keyboard/images/flower.png"", IDR_KEYBOARD_IMAGES_FLOWER}, {""keyboard/images/globe.png"", IDR_KEYBOARD_IMAGES_GLOBE}, {""keyboard/images/hide.png"", IDR_KEYBOARD_IMAGES_HIDE_KEYBOARD}, {""keyboard/images/keyboard.svg"", IDR_KEYBOARD_IMAGES_KEYBOARD}, {""keyboard/images/left.png"", IDR_KEYBOARD_IMAGES_LEFT}, {""keyboard/images/penci.png"", IDR_KEYBOARD_IMAGES_PENCIL}, {""keyboard/images/recent.png"", IDR_KEYBOARD_IMAGES_RECENT}, {""keyboard/images/regular_size.png"", IDR_KEYBOARD_IMAGES_FULLSIZE}, {""keyboard/images/menu.png"", IDR_KEYBOARD_IMAGES_MENU}, {""keyboard/images/pencil.png"", IDR_KEYBOARD_IMAGES_PENCIL}, {""keyboard/images/right.png"", IDR_KEYBOARD_IMAGES_RIGHT}, {""keyboard/images/search.png"", IDR_KEYBOARD_IMAGES_SEARCH}, {""keyboard/images/setting.png"", IDR_KEYBOARD_IMAGES_SETTINGS}, {""keyboard/images/shift.png"", IDR_KEYBOARD_IMAGES_SHIFT}, {""keyboard/images/space.png"", IDR_KEYBOARD_IMAGES_SPACE}, {""keyboard/images/tab.png"", IDR_KEYBOARD_IMAGES_TAB}, {""keyboard/images/triangle.png"", IDR_KEYBOARD_IMAGES_TRIANGLE}, {""keyboard/images/up.png"", IDR_KEYBOARD_IMAGES_UP}, {""keyboard/index.html"", IDR_KEYBOARD_INDEX}, {""keyboard/inputview_adapter.js"", IDR_KEYBOARD_INPUTVIEW_ADAPTER}, {""keyboard/inputview.css"", IDR_KEYBOARD_INPUTVIEW_CSS}, {""keyboard/inputview.js"", IDR_KEYBOARD_INPUTVIEW_JS}, {""keyboard/inputview_layouts/101kbd.js"", IDR_KEYBOARD_LAYOUTS_101}, {""keyboard/inputview_layouts/compactkbd-qwerty.js"", IDR_KEYBOARD_LAYOUTS_COMPACT_QWERTY}, {""keyboard/inputview_layouts/compactkbd-numberpad.js"", IDR_KEYBOARD_LAYOUTS_COMPACT_NUMBERPAD}, {""keyboard/inputview_layouts/emoji.js"", IDR_KEYBOARD_LAYOUTS_EMOJI}, {""keyboard/inputview_layouts/handwriting.js"", IDR_KEYBOARD_LAYOUTS_HWT}, {""keyboard/inputview_layouts/m-101kbd.js"", IDR_KEYBOARD_LAYOUTS_MATERIAL_101}, {""keyboard/inputview_layouts/m-compactkbd-qwerty.js"", IDR_KEYBOARD_LAYOUTS_MATERIAL_COMPACT_QWERTY}, {""keyboard/inputview_layouts/m-compactkbd-numberpad.js"", IDR_KEYBOARD_LAYOUTS_MATERIAL_COMPACT_NUMBERPAD}, {""keyboard/inputview_layouts/m-emoji.js"", IDR_KEYBOARD_LAYOUTS_MATERIAL_EMOJI}, {""keyboard/inputview_layouts/m-handwriting.js"", IDR_KEYBOARD_LAYOUTS_MATERIAL_HWT}, {""keyboard/manifest.json"", IDR_KEYBOARD_MANIFEST}, {""keyboard/sounds/keypress-delete.wav"", IDR_KEYBOARD_SOUNDS_KEYPRESS_DELETE}, {""keyboard/sounds/keypress-return.wav"", IDR_KEYBOARD_SOUNDS_KEYPRESS_RETURN}, {""keyboard/sounds/keypress-spacebar.wav"", IDR_KEYBOARD_SOUNDS_KEYPRESS_SPACEBAR}, {""keyboard/sounds/keypress-standard.wav"", IDR_KEYBOARD_SOUNDS_KEYPRESS_STANDARD}, }; static const size_t kKeyboardResourcesSize = arraysize(kKeyboardResources); *size = kKeyboardResourcesSize; return kKeyboardResources; } ",0 "void SimplifiedBackwardsTextIterator::emitCharacter(UChar c, Node* node, int startOffset, int endOffset) { m_singleCharacterBuffer = c; m_positionNode = node; m_positionStartOffset = startOffset; m_positionEndOffset = endOffset; m_textCharacters = &m_singleCharacterBuffer; m_textLength = 1; m_lastCharacter = c; } ",0 "static void __account_cfs_rq_runtime(struct cfs_rq *cfs_rq, u64 delta_exec) { /* dock delta_exec before expiring quota (as it could span periods) */ cfs_rq->runtime_remaining -= delta_exec; expire_cfs_rq_runtime(cfs_rq); if (likely(cfs_rq->runtime_remaining > 0)) return; /* * if we're unable to extend our runtime we resched so that the active * hierarchy can be throttled */ if (!assign_cfs_rq_runtime(cfs_rq) && likely(cfs_rq->curr)) resched_curr(rq_of(cfs_rq)); } ",0 "static int hns_nic_uc_sync(struct net_device *netdev, const unsigned char *addr) { struct hns_nic_priv *priv = netdev_priv(netdev); struct hnae_handle *h = priv->ae_handle; if (h->dev->ops->add_uc_addr) return h->dev->ops->add_uc_addr(h, addr); return 0; } ",0 "void dtls1_free(SSL *s) { ssl3_free(s); dtls1_clear_queues(s); pqueue_free(s->d1->unprocessed_rcds.q); pqueue_free(s->d1->processed_rcds.q); pqueue_free(s->d1->buffered_messages); pqueue_free(s->d1->sent_messages); pqueue_free(s->d1->buffered_app_data.q); OPENSSL_free(s->d1); s->d1 = NULL; } ",0 "static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) { /* OBJECTS_FIXME */ zval *ent, fname, *varname; zval retval; zend_string *key; zend_ulong idx; char tmp_buf[WDDX_BUF_LEN]; HashTable *objhash, *sleephash; zend_class_entry *ce; PHP_CLASS_ATTRIBUTES; PHP_SET_CLASS_ATTRIBUTES(obj); ce = Z_OBJCE_P(obj); if (!ce || ce->serialize || ce->unserialize) { php_error_docref(NULL, E_WARNING, ""Class %s can not be serialized"", ZSTR_VAL(class_name)); PHP_CLEANUP_CLASS_ATTRIBUTES(); return; } ZVAL_STRING(&fname, ""__sleep""); /* * We try to call __sleep() method on object. It's supposed to return an * array of property names to be serialized. */ if (call_user_function_ex(CG(function_table), obj, &fname, &retval, 0, 0, 1, NULL) == SUCCESS) { if (!Z_ISUNDEF(retval) && (sleephash = HASH_OF(&retval))) { PHP_CLASS_ATTRIBUTES; PHP_SET_CLASS_ATTRIBUTES(obj); php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR); php_wddx_add_chunk(packet, tmp_buf); php_wddx_add_chunk_static(packet, WDDX_STRING_S); php_wddx_add_chunk_ex(packet, ZSTR_VAL(class_name), ZSTR_LEN(class_name)); php_wddx_add_chunk_static(packet, WDDX_STRING_E); php_wddx_add_chunk_static(packet, WDDX_VAR_E); objhash = Z_OBJPROP_P(obj); ZEND_HASH_FOREACH_VAL(sleephash, varname) { if (Z_TYPE_P(varname) != IS_STRING) { php_error_docref(NULL, E_NOTICE, ""__sleep should return an array only containing the names of instance-variables to serialize.""); continue; } if ((ent = zend_hash_find(objhash, Z_STR_P(varname))) != NULL) { php_wddx_serialize_var(packet, ent, Z_STR_P(varname)); } } ZEND_HASH_FOREACH_END(); php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); } } else { php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR); php_wddx_add_chunk(packet, tmp_buf); php_wddx_add_chunk_static(packet, WDDX_STRING_S); php_wddx_add_chunk_ex(packet, ZSTR_VAL(class_name), ZSTR_LEN(class_name)); php_wddx_add_chunk_static(packet, WDDX_STRING_E); php_wddx_add_chunk_static(packet, WDDX_VAR_E); objhash = Z_OBJPROP_P(obj); ZEND_HASH_FOREACH_KEY_VAL(objhash, idx, key, ent) { if (ent == obj) { continue; } if (key) { const char *class_name, *prop_name; size_t prop_name_len; zend_string *tmp; zend_unmangle_property_name_ex(key, &class_name, &prop_name, &prop_name_len); tmp = zend_string_init(prop_name, prop_name_len, 0); php_wddx_serialize_var(packet, ent, tmp); zend_string_release(tmp); } else { key = zend_long_to_str(idx); php_wddx_serialize_var(packet, ent, key); zend_string_release(key); } } ZEND_HASH_FOREACH_END(); php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); } PHP_CLEANUP_CLASS_ATTRIBUTES(); zval_ptr_dtor(&fname); zval_ptr_dtor(&retval); } ",0 "ReadableStream::ReadableStream(UnderlyingSource* source) : m_source(source) , m_isStarted(false) , m_isDraining(false) , m_isPulling(false) , m_isDisturbed(false) , m_state(Readable) { } ",0 "write_xml_fd(xmlNode * xml_node, const char *filename, int fd, gboolean compress) { FILE *stream = NULL; CRM_CHECK(fd > 0, return -1); stream = fdopen(fd, ""w""); return write_xml_stream(xml_node, filename, stream, compress); } ",0 " bool PaintWithoutCommit(GraphicsLayer& layer, const IntRect* interest_rect) { return layer.PaintWithoutCommit(interest_rect); } ",0 "void V8TestObject::SerializedScriptValueMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_serializedScriptValueMethod""); test_object_v8_internal::SerializedScriptValueMethodMethod(info); } ",0 "bool Resource::CanUseCacheValidator() const { if (IsLoading() || ErrorOccurred()) return false; if (HasCacheControlNoStoreHeader()) return false; if (!RedirectChain().IsEmpty()) return false; return GetResponse().HasCacheValidatorFields() || GetResourceRequest().HasCacheValidatorFields(); } ",0 "calc_image_size(struct file *file) /* Fill in the image_bytes field given the IHDR information, calls stop on * error. */ { png_uint_16 pd = file->bit_depth; switch (file->color_type) { default: stop_invalid(file, ""IHDR: colour type""); invalid_bit_depth: stop_invalid(file, ""IHDR: bit depth""); case 0: /* g */ if (pd != 1 && pd != 2 && pd != 4 && pd != 8 && pd != 16) goto invalid_bit_depth; break; case 3: if (pd != 1 && pd != 2 && pd != 4 && pd != 8) goto invalid_bit_depth; break; case 2: /* rgb */ if (pd != 8 && pd != 16) goto invalid_bit_depth; pd = (png_uint_16)(pd * 3); break; case 4: /* ga */ if (pd != 8 && pd != 16) goto invalid_bit_depth; pd = (png_uint_16)(pd * 2); break; case 6: /* rgba */ if (pd != 8 && pd != 16) goto invalid_bit_depth; pd = (png_uint_16)(pd * 4); break; } if (file->width < 1 || file->width > 0x7fffffff) stop_invalid(file, ""IHDR: width""); else if (file->height < 1 || file->height > 0x7fffffff) stop_invalid(file, ""IHDR: height""); else if (file->compression_method != 0) stop_invalid(file, ""IHDR: compression method""); else if (file->filter_method != 0) stop_invalid(file, ""IHDR: filter method""); else switch (file->interlace_method) { case PNG_INTERLACE_ADAM7: /* Interlacing makes the image larger because of the replication of * both the filter byte and the padding to a byte boundary. */ { int pass; int image_digits = 0; udigit row_width[2], row_bytes[3]; for (pass=0; pass<=6; ++pass) { png_uint_32 pw = PNG_PASS_COLS(file->width, pass); if (pw > 0) { int digits; /* calculate 1+((pw*pd+7)>>3) in row_bytes */ digits = uarb_mult_digit(row_bytes, uarb_set(row_bytes, 7), row_width, uarb_set(row_width, pw), pd); digits = uarb_shift(row_bytes, digits, 3); digits = uarb_inc(row_bytes, digits, 1); /* Add row_bytes * pass-height to the file image_bytes field */ image_digits = uarb_mult32(file->image_bytes, image_digits, row_bytes, digits, PNG_PASS_ROWS(file->height, pass)); } } file->image_digits = image_digits; } break; case PNG_INTERLACE_NONE: { int digits; udigit row_width[2], row_bytes[3]; /* As above, but use image_width in place of the pass width: */ digits = uarb_mult_digit(row_bytes, uarb_set(row_bytes, 7), row_width, uarb_set(row_width, file->width), pd); digits = uarb_shift(row_bytes, digits, 3); digits = uarb_inc(row_bytes, digits, 1); /* Set row_bytes * image-height to the file image_bytes field */ file->image_digits = uarb_mult32(file->image_bytes, 0, row_bytes, digits, file->height); } break; default: stop_invalid(file, ""IHDR: interlace method""); } assert(file->image_digits >= 1 && file->image_digits <= 5); return 1; } ",0 " RelayCreateDirectory( const FilePath& file_path, bool exclusive, bool recursive, base::FileUtilProxy::StatusCallback* callback) : RelayWithStatusCallback(callback), file_path_(file_path), exclusive_(exclusive), recursive_(recursive) { } ",0 "InternalPageInfoPopupView::~InternalPageInfoPopupView() { } ",0 "static BROTLI_INLINE int SafeReadCommand(BrotliState* s, BrotliBitReader* br, int* insert_length) { return ReadCommandInternal(1, s, br, insert_length); } ",0 "PHP_FUNCTION(imagegrabwindow) { HWND window; long client_area = 0; RECT rc = {0}; RECT rc_win = {0}; int Width, Height; HDC hdc; HDC memDC; HBITMAP memBM; HBITMAP hOld; HINSTANCE handle; long lwindow_handle; typedef BOOL (WINAPI *tPrintWindow)(HWND, HDC,UINT); tPrintWindow pPrintWindow = 0; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""l|l"", &lwindow_handle, &client_area) == FAILURE) { RETURN_FALSE; } window = (HWND) lwindow_handle; if (!IsWindow(window)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid window handle""); RETURN_FALSE; } hdc = GetDC(0); if (client_area) { GetClientRect(window, &rc); Width = rc.right; Height = rc.bottom; } else { GetWindowRect(window, &rc); Width = rc.right - rc.left; Height = rc.bottom - rc.top; } Width = (Width/4)*4; memDC = CreateCompatibleDC(hdc); memBM = CreateCompatibleBitmap(hdc, Width, Height); hOld = (HBITMAP) SelectObject (memDC, memBM); handle = LoadLibrary(""User32.dll""); if ( handle == 0 ) { goto clean; } pPrintWindow = (tPrintWindow) GetProcAddress(handle, ""PrintWindow""); if ( pPrintWindow ) { pPrintWindow(window, memDC, (UINT) client_area); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Windows API too old""); goto clean; } FreeLibrary(handle); im = gdImageCreateTrueColor(Width, Height); if (im) { int x,y; for (y=0; y <= Height; y++) { for (x=0; x <= Width; x++) { int c = GetPixel(memDC, x,y); gdImageSetPixel(im, x, y, gdTrueColor(GetRValue(c), GetGValue(c), GetBValue(c))); } } } clean: SelectObject(memDC,hOld); DeleteObject(memBM); DeleteDC(memDC); ReleaseDC( 0, hdc ); if (!im) { RETURN_FALSE; } else { ZEND_REGISTER_RESOURCE(return_value, im, le_gd); } } ",0 "static noinline int mmc_ioctl_cdrom_last_written(struct cdrom_device_info *cdi, void __user *arg) { int ret; long last = 0; cd_dbg(CD_DO_IOCTL, ""entering CDROM_LAST_WRITTEN\n""); ret = cdrom_get_last_written(cdi, &last); if (ret) return ret; if (copy_to_user((long __user *)arg, &last, sizeof(last))) return -EFAULT; return 0; } ",0 " InfoBarService* infobar_service() { return InfoBarService::FromWebContents(web_contents()); } ",0 "void InspectorResourceAgent::didCommitLoad(LocalFrame* frame, DocumentLoader* loader) { if (loader->frame() != frame->page()->mainFrame()) return; if (m_state->getBoolean(ResourceAgentState::cacheDisabled)) memoryCache()->evictResources(); m_resourcesData->clear(m_pageAgent->loaderId(loader)); } ",0 "bool AXObject::isInertOrAriaHidden() const { updateCachedAttributeValuesIfNeeded(); return m_cachedIsInertOrAriaHidden; } ",0 "Color FrameView::baseBackgroundColor() const { return m_baseBackgroundColor; } ",0 " void ForeignSessionHelper::TriggerSessionSync( JNIEnv* env, const JavaParamRef& obj) { browser_sync::ProfileSyncService* service = ProfileSyncServiceFactory::GetInstance()->GetForProfile(profile_); if (!service) return; const syncer::ModelTypeSet types(syncer::SESSIONS); service->TriggerRefresh(types); } ",1 "static int vfio_pci_set_intx_trigger(struct vfio_pci_device *vdev, unsigned index, unsigned start, unsigned count, uint32_t flags, void *data) { if (is_intx(vdev) && !count && (flags & VFIO_IRQ_SET_DATA_NONE)) { vfio_intx_disable(vdev); return 0; } if (!(is_intx(vdev) || is_irq_none(vdev)) || start != 0 || count != 1) return -EINVAL; if (flags & VFIO_IRQ_SET_DATA_EVENTFD) { int32_t fd = *(int32_t *)data; int ret; if (is_intx(vdev)) return vfio_intx_set_signal(vdev, fd); ret = vfio_intx_enable(vdev); if (ret) return ret; ret = vfio_intx_set_signal(vdev, fd); if (ret) vfio_intx_disable(vdev); return ret; } if (!is_intx(vdev)) return -EINVAL; if (flags & VFIO_IRQ_SET_DATA_NONE) { vfio_send_intx_eventfd(vdev, NULL); } else if (flags & VFIO_IRQ_SET_DATA_BOOL) { uint8_t trigger = *(uint8_t *)data; if (trigger) vfio_send_intx_eventfd(vdev, NULL); } return 0; } ",0 "SPL_METHOD(Array, offsetSet) { zval *index, *value; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""zz"", &index, &value) == FAILURE) { return; } spl_array_write_dimension_ex(0, getThis(), index, value TSRMLS_CC); } /* }}} */ void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{{ */ ",0 "static char * RIL_getRilSocketName() { return rild; } ",0 "static void vmsvga_index_write(void *opaque, uint32_t address, uint32_t index) { struct vmsvga_state_s *s = opaque; s->index = index; } ",0 "ModuleExport void UnregisterPSImage(void) { (void) UnregisterMagickInfo(""EPI""); (void) UnregisterMagickInfo(""EPS""); (void) UnregisterMagickInfo(""EPSF""); (void) UnregisterMagickInfo(""EPSI""); (void) UnregisterMagickInfo(""PS""); } ",0 "int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t displayId, int32_t injectorPid, int32_t injectorUid, int32_t syncMode, int32_t timeoutMillis, uint32_t policyFlags) { #if DEBUG_INBOUND_EVENT_DETAILS ALOGD(""injectInputEvent - eventType=%d, injectorPid=%d, injectorUid=%d, "" ""syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x"", event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags); #endif nsecs_t endTime = now() + milliseconds_to_nanoseconds(timeoutMillis); policyFlags |= POLICY_FLAG_INJECTED; if (hasInjectionPermission(injectorPid, injectorUid)) { policyFlags |= POLICY_FLAG_TRUSTED; } EventEntry* firstInjectedEntry; EventEntry* lastInjectedEntry; switch (event->getType()) { case AINPUT_EVENT_TYPE_KEY: { const KeyEvent* keyEvent = static_cast(event); int32_t action = keyEvent->getAction(); if (! validateKeyEvent(action)) { return INPUT_EVENT_INJECTION_FAILED; } int32_t flags = keyEvent->getFlags(); if (flags & AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY) { policyFlags |= POLICY_FLAG_VIRTUAL; } if (!(policyFlags & POLICY_FLAG_FILTERED)) { mPolicy->interceptKeyBeforeQueueing(keyEvent, /*byref*/ policyFlags); } mLock.lock(); firstInjectedEntry = new KeyEntry(keyEvent->getEventTime(), keyEvent->getDeviceId(), keyEvent->getSource(), policyFlags, action, flags, keyEvent->getKeyCode(), keyEvent->getScanCode(), keyEvent->getMetaState(), keyEvent->getRepeatCount(), keyEvent->getDownTime()); lastInjectedEntry = firstInjectedEntry; break; } case AINPUT_EVENT_TYPE_MOTION: { const MotionEvent* motionEvent = static_cast(event); int32_t action = motionEvent->getAction(); size_t pointerCount = motionEvent->getPointerCount(); const PointerProperties* pointerProperties = motionEvent->getPointerProperties(); int32_t actionButton = motionEvent->getActionButton(); if (! validateMotionEvent(action, actionButton, pointerCount, pointerProperties)) { return INPUT_EVENT_INJECTION_FAILED; } if (!(policyFlags & POLICY_FLAG_FILTERED)) { nsecs_t eventTime = motionEvent->getEventTime(); mPolicy->interceptMotionBeforeQueueing(eventTime, /*byref*/ policyFlags); } mLock.lock(); const nsecs_t* sampleEventTimes = motionEvent->getSampleEventTimes(); const PointerCoords* samplePointerCoords = motionEvent->getSamplePointerCoords(); firstInjectedEntry = new MotionEntry(*sampleEventTimes, motionEvent->getDeviceId(), motionEvent->getSource(), policyFlags, action, actionButton, motionEvent->getFlags(), motionEvent->getMetaState(), motionEvent->getButtonState(), motionEvent->getEdgeFlags(), motionEvent->getXPrecision(), motionEvent->getYPrecision(), motionEvent->getDownTime(), displayId, uint32_t(pointerCount), pointerProperties, samplePointerCoords, motionEvent->getXOffset(), motionEvent->getYOffset()); lastInjectedEntry = firstInjectedEntry; for (size_t i = motionEvent->getHistorySize(); i > 0; i--) { sampleEventTimes += 1; samplePointerCoords += pointerCount; MotionEntry* nextInjectedEntry = new MotionEntry(*sampleEventTimes, motionEvent->getDeviceId(), motionEvent->getSource(), policyFlags, action, actionButton, motionEvent->getFlags(), motionEvent->getMetaState(), motionEvent->getButtonState(), motionEvent->getEdgeFlags(), motionEvent->getXPrecision(), motionEvent->getYPrecision(), motionEvent->getDownTime(), displayId, uint32_t(pointerCount), pointerProperties, samplePointerCoords, motionEvent->getXOffset(), motionEvent->getYOffset()); lastInjectedEntry->next = nextInjectedEntry; lastInjectedEntry = nextInjectedEntry; } break; } default: ALOGW(""Cannot inject event of type %d"", event->getType()); return INPUT_EVENT_INJECTION_FAILED; } InjectionState* injectionState = new InjectionState(injectorPid, injectorUid); if (syncMode == INPUT_EVENT_INJECTION_SYNC_NONE) { injectionState->injectionIsAsync = true; } injectionState->refCount += 1; lastInjectedEntry->injectionState = injectionState; bool needWake = false; for (EventEntry* entry = firstInjectedEntry; entry != NULL; ) { EventEntry* nextEntry = entry->next; needWake |= enqueueInboundEventLocked(entry); entry = nextEntry; } mLock.unlock(); if (needWake) { mLooper->wake(); } int32_t injectionResult; { // acquire lock AutoMutex _l(mLock); if (syncMode == INPUT_EVENT_INJECTION_SYNC_NONE) { injectionResult = INPUT_EVENT_INJECTION_SUCCEEDED; } else { for (;;) { injectionResult = injectionState->injectionResult; if (injectionResult != INPUT_EVENT_INJECTION_PENDING) { break; } nsecs_t remainingTimeout = endTime - now(); if (remainingTimeout <= 0) { #if DEBUG_INJECTION ALOGD(""injectInputEvent - Timed out waiting for injection result "" ""to become available.""); #endif injectionResult = INPUT_EVENT_INJECTION_TIMED_OUT; break; } mInjectionResultAvailableCondition.waitRelative(mLock, remainingTimeout); } if (injectionResult == INPUT_EVENT_INJECTION_SUCCEEDED && syncMode == INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISHED) { while (injectionState->pendingForegroundDispatches != 0) { #if DEBUG_INJECTION ALOGD(""injectInputEvent - Waiting for %d pending foreground dispatches."", injectionState->pendingForegroundDispatches); #endif nsecs_t remainingTimeout = endTime - now(); if (remainingTimeout <= 0) { #if DEBUG_INJECTION ALOGD(""injectInputEvent - Timed out waiting for pending foreground "" ""dispatches to finish.""); #endif injectionResult = INPUT_EVENT_INJECTION_TIMED_OUT; break; } mInjectionSyncFinishedCondition.waitRelative(mLock, remainingTimeout); } } } injectionState->release(); } // release lock #if DEBUG_INJECTION ALOGD(""injectInputEvent - Finished with result %d. "" ""injectorPid=%d, injectorUid=%d"", injectionResult, injectorPid, injectorUid); #endif return injectionResult; } ",0 "cmsStage* ReadCLUT(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number Offset, int InputChannels, int OutputChannels) { cmsUInt8Number gridPoints8[cmsMAXCHANNELS]; // Number of grid points in each dimension. cmsUInt32Number GridPoints[cmsMAXCHANNELS], i; cmsUInt8Number Precision; cmsStage* CLUT; _cmsStageCLutData* Data; if (!io -> Seek(io, Offset)) return NULL; if (io -> Read(io, gridPoints8, cmsMAXCHANNELS, 1) != 1) return NULL; for (i=0; i < cmsMAXCHANNELS; i++) { if (gridPoints8[i] == 1) return NULL; // Impossible value, 0 for no CLUT and then 2 at least GridPoints[i] = gridPoints8[i]; } if (!_cmsReadUInt8Number(io, &Precision)) return NULL; if (!_cmsReadUInt8Number(io, NULL)) return NULL; if (!_cmsReadUInt8Number(io, NULL)) return NULL; if (!_cmsReadUInt8Number(io, NULL)) return NULL; CLUT = cmsStageAllocCLut16bitGranular(self ->ContextID, GridPoints, InputChannels, OutputChannels, NULL); if (CLUT == NULL) return NULL; Data = (_cmsStageCLutData*) CLUT ->Data; if (Precision == 1) { cmsUInt8Number v; for (i=0; i < Data ->nEntries; i++) { if (io ->Read(io, &v, sizeof(cmsUInt8Number), 1) != 1) return NULL; Data ->Tab.T[i] = FROM_8_TO_16(v); } } else if (Precision == 2) { if (!_cmsReadUInt16Array(io, Data->nEntries, Data ->Tab.T)) { cmsStageFree(CLUT); return NULL; } } else { cmsStageFree(CLUT); cmsSignalError(self ->ContextID, cmsERROR_UNKNOWN_EXTENSION, ""Unknown precision of '%d'"", Precision); return NULL; } return CLUT; } ",0 "start_xmit (struct sk_buff *skb, struct net_device *dev) { struct netdev_private *np = netdev_priv(dev); struct netdev_desc *txdesc; unsigned entry; u32 ioaddr; u64 tfc_vlan_tag = 0; if (np->link_status == 0) { /* Link Down */ dev_kfree_skb(skb); return NETDEV_TX_OK; } ioaddr = dev->base_addr; entry = np->cur_tx % TX_RING_SIZE; np->tx_skbuff[entry] = skb; txdesc = &np->tx_ring[entry]; #if 0 if (skb->ip_summed == CHECKSUM_PARTIAL) { txdesc->status |= cpu_to_le64 (TCPChecksumEnable | UDPChecksumEnable | IPChecksumEnable); } #endif if (np->vlan) { tfc_vlan_tag = VLANTagInsert | ((u64)np->vlan << 32) | ((u64)skb->priority << 45); } txdesc->fraginfo = cpu_to_le64 (pci_map_single (np->pdev, skb->data, skb->len, PCI_DMA_TODEVICE)); txdesc->fraginfo |= cpu_to_le64((u64)skb->len << 48); /* DL2K bug: DMA fails to get next descriptor ptr in 10Mbps mode * Work around: Always use 1 descriptor in 10Mbps mode */ if (entry % np->tx_coalesce == 0 || np->speed == 10) txdesc->status = cpu_to_le64 (entry | tfc_vlan_tag | WordAlignDisable | TxDMAIndicate | (1 << FragCountShift)); else txdesc->status = cpu_to_le64 (entry | tfc_vlan_tag | WordAlignDisable | (1 << FragCountShift)); /* TxDMAPollNow */ writel (readl (ioaddr + DMACtrl) | 0x00001000, ioaddr + DMACtrl); /* Schedule ISR */ writel(10000, ioaddr + CountDown); np->cur_tx = (np->cur_tx + 1) % TX_RING_SIZE; if ((np->cur_tx - np->old_tx + TX_RING_SIZE) % TX_RING_SIZE < TX_QUEUE_LEN - 1 && np->speed != 10) { /* do nothing */ } else if (!netif_queue_stopped(dev)) { netif_stop_queue (dev); } /* The first TFDListPtr */ if (readl (dev->base_addr + TFDListPtr0) == 0) { writel (np->tx_ring_dma + entry * sizeof (struct netdev_desc), dev->base_addr + TFDListPtr0); writel (0, dev->base_addr + TFDListPtr1); } return NETDEV_TX_OK; } ",0 "static void nested_vmx_entry_failure(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12, u32 reason, unsigned long qualification) { load_vmcs12_host_state(vcpu, vmcs12); vmcs12->vm_exit_reason = reason | VMX_EXIT_REASONS_FAILED_VMENTRY; vmcs12->exit_qualification = qualification; nested_vmx_succeed(vcpu); if (enable_shadow_vmcs) to_vmx(vcpu)->nested.sync_shadow_vmcs = true; } ",0 "InputDispatcher::InjectionState::~InjectionState() { } ",0 " void CacheFavIcon() { CacheUrl(embedded_test_server()->GetURL(""/favicon.ico"")); } ",0 "ProcessInfoObserver::ProcessInfoObserver( AutomationProvider* automation, IPC::Message* reply_message) : automation_(automation->AsWeakPtr()), reply_message_(reply_message) {} ",0 "void ProfileSyncService::UpdateLastSyncedTime() { last_synced_time_ = base::Time::Now(); sync_prefs_.SetLastSyncedTime(last_synced_time_); } ",0 "static int emulator_check_pmc(struct x86_emulate_ctxt *ctxt, u32 pmc) { return kvm_pmu_check_pmc(emul_to_vcpu(ctxt), pmc); } ",0 "void HTMLMediaElement::ActivateViewportIntersectionMonitoring(bool activate) { if (activate && !check_viewport_intersection_timer_.IsActive()) { check_viewport_intersection_timer_.StartRepeating( kCheckViewportIntersectionInterval, FROM_HERE); } else if (!activate) { check_viewport_intersection_timer_.Stop(); } } ",0 "static bool vnc_has_job_locked(VncState *vs) { VncJob *job; QTAILQ_FOREACH(job, &queue->jobs, next) { if (job->vs == vs || !vs) { return true; } } return false; } ",0 "void WebProcessProxy::addMessageReceiver(CoreIPC::StringReference messageReceiverName, CoreIPC::MessageReceiver* messageReceiver) { m_messageReceiverMap.addMessageReceiver(messageReceiverName, messageReceiver); } ",0 "mwifiex_uap_bss_param_prepare(u8 *tlv, void *cmd_buf, u16 *param_size) { struct host_cmd_tlv_dtim_period *dtim_period; struct host_cmd_tlv_beacon_period *beacon_period; struct host_cmd_tlv_ssid *ssid; struct host_cmd_tlv_bcast_ssid *bcast_ssid; struct host_cmd_tlv_channel_band *chan_band; struct host_cmd_tlv_frag_threshold *frag_threshold; struct host_cmd_tlv_rts_threshold *rts_threshold; struct host_cmd_tlv_retry_limit *retry_limit; struct host_cmd_tlv_encrypt_protocol *encrypt_protocol; struct host_cmd_tlv_auth_type *auth_type; struct host_cmd_tlv_rates *tlv_rates; struct host_cmd_tlv_ageout_timer *ao_timer, *ps_ao_timer; struct host_cmd_tlv_power_constraint *pwr_ct; struct mwifiex_ie_types_htcap *htcap; struct mwifiex_ie_types_wmmcap *wmm_cap; struct mwifiex_uap_bss_param *bss_cfg = cmd_buf; int i; u16 cmd_size = *param_size; if (bss_cfg->ssid.ssid_len) { ssid = (struct host_cmd_tlv_ssid *)tlv; ssid->header.type = cpu_to_le16(TLV_TYPE_UAP_SSID); ssid->header.len = cpu_to_le16((u16)bss_cfg->ssid.ssid_len); memcpy(ssid->ssid, bss_cfg->ssid.ssid, bss_cfg->ssid.ssid_len); cmd_size += sizeof(struct mwifiex_ie_types_header) + bss_cfg->ssid.ssid_len; tlv += sizeof(struct mwifiex_ie_types_header) + bss_cfg->ssid.ssid_len; bcast_ssid = (struct host_cmd_tlv_bcast_ssid *)tlv; bcast_ssid->header.type = cpu_to_le16(TLV_TYPE_UAP_BCAST_SSID); bcast_ssid->header.len = cpu_to_le16(sizeof(bcast_ssid->bcast_ctl)); bcast_ssid->bcast_ctl = bss_cfg->bcast_ssid_ctl; cmd_size += sizeof(struct host_cmd_tlv_bcast_ssid); tlv += sizeof(struct host_cmd_tlv_bcast_ssid); } if (bss_cfg->rates[0]) { tlv_rates = (struct host_cmd_tlv_rates *)tlv; tlv_rates->header.type = cpu_to_le16(TLV_TYPE_UAP_RATES); for (i = 0; i < MWIFIEX_SUPPORTED_RATES && bss_cfg->rates[i]; i++) tlv_rates->rates[i] = bss_cfg->rates[i]; tlv_rates->header.len = cpu_to_le16(i); cmd_size += sizeof(struct host_cmd_tlv_rates) + i; tlv += sizeof(struct host_cmd_tlv_rates) + i; } if (bss_cfg->channel && (((bss_cfg->band_cfg & BIT(0)) == BAND_CONFIG_BG && bss_cfg->channel <= MAX_CHANNEL_BAND_BG) || ((bss_cfg->band_cfg & BIT(0)) == BAND_CONFIG_A && bss_cfg->channel <= MAX_CHANNEL_BAND_A))) { chan_band = (struct host_cmd_tlv_channel_band *)tlv; chan_band->header.type = cpu_to_le16(TLV_TYPE_CHANNELBANDLIST); chan_band->header.len = cpu_to_le16(sizeof(struct host_cmd_tlv_channel_band) - sizeof(struct mwifiex_ie_types_header)); chan_band->band_config = bss_cfg->band_cfg; chan_band->channel = bss_cfg->channel; cmd_size += sizeof(struct host_cmd_tlv_channel_band); tlv += sizeof(struct host_cmd_tlv_channel_band); } if (bss_cfg->beacon_period >= MIN_BEACON_PERIOD && bss_cfg->beacon_period <= MAX_BEACON_PERIOD) { beacon_period = (struct host_cmd_tlv_beacon_period *)tlv; beacon_period->header.type = cpu_to_le16(TLV_TYPE_UAP_BEACON_PERIOD); beacon_period->header.len = cpu_to_le16(sizeof(struct host_cmd_tlv_beacon_period) - sizeof(struct mwifiex_ie_types_header)); beacon_period->period = cpu_to_le16(bss_cfg->beacon_period); cmd_size += sizeof(struct host_cmd_tlv_beacon_period); tlv += sizeof(struct host_cmd_tlv_beacon_period); } if (bss_cfg->dtim_period >= MIN_DTIM_PERIOD && bss_cfg->dtim_period <= MAX_DTIM_PERIOD) { dtim_period = (struct host_cmd_tlv_dtim_period *)tlv; dtim_period->header.type = cpu_to_le16(TLV_TYPE_UAP_DTIM_PERIOD); dtim_period->header.len = cpu_to_le16(sizeof(struct host_cmd_tlv_dtim_period) - sizeof(struct mwifiex_ie_types_header)); dtim_period->period = bss_cfg->dtim_period; cmd_size += sizeof(struct host_cmd_tlv_dtim_period); tlv += sizeof(struct host_cmd_tlv_dtim_period); } if (bss_cfg->rts_threshold <= MWIFIEX_RTS_MAX_VALUE) { rts_threshold = (struct host_cmd_tlv_rts_threshold *)tlv; rts_threshold->header.type = cpu_to_le16(TLV_TYPE_UAP_RTS_THRESHOLD); rts_threshold->header.len = cpu_to_le16(sizeof(struct host_cmd_tlv_rts_threshold) - sizeof(struct mwifiex_ie_types_header)); rts_threshold->rts_thr = cpu_to_le16(bss_cfg->rts_threshold); cmd_size += sizeof(struct host_cmd_tlv_frag_threshold); tlv += sizeof(struct host_cmd_tlv_frag_threshold); } if ((bss_cfg->frag_threshold >= MWIFIEX_FRAG_MIN_VALUE) && (bss_cfg->frag_threshold <= MWIFIEX_FRAG_MAX_VALUE)) { frag_threshold = (struct host_cmd_tlv_frag_threshold *)tlv; frag_threshold->header.type = cpu_to_le16(TLV_TYPE_UAP_FRAG_THRESHOLD); frag_threshold->header.len = cpu_to_le16(sizeof(struct host_cmd_tlv_frag_threshold) - sizeof(struct mwifiex_ie_types_header)); frag_threshold->frag_thr = cpu_to_le16(bss_cfg->frag_threshold); cmd_size += sizeof(struct host_cmd_tlv_frag_threshold); tlv += sizeof(struct host_cmd_tlv_frag_threshold); } if (bss_cfg->retry_limit <= MWIFIEX_RETRY_LIMIT) { retry_limit = (struct host_cmd_tlv_retry_limit *)tlv; retry_limit->header.type = cpu_to_le16(TLV_TYPE_UAP_RETRY_LIMIT); retry_limit->header.len = cpu_to_le16(sizeof(struct host_cmd_tlv_retry_limit) - sizeof(struct mwifiex_ie_types_header)); retry_limit->limit = (u8)bss_cfg->retry_limit; cmd_size += sizeof(struct host_cmd_tlv_retry_limit); tlv += sizeof(struct host_cmd_tlv_retry_limit); } if ((bss_cfg->protocol & PROTOCOL_WPA) || (bss_cfg->protocol & PROTOCOL_WPA2) || (bss_cfg->protocol & PROTOCOL_EAP)) mwifiex_uap_bss_wpa(&tlv, cmd_buf, &cmd_size); else mwifiex_uap_bss_wep(&tlv, cmd_buf, &cmd_size); if ((bss_cfg->auth_mode <= WLAN_AUTH_SHARED_KEY) || (bss_cfg->auth_mode == MWIFIEX_AUTH_MODE_AUTO)) { auth_type = (struct host_cmd_tlv_auth_type *)tlv; auth_type->header.type = cpu_to_le16(TLV_TYPE_AUTH_TYPE); auth_type->header.len = cpu_to_le16(sizeof(struct host_cmd_tlv_auth_type) - sizeof(struct mwifiex_ie_types_header)); auth_type->auth_type = (u8)bss_cfg->auth_mode; cmd_size += sizeof(struct host_cmd_tlv_auth_type); tlv += sizeof(struct host_cmd_tlv_auth_type); } if (bss_cfg->protocol) { encrypt_protocol = (struct host_cmd_tlv_encrypt_protocol *)tlv; encrypt_protocol->header.type = cpu_to_le16(TLV_TYPE_UAP_ENCRY_PROTOCOL); encrypt_protocol->header.len = cpu_to_le16(sizeof(struct host_cmd_tlv_encrypt_protocol) - sizeof(struct mwifiex_ie_types_header)); encrypt_protocol->proto = cpu_to_le16(bss_cfg->protocol); cmd_size += sizeof(struct host_cmd_tlv_encrypt_protocol); tlv += sizeof(struct host_cmd_tlv_encrypt_protocol); } if (bss_cfg->ht_cap.cap_info) { htcap = (struct mwifiex_ie_types_htcap *)tlv; htcap->header.type = cpu_to_le16(WLAN_EID_HT_CAPABILITY); htcap->header.len = cpu_to_le16(sizeof(struct ieee80211_ht_cap)); htcap->ht_cap.cap_info = bss_cfg->ht_cap.cap_info; htcap->ht_cap.ampdu_params_info = bss_cfg->ht_cap.ampdu_params_info; memcpy(&htcap->ht_cap.mcs, &bss_cfg->ht_cap.mcs, sizeof(struct ieee80211_mcs_info)); htcap->ht_cap.extended_ht_cap_info = bss_cfg->ht_cap.extended_ht_cap_info; htcap->ht_cap.tx_BF_cap_info = bss_cfg->ht_cap.tx_BF_cap_info; htcap->ht_cap.antenna_selection_info = bss_cfg->ht_cap.antenna_selection_info; cmd_size += sizeof(struct mwifiex_ie_types_htcap); tlv += sizeof(struct mwifiex_ie_types_htcap); } if (bss_cfg->wmm_info.qos_info != 0xFF) { wmm_cap = (struct mwifiex_ie_types_wmmcap *)tlv; wmm_cap->header.type = cpu_to_le16(WLAN_EID_VENDOR_SPECIFIC); wmm_cap->header.len = cpu_to_le16(sizeof(wmm_cap->wmm_info)); memcpy(&wmm_cap->wmm_info, &bss_cfg->wmm_info, sizeof(wmm_cap->wmm_info)); cmd_size += sizeof(struct mwifiex_ie_types_wmmcap); tlv += sizeof(struct mwifiex_ie_types_wmmcap); } if (bss_cfg->sta_ao_timer) { ao_timer = (struct host_cmd_tlv_ageout_timer *)tlv; ao_timer->header.type = cpu_to_le16(TLV_TYPE_UAP_AO_TIMER); ao_timer->header.len = cpu_to_le16(sizeof(*ao_timer) - sizeof(struct mwifiex_ie_types_header)); ao_timer->sta_ao_timer = cpu_to_le32(bss_cfg->sta_ao_timer); cmd_size += sizeof(*ao_timer); tlv += sizeof(*ao_timer); } if (bss_cfg->power_constraint) { pwr_ct = (void *)tlv; pwr_ct->header.type = cpu_to_le16(TLV_TYPE_PWR_CONSTRAINT); pwr_ct->header.len = cpu_to_le16(sizeof(u8)); pwr_ct->constraint = bss_cfg->power_constraint; cmd_size += sizeof(*pwr_ct); tlv += sizeof(*pwr_ct); } if (bss_cfg->ps_sta_ao_timer) { ps_ao_timer = (struct host_cmd_tlv_ageout_timer *)tlv; ps_ao_timer->header.type = cpu_to_le16(TLV_TYPE_UAP_PS_AO_TIMER); ps_ao_timer->header.len = cpu_to_le16(sizeof(*ps_ao_timer) - sizeof(struct mwifiex_ie_types_header)); ps_ao_timer->sta_ao_timer = cpu_to_le32(bss_cfg->ps_sta_ao_timer); cmd_size += sizeof(*ps_ao_timer); tlv += sizeof(*ps_ao_timer); } *param_size = cmd_size; return 0; } ",0 "static void reflectedIntegralAttrAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueInt(info, imp->getIntegralAttribute(HTMLNames::reflectedintegralattrAttr)); } ",0 "int dtls1_get_record(SSL *s) { int ssl_major, ssl_minor; int i, n; SSL3_RECORD *rr; unsigned char *p = NULL; unsigned short version; DTLS1_BITMAP *bitmap; unsigned int is_next_epoch; rr = &(s->s3->rrec); again: /* * The epoch may have changed. If so, process all the pending records. * This is a non-blocking operation. */ if (!dtls1_process_buffered_records(s)) return -1; /* if we're renegotiating, then there may be buffered records */ if (dtls1_get_processed_record(s)) return 1; /* get something from the wire */ /* check if we have the header */ if ((s->rstate != SSL_ST_READ_BODY) || (s->packet_length < DTLS1_RT_HEADER_LENGTH)) { n = ssl3_read_n(s, DTLS1_RT_HEADER_LENGTH, s->s3->rbuf.len, 0); /* read timeout is handled by dtls1_read_bytes */ if (n <= 0) return (n); /* error or non-blocking */ /* this packet contained a partial record, dump it */ if (s->packet_length != DTLS1_RT_HEADER_LENGTH) { s->packet_length = 0; goto again; } s->rstate = SSL_ST_READ_BODY; p = s->packet; if (s->msg_callback) s->msg_callback(0, 0, SSL3_RT_HEADER, p, DTLS1_RT_HEADER_LENGTH, s, s->msg_callback_arg); /* Pull apart the header into the DTLS1_RECORD */ rr->type = *(p++); ssl_major = *(p++); ssl_minor = *(p++); version = (ssl_major << 8) | ssl_minor; /* sequence number is 64 bits, with top 2 bytes = epoch */ n2s(p, rr->epoch); memcpy(&(s->s3->read_sequence[2]), p, 6); p += 6; n2s(p, rr->length); /* * Lets check the version. We tolerate alerts that don't have the exact * version number (e.g. because of protocol version errors) */ if (!s->first_packet && rr->type != SSL3_RT_ALERT) { if (version != s->version) { /* unexpected version, silently discard */ rr->length = 0; s->packet_length = 0; goto again; } } if ((version & 0xff00) != (s->version & 0xff00)) { /* wrong version, silently discard record */ rr->length = 0; s->packet_length = 0; goto again; } if (rr->length > SSL3_RT_MAX_ENCRYPTED_LENGTH) { /* record too long, silently discard it */ rr->length = 0; s->packet_length = 0; goto again; } /* now s->rstate == SSL_ST_READ_BODY */ } /* s->rstate == SSL_ST_READ_BODY, get and decode the data */ if (rr->length > s->packet_length - DTLS1_RT_HEADER_LENGTH) { /* now s->packet_length == DTLS1_RT_HEADER_LENGTH */ i = rr->length; n = ssl3_read_n(s, i, i, 1); /* this packet contained a partial record, dump it */ if (n != i) { rr->length = 0; s->packet_length = 0; goto again; } /* * now n == rr->length, and s->packet_length == * DTLS1_RT_HEADER_LENGTH + rr->length */ } s->rstate = SSL_ST_READ_HEADER; /* set state for later operations */ /* match epochs. NULL means the packet is dropped on the floor */ bitmap = dtls1_get_bitmap(s, rr, &is_next_epoch); if (bitmap == NULL) { rr->length = 0; s->packet_length = 0; /* dump this record */ goto again; /* get another record */ } #ifndef OPENSSL_NO_SCTP /* Only do replay check if no SCTP bio */ if (!BIO_dgram_is_sctp(SSL_get_rbio(s))) { #endif /* * Check whether this is a repeat, or aged record. Don't check if * we're listening and this message is a ClientHello. They can look * as if they're replayed, since they arrive from different * connections and would be dropped unnecessarily. */ if (!(s->d1->listen && rr->type == SSL3_RT_HANDSHAKE && s->packet_length > DTLS1_RT_HEADER_LENGTH && s->packet[DTLS1_RT_HEADER_LENGTH] == SSL3_MT_CLIENT_HELLO) && !dtls1_record_replay_check(s, bitmap)) { rr->length = 0; s->packet_length = 0; /* dump this record */ goto again; /* get another record */ } #ifndef OPENSSL_NO_SCTP } #endif /* just read a 0 length packet */ if (rr->length == 0) goto again; /* * If this record is from the next epoch (either HM or ALERT), and a * handshake is currently in progress, buffer it since it cannot be * processed at this time. However, do not buffer anything while * listening. */ if (is_next_epoch) { if ((SSL_in_init(s) || s->in_handshake) && !s->d1->listen) { if (dtls1_buffer_record (s, &(s->d1->unprocessed_rcds), rr->seq_num) < 0) return -1; } rr->length = 0; s->packet_length = 0; goto again; } if (!dtls1_process_record(s, bitmap)) { rr->length = 0; s->packet_length = 0; /* dump this record */ goto again; /* get another record */ } return (1); } ",0 "std::vector GetImagesForAccounts( const std::vector& accounts, Profile* profile) { AccountTrackerService* tracker_service = AccountTrackerServiceFactory::GetForProfile(profile); std::vector images; for (auto account : accounts) { images.push_back(tracker_service->GetAccountImage(account.account_id)); } return images; } ",0 "_gnutls_server_name_recv_params (gnutls_session_t session, const opaque * data, size_t _data_size) { int i; const unsigned char *p; uint16_t len, type; ssize_t data_size = _data_size; int server_names = 0; if (session->security_parameters.entity == GNUTLS_SERVER) { DECR_LENGTH_RET (data_size, 2, 0); len = _gnutls_read_uint16 (data); if (len != data_size) { /* This is unexpected packet length, but * just ignore it, for now. */ gnutls_assert (); return 0; } p = data + 2; /* Count all server_names in the packet. */ while (data_size > 0) { DECR_LENGTH_RET (data_size, 1, 0); p++; DECR_LEN (data_size, 2); len = _gnutls_read_uint16 (p); p += 2; DECR_LENGTH_RET (data_size, len, 0); server_names++; p += len; } session->security_parameters.extensions.server_names_size = if (server_names == 0) return 0; /* no names found */ /* we cannot accept more server names. */ if (server_names > MAX_SERVER_NAME_EXTENSIONS) server_names = MAX_SERVER_NAME_EXTENSIONS; p = data + 2; for (i = 0; i < server_names; i++) server_names[i].name, p, len); session->security_parameters.extensions. server_names[i].name_length = len; session->security_parameters.extensions. server_names[i].type = GNUTLS_NAME_DNS; break; } } ",1 "event_filter_match(struct perf_event *event) { return (event->cpu == -1 || event->cpu == smp_processor_id()) && perf_cgroup_match(event) && pmu_filter_match(event); } ",0 "void GraphicsContext::setPlatformStrokeStyle(StrokeStyle stroke) { if (paintingDisabled()) return; platformContext()->setStrokeStyle(stroke); } ",0 "void VaapiVideoDecodeAccelerator::AssignPictureBuffers( const std::vector& buffers) { DCHECK(task_runner_->BelongsToCurrentThread()); base::AutoLock auto_lock(lock_); DCHECK(pictures_.empty()); while (!output_buffers_.empty()) output_buffers_.pop(); RETURN_AND_NOTIFY_ON_FAILURE( buffers.size() >= requested_num_pics_, ""Got an invalid number of picture buffers. (Got "" << buffers.size() << "", requested "" << requested_num_pics_ << "")"", INVALID_ARGUMENT, ); DCHECK(requested_pic_size_ == buffers[0].size()); const unsigned int va_format = GetVaFormatForVideoCodecProfile(profile_); std::vector va_surface_ids; RETURN_AND_NOTIFY_ON_FAILURE( vaapi_wrapper_->CreateSurfaces(va_format, requested_pic_size_, buffers.size(), &va_surface_ids), ""Failed creating VA Surfaces"", PLATFORM_FAILURE, ); DCHECK_EQ(va_surface_ids.size(), buffers.size()); for (size_t i = 0; i < buffers.size(); ++i) { uint32_t client_id = !buffers[i].client_texture_ids().empty() ? buffers[i].client_texture_ids()[0] : 0; uint32_t service_id = !buffers[i].service_texture_ids().empty() ? buffers[i].service_texture_ids()[0] : 0; DCHECK_EQ(buffers[i].texture_target(), vaapi_picture_factory_->GetGLTextureTarget()); std::unique_ptr picture(vaapi_picture_factory_->Create( vaapi_wrapper_, make_context_current_cb_, bind_image_cb_, buffers[i].id(), requested_pic_size_, service_id, client_id, buffers[i].texture_target())); RETURN_AND_NOTIFY_ON_FAILURE( picture.get(), ""Failed creating a VaapiPicture"", PLATFORM_FAILURE, ); if (output_mode_ == Config::OutputMode::ALLOCATE) { RETURN_AND_NOTIFY_ON_FAILURE( picture->Allocate(output_format_), ""Failed to allocate memory for a VaapiPicture"", PLATFORM_FAILURE, ); output_buffers_.push(buffers[i].id()); } bool inserted = pictures_.insert(std::make_pair(buffers[i].id(), std::move(picture))) .second; DCHECK(inserted); available_va_surfaces_.push_back(va_surface_ids[i]); surfaces_available_.Signal(); } if (state_ == kDecoding) { decoder_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&VaapiVideoDecodeAccelerator::DecodeTask, base::Unretained(this))); } } ",0 "struct ring_buffer *rb_alloc(int nr_pages, long watermark, int cpu, int flags) { struct ring_buffer *rb; unsigned long size; int i; size = sizeof(struct ring_buffer); size += nr_pages * sizeof(void *); rb = kzalloc(size, GFP_KERNEL); if (!rb) goto fail; rb->user_page = perf_mmap_alloc_page(cpu); if (!rb->user_page) goto fail_user_page; for (i = 0; i < nr_pages; i++) { rb->data_pages[i] = perf_mmap_alloc_page(cpu); if (!rb->data_pages[i]) goto fail_data_pages; } rb->nr_pages = nr_pages; ring_buffer_init(rb, watermark, flags); return rb; fail_data_pages: for (i--; i >= 0; i--) free_page((unsigned long)rb->data_pages[i]); free_page((unsigned long)rb->user_page); fail_user_page: kfree(rb); fail: return NULL; } ",0 "void UserSelectionScreen::OnUserRemoved(const AccountId& account_id) { if (!handler_) return; handler_->OnUserRemoved(account_id, users_.empty()); } ",0 "Browser* GetOrCreateBrowser(Profile* profile) { Browser* browser = BrowserList::FindTabbedBrowser(profile, false); return browser ? browser : Browser::Create(profile); } ",0 "static int esil_6502_init (RAnalEsil *esil) { if (esil->anal && esil->anal->reg) { //initial values r_reg_set_value (esil->anal->reg, r_reg_get (esil->anal->reg, ""pc"", -1), 0x0000); r_reg_set_value (esil->anal->reg, r_reg_get (esil->anal->reg, ""sp"", -1), 0xff); r_reg_set_value (esil->anal->reg, r_reg_get (esil->anal->reg, ""a"", -1), 0x00); r_reg_set_value (esil->anal->reg, r_reg_get (esil->anal->reg, ""x"", -1), 0x00); r_reg_set_value (esil->anal->reg, r_reg_get (esil->anal->reg, ""y"", -1), 0x00); r_reg_set_value (esil->anal->reg, r_reg_get (esil->anal->reg, ""flags"", -1), 0x00); } return true; } ",0 "SPICE_GNUC_VISIBLE int spice_server_migrate_connect(SpiceServer *s, const char* dest, int port, int secure_port, const char* cert_subject) { SpiceMigrateInterface *sif; int try_seamless; spice_info(NULL); spice_assert(migration_interface); spice_assert(reds == s); if (reds->expect_migrate) { spice_info(""consecutive calls without migration. Canceling previous call""); main_channel_migrate_src_complete(reds->main_channel, FALSE); } sif = SPICE_CONTAINEROF(migration_interface->base.sif, SpiceMigrateInterface, base); if (!reds_set_migration_dest_info(dest, port, secure_port, cert_subject)) { sif->migrate_connect_complete(migration_interface); return -1; } reds->expect_migrate = TRUE; /* * seamless migration support was added to the client after the support in * agent_connect_tokens, so there shouldn't be contradicition - if * the client is capable of seamless migration, it is capbable of agent_connected_tokens. * The demand for agent_connected_tokens support is in order to assure that if migration * occured when the agent was not connected, the tokens state after migration will still * be valid (see reds_reset_vdp for more details). */ try_seamless = reds->seamless_migration_enabled && red_channel_test_remote_cap(&reds->main_channel->base, SPICE_MAIN_CAP_AGENT_CONNECTED_TOKENS); /* main channel will take care of clients that are still during migration (at target)*/ if (main_channel_migrate_connect(reds->main_channel, reds->mig_spice, try_seamless)) { reds_mig_started(); } else { if (reds->num_clients == 0) { reds_mig_release(); spice_info(""no client connected""); } sif->migrate_connect_complete(migration_interface); } return 0; } ",0 "static int irda_data_indication(void *instance, void *sap, struct sk_buff *skb) { struct irda_sock *self; struct sock *sk; int err; self = instance; sk = instance; err = sock_queue_rcv_skb(sk, skb); if (err) { pr_debug(""%s(), error: no more mem!\n"", __func__); self->rx_flow = FLOW_STOP; /* When we return error, TTP will need to requeue the skb */ return err; } return 0; } ",0 "void ScriptController::setIsolatedWorldSecurityOrigin(int worldID, PassRefPtr securityOrigin) { m_proxy->setIsolatedWorldSecurityOrigin(worldID, securityOrigin); } ",0 "X509_SIG *d2i_PKCS8_fp(FILE *fp, X509_SIG **p8) { return ASN1_d2i_fp_of(X509_SIG,X509_SIG_new,d2i_X509_SIG,fp,p8); } ",0 "asmlinkage void __exception do_undefinstr(struct pt_regs *regs) { siginfo_t info; void __user *pc = (void __user *)instruction_pointer(regs); #ifdef CONFIG_COMPAT /* check for AArch32 breakpoint instructions */ if (compat_user_mode(regs) && aarch32_break_trap(regs) == 0) return; #endif if (show_unhandled_signals && unhandled_signal(current, SIGILL) && printk_ratelimit()) { pr_info(""%s[%d]: undefined instruction: pc=%p\n"", current->comm, task_pid_nr(current), pc); dump_instr(KERN_INFO, regs); } info.si_signo = SIGILL; info.si_errno = 0; info.si_code = ILL_ILLOPC; info.si_addr = pc; arm64_notify_die(""Oops - undefined instruction"", regs, &info, 0); } ",0 "static int crypto_ahash_report(struct sk_buff *skb, struct crypto_alg *alg) { return -ENOSYS; } ",0 "static bool ath_tx_sched_aggr(struct ath_softc *sc, struct ath_txq *txq, struct ath_atx_tid *tid, bool *stop) { struct ath_buf *bf; struct ieee80211_tx_info *tx_info; struct sk_buff_head *tid_q; struct list_head bf_q; int aggr_len = 0; bool aggr, last = true; if (!ath_tid_has_buffered(tid)) return false; INIT_LIST_HEAD(&bf_q); bf = ath_tx_get_tid_subframe(sc, txq, tid, &tid_q); if (!bf) return false; tx_info = IEEE80211_SKB_CB(bf->bf_mpdu); aggr = !!(tx_info->flags & IEEE80211_TX_CTL_AMPDU); if ((aggr && txq->axq_ampdu_depth >= ATH_AGGR_MIN_QDEPTH) || (!aggr && txq->axq_depth >= ATH_NON_AGGR_MIN_QDEPTH)) { *stop = true; return false; } ath_set_rates(tid->an->vif, tid->an->sta, bf); if (aggr) last = ath_tx_form_aggr(sc, txq, tid, &bf_q, bf, tid_q, &aggr_len); else ath_tx_form_burst(sc, txq, tid, &bf_q, bf, tid_q); if (list_empty(&bf_q)) return false; if (tid->ac->clear_ps_filter || tid->an->no_ps_filter) { tid->ac->clear_ps_filter = false; tx_info->flags |= IEEE80211_TX_CTL_CLEAR_PS_FILT; } ath_tx_fill_desc(sc, bf, txq, aggr_len); ath_tx_txqaddbuf(sc, txq, &bf_q, false); return true; } ",0 "void ipmi_free_recv_msg(struct ipmi_recv_msg *msg) { if (msg->user) kref_put(&msg->user->refcount, free_user); msg->done(msg); } ",0 "bool RenderBox::hasUnsplittableScrollingOverflow() const { bool isHorizontal = isHorizontalWritingMode(); if ((isHorizontal && !scrollsOverflowY()) || (!isHorizontal && !scrollsOverflowX())) return false; return !style()->logicalHeight().isIntrinsicOrAuto() || (!style()->logicalMaxHeight().isIntrinsicOrAuto() && !style()->logicalMaxHeight().isUndefined() && (!style()->logicalMaxHeight().isPercent() || percentageLogicalHeightIsResolvable(this))) || (!style()->logicalMinHeight().isIntrinsicOrAuto() && style()->logicalMinHeight().isPositive() && (!style()->logicalMinHeight().isPercent() || percentageLogicalHeightIsResolvable(this))); } ",0 "void Cache::pruneDeadResources() { if (!m_pruneEnabled) return; unsigned capacity = deadCapacity(); if (m_deadSize <= capacity) return; unsigned targetSize = static_cast(capacity * cTargetPrunePercentage); // Cut by a percentage to avoid immediately pruning again. int size = m_allResources.size(); bool canShrinkLRULists = true; for (int i = size - 1; i >= 0; i--) { CachedResource* current = m_allResources[i].m_tail; while (current) { CachedResource* prev = current->m_prevInAllResourcesList; if (!current->referenced() && !current->isPreloaded() && current->isLoaded() && current->decodedSize()) { current->destroyDecodedData(); if (m_deadSize <= targetSize) return; } current = prev; } current = m_allResources[i].m_tail; while (current) { CachedResource* prev = current->m_prevInAllResourcesList; if (!current->referenced() && !current->isPreloaded()) { remove(current); if (m_deadSize <= targetSize) return; } current = prev; } if (m_allResources[i].m_head) canShrinkLRULists = false; else if (canShrinkLRULists) m_allResources.resize(i); } } ",0 " void free(void * p) { # if defined(GC_LINUX_THREADS) && !defined(USE_PROC_FOR_LIBRARIES) { /* Don't bother with initialization checks. If nothing */ /* has been initialized, the check fails, and that's safe, */ /* since we haven't allocated uncollectable objects either. */ ptr_t caller = (ptr_t)__builtin_return_address(0); /* This test does not need to ensure memory visibility, since */ /* the bounds will be set when/if we create another thread. */ if (((word)caller >= (word)GC_libpthread_start && (word)caller < (word)GC_libpthread_end) || ((word)caller >= (word)GC_libld_start && (word)caller < (word)GC_libld_end)) { GC_free(p); return; } } # endif # ifndef IGNORE_FREE REDIRECT_FREE(p); # endif } ",0 "static int rgbvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comps) { os_ptr op = osp; int i; if (num_comps < 3) return_error(gs_error_stackunderflow); op -= 2; for (i=0;i<3;i++) { if (!r_has_type(op, t_integer) && !r_has_type(op, t_real)) return_error(gs_error_typecheck); op++; } for (i=0;i < 3; i++) { if (values[i] > 1.0) values[i] = 1.0; if (values[i] < 0.0) values[i] = 0.0; } return 0; } ",0 "scoped_refptr DataPipeConsumerDispatcher::Create( NodeController* node_controller, const ports::PortRef& control_port, base::UnsafeSharedMemoryRegion shared_ring_buffer, const MojoCreateDataPipeOptions& options, uint64_t pipe_id) { scoped_refptr consumer = new DataPipeConsumerDispatcher(node_controller, control_port, std::move(shared_ring_buffer), options, pipe_id); base::AutoLock lock(consumer->lock_); if (!consumer->InitializeNoLock()) return nullptr; return consumer; } ",0 "static void cma_set_rep_event_data(struct rdma_cm_event *event, struct ib_cm_rep_event_param *rep_data, void *private_data) { event->param.conn.private_data = private_data; event->param.conn.private_data_len = IB_CM_REP_PRIVATE_DATA_SIZE; event->param.conn.responder_resources = rep_data->responder_resources; event->param.conn.initiator_depth = rep_data->initiator_depth; event->param.conn.flow_control = rep_data->flow_control; event->param.conn.rnr_retry_count = rep_data->rnr_retry_count; event->param.conn.srq = rep_data->srq; event->param.conn.qp_num = rep_data->remote_qpn; } ",0 " void CWebServer::Cmd_UpdateHardware(WebEmSession & session, const request& req, Json::Value &root) { if (session.rights != 2) { session.reply_status = reply::forbidden; return; //Only admin user allowed } std::string idx = request::findValue(&req, ""idx""); if (idx.empty()) return; std::string name = CURLEncode::URLDecode(request::findValue(&req, ""name"")); std::string senabled = request::findValue(&req, ""enabled""); std::string shtype = request::findValue(&req, ""htype""); std::string address = request::findValue(&req, ""address""); std::string sport = request::findValue(&req, ""port""); std::string username = CURLEncode::URLDecode(request::findValue(&req, ""username"")); std::string password = CURLEncode::URLDecode(request::findValue(&req, ""password"")); std::string extra = CURLEncode::URLDecode(request::findValue(&req, ""extra"")); std::string sdatatimeout = request::findValue(&req, ""datatimeout""); if ( (name.empty()) || (senabled.empty()) || (shtype.empty()) ) return; int mode1 = atoi(request::findValue(&req, ""Mode1"").c_str()); int mode2 = atoi(request::findValue(&req, ""Mode2"").c_str()); int mode3 = atoi(request::findValue(&req, ""Mode3"").c_str()); int mode4 = atoi(request::findValue(&req, ""Mode4"").c_str()); int mode5 = atoi(request::findValue(&req, ""Mode5"").c_str()); int mode6 = atoi(request::findValue(&req, ""Mode6"").c_str()); bool bEnabled = (senabled == ""true"") ? true : false; _eHardwareTypes htype = (_eHardwareTypes)atoi(shtype.c_str()); int iDataTimeout = atoi(sdatatimeout.c_str()); int port = atoi(sport.c_str()); bool bIsSerial = false; if (IsSerialDevice(htype)) { bIsSerial = true; if (bEnabled) { if (sport.empty()) return; //need to have a serial port } } else if ( (htype == HTYPE_RFXLAN) || (htype == HTYPE_P1SmartMeterLAN) || (htype == HTYPE_YouLess) || (htype == HTYPE_OpenThermGatewayTCP) || (htype == HTYPE_LimitlessLights) || (htype == HTYPE_SolarEdgeTCP) || (htype == HTYPE_WOL) || (htype == HTYPE_S0SmartMeterTCP) || (htype == HTYPE_ECODEVICES) || (htype == HTYPE_Mochad) || (htype == HTYPE_MySensorsTCP) || (htype == HTYPE_MySensorsMQTT) || (htype == HTYPE_MQTT) || (htype == HTYPE_TTN_MQTT) || (htype == HTYPE_FRITZBOX) || (htype == HTYPE_ETH8020) || (htype == HTYPE_Sterbox) || (htype == HTYPE_KMTronicTCP) || (htype == HTYPE_KMTronicUDP) || (htype == HTYPE_SOLARMAXTCP) || (htype == HTYPE_RelayNet) || (htype == HTYPE_SatelIntegra) || (htype == HTYPE_eHouseTCP) || (htype == HTYPE_RFLINKTCP) || (htype == HTYPE_Comm5TCP || (htype == HTYPE_Comm5SMTCP) || (htype == HTYPE_CurrentCostMeterLAN)) || (htype == HTYPE_NefitEastLAN) || (htype == HTYPE_DenkoviHTTPDevices) || (htype == HTYPE_DenkoviTCPDevices) || (htype == HTYPE_Ec3kMeterTCP) || (htype == HTYPE_MultiFun) || (htype == HTYPE_ZIBLUETCP) || (htype == HTYPE_OnkyoAVTCP) ) { if (address.empty()) return; } else if (htype == HTYPE_DomoticzInternal) { return; } else if (htype == HTYPE_Domoticz) { if (address.empty()) return; } else if (htype == HTYPE_System) { std::vector > result; result = m_sql.safe_query(""SELECT ID FROM Hardware WHERE (Type==%d)"", HTYPE_System); if (!result.empty()) { int hID = atoi(result[0][0].c_str()); int aID = atoi(idx.c_str()); if (hID != aID) return; } } else if (htype == HTYPE_TE923) { } else if (htype == HTYPE_VOLCRAFTCO20) { } else if (htype == HTYPE_1WIRE) { } else if (htype == HTYPE_Pinger) { } else if (htype == HTYPE_Kodi) { } else if (htype == HTYPE_PanasonicTV) { } else if (htype == HTYPE_LogitechMediaServer) { } else if (htype == HTYPE_RaspberryBMP085) { } else if (htype == HTYPE_RaspberryHTU21D) { } else if (htype == HTYPE_RaspberryTSL2561) { } else if (htype == HTYPE_RaspberryBME280) { } else if (htype == HTYPE_RaspberryMCP23017) { } else if (htype == HTYPE_Dummy) { } else if (htype == HTYPE_EVOHOME_SCRIPT || htype == HTYPE_EVOHOME_SERIAL || htype == HTYPE_EVOHOME_WEB || htype == HTYPE_EVOHOME_TCP) { } else if (htype == HTYPE_PiFace) { } else if (htype == HTYPE_HTTPPOLLER) { } else if (htype == HTYPE_BleBox) { } else if (htype == HTYPE_HEOS) { } else if (htype == HTYPE_Yeelight) { } else if (htype == HTYPE_XiaomiGateway) { } else if (htype == HTYPE_Arilux) { } else if (htype == HTYPE_USBtinGateway) { } else if ( (htype == HTYPE_Wunderground) || (htype == HTYPE_DarkSky) || (htype == HTYPE_AccuWeather) || (htype == HTYPE_OpenWeatherMap) || (htype == HTYPE_ICYTHERMOSTAT) || (htype == HTYPE_TOONTHERMOSTAT) || (htype == HTYPE_AtagOne) || (htype == HTYPE_PVOUTPUT_INPUT) || (htype == HTYPE_NEST) || (htype == HTYPE_ANNATHERMOSTAT) || (htype == HTYPE_THERMOSMART) || (htype == HTYPE_Tado) || (htype == HTYPE_Netatmo) ) { if ( (username.empty()) || (password.empty()) ) return; } else if (htype == HTYPE_SolarEdgeAPI) { if ( (username.empty()) ) return; } else if (htype == HTYPE_Nest_OAuthAPI) { if ( (username == """") && (extra == ""||"") ) return; } else if (htype == HTYPE_HARMONY_HUB) { if ( (address.empty()) ) return; } else if (htype == HTYPE_Philips_Hue) { if ( (username.empty()) || (address.empty()) ) return; if (port == 0) port = 80; } else if (htype == HTYPE_RaspberryGPIO) { } else if (htype == HTYPE_SysfsGpio) { } else if (htype == HTYPE_Rtl433) { } else if (htype == HTYPE_Daikin) { } else if (htype == HTYPE_SBFSpot) { if (username.empty()) return; } else if (htype == HTYPE_WINDDELEN) { std::string mill_id = request::findValue(&req, ""Mode1""); if ( (mill_id.empty()) || (sport.empty()) ) return; } else if (htype == HTYPE_Honeywell) { } else if (htype == HTYPE_OpenWebNetTCP) { } else if (htype == HTYPE_PythonPlugin) { } else if (htype == HTYPE_GoodweAPI) { if (username.empty()) { return; } } else if (htype == HTYPE_RaspberryPCF8574) { } else if (htype == HTYPE_OpenWebNetUSB) { } else if (htype == HTYPE_IntergasInComfortLAN2RF) { } else if (htype == HTYPE_EnphaseAPI) { } else return; std::string mode1Str; std::string mode2Str; std::string mode3Str; std::string mode4Str; std::string mode5Str; std::string mode6Str; root[""status""] = ""OK""; root[""title""] = ""UpdateHardware""; if (htype == HTYPE_Domoticz) { if (password.size() != 32) { password = GenerateMD5Hash(password); } } if ((bIsSerial) && (!bEnabled) && (sport.empty())) { m_sql.safe_query( ""UPDATE Hardware SET Enabled=%d WHERE (ID == '%q')"", (bEnabled == true) ? 1 : 0, idx.c_str() ); } else { if (htype == HTYPE_HTTPPOLLER) { m_sql.safe_query( ""UPDATE Hardware SET Name='%q', Enabled=%d, Type=%d, Address='%q', Port=%d, SerialPort='%q', Username='%q', Password='%q', Extra='%q', DataTimeout=%d WHERE (ID == '%q')"", name.c_str(), (senabled == ""true"") ? 1 : 0, htype, address.c_str(), port, sport.c_str(), username.c_str(), password.c_str(), extra.c_str(), iDataTimeout, idx.c_str() ); } else if (htype == HTYPE_PythonPlugin) { mode1Str = request::findValue(&req, ""Mode1""); mode2Str = request::findValue(&req, ""Mode2""); mode3Str = request::findValue(&req, ""Mode3""); mode4Str = request::findValue(&req, ""Mode4""); mode5Str = request::findValue(&req, ""Mode5""); mode6Str = request::findValue(&req, ""Mode6""); sport = request::findValue(&req, ""serialport""); m_sql.safe_query( ""UPDATE Hardware SET Name='%q', Enabled=%d, Type=%d, Address='%q', Port=%d, SerialPort='%q', Username='%q', Password='%q', Extra='%q', Mode1='%q', Mode2='%q', Mode3='%q', Mode4='%q', Mode5='%q', Mode6='%q', DataTimeout=%d WHERE (ID == '%q')"", name.c_str(), (senabled == ""true"") ? 1 : 0, htype, address.c_str(), port, sport.c_str(), username.c_str(), password.c_str(), extra.c_str(), mode1Str.c_str(), mode2Str.c_str(), mode3Str.c_str(), mode4Str.c_str(), mode5Str.c_str(), mode6Str.c_str(), iDataTimeout, idx.c_str() ); } else if ( (htype == HTYPE_RFXtrx433) || (htype == HTYPE_RFXtrx868) ) { m_sql.safe_query( ""UPDATE Hardware SET Name='%q', Enabled=%d, Type=%d, Address='%q', Port=%d, SerialPort='%q', Username='%q', Password='%q', Mode1=%d, Mode2=%d, Mode3=%d, Mode4=%d, Mode5=%d, Mode6=%d, DataTimeout=%d WHERE (ID == '%q')"", name.c_str(), (bEnabled == true) ? 1 : 0, htype, address.c_str(), port, sport.c_str(), username.c_str(), password.c_str(), mode1, mode2, mode3, mode4, mode5, mode6, iDataTimeout, idx.c_str() ); std::vector > result; result = m_sql.safe_query(""SELECT Extra FROM Hardware WHERE ID=%q"", idx.c_str()); if (!result.empty()) extra = result[0][0]; } else { m_sql.safe_query( ""UPDATE Hardware SET Name='%q', Enabled=%d, Type=%d, Address='%q', Port=%d, SerialPort='%q', Username='%q', Password='%q', Extra='%q', Mode1=%d, Mode2=%d, Mode3=%d, Mode4=%d, Mode5=%d, Mode6=%d, DataTimeout=%d WHERE (ID == '%q')"", name.c_str(), (bEnabled == true) ? 1 : 0, htype, address.c_str(), port, sport.c_str(), username.c_str(), password.c_str(), extra.c_str(), mode1, mode2, mode3, mode4, mode5, mode6, iDataTimeout, idx.c_str() ); } } int ID = atoi(idx.c_str()); m_mainworker.AddHardwareFromParams(ID, name, bEnabled, htype, address, port, sport, username, password, extra, mode1, mode2, mode3, mode4, mode5, mode6, iDataTimeout, true); } ",0 "void CSSStyleSheet::styleSheetChanged() { StyleBase* root = this; while (StyleBase* parent = root->parent()) root = parent; Document* documentToUpdate = root->isCSSStyleSheet() ? static_cast(root)->doc() : 0; /* FIXME: We don't need to do everything updateStyleSelector does, * basically we just need to recreate the document's selector with the * already existing style sheets. */ if (documentToUpdate) documentToUpdate->updateStyleSelector(); } ",0 "void ProfileSyncService::ShutdownImpl(bool sync_disabled) { base::Time shutdown_start_time = base::Time::Now(); if (backend_.get()) backend_->StopSyncingForShutdown(); if (data_type_manager_.get()) { if (data_type_manager_->state() != DataTypeManager::STOPPED) { expect_sync_configuration_aborted_ = true; data_type_manager_->Stop(); } registrar_.Remove( this, chrome::NOTIFICATION_SYNC_CONFIGURE_START, content::Source(data_type_manager_.get())); registrar_.Remove( this, chrome::NOTIFICATION_SYNC_CONFIGURE_DONE, content::Source(data_type_manager_.get())); registrar_.Remove( this, chrome::NOTIFICATION_SYNC_CONFIGURE_BLOCKED, content::Source(data_type_manager_.get())); data_type_manager_.reset(); } migrator_.reset(); sync_js_controller_.AttachJsBackend(WeakHandle()); scoped_ptr doomed_backend(backend_.release()); if (doomed_backend.get()) { doomed_backend->Shutdown(sync_disabled); doomed_backend.reset(); } base::TimeDelta shutdown_time = base::Time::Now() - shutdown_start_time; UMA_HISTOGRAM_TIMES(""Sync.Shutdown.BackendDestroyedTime"", shutdown_time); weak_factory_.InvalidateWeakPtrs(); expect_sync_configuration_aborted_ = false; is_auth_in_progress_ = false; backend_initialized_ = false; cached_passphrase_.clear(); encryption_pending_ = false; encrypt_everything_ = false; encrypted_types_ = browser_sync::Cryptographer::SensitiveTypes(); passphrase_required_reason_ = sync_api::REASON_PASSPHRASE_NOT_REQUIRED; last_auth_error_ = GoogleServiceAuthError::None(); if (sync_global_error_.get()) { GlobalErrorServiceFactory::GetForProfile(profile_)->RemoveGlobalError( sync_global_error_.get()); RemoveObserver(sync_global_error_.get()); sync_global_error_.reset(NULL); } } ",0 "T* HFSBTreeIterator::GetLeafData() { base::CheckedNumeric size = sizeof(T); auto new_offset = size + current_leaf_offset_; if (!new_offset.IsValid() || new_offset.ValueOrDie() >= leaf_data_.size()) return nullptr; T* object = reinterpret_cast(&leaf_data_[current_leaf_offset_]); current_leaf_offset_ = new_offset.ValueOrDie(); return object; } ",0 "void V8TestObject::VoidMethodArrayBufferOrArrayBufferViewOrDictionaryArgMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_voidMethodArrayBufferOrArrayBufferViewOrDictionaryArg""); test_object_v8_internal::VoidMethodArrayBufferOrArrayBufferViewOrDictionaryArgMethod(info); } ",0 "static int try_to_unmap_nonlinear(struct page *page, struct address_space *mapping, void *arg) { struct vm_area_struct *vma; int ret = SWAP_AGAIN; unsigned long cursor; unsigned long max_nl_cursor = 0; unsigned long max_nl_size = 0; unsigned int mapcount; list_for_each_entry(vma, &mapping->i_mmap_nonlinear, shared.nonlinear) { cursor = (unsigned long) vma->vm_private_data; if (cursor > max_nl_cursor) max_nl_cursor = cursor; cursor = vma->vm_end - vma->vm_start; if (cursor > max_nl_size) max_nl_size = cursor; } if (max_nl_size == 0) { /* all nonlinears locked or reserved ? */ return SWAP_FAIL; } /* * We don't try to search for this page in the nonlinear vmas, * and page_referenced wouldn't have found it anyway. Instead * just walk the nonlinear vmas trying to age and unmap some. * The mapcount of the page we came in with is irrelevant, * but even so use it as a guide to how hard we should try? */ mapcount = page_mapcount(page); if (!mapcount) return ret; cond_resched(); max_nl_size = (max_nl_size + CLUSTER_SIZE - 1) & CLUSTER_MASK; if (max_nl_cursor == 0) max_nl_cursor = CLUSTER_SIZE; do { list_for_each_entry(vma, &mapping->i_mmap_nonlinear, shared.nonlinear) { cursor = (unsigned long) vma->vm_private_data; while (cursor < max_nl_cursor && cursor < vma->vm_end - vma->vm_start) { if (try_to_unmap_cluster(cursor, &mapcount, vma, page) == SWAP_MLOCK) ret = SWAP_MLOCK; cursor += CLUSTER_SIZE; vma->vm_private_data = (void *) cursor; if ((int)mapcount <= 0) return ret; } vma->vm_private_data = (void *) max_nl_cursor; } cond_resched(); max_nl_cursor += CLUSTER_SIZE; } while (max_nl_cursor <= max_nl_size); /* * Don't loop forever (perhaps all the remaining pages are * in locked vmas). Reset cursor on all unreserved nonlinear * vmas, now forgetting on which ones it had fallen behind. */ list_for_each_entry(vma, &mapping->i_mmap_nonlinear, shared.nonlinear) vma->vm_private_data = NULL; return ret; } ",0 "std::unique_ptr PasswordAutofillAgent::GetPasswordFormFromWebForm( const WebFormElement& web_form) { return CreateSimplifiedPasswordFormFromWebForm(web_form, &field_data_manager_, &username_detector_cache_); } ",0 "void RenderViewImpl::didHandleGestureEvent(const WebGestureEvent& event, bool event_swallowed) { #if defined(OS_ANDROID) if (event.type == WebInputEvent::GestureTap || event.type == WebInputEvent::GestureLongPress) { UpdateTextInputState(SHOW_IME_IF_NEEDED); } #endif FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidHandleGestureEvent(event)); } ",0 " static bool HasEntryImpl(Isolate* isolate, FixedArrayBase* parameters, uint32_t entry) { FixedArray* parameter_map = FixedArray::cast(parameters); uint32_t length = parameter_map->length() - 2; if (entry < length) { return HasParameterMapArg(parameter_map, entry); } FixedArrayBase* arguments = FixedArrayBase::cast(parameter_map->get(1)); return ArgumentsAccessor::HasEntryImpl(isolate, arguments, entry - length); } ",0 "void AddUninstallShortcutWorkItems(const InstallerState& installer_state, const FilePath& setup_path, const Version& new_version, WorkItemList* install_list, const Product& product) { HKEY reg_root = installer_state.root_key(); BrowserDistribution* browser_dist = product.distribution(); DCHECK(browser_dist); FilePath install_path(installer_state.target_path()); FilePath installer_path(installer_state.GetInstallerDirectory(new_version)); installer_path = installer_path.Append(setup_path.BaseName()); CommandLine uninstall_arguments(CommandLine::NO_PROGRAM); AppendUninstallCommandLineFlags(installer_state, product, &uninstall_arguments); if (product.is_chrome() && installer_state.operation() != InstallerState::UNINSTALL) { const Products& products = installer_state.products(); for (size_t i = 0; i < products.size(); ++i) { const Product& p = *products[i]; if (!p.is_chrome() && !p.ShouldCreateUninstallEntry()) p.AppendUninstallFlags(&uninstall_arguments); } } std::wstring update_state_key(browser_dist->GetStateKey()); install_list->AddCreateRegKeyWorkItem(reg_root, update_state_key); install_list->AddSetRegValueWorkItem(reg_root, update_state_key, installer::kUninstallStringField, installer_path.value(), true); install_list->AddSetRegValueWorkItem(reg_root, update_state_key, installer::kUninstallArgumentsField, uninstall_arguments.command_line_string(), true); if (!installer_state.is_msi() && product.ShouldCreateUninstallEntry()) { CommandLine quoted_uninstall_cmd(installer_path); DCHECK_EQ(quoted_uninstall_cmd.command_line_string()[0], '""'); quoted_uninstall_cmd.AppendArguments(uninstall_arguments, false); std::wstring uninstall_reg = browser_dist->GetUninstallRegPath(); install_list->AddCreateRegKeyWorkItem(reg_root, uninstall_reg); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, installer::kUninstallDisplayNameField, browser_dist->GetAppShortCutName(), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, installer::kUninstallStringField, quoted_uninstall_cmd.command_line_string(), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L""InstallLocation"", install_path.value(), true); FilePath chrome_icon(install_path.Append(installer::kChromeExe)); ShellUtil::GetChromeIcon(product.distribution(), chrome_icon.value()); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L""DisplayIcon"", chrome_icon.value(), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L""NoModify"", static_cast(1), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L""NoRepair"", static_cast(1), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L""Publisher"", browser_dist->GetPublisherName(), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L""Version"", UTF8ToWide(new_version.GetString()), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L""DisplayVersion"", UTF8ToWide(new_version.GetString()), true); install_list->AddSetRegValueWorkItem(reg_root, uninstall_reg, L""InstallDate"", InstallUtil::GetCurrentDate(), false); } } ",0 "static int check_resource_valid(struct vrend_renderer_resource_create_args *args) { /* do not accept handle 0 */ if (args->handle == 0) return -1; /* limit the target */ if (args->target >= PIPE_MAX_TEXTURE_TYPES) return -1; if (args->format >= VIRGL_FORMAT_MAX) return -1; /* only texture 2d and 2d array can have multiple samples */ if (args->nr_samples > 1) { if (args->target != PIPE_TEXTURE_2D && args->target != PIPE_TEXTURE_2D_ARRAY) return -1; /* multisample can't have miplevels */ if (args->last_level > 0) return -1; } if (args->last_level > 0) { /* buffer and rect textures can't have mipmaps */ if (args->target == PIPE_BUFFER || args->target == PIPE_TEXTURE_RECT) return -1; if (args->last_level > (floor(log2(MAX2(args->width, args->height))) + 1)) return -1; } if (args->flags != 0 && args->flags != VIRGL_RESOURCE_Y_0_TOP) return -1; if (args->flags & VIRGL_RESOURCE_Y_0_TOP) if (args->target != PIPE_TEXTURE_2D && args->target != PIPE_TEXTURE_RECT) return -1; /* array size for array textures only */ if (args->target == PIPE_TEXTURE_CUBE) { if (args->array_size != 6) return -1; } else if (args->target == PIPE_TEXTURE_CUBE_ARRAY) { if (args->array_size % 6) return -1; } else if (args->array_size > 1) { if (args->target != PIPE_TEXTURE_2D_ARRAY && args->target != PIPE_TEXTURE_1D_ARRAY) return -1; } if (args->bind == 0 || args->bind == VREND_RES_BIND_CUSTOM || args->bind == VREND_RES_BIND_INDEX_BUFFER || args->bind == VREND_RES_BIND_STREAM_OUTPUT || args->bind == VREND_RES_BIND_VERTEX_BUFFER || args->bind == VREND_RES_BIND_CONSTANT_BUFFER) { if (args->target != PIPE_BUFFER) return -1; if (args->height != 1 || args->depth != 1) return -1; } else { if (!((args->bind & VREND_RES_BIND_SAMPLER_VIEW) || (args->bind & VREND_RES_BIND_DEPTH_STENCIL) || (args->bind & VREND_RES_BIND_RENDER_TARGET) || (args->bind & VREND_RES_BIND_CURSOR))) return -1; if (args->target == PIPE_TEXTURE_2D || args->target == PIPE_TEXTURE_RECT || args->target == PIPE_TEXTURE_CUBE || args->target == PIPE_TEXTURE_2D_ARRAY || args->target == PIPE_TEXTURE_CUBE_ARRAY) { if (args->depth != 1) return -1; } if (args->target == PIPE_TEXTURE_1D || args->target == PIPE_TEXTURE_1D_ARRAY) { if (args->height != 1 || args->depth != 1) return -1; } } return 0; } ",0 "void setJSTestObjReflectedBooleanAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast(thisObject); TestObj* impl = static_cast(castedThis->impl()); impl->setBooleanAttribute(WebCore::HTMLNames::reflectedbooleanattrAttr, value.toBoolean(exec)); } ",0 "static void tcp_check_reno_reordering(struct sock *sk, const int addend) { struct tcp_sock *tp = tcp_sk(sk); if (tcp_limit_reno_sacked(tp)) tcp_update_reordering(sk, tp->packets_out + addend, 0); } ",0 "static ssize_t ims_pcu_ofn_reg_data_show(struct device *dev, struct device_attribute *dattr, char *buf) { struct usb_interface *intf = to_usb_interface(dev); struct ims_pcu *pcu = usb_get_intfdata(intf); int error; u8 data; mutex_lock(&pcu->cmd_mutex); error = ims_pcu_read_ofn_config(pcu, pcu->ofn_reg_addr, &data); mutex_unlock(&pcu->cmd_mutex); if (error) return error; return scnprintf(buf, PAGE_SIZE, ""%x\n"", data); } ",0 "static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock_iocb *siocb = kiocb_to_siocb(iocb); struct scm_cookie tmp_scm; struct sock *sk = sock->sk; struct unix_sock *u = unix_sk(sk); struct sockaddr_un *sunaddr = msg->msg_name; int copied = 0; int check_creds = 0; int target; int err = 0; long timeo; int skip; err = -EINVAL; if (sk->sk_state != TCP_ESTABLISHED) goto out; err = -EOPNOTSUPP; if (flags&MSG_OOB) goto out; target = sock_rcvlowat(sk, flags&MSG_WAITALL, size); timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT); msg->msg_namelen = 0; /* Lock the socket to prevent queue disordering * while sleeps in memcpy_tomsg */ if (!siocb->scm) { siocb->scm = &tmp_scm; memset(&tmp_scm, 0, sizeof(tmp_scm)); } err = mutex_lock_interruptible(&u->readlock); if (err) { err = sock_intr_errno(timeo); goto out; } do { int chunk; struct sk_buff *skb, *last; unix_state_lock(sk); last = skb = skb_peek(&sk->sk_receive_queue); again: if (skb == NULL) { unix_sk(sk)->recursion_level = 0; if (copied >= target) goto unlock; /* * POSIX 1003.1g mandates this order. */ err = sock_error(sk); if (err) goto unlock; if (sk->sk_shutdown & RCV_SHUTDOWN) goto unlock; unix_state_unlock(sk); err = -EAGAIN; if (!timeo) break; mutex_unlock(&u->readlock); timeo = unix_stream_data_wait(sk, timeo, last); if (signal_pending(current) || mutex_lock_interruptible(&u->readlock)) { err = sock_intr_errno(timeo); goto out; } continue; unlock: unix_state_unlock(sk); break; } skip = sk_peek_offset(sk, flags); while (skip >= unix_skb_len(skb)) { skip -= unix_skb_len(skb); last = skb; skb = skb_peek_next(skb, &sk->sk_receive_queue); if (!skb) goto again; } unix_state_unlock(sk); if (check_creds) { /* Never glue messages from different writers */ if ((UNIXCB(skb).pid != siocb->scm->pid) || !uid_eq(UNIXCB(skb).uid, siocb->scm->creds.uid) || !gid_eq(UNIXCB(skb).gid, siocb->scm->creds.gid)) break; } else if (test_bit(SOCK_PASSCRED, &sock->flags)) { /* Copy credentials */ scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).uid, UNIXCB(skb).gid); check_creds = 1; } /* Copy address just once */ if (sunaddr) { unix_copy_addr(msg, skb->sk); sunaddr = NULL; } chunk = min_t(unsigned int, unix_skb_len(skb) - skip, size); if (skb_copy_datagram_iovec(skb, UNIXCB(skb).consumed + skip, msg->msg_iov, chunk)) { if (copied == 0) copied = -EFAULT; break; } copied += chunk; size -= chunk; /* Mark read part of skb as used */ if (!(flags & MSG_PEEK)) { UNIXCB(skb).consumed += chunk; sk_peek_offset_bwd(sk, chunk); if (UNIXCB(skb).fp) unix_detach_fds(siocb->scm, skb); if (unix_skb_len(skb)) break; skb_unlink(skb, &sk->sk_receive_queue); consume_skb(skb); if (siocb->scm->fp) break; } else { /* It is questionable, see note in unix_dgram_recvmsg. */ if (UNIXCB(skb).fp) siocb->scm->fp = scm_fp_dup(UNIXCB(skb).fp); sk_peek_offset_fwd(sk, chunk); break; } } while (size); mutex_unlock(&u->readlock); scm_recv(sock, msg, siocb->scm, flags); out: return copied ? : err; } ",1 "SVGElement::~SVGElement() { DCHECK(isConnected() || !HasRelativeLengths()); } ",0 "LocalFrameClientImpl::CreateServiceWorkerProvider() { if (!web_frame_->Client()) return nullptr; return web_frame_->Client()->CreateServiceWorkerProvider(); } ",0 "std::map GetExpectedMetaProtoTimes() { std::map expected_meta_proto_times; expected_meta_proto_times[1] = META_PROTO_TIMES(1); expected_meta_proto_times[2] = META_PROTO_TIMES(2); expected_meta_proto_times[4] = META_PROTO_TIMES(4); expected_meta_proto_times[5] = META_PROTO_TIMES(5); expected_meta_proto_times[6] = META_PROTO_TIMES(6); expected_meta_proto_times[7] = META_PROTO_TIMES(7); expected_meta_proto_times[8] = META_PROTO_TIMES(8); expected_meta_proto_times[9] = META_PROTO_TIMES(9); expected_meta_proto_times[10] = META_PROTO_TIMES(10); expected_meta_proto_times[11] = META_PROTO_TIMES(11); expected_meta_proto_times[12] = META_PROTO_TIMES(12); expected_meta_proto_times[13] = META_PROTO_TIMES(13); expected_meta_proto_times[14] = META_PROTO_TIMES(14); return expected_meta_proto_times; } ",1 "void sock_update_netprioidx(struct sock *sk, struct task_struct *task) { if (in_interrupt()) return; sk->sk_cgrp_prioidx = task_netprioidx(task); } ",0 "static inline int forced_push(struct tcp_sock *tp) { return after(tp->write_seq, tp->pushed_seq + (tp->max_window >> 1)); } ",0 "void GpuProcessHost::StoreShaderToDisk(int32_t client_id, const std::string& key, const std::string& shader) { TRACE_EVENT0(""gpu"", ""GpuProcessHost::StoreShaderToDisk""); ClientIdToShaderCacheMap::iterator iter = client_id_to_shader_cache_.find(client_id); if (iter == client_id_to_shader_cache_.end()) return; iter->second->Cache(GetShaderPrefixKey() + "":"" + key, shader); } ",0 "OMX_ERRORTYPE SoftMP3::internalSetParameter( OMX_INDEXTYPE index, const OMX_PTR params) { switch (index) { case OMX_IndexParamStandardComponentRole: { const OMX_PARAM_COMPONENTROLETYPE *roleParams = (const OMX_PARAM_COMPONENTROLETYPE *)params; if (!isValidOMXParam(roleParams)) { return OMX_ErrorBadParameter; } if (strncmp((const char *)roleParams->cRole, ""audio_decoder.mp3"", OMX_MAX_STRINGNAME_SIZE - 1)) { return OMX_ErrorUndefined; } return OMX_ErrorNone; } case OMX_IndexParamAudioPcm: { const OMX_AUDIO_PARAM_PCMMODETYPE *pcmParams = (const OMX_AUDIO_PARAM_PCMMODETYPE *)params; if (!isValidOMXParam(pcmParams)) { return OMX_ErrorBadParameter; } if (pcmParams->nPortIndex != 1) { return OMX_ErrorUndefined; } mNumChannels = pcmParams->nChannels; mSamplingRate = pcmParams->nSamplingRate; return OMX_ErrorNone; } default: return SimpleSoftOMXComponent::internalSetParameter(index, params); } } ",0 "double GfxState::transformWidth(double w) { double x, y; x = ctm[0] + ctm[2]; y = ctm[1] + ctm[3]; return w * sqrt(0.5 * (x * x + y * y)); } ",0 "nfs_request_add_commit_list(struct nfs_page *req, struct list_head *dst, struct nfs_commit_info *cinfo) { set_bit(PG_CLEAN, &(req)->wb_flags); spin_lock(cinfo->lock); nfs_list_add_request(req, dst); cinfo->mds->ncommit++; spin_unlock(cinfo->lock); if (!cinfo->dreq) { inc_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); inc_bdi_stat(page_file_mapping(req->wb_page)->backing_dev_info, BDI_RECLAIMABLE); __mark_inode_dirty(req->wb_context->dentry->d_inode, I_DIRTY_DATASYNC); } } ",0 "void SavePackage::SaveNextFile(bool process_all_remaining_items) { DCHECK(web_contents()); DCHECK(waiting_item_queue_.size()); do { SaveItem* save_item = waiting_item_queue_.front(); waiting_item_queue_.pop(); SaveUrlItemMap::iterator it = in_progress_items_.find( save_item->url().spec()); DCHECK(it == in_progress_items_.end()); in_progress_items_[save_item->url().spec()] = save_item; save_item->Start(); file_manager_->SaveURL(save_item->url(), save_item->referrer(), web_contents()->GetRenderProcessHost()->GetID(), routing_id(), save_item->save_source(), save_item->full_path(), web_contents()-> GetBrowserContext()->GetResourceContext(), this); } while (process_all_remaining_items && waiting_item_queue_.size()); } ",0 "blank_screen(void) { #if CURSES_ENABLED int lpc = 0; for (lpc = 0; lpc < LINES; lpc++) { move(lpc, 0); clrtoeol(); } move(0, 0); refresh(); #endif } ",0 "static int check_ptr_alignment(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, int off, int size) { bool strict = env->strict_alignment; const char *pointer_desc = """"; switch (reg->type) { case PTR_TO_PACKET: case PTR_TO_PACKET_META: /* Special case, because of NET_IP_ALIGN. Given metadata sits * right in front, treat it the very same way. */ return check_pkt_ptr_alignment(env, reg, off, size, strict); case PTR_TO_MAP_VALUE: pointer_desc = ""value ""; break; case PTR_TO_CTX: pointer_desc = ""context ""; break; case PTR_TO_STACK: pointer_desc = ""stack ""; break; default: break; } return check_generic_ptr_alignment(env, reg, pointer_desc, off, size, strict); } ",1 "void DefaultTabHandler::TabDeselected(TabContentsWrapper* contents) { delegate_->AsBrowser()->TabDeselected(contents); } ",0 "int unregister_md_cluster_operations(void) { spin_lock(&pers_lock); md_cluster_ops = NULL; spin_unlock(&pers_lock); return 0; } ",0 "static int decode_zbuf(AVBPrint *bp, const uint8_t *data, const uint8_t *data_end) { z_stream zstream; unsigned char *buf; unsigned buf_size; int ret; zstream.zalloc = ff_png_zalloc; zstream.zfree = ff_png_zfree; zstream.opaque = NULL; if (inflateInit(&zstream) != Z_OK) return AVERROR_EXTERNAL; zstream.next_in = (unsigned char *)data; zstream.avail_in = data_end - data; av_bprint_init(bp, 0, -1); while (zstream.avail_in > 0) { av_bprint_get_buffer(bp, 1, &buf, &buf_size); if (!buf_size) { ret = AVERROR(ENOMEM); goto fail; } zstream.next_out = buf; zstream.avail_out = buf_size; ret = inflate(&zstream, Z_PARTIAL_FLUSH); if (ret != Z_OK && ret != Z_STREAM_END) { ret = AVERROR_EXTERNAL; goto fail; } bp->len += zstream.next_out - buf; if (ret == Z_STREAM_END) break; } inflateEnd(&zstream); bp->str[bp->len] = 0; return 0; fail: inflateEnd(&zstream); av_bprint_finalize(bp, NULL); return ret; } ",1 "static void __hw_addr_unsync(struct netdev_hw_addr_list *to_list, struct netdev_hw_addr_list *from_list, int addr_len) { struct netdev_hw_addr *ha, *tmp; list_for_each_entry_safe(ha, tmp, &from_list->list, list) { if (ha->synced) { __hw_addr_del(to_list, ha->addr, addr_len, ha->type); ha->synced = false; __hw_addr_del(from_list, ha->addr, addr_len, ha->type); } } } ",0 "VOID TCUnloadDriver (PDRIVER_OBJECT DriverObject) { Dump (""TCUnloadDriver BEGIN\n""); OnShutdownPending(); if (IsBootDriveMounted()) TC_BUG_CHECK (STATUS_INVALID_DEVICE_STATE); EncryptionThreadPoolStop(); TCDeleteDeviceObject (RootDeviceObject, (PEXTENSION) RootDeviceObject->DeviceExtension); Dump (""TCUnloadDriver END\n""); } ",0 "ASN1_TIME *X509_gmtime_adj(ASN1_TIME *s, long adj) { return X509_time_adj(s, adj, NULL); } ",0 "static int csnmp_strvbcopy(char *dst, /* {{{ */ const struct variable_list *vb, size_t dst_size) { char *src; size_t num_chars; if (vb->type == ASN_OCTET_STR) src = (char *)vb->val.string; else if (vb->type == ASN_BIT_STR) src = (char *)vb->val.bitstring; else if (vb->type == ASN_IPADDRESS) { return ssnprintf(dst, dst_size, ""%"" PRIu8 "".%"" PRIu8 "".%"" PRIu8 "".%"" PRIu8 """", (uint8_t)vb->val.string[0], (uint8_t)vb->val.string[1], (uint8_t)vb->val.string[2], (uint8_t)vb->val.string[3]); } else { dst[0] = 0; return (EINVAL); } num_chars = dst_size - 1; if (num_chars > vb->val_len) num_chars = vb->val_len; for (size_t i = 0; i < num_chars; i++) { /* Check for control characters. */ if ((unsigned char)src[i] < 32) return (csnmp_strvbcopy_hexstring(dst, vb, dst_size)); dst[i] = src[i]; } dst[num_chars] = 0; dst[dst_size - 1] = 0; if (dst_size <= vb->val_len) return ENOMEM; return 0; } /* }}} int csnmp_strvbcopy */ ",0 "static int handle_vmcall(struct kvm_vcpu *vcpu) { kvm_emulate_hypercall(vcpu); return 1; } ",0 "void snd_usb_unlock_shutdown(struct snd_usb_audio *chip) { snd_usb_autosuspend(chip); if (atomic_dec_and_test(&chip->usage_count)) wake_up(&chip->shutdown_wait); } ",0 "void RenderLayerScrollableArea::updateAfterStyleChange(const RenderStyle* oldStyle) { if (!canHaveOverflowScrollbars(box())) return; if (!m_scrollDimensionsDirty) updateScrollableAreaSet(hasScrollableHorizontalOverflow() || hasScrollableVerticalOverflow()); EOverflow overflowX = box().style()->overflowX(); EOverflow overflowY = box().style()->overflowY(); bool needsHorizontalScrollbar = (hasHorizontalScrollbar() && overflowDefinesAutomaticScrollbar(overflowX)) || overflowRequiresScrollbar(overflowX); bool needsVerticalScrollbar = (hasVerticalScrollbar() && overflowDefinesAutomaticScrollbar(overflowY)) || overflowRequiresScrollbar(overflowY); setHasHorizontalScrollbar(needsHorizontalScrollbar); setHasVerticalScrollbar(needsVerticalScrollbar); if (needsHorizontalScrollbar && oldStyle && oldStyle->overflowX() == OSCROLL && overflowX != OSCROLL) { ASSERT(hasHorizontalScrollbar()); m_hBar->setEnabled(true); } if (needsVerticalScrollbar && oldStyle && oldStyle->overflowY() == OSCROLL && overflowY != OSCROLL) { ASSERT(hasVerticalScrollbar()); m_vBar->setEnabled(true); } if (m_hBar) m_hBar->styleChanged(); if (m_vBar) m_vBar->styleChanged(); updateScrollCornerStyle(); updateResizerAreaSet(); updateResizerStyle(); } ",0 "static void Free_MarkBasePos( HB_GPOS_SubTable* st ) { HB_MarkBasePos* mbp = &st->markbase; Free_BaseArray( &mbp->BaseArray, mbp->ClassCount ); Free_MarkArray( &mbp->MarkArray ); _HB_OPEN_Free_Coverage( &mbp->BaseCoverage ); _HB_OPEN_Free_Coverage( &mbp->MarkCoverage ); } ",0 "static inline u32 xswap(u32 val) { return ((val & 0x00ff00ff) << 8) | ((val & 0xff00ff00) >> 8); } ",0 "status_t MediaPlayer::prepare() { ALOGV(""prepare""); Mutex::Autolock _l(mLock); mLockThreadId = getThreadId(); if (mPrepareSync) { mLockThreadId = 0; return -EALREADY; } mPrepareSync = true; status_t ret = prepareAsync_l(); if (ret != NO_ERROR) { mLockThreadId = 0; return ret; } if (mPrepareSync) { mSignal.wait(mLock); // wait for prepare done mPrepareSync = false; } ALOGV(""prepare complete - status=%d"", mPrepareStatus); mLockThreadId = 0; return mPrepareStatus; } ",0 "static void frag_set_pending_idx(skb_frag_t *frag, u16 pending_idx) { frag->page_offset = pending_idx; } ",0 "bool Document::hasManifest() const { return documentElement() && documentElement()->hasTagName(htmlTag) && documentElement()->hasAttribute(manifestAttr); } ",0 "AffineTransform& AffineTransform::translate(double tx, double ty) { if (isIdentityOrTranslation()) { m_transform[4] += tx; m_transform[5] += ty; return *this; } m_transform[4] += tx * m_transform[0] + ty * m_transform[2]; m_transform[5] += tx * m_transform[1] + ty * m_transform[3]; return *this; } ",0 "void jpc_ms_dump(jpc_ms_t *ms, FILE *out) { jpc_mstabent_t *mstabent; mstabent = jpc_mstab_lookup(ms->id); fprintf(out, ""type = 0x%04""PRIxFAST16"" (%s);"", ms->id, mstabent->name); if (JPC_MS_HASPARMS(ms->id)) { fprintf(out, "" len = %""PRIuFAST16"";"", ms->len + 2); if (ms->ops->dumpparms) { (*ms->ops->dumpparms)(ms, out); } else { fprintf(out, ""\n""); } } else { fprintf(out, ""\n""); } } ",0 "static void __exit pppoe_exit(void) { unregister_netdevice_notifier(&pppoe_notifier); dev_remove_pack(&pppoed_ptype); dev_remove_pack(&pppoes_ptype); unregister_pppox_proto(PX_PROTO_OE); proto_unregister(&pppoe_sk_proto); unregister_pernet_device(&pppoe_net_ops); } ",0 "void kvm_ioapic_calculate_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) { struct kvm_ioapic *ioapic = vcpu->kvm->arch.vioapic; union kvm_ioapic_redirect_entry *e; struct kvm_lapic_irq irqe; int index; spin_lock(&ioapic->lock); /* traverse ioapic entry to set eoi exit bitmap*/ for (index = 0; index < IOAPIC_NUM_PINS; index++) { e = &ioapic->redirtbl[index]; if (!e->fields.mask && (e->fields.trig_mode == IOAPIC_LEVEL_TRIG || kvm_irq_has_notifier(ioapic->kvm, KVM_IRQCHIP_IOAPIC, index))) { irqe.dest_id = e->fields.dest_id; irqe.vector = e->fields.vector; irqe.dest_mode = e->fields.dest_mode; irqe.delivery_mode = e->fields.delivery_mode << 8; kvm_calculate_eoi_exitmap(vcpu, &irqe, eoi_exit_bitmap); } } spin_unlock(&ioapic->lock); } ",0 "static void SVGIgnorableWhitespace(void *context,const xmlChar *c,int length) { SVGInfo *svg_info; /* Receiving some ignorable whitespaces from the parser. */ (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" SAX.ignorableWhitespace(%.30s, %d)"",c,length); svg_info=(SVGInfo *) context; (void) svg_info; } ",0 "char decchar(int x) { return '0' + (x % 10); } ",0 "int Reverb_getParameter(ReverbContext *pContext, void *pParam, uint32_t *pValueSize, void *pValue){ int status = 0; int32_t *pParamTemp = (int32_t *)pParam; int32_t param = *pParamTemp++; t_reverb_settings *pProperties; if (pContext->preset) { if (param != REVERB_PARAM_PRESET || *pValueSize < sizeof(uint16_t)) { return -EINVAL; } *(uint16_t *)pValue = pContext->nextPreset; ALOGV(""get REVERB_PARAM_PRESET, preset %d"", pContext->nextPreset); return 0; } switch (param){ case REVERB_PARAM_ROOM_LEVEL: if (*pValueSize != sizeof(int16_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize1 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(int16_t); break; case REVERB_PARAM_ROOM_HF_LEVEL: if (*pValueSize != sizeof(int16_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize12 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(int16_t); break; case REVERB_PARAM_DECAY_TIME: if (*pValueSize != sizeof(uint32_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize3 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(uint32_t); break; case REVERB_PARAM_DECAY_HF_RATIO: if (*pValueSize != sizeof(int16_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize4 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(int16_t); break; case REVERB_PARAM_REFLECTIONS_LEVEL: if (*pValueSize != sizeof(int16_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize5 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(int16_t); break; case REVERB_PARAM_REFLECTIONS_DELAY: if (*pValueSize != sizeof(uint32_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize6 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(uint32_t); break; case REVERB_PARAM_REVERB_LEVEL: if (*pValueSize != sizeof(int16_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize7 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(int16_t); break; case REVERB_PARAM_REVERB_DELAY: if (*pValueSize != sizeof(uint32_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize8 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(uint32_t); break; case REVERB_PARAM_DIFFUSION: if (*pValueSize != sizeof(int16_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize9 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(int16_t); break; case REVERB_PARAM_DENSITY: if (*pValueSize != sizeof(int16_t)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize10 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(int16_t); break; case REVERB_PARAM_PROPERTIES: if (*pValueSize != sizeof(t_reverb_settings)){ ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid pValueSize11 %d"", *pValueSize); return -EINVAL; } *pValueSize = sizeof(t_reverb_settings); break; default: ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid param %d"", param); return -EINVAL; } pProperties = (t_reverb_settings *) pValue; switch (param){ case REVERB_PARAM_PROPERTIES: pProperties->roomLevel = ReverbGetRoomLevel(pContext); pProperties->roomHFLevel = ReverbGetRoomHfLevel(pContext); pProperties->decayTime = ReverbGetDecayTime(pContext); pProperties->decayHFRatio = ReverbGetDecayHfRatio(pContext); pProperties->reflectionsLevel = 0; pProperties->reflectionsDelay = 0; pProperties->reverbDelay = 0; pProperties->reverbLevel = ReverbGetReverbLevel(pContext); pProperties->diffusion = ReverbGetDiffusion(pContext); pProperties->density = ReverbGetDensity(pContext); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomLevel %d"", pProperties->roomLevel); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is roomHFLevel %d"", pProperties->roomHFLevel); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayTime %d"", pProperties->decayTime); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is decayHFRatio %d"", pProperties->decayHFRatio); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsLevel %d"", pProperties->reflectionsLevel); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reflectionsDelay %d"", pProperties->reflectionsDelay); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbDelay %d"", pProperties->reverbDelay); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is reverbLevel %d"", pProperties->reverbLevel); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is diffusion %d"", pProperties->diffusion); ALOGV(""\tReverb_getParameter() REVERB_PARAM_PROPERTIES Value is density %d"", pProperties->density); break; case REVERB_PARAM_ROOM_LEVEL: *(int16_t *)pValue = ReverbGetRoomLevel(pContext); break; case REVERB_PARAM_ROOM_HF_LEVEL: *(int16_t *)pValue = ReverbGetRoomHfLevel(pContext); break; case REVERB_PARAM_DECAY_TIME: *(uint32_t *)pValue = ReverbGetDecayTime(pContext); break; case REVERB_PARAM_DECAY_HF_RATIO: *(int16_t *)pValue = ReverbGetDecayHfRatio(pContext); break; case REVERB_PARAM_REVERB_LEVEL: *(int16_t *)pValue = ReverbGetReverbLevel(pContext); break; case REVERB_PARAM_DIFFUSION: *(int16_t *)pValue = ReverbGetDiffusion(pContext); break; case REVERB_PARAM_DENSITY: *(uint16_t *)pValue = 0; *(int16_t *)pValue = ReverbGetDensity(pContext); break; case REVERB_PARAM_REFLECTIONS_LEVEL: *(uint16_t *)pValue = 0; case REVERB_PARAM_REFLECTIONS_DELAY: *(uint32_t *)pValue = 0; case REVERB_PARAM_REVERB_DELAY: *(uint32_t *)pValue = 0; break; default: ALOGV(""\tLVM_ERROR : Reverb_getParameter() invalid param %d"", param); status = -EINVAL; break; } return status; } /* end Reverb_getParameter */ ",0 "MojoResult Core::FuseMessagePipes(MojoHandle handle0, MojoHandle handle1) { RequestContext request_context; scoped_refptr dispatcher0; scoped_refptr dispatcher1; bool valid_handles = true; { base::AutoLock lock(handles_->GetLock()); MojoResult result0 = handles_->GetAndRemoveDispatcher(handle0, &dispatcher0); MojoResult result1 = handles_->GetAndRemoveDispatcher(handle1, &dispatcher1); if (result0 != MOJO_RESULT_OK || result1 != MOJO_RESULT_OK || dispatcher0->GetType() != Dispatcher::Type::MESSAGE_PIPE || dispatcher1->GetType() != Dispatcher::Type::MESSAGE_PIPE) valid_handles = false; } if (!valid_handles) { if (dispatcher0) dispatcher0->Close(); if (dispatcher1) dispatcher1->Close(); return MOJO_RESULT_INVALID_ARGUMENT; } MessagePipeDispatcher* mpd0 = static_cast(dispatcher0.get()); MessagePipeDispatcher* mpd1 = static_cast(dispatcher1.get()); if (!mpd0->Fuse(mpd1)) return MOJO_RESULT_FAILED_PRECONDITION; return MOJO_RESULT_OK; } ",0 "void TabCountChangeObserver::TabInsertedAt(WebContents* contents, int index, bool foreground) { CheckTabCount(); } ",0 " static int au1200fb_fb_mmap(struct fb_info *info, struct vm_area_struct *vma) { unsigned int len; unsigned long start=0, off; struct au1200fb_device *fbdev = info->par; if (vma->vm_pgoff > (~0UL >> PAGE_SHIFT)) { return -EINVAL; } start = fbdev->fb_phys & PAGE_MASK; len = PAGE_ALIGN((start & ~PAGE_MASK) + fbdev->fb_len); off = vma->vm_pgoff << PAGE_SHIFT; if ((vma->vm_end - vma->vm_start + off) > len) { return -EINVAL; } off += start; vma->vm_pgoff = off >> PAGE_SHIFT; vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); pgprot_val(vma->vm_page_prot) |= _CACHE_MASK; /* CCA=7 */ return io_remap_pfn_range(vma, vma->vm_start, off >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot); } ",1 "void ipmi_unregister_smi(struct ipmi_smi *intf) { struct ipmi_smi_watcher *w; int intf_num = intf->intf_num, index; mutex_lock(&ipmi_interfaces_mutex); intf->intf_num = -1; intf->in_shutdown = true; list_del_rcu(&intf->link); mutex_unlock(&ipmi_interfaces_mutex); synchronize_srcu(&ipmi_interfaces_srcu); /* At this point no users can be added to the interface. */ /* * Call all the watcher interfaces to tell them that * an interface is going away. */ mutex_lock(&smi_watchers_mutex); list_for_each_entry(w, &smi_watchers, link) w->smi_gone(intf_num); mutex_unlock(&smi_watchers_mutex); index = srcu_read_lock(&intf->users_srcu); while (!list_empty(&intf->users)) { struct ipmi_user *user = container_of(list_next_rcu(&intf->users), struct ipmi_user, link); _ipmi_destroy_user(user); } srcu_read_unlock(&intf->users_srcu, index); if (intf->handlers->shutdown) intf->handlers->shutdown(intf->send_info); cleanup_smi_msgs(intf); ipmi_bmc_unregister(intf); cleanup_srcu_struct(&intf->users_srcu); kref_put(&intf->refcount, intf_free); } ",0 "start_thread_common(struct pt_regs *regs, unsigned long new_ip, unsigned long new_sp, unsigned int _cs, unsigned int _ss, unsigned int _ds) { loadsegment(fs, 0); loadsegment(es, _ds); loadsegment(ds, _ds); load_gs_index(0); current->thread.usersp = new_sp; regs->ip = new_ip; regs->sp = new_sp; this_cpu_write(old_rsp, new_sp); regs->cs = _cs; regs->ss = _ss; regs->flags = X86_EFLAGS_IF; } ",0 "static void process_lru_command(conn *c, token_t *tokens, const size_t ntokens) { uint32_t pct_hot; uint32_t pct_warm; uint32_t hot_age; int32_t ttl; double factor; set_noreply_maybe(c, tokens, ntokens); if (strcmp(tokens[1].value, ""tune"") == 0 && ntokens >= 7) { if (!safe_strtoul(tokens[2].value, &pct_hot) || !safe_strtoul(tokens[3].value, &pct_warm) || !safe_strtoul(tokens[4].value, &hot_age) || !safe_strtod(tokens[5].value, &factor)) { out_string(c, ""ERROR""); } else { if (pct_hot + pct_warm > 80) { out_string(c, ""ERROR hot and warm pcts must not exceed 80""); } else if (factor <= 0) { out_string(c, ""ERROR cold age factor must be greater than 0""); } else { settings.hot_lru_pct = pct_hot; settings.warm_lru_pct = pct_warm; settings.hot_max_age = hot_age; settings.warm_max_factor = factor; out_string(c, ""OK""); } } } else if (strcmp(tokens[1].value, ""mode"") == 0 && ntokens >= 3 && settings.lru_maintainer_thread) { if (strcmp(tokens[2].value, ""flat"") == 0) { settings.lru_segmented = false; out_string(c, ""OK""); } else if (strcmp(tokens[2].value, ""segmented"") == 0) { settings.lru_segmented = true; out_string(c, ""OK""); } else { out_string(c, ""ERROR""); } } else if (strcmp(tokens[1].value, ""temp_ttl"") == 0 && ntokens >= 3 && settings.lru_maintainer_thread) { if (!safe_strtol(tokens[2].value, &ttl)) { out_string(c, ""ERROR""); } else { if (ttl < 0) { settings.temp_lru = false; } else { settings.temp_lru = true; settings.temporary_ttl = ttl; } out_string(c, ""OK""); } } else { out_string(c, ""ERROR""); } } ",0 "OJPEGWriteStreamEoi(TIFF* tif, void** mem, uint32* len) { OJPEGState* sp=(OJPEGState*)tif->tif_data; assert(OJPEG_BUFFER>=2); sp->out_buffer[0]=255; sp->out_buffer[1]=JPEG_MARKER_EOI; *len=2; *mem=(void*)sp->out_buffer; } ",0 "void ib_uverbs_free_async_event_file(struct ib_uverbs_file *file) { kref_put(&file->async_file->ref, ib_uverbs_release_async_event_file); file->async_file = NULL; } ",0 "void RenderFrameImpl::didAddMessageToConsole( const blink::WebConsoleMessage& message, const blink::WebString& source_name, unsigned source_line, const blink::WebString& stack_trace) { logging::LogSeverity log_severity = logging::LOG_VERBOSE; switch (message.level) { case blink::WebConsoleMessage::LevelDebug: log_severity = logging::LOG_VERBOSE; break; case blink::WebConsoleMessage::LevelLog: case blink::WebConsoleMessage::LevelInfo: log_severity = logging::LOG_INFO; break; case blink::WebConsoleMessage::LevelWarning: log_severity = logging::LOG_WARNING; break; case blink::WebConsoleMessage::LevelError: log_severity = logging::LOG_ERROR; break; default: log_severity = logging::LOG_VERBOSE; } if (shouldReportDetailedMessageForSource(source_name)) { FOR_EACH_OBSERVER( RenderFrameObserver, observers_, DetailedConsoleMessageAdded(message.text, source_name, stack_trace, source_line, static_cast(log_severity))); } Send(new FrameHostMsg_AddMessageToConsole(routing_id_, static_cast(log_severity), message.text, static_cast(source_line), source_name)); } ",0 "DownloadItemImpl::DestinationObserverAsWeakPtr() { return weak_ptr_factory_.GetWeakPtr(); } ",0 "static bool check_hw_exists(void) { u64 val, val_new = 0; int i, reg, ret = 0; /* * Check to see if the BIOS enabled any of the counters, if so * complain and bail. */ for (i = 0; i < x86_pmu.num_counters; i++) { reg = x86_pmu_config_addr(i); ret = rdmsrl_safe(reg, &val); if (ret) goto msr_fail; if (val & ARCH_PERFMON_EVENTSEL_ENABLE) goto bios_fail; } if (x86_pmu.num_counters_fixed) { reg = MSR_ARCH_PERFMON_FIXED_CTR_CTRL; ret = rdmsrl_safe(reg, &val); if (ret) goto msr_fail; for (i = 0; i < x86_pmu.num_counters_fixed; i++) { if (val & (0x03 << i*4)) goto bios_fail; } } /* * Now write a value and read it back to see if it matches, * this is needed to detect certain hardware emulators (qemu/kvm) * that don't trap on the MSR access and always return 0s. */ val = 0xabcdUL; ret = checking_wrmsrl(x86_pmu_event_addr(0), val); ret |= rdmsrl_safe(x86_pmu_event_addr(0), &val_new); if (ret || val != val_new) goto msr_fail; return true; bios_fail: /* * We still allow the PMU driver to operate: */ printk(KERN_CONT ""Broken BIOS detected, complain to your hardware vendor.\n""); printk(KERN_ERR FW_BUG ""the BIOS has corrupted hw-PMU resources (MSR %x is %Lx)\n"", reg, val); return true; msr_fail: printk(KERN_CONT ""Broken PMU hardware detected, using software events only.\n""); return false; } ",0 "bool ResourceDispatcherHostImpl::DoNotPromptForLogin( ResourceType resource_type, const GURL& url, const GURL& site_for_cookies) { if (resource_type == RESOURCE_TYPE_IMAGE && HTTP_AUTH_RELATION_BLOCKED_CROSS == HttpAuthRelationTypeOf(url, site_for_cookies)) { return true; } return false; } ",0 "int CRYPTO_THREAD_set_local(CRYPTO_THREAD_LOCAL *key, void *val) { if (*key >= OPENSSL_CRYPTO_THREAD_LOCAL_KEY_MAX) return 0; thread_local_storage[*key] = val; return 1; } ",0 "psf_fread (void *ptr, sf_count_t bytes, sf_count_t items, SF_PRIVATE *psf) { sf_count_t total = 0 ; ssize_t count ; if (psf->virtual_io) return psf->vio.read (ptr, bytes*items, psf->vio_user_data) / bytes ; items *= bytes ; /* Do this check after the multiplication above. */ if (items <= 0) return 0 ; while (items > 0) { /* Break the writes down to a sensible size. */ count = (items > SENSIBLE_SIZE) ? SENSIBLE_SIZE : (ssize_t) items ; count = read (psf->file.filedes, ((char*) ptr) + total, (size_t) count) ; if (count == -1) { if (errno == EINTR) continue ; psf_log_syserr (psf, errno) ; break ; } ; if (count == 0) break ; total += count ; items -= count ; } ; return total / bytes ; } /* psf_fread */ ",0 "static void pppol2tp_next_tunnel(struct net *net, struct pppol2tp_seq_data *pd) { for (;;) { pd->tunnel = l2tp_tunnel_find_nth(net, pd->tunnel_idx); pd->tunnel_idx++; if (pd->tunnel == NULL) break; /* Ignore L2TPv3 tunnels */ if (pd->tunnel->version < 3) break; } } ",0 "struct inode *__udf_iget(struct super_block *sb, struct kernel_lb_addr *ino, bool hidden_inode) { unsigned long block = udf_get_lb_pblock(sb, ino, 0); struct inode *inode = iget_locked(sb, block); int err; if (!inode) return ERR_PTR(-ENOMEM); if (!(inode->i_state & I_NEW)) return inode; memcpy(&UDF_I(inode)->i_location, ino, sizeof(struct kernel_lb_addr)); err = udf_read_inode(inode, hidden_inode); if (err < 0) { iget_failed(inode); return ERR_PTR(err); } unlock_new_inode(inode); return inode; } ",0 "static bool shmem_should_replace_page(struct page *page, gfp_t gfp) { return page_zonenum(page) > gfp_zone(gfp); } ",0 "int nfs_map_gid_to_group(const struct nfs_server *server, kgid_t gid, char *buf, size_t buflen) { struct idmap *idmap = server->nfs_client->cl_idmap; int ret = -EINVAL; __u32 id; id = from_kgid(&init_user_ns, gid); if (!(server->caps & NFS_CAP_UIDGID_NOMAP)) ret = nfs_idmap_lookup_name(id, ""group"", buf, buflen, idmap); if (ret < 0) ret = nfs_map_numeric_to_string(id, buf, buflen); trace_nfs4_map_gid_to_group(buf, ret, id, ret); return ret; } ",0 "static u32 rt_peer_genid(void) { return atomic_read(&__rt_peer_genid); } ",0 "bool OmniboxEditModel::CreatedKeywordSearchByInsertingSpaceInMiddle( const base::string16& old_text, const base::string16& new_text, size_t caret_position) const { DCHECK_GE(new_text.length(), caret_position); if ((paste_state_ != NONE) || (caret_position < 2) || (old_text.length() < caret_position) || (new_text.length() == caret_position)) return false; size_t space_position = caret_position - 1; if (!IsSpaceCharForAcceptingKeyword(new_text[space_position]) || IsWhitespace(new_text[space_position - 1]) || new_text.compare(0, space_position, old_text, 0, space_position) || !new_text.compare(space_position, new_text.length() - space_position, old_text, space_position, old_text.length() - space_position)) { return false; } base::string16 keyword; base::TrimWhitespace(new_text.substr(0, space_position), base::TRIM_LEADING, &keyword); return !keyword.empty() && !autocomplete_controller()->keyword_provider()-> GetKeywordForText(keyword).empty(); } ",0 "static int sctp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen) { int retval = 0; int len; pr_debug(""%s: sk:%p, optname:%d\n"", __func__, sk, optname); /* I can hardly begin to describe how wrong this is. This is * so broken as to be worse than useless. The API draft * REALLY is NOT helpful here... I am not convinced that the * semantics of getsockopt() with a level OTHER THAN SOL_SCTP * are at all well-founded. */ if (level != SOL_SCTP) { struct sctp_af *af = sctp_sk(sk)->pf->af; retval = af->getsockopt(sk, level, optname, optval, optlen); return retval; } if (get_user(len, optlen)) return -EFAULT; if (len < 0) return -EINVAL; lock_sock(sk); switch (optname) { case SCTP_STATUS: retval = sctp_getsockopt_sctp_status(sk, len, optval, optlen); break; case SCTP_DISABLE_FRAGMENTS: retval = sctp_getsockopt_disable_fragments(sk, len, optval, optlen); break; case SCTP_EVENTS: retval = sctp_getsockopt_events(sk, len, optval, optlen); break; case SCTP_AUTOCLOSE: retval = sctp_getsockopt_autoclose(sk, len, optval, optlen); break; case SCTP_SOCKOPT_PEELOFF: retval = sctp_getsockopt_peeloff(sk, len, optval, optlen); break; case SCTP_PEER_ADDR_PARAMS: retval = sctp_getsockopt_peer_addr_params(sk, len, optval, optlen); break; case SCTP_DELAYED_SACK: retval = sctp_getsockopt_delayed_ack(sk, len, optval, optlen); break; case SCTP_INITMSG: retval = sctp_getsockopt_initmsg(sk, len, optval, optlen); break; case SCTP_GET_PEER_ADDRS: retval = sctp_getsockopt_peer_addrs(sk, len, optval, optlen); break; case SCTP_GET_LOCAL_ADDRS: retval = sctp_getsockopt_local_addrs(sk, len, optval, optlen); break; case SCTP_SOCKOPT_CONNECTX3: retval = sctp_getsockopt_connectx3(sk, len, optval, optlen); break; case SCTP_DEFAULT_SEND_PARAM: retval = sctp_getsockopt_default_send_param(sk, len, optval, optlen); break; case SCTP_DEFAULT_SNDINFO: retval = sctp_getsockopt_default_sndinfo(sk, len, optval, optlen); break; case SCTP_PRIMARY_ADDR: retval = sctp_getsockopt_primary_addr(sk, len, optval, optlen); break; case SCTP_NODELAY: retval = sctp_getsockopt_nodelay(sk, len, optval, optlen); break; case SCTP_RTOINFO: retval = sctp_getsockopt_rtoinfo(sk, len, optval, optlen); break; case SCTP_ASSOCINFO: retval = sctp_getsockopt_associnfo(sk, len, optval, optlen); break; case SCTP_I_WANT_MAPPED_V4_ADDR: retval = sctp_getsockopt_mappedv4(sk, len, optval, optlen); break; case SCTP_MAXSEG: retval = sctp_getsockopt_maxseg(sk, len, optval, optlen); break; case SCTP_GET_PEER_ADDR_INFO: retval = sctp_getsockopt_peer_addr_info(sk, len, optval, optlen); break; case SCTP_ADAPTATION_LAYER: retval = sctp_getsockopt_adaptation_layer(sk, len, optval, optlen); break; case SCTP_CONTEXT: retval = sctp_getsockopt_context(sk, len, optval, optlen); break; case SCTP_FRAGMENT_INTERLEAVE: retval = sctp_getsockopt_fragment_interleave(sk, len, optval, optlen); break; case SCTP_PARTIAL_DELIVERY_POINT: retval = sctp_getsockopt_partial_delivery_point(sk, len, optval, optlen); break; case SCTP_MAX_BURST: retval = sctp_getsockopt_maxburst(sk, len, optval, optlen); break; case SCTP_AUTH_KEY: case SCTP_AUTH_CHUNK: case SCTP_AUTH_DELETE_KEY: retval = -EOPNOTSUPP; break; case SCTP_HMAC_IDENT: retval = sctp_getsockopt_hmac_ident(sk, len, optval, optlen); break; case SCTP_AUTH_ACTIVE_KEY: retval = sctp_getsockopt_active_key(sk, len, optval, optlen); break; case SCTP_PEER_AUTH_CHUNKS: retval = sctp_getsockopt_peer_auth_chunks(sk, len, optval, optlen); break; case SCTP_LOCAL_AUTH_CHUNKS: retval = sctp_getsockopt_local_auth_chunks(sk, len, optval, optlen); break; case SCTP_GET_ASSOC_NUMBER: retval = sctp_getsockopt_assoc_number(sk, len, optval, optlen); break; case SCTP_GET_ASSOC_ID_LIST: retval = sctp_getsockopt_assoc_ids(sk, len, optval, optlen); break; case SCTP_AUTO_ASCONF: retval = sctp_getsockopt_auto_asconf(sk, len, optval, optlen); break; case SCTP_PEER_ADDR_THLDS: retval = sctp_getsockopt_paddr_thresholds(sk, optval, len, optlen); break; case SCTP_GET_ASSOC_STATS: retval = sctp_getsockopt_assoc_stats(sk, len, optval, optlen); break; case SCTP_RECVRCVINFO: retval = sctp_getsockopt_recvrcvinfo(sk, len, optval, optlen); break; case SCTP_RECVNXTINFO: retval = sctp_getsockopt_recvnxtinfo(sk, len, optval, optlen); break; case SCTP_PR_SUPPORTED: retval = sctp_getsockopt_pr_supported(sk, len, optval, optlen); break; case SCTP_DEFAULT_PRINFO: retval = sctp_getsockopt_default_prinfo(sk, len, optval, optlen); break; case SCTP_PR_ASSOC_STATUS: retval = sctp_getsockopt_pr_assocstatus(sk, len, optval, optlen); break; case SCTP_ENABLE_STREAM_RESET: retval = sctp_getsockopt_enable_strreset(sk, len, optval, optlen); break; default: retval = -ENOPROTOOPT; break; } release_sock(sk); return retval; } ",0 "void GDataFileSystem::OnGetEntryCompleteForCloseFile( const FilePath& file_path, const base::PlatformFileInfo& file_info, const FileOperationCallback& callback, GDataFileError error, GDataEntry* entry) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { if (!callback.is_null()) callback.Run(error); return; } DCHECK(entry); GDataFile* file = entry->AsGDataFile(); if (!file || file->file_md5().empty() || file->is_hosted_document()) { if (!callback.is_null()) callback.Run(GDATA_FILE_ERROR_INVALID_OPERATION); return; } DCHECK(!file->resource_id().empty()); file->set_file_info(file_info); cache_->CommitDirtyOnUIThread( file->resource_id(), file->file_md5(), base::Bind(&GDataFileSystem::OnCommitDirtyInCacheCompleteForCloseFile, ui_weak_ptr_, callback)); } ",0 "static void overloadedPerWorldBindingsMethodMethod(const v8::FunctionCallbackInfo& info) { if (((info.Length() == 0))) { overloadedPerWorldBindingsMethod1Method(info); return; } if (((info.Length() == 1))) { overloadedPerWorldBindingsMethod2Method(info); return; } throwTypeError(ExceptionMessages::failedToExecute(""overloadedPerWorldBindingsMethod"", ""TestObjectPython"", ""No function was found that matched the signature provided.""), info.GetIsolate()); } ",0 "void ProfileDependencyManager::BuildDestructionOrder(Profile* profile) { #if !defined(NDEBUG) if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kDumpProfileDependencyGraph)) { FilePath dot_file = profile->GetPath().AppendASCII(""profile-dependencies.dot""); std::string contents = DumpGraphvizDependency(); file_util::WriteFile(dot_file, contents.c_str(), contents.size()); } #endif std::deque queue; std::copy(all_components_.begin(), all_components_.end(), std::back_inserter(queue)); std::deque::iterator queue_end = queue.end(); for (EdgeMap::const_iterator it = edges_.begin(); it != edges_.end(); ++it) { queue_end = std::remove(queue.begin(), queue_end, it->second); } queue.erase(queue_end, queue.end()); std::vector output; EdgeMap edges(edges_); while (!queue.empty()) { ProfileKeyedBaseFactory* node = queue.front(); queue.pop_front(); output.push_back(node); std::pair range = edges.equal_range(node); EdgeMap::iterator it = range.first; while (it != range.second) { ProfileKeyedBaseFactory* dest = it->second; EdgeMap::iterator temp = it; it++; edges.erase(temp); bool has_incoming_edges = false; for (EdgeMap::iterator jt = edges.begin(); jt != edges.end(); ++jt) { if (jt->second == dest) { has_incoming_edges = true; break; } } if (!has_incoming_edges) queue.push_back(dest); } } if (edges.size()) { NOTREACHED() << ""Dependency graph has a cycle. We are doomed.""; } std::reverse(output.begin(), output.end()); destruction_order_ = output; } ",0 "static void put_pipe_info(struct inode *inode, struct pipe_inode_info *pipe) { int kill = 0; spin_lock(&inode->i_lock); if (!--pipe->files) { inode->i_pipe = NULL; kill = 1; } spin_unlock(&inode->i_lock); if (kill) free_pipe_info(pipe); } ",0 "static int do_i2c_smbus_ioctl(unsigned int fd, unsigned int cmd, struct i2c_smbus_ioctl_data32 __user *udata) { struct i2c_smbus_ioctl_data __user *tdata; compat_caddr_t datap; tdata = compat_alloc_user_space(sizeof(*tdata)); if (tdata == NULL) return -ENOMEM; if (!access_ok(VERIFY_WRITE, tdata, sizeof(*tdata))) return -EFAULT; if (!access_ok(VERIFY_READ, udata, sizeof(*udata))) return -EFAULT; if (__copy_in_user(&tdata->read_write, &udata->read_write, 2 * sizeof(u8))) return -EFAULT; if (__copy_in_user(&tdata->size, &udata->size, 2 * sizeof(u32))) return -EFAULT; if (__get_user(datap, &udata->data) || __put_user(compat_ptr(datap), &tdata->data)) return -EFAULT; return sys_ioctl(fd, cmd, (unsigned long)tdata); } ",0 "bool ComponentControllerImpl::BindToRequest( fuchsia::sys::Package package, fuchsia::sys::StartupInfo startup_info, fidl::InterfaceRequest controller_request) { DCHECK(!service_directory_); DCHECK(!view_provider_binding_); url_ = GURL(*package.resolved_url); if (!url_.is_valid()) { LOG(ERROR) << ""Rejected invalid URL: "" << url_; return false; } if (controller_request.is_valid()) { controller_binding_.Bind(std::move(controller_request)); controller_binding_.set_error_handler( fit::bind_member(this, &ComponentControllerImpl::Kill)); } runner_->context()->CreateFrame(frame_observer_binding_.NewBinding(), frame_.NewRequest()); frame_->GetNavigationController(navigation_controller_.NewRequest()); navigation_controller_->LoadUrl(url_.spec(), nullptr); service_directory_ = std::make_unique( std::move(startup_info.launch_info.directory_request)); view_provider_binding_ = std::make_unique< base::fuchsia::ScopedServiceBinding>( service_directory_.get(), this); return true; } ",1 "const btav_sink_interface_t* btif_av_get_sink_interface(void) { BTIF_TRACE_EVENT(""%s"", __func__); return &bt_av_sink_interface; } ",0 " TemplateURLService* CreateTemplateURLService() { TemplateURLData data; data.SetURL(""https://foobar.com/url?bar={searchTerms}""); data.contextual_search_url = ""https://foobar.com/_/contextualsearch?"" ""{google:contextualSearchVersion}{google:contextualSearchContextData}""; TemplateURLService* template_url_service = new TemplateURLService(NULL, 0); TemplateURL* template_url = template_url_service->Add(base::MakeUnique(data)); template_url_service->SetUserSelectedDefaultSearchProvider(template_url); return template_url_service; } ",0 "void WebPagePrivate::scheduleCompositingRun() { if (WebPageCompositorClient* compositorClient = compositor()->client()) { double animationTime = compositorClient->requestAnimationFrame(); compositorClient->invalidate(animationTime); return; } m_backingStore->d->blitVisibleContents(); } ",0 "static size_t tokenize_command(char *command, token_t *tokens, const size_t max_tokens) { char *s, *e; size_t ntokens = 0; size_t len = strlen(command); unsigned int i = 0; assert(command != NULL && tokens != NULL && max_tokens > 1); s = e = command; for (i = 0; i < len; i++) { if (*e == ' ') { if (s != e) { tokens[ntokens].value = s; tokens[ntokens].length = e - s; ntokens++; *e = '\0'; if (ntokens == max_tokens - 1) { e++; s = e; /* so we don't add an extra token */ break; } } s = e + 1; } e++; } if (s != e) { tokens[ntokens].value = s; tokens[ntokens].length = e - s; ntokens++; } /* * If we scanned the whole string, the terminal value pointer is null, * otherwise it is the first unprocessed character. */ tokens[ntokens].value = *e == '\0' ? NULL : e; tokens[ntokens].length = 0; ntokens++; return ntokens; } ",0 "_rpc_checkpoint_tasks(slurm_msg_t *msg) { int fd; int rc = SLURM_SUCCESS; uid_t req_uid = g_slurm_auth_get_uid(msg->auth_cred, conf->auth_info); checkpoint_tasks_msg_t *req = (checkpoint_tasks_msg_t *) msg->data; uint16_t protocol_version; uid_t uid; fd = stepd_connect(conf->spooldir, conf->node_name, req->job_id, req->job_step_id, &protocol_version); if (fd == -1) { debug(""checkpoint for nonexistent %u.%u stepd_connect "" ""failed: %m"", req->job_id, req->job_step_id); rc = ESLURM_INVALID_JOB_ID; goto done; } if ((int)(uid = stepd_get_uid(fd, protocol_version)) < 0) { debug(""_rpc_checkpoint_tasks: couldn't read from the "" ""step %u.%u: %m"", req->job_id, req->job_step_id); rc = ESLURM_INVALID_JOB_ID; goto done2; } if ((req_uid != uid) && (!_slurm_authorized_user(req_uid))) { debug(""checkpoint req from uid %ld for job %u.%u owned by "" ""uid %ld"", (long) req_uid, req->job_id, req->job_step_id, (long) uid); rc = ESLURM_USER_ID_MISSING; /* or bad in this case */ goto done2; } rc = stepd_checkpoint(fd, protocol_version, req->timestamp, req->image_dir); if (rc == -1) rc = ESLURMD_JOB_NOTRUNNING; done2: close(fd); done: slurm_send_rc_msg(msg, rc); } ",0 "LocalDOMWindow* LocalDOMWindow::ToLocalDOMWindow() { return this; } ",0 "static sector_t max_io_len_target_boundary(sector_t sector, struct dm_target *ti) { sector_t target_offset = dm_target_offset(ti, sector); return ti->len - target_offset; } ",0 "static int cmpfile(const char *str, const char *path, const char *fname) { char filename[1024], *buffer; int ret; FILE *file; sprintf(filename, ""%s%c%s"", path, dir_sep, fname); file = fopen(filename, ""rb""); if (!file) { if (conf.strip) strcat(filename, "".strip""); else strcat(filename, "".normal""); file = fopen(filename, ""rb""); } if (!file) { printf(""Error: test result file could not be opened.\n""); exit(1); } buffer = loadfile(file); if (strcmp(buffer, str) != 0) ret = 1; else ret = 0; free(buffer); fclose(file); return ret; } ",0 "static HB_Error Lookup_PairPos2( GPOS_Instance* gpi, HB_PairPosFormat2* ppf2, HB_Buffer buffer, HB_UInt first_pos, HB_UShort format1, HB_UShort format2 ) { HB_Error error; HB_UShort cl1 = 0, cl2 = 0; /* shut compiler up */ HB_Class1Record* c1r; HB_Class2Record* c2r; error = _HB_OPEN_Get_Class( &ppf2->ClassDef1, IN_GLYPH( first_pos ), &cl1, NULL ); if ( error && error != HB_Err_Not_Covered ) return error; error = _HB_OPEN_Get_Class( &ppf2->ClassDef2, IN_CURGLYPH(), &cl2, NULL ); if ( error && error != HB_Err_Not_Covered ) return error; c1r = &ppf2->Class1Record[cl1]; if ( !c1r ) return ERR(HB_Err_Invalid_SubTable); c2r = &c1r->Class2Record[cl2]; error = Get_ValueRecord( gpi, &c2r->Value1, format1, POSITION( first_pos ) ); if ( error ) return error; return Get_ValueRecord( gpi, &c2r->Value2, format2, POSITION( buffer->in_pos ) ); } ",0 "ofputil_decode_port_mod(const struct ofp_header *oh, struct ofputil_port_mod *pm, bool loose) { struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length)); enum ofpraw raw = ofpraw_pull_assert(&b); if (raw == OFPRAW_OFPT10_PORT_MOD) { const struct ofp10_port_mod *opm = b.data; pm->port_no = u16_to_ofp(ntohs(opm->port_no)); pm->hw_addr = opm->hw_addr; pm->config = ntohl(opm->config) & OFPPC10_ALL; pm->mask = ntohl(opm->mask) & OFPPC10_ALL; pm->advertise = netdev_port_features_from_ofp10(opm->advertise); } else if (raw == OFPRAW_OFPT11_PORT_MOD) { const struct ofp11_port_mod *opm = b.data; enum ofperr error; error = ofputil_port_from_ofp11(opm->port_no, &pm->port_no); if (error) { return error; } pm->hw_addr = opm->hw_addr; pm->config = ntohl(opm->config) & OFPPC11_ALL; pm->mask = ntohl(opm->mask) & OFPPC11_ALL; pm->advertise = netdev_port_features_from_ofp11(opm->advertise); } else if (raw == OFPRAW_OFPT14_PORT_MOD) { const struct ofp14_port_mod *opm = ofpbuf_pull(&b, sizeof *opm); enum ofperr error; memset(pm, 0, sizeof *pm); error = ofputil_port_from_ofp11(opm->port_no, &pm->port_no); if (error) { return error; } pm->hw_addr = opm->hw_addr; pm->config = ntohl(opm->config) & OFPPC11_ALL; pm->mask = ntohl(opm->mask) & OFPPC11_ALL; while (b.size > 0) { struct ofpbuf property; enum ofperr error; uint64_t type; error = ofpprop_pull(&b, &property, &type); if (error) { return error; } switch (type) { case OFPPMPT14_ETHERNET: error = parse_port_mod_ethernet_property(&property, pm); break; default: error = OFPPROP_UNKNOWN(loose, ""port_mod"", type); break; } if (error) { return error; } } } else { return OFPERR_OFPBRC_BAD_TYPE; } pm->config &= pm->mask; return 0; } ",0 "void RecordContentDispositionCount(ContentDispositionCountTypes type, bool record) { if (!record) return; UMA_HISTOGRAM_ENUMERATION(""Download.ContentDisposition"", type, CONTENT_DISPOSITION_LAST_ENTRY); } ",0 "process_bmpcache2(STREAM s, uint16 flags, RD_BOOL compressed) { RD_HBITMAP bitmap; int y; uint8 cache_id, cache_idx_low, width, height, Bpp; uint16 cache_idx, bufsize; uint8 *data, *bmpdata, *bitmap_id; bitmap_id = NULL; /* prevent compiler warning */ cache_id = flags & ID_MASK; Bpp = ((flags & MODE_MASK) >> MODE_SHIFT) - 2; if (flags & PERSIST) { in_uint8p(s, bitmap_id, 8); } if (flags & SQUARE) { in_uint8(s, width); height = width; } else { in_uint8(s, width); in_uint8(s, height); } in_uint16_be(s, bufsize); bufsize &= BUFSIZE_MASK; in_uint8(s, cache_idx); if (cache_idx & LONG_FORMAT) { in_uint8(s, cache_idx_low); cache_idx = ((cache_idx ^ LONG_FORMAT) << 8) + cache_idx_low; } in_uint8p(s, data, bufsize); logger(Graphics, Debug, ""process_bmpcache2(), compr=%d, flags=%x, cx=%d, cy=%d, id=%d, idx=%d, Bpp=%d, bs=%d"", compressed, flags, width, height, cache_id, cache_idx, Bpp, bufsize); bmpdata = (uint8 *) xmalloc(width * height * Bpp); if (compressed) { if (!bitmap_decompress(bmpdata, width, height, data, bufsize, Bpp)) { logger(Graphics, Error, ""process_bmpcache2(), failed to decompress bitmap data""); xfree(bmpdata); return; } } else { for (y = 0; y < height; y++) memcpy(&bmpdata[(height - y - 1) * (width * Bpp)], &data[y * (width * Bpp)], width * Bpp); } bitmap = ui_create_bitmap(width, height, bmpdata); if (bitmap) { cache_put_bitmap(cache_id, cache_idx, bitmap); if (flags & PERSIST) pstcache_save_bitmap(cache_id, cache_idx, bitmap_id, width, height, width * height * Bpp, bmpdata); } else { logger(Graphics, Error, ""process_bmpcache2(), ui_create_bitmap(), failed""); } xfree(bmpdata); } ",0 "mISDN_sock_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len, int flags) { struct sk_buff *skb; struct sock *sk = sock->sk; struct sockaddr_mISDN *maddr; int copied, err; if (*debug & DEBUG_SOCKET) printk(KERN_DEBUG ""%s: len %d, flags %x ch.nr %d, proto %x\n"", __func__, (int)len, flags, _pms(sk)->ch.nr, sk->sk_protocol); if (flags & (MSG_OOB)) return -EOPNOTSUPP; if (sk->sk_state == MISDN_CLOSED) return 0; skb = skb_recv_datagram(sk, flags, flags & MSG_DONTWAIT, &err); if (!skb) return err; if (msg->msg_namelen >= sizeof(struct sockaddr_mISDN)) { msg->msg_namelen = sizeof(struct sockaddr_mISDN); maddr = (struct sockaddr_mISDN *)msg->msg_name; maddr->family = AF_ISDN; maddr->dev = _pms(sk)->dev->id; if ((sk->sk_protocol == ISDN_P_LAPD_TE) || (sk->sk_protocol == ISDN_P_LAPD_NT)) { maddr->channel = (mISDN_HEAD_ID(skb) >> 16) & 0xff; maddr->tei = (mISDN_HEAD_ID(skb) >> 8) & 0xff; maddr->sapi = mISDN_HEAD_ID(skb) & 0xff; } else { maddr->channel = _pms(sk)->ch.nr; maddr->sapi = _pms(sk)->ch.addr & 0xFF; maddr->tei = (_pms(sk)->ch.addr >> 8) & 0xFF; } } else { if (msg->msg_namelen) printk(KERN_WARNING ""%s: too small namelen %d\n"", __func__, msg->msg_namelen); msg->msg_namelen = 0; } copied = skb->len + MISDN_HEADER_LEN; if (len < copied) { if (flags & MSG_PEEK) atomic_dec(&skb->users); else skb_queue_head(&sk->sk_receive_queue, skb); return -ENOSPC; } memcpy(skb_push(skb, MISDN_HEADER_LEN), mISDN_HEAD_P(skb), MISDN_HEADER_LEN); err = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); mISDN_sock_cmsg(sk, msg, skb); skb_free_datagram(sk, skb); return err ? : copied; } ",1 "int fscrypt_get_crypt_info(struct inode *inode) { struct fscrypt_info *crypt_info; struct fscrypt_context ctx; struct crypto_skcipher *ctfm; const char *cipher_str; int keysize; u8 *raw_key = NULL; int res; res = fscrypt_initialize(inode->i_sb->s_cop->flags); if (res) return res; if (!inode->i_sb->s_cop->get_context) return -EOPNOTSUPP; retry: crypt_info = ACCESS_ONCE(inode->i_crypt_info); if (crypt_info) { if (!crypt_info->ci_keyring_key || key_validate(crypt_info->ci_keyring_key) == 0) return 0; fscrypt_put_encryption_info(inode, crypt_info); goto retry; } res = inode->i_sb->s_cop->get_context(inode, &ctx, sizeof(ctx)); if (res < 0) { if (!fscrypt_dummy_context_enabled(inode) || inode->i_sb->s_cop->is_encrypted(inode)) return res; /* Fake up a context for an unencrypted directory */ memset(&ctx, 0, sizeof(ctx)); ctx.format = FS_ENCRYPTION_CONTEXT_FORMAT_V1; ctx.contents_encryption_mode = FS_ENCRYPTION_MODE_AES_256_XTS; ctx.filenames_encryption_mode = FS_ENCRYPTION_MODE_AES_256_CTS; memset(ctx.master_key_descriptor, 0x42, FS_KEY_DESCRIPTOR_SIZE); } else if (res != sizeof(ctx)) { return -EINVAL; } if (ctx.format != FS_ENCRYPTION_CONTEXT_FORMAT_V1) return -EINVAL; if (ctx.flags & ~FS_POLICY_FLAGS_VALID) return -EINVAL; crypt_info = kmem_cache_alloc(fscrypt_info_cachep, GFP_NOFS); if (!crypt_info) return -ENOMEM; crypt_info->ci_flags = ctx.flags; crypt_info->ci_data_mode = ctx.contents_encryption_mode; crypt_info->ci_filename_mode = ctx.filenames_encryption_mode; crypt_info->ci_ctfm = NULL; crypt_info->ci_keyring_key = NULL; memcpy(crypt_info->ci_master_key, ctx.master_key_descriptor, sizeof(crypt_info->ci_master_key)); res = determine_cipher_type(crypt_info, inode, &cipher_str, &keysize); if (res) goto out; /* * This cannot be a stack buffer because it is passed to the scatterlist * crypto API as part of key derivation. */ res = -ENOMEM; raw_key = kmalloc(FS_MAX_KEY_SIZE, GFP_NOFS); if (!raw_key) goto out; res = validate_user_key(crypt_info, &ctx, raw_key, FS_KEY_DESC_PREFIX); if (res && inode->i_sb->s_cop->key_prefix) { int res2 = validate_user_key(crypt_info, &ctx, raw_key, inode->i_sb->s_cop->key_prefix); if (res2) { if (res2 == -ENOKEY) res = -ENOKEY; goto out; } } else if (res) { goto out; } ctfm = crypto_alloc_skcipher(cipher_str, 0, 0); if (!ctfm || IS_ERR(ctfm)) { res = ctfm ? PTR_ERR(ctfm) : -ENOMEM; printk(KERN_DEBUG ""%s: error %d (inode %u) allocating crypto tfm\n"", __func__, res, (unsigned) inode->i_ino); goto out; } crypt_info->ci_ctfm = ctfm; crypto_skcipher_clear_flags(ctfm, ~0); crypto_skcipher_set_flags(ctfm, CRYPTO_TFM_REQ_WEAK_KEY); res = crypto_skcipher_setkey(ctfm, raw_key, keysize); if (res) goto out; kzfree(raw_key); raw_key = NULL; if (cmpxchg(&inode->i_crypt_info, NULL, crypt_info) != NULL) { put_crypt_info(crypt_info); goto retry; } return 0; out: if (res == -ENOKEY) res = 0; put_crypt_info(crypt_info); kzfree(raw_key); return res; } ",1 "void DevToolsAgentHostImpl::DisconnectWebContents() { } ",0 "void ContainerNode::detach() { detachChildren(); clearChildNeedsStyleRecalc(); Node::detach(); } ",0 "int __sched wait_for_completion_killable(struct completion *x) { long t = wait_for_common(x, MAX_SCHEDULE_TIMEOUT, TASK_KILLABLE); if (t == -ERESTARTSYS) return t; return 0; } ",0 "struct in_device *inetdev_by_index(struct net *net, int ifindex) { struct net_device *dev; struct in_device *in_dev = NULL; rcu_read_lock(); dev = dev_get_by_index_rcu(net, ifindex); if (dev) in_dev = rcu_dereference_rtnl(dev->ip_ptr); rcu_read_unlock(); return in_dev; } ",0 "void TestingAutomationProvider::SignoutInScreenLocker( DictionaryValue* args, IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); chromeos::ScreenLocker* screen_locker = chromeos::ScreenLocker::default_screen_locker(); if (!screen_locker) { reply.SendError( ""No default screen locker. Are you sure the screen is locked?""); return; } reply.SendSuccess(NULL); screen_locker->Signout(); } ",0 "device_luks_lock_authorized_cb (Daemon *daemon, Device *device, DBusGMethodInvocation *context, const gchar *action_id, guint num_user_data, gpointer *user_data_elements) { /* TODO: use options */ Device *cleartext_device; int n; char *argv[10]; GError *error; if (device->priv->id_usage == NULL || strcmp (device->priv->id_usage, ""crypto"") != 0) { throw_error (context, ERROR_FAILED, ""Not a LUKS crypto device""); goto out; } cleartext_device = find_cleartext_device (device); if (cleartext_device == NULL) { throw_error (context, ERROR_FAILED, ""Cleartext device is not unlocked""); goto out; } if (cleartext_device->priv->dm_name == NULL || strlen (cleartext_device->priv->dm_name) == 0) { throw_error (context, ERROR_FAILED, ""Cannot determine device-mapper name""); goto out; } n = 0; argv[n++] = ""cryptsetup""; argv[n++] = ""luksClose""; argv[n++] = cleartext_device->priv->dm_name; argv[n++] = NULL; error = NULL; if (!job_new (context, ""LuksLock"", FALSE, device, argv, NULL, luks_lock_completed_cb, FALSE, lock_encryption_data_new (context, device, cleartext_device), (GDestroyNotify) lock_encryption_data_unref)) { goto out; } out: ; } ",0 "error::Error GLES2DecoderImpl::HandleBufferData( uint32 immediate_data_size, const cmds::BufferData& c) { GLenum target = static_cast(c.target); GLsizeiptr size = static_cast(c.size); uint32 data_shm_id = static_cast(c.data_shm_id); uint32 data_shm_offset = static_cast(c.data_shm_offset); GLenum usage = static_cast(c.usage); const void* data = NULL; if (data_shm_id != 0 || data_shm_offset != 0) { data = GetSharedMemoryAs(data_shm_id, data_shm_offset, size); if (!data) { return error::kOutOfBounds; } } buffer_manager()->ValidateAndDoBufferData(&state_, target, size, data, usage); return error::kNoError; } ",0 "nvmet_fc_destroy_fcp_iodlist(struct nvmet_fc_tgtport *tgtport, struct nvmet_fc_tgt_queue *queue) { struct nvmet_fc_fcp_iod *fod = queue->fod; int i; for (i = 0; i < queue->sqsize; fod++, i++) { if (fod->rspdma) fc_dma_unmap_single(tgtport->dev, fod->rspdma, sizeof(fod->rspiubuf), DMA_TO_DEVICE); } } ",0 "static void read_mmx_reg(struct x86_emulate_ctxt *ctxt, u64 *data, int reg) { ctxt->ops->get_fpu(ctxt); switch (reg) { case 0: asm(""movq %%mm0, %0"" : ""=m""(*data)); break; case 1: asm(""movq %%mm1, %0"" : ""=m""(*data)); break; case 2: asm(""movq %%mm2, %0"" : ""=m""(*data)); break; case 3: asm(""movq %%mm3, %0"" : ""=m""(*data)); break; case 4: asm(""movq %%mm4, %0"" : ""=m""(*data)); break; case 5: asm(""movq %%mm5, %0"" : ""=m""(*data)); break; case 6: asm(""movq %%mm6, %0"" : ""=m""(*data)); break; case 7: asm(""movq %%mm7, %0"" : ""=m""(*data)); break; default: BUG(); } ctxt->ops->put_fpu(ctxt); } ",0 "GF_Err maxr_Size(GF_Box *s) { s->size += 8; return GF_OK; } ",0 "status_t OMXCodec::initNativeWindow() { status_t err = mOMX->enableGraphicBuffers(mNode, kPortIndexOutput, OMX_TRUE); if (err != 0) { return err; } return OK; } ",0 "static int64_t get_bit_rate(AVCodecContext *ctx) { int64_t bit_rate; int bits_per_sample; switch (ctx->codec_type) { case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_DATA: case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_ATTACHMENT: bit_rate = ctx->bit_rate; break; case AVMEDIA_TYPE_AUDIO: bits_per_sample = av_get_bits_per_sample(ctx->codec_id); bit_rate = bits_per_sample ? ctx->sample_rate * (int64_t)ctx->channels * bits_per_sample : ctx->bit_rate; break; default: bit_rate = 0; break; } return bit_rate; } ",0 "void WebContentsImpl::ReplaceMisspelling(const base::string16& word) { RenderFrameHost* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->Send(new InputMsg_ReplaceMisspelling( focused_frame->GetRoutingID(), word)); } ",0 " static v8::Handle GetRenderViewId(const v8::Arguments& args) { RenderView* renderview = bindings_utils::GetRenderViewForCurrentContext(); if (!renderview) return v8::Undefined(); return v8::Integer::New(renderview->routing_id()); } ",0 "_nextA(int visited) { HmarkerList *hl = Currentbuf->hmarklist; BufferPoint *po; Anchor *an, *pan; int i, x, y, n = searchKeyNum(); ParsedURL url; if (Currentbuf->firstLine == NULL) return; if (!hl || hl->nmark == 0) return; an = retrieveCurrentAnchor(Currentbuf); if (visited != TRUE && an == NULL) an = retrieveCurrentForm(Currentbuf); y = Currentbuf->currentLine->linenumber; x = Currentbuf->pos; if (visited == TRUE) { n = hl->nmark; } for (i = 0; i < n; i++) { pan = an; if (an && an->hseq >= 0) { int hseq = an->hseq + 1; do { if (hseq >= hl->nmark) { if (visited == TRUE) return; an = pan; goto _end; } po = &hl->marks[hseq]; an = retrieveAnchor(Currentbuf->href, po->line, po->pos); if (visited != TRUE && an == NULL) an = retrieveAnchor(Currentbuf->formitem, po->line, po->pos); hseq++; if (visited == TRUE && an) { parseURL2(an->url, &url, baseURL(Currentbuf)); if (getHashHist(URLHist, parsedURL2Str(&url)->ptr)) { goto _end; } } } while (an == NULL || an == pan); } else { an = closest_next_anchor(Currentbuf->href, NULL, x, y); if (visited != TRUE) an = closest_next_anchor(Currentbuf->formitem, an, x, y); if (an == NULL) { if (visited == TRUE) return; an = pan; break; } x = an->start.pos; y = an->start.line; if (visited == TRUE) { parseURL2(an->url, &url, baseURL(Currentbuf)); if (getHashHist(URLHist, parsedURL2Str(&url)->ptr)) { goto _end; } } } } if (visited == TRUE) return; _end: if (an == NULL || an->hseq < 0) return; po = &hl->marks[an->hseq]; gotoLine(Currentbuf, po->line); Currentbuf->pos = po->pos; arrangeCursor(Currentbuf); displayBuffer(Currentbuf, B_NORMAL); } ",0 "void ChromeOSSendHandwritingStroke(InputMethodStatusConnection* connection, const HandwritingStroke& stroke) { g_return_if_fail(connection); connection->SendHandwritingStroke(stroke); } ",1 "bool PromptBrowserLoginFunction::RunImpl() { if (!IsWebStoreURL(profile_, source_url())) return false; std::string preferred_email; if (args_->GetSize() > 0) { EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &preferred_email)); } Profile* profile = GetDefaultProfile(profile_); TabContents* tab = dispatcher()->delegate()->associated_tab_contents(); if (!tab) return false; AddRef(); TokenService* token_service = profile->GetTokenService(); registrar_.Add(this, NotificationType::TOKEN_AVAILABLE, Source(token_service)); registrar_.Add(this, NotificationType::TOKEN_REQUEST_FAILED, Source(token_service)); GetBrowserSignin(profile)->RequestSignin(tab, ASCIIToUTF16(preferred_email), GetLoginMessage(), this); return true; } ",0 "static void reset_rsvds_bits_mask(struct kvm_vcpu *vcpu, struct kvm_mmu *context) { int maxphyaddr = cpuid_maxphyaddr(vcpu); u64 exb_bit_rsvd = 0; context->bad_mt_xwr = 0; if (!context->nx) exb_bit_rsvd = rsvd_bits(63, 63); switch (context->root_level) { case PT32_ROOT_LEVEL: /* no rsvd bits for 2 level 4K page table entries */ context->rsvd_bits_mask[0][1] = 0; context->rsvd_bits_mask[0][0] = 0; context->rsvd_bits_mask[1][0] = context->rsvd_bits_mask[0][0]; if (!is_pse(vcpu)) { context->rsvd_bits_mask[1][1] = 0; break; } if (is_cpuid_PSE36()) /* 36bits PSE 4MB page */ context->rsvd_bits_mask[1][1] = rsvd_bits(17, 21); else /* 32 bits PSE 4MB page */ context->rsvd_bits_mask[1][1] = rsvd_bits(13, 21); break; case PT32E_ROOT_LEVEL: context->rsvd_bits_mask[0][2] = rsvd_bits(maxphyaddr, 63) | rsvd_bits(7, 8) | rsvd_bits(1, 2); /* PDPTE */ context->rsvd_bits_mask[0][1] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 62); /* PDE */ context->rsvd_bits_mask[0][0] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 62); /* PTE */ context->rsvd_bits_mask[1][1] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 62) | rsvd_bits(13, 20); /* large page */ context->rsvd_bits_mask[1][0] = context->rsvd_bits_mask[0][0]; break; case PT64_ROOT_LEVEL: context->rsvd_bits_mask[0][3] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 51) | rsvd_bits(7, 8); context->rsvd_bits_mask[0][2] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 51) | rsvd_bits(7, 8); context->rsvd_bits_mask[0][1] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 51); context->rsvd_bits_mask[0][0] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 51); context->rsvd_bits_mask[1][3] = context->rsvd_bits_mask[0][3]; context->rsvd_bits_mask[1][2] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 51) | rsvd_bits(13, 29); context->rsvd_bits_mask[1][1] = exb_bit_rsvd | rsvd_bits(maxphyaddr, 51) | rsvd_bits(13, 20); /* large page */ context->rsvd_bits_mask[1][0] = context->rsvd_bits_mask[0][0]; break; } } ",0 "void GLManager::DestroyImage(int32_t id) { image_manager_.RemoveImage(id); } ",0 "void RenderFrameHostImpl::FilesSelectedInChooser( const std::vector& files, FileChooserParams::Mode permissions) { storage::FileSystemContext* const file_system_context = BrowserContext::GetStoragePartition(GetProcess()->GetBrowserContext(), GetSiteInstance()) ->GetFileSystemContext(); for (const auto& file : files) { if (permissions == FileChooserParams::Save) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantCreateReadWriteFile( GetProcess()->GetID(), file.file_path); } else { ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( GetProcess()->GetID(), file.file_path); } if (file.file_system_url.is_valid()) { ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFileSystem( GetProcess()->GetID(), file_system_context->CrackURL(file.file_system_url) .mount_filesystem_id()); } } Send(new FrameMsg_RunFileChooserResponse(routing_id_, files)); } ",0 "static int __ext4_ext_check_block(const char *function, unsigned int line, struct inode *inode, struct ext4_extent_header *eh, int depth, struct buffer_head *bh) { int ret; if (buffer_verified(bh)) return 0; ret = ext4_ext_check(inode, eh, depth); if (ret) return ret; set_buffer_verified(bh); return ret; } ",0 "static int hid_abort_transfers(int sub_api, struct usbi_transfer *itransfer) { struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); struct windows_transfer_priv *transfer_priv = (struct windows_transfer_priv*)usbi_transfer_get_os_priv(itransfer); struct windows_device_handle_priv *handle_priv = _device_handle_priv(transfer->dev_handle); HANDLE hid_handle; int current_interface; CHECK_HID_AVAILABLE; current_interface = transfer_priv->interface_number; hid_handle = handle_priv->interface_handle[current_interface].api_handle; CancelIo(hid_handle); return LIBUSB_SUCCESS; } ",1 "static int vnc_update_client(VncState *vs, int has_dirty, bool sync) { vs->has_dirty += has_dirty; if (vs->need_update && vs->csock != -1) { VncDisplay *vd = vs->vd; VncJob *job; int y; int height, width; int n = 0; if (vs->output.offset && !vs->audio_cap && !vs->force_update) /* kernel send buffers are full -> drop frames to throttle */ return 0; if (!vs->has_dirty && !vs->audio_cap && !vs->force_update) return 0; /* * Send screen updates to the vnc client using the server * surface and server dirty map. guest surface updates * happening in parallel don't disturb us, the next pass will * send them to the client. */ job = vnc_job_new(vs); height = pixman_image_get_height(vd->server); width = pixman_image_get_width(vd->server); y = 0; for (;;) { int x, h; unsigned long x2; unsigned long offset = find_next_bit((unsigned long *) &vs->dirty, height * VNC_DIRTY_BPL(vs), y * VNC_DIRTY_BPL(vs)); if (offset == height * VNC_DIRTY_BPL(vs)) { /* no more dirty bits */ break; } y = offset / VNC_DIRTY_BPL(vs); x = offset % VNC_DIRTY_BPL(vs); x2 = find_next_zero_bit((unsigned long *) &vs->dirty[y], VNC_DIRTY_BPL(vs), x); bitmap_clear(vs->dirty[y], x, x2 - x); h = find_and_clear_dirty_height(vs, y, x, x2, height); x2 = MIN(x2, width / VNC_DIRTY_PIXELS_PER_BIT); if (x2 > x) { n += vnc_job_add_rect(job, x * VNC_DIRTY_PIXELS_PER_BIT, y, (x2 - x) * VNC_DIRTY_PIXELS_PER_BIT, h); } } vnc_job_push(job); if (sync) { vnc_jobs_join(vs); } vs->force_update = 0; vs->has_dirty = 0; return n; } if (vs->csock == -1) { vnc_disconnect_finish(vs); } else if (sync) { vnc_jobs_join(vs); } return 0; } ",0 "static int l_hostkey_hash (lua_State *L) { luaL_Buffer B; static int hash_option[] = { LIBSSH2_HOSTKEY_HASH_MD5, LIBSSH2_HOSTKEY_HASH_SHA1 }; static int hash_length[] = { 16, 20 }; static const char *hashes[] = { ""md5"", ""sha1"", NULL }; int type = luaL_checkoption(L, 2, ""sha1"", hashes); struct ssh_userdata *state = NULL; const unsigned char *hash = NULL; state = (struct ssh_userdata *) nseU_checkudata(L, 1, SSH2_UDATA, ""ssh2""); hash = (const unsigned char *) libssh2_hostkey_hash(state->session, hash_option[type]); if (hash == NULL) return nseU_safeerror(L, ""could not get hostkey hash""); luaL_buffinit(L, &B); for (int i = 0; i < hash_length[type]; i++) { char byte[3]; /* with space for NULL */ snprintf(byte, sizeof(byte), ""%02X"", (unsigned int)hash[i]); if (i) luaL_addchar(&B, ':'); luaL_addlstring(&B, byte, 2); } luaL_pushresult(&B); return 1; } ",0 "static Eina_Bool _ewk_view_scrolls_resize(Ewk_View_Private_Data* priv, size_t size) { void* tmp = realloc(priv->scrolls.array, size * sizeof(Ewk_Scroll_Request)); if (!tmp) { CRITICAL(""could not realloc scrolls array to %zu elements."", size); return false; } priv->scrolls.allocated = size; priv->scrolls.array = static_cast(tmp); return true; } ",0 "void PreconnectManager::StartPreconnectUrl( const GURL& url, bool allow_credentials, net::NetworkIsolationKey network_isolation_key) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); if (!url.SchemeIsHTTPOrHTTPS()) return; PreresolveJobId job_id = preresolve_jobs_.Add(std::make_unique( url.GetOrigin(), 1, allow_credentials, std::move(network_isolation_key), nullptr)); queued_jobs_.push_front(job_id); TryToLaunchPreresolveJobs(); } ",0 "AVCodecParameters *avcodec_parameters_alloc(void) { AVCodecParameters *par = av_mallocz(sizeof(*par)); if (!par) return NULL; codec_parameters_reset(par); return par; } ",0 "static void entropy_decode_stereo_0000(APEContext *ctx, int blockstodecode) { decode_array_0000(ctx, &ctx->gb, ctx->decoded[0], &ctx->riceY, blockstodecode); decode_array_0000(ctx, &ctx->gb, ctx->decoded[1], &ctx->riceX, blockstodecode); } ",0 "void RenderViewImpl::OnSetBackground(const SkBitmap& background) { if (webview()) webview()->setIsTransparent(!background.empty()); if (compositor_) compositor_->setHasTransparentBackground(!background.empty()); SetBackground(background); } ",0 "static int gfs2_release(struct inode *inode, struct file *file) { struct gfs2_inode *ip = GFS2_I(inode); kfree(file->private_data); file->private_data = NULL; if (!(file->f_mode & FMODE_WRITE)) return 0; gfs2_rs_delete(ip, &inode->i_writecount); return 0; } ",0 "void GenerateNtlmResponseV1WithSessionSecurity( const base::string16& password, base::span server_challenge, base::span client_challenge, base::span ntlm_response) { uint8_t ntlm_hash[kNtlmHashLen]; GenerateNtlmHashV1(password, ntlm_hash); uint8_t session_hash[kNtlmHashLen]; GenerateSessionHashV1WithSessionSecurity(server_challenge, client_challenge, session_hash); GenerateResponseDesl( ntlm_hash, base::make_span(session_hash).subspan<0, kChallengeLen>(), ntlm_response); } ",0 "bool ContentSecurityPolicy::CheckScriptHashAgainstPolicy( Vector& csp_hash_values, const Member& policy, InlineType inline_type) { for (const auto& csp_hash_value : csp_hash_values) { if (policy->AllowScriptHash(csp_hash_value, inline_type)) { return true; } } return false; } ",0 "is_tag_length_valid(size_t taglen) { switch (taglen) { /* Allowed tag lengths from NIST SP 800-38D. */ case 128 / 8: /* GCRY_GCM_BLOCK_LEN */ case 120 / 8: case 112 / 8: case 104 / 8: case 96 / 8: case 64 / 8: case 32 / 8: return 1; default: return 0; } } ",0 "void GraphicsContext::restorePlatformState() { if (paintingDisabled()) return; platformContext()->restore(); } ",0 "MagickExport Image *FlopImage(const Image *image,ExceptionInfo *exception) { #define FlopImageTag ""Flop/Image"" CacheView *flop_view, *image_view; Image *flop_image; MagickBooleanType status; MagickOffsetType progress; RectangleInfo page; ssize_t y; assert(image != (const 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); flop_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception); if (flop_image == (Image *) NULL) return((Image *) NULL); /* Flop each row. */ status=MagickTrue; progress=0; page=image->page; image_view=AcquireVirtualCacheView(image,exception); flop_view=AcquireAuthenticCacheView(flop_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(status) \ magick_threads(image,flop_image,1,1) #endif for (y=0; y < (ssize_t) flop_image->rows; y++) { register const Quantum *restrict p; register ssize_t x; register Quantum *restrict q; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); q=QueueCacheViewAuthenticPixels(flop_view,0,y,flop_image->columns,1, exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } q+=GetPixelChannels(flop_image)*flop_image->columns; for (x=0; x < (ssize_t) flop_image->columns; x++) { register ssize_t i; q-=GetPixelChannels(flop_image); if (GetPixelReadMask(image,p) == 0) { p+=GetPixelChannels(image); continue; } for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel=GetPixelChannelChannel(image,i); PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait flop_traits=GetPixelChannelTraits(flop_image,channel); if ((traits == UndefinedPixelTrait) || (flop_traits == UndefinedPixelTrait)) continue; SetPixelChannel(flop_image,channel,p[i],q); } p+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(flop_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_FlopImage) #endif proceed=SetImageProgress(image,FlopImageTag,progress++,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } flop_view=DestroyCacheView(flop_view); image_view=DestroyCacheView(image_view); flop_image->type=image->type; if (page.width != 0) page.x=(ssize_t) (page.width-flop_image->columns-page.x); flop_image->page=page; if (status == MagickFalse) flop_image=DestroyImage(flop_image); return(flop_image); } ",0 "static void set_window(unsigned int plane, struct au1200_lcd_window_regs_t *pdata) { unsigned int val, bpp; /* Window control register 0 */ if (pdata->flags & WIN_POSITION) { val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_OX | LCD_WINCTRL0_OY); val |= ((pdata->xpos << 21) & LCD_WINCTRL0_OX); val |= ((pdata->ypos << 10) & LCD_WINCTRL0_OY); lcd->window[plane].winctrl0 = val; } if (pdata->flags & WIN_ALPHA_COLOR) { val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_A); val |= ((pdata->alpha_color << 2) & LCD_WINCTRL0_A); lcd->window[plane].winctrl0 = val; } if (pdata->flags & WIN_ALPHA_MODE) { val = lcd->window[plane].winctrl0 & ~(LCD_WINCTRL0_AEN); val |= ((pdata->alpha_mode << 1) & LCD_WINCTRL0_AEN); lcd->window[plane].winctrl0 = val; } /* Window control register 1 */ if (pdata->flags & WIN_PRIORITY) { val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PRI); val |= ((pdata->priority << 30) & LCD_WINCTRL1_PRI); lcd->window[plane].winctrl1 = val; } if (pdata->flags & WIN_CHANNEL) { val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PIPE); val |= ((pdata->channel << 29) & LCD_WINCTRL1_PIPE); lcd->window[plane].winctrl1 = val; } if (pdata->flags & WIN_BUFFER_FORMAT) { val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_FRM); val |= ((pdata->buffer_format << 25) & LCD_WINCTRL1_FRM); lcd->window[plane].winctrl1 = val; } if (pdata->flags & WIN_COLOR_ORDER) { val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_CCO); val |= ((pdata->color_order << 24) & LCD_WINCTRL1_CCO); lcd->window[plane].winctrl1 = val; } if (pdata->flags & WIN_PIXEL_ORDER) { val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_PO); val |= ((pdata->pixel_order << 22) & LCD_WINCTRL1_PO); lcd->window[plane].winctrl1 = val; } if (pdata->flags & WIN_SIZE) { val = lcd->window[plane].winctrl1 & ~(LCD_WINCTRL1_SZX | LCD_WINCTRL1_SZY); val |= (((pdata->xsize << 11) - 1) & LCD_WINCTRL1_SZX); val |= (((pdata->ysize) - 1) & LCD_WINCTRL1_SZY); lcd->window[plane].winctrl1 = val; /* program buffer line width */ bpp = winbpp(val) / 8; val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_BX); val |= (((pdata->xsize * bpp) << 8) & LCD_WINCTRL2_BX); lcd->window[plane].winctrl2 = val; } /* Window control register 2 */ if (pdata->flags & WIN_COLORKEY_MODE) { val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_CKMODE); val |= ((pdata->colorkey_mode << 24) & LCD_WINCTRL2_CKMODE); lcd->window[plane].winctrl2 = val; } if (pdata->flags & WIN_DOUBLE_BUFFER_MODE) { val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_DBM); val |= ((pdata->double_buffer_mode << 23) & LCD_WINCTRL2_DBM); lcd->window[plane].winctrl2 = val; } if (pdata->flags & WIN_RAM_ARRAY_MODE) { val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_RAM); val |= ((pdata->ram_array_mode << 21) & LCD_WINCTRL2_RAM); lcd->window[plane].winctrl2 = val; } /* Buffer line width programmed with WIN_SIZE */ if (pdata->flags & WIN_BUFFER_SCALE) { val = lcd->window[plane].winctrl2 & ~(LCD_WINCTRL2_SCX | LCD_WINCTRL2_SCY); val |= ((pdata->xsize << 11) & LCD_WINCTRL2_SCX); val |= ((pdata->ysize) & LCD_WINCTRL2_SCY); lcd->window[plane].winctrl2 = val; } if (pdata->flags & WIN_ENABLE) { val = lcd->winenable; val &= ~(1<enable & 1) << plane; lcd->winenable = val; } au_sync(); } ",0 "void ih264d_delete_nonref_nondisplay_pics(dpb_manager_t *ps_dpb_mgr) { WORD8 i; WORD32 (*i4_poc_buf_id_map)[3] = ps_dpb_mgr->ai4_poc_buf_id_map; /* remove all gaps marked as unused for ref */ for(i = 0; (i < MAX_FRAMES) && ps_dpb_mgr->i1_gaps_deleted; i++) { if(GAP_FRAME_NUM == i4_poc_buf_id_map[i][2]) { ps_dpb_mgr->i1_gaps_deleted--; ps_dpb_mgr->i1_poc_buf_id_entries--; i4_poc_buf_id_map[i][0] = -1; i4_poc_buf_id_map[i][1] = 0x7fffffff; i4_poc_buf_id_map[i][2] = 0; } } } ",0 "static void load_creator_from_xml(xref_t *xref, const char *buf) { /* TODO */ } ",0 "static int perf_mmap(struct file *file, struct vm_area_struct *vma) { struct perf_event *event = file->private_data; unsigned long user_locked, user_lock_limit; struct user_struct *user = current_user(); unsigned long locked, lock_limit; struct ring_buffer *rb; unsigned long vma_size; unsigned long nr_pages; long user_extra, extra; int ret = 0, flags = 0; /* * Don't allow mmap() of inherited per-task counters. This would * create a performance issue due to all children writing to the * same rb. */ if (event->cpu == -1 && event->attr.inherit) return -EINVAL; if (!(vma->vm_flags & VM_SHARED)) return -EINVAL; vma_size = vma->vm_end - vma->vm_start; nr_pages = (vma_size / PAGE_SIZE) - 1; /* * If we have rb pages ensure they're a power-of-two number, so we * can do bitmasks instead of modulo. */ if (nr_pages != 0 && !is_power_of_2(nr_pages)) return -EINVAL; if (vma_size != PAGE_SIZE * (1 + nr_pages)) return -EINVAL; if (vma->vm_pgoff != 0) return -EINVAL; WARN_ON_ONCE(event->ctx->parent_ctx); mutex_lock(&event->mmap_mutex); if (event->rb) { if (event->rb->nr_pages == nr_pages) atomic_inc(&event->rb->refcount); else ret = -EINVAL; goto unlock; } user_extra = nr_pages + 1; user_lock_limit = sysctl_perf_event_mlock >> (PAGE_SHIFT - 10); /* * Increase the limit linearly with more CPUs: */ user_lock_limit *= num_online_cpus(); user_locked = atomic_long_read(&user->locked_vm) + user_extra; extra = 0; if (user_locked > user_lock_limit) extra = user_locked - user_lock_limit; lock_limit = rlimit(RLIMIT_MEMLOCK); lock_limit >>= PAGE_SHIFT; locked = vma->vm_mm->pinned_vm + extra; if ((locked > lock_limit) && perf_paranoid_tracepoint_raw() && !capable(CAP_IPC_LOCK)) { ret = -EPERM; goto unlock; } WARN_ON(event->rb); if (vma->vm_flags & VM_WRITE) flags |= RING_BUFFER_WRITABLE; rb = rb_alloc(nr_pages, event->attr.watermark ? event->attr.wakeup_watermark : 0, event->cpu, flags); if (!rb) { ret = -ENOMEM; goto unlock; } rcu_assign_pointer(event->rb, rb); atomic_long_add(user_extra, &user->locked_vm); event->mmap_locked = extra; event->mmap_user = get_current_user(); vma->vm_mm->pinned_vm += event->mmap_locked; perf_event_update_userpage(event); unlock: if (!ret) atomic_inc(&event->mmap_count); mutex_unlock(&event->mmap_mutex); vma->vm_flags |= VM_DONTEXPAND | VM_DONTDUMP; vma->vm_ops = &perf_mmap_vmops; return ret; } ",0 "PrintPreviewDataSource::~PrintPreviewDataSource() { } ",0 "void cgsleep_us_r(cgtimer_t *ts_start, int64_t us) { LARGE_INTEGER li; int ms; li.QuadPart = ts_start->QuadPart + us * 10LL; ms = us / 1000; if (!ms) ms = 1; liSleep(&li, ms); } ",0 "bool NavigatorImpl::NavigateToEntry( FrameTreeNode* frame_tree_node, const FrameNavigationEntry& frame_entry, const NavigationEntryImpl& entry, ReloadType reload_type, bool is_same_document_history_load, bool is_history_navigation_in_new_child, bool is_pending_entry, const scoped_refptr& post_body) { TRACE_EVENT0(""browser,navigation"", ""NavigatorImpl::NavigateToEntry""); GURL dest_url = frame_entry.url(); Referrer dest_referrer = frame_entry.referrer(); if (reload_type == ReloadType::ORIGINAL_REQUEST_URL && entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) { dest_url = entry.GetOriginalRequestURL(); dest_referrer = Referrer(); } if (frame_tree_node->IsMainFrame()) { const GURL& virtual_url = entry.GetVirtualURL(); if (!virtual_url.is_valid() && !virtual_url.is_empty()) { LOG(WARNING) << ""Refusing to load for invalid virtual URL: "" << virtual_url.possibly_invalid_spec(); return false; } } if (!dest_url.is_valid() && !dest_url.is_empty()) { LOG(WARNING) << ""Refusing to load invalid URL: "" << dest_url.possibly_invalid_spec(); return false; } if (dest_url.spec().size() > url::kMaxURLChars) { LOG(WARNING) << ""Refusing to load URL as it exceeds "" << url::kMaxURLChars << "" characters.""; return false; } base::TimeTicks navigation_start = base::TimeTicks::Now(); TRACE_EVENT_INSTANT_WITH_TIMESTAMP0( ""navigation,rail"", ""NavigationTiming navigationStart"", TRACE_EVENT_SCOPE_GLOBAL, navigation_start); PreviewsState previews_state = PREVIEWS_UNSPECIFIED; if (!frame_tree_node->IsMainFrame()) { previews_state = frame_tree_node->frame_tree() ->root() ->current_frame_host() ->last_navigation_previews_state(); } else if (reload_type == ReloadType::DISABLE_LOFI_MODE) { previews_state = PREVIEWS_NO_TRANSFORM; } if (IsBrowserSideNavigationEnabled()) { navigation_data_.reset(new NavigationMetricsData(navigation_start, dest_url, entry.restore_type())); RequestNavigation(frame_tree_node, dest_url, dest_referrer, frame_entry, entry, reload_type, previews_state, is_same_document_history_load, is_history_navigation_in_new_child, navigation_start); if (frame_tree_node->IsMainFrame() && frame_tree_node->navigation_request()) { TRACE_EVENT_ASYNC_BEGIN_WITH_TIMESTAMP1( ""navigation"", ""Navigation timeToNetworkStack"", frame_tree_node->navigation_request()->navigation_handle(), navigation_start, ""FrameTreeNode id"", frame_tree_node->frame_tree_node_id()); } } else { RenderFrameHostImpl* dest_render_frame_host = frame_tree_node->render_manager()->Navigate( dest_url, frame_entry, entry, reload_type != ReloadType::NONE); if (!dest_render_frame_host) return false; // Unable to create the desired RenderFrameHost. if (is_pending_entry) CHECK_EQ(controller_->GetPendingEntry(), &entry); CheckWebUIRendererDoesNotDisplayNormalURL(dest_render_frame_host, dest_url); bool is_transfer = entry.transferred_global_request_id().child_id != -1; if (is_transfer) dest_render_frame_host->set_is_loading(true); if (is_pending_entry && controller_->GetPendingEntryIndex() != -1) DCHECK(frame_entry.page_state().IsValid()); bool is_transfer_to_same = is_transfer && entry.transferred_global_request_id().child_id == dest_render_frame_host->GetProcess()->GetID(); if (!is_transfer_to_same) { navigation_data_.reset(new NavigationMetricsData( navigation_start, dest_url, entry.restore_type())); FrameMsg_Navigate_Type::Value navigation_type = GetNavigationType( frame_tree_node->current_url(), // old_url dest_url, // new_url reload_type, // reload_type entry, // entry frame_entry, // frame_entry is_same_document_history_load); // is_same_document_history_load dest_render_frame_host->Navigate( entry.ConstructCommonNavigationParams( frame_entry, post_body, dest_url, dest_referrer, navigation_type, previews_state, navigation_start), entry.ConstructStartNavigationParams(), entry.ConstructRequestNavigationParams( frame_entry, GURL(), std::string(), is_history_navigation_in_new_child, entry.GetSubframeUniqueNames(frame_tree_node), frame_tree_node->has_committed_real_load(), controller_->GetPendingEntryIndex() == -1, controller_->GetIndexOfEntry(&entry), controller_->GetLastCommittedEntryIndex(), controller_->GetEntryCount())); } else { dest_render_frame_host->navigation_handle()->set_is_transferring(false); } } if (is_pending_entry) CHECK_EQ(controller_->GetPendingEntry(), &entry); if (controller_->GetPendingEntryIndex() == -1 && dest_url.SchemeIs(url::kJavaScriptScheme)) { return false; } if (delegate_ && is_pending_entry) delegate_->DidStartNavigationToPendingEntry(dest_url, reload_type); return true; } ",0 "static int getPremulBitmapCreateFlags(bool isMutable) { int flags = GraphicsJNI::kBitmapCreateFlag_Premultiplied; if (isMutable) flags |= GraphicsJNI::kBitmapCreateFlag_Mutable; return flags; } ",0 "smp_fetch_meth(const struct arg *args, struct sample *smp, const char *kw, void *private) { int meth; struct http_txn *txn; CHECK_HTTP_MESSAGE_FIRST_PERM(); txn = smp->strm->txn; meth = txn->meth; smp->data.type = SMP_T_METH; smp->data.u.meth.meth = meth; if (meth == HTTP_METH_OTHER) { if (txn->rsp.msg_state != HTTP_MSG_RPBEFORE) /* ensure the indexes are not affected */ return 0; smp->flags |= SMP_F_CONST; smp->data.u.meth.str.len = txn->req.sl.rq.m_l; smp->data.u.meth.str.str = txn->req.chn->buf->p; } smp->flags |= SMP_F_VOL_1ST; return 1; } ",0 "channel_lookup(int id) { Channel *c; if ((c = channel_by_id(id)) == NULL) return (NULL); switch (c->type) { case SSH_CHANNEL_X11_OPEN: case SSH_CHANNEL_LARVAL: case SSH_CHANNEL_CONNECTING: case SSH_CHANNEL_DYNAMIC: case SSH_CHANNEL_OPENING: case SSH_CHANNEL_OPEN: case SSH_CHANNEL_INPUT_DRAINING: case SSH_CHANNEL_OUTPUT_DRAINING: case SSH_CHANNEL_ABANDONED: return (c); } logit(""Non-public channel %d, type %d."", id, c->type); return (NULL); } ",0 " DatarateTestVP9Large() : EncoderTest(GET_PARAM(0)) {} ",0 "static long dprintf_DollarString(char *input, char **end) { int number=0; while(ISDIGIT(*input)) { number *= 10; number += *input-'0'; input++; } if(number && ('$'==*input++)) { *end = input; return number; } return 0; } ",0 "static void webkitWebViewBaseMap(GtkWidget* widget) { GTK_WIDGET_CLASS(webkit_web_view_base_parent_class)->map(widget); WebKitWebViewBase* webViewBase = WEBKIT_WEB_VIEW_BASE(widget); #if USE(TEXTURE_MAPPER_GL) && defined(GDK_WINDOWING_X11) GdkWindow* gdkWindow = gtk_widget_get_window(widget); ASSERT(gdkWindow); if (gdk_window_has_native(gdkWindow)) webViewBase->priv->pageProxy->widgetMapped(GDK_WINDOW_XID(gdkWindow)); #endif if (!webViewBase->priv->needsResizeOnMap) return; GtkAllocation allocation; gtk_widget_get_allocation(widget, &allocation); resizeWebKitWebViewBaseFromAllocation(webViewBase, &allocation); webViewBase->priv->needsResizeOnMap = false; } ",0 "void* CurvesDup(cmsContext ContextID, const void* ptr) { Curves16Data* Data = _cmsDupMem(ContextID, ptr, sizeof(Curves16Data)); int i; if (Data == NULL) return NULL; Data ->Curves = _cmsDupMem(ContextID, Data ->Curves, Data ->nCurves * sizeof(cmsUInt16Number*)); for (i=0; i < Data -> nCurves; i++) { Data ->Curves[i] = _cmsDupMem(ContextID, Data ->Curves[i], Data -> nElements * sizeof(cmsUInt16Number)); } return (void*) Data; } ",0 "void RenderWidgetHostImpl::OnTouchEventAck( const TouchEventWithLatencyInfo& event, InputEventAckSource ack_source, InputEventAckState ack_result) { latency_tracker_.OnInputEventAck(event.event, &event.latency, ack_result); for (auto& input_event_observer : input_event_observers_) input_event_observer.OnInputEventAck(ack_source, ack_result, event.event); auto* input_event_router = delegate() ? delegate()->GetInputEventRouter() : nullptr; if (input_event_router) input_event_router->ProcessAckedTouchEvent(event, ack_result, view_.get()); else if (view_) view_->ProcessAckedTouchEvent(event, ack_result); } ",0 "bool MdFeedbackEnabled() { return base::CommandLine::ForCurrentProcess()->HasSwitch( ::switches::kEnableMaterialDesignFeedback); } ",0 "int BluetoothSocketAsyncApiFunction::AddSocket(BluetoothApiSocket* socket) { return manager_->Add(socket); } ",0 "void RenderViewImpl::EnsureMediaStreamImpl() { #if defined(ENABLE_P2P_APIS) if (!p2p_socket_dispatcher_) p2p_socket_dispatcher_ = new content::P2PSocketDispatcher(this); #endif #if defined(ENABLE_WEBRTC) if (!media_stream_dispatcher_) media_stream_dispatcher_ = new MediaStreamDispatcher(this); if (!media_stream_impl_.get()) { MediaStreamDependencyFactory* factory = new MediaStreamDependencyFactory(); media_stream_impl_ = new MediaStreamImpl( media_stream_dispatcher_, p2p_socket_dispatcher_, RenderThreadImpl::current()->video_capture_impl_manager(), factory); } #endif } ",0 "GF_Err paen_AddBox(GF_Box *s, GF_Box *a) { FDPartitionEntryBox *ptr = (FDPartitionEntryBox *)s; switch(a->type) { case GF_ISOM_BOX_TYPE_FPAR: if (ptr->blocks_and_symbols) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->blocks_and_symbols = (FilePartitionBox *)a; return GF_OK; case GF_ISOM_BOX_TYPE_FECR: if (ptr->FEC_symbol_locations) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->FEC_symbol_locations = (FECReservoirBox *)a; return GF_OK; case GF_ISOM_BOX_TYPE_FIRE: if (ptr->File_symbol_locations) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->File_symbol_locations = (FileReservoirBox *)a; return GF_OK; default: return gf_isom_box_add_default(s, a); } return GF_OK; } ",0 "void Extension::UpdateTabSpecificPermissions( int tab_id, scoped_refptr permissions) const { base::AutoLock auto_lock(runtime_data_lock_); runtime_data_.UpdateTabSpecificPermissions(tab_id, permissions); } ",0 "static long do_rmdir(int dfd, const char __user *pathname) { int error = 0; struct filename *name; struct dentry *dentry; struct path path; struct qstr last; int type; unsigned int lookup_flags = 0; retry: name = filename_parentat(dfd, getname(pathname), lookup_flags, &path, &last, &type); if (IS_ERR(name)) return PTR_ERR(name); switch (type) { case LAST_DOTDOT: error = -ENOTEMPTY; goto exit1; case LAST_DOT: error = -EINVAL; goto exit1; case LAST_ROOT: error = -EBUSY; goto exit1; } error = mnt_want_write(path.mnt); if (error) goto exit1; inode_lock_nested(path.dentry->d_inode, I_MUTEX_PARENT); dentry = __lookup_hash(&last, path.dentry, lookup_flags); error = PTR_ERR(dentry); if (IS_ERR(dentry)) goto exit2; if (!dentry->d_inode) { error = -ENOENT; goto exit3; } error = security_path_rmdir(&path, dentry); if (error) goto exit3; error = vfs_rmdir(path.dentry->d_inode, dentry); exit3: dput(dentry); exit2: inode_unlock(path.dentry->d_inode); mnt_drop_write(path.mnt); exit1: path_put(&path); putname(name); if (retry_estale(error, lookup_flags)) { lookup_flags |= LOOKUP_REVAL; goto retry; } return error; } ",0 "bool DocumentLoader::ShouldContinueForResponse() const { if (substitute_data_.IsValid()) return true; int status_code = response_.HttpStatusCode(); if (status_code == 204 || status_code == 205) { return false; } if (IsContentDispositionAttachment( response_.HttpHeaderField(http_names::kContentDisposition))) { return false; } if (!CanShowMIMEType(response_.MimeType(), frame_)) return false; return true; } ",0 "static void voidMethodClampUnsignedShortArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodClampUnsignedShortArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "e1000e_intrmgr_pci_unint(E1000ECore *core) { int i; timer_del(core->radv.timer); timer_free(core->radv.timer); timer_del(core->rdtr.timer); timer_free(core->rdtr.timer); timer_del(core->raid.timer); timer_free(core->raid.timer); timer_del(core->tadv.timer); timer_free(core->tadv.timer); timer_del(core->tidv.timer); timer_free(core->tidv.timer); timer_del(core->itr.timer); timer_free(core->itr.timer); for (i = 0; i < E1000E_MSIX_VEC_NUM; i++) { timer_del(core->eitr[i].timer); timer_free(core->eitr[i].timer); } } ",0 "bool CanBeInManagedDomain(const std::string& username) { if (username.empty()) { return false; } for (size_t i = 0; i < arraysize(kNonManagedDomains); i++) { if (EndsWith(username, kNonManagedDomains[i], true)) { return false; } } return true; } ",0 "void DevToolsAgentHostImpl::NotifyCreated() { DCHECK(g_devtools_instances.Get().find(id_) == g_devtools_instances.Get().end()); g_devtools_instances.Get()[id_] = this; for (auto& observer : g_devtools_observers.Get()) observer.DevToolsAgentHostCreated(this); } ",0 "void HTMLInputElement::setSize(unsigned size) { setAttribute(sizeAttr, String::number(size)); } ",0 "bool EditorClientBlackBerry::shouldEraseMarkersAfterChangeSelection(TextCheckingType) const { return true; } ",0 "bool Extension::HasHostPermission(const GURL& url) const { for (URLPatternList::const_iterator host = host_permissions().begin(); host != host_permissions().end(); ++host) { if (url.SchemeIs(chrome::kChromeUIScheme) && url.host() != chrome::kChromeUIFaviconHost && location() != Extension::COMPONENT) return false; if (host->MatchesURL(url)) return true; } return false; } ",0 "SWFShape_moveScaledPen(SWFShape shape, int x, int y) { SWFShape_moveScaledPenTo(shape, shape->xpos+x, shape->ypos+y); } ",0 "static u16 SQLITE_NOINLINE computeNumericType(Mem *pMem){ assert( (pMem->flags & (MEM_Int|MEM_Real))==0 ); assert( (pMem->flags & (MEM_Str|MEM_Blob))!=0 ); ExpandBlob(pMem); if( sqlite3AtoF(pMem->z, &pMem->u.r, pMem->n, pMem->enc)==0 ){ return 0; } if( sqlite3Atoi64(pMem->z, &pMem->u.i, pMem->n, pMem->enc)==0 ){ return MEM_Int; } return MEM_Real; } ",0 " virtual int create() { int nlctrlFamily = genl_ctrl_resolve(mInfo->cmd_sock, ""nlctrl""); int ret = mMsg.create(nlctrlFamily, CTRL_CMD_GETFAMILY, 0, 0); if (ret < 0) { return ret; } ret = mMsg.put_string(CTRL_ATTR_FAMILY_NAME, mName); return ret; } ",0 "float HarfBuzzShaper::fillGlyphBufferFromHarfBuzzRun(GlyphBuffer* glyphBuffer, HarfBuzzRun* currentRun, float initialAdvance) { FloatSize* offsets = currentRun->offsets(); uint16_t* glyphs = currentRun->glyphs(); float* advances = currentRun->advances(); unsigned numGlyphs = currentRun->numGlyphs(); uint16_t* glyphToCharacterIndexes = currentRun->glyphToCharacterIndexes(); float advanceSoFar = initialAdvance; if (m_run.rtl()) { for (unsigned i = 0; i < numGlyphs; ++i) { uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToCharacterIndexes[i]; if (currentCharacterIndex >= m_toIndex) { advanceSoFar += advances[i]; } else if (currentCharacterIndex >= m_fromIndex) { FloatPoint runStartOffset = HB_DIRECTION_IS_HORIZONTAL(currentRun->direction()) ? FloatPoint(advanceSoFar, 0) : FloatPoint(0, advanceSoFar); glyphBuffer->add(glyphs[i], currentRun->fontData(), runStartOffset + offsets[i]); advanceSoFar += advances[i]; } } } else { for (unsigned i = 0; i < numGlyphs; ++i) { uint16_t currentCharacterIndex = currentRun->startIndex() + glyphToCharacterIndexes[i]; if (currentCharacterIndex < m_fromIndex) { advanceSoFar += advances[i]; } else if (currentCharacterIndex < m_toIndex) { FloatPoint runStartOffset = HB_DIRECTION_IS_HORIZONTAL(currentRun->direction()) ? FloatPoint(advanceSoFar, 0) : FloatPoint(0, advanceSoFar); glyphBuffer->add(glyphs[i], currentRun->fontData(), runStartOffset + offsets[i]); advanceSoFar += advances[i]; } } } return advanceSoFar - initialAdvance; } ",0 " bool Document::IsSecureTransitionTo(const KURL& url) const { scoped_refptr other = SecurityOrigin::Create(url); return GetSecurityOrigin()->CanAccess(other.get()); } ",0 "image_transform_png_set_rgb_to_gray_ini(PNG_CONST image_transform *this, transform_display *that) { png_modifier *pm = that->pm; PNG_CONST color_encoding *e = pm->current_encoding; UNUSED(this) /* Since we check the encoding this flag must be set: */ pm->test_uses_encoding = 1; /* If 'e' is not NULL chromaticity information is present and either a cHRM * or an sRGB chunk will be inserted. */ if (e != 0) { /* Coefficients come from the encoding, but may need to be normalized to a * white point Y of 1.0 */ PNG_CONST double whiteY = e->red.Y + e->green.Y + e->blue.Y; data.red_coefficient = e->red.Y; data.green_coefficient = e->green.Y; data.blue_coefficient = e->blue.Y; if (whiteY != 1) { data.red_coefficient /= whiteY; data.green_coefficient /= whiteY; data.blue_coefficient /= whiteY; } } else { /* The default (built in) coeffcients, as above: */ data.red_coefficient = 6968 / 32768.; data.green_coefficient = 23434 / 32768.; data.blue_coefficient = 2366 / 32768.; } data.gamma = pm->current_gamma; /* If not set then the calculations assume linear encoding (implicitly): */ if (data.gamma == 0) data.gamma = 1; /* The arguments to png_set_rgb_to_gray can override the coefficients implied * by the color space encoding. If doing exhaustive checks do the override * in each case, otherwise do it randomly. */ if (pm->test_exhaustive) { /* First time in coefficients_overridden is 0, the following sets it to 1, * so repeat if it is set. If a test fails this may mean we subsequently * skip a non-override test, ignore that. */ data.coefficients_overridden = !data.coefficients_overridden; pm->repeat = data.coefficients_overridden != 0; } else data.coefficients_overridden = random_choice(); if (data.coefficients_overridden) { /* These values override the color encoding defaults, simply use random * numbers. */ png_uint_32 ru; double total; RANDOMIZE(ru); data.green_coefficient = total = (ru & 0xffff) / 65535.; ru >>= 16; data.red_coefficient = (1 - total) * (ru & 0xffff) / 65535.; total += data.red_coefficient; data.blue_coefficient = 1 - total; # ifdef PNG_FLOATING_POINT_SUPPORTED data.red_to_set = data.red_coefficient; data.green_to_set = data.green_coefficient; # else data.red_to_set = fix(data.red_coefficient); data.green_to_set = fix(data.green_coefficient); # endif /* The following just changes the error messages: */ pm->encoding_ignored = 1; } else { data.red_to_set = -1; data.green_to_set = -1; } /* Adjust the error limit in the png_modifier because of the larger errors * produced in the digitization during the gamma handling. */ if (data.gamma != 1) /* Use gamma tables */ { if (that->this.bit_depth == 16 || pm->assume_16_bit_calculations) { /* The computations have the form: * * r * rc + g * gc + b * bc * * Each component of which is +/-1/65535 from the gamma_to_1 table * lookup, resulting in a base error of +/-6. The gamma_from_1 * conversion adds another +/-2 in the 16-bit case and * +/-(1<<(15-PNG_MAX_GAMMA_8)) in the 8-bit case. */ that->pm->limit += pow( # if PNG_MAX_GAMMA_8 < 14 (that->this.bit_depth == 16 ? 8. : 6. + (1<<(15-PNG_MAX_GAMMA_8))) # else 8. # endif /65535, data.gamma); } else { /* Rounding to 8 bits in the linear space causes massive errors which * will trigger the error check in transform_range_check. Fix that * here by taking the gamma encoding into account. * * When DIGITIZE is set because a pre-1.7 version of libpng is being * tested allow a bigger slack. * * NOTE: this magic number was determined by experiment to be 1.1 (when * using fixed point arithmetic). There's no great merit to the value * below, however it only affects the limit used for checking for * internal calculation errors, not the actual limit imposed by * pngvalid on the output errors. */ that->pm->limit += pow( # if DIGITIZE 1.1 # else 1. # endif /255, data.gamma); } } else { /* With no gamma correction a large error comes from the truncation of the * calculation in the 8 bit case, allow for that here. */ if (that->this.bit_depth != 16 && !pm->assume_16_bit_calculations) that->pm->limit += 4E-3; } } ",1 "static struct rmap_item *get_next_rmap_item(struct mm_slot *mm_slot, struct rmap_item **rmap_list, unsigned long addr) { struct rmap_item *rmap_item; while (*rmap_list) { rmap_item = *rmap_list; if ((rmap_item->address & PAGE_MASK) == addr) return rmap_item; if (rmap_item->address > addr) break; *rmap_list = rmap_item->rmap_list; remove_rmap_item_from_tree(rmap_item); free_rmap_item(rmap_item); } rmap_item = alloc_rmap_item(); if (rmap_item) { /* It has already been zeroed */ rmap_item->mm = mm_slot->mm; rmap_item->address = addr; rmap_item->rmap_list = *rmap_list; *rmap_list = rmap_item; } return rmap_item; } ",0 "void trace_event_buffer_commit(struct trace_event_buffer *fbuffer) { if (static_key_false(&tracepoint_printk_key.key)) output_printk(fbuffer); event_trigger_unlock_commit(fbuffer->trace_file, fbuffer->buffer, fbuffer->event, fbuffer->entry, fbuffer->flags, fbuffer->pc); } ",0 "void PaintLayerScrollableArea::ScrollbarManager::SetHasHorizontalScrollbar( bool has_scrollbar) { if (has_scrollbar) { DisableCompositingQueryAsserts disabler; if (!h_bar_) { h_bar_ = CreateScrollbar(kHorizontalScrollbar); h_bar_is_attached_ = 1; if (!h_bar_->IsCustomScrollbar()) ScrollableArea()->DidAddScrollbar(*h_bar_, kHorizontalScrollbar); } else { h_bar_is_attached_ = 1; } } else { h_bar_is_attached_ = 0; if (!DelayScrollOffsetClampScope::ClampingIsDelayed()) DestroyScrollbar(kHorizontalScrollbar); } } ",0 "void GLES2DecoderPassthroughImpl::RestoreActiveTexture() const {} ",0 "long keyctl_update_key(key_serial_t id, const void __user *_payload, size_t plen) { key_ref_t key_ref; void *payload; long ret; ret = -EINVAL; if (plen > PAGE_SIZE) goto error; /* pull the payload in if one was supplied */ payload = NULL; if (_payload) { ret = -ENOMEM; payload = kmalloc(plen, GFP_KERNEL); if (!payload) goto error; ret = -EFAULT; if (copy_from_user(payload, _payload, plen) != 0) goto error2; } /* find the target key (which must be writable) */ key_ref = lookup_user_key(id, 0, KEY_NEED_WRITE); if (IS_ERR(key_ref)) { ret = PTR_ERR(key_ref); goto error2; } /* update the key */ ret = key_update(key_ref, payload, plen); key_ref_put(key_ref); error2: kfree(payload); error: return ret; } ",0 "std::unique_ptr StoragePartitionImpl::Create( BrowserContext* context, bool in_memory, const base::FilePath& relative_partition_path, const std::string& partition_domain) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || !BrowserThread::IsThreadInitialized(BrowserThread::UI)); base::FilePath partition_path = context->GetPath().Append(relative_partition_path); std::unique_ptr partition = base::WrapUnique(new StoragePartitionImpl( context, partition_path, context->GetSpecialStoragePolicy())); partition->is_in_memory_ = in_memory; partition->relative_partition_path_ = relative_partition_path; partition->quota_manager_ = new storage::QuotaManager( in_memory, partition_path, base::CreateSingleThreadTaskRunnerWithTraits({BrowserThread::IO}).get(), context->GetSpecialStoragePolicy(), base::BindRepeating(&StoragePartitionImpl::GetQuotaSettings, partition->weak_factory_.GetWeakPtr())); scoped_refptr quota_manager_proxy = partition->quota_manager_->proxy(); partition->filesystem_context_ = CreateFileSystemContext( context, partition_path, in_memory, quota_manager_proxy.get()); partition->database_tracker_ = base::MakeRefCounted( partition_path, in_memory, context->GetSpecialStoragePolicy(), quota_manager_proxy.get()); partition->dom_storage_context_ = new DOMStorageContextWrapper( BrowserContext::GetConnectorFor(context), in_memory ? base::FilePath() : context->GetPath(), relative_partition_path, context->GetSpecialStoragePolicy()); partition->lock_manager_ = new LockManager(); base::FilePath path = in_memory ? base::FilePath() : partition_path; partition->indexed_db_context_ = new IndexedDBContextImpl( path, context->GetSpecialStoragePolicy(), quota_manager_proxy, indexed_db::GetDefaultLevelDBFactory()); partition->cache_storage_context_ = new CacheStorageContextImpl(context); partition->cache_storage_context_->Init(path, quota_manager_proxy); partition->service_worker_context_ = new ServiceWorkerContextWrapper(context); partition->service_worker_context_->set_storage_partition(partition.get()); partition->appcache_service_ = base::MakeRefCounted(quota_manager_proxy.get()); partition->shared_worker_service_ = std::make_unique( partition.get(), partition->service_worker_context_, partition->appcache_service_); partition->push_messaging_context_ = new PushMessagingContext(context, partition->service_worker_context_); #if !defined(OS_ANDROID) partition->host_zoom_level_context_ = new HostZoomLevelContext( context->CreateZoomLevelDelegate(partition_path)); #endif // !defined(OS_ANDROID) partition->platform_notification_context_ = new PlatformNotificationContextImpl(path, context, partition->service_worker_context_); partition->platform_notification_context_->Initialize(); partition->background_fetch_context_ = base::MakeRefCounted( context, partition->service_worker_context_, partition->cache_storage_context_, quota_manager_proxy); partition->background_sync_context_ = base::MakeRefCounted(); partition->background_sync_context_->Init(partition->service_worker_context_); partition->payment_app_context_ = new PaymentAppContextImpl(); partition->payment_app_context_->Init(partition->service_worker_context_); partition->broadcast_channel_provider_ = new BroadcastChannelProvider(); partition->bluetooth_allowed_devices_map_ = new BluetoothAllowedDevicesMap(); scoped_refptr blob_context = ChromeBlobStorageContext::GetFor(context); partition->url_loader_factory_getter_ = new URLLoaderFactoryGetter(); partition->url_loader_factory_getter_->Initialize(partition.get()); partition->service_worker_context_->Init( path, quota_manager_proxy.get(), context->GetSpecialStoragePolicy(), blob_context.get(), partition->url_loader_factory_getter_.get()); partition->blob_registry_ = BlobRegistryWrapper::Create(blob_context, partition->filesystem_context_); partition->appcache_service_->set_url_loader_factory_getter( partition->url_loader_factory_getter_.get()); partition->prefetch_url_loader_service_ = base::MakeRefCounted(); partition->cookie_store_context_ = base::MakeRefCounted(); partition->cookie_store_context_->Initialize( partition->service_worker_context_, base::DoNothing()); if (base::FeatureList::IsEnabled(net::features::kIsolatedCodeCache)) { GeneratedCodeCacheSettings settings = GetContentClient()->browser()->GetGeneratedCodeCacheSettings(context); if (!in_memory && settings.enabled()) { partition->generated_code_cache_context_ = base::MakeRefCounted(); base::FilePath code_cache_path; if (partition_domain.empty()) { code_cache_path = settings.path().AppendASCII(""Code Cache""); } else { code_cache_path = settings.path() .Append(relative_partition_path) .AppendASCII(""Code Cache""); } DCHECK_GE(settings.size_in_bytes(), 0); partition->GetGeneratedCodeCacheContext()->Initialize( code_cache_path, settings.size_in_bytes()); } } return partition; } ",1 "void RuleFeatureSet::FeatureMetadata::add(const FeatureMetadata& other) { usesFirstLineRules = usesFirstLineRules || other.usesFirstLineRules; usesWindowInactiveSelector = usesWindowInactiveSelector || other.usesWindowInactiveSelector; maxDirectAdjacentSelectors = std::max(maxDirectAdjacentSelectors, other.maxDirectAdjacentSelectors); } ",0 "_pango_emoji_iter_init (PangoEmojiIter *iter, const char *text, int length) { iter->text_start = text; if (length >= 0) iter->text_end = text + length; else iter->text_end = text + strlen (text); iter->start = text; iter->end = text; iter->is_emoji = (gboolean) 2; /* HACK */ _pango_emoji_iter_next (iter); return iter; } ",0 "static int acm_tty_break_ctl(struct tty_struct *tty, int state) { struct acm *acm = tty->driver_data; int retval; retval = acm_send_break(acm, state ? 0xffff : 0); if (retval < 0) dev_dbg(&acm->control->dev, ""%s - send break failed\n"", __func__); return retval; } ",0 "void BeginInstallWithManifestFunction::InstallUIProceed() { CrxInstaller::SetWhitelistedManifest(id_, parsed_manifest_.release()); SetResult(ERROR_NONE); SendResponse(true); Release(); } ",0 "void __init trap_init(void) { extern char except_vec3_generic, except_vec3_r4000; extern char except_vec4; unsigned long i; int rollback; check_wait(); rollback = (cpu_wait == r4k_wait); #if defined(CONFIG_KGDB) if (kgdb_early_setup) return; /* Already done */ #endif if (cpu_has_veic || cpu_has_vint) { unsigned long size = 0x200 + VECTORSPACING*64; ebase = (unsigned long) __alloc_bootmem(size, 1 << fls(size), 0); } else { ebase = CKSEG0; if (cpu_has_mips_r2) ebase += (read_c0_ebase() & 0x3ffff000); } per_cpu_trap_init(); /* * Copy the generic exception handlers to their final destination. * This will be overriden later as suitable for a particular * configuration. */ set_handler(0x180, &except_vec3_generic, 0x80); /* * Setup default vectors */ for (i = 0; i <= 31; i++) set_except_vector(i, handle_reserved); /* * Copy the EJTAG debug exception vector handler code to it's final * destination. */ if (cpu_has_ejtag && board_ejtag_handler_setup) board_ejtag_handler_setup(); /* * Only some CPUs have the watch exceptions. */ if (cpu_has_watch) set_except_vector(23, handle_watch); /* * Initialise interrupt handlers */ if (cpu_has_veic || cpu_has_vint) { int nvec = cpu_has_veic ? 64 : 8; for (i = 0; i < nvec; i++) set_vi_handler(i, NULL); } else if (cpu_has_divec) set_handler(0x200, &except_vec4, 0x8); /* * Some CPUs can enable/disable for cache parity detection, but does * it different ways. */ parity_protection_init(); /* * The Data Bus Errors / Instruction Bus Errors are signaled * by external hardware. Therefore these two exceptions * may have board specific handlers. */ if (board_be_init) board_be_init(); set_except_vector(0, rollback ? rollback_handle_int : handle_int); set_except_vector(1, handle_tlbm); set_except_vector(2, handle_tlbl); set_except_vector(3, handle_tlbs); set_except_vector(4, handle_adel); set_except_vector(5, handle_ades); set_except_vector(6, handle_ibe); set_except_vector(7, handle_dbe); set_except_vector(8, handle_sys); set_except_vector(9, handle_bp); set_except_vector(10, rdhwr_noopt ? handle_ri : (cpu_has_vtag_icache ? handle_ri_rdhwr_vivt : handle_ri_rdhwr)); set_except_vector(11, handle_cpu); set_except_vector(12, handle_ov); set_except_vector(13, handle_tr); if (current_cpu_type() == CPU_R6000 || current_cpu_type() == CPU_R6000A) { /* * The R6000 is the only R-series CPU that features a machine * check exception (similar to the R4000 cache error) and * unaligned ldc1/sdc1 exception. The handlers have not been * written yet. Well, anyway there is no R6000 machine on the * current list of targets for Linux/MIPS. * (Duh, crap, there is someone with a triple R6k machine) */ } if (board_nmi_handler_setup) board_nmi_handler_setup(); if (cpu_has_fpu && !cpu_has_nofpuex) set_except_vector(15, handle_fpe); set_except_vector(22, handle_mdmx); if (cpu_has_mcheck) set_except_vector(24, handle_mcheck); if (cpu_has_mipsmt) set_except_vector(25, handle_mt); set_except_vector(26, handle_dsp); if (cpu_has_vce) /* Special exception: R4[04]00 uses also the divec space. */ memcpy((void *)(ebase + 0x180), &except_vec3_r4000, 0x100); else if (cpu_has_4kex) memcpy((void *)(ebase + 0x180), &except_vec3_generic, 0x80); else memcpy((void *)(ebase + 0x080), &except_vec3_generic, 0x80); local_flush_icache_range(ebase, ebase + 0x400); flush_tlb_handlers(); sort_extable(__start___dbe_table, __stop___dbe_table); cu2_notifier(default_cu2_call, 0x80000000); /* Run last */ } ",0 "static void b43_dma_tx_resume_ring(struct b43_dmaring *ring) { B43_WARN_ON(!ring->tx); ring->ops->tx_resume(ring); } ",0 "std::string FormatLog(const char* fmt, va_list args) { std::string msg = base::StringPrintV(fmt, args); if (!msg.empty() && msg[msg.size() - 1] == '\n') msg.erase(msg.end() - 1, msg.end()); return msg; } ",0 "Element* Document::activeElement() const { if (Element* element = adjustedFocusedElement()) return element; return body(); } ",0 "static v8::Handle strictFunctionCallback(const v8::Arguments& args) { INC_STATS(""DOM.TestObj.strictFunction""); if (args.Length() < 3) return V8Proxy::throwNotEnoughArgumentsError(); TestObj* imp = V8TestObj::toNative(args.Holder()); ExceptionCode ec = 0; { STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)); EXCEPTION_BLOCK(float, a, static_cast(MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)->NumberValue())); EXCEPTION_BLOCK(int, b, V8int::HasInstance(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined)) ? V8int::toNative(v8::Handle::Cast(MAYBE_MISSING_PARAMETER(args, 2, DefaultIsUndefined))) : 0); RefPtr result = imp->strictFunction(str, a, b, ec); if (UNLIKELY(ec)) goto fail; return toV8(result.release(), args.GetIsolate()); } fail: V8Proxy::setDOMException(ec, args.GetIsolate()); return v8::Handle(); } ",1 "void NavigatorImpl::DidStartMainFrameNavigation( const GURL& url, SiteInstanceImpl* site_instance, NavigationHandleImpl* navigation_handle) { NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); bool has_browser_initiated_pending_entry = pending_entry && !pending_entry->is_renderer_initiated(); bool renderer_provisional_load_to_pending_url = pending_entry && pending_entry->is_renderer_initiated() && (pending_entry->GetURL() == url); bool has_transient_entry = !!controller_->GetTransientEntry(); if (!has_browser_initiated_pending_entry && !has_transient_entry && !renderer_provisional_load_to_pending_url) { std::unique_ptr entry = NavigationEntryImpl::FromNavigationEntry( controller_->CreateNavigationEntry( url, content::Referrer(), ui::PAGE_TRANSITION_LINK, true /* is_renderer_initiated */, std::string(), controller_->GetBrowserContext())); entry->set_site_instance(site_instance); if (pending_entry) { entry->set_transferred_global_request_id( pending_entry->transferred_global_request_id()); entry->set_should_replace_entry(pending_entry->should_replace_entry()); entry->SetRedirectChain(pending_entry->GetRedirectChain()); } if (navigation_handle) navigation_handle->update_entry_id_for_transfer(entry->GetUniqueID()); controller_->SetPendingEntry(std::move(entry)); if (delegate_) delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); } } ",0 "FILE *re_yyget_in (yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; return yyin; } ",0 " cf2_initGlobalRegionBuffer( CFF_Decoder* decoder, CF2_UInt idx, CF2_Buffer buf ) { FT_ASSERT( decoder && decoder->globals ); FT_ZERO( buf ); idx += decoder->globals_bias; if ( idx >= decoder->num_globals ) return TRUE; /* error */ buf->start = buf->ptr = decoder->globals[idx]; buf->end = decoder->globals[idx + 1]; } ",1 "ossl_cipher_final(VALUE self) { EVP_CIPHER_CTX *ctx; int out_len; VALUE str; GetCipher(self, ctx); str = rb_str_new(0, EVP_CIPHER_CTX_block_size(ctx)); if (!EVP_CipherFinal_ex(ctx, (unsigned char *)RSTRING_PTR(str), &out_len)) ossl_raise(eCipherError, NULL); assert(out_len <= RSTRING_LEN(str)); rb_str_set_len(str, out_len); return str; } ",0 "bool PDFiumEngine::New(const char* url, const char* headers) { url_ = url; if (headers) headers_ = headers; else headers_.clear(); return true; } ",0 "__svc_clean_idle(fd_set *fds, int timeout, bool_t cleanblock) { int i, ncleaned; SVCXPRT *xprt, *least_active; struct timeval tv, tdiff, tmax; struct cf_conn *cd; gettimeofday(&tv, NULL); tmax.tv_sec = tmax.tv_usec = 0; least_active = NULL; rwlock_wrlock(&svc_fd_lock); for (i = ncleaned = 0; i <= svc_maxfd; i++) { if (FD_ISSET(i, fds)) { xprt = __svc_xports[i]; if (xprt == NULL || xprt->xp_ops == NULL || xprt->xp_ops->xp_recv != svc_vc_recv) continue; cd = (struct cf_conn *)xprt->xp_p1; if (!cleanblock && !cd->nonblock) continue; if (timeout == 0) { timersub(&tv, &cd->last_recv_time, &tdiff); if (timercmp(&tdiff, &tmax, >)) { tmax = tdiff; least_active = xprt; } continue; } if (tv.tv_sec - cd->last_recv_time.tv_sec > timeout) { __xprt_unregister_unlocked(xprt); __svc_vc_dodestroy(xprt); ncleaned++; } } } if (timeout == 0 && least_active != NULL) { __xprt_unregister_unlocked(least_active); __svc_vc_dodestroy(least_active); ncleaned++; } rwlock_unlock(&svc_fd_lock); return ncleaned > 0 ? TRUE : FALSE; } ",0 "void SoundPool::setLoop(int channelID, int loop) { ALOGV(""setLoop(%d, %d)"", channelID, loop); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->setLoop(loop); } } ",0 "SpoolssSetForm_r(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep _U_) { proto_item *hidden_item; hidden_item = proto_tree_add_uint( tree, hf_form, tvb, offset, 0, 1); PROTO_ITEM_SET_HIDDEN(hidden_item); /* Parse packet */ offset = dissect_doserror( tvb, offset, pinfo, tree, di, drep, hf_rc, NULL); return offset; } ",0 "void SimpleSoftOMXComponent::onQueueFilled(OMX_U32 portIndex __unused) { } ",0 "void RenderFrameHostImpl::OnFrameFocused() { frame_tree_->SetFocusedFrame(frame_tree_node_); } ",0 " void PaymentRequest::Retry(mojom::PaymentValidationErrorsPtr errors) { if (!client_.is_bound() || !binding_.is_bound()) { DLOG(ERROR) << ""Attempted Retry(), but binding(s) missing.""; OnConnectionTerminated(); return; } if (!display_handle_) { DLOG(ERROR) << ""Attempted Retry(), but display_handle_ is nullptr.""; OnConnectionTerminated(); return; } std::string error; if (!PaymentsValidators::IsValidPaymentValidationErrorsFormat(errors, &error)) { DLOG(ERROR) << error; client_->OnError(mojom::PaymentErrorReason::USER_CANCEL); OnConnectionTerminated(); return; } spec()->Retry(std::move(errors)); display_handle_->Retry(); } ",1 "void RenderBlock::updateDragState(bool dragOn) { RenderBox::updateDragState(dragOn); if (continuation()) continuation()->updateDragState(dragOn); } ",0 "void RenderProcessHostImpl::SetIsNeverSuitableForReuse() { is_never_suitable_for_reuse_ = true; } ",0 "void QQuickWebViewPrivate::didRelaunchProcess() { qWarning(""WARNING: The web process has been successfully restarted.""); pageView->d->setDrawingAreaSize(viewSize()); } ",0 "void NavigationURLLoaderImpl::ProceedWithResponse() {} ",0 " WebLocalFrameImpl* MainFrame() const { return helper_.GetWebView()->MainFrameImpl(); } ",0 "static int sha1_neon_init(struct shash_desc *desc) { struct sha1_state *sctx = shash_desc_ctx(desc); *sctx = (struct sha1_state){ .state = { SHA1_H0, SHA1_H1, SHA1_H2, SHA1_H3, SHA1_H4 }, }; return 0; } ",0 "static int add_attribute(STACK_OF(X509_ATTRIBUTE) **sk, int nid, int atrtype, void *value) { X509_ATTRIBUTE *attr = NULL; if (*sk == NULL) { if ((*sk = sk_X509_ATTRIBUTE_new_null()) == NULL) return 0; new_attrib: if ((attr = X509_ATTRIBUTE_create(nid, atrtype, value)) == NULL) return 0; if (!sk_X509_ATTRIBUTE_push(*sk, attr)) { X509_ATTRIBUTE_free(attr); return 0; } } else { int i; for (i = 0; i < sk_X509_ATTRIBUTE_num(*sk); i++) { attr = sk_X509_ATTRIBUTE_value(*sk, i); if (OBJ_obj2nid(X509_ATTRIBUTE_get0_object(attr)) == nid) { X509_ATTRIBUTE_free(attr); attr = X509_ATTRIBUTE_create(nid, atrtype, value); if (attr == NULL) return 0; if (!sk_X509_ATTRIBUTE_set(*sk, i, attr)) { X509_ATTRIBUTE_free(attr); return 0; } goto end; } } goto new_attrib; } end: return (1); } ",0 "static void opt_debug(void) { config.debug = 1; snprintf(config.logfilename, sizeof(config.logfilename), ""-""); } ",0 "static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) { struct vcpu_svm *svm = to_svm(vcpu); int i; if (unlikely(cpu != vcpu->cpu)) { svm->asid_generation = 0; mark_all_dirty(svm->vmcb); } #ifdef CONFIG_X86_64 rdmsrl(MSR_GS_BASE, to_svm(vcpu)->host.gs_base); #endif savesegment(fs, svm->host.fs); savesegment(gs, svm->host.gs); svm->host.ldt = kvm_read_ldt(); for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++) rdmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); if (static_cpu_has(X86_FEATURE_TSCRATEMSR) && svm->tsc_ratio != __this_cpu_read(current_tsc_ratio)) { __this_cpu_write(current_tsc_ratio, svm->tsc_ratio); wrmsrl(MSR_AMD64_TSC_RATIO, svm->tsc_ratio); } } ",0 "bool ChromePasswordManagerClient::IsPasswordManagementEnabledForCurrentPage( const GURL& url) const { bool is_enabled = CanShowBubbleOnURL(url); if (vr::VrTabHelper::IsUiSuppressedInVr( web_contents(), vr::UiSuppressedElement::kPasswordManager)) { is_enabled = false; } if (log_manager_->IsLoggingActive()) { password_manager::BrowserSavePasswordProgressLogger logger( log_manager_.get()); logger.LogURL(Logger::STRING_SECURITY_ORIGIN, url); logger.LogBoolean( Logger::STRING_PASSWORD_MANAGEMENT_ENABLED_FOR_CURRENT_PAGE, is_enabled); } return is_enabled; } ",0 "inline static int php_openssl_safe_mode_chk(char *filename TSRMLS_DC) { if (PG(safe_mode) && (!php_checkuid(filename, NULL, CHECKUID_CHECK_FILE_AND_DIR))) { return -1; } if (php_check_open_basedir(filename TSRMLS_CC)) { return -1; } return 0; } ",0 "static int clie_3_5_startup(struct usb_serial *serial) { struct device *dev = &serial->dev->dev; int result; u8 *data; data = kmalloc(1, GFP_KERNEL); if (!data) return -ENOMEM; /* * Note that PEG-300 series devices expect the following two calls. */ /* get the config number */ result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), USB_REQ_GET_CONFIGURATION, USB_DIR_IN, 0, 0, data, 1, 3000); if (result < 0) { dev_err(dev, ""%s: get config number failed: %d\n"", __func__, result); goto out; } if (result != 1) { dev_err(dev, ""%s: get config number bad return length: %d\n"", __func__, result); result = -EIO; goto out; } /* get the interface number */ result = usb_control_msg(serial->dev, usb_rcvctrlpipe(serial->dev, 0), USB_REQ_GET_INTERFACE, USB_DIR_IN | USB_RECIP_INTERFACE, 0, 0, data, 1, 3000); if (result < 0) { dev_err(dev, ""%s: get interface number failed: %d\n"", __func__, result); goto out; } if (result != 1) { dev_err(dev, ""%s: get interface number bad return length: %d\n"", __func__, result); result = -EIO; goto out; } result = 0; out: kfree(data); return result; } ",0 " void DoCheckFakeData(uint8* audio_data, size_t length) { Type* output = reinterpret_cast(audio_data); for (size_t i = 0; i < length; i++) { EXPECT_TRUE(algorithm_.is_muted() || output[i] != 0); } } ",1 "void test_parserComplete() { int retval; /* alice's maintained packet */ bzrtpPacket_t *alice_Hello, *alice_HelloFromBob, *alice_HelloACK, *alice_HelloACKFromBob; /* bob's maintained packet */ bzrtpPacket_t *bob_Hello, *bob_HelloFromAlice, *bob_HelloACK, *bob_HelloACKFromAlice; /* Create zrtp Context */ bzrtpContext_t *contextAlice = bzrtp_createBzrtpContext(0x12345678); /* Alice's SSRC of main channel is 12345678 */ bzrtpContext_t *contextBob = bzrtp_createBzrtpContext(0x87654321); /* Bob's SSRC of main channel is 87654321 */ bzrtpHelloMessage_t *alice_HelloFromBob_message; bzrtpHelloMessage_t *bob_HelloFromAlice_message; bzrtpPacket_t *alice_selfDHPart; bzrtpPacket_t *bob_selfDHPart; bzrtpPacket_t *alice_Commit; bzrtpPacket_t *bob_Commit; bzrtpPacket_t *bob_CommitFromAlice; bzrtpPacket_t *alice_CommitFromBob; uint8_t tmpBuffer[8]; bzrtpDHPartMessage_t *bob_DHPart1; bzrtpPacket_t *alice_DHPart1FromBob; bzrtpDHPartMessage_t *alice_DHPart1FromBob_message=NULL; bzrtpPacket_t *bob_DHPart2FromAlice; bzrtpDHPartMessage_t *bob_DHPart2FromAlice_message=NULL; uint16_t secretLength; uint16_t totalHashDataLength; uint8_t *dataToHash; uint16_t hashDataIndex = 0; uint8_t alice_totalHash[32]; /* Note : actual length of hash depends on the choosen algo */ uint8_t bob_totalHash[32]; /* Note : actual length of hash depends on the choosen algo */ uint8_t *s1=NULL; uint32_t s1Length=0; uint8_t *s2=NULL; uint32_t s2Length=0; uint8_t *s3=NULL; uint32_t s3Length=0; uint8_t alice_sasHash[32]; uint8_t bob_sasHash[32]; uint32_t sasValue; char sas[32]; bzrtpPacket_t *bob_Confirm1; bzrtpPacket_t *alice_Confirm1FromBob; bzrtpConfirmMessage_t *alice_Confirm1FromBob_message=NULL; bzrtpPacket_t *alice_Confirm2; bzrtpPacket_t *bob_Confirm2FromAlice; bzrtpConfirmMessage_t *bob_Confirm2FromAlice_message=NULL; bzrtpPacket_t *bob_Conf2ACK; bzrtpPacket_t *alice_Conf2ACKFromBob; bzrtpPacket_t *alice_Confirm1; bzrtpPacket_t *bob_Confirm1FromAlice; bzrtpConfirmMessage_t *bob_Confirm1FromAlice_message=NULL; bzrtpPacket_t *bob_Confirm2; bzrtpPacket_t *alice_Confirm2FromBob; bzrtpConfirmMessage_t *alice_Confirm2FromBob_message=NULL; bzrtpPacket_t *alice_Conf2ACK; bzrtpPacket_t *bob_Conf2ACKFromAlice; bzrtpCallbacks_t cbs={0}; /* Create the client context, used for zidFilename only */ my_Context_t clientContextAlice; my_Context_t clientContextBob; strcpy(clientContextAlice.zidFilename, ""./ZIDAlice.txt""); strcpy(clientContextBob.zidFilename, ""./ZIDBob.txt""); /* attach the clientContext to the bzrtp Context */ retval = bzrtp_setClientData(contextAlice, 0x12345678, (void *)&clientContextAlice); retval += bzrtp_setClientData(contextBob, 0x87654321, (void *)&clientContextBob); /* set the cache related callback functions */ cbs.bzrtp_loadCache=floadAlice; cbs.bzrtp_writeCache=fwriteAlice; bzrtp_setCallbacks(contextAlice, &cbs); cbs.bzrtp_loadCache=floadBob; cbs.bzrtp_writeCache=fwriteBob; bzrtp_setCallbacks(contextBob, &cbs); bzrtp_message (""Init the contexts\n""); /* end the context init */ bzrtp_initBzrtpContext(contextAlice); bzrtp_initBzrtpContext(contextBob); /* now create Alice and BOB Hello packet */ alice_Hello = bzrtp_createZrtpPacket(contextAlice, contextAlice->channelContext[0], MSGTYPE_HELLO, &retval); if (bzrtp_packetBuild(contextAlice, contextAlice->channelContext[0], alice_Hello, contextAlice->channelContext[0]->selfSequenceNumber) ==0) { contextAlice->channelContext[0]->selfSequenceNumber++; contextAlice->channelContext[0]->selfPackets[HELLO_MESSAGE_STORE_ID] = alice_Hello; } bob_Hello = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[0], MSGTYPE_HELLO, &retval); if (bzrtp_packetBuild(contextBob, contextBob->channelContext[0], bob_Hello, contextBob->channelContext[0]->selfSequenceNumber) ==0) { contextBob->channelContext[0]->selfSequenceNumber++; contextBob->channelContext[0]->selfPackets[HELLO_MESSAGE_STORE_ID] = bob_Hello; } /* now send Alice Hello's to Bob and vice-versa, so they parse them */ alice_HelloFromBob = bzrtp_packetCheck(bob_Hello->packetString, bob_Hello->messageLength+16, contextAlice->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[0], bob_Hello->packetString, bob_Hello->messageLength+16, alice_HelloFromBob); bzrtp_message (""Alice parsing returns %x\n"", retval); if (retval==0) { bzrtpHelloMessage_t *alice_HelloFromBob_message; int i; contextAlice->channelContext[0]->peerSequenceNumber = alice_HelloFromBob->sequenceNumber; /* save bob's Hello packet in Alice's context */ contextAlice->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID] = alice_HelloFromBob; /* determine crypto Algo to use */ alice_HelloFromBob_message = (bzrtpHelloMessage_t *)alice_HelloFromBob->messageData; retval = crypoAlgoAgreement(contextAlice, contextAlice->channelContext[0], contextAlice->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID]->messageData); if (retval == 0) { bzrtp_message (""Alice selected algo %x\n"", contextAlice->channelContext[0]->keyAgreementAlgo); memcpy(contextAlice->peerZID, alice_HelloFromBob_message->ZID, 12); } /* check if the peer accept MultiChannel */ for (i=0; ikc; i++) { if (alice_HelloFromBob_message->supportedKeyAgreement[i] == ZRTP_KEYAGREEMENT_Mult) { contextAlice->peerSupportMultiChannel = 1; } } } bob_HelloFromAlice = bzrtp_packetCheck(alice_Hello->packetString, alice_Hello->messageLength+16, contextBob->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextBob, contextBob->channelContext[0], alice_Hello->packetString, alice_Hello->messageLength+16, bob_HelloFromAlice); bzrtp_message (""Bob parsing returns %x\n"", retval); if (retval==0) { bzrtpHelloMessage_t *bob_HelloFromAlice_message; int i; contextBob->channelContext[0]->peerSequenceNumber = bob_HelloFromAlice->sequenceNumber; /* save alice's Hello packet in bob's context */ contextBob->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID] = bob_HelloFromAlice; /* determine crypto Algo to use */ bob_HelloFromAlice_message = (bzrtpHelloMessage_t *)bob_HelloFromAlice->messageData; retval = crypoAlgoAgreement(contextBob, contextBob->channelContext[0], contextBob->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID]->messageData); if (retval == 0) { bzrtp_message (""Bob selected algo %x\n"", contextBob->channelContext[0]->keyAgreementAlgo); memcpy(contextBob->peerZID, bob_HelloFromAlice_message->ZID, 12); } /* check if the peer accept MultiChannel */ for (i=0; ikc; i++) { if (bob_HelloFromAlice_message->supportedKeyAgreement[i] == ZRTP_KEYAGREEMENT_Mult) { contextBob->peerSupportMultiChannel = 1; } } } /* update context with hello message information : H3 and compute initiator and responder's shared secret Hashs */ alice_HelloFromBob_message = (bzrtpHelloMessage_t *)alice_HelloFromBob->messageData; memcpy(contextAlice->channelContext[0]->peerH[3], alice_HelloFromBob_message->H3, 32); bob_HelloFromAlice_message = (bzrtpHelloMessage_t *)bob_HelloFromAlice->messageData; memcpy(contextBob->channelContext[0]->peerH[3], bob_HelloFromAlice_message->H3, 32); /* get the secrets associated to peer ZID */ bzrtp_getPeerAssociatedSecretsHash(contextAlice, alice_HelloFromBob_message->ZID); bzrtp_getPeerAssociatedSecretsHash(contextBob, bob_HelloFromAlice_message->ZID); /* compute the initiator hashed secret as in rfc section 4.3.1 */ if (contextAlice->cachedSecret.rs1!=NULL) { contextAlice->channelContext[0]->hmacFunction(contextAlice->cachedSecret.rs1, contextAlice->cachedSecret.rs1Length, (uint8_t *)""Initiator"", 9, 8, contextAlice->initiatorCachedSecretHash.rs1ID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextAlice->RNGContext, contextAlice->initiatorCachedSecretHash.rs1ID, 8); } if (contextAlice->cachedSecret.rs2!=NULL) { contextAlice->channelContext[0]->hmacFunction(contextAlice->cachedSecret.rs2, contextAlice->cachedSecret.rs2Length, (uint8_t *)""Initiator"", 9, 8, contextAlice->initiatorCachedSecretHash.rs2ID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextAlice->RNGContext, contextAlice->initiatorCachedSecretHash.rs2ID, 8); } if (contextAlice->cachedSecret.auxsecret!=NULL) { contextAlice->channelContext[0]->hmacFunction(contextAlice->cachedSecret.auxsecret, contextAlice->cachedSecret.auxsecretLength, contextAlice->channelContext[0]->selfH[3], 32, 8, contextAlice->channelContext[0]->initiatorAuxsecretID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextAlice->RNGContext, contextAlice->channelContext[0]->initiatorAuxsecretID, 8); } if (contextAlice->cachedSecret.pbxsecret!=NULL) { contextAlice->channelContext[0]->hmacFunction(contextAlice->cachedSecret.pbxsecret, contextAlice->cachedSecret.pbxsecretLength, (uint8_t *)""Initiator"", 9, 8, contextAlice->initiatorCachedSecretHash.pbxsecretID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextAlice->RNGContext, contextAlice->initiatorCachedSecretHash.pbxsecretID, 8); } if (contextAlice->cachedSecret.rs1!=NULL) { contextAlice->channelContext[0]->hmacFunction(contextAlice->cachedSecret.rs1, contextAlice->cachedSecret.rs1Length, (uint8_t *)""Responder"", 9, 8, contextAlice->responderCachedSecretHash.rs1ID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextAlice->RNGContext, contextAlice->responderCachedSecretHash.rs1ID, 8); } if (contextAlice->cachedSecret.rs2!=NULL) { contextAlice->channelContext[0]->hmacFunction(contextAlice->cachedSecret.rs2, contextAlice->cachedSecret.rs2Length, (uint8_t *)""Responder"", 9, 8, contextAlice->responderCachedSecretHash.rs2ID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextAlice->RNGContext, contextAlice->responderCachedSecretHash.rs2ID, 8); } if (contextAlice->cachedSecret.auxsecret!=NULL) { contextAlice->channelContext[0]->hmacFunction(contextAlice->cachedSecret.auxsecret, contextAlice->cachedSecret.auxsecretLength, contextAlice->channelContext[0]->peerH[3], 32, 8, contextAlice->channelContext[0]->responderAuxsecretID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextAlice->RNGContext, contextAlice->channelContext[0]->responderAuxsecretID, 8); } if (contextAlice->cachedSecret.pbxsecret!=NULL) { contextAlice->channelContext[0]->hmacFunction(contextAlice->cachedSecret.pbxsecret, contextAlice->cachedSecret.pbxsecretLength, (uint8_t *)""Responder"", 9, 8, contextAlice->responderCachedSecretHash.pbxsecretID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextAlice->RNGContext, contextAlice->responderCachedSecretHash.pbxsecretID, 8); } /* Bob hashes*/ if (contextBob->cachedSecret.rs1!=NULL) { contextBob->channelContext[0]->hmacFunction(contextBob->cachedSecret.rs1, contextBob->cachedSecret.rs1Length, (uint8_t *)""Initiator"", 9, 8, contextBob->initiatorCachedSecretHash.rs1ID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextBob->RNGContext, contextBob->initiatorCachedSecretHash.rs1ID, 8); } if (contextBob->cachedSecret.rs2!=NULL) { contextBob->channelContext[0]->hmacFunction(contextBob->cachedSecret.rs2, contextBob->cachedSecret.rs2Length, (uint8_t *)""Initiator"", 9, 8, contextBob->initiatorCachedSecretHash.rs2ID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextBob->RNGContext, contextBob->initiatorCachedSecretHash.rs2ID, 8); } if (contextBob->cachedSecret.auxsecret!=NULL) { contextBob->channelContext[0]->hmacFunction(contextBob->cachedSecret.auxsecret, contextBob->cachedSecret.auxsecretLength, contextBob->channelContext[0]->selfH[3], 32, 8, contextBob->channelContext[0]->initiatorAuxsecretID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextBob->RNGContext, contextBob->channelContext[0]->initiatorAuxsecretID, 8); } if (contextBob->cachedSecret.pbxsecret!=NULL) { contextBob->channelContext[0]->hmacFunction(contextBob->cachedSecret.pbxsecret, contextBob->cachedSecret.pbxsecretLength, (uint8_t *)""Initiator"", 9, 8, contextBob->initiatorCachedSecretHash.pbxsecretID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextBob->RNGContext, contextBob->initiatorCachedSecretHash.pbxsecretID, 8); } if (contextBob->cachedSecret.rs1!=NULL) { contextBob->channelContext[0]->hmacFunction(contextBob->cachedSecret.rs1, contextBob->cachedSecret.rs1Length, (uint8_t *)""Responder"", 9, 8, contextBob->responderCachedSecretHash.rs1ID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextBob->RNGContext, contextBob->responderCachedSecretHash.rs1ID, 8); } if (contextBob->cachedSecret.rs2!=NULL) { contextBob->channelContext[0]->hmacFunction(contextBob->cachedSecret.rs2, contextBob->cachedSecret.rs2Length, (uint8_t *)""Responder"", 9, 8, contextBob->responderCachedSecretHash.rs2ID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextBob->RNGContext, contextBob->responderCachedSecretHash.rs2ID, 8); } if (contextBob->cachedSecret.auxsecret!=NULL) { contextBob->channelContext[0]->hmacFunction(contextBob->cachedSecret.auxsecret, contextBob->cachedSecret.auxsecretLength, contextBob->channelContext[0]->peerH[3], 32, 8, contextBob->channelContext[0]->responderAuxsecretID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextBob->RNGContext, contextBob->channelContext[0]->responderAuxsecretID, 8); } if (contextBob->cachedSecret.pbxsecret!=NULL) { contextBob->channelContext[0]->hmacFunction(contextBob->cachedSecret.pbxsecret, contextBob->cachedSecret.pbxsecretLength, (uint8_t *)""Responder"", 9, 8, contextBob->responderCachedSecretHash.pbxsecretID); } else { /* we have no secret, generate a random */ bctoolbox_rng_get(contextBob->RNGContext, contextBob->responderCachedSecretHash.pbxsecretID, 8); } /* dump alice's packet on both sides */ bzrtp_message (""\nAlice original Packet is \n""); packetDump(alice_Hello, 1); bzrtp_message (""\nBob's parsed Alice Packet is \n""); packetDump(bob_HelloFromAlice, 0); /* Create the DHPart2 packet (that we then may change to DHPart1 if we ended to be the responder) */ alice_selfDHPart = bzrtp_createZrtpPacket(contextAlice, contextAlice->channelContext[0], MSGTYPE_DHPART2, &retval); retval += bzrtp_packetBuild(contextAlice, contextAlice->channelContext[0], alice_selfDHPart, 0); /* we don't care now about sequence number as we just need to build the message to be able to insert a hash of it into the commit packet */ if (retval == 0) { /* ok, insert it in context as we need it to build the commit packet */ contextAlice->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID] = alice_selfDHPart; } else { bzrtp_message (""Alice building DHPart packet returns %x\n"", retval); } bob_selfDHPart = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[0], MSGTYPE_DHPART2, &retval); retval +=bzrtp_packetBuild(contextBob, contextBob->channelContext[0], bob_selfDHPart, 0); /* we don't care now about sequence number as we just need to build the message to be able to insert a hash of it into the commit packet */ if (retval == 0) { /* ok, insert it in context as we need it to build the commit packet */ contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID] = bob_selfDHPart; } else { bzrtp_message (""Bob building DHPart packet returns %x\n"", retval); } bzrtp_message(""Alice DHPart packet:\n""); packetDump(alice_selfDHPart,0); bzrtp_message(""Bob DHPart packet:\n""); packetDump(bob_selfDHPart,0); /* respond to HELLO packet with an HelloACK - 1 create packets */ alice_HelloACK = bzrtp_createZrtpPacket(contextAlice, contextAlice->channelContext[0], MSGTYPE_HELLOACK, &retval); retval += bzrtp_packetBuild(contextAlice, contextAlice->channelContext[0], alice_HelloACK, contextAlice->channelContext[0]->selfSequenceNumber); if (retval == 0) { contextAlice->channelContext[0]->selfSequenceNumber++; } else { bzrtp_message(""Alice building HelloACK return %x\n"", retval); } bob_HelloACK = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[0], MSGTYPE_HELLOACK, &retval); retval += bzrtp_packetBuild(contextBob, contextBob->channelContext[0], bob_HelloACK, contextBob->channelContext[0]->selfSequenceNumber); if (retval == 0) { contextBob->channelContext[0]->selfSequenceNumber++; } else { bzrtp_message(""Bob building HelloACK return %x\n"", retval); } /* exchange the HelloACK */ alice_HelloACKFromBob = bzrtp_packetCheck(bob_HelloACK->packetString, bob_HelloACK->messageLength+16, contextAlice->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[0], bob_HelloACK->packetString, bob_HelloACK->messageLength+16, alice_HelloACKFromBob); bzrtp_message (""Alice parsing Hello ACK returns %x\n"", retval); if (retval==0) { contextAlice->channelContext[0]->peerSequenceNumber = alice_HelloACKFromBob->sequenceNumber; } bob_HelloACKFromAlice = bzrtp_packetCheck(alice_HelloACK->packetString, alice_HelloACK->messageLength+16, contextBob->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextBob, contextBob->channelContext[0], alice_HelloACK->packetString, alice_HelloACK->messageLength+16, bob_HelloACKFromAlice); bzrtp_message (""Bob parsing Hello ACK returns %x\n"", retval); if (retval==0) { contextBob->channelContext[0]->peerSequenceNumber = bob_HelloACKFromAlice->sequenceNumber; } bzrtp_freeZrtpPacket(alice_HelloACK); bzrtp_freeZrtpPacket(bob_HelloACK); bzrtp_freeZrtpPacket(alice_HelloACKFromBob); bzrtp_freeZrtpPacket(bob_HelloACKFromAlice); /* now build the commit message (both Alice and Bob will send it, then use the mechanism of rfc section 4.2 to determine who will be the initiator)*/ alice_Commit = bzrtp_createZrtpPacket(contextAlice, contextAlice->channelContext[0], MSGTYPE_COMMIT, &retval); retval += bzrtp_packetBuild(contextAlice, contextAlice->channelContext[0], alice_Commit, contextAlice->channelContext[0]->selfSequenceNumber); if (retval == 0) { contextAlice->channelContext[0]->selfSequenceNumber++; contextAlice->channelContext[0]->selfPackets[COMMIT_MESSAGE_STORE_ID] = alice_Commit; } bzrtp_message(""Alice building Commit return %x\n"", retval); bob_Commit = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[0], MSGTYPE_COMMIT, &retval); retval += bzrtp_packetBuild(contextBob, contextBob->channelContext[0], bob_Commit, contextBob->channelContext[0]->selfSequenceNumber); if (retval == 0) { contextBob->channelContext[0]->selfSequenceNumber++; contextBob->channelContext[0]->selfPackets[COMMIT_MESSAGE_STORE_ID] = bob_Commit; } bzrtp_message(""Bob building Commit return %x\n"", retval); /* and exchange the commits */ bob_CommitFromAlice = bzrtp_packetCheck(alice_Commit->packetString, alice_Commit->messageLength+16, contextBob->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextBob, contextBob->channelContext[0], alice_Commit->packetString, alice_Commit->messageLength+16, bob_CommitFromAlice); bzrtp_message (""Bob parsing Commit returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ bzrtpCommitMessage_t *bob_CommitFromAlice_message = (bzrtpCommitMessage_t *)bob_CommitFromAlice->messageData; contextBob->channelContext[0]->peerSequenceNumber = bob_CommitFromAlice->sequenceNumber; memcpy(contextBob->channelContext[0]->peerH[2], bob_CommitFromAlice_message->H2, 32); contextBob->channelContext[0]->peerPackets[COMMIT_MESSAGE_STORE_ID] = bob_CommitFromAlice; } packetDump(bob_CommitFromAlice, 0); alice_CommitFromBob = bzrtp_packetCheck(bob_Commit->packetString, bob_Commit->messageLength+16, contextAlice->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[0], bob_Commit->packetString, bob_Commit->messageLength+16, alice_CommitFromBob); bzrtp_message (""Alice parsing Commit returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextAlice->channelContext[0]->peerSequenceNumber = alice_CommitFromBob->sequenceNumber; /* Alice will be the initiator (commit contention not implemented in this test) so just discard bob's commit */ /*bzrtpCommirMessage_t *alice_CommitFromBob_message = (bzrtpCommitMessage_t *)alice_CommitFromBob->messageData; memcpy(contextAlice->channelContext[0]->peerH[2], alice_CommitFromBob_message->H2, 32); contextAlice->channelContext[0]->peerPackets[COMMIT_MESSAGE_STORE_ID] = alice_CommitFromBob;*/ } packetDump(alice_CommitFromBob, 0); bzrtp_freeZrtpPacket(alice_CommitFromBob); /* Now determine who shall be the initiator : rfc section 4.2 */ /* select the one with the lowest value of hvi */ /* for test purpose, we will set Alice as the initiator */ contextBob->channelContext[0]->role = RESPONDER; /* Bob (responder) shall update his selected algo list to match Alice selection */ /* no need to do this here as we have the same selection */ /* Bob is the responder, rebuild his DHPart packet to be responder and not initiator : */ /* as responder, bob must also swap his aux shared secret between responder and initiator as they are computed using the H3 and not a constant string */ memcpy(tmpBuffer, contextBob->channelContext[0]->initiatorAuxsecretID, 8); memcpy(contextBob->channelContext[0]->initiatorAuxsecretID, contextBob->channelContext[0]->responderAuxsecretID, 8); memcpy(contextBob->channelContext[0]->responderAuxsecretID, tmpBuffer, 8); contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageType = MSGTYPE_DHPART1; /* we are now part 1*/ bob_DHPart1 = (bzrtpDHPartMessage_t *)contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageData; /* change the shared secret ID to the responder one (we set them by default to the initiator's one) */ memcpy(bob_DHPart1->rs1ID, contextBob->responderCachedSecretHash.rs1ID, 8); memcpy(bob_DHPart1->rs2ID, contextBob->responderCachedSecretHash.rs2ID, 8); memcpy(bob_DHPart1->auxsecretID, contextBob->channelContext[0]->responderAuxsecretID, 8); memcpy(bob_DHPart1->pbxsecretID, contextBob->responderCachedSecretHash.pbxsecretID, 8); retval +=bzrtp_packetBuild(contextBob, contextBob->channelContext[0], contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID],contextBob->channelContext[0]->selfSequenceNumber); if (retval == 0) { contextBob->channelContext[0]->selfSequenceNumber++; } bzrtp_message(""Bob building DHPart1 return %x\n"", retval); /* Alice parse bob's DHPart1 message */ alice_DHPart1FromBob = bzrtp_packetCheck(contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->packetString, contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageLength+16, contextAlice->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[0], contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->packetString, contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageLength+16, alice_DHPart1FromBob); bzrtp_message (""Alice parsing DHPart1 returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextAlice->channelContext[0]->peerSequenceNumber = alice_DHPart1FromBob->sequenceNumber; alice_DHPart1FromBob_message = (bzrtpDHPartMessage_t *)alice_DHPart1FromBob->messageData; memcpy(contextAlice->channelContext[0]->peerH[1], alice_DHPart1FromBob_message->H1, 32); contextAlice->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID] = alice_DHPart1FromBob; } packetDump(alice_DHPart1FromBob, 1); /* Now Alice may check which shared secret she expected and if they are valid in bob's DHPart1 */ if (contextAlice->cachedSecret.rs1!=NULL) { if (memcmp(contextAlice->responderCachedSecretHash.rs1ID, alice_DHPart1FromBob_message->rs1ID,8) != 0) { bzrtp_message (""Alice found that requested shared secret rs1 ID differs!\n""); } else { bzrtp_message(""Alice validate rs1ID from bob DHPart1\n""); } } if (contextAlice->cachedSecret.rs2!=NULL) { if (memcmp(contextAlice->responderCachedSecretHash.rs2ID, alice_DHPart1FromBob_message->rs2ID,8) != 0) { bzrtp_message (""Alice found that requested shared secret rs2 ID differs!\n""); } else { bzrtp_message(""Alice validate rs2ID from bob DHPart1\n""); } } if (contextAlice->cachedSecret.auxsecret!=NULL) { if (memcmp(contextAlice->channelContext[0]->responderAuxsecretID, alice_DHPart1FromBob_message->auxsecretID,8) != 0) { bzrtp_message (""Alice found that requested shared secret aux secret ID differs!\n""); } else { bzrtp_message(""Alice validate aux secret ID from bob DHPart1\n""); } } if (contextAlice->cachedSecret.pbxsecret!=NULL) { if (memcmp(contextAlice->responderCachedSecretHash.pbxsecretID, alice_DHPart1FromBob_message->pbxsecretID,8) != 0) { bzrtp_message (""Alice found that requested shared secret pbx secret ID differs!\n""); } else { bzrtp_message(""Alice validate pbxsecretID from bob DHPart1\n""); } } /* Now Alice shall check that the PV from bob is not 1 or Prime-1 TODO*/ /* Compute the shared DH secret */ contextAlice->DHMContext->peer = (uint8_t *)malloc(contextAlice->channelContext[0]->keyAgreementLength*sizeof(uint8_t)); memcpy (contextAlice->DHMContext->peer, alice_DHPart1FromBob_message->pv, contextAlice->channelContext[0]->keyAgreementLength); bctoolbox_DHMComputeSecret(contextAlice->DHMContext, (int (*)(void *, uint8_t *, size_t))bctoolbox_rng_get, (void *)contextAlice->RNGContext); /* So Alice send bob her DHPart2 message which is already prepared and stored (we just need to update the sequence number) */ bzrtp_packetUpdateSequenceNumber(contextAlice->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID], contextAlice->channelContext[0]->selfSequenceNumber); contextAlice->channelContext[0]->selfSequenceNumber++; /* Bob parse Alice's DHPart2 message */ bob_DHPart2FromAlice = bzrtp_packetCheck(contextAlice->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->packetString, contextAlice->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageLength+16, contextBob->channelContext[0]->peerSequenceNumber, &retval); bzrtp_message (""Bob checking DHPart2 returns %x\n"", retval); retval += bzrtp_packetParser(contextBob, contextBob->channelContext[0], contextAlice->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->packetString, contextAlice->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageLength+16, bob_DHPart2FromAlice); bzrtp_message (""Bob parsing DHPart2 returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextBob->channelContext[0]->peerSequenceNumber = bob_DHPart2FromAlice->sequenceNumber; bob_DHPart2FromAlice_message = (bzrtpDHPartMessage_t *)bob_DHPart2FromAlice->messageData; memcpy(contextBob->channelContext[0]->peerH[1], bob_DHPart2FromAlice_message->H1, 32); contextBob->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID] = bob_DHPart2FromAlice; } packetDump(bob_DHPart2FromAlice, 0); /* Now Bob may check which shared secret she expected and if they are valid in bob's DHPart1 */ if (contextBob->cachedSecret.rs1!=NULL) { if (memcmp(contextBob->initiatorCachedSecretHash.rs1ID, bob_DHPart2FromAlice_message->rs1ID,8) != 0) { bzrtp_message (""Bob found that requested shared secret rs1 ID differs!\n""); } else { bzrtp_message(""Bob validate rs1ID from Alice DHPart2\n""); } } if (contextBob->cachedSecret.rs2!=NULL) { if (memcmp(contextBob->initiatorCachedSecretHash.rs2ID, bob_DHPart2FromAlice_message->rs2ID,8) != 0) { bzrtp_message (""Bob found that requested shared secret rs2 ID differs!\n""); } else { bzrtp_message(""Bob validate rs2ID from Alice DHPart2\n""); } } if (contextBob->cachedSecret.auxsecret!=NULL) { if (memcmp(contextBob->channelContext[0]->initiatorAuxsecretID, bob_DHPart2FromAlice_message->auxsecretID,8) != 0) { bzrtp_message (""Bob found that requested shared secret aux secret ID differs!\n""); } else { bzrtp_message(""Bob validate aux secret ID from Alice DHPart2\n""); } } if (contextBob->cachedSecret.pbxsecret!=NULL) { if (memcmp(contextBob->initiatorCachedSecretHash.pbxsecretID, bob_DHPart2FromAlice_message->pbxsecretID,8) != 0) { bzrtp_message (""Bob found that requested shared secret pbx secret ID differs!\n""); } else { bzrtp_message(""Bob validate pbxsecretID from Alice DHPart2\n""); } } /* Now Bob shall check that the PV from Alice is not 1 or Prime-1 TODO*/ /* Compute the shared DH secret */ contextBob->DHMContext->peer = (uint8_t *)malloc(contextBob->channelContext[0]->keyAgreementLength*sizeof(uint8_t)); memcpy (contextBob->DHMContext->peer, bob_DHPart2FromAlice_message->pv, contextBob->channelContext[0]->keyAgreementLength); bctoolbox_DHMComputeSecret(contextBob->DHMContext, (int (*)(void *, uint8_t *, size_t))bctoolbox_rng_get, (void *)contextAlice->RNGContext); /* JUST FOR TEST: check that the generated secrets are the same */ secretLength = bob_DHPart2FromAlice->messageLength-84; /* length of generated secret is the same than public value */ if (memcmp(contextBob->DHMContext->key, contextAlice->DHMContext->key, secretLength)==0) { bzrtp_message(""Secret Key correctly exchanged \n""); CU_PASS(""Secret Key exchange OK""); } else { CU_FAIL(""Secret Key exchange failed""); bzrtp_message(""ERROR : secretKey exchange failed!!\n""); } /* now compute the total_hash as in rfc section 4.4.1.4 * total_hash = hash(Hello of responder || Commit || DHPart1 || DHPart2) */ totalHashDataLength = bob_Hello->messageLength + alice_Commit->messageLength + contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageLength + alice_selfDHPart->messageLength; dataToHash = (uint8_t *)malloc(totalHashDataLength*sizeof(uint8_t)); /* get all data from Alice */ memcpy(dataToHash, contextAlice->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextAlice->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID]->messageLength); hashDataIndex += contextAlice->channelContext[0]->peerPackets[HELLO_MESSAGE_STORE_ID]->messageLength; memcpy(dataToHash+hashDataIndex, contextAlice->channelContext[0]->selfPackets[COMMIT_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextAlice->channelContext[0]->selfPackets[COMMIT_MESSAGE_STORE_ID]->messageLength); hashDataIndex += contextAlice->channelContext[0]->selfPackets[COMMIT_MESSAGE_STORE_ID]->messageLength; memcpy(dataToHash+hashDataIndex, contextAlice->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextAlice->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID]->messageLength); hashDataIndex += contextAlice->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID]->messageLength; memcpy(dataToHash+hashDataIndex, contextAlice->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextAlice->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageLength); contextAlice->channelContext[0]->hashFunction(dataToHash, totalHashDataLength, 32, alice_totalHash); /* get all data from Bob */ hashDataIndex = 0; memcpy(dataToHash, contextBob->channelContext[0]->selfPackets[HELLO_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextBob->channelContext[0]->selfPackets[HELLO_MESSAGE_STORE_ID]->messageLength); hashDataIndex += contextBob->channelContext[0]->selfPackets[HELLO_MESSAGE_STORE_ID]->messageLength; memcpy(dataToHash+hashDataIndex, contextBob->channelContext[0]->peerPackets[COMMIT_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextBob->channelContext[0]->peerPackets[COMMIT_MESSAGE_STORE_ID]->messageLength); hashDataIndex += contextBob->channelContext[0]->peerPackets[COMMIT_MESSAGE_STORE_ID]->messageLength; memcpy(dataToHash+hashDataIndex, contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageLength); hashDataIndex += contextBob->channelContext[0]->selfPackets[DHPART_MESSAGE_STORE_ID]->messageLength; memcpy(dataToHash+hashDataIndex, contextBob->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextBob->channelContext[0]->peerPackets[DHPART_MESSAGE_STORE_ID]->messageLength); contextBob->channelContext[0]->hashFunction(dataToHash, totalHashDataLength, 32, bob_totalHash); if (memcmp(bob_totalHash, alice_totalHash, 32) == 0) { bzrtp_message(""Got the same total hash\n""); CU_PASS(""Total Hash match""); } else { bzrtp_message(""AARGG!! total hash mismatch""); CU_FAIL(""Total Hash mismatch""); } /* now compute s0 and KDF_context as in rfc section 4.4.1.4 s0 = hash(counter || DHResult || ""ZRTP-HMAC-KDF"" || ZIDi || ZIDr || total_hash || len(s1) || s1 || len(s2) || s2 || len(s3) || s3) counter is a fixed 32 bits integer in big endian set to 1 : 0x00000001 */ free(dataToHash); contextAlice->channelContext[0]->KDFContextLength = 24+32;/* actual depends on selected hash length*/ contextAlice->channelContext[0]->KDFContext = (uint8_t *)malloc(contextAlice->channelContext[0]->KDFContextLength*sizeof(uint8_t)); memcpy(contextAlice->channelContext[0]->KDFContext, contextAlice->selfZID, 12); /* ZIDi*/ memcpy(contextAlice->channelContext[0]->KDFContext+12, contextAlice->peerZID, 12); /* ZIDr */ memcpy(contextAlice->channelContext[0]->KDFContext+24, alice_totalHash, 32); /* total Hash*/ /* get s1 from rs1 or rs2 */ if (contextAlice->cachedSecret.rs1 != NULL) { /* if there is a s1 (already validated when received the DHpacket) */ s1 = contextAlice->cachedSecret.rs1; s1Length = contextAlice->cachedSecret.rs1Length; } else if (contextAlice->cachedSecret.rs2 != NULL) { /* otherwise if there is a s2 (already validated when received the DHpacket) */ s1 = contextAlice->cachedSecret.rs2; s1Length = contextAlice->cachedSecret.rs2Length; } /* s2 is the auxsecret */ s2 = contextAlice->cachedSecret.auxsecret; /* this may be null if no match or no aux secret where found */ s2Length = contextAlice->cachedSecret.auxsecretLength; /* this may be 0 if no match or no aux secret where found */ /* s3 is the pbxsecret */ s3 = contextAlice->cachedSecret.pbxsecret; /* this may be null if no match or no pbx secret where found */ s3Length = contextAlice->cachedSecret.pbxsecretLength; /* this may be 0 if no match or no pbx secret where found */ totalHashDataLength = 4+secretLength+13/*ZRTP-HMAC-KDF string*/ + 12 + 12 + 32 + 4 +s1Length + 4 +s2Length + 4 + s3Length; /* secret length was computed before as the length of DH secret data */ dataToHash = (uint8_t *)malloc(totalHashDataLength*sizeof(uint8_t)); dataToHash[0] = 0x00; dataToHash[1] = 0x00; dataToHash[2] = 0x00; dataToHash[3] = 0x01; hashDataIndex = 4; memcpy(dataToHash+hashDataIndex, contextAlice->DHMContext->key, secretLength); hashDataIndex += secretLength; memcpy(dataToHash+hashDataIndex, ""ZRTP-HMAC-KDF"", 13); hashDataIndex += 13; memcpy(dataToHash+hashDataIndex, contextAlice->channelContext[0]->KDFContext, contextAlice->channelContext[0]->KDFContextLength); hashDataIndex += 56; dataToHash[hashDataIndex++] = (uint8_t)((s1Length>>24)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s1Length>>16)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s1Length>>8)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)(s1Length&0xFF); if (s1!=NULL) { memcpy(dataToHash+hashDataIndex, s1, s1Length); hashDataIndex += s1Length; } dataToHash[hashDataIndex++] = (uint8_t)((s2Length>>24)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s2Length>>16)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s2Length>>8)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)(s2Length&0xFF); if (s2!=NULL) { memcpy(dataToHash+hashDataIndex, s2, s2Length); hashDataIndex += s2Length; } dataToHash[hashDataIndex++] = (uint8_t)((s3Length>>24)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s3Length>>16)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s3Length>>8)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)(s3Length&0xFF); if (s3!=NULL) { memcpy(dataToHash+hashDataIndex, s3, s3Length); hashDataIndex += s3Length; } contextAlice->channelContext[0]->s0 = (uint8_t *)malloc(32*sizeof(uint8_t)); contextAlice->channelContext[0]->hashFunction(dataToHash, totalHashDataLength, 32, contextAlice->channelContext[0]->s0); /* destroy all cached keys in context */ if (contextAlice->cachedSecret.rs1!=NULL) { bzrtp_DestroyKey(contextAlice->cachedSecret.rs1, contextAlice->cachedSecret.rs1Length, contextAlice->RNGContext); free(contextAlice->cachedSecret.rs1); contextAlice->cachedSecret.rs1 = NULL; } if (contextAlice->cachedSecret.rs2!=NULL) { bzrtp_DestroyKey(contextAlice->cachedSecret.rs2, contextAlice->cachedSecret.rs2Length, contextAlice->RNGContext); free(contextAlice->cachedSecret.rs2); contextAlice->cachedSecret.rs2 = NULL; } if (contextAlice->cachedSecret.auxsecret!=NULL) { bzrtp_DestroyKey(contextAlice->cachedSecret.auxsecret, contextAlice->cachedSecret.auxsecretLength, contextAlice->RNGContext); free(contextAlice->cachedSecret.auxsecret); contextAlice->cachedSecret.auxsecret = NULL; } if (contextAlice->cachedSecret.pbxsecret!=NULL) { bzrtp_DestroyKey(contextAlice->cachedSecret.pbxsecret, contextAlice->cachedSecret.pbxsecretLength, contextAlice->RNGContext); free(contextAlice->cachedSecret.pbxsecret); contextAlice->cachedSecret.pbxsecret = NULL; } /*** Do the same for bob ***/ /* get s1 from rs1 or rs2 */ s1=NULL; s2=NULL; s3=NULL; contextBob->channelContext[0]->KDFContextLength = 24+32;/* actual depends on selected hash length*/ contextBob->channelContext[0]->KDFContext = (uint8_t *)malloc(contextBob->channelContext[0]->KDFContextLength*sizeof(uint8_t)); memcpy(contextBob->channelContext[0]->KDFContext, contextBob->peerZID, 12); /* ZIDi*/ memcpy(contextBob->channelContext[0]->KDFContext+12, contextBob->selfZID, 12); /* ZIDr */ memcpy(contextBob->channelContext[0]->KDFContext+24, bob_totalHash, 32); /* total Hash*/ if (contextBob->cachedSecret.rs1 != NULL) { /* if there is a s1 (already validated when received the DHpacket) */ s1 = contextBob->cachedSecret.rs1; s1Length = contextBob->cachedSecret.rs1Length; } else if (contextBob->cachedSecret.rs2 != NULL) { /* otherwise if there is a s2 (already validated when received the DHpacket) */ s1 = contextBob->cachedSecret.rs2; s1Length = contextBob->cachedSecret.rs2Length; } /* s2 is the auxsecret */ s2 = contextBob->cachedSecret.auxsecret; /* this may be null if no match or no aux secret where found */ s2Length = contextBob->cachedSecret.auxsecretLength; /* this may be 0 if no match or no aux secret where found */ /* s3 is the pbxsecret */ s3 = contextBob->cachedSecret.pbxsecret; /* this may be null if no match or no pbx secret where found */ s3Length = contextBob->cachedSecret.pbxsecretLength; /* this may be 0 if no match or no pbx secret where found */ free(dataToHash); dataToHash = (uint8_t *)malloc(totalHashDataLength*sizeof(uint8_t)); dataToHash[0] = 0x00; dataToHash[1] = 0x00; dataToHash[2] = 0x00; dataToHash[3] = 0x01; hashDataIndex = 4; memcpy(dataToHash+hashDataIndex, contextBob->DHMContext->key, secretLength); hashDataIndex += secretLength; memcpy(dataToHash+hashDataIndex, ""ZRTP-HMAC-KDF"", 13); hashDataIndex += 13; memcpy(dataToHash+hashDataIndex, contextBob->channelContext[0]->KDFContext, contextBob->channelContext[0]->KDFContextLength); hashDataIndex += 56; dataToHash[hashDataIndex++] = (uint8_t)((s1Length>>24)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s1Length>>16)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s1Length>>8)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)(s1Length&0xFF); if (s1!=NULL) { memcpy(dataToHash+hashDataIndex, s1, s1Length); hashDataIndex += s1Length; } dataToHash[hashDataIndex++] = (uint8_t)((s2Length>>24)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s2Length>>16)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s2Length>>8)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)(s2Length&0xFF); if (s2!=NULL) { memcpy(dataToHash+hashDataIndex, s2, s2Length); hashDataIndex += s2Length; } dataToHash[hashDataIndex++] = (uint8_t)((s3Length>>24)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s3Length>>16)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)((s3Length>>8)&0xFF); dataToHash[hashDataIndex++] = (uint8_t)(s3Length&0xFF); if (s3!=NULL) { memcpy(dataToHash+hashDataIndex, s3, s3Length); hashDataIndex += s3Length; } contextBob->channelContext[0]->s0 = (uint8_t *)malloc(32*sizeof(uint8_t)); contextBob->channelContext[0]->hashFunction(dataToHash, totalHashDataLength, 32, contextBob->channelContext[0]->s0); free(dataToHash); /* destroy all cached keys in context */ if (contextBob->cachedSecret.rs1!=NULL) { bzrtp_DestroyKey(contextBob->cachedSecret.rs1, contextBob->cachedSecret.rs1Length, contextBob->RNGContext); free(contextBob->cachedSecret.rs1); contextBob->cachedSecret.rs1 = NULL; } if (contextBob->cachedSecret.rs2!=NULL) { bzrtp_DestroyKey(contextBob->cachedSecret.rs2, contextBob->cachedSecret.rs2Length, contextBob->RNGContext); free(contextBob->cachedSecret.rs2); contextBob->cachedSecret.rs2 = NULL; } if (contextBob->cachedSecret.auxsecret!=NULL) { bzrtp_DestroyKey(contextBob->cachedSecret.auxsecret, contextBob->cachedSecret.auxsecretLength, contextBob->RNGContext); free(contextBob->cachedSecret.auxsecret); contextBob->cachedSecret.auxsecret = NULL; } if (contextBob->cachedSecret.pbxsecret!=NULL) { bzrtp_DestroyKey(contextBob->cachedSecret.pbxsecret, contextBob->cachedSecret.pbxsecretLength, contextBob->RNGContext); free(contextBob->cachedSecret.pbxsecret); contextBob->cachedSecret.pbxsecret = NULL; } /* DEBUG compare s0 */ if (memcmp(contextBob->channelContext[0]->s0, contextAlice->channelContext[0]->s0, 32)==0) { bzrtp_message(""Got the same s0\n""); CU_PASS(""s0 match""); } else { bzrtp_message(""ERROR s0 differs\n""); CU_PASS(""s0 mismatch""); } /* now compute the ZRTPSession key : section 4.5.2 * ZRTPSess = KDF(s0, ""ZRTP Session Key"", KDF_Context, negotiated hash length)*/ contextAlice->ZRTPSessLength=32; /* must be set to the length of negotiated hash */ contextAlice->ZRTPSess = (uint8_t *)malloc(contextAlice->ZRTPSessLength*sizeof(uint8_t)); retval = bzrtp_keyDerivationFunction(contextAlice->channelContext[0]->s0, contextAlice->channelContext[0]->hashLength, (uint8_t *)""ZRTP Session Key"", 16, contextAlice->channelContext[0]->KDFContext, contextAlice->channelContext[0]->KDFContextLength, /* this one too depends on selected hash */ contextAlice->channelContext[0]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[0]->hmacFunction, contextAlice->ZRTPSess); contextBob->ZRTPSessLength=32; /* must be set to the length of negotiated hash */ contextBob->ZRTPSess = (uint8_t *)malloc(contextBob->ZRTPSessLength*sizeof(uint8_t)); retval = bzrtp_keyDerivationFunction(contextBob->channelContext[0]->s0, contextBob->channelContext[0]->hashLength, (uint8_t *)""ZRTP Session Key"", 16, contextBob->channelContext[0]->KDFContext, contextBob->channelContext[0]->KDFContextLength, /* this one too depends on selected hash */ contextBob->channelContext[0]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[0]->hmacFunction, contextBob->ZRTPSess); /* DEBUG compare ZRTPSess Key */ if (memcmp(contextBob->ZRTPSess, contextAlice->ZRTPSess, 32)==0) { bzrtp_message(""Got the same ZRTPSess\n""); CU_PASS(""ZRTPSess match""); } else { bzrtp_message(""ERROR ZRTPSess differs\n""); CU_PASS(""ZRTPSess mismatch""); } /* compute the sas according to rfc section 4.5.2 sashash = KDF(s0, ""SAS"", KDF_Context, 256) */ retval = bzrtp_keyDerivationFunction(contextAlice->channelContext[0]->s0, contextAlice->channelContext[0]->hashLength, (uint8_t *)""SAS"", 3, contextAlice->channelContext[0]->KDFContext, contextAlice->channelContext[0]->KDFContextLength, /* this one too depends on selected hash */ 256/8, /* function gets L in bytes */ (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[0]->hmacFunction, alice_sasHash); retval = bzrtp_keyDerivationFunction(contextBob->channelContext[0]->s0, contextBob->channelContext[0]->hashLength, (uint8_t *)""SAS"", 3, contextBob->channelContext[0]->KDFContext, contextBob->channelContext[0]->KDFContextLength, /* this one too depends on selected hash */ 256/8, /* function gets L in bytes */ (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[0]->hmacFunction, bob_sasHash); /* DEBUG compare sasHash */ if (memcmp(alice_sasHash, bob_sasHash, 32)==0) { bzrtp_message(""Got the same SAS Hash\n""); CU_PASS(""SAS Hash match""); } else { bzrtp_message(""ERROR SAS Hash differs\n""); CU_PASS(""SAS Hash mismatch""); } /* display SAS (we shall not do this now but after the confirm message exchanges) */ sasValue = ((uint32_t)alice_sasHash[0]<<24) | ((uint32_t)alice_sasHash[1]<<16) | ((uint32_t)alice_sasHash[2]<<8) | ((uint32_t)(alice_sasHash[3])); contextAlice->channelContext[0]->sasFunction(sasValue, sas, 5); bzrtp_message(""Alice SAS is %.4s\n"", sas); sasValue = ((uint32_t)bob_sasHash[0]<<24) | ((uint32_t)bob_sasHash[1]<<16) | ((uint32_t)bob_sasHash[2]<<8) | ((uint32_t)(bob_sasHash[3])); contextBob->channelContext[0]->sasFunction(sasValue, sas, 5); bzrtp_message(""Bob SAS is %.4s\n"", sas); /* now derive the other keys (mackeyi, mackeyr, zrtpkeyi and zrtpkeyr, srtpkeys and salt) */ contextAlice->channelContext[0]->mackeyi = (uint8_t *)malloc(contextAlice->channelContext[0]->hashLength*(sizeof(uint8_t))); contextAlice->channelContext[0]->mackeyr = (uint8_t *)malloc(contextAlice->channelContext[0]->hashLength*(sizeof(uint8_t))); contextAlice->channelContext[0]->zrtpkeyi = (uint8_t *)malloc(contextAlice->channelContext[0]->cipherKeyLength*(sizeof(uint8_t))); contextAlice->channelContext[0]->zrtpkeyr = (uint8_t *)malloc(contextAlice->channelContext[0]->cipherKeyLength*(sizeof(uint8_t))); contextBob->channelContext[0]->mackeyi = (uint8_t *)malloc(contextBob->channelContext[0]->hashLength*(sizeof(uint8_t))); contextBob->channelContext[0]->mackeyr = (uint8_t *)malloc(contextBob->channelContext[0]->hashLength*(sizeof(uint8_t))); contextBob->channelContext[0]->zrtpkeyi = (uint8_t *)malloc(contextBob->channelContext[0]->cipherKeyLength*(sizeof(uint8_t))); contextBob->channelContext[0]->zrtpkeyr = (uint8_t *)malloc(contextBob->channelContext[0]->cipherKeyLength*(sizeof(uint8_t))); /* Alice */ retval = bzrtp_keyDerivationFunction(contextAlice->channelContext[0]->s0, contextAlice->channelContext[0]->hashLength, (uint8_t *)""Initiator HMAC key"", 18, contextAlice->channelContext[0]->KDFContext, contextAlice->channelContext[0]->KDFContextLength, contextAlice->channelContext[0]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[0]->hmacFunction, contextAlice->channelContext[0]->mackeyi); retval += bzrtp_keyDerivationFunction(contextAlice->channelContext[0]->s0, contextAlice->channelContext[0]->hashLength, (uint8_t *)""Responder HMAC key"", 18, contextAlice->channelContext[0]->KDFContext, contextAlice->channelContext[0]->KDFContextLength, contextAlice->channelContext[0]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[0]->hmacFunction, contextAlice->channelContext[0]->mackeyr); retval += bzrtp_keyDerivationFunction(contextAlice->channelContext[0]->s0, contextAlice->channelContext[0]->hashLength, (uint8_t *)""Initiator ZRTP key"", 18, contextAlice->channelContext[0]->KDFContext, contextAlice->channelContext[0]->KDFContextLength, contextAlice->channelContext[0]->cipherKeyLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[0]->hmacFunction, contextAlice->channelContext[0]->zrtpkeyi); retval += bzrtp_keyDerivationFunction(contextAlice->channelContext[0]->s0, contextAlice->channelContext[0]->hashLength, (uint8_t *)""Responder ZRTP key"", 18, contextAlice->channelContext[0]->KDFContext, contextAlice->channelContext[0]->KDFContextLength, contextAlice->channelContext[0]->cipherKeyLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[0]->hmacFunction, contextAlice->channelContext[0]->zrtpkeyr); /* Bob */ retval = bzrtp_keyDerivationFunction(contextBob->channelContext[0]->s0, contextBob->channelContext[0]->hashLength, (uint8_t *)""Initiator HMAC key"", 18, contextBob->channelContext[0]->KDFContext, contextBob->channelContext[0]->KDFContextLength, contextBob->channelContext[0]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[0]->hmacFunction, contextBob->channelContext[0]->mackeyi); retval += bzrtp_keyDerivationFunction(contextBob->channelContext[0]->s0, contextBob->channelContext[0]->hashLength, (uint8_t *)""Responder HMAC key"", 18, contextBob->channelContext[0]->KDFContext, contextBob->channelContext[0]->KDFContextLength, contextBob->channelContext[0]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[0]->hmacFunction, contextBob->channelContext[0]->mackeyr); retval += bzrtp_keyDerivationFunction(contextBob->channelContext[0]->s0, contextBob->channelContext[0]->hashLength, (uint8_t *)""Initiator ZRTP key"", 18, contextBob->channelContext[0]->KDFContext, contextBob->channelContext[0]->KDFContextLength, contextBob->channelContext[0]->cipherKeyLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[0]->hmacFunction, contextBob->channelContext[0]->zrtpkeyi); retval += bzrtp_keyDerivationFunction(contextBob->channelContext[0]->s0, contextBob->channelContext[0]->hashLength, (uint8_t *)""Responder ZRTP key"", 18, contextBob->channelContext[0]->KDFContext, contextBob->channelContext[0]->KDFContextLength, contextBob->channelContext[0]->cipherKeyLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[0]->hmacFunction, contextBob->channelContext[0]->zrtpkeyr); /* DEBUG compare keys */ if ((memcmp(contextAlice->channelContext[0]->mackeyi, contextBob->channelContext[0]->mackeyi, contextAlice->channelContext[0]->hashLength)==0) && (memcmp(contextAlice->channelContext[0]->mackeyr, contextBob->channelContext[0]->mackeyr, contextAlice->channelContext[0]->hashLength)==0) && (memcmp(contextAlice->channelContext[0]->zrtpkeyi, contextBob->channelContext[0]->zrtpkeyi, contextAlice->channelContext[0]->cipherKeyLength)==0) && (memcmp(contextAlice->channelContext[0]->zrtpkeyr, contextBob->channelContext[0]->zrtpkeyr, contextAlice->channelContext[0]->cipherKeyLength)==0)) { bzrtp_message(""Got the same keys\n""); CU_PASS(""keys match""); } else { bzrtp_message(""ERROR keys differ\n""); CU_PASS(""Keys mismatch""); } /* now Bob build the CONFIRM1 packet and send it to Alice */ bob_Confirm1 = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[0], MSGTYPE_CONFIRM1, &retval); retval += bzrtp_packetBuild(contextBob, contextBob->channelContext[0], bob_Confirm1, contextBob->channelContext[0]->selfSequenceNumber); if (retval == 0) { contextBob->channelContext[0]->selfSequenceNumber++; } bzrtp_message(""Bob building Confirm1 return %x\n"", retval); alice_Confirm1FromBob = bzrtp_packetCheck(bob_Confirm1->packetString, bob_Confirm1->messageLength+16, contextAlice->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[0], bob_Confirm1->packetString, bob_Confirm1->messageLength+16, alice_Confirm1FromBob); bzrtp_message (""Alice parsing confirm1 returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextAlice->channelContext[0]->peerSequenceNumber = alice_Confirm1FromBob->sequenceNumber; alice_Confirm1FromBob_message = (bzrtpConfirmMessage_t *)alice_Confirm1FromBob->messageData; memcpy(contextAlice->channelContext[0]->peerH[0], alice_Confirm1FromBob_message->H0, 32); } packetDump(bob_Confirm1,1); packetDump(alice_Confirm1FromBob,0); bzrtp_freeZrtpPacket(alice_Confirm1FromBob); bzrtp_freeZrtpPacket(bob_Confirm1); /* now Alice build the CONFIRM2 packet and send it to Bob */ alice_Confirm2 = bzrtp_createZrtpPacket(contextAlice, contextAlice->channelContext[0], MSGTYPE_CONFIRM2, &retval); retval += bzrtp_packetBuild(contextAlice, contextAlice->channelContext[0], alice_Confirm2, contextAlice->channelContext[0]->selfSequenceNumber); if (retval == 0) { contextAlice->channelContext[0]->selfSequenceNumber++; } bzrtp_message(""Alice building Confirm2 return %x\n"", retval); bob_Confirm2FromAlice = bzrtp_packetCheck(alice_Confirm2->packetString, alice_Confirm2->messageLength+16, contextBob->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextBob, contextBob->channelContext[0], alice_Confirm2->packetString, alice_Confirm2->messageLength+16, bob_Confirm2FromAlice); bzrtp_message (""Bob parsing confirm2 returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextBob->channelContext[0]->peerSequenceNumber = bob_Confirm2FromAlice->sequenceNumber; bob_Confirm2FromAlice_message = (bzrtpConfirmMessage_t *)bob_Confirm2FromAlice->messageData; memcpy(contextBob->channelContext[0]->peerH[0], bob_Confirm2FromAlice_message->H0, 32); /* set bob's status to secure */ contextBob->isSecure = 1; } packetDump(alice_Confirm2,1); packetDump(bob_Confirm2FromAlice,0); bzrtp_freeZrtpPacket(bob_Confirm2FromAlice); bzrtp_freeZrtpPacket(alice_Confirm2); /* Bob build the conf2Ack and send it to Alice */ bob_Conf2ACK = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[0], MSGTYPE_CONF2ACK, &retval); retval += bzrtp_packetBuild(contextBob, contextBob->channelContext[0], bob_Conf2ACK, contextBob->channelContext[0]->selfSequenceNumber); if (retval == 0) { contextBob->channelContext[0]->selfSequenceNumber++; } bzrtp_message(""Bob building Conf2ACK return %x\n"", retval); alice_Conf2ACKFromBob = bzrtp_packetCheck(bob_Conf2ACK->packetString, bob_Conf2ACK->messageLength+16, contextAlice->channelContext[0]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[0], bob_Conf2ACK->packetString, bob_Conf2ACK->messageLength+16, alice_Conf2ACKFromBob); bzrtp_message (""Alice parsing conf2ACK returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextAlice->channelContext[0]->peerSequenceNumber = alice_Conf2ACKFromBob->sequenceNumber; /* set Alice's status to secure */ contextAlice->isSecure = 1; } bzrtp_freeZrtpPacket(bob_Conf2ACK); bzrtp_freeZrtpPacket(alice_Conf2ACKFromBob); dumpContext(""Alice"", contextAlice); dumpContext(""Bob"", contextBob); bzrtp_message(""\n\n\n\n\n*************************************************************\n SECOND CHANNEL\n**********************************************\n\n""); /* Now create a second channel for Bob and Alice */ retval = bzrtp_addChannel(contextAlice, 0x45678901); bzrtp_message(""Add channel to Alice's context returns %d\n"", retval); retval = bzrtp_addChannel(contextBob, 0x54321098); bzrtp_message(""Add channel to Bob's context returns %d\n"", retval); /* create hello packets for this channel */ alice_Hello = bzrtp_createZrtpPacket(contextAlice, contextAlice->channelContext[1], MSGTYPE_HELLO, &retval); if (bzrtp_packetBuild(contextAlice, contextAlice->channelContext[1], alice_Hello, contextAlice->channelContext[1]->selfSequenceNumber) ==0) { contextAlice->channelContext[1]->selfSequenceNumber++; contextAlice->channelContext[1]->selfPackets[HELLO_MESSAGE_STORE_ID] = alice_Hello; } bob_Hello = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[1], MSGTYPE_HELLO, &retval); if (bzrtp_packetBuild(contextBob, contextBob->channelContext[1], bob_Hello, contextBob->channelContext[1]->selfSequenceNumber) ==0) { contextBob->channelContext[1]->selfSequenceNumber++; contextBob->channelContext[1]->selfPackets[HELLO_MESSAGE_STORE_ID] = bob_Hello; } /* now send Alice Hello's to Bob and vice-versa, so they parse them */ alice_HelloFromBob = bzrtp_packetCheck(bob_Hello->packetString, bob_Hello->messageLength+16, contextAlice->channelContext[1]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[0], bob_Hello->packetString, bob_Hello->messageLength+16, alice_HelloFromBob); bzrtp_message (""Alice parsing returns %x\n"", retval); if (retval==0) { bzrtpHelloMessage_t *alice_HelloFromBob_message; int i; uint8_t checkPeerSupportMultiChannel = 0; contextAlice->channelContext[1]->peerSequenceNumber = alice_HelloFromBob->sequenceNumber; /* save bob's Hello packet in Alice's context */ contextAlice->channelContext[1]->peerPackets[HELLO_MESSAGE_STORE_ID] = alice_HelloFromBob; /* we are already secured (shall check isSecure==1), so we just need to check that peer Hello have the Mult in his key agreement list of supported algo */ alice_HelloFromBob_message = (bzrtpHelloMessage_t *)alice_HelloFromBob->messageData; for (i=0; ikc; i++) { if (alice_HelloFromBob_message->supportedKeyAgreement[i] == ZRTP_KEYAGREEMENT_Mult) { checkPeerSupportMultiChannel = 1; } } /* ok multi channel is supported*/ if (checkPeerSupportMultiChannel == 1) { bzrtp_message(""Alice found that Bob supports multi channel\n""); /* now set the choosen algos, they MUST be the same than main channel (channel 0) except for keyAgreement which is set to mult */ contextAlice->channelContext[1]->hashAlgo = contextAlice->channelContext[0]->hashAlgo; contextAlice->channelContext[1]->hashLength = contextAlice->channelContext[0]->hashLength; contextAlice->channelContext[1]->cipherAlgo = contextAlice->channelContext[0]->cipherAlgo; contextAlice->channelContext[1]->cipherKeyLength = contextAlice->channelContext[0]->cipherKeyLength; contextAlice->channelContext[1]->authTagAlgo = contextAlice->channelContext[0]->authTagAlgo; contextAlice->channelContext[1]->sasAlgo = contextAlice->channelContext[0]->sasAlgo; contextAlice->channelContext[1]->keyAgreementAlgo = ZRTP_KEYAGREEMENT_Mult; contextAlice->channelContext[1]->keyAgreementLength = 0; /* no public values exchanged in Multi channel mode */ updateCryptoFunctionPointers(contextAlice->channelContext[1]); } else { bzrtp_message(""ERROR : Alice found that Bob doesn't support multi channel\n""); } } bob_HelloFromAlice = bzrtp_packetCheck(alice_Hello->packetString, alice_Hello->messageLength+16, contextBob->channelContext[1]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextBob, contextBob->channelContext[1], alice_Hello->packetString, alice_Hello->messageLength+16, bob_HelloFromAlice); bzrtp_message (""Bob parsing returns %x\n"", retval); if (retval==0) { bzrtpHelloMessage_t *bob_HelloFromAlice_message; int i; uint8_t checkPeerSupportMultiChannel = 0; contextBob->channelContext[1]->peerSequenceNumber = bob_HelloFromAlice->sequenceNumber; /* save alice's Hello packet in bob's context */ contextBob->channelContext[1]->peerPackets[HELLO_MESSAGE_STORE_ID] = bob_HelloFromAlice; /* we are already secured (shall check isSecure==1), so we just need to check that peer Hello have the Mult in his key agreement list of supported algo */ bob_HelloFromAlice_message = (bzrtpHelloMessage_t *)bob_HelloFromAlice->messageData; for (i=0; ikc; i++) { if (bob_HelloFromAlice_message->supportedKeyAgreement[i] == ZRTP_KEYAGREEMENT_Mult) { checkPeerSupportMultiChannel = 1; } } /* ok multi channel is supported*/ if (checkPeerSupportMultiChannel == 1) { bzrtp_message(""Bob found that Alice supports multi channel\n""); /* now set the choosen algos, they MUST be the same than main channel (channel 0) except for keyAgreement which is set to mult */ contextBob->channelContext[1]->hashAlgo = contextBob->channelContext[0]->hashAlgo; contextBob->channelContext[1]->hashLength = contextBob->channelContext[0]->hashLength; contextBob->channelContext[1]->cipherAlgo = contextBob->channelContext[0]->cipherAlgo; contextBob->channelContext[1]->cipherKeyLength = contextBob->channelContext[0]->cipherKeyLength; contextBob->channelContext[1]->authTagAlgo = contextBob->channelContext[0]->authTagAlgo; contextBob->channelContext[1]->sasAlgo = contextBob->channelContext[0]->sasAlgo; contextBob->channelContext[1]->keyAgreementAlgo = ZRTP_KEYAGREEMENT_Mult; contextBob->channelContext[1]->keyAgreementLength = 0; /* no public values exchanged in Multi channel mode */ updateCryptoFunctionPointers(contextBob->channelContext[1]); } else { bzrtp_message(""ERROR : Bob found that Alice doesn't support multi channel\n""); } } /* update context with hello message information : H3 and compute initiator and responder's shared secret Hashs */ alice_HelloFromBob_message = (bzrtpHelloMessage_t *)alice_HelloFromBob->messageData; memcpy(contextAlice->channelContext[1]->peerH[3], alice_HelloFromBob_message->H3, 32); bob_HelloFromAlice_message = (bzrtpHelloMessage_t *)bob_HelloFromAlice->messageData; memcpy(contextBob->channelContext[1]->peerH[3], bob_HelloFromAlice_message->H3, 32); /* here we shall exchange Hello ACK but it is just a test and was done already for channel 0, skip it as it is useless for the test */ /* Bob will be the initiator, so compute a commit for him */ bob_Commit = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[1], MSGTYPE_COMMIT, &retval); retval += bzrtp_packetBuild(contextBob, contextBob->channelContext[1], bob_Commit, contextBob->channelContext[1]->selfSequenceNumber); if (retval == 0) { contextBob->channelContext[1]->selfSequenceNumber++; contextBob->channelContext[1]->selfPackets[COMMIT_MESSAGE_STORE_ID] = bob_Commit; } bzrtp_message(""Bob building Commit return %x\n"", retval); /* and send it to Alice */ alice_CommitFromBob = bzrtp_packetCheck(bob_Commit->packetString, bob_Commit->messageLength+16, contextAlice->channelContext[1]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[1], bob_Commit->packetString, bob_Commit->messageLength+16, alice_CommitFromBob); bzrtp_message (""Alice parsing Commit returns %x\n"", retval); if (retval==0) { bzrtpCommitMessage_t *alice_CommitFromBob_message; /* update context with the information found in the packet */ contextAlice->channelContext[1]->peerSequenceNumber = alice_CommitFromBob->sequenceNumber; /* Alice will be the initiator (commit contention not implemented in this test) so just discard bob's commit */ alice_CommitFromBob_message = (bzrtpCommitMessage_t *)alice_CommitFromBob->messageData; memcpy(contextAlice->channelContext[1]->peerH[2], alice_CommitFromBob_message->H2, 32); contextAlice->channelContext[1]->peerPackets[COMMIT_MESSAGE_STORE_ID] = alice_CommitFromBob; } packetDump(alice_CommitFromBob, 0); /* for test purpose define Alice as the responder */ contextAlice->channelContext[1]->role = RESPONDER; /* compute the total hash as in rfc section 4.4.3.2 total_hash = hash(Hello of responder || Commit) */ totalHashDataLength = alice_Hello->messageLength + bob_Commit->messageLength; dataToHash = (uint8_t *)malloc(totalHashDataLength*sizeof(uint8_t)); hashDataIndex = 0; /* get all data from Alice */ memcpy(dataToHash, contextAlice->channelContext[1]->selfPackets[HELLO_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextAlice->channelContext[1]->selfPackets[HELLO_MESSAGE_STORE_ID]->messageLength); hashDataIndex += contextAlice->channelContext[1]->selfPackets[HELLO_MESSAGE_STORE_ID]->messageLength; memcpy(dataToHash+hashDataIndex, contextAlice->channelContext[1]->peerPackets[COMMIT_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextAlice->channelContext[1]->peerPackets[COMMIT_MESSAGE_STORE_ID]->messageLength); contextAlice->channelContext[1]->hashFunction(dataToHash, totalHashDataLength, 32, alice_totalHash); /* get all data from Bob */ hashDataIndex = 0; memcpy(dataToHash, contextBob->channelContext[1]->peerPackets[HELLO_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextBob->channelContext[1]->peerPackets[HELLO_MESSAGE_STORE_ID]->messageLength); hashDataIndex += contextBob->channelContext[1]->peerPackets[HELLO_MESSAGE_STORE_ID]->messageLength; memcpy(dataToHash+hashDataIndex, contextBob->channelContext[1]->selfPackets[COMMIT_MESSAGE_STORE_ID]->packetString+ZRTP_PACKET_HEADER_LENGTH, contextBob->channelContext[1]->selfPackets[COMMIT_MESSAGE_STORE_ID]->messageLength); contextBob->channelContext[1]->hashFunction(dataToHash, totalHashDataLength, 32, bob_totalHash); if (memcmp(bob_totalHash, alice_totalHash, 32) == 0) { bzrtp_message(""Got the same total hash\n""); CU_PASS(""Total Hash match""); } else { bzrtp_message(""AARGG!! total hash mismatch""); CU_FAIL(""Total Hash mismatch""); } free(dataToHash); /* compute the KDF Context as in rfc section 4.4.3.2 KDF_Context = (ZIDi || ZIDr || total_hash) */ contextAlice->channelContext[1]->KDFContextLength = 24 + contextAlice->channelContext[1]->hashLength; contextAlice->channelContext[1]->KDFContext = (uint8_t *)malloc(contextAlice->channelContext[1]->KDFContextLength*sizeof(uint8_t)); memcpy(contextAlice->channelContext[1]->KDFContext, contextAlice->peerZID, 12); memcpy(contextAlice->channelContext[1]->KDFContext+12, contextAlice->selfZID, 12); memcpy(contextAlice->channelContext[1]->KDFContext+24, alice_totalHash, contextAlice->channelContext[1]->hashLength); contextBob->channelContext[1]->KDFContextLength = 24 + contextBob->channelContext[1]->hashLength; contextBob->channelContext[1]->KDFContext = (uint8_t *)malloc(contextBob->channelContext[1]->KDFContextLength*sizeof(uint8_t)); memcpy(contextBob->channelContext[1]->KDFContext, contextBob->selfZID, 12); memcpy(contextBob->channelContext[1]->KDFContext+12, contextBob->peerZID, 12); memcpy(contextBob->channelContext[1]->KDFContext+24, bob_totalHash, contextBob->channelContext[1]->hashLength); if (memcmp(contextBob->channelContext[1]->KDFContext, contextAlice->channelContext[1]->KDFContext, 56) == 0) { bzrtp_message(""Got the same total KDF Context\n""); CU_PASS(""KDFContext match""); } else { bzrtp_message(""AARGG!! KDF Context mismatch""); CU_FAIL(""KDF Context mismatch""); } /* compute s0 as in rfc section 4.4.3.2 s0 = KDF(ZRTPSess, ""ZRTP MSK"", KDF_Context, negotiated hash length) */ contextBob->channelContext[1]->s0 = (uint8_t *)malloc(contextBob->channelContext[1]->hashLength*sizeof(uint8_t)); contextAlice->channelContext[1]->s0 = (uint8_t *)malloc(contextAlice->channelContext[1]->hashLength*sizeof(uint8_t)); retval = bzrtp_keyDerivationFunction(contextBob->ZRTPSess, contextBob->ZRTPSessLength, (uint8_t *)""ZRTP MSK"", 8, contextBob->channelContext[1]->KDFContext, contextBob->channelContext[1]->KDFContextLength, /* this one too depends on selected hash */ contextBob->channelContext[1]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[1]->hmacFunction, contextBob->channelContext[1]->s0); retval = bzrtp_keyDerivationFunction(contextAlice->ZRTPSess, contextAlice->ZRTPSessLength, (uint8_t *)""ZRTP MSK"", 8, contextAlice->channelContext[1]->KDFContext, contextAlice->channelContext[1]->KDFContextLength, /* this one too depends on selected hash */ contextAlice->channelContext[1]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[1]->hmacFunction, contextAlice->channelContext[1]->s0); if (memcmp(contextBob->channelContext[1]->s0, contextAlice->channelContext[1]->s0, contextAlice->channelContext[1]->hashLength) == 0) { bzrtp_message(""Got the same s0\n""); CU_PASS(""s0 match""); } else { bzrtp_message(""AARGG!! s0 mismatch""); CU_FAIL(""s0 mismatch""); } /* the rest of key derivation is common to DH mode, no need to test it as it has been done before for channel 0 */ /* we must anyway derive zrtp and mac key for initiator and responder in order to be able to build the confirm packets */ contextAlice->channelContext[1]->mackeyi = (uint8_t *)malloc(contextAlice->channelContext[1]->hashLength*(sizeof(uint8_t))); contextAlice->channelContext[1]->mackeyr = (uint8_t *)malloc(contextAlice->channelContext[1]->hashLength*(sizeof(uint8_t))); contextAlice->channelContext[1]->zrtpkeyi = (uint8_t *)malloc(contextAlice->channelContext[1]->cipherKeyLength*(sizeof(uint8_t))); contextAlice->channelContext[1]->zrtpkeyr = (uint8_t *)malloc(contextAlice->channelContext[1]->cipherKeyLength*(sizeof(uint8_t))); contextBob->channelContext[1]->mackeyi = (uint8_t *)malloc(contextBob->channelContext[1]->hashLength*(sizeof(uint8_t))); contextBob->channelContext[1]->mackeyr = (uint8_t *)malloc(contextBob->channelContext[1]->hashLength*(sizeof(uint8_t))); contextBob->channelContext[1]->zrtpkeyi = (uint8_t *)malloc(contextBob->channelContext[1]->cipherKeyLength*(sizeof(uint8_t))); contextBob->channelContext[1]->zrtpkeyr = (uint8_t *)malloc(contextBob->channelContext[1]->cipherKeyLength*(sizeof(uint8_t))); /* Alice */ retval = bzrtp_keyDerivationFunction(contextAlice->channelContext[1]->s0, contextAlice->channelContext[1]->hashLength, (uint8_t *)""Initiator HMAC key"", 18, contextAlice->channelContext[1]->KDFContext, contextAlice->channelContext[1]->KDFContextLength, contextAlice->channelContext[1]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[1]->hmacFunction, contextAlice->channelContext[1]->mackeyi); retval += bzrtp_keyDerivationFunction(contextAlice->channelContext[1]->s0, contextAlice->channelContext[1]->hashLength, (uint8_t *)""Responder HMAC key"", 18, contextAlice->channelContext[1]->KDFContext, contextAlice->channelContext[1]->KDFContextLength, contextAlice->channelContext[1]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[1]->hmacFunction, contextAlice->channelContext[1]->mackeyr); retval += bzrtp_keyDerivationFunction(contextAlice->channelContext[1]->s0, contextAlice->channelContext[1]->hashLength, (uint8_t *)""Initiator ZRTP key"", 18, contextAlice->channelContext[1]->KDFContext, contextAlice->channelContext[1]->KDFContextLength, contextAlice->channelContext[1]->cipherKeyLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[1]->hmacFunction, contextAlice->channelContext[1]->zrtpkeyi); retval += bzrtp_keyDerivationFunction(contextAlice->channelContext[1]->s0, contextAlice->channelContext[1]->hashLength, (uint8_t *)""Responder ZRTP key"", 18, contextAlice->channelContext[1]->KDFContext, contextAlice->channelContext[1]->KDFContextLength, contextAlice->channelContext[1]->cipherKeyLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextAlice->channelContext[1]->hmacFunction, contextAlice->channelContext[1]->zrtpkeyr); /* Bob */ retval = bzrtp_keyDerivationFunction(contextBob->channelContext[1]->s0, contextBob->channelContext[1]->hashLength, (uint8_t *)""Initiator HMAC key"", 18, contextBob->channelContext[1]->KDFContext, contextBob->channelContext[1]->KDFContextLength, contextBob->channelContext[1]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[1]->hmacFunction, contextBob->channelContext[1]->mackeyi); retval += bzrtp_keyDerivationFunction(contextBob->channelContext[1]->s0, contextBob->channelContext[1]->hashLength, (uint8_t *)""Responder HMAC key"", 18, contextBob->channelContext[1]->KDFContext, contextBob->channelContext[1]->KDFContextLength, contextBob->channelContext[1]->hashLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[1]->hmacFunction, contextBob->channelContext[1]->mackeyr); retval += bzrtp_keyDerivationFunction(contextBob->channelContext[1]->s0, contextBob->channelContext[1]->hashLength, (uint8_t *)""Initiator ZRTP key"", 18, contextBob->channelContext[1]->KDFContext, contextBob->channelContext[1]->KDFContextLength, contextBob->channelContext[1]->cipherKeyLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[1]->hmacFunction, contextBob->channelContext[1]->zrtpkeyi); retval += bzrtp_keyDerivationFunction(contextBob->channelContext[1]->s0, contextBob->channelContext[1]->hashLength, (uint8_t *)""Responder ZRTP key"", 18, contextBob->channelContext[1]->KDFContext, contextBob->channelContext[1]->KDFContextLength, contextBob->channelContext[1]->cipherKeyLength, (void (*)(uint8_t *, uint8_t, uint8_t *, uint32_t, uint8_t, uint8_t *))contextBob->channelContext[1]->hmacFunction, contextBob->channelContext[1]->zrtpkeyr); /* DEBUG compare keys */ if ((memcmp(contextAlice->channelContext[1]->mackeyi, contextBob->channelContext[1]->mackeyi, contextAlice->channelContext[1]->hashLength)==0) && (memcmp(contextAlice->channelContext[1]->mackeyr, contextBob->channelContext[1]->mackeyr, contextAlice->channelContext[1]->hashLength)==0) && (memcmp(contextAlice->channelContext[1]->zrtpkeyi, contextBob->channelContext[1]->zrtpkeyi, contextAlice->channelContext[1]->cipherKeyLength)==0) && (memcmp(contextAlice->channelContext[1]->zrtpkeyr, contextBob->channelContext[1]->zrtpkeyr, contextAlice->channelContext[1]->cipherKeyLength)==0)) { bzrtp_message(""Got the same keys\n""); CU_PASS(""keys match""); } else { bzrtp_message(""ERROR keys differ\n""); CU_PASS(""Keys mismatch""); } /* now Alice build a confirm1 packet */ alice_Confirm1 = bzrtp_createZrtpPacket(contextAlice, contextAlice->channelContext[1], MSGTYPE_CONFIRM1, &retval); retval += bzrtp_packetBuild(contextAlice, contextAlice->channelContext[1], alice_Confirm1, contextAlice->channelContext[1]->selfSequenceNumber); if (retval == 0) { contextAlice->channelContext[1]->selfSequenceNumber++; } bzrtp_message(""Alice building Confirm1 return %x\n"", retval); bob_Confirm1FromAlice = bzrtp_packetCheck(alice_Confirm1->packetString, alice_Confirm1->messageLength+16, contextBob->channelContext[1]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextBob, contextBob->channelContext[1], alice_Confirm1->packetString, alice_Confirm1->messageLength+16, bob_Confirm1FromAlice); bzrtp_message (""Bob parsing confirm1 returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextBob->channelContext[1]->peerSequenceNumber = bob_Confirm1FromAlice->sequenceNumber; bob_Confirm1FromAlice_message = (bzrtpConfirmMessage_t *)bob_Confirm1FromAlice->messageData; memcpy(contextBob->channelContext[1]->peerH[0], bob_Confirm1FromAlice_message->H0, 32); } packetDump(bob_Confirm1FromAlice,0); bzrtp_freeZrtpPacket(bob_Confirm1FromAlice); bzrtp_freeZrtpPacket(alice_Confirm1); /* now Bob build the CONFIRM2 packet and send it to Alice */ bob_Confirm2 = bzrtp_createZrtpPacket(contextBob, contextBob->channelContext[1], MSGTYPE_CONFIRM2, &retval); retval += bzrtp_packetBuild(contextBob, contextBob->channelContext[1], bob_Confirm2, contextBob->channelContext[1]->selfSequenceNumber); if (retval == 0) { contextBob->channelContext[1]->selfSequenceNumber++; } bzrtp_message(""Bob building Confirm2 return %x\n"", retval); alice_Confirm2FromBob = bzrtp_packetCheck(bob_Confirm2->packetString, bob_Confirm2->messageLength+16, contextAlice->channelContext[1]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextAlice, contextAlice->channelContext[1], bob_Confirm2->packetString, bob_Confirm2->messageLength+16, alice_Confirm2FromBob); bzrtp_message (""Alice parsing confirm2 returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextAlice->channelContext[1]->peerSequenceNumber = alice_Confirm2FromBob->sequenceNumber; alice_Confirm2FromBob_message = (bzrtpConfirmMessage_t *)alice_Confirm2FromBob->messageData; memcpy(contextAlice->channelContext[1]->peerH[0], alice_Confirm2FromBob_message->H0, 32); } packetDump(alice_Confirm2FromBob,0); bzrtp_freeZrtpPacket(alice_Confirm2FromBob); bzrtp_freeZrtpPacket(bob_Confirm2); /* Alice build the conf2Ack and send it to Bob */ alice_Conf2ACK = bzrtp_createZrtpPacket(contextAlice, contextAlice->channelContext[1], MSGTYPE_CONF2ACK, &retval); retval += bzrtp_packetBuild(contextAlice, contextAlice->channelContext[1], alice_Conf2ACK, contextAlice->channelContext[1]->selfSequenceNumber); if (retval == 0) { contextAlice->channelContext[1]->selfSequenceNumber++; } bzrtp_message(""Alice building Conf2ACK return %x\n"", retval); bob_Conf2ACKFromAlice = bzrtp_packetCheck(alice_Conf2ACK->packetString, alice_Conf2ACK->messageLength+16, contextBob->channelContext[1]->peerSequenceNumber, &retval); retval += bzrtp_packetParser(contextBob, contextBob->channelContext[1], alice_Conf2ACK->packetString, alice_Conf2ACK->messageLength+16, bob_Conf2ACKFromAlice); bzrtp_message (""Bob parsing conf2ACK returns %x\n"", retval); if (retval==0) { /* update context with the information found in the packet */ contextBob->channelContext[1]->peerSequenceNumber = bob_Conf2ACKFromAlice->sequenceNumber; } bzrtp_freeZrtpPacket(alice_Conf2ACK); bzrtp_freeZrtpPacket(bob_Conf2ACKFromAlice); /* dumpContext(""\nAlice"", contextAlice); dumpContext(""\nBob"", contextBob); */ bzrtp_message(""Destroy the contexts\n""); /* destroy the context */ bzrtp_destroyBzrtpContext(contextAlice, 0x45678901); bzrtp_destroyBzrtpContext(contextBob, 0x54321098); bzrtp_message(""Destroy the contexts last channel\n""); bzrtp_destroyBzrtpContext(contextBob, 0x87654321); bzrtp_destroyBzrtpContext(contextAlice, 0x12345678); } ",0 "void nft_unregister_chain_type(const struct nf_chain_type *ctype) { nfnl_lock(NFNL_SUBSYS_NFTABLES); chain_type[ctype->family][ctype->type] = NULL; nfnl_unlock(NFNL_SUBSYS_NFTABLES); } ",0 " tt_cmap6_get_info( TT_CMap cmap, TT_CMapInfo *cmap_info ) { FT_Byte* p = cmap->data + 4; cmap_info->format = 6; cmap_info->language = (FT_ULong)TT_PEEK_USHORT( p ); return FT_Err_Ok; } ",0 " void OffscreenCanvasSurfaceImpl::Create( mojo::InterfaceRequest request) { mojo::MakeStrongBinding(base::MakeUnique(), std::move(request)); } ",0 "static unsigned int hweight32(unsigned int *w) { unsigned int res = *w - ((*w >> 1) & 0x55555555); res = (res & 0x33333333) + ((res >> 2) & 0x33333333); res = (res + (res >> 4)) & 0x0F0F0F0F; res = res + (res >> 8); return (res + (res >> 16)) & 0x000000FF; } ",0 "static void h2_show_fd(struct chunk *msg, struct connection *conn) { struct h2c *h2c = conn->mux_ctx; struct h2s *h2s; struct eb32_node *node; int fctl_cnt = 0; int send_cnt = 0; int tree_cnt = 0; int orph_cnt = 0; if (!h2c) return; list_for_each_entry(h2s, &h2c->fctl_list, list) fctl_cnt++; list_for_each_entry(h2s, &h2c->send_list, list) send_cnt++; node = eb32_first(&h2c->streams_by_id); while (node) { h2s = container_of(node, struct h2s, by_id); tree_cnt++; if (!h2s->cs) orph_cnt++; node = eb32_next(node); } chunk_appendf(msg, "" st0=%d flg=0x%08x fctl_cnt=%d send_cnt=%d tree_cnt=%d orph_cnt=%d"", h2c->st0, h2c->flags, fctl_cnt, send_cnt, tree_cnt, orph_cnt); } ",0 "mrb_notimplement(mrb_state *mrb) { const char *str; mrb_int len; mrb_callinfo *ci = mrb->c->ci; if (ci->mid) { str = mrb_sym2name_len(mrb, ci->mid, &len); mrb_raisef(mrb, E_NOTIMP_ERROR, ""%S() function is unimplemented on this machine"", mrb_str_new_static(mrb, str, (size_t)len)); } } ",0 "coolkey_v1_get_object_length(u8 *obj, size_t buf_len) { coolkey_combined_object_header_t *object_head = (coolkey_combined_object_header_t *) obj; int attribute_count; u8 *current_attribute; int j; size_t len; len = sizeof(coolkey_combined_object_header_t); if (buf_len <= len) { return buf_len; } attribute_count = bebytes2ushort(object_head->attribute_count); buf_len -= len; for (current_attribute = obj + len, j = 0; j < attribute_count; j++) { size_t attribute_len = coolkey_v1_get_attribute_record_len(current_attribute, buf_len); len += attribute_len; current_attribute += attribute_len; buf_len -= attribute_len; } return len; } ",0 "vmxnet3_setup_tx_offloads(VMXNET3State *s) { switch (s->offload_mode) { case VMXNET3_OM_NONE: vmxnet_tx_pkt_build_vheader(s->tx_pkt, false, false, 0); break; case VMXNET3_OM_CSUM: vmxnet_tx_pkt_build_vheader(s->tx_pkt, false, true, 0); VMW_PKPRN(""L4 CSO requested\n""); break; case VMXNET3_OM_TSO: vmxnet_tx_pkt_build_vheader(s->tx_pkt, true, true, s->cso_or_gso_size); vmxnet_tx_pkt_update_ip_checksums(s->tx_pkt); VMW_PKPRN(""GSO offload requested.""); break; default: g_assert_not_reached(); return false; } return true; } ",0 "void LayerTreeHostImpl::RegisterScrollbarAnimationController( int scroll_layer_id) { if (settings().scrollbar_animator == LayerTreeSettings::NO_ANIMATOR) return; if (ScrollbarAnimationControllerForId(scroll_layer_id)) return; scrollbar_animation_controllers_[scroll_layer_id] = active_tree_->CreateScrollbarAnimationController(scroll_layer_id); } ",0 "void dump_section(SERVER* serve, gchar* section_header) { printf(""[%s]\n"", section_header); printf(""\texportname = %s\n"", serve->exportname); printf(""\tlistenaddr = %s\n"", serve->listenaddr); printf(""\tport = %d\n"", serve->port); if(serve->flags & F_READONLY) { printf(""\treadonly = true\n""); } if(serve->flags & F_MULTIFILE) { printf(""\tmultifile = true\n""); } if(serve->flags & F_COPYONWRITE) { printf(""\tcopyonwrite = true\n""); } if(serve->expected_size) { printf(""\tfilesize = %lld\n"", (long long int)serve->expected_size); } if(serve->authname) { printf(""\tauthfile = %s\n"", serve->authname); } exit(EXIT_SUCCESS); } ",0 "std::unique_ptr InspectorTimerRemoveEvent::Data( ExecutionContext* context, int timer_id) { std::unique_ptr value = GenericTimerData(context, timer_id); SetCallStack(value.get()); return value; } ",0 "static int __init fail_make_request_debugfs(void) { struct dentry *dir = fault_create_debugfs_attr(""fail_make_request"", NULL, &fail_make_request); return PTR_ERR_OR_ZERO(dir); } ",0 "static void mct_u232_unthrottle(struct tty_struct *tty) { struct usb_serial_port *port = tty->driver_data; struct mct_u232_private *priv = usb_get_serial_port_data(port); unsigned int control_state; spin_lock_irq(&priv->lock); if ((priv->rx_flags & THROTTLED) && C_CRTSCTS(tty)) { priv->rx_flags &= ~THROTTLED; priv->control_state |= TIOCM_RTS; control_state = priv->control_state; spin_unlock_irq(&priv->lock); mct_u232_set_modem_ctrl(port, control_state); } else { spin_unlock_irq(&priv->lock); } } ",0 "static int paging32_init_context(struct kvm_vcpu *vcpu, struct kvm_mmu *context) { context->nx = false; context->root_level = PT32_ROOT_LEVEL; reset_rsvds_bits_mask(vcpu, context); update_permission_bitmask(vcpu, context, false); update_last_pte_bitmap(vcpu, context); context->new_cr3 = paging_new_cr3; context->page_fault = paging32_page_fault; context->gva_to_gpa = paging32_gva_to_gpa; context->free = paging_free; context->sync_page = paging32_sync_page; context->invlpg = paging32_invlpg; context->update_pte = paging32_update_pte; context->shadow_root_level = PT32E_ROOT_LEVEL; context->root_hpa = INVALID_PAGE; context->direct_map = false; return 0; } ",0 "std::wstring UTF8ToUTF16(const std::string& source) { if (source.empty() || static_cast(source.size()) > std::numeric_limits::max()) { return std::wstring(); } int size = ::MultiByteToWideChar(CP_UTF8, 0, &source[0], static_cast(source.size()), nullptr, 0); std::wstring result(size, L'\0'); if (::MultiByteToWideChar(CP_UTF8, 0, &source[0], static_cast(source.size()), &result[0], size) != size) { assert(false); return std::wstring(); } return result; } ",0 "void DataReductionProxyConfig::AddDefaultProxyBypassRules() { DCHECK(configurator_); configurator_->SetBypassRules( "","" ""127.0.0.0/8,"" ""0.0.0.0/8,"" ""10.0.0.0/8,"" ""172.16.0.0/12,"" ""192.168.0.0/16,"" ""::/128,"" ""fc00::/7,"" ""*-ds.metric.gstatic.com,"" ""*-v4.metric.gstatic.com""); } ",0 " int btsock_thread_wakeup(int h) { if(h < 0 || h >= MAX_THREAD) { APPL_TRACE_ERROR(""invalid bt thread handle:%d"", h); return FALSE; } if(ts[h].cmd_fdw == -1) { APPL_TRACE_ERROR(""thread handle:%d, cmd socket is not created"", h); return FALSE; } sock_cmd_t cmd = {CMD_WAKEUP, 0, 0, 0, 0}; return send(ts[h].cmd_fdw, &cmd, sizeof(cmd), 0) == sizeof(cmd); } ",1 "rend_consider_services_intro_points(void) { int i; time_t now; const or_options_t *options = get_options(); /* Are we in single onion mode? */ const int allow_direct = rend_service_allow_non_anonymous_connection( get_options()); /* List of nodes we need to _exclude_ when choosing a new node to * establish an intro point to. */ smartlist_t *exclude_nodes; /* List of nodes we need to retry to build a circuit on them because the * node is valid but circuit died. */ smartlist_t *retry_nodes; if (!have_completed_a_circuit()) return; exclude_nodes = smartlist_new(); retry_nodes = smartlist_new(); now = time(NULL); SMARTLIST_FOREACH_BEGIN(rend_service_list, rend_service_t *, service) { int r; /* Number of intro points we want to open and add to the intro nodes * list of the service. */ unsigned int n_intro_points_to_open; /* Have an unsigned len so we can use it to compare values else gcc is * not happy with unmatching signed comparaison. */ unsigned int intro_nodes_len; /* Different service are allowed to have the same introduction point as * long as they are on different circuit thus why we clear this list. */ smartlist_clear(exclude_nodes); smartlist_clear(retry_nodes); /* Cleanup the invalid intro points and save the node objects, if any, * in the exclude_nodes and retry_nodes lists. */ remove_invalid_intro_points(service, exclude_nodes, retry_nodes, now); /* This retry period is important here so we don't stress circuit * creation. */ if (now > service->intro_period_started + INTRO_CIRC_RETRY_PERIOD) { /* One period has elapsed; we can try building circuits again. */ service->intro_period_started = now; service->n_intro_circuits_launched = 0; } else if (service->n_intro_circuits_launched >= rend_max_intro_circs_per_period( service->n_intro_points_wanted)) { /* We have failed too many times in this period; wait for the next * one before we try to initiate any more connections. */ continue; } /* Let's try to rebuild circuit on the nodes we want to retry on. */ SMARTLIST_FOREACH_BEGIN(retry_nodes, rend_intro_point_t *, intro) { r = rend_service_launch_establish_intro(service, intro); if (r < 0) { log_warn(LD_REND, ""Error launching circuit to node %s for service %s."", safe_str_client(extend_info_describe(intro->extend_info)), safe_str_client(service->service_id)); /* Unable to launch a circuit to that intro point, remove it from * the valid list so we can create a new one. */ smartlist_remove(service->intro_nodes, intro); rend_intro_point_free(intro); continue; } intro->circuit_retries++; } SMARTLIST_FOREACH_END(intro); /* Avoid mismatched signed comparaison below. */ intro_nodes_len = (unsigned int) smartlist_len(service->intro_nodes); /* Quiescent state, we have more or the equal amount of wanted node for * this service. Proceed to the next service. We can have more nodes * because we launch extra preemptive circuits if our intro nodes list was * originally empty for performance reasons. */ if (intro_nodes_len >= service->n_intro_points_wanted) { continue; } /* Number of intro points we want to open which is the wanted amount minus * the current amount of valid nodes. We know that this won't underflow * because of the check above. */ n_intro_points_to_open = service->n_intro_points_wanted - intro_nodes_len; if (intro_nodes_len == 0) { /* We want to end up with n_intro_points_wanted intro points, but if * we have no intro points at all (chances are they all cycled or we * are starting up), we launch NUM_INTRO_POINTS_EXTRA extra circuits * and use the first n_intro_points_wanted that complete. See proposal * #155, section 4 for the rationale of this which is purely for * performance. * * The ones after the first n_intro_points_to_open will be converted * to 'general' internal circuits in rend_service_intro_has_opened(), * and then we'll drop them from the list of intro points. */ n_intro_points_to_open += NUM_INTRO_POINTS_EXTRA; } for (i = 0; i < (int) n_intro_points_to_open; i++) { const node_t *node; rend_intro_point_t *intro; router_crn_flags_t flags = CRN_NEED_UPTIME|CRN_NEED_DESC; if (get_options()->AllowInvalid_ & ALLOW_INVALID_INTRODUCTION) flags |= CRN_ALLOW_INVALID; router_crn_flags_t direct_flags = flags; direct_flags |= CRN_PREF_ADDR; direct_flags |= CRN_DIRECT_CONN; node = router_choose_random_node(exclude_nodes, options->ExcludeNodes, allow_direct ? direct_flags : flags); /* If we are in single onion mode, retry node selection for a 3-hop * path */ if (allow_direct && !node) { log_info(LD_REND, ""Unable to find an intro point that we can connect to "" ""directly for %s, falling back to a 3-hop path."", safe_str_client(service->service_id)); node = router_choose_random_node(exclude_nodes, options->ExcludeNodes, flags); } if (!node) { log_warn(LD_REND, ""We only have %d introduction points established for %s; "" ""wanted %u."", smartlist_len(service->intro_nodes), safe_str_client(service->service_id), n_intro_points_to_open); break; } /* Add the choosen node to the exclusion list in order to avoid picking * it again in the next iteration. */ smartlist_add(exclude_nodes, (void*)node); intro = tor_malloc_zero(sizeof(rend_intro_point_t)); /* extend_info is for clients, so we want the multi-hop primary ORPort, * even if we are a single onion service and intend to connect to it * directly ourselves. */ intro->extend_info = extend_info_from_node(node, 0); if (BUG(intro->extend_info == NULL)) { break; } intro->intro_key = crypto_pk_new(); const int fail = crypto_pk_generate_key(intro->intro_key); tor_assert(!fail); intro->time_published = -1; intro->time_to_expire = -1; intro->max_introductions = crypto_rand_int_range(INTRO_POINT_MIN_LIFETIME_INTRODUCTIONS, INTRO_POINT_MAX_LIFETIME_INTRODUCTIONS); smartlist_add(service->intro_nodes, intro); log_info(LD_REND, ""Picked router %s as an intro point for %s."", safe_str_client(node_describe(node)), safe_str_client(service->service_id)); /* Establish new introduction circuit to our chosen intro point. */ r = rend_service_launch_establish_intro(service, intro); if (r < 0) { log_warn(LD_REND, ""Error launching circuit to node %s for service %s."", safe_str_client(extend_info_describe(intro->extend_info)), safe_str_client(service->service_id)); /* This funcion will be called again by the main loop so this intro * point without a intro circuit will be retried on or removed after * a maximum number of attempts. */ } } } SMARTLIST_FOREACH_END(service); smartlist_free(exclude_nodes); smartlist_free(retry_nodes); } ",0 "int ContextualSearchFieldTrial::GetSurroundingSize() { return GetIntParamValueOrDefault(kContextualSearchSurroundingSizeParamName, kContextualSearchDefaultContentSize, &is_surrounding_size_cached_, &surrounding_size_); } ",0 "static void * dev_seq_start(struct seq_file *s, loff_t *pos) { struct sg_proc_deviter * it = kmalloc(sizeof(*it), GFP_KERNEL); s->private = it; if (! it) return NULL; it->index = *pos; it->max = sg_last_dev(); if (it->index >= it->max) return NULL; return it; } ",0 "void InputMethodTSF::OnBlur() { tsf_event_router_->SetManager(NULL); } ",0 "unix_sck_send_ping(hsm_com_client_hdl_t *hdl, int timeout) { hsm_com_ping_data_t msg; memset(&msg,0,sizeof(msg)); msg.header.cmd = HSM_COM_CMD_PING; msg.header.ver = HSM_COM_VER; msg.header.trans_id = hdl->trans_id++; msg.header.payload_len = 0; if(unix_sck_send_msg(hdl, (char*)&msg, sizeof(msg), (char*)&msg, sizeof(msg), timeout) != sizeof(msg)) { close(hdl->client_fd); hdl->client_state = HSM_COM_C_STATE_IN; return HSM_COM_BAD; } if(msg.header.resp_code == HSM_COM_RESP_OK){ return HSM_COM_OK; } return HSM_COM_BAD; } ",0 "server_process_dh(krb5_context context, pkinit_plg_crypto_context plg_cryptoctx, pkinit_req_crypto_context cryptoctx, pkinit_identity_crypto_context id_cryptoctx, unsigned char *data, unsigned int data_len, unsigned char **dh_pubkey, unsigned int *dh_pubkey_len, unsigned char **server_key, unsigned int *server_key_len) { krb5_error_code retval = ENOMEM; DH *dh = NULL, *dh_server = NULL; unsigned char *p = NULL; ASN1_INTEGER *pub_key = NULL; BIGNUM *client_pubkey = NULL; const BIGNUM *server_pubkey; *dh_pubkey = *server_key = NULL; *dh_pubkey_len = *server_key_len = 0; /* get client's received DH parameters that we saved in server_check_dh */ dh = cryptoctx->dh; dh_server = dup_dh_params(dh); if (dh_server == NULL) goto cleanup; /* decode client's public key */ p = data; pub_key = d2i_ASN1_INTEGER(NULL, (const unsigned char **)&p, (int)data_len); if (pub_key == NULL) goto cleanup; client_pubkey = ASN1_INTEGER_to_BN(pub_key, NULL); if (client_pubkey == NULL) goto cleanup; ASN1_INTEGER_free(pub_key); if (!DH_generate_key(dh_server)) goto cleanup; DH_get0_key(dh_server, &server_pubkey, NULL); /* generate DH session key */ *server_key_len = DH_size(dh_server); if ((*server_key = malloc(*server_key_len)) == NULL) goto cleanup; compute_dh(*server_key, *server_key_len, client_pubkey, dh_server); #ifdef DEBUG_DH print_dh(dh_server, ""client&server's DH params\n""); print_pubkey(client_pubkey, ""client's pub_key=""); print_pubkey(server_pubkey, ""server's pub_key=""); pkiDebug(""server computed key=""); print_buffer(*server_key, *server_key_len); #endif /* KDC reply */ /* pack DH public key */ /* Diffie-Hellman public key must be ASN1 encoded as an INTEGER; this * encoding shall be used as the contents (the value) of the * subjectPublicKey component (a BIT STRING) of the SubjectPublicKeyInfo * data element */ pub_key = BN_to_ASN1_INTEGER(server_pubkey, NULL); if (pub_key == NULL) goto cleanup; *dh_pubkey_len = i2d_ASN1_INTEGER(pub_key, NULL); if ((p = *dh_pubkey = malloc(*dh_pubkey_len)) == NULL) goto cleanup; i2d_ASN1_INTEGER(pub_key, &p); if (pub_key != NULL) ASN1_INTEGER_free(pub_key); retval = 0; if (dh_server != NULL) DH_free(dh_server); return retval; cleanup: BN_free(client_pubkey); DH_free(dh_server); free(*dh_pubkey); free(*server_key); return retval; } ",0 "FLAC_API FLAC__StreamDecoderInitStatus FLAC__stream_decoder_init_stream( FLAC__StreamDecoder *decoder, FLAC__StreamDecoderReadCallback read_callback, FLAC__StreamDecoderSeekCallback seek_callback, FLAC__StreamDecoderTellCallback tell_callback, FLAC__StreamDecoderLengthCallback length_callback, FLAC__StreamDecoderEofCallback eof_callback, FLAC__StreamDecoderWriteCallback write_callback, FLAC__StreamDecoderMetadataCallback metadata_callback, FLAC__StreamDecoderErrorCallback error_callback, void *client_data ) { return init_stream_internal_( decoder, read_callback, seek_callback, tell_callback, length_callback, eof_callback, write_callback, metadata_callback, error_callback, client_data, /*is_ogg=*/false ); } ",0 "void comps_rtree_set_n(COMPS_RTree * rt, char * key, size_t keylen, void * data) { __comps_rtree_set(rt, key, keylen, data); } ",0 "GLvoid StubGLUniform3fv(GLint location, GLsizei count, const GLfloat* v) { glUniform3fv(location, count, v); } ",0 "static inline size_t vmxnet3_ring_curr_cell_idx(Vmxnet3Ring *ring) { return ring->next; } ",0 "bool RenderLayerCompositor::requiresCompositingForCanvas(RenderObject* renderer) const { if (!(m_compositingTriggers & ChromeClient::CanvasTrigger)) return false; if (renderer->isCanvas()) { HTMLCanvasElement* canvas = toHTMLCanvasElement(renderer->node()); return canvas->renderingContext() && canvas->renderingContext()->isAccelerated(); } return false; } ",0 "xdr_gprincs_ret(XDR *xdrs, gprincs_ret *objp) { if (!xdr_ui_4(xdrs, &objp->api_version)) { return (FALSE); } if (!xdr_kadm5_ret_t(xdrs, &objp->code)) { return (FALSE); } if (objp->code == KADM5_OK) { if (!xdr_int(xdrs, &objp->count)) { return (FALSE); } if (!xdr_array(xdrs, (caddr_t *) &objp->princs, (unsigned int *) &objp->count, ~0, sizeof(char *), xdr_nullstring)) { return (FALSE); } } return (TRUE); } ",0 "xdr_krb5_principal(XDR *xdrs, krb5_principal *objp) { int ret; char *p = NULL; krb5_principal pr = NULL; static krb5_context context = NULL; /* using a static context here is ugly, but should work ok, and the other solutions are even uglier */ if (!context && kadm5_init_krb5_context(&context)) return(FALSE); switch(xdrs->x_op) { case XDR_ENCODE: if (*objp) { if((ret = krb5_unparse_name(context, *objp, &p)) != 0) return FALSE; } if(!xdr_nullstring(xdrs, &p)) return FALSE; if (p) free(p); break; case XDR_DECODE: if(!xdr_nullstring(xdrs, &p)) return FALSE; if (p) { ret = krb5_parse_name(context, p, &pr); if(ret != 0) return FALSE; *objp = pr; free(p); } else *objp = NULL; break; case XDR_FREE: if(*objp != NULL) krb5_free_principal(context, *objp); break; } return TRUE; } ",1 "void V8TestObject::LimitedToOnlyOneAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_limitedToOnlyOneAttribute_Getter""); test_object_v8_internal::LimitedToOnlyOneAttributeAttributeGetter(info); } ",0 "xmlBufAdd(xmlBufPtr buf, const xmlChar *str, int len) { unsigned int needSize; if ((str == NULL) || (buf == NULL) || (buf->error)) return -1; CHECK_COMPAT(buf) if (buf->alloc == XML_BUFFER_ALLOC_IMMUTABLE) return -1; if (len < -1) { #ifdef DEBUG_BUFFER xmlGenericError(xmlGenericErrorContext, ""xmlBufAdd: len < 0\n""); #endif return -1; } if (len == 0) return 0; if (len < 0) len = xmlStrlen(str); if (len < 0) return -1; if (len == 0) return 0; needSize = buf->use + len + 2; if (needSize > buf->size){ if (buf->alloc == XML_BUFFER_ALLOC_BOUNDED) { /* * Used to provide parsing limits */ if (needSize >= XML_MAX_TEXT_LENGTH) { xmlBufMemoryError(buf, ""buffer error: text too long\n""); return(-1); } } if (!xmlBufResize(buf, needSize)){ xmlBufMemoryError(buf, ""growing buffer""); return XML_ERR_NO_MEMORY; } } memmove(&buf->content[buf->use], str, len*sizeof(xmlChar)); buf->use += len; buf->content[buf->use] = 0; UPDATE_COMPAT(buf) return 0; } ",0 "static int pgx_getsgnd(jas_stream_t *in, bool *sgnd) { int c; do { if ((c = pgx_getc(in)) == EOF) { return -1; } } while (isspace(c)); #if 0 if (c == '+') { *sgnd = false; } else if (c == '-') { *sgnd = true; } else { *sgnd = false; if (jas_stream_ungetc(in, c)) { goto error; } return 0; } while ((c = pgx_getc(in)) != EOF && !isspace(c)) { ; } if (c == EOF) { goto error; } #else if (c == '+' || c == '-') { *sgnd = (c == '-'); while ((c = pgx_getc(in)) != EOF && !isspace(c)) { ; } if (c == EOF) { goto error; } } else { *sgnd = false; if (jas_stream_ungetc(in, c)) { goto error; } } #endif return 0; error: return -1; } ",0 "void Move() { Object* obj = Object::Create(); Container container1; container1.insert(obj); { ExpectWriteBarrierFires scope(ThreadState::Current(), {obj}); Container container2(std::move(container1)); } } ",0 "void LayoutBlockFlow::setDidBreakAtLineToAvoidWidow() { ASSERT(!shouldBreakAtLineToAvoidWidow()); ASSERT(m_rareData); m_rareData->m_didBreakAtLineToAvoidWidow = true; } ",0 "void RenderViewImpl::ConvertViewportToWindowViaWidget(blink::WebRect* rect) { ConvertViewportToWindow(rect); } ",0 "static void bmpmask16toimage(const OPJ_UINT8* pData, OPJ_UINT32 stride, opj_image_t* image, OPJ_UINT32 redMask, OPJ_UINT32 greenMask, OPJ_UINT32 blueMask, OPJ_UINT32 alphaMask) { int index; OPJ_UINT32 width, height; OPJ_UINT32 x, y; const OPJ_UINT8 *pSrc = NULL; OPJ_BOOL hasAlpha; OPJ_UINT32 redShift, redPrec; OPJ_UINT32 greenShift, greenPrec; OPJ_UINT32 blueShift, bluePrec; OPJ_UINT32 alphaShift, alphaPrec; width = image->comps[0].w; height = image->comps[0].h; hasAlpha = image->numcomps > 3U; bmp_mask_get_shift_and_prec(redMask, &redShift, &redPrec); bmp_mask_get_shift_and_prec(greenMask, &greenShift, &greenPrec); bmp_mask_get_shift_and_prec(blueMask, &blueShift, &bluePrec); bmp_mask_get_shift_and_prec(alphaMask, &alphaShift, &alphaPrec); image->comps[0].bpp = redPrec; image->comps[0].prec = redPrec; image->comps[1].bpp = greenPrec; image->comps[1].prec = greenPrec; image->comps[2].bpp = bluePrec; image->comps[2].prec = bluePrec; if (hasAlpha) { image->comps[3].bpp = alphaPrec; image->comps[3].prec = alphaPrec; } index = 0; pSrc = pData + (height - 1U) * stride; for(y = 0; y < height; y++) { for(x = 0; x < width; x++) { OPJ_UINT32 value = 0U; value |= ((OPJ_UINT32)pSrc[2*x+0]) << 0; value |= ((OPJ_UINT32)pSrc[2*x+1]) << 8; image->comps[0].data[index] = (OPJ_INT32)((value & redMask) >> redShift); /* R */ image->comps[1].data[index] = (OPJ_INT32)((value & greenMask) >> greenShift); /* G */ image->comps[2].data[index] = (OPJ_INT32)((value & blueMask) >> blueShift); /* B */ if (hasAlpha) { image->comps[3].data[index] = (OPJ_INT32)((value & alphaMask) >> alphaShift); /* A */ } index++; } pSrc -= stride; } } ",0 "v8::Local ScriptController::callFunctionWithInstrumentation(ScriptExecutionContext* context, v8::Handle function, v8::Handle receiver, int argc, v8::Handle args[]) { InspectorInstrumentationCookie cookie; if (InspectorInstrumentation::timelineAgentEnabled(context)) { String resourceName; int lineNumber; resourceInfo(function, resourceName, lineNumber); cookie = InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber); } v8::Local result = V8ScriptRunner::callFunction(function, context, receiver, argc, args); InspectorInstrumentation::didCallFunction(cookie); return result; } ",0 "void PaymentRequest::AreRequestedMethodsSupportedCallback( bool methods_supported) { if (methods_supported) { if (SatisfiesSkipUIConstraints()) { skipped_payment_request_ui_ = true; Pay(); } } else { journey_logger_.SetNotShown( JourneyLogger::NOT_SHOWN_REASON_NO_SUPPORTED_PAYMENT_METHOD); client_->OnError(mojom::PaymentErrorReason::NOT_SUPPORTED); if (observer_for_testing_) observer_for_testing_->OnNotSupportedError(); OnConnectionTerminated(); } } ",1 "static struct rq *find_busiest_queue(struct lb_env *env, struct sched_group *group) { struct rq *busiest = NULL, *rq; unsigned long busiest_load = 0, busiest_capacity = 1; int i; for_each_cpu_and(i, sched_group_span(group), env->cpus) { unsigned long capacity, wl; enum fbq_type rt; rq = cpu_rq(i); rt = fbq_classify_rq(rq); /* * We classify groups/runqueues into three groups: * - regular: there are !numa tasks * - remote: there are numa tasks that run on the 'wrong' node * - all: there is no distinction * * In order to avoid migrating ideally placed numa tasks, * ignore those when there's better options. * * If we ignore the actual busiest queue to migrate another * task, the next balance pass can still reduce the busiest * queue by moving tasks around inside the node. * * If we cannot move enough load due to this classification * the next pass will adjust the group classification and * allow migration of more tasks. * * Both cases only affect the total convergence complexity. */ if (rt > env->fbq_type) continue; /* * For ASYM_CPUCAPACITY domains with misfit tasks we simply * seek the ""biggest"" misfit task. */ if (env->src_grp_type == group_misfit_task) { if (rq->misfit_task_load > busiest_load) { busiest_load = rq->misfit_task_load; busiest = rq; } continue; } capacity = capacity_of(i); /* * For ASYM_CPUCAPACITY domains, don't pick a CPU that could * eventually lead to active_balancing high->low capacity. * Higher per-CPU capacity is considered better than balancing * average load. */ if (env->sd->flags & SD_ASYM_CPUCAPACITY && capacity_of(env->dst_cpu) < capacity && rq->nr_running == 1) continue; wl = weighted_cpuload(rq); /* * When comparing with imbalance, use weighted_cpuload() * which is not scaled with the CPU capacity. */ if (rq->nr_running == 1 && wl > env->imbalance && !check_cpu_capacity(rq, env->sd)) continue; /* * For the load comparisons with the other CPU's, consider * the weighted_cpuload() scaled with the CPU capacity, so * that the load can be moved away from the CPU that is * potentially running at a lower capacity. * * Thus we're looking for max(wl_i / capacity_i), crosswise * multiplication to rid ourselves of the division works out * to: wl_i * capacity_j > wl_j * capacity_i; where j is * our previous maximum. */ if (wl * busiest_capacity > busiest_load * capacity) { busiest_load = wl; busiest_capacity = capacity; busiest = rq; } } return busiest; } ",0 "static void print_serial(sc_card_t *in_card) { int r; sc_serial_number_t serial; r = sc_lock(card); if (r == SC_SUCCESS) r = sc_card_ctl(in_card, SC_CARDCTL_GET_SERIALNR, &serial); sc_unlock(card); if (r) fprintf(stderr, ""sc_card_ctl(*, SC_CARDCTL_GET_SERIALNR, *) failed\n""); else util_hex_dump_asc(stdout, serial.value, serial.len, -1); } ",0 "void AppCacheUpdateJob::DeleteSoon() { ClearPendingMasterEntries(); manifest_response_writer_.reset(); storage_->CancelDelegateCallbacks(this); service_->RemoveObserver(this); service_ = nullptr; if (group_) { group_->SetUpdateAppCacheStatus(AppCacheGroup::IDLE); group_ = nullptr; } base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this); } ",0 "CreatePixels( char **dataptr, unsigned int data_size, unsigned int width, unsigned int height, unsigned int cpp, unsigned int *pixels, XpmColor *colors) { char *s; unsigned int x, y, h, offset; if(height <= 1) return; h = height - 1; offset = width * cpp + 1; if(offset <= width || offset <= cpp) return; /* why trust h? */ for (y = 0; y < h; y++, dataptr++) { s = *dataptr; /* why trust width? */ for (x = 0; x < width; x++, pixels++) { if(cpp > (data_size - (s - *dataptr))) return; strncpy(s, colors[*pixels].string, cpp); /* why trust pixel? */ s += cpp; } *s = '\0'; if(offset > data_size) return; *(dataptr + 1) = *dataptr + offset; } /* duplicate some code to avoid a test in the loop */ s = *dataptr; /* why trust width? */ for (x = 0; x < width; x++, pixels++) { if(cpp > data_size - (s - *dataptr)) return; strncpy(s, colors[*pixels].string, cpp); /* why should we trust *pixel? */ s += cpp; } *s = '\0'; } ",0 "static void WillDispatchTabUpdatedEvent(WebContents* contents, Profile* profile, const Extension* extension, ListValue* event_args) { DictionaryValue* tab_value = ExtensionTabUtil::CreateTabValue( contents, extension); } ",1 "void SyncManager::SyncInternal::UpdateCredentials( const SyncCredentials& credentials) { DCHECK(thread_checker_.CalledOnValidThread()); DCHECK_EQ(credentials.email, share_.name); DCHECK(!credentials.email.empty()); DCHECK(!credentials.sync_token.empty()); observing_ip_address_changes_ = true; if (connection_manager()->set_auth_token(credentials.sync_token)) { sync_notifier_->UpdateCredentials( credentials.email, credentials.sync_token); if (!setup_for_test_mode_ && initialized_) { if (scheduler()) scheduler()->OnCredentialsUpdated(); } } } ",0 " cff_index_get_name( CFF_Index idx, FT_UInt element ) { FT_Memory memory = idx->stream->memory; FT_Byte* bytes; FT_ULong byte_len; FT_Error error; FT_String* name = 0; error = cff_index_access_element( idx, element, &bytes, &byte_len ); if ( error ) goto Exit; if ( !FT_ALLOC( name, byte_len + 1 ) ) { FT_MEM_COPY( name, bytes, byte_len ); name[byte_len] = 0; } cff_index_forget_element( idx, &bytes ); Exit: return name; } ",0 "int swap_type_of(dev_t device, sector_t offset, struct block_device **bdev_p) { struct block_device *bdev = NULL; int type; if (device) bdev = bdget(device); spin_lock(&swap_lock); for (type = 0; type < nr_swapfiles; type++) { struct swap_info_struct *sis = swap_info[type]; if (!(sis->flags & SWP_WRITEOK)) continue; if (!bdev) { if (bdev_p) *bdev_p = bdgrab(sis->bdev); spin_unlock(&swap_lock); return type; } if (bdev == sis->bdev) { struct swap_extent *se = &sis->first_swap_extent; if (se->start_block == offset) { if (bdev_p) *bdev_p = bdgrab(sis->bdev); spin_unlock(&swap_lock); bdput(bdev); return type; } } } spin_unlock(&swap_lock); if (bdev) bdput(bdev); return -ENODEV; } ",0 "static int bgp_attr_atomic(struct bgp_attr_parser_args *args) { struct attr *const attr = args->attr; const bgp_size_t length = args->length; /* Length check. */ if (length != 0) { flog_err(EC_BGP_ATTR_LEN, ""ATOMIC_AGGREGATE attribute length isn't 0 [%u]"", length); return bgp_attr_malformed(args, BGP_NOTIFY_UPDATE_ATTR_LENG_ERR, args->total); } /* Set atomic aggregate flag. */ attr->flag |= ATTR_FLAG_BIT(BGP_ATTR_ATOMIC_AGGREGATE); return BGP_ATTR_PARSE_PROCEED; } ",0 "QByteArray CtcpHandler::xdelimDequote(const QByteArray &message) { QByteArray dequotedMessage; QByteArray messagepart; QHash::iterator xdelimquote; for(int i = 0; i < message.size(); i++) { messagepart = message.mid(i,1); if(i+1 < message.size()) { for(xdelimquote = ctcpXDelimDequoteHash.begin(); xdelimquote != ctcpXDelimDequoteHash.end(); ++xdelimquote) { if(message.mid(i,2) == xdelimquote.key()) { messagepart = xdelimquote.value(); i++; break; } } } dequotedMessage += messagepart; } return dequotedMessage; } ",0 "void MemoryInstrumentation::RequestGlobalDump( RequestGlobalDumpCallback callback) { RequestGlobalDump({}, callback); } ",0 "void StatusBubbleGtk::InitWidgets() { bool ltr = !base::i18n::IsRTL(); label_ = gtk_label_new(NULL); padding_ = gtk_alignment_new(0, 0, 1, 1); gtk_alignment_set_padding(GTK_ALIGNMENT(padding_), kInternalTopBottomPadding, kInternalTopBottomPadding, kInternalLeftRightPadding + (ltr ? 0 : kCornerSize), kInternalLeftRightPadding + (ltr ? kCornerSize : 0)); gtk_container_add(GTK_CONTAINER(padding_), label_); container_.Own(gtk_event_box_new()); gtk_widget_set_no_show_all(container_.get(), TRUE); gtk_util::ActAsRoundedWindow( container_.get(), gtk_util::kGdkWhite, kCornerSize, gtk_util::ROUNDED_TOP_RIGHT, gtk_util::BORDER_TOP | gtk_util::BORDER_RIGHT); gtk_widget_set_name(container_.get(), ""status-bubble""); gtk_container_add(GTK_CONTAINER(container_.get()), padding_); gtk_widget_add_events(container_.get(), GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK); g_signal_connect(container_.get(), ""motion-notify-event"", G_CALLBACK(HandleMotionNotifyThunk), this); g_signal_connect(container_.get(), ""enter-notify-event"", G_CALLBACK(HandleEnterNotifyThunk), this); UserChangedTheme(); } ",1 "static int mxf_decrypt_triplet(AVFormatContext *s, AVPacket *pkt, KLVPacket *klv) { static const uint8_t checkv[16] = {0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b, 0x43, 0x48, 0x55, 0x4b}; MXFContext *mxf = s->priv_data; AVIOContext *pb = s->pb; int64_t end = avio_tell(pb) + klv->length; int64_t size; uint64_t orig_size; uint64_t plaintext_size; uint8_t ivec[16]; uint8_t tmpbuf[16]; int index; if (!mxf->aesc && s->key && s->keylen == 16) { mxf->aesc = av_aes_alloc(); if (!mxf->aesc) return AVERROR(ENOMEM); av_aes_init(mxf->aesc, s->key, 128, 1); } avio_skip(pb, klv_decode_ber_length(pb)); klv_decode_ber_length(pb); plaintext_size = avio_rb64(pb); klv_decode_ber_length(pb); avio_read(pb, klv->key, 16); if (!IS_KLV_KEY(klv, mxf_essence_element_key)) return AVERROR_INVALIDDATA; index = mxf_get_stream_index(s, klv); if (index < 0) return AVERROR_INVALIDDATA; klv_decode_ber_length(pb); orig_size = avio_rb64(pb); if (orig_size < plaintext_size) return AVERROR_INVALIDDATA; size = klv_decode_ber_length(pb); if (size < 32 || size - 32 < orig_size) return AVERROR_INVALIDDATA; avio_read(pb, ivec, 16); avio_read(pb, tmpbuf, 16); if (mxf->aesc) av_aes_crypt(mxf->aesc, tmpbuf, tmpbuf, 1, ivec, 1); if (memcmp(tmpbuf, checkv, 16)) av_log(s, AV_LOG_ERROR, ""probably incorrect decryption key\n""); size -= 32; size = av_get_packet(pb, pkt, size); if (size < 0) return size; else if (size < plaintext_size) return AVERROR_INVALIDDATA; size -= plaintext_size; if (mxf->aesc) av_aes_crypt(mxf->aesc, &pkt->data[plaintext_size], &pkt->data[plaintext_size], size >> 4, ivec, 1); av_shrink_packet(pkt, orig_size); pkt->stream_index = index; avio_skip(pb, end - avio_tell(pb)); return 0; } ",0 "int dm_get_geometry(struct mapped_device *md, struct hd_geometry *geo) { *geo = md->geometry; return 0; } ",0 "int dtls1_send_finished(SSL *s, int a, int b, const char *sender, int slen) { unsigned char *p,*d; int i; unsigned long l; if (s->state == a) { d=(unsigned char *)s->init_buf->data; p= &(d[DTLS1_HM_HEADER_LENGTH]); i=s->method->ssl3_enc->final_finish_mac(s, sender,slen,s->s3->tmp.finish_md); s->s3->tmp.finish_md_len = i; memcpy(p, s->s3->tmp.finish_md, i); p+=i; l=i; /* Copy the finished so we can use it for * renegotiation checks */ if(s->type == SSL_ST_CONNECT) { OPENSSL_assert(i <= EVP_MAX_MD_SIZE); memcpy(s->s3->previous_client_finished, s->s3->tmp.finish_md, i); s->s3->previous_client_finished_len=i; } else { OPENSSL_assert(i <= EVP_MAX_MD_SIZE); memcpy(s->s3->previous_server_finished, s->s3->tmp.finish_md, i); s->s3->previous_server_finished_len=i; } #ifdef OPENSSL_SYS_WIN16 /* MSVC 1.5 does not clear the top bytes of the word unless * I do this. */ l&=0xffff; #endif d = dtls1_set_message_header(s, d, SSL3_MT_FINISHED, l, 0, l); s->init_num=(int)l+DTLS1_HM_HEADER_LENGTH; s->init_off=0; /* buffer the message to handle re-xmits */ dtls1_buffer_message(s, 0); s->state=b; } /* SSL3_ST_SEND_xxxxxx_HELLO_B */ return(dtls1_do_write(s,SSL3_RT_HANDSHAKE)); } ",0 "void AppListSyncableService::ProcessNewSyncItem(SyncItem* sync_item) { VLOG(2) << ""ProcessNewSyncItem: "" << sync_item->ToString(); switch (sync_item->item_type) { case sync_pb::AppListSpecifics::TYPE_APP: { return; } case sync_pb::AppListSpecifics::TYPE_REMOVE_DEFAULT_APP: { VLOG(1) << this << "": Uninstall: "" << sync_item->ToString(); if (IsDriveAppSyncId(sync_item->item_id)) { if (drive_app_provider_) { drive_app_provider_->AddUninstalledDriveAppFromSync( GetDriveAppIdFromSyncId(sync_item->item_id)); } } else { UninstallExtension(extension_system_->extension_service(), sync_item->item_id); } return; } case sync_pb::AppListSpecifics::TYPE_FOLDER: { AppListItem* app_item = model_->FindItem(sync_item->item_id); if (!app_item) return; // Don't create new folders here, the model will do that. UpdateAppItemFromSyncItem(sync_item, app_item); return; } case sync_pb::AppListSpecifics::TYPE_URL: { LOG(WARNING) << ""TYPE_URL not supported""; return; } } NOTREACHED() << ""Unrecognized sync item type: "" << sync_item->ToString(); } ",0 "void OneClickSigninHelper::NavigateToPendingEntry( const GURL& url, content::NavigationController::ReloadType reload_type) { VLOG(1) << ""OneClickSigninHelper::NavigateToPendingEntry: url="" << url.spec(); const GURL continue_url = SyncPromoUI::GetNextPageURLForSyncPromoURL( SyncPromoUI::GetSyncPromoURL(SyncPromoUI::SOURCE_START_PAGE, false)); GURL::Replacements replacements; replacements.ClearQuery(); if (!IsValidGaiaSigninRedirectOrResponseURL(url) && continue_url_.is_valid() && url.ReplaceComponents(replacements) != continue_url_.ReplaceComponents(replacements)) { if (++untrusted_navigations_since_signin_visit_ > kMaxNavigationsSince) CleanTransientState(); } } ",0 "smp_fetch_url_port(const struct arg *args, struct sample *smp, const char *kw, void *private) { struct http_txn *txn; struct sockaddr_storage addr; CHECK_HTTP_MESSAGE_FIRST(); txn = smp->strm->txn; url2sa(txn->req.chn->buf->p + txn->req.sl.rq.u, txn->req.sl.rq.u_l, &addr, NULL); if (((struct sockaddr_in *)&addr)->sin_family != AF_INET) return 0; smp->data.type = SMP_T_SINT; smp->data.u.sint = ntohs(((struct sockaddr_in *)&addr)->sin_port); smp->flags = 0; return 1; } ",0 "int ocfs2_change_file_space(struct file *file, unsigned int cmd, struct ocfs2_space_resv *sr) { struct inode *inode = file_inode(file); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); int ret; if ((cmd == OCFS2_IOC_RESVSP || cmd == OCFS2_IOC_RESVSP64) && !ocfs2_writes_unwritten_extents(osb)) return -ENOTTY; else if ((cmd == OCFS2_IOC_UNRESVSP || cmd == OCFS2_IOC_UNRESVSP64) && !ocfs2_sparse_alloc(osb)) return -ENOTTY; if (!S_ISREG(inode->i_mode)) return -EINVAL; if (!(file->f_mode & FMODE_WRITE)) return -EBADF; ret = mnt_want_write_file(file); if (ret) return ret; ret = __ocfs2_change_file_space(file, inode, file->f_pos, cmd, sr, 0); mnt_drop_write_file(file); return ret; } ",0 "static int unimac_mdio_write(struct mii_bus *bus, int phy_id, int reg, u16 val) { struct unimac_mdio_priv *priv = bus->priv; u32 cmd; /* Prepare the write operation */ cmd = MDIO_WR | (phy_id << MDIO_PMD_SHIFT) | (reg << MDIO_REG_SHIFT) | (0xffff & val); unimac_mdio_writel(priv, cmd, MDIO_CMD); unimac_mdio_start(priv); return priv->wait_func(priv->wait_func_data); } ",0 "static void reflectUrlStringAttributeAttributeSetterCallback(const v8::FunctionCallbackInfo& info) { v8::Local v8Value = info[0]; V0CustomElementProcessingStack::CallbackDeliveryScope deliveryScope; TestInterfaceNodeV8Internal::reflectUrlStringAttributeAttributeSetter(v8Value, info); } ",0 "ofputil_decode_bundle_ctrl(const struct ofp_header *oh, struct ofputil_bundle_ctrl_msg *msg) { struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length)); enum ofpraw raw = ofpraw_pull_assert(&b); ovs_assert(raw == OFPRAW_OFPT14_BUNDLE_CONTROL || raw == OFPRAW_ONFT13_BUNDLE_CONTROL); const struct ofp14_bundle_ctrl_msg *m = b.msg; msg->bundle_id = ntohl(m->bundle_id); msg->type = ntohs(m->type); msg->flags = ntohs(m->flags); return 0; } ",0 "static void rt_del(unsigned hash, struct rtable *rt) { struct rtable __rcu **rthp; struct rtable *aux; rthp = &rt_hash_table[hash].chain; spin_lock_bh(rt_hash_lock_addr(hash)); ip_rt_put(rt); while ((aux = rcu_dereference_protected(*rthp, lockdep_is_held(rt_hash_lock_addr(hash)))) != NULL) { if (aux == rt || rt_is_expired(aux)) { *rthp = aux->dst.rt_next; rt_free(aux); continue; } rthp = &aux->dst.rt_next; } spin_unlock_bh(rt_hash_lock_addr(hash)); } ",0 "File* DataObjectItem::GetAsFile() const { if (Kind() != kFileKind) return nullptr; if (source_ == kInternalSource) { if (file_) return file_.Get(); DCHECK(shared_buffer_); return nullptr; } DCHECK_EQ(source_, kClipboardSource); if (GetType() == kMimeTypeImagePng) { SkBitmap bitmap = SystemClipboard::GetInstance().ReadImage( mojom::ClipboardBuffer::kStandard); SkPixmap pixmap; bitmap.peekPixels(&pixmap); Vector png_data; SkPngEncoder::Options options; options.fZLibLevel = 1; // Fastest compression. if (!ImageEncoder::Encode(&png_data, pixmap, options)) return nullptr; auto data = std::make_unique(); data->SetContentType(kMimeTypeImagePng); data->AppendBytes(png_data.data(), png_data.size()); const uint64_t length = data->length(); auto blob = BlobDataHandle::Create(std::move(data), length); return File::Create(""image.png"", base::Time::Now().ToDoubleT() * 1000.0, std::move(blob)); } return nullptr; } ",1 "const struct user_regset_view *task_user_regset_view(struct task_struct *task) { #ifdef CONFIG_COMPAT if (test_tsk_thread_flag(task, TIF_31BIT)) return &user_s390_compat_view; #endif return &user_s390_view; } ",0 "static int qib_tid_update(struct qib_ctxtdata *rcd, struct file *fp, const struct qib_tid_info *ti) { int ret = 0, ntids; u32 tid, ctxttid, cnt, i, tidcnt, tidoff; u16 *tidlist; struct qib_devdata *dd = rcd->dd; u64 physaddr; unsigned long vaddr; u64 __iomem *tidbase; unsigned long tidmap[8]; struct page **pagep = NULL; unsigned subctxt = subctxt_fp(fp); if (!dd->pageshadow) { ret = -ENOMEM; goto done; } cnt = ti->tidcnt; if (!cnt) { ret = -EFAULT; goto done; } ctxttid = rcd->ctxt * dd->rcvtidcnt; if (!rcd->subctxt_cnt) { tidcnt = dd->rcvtidcnt; tid = rcd->tidcursor; tidoff = 0; } else if (!subctxt) { tidcnt = (dd->rcvtidcnt / rcd->subctxt_cnt) + (dd->rcvtidcnt % rcd->subctxt_cnt); tidoff = dd->rcvtidcnt - tidcnt; ctxttid += tidoff; tid = tidcursor_fp(fp); } else { tidcnt = dd->rcvtidcnt / rcd->subctxt_cnt; tidoff = tidcnt * (subctxt - 1); ctxttid += tidoff; tid = tidcursor_fp(fp); } if (cnt > tidcnt) { /* make sure it all fits in tid_pg_list */ qib_devinfo(dd->pcidev, ""Process tried to allocate %u TIDs, only trying max (%u)\n"", cnt, tidcnt); cnt = tidcnt; } pagep = (struct page **) rcd->tid_pg_list; tidlist = (u16 *) &pagep[dd->rcvtidcnt]; pagep += tidoff; tidlist += tidoff; memset(tidmap, 0, sizeof(tidmap)); /* before decrement; chip actual # */ ntids = tidcnt; tidbase = (u64 __iomem *) (((char __iomem *) dd->kregbase) + dd->rcvtidbase + ctxttid * sizeof(*tidbase)); /* virtual address of first page in transfer */ vaddr = ti->tidvaddr; if (!access_ok(VERIFY_WRITE, (void __user *) vaddr, cnt * PAGE_SIZE)) { ret = -EFAULT; goto done; } ret = qib_get_user_pages(vaddr, cnt, pagep); if (ret) { /* * if (ret == -EBUSY) * We can't continue because the pagep array won't be * initialized. This should never happen, * unless perhaps the user has mpin'ed the pages * themselves. */ qib_devinfo( dd->pcidev, ""Failed to lock addr %p, %u pages: errno %d\n"", (void *) vaddr, cnt, -ret); goto done; } for (i = 0; i < cnt; i++, vaddr += PAGE_SIZE) { for (; ntids--; tid++) { if (tid == tidcnt) tid = 0; if (!dd->pageshadow[ctxttid + tid]) break; } if (ntids < 0) { /* * Oops, wrapped all the way through their TIDs, * and didn't have enough free; see comments at * start of routine */ i--; /* last tidlist[i] not filled in */ ret = -ENOMEM; break; } tidlist[i] = tid + tidoff; /* we ""know"" system pages and TID pages are same size */ dd->pageshadow[ctxttid + tid] = pagep[i]; dd->physshadow[ctxttid + tid] = qib_map_page(dd->pcidev, pagep[i], 0, PAGE_SIZE, PCI_DMA_FROMDEVICE); /* * don't need atomic or it's overhead */ __set_bit(tid, tidmap); physaddr = dd->physshadow[ctxttid + tid]; /* PERFORMANCE: below should almost certainly be cached */ dd->f_put_tid(dd, &tidbase[tid], RCVHQ_RCV_TYPE_EXPECTED, physaddr); /* * don't check this tid in qib_ctxtshadow, since we * just filled it in; start with the next one. */ tid++; } if (ret) { u32 limit; cleanup: /* jump here if copy out of updated info failed... */ /* same code that's in qib_free_tid() */ limit = sizeof(tidmap) * BITS_PER_BYTE; if (limit > tidcnt) /* just in case size changes in future */ limit = tidcnt; tid = find_first_bit((const unsigned long *)tidmap, limit); for (; tid < limit; tid++) { if (!test_bit(tid, tidmap)) continue; if (dd->pageshadow[ctxttid + tid]) { dma_addr_t phys; phys = dd->physshadow[ctxttid + tid]; dd->physshadow[ctxttid + tid] = dd->tidinvalid; /* PERFORMANCE: below should almost certainly * be cached */ dd->f_put_tid(dd, &tidbase[tid], RCVHQ_RCV_TYPE_EXPECTED, dd->tidinvalid); pci_unmap_page(dd->pcidev, phys, PAGE_SIZE, PCI_DMA_FROMDEVICE); dd->pageshadow[ctxttid + tid] = NULL; } } qib_release_user_pages(pagep, cnt); } else { /* * Copy the updated array, with qib_tid's filled in, back * to user. Since we did the copy in already, this ""should * never fail"" If it does, we have to clean up... */ if (copy_to_user((void __user *) (unsigned long) ti->tidlist, tidlist, cnt * sizeof(*tidlist))) { ret = -EFAULT; goto cleanup; } if (copy_to_user((void __user *) (unsigned long) ti->tidmap, tidmap, sizeof(tidmap))) { ret = -EFAULT; goto cleanup; } if (tid == tidcnt) tid = 0; if (!rcd->subctxt_cnt) rcd->tidcursor = tid; else tidcursor_fp(fp) = tid; } done: return ret; } ",0 "bool isAllowedByAll(const CSPDirectiveListVector& policies, Element* element, const String& contextURL, const String& nonce, const WTF::OrdinalNumber& contextLine, SecurityViolationReportingPolicy reportingPolicy, const String& content) { bool isAllowed = true; for (const auto& policy : policies) { isAllowed &= (policy.get()->*allowed)( element, contextURL, nonce, contextLine, reportingPolicy, content); } return isAllowed; } ",0 "static inline void disable_gif(struct vcpu_svm *svm) { svm->vcpu.arch.hflags &= ~HF_GIF_MASK; } ",0 "kwsalloc (char const *trans) { struct kwset *kwset; kwset = (struct kwset *) malloc(sizeof (struct kwset)); if (!kwset) return NULL; obstack_init(&kwset->obstack); kwset->words = 0; kwset->trie = (struct trie *) obstack_alloc(&kwset->obstack, sizeof (struct trie)); if (!kwset->trie) { kwsfree((kwset_t) kwset); return NULL; } kwset->trie->accepting = 0; kwset->trie->links = NULL; kwset->trie->parent = NULL; kwset->trie->next = NULL; kwset->trie->fail = NULL; kwset->trie->depth = 0; kwset->trie->shift = 0; kwset->mind = INT_MAX; kwset->maxd = -1; kwset->target = NULL; kwset->trans = trans; return (kwset_t) kwset; } ",0 "static bool push_ascii_string(void *dest, const char *src, size_t dest_len, int flags, size_t *converted_size) { size_t src_len; bool ret; if (flags & STR_UPPER) { char *tmpbuf = strupper_talloc(NULL, src); if (tmpbuf == NULL) { return false; } ret = push_ascii_string(dest, tmpbuf, dest_len, flags & ~STR_UPPER, converted_size); talloc_free(tmpbuf); return ret; } src_len = strlen(src); if (flags & (STR_TERMINATE | STR_TERMINATE_ASCII)) src_len++; return convert_string(CH_UNIX, CH_DOS, src, src_len, dest, dest_len, converted_size); } ",0 " Framebuffer* GetFramebuffer(GLuint client_id) { return framebuffer_manager()->GetFramebuffer(client_id); } ",0 "kwsprep (kwset_t kws) { struct kwset *kwset; int i; struct trie *curr; char const *trans; unsigned char delta[NCHAR]; kwset = (struct kwset *) kws; /* Initial values for the delta table; will be changed later. The delta entry for a given character is the smallest depth of any node at which an outgoing edge is labeled by that character. */ memset(delta, kwset->mind < UCHAR_MAX ? kwset->mind : UCHAR_MAX, NCHAR); /* Check if we can use the simple boyer-moore algorithm, instead of the hairy commentz-walter algorithm. */ if (kwset->words == 1 && kwset->trans == NULL) { char c; /* Looking for just one string. Extract it from the trie. */ kwset->target = obstack_alloc(&kwset->obstack, kwset->mind); if (!kwset->target) return _(""memory exhausted""); for (i = kwset->mind - 1, curr = kwset->trie; i >= 0; --i) { kwset->target[i] = curr->links->label; curr = curr->links->trie; } /* Build the Boyer Moore delta. Boy that's easy compared to CW. */ for (i = 0; i < kwset->mind; ++i) delta[U(kwset->target[i])] = kwset->mind - (i + 1); /* Find the minimal delta2 shift that we might make after a backwards match has failed. */ c = kwset->target[kwset->mind - 1]; for (i = kwset->mind - 2; i >= 0; --i) if (kwset->target[i] == c) break; kwset->mind2 = kwset->mind - (i + 1); } else { struct trie *fail; struct trie *last, *next[NCHAR]; /* Traverse the nodes of the trie in level order, simultaneously computing the delta table, failure function, and shift function. */ for (curr = last = kwset->trie; curr; curr = curr->next) { /* Enqueue the immediate descendents in the level order queue. */ enqueue(curr->links, &last); curr->shift = kwset->mind; curr->maxshift = kwset->mind; /* Update the delta table for the descendents of this node. */ treedelta(curr->links, curr->depth, delta); /* Compute the failure function for the decendents of this node. */ treefails(curr->links, curr->fail, kwset->trie); /* Update the shifts at each node in the current node's chain of fails back to the root. */ for (fail = curr->fail; fail; fail = fail->fail) { /* If the current node has some outgoing edge that the fail doesn't, then the shift at the fail should be no larger than the difference of their depths. */ if (!hasevery(fail->links, curr->links)) if (curr->depth - fail->depth < fail->shift) fail->shift = curr->depth - fail->depth; /* If the current node is accepting then the shift at the fail and its descendents should be no larger than the difference of their depths. */ if (curr->accepting && fail->maxshift > curr->depth - fail->depth) fail->maxshift = curr->depth - fail->depth; } } /* Traverse the trie in level order again, fixing up all nodes whose shift exceeds their inherited maxshift. */ for (curr = kwset->trie->next; curr; curr = curr->next) { if (curr->maxshift > curr->parent->maxshift) curr->maxshift = curr->parent->maxshift; if (curr->shift > curr->maxshift) curr->shift = curr->maxshift; } /* Create a vector, indexed by character code, of the outgoing links from the root node. */ for (i = 0; i < NCHAR; ++i) next[i] = NULL; treenext(kwset->trie->links, next); if ((trans = kwset->trans) != NULL) for (i = 0; i < NCHAR; ++i) kwset->next[i] = next[U(trans[i])]; else memcpy(kwset->next, next, NCHAR * sizeof(struct trie *)); } /* Fix things up for any translation table. */ if ((trans = kwset->trans) != NULL) for (i = 0; i < NCHAR; ++i) kwset->delta[i] = delta[U(trans[i])]; else memcpy(kwset->delta, delta, NCHAR); return NULL; } ",0 "static inline void php_register_server_variables(void) { zval request_time_float, request_time_long; zval_ptr_dtor(&PG(http_globals)[TRACK_VARS_SERVER]); array_init(&PG(http_globals)[TRACK_VARS_SERVER]); /* Server variables */ if (sapi_module.register_server_variables) { sapi_module.register_server_variables(&PG(http_globals)[TRACK_VARS_SERVER]); } /* PHP Authentication support */ if (SG(request_info).auth_user) { php_register_variable(""PHP_AUTH_USER"", SG(request_info).auth_user, &PG(http_globals)[TRACK_VARS_SERVER]); } if (SG(request_info).auth_password) { php_register_variable(""PHP_AUTH_PW"", SG(request_info).auth_password, &PG(http_globals)[TRACK_VARS_SERVER]); } if (SG(request_info).auth_digest) { php_register_variable(""PHP_AUTH_DIGEST"", SG(request_info).auth_digest, &PG(http_globals)[TRACK_VARS_SERVER]); } /* store request init time */ ZVAL_DOUBLE(&request_time_float, sapi_get_request_time()); php_register_variable_ex(""REQUEST_TIME_FLOAT"", &request_time_float, &PG(http_globals)[TRACK_VARS_SERVER]); ZVAL_LONG(&request_time_long, zend_dval_to_lval(Z_DVAL(request_time_float))); php_register_variable_ex(""REQUEST_TIME"", &request_time_long, &PG(http_globals)[TRACK_VARS_SERVER]); } ",0 "static int proc_single_show(struct seq_file *m, void *v) { struct inode *inode = m->private; struct pid_namespace *ns; struct pid *pid; struct task_struct *task; int ret; ns = inode->i_sb->s_fs_info; pid = proc_pid(inode); task = get_pid_task(pid, PIDTYPE_PID); if (!task) return -ESRCH; ret = PROC_I(inode)->op.proc_show(m, ns, pid, task); put_task_struct(task); return ret; } ",0 "void RenderThreadImpl::RemoveObserver(RenderThreadObserver* observer) { observer->UnregisterMojoInterfaces(&associated_interfaces_); observers_.RemoveObserver(observer); } ",0 "static inline int StreamTcpValidateChecksum(Packet *p) { int ret = 1; if (p->flags & PKT_IGNORE_CHECKSUM) return ret; if (p->level4_comp_csum == -1) { if (PKT_IS_IPV4(p)) { p->level4_comp_csum = TCPChecksum(p->ip4h->s_ip_addrs, (uint16_t *)p->tcph, (p->payload_len + TCP_GET_HLEN(p)), p->tcph->th_sum); } else if (PKT_IS_IPV6(p)) { p->level4_comp_csum = TCPV6Checksum(p->ip6h->s_ip6_addrs, (uint16_t *)p->tcph, (p->payload_len + TCP_GET_HLEN(p)), p->tcph->th_sum); } } if (p->level4_comp_csum != 0) { ret = 0; if (p->livedev) { (void) SC_ATOMIC_ADD(p->livedev->invalid_checksums, 1); } else if (p->pcap_cnt) { PcapIncreaseInvalidChecksum(); } } return ret; } ",0 "asmlinkage long compat_sys_ptrace(compat_long_t request, compat_long_t pid, compat_long_t addr, compat_long_t data) { struct task_struct *child; long ret; if (request == PTRACE_TRACEME) { ret = ptrace_traceme(); goto out; } child = ptrace_get_task_struct(pid); if (IS_ERR(child)) { ret = PTR_ERR(child); goto out; } if (request == PTRACE_ATTACH || request == PTRACE_SEIZE) { ret = ptrace_attach(child, request, addr, data); /* * Some architectures need to do book-keeping after * a ptrace attach. */ if (!ret) arch_ptrace_attach(child); goto out_put_task_struct; } ret = ptrace_check_attach(child, request == PTRACE_KILL || request == PTRACE_INTERRUPT); if (!ret) ret = compat_arch_ptrace(child, request, addr, data); out_put_task_struct: put_task_struct(child); out: return ret; } ",1 "build_pathname(struct archive_string *as, struct file_info *file, int depth) { if (depth > 1000) { return NULL; } if (file->parent != NULL && archive_strlen(&file->parent->name) > 0) { if (build_pathname(as, file->parent, depth + 1) == NULL) { return NULL; } archive_strcat(as, ""/""); } if (archive_strlen(&file->name) == 0) archive_strcat(as, "".""); else archive_string_concat(as, &file->name); return (as->s); } ",0 "static int nfc_genl_disable_se(struct sk_buff *skb, struct genl_info *info) { struct nfc_dev *dev; int rc; u32 idx, se_idx; if (!info->attrs[NFC_ATTR_DEVICE_INDEX] || !info->attrs[NFC_ATTR_SE_INDEX]) return -EINVAL; idx = nla_get_u32(info->attrs[NFC_ATTR_DEVICE_INDEX]); se_idx = nla_get_u32(info->attrs[NFC_ATTR_SE_INDEX]); dev = nfc_get_device(idx); if (!dev) return -ENODEV; rc = nfc_disable_se(dev, se_idx); nfc_put_device(dev); return rc; } ",0 "static bool CheckMpeg2TransportStream(const uint8* buffer, int buffer_size) { RCHECK(buffer_size >= 250); // Want more than 1 packet to check. int offset = 0; int packet_length = -1; while (buffer[offset] != kMpeg2SyncWord && offset < 20) { ++offset; } while (offset + 6 < buffer_size) { BitReader reader(buffer + offset, 6); RCHECK(ReadBits(&reader, 8) == kMpeg2SyncWord); reader.SkipBits(1 + 1 + 1); int pid = ReadBits(&reader, 13); RCHECK(pid < 3 || pid > 15); reader.SkipBits(2); int adaptation_field_control = ReadBits(&reader, 2); RCHECK(adaptation_field_control != 0); if (adaptation_field_control >= 2) { reader.SkipBits(4); int adaptation_field_length = ReadBits(&reader, 8); if (adaptation_field_control == 2) RCHECK(adaptation_field_length == 183); else RCHECK(adaptation_field_length <= 182); } if (packet_length < 0) { if (buffer[offset + 188] == kMpeg2SyncWord) packet_length = 188; else if (buffer[offset + 192] == kMpeg2SyncWord) packet_length = 192; else if (buffer[offset + 204] == kMpeg2SyncWord) packet_length = 204; else packet_length = 208; } offset += packet_length; } return true; } ",0 "static int llc_conn_rcv(struct sock *sk, struct sk_buff *skb) { struct llc_conn_state_ev *ev = llc_conn_ev(skb); ev->type = LLC_CONN_EV_TYPE_PDU; ev->reason = 0; return llc_conn_state_process(sk, skb); } ",0 "write_lease(const struct interface *iface, const struct dhcp_message *dhcp) { int fd; ssize_t bytes = sizeof(*dhcp); const uint8_t *p = dhcp->options; const uint8_t *e = p + sizeof(dhcp->options); uint8_t l; uint8_t o = 0; /* We don't write BOOTP leases */ if (is_bootp(dhcp)) { unlink(iface->leasefile); return 0; } syslog(LOG_DEBUG, ""%s: writing lease `%s'"", iface->name, iface->leasefile); fd = open(iface->leasefile, O_WRONLY | O_CREAT | O_TRUNC, 0444); #ifdef ANDROID if (fd == -1 && errno == EACCES) { /* the lease file might have been created when dhcpcd was running as root */ unlink(iface->leasefile); fd = open(iface->leasefile, O_WRONLY | O_CREAT | O_TRUNC, 0444); } #endif if (fd == -1) { syslog(LOG_ERR, ""%s: open: %m"", iface->name); return -1; } /* Only write as much as we need */ while (p < e) { o = *p; if (o == DHO_END) { bytes = p - (const uint8_t *)dhcp; break; } p++; if (o != DHO_PAD) { l = *p++; p += l; } } bytes = write(fd, dhcp, bytes); close(fd); return bytes; } ",0 "NO_INLINE JsVar *jspeConstruct(JsVar *func, JsVar *funcName, bool hasArgs) { assert(JSP_SHOULD_EXECUTE); if (!jsvIsFunction(func)) { jsExceptionHere(JSET_ERROR, ""Constructor should be a function, but is %t"", func); return 0; } JsVar *thisObj = jsvNewObject(); if (!thisObj) return 0; // out of memory JsVar *prototypeName = jsvFindChildFromString(func, JSPARSE_PROTOTYPE_VAR, true); jspEnsureIsPrototype(func, prototypeName); // make sure it's an object JsVar *prototypeVar = jsvSkipName(prototypeName); jsvUnLock3(jsvAddNamedChild(thisObj, prototypeVar, JSPARSE_INHERITS_VAR), prototypeVar, prototypeName); JsVar *a = jspeFunctionCall(func, funcName, thisObj, hasArgs, 0, 0); /* FIXME: we should ignore return values that aren't objects (bug #848), but then we need * to be aware of `new String()` and `new Uint8Array()`. Ideally we'd let through * arrays/etc, and then String/etc should return 'boxed' values. * * But they don't return boxed values at the moment, so let's just * pass the return value through. If you try and return a string from * a function it's broken JS code anyway. */ if (a) { jsvUnLock(thisObj); thisObj = a; } else { jsvUnLock(a); } return thisObj; } ",0 "bool ImageInputType::hasLegalLinkAttribute(const QualifiedName& name) const { return name == srcAttr || BaseButtonInputType::hasLegalLinkAttribute(name); } ",0 "static int cipso_v4_getattr(const unsigned char *cipso, struct netlbl_lsm_secattr *secattr) { int ret_val = -ENOMSG; u32 doi; struct cipso_v4_doi *doi_def; if (cipso_v4_cache_check(cipso, cipso[1], secattr) == 0) return 0; doi = get_unaligned_be32(&cipso[2]); rcu_read_lock(); doi_def = cipso_v4_doi_search(doi); if (doi_def == NULL) goto getattr_return; /* XXX - This code assumes only one tag per CIPSO option which isn't * really a good assumption to make but since we only support the MAC * tags right now it is a safe assumption. */ switch (cipso[6]) { case CIPSO_V4_TAG_RBITMAP: ret_val = cipso_v4_parsetag_rbm(doi_def, &cipso[6], secattr); break; case CIPSO_V4_TAG_ENUM: ret_val = cipso_v4_parsetag_enum(doi_def, &cipso[6], secattr); break; case CIPSO_V4_TAG_RANGE: ret_val = cipso_v4_parsetag_rng(doi_def, &cipso[6], secattr); break; case CIPSO_V4_TAG_LOCAL: ret_val = cipso_v4_parsetag_loc(doi_def, &cipso[6], secattr); break; } if (ret_val == 0) secattr->type = NETLBL_NLTYPE_CIPSOV4; getattr_return: rcu_read_unlock(); return ret_val; } ",0 "void GLES2DecoderImpl::PerformanceWarning(const std::string& msg) { LogMessage(std::string(""PERFORMANCE WARNING: "") + msg); } ",0 "error::Error GLES2DecoderImpl::HandleDeleteProgram( uint32 immediate_data_size, const gles2::DeleteProgram& c) { GLuint client_id = c.program; if (client_id) { ProgramManager::ProgramInfo* info = GetProgramInfo(client_id); if (info) { if (!info->IsDeleted()) { program_manager()->MarkAsDeleted(shader_manager(), info); } } else { SetGLError(GL_INVALID_VALUE, ""glDeleteProgram"", ""unknown program""); } } return error::kNoError; } ",0 "already_exist_sock(list l, sa_family_t family, int proto, ifindex_t ifindex, bool unicast) { sock_t *sock; element e; LIST_FOREACH(l, sock, e) { if ((sock->family == family) && (sock->proto == proto) && (sock->ifindex == ifindex) && (sock->unicast == unicast)) return sock; } return NULL; } ",0 "static JSValueRef addTouchPointCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 2) return JSValueMakeUndefined(context); int x = static_cast(JSValueToNumber(context, arguments[0], exception)); ASSERT(!exception || !*exception); int y = static_cast(JSValueToNumber(context, arguments[1], exception)); ASSERT(!exception || !*exception); BlackBerry::Platform::TouchPoint touch; touch.m_id = touches.isEmpty() ? 0 : touches.last().m_id + 1; IntPoint pos(x, y); touch.m_pos = pos; touch.m_screenPos = pos; touch.m_state = BlackBerry::Platform::TouchPoint::TouchPressed; touches.append(touch); return JSValueMakeUndefined(context); } ",1 "static void startup_timer_expired(UNUSED_ATTR void *context) { LOG_ERROR(""%s"", __func__); future_ready(startup_future, FUTURE_FAIL); startup_future = NULL; } ",0 "static void write_ecryptfs_marker(char *page_virt, size_t *written) { u32 m_1, m_2; get_random_bytes(&m_1, (MAGIC_ECRYPTFS_MARKER_SIZE_BYTES / 2)); m_2 = (m_1 ^ MAGIC_ECRYPTFS_MARKER); put_unaligned_be32(m_1, page_virt); page_virt += (MAGIC_ECRYPTFS_MARKER_SIZE_BYTES / 2); put_unaligned_be32(m_2, page_virt); (*written) = MAGIC_ECRYPTFS_MARKER_SIZE_BYTES; } ",0 "void get_iowait_load(unsigned long *nr_waiters, unsigned long *load) { struct rq *rq = this_rq(); *nr_waiters = atomic_read(&rq->nr_iowait); *load = rq->load.weight; } ",0 "static int send_connect(struct iwch_ep *ep) { struct cpl_act_open_req *req; struct sk_buff *skb; u32 opt0h, opt0l, opt2; unsigned int mtu_idx; int wscale; PDBG(""%s ep %p\n"", __func__, ep); skb = get_skb(NULL, sizeof(*req), GFP_KERNEL); if (!skb) { printk(KERN_ERR MOD ""%s - failed to alloc skb.\n"", __func__); return -ENOMEM; } mtu_idx = find_best_mtu(T3C_DATA(ep->com.tdev), dst_mtu(ep->dst)); wscale = compute_wscale(rcv_win); opt0h = V_NAGLE(0) | V_NO_CONG(nocong) | V_KEEP_ALIVE(1) | F_TCAM_BYPASS | V_WND_SCALE(wscale) | V_MSS_IDX(mtu_idx) | V_L2T_IDX(ep->l2t->idx) | V_TX_CHANNEL(ep->l2t->smt_idx); opt0l = V_TOS((ep->tos >> 2) & M_TOS) | V_RCV_BUFSIZ(rcv_win>>10); opt2 = F_RX_COALESCE_VALID | V_RX_COALESCE(0) | V_FLAVORS_VALID(1) | V_CONG_CONTROL_FLAVOR(cong_flavor); skb->priority = CPL_PRIORITY_SETUP; set_arp_failure_handler(skb, act_open_req_arp_failure); req = (struct cpl_act_open_req *) skb_put(skb, sizeof(*req)); req->wr.wr_hi = htonl(V_WR_OP(FW_WROPCODE_FORWARD)); OPCODE_TID(req) = htonl(MK_OPCODE_TID(CPL_ACT_OPEN_REQ, ep->atid)); req->local_port = ep->com.local_addr.sin_port; req->peer_port = ep->com.remote_addr.sin_port; req->local_ip = ep->com.local_addr.sin_addr.s_addr; req->peer_ip = ep->com.remote_addr.sin_addr.s_addr; req->opt0h = htonl(opt0h); req->opt0l = htonl(opt0l); req->params = 0; req->opt2 = htonl(opt2); return iwch_l2t_send(ep->com.tdev, skb, ep->l2t); } ",0 "ec_powm (gcry_mpi_t w, const gcry_mpi_t b, const gcry_mpi_t e, mpi_ec_t ctx) { mpi_powm (w, b, e, ctx->p); /* _gcry_mpi_abs (w); */ } ",0 "static int fuse_notify(struct fuse_conn *fc, enum fuse_notify_code code, unsigned int size, struct fuse_copy_state *cs) { switch (code) { case FUSE_NOTIFY_POLL: return fuse_notify_poll(fc, size, cs); case FUSE_NOTIFY_INVAL_INODE: return fuse_notify_inval_inode(fc, size, cs); case FUSE_NOTIFY_INVAL_ENTRY: return fuse_notify_inval_entry(fc, size, cs); case FUSE_NOTIFY_STORE: return fuse_notify_store(fc, size, cs); case FUSE_NOTIFY_RETRIEVE: return fuse_notify_retrieve(fc, size, cs); default: fuse_copy_finish(cs); return -EINVAL; } } ",0 "static void cirrus_invalidate_region(CirrusVGAState * s, int off_begin, int off_pitch, int bytesperline, int lines) { int y; int off_cur; int off_cur_end; for (y = 0; y < lines; y++) { off_cur = off_begin; off_cur_end = (off_cur + bytesperline) & s->cirrus_addr_mask; memory_region_set_dirty(&s->vga.vram, off_cur, off_cur_end - off_cur); off_begin += off_pitch; } } ",0 "gp_rgba8(Pixel *p, png_const_voidp pb) { png_const_bytep pp = voidcast(png_const_bytep, pb); p->r = pp[0]; p->g = pp[1]; p->b = pp[2]; p->a = pp[3]; } ",0 "void InlineFlowBox::adjustPosition(float dx, float dy) { InlineBox::adjustPosition(dx, dy); for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) child->adjustPosition(dx, dy); if (m_overflow) m_overflow->move(dx, dy); // FIXME: Rounding error here since overflow was pixel snapped, but nobody other than list markers passes non-integral values here. } ",0 "void WebGLRenderingContextBase::ForciblyLoseOldestContext( const String& reason) { WebGLRenderingContextBase* candidate = OldestContext(); if (!candidate) return; candidate->PrintWarningToConsole(reason); probe::didFireWebGLWarning(candidate->canvas()); candidate->ForceLostContext(WebGLRenderingContextBase::kSyntheticLostContext, WebGLRenderingContextBase::kWhenAvailable); } ",0 "add_opt_anc_info(OptAnc* to, int anc) { if (is_left(anc)) to->left |= anc; else to->right |= anc; } ",0 "ImageResourceContent* ImageResource::GetContent() { return content_; } ",0 "static void raw_close(struct sock *sk, long timeout) { /* * Raw sockets may have direct kernel references. Kill them. */ rtnl_lock(); ip_ra_control(sk, 0, NULL); rtnl_unlock(); sk_common_release(sk); } ",0 "status_t AMRSource::stop() { CHECK(mStarted); delete mGroup; mGroup = NULL; mStarted = false; return OK; } ",0 "void GestureSequence::AppendDoubleClickGestureEvent(const GesturePoint& point, Gestures* gestures) { gestures->push_back(linked_ptr(new GestureEvent( ui::ET_GESTURE_DOUBLE_TAP, point.first_touch_position().x(), point.first_touch_position().y(), flags_, base::Time::FromDoubleT(point.last_touch_time()), 0.f, 0.f))); } ",0 "GF_Err trik_dump(GF_Box *a, FILE * trace) { u32 i; GF_TrickPlayBox *p = (GF_TrickPlayBox *) a; gf_isom_box_dump_start(a, ""TrickPlayBox"", trace); fprintf(trace, "">\n""); for (i=0; ientry_count; i++) { fprintf(trace, ""\n"", p->entries[i].pic_type, p->entries[i].dependency_level); } if (!p->size) fprintf(trace, ""\n""); gf_isom_box_dump_done(""TrickPlayBox"", a, trace); return GF_OK; } ",0 "void SyncManager::SyncInternal::ShutdownOnSyncThread() { DCHECK(thread_checker_.CalledOnValidThread()); weak_ptr_factory_.InvalidateWeakPtrs(); js_mutation_event_observer_.InvalidateWeakPtrs(); scheduler_.reset(); SetJsEventHandler(WeakHandle()); RemoveObserver(&js_sync_manager_observer_); RemoveObserver(&debug_info_event_listener_); if (sync_notifier_.get()) { sync_notifier_->RemoveObserver(this); } sync_notifier_.reset(); if (connection_manager_.get()) { connection_manager_->RemoveListener(this); } connection_manager_.reset(); net::NetworkChangeNotifier::RemoveIPAddressObserver(this); observing_ip_address_changes_ = false; if (initialized_ && directory()) { { ReadTransaction trans(FROM_HERE, GetUserShare()); trans.GetCryptographer()->RemoveObserver(this); } directory()->SaveChanges(); } share_.directory.reset(); change_delegate_ = NULL; registrar_ = NULL; initialized_ = false; change_observer_.Reset(); weak_handle_this_.Reset(); } ",0 "InputMethodLinuxX11::InputMethodLinuxX11( internal::InputMethodDelegate* delegate) { SetDelegate(delegate); } ",0 "gs_pop_real(gs_main_instance * minst, float *result) { i_ctx_t *i_ctx_p = minst->i_ctx_p; ref vref; int code = pop_value(i_ctx_p, &vref); if (code < 0) return code; switch (r_type(&vref)) { case t_real: *result = vref.value.realval; break; case t_integer: *result = (float)(vref.value.intval); break; default: return_error(gs_error_typecheck); } ref_stack_pop(&o_stack, 1); return 0; } ",0 "static void convert_32s6u_C1R(const OPJ_INT32* pSrc, OPJ_BYTE* pDst, OPJ_SIZE_T length) { OPJ_SIZE_T i; for (i = 0; i < (length & ~(OPJ_SIZE_T)3U); i += 4U) { OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i + 0]; OPJ_UINT32 src1 = (OPJ_UINT32)pSrc[i + 1]; OPJ_UINT32 src2 = (OPJ_UINT32)pSrc[i + 2]; OPJ_UINT32 src3 = (OPJ_UINT32)pSrc[i + 3]; *pDst++ = (OPJ_BYTE)((src0 << 2) | (src1 >> 4)); *pDst++ = (OPJ_BYTE)(((src1 & 0xFU) << 4) | (src2 >> 2)); *pDst++ = (OPJ_BYTE)(((src2 & 0x3U) << 6) | src3); } if (length & 3U) { OPJ_UINT32 src0 = (OPJ_UINT32)pSrc[i + 0]; OPJ_UINT32 src1 = 0U; OPJ_UINT32 src2 = 0U; length = length & 3U; if (length > 1U) { src1 = (OPJ_UINT32)pSrc[i + 1]; if (length > 2U) { src2 = (OPJ_UINT32)pSrc[i + 2]; } } *pDst++ = (OPJ_BYTE)((src0 << 2) | (src1 >> 4)); if (length > 1U) { *pDst++ = (OPJ_BYTE)(((src1 & 0xFU) << 4) | (src2 >> 2)); if (length > 2U) { *pDst++ = (OPJ_BYTE)(((src2 & 0x3U) << 6)); } } } } ",0 " bool WasAutoplayInitiated() { return Media()->WasAutoplayInitiated(); } ",0 "int phar_copy_on_write(phar_archive_data **pphar) /* {{{ */ { zval zv, *pzv; phar_archive_data *newpphar; ZVAL_PTR(&zv, *pphar); if (NULL == (pzv = zend_hash_str_add(&(PHAR_G(phar_fname_map)), (*pphar)->fname, (*pphar)->fname_len, &zv))) { return FAILURE; } phar_copy_cached_phar((phar_archive_data **)&Z_PTR_P(pzv)); newpphar = Z_PTR_P(pzv); /* invalidate phar cache */ PHAR_G(last_phar) = NULL; PHAR_G(last_phar_name) = PHAR_G(last_alias) = NULL; if (newpphar->alias_len && NULL == zend_hash_str_add_ptr(&(PHAR_G(phar_alias_map)), newpphar->alias, newpphar->alias_len, newpphar)) { zend_hash_str_del(&(PHAR_G(phar_fname_map)), (*pphar)->fname, (*pphar)->fname_len); return FAILURE; } *pphar = newpphar; return SUCCESS; } /* }}} */ ",0 "bool TemplateURLRef::ExtractSearchTermsFromURL( const GURL& url, base::string16* search_terms, const SearchTermsData& search_terms_data, url::Parsed::ComponentType* search_terms_component, url::Component* search_terms_position) const { DCHECK(search_terms); search_terms->clear(); ParseIfNecessary(search_terms_data); if (search_term_key_.empty() && (search_term_key_location_ != url::Parsed::PATH)) return false; if ((url.host() != host_) || (url.port() != port_) || ((url.path() != path_) && (search_term_key_location_ != url::Parsed::PATH))) { return false; } std::string source; url::Component position; if (search_term_key_location_ == url::Parsed::PATH) { source = url.path(); if (source.length() < path_.length()) return false; position.begin = search_term_position_in_path_; position.len = source.length() - path_.length(); if (source.substr(0, position.begin) + source.substr(position.end()) != path_) return false; } else { DCHECK(search_term_key_location_ == url::Parsed::QUERY || search_term_key_location_ == url::Parsed::REF); source = (search_term_key_location_ == url::Parsed::QUERY) ? url.query() : url.ref(); url::Component query, key, value; query.len = static_cast(source.size()); bool key_found = false; while (url::ExtractQueryKeyValue(source.c_str(), &query, &key, &value)) { if (key.is_nonempty()) { if (source.substr(key.begin, key.len) == search_term_key_) { if (key_found) return false; base::StringPiece search_term = base::StringPiece(source).substr(value.begin, value.len); if (!search_term.starts_with(search_term_value_prefix_) || !search_term.ends_with(search_term_value_suffix_)) continue; key_found = true; position = url::MakeRange(value.begin + search_term_value_prefix_.size(), value.end() - search_term_value_suffix_.size()); } } } if (!key_found) return false; } *search_terms = SearchTermToString16(source.substr(position.begin, position.len)); if (search_terms_component) *search_terms_component = search_term_key_location_; if (search_terms_position) *search_terms_position = position; return true; } ",0 "static int __vsock_core_init(void) { int err; vsock_init_tables(); vsock_device.minor = MISC_DYNAMIC_MINOR; err = misc_register(&vsock_device); if (err) { pr_err(""Failed to register misc device\n""); return -ENOENT; } err = proto_register(&vsock_proto, 1); /* we want our slab */ if (err) { pr_err(""Cannot register vsock protocol\n""); goto err_misc_deregister; } err = sock_register(&vsock_family_ops); if (err) { pr_err(""could not register af_vsock (%d) address family: %d\n"", AF_VSOCK, err); goto err_unregister_proto; } return 0; err_unregister_proto: proto_unregister(&vsock_proto); err_misc_deregister: misc_deregister(&vsock_device); return err; } ",0 "void XMLHttpRequest::abortError() { genericError(); if (!m_uploadComplete) { m_uploadComplete = true; if (m_upload && m_uploadEventsAllowed) m_upload->dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); } m_progressEventThrottle.dispatchEventAndLoadEnd(XMLHttpRequestProgressEvent::create(eventNames().abortEvent)); } ",1 "static int em_ret_far(struct x86_emulate_ctxt *ctxt) { int rc; unsigned long eip, cs; u16 old_cs; int cpl = ctxt->ops->cpl(ctxt); struct desc_struct old_desc, new_desc; const struct x86_emulate_ops *ops = ctxt->ops; if (ctxt->mode == X86EMUL_MODE_PROT64) ops->get_segment(ctxt, &old_cs, &old_desc, NULL, VCPU_SREG_CS); rc = emulate_pop(ctxt, &eip, ctxt->op_bytes); if (rc != X86EMUL_CONTINUE) return rc; rc = emulate_pop(ctxt, &cs, ctxt->op_bytes); if (rc != X86EMUL_CONTINUE) return rc; /* Outer-privilege level return is not implemented */ if (ctxt->mode >= X86EMUL_MODE_PROT16 && (cs & 3) > cpl) return X86EMUL_UNHANDLEABLE; rc = __load_segment_descriptor(ctxt, (u16)cs, VCPU_SREG_CS, cpl, X86_TRANSFER_RET, &new_desc); if (rc != X86EMUL_CONTINUE) return rc; rc = assign_eip_far(ctxt, eip, &new_desc); if (rc != X86EMUL_CONTINUE) { WARN_ON(ctxt->mode != X86EMUL_MODE_PROT64); ops->set_segment(ctxt, old_cs, &old_desc, 0, VCPU_SREG_CS); } return rc; } ",1 "ip6_checkentry(const struct ip6t_ip6 *ipv6) { if (ipv6->flags & ~IP6T_F_MASK) { duprintf(""Unknown flag bits set: %08X\n"", ipv6->flags & ~IP6T_F_MASK); return false; } if (ipv6->invflags & ~IP6T_INV_MASK) { duprintf(""Unknown invflag bits set: %08X\n"", ipv6->invflags & ~IP6T_INV_MASK); return false; } return true; } ",0 "void QQuickWebView::loadHtml(const QString& html, const QUrl& baseUrl, const QUrl& unreachableUrl) { Q_D(QQuickWebView); if (unreachableUrl.isValid()) d->webPageProxy->loadAlternateHTMLString(html, baseUrl.toString(), unreachableUrl.toString()); else d->webPageProxy->loadHTMLString(html, baseUrl.toString()); } ",0 "iso9660_write_data(struct archive_write *a, const void *buff, size_t s) { struct iso9660 *iso9660 = a->format_data; ssize_t r; if (iso9660->cur_file == NULL) return (0); if (archive_entry_filetype(iso9660->cur_file->entry) != AE_IFREG) return (0); if (s > iso9660->bytes_remaining) s = (size_t)iso9660->bytes_remaining; if (s == 0) return (0); r = write_iso9660_data(a, buff, s); if (r > 0) iso9660->bytes_remaining -= r; return (r); } ",0 "static v8::Handle addEventListenerCallback(const v8::Arguments& args) { INC_STATS(""DOM.TestObj.addEventListener()""); RefPtr listener = V8DOMWrapper::getEventListener(args[1], false, ListenerFindOrCreate); if (listener) { V8TestObj::toNative(args.Holder())->addEventListener(v8ValueToAtomicWebCoreString(args[0]), listener, args[2]->BooleanValue()); createHiddenDependency(args.Holder(), args[1], V8TestObj::eventListenerCacheIndex); } return v8::Undefined(); } ",0 "__buffer_unlock_commit(struct ring_buffer *buffer, struct ring_buffer_event *event) { __this_cpu_write(trace_taskinfo_save, true); /* If this is the temp buffer, we need to commit fully */ if (this_cpu_read(trace_buffered_event) == event) { /* Length is in event->array[0] */ ring_buffer_write(buffer, event->array[0], &event->array[1]); /* Release the temp buffer */ this_cpu_dec(trace_buffered_event_cnt); } else ring_buffer_unlock_commit(buffer, event); } ",0 "static void perf_mmap_open(struct vm_area_struct *vma) { struct perf_event *event = vma->vm_file->private_data; atomic_inc(&event->mmap_count); atomic_inc(&event->rb->mmap_count); if (vma->vm_pgoff) atomic_inc(&event->rb->aux_mmap_count); if (event->pmu->event_mapped) event->pmu->event_mapped(event); } ",0 "channel_flush_from_first_active_circuit(channel_t *chan, int max) { circuitmux_t *cmux = NULL; int n_flushed = 0; cell_queue_t *queue; circuit_t *circ; or_circuit_t *or_circ; int streams_blocked; packed_cell_t *cell; /* Get the cmux */ tor_assert(chan); tor_assert(chan->cmux); cmux = chan->cmux; /* Main loop: pick a circuit, send a cell, update the cmux */ while (n_flushed < max) { circ = circuitmux_get_first_active_circuit(cmux); /* If it returns NULL, no cells left to send */ if (!circ) break; assert_cmux_ok_paranoid(chan); if (circ->n_chan == chan) { queue = &circ->n_chan_cells; streams_blocked = circ->streams_blocked_on_n_chan; } else { or_circ = TO_OR_CIRCUIT(circ); tor_assert(or_circ->p_chan == chan); queue = &TO_OR_CIRCUIT(circ)->p_chan_cells; streams_blocked = circ->streams_blocked_on_p_chan; } /* Circuitmux told us this was active, so it should have cells */ tor_assert(queue->n > 0); /* * Get just one cell here; once we've sent it, that can change the circuit * selection, so we have to loop around for another even if this circuit * has more than one. */ cell = cell_queue_pop(queue); /* Calculate the exact time that this cell has spent in the queue. */ if (get_options()->CellStatistics && !CIRCUIT_IS_ORIGIN(circ)) { uint32_t msec_waiting; struct timeval tvnow; or_circ = TO_OR_CIRCUIT(circ); tor_gettimeofday_cached(&tvnow); msec_waiting = ((uint32_t)tv_to_msec(&tvnow)) - cell->inserted_time; or_circ->total_cell_waiting_time += msec_waiting; or_circ->processed_cells++; } /* If we just flushed our queue and this circuit is used for a * tunneled directory request, possibly advance its state. */ if (queue->n == 0 && chan->dirreq_id) geoip_change_dirreq_state(chan->dirreq_id, DIRREQ_TUNNELED, DIRREQ_CIRC_QUEUE_FLUSHED); /* Now send the cell */ channel_write_packed_cell(chan, cell); cell = NULL; /* * Don't packed_cell_free_unchecked(cell) here because the channel will * do so when it gets out of the channel queue (probably already did, in * which case that was an immediate double-free bug). */ /* Update the counter */ ++n_flushed; /* * Now update the cmux; tell it we've just sent a cell, and how many * we have left. */ circuitmux_notify_xmit_cells(cmux, circ, 1); circuitmux_set_num_cells(cmux, circ, queue->n); if (queue->n == 0) log_debug(LD_GENERAL, ""Made a circuit inactive.""); /* Is the cell queue low enough to unblock all the streams that are waiting * to write to this circuit? */ if (streams_blocked && queue->n <= CELL_QUEUE_LOWWATER_SIZE) set_streams_blocked_on_circ(circ, chan, 0, 0); /* unblock streams */ /* If n_flushed < max still, loop around and pick another circuit */ } /* Okay, we're done sending now */ assert_cmux_ok_paranoid(chan); return n_flushed; } ",0 "bool MediaControlDownloadButtonElement::shouldDisplayDownloadButton() { const KURL& url = mediaElement().currentSrc(); if (document().page() && document().page()->settings().getHideDownloadUI()) return false; if (url.isNull() || url.isEmpty()) return false; if (url.isLocalFile() || url.protocolIs(""blob"")) return false; if (HTMLMediaElement::isMediaStreamURL(url.getString())) return false; if (HTMLMediaSource::lookup(url)) return false; if (HTMLMediaElement::isHLSURL(url)) return false; return true; } ",0 "static int pfkey_spdget(struct sock *sk, struct sk_buff *skb, const struct sadb_msg *hdr, void * const *ext_hdrs) { struct net *net = sock_net(sk); unsigned int dir; int err = 0, delete; struct sadb_x_policy *pol; struct xfrm_policy *xp; struct km_event c; if ((pol = ext_hdrs[SADB_X_EXT_POLICY-1]) == NULL) return -EINVAL; dir = xfrm_policy_id2dir(pol->sadb_x_policy_id); if (dir >= XFRM_POLICY_MAX) return -EINVAL; delete = (hdr->sadb_msg_type == SADB_X_SPDDELETE2); xp = xfrm_policy_byid(net, DUMMY_MARK, XFRM_POLICY_TYPE_MAIN, dir, pol->sadb_x_policy_id, delete, &err); if (xp == NULL) return -ENOENT; if (delete) { xfrm_audit_policy_delete(xp, err ? 0 : 1, audit_get_loginuid(current), audit_get_sessionid(current), 0); if (err) goto out; c.seq = hdr->sadb_msg_seq; c.portid = hdr->sadb_msg_pid; c.data.byid = 1; c.event = XFRM_MSG_DELPOLICY; km_policy_notify(xp, dir, &c); } else { err = key_pol_get_resp(sk, xp, hdr, dir); } out: xfrm_pol_put(xp); return err; } ",0 "GLboolean WebGLRenderingContextBase::isFramebuffer( WebGLFramebuffer* framebuffer) { if (!framebuffer || isContextLost() || !framebuffer->Validate(ContextGroup(), this)) return 0; if (!framebuffer->HasEverBeenBound()) return 0; if (framebuffer->MarkedForDeletion()) return 0; return ContextGL()->IsFramebuffer(framebuffer->Object()); } ",0 "getMimeTypeToDownloadContentMap() { return { {""application/octet-stream"", DownloadContent::OCTET_STREAM}, {""binary/octet-stream"", DownloadContent::OCTET_STREAM}, {""application/pdf"", DownloadContent::PDF}, {""application/msword"", DownloadContent::DOCUMENT}, {""application/"" ""vnd.openxmlformats-officedocument.wordprocessingml.document"", DownloadContent::DOCUMENT}, {""application/rtf"", DownloadContent::DOCUMENT}, {""application/vnd.oasis.opendocument.text"", DownloadContent::DOCUMENT}, {""application/vnd.google-apps.document"", DownloadContent::DOCUMENT}, {""application/vnd.ms-excel"", DownloadContent::SPREADSHEET}, {""application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"", DownloadContent::SPREADSHEET}, {""application/vnd.oasis.opendocument.spreadsheet"", DownloadContent::SPREADSHEET}, {""application/vnd.google-apps.spreadsheet"", DownloadContent::SPREADSHEET}, {""application/vns.ms-powerpoint"", DownloadContent::PRESENTATION}, {""application/"" ""vnd.openxmlformats-officedocument.presentationml.presentation"", DownloadContent::PRESENTATION}, {""application/vnd.oasis.opendocument.presentation"", DownloadContent::PRESENTATION}, {""application/vnd.google-apps.presentation"", DownloadContent::PRESENTATION}, {""application/zip"", DownloadContent::ARCHIVE}, {""application/x-gzip"", DownloadContent::ARCHIVE}, {""application/x-rar-compressed"", DownloadContent::ARCHIVE}, {""application/x-tar"", DownloadContent::ARCHIVE}, {""application/x-bzip"", DownloadContent::ARCHIVE}, {""application/x-bzip2"", DownloadContent::ARCHIVE}, {""application/x-7z-compressed"", DownloadContent::ARCHIVE}, {""application/x-exe"", DownloadContent::EXECUTABLE}, {""application/java-archive"", DownloadContent::EXECUTABLE}, {""application/vnd.apple.installer+xml"", DownloadContent::EXECUTABLE}, {""application/x-csh"", DownloadContent::EXECUTABLE}, {""application/x-sh"", DownloadContent::EXECUTABLE}, {""application/x-apple-diskimage"", DownloadContent::DMG}, {""application/x-chrome-extension"", DownloadContent::CRX}, {""application/xhtml+xml"", DownloadContent::WEB}, {""application/xml"", DownloadContent::WEB}, {""application/javascript"", DownloadContent::WEB}, {""application/json"", DownloadContent::WEB}, {""application/typescript"", DownloadContent::WEB}, {""application/vnd.mozilla.xul+xml"", DownloadContent::WEB}, {""application/vnd.amazon.ebook"", DownloadContent::EBOOK}, {""application/epub+zip"", DownloadContent::EBOOK}, {""application/vnd.android.package-archive"", DownloadContent::APK}}; } ",0 "static int local_mknod(FsContext *fs_ctx, V9fsPath *dir_path, const char *name, FsCred *credp) { int err = -1; int dirfd; dirfd = local_opendir_nofollow(fs_ctx, dir_path->data); if (dirfd == -1) { return -1; } if (fs_ctx->export_flags & V9FS_SM_MAPPED || fs_ctx->export_flags & V9FS_SM_MAPPED_FILE) { err = mknodat(dirfd, name, SM_LOCAL_MODE_BITS | S_IFREG, 0); if (err == -1) { goto out; } if (fs_ctx->export_flags & V9FS_SM_MAPPED) { err = local_set_xattrat(dirfd, name, credp); } else { err = local_set_mapped_file_attrat(dirfd, name, credp); } if (err == -1) { goto err_end; } } else if (fs_ctx->export_flags & V9FS_SM_PASSTHROUGH || fs_ctx->export_flags & V9FS_SM_NONE) { err = mknodat(dirfd, name, credp->fc_mode, credp->fc_rdev); if (err == -1) { goto out; } err = local_set_cred_passthrough(fs_ctx, dirfd, name, credp); if (err == -1) { goto err_end; } } goto out; err_end: unlinkat_preserve_errno(dirfd, name, 0); out: close_preserve_errno(dirfd); return err; } ",0 "dissect_iur_dsch_channel_info(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, int offset, struct fp_info *p_fp_info) { gboolean is_control_frame; /* Header CRC */ proto_tree_add_item(tree, hf_fp_header_crc, tvb, offset, 1, ENC_BIG_ENDIAN); /* Frame Type */ is_control_frame = tvb_get_guint8(tvb, offset) & 0x01; proto_tree_add_item(tree, hf_fp_ft, tvb, offset, 1, ENC_BIG_ENDIAN); offset++; col_append_str(pinfo->cinfo, COL_INFO, is_control_frame ? "" [Control] "" : "" [Data] ""); if (is_control_frame) { dissect_common_control(tvb, pinfo, tree, offset, p_fp_info); } else { /* TODO: DATA */ } } ",0 "static int __init fscrypt_init(void) { fscrypt_read_workqueue = alloc_workqueue(""fscrypt_read_queue"", WQ_HIGHPRI, 0); if (!fscrypt_read_workqueue) goto fail; fscrypt_ctx_cachep = KMEM_CACHE(fscrypt_ctx, SLAB_RECLAIM_ACCOUNT); if (!fscrypt_ctx_cachep) goto fail_free_queue; fscrypt_info_cachep = KMEM_CACHE(fscrypt_info, SLAB_RECLAIM_ACCOUNT); if (!fscrypt_info_cachep) goto fail_free_ctx; return 0; fail_free_ctx: kmem_cache_destroy(fscrypt_ctx_cachep); fail_free_queue: destroy_workqueue(fscrypt_read_workqueue); fail: return -ENOMEM; } ",0 "doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num, size_t size, off_t fsize, int *flags, int mach, int strtab) { Elf32_Shdr sh32; Elf64_Shdr sh64; int stripped = 1; size_t nbadcap = 0; void *nbuf; off_t noff, coff, name_off; uint64_t cap_hw1 = 0; /* SunOS 5.x hardware capabilites */ uint64_t cap_sf1 = 0; /* SunOS 5.x software capabilites */ char name[50]; if (size != xsh_sizeof) { if (file_printf(ms, "", corrupted section header size"") == -1) return -1; return 0; } /* Read offset of name section to be able to read section names later */ if (pread(fd, xsh_addr, xsh_sizeof, off + size * strtab) == -1) { file_badread(ms); return -1; } name_off = xsh_offset; for ( ; num; num--) { /* Read the name of this section. */ if (pread(fd, name, sizeof(name), name_off + xsh_name) == -1) { file_badread(ms); return -1; } name[sizeof(name) - 1] = '\0'; if (strcmp(name, "".debug_info"") == 0) stripped = 0; if (pread(fd, xsh_addr, xsh_sizeof, off) == -1) { file_badread(ms); return -1; } off += size; /* Things we can determine before we seek */ switch (xsh_type) { case SHT_SYMTAB: #if 0 case SHT_DYNSYM: #endif stripped = 0; break; default: if (fsize != SIZE_UNKNOWN && xsh_offset > fsize) { /* Perhaps warn here */ continue; } break; } /* Things we can determine when we seek */ switch (xsh_type) { case SHT_NOTE: if ((nbuf = malloc(xsh_size)) == NULL) { file_error(ms, errno, ""Cannot allocate memory"" "" for note""); return -1; } if (pread(fd, nbuf, xsh_size, xsh_offset) == -1) { file_badread(ms); free(nbuf); return -1; } noff = 0; for (;;) { if (noff >= (off_t)xsh_size) break; noff = donote(ms, nbuf, (size_t)noff, xsh_size, clazz, swap, 4, flags); if (noff == 0) break; } free(nbuf); break; case SHT_SUNW_cap: switch (mach) { case EM_SPARC: case EM_SPARCV9: case EM_IA_64: case EM_386: case EM_AMD64: break; default: goto skip; } if (nbadcap > 5) break; if (lseek(fd, xsh_offset, SEEK_SET) == (off_t)-1) { file_badseek(ms); return -1; } coff = 0; for (;;) { Elf32_Cap cap32; Elf64_Cap cap64; char cbuf[/*CONSTCOND*/ MAX(sizeof cap32, sizeof cap64)]; if ((coff += xcap_sizeof) > (off_t)xsh_size) break; if (read(fd, cbuf, (size_t)xcap_sizeof) != (ssize_t)xcap_sizeof) { file_badread(ms); return -1; } if (cbuf[0] == 'A') { #ifdef notyet char *p = cbuf + 1; uint32_t len, tag; memcpy(&len, p, sizeof(len)); p += 4; len = getu32(swap, len); if (memcmp(""gnu"", p, 3) != 0) { if (file_printf(ms, "", unknown capability %.3s"", p) == -1) return -1; break; } p += strlen(p) + 1; tag = *p++; memcpy(&len, p, sizeof(len)); p += 4; len = getu32(swap, len); if (tag != 1) { if (file_printf(ms, "", unknown gnu"" "" capability tag %d"", tag) == -1) return -1; break; } #endif break; } (void)memcpy(xcap_addr, cbuf, xcap_sizeof); switch (xcap_tag) { case CA_SUNW_NULL: break; case CA_SUNW_HW_1: cap_hw1 |= xcap_val; break; case CA_SUNW_SF_1: cap_sf1 |= xcap_val; break; default: if (file_printf(ms, "", with unknown capability "" ""0x%"" INT64_T_FORMAT ""x = 0x%"" INT64_T_FORMAT ""x"", (unsigned long long)xcap_tag, (unsigned long long)xcap_val) == -1) return -1; if (nbadcap++ > 2) coff = xsh_size; break; } } /*FALLTHROUGH*/ skip: default: break; } } if (file_printf(ms, "", %sstripped"", stripped ? """" : ""not "") == -1) return -1; if (cap_hw1) { const cap_desc_t *cdp; switch (mach) { case EM_SPARC: case EM_SPARC32PLUS: case EM_SPARCV9: cdp = cap_desc_sparc; break; case EM_386: case EM_IA_64: case EM_AMD64: cdp = cap_desc_386; break; default: cdp = NULL; break; } if (file_printf(ms, "", uses"") == -1) return -1; if (cdp) { while (cdp->cd_name) { if (cap_hw1 & cdp->cd_mask) { if (file_printf(ms, "" %s"", cdp->cd_name) == -1) return -1; cap_hw1 &= ~cdp->cd_mask; } ++cdp; } if (cap_hw1) if (file_printf(ms, "" unknown hardware capability 0x%"" INT64_T_FORMAT ""x"", (unsigned long long)cap_hw1) == -1) return -1; } else { if (file_printf(ms, "" hardware capability 0x%"" INT64_T_FORMAT ""x"", (unsigned long long)cap_hw1) == -1) return -1; } } if (cap_sf1) { if (cap_sf1 & SF1_SUNW_FPUSED) { if (file_printf(ms, (cap_sf1 & SF1_SUNW_FPKNWN) ? "", uses frame pointer"" : "", not known to use frame pointer"") == -1) return -1; } cap_sf1 &= ~SF1_SUNW_MASK; if (cap_sf1) if (file_printf(ms, "", with unknown software capability 0x%"" INT64_T_FORMAT ""x"", (unsigned long long)cap_sf1) == -1) return -1; } return 0; } ",1 "void NTPResourceCache::CreateNewTabIncognitoHTML() { base::DictionaryValue localized_strings; localized_strings.SetString(""title"", l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); int new_tab_description_ids = IDS_NEW_TAB_OTR_DESCRIPTION; int new_tab_heading_ids = IDS_NEW_TAB_OTR_HEADING; int new_tab_link_ids = IDS_NEW_TAB_OTR_LEARN_MORE_LINK; int new_tab_warning_ids = IDS_NEW_TAB_OTR_MESSAGE_WARNING; int new_tab_html_idr = IDR_INCOGNITO_TAB_HTML; const char* new_tab_link = kLearnMoreIncognitoUrl; if (profile_->IsGuestSession()) { localized_strings.SetString(""guestTabDescription"", l10n_util::GetStringUTF16(new_tab_description_ids)); localized_strings.SetString(""guestTabHeading"", l10n_util::GetStringUTF16(new_tab_heading_ids)); } else { localized_strings.SetString(""incognitoTabDescription"", l10n_util::GetStringUTF16(new_tab_description_ids)); localized_strings.SetString(""incognitoTabHeading"", l10n_util::GetStringUTF16(new_tab_heading_ids)); localized_strings.SetString(""incognitoTabWarning"", l10n_util::GetStringUTF16(new_tab_warning_ids)); } localized_strings.SetString(""learnMore"", l10n_util::GetStringUTF16(new_tab_link_ids)); localized_strings.SetString(""learnMoreLink"", GetUrlWithLang(GURL(new_tab_link))); bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( prefs::kShowBookmarkBar); localized_strings.SetBoolean(""bookmarkbarattached"", bookmark_bar_attached); webui::SetFontAndTextDirection(&localized_strings); static const base::StringPiece incognito_tab_html( ResourceBundle::GetSharedInstance().GetRawDataResource( new_tab_html_idr)); std::string full_html = webui::GetI18nTemplateHtml( incognito_tab_html, &localized_strings); new_tab_incognito_html_ = base::RefCountedString::TakeString(&full_html); } ",0 "void WebPage::popupListClosed(int size, const bool* selecteds) { DeferredTaskPopupListSelectSingle::finishOrCancel(d); if (d->m_page->defersLoading()) { d->m_deferredTasks.append(adoptPtr(new DeferredTaskPopupListSelectMultiple(d, size, selecteds))); return; } DeferredTaskPopupListSelectMultiple::finishOrCancel(d); d->m_inputHandler->setPopupListIndexes(size, selecteds); } ",0 "static int skb_checksum_setup_ipv6(struct sk_buff *skb, bool recalculate) { int err; u8 nexthdr; unsigned int off; unsigned int len; bool fragment; bool done; fragment = false; done = false; off = sizeof(struct ipv6hdr); err = skb_maybe_pull_tail(skb, off, MAX_IPV6_HDR_LEN); if (err < 0) goto out; nexthdr = ipv6_hdr(skb)->nexthdr; len = sizeof(struct ipv6hdr) + ntohs(ipv6_hdr(skb)->payload_len); while (off <= len && !done) { switch (nexthdr) { case IPPROTO_DSTOPTS: case IPPROTO_HOPOPTS: case IPPROTO_ROUTING: { struct ipv6_opt_hdr *hp; err = skb_maybe_pull_tail(skb, off + sizeof(struct ipv6_opt_hdr), MAX_IPV6_HDR_LEN); if (err < 0) goto out; hp = OPT_HDR(struct ipv6_opt_hdr, skb, off); nexthdr = hp->nexthdr; off += ipv6_optlen(hp); break; } case IPPROTO_AH: { struct ip_auth_hdr *hp; err = skb_maybe_pull_tail(skb, off + sizeof(struct ip_auth_hdr), MAX_IPV6_HDR_LEN); if (err < 0) goto out; hp = OPT_HDR(struct ip_auth_hdr, skb, off); nexthdr = hp->nexthdr; off += ipv6_authlen(hp); break; } case IPPROTO_FRAGMENT: { struct frag_hdr *hp; err = skb_maybe_pull_tail(skb, off + sizeof(struct frag_hdr), MAX_IPV6_HDR_LEN); if (err < 0) goto out; hp = OPT_HDR(struct frag_hdr, skb, off); if (hp->frag_off & htons(IP6_OFFSET | IP6_MF)) fragment = true; nexthdr = hp->nexthdr; off += sizeof(struct frag_hdr); break; } default: done = true; break; } } err = -EPROTO; if (!done || fragment) goto out; switch (nexthdr) { case IPPROTO_TCP: err = skb_maybe_pull_tail(skb, off + sizeof(struct tcphdr), MAX_IPV6_HDR_LEN); if (err < 0) goto out; if (!skb_partial_csum_set(skb, off, offsetof(struct tcphdr, check))) { err = -EPROTO; goto out; } if (recalculate) tcp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, skb->len - off, IPPROTO_TCP, 0); break; case IPPROTO_UDP: err = skb_maybe_pull_tail(skb, off + sizeof(struct udphdr), MAX_IPV6_HDR_LEN); if (err < 0) goto out; if (!skb_partial_csum_set(skb, off, offsetof(struct udphdr, check))) { err = -EPROTO; goto out; } if (recalculate) udp_hdr(skb)->check = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, skb->len - off, IPPROTO_UDP, 0); break; default: goto out; } err = 0; out: return err; } ",0 "VOID NBLSetRSCInfo(PPARANDIS_ADAPTER pContext, PNET_BUFFER_LIST pNBL, PNET_PACKET_INFO PacketInfo, UINT nCoalescedSegments) { NDIS_TCP_IP_CHECKSUM_NET_BUFFER_LIST_INFO qCSInfo; qCSInfo.Value = NULL; qCSInfo.Receive.IpChecksumSucceeded = TRUE; qCSInfo.Receive.IpChecksumValueInvalid = TRUE; qCSInfo.Receive.TcpChecksumSucceeded = TRUE; qCSInfo.Receive.TcpChecksumValueInvalid = TRUE; NET_BUFFER_LIST_INFO(pNBL, TcpIpChecksumNetBufferListInfo) = qCSInfo.Value; NET_BUFFER_LIST_COALESCED_SEG_COUNT(pNBL) = (USHORT) nCoalescedSegments; NET_BUFFER_LIST_DUP_ACK_COUNT(pNBL) = 0; NdisInterlockedAddLargeStatistic(&pContext->RSC.Statistics.CoalescedOctets, PacketInfo->L2PayloadLen); NdisInterlockedAddLargeStatistic(&pContext->RSC.Statistics.CoalesceEvents, 1); NdisInterlockedAddLargeStatistic(&pContext->RSC.Statistics.CoalescedPkts, nCoalescedSegments); } ",0 "ModuleExport void UnregisterXWDImage(void) { (void) UnregisterMagickInfo(""XWD""); } ",0 "static int convertCompoundSelectToSubquery(Walker *pWalker, Select *p){ int i; Select *pNew; Select *pX; sqlite3 *db; struct ExprList_item *a; SrcList *pNewSrc; Parse *pParse; Token dummy; if( p->pPrior==0 ) return WRC_Continue; if( p->pOrderBy==0 ) return WRC_Continue; for(pX=p; pX && (pX->op==TK_ALL || pX->op==TK_SELECT); pX=pX->pPrior){} if( pX==0 ) return WRC_Continue; a = p->pOrderBy->a; for(i=p->pOrderBy->nExpr-1; i>=0; i--){ if( a[i].pExpr->flags & EP_Collate ) break; } if( i<0 ) return WRC_Continue; /* If we reach this point, that means the transformation is required. */ pParse = pWalker->pParse; db = pParse->db; pNew = sqlite3DbMallocZero(db, sizeof(*pNew) ); if( pNew==0 ) return WRC_Abort; memset(&dummy, 0, sizeof(dummy)); pNewSrc = sqlite3SrcListAppendFromTerm(pParse,0,0,0,&dummy,pNew,0,0); if( pNewSrc==0 ) return WRC_Abort; *pNew = *p; p->pSrc = pNewSrc; p->pEList = sqlite3ExprListAppend(pParse, 0, sqlite3Expr(db, TK_ASTERISK, 0)); p->op = TK_SELECT; p->pWhere = 0; pNew->pGroupBy = 0; pNew->pHaving = 0; pNew->pOrderBy = 0; p->pPrior = 0; p->pNext = 0; p->pWith = 0; p->selFlags &= ~SF_Compound; assert( (p->selFlags & SF_Converted)==0 ); p->selFlags |= SF_Converted; assert( pNew->pPrior!=0 ); pNew->pPrior->pNext = pNew; pNew->pLimit = 0; pNew->pOffset = 0; return WRC_Continue; } ",0 "static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld, uint8_t channels, uint8_t *tag) { ALIGN int16_t spec_data1[1024] = {0}; ALIGN int16_t spec_data2[1024] = {0}; element cpe = {0}; ic_stream *ics1 = &(cpe.ics1); ic_stream *ics2 = &(cpe.ics2); uint8_t result; cpe.channel = channels; cpe.paired_channel = channels+1; cpe.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG DEBUGVAR(1,39,""channel_pair_element(): element_instance_tag"")); *tag = cpe.element_instance_tag; if ((cpe.common_window = faad_get1bit(ld DEBUGVAR(1,40,""channel_pair_element(): common_window""))) & 1) { /* both channels have common ics information */ if ((result = ics_info(hDecoder, ics1, ld, cpe.common_window)) > 0) return result; ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2 DEBUGVAR(1,41,""channel_pair_element(): ms_mask_present"")); if (ics1->ms_mask_present == 3) { /* bitstream error */ return 32; } if (ics1->ms_mask_present == 1) { uint8_t g, sfb; for (g = 0; g < ics1->num_window_groups; g++) { for (sfb = 0; sfb < ics1->max_sfb; sfb++) { ics1->ms_used[g][sfb] = faad_get1bit(ld DEBUGVAR(1,42,""channel_pair_element(): faad_get1bit"")); } } } #ifdef ERROR_RESILIENCE if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) { if (( #ifdef LTP_DEC ics1->ltp.data_present = #endif faad_get1bit(ld DEBUGVAR(1,50,""channel_pair_element(): ltp.data_present""))) & 1) { #ifdef LTP_DEC if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0) { return result; } #else return 26; #endif } } #endif memcpy(ics2, ics1, sizeof(ic_stream)); } else { ics1->ms_mask_present = 0; } if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics1, 0, spec_data1)) > 0) { return result; } #ifdef ERROR_RESILIENCE if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present)) { if (( #ifdef LTP_DEC ics1->ltp2.data_present = #endif faad_get1bit(ld DEBUGVAR(1,50,""channel_pair_element(): ltp.data_present""))) & 1) { #ifdef LTP_DEC if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0) { return result; } #else return 26; #endif } } #endif if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2, 0, spec_data2)) > 0) { return result; } #ifdef SBR_DEC /* check if next bitstream element is a fill element */ /* if so, read it now so SBR decoding can be done in case of a file with SBR */ if (faad_showbits(ld, LEN_SE_ID) == ID_FIL) { faad_flushbits(ld, LEN_SE_ID); /* one sbr_info describes a channel_element not a channel! */ if ((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0) { return result; } } #endif /* noiseless coding is done, spectral reconstruction is done now */ if ((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe, spec_data1, spec_data2)) > 0) { return result; } return 0; } ",0 "static int ioapic_deliver(struct kvm_ioapic *ioapic, int irq) { union kvm_ioapic_redirect_entry *entry = &ioapic->redirtbl[irq]; struct kvm_lapic_irq irqe; ioapic_debug(""dest=%x dest_mode=%x delivery_mode=%x "" ""vector=%x trig_mode=%x\n"", entry->fields.dest_id, entry->fields.dest_mode, entry->fields.delivery_mode, entry->fields.vector, entry->fields.trig_mode); irqe.dest_id = entry->fields.dest_id; irqe.vector = entry->fields.vector; irqe.dest_mode = entry->fields.dest_mode; irqe.trig_mode = entry->fields.trig_mode; irqe.delivery_mode = entry->fields.delivery_mode << 8; irqe.level = 1; irqe.shorthand = 0; return kvm_irq_delivery_to_apic(ioapic->kvm, NULL, &irqe); } ",0 "static int i_ipmi_request(struct ipmi_user *user, struct ipmi_smi *intf, struct ipmi_addr *addr, long msgid, struct kernel_ipmi_msg *msg, void *user_msg_data, void *supplied_smi, struct ipmi_recv_msg *supplied_recv, int priority, unsigned char source_address, unsigned char source_lun, int retries, unsigned int retry_time_ms) { struct ipmi_smi_msg *smi_msg; struct ipmi_recv_msg *recv_msg; int rv = 0; if (supplied_recv) recv_msg = supplied_recv; else { recv_msg = ipmi_alloc_recv_msg(); if (recv_msg == NULL) { rv = -ENOMEM; goto out; } } recv_msg->user_msg_data = user_msg_data; if (supplied_smi) smi_msg = (struct ipmi_smi_msg *) supplied_smi; else { smi_msg = ipmi_alloc_smi_msg(); if (smi_msg == NULL) { ipmi_free_recv_msg(recv_msg); rv = -ENOMEM; goto out; } } rcu_read_lock(); if (intf->in_shutdown) { rv = -ENODEV; goto out_err; } recv_msg->user = user; if (user) /* The put happens when the message is freed. */ kref_get(&user->refcount); recv_msg->msgid = msgid; /* * Store the message to send in the receive message so timeout * responses can get the proper response data. */ recv_msg->msg = *msg; if (addr->addr_type == IPMI_SYSTEM_INTERFACE_ADDR_TYPE) { rv = i_ipmi_req_sysintf(intf, addr, msgid, msg, smi_msg, recv_msg, retries, retry_time_ms); } else if (is_ipmb_addr(addr) || is_ipmb_bcast_addr(addr)) { rv = i_ipmi_req_ipmb(intf, addr, msgid, msg, smi_msg, recv_msg, source_address, source_lun, retries, retry_time_ms); } else if (is_lan_addr(addr)) { rv = i_ipmi_req_lan(intf, addr, msgid, msg, smi_msg, recv_msg, source_lun, retries, retry_time_ms); } else { /* Unknown address type. */ ipmi_inc_stat(intf, sent_invalid_commands); rv = -EINVAL; } if (rv) { out_err: ipmi_free_smi_msg(smi_msg); ipmi_free_recv_msg(recv_msg); } else { ipmi_debug_msg(""Send"", smi_msg->data, smi_msg->data_size); smi_send(intf, intf->handlers, smi_msg, priority); } rcu_read_unlock(); out: return rv; } ",0 "get_tracer_for_array(struct trace_array *tr, struct tracer *t) { while (t && !trace_ok_for_array(t, tr)) t = t->next; return t; } ",0 "unsigned lodepng_read32bitInt(const unsigned char* buffer) { return (unsigned)((buffer[0] << 24) | (buffer[1] << 16) | (buffer[2] << 8) | buffer[3]); } ",0 "static M_fs_error_t M_fs_delete_dir(const char *path) { if (!RemoveDirectory(path)) { return M_fs_error_from_syserr(GetLastError()); } return M_FS_ERROR_SUCCESS; } ",0 " void testCrash_Report2418192() { helperTestQueryString(""http://svcs.cnn.com/weather/wrapper.jsp?&csiID=csi1"", 1); } ",0 "static int crypto_rfc4543_copy_src_to_dst(struct aead_request *req, bool enc) { struct crypto_aead *aead = crypto_aead_reqtfm(req); struct crypto_rfc4543_ctx *ctx = crypto_aead_ctx(aead); unsigned int authsize = crypto_aead_authsize(aead); unsigned int nbytes = req->cryptlen - (enc ? 0 : authsize); struct blkcipher_desc desc = { .tfm = ctx->null, }; return crypto_blkcipher_encrypt(&desc, req->dst, req->src, nbytes); } ",0 " void GpuProcessHost::CreateCommandBufferError( const CreateCommandBufferCallback& callback, int32 route_id) { callback.Run(route_id); } ",0 "static int h263_decode_gob_header(MpegEncContext *s) { unsigned int val, gob_number; int left; /* Check for GOB Start Code */ val = show_bits(&s->gb, 16); if(val) return -1; /* We have a GBSC probably with GSTUFF */ skip_bits(&s->gb, 16); /* Drop the zeros */ left= get_bits_left(&s->gb); for(;left>13; left--){ if(get_bits1(&s->gb)) break; /* Seek the '1' bit */ } if(left<=13) return -1; if(s->h263_slice_structured){ if(get_bits1(&s->gb)==0) return -1; ff_h263_decode_mba(s); if(s->mb_num > 1583) if(get_bits1(&s->gb)==0) return -1; s->qscale = get_bits(&s->gb, 5); /* SQUANT */ if(get_bits1(&s->gb)==0) return -1; skip_bits(&s->gb, 2); /* GFID */ }else{ gob_number = get_bits(&s->gb, 5); /* GN */ s->mb_x= 0; s->mb_y= s->gob_index* gob_number; skip_bits(&s->gb, 2); /* GFID */ s->qscale = get_bits(&s->gb, 5); /* GQUANT */ } if(s->mb_y >= s->mb_height) return -1; if(s->qscale==0) return -1; return 0; } ",0 "status_t Parcel::readFloat(float *pArg) const { return readAligned(pArg); } ",0 "static Status UpdateKeyGenerator(IndexedDBBackingStore* backing_store, IndexedDBTransaction* transaction, int64_t database_id, int64_t object_store_id, const IndexedDBKey& key, bool check_current) { DCHECK_EQ(blink::mojom::IDBKeyType::Number, key.type()); const double max_generator_value = 9007199254740992.0; int64_t value = base::saturated_cast( floor(std::min(key.number(), max_generator_value))); return backing_store->MaybeUpdateKeyGeneratorCurrentNumber( transaction->BackingStoreTransaction(), database_id, object_store_id, value + 1, check_current); } ",0 "derelativise_path(const char *path) { char *expanded, *ret, cwd[PATH_MAX]; if (strcasecmp(path, ""none"") == 0) return xstrdup(""none""); expanded = tilde_expand_filename(path, getuid()); if (*expanded == '/') return expanded; if (getcwd(cwd, sizeof(cwd)) == NULL) fatal(""%s: getcwd: %s"", __func__, strerror(errno)); xasprintf(&ret, ""%s/%s"", cwd, expanded); free(expanded); return ret; } ",0 "void CuePoint::Load(IMkvReader* pReader) { if (m_timecode >= 0) // already loaded return; assert(m_track_positions == NULL); assert(m_track_positions_count == 0); long long pos_ = -m_timecode; const long long element_start = pos_; long long stop; { long len; const long long id = ReadUInt(pReader, pos_, len); assert(id == 0x3B); // CuePoint ID if (id != 0x3B) return; pos_ += len; // consume ID const long long size = ReadUInt(pReader, pos_, len); assert(size >= 0); pos_ += len; // consume Size field stop = pos_ + size; } const long long element_size = stop - element_start; long long pos = pos_; while (pos < stop) { long len; const long long id = ReadUInt(pReader, pos, len); assert(id >= 0); // TODO assert((pos + len) <= stop); pos += len; // consume ID const long long size = ReadUInt(pReader, pos, len); assert(size >= 0); assert((pos + len) <= stop); pos += len; // consume Size field assert((pos + size) <= stop); if (id == 0x33) // CueTime ID m_timecode = UnserializeUInt(pReader, pos, size); else if (id == 0x37) // CueTrackPosition(s) ID ++m_track_positions_count; pos += size; // consume payload assert(pos <= stop); } assert(m_timecode >= 0); assert(m_track_positions_count > 0); m_track_positions = new TrackPosition[m_track_positions_count]; TrackPosition* p = m_track_positions; pos = pos_; while (pos < stop) { long len; const long long id = ReadUInt(pReader, pos, len); assert(id >= 0); // TODO assert((pos + len) <= stop); pos += len; // consume ID const long long size = ReadUInt(pReader, pos, len); assert(size >= 0); assert((pos + len) <= stop); pos += len; // consume Size field assert((pos + size) <= stop); if (id == 0x37) { // CueTrackPosition(s) ID TrackPosition& tp = *p++; tp.Parse(pReader, pos, size); } pos += size; // consume payload assert(pos <= stop); } assert(size_t(p - m_track_positions) == m_track_positions_count); m_element_start = element_start; m_element_size = element_size; } ",1 "static bool CalculateReachability(SCNetworkConnectionFlags flags) { bool reachable = flags & kSCNetworkFlagsReachable; bool connection_required = flags & kSCNetworkFlagsConnectionRequired; return reachable && !connection_required; } ",0 "static noinline void switch_commit_root(struct btrfs_root *root) { free_extent_buffer(root->commit_root); root->commit_root = btrfs_root_node(root); } ",0 "static void gcm_enc_copy_hash(struct aead_request *req, struct crypto_gcm_req_priv_ctx *pctx) { struct crypto_aead *aead = crypto_aead_reqtfm(req); u8 *auth_tag = pctx->auth_tag; scatterwalk_map_and_copy(auth_tag, req->dst, req->cryptlen, crypto_aead_authsize(aead), 1); } ",0 "status_t Parcel::readUtf8VectorFromUtf16Vector( std::unique_ptr>>* val) const { return readNullableTypedVector(val, &Parcel::readUtf8FromUtf16); } ",0 "PHP_METHOD(Phar, getSupportedCompression) { if (zend_parse_parameters_none() == FAILURE) { return; } array_init(return_value); phar_request_initialize(); if (PHAR_G(has_zlib)) { add_next_index_stringl(return_value, ""GZ"", 2); } if (PHAR_G(has_bz2)) { add_next_index_stringl(return_value, ""BZIP2"", 5); } } ",0 "String HTMLMediaElement::canPlayType(const String& mime_type) const { MIMETypeRegistry::SupportsType support = GetSupportsType(ContentType(mime_type)); String can_play; switch (support) { case MIMETypeRegistry::kIsNotSupported: can_play = g_empty_string; break; case MIMETypeRegistry::kMayBeSupported: can_play = ""maybe""; break; case MIMETypeRegistry::kIsSupported: can_play = ""probably""; break; } BLINK_MEDIA_LOG << ""canPlayType("" << (void*)this << "", "" << mime_type << "") -> "" << can_play; return can_play; } ",0 "XScopedImage::~XScopedImage() { reset(NULL); } ",0 "static inline int lookup_last(struct nameidata *nd, struct path *path) { if (nd->last_type == LAST_NORM && nd->last.name[nd->last.len]) nd->flags |= LOOKUP_FOLLOW | LOOKUP_DIRECTORY; nd->flags &= ~LOOKUP_PARENT; return walk_component(nd, path, nd->flags & LOOKUP_FOLLOW); } ",0 "unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf, unsigned char *limit, int *al) { int extdatalen = 0; unsigned char *orig = buf; unsigned char *ret = buf; #ifndef OPENSSL_NO_EC /* See if we support any ECC ciphersuites */ int using_ecc = 0; if (s->version >= TLS1_VERSION || SSL_IS_DTLS(s)) { int i; unsigned long alg_k, alg_a; STACK_OF(SSL_CIPHER) *cipher_stack = SSL_get_ciphers(s); for (i = 0; i < sk_SSL_CIPHER_num(cipher_stack); i++) { const SSL_CIPHER *c = sk_SSL_CIPHER_value(cipher_stack, i); alg_k = c->algorithm_mkey; alg_a = c->algorithm_auth; if ((alg_k & (SSL_kECDHE | SSL_kECDHEPSK)) || (alg_a & SSL_aECDSA)) { using_ecc = 1; break; } } } #endif ret += 2; if (ret >= limit) return NULL; /* this really never occurs, but ... */ /* Add RI if renegotiating */ if (s->renegotiate) { int el; if (!ssl_add_clienthello_renegotiate_ext(s, 0, &el, 0)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } if (CHECKLEN(ret, 4 + el, limit)) return NULL; s2n(TLSEXT_TYPE_renegotiate, ret); s2n(el, ret); if (!ssl_add_clienthello_renegotiate_ext(s, ret, &el, el)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } ret += el; } /* Only add RI for SSLv3 */ if (s->client_version == SSL3_VERSION) goto done; if (s->tlsext_hostname != NULL) { /* Add TLS extension servername to the Client Hello message */ size_t size_str; /*- * check for enough space. * 4 for the servername type and extension length * 2 for servernamelist length * 1 for the hostname type * 2 for hostname length * + hostname length */ size_str = strlen(s->tlsext_hostname); if (CHECKLEN(ret, 9 + size_str, limit)) return NULL; /* extension type and length */ s2n(TLSEXT_TYPE_server_name, ret); s2n(size_str + 5, ret); /* length of servername list */ s2n(size_str + 3, ret); /* hostname type, length and hostname */ *(ret++) = (unsigned char)TLSEXT_NAMETYPE_host_name; s2n(size_str, ret); memcpy(ret, s->tlsext_hostname, size_str); ret += size_str; } #ifndef OPENSSL_NO_SRP /* Add SRP username if there is one */ if (s->srp_ctx.login != NULL) { /* Add TLS extension SRP username to the * Client Hello message */ size_t login_len = strlen(s->srp_ctx.login); if (login_len > 255 || login_len == 0) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /*- * check for enough space. * 4 for the srp type type and extension length * 1 for the srp user identity * + srp user identity length */ if (CHECKLEN(ret, 5 + login_len, limit)) return NULL; /* fill in the extension */ s2n(TLSEXT_TYPE_srp, ret); s2n(login_len + 1, ret); (*ret++) = (unsigned char)login_len; memcpy(ret, s->srp_ctx.login, login_len); ret += login_len; } #endif #ifndef OPENSSL_NO_EC if (using_ecc) { /* * Add TLS extension ECPointFormats to the ClientHello message */ const unsigned char *pcurves, *pformats; size_t num_curves, num_formats, curves_list_len; size_t i; unsigned char *etmp; tls1_get_formatlist(s, &pformats, &num_formats); if (num_formats > 255) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /*- * check for enough space. * 4 bytes for the ec point formats type and extension length * 1 byte for the length of the formats * + formats length */ if (CHECKLEN(ret, 5 + num_formats, limit)) return NULL; s2n(TLSEXT_TYPE_ec_point_formats, ret); /* The point format list has 1-byte length. */ s2n(num_formats + 1, ret); *(ret++) = (unsigned char)num_formats; memcpy(ret, pformats, num_formats); ret += num_formats; /* * Add TLS extension EllipticCurves to the ClientHello message */ pcurves = s->tlsext_ellipticcurvelist; if (!tls1_get_curvelist(s, 0, &pcurves, &num_curves)) return NULL; if (num_curves > 65532 / 2) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /*- * check for enough space. * 4 bytes for the ec curves type and extension length * 2 bytes for the curve list length * + curve list length */ if (CHECKLEN(ret, 6 + (num_curves * 2), limit)) return NULL; s2n(TLSEXT_TYPE_elliptic_curves, ret); etmp = ret + 4; /* Copy curve ID if supported */ for (i = 0; i < num_curves; i++, pcurves += 2) { if (tls_curve_allowed(s, pcurves, SSL_SECOP_CURVE_SUPPORTED)) { *etmp++ = pcurves[0]; *etmp++ = pcurves[1]; } } curves_list_len = etmp - ret - 4; s2n(curves_list_len + 2, ret); s2n(curves_list_len, ret); ret += curves_list_len; } #endif /* OPENSSL_NO_EC */ if (tls_use_ticket(s)) { size_t ticklen; if (!s->new_session && s->session && s->session->tlsext_tick) ticklen = s->session->tlsext_ticklen; else if (s->session && s->tlsext_session_ticket && s->tlsext_session_ticket->data) { ticklen = s->tlsext_session_ticket->length; s->session->tlsext_tick = OPENSSL_malloc(ticklen); if (s->session->tlsext_tick == NULL) return NULL; memcpy(s->session->tlsext_tick, s->tlsext_session_ticket->data, ticklen); s->session->tlsext_ticklen = ticklen; } else ticklen = 0; if (ticklen == 0 && s->tlsext_session_ticket && s->tlsext_session_ticket->data == NULL) goto skip_ext; /* * Check for enough room 2 for extension type, 2 for len rest for * ticket */ if (CHECKLEN(ret, 4 + ticklen, limit)) return NULL; s2n(TLSEXT_TYPE_session_ticket, ret); s2n(ticklen, ret); if (ticklen > 0) { memcpy(ret, s->session->tlsext_tick, ticklen); ret += ticklen; } } skip_ext: if (SSL_CLIENT_USE_SIGALGS(s)) { size_t salglen; const unsigned char *salg; unsigned char *etmp; salglen = tls12_get_psigalgs(s, 1, &salg); /*- * check for enough space. * 4 bytes for the sigalgs type and extension length * 2 bytes for the sigalg list length * + sigalg list length */ if (CHECKLEN(ret, salglen + 6, limit)) return NULL; s2n(TLSEXT_TYPE_signature_algorithms, ret); etmp = ret; /* Skip over lengths for now */ ret += 4; salglen = tls12_copy_sigalgs(s, ret, salg, salglen); /* Fill in lengths */ s2n(salglen + 2, etmp); s2n(salglen, etmp); ret += salglen; } #ifndef OPENSSL_NO_OCSP if (s->tlsext_status_type == TLSEXT_STATUSTYPE_ocsp) { int i; size_t extlen, idlen; int lentmp; OCSP_RESPID *id; idlen = 0; for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) { id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i); lentmp = i2d_OCSP_RESPID(id, NULL); if (lentmp <= 0) return NULL; idlen += (size_t)lentmp + 2; } if (s->tlsext_ocsp_exts) { lentmp = i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, NULL); if (lentmp < 0) return NULL; extlen = (size_t)lentmp; } else extlen = 0; if (extlen + idlen > 0xFFF0) return NULL; /* * 2 bytes for status request type * 2 bytes for status request len * 1 byte for OCSP request type * 2 bytes for length of ids * 2 bytes for length of extensions * + length of ids * + length of extensions */ if (CHECKLEN(ret, 9 + idlen + extlen, limit)) return NULL; s2n(TLSEXT_TYPE_status_request, ret); s2n(extlen + idlen + 5, ret); *(ret++) = TLSEXT_STATUSTYPE_ocsp; s2n(idlen, ret); for (i = 0; i < sk_OCSP_RESPID_num(s->tlsext_ocsp_ids); i++) { /* save position of id len */ unsigned char *q = ret; id = sk_OCSP_RESPID_value(s->tlsext_ocsp_ids, i); /* skip over id len */ ret += 2; lentmp = i2d_OCSP_RESPID(id, &ret); /* write id len */ s2n(lentmp, q); } s2n(extlen, ret); if (extlen > 0) i2d_X509_EXTENSIONS(s->tlsext_ocsp_exts, &ret); } #endif #ifndef OPENSSL_NO_HEARTBEATS if (SSL_IS_DTLS(s)) { /* Add Heartbeat extension */ /*- * check for enough space. * 4 bytes for the heartbeat ext type and extension length * 1 byte for the mode */ if (CHECKLEN(ret, 5, limit)) return NULL; s2n(TLSEXT_TYPE_heartbeat, ret); s2n(1, ret); /*- * Set mode: * 1: peer may send requests * 2: peer not allowed to send requests */ if (s->tlsext_heartbeat & SSL_DTLSEXT_HB_DONT_RECV_REQUESTS) *(ret++) = SSL_DTLSEXT_HB_DONT_SEND_REQUESTS; else *(ret++) = SSL_DTLSEXT_HB_ENABLED; } #endif #ifndef OPENSSL_NO_NEXTPROTONEG if (s->ctx->next_proto_select_cb && !s->s3->tmp.finish_md_len) { /* * The client advertises an empty extension to indicate its support * for Next Protocol Negotiation */ /*- * check for enough space. * 4 bytes for the NPN ext type and extension length */ if (CHECKLEN(ret, 4, limit)) return NULL; s2n(TLSEXT_TYPE_next_proto_neg, ret); s2n(0, ret); } #endif /* * finish_md_len is non-zero during a renegotiation, so * this avoids sending ALPN during the renegotiation * (see longer comment below) */ if (s->alpn_client_proto_list && !s->s3->tmp.finish_md_len) { /*- * check for enough space. * 4 bytes for the ALPN type and extension length * 2 bytes for the ALPN protocol list length * + ALPN protocol list length */ if (CHECKLEN(ret, 6 + s->alpn_client_proto_list_len, limit)) return NULL; s2n(TLSEXT_TYPE_application_layer_protocol_negotiation, ret); s2n(2 + s->alpn_client_proto_list_len, ret); s2n(s->alpn_client_proto_list_len, ret); memcpy(ret, s->alpn_client_proto_list, s->alpn_client_proto_list_len); ret += s->alpn_client_proto_list_len; s->s3->alpn_sent = 1; } #ifndef OPENSSL_NO_SRTP if (SSL_IS_DTLS(s) && SSL_get_srtp_profiles(s)) { int el; /* Returns 0 on success!! */ if (ssl_add_clienthello_use_srtp_ext(s, 0, &el, 0)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } /*- * check for enough space. * 4 bytes for the SRTP type and extension length * + SRTP profiles length */ if (CHECKLEN(ret, 4 + el, limit)) return NULL; s2n(TLSEXT_TYPE_use_srtp, ret); s2n(el, ret); if (ssl_add_clienthello_use_srtp_ext(s, ret, &el, el)) { SSLerr(SSL_F_SSL_ADD_CLIENTHELLO_TLSEXT, ERR_R_INTERNAL_ERROR); return NULL; } ret += el; } #endif custom_ext_init(&s->cert->cli_ext); /* Add custom TLS Extensions to ClientHello */ if (!custom_ext_add(s, 0, &ret, limit, al)) return NULL; /* * In 1.1.0 before 1.1.0c we negotiated EtM with DTLS, then just * silently failed to actually do it. It is fixed in 1.1.1 but to * ease the transition especially from 1.1.0b to 1.1.0c, we just * disable it in 1.1.0. */ if (!SSL_IS_DTLS(s)) { /*- * check for enough space. * 4 bytes for the ETM type and extension length */ if (CHECKLEN(ret, 4, limit)) return NULL; s2n(TLSEXT_TYPE_encrypt_then_mac, ret); s2n(0, ret); } #ifndef OPENSSL_NO_CT if (s->ct_validation_callback != NULL) { /*- * check for enough space. * 4 bytes for the SCT type and extension length */ if (CHECKLEN(ret, 4, limit)) return NULL; s2n(TLSEXT_TYPE_signed_certificate_timestamp, ret); s2n(0, ret); } #endif /*- * check for enough space. * 4 bytes for the EMS type and extension length */ if (CHECKLEN(ret, 4, limit)) return NULL; s2n(TLSEXT_TYPE_extended_master_secret, ret); s2n(0, ret); /* * Add padding to workaround bugs in F5 terminators. See * https://tools.ietf.org/html/draft-agl-tls-padding-03 NB: because this * code works out the length of all existing extensions it MUST always * appear last. */ if (s->options & SSL_OP_TLSEXT_PADDING) { int hlen = ret - (unsigned char *)s->init_buf->data; if (hlen > 0xff && hlen < 0x200) { hlen = 0x200 - hlen; if (hlen >= 4) hlen -= 4; else hlen = 0; /*- * check for enough space. Strictly speaking we know we've already * got enough space because to get here the message size is < 0x200, * but we know that we've allocated far more than that in the buffer * - but for consistency and robustness we're going to check anyway. * * 4 bytes for the padding type and extension length * + padding length */ if (CHECKLEN(ret, 4 + hlen, limit)) return NULL; s2n(TLSEXT_TYPE_padding, ret); s2n(hlen, ret); memset(ret, 0, hlen); ret += hlen; } } done: if ((extdatalen = ret - orig - 2) == 0) return orig; s2n(extdatalen, orig); return ret; } ",0 " explicit PluginNetworkObserver(PpapiPluginProcessHost* process_host) : process_host_(process_host) { net::NetworkChangeNotifier::AddIPAddressObserver(this); net::NetworkChangeNotifier::AddConnectionTypeObserver(this); } ",0 "static int crypto_ccm_create_common(struct crypto_template *tmpl, struct rtattr **tb, const char *full_name, const char *ctr_name, const char *mac_name) { struct crypto_attr_type *algt; struct aead_instance *inst; struct skcipher_alg *ctr; struct crypto_alg *mac_alg; struct hash_alg_common *mac; struct ccm_instance_ctx *ictx; int err; algt = crypto_get_attr_type(tb); if (IS_ERR(algt)) return PTR_ERR(algt); if ((algt->type ^ CRYPTO_ALG_TYPE_AEAD) & algt->mask) return -EINVAL; mac_alg = crypto_find_alg(mac_name, &crypto_ahash_type, CRYPTO_ALG_TYPE_HASH, CRYPTO_ALG_TYPE_AHASH_MASK | CRYPTO_ALG_ASYNC); if (IS_ERR(mac_alg)) return PTR_ERR(mac_alg); mac = __crypto_hash_alg_common(mac_alg); err = -EINVAL; if (mac->digestsize != 16) goto out_put_mac; inst = kzalloc(sizeof(*inst) + sizeof(*ictx), GFP_KERNEL); err = -ENOMEM; if (!inst) goto out_put_mac; ictx = aead_instance_ctx(inst); err = crypto_init_ahash_spawn(&ictx->mac, mac, aead_crypto_instance(inst)); if (err) goto err_free_inst; crypto_set_skcipher_spawn(&ictx->ctr, aead_crypto_instance(inst)); err = crypto_grab_skcipher(&ictx->ctr, ctr_name, 0, crypto_requires_sync(algt->type, algt->mask)); if (err) goto err_drop_mac; ctr = crypto_spawn_skcipher_alg(&ictx->ctr); /* Not a stream cipher? */ err = -EINVAL; if (ctr->base.cra_blocksize != 1) goto err_drop_ctr; /* We want the real thing! */ if (crypto_skcipher_alg_ivsize(ctr) != 16) goto err_drop_ctr; err = -ENAMETOOLONG; if (snprintf(inst->alg.base.cra_driver_name, CRYPTO_MAX_ALG_NAME, ""ccm_base(%s,%s)"", ctr->base.cra_driver_name, mac->base.cra_driver_name) >= CRYPTO_MAX_ALG_NAME) goto err_drop_ctr; memcpy(inst->alg.base.cra_name, full_name, CRYPTO_MAX_ALG_NAME); inst->alg.base.cra_flags = ctr->base.cra_flags & CRYPTO_ALG_ASYNC; inst->alg.base.cra_priority = (mac->base.cra_priority + ctr->base.cra_priority) / 2; inst->alg.base.cra_blocksize = 1; inst->alg.base.cra_alignmask = mac->base.cra_alignmask | ctr->base.cra_alignmask; inst->alg.ivsize = 16; inst->alg.chunksize = crypto_skcipher_alg_chunksize(ctr); inst->alg.maxauthsize = 16; inst->alg.base.cra_ctxsize = sizeof(struct crypto_ccm_ctx); inst->alg.init = crypto_ccm_init_tfm; inst->alg.exit = crypto_ccm_exit_tfm; inst->alg.setkey = crypto_ccm_setkey; inst->alg.setauthsize = crypto_ccm_setauthsize; inst->alg.encrypt = crypto_ccm_encrypt; inst->alg.decrypt = crypto_ccm_decrypt; inst->free = crypto_ccm_free; err = aead_register_instance(tmpl, inst); if (err) goto err_drop_ctr; out_put_mac: crypto_mod_put(mac_alg); return err; err_drop_ctr: crypto_drop_skcipher(&ictx->ctr); err_drop_mac: crypto_drop_ahash(&ictx->mac); err_free_inst: kfree(inst); goto out_put_mac; } ",0 "void Document::setTitleElement(Element* titleElement) { if (m_titleElement && m_titleElement != titleElement) { if (isHTMLDocument() || isXHTMLDocument()) { m_titleElement = Traversal::firstWithin(*this); } else if (isSVGDocument()) { m_titleElement = Traversal::firstWithin(*this); } } else { m_titleElement = titleElement; } if (isHTMLTitleElement(m_titleElement)) updateTitle(toHTMLTitleElement(m_titleElement)->text()); else if (isSVGTitleElement(m_titleElement)) updateTitle(toSVGTitleElement(m_titleElement)->textContent()); } ",0 "static __init int rb_write_something(struct rb_test_data *data, bool nested) { struct ring_buffer_event *event; struct rb_item *item; bool started; int event_len; int size; int len; int cnt; /* Have nested writes different that what is written */ cnt = data->cnt + (nested ? 27 : 0); /* Multiply cnt by ~e, to make some unique increment */ size = (data->cnt * 68 / 25) % (sizeof(rb_string) - 1); len = size + sizeof(struct rb_item); started = rb_test_started; /* read rb_test_started before checking buffer enabled */ smp_rmb(); event = ring_buffer_lock_reserve(data->buffer, len); if (!event) { /* Ignore dropped events before test starts. */ if (started) { if (nested) data->bytes_dropped += len; else data->bytes_dropped_nested += len; } return len; } event_len = ring_buffer_event_length(event); if (RB_WARN_ON(data->buffer, event_len < len)) goto out; item = ring_buffer_event_data(event); item->size = size; memcpy(item->str, rb_string, size); if (nested) { data->bytes_alloc_nested += event_len; data->bytes_written_nested += len; data->events_nested++; if (!data->min_size_nested || len < data->min_size_nested) data->min_size_nested = len; if (len > data->max_size_nested) data->max_size_nested = len; } else { data->bytes_alloc += event_len; data->bytes_written += len; data->events++; if (!data->min_size || len < data->min_size) data->max_size = len; if (len > data->max_size) data->max_size = len; } out: ring_buffer_unlock_commit(data->buffer, event); return 0; } ",0 "bool SyncerProtoUtil::VerifyResponseBirthday(syncable::Directory* dir, const ClientToServerResponse* response) { std::string local_birthday = dir->store_birthday(); if (local_birthday.empty()) { if (!response->has_store_birthday()) { LOG(WARNING) << ""Expected a birthday on first sync.""; return false; } VLOG(1) << ""New store birthday: "" << response->store_birthday(); dir->set_store_birthday(response->store_birthday()); return true; } if (!response->has_store_birthday()) { LOG(WARNING) << ""No birthday in server response?""; return true; } if (response->store_birthday() != local_birthday) { LOG(WARNING) << ""Birthday changed, showing syncer stuck""; return false; } return true; } ",0 " void Alert(const base::string16& message) { alerts_.push_back(base::UTF16ToASCII(message)); } ",0 "SimpleLookup(struct xkb_context *ctx, const void *priv, xkb_atom_t field, enum expr_value_type type, unsigned int *val_rtrn) { const LookupEntry *entry; const char *str; if (!priv || field == XKB_ATOM_NONE || type != EXPR_TYPE_INT) return false; str = xkb_atom_text(ctx, field); for (entry = priv; entry && entry->name; entry++) { if (istreq(str, entry->name)) { *val_rtrn = entry->value; return true; } } return false; } ",0 "void LayerTreeHostImpl::BeginCommit() { TRACE_EVENT0(""cc"", ""LayerTreeHostImpl::BeginCommit""); if (compositor_frame_sink_) compositor_frame_sink_->ForceReclaimResources(); if (!CommitToActiveTree()) CreatePendingTree(); } ",0 "int parse_number(char *arg, int *res) { char *b; long number = strtol(arg, &b, 10); /* check for trailing junk after number */ if(*b != '\0') return 0; /* * check for strtol underflow or overflow in conversion. * Note: strtol can validly return LONG_MIN and LONG_MAX * if the user entered these values, but, additional code * to distinguish this scenario is unnecessary, because for * our purposes LONG_MIN and LONG_MAX are too large anyway */ if(number == LONG_MIN || number == LONG_MAX) return 0; /* reject negative numbers as invalid */ if(number < 0) return 0; /* check if long result will overflow signed int */ if(number > INT_MAX) return 0; *res = number; return 1; } ",0 "filesystem_info_cancel (NautilusDirectory *directory) { if (directory->details->filesystem_info_state != NULL) { g_cancellable_cancel (directory->details->filesystem_info_state->cancellable); directory->details->filesystem_info_state->directory = NULL; directory->details->filesystem_info_state = NULL; async_job_end (directory, ""filesystem info""); } } ",0 "static int padlock_sha_import_nano(struct shash_desc *desc, const void *in) { int statesize = crypto_shash_statesize(desc->tfm); void *sctx = shash_desc_ctx(desc); memcpy(sctx, in, statesize); return 0; } ",0 "OMX_ERRORTYPE omx_vdec::push_input_hevc(OMX_HANDLETYPE hComp) { OMX_U32 partial_frame = 1; unsigned long address,p2,id; OMX_BOOL isNewFrame = OMX_FALSE; OMX_BOOL generate_ebd = OMX_TRUE; OMX_ERRORTYPE rc = OMX_ErrorNone; if (h264_scratch.pBuffer == NULL) { DEBUG_PRINT_ERROR(""ERROR:Hevc Scratch Buffer not allocated""); return OMX_ErrorBadParameter; } DEBUG_PRINT_LOW(""h264_scratch.nFilledLen %u has look_ahead_nal %d \ pdest_frame nFilledLen %u nTimeStamp %lld"", (unsigned int)h264_scratch.nFilledLen, look_ahead_nal, (unsigned int)pdest_frame->nFilledLen, pdest_frame->nTimeStamp); if (h264_scratch.nFilledLen && look_ahead_nal) { look_ahead_nal = false; rc = copy_buffer(pdest_frame, &h264_scratch); if (rc != OMX_ErrorNone) { return rc; } } if (nal_length == 0) { 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) { m_hevc_utils.isNewFrame(&h264_scratch, 0, isNewFrame); nal_count++; } if (!isNewFrame) { DEBUG_PRINT_LOW(""Not a new frame, copy h264_scratch nFilledLen %u \ nTimestamp %lld, pdest_frame nFilledLen %u nTimestamp %lld"", (unsigned int)h264_scratch.nFilledLen, h264_scratch.nTimeStamp, (unsigned int)pdest_frame->nFilledLen, pdest_frame->nTimeStamp); rc = copy_buffer(pdest_frame, &h264_scratch); if (rc != OMX_ErrorNone) { return rc; } } else { look_ahead_nal = true; if (pdest_frame->nFilledLen == 0) { look_ahead_nal = false; DEBUG_PRINT_LOW(""dest nation buffer empty, copy scratch buffer""); rc = copy_buffer(pdest_frame, &h264_scratch); if (rc != OMX_ErrorNone) { return OMX_ErrorBadParameter; } } else { if (psource_frame->nFilledLen || h264_scratch.nFilledLen) { pdest_frame->nFlags &= ~OMX_BUFFERFLAG_EOS; } DEBUG_PRINT_LOW(""FrameDetected # %d pdest_frame nFilledLen %u \ nTimeStamp %lld, look_ahead_nal in h264_scratch \ nFilledLen %u nTimeStamp %lld"", frame_count++, (unsigned int)pdest_frame->nFilledLen, pdest_frame->nTimeStamp, (unsigned int)h264_scratch.nFilledLen, h264_scratch.nTimeStamp); 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(""psource_frame is partial nFilledLen %u nTimeStamp %lld, \ pdest_frame nFilledLen %u nTimeStamp %lld, h264_scratch \ nFilledLen %u nTimeStamp %lld"", (unsigned int)psource_frame->nFilledLen, psource_frame->nTimeStamp, (unsigned int)pdest_frame->nFilledLen, pdest_frame->nTimeStamp, (unsigned int)h264_scratch.nFilledLen, h264_scratch.nTimeStamp); 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""); rc = copy_buffer(pdest_frame, &h264_scratch); if ( rc != OMX_ErrorNone ) { return rc; } pdest_frame->nTimeStamp = h264_scratch.nTimeStamp; pdest_frame->nFlags = h264_scratch.nFlags | psource_frame->nFlags; DEBUG_PRINT_LOW(""Push EOS frame number:%d nFilledLen =%u TimeStamp = %lld"", frame_count, (unsigned int)pdest_frame->nFilledLen, pdest_frame->nTimeStamp); 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) { m_input_pending_q.pop_entry(&address, &p2, &id); psource_frame = (OMX_BUFFERHEADERTYPE *)address; DEBUG_PRINT_LOW(""Next source Buffer flag %u nFilledLen %u, nTimeStamp %lld"", (unsigned int)psource_frame->nFlags, (unsigned int)psource_frame->nFilledLen, psource_frame->nTimeStamp); } } return OMX_ErrorNone; } ",0 "static Image *ReadTXTImage(const ImageInfo *image_info,ExceptionInfo *exception) { char colorspace[MaxTextExtent], text[MaxTextExtent]; Image *image; IndexPacket *indexes; long type, x_offset, y, y_offset; MagickBooleanType status; MagickPixelPacket pixel; QuantumAny range; register ssize_t i, x; register PixelPacket *q; ssize_t count; unsigned long depth, height, max_value, width; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } (void) ResetMagickMemory(text,0,sizeof(text)); (void) ReadBlobString(image,text); if (LocaleNCompare((char *) text,MagickID,strlen(MagickID)) != 0) return(ReadTEXTImage(image_info,image,text,exception)); do { width=0; height=0; max_value=0; *colorspace='\0'; count=(ssize_t) sscanf(text+32,""%lu,%lu,%lu,%s"",&width,&height,&max_value, colorspace); if ((count != 4) || (width == 0) || (height == 0) || (max_value == 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); image->columns=width; image->rows=height; for (depth=1; (GetQuantumRange(depth)+1) < max_value; depth++) ; image->depth=depth; LocaleLower(colorspace); i=(ssize_t) strlen(colorspace)-1; image->matte=MagickFalse; if ((i > 0) && (colorspace[i] == 'a')) { colorspace[i]='\0'; image->matte=MagickTrue; } type=ParseCommandOption(MagickColorspaceOptions,MagickFalse,colorspace); if (type < 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); image->colorspace=(ColorspaceType) type; (void) ResetMagickMemory(&pixel,0,sizeof(pixel)); (void) SetImageBackgroundColor(image); range=GetQuantumRange(image->depth); for (y=0; y < (ssize_t) image->rows; y++) { double blue, green, index, opacity, red; red=0.0; green=0.0; blue=0.0; index=0.0; opacity=0.0; for (x=0; x < (ssize_t) image->columns; x++) { if (ReadBlobString(image,text) == (char *) NULL) break; switch (image->colorspace) { case GRAYColorspace: { if (image->matte != MagickFalse) { count=(ssize_t) sscanf(text,""%ld,%ld: (%lf%*[%,]%lf%*[%,]"", &x_offset,&y_offset,&red,&opacity); green=red; blue=red; break; } count=(ssize_t) sscanf(text,""%ld,%ld: (%lf%*[%,]"",&x_offset, &y_offset,&red); green=red; blue=red; break; } case CMYKColorspace: { if (image->matte != MagickFalse) { count=(ssize_t) sscanf(text, ""%ld,%ld: (%lf%*[%,]%lf%*[%,]%lf%*[%,]%lf%*[%,]%lf%*[%,]"", &x_offset,&y_offset,&red,&green,&blue,&index,&opacity); break; } count=(ssize_t) sscanf(text, ""%ld,%ld: (%lf%*[%,]%lf%*[%,]%lf%*[%,]%lf%*[%,]"",&x_offset, &y_offset,&red,&green,&blue,&index); break; } default: { if (image->matte != MagickFalse) { count=(ssize_t) sscanf(text, ""%ld,%ld: (%lf%*[%,]%lf%*[%,]%lf%*[%,]%lf%*[%,]"", &x_offset,&y_offset,&red,&green,&blue,&opacity); break; } count=(ssize_t) sscanf(text, ""%ld,%ld: (%lf%*[%,]%lf%*[%,]%lf%*[%,]"",&x_offset,&y_offset, &red,&green,&blue); break; } } if (strchr(text,'%') != (char *) NULL) { red*=0.01*range; green*=0.01*range; blue*=0.01*range; index*=0.01*range; opacity*=0.01*range; } if (image->colorspace == LabColorspace) { green+=(range+1)/2.0; blue+=(range+1)/2.0; } pixel.red=ScaleAnyToQuantum((QuantumAny) (red+0.5),range); pixel.green=ScaleAnyToQuantum((QuantumAny) (green+0.5),range); pixel.blue=ScaleAnyToQuantum((QuantumAny) (blue+0.5),range); pixel.index=ScaleAnyToQuantum((QuantumAny) (index+0.5),range); pixel.opacity=ScaleAnyToQuantum((QuantumAny) (opacity+0.5),range); q=GetAuthenticPixels(image,x_offset,y_offset,1,1,exception); if (q == (PixelPacket *) NULL) continue; SetPixelRed(q,pixel.red); SetPixelGreen(q,pixel.green); SetPixelBlue(q,pixel.blue); if (image->colorspace == CMYKColorspace) { indexes=GetAuthenticIndexQueue(image); SetPixelIndex(indexes,pixel.index); } if (image->matte != MagickFalse) SetPixelAlpha(q,pixel.opacity); if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } } (void) ReadBlobString(image,text); if (LocaleNCompare((char *) text,MagickID,strlen(MagickID)) == 0) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (LocaleNCompare((char *) text,MagickID,strlen(MagickID)) == 0); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "void LocalSiteCharacteristicsDataImpl::NotifyLoadedSiteBackgrounded() { if (loaded_tabs_in_background_count_ == 0) background_session_begin_ = NowTicks(); loaded_tabs_in_background_count_++; DCHECK_LE(loaded_tabs_in_background_count_, loaded_tabs_count_); } ",0 "void OmniboxViewWin::RevertAll() { ScopedFreeze freeze(this, GetTextObjectModel()); ClosePopup(); model_->Revert(); saved_selection_for_focus_change_.cpMin = -1; TextChanged(); } ",0 "static void serial_update_irq(SerialState *s) { uint8_t tmp_iir = UART_IIR_NO_INT; if ((s->ier & UART_IER_RLSI) && (s->lsr & UART_LSR_INT_ANY)) { tmp_iir = UART_IIR_RLSI; } else if ((s->ier & UART_IER_RDI) && s->timeout_ipending) { /* Note that(s->ier & UART_IER_RDI) can mask this interrupt, * this is not in the specification but is observed on existing * hardware. */ tmp_iir = UART_IIR_CTI; } else if ((s->ier & UART_IER_RDI) && (s->lsr & UART_LSR_DR) && (!(s->fcr & UART_FCR_FE) || s->recv_fifo.num >= s->recv_fifo_itl)) { tmp_iir = UART_IIR_RDI; } else if ((s->ier & UART_IER_THRI) && s->thr_ipending) { tmp_iir = UART_IIR_THRI; } else if ((s->ier & UART_IER_MSI) && (s->msr & UART_MSR_ANY_DELTA)) { tmp_iir = UART_IIR_MSI; } s->iir = tmp_iir | (s->iir & 0xF0); if (tmp_iir != UART_IIR_NO_INT) { qemu_irq_raise(s->irq); } else { qemu_irq_lower(s->irq); } } ",0 "String HTMLDocument::designMode() const { return inDesignMode() ? ""on"" : ""off""; } ",0 "void ServiceWorkerPaymentInstrument::ValidateCanMakePayment( ValidateCanMakePaymentCallback callback) { if (needs_installation_) { OnCanMakePaymentEventSkipped(std::move(callback)); return; } if (payment_request_delegate_->IsIncognito()) { OnCanMakePaymentEventSkipped(std::move(callback)); return; } if (!stored_payment_app_info_->has_explicitly_verified_methods) { OnCanMakePaymentEventSkipped(std::move(callback)); return; } mojom::CanMakePaymentEventDataPtr event_data = CreateCanMakePaymentEventData(); if (event_data.is_null()) { OnCanMakePaymentEventSkipped(std::move(callback)); return; } content::PaymentAppProvider::GetInstance()->CanMakePayment( browser_context_, stored_payment_app_info_->registration_id, std::move(event_data), base::BindOnce( &ServiceWorkerPaymentInstrument::OnCanMakePaymentEventResponded, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } ",0 "static int mdio_uevent(struct device *dev, struct kobj_uevent_env *env) { int rc; /* Some devices have extra OF data and an OF-style MODALIAS */ rc = of_device_uevent_modalias(dev, env); if (rc != -ENODEV) return rc; return 0; } ",0 "static void StringMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8SetReturnValueString(info, impl->stringMethod(), info.GetIsolate()); } ",0 "node_is_unreliable(const node_t *node, int need_uptime, int need_capacity, int need_guard) { if (need_uptime && !node->is_stable) return 1; if (need_capacity && !node->is_fast) return 1; if (need_guard && !node->is_possible_guard) return 1; return 0; } ",0 "static ssize_t map_addr_show(struct uio_mem *mem, char *buf) { return sprintf(buf, ""0x%llx\n"", (unsigned long long)mem->addr); } ",0 "void DesktopWindowTreeHostX11::Init(const Widget::InitParams& params) { activatable_ = (params.activatable == Widget::InitParams::ACTIVATABLE_YES); if (params.type == Widget::InitParams::TYPE_WINDOW) content_window()->SetProperty(aura::client::kAnimationsDisabledKey, true); Widget::InitParams sanitized_params = params; if (sanitized_params.bounds.width() == 0) sanitized_params.bounds.set_width(100); if (sanitized_params.bounds.height() == 0) sanitized_params.bounds.set_height(100); InitX11Window(sanitized_params); InitHost(); window()->Show(); } ",0 "bool JingleSessionManager::WriteContent( cricket::SignalingProtocol protocol, const cricket::ContentDescription* content, XmlElement** elem, cricket::WriteError* error) { const ContentDescription* desc = static_cast(content); *elem = desc->ToXml(); return true; } ",0 "bool Browser::CanBookmarkAllTabs() const { BookmarkModel* model = profile()->GetBookmarkModel(); return (model && model->IsLoaded() && (tab_count() > 1)); } ",0 "PickerIndicatorElement* BaseMultipleFieldsDateAndTimeInputType::pickerIndicatorElement() const { return toPickerIndicatorElement(elementById(ShadowElementNames::pickerIndicator())); } ",0 "void RecordSeedStoreHistogram(VariationsSeedStoreResult result) { UMA_HISTOGRAM_ENUMERATION(""Variations.SeedStoreResult"", result, VARIATIONS_SEED_STORE_RESULT_ENUM_SIZE); } ",0 "int vfs_unlink(struct inode *dir, struct dentry *dentry, struct inode **delegated_inode) { struct inode *target = dentry->d_inode; int error = may_delete(dir, dentry, 0); if (error) return error; if (!dir->i_op->unlink) return -EPERM; mutex_lock(&target->i_mutex); if (d_mountpoint(dentry)) error = -EBUSY; else { error = security_inode_unlink(dir, dentry); if (!error) { error = try_break_deleg(target, delegated_inode); if (error) goto out; error = dir->i_op->unlink(dir, dentry); if (!error) dont_mount(dentry); } } out: mutex_unlock(&target->i_mutex); /* We don't d_delete() NFS sillyrenamed files--they still exist. */ if (!error && !(dentry->d_flags & DCACHE_NFSFS_RENAMED)) { fsnotify_link_count(target); d_delete(dentry); } return error; } ",0 "DevToolsDataSource::~DevToolsDataSource() { for (const auto& pair : pending_) { delete pair.first; pair.second.Run( new base::RefCountedStaticMemory(kHttpNotFound, strlen(kHttpNotFound))); } } ",0 "void ManifestManager::OnDestruct() {} ",0 " void SetUpColoredUnitQuad(const GLfloat* color) { GLuint program1 = SetupColoredVertexProgram(); GLuint position_loc1 = glGetAttribLocation(program1, ""a_position""); GLuint color_loc1 = glGetAttribLocation(program1, ""a_color""); GLTestHelper::SetupUnitQuad(position_loc1); GLTestHelper::SetupColorsForUnitQuad(color_loc1, color, GL_STATIC_DRAW); } ",0 "posix_acl_alloc(int count, gfp_t flags) { const size_t size = sizeof(struct posix_acl) + count * sizeof(struct posix_acl_entry); struct posix_acl *acl = kmalloc(size, flags); if (acl) posix_acl_init(acl, count); return acl; } ",0 "and_cclass(CClassNode* dest, CClassNode* cc, OnigEncoding enc) { int r, not1, not2; BBuf *buf1, *buf2, *pbuf; BitSetRef bsr1, bsr2; BitSet bs1, bs2; not1 = IS_NCCLASS_NOT(dest); bsr1 = dest->bs; buf1 = dest->mbuf; not2 = IS_NCCLASS_NOT(cc); bsr2 = cc->bs; buf2 = cc->mbuf; if (not1 != 0) { bitset_invert_to(bsr1, bs1); bsr1 = bs1; } if (not2 != 0) { bitset_invert_to(bsr2, bs2); bsr2 = bs2; } bitset_and(bsr1, bsr2); if (bsr1 != dest->bs) { bitset_copy(dest->bs, bsr1); bsr1 = dest->bs; } if (not1 != 0) { bitset_invert(dest->bs); } if (! ONIGENC_IS_SINGLEBYTE(enc)) { if (not1 != 0 && not2 != 0) { r = or_code_range_buf(enc, buf1, 0, buf2, 0, &pbuf); } else { r = and_code_range_buf(buf1, not1, buf2, not2, &pbuf); if (r == 0 && not1 != 0) { BBuf *tbuf; r = not_code_range_buf(enc, pbuf, &tbuf); if (r != 0) { bbuf_free(pbuf); return r; } bbuf_free(pbuf); pbuf = tbuf; } } if (r != 0) return r; dest->mbuf = pbuf; bbuf_free(buf1); return r; } return 0; } ",0 "uint64_t norm_mig_pages_transferred(void) { return acct_info.norm_pages; } ",0 "xsltApplyTemplatesComp(xsltStylesheetPtr style, xmlNodePtr inst) { #ifdef XSLT_REFACTORED xsltStyleItemApplyTemplatesPtr comp; #else xsltStylePreCompPtr comp; #endif if ((style == NULL) || (inst == NULL) || (inst->type != XML_ELEMENT_NODE)) return; #ifdef XSLT_REFACTORED comp = (xsltStyleItemApplyTemplatesPtr) xsltNewStylePreComp(style, XSLT_FUNC_APPLYTEMPLATES); #else comp = xsltNewStylePreComp(style, XSLT_FUNC_APPLYTEMPLATES); #endif if (comp == NULL) return; inst->psvi = comp; comp->inst = inst; /* * Attribute ""mode"". */ xsltGetQNameProperty(style, inst, BAD_CAST ""mode"", 0, NULL, &(comp->modeURI), &(comp->mode)); /* * Attribute ""select"". */ comp->select = xsltGetCNsProp(style, inst, BAD_CAST ""select"", XSLT_NAMESPACE); if (comp->select != NULL) { comp->comp = xsltXPathCompile(style, comp->select); if (comp->comp == NULL) { xsltTransformError(NULL, style, inst, ""XSLT-apply-templates: could not compile select "" ""expression '%s'\n"", comp->select); style->errors++; } } /* TODO: handle (or skip) the xsl:sort and xsl:with-param */ } ",0 "void ResourceFetcher::ResourceTimingReportTimerFired(TimerBase* timer) { DCHECK_EQ(timer, &resource_timing_report_timer_); Vector> timing_reports; timing_reports.Swap(scheduled_resource_timing_reports_); for (const auto& timing_info : timing_reports) Context().AddResourceTiming(*timing_info); } ",0 "static int get_user_page_nowait(unsigned long start, int write, struct page **page) { int flags = FOLL_NOWAIT | FOLL_HWPOISON; if (write) flags |= FOLL_WRITE; return get_user_pages(start, 1, flags, page, NULL); } ",0 "static void brcmf_update_vht_cap(struct ieee80211_supported_band *band, u32 bw_cap[2], u32 nchain, u32 txstreams, u32 txbf_bfe_cap, u32 txbf_bfr_cap) { __le16 mcs_map; /* not allowed in 2.4G band */ if (band->band == NL80211_BAND_2GHZ) return; band->vht_cap.vht_supported = true; /* 80MHz is mandatory */ band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_80; if (bw_cap[band->band] & WLC_BW_160MHZ_BIT) { band->vht_cap.cap |= IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ; band->vht_cap.cap |= IEEE80211_VHT_CAP_SHORT_GI_160; } /* all support 256-QAM */ mcs_map = brcmf_get_mcs_map(nchain, IEEE80211_VHT_MCS_SUPPORT_0_9); band->vht_cap.vht_mcs.rx_mcs_map = mcs_map; band->vht_cap.vht_mcs.tx_mcs_map = mcs_map; /* Beamforming support information */ if (txbf_bfe_cap & BRCMF_TXBF_SU_BFE_CAP) band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE; if (txbf_bfe_cap & BRCMF_TXBF_MU_BFE_CAP) band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE; if (txbf_bfr_cap & BRCMF_TXBF_SU_BFR_CAP) band->vht_cap.cap |= IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE; if (txbf_bfr_cap & BRCMF_TXBF_MU_BFR_CAP) band->vht_cap.cap |= IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE; if ((txbf_bfe_cap || txbf_bfr_cap) && (txstreams > 1)) { band->vht_cap.cap |= (2 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT); band->vht_cap.cap |= ((txstreams - 1) << IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT); band->vht_cap.cap |= IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB; } } ",0 "void RilSapSocket::sOnRequestComplete (RIL_Token t, RIL_Errno e, void *response, size_t responselen) { RilSapSocket *sap_socket; SapSocketRequest *request = (SapSocketRequest*) t; RLOGD(""Socket id:%d"", request->socketId); sap_socket = getSocketById(request->socketId); if (sap_socket) { sap_socket->onRequestComplete(t,e,response,responselen); } else { RLOGE(""Invalid socket id""); if (request->curr->payload) { free(request->curr->payload); } free(request->curr); free(request); } } ",0 "unsigned PixelBufferRasterWorkerPool::PendingRasterTaskCount() const { unsigned num_completed_raster_tasks = tasks_with_pending_upload_.size() + completed_tasks_.size(); DCHECK_GE(pixel_buffer_tasks_.size(), num_completed_raster_tasks); return pixel_buffer_tasks_.size() - num_completed_raster_tasks; } ",0 "kg_seal(minor_status, context_handle, conf_req_flag, qop_req, input_message_buffer, conf_state, output_message_buffer, toktype) OM_uint32 *minor_status; gss_ctx_id_t context_handle; int conf_req_flag; gss_qop_t qop_req; gss_buffer_t input_message_buffer; int *conf_state; gss_buffer_t output_message_buffer; int toktype; { krb5_gss_ctx_id_rec *ctx; krb5_error_code code; krb5_context context; output_message_buffer->length = 0; output_message_buffer->value = NULL; /* Only default qop or matching established cryptosystem is allowed. There are NO EXTENSIONS to this set for AES and friends! The new spec says ""just use 0"". The old spec plus extensions would actually allow for certain non-zero values. Fix this to handle them later. */ if (qop_req != 0) { *minor_status = (OM_uint32) G_UNKNOWN_QOP; return GSS_S_FAILURE; } ctx = (krb5_gss_ctx_id_rec *) context_handle; if (! ctx->established) { *minor_status = KG_CTX_INCOMPLETE; return(GSS_S_NO_CONTEXT); } context = ctx->k5_context; switch (ctx->proto) { case 0: code = make_seal_token_v1(context, ctx->enc, ctx->seq, &ctx->seq_send, ctx->initiate, input_message_buffer, output_message_buffer, ctx->signalg, ctx->cksum_size, ctx->sealalg, conf_req_flag, toktype, ctx->mech_used); break; case 1: code = gss_krb5int_make_seal_token_v3(context, ctx, input_message_buffer, output_message_buffer, conf_req_flag, toktype); break; default: code = G_UNKNOWN_QOP; /* XXX */ break; } if (code) { *minor_status = code; save_error_info(*minor_status, context); return(GSS_S_FAILURE); } if (conf_state) *conf_state = conf_req_flag; *minor_status = 0; return(GSS_S_COMPLETE); } ",1 "static void __free_ftrace_hash_rcu(struct rcu_head *rcu) { struct ftrace_hash *hash; hash = container_of(rcu, struct ftrace_hash, rcu); free_ftrace_hash(hash); } ",0 "entry_guard_consider_retry(entry_guard_t *guard) { if (guard->is_reachable != GUARD_REACHABLE_NO) return; /* No retry needed. */ const time_t now = approx_time(); const int delay = get_retry_schedule(guard->failing_since, now, guard->is_primary); const time_t last_attempt = guard->last_tried_to_connect; if (BUG(last_attempt == 0) || now >= last_attempt + delay) { /* We should mark this retriable. */ char tbuf[ISO_TIME_LEN+1]; format_local_iso_time(tbuf, last_attempt); log_info(LD_GUARD, ""Marked %s%sguard %s for possible retry, since we "" ""haven't tried to use it since %s."", guard->is_primary?""primary "":"""", guard->confirmed_idx>=0?""confirmed "":"""", entry_guard_describe(guard), tbuf); guard->is_reachable = GUARD_REACHABLE_MAYBE; if (guard->is_filtered_guard) guard->is_usable_filtered_guard = 1; } } ",0 "static int sco_sock_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; int len, err = 0; BT_DBG(""sk %p"", sk); if (level == SOL_SCO) return sco_sock_getsockopt_old(sock, optname, optval, optlen); if (get_user(len, optlen)) return -EFAULT; lock_sock(sk); switch (optname) { default: err = -ENOPROTOOPT; break; } release_sock(sk); return err; } ",0 "static int nfs4_proc_lookupfh(struct nfs_server *server, struct nfs_fh *dirfh, struct qstr *name, struct nfs_fh *fhandle, struct nfs_fattr *fattr) { struct nfs4_exception exception = { }; int err; do { err = _nfs4_proc_lookupfh(server, dirfh, name, fhandle, fattr); /* FIXME: !!!! */ if (err == -NFS4ERR_MOVED) { err = -EREMOTE; break; } err = nfs4_handle_exception(server, err, &exception); } while (exception.retry); return err; } ",0 " FromMojom(media::mojom::VideoFacingMode input, media::VideoFacingMode* output) { switch (input) { case media::mojom::VideoFacingMode::NONE: *output = media::VideoFacingMode::MEDIA_VIDEO_FACING_NONE; return true; case media::mojom::VideoFacingMode::USER: *output = media::VideoFacingMode::MEDIA_VIDEO_FACING_USER; return true; case media::mojom::VideoFacingMode::ENVIRONMENT: *output = media::VideoFacingMode::MEDIA_VIDEO_FACING_ENVIRONMENT; return true; } NOTREACHED(); return false; } ",0 "bool FrameLoader::closeURL() { history()->saveDocumentState(); Document* currentDocument = m_frame->document(); stopLoading(currentDocument && !currentDocument->inPageCache() ? UnloadEventPolicyUnloadAndPageHide : UnloadEventPolicyUnloadOnly); m_frame->editor()->clearUndoRedoOperations(); return true; } ",0 "String MixedContentTypeForContextType(WebMixedContentContextType context_type) { switch (context_type) { case WebMixedContentContextType::kNotMixedContent: return protocol::Security::MixedContentTypeEnum::None; case WebMixedContentContextType::kBlockable: return protocol::Security::MixedContentTypeEnum::Blockable; case WebMixedContentContextType::kOptionallyBlockable: case WebMixedContentContextType::kShouldBeBlockable: return protocol::Security::MixedContentTypeEnum::OptionallyBlockable; } return protocol::Security::MixedContentTypeEnum::None; } ",0 "PHP_FUNCTION(openssl_pkey_export_to_file) { struct php_x509_request req; zval ** zpkey, * args = NULL; char * passphrase = NULL; int passphrase_len = 0; char * filename = NULL; int filename_len = 0; long key_resource = -1; EVP_PKEY * key; BIO * bio_out = NULL; const EVP_CIPHER * cipher; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""Zs|s!a!"", &zpkey, &filename, &filename_len, &passphrase, &passphrase_len, &args) == FAILURE) { return; } RETVAL_FALSE; if (strlen(filename) != filename_len) { return; } key = php_openssl_evp_from_zval(zpkey, 0, passphrase, 0, &key_resource TSRMLS_CC); if (key == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""cannot get key from parameter 1""); RETURN_FALSE; } if (php_openssl_safe_mode_chk(filename TSRMLS_CC)) { RETURN_FALSE; } PHP_SSL_REQ_INIT(&req); if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) { bio_out = BIO_new_file(filename, ""w""); if (passphrase && req.priv_key_encrypt) { cipher = (EVP_CIPHER *) EVP_des_ede3_cbc(); } else { cipher = NULL; } if (PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, passphrase_len, NULL, NULL)) { /* Success! * If returning the output as a string, do so now */ RETVAL_TRUE; } } PHP_SSL_REQ_DISPOSE(&req); if (key_resource == -1 && key) { EVP_PKEY_free(key); } if (bio_out) { BIO_free(bio_out); } } ",0 "static int lua_ap_module_info(lua_State *L) { const char *moduleName; module *mod; luaL_checktype(L, 1, LUA_TSTRING); moduleName = lua_tostring(L, 1); mod = ap_find_linked_module(moduleName); if (mod && mod->cmds) { const command_rec *cmd; lua_newtable(L); lua_pushstring(L, ""commands""); lua_newtable(L); for (cmd = mod->cmds; cmd->name; ++cmd) { lua_pushstring(L, cmd->name); lua_pushstring(L, cmd->errmsg); lua_settable(L, -3); } lua_settable(L, -3); return 1; } return 0; } ",0 "static int readfull(AVFormatContext *s, AVIOContext *pb, uint8_t *dst, int n) { int ret = avio_read(pb, dst, n); if (ret != n) { if (ret >= 0) memset(dst + ret, 0, n - ret); else memset(dst , 0, n); av_log(s, AV_LOG_ERROR, ""Failed to fully read block\n""); } return ret; } ",0 "long long Block::GetTrackNumber() const { return m_track; } ",1 "unsigned int SSL_SESSION_get_compress_id(const SSL_SESSION *s) { return s->compress_meth; } ",0 "void ff_reset_entries(AVCodecContext *avctx) { } ",0 "void RegisterOptimizationHintsComponent(ComponentUpdateService* cus, PrefService* profile_prefs) { if (!previews::params::IsOptimizationHintsEnabled()) { return; } bool data_saver_enabled = base::CommandLine::ForCurrentProcess()->HasSwitch( data_reduction_proxy::switches::kEnableDataReductionProxy) || (profile_prefs && profile_prefs->GetBoolean( data_reduction_proxy::prefs::kDataSaverEnabled)); if (!data_saver_enabled) return; auto installer = base::MakeRefCounted( std::make_unique()); installer->Register(cus, base::OnceClosure()); } ",1 "static int f2fs_drop_inode(struct inode *inode) { int ret; /* * This is to avoid a deadlock condition like below. * writeback_single_inode(inode) * - f2fs_write_data_page * - f2fs_gc -> iput -> evict * - inode_wait_for_writeback(inode) */ if ((!inode_unhashed(inode) && inode->i_state & I_SYNC)) { if (!inode->i_nlink && !is_bad_inode(inode)) { /* to avoid evict_inode call simultaneously */ atomic_inc(&inode->i_count); spin_unlock(&inode->i_lock); /* some remained atomic pages should discarded */ if (f2fs_is_atomic_file(inode)) drop_inmem_pages(inode); /* should remain fi->extent_tree for writepage */ f2fs_destroy_extent_node(inode); sb_start_intwrite(inode->i_sb); f2fs_i_size_write(inode, 0); if (F2FS_HAS_BLOCKS(inode)) f2fs_truncate(inode); sb_end_intwrite(inode->i_sb); fscrypt_put_encryption_info(inode, NULL); spin_lock(&inode->i_lock); atomic_dec(&inode->i_count); } trace_f2fs_drop_inode(inode, 0); return 0; } ret = generic_drop_inode(inode); trace_f2fs_drop_inode(inode, ret); return ret; } ",0 "void BackgroundLoaderOffliner::DocumentAvailableInMainFrame() { is_low_bar_met_ = true; AddLoadingSignal(""DocumentAvailableInMainFrame""); } ",0 "static TEE_Result get_open_session_meta(size_t num_params, struct optee_msg_param *params, size_t *num_meta, TEE_UUID *uuid, TEE_Identity *clnt_id) { const uint32_t req_attr = OPTEE_MSG_ATTR_META | OPTEE_MSG_ATTR_TYPE_VALUE_INPUT; if (num_params < 2) return TEE_ERROR_BAD_PARAMETERS; if (params[0].attr != req_attr || params[1].attr != req_attr) return TEE_ERROR_BAD_PARAMETERS; tee_uuid_from_octets(uuid, (void *)¶ms[0].u.value); clnt_id->login = params[1].u.value.c; switch (clnt_id->login) { case TEE_LOGIN_PUBLIC: memset(&clnt_id->uuid, 0, sizeof(clnt_id->uuid)); break; case TEE_LOGIN_USER: case TEE_LOGIN_GROUP: case TEE_LOGIN_APPLICATION: case TEE_LOGIN_APPLICATION_USER: case TEE_LOGIN_APPLICATION_GROUP: tee_uuid_from_octets(&clnt_id->uuid, (void *)¶ms[1].u.value); break; default: return TEE_ERROR_BAD_PARAMETERS; } *num_meta = 2; return TEE_SUCCESS; } ",0 "static void catc_multicast(unsigned char *addr, u8 *multicast) { u32 crc; crc = ether_crc_le(6, addr); multicast[(crc >> 3) & 0x3f] |= 1 << (crc & 7); } ",0 "SProcRenderComposite (ClientPtr client) { register int n; REQUEST(xRenderCompositeReq); swaps(&stuff->length, n); swapl(&stuff->src, n); swapl(&stuff->mask, n); swapl(&stuff->dst, n); swaps(&stuff->xSrc, n); swaps(&stuff->ySrc, n); swaps(&stuff->xMask, n); swaps(&stuff->yMask, n); swaps(&stuff->xDst, n); swaps(&stuff->yDst, n); swaps(&stuff->width, n); swaps(&stuff->height, n); return (*ProcRenderVector[stuff->renderReqType]) (client); } ",0 "status_t Parcel::readStrongBinderVector(std::vector>* val) const { return readTypedVector(val, &Parcel::readStrongBinder); } ",0 "bool SendGetChromeDriverAutomationVersion( AutomationMessageSender* sender, int* version, std::string* error_msg) { DictionaryValue dict; dict.SetString(""command"", ""GetChromeDriverAutomationVersion""); DictionaryValue reply_dict; if (!SendAutomationJSONRequest(sender, dict, &reply_dict, error_msg)) return false; return reply_dict.GetInteger(""version"", version); } ",0 "void StreamTcpSetDisableRawReassemblyFlag (TcpSession *ssn, char direction) { direction ? (ssn->server.flags |= STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED) : (ssn->client.flags |= STREAMTCP_STREAM_FLAG_NEW_RAW_DISABLED); } ",0 "static int sha256_import(struct shash_desc *desc, const void *in) { struct s390_sha_ctx *sctx = shash_desc_ctx(desc); const struct sha256_state *ictx = in; sctx->count = ictx->count; memcpy(sctx->state, ictx->state, sizeof(ictx->state)); memcpy(sctx->buf, ictx->buf, sizeof(ictx->buf)); sctx->func = KIMD_SHA_256; return 0; } ",0 " hash_free( hashtable* ht, FT_Memory memory ) { if ( ht != 0 ) { int i, sz = ht->size; hashnode* bp = ht->table; for ( i = 0; i < sz; i++, bp++ ) FT_FREE( *bp ); FT_FREE( ht->table ); } } ",0 "htmlParseContentInternal(htmlParserCtxtPtr ctxt) { xmlChar *currentNode; int depth; const xmlChar *name; currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; while (1) { long cons = ctxt->nbChars; GROW; if (ctxt->instate == XML_PARSER_EOF) break; /* * Our tag or one of it's parent or children is ending. */ if ((CUR == '<') && (NXT(1) == '/')) { if (htmlParseEndTag(ctxt) && ((currentNode != NULL) || (ctxt->nameNr == 0))) { if (currentNode != NULL) xmlFree(currentNode); currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; } continue; /* while */ } else if ((CUR == '<') && ((IS_ASCII_LETTER(NXT(1))) || (NXT(1) == '_') || (NXT(1) == ':'))) { name = htmlParseHTMLName_nonInvasive(ctxt); if (name == NULL) { htmlParseErr(ctxt, XML_ERR_NAME_REQUIRED, ""htmlParseStartTag: invalid element name\n"", NULL, NULL); /* Dump the bogus tag like browsers do */ while ((IS_CHAR_CH(CUR)) && (CUR != '>')) NEXT; htmlParserFinishElementParsing(ctxt); if (currentNode != NULL) xmlFree(currentNode); currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; continue; } if (ctxt->name != NULL) { if (htmlCheckAutoClose(name, ctxt->name) == 1) { htmlAutoClose(ctxt, name); continue; } } } /* * Has this node been popped out during parsing of * the next element */ if ((ctxt->nameNr > 0) && (depth >= ctxt->nameNr) && (!xmlStrEqual(currentNode, ctxt->name))) { htmlParserFinishElementParsing(ctxt); if (currentNode != NULL) xmlFree(currentNode); currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; continue; } if ((CUR != 0) && ((xmlStrEqual(currentNode, BAD_CAST""script"")) || (xmlStrEqual(currentNode, BAD_CAST""style"")))) { /* * Handle SCRIPT/STYLE separately */ htmlParseScript(ctxt); } else { /* * Sometimes DOCTYPE arrives in the middle of the document */ if ((CUR == '<') && (NXT(1) == '!') && (UPP(2) == 'D') && (UPP(3) == 'O') && (UPP(4) == 'C') && (UPP(5) == 'T') && (UPP(6) == 'Y') && (UPP(7) == 'P') && (UPP(8) == 'E')) { htmlParseErr(ctxt, XML_HTML_STRUCURE_ERROR, ""Misplaced DOCTYPE declaration\n"", BAD_CAST ""DOCTYPE"" , NULL); htmlParseDocTypeDecl(ctxt); } /* * First case : a comment */ if ((CUR == '<') && (NXT(1) == '!') && (NXT(2) == '-') && (NXT(3) == '-')) { htmlParseComment(ctxt); } /* * Second case : a Processing Instruction. */ else if ((CUR == '<') && (NXT(1) == '?')) { htmlParsePI(ctxt); } /* * Third case : a sub-element. */ else if (CUR == '<') { htmlParseElementInternal(ctxt); if (currentNode != NULL) xmlFree(currentNode); currentNode = xmlStrdup(ctxt->name); depth = ctxt->nameNr; } /* * Fourth case : a reference. If if has not been resolved, * parsing returns it's Name, create the node */ else if (CUR == '&') { htmlParseReference(ctxt); } /* * Fifth case : end of the resource */ else if (CUR == 0) { htmlAutoCloseOnEnd(ctxt); break; } /* * Last case, text. Note that References are handled directly. */ else { htmlParseCharData(ctxt); } if (cons == ctxt->nbChars) { if (ctxt->node != NULL) { htmlParseErr(ctxt, XML_ERR_INTERNAL_ERROR, ""detected an error in element content\n"", NULL, NULL); } break; } } GROW; } if (currentNode != NULL) xmlFree(currentNode); } ",0 "int btrfs_merge_bio_hook(struct page *page, unsigned long offset, size_t size, struct bio *bio, unsigned long bio_flags) { struct btrfs_root *root = BTRFS_I(page->mapping->host)->root; u64 logical = (u64)bio->bi_sector << 9; u64 length = 0; u64 map_length; int ret; if (bio_flags & EXTENT_BIO_COMPRESSED) return 0; length = bio->bi_size; map_length = length; ret = btrfs_map_block(root->fs_info, READ, logical, &map_length, NULL, 0); /* Will always return 0 with map_multi == NULL */ BUG_ON(ret < 0); if (map_length < length + size) return 1; return 0; } ",0 "void TabStripModel::SetSelectionFromModel( const TabStripSelectionModel& source) { DCHECK_NE(TabStripSelectionModel::kUnselectedIndex, source.active()); SetSelection(source, NOTIFY_DEFAULT); } ",0 "void GLES2DecoderImpl::ReleaseSurface() { if (!context_.get()) return; if (WasContextLost()) { DLOG(ERROR) << "" GLES2DecoderImpl: Trying to release lost context.""; return; } context_->ReleaseCurrent(surface_.get()); surface_ = nullptr; } ",0 "static int is_hugetlb_entry_migration(pte_t pte) { swp_entry_t swp; if (huge_pte_none(pte) || pte_present(pte)) return 0; swp = pte_to_swp_entry(pte); if (non_swap_entry(swp) && is_migration_entry(swp)) return 1; else return 0; } ",0 "mm_skey_respond(void *ctx, u_int numresponses, char **responses) { Buffer m; int authok; debug3(""%s: entering"", __func__); if (numresponses != 1) return (-1); buffer_init(&m); buffer_put_cstring(&m, responses[0]); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SKEYRESPOND, &m); mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SKEYRESPOND, &m); authok = buffer_get_int(&m); buffer_free(&m); return ((authok == 0) ? -1 : 0); } ",0 "void RenderWidgetHostImpl::SendScreenRects() { if (!renderer_initialized_ || waiting_for_screen_rects_ack_) return; if (is_hidden_) { return; } if (!view_) return; last_view_screen_rect_ = view_->GetViewBounds(); last_window_screen_rect_ = view_->GetBoundsInRootWindow(); view_->WillSendScreenRects(); Send(new ViewMsg_UpdateScreenRects( GetRoutingID(), last_view_screen_rect_, last_window_screen_rect_)); waiting_for_screen_rects_ack_ = true; } ",0 "static int dvb_usb_fe_init(struct dvb_frontend *fe) { int ret; struct dvb_usb_adapter *adap = fe->dvb->priv; struct dvb_usb_device *d = adap_to_d(adap); dev_dbg(&d->udev->dev, ""%s: adap=%d fe=%d\n"", __func__, adap->id, fe->id); if (!adap->suspend_resume_active) { adap->active_fe = fe->id; set_bit(ADAP_INIT, &adap->state_bits); } ret = dvb_usbv2_device_power_ctrl(d, 1); if (ret < 0) goto err; if (d->props->frontend_ctrl) { ret = d->props->frontend_ctrl(fe, 1); if (ret < 0) goto err; } if (adap->fe_init[fe->id]) { ret = adap->fe_init[fe->id](fe); if (ret < 0) goto err; } err: if (!adap->suspend_resume_active) { clear_bit(ADAP_INIT, &adap->state_bits); smp_mb__after_atomic(); wake_up_bit(&adap->state_bits, ADAP_INIT); } dev_dbg(&d->udev->dev, ""%s: ret=%d\n"", __func__, ret); return ret; } ",0 "void UserSelectionScreen::SetUsersLoaded(bool loaded) { users_loaded_ = loaded; } ",0 "bool FileManagerBrowserTestBase::GetEnableMyFilesVolume() const { return false; } ",0 "static inline int check_mnt(struct mount *mnt) { return mnt->mnt_ns == current->nsproxy->mnt_ns; } ",0 "void GenerateMicV2(base::span session_key, base::span negotiate_msg, base::span challenge_msg, base::span authenticate_msg, base::span mic) { bssl::ScopedHMAC_CTX ctx; HMAC_Init_ex(ctx.get(), session_key.data(), kSessionKeyLenV2, EVP_md5(), NULL); DCHECK_EQ(kMicLenV2, HMAC_size(ctx.get())); HMAC_Update(ctx.get(), negotiate_msg.data(), negotiate_msg.size()); HMAC_Update(ctx.get(), challenge_msg.data(), challenge_msg.size()); HMAC_Update(ctx.get(), authenticate_msg.data(), authenticate_msg.size()); HMAC_Final(ctx.get(), mic.data(), nullptr); } ",0 "void ContainerNode::parserAddChild(PassRefPtr newChild) { ASSERT(newChild); ASSERT(!newChild->parentNode()); // Use appendChild if you need to handle reparenting (and want DOM mutation events). forbidEventDispatch(); Node* last = m_lastChild; appendChildToContainer(newChild.get(), this); treeScope()->adoptIfNeeded(newChild.get()); allowEventDispatch(); childrenChanged(true, last, 0, 1); ChildNodeInsertionNotifier(this).notify(newChild.get()); } ",0 " virtual bool ethernet_connecting() const { return false; } ",0 " explicit MockScreenshotManager(content::NavigationControllerImpl* owner) : content::NavigationEntryScreenshotManager(owner), encoding_screenshot_in_progress_(false) { } ",0 "static void xhci_via_challenge(XHCIState *xhci, uint64_t addr) { PCIDevice *pci_dev = PCI_DEVICE(xhci); uint32_t buf[8]; uint32_t obuf[8]; dma_addr_t paddr = xhci_mask64(addr); pci_dma_read(pci_dev, paddr, &buf, 32); memcpy(obuf, buf, sizeof(obuf)); if ((buf[0] & 0xff) == 2) { obuf[0] = 0x49932000 + 0x54dc200 * buf[2] + 0x7429b578 * buf[3]; obuf[0] |= (buf[2] * buf[3]) & 0xff; obuf[1] = 0x0132bb37 + 0xe89 * buf[2] + 0xf09 * buf[3]; obuf[2] = 0x0066c2e9 + 0x2091 * buf[2] + 0x19bd * buf[3]; obuf[3] = 0xd5281342 + 0x2cc9691 * buf[2] + 0x2367662 * buf[3]; obuf[4] = 0x0123c75c + 0x1595 * buf[2] + 0x19ec * buf[3]; obuf[5] = 0x00f695de + 0x26fd * buf[2] + 0x3e9 * buf[3]; obuf[6] = obuf[2] ^ obuf[3] ^ 0x29472956; obuf[7] = obuf[2] ^ obuf[3] ^ 0x65866593; } pci_dma_write(pci_dev, paddr, &obuf, 32); } ",0 "const gfx::ImageSkia PageInfoUI::GetSiteSettingsIcon( const SkColor related_text_color) { return gfx::CreateVectorIcon( kSettingsIcon, kVectorIconSize, color_utils::DeriveDefaultIconColor(related_text_color)); } ",0 "void sc_file_clear_acl_entries(sc_file_t *file, unsigned int operation) { sc_acl_entry_t *e; if (file == NULL || operation >= SC_MAX_AC_OPS) { return; } e = file->acl[operation]; if (e == (sc_acl_entry_t *) 1 || e == (sc_acl_entry_t *) 2 || e == (sc_acl_entry_t *) 3) { file->acl[operation] = NULL; return; } while (e != NULL) { sc_acl_entry_t *tmp = e->next; free(e); e = tmp; } file->acl[operation] = NULL; } ",0 "void Document::UpdateActiveStyle() { DCHECK(IsActive()); DCHECK(IsMainThread()); TRACE_EVENT0(""blink"", ""Document::updateActiveStyle""); GetStyleEngine().UpdateActiveStyle(); } ",0 "WebKit::WebPrintScalingOption PrintWebViewHelper::GetPrintScalingOption( bool source_is_html, const DictionaryValue& job_settings, const PrintMsg_Print_Params& params) { DCHECK(!print_for_preview_); if (params.print_to_pdf) return WebKit::WebPrintScalingOptionSourceSize; if (!source_is_html) { if (!FitToPageEnabled(job_settings)) return WebKit::WebPrintScalingOptionNone; bool no_plugin_scaling = print_preview_context_.frame()->isPrintScalingDisabledForPlugin( print_preview_context_.node()); if (params.is_first_request && no_plugin_scaling) return WebKit::WebPrintScalingOptionNone; } return WebKit::WebPrintScalingOptionFitToPrintableArea; } ",0 "static inline unsigned int dccp_basic_hdr_len(const struct dccp_hdr *dh) { return DCCPH_X(dh) ? sizeof(struct dccp_hdr_ext) : sizeof(struct dccp_hdr); } ",0 "static int __netif_receive_skb(struct sk_buff *skb) { struct packet_type *ptype, *pt_prev; rx_handler_func_t *rx_handler; struct net_device *orig_dev; struct net_device *master; struct net_device *null_or_orig; struct net_device *orig_or_bond; int ret = NET_RX_DROP; __be16 type; if (!netdev_tstamp_prequeue) net_timestamp_check(skb); if (vlan_tx_tag_present(skb) && vlan_hwaccel_do_receive(skb)) return NET_RX_SUCCESS; /* if we've gotten here through NAPI, check netpoll */ if (netpoll_receive_skb(skb)) return NET_RX_DROP; if (!skb->skb_iif) skb->skb_iif = skb->dev->ifindex; /* * bonding note: skbs received on inactive slaves should only * be delivered to pkt handlers that are exact matches. Also * the deliver_no_wcard flag will be set. If packet handlers * are sensitive to duplicate packets these skbs will need to * be dropped at the handler. The vlan accel path may have * already set the deliver_no_wcard flag. */ null_or_orig = NULL; orig_dev = skb->dev; master = ACCESS_ONCE(orig_dev->master); if (skb->deliver_no_wcard) null_or_orig = orig_dev; else if (master) { if (skb_bond_should_drop(skb, master)) { skb->deliver_no_wcard = 1; null_or_orig = orig_dev; /* deliver only exact match */ } else skb->dev = master; } __this_cpu_inc(softnet_data.processed); skb_reset_network_header(skb); skb_reset_transport_header(skb); skb->mac_len = skb->network_header - skb->mac_header; pt_prev = NULL; rcu_read_lock(); #ifdef CONFIG_NET_CLS_ACT if (skb->tc_verd & TC_NCLS) { skb->tc_verd = CLR_TC_NCLS(skb->tc_verd); goto ncls; } #endif list_for_each_entry_rcu(ptype, &ptype_all, list) { if (ptype->dev == null_or_orig || ptype->dev == skb->dev || ptype->dev == orig_dev) { if (pt_prev) ret = deliver_skb(skb, pt_prev, orig_dev); pt_prev = ptype; } } #ifdef CONFIG_NET_CLS_ACT skb = handle_ing(skb, &pt_prev, &ret, orig_dev); if (!skb) goto out; ncls: #endif /* Handle special case of bridge or macvlan */ rx_handler = rcu_dereference(skb->dev->rx_handler); if (rx_handler) { if (pt_prev) { ret = deliver_skb(skb, pt_prev, orig_dev); pt_prev = NULL; } skb = rx_handler(skb); if (!skb) goto out; } /* * Make sure frames received on VLAN interfaces stacked on * bonding interfaces still make their way to any base bonding * device that may have registered for a specific ptype. The * handler may have to adjust skb->dev and orig_dev. */ orig_or_bond = orig_dev; if ((skb->dev->priv_flags & IFF_802_1Q_VLAN) && (vlan_dev_real_dev(skb->dev)->priv_flags & IFF_BONDING)) { orig_or_bond = vlan_dev_real_dev(skb->dev); } type = skb->protocol; list_for_each_entry_rcu(ptype, &ptype_base[ntohs(type) & PTYPE_HASH_MASK], list) { if (ptype->type == type && (ptype->dev == null_or_orig || ptype->dev == skb->dev || ptype->dev == orig_dev || ptype->dev == orig_or_bond)) { if (pt_prev) ret = deliver_skb(skb, pt_prev, orig_dev); pt_prev = ptype; } } if (pt_prev) { ret = pt_prev->func(skb, skb->dev, pt_prev, orig_dev); } else { kfree_skb(skb); /* Jamal, now you will not able to escape explaining * me how you were going to use this. :-) */ ret = NET_RX_DROP; } out: rcu_read_unlock(); return ret; } ",0 "void ExtensionInstallUI::Prompt::SetPermissions( std::vector permissions) { permissions_ = permissions; } ",0 "int wc_ecc_sign_hash(const byte* in, word32 inlen, byte* out, word32 *outlen, WC_RNG* rng, ecc_key* key) { int err; mp_int *r = NULL, *s = NULL; #ifndef WOLFSSL_ASYNC_CRYPT mp_int r_lcl, s_lcl; #endif if (in == NULL || out == NULL || outlen == NULL || key == NULL || rng == NULL) { return ECC_BAD_ARG_E; } #ifdef WOLF_CRYPTO_DEV if (key->devId != INVALID_DEVID) { err = wc_CryptoDev_EccSign(in, inlen, out, outlen, rng, key); if (err != NOT_COMPILED_IN) return err; } #endif #ifdef WOLFSSL_ASYNC_CRYPT err = wc_ecc_alloc_async(key); if (err != 0) return err; r = key->r; s = key->s; #else r = &r_lcl; s = &s_lcl; #endif switch(key->state) { case ECC_STATE_NONE: case ECC_STATE_SIGN_DO: key->state = ECC_STATE_SIGN_DO; if ((err = mp_init_multi(r, s, NULL, NULL, NULL, NULL)) != MP_OKAY){ break; } /* hardware crypto */ #if defined(WOLFSSL_ATECC508A) || defined(PLUTON_CRYPTO_ECC) err = wc_ecc_sign_hash_hw(in, inlen, r, s, out, outlen, rng, key); #else err = wc_ecc_sign_hash_ex(in, inlen, rng, key, r, s); #endif if (err < 0) { break; } FALL_THROUGH; case ECC_STATE_SIGN_ENCODE: key->state = ECC_STATE_SIGN_ENCODE; #if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ECC) if (key->asyncDev.marker == WOLFSSL_ASYNC_MARKER_ECC) { #ifdef HAVE_CAVIUM_V /* Nitrox requires r and s in sep buffer, so split it */ NitroxEccRsSplit(key, &r->raw, &s->raw); #endif #ifndef WOLFSSL_ASYNC_CRYPT_TEST /* only do this if not simulator, since it overwrites result */ wc_bigint_to_mp(&r->raw, r); wc_bigint_to_mp(&s->raw, s); #endif } #endif /* WOLFSSL_ASYNC_CRYPT */ /* encoded with DSA header */ err = StoreECC_DSA_Sig(out, outlen, r, s); /* done with R/S */ mp_clear(r); mp_clear(s); break; default: err = BAD_STATE_E; break; } /* if async pending then return and skip done cleanup below */ if (err == WC_PENDING_E) { key->state++; return err; } /* cleanup */ #ifdef WOLFSSL_ASYNC_CRYPT wc_ecc_free_async(key); #endif key->state = ECC_STATE_NONE; return err; } ",0 "local void defaults(void) { g.level = Z_DEFAULT_COMPRESSION; /* default zopfli options as set by ZopfliInitOptions(): verbose = 0 numiterations = 15 blocksplitting = 1 blocksplittinglast = 0 blocksplittingmax = 15 */ ZopfliInitOptions(&g.zopts); #ifdef NOTHREAD g.procs = 1; #else g.procs = nprocs(8); #endif g.block = 131072UL; /* 128K */ g.rsync = 0; /* don't do rsync blocking */ g.setdict = 1; /* initialize dictionary each thread */ g.verbosity = 1; /* normal message level */ g.headis = 3; /* store/restore name and timestamp */ g.pipeout = 0; /* don't force output to stdout */ g.sufx = "".gz""; /* compressed file suffix */ g.decode = 0; /* compress */ g.list = 0; /* compress */ g.keep = 0; /* delete input file once compressed */ g.force = 0; /* don't overwrite, don't compress links */ g.recurse = 0; /* don't go into directories */ g.form = 0; /* use gzip format */ } ",0 "void QuicClientPromisedInfo::OnPromiseHeaders(const SpdyHeaderBlock& headers) { SpdyHeaderBlock::const_iterator it = headers.find(kHttp2MethodHeader); DCHECK(it != headers.end()); if (!(it->second == ""GET"" || it->second == ""HEAD"")) { QUIC_DVLOG(1) << ""Promise for stream "" << id_ << "" has invalid method "" << it->second; Reset(QUIC_INVALID_PROMISE_METHOD); return; } if (!SpdyUtils::UrlIsValid(headers)) { QUIC_DVLOG(1) << ""Promise for stream "" << id_ << "" has invalid URL "" << url_; Reset(QUIC_INVALID_PROMISE_URL); return; } if (!session_->IsAuthorized(SpdyUtils::GetHostNameFromHeaderBlock(headers))) { Reset(QUIC_UNAUTHORIZED_PROMISE_URL); return; } request_headers_.reset(new SpdyHeaderBlock(headers.Clone())); } ",1 "bool PictureLayerImpl::HasValidTilePriorities() const { return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); } ",0 "nfs41_proc_secinfo_no_name(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *info, struct nfs4_secinfo_flavors *flavors) { struct nfs4_exception exception = { }; int err; do { err = _nfs41_proc_secinfo_no_name(server, fhandle, info, flavors); switch (err) { case 0: case -NFS4ERR_WRONGSEC: case -NFS4ERR_NOTSUPP: goto out; default: err = nfs4_handle_exception(server, err, &exception); } } while (exception.retry); out: return err; } ",0 "static int _nfs4_proc_symlink(struct inode *dir, struct dentry *dentry, struct page *page, unsigned int len, struct iattr *sattr) { struct nfs4_createdata *data; int status = -ENAMETOOLONG; if (len > NFS4_MAXPATHLEN) goto out; status = -ENOMEM; data = nfs4_alloc_createdata(dir, &dentry->d_name, sattr, NF4LNK); if (data == NULL) goto out; data->msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SYMLINK]; data->arg.u.symlink.pages = &page; data->arg.u.symlink.len = len; status = nfs4_do_create(dir, dentry, data); nfs4_free_createdata(data); out: return status; } ",0 "sf_error_number (int errnum) { static const char *bad_errnum = ""No error defined for this error number. This is a bug in libsndfile."" ; int k ; if (errnum == SFE_MAX_ERROR) return SndfileErrors [0].str ; if (errnum < 0 || errnum > SFE_MAX_ERROR) { /* This really shouldn't happen in release versions. */ printf (""Not a valid error number (%d).\n"", errnum) ; return bad_errnum ; } ; for (k = 0 ; SndfileErrors [k].str ; k++) if (errnum == SndfileErrors [k].error) return SndfileErrors [k].str ; return bad_errnum ; } /* sf_error_number */ ",0 "static int unshare_sighand(unsigned long unshare_flags, struct sighand_struct **new_sighp) { struct sighand_struct *sigh = current->sighand; if ((unshare_flags & CLONE_SIGHAND) && atomic_read(&sigh->count) > 1) return -EINVAL; else return 0; } ",0 "static void onCommandsSocketClosed(RIL_SOCKET_ID socket_id) { int ret; RequestInfo *p_cur; /* Hook for current context pendingRequestsMutextHook refer to &s_pendingRequestsMutex */ pthread_mutex_t * pendingRequestsMutexHook = &s_pendingRequestsMutex; /* pendingRequestsHook refer to &s_pendingRequests */ RequestInfo ** pendingRequestsHook = &s_pendingRequests; #if (SIM_COUNT >= 2) if (socket_id == RIL_SOCKET_2) { pendingRequestsMutexHook = &s_pendingRequestsMutex_socket2; pendingRequestsHook = &s_pendingRequests_socket2; } #if (SIM_COUNT >= 3) else if (socket_id == RIL_SOCKET_3) { pendingRequestsMutexHook = &s_pendingRequestsMutex_socket3; pendingRequestsHook = &s_pendingRequests_socket3; } #endif #if (SIM_COUNT >= 4) else if (socket_id == RIL_SOCKET_4) { pendingRequestsMutexHook = &s_pendingRequestsMutex_socket4; pendingRequestsHook = &s_pendingRequests_socket4; } #endif #endif /* mark pending requests as ""cancelled"" so we dont report responses */ ret = pthread_mutex_lock(pendingRequestsMutexHook); assert (ret == 0); p_cur = *pendingRequestsHook; for (p_cur = *pendingRequestsHook ; p_cur != NULL ; p_cur = p_cur->p_next ) { p_cur->cancelled = 1; } ret = pthread_mutex_unlock(pendingRequestsMutexHook); assert (ret == 0); } ",0 " explicit ListenerProxy(FileChooserImpl* owner) : owner_(owner) {} ",0 "static int bap_write(struct airo_info *ai, const __le16 *pu16Src, int bytelen, int whichbap) { bytelen = (bytelen + 1) & (~1); // round up to even value if ( !do8bitIO ) outsw( ai->dev->base_addr+DATA0+whichbap, pu16Src, bytelen>>1 ); else outsb( ai->dev->base_addr+DATA0+whichbap, pu16Src, bytelen ); return SUCCESS; } ",0 "static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf) { struct socket *sock = tsock->sk.sk_socket; struct tipc_msg *msg = buf_msg(*buf); struct sock *sk = &tsock->sk; u32 retval = TIPC_ERR_NO_PORT; int res; if (msg_mcast(msg)) return retval; switch ((int)sock->state) { case SS_CONNECTED: /* Accept only connection-based messages sent by peer */ if (msg_connected(msg) && tipc_port_peer_msg(tsock->p, msg)) { if (unlikely(msg_errcode(msg))) { sock->state = SS_DISCONNECTING; __tipc_disconnect(tsock->p); } retval = TIPC_OK; } break; case SS_CONNECTING: /* Accept only ACK or NACK message */ if (unlikely(msg_errcode(msg))) { sock->state = SS_DISCONNECTING; sk->sk_err = ECONNREFUSED; retval = TIPC_OK; break; } if (unlikely(!msg_connected(msg))) break; res = auto_connect(sock, msg); if (res) { sock->state = SS_DISCONNECTING; sk->sk_err = -res; retval = TIPC_OK; break; } /* If an incoming message is an 'ACK-', it should be * discarded here because it doesn't contain useful * data. In addition, we should try to wake up * connect() routine if sleeping. */ if (msg_data_sz(msg) == 0) { kfree_skb(*buf); *buf = NULL; if (waitqueue_active(sk_sleep(sk))) wake_up_interruptible(sk_sleep(sk)); } retval = TIPC_OK; break; case SS_LISTENING: case SS_UNCONNECTED: /* Accept only SYN message */ if (!msg_connected(msg) && !(msg_errcode(msg))) retval = TIPC_OK; break; case SS_DISCONNECTING: break; default: pr_err(""Unknown socket state %u\n"", sock->state); } return retval; } ",0 "TEE_Result syscall_authenc_enc_final(unsigned long state, const void *src_data, size_t src_len, void *dst_data, uint64_t *dst_len, void *tag, uint64_t *tag_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; uint64_t dlen; uint64_t tlen = 0; size_t tmp_dlen; size_t tmp_tlen; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; if (cs->mode != TEE_MODE_ENCRYPT) return TEE_ERROR_BAD_PARAMETERS; res = tee_mmu_check_access_rights(to_user_ta_ctx(sess->ctx), TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)src_data, src_len); if (res != TEE_SUCCESS) return res; if (!dst_len) { dlen = 0; } else { res = tee_svc_copy_from_user(&dlen, dst_len, sizeof(dlen)); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights(to_user_ta_ctx(sess->ctx), TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_WRITE | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)dst_data, dlen); if (res != TEE_SUCCESS) return res; } if (dlen < src_len) { res = TEE_ERROR_SHORT_BUFFER; goto out; } res = tee_svc_copy_from_user(&tlen, tag_len, sizeof(tlen)); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights(to_user_ta_ctx(sess->ctx), TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_WRITE | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)tag, tlen); if (res != TEE_SUCCESS) return res; tmp_dlen = dlen; tmp_tlen = tlen; res = crypto_authenc_enc_final(cs->ctx, cs->algo, src_data, src_len, dst_data, &tmp_dlen, tag, &tmp_tlen); dlen = tmp_dlen; tlen = tmp_tlen; out: if (res == TEE_SUCCESS || res == TEE_ERROR_SHORT_BUFFER) { TEE_Result res2; if (dst_len != NULL) { res2 = tee_svc_copy_to_user(dst_len, &dlen, sizeof(*dst_len)); if (res2 != TEE_SUCCESS) return res2; } res2 = tee_svc_copy_to_user(tag_len, &tlen, sizeof(*tag_len)); if (res2 != TEE_SUCCESS) return res2; } return res; } ",0 " virtual ~TestWebFrameClient() { } ",0 "int __init raw_proc_init(void) { return register_pernet_subsys(&raw_net_ops); } ",0 "static void apply_window_int16_c(int16_t *output, const int16_t *input, const int16_t *window, unsigned int len) { int i; int len2 = len >> 1; for (i = 0; i < len2; i++) { int16_t w = window[i]; output[i] = (MUL16(input[i], w) + (1 << 14)) >> 15; output[len-i-1] = (MUL16(input[len-i-1], w) + (1 << 14)) >> 15; } } ",0 "void RenderViewImpl::OnSetZoomLevelForLoadingURL(const GURL& url, double zoom_level) { host_zoom_levels_[url] = zoom_level; } ",0 "static void nfs4_check_drain_fc_complete(struct nfs4_session *ses) { struct rpc_task *task; if (!test_bit(NFS4_SESSION_DRAINING, &ses->session_state)) { task = rpc_wake_up_next(&ses->fc_slot_table.slot_tbl_waitq); if (task) rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED); return; } if (ses->fc_slot_table.highest_used_slotid != -1) return; dprintk(""%s COMPLETE: Session Fore Channel Drained\n"", __func__); complete(&ses->fc_slot_table.complete); } ",0 "static int bin_pe_init_resource(struct PE_(r_bin_pe_obj_t)* bin) { PE_(image_data_directory) * resource_dir = &bin->data_directory[PE_IMAGE_DIRECTORY_ENTRY_RESOURCE]; PE_DWord resource_dir_paddr = bin_pe_rva_to_paddr (bin, resource_dir->VirtualAddress); if (!resource_dir_paddr) { return false; } bin->resources = r_list_newf ((RListFree)_free_resources); if (!bin->resources) { return false; } if (!(bin->resource_directory = malloc (sizeof(*bin->resource_directory)))) { r_sys_perror (""malloc (resource directory)""); return false; } if (r_buf_read_at (bin->b, resource_dir_paddr, (ut8*) bin->resource_directory, sizeof (*bin->resource_directory)) != sizeof (*bin->resource_directory)) { bprintf (""Warning: read (resource directory)\n""); free (bin->resource_directory); bin->resource_directory = NULL; return false; } bin->resource_directory_offset = resource_dir_paddr; return true; } ",0 " static Ewk_View_Smart_Class* miniBrowserViewSmartClass() { static Ewk_View_Smart_Class ewkViewClass = EWK_VIEW_SMART_CLASS_INIT_NAME_VERSION(""MiniBrowser_View""); return &ewkViewClass; } ",0 "void change_mnt_propagation(struct mount *mnt, int type) { if (type == MS_SHARED) { set_mnt_shared(mnt); return; } do_make_slave(mnt); if (type != MS_SLAVE) { list_del_init(&mnt->mnt_slave); mnt->mnt_master = NULL; if (type == MS_UNBINDABLE) mnt->mnt.mnt_flags |= MNT_UNBINDABLE; else mnt->mnt.mnt_flags &= ~MNT_UNBINDABLE; } } ",0 "void WebGL2RenderingContextBase::uniformMatrix2x3fv( const WebGLUniformLocation* location, GLboolean transpose, Vector& value, GLuint src_offset, GLuint src_length) { if (isContextLost() || !ValidateUniformMatrixParameters(""uniformMatrix2x3fv"", location, transpose, value.data(), value.size(), 6, src_offset, src_length)) return; ContextGL()->UniformMatrix2x3fv( location->Location(), (src_length ? src_length : (value.size() - src_offset)) / 6, transpose, value.data() + src_offset); } ",0 "void RenderViewImpl::OnSetEditCommandsForNextKeyEvent( const EditCommands& edit_commands) { edit_commands_ = edit_commands; } ",0 "void RenderBox::addVisualOverflow(const LayoutRect& rect) { LayoutRect borderBox = borderBoxRect(); if (borderBox.contains(rect) || rect.isEmpty()) return; if (!m_overflow) m_overflow = adoptPtr(new RenderOverflow(noOverflowRect(), borderBox)); m_overflow->addVisualOverflow(rect); } ",0 "static void qeth_notify_skbs(struct qeth_qdio_out_q *q, struct qeth_qdio_out_buffer *buf, enum iucv_tx_notify notification) { struct sk_buff *skb; if (skb_queue_empty(&buf->skb_list)) goto out; skb = skb_peek(&buf->skb_list); while (skb) { QETH_CARD_TEXT_(q->card, 5, ""skbn%d"", notification); QETH_CARD_TEXT_(q->card, 5, ""%lx"", (long) skb); if (skb->protocol == ETH_P_AF_IUCV) { if (skb->sk) { struct iucv_sock *iucv = iucv_sk(skb->sk); iucv->sk_txnotify(skb, notification); } } if (skb_queue_is_last(&buf->skb_list, skb)) skb = NULL; else skb = skb_queue_next(&buf->skb_list, skb); } out: return; } ",0 "HRESULT CGaiaCredentialBase::GetStringValue(DWORD field_id, wchar_t** value) { return GetStringValueImpl(field_id, value); } ",0 "void HTMLFormElement::addToPastNamesMap(Node* element, const AtomicString& pastName) { if (pastName.isEmpty()) return; if (!m_pastNamesMap) m_pastNamesMap = adoptPtr(new PastNamesMap); m_pastNamesMap->set(pastName.impl(), element); } ",0 "static void coroutine_fn v9fs_xattrcreate(void *opaque) { int flags; int32_t fid; int64_t size; ssize_t err = 0; V9fsString name; size_t offset = 7; V9fsFidState *file_fidp; V9fsFidState *xattr_fidp; V9fsPDU *pdu = opaque; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, ""dsqd"", &fid, &name, &size, &flags); if (err < 0) { goto out_nofid; } trace_v9fs_xattrcreate(pdu->tag, pdu->id, fid, name.data, size, flags); file_fidp = get_fid(pdu, fid); if (file_fidp == NULL) { err = -EINVAL; goto out_nofid; } /* Make the file fid point to xattr */ xattr_fidp = file_fidp; xattr_fidp->fid_type = P9_FID_XATTR; xattr_fidp->fs.xattr.copied_len = 0; xattr_fidp->fs.xattr.len = size; xattr_fidp->fs.xattr.flags = flags; v9fs_string_init(&xattr_fidp->fs.xattr.name); v9fs_string_copy(&xattr_fidp->fs.xattr.name, &name); xattr_fidp->fs.xattr.value = g_malloc0(size); err = offset; put_fid(pdu, file_fidp); pdu_complete(pdu, err); v9fs_string_free(&name); } ",1 "std::string GetRestrictParameterPref(PrefService* policy_pref_service) { std::string parameter; #if defined(OS_CHROMEOS) chromeos::CrosSettings::Get()->GetString( chromeos::kVariationsRestrictParameter, ¶meter); #else if (policy_pref_service) { parameter = policy_pref_service->GetString(prefs::kVariationsRestrictParameter); } #endif return parameter; } ",0 "CMD_FUNC(m_authenticate) { aClient *agent_p = NULL; /* Failing to use CAP REQ for sasl is a protocol violation. */ if (!SASL_SERVER || !MyConnect(sptr) || BadPtr(parv[1]) || !CHECKPROTO(sptr, PROTO_SASL)) return 0; if (sptr->local->sasl_complete) { sendto_one(sptr, err_str(ERR_SASLALREADY), me.name, BadPtr(sptr->name) ? ""*"" : sptr->name); return 0; } if (strlen(parv[1]) > 400) { sendto_one(sptr, err_str(ERR_SASLTOOLONG), me.name, BadPtr(sptr->name) ? ""*"" : sptr->name); return 0; } if (*sptr->local->sasl_agent) agent_p = find_client(sptr->local->sasl_agent, NULL); if (agent_p == NULL) { char *addr = BadPtr(sptr->ip) ? ""0"" : sptr->ip; char *certfp = moddata_client_get(sptr, ""certfp""); sendto_server(NULL, 0, 0, "":%s SASL %s %s H %s %s"", me.name, SASL_SERVER, encode_puid(sptr), addr, addr); if (certfp) sendto_server(NULL, 0, 0, "":%s SASL %s %s S %s %s"", me.name, SASL_SERVER, encode_puid(sptr), parv[1], certfp); else sendto_server(NULL, 0, 0, "":%s SASL %s %s S %s"", me.name, SASL_SERVER, encode_puid(sptr), parv[1]); } else sendto_server(NULL, 0, 0, "":%s SASL %s %s C %s"", me.name, AGENT_SID(agent_p), encode_puid(sptr), parv[1]); sptr->local->sasl_out++; return 0; } ",1 "rend_service_verify_single_onion_poison(const rend_service_t* s, const or_options_t* options) { /* Passing a NULL service is a bug */ if (BUG(!s)) { return -1; } /* Ephemeral services are checked at ADD_ONION time */ if (BUG(rend_service_is_ephemeral(s))) { return -1; } /* Service is expected to have a directory */ if (BUG(!s->directory)) { return -1; } /* Services without keys are always ok - their keys will only ever be used * in the current mode */ if (!rend_service_private_key_exists(s)) { return 0; } /* The key has been used before in a different mode */ if (service_is_single_onion_poisoned(s) != rend_service_non_anonymous_mode_enabled(options)) { return -1; } /* The key exists and is consistent with the current mode */ return 0; } ",0 " explicit TestSSLConfigService(const SSLConfig& config) : config_(config) {} ",0 "SECURITY_STATUS ntlm_write_ChallengeMessage(NTLM_CONTEXT* context, PSecBuffer buffer) { wStream* s; size_t length; UINT32 PayloadOffset; NTLM_CHALLENGE_MESSAGE* message; message = &context->CHALLENGE_MESSAGE; ZeroMemory(message, sizeof(NTLM_CHALLENGE_MESSAGE)); s = Stream_New((BYTE*) buffer->pvBuffer, buffer->cbBuffer); if (!s) return SEC_E_INTERNAL_ERROR; ntlm_get_version_info(&(message->Version)); /* Version */ ntlm_generate_server_challenge(context); /* Server Challenge */ ntlm_generate_timestamp(context); /* Timestamp */ if (ntlm_construct_challenge_target_info(context) < 0) /* TargetInfo */ { Stream_Free(s, FALSE); return SEC_E_INTERNAL_ERROR; } CopyMemory(message->ServerChallenge, context->ServerChallenge, 8); /* ServerChallenge */ message->NegotiateFlags = context->NegotiateFlags; ntlm_populate_message_header((NTLM_MESSAGE_HEADER*) message, MESSAGE_TYPE_CHALLENGE); /* Message Header (12 bytes) */ ntlm_write_message_header(s, (NTLM_MESSAGE_HEADER*) message); if (message->NegotiateFlags & NTLMSSP_REQUEST_TARGET) { message->TargetName.Len = (UINT16) context->TargetName.cbBuffer; message->TargetName.Buffer = (PBYTE) context->TargetName.pvBuffer; } message->NegotiateFlags |= NTLMSSP_NEGOTIATE_TARGET_INFO; if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_TARGET_INFO) { message->TargetInfo.Len = (UINT16) context->ChallengeTargetInfo.cbBuffer; message->TargetInfo.Buffer = (PBYTE) context->ChallengeTargetInfo.pvBuffer; } PayloadOffset = 48; if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION) PayloadOffset += 8; message->TargetName.BufferOffset = PayloadOffset; message->TargetInfo.BufferOffset = message->TargetName.BufferOffset + message->TargetName.Len; /* TargetNameFields (8 bytes) */ ntlm_write_message_fields(s, &(message->TargetName)); Stream_Write_UINT32(s, message->NegotiateFlags); /* NegotiateFlags (4 bytes) */ Stream_Write(s, message->ServerChallenge, 8); /* ServerChallenge (8 bytes) */ Stream_Write(s, message->Reserved, 8); /* Reserved (8 bytes), should be ignored */ /* TargetInfoFields (8 bytes) */ ntlm_write_message_fields(s, &(message->TargetInfo)); if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION) ntlm_write_version_info(s, &(message->Version)); /* Version (8 bytes) */ /* Payload (variable) */ if (message->NegotiateFlags & NTLMSSP_REQUEST_TARGET) ntlm_write_message_fields_buffer(s, &(message->TargetName)); if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_TARGET_INFO) ntlm_write_message_fields_buffer(s, &(message->TargetInfo)); length = Stream_GetPosition(s); buffer->cbBuffer = length; if (!sspi_SecBufferAlloc(&context->ChallengeMessage, length)) { Stream_Free(s, FALSE); return SEC_E_INTERNAL_ERROR; } CopyMemory(context->ChallengeMessage.pvBuffer, Stream_Buffer(s), length); #ifdef WITH_DEBUG_NTLM WLog_DBG(TAG, ""CHALLENGE_MESSAGE (length = %d)"", length); winpr_HexDump(TAG, WLOG_DEBUG, context->ChallengeMessage.pvBuffer, context->ChallengeMessage.cbBuffer); ntlm_print_negotiate_flags(message->NegotiateFlags); if (message->NegotiateFlags & NTLMSSP_NEGOTIATE_VERSION) ntlm_print_version_info(&(message->Version)); ntlm_print_message_fields(&(message->TargetName), ""TargetName""); ntlm_print_message_fields(&(message->TargetInfo), ""TargetInfo""); #endif context->state = NTLM_STATE_AUTHENTICATE; Stream_Free(s, FALSE); return SEC_I_CONTINUE_NEEDED; } ",0 "download::DownloadItemImpl* DownloadManagerImpl::CreateActiveItem( uint32_t id, const download::DownloadCreateInfo& info) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!base::ContainsKey(downloads_, id)); download::DownloadItemImpl* download = item_factory_->CreateActiveItem(this, id, info); downloads_[id] = base::WrapUnique(download); downloads_by_guid_[download->GetGuid()] = download; DownloadItemUtils::AttachInfo( download, GetBrowserContext(), WebContentsImpl::FromRenderFrameHostID(info.render_process_id, info.render_frame_id)); return download; } ",0 "history_tree_clone(OnigCaptureTreeNode* node) { int i; OnigCaptureTreeNode *clone, *child; clone = history_node_new(); CHECK_NULL_RETURN(clone); clone->beg = node->beg; clone->end = node->end; for (i = 0; i < node->num_childs; i++) { child = history_tree_clone(node->childs[i]); if (IS_NULL(child)) { history_tree_free(clone); return (OnigCaptureTreeNode* )0; } history_tree_add_child(clone, child); } return clone; } ",0 "IndexedDBTransaction::TaskQueue::TaskQueue() {} ",0 "static MagickBooleanType IsHDR(const unsigned char *magick, const size_t length) { if (length < 10) return(MagickFalse); if (LocaleNCompare((const char *) magick,""#?RADIANCE"",10) == 0) return(MagickTrue); if (LocaleNCompare((const char *) magick,""#?RGBE"",6) == 0) return(MagickTrue); return(MagickFalse); } ",0 "GF_Err stsc_Size(GF_Box *s) { GF_SampleToChunkBox *ptr = (GF_SampleToChunkBox *)s; ptr->size += 4 + (12 * ptr->nb_entries); return GF_OK; } ",0 "static void unreg_event_syscall_enter(struct ftrace_event_file *file, struct ftrace_event_call *call) { struct trace_array *tr = file->tr; int num; num = ((struct syscall_metadata *)call->data)->syscall_nr; if (WARN_ON_ONCE(num < 0 || num >= NR_syscalls)) return; mutex_lock(&syscall_trace_lock); tr->sys_refcount_enter--; RCU_INIT_POINTER(tr->enter_syscall_files[num], NULL); if (!tr->sys_refcount_enter) unregister_trace_sys_enter(ftrace_syscall_enter, tr); mutex_unlock(&syscall_trace_lock); } ",0 "protocol::VideoStub* PepperVideoRenderer3D::GetVideoStub() { return this; } ",0 "static int check_subprogs(struct bpf_verifier_env *env) { int i, ret, subprog_start, subprog_end, off, cur_subprog = 0; struct bpf_subprog_info *subprog = env->subprog_info; struct bpf_insn *insn = env->prog->insnsi; int insn_cnt = env->prog->len; /* Add entry function. */ ret = add_subprog(env, 0); if (ret < 0) return ret; /* determine subprog starts. The end is one before the next starts */ for (i = 0; i < insn_cnt; i++) { if (insn[i].code != (BPF_JMP | BPF_CALL)) continue; if (insn[i].src_reg != BPF_PSEUDO_CALL) continue; if (!env->allow_ptr_leaks) { verbose(env, ""function calls to other bpf functions are allowed for root only\n""); return -EPERM; } if (bpf_prog_is_dev_bound(env->prog->aux)) { verbose(env, ""function calls in offloaded programs are not supported yet\n""); return -EINVAL; } ret = add_subprog(env, i + insn[i].imm + 1); if (ret < 0) return ret; } /* Add a fake 'exit' subprog which could simplify subprog iteration * logic. 'subprog_cnt' should not be increased. */ subprog[env->subprog_cnt].start = insn_cnt; if (env->log.level > 1) for (i = 0; i < env->subprog_cnt; i++) verbose(env, ""func#%d @%d\n"", i, subprog[i].start); /* now check that all jumps are within the same subprog */ subprog_start = subprog[cur_subprog].start; subprog_end = subprog[cur_subprog + 1].start; for (i = 0; i < insn_cnt; i++) { u8 code = insn[i].code; if (BPF_CLASS(code) != BPF_JMP) goto next; if (BPF_OP(code) == BPF_EXIT || BPF_OP(code) == BPF_CALL) goto next; off = i + insn[i].off + 1; if (off < subprog_start || off >= subprog_end) { verbose(env, ""jump out of range from insn %d to %d\n"", i, off); return -EINVAL; } next: if (i == subprog_end - 1) { /* to avoid fall-through from one subprog into another * the last insn of the subprog should be either exit * or unconditional jump back */ if (code != (BPF_JMP | BPF_EXIT) && code != (BPF_JMP | BPF_JA)) { verbose(env, ""last insn is not an exit or jmp\n""); return -EINVAL; } subprog_start = subprog_end; cur_subprog++; if (cur_subprog < env->subprog_cnt) subprog_end = subprog[cur_subprog + 1].start; } } return 0; } ",0 " TestSafeBrowsingBlockingPage(SafeBrowsingService* service, TabContents* tab_contents, const UnsafeResourceList& unsafe_resources) : SafeBrowsingBlockingPage(service, tab_contents, unsafe_resources) { malware_details_proceed_delay_ms_ = 0; } ",0 "void Instance::CalculateBackgroundParts() { background_parts_.clear(); int v_scrollbar_thickness = GetScaled(v_scrollbar_.get() ? GetScrollbarReservedThickness() : 0); int h_scrollbar_thickness = GetScaled(h_scrollbar_.get() ? GetScrollbarReservedThickness() : 0); int width_without_scrollbar = std::max( plugin_size_.width() - v_scrollbar_thickness, 0); int height_without_scrollbar = std::max( plugin_size_.height() - h_scrollbar_thickness, 0); int left_width = available_area_.x(); int right_start = available_area_.right(); int right_width = abs(width_without_scrollbar - available_area_.right()); int bottom = std::min(available_area_.bottom(), height_without_scrollbar); BackgroundPart part = { pp::Rect(0, 0, left_width, bottom), kBackgroundColor }; if (!part.location.IsEmpty()) background_parts_.push_back(part); part.location = pp::Rect(right_start, 0, right_width, bottom); if (!part.location.IsEmpty()) background_parts_.push_back(part); part.location = pp::Rect( 0, bottom, width_without_scrollbar, height_without_scrollbar - bottom); if (!part.location.IsEmpty()) background_parts_.push_back(part); if (h_scrollbar_thickness #if defined(OS_MACOSX) || #else && #endif v_scrollbar_thickness) { part.color = 0xFFFFFFFF; part.location = pp::Rect(plugin_size_.width() - v_scrollbar_thickness, plugin_size_.height() - h_scrollbar_thickness, h_scrollbar_thickness, v_scrollbar_thickness); background_parts_.push_back(part); } } ",0 "ofproto_packet_out_init(struct ofproto *ofproto, struct ofconn *ofconn, struct ofproto_packet_out *opo, const struct ofputil_packet_out *po) { enum ofperr error; if (ofp_to_u16(po->in_port) >= ofproto->max_ports && ofp_to_u16(po->in_port) < ofp_to_u16(OFPP_MAX)) { return OFPERR_OFPBRC_BAD_PORT; } /* Get payload. */ if (po->buffer_id != UINT32_MAX) { return OFPERR_OFPBRC_BUFFER_UNKNOWN; } /* Ensure that the L3 header is 32-bit aligned. */ opo->packet = dp_packet_clone_data_with_headroom(po->packet, po->packet_len, 2); /* Store struct flow. */ opo->flow = xmalloc(sizeof *opo->flow); flow_extract(opo->packet, opo->flow); opo->flow->in_port.ofp_port = po->in_port; /* Check actions like for flow mods. We pass a 'table_id' of 0 to * ofproto_check_consistency(), which isn't strictly correct because these * actions aren't in any table. This is OK as 'table_id' is only used to * check instructions (e.g., goto-table), which can't appear on the action * list of a packet-out. */ error = ofpacts_check_consistency(po->ofpacts, po->ofpacts_len, opo->flow, u16_to_ofp(ofproto->max_ports), 0, ofproto->n_tables, ofconn_get_protocol(ofconn)); if (error) { dp_packet_delete(opo->packet); free(opo->flow); return error; } opo->ofpacts = po->ofpacts; opo->ofpacts_len = po->ofpacts_len; opo->aux = NULL; return 0; } ",0 "Response CreateInvalidVersionIdErrorResponse() { return Response::InvalidParams(""Invalid version ID""); } ",0 "BrowserPluginEmbedder* WebContentsImpl::GetBrowserPluginEmbedder() const { return browser_plugin_embedder_.get(); } ",0 "void free_netdev(struct net_device *dev) { struct napi_struct *p, *n; release_net(dev_net(dev)); kfree(dev->_tx); /* Flush device addresses */ dev_addr_flush(dev); /* Clear ethtool n-tuple list */ ethtool_ntuple_flush(dev); list_for_each_entry_safe(p, n, &dev->napi_list, dev_list) netif_napi_del(p); /* Compatibility with error handling in drivers */ if (dev->reg_state == NETREG_UNINITIALIZED) { kfree((char *)dev - dev->padded); return; } BUG_ON(dev->reg_state != NETREG_UNREGISTERED); dev->reg_state = NETREG_RELEASED; /* will free via device release */ put_device(&dev->dev); } ",0 "bool HTMLInputElement::isText() const { return m_inputType->isTextType(); } ",0 "int avcodec_parameters_from_context(AVCodecParameters *par, const AVCodecContext *codec) { codec_parameters_reset(par); par->codec_type = codec->codec_type; par->codec_id = codec->codec_id; par->codec_tag = codec->codec_tag; par->bit_rate = codec->bit_rate; par->bits_per_coded_sample = codec->bits_per_coded_sample; par->bits_per_raw_sample = codec->bits_per_raw_sample; par->profile = codec->profile; par->level = codec->level; switch (par->codec_type) { case AVMEDIA_TYPE_VIDEO: par->format = codec->pix_fmt; par->width = codec->width; par->height = codec->height; par->field_order = codec->field_order; par->color_range = codec->color_range; par->color_primaries = codec->color_primaries; par->color_trc = codec->color_trc; par->color_space = codec->colorspace; par->chroma_location = codec->chroma_sample_location; par->sample_aspect_ratio = codec->sample_aspect_ratio; par->video_delay = codec->has_b_frames; break; case AVMEDIA_TYPE_AUDIO: par->format = codec->sample_fmt; par->channel_layout = codec->channel_layout; par->channels = codec->channels; par->sample_rate = codec->sample_rate; par->block_align = codec->block_align; par->frame_size = codec->frame_size; par->initial_padding = codec->initial_padding; par->trailing_padding = codec->trailing_padding; par->seek_preroll = codec->seek_preroll; break; case AVMEDIA_TYPE_SUBTITLE: par->width = codec->width; par->height = codec->height; break; } if (codec->extradata) { par->extradata = av_mallocz(codec->extradata_size + AV_INPUT_BUFFER_PADDING_SIZE); if (!par->extradata) return AVERROR(ENOMEM); memcpy(par->extradata, codec->extradata, codec->extradata_size); par->extradata_size = codec->extradata_size; } return 0; } ",0 "void ChromeContentBrowserClient::NavigationRequestStarted( int frame_tree_node_id, const GURL& url, net::HttpRequestHeaders* extra_headers, int* extra_load_flags) { WebContents* web_contents = WebContents::FromFrameTreeNodeId(frame_tree_node_id); content::BrowserContext* browser_context = web_contents->GetBrowserContext(); ClientHintsFactory::GetForBrowserContext(browser_context) ->GetAdditionalNavigationRequestClientHintsHeaders(url, extra_headers); prerender::PrerenderContents* prerender_contents = prerender::PrerenderContents::FromWebContents(web_contents); if (prerender_contents && prerender_contents->prerender_mode() == prerender::PREFETCH_ONLY) { *extra_load_flags = net::LOAD_PREFETCH; extra_headers->SetHeader(prerender::kPurposeHeaderName, prerender::kPurposeHeaderValue); } if (!browser_context->IsOffTheRecord()) { policy::PolicyHeaderService* policy_header_service = policy::PolicyHeaderServiceFactory::GetForBrowserContext( browser_context); if (policy_header_service) policy_header_service->AddPolicyHeaders(url, extra_headers); } } ",0 "static RSA_PSS_PARAMS *rsa_pss_decode(const X509_ALGOR *alg, X509_ALGOR **pmaskHash) { const unsigned char *p; int plen; RSA_PSS_PARAMS *pss; *pmaskHash = NULL; if (!alg->parameter || alg->parameter->type != V_ASN1_SEQUENCE) return NULL; p = alg->parameter->value.sequence->data; plen = alg->parameter->value.sequence->length; pss = d2i_RSA_PSS_PARAMS(NULL, &p, plen); if (!pss) return NULL; if (pss->maskGenAlgorithm) { ASN1_TYPE *param = pss->maskGenAlgorithm->parameter; if (OBJ_obj2nid(pss->maskGenAlgorithm->algorithm) == NID_mgf1 && param->type == V_ASN1_SEQUENCE) { p = param->value.sequence->data; plen = param->value.sequence->length; *pmaskHash = d2i_X509_ALGOR(NULL, &p, plen); } } return pss; } ",1 "static int sctp_rcv_ootb(struct sk_buff *skb) { sctp_chunkhdr_t *ch; __u8 *ch_end; sctp_errhdr_t *err; ch = (sctp_chunkhdr_t *) skb->data; /* Scan through all the chunks in the packet. */ do { /* Break out if chunk length is less then minimal. */ if (ntohs(ch->length) < sizeof(sctp_chunkhdr_t)) break; ch_end = ((__u8 *)ch) + WORD_ROUND(ntohs(ch->length)); if (ch_end > skb_tail_pointer(skb)) break; /* RFC 8.4, 2) If the OOTB packet contains an ABORT chunk, the * receiver MUST silently discard the OOTB packet and take no * further action. */ if (SCTP_CID_ABORT == ch->type) goto discard; /* RFC 8.4, 6) If the packet contains a SHUTDOWN COMPLETE * chunk, the receiver should silently discard the packet * and take no further action. */ if (SCTP_CID_SHUTDOWN_COMPLETE == ch->type) goto discard; /* RFC 4460, 2.11.2 * This will discard packets with INIT chunk bundled as * subsequent chunks in the packet. When INIT is first, * the normal INIT processing will discard the chunk. */ if (SCTP_CID_INIT == ch->type && (void *)ch != skb->data) goto discard; /* RFC 8.4, 7) If the packet contains a ""Stale cookie"" ERROR * or a COOKIE ACK the SCTP Packet should be silently * discarded. */ if (SCTP_CID_COOKIE_ACK == ch->type) goto discard; if (SCTP_CID_ERROR == ch->type) { sctp_walk_errors(err, ch) { if (SCTP_ERROR_STALE_COOKIE == err->cause) goto discard; } } ch = (sctp_chunkhdr_t *) ch_end; } while (ch_end < skb_tail_pointer(skb)); return 0; discard: return 1; } ",0 " TestAutoFillManager(TabContents* tab_contents, TestPersonalDataManager* personal_manager) : AutoFillManager(tab_contents, personal_manager), autofill_enabled_(true) { set_metric_logger(new MockAutoFillMetrics); } ",0 "static void dispatchVoiceRadioTech(Parcel& p, RequestInfo *pRI) { RIL_RadioState state = CALL_ONSTATEREQUEST((RIL_SOCKET_ID)pRI->socket_id); if ((RADIO_STATE_UNAVAILABLE == state) || (RADIO_STATE_OFF == state)) { RIL_onRequestComplete(pRI, RIL_E_RADIO_NOT_AVAILABLE, NULL, 0); } if (RADIO_STATE_ON == state) { dispatchVoid(p, pRI); return; } voiceRadioTech = decodeVoiceRadioTechnology(state); if (voiceRadioTech < 0) RIL_onRequestComplete(pRI, RIL_E_GENERIC_FAILURE, NULL, 0); else RIL_onRequestComplete(pRI, RIL_E_SUCCESS, &voiceRadioTech, sizeof(int)); } ",0 "int platform_pm_poweroff(struct device *dev) { struct device_driver *drv = dev->driver; int ret = 0; if (!drv) return 0; if (drv->pm) { if (drv->pm->poweroff) ret = drv->pm->poweroff(dev); } else { ret = platform_legacy_suspend(dev, PMSG_HIBERNATE); } return ret; } ",0 "static void reflectedCustomBooleanAttrAttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.reflectedCustomBooleanAttr._set""); TestObj* imp = V8TestObj::toNative(info.Holder()); bool v = value->BooleanValue(); imp->setBooleanAttribute(WebCore::HTMLNames::customContentBooleanAttrAttr, v); return; } ",0 " bool IsAllowedScript(const Extension* extension, const GURL& url, int tab_id) { return extension->permissions_data()->CanAccessPage(extension, url, tab_id, nullptr); } ",0 "static void php_ifd_set16u(char *data, unsigned int value, int motorola_intel) { if (motorola_intel) { data[0] = (value & 0xFF00) >> 8; data[1] = (value & 0x00FF); } else { data[1] = (value & 0xFF00) >> 8; data[0] = (value & 0x00FF); } } ",0 "base::string16 BrowserView::GetAccessibleWindowTitle() const { return GetAccessibleWindowTitleForChannelAndProfile(chrome::GetChannel(), browser_->profile()); } ",0 "static void withScriptStateObjMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectV8Internal::withScriptStateObjMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " void FrameImpl::GoForward() { NOTIMPLEMENTED(); } ",1 " MockPageInfoUI* mock_ui() { return mock_ui_.get(); } ",0 " virtual ~PdfUnsupportedInfoBarDelegate() {} ",0 "void RenderBox::computePositionedLogicalHeightReplaced() { const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container()); const int containerLogicalHeight = containingBlockLogicalHeightForPositioned(containerBlock); bool isHorizontal = isHorizontalWritingMode(); bool isFlipped = style()->isFlippedBlocksWritingMode(); Length marginBefore = style()->marginBefore(); Length marginAfter = style()->marginAfter(); int& marginBeforeAlias = isHorizontal ? (isFlipped ? m_marginBottom : m_marginTop) : (isFlipped ? m_marginRight: m_marginLeft); int& marginAfterAlias = isHorizontal ? (isFlipped ? m_marginTop : m_marginBottom) : (isFlipped ? m_marginLeft: m_marginRight); Length logicalTop = style()->logicalTop(); Length logicalBottom = style()->logicalBottom(); /*-----------------------------------------------------------------------*\ * 1. The used value of 'height' is determined as for inline replaced * elements. \*-----------------------------------------------------------------------*/ setLogicalHeight(computeReplacedLogicalHeight() + borderAndPaddingLogicalHeight()); const int availableSpace = containerLogicalHeight - logicalHeight(); /*-----------------------------------------------------------------------*\ * 2. If both 'top' and 'bottom' have the value 'auto', replace 'top' * with the element's static position. \*-----------------------------------------------------------------------*/ computeBlockStaticDistance(logicalTop, logicalBottom, this, containerBlock); /*-----------------------------------------------------------------------*\ * 3. If 'bottom' is 'auto', replace any 'auto' on 'margin-top' or * 'margin-bottom' with '0'. \*-----------------------------------------------------------------------*/ if (logicalTop.isAuto() || logicalBottom.isAuto()) { if (marginBefore.isAuto()) marginBefore.setValue(Fixed, 0); if (marginAfter.isAuto()) marginAfter.setValue(Fixed, 0); } /*-----------------------------------------------------------------------*\ * 4. If at this point both 'margin-top' and 'margin-bottom' are still * 'auto', solve the equation under the extra constraint that the two * margins must get equal values. \*-----------------------------------------------------------------------*/ int logicalTopValue = 0; int logicalBottomValue = 0; if (marginBefore.isAuto() && marginAfter.isAuto()) { ASSERT(!(logicalTop.isAuto() || logicalBottom.isAuto())); logicalTopValue = logicalTop.calcValue(containerLogicalHeight); logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight); int difference = availableSpace - (logicalTopValue + logicalBottomValue); marginBeforeAlias = difference / 2; // split the difference marginAfterAlias = difference - marginBeforeAlias; // account for odd valued differences /*-----------------------------------------------------------------------*\ * 5. If at this point there is only one 'auto' left, solve the equation * for that value. \*-----------------------------------------------------------------------*/ } else if (logicalTop.isAuto()) { marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight); marginAfterAlias = marginAfter.calcValue(containerLogicalHeight); logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight); logicalTopValue = availableSpace - (logicalBottomValue + marginBeforeAlias + marginAfterAlias); } else if (logicalBottom.isAuto()) { marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight); marginAfterAlias = marginAfter.calcValue(containerLogicalHeight); logicalTopValue = logicalTop.calcValue(containerLogicalHeight); } else if (marginBefore.isAuto()) { marginAfterAlias = marginAfter.calcValue(containerLogicalHeight); logicalTopValue = logicalTop.calcValue(containerLogicalHeight); logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight); marginBeforeAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginAfterAlias); } else if (marginAfter.isAuto()) { marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight); logicalTopValue = logicalTop.calcValue(containerLogicalHeight); logicalBottomValue = logicalBottom.calcValue(containerLogicalHeight); marginAfterAlias = availableSpace - (logicalTopValue + logicalBottomValue + marginBeforeAlias); } else { marginBeforeAlias = marginBefore.calcValue(containerLogicalHeight); marginAfterAlias = marginAfter.calcValue(containerLogicalHeight); logicalTopValue = logicalTop.calcValue(containerLogicalHeight); } /*-----------------------------------------------------------------------*\ * 6. If at this point the values are over-constrained, ignore the value * for 'bottom' and solve for that value. \*-----------------------------------------------------------------------*/ int logicalTopPos = logicalTopValue + marginBeforeAlias; computeLogicalTopPositionedOffset(logicalTopPos, this, logicalHeight(), containerBlock, containerLogicalHeight); setLogicalTop(logicalTopPos); } ",0 " T42_Open_Face( T42_Face face ) { T42_LoaderRec loader; T42_Parser parser; T1_Font type1 = &face->type1; FT_Memory memory = face->root.memory; FT_Error error; PSAux_Service psaux = (PSAux_Service)face->psaux; t42_loader_init( &loader, face ); parser = &loader.parser; if ( FT_ALLOC( face->ttf_data, 12 ) ) goto Exit; /* while parsing the font we always update `face->ttf_size' so that */ /* even in case of buggy data (which might lead to premature end of */ /* scanning without causing an error) the call to `FT_Open_Face' in */ /* `T42_Face_Init' passes the correct size */ face->ttf_size = 12; error = t42_parser_init( parser, face->root.stream, memory, psaux); if ( error ) goto Exit; error = t42_parse_dict( face, &loader, parser->base_dict, parser->base_len ); if ( error ) goto Exit; if ( type1->font_type != 42 ) { FT_ERROR(( ""T42_Open_Face: cannot handle FontType %d\n"", type1->font_type )); error = FT_THROW( Unknown_File_Format ); goto Exit; } /* now, propagate the charstrings and glyphnames tables */ /* to the Type1 data */ type1->num_glyphs = loader.num_glyphs; if ( !loader.charstrings.init ) { FT_ERROR(( ""T42_Open_Face: no charstrings array in face\n"" )); error = FT_THROW( Invalid_File_Format ); } loader.charstrings.init = 0; type1->charstrings_block = loader.charstrings.block; type1->charstrings = loader.charstrings.elements; type1->charstrings_len = loader.charstrings.lengths; /* we copy the glyph names `block' and `elements' fields; */ /* the `lengths' field must be released later */ type1->glyph_names_block = loader.glyph_names.block; type1->glyph_names = (FT_String**)loader.glyph_names.elements; loader.glyph_names.block = 0; loader.glyph_names.elements = 0; /* we must now build type1.encoding when we have a custom array */ if ( type1->encoding_type == T1_ENCODING_TYPE_ARRAY ) { FT_Int charcode, idx, min_char, max_char; FT_Byte* glyph_name; /* OK, we do the following: for each element in the encoding */ /* table, look up the index of the glyph having the same name */ /* as defined in the CharStrings array. */ /* The index is then stored in type1.encoding.char_index, and */ /* the name in type1.encoding.char_name */ min_char = 0; max_char = 0; charcode = 0; for ( ; charcode < loader.encoding_table.max_elems; charcode++ ) { FT_Byte* char_name; type1->encoding.char_index[charcode] = 0; type1->encoding.char_name [charcode] = (char *)"".notdef""; char_name = loader.encoding_table.elements[charcode]; if ( char_name ) for ( idx = 0; idx < type1->num_glyphs; idx++ ) { glyph_name = (FT_Byte*)type1->glyph_names[idx]; if ( ft_strcmp( (const char*)char_name, (const char*)glyph_name ) == 0 ) { type1->encoding.char_index[charcode] = (FT_UShort)idx; type1->encoding.char_name [charcode] = (char*)glyph_name; /* Change min/max encoded char only if glyph name is */ /* not /.notdef */ if ( ft_strcmp( (const char*)"".notdef"", (const char*)glyph_name ) != 0 ) { if ( charcode < min_char ) min_char = charcode; if ( charcode >= max_char ) max_char = charcode + 1; } break; } } } type1->encoding.code_first = min_char; type1->encoding.code_last = max_char; type1->encoding.num_chars = loader.num_chars; } Exit: t42_loader_done( &loader ); return error; } ",0 "QuotaManager::QuotaManager(bool is_incognito, const FilePath& profile_path, base::SingleThreadTaskRunner* io_thread, base::SequencedTaskRunner* db_thread, SpecialStoragePolicy* special_storage_policy) : is_incognito_(is_incognito), profile_path_(profile_path), proxy_(new QuotaManagerProxy( ALLOW_THIS_IN_INITIALIZER_LIST(this), io_thread)), db_disabled_(false), eviction_disabled_(false), io_thread_(io_thread), db_thread_(db_thread), temporary_quota_initialized_(false), temporary_quota_override_(-1), desired_available_space_(-1), special_storage_policy_(special_storage_policy), weak_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), get_disk_space_fn_(&base::SysInfo::AmountOfFreeDiskSpace) { } ",0 "bool Document::setFocusedElement(Element* prpNewFocusedElement, const FocusParams& params) { DCHECK(!m_lifecycle.inDetach()); m_clearFocusedElementTimer.stop(); Element* newFocusedElement = prpNewFocusedElement; if (newFocusedElement && (newFocusedElement->document() != this)) return true; if (NodeChildRemovalTracker::isBeingRemoved(newFocusedElement)) return true; if (m_focusedElement == newFocusedElement) return true; bool focusChangeBlocked = false; Element* oldFocusedElement = m_focusedElement; m_focusedElement = nullptr; if (oldFocusedElement) { oldFocusedElement->setFocus(false); if (page() && (page()->focusController().isFocused())) { oldFocusedElement->dispatchBlurEvent(newFocusedElement, params.type, params.sourceCapabilities); if (m_focusedElement) { focusChangeBlocked = true; newFocusedElement = nullptr; } oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::focusout, newFocusedElement, params.sourceCapabilities); // DOM level 3 name for the bubbling blur event. oldFocusedElement->dispatchFocusOutEvent(EventTypeNames::DOMFocusOut, newFocusedElement, params.sourceCapabilities); // DOM level 2 name for compatibility. if (m_focusedElement) { focusChangeBlocked = true; newFocusedElement = nullptr; } } if (view()) { Widget* oldWidget = widgetForElement(*oldFocusedElement); if (oldWidget) oldWidget->setFocus(false, params.type); else view()->setFocus(false, params.type); } } if (newFocusedElement) updateStyleAndLayoutTreeForNode(newFocusedElement); if (newFocusedElement && newFocusedElement->isFocusable()) { if (newFocusedElement->isRootEditableElement() && !acceptsEditingFocus(*newFocusedElement)) { focusChangeBlocked = true; goto SetFocusedElementDone; } m_focusedElement = newFocusedElement; setSequentialFocusNavigationStartingPoint(m_focusedElement.get()); m_focusedElement->setFocus(true); if (m_focusedElement != newFocusedElement) { focusChangeBlocked = true; goto SetFocusedElementDone; } cancelFocusAppearanceUpdate(); m_focusedElement->updateFocusAppearance(params.selectionBehavior); if (page() && (page()->focusController().isFocused())) { m_focusedElement->dispatchFocusEvent(oldFocusedElement, params.type, params.sourceCapabilities); if (m_focusedElement != newFocusedElement) { focusChangeBlocked = true; goto SetFocusedElementDone; } m_focusedElement->dispatchFocusInEvent(EventTypeNames::focusin, oldFocusedElement, params.type, params.sourceCapabilities); // DOM level 3 bubbling focus event. if (m_focusedElement != newFocusedElement) { focusChangeBlocked = true; goto SetFocusedElementDone; } m_focusedElement->dispatchFocusInEvent(EventTypeNames::DOMFocusIn, oldFocusedElement, params.type, params.sourceCapabilities); // DOM level 2 for compatibility. if (m_focusedElement != newFocusedElement) { focusChangeBlocked = true; goto SetFocusedElementDone; } } if (m_focusedElement->isRootEditableElement()) frame()->spellChecker().didBeginEditing(m_focusedElement.get()); if (view()) { Widget* focusWidget = widgetForElement(*m_focusedElement); if (focusWidget) { updateStyleAndLayout(); focusWidget = widgetForElement(*m_focusedElement); } if (focusWidget) focusWidget->setFocus(true, params.type); else view()->setFocus(true, params.type); } } if (!focusChangeBlocked && m_focusedElement) { if (AXObjectCache* cache = axObjectCache()) cache->handleFocusedUIElementChanged(oldFocusedElement, newFocusedElement); } if (!focusChangeBlocked && frameHost()) frameHost()->chromeClient().focusedNodeChanged(oldFocusedElement, m_focusedElement.get()); SetFocusedElementDone: updateStyleAndLayoutTree(); if (LocalFrame* frame = this->frame()) frame->selection().didChangeFocus(); return !focusChangeBlocked; } ",0 "void Pack(const float* source, float* destination, unsigned pixels_per_row) { for (unsigned i = 0; i < pixels_per_row; ++i) { float scale_factor = source[3]; destination[0] = source[0] * scale_factor; destination[1] = source[1] * scale_factor; destination[2] = source[2] * scale_factor; destination[3] = source[3]; source += 4; destination += 4; } } ",0 "txid_current(PG_FUNCTION_ARGS) { txid val; TxidEpoch state; /* * Must prevent during recovery because if an xid is not assigned we try * to assign one, which would fail. Programs already rely on this function * to always return a valid current xid, so we should not change this to * return NULL or similar invalid xid. */ PreventCommandDuringRecovery(""txid_current()""); load_xid_epoch(&state); val = convert_xid(GetTopTransactionId(), &state); PG_RETURN_INT64(val); } ",0 "int skb_vlan_push(struct sk_buff *skb, __be16 vlan_proto, u16 vlan_tci) { if (skb_vlan_tag_present(skb)) { int offset = skb->data - skb_mac_header(skb); int err; if (WARN_ONCE(offset, ""skb_vlan_push got skb with skb->data not at mac header (offset %d)\n"", offset)) { return -EINVAL; } err = __vlan_insert_tag(skb, skb->vlan_proto, skb_vlan_tag_get(skb)); if (err) return err; skb->protocol = skb->vlan_proto; skb->mac_len += VLAN_HLEN; skb_postpush_rcsum(skb, skb->data + (2 * ETH_ALEN), VLAN_HLEN); } __vlan_hwaccel_put_tag(skb, vlan_proto, vlan_tci); return 0; } ",0 "void Editor::PasteAsPlainText(EditorCommandSource source) { if (TryDHTMLPaste(kPlainTextOnly)) return; if (!CanPaste()) return; GetFrame().GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); if (source == kCommandFromMenuOrKeyBinding && !GetFrame().Selection().SelectionHasFocus()) return; GetSpellChecker().UpdateMarkersForWordsAffectedByEditing(false); PasteAsPlainTextWithPasteboard(Pasteboard::GeneralPasteboard()); } ",0 "void Reverb_free(ReverbContext *pContext){ LVREV_ReturnStatus_en LvmStatus=LVREV_SUCCESS; /* Function call status */ LVREV_ControlParams_st params; /* Control Parameters */ LVREV_MemoryTable_st MemTab; /* Free the algorithm memory */ LvmStatus = LVREV_GetMemoryTable(pContext->hInstance, &MemTab, LVM_NULL); LVM_ERROR_CHECK(LvmStatus, ""LVM_GetMemoryTable"", ""Reverb_free"") for (int i=0; ibusy = 0; devc->v_alloc->max_voice = devc->nr_voice = (devc->model == 2) ? 18 : 9; devc->fm_info.nr_drums = 0; devc->fm_info.perc_mode = 0; opl3_reset(dev); } ",0 "aodv_v6_rreq(netdissect_options *ndo, const u_char *dat, u_int length) { u_int i; const struct aodv_rreq6 *ap = (const struct aodv_rreq6 *)dat; ND_TCHECK(*ap); if (length < sizeof(*ap)) goto trunc; ND_PRINT((ndo, "" v6 rreq %u %s%s%s%s%shops %u id 0x%08lx\n"" ""\tdst %s seq %lu src %s seq %lu"", length, ap->rreq_type & RREQ_JOIN ? ""[J]"" : """", ap->rreq_type & RREQ_REPAIR ? ""[R]"" : """", ap->rreq_type & RREQ_GRAT ? ""[G]"" : """", ap->rreq_type & RREQ_DEST ? ""[D]"" : """", ap->rreq_type & RREQ_UNKNOWN ? ""[U] "" : "" "", ap->rreq_hops, (unsigned long)EXTRACT_32BITS(&ap->rreq_id), ip6addr_string(ndo, &ap->rreq_da), (unsigned long)EXTRACT_32BITS(&ap->rreq_ds), ip6addr_string(ndo, &ap->rreq_oa), (unsigned long)EXTRACT_32BITS(&ap->rreq_os))); i = length - sizeof(*ap); if (i >= sizeof(struct aodv_ext)) aodv_extension(ndo, (const struct aodv_ext *)(dat + sizeof(*ap)), i); return; trunc: ND_PRINT((ndo, "" [|rreq"")); } ",0 "void Document::removeFocusedElementOfSubtree(Node* node, bool amongChildrenOnly) { if (!m_focusedElement) return; if (!node->inShadowIncludingDocument()) return; bool contains = node->isShadowIncludingInclusiveAncestorOf(m_focusedElement.get()); if (contains && (m_focusedElement != node || !amongChildrenOnly)) clearFocusedElement(); } ",0 "static __net_exit void dccp_net_exit(struct net *net) { nf_ct_l4proto_pernet_unregister(net, &dccp_proto6); nf_ct_l4proto_pernet_unregister(net, &dccp_proto4); } ",0 "find_check_entry(struct ipt_entry *e, struct net *net, const char *name, unsigned int size) { struct xt_entry_target *t; struct xt_target *target; int ret; unsigned int j; struct xt_mtchk_param mtpar; struct xt_entry_match *ematch; e->counters.pcnt = xt_percpu_counter_alloc(); if (IS_ERR_VALUE(e->counters.pcnt)) return -ENOMEM; j = 0; mtpar.net = net; mtpar.table = name; mtpar.entryinfo = &e->ip; mtpar.hook_mask = e->comefrom; mtpar.family = NFPROTO_IPV4; xt_ematch_foreach(ematch, e) { ret = find_check_match(ematch, &mtpar); if (ret != 0) goto cleanup_matches; ++j; } t = ipt_get_target(e); target = xt_request_find_target(NFPROTO_IPV4, t->u.user.name, t->u.user.revision); if (IS_ERR(target)) { duprintf(""find_check_entry: `%s' not found\n"", t->u.user.name); ret = PTR_ERR(target); goto cleanup_matches; } t->u.kernel.target = target; ret = check_target(e, net, name); if (ret) goto err; return 0; err: module_put(t->u.kernel.target->me); cleanup_matches: xt_ematch_foreach(ematch, e) { if (j-- == 0) break; cleanup_match(ematch, net); } xt_percpu_counter_free(e->counters.pcnt); return ret; } ",0 "DWORD UnprivilegedProcessDelegate::GetExitCode() { DCHECK(main_task_runner_->BelongsToCurrentThread()); DWORD exit_code = CONTROL_C_EXIT; if (worker_process_.IsValid()) { if (!::GetExitCodeProcess(worker_process_, &exit_code)) { LOG_GETLASTERROR(INFO) << ""Failed to query the exit code of the worker process""; exit_code = CONTROL_C_EXIT; } } return exit_code; } ",1 "HTTP_Copy(struct http *to, const struct http * const fm) { to->conds = fm->conds; to->logtag = fm->logtag; to->status = fm->status; to->protover = fm->protover; to->nhd = fm->nhd; assert(fm->nhd <= to->shd); memcpy(to->hd, fm->hd, fm->nhd * sizeof *to->hd); memcpy(to->hdf, fm->hdf, fm->nhd * sizeof *to->hdf); } ",0 "void sched_setnuma(struct task_struct *p, int nid) { bool queued, running; struct rq_flags rf; struct rq *rq; rq = task_rq_lock(p, &rf); queued = task_on_rq_queued(p); running = task_current(rq, p); if (queued) dequeue_task(rq, p, DEQUEUE_SAVE); if (running) put_prev_task(rq, p); p->numa_preferred_nid = nid; if (running) p->sched_class->set_curr_task(rq); if (queued) enqueue_task(rq, p, ENQUEUE_RESTORE); task_rq_unlock(rq, p, &rf); } ",0 "MYSQLND_METHOD(mysqlnd_conn_data, simple_command_handle_response)(MYSQLND_CONN_DATA * conn, enum mysqlnd_packet_type ok_packet, zend_bool silent, enum php_mysqlnd_server_command command, zend_bool ignore_upsert_status TSRMLS_DC) { enum_func_status ret = FAIL; DBG_ENTER(""mysqlnd_conn_data::simple_command_handle_response""); DBG_INF_FMT(""silent=%u packet=%u command=%s"", silent, ok_packet, mysqlnd_command_to_text[command]); switch (ok_packet) { case PROT_OK_PACKET:{ MYSQLND_PACKET_OK * ok_response = conn->protocol->m.get_ok_packet(conn->protocol, FALSE TSRMLS_CC); if (!ok_response) { SET_OOM_ERROR(*conn->error_info); break; } if (FAIL == (ret = PACKET_READ(ok_response, conn))) { if (!silent) { DBG_ERR_FMT(""Error while reading %s's OK packet"", mysqlnd_command_to_text[command]); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Error while reading %s's OK packet. PID=%u"", mysqlnd_command_to_text[command], getpid()); } } else { DBG_INF_FMT(""OK from server""); if (0xFF == ok_response->field_count) { /* The server signalled error. Set the error */ SET_CLIENT_ERROR(*conn->error_info, ok_response->error_no, ok_response->sqlstate, ok_response->error); ret = FAIL; /* Cover a protocol design error: error packet does not contain the server status. Therefore, the client has no way to find out whether there are more result sets of a multiple-result-set statement pending. Luckily, in 5.0 an error always aborts execution of a statement, wherever it is a multi-statement or a stored procedure, so it should be safe to unconditionally turn off the flag here. */ conn->upsert_status->server_status &= ~SERVER_MORE_RESULTS_EXISTS; SET_ERROR_AFF_ROWS(conn); } else { SET_NEW_MESSAGE(conn->last_message, conn->last_message_len, ok_response->message, ok_response->message_len, conn->persistent); if (!ignore_upsert_status) { memset(conn->upsert_status, 0, sizeof(*conn->upsert_status)); conn->upsert_status->warning_count = ok_response->warning_count; conn->upsert_status->server_status = ok_response->server_status; conn->upsert_status->affected_rows = ok_response->affected_rows; conn->upsert_status->last_insert_id = ok_response->last_insert_id; } } } PACKET_FREE(ok_response); break; } case PROT_EOF_PACKET:{ MYSQLND_PACKET_EOF * ok_response = conn->protocol->m.get_eof_packet(conn->protocol, FALSE TSRMLS_CC); if (!ok_response) { SET_OOM_ERROR(*conn->error_info); break; } if (FAIL == (ret = PACKET_READ(ok_response, conn))) { SET_CLIENT_ERROR(*conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, ""Malformed packet""); if (!silent) { DBG_ERR_FMT(""Error while reading %s's EOF packet"", mysqlnd_command_to_text[command]); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Error while reading %s's EOF packet. PID=%d"", mysqlnd_command_to_text[command], getpid()); } } else if (0xFF == ok_response->field_count) { /* The server signalled error. Set the error */ SET_CLIENT_ERROR(*conn->error_info, ok_response->error_no, ok_response->sqlstate, ok_response->error); SET_ERROR_AFF_ROWS(conn); } else if (0xFE != ok_response->field_count) { SET_CLIENT_ERROR(*conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, ""Malformed packet""); if (!silent) { DBG_ERR_FMT(""EOF packet expected, field count wasn't 0xFE but 0x%2X"", ok_response->field_count); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""EOF packet expected, field count wasn't 0xFE but 0x%2X"", ok_response->field_count); } } else { DBG_INF_FMT(""OK from server""); } PACKET_FREE(ok_response); break; } default: SET_CLIENT_ERROR(*conn->error_info, CR_MALFORMED_PACKET, UNKNOWN_SQLSTATE, ""Malformed packet""); php_error_docref(NULL TSRMLS_CC, E_ERROR, ""Wrong response packet %u passed to the function"", ok_packet); break; } DBG_INF(ret == PASS ? ""PASS"":""FAIL""); DBG_RETURN(ret); } ",0 "static struct rpc_task * __rpc_wake_up_next_priority(struct rpc_wait_queue *queue) { struct list_head *q; struct rpc_task *task; /* * Service a batch of tasks from a single owner. */ q = &queue->tasks[queue->priority]; if (!list_empty(q)) { task = list_entry(q->next, struct rpc_task, u.tk_wait.list); if (queue->owner == task->tk_owner) { if (--queue->nr) goto out; list_move_tail(&task->u.tk_wait.list, q); } /* * Check if we need to switch queues. */ if (--queue->count) goto new_owner; } /* * Service the next queue. */ do { if (q == &queue->tasks[0]) q = &queue->tasks[queue->maxpriority]; else q = q - 1; if (!list_empty(q)) { task = list_entry(q->next, struct rpc_task, u.tk_wait.list); goto new_queue; } } while (q != &queue->tasks[queue->priority]); rpc_reset_waitqueue_priority(queue); return NULL; new_queue: rpc_set_waitqueue_priority(queue, (unsigned int)(q - &queue->tasks[0])); new_owner: rpc_set_waitqueue_owner(queue, task->tk_owner); out: rpc_wake_up_task_queue_locked(queue, task); return task; } ",0 "void Document::SetTitleElement(Element* title_element) { if (IsSVGSVGElement(documentElement())) { title_element_ = Traversal::FirstChild(*documentElement()); } else { if (title_element_ && title_element_ != title_element) title_element_ = Traversal::FirstWithin(*this); else title_element_ = title_element; if (IsSVGTitleElement(title_element_)) { title_element_ = nullptr; return; } } if (auto* html_title = ToHTMLTitleElementOrNull(title_element_)) UpdateTitle(html_title->text()); else if (auto* svg_title = ToSVGTitleElementOrNull(title_element_)) UpdateTitle(svg_title->textContent()); } ",0 "void RenderProcessHostImpl::Cleanup() { if (render_widget_hosts_.IsEmpty()) { DCHECK_EQ(0, pending_views_); NotificationService::current()->Notify( NOTIFICATION_RENDERER_PROCESS_TERMINATED, Source(this), NotificationService::NoDetails()); MessageLoop::current()->DeleteSoon(FROM_HERE, this); deleting_soon_ = true; channel_.reset(); gpu_message_filter_ = NULL; UnregisterHost(GetID()); } } ",0 "static void ss_wakeup(struct list_head *h, int kill) { struct msg_sender *mss, *t; list_for_each_entry_safe(mss, t, h, list) { if (kill) mss->list.next = NULL; wake_up_process(mss->tsk); } } ",0 "static inline u32 armv8pmu_getreset_flags(void) { u32 value; /* Read */ asm volatile(""mrs %0, pmovsclr_el0"" : ""=r"" (value)); /* Write to clear flags */ value &= ARMV8_OVSR_MASK; asm volatile(""msr pmovsclr_el0, %0"" :: ""r"" (value)); return value; } ",0 "SPR_Delete(struct rx_call *call, afs_int32 aid) { afs_int32 code; afs_int32 cid = ANONYMOUSID; code = Delete(call, aid, &cid); osi_auditU(call, PTS_DelEvent, code, AUD_ID, aid, AUD_END); ViceLog(5, (""PTS_Delete: code %d cid %d aid %d\n"", code, cid, aid)); return code; } ",0 "void WebContentsImpl::SetFocusedFrame(FrameTreeNode* node, SiteInstance* source) { SetAsFocusedWebContentsIfNecessary(); frame_tree_.SetFocusedFrame(node, source); WebContentsImpl* inner_contents = node_.GetInnerWebContentsInFrame(node); WebContentsImpl* contents_to_focus = inner_contents ? inner_contents : this; contents_to_focus->SetAsFocusedWebContentsIfNecessary(); } ",0 "static void nfs4_xdr_enc_getdevicelist(struct rpc_rqst *req, struct xdr_stream *xdr, struct nfs4_getdevicelist_args *args) { struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->seq_args), }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->seq_args, &hdr); encode_putfh(xdr, args->fh, &hdr); encode_getdevicelist(xdr, args, &hdr); encode_nops(&hdr); } ",0 "void UrlFetcher::Core::CancelRequest() { if (request_.get()) { request_->Cancel(); request_.reset(); } } ",0 "void MainThreadFrameObserver::Wait() { DCHECK_CURRENTLY_ON(BrowserThread::UI); render_widget_host_->Send(new ViewMsg_WaitForNextFrameForTests( render_widget_host_->GetRoutingID(), routing_id_)); run_loop_.reset(new base::RunLoop()); run_loop_->Run(); run_loop_.reset(nullptr); } ",0 "int vp9_alloc_context_buffers(VP9_COMMON *cm, int width, int height) { int new_mi_size; vp9_set_mb_mi(cm, width, height); new_mi_size = cm->mi_stride * calc_mi_size(cm->mi_rows); if (cm->mi_alloc_size < new_mi_size) { cm->free_mi(cm); if (cm->alloc_mi(cm, new_mi_size)) goto fail; } if (cm->seg_map_alloc_size < cm->mi_rows * cm->mi_cols) { free_seg_map(cm); if (alloc_seg_map(cm, cm->mi_rows * cm->mi_cols)) goto fail; } if (cm->above_context_alloc_cols < cm->mi_cols) { vpx_free(cm->above_context); cm->above_context = (ENTROPY_CONTEXT *)vpx_calloc( 2 * mi_cols_aligned_to_sb(cm->mi_cols) * MAX_MB_PLANE, sizeof(*cm->above_context)); if (!cm->above_context) goto fail; vpx_free(cm->above_seg_context); cm->above_seg_context = (PARTITION_CONTEXT *)vpx_calloc( mi_cols_aligned_to_sb(cm->mi_cols), sizeof(*cm->above_seg_context)); if (!cm->above_seg_context) goto fail; cm->above_context_alloc_cols = cm->mi_cols; } return 0; fail: vp9_free_context_buffers(cm); return 1; } ",1 "xps_draw_arc(fz_context *doc, fz_path *path, float size_x, float size_y, float rotation_angle, int is_large_arc, int is_clockwise, float point_x, float point_y) { fz_matrix rotmat, revmat; fz_matrix mtx; fz_point pt; float rx, ry; float x1, y1, x2, y2; float x1t, y1t; float cxt, cyt, cx, cy; float t1, t2, t3; float sign; float th1, dth; pt = fz_currentpoint(doc, path); x1 = pt.x; y1 = pt.y; x2 = point_x; y2 = point_y; rx = size_x; ry = size_y; if (is_clockwise != is_large_arc) sign = 1; else sign = -1; fz_rotate(&rotmat, rotation_angle); fz_rotate(&revmat, -rotation_angle); /* http://www.w3.org/TR/SVG11/implnote.html#ArcImplementationNotes */ /* Conversion from endpoint to center parameterization */ /* F.6.6.1 -- ensure radii are positive and non-zero */ rx = fabsf(rx); ry = fabsf(ry); if (rx < 0.001f || ry < 0.001f || (x1 == x2 && y1 == y2)) { fz_lineto(doc, path, x2, y2); return; } /* F.6.5.1 */ pt.x = (x1 - x2) / 2; pt.y = (y1 - y2) / 2; fz_transform_vector(&pt, &revmat); x1t = pt.x; y1t = pt.y; /* F.6.6.2 -- ensure radii are large enough */ t1 = (x1t * x1t) / (rx * rx) + (y1t * y1t) / (ry * ry); if (t1 > 1) { rx = rx * sqrtf(t1); ry = ry * sqrtf(t1); } /* F.6.5.2 */ t1 = (rx * rx * ry * ry) - (rx * rx * y1t * y1t) - (ry * ry * x1t * x1t); t2 = (rx * rx * y1t * y1t) + (ry * ry * x1t * x1t); t3 = t1 / t2; /* guard against rounding errors; sqrt of negative numbers is bad for your health */ if (t3 < 0) t3 = 0; t3 = sqrtf(t3); cxt = sign * t3 * (rx * y1t) / ry; cyt = sign * t3 * -(ry * x1t) / rx; /* F.6.5.3 */ pt.x = cxt; pt.y = cyt; fz_transform_vector(&pt, &rotmat); cx = pt.x + (x1 + x2) / 2; cy = pt.y + (y1 + y2) / 2; /* F.6.5.4 */ { fz_point coord1, coord2, coord3, coord4; coord1.x = 1; coord1.y = 0; coord2.x = (x1t - cxt) / rx; coord2.y = (y1t - cyt) / ry; coord3.x = (x1t - cxt) / rx; coord3.y = (y1t - cyt) / ry; coord4.x = (-x1t - cxt) / rx; coord4.y = (-y1t - cyt) / ry; th1 = angle_between(coord1, coord2); dth = angle_between(coord3, coord4); if (dth < 0 && !is_clockwise) dth += (((float)M_PI / 180) * 360); if (dth > 0 && is_clockwise) dth -= (((float)M_PI / 180) * 360); } fz_pre_scale(fz_pre_rotate(fz_translate(&mtx, cx, cy), rotation_angle), rx, ry); xps_draw_arc_segment(doc, path, &mtx, th1, th1 + dth, is_clockwise); fz_lineto(doc, path, point_x, point_y); } ",0 "AwBrowserPermissionRequestDelegate* AwBrowserPermissionRequestDelegate::FromID( int render_process_id, int render_frame_id) { AwContents* aw_contents = AwContents::FromWebContents( content::WebContents::FromRenderFrameHost( content::RenderFrameHost::FromID(render_process_id, render_frame_id))); return aw_contents; } ",0 "onig_is_in_code_range(const UChar* p, OnigCodePoint code) { OnigCodePoint n, *data; OnigCodePoint low, high, x; GET_CODE_POINT(n, p); data = (OnigCodePoint* )p; data++; for (low = 0, high = n; low < high; ) { x = (low + high) >> 1; if (code > data[x * 2 + 1]) low = x + 1; else high = x; } return ((low < n && code >= data[low * 2]) ? 1 : 0); } ",0 "void btif_config_save(void) { assert(alarm_timer != NULL); assert(config != NULL); alarm_set(alarm_timer, CONFIG_SETTLE_PERIOD_MS, timer_config_save_cb, NULL); } ",0 "bool TestDataReductionProxyConfig::GetIsCaptivePortal() const { return is_captive_portal_; } ",0 "QWebKitTest* QQuickWebViewExperimental::test() { return m_test; } ",0 "update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se) { /* * We are starting a new run period: */ se->exec_start = rq_clock_task(rq_of(cfs_rq)); } ",0 "IW_IMPL(void*) iw_get_userdata(struct iw_context *ctx) { return ctx->userdata; } ",0 "int inet_dgram_connect(struct socket *sock, struct sockaddr *uaddr, int addr_len, int flags) { struct sock *sk = sock->sk; if (addr_len < sizeof(uaddr->sa_family)) return -EINVAL; if (uaddr->sa_family == AF_UNSPEC) return sk->sk_prot->disconnect(sk, flags); if (!inet_sk(sk)->inet_num && inet_autobind(sk)) return -EAGAIN; return sk->sk_prot->connect(sk, uaddr, addr_len); } ",0 "static int check_target(struct ip6t_entry *e, struct net *net, const char *name) { struct xt_entry_target *t = ip6t_get_target(e); struct xt_tgchk_param par = { .net = net, .table = name, .entryinfo = e, .target = t->u.kernel.target, .targinfo = t->data, .hook_mask = e->comefrom, .family = NFPROTO_IPV6, }; t = ip6t_get_target(e); return xt_check_target(&par, t->u.target_size - sizeof(*t), e->ipv6.proto, e->ipv6.invflags & IP6T_INV_PROTO); } ",0 "hfs_cat_get_record_offset_cb(HFS_INFO * hfs, int8_t level_type, const hfs_btree_key_cat * cur_key, TSK_OFF_T key_off, void *ptr) { HFS_CAT_GET_RECORD_OFFSET_DATA *offset_data = (HFS_CAT_GET_RECORD_OFFSET_DATA *)ptr; const hfs_btree_key_cat *targ_key = offset_data->targ_key; if (tsk_verbose) tsk_fprintf(stderr, ""hfs_cat_get_record_offset_cb: %s node want: %"" PRIu32 "" vs have: %"" PRIu32 ""\n"", (level_type == HFS_BT_NODE_TYPE_IDX) ? ""Index"" : ""Leaf"", tsk_getu32(hfs->fs_info.endian, targ_key->parent_cnid), tsk_getu32(hfs->fs_info.endian, cur_key->parent_cnid)); if (level_type == HFS_BT_NODE_TYPE_IDX) { int diff = hfs_cat_compare_keys(hfs, cur_key, targ_key); if (diff < 0) return HFS_BTREE_CB_IDX_LT; else return HFS_BTREE_CB_IDX_EQGT; } else { int diff = hfs_cat_compare_keys(hfs, cur_key, targ_key); if (diff < 0) { return HFS_BTREE_CB_LEAF_GO; } else if (diff == 0) { offset_data->off = key_off + 2 + tsk_getu16(hfs->fs_info.endian, cur_key->key_len); } return HFS_BTREE_CB_LEAF_STOP; } } ",0 "xmlXPathCacheWrapString(xmlXPathContextPtr ctxt, xmlChar *val) { if ((ctxt != NULL) && (ctxt->cache != NULL)) { xmlXPathContextCachePtr cache = (xmlXPathContextCachePtr) ctxt->cache; if ((cache->stringObjs != NULL) && (cache->stringObjs->number != 0)) { xmlXPathObjectPtr ret; ret = (xmlXPathObjectPtr) cache->stringObjs->items[--cache->stringObjs->number]; ret->type = XPATH_STRING; ret->stringval = val; #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING); #endif return(ret); } else if ((cache->miscObjs != NULL) && (cache->miscObjs->number != 0)) { xmlXPathObjectPtr ret; /* * Fallback to misc-cache. */ ret = (xmlXPathObjectPtr) cache->miscObjs->items[--cache->miscObjs->number]; ret->type = XPATH_STRING; ret->stringval = val; #ifdef XP_DEBUG_OBJ_USAGE xmlXPathDebugObjUsageRequested(ctxt, XPATH_STRING); #endif return(ret); } } return(xmlXPathWrapString(val)); } ",0 "bool PaintLayerScrollableArea::HasVerticalOverflow() const { LayoutUnit client_height = LayoutContentRect(kIncludeScrollbars).Height() - HorizontalScrollbarHeight(kIgnorePlatformAndCSSOverlayScrollbarSize); LayoutUnit scroll_height(ScrollHeight()); LayoutUnit box_y = GetLayoutBox()->Location().Y(); return SnapSizeToPixel(scroll_height, box_y) > SnapSizeToPixel(client_height, box_y); } ",0 "LRESULT HWNDMessageHandler::OnReflectedMessage(UINT message, WPARAM w_param, LPARAM l_param) { SetMsgHandled(FALSE); return 0; } ",0 "void WebGLRenderingContextBase::vertexAttrib2f(GLuint index, GLfloat v0, GLfloat v1) { if (isContextLost()) return; ContextGL()->VertexAttrib2f(index, v0, v1); SetVertexAttribType(index, kFloat32ArrayType); } ",0 "void virtio_notify(VirtIODevice *vdev, VirtQueue *vq) { if (!virtio_should_notify(vdev, vq)) { return; } trace_virtio_notify(vdev, vq); vdev->isr |= 0x01; virtio_notify_vector(vdev, vq->vector); } ",0 "kauth_reply_print(netdissect_options *ndo, register const u_char *bp, int length, int32_t opcode) { const struct rx_header *rxh; if (length <= (int)sizeof(struct rx_header)) return; rxh = (const struct rx_header *) bp; /* * Print out the afs call we're invoking. The table used here was * gleaned from kauth/kauth.rg */ ND_PRINT((ndo, "" kauth"")); if (is_ubik(opcode)) { ubik_reply_print(ndo, bp, length, opcode); return; } ND_PRINT((ndo, "" reply %s"", tok2str(kauth_req, ""op#%d"", opcode))); bp += sizeof(struct rx_header); /* * If it was a data packet, interpret the response. */ if (rxh->type == RX_PACKET_TYPE_DATA) /* Well, no, not really. Leave this for later */ ; else { /* * Otherwise, just print out the return code */ ND_PRINT((ndo, "" errcode"")); INTOUT(); } return; trunc: ND_PRINT((ndo, "" [|kauth]"")); } ",0 "void HTMLFormControlElement::findCustomValidationMessageTextDirection( const String& message, TextDirection& messageDir, String& subMessage, TextDirection& subMessageDir) { messageDir = determineDirectionality(message); if (!subMessage.isEmpty()) subMessageDir = layoutObject()->style()->direction(); } ",0 "void AudioHandler::AdjustVolumeByPercent(double adjust_by_percent) { const double old_volume_db = mixer_->GetVolumeDb(); const double old_percent = VolumeDbToPercent(old_volume_db); SetVolumePercent(old_percent + adjust_by_percent); } ",0 "esis_print(netdissect_options *ndo, const uint8_t *pptr, u_int length) { const uint8_t *optr; u_int li,esis_pdu_type,source_address_length, source_address_number; const struct esis_header_t *esis_header; if (!ndo->ndo_eflag) ND_PRINT((ndo, ""ES-IS"")); if (length <= 2) { ND_PRINT((ndo, ndo->ndo_qflag ? ""bad pkt!"" : ""no header at all!"")); return; } esis_header = (const struct esis_header_t *) pptr; ND_TCHECK(*esis_header); li = esis_header->length_indicator; optr = pptr; /* * Sanity checking of the header. */ if (esis_header->nlpid != NLPID_ESIS) { ND_PRINT((ndo, "" nlpid 0x%02x packet not supported"", esis_header->nlpid)); return; } if (esis_header->version != ESIS_VERSION) { ND_PRINT((ndo, "" version %d packet not supported"", esis_header->version)); return; } if (li > length) { ND_PRINT((ndo, "" length indicator(%u) > PDU size (%u)!"", li, length)); return; } if (li < sizeof(struct esis_header_t) + 2) { ND_PRINT((ndo, "" length indicator %u < min PDU size:"", li)); while (pptr < ndo->ndo_snapend) ND_PRINT((ndo, ""%02X"", *pptr++)); return; } esis_pdu_type = esis_header->type & ESIS_PDU_TYPE_MASK; if (ndo->ndo_vflag < 1) { ND_PRINT((ndo, ""%s%s, length %u"", ndo->ndo_eflag ? """" : "", "", tok2str(esis_pdu_values,""unknown type (%u)"",esis_pdu_type), length)); return; } else ND_PRINT((ndo, ""%slength %u\n\t%s (%u)"", ndo->ndo_eflag ? """" : "", "", length, tok2str(esis_pdu_values,""unknown type: %u"", esis_pdu_type), esis_pdu_type)); ND_PRINT((ndo, "", v: %u%s"", esis_header->version, esis_header->version == ESIS_VERSION ? """" : ""unsupported"" )); ND_PRINT((ndo, "", checksum: 0x%04x"", EXTRACT_16BITS(esis_header->cksum))); osi_print_cksum(ndo, pptr, EXTRACT_16BITS(esis_header->cksum), 7, li); ND_PRINT((ndo, "", holding time: %us, length indicator: %u"", EXTRACT_16BITS(esis_header->holdtime), li)); if (ndo->ndo_vflag > 1) print_unknown_data(ndo, optr, ""\n\t"", sizeof(struct esis_header_t)); pptr += sizeof(struct esis_header_t); li -= sizeof(struct esis_header_t); switch (esis_pdu_type) { case ESIS_PDU_REDIRECT: { const uint8_t *dst, *snpa, *neta; u_int dstl, snpal, netal; ND_TCHECK(*pptr); if (li < 1) { ND_PRINT((ndo, "", bad redirect/li"")); return; } dstl = *pptr; pptr++; li--; ND_TCHECK2(*pptr, dstl); if (li < dstl) { ND_PRINT((ndo, "", bad redirect/li"")); return; } dst = pptr; pptr += dstl; li -= dstl; ND_PRINT((ndo, ""\n\t %s"", isonsap_string(ndo, dst, dstl))); ND_TCHECK(*pptr); if (li < 1) { ND_PRINT((ndo, "", bad redirect/li"")); return; } snpal = *pptr; pptr++; li--; ND_TCHECK2(*pptr, snpal); if (li < snpal) { ND_PRINT((ndo, "", bad redirect/li"")); return; } snpa = pptr; pptr += snpal; li -= snpal; ND_TCHECK(*pptr); if (li < 1) { ND_PRINT((ndo, "", bad redirect/li"")); return; } netal = *pptr; pptr++; ND_TCHECK2(*pptr, netal); if (li < netal) { ND_PRINT((ndo, "", bad redirect/li"")); return; } neta = pptr; pptr += netal; li -= netal; if (netal == 0) ND_PRINT((ndo, ""\n\t %s"", etheraddr_string(ndo, snpa))); else ND_PRINT((ndo, ""\n\t %s"", isonsap_string(ndo, neta, netal))); break; } case ESIS_PDU_ESH: ND_TCHECK(*pptr); if (li < 1) { ND_PRINT((ndo, "", bad esh/li"")); return; } source_address_number = *pptr; pptr++; li--; ND_PRINT((ndo, ""\n\t Number of Source Addresses: %u"", source_address_number)); while (source_address_number > 0) { ND_TCHECK(*pptr); if (li < 1) { ND_PRINT((ndo, "", bad esh/li"")); return; } source_address_length = *pptr; pptr++; li--; ND_TCHECK2(*pptr, source_address_length); if (li < source_address_length) { ND_PRINT((ndo, "", bad esh/li"")); return; } ND_PRINT((ndo, ""\n\t NET (length: %u): %s"", source_address_length, isonsap_string(ndo, pptr, source_address_length))); pptr += source_address_length; li -= source_address_length; source_address_number--; } break; case ESIS_PDU_ISH: { ND_TCHECK(*pptr); if (li < 1) { ND_PRINT((ndo, "", bad ish/li"")); return; } source_address_length = *pptr; pptr++; li--; ND_TCHECK2(*pptr, source_address_length); if (li < source_address_length) { ND_PRINT((ndo, "", bad ish/li"")); return; } ND_PRINT((ndo, ""\n\t NET (length: %u): %s"", source_address_length, isonsap_string(ndo, pptr, source_address_length))); pptr += source_address_length; li -= source_address_length; break; } default: if (ndo->ndo_vflag <= 1) { if (pptr < ndo->ndo_snapend) print_unknown_data(ndo, pptr, ""\n\t "", ndo->ndo_snapend - pptr); } return; } /* now walk the options */ while (li != 0) { u_int op, opli; const uint8_t *tptr; if (li < 2) { ND_PRINT((ndo, "", bad opts/li"")); return; } ND_TCHECK2(*pptr, 2); op = *pptr++; opli = *pptr++; li -= 2; if (opli > li) { ND_PRINT((ndo, "", opt (%d) too long"", op)); return; } li -= opli; tptr = pptr; ND_PRINT((ndo, ""\n\t %s Option #%u, length %u, value: "", tok2str(esis_option_values,""Unknown"",op), op, opli)); switch (op) { case ESIS_OPTION_ES_CONF_TIME: if (opli == 2) { ND_TCHECK2(*pptr, 2); ND_PRINT((ndo, ""%us"", EXTRACT_16BITS(tptr))); } else ND_PRINT((ndo, ""(bad length)"")); break; case ESIS_OPTION_PROTOCOLS: while (opli>0) { ND_TCHECK(*pptr); ND_PRINT((ndo, ""%s (0x%02x)"", tok2str(nlpid_values, ""unknown"", *tptr), *tptr)); if (opli>1) /* further NPLIDs ? - put comma */ ND_PRINT((ndo, "", "")); tptr++; opli--; } break; /* * FIXME those are the defined Options that lack a decoder * you are welcome to contribute code ;-) */ case ESIS_OPTION_QOS_MAINTENANCE: case ESIS_OPTION_SECURITY: case ESIS_OPTION_PRIORITY: case ESIS_OPTION_ADDRESS_MASK: case ESIS_OPTION_SNPA_MASK: default: print_unknown_data(ndo, tptr, ""\n\t "", opli); break; } if (ndo->ndo_vflag > 1) print_unknown_data(ndo, pptr, ""\n\t "", opli); pptr += opli; } trunc: return; } ",0 "int __mnt_is_readonly(struct vfsmount *mnt) { if (mnt->mnt_flags & MNT_READONLY) return 1; if (mnt->mnt_sb->s_flags & MS_RDONLY) return 1; return 0; } ",0 "static int http_server(void) { int server_fd = 0, rtsp_server_fd = 0; int ret, delay; struct pollfd *poll_table, *poll_entry; HTTPContext *c, *c_next; poll_table = av_mallocz_array(config.nb_max_http_connections + 2, sizeof(*poll_table)); if(!poll_table) { http_log(""Impossible to allocate a poll table handling %d "" ""connections.\n"", config.nb_max_http_connections); return -1; } if (config.http_addr.sin_port) { server_fd = socket_open_listen(&config.http_addr); if (server_fd < 0) goto quit; } if (config.rtsp_addr.sin_port) { rtsp_server_fd = socket_open_listen(&config.rtsp_addr); if (rtsp_server_fd < 0) { closesocket(server_fd); goto quit; } } if (!rtsp_server_fd && !server_fd) { http_log(""HTTP and RTSP disabled.\n""); goto quit; } http_log(""FFserver started.\n""); start_children(config.first_feed); start_multicast(); for(;;) { poll_entry = poll_table; if (server_fd) { poll_entry->fd = server_fd; poll_entry->events = POLLIN; poll_entry++; } if (rtsp_server_fd) { poll_entry->fd = rtsp_server_fd; poll_entry->events = POLLIN; poll_entry++; } /* wait for events on each HTTP handle */ c = first_http_ctx; delay = 1000; while (c) { int fd; fd = c->fd; switch(c->state) { case HTTPSTATE_SEND_HEADER: case RTSPSTATE_SEND_REPLY: case RTSPSTATE_SEND_PACKET: c->poll_entry = poll_entry; poll_entry->fd = fd; poll_entry->events = POLLOUT; poll_entry++; break; case HTTPSTATE_SEND_DATA_HEADER: case HTTPSTATE_SEND_DATA: case HTTPSTATE_SEND_DATA_TRAILER: if (!c->is_packetized) { /* for TCP, we output as much as we can * (may need to put a limit) */ c->poll_entry = poll_entry; poll_entry->fd = fd; poll_entry->events = POLLOUT; poll_entry++; } else { /* when ffserver is doing the timing, we work by * looking at which packet needs to be sent every * 10 ms (one tick wait XXX: 10 ms assumed) */ if (delay > 10) delay = 10; } break; case HTTPSTATE_WAIT_REQUEST: case HTTPSTATE_RECEIVE_DATA: case HTTPSTATE_WAIT_FEED: case RTSPSTATE_WAIT_REQUEST: /* need to catch errors */ c->poll_entry = poll_entry; poll_entry->fd = fd; poll_entry->events = POLLIN;/* Maybe this will work */ poll_entry++; break; default: c->poll_entry = NULL; break; } c = c->next; } /* wait for an event on one connection. We poll at least every * second to handle timeouts */ do { ret = poll(poll_table, poll_entry - poll_table, delay); if (ret < 0 && ff_neterrno() != AVERROR(EAGAIN) && ff_neterrno() != AVERROR(EINTR)) { goto quit; } } while (ret < 0); cur_time = av_gettime() / 1000; if (need_to_start_children) { need_to_start_children = 0; start_children(config.first_feed); } /* now handle the events */ for(c = first_http_ctx; c; c = c_next) { c_next = c->next; if (handle_connection(c) < 0) { log_connection(c); /* close and free the connection */ close_connection(c); } } poll_entry = poll_table; if (server_fd) { /* new HTTP connection request ? */ if (poll_entry->revents & POLLIN) new_connection(server_fd, 0); poll_entry++; } if (rtsp_server_fd) { /* new RTSP connection request ? */ if (poll_entry->revents & POLLIN) new_connection(rtsp_server_fd, 1); } } quit: av_free(poll_table); return -1; } ",0 "static void msg_mode(IRC_SERVER_REC *server, const char *channel, const char *sender, const char *addr, const char *data) { NETJOIN_REC *rec; char *params, *mode, *nicks; char **nicklist, **nick, type, prefix; int show; g_return_if_fail(data != NULL); if (!server_ischannel(SERVER(server), channel) || addr != NULL) return; params = event_get_params(data, 2 | PARAM_FLAG_GETREST, &mode, &nicks); /* parse server mode changes - hide operator status changes and show them in the netjoin message instead as @ before the nick */ nick = nicklist = g_strsplit(nicks, "" "", -1); type = '+'; show = FALSE; for (; *mode != '\0'; mode++) { if (*mode == '+' || *mode == '-') { type = *mode; continue; } if (*nick != NULL && GET_MODE_PREFIX(server, *mode)) { /* give/remove ops */ rec = netjoin_find(server, *nick); prefix = GET_MODE_PREFIX(server, *mode); if (rec == NULL || type != '+' || prefix == '\0' || !netjoin_set_nickmode(server, rec, channel, prefix)) show = TRUE; nick++; } else { if (HAS_MODE_ARG(server, type, *mode) && *nick != NULL) nick++; show = TRUE; } } if (!show) signal_stop(); g_strfreev(nicklist); g_free(params); } ",0 "ChooserContextBase::GetAllGrantedObjects() { ContentSettingsForOneType content_settings; host_content_settings_map_->GetSettingsForOneType( data_content_settings_type_, std::string(), &content_settings); std::vector> results; for (const ContentSettingPatternSource& content_setting : content_settings) { GURL requesting_origin(content_setting.primary_pattern.ToString()); GURL embedding_origin(content_setting.secondary_pattern.ToString()); if (!requesting_origin.is_valid() || !embedding_origin.is_valid()) continue; if (!CanRequestObjectPermission(requesting_origin, embedding_origin)) continue; content_settings::SettingInfo info; std::unique_ptr setting = GetWebsiteSetting(requesting_origin, embedding_origin, &info); base::ListValue* object_list; if (!setting->GetList(kObjectListKey, &object_list)) continue; for (auto& object : *object_list) { base::DictionaryValue* object_dict; if (!object.GetAsDictionary(&object_dict) || !IsValidObject(*object_dict)) { continue; } results.push_back(std::make_unique( requesting_origin, embedding_origin, object_dict, info.source, content_setting.incognito)); } } return results; } ",0 "static void keyring_describe(const struct key *keyring, struct seq_file *m) { if (keyring->description) seq_puts(m, keyring->description); else seq_puts(m, ""[anon]""); if (key_is_instantiated(keyring)) { if (keyring->keys.nr_leaves_on_tree != 0) seq_printf(m, "": %lu"", keyring->keys.nr_leaves_on_tree); else seq_puts(m, "": empty""); } } ",0 "NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue value) { ArrayStorage* storage = m_storage; SparseArrayValueMap* map = storage->m_sparseValueMap; if (i >= MIN_SPARSE_ARRAY_INDEX) { if (i > MAX_ARRAY_INDEX) { PutPropertySlot slot; put(exec, Identifier::from(exec, i), value, slot); return; } if ((i > MAX_STORAGE_VECTOR_INDEX) || !isDenseEnoughForVector(i + 1, storage->m_numValuesInVector + 1)) { if (!map) { map = new SparseArrayValueMap; storage->m_sparseValueMap = map; } WriteBarrier temp; pair result = map->add(i, temp); result.first->second.set(exec->globalData(), this, value); if (!result.second) // pre-existing entry return; size_t capacity = map->capacity(); if (capacity != storage->reportedMapCapacity) { Heap::heap(this)->reportExtraMemoryCost((capacity - storage->reportedMapCapacity) * (sizeof(unsigned) + sizeof(JSValue))); storage->reportedMapCapacity = capacity; } return; } } if (!map || map->isEmpty()) { if (increaseVectorLength(i + 1)) { storage = m_storage; storage->m_vector[i].set(exec->globalData(), this, value); ++storage->m_numValuesInVector; checkConsistency(); } else throwOutOfMemoryError(exec); return; } unsigned newNumValuesInVector = storage->m_numValuesInVector + 1; unsigned newVectorLength = getNewVectorLength(i + 1); for (unsigned j = max(m_vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j) newNumValuesInVector += map->contains(j); if (i >= MIN_SPARSE_ARRAY_INDEX) newNumValuesInVector -= map->contains(i); if (isDenseEnoughForVector(newVectorLength, newNumValuesInVector)) { unsigned needLength = max(i + 1, storage->m_length); unsigned proposedNewNumValuesInVector = newNumValuesInVector; while ((newVectorLength < needLength) && (newVectorLength < MAX_STORAGE_VECTOR_LENGTH)) { unsigned proposedNewVectorLength = getNewVectorLength(newVectorLength + 1); for (unsigned j = max(newVectorLength, MIN_SPARSE_ARRAY_INDEX); j < proposedNewVectorLength; ++j) proposedNewNumValuesInVector += map->contains(j); if (!isDenseEnoughForVector(proposedNewVectorLength, proposedNewNumValuesInVector)) break; newVectorLength = proposedNewVectorLength; newNumValuesInVector = proposedNewNumValuesInVector; } } void* baseStorage = storage->m_allocBase; if (!tryFastRealloc(baseStorage, storageSize(newVectorLength + m_indexBias)).getValue(baseStorage)) { throwOutOfMemoryError(exec); return; } m_storage = reinterpret_cast_ptr(static_cast(baseStorage) + m_indexBias * sizeof(JSValue)); m_storage->m_allocBase = baseStorage; storage = m_storage; unsigned vectorLength = m_vectorLength; WriteBarrier* vector = storage->m_vector; if (newNumValuesInVector == storage->m_numValuesInVector + 1) { for (unsigned j = vectorLength; j < newVectorLength; ++j) vector[j].clear(); if (i > MIN_SPARSE_ARRAY_INDEX) map->remove(i); } else { for (unsigned j = vectorLength; j < max(vectorLength, MIN_SPARSE_ARRAY_INDEX); ++j) vector[j].clear(); JSGlobalData& globalData = exec->globalData(); for (unsigned j = max(vectorLength, MIN_SPARSE_ARRAY_INDEX); j < newVectorLength; ++j) vector[j].set(globalData, this, map->take(j).get()); } ASSERT(i < newVectorLength); m_vectorLength = newVectorLength; storage->m_numValuesInVector = newNumValuesInVector; storage->m_vector[i].set(exec->globalData(), this, value); checkConsistency(); Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength)); } ",0 "static inline void fixup_objfreelist_debug(struct kmem_cache *cachep, void **list) { #if DEBUG void *next = *list; void *objp; while (next) { objp = next - obj_offset(cachep); next = *(void **)next; poison_obj(cachep, objp, POISON_FREE); } #endif } ",0 "R_API void r_bin_iobind(RBin *bin, RIO *io) { r_io_bind (io, &bin->iob); } ",0 "void ChromeContentBrowserClient::BindInterfaceRequestFromFrame( content::RenderFrameHost* render_frame_host, const std::string& interface_name, mojo::ScopedMessagePipeHandle interface_pipe) { if (!frame_interfaces_ && !frame_interfaces_parameterized_ && !worker_interfaces_parameterized_) { InitWebContextInterfaces(); } if (!frame_interfaces_parameterized_->TryBindInterface( interface_name, &interface_pipe, render_frame_host)) { frame_interfaces_->TryBindInterface(interface_name, &interface_pipe); } } ",0 "CSSStyleSheet::CSSStyleSheet(CSSRule* ownerRule, const String& href, const KURL& baseURL, const String& charset) : StyleSheet(ownerRule, href, baseURL) , m_namespaces(0) , m_charset(charset) , m_loadCompleted(false) , m_strictParsing(!ownerRule || ownerRule->useStrictParsing()) , m_hasSyntacticallyValidCSSHeader(true) { CSSStyleSheet* parentSheet = ownerRule ? ownerRule->parentStyleSheet() : 0; m_doc = parentSheet ? parentSheet->doc() : 0; m_isUserStyleSheet = parentSheet ? parentSheet->isUserStyleSheet() : false; } ",0 " static void ext4_invalidatepage(struct page *page, unsigned long offset) { journal_t *journal = EXT4_JOURNAL(page->mapping->host); /* * If it's a full truncate we just forget about the pending dirtying */ if (offset == 0) ClearPageChecked(page); if (journal) jbd2_journal_invalidatepage(journal, page, offset); else block_invalidatepage(page, offset); } ",1 "MODRET set_rewritehome(cmd_rec *cmd) { int bool = -1; config_rec *c = NULL; CHECK_ARGS(cmd, 1); CHECK_CONF(cmd, CONF_ROOT|CONF_VIRTUAL|CONF_GLOBAL); bool = get_boolean(cmd, 1); if (bool == -1) CONF_ERROR(cmd, ""expected Boolean parameter""); c = add_config_param(cmd->argv[0], 1, NULL); c->argv[0] = pcalloc(c->pool, sizeof(int)); *((int *) c->argv[0]) = bool; return PR_HANDLED(cmd); } ",0 " void CWebServer::RType_LightLog(WebEmSession & session, const request& req, Json::Value &root) { uint64_t idx = 0; if (request::findValue(&req, ""idx"") != """") { idx = std::strtoull(request::findValue(&req, ""idx"").c_str(), nullptr, 10); } std::vector > result; result = m_sql.safe_query(""SELECT Type, SubType, SwitchType, Options FROM DeviceStatus WHERE (ID == %"" PRIu64 "")"", idx); if (result.empty()) return; unsigned char dType = atoi(result[0][0].c_str()); unsigned char dSubType = atoi(result[0][1].c_str()); _eSwitchType switchtype = (_eSwitchType)atoi(result[0][2].c_str()); std::map options = m_sql.BuildDeviceOptions(result[0][3].c_str()); if ( (dType != pTypeLighting1) && (dType != pTypeLighting2) && (dType != pTypeLighting3) && (dType != pTypeLighting4) && (dType != pTypeLighting5) && (dType != pTypeLighting6) && (dType != pTypeFan) && (dType != pTypeColorSwitch) && (dType != pTypeSecurity1) && (dType != pTypeSecurity2) && (dType != pTypeEvohome) && (dType != pTypeEvohomeRelay) && (dType != pTypeCurtain) && (dType != pTypeBlinds) && (dType != pTypeRFY) && (dType != pTypeRego6XXValue) && (dType != pTypeChime) && (dType != pTypeThermostat2) && (dType != pTypeThermostat3) && (dType != pTypeThermostat4) && (dType != pTypeRemote) && (dType != pTypeGeneralSwitch) && (dType != pTypeHomeConfort) && (dType != pTypeFS20) && (!((dType == pTypeRadiator1) && (dSubType == sTypeSmartwaresSwitchRadiator))) ) return; //no light device! we should not be here! root[""status""] = ""OK""; root[""title""] = ""LightLog""; result = m_sql.safe_query(""SELECT ROWID, nValue, sValue, Date FROM LightingLog WHERE (DeviceRowID==%"" PRIu64 "") ORDER BY Date DESC"", idx); if (!result.empty()) { std::map selectorStatuses; if (switchtype == STYPE_Selector) { GetSelectorSwitchStatuses(options, selectorStatuses); } int ii = 0; for (const auto & itt : result) { std::vector sd = itt; int nValue = atoi(sd[1].c_str()); std::string sValue = sd[2]; if ((switchtype == STYPE_Media) && (sValue == ""0"")) continue; root[""result""][ii][""idx""] = sd[0]; std::string lstatus = """"; std::string ldata = """"; int llevel = 0; bool bHaveDimmer = false; bool bHaveSelector = false; bool bHaveGroupCmd = false; int maxDimLevel = 0; if (switchtype == STYPE_Media) { lstatus = sValue; ldata = lstatus; } else if (switchtype == STYPE_Selector) { if (ii == 0) { bHaveSelector = true; maxDimLevel = selectorStatuses.size(); } if (!selectorStatuses.empty()) { std::string sLevel = selectorStatuses[sValue]; ldata = sLevel; lstatus = ""Set Level: "" + sLevel; llevel = atoi(sValue.c_str()); } } else { GetLightStatus(dType, dSubType, switchtype, nValue, sValue, lstatus, llevel, bHaveDimmer, maxDimLevel, bHaveGroupCmd); ldata = lstatus; } if (ii == 0) { root[""HaveDimmer""] = bHaveDimmer; root[""result""][ii][""MaxDimLevel""] = maxDimLevel; root[""HaveGroupCmd""] = bHaveGroupCmd; root[""HaveSelector""] = bHaveSelector; } root[""result""][ii][""Date""] = sd[3]; root[""result""][ii][""Data""] = ldata; root[""result""][ii][""Status""] = lstatus; root[""result""][ii][""Level""] = llevel; ii++; } } } ",0 "static int ip_error(struct sk_buff *skb) { struct in_device *in_dev = __in_dev_get_rcu(skb->dev); struct rtable *rt = skb_rtable(skb); struct inet_peer *peer; unsigned long now; struct net *net; bool send; int code; /* IP on this device is disabled. */ if (!in_dev) goto out; net = dev_net(rt->dst.dev); if (!IN_DEV_FORWARD(in_dev)) { switch (rt->dst.error) { case EHOSTUNREACH: __IP_INC_STATS(net, IPSTATS_MIB_INADDRERRORS); break; case ENETUNREACH: __IP_INC_STATS(net, IPSTATS_MIB_INNOROUTES); break; } goto out; } switch (rt->dst.error) { case EINVAL: default: goto out; case EHOSTUNREACH: code = ICMP_HOST_UNREACH; break; case ENETUNREACH: code = ICMP_NET_UNREACH; __IP_INC_STATS(net, IPSTATS_MIB_INNOROUTES); break; case EACCES: code = ICMP_PKT_FILTERED; break; } peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, l3mdev_master_ifindex(skb->dev), 1); send = true; if (peer) { now = jiffies; peer->rate_tokens += now - peer->rate_last; if (peer->rate_tokens > ip_rt_error_burst) peer->rate_tokens = ip_rt_error_burst; peer->rate_last = now; if (peer->rate_tokens >= ip_rt_error_cost) peer->rate_tokens -= ip_rt_error_cost; else send = false; inet_putpeer(peer); } if (send) icmp_send(skb, ICMP_DEST_UNREACH, code, 0); out: kfree_skb(skb); return 0; } ",0 "void DocumentTimeline::pauseAnimationsForTesting(double pauseTime) { for (size_t i = 0; i < m_players.size(); i++) m_players[i]->pauseForTesting(pauseTime); serviceAnimations(); } ",0 "const char** lxc_va_arg_list_to_argv_const(va_list ap, size_t skip) { return (const char**)lxc_va_arg_list_to_argv(ap, skip, 0); } ",0 "void WebGLRenderingContextBase::ReadPixelsHelper(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, DOMArrayBufferView* pixels, GLuint offset) { if (isContextLost()) return; DCHECK(Host()->OriginClean()); if (!pixels) { SynthesizeGLError(GL_INVALID_VALUE, ""readPixels"", ""no destination ArrayBufferView""); return; } CheckedNumeric offset_in_bytes = offset; offset_in_bytes *= pixels->TypeSize(); if (!offset_in_bytes.IsValid() || offset_in_bytes.ValueOrDie() > pixels->byteLength()) { SynthesizeGLError(GL_INVALID_VALUE, ""readPixels"", ""destination offset out of range""); return; } const char* reason = ""framebuffer incomplete""; WebGLFramebuffer* framebuffer = GetReadFramebufferBinding(); if (framebuffer && framebuffer->CheckDepthStencilStatus(&reason) != GL_FRAMEBUFFER_COMPLETE) { SynthesizeGLError(GL_INVALID_FRAMEBUFFER_OPERATION, ""readPixels"", reason); return; } CheckedNumeric buffer_size = pixels->byteLength() - offset_in_bytes; if (!buffer_size.IsValid()) { SynthesizeGLError(GL_INVALID_VALUE, ""readPixels"", ""destination offset out of range""); return; } if (!ValidateReadPixelsFuncParameters(width, height, format, type, pixels, buffer_size.ValueOrDie())) { return; } ClearIfComposited(); uint8_t* data = static_cast(pixels->BaseAddressMaybeShared()) + offset_in_bytes.ValueOrDie(); { ScopedDrawingBufferBinder binder(GetDrawingBuffer(), framebuffer); ContextGL()->ReadPixels(x, y, width, height, format, type, data); } } ",0 "void Document::DidChangeVisibilityState() { DispatchEvent(*Event::CreateBubble(EventTypeNames::visibilitychange)); DispatchEvent(*Event::CreateBubble(EventTypeNames::webkitvisibilitychange)); if (GetPageVisibilityState() == mojom::PageVisibilityState::kVisible) Timeline().SetAllCompositorPending(); if (hidden() && canvas_font_cache_) canvas_font_cache_->PruneAll(); InteractiveDetector* interactive_detector = InteractiveDetector::From(*this); if (interactive_detector) { interactive_detector->OnPageVisibilityChanged(GetPageVisibilityState()); } } ",0 "HTMLImportLoader* HTMLImportsController::LoaderFor( const Document& document) const { for (const auto& loader : loaders_) { if (loader->GetDocument() == &document) return loader.Get(); } return nullptr; } ",0 "void GDataFileSystem::RemoveOnUIThreadAfterGetEntryInfo( const FilePath& file_path, bool /* is_recursive */, const FileOperationCallback& callback, GDataFileError error, scoped_ptr entry_proto) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (error != GDATA_FILE_OK) { if (!callback.is_null()) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(callback, error)); } return; } DCHECK(entry_proto.get()); documents_service_->DeleteDocument( GURL(entry_proto->edit_url()), base::Bind(&GDataFileSystem::OnRemovedDocument, ui_weak_ptr_, callback, file_path)); } ",0 "static int rtecp_construct_fci(sc_card_t *card, const sc_file_t *file, u8 *out, size_t *outlen) { u8 buf[64], *p = out; assert(card && card->ctx && file && out && outlen); assert(*outlen >= (size_t)(p - out) + 2); *p++ = 0x6F; /* FCI template */ p++; /* for length */ /* 0x80 - Number of data bytes in the file, excluding structural information */ buf[0] = (file->size >> 8) & 0xFF; buf[1] = file->size & 0xFF; sc_asn1_put_tag(0x80, buf, 2, p, *outlen - (p - out), &p); /* 0x82 - File descriptor byte */ if (file->type_attr_len) { assert(sizeof(buf) >= file->type_attr_len); memcpy(buf, file->type_attr, file->type_attr_len); sc_asn1_put_tag(0x82, buf, file->type_attr_len, p, *outlen - (p - out), &p); } else { switch (file->type) { case SC_FILE_TYPE_WORKING_EF: buf[0] = 0x01; break; case SC_FILE_TYPE_DF: buf[0] = 0x38; break; case SC_FILE_TYPE_INTERNAL_EF: default: SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_NOT_SUPPORTED); } buf[1] = 0; sc_asn1_put_tag(0x82, buf, 2, p, *outlen - (p - out), &p); } /* 0x83 - File identifier */ buf[0] = (file->id >> 8) & 0xFF; buf[1] = file->id & 0xFF; sc_asn1_put_tag(0x83, buf, 2, p, *outlen - (p - out), &p); if (file->prop_attr_len) { assert(sizeof(buf) >= file->prop_attr_len); memcpy(buf, file->prop_attr, file->prop_attr_len); sc_asn1_put_tag(0x85, buf, file->prop_attr_len, p, *outlen - (p - out), &p); } if (file->sec_attr_len) { assert(sizeof(buf) >= file->sec_attr_len); memcpy(buf, file->sec_attr, file->sec_attr_len); sc_asn1_put_tag(0x86, buf, file->sec_attr_len, p, *outlen - (p - out), &p); } out[1] = p - out - 2; /* length */ *outlen = p - out; SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, 0); } ",0 "SyncManager::Status::~Status() { } ",0 "static Image *ReadJP2Image(const ImageInfo *image_info,ExceptionInfo *exception) { const char *option; Image *image; int jp2_status; MagickBooleanType status; opj_codec_t *jp2_codec; opj_codestream_index_t *codestream_index = (opj_codestream_index_t *) NULL; opj_dparameters_t parameters; opj_image_t *jp2_image; opj_stream_t *jp2_stream; register ssize_t i; ssize_t y; unsigned char sans[4]; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Initialize JP2 codec. */ if (ReadBlob(image,4,sans) != 4) { image=DestroyImageList(image); return((Image *) NULL); } (void) SeekBlob(image,SEEK_SET,0); if (LocaleCompare(image_info->magick,""JPT"") == 0) jp2_codec=opj_create_decompress(OPJ_CODEC_JPT); else if (IsJ2K(sans,4) != MagickFalse) jp2_codec=opj_create_decompress(OPJ_CODEC_J2K); else jp2_codec=opj_create_decompress(OPJ_CODEC_JP2); opj_set_warning_handler(jp2_codec,JP2WarningHandler,exception); opj_set_error_handler(jp2_codec,JP2ErrorHandler,exception); opj_set_default_decoder_parameters(¶meters); option=GetImageOption(image_info,""jp2:reduce-factor""); if (option != (const char *) NULL) parameters.cp_reduce=StringToInteger(option); option=GetImageOption(image_info,""jp2:quality-layers""); if (option == (const char *) NULL) option=GetImageOption(image_info,""jp2:layer-number""); if (option != (const char *) NULL) parameters.cp_layer=StringToInteger(option); if (opj_setup_decoder(jp2_codec,¶meters) == 0) { opj_destroy_codec(jp2_codec); ThrowReaderException(DelegateError,""UnableToManageJP2Stream""); } jp2_stream=opj_stream_create(OPJ_J2K_STREAM_CHUNK_SIZE,OPJ_TRUE); opj_stream_set_read_function(jp2_stream,JP2ReadHandler); opj_stream_set_write_function(jp2_stream,JP2WriteHandler); opj_stream_set_seek_function(jp2_stream,JP2SeekHandler); opj_stream_set_skip_function(jp2_stream,JP2SkipHandler); opj_stream_set_user_data(jp2_stream,image,NULL); opj_stream_set_user_data_length(jp2_stream,GetBlobSize(image)); if (opj_read_header(jp2_stream,jp2_codec,&jp2_image) == 0) { opj_stream_destroy(jp2_stream); opj_destroy_codec(jp2_codec); ThrowReaderException(DelegateError,""UnableToDecodeImageFile""); } jp2_status=1; if ((image->columns != 0) && (image->rows != 0)) { /* Extract an area from the image. */ jp2_status=opj_set_decode_area(jp2_codec,jp2_image, (OPJ_INT32) image->extract_info.x,(OPJ_INT32) image->extract_info.y, (OPJ_INT32) image->extract_info.x+(ssize_t) image->columns, (OPJ_INT32) image->extract_info.y+(ssize_t) image->rows); if (jp2_status == 0) { opj_stream_destroy(jp2_stream); opj_destroy_codec(jp2_codec); opj_image_destroy(jp2_image); ThrowReaderException(DelegateError,""UnableToDecodeImageFile""); } } if ((image_info->number_scenes != 0) && (image_info->scene != 0)) jp2_status=opj_get_decoded_tile(jp2_codec,jp2_stream,jp2_image, (unsigned int) image_info->scene-1); else if (image->ping == MagickFalse) { jp2_status=opj_decode(jp2_codec,jp2_stream,jp2_image); if (jp2_status != 0) jp2_status=opj_end_decompress(jp2_codec,jp2_stream); } if (jp2_status == 0) { opj_stream_destroy(jp2_stream); opj_destroy_codec(jp2_codec); opj_image_destroy(jp2_image); ThrowReaderException(DelegateError,""UnableToDecodeImageFile""); } opj_stream_destroy(jp2_stream); for (i=0; i < (ssize_t) jp2_image->numcomps; i++) { if ((jp2_image->comps[0].dx == 0) || (jp2_image->comps[0].dy == 0) || (jp2_image->comps[0].dx != jp2_image->comps[i].dx) || (jp2_image->comps[0].dy != jp2_image->comps[i].dy) || (jp2_image->comps[0].prec != jp2_image->comps[i].prec) || (jp2_image->comps[0].sgnd != jp2_image->comps[i].sgnd) || (jp2_image->comps[i].data == NULL)) { opj_destroy_codec(jp2_codec); opj_image_destroy(jp2_image); ThrowReaderException(CoderError,""IrregularChannelGeometryNotSupported"") } } /* Convert JP2 image. */ image->columns=(size_t) jp2_image->comps[0].w; image->rows=(size_t) jp2_image->comps[0].h; image->depth=jp2_image->comps[0].prec; status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } image->compression=JPEG2000Compression; if (jp2_image->color_space == 2) { SetImageColorspace(image,GRAYColorspace); if (jp2_image->numcomps > 1) image->matte=MagickTrue; } else if (jp2_image->color_space == 3) SetImageColorspace(image,Rec601YCbCrColorspace); if (jp2_image->numcomps > 3) image->matte=MagickTrue; if (jp2_image->icc_profile_buf != (unsigned char *) NULL) { StringInfo *profile; profile=BlobToStringInfo(jp2_image->icc_profile_buf, jp2_image->icc_profile_len); if (profile != (StringInfo *) NULL) SetImageProfile(image,""icc"",profile); } if (image->ping != MagickFalse) { opj_destroy_codec(jp2_codec); opj_image_destroy(jp2_image); opj_destroy_cstr_index(&codestream_index); return(GetFirstImageInList(image)); } for (y=0; y < (ssize_t) image->rows; y++) { register PixelPacket *magick_restrict q; register ssize_t x; q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { register ssize_t i; for (i=0; i < (ssize_t) jp2_image->numcomps; i++) { double pixel, scale; scale=QuantumRange/(double) ((1UL << jp2_image->comps[i].prec)-1); pixel=scale*(jp2_image->comps[i].data[y/jp2_image->comps[i].dy* image->columns/jp2_image->comps[i].dx+x/jp2_image->comps[i].dx]+ (jp2_image->comps[i].sgnd ? 1UL << (jp2_image->comps[i].prec-1) : 0)); switch (i) { case 0: { q->red=ClampToQuantum(pixel); q->green=q->red; q->blue=q->red; q->opacity=OpaqueOpacity; break; } case 1: { if (jp2_image->numcomps == 2) { q->opacity=ClampToQuantum(QuantumRange-pixel); break; } q->green=ClampToQuantum(pixel); break; } case 2: { q->blue=ClampToQuantum(pixel); break; } case 3: { q->opacity=ClampToQuantum(QuantumRange-pixel); break; } } } q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } /* Free resources. */ opj_destroy_codec(jp2_codec); opj_image_destroy(jp2_image); opj_destroy_cstr_index(&codestream_index); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "vhost_scsi_alloc_fabric_acl(struct se_portal_group *se_tpg) { struct vhost_scsi_nacl *nacl; nacl = kzalloc(sizeof(struct vhost_scsi_nacl), GFP_KERNEL); if (!nacl) { pr_err(""Unable to allocate struct vhost_scsi_nacl\n""); return NULL; } return &nacl->se_node_acl; } ",0 "fast_pf_fix_direct_spte(struct kvm_vcpu *vcpu, u64 *sptep, u64 spte) { struct kvm_mmu_page *sp = page_header(__pa(sptep)); gfn_t gfn; WARN_ON(!sp->role.direct); /* * The gfn of direct spte is stable since it is calculated * by sp->gfn. */ gfn = kvm_mmu_page_get_gfn(sp, sptep - sp->spt); if (cmpxchg64(sptep, spte, spte | PT_WRITABLE_MASK) == spte) mark_page_dirty(vcpu->kvm, gfn); return true; } ",0 "fbCombineDisjointOverC (CARD32 *dest, CARD32 *src, CARD32 *mask, int width) { fbCombineDisjointGeneralC (dest, src, mask, width, CombineAOver); } ",0 "static int debugfs_remount(struct super_block *sb, int *flags, char *data) { int err; struct debugfs_fs_info *fsi = sb->s_fs_info; sync_filesystem(sb); err = debugfs_parse_options(data, &fsi->mount_opts); if (err) goto fail; debugfs_apply_options(sb); fail: return err; } ",0 "static gboolean webkit_web_view_motion_event(GtkWidget* widget, GdkEventMotion* event) { WebKitWebView* webView = WEBKIT_WEB_VIEW(widget); Frame* frame = core(webView)->mainFrame(); if (!frame->view()) return FALSE; return frame->eventHandler()->mouseMoved(PlatformMouseEvent(event)); } ",0 "NO_INLINE JsVar *__jspeAssignmentExpression(JsVar *lhs) { if (lex->tk=='=' || lex->tk==LEX_PLUSEQUAL || lex->tk==LEX_MINUSEQUAL || lex->tk==LEX_MULEQUAL || lex->tk==LEX_DIVEQUAL || lex->tk==LEX_MODEQUAL || lex->tk==LEX_ANDEQUAL || lex->tk==LEX_OREQUAL || lex->tk==LEX_XOREQUAL || lex->tk==LEX_RSHIFTEQUAL || lex->tk==LEX_LSHIFTEQUAL || lex->tk==LEX_RSHIFTUNSIGNEDEQUAL) { JsVar *rhs; int op = lex->tk; JSP_ASSERT_MATCH(op); rhs = jspeAssignmentExpression(); rhs = jsvSkipNameAndUnLock(rhs); // ensure we get rid of any references on the RHS if (JSP_SHOULD_EXECUTE && lhs) { if (op=='=') { /* If we're assigning to this and we don't have a parent, * add it to the symbol table root */ if (!jsvGetRefs(lhs) && jsvIsName(lhs)) { if (!jsvIsArrayBufferName(lhs) && !jsvIsNewChild(lhs)) jsvAddName(execInfo.root, lhs); } jspReplaceWith(lhs, rhs); } else { if (op==LEX_PLUSEQUAL) op='+'; else if (op==LEX_MINUSEQUAL) op='-'; else if (op==LEX_MULEQUAL) op='*'; else if (op==LEX_DIVEQUAL) op='/'; else if (op==LEX_MODEQUAL) op='%'; else if (op==LEX_ANDEQUAL) op='&'; else if (op==LEX_OREQUAL) op='|'; else if (op==LEX_XOREQUAL) op='^'; else if (op==LEX_RSHIFTEQUAL) op=LEX_RSHIFT; else if (op==LEX_LSHIFTEQUAL) op=LEX_LSHIFT; else if (op==LEX_RSHIFTUNSIGNEDEQUAL) op=LEX_RSHIFTUNSIGNED; if (op=='+' && jsvIsName(lhs)) { JsVar *currentValue = jsvSkipName(lhs); if (jsvIsString(currentValue) && !jsvIsFlatString(currentValue) && jsvGetRefs(currentValue)==1 && rhs!=currentValue) { /* A special case for string += where this is the only use of the string * and we're not appending to ourselves. In this case we can do a * simple append (rather than clone + append)*/ JsVar *str = jsvAsString(rhs, false); jsvAppendStringVarComplete(currentValue, str); jsvUnLock(str); op = 0; } jsvUnLock(currentValue); } if (op) { /* Fallback which does a proper add */ JsVar *res = jsvMathsOpSkipNames(lhs,rhs,op); jspReplaceWith(lhs, res); jsvUnLock(res); } } } jsvUnLock(rhs); } return lhs; } ",0 "bool AppCacheDatabase::FindOriginsWithGroups(std::set* origins) { DCHECK(origins && origins->empty()); if (!LazyOpen(kDontCreate)) return false; static const char kSql[] = ""SELECT DISTINCT(origin) FROM Groups""; sql::Statement statement(db_->GetUniqueStatement(kSql)); while (statement.Step()) origins->insert(url::Origin::Create(GURL(statement.ColumnString(0)))); return statement.Succeeded(); } ",0 "status_t StreamingProcessor::processRecordingFrame() { ATRACE_CALL(); status_t res; sp recordingHeap; size_t heapIdx = 0; nsecs_t timestamp; sp client = mClient.promote(); if (client == 0) { BufferItem imgBuffer; res = mRecordingConsumer->acquireBuffer(&imgBuffer, 0); if (res != OK) { if (res != BufferItemConsumer::NO_BUFFER_AVAILABLE) { ALOGE(""%s: Camera %d: Can't acquire recording buffer: %s (%d)"", __FUNCTION__, mId, strerror(-res), res); } return res; } mRecordingConsumer->releaseBuffer(imgBuffer); return OK; } { /* acquire SharedParameters before mMutex so we don't dead lock with Camera2Client code calling into StreamingProcessor */ SharedParameters::Lock l(client->getParameters()); Mutex::Autolock m(mMutex); BufferItem imgBuffer; res = mRecordingConsumer->acquireBuffer(&imgBuffer, 0); if (res != OK) { if (res != BufferItemConsumer::NO_BUFFER_AVAILABLE) { ALOGE(""%s: Camera %d: Can't acquire recording buffer: %s (%d)"", __FUNCTION__, mId, strerror(-res), res); } return res; } timestamp = imgBuffer.mTimestamp; mRecordingFrameCount++; ALOGVV(""OnRecordingFrame: Frame %d"", mRecordingFrameCount); if (l.mParameters.state != Parameters::RECORD && l.mParameters.state != Parameters::VIDEO_SNAPSHOT) { ALOGV(""%s: Camera %d: Discarding recording image buffers "" ""received after recording done"", __FUNCTION__, mId); mRecordingConsumer->releaseBuffer(imgBuffer); return INVALID_OPERATION; } if (mRecordingHeap == 0) { size_t payloadSize = sizeof(VideoNativeMetadata); ALOGV(""%s: Camera %d: Creating recording heap with %zu buffers of "" ""size %zu bytes"", __FUNCTION__, mId, mRecordingHeapCount, payloadSize); mRecordingHeap = new Camera2Heap(payloadSize, mRecordingHeapCount, ""Camera2Client::RecordingHeap""); if (mRecordingHeap->mHeap->getSize() == 0) { ALOGE(""%s: Camera %d: Unable to allocate memory for recording"", __FUNCTION__, mId); mRecordingConsumer->releaseBuffer(imgBuffer); return NO_MEMORY; } for (size_t i = 0; i < mRecordingBuffers.size(); i++) { if (mRecordingBuffers[i].mBuf != BufferItemConsumer::INVALID_BUFFER_SLOT) { ALOGE(""%s: Camera %d: Non-empty recording buffers list!"", __FUNCTION__, mId); } } mRecordingBuffers.clear(); mRecordingBuffers.setCapacity(mRecordingHeapCount); mRecordingBuffers.insertAt(0, mRecordingHeapCount); mRecordingHeapHead = 0; mRecordingHeapFree = mRecordingHeapCount; } if (mRecordingHeapFree == 0) { ALOGE(""%s: Camera %d: No free recording buffers, dropping frame"", __FUNCTION__, mId); mRecordingConsumer->releaseBuffer(imgBuffer); return NO_MEMORY; } heapIdx = mRecordingHeapHead; mRecordingHeapHead = (mRecordingHeapHead + 1) % mRecordingHeapCount; mRecordingHeapFree--; ALOGVV(""%s: Camera %d: Timestamp %lld"", __FUNCTION__, mId, timestamp); ssize_t offset; size_t size; sp heap = mRecordingHeap->mBuffers[heapIdx]->getMemory(&offset, &size); VideoNativeMetadata *payload = reinterpret_cast( (uint8_t*)heap->getBase() + offset); payload->eType = kMetadataBufferTypeANWBuffer; payload->pBuffer = imgBuffer.mGraphicBuffer->getNativeBuffer(); payload->nFenceFd = -1; ALOGVV(""%s: Camera %d: Sending out ANWBuffer %p"", __FUNCTION__, mId, payload->pBuffer); mRecordingBuffers.replaceAt(imgBuffer, heapIdx); recordingHeap = mRecordingHeap; } Camera2Client::SharedCameraCallbacks::Lock l(client->mSharedCameraCallbacks); if (l.mRemoteCallback != 0) { l.mRemoteCallback->dataCallbackTimestamp(timestamp, CAMERA_MSG_VIDEO_FRAME, recordingHeap->mBuffers[heapIdx]); } else { ALOGW(""%s: Camera %d: Remote callback gone"", __FUNCTION__, mId); } return OK; } ",1 " xmlXPathNextPreceding(xmlXPathParserContextPtr ctxt, xmlNodePtr cur) { if ((ctxt == NULL) || (ctxt->context == NULL)) return(NULL); if ((ctxt->context->node->type == XML_ATTRIBUTE_NODE) || (ctxt->context->node->type == XML_NAMESPACE_DECL)) return(NULL); if (cur == NULL) cur = ctxt->context->node; if (cur == NULL) return (NULL); if ((cur->prev != NULL) && (cur->prev->type == XML_DTD_NODE)) cur = cur->prev; do { if (cur->prev != NULL) { for (cur = cur->prev; cur->last != NULL; cur = cur->last) ; return (cur); } cur = cur->parent; if (cur == NULL) return (NULL); if (cur == ctxt->context->doc->children) return (NULL); } while (xmlXPathIsAncestor(cur, ctxt->context->node)); return (cur); } ",1 "uint32_t ide_data_readw(void *opaque, uint32_t addr) { IDEBus *bus = opaque; IDEState *s = idebus_active_if(bus); uint8_t *p; int ret; /* PIO data access allowed only when DRQ bit is set. The result of a read * during PIO in is indeterminate, return 0 and don't move forward. */ if (!(s->status & DRQ_STAT) || !ide_is_pio_out(s)) { return 0; } p = s->data_ptr; ret = cpu_to_le16(*(uint16_t *)p); p += 2; s->data_ptr = p; if (p >= s->data_end) s->end_transfer_func(s); return ret; } ",0 "int Visualizer_process( effect_handle_t self,audio_buffer_t *inBuffer, audio_buffer_t *outBuffer) { VisualizerContext * pContext = (VisualizerContext *)self; if (pContext == NULL) { return -EINVAL; } if (inBuffer == NULL || inBuffer->raw == NULL || outBuffer == NULL || outBuffer->raw == NULL || inBuffer->frameCount != outBuffer->frameCount || inBuffer->frameCount == 0) { return -EINVAL; } if (pContext->mMeasurementMode & MEASUREMENT_MODE_PEAK_RMS) { uint32_t inIdx; int16_t maxSample = 0; float rmsSqAcc = 0; for (inIdx = 0 ; inIdx < inBuffer->frameCount * pContext->mChannelCount ; inIdx++) { if (inBuffer->s16[inIdx] > maxSample) { maxSample = inBuffer->s16[inIdx]; } else if (-inBuffer->s16[inIdx] > maxSample) { maxSample = -inBuffer->s16[inIdx]; } rmsSqAcc += (inBuffer->s16[inIdx] * inBuffer->s16[inIdx]); } pContext->mPastMeasurements[pContext->mMeasurementBufferIdx].mPeakU16 = (uint16_t)maxSample; pContext->mPastMeasurements[pContext->mMeasurementBufferIdx].mRmsSquared = rmsSqAcc / (inBuffer->frameCount * pContext->mChannelCount); pContext->mPastMeasurements[pContext->mMeasurementBufferIdx].mIsValid = true; if (++pContext->mMeasurementBufferIdx >= pContext->mMeasurementWindowSizeInBuffers) { pContext->mMeasurementBufferIdx = 0; } } int32_t shift; if (pContext->mScalingMode == VISUALIZER_SCALING_MODE_NORMALIZED) { shift = 32; int len = inBuffer->frameCount * 2; for (int i = 0; i < len; i++) { int32_t smp = inBuffer->s16[i]; if (smp < 0) smp = -smp - 1; // take care to keep the max negative in range int32_t clz = __builtin_clz(smp); if (shift > clz) shift = clz; } shift = 25 - shift; if (shift < 3) { shift = 3; } shift++; } else { assert(pContext->mScalingMode == VISUALIZER_SCALING_MODE_AS_PLAYED); shift = 9; } uint32_t captIdx; uint32_t inIdx; uint8_t *buf = pContext->mCaptureBuf; for (inIdx = 0, captIdx = pContext->mCaptureIdx; inIdx < inBuffer->frameCount; inIdx++, captIdx++) { if (captIdx >= CAPTURE_BUF_SIZE) { captIdx = 0; } int32_t smp = inBuffer->s16[2 * inIdx] + inBuffer->s16[2 * inIdx + 1]; smp = smp >> shift; buf[captIdx] = ((uint8_t)smp)^0x80; } pContext->mCaptureIdx = captIdx; if (clock_gettime(CLOCK_MONOTONIC, &pContext->mBufferUpdateTime) < 0) { pContext->mBufferUpdateTime.tv_sec = 0; } if (inBuffer->raw != outBuffer->raw) { if (pContext->mConfig.outputCfg.accessMode == EFFECT_BUFFER_ACCESS_ACCUMULATE) { for (size_t i = 0; i < outBuffer->frameCount*2; i++) { outBuffer->s16[i] = clamp16(outBuffer->s16[i] + inBuffer->s16[i]); } } else { memcpy(outBuffer->raw, inBuffer->raw, outBuffer->frameCount * 2 * sizeof(int16_t)); } } if (pContext->mState != VISUALIZER_STATE_ACTIVE) { return -ENODATA; } return 0; } // end Visualizer_process ",0 "void TabStripModel::SelectLastTab() { ActivateTabAt(count() - 1, true); } ",0 "void Document::Shutdown() { TRACE_EVENT0(""blink"", ""Document::shutdown""); CHECK(!frame_ || frame_->Tree().ChildCount() == 0); if (!IsActive()) return; FrameNavigationDisabler navigation_disabler(*frame_); HTMLFrameOwnerElement::PluginDisposeSuspendScope suspend_plugin_dispose; ScriptForbiddenScope forbid_script; lifecycle_.AdvanceTo(DocumentLifecycle::kStopping); View()->Dispose(); CHECK(!View()->IsAttached()); HTMLFrameOwnerElement* owner_element = frame_->DeprecatedLocalOwner(); if (owner_element) owner_element->SetEmbeddedContentView(nullptr); markers_->PrepareForDestruction(); if (GetPage()) GetPage()->DocumentDetached(this); probe::documentDetached(this); if (frame_->Client()->GetSharedWorkerRepositoryClient()) frame_->Client()->GetSharedWorkerRepositoryClient()->DocumentDetached(this); if (scripted_animation_controller_) scripted_animation_controller_->ClearDocumentPointer(); scripted_animation_controller_.Clear(); scripted_idle_task_controller_.Clear(); if (SvgExtensions()) AccessSVGExtensions().PauseAnimations(); if (dom_window_) dom_window_->ClearEventQueue(); if (layout_view_) layout_view_->SetIsInWindow(false); if (RegistrationContext()) RegistrationContext()->DocumentWasDetached(); MutationObserver::CleanSlotChangeList(*this); hover_element_ = nullptr; active_element_ = nullptr; autofocus_element_ = nullptr; if (focused_element_.Get()) { Element* old_focused_element = focused_element_; focused_element_ = nullptr; if (GetPage()) GetPage()->GetChromeClient().FocusedNodeChanged(old_focused_element, nullptr); } sequential_focus_navigation_starting_point_ = nullptr; if (this == &AXObjectCacheOwner()) ClearAXObjectCache(); layout_view_ = nullptr; ContainerNode::DetachLayoutTree(); CHECK(!View()->IsAttached()); if (this != &AXObjectCacheOwner()) { if (AXObjectCache* cache = ExistingAXObjectCache()) { for (Node& node : NodeTraversal::DescendantsOf(*this)) { cache->Remove(&node); } } } GetStyleEngine().DidDetach(); GetPage()->GetEventHandlerRegistry().DocumentDetached(*this); DocumentShutdownNotifier::NotifyContextDestroyed(); SynchronousMutationNotifier::NotifyContextDestroyed(); if (!Loader()) fetcher_->ClearContext(); if (imports_controller_) { imports_controller_->Dispose(); ClearImportsController(); } timers_.SetTimerTaskRunner( Platform::Current()->CurrentThread()->Scheduler()->TimerTaskRunner()); if (media_query_matcher_) media_query_matcher_->DocumentDetached(); lifecycle_.AdvanceTo(DocumentLifecycle::kStopped); CHECK(!View()->IsAttached()); ExecutionContext::NotifyContextDestroyed(); CHECK(!View()->IsAttached()); frame_ = nullptr; document_outlive_time_reporter_ = WTF::WrapUnique(new DocumentOutliveTimeReporter(this)); } ",0 "static int break_ksm(struct vm_area_struct *vma, unsigned long addr) { struct page *page; int ret = 0; do { cond_resched(); page = follow_page(vma, addr, FOLL_GET); if (IS_ERR_OR_NULL(page)) break; if (PageKsm(page)) ret = handle_mm_fault(vma->vm_mm, vma, addr, FAULT_FLAG_WRITE); else ret = VM_FAULT_WRITE; put_page(page); } while (!(ret & (VM_FAULT_WRITE | VM_FAULT_SIGBUS | VM_FAULT_OOM))); /* * We must loop because handle_mm_fault() may back out if there's * any difficulty e.g. if pte accessed bit gets updated concurrently. * * VM_FAULT_WRITE is what we have been hoping for: it indicates that * COW has been broken, even if the vma does not permit VM_WRITE; * but note that a concurrent fault might break PageKsm for us. * * VM_FAULT_SIGBUS could occur if we race with truncation of the * backing file, which also invalidates anonymous pages: that's * okay, that truncation will have unmapped the PageKsm for us. * * VM_FAULT_OOM: at the time of writing (late July 2009), setting * aside mem_cgroup limits, VM_FAULT_OOM would only be set if the * current task has TIF_MEMDIE set, and will be OOM killed on return * to user; and ksmd, having no mm, would never be chosen for that. * * But if the mm is in a limited mem_cgroup, then the fault may fail * with VM_FAULT_OOM even if the current task is not TIF_MEMDIE; and * even ksmd can fail in this way - though it's usually breaking ksm * just to undo a merge it made a moment before, so unlikely to oom. * * That's a pity: we might therefore have more kernel pages allocated * than we're counting as nodes in the stable tree; but ksm_do_scan * will retry to break_cow on each pass, so should recover the page * in due course. The important thing is to not let VM_MERGEABLE * be cleared while any such pages might remain in the area. */ return (ret & VM_FAULT_OOM) ? -ENOMEM : 0; } ",0 "juniper_pppoe_atm_print(netdissect_options *ndo, const struct pcap_pkthdr *h, register const u_char *p) { struct juniper_l2info_t l2info; uint16_t extracted_ethertype; l2info.pictype = DLT_JUNIPER_PPPOE_ATM; if (juniper_parse_header(ndo, p, h, &l2info) == 0) return l2info.header_len; p+=l2info.header_len; ND_TCHECK2(p[0], 2); extracted_ethertype = EXTRACT_16BITS(p); /* this DLT contains nothing but raw PPPoE frames, * prepended with a type field*/ if (ethertype_print(ndo, extracted_ethertype, p+ETHERTYPE_LEN, l2info.length-ETHERTYPE_LEN, l2info.caplen-ETHERTYPE_LEN, NULL, NULL) == 0) /* ether_type not known, probably it wasn't one */ ND_PRINT((ndo, ""unknown ethertype 0x%04x"", extracted_ethertype)); return l2info.header_len; trunc: ND_PRINT((ndo, ""[|juniper_pppoe_atm]"")); return l2info.header_len; } ",0 "void RenderFrameHostImpl::SetNavigationsSuspended( bool suspend, const base::TimeTicks& proceed_time) { DCHECK(navigations_suspended_ != suspend); navigations_suspended_ = suspend; if (navigations_suspended_) { TRACE_EVENT_ASYNC_BEGIN0(""navigation"", ""RenderFrameHostImpl navigation suspended"", this); } else { TRACE_EVENT_ASYNC_END0(""navigation"", ""RenderFrameHostImpl navigation suspended"", this); } if (!suspend && suspended_nav_params_) { ResetWaitingState(); DCHECK(!proceed_time.is_null()); suspended_nav_params_->common_params.navigation_start = proceed_time; SendNavigateMessage(suspended_nav_params_->common_params, suspended_nav_params_->start_params, suspended_nav_params_->request_params); suspended_nav_params_.reset(); } } ",0 "static int hci_uart_set_proto(struct hci_uart *hu, int id) { const struct hci_uart_proto *p; int err; p = hci_uart_get_proto(id); if (!p) return -EPROTONOSUPPORT; hu->proto = p; set_bit(HCI_UART_PROTO_READY, &hu->flags); err = hci_uart_register_dev(hu); if (err) { clear_bit(HCI_UART_PROTO_READY, &hu->flags); return err; } return 0; } ",1 "static double filter_hanning(const double x) { /* A Cosine windowing function */ return(0.5 + 0.5 * cos(M_PI * x)); } ",0 "gx_dc_pure_masked_load(gx_device_color * pdevc, const gs_gstate * pgs, gx_device * dev, gs_color_select_t select) { int code = (*gx_dc_type_data_pure.load) (pdevc, pgs, dev, select); if (code < 0) return code; FINISH_PATTERN_LOAD } ",0 "ExtensionSystemImpl::serial_connection_manager() { return serial_connection_manager_.get(); } ",0 "static void FromColor_D32_Raw(void* dst, const SkColor src[], int width, int, int) { if (SK_COLOR_MATCHES_PMCOLOR_BYTE_ORDER) { memcpy(dst, src, width * sizeof(SkColor)); return; } SkPMColor* d = (SkPMColor*)dst; for (int i = 0; i < width; i++) { SkColor c = *src++; *d++ = SkPackARGB32NoCheck(SkColorGetA(c), SkColorGetR(c), SkColorGetG(c), SkColorGetB(c)); } } ",0 "void ReadReal(cmsIT8* it8, cmsInt32Number inum) { it8->dnum = (cmsFloat64Number)inum; while (isdigit(it8->ch)) { it8->dnum = (cmsFloat64Number)it8->dnum * 10.0 + (cmsFloat64Number)(it8->ch - '0'); NextCh(it8); } if (it8->ch == '.') { // Decimal point cmsFloat64Number frac = 0.0; // fraction int prec = 0; // precision NextCh(it8); // Eats dec. point while (isdigit(it8->ch)) { frac = frac * 10.0 + (cmsFloat64Number)(it8->ch - '0'); prec++; NextCh(it8); } it8->dnum = it8->dnum + (frac / xpow10(prec)); } if (toupper(it8->ch) == 'E') { cmsInt32Number e; cmsInt32Number sgn; NextCh(it8); sgn = 1; if (it8->ch == '-') { sgn = -1; NextCh(it8); } else if (it8->ch == '+') { sgn = +1; NextCh(it8); } e = 0; while (isdigit(it8->ch)) { cmsInt32Number digit = (it8->ch - '0'); if ((cmsFloat64Number)e * 10.0 + (cmsFloat64Number)digit < (cmsFloat64Number)+2147483647.0) e = e * 10 + digit; NextCh(it8); } e = sgn*e; it8->dnum = it8->dnum * xpow10(e); } } ",0 "static void decode_block(decoder_info_t *decoder_info,int size,int ypos,int xpos,int sub){ int width = decoder_info->width; int height = decoder_info->height; int xposY = xpos; int yposY = ypos; int xposC = xpos >> sub; int yposC = ypos >> sub; int sizeY = size; int sizeC = size >> sub; block_mode_t mode; intra_mode_t intra_mode; frame_type_t frame_type = decoder_info->frame_info.frame_type; int bipred = decoder_info->bipred; int qpY = decoder_info->frame_info.qpb; int qpC = sub ? chroma_qp[qpY] : qpY; /* Intermediate block variables */ SAMPLE *pblock_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); int16_t *coeff_y = thor_alloc(2*MAX_TR_SIZE*MAX_TR_SIZE, 32); int16_t *coeff_u = thor_alloc(2*MAX_TR_SIZE*MAX_TR_SIZE, 32); int16_t *coeff_v = thor_alloc(2*MAX_TR_SIZE*MAX_TR_SIZE, 32); /* Block variables for bipred */ SAMPLE *pblock0_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock0_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock0_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock1_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock1_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock1_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); yuv_frame_t *rec = decoder_info->rec; yuv_frame_t *ref = decoder_info->ref[0]; /* Pointers to current position in reconstructed frame*/ SAMPLE *rec_y = &rec->y[yposY*rec->stride_y+xposY]; SAMPLE *rec_u = &rec->u[yposC*rec->stride_c+xposC]; SAMPLE *rec_v = &rec->v[yposC*rec->stride_c+xposC]; stream_t *stream = decoder_info->stream; /* Read data from bitstream */ block_info_dec_t block_info; block_info.block_pos.size = size; block_info.block_pos.ypos = ypos; block_info.block_pos.xpos = xpos; block_info.coeffq_y = coeff_y; block_info.coeffq_u = coeff_u; block_info.coeffq_v = coeff_v; block_info.sub = sub; /* Used for rectangular skip blocks */ int bwidth = min(size,width - xpos); int bheight = min(size,height - ypos); block_info.block_pos.bwidth = bwidth; block_info.block_pos.bheight = bheight; read_block(decoder_info,stream,&block_info,frame_type); mode = block_info.block_param.mode; if (mode == MODE_INTRA){ int ql = decoder_info->qmtx ? qp_to_qlevel(qpY,decoder_info->qmtx_offset) : 0; intra_mode = block_info.block_param.intra_mode; int bwidth = size; //TODO: fix for non-square blocks int bheight = size; //TODO: fix for non-square blocks int upright_available = get_upright_available(yposY, xposY, bwidth, bheight, width, height, 1 << decoder_info->log2_sb_size); int downleft_available = get_downleft_available(yposY, xposY, bwidth, bheight, width, height, 1 << decoder_info->log2_sb_size); int tb_split = block_info.block_param.tb_split; decode_and_reconstruct_block_intra(rec_y,rec->stride_y,sizeY,qpY,pblock_y,coeff_y,tb_split,upright_available,downleft_available,intra_mode,yposY,xposY,width,0,decoder_info->bitdepth,decoder_info->qmtx ? decoder_info->iwmatrix[ql][0][1] : NULL); if (decoder_info->subsample != 400) decode_and_reconstruct_block_intra_uv(rec_u,rec_v,rec->stride_c,sizeC,qpC,pblock_u,pblock_v,coeff_u,coeff_v,tb_split && sizeC > 4,upright_available,downleft_available,intra_mode,yposC,xposC,width>>sub,1,decoder_info->bitdepth,decoder_info->qmtx ? decoder_info->iwmatrix[ql][1][1] : NULL, decoder_info->cfl_intra ? pblock_y : 0, rec_y, rec->stride_y, sub); } else { int tb_split = block_info.block_param.tb_split; if (mode==MODE_SKIP){ if (block_info.block_param.dir==2){ SAMPLE *pblock0_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock0_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock0_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock1_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock1_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock1_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); int r0 = decoder_info->frame_info.ref_array[block_info.block_param.ref_idx0]; yuv_frame_t *ref0 = r0 >= 0 ? decoder_info->ref[r0] : decoder_info->interp_frames[0]; int sign0 = ref0->frame_num >= rec->frame_num; int r1 = decoder_info->frame_info.ref_array[block_info.block_param.ref_idx1]; yuv_frame_t *ref1 = r1 >= 0 ? decoder_info->ref[r1] : decoder_info->interp_frames[0]; int sign1 = ref1->frame_num >= rec->frame_num; if (decoder_info->bit_count.stat_frame_type == B_FRAME && decoder_info->interp_ref == 2 && block_info.block_param.skip_idx==0) { TEMPLATE(get_inter_prediction_temp)(width, height, ref0, ref1, &block_info.block_pos, decoder_info->deblock_data, decoder_info->num_reorder_pics + 1, decoder_info->frame_info.phase, pblock_y, pblock_u, pblock_v); } else { TEMPLATE(get_inter_prediction_yuv)(ref0, pblock0_y, pblock0_u, pblock0_v, &block_info.block_pos, block_info.block_param.mv_arr0, sign0, width, height, bipred, 0, decoder_info->bitdepth); TEMPLATE(get_inter_prediction_yuv)(ref1, pblock1_y, pblock1_u, pblock1_v, &block_info.block_pos, block_info.block_param.mv_arr1, sign1, width, height, bipred, 0, decoder_info->bitdepth); TEMPLATE(average_blocks_all)(pblock_y, pblock_u, pblock_v, pblock0_y, pblock0_u, pblock0_v, pblock1_y, pblock1_u, pblock1_v, &block_info.block_pos, sub); } thor_free(pblock0_y); thor_free(pblock0_u); thor_free(pblock0_v); thor_free(pblock1_y); thor_free(pblock1_u); thor_free(pblock1_v); } else{ int ref_idx = block_info.block_param.ref_idx0; //TODO: Move to top int r = decoder_info->frame_info.ref_array[ref_idx]; ref = r>=0 ? decoder_info->ref[r] : decoder_info->interp_frames[0]; int sign = ref->frame_num > rec->frame_num; TEMPLATE(get_inter_prediction_yuv)(ref, pblock_y, pblock_u, pblock_v, &block_info.block_pos, block_info.block_param.mv_arr0, sign, width, height, bipred, 0, decoder_info->bitdepth); } int j; for (j = 0; jstride_y], &pblock_y[j*sizeY], bwidth*sizeof(SAMPLE)); } for (j = 0; j> sub; j++) { memcpy(&rec_u[j*rec->stride_c], &pblock_u[j*sizeC], (bwidth >> sub)*sizeof(SAMPLE)); memcpy(&rec_v[j*rec->stride_c], &pblock_v[j*sizeC], (bwidth >> sub)*sizeof(SAMPLE)); } copy_deblock_data(decoder_info, &block_info); return; } else if (mode==MODE_MERGE){ if (block_info.block_param.dir==2){ SAMPLE *pblock0_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock0_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock0_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock1_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock1_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock1_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); int r0 = decoder_info->frame_info.ref_array[block_info.block_param.ref_idx0]; yuv_frame_t *ref0 = r0 >= 0 ? decoder_info->ref[r0] : decoder_info->interp_frames[0]; int sign0 = ref0->frame_num >= rec->frame_num; TEMPLATE(get_inter_prediction_yuv)(ref0, pblock0_y, pblock0_u, pblock0_v, &block_info.block_pos, block_info.block_param.mv_arr0, sign0, width, height, bipred, 0, decoder_info->bitdepth); int r1 = decoder_info->frame_info.ref_array[block_info.block_param.ref_idx1]; yuv_frame_t *ref1 = r1 >= 0 ? decoder_info->ref[r1] : decoder_info->interp_frames[0]; int sign1 = ref1->frame_num >= rec->frame_num; TEMPLATE(get_inter_prediction_yuv)(ref1, pblock1_y, pblock1_u, pblock1_v, &block_info.block_pos, block_info.block_param.mv_arr1, sign1, width, height, bipred, 0, decoder_info->bitdepth); TEMPLATE(average_blocks_all)(pblock_y, pblock_u, pblock_v, pblock0_y, pblock0_u, pblock0_v, pblock1_y, pblock1_u, pblock1_v, &block_info.block_pos, sub); thor_free(pblock0_y); thor_free(pblock0_u); thor_free(pblock0_v); thor_free(pblock1_y); thor_free(pblock1_u); thor_free(pblock1_v); } else{ int ref_idx = block_info.block_param.ref_idx0; //TODO: Move to top int r = decoder_info->frame_info.ref_array[ref_idx]; ref = r>=0 ? decoder_info->ref[r] : decoder_info->interp_frames[0]; int sign = ref->frame_num > rec->frame_num; TEMPLATE(get_inter_prediction_yuv)(ref, pblock_y, pblock_u, pblock_v, &block_info.block_pos, block_info.block_param.mv_arr0, sign, width, height, bipred, 0, decoder_info->bitdepth); } } else if (mode == MODE_INTER){ int ref_idx = block_info.block_param.ref_idx0; int r = decoder_info->frame_info.ref_array[ref_idx]; ref = r>=0 ? decoder_info->ref[r] : decoder_info->interp_frames[0]; int sign = ref->frame_num > rec->frame_num; TEMPLATE(get_inter_prediction_yuv)(ref, pblock_y, pblock_u, pblock_v, &block_info.block_pos, block_info.block_param.mv_arr0, sign, width, height, bipred, decoder_info->pb_split, decoder_info->bitdepth); } else if (mode == MODE_BIPRED){ SAMPLE *pblock0_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock0_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock0_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock1_y = thor_alloc(MAX_SB_SIZE*MAX_SB_SIZE*sizeof(SAMPLE), 32); SAMPLE *pblock1_u = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); SAMPLE *pblock1_v = thor_alloc((MAX_SB_SIZE*MAX_SB_SIZE >> 2*sub)*sizeof(SAMPLE), 32); int r0 = decoder_info->frame_info.ref_array[block_info.block_param.ref_idx0]; yuv_frame_t *ref0 = r0 >= 0 ? decoder_info->ref[r0] : decoder_info->interp_frames[0]; int sign0 = ref0->frame_num >= rec->frame_num; TEMPLATE(get_inter_prediction_yuv)(ref0, pblock0_y, pblock0_u, pblock0_v, &block_info.block_pos, block_info.block_param.mv_arr0, sign0, width, height, bipred, decoder_info->pb_split, decoder_info->bitdepth); int r1 = decoder_info->frame_info.ref_array[block_info.block_param.ref_idx1]; yuv_frame_t *ref1 = r1 >= 0 ? decoder_info->ref[r1] : decoder_info->interp_frames[0]; int sign1 = ref1->frame_num >= rec->frame_num; TEMPLATE(get_inter_prediction_yuv)(ref1, pblock1_y, pblock1_u, pblock1_v, &block_info.block_pos, block_info.block_param.mv_arr1, sign1, width, height, bipred, decoder_info->pb_split, decoder_info->bitdepth); TEMPLATE(average_blocks_all)(pblock_y, pblock_u, pblock_v, pblock0_y, pblock0_u, pblock0_v, pblock1_y, pblock1_u, pblock1_v, &block_info.block_pos, sub); thor_free(pblock0_y); thor_free(pblock0_u); thor_free(pblock0_v); thor_free(pblock1_y); thor_free(pblock1_u); thor_free(pblock1_v); } /* Dequantize, invere tranform and reconstruct */ int ql = decoder_info->qmtx ? qp_to_qlevel(qpY,decoder_info->qmtx_offset) : 0; decode_and_reconstruct_block_inter(rec_y,rec->stride_y,sizeY,qpY,pblock_y,coeff_y,tb_split,decoder_info->bitdepth,decoder_info->qmtx ? decoder_info->iwmatrix[ql][0][0] : NULL); if (decoder_info->cfl_inter && decoder_info->subsample != 400) TEMPLATE(improve_uv_prediction)(pblock_y, pblock_u, pblock_v, rec_y, sizeY, sizeY, rec->stride_y, sub, decoder_info->bitdepth); decode_and_reconstruct_block_inter(rec_u,rec->stride_c,sizeC,qpC,pblock_u,coeff_u,tb_split&&sizeC>4,decoder_info->bitdepth,decoder_info->qmtx ? decoder_info->iwmatrix[ql][1][0] : NULL); decode_and_reconstruct_block_inter(rec_v,rec->stride_c,sizeC,qpC,pblock_v,coeff_v,tb_split&&sizeC>4,decoder_info->bitdepth,decoder_info->qmtx ? decoder_info->iwmatrix[ql][2][0] : NULL); } /* Copy deblock data to frame array */ copy_deblock_data(decoder_info,&block_info); thor_free(pblock0_y); thor_free(pblock0_u); thor_free(pblock0_v); thor_free(pblock1_y); thor_free(pblock1_u); thor_free(pblock1_v); thor_free(pblock_y); thor_free(pblock_u); thor_free(pblock_v); thor_free(coeff_y); thor_free(coeff_u); thor_free(coeff_v); } ",0 "void UrlData::UrlDataWithLoadingState::SetUrlData( scoped_refptr url_data) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (url_data) url_data->IncreaseLoadersInState(loading_state_); if (url_data_) url_data_->DecreaseLoadersInState(loading_state_); url_data_ = std::move(url_data); } ",0 "static int vmx_handle_exit(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); u32 exit_reason = vmx->exit_reason; u32 vectoring_info = vmx->idt_vectoring_info; trace_kvm_exit(exit_reason, vcpu, KVM_ISA_VMX); /* * Flush logged GPAs PML buffer, this will make dirty_bitmap more * updated. Another good is, in kvm_vm_ioctl_get_dirty_log, before * querying dirty_bitmap, we only need to kick all vcpus out of guest * mode as if vcpus is in root mode, the PML buffer must has been * flushed already. */ if (enable_pml) vmx_flush_pml_buffer(vcpu); /* If guest state is invalid, start emulating */ if (vmx->emulation_required) return handle_invalid_guest_state(vcpu); if (is_guest_mode(vcpu) && nested_vmx_exit_handled(vcpu)) { nested_vmx_vmexit(vcpu, exit_reason, vmcs_read32(VM_EXIT_INTR_INFO), vmcs_readl(EXIT_QUALIFICATION)); return 1; } if (exit_reason & VMX_EXIT_REASONS_FAILED_VMENTRY) { dump_vmcs(); vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; vcpu->run->fail_entry.hardware_entry_failure_reason = exit_reason; return 0; } if (unlikely(vmx->fail)) { vcpu->run->exit_reason = KVM_EXIT_FAIL_ENTRY; vcpu->run->fail_entry.hardware_entry_failure_reason = vmcs_read32(VM_INSTRUCTION_ERROR); return 0; } /* * Note: * Do not try to fix EXIT_REASON_EPT_MISCONFIG if it caused by * delivery event since it indicates guest is accessing MMIO. * The vm-exit can be triggered again after return to guest that * will cause infinite loop. */ if ((vectoring_info & VECTORING_INFO_VALID_MASK) && (exit_reason != EXIT_REASON_EXCEPTION_NMI && exit_reason != EXIT_REASON_EPT_VIOLATION && exit_reason != EXIT_REASON_TASK_SWITCH)) { vcpu->run->exit_reason = KVM_EXIT_INTERNAL_ERROR; vcpu->run->internal.suberror = KVM_INTERNAL_ERROR_DELIVERY_EV; vcpu->run->internal.ndata = 2; vcpu->run->internal.data[0] = vectoring_info; vcpu->run->internal.data[1] = exit_reason; return 0; } if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked && !(is_guest_mode(vcpu) && nested_cpu_has_virtual_nmis( get_vmcs12(vcpu))))) { if (vmx_interrupt_allowed(vcpu)) { vmx->soft_vnmi_blocked = 0; } else if (vmx->vnmi_blocked_time > 1000000000LL && vcpu->arch.nmi_pending) { /* * This CPU don't support us in finding the end of an * NMI-blocked window if the guest runs with IRQs * disabled. So we pull the trigger after 1 s of * futile waiting, but inform the user about this. */ printk(KERN_WARNING ""%s: Breaking out of NMI-blocked "" ""state on VCPU %d after 1 s timeout\n"", __func__, vcpu->vcpu_id); vmx->soft_vnmi_blocked = 0; } } if (exit_reason < kvm_vmx_max_exit_handlers && kvm_vmx_exit_handlers[exit_reason]) return kvm_vmx_exit_handlers[exit_reason](vcpu); else { WARN_ONCE(1, ""vmx: unexpected exit reason 0x%x\n"", exit_reason); kvm_queue_exception(vcpu, UD_VECTOR); return 1; } } ",0 "static RtreeDValue cellMargin(Rtree *pRtree, RtreeCell *p){ RtreeDValue margin = 0; int ii = pRtree->nDim2 - 2; do{ margin += (DCOORD(p->aCoord[ii+1]) - DCOORD(p->aCoord[ii])); ii -= 2; }while( ii>=0 ); return margin; } ",0 "void encodeBase64( const void *_data, size_t size, AString *out) { out->clear(); const uint8_t *data = (const uint8_t *)_data; size_t i; for (i = 0; i < (size / 3) * 3; i += 3) { uint8_t x1 = data[i]; uint8_t x2 = data[i + 1]; uint8_t x3 = data[i + 2]; out->append(encode6Bit(x1 >> 2)); out->append(encode6Bit((x1 << 4 | x2 >> 4) & 0x3f)); out->append(encode6Bit((x2 << 2 | x3 >> 6) & 0x3f)); out->append(encode6Bit(x3 & 0x3f)); } switch (size % 3) { case 0: break; case 2: { uint8_t x1 = data[i]; uint8_t x2 = data[i + 1]; out->append(encode6Bit(x1 >> 2)); out->append(encode6Bit((x1 << 4 | x2 >> 4) & 0x3f)); out->append(encode6Bit((x2 << 2) & 0x3f)); out->append('='); break; } default: { uint8_t x1 = data[i]; out->append(encode6Bit(x1 >> 2)); out->append(encode6Bit((x1 << 4) & 0x3f)); out->append(""==""); break; } } } ",0 "size_t SyncSocket::Send(const void* buffer, size_t length) { ThreadRestrictions::AssertIOAllowed(); DCHECK_GT(length, 0u); DCHECK_LE(length, kMaxMessageLength); DCHECK_NE(handle_, kInvalidHandle); size_t count = 0; while (count < length) { DWORD len; DWORD chunk = GetNextChunkSize(count, length); if (WriteFile(handle_, static_cast(buffer) + count, chunk, &len, NULL) == FALSE) { return count; } count += len; } return count; } ",0 "IsParent(WindowPtr a, WindowPtr b) { for (b = b->parent; b; b = b->parent) if (b == a) return TRUE; return FALSE; } ",0 "person_get_leader(const person_t* person) { return person->leader; } ",0 "unsigned long page_address_in_vma(struct page *page, struct vm_area_struct *vma) { unsigned long address; if (PageAnon(page)) { struct anon_vma *page__anon_vma = page_anon_vma(page); /* * Note: swapoff's unuse_vma() is more efficient with this * check, and needs it to match anon_vma when KSM is active. */ if (!vma->anon_vma || !page__anon_vma || vma->anon_vma->root != page__anon_vma->root) return -EFAULT; } else if (page->mapping && !(vma->vm_flags & VM_NONLINEAR)) { if (!vma->vm_file || vma->vm_file->f_mapping != page->mapping) return -EFAULT; } else return -EFAULT; address = __vma_address(page, vma); if (unlikely(address < vma->vm_start || address >= vma->vm_end)) return -EFAULT; return address; } ",0 "static void *nested_svm_map(struct vcpu_svm *svm, u64 gpa, struct page **_page) { struct page *page; might_sleep(); page = gfn_to_page(svm->vcpu.kvm, gpa >> PAGE_SHIFT); if (is_error_page(page)) goto error; *_page = page; return kmap(page); error: kvm_inject_gp(&svm->vcpu, 0); return NULL; } ",0 "static int sctp_getsockopt_adaptation_layer(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_setadaptation adaptation; if (len < sizeof(struct sctp_setadaptation)) return -EINVAL; len = sizeof(struct sctp_setadaptation); adaptation.ssb_adaptation_ind = sctp_sk(sk)->adaptation_ind; if (put_user(len, optlen)) return -EFAULT; if (copy_to_user(optval, &adaptation, len)) return -EFAULT; return 0; } ",0 "base::string16 ExtensionDevToolsInfoBarDelegate::GetMessageText() const { return l10n_util::GetStringFUTF16(IDS_DEV_TOOLS_INFOBAR_LABEL, base::UTF8ToUTF16(client_name_)); } ",0 "void FastSetActiveURL(const GURL& url, size_t url_hash) { if (url.is_empty()) return; static size_t g_last_url_hash = 0; if (url_hash != g_last_url_hash) { g_last_url_hash = url_hash; GetContentClient()->SetActiveURL(url); } } ",0 "static void webkit_web_view_container_add(GtkContainer* container, GtkWidget* widget) { WebKitWebView* webView = WEBKIT_WEB_VIEW(container); WebKitWebViewPrivate* priv = webView->priv; priv->children.add(widget); gtk_widget_set_parent(widget, GTK_WIDGET(container)); } ",0 "piv_write_certificate(sc_card_t *card, const u8* buf, size_t count, unsigned long flags) { piv_private_data_t * priv = PIV_DATA(card); int enumtag; int r = SC_SUCCESS; u8 *sbuf = NULL; u8 *p; size_t sbuflen; size_t taglen; sc_log(card->ctx, ""DEE cert len=%""SC_FORMAT_LEN_SIZE_T""u"", count); taglen = put_tag_and_len(0x70, count, NULL) + put_tag_and_len(0x71, 1, NULL) + put_tag_and_len(0xFE, 0, NULL); sbuflen = put_tag_and_len(0x53, taglen, NULL); sbuf = malloc(sbuflen); if (sbuf == NULL) LOG_FUNC_RETURN(card->ctx, SC_ERROR_OUT_OF_MEMORY); p = sbuf; put_tag_and_len(0x53, taglen, &p); put_tag_and_len(0x70, count, &p); memcpy(p, buf, count); p += count; put_tag_and_len(0x71, 1, &p); /* Use 01 as per NIST 800-73-3 */ *p++ = (flags)? 0x01:0x00; /* certinfo, i.e. gzipped? */ put_tag_and_len(0xFE,0,&p); /* LRC tag */ sc_log(card->ctx, ""DEE buf %p len %""SC_FORMAT_LEN_PTRDIFF_T""u %""SC_FORMAT_LEN_SIZE_T""u"", sbuf, p - sbuf, sbuflen); enumtag = piv_objects[priv->selected_obj].enumtag; r = piv_put_data(card, enumtag, sbuf, sbuflen); if (sbuf) free(sbuf); LOG_FUNC_RETURN(card->ctx, r); } ",0 "static int anon_vma_compatible(struct vm_area_struct *a, struct vm_area_struct *b) { return a->vm_end == b->vm_start && mpol_equal(vma_policy(a), vma_policy(b)) && a->vm_file == b->vm_file && !((a->vm_flags ^ b->vm_flags) & ~(VM_READ|VM_WRITE|VM_EXEC|VM_SOFTDIRTY)) && b->vm_pgoff == a->vm_pgoff + ((b->vm_start - a->vm_start) >> PAGE_SHIFT); } ",0 "BITMAP_UPDATE* update_read_bitmap_update(rdpUpdate* update, wStream* s) { UINT32 i; BITMAP_UPDATE* bitmapUpdate = calloc(1, sizeof(BITMAP_UPDATE)); if (!bitmapUpdate) goto fail; if (Stream_GetRemainingLength(s) < 2) goto fail; Stream_Read_UINT16(s, bitmapUpdate->number); /* numberRectangles (2 bytes) */ WLog_Print(update->log, WLOG_TRACE, ""BitmapUpdate: %""PRIu32"""", bitmapUpdate->number); if (bitmapUpdate->number > bitmapUpdate->count) { UINT16 count; BITMAP_DATA* newdata; count = bitmapUpdate->number * 2; newdata = (BITMAP_DATA*) realloc(bitmapUpdate->rectangles, sizeof(BITMAP_DATA) * count); if (!newdata) goto fail; bitmapUpdate->rectangles = newdata; ZeroMemory(&bitmapUpdate->rectangles[bitmapUpdate->count], sizeof(BITMAP_DATA) * (count - bitmapUpdate->count)); bitmapUpdate->count = count; } /* rectangles */ for (i = 0; i < bitmapUpdate->number; i++) { if (!update_read_bitmap_data(update, s, &bitmapUpdate->rectangles[i])) goto fail; } return bitmapUpdate; fail: free_bitmap_update(update->context, bitmapUpdate); return NULL; } ",1 "void V8TestObject::DOMTimeStampAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_domTimeStampAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::DOMTimeStampAttributeAttributeSetter(v8_value, info); } ",0 "void RTCPeerConnection::changeIceState(IceState iceState) { if (iceState == m_iceState || m_readyState == ReadyStateClosed) return; m_iceState = iceState; dispatchEvent(Event::create(eventNames().icechangeEvent, false, false)); } ",0 " Ins_ODD( TT_ExecContext exc, FT_Long* args ) { args[0] = ( ( exc->func_round( exc, args[0], 0 ) & 127 ) == 64 ); } ",0 "bool InputMethodBase::DispatchFabricatedKeyEventPostIME(EventType type, KeyboardCode key_code, int flags) const { return delegate_ ? delegate_->DispatchFabricatedKeyEventPostIME (type, key_code, flags) : false; } ",0 "nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, __be32 *p, struct nfsd3_readdirargs *args) { int len; u32 max_blocksize = svc_max_payload(rqstp); p = decode_fh(p, &args->fh); if (!p) return 0; p = xdr_decode_hyper(p, &args->cookie); args->verf = p; p += 2; args->dircount = ntohl(*p++); args->count = ntohl(*p++); len = args->count = min(args->count, max_blocksize); while (len > 0) { struct page *p = *(rqstp->rq_next_page++); if (!args->buffer) args->buffer = page_address(p); len -= PAGE_SIZE; } return xdr_argsize_check(rqstp, p); } ",0 "void HTMLMediaElement::DidRemoveTrackElement(HTMLTrackElement* track_element) { KURL url = track_element->GetNonEmptyURLAttribute(srcAttr); BLINK_MEDIA_LOG << ""didRemoveTrackElement("" << (void*)this << "") - 'src' is "" << UrlForLoggingMedia(url); TextTrack* text_track = track_element->track(); if (!text_track) return; text_track->SetHasBeenConfigured(false); if (!text_tracks_) return; text_tracks_->Remove(text_track); size_t index = text_tracks_when_resource_selection_began_.Find(text_track); if (index != kNotFound) text_tracks_when_resource_selection_began_.EraseAt(index); } ",0 "SkColor TabStrip::GetToolbarTopSeparatorColor() const { return controller_->GetToolbarTopSeparatorColor(); } ",0 "void ff_http_init_auth_state(URLContext *dest, const URLContext *src) { memcpy(&((HTTPContext *)dest->priv_data)->auth_state, &((HTTPContext *)src->priv_data)->auth_state, sizeof(HTTPAuthState)); memcpy(&((HTTPContext *)dest->priv_data)->proxy_auth_state, &((HTTPContext *)src->priv_data)->proxy_auth_state, sizeof(HTTPAuthState)); } ",0 "static int timerfd_fget(int fd, struct fd *p) { struct fd f = fdget(fd); if (!f.file) return -EBADF; if (f.file->f_op != &timerfd_fops) { fdput(f); return -EINVAL; } *p = f; return 0; } ",0 "void ar6000_TxDataCleanup(struct ar6_softc *ar) { /* flush all the data (non-control) streams * we only flush packets that are tagged as data, we leave any control packets that * were in the TX queues alone */ HTCFlushEndpoint(ar->arHtcTarget, arAc2EndpointID(ar, WMM_AC_BE), AR6K_DATA_PKT_TAG); HTCFlushEndpoint(ar->arHtcTarget, arAc2EndpointID(ar, WMM_AC_BK), AR6K_DATA_PKT_TAG); HTCFlushEndpoint(ar->arHtcTarget, arAc2EndpointID(ar, WMM_AC_VI), AR6K_DATA_PKT_TAG); HTCFlushEndpoint(ar->arHtcTarget, arAc2EndpointID(ar, WMM_AC_VO), AR6K_DATA_PKT_TAG); } ",0 "circle_ar(CIRCLE *circle) { return M_PI * (circle->radius * circle->radius); } ",0 "coolkey_get_attribute_data(const u8 *attr, u8 object_record_type, size_t buf_len, sc_cardctl_coolkey_attribute_t *attr_out) { /* handle the V0 objects first */ if (object_record_type == COOLKEY_V0_OBJECT) { return coolkey_v0_get_attribute_data(attr, buf_len, attr_out); } /* don't crash if we encounter some new or corrupted coolkey device */ if (object_record_type != COOLKEY_V1_OBJECT) { return SC_ERROR_NO_CARD_SUPPORT; } return coolkey_v1_get_attribute_data(attr, buf_len, attr_out); } ",0 "static void ip6_evictor(struct net *net, struct inet6_dev *idev) { int evicted; evicted = inet_frag_evictor(&net->ipv6.frags, &ip6_frags); if (evicted) IP6_ADD_STATS_BH(net, idev, IPSTATS_MIB_REASMFAILS, evicted); } ",0 "static LPITEMIDLIST GetNthPIDL(CIDA* cida, int n) { return reinterpret_cast( reinterpret_cast(cida) + cida->aoffset[n]); } ",0 "node_get_declared_family(const node_t *node) { if (node->ri && node->ri->declared_family) return node->ri->declared_family; else if (node->md && node->md->family) return node->md->family; else return NULL; } ",0 "int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) { regs->rax = kvm_register_read(vcpu, VCPU_REGS_RAX); regs->rbx = kvm_register_read(vcpu, VCPU_REGS_RBX); regs->rcx = kvm_register_read(vcpu, VCPU_REGS_RCX); regs->rdx = kvm_register_read(vcpu, VCPU_REGS_RDX); regs->rsi = kvm_register_read(vcpu, VCPU_REGS_RSI); regs->rdi = kvm_register_read(vcpu, VCPU_REGS_RDI); regs->rsp = kvm_register_read(vcpu, VCPU_REGS_RSP); regs->rbp = kvm_register_read(vcpu, VCPU_REGS_RBP); #ifdef CONFIG_X86_64 regs->r8 = kvm_register_read(vcpu, VCPU_REGS_R8); regs->r9 = kvm_register_read(vcpu, VCPU_REGS_R9); regs->r10 = kvm_register_read(vcpu, VCPU_REGS_R10); regs->r11 = kvm_register_read(vcpu, VCPU_REGS_R11); regs->r12 = kvm_register_read(vcpu, VCPU_REGS_R12); regs->r13 = kvm_register_read(vcpu, VCPU_REGS_R13); regs->r14 = kvm_register_read(vcpu, VCPU_REGS_R14); regs->r15 = kvm_register_read(vcpu, VCPU_REGS_R15); #endif regs->rip = kvm_rip_read(vcpu); regs->rflags = kvm_get_rflags(vcpu); return 0; } ",0 "bool PDFiumEngine::PageIndexInBounds(int index) const { return index >= 0 && index < static_cast(pages_.size()); } ",0 " virtual InputMethodDescriptor previous_input_method() const { if (previous_input_method_.id.empty()) { return input_method::GetFallbackInputMethodDescriptor(); } return previous_input_method_; } ",1 "static void intra_prediction_unit(HEVCContext *s, int x0, int y0, int log2_cb_size) { HEVCLocalContext *lc = s->HEVClc; static const uint8_t intra_chroma_table[4] = { 0, 26, 10, 1 }; uint8_t prev_intra_luma_pred_flag[4]; int split = lc->cu.part_mode == PART_NxN; int pb_size = (1 << log2_cb_size) >> split; int side = split + 1; int chroma_mode; int i, j; for (i = 0; i < side; i++) for (j = 0; j < side; j++) prev_intra_luma_pred_flag[2 * i + j] = ff_hevc_prev_intra_luma_pred_flag_decode(s); for (i = 0; i < side; i++) { for (j = 0; j < side; j++) { if (prev_intra_luma_pred_flag[2 * i + j]) lc->pu.mpm_idx = ff_hevc_mpm_idx_decode(s); else lc->pu.rem_intra_luma_pred_mode = ff_hevc_rem_intra_luma_pred_mode_decode(s); lc->pu.intra_pred_mode[2 * i + j] = luma_intra_pred_mode(s, x0 + pb_size * j, y0 + pb_size * i, pb_size, prev_intra_luma_pred_flag[2 * i + j]); } } if (s->ps.sps->chroma_format_idc == 3) { for (i = 0; i < side; i++) { for (j = 0; j < side; j++) { lc->pu.chroma_mode_c[2 * i + j] = chroma_mode = ff_hevc_intra_chroma_pred_mode_decode(s); if (chroma_mode != 4) { if (lc->pu.intra_pred_mode[2 * i + j] == intra_chroma_table[chroma_mode]) lc->pu.intra_pred_mode_c[2 * i + j] = 34; else lc->pu.intra_pred_mode_c[2 * i + j] = intra_chroma_table[chroma_mode]; } else { lc->pu.intra_pred_mode_c[2 * i + j] = lc->pu.intra_pred_mode[2 * i + j]; } } } } else if (s->ps.sps->chroma_format_idc == 2) { int mode_idx; lc->pu.chroma_mode_c[0] = chroma_mode = ff_hevc_intra_chroma_pred_mode_decode(s); if (chroma_mode != 4) { if (lc->pu.intra_pred_mode[0] == intra_chroma_table[chroma_mode]) mode_idx = 34; else mode_idx = intra_chroma_table[chroma_mode]; } else { mode_idx = lc->pu.intra_pred_mode[0]; } lc->pu.intra_pred_mode_c[0] = tab_mode_idx[mode_idx]; } else if (s->ps.sps->chroma_format_idc != 0) { chroma_mode = ff_hevc_intra_chroma_pred_mode_decode(s); if (chroma_mode != 4) { if (lc->pu.intra_pred_mode[0] == intra_chroma_table[chroma_mode]) lc->pu.intra_pred_mode_c[0] = 34; else lc->pu.intra_pred_mode_c[0] = intra_chroma_table[chroma_mode]; } else { lc->pu.intra_pred_mode_c[0] = lc->pu.intra_pred_mode[0]; } } } ",0 " explicit TestURLRequestContextWithProxy(const std::string& proxy) : TestURLRequestContext(true) { context_storage_.set_proxy_service(ProxyService::CreateFixed(proxy)); Init(); } ",0 "static void uvesafb_vbe_state_restore(struct uvesafb_par *par, u8 *state_buf) { struct uvesafb_ktask *task; int err; if (!state_buf) return; task = uvesafb_prep(); if (!task) return; task->t.regs.eax = 0x4f04; task->t.regs.ecx = 0x000f; task->t.regs.edx = 0x0002; task->t.buf_len = par->vbe_state_size; task->t.flags = TF_BUF_ESBX; task->buf = state_buf; err = uvesafb_exec(task); if (err || (task->t.regs.eax & 0xffff) != 0x004f) pr_warn(""VBE state restore call failed (eax=0x%x, err=%d)\n"", task->t.regs.eax, err); uvesafb_free(task); } ",0 "bool WebPageSerializer::retrieveAllResources(WebView* view, const WebVector& supportedSchemes, WebVector* resourceURLs, WebVector* frameURLs) { WebLocalFrameImpl* mainFrame = toWebLocalFrameImpl(view->mainFrame()); if (!mainFrame) return false; Vector framesToVisit; Vector visitedFrames; Vector frameKURLs; Vector resourceKURLs; framesToVisit.append(mainFrame->frame()); while (!framesToVisit.isEmpty()) { LocalFrame* frame = framesToVisit[0]; framesToVisit.remove(0); retrieveResourcesForFrame(frame, supportedSchemes, &visitedFrames, &framesToVisit, &frameKURLs, &resourceKURLs); } WebVector resultResourceURLs(resourceKURLs.size()); for (size_t i = 0; i < resourceKURLs.size(); ++i) { resultResourceURLs[i] = resourceKURLs[i]; size_t index = frameKURLs.find(resourceKURLs[i]); if (index != kNotFound) frameKURLs.remove(index); } *resourceURLs = resultResourceURLs; WebVector resultFrameURLs(frameKURLs.size()); for (size_t i = 0; i < frameKURLs.size(); ++i) resultFrameURLs[i] = frameKURLs[i]; *frameURLs = resultFrameURLs; return true; } ",0 "void BaseRenderingContext2D::clearRect(double x, double y, double width, double height) { usage_counters_.num_clear_rect_calls++; if (!ValidateRectForCanvas(x, y, width, height)) return; PaintCanvas* c = DrawingCanvas(); if (!c) return; if (!GetState().IsTransformInvertible()) return; SkIRect clip_bounds; if (!c->getDeviceClipBounds(&clip_bounds)) return; PaintFlags clear_flags; clear_flags.setBlendMode(SkBlendMode::kClear); clear_flags.setStyle(PaintFlags::kFill_Style); FloatRect rect(x, y, width, height); if (RectContainsTransformedRect(rect, clip_bounds)) { CheckOverdraw(rect, &clear_flags, CanvasRenderingContext2DState::kNoImage, kClipFill); if (DrawingCanvas()) DrawingCanvas()->drawRect(rect, clear_flags); DidDraw(clip_bounds); } else { SkIRect dirty_rect; if (ComputeDirtyRect(rect, clip_bounds, &dirty_rect)) { c->drawRect(rect, clear_flags); DidDraw(dirty_rect); } } } ",0 "void Compositor::RemoveChildFrameSink(const viz::FrameSinkId& frame_sink_id) { if (!context_factory_private_) return; auto it = child_frame_sinks_.find(frame_sink_id); DCHECK(it != child_frame_sinks_.end()); DCHECK(it->is_valid()); context_factory_private_->GetHostFrameSinkManager() ->UnregisterFrameSinkHierarchy(frame_sink_id_, *it); child_frame_sinks_.erase(it); } ",0 "ofproto_run(struct ofproto *p) { int error; uint64_t new_seq; error = p->ofproto_class->run(p); if (error && error != EAGAIN) { VLOG_ERR_RL(&rl, ""%s: run failed (%s)"", p->name, ovs_strerror(error)); } /* Restore the eviction group heap invariant occasionally. */ if (p->eviction_group_timer < time_msec()) { size_t i; p->eviction_group_timer = time_msec() + 1000; for (i = 0; i < p->n_tables; i++) { struct oftable *table = &p->tables[i]; struct eviction_group *evg; struct rule *rule; if (!table->eviction) { continue; } if (table->n_flows > 100000) { static struct vlog_rate_limit count_rl = VLOG_RATE_LIMIT_INIT(1, 1); VLOG_WARN_RL(&count_rl, ""Table %""PRIuSIZE"" has an excessive"" "" number of rules: %d"", i, table->n_flows); } ovs_mutex_lock(&ofproto_mutex); CLS_FOR_EACH (rule, cr, &table->cls) { if (rule->idle_timeout || rule->hard_timeout) { if (!rule->eviction_group) { eviction_group_add_rule(rule); } else { heap_raw_change(&rule->evg_node, rule_eviction_priority(p, rule)); } } } HEAP_FOR_EACH (evg, size_node, &table->eviction_groups_by_size) { heap_rebuild(&evg->rules); } ovs_mutex_unlock(&ofproto_mutex); } } if (p->ofproto_class->port_poll) { char *devname; while ((error = p->ofproto_class->port_poll(p, &devname)) != EAGAIN) { process_port_change(p, error, devname); } } new_seq = seq_read(connectivity_seq_get()); if (new_seq != p->change_seq) { struct sset devnames; const char *devname; struct ofport *ofport; /* Update OpenFlow port status for any port whose netdev has changed. * * Refreshing a given 'ofport' can cause an arbitrary ofport to be * destroyed, so it's not safe to update ports directly from the * HMAP_FOR_EACH loop, or even to use HMAP_FOR_EACH_SAFE. Instead, we * need this two-phase approach. */ sset_init(&devnames); HMAP_FOR_EACH (ofport, hmap_node, &p->ports) { uint64_t port_change_seq; port_change_seq = netdev_get_change_seq(ofport->netdev); if (ofport->change_seq != port_change_seq) { ofport->change_seq = port_change_seq; sset_add(&devnames, netdev_get_name(ofport->netdev)); } } SSET_FOR_EACH (devname, &devnames) { update_port(p, devname); } sset_destroy(&devnames); p->change_seq = new_seq; } connmgr_run(p->connmgr, handle_openflow); return error; } ",0 "void PageInfo::OpenSiteSettingsView() { #if defined(OS_ANDROID) NOTREACHED(); #else chrome::ShowSiteSettings(chrome::FindBrowserWithWebContents(web_contents()), site_url()); RecordPageInfoAction(PageInfo::PAGE_INFO_SITE_SETTINGS_OPENED); #endif } ",0 "static AtomicString makeVisibleEmptyValue(const Vector& symbols) { unsigned maximumLength = 0; for (unsigned index = 0; index < symbols.size(); ++index) maximumLength = std::max(maximumLength, numGraphemeClusters(symbols[index])); StringBuilder builder; builder.reserveCapacity(maximumLength); for (unsigned length = 0; length < maximumLength; ++length) builder.append('-'); return builder.toAtomicString(); } ",0 "int lockdep_tasklist_lock_is_held(void) { return lockdep_is_held(&tasklist_lock); } ",0 "void TopSitesImpl::GetMostVisitedURLs( const GetMostVisitedURLsCallback& callback, bool include_forced_urls) { MostVisitedURLList filtered_urls; { base::AutoLock lock(lock_); if (!loaded_) { pending_callbacks_.push_back( base::Bind(&RunOrPostGetMostVisitedURLsCallback, base::RetainedRef(base::ThreadTaskRunnerHandle::Get()), include_forced_urls, callback)); return; } if (include_forced_urls) { filtered_urls = thread_safe_cache_->top_sites(); } else { filtered_urls.assign(thread_safe_cache_->top_sites().begin() + thread_safe_cache_->GetNumForcedURLs(), thread_safe_cache_->top_sites().end()); } } callback.Run(filtered_urls); } ",0 "void OMXNodeInstance::onMessages(std::list &messages) { for (std::list::iterator it = messages.begin(); it != messages.end(); ) { if (handleMessage(*it)) { messages.erase(it++); } else { ++it; } } if (!messages.empty()) { mObserver->onMessages(messages); } } ",0 " psh_glyph_load_points( PSH_Glyph glyph, FT_Int dimension ) { FT_Vector* vec = glyph->outline->points; PSH_Point point = glyph->points; FT_UInt count = glyph->num_points; for ( ; count > 0; count--, point++, vec++ ) { point->flags2 = 0; point->hint = NULL; if ( dimension == 0 ) { point->org_u = vec->x; point->org_v = vec->y; } else { point->org_u = vec->y; point->org_v = vec->x; } #ifdef DEBUG_HINTER point->org_x = vec->x; point->org_y = vec->y; #endif } } ",0 "void IndexedDBDispatcher::OnSuccessSerializedScriptValue( int32 thread_id, int32 response_id, const content::SerializedScriptValue& value) { DCHECK_EQ(thread_id, CurrentWorkerId()); WebIDBCallbacks* callbacks = pending_callbacks_.Lookup(response_id); if (!callbacks) return; callbacks->onSuccess(value); pending_callbacks_.Remove(response_id); } ",0 "sctp_disposition_t sctp_sf_unk_chunk(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *unk_chunk = arg; struct sctp_chunk *err_chunk; sctp_chunkhdr_t *hdr; pr_debug(""%s: processing unknown chunk id:%d\n"", __func__, type.chunk); if (!sctp_vtag_verify(unk_chunk, asoc)) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); /* Make sure that the chunk has a valid length. * Since we don't know the chunk type, we use a general * chunkhdr structure to make a comparison. */ if (!sctp_chunk_length_valid(unk_chunk, sizeof(sctp_chunkhdr_t))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands); switch (type.chunk & SCTP_CID_ACTION_MASK) { case SCTP_CID_ACTION_DISCARD: /* Discard the packet. */ return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); case SCTP_CID_ACTION_DISCARD_ERR: /* Generate an ERROR chunk as response. */ hdr = unk_chunk->chunk_hdr; err_chunk = sctp_make_op_error(asoc, unk_chunk, SCTP_ERROR_UNKNOWN_CHUNK, hdr, WORD_ROUND(ntohs(hdr->length)), 0); if (err_chunk) { sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(err_chunk)); } /* Discard the packet. */ sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); return SCTP_DISPOSITION_CONSUME; case SCTP_CID_ACTION_SKIP: /* Skip the chunk. */ return SCTP_DISPOSITION_DISCARD; case SCTP_CID_ACTION_SKIP_ERR: /* Generate an ERROR chunk as response. */ hdr = unk_chunk->chunk_hdr; err_chunk = sctp_make_op_error(asoc, unk_chunk, SCTP_ERROR_UNKNOWN_CHUNK, hdr, WORD_ROUND(ntohs(hdr->length)), 0); if (err_chunk) { sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(err_chunk)); } /* Skip the chunk. */ return SCTP_DISPOSITION_CONSUME; default: break; } return SCTP_DISPOSITION_DISCARD; } ",0 "flush_signal_handlers(struct task_struct *t, int force_default) { int i; struct k_sigaction *ka = &t->sighand->action[0]; for (i = _NSIG ; i != 0 ; i--) { if (force_default || ka->sa.sa_handler != SIG_IGN) ka->sa.sa_handler = SIG_DFL; ka->sa.sa_flags = 0; sigemptyset(&ka->sa.sa_mask); ka++; } } ",1 " void DownloadFilesCheckErrorsSetup() { embedded_test_server()->ServeFilesFromDirectory(GetTestDataDirectory()); ASSERT_TRUE(embedded_test_server()->Start()); std::vector download_items; GetDownloads(browser(), &download_items); ASSERT_TRUE(download_items.empty()); EnableFileChooser(true); } ",0 "FLAC__OggDecoderAspectReadStatus read_callback_proxy_(const void *void_decoder, FLAC__byte buffer[], size_t *bytes, void *client_data) { FLAC__StreamDecoder *decoder = (FLAC__StreamDecoder*)void_decoder; switch(decoder->private_->read_callback(decoder, buffer, bytes, client_data)) { case FLAC__STREAM_DECODER_READ_STATUS_CONTINUE: return FLAC__OGG_DECODER_ASPECT_READ_STATUS_OK; case FLAC__STREAM_DECODER_READ_STATUS_END_OF_STREAM: return FLAC__OGG_DECODER_ASPECT_READ_STATUS_END_OF_STREAM; case FLAC__STREAM_DECODER_READ_STATUS_ABORT: return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT; default: /* double protection: */ FLAC__ASSERT(0); return FLAC__OGG_DECODER_ASPECT_READ_STATUS_ABORT; } } ",0 "static int sched_domains_numa_masks_update(struct notifier_block *nfb, unsigned long action, void *hcpu) { int cpu = (long)hcpu; switch (action & ~CPU_TASKS_FROZEN) { case CPU_ONLINE: sched_domains_numa_masks_set(cpu); break; case CPU_DEAD: sched_domains_numa_masks_clear(cpu); break; default: return NOTIFY_DONE; } return NOTIFY_OK; } ",0 "jboolean ForeignSessionHelper::IsTabSyncEnabled( JNIEnv* env, const JavaParamRef& obj) { sync_sessions::SessionSyncService* service = SessionSyncServiceFactory::GetInstance()->GetForProfile(profile_); return service && service->GetOpenTabsUIDelegate(); } ",0 "int HarfBuzzShaper::HarfBuzzRun::characterIndexForXPosition(float targetX) { ASSERT(targetX <= m_width); float currentX = 0; float currentAdvance = m_advances[0]; unsigned glyphIndex = 0; while (glyphIndex < m_numGlyphs - 1 && m_glyphToCharacterIndexes[glyphIndex] == m_glyphToCharacterIndexes[glyphIndex + 1]) currentAdvance += m_advances[++glyphIndex]; currentAdvance = currentAdvance / 2.0; if (targetX <= currentAdvance) return rtl() ? m_numCharacters : 0; currentX = currentAdvance; ++glyphIndex; while (glyphIndex < m_numGlyphs) { unsigned prevCharacterIndex = m_glyphToCharacterIndexes[glyphIndex - 1]; float prevAdvance = currentAdvance; currentAdvance = m_advances[glyphIndex]; while (glyphIndex < m_numGlyphs - 1 && m_glyphToCharacterIndexes[glyphIndex] == m_glyphToCharacterIndexes[glyphIndex + 1]) currentAdvance += m_advances[++glyphIndex]; currentAdvance = currentAdvance / 2.0; float nextX = currentX + prevAdvance + currentAdvance; if (currentX <= targetX && targetX <= nextX) return rtl() ? prevCharacterIndex : m_glyphToCharacterIndexes[glyphIndex]; currentX = nextX; ++glyphIndex; } return rtl() ? 0 : m_numCharacters; } ",0 "static void voidMethodNullableStringArgMethod(const v8::FunctionCallbackInfo& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute(""voidMethodNullableStringArg"", ""TestObjectPython"", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(TestInterfaceEmpty*, nullableTestInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0])); imp->voidMethodNullableStringArg(nullableTestInterfaceEmptyArg); } ",0 "process_config_source( const char* file, const char* name, const char* host, int required ) { int rval; if( access( file, R_OK ) != 0 && !is_piped_command(file)) { if( !required) { return; } if( !host ) { fprintf( stderr, ""ERROR: Can't read %s %s\n"", name, file ); exit( 1 ); } } else { rval = Read_config( file, ConfigTab, TABLESIZE, EXPAND_LAZY, false, extra_info ); if( rval < 0 ) { fprintf( stderr, ""Configuration Error Line %d while reading %s %s\n"", ConfigLineNo, name, file ); exit( 1 ); } } } ",0 "static int leaks_show(struct seq_file *m, void *p) { struct kmem_cache *cachep = list_entry(p, struct kmem_cache, list); struct page *page; struct kmem_cache_node *n; const char *name; unsigned long *x = m->private; int node; int i; if (!(cachep->flags & SLAB_STORE_USER)) return 0; if (!(cachep->flags & SLAB_RED_ZONE)) return 0; /* * Set store_user_clean and start to grab stored user information * for all objects on this cache. If some alloc/free requests comes * during the processing, information would be wrong so restart * whole processing. */ do { set_store_user_clean(cachep); drain_cpu_caches(cachep); x[1] = 0; for_each_kmem_cache_node(cachep, node, n) { check_irq_on(); spin_lock_irq(&n->list_lock); list_for_each_entry(page, &n->slabs_full, lru) handle_slab(x, cachep, page); list_for_each_entry(page, &n->slabs_partial, lru) handle_slab(x, cachep, page); spin_unlock_irq(&n->list_lock); } } while (!is_store_user_clean(cachep)); name = cachep->name; if (x[0] == x[1]) { /* Increase the buffer size */ mutex_unlock(&slab_mutex); m->private = kzalloc(x[0] * 4 * sizeof(unsigned long), GFP_KERNEL); if (!m->private) { /* Too bad, we are really out */ m->private = x; mutex_lock(&slab_mutex); return -ENOMEM; } *(unsigned long *)m->private = x[0] * 2; kfree(x); mutex_lock(&slab_mutex); /* Now make sure this entry will be retried */ m->count = m->size; return 0; } for (i = 0; i < x[1]; i++) { seq_printf(m, ""%s: %lu "", name, x[2*i+3]); show_symbol(m, x[2*i+2]); seq_putc(m, '\n'); } return 0; } ",0 "int vrend_create_shader(struct vrend_context *ctx, uint32_t handle, const struct pipe_stream_output_info *so_info, const char *shd_text, uint32_t offlen, uint32_t num_tokens, uint32_t type, uint32_t pkt_length) { struct vrend_shader_selector *sel = NULL; int ret_handle; bool new_shader = true, long_shader = false; bool finished = false; int ret; if (type > PIPE_SHADER_GEOMETRY) return EINVAL; if (offlen & VIRGL_OBJ_SHADER_OFFSET_CONT) new_shader = false; else if (((offlen + 3) / 4) > pkt_length) long_shader = true; /* if we have an in progress one - don't allow a new shader of that type or a different handle. */ if (ctx->sub->long_shader_in_progress_handle[type]) { if (new_shader == true) return EINVAL; if (handle != ctx->sub->long_shader_in_progress_handle[type]) return EINVAL; } if (new_shader) { sel = vrend_create_shader_state(ctx, so_info, type); if (sel == NULL) return ENOMEM; if (long_shader) { sel->buf_len = ((offlen + 3) / 4) * 4; /* round up buffer size */ sel->tmp_buf = malloc(sel->buf_len); if (!sel->tmp_buf) { ret = ENOMEM; goto error; } memcpy(sel->tmp_buf, shd_text, pkt_length * 4); sel->buf_offset = pkt_length * 4; ctx->sub->long_shader_in_progress_handle[type] = handle; } else finished = true; } else { sel = vrend_object_lookup(ctx->sub->object_hash, handle, VIRGL_OBJECT_SHADER); if (!sel) { fprintf(stderr, ""got continuation without original shader %d\n"", handle); ret = EINVAL; goto error; } offlen &= ~VIRGL_OBJ_SHADER_OFFSET_CONT; if (offlen != sel->buf_offset) { fprintf(stderr, ""Got mismatched shader continuation %d vs %d\n"", offlen, sel->buf_offset); ret = EINVAL; goto error; } if ((pkt_length * 4 + sel->buf_offset) > sel->buf_len) { fprintf(stderr, ""Got too large shader continuation %d vs %d\n"", pkt_length * 4 + sel->buf_offset, sel->buf_len); ret = EINVAL; goto error; } memcpy(sel->tmp_buf + sel->buf_offset, shd_text, pkt_length * 4); sel->buf_offset += pkt_length * 4; if (sel->buf_offset >= sel->buf_len) { finished = true; shd_text = sel->tmp_buf; } } if (finished) { struct tgsi_token *tokens; tokens = calloc(num_tokens + 10, sizeof(struct tgsi_token)); if (!tokens) { ret = ENOMEM; goto error; } if (vrend_dump_shaders) fprintf(stderr,""shader\n%s\n"", shd_text); if (!tgsi_text_translate((const char *)shd_text, tokens, num_tokens + 10)) { free(tokens); ret = EINVAL; goto error; } if (vrend_finish_shader(ctx, sel, tokens)) { free(tokens); ret = EINVAL; goto error; } else { free(sel->tmp_buf); sel->tmp_buf = NULL; } free(tokens); ctx->sub->long_shader_in_progress_handle[type] = 0; } if (new_shader) { ret_handle = vrend_renderer_object_insert(ctx, sel, sizeof(*sel), handle, VIRGL_OBJECT_SHADER); if (ret_handle == 0) { ret = ENOMEM; goto error; } } return 0; error: if (new_shader) vrend_destroy_shader_selector(sel); else vrend_renderer_object_destroy(ctx, handle); return ret; } ",0 "LayoutUnit RenderBlockFlow::lowestFloatLogicalBottom(FloatingObject::Type floatType) const { if (!m_floatingObjects) return 0; return m_floatingObjects->lowestFloatLogicalBottom(floatType); } ",0 "void jas_matrix_divpow2(jas_matrix_t *matrix, int n) { int i; int j; jas_seqent_t *rowstart; int rowstep; jas_seqent_t *data; if (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) { assert(matrix->rows_); rowstep = jas_matrix_rowstep(matrix); for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i, rowstart += rowstep) { for (j = matrix->numcols_, data = rowstart; j > 0; --j, ++data) { *data = (*data >= 0) ? ((*data) >> n) : (-((-(*data)) >> n)); } } } } ",0 "void reply_outbuf(struct smb_request *req, uint8 num_words, uint32 num_bytes) { char *outbuf; if (!create_outbuf(req, req, (char *)req->inbuf, &outbuf, num_words, num_bytes)) { smb_panic(""could not allocate output buffer\n""); } req->outbuf = (uint8_t *)outbuf; } ",0 "void AudioContext::registerLiveAudioSummingJunction(AudioSummingJunction& junction) { ASSERT(isMainThread()); m_liveAudioSummingJunctions.add(&junction, adoptPtr(new AudioSummingJunctionDisposer(junction))); } ",0 "JNIEnv* getCallbackEnv() { return callbackEnv; } ",0 "_udev_util_encode_string(const char *str, char *str_enc, size_t len) { size_t i, j; if (str == NULL || str_enc == NULL) return -1; for (i = 0, j = 0; str[i] != '\0'; i++) { int seqlen; seqlen = utf8_encoded_valid_unichar(&str[i]); if (seqlen > 1) { if (len-j < (size_t)seqlen) goto err; memcpy(&str_enc[j], &str[i], seqlen); j += seqlen; i += (seqlen-1); } else if (str[i] == '\\' || !is_whitelisted(str[i], NULL)) { if (len-j < 4) goto err; sprintf(&str_enc[j], ""\\x%02x"", (unsigned char) str[i]); j += 4; } else { if (len-j < 1) goto err; str_enc[j] = str[i]; j++; } } if (len-j < 1) goto err; str_enc[j] = '\0'; return 0; err: return -1; } ",0 "static bool EnabledPaste(LocalFrame& frame, Event*, EditorCommandSource source) { if (!CanReadClipboard(frame, source)) return false; if (source == kCommandFromMenuOrKeyBinding && !frame.Selection().SelectionHasFocus()) return false; return frame.GetEditor().CanPaste(); } ",0 "static int ieee80211_fragment(struct ieee80211_tx_data *tx, struct sk_buff *skb, int hdrlen, int frag_threshold) { struct ieee80211_local *local = tx->local; struct ieee80211_tx_info *info; struct sk_buff *tmp; int per_fragm = frag_threshold - hdrlen - FCS_LEN; int pos = hdrlen + per_fragm; int rem = skb->len - hdrlen - per_fragm; if (WARN_ON(rem < 0)) return -EINVAL; /* first fragment was already added to queue by caller */ while (rem) { int fraglen = per_fragm; if (fraglen > rem) fraglen = rem; rem -= fraglen; tmp = dev_alloc_skb(local->tx_headroom + frag_threshold + tx->sdata->encrypt_headroom + IEEE80211_ENCRYPT_TAILROOM); if (!tmp) return -ENOMEM; __skb_queue_tail(&tx->skbs, tmp); skb_reserve(tmp, local->tx_headroom + tx->sdata->encrypt_headroom); /* copy control information */ memcpy(tmp->cb, skb->cb, sizeof(tmp->cb)); info = IEEE80211_SKB_CB(tmp); info->flags &= ~(IEEE80211_TX_CTL_CLEAR_PS_FILT | IEEE80211_TX_CTL_FIRST_FRAGMENT); if (rem) info->flags |= IEEE80211_TX_CTL_MORE_FRAMES; skb_copy_queue_mapping(tmp, skb); tmp->priority = skb->priority; tmp->dev = skb->dev; /* copy header and data */ memcpy(skb_put(tmp, hdrlen), skb->data, hdrlen); memcpy(skb_put(tmp, fraglen), skb->data + pos, fraglen); pos += fraglen; } /* adjust first fragment's length */ skb->len = hdrlen + per_fragm; return 0; } ",1 "png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { png_color palette[PNG_MAX_PALETTE_LENGTH]; int max_palette_length, num, i; #ifdef PNG_POINTER_INDEXING_SUPPORTED png_colorp pal_ptr; #endif png_debug(1, ""in png_handle_PLTE""); if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) png_chunk_error(png_ptr, ""missing IHDR""); /* Moved to before the 'after IDAT' check below because otherwise duplicate * PLTE chunks are potentially ignored (the spec says there shall not be more * than one PLTE, the error is not treated as benign, so this check trumps * the requirement that PLTE appears before IDAT.) */ else if ((png_ptr->mode & PNG_HAVE_PLTE) != 0) png_chunk_error(png_ptr, ""duplicate""); else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0) { /* This is benign because the non-benign error happened before, when an * IDAT was encountered in a color-mapped image with no PLTE. */ png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""out of place""); return; } png_ptr->mode |= PNG_HAVE_PLTE; if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""ignored in grayscale PNG""); return; } #ifndef PNG_READ_OPT_PLTE_SUPPORTED if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) { png_crc_finish(png_ptr, length); return; } #endif if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3) { png_crc_finish(png_ptr, length); if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE) png_chunk_benign_error(png_ptr, ""invalid""); else png_chunk_error(png_ptr, ""invalid""); return; } /* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */ num = (int)length / 3; /* If the palette has 256 or fewer entries but is too large for the bit * depth, we don't issue an error, to preserve the behavior of previous * libpng versions. We silently truncate the unused extra palette entries * here. */ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) max_palette_length = (1 << png_ptr->bit_depth); else max_palette_length = PNG_MAX_PALETTE_LENGTH; if (num > max_palette_length) num = max_palette_length; #ifdef PNG_POINTER_INDEXING_SUPPORTED for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++) { png_byte buf[3]; png_crc_read(png_ptr, buf, 3); pal_ptr->red = buf[0]; pal_ptr->green = buf[1]; pal_ptr->blue = buf[2]; } #else for (i = 0; i < num; i++) { png_byte buf[3]; png_crc_read(png_ptr, buf, 3); /* Don't depend upon png_color being any order */ palette[i].red = buf[0]; palette[i].green = buf[1]; palette[i].blue = buf[2]; } #endif /* If we actually need the PLTE chunk (ie for a paletted image), we do * whatever the normal CRC configuration tells us. However, if we * have an RGB image, the PLTE can be considered ancillary, so * we will act as though it is. */ #ifndef PNG_READ_OPT_PLTE_SUPPORTED if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) #endif { png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3)); } #ifndef PNG_READ_OPT_PLTE_SUPPORTED else if (png_crc_error(png_ptr) != 0) /* Only if we have a CRC error */ { /* If we don't want to use the data from an ancillary chunk, * we have two options: an error abort, or a warning and we * ignore the data in this chunk (which should be OK, since * it's considered ancillary for a RGB or RGBA image). * * IMPLEMENTATION NOTE: this is only here because png_crc_finish uses the * chunk type to determine whether to check the ancillary or the critical * flags. */ if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE) == 0) { if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) != 0) return; else png_chunk_error(png_ptr, ""CRC error""); } /* Otherwise, we (optionally) emit a warning and use the chunk. */ else if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) == 0) png_chunk_warning(png_ptr, ""CRC error""); } #endif /* TODO: png_set_PLTE has the side effect of setting png_ptr->palette to its * own copy of the palette. This has the side effect that when png_start_row * is called (this happens after any call to png_read_update_info) the * info_ptr palette gets changed. This is extremely unexpected and * confusing. * * Fix this by not sharing the palette in this way. */ png_set_PLTE(png_ptr, info_ptr, palette, num); /* The three chunks, bKGD, hIST and tRNS *must* appear after PLTE and before * IDAT. Prior to 1.6.0 this was not checked; instead the code merely * checked the apparent validity of a tRNS chunk inserted before PLTE on a * palette PNG. 1.6.0 attempts to rigorously follow the standard and * therefore does a benign error if the erroneous condition is detected *and* * cancels the tRNS if the benign error returns. The alternative is to * amend the standard since it would be rather hypocritical of the standards * maintainers to ignore it. */ #ifdef PNG_READ_tRNS_SUPPORTED if (png_ptr->num_trans > 0 || (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0)) { /* Cancel this because otherwise it would be used if the transforms * require it. Don't cancel the 'valid' flag because this would prevent * detection of duplicate chunks. */ png_ptr->num_trans = 0; if (info_ptr != NULL) info_ptr->num_trans = 0; png_chunk_benign_error(png_ptr, ""tRNS must be after""); } #endif #ifdef PNG_READ_hIST_SUPPORTED if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) != 0) png_chunk_benign_error(png_ptr, ""hIST must be after""); #endif #ifdef PNG_READ_bKGD_SUPPORTED if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0) png_chunk_benign_error(png_ptr, ""bKGD must be after""); #endif } ",0 "void WebPageProxy::handleMouseEvent(const WebMouseEvent& event) { if (!isValid()) return; if (event.type() != WebEvent::MouseMove) process()->responsivenessTimer()->start(); else { if (m_processingMouseMoveEvent) { m_nextMouseMoveEvent = adoptPtr(new WebMouseEvent(event)); return; } m_processingMouseMoveEvent = true; } process()->send(Messages::WebPage::MouseEvent(event), m_pageID); } ",0 "CursorCloseScreen(ScreenPtr pScreen) { CursorScreenPtr cs = GetCursorScreen(pScreen); Bool ret; _X_UNUSED CloseScreenProcPtr close_proc; _X_UNUSED DisplayCursorProcPtr display_proc; Unwrap(cs, pScreen, CloseScreen, close_proc); Unwrap(cs, pScreen, DisplayCursor, display_proc); deleteCursorHideCountsForScreen(pScreen); ret = (*pScreen->CloseScreen) (pScreen); free(cs); return ret; } ",0 "void Textfield::DestroyTouchSelection() { touch_selection_controller_.reset(); } ",0 "png_get_int_32(png_bytep buf) { png_int_32 i = ((png_int_32)(*buf) << 24) + ((png_int_32)(*(buf + 1)) << 16) + ((png_int_32)(*(buf + 2)) << 8) + (png_int_32)(*(buf + 3)); return (i); } ",0 "void GLES2DecoderImpl::PerformIdleWork() { gpu_tracer_->ProcessTraces(); ProcessPendingReadPixels(false); } ",0 "gfx::Size RenderViewImpl::GetSize() { return size(); } ",0 "int usb_port_suspend(struct usb_device *udev, pm_message_t msg) { struct usb_hub *hub = usb_hub_to_struct_hub(udev->parent); struct usb_port *port_dev = hub->ports[udev->portnum - 1]; int port1 = udev->portnum; int status; bool really_suspend = true; usb_lock_port(port_dev); /* enable remote wakeup when appropriate; this lets the device * wake up the upstream hub (including maybe the root hub). * * NOTE: OTG devices may issue remote wakeup (or SRP) even when * we don't explicitly enable it here. */ if (udev->do_remote_wakeup) { status = usb_enable_remote_wakeup(udev); if (status) { dev_dbg(&udev->dev, ""won't remote wakeup, status %d\n"", status); /* bail if autosuspend is requested */ if (PMSG_IS_AUTO(msg)) goto err_wakeup; } } /* disable USB2 hardware LPM */ if (udev->usb2_hw_lpm_enabled == 1) usb_set_usb2_hardware_lpm(udev, 0); if (usb_disable_ltm(udev)) { dev_err(&udev->dev, ""Failed to disable LTM before suspend\n""); status = -ENOMEM; if (PMSG_IS_AUTO(msg)) goto err_ltm; } /* see 7.1.7.6 */ if (hub_is_superspeed(hub->hdev)) status = hub_set_port_link_state(hub, port1, USB_SS_PORT_LS_U3); /* * For system suspend, we do not need to enable the suspend feature * on individual USB-2 ports. The devices will automatically go * into suspend a few ms after the root hub stops sending packets. * The USB 2.0 spec calls this ""global suspend"". * * However, many USB hubs have a bug: They don't relay wakeup requests * from a downstream port if the port's suspend feature isn't on. * Therefore we will turn on the suspend feature if udev or any of its * descendants is enabled for remote wakeup. */ else if (PMSG_IS_AUTO(msg) || wakeup_enabled_descendants(udev) > 0) status = set_port_feature(hub->hdev, port1, USB_PORT_FEAT_SUSPEND); else { really_suspend = false; status = 0; } if (status) { dev_dbg(&port_dev->dev, ""can't suspend, status %d\n"", status); /* Try to enable USB3 LTM again */ usb_enable_ltm(udev); err_ltm: /* Try to enable USB2 hardware LPM again */ if (udev->usb2_hw_lpm_capable == 1) usb_set_usb2_hardware_lpm(udev, 1); if (udev->do_remote_wakeup) (void) usb_disable_remote_wakeup(udev); err_wakeup: /* System sleep transitions should never fail */ if (!PMSG_IS_AUTO(msg)) status = 0; } else { dev_dbg(&udev->dev, ""usb %ssuspend, wakeup %d\n"", (PMSG_IS_AUTO(msg) ? ""auto-"" : """"), udev->do_remote_wakeup); if (really_suspend) { udev->port_is_suspended = 1; /* device has up to 10 msec to fully suspend */ msleep(10); } usb_set_device_state(udev, USB_STATE_SUSPENDED); } if (status == 0 && !udev->do_remote_wakeup && udev->persist_enabled && test_and_clear_bit(port1, hub->child_usage_bits)) pm_runtime_put_sync(&port_dev->dev); usb_mark_last_busy(hub->hdev); usb_unlock_port(port_dev); return status; } ",0 "AffineTransform& AffineTransform::skew(double angleX, double angleY) { return shear(tan(deg2rad(angleX)), tan(deg2rad(angleY))); } ",0 "bool config_save(const config_t *config, const char *filename) { assert(config != NULL); assert(filename != NULL); assert(*filename != '\0'); char *temp_filename = osi_calloc(strlen(filename) + 5); if (!temp_filename) { LOG_ERROR(""%s unable to allocate memory for filename."", __func__); return false; } strcpy(temp_filename, filename); strcat(temp_filename, "".new""); FILE *fp = fopen(temp_filename, ""wt""); if (!fp) { LOG_ERROR(""%s unable to write file '%s': %s"", __func__, temp_filename, strerror(errno)); goto error; } for (const list_node_t *node = list_begin(config->sections); node != list_end(config->sections); node = list_next(node)) { const section_t *section = (const section_t *)list_node(node); fprintf(fp, ""[%s]\n"", section->name); for (const list_node_t *enode = list_begin(section->entries); enode != list_end(section->entries); enode = list_next(enode)) { const entry_t *entry = (const entry_t *)list_node(enode); fprintf(fp, ""%s = %s\n"", entry->key, entry->value); } if (list_next(node) != list_end(config->sections)) fputc('\n', fp); } fflush(fp); fclose(fp); if (chmod(temp_filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP) == -1) { LOG_ERROR(""%s unable to change file permissions '%s': %s"", __func__, filename, strerror(errno)); goto error; } if (rename(temp_filename, filename) == -1) { LOG_ERROR(""%s unable to commit file '%s': %s"", __func__, filename, strerror(errno)); goto error; } osi_free(temp_filename); return true; error:; unlink(temp_filename); osi_free(temp_filename); return false; } ",1 "static int rds_cmsg_recv(struct rds_incoming *inc, struct msghdr *msg, struct rds_sock *rs) { int ret = 0; if (inc->i_rdma_cookie) { ret = put_cmsg(msg, SOL_RDS, RDS_CMSG_RDMA_DEST, sizeof(inc->i_rdma_cookie), &inc->i_rdma_cookie); if (ret) return ret; } if ((inc->i_rx_tstamp.tv_sec != 0) && sock_flag(rds_rs_to_sk(rs), SOCK_RCVTSTAMP)) { ret = put_cmsg(msg, SOL_SOCKET, SCM_TIMESTAMP, sizeof(struct timeval), &inc->i_rx_tstamp); if (ret) return ret; } return 0; } ",0 "void Textfield::OffsetDoubleClickWord(int offset) { selection_controller_.OffsetDoubleClickWord(offset); } ",0 "static void __br_mdb_notify(struct net_device *dev, struct br_mdb_entry *entry, int type) { struct net *net = dev_net(dev); struct sk_buff *skb; int err = -ENOBUFS; skb = nlmsg_new(rtnl_mdb_nlmsg_size(), GFP_ATOMIC); if (!skb) goto errout; err = nlmsg_populate_mdb_fill(skb, dev, entry, 0, 0, type, NTF_SELF); if (err < 0) { kfree_skb(skb); goto errout; } rtnl_notify(skb, net, 0, RTNLGRP_MDB, NULL, GFP_ATOMIC); return; errout: rtnl_set_sk_err(net, RTNLGRP_MDB, err); } ",0 "WebsiteSettingsPopupView::~WebsiteSettingsPopupView() { } ",0 "void InspectorClientImpl::sendMessageToFrontend(PassRefPtr message) { if (WebDevToolsAgentImpl* agent = devToolsAgent()) agent->sendMessageToFrontend(message); } ",0 "void RenderThreadImpl::AddFilter(IPC::ChannelProxy::MessageFilter* filter) { channel()->AddFilter(filter); } ",0 "bool RenderProcessHostImpl::MayReuseHost() { if (is_never_suitable_for_reuse_) return false; return GetContentClient()->browser()->MayReuseHost(this); } ",0 " const Extension* extension() { return extension_.get(); } ",0 "static int do_tkill(pid_t tgid, pid_t pid, int sig) { struct siginfo info; info.si_signo = sig; info.si_errno = 0; info.si_code = SI_TKILL; info.si_pid = task_tgid_vnr(current); info.si_uid = from_kuid_munged(current_user_ns(), current_uid()); return do_send_specific(tgid, pid, sig, &info); } ",0 "void ipc_init_ids(struct ipc_ids *ids) { ids->in_use = 0; ids->seq = 0; ids->next_id = -1; init_rwsem(&ids->rwsem); idr_init(&ids->ipcs_idr); } ",0 "PassRefPtr RTCSessionDescriptionRequestImpl::create(ScriptExecutionContext* context, PassRefPtr successCallback, PassRefPtr errorCallback) { RefPtr request = adoptRef(new RTCSessionDescriptionRequestImpl(context, successCallback, errorCallback)); request->suspendIfNeeded(); return request.release(); } ",1 "error::Error GLES2DecoderImpl::HandleGetRequestableExtensionsCHROMIUM( uint32 immediate_data_size, const gles2::GetRequestableExtensionsCHROMIUM& c) { Bucket* bucket = CreateBucket(c.bucket_id); FeatureInfo::Ref info(new FeatureInfo()); info->Initialize(disallowed_features_, NULL); bucket->SetFromString(info->extensions().c_str()); return error::kNoError; } ",0 "static void tcp_mtup_probe_failed(struct sock *sk) { struct inet_connection_sock *icsk = inet_csk(sk); icsk->icsk_mtup.search_high = icsk->icsk_mtup.probe_size - 1; icsk->icsk_mtup.probe_size = 0; NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPMTUPFAIL); } ",0 "SProcXvQueryPortAttributes(ClientPtr client) { REQUEST(xvQueryPortAttributesReq); REQUEST_SIZE_MATCH(xvQueryPortAttributesReq); swaps(&stuff->length); swapl(&stuff->port); return XvProcVector[xv_QueryPortAttributes] (client); } ",0 "static void salsa20_keysetup(struct salsa20_ctx *ctx, const u8 *k, u32 kbytes) { const char *constants; ctx->input[1] = U8TO32_LITTLE(k + 0); ctx->input[2] = U8TO32_LITTLE(k + 4); ctx->input[3] = U8TO32_LITTLE(k + 8); ctx->input[4] = U8TO32_LITTLE(k + 12); if (kbytes == 32) { /* recommended */ k += 16; constants = sigma; } else { /* kbytes == 16 */ constants = tau; } ctx->input[11] = U8TO32_LITTLE(k + 0); ctx->input[12] = U8TO32_LITTLE(k + 4); ctx->input[13] = U8TO32_LITTLE(k + 8); ctx->input[14] = U8TO32_LITTLE(k + 12); ctx->input[0] = U8TO32_LITTLE(constants + 0); ctx->input[5] = U8TO32_LITTLE(constants + 4); ctx->input[10] = U8TO32_LITTLE(constants + 8); ctx->input[15] = U8TO32_LITTLE(constants + 12); } ",0 "int ClearCookiesFunction::GetRemovalMask() const { return BrowsingDataRemover::REMOVE_COOKIES; } ",0 "static int nested_vmx_store_msr(struct kvm_vcpu *vcpu, u64 gpa, u32 count) { u32 i; struct vmx_msr_entry e; for (i = 0; i < count; i++) { struct msr_data msr_info; if (kvm_vcpu_read_guest(vcpu, gpa + i * sizeof(e), &e, 2 * sizeof(u32))) { pr_warn_ratelimited( ""%s cannot read MSR entry (%u, 0x%08llx)\n"", __func__, i, gpa + i * sizeof(e)); return -EINVAL; } if (nested_vmx_store_msr_check(vcpu, &e)) { pr_warn_ratelimited( ""%s check failed (%u, 0x%x, 0x%x)\n"", __func__, i, e.index, e.reserved); return -EINVAL; } msr_info.host_initiated = false; msr_info.index = e.index; if (kvm_get_msr(vcpu, &msr_info)) { pr_warn_ratelimited( ""%s cannot read MSR (%u, 0x%x)\n"", __func__, i, e.index); return -EINVAL; } if (kvm_vcpu_write_guest(vcpu, gpa + i * sizeof(e) + offsetof(struct vmx_msr_entry, value), &msr_info.data, sizeof(msr_info.data))) { pr_warn_ratelimited( ""%s cannot write MSR (%u, 0x%x, 0x%llx)\n"", __func__, i, e.index, msr_info.data); return -EINVAL; } } return 0; } ",0 "void TabsCaptureVisibleTabFunction::OnCaptureFailure(CaptureResult result) { Respond(Error(CaptureResultToErrorMessage(result))); } ",0 "XineramifyXv(void) { XvScreenPtr xvsp0 = dixLookupPrivate(&screenInfo.screens[0]->devPrivates, XvGetScreenKey()); XvAdaptorPtr MatchingAdaptors[MAXSCREENS]; int i, j, k; XvXRTPort = CreateNewResourceType(XineramaDeleteResource, ""XvXRTPort""); if (!xvsp0 || !XvXRTPort) return; SetResourceTypeErrorValue(XvXRTPort, _XvBadPort); for (i = 0; i < xvsp0->nAdaptors; i++) { Bool isOverlay; XvAdaptorPtr refAdapt = xvsp0->pAdaptors + i; if (!(refAdapt->type & XvInputMask)) continue; MatchingAdaptors[0] = refAdapt; isOverlay = hasOverlay(refAdapt); FOR_NSCREENS_FORWARD_SKIP(j) MatchingAdaptors[j] = matchAdaptor(screenInfo.screens[j], refAdapt, isOverlay); /* now create a resource for each port */ for (j = 0; j < refAdapt->nPorts; j++) { PanoramiXRes *port = malloc(sizeof(PanoramiXRes)); if (!port) break; FOR_NSCREENS(k) { if (MatchingAdaptors[k] && (MatchingAdaptors[k]->nPorts > j)) port->info[k].id = MatchingAdaptors[k]->base_id + j; else port->info[k].id = 0; } AddResource(port->info[0].id, XvXRTPort, port); } } /* munge the dispatch vector */ XvProcVector[xv_PutVideo] = XineramaXvPutVideo; XvProcVector[xv_PutStill] = XineramaXvPutStill; XvProcVector[xv_StopVideo] = XineramaXvStopVideo; XvProcVector[xv_SetPortAttribute] = XineramaXvSetPortAttribute; XvProcVector[xv_PutImage] = XineramaXvPutImage; XvProcVector[xv_ShmPutImage] = XineramaXvShmPutImage; } ",0 "xmlParseGetLasts(xmlParserCtxtPtr ctxt, const xmlChar **lastlt, const xmlChar **lastgt) { const xmlChar *tmp; if ((ctxt == NULL) || (lastlt == NULL) || (lastgt == NULL)) { xmlGenericError(xmlGenericErrorContext, ""Internal error: xmlParseGetLasts\n""); return; } if ((ctxt->progressive != 0) && (ctxt->inputNr == 1)) { tmp = ctxt->input->end; tmp--; while ((tmp >= ctxt->input->base) && (*tmp != '<')) tmp--; if (tmp < ctxt->input->base) { *lastlt = NULL; *lastgt = NULL; } else { *lastlt = tmp; tmp++; while ((tmp < ctxt->input->end) && (*tmp != '>')) { if (*tmp == '\'') { tmp++; while ((tmp < ctxt->input->end) && (*tmp != '\'')) tmp++; if (tmp < ctxt->input->end) tmp++; } else if (*tmp == '""') { tmp++; while ((tmp < ctxt->input->end) && (*tmp != '""')) tmp++; if (tmp < ctxt->input->end) tmp++; } else tmp++; } if (tmp < ctxt->input->end) *lastgt = tmp; else { tmp = *lastlt; tmp--; while ((tmp >= ctxt->input->base) && (*tmp != '>')) tmp--; if (tmp >= ctxt->input->base) *lastgt = tmp; else *lastgt = NULL; } } } else { *lastlt = NULL; *lastgt = NULL; } } ",0 " static const MediaQueryEvaluator& screenEval() { DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticScreenEval, (""screen"")); return staticScreenEval; } ",0 "static int xt_table_open(struct inode *inode, struct file *file) { int ret; struct xt_names_priv *priv; ret = seq_open_net(inode, file, &xt_table_seq_ops, sizeof(struct xt_names_priv)); if (!ret) { priv = ((struct seq_file *)file->private_data)->private; priv->af = (unsigned long)PDE_DATA(inode); } return ret; } ",0 "reduce_timeout(uint16_t max, uint16_t *timeout) { if (max && (!*timeout || *timeout > max)) { *timeout = max; } } ",0 " TestOptimizationGuideService* service() { return optimization_guide_service_; } ",0 " tt_cmap6_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p; FT_UInt length, count; if ( table + 10 > valid->limit ) FT_INVALID_TOO_SHORT; p = table + 2; length = TT_NEXT_USHORT( p ); p = table + 8; /* skip language and start index */ count = TT_NEXT_USHORT( p ); if ( table + length > valid->limit || length < 10 + count * 2 ) FT_INVALID_TOO_SHORT; /* check glyph indices */ if ( valid->level >= FT_VALIDATE_TIGHT ) { FT_UInt gindex; for ( ; count > 0; count-- ) { gindex = TT_NEXT_USHORT( p ); if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) ) FT_INVALID_GLYPH_ID; } } return SFNT_Err_Ok; } ",0 "void HTMLMediaElement::SetPlayerPreload() { if (web_media_player_) web_media_player_->SetPreload(EffectivePreloadType()); if (LoadIsDeferred() && EffectivePreloadType() != WebMediaPlayer::kPreloadNone) StartDeferredLoad(); } ",0 "void RenderFrameImpl::BindAutoplayConfiguration( blink::mojom::AutoplayConfigurationClientAssociatedRequest request) { autoplay_configuration_binding_.Bind( std::move(request), GetTaskRunner(blink::TaskType::kInternalIPC)); } ",0 "void read_coeff(stream_t *stream,int16_t *coeff,int size,int type){ int16_t scoeff[MAX_QUANT_SIZE*MAX_QUANT_SIZE]; int i,j,levelFlag,sign,level,pos,run,tmp,code; int qsize = min(size,MAX_QUANT_SIZE); int N = qsize*qsize; int level_mode; int chroma_flag = type&1; int intra_flag = (type>>1)&1; int vlc_adaptive = intra_flag && !chroma_flag; /* Initialize arrays */ memset(scoeff,0,N*sizeof(int16_t)); memset(coeff,0,size*size*sizeof(int16_t)); pos = 0; /* Use one bit to signal chroma/last_pos=1/level=1 */ if (chroma_flag==1){ int tmp = get_flc(1, stream); if (tmp){ sign = get_flc(1, stream); scoeff[pos] = sign ? -1 : 1; pos = N; } } /* Initiate forward scan */ level_mode = 1; level = 1; while (pos < N){ if (level_mode){ /* Level-mode */ while (pos < N && level > 0){ level = get_vlc(vlc_adaptive,stream); if (level){ sign = get_flc(1, stream); } else{ sign = 1; } scoeff[pos] = sign ? -level : level; if (chroma_flag==0) vlc_adaptive = level > 3; pos++; } } if (pos >= N){ break; } /* Run-mode */ int eob; int eob_pos = chroma_flag ? 0 : 2; if (chroma_flag && size <= 8) code = get_vlc(10, stream); else code = get_vlc(6, stream); eob = code == eob_pos; if (eob) { break; } if (code > eob_pos) code -= 1; levelFlag = (code % 5) == 4; if (levelFlag) run = code / 5; else run = 4*(code/5) + code % 5; pos += run; /* Decode level and sign */ if (levelFlag){ tmp = get_vlc(0,stream); sign = tmp&1; level = (tmp>>1)+2; } else{ level = 1; sign = get_flc(1, stream); } scoeff[pos] = sign ? -level : level; level_mode = level > 1; //Set level_mode pos++; } //while pos < N /* Perform inverse zigzag scan */ int *zigzagptr = zigzag64; if (qsize==4) zigzagptr = zigzag16; else if (qsize==8) zigzagptr = zigzag64; else if (qsize==16) zigzagptr = zigzag256; for (i=0;ireq); if (err) return err; fuse_copy_finish(cs); if (cs->pipebufs) { struct pipe_buffer *buf = cs->pipebufs; if (!cs->write) { err = pipe_buf_confirm(cs->pipe, buf); if (err) return err; BUG_ON(!cs->nr_segs); cs->currbuf = buf; cs->pg = buf->page; cs->offset = buf->offset; cs->len = buf->len; cs->pipebufs++; cs->nr_segs--; } else { if (cs->nr_segs == cs->pipe->buffers) return -EIO; page = alloc_page(GFP_HIGHUSER); if (!page) return -ENOMEM; buf->page = page; buf->offset = 0; buf->len = 0; cs->currbuf = buf; cs->pg = page; cs->offset = 0; cs->len = PAGE_SIZE; cs->pipebufs++; cs->nr_segs++; } } else { size_t off; err = iov_iter_get_pages(cs->iter, &page, PAGE_SIZE, 1, &off); if (err < 0) return err; BUG_ON(!err); cs->len = err; cs->offset = off; cs->pg = page; iov_iter_advance(cs->iter, err); } return lock_request(cs->req); } ",0 "void Element::setIsInTopLayer(bool inTopLayer) { if (isInTopLayer() == inTopLayer) return; ensureElementRareData()->setIsInTopLayer(inTopLayer); lazyReattachIfAttached(); } ",0 "void blk_drain_queue(struct request_queue *q) { spin_lock_irq(q->queue_lock); __blk_drain_queue(q, true); spin_unlock_irq(q->queue_lock); } ",0 "void Gfx::opRectangle(Object args[], int numArgs) { double x, y, w, h; x = args[0].getNum(); y = args[1].getNum(); w = args[2].getNum(); h = args[3].getNum(); state->moveTo(x, y); state->lineTo(x + w, y); state->lineTo(x + w, y + h); state->lineTo(x, y + h); state->closePath(); } ",0 "int xmlThrDefSaveNoEmptyTags(int v) { int ret; xmlMutexLock(xmlThrDefMutex); ret = xmlSaveNoEmptyTagsThrDef; xmlSaveNoEmptyTagsThrDef = v; xmlMutexUnlock(xmlThrDefMutex); return ret; } ",0 "static void bond_state_changed_callback(bt_status_t status, bt_bdaddr_t *bd_addr, bt_bond_state_t state) { jbyteArray addr; int i; if (!checkCallbackThread()) { ALOGE(""Callback: '%s' is not called on the correct thread"", __FUNCTION__); return; } if (!bd_addr) { ALOGE(""Address is null in %s"", __FUNCTION__); return; } addr = callbackEnv->NewByteArray(sizeof(bt_bdaddr_t)); if (addr == NULL) { ALOGE(""Address allocation failed in %s"", __FUNCTION__); return; } callbackEnv->SetByteArrayRegion(addr, 0, sizeof(bt_bdaddr_t), (jbyte *)bd_addr); callbackEnv->CallVoidMethod(sJniCallbacksObj, method_bondStateChangeCallback, (jint) status, addr, (jint)state); checkAndClearExceptionFromCallback(callbackEnv, __FUNCTION__); callbackEnv->DeleteLocalRef(addr); } ",0 "static bool ip6_pkt_too_big(const struct sk_buff *skb, unsigned int mtu) { if (skb->len <= mtu) return false; /* ipv6 conntrack defrag sets max_frag_size + ignore_df */ if (IP6CB(skb)->frag_max_size && IP6CB(skb)->frag_max_size > mtu) return true; if (skb->ignore_df) return false; if (skb_is_gso(skb) && skb_gso_network_seglen(skb) <= mtu) return false; return true; } ",0 "void InterstitialPageImpl::OnDomOperationResponse( RenderFrameHostImpl* source, const std::string& json_string) { std::string json = json_string; NotificationService::current()->Notify(NOTIFICATION_DOM_OPERATION_RESPONSE, Source(web_contents()), Details(&json)); if (!enabled()) return; delegate_->CommandReceived(json_string); } ",0 "jas_image_t *bmp_decode(jas_stream_t *in, char *optstr) { jas_image_t *image; bmp_hdr_t hdr; bmp_info_t *info; uint_fast16_t cmptno; jas_image_cmptparm_t cmptparms[3]; jas_image_cmptparm_t *cmptparm; uint_fast16_t numcmpts; long n; if (optstr) { jas_eprintf(""warning: ignoring BMP decoder options\n""); } jas_eprintf( ""THE BMP FORMAT IS NOT FULLY SUPPORTED!\n"" ""THAT IS, THE JASPER SOFTWARE CANNOT DECODE ALL TYPES OF BMP DATA.\n"" ""IF YOU HAVE ANY PROBLEMS, PLEASE TRY CONVERTING YOUR IMAGE DATA\n"" ""TO THE PNM FORMAT, AND USING THIS FORMAT INSTEAD.\n"" ); /* Read the bitmap header. */ if (bmp_gethdr(in, &hdr)) { jas_eprintf(""cannot get header\n""); return 0; } JAS_DBGLOG(1, ( ""BMP header: magic 0x%x; siz %d; res1 %d; res2 %d; off %d\n"", hdr.magic, hdr.siz, hdr.reserved1, hdr.reserved2, hdr.off )); /* Read the bitmap information. */ if (!(info = bmp_getinfo(in))) { jas_eprintf(""cannot get info\n""); return 0; } JAS_DBGLOG(1, (""BMP information: len %d; width %d; height %d; numplanes %d; "" ""depth %d; enctype %d; siz %d; hres %d; vres %d; numcolors %d; "" ""mincolors %d\n"", info->len, info->width, info->height, info->numplanes, info->depth, info->enctype, info->siz, info->hres, info->vres, info->numcolors, info->mincolors)); /* Ensure that we support this type of BMP file. */ if (!bmp_issupported(&hdr, info)) { jas_eprintf(""error: unsupported BMP encoding\n""); bmp_info_destroy(info); return 0; } /* Skip over any useless data between the end of the palette and start of the bitmap data. */ if ((n = hdr.off - (BMP_HDRLEN + BMP_INFOLEN + BMP_PALLEN(info))) < 0) { jas_eprintf(""error: possibly bad bitmap offset?\n""); return 0; } if (n > 0) { jas_eprintf(""skipping unknown data in BMP file\n""); if (bmp_gobble(in, n)) { bmp_info_destroy(info); return 0; } } /* Get the number of components. */ numcmpts = bmp_numcmpts(info); for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno, ++cmptparm) { cmptparm->tlx = 0; cmptparm->tly = 0; cmptparm->hstep = 1; cmptparm->vstep = 1; cmptparm->width = info->width; cmptparm->height = info->height; cmptparm->prec = 8; cmptparm->sgnd = false; } /* Create image object. */ if (!(image = jas_image_create(numcmpts, cmptparms, JAS_CLRSPC_UNKNOWN))) { bmp_info_destroy(info); return 0; } if (numcmpts == 3) { jas_image_setclrspc(image, JAS_CLRSPC_SRGB); jas_image_setcmpttype(image, 0, JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_R)); jas_image_setcmpttype(image, 1, JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_G)); jas_image_setcmpttype(image, 2, JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_RGB_B)); } else { jas_image_setclrspc(image, JAS_CLRSPC_SGRAY); jas_image_setcmpttype(image, 0, JAS_IMAGE_CT_COLOR(JAS_CLRSPC_CHANIND_GRAY_Y)); } /* Read the bitmap data. */ if (bmp_getdata(in, info, image)) { bmp_info_destroy(info); jas_image_destroy(image); return 0; } bmp_info_destroy(info); return image; } ",1 "ScriptProcessorNode* BaseAudioContext::createScriptProcessor( uint32_t buffer_size, ExceptionState& exception_state) { DCHECK(IsMainThread()); return ScriptProcessorNode::Create(*this, buffer_size, exception_state); } ",0 "isdn_net_ciscohdlck_slarp_in(isdn_net_local *lp, struct sk_buff *skb) { unsigned char *p; int period; u32 code; u32 my_seq; u32 your_seq; __be32 local; __be32 *addr, *mask; if (skb->len < 14) return; p = skb->data; code = be32_to_cpup((__be32 *)p); p += 4; switch (code) { case CISCO_SLARP_REQUEST: lp->cisco_yourseq = 0; isdn_net_ciscohdlck_slarp_send_reply(lp); break; case CISCO_SLARP_REPLY: addr = (__be32 *)p; mask = (__be32 *)(p + 4); if (*mask != cpu_to_be32(0xfffffffc)) goto slarp_reply_out; if ((*addr & cpu_to_be32(3)) == cpu_to_be32(0) || (*addr & cpu_to_be32(3)) == cpu_to_be32(3)) goto slarp_reply_out; local = *addr ^ cpu_to_be32(3); printk(KERN_INFO ""%s: got slarp reply: remote ip: %pI4, local ip: %pI4 mask: %pI4\n"", lp->netdev->dev->name, addr, &local, mask); break; slarp_reply_out: printk(KERN_INFO ""%s: got invalid slarp reply (%pI4/%pI4) - ignored\n"", lp->netdev->dev->name, addr, mask); break; case CISCO_SLARP_KEEPALIVE: period = (int)((jiffies - lp->cisco_last_slarp_in + HZ/2 - 1) / HZ); if (lp->cisco_debserint && (period != lp->cisco_keepalive_period) && lp->cisco_last_slarp_in) { printk(KERN_DEBUG ""%s: Keepalive period mismatch - "" ""is %d but should be %d.\n"", lp->netdev->dev->name, period, lp->cisco_keepalive_period); } lp->cisco_last_slarp_in = jiffies; my_seq = be32_to_cpup((__be32 *)(p + 0)); your_seq = be32_to_cpup((__be32 *)(p + 4)); p += 10; lp->cisco_yourseq = my_seq; lp->cisco_mineseen = your_seq; break; } } ",0 "void InlineFlowBox::removeChild(InlineBox* child) { checkConsistency(); if (!m_dirty) dirtyLineBoxes(); root()->childRemoved(child); if (child == m_firstChild) m_firstChild = child->nextOnLine(); if (child == m_lastChild) m_lastChild = child->prevOnLine(); if (child->nextOnLine()) child->nextOnLine()->setPrevOnLine(child->prevOnLine()); if (child->prevOnLine()) child->prevOnLine()->setNextOnLine(child->nextOnLine()); child->setParent(0); checkConsistency(); } ",0 "void MojoVideoEncodeAcceleratorService::RequireBitstreamBuffers( unsigned int input_count, const gfx::Size& input_coded_size, size_t output_buffer_size) { DVLOG(2) << __func__ << "" input_count="" << input_count << "" input_coded_size="" << input_coded_size.ToString() << "" output_buffer_size="" << output_buffer_size; DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!vea_client_) return; output_buffer_size_ = output_buffer_size; input_coded_size_ = input_coded_size; vea_client_->RequireBitstreamBuffers(input_count, input_coded_size, output_buffer_size); } ",0 "int kernel_recvmsg(struct socket *sock, struct msghdr *msg, struct kvec *vec, size_t num, size_t size, int flags) { mm_segment_t oldfs = get_fs(); int result; set_fs(KERNEL_DS); /* * the following is safe, since for compiler definitions of kvec and * iovec are identical, yielding the same in-core layout and alignment */ iov_iter_init(&msg->msg_iter, READ, (struct iovec *)vec, num, size); result = sock_recvmsg(sock, msg, size, flags); set_fs(oldfs); return result; } ",0 " virtual void RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } ",1 " static void btsnoop_write(const void *data, size_t length) { if (logfile_fd != INVALID_FD) write(logfile_fd, data, length); btsnoop_net_write(data, length); } ",1 "void task_numa_work(struct callback_head *work) { unsigned long migrate, next_scan, now = jiffies; struct task_struct *p = current; struct mm_struct *mm = p->mm; u64 runtime = p->se.sum_exec_runtime; struct vm_area_struct *vma; unsigned long start, end; unsigned long nr_pte_updates = 0; long pages, virtpages; SCHED_WARN_ON(p != container_of(work, struct task_struct, numa_work)); work->next = work; /* protect against double add */ /* * Who cares about NUMA placement when they're dying. * * NOTE: make sure not to dereference p->mm before this check, * exit_task_work() happens _after_ exit_mm() so we could be called * without p->mm even though we still had it when we enqueued this * work. */ if (p->flags & PF_EXITING) return; if (!mm->numa_next_scan) { mm->numa_next_scan = now + msecs_to_jiffies(sysctl_numa_balancing_scan_delay); } /* * Enforce maximal scan/migration frequency.. */ migrate = mm->numa_next_scan; if (time_before(now, migrate)) return; if (p->numa_scan_period == 0) { p->numa_scan_period_max = task_scan_max(p); p->numa_scan_period = task_scan_start(p); } next_scan = now + msecs_to_jiffies(p->numa_scan_period); if (cmpxchg(&mm->numa_next_scan, migrate, next_scan) != migrate) return; /* * Delay this task enough that another task of this mm will likely win * the next time around. */ p->node_stamp += 2 * TICK_NSEC; start = mm->numa_scan_offset; pages = sysctl_numa_balancing_scan_size; pages <<= 20 - PAGE_SHIFT; /* MB in pages */ virtpages = pages * 8; /* Scan up to this much virtual space */ if (!pages) return; if (!down_read_trylock(&mm->mmap_sem)) return; vma = find_vma(mm, start); if (!vma) { reset_ptenuma_scan(p); start = 0; vma = mm->mmap; } for (; vma; vma = vma->vm_next) { if (!vma_migratable(vma) || !vma_policy_mof(vma) || is_vm_hugetlb_page(vma) || (vma->vm_flags & VM_MIXEDMAP)) { continue; } /* * Shared library pages mapped by multiple processes are not * migrated as it is expected they are cache replicated. Avoid * hinting faults in read-only file-backed mappings or the vdso * as migrating the pages will be of marginal benefit. */ if (!vma->vm_mm || (vma->vm_file && (vma->vm_flags & (VM_READ|VM_WRITE)) == (VM_READ))) continue; /* * Skip inaccessible VMAs to avoid any confusion between * PROT_NONE and NUMA hinting ptes */ if (!(vma->vm_flags & (VM_READ | VM_EXEC | VM_WRITE))) continue; do { start = max(start, vma->vm_start); end = ALIGN(start + (pages << PAGE_SHIFT), HPAGE_SIZE); end = min(end, vma->vm_end); nr_pte_updates = change_prot_numa(vma, start, end); /* * Try to scan sysctl_numa_balancing_size worth of * hpages that have at least one present PTE that * is not already pte-numa. If the VMA contains * areas that are unused or already full of prot_numa * PTEs, scan up to virtpages, to skip through those * areas faster. */ if (nr_pte_updates) pages -= (end - start) >> PAGE_SHIFT; virtpages -= (end - start) >> PAGE_SHIFT; start = end; if (pages <= 0 || virtpages <= 0) goto out; cond_resched(); } while (end != vma->vm_end); } out: /* * It is possible to reach the end of the VMA list but the last few * VMAs are not guaranteed to the vma_migratable. If they are not, we * would find the !migratable VMA on the next scan but not reset the * scanner to the start so check it now. */ if (vma) mm->numa_scan_offset = start; else reset_ptenuma_scan(p); up_read(&mm->mmap_sem); /* * Make sure tasks use at least 32x as much time to run other code * than they used here, to limit NUMA PTE scanning overhead to 3% max. * Usually update_task_scan_period slows down scanning enough; on an * overloaded system we need to limit overhead on a per task basis. */ if (unlikely(p->se.sum_exec_runtime != runtime)) { u64 diff = p->se.sum_exec_runtime - runtime; p->node_stamp += 32 * diff; } } ",0 "user_unsetprint(opt, printer, arg) option_t *opt; printer_func printer; void *arg; { struct userenv *uep, *uepnext; uepnext = userenv_list; while (uepnext != NULL && uepnext->ue_isset) uepnext = uepnext->ue_next; while ((uep = uepnext) != NULL) { uepnext = uep->ue_next; while (uepnext != NULL && uepnext->ue_isset) uepnext = uepnext->ue_next; (*printer)(arg, ""%s"", uep->ue_name); if (uepnext != NULL) (*printer)(arg, ""\t\t# (from %s)\n%s "", uep->ue_source, opt->name); else opt->source = uep->ue_source; } } ",0 "static uint64_t dccp_seqno(const u_char *bp) { const struct dccp_hdr *dh = (const struct dccp_hdr *)bp; uint64_t seqno; if (DCCPH_X(dh) != 0) { const struct dccp_hdr_ext *dhx = (const struct dccp_hdr_ext *)bp; seqno = EXTRACT_48BITS(dhx->dccph_seq); } else { seqno = EXTRACT_24BITS(dh->dccph_seq); } return seqno; } ",0 "static int __do_tune_cpucache(struct kmem_cache *cachep, int limit, int batchcount, int shared, gfp_t gfp) { struct array_cache __percpu *cpu_cache, *prev; int cpu; cpu_cache = alloc_kmem_cache_cpus(cachep, limit, batchcount); if (!cpu_cache) return -ENOMEM; prev = cachep->cpu_cache; cachep->cpu_cache = cpu_cache; kick_all_cpus_sync(); check_irq_on(); cachep->batchcount = batchcount; cachep->limit = limit; cachep->shared = shared; if (!prev) goto setup_node; for_each_online_cpu(cpu) { LIST_HEAD(list); int node; struct kmem_cache_node *n; struct array_cache *ac = per_cpu_ptr(prev, cpu); node = cpu_to_mem(cpu); n = get_node(cachep, node); spin_lock_irq(&n->list_lock); free_block(cachep, ac->entry, ac->avail, node, &list); spin_unlock_irq(&n->list_lock); slabs_destroy(cachep, &list); } free_percpu(prev); setup_node: return setup_kmem_cache_nodes(cachep, gfp); } ",0 "void TestingAutomationProvider::GoBackBlockUntilNavigationsComplete( int handle, int number_of_navigations, IPC::Message* reply_message) { if (tab_tracker_->ContainsHandle(handle)) { NavigationController* tab = tab_tracker_->GetResource(handle); Browser* browser = FindAndActivateTab(tab); if (browser && browser->command_updater()->IsCommandEnabled(IDC_BACK)) { new NavigationNotificationObserver(tab, this, reply_message, number_of_navigations, false, false); browser->GoBack(CURRENT_TAB); return; } } AutomationMsg_GoBackBlockUntilNavigationsComplete::WriteReplyParams( reply_message, AUTOMATION_MSG_NAVIGATION_ERROR); Send(reply_message); } ",0 "static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock_iocb *siocb = kiocb_to_siocb(iocb); struct scm_cookie tmp_scm; struct sock *sk = sock->sk; struct unix_sock *u = unix_sk(sk); struct sockaddr_un *sunaddr = msg->msg_name; int copied = 0; int check_creds = 0; int target; int err = 0; long timeo; int skip; err = -EINVAL; if (sk->sk_state != TCP_ESTABLISHED) goto out; err = -EOPNOTSUPP; if (flags&MSG_OOB) goto out; target = sock_rcvlowat(sk, flags&MSG_WAITALL, size); timeo = sock_rcvtimeo(sk, flags&MSG_DONTWAIT); msg->msg_namelen = 0; /* Lock the socket to prevent queue disordering * while sleeps in memcpy_tomsg */ if (!siocb->scm) { siocb->scm = &tmp_scm; memset(&tmp_scm, 0, sizeof(tmp_scm)); } err = mutex_lock_interruptible(&u->readlock); if (err) { err = sock_intr_errno(timeo); goto out; } skip = sk_peek_offset(sk, flags); do { int chunk; struct sk_buff *skb; unix_state_lock(sk); skb = skb_peek(&sk->sk_receive_queue); again: if (skb == NULL) { unix_sk(sk)->recursion_level = 0; if (copied >= target) goto unlock; /* * POSIX 1003.1g mandates this order. */ err = sock_error(sk); if (err) goto unlock; if (sk->sk_shutdown & RCV_SHUTDOWN) goto unlock; unix_state_unlock(sk); err = -EAGAIN; if (!timeo) break; mutex_unlock(&u->readlock); timeo = unix_stream_data_wait(sk, timeo); if (signal_pending(current) || mutex_lock_interruptible(&u->readlock)) { err = sock_intr_errno(timeo); goto out; } continue; unlock: unix_state_unlock(sk); break; } if (skip >= skb->len) { skip -= skb->len; skb = skb_peek_next(skb, &sk->sk_receive_queue); goto again; } unix_state_unlock(sk); if (check_creds) { /* Never glue messages from different writers */ if ((UNIXCB(skb).pid != siocb->scm->pid) || (UNIXCB(skb).cred != siocb->scm->cred)) break; } else { /* Copy credentials */ scm_set_cred(siocb->scm, UNIXCB(skb).pid, UNIXCB(skb).cred); check_creds = 1; } /* Copy address just once */ if (sunaddr) { unix_copy_addr(msg, skb->sk); sunaddr = NULL; } chunk = min_t(unsigned int, skb->len - skip, size); if (memcpy_toiovec(msg->msg_iov, skb->data + skip, chunk)) { if (copied == 0) copied = -EFAULT; break; } copied += chunk; size -= chunk; /* Mark read part of skb as used */ if (!(flags & MSG_PEEK)) { skb_pull(skb, chunk); sk_peek_offset_bwd(sk, chunk); if (UNIXCB(skb).fp) unix_detach_fds(siocb->scm, skb); if (skb->len) break; skb_unlink(skb, &sk->sk_receive_queue); consume_skb(skb); if (siocb->scm->fp) break; } else { /* It is questionable, see note in unix_dgram_recvmsg. */ if (UNIXCB(skb).fp) siocb->scm->fp = scm_fp_dup(UNIXCB(skb).fp); sk_peek_offset_fwd(sk, chunk); break; } } while (size); mutex_unlock(&u->readlock); scm_recv(sock, msg, siocb->scm, flags); out: return copied ? : err; } ",0 "void f2fs_enable_quota_files(struct f2fs_sb_info *sbi) { int i, ret; for (i = 0; i < MAXQUOTAS; i++) { if (sbi->s_qf_names[i]) { ret = f2fs_quota_on_mount(sbi, i); if (ret < 0) f2fs_msg(sbi->sb, KERN_ERR, ""Cannot turn on journaled "" ""quota: error %d"", ret); } } } ",0 " int size() { return size_; } ",0 "void ff_put_pixels16x16_c(uint8_t *dst, uint8_t *src, ptrdiff_t stride) { put_pixels16_8_c(dst, src, stride, 16); } ",0 "static MagickBooleanType JPEGWarningHandler(j_common_ptr jpeg_info,int level) { #define JPEGExcessiveWarnings 1000 char message[JMSG_LENGTH_MAX]; ErrorManager *error_manager; Image *image; *message='\0'; error_manager=(ErrorManager *) jpeg_info->client_data; image=error_manager->image; if (level < 0) { /* Process warning message. */ (jpeg_info->err->format_message)(jpeg_info,message); if (jpeg_info->err->num_warnings++ > JPEGExcessiveWarnings) JPEGErrorHandler(jpeg_info); ThrowBinaryException(CorruptImageWarning,(char *) message, image->filename); } else if ((image->debug != MagickFalse) && (level >= jpeg_info->err->trace_level)) { /* Process trace message. */ (jpeg_info->err->format_message)(jpeg_info,message); (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""[%s] JPEG Trace: \""%s\"""",image->filename,message); } return(MagickTrue); } ",0 "void ImageProcessorClient::CreateImageProcessorTask( const ImageProcessor::PortConfig& input_config, const ImageProcessor::PortConfig& output_config, size_t num_buffers, base::WaitableEvent* done) { DCHECK_CALLED_ON_VALID_THREAD(image_processor_client_thread_checker_); image_processor_ = ImageProcessorFactory::Create( input_config, output_config, {ImageProcessor::OutputMode::IMPORT}, num_buffers, base::BindRepeating(&ImageProcessorClient::NotifyError, base::Unretained(this))); done->Signal(); } ",0 "void RenderViewHostImpl::JavaScriptDialogClosed(IPC::Message* reply_msg, bool success, const string16& user_input) { GetProcess()->SetIgnoreInputEvents(false); bool is_waiting = is_waiting_for_beforeunload_ack_ || is_waiting_for_unload_ack_; if (is_waiting) { StartHangMonitorTimeout(TimeDelta::FromMilliseconds( success ? kUnloadTimeoutMS : hung_renderer_delay_ms_)); } ViewHostMsg_RunJavaScriptMessage::WriteReplyParams(reply_msg, success, user_input); Send(reply_msg); if (is_waiting && are_javascript_messages_suppressed_) delegate_->RendererUnresponsive(this, is_waiting); } ",0 "static bool states_equal(struct bpf_verifier_env *env, struct bpf_verifier_state *old, struct bpf_verifier_state *cur) { int i; if (old->curframe != cur->curframe) return false; /* for states to be equal callsites have to be the same * and all frame states need to be equivalent */ for (i = 0; i <= old->curframe; i++) { if (old->frame[i]->callsite != cur->frame[i]->callsite) return false; if (!func_states_equal(old->frame[i], cur->frame[i])) return false; } return true; } ",0 "static int cdrom_ioctl_get_subchnl(struct cdrom_device_info *cdi, void __user *argp) { struct cdrom_subchnl q; u8 requested, back; int ret; /* cd_dbg(CD_DO_IOCTL,""entering CDROMSUBCHNL\n"");*/ if (copy_from_user(&q, argp, sizeof(q))) return -EFAULT; requested = q.cdsc_format; if (requested != CDROM_MSF && requested != CDROM_LBA) return -EINVAL; q.cdsc_format = CDROM_MSF; ret = cdi->ops->audio_ioctl(cdi, CDROMSUBCHNL, &q); if (ret) return ret; back = q.cdsc_format; /* local copy */ sanitize_format(&q.cdsc_absaddr, &back, requested); sanitize_format(&q.cdsc_reladdr, &q.cdsc_format, requested); if (copy_to_user(argp, &q, sizeof(q))) return -EFAULT; /* cd_dbg(CD_DO_IOCTL, ""CDROMSUBCHNL successful\n""); */ return 0; } ",0 "static void rpc_free_task(struct rpc_task *task) { const struct rpc_call_ops *tk_ops = task->tk_ops; void *calldata = task->tk_calldata; if (task->tk_flags & RPC_TASK_DYNAMIC) { dprintk(""RPC: %5u freeing task\n"", task->tk_pid); mempool_free(task, rpc_task_mempool); } rpc_release_calldata(tk_ops, calldata); } ",0 "static void _make_prolog_mem_container(slurm_msg_t *msg) { prolog_launch_msg_t *req = (prolog_launch_msg_t *)msg->data; job_mem_limits_t *job_limits_ptr; step_loc_t step_info; _convert_job_mem(msg); /* Convert per-CPU mem limit */ if (req->job_mem_limit) { slurm_mutex_lock(&job_limits_mutex); if (!job_limits_list) job_limits_list = list_create(_job_limits_free); step_info.jobid = req->job_id; step_info.stepid = SLURM_EXTERN_CONT; job_limits_ptr = list_find_first (job_limits_list, _step_limits_match, &step_info); if (!job_limits_ptr) { job_limits_ptr = xmalloc(sizeof(job_mem_limits_t)); job_limits_ptr->job_id = req->job_id; job_limits_ptr->job_mem = req->job_mem_limit; job_limits_ptr->step_id = SLURM_EXTERN_CONT; job_limits_ptr->step_mem = req->job_mem_limit; #if _LIMIT_INFO info(""AddLim step:%u.%u job_mem:%u step_mem:%u"", job_limits_ptr->job_id, job_limits_ptr->step_id, job_limits_ptr->job_mem, job_limits_ptr->step_mem); #endif list_append(job_limits_list, job_limits_ptr); } slurm_mutex_unlock(&job_limits_mutex); } } ",0 "void btif_config_save(void) { assert(alarm_timer != NULL); assert(config != NULL); alarm_set(alarm_timer, CONFIG_SETTLE_PERIOD_MS, timer_config_save, NULL); } ",1 "AcpiPsGetAmlOpcode ( ACPI_WALK_STATE *WalkState) { UINT32 AmlOffset; ACPI_FUNCTION_TRACE_PTR (PsGetAmlOpcode, WalkState); WalkState->Aml = WalkState->ParserState.Aml; WalkState->Opcode = AcpiPsPeekOpcode (&(WalkState->ParserState)); /* * First cut to determine what we have found: * 1) A valid AML opcode * 2) A name string * 3) An unknown/invalid opcode */ WalkState->OpInfo = AcpiPsGetOpcodeInfo (WalkState->Opcode); switch (WalkState->OpInfo->Class) { case AML_CLASS_ASCII: case AML_CLASS_PREFIX: /* * Starts with a valid prefix or ASCII char, this is a name * string. Convert the bare name string to a namepath. */ WalkState->Opcode = AML_INT_NAMEPATH_OP; WalkState->ArgTypes = ARGP_NAMESTRING; break; case AML_CLASS_UNKNOWN: /* The opcode is unrecognized. Complain and skip unknown opcodes */ if (WalkState->PassNumber == 2) { AmlOffset = (UINT32) ACPI_PTR_DIFF (WalkState->Aml, WalkState->ParserState.AmlStart); ACPI_ERROR ((AE_INFO, ""Unknown opcode 0x%.2X at table offset 0x%.4X, ignoring"", WalkState->Opcode, (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER)))); ACPI_DUMP_BUFFER ((WalkState->ParserState.Aml - 16), 48); #ifdef ACPI_ASL_COMPILER /* * This is executed for the disassembler only. Output goes * to the disassembled ASL output file. */ AcpiOsPrintf ( ""/*\nError: Unknown opcode 0x%.2X at table offset 0x%.4X, context:\n"", WalkState->Opcode, (UINT32) (AmlOffset + sizeof (ACPI_TABLE_HEADER))); ACPI_ERROR ((AE_INFO, ""Aborting disassembly, AML byte code is corrupt"")); /* Dump the context surrounding the invalid opcode */ AcpiUtDumpBuffer (((UINT8 *) WalkState->ParserState.Aml - 16), 48, DB_BYTE_DISPLAY, (AmlOffset + sizeof (ACPI_TABLE_HEADER) - 16)); AcpiOsPrintf ("" */\n""); /* * Just abort the disassembly, cannot continue because the * parser is essentially lost. The disassembler can then * randomly fail because an ill-constructed parse tree * can result. */ return_ACPI_STATUS (AE_AML_BAD_OPCODE); #endif } /* Increment past one-byte or two-byte opcode */ WalkState->ParserState.Aml++; if (WalkState->Opcode > 0xFF) /* Can only happen if first byte is 0x5B */ { WalkState->ParserState.Aml++; } return_ACPI_STATUS (AE_CTRL_PARSE_CONTINUE); default: /* Found opcode info, this is a normal opcode */ WalkState->ParserState.Aml += AcpiPsGetOpcodeSize (WalkState->Opcode); WalkState->ArgTypes = WalkState->OpInfo->ParseArgs; break; } return_ACPI_STATUS (AE_OK); } ",0 "ZEND_API void* ZEND_FASTCALL _safe_erealloc(void *ptr, size_t nmemb, size_t size, size_t offset ZEND_FILE_LINE_DC ZEND_FILE_LINE_ORIG_DC) { return erealloc_rel(ptr, safe_address(nmemb, size, offset)); } ",0 "void ParamTraits::Log(const param_type& p, std::string* l) { l->append(""(""); LogParam(p.size, l); l->append("",""); LogParam(p.is_directory, l); l->append("",""); LogParam(p.last_modified.ToDoubleT(), l); l->append("",""); LogParam(p.last_accessed.ToDoubleT(), l); l->append("",""); LogParam(p.creation_time.ToDoubleT(), l); l->append("")""); } ",0 "static int kvm_deassign_irq(struct kvm *kvm, struct kvm_assigned_dev_kernel *assigned_dev, unsigned long irq_requested_type) { unsigned long guest_irq_type, host_irq_type; if (!irqchip_in_kernel(kvm)) return -EINVAL; /* no irq assignment to deassign */ if (!assigned_dev->irq_requested_type) return -ENXIO; host_irq_type = irq_requested_type & KVM_DEV_IRQ_HOST_MASK; guest_irq_type = irq_requested_type & KVM_DEV_IRQ_GUEST_MASK; if (host_irq_type) deassign_host_irq(kvm, assigned_dev); if (guest_irq_type) deassign_guest_irq(kvm, assigned_dev); return 0; } ",0 "DocumentElementSetMap& DocumentToElementSetMap() { DEFINE_STATIC_LOCAL(Persistent, map, (new DocumentElementSetMap)); return *map; } ",0 "bool MojoVideoEncodeAccelerator::Initialize(VideoPixelFormat input_format, const gfx::Size& input_visible_size, VideoCodecProfile output_profile, uint32_t initial_bitrate, Client* client) { DVLOG(2) << __func__ << "" input_format="" << VideoPixelFormatToString(input_format) << "", input_visible_size="" << input_visible_size.ToString() << "", output_profile="" << GetProfileName(output_profile) << "", initial_bitrate="" << initial_bitrate; DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); if (!client) return false; mojom::VideoEncodeAcceleratorClientPtr vea_client_ptr; vea_client_ = std::make_unique( client, mojo::MakeRequest(&vea_client_ptr)); bool result = false; vea_->Initialize(input_format, input_visible_size, output_profile, initial_bitrate, std::move(vea_client_ptr), &result); return result; } ",0 " MountError PerformFakeMount(const std::string& source_path, const base::FilePath& mounted_path) { if (mounted_path.empty()) return MOUNT_ERROR_INVALID_ARGUMENT; if (!base::CreateDirectory(mounted_path)) { DLOG(ERROR) << ""Failed to create directory at "" << mounted_path.value(); return MOUNT_ERROR_DIRECTORY_CREATION_FAILED; } const base::FilePath dummy_file_path = mounted_path.Append(""SUCCESSFULLY_PERFORMED_FAKE_MOUNT.txt""); const std::string dummy_file_content = ""This is a dummy file.""; const int write_result = base::WriteFile( dummy_file_path, dummy_file_content.data(), dummy_file_content.size()); if (write_result != static_cast(dummy_file_content.size())) { DLOG(ERROR) << ""Failed to put a dummy file at "" << dummy_file_path.value(); return MOUNT_ERROR_MOUNT_PROGRAM_FAILED; } return MOUNT_ERROR_NONE; } ",1 "__switch_to(struct task_struct *prev_p, struct task_struct *next_p) { struct thread_struct *prev = &prev_p->thread; struct thread_struct *next = &next_p->thread; int cpu = smp_processor_id(); struct tss_struct *tss = &per_cpu(init_tss, cpu); unsigned fsindex, gsindex; fpu_switch_t fpu; fpu = switch_fpu_prepare(prev_p, next_p, cpu); /* * Reload esp0, LDT and the page table pointer: */ load_sp0(tss, next); /* * Switch DS and ES. * This won't pick up thread selector changes, but I guess that is ok. */ savesegment(es, prev->es); if (unlikely(next->es | prev->es)) loadsegment(es, next->es); savesegment(ds, prev->ds); if (unlikely(next->ds | prev->ds)) loadsegment(ds, next->ds); /* We must save %fs and %gs before load_TLS() because * %fs and %gs may be cleared by load_TLS(). * * (e.g. xen_load_tls()) */ savesegment(fs, fsindex); savesegment(gs, gsindex); load_TLS(next, cpu); /* * Leave lazy mode, flushing any hypercalls made here. * This must be done before restoring TLS segments so * the GDT and LDT are properly updated, and must be * done before math_state_restore, so the TS bit is up * to date. */ arch_end_context_switch(next_p); /* * Switch FS and GS. * * Segment register != 0 always requires a reload. Also * reload when it has changed. When prev process used 64bit * base always reload to avoid an information leak. */ if (unlikely(fsindex | next->fsindex | prev->fs)) { loadsegment(fs, next->fsindex); /* * Check if the user used a selector != 0; if yes * clear 64bit base, since overloaded base is always * mapped to the Null selector */ if (fsindex) prev->fs = 0; } /* when next process has a 64bit base use it */ if (next->fs) wrmsrl(MSR_FS_BASE, next->fs); prev->fsindex = fsindex; if (unlikely(gsindex | next->gsindex | prev->gs)) { load_gs_index(next->gsindex); if (gsindex) prev->gs = 0; } if (next->gs) wrmsrl(MSR_KERNEL_GS_BASE, next->gs); prev->gsindex = gsindex; switch_fpu_finish(next_p, fpu); /* * Switch the PDA and FPU contexts. */ prev->usersp = this_cpu_read(old_rsp); this_cpu_write(old_rsp, next->usersp); this_cpu_write(current_task, next_p); /* * If it were not for PREEMPT_ACTIVE we could guarantee that the * preempt_count of all tasks was equal here and this would not be * needed. */ task_thread_info(prev_p)->saved_preempt_count = this_cpu_read(__preempt_count); this_cpu_write(__preempt_count, task_thread_info(next_p)->saved_preempt_count); this_cpu_write(kernel_stack, (unsigned long)task_stack_page(next_p) + THREAD_SIZE - KERNEL_STACK_OFFSET); /* * Now maybe reload the debug registers and handle I/O bitmaps */ if (unlikely(task_thread_info(next_p)->flags & _TIF_WORK_CTXSW_NEXT || task_thread_info(prev_p)->flags & _TIF_WORK_CTXSW_PREV)) __switch_to_xtra(prev_p, next_p, tss); return prev_p; } ",1 "void AutocompleteController::UpdateResult(bool is_synchronous_pass) { AutocompleteResult last_result; last_result.Swap(&result_); for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); ++i) result_.AppendMatches((*i)->matches()); result_.SortAndCull(input_); #ifndef NDEBUG result_.Validate(); #endif if (!done_) { result_.CopyOldMatches(input_, last_result); } UpdateKeywordDescriptions(&result_); UpdateAssociatedKeywords(&result_); UpdateAssistedQueryStats(&result_); bool notify_default_match = is_synchronous_pass; if (!is_synchronous_pass) { const bool last_default_was_valid = last_result.default_match() != last_result.end(); const bool default_is_valid = result_.default_match() != result_.end(); notify_default_match = (last_default_was_valid != default_is_valid) || (default_is_valid && ((result_.default_match()->fill_into_edit != last_result.default_match()->fill_into_edit) || (result_.default_match()->associated_keyword.get() != last_result.default_match()->associated_keyword.get()))); } NotifyChanged(notify_default_match); } ",0 "void InspectorPageAgent::FrameClearedScheduledNavigation(LocalFrame* frame) { GetFrontend()->frameClearedScheduledNavigation( IdentifiersFactory::FrameId(frame)); } ",0 "SERVER* dup_serve(SERVER *s) { SERVER *serve = NULL; serve=g_new0(SERVER, 1); if(serve == NULL) return NULL; if(s->exportname) serve->exportname = g_strdup(s->exportname); serve->expected_size = s->expected_size; if(s->listenaddr) serve->listenaddr = g_strdup(s->listenaddr); serve->port = s->port; if(s->authname) serve->authname = strdup(s->authname); serve->flags = s->flags; serve->socket = serve->socket; serve->socket_family = serve->socket_family; serve->cidrlen = s->cidrlen; if(s->prerun) serve->prerun = g_strdup(s->prerun); if(s->postrun) serve->postrun = g_strdup(s->postrun); if(s->servename) serve->servename = g_strdup(s->servename); serve->max_connections = s->max_connections; return serve; } ",0 "static struct dquot **ext2_get_dquots(struct inode *inode) { return EXT2_I(inode)->i_dquot; } ",0 "static void attrWithSetterExceptionAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectV8Internal::attrWithSetterExceptionAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void WebPluginDelegateProxy::DidFinishManualLoading() { Send(new PluginMsg_DidFinishManualLoading(instance_id_)); } ",0 "void reset_phy(void) { unsigned int oui; unsigned char model, rev; char *name = ""egiga0""; if (miiphy_set_current_dev(name)) return; /* reset the phy */ miiphy_reset(name, CONFIG_PHY_BASE_ADR); /* get PHY model */ if (miiphy_info(name, CONFIG_PHY_BASE_ADR, &oui, &model, &rev)) return; /* check for Marvell 88E1118R Gigabit PHY (PIGGY3) */ if ((oui == PHY_MARVELL_OUI) && (model == PHY_MARVELL_88E1118R_MODEL)) { /* set page register to 3 */ if (miiphy_write(name, CONFIG_PHY_BASE_ADR, PHY_MARVELL_PAGE_REG, PHY_MARVELL_88E1118R_LED_CTRL_PAGE)) printf(""Error writing PHY page reg\n""); /* * leds setup as printed on PCB: * LED2 (Link): 0x0 (On Link, Off No Link) * LED1 (Activity): 0x3 (On Activity, Off No Activity) * LED0 (Speed): 0x7 (On 1000 MBits, Off Else) */ if (miiphy_write(name, CONFIG_PHY_BASE_ADR, PHY_MARVELL_88E1118R_LED_CTRL_REG, PHY_MARVELL_88E1118R_LED_CTRL_RESERVED | PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB | PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT | PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK)) printf(""Error writing PHY LED reg\n""); /* set page register back to 0 */ if (miiphy_write(name, CONFIG_PHY_BASE_ADR, PHY_MARVELL_PAGE_REG, PHY_MARVELL_DEFAULT_PAGE)) printf(""Error writing PHY page reg\n""); } } ",0 "BlockedPluginInfoBarDelegate::BlockedPluginInfoBarDelegate( TabContents* tab_contents, const string16& utf16_name) : PluginInfoBarDelegate(tab_contents, utf16_name) { UserMetrics::RecordAction(UserMetricsAction(""BlockedPluginInfobar.Shown"")); std::string name = UTF16ToUTF8(utf16_name); if (name == webkit::npapi::PluginGroup::kJavaGroupName) UserMetrics::RecordAction( UserMetricsAction(""BlockedPluginInfobar.Shown.Java"")); else if (name == webkit::npapi::PluginGroup::kQuickTimeGroupName) UserMetrics::RecordAction( UserMetricsAction(""BlockedPluginInfobar.Shown.QuickTime"")); else if (name == webkit::npapi::PluginGroup::kShockwaveGroupName) UserMetrics::RecordAction( UserMetricsAction(""BlockedPluginInfobar.Shown.Shockwave"")); else if (name == webkit::npapi::PluginGroup::kRealPlayerGroupName) UserMetrics::RecordAction( UserMetricsAction(""BlockedPluginInfobar.Shown.RealPlayer"")); } ",1 "static void rm_read_metadata(AVFormatContext *s, AVIOContext *pb, int wide) { char buf[1024]; int i; for (i=0; imetadata, ff_rm_metadata[i], buf, 0); } } ",0 "static bool is_pointer_value(struct verifier_env *env, int regno) { if (env->allow_ptr_leaks) return false; switch (env->cur_state.regs[regno].type) { case UNKNOWN_VALUE: case CONST_IMM: return false; default: return true; } } ",0 "pdf_read_xref(fz_context *ctx, pdf_document *doc, int64_t ofs, pdf_lexbuf *buf) { pdf_obj *trailer; int c; fz_seek(ctx, doc->file, ofs, SEEK_SET); while (iswhite(fz_peek_byte(ctx, doc->file))) fz_read_byte(ctx, doc->file); c = fz_peek_byte(ctx, doc->file); if (c == 'x') trailer = pdf_read_old_xref(ctx, doc, buf); else if (c >= '0' && c <= '9') trailer = pdf_read_new_xref(ctx, doc, buf); else fz_throw(ctx, FZ_ERROR_GENERIC, ""cannot recognize xref format""); return trailer; } ",0 "void CheckQuotaManagedDataDeletionStatus(size_t* deletion_task_count, base::OnceClosure callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (*deletion_task_count == 0) { delete deletion_task_count; std::move(callback).Run(); } } ",0 "WebFrameProxy* WebProcessProxy::webFrame(uint64_t frameID) const { return isGoodKey(frameID) ? m_frameMap.get(frameID).get() : 0; } ",0 "static uint32_t i6300esb_mem_readb(void *vp, hwaddr addr) { i6300esb_debug (""addr = %x\n"", (int) addr); return 0; } ",0 "static int snd_usb_create_stream(struct snd_usb_audio *chip, int ctrlif, int interface) { struct usb_device *dev = chip->dev; struct usb_host_interface *alts; struct usb_interface_descriptor *altsd; struct usb_interface *iface = usb_ifnum_to_if(dev, interface); if (!iface) { dev_err(&dev->dev, ""%u:%d : does not exist\n"", ctrlif, interface); return -EINVAL; } alts = &iface->altsetting[0]; altsd = get_iface_desc(alts); /* * Android with both accessory and audio interfaces enabled gets the * interface numbers wrong. */ if ((chip->usb_id == USB_ID(0x18d1, 0x2d04) || chip->usb_id == USB_ID(0x18d1, 0x2d05)) && interface == 0 && altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC && altsd->bInterfaceSubClass == USB_SUBCLASS_VENDOR_SPEC) { interface = 2; iface = usb_ifnum_to_if(dev, interface); if (!iface) return -EINVAL; alts = &iface->altsetting[0]; altsd = get_iface_desc(alts); } if (usb_interface_claimed(iface)) { dev_dbg(&dev->dev, ""%d:%d: skipping, already claimed\n"", ctrlif, interface); return -EINVAL; } if ((altsd->bInterfaceClass == USB_CLASS_AUDIO || altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC) && altsd->bInterfaceSubClass == USB_SUBCLASS_MIDISTREAMING) { int err = __snd_usbmidi_create(chip->card, iface, &chip->midi_list, NULL, chip->usb_id); if (err < 0) { dev_err(&dev->dev, ""%u:%d: cannot create sequencer device\n"", ctrlif, interface); return -EINVAL; } usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); return 0; } if ((altsd->bInterfaceClass != USB_CLASS_AUDIO && altsd->bInterfaceClass != USB_CLASS_VENDOR_SPEC) || altsd->bInterfaceSubClass != USB_SUBCLASS_AUDIOSTREAMING) { dev_dbg(&dev->dev, ""%u:%d: skipping non-supported interface %d\n"", ctrlif, interface, altsd->bInterfaceClass); /* skip non-supported classes */ return -EINVAL; } if (snd_usb_get_speed(dev) == USB_SPEED_LOW) { dev_err(&dev->dev, ""low speed audio streaming not supported\n""); return -EINVAL; } if (! snd_usb_parse_audio_interface(chip, interface)) { usb_set_interface(dev, interface, 0); /* reset the current interface */ usb_driver_claim_interface(&usb_audio_driver, iface, (void *)-1L); } return 0; } ",0 "int kvm_set_ioapic(struct kvm *kvm, struct kvm_ioapic_state *state) { struct kvm_ioapic *ioapic = ioapic_irqchip(kvm); if (!ioapic) return -EINVAL; spin_lock(&ioapic->lock); memcpy(ioapic, state, sizeof(struct kvm_ioapic_state)); update_handled_vectors(ioapic); kvm_ioapic_make_eoibitmap_request(kvm); spin_unlock(&ioapic->lock); return 0; } ",0 "int AppLayerProtoDetectPPParseConfPorts(const char *ipproto_name, uint8_t ipproto, const char *alproto_name, AppProto alproto, uint16_t min_depth, uint16_t max_depth, ProbingParserFPtr ProbingParserTs, ProbingParserFPtr ProbingParserTc) { SCEnter(); char param[100]; int r; ConfNode *node; ConfNode *port_node = NULL; int config = 0; r = snprintf(param, sizeof(param), ""%s%s%s"", ""app-layer.protocols."", alproto_name, "".detection-ports""); if (r < 0) { SCLogError(SC_ERR_FATAL, ""snprintf failure.""); exit(EXIT_FAILURE); } else if (r > (int)sizeof(param)) { SCLogError(SC_ERR_FATAL, ""buffer not big enough to write param.""); exit(EXIT_FAILURE); } node = ConfGetNode(param); if (node == NULL) { SCLogDebug(""Entry for %s not found."", param); r = snprintf(param, sizeof(param), ""%s%s%s%s%s"", ""app-layer.protocols."", alproto_name, ""."", ipproto_name, "".detection-ports""); if (r < 0) { SCLogError(SC_ERR_FATAL, ""snprintf failure.""); exit(EXIT_FAILURE); } else if (r > (int)sizeof(param)) { SCLogError(SC_ERR_FATAL, ""buffer not big enough to write param.""); exit(EXIT_FAILURE); } node = ConfGetNode(param); if (node == NULL) goto end; } /* detect by destination port of the flow (e.g. port 53 for DNS) */ port_node = ConfNodeLookupChild(node, ""dp""); if (port_node == NULL) port_node = ConfNodeLookupChild(node, ""toserver""); if (port_node != NULL && port_node->val != NULL) { AppLayerProtoDetectPPRegister(ipproto, port_node->val, alproto, min_depth, max_depth, STREAM_TOSERVER, /* to indicate dp */ ProbingParserTs, ProbingParserTc); } /* detect by source port of flow */ port_node = ConfNodeLookupChild(node, ""sp""); if (port_node == NULL) port_node = ConfNodeLookupChild(node, ""toclient""); if (port_node != NULL && port_node->val != NULL) { AppLayerProtoDetectPPRegister(ipproto, port_node->val, alproto, min_depth, max_depth, STREAM_TOCLIENT, /* to indicate sp */ ProbingParserTc, ProbingParserTs); } config = 1; end: SCReturnInt(config); } ",0 "static int genl_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack) { const struct genl_family *family; int err; family = genl_family_find_byid(nlh->nlmsg_type); if (family == NULL) return -ENOENT; if (!family->parallel_ops) genl_lock(); err = genl_family_rcv_msg(family, skb, nlh, extack); if (!family->parallel_ops) genl_unlock(); return err; } ",0 "void RenderFrameImpl::OnSelectPopupMenuItem(int selected_index) { if (external_popup_menu_ == NULL) return; external_popup_menu_->DidSelectItem(selected_index); external_popup_menu_.reset(); } ",0 "static int ndis_set(USBNetState *s, uint32_t oid, uint8_t *inbuf, unsigned int inlen) { switch (oid) { case OID_GEN_CURRENT_PACKET_FILTER: s->filter = le32_to_cpup((le32 *) inbuf); if (s->filter) { s->rndis_state = RNDIS_DATA_INITIALIZED; } else { s->rndis_state = RNDIS_INITIALIZED; } return 0; case OID_802_3_MULTICAST_LIST: return 0; } return -1; } ",0 "void kvm_free_pit(struct kvm *kvm) { struct hrtimer *timer; if (kvm->arch.vpit) { kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS, &kvm->arch.vpit->dev); kvm_io_bus_unregister_dev(kvm, KVM_PIO_BUS, &kvm->arch.vpit->speaker_dev); kvm_unregister_irq_mask_notifier(kvm, 0, &kvm->arch.vpit->mask_notifier); kvm_unregister_irq_ack_notifier(kvm, &kvm->arch.vpit->pit_state.irq_ack_notifier); mutex_lock(&kvm->arch.vpit->pit_state.lock); timer = &kvm->arch.vpit->pit_state.timer; hrtimer_cancel(timer); flush_kthread_work(&kvm->arch.vpit->expired); kthread_stop(kvm->arch.vpit->worker_task); kvm_free_irq_source_id(kvm, kvm->arch.vpit->irq_source_id); mutex_unlock(&kvm->arch.vpit->pit_state.lock); kfree(kvm->arch.vpit); } } ",0 "char *simple_dname(struct dentry *dentry, char *buffer, int buflen) { char *end = buffer + buflen; /* these dentries are never renamed, so d_lock is not needed */ if (prepend(&end, &buflen, "" (deleted)"", 11) || prepend(&end, &buflen, dentry->d_name.name, dentry->d_name.len) || prepend(&end, &buflen, ""/"", 1)) end = ERR_PTR(-ENAMETOOLONG); return end; } ",0 "static void commit_tree(struct mount *mnt, struct mount *shadows) { struct mount *parent = mnt->mnt_parent; struct mount *m; LIST_HEAD(head); struct mnt_namespace *n = parent->mnt_ns; BUG_ON(parent == mnt); list_add_tail(&head, &mnt->mnt_list); list_for_each_entry(m, &head, mnt_list) m->mnt_ns = n; list_splice(&head, n->list.prev); attach_shadowed(mnt, parent, shadows); touch_mnt_namespace(n); } ",0 "Response TargetHandler::AttachToTarget(const std::string& target_id, std::string* out_session_id) { scoped_refptr agent_host = DevToolsAgentHost::GetForId(target_id); if (!agent_host) return Response::InvalidParams(""No target with given id found""); *out_session_id = Session::Attach(this, agent_host.get(), false); return Response::OK(); } ",0 "bool JSTestMediaQueryListListener::getOwnPropertySlot(JSCell* cell, ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { JSTestMediaQueryListListener* thisObject = jsCast(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); return getStaticValueSlot(exec, &JSTestMediaQueryListListenerTable, thisObject, propertyName, slot); } ",0 "void TestingAutomationProvider::GetShowingAppModalDialog(bool* showing_dialog, int* dialog_button) { AppModalDialog* active_dialog = AppModalDialogQueue::GetInstance()->active_dialog(); if (!active_dialog) { *showing_dialog = false; *dialog_button = ui::DIALOG_BUTTON_NONE; return; } NativeAppModalDialog* native_dialog = active_dialog->native_dialog(); *showing_dialog = (native_dialog != NULL); if (*showing_dialog) *dialog_button = native_dialog->GetAppModalDialogButtons(); else *dialog_button = ui::DIALOG_BUTTON_NONE; } ",0 "PasswordAutofillAgent::ExtractFormStructureInfo(const FormData& form_data) { FormStructureInfo result; result.unique_renderer_id = form_data.unique_renderer_id; result.fields.resize(form_data.fields.size()); for (size_t i = 0; i < form_data.fields.size(); ++i) { const FormFieldData& form_field = form_data.fields[i]; FormFieldInfo& field_info = result.fields[i]; field_info.unique_renderer_id = form_field.unique_renderer_id; field_info.form_control_type = form_field.form_control_type; field_info.autocomplete_attribute = form_field.autocomplete_attribute; field_info.is_focusable = form_field.is_focusable; } return result; } ",0 "bool TestRenderViewHost::CreateRenderView( int opener_frame_route_id, int proxy_route_id, const FrameReplicationState& replicated_frame_state, bool window_was_created_with_opener) { DCHECK(!IsRenderViewLive()); GetWidget()->set_renderer_initialized(true); DCHECK(IsRenderViewLive()); opener_frame_route_id_ = opener_frame_route_id; RenderFrameHost* main_frame = GetMainFrame(); if (main_frame) static_cast(main_frame)->SetRenderFrameCreated(true); return true; } ",0 "SerializedScriptValue::SerializedScriptValue(v8::Handle value, MessagePortArray* messagePorts, ArrayBufferArray* arrayBuffers, WebBlobInfoArray* blobInfo, ExceptionState& exceptionState, v8::Isolate* isolate) : m_externallyAllocatedMemory(0) { Writer writer; Serializer::Status status; String errorMessage; { v8::TryCatch tryCatch; Serializer serializer(writer, messagePorts, arrayBuffers, blobInfo, m_blobDataHandles, tryCatch, ScriptState::current(isolate)); status = serializer.serialize(value); if (status == Serializer::JSException) { exceptionState.rethrowV8Exception(tryCatch.Exception()); return; } errorMessage = serializer.errorMessage(); } switch (status) { case Serializer::InputError: case Serializer::DataCloneError: exceptionState.throwDOMException(DataCloneError, errorMessage); return; case Serializer::Success: m_data = writer.takeWireString(); ASSERT(m_data.impl()->hasOneRef()); if (arrayBuffers && arrayBuffers->size()) m_arrayBufferContentsArray = transferArrayBuffers(*arrayBuffers, exceptionState, isolate); return; case Serializer::JSException: ASSERT_NOT_REACHED(); break; } ASSERT_NOT_REACHED(); } ",0 "ofputil_queue_stats_to_ofp13(const struct ofputil_queue_stats *oqs, struct ofp13_queue_stats *qs13) { ofputil_queue_stats_to_ofp11(oqs, &qs13->qs); if (oqs->duration_sec != UINT32_MAX) { qs13->duration_sec = htonl(oqs->duration_sec); qs13->duration_nsec = htonl(oqs->duration_nsec); } else { qs13->duration_sec = OVS_BE32_MAX; qs13->duration_nsec = OVS_BE32_MAX; } } ",0 "static int create_std_midi_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver, struct usb_host_interface *alts) { struct usb_ms_header_descriptor *mshd; struct usb_ms_endpoint_descriptor *msepd; /* must have the MIDIStreaming interface header descriptor*/ mshd = (struct usb_ms_header_descriptor *)alts->extra; if (alts->extralen < 7 || mshd->bLength < 7 || mshd->bDescriptorType != USB_DT_CS_INTERFACE || mshd->bDescriptorSubtype != USB_MS_HEADER) return -ENODEV; /* must have the MIDIStreaming endpoint descriptor*/ msepd = (struct usb_ms_endpoint_descriptor *)alts->endpoint[0].extra; if (alts->endpoint[0].extralen < 4 || msepd->bLength < 4 || msepd->bDescriptorType != USB_DT_CS_ENDPOINT || msepd->bDescriptorSubtype != UAC_MS_GENERAL || msepd->bNumEmbMIDIJack < 1 || msepd->bNumEmbMIDIJack > 16) return -ENODEV; return create_any_midi_quirk(chip, iface, driver, NULL); } ",0 "raptor_rdfxml_parse_terminate(raptor_parser *rdf_parser) { raptor_rdfxml_parser* rdf_xml_parser; raptor_rdfxml_element* element; int i; rdf_xml_parser = (raptor_rdfxml_parser*)rdf_parser->context; if(rdf_xml_parser->sax2) { raptor_free_sax2(rdf_xml_parser->sax2); rdf_xml_parser->sax2 = NULL; } while( (element = raptor_rdfxml_element_pop(rdf_xml_parser)) ) raptor_free_rdfxml_element(element); for(i = 0; i < RAPTOR_RDFXML_N_CONCEPTS; i++) { raptor_uri* concept_uri = rdf_xml_parser->concepts[i]; if(concept_uri) { raptor_free_uri(concept_uri); rdf_xml_parser->concepts[i] = NULL; } } if(rdf_xml_parser->id_set) { raptor_free_id_set(rdf_xml_parser->id_set); rdf_xml_parser->id_set = NULL; } } ",0 "error::Error GLES2DecoderPassthroughImpl::DoUniform3i(GLint location, GLint x, GLint y, GLint z) { api()->glUniform3iFn(location, x, y, z); return error::kNoError; } ",0 "v8::Persistent V8TestInterface::GetRawTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info); if (result != data->rawTemplateMap().end()) return result->second; v8::HandleScope handleScope; v8::Persistent templ = createRawTemplate(); data->rawTemplateMap().add(&info, templ); return templ; } ",0 "bool Extension::LoadLaunchContainer(const DictionaryValue* manifest, std::string* error) { Value* temp = NULL; if (!manifest->Get(keys::kLaunchContainer, &temp)) return true; std::string launch_container_string; if (!temp->GetAsString(&launch_container_string)) { *error = errors::kInvalidLaunchContainer; return false; } if (launch_container_string == values::kLaunchContainerPanel) { launch_container_ = extension_misc::LAUNCH_PANEL; } else if (launch_container_string == values::kLaunchContainerTab) { launch_container_ = extension_misc::LAUNCH_TAB; } else { *error = errors::kInvalidLaunchContainer; return false; } if (manifest->Get(keys::kLaunchWidth, &temp)) { if (launch_container() != extension_misc::LAUNCH_PANEL && launch_container() != extension_misc::LAUNCH_WINDOW) { *error = errors::kInvalidLaunchWidthContainer; return false; } if (!temp->GetAsInteger(&launch_width_) || launch_width_ < 0) { launch_width_ = 0; *error = errors::kInvalidLaunchWidth; return false; } } if (manifest->Get(keys::kLaunchHeight, &temp)) { if (launch_container() != extension_misc::LAUNCH_PANEL && launch_container() != extension_misc::LAUNCH_WINDOW) { *error = errors::kInvalidLaunchHeightContainer; return false; } if (!temp->GetAsInteger(&launch_height_) || launch_height_ < 0) { launch_height_ = 0; *error = errors::kInvalidLaunchHeight; return false; } } return true; } ",0 "bool ShouldEnableServerPushCancelation( const VariationParameters& quic_trial_params) { return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, ""enable_server_push_cancellation""), ""true""); } ",0 "void MostVisitedSitesBridge::RecordPageImpression( JNIEnv* env, const JavaParamRef& obj, const JavaParamRef& jtile_types, const JavaParamRef& jsources, const JavaParamRef& jtile_urls) { std::vector int_sources; base::android::JavaIntArrayToIntVector(env, jsources, &int_sources); std::vector int_tile_types; base::android::JavaIntArrayToIntVector(env, jtile_types, &int_tile_types); std::vector string_tile_urls; base::android::AppendJavaStringArrayToStringVector(env, jtile_urls, &string_tile_urls); DCHECK_EQ(int_sources.size(), int_tile_types.size()); DCHECK_EQ(int_sources.size(), string_tile_urls.size()); std::vector tiles; for (size_t i = 0; i < int_sources.size(); i++) { NTPTileSource source = static_cast(int_sources[i]); MostVisitedTileType tile_type = static_cast(int_tile_types[i]); tiles.emplace_back(source, tile_type, GURL(string_tile_urls[i])); } ntp_tiles::metrics::RecordPageImpression(tiles, g_browser_process->rappor_service()); } ",0 " int num_decoded_frames() { return num_decoded_frames_; } ",0 "static void FS_FreePak(pack_t *thepak) { unzClose(thepak->handle); Z_Free(thepak->buildBuffer); Z_Free(thepak); } ",0 "static int cdrom_ioctl_media_changed(struct cdrom_device_info *cdi, unsigned long arg) { struct cdrom_changer_info *info; int ret; cd_dbg(CD_DO_IOCTL, ""entering CDROM_MEDIA_CHANGED\n""); if (!CDROM_CAN(CDC_MEDIA_CHANGED)) return -ENOSYS; /* cannot select disc or select current disc */ if (!CDROM_CAN(CDC_SELECT_DISC) || arg == CDSL_CURRENT) return media_changed(cdi, 1); if ((unsigned int)arg >= cdi->capacity) return -EINVAL; info = kmalloc(sizeof(*info), GFP_KERNEL); if (!info) return -ENOMEM; ret = cdrom_read_mech_status(cdi, info); if (!ret) ret = info->slots[arg].change; kfree(info); return ret; } ",1 "static void svm_sync_pir_to_irr(struct kvm_vcpu *vcpu) { return; } ",0 "zip_deflate_init(struct archive_read *a, struct zip *zip) { int r; /* If we haven't yet read any data, initialize the decompressor. */ if (!zip->decompress_init) { if (zip->stream_valid) r = inflateReset(&zip->stream); else r = inflateInit2(&zip->stream, -15 /* Don't check for zlib header */); if (r != Z_OK) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""Can't initialize ZIP decompression.""); return (ARCHIVE_FATAL); } /* Stream structure has been set up. */ zip->stream_valid = 1; /* We've initialized decompression for this stream. */ zip->decompress_init = 1; } return (ARCHIVE_OK); } ",0 "static int ahash_algs_register_all(struct hash_device_data *device_data) { int ret; int i; int count; for (i = 0; i < ARRAY_SIZE(hash_algs); i++) { ret = crypto_register_ahash(&hash_algs[i].hash); if (ret) { count = i; dev_err(device_data->dev, ""%s: alg registration failed\n"", hash_algs[i].hash.halg.base.cra_driver_name); goto unreg; } } return 0; unreg: for (i = 0; i < count; i++) crypto_unregister_ahash(&hash_algs[i].hash); return ret; } ",0 "void BrowserChildProcessHostImpl::OnProcessLaunched() { DCHECK_CURRENTLY_ON(BrowserThread::IO); const base::Process& process = child_process_->GetProcess(); DCHECK(process.IsValid()); if (child_connection_) child_connection_->SetProcessHandle(process.Handle()); #if defined(OS_WIN) DCHECK(!early_exit_watcher_.GetWatchedObject()); early_exit_watcher_.StartWatchingOnce(process.Handle(), this); #endif data_.handle = process.Handle(); delegate_->OnProcessLaunched(); if (is_channel_connected_) { ShareMetricsAllocatorToProcess(); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&NotifyProcessLaunchedAndConnected, data_)); } } ",0 "static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res) { int n; __be32 *p; int status = -EIO; if (unlikely(bitmap[0] & (FATTR4_WORD0_FS_LOCATIONS -1U))) goto out; status = 0; if (unlikely(!(bitmap[0] & FATTR4_WORD0_FS_LOCATIONS))) goto out; dprintk(""%s: fsroot "", __func__); status = decode_pathname(xdr, &res->fs_path); if (unlikely(status != 0)) goto out; READ_BUF(4); READ32(n); if (n <= 0) goto out_eio; res->nlocations = 0; while (res->nlocations < n) { u32 m; struct nfs4_fs_location *loc = &res->locations[res->nlocations]; READ_BUF(4); READ32(m); loc->nservers = 0; dprintk(""%s: servers "", __func__); while (loc->nservers < m) { struct nfs4_string *server = &loc->servers[loc->nservers]; status = decode_opaque_inline(xdr, &server->len, &server->data); if (unlikely(status != 0)) goto out_eio; dprintk(""%s "", server->data); if (loc->nservers < NFS4_FS_LOCATION_MAXSERVERS) loc->nservers++; else { unsigned int i; dprintk(""%s: using first %u of %u servers "" ""returned for location %u\n"", __func__, NFS4_FS_LOCATION_MAXSERVERS, m, res->nlocations); for (i = loc->nservers; i < m; i++) { unsigned int len; char *data; status = decode_opaque_inline(xdr, &len, &data); if (unlikely(status != 0)) goto out_eio; } } } status = decode_pathname(xdr, &loc->rootpath); if (unlikely(status != 0)) goto out_eio; if (res->nlocations < NFS4_FS_LOCATIONS_MAXENTRIES) res->nlocations++; } out: dprintk(""%s: fs_locations done, error = %d\n"", __func__, status); return status; out_eio: status = -EIO; goto out; } ",0 "static inline unsigned long ad_mask(struct x86_emulate_ctxt *ctxt) { return (1UL << (ctxt->ad_bytes << 3)) - 1; } ",0 "ProcShmCreatePixmap(ClientPtr client) { PixmapPtr pMap; DrawablePtr pDraw; DepthPtr pDepth; int i, rc; ShmDescPtr shmdesc; ShmScrPrivateRec *screen_priv; REQUEST(xShmCreatePixmapReq); unsigned int width, height, depth; unsigned long size; REQUEST_SIZE_MATCH(xShmCreatePixmapReq); client->errorValue = stuff->pid; if (!sharedPixmaps) return BadImplementation; LEGAL_NEW_RESOURCE(stuff->pid, client); rc = dixLookupDrawable(&pDraw, stuff->drawable, client, M_ANY, DixGetAttrAccess); if (rc != Success) return rc; VERIFY_SHMPTR(stuff->shmseg, stuff->offset, TRUE, shmdesc, client); width = stuff->width; height = stuff->height; depth = stuff->depth; if (!width || !height || !depth) { client->errorValue = 0; return BadValue; } if (width > 32767 || height > 32767) return BadAlloc; if (stuff->depth != 1) { pDepth = pDraw->pScreen->allowedDepths; for (i = 0; i < pDraw->pScreen->numDepths; i++, pDepth++) if (pDepth->depth == stuff->depth) goto CreatePmap; client->errorValue = stuff->depth; return BadValue; } CreatePmap: size = PixmapBytePad(width, depth) * height; if (sizeof(size) == 4 && BitsPerPixel(depth) > 8) { if (size < width * height) return BadAlloc; } /* thankfully, offset is unsigned */ if (stuff->offset + size < size) return BadAlloc; VERIFY_SHMSIZE(shmdesc, stuff->offset, size, client); screen_priv = ShmGetScreenPriv(pDraw->pScreen); pMap = (*screen_priv->shmFuncs->CreatePixmap) (pDraw->pScreen, stuff->width, stuff->height, stuff->depth, shmdesc->addr + stuff->offset); if (pMap) { rc = XaceHook(XACE_RESOURCE_ACCESS, client, stuff->pid, RT_PIXMAP, pMap, RT_NONE, NULL, DixCreateAccess); if (rc != Success) { pDraw->pScreen->DestroyPixmap(pMap); return rc; } dixSetPrivate(&pMap->devPrivates, shmPixmapPrivateKey, shmdesc); shmdesc->refcnt++; pMap->drawable.serialNumber = NEXT_SERIAL_NUMBER; pMap->drawable.id = stuff->pid; if (AddResource(stuff->pid, RT_PIXMAP, (void *) pMap)) { return Success; } } return BadAlloc; } ",0 "SYSCALL_DEFINE5(mount, char __user *, dev_name, char __user *, dir_name, char __user *, type, unsigned long, flags, void __user *, data) { int ret; char *kernel_type; char *kernel_dev; unsigned long data_page; kernel_type = copy_mount_string(type); ret = PTR_ERR(kernel_type); if (IS_ERR(kernel_type)) goto out_type; kernel_dev = copy_mount_string(dev_name); ret = PTR_ERR(kernel_dev); if (IS_ERR(kernel_dev)) goto out_dev; ret = copy_mount_options(data, &data_page); if (ret < 0) goto out_data; ret = do_mount(kernel_dev, dir_name, kernel_type, flags, (void *) data_page); free_page(data_page); out_data: kfree(kernel_dev); out_dev: kfree(kernel_type); out_type: return ret; } ",0 "bool MainResourceLoader::isPostOrRedirectAfterPost(const ResourceRequest& newRequest, const ResourceResponse& redirectResponse) { if (newRequest.httpMethod() == ""POST"") return true; int status = redirectResponse.httpStatusCode(); if (((status >= 301 && status <= 303) || status == 307) && frameLoader()->initialRequest().httpMethod() == ""POST"") return true; return false; } ",0 "bool Document::hasPendingForcedStyleRecalc() const { return hasPendingStyleRecalc() && styleChangeType() >= SubtreeStyleChange; } ",0 "void HTMLInputElement::handleFocusEvent(Node* oldFocusedNode, FocusDirection direction) { m_inputType->handleFocusEvent(oldFocusedNode, direction); } ",0 "static char *_xml_decode_tag(xml_parser *parser, const char *tag) { char *newstr; int out_len; newstr = xml_utf8_decode(tag, strlen(tag), &out_len, parser->target_encoding); if (parser->case_folding) { php_strtoupper(newstr, out_len); } return newstr; } ",0 "point_horiz(PG_FUNCTION_ARGS) { Point *pt1 = PG_GETARG_POINT_P(0); Point *pt2 = PG_GETARG_POINT_P(1); PG_RETURN_BOOL(FPeq(pt1->y, pt2->y)); } ",0 "void ext4_xattr_destroy_cache(struct mb_cache *cache) { if (cache) mb_cache_destroy(cache); } ",1 "void qemu_spice_create_host_memslot(SimpleSpiceDisplay *ssd) { QXLDevMemSlot memslot; dprint(1, ""%s/%d:\n"", __func__, ssd->qxl.id); memset(&memslot, 0, sizeof(memslot)); memslot.slot_group_id = MEMSLOT_GROUP_HOST; memslot.virt_end = ~0; qemu_spice_add_memslot(ssd, &memslot, QXL_SYNC); } ",0 "IMPEG2D_ERROR_CODES_T impeg2d_vld_inv_quant_mpeg2( void *pv_dec, /* Decoder State */ WORD16 *pi2_out_addr, /*!< Address where decoded symbols will be stored */ const UWORD8 *pu1_scan, /*!< Scan table to be used */ UWORD16 u2_intra_flag, /*!< Intra Macroblock or not */ UWORD16 u2_colr_comp, /*!< 0 - Luma,1 - U comp, 2 - V comp */ UWORD16 u2_d_picture /*!< D Picture or not */ ) { UWORD8 *pu1_weighting_matrix; WORD32 u4_sum_is_even; dec_state_t *ps_dec = (dec_state_t *)pv_dec; IMPEG2D_ERROR_CODES_T e_error = (IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE; WORD16 pi2_coeffs[NUM_COEFFS]; UWORD8 pi4_pos[NUM_COEFFS]; WORD32 i4_num_coeffs; /* Perform VLD on the stream to get the coefficients and their positions */ e_error = impeg2d_vld_decode(ps_dec, pi2_coeffs, pu1_scan, pi4_pos, u2_intra_flag, u2_colr_comp, u2_d_picture, ps_dec->u2_intra_vlc_format, ps_dec->u2_is_mpeg2, &i4_num_coeffs); if ((IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE != e_error) { return e_error; } /* For YUV420 format,Select the weighting matrix according to Table 7.5 */ pu1_weighting_matrix = (u2_intra_flag == 1) ? ps_dec->au1_intra_quant_matrix: ps_dec->au1_inter_quant_matrix; /*mismatch control for mpeg2*/ /* Check if the block has only one non-zero coeff which is DC */ ps_dec->i4_last_value_one = 0; IMPEG2D_IQNT_INP_STATISTICS(pi2_out_addr, ps_dec->u4_non_zero_cols, ps_dec->u4_non_zero_rows); /* Inverse Quantize the Output of VLD */ PROFILE_DISABLE_INVQUANT_IF0 { /* Clear output matrix */ PROFILE_DISABLE_MEMSET_RESBUF_IF0 if (1 != (ps_dec->u4_non_zero_cols | ps_dec->u4_non_zero_rows)) { ps_dec->pf_memset_16bit_8x8_linear_block (pi2_out_addr); } u4_sum_is_even = impeg2d_inv_quant_mpeg2(pi2_out_addr, pu1_weighting_matrix, ps_dec->u1_quant_scale, u2_intra_flag, i4_num_coeffs, pi2_coeffs, pi4_pos, pu1_scan, &ps_dec->u2_def_dc_pred[u2_colr_comp], ps_dec->u2_intra_dc_precision); if (0 != pi2_out_addr[0]) { /* The first coeff might've become non-zero due to intra_dc_decision * value. So, check here after inverse quantization. */ ps_dec->u4_non_zero_cols |= 0x1; ps_dec->u4_non_zero_rows |= 0x1; } if (1 == (ps_dec->u4_non_zero_cols | ps_dec->u4_non_zero_rows)) { ps_dec->i4_last_value_one = 1 - (pi2_out_addr[0] & 1); } else { /*toggle last bit if sum is even ,else retain it as it is*/ pi2_out_addr[63] ^= (u4_sum_is_even & 1); if (0 != pi2_out_addr[63]) { ps_dec->u4_non_zero_cols |= 0x80; ps_dec->u4_non_zero_rows |= 0x80; } } } return e_error; } ",0 "ExprCreateMultiKeysymList(ExprDef *expr) { unsigned nLevels = darray_size(expr->keysym_list.symsMapIndex); darray_resize(expr->keysym_list.symsMapIndex, 1); darray_resize(expr->keysym_list.symsNumEntries, 1); darray_item(expr->keysym_list.symsMapIndex, 0) = 0; darray_item(expr->keysym_list.symsNumEntries, 0) = nLevels; return expr; } ",0 " void SetContextState(AudioContext* audio_context, AudioContext::AudioContextState state) { audio_context->SetContextState(state); } ",0 "static void shortAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectPythonV8Internal::shortAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "const std::string& RenderViewImpl::GetAcceptLanguages() const { return renderer_preferences_.accept_languages; } ",0 "void OutOfProcessInstance::DidOpenPreview(int32_t result) { if (result == PP_OK) { preview_engine_.reset(PDFEngine::Create(new PreviewModeClient(this))); preview_engine_->HandleDocumentLoad(embed_preview_loader_); } else { NOTREACHED(); } } ",0 "static bool tomoyo_same_mount_acl(const struct tomoyo_acl_info *a, const struct tomoyo_acl_info *b) { const struct tomoyo_mount_acl *p1 = container_of(a, typeof(*p1), head); const struct tomoyo_mount_acl *p2 = container_of(b, typeof(*p2), head); return tomoyo_same_acl_head(&p1->head, &p2->head) && tomoyo_same_name_union(&p1->dev_name, &p2->dev_name) && tomoyo_same_name_union(&p1->dir_name, &p2->dir_name) && tomoyo_same_name_union(&p1->fs_type, &p2->fs_type) && tomoyo_same_number_union(&p1->flags, &p2->flags); } ",0 "static int ecryptfs_write_headers_virt(char *page_virt, size_t max, size_t *size, struct ecryptfs_crypt_stat *crypt_stat, struct dentry *ecryptfs_dentry) { int rc; size_t written; size_t offset; offset = ECRYPTFS_FILE_SIZE_BYTES; write_ecryptfs_marker((page_virt + offset), &written); offset += written; ecryptfs_write_crypt_stat_flags((page_virt + offset), crypt_stat, &written); offset += written; ecryptfs_write_header_metadata((page_virt + offset), crypt_stat, &written); offset += written; rc = ecryptfs_generate_key_packet_set((page_virt + offset), crypt_stat, ecryptfs_dentry, &written, max - offset); if (rc) ecryptfs_printk(KERN_WARNING, ""Error generating key packet "" ""set; rc = [%d]\n"", rc); if (size) { offset += written; *size = offset; } return rc; } ",0 "unsigned long long nr_context_switches(void) { int i; unsigned long long sum = 0; for_each_possible_cpu(i) sum += cpu_rq(i)->nr_switches; return sum; } ",0 " void CalculateCircleTransforms(const gfx::Size& size, PaintedShapeTransforms* transforms_out) const { CalculateRectTransforms(size, std::min(size.width(), size.height()) / 2.0f, transforms_out); } ",0 "static unsigned char *read_sys_file(struct mschm_decompressor_p *self, struct mschmd_file *file) { struct mspack_system *sys = self->system; unsigned char *data = NULL; int len; if (!file || !file->section || (file->section->id != 0)) { self->error = MSPACK_ERR_DATAFORMAT; return NULL; } len = (int) file->length; if (!(data = (unsigned char *) sys->alloc(sys, (size_t) len))) { self->error = MSPACK_ERR_NOMEMORY; return NULL; } if (sys->seek(self->d->infh, file->section->chm->sec0.offset + file->offset, MSPACK_SYS_SEEK_START)) { self->error = MSPACK_ERR_SEEK; sys->free(data); return NULL; } if (sys->read(self->d->infh, data, len) != len) { self->error = MSPACK_ERR_READ; sys->free(data); return NULL; } return data; } ",0 "ring_buffer_iter_peek(struct ring_buffer_iter *iter, u64 *ts) { struct ring_buffer_per_cpu *cpu_buffer = iter->cpu_buffer; struct ring_buffer_event *event; unsigned long flags; again: raw_spin_lock_irqsave(&cpu_buffer->reader_lock, flags); event = rb_iter_peek(iter, ts); raw_spin_unlock_irqrestore(&cpu_buffer->reader_lock, flags); if (event && event->type_len == RINGBUF_TYPE_PADDING) goto again; return event; } ",0 "void RenderFrameDevToolsAgentHost::Reload() { WebContentsImpl* wc = static_cast(web_contents()); if (wc) wc->GetController().Reload(ReloadType::NORMAL, true); } ",0 " virtual std::wstring GetMessageText() const { return l10n_util::GetString(IDS_DEFAULT_BROWSER_INFOBAR_SHORT_TEXT); } ",0 "void rds_ib_xmit_complete(struct rds_connection *conn) { struct rds_ib_connection *ic = conn->c_transport_data; /* We may have a pending ACK or window update we were unable * to send previously (due to flow control). Try again. */ rds_ib_attempt_ack(ic); } ",0 "void V8TestObject::StaticSaveSameObjectAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_staticSaveSameObjectAttribute_Getter""); test_object_v8_internal::StaticSaveSameObjectAttributeAttributeGetter(info); } ",0 " Factory(const std::string& name, int32_t flags) : Histogram::Factory(name, BOOLEAN_HISTOGRAM, 1, 2, 3, flags) {} ",0 "static int ipxitf_create_internal(struct ipx_interface_definition *idef) { struct ipx_interface *intrfc; int rc = -EEXIST; /* Only one primary network allowed */ if (ipx_primary_net) goto out; /* Must have a valid network number */ rc = -EADDRNOTAVAIL; if (!idef->ipx_network) goto out; intrfc = ipxitf_find_using_net(idef->ipx_network); rc = -EADDRINUSE; if (intrfc) { ipxitf_put(intrfc); goto out; } intrfc = ipxitf_alloc(NULL, idef->ipx_network, 0, NULL, 1, 0); rc = -EAGAIN; if (!intrfc) goto out; memcpy((char *)&(intrfc->if_node), idef->ipx_node, IPX_NODE_LEN); ipx_internal_net = ipx_primary_net = intrfc; ipxitf_hold(intrfc); ipxitf_insert(intrfc); rc = ipxitf_add_local_route(intrfc); ipxitf_put(intrfc); out: return rc; } ",0 "jpc_ms_t *jpc_getms(jas_stream_t *in, jpc_cstate_t *cstate) { jpc_ms_t *ms; jpc_mstabent_t *mstabent; jas_stream_t *tmpstream; if (!(ms = jpc_ms_create(0))) { return 0; } /* Get the marker type. */ if (jpc_getuint16(in, &ms->id) || ms->id < JPC_MS_MIN || ms->id > JPC_MS_MAX) { jpc_ms_destroy(ms); return 0; } mstabent = jpc_mstab_lookup(ms->id); ms->ops = &mstabent->ops; /* Get the marker segment length and parameters if present. */ /* Note: It is tacitly assumed that a marker segment cannot have parameters unless it has a length field. That is, there cannot be a parameters field without a length field and vice versa. */ if (JPC_MS_HASPARMS(ms->id)) { /* Get the length of the marker segment. */ if (jpc_getuint16(in, &ms->len) || ms->len < 3) { jpc_ms_destroy(ms); return 0; } /* Calculate the length of the marker segment parameters. */ ms->len -= 2; /* Create and prepare a temporary memory stream from which to read the marker segment parameters. */ /* Note: This approach provides a simple way of ensuring that we never read beyond the end of the marker segment (even if the marker segment length is errantly set too small). */ if (!(tmpstream = jas_stream_memopen(0, 0))) { jpc_ms_destroy(ms); return 0; } if (jas_stream_copy(tmpstream, in, ms->len) || jas_stream_seek(tmpstream, 0, SEEK_SET) < 0) { jas_stream_close(tmpstream); jpc_ms_destroy(ms); return 0; } /* Get the marker segment parameters. */ if ((*ms->ops->getparms)(ms, cstate, tmpstream)) { ms->ops = 0; jpc_ms_destroy(ms); jas_stream_close(tmpstream); return 0; } if (jas_getdbglevel() > 0) { jpc_ms_dump(ms, stderr); } if (JAS_CAST(ulong, jas_stream_tell(tmpstream)) != ms->len) { jas_eprintf( ""warning: trailing garbage in marker segment (%ld bytes)\n"", ms->len - jas_stream_tell(tmpstream)); } /* Close the temporary stream. */ jas_stream_close(tmpstream); } else { /* There are no marker segment parameters. */ ms->len = 0; if (jas_getdbglevel() > 0) { jpc_ms_dump(ms, stderr); } } /* Update the code stream state information based on the type of marker segment read. */ /* Note: This is a bit of a hack, but I'm not going to define another type of virtual function for this one special case. */ if (ms->id == JPC_MS_SIZ) { cstate->numcomps = ms->parms.siz.numcomps; } return ms; } ",1 "static long do_mbind(unsigned long start, unsigned long len, unsigned short mode, unsigned short mode_flags, nodemask_t *nmask, unsigned long flags) { struct vm_area_struct *vma; struct mm_struct *mm = current->mm; struct mempolicy *new; unsigned long end; int err; LIST_HEAD(pagelist); if (flags & ~(unsigned long)(MPOL_MF_STRICT | MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) return -EINVAL; if ((flags & MPOL_MF_MOVE_ALL) && !capable(CAP_SYS_NICE)) return -EPERM; if (start & ~PAGE_MASK) return -EINVAL; if (mode == MPOL_DEFAULT) flags &= ~MPOL_MF_STRICT; len = (len + PAGE_SIZE - 1) & PAGE_MASK; end = start + len; if (end < start) return -EINVAL; if (end == start) return 0; new = mpol_new(mode, mode_flags, nmask); if (IS_ERR(new)) return PTR_ERR(new); /* * If we are using the default policy then operation * on discontinuous address spaces is okay after all */ if (!new) flags |= MPOL_MF_DISCONTIG_OK; pr_debug(""mbind %lx-%lx mode:%d flags:%d nodes:%lx\n"", start, start + len, mode, mode_flags, nmask ? nodes_addr(*nmask)[0] : -1); if (flags & (MPOL_MF_MOVE | MPOL_MF_MOVE_ALL)) { err = migrate_prep(); if (err) goto mpol_out; } { NODEMASK_SCRATCH(scratch); if (scratch) { down_write(&mm->mmap_sem); task_lock(current); err = mpol_set_nodemask(new, nmask, scratch); task_unlock(current); if (err) up_write(&mm->mmap_sem); } else err = -ENOMEM; NODEMASK_SCRATCH_FREE(scratch); } if (err) goto mpol_out; vma = check_range(mm, start, end, nmask, flags | MPOL_MF_INVERT, &pagelist); err = PTR_ERR(vma); if (!IS_ERR(vma)) { int nr_failed = 0; err = mbind_range(mm, start, end, new); if (!list_empty(&pagelist)) { nr_failed = migrate_pages(&pagelist, new_vma_page, (unsigned long)vma, false, true); if (nr_failed) putback_lru_pages(&pagelist); } if (!err && nr_failed && (flags & MPOL_MF_STRICT)) err = -EIO; } else putback_lru_pages(&pagelist); up_write(&mm->mmap_sem); mpol_out: mpol_put(new); return err; } ",0 " void ChromeExtensionsDispatcherDelegate::PopulateSourceMap( extensions::ResourceBundleSourceMap* source_map) { source_map->RegisterSource(""app"", IDR_APP_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""automation"", IDR_AUTOMATION_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""automationEvent"", IDR_AUTOMATION_EVENT_JS); source_map->RegisterSource(""automationNode"", IDR_AUTOMATION_NODE_JS); source_map->RegisterSource(""browserAction"", IDR_BROWSER_ACTION_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""certificateProvider"", IDR_CERTIFICATE_PROVIDER_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""declarativeContent"", IDR_DECLARATIVE_CONTENT_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""desktopCapture"", IDR_DESKTOP_CAPTURE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""developerPrivate"", IDR_DEVELOPER_PRIVATE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""downloads"", IDR_DOWNLOADS_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""enterprise.platformKeys"", IDR_ENTERPRISE_PLATFORM_KEYS_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""enterprise.platformKeys.internalAPI"", IDR_ENTERPRISE_PLATFORM_KEYS_INTERNAL_API_JS); source_map->RegisterSource(""enterprise.platformKeys.KeyPair"", IDR_ENTERPRISE_PLATFORM_KEYS_KEY_PAIR_JS); source_map->RegisterSource(""enterprise.platformKeys.SubtleCrypto"", IDR_ENTERPRISE_PLATFORM_KEYS_SUBTLE_CRYPTO_JS); source_map->RegisterSource(""enterprise.platformKeys.Token"", IDR_ENTERPRISE_PLATFORM_KEYS_TOKEN_JS); source_map->RegisterSource(""feedbackPrivate"", IDR_FEEDBACK_PRIVATE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""fileBrowserHandler"", IDR_FILE_BROWSER_HANDLER_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""fileManagerPrivate"", IDR_FILE_MANAGER_PRIVATE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""fileSystem"", IDR_FILE_SYSTEM_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""fileSystemProvider"", IDR_FILE_SYSTEM_PROVIDER_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""gcm"", IDR_GCM_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""identity"", IDR_IDENTITY_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""imageWriterPrivate"", IDR_IMAGE_WRITER_PRIVATE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""input.ime"", IDR_INPUT_IME_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""logPrivate"", IDR_LOG_PRIVATE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""mediaGalleries"", IDR_MEDIA_GALLERIES_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""notifications"", IDR_NOTIFICATIONS_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""omnibox"", IDR_OMNIBOX_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""pageAction"", IDR_PAGE_ACTION_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""pageCapture"", IDR_PAGE_CAPTURE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""platformKeys"", IDR_PLATFORM_KEYS_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""platformKeys.getPublicKey"", IDR_PLATFORM_KEYS_GET_PUBLIC_KEY_JS); source_map->RegisterSource(""platformKeys.internalAPI"", IDR_PLATFORM_KEYS_INTERNAL_API_JS); source_map->RegisterSource(""platformKeys.Key"", IDR_PLATFORM_KEYS_KEY_JS); source_map->RegisterSource(""platformKeys.SubtleCrypto"", IDR_PLATFORM_KEYS_SUBTLE_CRYPTO_JS); source_map->RegisterSource(""platformKeys.utils"", IDR_PLATFORM_KEYS_UTILS_JS); source_map->RegisterSource(""syncFileSystem"", IDR_SYNC_FILE_SYSTEM_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""systemIndicator"", IDR_SYSTEM_INDICATOR_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""tabCapture"", IDR_TAB_CAPTURE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""tabs"", IDR_TABS_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""terminalPrivate"", IDR_TERMINAL_PRIVATE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""tts"", IDR_TTS_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""ttsEngine"", IDR_TTS_ENGINE_CUSTOM_BINDINGS_JS); #if defined(ENABLE_WEBRTC) source_map->RegisterSource(""cast.streaming.rtpStream"", IDR_CAST_STREAMING_RTP_STREAM_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""cast.streaming.session"", IDR_CAST_STREAMING_SESSION_CUSTOM_BINDINGS_JS); source_map->RegisterSource( ""cast.streaming.udpTransport"", IDR_CAST_STREAMING_UDP_TRANSPORT_CUSTOM_BINDINGS_JS); source_map->RegisterSource( ""cast.streaming.receiverSession"", IDR_CAST_STREAMING_RECEIVER_SESSION_CUSTOM_BINDINGS_JS); #endif source_map->RegisterSource( ""webrtcDesktopCapturePrivate"", IDR_WEBRTC_DESKTOP_CAPTURE_PRIVATE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""webstore"", IDR_WEBSTORE_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""ChromeSetting"", IDR_CHROME_SETTING_JS); source_map->RegisterSource(""ContentSetting"", IDR_CONTENT_SETTING_JS); source_map->RegisterSource(""ChromeDirectSetting"", IDR_CHROME_DIRECT_SETTING_JS); source_map->RegisterSource(""fileEntryBindingUtil"", IDR_FILE_ENTRY_BINDING_UTIL_JS); source_map->RegisterSource(""tagWatcher"", IDR_TAG_WATCHER_JS); source_map->RegisterSource(""chromeWebViewInternal"", IDR_CHROME_WEB_VIEW_INTERNAL_CUSTOM_BINDINGS_JS); source_map->RegisterSource(""chromeWebView"", IDR_CHROME_WEB_VIEW_JS); } ",0 "string_match (const char *string, const char *mask, int case_sensitive) { char last, *mask2; int len_string, len_mask, rc; if (!mask || !mask[0]) return 0; /* if mask is ""*"", then any string matches */ if (strcmp (mask, ""*"") == 0) return 1; len_string = strlen (string); len_mask = strlen (mask); last = mask[len_mask - 1]; /* mask begins with ""*"" */ if ((mask[0] == '*') && (last != '*')) { /* not enough chars in string to match */ if (len_string < len_mask - 1) return 0; /* check if end of string matches */ if ((case_sensitive && (strcmp (string + len_string - (len_mask - 1), mask + 1) == 0)) || (!case_sensitive && (string_strcasecmp (string + len_string - (len_mask - 1), mask + 1) == 0))) return 1; /* no match */ return 0; } /* mask ends with ""*"" */ if ((mask[0] != '*') && (last == '*')) { /* not enough chars in string to match */ if (len_string < len_mask - 1) return 0; /* check if beginning of string matches */ if ((case_sensitive && (strncmp (string, mask, len_mask - 1) == 0)) || (!case_sensitive && (string_strncasecmp (string, mask, len_mask - 1) == 0))) return 1; /* no match */ return 0; } /* mask begins and ends with ""*"" */ if ((mask[0] == '*') && (last == '*')) { /* not enough chars in string to match */ if (len_string < len_mask - 1) return 0; /* keep only relevant chars in mask for searching string */ mask2 = string_strndup (mask + 1, len_mask - 2); if (!mask2) return 0; /* search string */ rc = ((case_sensitive && strstr (string, mask2)) || (!case_sensitive && string_strcasestr (string, mask2))) ? 1 : 0; /* free and return */ free (mask2); return rc; } /* no ""*"" at all, compare strings */ if ((case_sensitive && (strcmp (string, mask) == 0)) || (!case_sensitive && (string_strcasecmp (string, mask) == 0))) return 1; /* no match */ return 0; } ",0 "void PrintWebViewHelper::OnPrintForPrintPreview( const DictionaryValue& job_settings) { DCHECK(is_preview_); if (print_web_view_) return; if (!render_view()->webview()) return; WebFrame* main_frame = render_view()->webview()->mainFrame(); if (!main_frame) return; WebDocument document = main_frame->document(); WebElement pdf_element = document.getElementById(""pdf-viewer""); if (pdf_element.isNull()) { NOTREACHED(); return; } WebFrame* pdf_frame = pdf_element.document().frame(); scoped_ptr prepare; if (!InitPrintSettingsAndPrepareFrame(pdf_frame, &pdf_element, &prepare)) { LOG(ERROR) << ""Failed to initialize print page settings""; return; } if (!UpdatePrintSettings(job_settings, false)) { LOG(ERROR) << ""UpdatePrintSettings failed""; DidFinishPrinting(FAIL_PRINT); return; } if (!RenderPagesForPrint(pdf_frame, &pdf_element, prepare.get())) { LOG(ERROR) << ""RenderPagesForPrint failed""; DidFinishPrinting(FAIL_PRINT); } } ",1 "void AutofillExternalDelegate::ClearPreviewedForm() { driver_->RendererShouldClearPreviewedForm(); } ",0 "PassRefPtr Document::createElement(const QualifiedName& qName, bool createdByParser) { RefPtr e; if (qName.namespaceURI() == xhtmlNamespaceURI) e = HTMLElementFactory::createHTMLElement(qName, this, 0, createdByParser); else if (qName.namespaceURI() == SVGNames::svgNamespaceURI) e = SVGElementFactory::createSVGElement(qName, this, createdByParser); if (e) m_sawElementsInKnownNamespaces = true; else e = Element::create(qName, &document()); ASSERT((qName.matches(imageTag) && e->tagQName().matches(imgTag) && e->tagQName().prefix() == qName.prefix()) || qName == e->tagQName()); return e.release(); } ",0 "void DownloadController::CreateGETDownload( const content::ResourceRequestInfo::WebContentsGetter& wc_getter, bool must_download, const DownloadInfo& info) { DCHECK_CURRENTLY_ON(BrowserThread::IO); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&DownloadController::StartAndroidDownload, base::Unretained(this), wc_getter, must_download, info)); } ",1 "mm_answer_authserv(int sock, Buffer *m) { monitor_permit_authentications(1); authctxt->service = buffer_get_string(m, NULL); authctxt->style = buffer_get_string(m, NULL); debug3(""%s: service=%s, style=%s"", __func__, authctxt->service, authctxt->style); if (strlen(authctxt->style) == 0) { free(authctxt->style); authctxt->style = NULL; } return (0); } ",0 "PHP_FUNCTION(stream_set_read_buffer) { zval *arg1; int ret; long arg2; size_t buff; php_stream *stream; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rl"", &arg1, &arg2) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(stream, &arg1); buff = arg2; /* if buff is 0 then set to non-buffered */ if (buff == 0) { ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_NONE, NULL); } else { ret = php_stream_set_option(stream, PHP_STREAM_OPTION_READ_BUFFER, PHP_STREAM_BUFFER_FULL, &buff); } RETURN_LONG(ret == 0 ? 0 : EOF); } ",0 "static int get_reg_offset_16(struct insn *insn, struct pt_regs *regs, int *offs1, int *offs2) { /* * 16-bit addressing can use one or two registers. Specifics of * encodings are given in Table 2-1. ""16-Bit Addressing Forms with the * ModR/M Byte"" of the Intel Software Development Manual. */ static const int regoff1[] = { offsetof(struct pt_regs, bx), offsetof(struct pt_regs, bx), offsetof(struct pt_regs, bp), offsetof(struct pt_regs, bp), offsetof(struct pt_regs, si), offsetof(struct pt_regs, di), offsetof(struct pt_regs, bp), offsetof(struct pt_regs, bx), }; static const int regoff2[] = { offsetof(struct pt_regs, si), offsetof(struct pt_regs, di), offsetof(struct pt_regs, si), offsetof(struct pt_regs, di), -EDOM, -EDOM, -EDOM, -EDOM, }; if (!offs1 || !offs2) return -EINVAL; /* Operand is a register, use the generic function. */ if (X86_MODRM_MOD(insn->modrm.value) == 3) { *offs1 = insn_get_modrm_rm_off(insn, regs); *offs2 = -EDOM; return 0; } *offs1 = regoff1[X86_MODRM_RM(insn->modrm.value)]; *offs2 = regoff2[X86_MODRM_RM(insn->modrm.value)]; /* * If ModRM.mod is 0 and ModRM.rm is 110b, then we use displacement- * only addressing. This means that no registers are involved in * computing the effective address. Thus, ensure that the first * register offset is invalild. The second register offset is already * invalid under the aforementioned conditions. */ if ((X86_MODRM_MOD(insn->modrm.value) == 0) && (X86_MODRM_RM(insn->modrm.value) == 6)) *offs1 = -EDOM; return 0; } ",0 " base::TimeTicks start_time() const { return start_time_; } ",0 "brcmf_cfg80211_dump_station(struct wiphy *wiphy, struct net_device *ndev, int idx, u8 *mac, struct station_info *sinfo) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_if *ifp = netdev_priv(ndev); s32 err; brcmf_dbg(TRACE, ""Enter, idx %d\n"", idx); if (idx == 0) { cfg->assoclist.count = cpu_to_le32(BRCMF_MAX_ASSOCLIST); err = brcmf_fil_cmd_data_get(ifp, BRCMF_C_GET_ASSOCLIST, &cfg->assoclist, sizeof(cfg->assoclist)); if (err) { brcmf_err(""BRCMF_C_GET_ASSOCLIST unsupported, err=%d\n"", err); cfg->assoclist.count = 0; return -EOPNOTSUPP; } } if (idx < le32_to_cpu(cfg->assoclist.count)) { memcpy(mac, cfg->assoclist.mac[idx], ETH_ALEN); return brcmf_cfg80211_get_station(wiphy, ndev, mac, sinfo); } return -ENOENT; } ",0 "PHP_MINIT_FUNCTION(spl_array) { REGISTER_SPL_STD_CLASS_EX(ArrayObject, spl_array_object_new, spl_funcs_ArrayObject); REGISTER_SPL_IMPLEMENTS(ArrayObject, Aggregate); REGISTER_SPL_IMPLEMENTS(ArrayObject, ArrayAccess); REGISTER_SPL_IMPLEMENTS(ArrayObject, Serializable); REGISTER_SPL_IMPLEMENTS(ArrayObject, Countable); memcpy(&spl_handler_ArrayObject, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); spl_handler_ArrayObject.clone_obj = spl_array_object_clone; spl_handler_ArrayObject.read_dimension = spl_array_read_dimension; spl_handler_ArrayObject.write_dimension = spl_array_write_dimension; spl_handler_ArrayObject.unset_dimension = spl_array_unset_dimension; spl_handler_ArrayObject.has_dimension = spl_array_has_dimension; spl_handler_ArrayObject.count_elements = spl_array_object_count_elements; spl_handler_ArrayObject.get_properties = spl_array_get_properties; spl_handler_ArrayObject.get_debug_info = spl_array_get_debug_info; spl_handler_ArrayObject.read_property = spl_array_read_property; spl_handler_ArrayObject.write_property = spl_array_write_property; spl_handler_ArrayObject.get_property_ptr_ptr = spl_array_get_property_ptr_ptr; spl_handler_ArrayObject.has_property = spl_array_has_property; spl_handler_ArrayObject.unset_property = spl_array_unset_property; spl_handler_ArrayObject.compare_objects = spl_array_compare_objects; REGISTER_SPL_STD_CLASS_EX(ArrayIterator, spl_array_object_new, spl_funcs_ArrayIterator); REGISTER_SPL_IMPLEMENTS(ArrayIterator, Iterator); REGISTER_SPL_IMPLEMENTS(ArrayIterator, ArrayAccess); REGISTER_SPL_IMPLEMENTS(ArrayIterator, SeekableIterator); REGISTER_SPL_IMPLEMENTS(ArrayIterator, Serializable); REGISTER_SPL_IMPLEMENTS(ArrayIterator, Countable); memcpy(&spl_handler_ArrayIterator, &spl_handler_ArrayObject, sizeof(zend_object_handlers)); spl_ce_ArrayIterator->get_iterator = spl_array_get_iterator; REGISTER_SPL_SUB_CLASS_EX(RecursiveArrayIterator, ArrayIterator, spl_array_object_new, spl_funcs_RecursiveArrayIterator); REGISTER_SPL_IMPLEMENTS(RecursiveArrayIterator, RecursiveIterator); spl_ce_RecursiveArrayIterator->get_iterator = spl_array_get_iterator; REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, ""STD_PROP_LIST"", SPL_ARRAY_STD_PROP_LIST); REGISTER_SPL_CLASS_CONST_LONG(ArrayObject, ""ARRAY_AS_PROPS"", SPL_ARRAY_ARRAY_AS_PROPS); REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, ""STD_PROP_LIST"", SPL_ARRAY_STD_PROP_LIST); REGISTER_SPL_CLASS_CONST_LONG(ArrayIterator, ""ARRAY_AS_PROPS"", SPL_ARRAY_ARRAY_AS_PROPS); REGISTER_SPL_CLASS_CONST_LONG(RecursiveArrayIterator, ""CHILD_ARRAYS_ONLY"", SPL_ARRAY_CHILD_ARRAYS_ONLY); return SUCCESS; } ",0 "static int sha1_export(struct shash_desc *desc, void *out) { struct sha1_state *sctx = shash_desc_ctx(desc); memcpy(out, sctx, sizeof(*sctx)); return 0; } ",0 "nfsd_splice_actor(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd) { struct svc_rqst *rqstp = sd->u.data; struct page **pp = rqstp->rq_next_page; struct page *page = buf->page; size_t size; size = sd->len; if (rqstp->rq_res.page_len == 0) { get_page(page); put_page(*rqstp->rq_next_page); *(rqstp->rq_next_page++) = page; rqstp->rq_res.page_base = buf->offset; rqstp->rq_res.page_len = size; } else if (page != pp[-1]) { get_page(page); if (*rqstp->rq_next_page) put_page(*rqstp->rq_next_page); *(rqstp->rq_next_page++) = page; rqstp->rq_res.page_len += size; } else rqstp->rq_res.page_len += size; return size; } ",0 "void FrameLoaderClient::willChangeTitle(WebCore::DocumentLoader*) { notImplemented(); } ",0 "static inline int msg_security(struct kern_ipc_perm *ipcp, int msgflg) { struct msg_queue *msq = container_of(ipcp, struct msg_queue, q_perm); return security_msg_queue_associate(msq, msgflg); } ",0 "void MediaStreamManager::DeleteRequest(const std::string& label) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DVLOG(1) << ""DeleteRequest({label= "" << label << ""})""; for (auto request_it = requests_.begin(); request_it != requests_.end(); ++request_it) { if (request_it->first == label) { std::unique_ptr request(request_it->second); requests_.erase(request_it); return; } } NOTREACHED(); } ",0 "void o2nm_node_get(struct o2nm_node *node) { config_item_get(&node->nd_item); } ",0 "TreeCache::~TreeCache() {} ",0 "T ValueOrDefault(Optional&& opt) { return std::forward(opt).value_or(T{}); } ",0 "void S_AL_StartBackgroundTrack( const char *intro, const char *loop ) { int i; qboolean issame; S_AL_StopBackgroundTrack(); if((!intro || !*intro) && (!loop || !*loop)) return; S_AL_MusicSourceGet(); if(musicSourceHandle == -1) return; if (!loop || !*loop) { loop = intro; issame = qtrue; } else if(intro && *intro && !strcmp(intro, loop)) issame = qtrue; else issame = qfalse; Q_strncpyz( s_backgroundLoop, loop, sizeof( s_backgroundLoop ) ); if(!issame) { intro_stream = S_CodecOpenStream(intro); } else intro_stream = NULL; mus_stream = S_CodecOpenStream(s_backgroundLoop); if(!mus_stream) { S_AL_CloseMusicFiles(); S_AL_MusicSourceFree(); return; } if (!S_AL_GenBuffers(NUM_MUSIC_BUFFERS, musicBuffers, ""music"")) return; for(i = 0; i < NUM_MUSIC_BUFFERS; i++) { S_AL_MusicProcess(musicBuffers[i]); } qalSourceQueueBuffers(musicSource, NUM_MUSIC_BUFFERS, musicBuffers); S_AL_Gain(musicSource, s_alGain->value * s_musicVolume->value); qalSourcePlay(musicSource); musicPlaying = qtrue; } ",0 " ConnectionTracker* connection_tracker() { return connection_tracker_.get(); } ",0 " virtual void didCreateSnapshotFile(const WebKit::WebFileInfo& info) { ASSERT_NOT_REACHED(); delete this; } ",0 "static int em_fnstsw(struct x86_emulate_ctxt *ctxt) { u16 fsw; if (ctxt->ops->get_cr(ctxt, 0) & (X86_CR0_TS | X86_CR0_EM)) return emulate_nm(ctxt); ctxt->ops->get_fpu(ctxt); asm volatile(""fnstsw %0"": ""+m""(fsw)); ctxt->ops->put_fpu(ctxt); /* force 2 byte destination */ ctxt->dst.bytes = 2; ctxt->dst.val = fsw; return X86EMUL_CONTINUE; } ",0 "void RenderFrameImpl::SetNeedsOcclusionTracking(bool needs_tracking) { Send(new FrameHostMsg_SetNeedsOcclusionTracking(routing_id_, needs_tracking)); } ",0 "static void ssl_check_for_safari(SSL *s, const unsigned char *data, const unsigned char *d, int n) { unsigned short type, size; static const unsigned char kSafariExtensionsBlock[] = { 0x00, 0x0a, /* elliptic_curves extension */ 0x00, 0x08, /* 8 bytes */ 0x00, 0x06, /* 6 bytes of curve ids */ 0x00, 0x17, /* P-256 */ 0x00, 0x18, /* P-384 */ 0x00, 0x19, /* P-521 */ 0x00, 0x0b, /* ec_point_formats */ 0x00, 0x02, /* 2 bytes */ 0x01, /* 1 point format */ 0x00, /* uncompressed */ }; /* The following is only present in TLS 1.2 */ static const unsigned char kSafariTLS12ExtensionsBlock[] = { 0x00, 0x0d, /* signature_algorithms */ 0x00, 0x0c, /* 12 bytes */ 0x00, 0x0a, /* 10 bytes */ 0x05, 0x01, /* SHA-384/RSA */ 0x04, 0x01, /* SHA-256/RSA */ 0x02, 0x01, /* SHA-1/RSA */ 0x04, 0x03, /* SHA-256/ECDSA */ 0x02, 0x03, /* SHA-1/ECDSA */ }; if (data >= (d+n-2)) return; data += 2; if (data > (d+n-4)) return; n2s(data,type); n2s(data,size); if (type != TLSEXT_TYPE_server_name) return; if (data+size > d+n) return; data += size; if (TLS1_get_client_version(s) >= TLS1_2_VERSION) { const size_t len1 = sizeof(kSafariExtensionsBlock); const size_t len2 = sizeof(kSafariTLS12ExtensionsBlock); if (data + len1 + len2 != d+n) return; if (memcmp(data, kSafariExtensionsBlock, len1) != 0) return; if (memcmp(data + len1, kSafariTLS12ExtensionsBlock, len2) != 0) return; } else { const size_t len = sizeof(kSafariExtensionsBlock); if (data + len != d+n) return; if (memcmp(data, kSafariExtensionsBlock, len) != 0) return; } s->s3->is_probably_safari = 1; } ",0 "static int ext4_nonda_switch(struct super_block *sb) { s64 free_blocks, dirty_blocks; struct ext4_sb_info *sbi = EXT4_SB(sb); /* * switch to non delalloc mode if we are running low * on free block. The free block accounting via percpu * counters can get slightly wrong with percpu_counter_batch getting * accumulated on each CPU without updating global counters * Delalloc need an accurate free block accounting. So switch * to non delalloc when we are near to error range. */ free_blocks = percpu_counter_read_positive(&sbi->s_freeblocks_counter); dirty_blocks = percpu_counter_read_positive(&sbi->s_dirtyblocks_counter); if (2 * free_blocks < 3 * dirty_blocks || free_blocks < (dirty_blocks + EXT4_FREEBLOCKS_WATERMARK)) { /* * free block count is less than 150% of dirty blocks * or free blocks is less than watermark */ return 1; } /* * Even if we don't switch but are nearing capacity, * start pushing delalloc when 1/2 of free blocks are dirty. */ if (free_blocks < 2 * dirty_blocks) writeback_inodes_sb_if_idle(sb); return 0; } ",0 "const char* WinPKIErrorString(void) { static char error_string[64]; DWORD error_code = GetLastError(); if ((error_code >> 16) != 0x8009) return WindowsErrorString(); switch (error_code) { case NTE_BAD_UID: return ""Bad UID.""; case CRYPT_E_MSG_ERROR: return ""An error occurred while performing an operation on a cryptographic message.""; case CRYPT_E_UNKNOWN_ALGO: return ""Unknown cryptographic algorithm.""; case CRYPT_E_INVALID_MSG_TYPE: return ""Invalid cryptographic message type.""; case CRYPT_E_HASH_VALUE: return ""The hash value is not correct""; case CRYPT_E_ISSUER_SERIALNUMBER: return ""Invalid issuer and/or serial number.""; case CRYPT_E_BAD_LEN: return ""The length specified for the output data was insufficient.""; case CRYPT_E_BAD_ENCODE: return ""An error occurred during encode or decode operation.""; case CRYPT_E_FILE_ERROR: return ""An error occurred while reading or writing to a file.""; case CRYPT_E_NOT_FOUND: return ""Cannot find object or property.""; case CRYPT_E_EXISTS: return ""The object or property already exists.""; case CRYPT_E_NO_PROVIDER: return ""No provider was specified for the store or object.""; case CRYPT_E_DELETED_PREV: return ""The previous certificate or CRL context was deleted.""; case CRYPT_E_NO_MATCH: return ""Cannot find the requested object.""; case CRYPT_E_UNEXPECTED_MSG_TYPE: case CRYPT_E_NO_KEY_PROPERTY: case CRYPT_E_NO_DECRYPT_CERT: return ""Private key or certificate issue""; case CRYPT_E_BAD_MSG: return ""Not a cryptographic message.""; case CRYPT_E_NO_SIGNER: return ""The signed cryptographic message does not have a signer for the specified signer index.""; case CRYPT_E_REVOKED: return ""The certificate is revoked.""; case CRYPT_E_NO_REVOCATION_DLL: case CRYPT_E_NO_REVOCATION_CHECK: case CRYPT_E_REVOCATION_OFFLINE: case CRYPT_E_NOT_IN_REVOCATION_DATABASE: return ""Cannot check certificate revocation.""; case CRYPT_E_INVALID_NUMERIC_STRING: case CRYPT_E_INVALID_PRINTABLE_STRING: case CRYPT_E_INVALID_IA5_STRING: case CRYPT_E_INVALID_X500_STRING: case CRYPT_E_NOT_CHAR_STRING: return ""Invalid string.""; case CRYPT_E_SECURITY_SETTINGS: return ""The cryptographic operation failed due to a local security option setting.""; case CRYPT_E_NO_VERIFY_USAGE_CHECK: case CRYPT_E_VERIFY_USAGE_OFFLINE: return ""Cannot complete usage check.""; case CRYPT_E_NO_TRUSTED_SIGNER: return ""None of the signers of the cryptographic message or certificate trust list is trusted.""; default: static_sprintf(error_string, ""Unknown PKI error 0x%08lX"", error_code); return error_string; } } ",1 "void FileSystemManagerImpl::DidReadDirectorySync( ReadDirectorySyncCallbackEntry* callback_entry, base::File::Error result, std::vector entries, bool has_more) { DCHECK_CURRENTLY_ON(BrowserThread::IO); for (const auto& entry : entries) { callback_entry->entries.emplace_back( filesystem::mojom::DirectoryEntry::New(std::move(entry))); } if (result != base::File::FILE_OK || !has_more) { std::move(callback_entry->callback) .Run(std::move(callback_entry->entries), result); } } ",0 "struct page *gfn_to_page(struct kvm *kvm, gfn_t gfn) { pfn_t pfn; pfn = gfn_to_pfn(kvm, gfn); return kvm_pfn_to_page(pfn); } ",0 "static inline void debugt(const char *func, const char *msg) { } ",0 "void jpc_ns_invlift_colres(jpc_fix_t *a, int numrows, int numcols, int stride, int parity) { jpc_fix_t *lptr; jpc_fix_t *hptr; register jpc_fix_t *lptr2; register jpc_fix_t *hptr2; register int n; register int i; int llen; llen = (numrows + 1 - parity) >> 1; if (numrows > 1) { /* Apply the scaling step. */ #if defined(WT_DOSCALE) lptr = &a[0]; n = llen; while (n-- > 0) { lptr2 = lptr; for (i = 0; i < numcols; ++i) { lptr2[0] = jpc_fix_mul(lptr2[0], jpc_dbltofix(1.0 / LGAIN)); ++lptr2; } lptr += stride; } hptr = &a[llen * stride]; n = numrows - llen; while (n-- > 0) { hptr2 = hptr; for (i = 0; i < numcols; ++i) { hptr2[0] = jpc_fix_mul(hptr2[0], jpc_dbltofix(1.0 / HGAIN)); ++hptr2; } hptr += stride; } #endif /* Apply the first lifting step. */ lptr = &a[0]; hptr = &a[llen * stride]; if (!parity) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * DELTA), hptr2[0])); ++lptr2; ++hptr2; } lptr += stride; } n = llen - (!parity) - (parity != (numrows & 1)); while (n-- > 0) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(DELTA), jpc_fix_add(hptr2[0], hptr2[stride]))); ++lptr2; ++hptr2; } lptr += stride; hptr += stride; } if (parity != (numrows & 1)) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * DELTA), hptr2[0])); ++lptr2; ++hptr2; } } /* Apply the second lifting step. */ lptr = &a[0]; hptr = &a[llen * stride]; if (parity) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * GAMMA), lptr2[0])); ++hptr2; ++lptr2; } hptr += stride; } n = numrows - llen - parity - (parity == (numrows & 1)); while (n-- > 0) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(GAMMA), jpc_fix_add(lptr2[0], lptr2[stride]))); ++lptr2; ++hptr2; } hptr += stride; lptr += stride; } if (parity == (numrows & 1)) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * GAMMA), lptr2[0])); ++lptr2; ++hptr2; } } /* Apply the third lifting step. */ lptr = &a[0]; hptr = &a[llen * stride]; if (!parity) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * BETA), hptr2[0])); ++lptr2; ++hptr2; } lptr += stride; } n = llen - (!parity) - (parity != (numrows & 1)); while (n-- > 0) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(BETA), jpc_fix_add(hptr2[0], hptr2[stride]))); ++lptr2; ++hptr2; } lptr += stride; hptr += stride; } if (parity != (numrows & 1)) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(lptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * BETA), hptr2[0])); ++lptr2; ++hptr2; } } /* Apply the fourth lifting step. */ lptr = &a[0]; hptr = &a[llen * stride]; if (parity) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * ALPHA), lptr2[0])); ++hptr2; ++lptr2; } hptr += stride; } n = numrows - llen - parity - (parity == (numrows & 1)); while (n-- > 0) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(ALPHA), jpc_fix_add(lptr2[0], lptr2[stride]))); ++lptr2; ++hptr2; } hptr += stride; lptr += stride; } if (parity == (numrows & 1)) { lptr2 = lptr; hptr2 = hptr; for (i = 0; i < numcols; ++i) { jpc_fix_minuseq(hptr2[0], jpc_fix_mul(jpc_dbltofix(2.0 * ALPHA), lptr2[0])); ++lptr2; ++hptr2; } } } else { #if defined(WT_LENONE) if (parity) { lptr2 = &a[0]; for (i = 0; i < numcols; ++i) { lptr2[0] = jpc_fix_asr(lptr2[0], 1); ++lptr2; } } #endif } } ",0 "static void run_script(const char *action, double offset) { char *argv[3]; char *env1, *env2, *env3, *env4; G.last_script_run = G.cur_time; if (!G.script_name) return; argv[0] = (char*) G.script_name; argv[1] = (char*) action; argv[2] = NULL; VERB1 bb_error_msg(""executing '%s %s'"", G.script_name, action); env1 = xasprintf(""%s=%u"", ""stratum"", G.stratum); putenv(env1); env2 = xasprintf(""%s=%ld"", ""freq_drift_ppm"", G.kernel_freq_drift); putenv(env2); env3 = xasprintf(""%s=%u"", ""poll_interval"", 1 << G.poll_exp); putenv(env3); env4 = xasprintf(""%s=%f"", ""offset"", offset); putenv(env4); /* Other items of potential interest: selected peer, * rootdelay, reftime, rootdisp, refid, ntp_status, * last_update_offset, last_update_recv_time, discipline_jitter, * how many peers have reachable_bits = 0? */ /* Don't want to wait: it may run hwclock --systohc, and that * may take some time (seconds): */ /*spawn_and_wait(argv);*/ spawn(argv); unsetenv(""stratum""); unsetenv(""freq_drift_ppm""); unsetenv(""poll_interval""); unsetenv(""offset""); free(env1); free(env2); free(env3); free(env4); } ",0 "void DiceResponseHandler::DiceTokenFetcher::OnTimeout() { RecordDiceFetchTokenResult(kFetchTimeout); gaia_auth_fetcher_.reset(); timeout_closure_.Cancel(); dice_response_handler_->OnTokenExchangeFailure( this, GoogleServiceAuthError(GoogleServiceAuthError::REQUEST_CANCELED)); } ",0 "static ZIPARCHIVE_METHOD(getExternalAttributesName) { struct zip *intern; zval *self = getThis(), *z_opsys, *z_attr; size_t name_len; char *name; zend_long flags=0; zip_uint8_t opsys; zip_uint32_t attr; zip_int64_t idx; if (!self) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, self); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""sz/z/|l"", &name, &name_len, &z_opsys, &z_attr, &flags) == FAILURE) { return; } if (name_len < 1) { php_error_docref(NULL, E_NOTICE, ""Empty string as entry name""); } idx = zip_name_locate(intern, name, 0); if (idx < 0) { RETURN_FALSE; } if (zip_file_get_external_attributes(intern, idx, (zip_flags_t)flags, &opsys, &attr) < 0) { RETURN_FALSE; } zval_ptr_dtor(z_opsys); ZVAL_LONG(z_opsys, opsys); zval_ptr_dtor(z_attr); ZVAL_LONG(z_attr, attr); RETURN_TRUE; } ",0 "static inline void shrink_free_pagepool(struct xen_blkif_ring *ring, int num) { /* Remove requested pages in batches of NUM_BATCH_FREE_PAGES */ struct page *page[NUM_BATCH_FREE_PAGES]; unsigned int num_pages = 0; unsigned long flags; spin_lock_irqsave(&ring->free_pages_lock, flags); while (ring->free_pages_num > num) { BUG_ON(list_empty(&ring->free_pages)); page[num_pages] = list_first_entry(&ring->free_pages, struct page, lru); list_del(&page[num_pages]->lru); ring->free_pages_num--; if (++num_pages == NUM_BATCH_FREE_PAGES) { spin_unlock_irqrestore(&ring->free_pages_lock, flags); gnttab_free_pages(num_pages, page); spin_lock_irqsave(&ring->free_pages_lock, flags); num_pages = 0; } } spin_unlock_irqrestore(&ring->free_pages_lock, flags); if (num_pages != 0) gnttab_free_pages(num_pages, page); } ",0 "CSSStyleSheet* Document::createCSSStyleSheetSync( ScriptState* script_state, const String& text, const CSSStyleSheetInit* options, ExceptionState& exception_state) { CSSStyleSheet* sheet = CSSStyleSheet::Create(*this, options, exception_state); sheet->SetText(text, false /* allow_import_rules */, exception_state); if (exception_state.HadException()) return nullptr; sheet->SetAssociatedDocument(this); return sheet; } ",0 "void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( HTMLCanvasElementOrOffscreenCanvas& result) const { if (canvas()) { result.SetHTMLCanvasElement(static_cast(Host())); } else { result.SetOffscreenCanvas(static_cast(Host())); } } ",0 "void WebRuntimeFeatures::EnablePassiveDocumentWheelEventListeners(bool enable) { RuntimeEnabledFeatures::SetPassiveDocumentWheelEventListenersEnabled(enable); } ",0 "void GetRTCStatsOnSignalingThread( const scoped_refptr& main_thread, scoped_refptr native_peer_connection, std::unique_ptr callback, blink::RTCStatsFilter filter) { TRACE_EVENT0(""webrtc"", ""GetRTCStatsOnSignalingThread""); native_peer_connection->GetStats(RTCStatsCollectorCallbackImpl::Create( main_thread, std::move(callback), filter)); } ",0 "void WebContentsImpl::RenderViewTerminated(RenderViewHost* rvh, base::TerminationStatus status, int error_code) { if (rvh != GetRenderViewHost()) { return; } if (IsFullscreenForCurrentTab()) ExitFullscreenMode(false); CancelActiveAndPendingDialogs(); if (delegate_) delegate_->HideValidationMessage(this); audio_stream_monitor_.RenderProcessGone(rvh->GetProcess()->GetID()); ResetLoadProgressState(); NotifyDisconnected(); SetIsCrashed(status, error_code); for (auto& observer : observers_) observer.RenderProcessGone(GetCrashedStatus()); } ",0 "void IndexedDBDispatcher::RequestIDBFactoryDeleteDatabase( const string16& name, WebIDBCallbacks* callbacks_ptr, const string16& origin, WebFrame* web_frame) { ResetCursorPrefetchCaches(); scoped_ptr callbacks(callbacks_ptr); if (!CurrentWorkerId() && !ChildThread::current()->IsWebFrameValid(web_frame)) return; IndexedDBHostMsg_FactoryDeleteDatabase_Params params; params.thread_id = CurrentWorkerId(); params.response_id = pending_callbacks_.Add(callbacks.release()); params.origin = origin; params.name = name; Send(new IndexedDBHostMsg_FactoryDeleteDatabase(params)); } ",0 "reinit_ports(struct ofproto *p) { struct ofproto_port_dump dump; struct sset devnames; struct ofport *ofport; struct ofproto_port ofproto_port; const char *devname; COVERAGE_INC(ofproto_reinit_ports); sset_init(&devnames); HMAP_FOR_EACH (ofport, hmap_node, &p->ports) { sset_add(&devnames, netdev_get_name(ofport->netdev)); } OFPROTO_PORT_FOR_EACH (&ofproto_port, &dump, p) { sset_add(&devnames, ofproto_port.name); } SSET_FOR_EACH (devname, &devnames) { update_port(p, devname); } sset_destroy(&devnames); } ",0 "static void h264_er_decode_mb(void *opaque, int ref, int mv_dir, int mv_type, int (*mv)[2][4][2], int mb_x, int mb_y, int mb_intra, int mb_skipped) { H264Context *h = opaque; h->mb_x = mb_x; h->mb_y = mb_y; h->mb_xy = mb_x + mb_y * h->mb_stride; memset(h->non_zero_count_cache, 0, sizeof(h->non_zero_count_cache)); av_assert1(ref >= 0); /* FIXME: It is possible albeit uncommon that slice references * differ between slices. We take the easy approach and ignore * it for now. If this turns out to have any relevance in * practice then correct remapping should be added. */ if (ref >= h->ref_count[0]) ref = 0; if (!h->ref_list[0][ref].f.data[0]) { av_log(h->avctx, AV_LOG_DEBUG, ""Reference not available for error concealing\n""); ref = 0; } if ((h->ref_list[0][ref].reference&3) != 3) { av_log(h->avctx, AV_LOG_DEBUG, ""Reference invalid\n""); return; } fill_rectangle(&h->cur_pic.ref_index[0][4 * h->mb_xy], 2, 2, 2, ref, 1); fill_rectangle(&h->ref_cache[0][scan8[0]], 4, 4, 8, ref, 1); fill_rectangle(h->mv_cache[0][scan8[0]], 4, 4, 8, pack16to32((*mv)[0][0][0], (*mv)[0][0][1]), 4); h->mb_mbaff = h->mb_field_decoding_flag = 0; ff_h264_hl_decode_mb(h); } ",0 "CronTab::needsCronTab( ClassAd *ad ) { bool ret = false; int ctr; for ( ctr = 0; ctr < CRONTAB_FIELDS; ctr++ ) { if ( ad->LookupExpr( CronTab::attributes[ctr] ) ) { ret = true; break; } } // FOR return ( ret ); } ",0 "bool AXObject::isMenuRelated() const { switch (roleValue()) { case MenuRole: case MenuBarRole: case MenuButtonRole: case MenuItemRole: case MenuItemCheckBoxRole: case MenuItemRadioRole: return true; default: return false; } } ",0 "void ServiceWorkerContextCore::RemoveProviderHost(int provider_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); providers_->erase(provider_id); } ",0 "bool AuthenticatorBlePowerOnAutomaticSheetModel::IsAcceptButtonVisible() const { return true; } ",0 "static void appendImagesFromStyle(Vector& images, RenderStyle& blockStyle) { appendLayers(images, blockStyle.backgroundLayers()); appendLayers(images, blockStyle.maskLayers()); const ContentData* contentData = blockStyle.contentData(); if (contentData && contentData->isImage()) { const ImageContentData* imageContentData = static_cast(contentData); appendImageIfNotNull(images, imageContentData->image()); } if (blockStyle.boxReflect()) appendImageIfNotNull(images, blockStyle.boxReflect()->mask().image()); appendImageIfNotNull(images, blockStyle.listStyleImage()); appendImageIfNotNull(images, blockStyle.borderImageSource()); appendImageIfNotNull(images, blockStyle.maskBoxImageSource()); if (blockStyle.shapeOutside()) appendImageIfNotNull(images, blockStyle.shapeOutside()->image()); } ",0 "void WebFrameLoaderClient::dispatchDidFirstLayout() { } ",0 "void FileReaderLoader::convertToText() { if (!m_bytesLoaded) return; StringBuilder builder; if (!m_decoder) m_decoder = TextResourceDecoder::create(""text/plain"", m_encoding.isValid() ? m_encoding : UTF8Encoding()); builder.append(m_decoder->decode(static_cast(m_rawData->data()), m_bytesLoaded)); if (isCompleted()) builder.append(m_decoder->flush()); m_stringResult = builder.toString(); } ",0 "int pdf_add_barcode(struct pdf_doc *pdf, struct pdf_object *page, int code, int x, int y, int width, int height, const char *string, uint32_t colour) { if (!string || !*string) return 0; switch (code) { case PDF_BARCODE_128A: return pdf_add_barcode_128a(pdf, page, x, y, width, height, string, colour); case PDF_BARCODE_39: return pdf_add_barcode_39(pdf, page, x, y, width, height, string, colour); default: return pdf_set_err(pdf, -EINVAL, ""Invalid barcode code %d"", code); } } ",0 " T1_Set_MM_Blend( T1_Face face, FT_UInt num_coords, FT_Fixed* coords ) { PS_Blend blend = face->blend; FT_Error error; FT_UInt n, m; error = FT_ERR( Invalid_Argument ); if ( blend && blend->num_axis == num_coords ) { /* recompute the weight vector from the blend coordinates */ for ( n = 0; n < blend->num_designs; n++ ) { FT_Fixed result = 0x10000L; /* 1.0 fixed */ for ( m = 0; m < blend->num_axis; m++ ) { FT_Fixed factor; /* get current blend axis position */ factor = coords[m]; if ( factor < 0 ) factor = 0; if ( factor > 0x10000L ) factor = 0x10000L; if ( ( n & ( 1 << m ) ) == 0 ) factor = 0x10000L - factor; result = FT_MulFix( result, factor ); } blend->weight_vector[n] = result; } error = FT_Err_Ok; } return error; } ",0 "void WebPagePrivate::updateViewportSize(bool setFixedReportedSize, bool sendResizeEvent) { if (!m_backingStore) return; ASSERT(m_mainFrame->view()); IntSize visibleSize = actualVisibleSize(); if (setFixedReportedSize) m_mainFrame->view()->setFixedReportedSize(visibleSize); IntRect frameRect = IntRect(scrollPosition(), visibleSize); if (frameRect != m_mainFrame->view()->frameRect()) { m_mainFrame->view()->setFrameRect(frameRect); m_mainFrame->view()->adjustViewSize(); #if ENABLE(FULLSCREEN_API) if (m_fullscreenVideoNode) { Document* document = m_fullscreenVideoNode->document(); ASSERT(document); ASSERT(document->fullScreenRenderer()); int width = m_mainFrame->view()->visibleContentRect().size().width(); document->fullScreenRenderer()->style()->setWidth(Length(width, Fixed)); } #endif } if (sendResizeEvent && shouldSendResizeEvent()) m_mainFrame->eventHandler()->sendResizeEvent(); m_mainFrame->view()->repaintFixedElementsAfterScrolling(); } ",0 "void AXObjectCacheImpl::handleTextFormControlChanged(Node* node) { handleEditableTextContentChanged(node); } ",0 "static int convert_ctx_accesses(struct verifier_env *env) { struct bpf_insn *insn = env->prog->insnsi; int insn_cnt = env->prog->len; struct bpf_insn insn_buf[16]; struct bpf_prog *new_prog; u32 cnt; int i; enum bpf_access_type type; if (!env->prog->aux->ops->convert_ctx_access) return 0; for (i = 0; i < insn_cnt; i++, insn++) { if (insn->code == (BPF_LDX | BPF_MEM | BPF_W)) type = BPF_READ; else if (insn->code == (BPF_STX | BPF_MEM | BPF_W)) type = BPF_WRITE; else continue; if (insn->imm != PTR_TO_CTX) { /* clear internal mark */ insn->imm = 0; continue; } cnt = env->prog->aux->ops-> convert_ctx_access(type, insn->dst_reg, insn->src_reg, insn->off, insn_buf, env->prog); if (cnt == 0 || cnt >= ARRAY_SIZE(insn_buf)) { verbose(""bpf verifier is misconfigured\n""); return -EINVAL; } if (cnt == 1) { memcpy(insn, insn_buf, sizeof(*insn)); continue; } /* several new insns need to be inserted. Make room for them */ insn_cnt += cnt - 1; new_prog = bpf_prog_realloc(env->prog, bpf_prog_size(insn_cnt), GFP_USER); if (!new_prog) return -ENOMEM; new_prog->len = insn_cnt; memmove(new_prog->insnsi + i + cnt, new_prog->insns + i + 1, sizeof(*insn) * (insn_cnt - i - cnt)); /* copy substitute insns in place of load instruction */ memcpy(new_prog->insnsi + i, insn_buf, sizeof(*insn) * cnt); /* adjust branches in the whole program */ adjust_branches(new_prog, i, cnt - 1); /* keep walking new program and skip insns we just inserted */ env->prog = new_prog; insn = new_prog->insnsi + i + cnt - 1; i += cnt - 1; } return 0; } ",0 "virConnectGetAllDomainStats(virConnectPtr conn, unsigned int stats, virDomainStatsRecordPtr **retStats, unsigned int flags) { int ret = -1; VIR_DEBUG(""conn=%p, stats=0x%x, retStats=%p, flags=0x%x"", conn, stats, retStats, flags); virResetLastError(); virCheckConnectReturn(conn, -1); virCheckNonNullArgGoto(retStats, cleanup); if (!conn->driver->connectGetAllDomainStats) { virReportUnsupportedError(); goto cleanup; } ret = conn->driver->connectGetAllDomainStats(conn, NULL, 0, stats, retStats, flags); cleanup: if (ret < 0) virDispatchError(conn); return ret; } ",0 "bool RenderWidgetHostViewAura::CanFocus() { return popup_type_ == blink::WebPopupTypeNone; } ",0 "static unsigned VerticalScrollDistance(LocalFrame& frame) { Element* focused_element = frame.GetDocument()->FocusedElement(); if (!focused_element) return 0; LayoutObject* layout_object = focused_element->GetLayoutObject(); if (!layout_object || !layout_object->IsBox()) return 0; LayoutBox& layout_box = ToLayoutBox(*layout_object); const ComputedStyle* style = layout_box.Style(); if (!style) return 0; if (!(style->OverflowY() == EOverflow::kScroll || style->OverflowY() == EOverflow::kAuto || HasEditableStyle(*focused_element))) return 0; int height = std::min(layout_box.ClientHeight().ToInt(), frame.View()->VisibleHeight()); return static_cast( max(max(height * ScrollableArea::MinFractionToStepWhenPaging(), height - ScrollableArea::MaxOverlapBetweenPages()), 1)); } ",0 "static int ax25_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg) { struct sock *sk = sock->sk; void __user *argp = (void __user *)arg; int res = 0; lock_sock(sk); switch (cmd) { case TIOCOUTQ: { long amount; amount = sk->sk_sndbuf - sk_wmem_alloc_get(sk); if (amount < 0) amount = 0; res = put_user(amount, (int __user *)argp); break; } case TIOCINQ: { struct sk_buff *skb; long amount = 0L; /* These two are safe on a single CPU system as only user tasks fiddle here */ if ((skb = skb_peek(&sk->sk_receive_queue)) != NULL) amount = skb->len; res = put_user(amount, (int __user *) argp); break; } case SIOCGSTAMP: res = sock_get_timestamp(sk, argp); break; case SIOCGSTAMPNS: res = sock_get_timestampns(sk, argp); break; case SIOCAX25ADDUID: /* Add a uid to the uid/call map table */ case SIOCAX25DELUID: /* Delete a uid from the uid/call map table */ case SIOCAX25GETUID: { struct sockaddr_ax25 sax25; if (copy_from_user(&sax25, argp, sizeof(sax25))) { res = -EFAULT; break; } res = ax25_uid_ioctl(cmd, &sax25); break; } case SIOCAX25NOUID: { /* Set the default policy (default/bar) */ long amount; if (!capable(CAP_NET_ADMIN)) { res = -EPERM; break; } if (get_user(amount, (long __user *)argp)) { res = -EFAULT; break; } if (amount < 0 || amount > AX25_NOUID_BLOCK) { res = -EINVAL; break; } ax25_uid_policy = amount; res = 0; break; } case SIOCADDRT: case SIOCDELRT: case SIOCAX25OPTRT: if (!capable(CAP_NET_ADMIN)) { res = -EPERM; break; } res = ax25_rt_ioctl(cmd, argp); break; case SIOCAX25CTLCON: if (!capable(CAP_NET_ADMIN)) { res = -EPERM; break; } res = ax25_ctl_ioctl(cmd, argp); break; case SIOCAX25GETINFO: case SIOCAX25GETINFOOLD: { ax25_cb *ax25 = ax25_sk(sk); struct ax25_info_struct ax25_info; ax25_info.t1 = ax25->t1 / HZ; ax25_info.t2 = ax25->t2 / HZ; ax25_info.t3 = ax25->t3 / HZ; ax25_info.idle = ax25->idle / (60 * HZ); ax25_info.n2 = ax25->n2; ax25_info.t1timer = ax25_display_timer(&ax25->t1timer) / HZ; ax25_info.t2timer = ax25_display_timer(&ax25->t2timer) / HZ; ax25_info.t3timer = ax25_display_timer(&ax25->t3timer) / HZ; ax25_info.idletimer = ax25_display_timer(&ax25->idletimer) / (60 * HZ); ax25_info.n2count = ax25->n2count; ax25_info.state = ax25->state; ax25_info.rcv_q = sk_rmem_alloc_get(sk); ax25_info.snd_q = sk_wmem_alloc_get(sk); ax25_info.vs = ax25->vs; ax25_info.vr = ax25->vr; ax25_info.va = ax25->va; ax25_info.vs_max = ax25->vs; /* reserved */ ax25_info.paclen = ax25->paclen; ax25_info.window = ax25->window; /* old structure? */ if (cmd == SIOCAX25GETINFOOLD) { static int warned = 0; if (!warned) { printk(KERN_INFO ""%s uses old SIOCAX25GETINFO\n"", current->comm); warned=1; } if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct_deprecated))) { res = -EFAULT; break; } } else { if (copy_to_user(argp, &ax25_info, sizeof(struct ax25_info_struct))) { res = -EINVAL; break; } } res = 0; break; } case SIOCAX25ADDFWD: case SIOCAX25DELFWD: { struct ax25_fwd_struct ax25_fwd; if (!capable(CAP_NET_ADMIN)) { res = -EPERM; break; } if (copy_from_user(&ax25_fwd, argp, sizeof(ax25_fwd))) { res = -EFAULT; break; } res = ax25_fwd_ioctl(cmd, &ax25_fwd); break; } case SIOCGIFADDR: case SIOCSIFADDR: case SIOCGIFDSTADDR: case SIOCSIFDSTADDR: case SIOCGIFBRDADDR: case SIOCSIFBRDADDR: case SIOCGIFNETMASK: case SIOCSIFNETMASK: case SIOCGIFMETRIC: case SIOCSIFMETRIC: res = -EINVAL; break; default: res = -ENOIOCTLCMD; break; } release_sock(sk); return res; } ",0 "static void strictTypeCheckingVoidMethodTestInterfaceEmptyArgMethod(const v8::FunctionCallbackInfo& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute(""strictTypeCheckingVoidMethodTestInterfaceEmptyArg"", ""TestObjectPython"", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); if (info.Length() > 0 && !V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate())) { throwTypeError(ExceptionMessages::failedToExecute(""strictTypeCheckingVoidMethodTestInterfaceEmptyArg"", ""TestObjectPython"", ""parameter 1 is not of type 'TestInterfaceEmpty'.""), info.GetIsolate()); return; } V8TRYCATCH_VOID(TestInterfaceEmpty*, testInterfaceEmptyArg, V8TestInterfaceEmpty::toNativeWithTypeCheck(info.GetIsolate(), info[0])); imp->strictTypeCheckingVoidMethodTestInterfaceEmptyArg(testInterfaceEmptyArg); } ",0 "static void usbnet_async_cmd_cb(struct urb *urb) { struct usb_ctrlrequest *req = (struct usb_ctrlrequest *)urb->context; int status = urb->status; if (status < 0) dev_dbg(&urb->dev->dev, ""%s failed with %d"", __func__, status); kfree(req); usb_free_urb(urb); } ",0 "static inline void VectorCopy44(const DDSVector4 source, DDSVector4 *destination) { destination->x = source.x; destination->y = source.y; destination->z = source.z; destination->w = source.w; } ",0 "int test_kron(BIO *bp, BN_CTX *ctx) { BN_GENCB cb; BIGNUM *a,*b,*r,*t; int i; int legendre, kronecker; int ret = 0; a = BN_new(); b = BN_new(); r = BN_new(); t = BN_new(); if (a == NULL || b == NULL || r == NULL || t == NULL) goto err; BN_GENCB_set(&cb, genprime_cb, NULL); /* We test BN_kronecker(a, b, ctx) just for b odd (Jacobi symbol). * In this case we know that if b is prime, then BN_kronecker(a, b, ctx) * is congruent to $a^{(b-1)/2}$, modulo $b$ (Legendre symbol). * So we generate a random prime b and compare these values * for a number of random a's. (That is, we run the Solovay-Strassen * primality test to confirm that b is prime, except that we * don't want to test whether b is prime but whether BN_kronecker * works.) */ if (!BN_generate_prime_ex(b, 512, 0, NULL, NULL, &cb)) goto err; b->neg = rand_neg(); putc('\n', stderr); for (i = 0; i < num0; i++) { if (!BN_bntest_rand(a, 512, 0, 0)) goto err; a->neg = rand_neg(); /* t := (|b|-1)/2 (note that b is odd) */ if (!BN_copy(t, b)) goto err; t->neg = 0; if (!BN_sub_word(t, 1)) goto err; if (!BN_rshift1(t, t)) goto err; /* r := a^t mod b */ b->neg=0; if (!BN_mod_exp_recp(r, a, t, b, ctx)) goto err; b->neg=1; if (BN_is_word(r, 1)) legendre = 1; else if (BN_is_zero(r)) legendre = 0; else { if (!BN_add_word(r, 1)) goto err; if (0 != BN_ucmp(r, b)) { fprintf(stderr, ""Legendre symbol computation failed\n""); goto err; } legendre = -1; } kronecker = BN_kronecker(a, b, ctx); if (kronecker < -1) goto err; /* we actually need BN_kronecker(a, |b|) */ if (a->neg && b->neg) kronecker = -kronecker; if (legendre != kronecker) { fprintf(stderr, ""legendre != kronecker; a = ""); BN_print_fp(stderr, a); fprintf(stderr, "", b = ""); BN_print_fp(stderr, b); fprintf(stderr, ""\n""); goto err; } putc('.', stderr); fflush(stderr); } putc('\n', stderr); fflush(stderr); ret = 1; err: if (a != NULL) BN_free(a); if (b != NULL) BN_free(b); if (r != NULL) BN_free(r); if (t != NULL) BN_free(t); return ret; } ",0 "Buffer CommandBufferProxyImpl::GetTransferBuffer(int32 id) { if (last_state_.error != gpu::error::kNoError) return Buffer(); TransferBufferMap::iterator it = transfer_buffers_.find(id); if (it != transfer_buffers_.end()) { return it->second; } base::SharedMemoryHandle handle; uint32 size; if (!Send(new GpuCommandBufferMsg_GetTransferBuffer(route_id_, id, &handle, &size))) { return Buffer(); } base::SharedMemory* shared_memory = new base::SharedMemory(handle, false); if (!shared_memory->memory()) { if (!shared_memory->Map(size)) { delete shared_memory; return Buffer(); } } Buffer buffer; buffer.ptr = shared_memory->memory(); buffer.size = size; buffer.shared_memory = shared_memory; transfer_buffers_[id] = buffer; return buffer; } ",0 "void HTMLInputElement::defaultEventHandler(Event* evt) { if (evt->isMouseEvent() && evt->type() == EventTypeNames::click && toMouseEvent(evt)->button() == LeftButton) { m_inputTypeView->handleClickEvent(toMouseEvent(evt)); if (evt->defaultHandled()) return; } if (evt->isTouchEvent()) { m_inputTypeView->handleTouchEvent(toTouchEvent(evt)); if (evt->defaultHandled()) return; } if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keydown) { m_inputTypeView->handleKeydownEvent(toKeyboardEvent(evt)); if (evt->defaultHandled()) return; } bool callBaseClassEarly = isTextField() && (evt->type() == EventTypeNames::keydown || evt->type() == EventTypeNames::keypress); if (callBaseClassEarly) { HTMLTextFormControlElement::defaultEventHandler(evt); if (evt->defaultHandled()) return; } if (evt->type() == EventTypeNames::DOMActivate) { m_inputType->handleDOMActivateEvent(evt); if (evt->defaultHandled()) return; } if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keypress) { m_inputTypeView->handleKeypressEvent(toKeyboardEvent(evt)); if (evt->defaultHandled()) return; } if (evt->isKeyboardEvent() && evt->type() == EventTypeNames::keyup) { m_inputTypeView->handleKeyupEvent(toKeyboardEvent(evt)); if (evt->defaultHandled()) return; } if (m_inputTypeView->shouldSubmitImplicitly(evt)) { if (isSearchField()) onSearch(); if (wasChangedSinceLastFormControlChangeEvent()) dispatchFormControlChangeEvent(); RefPtr formForSubmission = m_inputTypeView->formForSubmission(); if (formForSubmission) formForSubmission->submitImplicitly(evt, canTriggerImplicitSubmission()); evt->setDefaultHandled(); return; } if (evt->isBeforeTextInsertedEvent()) m_inputTypeView->handleBeforeTextInsertedEvent(static_cast(evt)); if (evt->isMouseEvent() && evt->type() == EventTypeNames::mousedown) { m_inputTypeView->handleMouseDownEvent(toMouseEvent(evt)); if (evt->defaultHandled()) return; } m_inputTypeView->forwardEvent(evt); if (!callBaseClassEarly && !evt->defaultHandled()) HTMLTextFormControlElement::defaultEventHandler(evt); } ",0 "const WebParsedFeaturePolicy& HTMLFrameOwnerElement::ContainerPolicy() const { return container_policy_; } ",0 "void webkit_web_view_set_settings(WebKitWebView* webView, WebKitWebSettings* webSettings) { g_return_if_fail(WEBKIT_IS_WEB_VIEW(webView)); g_return_if_fail(WEBKIT_IS_WEB_SETTINGS(webSettings)); WebKitWebViewPrivate* priv = webView->priv; g_signal_handlers_disconnect_by_func(priv->webSettings.get(), (gpointer)webkit_web_view_settings_notify, webView); priv->webSettings = webSettings; webkit_web_view_update_settings(webView); g_signal_connect(webSettings, ""notify"", G_CALLBACK(webkit_web_view_settings_notify), webView); g_object_notify(G_OBJECT(webView), ""settings""); } ",0 "void Browser::OnStartDownload(TabContents* source, DownloadItem* download) { TabContentsWrapper* wrapper = TabContentsWrapper::GetCurrentWrapperForContents(source); TabContentsWrapper* constrained = GetConstrainingContentsWrapper(wrapper); if (constrained != wrapper) { TabContents* constrained_tab = constrained->tab_contents(); constrained_tab->delegate()->OnStartDownload(constrained_tab, download); return; } if (!window()) return; if (DisplayOldDownloadsUI()) { #if defined(OS_CHROMEOS) ExtensionService* service = profile_->GetExtensionService(); if (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || (service == NULL) || !service->IsDownloadFromGallery(download->GetURL(), download->referrer_url())) { ActiveDownloadsUI::OpenPopup(profile_); } #else DownloadShelf* shelf = window()->GetDownloadShelf(); shelf->AddDownload(new DownloadItemModel(download)); TabContents* shelf_tab = shelf->browser()->GetSelectedTabContents(); if ((download->total_bytes() > 0) && (!ChromeDownloadManagerDelegate::IsExtensionDownload(download) || ExtensionService::IsDownloadFromMiniGallery(download->GetURL())) && platform_util::IsVisible(shelf_tab->GetNativeView()) && ui::Animation::ShouldRenderRichAnimation()) { DownloadStartedAnimation::Show(shelf_tab); } #endif } if (source->controller().IsInitialNavigation() && tab_count() > 1) CloseContents(source); } ",0 "WKBundlePagePolicyAction InjectedBundlePage::decidePolicyForNewWindowAction(WKBundlePageRef, WKBundleFrameRef, WKBundleNavigationActionRef, WKURLRequestRef, WKStringRef, WKTypeRef*) { return WKBundlePagePolicyActionUse; } ",0 "static int amd_pinconf_group_get(struct pinctrl_dev *pctldev, unsigned int group, unsigned long *config) { const unsigned *pins; unsigned npins; int ret; ret = amd_get_group_pins(pctldev, group, &pins, &npins); if (ret) return ret; if (amd_pinconf_get(pctldev, pins[0], config)) return -ENOTSUPP; return 0; } ",0 "static int prepare_write_begin(struct f2fs_sb_info *sbi, struct page *page, loff_t pos, unsigned len, block_t *blk_addr, bool *node_changed) { struct inode *inode = page->mapping->host; pgoff_t index = page->index; struct dnode_of_data dn; struct page *ipage; bool locked = false; struct extent_info ei; int err = 0; /* * we already allocated all the blocks, so we don't need to get * the block addresses when there is no need to fill the page. */ if (!f2fs_has_inline_data(inode) && len == PAGE_SIZE && !is_inode_flag_set(inode, FI_NO_PREALLOC)) return 0; if (f2fs_has_inline_data(inode) || (pos & PAGE_MASK) >= i_size_read(inode)) { f2fs_lock_op(sbi); locked = true; } restart: /* check inline_data */ ipage = get_node_page(sbi, inode->i_ino); if (IS_ERR(ipage)) { err = PTR_ERR(ipage); goto unlock_out; } set_new_dnode(&dn, inode, ipage, ipage, 0); if (f2fs_has_inline_data(inode)) { if (pos + len <= MAX_INLINE_DATA) { read_inline_data(page, ipage); set_inode_flag(inode, FI_DATA_EXIST); if (inode->i_nlink) set_inline_node(ipage); } else { err = f2fs_convert_inline_page(&dn, page); if (err) goto out; if (dn.data_blkaddr == NULL_ADDR) err = f2fs_get_block(&dn, index); } } else if (locked) { err = f2fs_get_block(&dn, index); } else { if (f2fs_lookup_extent_cache(inode, index, &ei)) { dn.data_blkaddr = ei.blk + index - ei.fofs; } else { /* hole case */ err = get_dnode_of_data(&dn, index, LOOKUP_NODE); if (err || dn.data_blkaddr == NULL_ADDR) { f2fs_put_dnode(&dn); f2fs_lock_op(sbi); locked = true; goto restart; } } } /* convert_inline_page can make node_changed */ *blk_addr = dn.data_blkaddr; *node_changed = dn.node_changed; out: f2fs_put_dnode(&dn); unlock_out: if (locked) f2fs_unlock_op(sbi); return err; } ",0 "void NuPlayer::GenericSource::prepareAsync() { if (mLooper == NULL) { mLooper = new ALooper; mLooper->setName(""generic""); mLooper->start(); mLooper->registerHandler(this); } sp msg = new AMessage(kWhatPrepareAsync, this); msg->post(); } ",0 "unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable) { struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn); return gfn_to_hva_memslot_prot(slot, gfn, writable); } ",0 "AudioBuffer* ConvolverNode::buffer() { ASSERT(isMainThread()); return m_buffer.get(); } ",0 "void user_disable_single_step(struct task_struct *child) { clear_tsk_thread_flag(child, TIF_SINGLESTEP); } ",0 "void Document::CreateImportsController() { DCHECK(!imports_controller_); imports_controller_ = HTMLImportsController::Create(*this); } ",0 "void FrameLoader::detachChildren() { typedef Vector > FrameVector; FrameVector childrenToDetach; childrenToDetach.reserveCapacity(m_frame->tree()->childCount()); for (Frame* child = m_frame->tree()->lastChild(); child; child = child->tree()->previousSibling()) childrenToDetach.append(child); FrameVector::iterator end = childrenToDetach.end(); for (FrameVector::iterator it = childrenToDetach.begin(); it != end; it++) (*it)->loader()->detachFromParent(); } ",0 "hb_buffer_get_script (hb_buffer_t *buffer) { return buffer->script; } ",0 "static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) { __be32 *p; int status = 0; *res = 0; if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_FREE - 1U))) return -EIO; if (likely(bitmap[1] & FATTR4_WORD1_SPACE_FREE)) { p = xdr_inline_decode(xdr, 8); if (unlikely(!p)) goto out_overflow; xdr_decode_hyper(p, res); bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; } dprintk(""%s: space free=%Lu\n"", __func__, (unsigned long long)*res); return status; out_overflow: print_overflow_msg(__func__, xdr); return -EIO; } ",0 " void CallCompleteInitialization(MidiResult result) { CompleteInitialization(result); base::RunLoop run_loop; run_loop.RunUntilIdle(); } ",0 "RenderFrameHostImpl::~RenderFrameHostImpl() { GetProcess()->RemoveRoute(routing_id_); g_routing_id_frame_map.Get().erase( RenderFrameHostID(GetProcess()->GetID(), routing_id_)); if (delegate_) delegate_->RenderFrameDeleted(this); frame_tree_->UnregisterRenderFrameHost(this); } ",0 "ar6000_free_cookie(struct ar6_softc *ar, struct ar_cookie * cookie) { /* Insert first */ A_ASSERT(ar != NULL); A_ASSERT(cookie != NULL); cookie->arc_list_next = ar->arCookieList; ar->arCookieList = cookie; ar->arCookieCount++; } ",0 "static int _perf_event_refresh(struct perf_event *event, int refresh) { /* * not supported on inherited events */ if (event->attr.inherit || !is_sampling_event(event)) return -EINVAL; atomic_add(refresh, &event->event_limit); _perf_event_enable(event); return 0; } ",0 "static void __noclone vmx_vcpu_run(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); unsigned long debugctlmsr, cr4; /* Record the guest's net vcpu time for enforced NMI injections. */ if (unlikely(!cpu_has_virtual_nmis() && vmx->soft_vnmi_blocked)) vmx->entry_time = ktime_get(); /* Don't enter VMX if guest state is invalid, let the exit handler start emulation until we arrive back to a valid state */ if (vmx->emulation_required) return; if (vmx->ple_window_dirty) { vmx->ple_window_dirty = false; vmcs_write32(PLE_WINDOW, vmx->ple_window); } if (vmx->nested.sync_shadow_vmcs) { copy_vmcs12_to_shadow(vmx); vmx->nested.sync_shadow_vmcs = false; } if (test_bit(VCPU_REGS_RSP, (unsigned long *)&vcpu->arch.regs_dirty)) vmcs_writel(GUEST_RSP, vcpu->arch.regs[VCPU_REGS_RSP]); if (test_bit(VCPU_REGS_RIP, (unsigned long *)&vcpu->arch.regs_dirty)) vmcs_writel(GUEST_RIP, vcpu->arch.regs[VCPU_REGS_RIP]); cr4 = cr4_read_shadow(); if (unlikely(cr4 != vmx->host_state.vmcs_host_cr4)) { vmcs_writel(HOST_CR4, cr4); vmx->host_state.vmcs_host_cr4 = cr4; } /* When single-stepping over STI and MOV SS, we must clear the * corresponding interruptibility bits in the guest state. Otherwise * vmentry fails as it then expects bit 14 (BS) in pending debug * exceptions being set, but that's not correct for the guest debugging * case. */ if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) vmx_set_interrupt_shadow(vcpu, 0); if (vmx->guest_pkru_valid) __write_pkru(vmx->guest_pkru); atomic_switch_perf_msrs(vmx); debugctlmsr = get_debugctlmsr(); vmx_arm_hv_timer(vcpu); vmx->__launched = vmx->loaded_vmcs->launched; asm( /* Store host registers */ ""push %%"" _ASM_DX ""; push %%"" _ASM_BP "";"" ""push %%"" _ASM_CX "" \n\t"" /* placeholder for guest rcx */ ""push %%"" _ASM_CX "" \n\t"" ""cmp %%"" _ASM_SP "", %c[host_rsp](%0) \n\t"" ""je 1f \n\t"" ""mov %%"" _ASM_SP "", %c[host_rsp](%0) \n\t"" __ex(ASM_VMX_VMWRITE_RSP_RDX) ""\n\t"" ""1: \n\t"" /* Reload cr2 if changed */ ""mov %c[cr2](%0), %%"" _ASM_AX "" \n\t"" ""mov %%cr2, %%"" _ASM_DX "" \n\t"" ""cmp %%"" _ASM_AX "", %%"" _ASM_DX "" \n\t"" ""je 2f \n\t"" ""mov %%"" _ASM_AX"", %%cr2 \n\t"" ""2: \n\t"" /* Check if vmlaunch of vmresume is needed */ ""cmpl $0, %c[launched](%0) \n\t"" /* Load guest registers. Don't clobber flags. */ ""mov %c[rax](%0), %%"" _ASM_AX "" \n\t"" ""mov %c[rbx](%0), %%"" _ASM_BX "" \n\t"" ""mov %c[rdx](%0), %%"" _ASM_DX "" \n\t"" ""mov %c[rsi](%0), %%"" _ASM_SI "" \n\t"" ""mov %c[rdi](%0), %%"" _ASM_DI "" \n\t"" ""mov %c[rbp](%0), %%"" _ASM_BP "" \n\t"" #ifdef CONFIG_X86_64 ""mov %c[r8](%0), %%r8 \n\t"" ""mov %c[r9](%0), %%r9 \n\t"" ""mov %c[r10](%0), %%r10 \n\t"" ""mov %c[r11](%0), %%r11 \n\t"" ""mov %c[r12](%0), %%r12 \n\t"" ""mov %c[r13](%0), %%r13 \n\t"" ""mov %c[r14](%0), %%r14 \n\t"" ""mov %c[r15](%0), %%r15 \n\t"" #endif ""mov %c[rcx](%0), %%"" _ASM_CX "" \n\t"" /* kills %0 (ecx) */ /* Enter guest mode */ ""jne 1f \n\t"" __ex(ASM_VMX_VMLAUNCH) ""\n\t"" ""jmp 2f \n\t"" ""1: "" __ex(ASM_VMX_VMRESUME) ""\n\t"" ""2: "" /* Save guest registers, load host registers, keep flags */ ""mov %0, %c[wordsize](%%"" _ASM_SP "") \n\t"" ""pop %0 \n\t"" ""mov %%"" _ASM_AX "", %c[rax](%0) \n\t"" ""mov %%"" _ASM_BX "", %c[rbx](%0) \n\t"" __ASM_SIZE(pop) "" %c[rcx](%0) \n\t"" ""mov %%"" _ASM_DX "", %c[rdx](%0) \n\t"" ""mov %%"" _ASM_SI "", %c[rsi](%0) \n\t"" ""mov %%"" _ASM_DI "", %c[rdi](%0) \n\t"" ""mov %%"" _ASM_BP "", %c[rbp](%0) \n\t"" #ifdef CONFIG_X86_64 ""mov %%r8, %c[r8](%0) \n\t"" ""mov %%r9, %c[r9](%0) \n\t"" ""mov %%r10, %c[r10](%0) \n\t"" ""mov %%r11, %c[r11](%0) \n\t"" ""mov %%r12, %c[r12](%0) \n\t"" ""mov %%r13, %c[r13](%0) \n\t"" ""mov %%r14, %c[r14](%0) \n\t"" ""mov %%r15, %c[r15](%0) \n\t"" #endif ""mov %%cr2, %%"" _ASM_AX "" \n\t"" ""mov %%"" _ASM_AX "", %c[cr2](%0) \n\t"" ""pop %%"" _ASM_BP ""; pop %%"" _ASM_DX "" \n\t"" ""setbe %c[fail](%0) \n\t"" "".pushsection .rodata \n\t"" "".global vmx_return \n\t"" ""vmx_return: "" _ASM_PTR "" 2b \n\t"" "".popsection"" : : ""c""(vmx), ""d""((unsigned long)HOST_RSP), [launched]""i""(offsetof(struct vcpu_vmx, __launched)), [fail]""i""(offsetof(struct vcpu_vmx, fail)), [host_rsp]""i""(offsetof(struct vcpu_vmx, host_rsp)), [rax]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_RAX])), [rbx]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_RBX])), [rcx]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_RCX])), [rdx]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_RDX])), [rsi]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_RSI])), [rdi]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_RDI])), [rbp]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_RBP])), #ifdef CONFIG_X86_64 [r8]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_R8])), [r9]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_R9])), [r10]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_R10])), [r11]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_R11])), [r12]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_R12])), [r13]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_R13])), [r14]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_R14])), [r15]""i""(offsetof(struct vcpu_vmx, vcpu.arch.regs[VCPU_REGS_R15])), #endif [cr2]""i""(offsetof(struct vcpu_vmx, vcpu.arch.cr2)), [wordsize]""i""(sizeof(ulong)) : ""cc"", ""memory"" #ifdef CONFIG_X86_64 , ""rax"", ""rbx"", ""rdi"", ""rsi"" , ""r8"", ""r9"", ""r10"", ""r11"", ""r12"", ""r13"", ""r14"", ""r15"" #else , ""eax"", ""ebx"", ""edi"", ""esi"" #endif ); /* MSR_IA32_DEBUGCTLMSR is zeroed on vmexit. Restore it if needed */ if (debugctlmsr) update_debugctlmsr(debugctlmsr); #ifndef CONFIG_X86_64 /* * The sysexit path does not restore ds/es, so we must set them to * a reasonable value ourselves. * * We can't defer this to vmx_load_host_state() since that function * may be executed in interrupt context, which saves and restore segments * around it, nullifying its effect. */ loadsegment(ds, __USER_DS); loadsegment(es, __USER_DS); #endif vcpu->arch.regs_avail = ~((1 << VCPU_REGS_RIP) | (1 << VCPU_REGS_RSP) | (1 << VCPU_EXREG_RFLAGS) | (1 << VCPU_EXREG_PDPTR) | (1 << VCPU_EXREG_SEGMENTS) | (1 << VCPU_EXREG_CR3)); vcpu->arch.regs_dirty = 0; vmx->idt_vectoring_info = vmcs_read32(IDT_VECTORING_INFO_FIELD); vmx->loaded_vmcs->launched = 1; vmx->exit_reason = vmcs_read32(VM_EXIT_REASON); /* * eager fpu is enabled if PKEY is supported and CR4 is switched * back on host, so it is safe to read guest PKRU from current * XSAVE. */ if (boot_cpu_has(X86_FEATURE_OSPKE)) { vmx->guest_pkru = __read_pkru(); if (vmx->guest_pkru != vmx->host_pkru) { vmx->guest_pkru_valid = true; __write_pkru(vmx->host_pkru); } else vmx->guest_pkru_valid = false; } /* * the KVM_REQ_EVENT optimization bit is only on for one entry, and if * we did not inject a still-pending event to L1 now because of * nested_run_pending, we need to re-enable this bit. */ if (vmx->nested.nested_run_pending) kvm_make_request(KVM_REQ_EVENT, vcpu); vmx->nested.nested_run_pending = 0; vmx_complete_atomic_exit(vmx); vmx_recover_nmi_blocking(vmx); vmx_complete_interrupts(vmx); } ",0 "jsonb_array_elements_text(PG_FUNCTION_ARGS) { return elements_worker_jsonb(fcinfo, ""jsonb_array_elements_text"", true); } ",0 "struct lruvec *mem_cgroup_lru_add_list(struct zone *zone, struct page *page, enum lru_list lru) { struct mem_cgroup_per_zone *mz; struct mem_cgroup *memcg; struct page_cgroup *pc; if (mem_cgroup_disabled()) return &zone->lruvec; pc = lookup_page_cgroup(page); memcg = pc->mem_cgroup; /* * Surreptitiously switch any uncharged page to root: * an uncharged page off lru does nothing to secure * its former mem_cgroup from sudden removal. * * Our caller holds lru_lock, and PageCgroupUsed is updated * under page_cgroup lock: between them, they make all uses * of pc->mem_cgroup safe. */ if (!PageCgroupUsed(pc) && memcg != root_mem_cgroup) pc->mem_cgroup = memcg = root_mem_cgroup; mz = page_cgroup_zoneinfo(memcg, page); /* compound_order() is stabilized through lru_lock */ MEM_CGROUP_ZSTAT(mz, lru) += 1 << compound_order(page); return &mz->lruvec; } ",0 "static RBinAddr* newEntry(ut64 haddr, ut64 paddr, int type, int bits) { RBinAddr *ptr = R_NEW0 (RBinAddr); if (ptr) { ptr->paddr = paddr; ptr->vaddr = paddr; ptr->haddr = haddr; ptr->bits = bits; ptr->type = type; if (bits == 16 && ptr->vaddr & 1) { ptr->paddr--; ptr->vaddr--; } } return ptr; } ",0 "ProcRenderFreeGlyphSet(ClientPtr client) { GlyphSetPtr glyphSet; int rc; REQUEST(xRenderFreeGlyphSetReq); REQUEST_SIZE_MATCH(xRenderFreeGlyphSetReq); rc = dixLookupResourceByType((void **) &glyphSet, stuff->glyphset, GlyphSetType, client, DixDestroyAccess); if (rc != Success) { client->errorValue = stuff->glyphset; return rc; } FreeResource(stuff->glyphset, RT_NONE); return Success; } ",0 "bool TextAutosizer::isAutosizingCluster(const RenderBlock* renderer) { ASSERT(isAutosizingContainer(renderer)); return renderer->isRenderView() || renderer->isFloating() || renderer->isOutOfFlowPositioned() || renderer->isTableCell() || renderer->isTableCaption() || renderer->isFlexibleBoxIncludingDeprecated() || renderer->hasColumns() || renderer->style()->overflowX() != OVISIBLE || renderer->style()->overflowY() != OVISIBLE || renderer->containingBlock()->isHorizontalWritingMode() != renderer->isHorizontalWritingMode(); } ",0 "static void setLogLevel(int level) { android_atomic_write(level, &gLogLevel); } ",0 "static int parse_tag(blkid_cache cache, blkid_dev dev, char **cp) { char *name = NULL; char *value = NULL; int ret; if (!cache || !dev) return -BLKID_ERR_PARAM; if ((ret = parse_token(&name, &value, cp)) <= 0 /* && (ret = parse_xml(&name, &value, cp)) <= 0 */) return ret; /* Some tags are stored directly in the device struct */ if (!strcmp(name, ""DEVNO"")) dev->bid_devno = STRTOULL(value, 0, 0); else if (!strcmp(name, ""PRI"")) dev->bid_pri = strtol(value, 0, 0); else if (!strcmp(name, ""TIME"")) { char *end = NULL; dev->bid_time = STRTOULL(value, &end, 0); if (end && *end == '.') dev->bid_utime = STRTOULL(end + 1, 0, 0); } else ret = blkid_set_tag(dev, name, value, strlen(value)); DBG(READ, ul_debug("" tag: %s=\""%s\"""", name, value)); return ret < 0 ? ret : 1; } ",0 "static int devicenvalidate(i_ctx_t *i_ctx_p, ref *space, float *values, int num_comps) { int i, code; ref narray; os_ptr op = osp; code = array_get(imemory, space, 1, &narray); if (code < 0) return code; if (!r_is_array(&narray)) return_error(gs_error_typecheck); if (num_comps < r_size(&narray)) return_error(gs_error_stackunderflow); op -= r_size(&narray) - 1; for (i=0;i < r_size(&narray); i++) { if (!r_has_type(op, t_integer) && !r_has_type(op, t_real)) return_error(gs_error_typecheck); if (values[i] > 1.0) values[i] = 1.0; if (values[i] < 0.0) values[i] = 0.0; op++; } return 0; } ",0 "P2PQuicStreamImpl* P2PQuicTransportImpl::CreateStream() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); return CreateOutgoingBidirectionalStream(); } ",0 "DownloadItemImpl::RequestInfo::RequestInfo(const GURL& url) : url_chain(std::vector(1, url)), start_time(base::Time::Now()) {} ",0 "void NavigationRequest::ResetForCrossDocumentRestart() { DCHECK( FrameMsg_Navigate_Type::IsSameDocument(common_params_.navigation_type)); DCHECK(!loader_); navigation_handle_.reset(); if (common_params_.navigation_type == FrameMsg_Navigate_Type::HISTORY_SAME_DOCUMENT) { common_params_.navigation_type = FrameMsg_Navigate_Type::HISTORY_DIFFERENT_DOCUMENT; } else { DCHECK(common_params_.navigation_type == FrameMsg_Navigate_Type::SAME_DOCUMENT); common_params_.navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; } state_ = NOT_STARTED; } ",0 "static void usage(char *progname) { printf(""Usage:\n""); printf(""%s x x "", progname); printf("" []\n""); } ",1 "status_t OggSource::read( MediaBuffer **out, const ReadOptions *options) { *out = NULL; int64_t seekTimeUs; ReadOptions::SeekMode mode; if (options && options->getSeekTo(&seekTimeUs, &mode)) { status_t err = mExtractor->mImpl->seekToTime(seekTimeUs); if (err != OK) { return err; } } MediaBuffer *packet; status_t err = mExtractor->mImpl->readNextPacket(&packet); if (err != OK) { return err; } #if 0 int64_t timeUs; if (packet->meta_data()->findInt64(kKeyTime, &timeUs)) { ALOGI(""found time = %lld us"", timeUs); } else { ALOGI(""NO time""); } #endif packet->meta_data()->setInt32(kKeyIsSyncFrame, 1); *out = packet; return OK; } ",0 "std::string MockRenderThread::GetLocale() { return std::string(); } ",0 "int apply_filters_to_response(struct session *s, struct channel *rtr, struct proxy *px) { struct http_txn *txn = &s->txn; struct hdr_exp *exp; for (exp = px->rsp_exp; exp; exp = exp->next) { int ret; /* * The interleaving of transformations and verdicts * makes it difficult to decide to continue or stop * the evaluation. */ if (txn->flags & TX_SVDENY) break; if ((txn->flags & TX_SVALLOW) && (exp->action == ACT_ALLOW || exp->action == ACT_DENY || exp->action == ACT_PASS)) { exp = exp->next; continue; } /* if this filter had a condition, evaluate it now and skip to * next filter if the condition does not match. */ if (exp->cond) { ret = acl_exec_cond(exp->cond, px, s, txn, SMP_OPT_DIR_RES|SMP_OPT_FINAL); ret = acl_pass(ret); if (((struct acl_cond *)exp->cond)->pol == ACL_COND_UNLESS) ret = !ret; if (!ret) continue; } /* Apply the filter to the status line. */ ret = apply_filter_to_sts_line(s, rtr, exp); if (unlikely(ret < 0)) return -1; if (likely(ret == 0)) { /* The filter did not match the response, it can be * iterated through all headers. */ if (unlikely(apply_filter_to_resp_headers(s, rtr, exp) < 0)) return -1; } } return 0; } ",0 "asn1_expand_octet_string (asn1_node definitions, asn1_node * element, const char *octetName, const char *objectName) { char name[2 * ASN1_MAX_NAME_SIZE + 1], value[ASN1_MAX_NAME_SIZE]; int retCode = ASN1_SUCCESS, result; int len, len2, len3; asn1_node p2, aux = NULL; asn1_node octetNode = NULL, objectNode = NULL; char errorDescription[ASN1_MAX_ERROR_DESCRIPTION_SIZE]; if ((definitions == NULL) || (*element == NULL)) return ASN1_ELEMENT_NOT_FOUND; octetNode = asn1_find_node (*element, octetName); if (octetNode == NULL) return ASN1_ELEMENT_NOT_FOUND; if (type_field (octetNode->type) != ASN1_ETYPE_OCTET_STRING) return ASN1_ELEMENT_NOT_FOUND; if (octetNode->value == NULL) return ASN1_VALUE_NOT_FOUND; objectNode = asn1_find_node (*element, objectName); if (objectNode == NULL) return ASN1_ELEMENT_NOT_FOUND; if (type_field (objectNode->type) != ASN1_ETYPE_OBJECT_ID) return ASN1_ELEMENT_NOT_FOUND; if (objectNode->value == NULL) return ASN1_VALUE_NOT_FOUND; /* search the OBJECT_ID into definitions */ p2 = definitions->down; while (p2) { if ((type_field (p2->type) == ASN1_ETYPE_OBJECT_ID) && (p2->type & CONST_ASSIGN)) { strcpy (name, definitions->name); strcat (name, "".""); strcat (name, p2->name); len = sizeof (value); result = asn1_read_value (definitions, name, value, &len); if ((result == ASN1_SUCCESS) && (!_asn1_strcmp (objectNode->value, value))) { p2 = p2->right; /* pointer to the structure to use for expansion */ while ((p2) && (p2->type & CONST_ASSIGN)) p2 = p2->right; if (p2) { strcpy (name, definitions->name); strcat (name, "".""); strcat (name, p2->name); result = asn1_create_element (definitions, name, &aux); if (result == ASN1_SUCCESS) { _asn1_cpy_name (aux, octetNode); len2 = asn1_get_length_der (octetNode->value, octetNode->value_len, &len3); if (len2 < 0) return ASN1_DER_ERROR; result = asn1_der_decoding (&aux, octetNode->value + len3, len2, errorDescription); if (result == ASN1_SUCCESS) { _asn1_set_right (aux, octetNode->right); _asn1_set_right (octetNode, aux); result = asn1_delete_structure (&octetNode); if (result == ASN1_SUCCESS) { aux = NULL; break; } else { /* error with asn1_delete_structure */ asn1_delete_structure (&aux); retCode = result; break; } } else { /* error with asn1_der_decoding */ retCode = result; break; } } else { /* error with asn1_create_element */ retCode = result; break; } } else { /* error with the pointer to the structure to exapand */ retCode = ASN1_VALUE_NOT_VALID; break; } } } p2 = p2->right; } if (!p2) retCode = ASN1_VALUE_NOT_VALID; return retCode; } ",0 "static uint64_t cirrus_linear_bitblt_read(void *opaque, hwaddr addr, unsigned size) { CirrusVGAState *s = opaque; uint32_t ret; /* XXX handle bitblt */ (void)s; ret = 0xff; return ret; } ",0 "static void vmw_hw_surface_destroy(struct vmw_resource *res) { struct vmw_private *dev_priv = res->dev_priv; struct vmw_surface *srf; void *cmd; if (res->func->destroy == vmw_gb_surface_destroy) { (void) vmw_gb_surface_destroy(res); return; } if (res->id != -1) { cmd = vmw_fifo_reserve(dev_priv, vmw_surface_destroy_size()); if (unlikely(!cmd)) { DRM_ERROR(""Failed reserving FIFO space for surface "" ""destruction.\n""); return; } vmw_surface_destroy_encode(res->id, cmd); vmw_fifo_commit(dev_priv, vmw_surface_destroy_size()); /* * used_memory_size_atomic, or separate lock * to avoid taking dev_priv::cmdbuf_mutex in * the destroy path. */ mutex_lock(&dev_priv->cmdbuf_mutex); srf = vmw_res_to_srf(res); dev_priv->used_memory_size -= res->backup_size; mutex_unlock(&dev_priv->cmdbuf_mutex); } vmw_fifo_resource_dec(dev_priv); } ",0 "static void ByteStringAttributeAttributeSetter( v8::Local v8_value, const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(isolate, ExceptionState::kSetterContext, ""TestObject"", ""byteStringAttribute""); V8StringResource<> cpp_value = NativeValueTraits::NativeValue(info.GetIsolate(), v8_value, exception_state); if (exception_state.HadException()) return; impl->setByteStringAttribute(cpp_value); } ",0 "void streamNextID(streamID *last_id, streamID *new_id) { uint64_t ms = mstime(); if (ms > last_id->ms) { new_id->ms = ms; new_id->seq = 0; } else { new_id->ms = last_id->ms; new_id->seq = last_id->seq+1; } } ",0 "void HeadlessWebContentsImpl::RemoveObserver(Observer* observer) { observers_.RemoveObserver(observer); } ",0 "struct net_device *netdev_master_upper_dev_get(struct net_device *dev) { struct netdev_adjacent *upper; ASSERT_RTNL(); if (list_empty(&dev->adj_list.upper)) return NULL; upper = list_first_entry(&dev->adj_list.upper, struct netdev_adjacent, list); if (likely(upper->master)) return upper->dev; return NULL; } ",0 "GF_Box *dac3_New() { ISOM_DECL_BOX_ALLOC(GF_AC3ConfigBox, GF_ISOM_BOX_TYPE_DAC3); return (GF_Box *)tmp; } ",0 "fst_open(struct net_device *dev) { int err; struct fst_port_info *port; port = dev_to_port(dev); if (!try_module_get(THIS_MODULE)) return -EBUSY; if (port->mode != FST_RAW) { err = hdlc_open(dev); if (err) { module_put(THIS_MODULE); return err; } } fst_openport(port); netif_wake_queue(dev); return 0; } ",0 "void V8TestObject::TestObjectAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_testObjectAttribute_Getter""); test_object_v8_internal::TestObjectAttributeAttributeGetter(info); } ",0 "WebString BlinkTestRunner::GetAbsoluteWebStringFromUTF8Path( const std::string& utf8_path) { base::FilePath path = base::FilePath::FromUTF8Unsafe(utf8_path); if (!path.IsAbsolute()) { GURL base_url = net::FilePathToFileURL(test_config_.current_working_directory.Append( FILE_PATH_LITERAL(""foo""))); net::FileURLToFilePath(base_url.Resolve(utf8_path), &path); } return path.AsUTF16Unsafe(); } ",0 "check_mandatory_fields (DBusHeader *header) { #define REQUIRE_FIELD(name) do { if (header->fields[DBUS_HEADER_FIELD_##name].value_pos < 0) return DBUS_INVALID_MISSING_##name; } while (0) switch (_dbus_header_get_message_type (header)) { case DBUS_MESSAGE_TYPE_SIGNAL: REQUIRE_FIELD (INTERFACE); /* FALL THRU - signals also require the path and member */ case DBUS_MESSAGE_TYPE_METHOD_CALL: REQUIRE_FIELD (PATH); REQUIRE_FIELD (MEMBER); break; case DBUS_MESSAGE_TYPE_ERROR: REQUIRE_FIELD (ERROR_NAME); REQUIRE_FIELD (REPLY_SERIAL); break; case DBUS_MESSAGE_TYPE_METHOD_RETURN: REQUIRE_FIELD (REPLY_SERIAL); break; default: /* other message types allowed but ignored */ break; } return DBUS_VALID; } ",0 "GLenum GLES2DecoderImpl::DoCheckFramebufferStatus(GLenum target) { Framebuffer* framebuffer = GetFramebufferInfoForTarget(target); if (!framebuffer) { return GL_FRAMEBUFFER_COMPLETE; } GLenum completeness = framebuffer->IsPossiblyComplete(feature_info_.get()); if (completeness != GL_FRAMEBUFFER_COMPLETE) { return completeness; } return framebuffer->GetStatus(texture_manager(), target); } ",0 "static void sparc_pmu_stop(struct perf_event *event, int flags) { struct cpu_hw_events *cpuc = &__get_cpu_var(cpu_hw_events); int idx = active_event_index(cpuc, event); if (!(event->hw.state & PERF_HES_STOPPED)) { sparc_pmu_disable_event(cpuc, &event->hw, idx); event->hw.state |= PERF_HES_STOPPED; } if (!(event->hw.state & PERF_HES_UPTODATE) && (flags & PERF_EF_UPDATE)) { sparc_perf_event_update(event, &event->hw, idx); event->hw.state |= PERF_HES_UPTODATE; } } ",0 "static struct buffer_head * ext4_find_entry (struct inode *dir, const struct qstr *d_name, struct ext4_dir_entry_2 **res_dir, int *inlined) { struct super_block *sb; struct buffer_head *bh_use[NAMEI_RA_SIZE]; struct buffer_head *bh, *ret = NULL; ext4_lblk_t start, block, b; const u8 *name = d_name->name; int ra_max = 0; /* Number of bh's in the readahead buffer, bh_use[] */ int ra_ptr = 0; /* Current index into readahead buffer */ int num = 0; ext4_lblk_t nblocks; int i, err; int namelen; *res_dir = NULL; sb = dir->i_sb; namelen = d_name->len; if (namelen > EXT4_NAME_LEN) return NULL; if (ext4_has_inline_data(dir)) { int has_inline_data = 1; ret = ext4_find_inline_entry(dir, d_name, res_dir, &has_inline_data); if (has_inline_data) { if (inlined) *inlined = 1; return ret; } } if ((namelen <= 2) && (name[0] == '.') && (name[1] == '.' || name[1] == '\0')) { /* * ""."" or "".."" will only be in the first block * NFS may look up ""..""; ""."" should be handled by the VFS */ block = start = 0; nblocks = 1; goto restart; } if (is_dx(dir)) { bh = ext4_dx_find_entry(dir, d_name, res_dir, &err); /* * On success, or if the error was file not found, * return. Otherwise, fall back to doing a search the * old fashioned way. */ if (bh || (err != ERR_BAD_DX_DIR)) return bh; dxtrace(printk(KERN_DEBUG ""ext4_find_entry: dx failed, "" ""falling back\n"")); } nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb); start = EXT4_I(dir)->i_dir_start_lookup; if (start >= nblocks) start = 0; block = start; restart: do { /* * We deal with the read-ahead logic here. */ if (ra_ptr >= ra_max) { /* Refill the readahead buffer */ ra_ptr = 0; b = block; for (ra_max = 0; ra_max < NAMEI_RA_SIZE; ra_max++) { /* * Terminate if we reach the end of the * directory and must wrap, or if our * search has finished at this block. */ if (b >= nblocks || (num && block == start)) { bh_use[ra_max] = NULL; break; } num++; bh = ext4_getblk(NULL, dir, b++, 0, &err); bh_use[ra_max] = bh; if (bh) ll_rw_block(READ | REQ_META | REQ_PRIO, 1, &bh); } } if ((bh = bh_use[ra_ptr++]) == NULL) goto next; wait_on_buffer(bh); if (!buffer_uptodate(bh)) { /* read error, skip block & hope for the best */ EXT4_ERROR_INODE(dir, ""reading directory lblock %lu"", (unsigned long) block); brelse(bh); goto next; } if (!buffer_verified(bh) && !is_dx_internal_node(dir, block, (struct ext4_dir_entry *)bh->b_data) && !ext4_dirent_csum_verify(dir, (struct ext4_dir_entry *)bh->b_data)) { EXT4_ERROR_INODE(dir, ""checksumming directory "" ""block %lu"", (unsigned long)block); brelse(bh); goto next; } set_buffer_verified(bh); i = search_dirblock(bh, dir, d_name, block << EXT4_BLOCK_SIZE_BITS(sb), res_dir); if (i == 1) { EXT4_I(dir)->i_dir_start_lookup = block; ret = bh; goto cleanup_and_exit; } else { brelse(bh); if (i < 0) goto cleanup_and_exit; } next: if (++block >= nblocks) block = 0; } while (block != start); /* * If the directory has grown while we were searching, then * search the last part of the directory before giving up. */ block = nblocks; nblocks = dir->i_size >> EXT4_BLOCK_SIZE_BITS(sb); if (block < nblocks) { start = 0; goto restart; } cleanup_and_exit: /* Clean up the read-ahead blocks */ for (; ra_ptr < ra_max; ra_ptr++) brelse(bh_use[ra_ptr]); return ret; } ",0 "xmlParseChunk(xmlParserCtxtPtr ctxt, const char *chunk, int size, int terminate) { int end_in_lf = 0; int remain = 0; size_t old_avail = 0; size_t avail = 0; if (ctxt == NULL) return(XML_ERR_INTERNAL_ERROR); if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1)) return(ctxt->errNo); if (ctxt->instate == XML_PARSER_EOF) return(-1); if (ctxt->instate == XML_PARSER_START) xmlDetectSAX2(ctxt); if ((size > 0) && (chunk != NULL) && (!terminate) && (chunk[size - 1] == '\r')) { end_in_lf = 1; size--; } xmldecl_done: if ((size > 0) && (chunk != NULL) && (ctxt->input != NULL) && (ctxt->input->buf != NULL) && (ctxt->instate != XML_PARSER_EOF)) { size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input); size_t cur = ctxt->input->cur - ctxt->input->base; int res; old_avail = xmlBufUse(ctxt->input->buf->buffer); /* * Specific handling if we autodetected an encoding, we should not * push more than the first line ... which depend on the encoding * And only push the rest once the final encoding was detected */ if ((ctxt->instate == XML_PARSER_START) && (ctxt->input != NULL) && (ctxt->input->buf != NULL) && (ctxt->input->buf->encoder != NULL)) { unsigned int len = 45; if ((xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name, BAD_CAST ""UTF-16"")) || (xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name, BAD_CAST ""UTF16""))) len = 90; else if ((xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name, BAD_CAST ""UCS-4"")) || (xmlStrcasestr(BAD_CAST ctxt->input->buf->encoder->name, BAD_CAST ""UCS4""))) len = 180; if (ctxt->input->buf->rawconsumed < len) len -= ctxt->input->buf->rawconsumed; /* * Change size for reading the initial declaration only * if size is greater than len. Otherwise, memmove in xmlBufferAdd * will blindly copy extra bytes from memory. */ if ((unsigned int) size > len) { remain = size - len; size = len; } else { remain = 0; } } res = xmlParserInputBufferPush(ctxt->input->buf, size, chunk); if (res < 0) { ctxt->errNo = XML_PARSER_EOF; xmlHaltParser(ctxt); return (XML_PARSER_EOF); } xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, cur); #ifdef DEBUG_PUSH xmlGenericError(xmlGenericErrorContext, ""PP: pushed %d\n"", size); #endif } else if (ctxt->instate != XML_PARSER_EOF) { if ((ctxt->input != NULL) && ctxt->input->buf != NULL) { xmlParserInputBufferPtr in = ctxt->input->buf; if ((in->encoder != NULL) && (in->buffer != NULL) && (in->raw != NULL)) { int nbchars; size_t base = xmlBufGetInputBase(in->buffer, ctxt->input); size_t current = ctxt->input->cur - ctxt->input->base; nbchars = xmlCharEncInput(in, terminate); if (nbchars < 0) { /* TODO 2.6.0 */ xmlGenericError(xmlGenericErrorContext, ""xmlParseChunk: encoder error\n""); return(XML_ERR_INVALID_ENCODING); } xmlBufSetInputBaseCur(in->buffer, ctxt->input, base, current); } } } if (remain != 0) { xmlParseTryOrFinish(ctxt, 0); } else { if ((ctxt->input != NULL) && (ctxt->input->buf != NULL)) avail = xmlBufUse(ctxt->input->buf->buffer); /* * Depending on the current state it may not be such * a good idea to try parsing if there is nothing in the chunk * which would be worth doing a parser state transition and we * need to wait for more data */ if ((terminate) || (avail > XML_MAX_TEXT_LENGTH) || (old_avail == 0) || (avail == 0) || (xmlParseCheckTransition(ctxt, (const char *)&ctxt->input->base[old_avail], avail - old_avail))) xmlParseTryOrFinish(ctxt, terminate); } if (ctxt->instate == XML_PARSER_EOF) return(ctxt->errNo); if ((ctxt->input != NULL) && (((ctxt->input->end - ctxt->input->cur) > XML_MAX_LOOKUP_LIMIT) || ((ctxt->input->cur - ctxt->input->base) > XML_MAX_LOOKUP_LIMIT)) && ((ctxt->options & XML_PARSE_HUGE) == 0)) { xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, ""Huge input lookup""); xmlHaltParser(ctxt); } if ((ctxt->errNo != XML_ERR_OK) && (ctxt->disableSAX == 1)) return(ctxt->errNo); if (remain != 0) { chunk += size; size = remain; remain = 0; goto xmldecl_done; } if ((end_in_lf == 1) && (ctxt->input != NULL) && (ctxt->input->buf != NULL)) { size_t base = xmlBufGetInputBase(ctxt->input->buf->buffer, ctxt->input); size_t current = ctxt->input->cur - ctxt->input->base; xmlParserInputBufferPush(ctxt->input->buf, 1, ""\r""); xmlBufSetInputBaseCur(ctxt->input->buf->buffer, ctxt->input, base, current); } if (terminate) { /* * Check for termination */ int cur_avail = 0; if (ctxt->input != NULL) { if (ctxt->input->buf == NULL) cur_avail = ctxt->input->length - (ctxt->input->cur - ctxt->input->base); else cur_avail = xmlBufUse(ctxt->input->buf->buffer) - (ctxt->input->cur - ctxt->input->base); } if ((ctxt->instate != XML_PARSER_EOF) && (ctxt->instate != XML_PARSER_EPILOG)) { xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); } if ((ctxt->instate == XML_PARSER_EPILOG) && (cur_avail > 0)) { xmlFatalErr(ctxt, XML_ERR_DOCUMENT_END, NULL); } if (ctxt->instate != XML_PARSER_EOF) { if ((ctxt->sax) && (ctxt->sax->endDocument != NULL)) ctxt->sax->endDocument(ctxt->userData); } ctxt->instate = XML_PARSER_EOF; } if (ctxt->wellFormed == 0) return((xmlParserErrors) ctxt->errNo); else return(0); } ",0 "static void virtcons_remove(struct virtio_device *vdev) { struct ports_device *portdev; struct port *port, *port2; portdev = vdev->priv; spin_lock_irq(&pdrvdata_lock); list_del(&portdev->list); spin_unlock_irq(&pdrvdata_lock); /* Disable interrupts for vqs */ vdev->config->reset(vdev); /* Finish up work that's lined up */ if (use_multiport(portdev)) cancel_work_sync(&portdev->control_work); else cancel_work_sync(&portdev->config_work); list_for_each_entry_safe(port, port2, &portdev->ports, list) unplug_port(port); unregister_chrdev(portdev->chr_major, ""virtio-portsdev""); /* * When yanking out a device, we immediately lose the * (device-side) queues. So there's no point in keeping the * guest side around till we drop our final reference. This * also means that any ports which are in an open state will * have to just stop using the port, as the vqs are going * away. */ remove_controlq_data(portdev); remove_vqs(portdev); kfree(portdev); } ",0 " InitializeTemporaryOriginsInfoTask( QuotaManager* manager, UsageTracker* temporary_usage_tracker) : DatabaseTaskBase(manager), has_registered_origins_(false) { DCHECK(temporary_usage_tracker); temporary_usage_tracker->GetCachedOrigins(&origins_); } ",0 "static void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags) { unsigned long old_rflags = vmx_get_rflags(vcpu); __set_bit(VCPU_EXREG_RFLAGS, (ulong *)&vcpu->arch.regs_avail); to_vmx(vcpu)->rflags = rflags; if (to_vmx(vcpu)->rmode.vm86_active) { to_vmx(vcpu)->rmode.save_rflags = rflags; rflags |= X86_EFLAGS_IOPL | X86_EFLAGS_VM; } vmcs_writel(GUEST_RFLAGS, rflags); if ((old_rflags ^ to_vmx(vcpu)->rflags) & X86_EFLAGS_VM) to_vmx(vcpu)->emulation_required = emulation_required(vcpu); } ",0 "void faad_endbits(bitfile *ld) { } ",0 "static void callWithExecutionContextVoidMethodMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()); imp->callWithExecutionContextVoidMethod(scriptContext); } ",0 "string16 BuildString16(const wchar_t* s) { #if defined(WCHAR_T_IS_UTF16) return string16(s); #elif defined(WCHAR_T_IS_UTF32) string16 u16; while (*s != 0) { DCHECK_LE(static_cast(*s), 0xFFFFu); u16.push_back(*s++); } return u16; #endif } ",0 "vmci_transport_reply_control_pkt_fast(struct vmci_transport_packet *pkt, enum vmci_transport_packet_type type, u64 size, u64 mode, struct vmci_transport_waiting_info *wait, struct vmci_handle handle) { struct vmci_transport_packet reply; struct sockaddr_vm src, dst; if (pkt->type == VMCI_TRANSPORT_PACKET_TYPE_RST) { return 0; } else { vmci_transport_packet_get_addresses(pkt, &src, &dst); return __vmci_transport_send_control_pkt(&reply, &src, &dst, type, size, mode, wait, VSOCK_PROTO_INVALID, handle, true); } } ",0 "HTMLMediaElement::NetworkState HTMLMediaElement::getNetworkState() const { return network_state_; } ",0 "bool JPEGImageDecoder::outputScanlines(ImageFrame& buffer) { return m_scaled ? outputScanlines(buffer) : outputScanlines(buffer); } ",0 "SAPI_API int sapi_register_treat_data(void (*treat_data)(int arg, char *str, zval *destArray TSRMLS_DC) TSRMLS_DC) { if (SG(sapi_started) && EG(in_execution)) { return FAILURE; } sapi_module.treat_data = treat_data; return SUCCESS; } ",0 "void ib_uverbs_release_file(struct kref *ref) { struct ib_uverbs_file *file = container_of(ref, struct ib_uverbs_file, ref); struct ib_device *ib_dev; int srcu_key; release_ufile_idr_uobject(file); srcu_key = srcu_read_lock(&file->device->disassociate_srcu); ib_dev = srcu_dereference(file->device->ib_dev, &file->device->disassociate_srcu); if (ib_dev && !ib_dev->ops.disassociate_ucontext) module_put(ib_dev->owner); srcu_read_unlock(&file->device->disassociate_srcu, srcu_key); if (atomic_dec_and_test(&file->device->refcount)) ib_uverbs_comp_dev(file->device); if (file->async_file) kref_put(&file->async_file->ref, ib_uverbs_release_async_event_file); put_device(&file->device->dev); kfree(file); } ",0 "void WebContentsImpl::DidStartProvisionalLoad( RenderFrameHostImpl* render_frame_host, const GURL& validated_url, bool is_error_page, bool is_iframe_srcdoc) { FOR_EACH_OBSERVER( WebContentsObserver, observers_, DidStartProvisionalLoadForFrame( render_frame_host, validated_url, is_error_page, is_iframe_srcdoc)); NavigationEntry* entry = controller_.GetVisibleEntry(); if (entry && ui::PageTransitionCoreTypeIs( entry->GetTransitionType(), ui::PAGE_TRANSITION_RELOAD)) { FrameTreeNode* ftn = render_frame_host->frame_tree_node(); BrowserAccessibilityManager* manager = ftn->current_frame_host()->browser_accessibility_manager(); if (manager) manager->UserIsReloading(); } } ",0 "static int key_notify_policy(struct xfrm_policy *xp, int dir, const struct km_event *c) { struct sk_buff *out_skb; struct sadb_msg *out_hdr; int err; out_skb = pfkey_xfrm_policy2msg_prep(xp); if (IS_ERR(out_skb)) return PTR_ERR(out_skb); err = pfkey_xfrm_policy2msg(out_skb, xp, dir); if (err < 0) return err; out_hdr = (struct sadb_msg *) out_skb->data; out_hdr->sadb_msg_version = PF_KEY_V2; if (c->data.byid && c->event == XFRM_MSG_DELPOLICY) out_hdr->sadb_msg_type = SADB_X_SPDDELETE2; else out_hdr->sadb_msg_type = event2poltype(c->event); out_hdr->sadb_msg_errno = 0; out_hdr->sadb_msg_seq = c->seq; out_hdr->sadb_msg_pid = c->portid; pfkey_broadcast(out_skb, GFP_ATOMIC, BROADCAST_ALL, NULL, xp_net(xp)); return 0; } ",0 "void WebGLRenderingContextBase::texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, ImageData* pixels) { TexImageHelperImageData(kTexSubImage2D, target, level, 0, 0, format, type, 1, xoffset, yoffset, 0, pixels, GetImageDataSize(pixels), 0); } ",0 "PermissionsData::GetPermissionMessageDetailsStrings() const { if (ShouldSkipPermissionWarnings(extension_id_)) return std::vector(); return PermissionMessageProvider::Get()->GetWarningMessagesDetails( active_permissions(), manifest_type_); } ",0 "PHPAPI php_stream *_php_stream_temp_open(int mode, size_t max_memory_usage, char *buf, size_t length STREAMS_DC TSRMLS_DC) { php_stream *stream; php_stream_temp_data *ts; off_t newoffs; if ((stream = php_stream_temp_create_rel(mode, max_memory_usage)) != NULL) { if (length) { assert(buf != NULL); php_stream_temp_write(stream, buf, length TSRMLS_CC); php_stream_temp_seek(stream, 0, SEEK_SET, &newoffs TSRMLS_CC); } ts = (php_stream_temp_data*)stream->abstract; assert(ts != NULL); ts->mode = mode; } return stream; } ",0 "static ZIPARCHIVE_METHOD(setExternalAttributesIndex) { struct zip *intern; zval *self = getThis(); zend_long index, flags=0, opsys, attr; struct zip_stat sb; if (!self) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, self); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""lll|l"", &index, &opsys, &attr, &flags) == FAILURE) { return; } PHP_ZIP_STAT_INDEX(intern, index, 0, sb); if (zip_file_set_external_attributes(intern, (zip_uint64_t)index, (zip_flags_t)flags, (zip_uint8_t)(opsys&0xff), (zip_uint32_t)attr) < 0) { RETURN_FALSE; } RETURN_TRUE; } ",0 "static void virgl_cmd_transfer_to_host_2d(VirtIOGPU *g, struct virtio_gpu_ctrl_command *cmd) { struct virtio_gpu_transfer_to_host_2d t2d; struct virtio_gpu_box box; VIRTIO_GPU_FILL_CMD(t2d); trace_virtio_gpu_cmd_res_xfer_toh_2d(t2d.resource_id); box.x = t2d.r.x; box.y = t2d.r.y; box.z = 0; box.w = t2d.r.width; box.h = t2d.r.height; box.d = 1; virgl_renderer_transfer_write_iov(t2d.resource_id, 0, 0, 0, 0, (struct virgl_box *)&box, t2d.offset, NULL, 0); } ",0 "static void voidMethodDoubleArgMethod(const v8::FunctionCallbackInfo& info) { if (UNLIKELY(info.Length() < 1)) { throwTypeError(ExceptionMessages::failedToExecute(""voidMethodDoubleArg"", ""TestObjectPython"", ExceptionMessages::notEnoughArguments(1, info.Length())), info.GetIsolate()); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(double, doubleArg, static_cast(info[0]->NumberValue())); imp->voidMethodDoubleArg(doubleArg); } ",0 "check_decryption_preparation (RIJNDAEL_context *ctx) { if ( !ctx->decryption_prepared ) { prepare_decryption ( ctx ); ctx->decryption_prepared = 1; } } ",0 "parse_CLONE(char *arg, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols) { const size_t clone_offset = ofpacts_pull(ofpacts); struct ofpact_nest *clone = ofpact_put_CLONE(ofpacts); char *error; ofpbuf_pull(ofpacts, sizeof *clone); error = ofpacts_parse_copy(arg, ofpacts, usable_protocols, false, 0); /* header points to the action list */ ofpacts->header = ofpbuf_push_uninit(ofpacts, sizeof *clone); clone = ofpacts->header; ofpact_finish_CLONE(ofpacts, &clone); ofpbuf_push_uninit(ofpacts, clone_offset); return error; } ",0 "void zgfx_context_free(ZGFX_CONTEXT* zgfx) { free(zgfx); } ",0 "static int hugetlb_sysfs_add_hstate(struct hstate *h, struct kobject *parent, struct kobject **hstate_kobjs, struct attribute_group *hstate_attr_group) { int retval; int hi = h - hstates; hstate_kobjs[hi] = kobject_create_and_add(h->name, parent); if (!hstate_kobjs[hi]) return -ENOMEM; retval = sysfs_create_group(hstate_kobjs[hi], hstate_attr_group); if (retval) kobject_put(hstate_kobjs[hi]); return retval; } ",0 "void register_sysctl_root(struct ctl_table_root *root) { spin_lock(&sysctl_lock); list_add_tail(&root->root_list, &sysctl_table_root.root_list); spin_unlock(&sysctl_lock); } ",0 "static void php_wddx_serialize_array(wddx_packet *packet, zval *arr) { zval *ent; zend_string *key; int is_struct = 0; zend_ulong idx; HashTable *target_hash; char tmp_buf[WDDX_BUF_LEN]; zend_ulong ind = 0; target_hash = Z_ARRVAL_P(arr); ZEND_HASH_FOREACH_KEY(target_hash, idx, key) { if (key) { is_struct = 1; break; } if (idx != ind) { is_struct = 1; break; } ind++; } ZEND_HASH_FOREACH_END(); if (is_struct) { php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); } else { snprintf(tmp_buf, sizeof(tmp_buf), WDDX_ARRAY_S, zend_hash_num_elements(target_hash)); php_wddx_add_chunk(packet, tmp_buf); } ZEND_HASH_FOREACH_KEY_VAL(target_hash, idx, key, ent) { if (ent == arr) { continue; } if (is_struct) { if (key) { php_wddx_serialize_var(packet, ent, key); } else { key = zend_long_to_str(idx); php_wddx_serialize_var(packet, ent, key); zend_string_release(key); } } else { php_wddx_serialize_var(packet, ent, NULL); } } ZEND_HASH_FOREACH_END(); if (is_struct) { php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); } else { php_wddx_add_chunk_static(packet, WDDX_ARRAY_E); } } ",0 "static int hub_suspend(struct usb_interface *intf, pm_message_t msg) { struct usb_hub *hub = usb_get_intfdata(intf); struct usb_device *hdev = hub->hdev; unsigned port1; int status; /* * Warn if children aren't already suspended. * Also, add up the number of wakeup-enabled descendants. */ hub->wakeup_enabled_descendants = 0; for (port1 = 1; port1 <= hdev->maxchild; port1++) { struct usb_port *port_dev = hub->ports[port1 - 1]; struct usb_device *udev = port_dev->child; if (udev && udev->can_submit) { dev_warn(&port_dev->dev, ""device %s not suspended yet\n"", dev_name(&udev->dev)); if (PMSG_IS_AUTO(msg)) return -EBUSY; } if (udev) hub->wakeup_enabled_descendants += wakeup_enabled_descendants(udev); } if (hdev->do_remote_wakeup && hub->quirk_check_port_auto_suspend) { /* check if there are changes pending on hub ports */ if (check_ports_changed(hub)) { if (PMSG_IS_AUTO(msg)) return -EBUSY; pm_wakeup_event(&hdev->dev, 2000); } } if (hub_is_superspeed(hdev) && hdev->do_remote_wakeup) { /* Enable hub to send remote wakeup for all ports. */ for (port1 = 1; port1 <= hdev->maxchild; port1++) { status = set_port_feature(hdev, port1 | USB_PORT_FEAT_REMOTE_WAKE_CONNECT | USB_PORT_FEAT_REMOTE_WAKE_DISCONNECT | USB_PORT_FEAT_REMOTE_WAKE_OVER_CURRENT, USB_PORT_FEAT_REMOTE_WAKE_MASK); } } dev_dbg(&intf->dev, ""%s\n"", __func__); /* stop hub_wq and related activity */ hub_quiesce(hub, HUB_SUSPEND); return 0; } ",0 " TestMultiBufferDataProvider* GetProvider() { EXPECT_EQ(test_data_providers.size(), 1U); if (test_data_providers.size() != 1) return nullptr; return *test_data_providers.begin(); } ",0 "Document* HTMLFrameOwnerElement::contentDocument() const { return (content_frame_ && content_frame_->IsLocalFrame()) ? ToLocalFrame(content_frame_)->GetDocument() : nullptr; } ",0 " HeadlessDevToolsClientFullscreenWindowTest() : HeadlessDevToolsClientChangeWindowStateTest( browser::WindowState::FULLSCREEN){}; ",0 "cl_hash(register count_int chsize, GifCtx *ctx) /* reset code table */ { register count_int *htab_p = ctx->htab+chsize; register long i; register long m1 = -1; i = chsize - 16; do { /* might use Sys V memset(3) here */ *(htab_p-16) = m1; *(htab_p-15) = m1; *(htab_p-14) = m1; *(htab_p-13) = m1; *(htab_p-12) = m1; *(htab_p-11) = m1; *(htab_p-10) = m1; *(htab_p-9) = m1; *(htab_p-8) = m1; *(htab_p-7) = m1; *(htab_p-6) = m1; *(htab_p-5) = m1; *(htab_p-4) = m1; *(htab_p-3) = m1; *(htab_p-2) = m1; *(htab_p-1) = m1; htab_p -= 16; } while ((i -= 16) >= 0); for ( i += 16; i > 0; --i ) *--htab_p = m1; } ",0 "GLSurfaceOzoneSurfacelessSurfaceImpl::GLSurfaceOzoneSurfacelessSurfaceImpl( std::unique_ptr ozone_surface, AcceleratedWidget widget) : GLSurfaceOzoneSurfaceless(std::move(ozone_surface), widget), context_(nullptr), fbo_(0), current_surface_(0) { for (auto& texture : textures_) texture = 0; } ",0 "int CMS_decrypt_set1_pkey(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert) { STACK_OF(CMS_RecipientInfo) *ris; CMS_RecipientInfo *ri; int i, r, ri_type; int debug = 0; ris = CMS_get0_RecipientInfos(cms); if (ris) debug = cms->d.envelopedData->encryptedContentInfo->debug; ri_type = cms_pkey_get_ri_type(pk); if (ri_type == CMS_RECIPINFO_NONE) { CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY, CMS_R_NOT_SUPPORTED_FOR_THIS_KEY_TYPE); return 0; } for (i = 0; i < sk_CMS_RecipientInfo_num(ris); i++) { ri = sk_CMS_RecipientInfo_value(ris, i); if (CMS_RecipientInfo_type(ri) != ri_type) continue; if (ri_type == CMS_RECIPINFO_AGREE) { r = cms_kari_set1_pkey(cms, ri, pk, cert); if (r > 0) return 1; if (r < 0) return 0; } /* If we have a cert try matching RecipientInfo * otherwise try them all. */ else if (!cert || !CMS_RecipientInfo_ktri_cert_cmp(ri, cert)) { CMS_RecipientInfo_set0_pkey(ri, pk); r = CMS_RecipientInfo_decrypt(cms, ri); CMS_RecipientInfo_set0_pkey(ri, NULL); if (cert) { /* If not debugging clear any error and * return success to avoid leaking of * information useful to MMA */ if (!debug) { ERR_clear_error(); return 1; } if (r > 0) return 1; CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY, CMS_R_DECRYPT_ERROR); return 0; } /* If no cert and not debugging don't leave loop * after first successful decrypt. Always attempt * to decrypt all recipients to avoid leaking timing * of a successful decrypt. */ else if (r > 0 && debug) return 1; } } /* If no cert and not debugging always return success */ if (!cert && !debug) { ERR_clear_error(); return 1; } CMSerr(CMS_F_CMS_DECRYPT_SET1_PKEY, CMS_R_NO_MATCHING_RECIPIENT); return 0; } ",0 "const AtomicString& TextTrack::HiddenKeyword() { DEFINE_STATIC_LOCAL(const AtomicString, hidden, (""hidden"")); return hidden; } ",0 "iasecc_match_card(struct sc_card *card) { struct sc_context *ctx = card->ctx; int i; i = _sc_match_atr(card, iasecc_known_atrs, &card->type); if (i < 0) { sc_log(ctx, ""card not matched""); return 0; } sc_log(ctx, ""'%s' card matched"", iasecc_known_atrs[i].name); return 1; } ",0 "void ShelfLayoutManager::OnWindowResized() { LayoutShelf(); } ",0 "static void TraceBezier(PrimitiveInfo *primitive_info, const size_t number_coordinates) { double alpha, *coefficients, weight; PointInfo end, point, *points; register PrimitiveInfo *p; register ssize_t i, j; size_t control_points, quantum; /* Allocate coeficients. */ quantum=number_coordinates; for (i=0; i < (ssize_t) number_coordinates; i++) { for (j=i+1; j < (ssize_t) number_coordinates; j++) { alpha=fabs(primitive_info[j].point.x-primitive_info[i].point.x); if (alpha > (double) quantum) quantum=(size_t) alpha; alpha=fabs(primitive_info[j].point.y-primitive_info[i].point.y); if (alpha > (double) quantum) quantum=(size_t) alpha; } } quantum=(size_t) MagickMin((double) quantum/number_coordinates, (double) BezierQuantum); control_points=quantum*number_coordinates; coefficients=(double *) AcquireQuantumMemory((size_t) number_coordinates,sizeof(*coefficients)); points=(PointInfo *) AcquireQuantumMemory((size_t) control_points, sizeof(*points)); if ((coefficients == (double *) NULL) || (points == (PointInfo *) NULL)) ThrowFatalException(ResourceLimitFatalError,""MemoryAllocationFailed""); /* Compute bezier points. */ end=primitive_info[number_coordinates-1].point; for (i=0; i < (ssize_t) number_coordinates; i++) coefficients[i]=Permutate((ssize_t) number_coordinates-1,i); weight=0.0; for (i=0; i < (ssize_t) control_points; i++) { p=primitive_info; point.x=0.0; point.y=0.0; alpha=pow((double) (1.0-weight),(double) number_coordinates-1.0); for (j=0; j < (ssize_t) number_coordinates; j++) { point.x+=alpha*coefficients[j]*p->point.x; point.y+=alpha*coefficients[j]*p->point.y; alpha*=weight/(1.0-weight); p++; } points[i]=point; weight+=1.0/control_points; } /* Bezier curves are just short segmented polys. */ p=primitive_info; for (i=0; i < (ssize_t) control_points; i++) { TracePoint(p,points[i]); p+=p->coordinates; } TracePoint(p,end); p+=p->coordinates; primitive_info->coordinates=(size_t) (p-primitive_info); for (i=0; i < (ssize_t) primitive_info->coordinates; i++) { p->primitive=primitive_info->primitive; p--; } points=(PointInfo *) RelinquishMagickMemory(points); coefficients=(double *) RelinquishMagickMemory(coefficients); } ",0 "SYSCALL_DEFINE2(sigaltstack,const stack_t __user *,uss, stack_t __user *,uoss) { stack_t new, old; int err; if (uss && copy_from_user(&new, uss, sizeof(stack_t))) return -EFAULT; err = do_sigaltstack(uss ? &new : NULL, uoss ? &old : NULL, current_user_stack_pointer()); if (!err && uoss && copy_to_user(uoss, &old, sizeof(stack_t))) err = -EFAULT; return err; } ",0 "strndup(const char *str, size_t n) { size_t len; char *copy; for (len = 0; len < n && str[len]; len++) continue; if ((copy = malloc(len + 1)) == NULL) return NULL; (void)memcpy(copy, str, len); copy[len] = '\0'; return copy; } ",0 " SyncerPositionUpdateTest() : next_update_id_(1), next_revision_(1) {} ",0 "static int read_from_url(struct playlist *pls, struct segment *seg, uint8_t *buf, int buf_size, enum ReadFromURLMode mode) { int ret; /* limit read if the segment was only a part of a file */ if (seg->size >= 0) buf_size = FFMIN(buf_size, seg->size - pls->cur_seg_offset); if (mode == READ_COMPLETE) { ret = avio_read(pls->input, buf, buf_size); if (ret != buf_size) av_log(NULL, AV_LOG_ERROR, ""Could not read complete segment.\n""); } else ret = avio_read(pls->input, buf, buf_size); if (ret > 0) pls->cur_seg_offset += ret; return ret; } ",0 "ar6000_unavail_ev(void *context, void *hif_handle) { struct ar6_softc *ar = (struct ar6_softc *)context; /* NULL out it's entry in the global list */ ar6000_devices[ar->arDeviceIndex] = NULL; ar6000_destroy(ar->arNetDev, 1); return 0; } ",0 "static void cfundecs(JF, js_Ast *list) { while (list) { js_Ast *stm = list->a; if (stm->type == AST_FUNDEC) { emitfunction(J, F, newfun(J, stm->a, stm->b, stm->c, 0)); emitstring(J, F, OP_INITVAR, stm->a->string); } list = list->b; } } ",0 "static void track_linear(struct rev_info *revs, struct commit *commit) { if (revs->track_first_time) { revs->linear = 1; revs->track_first_time = 0; } else { struct commit_list *p; for (p = revs->previous_parents; p; p = p->next) if (p->item == NULL || /* first commit */ !oidcmp(&p->item->object.oid, &commit->object.oid)) break; revs->linear = p != NULL; } if (revs->reverse) { if (revs->linear) commit->object.flags |= TRACK_LINEAR; } free_commit_list(revs->previous_parents); revs->previous_parents = copy_commit_list(commit->parents); } ",0 "Value* ChromeNetworkDelegate::HistoricNetworkStatsInfoToValue() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); PrefService* prefs = g_browser_process->local_state(); int64 total_received = prefs->GetInt64(prefs::kHttpReceivedContentLength); int64 total_original = prefs->GetInt64(prefs::kHttpOriginalContentLength); DictionaryValue* dict = new DictionaryValue(); dict->SetString(""historic_received_content_length"", base::Int64ToString(total_received)); dict->SetString(""historic_original_content_length"", base::Int64ToString(total_original)); return dict; } ",0 "bool RenderViewImpl::didTapMultipleTargets( const WebKit::WebGestureEvent& event, const WebVector& target_rects) { gfx::Rect finger_rect( event.x - event.data.tap.width / 2, event.y - event.data.tap.height / 2, event.data.tap.width, event.data.tap.height); gfx::Rect zoom_rect; float scale = DisambiguationPopupHelper::ComputeZoomAreaAndScaleFactor( finger_rect, target_rects, GetSize(), &zoom_rect); if (!scale) return false; gfx::Size canvas_size = zoom_rect.size(); canvas_size = ToCeiledSize(gfx::ScaleSize(canvas_size, scale)); TransportDIB* transport_dib = NULL; { scoped_ptr canvas( RenderProcess::current()->GetDrawingCanvas(&transport_dib, gfx::Rect(canvas_size))); if (!canvas.get()) return false; canvas->scale(scale, scale); canvas->translate(-zoom_rect.x(), -zoom_rect.y()); webwidget_->paint(webkit_glue::ToWebCanvas(canvas.get()), zoom_rect, WebWidget::ForceSoftwareRenderingAndIgnoreGPUResidentContent); } Send(new ViewHostMsg_ShowDisambiguationPopup(routing_id_, zoom_rect, canvas_size, transport_dib->id())); return true; } ",0 "static zend_bool php_auto_globals_create_files(zend_string *name) { if (Z_TYPE(PG(http_globals)[TRACK_VARS_FILES]) == IS_UNDEF) { array_init(&PG(http_globals)[TRACK_VARS_FILES]); } zend_hash_update(&EG(symbol_table), name, &PG(http_globals)[TRACK_VARS_FILES]); Z_ADDREF(PG(http_globals)[TRACK_VARS_FILES]); return 0; /* don't rearm */ } ",0 "void Document::finishedParsing() { ASSERT(!scriptableDocumentParser() || !m_parser->isParsing()); ASSERT(!scriptableDocumentParser() || m_readyState != Loading); setParsingState(InDOMContentLoaded); if (!m_documentTiming.domContentLoadedEventStart()) m_documentTiming.markDomContentLoadedEventStart(); dispatchEvent(Event::createBubble(EventTypeNames::DOMContentLoaded)); if (!m_documentTiming.domContentLoadedEventEnd()) m_documentTiming.markDomContentLoadedEventEnd(); setParsingState(FinishedParsing); RefPtrWillBeRawPtr protect(this); Microtask::performCheckpoint(V8PerIsolateData::mainThreadIsolate()); if (RefPtrWillBeRawPtr frame = this->frame()) { const bool mainResourceWasAlreadyRequested = frame->loader().stateMachine()->committedFirstRealDocumentLoad(); if (mainResourceWasAlreadyRequested) updateLayoutTreeIfNeeded(); frame->loader().finishedParsing(); TRACE_EVENT_INSTANT1(""devtools.timeline"", ""MarkDOMContent"", TRACE_EVENT_SCOPE_THREAD, ""data"", InspectorMarkLoadEvent::data(frame.get())); InspectorInstrumentation::domContentLoadedEventFired(frame.get()); } m_elementDataCacheClearTimer.startOneShot(10, FROM_HERE); m_fetcher->clearPreloads(); } ",0 "const hci_t *hci_layer_get_test_interface( const allocator_t *buffer_allocator_interface, const hci_hal_t *hal_interface, const btsnoop_t *btsnoop_interface, const hci_inject_t *hci_inject_interface, const packet_fragmenter_t *packet_fragmenter_interface, const vendor_t *vendor_interface, const low_power_manager_t *low_power_manager_interface) { buffer_allocator = buffer_allocator_interface; hal = hal_interface; btsnoop = btsnoop_interface; hci_inject = hci_inject_interface; packet_fragmenter = packet_fragmenter_interface; vendor = vendor_interface; low_power_manager = low_power_manager_interface; init_layer_interface(); return &interface; } ",0 "static void int32ArrayMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::int32ArrayMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "size_t coolkey_list_meter(const void *el) { return sizeof(sc_cardctl_coolkey_object_t); } ",0 "GF_Err sidx_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 i; GF_SegmentIndexBox *ptr = (GF_SegmentIndexBox*) s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->reference_ID); gf_bs_write_u32(bs, ptr->timescale); if (ptr->version==0) { gf_bs_write_u32(bs, (u32) ptr->earliest_presentation_time); gf_bs_write_u32(bs, (u32) ptr->first_offset); } else { gf_bs_write_u64(bs, ptr->earliest_presentation_time); gf_bs_write_u64(bs, ptr->first_offset); } gf_bs_write_u16(bs, 0); gf_bs_write_u16(bs, ptr->nb_refs); for (i=0; inb_refs; i++ ) { gf_bs_write_int(bs, ptr->refs[i].reference_type, 1); gf_bs_write_int(bs, ptr->refs[i].reference_size, 31); gf_bs_write_u32(bs, ptr->refs[i].subsegment_duration); gf_bs_write_int(bs, ptr->refs[i].starts_with_SAP, 1); gf_bs_write_int(bs, ptr->refs[i].SAP_type, 3); gf_bs_write_int(bs, ptr->refs[i].SAP_delta_time, 28); } return GF_OK; } ",0 "pdf_xobject_size(pdf_xobject *xobj) { if (xobj == NULL) return 0; return sizeof(*xobj); } ",0 "static int date_compare(const void *_a, const void *_b) { struct commit *a = *(struct commit **)_a; struct commit *b = *(struct commit **)_b; return (long)b->date - (long)a->date; } ",0 "int hfsplus_create_cat(u32 cnid, struct inode *dir, struct qstr *str, struct inode *inode) { struct super_block *sb = dir->i_sb; struct hfs_find_data fd; hfsplus_cat_entry entry; int entry_size; int err; dprint(DBG_CAT_MOD, ""create_cat: %s,%u(%d)\n"", str->name, cnid, inode->i_nlink); err = hfs_find_init(HFSPLUS_SB(sb)->cat_tree, &fd); if (err) return err; hfsplus_cat_build_key(sb, fd.search_key, cnid, NULL); entry_size = hfsplus_fill_cat_thread(sb, &entry, S_ISDIR(inode->i_mode) ? HFSPLUS_FOLDER_THREAD : HFSPLUS_FILE_THREAD, dir->i_ino, str); err = hfs_brec_find(&fd); if (err != -ENOENT) { if (!err) err = -EEXIST; goto err2; } err = hfs_brec_insert(&fd, &entry, entry_size); if (err) goto err2; hfsplus_cat_build_key(sb, fd.search_key, dir->i_ino, str); entry_size = hfsplus_cat_build_record(&entry, cnid, inode); err = hfs_brec_find(&fd); if (err != -ENOENT) { /* panic? */ if (!err) err = -EEXIST; goto err1; } err = hfs_brec_insert(&fd, &entry, entry_size); if (err) goto err1; dir->i_size++; dir->i_mtime = dir->i_ctime = CURRENT_TIME_SEC; hfsplus_mark_inode_dirty(dir, HFSPLUS_I_CAT_DIRTY); hfs_find_exit(&fd); return 0; err1: hfsplus_cat_build_key(sb, fd.search_key, cnid, NULL); if (!hfs_brec_find(&fd)) hfs_brec_remove(&fd); err2: hfs_find_exit(&fd); return err; } ",0 "static void p4_pmu_swap_config_ts(struct hw_perf_event *hwc, int cpu) { u32 escr, cccr; /* * we either lucky and continue on same cpu or no HT support */ if (!p4_should_swap_ts(hwc->config, cpu)) return; /* * the event is migrated from an another logical * cpu, so we need to swap thread specific flags */ escr = p4_config_unpack_escr(hwc->config); cccr = p4_config_unpack_cccr(hwc->config); if (p4_ht_thread(cpu)) { cccr &= ~P4_CCCR_OVF_PMI_T0; cccr |= P4_CCCR_OVF_PMI_T1; if (escr & P4_ESCR_T0_OS) { escr &= ~P4_ESCR_T0_OS; escr |= P4_ESCR_T1_OS; } if (escr & P4_ESCR_T0_USR) { escr &= ~P4_ESCR_T0_USR; escr |= P4_ESCR_T1_USR; } hwc->config = p4_config_pack_escr(escr); hwc->config |= p4_config_pack_cccr(cccr); hwc->config |= P4_CONFIG_HT; } else { cccr &= ~P4_CCCR_OVF_PMI_T1; cccr |= P4_CCCR_OVF_PMI_T0; if (escr & P4_ESCR_T1_OS) { escr &= ~P4_ESCR_T1_OS; escr |= P4_ESCR_T0_OS; } if (escr & P4_ESCR_T1_USR) { escr &= ~P4_ESCR_T1_USR; escr |= P4_ESCR_T0_USR; } hwc->config = p4_config_pack_escr(escr); hwc->config |= p4_config_pack_cccr(cccr); hwc->config &= ~P4_CONFIG_HT; } } ",0 "xfs_attr3_leaf_flipflags( struct xfs_da_args *args) { struct xfs_attr_leafblock *leaf1; struct xfs_attr_leafblock *leaf2; struct xfs_attr_leaf_entry *entry1; struct xfs_attr_leaf_entry *entry2; struct xfs_attr_leaf_name_remote *name_rmt; struct xfs_buf *bp1; struct xfs_buf *bp2; int error; #ifdef DEBUG struct xfs_attr3_icleaf_hdr ichdr1; struct xfs_attr3_icleaf_hdr ichdr2; xfs_attr_leaf_name_local_t *name_loc; int namelen1, namelen2; char *name1, *name2; #endif /* DEBUG */ trace_xfs_attr_leaf_flipflags(args); /* * Read the block containing the ""old"" attr */ error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, -1, &bp1); if (error) return error; /* * Read the block containing the ""new"" attr, if it is different */ if (args->blkno2 != args->blkno) { error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno2, -1, &bp2); if (error) return error; } else { bp2 = bp1; } leaf1 = bp1->b_addr; entry1 = &xfs_attr3_leaf_entryp(leaf1)[args->index]; leaf2 = bp2->b_addr; entry2 = &xfs_attr3_leaf_entryp(leaf2)[args->index2]; #ifdef DEBUG xfs_attr3_leaf_hdr_from_disk(&ichdr1, leaf1); ASSERT(args->index < ichdr1.count); ASSERT(args->index >= 0); xfs_attr3_leaf_hdr_from_disk(&ichdr2, leaf2); ASSERT(args->index2 < ichdr2.count); ASSERT(args->index2 >= 0); if (entry1->flags & XFS_ATTR_LOCAL) { name_loc = xfs_attr3_leaf_name_local(leaf1, args->index); namelen1 = name_loc->namelen; name1 = (char *)name_loc->nameval; } else { name_rmt = xfs_attr3_leaf_name_remote(leaf1, args->index); namelen1 = name_rmt->namelen; name1 = (char *)name_rmt->name; } if (entry2->flags & XFS_ATTR_LOCAL) { name_loc = xfs_attr3_leaf_name_local(leaf2, args->index2); namelen2 = name_loc->namelen; name2 = (char *)name_loc->nameval; } else { name_rmt = xfs_attr3_leaf_name_remote(leaf2, args->index2); namelen2 = name_rmt->namelen; name2 = (char *)name_rmt->name; } ASSERT(be32_to_cpu(entry1->hashval) == be32_to_cpu(entry2->hashval)); ASSERT(namelen1 == namelen2); ASSERT(memcmp(name1, name2, namelen1) == 0); #endif /* DEBUG */ ASSERT(entry1->flags & XFS_ATTR_INCOMPLETE); ASSERT((entry2->flags & XFS_ATTR_INCOMPLETE) == 0); entry1->flags &= ~XFS_ATTR_INCOMPLETE; xfs_trans_log_buf(args->trans, bp1, XFS_DA_LOGRANGE(leaf1, entry1, sizeof(*entry1))); if (args->rmtblkno) { ASSERT((entry1->flags & XFS_ATTR_LOCAL) == 0); name_rmt = xfs_attr3_leaf_name_remote(leaf1, args->index); name_rmt->valueblk = cpu_to_be32(args->rmtblkno); name_rmt->valuelen = cpu_to_be32(args->valuelen); xfs_trans_log_buf(args->trans, bp1, XFS_DA_LOGRANGE(leaf1, name_rmt, sizeof(*name_rmt))); } entry2->flags |= XFS_ATTR_INCOMPLETE; xfs_trans_log_buf(args->trans, bp2, XFS_DA_LOGRANGE(leaf2, entry2, sizeof(*entry2))); if ((entry2->flags & XFS_ATTR_LOCAL) == 0) { name_rmt = xfs_attr3_leaf_name_remote(leaf2, args->index2); name_rmt->valueblk = 0; name_rmt->valuelen = 0; xfs_trans_log_buf(args->trans, bp2, XFS_DA_LOGRANGE(leaf2, name_rmt, sizeof(*name_rmt))); } /* * Commit the flag value change and start the next trans in series. */ error = xfs_trans_roll(&args->trans, args->dp); return error; } ",1 "pp::VarDictionary PDFiumEngine::TraverseBookmarks(FPDF_BOOKMARK bookmark, unsigned int depth) { pp::VarDictionary dict; base::string16 title; unsigned long buffer_size = FPDFBookmark_GetTitle(bookmark, nullptr, 0); if (buffer_size > 0) { PDFiumAPIStringBufferSizeInBytesAdapter api_string_adapter( &title, buffer_size, true); api_string_adapter.Close(FPDFBookmark_GetTitle( bookmark, api_string_adapter.GetData(), buffer_size)); } dict.Set(pp::Var(""title""), pp::Var(base::UTF16ToUTF8(title))); FPDF_DEST dest = FPDFBookmark_GetDest(doc_, bookmark); if (dest) { unsigned long page_index = FPDFDest_GetPageIndex(doc_, dest); if (page_index < pages_.size() && base::IsValueInRangeForNumericType(page_index)) { dict.Set(pp::Var(""page""), pp::Var(static_cast(page_index))); PDFiumPage::LinkTarget target; pages_[page_index]->GetPageYTarget(dest, &target); if (target.y_in_pixels) dict.Set(pp::Var(""y""), pp::Var(target.y_in_pixels.value())); } } else { FPDF_ACTION action = FPDFBookmark_GetAction(bookmark); buffer_size = FPDFAction_GetURIPath(doc_, action, nullptr, 0); if (buffer_size > 0) { std::string uri; PDFiumAPIStringBufferAdapter api_string_adapter( &uri, buffer_size, true); api_string_adapter.Close(FPDFAction_GetURIPath( doc_, action, api_string_adapter.GetData(), buffer_size)); dict.Set(pp::Var(""uri""), pp::Var(uri)); } } pp::VarArray children; const unsigned int kMaxDepth = 128; if (depth < kMaxDepth) { int child_index = 0; std::set seen_bookmarks; for (FPDF_BOOKMARK child_bookmark = FPDFBookmark_GetFirstChild(doc_, bookmark); child_bookmark; child_bookmark = FPDFBookmark_GetNextSibling(doc_, child_bookmark)) { if (base::ContainsKey(seen_bookmarks, child_bookmark)) break; seen_bookmarks.insert(child_bookmark); children.Set(child_index, TraverseBookmarks(child_bookmark, depth + 1)); child_index++; } } dict.Set(pp::Var(""children""), children); return dict; } ",0 "void MediaStreamDispatcherHost::OnMediaStreamDeviceObserverConnectionError() { DCHECK_CURRENTLY_ON(BrowserThread::IO); media_stream_device_observer_.reset(); } ",0 "static void swap_free_obj(struct page *page, unsigned int a, unsigned int b) { swap(((freelist_idx_t *)page->freelist)[a], ((freelist_idx_t *)page->freelist)[b]); } ",0 "void DataReductionProxyConfig::FetchWarmupProbeURL() { DCHECK(thread_checker_.CalledOnValidThread()); if (!enabled_by_user_) { RecordWarmupURLFetchAttemptEvent( WarmupURLFetchAttemptEvent::kProxyNotEnabledByUser); return; } if (!params::FetchWarmupProbeURLEnabled()) { RecordWarmupURLFetchAttemptEvent( WarmupURLFetchAttemptEvent::kWarmupURLFetchingDisabled); return; } if (connection_type_ == network::mojom::ConnectionType::CONNECTION_NONE) { RecordWarmupURLFetchAttemptEvent( WarmupURLFetchAttemptEvent::kConnectionTypeNone); return; } base::Optional warmup_proxy = GetProxyConnectionToProbe(); if (!warmup_proxy) return; warmup_url_fetch_in_flight_secure_proxy_ = warmup_proxy->IsSecureProxy(); warmup_url_fetch_in_flight_core_proxy_ = warmup_proxy->IsCoreProxy(); size_t previous_attempt_counts = GetWarmupURLFetchAttemptCounts(); network_properties_manager_->OnWarmupFetchInitiated( warmup_url_fetch_in_flight_secure_proxy_, warmup_url_fetch_in_flight_core_proxy_); RecordWarmupURLFetchAttemptEvent(WarmupURLFetchAttemptEvent::kFetchInitiated); warmup_url_fetcher_->FetchWarmupURL(previous_attempt_counts, warmup_proxy.value()); } ",0 "choose_mac(struct ssh *ssh, struct sshmac *mac, char *client, char *server) { char *name = match_list(client, server, NULL); if (name == NULL) return SSH_ERR_NO_MAC_ALG_MATCH; if (mac_setup(mac, name) < 0) return SSH_ERR_INTERNAL_ERROR; /* truncate the key */ if (ssh->compat & SSH_BUG_HMAC) mac->key_len = 16; mac->name = name; mac->key = NULL; mac->enabled = 0; return 0; } ",0 "static int __btrfs_end_transaction(struct btrfs_trans_handle *trans, struct btrfs_root *root, int throttle) { struct btrfs_transaction *cur_trans = trans->transaction; struct btrfs_fs_info *info = root->fs_info; int count = 0; int lock = (trans->type != TRANS_JOIN_NOLOCK); int err = 0; if (--trans->use_count) { trans->block_rsv = trans->orig_rsv; return 0; } /* * do the qgroup accounting as early as possible */ err = btrfs_delayed_refs_qgroup_accounting(trans, info); btrfs_trans_release_metadata(trans, root); trans->block_rsv = NULL; /* * the same root has to be passed to start_transaction and * end_transaction. Subvolume quota depends on this. */ WARN_ON(trans->root != root); if (trans->qgroup_reserved) { btrfs_qgroup_free(root, trans->qgroup_reserved); trans->qgroup_reserved = 0; } if (!list_empty(&trans->new_bgs)) btrfs_create_pending_block_groups(trans, root); while (count < 2) { unsigned long cur = trans->delayed_ref_updates; trans->delayed_ref_updates = 0; if (cur && trans->transaction->delayed_refs.num_heads_ready > 64) { trans->delayed_ref_updates = 0; btrfs_run_delayed_refs(trans, root, cur); } else { break; } count++; } btrfs_trans_release_metadata(trans, root); trans->block_rsv = NULL; if (!list_empty(&trans->new_bgs)) btrfs_create_pending_block_groups(trans, root); if (lock && !atomic_read(&root->fs_info->open_ioctl_trans) && should_end_transaction(trans, root)) { trans->transaction->blocked = 1; smp_wmb(); } if (lock && cur_trans->blocked && !cur_trans->in_commit) { if (throttle) { /* * We may race with somebody else here so end up having * to call end_transaction on ourselves again, so inc * our use_count. */ trans->use_count++; return btrfs_commit_transaction(trans, root); } else { wake_up_process(info->transaction_kthread); } } if (trans->type < TRANS_JOIN_NOLOCK) sb_end_intwrite(root->fs_info->sb); WARN_ON(cur_trans != info->running_transaction); WARN_ON(atomic_read(&cur_trans->num_writers) < 1); atomic_dec(&cur_trans->num_writers); smp_mb(); if (waitqueue_active(&cur_trans->writer_wait)) wake_up(&cur_trans->writer_wait); put_transaction(cur_trans); if (current->journal_info == trans) current->journal_info = NULL; if (throttle) btrfs_run_delayed_iputs(root); if (trans->aborted || root->fs_info->fs_state & BTRFS_SUPER_FLAG_ERROR) { err = -EIO; } assert_qgroups_uptodate(trans); memset(trans, 0, sizeof(*trans)); kmem_cache_free(btrfs_trans_handle_cachep, trans); return err; } ",0 "PHP_FUNCTION(openssl_csr_get_public_key) { zval ** zcsr; zend_bool use_shortnames = 1; long csr_resource; X509_REQ * csr; EVP_PKEY *tpubkey; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""Z|b"", &zcsr, &use_shortnames) == FAILURE) { return; } csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource TSRMLS_CC); if (csr == NULL) { RETURN_FALSE; } tpubkey=X509_REQ_get_pubkey(csr); RETVAL_RESOURCE(zend_list_insert(tpubkey, le_key)); return; } ",0 " virtual void SetUp() { NavigationControllerTest::SetUp(); SessionService* service = new SessionService(profile()); profile()->set_session_service(service); service->SetWindowType(window_id, Browser::TYPE_NORMAL); service->SetWindowBounds(window_id, gfx::Rect(0, 1, 2, 3), false); service->SetTabIndexInWindow(window_id, controller().session_id(), 0); controller().SetWindowID(window_id); session_helper_.set_service(service); } ",0 "static void php_zip_entry_get_info(INTERNAL_FUNCTION_PARAMETERS, int opt) /* {{{ */ { zval * zip_entry; zip_read_rsrc * zr_rsrc; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""r"", &zip_entry) == FAILURE) { return; } if ((zr_rsrc = (zip_read_rsrc *)zend_fetch_resource(Z_RES_P(zip_entry), le_zip_entry_name, le_zip_entry)) == NULL) { RETURN_FALSE; } if (!zr_rsrc->zf) { RETURN_FALSE; } switch (opt) { case 0: RETURN_STRING((char *)zr_rsrc->sb.name); break; case 1: RETURN_LONG((zend_long) (zr_rsrc->sb.comp_size)); break; case 2: RETURN_LONG((zend_long) (zr_rsrc->sb.size)); break; case 3: switch (zr_rsrc->sb.comp_method) { case 0: RETURN_STRING(""stored""); break; case 1: RETURN_STRING(""shrunk""); break; case 2: case 3: case 4: case 5: RETURN_STRING(""reduced""); break; case 6: RETURN_STRING(""imploded""); break; case 7: RETURN_STRING(""tokenized""); break; case 8: RETURN_STRING(""deflated""); break; case 9: RETURN_STRING(""deflatedX""); break; case 10: RETURN_STRING(""implodedX""); break; default: RETURN_FALSE; } RETURN_LONG((zend_long) (zr_rsrc->sb.comp_method)); break; } } /* }}} */ ",0 "static OMX_ERRORTYPE subscribe_to_events(int fd) { OMX_ERRORTYPE eRet = OMX_ErrorNone; struct v4l2_event_subscription sub; int array_sz = sizeof(event_type)/sizeof(int); int i,rc; if (fd < 0) { DEBUG_PRINT_ERROR(""Invalid input: %d"", fd); return OMX_ErrorBadParameter; } for (i = 0; i < array_sz; ++i) { memset(&sub, 0, sizeof(sub)); sub.type = event_type[i]; rc = ioctl(fd, VIDIOC_SUBSCRIBE_EVENT, &sub); if (rc) { DEBUG_PRINT_ERROR(""Failed to subscribe event: 0x%x"", sub.type); break; } } if (i < array_sz) { for (--i; i >=0 ; i--) { memset(&sub, 0, sizeof(sub)); sub.type = event_type[i]; rc = ioctl(fd, VIDIOC_UNSUBSCRIBE_EVENT, &sub); if (rc) DEBUG_PRINT_ERROR(""Failed to unsubscribe event: 0x%x"", sub.type); } eRet = OMX_ErrorNotImplemented; } return eRet; } ",0 "TestURLFetcherFactory::~TestURLFetcherFactory() {} ",0 "void RenderWidgetHostImpl::SetInitialRenderSizeParams( const ResizeParams& resize_params) { resize_ack_pending_ = resize_params.needs_resize_ack; old_resize_params_ = std::make_unique(resize_params); } ",0 "struct page *get_sum_page(struct f2fs_sb_info *sbi, unsigned int segno) { return get_meta_page(sbi, GET_SUM_BLOCK(sbi, segno)); } ",0 "void Textfield::SetTextEditCommandForNextKeyEvent(ui::TextEditCommand command) { DCHECK_EQ(ui::TextEditCommand::INVALID_COMMAND, scheduled_text_edit_command_); scheduled_text_edit_command_ = command; } ",0 "static HB_Error Lookup_ChainContextPos3( GPOS_Instance* gpi, HB_ChainContextPosFormat3* ccpf3, HB_Buffer buffer, HB_UShort flags, HB_UShort context_length, int nesting_level ) { HB_UShort index, i, j, property; HB_UShort bgc, igc, lgc; HB_Error error; HB_GPOSHeader* gpos = gpi->gpos; HB_Coverage* bc; HB_Coverage* ic; HB_Coverage* lc; HB_GDEFHeader* gdef; gdef = gpos->gdef; if ( CHECK_Property( gdef, IN_CURITEM(), flags, &property ) ) return error; bgc = ccpf3->BacktrackGlyphCount; igc = ccpf3->InputGlyphCount; lgc = ccpf3->LookaheadGlyphCount; if ( context_length != 0xFFFF && context_length < igc ) return HB_Err_Not_Covered; /* check whether context is too long; it is a first guess only */ if ( bgc > buffer->in_pos || buffer->in_pos + igc + lgc > buffer->in_length ) return HB_Err_Not_Covered; if ( bgc ) { /* Since we don't know in advance the number of glyphs to inspect, we search backwards for matches in the backtrack glyph array */ bc = ccpf3->BacktrackCoverage; for ( i = 0, j = buffer->in_pos - 1; i < bgc; i++, j-- ) { while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) { if ( error && error != HB_Err_Not_Covered ) return error; if ( j + 1 == bgc - i ) return HB_Err_Not_Covered; j--; } error = _HB_OPEN_Coverage_Index( &bc[i], IN_GLYPH( j ), &index ); if ( error ) return error; } } ic = ccpf3->InputCoverage; for ( i = 0, j = buffer->in_pos; i < igc; i++, j++ ) { /* We already called CHECK_Property for IN_GLYPH ( buffer->in_pos ) */ while ( j > buffer->in_pos && CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) { if ( error && error != HB_Err_Not_Covered ) return error; if ( j + igc - i + lgc == (HB_Int)buffer->in_length ) return HB_Err_Not_Covered; j++; } error = _HB_OPEN_Coverage_Index( &ic[i], IN_GLYPH( j ), &index ); if ( error ) return error; } /* we are starting to check for lookahead glyphs right after the last context glyph */ lc = ccpf3->LookaheadCoverage; for ( i = 0; i < lgc; i++, j++ ) { while ( CHECK_Property( gdef, IN_ITEM( j ), flags, &property ) ) { if ( error && error != HB_Err_Not_Covered ) return error; if ( j + lgc - i == (HB_Int)buffer->in_length ) return HB_Err_Not_Covered; j++; } error = _HB_OPEN_Coverage_Index( &lc[i], IN_GLYPH( j ), &index ); if ( error ) return error; } return Do_ContextPos( gpi, igc, ccpf3->PosCount, ccpf3->PosLookupRecord, buffer, nesting_level ); } ",0 "PGTYPESdate_new(void) { date *result; result = (date *) pgtypes_alloc(sizeof(date)); /* result can be NULL if we run out of memory */ return result; } ",0 "MagickExport unsigned char *DetachBlob(BlobInfo *blob_info) { unsigned char *data; assert(blob_info != (BlobInfo *) NULL); if (blob_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); if (blob_info->mapped != MagickFalse) { (void) UnmapBlob(blob_info->data,blob_info->length); RelinquishMagickResource(MapResource,blob_info->length); } blob_info->mapped=MagickFalse; blob_info->length=0; blob_info->offset=0; blob_info->eof=MagickFalse; blob_info->error=0; blob_info->exempt=MagickFalse; blob_info->type=UndefinedStream; blob_info->file_info.file=(FILE *) NULL; data=blob_info->data; blob_info->data=(unsigned char *) NULL; blob_info->stream=(StreamHandler) NULL; return(data); } ",1 "void InspectorPageAgent::GetResourceContentAfterResourcesContentLoaded( const String& frame_id, const String& url, std::unique_ptr callback) { LocalFrame* frame = IdentifiersFactory::FrameById(inspected_frames_, frame_id); if (!frame) { callback->sendFailure(Response::Error(""No frame for given id found"")); return; } String content; bool base64_encoded; if (InspectorPageAgent::CachedResourceContent( CachedResource(frame, KURL(kParsedURLString, url), inspector_resource_content_loader_), &content, &base64_encoded)) callback->sendSuccess(content, base64_encoded); else callback->sendFailure(Response::Error(""No resource with given URL found"")); } ",0 " tt_face_load_sbit( TT_Face face, FT_Stream stream ) { FT_Error error; FT_ULong table_size; face->sbit_table = NULL; face->sbit_table_size = 0; face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE; face->sbit_num_strikes = 0; error = face->goto_table( face, TTAG_CBLC, stream, &table_size ); if ( !error ) face->sbit_table_type = TT_SBIT_TABLE_TYPE_CBLC; else { error = face->goto_table( face, TTAG_EBLC, stream, &table_size ); if ( error ) error = face->goto_table( face, TTAG_bloc, stream, &table_size ); if ( !error ) face->sbit_table_type = TT_SBIT_TABLE_TYPE_EBLC; } if ( error ) { error = face->goto_table( face, TTAG_sbix, stream, &table_size ); if ( !error ) face->sbit_table_type = TT_SBIT_TABLE_TYPE_SBIX; } if ( error ) goto Exit; if ( table_size < 8 ) { FT_ERROR(( ""tt_face_load_sbit_strikes: table too short\n"" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } switch ( (FT_UInt)face->sbit_table_type ) { case TT_SBIT_TABLE_TYPE_EBLC: case TT_SBIT_TABLE_TYPE_CBLC: { FT_Byte* p; FT_Fixed version; FT_ULong num_strikes; FT_UInt count; if ( FT_FRAME_EXTRACT( table_size, face->sbit_table ) ) goto Exit; face->sbit_table_size = table_size; p = face->sbit_table; version = FT_NEXT_ULONG( p ); num_strikes = FT_NEXT_ULONG( p ); if ( ( version & 0xFFFF0000UL ) != 0x00020000UL ) { error = FT_THROW( Unknown_File_Format ); goto Exit; } if ( num_strikes >= 0x10000UL ) { error = FT_THROW( Invalid_File_Format ); goto Exit; } /* * Count the number of strikes available in the table. We are a bit * paranoid there and don't trust the data. */ count = (FT_UInt)num_strikes; if ( 8 + 48UL * count > table_size ) count = (FT_UInt)( ( table_size - 8 ) / 48 ); face->sbit_num_strikes = count; } break; case TT_SBIT_TABLE_TYPE_SBIX: { FT_UShort version; FT_UShort flags; FT_ULong num_strikes; FT_UInt count; if ( FT_FRAME_ENTER( 8 ) ) goto Exit; version = FT_GET_USHORT(); flags = FT_GET_USHORT(); num_strikes = FT_GET_ULONG(); FT_FRAME_EXIT(); if ( version < 1 ) { error = FT_THROW( Unknown_File_Format ); goto Exit; } /* Bit 0 must always be `1'. */ /* Bit 1 controls the overlay of bitmaps with outlines. */ /* All other bits should be zero. */ if ( !( flags == 1 || flags == 3 ) || num_strikes >= 0x10000UL ) { error = FT_THROW( Invalid_File_Format ); goto Exit; } /* we currently don't support bit 1; however, it is better to */ /* draw at least something... */ if ( flags == 3 ) FT_TRACE1(( ""tt_face_load_sbit_strikes:"" "" sbix overlay not supported yet\n"" "" "" "" expect bad rendering results\n"" )); /* * Count the number of strikes available in the table. We are a bit * paranoid there and don't trust the data. */ count = (FT_UInt)num_strikes; if ( 8 + 4UL * count > table_size ) count = (FT_UInt)( ( table_size - 8 ) / 4 ); if ( FT_STREAM_SEEK( FT_STREAM_POS() - 8 ) ) goto Exit; face->sbit_table_size = 8 + count * 4; if ( FT_FRAME_EXTRACT( face->sbit_table_size, face->sbit_table ) ) goto Exit; face->sbit_num_strikes = count; } break; default: error = FT_THROW( Unknown_File_Format ); break; } if ( !error ) FT_TRACE3(( ""sbit_num_strikes: %u\n"", face->sbit_num_strikes )); return FT_Err_Ok; Exit: if ( error ) { if ( face->sbit_table ) FT_FRAME_RELEASE( face->sbit_table ); face->sbit_table_size = 0; face->sbit_table_type = TT_SBIT_TABLE_TYPE_NONE; } return error; } ",0 "int modbus_read_input_bits(modbus_t *ctx, int addr, int nb, uint8_t *dest) { int rc; if (ctx == NULL) { errno = EINVAL; return -1; } if (nb > MODBUS_MAX_READ_BITS) { if (ctx->debug) { fprintf(stderr, ""ERROR Too many discrete inputs requested (%d > %d)\n"", nb, MODBUS_MAX_READ_BITS); } errno = EMBMDATA; return -1; } rc = read_io_status(ctx, MODBUS_FC_READ_DISCRETE_INPUTS, addr, nb, dest); if (rc == -1) return -1; else return nb; } ",0 "static void __ref show_saved_mc(void) { int i, j; unsigned int sig, pf, rev, total_size, data_size, date; struct ucode_cpu_info uci; if (mc_saved_data.mc_saved_count == 0) { pr_debug(""no microcode data saved.\n""); return; } pr_debug(""Total microcode saved: %d\n"", mc_saved_data.mc_saved_count); collect_cpu_info_early(&uci); sig = uci.cpu_sig.sig; pf = uci.cpu_sig.pf; rev = uci.cpu_sig.rev; pr_debug(""CPU%d: sig=0x%x, pf=0x%x, rev=0x%x\n"", smp_processor_id(), sig, pf, rev); for (i = 0; i < mc_saved_data.mc_saved_count; i++) { struct microcode_header_intel *mc_saved_header; struct extended_sigtable *ext_header; int ext_sigcount; struct extended_signature *ext_sig; mc_saved_header = (struct microcode_header_intel *) mc_saved_data.mc_saved[i]; sig = mc_saved_header->sig; pf = mc_saved_header->pf; rev = mc_saved_header->rev; total_size = get_totalsize(mc_saved_header); data_size = get_datasize(mc_saved_header); date = mc_saved_header->date; pr_debug(""mc_saved[%d]: sig=0x%x, pf=0x%x, rev=0x%x, toal size=0x%x, date = %04x-%02x-%02x\n"", i, sig, pf, rev, total_size, date & 0xffff, date >> 24, (date >> 16) & 0xff); /* Look for ext. headers: */ if (total_size <= data_size + MC_HEADER_SIZE) continue; ext_header = (struct extended_sigtable *) mc_saved_header + data_size + MC_HEADER_SIZE; ext_sigcount = ext_header->count; ext_sig = (void *)ext_header + EXT_HEADER_SIZE; for (j = 0; j < ext_sigcount; j++) { sig = ext_sig->sig; pf = ext_sig->pf; pr_debug(""\tExtended[%d]: sig=0x%x, pf=0x%x\n"", j, sig, pf); ext_sig++; } } } ",0 "SyncManager::Observer::~Observer() {} ",0 " TabSpecificContentSettings* tab_specific_content_settings() { return TabSpecificContentSettings::FromWebContents(web_contents()); } ",0 "static int32 TIFFWritePixels(TIFF *tiff,TIFFInfo *tiff_info,ssize_t row, tsample_t sample,Image *image) { int32 status; register ssize_t i; register unsigned char *p, *q; size_t number_tiles, tile_width; ssize_t bytes_per_pixel, j, k, l; if (TIFFIsTiled(tiff) == 0) return(TIFFWriteScanline(tiff,tiff_info->scanline,(uint32) row,sample)); /* Fill scanlines to tile height. */ i=(ssize_t) (row % tiff_info->tile_geometry.height)*TIFFScanlineSize(tiff); (void) memcpy(tiff_info->scanlines+i,(char *) tiff_info->scanline, (size_t) TIFFScanlineSize(tiff)); if (((size_t) (row % tiff_info->tile_geometry.height) != (tiff_info->tile_geometry.height-1)) && (row != (ssize_t) (image->rows-1))) return(0); /* Write tile to TIFF image. */ status=0; bytes_per_pixel=TIFFTileSize(tiff)/(ssize_t) (tiff_info->tile_geometry.height* tiff_info->tile_geometry.width); number_tiles=(image->columns+tiff_info->tile_geometry.width)/ tiff_info->tile_geometry.width; for (i=0; i < (ssize_t) number_tiles; i++) { tile_width=(i == (ssize_t) (number_tiles-1)) ? image->columns-(i* tiff_info->tile_geometry.width) : tiff_info->tile_geometry.width; for (j=0; j < (ssize_t) ((row % tiff_info->tile_geometry.height)+1); j++) for (k=0; k < (ssize_t) tile_width; k++) { if (bytes_per_pixel == 0) { p=tiff_info->scanlines+(j*TIFFScanlineSize(tiff)+(i* tiff_info->tile_geometry.width+k)/8); q=tiff_info->pixels+(j*TIFFTileRowSize(tiff)+k/8); *q++=(*p++); continue; } p=tiff_info->scanlines+(j*TIFFScanlineSize(tiff)+(i* tiff_info->tile_geometry.width+k)*bytes_per_pixel); q=tiff_info->pixels+(j*TIFFTileRowSize(tiff)+k*bytes_per_pixel); for (l=0; l < bytes_per_pixel; l++) *q++=(*p++); } if ((i*tiff_info->tile_geometry.width) != image->columns) status=TIFFWriteTile(tiff,tiff_info->pixels,(uint32) (i* tiff_info->tile_geometry.width),(uint32) ((row/ tiff_info->tile_geometry.height)*tiff_info->tile_geometry.height),0, sample); if (status < 0) break; } return(status); } ",0 "static void cleanup2_doall(ADDED_OBJ *a) { a->obj->nid++; } ",0 "encode_METER(const struct ofpact_meter *meter, enum ofp_version ofp_version, struct ofpbuf *out) { if (ofp_version >= OFP13_VERSION) { instruction_put_OFPIT13_METER(out)->meter_id = htonl(meter->meter_id); } } ",0 "void RenderView::DidDownloadImage(ImageResourceFetcher* fetcher, const SkBitmap& image) { Send(new ViewHostMsg_DidDownloadFavIcon(routing_id_, fetcher->id(), fetcher->image_url(), image.isNull(), image)); DCHECK(image_fetchers_.find(fetcher) != image_fetchers_.end()); image_fetchers_.erase(fetcher); MessageLoop::current()->DeleteSoon(FROM_HERE, fetcher); } ",0 "bool HostNPScriptObject::InvokeDefault(const NPVariant* args, uint32_t argCount, NPVariant* result) { VLOG(2) << ""InvokeDefault""; CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_); SetException(""exception during default invocation""); return false; } ",0 "MagickExport void ResetImageProfileIterator(const Image *image) { assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if (image->profiles == (SplayTreeInfo *) NULL) return; ResetSplayTreeIterator((SplayTreeInfo *) image->profiles); } ",0 "static sector_t rd_get_blocks(struct se_device *dev) { struct rd_dev *rd_dev = RD_DEV(dev); unsigned long long blocks_long = ((rd_dev->rd_page_count * PAGE_SIZE) / dev->dev_attrib.block_size) - 1; return blocks_long; } ",0 " scoped_refptr cert() { return cert_; } ",0 "bool ImageResource::CanReuse(const FetchParameters& params) const { if (params.GetPlaceholderImageRequestType() != FetchParameters::kAllowPlaceholder && placeholder_option_ != PlaceholderOption::kDoNotReloadPlaceholder) return false; return Resource::CanReuse(params); } ",0 "struct hid_device *hid_allocate_device(void) { struct hid_device *hdev; int ret = -ENOMEM; hdev = kzalloc(sizeof(*hdev), GFP_KERNEL); if (hdev == NULL) return ERR_PTR(ret); device_initialize(&hdev->dev); hdev->dev.release = hid_device_release; hdev->dev.bus = &hid_bus_type; device_enable_async_suspend(&hdev->dev); hid_close_report(hdev); init_waitqueue_head(&hdev->debug_wait); INIT_LIST_HEAD(&hdev->debug_list); spin_lock_init(&hdev->debug_list_lock); sema_init(&hdev->driver_lock, 1); sema_init(&hdev->driver_input_lock, 1); return hdev; } ",0 "const std::string& OobeUI::GetScreenName(Screen screen) const { DCHECK(screen >= 0 && screen < SCREEN_UNKNOWN); return screen_names_[static_cast(screen)]; } ",0 "void AutofillPopupItemView::AddSpacerWithSize(int spacer_width, bool resize, views::BoxLayout* layout) { auto* spacer = new views::View; spacer->SetPreferredSize(gfx::Size(spacer_width, 1)); AddChildView(spacer); layout->SetFlexForView(spacer, /*flex=*/resize ? 1 : 0, /*use_min_size=*/true); } ",0 "static void LongAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueInt(info, impl->longAttribute()); } ",0 "void json_tokener_free(struct json_tokener *tok) { json_tokener_reset(tok); if (tok->pb) printbuf_free(tok->pb); if (tok->stack) free(tok->stack); free(tok); } ",0 "int kvm_arch_vcpu_ioctl_set_sregs(struct kvm_vcpu *vcpu, struct kvm_sregs *sregs) { return -EINVAL; } ",0 "void Browser::TabDetachedAtImpl(content::WebContents* contents, bool was_active, DetachType type) { if (type == DETACH_TYPE_DETACH) { if (was_active) { LocationBar* location_bar = window()->GetLocationBar(); if (location_bar) location_bar->SaveStateToContents(contents); } if (!tab_strip_model_->closing_all()) SyncHistoryWithTabs(0); } SetAsDelegate(contents, false); RemoveScheduledUpdatesFor(contents); if (HasFindBarController() && was_active) find_bar_controller_->ChangeWebContents(NULL); for (size_t i = 0; i < interstitial_observers_.size(); i++) { if (interstitial_observers_[i]->web_contents() != contents) continue; delete interstitial_observers_[i]; interstitial_observers_.erase(interstitial_observers_.begin() + i); return; } } ",0 "PlatformSensorProviderBase::MapSharedBufferForType(mojom::SensorType type) { mojo::ScopedSharedBufferMapping mapping = shared_buffer_handle_->MapAtOffset( kReadingBufferSize, SensorReadingSharedBuffer::GetOffset(type)); if (mapping) memset(mapping.get(), 0, kReadingBufferSize); return mapping; } ",1 "string16 PolicyStatusInfo::GetSourceTypeString( PolicySourceType source_type) { static const char* strings[] = { ""user"", ""device"", ""undefined"" }; DCHECK(static_cast(source_type) < arraysize(strings)); return ASCIIToUTF16(strings[source_type]); } ",0 "int StreamTcpBypassEnabled(void) { return (stream_config.flags & STREAMTCP_INIT_FLAG_BYPASS); } ",0 "static bool checkPermission(const char* permissionString) { if (getpid() == IPCThreadState::self()->getCallingPid()) return true; bool ok = checkCallingPermission(String16(permissionString)); if (!ok) ALOGE(""Request requires %s"", permissionString); return ok; } ",0 "static int __init crypto_gcm_module_init(void) { int err; gcm_zeroes = kzalloc(16, GFP_KERNEL); if (!gcm_zeroes) return -ENOMEM; err = crypto_register_template(&crypto_gcm_base_tmpl); if (err) goto out; err = crypto_register_template(&crypto_gcm_tmpl); if (err) goto out_undo_base; err = crypto_register_template(&crypto_rfc4106_tmpl); if (err) goto out_undo_gcm; err = crypto_register_template(&crypto_rfc4543_tmpl); if (err) goto out_undo_rfc4106; return 0; out_undo_rfc4106: crypto_unregister_template(&crypto_rfc4106_tmpl); out_undo_gcm: crypto_unregister_template(&crypto_gcm_tmpl); out_undo_base: crypto_unregister_template(&crypto_gcm_base_tmpl); out: kfree(gcm_zeroes); return err; } ",0 " int scsi_cmd_blk_ioctl(struct block_device *bd, fmode_t mode, unsigned int cmd, void __user *arg) { return scsi_cmd_ioctl(bd->bd_disk->queue, bd->bd_disk, mode, cmd, arg); } ",1 "static void iov_buffer_upload(void *cookie, uint32_t doff, void *src, int len) { struct virgl_sub_upload_data *d = cookie; glBufferSubData(d->target, d->box->x + doff, len, src); } ",0 "static int if6_seq_show(struct seq_file *seq, void *v) { struct inet6_ifaddr *ifp = (struct inet6_ifaddr *)v; seq_printf(seq, ""%pi6 %02x %02x %02x %02x %8s\n"", &ifp->addr, ifp->idev->dev->ifindex, ifp->prefix_len, ifp->scope, (u8) ifp->flags, ifp->idev->dev->name); return 0; } ",0 "const EC_METHOD *EC_GROUP_method_of(const EC_GROUP *group) { return group->meth; } ",0 "struct file *do_file_open_root(struct dentry *dentry, struct vfsmount *mnt, const char *name, const struct open_flags *op) { struct nameidata nd; struct file *file; struct filename *filename; int flags = op->lookup_flags | LOOKUP_ROOT; nd.root.mnt = mnt; nd.root.dentry = dentry; if (d_is_symlink(dentry) && op->intent & LOOKUP_OPEN) return ERR_PTR(-ELOOP); filename = getname_kernel(name); if (IS_ERR(filename)) return ERR_CAST(filename); set_nameidata(&nd, -1, filename); file = path_openat(&nd, op, flags | LOOKUP_RCU); if (unlikely(file == ERR_PTR(-ECHILD))) file = path_openat(&nd, op, flags); if (unlikely(file == ERR_PTR(-ESTALE))) file = path_openat(&nd, op, flags | LOOKUP_REVAL); restore_nameidata(); putname(filename); return file; } ",0 "char *FoFiType1C::getName() { return name ? name->getCString() : (char *)NULL; } ",0 "std::vector BookmarkManagerView::GetSelectedTableNodes() { std::vector nodes; for (views::TableView::iterator i = table_view_->SelectionBegin(); i != table_view_->SelectionEnd(); ++i) { nodes.push_back(table_model_->GetNodeForRow(*i)); } std::reverse(nodes.begin(), nodes.end()); return nodes; } ",0 "static int check_prlimit_permission(struct task_struct *task) { const struct cred *cred = current_cred(), *tcred; if (current == task) return 0; tcred = __task_cred(task); if (uid_eq(cred->uid, tcred->euid) && uid_eq(cred->uid, tcred->suid) && uid_eq(cred->uid, tcred->uid) && gid_eq(cred->gid, tcred->egid) && gid_eq(cred->gid, tcred->sgid) && gid_eq(cred->gid, tcred->gid)) return 0; if (ns_capable(tcred->user_ns, CAP_SYS_RESOURCE)) return 0; return -EPERM; } ",0 "OMX_ERRORTYPE SoftMPEG4Encoder::initEncoder() { CHECK(!mStarted); OMX_ERRORTYPE errType = OMX_ErrorNone; if (OMX_ErrorNone != (errType = initEncParams())) { ALOGE(""Failed to initialized encoder params""); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); return errType; } if (!PVInitVideoEncoder(mHandle, mEncParams)) { ALOGE(""Failed to initialize the encoder""); mSignalledError = true; notify(OMX_EventError, OMX_ErrorUndefined, 0, 0); return OMX_ErrorUndefined; } mNumInputFrames = -1; // 1st buffer for codec specific data mStarted = true; return OMX_ErrorNone; } ",0 "static Element* contextElementForInsertion(const String& where, Element* element, ExceptionCode& ec) { if (equalIgnoringCase(where, ""beforeBegin"") || equalIgnoringCase(where, ""afterEnd"")) { ContainerNode* parent = element->parentNode(); if (parent && !parent->isElementNode()) { ec = NO_MODIFICATION_ALLOWED_ERR; return 0; } ASSERT(!parent || parent->isElementNode()); return static_cast(parent); } if (equalIgnoringCase(where, ""afterBegin"") || equalIgnoringCase(where, ""beforeEnd"")) return element; ec = SYNTAX_ERR; return 0; } ",0 "auth_pin_verify(struct sc_card *card, unsigned int type, struct sc_pin_cmd_data *data, int *tries_left) { struct sc_card_driver *iso_drv = sc_get_iso7816_driver(); int rv; LOG_FUNC_CALLED(card->ctx); if (type != SC_AC_CHV) LOG_TEST_RET(card->ctx, SC_ERROR_NOT_SUPPORTED, ""PIN type other then SC_AC_CHV is not supported""); data->flags |= SC_PIN_CMD_NEED_PADDING; auth_init_pin_info(card, &data->pin1, OBERTHUR_AUTH_TYPE_PIN); /* User PIN is always local. */ if (data->pin_reference == OBERTHUR_PIN_REFERENCE_USER || data->pin_reference == OBERTHUR_PIN_REFERENCE_ONETIME) data->pin_reference |= OBERTHUR_PIN_LOCAL; rv = auth_pin_is_verified(card, data->pin_reference, tries_left); sc_log(card->ctx, ""auth_pin_is_verified returned rv %i"", rv); /* Return if only PIN status has been asked. */ if (data->pin1.data && !data->pin1.len) LOG_FUNC_RETURN(card->ctx, rv); /* Return SUCCESS without verifying if * PIN has been already verified and PIN pad has to be used. */ if (!rv && !data->pin1.data && !data->pin1.len) LOG_FUNC_RETURN(card->ctx, rv); if (!data->pin1.data && !data->pin1.len) rv = auth_pin_verify_pinpad(card, data->pin_reference, tries_left); else rv = iso_drv->ops->pin_cmd(card, data, tries_left); LOG_FUNC_RETURN(card->ctx, rv); } ",0 "int apic_has_pending_timer(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; if (kvm_vcpu_has_lapic(vcpu) && apic_enabled(apic) && apic_lvt_enabled(apic, APIC_LVTT)) return atomic_read(&apic->lapic_timer.pending); return 0; } ",0 "bool extract_sockaddr(char *url, char **sockaddr_url, char **sockaddr_port) { char *url_begin, *url_end, *ipv6_begin, *ipv6_end, *port_start = NULL; char url_address[256], port[6]; int url_len, port_len = 0; *sockaddr_url = url; url_begin = strstr(url, ""//""); if (!url_begin) url_begin = url; else url_begin += 2; /* Look for numeric ipv6 entries */ ipv6_begin = strstr(url_begin, ""[""); ipv6_end = strstr(url_begin, ""]""); if (ipv6_begin && ipv6_end && ipv6_end > ipv6_begin) url_end = strstr(ipv6_end, "":""); else url_end = strstr(url_begin, "":""); if (url_end) { url_len = url_end - url_begin; port_len = strlen(url_begin) - url_len - 1; if (port_len < 1) return false; port_start = url_end + 1; } else url_len = strlen(url_begin); if (url_len < 1) return false; if (url_len >= sizeof(url_address)) { applog(LOG_WARNING, ""%s: Truncating overflowed address '%.*s'"", __func__, url_len, url_begin); url_len = sizeof(url_address) - 1; } sprintf(url_address, ""%.*s"", url_len, url_begin); if (port_len) { char *slash; snprintf(port, 6, ""%.*s"", port_len, port_start); slash = strchr(port, '/'); if (slash) *slash = '\0'; } else strcpy(port, ""80""); *sockaddr_port = strdup(port); *sockaddr_url = strdup(url_address); return true; } ",0 "static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; struct l2cap_chan *chan = l2cap_pi(sk)->chan; int err; BT_DBG(""sock %p, sk %p"", sock, sk); err = sock_error(sk); if (err) return err; if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; if (sk->sk_state != BT_CONNECTED) return -ENOTCONN; l2cap_chan_lock(chan); err = l2cap_chan_send(chan, msg, len, sk->sk_priority); l2cap_chan_unlock(chan); return err; } ",0 "CmdBufferImageTransportFactory::CreateSharedSurfaceHandle() { if (!context_->makeContextCurrent()) { NOTREACHED() << ""Failed to make shared graphics context current""; return gfx::GLSurfaceHandle(); } gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( gfx::kNullPluginWindow, true); handle.parent_gpu_process_id = context_->GetGPUProcessID(); handle.parent_client_id = context_->GetChannelID(); handle.parent_context_id = context_->GetContextID(); handle.parent_texture_id[0] = context_->createTexture(); handle.parent_texture_id[1] = context_->createTexture(); handle.sync_point = context_->insertSyncPoint(); context_->flush(); return handle; } ",1 "qboolean S_AL_Init( soundInterface_t *si ) { #ifdef USE_OPENAL const char* device = NULL; const char* inputdevice = NULL; int i; if( !si ) { return qfalse; } for (i = 0; i < MAX_RAW_STREAMS; i++) { streamSourceHandles[i] = -1; streamPlaying[i] = qfalse; streamSources[i] = 0; streamNumBuffers[i] = 0; streamBufIndex[i] = 0; } s_alPrecache = Cvar_Get( ""s_alPrecache"", ""1"", CVAR_ARCHIVE ); s_alGain = Cvar_Get( ""s_alGain"", ""1.0"", CVAR_ARCHIVE ); s_alSources = Cvar_Get( ""s_alSources"", ""96"", CVAR_ARCHIVE ); s_alDopplerFactor = Cvar_Get( ""s_alDopplerFactor"", ""1.0"", CVAR_ARCHIVE ); s_alDopplerSpeed = Cvar_Get( ""s_alDopplerSpeed"", ""9000"", CVAR_ARCHIVE ); s_alMinDistance = Cvar_Get( ""s_alMinDistance"", ""120"", CVAR_CHEAT ); s_alMaxDistance = Cvar_Get(""s_alMaxDistance"", ""1024"", CVAR_CHEAT); s_alRolloff = Cvar_Get( ""s_alRolloff"", ""2"", CVAR_CHEAT); s_alGraceDistance = Cvar_Get(""s_alGraceDistance"", ""512"", CVAR_CHEAT); s_alDriver = Cvar_Get( ""s_alDriver"", ALDRIVER_DEFAULT, CVAR_ARCHIVE | CVAR_LATCH ); s_alInputDevice = Cvar_Get( ""s_alInputDevice"", """", CVAR_ARCHIVE | CVAR_LATCH ); s_alDevice = Cvar_Get(""s_alDevice"", """", CVAR_ARCHIVE | CVAR_LATCH); if( !QAL_Init( s_alDriver->string ) ) { Com_Printf( ""Failed to load library: \""%s\"".\n"", s_alDriver->string ); if( !Q_stricmp( s_alDriver->string, ALDRIVER_DEFAULT ) || !QAL_Init( ALDRIVER_DEFAULT ) ) { return qfalse; } } device = s_alDevice->string; if(device && !*device) device = NULL; inputdevice = s_alInputDevice->string; if(inputdevice && !*inputdevice) inputdevice = NULL; enumeration_all_ext = qalcIsExtensionPresent(NULL, ""ALC_ENUMERATE_ALL_EXT""); enumeration_ext = qalcIsExtensionPresent(NULL, ""ALC_ENUMERATION_EXT""); if(enumeration_ext || enumeration_all_ext) { char devicenames[16384] = """"; const char *devicelist; #ifdef _WIN32 const char *defaultdevice; #endif int curlen; if(enumeration_all_ext) { devicelist = qalcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER); #ifdef _WIN32 defaultdevice = qalcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER); #endif } else { devicelist = qalcGetString(NULL, ALC_DEVICE_SPECIFIER); #ifdef _WIN32 defaultdevice = qalcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER); #endif enumeration_ext = qtrue; } #ifdef _WIN32 if(!device && defaultdevice && !strcmp(defaultdevice, ""Generic Hardware"")) device = ""Generic Software""; #endif if(devicelist) { while((curlen = strlen(devicelist))) { Q_strcat(devicenames, sizeof(devicenames), devicelist); Q_strcat(devicenames, sizeof(devicenames), ""\n""); devicelist += curlen + 1; } } s_alAvailableDevices = Cvar_Get(""s_alAvailableDevices"", devicenames, CVAR_ROM | CVAR_NORESTART); } alDevice = qalcOpenDevice(device); if( !alDevice && device ) { Com_Printf( ""Failed to open OpenAL device '%s', trying default.\n"", device ); alDevice = qalcOpenDevice(NULL); } if( !alDevice ) { QAL_Shutdown( ); Com_Printf( ""Failed to open OpenAL device.\n"" ); return qfalse; } alContext = qalcCreateContext( alDevice, NULL ); if( !alContext ) { QAL_Shutdown( ); qalcCloseDevice( alDevice ); Com_Printf( ""Failed to create OpenAL context.\n"" ); return qfalse; } qalcMakeContextCurrent( alContext ); S_AL_BufferInit( ); S_AL_SrcInit( ); qalDistanceModel(AL_INVERSE_DISTANCE_CLAMPED); qalDopplerFactor( s_alDopplerFactor->value ); qalSpeedOfSound( s_alDopplerSpeed->value ); #ifdef USE_VOIP s_alCapture = Cvar_Get( ""s_alCapture"", ""1"", CVAR_ARCHIVE | CVAR_LATCH ); if (!s_alCapture->integer) { Com_Printf(""OpenAL capture support disabled by user ('+set s_alCapture 1' to enable)\n""); } #if USE_MUMBLE else if (cl_useMumble->integer) { Com_Printf(""OpenAL capture support disabled for Mumble support\n""); } #endif else { #ifdef __APPLE__ if (qalcCaptureOpenDevice == NULL) #else if (!qalcIsExtensionPresent(NULL, ""ALC_EXT_capture"")) #endif { Com_Printf(""No ALC_EXT_capture support, can't record audio.\n""); } else { char inputdevicenames[16384] = """"; const char *inputdevicelist; const char *defaultinputdevice; int curlen; capture_ext = qtrue; inputdevicelist = qalcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER); defaultinputdevice = qalcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER); if (inputdevicelist) { while((curlen = strlen(inputdevicelist))) { Q_strcat(inputdevicenames, sizeof(inputdevicenames), inputdevicelist); Q_strcat(inputdevicenames, sizeof(inputdevicenames), ""\n""); inputdevicelist += curlen + 1; } } s_alAvailableInputDevices = Cvar_Get(""s_alAvailableInputDevices"", inputdevicenames, CVAR_ROM | CVAR_NORESTART); Com_Printf(""OpenAL default capture device is '%s'\n"", defaultinputdevice ? defaultinputdevice : ""none""); alCaptureDevice = qalcCaptureOpenDevice(inputdevice, 48000, AL_FORMAT_MONO16, VOIP_MAX_PACKET_SAMPLES*4); if( !alCaptureDevice && inputdevice ) { Com_Printf( ""Failed to open OpenAL Input device '%s', trying default.\n"", inputdevice ); alCaptureDevice = qalcCaptureOpenDevice(NULL, 48000, AL_FORMAT_MONO16, VOIP_MAX_PACKET_SAMPLES*4); } Com_Printf( ""OpenAL capture device %s.\n"", (alCaptureDevice == NULL) ? ""failed to open"" : ""opened""); } } #endif si->Shutdown = S_AL_Shutdown; si->StartSound = S_AL_StartSound; si->StartLocalSound = S_AL_StartLocalSound; si->StartBackgroundTrack = S_AL_StartBackgroundTrack; si->StopBackgroundTrack = S_AL_StopBackgroundTrack; si->RawSamples = S_AL_RawSamples; si->StopAllSounds = S_AL_StopAllSounds; si->ClearLoopingSounds = S_AL_ClearLoopingSounds; si->AddLoopingSound = S_AL_AddLoopingSound; si->AddRealLoopingSound = S_AL_AddRealLoopingSound; si->StopLoopingSound = S_AL_StopLoopingSound; si->Respatialize = S_AL_Respatialize; si->UpdateEntityPosition = S_AL_UpdateEntityPosition; si->Update = S_AL_Update; si->DisableSounds = S_AL_DisableSounds; si->BeginRegistration = S_AL_BeginRegistration; si->RegisterSound = S_AL_RegisterSound; si->ClearSoundBuffer = S_AL_ClearSoundBuffer; si->SoundInfo = S_AL_SoundInfo; si->SoundList = S_AL_SoundList; #ifdef USE_VOIP si->StartCapture = S_AL_StartCapture; si->AvailableCaptureSamples = S_AL_AvailableCaptureSamples; si->Capture = S_AL_Capture; si->StopCapture = S_AL_StopCapture; si->MasterGain = S_AL_MasterGain; #endif return qtrue; #else return qfalse; #endif } ",1 "static int blk_cloned_rq_check_limits(struct request_queue *q, struct request *rq) { if (blk_rq_sectors(rq) > blk_queue_get_max_sectors(q, req_op(rq))) { printk(KERN_ERR ""%s: over max size limit.\n"", __func__); return -EIO; } /* * queue's settings related to segment counting like q->bounce_pfn * may differ from that of other stacking queues. * Recalculate it to check the request correctly on this queue's * limitation. */ blk_recalc_rq_segments(rq); if (rq->nr_phys_segments > queue_max_segments(q)) { printk(KERN_ERR ""%s: over max segments limit.\n"", __func__); return -EIO; } return 0; } ",0 "connection_ap_handshake_rewrite_and_attach(entry_connection_t *conn, origin_circuit_t *circ, crypt_path_t *cpath) { socks_request_t *socks = conn->socks_request; const or_options_t *options = get_options(); connection_t *base_conn = ENTRY_TO_CONN(conn); time_t now = time(NULL); rewrite_result_t rr; /* First we'll do the rewrite part. Let's see if we get a reasonable * answer. */ memset(&rr, 0, sizeof(rr)); connection_ap_handshake_rewrite(conn,&rr); if (rr.should_close) { /* connection_ap_handshake_rewrite told us to close the connection: * either because it sent back an answer, or because it sent back an * error */ connection_mark_unattached_ap(conn, rr.end_reason); if (END_STREAM_REASON_DONE == (rr.end_reason & END_STREAM_REASON_MASK)) return 0; else return -1; } const time_t map_expires = rr.map_expires; const int automap = rr.automap; const addressmap_entry_source_t exit_source = rr.exit_source; /* Now, we parse the address to see if it's an .onion or .exit or * other special address. */ const hostname_type_t addresstype = parse_extended_hostname(socks->address); /* Now see whether the hostname is bogus. This could happen because of an * onion hostname whose format we don't recognize. */ if (addresstype == BAD_HOSTNAME) { control_event_client_status(LOG_WARN, ""SOCKS_BAD_HOSTNAME HOSTNAME=%s"", escaped(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } /* If this is a .exit hostname, strip off the .name.exit part, and * see whether we're willing to connect there, and and otherwise handle the * .exit address. * * We'll set chosen_exit_name and/or close the connection as appropriate. */ if (addresstype == EXIT_HOSTNAME) { /* If StrictNodes is not set, then .exit overrides ExcludeNodes but * not ExcludeExitNodes. */ routerset_t *excludeset = options->StrictNodes ? options->ExcludeExitNodesUnion_ : options->ExcludeExitNodes; const node_t *node = NULL; /* If this .exit was added by an AUTOMAP, then it came straight from * a user. Make sure that options->AllowDotExit permits that! */ if (exit_source == ADDRMAPSRC_AUTOMAP && !options->AllowDotExit) { /* Whoops; this one is stale. It must have gotten added earlier, * when AllowDotExit was on. */ log_warn(LD_APP,""Stale automapped address for '%s.exit', with "" ""AllowDotExit disabled. Refusing."", safe_str_client(socks->address)); control_event_client_status(LOG_WARN, ""SOCKS_BAD_HOSTNAME HOSTNAME=%s"", escaped(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } /* Double-check to make sure there are no .exits coming from * impossible/weird sources. */ if (exit_source == ADDRMAPSRC_DNS || (exit_source == ADDRMAPSRC_NONE && !options->AllowDotExit)) { /* It shouldn't be possible to get a .exit address from any of these * sources. */ log_warn(LD_BUG,""Address '%s.exit', with impossible source for the "" "".exit part. Refusing."", safe_str_client(socks->address)); control_event_client_status(LOG_WARN, ""SOCKS_BAD_HOSTNAME HOSTNAME=%s"", escaped(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } tor_assert(!automap); /* Now, find the character before the .(name) part. * (The "".exit"" part got stripped off by ""parse_extended_hostname""). * * We're going to put the exit name into conn->chosen_exit_name, and * look up a node correspondingly. */ char *s = strrchr(socks->address,'.'); if (s) { /* The address was of the form ""(stuff).(name).exit */ if (s[1] != '\0') { /* Looks like a real .exit one. */ conn->chosen_exit_name = tor_strdup(s+1); node = node_get_by_nickname(conn->chosen_exit_name, 1); if (exit_source == ADDRMAPSRC_TRACKEXIT) { /* We 5 tries before it expires the addressmap */ conn->chosen_exit_retries = TRACKHOSTEXITS_RETRIES; } *s = 0; } else { /* Oops, the address was (stuff)..exit. That's not okay. */ log_warn(LD_APP,""Malformed exit address '%s.exit'. Refusing."", safe_str_client(socks->address)); control_event_client_status(LOG_WARN, ""SOCKS_BAD_HOSTNAME HOSTNAME=%s"", escaped(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } } else { /* It looks like they just asked for ""foo.exit"". That's a special * form that means (foo's address).foo.exit. */ conn->chosen_exit_name = tor_strdup(socks->address); node = node_get_by_nickname(conn->chosen_exit_name, 1); if (node) { *socks->address = 0; node_get_address_string(node, socks->address, sizeof(socks->address)); } } /* Now make sure that the chosen exit exists... */ if (!node) { log_warn(LD_APP, ""Unrecognized relay in exit address '%s.exit'. Refusing."", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } /* ...and make sure that it isn't excluded. */ if (routerset_contains_node(excludeset, node)) { log_warn(LD_APP, ""Excluded relay in exit address '%s.exit'. Refusing."", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } /* XXXX-1090 Should we also allow foo.bar.exit if ExitNodes is set and Bar is not listed in it? I say yes, but our revised manpage branch implies no. */ } /* Now, we handle everything that isn't a .onion address. */ if (addresstype != ONION_HOSTNAME) { /* Not a hidden-service request. It's either a hostname or an IP, * possibly with a .exit that we stripped off. We're going to check * if we're allowed to connect/resolve there, and then launch the * appropriate request. */ /* Check for funny characters in the address. */ if (address_is_invalid_destination(socks->address, 1)) { control_event_client_status(LOG_WARN, ""SOCKS_BAD_HOSTNAME HOSTNAME=%s"", escaped(socks->address)); log_warn(LD_APP, ""Destination '%s' seems to be an invalid hostname. Failing."", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } #ifdef ENABLE_TOR2WEB_MODE /* If we're running in Tor2webMode, we don't allow anything BUT .onion * addresses. */ if (options->Tor2webMode) { log_warn(LD_APP, ""Refusing to connect to non-hidden-service hostname "" ""or IP address %s because tor2web mode is enabled."", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } #endif /* socks->address is a non-onion hostname or IP address. * If we can't do any non-onion requests, refuse the connection. * If we have a hostname but can't do DNS, refuse the connection. * If we have an IP address, but we can't use that address family, * refuse the connection. * * If we can do DNS requests, and we can use at least one address family, * then we have to resolve the address first. Then we'll know if it * resolves to a usable address family. */ /* First, check if all non-onion traffic is disabled */ if (!conn->entry_cfg.dns_request && !conn->entry_cfg.ipv4_traffic && !conn->entry_cfg.ipv6_traffic) { log_warn(LD_APP, ""Refusing to connect to non-hidden-service hostname "" ""or IP address %s because Port has OnionTrafficOnly set (or "" ""NoDNSRequest, NoIPv4Traffic, and NoIPv6Traffic)."", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } /* Then check if we have a hostname or IP address, and whether DNS or * the IP address family are permitted. Reject if not. */ tor_addr_t dummy_addr; int socks_family = tor_addr_parse(&dummy_addr, socks->address); /* family will be -1 for a non-onion hostname that's not an IP */ if (socks_family == -1) { if (!conn->entry_cfg.dns_request) { log_warn(LD_APP, ""Refusing to connect to hostname %s "" ""because Port has NoDNSRequest set."", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } } else if (socks_family == AF_INET) { if (!conn->entry_cfg.ipv4_traffic) { log_warn(LD_APP, ""Refusing to connect to IPv4 address %s because "" ""Port has NoIPv4Traffic set."", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } } else if (socks_family == AF_INET6) { if (!conn->entry_cfg.ipv6_traffic) { log_warn(LD_APP, ""Refusing to connect to IPv6 address %s because "" ""Port has NoIPv6Traffic set."", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } } else { tor_assert_nonfatal_unreached_once(); } /* See if this is a hostname lookup that we can answer immediately. * (For example, an attempt to look up the IP address for an IP address.) */ if (socks->command == SOCKS_COMMAND_RESOLVE) { tor_addr_t answer; /* Reply to resolves immediately if we can. */ if (tor_addr_parse(&answer, socks->address) >= 0) {/* is it an IP? */ /* remember _what_ is supposed to have been resolved. */ strlcpy(socks->address, rr.orig_address, sizeof(socks->address)); connection_ap_handshake_socks_resolved_addr(conn, &answer, -1, map_expires); connection_mark_unattached_ap(conn, END_STREAM_REASON_DONE | END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED); return 0; } tor_assert(!automap); rep_hist_note_used_resolve(now); /* help predict this next time */ } else if (socks->command == SOCKS_COMMAND_CONNECT) { /* Now see if this is a connect request that we can reject immediately */ tor_assert(!automap); /* Don't allow connections to port 0. */ if (socks->port == 0) { log_notice(LD_APP,""Application asked to connect to port 0. Refusing.""); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } /* You can't make connections to internal addresses, by default. * Exceptions are begindir requests (where the address is meaningless), * or cases where you've hand-configured a particular exit, thereby * making the local address meaningful. */ if (options->ClientRejectInternalAddresses && !conn->use_begindir && !conn->chosen_exit_name && !circ) { /* If we reach this point then we don't want to allow internal * addresses. Check if we got one. */ tor_addr_t addr; if (tor_addr_hostname_is_local(socks->address) || (tor_addr_parse(&addr, socks->address) >= 0 && tor_addr_is_internal(&addr, 0))) { /* If this is an explicit private address with no chosen exit node, * then we really don't want to try to connect to it. That's * probably an error. */ if (conn->is_transparent_ap) { #define WARN_INTRVL_LOOP 300 static ratelim_t loop_warn_limit = RATELIM_INIT(WARN_INTRVL_LOOP); char *m; if ((m = rate_limit_log(&loop_warn_limit, approx_time()))) { log_warn(LD_NET, ""Rejecting request for anonymous connection to private "" ""address %s on a TransPort or NATDPort. Possible loop "" ""in your NAT rules?%s"", safe_str_client(socks->address), m); tor_free(m); } } else { #define WARN_INTRVL_PRIV 300 static ratelim_t priv_warn_limit = RATELIM_INIT(WARN_INTRVL_PRIV); char *m; if ((m = rate_limit_log(&priv_warn_limit, approx_time()))) { log_warn(LD_NET, ""Rejecting SOCKS request for anonymous connection to "" ""private address %s.%s"", safe_str_client(socks->address),m); tor_free(m); } } connection_mark_unattached_ap(conn, END_STREAM_REASON_PRIVATE_ADDR); return -1; } } /* end ""if we should check for internal addresses"" */ /* Okay. We're still doing a CONNECT, and it wasn't a private * address. Here we do special handling for literal IP addresses, * to see if we should reject this preemptively, and to set up * fields in conn->entry_cfg to tell the exit what AF we want. */ { tor_addr_t addr; /* XXX Duplicate call to tor_addr_parse. */ if (tor_addr_parse(&addr, socks->address) >= 0) { /* If we reach this point, it's an IPv4 or an IPv6 address. */ sa_family_t family = tor_addr_family(&addr); if ((family == AF_INET && ! conn->entry_cfg.ipv4_traffic) || (family == AF_INET6 && ! conn->entry_cfg.ipv6_traffic)) { /* You can't do an IPv4 address on a v6-only socks listener, * or vice versa. */ log_warn(LD_NET, ""Rejecting SOCKS request for an IP address "" ""family that this listener does not support.""); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } else if (family == AF_INET6 && socks->socks_version == 4) { /* You can't make a socks4 request to an IPv6 address. Socks4 * doesn't support that. */ log_warn(LD_NET, ""Rejecting SOCKS4 request for an IPv6 address.""); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } else if (socks->socks_version == 4 && !conn->entry_cfg.ipv4_traffic) { /* You can't do any kind of Socks4 request when IPv4 is forbidden. * * XXX raise this check outside the enclosing block? */ log_warn(LD_NET, ""Rejecting SOCKS4 request on a listener with "" ""no IPv4 traffic supported.""); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } else if (family == AF_INET6) { /* Tell the exit: we won't accept any ipv4 connection to an IPv6 * address. */ conn->entry_cfg.ipv4_traffic = 0; } else if (family == AF_INET) { /* Tell the exit: we won't accept any ipv6 connection to an IPv4 * address. */ conn->entry_cfg.ipv6_traffic = 0; } } } /* we never allow IPv6 answers on socks4. (TODO: Is this smart?) */ if (socks->socks_version == 4) conn->entry_cfg.ipv6_traffic = 0; /* Still handling CONNECT. Now, check for exit enclaves. (Which we * don't do on BEGINDIR, or when there is a chosen exit.) * * TODO: Should we remove this? Exit enclaves are nutty and don't * work very well */ if (!conn->use_begindir && !conn->chosen_exit_name && !circ) { /* see if we can find a suitable enclave exit */ const node_t *r = router_find_exact_exit_enclave(socks->address, socks->port); if (r) { log_info(LD_APP, ""Redirecting address %s to exit at enclave router %s"", safe_str_client(socks->address), node_describe(r)); /* use the hex digest, not nickname, in case there are two routers with this nickname */ conn->chosen_exit_name = tor_strdup(hex_str(r->identity, DIGEST_LEN)); conn->chosen_exit_optional = 1; } } /* Still handling CONNECT: warn or reject if it's using a dangerous * port. */ if (!conn->use_begindir && !conn->chosen_exit_name && !circ) if (consider_plaintext_ports(conn, socks->port) < 0) return -1; /* Remember the port so that we will predict that more requests there will happen in the future. */ if (!conn->use_begindir) { /* help predict this next time */ rep_hist_note_used_port(now, socks->port); } } else if (socks->command == SOCKS_COMMAND_RESOLVE_PTR) { rep_hist_note_used_resolve(now); /* help predict this next time */ /* no extra processing needed */ } else { /* We should only be doing CONNECT, RESOLVE, or RESOLVE_PTR! */ tor_fragile_assert(); } /* Okay. At this point we've set chosen_exit_name if needed, rewritten the * address, and decided not to reject it for any number of reasons. Now * mark the connection as waiting for a circuit, and try to attach it! */ base_conn->state = AP_CONN_STATE_CIRCUIT_WAIT; /* If we were given a circuit to attach to, try to attach. Otherwise, * try to find a good one and attach to that. */ int rv; if (circ) { rv = connection_ap_handshake_attach_chosen_circuit(conn, circ, cpath); } else { /* We'll try to attach it at the next event loop, or whenever * we call connection_ap_attach_pending() */ connection_ap_mark_as_pending_circuit(conn); rv = 0; } /* If the above function returned 0 then we're waiting for a circuit. * if it returned 1, we're attached. Both are okay. But if it returned * -1, there was an error, so make sure the connection is marked, and * return -1. */ if (rv < 0) { if (!base_conn->marked_for_close) connection_mark_unattached_ap(conn, END_STREAM_REASON_CANT_ATTACH); return -1; } return 0; } else { /* If we get here, it's a request for a .onion address! */ tor_assert(!automap); /* If .onion address requests are disabled, refuse the request */ if (!conn->entry_cfg.onion_traffic) { log_warn(LD_APP, ""Onion address %s requested from a port with .onion "" ""disabled"", safe_str_client(socks->address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_ENTRYPOLICY); return -1; } /* Check whether it's RESOLVE or RESOLVE_PTR. We don't handle those * for hidden service addresses. */ if (SOCKS_COMMAND_IS_RESOLVE(socks->command)) { /* if it's a resolve request, fail it right now, rather than * building all the circuits and then realizing it won't work. */ log_warn(LD_APP, ""Resolve requests to hidden services not allowed. Failing.""); connection_ap_handshake_socks_resolved(conn,RESOLVED_TYPE_ERROR, 0,NULL,-1,TIME_MAX); connection_mark_unattached_ap(conn, END_STREAM_REASON_SOCKSPROTOCOL | END_STREAM_REASON_FLAG_ALREADY_SOCKS_REPLIED); return -1; } /* If we were passed a circuit, then we need to fail. .onion addresses * only work when we launch our own circuits for now. */ if (circ) { log_warn(LD_CONTROL, ""Attachstream to a circuit is not "" ""supported for .onion addresses currently. Failing.""); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; } /* Look up if we have client authorization configured for this hidden * service. If we do, associate it with the rend_data. */ rend_service_authorization_t *client_auth = rend_client_lookup_service_authorization(socks->address); const uint8_t *cookie = NULL; rend_auth_type_t auth_type = REND_NO_AUTH; if (client_auth) { log_info(LD_REND, ""Using previously configured client authorization "" ""for hidden service request.""); auth_type = client_auth->auth_type; cookie = client_auth->descriptor_cookie; } /* Fill in the rend_data field so we can start doing a connection to * a hidden service. */ rend_data_t *rend_data = ENTRY_TO_EDGE_CONN(conn)->rend_data = rend_data_client_create(socks->address, NULL, (char *) cookie, auth_type); if (rend_data == NULL) { return -1; } const char *onion_address = rend_data_get_address(rend_data); log_info(LD_REND,""Got a hidden service request for ID '%s'"", safe_str_client(onion_address)); /* Lookup the given onion address. If invalid, stop right now. * Otherwise, we might have it in the cache or not. */ unsigned int refetch_desc = 0; rend_cache_entry_t *entry = NULL; const int rend_cache_lookup_result = rend_cache_lookup_entry(onion_address, -1, &entry); if (rend_cache_lookup_result < 0) { switch (-rend_cache_lookup_result) { case EINVAL: /* We should already have rejected this address! */ log_warn(LD_BUG,""Invalid service name '%s'"", safe_str_client(onion_address)); connection_mark_unattached_ap(conn, END_STREAM_REASON_TORPROTOCOL); return -1; case ENOENT: /* We didn't have this; we should look it up. */ refetch_desc = 1; break; default: log_warn(LD_BUG, ""Unknown cache lookup error %d"", rend_cache_lookup_result); return -1; } } /* Help predict that we'll want to do hidden service circuits in the * future. We're not sure if it will need a stable circuit yet, but * we know we'll need *something*. */ rep_hist_note_used_internal(now, 0, 1); /* Now we have a descriptor but is it usable or not? If not, refetch. * Also, a fetch could have been requested if the onion address was not * found in the cache previously. */ if (refetch_desc || !rend_client_any_intro_points_usable(entry)) { connection_ap_mark_as_non_pending_circuit(conn); base_conn->state = AP_CONN_STATE_RENDDESC_WAIT; log_info(LD_REND, ""Unknown descriptor %s. Fetching."", safe_str_client(onion_address)); rend_client_refetch_v2_renddesc(rend_data); return 0; } /* We have the descriptor! So launch a connection to the HS. */ base_conn->state = AP_CONN_STATE_CIRCUIT_WAIT; log_info(LD_REND, ""Descriptor is here. Great.""); /* We'll try to attach it at the next event loop, or whenever * we call connection_ap_attach_pending() */ connection_ap_mark_as_pending_circuit(conn); return 0; } return 0; /* unreached but keeps the compiler happy */ } ",0 "void DelayedExecutor::delayedExecute(const QString &udi) { Solid::Device device(udi); QString exec = m_service.exec(); MacroExpander mx(device); mx.expandMacros(exec); KRun::runCommand(exec, QString(), m_service.icon(), 0); deleteLater(); } ",1 "JSValue jsTestObjReadOnlyStringAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* impl = static_cast(castedThis->impl()); JSValue result = jsString(exec, impl->readOnlyStringAttr()); return result; } ",0 "EvalJsResult GetOriginFromRenderer(FrameTreeNode* ftn) { return EvalJs(ftn, ""self.origin;""); } ",0 "bool WebRuntimeFeatures::isPrefixedEncryptedMediaEnabled() { return RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled(); } ",0 "static int composite_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting) { struct windows_device_priv *priv = _device_priv(dev_handle->dev); return priv->usb_interface[iface].apib-> set_interface_altsetting(priv->usb_interface[iface].sub_api, dev_handle, iface, altsetting); } ",0 "static int sctp_getsockopt_local_addrs(struct sock *sk, int len, char __user *optval, int __user *optlen) { struct sctp_bind_addr *bp; struct sctp_association *asoc; int cnt = 0; struct sctp_getaddrs getaddrs; struct sctp_sockaddr_entry *addr; void __user *to; union sctp_addr temp; struct sctp_sock *sp = sctp_sk(sk); int addrlen; int err = 0; size_t space_left; int bytes_copied = 0; void *addrs; void *buf; if (len < sizeof(struct sctp_getaddrs)) return -EINVAL; if (copy_from_user(&getaddrs, optval, sizeof(struct sctp_getaddrs))) return -EFAULT; /* * For UDP-style sockets, id specifies the association to query. * If the id field is set to the value '0' then the locally bound * addresses are returned without regard to any particular * association. */ if (0 == getaddrs.assoc_id) { bp = &sctp_sk(sk)->ep->base.bind_addr; } else { asoc = sctp_id2assoc(sk, getaddrs.assoc_id); if (!asoc) return -EINVAL; bp = &asoc->base.bind_addr; } to = optval + offsetof(struct sctp_getaddrs, addrs); space_left = len - offsetof(struct sctp_getaddrs, addrs); addrs = kmalloc(space_left, GFP_KERNEL); if (!addrs) return -ENOMEM; /* If the endpoint is bound to 0.0.0.0 or ::0, get the valid * addresses from the global local address list. */ if (sctp_list_single_entry(&bp->address_list)) { addr = list_entry(bp->address_list.next, struct sctp_sockaddr_entry, list); if (sctp_is_any(sk, &addr->a)) { cnt = sctp_copy_laddrs(sk, bp->port, addrs, space_left, &bytes_copied); if (cnt < 0) { err = cnt; goto out; } goto copy_getaddrs; } } buf = addrs; /* Protection on the bound address list is not needed since * in the socket option context we hold a socket lock and * thus the bound address list can't change. */ list_for_each_entry(addr, &bp->address_list, list) { memcpy(&temp, &addr->a, sizeof(temp)); addrlen = sctp_get_pf_specific(sk->sk_family) ->addr_to_user(sp, &temp); if (space_left < addrlen) { err = -ENOMEM; /*fixme: right error?*/ goto out; } memcpy(buf, &temp, addrlen); buf += addrlen; bytes_copied += addrlen; cnt++; space_left -= addrlen; } copy_getaddrs: if (copy_to_user(to, addrs, bytes_copied)) { err = -EFAULT; goto out; } if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) { err = -EFAULT; goto out; } if (put_user(bytes_copied, optlen)) err = -EFAULT; out: kfree(addrs); return err; } ",0 "static int jffs2_do_setattr (struct inode *inode, struct iattr *iattr) { struct jffs2_full_dnode *old_metadata, *new_metadata; struct jffs2_inode_info *f = JFFS2_INODE_INFO(inode); struct jffs2_sb_info *c = JFFS2_SB_INFO(inode->i_sb); struct jffs2_raw_inode *ri; union jffs2_device_node dev; unsigned char *mdata = NULL; int mdatalen = 0; unsigned int ivalid; uint32_t alloclen; int ret; D1(printk(KERN_DEBUG ""jffs2_setattr(): ino #%lu\n"", inode->i_ino)); ret = inode_change_ok(inode, iattr); if (ret) return ret; /* Special cases - we don't want more than one data node for these types on the medium at any time. So setattr /* Special cases - we don't want more than one data node for these types on the medium at any time. So setattr must read the original data associated with the node (i.e. the device numbers or the target name) and write it out again with the appropriate data attached */ if (S_ISBLK(inode->i_mode) || S_ISCHR(inode->i_mode)) { /* For these, we don't actually need to read the old node */ mdatalen = jffs2_encode_dev(&dev, inode->i_rdev); mdata = (char *)&dev; D1(printk(KERN_DEBUG ""jffs2_setattr(): Writing %d bytes of kdev_t\n"", mdatalen)); } else if (S_ISLNK(inode->i_mode)) { down(&f->sem); mdatalen = f->metadata->size; mdata = kmalloc(f->metadata->size, GFP_USER); if (!mdata) { up(&f->sem); return -ENOMEM; } ret = jffs2_read_dnode(c, f, f->metadata, mdata, 0, mdatalen); if (ret) { up(&f->sem); kfree(mdata); return ret; } up(&f->sem); D1(printk(KERN_DEBUG ""jffs2_setattr(): Writing %d bytes of symlink target\n"", mdatalen)); } ri = jffs2_alloc_raw_inode(); if (!ri) { if (S_ISLNK(inode->i_mode)) kfree(mdata); return -ENOMEM; } ret = jffs2_reserve_space(c, sizeof(*ri) + mdatalen, &alloclen, ALLOC_NORMAL, JFFS2_SUMMARY_INODE_SIZE); if (ret) { jffs2_free_raw_inode(ri); if (S_ISLNK(inode->i_mode & S_IFMT)) kfree(mdata); return ret; } down(&f->sem); ivalid = iattr->ia_valid; ri->magic = cpu_to_je16(JFFS2_MAGIC_BITMASK); ri->nodetype = cpu_to_je16(JFFS2_NODETYPE_INODE); ri->totlen = cpu_to_je32(sizeof(*ri) + mdatalen); ri->hdr_crc = cpu_to_je32(crc32(0, ri, sizeof(struct jffs2_unknown_node)-4)); ri->ino = cpu_to_je32(inode->i_ino); ri->version = cpu_to_je32(++f->highest_version); ri->uid = cpu_to_je16((ivalid & ATTR_UID)?iattr->ia_uid:inode->i_uid); ri->gid = cpu_to_je16((ivalid & ATTR_GID)?iattr->ia_gid:inode->i_gid); if (ivalid & ATTR_MODE) if (iattr->ia_mode & S_ISGID && !in_group_p(je16_to_cpu(ri->gid)) && !capable(CAP_FSETID)) ri->mode = cpu_to_jemode(iattr->ia_mode & ~S_ISGID); else ri->mode = cpu_to_jemode(iattr->ia_mode); else ri->mode = cpu_to_jemode(inode->i_mode); ri->isize = cpu_to_je32((ivalid & ATTR_SIZE)?iattr->ia_size:inode->i_size); ri->atime = cpu_to_je32(I_SEC((ivalid & ATTR_ATIME)?iattr->ia_atime:inode->i_atime)); ri->mtime = cpu_to_je32(I_SEC((ivalid & ATTR_MTIME)?iattr->ia_mtime:inode->i_mtime)); ri->ctime = cpu_to_je32(I_SEC((ivalid & ATTR_CTIME)?iattr->ia_ctime:inode->i_ctime)); ri->offset = cpu_to_je32(0); ri->csize = ri->dsize = cpu_to_je32(mdatalen); ri->compr = JFFS2_COMPR_NONE; if (ivalid & ATTR_SIZE && inode->i_size < iattr->ia_size) { /* It's an extension. Make it a hole node */ ri->compr = JFFS2_COMPR_ZERO; ri->dsize = cpu_to_je32(iattr->ia_size - inode->i_size); ri->offset = cpu_to_je32(inode->i_size); } ri->node_crc = cpu_to_je32(crc32(0, ri, sizeof(*ri)-8)); if (mdatalen) ri->data_crc = cpu_to_je32(crc32(0, mdata, mdatalen)); else ri->data_crc = cpu_to_je32(0); new_metadata = jffs2_write_dnode(c, f, ri, mdata, mdatalen, ALLOC_NORMAL); if (S_ISLNK(inode->i_mode)) kfree(mdata); if (IS_ERR(new_metadata)) { jffs2_complete_reservation(c); jffs2_free_raw_inode(ri); up(&f->sem); return PTR_ERR(new_metadata); } /* It worked. Update the inode */ inode->i_atime = ITIME(je32_to_cpu(ri->atime)); inode->i_ctime = ITIME(je32_to_cpu(ri->ctime)); inode->i_mtime = ITIME(je32_to_cpu(ri->mtime)); inode->i_mode = jemode_to_cpu(ri->mode); inode->i_uid = je16_to_cpu(ri->uid); inode->i_gid = je16_to_cpu(ri->gid); old_metadata = f->metadata; if (ivalid & ATTR_SIZE && inode->i_size > iattr->ia_size) jffs2_truncate_fragtree (c, &f->fragtree, iattr->ia_size); if (ivalid & ATTR_SIZE && inode->i_size < iattr->ia_size) { jffs2_add_full_dnode_to_inode(c, f, new_metadata); inode->i_size = iattr->ia_size; f->metadata = NULL; } else { f->metadata = new_metadata; } if (old_metadata) { jffs2_mark_node_obsolete(c, old_metadata->raw); jffs2_free_full_dnode(old_metadata); } jffs2_free_raw_inode(ri); up(&f->sem); jffs2_complete_reservation(c); /* We have to do the vmtruncate() without f->sem held, since some pages may be locked and waiting for it in readpage(). We are protected from a simultaneous write() extending i_size back past iattr->ia_size, because do_truncate() holds the generic inode semaphore. */ if (ivalid & ATTR_SIZE && inode->i_size > iattr->ia_size) vmtruncate(inode, iattr->ia_size); return 0; } ",1 "int GetPageCountFromSettingsDictionary(const DictionaryValue& settings) { int count = 0; const ListValue* page_range_array; if (settings.GetList(printing::kSettingPageRange, &page_range_array)) { for (size_t index = 0; index < page_range_array->GetSize(); ++index) { const DictionaryValue* dict; if (!page_range_array->GetDictionary(index, &dict)) continue; printing::PageRange range; if (!dict->GetInteger(printing::kSettingPageRangeFrom, &range.from) || !dict->GetInteger(printing::kSettingPageRangeTo, &range.to)) { continue; } count += (range.to - range.from) + 1; } } return count; } ",0 "static bool requiresLineBoxForContent(RenderInline* flow, const LineInfo& lineInfo) { RenderObject* parent = flow->parent(); if (flow->document().inNoQuirksMode() && (flow->style(lineInfo.isFirstLine())->lineHeight() != parent->style(lineInfo.isFirstLine())->lineHeight() || flow->style()->verticalAlign() != parent->style()->verticalAlign() || !parent->style()->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(flow->style()->font().fontMetrics()))) return true; return false; } ",0 "bool WebGLRenderingContextBase::ValidateImageBitmap( const char* function_name, ImageBitmap* bitmap, ExceptionState& exception_state) { if (bitmap->IsNeutered()) { SynthesizeGLError(GL_INVALID_VALUE, function_name, ""The source data has been detached.""); return false; } if (!bitmap->OriginClean()) { exception_state.ThrowSecurityError( ""The ImageBitmap contains cross-origin data, and may not be loaded.""); return false; } return true; } ",0 "bool PrintRenderFrameHelper::PrintPreviewContext::CreatePreviewDocument( std::unique_ptr prepared_frame, const std::vector& pages, SkiaDocumentType doc_type) { DCHECK_EQ(INITIALIZED, state_); state_ = RENDERING; prep_frame_view_ = std::move(prepared_frame); prep_frame_view_->StartPrinting(); total_page_count_ = prep_frame_view_->GetExpectedPageCount(); if (total_page_count_ == 0) { LOG(ERROR) << ""CreatePreviewDocument got 0 page count""; set_error(PREVIEW_ERROR_ZERO_PAGES); return false; } metafile_ = base::MakeUnique(doc_type); CHECK(metafile_->Init()); current_page_index_ = 0; pages_to_render_ = pages; std::sort(pages_to_render_.begin(), pages_to_render_.end()); pages_to_render_.resize( std::unique(pages_to_render_.begin(), pages_to_render_.end()) - pages_to_render_.begin()); pages_to_render_.resize(std::lower_bound(pages_to_render_.begin(), pages_to_render_.end(), total_page_count_) - pages_to_render_.begin()); print_ready_metafile_page_count_ = pages_to_render_.size(); if (pages_to_render_.empty()) { print_ready_metafile_page_count_ = total_page_count_; for (int i = 0; i < total_page_count_; ++i) pages_to_render_.push_back(i); } else if (generate_draft_pages_) { int pages_index = 0; for (int i = 0; i < total_page_count_; ++i) { if (pages_index < print_ready_metafile_page_count_ && i == pages_to_render_[pages_index]) { pages_index++; continue; } pages_to_render_.push_back(i); } } document_render_time_ = base::TimeDelta(); begin_time_ = base::TimeTicks::Now(); return true; } ",0 "static void __ip_vs_del_dest(struct ip_vs_dest *dest) { ip_vs_kill_estimator(&dest->stats); /* * Remove it from the d-linked list with the real services. */ write_lock_bh(&__ip_vs_rs_lock); ip_vs_rs_unhash(dest); write_unlock_bh(&__ip_vs_rs_lock); /* * Decrease the refcnt of the dest, and free the dest * if nobody refers to it (refcnt=0). Otherwise, throw * the destination into the trash. */ if (atomic_dec_and_test(&dest->refcnt)) { ip_vs_dst_reset(dest); /* simply decrease svc->refcnt here, let the caller check and release the service if nobody refers to it. Only user context can release destination and service, and only one user context can update virtual service at a time, so the operation here is OK */ atomic_dec(&dest->svc->refcnt); kfree(dest); } else { IP_VS_DBG_BUF(3, ""Moving dest %s:%u into trash, "" ""dest->refcnt=%d\n"", IP_VS_DBG_ADDR(dest->af, &dest->addr), ntohs(dest->port), atomic_read(&dest->refcnt)); list_add(&dest->n_list, &ip_vs_dest_trash); atomic_inc(&dest->refcnt); } } ",0 "static int seek_eof_information (WavpackContext *wpc, int64_t *final_index, int get_wrapper) { int64_t restore_pos, last_pos = -1; WavpackStreamReader64 *reader = wpc->reader; int alt_types = wpc->open_flags & OPEN_ALT_TYPES; uint32_t blocks = 0, audio_blocks = 0; void *id = wpc->wv_in; WavpackHeader wphdr; restore_pos = reader->get_pos (id); // we restore file position when done if (reader->get_length (id) > (int64_t) 1048576) reader->set_pos_rel (id, -1048576, SEEK_END); else reader->set_pos_abs (id, 0); while (1) { uint32_t bcount = read_next_header (reader, id, &wphdr); int64_t current_pos = reader->get_pos (id); if (current_pos == last_pos) { reader->set_pos_abs (id, restore_pos); return FALSE; } last_pos = current_pos; if (bcount == (uint32_t) -1) { if (!blocks) { if (current_pos > (int64_t) 2000000) reader->set_pos_rel (id, -2000000, SEEK_CUR); else reader->set_pos_abs (id, 0); continue; } reader->set_pos_abs (id, restore_pos); return TRUE; } blocks++; if (wphdr.block_samples) { if (final_index) *final_index = GET_BLOCK_INDEX (wphdr) + wphdr.block_samples; audio_blocks++; } else if (!audio_blocks) { if (current_pos > (int64_t) 1048576) reader->set_pos_rel (id, -1048576, SEEK_CUR); else reader->set_pos_abs (id, 0); continue; } bcount = wphdr.ckSize - sizeof (WavpackHeader) + 8; while (bcount >= 2) { unsigned char meta_id, c1, c2; uint32_t meta_bc, meta_size; if (reader->read_bytes (id, &meta_id, 1) != 1 || reader->read_bytes (id, &c1, 1) != 1) { reader->set_pos_abs (id, restore_pos); return FALSE; } meta_bc = c1 << 1; bcount -= 2; if (meta_id & ID_LARGE) { if (bcount < 2 || reader->read_bytes (id, &c1, 1) != 1 || reader->read_bytes (id, &c2, 1) != 1) { reader->set_pos_abs (id, restore_pos); return FALSE; } meta_bc += ((uint32_t) c1 << 9) + ((uint32_t) c2 << 17); bcount -= 2; } meta_size = (meta_id & ID_ODD_SIZE) ? meta_bc - 1 : meta_bc; meta_id &= ID_UNIQUE; if (get_wrapper && (meta_id == ID_RIFF_TRAILER || (alt_types && meta_id == ID_ALT_TRAILER)) && meta_bc) { wpc->wrapper_data = (unsigned char *)realloc (wpc->wrapper_data, wpc->wrapper_bytes + meta_bc); if (!wpc->wrapper_data) { reader->set_pos_abs (id, restore_pos); return FALSE; } if (reader->read_bytes (id, wpc->wrapper_data + wpc->wrapper_bytes, meta_bc) == meta_bc) wpc->wrapper_bytes += meta_size; else { reader->set_pos_abs (id, restore_pos); return FALSE; } } else if (meta_id == ID_MD5_CHECKSUM || (alt_types && meta_id == ID_ALT_MD5_CHECKSUM)) { if (meta_bc == 16 && bcount >= 16) { if (reader->read_bytes (id, wpc->config.md5_checksum, 16) == 16) wpc->config.md5_read = TRUE; else { reader->set_pos_abs (id, restore_pos); return FALSE; } } else reader->set_pos_rel (id, meta_bc, SEEK_CUR); } else reader->set_pos_rel (id, meta_bc, SEEK_CUR); bcount -= meta_bc; } } } ",0 "newFormList(char *action, char *method, char *charset, char *enctype, char *target, char *name, struct form_list *_next) { struct form_list *l; Str a = Strnew_charp(action); int m = FORM_METHOD_GET; int e = FORM_ENCTYPE_URLENCODED; #ifdef USE_M17N wc_ces c = 0; #endif if (method == NULL || !strcasecmp(method, ""get"")) m = FORM_METHOD_GET; else if (!strcasecmp(method, ""post"")) m = FORM_METHOD_POST; else if (!strcasecmp(method, ""internal"")) m = FORM_METHOD_INTERNAL; /* unknown method is regarded as 'get' */ if (m != FORM_METHOD_GET && enctype != NULL && !strcasecmp(enctype, ""multipart/form-data"")) { e = FORM_ENCTYPE_MULTIPART; } #ifdef USE_M17N if (charset != NULL) c = wc_guess_charset(charset, 0); #endif l = New(struct form_list); l->item = l->lastitem = NULL; l->action = a; l->method = m; #ifdef USE_M17N l->charset = c; #endif l->enctype = e; l->target = target; l->name = name; l->next = _next; l->nitems = 0; l->body = NULL; l->length = 0; return l; } ",0 "static int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct kiocb iocb; int ret; init_sync_kiocb(&iocb, NULL); ret = __sock_recvmsg_nosec(&iocb, sock, msg, size, flags); if (-EIOCBQUEUED == ret) ret = wait_on_sync_kiocb(&iocb); return ret; } ",0 "static int decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct priv *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk w; blkcipher_walk_init(&w, dst, src, nbytes); return crypt(desc, &w, ctx, crypto_cipher_alg(ctx->tweak)->cia_encrypt, crypto_cipher_alg(ctx->child)->cia_decrypt); } ",0 "int jas_matrix_cmp(jas_matrix_t *mat0, jas_matrix_t *mat1) { int i; int j; if (mat0->numrows_ != mat1->numrows_ || mat0->numcols_ != mat1->numcols_) { return 1; } for (i = 0; i < mat0->numrows_; i++) { for (j = 0; j < mat0->numcols_; j++) { if (jas_matrix_get(mat0, i, j) != jas_matrix_get(mat1, i, j)) { return 1; } } } return 0; } ",0 "HistogramBase* LinearHistogram::FactoryTimeGet(const char* name, TimeDelta minimum, TimeDelta maximum, uint32_t bucket_count, int32_t flags) { return FactoryTimeGet(std::string(name), minimum, maximum, bucket_count, flags); } ",0 "size_t QuicStreamSequencerBuffer::GetBlockIndex(QuicStreamOffset offset) const { return (offset % max_buffer_capacity_bytes_) / kBlockSizeBytes; } ",0 "void sock_diag_unregister(const struct sock_diag_handler *hnld) { int family = hnld->family; if (family >= AF_MAX) return; mutex_lock(&sock_diag_table_mutex); BUG_ON(sock_diag_handlers[family] != hnld); sock_diag_handlers[family] = NULL; mutex_unlock(&sock_diag_table_mutex); } ",0 "void MetricsWebContentsObserver::OnVisibilityChanged( content::Visibility visibility) { if (web_contents_will_soon_be_destroyed_) return; bool was_in_foreground = in_foreground_; in_foreground_ = visibility == content::Visibility::VISIBLE; if (in_foreground_ == was_in_foreground) return; if (in_foreground_) { if (committed_load_) committed_load_->WebContentsShown(); for (const auto& kv : provisional_loads_) { kv.second->WebContentsShown(); } } else { if (committed_load_) committed_load_->WebContentsHidden(); for (const auto& kv : provisional_loads_) { kv.second->WebContentsHidden(); } } } ",0 "LayoutUnit RenderBox::computePercentageLogicalHeight(const Length& height) { LayoutUnit result = -1; bool skippedAutoHeightContainingBlock = false; RenderBlock* cb = containingBlock(); while (!cb->isRenderView() && !cb->isBody() && !cb->isTableCell() && !cb->isPositioned() && cb->style()->logicalHeight().isAuto()) { if (!document()->inQuirksMode() && !cb->isAnonymousBlock()) break; skippedAutoHeightContainingBlock = true; cb = cb->containingBlock(); cb->addPercentHeightDescendant(this); } bool isPositionedWithSpecifiedHeight = cb->isPositioned() && (!cb->style()->logicalHeight().isAuto() || (!cb->style()->top().isAuto() && !cb->style()->bottom().isAuto())); bool includeBorderPadding = isTable(); if (cb->isTableCell()) { if (!skippedAutoHeightContainingBlock) { if (!cb->hasOverrideSize()) { RenderTableCell* cell = toRenderTableCell(cb); if (scrollsOverflowY() && (!cell->style()->logicalHeight().isAuto() || !cell->table()->style()->logicalHeight().isAuto())) return 0; return -1; } result = cb->overrideHeight(); includeBorderPadding = true; } } else if (cb->style()->logicalHeight().isFixed()) result = cb->computeContentBoxLogicalHeight(cb->style()->logicalHeight().value()); else if (cb->style()->logicalHeight().isPercent() && !isPositionedWithSpecifiedHeight) { result = cb->computePercentageLogicalHeight(cb->style()->logicalHeight()); if (result != -1) result = cb->computeContentBoxLogicalHeight(result); } else if (cb->isRenderView() || (cb->isBody() && document()->inQuirksMode()) || isPositionedWithSpecifiedHeight) { LayoutUnit oldHeight = cb->logicalHeight(); cb->computeLogicalHeight(); result = cb->contentLogicalHeight(); cb->setLogicalHeight(oldHeight); } else if (cb->isRoot() && isPositioned()) result = cb->computeContentBoxLogicalHeight(cb->availableLogicalHeight()); if (result != -1) { result = height.calcValue(result); if (includeBorderPadding) { result -= borderAndPaddingLogicalHeight(); result = max(0, result); } } return result; } ",0 "void CL_Configstrings_f( void ) { int i; int ofs; if ( clc.state != CA_ACTIVE ) { Com_Printf( ""Not connected to a server.\n""); return; } for ( i = 0 ; i < MAX_CONFIGSTRINGS ; i++ ) { ofs = cl.gameState.stringOffsets[ i ]; if ( !ofs ) { continue; } Com_Printf( ""%4i: %s\n"", i, cl.gameState.stringData + ofs ); } } ",0 "WebContents* GetWebContents(int render_process_id, int render_view_id) { content::RenderViewHost* render_view_host = content::RenderViewHost::FromID(render_process_id, render_view_id); if (!render_view_host) return nullptr; return WebContents::FromRenderViewHost(render_view_host); } ",0 "void NavigationController::DiscardTransientEntry() { if (transient_entry_index_ == -1) return; entries_.erase(entries_.begin() + transient_entry_index_); transient_entry_index_ = -1; } ",0 "static int walk_page_buffers(handle_t *handle, struct buffer_head *head, unsigned from, unsigned to, int *partial, int (*fn)(handle_t *handle, struct buffer_head *bh)) { struct buffer_head *bh; unsigned block_start, block_end; unsigned blocksize = head->b_size; int err, ret = 0; struct buffer_head *next; for (bh = head, block_start = 0; ret == 0 && (bh != head || !block_start); block_start = block_end, bh = next) { next = bh->b_this_page; block_end = block_start + blocksize; if (block_end <= from || block_start >= to) { if (partial && !buffer_uptodate(bh)) *partial = 1; continue; } err = (*fn)(handle, bh); if (!ret) ret = err; } return ret; } ",0 " void InitializeWithCORS(const char* url, bool expected, UrlData::CORSMode cors_mode, size_t file_size = kFileSize) { GURL gurl(url); data_source_.reset(new MockMultibufferDataSource( base::ThreadTaskRunnerHandle::Get(), url_index_->GetByUrl(gurl, cors_mode), &host_)); data_source_->SetPreload(preload_); response_generator_.reset(new TestResponseGenerator(gurl, file_size)); EXPECT_CALL(*this, OnInitialize(expected)); data_source_->Initialize(base::Bind( &MultibufferDataSourceTest::OnInitialize, base::Unretained(this))); base::RunLoop().RunUntilIdle(); EXPECT_EQ(data_source_->downloading(), false); } ",0 "void ContentSecurityPolicy::DidSendViolationReport(const String& report) { violation_reports_sent_.insert(report.Impl()->GetHash()); } ",0 "static __be32 nfsd4_encode_fsloc_fsroot(struct xdr_stream *xdr, struct svc_rqst *rqstp, const struct path *path) { struct svc_export *exp_ps; __be32 res; exp_ps = rqst_find_fsidzero_export(rqstp); if (IS_ERR(exp_ps)) return nfserrno(PTR_ERR(exp_ps)); res = nfsd4_encode_path(xdr, &exp_ps->ex_path, path); exp_put(exp_ps); return res; } ",0 "std::string Compress(const std::string& data) { std::string compressed; const bool result = metrics::GzipCompress(data, &compressed); EXPECT_TRUE(result); return compressed; } ",0 "static int isofs_bmap(struct inode *inode, sector_t block) { struct buffer_head dummy; int error; dummy.b_state = 0; dummy.b_blocknr = -1000; error = isofs_get_block(inode, block, &dummy, 0); if (!error) return dummy.b_blocknr; return 0; } ",0 "int nfs4_lock_delegation_recall(struct nfs4_state *state, struct file_lock *fl) { struct nfs_server *server = NFS_SERVER(state->inode); struct nfs4_exception exception = { }; int err; err = nfs4_set_lock_state(state, fl); if (err != 0) goto out; do { err = _nfs4_do_setlk(state, F_SETLK, fl, NFS_LOCK_NEW); switch (err) { default: printk(KERN_ERR ""NFS: %s: unhandled error "" ""%d.\n"", __func__, err); case 0: case -ESTALE: goto out; case -NFS4ERR_EXPIRED: nfs4_schedule_stateid_recovery(server, state); case -NFS4ERR_STALE_CLIENTID: case -NFS4ERR_STALE_STATEID: nfs4_schedule_lease_recovery(server->nfs_client); goto out; case -NFS4ERR_BADSESSION: case -NFS4ERR_BADSLOT: case -NFS4ERR_BAD_HIGH_SLOT: case -NFS4ERR_CONN_NOT_BOUND_TO_SESSION: case -NFS4ERR_DEADSESSION: nfs4_schedule_session_recovery(server->nfs_client->cl_session, err); goto out; case -ERESTARTSYS: /* * The show must go on: exit, but mark the * stateid as needing recovery. */ case -NFS4ERR_DELEG_REVOKED: case -NFS4ERR_ADMIN_REVOKED: case -NFS4ERR_BAD_STATEID: case -NFS4ERR_OPENMODE: nfs4_schedule_stateid_recovery(server, state); err = 0; goto out; case -EKEYEXPIRED: /* * User RPCSEC_GSS context has expired. * We cannot recover this stateid now, so * skip it and allow recovery thread to * proceed. */ err = 0; goto out; case -ENOMEM: case -NFS4ERR_DENIED: /* kill_proc(fl->fl_pid, SIGLOST, 1); */ err = 0; goto out; case -NFS4ERR_DELAY: break; } err = nfs4_handle_exception(server, err, &exception); } while (exception.retry); out: return err; } ",0 "void ImageLoader::DispatchDecodeRequestsIfComplete() { if (!image_complete_) return; bool is_active = GetElement()->GetDocument().IsActive(); if (!is_active || !GetContent() || GetContent()->ErrorOccurred()) { RejectPendingDecodes(); return; } LocalFrame* frame = GetElement()->GetDocument().GetFrame(); for (auto& request : decode_requests_) { if (request->state() != DecodeRequest::kPendingLoad) continue; Image* image = GetContent()->GetImage(); frame->GetChromeClient().RequestDecode( frame, image->PaintImageForCurrentFrame(), WTF::Bind(&ImageLoader::DecodeRequestFinished, WrapCrossThreadWeakPersistent(this), request->request_id())); request->NotifyDecodeDispatched(); } } ",0 "bool FrameLoader::isLoading() const { DocumentLoader* docLoader = activeDocumentLoader(); if (!docLoader) return false; return docLoader->isLoadingMainResource() || docLoader->isLoadingSubresources() || docLoader->isLoadingPlugIns(); } ",0 "enum dm_queue_mode dm_get_md_type(struct mapped_device *md) { return md->type; } ",0 "GF_Err padb_Write(GF_Box *s, GF_BitStream *bs) { u32 i; GF_Err e; GF_PaddingBitsBox *ptr = (GF_PaddingBitsBox *) s; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_int(bs, ptr->SampleCount, 32); for (i=0 ; iSampleCount; i += 2) { gf_bs_write_int(bs, 0, 1); if (i+1 < ptr->SampleCount) { gf_bs_write_int(bs, ptr->padbits[i+1], 3); } else { gf_bs_write_int(bs, 0, 3); } gf_bs_write_int(bs, 0, 1); gf_bs_write_int(bs, ptr->padbits[i], 3); } return GF_OK; } ",0 "static int cm_init_qp_init_attr(struct cm_id_private *cm_id_priv, struct ib_qp_attr *qp_attr, int *qp_attr_mask) { unsigned long flags; int ret; spin_lock_irqsave(&cm_id_priv->lock, flags); switch (cm_id_priv->id.state) { case IB_CM_REQ_SENT: case IB_CM_MRA_REQ_RCVD: case IB_CM_REQ_RCVD: case IB_CM_MRA_REQ_SENT: case IB_CM_REP_RCVD: case IB_CM_MRA_REP_SENT: case IB_CM_REP_SENT: case IB_CM_MRA_REP_RCVD: case IB_CM_ESTABLISHED: *qp_attr_mask = IB_QP_STATE | IB_QP_ACCESS_FLAGS | IB_QP_PKEY_INDEX | IB_QP_PORT; qp_attr->qp_access_flags = IB_ACCESS_REMOTE_WRITE; if (cm_id_priv->responder_resources) qp_attr->qp_access_flags |= IB_ACCESS_REMOTE_READ | IB_ACCESS_REMOTE_ATOMIC; qp_attr->pkey_index = cm_id_priv->av.pkey_index; qp_attr->port_num = cm_id_priv->av.port->port_num; ret = 0; break; default: ret = -EINVAL; break; } spin_unlock_irqrestore(&cm_id_priv->lock, flags); return ret; } ",0 "kuid_t sock_i_uid(struct sock *sk) { kuid_t uid; read_lock_bh(&sk->sk_callback_lock); uid = sk->sk_socket ? SOCK_INODE(sk->sk_socket)->i_uid : GLOBAL_ROOT_UID; read_unlock_bh(&sk->sk_callback_lock); return uid; } ",0 "circle_mul_pt(PG_FUNCTION_ARGS) { CIRCLE *circle = PG_GETARG_CIRCLE_P(0); Point *point = PG_GETARG_POINT_P(1); CIRCLE *result; Point *p; result = circle_copy(circle); p = DatumGetPointP(DirectFunctionCall2(point_mul, PointPGetDatum(&circle->center), PointPGetDatum(point))); result->center.x = p->x; result->center.y = p->y; result->radius *= HYPOT(point->x, point->y); PG_RETURN_CIRCLE_P(result); } ",0 "void SyncBackendHost::Core::DoProcessMessage( const std::string& name, const JsArgList& args, const JsEventHandler* sender) { DCHECK_EQ(MessageLoop::current(), host_->core_thread_.message_loop()); syncapi_->GetJsBackend()->ProcessMessage(name, args, sender); } ",0 "bool ipv6_opt_accepted(const struct sock *sk, const struct sk_buff *skb, const struct inet6_skb_parm *opt) { const struct ipv6_pinfo *np = inet6_sk(sk); if (np->rxopt.all) { if (((opt->flags & IP6SKB_HOPBYHOP) && (np->rxopt.bits.hopopts || np->rxopt.bits.ohopopts)) || (ip6_flowinfo((struct ipv6hdr *) skb_network_header(skb)) && np->rxopt.bits.rxflow) || (opt->srcrt && (np->rxopt.bits.srcrt || np->rxopt.bits.osrcrt)) || ((opt->dst1 || opt->dst0) && (np->rxopt.bits.dstopts || np->rxopt.bits.odstopts))) return true; } return false; } ",0 "void InjectedBundlePage::beganExitFullScreen(WKBundlePageRef, WKRect, WKRect) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) InjectedBundle::shared().outputText(""beganExitFullScreen()\n""); } ",0 "bool HFSBTreeIterator::ReadCurrentLeaf() { if (read_current_leaf_) return true; if (!SeekToNode(current_leaf_number_)) { DLOG(ERROR) << ""Failed to seek to node "" << current_leaf_number_; return false; } if (!stream_->ReadExact(&leaf_data_[0], header_.nodeSize)) { DLOG(ERROR) << ""Failed to read node "" << current_leaf_number_; return false; } auto leaf = reinterpret_cast(&leaf_data_[0]); ConvertBigEndian(leaf); if (leaf->kind != kBTLeafNode) { DLOG(ERROR) << ""Node "" << current_leaf_number_ << "" is not a leaf""; return false; } current_leaf_ = leaf; current_leaf_offset_ = sizeof(BTNodeDescriptor); current_leaf_records_read_ = 0; read_current_leaf_ = true; return true; } ",0 "sshpkt_putb(struct ssh *ssh, const struct sshbuf *b) { return sshbuf_putb(ssh->state->outgoing_packet, b); } ",0 "void WebContentsImpl::HandleMouseDown() { if (delegate_) delegate_->HandleMouseDown(); } ",0 "MagickExport MagickSizeType ReadBlobMSBLongLong(Image *image) { register const unsigned char *p; register MagickSizeType value; ssize_t count; unsigned char buffer[8]; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); *buffer='\0'; p=(const unsigned char *) ReadBlobStream(image,8,buffer,&count); if (count != 8) return(MagickULLConstant(0)); value=(MagickSizeType) (*p++) << 56; value|=(MagickSizeType) (*p++) << 48; value|=(MagickSizeType) (*p++) << 40; value|=(MagickSizeType) (*p++) << 32; value|=(MagickSizeType) (*p++) << 24; value|=(MagickSizeType) (*p++) << 16; value|=(MagickSizeType) (*p++) << 8; value|=(MagickSizeType) (*p++); return(value); } ",0 "wiki_show_changes_page_rss(HttpResponse *res) { WikiPageList **pages = NULL; int n_pages, i; /*char *html_clean_wikitext = NULL; char *wikitext; */ pages = wiki_get_pages(&n_pages, NULL); http_response_printf(res, ""\n"" ""\n"" ""DidiWiki Changes feed\n""); for (i=0; imtime); strftime(datebuf, sizeof(datebuf), ""%Y-%m-%d %H:%M"", pTm); http_response_printf(res, ""%s"" ""%s%s"" ""Modified %s\n"", pages[i]->name, getenv(""DIDIWIKI_URL_PREFIX"") ? getenv(""DIDIWIKI_URL_PREFIX"") : """", pages[i]->name, datebuf); /* wikitext = file_read(pages[i]->name); http_response_printf_alloc_buffer(res, strlen(wikitext)*2); html_clean_wikitext = util_htmlize(wikitext, strlen(wikitext)); wiki_print_data_as_html(res, html_clean_wikitext); */ http_response_printf(res, ""\n""); } http_response_printf(res, ""\n""); http_response_send(res); exit(0); } ",0 "static int genregs_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { int ret = 0; if (kbuf) { const unsigned long *k = kbuf; while (count >= sizeof(*k) && !ret) { ret = putreg(target, pos, *k++); count -= sizeof(*k); pos += sizeof(*k); } } else { const unsigned long __user *u = ubuf; while (count >= sizeof(*u) && !ret) { unsigned long word; ret = __get_user(word, u++); if (ret) break; ret = putreg(target, pos, word); count -= sizeof(*u); pos += sizeof(*u); } } return ret; } ",0 "static void send_metamsg_rsp (UINT8 rc_handle, UINT8 label, tBTA_AV_CODE code, tAVRC_RESPONSE *pmetamsg_resp) { UINT8 ctype; if (!pmetamsg_resp) { BTIF_TRACE_WARNING(""%s: Invalid response received from application"", __FUNCTION__); return; } BTIF_TRACE_EVENT(""+%s: rc_handle: %d, label: %d, code: 0x%02x, pdu: %s"", __FUNCTION__, rc_handle, label, code, dump_rc_pdu(pmetamsg_resp->rsp.pdu)); if (pmetamsg_resp->rsp.status != AVRC_STS_NO_ERROR) { ctype = AVRC_RSP_REJ; } else { if ( code < AVRC_RSP_NOT_IMPL) { if (code == AVRC_CMD_NOTIF) { ctype = AVRC_RSP_INTERIM; } else if (code == AVRC_CMD_STATUS) { ctype = AVRC_RSP_IMPL_STBL; } else { ctype = AVRC_RSP_ACCEPT; } } else { ctype = code; } } /* if response is for register_notification, make sure the rc has actually registered for this */ if((pmetamsg_resp->rsp.pdu == AVRC_PDU_REGISTER_NOTIFICATION) && (code == AVRC_RSP_CHANGED)) { BOOLEAN bSent = FALSE; UINT8 event_id = pmetamsg_resp->reg_notif.event_id; BOOLEAN bNotify = (btif_rc_cb.rc_connected) && (btif_rc_cb.rc_notif[event_id-1].bNotify); /* de-register this notification for a CHANGED response */ btif_rc_cb.rc_notif[event_id-1].bNotify = FALSE; BTIF_TRACE_DEBUG(""%s rc_handle: %d. event_id: 0x%02d bNotify:%u"", __FUNCTION__, btif_rc_cb.rc_handle, event_id, bNotify); if (bNotify) { BT_HDR *p_msg = NULL; tAVRC_STS status; if (AVRC_STS_NO_ERROR == (status = AVRC_BldResponse(btif_rc_cb.rc_handle, pmetamsg_resp, &p_msg)) ) { BTIF_TRACE_DEBUG(""%s Sending notification to rc_handle: %d. event_id: 0x%02d"", __FUNCTION__, btif_rc_cb.rc_handle, event_id); bSent = TRUE; BTA_AvMetaRsp(btif_rc_cb.rc_handle, btif_rc_cb.rc_notif[event_id-1].label, ctype, p_msg); } else { BTIF_TRACE_WARNING(""%s failed to build metamsg response. status: 0x%02x"", __FUNCTION__, status); } } if (!bSent) { BTIF_TRACE_DEBUG(""%s: Notification not sent, as there are no RC connections or the \ CT has not subscribed for event_id: %s"", __FUNCTION__, dump_rc_notification_event_id(event_id)); } } else { /* All other commands go here */ BT_HDR *p_msg = NULL; tAVRC_STS status; status = AVRC_BldResponse(rc_handle, pmetamsg_resp, &p_msg); if (status == AVRC_STS_NO_ERROR) { BTA_AvMetaRsp(rc_handle, label, ctype, p_msg); } else { BTIF_TRACE_ERROR(""%s: failed to build metamsg response. status: 0x%02x"", __FUNCTION__, status); } } } ",0 "static void nick_hash_add(CHANNEL_REC *channel, NICK_REC *nick) { NICK_REC *list; nick->next = NULL; list = g_hash_table_lookup(channel->nicks, nick->nick); if (list == NULL) g_hash_table_insert(channel->nicks, nick->nick, nick); else { /* multiple nicks with same name */ while (list->next != NULL) list = list->next; list->next = nick; } if (nick == channel->ownnick) { /* move our own nick to beginning of the nick list.. */ nicklist_set_own(channel, nick); } } ",0 "PrintPreviewDialogController::~PrintPreviewDialogController() {} ",0 "static void keep_sockalive(SOCKETTYPE fd) { const int tcp_one = 1; #ifndef WIN32 const int tcp_keepidle = 45; const int tcp_keepintvl = 30; int flags = fcntl(fd, F_GETFL, 0); fcntl(fd, F_SETFL, O_NONBLOCK | flags); #else u_long flags = 1; ioctlsocket(fd, FIONBIO, &flags); #endif setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, (const void *)&tcp_one, sizeof(tcp_one)); if (!opt_delaynet) #ifndef __linux setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one)); #else /* __linux */ setsockopt(fd, SOL_TCP, TCP_NODELAY, (const void *)&tcp_one, sizeof(tcp_one)); setsockopt(fd, SOL_TCP, TCP_KEEPCNT, &tcp_one, sizeof(tcp_one)); setsockopt(fd, SOL_TCP, TCP_KEEPIDLE, &tcp_keepidle, sizeof(tcp_keepidle)); setsockopt(fd, SOL_TCP, TCP_KEEPINTVL, &tcp_keepintvl, sizeof(tcp_keepintvl)); #endif /* __linux */ #ifdef __APPLE_CC__ setsockopt(fd, IPPROTO_TCP, TCP_KEEPALIVE, &tcp_keepintvl, sizeof(tcp_keepintvl)); #endif /* __APPLE_CC__ */ } ",0 "static int walk_page_test(unsigned long start, unsigned long end, struct mm_walk *walk) { struct vm_area_struct *vma = walk->vma; if (walk->test_walk) return walk->test_walk(start, end, walk); /* * vma(VM_PFNMAP) doesn't have any valid struct pages behind VM_PFNMAP * range, so we don't walk over it as we do for normal vmas. However, * Some callers are interested in handling hole range and they don't * want to just ignore any single address range. Such users certainly * define their ->pte_hole() callbacks, so let's delegate them to handle * vma(VM_PFNMAP). */ if (vma->vm_flags & VM_PFNMAP) { int err = 1; if (walk->pte_hole) err = walk->pte_hole(start, end, walk); return err ? err : 1; } return 0; } ",0 "PanoramiXRenderReset (void) { int i; for (i = 0; i < RenderNumberRequests; i++) ProcRenderVector[i] = PanoramiXSaveRenderVector[i]; RenderErrBase = 0; } ",0 "static inline MagickBooleanType TracePoint(PrimitiveInfo *primitive_info, const PointInfo point) { primitive_info->coordinates=1; primitive_info->closed_subpath=MagickFalse; primitive_info->point=point; return(MagickTrue); } ",0 "void ewk_view_contents_size_changed(Evas_Object* ewkView, int width, int height) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData); EINA_SAFETY_ON_NULL_RETURN(smartData->api); EINA_SAFETY_ON_NULL_RETURN(smartData->api->contents_resize); if (!smartData->api->contents_resize(smartData, width, height)) ERR(""failed to resize contents to %dx%d"", width, height); } ",0 "void LayerTreeHost::SetVisible(bool visible) { if (visible_ == visible) return; visible_ = visible; proxy_->SetVisible(visible); } ",0 " void HTTPRedirectMethodTest(const GURL& redirect_url, const std::string& request_method, const std::string& redirect_method, bool include_data) { static const char kData[] = ""hello world""; TestDelegate d; URLRequest req(redirect_url, &d, &default_context_); req.set_method(request_method); if (include_data) { req.set_upload(CreateSimpleUploadData(kData).get()); HttpRequestHeaders headers; headers.SetHeader(HttpRequestHeaders::kContentLength, base::UintToString(arraysize(kData) - 1)); req.SetExtraRequestHeaders(headers); } req.Start(); MessageLoop::current()->Run(); EXPECT_EQ(redirect_method, req.method()); EXPECT_EQ(URLRequestStatus::SUCCESS, req.status().status()); EXPECT_EQ(OK, req.status().error()); if (include_data) { if (request_method == redirect_method) { EXPECT_EQ(kData, d.data_received()); } else { EXPECT_NE(kData, d.data_received()); } } if (HasFailure()) LOG(WARNING) << ""Request method was: "" << request_method; } ",0 "bool DesktopWindowTreeHostX11::IsTranslucentWindowOpacitySupported() const { return ui::XVisualManager::GetInstance()->ArgbVisualAvailable(); } ",0 "PageClientBlackBerry::SaveCredentialType WebPagePrivate::notifyShouldSaveCredential(bool isNew) { return static_cast(m_client->notifyShouldSaveCredential(isNew)); } ",0 "void Browser::FormatTitleForDisplay(string16* title) { size_t current_index = 0; size_t match_index; while ((match_index = title->find(L'\n', current_index)) != string16::npos) { title->replace(match_index, 1, string16()); current_index = match_index; } } ",0 "void GLES2DecoderImpl::RenderbufferStorageMultisampleHelper( const FeatureInfo* feature_info, GLenum target, GLsizei samples, GLenum internal_format, GLsizei width, GLsizei height) { if (feature_info->feature_flags().is_angle) { glRenderbufferStorageMultisampleANGLE( target, samples, internal_format, width, height); } else if (feature_info->feature_flags().use_core_framebuffer_multisample) { glRenderbufferStorageMultisample( target, samples, internal_format, width, height); } else { glRenderbufferStorageMultisampleEXT( target, samples, internal_format, width, height); } } ",0 "void ChromeDownloadManagerDelegate::OnCheckDownloadAllowedComplete( content::CheckDownloadAllowedCallback check_download_allowed_cb, bool storage_permission_granted, bool allow) { if (!storage_permission_granted) { } else if (allow) { RecordDownloadSource(DOWNLOAD_INITIATED_BY_NAVIGATION); } else { RecordDownloadCount(CHROME_DOWNLOAD_COUNT_BLOCKED_BY_THROTTLING); } std::move(check_download_allowed_cb).Run(allow); } ",0 "xsltAddTextString(xsltTransformContextPtr ctxt, xmlNodePtr target, const xmlChar *string, int len) { /* * optimization */ if ((len <= 0) || (string == NULL) || (target == NULL)) return(target); if (ctxt->lasttext == target->content) { if (ctxt->lasttuse + len >= ctxt->lasttsize) { xmlChar *newbuf; int size; size = ctxt->lasttsize + len + 100; size *= 2; newbuf = (xmlChar *) xmlRealloc(target->content,size); if (newbuf == NULL) { xsltTransformError(ctxt, NULL, target, ""xsltCopyText: text allocation failed\n""); return(NULL); } ctxt->lasttsize = size; ctxt->lasttext = newbuf; target->content = newbuf; } memcpy(&(target->content[ctxt->lasttuse]), string, len); ctxt->lasttuse += len; target->content[ctxt->lasttuse] = 0; } else { xmlNodeAddContent(target, string); ctxt->lasttext = target->content; len = xmlStrlen(target->content); ctxt->lasttsize = len; ctxt->lasttuse = len; } return(target); } ",0 "static void print_bad_pte(struct vm_area_struct *vma, unsigned long addr, pte_t pte, struct page *page) { pgd_t *pgd = pgd_offset(vma->vm_mm, addr); pud_t *pud = pud_offset(pgd, addr); pmd_t *pmd = pmd_offset(pud, addr); struct address_space *mapping; pgoff_t index; static unsigned long resume; static unsigned long nr_shown; static unsigned long nr_unshown; /* * Allow a burst of 60 reports, then keep quiet for that minute; * or allow a steady drip of one report per second. */ if (nr_shown == 60) { if (time_before(jiffies, resume)) { nr_unshown++; return; } if (nr_unshown) { printk(KERN_ALERT ""BUG: Bad page map: %lu messages suppressed\n"", nr_unshown); nr_unshown = 0; } nr_shown = 0; } if (nr_shown++ == 0) resume = jiffies + 60 * HZ; mapping = vma->vm_file ? vma->vm_file->f_mapping : NULL; index = linear_page_index(vma, addr); printk(KERN_ALERT ""BUG: Bad page map in process %s pte:%08llx pmd:%08llx\n"", current->comm, (long long)pte_val(pte), (long long)pmd_val(*pmd)); if (page) dump_page(page); printk(KERN_ALERT ""addr:%p vm_flags:%08lx anon_vma:%p mapping:%p index:%lx\n"", (void *)addr, vma->vm_flags, vma->anon_vma, mapping, index); /* * Choose text because data symbols depend on CONFIG_KALLSYMS_ALL=y */ if (vma->vm_ops) print_symbol(KERN_ALERT ""vma->vm_ops->fault: %s\n"", (unsigned long)vma->vm_ops->fault); if (vma->vm_file && vma->vm_file->f_op) print_symbol(KERN_ALERT ""vma->vm_file->f_op->mmap: %s\n"", (unsigned long)vma->vm_file->f_op->mmap); dump_stack(); add_taint(TAINT_BAD_PAGE, LOCKDEP_NOW_UNRELIABLE); } ",0 "static void ssl_check_for_safari(SSL *s, const unsigned char *data, const unsigned char *d, int n) { unsigned short type, size; static const unsigned char kSafariExtensionsBlock[] = { 0x00, 0x0a, /* elliptic_curves extension */ 0x00, 0x08, /* 8 bytes */ 0x00, 0x06, /* 6 bytes of curve ids */ 0x00, 0x17, /* P-256 */ 0x00, 0x18, /* P-384 */ 0x00, 0x19, /* P-521 */ 0x00, 0x0b, /* ec_point_formats */ 0x00, 0x02, /* 2 bytes */ 0x01, /* 1 point format */ 0x00, /* uncompressed */ }; /* The following is only present in TLS 1.2 */ static const unsigned char kSafariTLS12ExtensionsBlock[] = { 0x00, 0x0d, /* signature_algorithms */ 0x00, 0x0c, /* 12 bytes */ 0x00, 0x0a, /* 10 bytes */ 0x05, 0x01, /* SHA-384/RSA */ 0x04, 0x01, /* SHA-256/RSA */ 0x02, 0x01, /* SHA-1/RSA */ 0x04, 0x03, /* SHA-256/ECDSA */ 0x02, 0x03, /* SHA-1/ECDSA */ }; if (data >= (d + n - 2)) return; data += 2; if (data > (d + n - 4)) return; n2s(data, type); n2s(data, size); if (type != TLSEXT_TYPE_server_name) return; if (data + size > d + n) return; data += size; if (TLS1_get_client_version(s) >= TLS1_2_VERSION) { const size_t len1 = sizeof(kSafariExtensionsBlock); const size_t len2 = sizeof(kSafariTLS12ExtensionsBlock); if (data + len1 + len2 != d + n) return; if (memcmp(data, kSafariExtensionsBlock, len1) != 0) return; if (memcmp(data + len1, kSafariTLS12ExtensionsBlock, len2) != 0) return; } else { const size_t len = sizeof(kSafariExtensionsBlock); if (data + len != d + n) return; if (memcmp(data, kSafariExtensionsBlock, len) != 0) return; } s->s3->is_probably_safari = 1; } ",0 "SecurityFunctionTableA* sspi_GetSecurityFunctionTableAByNameW(const SEC_WCHAR* Name) { return NULL; } ",0 "upnpevents_renewSubscription(const char * sid, int sidlen, int timeout) { struct subscriber * sub; for(sub = subscriberlist.lh_first; sub != NULL; sub = sub->entries.le_next) { if((sidlen == 41) && (memcmp(sid, sub->uuid, 41) == 0)) { #ifdef UPNP_STRICT /* check if the subscription already timeouted */ if(sub->timeout && upnp_time() > sub->timeout) continue; #endif sub->timeout = (timeout ? upnp_time() + timeout : 0); return sub->uuid; } } return NULL; } ",0 "static int cliAuth(void) { redisReply *reply; if (config.auth == NULL) return REDIS_OK; reply = redisCommand(context,""AUTH %s"",config.auth); if (reply != NULL) { freeReplyObject(reply); return REDIS_OK; } return REDIS_ERR; } ",0 "AutocompleteMatch HistoryQuickProvider::QuickMatchToACMatch( const ScoredHistoryMatch& history_match, int score) { const history::URLRow& info = history_match.url_info; AutocompleteMatch match(this, score, !!info.visit_count(), history_match.url_matches.empty() ? AutocompleteMatch::HISTORY_URL : AutocompleteMatch::HISTORY_TITLE); match.destination_url = info.url(); DCHECK(match.destination_url.is_valid()); std::vector offsets = OffsetsFromTermMatches(history_match.url_matches); const net::FormatUrlTypes format_types = net::kFormatUrlOmitAll & ~(!history_match.match_in_scheme ? 0 : net::kFormatUrlOmitHTTP); match.fill_into_edit = AutocompleteInput::FormattedStringWithEquivalentMeaning(info.url(), net::FormatUrlWithOffsets(info.url(), languages_, format_types, net::UnescapeRule::SPACES, NULL, NULL, &offsets)); history::TermMatches new_matches = ReplaceOffsetsInTermMatches(history_match.url_matches, offsets); match.contents = net::FormatUrl(info.url(), languages_, format_types, net::UnescapeRule::SPACES, NULL, NULL, NULL); match.contents_class = SpansFromTermMatch(new_matches, match.contents.length(), true); if (!history_match.can_inline) { match.inline_autocomplete_offset = string16::npos; } else { DCHECK(!new_matches.empty()); match.inline_autocomplete_offset = new_matches[0].offset + new_matches[0].length; if (match.inline_autocomplete_offset > match.fill_into_edit.length()) match.inline_autocomplete_offset = match.fill_into_edit.length(); } match.description = info.title(); match.description_class = SpansFromTermMatch( history_match.title_matches, match.description.length(), false); return match; } ",1 "error::Error GLES2DecoderImpl::HandleCompressedTexImage2DBucket( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::CompressedTexImage2DBucket& c = *static_cast(cmd_data); GLenum target = static_cast(c.target); GLint level = static_cast(c.level); GLenum internal_format = static_cast(c.internalformat); GLsizei width = static_cast(c.width); GLsizei height = static_cast(c.height); GLint border = static_cast(c.border); Bucket* bucket = GetBucket(c.bucket_id); if (!bucket) { return error::kInvalidArguments; } uint32 data_size = bucket->size(); GLsizei imageSize = data_size; const void* data = bucket->GetData(0, data_size); if (!data) { return error::kInvalidArguments; } return DoCompressedTexImage2D( target, level, internal_format, width, height, border, imageSize, data); } ",0 "daemon_linux_lvm2_vg_start (Daemon *daemon, const gchar *uuid, char **options, DBusGMethodInvocation *context) { daemon_local_check_auth (daemon, NULL, ""org.freedesktop.udisks.linux-lvm2"", ""LinuxLvm2VGStart"", TRUE, daemon_linux_lvm2_vg_start_authorized_cb, context, 2, g_strdup (uuid), g_free, g_strdupv (options), g_strfreev); return TRUE; } ",0 "int get_camera_metadata_entry(camera_metadata_t *src, size_t index, camera_metadata_entry_t *entry) { if (src == NULL || entry == NULL) return ERROR; if (index >= src->entry_count) return ERROR; camera_metadata_buffer_entry_t *buffer_entry = get_entries(src) + index; entry->index = index; entry->tag = buffer_entry->tag; entry->type = buffer_entry->type; entry->count = buffer_entry->count; if (buffer_entry->count * camera_metadata_type_size[buffer_entry->type] > 4) { entry->data.u8 = get_data(src) + buffer_entry->data.offset; } else { entry->data.u8 = buffer_entry->data.value; } return OK; } ",0 " void ClassicPendingScript::SetStreamer(ScriptStreamer* streamer) { DCHECK(streamer); DCHECK(!streamer_); DCHECK(!IsWatchingForLoad() || ready_state_ != kWaitingForResource); DCHECK(!streamer->IsFinished()); DCHECK(ready_state_ == kWaitingForResource || ready_state_ == kReady); streamer_ = streamer; is_currently_streaming_ = true; if (streamer && ready_state_ == kReady) AdvanceReadyState(kReadyStreaming); CheckState(); } ",0 "bool AutocompleteEditModel::OnAfterPossibleChange( const string16& old_text, const string16& new_text, size_t selection_start, size_t selection_end, bool selection_differs, bool text_differs, bool just_deleted_text, bool allow_keyword_ui_change) { if (paste_state_ == PASTING) paste_state_ = PASTED; else if (text_differs) paste_state_ = NONE; const bool user_text_changed = text_differs || (selection_differs && !inline_autocomplete_text_.empty()); if ((text_differs || selection_differs) && (control_key_state_ == DOWN_WITHOUT_CHANGE)) { control_key_state_ = DOWN_WITH_CHANGE; if (!text_differs && !popup_->IsOpen()) return false; // Don't open the popup for no reason. } else if (!user_text_changed) { return false; } if (user_text_changed) { InternalSetUserText(UserTextFromDisplayText(new_text)); has_temporary_text_ = false; just_deleted_text_ = just_deleted_text; } const bool no_selection = selection_start == selection_end; allow_exact_keyword_match_ = text_differs && allow_keyword_ui_change && !just_deleted_text && no_selection && CreatedKeywordSearchByInsertingSpaceInMiddle(old_text, user_text_, selection_start); view_->UpdatePopup(); allow_exact_keyword_match_ = false; return !(text_differs && allow_keyword_ui_change && !just_deleted_text && no_selection && (selection_start == user_text_.length()) && MaybeAcceptKeywordBySpace(user_text_)); } ",0 "xps_select_font_encoding(xps_font_t *font, int idx) { byte *cmapdata, *entry; int pid, eid; if (idx < 0 || idx >= font->cmapsubcount) return; cmapdata = font->data + font->cmaptable; entry = cmapdata + 4 + idx * 8; pid = u16(entry + 0); eid = u16(entry + 2); font->cmapsubtable = font->cmaptable + u32(entry + 4); font->usepua = (pid == 3 && eid == 0); } ",0 "bool ChromePasswordManagerClient::IsFillingFallbackEnabled( const GURL& url) const { return IsFillingEnabled(url) && !Profile::FromBrowserContext(web_contents()->GetBrowserContext()) ->IsGuestSession(); } ",0 "static Sdb *store_versioninfo_gnu_verneed(ELFOBJ *bin, Elf_(Shdr) *shdr, int sz) { ut8 *end, *need = NULL; const char *section_name = """"; Elf_(Shdr) *link_shdr = NULL; const char *link_section_name = """"; Sdb *sdb_vernaux = NULL; Sdb *sdb_version = NULL; Sdb *sdb = NULL; int i, cnt; if (!bin || !bin->dynstr) { return NULL; } if (shdr->sh_link > bin->ehdr.e_shnum) { return NULL; } if (shdr->sh_size < 1 || shdr->sh_size > SIZE_MAX) { return NULL; } sdb = sdb_new0 (); if (!sdb) { return NULL; } link_shdr = &bin->shdr[shdr->sh_link]; if (bin->shstrtab && shdr->sh_name < bin->shstrtab_size) { section_name = &bin->shstrtab[shdr->sh_name]; } if (bin->shstrtab && link_shdr->sh_name < bin->shstrtab_size) { link_section_name = &bin->shstrtab[link_shdr->sh_name]; } if (!(need = (ut8*) calloc (R_MAX (1, shdr->sh_size), sizeof (ut8)))) { bprintf (""Warning: Cannot allocate memory for Elf_(Verneed)\n""); goto beach; } end = need + shdr->sh_size; sdb_set (sdb, ""section_name"", section_name, 0); sdb_num_set (sdb, ""num_entries"", shdr->sh_info, 0); sdb_num_set (sdb, ""addr"", shdr->sh_addr, 0); sdb_num_set (sdb, ""offset"", shdr->sh_offset, 0); sdb_num_set (sdb, ""link"", shdr->sh_link, 0); sdb_set (sdb, ""link_section_name"", link_section_name, 0); if (shdr->sh_offset > bin->size || shdr->sh_offset + shdr->sh_size > bin->size) { goto beach; } if (shdr->sh_offset + shdr->sh_size < shdr->sh_size) { goto beach; } i = r_buf_read_at (bin->b, shdr->sh_offset, need, shdr->sh_size); if (i < 0) goto beach; for (i = 0, cnt = 0; cnt < shdr->sh_info; ++cnt) { int j, isum; ut8 *vstart = need + i; Elf_(Verneed) vvn = {0}; if (vstart + sizeof (Elf_(Verneed)) > end) { goto beach; } Elf_(Verneed) *entry = &vvn; char key[32] = {0}; sdb_version = sdb_new0 (); if (!sdb_version) { goto beach; } j = 0; vvn.vn_version = READ16 (vstart, j) vvn.vn_cnt = READ16 (vstart, j) vvn.vn_file = READ32 (vstart, j) vvn.vn_aux = READ32 (vstart, j) vvn.vn_next = READ32 (vstart, j) sdb_num_set (sdb_version, ""vn_version"", entry->vn_version, 0); sdb_num_set (sdb_version, ""idx"", i, 0); if (entry->vn_file > bin->dynstr_size) { goto beach; } { char *s = r_str_ndup (&bin->dynstr[entry->vn_file], 16); sdb_set (sdb_version, ""file_name"", s, 0); free (s); } sdb_num_set (sdb_version, ""cnt"", entry->vn_cnt, 0); st32 vnaux = entry->vn_aux; if (vnaux < 1) { goto beach; } vstart += vnaux; for (j = 0, isum = i + entry->vn_aux; j < entry->vn_cnt && vstart + sizeof (Elf_(Vernaux)) <= end; ++j) { int k; Elf_(Vernaux) * aux = NULL; Elf_(Vernaux) vaux = {0}; sdb_vernaux = sdb_new0 (); if (!sdb_vernaux) { goto beach; } aux = (Elf_(Vernaux)*)&vaux; k = 0; vaux.vna_hash = READ32 (vstart, k) vaux.vna_flags = READ16 (vstart, k) vaux.vna_other = READ16 (vstart, k) vaux.vna_name = READ32 (vstart, k) vaux.vna_next = READ32 (vstart, k) if (aux->vna_name > bin->dynstr_size) { goto beach; } sdb_num_set (sdb_vernaux, ""idx"", isum, 0); if (aux->vna_name > 0 && aux->vna_name + 8 < bin->dynstr_size) { char name [16]; strncpy (name, &bin->dynstr[aux->vna_name], sizeof (name)-1); name[sizeof(name)-1] = 0; sdb_set (sdb_vernaux, ""name"", name, 0); } sdb_set (sdb_vernaux, ""flags"", get_ver_flags (aux->vna_flags), 0); sdb_num_set (sdb_vernaux, ""version"", aux->vna_other, 0); isum += aux->vna_next; vstart += aux->vna_next; snprintf (key, sizeof (key), ""vernaux%d"", j); sdb_ns_set (sdb_version, key, sdb_vernaux); } if ((int)entry->vn_next < 0) { bprintf (""Invalid vn_next\n""); break; } i += entry->vn_next; snprintf (key, sizeof (key), ""version%d"", cnt ); sdb_ns_set (sdb, key, sdb_version); if (!entry->vn_next) { break; } } free (need); return sdb; beach: free (need); sdb_free (sdb_vernaux); sdb_free (sdb_version); sdb_free (sdb); return NULL; } ",0 "static int64_t add_index_entry(AVStream *st, int64_t pos, int64_t timestamp, int size, int distance, int flags) { AVIndexEntry *entries, *ie; int64_t index = -1; const size_t min_size_needed = (st->nb_index_entries + 1) * sizeof(AVIndexEntry); const size_t requested_size = min_size_needed > st->index_entries_allocated_size ? FFMAX(min_size_needed, 2 * st->index_entries_allocated_size) : min_size_needed; if((unsigned)st->nb_index_entries + 1 >= UINT_MAX / sizeof(AVIndexEntry)) return -1; entries = av_fast_realloc(st->index_entries, &st->index_entries_allocated_size, requested_size); if(!entries) return -1; st->index_entries= entries; index= st->nb_index_entries++; ie= &entries[index]; ie->pos = pos; ie->timestamp = timestamp; ie->min_distance= distance; ie->size= size; ie->flags = flags; return index; } ",0 "bool BrowserWindowGtk::UseCustomFrame() const { return use_custom_frame_pref_.GetValue() && !browser_->is_app(); } ",0 "static void check_preempt_curr(struct rq *rq, struct task_struct *p, int flags) { const struct sched_class *class; if (p->sched_class == rq->curr->sched_class) { rq->curr->sched_class->check_preempt_curr(rq, p, flags); } else { for_each_class(class) { if (class == rq->curr->sched_class) break; if (class == p->sched_class) { resched_task(rq->curr); break; } } } /* * A queue event has occurred, and we're going to schedule. In * this case, we can save a useless back to back clock update. */ if (rq->curr->on_rq && test_tsk_need_resched(rq->curr)) rq->skip_clock_update = 1; } ",0 "void vorbis_book_clear(codebook *b){ /* static book is not cleared; we're likely called on the lookup and the static codebook belongs to the info struct */ if(b->q_val)_ogg_free(b->q_val); if(b->dec_table)_ogg_free(b->dec_table); if(b->dec_buf)_ogg_free(b->dec_buf); memset(b,0,sizeof(*b)); } ",0 "void RenderViewHostImpl::OnDidStartLoading() { delegate_->DidStartLoading(this); } ",0 "static int ecb_crypt(struct blkcipher_desc *desc, struct blkcipher_walk *walk, void (*fn)(struct bf_ctx *, u8 *, const u8 *), void (*fn_4way)(struct bf_ctx *, u8 *, const u8 *)) { struct bf_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); unsigned int bsize = BF_BLOCK_SIZE; unsigned int nbytes; int err; err = blkcipher_walk_virt(desc, walk); while ((nbytes = walk->nbytes)) { u8 *wsrc = walk->src.virt.addr; u8 *wdst = walk->dst.virt.addr; /* Process four block batch */ if (nbytes >= bsize * 4) { do { fn_4way(ctx, wdst, wsrc); wsrc += bsize * 4; wdst += bsize * 4; nbytes -= bsize * 4; } while (nbytes >= bsize * 4); if (nbytes < bsize) goto done; } /* Handle leftovers */ do { fn(ctx, wdst, wsrc); wsrc += bsize; wdst += bsize; nbytes -= bsize; } while (nbytes >= bsize); done: err = blkcipher_walk_done(desc, walk, nbytes); } return err; } ",0 "void WebContext::init( const QWeakPointer& io_client) { delegate_->Init(io_client); } ",0 "static bool WebAccessibilityNotificationToViewHostMsg( WebAccessibilityNotification notification, ViewHostMsg_AccessibilityNotification_Type::Value* type) { switch (notification) { case WebKit::WebAccessibilityNotificationCheckedStateChanged: *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHECK_STATE_CHANGED; break; case WebKit::WebAccessibilityNotificationChildrenChanged: *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_CHILDREN_CHANGED; break; case WebKit::WebAccessibilityNotificationFocusedUIElementChanged: *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_FOCUS_CHANGED; break; case WebKit::WebAccessibilityNotificationLoadComplete: *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_LOAD_COMPLETE; break; case WebKit::WebAccessibilityNotificationValueChanged: *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_VALUE_CHANGED; break; case WebKit::WebAccessibilityNotificationSelectedTextChanged: *type = ViewHostMsg_AccessibilityNotification_Type:: NOTIFICATION_TYPE_SELECTED_TEXT_CHANGED; break; default: return false; } return true; } ",0 "static void usb_audio_disconnect(struct usb_interface *intf) { struct snd_usb_audio *chip = usb_get_intfdata(intf); struct snd_card *card; struct list_head *p; if (chip == (void *)-1L) return; card = chip->card; mutex_lock(®ister_mutex); if (atomic_inc_return(&chip->shutdown) == 1) { struct snd_usb_stream *as; struct snd_usb_endpoint *ep; struct usb_mixer_interface *mixer; /* wait until all pending tasks done; * they are protected by snd_usb_lock_shutdown() */ wait_event(chip->shutdown_wait, !atomic_read(&chip->usage_count)); snd_card_disconnect(card); /* release the pcm resources */ list_for_each_entry(as, &chip->pcm_list, list) { snd_usb_stream_disconnect(as); } /* release the endpoint resources */ list_for_each_entry(ep, &chip->ep_list, list) { snd_usb_endpoint_release(ep); } /* release the midi resources */ list_for_each(p, &chip->midi_list) { snd_usbmidi_disconnect(p); } /* release mixer resources */ list_for_each_entry(mixer, &chip->mixer_list, list) { snd_usb_mixer_disconnect(mixer); } } chip->num_interfaces--; if (chip->num_interfaces <= 0) { usb_chip[chip->index] = NULL; mutex_unlock(®ister_mutex); snd_card_free_when_closed(card); } else { mutex_unlock(®ister_mutex); } } ",0 "static void free_ftrace_hash(struct ftrace_hash *hash) { if (!hash || hash == EMPTY_HASH) return; ftrace_hash_clear(hash); kfree(hash->buckets); kfree(hash); } ",0 "void FakeCrosDisksClient::Format(const std::string& device_path, const std::string& filesystem, VoidDBusMethodCallback callback) { DCHECK(!callback.is_null()); format_call_count_++; last_format_device_path_ = device_path; last_format_filesystem_ = filesystem; base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(std::move(callback), format_success_)); } ",0 "http_GetReq(const struct http *hp) { Tcheck(hp->hd[HTTP_HDR_REQ]); return (hp->hd[HTTP_HDR_REQ].b); } ",0 "static int __x86_pmu_event_init(struct perf_event *event) { int err; if (!x86_pmu_initialized()) return -ENODEV; err = 0; if (!atomic_inc_not_zero(&active_events)) { mutex_lock(&pmc_reserve_mutex); if (atomic_read(&active_events) == 0) { if (!reserve_pmc_hardware()) err = -EBUSY; else reserve_ds_buffers(); } if (!err) atomic_inc(&active_events); mutex_unlock(&pmc_reserve_mutex); } if (err) return err; event->destroy = hw_perf_event_destroy; event->hw.idx = -1; event->hw.last_cpu = -1; event->hw.last_tag = ~0ULL; return x86_pmu.hw_config(event); } ",0 "static int ipip6_tunnel_init(struct net_device *dev) { struct ip_tunnel *tunnel = netdev_priv(dev); tunnel->dev = dev; strcpy(tunnel->parms.name, dev->name); memcpy(dev->dev_addr, &tunnel->parms.iph.saddr, 4); memcpy(dev->broadcast, &tunnel->parms.iph.daddr, 4); ipip6_tunnel_bind_dev(dev); dev->tstats = alloc_percpu(struct pcpu_tstats); if (!dev->tstats) return -ENOMEM; return 0; } ",0 "PassRefPtr Document::createElementNS(const AtomicString& namespaceURI, const String& qualifiedName, const AtomicString& typeExtension, ExceptionCode& ec) { String prefix, localName; if (!parseQualifiedName(qualifiedName, prefix, localName, ec)) return 0; QualifiedName qName(prefix, localName, namespaceURI); if (!hasValidNamespaceForElements(qName)) { ec = NAMESPACE_ERR; return 0; } if (m_registry) { if (PassRefPtr created = m_registry->createElement(qName, typeExtension)) return created; } return setTypeExtension(createElementNS(namespaceURI, qualifiedName, ec), typeExtension); } ",0 "void ExtensionFunctionDispatcher::GetAllFunctionNames( std::vector* names) { ExtensionFunctionRegistry::GetInstance()->GetAllNames(names); } ",0 "static inline int do_refcount_check(struct mount *mnt, int count) { int mycount = mnt_get_count(mnt) - mnt->mnt_ghosts; return (mycount > count); } ",0 "long long VideoTrack::GetDisplayWidth() const { return m_display_width > 0 ? m_display_width : GetWidth(); } ",0 "Eina_Bool ewk_view_reload_full(Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); return ewk_frame_reload_full(smartData->main_frame); } ",0 "void XIBarrierRemoveMasterDevice(ClientPtr client, int deviceid) { FindClientResourcesByType(client, PointerBarrierType, remove_master_func, &deviceid); } ",0 "activation_parameters_free (ActivateParameters *parameters) { if (parameters->timed_wait_active) { eel_timed_wait_stop (cancel_activate_callback, parameters); } if (parameters->slot) { g_object_remove_weak_pointer (G_OBJECT (parameters->slot), (gpointer *) ¶meters->slot); } if (parameters->parent_window) { g_object_remove_weak_pointer (G_OBJECT (parameters->parent_window), (gpointer *) ¶meters->parent_window); } g_object_unref (parameters->cancellable); launch_location_list_free (parameters->locations); nautilus_file_list_free (parameters->mountables); nautilus_file_list_free (parameters->start_mountables); nautilus_file_list_free (parameters->not_mounted); g_free (parameters->activation_directory); g_free (parameters->timed_wait_prompt); g_assert (parameters->files_handle == NULL); g_free (parameters); } ",0 "static int check_call(struct bpf_verifier_env *env, int func_id, int insn_idx) { const struct bpf_func_proto *fn = NULL; struct bpf_reg_state *regs; struct bpf_call_arg_meta meta; bool changes_data; int i, err; /* find function prototype */ if (func_id < 0 || func_id >= __BPF_FUNC_MAX_ID) { verbose(env, ""invalid func %s#%d\n"", func_id_name(func_id), func_id); return -EINVAL; } if (env->ops->get_func_proto) fn = env->ops->get_func_proto(func_id); if (!fn) { verbose(env, ""unknown func %s#%d\n"", func_id_name(func_id), func_id); return -EINVAL; } /* eBPF programs must be GPL compatible to use GPL-ed functions */ if (!env->prog->gpl_compatible && fn->gpl_only) { verbose(env, ""cannot call GPL only function from proprietary program\n""); return -EINVAL; } changes_data = bpf_helper_changes_pkt_data(fn->func); memset(&meta, 0, sizeof(meta)); meta.pkt_access = fn->pkt_access; /* We only support one arg being in raw mode at the moment, which * is sufficient for the helper functions we have right now. */ err = check_raw_mode(fn); if (err) { verbose(env, ""kernel subsystem misconfigured func %s#%d\n"", func_id_name(func_id), func_id); return err; } /* check args */ err = check_func_arg(env, BPF_REG_1, fn->arg1_type, &meta); if (err) return err; err = check_func_arg(env, BPF_REG_2, fn->arg2_type, &meta); if (err) return err; err = check_func_arg(env, BPF_REG_3, fn->arg3_type, &meta); if (err) return err; err = check_func_arg(env, BPF_REG_4, fn->arg4_type, &meta); if (err) return err; err = check_func_arg(env, BPF_REG_5, fn->arg5_type, &meta); if (err) return err; /* Mark slots with STACK_MISC in case of raw mode, stack offset * is inferred from register state. */ for (i = 0; i < meta.access_size; i++) { err = check_mem_access(env, insn_idx, meta.regno, i, BPF_B, BPF_WRITE, -1); if (err) return err; } regs = cur_regs(env); /* reset caller saved regs */ for (i = 0; i < CALLER_SAVED_REGS; i++) { mark_reg_not_init(env, regs, caller_saved[i]); check_reg_arg(env, caller_saved[i], DST_OP_NO_MARK); } /* update return register (already marked as written above) */ if (fn->ret_type == RET_INTEGER) { /* sets type to SCALAR_VALUE */ mark_reg_unknown(env, regs, BPF_REG_0); } else if (fn->ret_type == RET_VOID) { regs[BPF_REG_0].type = NOT_INIT; } else if (fn->ret_type == RET_PTR_TO_MAP_VALUE_OR_NULL) { struct bpf_insn_aux_data *insn_aux; regs[BPF_REG_0].type = PTR_TO_MAP_VALUE_OR_NULL; /* There is no offset yet applied, variable or fixed */ mark_reg_known_zero(env, regs, BPF_REG_0); regs[BPF_REG_0].off = 0; /* remember map_ptr, so that check_map_access() * can check 'value_size' boundary of memory access * to map element returned from bpf_map_lookup_elem() */ if (meta.map_ptr == NULL) { verbose(env, ""kernel subsystem misconfigured verifier\n""); return -EINVAL; } regs[BPF_REG_0].map_ptr = meta.map_ptr; regs[BPF_REG_0].id = ++env->id_gen; insn_aux = &env->insn_aux_data[insn_idx]; if (!insn_aux->map_ptr) insn_aux->map_ptr = meta.map_ptr; else if (insn_aux->map_ptr != meta.map_ptr) insn_aux->map_ptr = BPF_MAP_PTR_POISON; } else { verbose(env, ""unknown return type %d of func %s#%d\n"", fn->ret_type, func_id_name(func_id), func_id); return -EINVAL; } err = check_map_func_compatibility(env, meta.map_ptr, func_id); if (err) return err; if (changes_data) clear_all_pkt_pointers(env); return 0; } ",0 "struct btrfs_dir_item *btrfs_lookup_dir_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, u64 dir, const char *name, int name_len, int mod) { int ret; struct btrfs_key key; int ins_len = mod < 0 ? -1 : 0; int cow = mod != 0; key.objectid = dir; btrfs_set_key_type(&key, BTRFS_DIR_ITEM_KEY); key.offset = btrfs_name_hash(name, name_len); ret = btrfs_search_slot(trans, root, &key, path, ins_len, cow); if (ret < 0) return ERR_PTR(ret); if (ret > 0) return NULL; return btrfs_match_dir_item_name(root, path, name, name_len); } ",0 "R_API RList *r_bin_get_entries(RBin *bin) { RBinObject *o = r_bin_cur_object (bin); return o? o->entries: NULL; } ",0 "uint32_t DefragTrackerSpareQueueGetSize(void) { return DefragTrackerQueueLen(&defragtracker_spare_q); } ",0 "int check_tm_pred8x8_mode(int mode, int mb_x, int mb_y, int vp7) { if (!mb_x) return mb_y ? VERT_PRED8x8 : (vp7 ? DC_128_PRED8x8 : DC_129_PRED8x8); else return mb_y ? mode : HOR_PRED8x8; } ",0 " std::unique_ptr WaitForWarmupRequest( base::RunLoop* run_loop, const net::test_server::HttpRequest& request) { auto response = std::make_unique(); if (base::StartsWith(request.relative_url, ""/e2e_probe"", base::CompareCase::SENSITIVE)) { run_loop->Quit(); response->set_content(""content""); response->AddCustomHeader(""via"", via_header_); const auto user_agent = request.headers.find(net::HttpRequestHeaders::kUserAgent); EXPECT_TRUE(user_agent != request.headers.end()); EXPECT_THAT(user_agent->second, HasSubstr(""Chrome/"")); } else if (base::StartsWith(request.relative_url, ""/echoheader"", base::CompareCase::SENSITIVE)) { const auto chrome_proxy_header = request.headers.find(""chrome-proxy""); if (chrome_proxy_header != request.headers.end()) { response->set_content(chrome_proxy_header->second); response->AddCustomHeader(""chrome-proxy"", ""ofcl=1000""); } } return response; } ",0 "OggSource::~OggSource() { if (mStarted) { stop(); } } ",0 "static void SetterCallWithExecutionContextStringAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueString(info, impl->setterCallWithExecutionContextStringAttribute(), info.GetIsolate()); } ",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(); } ",0 "static int add_metadata_from_side_data(AVPacket *avpkt, AVFrame *frame) { int size; const uint8_t *side_metadata; AVDictionary **frame_md = avpriv_frame_get_metadatap(frame); side_metadata = av_packet_get_side_data(avpkt, AV_PKT_DATA_STRINGS_METADATA, &size); return av_packet_unpack_dictionary(side_metadata, size, frame_md); } ",0 "MagickExport int LocaleNCompare(const char *p,const char *q,const size_t length) { if (p == (char *) NULL) { if (q == (char *) NULL) return(0); return(-1); } if (q == (char *) NULL) return(1); #if defined(MAGICKCORE_HAVE_STRNCASECMP) return(strncasecmp(p,q,length)); #else { register int c, d; register size_t i; for (i=length; i != 0; i--) { c=(int) *((unsigned char *) p); d=(int) *((unsigned char *) q); if (AsciiMap[c] != AsciiMap[d]) return(AsciiMap[c]-(int) AsciiMap[d]); if (c == 0) return(0); p++; q++; } return(0); } #endif } ",0 "static int shash_async_final(struct ahash_request *req) { return crypto_shash_final(ahash_request_ctx(req), req->result); } ",0 "static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh) { struct net *net = sock_net(skb->sk); struct fib_config cfg; struct fib_table *tb; int err; err = rtm_to_fib_config(net, skb, nlh, &cfg); if (err < 0) goto errout; tb = fib_get_table(net, cfg.fc_table); if (!tb) { err = -ESRCH; goto errout; } err = fib_table_delete(tb, &cfg); errout: return err; } ",0 "static int __init gate_vma_init(void) { gate_vma.vm_page_prot = PAGE_READONLY_EXEC; return 0; } ",0 "copy_entries_to_user(unsigned int total_size, const struct xt_table *table, void __user *userptr) { unsigned int off, num; const struct ip6t_entry *e; struct xt_counters *counters; const struct xt_table_info *private = table->private; int ret = 0; const void *loc_cpu_entry; counters = alloc_counters(table); if (IS_ERR(counters)) return PTR_ERR(counters); loc_cpu_entry = private->entries; /* FIXME: use iterator macros --RR */ /* ... then go back and fix counters and names */ for (off = 0, num = 0; off < total_size; off += e->next_offset, num++){ unsigned int i; const struct xt_entry_match *m; const struct xt_entry_target *t; e = loc_cpu_entry + off; if (copy_to_user(userptr + off, e, sizeof(*e))) { ret = -EFAULT; goto free_counters; } if (copy_to_user(userptr + off + offsetof(struct ip6t_entry, counters), &counters[num], sizeof(counters[num])) != 0) { ret = -EFAULT; goto free_counters; } for (i = sizeof(struct ip6t_entry); i < e->target_offset; i += m->u.match_size) { m = (void *)e + i; if (xt_match_to_user(m, userptr + off + i)) { ret = -EFAULT; goto free_counters; } } t = ip6t_get_target_c(e); if (xt_target_to_user(t, userptr + off + e->target_offset)) { ret = -EFAULT; goto free_counters; } } free_counters: vfree(counters); return ret; } ",0 "Tab* TabStrip::FindTabForEventFrom(const gfx::Point& point, int start, int delta) { if (start == tab_count()) start += delta; for (int i = start; i >= 0 && i < tab_count(); i += delta) { if (IsPointInTab(tab_at(i), point)) return tab_at(i); } return nullptr; } ",0 "void WebGLRenderingContextBase::getContextAttributes( Nullable& result) { if (isContextLost()) return; result.Set(ToWebGLContextAttributes(CreationAttributes())); if (CreationAttributes().depth() && !GetDrawingBuffer()->HasDepthBuffer()) result.Get().setDepth(false); if (CreationAttributes().stencil() && !GetDrawingBuffer()->HasStencilBuffer()) result.Get().setStencil(false); result.Get().setAntialias(GetDrawingBuffer()->Multisample()); } ",0 "bool RenderWidget::next_paint_is_restore_ack() const { return ViewHostMsg_UpdateRect_Flags::is_restore_ack(next_paint_flags_); } ",0 "DEFINE_TRACE(NodeIterator) { visitor->trace(m_referenceNode); visitor->trace(m_candidateNode); NodeIteratorBase::trace(visitor); } ",0 "RenderFrameImpl::~RenderFrameImpl() { FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone()); FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnDestruct()); RenderThread::Get()->RemoveRoute(routing_id_); } ",0 "static int decode_lt_rps(HEVCContext *s, LongTermRPS *rps, GetBitContext *gb) { const HEVCSPS *sps = s->ps.sps; int max_poc_lsb = 1 << sps->log2_max_poc_lsb; int prev_delta_msb = 0; unsigned int nb_sps = 0, nb_sh; int i; rps->nb_refs = 0; if (!sps->long_term_ref_pics_present_flag) return 0; if (sps->num_long_term_ref_pics_sps > 0) nb_sps = get_ue_golomb_long(gb); nb_sh = get_ue_golomb_long(gb); if (nb_sps > sps->num_long_term_ref_pics_sps) return AVERROR_INVALIDDATA; if (nb_sh + (uint64_t)nb_sps > FF_ARRAY_ELEMS(rps->poc)) return AVERROR_INVALIDDATA; rps->nb_refs = nb_sh + nb_sps; for (i = 0; i < rps->nb_refs; i++) { uint8_t delta_poc_msb_present; if (i < nb_sps) { uint8_t lt_idx_sps = 0; if (sps->num_long_term_ref_pics_sps > 1) lt_idx_sps = get_bits(gb, av_ceil_log2(sps->num_long_term_ref_pics_sps)); rps->poc[i] = sps->lt_ref_pic_poc_lsb_sps[lt_idx_sps]; rps->used[i] = sps->used_by_curr_pic_lt_sps_flag[lt_idx_sps]; } else { rps->poc[i] = get_bits(gb, sps->log2_max_poc_lsb); rps->used[i] = get_bits1(gb); } delta_poc_msb_present = get_bits1(gb); if (delta_poc_msb_present) { int64_t delta = get_ue_golomb_long(gb); int64_t poc; if (i && i != nb_sps) delta += prev_delta_msb; poc = rps->poc[i] + s->poc - delta * max_poc_lsb - s->sh.pic_order_cnt_lsb; if (poc != (int32_t)poc) return AVERROR_INVALIDDATA; rps->poc[i] = poc; prev_delta_msb = delta; } } return 0; } ",0 "static void ElementAttributeAttributeSetter( v8::Local v8_value, const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(isolate, ExceptionState::kSetterContext, ""TestObject"", ""elementAttribute""); Element* cpp_value = V8Element::ToImplWithTypeCheck(info.GetIsolate(), v8_value); if (!cpp_value) { exception_state.ThrowTypeError(""The provided value is not of type 'Element'.""); return; } impl->setElementAttribute(cpp_value); } ",0 "void DisplaySourceCustomBindings::StartSession( const v8::FunctionCallbackInfo& args) { CHECK_EQ(1, args.Length()); CHECK(args[0]->IsObject()); v8::Isolate* isolate = context()->isolate(); v8::Local start_info = args[0].As(); v8::Local sink_id_val = GetChildValue(start_info, ""sinkId"", isolate); CHECK(sink_id_val->IsInt32()); const int sink_id = sink_id_val->ToInt32(isolate)->Value(); if (GetDisplaySession(sink_id)) { isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8( isolate, kSessionAlreadyStarted))); return; } v8::Local video_stream_val = GetChildValue(start_info, ""videoTrack"", isolate); v8::Local audio_stream_val = GetChildValue(start_info, ""audioTrack"", isolate); if ((video_stream_val->IsNull() || video_stream_val->IsUndefined()) && (audio_stream_val->IsNull() || audio_stream_val->IsUndefined())) { isolate->ThrowException(v8::Exception::Error( v8::String::NewFromUtf8(isolate, kInvalidStreamArgs))); return; } blink::WebMediaStreamTrack audio_track, video_track; if (!video_stream_val->IsNull() && !video_stream_val->IsUndefined()) { CHECK(video_stream_val->IsObject()); video_track = blink::WebDOMMediaStreamTrack::fromV8Value( video_stream_val).component(); if (video_track.isNull()) { isolate->ThrowException(v8::Exception::Error( v8::String::NewFromUtf8(isolate, kInvalidStreamArgs))); return; } } if (!audio_stream_val->IsNull() && !audio_stream_val->IsUndefined()) { CHECK(audio_stream_val->IsObject()); audio_track = blink::WebDOMMediaStreamTrack::fromV8Value( audio_stream_val).component(); if (audio_track.isNull()) { isolate->ThrowException(v8::Exception::Error( v8::String::NewFromUtf8(isolate, kInvalidStreamArgs))); return; } } scoped_ptr auth_info; v8::Local auth_info_v8_val = GetChildValue(start_info, ""authenticationInfo"", isolate); if (!auth_info_v8_val->IsNull()) { CHECK(auth_info_v8_val->IsObject()); scoped_ptr converter(V8ValueConverter::create()); scoped_ptr auth_info_val( converter->FromV8Value(auth_info_v8_val, context()->v8_context())); CHECK(auth_info_val); auth_info = DisplaySourceAuthInfo::FromValue(*auth_info_val); } DisplaySourceSessionParams session_params; session_params.sink_id = sink_id; session_params.video_track = video_track; session_params.audio_track = audio_track; session_params.render_frame = context()->GetRenderFrame(); if (auth_info) { session_params.auth_method = auth_info->method; session_params.auth_data = auth_info->data ? *auth_info->data : """"; } scoped_ptr session = DisplaySourceSessionFactory::CreateSession(session_params); if (!session) { isolate->ThrowException(v8::Exception::Error(v8::String::NewFromUtf8( isolate, kErrorNotSupported))); return; } auto on_terminated_callback = base::Bind(&DisplaySourceCustomBindings::OnSessionTerminated, weak_factory_.GetWeakPtr(), sink_id); auto on_error_callback = base::Bind(&DisplaySourceCustomBindings::OnSessionError, weak_factory_.GetWeakPtr(), sink_id); session->SetNotificationCallbacks(on_terminated_callback, on_error_callback); int32_t call_id = GetCallbackId(); args.GetReturnValue().Set(call_id); auto on_call_completed = base::Bind(&DisplaySourceCustomBindings::OnSessionStarted, weak_factory_.GetWeakPtr(), sink_id, call_id); session->Start(on_call_completed); session_map_.insert(std::make_pair(sink_id, std::move(session))); } ",0 "WebGLRenderingContextBase::CreateWebGraphicsContext3DProvider( CanvasRenderingContextHost* host, const CanvasContextCreationAttributes& attributes, unsigned webgl_version, bool* using_gpu_compositing) { if (host->IsWebGLBlocked()) { host->HostDispatchEvent(WebGLContextEvent::Create( EventTypeNames::webglcontextcreationerror, false, true, ""Web page caused context loss and was blocked"")); return nullptr; } if ((webgl_version == 1 && !host->IsWebGL1Enabled()) || (webgl_version == 2 && !host->IsWebGL2Enabled())) { host->HostDispatchEvent(WebGLContextEvent::Create( EventTypeNames::webglcontextcreationerror, false, true, ""disabled by enterprise policy or commandline switch"")); return nullptr; } return CreateContextProviderInternal(host, attributes, webgl_version, using_gpu_compositing); } ",0 "void RenderThreadImpl::OnSetZoomLevelForCurrentURL(const std::string& host, double zoom_level) { RenderViewZoomer zoomer(host, zoom_level); content::RenderView::ForEach(&zoomer); } ",0 "gsicc_get_devicen_names(cmm_profile_t *icc_profile, gs_memory_t *memory) { /* The names are contained in the named color tag. We use the CMM to extract the data from the profile */ if (icc_profile->profile_handle == NULL) { if (icc_profile->buffer != NULL) { icc_profile->profile_handle = gsicc_get_profile_handle_buffer(icc_profile->buffer, icc_profile->buffer_size, memory); } else return; } icc_profile->spotnames = gsicc_get_spotnames(icc_profile->profile_handle, memory->non_gc_memory); return; } ",0 "void Compositor::SetDisplayVSyncParameters(base::TimeTicks timebase, base::TimeDelta interval) { static bool is_frame_rate_limit_disabled = base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableFrameRateLimit); if (is_frame_rate_limit_disabled) return; if (forced_refresh_rate_) { timebase = base::TimeTicks(); interval = base::TimeDelta::FromSeconds(1) / forced_refresh_rate_; } if (interval.is_zero()) { interval = viz::BeginFrameArgs::DefaultInterval(); } DCHECK_GT(interval.InMillisecondsF(), 0); if (vsync_timebase_ == timebase && vsync_interval_ == interval) return; vsync_timebase_ = timebase; vsync_interval_ = interval; refresh_rate_ = base::Time::kMillisecondsPerSecond / interval.InMillisecondsF(); if (context_factory_private_) { context_factory_private_->SetDisplayVSyncParameters(this, timebase, interval); } vsync_manager_->UpdateVSyncParameters(timebase, interval); } ",0 "trace_recursive_lock(struct ring_buffer_per_cpu *cpu_buffer) { unsigned int val = cpu_buffer->current_context; int bit; if (in_interrupt()) { if (in_nmi()) bit = RB_CTX_NMI; else if (in_irq()) bit = RB_CTX_IRQ; else bit = RB_CTX_SOFTIRQ; } else bit = RB_CTX_NORMAL; if (unlikely(val & (1 << bit))) return 1; val |= (1 << bit); cpu_buffer->current_context = val; return 0; } ",0 "static void nfs4_renew_done(struct rpc_task *task, void *calldata) { struct nfs4_renewdata *data = calldata; struct nfs_client *clp = data->client; unsigned long timestamp = data->timestamp; if (task->tk_status < 0) { /* Unless we're shutting down, schedule state recovery! */ if (test_bit(NFS_CS_RENEWD, &clp->cl_res_state) == 0) return; if (task->tk_status != NFS4ERR_CB_PATH_DOWN) { nfs4_schedule_lease_recovery(clp); return; } nfs4_schedule_path_down_recovery(clp); } do_renew_lease(clp, timestamp); } ",0 "void InspectorPageAgent::frameAttachedToParent(Frame* frame) { m_frontend->frameAttached(frameId(frame)); } ",0 "bool ScriptLoader::isScriptTypeSupported(LegacyTypeSupport supportLegacyTypes) const { String type = client()->typeAttributeValue(); String language = client()->languageAttributeValue(); if (type.isEmpty() && language.isEmpty()) return true; // Assume text/javascript. if (type.isEmpty()) { type = ""text/"" + language.lower(); if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type) || isLegacySupportedJavaScriptLanguage(language)) return true; } else if (MIMETypeRegistry::isSupportedJavaScriptMIMEType(type.stripWhiteSpace()) || (supportLegacyTypes == AllowLegacyTypeInTypeAttribute && isLegacySupportedJavaScriptLanguage(type))) { return true; } return false; } ",0 "status_t Camera3Device::configureStreamsLocked() { ATRACE_CALL(); status_t res; if (mStatus != STATUS_UNCONFIGURED && mStatus != STATUS_CONFIGURED) { CLOGE(""Not idle""); return INVALID_OPERATION; } if (!mNeedConfig) { ALOGV(""%s: Skipping config, no stream changes"", __FUNCTION__); return OK; } if (mOutputStreams.size() == 0) { addDummyStreamLocked(); } else { tryRemoveDummyStreamLocked(); } ALOGV(""%s: Camera %d: Starting stream configuration"", __FUNCTION__, mId); camera3_stream_configuration config; config.operation_mode = mIsConstrainedHighSpeedConfiguration ? CAMERA3_STREAM_CONFIGURATION_CONSTRAINED_HIGH_SPEED_MODE : CAMERA3_STREAM_CONFIGURATION_NORMAL_MODE; config.num_streams = (mInputStream != NULL) + mOutputStreams.size(); Vector streams; streams.setCapacity(config.num_streams); if (mInputStream != NULL) { camera3_stream_t *inputStream; inputStream = mInputStream->startConfiguration(); if (inputStream == NULL) { SET_ERR_L(""Can't start input stream configuration""); return INVALID_OPERATION; } streams.add(inputStream); } for (size_t i = 0; i < mOutputStreams.size(); i++) { if (mOutputStreams[i].get() == static_cast(mInputStream.get())) { config.num_streams--; continue; } camera3_stream_t *outputStream; outputStream = mOutputStreams.editValueAt(i)->startConfiguration(); if (outputStream == NULL) { SET_ERR_L(""Can't start output stream configuration""); return INVALID_OPERATION; } streams.add(outputStream); } config.streams = streams.editArray(); ATRACE_BEGIN(""camera3->configure_streams""); res = mHal3Device->ops->configure_streams(mHal3Device, &config); ATRACE_END(); if (res == BAD_VALUE) { if (mInputStream != NULL && mInputStream->isConfiguring()) { res = mInputStream->cancelConfiguration(); if (res != OK) { SET_ERR_L(""Can't cancel configuring input stream %d: %s (%d)"", mInputStream->getId(), strerror(-res), res); return res; } } for (size_t i = 0; i < mOutputStreams.size(); i++) { sp outputStream = mOutputStreams.editValueAt(i); if (outputStream->isConfiguring()) { res = outputStream->cancelConfiguration(); if (res != OK) { SET_ERR_L( ""Can't cancel configuring output stream %d: %s (%d)"", outputStream->getId(), strerror(-res), res); return res; } } } internalUpdateStatusLocked(STATUS_UNCONFIGURED); mNeedConfig = true; ALOGV(""%s: Camera %d: Stream configuration failed"", __FUNCTION__, mId); return BAD_VALUE; } else if (res != OK) { SET_ERR_L(""Unable to configure streams with HAL: %s (%d)"", strerror(-res), res); return res; } if (mInputStream != NULL && mInputStream->isConfiguring()) { res = mInputStream->finishConfiguration(mHal3Device); if (res != OK) { SET_ERR_L(""Can't finish configuring input stream %d: %s (%d)"", mInputStream->getId(), strerror(-res), res); return res; } } for (size_t i = 0; i < mOutputStreams.size(); i++) { sp outputStream = mOutputStreams.editValueAt(i); if (outputStream->isConfiguring()) { res = outputStream->finishConfiguration(mHal3Device); if (res != OK) { SET_ERR_L(""Can't finish configuring output stream %d: %s (%d)"", outputStream->getId(), strerror(-res), res); return res; } } } mRequestThread->configurationComplete(); if (mIsConstrainedHighSpeedConfiguration) { pid_t requestThreadTid = mRequestThread->getTid(); res = requestPriority(getpid(), requestThreadTid, kConstrainedHighSpeedThreadPriority, true); if (res != OK) { ALOGW(""Can't set realtime priority for request processing thread: %s (%d)"", strerror(-res), res); } else { ALOGD(""Set real time priority for request queue thread (tid %d)"", requestThreadTid); } } else { } mNeedConfig = false; internalUpdateStatusLocked((mDummyStreamId == NO_STREAM) ? STATUS_CONFIGURED : STATUS_UNCONFIGURED); ALOGV(""%s: Camera %d: Stream configuration complete"", __FUNCTION__, mId); mDeletedStreams.clear(); return OK; } ",0 "static bool check_seg_overrides(struct insn *insn, int regoff) { if (regoff == offsetof(struct pt_regs, di) && is_string_insn(insn)) return false; return true; } ",0 "IW_IMPL(void) iw_snprintf(char *buf, size_t buflen, const char *fmt, ...) { va_list ap; va_start(ap, fmt); iw_vsnprintf(buf,buflen,fmt,ap); va_end(ap); } ",0 "brcmf_notify_mic_status(struct brcmf_if *ifp, const struct brcmf_event_msg *e, void *data) { u16 flags = e->flags; enum nl80211_key_type key_type; if (flags & BRCMF_EVENT_MSG_GROUP) key_type = NL80211_KEYTYPE_GROUP; else key_type = NL80211_KEYTYPE_PAIRWISE; cfg80211_michael_mic_failure(ifp->ndev, (u8 *)&e->addr, key_type, -1, NULL, GFP_KERNEL); return 0; } ",0 "static int tar_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) { return user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.tar, 0, sizeof(u64)); } ",0 "int mailimf_msg_id_parse(const char * message, size_t length, size_t * indx, char ** result) { size_t cur_token; #if 0 char * id_left; char * id_right; #endif char * msg_id; int r; int res; cur_token = * indx; r = mailimf_cfws_parse(message, length, &cur_token); if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) return r; r = mailimf_lower_parse(message, length, &cur_token); if (r == MAILIMF_ERROR_PARSE) { r = mailimf_addr_spec_msg_id_parse(message, length, &cur_token, &msg_id); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } * result = msg_id; * indx = cur_token; return MAILIMF_NO_ERROR; } else if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_lower_parse(message, length, &cur_token); if (r == MAILIMF_NO_ERROR) { } else if (r == MAILIMF_ERROR_PARSE) { } else { res = r; goto err; } r = mailimf_addr_spec_msg_id_parse(message, length, &cur_token, &msg_id); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_greater_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { free(msg_id); res = r; goto err; } r = mailimf_greater_parse(message, length, &cur_token); if (r == MAILIMF_NO_ERROR) { } else if (r == MAILIMF_ERROR_PARSE) { } else { free(msg_id); res = r; goto err; } #if 0 r = mailimf_id_left_parse(message, length, &cur_token, &id_left); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_at_sign_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto free_id_left; } r = mailimf_id_right_parse(message, length, &cur_token, &id_right); if (r != MAILIMF_NO_ERROR) { res = r; goto free_id_left; } r = mailimf_greater_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto free_id_right; } msg_id = malloc(strlen(id_left) + strlen(id_right) + 2); if (msg_id == NULL) { res = MAILIMF_ERROR_MEMORY; goto free_id_right; } strcpy(msg_id, id_left); strcat(msg_id, ""@""); strcat(msg_id, id_right); mailimf_id_left_free(id_left); mailimf_id_right_free(id_right); #endif * result = msg_id; * indx = cur_token; return MAILIMF_NO_ERROR; #if 0 free_id_right: mailimf_id_right_free(id_right); free_id_left: mailimf_id_left_free(id_left); #endif /* free: mailimf_atom_free(msg_id); */ err: return res; } ",0 "void Splash::clear(SplashColorPtr color, Guchar alpha) { SplashColorPtr row, p; Guchar mono; int x, y; switch (bitmap->mode) { case splashModeMono1: mono = (color[0] & 0x80) ? 0xff : 0x00; if (bitmap->rowSize < 0) { memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), mono, -bitmap->rowSize * bitmap->height); } else { memset(bitmap->data, mono, bitmap->rowSize * bitmap->height); } break; case splashModeMono8: if (bitmap->rowSize < 0) { memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), color[0], -bitmap->rowSize * bitmap->height); } else { memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); } break; case splashModeRGB8: if (color[0] == color[1] && color[1] == color[2]) { if (bitmap->rowSize < 0) { memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), color[0], -bitmap->rowSize * bitmap->height); } else { memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); } } else { row = bitmap->data; for (y = 0; y < bitmap->height; ++y) { p = row; for (x = 0; x < bitmap->width; ++x) { *p++ = color[2]; *p++ = color[1]; *p++ = color[0]; } row += bitmap->rowSize; } } break; case splashModeXBGR8: if (color[0] == color[1] && color[1] == color[2]) { if (bitmap->rowSize < 0) { memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), color[0], -bitmap->rowSize * bitmap->height); } else { memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); } } else { row = bitmap->data; for (y = 0; y < bitmap->height; ++y) { p = row; for (x = 0; x < bitmap->width; ++x) { *p++ = color[0]; *p++ = color[1]; *p++ = color[2]; *p++ = 255; } row += bitmap->rowSize; } } break; case splashModeBGR8: if (color[0] == color[1] && color[1] == color[2]) { if (bitmap->rowSize < 0) { memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), color[0], -bitmap->rowSize * bitmap->height); } else { memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); } } else { row = bitmap->data; for (y = 0; y < bitmap->height; ++y) { p = row; for (x = 0; x < bitmap->width; ++x) { *p++ = color[0]; *p++ = color[1]; *p++ = color[2]; } row += bitmap->rowSize; } } break; #if SPLASH_CMYK case splashModeCMYK8: if (color[0] == color[1] && color[1] == color[2] && color[2] == color[3]) { if (bitmap->rowSize < 0) { memset(bitmap->data + bitmap->rowSize * (bitmap->height - 1), color[0], -bitmap->rowSize * bitmap->height); } else { memset(bitmap->data, color[0], bitmap->rowSize * bitmap->height); } } else { row = bitmap->data; for (y = 0; y < bitmap->height; ++y) { p = row; for (x = 0; x < bitmap->width; ++x) { *p++ = color[0]; *p++ = color[1]; *p++ = color[2]; *p++ = color[3]; } row += bitmap->rowSize; } } break; case splashModeDeviceN8: row = bitmap->data; for (y = 0; y < bitmap->height; ++y) { p = row; for (x = 0; x < bitmap->width; ++x) { for (int cp = 0; cp < SPOT_NCOMPS+4; cp++) *p++ = color[cp]; } row += bitmap->rowSize; } break; #endif } if (bitmap->alpha) { memset(bitmap->alpha, alpha, bitmap->width * bitmap->height); } updateModX(0); updateModY(0); updateModX(bitmap->width - 1); updateModY(bitmap->height - 1); } ",0 "void PageCaptureCustomBindings::SendResponseAck( const v8::FunctionCallbackInfo& args) { CHECK(args.Length() == 1); CHECK(args[0]->IsInt32()); content::RenderFrame* render_frame = context()->GetRenderFrame(); if (render_frame) { render_frame->Send(new ExtensionHostMsg_ResponseAck( render_frame->GetRoutingID(), args[0]->Int32Value())); } } ",0 "void WebGLRenderingContextBase::attachShader(WebGLProgram* program, WebGLShader* shader) { if (!ValidateWebGLProgramOrShader(""attachShader"", program) || !ValidateWebGLProgramOrShader(""attachShader"", shader)) return; if (!program->AttachShader(shader)) { SynthesizeGLError(GL_INVALID_OPERATION, ""attachShader"", ""shader attachment already has shader""); return; } ContextGL()->AttachShader(ObjectOrZero(program), ObjectOrZero(shader)); shader->OnAttached(); } ",0 "void PluginServiceImpl::AppActivated() { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::Bind(&NotifyPluginsOfActivation)); } ",0 "NavigationRequest::~NavigationRequest() { TRACE_EVENT_ASYNC_END0(""navigation"", ""NavigationRequest"", this); if (state_ == STARTED) { RenderFrameDevToolsAgentHost::OnNavigationRequestFailed(*this, net::ERR_ABORTED); } } ",0 "static void sas_unregister_common_dev(struct asd_sas_port *port, struct domain_device *dev) { struct sas_ha_struct *ha = port->ha; sas_notify_lldd_dev_gone(dev); if (!dev->parent) dev->port->port_dev = NULL; else list_del_init(&dev->siblings); spin_lock_irq(&port->dev_list_lock); list_del_init(&dev->dev_list_node); if (dev_is_sata(dev)) sas_ata_end_eh(dev->sata_dev.ap); spin_unlock_irq(&port->dev_list_lock); spin_lock_irq(&ha->lock); if (dev->dev_type == SAS_END_DEVICE && !list_empty(&dev->ssp_dev.eh_list_node)) { list_del_init(&dev->ssp_dev.eh_list_node); ha->eh_active--; } spin_unlock_irq(&ha->lock); sas_put_device(dev); } ",0 "bool PrintWebViewHelper::InitPrintSettingsAndPrepareFrame( WebKit::WebFrame* frame, const WebKit::WebNode& node, scoped_ptr* prepare) { DCHECK(frame); bool fit_to_paper_size = !(PrintingNodeOrPdfFrame(frame, node)); if (!InitPrintSettings(fit_to_paper_size)) { notify_browser_of_print_failure_ = false; render_view()->RunModalAlertDialog( frame, l10n_util::GetStringUTF16(IDS_PRINT_PREVIEW_INVALID_PRINTER_SETTINGS)); return false; } DCHECK(!prepare->get()); prepare->reset(new PrepareFrameAndViewForPrint(print_pages_params_->params, frame, node)); UpdateFrameAndViewFromCssPageLayout(frame, node, prepare->get(), print_pages_params_->params, ignore_css_margins_); Send(new PrintHostMsg_DidGetDocumentCookie( routing_id(), print_pages_params_->params.document_cookie)); return true; } ",0 "hfs_istat(TSK_FS_INFO * fs, TSK_FS_ISTAT_FLAG_ENUM istat_flags, FILE * hFile, TSK_INUM_T inum, TSK_DADDR_T numblock, int32_t sec_skew) { HFS_INFO *hfs = (HFS_INFO *) fs; TSK_FS_FILE *fs_file; char hfs_mode[12]; HFS_PRINT_ADDR print; HFS_ENTRY entry; char timeBuf[128]; const TSK_FS_ATTR *compressionAttr = NULL; RES_DESCRIPTOR *rd; // descriptor of a resource tsk_error_reset(); if (tsk_verbose) tsk_fprintf(stderr, ""hfs_istat: inum: %"" PRIuINUM "" numblock: %"" PRIu32 ""\n"", inum, numblock); if ((fs_file = tsk_fs_file_open_meta(fs, NULL, inum)) == NULL) { error_returned(""hfs_istat: getting metadata for the file""); return 1; } if (inum >= HFS_FIRST_USER_CNID) { int rslt; tsk_fprintf(hFile, ""File Path: ""); rslt = print_parent_path(hFile, fs, inum); if (rslt != 0) tsk_fprintf(hFile, "" Error in printing path\n""); else tsk_fprintf(hFile, ""\n""); } else { if (fs_file->meta->name2 != NULL) tsk_fprintf(hFile, ""File Name: %s\n"", fs_file->meta->name2->name); } tsk_fprintf(hFile, ""Catalog Record: %"" PRIuINUM ""\n"", inum); tsk_fprintf(hFile, ""%sAllocated\n"", (fs_file->meta->flags & TSK_FS_META_FLAG_UNALLOC) ? ""Not "" : """"); tsk_fprintf(hFile, ""Type:\t""); if (fs_file->meta->type == TSK_FS_META_TYPE_REG) tsk_fprintf(hFile, ""File\n""); else if (TSK_FS_IS_DIR_META(fs_file->meta->type)) tsk_fprintf(hFile, ""Folder\n""); else tsk_fprintf(hFile, ""\n""); tsk_fs_meta_make_ls(fs_file->meta, hfs_mode, sizeof(hfs_mode)); tsk_fprintf(hFile, ""Mode:\t%s\n"", hfs_mode); tsk_fprintf(hFile, ""Size:\t%"" PRIuOFF ""\n"", fs_file->meta->size); if (fs_file->meta->link) tsk_fprintf(hFile, ""Symbolic link to:\t%s\n"", fs_file->meta->link); tsk_fprintf(hFile, ""uid / gid: %"" PRIuUID "" / %"" PRIuGID ""\n"", fs_file->meta->uid, fs_file->meta->gid); tsk_fprintf(hFile, ""Link count:\t%d\n"", fs_file->meta->nlink); if (hfs_cat_file_lookup(hfs, inum, &entry, TRUE) == 0) { hfs_uni_str *nm = &entry.thread.name; char name_buf[HFS_MAXNAMLEN + 1]; TSK_INUM_T par_cnid; // parent CNID tsk_fprintf(hFile, ""\n""); hfs_UTF16toUTF8(fs, nm->unicode, (int) tsk_getu16(fs->endian, nm->length), &name_buf[0], HFS_MAXNAMLEN + 1, HFS_U16U8_FLAG_REPLACE_SLASH | HFS_U16U8_FLAG_REPLACE_CONTROL); tsk_fprintf(hFile, ""File Name: %s\n"", name_buf); par_cnid = tsk_getu32(fs->endian, &(entry.thread.parent_cnid)); if ((hfs->has_meta_dir_crtime && par_cnid == hfs->meta_dir_inum) || (hfs->has_meta_crtime && par_cnid == hfs->meta_inum)) { int instr = strncmp(name_buf, ""iNode"", 5); int drstr = strncmp(name_buf, ""dir_"", 4); if (instr == 0 && hfs->has_meta_crtime && par_cnid == hfs->meta_inum) { tsk_fprintf(hFile, ""This is a hard link to a file\n""); } else if (drstr == 0 && hfs->has_meta_dir_crtime && par_cnid == hfs->meta_dir_inum) { tsk_fprintf(hFile, ""This is a hard link to a folder.\n""); } } /* The cat.perm union contains file-type specific values. * Print them if they are relevant. */ if ((fs_file->meta->type == TSK_FS_META_TYPE_CHR) || (fs_file->meta->type == TSK_FS_META_TYPE_BLK)) { tsk_fprintf(hFile, ""Device ID:\t%"" PRIu32 ""\n"", tsk_getu32(fs->endian, entry.cat.std.perm.special.raw)); } else if ((tsk_getu32(fs->endian, entry.cat.std.u_info.file_type) == HFS_HARDLINK_FILE_TYPE) && (tsk_getu32(fs->endian, entry.cat.std.u_info.file_cr) == HFS_HARDLINK_FILE_CREATOR)) { tsk_fprintf(hFile, ""Hard link inode number\t %"" PRIu32 ""\n"", tsk_getu32(fs->endian, entry.cat.std.perm.special.inum)); } tsk_fprintf(hFile, ""Admin flags: %"" PRIu8, entry.cat.std.perm.a_flags); if (entry.cat.std.perm.a_flags != 0) { tsk_fprintf(hFile, "" - ""); if (entry.cat.std.perm.a_flags & HFS_PERM_AFLAG_ARCHIVED) tsk_fprintf(hFile, ""archived ""); if (entry.cat.std.perm.a_flags & HFS_PERM_AFLAG_IMMUTABLE) tsk_fprintf(hFile, ""immutable ""); if (entry.cat.std.perm.a_flags & HFS_PERM_AFLAG_APPEND) tsk_fprintf(hFile, ""append-only ""); } tsk_fprintf(hFile, ""\n""); tsk_fprintf(hFile, ""Owner flags: %"" PRIu8, entry.cat.std.perm.o_flags); if (entry.cat.std.perm.o_flags != 0) { tsk_fprintf(hFile, "" - ""); if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_NODUMP) tsk_fprintf(hFile, ""no-dump ""); if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_IMMUTABLE) tsk_fprintf(hFile, ""immutable ""); if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_APPEND) tsk_fprintf(hFile, ""append-only ""); if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_OPAQUE) tsk_fprintf(hFile, ""opaque ""); if (entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_COMPRESSED) tsk_fprintf(hFile, ""compressed ""); } tsk_fprintf(hFile, ""\n""); if (tsk_getu16(fs->endian, entry.cat.std.flags) & HFS_FILE_FLAG_LOCKED) tsk_fprintf(hFile, ""Locked\n""); if (tsk_getu16(fs->endian, entry.cat.std.flags) & HFS_FILE_FLAG_ATTR) tsk_fprintf(hFile, ""Has extended attributes\n""); if (tsk_getu16(fs->endian, entry.cat.std.flags) & HFS_FILE_FLAG_ACL) tsk_fprintf(hFile, ""Has security data (ACLs)\n""); if ( !TSK_FS_IS_DIR_META(fs_file->meta->type)){ int windx; // loop index tsk_fprintf(hFile, ""File type:\t%04"" PRIx32 "" "", tsk_getu32(fs->endian, entry.cat.std.u_info.file_type)); for (windx = 0; windx < 4; ++windx) { uint8_t cu = entry.cat.std.u_info.file_type[windx]; if (cu >= 32 && cu <= 126) tsk_fprintf(hFile, ""%c"", (char) cu); else tsk_fprintf(hFile, "" ""); } tsk_fprintf(hFile, ""\n""); tsk_fprintf(hFile, ""File creator:\t%04"" PRIx32 "" "", tsk_getu32(fs->endian, entry.cat.std.u_info.file_cr)); for (windx = 0; windx < 4; ++windx) { uint8_t cu = entry.cat.std.u_info.file_cr[windx]; if (cu >= 32 && cu <= 126) tsk_fprintf(hFile, ""%c"", (char) cu); else tsk_fprintf(hFile, "" ""); } tsk_fprintf(hFile, ""\n""); } // END if(not folder) if (tsk_getu16(fs->endian, entry.cat.std.u_info.flags) & HFS_FINDER_FLAG_NAME_LOCKED) tsk_fprintf(hFile, ""Name locked\n""); if (tsk_getu16(fs->endian, entry.cat.std.u_info.flags) & HFS_FINDER_FLAG_HAS_BUNDLE) tsk_fprintf(hFile, ""Has bundle\n""); if (tsk_getu16(fs->endian, entry.cat.std.u_info.flags) & HFS_FINDER_FLAG_IS_INVISIBLE) tsk_fprintf(hFile, ""Is invisible\n""); if (tsk_getu16(fs->endian, entry.cat.std.u_info.flags) & HFS_FINDER_FLAG_IS_ALIAS) tsk_fprintf(hFile, ""Is alias\n""); tsk_fprintf(hFile, ""Text encoding:\t%"" PRIx32 "" = %s\n"", tsk_getu32(fs->endian, entry.cat.std.text_enc), text_encoding_name(tsk_getu32(fs->endian, entry.cat.std.text_enc))); if (tsk_getu16(fs->endian, entry.cat.std.rec_type) == HFS_FILE_RECORD) { tsk_fprintf(hFile, ""Resource fork size:\t%"" PRIu64 ""\n"", tsk_getu64(fs->endian, entry.cat.resource.logic_sz)); } } if (sec_skew != 0) { tsk_fprintf(hFile, ""\nAdjusted times:\n""); if (fs_file->meta->mtime) fs_file->meta->mtime -= sec_skew; if (fs_file->meta->atime) fs_file->meta->atime -= sec_skew; if (fs_file->meta->ctime) fs_file->meta->ctime -= sec_skew; if (fs_file->meta->crtime) fs_file->meta->crtime -= sec_skew; if (fs_file->meta->time2.hfs.bkup_time) fs_file->meta->time2.hfs.bkup_time -= sec_skew; tsk_fprintf(hFile, ""Created:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->crtime, timeBuf)); tsk_fprintf(hFile, ""Content Modified:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->mtime, timeBuf)); tsk_fprintf(hFile, ""Attributes Modified:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->ctime, timeBuf)); tsk_fprintf(hFile, ""Accessed:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->atime, timeBuf)); tsk_fprintf(hFile, ""Backed Up:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->time2.hfs.bkup_time, timeBuf)); if (fs_file->meta->mtime) fs_file->meta->mtime += sec_skew; if (fs_file->meta->atime) fs_file->meta->atime += sec_skew; if (fs_file->meta->ctime) fs_file->meta->ctime += sec_skew; if (fs_file->meta->crtime) fs_file->meta->crtime += sec_skew; if (fs_file->meta->time2.hfs.bkup_time) fs_file->meta->time2.hfs.bkup_time += sec_skew; tsk_fprintf(hFile, ""\nOriginal times:\n""); } else { tsk_fprintf(hFile, ""\nTimes:\n""); } tsk_fprintf(hFile, ""Created:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->crtime, timeBuf)); tsk_fprintf(hFile, ""Content Modified:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->mtime, timeBuf)); tsk_fprintf(hFile, ""Attributes Modified:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->ctime, timeBuf)); tsk_fprintf(hFile, ""Accessed:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->atime, timeBuf)); tsk_fprintf(hFile, ""Backed Up:\t%s\n"", tsk_fs_time_to_str(fs_file->meta->time2.hfs.bkup_time, timeBuf)); if (tsk_getu16(fs->endian, entry.cat.std.rec_type) == HFS_FILE_RECORD) { if (!(entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_COMPRESSED)) { if (!(istat_flags & TSK_FS_ISTAT_RUNLIST)) { tsk_fprintf(hFile, ""\nData Fork Blocks:\n""); print.idx = 0; print.hFile = hFile; print.accumulating = FALSE; print.startBlock = 0; print.blockCount = 0; if (tsk_fs_file_walk_type(fs_file, TSK_FS_ATTR_TYPE_HFS_DATA, HFS_FS_ATTR_ID_DATA, (TSK_FS_FILE_WALK_FLAG_AONLY | TSK_FS_FILE_WALK_FLAG_SLACK), print_addr_act, (void *)&print)) { tsk_fprintf(hFile, ""\nError reading file data fork\n""); tsk_error_print(hFile); tsk_error_reset(); } else { output_print_addr(&print); if (print.idx != 0) tsk_fprintf(hFile, ""\n""); } } } if (tsk_getu64(fs->endian, entry.cat.resource.logic_sz) > 0) { if (! (istat_flags & TSK_FS_ISTAT_RUNLIST)) { tsk_fprintf(hFile, ""\nResource Fork Blocks:\n""); print.idx = 0; print.hFile = hFile; print.accumulating = FALSE; print.startBlock = 0; print.blockCount = 0; if (tsk_fs_file_walk_type(fs_file, TSK_FS_ATTR_TYPE_HFS_RSRC, HFS_FS_ATTR_ID_RSRC, (TSK_FS_FILE_WALK_FLAG_AONLY | TSK_FS_FILE_WALK_FLAG_SLACK), print_addr_act, (void *)&print)) { tsk_fprintf(hFile, ""\nError reading file resource fork\n""); tsk_error_print(hFile); tsk_error_reset(); } else { output_print_addr(&print); if (print.idx != 0) tsk_fprintf(hFile, ""\n""); } } } } (void) tsk_fs_file_attr_get(fs_file); /* Print all of the attributes */ tsk_fprintf(hFile, ""\nAttributes: \n""); if (fs_file->meta->attr) { int cnt, i; cnt = tsk_fs_file_attr_getsize(fs_file); for (i = 0; i < cnt; ++i) { const char *type; // type of the attribute as a string const TSK_FS_ATTR *fs_attr = tsk_fs_file_attr_get_idx(fs_file, i); if (!fs_attr) continue; type = hfs_attrTypeName((uint32_t) fs_attr->type); /* print the layout if it is non-resident and not ""special"" */ if (fs_attr->flags & TSK_FS_ATTR_NONRES) { tsk_fprintf(hFile, ""Type: %s (%"" PRIu32 ""-%"" PRIu16 "") Name: %s Non-Resident%s%s%s size: %"" PRIuOFF "" init_size: %"" PRIuOFF ""\n"", type, fs_attr->type, fs_attr->id, (fs_attr->name) ? fs_attr->name : ""N/A"", (fs_attr->flags & TSK_FS_ATTR_ENC) ? "", Encrypted"" : """", (fs_attr->flags & TSK_FS_ATTR_COMP) ? "", Compressed"" : """", (fs_attr->flags & TSK_FS_ATTR_SPARSE) ? "", Sparse"" : """", fs_attr->size, fs_attr->nrd.initsize); if (istat_flags & TSK_FS_ISTAT_RUNLIST) { if (tsk_fs_attr_print(fs_attr, hFile)) { tsk_fprintf(hFile, ""\nError creating run lists\n""); tsk_error_print(hFile); tsk_error_reset(); } } } // END: non-resident attribute case else { tsk_fprintf(hFile, ""Type: %s (%"" PRIu32 ""-%"" PRIu16 "") Name: %s Resident%s%s%s size: %"" PRIuOFF ""\n"", type, fs_attr->type, fs_attr->id, (fs_attr->name) ? fs_attr->name : ""N/A"", (fs_attr->flags & TSK_FS_ATTR_ENC) ? "", Encrypted"" : """", (fs_attr->flags & TSK_FS_ATTR_COMP) ? "", Compressed"" : """", (fs_attr->flags & TSK_FS_ATTR_SPARSE) ? "", Sparse"" : """", fs_attr->size); if (fs_attr->type == TSK_FS_ATTR_TYPE_HFS_COMP_REC) { if (compressionAttr == NULL) { compressionAttr = fs_attr; } else { error_detected(TSK_ERR_FS_CORRUPT, ""hfs_istat: more than one compression attribute""); return 1; } } } // END: else (RESIDENT attribute case) } // END: for(;;) loop over attributes } // END: if(fs_file->meta->attr is non-NULL) if ((entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_COMPRESSED) && (compressionAttr == NULL)) tsk_fprintf(hFile, ""WARNING: Compression Flag is set, but there"" "" is no compression record for this file.\n""); if (((entry.cat.std.perm.o_flags & HFS_PERM_OFLAG_COMPRESSED) == 0) && (compressionAttr != NULL)) tsk_fprintf(hFile, ""WARNING: Compression Flag is NOT set, but there"" "" is a compression record for this file.\n""); if (compressionAttr != NULL) { const TSK_FS_ATTR *fs_attr = compressionAttr; ssize_t attrReadResult; DECMPFS_DISK_HEADER *cmph; uint32_t cmpType; uint64_t uncSize; uint64_t cmpSize = 0; char *aBuf = (char *) tsk_malloc((size_t) fs_attr->size); if (aBuf == NULL) { error_returned(""hfs_istat: space for a compression attribute""); return 1; } attrReadResult = tsk_fs_attr_read(fs_attr, (TSK_OFF_T) 0, aBuf, (size_t) fs_attr->size, (TSK_FS_FILE_READ_FLAG_ENUM) 0x00); if (attrReadResult == -1) { error_returned(""hfs_istat: reading the compression attribute""); free(aBuf); return 1; } else if (attrReadResult < fs_attr->size) { error_detected(TSK_ERR_FS_READ, ""hfs_istat: could not read the whole compression attribute""); free(aBuf); return 1; } cmph = (DECMPFS_DISK_HEADER *) aBuf; cmpType = tsk_getu32(TSK_LIT_ENDIAN, cmph->compression_type); uncSize = tsk_getu64(TSK_LIT_ENDIAN, cmph->uncompressed_size); tsk_fprintf(hFile, ""\nCompressed File:\n""); tsk_fprintf(hFile, "" Uncompressed size: %llu\n"", uncSize); switch (cmpType) { case DECMPFS_TYPE_ZLIB_ATTR: { uint32_t off = (cmph->attr_bytes[0] & 0x0F) == 0x0F ? 17 : 16; cmpSize = fs_attr->size - off; tsk_fprintf(hFile, "" Data follows compression record in the CMPF attribute\n"" "" %"" PRIu64 "" bytes of data at offset %u, %s compressed\n"", cmpSize, off, off == 16 ? ""zlib"" : ""not""); } break; case DECMPFS_TYPE_LZVN_ATTR: { uint32_t off = cmph->attr_bytes[0] == 0x06 ? 17 : 16; cmpSize = fs_attr->size - off; tsk_fprintf(hFile, "" Data follows compression record in the CMPF attribute\n"" "" %"" PRIu64 "" bytes of data at offset %u, %s compressed\n"", cmpSize, off, off == 16 ? ""lzvn"" : ""not""); } break; case DECMPFS_TYPE_ZLIB_RSRC: tsk_fprintf(hFile, "" Data is zlib compressed in the resource fork\n""); break; case DECMPFS_TYPE_LZVN_RSRC: tsk_fprintf(hFile, "" Data is lzvn compressed in the resource fork\n""); break; default: tsk_fprintf(hFile, "" Compression type is %u: UNKNOWN\n"", cmpType); } free(aBuf); if ((cmpType == DECMPFS_TYPE_ZLIB_RSRC || cmpType == DECMPFS_TYPE_LZVN_RSRC) && (tsk_getu64(fs->endian, entry.cat.resource.logic_sz) == 0)) tsk_fprintf(hFile, ""WARNING: Compression record indicates compressed data"" "" in the RSRC Fork, but that fork is empty.\n""); } rd = hfs_parse_resource_fork(fs_file); if (rd != NULL) { tsk_fprintf(hFile, ""\nResources:\n""); while (rd) { tsk_fprintf(hFile, "" Type: %s \tID: %-5u \tOffset: %-5u \tSize: %-5u \tName: %s\n"", rd->type, rd->id, rd->offset, rd->length, rd->name); rd = rd->next; } } free_res_descriptor(rd); tsk_fs_file_close(fs_file); return 0; } ",0 "static void unlock_expected_tids(struct qib_ctxtdata *rcd) { struct qib_devdata *dd = rcd->dd; int ctxt_tidbase = rcd->ctxt * dd->rcvtidcnt; int i, cnt = 0, maxtid = ctxt_tidbase + dd->rcvtidcnt; for (i = ctxt_tidbase; i < maxtid; i++) { struct page *p = dd->pageshadow[i]; dma_addr_t phys; if (!p) continue; phys = dd->physshadow[i]; dd->physshadow[i] = dd->tidinvalid; dd->pageshadow[i] = NULL; pci_unmap_page(dd->pcidev, phys, PAGE_SIZE, PCI_DMA_FROMDEVICE); qib_release_user_pages(&p, 1); cnt++; } } ",0 "static void perf_syscall_exit(void *ignore, struct pt_regs *regs, long ret) { struct syscall_metadata *sys_data; struct syscall_trace_exit *rec; struct hlist_head *head; int syscall_nr; int rctx; int size; syscall_nr = trace_get_syscall_nr(current, regs); if (syscall_nr < 0) return; if (!test_bit(syscall_nr, enabled_perf_exit_syscalls)) return; sys_data = syscall_nr_to_meta(syscall_nr); if (!sys_data) return; head = this_cpu_ptr(sys_data->exit_event->perf_events); if (hlist_empty(head)) return; /* We can probably do that at build time */ size = ALIGN(sizeof(*rec) + sizeof(u32), sizeof(u64)); size -= sizeof(u32); rec = (struct syscall_trace_exit *)perf_trace_buf_prepare(size, sys_data->exit_event->event.type, regs, &rctx); if (!rec) return; rec->nr = syscall_nr; rec->ret = syscall_get_return_value(current, regs); perf_trace_buf_submit(rec, size, rctx, 0, 1, regs, head, NULL); } ",1 "void RenderBlock::createFirstLetterRenderer(RenderObject* firstLetterBlock, RenderObject* currentChild, unsigned length) { ASSERT(length && currentChild->isText()); RenderObject* firstLetterContainer = currentChild->parent(); RenderStyle* pseudoStyle = styleForFirstLetter(firstLetterBlock, firstLetterContainer); RenderObject* firstLetter = 0; if (pseudoStyle->display() == INLINE) firstLetter = RenderInline::createAnonymous(&document()); else firstLetter = RenderBlockFlow::createAnonymous(&document()); firstLetter->setStyle(pseudoStyle); firstLetterContainer->addChild(firstLetter, currentChild); RenderText* textObj = toRenderText(currentChild); String oldText = textObj->originalText(); ASSERT(oldText.impl()); RenderTextFragment* remainingText = new RenderTextFragment(textObj->node() ? textObj->node() : &textObj->document(), oldText.impl(), length, oldText.length() - length); remainingText->setStyle(textObj->style()); if (remainingText->node()) remainingText->node()->setRenderer(remainingText); firstLetterContainer->addChild(remainingText, textObj); firstLetterContainer->removeChild(textObj); remainingText->setFirstLetter(firstLetter); toRenderBoxModelObject(firstLetter)->setFirstLetterRemainingText(remainingText); RenderTextFragment* letter = new RenderTextFragment(remainingText->node() ? remainingText->node() : &remainingText->document(), oldText.impl(), 0, length); letter->setStyle(pseudoStyle); firstLetter->addChild(letter); textObj->destroy(); } ",0 "void RenderView::OnReplace(const string16& text) { if (!webview()) return; WebFrame* frame = webview()->focusedFrame(); if (!frame->hasSelection()) frame->selectWordAroundCaret(); frame->replaceSelection(text); } ",0 "void FrameLoader::checkLoadCompleteForThisFrame() { ASSERT(m_client->hasWebView()); switch (m_state) { case FrameStateProvisional: { if (m_delegateIsHandlingProvisionalLoadError) return; RefPtr pdl = m_provisionalDocumentLoader; if (!pdl) return; const ResourceError& error = pdl->mainDocumentError(); if (error.isNull()) return; RefPtr item; if (Page* page = m_frame->page()) if (isBackForwardLoadType(loadType()) && m_frame == page->mainFrame()) item = history()->currentItem(); bool shouldReset = true; if (!(pdl->isLoadingInAPISense() && !pdl->isStopping())) { m_delegateIsHandlingProvisionalLoadError = true; m_client->dispatchDidFailProvisionalLoad(error); m_delegateIsHandlingProvisionalLoadError = false; stopLoadingSubframes(); pdl->stopLoading(); if (isReplacing() && !m_documentLoader.get()) setDocumentLoader(m_provisionalDocumentLoader.get()); if (pdl == m_provisionalDocumentLoader) clearProvisionalLoad(); else if (activeDocumentLoader()) { KURL unreachableURL = activeDocumentLoader()->unreachableURL(); if (!unreachableURL.isEmpty() && unreachableURL == pdl->request().url()) shouldReset = false; } } if (shouldReset && item) if (Page* page = m_frame->page()) { page->backForwardList()->goToItem(item.get()); Settings* settings = m_frame->settings(); page->setGlobalHistoryItem((!settings || settings->privateBrowsingEnabled()) ? 0 : item.get()); } return; } case FrameStateCommittedPage: { DocumentLoader* dl = m_documentLoader.get(); if (!dl || (dl->isLoadingInAPISense() && !dl->isStopping())) return; markLoadComplete(); m_client->forceLayoutForNonHTML(); if (Page* page = m_frame->page()) if ((isBackForwardLoadType(m_loadType) || m_loadType == FrameLoadTypeReload || m_loadType == FrameLoadTypeReloadFromOrigin) && page->backForwardList()) history()->restoreScrollPositionAndViewState(); if (m_stateMachine.creatingInitialEmptyDocument() || !m_stateMachine.committedFirstRealDocumentLoad()) return; const ResourceError& error = dl->mainDocumentError(); #ifndef NDEBUG m_didDispatchDidCommitLoad = false; #endif if (!error.isNull()) m_client->dispatchDidFailLoad(error); else m_client->dispatchDidFinishLoad(); if (Page* page = m_frame->page()) page->progress()->progressCompleted(m_frame); return; } case FrameStateComplete: frameLoadCompleted(); return; } ASSERT_NOT_REACHED(); } ",0 "_xfs_buf_map_pages( xfs_buf_t *bp, uint flags) { ASSERT(bp->b_flags & _XBF_PAGES); if (bp->b_page_count == 1) { /* A single page buffer is always mappable */ bp->b_addr = page_address(bp->b_pages[0]) + bp->b_offset; } else if (flags & XBF_UNMAPPED) { bp->b_addr = NULL; } else { int retried = 0; do { bp->b_addr = vm_map_ram(bp->b_pages, bp->b_page_count, -1, PAGE_KERNEL); if (bp->b_addr) break; vm_unmap_aliases(); } while (retried++ <= 1); if (!bp->b_addr) return -ENOMEM; bp->b_addr += bp->b_offset; } return 0; } ",0 "static bool cmd_seek(IDEState *s, uint8_t cmd) { /* XXX: Check that seek is within bounds */ return true; } ",0 "void OfflinePageModelImpl::OnDeleteOldPagesWithSameURL( DeletePageResult result) { PostClearStorageIfNeededTask(false /* delayed */); } ",0 " Element* GetElementById(const AtomicString& id) { WebLocalFrameImpl* frame = web_view_helper_->LocalMainFrame(); return frame->GetFrame()->GetDocument()->getElementById(id); } ",0 "static struct oz_urb_link *oz_remove_urb(struct oz_endpoint *ep, struct urb *urb) { struct oz_urb_link *urbl; if (unlikely(ep == NULL)) return NULL; list_for_each_entry(urbl, &ep->urb_list, link) { if (urbl->urb == urb) { list_del_init(&urbl->link); if (usb_pipeisoc(urb->pipe)) { ep->credit -= urb->number_of_packets; if (ep->credit < 0) ep->credit = 0; } return urbl; } } return NULL; } ",0 " bool asn1_read_BOOLEAN_context(struct asn1_data *data, bool *v, int context) { uint8_t tmp = 0; asn1_start_tag(data, ASN1_CONTEXT_SIMPLE(context)); asn1_read_uint8(data, &tmp); if (tmp == 0xFF) { *v = true; } else { *v = false; } asn1_end_tag(data); return !data->has_error; } ",1 "static inline u8 *ablkcipher_get_spot(u8 *start, unsigned int len) { u8 *end_page = (u8 *)(((unsigned long)(start + len - 1)) & PAGE_MASK); return max(start, end_page); } ",0 "const AtomicString& AXObject::internalRoleName(AccessibilityRole role) { static const Vector* internalRoleNameVector = createInternalRoleNameVector(); return internalRoleNameVector->at(role); } ",0 "static struct idr *cma_select_ib_ps(struct rdma_id_private *id_priv) { struct idr *ps = NULL; struct sockaddr_ib *sib; u64 sid_ps, mask, sid; sib = (struct sockaddr_ib *) cma_src_addr(id_priv); mask = be64_to_cpu(sib->sib_sid_mask) & RDMA_IB_IP_PS_MASK; sid = be64_to_cpu(sib->sib_sid) & mask; if ((id_priv->id.ps == RDMA_PS_IB) && (sid == (RDMA_IB_IP_PS_IB & mask))) { sid_ps = RDMA_IB_IP_PS_IB; ps = &ib_ps; } else if (((id_priv->id.ps == RDMA_PS_IB) || (id_priv->id.ps == RDMA_PS_TCP)) && (sid == (RDMA_IB_IP_PS_TCP & mask))) { sid_ps = RDMA_IB_IP_PS_TCP; ps = &tcp_ps; } else if (((id_priv->id.ps == RDMA_PS_IB) || (id_priv->id.ps == RDMA_PS_UDP)) && (sid == (RDMA_IB_IP_PS_UDP & mask))) { sid_ps = RDMA_IB_IP_PS_UDP; ps = &udp_ps; } if (ps) { sib->sib_sid = cpu_to_be64(sid_ps | ntohs(cma_port((struct sockaddr *) sib))); sib->sib_sid_mask = cpu_to_be64(RDMA_IB_IP_PS_MASK | be64_to_cpu(sib->sib_sid_mask)); } return ps; } ",0 "bool BaseArena::WillObjectBeLazilySwept(BasePage* page, void* object_pointer) const { if (page != first_unswept_page_) return true; DCHECK(!page->IsLargeObjectPage()); NormalPage* normal_page = reinterpret_cast(page); NormalPageArena* normal_arena = normal_page->ArenaForNormalPage(); if (!normal_arena->IsLazySweeping()) return true; Address page_end = normal_page->PayloadEnd(); for (Address header_address = normal_page->Payload(); header_address < page_end;) { HeapObjectHeader* header = reinterpret_cast(header_address); size_t size = header->size(); if (header_address > object_pointer) return false; if (!header->IsFree() && header->IsMarked()) { DCHECK(header_address + size < page_end); return true; } header_address += size; } NOTREACHED(); return true; } ",0 "void PrintPreviewUI::SetInitiatorTabURLAndTitle( const std::string& initiator_url, const string16& job_title) { initiator_url_ = initiator_url; initiator_tab_title_ = job_title; } ",0 " bool PlatformSensorProviderBase::CreateSharedBufferIfNeeded() { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (shared_buffer_handle_.is_valid()) return true; shared_buffer_handle_ = mojo::SharedBufferHandle::Create(kSharedBufferSizeInBytes); return shared_buffer_handle_.is_valid(); } ",1 "static int opstos(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; if (!strcmp(op->mnemonic, ""stosw"")) { data[l++] = 0x66; } if (!strcmp(op->mnemonic, ""stosb"")) { data[l++] = 0xaa; } else if (!strcmp(op->mnemonic, ""stosw"")) { data[l++] = 0xab; } else if (!strcmp(op->mnemonic, ""stosd"")) { data[l++] = 0xab; } return l; } ",0 "void RegistrationManager::DisableId(const invalidation::ObjectId& id) { DCHECK(CalledOnValidThread()); RegistrationStatusMap::const_iterator it = registration_statuses_.find(id); if (it == registration_statuses_.end()) { DLOG(WARNING) << ""Attempt to disable non-existent registration for "" << ObjectIdToString(id); return; } it->second->Disable(); } ",0 "remove_unused_rules(struct rule_state * list) { char ifname[IFNAMSIZ]; unsigned short iport; struct rule_state * tmp; u_int64_t packets; u_int64_t bytes; unsigned int timestamp; int n = 0; while(list) { /* remove the rule if no traffic has used it */ if(get_redirect_rule(ifname, list->eport, list->proto, 0, 0, &iport, 0, 0, 0, 0, ×tamp, &packets, &bytes) >= 0) { if(packets == list->packets && bytes == list->bytes) { syslog(LOG_DEBUG, ""removing unused mapping %hu %s : still "" ""%"" PRIu64 ""packets %"" PRIu64 ""bytes"", list->eport, proto_itoa(list->proto), packets, bytes); _upnp_delete_redir(list->eport, list->proto); n++; } } tmp = list; list = tmp->next; free(tmp); } if(n>0) syslog(LOG_NOTICE, ""removed %d unused rules"", n); } ",0 "static int userfaultfd_copy(struct userfaultfd_ctx *ctx, unsigned long arg) { __s64 ret; struct uffdio_copy uffdio_copy; struct uffdio_copy __user *user_uffdio_copy; struct userfaultfd_wake_range range; user_uffdio_copy = (struct uffdio_copy __user *) arg; ret = -EAGAIN; if (READ_ONCE(ctx->mmap_changing)) goto out; ret = -EFAULT; if (copy_from_user(&uffdio_copy, user_uffdio_copy, /* don't copy ""copy"" last field */ sizeof(uffdio_copy)-sizeof(__s64))) goto out; ret = validate_range(ctx->mm, uffdio_copy.dst, uffdio_copy.len); if (ret) goto out; /* * double check for wraparound just in case. copy_from_user() * will later check uffdio_copy.src + uffdio_copy.len to fit * in the userland range. */ ret = -EINVAL; if (uffdio_copy.src + uffdio_copy.len <= uffdio_copy.src) goto out; if (uffdio_copy.mode & ~UFFDIO_COPY_MODE_DONTWAKE) goto out; if (mmget_not_zero(ctx->mm)) { ret = mcopy_atomic(ctx->mm, uffdio_copy.dst, uffdio_copy.src, uffdio_copy.len, &ctx->mmap_changing); mmput(ctx->mm); } else { return -ESRCH; } if (unlikely(put_user(ret, &user_uffdio_copy->copy))) return -EFAULT; if (ret < 0) goto out; BUG_ON(!ret); /* len == 0 would wake all */ range.len = ret; if (!(uffdio_copy.mode & UFFDIO_COPY_MODE_DONTWAKE)) { range.start = uffdio_copy.dst; wake_userfault(ctx, &range); } ret = range.len == uffdio_copy.len ? 0 : -EAGAIN; out: return ret; } ",0 "static bool shouldAllowExternalLoad(const KURL& url) { String urlString = url.string(); if (urlString == ""file:///etc/xml/catalog"") return false; if (urlString.startsWith(""file:///"", false) && urlString.endsWith(""/etc/catalog"", false)) return false; if (urlString.startsWith(""http://www.w3.org/TR/xhtml"", false)) return false; if (urlString.startsWith(""http://www.w3.org/Graphics/SVG"", false)) return false; if (!XMLTokenizerScope::currentDocLoader->doc()->securityOrigin()->canRequest(url)) { XMLTokenizerScope::currentDocLoader->printAccessDeniedMessage(url); return false; } return true; } ",0 "ofputil_encode_port_status(const struct ofputil_port_status *ps, enum ofputil_protocol protocol) { struct ofp_port_status *ops; struct ofpbuf *b; enum ofp_version version; enum ofpraw raw; version = ofputil_protocol_to_ofp_version(protocol); switch (version) { case OFP10_VERSION: raw = OFPRAW_OFPT10_PORT_STATUS; break; case OFP11_VERSION: case OFP12_VERSION: case OFP13_VERSION: raw = OFPRAW_OFPT11_PORT_STATUS; break; case OFP14_VERSION: case OFP15_VERSION: case OFP16_VERSION: raw = OFPRAW_OFPT14_PORT_STATUS; break; default: OVS_NOT_REACHED(); } b = ofpraw_alloc_xid(raw, version, htonl(0), 0); ops = ofpbuf_put_zeros(b, sizeof *ops); ops->reason = ps->reason; ofputil_put_phy_port(version, &ps->desc, b); ofpmsg_update_length(b); return b; } ",0 "static void mtrr_lookup_var_next(struct mtrr_iter *iter) { __mtrr_lookup_var_next(iter); } ",0 " View* GetFocusedView() { return widget_->GetFocusManager()->GetFocusedView(); } ",0 "void BookmarksCreateFunction::GetQuotaLimitHeuristics( QuotaLimitHeuristics* heuristics) const { BookmarksQuotaLimitFactory::BuildForCreate(heuristics, profile()); } ",0 "bool drm_mode_crtc_set_gamma_size(struct drm_crtc *crtc, int gamma_size) { crtc->gamma_size = gamma_size; crtc->gamma_store = kzalloc(gamma_size * sizeof(uint16_t) * 3, GFP_KERNEL); if (!crtc->gamma_store) { crtc->gamma_size = 0; return false; } return true; } ",0 "int jas_stream_read(jas_stream_t *stream, void *buf, int cnt) { int n; int c; char *bufptr; JAS_DBGLOG(100, (""jas_stream_read(%p, %p, %d)\n"", stream, buf, cnt)); if (cnt < 0) { jas_deprecated(""negative count for jas_stream_read""); } bufptr = buf; n = 0; while (n < cnt) { if ((c = jas_stream_getc(stream)) == EOF) { return n; } *bufptr++ = c; ++n; } return n; } ",0 "bool IsValidHostName(base::StringPiece host, base::StringPiece domain_in_lower_case, SubdomainPermission subdomain_permission, base::StringPiece* tld) { if (host.find(domain_in_lower_case) == base::StringPiece::npos) return false; size_t tld_length = net::registry_controlled_domains::GetCanonicalHostRegistryLength( host, net::registry_controlled_domains::EXCLUDE_UNKNOWN_REGISTRIES, net::registry_controlled_domains::EXCLUDE_PRIVATE_REGISTRIES); if ((tld_length == 0) || (tld_length == std::string::npos)) return false; base::StringPiece host_minus_tld = host.substr(0, host.length() - tld_length - 1); if (tld) *tld = host.substr(host.length() - tld_length); if (base::LowerCaseEqualsASCII(host_minus_tld, domain_in_lower_case)) return true; if (subdomain_permission == ALLOW_SUBDOMAIN) { std::string dot_domain("".""); domain_in_lower_case.AppendToString(&dot_domain); return base::EndsWith(host_minus_tld, dot_domain, base::CompareCase::INSENSITIVE_ASCII); } std::string www_domain(""www.""); domain_in_lower_case.AppendToString(&www_domain); return base::LowerCaseEqualsASCII(host_minus_tld, www_domain); } ",0 "static int snd_timer_user_start(struct file *file) { int err; struct snd_timer_user *tu; tu = file->private_data; if (!tu->timeri) return -EBADFD; snd_timer_stop(tu->timeri); tu->timeri->lost = 0; tu->last_resolution = 0; return (err = snd_timer_start(tu->timeri, tu->ticks)) < 0 ? err : 0; } ",0 "int xts_serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { struct serpent_xts_ctx *ctx = crypto_tfm_ctx(tfm); u32 *flags = &tfm->crt_flags; int err; /* key consists of keys of equal size concatenated, therefore * the length must be even */ if (keylen % 2) { *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; return -EINVAL; } /* first half of xts-key is for crypt */ err = __serpent_setkey(&ctx->crypt_ctx, key, keylen / 2); if (err) return err; /* second half of xts-key is for tweak */ return __serpent_setkey(&ctx->tweak_ctx, key + keylen / 2, keylen / 2); } ",0 "void SocketStream::Delegate::OnAuthRequired(SocketStream* socket, AuthChallengeInfo* auth_info) { socket->Close(); } ",0 "void Document::setReadyState(ReadyState readyState) { if (readyState == m_readyState) return; switch (readyState) { case Loading: if (!m_documentTiming.domLoading) m_documentTiming.domLoading = monotonicallyIncreasingTime(); break; case Interactive: if (!m_documentTiming.domInteractive) m_documentTiming.domInteractive = monotonicallyIncreasingTime(); break; case Complete: if (!m_documentTiming.domComplete) m_documentTiming.domComplete = monotonicallyIncreasingTime(); break; } m_readyState = readyState; dispatchEvent(Event::create(eventNames().readystatechangeEvent, false, false)); if (settings() && settings()->suppressesIncrementalRendering()) setVisualUpdatesAllowed(readyState); } ",0 "int ip_mc_sf_allow(struct sock *sk, __be32 loc_addr, __be32 rmt_addr, int dif) { struct inet_sock *inet = inet_sk(sk); struct ip_mc_socklist *pmc; struct ip_sf_socklist *psl; int i; int ret; ret = 1; if (!ipv4_is_multicast(loc_addr)) goto out; rcu_read_lock(); for_each_pmc_rcu(inet, pmc) { if (pmc->multi.imr_multiaddr.s_addr == loc_addr && pmc->multi.imr_ifindex == dif) break; } ret = inet->mc_all; if (!pmc) goto unlock; psl = rcu_dereference(pmc->sflist); ret = (pmc->sfmode == MCAST_EXCLUDE); if (!psl) goto unlock; for (i=0; isl_count; i++) { if (psl->sl_addr[i] == rmt_addr) break; } ret = 0; if (pmc->sfmode == MCAST_INCLUDE && i >= psl->sl_count) goto unlock; if (pmc->sfmode == MCAST_EXCLUDE && i < psl->sl_count) goto unlock; ret = 1; unlock: rcu_read_unlock(); out: return ret; } ",0 "void DatabaseMessageFilter::OnDatabaseDeleteFile(const string16& vfs_file_name, const bool& sync_dir, IPC::Message* reply_msg) { DatabaseDeleteFile(vfs_file_name, sync_dir, reply_msg, kNumDeleteRetries); } ",0 "gx_pattern1_clist_has_trans(const gx_device_color *pdevc) { if (pdevc->colors.pattern.p_tile != NULL && pdevc->colors.pattern.p_tile->cdev != NULL) { return pdevc->colors.pattern.p_tile->cdev->common.page_uses_transparency; } else { return 0; } } ",0 "bool WebContentsImpl::IsAudioMuted() const { return audio_muter_.get() && audio_muter_->is_muting(); } ",0 "static void stringAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { TestInterfaceNodeV8Internal::stringAttributeAttributeGetter(info); } ",0 "static Image *ReadPALMImage(const ImageInfo *image_info, ExceptionInfo *exception) { Image *image; IndexPacket index; MagickBooleanType status; MagickOffsetType totalOffset, seekNextDepth; MagickPixelPacket transpix; register IndexPacket *indexes; register ssize_t i, x; register PixelPacket *q; size_t bytes_per_row, flags, bits_per_pixel, version, nextDepthOffset, transparentIndex, compressionType, byte, mask, redbits, greenbits, bluebits, one, pad, size, bit; ssize_t count, y; unsigned char *lastrow, *one_row, *ptr; unsigned short color16; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { (void) DestroyImageList(image); return((Image *) NULL); } totalOffset=0; do { image->columns=ReadBlobMSBShort(image); image->rows=ReadBlobMSBShort(image); if (EOFBlob(image) != MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if ((image->columns == 0) || (image->rows == 0)) ThrowReaderException(CorruptImageError,""NegativeOrZeroImageSize""); status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } bytes_per_row=ReadBlobMSBShort(image); flags=ReadBlobMSBShort(image); bits_per_pixel=(size_t) ReadBlobByte(image); if ((bits_per_pixel != 1) && (bits_per_pixel != 2) && (bits_per_pixel != 4) && (bits_per_pixel != 8) && (bits_per_pixel != 16)) ThrowReaderException(CorruptImageError,""UnrecognizedBitsPerPixel""); version=(size_t) ReadBlobByte(image); if ((version != 0) && (version != 1) && (version != 2)) ThrowReaderException(CorruptImageError,""FileFormatVersionMismatch""); nextDepthOffset=(size_t) ReadBlobMSBShort(image); transparentIndex=(size_t) ReadBlobByte(image); compressionType=(size_t) ReadBlobByte(image); if ((compressionType != PALM_COMPRESSION_NONE) && (compressionType != PALM_COMPRESSION_SCANLINE ) && (compressionType != PALM_COMPRESSION_RLE)) ThrowReaderException(CorruptImageError,""UnrecognizedImageCompression""); pad=ReadBlobMSBShort(image); (void) pad; /* Initialize image colormap. */ one=1; if ((bits_per_pixel < 16) && (AcquireImageColormap(image,one << bits_per_pixel) == MagickFalse)) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); GetMagickPixelPacket(image,&transpix); if (bits_per_pixel == 16) /* Direct Color */ { redbits=(size_t) ReadBlobByte(image); /* # of bits of red */ (void) redbits; greenbits=(size_t) ReadBlobByte(image); /* # of bits of green */ (void) greenbits; bluebits=(size_t) ReadBlobByte(image); /* # of bits of blue */ (void) bluebits; ReadBlobByte(image); /* reserved by Palm */ ReadBlobByte(image); /* reserved by Palm */ transpix.red=(MagickRealType) (QuantumRange*ReadBlobByte(image)/31); transpix.green=(MagickRealType) (QuantumRange*ReadBlobByte(image)/63); transpix.blue=(MagickRealType) (QuantumRange*ReadBlobByte(image)/31); } if (bits_per_pixel == 8) { IndexPacket index; if (flags & PALM_HAS_COLORMAP_FLAG) { count=(ssize_t) ReadBlobMSBShort(image); for (i=0; i < (ssize_t) count; i++) { ReadBlobByte(image); index=ConstrainColormapIndex(image,(size_t) (255-i)); image->colormap[(int) index].red=ScaleCharToQuantum( (unsigned char) ReadBlobByte(image)); image->colormap[(int) index].green=ScaleCharToQuantum( (unsigned char) ReadBlobByte(image)); image->colormap[(int) index].blue=ScaleCharToQuantum( (unsigned char) ReadBlobByte(image)); } } else for (i=0; i < (ssize_t) (1L << bits_per_pixel); i++) { index=ConstrainColormapIndex(image,(size_t) (255-i)); image->colormap[(int) index].red=ScaleCharToQuantum( PalmPalette[i][0]); image->colormap[(int) index].green=ScaleCharToQuantum( PalmPalette[i][1]); image->colormap[(int) index].blue=ScaleCharToQuantum( PalmPalette[i][2]); } } if (flags & PALM_IS_COMPRESSED_FLAG) size=ReadBlobMSBShort(image); (void) size; image->storage_class=DirectClass; if (bits_per_pixel < 16) { image->storage_class=PseudoClass; image->depth=8; } if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(image); } status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } one_row=(unsigned char *) AcquireQuantumMemory(MagickMax(bytes_per_row, 2*image->columns),sizeof(*one_row)); if (one_row == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); lastrow=(unsigned char *) NULL; if (compressionType == PALM_COMPRESSION_SCANLINE) { lastrow=(unsigned char *) AcquireQuantumMemory(MagickMax(bytes_per_row, 2*image->columns),sizeof(*lastrow)); if (lastrow == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } mask=(size_t) (1U << bits_per_pixel)-1; for (y=0; y < (ssize_t) image->rows; y++) { if ((flags & PALM_IS_COMPRESSED_FLAG) == 0) { /* TODO move out of loop! */ image->compression=NoCompression; count=ReadBlob(image,bytes_per_row,one_row); if (count != (ssize_t) bytes_per_row) break; } else { if (compressionType == PALM_COMPRESSION_RLE) { /* TODO move out of loop! */ image->compression=RLECompression; for (i=0; i < (ssize_t) bytes_per_row; ) { count=(ssize_t) ReadBlobByte(image); if (count < 0) break; count=MagickMin(count,(ssize_t) bytes_per_row-i); byte=(size_t) ReadBlobByte(image); (void) ResetMagickMemory(one_row+i,(int) byte,(size_t) count); i+=count; } } else if (compressionType == PALM_COMPRESSION_SCANLINE) { size_t one; /* TODO move out of loop! */ one=1; image->compression=FaxCompression; for (i=0; i < (ssize_t) bytes_per_row; i+=8) { count=(ssize_t) ReadBlobByte(image); if (count < 0) break; byte=(size_t) MagickMin((ssize_t) bytes_per_row-i,8); for (bit=0; bit < byte; bit++) { if ((y == 0) || (count & (one << (7 - bit)))) one_row[i+bit]=(unsigned char) ReadBlobByte(image); else one_row[i+bit]=lastrow[i+bit]; } } (void) CopyMagickMemory(lastrow, one_row, bytes_per_row); } } ptr=one_row; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); if (bits_per_pixel == 16) { if (image->columns > (2*bytes_per_row)) { one_row=(unsigned char *) RelinquishMagickMemory(one_row); if (compressionType == PALM_COMPRESSION_SCANLINE) lastrow=(unsigned char *) RelinquishMagickMemory(lastrow); ThrowReaderException(CorruptImageError,""CorruptImage""); } for (x=0; x < (ssize_t) image->columns; x++) { color16=(*ptr++ << 8); color16|=(*ptr++); SetPixelRed(q,(QuantumRange*((color16 >> 11) & 0x1f))/0x1f); SetPixelGreen(q,(QuantumRange*((color16 >> 5) & 0x3f))/0x3f); SetPixelBlue(q,(QuantumRange*((color16 >> 0) & 0x1f))/0x1f); SetPixelOpacity(q,OpaqueOpacity); q++; } } else { bit=8-bits_per_pixel; for (x=0; x < (ssize_t) image->columns; x++) { if ((size_t) (ptr-one_row) >= bytes_per_row) { one_row=(unsigned char *) RelinquishMagickMemory(one_row); if (compressionType == PALM_COMPRESSION_SCANLINE) lastrow=(unsigned char *) RelinquishMagickMemory(lastrow); ThrowReaderException(CorruptImageError,""CorruptImage""); } index=(IndexPacket) (mask-(((*ptr) & (mask << bit)) >> bit)); SetPixelIndex(indexes+x,index); SetPixelRGBO(q,image->colormap+(ssize_t) index); if (bit) bit-=bits_per_pixel; else { ptr++; bit=8-bits_per_pixel; } q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } if (flags & PALM_HAS_TRANSPARENCY_FLAG) { IndexPacket index=ConstrainColormapIndex(image,(mask-transparentIndex)); if (bits_per_pixel != 16) SetMagickPixelPacket(image,image->colormap+(ssize_t) index, (const IndexPacket *) NULL,&transpix); (void) TransparentPaintImage(image,&transpix,(Quantum) TransparentOpacity,MagickFalse); } one_row=(unsigned char *) RelinquishMagickMemory(one_row); if (compressionType == PALM_COMPRESSION_SCANLINE) lastrow=(unsigned char *) RelinquishMagickMemory(lastrow); if (EOFBlob(image) != MagickFalse) { ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); break; } /* Proceed to next image. Copied from coders/pnm.c */ if (image_info->number_scenes != 0) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; if (nextDepthOffset != 0) { /* Skip to next image. */ totalOffset+=(MagickOffsetType) (nextDepthOffset*4); if (totalOffset >= (MagickOffsetType) GetBlobSize(image)) ThrowReaderException(CorruptImageError,""ImproperImageHeader"") else seekNextDepth=SeekBlob(image,totalOffset,SEEK_SET); if (seekNextDepth != totalOffset) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); /* Allocate next image structure. Copied from coders/pnm.c */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { (void) DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; } } while (nextDepthOffset != 0); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "int ossl_statem_in_sctp_read_sock(SSL *s) { return s->statem.in_sctp_read_sock; } ",0 "brcmf_cfg80211_connect(struct wiphy *wiphy, struct net_device *ndev, struct cfg80211_connect_params *sme) { struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy); struct brcmf_if *ifp = netdev_priv(ndev); struct ieee80211_channel *chan = sme->channel; struct brcmf_join_params join_params; size_t join_params_size; const struct brcmf_tlv *rsn_ie; const struct brcmf_vs_tlv *wpa_ie; const void *ie; u32 ie_len; struct brcmf_ext_join_params_le *ext_join_params; u16 chanspec; s32 err = 0; u32 ssid_len; brcmf_dbg(TRACE, ""Enter\n""); if (!check_vif_up(ifp->vif)) return -EIO; if (!sme->ssid) { brcmf_err(""Invalid ssid\n""); return -EOPNOTSUPP; } if (ifp->vif == cfg->p2p.bss_idx[P2PAPI_BSSCFG_PRIMARY].vif) { /* A normal (non P2P) connection request setup. */ ie = NULL; ie_len = 0; /* find the WPA_IE */ wpa_ie = brcmf_find_wpaie((u8 *)sme->ie, sme->ie_len); if (wpa_ie) { ie = wpa_ie; ie_len = wpa_ie->len + TLV_HDR_LEN; } else { /* find the RSN_IE */ rsn_ie = brcmf_parse_tlvs((const u8 *)sme->ie, sme->ie_len, WLAN_EID_RSN); if (rsn_ie) { ie = rsn_ie; ie_len = rsn_ie->len + TLV_HDR_LEN; } } brcmf_fil_iovar_data_set(ifp, ""wpaie"", ie, ie_len); } err = brcmf_vif_set_mgmt_ie(ifp->vif, BRCMF_VNDR_IE_ASSOCREQ_FLAG, sme->ie, sme->ie_len); if (err) brcmf_err(""Set Assoc REQ IE Failed\n""); else brcmf_dbg(TRACE, ""Applied Vndr IEs for Assoc request\n""); set_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); if (chan) { cfg->channel = ieee80211_frequency_to_channel(chan->center_freq); chanspec = channel_to_chanspec(&cfg->d11inf, chan); brcmf_dbg(CONN, ""channel=%d, center_req=%d, chanspec=0x%04x\n"", cfg->channel, chan->center_freq, chanspec); } else { cfg->channel = 0; chanspec = 0; } brcmf_dbg(INFO, ""ie (%p), ie_len (%zd)\n"", sme->ie, sme->ie_len); err = brcmf_set_wpa_version(ndev, sme); if (err) { brcmf_err(""wl_set_wpa_version failed (%d)\n"", err); goto done; } sme->auth_type = brcmf_war_auth_type(ifp, sme->auth_type); err = brcmf_set_auth_type(ndev, sme); if (err) { brcmf_err(""wl_set_auth_type failed (%d)\n"", err); goto done; } err = brcmf_set_wsec_mode(ndev, sme); if (err) { brcmf_err(""wl_set_set_cipher failed (%d)\n"", err); goto done; } err = brcmf_set_key_mgmt(ndev, sme); if (err) { brcmf_err(""wl_set_key_mgmt failed (%d)\n"", err); goto done; } err = brcmf_set_sharedkey(ndev, sme); if (err) { brcmf_err(""brcmf_set_sharedkey failed (%d)\n"", err); goto done; } /* Join with specific BSSID and cached SSID * If SSID is zero join based on BSSID only */ join_params_size = offsetof(struct brcmf_ext_join_params_le, assoc_le) + offsetof(struct brcmf_assoc_params_le, chanspec_list); if (cfg->channel) join_params_size += sizeof(u16); ext_join_params = kzalloc(join_params_size, GFP_KERNEL); if (ext_join_params == NULL) { err = -ENOMEM; goto done; } ssid_len = min_t(u32, sme->ssid_len, IEEE80211_MAX_SSID_LEN); ext_join_params->ssid_le.SSID_len = cpu_to_le32(ssid_len); memcpy(&ext_join_params->ssid_le.SSID, sme->ssid, ssid_len); if (ssid_len < IEEE80211_MAX_SSID_LEN) brcmf_dbg(CONN, ""SSID \""%s\"", len (%d)\n"", ext_join_params->ssid_le.SSID, ssid_len); /* Set up join scan parameters */ ext_join_params->scan_le.scan_type = -1; ext_join_params->scan_le.home_time = cpu_to_le32(-1); if (sme->bssid) memcpy(&ext_join_params->assoc_le.bssid, sme->bssid, ETH_ALEN); else eth_broadcast_addr(ext_join_params->assoc_le.bssid); if (cfg->channel) { ext_join_params->assoc_le.chanspec_num = cpu_to_le32(1); ext_join_params->assoc_le.chanspec_list[0] = cpu_to_le16(chanspec); /* Increase dwell time to receive probe response or detect * beacon from target AP at a noisy air only during connect * command. */ ext_join_params->scan_le.active_time = cpu_to_le32(BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS); ext_join_params->scan_le.passive_time = cpu_to_le32(BRCMF_SCAN_JOIN_PASSIVE_DWELL_TIME_MS); /* To sync with presence period of VSDB GO send probe request * more frequently. Probe request will be stopped when it gets * probe response from target AP/GO. */ ext_join_params->scan_le.nprobes = cpu_to_le32(BRCMF_SCAN_JOIN_ACTIVE_DWELL_TIME_MS / BRCMF_SCAN_JOIN_PROBE_INTERVAL_MS); } else { ext_join_params->scan_le.active_time = cpu_to_le32(-1); ext_join_params->scan_le.passive_time = cpu_to_le32(-1); ext_join_params->scan_le.nprobes = cpu_to_le32(-1); } brcmf_set_join_pref(ifp, &sme->bss_select); err = brcmf_fil_bsscfg_data_set(ifp, ""join"", ext_join_params, join_params_size); kfree(ext_join_params); if (!err) /* This is it. join command worked, we are done */ goto done; /* join command failed, fallback to set ssid */ memset(&join_params, 0, sizeof(join_params)); join_params_size = sizeof(join_params.ssid_le); memcpy(&join_params.ssid_le.SSID, sme->ssid, ssid_len); join_params.ssid_le.SSID_len = cpu_to_le32(ssid_len); if (sme->bssid) memcpy(join_params.params_le.bssid, sme->bssid, ETH_ALEN); else eth_broadcast_addr(join_params.params_le.bssid); if (cfg->channel) { join_params.params_le.chanspec_list[0] = cpu_to_le16(chanspec); join_params.params_le.chanspec_num = cpu_to_le32(1); join_params_size += sizeof(join_params.params_le); } err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, &join_params, join_params_size); if (err) brcmf_err(""BRCMF_C_SET_SSID failed (%d)\n"", err); done: if (err) clear_bit(BRCMF_VIF_STATUS_CONNECTING, &ifp->vif->sme_state); brcmf_dbg(TRACE, ""Exit\n""); return err; } ",0 "GURL ChromeContentBrowserClientExtensionsPart::GetEffectiveURL( Profile* profile, const GURL& url) { ExtensionRegistry* registry = ExtensionRegistry::Get(profile); if (!registry) return url; const Extension* extension = registry->enabled_extensions().GetHostedAppByURL(url); if (!extension) return url; if (extension->from_bookmark()) return url; return extension->GetResourceURL(url.path()); } ",0 "static int __dccp_rcv_established(struct sock *sk, struct sk_buff *skb, const struct dccp_hdr *dh, const unsigned int len) { struct dccp_sock *dp = dccp_sk(sk); switch (dccp_hdr(skb)->dccph_type) { case DCCP_PKT_DATAACK: case DCCP_PKT_DATA: /* * FIXME: schedule DATA_DROPPED (RFC 4340, 11.7.2) if and when * - sk_shutdown == RCV_SHUTDOWN, use Code 1, ""Not Listening"" * - sk_receive_queue is full, use Code 2, ""Receive Buffer"" */ dccp_enqueue_skb(sk, skb); return 0; case DCCP_PKT_ACK: goto discard; case DCCP_PKT_RESET: /* * Step 9: Process Reset * If P.type == Reset, * Tear down connection * S.state := TIMEWAIT * Set TIMEWAIT timer * Drop packet and return */ dccp_rcv_reset(sk, skb); return 0; case DCCP_PKT_CLOSEREQ: if (dccp_rcv_closereq(sk, skb)) return 0; goto discard; case DCCP_PKT_CLOSE: if (dccp_rcv_close(sk, skb)) return 0; goto discard; case DCCP_PKT_REQUEST: /* Step 7 * or (S.is_server and P.type == Response) * or (S.is_client and P.type == Request) * or (S.state >= OPEN and P.type == Request * and P.seqno >= S.OSR) * or (S.state >= OPEN and P.type == Response * and P.seqno >= S.OSR) * or (S.state == RESPOND and P.type == Data), * Send Sync packet acknowledging P.seqno * Drop packet and return */ if (dp->dccps_role != DCCP_ROLE_LISTEN) goto send_sync; goto check_seq; case DCCP_PKT_RESPONSE: if (dp->dccps_role != DCCP_ROLE_CLIENT) goto send_sync; check_seq: if (dccp_delta_seqno(dp->dccps_osr, DCCP_SKB_CB(skb)->dccpd_seq) >= 0) { send_sync: dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNC); } break; case DCCP_PKT_SYNC: dccp_send_sync(sk, DCCP_SKB_CB(skb)->dccpd_seq, DCCP_PKT_SYNCACK); /* * From RFC 4340, sec. 5.7 * * As with DCCP-Ack packets, DCCP-Sync and DCCP-SyncAck packets * MAY have non-zero-length application data areas, whose * contents receivers MUST ignore. */ goto discard; } DCCP_INC_STATS(DCCP_MIB_INERRS); discard: __kfree_skb(skb); return 0; } ",0 "e1000e_rx_use_ps_descriptor(E1000ECore *core) { return !e1000e_rx_use_legacy_descriptor(core) && (core->mac[RCTL] & E1000_RCTL_DTYP_PS); } ",0 " int GlobalConfirmInfoBar::DelegateProxy::GetButtons() const { return global_info_bar_ ? global_info_bar_->delegate_->GetButtons() : 0; } ",0 "void ff_clean_mpeg4_qscales(MpegEncContext *s) { int i; int8_t *const qscale_table = s->current_picture.qscale_table; ff_clean_h263_qscales(s); if (s->pict_type == AV_PICTURE_TYPE_B) { int odd = 0; /* ok, come on, this isn't funny anymore, there's more code for * handling this MPEG-4 mess than for the actual adaptive quantization */ for (i = 0; i < s->mb_num; i++) { int mb_xy = s->mb_index2xy[i]; odd += qscale_table[mb_xy] & 1; } if (2 * odd > s->mb_num) odd = 1; else odd = 0; for (i = 0; i < s->mb_num; i++) { int mb_xy = s->mb_index2xy[i]; if ((qscale_table[mb_xy] & 1) != odd) qscale_table[mb_xy]++; if (qscale_table[mb_xy] > 31) qscale_table[mb_xy] = 31; } for (i = 1; i < s->mb_num; i++) { int mb_xy = s->mb_index2xy[i]; if (qscale_table[mb_xy] != qscale_table[s->mb_index2xy[i - 1]] && (s->mb_type[mb_xy] & CANDIDATE_MB_TYPE_DIRECT)) { s->mb_type[mb_xy] |= CANDIDATE_MB_TYPE_BIDIR; } } } } ",0 "bool DBusHelperProxy::hasToStopAction() { QEventLoop loop; loop.processEvents(QEventLoop::AllEvents); return m_stopRequest; } ",0 "bool PlatformSensorAndroid::StartSensor( const PlatformSensorConfiguration& configuration) { JNIEnv* env = AttachCurrentThread(); return Java_PlatformSensor_startSensor(env, j_object_, configuration.frequency()); } ",0 "void Browser::BeforeUnloadFired(TabContents* tab, bool proceed, bool* proceed_to_fire_unload) { if (!is_attempting_to_close_browser_) { *proceed_to_fire_unload = proceed; if (!proceed) tab->set_closed_by_user_gesture(false); return; } if (!proceed) { CancelWindowClose(); *proceed_to_fire_unload = false; tab->set_closed_by_user_gesture(false); return; } if (RemoveFromSet(&tabs_needing_before_unload_fired_, tab)) { tabs_needing_unload_fired_.insert(tab); ProcessPendingTabs(); *proceed_to_fire_unload = false; return; } *proceed_to_fire_unload = true; } ",0 "loop_set_status64(struct loop_device *lo, const struct loop_info64 __user *arg) { struct loop_info64 info64; if (copy_from_user(&info64, arg, sizeof (struct loop_info64))) return -EFAULT; return loop_set_status(lo, &info64); } ",0 "hook_signal_send (const char *signal, const char *type_data, void *signal_data) { struct t_hook *ptr_hook, *next_hook; hook_exec_start (); ptr_hook = weechat_hooks[HOOK_TYPE_SIGNAL]; while (ptr_hook) { next_hook = ptr_hook->next_hook; if (!ptr_hook->deleted && !ptr_hook->running && (string_match (signal, HOOK_SIGNAL(ptr_hook, signal), 0))) { ptr_hook->running = 1; (void) (HOOK_SIGNAL(ptr_hook, callback)) (ptr_hook->callback_data, signal, type_data, signal_data); ptr_hook->running = 0; } ptr_hook = next_hook; } hook_exec_end (); } ",0 "void init_destination (j_compress_ptr cinfo) { my_dest_ptr dest = (my_dest_ptr) cinfo->dest; /* Allocate the output buffer --- it will be released when done with image */ dest->buffer = (unsigned char *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_IMAGE, OUTPUT_BUF_SIZE * sizeof (unsigned char)); dest->pub.next_output_byte = dest->buffer; dest->pub.free_in_buffer = OUTPUT_BUF_SIZE; } ",0 " TestCase& EnableMyFilesVolume() { enable_myfiles_volume.emplace(true); return *this; } ",0 "crm_ipcs_send(crm_client_t * c, uint32_t request, xmlNode * message, enum crm_ipc_flags flags) { struct iovec *iov = NULL; ssize_t rc = 0; if(c == NULL) { return -EDESTADDRREQ; } crm_ipc_init(); rc = crm_ipc_prepare(request, message, &iov, ipc_buffer_max); if (rc > 0) { rc = crm_ipcs_sendv(c, iov, flags | crm_ipc_server_free); } else { free(iov); crm_notice(""Message to %p[%d] failed: %s (%d)"", c->ipcs, c->pid, pcmk_strerror(rc), rc); } return rc; } ",0 "status_t ESDS::parse() { uint8_t tag; size_t data_offset; size_t data_size; status_t err = skipDescriptorHeader(0, mSize, &tag, &data_offset, &data_size); if (err != OK) { return err; } if (tag != kTag_ESDescriptor) { return ERROR_MALFORMED; } return parseESDescriptor(data_offset, data_size); } ",0 "static int h2c_handle_window_update(struct h2c *h2c, struct h2s *h2s) { int32_t inc; int error; if (h2c->dfl != 4) { error = H2_ERR_FRAME_SIZE_ERROR; goto conn_err; } /* process full frame only */ if (h2c->dbuf->i < h2c->dfl) return 0; inc = h2_get_n32(h2c->dbuf, 0); if (h2c->dsi != 0) { /* stream window update */ /* it's not an error to receive WU on a closed stream */ if (h2s->st == H2_SS_CLOSED) return 1; if (!inc) { error = H2_ERR_PROTOCOL_ERROR; goto strm_err; } if (h2s->mws >= 0 && h2s->mws + inc < 0) { error = H2_ERR_FLOW_CONTROL_ERROR; goto strm_err; } h2s->mws += inc; if (h2s->mws > 0 && (h2s->flags & H2_SF_BLK_SFCTL)) { h2s->flags &= ~H2_SF_BLK_SFCTL; if (h2s->cs && LIST_ISEMPTY(&h2s->list) && (h2s->cs->flags & CS_FL_DATA_WR_ENA)) { /* This stream wanted to send but could not due to its * own flow control. We can put it back into the send * list now, it will be handled upon next send() call. */ LIST_ADDQ(&h2c->send_list, &h2s->list); } } } else { /* connection window update */ if (!inc) { error = H2_ERR_PROTOCOL_ERROR; goto conn_err; } if (h2c->mws >= 0 && h2c->mws + inc < 0) { error = H2_ERR_FLOW_CONTROL_ERROR; goto conn_err; } h2c->mws += inc; } return 1; conn_err: h2c_error(h2c, error); return 0; strm_err: if (h2s) { h2s_error(h2s, error); h2c->st0 = H2_CS_FRAME_E; } else h2c_error(h2c, error); return 0; } ",0 "bool TabStrip::IsRectInWindowCaption(const gfx::Rect& rect) { views::View* v = GetEventHandlerForRect(rect); if (v == this) return true; gfx::RectF rect_in_newtab_coords_f(rect); View::ConvertRectToTarget(this, newtab_button_, &rect_in_newtab_coords_f); gfx::Rect rect_in_newtab_coords = gfx::ToEnclosingRect( rect_in_newtab_coords_f); if (newtab_button_->GetLocalBounds().Intersects(rect_in_newtab_coords) && !newtab_button_->HitTestRect(rect_in_newtab_coords)) return true; return false; } ",0 "proc_do_sync_threshold(ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { int *valp = table->data; int val[2]; int rc; /* backup the value first */ memcpy(val, valp, sizeof(val)); rc = proc_dointvec(table, write, buffer, lenp, ppos); if (write && (valp[0] < 0 || valp[1] < 0 || valp[0] >= valp[1])) { /* Restore the correct value */ memcpy(valp, val, sizeof(val)); } return rc; } ",0 "bool DownloadItemImpl::IsValidSavePackageStateTransition( DownloadInternalState from, DownloadInternalState to) { #if DCHECK_IS_ON() switch (from) { case INITIAL_INTERNAL: case TARGET_PENDING_INTERNAL: case INTERRUPTED_TARGET_PENDING_INTERNAL: case TARGET_RESOLVED_INTERNAL: case COMPLETING_INTERNAL: case COMPLETE_INTERNAL: case INTERRUPTED_INTERNAL: case RESUMING_INTERNAL: case CANCELLED_INTERNAL: return false; case IN_PROGRESS_INTERNAL: return to == CANCELLED_INTERNAL || to == COMPLETE_INTERNAL; case MAX_DOWNLOAD_INTERNAL_STATE: NOTREACHED(); } return false; #else return true; #endif } ",0 "CJSON_PUBLIC(cJSON *) cJSON_CreateFloatArray(const float *numbers, int count) { size_t i = 0; cJSON *n = NULL; cJSON *p = NULL; cJSON *a = NULL; if ((count < 0) || (numbers == NULL)) { return NULL; } a = cJSON_CreateArray(); for(i = 0; a && (i < (size_t)count); i++) { n = cJSON_CreateNumber((double)numbers[i]); if(!n) { cJSON_Delete(a); return NULL; } if(!i) { a->child = n; } else { suffix_object(p, n); } p = n; } return a; } ",0 "register_basic_auth_host (const char *hostname) { if (!basic_authed_hosts) { basic_authed_hosts = make_nocase_string_hash_table (1); } if (!hash_table_contains (basic_authed_hosts, hostname)) { hash_table_put (basic_authed_hosts, xstrdup (hostname), NULL); DEBUGP ((""Inserted %s into basic_authed_hosts\n"", quote (hostname))); } } ",0 "static __le64 __mac80211_hwsim_get_tsf(struct mac80211_hwsim_data *data) { u64 now = mac80211_hwsim_get_tsf_raw(); return cpu_to_le64(now + data->tsf_offset); } ",0 "void ScreenRecorder::CaptureDoneCallback( scoped_refptr capture_data) { DCHECK_EQ(capture_loop_, MessageLoop::current()); if (!is_recording_) return; if (capture_data) { base::TimeDelta capture_time = base::Time::Now() - capture_start_time_; int capture_time_ms = static_cast(capture_time.InMilliseconds()); capture_data->set_capture_time_ms(capture_time_ms); scheduler_.RecordCaptureTime(capture_time); capture_data->set_client_sequence_number(sequence_number_); } encode_loop_->PostTask( FROM_HERE, base::Bind(&ScreenRecorder::DoEncode, this, capture_data)); } ",0 "int Elf_(r_bin_elf_get_static)(ELFOBJ *bin) { int i; if (!bin->phdr) { return false; } for (i = 0; i < bin->ehdr.e_phnum; i++) { if (bin->phdr[i].p_type == PT_INTERP) { return false; } } return true; } ",0 "void CLASS scale_colors() { unsigned bottom, right, size, row, col, ur, uc, i, x, y, c, sum[8]; int val, dark, sat; double dsum[8], dmin, dmax; float scale_mul[4], fr, fc; ushort *img=0, *pix; FORC4 cblack[c] += black; if (user_mul[0]) memcpy (pre_mul, user_mul, sizeof pre_mul); if (use_auto_wb || (use_camera_wb && cam_mul[0] == -1)) { memset (dsum, 0, sizeof dsum); bottom = MIN (greybox[1]+greybox[3], height); right = MIN (greybox[0]+greybox[2], width); for (row=greybox[1]; row < bottom; row += 8) for (col=greybox[0]; col < right; col += 8) { memset (sum, 0, sizeof sum); for (y=row; y < row+8 && y < bottom; y++) for (x=col; x < col+8 && x < right; x++) FORC4 { if (filters) { c = FC(y,x); val = BAYER(y,x); } else val = image[y*width+x][c]; if (val > (int)(maximum-25)) goto skip_block; if ((val -= cblack[c]) < 0) val = 0; sum[c] += val; sum[c+4]++; if (filters) break; } FORC(8) dsum[c] += sum[c]; skip_block: ; } FORC4 if (dsum[c]) pre_mul[c] = dsum[c+4] / dsum[c]; } if (use_camera_wb && cam_mul[0] != -1) { memset (sum, 0, sizeof sum); for (row=0; row < 8; row++) for (col=0; col < 8; col++) { c = FC(row,col); if ((val = white[row][col] - cblack[c]) > 0) sum[c] += val; sum[c+4]++; } if (sum[0] && sum[1] && sum[2] && sum[3]) FORC4 pre_mul[c] = (float) sum[c+4] / sum[c]; else if (cam_mul[0] && cam_mul[2]) memcpy (pre_mul, cam_mul, sizeof pre_mul); else dcraw_message (DCRAW_NO_CAMERA_WB,_(""%s: Cannot use camera white balance.\n""), ifname_display); } if (pre_mul[3] == 0) pre_mul[3] = colors < 4 ? pre_mul[1] : 1; dark = black; sat = maximum; if (threshold) wavelet_denoise(); maximum -= black; for (dmin=DBL_MAX, dmax=c=0; c < 4; c++) { if (dmin > pre_mul[c]) dmin = pre_mul[c]; if (dmax < pre_mul[c]) dmax = pre_mul[c]; } if (!highlight) dmax = dmin; FORC4 scale_mul[c] = (pre_mul[c] /= dmax) * 65535.0 / maximum; dcraw_message(DCRAW_VERBOSE, _(""Scaling with darkness %d, saturation %d, and\nmultipliers""), dark, sat); FORC4 dcraw_message(DCRAW_VERBOSE, "" %f"", pre_mul[c]); dcraw_message(DCRAW_VERBOSE, ""\n""); size = iheight*iwidth; for (i=0; i < size*4; i++) { val = image[0][i]; if (!val) continue; val -= cblack[i & 3]; val *= scale_mul[i & 3]; image[0][i] = CLIP(val); } if ((aber[0] != 1 || aber[2] != 1) && colors == 3) { dcraw_message (DCRAW_VERBOSE,_(""Correcting chromatic aberration...\n"")); for (c=0; c < 4; c+=2) { if (aber[c] == 1) continue; img = (ushort *) malloc (size * sizeof *img); merror (img, ""scale_colors()""); for (i=0; i < size; i++) img[i] = image[i][c]; for (row=0; row < iheight; row++) { ur = fr = (row - iheight*0.5) * aber[c] + iheight*0.5; if (ur > (unsigned)(iheight-2)) continue; fr -= ur; for (col=0; col < iwidth; col++) { uc = fc = (col - iwidth*0.5) * aber[c] + iwidth*0.5; if (uc > (unsigned)(iwidth-2)) continue; fc -= uc; pix = img + ur*iwidth + uc; image[row*iwidth+col][c] = (pix[ 0]*(1-fc) + pix[ 1]*fc) * (1-fr) + (pix[iwidth]*(1-fc) + pix[iwidth+1]*fc) * fr; } } free(img); } } } ",0 "int credssp_write_ts_credentials(rdpCredssp* credssp, wStream* s) { int size = 0; int innerSize = credssp_sizeof_ts_credentials(credssp); int passwordSize; /* TSCredentials (SEQUENCE) */ size += ber_write_sequence_tag(s, innerSize); /* [0] credType (INTEGER) */ size += ber_write_contextual_tag(s, 0, ber_sizeof_integer(1), TRUE); size += ber_write_integer(s, 1); /* [1] credentials (OCTET STRING) */ passwordSize = ber_sizeof_sequence(credssp_sizeof_ts_password_creds(credssp)); size += ber_write_contextual_tag(s, 1, ber_sizeof_octet_string(passwordSize), TRUE); size += ber_write_octet_string_tag(s, passwordSize); size += credssp_write_ts_password_creds(credssp, s); return size; } ",0 "static void _ewk_view_scroll_add(Ewk_View_Private_Data* priv, Evas_Coord deltaX, Evas_Coord deltaY, Evas_Coord x, Evas_Coord y, Evas_Coord width, Evas_Coord height, Eina_Bool mainScroll) { Ewk_Scroll_Request* rect; Ewk_Scroll_Request* rect_end; Evas_Coord x2 = x + width, y2 = y + height; rect = priv->scrolls.array; rect_end = rect + priv->scrolls.count; for (; rect < rect_end; rect++) { if (rect->x == x && rect->y == y && rect->w == width && rect->h == height) { DBG(""region already scrolled %d,%d+%dx%d %+03d,%+03d add "" ""%+03d,%+03d"", rect->x, rect->y, rect->w, rect->h, rect->dx, rect->dy, deltaX, deltaY); rect->dx += deltaX; rect->dy += deltaY; return; } if ((x <= rect->x && x2 >= rect->x2) && (y <= rect->y && y2 >= rect->y2)) { DBG(""old viewport (%d,%d+%dx%d %+03d,%+03d) was scrolled itself, "" ""add %+03d,%+03d"", rect->x, rect->y, rect->w, rect->h, rect->dx, rect->dy, deltaX, deltaY); rect->x += deltaX; rect->y += deltaY; } } if (priv->scrolls.allocated == priv->scrolls.count) { size_t size; if (!priv->scrolls.allocated) size = EWK_VIEW_SCROLLS_SIZE_INITIAL; else size = priv->scrolls.allocated + EWK_VIEW_SCROLLS_SIZE_STEP; if (!_ewk_view_scrolls_resize(priv, size)) return; } rect = priv->scrolls.array + priv->scrolls.count; priv->scrolls.count++; rect->x = x; rect->y = y; rect->w = width; rect->h = height; rect->x2 = x2; rect->y2 = y2; rect->dx = deltaX; rect->dy = deltaY; rect->main_scroll = mainScroll; DBG(""add scroll in region: %d, %d+%dx%d %+03d, %+03d"", x, y, width, height, deltaX, deltaY); Eina_Rectangle* pr; Eina_Rectangle* pr_end; size_t count; pr = priv->repaints.array; count = priv->repaints.count; pr_end = pr + count; for (; pr < pr_end; pr++) { pr->x += deltaX; pr->y += deltaY; } } ",0 "__nfs4_file_get_access(struct nfs4_file *fp, u32 access) { lockdep_assert_held(&fp->fi_lock); if (access & NFS4_SHARE_ACCESS_WRITE) atomic_inc(&fp->fi_access[O_WRONLY]); if (access & NFS4_SHARE_ACCESS_READ) atomic_inc(&fp->fi_access[O_RDONLY]); } ",0 "gpc_sRGB(Pixel *out, const Pixel *in, const Background *back) { (void)back; out->r = isRGB(in->r); if (in->g == in->r) { out->g = out->r; if (in->b == in->r) out->b = out->r; else out->b = isRGB(in->b); } else { out->g = isRGB(in->g); if (in->b == in->r) out->b = out->r; else if (in->b == in->g) out->b = out->g; else out->b = isRGB(in->b); } out->a = 255; } ",0 "static int local_lremovexattr(FsContext *ctx, V9fsPath *fs_path, const char *name) { char *path = fs_path->data; return v9fs_remove_xattr(ctx, path, name); } ",0 "void AXLayoutObject::detachRemoteSVGRoot() { if (AXSVGRoot* root = remoteSVGRootElement()) root->setParent(0); } ",0 " void update_max_used_slots(struct b43_dmaring *ring, int current_used_slots) { } ",0 "void ShowGeolocationPromptHelperTask(const JavaObjectWeakGlobalRef& java_ref, const GURL& origin) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef j_ref = java_ref.get(env); if (j_ref.obj()) { ScopedJavaLocalRef j_origin( ConvertUTF8ToJavaString(env, origin.spec())); devtools_instrumentation::ScopedEmbedderCallbackTask embedder_callback( ""onGeolocationPermissionsShowPrompt""); Java_AwContents_onGeolocationPermissionsShowPrompt(env, j_ref.obj(), j_origin.obj()); } } ",0 "donote(struct magic_set *ms, void *vbuf, size_t offset, size_t size, int clazz, int swap, size_t align, int *flags) { Elf32_Nhdr nh32; Elf64_Nhdr nh64; size_t noff, doff; #ifdef ELFCORE int os_style = -1; #endif uint32_t namesz, descsz; unsigned char *nbuf = CAST(unsigned char *, vbuf); char sbuf[512]; if (xnh_sizeof + offset > size) { /* * We're out of note headers. */ return xnh_sizeof + offset; } (void)memcpy(xnh_addr, &nbuf[offset], xnh_sizeof); offset += xnh_sizeof; namesz = xnh_namesz; descsz = xnh_descsz; if ((namesz == 0) && (descsz == 0)) { /* * We're out of note headers. */ return (offset >= size) ? offset : size; } if (namesz & 0x80000000) { (void)file_printf(ms, "", bad note name size 0x%lx"", (unsigned long)namesz); return 0; } if (descsz & 0x80000000) { (void)file_printf(ms, "", bad note description size 0x%lx"", (unsigned long)descsz); return 0; } noff = offset; doff = ELF_ALIGN(offset + namesz); if (offset + namesz > size) { /* * We're past the end of the buffer. */ return doff; } offset = ELF_ALIGN(doff + descsz); if (doff + descsz > size) { /* * We're past the end of the buffer. */ return (offset >= size) ? offset : size; } if ((*flags & (FLAGS_DID_NOTE|FLAGS_DID_BUILD_ID)) == (FLAGS_DID_NOTE|FLAGS_DID_BUILD_ID)) goto core; if (namesz == 5 && strcmp((char *)&nbuf[noff], ""SuSE"") == 0 && xnh_type == NT_GNU_VERSION && descsz == 2) { file_printf(ms, "", for SuSE %d.%d"", nbuf[doff], nbuf[doff + 1]); } if (namesz == 4 && strcmp((char *)&nbuf[noff], ""GNU"") == 0 && xnh_type == NT_GNU_VERSION && descsz == 16) { uint32_t desc[4]; (void)memcpy(desc, &nbuf[doff], sizeof(desc)); if (file_printf(ms, "", for GNU/"") == -1) return size; switch (elf_getu32(swap, desc[0])) { case GNU_OS_LINUX: if (file_printf(ms, ""Linux"") == -1) return size; break; case GNU_OS_HURD: if (file_printf(ms, ""Hurd"") == -1) return size; break; case GNU_OS_SOLARIS: if (file_printf(ms, ""Solaris"") == -1) return size; break; case GNU_OS_KFREEBSD: if (file_printf(ms, ""kFreeBSD"") == -1) return size; break; case GNU_OS_KNETBSD: if (file_printf(ms, ""kNetBSD"") == -1) return size; break; default: if (file_printf(ms, """") == -1) return size; } if (file_printf(ms, "" %d.%d.%d"", elf_getu32(swap, desc[1]), elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1) return size; *flags |= FLAGS_DID_NOTE; return size; } if (namesz == 4 && strcmp((char *)&nbuf[noff], ""GNU"") == 0 && xnh_type == NT_GNU_BUILD_ID && (descsz == 16 || descsz == 20)) { uint8_t desc[20]; uint32_t i; if (file_printf(ms, "", BuildID[%s]="", descsz == 16 ? ""md5/uuid"" : ""sha1"") == -1) return size; (void)memcpy(desc, &nbuf[doff], descsz); for (i = 0; i < descsz; i++) if (file_printf(ms, ""%02x"", desc[i]) == -1) return size; *flags |= FLAGS_DID_BUILD_ID; } if (namesz == 4 && strcmp((char *)&nbuf[noff], ""PaX"") == 0 && xnh_type == NT_NETBSD_PAX && descsz == 4) { static const char *pax[] = { ""+mprotect"", ""-mprotect"", ""+segvguard"", ""-segvguard"", ""+ASLR"", ""-ASLR"", }; uint32_t desc; size_t i; int did = 0; (void)memcpy(&desc, &nbuf[doff], sizeof(desc)); desc = elf_getu32(swap, desc); if (desc && file_printf(ms, "", PaX: "") == -1) return size; for (i = 0; i < __arraycount(pax); i++) { if (((1 << i) & desc) == 0) continue; if (file_printf(ms, ""%s%s"", did++ ? "","" : """", pax[i]) == -1) return size; } } if (namesz == 7 && strcmp((char *)&nbuf[noff], ""NetBSD"") == 0) { switch (xnh_type) { case NT_NETBSD_VERSION: if (descsz == 4) { do_note_netbsd_version(ms, swap, &nbuf[doff]); *flags |= FLAGS_DID_NOTE; return size; } break; case NT_NETBSD_MARCH: if (file_printf(ms, "", compiled for: %.*s"", (int)descsz, (const char *)&nbuf[doff]) == -1) return size; break; case NT_NETBSD_CMODEL: if (file_printf(ms, "", compiler model: %.*s"", (int)descsz, (const char *)&nbuf[doff]) == -1) return size; break; default: if (file_printf(ms, "", note=%u"", xnh_type) == -1) return size; break; } return size; } if (namesz == 8 && strcmp((char *)&nbuf[noff], ""FreeBSD"") == 0) { if (xnh_type == NT_FREEBSD_VERSION && descsz == 4) { do_note_freebsd_version(ms, swap, &nbuf[doff]); *flags |= FLAGS_DID_NOTE; return size; } } if (namesz == 8 && strcmp((char *)&nbuf[noff], ""OpenBSD"") == 0 && xnh_type == NT_OPENBSD_VERSION && descsz == 4) { if (file_printf(ms, "", for OpenBSD"") == -1) return size; /* Content of note is always 0 */ *flags |= FLAGS_DID_NOTE; return size; } if (namesz == 10 && strcmp((char *)&nbuf[noff], ""DragonFly"") == 0 && xnh_type == NT_DRAGONFLY_VERSION && descsz == 4) { uint32_t desc; if (file_printf(ms, "", for DragonFly"") == -1) return size; (void)memcpy(&desc, &nbuf[doff], sizeof(desc)); desc = elf_getu32(swap, desc); if (file_printf(ms, "" %d.%d.%d"", desc / 100000, desc / 10000 % 10, desc % 10000) == -1) return size; *flags |= FLAGS_DID_NOTE; return size; } core: /* * Sigh. The 2.0.36 kernel in Debian 2.1, at * least, doesn't correctly implement name * sections, in core dumps, as specified by * the ""Program Linking"" section of ""UNIX(R) System * V Release 4 Programmer's Guide: ANSI C and * Programming Support Tools"", because my copy * clearly says ""The first 'namesz' bytes in 'name' * contain a *null-terminated* [emphasis mine] * character representation of the entry's owner * or originator"", but the 2.0.36 kernel code * doesn't include the terminating null in the * name.... */ if ((namesz == 4 && strncmp((char *)&nbuf[noff], ""CORE"", 4) == 0) || (namesz == 5 && strcmp((char *)&nbuf[noff], ""CORE"") == 0)) { os_style = OS_STYLE_SVR4; } if ((namesz == 8 && strcmp((char *)&nbuf[noff], ""FreeBSD"") == 0)) { os_style = OS_STYLE_FREEBSD; } if ((namesz >= 11 && strncmp((char *)&nbuf[noff], ""NetBSD-CORE"", 11) == 0)) { os_style = OS_STYLE_NETBSD; } #ifdef ELFCORE if ((*flags & FLAGS_DID_CORE) != 0) return size; if (os_style != -1 && (*flags & FLAGS_DID_CORE_STYLE) == 0) { if (file_printf(ms, "", %s-style"", os_style_names[os_style]) == -1) return size; *flags |= FLAGS_DID_CORE_STYLE; } switch (os_style) { case OS_STYLE_NETBSD: if (xnh_type == NT_NETBSD_CORE_PROCINFO) { uint32_t signo; /* * Extract the program name. It is at * offset 0x7c, and is up to 32-bytes, * including the terminating NUL. */ if (file_printf(ms, "", from '%.31s'"", file_printable(sbuf, sizeof(sbuf), (const char *)&nbuf[doff + 0x7c])) == -1) return size; /* * Extract the signal number. It is at * offset 0x08. */ (void)memcpy(&signo, &nbuf[doff + 0x08], sizeof(signo)); if (file_printf(ms, "" (signal %u)"", elf_getu32(swap, signo)) == -1) return size; *flags |= FLAGS_DID_CORE; return size; } break; default: if (xnh_type == NT_PRPSINFO && *flags & FLAGS_IS_CORE) { size_t i, j; unsigned char c; /* * Extract the program name. We assume * it to be 16 characters (that's what it * is in SunOS 5.x and Linux). * * Unfortunately, it's at a different offset * in various OSes, so try multiple offsets. * If the characters aren't all printable, * reject it. */ for (i = 0; i < NOFFSETS; i++) { unsigned char *cname, *cp; size_t reloffset = prpsoffsets(i); size_t noffset = doff + reloffset; size_t k; for (j = 0; j < 16; j++, noffset++, reloffset++) { /* * Make sure we're not past * the end of the buffer; if * we are, just give up. */ if (noffset >= size) goto tryanother; /* * Make sure we're not past * the end of the contents; * if we are, this obviously * isn't the right offset. */ if (reloffset >= descsz) goto tryanother; c = nbuf[noffset]; if (c == '\0') { /* * A '\0' at the * beginning is * obviously wrong. * Any other '\0' * means we're done. */ if (j == 0) goto tryanother; else break; } else { /* * A nonprintable * character is also * wrong. */ if (!isprint(c) || isquote(c)) goto tryanother; } } /* * Well, that worked. */ /* * Try next offsets, in case this match is * in the middle of a string. */ for (k = i + 1 ; k < NOFFSETS ; k++) { size_t no; int adjust = 1; if (prpsoffsets(k) >= prpsoffsets(i)) continue; for (no = doff + prpsoffsets(k); no < doff + prpsoffsets(i); no++) adjust = adjust && isprint(nbuf[no]); if (adjust) i = k; } cname = (unsigned char *) &nbuf[doff + prpsoffsets(i)]; for (cp = cname; *cp && isprint(*cp); cp++) continue; /* * Linux apparently appends a space at the end * of the command line: remove it. */ while (cp > cname && isspace(cp[-1])) cp--; if (file_printf(ms, "", from '%.*s'"", (int)(cp - cname), cname) == -1) return size; *flags |= FLAGS_DID_CORE; return size; tryanother: ; } } break; } #endif return offset; } ",0 "bool MockContentSettingsClient::allowRunningInsecureContent( bool enabled_per_settings, const blink::WebSecurityOrigin& context, const blink::WebURL& url) { return enabled_per_settings || flags_->running_insecure_content_allowed(); } ",0 "static int list_locations(struct kmem_cache *s, char *buf, enum track_item alloc) { int len = 0; unsigned long i; struct loc_track t = { 0, 0, NULL }; int node; if (!alloc_loc_track(&t, PAGE_SIZE / sizeof(struct location), GFP_TEMPORARY)) return sprintf(buf, ""Out of memory\n""); /* Push back cpu slabs */ flush_all(s); for_each_node_state(node, N_NORMAL_MEMORY) { struct kmem_cache_node *n = get_node(s, node); unsigned long flags; struct page *page; if (!atomic_long_read(&n->nr_slabs)) continue; spin_lock_irqsave(&n->list_lock, flags); list_for_each_entry(page, &n->partial, lru) process_slab(&t, s, page, alloc); list_for_each_entry(page, &n->full, lru) process_slab(&t, s, page, alloc); spin_unlock_irqrestore(&n->list_lock, flags); } for (i = 0; i < t.count; i++) { struct location *l = &t.loc[i]; if (len > PAGE_SIZE - 100) break; len += sprintf(buf + len, ""%7ld "", l->count); if (l->addr) len += sprint_symbol(buf + len, (unsigned long)l->addr); else len += sprintf(buf + len, """"); if (l->sum_time != l->min_time) { unsigned long remainder; len += sprintf(buf + len, "" age=%ld/%ld/%ld"", l->min_time, div_long_long_rem(l->sum_time, l->count, &remainder), l->max_time); } else len += sprintf(buf + len, "" age=%ld"", l->min_time); if (l->min_pid != l->max_pid) len += sprintf(buf + len, "" pid=%ld-%ld"", l->min_pid, l->max_pid); else len += sprintf(buf + len, "" pid=%ld"", l->min_pid); if (num_online_cpus() > 1 && !cpus_empty(l->cpus) && len < PAGE_SIZE - 60) { len += sprintf(buf + len, "" cpus=""); len += cpulist_scnprintf(buf + len, PAGE_SIZE - len - 50, l->cpus); } if (num_online_nodes() > 1 && !nodes_empty(l->nodes) && len < PAGE_SIZE - 60) { len += sprintf(buf + len, "" nodes=""); len += nodelist_scnprintf(buf + len, PAGE_SIZE - len - 50, l->nodes); } len += sprintf(buf + len, ""\n""); } free_loc_track(&t); if (!t.count) len += sprintf(buf, ""No data\n""); return len; } ",1 "void CCThreadProxy::commitOnCCThread(CCCompletionEvent* completion) { TRACE_EVENT(""CCThreadProxy::beginFrameAndCommitOnCCThread"", this, 0); ASSERT(isImplThread()); ASSERT(m_schedulerOnCCThread->commitPending()); if (!m_layerTreeHostImpl) { completion->signal(); return; } m_layerTreeHostImpl->beginCommit(); m_layerTreeHost->commitToOnCCThread(m_layerTreeHostImpl.get()); m_layerTreeHostImpl->commitComplete(); completion->signal(); m_schedulerOnCCThread->didCommit(); } ",0 "void Browser::OpenSearchEngineOptionsDialog() { UserMetrics::RecordAction(UserMetricsAction(""EditSearchEngines"")); ShowOptionsTab(chrome::kSearchEnginesSubPage); } ",0 "static void stringAttrWithSetterExceptionAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueString(info, imp->stringAttrWithSetterException(), info.GetIsolate()); } ",0 "int crypto_init_shash_ops_async(struct crypto_tfm *tfm) { struct crypto_alg *calg = tfm->__crt_alg; struct shash_alg *alg = __crypto_shash_alg(calg); struct crypto_ahash *crt = __crypto_ahash_cast(tfm); struct crypto_shash **ctx = crypto_tfm_ctx(tfm); struct crypto_shash *shash; if (!crypto_mod_get(calg)) return -EAGAIN; shash = crypto_create_tfm(calg, &crypto_shash_type); if (IS_ERR(shash)) { crypto_mod_put(calg); return PTR_ERR(shash); } *ctx = shash; tfm->exit = crypto_exit_shash_ops_async; crt->init = shash_async_init; crt->update = shash_async_update; crt->final = shash_async_final; crt->finup = shash_async_finup; crt->digest = shash_async_digest; if (alg->setkey) crt->setkey = shash_async_setkey; if (alg->export) crt->export = shash_async_export; if (alg->import) crt->import = shash_async_import; crt->reqsize = sizeof(struct shash_desc) + crypto_shash_descsize(shash); return 0; } ",0 "static PHP_FUNCTION(xmlwriter_start_pi) { php_xmlwriter_string_arg(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextWriterStartPI, ""Invalid PI Target""); } ",0 "static inline int propagate_entity_load_avg(struct sched_entity *se) { struct cfs_rq *cfs_rq, *gcfs_rq; if (entity_is_task(se)) return 0; gcfs_rq = group_cfs_rq(se); if (!gcfs_rq->propagate) return 0; gcfs_rq->propagate = 0; cfs_rq = cfs_rq_of(se); add_tg_cfs_propagate(cfs_rq, gcfs_rq->prop_runnable_sum); update_tg_cfs_util(cfs_rq, se, gcfs_rq); update_tg_cfs_runnable(cfs_rq, se, gcfs_rq); return 1; } ",0 "bool MessageLoop::SweepDelayedWorkQueueAndReturnTrueIfStillHasWork() { while (!delayed_work_queue_.empty()) { const PendingTask& pending_task = delayed_work_queue_.top(); if (!pending_task.task.IsCancelled()) return true; #if defined(OS_WIN) DecrementHighResTaskCountIfNeeded(pending_task); #endif delayed_work_queue_.pop(); } return false; } ",0 "GpuProcessPolicy::GpuProcessPolicy() : GpuProcessPolicy(false) { } ",0 "init_side (FlatpakProxyClient *client, ProxySide *side) { side->got_first_byte = (side == &client->bus_side); side->client = client; side->header_buffer.size = 16; side->header_buffer.pos = 0; side->current_read_buffer = &side->header_buffer; side->expected_replies = g_hash_table_new (g_direct_hash, g_direct_equal); } ",0 "static LPCSTR __inline GetPacketCase(tTcpIpPacketParsingResult res) { static const char *const IPCaseName[4] = { ""not tested"", ""Non-IP"", ""IPv4"", ""IPv6"" }; if (res.xxpStatus == ppresXxpKnown) return res.TcpUdp == ppresIsTCP ? (res.ipStatus == ppresIPV4 ? ""TCPv4"" : ""TCPv6"") : (res.ipStatus == ppresIPV4 ? ""UDPv4"" : ""UDPv6""); if (res.xxpStatus == ppresXxpIncomplete) return res.TcpUdp == ppresIsTCP ? ""Incomplete TCP"" : ""Incomplete UDP""; if (res.xxpStatus == ppresXxpOther) return ""IP""; return IPCaseName[res.ipStatus]; } ",0 "acpi_status acpi_os_execute(acpi_execute_type type, acpi_osd_exec_callback function, void *context) { acpi_status status = AE_OK; struct acpi_os_dpc *dpc; struct workqueue_struct *queue; int ret; ACPI_DEBUG_PRINT((ACPI_DB_EXEC, ""Scheduling function [%p(%p)] for deferred execution.\n"", function, context)); if (type == OSL_DEBUGGER_MAIN_THREAD) { ret = acpi_debugger_create_thread(function, context); if (ret) { pr_err(""Call to kthread_create() failed.\n""); status = AE_ERROR; } goto out_thread; } /* * Allocate/initialize DPC structure. Note that this memory will be * freed by the callee. The kernel handles the work_struct list in a * way that allows us to also free its memory inside the callee. * Because we may want to schedule several tasks with different * parameters we can't use the approach some kernel code uses of * having a static work_struct. */ dpc = kzalloc(sizeof(struct acpi_os_dpc), GFP_ATOMIC); if (!dpc) return AE_NO_MEMORY; dpc->function = function; dpc->context = context; /* * To prevent lockdep from complaining unnecessarily, make sure that * there is a different static lockdep key for each workqueue by using * INIT_WORK() for each of them separately. */ if (type == OSL_NOTIFY_HANDLER) { queue = kacpi_notify_wq; INIT_WORK(&dpc->work, acpi_os_execute_deferred); } else if (type == OSL_GPE_HANDLER) { queue = kacpid_wq; INIT_WORK(&dpc->work, acpi_os_execute_deferred); } else { pr_err(""Unsupported os_execute type %d.\n"", type); status = AE_ERROR; } if (ACPI_FAILURE(status)) goto err_workqueue; /* * On some machines, a software-initiated SMI causes corruption unless * the SMI runs on CPU 0. An SMI can be initiated by any AML, but * typically it's done in GPE-related methods that are run via * workqueues, so we can avoid the known corruption cases by always * queueing on CPU 0. */ ret = queue_work_on(0, queue, &dpc->work); if (!ret) { printk(KERN_ERR PREFIX ""Call to queue_work() failed.\n""); status = AE_ERROR; } err_workqueue: if (ACPI_FAILURE(status)) kfree(dpc); out_thread: return status; } ",0 " void GrantPermissionsForFileSystem(const std::string& filesystem_id, int permissions) { if (filesystem_permissions_.find(filesystem_id) == filesystem_permissions_.end()) fileapi::IsolatedContext::GetInstance()->AddReference(filesystem_id); filesystem_permissions_[filesystem_id] = permissions; } ",0 "e1000e_set_fcrth(E1000ECore *core, int index, uint32_t val) { core->mac[FCRTH] = val & 0xFFF8; } ",0 "gboolean BrowserWindowGtk::OnButtonPressEvent(GtkWidget* widget, GdkEventButton* event) { if (event->type == GDK_BUTTON_PRESS) { if (event->button == 8) { chrome::GoBack(browser_.get(), CURRENT_TAB); return TRUE; } else if (event->button == 9) { chrome::GoForward(browser_.get(), CURRENT_TAB); return TRUE; } } int win_x, win_y; GdkWindow* gdk_window = gtk_widget_get_window(GTK_WIDGET(window_)); gdk_window_get_origin(gdk_window, &win_x, &win_y); GdkWindowEdge edge; gfx::Point point(static_cast(event->x_root - win_x), static_cast(event->y_root - win_y)); bool has_hit_edge = GetWindowEdge(point.x(), point.y(), &edge); GtkWidget* toolbar = toolbar_->widget(); if (!gtk_widget_get_visible(toolbar)) { toolbar = render_area_vbox_; } gint toolbar_y; gtk_widget_get_pointer(toolbar, NULL, &toolbar_y); bool has_hit_titlebar = !IsFullscreen() && (toolbar_y < 0) && !has_hit_edge; if (event->button == 1) { if (GDK_BUTTON_PRESS == event->type) { if ((has_hit_titlebar || has_hit_edge) && !suppress_window_raise_) gdk_window_raise(gdk_window); if (has_hit_titlebar) { return gtk_window_util::HandleTitleBarLeftMousePress( window_, bounds_, event); } else if (has_hit_edge) { gtk_window_begin_resize_drag(window_, edge, event->button, static_cast(event->x_root), static_cast(event->y_root), event->time); return TRUE; } } else if (GDK_2BUTTON_PRESS == event->type) { if (has_hit_titlebar) { if (IsMaximized()) { UnMaximize(); } else { gtk_window_maximize(window_); } return TRUE; } } } else if (event->button == 2) { if (has_hit_titlebar || has_hit_edge) { gdk_window_lower(gdk_window); } return TRUE; } else if (event->button == 3) { if (has_hit_titlebar) { titlebar_->ShowContextMenu(event); return TRUE; } } return FALSE; // Continue to propagate the event. } ",0 "u_bitwidth_to_subformat (int bits) { static int array [] = { SF_FORMAT_PCM_U8, SF_FORMAT_PCM_16, SF_FORMAT_PCM_24, SF_FORMAT_PCM_32 } ; if (bits < 8 || bits > 32) return 0 ; return array [((bits + 7) / 8) - 1] ; } /* bitwidth_to_subformat */ ",0 "static int raw_rcv_skb(struct sock *sk, struct sk_buff *skb) { /* Charge it to the socket. */ ipv4_pktinfo_prepare(sk, skb); if (sock_queue_rcv_skb(sk, skb) < 0) { kfree_skb(skb); return NET_RX_DROP; } return NET_RX_SUCCESS; } ",0 "const AtomicString& Document::dir() { Element* rootElement = documentElement(); if (isHTMLHtmlElement(rootElement)) return toHTMLHtmlElement(rootElement)->dir(); return nullAtom; } ",0 "static void fdctrl_handle_restore(FDCtrl *fdctrl, int direction) { FDrive *cur_drv = get_cur_drv(fdctrl); /* Drives position */ drv0(fdctrl)->track = fdctrl->fifo[3]; drv1(fdctrl)->track = fdctrl->fifo[4]; #if MAX_FD == 4 drv2(fdctrl)->track = fdctrl->fifo[5]; drv3(fdctrl)->track = fdctrl->fifo[6]; #endif /* timers */ fdctrl->timer0 = fdctrl->fifo[7]; fdctrl->timer1 = fdctrl->fifo[8]; cur_drv->last_sect = fdctrl->fifo[9]; fdctrl->lock = fdctrl->fifo[10] >> 7; cur_drv->perpendicular = (fdctrl->fifo[10] >> 2) & 0xF; fdctrl->config = fdctrl->fifo[11]; fdctrl->precomp_trk = fdctrl->fifo[12]; fdctrl->pwrd = fdctrl->fifo[13]; fdctrl_reset_fifo(fdctrl); } ",0 "hstore_le(PG_FUNCTION_ARGS) { int res = DatumGetInt32(DirectFunctionCall2(hstore_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(res <= 0); } ",0 "static int alloc_loc_track(struct loc_track *t, unsigned long max, gfp_t flags) { struct location *l; int order; order = get_order(sizeof(struct location) * max); l = (void *)__get_free_pages(flags, order); if (!l) return 0; if (t->count) { memcpy(l, t->loc, sizeof(struct location) * t->count); free_loc_track(t); } t->max = max; t->loc = l; return 1; } ",0 "void RenderFrameImpl::SimulateImeSetComposition( const base::string16& text, const std::vector& underlines, int selection_start, int selection_end) { render_view_->OnImeSetComposition( text, underlines, selection_start, selection_end); } ",0 "ShelfDelegate* ShellDelegateImpl::CreateShelfDelegate(ShelfModel* model) { shelf_delegate_ = new ShelfDelegateImpl(); return shelf_delegate_; } ",0 "NTSTATUS TCWriteDevice (PDEVICE_OBJECT deviceObject, PVOID buffer, LARGE_INTEGER offset, ULONG length) { return TCReadWriteDevice (TRUE, deviceObject, buffer, offset, length); } ",0 "int http_process_req_common(struct session *s, struct channel *req, int an_bit, struct proxy *px) { struct http_txn *txn = &s->txn; struct http_msg *msg = &txn->req; struct redirect_rule *rule; struct cond_wordlist *wl; enum rule_result verdict; if (unlikely(msg->msg_state < HTTP_MSG_BODY)) { /* we need more data */ channel_dont_connect(req); return 0; } DPRINTF(stderr,""[%u] %s: session=%p b=%p, exp(r,w)=%u,%u bf=%08x bh=%d analysers=%02x\n"", now_ms, __FUNCTION__, s, req, req->rex, req->wex, req->flags, req->buf->i, req->analysers); /* just in case we have some per-backend tracking */ session_inc_be_http_req_ctr(s); /* evaluate http-request rules */ if (!LIST_ISEMPTY(&px->http_req_rules)) { verdict = http_req_get_intercept_rule(px, &px->http_req_rules, s, txn); switch (verdict) { case HTTP_RULE_RES_CONT: case HTTP_RULE_RES_STOP: /* nothing to do */ break; case HTTP_RULE_RES_DENY: /* deny or tarpit */ if (txn->flags & TX_CLTARPIT) goto tarpit; goto deny; case HTTP_RULE_RES_ABRT: /* abort request, response already sent. Eg: auth */ goto return_prx_cond; case HTTP_RULE_RES_DONE: /* OK, but terminate request processing (eg: redirect) */ goto done; case HTTP_RULE_RES_BADREQ: /* failed with a bad request */ goto return_bad_req; } } /* OK at this stage, we know that the request was accepted according to * the http-request rules, we can check for the stats. Note that the * URI is detected *before* the req* rules in order not to be affected * by a possible reqrep, while they are processed *after* so that a * reqdeny can still block them. This clearly needs to change in 1.6! */ if (stats_check_uri(s->rep->prod, txn, px)) { s->target = &http_stats_applet.obj_type; if (unlikely(!stream_int_register_handler(s->rep->prod, objt_applet(s->target)))) { txn->status = 500; s->logs.tv_request = now; stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_500)); if (!(s->flags & SN_ERR_MASK)) s->flags |= SN_ERR_RESOURCE; goto return_prx_cond; } /* parse the whole stats request and extract the relevant information */ http_handle_stats(s, req); verdict = http_req_get_intercept_rule(px, &px->uri_auth->http_req_rules, s, txn); /* not all actions implemented: deny, allow, auth */ if (verdict == HTTP_RULE_RES_DENY) /* stats http-request deny */ goto deny; if (verdict == HTTP_RULE_RES_ABRT) /* stats auth / stats http-request auth */ goto return_prx_cond; } /* evaluate the req* rules except reqadd */ if (px->req_exp != NULL) { if (apply_filters_to_request(s, req, px) < 0) goto return_bad_req; if (txn->flags & TX_CLDENY) goto deny; if (txn->flags & TX_CLTARPIT) goto tarpit; } /* add request headers from the rule sets in the same order */ list_for_each_entry(wl, &px->req_add, list) { if (wl->cond) { int ret = acl_exec_cond(wl->cond, px, s, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (((struct acl_cond *)wl->cond)->pol == ACL_COND_UNLESS) ret = !ret; if (!ret) continue; } if (unlikely(http_header_add_tail(&txn->req, &txn->hdr_idx, wl->s) < 0)) goto return_bad_req; } /* Proceed with the stats now. */ if (unlikely(objt_applet(s->target) == &http_stats_applet)) { /* process the stats request now */ if (s->fe == s->be) /* report it if the request was intercepted by the frontend */ s->fe->fe_counters.intercepted_req++; if (!(s->flags & SN_ERR_MASK)) // this is not really an error but it is s->flags |= SN_ERR_LOCAL; // to mark that it comes from the proxy if (!(s->flags & SN_FINST_MASK)) s->flags |= SN_FINST_R; /* we may want to compress the stats page */ if (s->fe->comp || s->be->comp) select_compression_request_header(s, req->buf); /* enable the minimally required analyzers to handle keep-alive and compression on the HTTP response */ req->analysers = (req->analysers & AN_REQ_HTTP_BODY) | AN_REQ_HTTP_XFER_BODY | AN_RES_WAIT_HTTP | AN_RES_HTTP_PROCESS_BE | AN_RES_HTTP_XFER_BODY; goto done; } /* check whether we have some ACLs set to redirect this request */ list_for_each_entry(rule, &px->redirect_rules, list) { if (rule->cond) { int ret; ret = acl_exec_cond(rule->cond, px, s, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (rule->cond->pol == ACL_COND_UNLESS) ret = !ret; if (!ret) continue; } if (!http_apply_redirect_rule(rule, s, txn)) goto return_bad_req; goto done; } /* POST requests may be accompanied with an ""Expect: 100-Continue"" header. * If this happens, then the data will not come immediately, so we must * send all what we have without waiting. Note that due to the small gain * in waiting for the body of the request, it's easier to simply put the * CF_SEND_DONTWAIT flag any time. It's a one-shot flag so it will remove * itself once used. */ req->flags |= CF_SEND_DONTWAIT; done: /* done with this analyser, continue with next ones that the calling * points will have set, if any. */ req->analyse_exp = TICK_ETERNITY; done_without_exp: /* done with this analyser, but dont reset the analyse_exp. */ req->analysers &= ~an_bit; return 1; tarpit: /* When a connection is tarpitted, we use the tarpit timeout, * which may be the same as the connect timeout if unspecified. * If unset, then set it to zero because we really want it to * eventually expire. We build the tarpit as an analyser. */ channel_erase(s->req); /* wipe the request out so that we can drop the connection early * if the client closes first. */ channel_dont_connect(req); req->analysers = 0; /* remove switching rules etc... */ req->analysers |= AN_REQ_HTTP_TARPIT; req->analyse_exp = tick_add_ifset(now_ms, s->be->timeout.tarpit); if (!req->analyse_exp) req->analyse_exp = tick_add(now_ms, 0); session_inc_http_err_ctr(s); s->fe->fe_counters.denied_req++; if (s->fe != s->be) s->be->be_counters.denied_req++; if (s->listener->counters) s->listener->counters->denied_req++; goto done_without_exp; deny: /* this request was blocked (denied) */ txn->flags |= TX_CLDENY; txn->status = 403; s->logs.tv_request = now; stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_403)); session_inc_http_err_ctr(s); s->fe->fe_counters.denied_req++; if (s->fe != s->be) s->be->be_counters.denied_req++; if (s->listener->counters) s->listener->counters->denied_req++; goto return_prx_cond; return_bad_req: /* We centralize bad requests processing here */ if (unlikely(msg->msg_state == HTTP_MSG_ERROR) || msg->err_pos >= 0) { /* we detected a parsing error. We want to archive this request * in the dedicated proxy area for later troubleshooting. */ http_capture_bad_message(&s->fe->invalid_req, s, msg, msg->msg_state, s->fe); } txn->req.msg_state = HTTP_MSG_ERROR; txn->status = 400; stream_int_retnclose(req->prod, http_error_message(s, HTTP_ERR_400)); s->fe->fe_counters.failed_req++; if (s->listener->counters) s->listener->counters->failed_req++; return_prx_cond: if (!(s->flags & SN_ERR_MASK)) s->flags |= SN_ERR_PRXCOND; if (!(s->flags & SN_FINST_MASK)) s->flags |= SN_FINST_R; req->analysers = 0; req->analyse_exp = TICK_ETERNITY; return 0; } ",0 "int ipmi_smi_watcher_register(struct ipmi_smi_watcher *watcher) { struct ipmi_smi *intf; int index; mutex_lock(&smi_watchers_mutex); list_add(&watcher->link, &smi_watchers); index = srcu_read_lock(&ipmi_interfaces_srcu); list_for_each_entry_rcu(intf, &ipmi_interfaces, link) { int intf_num = READ_ONCE(intf->intf_num); if (intf_num == -1) continue; watcher->new_smi(intf_num, intf->si_dev); } srcu_read_unlock(&ipmi_interfaces_srcu, index); mutex_unlock(&smi_watchers_mutex); return 0; } ",0 "int skb_copy_ubufs(struct sk_buff *skb, gfp_t gfp_mask) { int i; int num_frags = skb_shinfo(skb)->nr_frags; struct page *page, *head = NULL; struct ubuf_info *uarg = skb_shinfo(skb)->destructor_arg; for (i = 0; i < num_frags; i++) { u8 *vaddr; skb_frag_t *f = &skb_shinfo(skb)->frags[i]; page = alloc_page(gfp_mask); if (!page) { while (head) { struct page *next = (struct page *)page_private(head); put_page(head); head = next; } return -ENOMEM; } vaddr = kmap_atomic(skb_frag_page(f)); memcpy(page_address(page), vaddr + f->page_offset, skb_frag_size(f)); kunmap_atomic(vaddr); set_page_private(page, (unsigned long)head); head = page; } /* skb frags release userspace buffers */ for (i = 0; i < num_frags; i++) skb_frag_unref(skb, i); uarg->callback(uarg, false); /* skb frags point to kernel buffers */ for (i = num_frags - 1; i >= 0; i--) { __skb_fill_page_desc(skb, i, head, 0, skb_shinfo(skb)->frags[i].size); head = (struct page *)page_private(head); } skb_shinfo(skb)->tx_flags &= ~SKBTX_DEV_ZEROCOPY; return 0; } ",0 " TT_Load_Context( TT_ExecContext exec, TT_Face face, TT_Size size ) { FT_Int i; FT_ULong tmp; TT_MaxProfile* maxp; FT_Error error; exec->face = face; maxp = &face->max_profile; exec->size = size; if ( size ) { exec->numFDefs = size->num_function_defs; exec->maxFDefs = size->max_function_defs; exec->numIDefs = size->num_instruction_defs; exec->maxIDefs = size->max_instruction_defs; exec->FDefs = size->function_defs; exec->IDefs = size->instruction_defs; exec->tt_metrics = size->ttmetrics; exec->metrics = size->metrics; exec->maxFunc = size->max_func; exec->maxIns = size->max_ins; for ( i = 0; i < TT_MAX_CODE_RANGES; i++ ) exec->codeRangeTable[i] = size->codeRangeTable[i]; /* set graphics state */ exec->GS = size->GS; exec->cvtSize = size->cvt_size; exec->cvt = size->cvt; exec->storeSize = size->storage_size; exec->storage = size->storage; exec->twilight = size->twilight; } /* XXX: We reserve a little more elements on the stack to deal safely */ /* with broken fonts like arialbs, courbs, timesbs, etc. */ tmp = exec->stackSize; error = Update_Max( exec->memory, &tmp, sizeof ( FT_F26Dot6 ), (void*)&exec->stack, maxp->maxStackElements + 32 ); exec->stackSize = (FT_UInt)tmp; if ( error ) return error; tmp = exec->glyphSize; error = Update_Max( exec->memory, &tmp, sizeof ( FT_Byte ), (void*)&exec->glyphIns, maxp->maxSizeOfInstructions ); exec->glyphSize = (FT_UShort)tmp; if ( error ) return error; exec->pts.n_points = 0; exec->pts.n_contours = 0; exec->zp1 = exec->pts; exec->zp2 = exec->pts; exec->zp0 = exec->pts; exec->instruction_trap = FALSE; return TT_Err_Ok; } ",0 "static inline void loop_update_dio(struct loop_device *lo) { __loop_update_dio(lo, io_is_direct(lo->lo_backing_file) | lo->use_dio); } ",0 "struct file *hugetlb_file_setup(const char *name, size_t size, vm_flags_t acctflag, struct user_struct **user, int creat_flags) { int error = -ENOMEM; struct file *file; struct inode *inode; struct path path; struct dentry *root; struct qstr quick_string; *user = NULL; if (!hugetlbfs_vfsmount) return ERR_PTR(-ENOENT); if (creat_flags == HUGETLB_SHMFS_INODE && !can_do_hugetlb_shm()) { *user = current_user(); if (user_shm_lock(size, *user)) { printk_once(KERN_WARNING ""Using mlock ulimits for SHM_HUGETLB is deprecated\n""); } else { *user = NULL; return ERR_PTR(-EPERM); } } root = hugetlbfs_vfsmount->mnt_root; quick_string.name = name; quick_string.len = strlen(quick_string.name); quick_string.hash = 0; path.dentry = d_alloc(root, &quick_string); if (!path.dentry) goto out_shm_unlock; path.mnt = mntget(hugetlbfs_vfsmount); error = -ENOSPC; inode = hugetlbfs_get_inode(root->d_sb, NULL, S_IFREG | S_IRWXUGO, 0); if (!inode) goto out_dentry; error = -ENOMEM; if (hugetlb_reserve_pages(inode, 0, size >> huge_page_shift(hstate_inode(inode)), NULL, acctflag)) goto out_inode; d_instantiate(path.dentry, inode); inode->i_size = size; clear_nlink(inode); error = -ENFILE; file = alloc_file(&path, FMODE_WRITE | FMODE_READ, &hugetlbfs_file_operations); if (!file) goto out_dentry; /* inode is already attached */ return file; out_inode: iput(inode); out_dentry: path_put(&path); out_shm_unlock: if (*user) { user_shm_unlock(size, *user); *user = NULL; } return ERR_PTR(error); } ",0 "void DataReductionProxyConfigServiceClient::SetEnabled(bool enabled) { DCHECK(thread_checker_.CalledOnValidThread()); enabled_ = enabled; } ",0 "static void Free_ContextPos3( HB_ContextPosFormat3* cpf3 ) { HB_UShort n, count; HB_Coverage* c; FREE( cpf3->PosLookupRecord ); if ( cpf3->Coverage ) { count = cpf3->GlyphCount; c = cpf3->Coverage; for ( n = 0; n < count; n++ ) _HB_OPEN_Free_Coverage( &c[n] ); FREE( c ); } } ",0 "void NavigatorImpl::RequestNavigation(FrameTreeNode* frame_tree_node, const GURL& dest_url, const Referrer& dest_referrer, const FrameNavigationEntry& frame_entry, const NavigationEntryImpl& entry, ReloadType reload_type, LoFiState lofi_state, bool is_same_document_history_load, bool is_history_navigation_in_new_child, base::TimeTicks navigation_start) { CHECK(IsBrowserSideNavigationEnabled()); DCHECK(frame_tree_node); bool should_dispatch_beforeunload = frame_tree_node->current_frame_host()->ShouldDispatchBeforeUnload(); FrameMsg_Navigate_Type::Value navigation_type = GetNavigationType(controller_->GetBrowserContext(), entry, reload_type); std::unique_ptr scoped_request = NavigationRequest::CreateBrowserInitiated( frame_tree_node, dest_url, dest_referrer, frame_entry, entry, navigation_type, lofi_state, is_same_document_history_load, is_history_navigation_in_new_child, navigation_start, controller_); NavigationRequest* navigation_request = scoped_request.get(); if (dest_url.SchemeIs(url::kJavaScriptScheme)) { RenderFrameHostImpl* render_frame_host = frame_tree_node->render_manager()->GetFrameHostForNavigation( *navigation_request); render_frame_host->CommitNavigation(nullptr, // response nullptr, // body navigation_request->common_params(), navigation_request->request_params(), navigation_request->is_view_source()); return; } frame_tree_node->CreatedNavigationRequest(std::move(scoped_request)); navigation_request->CreateNavigationHandle(entry.GetUniqueID()); if (should_dispatch_beforeunload && !IsRendererDebugURL(dest_url)) { navigation_request->SetWaitingForRendererResponse(); frame_tree_node->current_frame_host()->DispatchBeforeUnload( true, reload_type != ReloadType::NONE); } else { navigation_request->BeginNavigation(); } } ",0 "status_t Parcel::writeByteArray(size_t len, const uint8_t *val) { if (len > INT32_MAX) { return BAD_VALUE; } if (!val) { return writeInt32(-1); } status_t ret = writeInt32(static_cast(len)); if (ret == NO_ERROR) { ret = write(val, len * sizeof(*val)); } return ret; } ",0 "static int l2tp_ip6_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, size_t len) { struct ipv6_txoptions opt_space; struct sockaddr_l2tpip6 *lsa = (struct sockaddr_l2tpip6 *) msg->msg_name; struct in6_addr *daddr, *final_p, final; struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_txoptions *opt = NULL; struct ip6_flowlabel *flowlabel = NULL; struct dst_entry *dst = NULL; struct flowi6 fl6; int addr_len = msg->msg_namelen; int hlimit = -1; int tclass = -1; int dontfrag = -1; int transhdrlen = 4; /* zero session-id */ int ulen = len + transhdrlen; int err; /* Rough check on arithmetic overflow, better check is made in ip6_append_data(). */ if (len > INT_MAX) return -EMSGSIZE; /* Mirror BSD error message compatibility */ if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; /* * Get and verify the address. */ memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_mark = sk->sk_mark; if (lsa) { if (addr_len < SIN6_LEN_RFC2133) return -EINVAL; if (lsa->l2tp_family && lsa->l2tp_family != AF_INET6) return -EAFNOSUPPORT; daddr = &lsa->l2tp_addr; if (np->sndflow) { fl6.flowlabel = lsa->l2tp_flowinfo & IPV6_FLOWINFO_MASK; if (fl6.flowlabel&IPV6_FLOWLABEL_MASK) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (flowlabel == NULL) return -EINVAL; daddr = &flowlabel->dst; } } /* * Otherwise it will be difficult to maintain * sk->sk_dst_cache. */ if (sk->sk_state == TCP_ESTABLISHED && ipv6_addr_equal(daddr, &np->daddr)) daddr = &np->daddr; if (addr_len >= sizeof(struct sockaddr_in6) && lsa->l2tp_scope_id && ipv6_addr_type(daddr) & IPV6_ADDR_LINKLOCAL) fl6.flowi6_oif = lsa->l2tp_scope_id; } else { if (sk->sk_state != TCP_ESTABLISHED) return -EDESTADDRREQ; daddr = &np->daddr; fl6.flowlabel = np->flow_label; } if (fl6.flowi6_oif == 0) fl6.flowi6_oif = sk->sk_bound_dev_if; if (msg->msg_controllen) { opt = &opt_space; memset(opt, 0, sizeof(struct ipv6_txoptions)); opt->tot_len = sizeof(struct ipv6_txoptions); err = datagram_send_ctl(sock_net(sk), sk, msg, &fl6, opt, &hlimit, &tclass, &dontfrag); if (err < 0) { fl6_sock_release(flowlabel); return err; } if ((fl6.flowlabel & IPV6_FLOWLABEL_MASK) && !flowlabel) { flowlabel = fl6_sock_lookup(sk, fl6.flowlabel); if (flowlabel == NULL) return -EINVAL; } if (!(opt->opt_nflen|opt->opt_flen)) opt = NULL; } if (opt == NULL) opt = np->opt; if (flowlabel) opt = fl6_merge_options(&opt_space, flowlabel, opt); opt = ipv6_fixup_options(&opt_space, opt); fl6.flowi6_proto = sk->sk_protocol; if (!ipv6_addr_any(daddr)) fl6.daddr = *daddr; else fl6.daddr.s6_addr[15] = 0x1; /* :: means loopback (BSD'ism) */ if (ipv6_addr_any(&fl6.saddr) && !ipv6_addr_any(&np->saddr)) fl6.saddr = np->saddr; final_p = fl6_update_dst(&fl6, opt, &final); if (!fl6.flowi6_oif && ipv6_addr_is_multicast(&fl6.daddr)) fl6.flowi6_oif = np->mcast_oif; else if (!fl6.flowi6_oif) fl6.flowi6_oif = np->ucast_oif; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); dst = ip6_dst_lookup_flow(sk, &fl6, final_p, true); if (IS_ERR(dst)) { err = PTR_ERR(dst); goto out; } if (hlimit < 0) { if (ipv6_addr_is_multicast(&fl6.daddr)) hlimit = np->mcast_hops; else hlimit = np->hop_limit; if (hlimit < 0) hlimit = ip6_dst_hoplimit(dst); } if (tclass < 0) tclass = np->tclass; if (dontfrag < 0) dontfrag = np->dontfrag; if (msg->msg_flags & MSG_CONFIRM) goto do_confirm; back_from_confirm: lock_sock(sk); err = ip6_append_data(sk, ip_generic_getfrag, msg->msg_iov, ulen, transhdrlen, hlimit, tclass, opt, &fl6, (struct rt6_info *)dst, msg->msg_flags, dontfrag); if (err) ip6_flush_pending_frames(sk); else if (!(msg->msg_flags & MSG_MORE)) err = l2tp_ip6_push_pending_frames(sk); release_sock(sk); done: dst_release(dst); out: fl6_sock_release(flowlabel); return err < 0 ? err : len; do_confirm: dst_confirm(dst); if (!(msg->msg_flags & MSG_PROBE) || len) goto back_from_confirm; err = 0; goto done; } ",0 " parse_blend_design_map( T1_Face face, T1_Loader loader ) { FT_Error error = FT_Err_Ok; T1_Parser parser = &loader->parser; PS_Blend blend; T1_TokenRec axis_tokens[T1_MAX_MM_AXIS]; FT_Int n, num_axis; FT_Byte* old_cursor; FT_Byte* old_limit; FT_Memory memory = face->root.memory; T1_ToTokenArray( parser, axis_tokens, T1_MAX_MM_AXIS, &num_axis ); if ( num_axis < 0 ) { error = FT_ERR( Ignore ); goto Exit; } if ( num_axis == 0 || num_axis > T1_MAX_MM_AXIS ) { FT_ERROR(( ""parse_blend_design_map: incorrect number of axes: %d\n"", num_axis )); error = FT_THROW( Invalid_File_Format ); goto Exit; } old_cursor = parser->root.cursor; old_limit = parser->root.limit; error = t1_allocate_blend( face, 0, num_axis ); if ( error ) goto Exit; blend = face->blend; /* now read each axis design map */ for ( n = 0; n < num_axis; n++ ) { PS_DesignMap map = blend->design_map + n; T1_Token axis_token; T1_TokenRec point_tokens[T1_MAX_MM_MAP_POINTS]; FT_Int p, num_points; axis_token = axis_tokens + n; parser->root.cursor = axis_token->start; parser->root.limit = axis_token->limit; T1_ToTokenArray( parser, point_tokens, T1_MAX_MM_MAP_POINTS, &num_points ); if ( num_points <= 0 || num_points > T1_MAX_MM_MAP_POINTS ) { FT_ERROR(( ""parse_blend_design_map: incorrect table\n"" )); error = FT_THROW( Invalid_File_Format ); goto Exit; } /* allocate design map data */ if ( FT_NEW_ARRAY( map->design_points, num_points * 2 ) ) goto Exit; map->blend_points = map->design_points + num_points; map->num_points = (FT_Byte)num_points; for ( p = 0; p < num_points; p++ ) { T1_Token point_token; point_token = point_tokens + p; /* don't include delimiting brackets */ parser->root.cursor = point_token->start + 1; parser->root.limit = point_token->limit - 1; map->design_points[p] = T1_ToInt( parser ); map->blend_points [p] = T1_ToFixed( parser, 0 ); } } parser->root.cursor = old_cursor; parser->root.limit = old_limit; Exit: parser->root.error = error; } ",0 "HRESULT DataObjectImpl::GetDataHere(FORMATETC* format_etc, STGMEDIUM* medium) { return DATA_E_FORMATETC; } ",0 "static const effect_uuid_t * id_to_uuid(int id) { if (id >= NUM_ID) return EFFECT_UUID_NULL; return uuid_to_id_table[id]; } ",0 "void WebContentsImpl::DidReceiveInputEvent( RenderWidgetHostImpl* render_widget_host, const blink::WebInputEvent::Type type) { if (!IsUserInteractionInputType(type)) return; if (!HasMatchingWidgetHost(&frame_tree_, render_widget_host)) return; if (type != blink::WebInputEvent::kGestureScrollBegin) last_interactive_input_event_time_ = ui::EventTimeForNow(); for (auto& observer : observers_) observer.DidGetUserInteraction(type); if (IsResourceLoadUserInteractionInputType(type)) SendUserGestureForResourceDispatchHost(); } ",0 "void kvm_vcpu_request_scan_ioapic(struct kvm *kvm) { struct kvm_ioapic *ioapic = kvm->arch.vioapic; if (!ioapic) return; kvm_make_scan_ioapic_request(kvm); } ",0 "scoped_ptr AppResult::Duplicate() const { scoped_ptr copy( new AppResult(profile_, app_id_, controller_, display_type() == DISPLAY_RECOMMENDATION)); copy->set_title(title()); copy->set_title_tags(title_tags()); copy->set_relevance(relevance()); return copy.Pass(); } ",0 "DECLAREcpFunc(cpSeparateStrips2ContigTiles) { return cpImage(in, out, readSeparateStripsIntoBuffer, writeBufferToContigTiles, imagelength, imagewidth, spp); } ",0 "void rds_inc_put(struct rds_incoming *inc) { rdsdebug(""put inc %p ref %d\n"", inc, refcount_read(&inc->i_refcount)); if (refcount_dec_and_test(&inc->i_refcount)) { BUG_ON(!list_empty(&inc->i_item)); inc->i_conn->c_trans->inc_free(inc); } } ",0 "void WebMediaPlayerMS::TrackAdded(const blink::WebMediaStreamTrack& track) { Reload(); } ",0 "static SelectionInFlatTree ExtendSelectionAsNonDirectional( const PositionInFlatTree& position, const VisibleSelectionInFlatTree& selection, TextGranularity granularity) { DCHECK(!selection.IsNone()); DCHECK(position.IsNotNull()); const PositionInFlatTree& start = selection.Start(); const PositionInFlatTree& end = selection.End(); if (position < start) { return SelectionInFlatTree::Builder() .SetBaseAndExtent( end, ComputeStartRespectingGranularity( PositionInFlatTreeWithAffinity(position), granularity)) .Build(); } if (end < position) { return SelectionInFlatTree::Builder() .SetBaseAndExtent( start, ComputeEndRespectingGranularity( start, PositionInFlatTreeWithAffinity(position), granularity)) .Build(); } const int distance_to_start = TextDistance(start, position); const int distance_to_end = TextDistance(position, end); if (distance_to_start <= distance_to_end) { return SelectionInFlatTree::Builder() .SetBaseAndExtent( end, ComputeStartRespectingGranularity( PositionInFlatTreeWithAffinity(position), granularity)) .Build(); } return SelectionInFlatTree::Builder() .SetBaseAndExtent( start, ComputeEndRespectingGranularity( start, PositionInFlatTreeWithAffinity(position), granularity)) .Build(); } ",0 "static void dex_parse_debug_item(RBinFile *binfile, RBinDexObj *bin, RBinDexClass *c, int MI, int MA, int paddr, int ins_size, int insns_size, char *class_name, int regsz, int debug_info_off) { struct r_bin_t *rbin = binfile->rbin; const ut8 *p4 = r_buf_get_at (binfile->buf, debug_info_off, NULL); const ut8 *p4_end = p4 + binfile->buf->length - debug_info_off; ut64 line_start; ut64 parameters_size; ut64 param_type_idx; ut16 argReg = regsz - ins_size; ut64 source_file_idx = c->source_file; RList *params, *debug_positions, *emitted_debug_locals = NULL; bool keep = true; if (argReg >= regsz) { } p4 = r_uleb128 (p4, p4_end - p4, &line_start); p4 = r_uleb128 (p4, p4_end - p4, ¶meters_size); ut32 address = 0; ut32 line = line_start; if (!(debug_positions = r_list_newf ((RListFree)free))) { return; } if (!(emitted_debug_locals = r_list_newf ((RListFree)free))) { r_list_free (debug_positions); return; } struct dex_debug_local_t debug_locals[regsz]; memset (debug_locals, 0, sizeof (struct dex_debug_local_t) * regsz); if (!(MA & 0x0008)) { debug_locals[argReg].name = ""this""; debug_locals[argReg].descriptor = r_str_newf(""%s;"", class_name); debug_locals[argReg].startAddress = 0; debug_locals[argReg].signature = NULL; debug_locals[argReg].live = true; argReg++; } if (!(params = dex_method_signature2 (bin, MI))) { r_list_free (debug_positions); r_list_free (emitted_debug_locals); return; } RListIter *iter = r_list_iterator (params); char *name; char *type; int reg; r_list_foreach (params, iter, type) { if ((argReg >= regsz) || !type || parameters_size <= 0) { r_list_free (debug_positions); r_list_free (params); r_list_free (emitted_debug_locals); return; } p4 = r_uleb128 (p4, p4_end - p4, ¶m_type_idx); // read uleb128p1 param_type_idx -= 1; name = getstr (bin, param_type_idx); reg = argReg; switch (type[0]) { case 'D': case 'J': argReg += 2; break; default: argReg += 1; break; } if (name) { debug_locals[reg].name = name; debug_locals[reg].descriptor = type; debug_locals[reg].signature = NULL; debug_locals[reg].startAddress = address; debug_locals[reg].live = true; } --parameters_size; } ut8 opcode = *(p4++) & 0xff; while (keep) { switch (opcode) { case 0x0: // DBG_END_SEQUENCE keep = false; break; case 0x1: // DBG_ADVANCE_PC { ut64 addr_diff; p4 = r_uleb128 (p4, p4_end - p4, &addr_diff); address += addr_diff; } break; case 0x2: // DBG_ADVANCE_LINE { st64 line_diff = r_sleb128 (&p4, p4_end); line += line_diff; } break; case 0x3: // DBG_START_LOCAL { ut64 register_num; ut64 name_idx; ut64 type_idx; p4 = r_uleb128 (p4, p4_end - p4, ®ister_num); p4 = r_uleb128 (p4, p4_end - p4, &name_idx); name_idx -= 1; p4 = r_uleb128 (p4, p4_end - p4, &type_idx); type_idx -= 1; if (register_num >= regsz) { r_list_free (debug_positions); r_list_free (params); return; } if (debug_locals[register_num].live) { struct dex_debug_local_t *local = malloc ( sizeof (struct dex_debug_local_t)); if (!local) { keep = false; break; } local->name = debug_locals[register_num].name; local->descriptor = debug_locals[register_num].descriptor; local->startAddress = debug_locals[register_num].startAddress; local->signature = debug_locals[register_num].signature; local->live = true; local->reg = register_num; local->endAddress = address; r_list_append (emitted_debug_locals, local); } debug_locals[register_num].name = getstr (bin, name_idx); debug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx); debug_locals[register_num].startAddress = address; debug_locals[register_num].signature = NULL; debug_locals[register_num].live = true; } break; case 0x4: //DBG_START_LOCAL_EXTENDED { ut64 register_num; ut64 name_idx; ut64 type_idx; ut64 sig_idx; p4 = r_uleb128 (p4, p4_end - p4, ®ister_num); p4 = r_uleb128 (p4, p4_end - p4, &name_idx); name_idx -= 1; p4 = r_uleb128 (p4, p4_end - p4, &type_idx); type_idx -= 1; p4 = r_uleb128 (p4, p4_end - p4, &sig_idx); sig_idx -= 1; if (register_num >= regsz) { r_list_free (debug_positions); r_list_free (params); return; } if (debug_locals[register_num].live) { struct dex_debug_local_t *local = malloc ( sizeof (struct dex_debug_local_t)); if (!local) { keep = false; break; } local->name = debug_locals[register_num].name; local->descriptor = debug_locals[register_num].descriptor; local->startAddress = debug_locals[register_num].startAddress; local->signature = debug_locals[register_num].signature; local->live = true; local->reg = register_num; local->endAddress = address; r_list_append (emitted_debug_locals, local); } debug_locals[register_num].name = getstr (bin, name_idx); debug_locals[register_num].descriptor = dex_type_descriptor (bin, type_idx); debug_locals[register_num].startAddress = address; debug_locals[register_num].signature = getstr (bin, sig_idx); debug_locals[register_num].live = true; } break; case 0x5: // DBG_END_LOCAL { ut64 register_num; p4 = r_uleb128 (p4, p4_end - p4, ®ister_num); if (debug_locals[register_num].live) { struct dex_debug_local_t *local = malloc ( sizeof (struct dex_debug_local_t)); if (!local) { keep = false; break; } local->name = debug_locals[register_num].name; local->descriptor = debug_locals[register_num].descriptor; local->startAddress = debug_locals[register_num].startAddress; local->signature = debug_locals[register_num].signature; local->live = true; local->reg = register_num; local->endAddress = address; r_list_append (emitted_debug_locals, local); } debug_locals[register_num].live = false; } break; case 0x6: // DBG_RESTART_LOCAL { ut64 register_num; p4 = r_uleb128 (p4, p4_end - p4, ®ister_num); if (!debug_locals[register_num].live) { debug_locals[register_num].startAddress = address; debug_locals[register_num].live = true; } } break; case 0x7: //DBG_SET_PROLOGUE_END break; case 0x8: //DBG_SET_PROLOGUE_BEGIN break; case 0x9: { p4 = r_uleb128 (p4, p4_end - p4, &source_file_idx); source_file_idx--; } break; default: { int adjusted_opcode = opcode - 0x0a; address += (adjusted_opcode / 15); line += -4 + (adjusted_opcode % 15); struct dex_debug_position_t *position = malloc (sizeof (struct dex_debug_position_t)); if (!position) { keep = false; break; } position->source_file_idx = source_file_idx; position->address = address; position->line = line; r_list_append (debug_positions, position); } break; } opcode = *(p4++) & 0xff; } if (!binfile->sdb_addrinfo) { binfile->sdb_addrinfo = sdb_new0 (); } char *fileline; char offset[64]; char *offset_ptr; RListIter *iter1; struct dex_debug_position_t *pos; r_list_foreach (debug_positions, iter1, pos) { fileline = r_str_newf (""%s|%""PFMT64d, getstr (bin, pos->source_file_idx), pos->line); offset_ptr = sdb_itoa (pos->address + paddr, offset, 16); sdb_set (binfile->sdb_addrinfo, offset_ptr, fileline, 0); sdb_set (binfile->sdb_addrinfo, fileline, offset_ptr, 0); } if (!dexdump) { r_list_free (debug_positions); r_list_free (emitted_debug_locals); r_list_free (params); return; } RListIter *iter2; struct dex_debug_position_t *position; rbin->cb_printf ("" positions :\n""); r_list_foreach (debug_positions, iter2, position) { rbin->cb_printf ("" 0x%04llx line=%llu\n"", position->address, position->line); } rbin->cb_printf ("" locals :\n""); RListIter *iter3; struct dex_debug_local_t *local; r_list_foreach (emitted_debug_locals, iter3, local) { if (local->signature) { rbin->cb_printf ( "" 0x%04x - 0x%04x reg=%d %s %s %s\n"", local->startAddress, local->endAddress, local->reg, local->name, local->descriptor, local->signature); } else { rbin->cb_printf ( "" 0x%04x - 0x%04x reg=%d %s %s\n"", local->startAddress, local->endAddress, local->reg, local->name, local->descriptor); } } for (reg = 0; reg < regsz; reg++) { if (debug_locals[reg].live) { if (debug_locals[reg].signature) { rbin->cb_printf ( "" 0x%04x - 0x%04x reg=%d %s %s "" ""%s\n"", debug_locals[reg].startAddress, insns_size, reg, debug_locals[reg].name, debug_locals[reg].descriptor, debug_locals[reg].signature); } else { rbin->cb_printf ( "" 0x%04x - 0x%04x reg=%d %s %s"" ""\n"", debug_locals[reg].startAddress, insns_size, reg, debug_locals[reg].name, debug_locals[reg].descriptor); } } } r_list_free (debug_positions); r_list_free (emitted_debug_locals); r_list_free (params); } ",0 "int tcp_twsk_unique(struct sock *sk, struct sock *sktw, void *twp) { const struct tcp_timewait_sock *tcptw = tcp_twsk(sktw); struct tcp_sock *tp = tcp_sk(sk); /* With PAWS, it is safe from the viewpoint of data integrity. Even without PAWS it is safe provided sequence spaces do not overlap i.e. at data rates <= 80Mbit/sec. Actually, the idea is close to VJ's one, only timestamp cache is held not per host, but per port pair and TW bucket is used as state holder. If TW bucket has been already destroyed we fall back to VJ's scheme and use initial timestamp retrieved from peer table. */ if (tcptw->tw_ts_recent_stamp && (twp == NULL || (sysctl_tcp_tw_reuse && get_seconds() - tcptw->tw_ts_recent_stamp > 1))) { tp->write_seq = tcptw->tw_snd_nxt + 65535 + 2; if (tp->write_seq == 0) tp->write_seq = 1; tp->rx_opt.ts_recent = tcptw->tw_ts_recent; tp->rx_opt.ts_recent_stamp = tcptw->tw_ts_recent_stamp; sock_hold(sktw); return 1; } return 0; } ",0 "bool Extension::LoadGlobsHelper( const DictionaryValue* content_script, int content_script_index, const char* globs_property_name, string16* error, void(UserScript::*add_method)(const std::string& glob), UserScript* instance) { if (!content_script->HasKey(globs_property_name)) return true; // they are optional const ListValue* list = NULL; if (!content_script->GetList(globs_property_name, &list)) { *error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidGlobList, base::IntToString(content_script_index), globs_property_name); return false; } for (size_t i = 0; i < list->GetSize(); ++i) { std::string glob; if (!list->GetString(i, &glob)) { *error = ErrorUtils::FormatErrorMessageUTF16( errors::kInvalidGlob, base::IntToString(content_script_index), globs_property_name, base::IntToString(i)); return false; } (instance->*add_method)(glob); } return true; } ",0 " void DragRevert() { resizer_->RevertDrag(); resizer_.reset(); } ",0 "static void Bitmap_setPremultiplied(JNIEnv* env, jobject, jlong bitmapHandle, jboolean isPremul) { SkBitmap* bitmap = reinterpret_cast(bitmapHandle); if (!bitmap->isOpaque()) { if (isPremul) { bitmap->setAlphaType(kPremul_SkAlphaType); } else { bitmap->setAlphaType(kUnpremul_SkAlphaType); } } } ",0 "void ResetAllFlags(FlagsStorage* flags_storage) { FlagsState::GetInstance()->ResetAllFlags(flags_storage); } ",0 "PHPAPI void php_var_serialize(smart_str *buf, zval *struc, php_serialize_data_t *data) /* {{{ */ { php_var_serialize_intern(buf, struc, *data); smart_str_0(buf); } /* }}} */ ",0 "void RenderWidgetHostViewGuest::SetIsLoading(bool is_loading) { NOTIMPLEMENTED(); } ",0 "bool Document::hasValidNamespaceForElements(const QualifiedName& qName) { if (!qName.prefix().isEmpty() && qName.namespaceURI().isNull()) // createElementNS(null, ""html:div"") return false; if (qName.prefix() == xmlAtom && qName.namespaceURI() != XMLNames::xmlNamespaceURI) // createElementNS(""http://www.example.com"", ""xml:lang"") return false; if (qName.prefix() == xmlnsAtom || (qName.prefix().isEmpty() && qName.localName() == xmlnsAtom)) return qName.namespaceURI() == XMLNSNames::xmlnsNamespaceURI; return qName.namespaceURI() != XMLNSNames::xmlnsNamespaceURI; } ",0 "evutil_check_interfaces(int force_recheck) { evutil_socket_t fd = -1; struct sockaddr_in sin, sin_out; struct sockaddr_in6 sin6, sin6_out; ev_socklen_t sin_out_len = sizeof(sin_out); ev_socklen_t sin6_out_len = sizeof(sin6_out); int r; if (have_checked_interfaces && !force_recheck) return 0; if (evutil_check_ifaddrs() == 0) { /* Use a nice sane interface, if this system has one. */ return 0; } /* Ugh. There was no nice sane interface. So to check whether we have * an interface open for a given protocol, will try to make a UDP * 'connection' to a remote host on the internet. We don't actually * use it, so the address doesn't matter, but we want to pick one that * keep us from using a host- or link-local interface. */ memset(&sin, 0, sizeof(sin)); sin.sin_family = AF_INET; sin.sin_port = htons(53); r = evutil_inet_pton(AF_INET, ""18.244.0.188"", &sin.sin_addr); EVUTIL_ASSERT(r); memset(&sin6, 0, sizeof(sin6)); sin6.sin6_family = AF_INET6; sin6.sin6_port = htons(53); r = evutil_inet_pton(AF_INET6, ""2001:4860:b002::68"", &sin6.sin6_addr); EVUTIL_ASSERT(r); memset(&sin_out, 0, sizeof(sin_out)); memset(&sin6_out, 0, sizeof(sin6_out)); /* XXX some errnos mean 'no address'; some mean 'not enough sockets'. */ if ((fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) >= 0 && connect(fd, (struct sockaddr*)&sin, sizeof(sin)) == 0 && getsockname(fd, (struct sockaddr*)&sin_out, &sin_out_len) == 0) { /* We might have an IPv4 interface. */ evutil_found_ifaddr((struct sockaddr*) &sin_out); } if (fd >= 0) evutil_closesocket(fd); if ((fd = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP)) >= 0 && connect(fd, (struct sockaddr*)&sin6, sizeof(sin6)) == 0 && getsockname(fd, (struct sockaddr*)&sin6_out, &sin6_out_len) == 0) { /* We might have an IPv6 interface. */ evutil_found_ifaddr((struct sockaddr*) &sin6_out); } if (fd >= 0) evutil_closesocket(fd); return 0; } ",0 "ScopedJavaLocalRef ChromeHttpAuthHandler::GetMessageBody( JNIEnv* env, const JavaParamRef&) { if (explanation_.empty()) return ConvertUTF16ToJavaString(env, authority_); return ConvertUTF16ToJavaString( env, authority_ + base::ASCIIToUTF16("" "") + explanation_); } ",0 " SyncerPositionTiebreakingTest() : low_id_(Id::CreateFromServerId(""A"")), mid_id_(Id::CreateFromServerId(""M"")), high_id_(Id::CreateFromServerId(""Z"")), next_revision_(1) { DCHECK(low_id_ < mid_id_); DCHECK(mid_id_ < high_id_); DCHECK(low_id_ < high_id_); } ",0 "static void DumpStackTraceSignalHandler(int signal) { base::debug::StackTrace().PrintBacktrace(); _exit(128 + signal); } ",0 "ikev1_vid_print(netdissect_options *ndo, u_char tpay _U_, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { struct isakmp_gen e; ND_PRINT((ndo,""%s:"", NPSTR(ISAKMP_NPTYPE_VID))); ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); ND_PRINT((ndo,"" len=%d"", ntohs(e.len) - 4)); if (2 < ndo->ndo_vflag && 4 < ntohs(e.len)) { ND_PRINT((ndo,"" "")); if (!rawprint(ndo, (const uint8_t *)(ext + 1), ntohs(e.len) - 4)) goto trunc; } return (const u_char *)ext + ntohs(e.len); trunc: ND_PRINT((ndo,"" [|%s]"", NPSTR(ISAKMP_NPTYPE_VID))); return NULL; } ",0 "void Automation::InitWithBrowserPath(const FilePath& browser_exe, const CommandLine& options, Error** error) { if (!file_util::PathExists(browser_exe)) { std::string message = base::StringPrintf( ""Could not find Chrome binary at: %"" PRFilePath, browser_exe.value().c_str()); *error = new Error(kUnknownError, message); return; } CommandLine command(browser_exe); command.AppendSwitch(switches::kDisableHangMonitor); command.AppendSwitch(switches::kDisablePromptOnRepost); command.AppendSwitch(switches::kDomAutomationController); command.AppendSwitch(switches::kFullMemoryCrashReport); command.AppendSwitchASCII(switches::kHomePage, chrome::kAboutBlankURL); command.AppendSwitch(switches::kNoDefaultBrowserCheck); command.AppendSwitch(switches::kNoFirstRun); command.AppendSwitchASCII(switches::kTestType, ""webdriver""); command.AppendArguments(options, false); launcher_.reset(new AnonymousProxyLauncher(false)); ProxyLauncher::LaunchState launch_props = { false, // clear_profile FilePath(), // template_user_data ProxyLauncher::DEFAULT_THEME, command, true, // include_testing_id true // show_window }; std::string chrome_details = base::StringPrintf( ""Using Chrome binary at: %"" PRFilePath, browser_exe.value().c_str()); VLOG(1) << chrome_details; if (!launcher_->LaunchBrowserAndServer(launch_props, true)) { *error = new Error( kUnknownError, ""Unable to either launch or connect to Chrome. Please check that "" ""ChromeDriver is up-to-date. "" + chrome_details); return; } launcher_->automation()->set_action_timeout_ms(base::kNoTimeout); VLOG(1) << ""Chrome launched successfully. Version: "" << automation()->server_version(); bool has_automation_version = false; *error = CompareVersion(730, 0, &has_automation_version); if (*error) return; chrome_details += "", version ("" + automation()->server_version() + "")""; if (has_automation_version) { int version = 0; std::string error_msg; if (!SendGetChromeDriverAutomationVersion( automation(), &version, &error_msg)) { *error = new Error(kUnknownError, error_msg + "" "" + chrome_details); return; } if (version > automation::kChromeDriverAutomationVersion) { *error = new Error( kUnknownError, ""ChromeDriver is not compatible with this version of Chrome. "" + chrome_details); return; } } } ",1 "static void callbackFunctionAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectV8Internal::callbackFunctionAttributeAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void Tab::OnGestureEvent(ui::GestureEvent* event) { controller_->UpdateHoverCard(this, false); switch (event->type()) { case ui::ET_GESTURE_TAP_DOWN: { DCHECK_EQ(1, event->details().touch_points()); ui::GestureEvent event_in_parent(*event, static_cast(this), parent()); ui::ListSelectionModel original_selection; original_selection = controller_->GetSelectionModel(); tab_activated_with_last_tap_down_ = !IsActive(); if (!IsSelected()) controller_->SelectTab(this, *event); gfx::Point loc(event->location()); views::View::ConvertPointToScreen(this, &loc); ui::GestureEvent cloned_event(event_in_parent, parent(), static_cast(this)); controller_->MaybeStartDrag(this, cloned_event, original_selection); break; } case ui::ET_GESTURE_END: controller_->EndDrag(END_DRAG_COMPLETE); break; case ui::ET_GESTURE_SCROLL_UPDATE: controller_->ContinueDrag(this, *event); break; default: break; } event->SetHandled(); } ",0 "void OomInterventionTabHelper::DidStartNavigation( content::NavigationHandle* navigation_handle) { if (!navigation_handle->IsInMainFrame() || navigation_handle->IsSameDocument()) { return; } last_navigation_timestamp_ = base::TimeTicks::Now(); if (!navigation_started_) { navigation_started_ = true; return; } ResetInterfaces(); if (!IsLastVisibleWebContents(navigation_handle->GetWebContents())) { ResetInterventionState(); return; } if (near_oom_detected_time_) { base::TimeDelta elapsed_time = base::TimeTicks::Now() - near_oom_detected_time_.value(); UMA_HISTOGRAM_MEDIUM_TIMES( ""Memory.Experimental.OomIntervention."" ""NavigationAfterDetectionTime"", elapsed_time); ResetInterventionState(); } else { RecordNearOomDetectionEndReason(NearOomDetectionEndReason::NAVIGATION); } } ",0 "void MediaStreamManager::HandleAccessRequestResponse( const std::string& label, const media::AudioParameters& output_parameters, const MediaStreamDevices& devices, MediaStreamRequestResult result) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DVLOG(1) << ""HandleAccessRequestResponse("" << "", {label = "" << label << ""})""; DeviceRequest* request = FindRequest(label); if (!request) { return; } if (request->request_type() == MEDIA_DEVICE_ACCESS) { FinalizeMediaAccessRequest(label, request, devices); return; } if (result != MEDIA_DEVICE_OK) { FinalizeRequestFailed(label, request, result); return; } DCHECK(!devices.empty()); if (request->request_type() == MEDIA_DEVICE_UPDATE) { HandleChangeSourceRequestResponse(label, request, devices); return; } bool found_audio = false; bool found_video = false; for (const MediaStreamDevice& media_stream_device : devices) { MediaStreamDevice device = media_stream_device; if (device.type == MEDIA_GUM_TAB_VIDEO_CAPTURE || device.type == MEDIA_GUM_TAB_AUDIO_CAPTURE) { device.id = request->tab_capture_device_id; } if (device.type == MEDIA_GUM_TAB_AUDIO_CAPTURE || device.type == MEDIA_GUM_DESKTOP_AUDIO_CAPTURE) { int sample_rate = output_parameters.sample_rate(); if (sample_rate <= 0 || sample_rate > 96000) sample_rate = 44100; media::AudioParameters params(device.input.format(), media::CHANNEL_LAYOUT_STEREO, sample_rate, device.input.frames_per_buffer()); params.set_effects(device.input.effects()); params.set_mic_positions(device.input.mic_positions()); DCHECK(params.IsValid()); device.input = params; } if (device.type == request->audio_type()) found_audio = true; else if (device.type == request->video_type()) found_video = true; if (request->request_type() == MEDIA_GENERATE_STREAM) { MediaRequestState state; if (FindExistingRequestedDevice(*request, device, &device, &state)) { request->devices.push_back(device); request->SetState(device.type, state); DVLOG(1) << ""HandleAccessRequestResponse - device already opened "" << "", {label = "" << label << ""}"" << "", device_id = "" << device.id << ""}""; continue; } } device.session_id = GetDeviceManager(device.type)->Open(device); TranslateDeviceIdToSourceId(request, &device); request->devices.push_back(device); request->SetState(device.type, MEDIA_REQUEST_STATE_OPENING); DVLOG(1) << ""HandleAccessRequestResponse - opening device "" << "", {label = "" << label << ""}"" << "", {device_id = "" << device.id << ""}"" << "", {session_id = "" << device.session_id << ""}""; } ",0 "static char * php_zipobj_get_zip_comment(struct zip *za, int *len) /* {{{ */ { if (za) { return (char *)zip_get_archive_comment(za, len, 0); } return NULL; } /* }}} */ ",0 "void WebLocalFrameImpl::CommitDataNavigation( const WebData& data, const WebString& mime_type, const WebString& text_encoding, const WebURL& base_url, const WebURL& unreachable_url, bool replace, WebFrameLoadType web_frame_load_type, const WebHistoryItem& item, bool is_client_redirect, std::unique_ptr navigation_data, const WebURLRequest* original_failed_request, const WebNavigationTimings& navigation_timings) { DCHECK(GetFrame()); ResourceRequest request; HistoryItem* history_item = item; DocumentLoader* provisional_document_loader = GetFrame()->Loader().GetProvisionalDocumentLoader(); if (replace && !unreachable_url.IsEmpty() && provisional_document_loader) { request = provisional_document_loader->OriginalRequest(); WebFrameLoadType previous_load_type = provisional_document_loader->LoadType(); if (previous_load_type == WebFrameLoadType::kBackForward && provisional_document_loader->GetHistoryItem()) { history_item = provisional_document_loader->GetHistoryItem(); web_frame_load_type = WebFrameLoadType::kBackForward; } else if (previous_load_type == WebFrameLoadType::kReload || previous_load_type == WebFrameLoadType::kReloadBypassingCache) { web_frame_load_type = previous_load_type; } } else if (original_failed_request) { request = original_failed_request->ToResourceRequest(); request.SetCacheMode(mojom::FetchCacheMode::kNoStore); } request.SetURL(base_url); FrameLoadRequest frame_request( nullptr, request, SubstituteData(data, mime_type, text_encoding, unreachable_url)); DCHECK(frame_request.GetSubstituteData().IsValid()); frame_request.SetReplacesCurrentItem(replace); if (is_client_redirect) frame_request.SetClientRedirect(ClientRedirectPolicy::kClientRedirect); GetFrame()->Loader().CommitNavigation( frame_request, web_frame_load_type, history_item, std::move(navigation_data), navigation_timings); } ",0 "void QuotaManager::NotifyStorageModifiedInternal( QuotaClient::ID client_id, const GURL& origin, StorageType type, int64 delta, base::Time modified_time) { LazyInitialize(); GetUsageTracker(type)->UpdateUsageCache(client_id, origin, delta); PostTaskAndReplyWithResultForDBThread( FROM_HERE, base::Bind(&UpdateModifiedTimeOnDBThread, origin, type, modified_time), base::Bind(&QuotaManager::DidDatabaseWork, weak_factory_.GetWeakPtr())); } ",0 "void ContentSecurityPolicy::AddPolicyFromHeaderValue( const String& header, ContentSecurityPolicyHeaderType type, ContentSecurityPolicyHeaderSource source) { if (source == kContentSecurityPolicyHeaderSourceMeta && type == kContentSecurityPolicyHeaderTypeReport) { ReportReportOnlyInMeta(header); return; } if (source == kContentSecurityPolicyHeaderSourceHTTP) header_delivered_ = true; Vector characters; header.AppendTo(characters); const UChar* begin = characters.data(); const UChar* end = begin + characters.size(); const UChar* position = begin; while (position < end) { SkipUntil(position, end, ','); Member policy = CSPDirectiveList::Create(this, begin, position, type, source); if (!policy->AllowEval(nullptr, SecurityViolationReportingPolicy::kSuppressReporting, kWillNotThrowException, g_empty_string) && disable_eval_error_message_.IsNull()) { disable_eval_error_message_ = policy->EvalDisabledErrorMessage(); } policies_.push_back(policy.Release()); DCHECK(position == end || *position == ','); SkipExactly(position, end, ','); begin = position; } } ",0 "void TEMPLATE(process_block_dec)(decoder_info_t *decoder_info,int size,int yposY,int xposY,int sub) { int width = decoder_info->width; int height = decoder_info->height; stream_t *stream = decoder_info->stream; frame_type_t frame_type = decoder_info->frame_info.frame_type; int split_flag = 0; if (yposY >= height || xposY >= width) return; int decode_this_size = (yposY + size <= height) && (xposY + size <= width); int decode_rectangular_size = !decode_this_size && frame_type != I_FRAME; int bit_start = stream->bitcnt; int mode = MODE_SKIP; block_context_t block_context; TEMPLATE(find_block_contexts)(yposY, xposY, height, width, size, decoder_info->deblock_data, &block_context, decoder_info->use_block_contexts); decoder_info->block_context = &block_context; split_flag = decode_super_mode(decoder_info,size,decode_this_size); mode = decoder_info->mode; /* Read delta_qp and set block-level qp */ if (size == (1<log2_sb_size) && (split_flag || mode != MODE_SKIP) && decoder_info->max_delta_qp > 0) { /* Read delta_qp */ int delta_qp = read_delta_qp(stream); int prev_qp; if (yposY == 0 && xposY == 0) prev_qp = decoder_info->frame_info.qp; else prev_qp = decoder_info->frame_info.qpb; decoder_info->frame_info.qpb = prev_qp + delta_qp; } decoder_info->bit_count.super_mode[decoder_info->bit_count.stat_frame_type] += (stream->bitcnt - bit_start); if (split_flag){ int new_size = size/2; TEMPLATE(process_block_dec)(decoder_info,new_size,yposY+0*new_size,xposY+0*new_size,sub); TEMPLATE(process_block_dec)(decoder_info,new_size,yposY+1*new_size,xposY+0*new_size,sub); TEMPLATE(process_block_dec)(decoder_info,new_size,yposY+0*new_size,xposY+1*new_size,sub); TEMPLATE(process_block_dec)(decoder_info,new_size,yposY+1*new_size,xposY+1*new_size,sub); } else if (decode_this_size || decode_rectangular_size){ decode_block(decoder_info,size,yposY,xposY,sub); } } ",1 "static void export_array(struct mddev *mddev) { struct md_rdev *rdev; while (!list_empty(&mddev->disks)) { rdev = list_first_entry(&mddev->disks, struct md_rdev, same_set); md_kick_rdev_from_array(rdev); } mddev->raid_disks = 0; mddev->major_version = 0; } ",0 "static void cfsk_hold(struct cflayer *layr) { struct caifsock *cf_sk = container_of(layr, struct caifsock, layer); sock_hold(&cf_sk->sk); } ",0 "QQuickWebView::~QQuickWebView() { } ",0 "static int mount_smb2_usage(FILE *stream) { fprintf(stream, ""\nUsage: %s -o \n"", thisprogram); fprintf(stream, ""\nMount the remote target, specified as a UNC name,""); fprintf(stream, "" to a local directory.\n\nOptions:\n""); fprintf(stream, ""\tuser=\n\tpass=\n\tdom=\n""); fprintf(stream, ""\nLess commonly used options:""); fprintf(stream, ""\n\tcredentials=,guest,perm,noperm,rw,ro,""); fprintf(stream, ""\n\tsep=,iocharset=,exec,noexec""); fprintf(stream, ""\n\tnolock,directio,sec=,sign""); fprintf(stream, ""\n\tuid=,gid=,dir_mode=,file_mode=""); fprintf(stream, ""\n\nRarely used options:""); fprintf(stream, ""\n\tport=,rsize=,wsize=,unc=,ip=,""); fprintf(stream, ""\n\tdev,nodev,hard,soft,intr,""); fprintf(stream, ""\n\tnointr,ignorecase,noacl,prefixpath=,nobrl""); fprintf(stream, ""\n\nOptions are described in more detail in the manual page""); fprintf(stream, ""\n\tman 8 mount.smb2\n""); fprintf(stream, ""\nTo display the version number of the mount helper:""); fprintf(stream, ""\n\tmount.smb2 -V\n""); if (stream == stderr) return EX_USAGE; return 0; } ",0 "std::string ModuleSystem::ExceptionHandler::CreateExceptionString( const v8::TryCatch& try_catch) { v8::Local message(try_catch.Message()); if (message.IsEmpty()) { return ""try_catch has no message""; } std::string resource_name = """"; if (!message->GetScriptOrigin().ResourceName().IsEmpty()) { v8::String::Utf8Value resource_name_v8( message->GetScriptOrigin().ResourceName()); resource_name.assign(*resource_name_v8, resource_name_v8.length()); } std::string error_message = """"; if (!message->Get().IsEmpty()) { v8::String::Utf8Value error_message_v8(message->Get()); error_message.assign(*error_message_v8, error_message_v8.length()); } auto maybe = message->GetLineNumber(context_->v8_context()); int line_number = maybe.IsJust() ? maybe.FromJust() : 0; return base::StringPrintf(""%s:%d: %s"", resource_name.c_str(), line_number, error_message.c_str()); } ",0 "int cipso_v4_skbuff_setattr(struct sk_buff *skb, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val; struct iphdr *iph; struct ip_options *opt = &IPCB(skb)->opt; unsigned char buf[CIPSO_V4_OPT_LEN_MAX]; u32 buf_len = CIPSO_V4_OPT_LEN_MAX; u32 opt_len; int len_delta; ret_val = cipso_v4_genopt(buf, buf_len, doi_def, secattr); if (ret_val < 0) return ret_val; buf_len = ret_val; opt_len = (buf_len + 3) & ~3; /* we overwrite any existing options to ensure that we have enough * room for the CIPSO option, the reason is that we _need_ to guarantee * that the security label is applied to the packet - we do the same * thing when using the socket options and it hasn't caused a problem, * if we need to we can always revisit this choice later */ len_delta = opt_len - opt->optlen; /* if we don't ensure enough headroom we could panic on the skb_push() * call below so make sure we have enough, we are also ""mangling"" the * packet so we should probably do a copy-on-write call anyway */ ret_val = skb_cow(skb, skb_headroom(skb) + len_delta); if (ret_val < 0) return ret_val; if (len_delta > 0) { /* we assume that the header + opt->optlen have already been * ""pushed"" in ip_options_build() or similar */ iph = ip_hdr(skb); skb_push(skb, len_delta); memmove((char *)iph - len_delta, iph, iph->ihl << 2); skb_reset_network_header(skb); iph = ip_hdr(skb); } else if (len_delta < 0) { iph = ip_hdr(skb); memset(iph + 1, IPOPT_NOP, opt->optlen); } else iph = ip_hdr(skb); if (opt->optlen > 0) memset(opt, 0, sizeof(*opt)); opt->optlen = opt_len; opt->cipso = sizeof(struct iphdr); opt->is_changed = 1; /* we have to do the following because we are being called from a * netfilter hook which means the packet already has had the header * fields populated and the checksum calculated - yes this means we * are doing more work than needed but we do it to keep the core * stack clean and tidy */ memcpy(iph + 1, buf, buf_len); if (opt_len > buf_len) memset((char *)(iph + 1) + buf_len, 0, opt_len - buf_len); if (len_delta != 0) { iph->ihl = 5 + (opt_len >> 2); iph->tot_len = htons(skb->len); } ip_send_check(iph); return 0; } ",0 "int dns_packet_is_reply_for(DnsPacket *p, const DnsResourceKey *key) { int r; assert(p); assert(key); /* Checks if the specified packet is a reply for the specified * key and the specified key is the only one in the question * section. */ if (DNS_PACKET_QR(p) != 1) return 0; /* Let's unpack the packet, if that hasn't happened yet. */ r = dns_packet_extract(p); if (r < 0) return r; if (p->question->n_keys != 1) return 0; return dns_resource_key_equal(p->question->keys[0], key); } ",1 " virtual ~PendingCommentCallback() { xmlFree(s); } ",0 "void ExtensionInstallPrompt::OnInstallSuccess(const Extension* extension, SkBitmap* icon) { extension_ = extension; SetIcon(icon); install_ui_->OnInstallSuccess(extension, &icon_); } ",0 "static void PartiallyRuntimeEnabledOverloadedVoidMethod1Method(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8StringResource<> string_arg; string_arg = info[0]; if (!string_arg.Prepare()) return; impl->partiallyRuntimeEnabledOverloadedVoidMethod(string_arg); } ",0 "void AXLayoutObject::handleAriaExpandedChanged() { AXObject* containerParent = this->parentObject(); while (containerParent) { bool foundParent = false; switch (containerParent->roleValue()) { case TreeRole: case TreeGridRole: case GridRole: case TableRole: foundParent = true; break; default: break; } if (foundParent) break; containerParent = containerParent->parentObject(); } if (containerParent) axObjectCache().postNotification(containerParent, AXObjectCacheImpl::AXRowCountChanged); AccessibilityExpanded expanded = isExpanded(); if (!expanded) return; if (roleValue() == RowRole || roleValue() == TreeItemRole) { AXObjectCacheImpl::AXNotification notification = AXObjectCacheImpl::AXRowExpanded; if (expanded == ExpandedCollapsed) notification = AXObjectCacheImpl::AXRowCollapsed; axObjectCache().postNotification(this, notification); } else { axObjectCache().postNotification(this, AXObjectCacheImpl::AXExpandedChanged); } } ",0 "static int handle_closedir(FsContext *ctx, V9fsFidOpenState *fs) { return closedir(fs->dir.stream); } ",0 " SubprocessMetricsProviderTest() : thread_bundle_(content::TestBrowserThreadBundle::DEFAULT) { base::PersistentHistogramAllocator::GetCreateHistogramResultHistogram(); provider_.MergeHistogramDeltas(); test_recorder_ = base::StatisticsRecorder::CreateTemporaryForTesting(); base::GlobalHistogramAllocator::CreateWithLocalMemory(TEST_MEMORY_SIZE, 0, """"); } ",1 "void commandCommand(client *c) { dictIterator *di; dictEntry *de; if (c->argc == 1) { addReplyMultiBulkLen(c, dictSize(server.commands)); di = dictGetIterator(server.commands); while ((de = dictNext(di)) != NULL) { addReplyCommand(c, dictGetVal(de)); } dictReleaseIterator(di); } else if (!strcasecmp(c->argv[1]->ptr, ""info"")) { int i; addReplyMultiBulkLen(c, c->argc-2); for (i = 2; i < c->argc; i++) { addReplyCommand(c, dictFetchValue(server.commands, c->argv[i]->ptr)); } } else if (!strcasecmp(c->argv[1]->ptr, ""count"") && c->argc == 2) { addReplyLongLong(c, dictSize(server.commands)); } else if (!strcasecmp(c->argv[1]->ptr,""getkeys"") && c->argc >= 3) { struct redisCommand *cmd = lookupCommand(c->argv[2]->ptr); int *keys, numkeys, j; if (!cmd) { addReplyErrorFormat(c,""Invalid command specified""); return; } else if ((cmd->arity > 0 && cmd->arity != c->argc-2) || ((c->argc-2) < -cmd->arity)) { addReplyError(c,""Invalid number of arguments specified for command""); return; } keys = getKeysFromCommand(cmd,c->argv+2,c->argc-2,&numkeys); addReplyMultiBulkLen(c,numkeys); for (j = 0; j < numkeys; j++) addReplyBulk(c,c->argv[keys[j]+2]); getKeysFreeResult(keys); } else { addReplyError(c, ""Unknown subcommand or wrong number of arguments.""); return; } } ",0 "void ehci_reset(void *opaque) { EHCIState *s = opaque; int i; USBDevice *devs[NB_PORTS]; trace_usb_ehci_reset(); /* * Do the detach before touching portsc, so that it correctly gets send to * us or to our companion based on PORTSC_POWNER before the reset. */ for(i = 0; i < NB_PORTS; i++) { devs[i] = s->ports[i].dev; if (devs[i] && devs[i]->attached) { usb_detach(&s->ports[i]); } } memset(&s->opreg, 0x00, sizeof(s->opreg)); memset(&s->portsc, 0x00, sizeof(s->portsc)); s->usbcmd = NB_MAXINTRATE << USBCMD_ITC_SH; s->usbsts = USBSTS_HALT; s->usbsts_pending = 0; s->usbsts_frindex = 0; ehci_update_irq(s); s->astate = EST_INACTIVE; s->pstate = EST_INACTIVE; for(i = 0; i < NB_PORTS; i++) { if (s->companion_ports[i]) { s->portsc[i] = PORTSC_POWNER | PORTSC_PPOWER; } else { s->portsc[i] = PORTSC_PPOWER; } if (devs[i] && devs[i]->attached) { usb_attach(&s->ports[i]); usb_device_reset(devs[i]); } } ehci_queues_rip_all(s, 0); ehci_queues_rip_all(s, 1); timer_del(s->frame_timer); qemu_bh_cancel(s->async_bh); } ",0 "BGD_DECLARE(int) gdImageColorExactAlpha (gdImagePtr im, int r, int g, int b, int a) { int i; if (im->trueColor) { return gdTrueColorAlpha (r, g, b, a); } for (i = 0; (i < (im->colorsTotal)); i++) { if (im->open[i]) { continue; } if ((im->red[i] == r) && (im->green[i] == g) && (im->blue[i] == b) && (im->alpha[i] == a)) { return i; } } return -1; } ",0 "LayoutUnit RenderBox::overrideContainingBlockContentLogicalWidth() const { ASSERT(hasOverrideContainingBlockLogicalWidth()); return gOverrideContainingBlockLogicalWidthMap->get(this); } ",0 "const char *X86_insn_name(csh handle, unsigned int id) { #ifndef CAPSTONE_DIET if (id >= X86_INS_ENDING) return NULL; return insn_name_maps[id].name; #else return NULL; #endif } ",0 "static int mov_read_chan(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; if (atom.size < 16) return 0; /* skip version and flags */ avio_skip(pb, 4); ff_mov_read_chan(c->fc, pb, st, atom.size - 4); return 0; } ",0 "static int ext4_do_update_inode(handle_t *handle, struct inode *inode, struct ext4_iloc *iloc) { struct ext4_inode *raw_inode = ext4_raw_inode(iloc); struct ext4_inode_info *ei = EXT4_I(inode); struct buffer_head *bh = iloc->bh; struct super_block *sb = inode->i_sb; int err = 0, rc, block; int need_datasync = 0, set_large_file = 0; uid_t i_uid; gid_t i_gid; projid_t i_projid; spin_lock(&ei->i_raw_lock); /* For fields not tracked in the in-memory inode, * initialise them to zero for new inodes. */ if (ext4_test_inode_state(inode, EXT4_STATE_NEW)) memset(raw_inode, 0, EXT4_SB(inode->i_sb)->s_inode_size); ext4_get_inode_flags(ei); raw_inode->i_mode = cpu_to_le16(inode->i_mode); i_uid = i_uid_read(inode); i_gid = i_gid_read(inode); i_projid = from_kprojid(&init_user_ns, ei->i_projid); if (!(test_opt(inode->i_sb, NO_UID32))) { raw_inode->i_uid_low = cpu_to_le16(low_16_bits(i_uid)); raw_inode->i_gid_low = cpu_to_le16(low_16_bits(i_gid)); /* * Fix up interoperability with old kernels. Otherwise, old inodes get * re-used with the upper 16 bits of the uid/gid intact */ if (!ei->i_dtime) { raw_inode->i_uid_high = cpu_to_le16(high_16_bits(i_uid)); raw_inode->i_gid_high = cpu_to_le16(high_16_bits(i_gid)); } else { raw_inode->i_uid_high = 0; raw_inode->i_gid_high = 0; } } else { raw_inode->i_uid_low = cpu_to_le16(fs_high2lowuid(i_uid)); raw_inode->i_gid_low = cpu_to_le16(fs_high2lowgid(i_gid)); raw_inode->i_uid_high = 0; raw_inode->i_gid_high = 0; } raw_inode->i_links_count = cpu_to_le16(inode->i_nlink); EXT4_INODE_SET_XTIME(i_ctime, inode, raw_inode); EXT4_INODE_SET_XTIME(i_mtime, inode, raw_inode); EXT4_INODE_SET_XTIME(i_atime, inode, raw_inode); EXT4_EINODE_SET_XTIME(i_crtime, ei, raw_inode); err = ext4_inode_blocks_set(handle, raw_inode, ei); if (err) { spin_unlock(&ei->i_raw_lock); goto out_brelse; } raw_inode->i_dtime = cpu_to_le32(ei->i_dtime); raw_inode->i_flags = cpu_to_le32(ei->i_flags & 0xFFFFFFFF); if (likely(!test_opt2(inode->i_sb, HURD_COMPAT))) raw_inode->i_file_acl_high = cpu_to_le16(ei->i_file_acl >> 32); raw_inode->i_file_acl_lo = cpu_to_le32(ei->i_file_acl); if (ei->i_disksize != ext4_isize(raw_inode)) { ext4_isize_set(raw_inode, ei->i_disksize); need_datasync = 1; } if (ei->i_disksize > 0x7fffffffULL) { if (!ext4_has_feature_large_file(sb) || EXT4_SB(sb)->s_es->s_rev_level == cpu_to_le32(EXT4_GOOD_OLD_REV)) set_large_file = 1; } raw_inode->i_generation = cpu_to_le32(inode->i_generation); if (S_ISCHR(inode->i_mode) || S_ISBLK(inode->i_mode)) { if (old_valid_dev(inode->i_rdev)) { raw_inode->i_block[0] = cpu_to_le32(old_encode_dev(inode->i_rdev)); raw_inode->i_block[1] = 0; } else { raw_inode->i_block[0] = 0; raw_inode->i_block[1] = cpu_to_le32(new_encode_dev(inode->i_rdev)); raw_inode->i_block[2] = 0; } } else if (!ext4_has_inline_data(inode)) { for (block = 0; block < EXT4_N_BLOCKS; block++) raw_inode->i_block[block] = ei->i_data[block]; } if (likely(!test_opt2(inode->i_sb, HURD_COMPAT))) { raw_inode->i_disk_version = cpu_to_le32(inode->i_version); if (ei->i_extra_isize) { if (EXT4_FITS_IN_INODE(raw_inode, ei, i_version_hi)) raw_inode->i_version_hi = cpu_to_le32(inode->i_version >> 32); raw_inode->i_extra_isize = cpu_to_le16(ei->i_extra_isize); } } BUG_ON(!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_PROJECT) && i_projid != EXT4_DEF_PROJID); if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE && EXT4_FITS_IN_INODE(raw_inode, ei, i_projid)) raw_inode->i_projid = cpu_to_le32(i_projid); ext4_inode_csum_set(inode, raw_inode, ei); spin_unlock(&ei->i_raw_lock); if (inode->i_sb->s_flags & MS_LAZYTIME) ext4_update_other_inodes_time(inode->i_sb, inode->i_ino, bh->b_data); BUFFER_TRACE(bh, ""call ext4_handle_dirty_metadata""); rc = ext4_handle_dirty_metadata(handle, NULL, bh); if (!err) err = rc; ext4_clear_inode_state(inode, EXT4_STATE_NEW); if (set_large_file) { BUFFER_TRACE(EXT4_SB(sb)->s_sbh, ""get write access""); err = ext4_journal_get_write_access(handle, EXT4_SB(sb)->s_sbh); if (err) goto out_brelse; ext4_update_dynamic_rev(sb); ext4_set_feature_large_file(sb); ext4_handle_sync(handle); err = ext4_handle_dirty_super(handle, sb); } ext4_update_inode_fsync_trans(handle, inode, need_datasync); out_brelse: brelse(bh); ext4_std_error(inode->i_sb, err); return err; } ",0 "static inline unsigned computeLengthForSubmission(const String& text) { return text.length() + numberOfLineBreaks(text); } ",0 "void OxideQQuickWebViewPrivate::setLocationBarAnimated(bool animated) { if (!proxy_) { construct_props_->location_bar_animated = animated; } else { proxy_->setLocationBarAnimated(animated); } } ",0 "static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs4_readdir_res *readdir) { struct xdr_buf *rcvbuf = &req->rq_rcv_buf; struct kvec *iov = rcvbuf->head; size_t hdrlen; u32 recvd, pglen = rcvbuf->page_len; int status; status = decode_op_hdr(xdr, OP_READDIR); if (!status) status = decode_verifier(xdr, readdir->verifier.data); if (unlikely(status)) return status; dprintk(""%s: verifier = %08x:%08x\n"", __func__, ((u32 *)readdir->verifier.data)[0], ((u32 *)readdir->verifier.data)[1]); hdrlen = (char *) xdr->p - (char *) iov->iov_base; recvd = rcvbuf->len - hdrlen; if (pglen > recvd) pglen = recvd; xdr_read_pages(xdr, pglen); return pglen; } ",0 "device_filesystem_create (Device *device, const char *fstype, char **options, DBusGMethodInvocation *context) { daemon_local_check_auth (device->priv->daemon, device, device->priv->device_is_system_internal ? ""org.freedesktop.udisks.change-system-internal"" : ""org.freedesktop.udisks.change"", ""FilesystemCreate"", TRUE, device_filesystem_create_authorized_cb, context, 2, g_strdup (fstype), g_free, g_strdupv (options), g_strfreev); return TRUE; } ",0 "static void migrate_dead_tasks(unsigned int dead_cpu) { struct rq *rq = cpu_rq(dead_cpu); struct task_struct *next; for ( ; ; ) { if (!rq->nr_running) break; next = pick_next_task(rq); if (!next) break; next->sched_class->put_prev_task(rq, next); migrate_dead(dead_cpu, next); } } ",0 "xfs_attr_shortform_create(xfs_da_args_t *args) { xfs_attr_sf_hdr_t *hdr; xfs_inode_t *dp; xfs_ifork_t *ifp; trace_xfs_attr_sf_create(args); dp = args->dp; ASSERT(dp != NULL); ifp = dp->i_afp; ASSERT(ifp != NULL); ASSERT(ifp->if_bytes == 0); if (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS) { ifp->if_flags &= ~XFS_IFEXTENTS; /* just in case */ dp->i_d.di_aformat = XFS_DINODE_FMT_LOCAL; ifp->if_flags |= XFS_IFINLINE; } else { ASSERT(ifp->if_flags & XFS_IFINLINE); } xfs_idata_realloc(dp, sizeof(*hdr), XFS_ATTR_FORK); hdr = (xfs_attr_sf_hdr_t *)ifp->if_u1.if_data; hdr->count = 0; hdr->totsize = cpu_to_be16(sizeof(*hdr)); xfs_trans_log_inode(args->trans, dp, XFS_ILOG_CORE | XFS_ILOG_ADATA); } ",0 "void RenderWidgetHostViewAura::Show() { window_->Show(); WasShown(); } ",0 "static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) { __be32 *p; int status = 0; *res = 0; if (unlikely(bitmap[1] & (FATTR4_WORD1_SPACE_TOTAL - 1U))) return -EIO; if (likely(bitmap[1] & FATTR4_WORD1_SPACE_TOTAL)) { p = xdr_inline_decode(xdr, 8); if (unlikely(!p)) goto out_overflow; xdr_decode_hyper(p, res); bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; } dprintk(""%s: space total=%Lu\n"", __func__, (unsigned long long)*res); return status; out_overflow: print_overflow_msg(__func__, xdr); return -EIO; } ",0 "static bool lxc_cgmanager_chmod(const char *controller, const char *cgroup_path, const char *file, int mode) { if (cgmanager_chmod_sync(NULL, cgroup_manager, controller, cgroup_path, file, mode) != 0) { NihError *nerr; nerr = nih_error_get(); ERROR(""call to cgmanager_chmod_sync failed: %s"", nerr->message); nih_free(nerr); return false; } return true; } ",0 "static int tg3_change_mtu(struct net_device *dev, int new_mtu) { struct tg3 *tp = netdev_priv(dev); int err, reset_phy = 0; if (new_mtu < TG3_MIN_MTU || new_mtu > TG3_MAX_MTU(tp)) return -EINVAL; if (!netif_running(dev)) { /* We'll just catch it later when the * device is up'd. */ tg3_set_mtu(dev, tp, new_mtu); return 0; } tg3_phy_stop(tp); tg3_netif_stop(tp); tg3_full_lock(tp, 1); tg3_halt(tp, RESET_KIND_SHUTDOWN, 1); tg3_set_mtu(dev, tp, new_mtu); /* Reset PHY, otherwise the read DMA engine will be in a mode that * breaks all requests to 256 bytes. */ if (tg3_asic_rev(tp) == ASIC_REV_57766) reset_phy = 1; err = tg3_restart_hw(tp, reset_phy); if (!err) tg3_netif_start(tp); tg3_full_unlock(tp); if (!err) tg3_phy_start(tp); return err; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufsize, GLsizei* length, GLsizei* columns, GLsizei* rows, void* pixels, int32_t* success) { CheckErrorCallbackState(); ScopedPackStateRowLengthReset reset_row_length( api(), bufsize != 0 && feature_info_->gl_version_info().is_es3); api()->glReadPixelsRobustANGLEFn(x, y, width, height, format, type, bufsize, length, columns, rows, pixels); *success = CheckErrorCallbackState() ? 0 : 1; return error::kNoError; } ",0 "static void drop_links(struct nameidata *nd) { int i = nd->depth; while (i--) { struct saved *last = nd->stack + i; do_delayed_call(&last->done); clear_delayed_call(&last->done); } } ",0 "static int xhci_try_complete_packet(XHCITransfer *xfer) { if (xfer->packet.status == USB_RET_ASYNC) { trace_usb_xhci_xfer_async(xfer); xfer->running_async = 1; xfer->running_retry = 0; xfer->complete = 0; return 0; } else if (xfer->packet.status == USB_RET_NAK) { trace_usb_xhci_xfer_nak(xfer); xfer->running_async = 0; xfer->running_retry = 1; xfer->complete = 0; return 0; } else { xfer->running_async = 0; xfer->running_retry = 0; xfer->complete = 1; xhci_xfer_unmap(xfer); } if (xfer->packet.status == USB_RET_SUCCESS) { trace_usb_xhci_xfer_success(xfer, xfer->packet.actual_length); xfer->status = CC_SUCCESS; xhci_xfer_report(xfer); return 0; } /* error */ trace_usb_xhci_xfer_error(xfer, xfer->packet.status); switch (xfer->packet.status) { case USB_RET_NODEV: case USB_RET_IOERROR: xfer->status = CC_USB_TRANSACTION_ERROR; xhci_xfer_report(xfer); xhci_stall_ep(xfer); break; case USB_RET_STALL: xfer->status = CC_STALL_ERROR; xhci_xfer_report(xfer); xhci_stall_ep(xfer); break; case USB_RET_BABBLE: xfer->status = CC_BABBLE_DETECTED; xhci_xfer_report(xfer); xhci_stall_ep(xfer); break; default: DPRINTF(""%s: FIXME: status = %d\n"", __func__, xfer->packet.status); FIXME(""unhandled USB_RET_*""); } return 0; } ",0 "void bdrv_set_io_limits(BlockDriverState *bs, ThrottleConfig *cfg) { int i; throttle_config(&bs->throttle_state, cfg); for (i = 0; i < 2; i++) { qemu_co_enter_next(&bs->throttled_reqs[i]); } } ",0 "TaskQueueManager::AsValueWithSelectorResult(bool should_run, size_t selected_queue) const { DCHECK(main_thread_checker_.CalledOnValidThread()); scoped_refptr state = new base::trace_event::TracedValue(); state->BeginArray(""queues""); for (auto& queue : queues_) queue->AsValueInto(state.get()); state->EndArray(); state->BeginDictionary(""selector""); selector_->AsValueInto(state.get()); state->EndDictionary(); if (should_run) state->SetInteger(""selected_queue"", selected_queue); return state; } ",0 "static struct net_generic *net_alloc_generic(void) { struct net_generic *ng; unsigned int generic_size = offsetof(struct net_generic, ptr[max_gen_ptrs]); ng = kzalloc(generic_size, GFP_KERNEL); if (ng) ng->s.len = max_gen_ptrs; return ng; } ",0 "void OnLoFiResponseReceivedOnUI(content::WebContents* web_contents) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); PreviewsUITabHelper* ui_tab_helper = PreviewsUITabHelper::FromWebContents(web_contents); if (!ui_tab_helper) return; uint64_t page_id = 0; if (ui_tab_helper && ui_tab_helper->previews_user_data()) { page_id = ui_tab_helper->previews_user_data()->page_id(); } ui_tab_helper->ShowUIElement( previews::PreviewsType::LOFI, true /* is_data_saver_user */, base::BindOnce(&AddPreviewNavigationToBlackListCallback, web_contents->GetBrowserContext(), web_contents->GetController() .GetLastCommittedEntry() ->GetRedirectChain()[0], previews::PreviewsType::LOFI, page_id)); } ",0 "int modbus_set_debug(modbus_t *ctx, int flag) { if (ctx == NULL) { errno = EINVAL; return -1; } ctx->debug = flag; return 0; } ",0 "static int FVAllSelected(FontView *fv) { int i, any = false; /* Is everything real selected? */ for ( i=0; ib.sf->glyphcnt; ++i ) if ( SCWorthOutputting(fv->b.sf->glyphs[i])) { if ( !fv->b.selected[fv->b.map->backmap[i]] ) return( false ); any = true; } return( any ); } ",0 "IV_API_CALL_STATUS_T impeg2d_api_entity(iv_obj_t *ps_dechdl, void *pv_api_ip, void *pv_api_op) { iv_obj_t *ps_dec_handle; dec_state_t *ps_dec_state; dec_state_multi_core_t *ps_dec_state_multi_core; impeg2d_video_decode_ip_t *ps_dec_ip; impeg2d_video_decode_op_t *ps_dec_op; WORD32 bytes_remaining; pic_buf_t *ps_disp_pic; ps_dec_ip = (impeg2d_video_decode_ip_t *)pv_api_ip; ps_dec_op = (impeg2d_video_decode_op_t *)pv_api_op; memset(ps_dec_op,0,sizeof(impeg2d_video_decode_op_t)); ps_dec_op->s_ivd_video_decode_op_t.u4_size = sizeof(impeg2d_video_decode_op_t); ps_dec_op->s_ivd_video_decode_op_t.u4_output_present = 0; bytes_remaining = ps_dec_ip->s_ivd_video_decode_ip_t.u4_num_Bytes; ps_dec_handle = (iv_obj_t *)ps_dechdl; if(ps_dechdl == NULL) { return(IV_FAIL); } ps_dec_state_multi_core = ps_dec_handle->pv_codec_handle; ps_dec_state = ps_dec_state_multi_core->ps_dec_state[0]; ps_dec_state->ps_disp_frm_buf = &(ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf); if(0 == ps_dec_state->u4_share_disp_buf) { ps_dec_state->ps_disp_frm_buf->pv_y_buf = ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[0]; ps_dec_state->ps_disp_frm_buf->pv_u_buf = ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[1]; ps_dec_state->ps_disp_frm_buf->pv_v_buf = ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[2]; } ps_dec_state->ps_disp_pic = NULL; ps_dec_state->i4_frame_decoded = 0; /*rest bytes consumed */ ps_dec_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = 0; ps_dec_op->s_ivd_video_decode_op_t.u4_error_code = IV_SUCCESS; if((ps_dec_ip->s_ivd_video_decode_ip_t.pv_stream_buffer == NULL)&&(ps_dec_state->u1_flushfrm==0)) { ps_dec_op->s_ivd_video_decode_op_t.u4_error_code |= 1 << IVD_UNSUPPORTEDPARAM; ps_dec_op->s_ivd_video_decode_op_t.u4_error_code |= IVD_DEC_FRM_BS_BUF_NULL; return IV_FAIL; } if (ps_dec_state->u4_num_frames_decoded > NUM_FRAMES_LIMIT) { ps_dec_op->s_ivd_video_decode_op_t.u4_error_code = IMPEG2D_SAMPLE_VERSION_LIMIT_ERR; return(IV_FAIL); } if(((0 == ps_dec_state->u2_header_done) || (ps_dec_state->u2_decode_header == 1)) && (ps_dec_state->u1_flushfrm == 0)) { impeg2d_dec_hdr(ps_dec_state,ps_dec_ip ,ps_dec_op); bytes_remaining -= ps_dec_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed; } if((1 != ps_dec_state->u2_decode_header) && ((bytes_remaining > 0) || ps_dec_state->u1_flushfrm)) { if(ps_dec_state->u1_flushfrm) { if(ps_dec_state->aps_ref_pics[1] != NULL) { impeg2_disp_mgr_add(&ps_dec_state->s_disp_mgr, ps_dec_state->aps_ref_pics[1], ps_dec_state->aps_ref_pics[1]->i4_buf_id); impeg2_buf_mgr_release(ps_dec_state->pv_pic_buf_mg, ps_dec_state->aps_ref_pics[1]->i4_buf_id, BUF_MGR_REF); impeg2_buf_mgr_release(ps_dec_state->pv_pic_buf_mg, ps_dec_state->aps_ref_pics[0]->i4_buf_id, BUF_MGR_REF); ps_dec_state->aps_ref_pics[1] = NULL; ps_dec_state->aps_ref_pics[0] = NULL; } else if(ps_dec_state->aps_ref_pics[0] != NULL) { impeg2_disp_mgr_add(&ps_dec_state->s_disp_mgr, ps_dec_state->aps_ref_pics[0], ps_dec_state->aps_ref_pics[0]->i4_buf_id); impeg2_buf_mgr_release(ps_dec_state->pv_pic_buf_mg, ps_dec_state->aps_ref_pics[0]->i4_buf_id, BUF_MGR_REF); ps_dec_state->aps_ref_pics[0] = NULL; } ps_dec_ip->s_ivd_video_decode_ip_t.u4_size = sizeof(impeg2d_video_decode_ip_t); ps_dec_op->s_ivd_video_decode_op_t.u4_size = sizeof(impeg2d_video_decode_op_t); ps_disp_pic = impeg2_disp_mgr_get(&ps_dec_state->s_disp_mgr, &ps_dec_state->i4_disp_buf_id); ps_dec_state->ps_disp_pic = ps_disp_pic; if(ps_disp_pic == NULL) { ps_dec_op->s_ivd_video_decode_op_t.u4_output_present = 0; } else { WORD32 fmt_conv; if(0 == ps_dec_state->u4_share_disp_buf) { ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.pv_y_buf = ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[0]; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.pv_u_buf = ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[1]; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.pv_v_buf = ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[2]; fmt_conv = 1; } else { ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.pv_y_buf = ps_disp_pic->pu1_y; if(IV_YUV_420P == ps_dec_state->i4_chromaFormat) { ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.pv_u_buf = ps_disp_pic->pu1_u; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.pv_v_buf = ps_disp_pic->pu1_v; fmt_conv = 0; } else { UWORD8 *pu1_buf; pu1_buf = ps_dec_state->as_disp_buffers[ps_disp_pic->i4_buf_id].pu1_bufs[1]; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.pv_u_buf = pu1_buf; pu1_buf = ps_dec_state->as_disp_buffers[ps_disp_pic->i4_buf_id].pu1_bufs[2]; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.pv_v_buf = pu1_buf; fmt_conv = 1; } } if(fmt_conv == 1) { iv_yuv_buf_t *ps_dst; ps_dst = &(ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf); if(ps_dec_state->u4_deinterlace && (0 == ps_dec_state->u2_progressive_frame)) { impeg2d_deinterlace(ps_dec_state, ps_disp_pic, ps_dst, 0, ps_dec_state->u2_vertical_size); } else { impeg2d_format_convert(ps_dec_state, ps_disp_pic, ps_dst, 0, ps_dec_state->u2_vertical_size); } } if(ps_dec_state->u4_deinterlace) { if(ps_dec_state->ps_deint_pic) { impeg2_buf_mgr_release(ps_dec_state->pv_pic_buf_mg, ps_dec_state->ps_deint_pic->i4_buf_id, MPEG2_BUF_MGR_DEINT); } ps_dec_state->ps_deint_pic = ps_disp_pic; } if(0 == ps_dec_state->u4_share_disp_buf) impeg2_buf_mgr_release(ps_dec_state->pv_pic_buf_mg, ps_disp_pic->i4_buf_id, BUF_MGR_DISP); ps_dec_op->s_ivd_video_decode_op_t.u4_pic_ht = ps_dec_state->u2_vertical_size; ps_dec_op->s_ivd_video_decode_op_t.u4_pic_wd = ps_dec_state->u2_horizontal_size; ps_dec_op->s_ivd_video_decode_op_t.u4_output_present = 1; ps_dec_op->s_ivd_video_decode_op_t.u4_disp_buf_id = ps_disp_pic->i4_buf_id; ps_dec_op->s_ivd_video_decode_op_t.u4_ts = ps_disp_pic->u4_ts; ps_dec_op->s_ivd_video_decode_op_t.e_output_format = (IV_COLOR_FORMAT_T)ps_dec_state->i4_chromaFormat; ps_dec_op->s_ivd_video_decode_op_t.u4_is_ref_flag = (B_PIC != ps_dec_state->e_pic_type); ps_dec_op->s_ivd_video_decode_op_t.u4_progressive_frame_flag = IV_PROGRESSIVE; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_y_wd = ps_dec_state->u2_horizontal_size; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_y_strd = ps_dec_state->u4_frm_buf_stride; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_y_ht = ps_dec_state->u2_vertical_size; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_wd = ps_dec_state->u2_horizontal_size >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_strd = ps_dec_state->u4_frm_buf_stride >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_ht = ps_dec_state->u2_vertical_size >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_wd = ps_dec_state->u2_horizontal_size >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_strd = ps_dec_state->u4_frm_buf_stride >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_ht = ps_dec_state->u2_vertical_size >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_size = sizeof(ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf); switch(ps_dec_state->i4_chromaFormat) { case IV_YUV_420SP_UV: case IV_YUV_420SP_VU: ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_wd = ps_dec_state->u2_horizontal_size; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_strd = ps_dec_state->u4_frm_buf_stride; break; case IV_YUV_422ILE: ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_wd = 0; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_ht = 0; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_wd = 0; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_ht = 0; break; default: break; } } if(ps_dec_op->s_ivd_video_decode_op_t.u4_output_present) { if(1 == ps_dec_op->s_ivd_video_decode_op_t.u4_output_present) { INSERT_LOGO(ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[0], ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[1], ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[2], ps_dec_state->u4_frm_buf_stride, ps_dec_state->u2_horizontal_size, ps_dec_state->u2_vertical_size, ps_dec_state->i4_chromaFormat, ps_dec_state->u2_horizontal_size, ps_dec_state->u2_vertical_size); } return(IV_SUCCESS); } else { ps_dec_state->u1_flushfrm = 0; return(IV_FAIL); } } else if(ps_dec_state->u1_flushfrm==0) { ps_dec_ip->s_ivd_video_decode_ip_t.u4_size = sizeof(impeg2d_video_decode_ip_t); ps_dec_op->s_ivd_video_decode_op_t.u4_size = sizeof(impeg2d_video_decode_op_t); if(ps_dec_ip->s_ivd_video_decode_ip_t.u4_num_Bytes < 4) { ps_dec_op->s_ivd_video_decode_op_t.u4_num_bytes_consumed = ps_dec_ip->s_ivd_video_decode_ip_t.u4_num_Bytes; return(IV_FAIL); } if(1 == ps_dec_state->u4_share_disp_buf) { if(0 == impeg2_buf_mgr_check_free(ps_dec_state->pv_pic_buf_mg)) { ps_dec_op->s_ivd_video_decode_op_t.u4_error_code = (IMPEG2D_ERROR_CODES_T)IVD_DEC_REF_BUF_NULL; return IV_FAIL; } } ps_dec_op->s_ivd_video_decode_op_t.e_output_format = (IV_COLOR_FORMAT_T)ps_dec_state->i4_chromaFormat; ps_dec_op->s_ivd_video_decode_op_t.u4_is_ref_flag = (B_PIC != ps_dec_state->e_pic_type); ps_dec_op->s_ivd_video_decode_op_t.u4_progressive_frame_flag = IV_PROGRESSIVE; if (0 == ps_dec_state->u4_frm_buf_stride) { ps_dec_state->u4_frm_buf_stride = (ps_dec_state->u2_horizontal_size); } ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_y_wd = ps_dec_state->u2_horizontal_size; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_y_strd = ps_dec_state->u4_frm_buf_stride; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_y_ht = ps_dec_state->u2_vertical_size; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_wd = ps_dec_state->u2_horizontal_size >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_strd = ps_dec_state->u4_frm_buf_stride >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_ht = ps_dec_state->u2_vertical_size >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_wd = ps_dec_state->u2_horizontal_size >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_strd = ps_dec_state->u4_frm_buf_stride >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_ht = ps_dec_state->u2_vertical_size >> 1; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_size = sizeof(ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf); switch(ps_dec_state->i4_chromaFormat) { case IV_YUV_420SP_UV: case IV_YUV_420SP_VU: ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_wd = ps_dec_state->u2_horizontal_size; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_strd = ps_dec_state->u4_frm_buf_stride; break; case IV_YUV_422ILE: ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_wd = 0; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_u_ht = 0; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_wd = 0; ps_dec_op->s_ivd_video_decode_op_t.s_disp_frm_buf.u4_v_ht = 0; break; default: break; } if( ps_dec_state->u1_flushfrm == 0) { ps_dec_state->u1_flushcnt = 0; /*************************************************************************/ /* Frame Decode */ /*************************************************************************/ impeg2d_dec_frm(ps_dec_state,ps_dec_ip,ps_dec_op); if (IVD_ERROR_NONE == ps_dec_op->s_ivd_video_decode_op_t.u4_error_code) { if(ps_dec_state->u1_first_frame_done == 0) { ps_dec_state->u1_first_frame_done = 1; } if(ps_dec_state->ps_disp_pic) { ps_dec_op->s_ivd_video_decode_op_t.u4_output_present = 1; switch(ps_dec_state->ps_disp_pic->e_pic_type) { case I_PIC : ps_dec_op->s_ivd_video_decode_op_t.e_pic_type = IV_I_FRAME; break; case P_PIC: ps_dec_op->s_ivd_video_decode_op_t.e_pic_type = IV_P_FRAME; break; case B_PIC: ps_dec_op->s_ivd_video_decode_op_t.e_pic_type = IV_B_FRAME; break; case D_PIC: ps_dec_op->s_ivd_video_decode_op_t.e_pic_type = IV_I_FRAME; break; default : ps_dec_op->s_ivd_video_decode_op_t.e_pic_type = IV_FRAMETYPE_DEFAULT; break; } } else { ps_dec_op->s_ivd_video_decode_op_t.u4_output_present = 0; ps_dec_op->s_ivd_video_decode_op_t.e_pic_type = IV_NA_FRAME; } ps_dec_state->u4_num_frames_decoded++; } } else { ps_dec_state->u1_flushcnt++; } } if(ps_dec_state->ps_disp_pic) { ps_dec_op->s_ivd_video_decode_op_t.u4_disp_buf_id = ps_dec_state->ps_disp_pic->i4_buf_id; ps_dec_op->s_ivd_video_decode_op_t.u4_ts = ps_dec_state->ps_disp_pic->u4_ts; if(0 == ps_dec_state->u4_share_disp_buf) { impeg2_buf_mgr_release(ps_dec_state->pv_pic_buf_mg, ps_dec_state->ps_disp_pic->i4_buf_id, BUF_MGR_DISP); } } if(ps_dec_state->u4_deinterlace) { if(ps_dec_state->ps_deint_pic) { impeg2_buf_mgr_release(ps_dec_state->pv_pic_buf_mg, ps_dec_state->ps_deint_pic->i4_buf_id, MPEG2_BUF_MGR_DEINT); } ps_dec_state->ps_deint_pic = ps_dec_state->ps_disp_pic; } if(1 == ps_dec_op->s_ivd_video_decode_op_t.u4_output_present) { INSERT_LOGO(ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[0], ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[1], ps_dec_ip->s_ivd_video_decode_ip_t.s_out_buffer.pu1_bufs[2], ps_dec_state->u4_frm_buf_stride, ps_dec_state->u2_horizontal_size, ps_dec_state->u2_vertical_size, ps_dec_state->i4_chromaFormat, ps_dec_state->u2_horizontal_size, ps_dec_state->u2_vertical_size); } } ps_dec_op->s_ivd_video_decode_op_t.u4_progressive_frame_flag = 1; ps_dec_op->s_ivd_video_decode_op_t.e4_fld_type = ps_dec_state->s_disp_op.e4_fld_type; if(ps_dec_op->s_ivd_video_decode_op_t.u4_error_code) return IV_FAIL; else return IV_SUCCESS; } ",1 "void PrintPreviewHandler::SendCloudPrintEnabled() { Profile* profile = Profile::FromBrowserContext( preview_web_contents()->GetBrowserContext()); PrefService* prefs = profile->GetPrefs(); if (prefs->GetBoolean(prefs::kCloudPrintSubmitEnabled)) { GURL gcp_url(CloudPrintURL(profile).GetCloudPrintServiceURL()); base::StringValue gcp_url_value(gcp_url.spec()); web_ui()->CallJavascriptFunction(""setUseCloudPrint"", gcp_url_value); } } ",0 "static int find_cleanup_stream(h2_stream *stream, void *ictx) { stream_sel_ctx *ctx = ictx; if (H2_STREAM_CLIENT_INITIATED(stream->id)) { if (!ctx->session->local.accepting && stream->id > ctx->session->local.accepted_max) { ctx->candidate = stream; return 0; } } else { if (!ctx->session->remote.accepting && stream->id > ctx->session->remote.accepted_max) { ctx->candidate = stream; return 0; } } return 1; } ",0 "unsigned long gfn_to_hva_prot(struct kvm *kvm, gfn_t gfn, bool *writable) { struct kvm_memory_slot *slot = gfn_to_memslot(kvm, gfn); unsigned long hva = __gfn_to_hva_many(slot, gfn, NULL, false); if (!kvm_is_error_hva(hva) && writable) *writable = !memslot_is_readonly(slot); return hva; } ",0 "xmlParseNCName(xmlParserCtxtPtr ctxt) { const xmlChar *in; const xmlChar *ret; int count = 0; #ifdef DEBUG nbParseNCName++; #endif /* * Accelerator for simple ASCII names */ in = ctxt->input->cur; if (((*in >= 0x61) && (*in <= 0x7A)) || ((*in >= 0x41) && (*in <= 0x5A)) || (*in == '_')) { in++; while (((*in >= 0x61) && (*in <= 0x7A)) || ((*in >= 0x41) && (*in <= 0x5A)) || ((*in >= 0x30) && (*in <= 0x39)) || (*in == '_') || (*in == '-') || (*in == '.')) in++; if ((*in > 0) && (*in < 0x80)) { count = in - ctxt->input->cur; ret = xmlDictLookup(ctxt->dict, ctxt->input->cur, count); ctxt->input->cur = in; ctxt->nbChars += count; ctxt->input->col += count; if (ret == NULL) { xmlErrMemory(ctxt, NULL); } return(ret); } } return(xmlParseNCNameComplex(ctxt)); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoGetActiveUniformsiv( GLuint program, GLsizei count, const GLuint* indices, GLenum pname, GLint* params) { api()->glGetActiveUniformsivFn(GetProgramServiceID(program, resources_), count, indices, pname, params); return error::kNoError; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoMatrixLoadfCHROMIUM( GLenum matrixMode, const volatile GLfloat* m) { NOTIMPLEMENTED(); return error::kNoError; } ",0 "::rappor::RapporService* ChromeContentBrowserClient::GetRapporService() { return g_browser_process->rappor_service(); } ",0 "PassOwnPtr LayerTreeCoordinator::beginContentUpdate(const WebCore::IntSize& size, ShareableBitmap::Flags flags, ShareableSurface::Handle& handle, WebCore::IntPoint& offset) { OwnPtr graphicsContext; for (unsigned i = 0; i < m_updateAtlases.size(); ++i) { UpdateAtlas* atlas = m_updateAtlases[i].get(); if (atlas->flags() == flags) { graphicsContext = atlas->beginPaintingOnAvailableBuffer(handle, size, offset); if (graphicsContext) return graphicsContext.release(); } } static const int ScratchBufferDimension = 1024; // Should be a power of two. m_updateAtlases.append(adoptPtr(new UpdateAtlas(ScratchBufferDimension, flags))); return m_updateAtlases.last()->beginPaintingOnAvailableBuffer(handle, size, offset); } ",1 "void VaapiWrapper::VADisplayState::SetDrmFd(base::PlatformFile fd) { drm_fd_.reset(HANDLE_EINTR(dup(fd))); } ",0 " explicit Level(FromV8ValueState* state) : state_(state) { state_->max_recursion_depth_--; } ",0 "QuicStreamSequencerBuffer::QuicStreamSequencerBuffer(size_t max_capacity_bytes) : max_buffer_capacity_bytes_(max_capacity_bytes), blocks_count_( ceil(static_cast(max_capacity_bytes) / kBlockSizeBytes)), total_bytes_read_(0), blocks_(nullptr), destruction_indicator_(123456) { CHECK_GT(blocks_count_, 1u) << ""blocks_count_ = "" << blocks_count_ << "", max_buffer_capacity_bytes_ = "" << max_buffer_capacity_bytes_; Clear(); } ",0 "bool CSSStyleSheet::SheetLoaded() { DCHECK(owner_node_); SetLoadCompleted(owner_node_->SheetLoaded()); return load_completed_; } ",0 "void ResourceFetcher::StorePerformanceTimingInitiatorInformation( Resource* resource) { const AtomicString& fetch_initiator = resource->Options().initiator_info.name; if (fetch_initiator == FetchInitiatorTypeNames::internal) return; bool is_main_resource = resource->GetType() == Resource::kMainResource; double start_time = resource->GetResourceRequest().NavigationStartTime() ? resource->GetResourceRequest().NavigationStartTime() : MonotonicallyIncreasingTime(); if (is_main_resource) { DCHECK(!navigation_timing_info_); navigation_timing_info_ = ResourceTimingInfo::Create( fetch_initiator, start_time, is_main_resource); } RefPtr info = ResourceTimingInfo::Create(fetch_initiator, start_time, is_main_resource); if (resource->IsCacheValidator()) { const AtomicString& timing_allow_origin = resource->GetResponse().HttpHeaderField(HTTPNames::Timing_Allow_Origin); if (!timing_allow_origin.IsEmpty()) info->SetOriginalTimingAllowOrigin(timing_allow_origin); } if (!is_main_resource || Context().UpdateTimingInfoForIFrameNavigation(info.get())) { resource_timing_info_map_.insert(resource, std::move(info)); } } ",0 "int modbus_set_response_timeout(modbus_t *ctx, uint32_t to_sec, uint32_t to_usec) { if (ctx == NULL || (to_sec == 0 && to_usec == 0) || to_usec > 999999) { errno = EINVAL; return -1; } ctx->response_timeout.tv_sec = to_sec; ctx->response_timeout.tv_usec = to_usec; return 0; } ",0 "void comps_objmrtree_set_x(COMPS_ObjMRTree *rt, char *key, COMPS_Object *data) { __comps_objmrtree_set(rt, key, strlen(key), data); } ",0 "void HTMLMediaElement::clearMediaPlayer() { forgetResourceSpecificTracks(); closeMediaSource(); cancelDeferredLoad(); { AudioSourceProviderClientLockScope scope(*this); clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); } stopPeriodicTimers(); m_loadTimer.stop(); m_pendingActionFlags = 0; m_loadState = WaitingForSource; m_playingRemotely = false; remoteRouteAvailabilityChanged(WebRemotePlaybackAvailability::Unknown); if (layoutObject()) layoutObject()->setShouldDoFullPaintInvalidation(); } ",0 "static void ftrace_hash_clear(struct ftrace_hash *hash) { struct hlist_head *hhd; struct hlist_node *tn; struct ftrace_func_entry *entry; int size = 1 << hash->size_bits; int i; if (!hash->count) return; for (i = 0; i < size; i++) { hhd = &hash->buckets[i]; hlist_for_each_entry_safe(entry, tn, hhd, hlist) free_hash_entry(hash, entry); } FTRACE_WARN_ON(hash->count); } ",0 "fifo_open(notify_fifo_t* fifo, int (*script_exit)(thread_t *), const char *type) { int ret; int sav_errno; if (fifo->name) { sav_errno = 0; if (!(ret = mkfifo(fifo->name, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH))) fifo->created_fifo = true; else { sav_errno = errno; if (sav_errno != EEXIST) log_message(LOG_INFO, ""Unable to create %snotify fifo %s"", type, fifo->name); } if (!sav_errno || sav_errno == EEXIST) { /* Run the notify script if there is one */ if (fifo->script) notify_fifo_exec(master, script_exit, fifo, fifo->script); /* Now open the fifo */ if ((fifo->fd = open(fifo->name, O_RDWR | O_CLOEXEC | O_NONBLOCK)) == -1) { log_message(LOG_INFO, ""Unable to open %snotify fifo %s - errno %d"", type, fifo->name, errno); if (fifo->created_fifo) { unlink(fifo->name); fifo->created_fifo = false; } } } if (fifo->fd == -1) { FREE(fifo->name); fifo->name = NULL; } } } ",1 "bool ProfileSyncService::IsUsingSecondaryPassphrase() const { return backend_->IsUsingExplicitPassphrase(); } ",0 "static void update_free_queued_message(void* obj) { wMessage* msg = (wMessage*)obj; update_message_queue_free_message(msg); } ",0 "static av_cold int dpcm_decode_init(AVCodecContext *avctx) { DPCMContext *s = avctx->priv_data; int i; if (avctx->channels < 1 || avctx->channels > 2) { av_log(avctx, AV_LOG_INFO, ""invalid number of channels\n""); return AVERROR(EINVAL); } s->channels = avctx->channels; s->sample[0] = s->sample[1] = 0; switch(avctx->codec->id) { case CODEC_ID_ROQ_DPCM: /* initialize square table */ for (i = 0; i < 128; i++) { int16_t square = i * i; s->roq_square_array[i ] = square; s->roq_square_array[i + 128] = -square; } break; case CODEC_ID_SOL_DPCM: switch(avctx->codec_tag){ case 1: s->sol_table = sol_table_old; s->sample[0] = s->sample[1] = 0x80; break; case 2: s->sol_table = sol_table_new; s->sample[0] = s->sample[1] = 0x80; break; case 3: break; default: av_log(avctx, AV_LOG_ERROR, ""Unknown SOL subcodec\n""); return -1; } break; default: break; } if (avctx->codec->id == CODEC_ID_SOL_DPCM && avctx->codec_tag != 3) avctx->sample_fmt = AV_SAMPLE_FMT_U8; else avctx->sample_fmt = AV_SAMPLE_FMT_S16; avcodec_get_frame_defaults(&s->frame); avctx->coded_frame = &s->frame; return 0; } ",0 "unsigned int XKeyEventKeyCode(ui::KeyboardCode key_code, int flags, Display* display) { const int keysym = XKeysymForWindowsKeyCode(key_code, flags & ui::EF_SHIFT_DOWN); return (keysym == XK_less) ? 59 : XKeysymToKeycode(display, keysym); } ",0 "void FrameLoaderClient::cancelPolicyCheck() { if (m_policyDecision) webkit_web_policy_decision_cancel(m_policyDecision); } ",0 "void LiveSyncTest::ReadPasswordFile() { CommandLine* cl = CommandLine::ForCurrentProcess(); password_file_ = cl->GetSwitchValuePath(switches::kPasswordFileForTest); if (password_file_.empty()) LOG(FATAL) << ""Can't run live server test without specifying --"" << switches::kPasswordFileForTest << ""=""; std::string file_contents; file_util::ReadFileToString(password_file_, &file_contents); ASSERT_NE(file_contents, """") << ""Password file \"""" << password_file_.value() << ""\"" does not exist.""; std::vector tokens; std::string delimiters = ""\r\n""; Tokenize(file_contents, delimiters, &tokens); ASSERT_TRUE(tokens.size() == 2) << ""Password file \"""" << password_file_.value() << ""\"" must contain exactly two lines of text.""; username_ = tokens[0]; password_ = tokens[1]; } ",0 "static struct kvm_memory_slot *__gfn_to_memslot(struct kvm_memslots *slots, gfn_t gfn) { return search_memslots(slots, gfn); } ",0 "static void ex_assign_report_general(struct domain_device *dev, struct smp_resp *resp) { struct report_general_resp *rg = &resp->rg; dev->ex_dev.ex_change_count = be16_to_cpu(rg->change_count); dev->ex_dev.max_route_indexes = be16_to_cpu(rg->route_indexes); dev->ex_dev.num_phys = min(rg->num_phys, (u8)MAX_EXPANDER_PHYS); dev->ex_dev.t2t_supp = rg->t2t_supp; dev->ex_dev.conf_route_table = rg->conf_route_table; dev->ex_dev.configuring = rg->configuring; memcpy(dev->ex_dev.enclosure_logical_id, rg->enclosure_logical_id, 8); } ",0 "EmulationHandler::EmulationHandler() : DevToolsDomainHandler(Emulation::Metainfo::domainName), touch_emulation_enabled_(false), device_emulation_enabled_(false), host_(nullptr) { } ",0 "void InjectedBundlePage::dumpBackForwardList(StringBuilder& stringBuilder) { stringBuilder.appendLiteral(""\n============== Back Forward List ==============\n""); WKBundleBackForwardListRef list = WKBundlePageGetBackForwardList(m_page); Vector > itemsToPrint; for (unsigned i = WKBundleBackForwardListGetForwardListCount(list); i; --i) { WKRetainPtr item = adoptWK(WKBundleBackForwardListCopyItemAtIndex(list, i)); ASSERT(!WKBundleBackForwardListItemIsSame(item.get(), m_previousTestBackForwardListItem.get())); itemsToPrint.append(item); } ASSERT(!WKBundleBackForwardListItemIsSame(adoptWK(WKBundleBackForwardListCopyItemAtIndex(list, 0)).get(), m_previousTestBackForwardListItem.get())); itemsToPrint.append(adoptWK(WKBundleBackForwardListCopyItemAtIndex(list, 0))); int currentItemIndex = itemsToPrint.size() - 1; int backListCount = WKBundleBackForwardListGetBackListCount(list); for (int i = -1; i >= -backListCount; --i) { WKRetainPtr item = adoptWK(WKBundleBackForwardListCopyItemAtIndex(list, i)); if (WKBundleBackForwardListItemIsSame(item.get(), m_previousTestBackForwardListItem.get())) break; itemsToPrint.append(item); } for (int i = itemsToPrint.size() - 1; i >= 0; i--) dumpBackForwardListItem(itemsToPrint[i].get(), 8, i == currentItemIndex, stringBuilder); stringBuilder.appendLiteral(""===============================================\n""); } ",0 "static int wdm_probe(struct usb_interface *intf, const struct usb_device_id *id) { int rv = -EINVAL; struct usb_host_interface *iface; struct usb_endpoint_descriptor *ep; struct usb_cdc_dmm_desc *dmhd; u8 *buffer = intf->altsetting->extra; int buflen = intf->altsetting->extralen; u16 maxcom = WDM_DEFAULT_BUFSIZE; if (!buffer) goto err; while (buflen > 2) { if (buffer[1] != USB_DT_CS_INTERFACE) { dev_err(&intf->dev, ""skipping garbage\n""); goto next_desc; } switch (buffer[2]) { case USB_CDC_HEADER_TYPE: break; case USB_CDC_DMM_TYPE: dmhd = (struct usb_cdc_dmm_desc *)buffer; maxcom = le16_to_cpu(dmhd->wMaxCommand); dev_dbg(&intf->dev, ""Finding maximum buffer length: %d"", maxcom); break; default: dev_err(&intf->dev, ""Ignoring extra header, type %d, length %d\n"", buffer[2], buffer[0]); break; } next_desc: buflen -= buffer[0]; buffer += buffer[0]; } iface = intf->cur_altsetting; if (iface->desc.bNumEndpoints != 1) goto err; ep = &iface->endpoint[0].desc; rv = wdm_create(intf, ep, maxcom, &wdm_manage_power); err: return rv; } ",0 "static void rpc_final_put_task(struct rpc_task *task, struct workqueue_struct *q) { if (q != NULL) { INIT_WORK(&task->u.tk_work, rpc_async_release); queue_work(q, &task->u.tk_work); } else rpc_free_task(task); } ",0 "static int check_cond_jmp_op(struct bpf_verifier_env *env, struct bpf_insn *insn, int *insn_idx) { struct bpf_verifier_state *this_branch = env->cur_state; struct bpf_verifier_state *other_branch; struct bpf_reg_state *regs = this_branch->frame[this_branch->curframe]->regs; struct bpf_reg_state *dst_reg, *other_branch_regs; u8 opcode = BPF_OP(insn->code); int err; if (opcode > BPF_JSLE) { verbose(env, ""invalid BPF_JMP opcode %x\n"", opcode); return -EINVAL; } if (BPF_SRC(insn->code) == BPF_X) { if (insn->imm != 0) { verbose(env, ""BPF_JMP uses reserved fields\n""); return -EINVAL; } /* check src1 operand */ err = check_reg_arg(env, insn->src_reg, SRC_OP); if (err) return err; if (is_pointer_value(env, insn->src_reg)) { verbose(env, ""R%d pointer comparison prohibited\n"", insn->src_reg); return -EACCES; } } else { if (insn->src_reg != BPF_REG_0) { verbose(env, ""BPF_JMP uses reserved fields\n""); return -EINVAL; } } /* check src2 operand */ err = check_reg_arg(env, insn->dst_reg, SRC_OP); if (err) return err; dst_reg = ®s[insn->dst_reg]; if (BPF_SRC(insn->code) == BPF_K) { int pred = is_branch_taken(dst_reg, insn->imm, opcode); if (pred == 1) { /* only follow the goto, ignore fall-through */ *insn_idx += insn->off; return 0; } else if (pred == 0) { /* only follow fall-through branch, since * that's where the program will go */ return 0; } } other_branch = push_stack(env, *insn_idx + insn->off + 1, *insn_idx); if (!other_branch) return -EFAULT; other_branch_regs = other_branch->frame[other_branch->curframe]->regs; /* detect if we are comparing against a constant value so we can adjust * our min/max values for our dst register. * this is only legit if both are scalars (or pointers to the same * object, I suppose, but we don't support that right now), because * otherwise the different base pointers mean the offsets aren't * comparable. */ if (BPF_SRC(insn->code) == BPF_X) { if (dst_reg->type == SCALAR_VALUE && regs[insn->src_reg].type == SCALAR_VALUE) { if (tnum_is_const(regs[insn->src_reg].var_off)) reg_set_min_max(&other_branch_regs[insn->dst_reg], dst_reg, regs[insn->src_reg].var_off.value, opcode); else if (tnum_is_const(dst_reg->var_off)) reg_set_min_max_inv(&other_branch_regs[insn->src_reg], ®s[insn->src_reg], dst_reg->var_off.value, opcode); else if (opcode == BPF_JEQ || opcode == BPF_JNE) /* Comparing for equality, we can combine knowledge */ reg_combine_min_max(&other_branch_regs[insn->src_reg], &other_branch_regs[insn->dst_reg], ®s[insn->src_reg], ®s[insn->dst_reg], opcode); } } else if (dst_reg->type == SCALAR_VALUE) { reg_set_min_max(&other_branch_regs[insn->dst_reg], dst_reg, insn->imm, opcode); } /* detect if R == 0 where R is returned from bpf_map_lookup_elem() */ if (BPF_SRC(insn->code) == BPF_K && insn->imm == 0 && (opcode == BPF_JEQ || opcode == BPF_JNE) && reg_type_may_be_null(dst_reg->type)) { /* Mark all identical registers in each branch as either * safe or unknown depending R == 0 or R != 0 conditional. */ mark_ptr_or_null_regs(this_branch, insn->dst_reg, opcode == BPF_JNE); mark_ptr_or_null_regs(other_branch, insn->dst_reg, opcode == BPF_JEQ); } else if (!try_match_pkt_pointers(insn, dst_reg, ®s[insn->src_reg], this_branch, other_branch) && is_pointer_value(env, insn->dst_reg)) { verbose(env, ""R%d pointer comparison prohibited\n"", insn->dst_reg); return -EACCES; } if (env->log.level) print_verifier_state(env, this_branch->frame[this_branch->curframe]); return 0; } ",1 "bool HTMLInputElement::appendFormData(FormDataList& encoding, bool multipart) { return m_inputType->isFormDataAppendable() && m_inputType->appendFormData(encoding, multipart); } ",0 "status_t OMXCodec::allocateBuffers() { status_t err = allocateBuffersOnPort(kPortIndexInput); if (err != OK) { return err; } return allocateBuffersOnPort(kPortIndexOutput); } ",0 "static u64 guest_read_tsc(struct kvm_vcpu *vcpu) { u64 host_tsc, tsc_offset; host_tsc = rdtsc(); tsc_offset = vmcs_read64(TSC_OFFSET); return kvm_scale_tsc(vcpu, host_tsc) + tsc_offset; } ",0 "void SpeechSynthesis::startSpeakingImmediately() { SpeechSynthesisUtterance* utterance = currentSpeechUtterance(); ASSERT(utterance); utterance->setStartTime(monotonicallyIncreasingTime()); m_isPaused = false; m_platformSpeechSynthesizer->speak(utterance->platformUtterance()); } ",0 "WebApplicationCacheHost* RenderViewImpl::createApplicationCacheHost( WebFrame* frame, WebApplicationCacheHostClient* client) { if (!frame || !frame->view()) return NULL; return new RendererWebApplicationCacheHostImpl( FromWebView(frame->view()), client, RenderThreadImpl::current()->appcache_dispatcher()->backend_proxy()); } ",0 "static int rpza_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) { const uint8_t *buf = avpkt->data; int buf_size = avpkt->size; RpzaContext *s = avctx->priv_data; int ret; s->buf = buf; s->size = buf_size; if ((ret = ff_reget_buffer(avctx, &s->frame)) < 0) return ret; rpza_decode_stream(s); if ((ret = av_frame_ref(data, &s->frame)) < 0) return ret; *got_frame = 1; /* always report that the buffer was completely consumed */ return buf_size; } ",0 "MagickExport void SetCustomStreamSeeker(CustomStreamInfo *custom_stream, CustomStreamSeeker seeker) { assert(custom_stream != (CustomStreamInfo *) NULL); assert(custom_stream->signature == MagickCoreSignature); custom_stream->seeker=seeker; } ",0 "static void rdev_init_debugfs(struct regulator_dev *rdev) { rdev->debugfs = debugfs_create_dir(rdev_get_name(rdev), debugfs_root); if (!rdev->debugfs) { rdev_warn(rdev, ""Failed to create debugfs directory\n""); return; } debugfs_create_u32(""use_count"", 0444, rdev->debugfs, &rdev->use_count); debugfs_create_u32(""open_count"", 0444, rdev->debugfs, &rdev->open_count); debugfs_create_u32(""bypass_count"", 0444, rdev->debugfs, &rdev->bypass_count); } ",0 "bool ShellMainDelegate::BasicStartupComplete(int* exit_code) { base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); int dummy; if (!exit_code) exit_code = &dummy; #if defined(OS_WIN) logging::LogEventProvider::Initialize(kContentShellProviderName); v8_breakpad_support::SetUp(); #endif #if defined(OS_LINUX) breakpad::SetFirstChanceExceptionHandler(v8::V8::TryHandleSignal); #endif #if defined(OS_MACOSX) OverrideFrameworkBundlePath(); OverrideChildProcessPath(); OverrideSourceRootPath(); EnsureCorrectResolutionSettings(); #endif // OS_MACOSX InitLogging(command_line); if (command_line.HasSwitch(switches::kCheckLayoutTestSysDeps)) { if (!CheckLayoutSystemDeps()) { *exit_code = 1; return true; } } if (command_line.HasSwitch(""run-layout-test"")) { std::cerr << std::string(79, '*') << ""\n"" << ""* The flag --run-layout-test is obsolete. Please use --"" << switches::kRunWebTests << "" instead. *\n"" << std::string(79, '*') << ""\n""; command_line.AppendSwitch(switches::kRunWebTests); } if (command_line.HasSwitch(switches::kRunWebTests)) { EnableBrowserLayoutTestMode(); #if BUILDFLAG(ENABLE_PLUGINS) if (!ppapi::RegisterBlinkTestPlugin(&command_line)) { *exit_code = 1; return true; } #endif command_line.AppendSwitch(switches::kDisableResizeLock); command_line.AppendSwitch(cc::switches::kEnableGpuBenchmarking); command_line.AppendSwitch(switches::kEnableLogging); command_line.AppendSwitch(switches::kAllowFileAccessFromFiles); if (!command_line.HasSwitch(switches::kUseGpuInTests) && !command_line.HasSwitch(switches::kUseGL)) { command_line.AppendSwitchASCII( switches::kUseGL, gl::GetGLImplementationName(gl::GetSoftwareGLImplementation())); } command_line.AppendSwitchASCII( switches::kTouchEventFeatureDetection, switches::kTouchEventFeatureDetectionEnabled); if (!command_line.HasSwitch(switches::kForceDeviceScaleFactor)) command_line.AppendSwitchASCII(switches::kForceDeviceScaleFactor, ""1.0""); if (!command_line.HasSwitch(switches::kAutoplayPolicy)) { command_line.AppendSwitchASCII( switches::kAutoplayPolicy, switches::autoplay::kNoUserGestureRequiredPolicy); } if (!command_line.HasSwitch(switches::kStableReleaseMode)) { command_line.AppendSwitch( switches::kEnableExperimentalWebPlatformFeatures); } if (!command_line.HasSwitch(switches::kEnableThreadedCompositing)) { command_line.AppendSwitch(switches::kDisableThreadedCompositing); command_line.AppendSwitch(cc::switches::kDisableThreadedAnimation); } if (command_line.HasSwitch(switches::kEnableDisplayCompositorPixelDump)) { command_line.AppendSwitch(switches::kRunAllCompositorStagesBeforeDraw); command_line.AppendSwitch(cc::switches::kDisableCheckerImaging); } command_line.AppendSwitch(switches::kEnableInbandTextTracks); command_line.AppendSwitch(switches::kMuteAudio); command_line.AppendSwitch(switches::kEnablePreciseMemoryInfo); command_line.AppendSwitchASCII(network::switches::kHostResolverRules, ""MAP *.test 127.0.0.1""); command_line.AppendSwitch(switches::kEnablePartialRaster); command_line.AppendSwitch(switches::kEnableWebAuthTestingAPI); if (!command_line.HasSwitch(switches::kForceGpuRasterization) && !command_line.HasSwitch(switches::kEnableGpuRasterization)) { command_line.AppendSwitch(switches::kDisableGpuRasterization); } if (!command_line.HasSwitch(switches::kForceColorProfile)) command_line.AppendSwitchASCII(switches::kForceColorProfile, ""srgb""); command_line.AppendSwitch(switches::kDisableSkiaRuntimeOpts); command_line.AppendSwitch(switches::kDisallowNonExactResourceReuse); command_line.AppendSwitch(switches::kUseFakeUIForMediaStream); command_line.AppendSwitch(switches::kUseFakeDeviceForMediaStream); if (!BlinkTestPlatformInitialize()) { *exit_code = 1; return true; } } content_client_.reset(switches::IsRunWebTestsSwitchPresent() ? new LayoutTestContentClient : new ShellContentClient); SetContentClient(content_client_.get()); return false; } ",0 "void WebContentsImpl::NotifyNavigationStateChanged( InvalidateTypes changed_flags) { if (changed_flags & INVALIDATE_TYPE_TAB) { media_web_contents_observer_->MaybeUpdateAudibleState(); } if (delegate_) delegate_->NavigationStateChanged(this, changed_flags); if (GetOuterWebContents()) GetOuterWebContents()->NotifyNavigationStateChanged(changed_flags); } ",0 "void Document::updateStyleAndLayoutTreeForNode(const Node* node) { DCHECK(node); if (!needsLayoutTreeUpdateForNode(*node)) return; updateStyleAndLayoutTree(); } ",0 "bool AppCacheGroup::FindObserver( const UpdateObserver* find_me, const base::ObserverList::Unchecked& observer_list) { return observer_list.HasObserver(find_me); } ",0 "ArthurOutputDev::ArthurOutputDev(QPainter *painter): m_painter(painter) { m_currentBrush = QBrush(Qt::SolidPattern); m_fontEngine = 0; m_font = 0; m_image = 0; } ",0 "xfs_attr_fillstate(xfs_da_state_t *state) { xfs_da_state_path_t *path; xfs_da_state_blk_t *blk; int level; trace_xfs_attr_fillstate(state->args); /* * Roll down the ""path"" in the state structure, storing the on-disk * block number for those buffers in the ""path"". */ path = &state->path; ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH)); for (blk = path->blk, level = 0; level < path->active; blk++, level++) { if (blk->bp) { blk->disk_blkno = XFS_BUF_ADDR(blk->bp); blk->bp = NULL; } else { blk->disk_blkno = 0; } } /* * Roll down the ""altpath"" in the state structure, storing the on-disk * block number for those buffers in the ""altpath"". */ path = &state->altpath; ASSERT((path->active >= 0) && (path->active < XFS_DA_NODE_MAXDEPTH)); for (blk = path->blk, level = 0; level < path->active; blk++, level++) { if (blk->bp) { blk->disk_blkno = XFS_BUF_ADDR(blk->bp); blk->bp = NULL; } else { blk->disk_blkno = 0; } } return 0; } ",0 "static bool nfsd4_is_deleg_cur(struct nfsd4_open *open) { return open->op_claim_type == NFS4_OPEN_CLAIM_DELEGATE_CUR || open->op_claim_type == NFS4_OPEN_CLAIM_DELEG_CUR_FH; } ",0 "static int unsupported_abort_control(int sub_api, struct usbi_transfer *itransfer) { PRINT_UNSUPPORTED_API(abort_control); } ",0 "void SVGImage::stopAnimation() { if (!m_page) return; LocalFrame* frame = m_page->mainFrame(); SVGSVGElement* rootElement = toSVGDocument(frame->document())->rootElement(); if (!rootElement) return; rootElement->pauseAnimations(); } ",0 "static void dump_map(log_t* log, const backtrace_map_t* map, bool fault_addr) { _LOG(log, logtype::MAPS, ""%s%"" PRIPTR ""-%"" PRIPTR "" %c%c%c %7"" PRIdPTR "" %s\n"", (fault_addr? ""--->"" : "" ""), map->start, map->end - 1, (map->flags & PROT_READ) ? 'r' : '-', (map->flags & PROT_WRITE) ? 'w' : '-', (map->flags & PROT_EXEC) ? 'x' : '-', (map->end - map->start), map->name.c_str()); } ",0 "TabContents* Browser::OpenApplication( Profile* profile, const Extension* extension, extension_misc::LaunchContainer container, WindowOpenDisposition disposition) { TabContents* tab = NULL; ExtensionPrefs* prefs = profile->GetExtensionService()->extension_prefs(); prefs->SetActiveBit(extension->id(), true); UMA_HISTOGRAM_ENUMERATION(""Extensions.AppLaunchContainer"", container, 100); switch (container) { case extension_misc::LAUNCH_WINDOW: case extension_misc::LAUNCH_PANEL: tab = Browser::OpenApplicationWindow(profile, extension, container, GURL(), NULL); break; case extension_misc::LAUNCH_TAB: { tab = Browser::OpenApplicationTab(profile, extension, disposition); break; } default: NOTREACHED(); break; } return tab; } ",0 "void PanelBrowserView::ClosePanel() { Close(); } ",0 "static int xfrm_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh, struct netlink_ext_ack *extack) { struct net *net = sock_net(skb->sk); struct nlattr *attrs[XFRMA_MAX+1]; const struct xfrm_link *link; int type, err; #ifdef CONFIG_COMPAT if (in_compat_syscall()) return -EOPNOTSUPP; #endif type = nlh->nlmsg_type; if (type > XFRM_MSG_MAX) return -EINVAL; type -= XFRM_MSG_BASE; link = &xfrm_dispatch[type]; /* All operations require privileges, even GET */ if (!netlink_net_capable(skb, CAP_NET_ADMIN)) return -EPERM; if ((type == (XFRM_MSG_GETSA - XFRM_MSG_BASE) || type == (XFRM_MSG_GETPOLICY - XFRM_MSG_BASE)) && (nlh->nlmsg_flags & NLM_F_DUMP)) { if (link->dump == NULL) return -EINVAL; { struct netlink_dump_control c = { .dump = link->dump, .done = link->done, }; return netlink_dump_start(net->xfrm.nlsk, skb, nlh, &c); } } err = nlmsg_parse(nlh, xfrm_msg_min[type], attrs, link->nla_max ? : XFRMA_MAX, link->nla_pol ? : xfrma_policy, extack); if (err < 0) return err; if (link->doit == NULL) return -EINVAL; return link->doit(skb, nlh, attrs); } ",1 "static Image *ReadPCDImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image; MagickBooleanType status; MagickOffsetType offset; MagickSizeType number_pixels; register ssize_t i, y; register PixelPacket *q; register unsigned char *c1, *c2, *yy; size_t height, number_images, rotate, scene, width; ssize_t count, x; unsigned char *chroma1, *chroma2, *header, *luma; unsigned int overview; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Determine if this a PCD file. */ header=(unsigned char *) AcquireQuantumMemory(0x800,3UL*sizeof(*header)); if (header == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); count=ReadBlob(image,3*0x800,header); overview=LocaleNCompare((char *) header,""PCD_OPA"",7) == 0; if ((count == 0) || ((LocaleNCompare((char *) header+0x800,""PCD"",3) != 0) && (overview == 0))) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); rotate=header[0x0e02] & 0x03; number_images=(header[10] << 8) | header[11]; if (number_images > 65535) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); header=(unsigned char *) RelinquishMagickMemory(header); /* Determine resolution by scene specification. */ if ((image->columns == 0) || (image->rows == 0)) scene=3; else { width=192; height=128; for (scene=1; scene < 6; scene++) { if ((width >= image->columns) && (height >= image->rows)) break; width<<=1; height<<=1; } } if (image_info->number_scenes != 0) scene=(size_t) MagickMin(image_info->scene,6); if (overview != 0) scene=1; /* Initialize image structure. */ width=192; height=128; for (i=1; i < (ssize_t) MagickMin(scene,3); i++) { width<<=1; height<<=1; } image->columns=width; image->rows=height; image->depth=8; for ( ; i < (ssize_t) scene; i++) { image->columns<<=1; image->rows<<=1; } /* Allocate luma and chroma memory. */ number_pixels=(MagickSizeType) image->columns*image->rows; if (number_pixels != (size_t) number_pixels) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); chroma1=(unsigned char *) AcquireQuantumMemory(image->columns+1UL,image->rows* sizeof(*chroma1)); chroma2=(unsigned char *) AcquireQuantumMemory(image->columns+1UL,image->rows* sizeof(*chroma2)); luma=(unsigned char *) AcquireQuantumMemory(image->columns+1UL,image->rows* sizeof(*luma)); if ((chroma1 == (unsigned char *) NULL) || (chroma2 == (unsigned char *) NULL) || (luma == (unsigned char *) NULL)) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); /* Advance to image data. */ offset=93; if (overview != 0) offset=2; else if (scene == 2) offset=20; else if (scene <= 1) offset=1; for (i=0; i < (ssize_t) (offset*0x800); i++) (void) ReadBlobByte(image); if (overview != 0) { Image *overview_image; MagickProgressMonitor progress_monitor; register ssize_t j; /* Read thumbnails from overview image. */ for (j=1; j <= (ssize_t) number_images; j++) { progress_monitor=SetImageProgressMonitor(image, (MagickProgressMonitor) NULL,image->client_data); (void) FormatLocaleString(image->filename,MaxTextExtent, ""images/img%04ld.pcd"",(long) j); (void) FormatLocaleString(image->magick_filename,MaxTextExtent, ""images/img%04ld.pcd"",(long) j); image->scene=(size_t) j; image->columns=width; image->rows=height; image->depth=8; yy=luma; c1=chroma1; c2=chroma2; for (y=0; y < (ssize_t) height; y+=2) { count=ReadBlob(image,width,yy); yy+=image->columns; count=ReadBlob(image,width,yy); yy+=image->columns; count=ReadBlob(image,width >> 1,c1); c1+=image->columns; count=ReadBlob(image,width >> 1,c2); c2+=image->columns; } Upsample(image->columns >> 1,image->rows >> 1,image->columns,chroma1); Upsample(image->columns >> 1,image->rows >> 1,image->columns,chroma2); /* Transfer luminance and chrominance channels. */ yy=luma; c1=chroma1; c2=chroma2; for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ScaleCharToQuantum(*yy++)); SetPixelGreen(q,ScaleCharToQuantum(*c1++)); SetPixelBlue(q,ScaleCharToQuantum(*c2++)); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } image->colorspace=YCCColorspace; if (LocaleCompare(image_info->magick,""PCDS"") == 0) SetImageColorspace(image,sRGBColorspace); if (j < (ssize_t) number_images) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { image=DestroyImageList(image); return((Image *) NULL); } image=SyncNextImageInList(image); } (void) SetImageProgressMonitor(image,progress_monitor, image->client_data); if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,j-1,number_images); if (status == MagickFalse) break; } } chroma2=(unsigned char *) RelinquishMagickMemory(chroma2); chroma1=(unsigned char *) RelinquishMagickMemory(chroma1); luma=(unsigned char *) RelinquishMagickMemory(luma); image=GetFirstImageInList(image); overview_image=OverviewImage(image_info,image,exception); return(overview_image); } /* Read interleaved image. */ yy=luma; c1=chroma1; c2=chroma2; for (y=0; y < (ssize_t) height; y+=2) { count=ReadBlob(image,width,yy); yy+=image->columns; count=ReadBlob(image,width,yy); yy+=image->columns; count=ReadBlob(image,width >> 1,c1); c1+=image->columns; count=ReadBlob(image,width >> 1,c2); c2+=image->columns; } if (scene >= 4) { /* Recover luminance deltas for 1536x1024 image. */ Upsample(768,512,image->columns,luma); Upsample(384,256,image->columns,chroma1); Upsample(384,256,image->columns,chroma2); image->rows=1024; for (i=0; i < (4*0x800); i++) (void) ReadBlobByte(image); status=DecodeImage(image,luma,chroma1,chroma2); if ((scene >= 5) && status) { /* Recover luminance deltas for 3072x2048 image. */ Upsample(1536,1024,image->columns,luma); Upsample(768,512,image->columns,chroma1); Upsample(768,512,image->columns,chroma2); image->rows=2048; offset=TellBlob(image)/0x800+12; offset=SeekBlob(image,offset*0x800,SEEK_SET); status=DecodeImage(image,luma,chroma1,chroma2); if ((scene >= 6) && (status != MagickFalse)) { /* Recover luminance deltas for 6144x4096 image (vaporware). */ Upsample(3072,2048,image->columns,luma); Upsample(1536,1024,image->columns,chroma1); Upsample(1536,1024,image->columns,chroma2); image->rows=4096; } } } Upsample(image->columns >> 1,image->rows >> 1,image->columns,chroma1); Upsample(image->columns >> 1,image->rows >> 1,image->columns,chroma2); /* Transfer luminance and chrominance channels. */ yy=luma; c1=chroma1; c2=chroma2; for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ScaleCharToQuantum(*yy++)); SetPixelGreen(q,ScaleCharToQuantum(*c1++)); SetPixelBlue(q,ScaleCharToQuantum(*c2++)); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if (image->previous == (Image *) NULL) { status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } } chroma2=(unsigned char *) RelinquishMagickMemory(chroma2); chroma1=(unsigned char *) RelinquishMagickMemory(chroma1); luma=(unsigned char *) RelinquishMagickMemory(luma); if (EOFBlob(image) != MagickFalse) ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); (void) CloseBlob(image); if (image_info->ping == MagickFalse) if ((rotate == 1) || (rotate == 3)) { double degrees; Image *rotate_image; /* Rotate image. */ degrees=rotate == 1 ? -90.0 : 90.0; rotate_image=RotateImage(image,degrees,exception); if (rotate_image != (Image *) NULL) { image=DestroyImage(image); image=rotate_image; } } /* Set CCIR 709 primaries with a D65 white point. */ image->chromaticity.red_primary.x=0.6400f; image->chromaticity.red_primary.y=0.3300f; image->chromaticity.green_primary.x=0.3000f; image->chromaticity.green_primary.y=0.6000f; image->chromaticity.blue_primary.x=0.1500f; image->chromaticity.blue_primary.y=0.0600f; image->chromaticity.white_point.x=0.3127f; image->chromaticity.white_point.y=0.3290f; image->gamma=1.000f/2.200f; image->colorspace=YCCColorspace; if (LocaleCompare(image_info->magick,""PCDS"") == 0) SetImageColorspace(image,sRGBColorspace); return(GetFirstImageInList(image)); } ",1 "void RenderBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset) { LayoutPoint adjustedPaintOffset = paintOffset + location(); PaintInfo childInfo(paintInfo); childInfo.updatePaintingRootForChildren(this); for (RenderObject* child = firstChild(); child; child = child->nextSibling()) child->paint(childInfo, adjustedPaintOffset); } ",0 "const GoogleServiceAuthError& ProfileSyncService::GetAuthError() const { return last_auth_error_; } ",0 "static bool extract_delimited_data( char const *input_buffer, int input_len, char const *begin_marker, char const *end_marker, MyString &output_buffer, MyString *error_msg) { int start = find_str_in_buffer(input_buffer,input_len,begin_marker); int end = find_str_in_buffer(input_buffer,input_len,end_marker); if( start < 0 ) { if( error_msg ) { error_msg->sprintf(""Failed to find '%s' in input: %.*s"", begin_marker,input_len,input_buffer); } return false; } start += strlen(begin_marker); if( end < 0 || end < start ) { if( error_msg ) { error_msg->sprintf(""Failed to find '%s' in input: %.*s"", end_marker,input_len,input_buffer); } return false; } output_buffer.sprintf(""%.*s"",end-start,input_buffer+start); return true; } ",0 " void BluetoothDeviceChromeOS::RejectPairing() { RunPairingCallbacks(REJECTED); } ",1 " ft_black_render( black_PRaster raster, const FT_Raster_Params* params ) { const FT_Outline* outline = (const FT_Outline*)params->source; const FT_Bitmap* target_map = params->target; black_PWorker worker; if ( !raster || !raster->buffer || !raster->buffer_size ) return FT_THROW( Not_Ini ); if ( !outline ) return FT_THROW( Invalid ); /* return immediately if the outline is empty */ if ( outline->n_points == 0 || outline->n_contours <= 0 ) return Raster_Err_None; if ( !outline->contours || !outline->points ) return FT_THROW( Invalid ); if ( outline->n_points != outline->contours[outline->n_contours - 1] + 1 ) return FT_THROW( Invalid ); worker = raster->worker; /* this version of the raster does not support direct rendering, sorry */ if ( params->flags & FT_RASTER_FLAG_DIRECT ) return FT_THROW( Unsupported ); if ( !target_map ) return FT_THROW( Invalid ); /* nothing to do */ if ( !target_map->width || !target_map->rows ) return Raster_Err_None; if ( !target_map->buffer ) return FT_THROW( Invalid ); ras.outline = *outline; ras.target = *target_map; worker->buff = (PLong) raster->buffer; worker->sizeBuff = worker->buff + raster->buffer_size / sizeof ( Long ); #ifdef FT_RASTER_OPTION_ANTI_ALIASING worker->grays = raster->grays; worker->gray_width = raster->gray_width; FT_MEM_ZERO( worker->gray_lines, worker->gray_width * 2 ); #endif return ( params->flags & FT_RASTER_FLAG_AA ) ? Render_Gray_Glyph( RAS_VAR ) : Render_Glyph( RAS_VAR ); } ",0 "int crypto_register_instance(struct crypto_template *tmpl, struct crypto_instance *inst) { struct crypto_larval *larval; int err; err = crypto_check_alg(&inst->alg); if (err) goto err; inst->alg.cra_module = tmpl->module; inst->alg.cra_flags |= CRYPTO_ALG_INSTANCE; down_write(&crypto_alg_sem); larval = __crypto_register_alg(&inst->alg); if (IS_ERR(larval)) goto unlock; hlist_add_head(&inst->list, &tmpl->instances); inst->tmpl = tmpl; unlock: up_write(&crypto_alg_sem); err = PTR_ERR(larval); if (IS_ERR(larval)) goto err; crypto_wait_for_test(larval); err = 0; err: return err; } ",0 "static int sctp_send_asconf(struct sctp_association *asoc, struct sctp_chunk *chunk) { int retval = 0; /* If there is an outstanding ASCONF chunk, queue it for later * transmission. */ if (asoc->addip_last_asconf) { list_add_tail(&chunk->list, &asoc->addip_chunk_list); goto out; } /* Hold the chunk until an ASCONF_ACK is received. */ sctp_chunk_hold(chunk); retval = sctp_primitive_ASCONF(asoc, chunk); if (retval) sctp_chunk_free(chunk); else asoc->addip_last_asconf = chunk; out: return retval; } ",0 "static struct sk_buff **ipv6_gro_receive(struct sk_buff **head, struct sk_buff *skb) { const struct net_offload *ops; struct sk_buff **pp = NULL; struct sk_buff *p; struct ipv6hdr *iph; unsigned int nlen; unsigned int hlen; unsigned int off; u16 flush = 1; int proto; off = skb_gro_offset(skb); hlen = off + sizeof(*iph); iph = skb_gro_header_fast(skb, off); if (skb_gro_header_hard(skb, hlen)) { iph = skb_gro_header_slow(skb, hlen, off); if (unlikely(!iph)) goto out; } skb_set_network_header(skb, off); skb_gro_pull(skb, sizeof(*iph)); skb_set_transport_header(skb, skb_gro_offset(skb)); flush += ntohs(iph->payload_len) != skb_gro_len(skb); rcu_read_lock(); proto = iph->nexthdr; ops = rcu_dereference(inet6_offloads[proto]); if (!ops || !ops->callbacks.gro_receive) { __pskb_pull(skb, skb_gro_offset(skb)); skb_gro_frag0_invalidate(skb); proto = ipv6_gso_pull_exthdrs(skb, proto); skb_gro_pull(skb, -skb_transport_offset(skb)); skb_reset_transport_header(skb); __skb_push(skb, skb_gro_offset(skb)); ops = rcu_dereference(inet6_offloads[proto]); if (!ops || !ops->callbacks.gro_receive) goto out_unlock; iph = ipv6_hdr(skb); } NAPI_GRO_CB(skb)->proto = proto; flush--; nlen = skb_network_header_len(skb); for (p = *head; p; p = p->next) { const struct ipv6hdr *iph2; __be32 first_word; /* */ if (!NAPI_GRO_CB(p)->same_flow) continue; iph2 = (struct ipv6hdr *)(p->data + off); first_word = *(__be32 *)iph ^ *(__be32 *)iph2; /* All fields must match except length and Traffic Class. * XXX skbs on the gro_list have all been parsed and pulled * already so we don't need to compare nlen * (nlen != (sizeof(*iph2) + ipv6_exthdrs_len(iph2, &ops))) * memcmp() alone below is suffcient, right? */ if ((first_word & htonl(0xF00FFFFF)) || memcmp(&iph->nexthdr, &iph2->nexthdr, nlen - offsetof(struct ipv6hdr, nexthdr))) { NAPI_GRO_CB(p)->same_flow = 0; continue; } /* flush if Traffic Class fields are different */ NAPI_GRO_CB(p)->flush |= !!(first_word & htonl(0x0FF00000)); NAPI_GRO_CB(p)->flush |= flush; /* If the previous IP ID value was based on an atomic * datagram we can overwrite the value and ignore it. */ if (NAPI_GRO_CB(skb)->is_atomic) NAPI_GRO_CB(p)->flush_id = 0; } NAPI_GRO_CB(skb)->is_atomic = true; NAPI_GRO_CB(skb)->flush |= flush; skb_gro_postpull_rcsum(skb, iph, nlen); pp = call_gro_receive(ops->callbacks.gro_receive, head, skb); out_unlock: rcu_read_unlock(); out: skb_gro_flush_final(skb, pp, flush); return pp; } ",0 " virtual ~TestInterstitialPage() { } ",0 "selaExtendArray(SELA *sela) { PROCNAME(""selaExtendArray""); if (!sela) return ERROR_INT(""sela not defined"", procName, 1); if ((sela->sel = (SEL **)reallocNew((void **)&sela->sel, sizeof(SEL *) * sela->nalloc, 2 * sizeof(SEL *) * sela->nalloc)) == NULL) return ERROR_INT(""new ptr array not returned"", procName, 1); sela->nalloc = 2 * sela->nalloc; return 0; } ",0 "WebMediaPlayer* RenderView::createMediaPlayer( WebFrame* frame, WebMediaPlayerClient* client) { scoped_refptr factory = new media::FilterFactoryCollection(); const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); if (!cmd_line->HasSwitch(switches::kDisableAudio)) { factory->AddFactory( AudioRendererImpl::CreateFactory(audio_message_filter())); } if (cmd_line->HasSwitch(switches::kEnableAcceleratedDecoding) && cmd_line->HasSwitch(switches::kEnableAcceleratedCompositing)) { factory->AddFactory( media::IpcVideoDecoder::CreateFactory(MessageLoop::current())); } WebApplicationCacheHostImpl* appcache_host = WebApplicationCacheHostImpl::FromFrame(frame); webkit_glue::MediaResourceLoaderBridgeFactory* bridge_factory = new webkit_glue::MediaResourceLoaderBridgeFactory( GURL(), // referrer ""null"", // frame origin ""null"", // main_frame_origin base::GetCurrentProcId(), appcache_host ? appcache_host->host_id() : appcache::kNoHostId, routing_id()); media::FilterFactory* simple_data_source_factory = webkit_glue::SimpleDataSource::CreateFactory(MessageLoop::current(), bridge_factory); media::FilterFactory* buffered_data_source_factory = webkit_glue::BufferedDataSource::CreateFactory(MessageLoop::current(), bridge_factory); if (cmd_line->HasSwitch(switches::kSimpleDataSource)) { factory->AddFactory(simple_data_source_factory); factory->AddFactory(buffered_data_source_factory); } else { factory->AddFactory(buffered_data_source_factory); factory->AddFactory(simple_data_source_factory); } webkit_glue::WebVideoRendererFactoryFactory* factory_factory = NULL; if (cmd_line->HasSwitch(switches::kEnableVideoLayering)) { factory_factory = new IPCVideoRenderer::FactoryFactory(routing_id_); } else { bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); factory_factory = new webkit_glue::VideoRendererImpl::FactoryFactory(pts_logging); } return new webkit_glue::WebMediaPlayerImpl(client, factory, factory_factory); } ",0 "static void create_tls_key() { (void)pthread_key_create(&key, destroy_tls_key); } ",0 "GF_Box *paen_New() { ISOM_DECL_BOX_ALLOC(FDPartitionEntryBox, GF_ISOM_BOX_TYPE_PAEN); return (GF_Box *)tmp; } ",0 "cmsBool WriteOneElem(cmsIOHANDLER* io, _cmsDICelem* e, cmsUInt32Number i) { if (!_cmsWriteUInt32Number(io, e->Offsets[i])) return FALSE; if (!_cmsWriteUInt32Number(io, e ->Sizes[i])) return FALSE; return TRUE; } ",0 "void ResourceDispatcherHost::SetRequestInfo( URLRequest* request, ResourceDispatcherHostRequestInfo* info) { request->SetUserData(NULL, info); } ",0 "static void nfs4_open_prepare(struct rpc_task *task, void *calldata) { struct nfs4_opendata *data = calldata; struct nfs4_state_owner *sp = data->owner; if (nfs_wait_on_sequence(data->o_arg.seqid, task) != 0) return; /* * Check if we still need to send an OPEN call, or if we can use * a delegation instead. */ if (data->state != NULL) { struct nfs_delegation *delegation; if (can_open_cached(data->state, data->o_arg.fmode, data->o_arg.open_flags)) goto out_no_action; rcu_read_lock(); delegation = rcu_dereference(NFS_I(data->state->inode)->delegation); if (data->o_arg.claim != NFS4_OPEN_CLAIM_DELEGATE_CUR && can_open_delegated(delegation, data->o_arg.fmode)) goto unlock_no_action; rcu_read_unlock(); } /* Update client id. */ data->o_arg.clientid = sp->so_server->nfs_client->cl_clientid; if (data->o_arg.claim == NFS4_OPEN_CLAIM_PREVIOUS) { task->tk_msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_NOATTR]; data->o_arg.open_bitmap = &nfs4_open_noattr_bitmap[0]; nfs_copy_fh(&data->o_res.fh, data->o_arg.fh); } data->timestamp = jiffies; if (nfs4_setup_sequence(data->o_arg.server, &data->o_arg.seq_args, &data->o_res.seq_res, task) != 0) nfs_release_seqid(data->o_arg.seqid); else rpc_call_start(task); return; unlock_no_action: rcu_read_unlock(); out_no_action: task->tk_action = NULL; } ",0 "static void mem_cgroup_drain_pcp_counter(struct mem_cgroup *memcg, int cpu) { int i; spin_lock(&memcg->pcp_counter_lock); for (i = 0; i < MEM_CGROUP_STAT_DATA; i++) { long x = per_cpu(memcg->stat->count[i], cpu); per_cpu(memcg->stat->count[i], cpu) = 0; memcg->nocpu_base.count[i] += x; } for (i = 0; i < MEM_CGROUP_EVENTS_NSTATS; i++) { unsigned long x = per_cpu(memcg->stat->events[i], cpu); per_cpu(memcg->stat->events[i], cpu) = 0; memcg->nocpu_base.events[i] += x; } /* need to clear ON_MOVE value, works as a kind of lock. */ per_cpu(memcg->stat->count[MEM_CGROUP_ON_MOVE], cpu) = 0; spin_unlock(&memcg->pcp_counter_lock); } ",0 "static void nlmsvc_freegrantargs(struct nlm_rqst *call) { if (call->a_args.lock.oh.data != call->a_owner) kfree(call->a_args.lock.oh.data); locks_release_private(&call->a_args.lock.fl); } ",0 "bool ShouldNavigateForward(const NavigationController& controller, OverscrollMode mode) { return mode == (base::i18n::IsRTL() ? OVERSCROLL_EAST : OVERSCROLL_WEST) && controller.CanGoForward(); } ",0 "static int ecc_check_privkey_gen_helper(ecc_key* key) { int err; #ifndef WOLFSSL_ATECC508A DECLARE_CURVE_SPECS(2) #endif if (key == NULL) return BAD_FUNC_ARG; #ifdef WOLFSSL_ATECC508A /* TODO: Implement equiv call to ATECC508A */ err = BAD_COND_E; #else /* load curve info */ err = wc_ecc_curve_load(key->dp, &curve, (ECC_CURVE_FIELD_PRIME | ECC_CURVE_FIELD_AF)); if (err == MP_OKAY) err = ecc_check_privkey_gen(key, curve->Af, curve->prime); wc_ecc_curve_free(curve); #endif /* WOLFSSL_ATECC508A */ return err; } ",0 "xfs_get_blocks( struct inode *inode, sector_t iblock, struct buffer_head *bh_result, int create) { return __xfs_get_blocks(inode, iblock, bh_result, create, false, false); } ",0 "static void voidMethodTestCallbackInterfaceArgMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::voidMethodTestCallbackInterfaceArgMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "static void arrayBufferMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::arrayBufferMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void GDataEntry::FromProto(const GDataEntryProto& proto) { ConvertProtoToPlatformFileInfo(proto.file_info(), &file_info_); title_ = proto.title(); resource_id_ = proto.resource_id(); parent_resource_id_ = proto.parent_resource_id(); edit_url_ = GURL(proto.edit_url()); content_url_ = GURL(proto.content_url()); SetFileNameFromTitle(); } ",0 " void RenderProcessHostImpl::RegisterProcessHostForSite( BrowserContext* browser_context, RenderProcessHost* process, const GURL& url) { SiteProcessMap* map = GetSiteProcessMapForBrowserContext(browser_context); std::string site = SiteInstance::GetSiteForURL(browser_context, url) .possibly_invalid_spec(); map->RegisterProcess(site, process); } ",1 " Read(media::mojom::VideoCaptureParamsDataView data, media::VideoCaptureParams* out) { if (!data.ReadRequestedFormat(&out->requested_format)) return false; if (!data.ReadBufferType(&out->buffer_type)) return false; if (!data.ReadResolutionChangePolicy(&out->resolution_change_policy)) return false; if (!data.ReadPowerLineFrequency(&out->power_line_frequency)) return false; return true; } ",0 "void ip_mc_rejoin_groups(struct in_device *in_dev) { #ifdef CONFIG_IP_MULTICAST struct ip_mc_list *im; int type; for_each_pmc_rcu(in_dev, im) { if (im->multiaddr == IGMP_ALL_HOSTS) continue; /* a failover is happening and switches * must be notified immediately */ if (IGMP_V1_SEEN(in_dev)) type = IGMP_HOST_MEMBERSHIP_REPORT; else if (IGMP_V2_SEEN(in_dev)) type = IGMPV2_HOST_MEMBERSHIP_REPORT; else type = IGMPV3_HOST_MEMBERSHIP_REPORT; igmp_send_report(in_dev, im, type); } #endif } ",0 "static void __exit comedi_cleanup(void) { int i; comedi_cleanup_legacy_minors(); for (i = 0; i < COMEDI_NUM_MINORS; ++i) BUG_ON(comedi_file_info_table[i]); class_destroy(comedi_class); cdev_del(&comedi_cdev); unregister_chrdev_region(MKDEV(COMEDI_MAJOR, 0), COMEDI_NUM_MINORS); comedi_proc_cleanup(); } ",0 "u64 btrfs_get_tree_mod_seq(struct btrfs_fs_info *fs_info, struct seq_list *elem) { tree_mod_log_write_lock(fs_info); spin_lock(&fs_info->tree_mod_seq_lock); if (!elem->seq) { elem->seq = btrfs_inc_tree_mod_seq(fs_info); list_add_tail(&elem->list, &fs_info->tree_mod_seq_list); } spin_unlock(&fs_info->tree_mod_seq_lock); tree_mod_log_write_unlock(fs_info); return elem->seq; } ",0 "bool ContentSecurityPolicy::AllowPrefetchFromSource( const KURL& url, RedirectStatus redirect_status, SecurityViolationReportingPolicy reporting_policy, CheckHeaderType check_header_type) const { if (ShouldBypassContentSecurityPolicy(url, execution_context_)) return true; bool is_allowed = true; for (const auto& policy : policies_) { if (!CheckHeaderTypeMatches(check_header_type, policy->HeaderType())) continue; is_allowed &= policy->AllowPrefetchFromSource(url, redirect_status, reporting_policy); } return is_allowed; } ",0 "const char *netdev_drivername(const struct net_device *dev) { const struct device_driver *driver; const struct device *parent; const char *empty = """"; parent = dev->dev.parent; if (!parent) return empty; driver = parent->driver; if (driver && driver->name) return driver->name; return empty; } ",0 "ProcGetInputFocus(ClientPtr client) { DeviceIntPtr kbd = PickKeyboard(client); xGetInputFocusReply rep; FocusClassPtr focus = kbd->focus; int rc; /* REQUEST(xReq); */ REQUEST_SIZE_MATCH(xReq); rc = XaceHook(XACE_DEVICE_ACCESS, client, kbd, DixGetFocusAccess); if (rc != Success) return rc; rep = (xGetInputFocusReply) { .type = X_Reply, .length = 0, .sequenceNumber = client->sequence, .revertTo = focus->revert }; if (focus->win == NoneWin) rep.focus = None; else if (focus->win == PointerRootWin) rep.focus = PointerRoot; else rep.focus = focus->win->drawable.id; WriteReplyToClient(client, sizeof(xGetInputFocusReply), &rep); return Success; } ",0 "int ecryptfs_encrypt_and_encode_filename( char **encoded_name, size_t *encoded_name_size, struct ecryptfs_crypt_stat *crypt_stat, struct ecryptfs_mount_crypt_stat *mount_crypt_stat, const char *name, size_t name_size) { size_t encoded_name_no_prefix_size; int rc = 0; (*encoded_name) = NULL; (*encoded_name_size) = 0; if ((crypt_stat && (crypt_stat->flags & ECRYPTFS_ENCRYPT_FILENAMES)) || (mount_crypt_stat && (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCRYPT_FILENAMES))) { struct ecryptfs_filename *filename; filename = kzalloc(sizeof(*filename), GFP_KERNEL); if (!filename) { printk(KERN_ERR ""%s: Out of memory whilst attempting "" ""to kzalloc [%zd] bytes\n"", __func__, sizeof(*filename)); rc = -ENOMEM; goto out; } filename->filename = (char *)name; filename->filename_size = name_size; rc = ecryptfs_encrypt_filename(filename, crypt_stat, mount_crypt_stat); if (rc) { printk(KERN_ERR ""%s: Error attempting to encrypt "" ""filename; rc = [%d]\n"", __func__, rc); kfree(filename); goto out; } ecryptfs_encode_for_filename( NULL, &encoded_name_no_prefix_size, filename->encrypted_filename, filename->encrypted_filename_size); if ((crypt_stat && (crypt_stat->flags & ECRYPTFS_ENCFN_USE_MOUNT_FNEK)) || (mount_crypt_stat && (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK))) (*encoded_name_size) = (ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE + encoded_name_no_prefix_size); else (*encoded_name_size) = (ECRYPTFS_FEK_ENCRYPTED_FILENAME_PREFIX_SIZE + encoded_name_no_prefix_size); (*encoded_name) = kmalloc((*encoded_name_size) + 1, GFP_KERNEL); if (!(*encoded_name)) { printk(KERN_ERR ""%s: Out of memory whilst attempting "" ""to kzalloc [%zd] bytes\n"", __func__, (*encoded_name_size)); rc = -ENOMEM; kfree(filename->encrypted_filename); kfree(filename); goto out; } if ((crypt_stat && (crypt_stat->flags & ECRYPTFS_ENCFN_USE_MOUNT_FNEK)) || (mount_crypt_stat && (mount_crypt_stat->flags & ECRYPTFS_GLOBAL_ENCFN_USE_MOUNT_FNEK))) { memcpy((*encoded_name), ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX, ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE); ecryptfs_encode_for_filename( ((*encoded_name) + ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE), &encoded_name_no_prefix_size, filename->encrypted_filename, filename->encrypted_filename_size); (*encoded_name_size) = (ECRYPTFS_FNEK_ENCRYPTED_FILENAME_PREFIX_SIZE + encoded_name_no_prefix_size); (*encoded_name)[(*encoded_name_size)] = '\0'; } else { rc = -EOPNOTSUPP; } if (rc) { printk(KERN_ERR ""%s: Error attempting to encode "" ""encrypted filename; rc = [%d]\n"", __func__, rc); kfree((*encoded_name)); (*encoded_name) = NULL; (*encoded_name_size) = 0; } kfree(filename->encrypted_filename); kfree(filename); } else { rc = ecryptfs_copy_filename(encoded_name, encoded_name_size, name, name_size); } out: return rc; } ",0 "ModuleExport void UnregisterMAPImage(void) { (void) UnregisterMagickInfo(""MAP""); } ",0 "static void __rpc_add_wait_queue(struct rpc_wait_queue *queue, struct rpc_task *task) { BUG_ON (RPC_IS_QUEUED(task)); if (RPC_IS_PRIORITY(queue)) __rpc_add_wait_queue_priority(queue, task); else if (RPC_IS_SWAPPER(task)) list_add(&task->u.tk_wait.list, &queue->tasks[0]); else list_add_tail(&task->u.tk_wait.list, &queue->tasks[0]); task->tk_waitqueue = queue; queue->qlen++; rpc_set_queued(task); dprintk(""RPC: %5u added to queue %p \""%s\""\n"", task->tk_pid, queue, rpc_qname(queue)); } ",0 "void DevToolsWindow::RunFileChooser(content::WebContents* web_contents, const content::FileChooserParams& params) { FileSelectHelper::RunFileChooser(web_contents, params); } ",0 "void DownloadItemImpl::OpenDownload() { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); if (IsPartialDownload()) { if (!IsTemporary()) open_when_complete_ = !open_when_complete_; return; } if (!IsComplete() || file_externally_removed_) return; delegate_->CheckForFileRemoval(this); download_stats::RecordOpen(GetEndTime(), !GetOpened()); opened_ = true; FOR_EACH_OBSERVER(Observer, observers_, OnDownloadOpened(this)); delegate_->DownloadOpened(this); if (!open_enabled_) return; content::GetContentClient()->browser()->OpenItem(GetFullPath()); } ",0 "void Document::WillChangeFrameOwnerProperties(int margin_width, int margin_height, ScrollbarMode scrolling_mode, bool is_display_none) { DCHECK(GetFrame() && GetFrame()->Owner()); FrameOwner* owner = GetFrame()->Owner(); if (RuntimeEnabledFeatures::DisplayNoneIFrameCreatesNoLayoutObjectEnabled()) { if (documentElement()) { if (is_display_none != owner->IsDisplayNone()) documentElement()->LazyReattachIfAttached(); } } if (margin_width != owner->MarginWidth()) { if (auto* body_element = body()) { body_element->SetIntegralAttribute(marginwidthAttr, margin_width); } } if (margin_height != owner->MarginHeight()) { if (auto* body_element = body()) { body_element->SetIntegralAttribute(marginheightAttr, margin_height); } } if (scrolling_mode != owner->ScrollingMode() && View()) { View()->SetNeedsLayout(); } } ",0 "static void logConsoleError(ScriptExecutionContext* context, const String& message) { if (!context) return; context->addConsoleMessage(JSMessageSource, ErrorMessageLevel, message); } ",0 "WebKitTestResultPrinter::~WebKitTestResultPrinter() { } ",0 "xfs_attr_shortform_getvalue(xfs_da_args_t *args) { xfs_attr_shortform_t *sf; xfs_attr_sf_entry_t *sfe; int i; ASSERT(args->dp->i_afp->if_flags == XFS_IFINLINE); sf = (xfs_attr_shortform_t *)args->dp->i_afp->if_u1.if_data; sfe = &sf->list[0]; for (i = 0; i < sf->hdr.count; sfe = XFS_ATTR_SF_NEXTENTRY(sfe), i++) { if (sfe->namelen != args->namelen) continue; if (memcmp(args->name, sfe->nameval, args->namelen) != 0) continue; if (!xfs_attr_namesp_match(args->flags, sfe->flags)) continue; if (args->flags & ATTR_KERNOVAL) { args->valuelen = sfe->valuelen; return(XFS_ERROR(EEXIST)); } if (args->valuelen < sfe->valuelen) { args->valuelen = sfe->valuelen; return(XFS_ERROR(ERANGE)); } args->valuelen = sfe->valuelen; memcpy(args->value, &sfe->nameval[args->namelen], args->valuelen); return(XFS_ERROR(EEXIST)); } return(XFS_ERROR(ENOATTR)); } ",0 "void ArthurOutputDev::updateFlatness(GfxState *state) { } ",0 "static inline void x86_assign_hw_event(struct perf_event *event, struct cpu_hw_events *cpuc, int i) { struct hw_perf_event *hwc = &event->hw; hwc->idx = cpuc->assign[i]; hwc->last_cpu = smp_processor_id(); hwc->last_tag = ++cpuc->tags[i]; if (hwc->idx == X86_PMC_IDX_FIXED_BTS) { hwc->config_base = 0; hwc->event_base = 0; } else if (hwc->idx >= X86_PMC_IDX_FIXED) { hwc->config_base = MSR_ARCH_PERFMON_FIXED_CTR_CTRL; hwc->event_base = MSR_ARCH_PERFMON_FIXED_CTR0 + (hwc->idx - X86_PMC_IDX_FIXED); } else { hwc->config_base = x86_pmu_config_addr(hwc->idx); hwc->event_base = x86_pmu_event_addr(hwc->idx); } } ",0 "static void le_test_mode(bt_status_t status, uint16_t packet_count) { bdt_log(""LE TEST MODE END status:%s number_of_packets:%d"", dump_bt_status(status), packet_count); } ",0 "box_ge(PG_FUNCTION_ARGS) { BOX *box1 = PG_GETARG_BOX_P(0); BOX *box2 = PG_GETARG_BOX_P(1); PG_RETURN_BOOL(FPge(box_ar(box1), box_ar(box2))); } ",0 "int __sys_listen(int fd, int backlog) { struct socket *sock; int err, fput_needed; int somaxconn; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (sock) { somaxconn = sock_net(sock->sk)->core.sysctl_somaxconn; if ((unsigned int)backlog > somaxconn) backlog = somaxconn; err = security_socket_listen(sock, backlog); if (!err) err = sock->ops->listen(sock, backlog); fput_light(sock->file, fput_needed); } return err; } ",0 "int __kvm_arm_vcpu_set_events(struct kvm_vcpu *vcpu, struct kvm_vcpu_events *events) { bool serror_pending = events->exception.serror_pending; bool has_esr = events->exception.serror_has_esr; if (serror_pending && has_esr) { if (!cpus_have_const_cap(ARM64_HAS_RAS_EXTN)) return -EINVAL; if (!((events->exception.serror_esr) & ~ESR_ELx_ISS_MASK)) kvm_set_sei_esr(vcpu, events->exception.serror_esr); else return -EINVAL; } else if (serror_pending) { kvm_inject_vabt(vcpu); } return 0; } ",0 "dissect_spare_extension_and_crc(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, guint8 dch_crc_present, int offset, guint header_length) { int crc_size = 0; int remain = tvb_captured_length_remaining(tvb, offset); /* Payload CRC (optional) */ if ((dch_crc_present == 1) || ((dch_crc_present == 2) && (remain >= 2))) { crc_size = 2; } if (remain > crc_size) { proto_item *ti; ti = proto_tree_add_item(tree, hf_fp_spare_extension, tvb, offset, remain-crc_size, ENC_NA); proto_item_append_text(ti, "" (%u octets)"", remain-crc_size); expert_add_info_format(pinfo, ti, &ei_fp_spare_extension, ""Spare Extension present (%u bytes)"", remain-crc_size); offset += remain-crc_size; } if (crc_size) { proto_item * pi = proto_tree_add_item(tree, hf_fp_payload_crc, tvb, offset, crc_size, ENC_BIG_ENDIAN); if (preferences_payload_checksum) { guint16 calc_crc, read_crc; guint8 * data = (guint8 *)tvb_memdup(wmem_packet_scope(), tvb, header_length, offset-header_length); calc_crc = crc16_8005_noreflect_noxor(data, offset-header_length); read_crc = tvb_get_bits16(tvb, offset*8, 16, ENC_BIG_ENDIAN); if (calc_crc == read_crc) { proto_item_append_text(pi, "" [correct]""); } else { proto_item_append_text(pi, "" [incorrect, should be 0x%x]"", calc_crc); expert_add_info(pinfo, pi, &ei_fp_bad_payload_checksum); } } } } ",0 " void NetworkHandler::SetCookie(const std::string& name, const std::string& value, Maybe url, Maybe domain, Maybe path, Maybe secure, Maybe http_only, Maybe same_site, Maybe expires, std::unique_ptr callback) { if (!process_) { callback->sendFailure(Response::InternalError()); return; } if (!url.isJust() && !domain.isJust()) { callback->sendFailure(Response::InvalidParams( ""At least one of the url and domain needs to be specified"")); } BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::BindOnce( &SetCookieOnIO, base::Unretained( process_->GetStoragePartition()->GetURLRequestContext()), name, value, url.fromMaybe(""""), domain.fromMaybe(""""), path.fromMaybe(""""), secure.fromMaybe(false), http_only.fromMaybe(false), same_site.fromMaybe(""""), expires.fromMaybe(-1), base::BindOnce(&CookieSetOnIO, std::move(callback)))); } ",1 "V0CustomElementRegistrationContext* DocumentInit::RegistrationContext( Document* document) const { if (!document->IsHTMLDocument() && !document->IsXHTMLDocument()) return nullptr; if (create_new_registration_context_) return V0CustomElementRegistrationContext::Create(); return registration_context_.Get(); } ",0 "CronTab::CronTab( int minutes, int hours, int days_of_month, int months, int days_of_week ) { if ( minutes == CRONTAB_CRONOS_STAR ) { this->parameters[CRONTAB_MINUTES_IDX] = new MyString( CRONTAB_WILDCARD ); } else { this->parameters[CRONTAB_MINUTES_IDX] = new MyString( minutes ); } if ( hours == CRONTAB_CRONOS_STAR ) { this->parameters[CRONTAB_HOURS_IDX] = new MyString( CRONTAB_WILDCARD ); } else { this->parameters[CRONTAB_HOURS_IDX] = new MyString( hours ); } if ( days_of_month == CRONTAB_CRONOS_STAR ) { this->parameters[CRONTAB_DOM_IDX] = new MyString( CRONTAB_WILDCARD ); } else { this->parameters[CRONTAB_DOM_IDX] = new MyString( days_of_month ); } if ( months == CRONTAB_CRONOS_STAR ) { this->parameters[CRONTAB_MONTHS_IDX] = new MyString( CRONTAB_WILDCARD ); } else { this->parameters[CRONTAB_MONTHS_IDX] = new MyString( months ); } if ( days_of_week == CRONTAB_CRONOS_STAR ) { this->parameters[CRONTAB_DOW_IDX] = new MyString( CRONTAB_WILDCARD ); } else { this->parameters[CRONTAB_DOW_IDX] = new MyString( days_of_week ); } this->init(); } ",0 "StoragePartitionImpl::GetMediaURLRequestContext() { if (base::FeatureList::IsEnabled(network::features::kNetworkService)) NOTREACHED(); return media_url_request_context_.get(); } ",0 "void update_rq_clock(struct rq *rq) { s64 delta; lockdep_assert_held(&rq->lock); if (rq->clock_skip_update & RQCF_ACT_SKIP) return; delta = sched_clock_cpu(cpu_of(rq)) - rq->clock; if (delta < 0) return; rq->clock += delta; update_rq_clock_task(rq, delta); } ",0 "prefix_is_simple(const char *pstr) { int i; char c; for (i = 0; (c = pstr[i]) != 0; i++) { if (!(c == '-' || c == '_' || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z'))) return false; } return true; } ",0 "void qcow2_refcount_close(BlockDriverState *bs) { BDRVQcowState *s = bs->opaque; g_free(s->refcount_table); } ",0 "static inline void handle_one(const struct inode *inode) { #ifdef CONFIG_AUDIT_TREE struct audit_context *context; struct audit_tree_refs *p; struct audit_chunk *chunk; int count; if (likely(hlist_empty(&inode->i_fsnotify_marks))) return; context = current->audit_context; p = context->trees; count = context->tree_count; rcu_read_lock(); chunk = audit_tree_lookup(inode); rcu_read_unlock(); if (!chunk) return; if (likely(put_tree_ref(context, chunk))) return; if (unlikely(!grow_tree_refs(context))) { pr_warn(""out of memory, audit has lost a tree reference\n""); audit_set_auditable(context); audit_put_chunk(chunk); unroll_tree_refs(context, p, count); return; } put_tree_ref(context, chunk); #endif } ",0 "struct fib_table *fib_get_table(struct net *net, u32 id) { struct fib_table *tb; struct hlist_head *head; unsigned int h; if (id == 0) id = RT_TABLE_MAIN; h = id & (FIB_TABLE_HASHSZ - 1); head = &net->ipv4.fib_table_hash[h]; hlist_for_each_entry_rcu(tb, head, tb_hlist) { if (tb->tb_id == id) return tb; } return NULL; } ",0 "int RenderFrameHostManager::CreateRenderFrameProxy(SiteInstance* instance) { CHECK(instance); CHECK_NE(instance, render_frame_host_->GetSiteInstance()); RenderFrameProxyHost* proxy = GetRenderFrameProxyHost(instance); if (proxy && proxy->is_render_frame_proxy_live()) return proxy->GetRoutingID(); RenderViewHostImpl* render_view_host = frame_tree_node_->frame_tree()->GetRenderViewHost(instance); if (!proxy) { if (!render_view_host) { CHECK(frame_tree_node_->IsMainFrame()); render_view_host = frame_tree_node_->frame_tree()->CreateRenderViewHost( instance, MSG_ROUTING_NONE, MSG_ROUTING_NONE, MSG_ROUTING_NONE, true, true); } proxy = CreateRenderFrameProxyHost(instance, render_view_host); } if (frame_tree_node_->IsMainFrame() && render_view_host) { InitRenderView(render_view_host, proxy); } else { proxy->InitRenderFrameProxy(); } return proxy->GetRoutingID(); } ",0 "static int rfcomm_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_len) { struct sockaddr_rc *sa = (struct sockaddr_rc *) addr; struct sock *sk = sock->sk; int err = 0; BT_DBG(""sk %p %pMR"", sk, &sa->rc_bdaddr); if (!addr || addr->sa_family != AF_BLUETOOTH) return -EINVAL; lock_sock(sk); if (sk->sk_state != BT_OPEN) { err = -EBADFD; goto done; } if (sk->sk_type != SOCK_STREAM) { err = -EINVAL; goto done; } write_lock(&rfcomm_sk_list.lock); if (sa->rc_channel && __rfcomm_get_sock_by_addr(sa->rc_channel, &sa->rc_bdaddr)) { err = -EADDRINUSE; } else { /* Save source address */ bacpy(&bt_sk(sk)->src, &sa->rc_bdaddr); rfcomm_pi(sk)->channel = sa->rc_channel; sk->sk_state = BT_BOUND; } write_unlock(&rfcomm_sk_list.lock); done: release_sock(sk); return err; } ",0 "static VncJobQueue *vnc_queue_init(void) { VncJobQueue *queue = g_malloc0(sizeof(VncJobQueue)); qemu_cond_init(&queue->cond); qemu_mutex_init(&queue->mutex); QTAILQ_INIT(&queue->jobs); return queue; } ",0 "void ProfileSyncService::ActivateDataType( syncable::ModelType type, browser_sync::ModelSafeGroup group, ChangeProcessor* change_processor) { if (!backend_.get()) { NOTREACHED(); return; } DCHECK(backend_initialized_); backend_->ActivateDataType(type, group, change_processor); } ",0 "add_ppi_field_header(tvbuff_t *tvb, proto_tree *tree, int *offset) { ptvcursor_t *csr; csr = ptvcursor_new(tree, tvb, *offset); ptvcursor_add(csr, hf_ppi_field_type, 2, ENC_LITTLE_ENDIAN); ptvcursor_add(csr, hf_ppi_field_len, 2, ENC_LITTLE_ENDIAN); ptvcursor_free(csr); *offset=ptvcursor_current_offset(csr); } ",0 "static int mov_read_elst(MOVContext *c, AVIOContext *pb, MOVAtom atom) { MOVStreamContext *sc; int i, edit_count, version; if (c->fc->nb_streams < 1 || c->ignore_editlist) return 0; sc = c->fc->streams[c->fc->nb_streams-1]->priv_data; version = avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ edit_count = avio_rb32(pb); /* entries */ if (!edit_count) return 0; if (sc->elst_data) av_log(c->fc, AV_LOG_WARNING, ""Duplicated ELST atom\n""); av_free(sc->elst_data); sc->elst_count = 0; sc->elst_data = av_malloc_array(edit_count, sizeof(*sc->elst_data)); if (!sc->elst_data) return AVERROR(ENOMEM); av_log(c->fc, AV_LOG_TRACE, ""track[%u].edit_count = %i\n"", c->fc->nb_streams - 1, edit_count); for (i = 0; i < edit_count && !pb->eof_reached; i++) { MOVElst *e = &sc->elst_data[i]; if (version == 1) { e->duration = avio_rb64(pb); e->time = avio_rb64(pb); } else { e->duration = avio_rb32(pb); /* segment duration */ e->time = (int32_t)avio_rb32(pb); /* media time */ } e->rate = avio_rb32(pb) / 65536.0; av_log(c->fc, AV_LOG_TRACE, ""duration=%""PRId64"" time=%""PRId64"" rate=%f\n"", e->duration, e->time, e->rate); if (e->time < 0 && e->time != -1 && c->fc->strict_std_compliance >= FF_COMPLIANCE_STRICT) { av_log(c->fc, AV_LOG_ERROR, ""Track %d, edit %d: Invalid edit list media time=%""PRId64""\n"", c->fc->nb_streams-1, i, e->time); return AVERROR_INVALIDDATA; } } sc->elst_count = i; return 0; } ",0 "SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon) { struct smb2_tree_disconnect_req *req; /* response is trivial */ int rc = 0; struct TCP_Server_Info *server; struct cifs_ses *ses = tcon->ses; cifs_dbg(FYI, ""Tree Disconnect\n""); if (ses && (ses->server)) server = ses->server; else return -EIO; if ((tcon->need_reconnect) || (tcon->ses->need_reconnect)) return 0; rc = small_smb2_init(SMB2_TREE_DISCONNECT, tcon, (void **) &req); if (rc) return rc; rc = SendReceiveNoRsp(xid, ses, (char *)&req->hdr, 0); if (rc) cifs_stats_fail_inc(tcon, SMB2_TREE_DISCONNECT_HE); return rc; } ",0 "static void futex_wait_queue_me(struct futex_hash_bucket *hb, struct futex_q *q, struct hrtimer_sleeper *timeout) { /* * The task state is guaranteed to be set before another task can * wake it. set_current_state() is implemented using set_mb() and * queue_me() calls spin_unlock() upon completion, both serializing * access to the hash list and forcing another memory barrier. */ set_current_state(TASK_INTERRUPTIBLE); queue_me(q, hb); /* Arm the timer */ if (timeout) { hrtimer_start_expires(&timeout->timer, HRTIMER_MODE_ABS); if (!hrtimer_active(&timeout->timer)) timeout->task = NULL; } /* * If we have been removed from the hash list, then another task * has tried to wake us, and we can skip the call to schedule(). */ if (likely(!plist_node_empty(&q->list))) { /* * If the timer has already expired, current will already be * flagged for rescheduling. Only call schedule if there * is no timeout, or if it has yet to expire. */ if (!timeout || timeout->task) freezable_schedule(); } __set_current_state(TASK_RUNNING); } ",0 "void DiscardableSharedMemoryManager::Bind( mojom::DiscardableSharedMemoryManagerRequest request, const service_manager::BindSourceInfo& source_info) { DCHECK(!mojo_thread_message_loop_ || mojo_thread_message_loop_ == base::MessageLoop::current()); if (!mojo_thread_message_loop_) { mojo_thread_message_loop_ = base::MessageLoop::current(); mojo_thread_message_loop_->AddDestructionObserver(this); } mojo::MakeStrongBinding( std::make_unique( next_client_id_++, mojo_thread_weak_ptr_factory_.GetWeakPtr()), std::move(request)); } ",0 "static void pdf_drop_xref_sections_imp(fz_context *ctx, pdf_document *doc, pdf_xref *xref_sections, int num_xref_sections) { pdf_unsaved_sig *usig; int x, e; for (x = 0; x < num_xref_sections; x++) { pdf_xref *xref = &xref_sections[x]; pdf_xref_subsec *sub = xref->subsec; while (sub != NULL) { pdf_xref_subsec *next_sub = sub->next; for (e = 0; e < sub->len; e++) { pdf_xref_entry *entry = &sub->table[e]; if (entry->obj) { pdf_drop_obj(ctx, entry->obj); fz_drop_buffer(ctx, entry->stm_buf); } } fz_free(ctx, sub->table); fz_free(ctx, sub); sub = next_sub; } pdf_drop_obj(ctx, xref->pre_repair_trailer); pdf_drop_obj(ctx, xref->trailer); while ((usig = xref->unsaved_sigs) != NULL) { xref->unsaved_sigs = usig->next; pdf_drop_obj(ctx, usig->field); pdf_drop_signer(ctx, usig->signer); fz_free(ctx, usig); } } fz_free(ctx, xref_sections); } ",0 "SYSCALL_DEFINE4(send, int, fd, void __user *, buff, size_t, len, unsigned, flags) { return sys_sendto(fd, buff, len, flags, NULL, 0); } ",0 "void VirtualAuthenticator::AddBinding( blink::test::mojom::VirtualAuthenticatorRequest request) { binding_set_.AddBinding(this, std::move(request)); } ",0 "static int irda_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { struct sockaddr_irda saddr; struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); memset(&saddr, 0, sizeof(saddr)); if (peer) { if (sk->sk_state != TCP_ESTABLISHED) return -ENOTCONN; saddr.sir_family = AF_IRDA; saddr.sir_lsap_sel = self->dtsap_sel; saddr.sir_addr = self->daddr; } else { saddr.sir_family = AF_IRDA; saddr.sir_lsap_sel = self->stsap_sel; saddr.sir_addr = self->saddr; } IRDA_DEBUG(1, ""%s(), tsap_sel = %#x\n"", __func__, saddr.sir_lsap_sel); IRDA_DEBUG(1, ""%s(), addr = %08x\n"", __func__, saddr.sir_addr); /* uaddr_len come to us uninitialised */ *uaddr_len = sizeof (struct sockaddr_irda); memcpy(uaddr, &saddr, *uaddr_len); return 0; } ",0 "void perf_sched_cb_dec(struct pmu *pmu) { this_cpu_dec(perf_sched_cb_usages); } ",0 "static unsigned int compute_transkey_hash(const MyString &key) { return key.Hash(); } ",0 "SMB2_QFS_attr(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, int level) { struct smb_rqst rqst; struct smb2_query_info_rsp *rsp = NULL; struct kvec iov; struct kvec rsp_iov; int rc = 0; int resp_buftype, max_len, min_len; struct cifs_ses *ses = tcon->ses; unsigned int rsp_len, offset; int flags = 0; if (level == FS_DEVICE_INFORMATION) { max_len = sizeof(FILE_SYSTEM_DEVICE_INFO); min_len = sizeof(FILE_SYSTEM_DEVICE_INFO); } else if (level == FS_ATTRIBUTE_INFORMATION) { max_len = sizeof(FILE_SYSTEM_ATTRIBUTE_INFO); min_len = MIN_FS_ATTR_INFO_SIZE; } else if (level == FS_SECTOR_SIZE_INFORMATION) { max_len = sizeof(struct smb3_fs_ss_info); min_len = sizeof(struct smb3_fs_ss_info); } else if (level == FS_VOLUME_INFORMATION) { max_len = sizeof(struct smb3_fs_vol_info) + MAX_VOL_LABEL_LEN; min_len = sizeof(struct smb3_fs_vol_info); } else { cifs_dbg(FYI, ""Invalid qfsinfo level %d\n"", level); return -EINVAL; } rc = build_qfs_info_req(&iov, tcon, level, max_len, persistent_fid, volatile_fid); if (rc) return rc; if (smb3_encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; memset(&rqst, 0, sizeof(struct smb_rqst)); rqst.rq_iov = &iov; rqst.rq_nvec = 1; rc = cifs_send_recv(xid, ses, &rqst, &resp_buftype, flags, &rsp_iov); cifs_small_buf_release(iov.iov_base); if (rc) { cifs_stats_fail_inc(tcon, SMB2_QUERY_INFO_HE); goto qfsattr_exit; } rsp = (struct smb2_query_info_rsp *)rsp_iov.iov_base; rsp_len = le32_to_cpu(rsp->OutputBufferLength); offset = le16_to_cpu(rsp->OutputBufferOffset); rc = smb2_validate_iov(offset, rsp_len, &rsp_iov, min_len); if (rc) goto qfsattr_exit; if (level == FS_ATTRIBUTE_INFORMATION) memcpy(&tcon->fsAttrInfo, offset + (char *)rsp, min_t(unsigned int, rsp_len, max_len)); else if (level == FS_DEVICE_INFORMATION) memcpy(&tcon->fsDevInfo, offset + (char *)rsp, sizeof(FILE_SYSTEM_DEVICE_INFO)); else if (level == FS_SECTOR_SIZE_INFORMATION) { struct smb3_fs_ss_info *ss_info = (struct smb3_fs_ss_info *) (offset + (char *)rsp); tcon->ss_flags = le32_to_cpu(ss_info->Flags); tcon->perf_sector_size = le32_to_cpu(ss_info->PhysicalBytesPerSectorForPerf); } else if (level == FS_VOLUME_INFORMATION) { struct smb3_fs_vol_info *vol_info = (struct smb3_fs_vol_info *) (offset + (char *)rsp); tcon->vol_serial_number = vol_info->VolumeSerialNumber; tcon->vol_create_time = vol_info->VolumeCreationTime; } qfsattr_exit: free_rsp_buf(resp_buftype, rsp_iov.iov_base); return rc; } ",0 "read_header(struct archive_read *a, struct archive_entry *entry) { struct mtree *mtree; char *p; int r, use_next; mtree = (struct mtree *)(a->format->data); if (mtree->fd >= 0) { close(mtree->fd); mtree->fd = -1; } if (mtree->entries == NULL) { mtree->resolver = archive_entry_linkresolver_new(); if (mtree->resolver == NULL) return ARCHIVE_FATAL; archive_entry_linkresolver_set_strategy(mtree->resolver, ARCHIVE_FORMAT_MTREE); r = read_mtree(a, mtree); if (r != ARCHIVE_OK) return (r); } a->archive.archive_format = mtree->archive_format; a->archive.archive_format_name = mtree->archive_format_name; for (;;) { if (mtree->this_entry == NULL) return (ARCHIVE_EOF); if (strcmp(mtree->this_entry->name, "".."") == 0) { mtree->this_entry->used = 1; if (archive_strlen(&mtree->current_dir) > 0) { /* Roll back current path. */ p = mtree->current_dir.s + mtree->current_dir.length - 1; while (p >= mtree->current_dir.s && *p != '/') --p; if (p >= mtree->current_dir.s) --p; mtree->current_dir.length = p - mtree->current_dir.s + 1; } } if (!mtree->this_entry->used) { use_next = 0; r = parse_file(a, entry, mtree, mtree->this_entry, &use_next); if (use_next == 0) return (r); } mtree->this_entry = mtree->this_entry->next; } } ",0 "Init() { char * tmp = param( ""CRED_SUPER_USERS"" ); if( tmp ) { super_users.initializeFromString( tmp ); free( tmp ); } else { #if defined(WIN32) super_users.initializeFromString(""Administrator""); #else super_users.initializeFromString(""root""); #endif } char * spool = param (""SPOOL""); tmp = param ( ""CRED_STORE_DIR"" ); if ( tmp ) { cred_store_dir = tmp; } else { cred_store_dir = dircat (spool, ""cred""); } if ( spool != NULL ) { free (spool); } tmp = param ( ""CRED_INDEX_FILE"" ); if (tmp ) { cred_index_file = tmp; } else { cred_index_file = dircat (cred_store_dir, ""cred-index""); } default_cred_expire_threshold = param_integer (""DEFAULT_CRED_EXPIRE_THRESHOLD"", 3600); CheckCredentials_interval = param_integer ( ""CRED_CHECK_INTERVAL"", // param name DEF_CRED_CHECK_INTERVAL // default value, seconds ); struct stat stat_buff; if (stat (cred_store_dir, &stat_buff)) { dprintf (D_ALWAYS, ""ERROR: Cred store directory %s does not exist\n"", cred_store_dir); DC_Exit (1 ); } if (stat (cred_index_file, &stat_buff)) { dprintf (D_ALWAYS, ""Creating credential index file %s\n"", cred_index_file); priv_state priv = set_root_priv(); int fd = safe_open_wrapper_follow(cred_index_file, O_WRONLY | O_CREAT | O_TRUNC, 0600); if (fd != -1) { close (fd); set_priv (priv); } else { dprintf (D_ALWAYS, ""ERROR: Unable to create credential index file %s\n"", cred_index_file); set_priv (priv); DC_Exit (1 ); } } else { if ((stat_buff.st_mode & (S_IRWXG | S_IRWXO)) || (stat_buff.st_uid != getuid())) { dprintf (D_ALWAYS, ""ERROR: Invalid ownership / permissions on credential index file %s\n"", cred_index_file); DC_Exit (1 ); } } } ",0 "void RenderFrameHostImpl::DidCommitProvisionalLoad( std::unique_ptr validated_params, service_manager::mojom::InterfaceProviderRequest interface_provider_request) { ScopedActiveURL scoped_active_url( validated_params->url, frame_tree_node()->frame_tree()->root()->current_origin()); ScopedCommitStateResetter commit_state_resetter(this); RenderProcessHost* process = GetProcess(); TRACE_EVENT2(""navigation"", ""RenderFrameHostImpl::DidCommitProvisionalLoad"", ""frame_tree_node"", frame_tree_node_->frame_tree_node_id(), ""url"", validated_params->url.possibly_invalid_spec()); NotifyResourceSchedulerOfNavigation(process->GetID(), *validated_params); if (is_waiting_for_beforeunload_ack_ && unload_ack_is_for_navigation_ && !GetParent()) { base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_; OnBeforeUnloadACK(true, approx_renderer_start_time, base::TimeTicks::Now()); } if (IsWaitingForUnloadACK()) return; DCHECK(document_scoped_interface_provider_binding_.is_bound()); if (interface_provider_request.is_pending()) { auto interface_provider_request_of_previous_document = document_scoped_interface_provider_binding_.Unbind(); dropped_interface_request_logger_ = std::make_unique( std::move(interface_provider_request_of_previous_document)); BindInterfaceProviderRequest(std::move(interface_provider_request)); } else { if (frame_tree_node_->has_committed_real_load()) { document_scoped_interface_provider_binding_.Close(); bad_message::ReceivedBadMessage( process, bad_message::RFH_INTERFACE_PROVIDER_MISSING); return; } } if (!DidCommitNavigationInternal(validated_params.get(), false /* is_same_document_navigation */)) return; commit_state_resetter.disable(); if (frame_tree_node_->IsMainFrame() && GetView()) { RenderWidgetHostImpl::From(GetView()->GetRenderWidgetHost()) ->DidNavigate(validated_params->content_source_id); } } ",0 "error::Error GLES2DecoderImpl::HandleProgramPathFragmentInputGenCHROMIUM( uint32_t immediate_data_size, const volatile void* cmd_data) { static const char kFunctionName[] = ""glProgramPathFragmentInputGenCHROMIUM""; const volatile gles2::cmds::ProgramPathFragmentInputGenCHROMIUM& c = *static_cast< const volatile gles2::cmds::ProgramPathFragmentInputGenCHROMIUM*>( cmd_data); if (!features().chromium_path_rendering) { return error::kUnknownCommand; } GLint program_id = static_cast(c.program); Program* program = GetProgram(program_id); if (!program || !program->IsValid() || program->IsDeleted()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, ""invalid program""); return error::kNoError; } GLenum gen_mode = static_cast(c.genMode); if (!validators_->path_fragment_input_gen_mode.IsValid(gen_mode)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, gen_mode, ""genMode""); return error::kNoError; } GLint components = static_cast(c.components); if (components < 0 || components > 4) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, ""components out of range""); return error::kNoError; } if ((components != 0 && gen_mode == GL_NONE) || (components == 0 && gen_mode != GL_NONE)) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, ""components and genMode do not match""); return error::kNoError; } GLint location = static_cast(c.location); if (program->IsInactiveFragmentInputLocationByFakeLocation(location)) return error::kNoError; const Program::FragmentInputInfo* fragment_input_info = program->GetFragmentInputInfoByFakeLocation(location); if (!fragment_input_info) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, ""unknown location""); return error::kNoError; } GLint real_location = fragment_input_info->location; const GLfloat* coeffs = nullptr; if (components > 0) { GLint components_needed = -1; switch (fragment_input_info->type) { case GL_FLOAT: components_needed = 1; break; case GL_FLOAT_VEC2: components_needed = 2; break; case GL_FLOAT_VEC3: components_needed = 3; break; case GL_FLOAT_VEC4: components_needed = 4; break; default: LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, ""fragment input type is not single-precision "" ""floating-point scalar or vector""); return error::kNoError; } if (components_needed != components) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, ""components does not match fragment input type""); return error::kNoError; } uint32_t coeffs_per_component = GLES2Util::GetCoefficientCountForGLPathFragmentInputGenMode(gen_mode); DCHECK(coeffs_per_component > 0 && coeffs_per_component <= 4); DCHECK(components > 0 && components <= 4); uint32_t coeffs_size = sizeof(GLfloat) * coeffs_per_component * components; uint32_t coeffs_shm_id = static_cast(c.coeffs_shm_id); uint32_t coeffs_shm_offset = static_cast(c.coeffs_shm_offset); if (coeffs_shm_id != 0 || coeffs_shm_offset != 0) { coeffs = GetSharedMemoryAs( coeffs_shm_id, coeffs_shm_offset, coeffs_size); } if (!coeffs) { return error::kOutOfBounds; } } api()->glProgramPathFragmentInputGenNVFn(program->service_id(), real_location, gen_mode, components, coeffs); return error::kNoError; } ",0 "static int nr_recvmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct sockaddr_ax25 *sax = (struct sockaddr_ax25 *)msg->msg_name; size_t copied; struct sk_buff *skb; int er; /* * This works for seqpacket too. The receiver has ordered the queue for * us! We do one quick check first though */ lock_sock(sk); if (sk->sk_state != TCP_ESTABLISHED) { release_sock(sk); return -ENOTCONN; } /* Now we can treat all alike */ if ((skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &er)) == NULL) { release_sock(sk); return er; } skb_reset_transport_header(skb); copied = skb->len; if (copied > size) { copied = size; msg->msg_flags |= MSG_TRUNC; } er = skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); if (er < 0) { skb_free_datagram(sk, skb); release_sock(sk); return er; } if (sax != NULL) { memset(sax, 0, sizeof(sax)); sax->sax25_family = AF_NETROM; skb_copy_from_linear_data_offset(skb, 7, sax->sax25_call.ax25_call, AX25_ADDR_LEN); } msg->msg_namelen = sizeof(*sax); skb_free_datagram(sk, skb); release_sock(sk); return copied; } ",1 "void BrowserPolicyConnector::InitializeUserPolicy(const std::string& user_name, const FilePath& policy_dir, TokenService* token_service) { user_cloud_policy_subsystem_.reset(); user_policy_token_cache_.reset(); user_data_store_.reset(); registrar_.RemoveAll(); CommandLine* command_line = CommandLine::ForCurrentProcess(); if (command_line->HasSwitch(switches::kDeviceManagementUrl)) { token_service_ = token_service; if (token_service_) { registrar_.Add(this, chrome::NOTIFICATION_TOKEN_AVAILABLE, Source(token_service_)); } FilePath policy_cache_dir = policy_dir.Append(kPolicyDir); UserPolicyCache* user_policy_cache = new UserPolicyCache(policy_cache_dir.Append(kPolicyCacheFile)); user_data_store_.reset(CloudPolicyDataStore::CreateForUserPolicies()); user_policy_token_cache_.reset( new UserPolicyTokenCache(user_data_store_.get(), policy_cache_dir.Append(kTokenCacheFile))); managed_cloud_provider_->PrependCache(user_policy_cache); recommended_cloud_provider_->PrependCache(user_policy_cache); user_cloud_policy_subsystem_.reset(new CloudPolicySubsystem( user_data_store_.get(), user_policy_cache)); user_policy_token_cache_->Load(); user_data_store_->set_user_name(user_name); if (token_service_ && token_service_->HasTokenForService( GaiaConstants::kDeviceManagementService)) { user_data_store_->SetGaiaToken(token_service_->GetTokenForService( GaiaConstants::kDeviceManagementService)); } user_cloud_policy_subsystem_->CompleteInitialization( prefs::kUserPolicyRefreshRate, kServiceInitializationStartupDelay); } } ",0 "SerializedFlashMenu::~SerializedFlashMenu() { if (own_menu_) FreeMenu(pp_menu_); } ",0 "ilineara(int fixed_srgb, int alpha) { return u16d((257 * alpha) * sRGB_to_d[fixed_srgb]); } ",0 "void AudioRendererHost::DoSendPlayingMessage( media::AudioOutputController* controller) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); AudioEntry* entry = LookupByController(controller); if (!entry) return; Send(new AudioMsg_NotifyStreamStateChanged( entry->stream_id, media::AudioOutputIPCDelegate::kPlaying)); } ",0 "static inline char * _php_pgsql_trim_result(PGconn * pgsql, char **buf) { return *buf = _php_pgsql_trim_message(PQerrorMessage(pgsql), NULL); } ",0 "spnego_gss_acquire_cred_with_password(OM_uint32 *minor_status, const gss_name_t desired_name, const gss_buffer_t password, OM_uint32 time_req, const gss_OID_set desired_mechs, gss_cred_usage_t cred_usage, gss_cred_id_t *output_cred_handle, gss_OID_set *actual_mechs, OM_uint32 *time_rec) { OM_uint32 status, tmpmin; gss_OID_set amechs = GSS_C_NULL_OID_SET; gss_cred_id_t mcred = NULL; spnego_gss_cred_id_t spcred = NULL; dsyslog(""Entering spnego_gss_acquire_cred_with_password\n""); if (actual_mechs) *actual_mechs = NULL; if (time_rec) *time_rec = 0; status = get_available_mechs(minor_status, desired_name, cred_usage, GSS_C_NO_CRED_STORE, NULL, &amechs); if (status != GSS_S_COMPLETE) goto cleanup; status = gss_acquire_cred_with_password(minor_status, desired_name, password, time_req, amechs, cred_usage, &mcred, actual_mechs, time_rec); if (status != GSS_S_COMPLETE) goto cleanup; spcred = malloc(sizeof(spnego_gss_cred_id_rec)); if (spcred == NULL) { *minor_status = ENOMEM; status = GSS_S_FAILURE; goto cleanup; } spcred->neg_mechs = GSS_C_NULL_OID_SET; spcred->mcred = mcred; mcred = GSS_C_NO_CREDENTIAL; *output_cred_handle = (gss_cred_id_t)spcred; cleanup: (void) gss_release_oid_set(&tmpmin, &amechs); (void) gss_release_cred(&tmpmin, &mcred); dsyslog(""Leaving spnego_gss_acquire_cred_with_password\n""); return (status); } ",0 "val_acc_sec_ctx_args( OM_uint32 *minor_status, gss_ctx_id_t *context_handle, gss_cred_id_t verifier_cred_handle, gss_buffer_t input_token_buffer, gss_channel_bindings_t input_chan_bindings, gss_name_t *src_name, gss_OID *mech_type, gss_buffer_t output_token, OM_uint32 *ret_flags, OM_uint32 *time_rec, gss_cred_id_t *d_cred) { /* Initialize outputs. */ if (minor_status != NULL) *minor_status = 0; if (src_name != NULL) *src_name = GSS_C_NO_NAME; if (mech_type != NULL) *mech_type = GSS_C_NO_OID; if (output_token != GSS_C_NO_BUFFER) { output_token->length = 0; output_token->value = NULL; } if (d_cred != NULL) *d_cred = GSS_C_NO_CREDENTIAL; /* Validate arguments. */ if (minor_status == NULL) return (GSS_S_CALL_INACCESSIBLE_WRITE); if (context_handle == NULL) return (GSS_S_CALL_INACCESSIBLE_WRITE); if (input_token_buffer == GSS_C_NO_BUFFER) return (GSS_S_CALL_INACCESSIBLE_READ); if (output_token == GSS_C_NO_BUFFER) return (GSS_S_CALL_INACCESSIBLE_WRITE); return (GSS_S_COMPLETE); } ",0 "bool RenderLayerScrollableArea::scrollbarsCanBeActive() const { RenderView* view = box().view(); if (!view) return false; return view->frameView()->scrollbarsCanBeActive(); } ",0 "bool WebGLRenderingContextBase::ValidateTexFuncFormatAndType( const char* function_name, TexImageFunctionType function_type, GLenum internalformat, GLenum format, GLenum type, GLint level) { if (!is_web_gl2_formats_types_added_ && IsWebGL2OrHigher()) { ADD_VALUES_TO_SET(supported_internal_formats_, kSupportedInternalFormatsES3); ADD_VALUES_TO_SET(supported_internal_formats_, kSupportedInternalFormatsTexImageES3); ADD_VALUES_TO_SET(supported_formats_, kSupportedFormatsES3); ADD_VALUES_TO_SET(supported_types_, kSupportedTypesES3); is_web_gl2_formats_types_added_ = true; } if (!IsWebGL2OrHigher()) { AddExtensionSupportedFormatsTypes(); } if (internalformat != 0 && supported_internal_formats_.find(internalformat) == supported_internal_formats_.end()) { if (function_type == kTexImage) { SynthesizeGLError(GL_INVALID_VALUE, function_name, ""invalid internalformat""); } else { SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid internalformat""); } return false; } if (supported_formats_.find(format) == supported_formats_.end()) { SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid format""); return false; } if (supported_types_.find(type) == supported_types_.end()) { SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid type""); return false; } if (format == GL_DEPTH_COMPONENT && level > 0 && !IsWebGL2OrHigher()) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""level must be 0 for DEPTH_COMPONENT format""); return false; } if (format == GL_DEPTH_STENCIL_OES && level > 0 && !IsWebGL2OrHigher()) { SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""level must be 0 for DEPTH_STENCIL format""); return false; } return true; } ",0 "ltxtq_in(PG_FUNCTION_ARGS) { PG_RETURN_POINTER(queryin((char *) PG_GETARG_POINTER(0))); } ",0 "static void spl_dllist_object_free_storage(zend_object *object) /* {{{ */ { spl_dllist_object *intern = spl_dllist_from_obj(object); zval tmp; zend_object_std_dtor(&intern->std); while (intern->llist->count > 0) { spl_ptr_llist_pop(intern->llist, &tmp); zval_ptr_dtor(&tmp); } if (intern->gc_data != NULL) { efree(intern->gc_data); }; spl_ptr_llist_destroy(intern->llist); SPL_LLIST_CHECK_DELREF(intern->traverse_pointer); } /* }}} */ ",0 "void GLES2DecoderImpl::DoWindowRectanglesEXT(GLenum mode, GLsizei n, const volatile GLint* box) { std::vector box_copy(box, box + (n * 4)); if (static_cast(n) > state_.GetMaxWindowRectangles()) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, ""glWindowRectanglesEXT"", ""count > GL_MAX_WINDOW_RECTANGLES_EXT""); return; } for (int i = 0; i < n; ++i) { int boxindex = i * 4; if (box_copy[boxindex + 2] < 0 || box_copy[boxindex + 3] < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, ""glWindowRectanglesEXT"", ""negative box width or height""); return; } } state_.SetWindowRectangles(mode, n, box_copy.data()); state_.UpdateWindowRectangles(); } ",0 "ftrace_snapshot_free(struct ftrace_probe_ops *ops, struct trace_array *tr, unsigned long ip, void *data) { struct ftrace_func_mapper *mapper = data; if (!ip) { if (!mapper) return; free_ftrace_func_mapper(mapper, NULL); return; } ftrace_func_mapper_remove_ip(mapper, ip); } ",0 "void AppCache::InitializeWithDatabaseRecords( const AppCacheDatabase::CacheRecord& cache_record, const std::vector& entries, const std::vector& intercepts, const std::vector& fallbacks, const std::vector& whitelists) { DCHECK(cache_id_ == cache_record.cache_id); online_whitelist_all_ = cache_record.online_wildcard; update_time_ = cache_record.update_time; for (size_t i = 0; i < entries.size(); ++i) { const AppCacheDatabase::EntryRecord& entry = entries.at(i); AddEntry(entry.url, AppCacheEntry(entry.flags, entry.response_id, entry.response_size)); } DCHECK(cache_size_ == cache_record.cache_size); for (size_t i = 0; i < intercepts.size(); ++i) intercept_namespaces_.push_back(intercepts.at(i).namespace_); for (size_t i = 0; i < fallbacks.size(); ++i) fallback_namespaces_.push_back(fallbacks.at(i).namespace_); std::sort(intercept_namespaces_.begin(), intercept_namespaces_.end(), SortNamespacesByLength); std::sort(fallback_namespaces_.begin(), fallback_namespaces_.end(), SortNamespacesByLength); for (size_t i = 0; i < whitelists.size(); ++i) { const AppCacheDatabase::OnlineWhiteListRecord& record = whitelists.at(i); online_whitelist_namespaces_.push_back( AppCacheNamespace(APPCACHE_NETWORK_NAMESPACE, record.namespace_url, GURL(), record.is_pattern)); } } ",1 "ScriptExecutor* ExecuteCodeInTabFunction::GetScriptExecutor() { Browser* browser = NULL; content::WebContents* contents = NULL; bool success = GetTabById(execute_tab_id_, browser_context(), include_incognito(), &browser, nullptr, &contents, nullptr, &error_) && contents && browser; if (!success) return NULL; return TabHelper::FromWebContents(contents)->script_executor(); } ",0 "ip_optprint(netdissect_options *ndo, register const u_char *cp, u_int length) { register u_int option_len; const char *sep = """"; for (; length > 0; cp += option_len, length -= option_len) { u_int option_code; ND_PRINT((ndo, ""%s"", sep)); sep = "",""; ND_TCHECK(*cp); option_code = *cp; ND_PRINT((ndo, ""%s"", tok2str(ip_option_values,""unknown %u"",option_code))); if (option_code == IPOPT_NOP || option_code == IPOPT_EOL) option_len = 1; else { ND_TCHECK(cp[1]); option_len = cp[1]; if (option_len < 2) { ND_PRINT((ndo, "" [bad length %u]"", option_len)); return; } } if (option_len > length) { ND_PRINT((ndo, "" [bad length %u]"", option_len)); return; } ND_TCHECK2(*cp, option_len); switch (option_code) { case IPOPT_EOL: return; case IPOPT_TS: ip_printts(ndo, cp, option_len); break; case IPOPT_RR: /* fall through */ case IPOPT_SSRR: case IPOPT_LSRR: if (ip_printroute(ndo, cp, option_len) == -1) goto trunc; break; case IPOPT_RA: if (option_len < 4) { ND_PRINT((ndo, "" [bad length %u]"", option_len)); break; } ND_TCHECK(cp[3]); if (EXTRACT_16BITS(&cp[2]) != 0) ND_PRINT((ndo, "" value %u"", EXTRACT_16BITS(&cp[2]))); break; case IPOPT_NOP: /* nothing to print - fall through */ case IPOPT_SECURITY: default: break; } } return; trunc: ND_PRINT((ndo, ""%s"", tstr)); } ",1 "static int bond_info_query(struct net_device *bond_dev, struct ifbond *info) { struct bonding *bond = netdev_priv(bond_dev); info->bond_mode = bond->params.mode; info->miimon = bond->params.miimon; read_lock(&bond->lock); info->num_slaves = bond->slave_cnt; read_unlock(&bond->lock); return 0; } ",0 "sctp_disposition_t sctp_sf_error_shutdown(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_ERROR, SCTP_ERROR(-ESHUTDOWN)); return SCTP_DISPOSITION_CONSUME; } ",0 " void qrio_uprstreq(u8 mode) { u32 rstcfg; void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE; rstcfg = in_8(qrio_base + RSTCFG_OFF); if (mode & UPREQ_CORE_RST) rstcfg |= UPREQ_CORE_RST; else rstcfg &= ~UPREQ_CORE_RST; out_8(qrio_base + RSTCFG_OFF, rstcfg); } ",0 "LayoutUnit RenderFlexibleBox::crossAxisExtentForChild(RenderBox* child) const { return isHorizontalFlow() ? child->height() : child->width(); } ",0 "void MediaRecorderHandler::OnAudioBusForTesting( const media::AudioBus& audio_bus, const base::TimeTicks& timestamp) { for (const auto& recorder : audio_recorders_) recorder->OnData(audio_bus, timestamp); } ",0 "static void camellia_encrypt(struct crypto_tfm *tfm, u8 *out, const u8 *in) { const struct camellia_ctx *cctx = crypto_tfm_ctx(tfm); const __be32 *src = (const __be32 *)in; __be32 *dst = (__be32 *)out; unsigned int max; u32 tmp[4]; tmp[0] = be32_to_cpu(src[0]); tmp[1] = be32_to_cpu(src[1]); tmp[2] = be32_to_cpu(src[2]); tmp[3] = be32_to_cpu(src[3]); if (cctx->key_length == 16) max = 24; else max = 32; /* for key lengths of 24 and 32 */ camellia_do_encrypt(cctx->key_table, tmp, max); /* do_encrypt returns 0,1 swapped with 2,3 */ dst[0] = cpu_to_be32(tmp[2]); dst[1] = cpu_to_be32(tmp[3]); dst[2] = cpu_to_be32(tmp[0]); dst[3] = cpu_to_be32(tmp[1]); } ",0 "PHP_FUNCTION(imagecolortransparent) { zval *IM; long COL = 0; gdImagePtr im; int argc = ZEND_NUM_ARGS(); if (zend_parse_parameters(argc TSRMLS_CC, ""r|l"", &IM, &COL) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, ""Image"", le_gd); if (argc > 1) { gdImageColorTransparent(im, COL); } RETURN_LONG(gdImageGetTransparent(im)); } ",0 "uint64_t ewk_view_exceeded_database_quota(Evas_Object* ewkView, Evas_Object* frame, const char* databaseName, uint64_t currentSize, uint64_t expectedSize) { DBG(""ewkView=%p"", ewkView); EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->api, 0); if (!smartData->api->exceeded_database_quota) return 0; INF(""currentSize=%"" PRIu64 "" expectedSize=%"" PRIu64, currentSize, expectedSize); return smartData->api->exceeded_database_quota(smartData, frame, databaseName, currentSize, expectedSize); } ",0 "rdpsnd_show_help(void) { struct audio_driver *pos; rdpsnd_register_drivers(NULL); pos = drivers; while (pos != NULL) { fprintf(stderr, "" %s:\t%s\n"", pos->name, pos->description); pos = pos->next; } } ",0 "void createDecodingBaseline(SharedBuffer* data, Vector* baselineHashes) { OwnPtr decoder = createDecoder(); decoder->setData(data, true); size_t frameCount = decoder->frameCount(); for (size_t i = 0; i < frameCount; ++i) { ImageFrame* frame = decoder->frameBufferAtIndex(i); baselineHashes->append(hashSkBitmap(frame->getSkBitmap())); } } ",0 "SYSCALL_DEFINE3(sigprocmask, int, how, old_sigset_t __user *, set, old_sigset_t __user *, oset) { int error; old_sigset_t old_set, new_set; if (set) { error = -EFAULT; if (copy_from_user(&new_set, set, sizeof(*set))) goto out; new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP)); spin_lock_irq(¤t->sighand->siglock); old_set = current->blocked.sig[0]; error = 0; switch (how) { default: error = -EINVAL; break; case SIG_BLOCK: sigaddsetmask(¤t->blocked, new_set); break; case SIG_UNBLOCK: sigdelsetmask(¤t->blocked, new_set); break; case SIG_SETMASK: current->blocked.sig[0] = new_set; break; } recalc_sigpending(); spin_unlock_irq(¤t->sighand->siglock); if (error) goto out; if (oset) goto set_old; } else if (oset) { old_set = current->blocked.sig[0]; set_old: error = -EFAULT; if (copy_to_user(oset, &old_set, sizeof(*oset))) goto out; } error = 0; out: return error; } ",0 " int WebGraphicsContext3DCommandBufferImpl::GetGPUProcessID() { return host_ ? host_->gpu_process_id() : 0; } ",1 "static void assoc_array_destroy_subtree(struct assoc_array_ptr *root, const struct assoc_array_ops *ops) { struct assoc_array_shortcut *shortcut; struct assoc_array_node *node; struct assoc_array_ptr *cursor, *parent = NULL; int slot = -1; pr_devel(""-->%s()\n"", __func__); cursor = root; if (!cursor) { pr_devel(""empty\n""); return; } move_to_meta: if (assoc_array_ptr_is_shortcut(cursor)) { /* Descend through a shortcut */ pr_devel(""[%d] shortcut\n"", slot); BUG_ON(!assoc_array_ptr_is_shortcut(cursor)); shortcut = assoc_array_ptr_to_shortcut(cursor); BUG_ON(shortcut->back_pointer != parent); BUG_ON(slot != -1 && shortcut->parent_slot != slot); parent = cursor; cursor = shortcut->next_node; slot = -1; BUG_ON(!assoc_array_ptr_is_node(cursor)); } pr_devel(""[%d] node\n"", slot); node = assoc_array_ptr_to_node(cursor); BUG_ON(node->back_pointer != parent); BUG_ON(slot != -1 && node->parent_slot != slot); slot = 0; continue_node: pr_devel(""Node %p [back=%p]\n"", node, node->back_pointer); for (; slot < ASSOC_ARRAY_FAN_OUT; slot++) { struct assoc_array_ptr *ptr = node->slots[slot]; if (!ptr) continue; if (assoc_array_ptr_is_meta(ptr)) { parent = cursor; cursor = ptr; goto move_to_meta; } if (ops) { pr_devel(""[%d] free leaf\n"", slot); ops->free_object(assoc_array_ptr_to_leaf(ptr)); } } parent = node->back_pointer; slot = node->parent_slot; pr_devel(""free node\n""); kfree(node); if (!parent) return; /* Done */ /* Move back up to the parent (may need to free a shortcut on * the way up) */ if (assoc_array_ptr_is_shortcut(parent)) { shortcut = assoc_array_ptr_to_shortcut(parent); BUG_ON(shortcut->next_node != cursor); cursor = parent; parent = shortcut->back_pointer; slot = shortcut->parent_slot; pr_devel(""free shortcut\n""); kfree(shortcut); if (!parent) return; BUG_ON(!assoc_array_ptr_is_node(parent)); } /* Ascend to next slot in parent node */ pr_devel(""ascend to %p[%d]\n"", parent, slot); cursor = parent; node = assoc_array_ptr_to_node(cursor); slot++; goto continue_node; } ",0 "String HTMLFormControlElement::formEnctype() const { const AtomicString& formEnctypeAttr = fastGetAttribute(formenctypeAttr); if (formEnctypeAttr.isNull()) return emptyString(); return FormSubmission::Attributes::parseEncodingType(formEnctypeAttr); } ",0 "exsltCryptoBin2Hex (const unsigned char *bin, int binlen, unsigned char *hex, int hexlen) { static const char bin2hex[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; unsigned char lo, hi; int i, pos; for (i = 0, pos = 0; (i < binlen && pos < hexlen); i++) { lo = bin[i] & 0xf; hi = bin[i] >> 4; hex[pos++] = bin2hex[hi]; hex[pos++] = bin2hex[lo]; } hex[pos] = '\0'; } ",0 "void FileSystemOperation::Remove(const GURL& path_url, bool recursive, const StatusCallback& callback) { DCHECK(SetPendingOperationType(kOperationRemove)); base::PlatformFileError result = SetUpFileSystemPath( path_url, &src_path_, &src_util_, PATH_FOR_WRITE); if (result != base::PLATFORM_FILE_OK) { callback.Run(result); delete this; return; } scoped_quota_notifier_.reset(new ScopedQuotaNotifier( file_system_context(), src_path_.origin(), src_path_.type())); FileSystemFileUtilProxy::Delete( &operation_context_, src_util_, src_path_, recursive, base::Bind(&FileSystemOperation::DidFinishFileOperation, base::Owned(this), callback)); } ",0 "ip_connect(struct TCP_Server_Info *server) { __be16 *sport; struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)&server->dstaddr; struct sockaddr_in *addr = (struct sockaddr_in *)&server->dstaddr; if (server->dstaddr.ss_family == AF_INET6) sport = &addr6->sin6_port; else sport = &addr->sin_port; if (*sport == 0) { int rc; /* try with 445 port at first */ *sport = htons(CIFS_PORT); rc = generic_ip_connect(server); if (rc >= 0) return rc; /* if it failed, try with 139 port */ *sport = htons(RFC1001_PORT); } return generic_ip_connect(server); } ",0 "copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, pte_t *dst_pte, pte_t *src_pte, struct vm_area_struct *vma, unsigned long addr, int *rss) { unsigned long vm_flags = vma->vm_flags; pte_t pte = *src_pte; struct page *page; /* pte contains position in swap or file, so copy. */ if (unlikely(!pte_present(pte))) { if (!pte_file(pte)) { swp_entry_t entry = pte_to_swp_entry(pte); if (swap_duplicate(entry) < 0) return entry.val; /* make sure dst_mm is on swapoff's mmlist. */ if (unlikely(list_empty(&dst_mm->mmlist))) { spin_lock(&mmlist_lock); if (list_empty(&dst_mm->mmlist)) list_add(&dst_mm->mmlist, &src_mm->mmlist); spin_unlock(&mmlist_lock); } if (likely(!non_swap_entry(entry))) rss[MM_SWAPENTS]++; else if (is_migration_entry(entry)) { page = migration_entry_to_page(entry); if (PageAnon(page)) rss[MM_ANONPAGES]++; else rss[MM_FILEPAGES]++; if (is_write_migration_entry(entry) && is_cow_mapping(vm_flags)) { /* * COW mappings require pages in both * parent and child to be set to read. */ make_migration_entry_read(&entry); pte = swp_entry_to_pte(entry); set_pte_at(src_mm, addr, src_pte, pte); } } } goto out_set_pte; } /* * If it's a COW mapping, write protect it both * in the parent and the child */ if (is_cow_mapping(vm_flags)) { ptep_set_wrprotect(src_mm, addr, src_pte); pte = pte_wrprotect(pte); } /* * If it's a shared mapping, mark it clean in * the child */ if (vm_flags & VM_SHARED) pte = pte_mkclean(pte); pte = pte_mkold(pte); page = vm_normal_page(vma, addr, pte); if (page) { get_page(page); page_dup_rmap(page); if (PageAnon(page)) rss[MM_ANONPAGES]++; else rss[MM_FILEPAGES]++; } out_set_pte: set_pte_at(dst_mm, addr, dst_pte, pte); return 0; } ",0 "static void tg3_set_bdinfo(struct tg3 *tp, u32 bdinfo_addr, dma_addr_t mapping, u32 maxlen_flags, u32 nic_addr) { tg3_write_mem(tp, (bdinfo_addr + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_HIGH), ((u64) mapping >> 32)); tg3_write_mem(tp, (bdinfo_addr + TG3_BDINFO_HOST_ADDR + TG3_64BIT_REG_LOW), ((u64) mapping & 0xffffffff)); tg3_write_mem(tp, (bdinfo_addr + TG3_BDINFO_MAXLEN_FLAGS), maxlen_flags); if (!tg3_flag(tp, 5705_PLUS)) tg3_write_mem(tp, (bdinfo_addr + TG3_BDINFO_NIC_ADDR), nic_addr); } ",0 "parse_previous_duplicate_name (const char *name, char **name_base, const char **suffix, int *count) { const char *tag; g_assert (name[0] != '\0'); *suffix = eel_filename_get_extension_offset (name); if (*suffix == NULL || (*suffix)[1] == '\0') { /* no suffix */ *suffix = """"; } tag = strstr (name, COPY_DUPLICATE_TAG); if (tag != NULL) { if (tag > *suffix) { /* handle case ""foo. (copy)"" */ *suffix = """"; } *name_base = extract_string_until (name, tag); *count = 1; return; } tag = strstr (name, ANOTHER_COPY_DUPLICATE_TAG); if (tag != NULL) { if (tag > *suffix) { /* handle case ""foo. (another copy)"" */ *suffix = """"; } *name_base = extract_string_until (name, tag); *count = 2; return; } /* Check to see if we got one of st, nd, rd, th. */ tag = strstr (name, X11TH_COPY_DUPLICATE_TAG); if (tag == NULL) { tag = strstr (name, X12TH_COPY_DUPLICATE_TAG); } if (tag == NULL) { tag = strstr (name, X13TH_COPY_DUPLICATE_TAG); } if (tag == NULL) { tag = strstr (name, ST_COPY_DUPLICATE_TAG); } if (tag == NULL) { tag = strstr (name, ND_COPY_DUPLICATE_TAG); } if (tag == NULL) { tag = strstr (name, RD_COPY_DUPLICATE_TAG); } if (tag == NULL) { tag = strstr (name, TH_COPY_DUPLICATE_TAG); } /* If we got one of st, nd, rd, th, fish out the duplicate number. */ if (tag != NULL) { /* localizers: opening parentheses to match the ""th copy)"" string */ tag = strstr (name, _("" ("")); if (tag != NULL) { if (tag > *suffix) { /* handle case ""foo. (22nd copy)"" */ *suffix = """"; } *name_base = extract_string_until (name, tag); /* localizers: opening parentheses of the ""th copy)"" string */ if (sscanf (tag, _("" (%'d""), count) == 1) { if (*count < 1 || *count > 1000000) { /* keep the count within a reasonable range */ *count = 0; } return; } *count = 0; return; } } *count = 0; if (**suffix != '\0') { *name_base = extract_string_until (name, *suffix); } else { *name_base = g_strdup (name); } } ",0 "EncryptionMode DetermineEncryptionMode( const EncryptionScheme& encryption_scheme) { switch (encryption_scheme.mode()) { case EncryptionScheme::CIPHER_MODE_UNENCRYPTED: return EncryptionMode::kUnencrypted; case EncryptionScheme::CIPHER_MODE_AES_CTR: return EncryptionMode::kCenc; case EncryptionScheme::CIPHER_MODE_AES_CBC: return EncryptionMode::kCbcs; } } ",0 "MagickExport ssize_t WriteBlobByte(Image *image,const unsigned char value) { BlobInfo *magick_restrict blob_info; ssize_t count; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); assert(image->blob != (BlobInfo *) NULL); assert(image->blob->type != UndefinedStream); blob_info=image->blob; count=0; switch (blob_info->type) { case StandardStream: case FileStream: case PipeStream: { int c; c=putc((int) value,blob_info->file_info.file); if (c == EOF) break; count++; break; } default: { count=WriteBlobStream(image,1,&value); break; } } return(count); } ",0 "_dbus_create_directory (const DBusString *filename, DBusError *error) { const char *filename_c; _DBUS_ASSERT_ERROR_IS_CLEAR (error); filename_c = _dbus_string_get_const_data (filename); if (!CreateDirectoryA (filename_c, NULL)) { if (GetLastError () == ERROR_ALREADY_EXISTS) return TRUE; dbus_set_error (error, DBUS_ERROR_FAILED, ""Failed to create directory %s: %s\n"", filename_c, _dbus_strerror_from_errno ()); return FALSE; } else return TRUE; } ",0 "static void __enable_ftrace_function_probe(void) { int ret; int i; if (ftrace_probe_registered) return; for (i = 0; i < FTRACE_FUNC_HASHSIZE; i++) { struct hlist_head *hhd = &ftrace_func_hash[i]; if (hhd->first) break; } /* Nothing registered? */ if (i == FTRACE_FUNC_HASHSIZE) return; ret = __register_ftrace_function(&trace_probe_ops); if (!ret) ret = ftrace_startup(&trace_probe_ops, 0); ftrace_probe_registered = 1; } ",0 "int XKeyEventType(ui::EventType type) { switch (type) { case ui::ET_KEY_PRESSED: return KeyPress; case ui::ET_KEY_RELEASED: return KeyRelease; default: return 0; } } ",0 "void DXVAVideoDecodeAccelerator::RequestPictureBuffers(int width, int height) { if (state_ != kUninitialized && client_) { client_->ProvidePictureBuffers(kNumPictureBuffers, gfx::Size(width, height)); } } ",0 "int git_index_write_tree_to( git_oid *oid, git_index *index, git_repository *repo) { assert(oid && index && repo); return git_tree__write_index(oid, index, repo); } ",0 "int nfs_write_need_commit(struct nfs_write_data *data) { return 0; } ",0 "SWFInput_eof(SWFInput input) { return input->eof(input); } ",0 "void CSoundFile::TonePortamento(ModChannel *pChn, uint32 param) const { pChn->dwFlags.set(CHN_PORTAMENTO); if((!m_SongFlags[SONG_ITCOMPATGXX] && m_playBehaviour[kITPortaMemoryShare]) || GetType() == MOD_TYPE_PLM) { if(param == 0) param = pChn->nOldPortaUp; pChn->nOldPortaUp = pChn->nOldPortaDown = static_cast(param); } if(GetType() == MOD_TYPE_MPT && pChn->pModInstrument && pChn->pModInstrument->pTuning) { const int32 old_PortamentoTickSlide = (m_PlayState.m_nTickCount != 0) ? pChn->m_PortamentoTickSlide : 0; if(param) pChn->nPortamentoSlide = param; else if(pChn->nPortamentoSlide == 0) return; if((pChn->nPortamentoDest > 0 && pChn->nPortamentoSlide < 0) || (pChn->nPortamentoDest < 0 && pChn->nPortamentoSlide > 0)) pChn->nPortamentoSlide = -pChn->nPortamentoSlide; pChn->m_PortamentoTickSlide = static_cast((m_PlayState.m_nTickCount + 1.0) * pChn->nPortamentoSlide / m_PlayState.m_nMusicSpeed); if(pChn->dwFlags[CHN_GLISSANDO]) { pChn->m_PortamentoTickSlide *= pChn->pModInstrument->pTuning->GetFineStepCount() + 1; } const int32 slide = pChn->m_PortamentoTickSlide - old_PortamentoTickSlide; if(mpt::abs(pChn->nPortamentoDest) <= mpt::abs(slide)) { if(pChn->nPortamentoDest != 0) { pChn->m_PortamentoFineSteps += pChn->nPortamentoDest; pChn->nPortamentoDest = 0; pChn->m_CalculateFreq = true; } } else { pChn->m_PortamentoFineSteps += slide; pChn->nPortamentoDest -= slide; pChn->m_CalculateFreq = true; } return; } //End candidate MPT behavior. bool doPorta = !pChn->isFirstTick || (GetType() & (MOD_TYPE_DBM | MOD_TYPE_669)) || (m_PlayState.m_nMusicSpeed == 1 && m_playBehaviour[kSlidesAtSpeed1]); if(GetType() == MOD_TYPE_PLM && param >= 0xF0) { param -= 0xF0; doPorta = pChn->isFirstTick; } if(param) { if(GetType() == MOD_TYPE_669) { param *= 10; } pChn->nPortamentoSlide = param * 4; } if(pChn->nPeriod && pChn->nPortamentoDest && doPorta) { if (pChn->nPeriod < pChn->nPortamentoDest) { int32 delta = pChn->nPortamentoSlide; if(m_SongFlags[SONG_LINEARSLIDES] && GetType() != MOD_TYPE_XM) { uint32 n = pChn->nPortamentoSlide / 4; if (n > 255) n = 255; delta = Util::muldivr(pChn->nPeriod, LinearSlideUpTable[n], 65536) - pChn->nPeriod; if (delta < 1) delta = 1; } pChn->nPeriod += delta; if (pChn->nPeriod > pChn->nPortamentoDest) pChn->nPeriod = pChn->nPortamentoDest; } else if (pChn->nPeriod > pChn->nPortamentoDest) { int32 delta = -pChn->nPortamentoSlide; if(m_SongFlags[SONG_LINEARSLIDES] && GetType() != MOD_TYPE_XM) { uint32 n = pChn->nPortamentoSlide / 4; if (n > 255) n = 255; delta = Util::muldivr(pChn->nPeriod, LinearSlideDownTable[n], 65536) - pChn->nPeriod; if (delta > -1) delta = -1; } pChn->nPeriod += delta; if (pChn->nPeriod < pChn->nPortamentoDest) pChn->nPeriod = pChn->nPortamentoDest; } } if(pChn->nPeriod == pChn->nPortamentoDest && (m_playBehaviour[kITPortaTargetReached] || GetType() == MOD_TYPE_MOD)) pChn->nPortamentoDest = 0; } ",0 "psf_fclose (SF_PRIVATE *psf) { int retval ; if (psf->virtual_io) return 0 ; if (psf->file.do_not_close_descriptor) { psf->file.filedes = -1 ; return 0 ; } ; if ((retval = psf_close_fd (psf->file.filedes)) == -1) psf_log_syserr (psf, errno) ; psf->file.filedes = -1 ; return retval ; } /* psf_fclose */ ",0 "static int vhost_scsi_set_features(struct vhost_scsi *vs, u64 features) { struct vhost_virtqueue *vq; int i; if (features & ~VHOST_SCSI_FEATURES) return -EOPNOTSUPP; mutex_lock(&vs->dev.mutex); if ((features & (1 << VHOST_F_LOG_ALL)) && !vhost_log_access_ok(&vs->dev)) { mutex_unlock(&vs->dev.mutex); return -EFAULT; } for (i = 0; i < VHOST_SCSI_MAX_VQ; i++) { vq = &vs->vqs[i].vq; mutex_lock(&vq->mutex); vq->acked_features = features; mutex_unlock(&vq->mutex); } mutex_unlock(&vs->dev.mutex); return 0; } ",0 "streamProcessTest(const char *filename, const char *result, const char *err, xmlTextReaderPtr reader, const char *rng, int options) { int ret; char *temp = NULL; FILE *t = NULL; if (reader == NULL) return(-1); nb_tests++; if (result != NULL) { temp = resultFilename(filename, """", "".res""); if (temp == NULL) { fprintf(stderr, ""Out of memory\n""); fatalError(); } t = fopen(temp, ""wb""); if (t == NULL) { fprintf(stderr, ""Can't open temp file %s\n"", temp); free(temp); return(-1); } } #ifdef LIBXML_SCHEMAS_ENABLED if (rng != NULL) { ret = xmlTextReaderRelaxNGValidate(reader, rng); if (ret < 0) { testErrorHandler(NULL, ""Relax-NG schema %s failed to compile\n"", rng); fclose(t); if (temp != NULL) { unlink(temp); free(temp); } return(0); } } #endif xmlGetWarningsDefaultValue = 1; ret = xmlTextReaderRead(reader); while (ret == 1) { if ((t != NULL) && (rng == NULL)) processNode(t, reader); ret = xmlTextReaderRead(reader); } if (ret != 0) { testErrorHandler(NULL, ""%s : failed to parse\n"", filename); } if (rng != NULL) { if (xmlTextReaderIsValid(reader) != 1) { testErrorHandler(NULL, ""%s fails to validate\n"", filename); } else { testErrorHandler(NULL, ""%s validates\n"", filename); } } xmlGetWarningsDefaultValue = 0; if (t != NULL) { fclose(t); ret = compareFiles(temp, result); if (temp != NULL) { unlink(temp); free(temp); } if (ret) { fprintf(stderr, ""Result for %s failed in %s\n"", filename, result); return(-1); } } if (err != NULL) { ret = compareFileMem(err, testErrors, testErrorsSize); if (ret != 0) { fprintf(stderr, ""Error for %s failed\n"", filename); printf(""%s"", testErrors); return(-1); } } return(0); } ",0 "void __exit sco_exit(void) { bt_procfs_cleanup(&init_net, ""sco""); debugfs_remove(sco_debugfs); bt_sock_unregister(BTPROTO_SCO); proto_unregister(&sco_proto); } ",0 "SYSCALL_DEFINE6(recvfrom, int, fd, void __user *, ubuf, size_t, size, unsigned int, flags, struct sockaddr __user *, addr, int __user *, addr_len) { struct socket *sock; struct iovec iov; struct msghdr msg; struct sockaddr_storage address; int err, err2; int fput_needed; if (size > INT_MAX) size = INT_MAX; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) goto out; msg.msg_control = NULL; msg.msg_controllen = 0; msg.msg_iovlen = 1; msg.msg_iov = &iov; iov.iov_len = size; iov.iov_base = ubuf; msg.msg_name = (struct sockaddr *)&address; msg.msg_namelen = sizeof(address); if (sock->file->f_flags & O_NONBLOCK) flags |= MSG_DONTWAIT; err = sock_recvmsg(sock, &msg, size, flags); if (err >= 0 && addr != NULL) { err2 = move_addr_to_user(&address, msg.msg_namelen, addr, addr_len); if (err2 < 0) err = err2; } fput_light(sock->file, fput_needed); out: return err; } ",1 "TextAutosizer* Document::GetTextAutosizer() { if (!text_autosizer_) text_autosizer_ = TextAutosizer::Create(this); return text_autosizer_.Get(); } ",0 "SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, u32 pid, __le64 *eof) { struct smb2_file_eof_info info; void *data; unsigned int size; info.EndOfFile = *eof; data = &info; size = sizeof(struct smb2_file_eof_info); return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid, FILE_END_OF_FILE_INFORMATION, SMB2_O_INFO_FILE, 0, 1, &data, &size); } ",0 "MediaQueryList* LocalDOMWindow::matchMedia(const String& media) { return document() ? document()->GetMediaQueryMatcher().MatchMedia(media) : nullptr; } ",0 "static struct crypto_instance *crypto_gcm_base_alloc(struct rtattr **tb) { const char *ctr_name; const char *ghash_name; char full_name[CRYPTO_MAX_ALG_NAME]; ctr_name = crypto_attr_alg_name(tb[1]); if (IS_ERR(ctr_name)) return ERR_CAST(ctr_name); ghash_name = crypto_attr_alg_name(tb[2]); if (IS_ERR(ghash_name)) return ERR_CAST(ghash_name); if (snprintf(full_name, CRYPTO_MAX_ALG_NAME, ""gcm_base(%s,%s)"", ctr_name, ghash_name) >= CRYPTO_MAX_ALG_NAME) return ERR_PTR(-ENAMETOOLONG); return crypto_gcm_alloc_common(tb, full_name, ctr_name, ghash_name); } ",0 "PanoramiXExtensionInit(void) { int i; Bool success = FALSE; ExtensionEntry *extEntry; ScreenPtr pScreen = screenInfo.screens[0]; PanoramiXScreenPtr pScreenPriv; if (noPanoramiXExtension) return; if (!dixRegisterPrivateKey(&PanoramiXScreenKeyRec, PRIVATE_SCREEN, 0)) { noPanoramiXExtension = TRUE; return; } if (!dixRegisterPrivateKey (&PanoramiXGCKeyRec, PRIVATE_GC, sizeof(PanoramiXGCRec))) { noPanoramiXExtension = TRUE; return; } PanoramiXNumScreens = screenInfo.numScreens; if (PanoramiXNumScreens == 1) { /* Only 1 screen */ noPanoramiXExtension = TRUE; return; } while (panoramiXGeneration != serverGeneration) { extEntry = AddExtension(PANORAMIX_PROTOCOL_NAME, 0, 0, ProcPanoramiXDispatch, SProcPanoramiXDispatch, PanoramiXResetProc, StandardMinorOpcode); if (!extEntry) break; /* * First make sure all the basic allocations succeed. If not, * run in non-PanoramiXeen mode. */ FOR_NSCREENS(i) { pScreen = screenInfo.screens[i]; pScreenPriv = malloc(sizeof(PanoramiXScreenRec)); dixSetPrivate(&pScreen->devPrivates, PanoramiXScreenKey, pScreenPriv); if (!pScreenPriv) { noPanoramiXExtension = TRUE; return; } pScreenPriv->CreateGC = pScreen->CreateGC; pScreenPriv->CloseScreen = pScreen->CloseScreen; pScreen->CreateGC = XineramaCreateGC; pScreen->CloseScreen = XineramaCloseScreen; } XRC_DRAWABLE = CreateNewResourceClass(); XRT_WINDOW = CreateNewResourceType(XineramaDeleteResource, ""XineramaWindow""); if (XRT_WINDOW) XRT_WINDOW |= XRC_DRAWABLE; XRT_PIXMAP = CreateNewResourceType(XineramaDeleteResource, ""XineramaPixmap""); if (XRT_PIXMAP) XRT_PIXMAP |= XRC_DRAWABLE; XRT_GC = CreateNewResourceType(XineramaDeleteResource, ""XineramaGC""); XRT_COLORMAP = CreateNewResourceType(XineramaDeleteResource, ""XineramaColormap""); if (XRT_WINDOW && XRT_PIXMAP && XRT_GC && XRT_COLORMAP) { panoramiXGeneration = serverGeneration; success = TRUE; } SetResourceTypeErrorValue(XRT_WINDOW, BadWindow); SetResourceTypeErrorValue(XRT_PIXMAP, BadPixmap); SetResourceTypeErrorValue(XRT_GC, BadGC); SetResourceTypeErrorValue(XRT_COLORMAP, BadColor); } if (!success) { noPanoramiXExtension = TRUE; ErrorF(PANORAMIX_PROTOCOL_NAME "" extension failed to initialize\n""); return; } XineramaInitData(); /* * Put our processes into the ProcVector */ for (i = 256; i--;) SavedProcVector[i] = ProcVector[i]; ProcVector[X_CreateWindow] = PanoramiXCreateWindow; ProcVector[X_ChangeWindowAttributes] = PanoramiXChangeWindowAttributes; ProcVector[X_DestroyWindow] = PanoramiXDestroyWindow; ProcVector[X_DestroySubwindows] = PanoramiXDestroySubwindows; ProcVector[X_ChangeSaveSet] = PanoramiXChangeSaveSet; ProcVector[X_ReparentWindow] = PanoramiXReparentWindow; ProcVector[X_MapWindow] = PanoramiXMapWindow; ProcVector[X_MapSubwindows] = PanoramiXMapSubwindows; ProcVector[X_UnmapWindow] = PanoramiXUnmapWindow; ProcVector[X_UnmapSubwindows] = PanoramiXUnmapSubwindows; ProcVector[X_ConfigureWindow] = PanoramiXConfigureWindow; ProcVector[X_CirculateWindow] = PanoramiXCirculateWindow; ProcVector[X_GetGeometry] = PanoramiXGetGeometry; ProcVector[X_TranslateCoords] = PanoramiXTranslateCoords; ProcVector[X_CreatePixmap] = PanoramiXCreatePixmap; ProcVector[X_FreePixmap] = PanoramiXFreePixmap; ProcVector[X_CreateGC] = PanoramiXCreateGC; ProcVector[X_ChangeGC] = PanoramiXChangeGC; ProcVector[X_CopyGC] = PanoramiXCopyGC; ProcVector[X_SetDashes] = PanoramiXSetDashes; ProcVector[X_SetClipRectangles] = PanoramiXSetClipRectangles; ProcVector[X_FreeGC] = PanoramiXFreeGC; ProcVector[X_ClearArea] = PanoramiXClearToBackground; ProcVector[X_CopyArea] = PanoramiXCopyArea; ProcVector[X_CopyPlane] = PanoramiXCopyPlane; ProcVector[X_PolyPoint] = PanoramiXPolyPoint; ProcVector[X_PolyLine] = PanoramiXPolyLine; ProcVector[X_PolySegment] = PanoramiXPolySegment; ProcVector[X_PolyRectangle] = PanoramiXPolyRectangle; ProcVector[X_PolyArc] = PanoramiXPolyArc; ProcVector[X_FillPoly] = PanoramiXFillPoly; ProcVector[X_PolyFillRectangle] = PanoramiXPolyFillRectangle; ProcVector[X_PolyFillArc] = PanoramiXPolyFillArc; ProcVector[X_PutImage] = PanoramiXPutImage; ProcVector[X_GetImage] = PanoramiXGetImage; ProcVector[X_PolyText8] = PanoramiXPolyText8; ProcVector[X_PolyText16] = PanoramiXPolyText16; ProcVector[X_ImageText8] = PanoramiXImageText8; ProcVector[X_ImageText16] = PanoramiXImageText16; ProcVector[X_CreateColormap] = PanoramiXCreateColormap; ProcVector[X_FreeColormap] = PanoramiXFreeColormap; ProcVector[X_CopyColormapAndFree] = PanoramiXCopyColormapAndFree; ProcVector[X_InstallColormap] = PanoramiXInstallColormap; ProcVector[X_UninstallColormap] = PanoramiXUninstallColormap; ProcVector[X_AllocColor] = PanoramiXAllocColor; ProcVector[X_AllocNamedColor] = PanoramiXAllocNamedColor; ProcVector[X_AllocColorCells] = PanoramiXAllocColorCells; ProcVector[X_AllocColorPlanes] = PanoramiXAllocColorPlanes; ProcVector[X_FreeColors] = PanoramiXFreeColors; ProcVector[X_StoreColors] = PanoramiXStoreColors; ProcVector[X_StoreNamedColor] = PanoramiXStoreNamedColor; PanoramiXRenderInit(); PanoramiXFixesInit(); PanoramiXDamageInit(); #ifdef COMPOSITE PanoramiXCompositeInit(); #endif } ",0 "int orangefs_init_acl(struct inode *inode, struct inode *dir) { struct orangefs_inode_s *orangefs_inode = ORANGEFS_I(inode); struct posix_acl *default_acl, *acl; umode_t mode = inode->i_mode; int error = 0; ClearModeFlag(orangefs_inode); error = posix_acl_create(dir, &mode, &default_acl, &acl); if (error) return error; if (default_acl) { error = orangefs_set_acl(inode, default_acl, ACL_TYPE_DEFAULT); posix_acl_release(default_acl); } if (acl) { if (!error) error = orangefs_set_acl(inode, acl, ACL_TYPE_ACCESS); posix_acl_release(acl); } /* If mode of the inode was changed, then do a forcible ->setattr */ if (mode != inode->i_mode) { SetModeFlag(orangefs_inode); inode->i_mode = mode; orangefs_flush_inode(inode); } return error; } ",0 "void UnloadController::CancelWindowClose() { DCHECK(is_attempting_to_close_browser_); tabs_needing_before_unload_fired_.clear(); tabs_needing_unload_fired_.clear(); is_attempting_to_close_browser_ = false; content::NotificationService::current()->Notify( chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED, content::Source(browser_), content::NotificationService::NoDetails()); } ",0 "PHP_FUNCTION(connection_status) { RETURN_LONG(PG(connection_status)); } ",0 "calc_rate (wgint bytes, double secs, int *units) { double dlrate; double bibyte = 1000.0; if (!opt.report_bps) bibyte = 1024.0; assert (secs >= 0); assert (bytes >= 0); if (secs == 0) /* If elapsed time is exactly zero, it means we're under the resolution of the timer. This can easily happen on systems that use time() for the timer. Since the interval lies between 0 and the timer's resolution, assume half the resolution. */ secs = ptimer_resolution () / 2.0; dlrate = convert_to_bits (bytes) / secs; if (dlrate < bibyte) *units = 0; else if (dlrate < (bibyte * bibyte)) *units = 1, dlrate /= bibyte; else if (dlrate < (bibyte * bibyte * bibyte)) *units = 2, dlrate /= (bibyte * bibyte); else /* Maybe someone will need this, one day. */ *units = 3, dlrate /= (bibyte * bibyte * bibyte); return dlrate; } ",0 "ProcRenderQueryPictFormats (ClientPtr client) { RenderClientPtr pRenderClient = GetRenderClient (client); xRenderQueryPictFormatsReply *reply; xPictScreen *pictScreen; xPictDepth *pictDepth; xPictVisual *pictVisual; xPictFormInfo *pictForm; CARD32 *pictSubpixel; ScreenPtr pScreen; VisualPtr pVisual; DepthPtr pDepth; int v, d; PictureScreenPtr ps; PictFormatPtr pFormat; int nformat; int ndepth; int nvisual; int rlength; int s; int n; int numScreens; int numSubpixel; /* REQUEST(xRenderQueryPictFormatsReq); */ REQUEST_SIZE_MATCH(xRenderQueryPictFormatsReq); #ifdef PANORAMIX if (noPanoramiXExtension) numScreens = screenInfo.numScreens; else numScreens = ((xConnSetup *)ConnectionInfo)->numRoots; #else numScreens = screenInfo.numScreens; #endif ndepth = nformat = nvisual = 0; for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; for (d = 0; d < pScreen->numDepths; d++) { pDepth = pScreen->allowedDepths + d; ++ndepth; for (v = 0; v < pDepth->numVids; v++) { pVisual = findVisual (pScreen, pDepth->vids[v]); if (pVisual && PictureMatchVisual (pScreen, pDepth->depth, pVisual)) ++nvisual; } } ps = GetPictureScreenIfSet(pScreen); if (ps) nformat += ps->nformats; } if (pRenderClient->major_version == 0 && pRenderClient->minor_version < 6) numSubpixel = 0; else numSubpixel = numScreens; rlength = (sizeof (xRenderQueryPictFormatsReply) + nformat * sizeof (xPictFormInfo) + numScreens * sizeof (xPictScreen) + ndepth * sizeof (xPictDepth) + nvisual * sizeof (xPictVisual) + numSubpixel * sizeof (CARD32)); reply = (xRenderQueryPictFormatsReply *) calloc(1, rlength); if (!reply) return BadAlloc; reply->type = X_Reply; reply->sequenceNumber = client->sequence; reply->length = bytes_to_int32(rlength - sizeof(xGenericReply)); reply->numFormats = nformat; reply->numScreens = numScreens; reply->numDepths = ndepth; reply->numVisuals = nvisual; reply->numSubpixel = numSubpixel; pictForm = (xPictFormInfo *) (reply + 1); for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; ps = GetPictureScreenIfSet(pScreen); if (ps) { for (nformat = 0, pFormat = ps->formats; nformat < ps->nformats; nformat++, pFormat++) { pictForm->id = pFormat->id; pictForm->type = pFormat->type; pictForm->depth = pFormat->depth; pictForm->direct.red = pFormat->direct.red; pictForm->direct.redMask = pFormat->direct.redMask; pictForm->direct.green = pFormat->direct.green; pictForm->direct.greenMask = pFormat->direct.greenMask; pictForm->direct.blue = pFormat->direct.blue; pictForm->direct.blueMask = pFormat->direct.blueMask; pictForm->direct.alpha = pFormat->direct.alpha; pictForm->direct.alphaMask = pFormat->direct.alphaMask; if (pFormat->type == PictTypeIndexed && pFormat->index.pColormap) pictForm->colormap = pFormat->index.pColormap->mid; else pictForm->colormap = None; if (client->swapped) { swapl (&pictForm->id, n); swaps (&pictForm->direct.red, n); swaps (&pictForm->direct.redMask, n); swaps (&pictForm->direct.green, n); swaps (&pictForm->direct.greenMask, n); swaps (&pictForm->direct.blue, n); swaps (&pictForm->direct.blueMask, n); swaps (&pictForm->direct.alpha, n); swaps (&pictForm->direct.alphaMask, n); swapl (&pictForm->colormap, n); } pictForm++; } } } pictScreen = (xPictScreen *) pictForm; for (s = 0; s < numScreens; s++) { pScreen = screenInfo.screens[s]; pictDepth = (xPictDepth *) (pictScreen + 1); ndepth = 0; for (d = 0; d < pScreen->numDepths; d++) { pictVisual = (xPictVisual *) (pictDepth + 1); pDepth = pScreen->allowedDepths + d; nvisual = 0; for (v = 0; v < pDepth->numVids; v++) { pVisual = findVisual (pScreen, pDepth->vids[v]); if (pVisual && (pFormat = PictureMatchVisual (pScreen, pDepth->depth, pVisual))) { pictVisual->visual = pVisual->vid; pictVisual->format = pFormat->id; if (client->swapped) { swapl (&pictVisual->visual, n); swapl (&pictVisual->format, n); } pictVisual++; nvisual++; } } pictDepth->depth = pDepth->depth; pictDepth->nPictVisuals = nvisual; if (client->swapped) { swaps (&pictDepth->nPictVisuals, n); } ndepth++; pictDepth = (xPictDepth *) pictVisual; } pictScreen->nDepth = ndepth; ps = GetPictureScreenIfSet(pScreen); if (ps) pictScreen->fallback = ps->fallback->id; else pictScreen->fallback = 0; if (client->swapped) { swapl (&pictScreen->nDepth, n); swapl (&pictScreen->fallback, n); } pictScreen = (xPictScreen *) pictDepth; } pictSubpixel = (CARD32 *) pictScreen; for (s = 0; s < numSubpixel; s++) { pScreen = screenInfo.screens[s]; ps = GetPictureScreenIfSet(pScreen); if (ps) *pictSubpixel = ps->subpixel; else *pictSubpixel = SubPixelUnknown; if (client->swapped) { swapl (pictSubpixel, n); } ++pictSubpixel; } if (client->swapped) { swaps (&reply->sequenceNumber, n); swapl (&reply->length, n); swapl (&reply->numFormats, n); swapl (&reply->numScreens, n); swapl (&reply->numDepths, n); swapl (&reply->numVisuals, n); swapl (&reply->numSubpixel, n); } WriteToClient(client, rlength, (char *) reply); free(reply); return Success; } ",0 "AVCPBProperties *ff_add_cpb_side_data(AVCodecContext *avctx) { AVPacketSideData *tmp; AVCPBProperties *props; size_t size; props = av_cpb_properties_alloc(&size); if (!props) return NULL; tmp = av_realloc_array(avctx->coded_side_data, avctx->nb_coded_side_data + 1, sizeof(*tmp)); if (!tmp) { av_freep(&props); return NULL; } avctx->coded_side_data = tmp; avctx->nb_coded_side_data++; avctx->coded_side_data[avctx->nb_coded_side_data - 1].type = AV_PKT_DATA_CPB_PROPERTIES; avctx->coded_side_data[avctx->nb_coded_side_data - 1].data = (uint8_t*)props; avctx->coded_side_data[avctx->nb_coded_side_data - 1].size = size; return props; } ",0 "linux_lvm2_vg_add_pv_completed_cb (DBusGMethodInvocation *context, Device *device, gboolean job_was_cancelled, int status, const char *stderr, const char *stdout, gpointer user_data) { if (WEXITSTATUS (status) == 0 && !job_was_cancelled) { dbus_g_method_return (context); } else { if (job_was_cancelled) { throw_error (context, ERROR_CANCELLED, ""Job was cancelled""); } else { throw_error (context, ERROR_FAILED, ""Error adding PV for LVM2 Volume Group: vgextend exited with exit code %d: %s"", WEXITSTATUS (status), stderr); } } } ",0 "R_API RConfigNode* r_config_set_i(RConfig *cfg, const char *name, const ut64 i) { char buf[128], *ov = NULL; if (!cfg || !name) { return NULL; } RConfigNode *node = r_config_node_get (cfg, name); if (node) { if (node->flags & CN_RO) { node = NULL; goto beach; } if (node->value) { ov = strdup (node->value); if (!ov) { node = NULL; goto beach; } free (node->value); } if (node->flags & CN_BOOL) { node->value = strdup (r_str_bool (i)); } else { snprintf (buf, sizeof (buf) - 1, ""%"" PFMT64d, i); node->value = strdup (buf); } if (!node->value) { node = NULL; goto beach; } node->i_value = i; } else { if (!cfg->lock) { if (i < 1024) { snprintf (buf, sizeof (buf), ""%"" PFMT64d """", i); } else { snprintf (buf, sizeof (buf), ""0x%08"" PFMT64x """", i); } node = r_config_node_new (name, buf); if (!node) { node = NULL; goto beach; } node->flags = CN_RW | CN_OFFT; node->i_value = i; if (cfg->ht) { ht_insert (cfg->ht, node->name, node); } if (cfg->nodes) { r_list_append (cfg->nodes, node); cfg->n_nodes++; } } else { eprintf (""(locked: no new keys can be created (%s))\n"", name); } } if (node && node->setter) { ut64 oi = node->i_value; int ret = node->setter (cfg->user, node); if (!ret) { node->i_value = oi; free (node->value); node->value = strdup (ov? ov: """"); } } beach: free (ov); return node; } ",0 "void ArthurOutputDev::stroke(GfxState *state) { m_painter->drawPath( convertPath( state, state->getPath(), Qt::OddEvenFill ) ); } ",0 "inline bool SearchBuffer::isBadMatch(const UChar* match, size_t matchLength) const { if (!m_targetRequiresKanaWorkaround) return false; normalizeCharacters(match, matchLength, m_normalizedMatch); const UChar* a = m_normalizedTarget.begin(); const UChar* aEnd = m_normalizedTarget.end(); const UChar* b = m_normalizedMatch.begin(); const UChar* bEnd = m_normalizedMatch.end(); while (true) { while (a != aEnd && !isKanaLetter(*a)) ++a; while (b != bEnd && !isKanaLetter(*b)) ++b; if (a == aEnd || b == bEnd) { ASSERT(a == aEnd); ASSERT(b == bEnd); return false; } if (isSmallKanaLetter(*a) != isSmallKanaLetter(*b)) return true; if (composedVoicedSoundMark(*a) != composedVoicedSoundMark(*b)) return true; ++a; ++b; while (1) { if (!(a != aEnd && isCombiningVoicedSoundMark(*a))) { if (b != bEnd && isCombiningVoicedSoundMark(*b)) return true; break; } if (!(b != bEnd && isCombiningVoicedSoundMark(*b))) return true; if (*a != *b) return true; ++a; ++b; } } } ",0 "int ssl3_get_client_hello(SSL *s) { int i,j,ok,al,ret= -1; unsigned int cookie_len; long n; unsigned long id; unsigned char *p,*d,*q; SSL_CIPHER *c; #ifndef OPENSSL_NO_COMP SSL_COMP *comp=NULL; #endif STACK_OF(SSL_CIPHER) *ciphers=NULL; /* We do this so that we will respond with our native type. * If we are TLSv1 and we get SSLv3, we will respond with TLSv1, * This down switching should be handled by a different method. * If we are SSLv3, we will respond with SSLv3, even if prompted with * TLSv1. */ if (s->state == SSL3_ST_SR_CLNT_HELLO_A ) { s->state=SSL3_ST_SR_CLNT_HELLO_B; } s->first_packet=1; n=s->method->ssl_get_message(s, SSL3_ST_SR_CLNT_HELLO_B, SSL3_ST_SR_CLNT_HELLO_C, SSL3_MT_CLIENT_HELLO, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return((int)n); s->first_packet=0; d=p=(unsigned char *)s->init_msg; /* use version from inside client hello, not from record header * (may differ: see RFC 2246, Appendix E, second paragraph) */ s->client_version=(((int)p[0])<<8)|(int)p[1]; p+=2; if ((s->version == DTLS1_VERSION && s->client_version > s->version) || (s->version != DTLS1_VERSION && s->client_version < s->version)) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_WRONG_VERSION_NUMBER); if ((s->client_version>>8) == SSL3_VERSION_MAJOR && !s->enc_write_ctx && !s->write_hash) { /* similar to ssl3_get_record, send alert using remote version number */ s->version = s->client_version; } al = SSL_AD_PROTOCOL_VERSION; goto f_err; } /* If we require cookies and this ClientHello doesn't * contain one, just return since we do not want to * allocate any memory yet. So check cookie length... */ if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) { unsigned int session_length, cookie_length; session_length = *(p + SSL3_RANDOM_SIZE); cookie_length = *(p + SSL3_RANDOM_SIZE + session_length + 1); if (cookie_length == 0) return 1; } /* load the client random */ memcpy(s->s3->client_random,p,SSL3_RANDOM_SIZE); p+=SSL3_RANDOM_SIZE; /* get the session-id */ j= *(p++); s->hit=0; /* Versions before 0.9.7 always allow clients to resume sessions in renegotiation. * 0.9.7 and later allow this by default, but optionally ignore resumption requests * with flag SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION (it's a new flag rather * than a change to default behavior so that applications relying on this for security * won't even compile against older library versions). * * 1.0.1 and later also have a function SSL_renegotiate_abbreviated() to request * renegotiation but not a new session (s->new_session remains unset): for servers, * this essentially just means that the SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION * setting will be ignored. */ if ((s->new_session && (s->options & SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION))) { if (!ssl_get_new_session(s,1)) goto err; } else { i=ssl_get_prev_session(s, p, j, d + n); if (i == 1) { /* previous session */ s->hit=1; } else if (i == -1) goto err; else /* i == 0 */ { if (!ssl_get_new_session(s,1)) goto err; } } p+=j; if (s->version == DTLS1_VERSION || s->version == DTLS1_BAD_VER) { /* cookie stuff */ cookie_len = *(p++); /* * The ClientHello may contain a cookie even if the * HelloVerify message has not been sent--make sure that it * does not cause an overflow. */ if ( cookie_len > sizeof(s->d1->rcvd_cookie)) { /* too much data */ al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } /* verify the cookie if appropriate option is set. */ if ((SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) && cookie_len > 0) { memcpy(s->d1->rcvd_cookie, p, cookie_len); if ( s->ctx->app_verify_cookie_cb != NULL) { if ( s->ctx->app_verify_cookie_cb(s, s->d1->rcvd_cookie, cookie_len) == 0) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } /* else cookie verification succeeded */ } else if ( memcmp(s->d1->rcvd_cookie, s->d1->cookie, s->d1->cookie_len) != 0) /* default verification */ { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_COOKIE_MISMATCH); goto f_err; } ret = 2; } p += cookie_len; } n2s(p,i); if ((i == 0) && (j != 0)) { /* we need a cipher if we are not resuming a session */ al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_CIPHERS_SPECIFIED); goto f_err; } if ((p+i) >= (d+n)) { /* not enough data */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_LENGTH_MISMATCH); goto f_err; } if ((i > 0) && (ssl_bytes_to_cipher_list(s,p,i,&(ciphers)) == NULL)) { goto err; } p+=i; /* If it is a hit, check that the cipher is in the list */ if ((s->hit) && (i > 0)) { j=0; id=s->session->cipher->id; #ifdef CIPHER_DEBUG printf(""client sent %d ciphers\n"",sk_num(ciphers)); #endif for (i=0; iid == id) { j=1; break; } } /* Disabled because it can be used in a ciphersuite downgrade * attack: CVE-2010-4180. */ #if 0 if (j == 0 && (s->options & SSL_OP_NETSCAPE_REUSE_CIPHER_CHANGE_BUG) && (sk_SSL_CIPHER_num(ciphers) == 1)) { /* Special case as client bug workaround: the previously used cipher may * not be in the current list, the client instead might be trying to * continue using a cipher that before wasn't chosen due to server * preferences. We'll have to reject the connection if the cipher is not * enabled, though. */ c = sk_SSL_CIPHER_value(ciphers, 0); if (sk_SSL_CIPHER_find(SSL_get_ciphers(s), c) >= 0) { s->session->cipher = c; j = 1; } } #endif if (j == 0) { /* we need to have the cipher in the cipher * list if we are asked to reuse it */ al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_REQUIRED_CIPHER_MISSING); goto f_err; } } /* compression */ i= *(p++); if ((p+i) > (d+n)) { /* not enough data */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_LENGTH_MISMATCH); goto f_err; } q=p; for (j=0; j= i) { /* no compress */ al=SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_COMPRESSION_SPECIFIED); goto f_err; } #ifndef OPENSSL_NO_TLSEXT /* TLS extensions*/ if (s->version >= SSL3_VERSION) { if (!ssl_parse_clienthello_tlsext(s,&p,d,n, &al)) { /* 'al' set by ssl_parse_clienthello_tlsext */ SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_PARSE_TLSEXT); goto f_err; } } if (ssl_check_clienthello_tlsext_early(s) <= 0) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT); goto err; } /* Check if we want to use external pre-shared secret for this * handshake for not reused session only. We need to generate * server_random before calling tls_session_secret_cb in order to allow * SessionTicket processing to use it in key derivation. */ { unsigned char *pos; pos=s->s3->server_random; if (ssl_fill_hello_random(s, 1, pos, SSL3_RANDOM_SIZE) <= 0) { al=SSL_AD_INTERNAL_ERROR; goto f_err; } } if (!s->hit && s->version >= TLS1_VERSION && s->tls_session_secret_cb) { SSL_CIPHER *pref_cipher=NULL; s->session->master_key_length=sizeof(s->session->master_key); if(s->tls_session_secret_cb(s, s->session->master_key, &s->session->master_key_length, ciphers, &pref_cipher, s->tls_session_secret_cb_arg)) { s->hit=1; s->session->ciphers=ciphers; s->session->verify_result=X509_V_OK; ciphers=NULL; /* check if some cipher was preferred by call back */ pref_cipher=pref_cipher ? pref_cipher : ssl3_choose_cipher(s, s->session->ciphers, SSL_get_ciphers(s)); if (pref_cipher == NULL) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_SHARED_CIPHER); goto f_err; } s->session->cipher=pref_cipher; if (s->cipher_list) sk_SSL_CIPHER_free(s->cipher_list); if (s->cipher_list_by_id) sk_SSL_CIPHER_free(s->cipher_list_by_id); s->cipher_list = sk_SSL_CIPHER_dup(s->session->ciphers); s->cipher_list_by_id = sk_SSL_CIPHER_dup(s->session->ciphers); } } #endif /* Worst case, we will use the NULL compression, but if we have other * options, we will now look for them. We have i-1 compression * algorithms from the client, starting at q. */ s->s3->tmp.new_compression=NULL; #ifndef OPENSSL_NO_COMP /* This only happens if we have a cache hit */ if (s->session->compress_meth != 0) { int m, comp_id = s->session->compress_meth; /* Perform sanity checks on resumed compression algorithm */ /* Can't disable compression */ if (s->options & SSL_OP_NO_COMPRESSION) { al=SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INCONSISTENT_COMPRESSION); goto f_err; } /* Look for resumed compression method */ for (m = 0; m < sk_SSL_COMP_num(s->ctx->comp_methods); m++) { comp=sk_SSL_COMP_value(s->ctx->comp_methods,m); if (comp_id == comp->id) { s->s3->tmp.new_compression=comp; break; } } if (s->s3->tmp.new_compression == NULL) { al=SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INVALID_COMPRESSION_ALGORITHM); goto f_err; } /* Look for resumed method in compression list */ for (m = 0; m < i; m++) { if (q[m] == comp_id) break; } if (m >= i) { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_REQUIRED_COMPRESSSION_ALGORITHM_MISSING); goto f_err; } } else if (s->hit) comp = NULL; else if (!(s->options & SSL_OP_NO_COMPRESSION) && s->ctx->comp_methods) { /* See if we have a match */ int m,nn,o,v,done=0; nn=sk_SSL_COMP_num(s->ctx->comp_methods); for (m=0; mctx->comp_methods,m); v=comp->id; for (o=0; os3->tmp.new_compression=comp; else comp=NULL; } #else /* If compression is disabled we'd better not try to resume a session * using compression. */ if (s->session->compress_meth != 0) { al=SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_INCONSISTENT_COMPRESSION); goto f_err; } #endif /* Given s->session->ciphers and SSL_get_ciphers, we must * pick a cipher */ if (!s->hit) { #ifdef OPENSSL_NO_COMP s->session->compress_meth=0; #else s->session->compress_meth=(comp == NULL)?0:comp->id; #endif if (s->session->ciphers != NULL) sk_SSL_CIPHER_free(s->session->ciphers); s->session->ciphers=ciphers; if (ciphers == NULL) { al=SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_CIPHERS_PASSED); goto f_err; } ciphers=NULL; c=ssl3_choose_cipher(s,s->session->ciphers, SSL_get_ciphers(s)); if (c == NULL) { al=SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO,SSL_R_NO_SHARED_CIPHER); goto f_err; } s->s3->tmp.new_cipher=c; } else { /* Session-id reuse */ #ifdef REUSE_CIPHER_BUG STACK_OF(SSL_CIPHER) *sk; SSL_CIPHER *nc=NULL; SSL_CIPHER *ec=NULL; if (s->options & SSL_OP_NETSCAPE_DEMO_CIPHER_CHANGE_BUG) { sk=s->session->ciphers; for (i=0; ialgorithm_enc & SSL_eNULL) nc=c; if (SSL_C_IS_EXPORT(c)) ec=c; } if (nc != NULL) s->s3->tmp.new_cipher=nc; else if (ec != NULL) s->s3->tmp.new_cipher=ec; else s->s3->tmp.new_cipher=s->session->cipher; } else #endif s->s3->tmp.new_cipher=s->session->cipher; } if (TLS1_get_version(s) < TLS1_2_VERSION || !(s->verify_mode & SSL_VERIFY_PEER)) { if (!ssl3_digest_cached_records(s)) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } } /* we now have the following setup. * client_random * cipher_list - our prefered list of ciphers * ciphers - the clients prefered list of ciphers * compression - basically ignored right now * ssl version is set - sslv3 * s->session - The ssl session has been setup. * s->hit - session reuse flag * s->tmp.new_cipher - the new cipher to use. */ /* Handles TLS extensions that we couldn't check earlier */ if (s->version >= SSL3_VERSION) { if (ssl_check_clienthello_tlsext_late(s) <= 0) { SSLerr(SSL_F_SSL3_GET_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); goto err; } } if (ret < 0) ret=1; if (0) { f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); } err: if (ciphers != NULL) sk_SSL_CIPHER_free(ciphers); return(ret); } ",0 "void HTMLInputElement::updatePlaceholderText() { return m_inputType->updatePlaceholderText(); } ",0 "struct dst_entry *inet_csk_update_pmtu(struct sock *sk, u32 mtu) { struct dst_entry *dst = __sk_dst_check(sk, 0); struct inet_sock *inet = inet_sk(sk); if (!dst) { dst = inet_csk_rebuild_route(sk, &inet->cork.fl); if (!dst) goto out; } dst->ops->update_pmtu(dst, sk, NULL, mtu); dst = __sk_dst_check(sk, 0); if (!dst) dst = inet_csk_rebuild_route(sk, &inet->cork.fl); out: return dst; } ",0 "IntPoint FrameView::convertFromContainingView(const IntPoint& parentPoint) const { if (const ScrollView* parentScrollView = toScrollView(parent())) { if (parentScrollView->isFrameView()) { const FrameView* parentView = toFrameView(parentScrollView); RenderPart* renderer = m_frame->ownerRenderer(); if (!renderer) return parentPoint; IntPoint point = parentView->convertToRenderer(*renderer, parentPoint); point.move(-renderer->borderLeft() - renderer->paddingLeft(), -renderer->borderTop() - renderer->paddingTop()); return point; } return Widget::convertFromContainingView(parentPoint); } return parentPoint; } ",0 "GahpClient::globus_gram_client_error_string(int error_code) { static char buf[200]; static const char* command = ""GRAM_ERROR_STRING""; if (server->m_commands_supported->contains_anycase(command)==FALSE) { strcpy(buf,""Unknown error""); return buf; } int x = snprintf(buf,sizeof(buf),""%s %d"",command,error_code); ASSERT( x > 0 && x < (int)sizeof(buf) ); server->write_line(buf); Gahp_Args result; server->read_argv(result); if ( result.argc < 2 || result.argv[0][0] != 'S' ) { dprintf(D_ALWAYS,""GAHP command '%s' failed: error_code=%d\n"", command,error_code); return NULL; } strncpy(buf,result.argv[1],sizeof(buf)-1); buf[sizeof(buf)-1] = '\0'; return buf; } ",0 "MojoAudioInputStream::MojoAudioInputStream( mojom::AudioInputStreamRequest request, mojom::AudioInputStreamClientPtr client, CreateDelegateCallback create_delegate_callback, StreamCreatedCallback stream_created_callback, base::OnceClosure deleter_callback) : stream_created_callback_(std::move(stream_created_callback)), deleter_callback_(std::move(deleter_callback)), binding_(this, std::move(request)), client_(std::move(client)), weak_factory_(this) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); DCHECK(stream_created_callback_); DCHECK(deleter_callback_); binding_.set_connection_error_handler( base::BindOnce(&MojoAudioInputStream::OnError, base::Unretained(this))); client_.set_connection_error_handler( base::BindOnce(&MojoAudioInputStream::OnError, base::Unretained(this))); delegate_ = std::move(create_delegate_callback).Run(this); if (!delegate_) { binding_.Close(); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&MojoAudioInputStream::OnStreamError, weak_factory_.GetWeakPtr(), /* not used */ 0)); } } ",0 "static inline int tcp_packet_delayed(const struct tcp_sock *tp) { return !tp->retrans_stamp || (tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr && before(tp->rx_opt.rcv_tsecr, tp->retrans_stamp)); } ",0 "static int chacha20_poly1305_ctrl(EVP_CIPHER_CTX *ctx, int type, int arg, void *ptr) { EVP_CHACHA_AEAD_CTX *actx = aead_data(ctx); switch(type) { case EVP_CTRL_INIT: if (actx == NULL) actx = ctx->cipher_data = OPENSSL_zalloc(sizeof(*actx) + Poly1305_ctx_size()); if (actx == NULL) { EVPerr(EVP_F_CHACHA20_POLY1305_CTRL, EVP_R_INITIALIZATION_ERROR); return 0; } actx->len.aad = 0; actx->len.text = 0; actx->aad = 0; actx->mac_inited = 0; actx->tag_len = 0; actx->nonce_len = 12; actx->tls_payload_length = NO_TLS_PAYLOAD_LENGTH; return 1; case EVP_CTRL_COPY: if (actx) { EVP_CIPHER_CTX *dst = (EVP_CIPHER_CTX *)ptr; dst->cipher_data = OPENSSL_memdup(actx, sizeof(*actx) + Poly1305_ctx_size()); if (dst->cipher_data == NULL) { EVPerr(EVP_F_CHACHA20_POLY1305_CTRL, EVP_R_COPY_ERROR); return 0; } } return 1; case EVP_CTRL_AEAD_SET_IVLEN: if (arg <= 0 || arg > CHACHA_CTR_SIZE) return 0; actx->nonce_len = arg; return 1; case EVP_CTRL_AEAD_SET_IV_FIXED: if (arg != 12) return 0; actx->nonce[0] = actx->key.counter[1] = CHACHA_U8TOU32((unsigned char *)ptr); actx->nonce[1] = actx->key.counter[2] = CHACHA_U8TOU32((unsigned char *)ptr+4); actx->nonce[2] = actx->key.counter[3] = CHACHA_U8TOU32((unsigned char *)ptr+8); return 1; case EVP_CTRL_AEAD_SET_TAG: if (arg <= 0 || arg > POLY1305_BLOCK_SIZE) return 0; if (ptr != NULL) { memcpy(actx->tag, ptr, arg); actx->tag_len = arg; } return 1; case EVP_CTRL_AEAD_GET_TAG: if (arg <= 0 || arg > POLY1305_BLOCK_SIZE || !ctx->encrypt) return 0; memcpy(ptr, actx->tag, arg); return 1; case EVP_CTRL_AEAD_TLS1_AAD: if (arg != EVP_AEAD_TLS1_AAD_LEN) return 0; { unsigned int len; unsigned char *aad = ptr, temp[POLY1305_BLOCK_SIZE]; len = aad[EVP_AEAD_TLS1_AAD_LEN - 2] << 8 | aad[EVP_AEAD_TLS1_AAD_LEN - 1]; if (!ctx->encrypt) { len -= POLY1305_BLOCK_SIZE; /* discount attached tag */ memcpy(temp, aad, EVP_AEAD_TLS1_AAD_LEN - 2); aad = temp; temp[EVP_AEAD_TLS1_AAD_LEN - 2] = (unsigned char)(len >> 8); temp[EVP_AEAD_TLS1_AAD_LEN - 1] = (unsigned char)len; } actx->tls_payload_length = len; /* * merge record sequence number as per * draft-ietf-tls-chacha20-poly1305-03 */ actx->key.counter[1] = actx->nonce[0]; actx->key.counter[2] = actx->nonce[1] ^ CHACHA_U8TOU32(aad); actx->key.counter[3] = actx->nonce[2] ^ CHACHA_U8TOU32(aad+4); actx->mac_inited = 0; chacha20_poly1305_cipher(ctx, NULL, aad, EVP_AEAD_TLS1_AAD_LEN); return POLY1305_BLOCK_SIZE; /* tag length */ } case EVP_CTRL_AEAD_SET_MAC_KEY: /* no-op */ return 1; default: return -1; } } ",1 "static sctp_disposition_t sctp_sf_do_unexpected_init( struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { sctp_disposition_t retval; struct sctp_chunk *chunk = arg; struct sctp_chunk *repl; struct sctp_association *new_asoc; struct sctp_chunk *err_chunk; struct sctp_packet *packet; sctp_unrecognized_param_t *unk_param; int len; /* 6.10 Bundling * An endpoint MUST NOT bundle INIT, INIT ACK or * SHUTDOWN COMPLETE with any other chunks. * * IG Section 2.11.2 * Furthermore, we require that the receiver of an INIT chunk MUST * enforce these rules by silently discarding an arriving packet * with an INIT chunk that is bundled with other chunks. */ if (!chunk->singleton) return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); /* 3.1 A packet containing an INIT chunk MUST have a zero Verification * Tag. */ if (chunk->sctp_hdr->vtag != 0) return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands); /* Make sure that the INIT chunk has a valid length. * In this case, we generate a protocol violation since we have * an association established. */ if (!sctp_chunk_length_valid(chunk, sizeof(sctp_init_chunk_t))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands); /* Grab the INIT header. */ chunk->subh.init_hdr = (sctp_inithdr_t *) chunk->skb->data; /* Tag the variable length parameters. */ chunk->param_hdr.v = skb_pull(chunk->skb, sizeof(sctp_inithdr_t)); /* Verify the INIT chunk before processing it. */ err_chunk = NULL; if (!sctp_verify_init(net, asoc, chunk->chunk_hdr->type, (sctp_init_chunk_t *)chunk->chunk_hdr, chunk, &err_chunk)) { /* This chunk contains fatal error. It is to be discarded. * Send an ABORT, with causes if there is any. */ if (err_chunk) { packet = sctp_abort_pkt_new(net, ep, asoc, arg, (__u8 *)(err_chunk->chunk_hdr) + sizeof(sctp_chunkhdr_t), ntohs(err_chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t)); if (packet) { sctp_add_cmd_sf(commands, SCTP_CMD_SEND_PKT, SCTP_PACKET(packet)); SCTP_INC_STATS(net, SCTP_MIB_OUTCTRLCHUNKS); retval = SCTP_DISPOSITION_CONSUME; } else { retval = SCTP_DISPOSITION_NOMEM; } goto cleanup; } else { return sctp_sf_tabort_8_4_8(net, ep, asoc, type, arg, commands); } } /* * Other parameters for the endpoint SHOULD be copied from the * existing parameters of the association (e.g. number of * outbound streams) into the INIT ACK and cookie. * FIXME: We are copying parameters from the endpoint not the * association. */ new_asoc = sctp_make_temp_asoc(ep, chunk, GFP_ATOMIC); if (!new_asoc) goto nomem; if (sctp_assoc_set_bind_addr_from_ep(new_asoc, sctp_scope(sctp_source(chunk)), GFP_ATOMIC) < 0) goto nomem; /* In the outbound INIT ACK the endpoint MUST copy its current * Verification Tag and Peers Verification tag into a reserved * place (local tie-tag and per tie-tag) within the state cookie. */ if (!sctp_process_init(new_asoc, chunk, sctp_source(chunk), (sctp_init_chunk_t *)chunk->chunk_hdr, GFP_ATOMIC)) goto nomem; /* Make sure no new addresses are being added during the * restart. Do not do this check for COOKIE-WAIT state, * since there are no peer addresses to check against. * Upon return an ABORT will have been sent if needed. */ if (!sctp_state(asoc, COOKIE_WAIT)) { if (!sctp_sf_check_restart_addrs(new_asoc, asoc, chunk, commands)) { retval = SCTP_DISPOSITION_CONSUME; goto nomem_retval; } } sctp_tietags_populate(new_asoc, asoc); /* B) ""Z"" shall respond immediately with an INIT ACK chunk. */ /* If there are errors need to be reported for unknown parameters, * make sure to reserve enough room in the INIT ACK for them. */ len = 0; if (err_chunk) { len = ntohs(err_chunk->chunk_hdr->length) - sizeof(sctp_chunkhdr_t); } repl = sctp_make_init_ack(new_asoc, chunk, GFP_ATOMIC, len); if (!repl) goto nomem; /* If there are errors need to be reported for unknown parameters, * include them in the outgoing INIT ACK as ""Unrecognized parameter"" * parameter. */ if (err_chunk) { /* Get the ""Unrecognized parameter"" parameter(s) out of the * ERROR chunk generated by sctp_verify_init(). Since the * error cause code for ""unknown parameter"" and the * ""Unrecognized parameter"" type is the same, we can * construct the parameters in INIT ACK by copying the * ERROR causes over. */ unk_param = (sctp_unrecognized_param_t *) ((__u8 *)(err_chunk->chunk_hdr) + sizeof(sctp_chunkhdr_t)); /* Replace the cause code with the ""Unrecognized parameter"" * parameter type. */ sctp_addto_chunk(repl, len, unk_param); } sctp_add_cmd_sf(commands, SCTP_CMD_NEW_ASOC, SCTP_ASOC(new_asoc)); sctp_add_cmd_sf(commands, SCTP_CMD_REPLY, SCTP_CHUNK(repl)); /* * Note: After sending out INIT ACK with the State Cookie parameter, * ""Z"" MUST NOT allocate any resources for this new association. * Otherwise, ""Z"" will be vulnerable to resource attacks. */ sctp_add_cmd_sf(commands, SCTP_CMD_DELETE_TCB, SCTP_NULL()); retval = SCTP_DISPOSITION_CONSUME; return retval; nomem: retval = SCTP_DISPOSITION_NOMEM; nomem_retval: if (new_asoc) sctp_association_free(new_asoc); cleanup: if (err_chunk) sctp_chunk_free(err_chunk); return retval; } ",0 "void PaymentHandlerWebFlowViewController::AddNewContents( content::WebContents* source, std::unique_ptr new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_rect, bool user_gesture, bool* was_blocked) { Browser* browser = chrome::FindLastActiveWithProfile(profile_); if (browser && user_gesture && (disposition == WindowOpenDisposition::NEW_FOREGROUND_TAB || disposition == WindowOpenDisposition::NEW_POPUP)) { chrome::AddWebContents(browser, source, std::move(new_contents), disposition, initial_rect); } } ",0 "String InputType::VisibleValue() const { return GetElement().value(); } ",0 "void CustomButton::SetAnimationDuration(int duration) { hover_animation_->SetSlideDuration(duration); } ",0 "static long kvm_vm_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm *kvm = filp->private_data; void __user *argp = (void __user *)arg; int r; if (kvm->mm != current->mm) return -EIO; switch (ioctl) { case KVM_CREATE_VCPU: r = kvm_vm_ioctl_create_vcpu(kvm, arg); break; case KVM_ENABLE_CAP: { struct kvm_enable_cap cap; r = -EFAULT; if (copy_from_user(&cap, argp, sizeof(cap))) goto out; r = kvm_vm_ioctl_enable_cap_generic(kvm, &cap); break; } case KVM_SET_USER_MEMORY_REGION: { struct kvm_userspace_memory_region kvm_userspace_mem; r = -EFAULT; if (copy_from_user(&kvm_userspace_mem, argp, sizeof(kvm_userspace_mem))) goto out; r = kvm_vm_ioctl_set_memory_region(kvm, &kvm_userspace_mem); break; } case KVM_GET_DIRTY_LOG: { struct kvm_dirty_log log; r = -EFAULT; if (copy_from_user(&log, argp, sizeof(log))) goto out; r = kvm_vm_ioctl_get_dirty_log(kvm, &log); break; } #ifdef CONFIG_KVM_GENERIC_DIRTYLOG_READ_PROTECT case KVM_CLEAR_DIRTY_LOG: { struct kvm_clear_dirty_log log; r = -EFAULT; if (copy_from_user(&log, argp, sizeof(log))) goto out; r = kvm_vm_ioctl_clear_dirty_log(kvm, &log); break; } #endif #ifdef CONFIG_KVM_MMIO case KVM_REGISTER_COALESCED_MMIO: { struct kvm_coalesced_mmio_zone zone; r = -EFAULT; if (copy_from_user(&zone, argp, sizeof(zone))) goto out; r = kvm_vm_ioctl_register_coalesced_mmio(kvm, &zone); break; } case KVM_UNREGISTER_COALESCED_MMIO: { struct kvm_coalesced_mmio_zone zone; r = -EFAULT; if (copy_from_user(&zone, argp, sizeof(zone))) goto out; r = kvm_vm_ioctl_unregister_coalesced_mmio(kvm, &zone); break; } #endif case KVM_IRQFD: { struct kvm_irqfd data; r = -EFAULT; if (copy_from_user(&data, argp, sizeof(data))) goto out; r = kvm_irqfd(kvm, &data); break; } case KVM_IOEVENTFD: { struct kvm_ioeventfd data; r = -EFAULT; if (copy_from_user(&data, argp, sizeof(data))) goto out; r = kvm_ioeventfd(kvm, &data); break; } #ifdef CONFIG_HAVE_KVM_MSI case KVM_SIGNAL_MSI: { struct kvm_msi msi; r = -EFAULT; if (copy_from_user(&msi, argp, sizeof(msi))) goto out; r = kvm_send_userspace_msi(kvm, &msi); break; } #endif #ifdef __KVM_HAVE_IRQ_LINE case KVM_IRQ_LINE_STATUS: case KVM_IRQ_LINE: { struct kvm_irq_level irq_event; r = -EFAULT; if (copy_from_user(&irq_event, argp, sizeof(irq_event))) goto out; r = kvm_vm_ioctl_irq_line(kvm, &irq_event, ioctl == KVM_IRQ_LINE_STATUS); if (r) goto out; r = -EFAULT; if (ioctl == KVM_IRQ_LINE_STATUS) { if (copy_to_user(argp, &irq_event, sizeof(irq_event))) goto out; } r = 0; break; } #endif #ifdef CONFIG_HAVE_KVM_IRQ_ROUTING case KVM_SET_GSI_ROUTING: { struct kvm_irq_routing routing; struct kvm_irq_routing __user *urouting; struct kvm_irq_routing_entry *entries = NULL; r = -EFAULT; if (copy_from_user(&routing, argp, sizeof(routing))) goto out; r = -EINVAL; if (!kvm_arch_can_set_irq_routing(kvm)) goto out; if (routing.nr > KVM_MAX_IRQ_ROUTES) goto out; if (routing.flags) goto out; if (routing.nr) { r = -ENOMEM; entries = vmalloc(array_size(sizeof(*entries), routing.nr)); if (!entries) goto out; r = -EFAULT; urouting = argp; if (copy_from_user(entries, urouting->entries, routing.nr * sizeof(*entries))) goto out_free_irq_routing; } r = kvm_set_irq_routing(kvm, entries, routing.nr, routing.flags); out_free_irq_routing: vfree(entries); break; } #endif /* CONFIG_HAVE_KVM_IRQ_ROUTING */ case KVM_CREATE_DEVICE: { struct kvm_create_device cd; r = -EFAULT; if (copy_from_user(&cd, argp, sizeof(cd))) goto out; r = kvm_ioctl_create_device(kvm, &cd); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, &cd, sizeof(cd))) goto out; r = 0; break; } case KVM_CHECK_EXTENSION: r = kvm_vm_ioctl_check_extension_generic(kvm, arg); break; default: r = kvm_arch_vm_ioctl(filp, ioctl, arg); } out: return r; } ",0 "bgp_update_print(netdissect_options *ndo, const u_char *dat, int length) { struct bgp bgp; const u_char *p; int withdrawn_routes_len; int len; int i; ND_TCHECK2(dat[0], BGP_SIZE); if (length < BGP_SIZE) goto trunc; memcpy(&bgp, dat, BGP_SIZE); p = dat + BGP_SIZE; /*XXX*/ length -= BGP_SIZE; /* Unfeasible routes */ ND_TCHECK2(p[0], 2); if (length < 2) goto trunc; withdrawn_routes_len = EXTRACT_16BITS(p); p += 2; length -= 2; if (withdrawn_routes_len) { /* * Without keeping state from the original NLRI message, * it's not possible to tell if this a v4 or v6 route, * so only try to decode it if we're not v6 enabled. */ ND_TCHECK2(p[0], withdrawn_routes_len); if (length < withdrawn_routes_len) goto trunc; ND_PRINT((ndo, ""\n\t Withdrawn routes: %d bytes"", withdrawn_routes_len)); p += withdrawn_routes_len; length -= withdrawn_routes_len; } ND_TCHECK2(p[0], 2); if (length < 2) goto trunc; len = EXTRACT_16BITS(p); p += 2; length -= 2; if (withdrawn_routes_len == 0 && len == 0 && length == 0) { /* No withdrawn routes, no path attributes, no NLRI */ ND_PRINT((ndo, ""\n\t End-of-Rib Marker (empty NLRI)"")); return; } if (len) { /* do something more useful!*/ while (len) { int aflags, atype, alenlen, alen; ND_TCHECK2(p[0], 2); if (len < 2) goto trunc; if (length < 2) goto trunc; aflags = *p; atype = *(p + 1); p += 2; len -= 2; length -= 2; alenlen = bgp_attr_lenlen(aflags, p); ND_TCHECK2(p[0], alenlen); if (len < alenlen) goto trunc; if (length < alenlen) goto trunc; alen = bgp_attr_len(aflags, p); p += alenlen; len -= alenlen; length -= alenlen; ND_PRINT((ndo, ""\n\t %s (%u), length: %u"", tok2str(bgp_attr_values, ""Unknown Attribute"", atype), atype, alen)); if (aflags) { ND_PRINT((ndo, "", Flags [%s%s%s%s"", aflags & 0x80 ? ""O"" : """", aflags & 0x40 ? ""T"" : """", aflags & 0x20 ? ""P"" : """", aflags & 0x10 ? ""E"" : """")); if (aflags & 0xf) ND_PRINT((ndo, ""+%x"", aflags & 0xf)); ND_PRINT((ndo, ""]: "")); } if (len < alen) goto trunc; if (length < alen) goto trunc; if (!bgp_attr_print(ndo, atype, p, alen)) goto trunc; p += alen; len -= alen; length -= alen; } } if (length) { /* * XXX - what if they're using the ""Advertisement of * Multiple Paths in BGP"" feature: * * https://datatracker.ietf.org/doc/draft-ietf-idr-add-paths/ * * http://tools.ietf.org/html/draft-ietf-idr-add-paths-06 */ ND_PRINT((ndo, ""\n\t Updated routes:"")); while (length) { char buf[MAXHOSTNAMELEN + 100]; i = decode_prefix4(ndo, p, length, buf, sizeof(buf)); if (i == -1) { ND_PRINT((ndo, ""\n\t (illegal prefix length)"")); break; } else if (i == -2) goto trunc; else if (i == -3) goto trunc; /* bytes left, but not enough */ else { ND_PRINT((ndo, ""\n\t %s"", buf)); p += i; length -= i; } } } return; trunc: ND_PRINT((ndo, ""%s"", tstr)); } ",1 "int copy_mount_string(const void __user *data, char **where) { char *tmp; if (!data) { *where = NULL; return 0; } tmp = strndup_user(data, PAGE_SIZE); if (IS_ERR(tmp)) return PTR_ERR(tmp); *where = tmp; return 0; } ",0 "GF_Err gf_sm_load_init(GF_SceneLoader *load) { GF_Err e = GF_NOT_SUPPORTED; char *ext, szExt[50]; /*we need at least a scene graph*/ if (!load || (!load->ctx && !load->scene_graph) #ifndef GPAC_DISABLE_ISOM || (!load->fileName && !load->isom && !(load->flags & GF_SM_LOAD_FOR_PLAYBACK) ) #endif ) return GF_BAD_PARAM; if (!load->type) { #ifndef GPAC_DISABLE_ISOM if (load->isom) { load->type = GF_SM_LOAD_MP4; } else #endif { ext = (char *)strrchr(load->fileName, '.'); if (!ext) return GF_NOT_SUPPORTED; if (!stricmp(ext, "".gz"")) { char *anext; ext[0] = 0; anext = (char *)strrchr(load->fileName, '.'); ext[0] = '.'; ext = anext; } strcpy(szExt, &ext[1]); strlwr(szExt); if (strstr(szExt, ""bt"")) load->type = GF_SM_LOAD_BT; else if (strstr(szExt, ""wrl"")) load->type = GF_SM_LOAD_VRML; else if (strstr(szExt, ""x3dv"")) load->type = GF_SM_LOAD_X3DV; #ifndef GPAC_DISABLE_LOADER_XMT else if (strstr(szExt, ""xmt"") || strstr(szExt, ""xmta"")) load->type = GF_SM_LOAD_XMTA; else if (strstr(szExt, ""x3d"")) load->type = GF_SM_LOAD_X3D; #endif else if (strstr(szExt, ""swf"")) load->type = GF_SM_LOAD_SWF; else if (strstr(szExt, ""mov"")) load->type = GF_SM_LOAD_QT; else if (strstr(szExt, ""svg"")) load->type = GF_SM_LOAD_SVG; else if (strstr(szExt, ""xsr"")) load->type = GF_SM_LOAD_XSR; else if (strstr(szExt, ""xbl"")) load->type = GF_SM_LOAD_XBL; else if (strstr(szExt, ""xml"")) { char *rtype = gf_xml_get_root_type(load->fileName, &e); if (rtype) { if (!strcmp(rtype, ""SAFSession"")) load->type = GF_SM_LOAD_XSR; else if (!strcmp(rtype, ""XMT-A"")) load->type = GF_SM_LOAD_XMTA; else if (!strcmp(rtype, ""X3D"")) load->type = GF_SM_LOAD_X3D; else if (!strcmp(rtype, ""bindings"")) load->type = GF_SM_LOAD_XBL; gf_free(rtype); } } } } if (!load->type) return e; if (!load->scene_graph) load->scene_graph = load->ctx->scene_graph; switch (load->type) { #ifndef GPAC_DISABLE_LOADER_BT case GF_SM_LOAD_BT: case GF_SM_LOAD_VRML: case GF_SM_LOAD_X3DV: return gf_sm_load_init_bt(load); #endif #ifndef GPAC_DISABLE_LOADER_XMT case GF_SM_LOAD_XMTA: case GF_SM_LOAD_X3D: return gf_sm_load_init_xmt(load); #endif #ifndef GPAC_DISABLE_SVG case GF_SM_LOAD_SVG: case GF_SM_LOAD_XSR: case GF_SM_LOAD_DIMS: return gf_sm_load_init_svg(load); case GF_SM_LOAD_XBL: e = gf_sm_load_init_xbl(load); load->process = gf_sm_load_run_xbl; load->done = gf_sm_load_done_xbl; return e; #endif #ifndef GPAC_DISABLE_SWF_IMPORT case GF_SM_LOAD_SWF: return gf_sm_load_init_swf(load); #endif #ifndef GPAC_DISABLE_LOADER_ISOM case GF_SM_LOAD_MP4: return gf_sm_load_init_isom(load); #endif #ifndef GPAC_DISABLE_QTVR case GF_SM_LOAD_QT: return gf_sm_load_init_qt(load); #endif default: return GF_NOT_SUPPORTED; } return GF_NOT_SUPPORTED; } ",1 "int NsSetParameter (preproc_effect_t *effect, void *pParam, void *pValue) { int status = 0; return status; } ",1 "void __init trap_init(void) { return; } ",0 "create_browser () { GUI *g = &uzbl.gui; g->web_view = WEBKIT_WEB_VIEW (webkit_web_view_new ()); g_object_connect((GObject*)g->web_view, ""signal::key-press-event"", (GCallback)key_press_cb, NULL, ""signal::key-release-event"", (GCallback)key_release_cb, NULL, ""signal::button-press-event"", (GCallback)button_press_cb, NULL, ""signal::button-release-event"", (GCallback)button_release_cb, NULL, ""signal::title-changed"", (GCallback)title_change_cb, NULL, ""signal::selection-changed"", (GCallback)selection_changed_cb, NULL, ""signal::load-progress-changed"", (GCallback)progress_change_cb, NULL, ""signal::load-committed"", (GCallback)load_commit_cb, NULL, ""signal::load-started"", (GCallback)load_start_cb, NULL, ""signal::load-finished"", (GCallback)load_finish_cb, NULL, ""signal::load-error"", (GCallback)load_error_cb, NULL, ""signal::hovering-over-link"", (GCallback)link_hover_cb, NULL, ""signal::navigation-policy-decision-requested"", (GCallback)navigation_decision_cb, NULL, ""signal::new-window-policy-decision-requested"", (GCallback)new_window_cb, NULL, ""signal::download-requested"", (GCallback)download_cb, NULL, ""signal::create-web-view"", (GCallback)create_web_view_cb, NULL, ""signal::mime-type-policy-decision-requested"", (GCallback)mime_policy_cb, NULL, ""signal::populate-popup"", (GCallback)populate_popup_cb, NULL, ""signal::focus-in-event"", (GCallback)focus_cb, NULL, ""signal::focus-out-event"", (GCallback)focus_cb, NULL, NULL); } ",0 "void DispatchInputEvent(Element* target, InputEvent::InputType input_type, const String& data, InputEvent::EventIsComposing is_composing) { if (!RuntimeEnabledFeatures::InputEventEnabled()) return; if (!target) return; InputEvent* input_event = InputEvent::CreateInput(input_type, data, is_composing, nullptr); target->DispatchScopedEvent(input_event); } ",0 "fz_new_colorspace(fz_context *ctx, const char *name, enum fz_colorspace_type type, int flags, int n, fz_colorspace_convert_fn *to_ccs, fz_colorspace_convert_fn *from_ccs, fz_colorspace_base_fn *base, fz_colorspace_clamp_fn *clamp, fz_colorspace_destruct_fn *destruct, void *data, size_t size) { fz_colorspace *cs = fz_malloc_struct(ctx, fz_colorspace); FZ_INIT_KEY_STORABLE(cs, 1, fz_drop_colorspace_imp); cs->size = sizeof(fz_colorspace) + size; fz_strlcpy(cs->name, name ? name : ""UNKNOWN"", sizeof cs->name); cs->type = type; cs->flags = flags; cs->n = n; cs->to_ccs = to_ccs; cs->from_ccs = from_ccs; cs->get_base = base; if (clamp != NULL) cs->clamp = clamp; else cs->clamp = clamp_default; cs->free_data = destruct; cs->data = data; return cs; } ",0 "static int ocfs2_find_rec(struct ocfs2_extent_list *el, u32 pos) { int i; struct ocfs2_extent_rec *rec = NULL; for (i = le16_to_cpu(el->l_next_free_rec) - 1; i >= 0; i--) { rec = &el->l_recs[i]; if (le32_to_cpu(rec->e_cpos) < pos) break; } return i; } ",0 "bool ResourceFetcher::IsControlledByServiceWorker() const { return Context().IsControlledByServiceWorker(); } ",0 "int ChromeBrowserMainPartsChromeos::PreEarlyInitialization() { base::CommandLine* singleton_command_line = base::CommandLine::ForCurrentProcess(); if (parsed_command_line().HasSwitch(switches::kGuestSession)) { singleton_command_line->AppendSwitch(::switches::kDisableSync); singleton_command_line->AppendSwitch(::switches::kDisableExtensions); browser_defaults::bookmarks_enabled = false; } if (!base::SysInfo::IsRunningOnChromeOS() && !parsed_command_line().HasSwitch(switches::kLoginManager) && !parsed_command_line().HasSwitch(switches::kLoginUser) && !parsed_command_line().HasSwitch(switches::kGuestSession)) { singleton_command_line->AppendSwitchASCII( switches::kLoginUser, cryptohome::Identification(user_manager::StubAccountId()).id()); if (!parsed_command_line().HasSwitch(switches::kLoginProfile)) { singleton_command_line->AppendSwitchASCII(switches::kLoginProfile, chrome::kTestUserProfileDir); } LOG(WARNING) << ""Running as stub user with profile dir: "" << singleton_command_line ->GetSwitchValuePath(switches::kLoginProfile) .value(); } RegisterStubPathOverridesIfNecessary(); #if defined(GOOGLE_CHROME_BUILD) const char kChromeOSReleaseTrack[] = ""CHROMEOS_RELEASE_TRACK""; std::string channel; if (base::SysInfo::GetLsbReleaseValue(kChromeOSReleaseTrack, &channel)) chrome::SetChannel(channel); #endif dbus_pre_early_init_ = std::make_unique(); return ChromeBrowserMainPartsLinux::PreEarlyInitialization(); } ",1 "std::string ContentBrowserClient::GetDefaultDownloadName() { return std::string(); } ",0 "status_t OMXCodec::allocateBuffersOnPort(OMX_U32 portIndex) { if (mNativeWindow != NULL && portIndex == kPortIndexOutput) { return allocateOutputBuffersFromNativeWindow(); } if ((mFlags & kEnableGrallocUsageProtected) && portIndex == kPortIndexOutput) { ALOGE(""protected output buffers must be stent to an ANativeWindow""); return PERMISSION_DENIED; } status_t err = OK; if ((mFlags & kStoreMetaDataInVideoBuffers) && portIndex == kPortIndexInput) { err = mOMX->storeMetaDataInBuffers(mNode, kPortIndexInput, OMX_TRUE); if (err != OK) { ALOGE(""Storing meta data in video buffers is not supported""); return err; } } OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = portIndex; err = mOMX->getParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); if (err != OK) { return err; } CODEC_LOGV(""allocating %u buffers of size %u on %s port"", def.nBufferCountActual, def.nBufferSize, portIndex == kPortIndexInput ? ""input"" : ""output""); if (def.nBufferSize != 0 && def.nBufferCountActual > SIZE_MAX / def.nBufferSize) { return BAD_VALUE; } size_t totalSize = def.nBufferCountActual * def.nBufferSize; mDealer[portIndex] = new MemoryDealer(totalSize, ""OMXCodec""); for (OMX_U32 i = 0; i < def.nBufferCountActual; ++i) { sp mem = mDealer[portIndex]->allocate(def.nBufferSize); CHECK(mem.get() != NULL); BufferInfo info; info.mData = NULL; info.mSize = def.nBufferSize; IOMX::buffer_id buffer; if (portIndex == kPortIndexInput && ((mQuirks & kRequiresAllocateBufferOnInputPorts) || (mFlags & kUseSecureInputBuffers))) { if (mOMXLivesLocally) { mem.clear(); err = mOMX->allocateBuffer( mNode, portIndex, def.nBufferSize, &buffer, &info.mData); } else { err = mOMX->allocateBufferWithBackup( mNode, portIndex, mem, &buffer, mem->size()); } } else if (portIndex == kPortIndexOutput && (mQuirks & kRequiresAllocateBufferOnOutputPorts)) { if (mOMXLivesLocally) { mem.clear(); err = mOMX->allocateBuffer( mNode, portIndex, def.nBufferSize, &buffer, &info.mData); } else { err = mOMX->allocateBufferWithBackup( mNode, portIndex, mem, &buffer, mem->size()); } } else { err = mOMX->useBuffer(mNode, portIndex, mem, &buffer, mem->size()); } if (err != OK) { ALOGE(""allocate_buffer_with_backup failed""); return err; } if (mem != NULL) { info.mData = mem->pointer(); } info.mBuffer = buffer; info.mStatus = OWNED_BY_US; info.mMem = mem; info.mMediaBuffer = NULL; if (portIndex == kPortIndexOutput) { LOG_ALWAYS_FATAL_IF((mOMXLivesLocally && (mQuirks & kRequiresAllocateBufferOnOutputPorts) && (mQuirks & kDefersOutputBufferAllocation)), ""allocateBuffersOnPort cannot defer buffer allocation""); info.mMediaBuffer = new MediaBuffer(info.mData, info.mSize); info.mMediaBuffer->setObserver(this); } mPortBuffers[portIndex].push(info); CODEC_LOGV(""allocated buffer %u on %s port"", buffer, portIndex == kPortIndexInput ? ""input"" : ""output""); } if (portIndex == kPortIndexOutput) { sp meta = mSource->getFormat(); int32_t delay = 0; if (!meta->findInt32(kKeyEncoderDelay, &delay)) { delay = 0; } int32_t padding = 0; if (!meta->findInt32(kKeyEncoderPadding, &padding)) { padding = 0; } int32_t numchannels = 0; if (delay + padding) { if (mOutputFormat->findInt32(kKeyChannelCount, &numchannels)) { size_t frameSize = numchannels * sizeof(int16_t); if (mSkipCutBuffer != NULL) { size_t prevbuffersize = mSkipCutBuffer->size(); if (prevbuffersize != 0) { ALOGW(""Replacing SkipCutBuffer holding %zu bytes"", prevbuffersize); } } mSkipCutBuffer = new SkipCutBuffer(delay * frameSize, padding * frameSize); } } } if (portIndex == kPortIndexInput && (mFlags & kUseSecureInputBuffers)) { Vector buffers; for (size_t i = 0; i < def.nBufferCountActual; ++i) { const BufferInfo &info = mPortBuffers[kPortIndexInput].itemAt(i); MediaBuffer *mbuf = new MediaBuffer(info.mData, info.mSize); buffers.push(mbuf); } status_t err = mSource->setBuffers(buffers); if (err != OK) { for (size_t i = 0; i < def.nBufferCountActual; ++i) { buffers.editItemAt(i)->release(); } buffers.clear(); CODEC_LOGE( ""Codec requested to use secure input buffers but "" ""upstream source didn't support that.""); return err; } } return OK; } ",0 "next_field_w(const wchar_t **wp, const wchar_t **start, const wchar_t **end, wchar_t *sep) { /* Skip leading whitespace to find start of field. */ while (**wp == L' ' || **wp == L'\t' || **wp == L'\n') { (*wp)++; } *start = *wp; /* Scan for the separator. */ while (**wp != L'\0' && **wp != L',' && **wp != L':' && **wp != L'\n' && **wp != L'#') { (*wp)++; } *sep = **wp; /* Locate end of field, trim trailing whitespace if necessary */ if (*wp == *start) { *end = *wp; } else { *end = *wp - 1; while (**end == L' ' || **end == L'\t' || **end == L'\n') { (*end)--; } (*end)++; } /* Handle in-field comments */ if (*sep == L'#') { while (**wp != L'\0' && **wp != L',' && **wp != L'\n') { (*wp)++; } *sep = **wp; } /* Adjust scanner location. */ if (**wp != L'\0') (*wp)++; } ",0 "void WebPluginDelegateStub::OnCreateCommandBuffer(int* route_id) { #if defined(ENABLE_GPU) command_buffer_stub_.reset(new CommandBufferStub( static_cast(PluginChannelBase::GetCurrentChannel()), delegate_->windowed_handle())); *route_id = command_buffer_stub_->route_id(); #else *route_id = 0; #endif // ENABLE_GPU } ",0 "static void tcm_loop_port_unlink( struct se_portal_group *se_tpg, struct se_lun *se_lun) { struct scsi_device *sd; struct tcm_loop_hba *tl_hba; struct tcm_loop_tpg *tl_tpg; tl_tpg = container_of(se_tpg, struct tcm_loop_tpg, tl_se_tpg); tl_hba = tl_tpg->tl_hba; sd = scsi_device_lookup(tl_hba->sh, 0, tl_tpg->tl_tpgt, se_lun->unpacked_lun); if (!sd) { printk(KERN_ERR ""Unable to locate struct scsi_device for %d:%d:"" ""%d\n"", 0, tl_tpg->tl_tpgt, se_lun->unpacked_lun); return; } /* * Remove Linux/SCSI struct scsi_device by HCTL */ scsi_remove_device(sd); scsi_device_put(sd); atomic_dec(&tl_tpg->tl_tpg_port_count); smp_mb__after_atomic_dec(); printk(KERN_INFO ""TCM_Loop_ConfigFS: Port Unlink Successful\n""); } ",0 "BGD_DECLARE(void) gdImageGd2 (gdImagePtr im, FILE * outFile, int cs, int fmt) { _noLibzError(); } ",0 "short CCITTFaxStream::getTwoDimCode() { int code; const CCITTCode *p; int n; code = 0; // make gcc happy if (endOfBlock) { if ((code = lookBits(7)) != EOF) { p = &twoDimTab1[code]; if (p->bits > 0) { eatBits(p->bits); return p->n; } } } else { for (n = 1; n <= 7; ++n) { if ((code = lookBits(n)) == EOF) { break; } if (n < 7) { code <<= 7 - n; } p = &twoDimTab1[code]; if (p->bits == n) { eatBits(n); return p->n; } } } error(errSyntaxError, getPos(), ""Bad two dim code ({0:04x}) in CCITTFax stream"", code); return EOF; } ",0 "control_end(struct control *control) { return file_end(&control->file); } ",0 " void RenderFrameHostImpl::ResetFeaturePolicy() { RenderFrameHostImpl* parent_frame_host = GetParent(); const FeaturePolicy* parent_policy = parent_frame_host ? parent_frame_host->get_feature_policy() : nullptr; ParsedFeaturePolicyHeader container_policy = frame_tree_node()->effective_container_policy(); feature_policy_ = FeaturePolicy::CreateFromParentPolicy( parent_policy, container_policy, last_committed_origin_); } ",1 "static int hci_sock_getname(struct socket *sock, struct sockaddr *addr, int *addr_len, int peer) { struct sockaddr_hci *haddr = (struct sockaddr_hci *) addr; struct sock *sk = sock->sk; struct hci_dev *hdev = hci_pi(sk)->hdev; BT_DBG(""sock %p sk %p"", sock, sk); if (!hdev) return -EBADFD; lock_sock(sk); *addr_len = sizeof(*haddr); haddr->hci_family = AF_BLUETOOTH; haddr->hci_dev = hdev->id; release_sock(sk); return 0; } ",0 "json_t *json_loadb(const char *buffer, size_t buflen, size_t flags, json_error_t *error) { lex_t lex; json_t *result; buffer_data_t stream_data; jsonp_error_init(error, """"); if (buffer == NULL) { error_set(error, NULL, ""wrong arguments""); return NULL; } stream_data.data = buffer; stream_data.pos = 0; stream_data.len = buflen; if(lex_init(&lex, buffer_get, flags, (void *)&stream_data)) return NULL; result = parse_json(&lex, flags, error); lex_close(&lex); return result; } ",0 "bool HpackDecoder::DecodeNextName( HpackInputStream* input_stream, StringPiece* next_name) { uint32 index_or_zero = 0; if (!input_stream->DecodeNextUint32(&index_or_zero)) return false; if (index_or_zero == 0) return DecodeNextStringLiteral(input_stream, true, next_name); const HpackEntry* entry = header_table_.GetByIndex(index_or_zero); if (entry == NULL) { return false; } else if (entry->IsStatic()) { *next_name = entry->name(); } else { key_buffer_.assign(entry->name()); *next_name = key_buffer_; } return true; } ",0 "status_t DRMSource::stop() { return mOriginalMediaSource->stop(); } ",0 "static u64 __update_clear_spte_slow(u64 *sptep, u64 spte) { union split_spte *ssptep, sspte, orig; ssptep = (union split_spte *)sptep; sspte = (union split_spte)spte; /* xchg acts as a barrier before the setting of the high bits */ orig.spte_low = xchg(&ssptep->spte_low, sspte.spte_low); orig.spte_high = ssptep->spte_high; ssptep->spte_high = sspte.spte_high; count_spte_clear(sptep, spte); return orig.spte; } ",0 "Document& Document::topDocument() const { Document* doc = const_cast(this); for (HTMLFrameOwnerElement* element = doc->ownerElement(); element; element = doc->ownerElement()) doc = &element->document(); ASSERT(doc); return *doc; } ",0 "LosslessReduceDepthOK(Image *image) { /* Reduce bit depth if it can be reduced losslessly from 16+ to 8. * * This is true if the high byte and the next highest byte of * each sample of the image, the colormap, and the background color * are equal to each other. We check this by seeing if the samples * are unchanged when we scale them down to 8 and back up to Quantum. * * We don't use the method GetImageDepth() because it doesn't check * background and doesn't handle PseudoClass specially. */ #define QuantumToCharToQuantumEqQuantum(quantum) \ ((ScaleCharToQuantum((unsigned char) ScaleQuantumToChar(quantum))) == quantum) MagickBooleanType ok_to_reduce=MagickFalse; if (image->depth >= 16) { const PixelPacket *p; ok_to_reduce= QuantumToCharToQuantumEqQuantum(image->background_color.red) && QuantumToCharToQuantumEqQuantum(image->background_color.green) && QuantumToCharToQuantumEqQuantum(image->background_color.blue) ? MagickTrue : MagickFalse; if (ok_to_reduce != MagickFalse && image->storage_class == PseudoClass) { int indx; for (indx=0; indx < (ssize_t) image->colors; indx++) { ok_to_reduce=( QuantumToCharToQuantumEqQuantum( image->colormap[indx].red) && QuantumToCharToQuantumEqQuantum( image->colormap[indx].green) && QuantumToCharToQuantumEqQuantum( image->colormap[indx].blue)) ? MagickTrue : MagickFalse; if (ok_to_reduce == MagickFalse) break; } } if ((ok_to_reduce != MagickFalse) && (image->storage_class != PseudoClass)) { ssize_t y; register ssize_t x; for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) { ok_to_reduce = MagickFalse; break; } for (x=(ssize_t) image->columns-1; x >= 0; x--) { ok_to_reduce= QuantumToCharToQuantumEqQuantum(GetPixelRed(p)) && QuantumToCharToQuantumEqQuantum(GetPixelGreen(p)) && QuantumToCharToQuantumEqQuantum(GetPixelBlue(p)) ? MagickTrue : MagickFalse; if (ok_to_reduce == MagickFalse) break; p++; } if (x >= 0) break; } } if (ok_to_reduce != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" OK to reduce PNG bit depth to 8 without loss of info""); } else { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Not OK to reduce PNG bit depth to 8 without loss of info""); } } return ok_to_reduce; } ",0 "void WebLocalFrameImpl::SetTextDirection(WebTextDirection direction) { Editor& editor = frame_->GetEditor(); if (!editor.CanEdit()) return; switch (direction) { case kWebTextDirectionDefault: editor.SetBaseWritingDirection(WritingDirection::kNatural); break; case kWebTextDirectionLeftToRight: editor.SetBaseWritingDirection(WritingDirection::kLeftToRight); break; case kWebTextDirectionRightToLeft: editor.SetBaseWritingDirection(WritingDirection::kRightToLeft); break; default: NOTIMPLEMENTED(); break; } } ",0 "enum dma_data_direction opposite_dma_dir(enum dma_data_direction dir) { switch (dir) { case DMA_TO_DEVICE: return DMA_FROM_DEVICE; case DMA_FROM_DEVICE: return DMA_TO_DEVICE; default: return dir; } } ",0 " LayerTreeHostTestSetNeedsRedraw() : num_commits_(0), num_draws_(0) {} ",0 "static void gs_usb_disconnect(struct usb_interface *intf) { unsigned i; struct gs_usb *dev = usb_get_intfdata(intf); usb_set_intfdata(intf, NULL); if (!dev) { dev_err(&intf->dev, ""Disconnect (nodata)\n""); return; } for (i = 0; i < GS_MAX_INTF; i++) if (dev->canch[i]) gs_destroy_candev(dev->canch[i]); usb_kill_anchored_urbs(&dev->rx_submitted); kfree(dev); } ",0 "static void mmu_destroy_caches(void) { if (pte_list_desc_cache) kmem_cache_destroy(pte_list_desc_cache); if (mmu_page_header_cache) kmem_cache_destroy(mmu_page_header_cache); } ",0 "static MagickBooleanType EncodeLabImage(Image *image,ExceptionInfo *exception) { CacheView *image_view; MagickBooleanType status; ssize_t y; status=MagickTrue; image_view=AcquireAuthenticCacheView(image,exception); for (y=0; y < (ssize_t) image->rows; y++) { register PixelPacket *restrict q; register ssize_t x; if (status == MagickFalse) continue; q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) image->columns; x++) { double a, b; a=QuantumScale*GetPixela(q)-0.5; if (a < 0.0) a+=1.0; b=QuantumScale*GetPixelb(q)-0.5; if (b < 0.0) b+=1.0; SetPixela(q,QuantumRange*a); SetPixelb(q,QuantumRange*b); q++; } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); return(status); } ",0 "static struct mm_struct *check_mem_permission(struct task_struct *task) { struct mm_struct *mm; int err; /* * Avoid racing if task exec's as we might get a new mm but validate * against old credentials. */ err = mutex_lock_killable(&task->signal->cred_guard_mutex); if (err) return ERR_PTR(err); mm = __check_mem_permission(task); mutex_unlock(&task->signal->cred_guard_mutex); return mm; } ",0 "void V8TestObject::XmlAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_xmlAttribute_Getter""); test_object_v8_internal::XmlAttributeAttributeGetter(info); } ",0 "void DocumentLoader::DidInstallNewDocument(Document* document) { document->SetReadyState(Document::kLoading); if (content_security_policy_) { document->InitContentSecurityPolicy(content_security_policy_.Release()); } if (history_item_ && IsBackForwardLoadType(load_type_)) document->SetStateForNewFormElements(history_item_->GetDocumentState()); String suborigin_header = response_.HttpHeaderField(HTTPNames::Suborigin); if (!suborigin_header.IsNull()) { Vector messages; Suborigin suborigin; if (ParseSuboriginHeader(suborigin_header, &suborigin, messages)) document->EnforceSuborigin(suborigin); for (auto& message : messages) { document->AddConsoleMessage( ConsoleMessage::Create(kSecurityMessageSource, kErrorMessageLevel, ""Error with Suborigin header: "" + message)); } } document->GetClientHintsPreferences().UpdateFrom(client_hints_preferences_); Settings* settings = document->GetSettings(); fetcher_->SetImagesEnabled(settings->GetImagesEnabled()); fetcher_->SetAutoLoadImages(settings->GetLoadsImagesAutomatically()); const AtomicString& dns_prefetch_control = response_.HttpHeaderField(HTTPNames::X_DNS_Prefetch_Control); if (!dns_prefetch_control.IsEmpty()) document->ParseDNSPrefetchControlHeader(dns_prefetch_control); String header_content_language = response_.HttpHeaderField(HTTPNames::Content_Language); if (!header_content_language.IsEmpty()) { size_t comma_index = header_content_language.find(','); header_content_language.Truncate(comma_index); header_content_language = header_content_language.StripWhiteSpace(IsHTMLSpace); if (!header_content_language.IsEmpty()) document->SetContentLanguage(AtomicString(header_content_language)); } String referrer_policy_header = response_.HttpHeaderField(HTTPNames::Referrer_Policy); if (!referrer_policy_header.IsNull()) { UseCounter::Count(*document, WebFeature::kReferrerPolicyHeader); document->ParseAndSetReferrerPolicy(referrer_policy_header); } GetLocalFrameClient().DidCreateNewDocument(); } ",0 "static int init_subctxts(struct qib_devdata *dd, struct qib_ctxtdata *rcd, const struct qib_user_info *uinfo) { int ret = 0; unsigned num_subctxts; size_t size; /* * If the user is requesting zero subctxts, * skip the subctxt allocation. */ if (uinfo->spu_subctxt_cnt <= 0) goto bail; num_subctxts = uinfo->spu_subctxt_cnt; /* Check for subctxt compatibility */ if (!qib_compatible_subctxts(uinfo->spu_userversion >> 16, uinfo->spu_userversion & 0xffff)) { qib_devinfo(dd->pcidev, ""Mismatched user version (%d.%d) and driver version (%d.%d) while context sharing. Ensure that driver and library are from the same release.\n"", (int) (uinfo->spu_userversion >> 16), (int) (uinfo->spu_userversion & 0xffff), QIB_USER_SWMAJOR, QIB_USER_SWMINOR); goto bail; } if (num_subctxts > QLOGIC_IB_MAX_SUBCTXT) { ret = -EINVAL; goto bail; } rcd->subctxt_uregbase = vmalloc_user(PAGE_SIZE * num_subctxts); if (!rcd->subctxt_uregbase) { ret = -ENOMEM; goto bail; } /* Note: rcd->rcvhdrq_size isn't initialized yet. */ size = ALIGN(dd->rcvhdrcnt * dd->rcvhdrentsize * sizeof(u32), PAGE_SIZE) * num_subctxts; rcd->subctxt_rcvhdr_base = vmalloc_user(size); if (!rcd->subctxt_rcvhdr_base) { ret = -ENOMEM; goto bail_ureg; } rcd->subctxt_rcvegrbuf = vmalloc_user(rcd->rcvegrbuf_chunks * rcd->rcvegrbuf_size * num_subctxts); if (!rcd->subctxt_rcvegrbuf) { ret = -ENOMEM; goto bail_rhdr; } rcd->subctxt_cnt = uinfo->spu_subctxt_cnt; rcd->subctxt_id = uinfo->spu_subctxt_id; rcd->active_slaves = 1; rcd->redirect_seq_cnt = 1; set_bit(QIB_CTXT_MASTER_UNINIT, &rcd->flag); goto bail; bail_rhdr: vfree(rcd->subctxt_rcvhdr_base); bail_ureg: vfree(rcd->subctxt_uregbase); rcd->subctxt_uregbase = NULL; bail: return ret; } ",0 "void Document::AddMutationEventListenerTypeIfEnabled( ListenerType listener_type) { if (ContextFeatures::MutationEventsEnabled(this)) AddListenerType(listener_type); } ",0 "static int proc_attr_dir_readdir(struct file * filp, void * dirent, filldir_t filldir) { return proc_pident_readdir(filp,dirent,filldir, attr_dir_stuff,ARRAY_SIZE(attr_dir_stuff)); } ",0 "static Image *ReadPSDImage(const ImageInfo *image_info,ExceptionInfo *exception) { Image *image; MagickBooleanType has_merged_image, skip_layers; MagickOffsetType offset; MagickSizeType length; MagickBooleanType status; PSDInfo psd_info; register ssize_t i; ssize_t count; unsigned char *data; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read image header. */ image->endian=MSBEndian; count=ReadBlob(image,4,(unsigned char *) psd_info.signature); psd_info.version=ReadBlobMSBShort(image); if ((count == 0) || (LocaleNCompare(psd_info.signature,""8BPS"",4) != 0) || ((psd_info.version != 1) && (psd_info.version != 2))) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); (void) ReadBlob(image,6,psd_info.reserved); psd_info.channels=ReadBlobMSBShort(image); if (psd_info.channels > MaxPSDChannels) ThrowReaderException(CorruptImageError,""MaximumChannelsExceeded""); psd_info.rows=ReadBlobMSBLong(image); psd_info.columns=ReadBlobMSBLong(image); if ((psd_info.version == 1) && ((psd_info.rows > 30000) || (psd_info.columns > 30000))) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); psd_info.depth=ReadBlobMSBShort(image); if ((psd_info.depth != 1) && (psd_info.depth != 8) && (psd_info.depth != 16)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); psd_info.mode=ReadBlobMSBShort(image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Image is %.20g x %.20g with channels=%.20g, depth=%.20g, mode=%s"", (double) psd_info.columns,(double) psd_info.rows,(double) psd_info.channels,(double) psd_info.depth,ModeToString((PSDImageType) psd_info.mode)); /* Initialize image. */ image->depth=psd_info.depth; image->columns=psd_info.columns; image->rows=psd_info.rows; status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) return(DestroyImageList(image)); if (SetImageBackgroundColor(image,exception) == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } if (psd_info.mode == LabMode) SetImageColorspace(image,LabColorspace,exception); if (psd_info.mode == CMYKMode) { SetImageColorspace(image,CMYKColorspace,exception); image->alpha_trait=psd_info.channels > 4 ? BlendPixelTrait : UndefinedPixelTrait; } else if ((psd_info.mode == BitmapMode) || (psd_info.mode == GrayscaleMode) || (psd_info.mode == DuotoneMode)) { status=AcquireImageColormap(image,psd_info.depth != 16 ? 256 : 65536, exception); if (status == MagickFalse) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Image colormap allocated""); SetImageColorspace(image,GRAYColorspace,exception); image->alpha_trait=psd_info.channels > 1 ? BlendPixelTrait : UndefinedPixelTrait; } else image->alpha_trait=psd_info.channels > 3 ? BlendPixelTrait : UndefinedPixelTrait; /* Read PSD raster colormap only present for indexed and duotone images. */ length=ReadBlobMSBLong(image); if (length != 0) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" reading colormap""); if (psd_info.mode == DuotoneMode) { /* Duotone image data; the format of this data is undocumented. */ data=(unsigned char *) AcquireQuantumMemory((size_t) length, sizeof(*data)); if (data == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); (void) ReadBlob(image,(size_t) length,data); data=(unsigned char *) RelinquishMagickMemory(data); } else { size_t number_colors; /* Read PSD raster colormap. */ number_colors=length/3; if (number_colors > 65536) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (AcquireImageColormap(image,number_colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].red=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].green=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); for (i=0; i < (ssize_t) image->colors; i++) image->colormap[i].blue=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); image->alpha_trait=UndefinedPixelTrait; } } has_merged_image=MagickTrue; length=ReadBlobMSBLong(image); if (length != 0) { unsigned char *blocks; /* Image resources block. */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" reading image resource blocks - %.20g bytes"",(double) ((MagickOffsetType) length)); blocks=(unsigned char *) AcquireQuantumMemory((size_t) length, sizeof(*blocks)); if (blocks == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); count=ReadBlob(image,(size_t) length,blocks); if ((count != (ssize_t) length) || (LocaleNCompare((char *) blocks,""8BIM"",4) != 0)) { blocks=(unsigned char *) RelinquishMagickMemory(blocks); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } ParseImageResourceBlocks(image,blocks,(size_t) length,&has_merged_image, exception); blocks=(unsigned char *) RelinquishMagickMemory(blocks); } /* Layer and mask block. */ length=GetPSDSize(&psd_info,image); if (length == 8) { length=ReadBlobMSBLong(image); length=ReadBlobMSBLong(image); } offset=TellBlob(image); skip_layers=MagickFalse; if ((image_info->number_scenes == 1) && (image_info->scene == 0) && (has_merged_image != MagickFalse)) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" read composite only""); skip_layers=MagickTrue; } if (length == 0) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" image has no layers""); } else { if (ReadPSDLayers(image,image_info,&psd_info,skip_layers,exception) != MagickTrue) { (void) CloseBlob(image); image=DestroyImageList(image); return((Image *) NULL); } /* Skip the rest of the layer and mask information. */ SeekBlob(image,offset+length,SEEK_SET); } /* If we are only ""pinging"" the image, then we're done - so return. */ if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } /* Read the precombined layer, present for PSD < 4 compatibility. */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" reading the precombined layer""); if ((has_merged_image != MagickFalse) || (GetImageListLength(image) == 1)) has_merged_image=(MagickBooleanType) ReadPSDMergedImage(image_info,image, &psd_info,exception); if ((has_merged_image == MagickFalse) && (GetImageListLength(image) == 1) && (length != 0)) { SeekBlob(image,offset,SEEK_SET); status=ReadPSDLayers(image,image_info,&psd_info,MagickFalse,exception); if (status != MagickTrue) { (void) CloseBlob(image); image=DestroyImageList(image); return((Image *) NULL); } } if ((has_merged_image == MagickFalse) && (GetImageListLength(image) > 1)) { Image *merged; SetImageAlphaChannel(image,TransparentAlphaChannel,exception); image->background_color.alpha=TransparentAlpha; image->background_color.alpha_trait=BlendPixelTrait; merged=MergeImageLayers(image,FlattenLayer,exception); ReplaceImageInList(&image,merged); } (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "int __kvm_set_cr8(struct kvm_vcpu *vcpu, unsigned long cr8) { if (cr8 & CR8_RESERVED_BITS) return 1; if (irqchip_in_kernel(vcpu->kvm)) kvm_lapic_set_tpr(vcpu, cr8); else vcpu->arch.cr8 = cr8; return 0; } ",0 "void RenderWidgetHostViewAura::SubmitCompositorFrame( const cc::LocalSurfaceId& local_surface_id, cc::CompositorFrame frame) { TRACE_EVENT0(""content"", ""RenderWidgetHostViewAura::OnSwapCompositorFrame""); UpdateBackgroundColorFromRenderer(frame.metadata.root_background_color); last_scroll_offset_ = frame.metadata.root_scroll_offset; cc::Selection selection = frame.metadata.selection; if (IsUseZoomForDSFEnabled()) { float viewportToDIPScale = 1.0f / current_device_scale_factor_; gfx::PointF start_edge_top = selection.start.edge_top(); gfx::PointF start_edge_bottom = selection.start.edge_bottom(); gfx::PointF end_edge_top = selection.end.edge_top(); gfx::PointF end_edge_bottom = selection.end.edge_bottom(); start_edge_top.Scale(viewportToDIPScale); start_edge_bottom.Scale(viewportToDIPScale); end_edge_top.Scale(viewportToDIPScale); end_edge_bottom.Scale(viewportToDIPScale); selection.start.SetEdge(start_edge_top, start_edge_bottom); selection.end.SetEdge(end_edge_top, end_edge_bottom); } if (delegated_frame_host_) { delegated_frame_host_->SubmitCompositorFrame(local_surface_id, std::move(frame)); } selection_controller_->OnSelectionBoundsChanged(selection.start, selection.end); } ",0 "Element* Editor::findEventTargetFromSelection() const { return findEventTargetFrom( frame().selection().computeVisibleSelectionInDOMTreeDeprecated()); } ",0 "Editor* Editor::Create(LocalFrame& frame) { return new Editor(frame); } ",0 "int __dev_set_mtu(struct net_device *dev, int new_mtu) { const struct net_device_ops *ops = dev->netdev_ops; if (ops->ndo_change_mtu) return ops->ndo_change_mtu(dev, new_mtu); dev->mtu = new_mtu; return 0; } ",0 "static int ipx_getname(struct socket *sock, struct sockaddr *uaddr, int *uaddr_len, int peer) { struct ipx_address *addr; struct sockaddr_ipx sipx; struct sock *sk = sock->sk; struct ipx_sock *ipxs = ipx_sk(sk); int rc; *uaddr_len = sizeof(struct sockaddr_ipx); lock_sock(sk); if (peer) { rc = -ENOTCONN; if (sk->sk_state != TCP_ESTABLISHED) goto out; addr = &ipxs->dest_addr; sipx.sipx_network = addr->net; sipx.sipx_port = addr->sock; memcpy(sipx.sipx_node, addr->node, IPX_NODE_LEN); } else { if (ipxs->intrfc) { sipx.sipx_network = ipxs->intrfc->if_netnum; #ifdef CONFIG_IPX_INTERN memcpy(sipx.sipx_node, ipxs->node, IPX_NODE_LEN); #else memcpy(sipx.sipx_node, ipxs->intrfc->if_node, IPX_NODE_LEN); #endif /* CONFIG_IPX_INTERN */ } else { sipx.sipx_network = 0; memset(sipx.sipx_node, '\0', IPX_NODE_LEN); } sipx.sipx_port = ipxs->port; } sipx.sipx_family = AF_IPX; sipx.sipx_type = ipxs->type; sipx.sipx_zero = 0; memcpy(uaddr, &sipx, sizeof(sipx)); rc = 0; out: release_sock(sk); return rc; } ",0 "static struct rds_connection *__rds_conn_create(struct net *net, __be32 laddr, __be32 faddr, struct rds_transport *trans, gfp_t gfp, int is_outgoing) { struct rds_connection *conn, *parent = NULL; struct hlist_head *head = rds_conn_bucket(laddr, faddr); struct rds_transport *loop_trans; unsigned long flags; int ret; struct rds_transport *otrans = trans; if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP) goto new_conn; rcu_read_lock(); conn = rds_conn_lookup(net, head, laddr, faddr, trans); if (conn && conn->c_loopback && conn->c_trans != &rds_loop_transport && laddr == faddr && !is_outgoing) { /* This is a looped back IB connection, and we're * called by the code handling the incoming connect. * We need a second connection object into which we * can stick the other QP. */ parent = conn; conn = parent->c_passive; } rcu_read_unlock(); if (conn) goto out; new_conn: conn = kmem_cache_zalloc(rds_conn_slab, gfp); if (!conn) { conn = ERR_PTR(-ENOMEM); goto out; } INIT_HLIST_NODE(&conn->c_hash_node); conn->c_laddr = laddr; conn->c_faddr = faddr; spin_lock_init(&conn->c_lock); conn->c_next_tx_seq = 1; rds_conn_net_set(conn, net); init_waitqueue_head(&conn->c_waitq); INIT_LIST_HEAD(&conn->c_send_queue); INIT_LIST_HEAD(&conn->c_retrans); ret = rds_cong_get_maps(conn); if (ret) { kmem_cache_free(rds_conn_slab, conn); conn = ERR_PTR(ret); goto out; } /* * This is where a connection becomes loopback. If *any* RDS sockets * can bind to the destination address then we'd rather the messages * flow through loopback rather than either transport. */ loop_trans = rds_trans_get_preferred(net, faddr); if (loop_trans) { rds_trans_put(loop_trans); conn->c_loopback = 1; if (is_outgoing && trans->t_prefer_loopback) { /* ""outgoing"" connection - and the transport * says it wants the connection handled by the * loopback transport. This is what TCP does. */ trans = &rds_loop_transport; } } conn->c_trans = trans; ret = trans->conn_alloc(conn, gfp); if (ret) { kmem_cache_free(rds_conn_slab, conn); conn = ERR_PTR(ret); goto out; } atomic_set(&conn->c_state, RDS_CONN_DOWN); conn->c_send_gen = 0; conn->c_reconnect_jiffies = 0; INIT_DELAYED_WORK(&conn->c_send_w, rds_send_worker); INIT_DELAYED_WORK(&conn->c_recv_w, rds_recv_worker); INIT_DELAYED_WORK(&conn->c_conn_w, rds_connect_worker); INIT_WORK(&conn->c_down_w, rds_shutdown_worker); mutex_init(&conn->c_cm_lock); conn->c_flags = 0; rdsdebug(""allocated conn %p for %pI4 -> %pI4 over %s %s\n"", conn, &laddr, &faddr, trans->t_name ? trans->t_name : ""[unknown]"", is_outgoing ? ""(outgoing)"" : """"); /* * Since we ran without holding the conn lock, someone could * have created the same conn (either normal or passive) in the * interim. We check while holding the lock. If we won, we complete * init and return our conn. If we lost, we rollback and return the * other one. */ spin_lock_irqsave(&rds_conn_lock, flags); if (parent) { /* Creating passive conn */ if (parent->c_passive) { trans->conn_free(conn->c_transport_data); kmem_cache_free(rds_conn_slab, conn); conn = parent->c_passive; } else { parent->c_passive = conn; rds_cong_add_conn(conn); rds_conn_count++; } } else { /* Creating normal conn */ struct rds_connection *found; if (!is_outgoing && otrans->t_type == RDS_TRANS_TCP) found = NULL; else found = rds_conn_lookup(net, head, laddr, faddr, trans); if (found) { trans->conn_free(conn->c_transport_data); kmem_cache_free(rds_conn_slab, conn); conn = found; } else { if ((is_outgoing && otrans->t_type == RDS_TRANS_TCP) || (otrans->t_type != RDS_TRANS_TCP)) { /* Only the active side should be added to * reconnect list for TCP. */ hlist_add_head_rcu(&conn->c_hash_node, head); } rds_cong_add_conn(conn); rds_conn_count++; } } spin_unlock_irqrestore(&rds_conn_lock, flags); out: return conn; } ",1 "static int airo_get_frag(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; readConfigRid(local, 1); vwrq->value = le16_to_cpu(local->config.fragThresh); vwrq->disabled = (vwrq->value >= AIRO_DEF_MTU); vwrq->fixed = 1; return 0; } ",0 "static void pdf_run_ri(fz_context *ctx, pdf_processor *proc, const char *intent) { pdf_run_processor *pr = (pdf_run_processor *)proc; pdf_gstate *gstate = pdf_flush_text(ctx, pr); gstate->fill.color_params.ri = fz_lookup_rendering_intent(intent); gstate->stroke.color_params.ri = gstate->fill.color_params.ri; } ",0 "static int __init cros_ec_dev_init(void) { int ret; dev_t dev = 0; ret = class_register(&cros_class); if (ret) { pr_err(CROS_EC_DEV_NAME "": failed to register device class\n""); return ret; } /* Get a range of minor numbers (starting with 0) to work with */ ret = alloc_chrdev_region(&dev, 0, CROS_MAX_DEV, CROS_EC_DEV_NAME); if (ret < 0) { pr_err(CROS_EC_DEV_NAME "": alloc_chrdev_region() failed\n""); goto failed_chrdevreg; } ec_major = MAJOR(dev); /* Register the driver */ ret = platform_driver_register(&cros_ec_dev_driver); if (ret < 0) { pr_warn(CROS_EC_DEV_NAME "": can't register driver: %d\n"", ret); goto failed_devreg; } return 0; failed_devreg: unregister_chrdev_region(MKDEV(ec_major, 0), CROS_MAX_DEV); failed_chrdevreg: class_unregister(&cros_class); return ret; } ",0 "authentic_set_security_env(struct sc_card *card, const struct sc_security_env *env, int se_num) { struct sc_context *ctx = card->ctx; struct sc_apdu apdu; unsigned char cse_crt_dst[] = { 0x80, 0x01, AUTHENTIC_ALGORITHM_RSA_PKCS1, 0x83, 0x01, env->key_ref[0] & ~AUTHENTIC_OBJECT_REF_FLAG_LOCAL, }; unsigned char cse_crt_ct[] = { 0x80, 0x01, AUTHENTIC_ALGORITHM_RSA_PKCS1, 0x83, 0x01, env->key_ref[0] & ~AUTHENTIC_OBJECT_REF_FLAG_LOCAL, }; int rv; LOG_FUNC_CALLED(ctx); sc_log(ctx, ""set SE#%i(op:0x%X,algo:0x%X,algo_ref:0x%X,flags:0x%X), key_ref:0x%X"", se_num, env->operation, env->algorithm, env->algorithm_ref, env->algorithm_flags, env->key_ref[0]); switch (env->operation) { case SC_SEC_OPERATION_SIGN: sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x22, 0x41, AUTHENTIC_TAG_CRT_DST); apdu.data = cse_crt_dst; apdu.datalen = sizeof(cse_crt_dst); apdu.lc = sizeof(cse_crt_dst); break; case SC_SEC_OPERATION_DECIPHER: sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0x22, 0x41, AUTHENTIC_TAG_CRT_CT); apdu.data = cse_crt_ct; apdu.datalen = sizeof(cse_crt_ct); apdu.lc = sizeof(cse_crt_ct); break; default: LOG_FUNC_RETURN(ctx, SC_ERROR_NOT_SUPPORTED); } rv = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, rv, ""APDU transmit failed""); rv = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(ctx, rv, ""MSE restore error""); LOG_FUNC_RETURN(ctx, rv); } ",0 "bos_print(netdissect_options *ndo, register const u_char *bp, int length) { int bos_op; if (length <= (int)sizeof(struct rx_header)) return; if (ndo->ndo_snapend - bp + 1 <= (int)(sizeof(struct rx_header) + sizeof(int32_t))) { goto trunc; } /* * Print out the afs call we're invoking. The table used here was * gleaned from bozo/bosint.xg */ bos_op = EXTRACT_32BITS(bp + sizeof(struct rx_header)); ND_PRINT((ndo, "" bos call %s"", tok2str(bos_req, ""op#%d"", bos_op))); /* * Decode some of the arguments to the BOS calls */ bp += sizeof(struct rx_header) + 4; switch (bos_op) { case 80: /* Create B node */ ND_PRINT((ndo, "" type"")); STROUT(BOSNAMEMAX); ND_PRINT((ndo, "" instance"")); STROUT(BOSNAMEMAX); break; case 81: /* Delete B node */ case 83: /* Get status */ case 85: /* Get instance info */ case 87: /* Add super user */ case 88: /* Delete super user */ case 93: /* Set cell name */ case 96: /* Add cell host */ case 97: /* Delete cell host */ case 104: /* Restart */ case 106: /* Uninstall */ case 108: /* Exec */ case 112: /* Getlog */ case 114: /* Get instance strings */ STROUT(BOSNAMEMAX); break; case 82: /* Set status */ case 98: /* Set T status */ STROUT(BOSNAMEMAX); ND_PRINT((ndo, "" status"")); INTOUT(); break; case 86: /* Get instance parm */ STROUT(BOSNAMEMAX); ND_PRINT((ndo, "" num"")); INTOUT(); break; case 84: /* Enumerate instance */ case 89: /* List super users */ case 90: /* List keys */ case 91: /* Add key */ case 92: /* Delete key */ case 95: /* Get cell host */ INTOUT(); break; case 105: /* Install */ STROUT(BOSNAMEMAX); ND_PRINT((ndo, "" size"")); INTOUT(); ND_PRINT((ndo, "" flags"")); INTOUT(); ND_PRINT((ndo, "" date"")); INTOUT(); break; default: ; } return; trunc: ND_PRINT((ndo, "" [|bos]"")); } ",0 "HttpUtil::ValuesIterator::~ValuesIterator() { } ",0 "static bool get_new_nicname(char **dest, char *br, int pid, char **cnic) { char template[IFNAMSIZ]; snprintf(template, sizeof(template), ""vethXXXXXX""); *dest = lxc_mkifname(template); if (!create_nic(*dest, br, pid, cnic)) { return false; } return true; } ",0 "void setup_new_exec(struct linux_binprm * bprm) { arch_pick_mmap_layout(current->mm); /* This is the point of no return */ current->sas_ss_sp = current->sas_ss_size = 0; if (uid_eq(current_euid(), current_uid()) && gid_eq(current_egid(), current_gid())) set_dumpable(current->mm, SUID_DUMPABLE_ENABLED); else set_dumpable(current->mm, suid_dumpable); set_task_comm(current, bprm->tcomm); /* Set the new mm task size. We have to do that late because it may * depend on TIF_32BIT which is only updated in flush_thread() on * some architectures like powerpc */ current->mm->task_size = TASK_SIZE; /* install the new credentials */ if (!uid_eq(bprm->cred->uid, current_euid()) || !gid_eq(bprm->cred->gid, current_egid())) { current->pdeath_signal = 0; } else { would_dump(bprm, bprm->file); if (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP) set_dumpable(current->mm, suid_dumpable); } /* * Flush performance counters when crossing a * security domain: */ if (!get_dumpable(current->mm)) perf_event_exit_task(current); /* An exec changes our domain. We are no longer part of the thread group */ current->self_exec_id++; flush_signal_handlers(current, 0); do_close_on_exec(current->files); } ",0 " void RemoveTransformFeedback(GLuint client_id) { transform_feedback_manager_->RemoveTransformFeedback(client_id); } ",0 "kwsincr (kwset_t kwset, char const *text, size_t len) { struct trie *trie = kwset->trie; char const *trans = kwset->trans; text += len; /* Descend the trie (built of reversed keywords) character-by-character, installing new nodes when necessary. */ while (len--) { unsigned char uc = *--text; unsigned char label = trans ? trans[uc] : uc; /* Descend the tree of outgoing links for this trie node, looking for the current character and keeping track of the path followed. */ struct tree *link = trie->links; struct tree *links[DEPTH_SIZE]; enum { L, R } dirs[DEPTH_SIZE]; links[0] = (struct tree *) &trie->links; dirs[0] = L; int depth = 1; while (link && label != link->label) { links[depth] = link; if (label < link->label) dirs[depth++] = L, link = link->llink; else dirs[depth++] = R, link = link->rlink; } /* The current character doesn't have an outgoing link at this trie node, so build a new trie node and install a link in the current trie node's tree. */ if (!link) { link = obstack_alloc (&kwset->obstack, sizeof *link); link->llink = NULL; link->rlink = NULL; link->trie = obstack_alloc (&kwset->obstack, sizeof *link->trie); link->trie->accepting = 0; link->trie->links = NULL; link->trie->parent = trie; link->trie->next = NULL; link->trie->fail = NULL; link->trie->depth = trie->depth + 1; link->trie->shift = 0; link->label = label; link->balance = 0; /* Install the new tree node in its parent. */ if (dirs[--depth] == L) links[depth]->llink = link; else links[depth]->rlink = link; /* Back up the tree fixing the balance flags. */ while (depth && !links[depth]->balance) { if (dirs[depth] == L) --links[depth]->balance; else ++links[depth]->balance; --depth; } /* Rebalance the tree by pointer rotations if necessary. */ if (depth && ((dirs[depth] == L && --links[depth]->balance) || (dirs[depth] == R && ++links[depth]->balance))) { struct tree *t, *r, *l, *rl, *lr; switch (links[depth]->balance) { case (char) -2: switch (dirs[depth + 1]) { case L: r = links[depth], t = r->llink, rl = t->rlink; t->rlink = r, r->llink = rl; t->balance = r->balance = 0; break; case R: r = links[depth], l = r->llink, t = l->rlink; rl = t->rlink, lr = t->llink; t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl; l->balance = t->balance != 1 ? 0 : -1; r->balance = t->balance != (char) -1 ? 0 : 1; t->balance = 0; break; default: abort (); } break; case 2: switch (dirs[depth + 1]) { case R: l = links[depth], t = l->rlink, lr = t->llink; t->llink = l, l->rlink = lr; t->balance = l->balance = 0; break; case L: l = links[depth], r = l->rlink, t = r->llink; lr = t->llink, rl = t->rlink; t->llink = l, l->rlink = lr, t->rlink = r, r->llink = rl; l->balance = t->balance != 1 ? 0 : -1; r->balance = t->balance != (char) -1 ? 0 : 1; t->balance = 0; break; default: abort (); } break; default: abort (); } if (dirs[depth - 1] == L) links[depth - 1]->llink = t; else links[depth - 1]->rlink = t; } } trie = link->trie; } /* Mark the node we finally reached as accepting, encoding the index number of this word in the keyword set so far. */ if (!trie->accepting) trie->accepting = 1 + 2 * kwset->words; ++kwset->words; /* Keep track of the longest and shortest string of the keyword set. */ if (trie->depth < kwset->mind) kwset->mind = trie->depth; if (trie->depth > kwset->maxd) kwset->maxd = trie->depth; } ",0 "static void nodeFilterMethodMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValue(info, imp->nodeFilterMethod()); } ",0 "read_Header(struct archive_read *a, struct _7z_header_info *h, int check_header_id) { struct _7zip *zip = (struct _7zip *)a->format->data; const unsigned char *p; struct _7z_folder *folders; struct _7z_stream_info *si = &(zip->si); struct _7zip_entry *entries; uint32_t folderIndex, indexInFolder; unsigned i; int eindex, empty_streams, sindex; if (check_header_id) { /* * Read Header. */ if ((p = header_bytes(a, 1)) == NULL) return (-1); if (*p != kHeader) return (-1); } /* * Read ArchiveProperties. */ if ((p = header_bytes(a, 1)) == NULL) return (-1); if (*p == kArchiveProperties) { for (;;) { uint64_t size; if ((p = header_bytes(a, 1)) == NULL) return (-1); if (*p == 0) break; if (parse_7zip_uint64(a, &size) < 0) return (-1); } if ((p = header_bytes(a, 1)) == NULL) return (-1); } /* * Read MainStreamsInfo. */ if (*p == kMainStreamsInfo) { if (read_StreamsInfo(a, &(zip->si)) < 0) return (-1); if ((p = header_bytes(a, 1)) == NULL) return (-1); } if (*p == kEnd) return (0); /* * Read FilesInfo. */ if (*p != kFilesInfo) return (-1); if (parse_7zip_uint64(a, &(zip->numFiles)) < 0) return (-1); if (UMAX_ENTRY < zip->numFiles) return (-1); zip->entries = calloc((size_t)zip->numFiles, sizeof(*zip->entries)); if (zip->entries == NULL) return (-1); entries = zip->entries; empty_streams = 0; for (;;) { int type; uint64_t size; size_t ll; if ((p = header_bytes(a, 1)) == NULL) return (-1); type = *p; if (type == kEnd) break; if (parse_7zip_uint64(a, &size) < 0) return (-1); if (zip->header_bytes_remaining < size) return (-1); ll = (size_t)size; switch (type) { case kEmptyStream: h->emptyStreamBools = calloc((size_t)zip->numFiles, sizeof(*h->emptyStreamBools)); if (h->emptyStreamBools == NULL) return (-1); if (read_Bools( a, h->emptyStreamBools, (size_t)zip->numFiles) < 0) return (-1); empty_streams = 0; for (i = 0; i < zip->numFiles; i++) { if (h->emptyStreamBools[i]) empty_streams++; } break; case kEmptyFile: if (empty_streams <= 0) { /* Unexcepted sequence. Skip this. */ if (header_bytes(a, ll) == NULL) return (-1); break; } h->emptyFileBools = calloc(empty_streams, sizeof(*h->emptyFileBools)); if (h->emptyFileBools == NULL) return (-1); if (read_Bools(a, h->emptyFileBools, empty_streams) < 0) return (-1); break; case kAnti: if (empty_streams <= 0) { /* Unexcepted sequence. Skip this. */ if (header_bytes(a, ll) == NULL) return (-1); break; } h->antiBools = calloc(empty_streams, sizeof(*h->antiBools)); if (h->antiBools == NULL) return (-1); if (read_Bools(a, h->antiBools, empty_streams) < 0) return (-1); break; case kCTime: case kATime: case kMTime: if (read_Times(a, h, type) < 0) return (-1); break; case kName: { unsigned char *np; size_t nl, nb; /* Skip one byte. */ if ((p = header_bytes(a, 1)) == NULL) return (-1); ll--; if ((ll & 1) || ll < zip->numFiles * 4) return (-1); zip->entry_names = malloc(ll); if (zip->entry_names == NULL) return (-1); np = zip->entry_names; nb = ll; /* * Copy whole file names. * NOTE: This loop prevents from expanding * the uncompressed buffer in order not to * use extra memory resource. */ while (nb) { size_t b; if (nb > UBUFF_SIZE) b = UBUFF_SIZE; else b = nb; if ((p = header_bytes(a, b)) == NULL) return (-1); memcpy(np, p, b); np += b; nb -= b; } np = zip->entry_names; nl = ll; for (i = 0; i < zip->numFiles; i++) { entries[i].utf16name = np; #if defined(_WIN32) && !defined(__CYGWIN__) && defined(_DEBUG) entries[i].wname = (wchar_t *)np; #endif /* Find a terminator. */ while (nl >= 2 && (np[0] || np[1])) { np += 2; nl -= 2; } if (nl < 2) return (-1);/* Terminator not found */ entries[i].name_len = np - entries[i].utf16name; np += 2; nl -= 2; } break; } case kAttributes: { int allAreDefined; if ((p = header_bytes(a, 2)) == NULL) return (-1); allAreDefined = *p; h->attrBools = calloc((size_t)zip->numFiles, sizeof(*h->attrBools)); if (h->attrBools == NULL) return (-1); if (allAreDefined) memset(h->attrBools, 1, (size_t)zip->numFiles); else { if (read_Bools(a, h->attrBools, (size_t)zip->numFiles) < 0) return (-1); } for (i = 0; i < zip->numFiles; i++) { if (h->attrBools[i]) { if ((p = header_bytes(a, 4)) == NULL) return (-1); entries[i].attr = archive_le32dec(p); } } break; } case kDummy: if (ll == 0) break; default: if (header_bytes(a, ll) == NULL) return (-1); break; } } /* * Set up entry's attributes. */ folders = si->ci.folders; eindex = sindex = 0; folderIndex = indexInFolder = 0; for (i = 0; i < zip->numFiles; i++) { if (h->emptyStreamBools == NULL || h->emptyStreamBools[i] == 0) entries[i].flg |= HAS_STREAM; /* The high 16 bits of attributes is a posix file mode. */ entries[i].mode = entries[i].attr >> 16; if (entries[i].flg & HAS_STREAM) { if ((size_t)sindex >= si->ss.unpack_streams) return (-1); if (entries[i].mode == 0) entries[i].mode = AE_IFREG | 0666; if (si->ss.digestsDefined[sindex]) entries[i].flg |= CRC32_IS_SET; entries[i].ssIndex = sindex; sindex++; } else { int dir; if (h->emptyFileBools == NULL) dir = 1; else { if (h->emptyFileBools[eindex]) dir = 0; else dir = 1; eindex++; } if (entries[i].mode == 0) { if (dir) entries[i].mode = AE_IFDIR | 0777; else entries[i].mode = AE_IFREG | 0666; } else if (dir && (entries[i].mode & AE_IFMT) != AE_IFDIR) { entries[i].mode &= ~AE_IFMT; entries[i].mode |= AE_IFDIR; } if ((entries[i].mode & AE_IFMT) == AE_IFDIR && entries[i].name_len >= 2 && (entries[i].utf16name[entries[i].name_len-2] != '/' || entries[i].utf16name[entries[i].name_len-1] != 0)) { entries[i].utf16name[entries[i].name_len] = '/'; entries[i].utf16name[entries[i].name_len+1] = 0; entries[i].name_len += 2; } entries[i].ssIndex = -1; } if (entries[i].attr & 0x01) entries[i].mode &= ~0222;/* Read only. */ if ((entries[i].flg & HAS_STREAM) == 0 && indexInFolder == 0) { /* * The entry is an empty file or a directory file, * those both have no contents. */ entries[i].folderIndex = -1; continue; } if (indexInFolder == 0) { for (;;) { if (folderIndex >= si->ci.numFolders) return (-1); if (folders[folderIndex].numUnpackStreams) break; folderIndex++; } } entries[i].folderIndex = folderIndex; if ((entries[i].flg & HAS_STREAM) == 0) continue; indexInFolder++; if (indexInFolder >= folders[folderIndex].numUnpackStreams) { folderIndex++; indexInFolder = 0; } } return (0); } ",0 "void VerifyProxyScript(Browser* browser) { ui_test_utils::NavigateToURL(browser, GURL(""http://google.com"")); bool result = false; EXPECT_TRUE(content::ExecuteScriptAndExtractBool( browser->tab_strip_model()->GetActiveWebContents(), ""var textContent = document.body.textContent;"" ""var hasError = textContent.indexOf('ERR_PROXY_CONNECTION_FAILED') >= 0;"" ""domAutomationController.send(hasError);"", &result)); EXPECT_TRUE(result); } ",0 "static void __dwc3_prepare_one_trb(struct dwc3_ep *dep, struct dwc3_trb *trb, dma_addr_t dma, unsigned length, unsigned chain, unsigned node, unsigned stream_id, unsigned short_not_ok, unsigned no_interrupt) { struct dwc3 *dwc = dep->dwc; struct usb_gadget *gadget = &dwc->gadget; enum usb_device_speed speed = gadget->speed; dwc3_ep_inc_enq(dep); trb->size = DWC3_TRB_SIZE_LENGTH(length); trb->bpl = lower_32_bits(dma); trb->bph = upper_32_bits(dma); switch (usb_endpoint_type(dep->endpoint.desc)) { case USB_ENDPOINT_XFER_CONTROL: trb->ctrl = DWC3_TRBCTL_CONTROL_SETUP; break; case USB_ENDPOINT_XFER_ISOC: if (!node) { trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS_FIRST; /* * USB Specification 2.0 Section 5.9.2 states that: ""If * there is only a single transaction in the microframe, * only a DATA0 data packet PID is used. If there are * two transactions per microframe, DATA1 is used for * the first transaction data packet and DATA0 is used * for the second transaction data packet. If there are * three transactions per microframe, DATA2 is used for * the first transaction data packet, DATA1 is used for * the second, and DATA0 is used for the third."" * * IOW, we should satisfy the following cases: * * 1) length <= maxpacket * - DATA0 * * 2) maxpacket < length <= (2 * maxpacket) * - DATA1, DATA0 * * 3) (2 * maxpacket) < length <= (3 * maxpacket) * - DATA2, DATA1, DATA0 */ if (speed == USB_SPEED_HIGH) { struct usb_ep *ep = &dep->endpoint; unsigned int mult = 2; unsigned int maxp = usb_endpoint_maxp(ep->desc); if (length <= (2 * maxp)) mult--; if (length <= maxp) mult--; trb->size |= DWC3_TRB_SIZE_PCM1(mult); } } else { trb->ctrl = DWC3_TRBCTL_ISOCHRONOUS; } /* always enable Interrupt on Missed ISOC */ trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; break; case USB_ENDPOINT_XFER_BULK: case USB_ENDPOINT_XFER_INT: trb->ctrl = DWC3_TRBCTL_NORMAL; break; default: /* * This is only possible with faulty memory because we * checked it already :) */ dev_WARN(dwc->dev, ""Unknown endpoint type %d\n"", usb_endpoint_type(dep->endpoint.desc)); } /* always enable Continue on Short Packet */ if (usb_endpoint_dir_out(dep->endpoint.desc)) { trb->ctrl |= DWC3_TRB_CTRL_CSP; if (short_not_ok) trb->ctrl |= DWC3_TRB_CTRL_ISP_IMI; } if ((!no_interrupt && !chain) || (dwc3_calc_trbs_left(dep) == 0)) trb->ctrl |= DWC3_TRB_CTRL_IOC; if (chain) trb->ctrl |= DWC3_TRB_CTRL_CHN; if (usb_endpoint_xfer_bulk(dep->endpoint.desc) && dep->stream_capable) trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(stream_id); trb->ctrl |= DWC3_TRB_CTRL_HWO; trace_dwc3_prepare_trb(dep, trb); } ",0 "ScriptProcessorNode* ScriptProcessorNode::Create( BaseAudioContext& context, size_t buffer_size, unsigned number_of_input_channels, ExceptionState& exception_state) { DCHECK(IsMainThread()); return Create(context, buffer_size, number_of_input_channels, 2, exception_state); } ",0 "static void keyring_free_preparse(struct key_preparsed_payload *prep) { } ",0 "static void CacheSignalHandler(int status) { ThrowFatalException(CacheFatalError,""UnableToExtendPixelCache""); } ",0 "int js_pconstruct(js_State *J, int n) { int savetop = TOP - n - 2; if (js_try(J)) { /* clean up the stack to only hold the error object */ STACK[savetop] = STACK[TOP-1]; TOP = savetop + 1; return 1; } js_construct(J, n); js_endtry(J); return 0; } ",0 "static bool ParseVp9CodecID(const std::string& mime_type_lower_case, const std::string& codec_id, VideoCodecProfile* out_profile, uint8_t* out_level, gfx::ColorSpace::TransferID* out_eotf) { if (mime_type_lower_case == ""video/mp4"") { if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableVp9InMp4)) { return ParseNewStyleVp9CodecID(codec_id, out_profile, out_level, out_eotf); } } else if (mime_type_lower_case == ""video/webm"") { if (HasNewVp9CodecStringSupport() && ParseNewStyleVp9CodecID(codec_id, out_profile, out_level, out_eotf)) { return true; } return ParseLegacyVp9CodecID(codec_id, out_profile, out_level); } return false; } ",1 "ref_param_get_next_key(gs_param_list * plist, gs_param_enumerator_t * penum, gs_param_key_t * key) { ref_type keytype; /* result not needed here */ iparam_list *const pilist = (iparam_list *) plist; return (*pilist->enumerate) (pilist, penum, key, &keytype); } ",0 "static bool vmx_mpx_supported(void) { return (vmcs_config.vmexit_ctrl & VM_EXIT_CLEAR_BNDCFGS) && (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_BNDCFGS); } ",0 "TabAnimationDelegate::~TabAnimationDelegate() {} ",0 "static void d_lru_del(struct dentry *dentry) { D_FLAG_VERIFY(dentry, DCACHE_LRU_LIST); dentry->d_flags &= ~DCACHE_LRU_LIST; this_cpu_dec(nr_dentry_unused); WARN_ON_ONCE(!list_lru_del(&dentry->d_sb->s_dentry_lru, &dentry->d_lru)); } ",0 "JsArgList SyncManager::SyncInternal::GetChildNodeIds( const JsArgList& args) { ListValue return_args; ListValue* child_ids = new ListValue(); return_args.Append(child_ids); int64 id = GetId(args.Get(), 0); if (id != kInvalidId) { ReadTransaction trans(FROM_HERE, GetUserShare()); syncable::Directory::ChildHandles child_handles; trans.GetLookup()->GetChildHandlesByHandle(trans.GetWrappedTrans(), id, &child_handles); for (syncable::Directory::ChildHandles::const_iterator it = child_handles.begin(); it != child_handles.end(); ++it) { child_ids->Append(Value::CreateStringValue( base::Int64ToString(*it))); } } return JsArgList(&return_args); } ",0 "static void entersafe_init_pin_info(struct sc_pin_cmd_pin *pin, unsigned int num) { pin->encoding = SC_PIN_ENCODING_ASCII; pin->min_length = 4; pin->max_length = 16; pin->pad_length = 16; pin->offset = 5 + num * 16; pin->pad_char = 0x00; } ",0 "alloc_strvec_r(char *string) { char *cp, *start, *token; size_t str_len; vector_t *strvec; if (!string) return NULL; /* Create a vector and alloc each command piece */ strvec = vector_alloc(); cp = string; while (true) { cp += strspn(cp, WHITE_SPACE); if (!*cp) break; start = cp; /* Save a quoted string without the """"s as a single string */ if (*start == '""') { start++; if (!(cp = strchr(start, '""'))) { report_config_error(CONFIG_UNMATCHED_QUOTE, ""Unmatched quote: '%s'"", string); break; } str_len = (size_t)(cp - start); cp++; } else { cp += strcspn(start, WHITE_SPACE_STR ""\""""); str_len = (size_t)(cp - start); } token = MALLOC(str_len + 1); memcpy(token, start, str_len); token[str_len] = '\0'; /* Alloc & set the slot */ vector_alloc_slot(strvec); vector_set_slot(strvec, token); } if (!vector_size(strvec)) { free_strvec(strvec); return NULL; } return strvec; } ",0 "void VerifySyncedSession( const std::string& tag, const std::vector >& windows, const SyncedSession& session) { ASSERT_EQ(tag, session.session_tag); ASSERT_EQ(SyncedSession::TYPE_LINUX, session.device_type); ASSERT_EQ(""name"", session.session_name); ASSERT_EQ(windows.size(), session.windows.size()); int i = 0; for (std::vector >::const_iterator win_iter = windows.begin(); win_iter != windows.end(); ++win_iter, ++i) { SessionWindow* win_ptr; SyncedSession::SyncedWindowMap::const_iterator map_iter = session.windows.find(i); if (map_iter != session.windows.end()) win_ptr = map_iter->second; else FAIL(); ASSERT_EQ(win_iter->size(), win_ptr->tabs.size()); ASSERT_EQ(0, win_ptr->selected_tab_index); ASSERT_EQ(1, win_ptr->type); int j = 0; for (std::vector::const_iterator tab_iter = (*win_iter).begin(); tab_iter != (*win_iter).end(); ++tab_iter, ++j) { SessionTab* tab = win_ptr->tabs[j]; ASSERT_EQ(*tab_iter, tab->tab_id.id()); ASSERT_EQ(1U, tab->navigations.size()); ASSERT_EQ(1, tab->tab_visual_index); ASSERT_EQ(0, tab->current_navigation_index); ASSERT_TRUE(tab->pinned); ASSERT_EQ(""app_id"", tab->extension_app_id); ASSERT_EQ(1U, tab->navigations.size()); ASSERT_EQ(12, tab->navigations[0].index()); ASSERT_EQ(tab->navigations[0].virtual_url(), GURL(""http://foo/1"")); ASSERT_EQ(tab->navigations[0].referrer().url, GURL(""referrer"")); ASSERT_EQ(tab->navigations[0].title(), string16(ASCIIToUTF16(""title""))); ASSERT_EQ(tab->navigations[0].transition(), content::PAGE_TRANSITION_TYPED); } } } ",0 "void EmbeddedWorkerContextClient::workerContextStarted( blink::WebServiceWorkerContextProxy* proxy) { DCHECK(!worker_task_runner_); worker_task_runner_ = new WorkerThreadTaskRunner( WorkerTaskRunner::Instance()->CurrentWorkerId()); DCHECK_NE(0, WorkerTaskRunner::Instance()->CurrentWorkerId()); DCHECK(g_worker_client_tls.Pointer()->Get() == NULL); DCHECK(!script_context_); g_worker_client_tls.Pointer()->Set(this); script_context_.reset(new ServiceWorkerScriptContext(this, proxy)); worker_task_runner_->PostTask( FROM_HERE, base::Bind(&EmbeddedWorkerContextClient::SendWorkerStarted, weak_factory_.GetWeakPtr())); } ",0 "const Cluster* Segment::FindCluster(long long time_ns) const { if ((m_clusters == NULL) || (m_clusterCount <= 0)) return &m_eos; { Cluster* const pCluster = m_clusters[0]; assert(pCluster); assert(pCluster->m_index == 0); if (time_ns <= pCluster->GetTime()) return pCluster; } long i = 0; long j = m_clusterCount; while (i < j) { const long k = i + (j - i) / 2; assert(k < m_clusterCount); Cluster* const pCluster = m_clusters[k]; assert(pCluster); assert(pCluster->m_index == k); const long long t = pCluster->GetTime(); if (t <= time_ns) i = k + 1; else j = k; assert(i <= j); } assert(i == j); assert(i > 0); assert(i <= m_clusterCount); const long k = i - 1; Cluster* const pCluster = m_clusters[k]; assert(pCluster); assert(pCluster->m_index == k); assert(pCluster->GetTime() <= time_ns); return pCluster; } ",0 "mrb_class_name_class(mrb_state *mrb, struct RClass *outer, struct RClass *c, mrb_sym id) { mrb_value name; mrb_sym nsym = mrb_intern_lit(mrb, ""__classname__""); if (mrb_obj_iv_defined(mrb, (struct RObject*)c, nsym)) return; if (outer == NULL || outer == mrb->object_class) { name = mrb_symbol_value(id); } else { name = mrb_class_path(mrb, outer); if (mrb_nil_p(name)) { /* unnamed outer class */ if (outer != mrb->object_class) { mrb_obj_iv_set(mrb, (struct RObject*)c, mrb_intern_lit(mrb, ""__outer__""), mrb_obj_value(outer)); } return; } mrb_str_cat_cstr(mrb, name, ""::""); mrb_str_cat_cstr(mrb, name, mrb_sym2name(mrb, id)); } mrb_obj_iv_set(mrb, (struct RObject*)c, nsym, name); } ",0 "static void bond_set_lockdep_class(struct net_device *dev) { lockdep_set_class(&dev->addr_list_lock, &bonding_netdev_addr_lock_key); netdev_for_each_tx_queue(dev, bond_set_lockdep_class_one, NULL); } ",0 "void gss_spnegoint_lib_fini(void) { } ",0 "bool AuthenticatorSelectAccountSheetModel::IsAcceptButtonVisible() const { return false; } ",0 "ssh_packet_set_compress_state(struct ssh *ssh, struct sshbuf *m) { struct session_state *state = ssh->state; struct sshbuf *b = NULL; int r; const u_char *inblob, *outblob; size_t inl, outl; if ((r = sshbuf_froms(m, &b)) != 0) goto out; if ((r = sshbuf_get_string_direct(b, &inblob, &inl)) != 0 || (r = sshbuf_get_string_direct(b, &outblob, &outl)) != 0) goto out; if (inl == 0) state->compression_in_started = 0; else if (inl != sizeof(state->compression_in_stream)) { r = SSH_ERR_INTERNAL_ERROR; goto out; } else { state->compression_in_started = 1; memcpy(&state->compression_in_stream, inblob, inl); } if (outl == 0) state->compression_out_started = 0; else if (outl != sizeof(state->compression_out_stream)) { r = SSH_ERR_INTERNAL_ERROR; goto out; } else { state->compression_out_started = 1; memcpy(&state->compression_out_stream, outblob, outl); } r = 0; out: sshbuf_free(b); return r; } ",1 "int intel_pmu_save_and_restart(struct perf_event *event) { x86_perf_event_update(event); return x86_perf_event_set_period(event); } ",0 "DaemonProcess::DaemonProcess( scoped_refptr caller_task_runner, scoped_refptr io_task_runner, const base::Closure& stopped_callback) : Stoppable(caller_task_runner, stopped_callback), caller_task_runner_(caller_task_runner), io_task_runner_(io_task_runner), next_terminal_id_(0) { DCHECK(caller_task_runner->BelongsToCurrentThread()); } ",0 "static void __init i8042_free_kbd_port(void) { kfree(i8042_ports[I8042_KBD_PORT_NO].serio); i8042_ports[I8042_KBD_PORT_NO].serio = NULL; } ",0 "int t2p_process_jpeg_strip( unsigned char* strip, tsize_t* striplength, unsigned char* buffer, tsize_t* bufferoffset, tstrip_t no, uint32 height){ tsize_t i=0; while (i < *striplength) { tsize_t datalen; uint16 ri; uint16 v_samp; uint16 h_samp; int j; int ncomp; /* marker header: one or more FFs */ if (strip[i] != 0xff) return(0); i++; while (i < *striplength && strip[i] == 0xff) i++; if (i >= *striplength) return(0); /* SOI is the only pre-SOS marker without a length word */ if (strip[i] == 0xd8) datalen = 0; else { if ((*striplength - i) <= 2) return(0); datalen = (strip[i+1] << 8) | strip[i+2]; if (datalen < 2 || datalen >= (*striplength - i)) return(0); } switch( strip[i] ){ case 0xd8: /* SOI - start of image */ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), 2); *bufferoffset+=2; break; case 0xc0: /* SOF0 */ case 0xc1: /* SOF1 */ case 0xc3: /* SOF3 */ case 0xc9: /* SOF9 */ case 0xca: /* SOF10 */ if(no==0){ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2); ncomp = buffer[*bufferoffset+9]; if (ncomp < 1 || ncomp > 4) return(0); v_samp=1; h_samp=1; for(j=0;j>4) > h_samp) h_samp = (samp>>4); if( (samp & 0x0f) > v_samp) v_samp = (samp & 0x0f); } v_samp*=8; h_samp*=8; ri=((( ((uint16)(buffer[*bufferoffset+5])<<8) | (uint16)(buffer[*bufferoffset+6]) )+v_samp-1)/ v_samp); ri*=((( ((uint16)(buffer[*bufferoffset+7])<<8) | (uint16)(buffer[*bufferoffset+8]) )+h_samp-1)/ h_samp); buffer[*bufferoffset+5]= (unsigned char) ((height>>8) & 0xff); buffer[*bufferoffset+6]= (unsigned char) (height & 0xff); *bufferoffset+=datalen+2; /* insert a DRI marker */ buffer[(*bufferoffset)++]=0xff; buffer[(*bufferoffset)++]=0xdd; buffer[(*bufferoffset)++]=0x00; buffer[(*bufferoffset)++]=0x04; buffer[(*bufferoffset)++]=(ri >> 8) & 0xff; buffer[(*bufferoffset)++]= ri & 0xff; } break; case 0xc4: /* DHT */ case 0xdb: /* DQT */ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2); *bufferoffset+=datalen+2; break; case 0xda: /* SOS */ if(no==0){ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i-1]), datalen+2); *bufferoffset+=datalen+2; } else { buffer[(*bufferoffset)++]=0xff; buffer[(*bufferoffset)++]= (unsigned char)(0xd0 | ((no-1)%8)); } i += datalen + 1; /* copy remainder of strip */ _TIFFmemcpy(&(buffer[*bufferoffset]), &(strip[i]), *striplength - i); *bufferoffset+= *striplength - i; return(1); default: /* ignore any other marker */ break; } i += datalen + 1; } /* failed to find SOS marker */ return(0); } ",1 "acpi_status acpi_os_purge_cache(acpi_cache_t * cache) { kmem_cache_shrink(cache); return (AE_OK); } ",0 "static bool NeedsCssClip(const LayoutObject& object) { return object.HasClip(); } ",0 "PassOwnPtr WebFrameLoaderClient::GetPluginLoadObserver() { WebDataSourceImpl* ds = WebDataSourceImpl::fromDocumentLoader( webframe_->frame()->loader()->activeDocumentLoader()); return ds->releasePluginLoadObserver(); } ",0 "static U32 ZSTD_equivalentParams(ZSTD_CCtx_params params1, ZSTD_CCtx_params params2, size_t buffSize1, size_t maxNbSeq1, size_t maxNbLit1, ZSTD_buffered_policy_e buffPol2, U64 pledgedSrcSize) { DEBUGLOG(4, ""ZSTD_equivalentParams: pledgedSrcSize=%u"", (U32)pledgedSrcSize); if (!ZSTD_equivalentCParams(params1.cParams, params2.cParams)) { DEBUGLOG(4, ""ZSTD_equivalentCParams() == 0""); return 0; } if (!ZSTD_equivalentLdmParams(params1.ldmParams, params2.ldmParams)) { DEBUGLOG(4, ""ZSTD_equivalentLdmParams() == 0""); return 0; } if (!ZSTD_sufficientBuff(buffSize1, maxNbSeq1, maxNbLit1, buffPol2, params2.cParams, pledgedSrcSize)) { DEBUGLOG(4, ""ZSTD_sufficientBuff() == 0""); return 0; } return 1; } ",0 "int __sys_connect(int fd, struct sockaddr __user *uservaddr, int addrlen) { struct socket *sock; struct sockaddr_storage address; int err, fput_needed; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) goto out; err = move_addr_to_kernel(uservaddr, addrlen, &address); if (err < 0) goto out_put; err = security_socket_connect(sock, (struct sockaddr *)&address, addrlen); if (err) goto out_put; err = sock->ops->connect(sock, (struct sockaddr *)&address, addrlen, sock->file->f_flags); out_put: fput_light(sock->file, fput_needed); out: return err; } ",0 "int register_die_notifier(struct notifier_block *nb) { return atomic_notifier_chain_register(&powerpc_die_chain, nb); } ",0 " void SynchronousCompositorExternalBeginFrameSource::SetCompositor( SynchronousCompositorImpl* compositor) { DCHECK(CalledOnValidThread()); compositor_ = compositor; } ",1 "static int add_imm(RAnal* anal, RAnalOp* op, ut16 code){ op->type = R_ANAL_OP_TYPE_ADD; op->src[0] = anal_fill_im (anal, (st8)(code&0xFF)); //Casting to (st8) forces sign-extension. op->dst = anal_fill_ai_rg (anal, GET_TARGET_REG(code)); return op->size; } ",0 "int add_argv(const char *what, int quoted) { DEBUGP(""add_argv: %s\n"", what); if (what && newargc + 1 < ARRAY_SIZE(newargv)) { newargv[newargc] = strdup(what); newargvattr[newargc] = quoted; newargv[++newargc] = NULL; return 1; } else { xtables_error(PARAMETER_PROBLEM, ""Parser cannot handle more arguments\n""); } } ",0 "void FrameLoader::navigateToDifferentDocument(HistoryItem* item, FrameLoadType loadType) { history()->setProvisionalItem(item); if (CachedPage* cachedPage = pageCache()->get(item)) { loadWithDocumentLoader(cachedPage->documentLoader(), loadType, 0); return; } KURL itemURL = item->url(); KURL itemOriginalURL = item->originalURL(); KURL currentURL; if (documentLoader()) currentURL = documentLoader()->url(); RefPtr formData = item->formData(); bool addedExtraFields = false; ResourceRequest request(itemURL); if (!item->referrer().isNull()) request.setHTTPReferrer(item->referrer()); NavigationAction action; if (formData) { formData->generateFiles(m_frame->document()); request.setHTTPMethod(""POST""); request.setHTTPBody(formData); request.setHTTPContentType(item->formContentType()); RefPtr securityOrigin = SecurityOrigin::createFromString(item->referrer()); addHTTPOriginIfNeeded(request, securityOrigin->toString()); addExtraFieldsToRequest(request, m_loadType, true, formData); addedExtraFields = true; if (ResourceHandle::willLoadFromCache(request, m_frame)) action = NavigationAction(itemURL, loadType, false); else { request.setCachePolicy(ReloadIgnoringCacheData); action = NavigationAction(itemURL, NavigationTypeFormResubmitted); } } else { switch (loadType) { case FrameLoadTypeReload: case FrameLoadTypeReloadFromOrigin: request.setCachePolicy(ReloadIgnoringCacheData); break; case FrameLoadTypeBack: case FrameLoadTypeBackWMLDeckNotAccessible: case FrameLoadTypeForward: case FrameLoadTypeIndexedBackForward: if (m_stateMachine.committedFirstRealDocumentLoad() && !itemURL.protocolIs(""https"")) request.setCachePolicy(ReturnCacheDataElseLoad); break; case FrameLoadTypeStandard: case FrameLoadTypeRedirectWithLockedBackForwardList: break; case FrameLoadTypeSame: default: ASSERT_NOT_REACHED(); } action = NavigationAction(itemOriginalURL, loadType, false); } if (!addedExtraFields) addExtraFieldsToRequest(request, m_loadType, true, formData); loadWithNavigationAction(request, action, false, loadType, 0); } ",0 "static int do_video_stillpicture(unsigned int fd, unsigned int cmd, struct compat_video_still_picture __user *up) { struct video_still_picture __user *up_native; compat_uptr_t fp; int32_t size; int err; err = get_user(fp, &up->iFrame); err |= get_user(size, &up->size); if (err) return -EFAULT; up_native = compat_alloc_user_space(sizeof(struct video_still_picture)); err = put_user(compat_ptr(fp), &up_native->iFrame); err |= put_user(size, &up_native->size); if (err) return -EFAULT; err = sys_ioctl(fd, cmd, (unsigned long) up_native); return err; } ",0 "same_prefix (guint32 address1, guint32 address2, int plen) { guint32 masked1 = ntohl (address1) >> (32 - plen); guint32 masked2 = ntohl (address2) >> (32 - plen); return masked1 == masked2; } ",0 "void nlmsvc_traverse_blocks(struct nlm_host *host, struct nlm_file *file, nlm_host_match_fn_t match) { struct nlm_block *block, *next; restart: mutex_lock(&file->f_mutex); list_for_each_entry_safe(block, next, &file->f_blocks, b_flist) { if (!match(block->b_host, host)) continue; /* Do not destroy blocks that are not on * the global retry list - why? */ if (list_empty(&block->b_list)) continue; kref_get(&block->b_count); mutex_unlock(&file->f_mutex); nlmsvc_unlink_block(block); nlmsvc_release_block(block); goto restart; } mutex_unlock(&file->f_mutex); } ",0 "static bool ExecuteMoveToEndOfParagraphAndModifySelection(LocalFrame& frame, Event*, EditorCommandSource, const String&) { frame.Selection().Modify( SelectionModifyAlteration::kExtend, SelectionModifyDirection::kForward, TextGranularity::kParagraphBoundary, SetSelectionBy::kUser); return true; } ",0 "static int process_metadata(AVFormatContext *s, const uint8_t *name, uint16_t name_len, uint16_t val_len, uint16_t type, AVDictionary **met) { int ret; ff_asf_guid guid; if (val_len) { switch (type) { case ASF_UNICODE: asf_read_value(s, name, val_len, type, met); break; case ASF_BYTE_ARRAY: if (!strcmp(name, ""WM/Picture"")) // handle cover art asf_read_picture(s, val_len); else if (!strcmp(name, ""ID3"")) // handle ID3 tag get_id3_tag(s, val_len); else asf_read_value(s, name, val_len, type, met); break; case ASF_GUID: ff_get_guid(s->pb, &guid); break; default: if ((ret = asf_set_metadata(s, name, type, met)) < 0) return ret; break; } } return 0; } ",0 "void EvalNamedColor(const cmsFloat32Number In[], cmsFloat32Number Out[], const cmsStage *mpe) { cmsNAMEDCOLORLIST* NamedColorList = (cmsNAMEDCOLORLIST*) mpe ->Data; cmsUInt16Number index = (cmsUInt16Number) _cmsQuickSaturateWord(In[0] * 65535.0); cmsUInt32Number j; if (index >= NamedColorList-> nColors) { cmsSignalError(NamedColorList ->ContextID, cmsERROR_RANGE, ""Color %d out of range; ignored"", index); } else { for (j=0; j < NamedColorList ->ColorantCount; j++) Out[j] = (cmsFloat32Number) (NamedColorList->List[index].DeviceColorant[j] / 65535.0); } } ",0 "static __le16 ext4_group_desc_csum(struct super_block *sb, __u32 block_group, struct ext4_group_desc *gdp) { int offset; __u16 crc = 0; __le32 le_group = cpu_to_le32(block_group); struct ext4_sb_info *sbi = EXT4_SB(sb); if (ext4_has_metadata_csum(sbi->s_sb)) { /* Use new metadata_csum algorithm */ __le16 save_csum; __u32 csum32; save_csum = gdp->bg_checksum; gdp->bg_checksum = 0; csum32 = ext4_chksum(sbi, sbi->s_csum_seed, (__u8 *)&le_group, sizeof(le_group)); csum32 = ext4_chksum(sbi, csum32, (__u8 *)gdp, sbi->s_desc_size); gdp->bg_checksum = save_csum; crc = csum32 & 0xFFFF; goto out; } /* old crc16 code */ if (!ext4_has_feature_gdt_csum(sb)) return 0; offset = offsetof(struct ext4_group_desc, bg_checksum); crc = crc16(~0, sbi->s_es->s_uuid, sizeof(sbi->s_es->s_uuid)); crc = crc16(crc, (__u8 *)&le_group, sizeof(le_group)); crc = crc16(crc, (__u8 *)gdp, offset); offset += sizeof(gdp->bg_checksum); /* skip checksum */ /* for checksum of struct ext4_group_desc do the rest...*/ if (ext4_has_feature_64bit(sb) && offset < le16_to_cpu(sbi->s_es->s_desc_size)) crc = crc16(crc, (__u8 *)gdp + offset, le16_to_cpu(sbi->s_es->s_desc_size) - offset); out: return cpu_to_le16(crc); } ",0 "String FrameLoader::referrer() const { return m_documentLoader ? m_documentLoader->request().httpReferrer() : """"; } ",0 "void Browser::DeactivateContents(TabContents* contents) { window_->Deactivate(); } ",0 "gfx::Size AutofillDialogViews::CalculatePreferredSize( bool get_minimum_size) const { gfx::Insets insets = GetInsets(); gfx::Size scroll_size = scrollable_area_->contents()->GetPreferredSize(); const int width = scroll_size.width(); if (sign_in_web_view_->visible()) { const gfx::Size size = static_cast(sign_in_web_view_)-> GetPreferredSize(); return gfx::Size(width + insets.width(), size.height() + insets.height()); } if (overlay_view_->visible()) { const int height = overlay_view_->GetHeightForContentsForWidth(width); if (height != 0) return gfx::Size(width + insets.width(), height + insets.height()); } if (loading_shield_->visible()) { return gfx::Size(width + insets.width(), loading_shield_height_ + insets.height()); } int height = 0; const int notification_height = notification_area_->GetHeightForWidth(width); if (notification_height > notification_area_->GetInsets().height()) height += notification_height + views::kRelatedControlVerticalSpacing; if (scrollable_area_->visible()) height += get_minimum_size ? kMinimumContentsHeight : scroll_size.height(); return gfx::Size(width + insets.width(), height + insets.height()); } ",0 "FileTransfer::ObtainAndSendTransferGoAhead(DCTransferQueue &xfer_queue,bool downloading,Stream *s,char const *full_fname,bool &go_ahead_always) { bool result; bool try_again = true; int hold_code = 0; int hold_subcode = 0; MyString error_desc; result = DoObtainAndSendTransferGoAhead(xfer_queue,downloading,s,full_fname,go_ahead_always,try_again,hold_code,hold_subcode,error_desc); if( !result ) { SaveTransferInfo(false,try_again,hold_code,hold_subcode,error_desc.Value()); if( error_desc.Length() ) { dprintf(D_ALWAYS,""%s\n"",error_desc.Value()); } } return result; } ",0 "void nfs4_reset_write(struct rpc_task *task, struct nfs_write_data *data) { dprintk(""%s Reset task for i/o through\n"", __func__); put_lseg(data->lseg); data->lseg = NULL; data->ds_clp = NULL; data->write_done_cb = nfs4_write_done_cb; data->args.fh = NFS_FH(data->inode); data->args.bitmask = data->res.server->cache_consistency_bitmask; data->args.offset = data->mds_offset; data->res.fattr = &data->fattr; task->tk_ops = data->mds_ops; rpc_task_reset_client(task, NFS_CLIENT(data->inode)); } ",0 "static void stringAttrAttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.stringAttr._set""); TestObj* imp = V8TestObj::toNative(info.Holder()); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK_VOID(V8Parameter<>, v, value); imp->setStringAttr(v); return; } ",0 "static const char *generate_message(cmd_parms *cmd, void *dummy, const char *arg) { /* cast with 64-bit warning avoidance */ int level = (cmd->info==(void*)APLOG_ERR)? APLOG_ERR: APLOG_WARNING; char * msg; /* get position information from wherever we can? */ ap_configfile_t * cf = cmd->config_file; ap_directive_t const * ed1 = cmd->directive; ap_directive_t const * ed2 = cmd->err_directive; /* expect an argument */ if (!arg || !*arg) { return ""The Error or Warning directive was used with no message.""; } /* set message, strip off quotes if necessary */ msg = (char *)arg; if (*arg == '""' || *arg == '\'') { apr_size_t len = strlen(arg); char last = *(arg + len - 1); if (*arg == last) { msg = apr_pstrndup(cmd->pool, arg + 1, len - 2); } } /* generate error or warning with a configuration file position. * the log is displayed on the terminal as no log file is opened yet. */ ap_log_error(APLOG_MARK, level, 0, NULL, ""%s on line %d of %s"", msg, cf? cf->line_number: ed1? ed1->line_num: ed2? ed2->line_num: -1, cf? cf->name: ed1? ed1->filename: ed2? ed2->filename: """"); /* message displayed above, return will stop configuration processing */ return level==APLOG_ERR? ""Configuration processing stopped by Error directive"": NULL; } ",0 "RenderSVGResourceContainer* SVGDocumentExtensions::resourceById(const AtomicString& id) const { if (id.isEmpty()) return 0; return m_resources.get(id); } ",0 " cf2_outline_init( CF2_Outline outline, FT_Memory memory, FT_Error* error ) { FT_MEM_ZERO( outline, sizeof ( CF2_OutlineRec ) ); outline->root.memory = memory; outline->root.error = error; outline->root.moveTo = cf2_builder_moveTo; outline->root.lineTo = cf2_builder_lineTo; outline->root.cubeTo = cf2_builder_cubeTo; } ",0 "void JSTestActiveDOMObject::finishCreation(JSGlobalData& globalData) { Base::finishCreation(globalData); ASSERT(inherits(&s_info)); } ",0 " explicit MyVorbisExtractor(const sp &source) : MyOggExtractor(source, MEDIA_MIMETYPE_AUDIO_VORBIS, /* numHeaders */ 3, /* seekPreRollUs */ 0) { } ",0 "static NPObject* createScriptObject(Frame* frame) { v8::HandleScope handleScope; v8::Handle v8Context = ScriptController::mainWorldContext(frame); if (v8Context.IsEmpty()) return createNoScriptObject(); v8::Context::Scope scope(v8Context); DOMWindow* window = frame->domWindow(); v8::Handle global = toV8(window, v8::Handle(), v8Context->GetIsolate()); ASSERT(global->IsObject()); return npCreateV8ScriptObject(0, v8::Handle::Cast(global), window); } ",0 "void FileReaderLoader::didReceiveData(const char* data, int dataLength) { ASSERT(data); ASSERT(dataLength > 0); if (m_errorCode) return; int length = dataLength; unsigned remainingBufferSpace = m_totalBytes - m_bytesLoaded; if (length > static_cast(remainingBufferSpace)) { if (m_totalBytes >= numeric_limits::max()) { failed(FileError::NOT_READABLE_ERR); return; } if (m_variableLength) { unsigned long long newLength = m_totalBytes * 2; if (newLength > numeric_limits::max()) newLength = numeric_limits::max(); RefPtr newData = ArrayBuffer::create(static_cast(newLength), 1); memcpy(static_cast(newData->data()), static_cast(m_rawData->data()), m_bytesLoaded); m_rawData = newData; m_totalBytes = static_cast(newLength); } else length = remainingBufferSpace; } if (length <= 0) return; memcpy(static_cast(m_rawData->data()) + m_bytesLoaded, data, length); m_bytesLoaded += length; m_isRawDataConverted = false; if (m_client) m_client->didReceiveData(); } ",0 "static const char* lua_ap_get_server_name(request_rec* r) { const char *name; name = ap_get_server_name(r); return name ? name : ""localhost""; } ",0 "void ContextualSearchDelegate::StartSearchTermRequestFromSelection( const base::string16& surrounding_text, int start_offset, int end_offset) { if (context_.get()) { SaveSurroundingText(surrounding_text, start_offset, end_offset); SendSurroundingText(kSurroundingSizeForUI); ContinueSearchTermResolutionRequest(); } else { DVLOG(1) << ""ctxs: Null context, ignored!""; } } ",0 "void virtqueue_push(VirtQueue *vq, const VirtQueueElement *elem, unsigned int len) { virtqueue_fill(vq, elem, len, 0); virtqueue_flush(vq, 1); } ",0 "static NTSTATUS smb1cli_conn_dispatch_incoming(struct smbXcli_conn *conn, TALLOC_CTX *tmp_mem, uint8_t *inbuf) { struct tevent_req *req; struct smbXcli_req_state *state; NTSTATUS status; size_t num_pending; size_t i; uint8_t cmd; uint16_t mid; bool oplock_break; uint8_t *inhdr = inbuf + NBT_HDR_SIZE; size_t len = smb_len_tcp(inbuf); struct iovec *iov = NULL; int num_iov = 0; struct tevent_req **chain = NULL; size_t num_chained = 0; size_t num_responses = 0; if (conn->smb1.read_braw_req != NULL) { req = conn->smb1.read_braw_req; conn->smb1.read_braw_req = NULL; state = tevent_req_data(req, struct smbXcli_req_state); smbXcli_req_unset_pending(req); if (state->smb1.recv_iov == NULL) { /* * For requests with more than * one response, we have to readd the * recv_iov array. */ state->smb1.recv_iov = talloc_zero_array(state, struct iovec, 3); if (tevent_req_nomem(state->smb1.recv_iov, req)) { return NT_STATUS_OK; } } state->smb1.recv_iov[0].iov_base = (void *)(inhdr); state->smb1.recv_iov[0].iov_len = len; ZERO_STRUCT(state->smb1.recv_iov[1]); ZERO_STRUCT(state->smb1.recv_iov[2]); state->smb1.recv_cmd = SMBreadBraw; state->smb1.recv_status = NT_STATUS_OK; state->inbuf = talloc_move(state->smb1.recv_iov, &inbuf); tevent_req_done(req); return NT_STATUS_OK; } if ((IVAL(inhdr, 0) != SMB_MAGIC) /* 0xFF""SMB"" */ && (SVAL(inhdr, 0) != 0x45ff)) /* 0xFF""E"" */ { DEBUG(10, (""Got non-SMB PDU\n"")); return NT_STATUS_INVALID_NETWORK_RESPONSE; } /* * If we supported multiple encrytion contexts * here we'd look up based on tid. */ if (common_encryption_on(conn->smb1.trans_enc) && (CVAL(inbuf, 0) == 0)) { uint16_t enc_ctx_num; status = get_enc_ctx_num(inbuf, &enc_ctx_num); if (!NT_STATUS_IS_OK(status)) { DEBUG(10, (""get_enc_ctx_num returned %s\n"", nt_errstr(status))); return status; } if (enc_ctx_num != conn->smb1.trans_enc->enc_ctx_num) { DEBUG(10, (""wrong enc_ctx %d, expected %d\n"", enc_ctx_num, conn->smb1.trans_enc->enc_ctx_num)); return NT_STATUS_INVALID_HANDLE; } status = common_decrypt_buffer(conn->smb1.trans_enc, (char *)inbuf); if (!NT_STATUS_IS_OK(status)) { DEBUG(10, (""common_decrypt_buffer returned %s\n"", nt_errstr(status))); return status; } inhdr = inbuf + NBT_HDR_SIZE; len = smb_len_nbt(inbuf); } mid = SVAL(inhdr, HDR_MID); num_pending = talloc_array_length(conn->pending); for (i=0; ipending[i])) { break; } } if (i == num_pending) { /* Dump unexpected reply */ return NT_STATUS_RETRY; } oplock_break = false; if (mid == 0xffff) { /* * Paranoia checks that this is really an oplock break request. */ oplock_break = (len == 51); /* hdr + 8 words */ oplock_break &= ((CVAL(inhdr, HDR_FLG) & FLAG_REPLY) == 0); oplock_break &= (CVAL(inhdr, HDR_COM) == SMBlockingX); oplock_break &= (SVAL(inhdr, HDR_VWV+VWV(6)) == 0); oplock_break &= (SVAL(inhdr, HDR_VWV+VWV(7)) == 0); if (!oplock_break) { /* Dump unexpected reply */ return NT_STATUS_RETRY; } } req = conn->pending[i]; state = tevent_req_data(req, struct smbXcli_req_state); if (!oplock_break /* oplock breaks are not signed */ && !smb_signing_check_pdu(conn->smb1.signing, inhdr, len, state->smb1.seqnum+1)) { DEBUG(10, (""cli_check_sign_mac failed\n"")); return NT_STATUS_ACCESS_DENIED; } status = smb1cli_inbuf_parse_chain(inbuf, tmp_mem, &iov, &num_iov); if (!NT_STATUS_IS_OK(status)) { DEBUG(10,(""smb1cli_inbuf_parse_chain - %s\n"", nt_errstr(status))); return status; } cmd = CVAL(inhdr, HDR_COM); status = smb1cli_pull_raw_error(inhdr); if (NT_STATUS_EQUAL(status, NT_STATUS_NETWORK_SESSION_EXPIRED) && (state->session != NULL) && state->session->disconnect_expired) { /* * this should be a short term hack * until the upper layers have implemented * re-authentication. */ return status; } if (state->smb1.chained_requests == NULL) { if (num_iov != 3) { return NT_STATUS_INVALID_NETWORK_RESPONSE; } smbXcli_req_unset_pending(req); if (state->smb1.recv_iov == NULL) { /* * For requests with more than * one response, we have to readd the * recv_iov array. */ state->smb1.recv_iov = talloc_zero_array(state, struct iovec, 3); if (tevent_req_nomem(state->smb1.recv_iov, req)) { return NT_STATUS_OK; } } state->smb1.recv_cmd = cmd; state->smb1.recv_status = status; state->inbuf = talloc_move(state->smb1.recv_iov, &inbuf); state->smb1.recv_iov[0] = iov[0]; state->smb1.recv_iov[1] = iov[1]; state->smb1.recv_iov[2] = iov[2]; if (talloc_array_length(conn->pending) == 0) { tevent_req_done(req); return NT_STATUS_OK; } tevent_req_defer_callback(req, state->ev); tevent_req_done(req); return NT_STATUS_RETRY; } chain = talloc_move(tmp_mem, &state->smb1.chained_requests); num_chained = talloc_array_length(chain); num_responses = (num_iov - 1)/2; if (num_responses > num_chained) { return NT_STATUS_INVALID_NETWORK_RESPONSE; } for (i=0; iev); if (i >= num_responses) { tevent_req_nterror(req, NT_STATUS_REQUEST_ABORTED); continue; } if (state->smb1.recv_iov == NULL) { /* * For requests with more than * one response, we have to readd the * recv_iov array. */ state->smb1.recv_iov = talloc_zero_array(state, struct iovec, 3); if (tevent_req_nomem(state->smb1.recv_iov, req)) { continue; } } state->smb1.recv_cmd = cmd; if (i == (num_responses - 1)) { /* * The last request in the chain gets the status */ state->smb1.recv_status = status; } else { cmd = CVAL(cur[0].iov_base, 0); state->smb1.recv_status = NT_STATUS_OK; } state->inbuf = inbuf; /* * Note: here we use talloc_reference() in a way * that does not expose it to the caller. */ inbuf_ref = talloc_reference(state->smb1.recv_iov, inbuf); if (tevent_req_nomem(inbuf_ref, req)) { continue; } /* copy the related buffers */ state->smb1.recv_iov[0] = iov[0]; state->smb1.recv_iov[1] = cur[0]; state->smb1.recv_iov[2] = cur[1]; tevent_req_done(req); } return NT_STATUS_RETRY; } ",0 "static int thread_cpu_clock_get(const clockid_t which_clock, struct timespec *tp) { return posix_cpu_clock_get(THREAD_CLOCK, tp); } ",0 "raptor_rdfxml_characters_handler(void *user_data, raptor_xml_element* xml_element, const unsigned char *s, int len) { raptor_parser* rdf_parser = (raptor_parser*)user_data; raptor_rdfxml_cdata_grammar(rdf_parser, s, len, 0); } ",0 "static void NamedPropertySetter( const AtomicString& name, v8::Local v8_value, const v8::PropertyCallbackInfo& info) { ScriptState* script_state = ScriptState::ForRelevantRealm(info); TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8StringResource<> property_value = v8_value; if (!property_value.Prepare()) return; bool result = impl->AnonymousNamedSetter(script_state, name, property_value); if (!result) return; V8SetReturnValue(info, v8_value); } ",0 "vrrp_notify_master_rx_lower_pri(vector_t *strvec) { vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); if (vrrp->script_master_rx_lower_pri) { report_config_error(CONFIG_GENERAL_ERROR, ""(%s) notify_master_rx_lower_pri script already specified - ignoring %s"", vrrp->iname, FMT_STR_VSLOT(strvec,1)); return; } vrrp->script_master_rx_lower_pri = set_vrrp_notify_script(strvec, 0); vrrp->notify_exec = true; } ",0 "char *FLTGetIsBetweenComparisonExpresssion(FilterEncodingNode *psFilterNode, layerObj *lp) { const size_t bufferSize = 1024; char szBuffer[1024]; char **aszBounds = NULL; int nBounds = 0; int bString=0; char szTmp[256]; szBuffer[0] = '\0'; if (!psFilterNode || !(strcasecmp(psFilterNode->pszValue, ""PropertyIsBetween"") == 0)) return NULL; if (!psFilterNode->psLeftNode || !psFilterNode->psRightNode ) return NULL; /* -------------------------------------------------------------------- */ /* Get the bounds value which are stored like boundmin;boundmax */ /* -------------------------------------------------------------------- */ aszBounds = msStringSplit(psFilterNode->psRightNode->pszValue, ';', &nBounds); if (nBounds != 2) { msFreeCharArray(aszBounds, nBounds); return NULL; } /* -------------------------------------------------------------------- */ /* check if the value is a numeric value or alphanumeric. If it */ /* is alphanumeric, add quotes around attribute and values. */ /* -------------------------------------------------------------------- */ bString = 0; if (aszBounds[0]) { const char* pszOFGType; snprintf(szTmp, sizeof(szTmp), ""%s_type"", psFilterNode->psLeftNode->pszValue); pszOFGType = msOWSLookupMetadata(&(lp->metadata), ""OFG"", szTmp); if (pszOFGType!= NULL && strcasecmp(pszOFGType, ""Character"") == 0) bString = 1; else if (FLTIsNumeric(aszBounds[0]) == MS_FALSE) bString = 1; } if (!bString) { if (aszBounds[1]) { if (FLTIsNumeric(aszBounds[1]) == MS_FALSE) bString = 1; } } /* -------------------------------------------------------------------- */ /* build expresssion. */ /* -------------------------------------------------------------------- */ if (bString) strlcat(szBuffer, "" (\""["", bufferSize); else strlcat(szBuffer, "" (["", bufferSize); /* attribute */ strlcat(szBuffer, psFilterNode->psLeftNode->pszValue, bufferSize); if (bString) strlcat(szBuffer, ""]\"" "", bufferSize); else strlcat(szBuffer, ""] "", bufferSize); strlcat(szBuffer, "" >= "", bufferSize); if (bString) strlcat(szBuffer,""\"""", bufferSize); strlcat(szBuffer, aszBounds[0], bufferSize); if (bString) strlcat(szBuffer,""\"""", bufferSize); strlcat(szBuffer, "" AND "", bufferSize); if (bString) strlcat(szBuffer, "" \""["", bufferSize); else strlcat(szBuffer, "" ["", bufferSize); /* attribute */ strlcat(szBuffer, psFilterNode->psLeftNode->pszValue, bufferSize); if (bString) strlcat(szBuffer, ""]\"" "", bufferSize); else strlcat(szBuffer, ""] "", bufferSize); strlcat(szBuffer, "" <= "", bufferSize); if (bString) strlcat(szBuffer,""\"""", bufferSize); strlcat(szBuffer, aszBounds[1], bufferSize); if (bString) strlcat(szBuffer,""\"""", bufferSize); strlcat(szBuffer, "")"", bufferSize); msFreeCharArray(aszBounds, nBounds); return msStrdup(szBuffer); } ",0 "void TestRenderWidgetHostView::StopSpeaking() {} ",0 "BackingStore* RenderWidgetHostViewAndroid::AllocBackingStore( const gfx::Size& size) { NOTIMPLEMENTED(); return NULL; } ",0 "struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr) { struct kvm_io_bus *bus; int dev_idx, srcu_idx; struct kvm_io_device *iodev = NULL; srcu_idx = srcu_read_lock(&kvm->srcu); bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu); if (!bus) goto out_unlock; dev_idx = kvm_io_bus_get_first_dev(bus, addr, 1); if (dev_idx < 0) goto out_unlock; iodev = bus->range[dev_idx].dev; out_unlock: srcu_read_unlock(&kvm->srcu, srcu_idx); return iodev; } ",0 "void WebContentsImpl::GetRenderViewHostAtPosition( int x, int y, const base::Callback& callback) { BrowserPluginEmbedder* embedder = GetBrowserPluginEmbedder(); if (embedder) embedder->GetRenderViewHostAtPosition(x, y, callback); else callback.Run(GetRenderViewHost(), x, y); } ",0 "void ExtensionService::GrantPermissions(const Extension* extension) { CHECK(extension); CHECK_EQ(Extension::INTERNAL, extension->location()); URLPatternSet effective_hosts = extension->GetEffectiveHostPermissions(); extension_prefs_->AddGrantedPermissions(extension->id(), extension->HasFullPermissions(), extension->api_permissions(), effective_hosts); } ",0 "static void inetpeer_free_rcu(struct rcu_head *head) { kmem_cache_free(peer_cachep, container_of(head, struct inet_peer, rcu)); } ",0 "static int fpm_unix_conf_wp(struct fpm_worker_pool_s *wp) /* {{{ */ { struct passwd *pwd; int is_root = !geteuid(); if (is_root) { if (wp->config->user && *wp->config->user) { if (strlen(wp->config->user) == strspn(wp->config->user, ""0123456789"")) { wp->set_uid = strtoul(wp->config->user, 0, 10); } else { struct passwd *pwd; pwd = getpwnam(wp->config->user); if (!pwd) { zlog(ZLOG_ERROR, ""[pool %s] cannot get uid for user '%s'"", wp->config->name, wp->config->user); return -1; } wp->set_uid = pwd->pw_uid; wp->set_gid = pwd->pw_gid; wp->user = strdup(pwd->pw_name); wp->home = strdup(pwd->pw_dir); } } if (wp->config->group && *wp->config->group) { if (strlen(wp->config->group) == strspn(wp->config->group, ""0123456789"")) { wp->set_gid = strtoul(wp->config->group, 0, 10); } else { struct group *grp; grp = getgrnam(wp->config->group); if (!grp) { zlog(ZLOG_ERROR, ""[pool %s] cannot get gid for group '%s'"", wp->config->name, wp->config->group); return -1; } wp->set_gid = grp->gr_gid; } } if (!fpm_globals.run_as_root) { if (wp->set_uid == 0 || wp->set_gid == 0) { zlog(ZLOG_ERROR, ""[pool %s] please specify user and group other than root"", wp->config->name); return -1; } } } else { /* not root */ if (wp->config->user && *wp->config->user) { zlog(ZLOG_NOTICE, ""[pool %s] 'user' directive is ignored when FPM is not running as root"", wp->config->name); } if (wp->config->group && *wp->config->group) { zlog(ZLOG_NOTICE, ""[pool %s] 'group' directive is ignored when FPM is not running as root"", wp->config->name); } if (wp->config->chroot && *wp->config->chroot) { zlog(ZLOG_NOTICE, ""[pool %s] 'chroot' directive is ignored when FPM is not running as root"", wp->config->name); } if (wp->config->process_priority != 64) { zlog(ZLOG_NOTICE, ""[pool %s] 'process.priority' directive is ignored when FPM is not running as root"", wp->config->name); } /* set up HOME and USER anyway */ pwd = getpwuid(getuid()); if (pwd) { wp->user = strdup(pwd->pw_name); wp->home = strdup(pwd->pw_dir); } } return 0; } /* }}} */ ",0 "bool RenderFrameImpl::OnMessageReceived(const IPC::Message& msg) { if ((IPC_MESSAGE_CLASS(msg) == PageMsgStart)) { if (render_view()) return render_view()->OnMessageReceived(msg); return false; } if (!frame_) return false; DCHECK(!frame_->GetDocument().IsNull()); GetContentClient()->SetActiveURL( frame_->GetDocument().Url(), frame_->Top()->GetSecurityOrigin().ToString().Utf8()); { SCOPED_UMA_HISTOGRAM_TIMER(""RenderFrameObservers.OnMessageReceived""); for (auto& observer : observers_) { if (observer.OnMessageReceived(msg)) return true; } } bool handled = true; IPC_BEGIN_MESSAGE_MAP(RenderFrameImpl, msg) IPC_MESSAGE_HANDLER(FrameMsg_BeforeUnload, OnBeforeUnload) IPC_MESSAGE_HANDLER(FrameMsg_SwapOut, OnSwapOut) IPC_MESSAGE_HANDLER(FrameMsg_SwapIn, OnSwapIn) IPC_MESSAGE_HANDLER(FrameMsg_Delete, OnDeleteFrame) IPC_MESSAGE_HANDLER(FrameMsg_Stop, OnStop) IPC_MESSAGE_HANDLER(FrameMsg_DroppedNavigation, OnDroppedNavigation) IPC_MESSAGE_HANDLER(FrameMsg_Collapse, OnCollapse) IPC_MESSAGE_HANDLER(FrameMsg_ContextMenuClosed, OnContextMenuClosed) IPC_MESSAGE_HANDLER(FrameMsg_CustomContextMenuAction, OnCustomContextMenuAction) #if BUILDFLAG(ENABLE_PLUGINS) IPC_MESSAGE_HANDLER(FrameMsg_SetPepperVolume, OnSetPepperVolume) #endif IPC_MESSAGE_HANDLER(InputMsg_Undo, OnUndo) IPC_MESSAGE_HANDLER(InputMsg_Redo, OnRedo) IPC_MESSAGE_HANDLER(InputMsg_Cut, OnCut) IPC_MESSAGE_HANDLER(InputMsg_Copy, OnCopy) IPC_MESSAGE_HANDLER(InputMsg_Paste, OnPaste) IPC_MESSAGE_HANDLER(InputMsg_PasteAndMatchStyle, OnPasteAndMatchStyle) IPC_MESSAGE_HANDLER(InputMsg_Delete, OnDelete) IPC_MESSAGE_HANDLER(InputMsg_SelectAll, OnSelectAll) IPC_MESSAGE_HANDLER(InputMsg_SelectRange, OnSelectRange) IPC_MESSAGE_HANDLER(InputMsg_AdjustSelectionByCharacterOffset, OnAdjustSelectionByCharacterOffset) IPC_MESSAGE_HANDLER(InputMsg_CollapseSelection, OnCollapseSelection) IPC_MESSAGE_HANDLER(InputMsg_MoveRangeSelectionExtent, OnMoveRangeSelectionExtent) IPC_MESSAGE_HANDLER(InputMsg_Replace, OnReplace) IPC_MESSAGE_HANDLER(InputMsg_ReplaceMisspelling, OnReplaceMisspelling) IPC_MESSAGE_HANDLER(InputMsg_MoveCaret, OnMoveCaret) IPC_MESSAGE_HANDLER(InputMsg_ScrollFocusedEditableNodeIntoRect, OnScrollFocusedEditableNodeIntoRect) IPC_MESSAGE_HANDLER(FrameMsg_CopyImageAt, OnCopyImageAt) IPC_MESSAGE_HANDLER(FrameMsg_SaveImageAt, OnSaveImageAt) IPC_MESSAGE_HANDLER(InputMsg_ExtendSelectionAndDelete, OnExtendSelectionAndDelete) IPC_MESSAGE_HANDLER(InputMsg_DeleteSurroundingText, OnDeleteSurroundingText) IPC_MESSAGE_HANDLER(InputMsg_DeleteSurroundingTextInCodePoints, OnDeleteSurroundingTextInCodePoints) IPC_MESSAGE_HANDLER(InputMsg_SetCompositionFromExistingText, OnSetCompositionFromExistingText) IPC_MESSAGE_HANDLER(InputMsg_SetEditableSelectionOffsets, OnSetEditableSelectionOffsets) IPC_MESSAGE_HANDLER(InputMsg_ExecuteNoValueEditCommand, OnExecuteNoValueEditCommand) IPC_MESSAGE_HANDLER(FrameMsg_AddMessageToConsole, OnAddMessageToConsole) IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequest, OnJavaScriptExecuteRequest) IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestForTests, OnJavaScriptExecuteRequestForTests) IPC_MESSAGE_HANDLER(FrameMsg_JavaScriptExecuteRequestInIsolatedWorld, OnJavaScriptExecuteRequestInIsolatedWorld) IPC_MESSAGE_HANDLER(FrameMsg_VisualStateRequest, OnVisualStateRequest) IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) IPC_MESSAGE_HANDLER(FrameMsg_ReloadLoFiImages, OnReloadLoFiImages) IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, OnTextSurroundingSelectionRequest) IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, OnSetAccessibilityMode) IPC_MESSAGE_HANDLER(AccessibilityMsg_SnapshotTree, OnSnapshotAccessibilityTree) IPC_MESSAGE_HANDLER(FrameMsg_UpdateOpener, OnUpdateOpener) IPC_MESSAGE_HANDLER(FrameMsg_DidUpdateFramePolicy, OnDidUpdateFramePolicy) IPC_MESSAGE_HANDLER(FrameMsg_SetFrameOwnerProperties, OnSetFrameOwnerProperties) IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocus, OnAdvanceFocus) IPC_MESSAGE_HANDLER(FrameMsg_AdvanceFocusInForm, OnAdvanceFocusInForm) IPC_MESSAGE_HANDLER(FrameMsg_SetFocusedFrame, OnSetFocusedFrame) IPC_MESSAGE_HANDLER(FrameMsg_SetTextTrackSettings, OnTextTrackSettingsChanged) IPC_MESSAGE_HANDLER(FrameMsg_PostMessageEvent, OnPostMessageEvent) IPC_MESSAGE_HANDLER(FrameMsg_ReportContentSecurityPolicyViolation, OnReportContentSecurityPolicyViolation) IPC_MESSAGE_HANDLER(FrameMsg_GetSavableResourceLinks, OnGetSavableResourceLinks) IPC_MESSAGE_HANDLER(FrameMsg_GetSerializedHtmlWithLocalLinks, OnGetSerializedHtmlWithLocalLinks) IPC_MESSAGE_HANDLER(FrameMsg_SerializeAsMHTML, OnSerializeAsMHTML) IPC_MESSAGE_HANDLER(FrameMsg_Find, OnFind) IPC_MESSAGE_HANDLER(FrameMsg_ClearActiveFindMatch, OnClearActiveFindMatch) IPC_MESSAGE_HANDLER(FrameMsg_StopFinding, OnStopFinding) IPC_MESSAGE_HANDLER(FrameMsg_EnableViewSourceMode, OnEnableViewSourceMode) IPC_MESSAGE_HANDLER(FrameMsg_SuppressFurtherDialogs, OnSuppressFurtherDialogs) IPC_MESSAGE_HANDLER(FrameMsg_RunFileChooserResponse, OnFileChooserResponse) IPC_MESSAGE_HANDLER(FrameMsg_ClearFocusedElement, OnClearFocusedElement) IPC_MESSAGE_HANDLER(FrameMsg_BlinkFeatureUsageReport, OnBlinkFeatureUsageReport) IPC_MESSAGE_HANDLER(FrameMsg_MixedContentFound, OnMixedContentFound) IPC_MESSAGE_HANDLER(FrameMsg_SetOverlayRoutingToken, OnSetOverlayRoutingToken) IPC_MESSAGE_HANDLER(FrameMsg_SetHasReceivedUserGesture, OnSetHasReceivedUserGesture) #if defined(OS_ANDROID) IPC_MESSAGE_HANDLER(FrameMsg_ActivateNearestFindResult, OnActivateNearestFindResult) IPC_MESSAGE_HANDLER(FrameMsg_GetNearestFindResult, OnGetNearestFindResult) IPC_MESSAGE_HANDLER(FrameMsg_FindMatchRects, OnFindMatchRects) #endif #if BUILDFLAG(USE_EXTERNAL_POPUP_MENU) #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) #else IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) #endif #endif #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) #endif IPC_END_MESSAGE_MAP() return handled; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoGetProgramInfoLog( GLuint program, std::string* infolog) { CheckErrorCallbackState(); GLint info_log_len = 0; api()->glGetProgramivFn(GetProgramServiceID(program, resources_), GL_INFO_LOG_LENGTH, &info_log_len); if (CheckErrorCallbackState()) { return error::kNoError; } std::vector buffer(info_log_len, 0); GLsizei length = 0; api()->glGetProgramInfoLogFn(GetProgramServiceID(program, resources_), info_log_len, &length, buffer.data()); DCHECK(length <= info_log_len); *infolog = length > 0 ? std::string(buffer.data(), length) : std::string(); return error::kNoError; } ",0 " const std::string& extension_id() { return extension_id_; } ",0 "QList Smb4KGlobal::sharedResources( Smb4KHost *host ) { QList shares; mutex.lock(); for ( int i = 0; i < p->sharesList.size(); ++i ) { if ( QString::compare( p->sharesList.at( i )->hostName(), host->hostName(), Qt::CaseInsensitive ) == 0 && QString::compare( p->sharesList.at( i )->workgroupName(), host->workgroupName(), Qt::CaseInsensitive ) == 0 ) { shares += p->sharesList.at( i ); continue; } else { continue; } } mutex.unlock(); return shares; } ",0 "void GraphicsContext::clearPlatformShadow() { if (paintingDisabled()) return; platformContext()->setDrawLooper(0); } ",0 "void kvm_arch_check_processor_compat(void *rtn) { *(int *)rtn = 0; } ",0 "static void __unix_insert_socket(struct hlist_head *list, struct sock *sk) { WARN_ON(!sk_unhashed(sk)); sk_add_node(sk, list); } ",0 "void WebContentsImpl::SetNotWaitingForResponse() { if (waiting_for_response_ == false) return; waiting_for_response_ = false; if (delegate_) delegate_->LoadingStateChanged(this, is_load_to_different_document_); } ",0 "void RegistrationManager::MarkAllRegistrationsLost() { DCHECK(CalledOnValidThread()); for (RegistrationStatusMap::const_iterator it = registration_statuses_.begin(); it != registration_statuses_.end(); ++it) { if (IsIdRegistered(it->first)) { MarkRegistrationLost(it->first); } } } ",0 "static void overloadedMethodD1Method(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""overloadedMethodD"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), exceptionState); imp->overloadedMethodD(longArg); } ",0 "static int sig_cb(int operation, ASN1_VALUE **pval, const ASN1_ITEM *it, void *exarg) { if(operation == ASN1_OP_NEW_PRE) { DSA_SIG *sig; sig = OPENSSL_malloc(sizeof(DSA_SIG)); if (!sig) { DSAerr(DSA_F_SIG_CB, ERR_R_MALLOC_FAILURE); return 0; } sig->r = NULL; sig->s = NULL; *pval = (ASN1_VALUE *)sig; return 2; } return 1; } ",0 "void FrameLoaderClient::registerForIconNotification(bool) { notImplemented(); } ",0 "void BrowserRenderProcessHost::OnProcessLaunched() { if (deleting_soon_) return; if (child_process_launcher_.get()) child_process_launcher_->SetProcessBackgrounded(backgrounded_); if (max_page_id_ != -1) Send(new ViewMsg_SetNextPageID(max_page_id_ + 1)); NotificationService::current()->Notify( content::NOTIFICATION_RENDERER_PROCESS_CREATED, Source(this), NotificationService::NoDetails()); while (!queued_messages_.empty()) { Send(queued_messages_.front()); queued_messages_.pop(); } } ",0 "SProcXIChangeHierarchy(ClientPtr client) { REQUEST(xXIChangeHierarchyReq); swaps(&stuff->length); return (ProcXIChangeHierarchy(client)); } ",0 "LoadCredentialList () { CredentialWrapper * pCred; if (!credentials.IsEmpty()) { credentials.Rewind(); while (credentials.Next(pCred)) { credentials.DeleteCurrent(); delete pCred; } } credentials.Rewind(); classad::ClassAdXMLParser parser; char buff[50000]; priv_state priv = set_root_priv(); FILE * fp = safe_fopen_wrapper(cred_index_file, ""r""); if (!fp) { dprintf (D_FULLDEBUG, ""Credential database %s does not exist!\n"", cred_index_file); set_priv (priv); return TRUE; } while (fgets(buff, 50000, fp)) { if ((buff[0] == '\n') || (buff[0] == '\r')) { continue; } classad::ClassAd * classad = parser.ParseClassAd (buff); int type=0; if ((!classad) || (!classad->EvaluateAttrInt (""Type"", type))) { dprintf (D_ALWAYS, ""Invalid classad %s\n"", buff); set_priv (priv); fclose (fp); return FALSE; } if (type == X509_CREDENTIAL_TYPE) { pCred = new X509CredentialWrapper (*classad); credentials.Append (pCred); } else { dprintf (D_ALWAYS, ""Invalid type %d\n"",type); } } fclose (fp); set_priv (priv); return TRUE; } ",0 "static int decode_secinfo_gss(struct xdr_stream *xdr, struct nfs4_secinfo_flavor *flavor) { __be32 *p; p = xdr_inline_decode(xdr, 4); if (unlikely(!p)) goto out_overflow; flavor->gss.sec_oid4.len = be32_to_cpup(p); if (flavor->gss.sec_oid4.len > GSS_OID_MAX_LEN) goto out_err; p = xdr_inline_decode(xdr, flavor->gss.sec_oid4.len); if (unlikely(!p)) goto out_overflow; memcpy(flavor->gss.sec_oid4.data, p, flavor->gss.sec_oid4.len); p = xdr_inline_decode(xdr, 8); if (unlikely(!p)) goto out_overflow; flavor->gss.qop4 = be32_to_cpup(p++); flavor->gss.service = be32_to_cpup(p); return 0; out_overflow: print_overflow_msg(__func__, xdr); return -EIO; out_err: return -EINVAL; } ",0 "void __fsnotify_inode_delete(struct inode *inode) { fsnotify_clear_marks_by_inode(inode); } ",0 "static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) { struct inode *inode = dentry->d_inode; int error = -EACCES; /* We don't need a base pointer in the /proc filesystem */ path_put(&nd->path); /* Are we allowed to snoop on the tasks file descriptors? */ if (!proc_fd_access_allowed(inode)) goto out; error = PROC_I(inode)->op.proc_get_link(inode, &nd->path); nd->last_type = LAST_BIND; out: return ERR_PTR(error); } ",1 "u64 notrace _paravirt_ident_64(u64 x) { return x; } ",0 "static void generate_hash(const char *in, const char *challenge, char *out) { char buf[MAX_DIGEST_LEN]; int len; sum_init(0); sum_update(in, strlen(in)); sum_update(challenge, strlen(challenge)); len = sum_end(buf); base64_encode(buf, len, out, 0); } ",0 "extract(FILE *fp, png_uint_32 *proflen) { png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING,0,0,0); png_infop info_ptr = NULL; png_bytep result = NULL; /* Initialize for error or no profile: */ *proflen = 0; if (png_ptr == NULL) { fprintf(stderr, ""iccfrompng: version library mismatch?\n""); return 0; } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, NULL); return 0; } png_init_io(png_ptr, fp); info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) png_error(png_ptr, ""OOM allocating info structure""); png_read_info(png_ptr, info_ptr); { png_charp name; int compression_type; png_bytep profile; if (png_get_iCCP(png_ptr, info_ptr, &name, &compression_type, &profile, proflen) & PNG_INFO_iCCP) { result = malloc(*proflen); if (result != NULL) memcpy(result, profile, *proflen); else png_error(png_ptr, ""OOM allocating profile buffer""); } else result = no_profile; } png_destroy_read_struct(&png_ptr, &info_ptr, NULL); return result; } ",0 "bool ExtensionBrowserTest::ExecuteScriptInBackgroundPageNoWait( const std::string& extension_id, const std::string& script) { return extensions::browsertest_util::ExecuteScriptInBackgroundPageNoWait( profile(), extension_id, script); } ",0 "static int snd_pcm_hw_rule_list(struct snd_pcm_hw_params *params, struct snd_pcm_hw_rule *rule) { struct snd_pcm_hw_constraint_list *list = rule->private; return snd_interval_list(hw_param_interval(params, rule->var), list->count, list->list, list->mask); } ",0 "static v8::Persistent ConfigureV8TestNamedConstructorTemplate(v8::Persistent desc) { desc->ReadOnlyPrototype(); v8::Local defaultSignature; defaultSignature = configureTemplate(desc, ""TestNamedConstructor"", v8::Persistent(), V8TestNamedConstructor::internalFieldCount, 0, 0, 0, 0); UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. desc->Set(getToStringName(), getToStringTemplate()); return desc; } ",0 "cifs_parse_smb_version(char *value, struct smb_vol *vol) { substring_t args[MAX_OPT_ARGS]; switch (match_token(value, cifs_smb_version_tokens, args)) { case Smb_1: vol->ops = &smb1_operations; vol->vals = &smb1_values; break; #ifdef CONFIG_CIFS_SMB2 case Smb_20: vol->ops = &smb21_operations; /* currently identical with 2.1 */ vol->vals = &smb20_values; break; case Smb_21: vol->ops = &smb21_operations; vol->vals = &smb21_values; break; case Smb_30: vol->ops = &smb30_operations; vol->vals = &smb30_values; break; #endif default: cifs_dbg(VFS, ""Unknown vers= option specified: %s\n"", value); return 1; } return 0; } ",0 "SECURITY_STATUS SEC_ENTRY DecryptMessage(PCtxtHandle phContext, PSecBufferDesc pMessage, ULONG MessageSeqNo, PULONG pfQOP) { char* Name; SECURITY_STATUS status; SecurityFunctionTableA* table; Name = (char*) sspi_SecureHandleGetUpperPointer(phContext); if (!Name) return SEC_E_SECPKG_NOT_FOUND; table = sspi_GetSecurityFunctionTableAByNameA(Name); if (!table) return SEC_E_SECPKG_NOT_FOUND; if (table->DecryptMessage == NULL) return SEC_E_UNSUPPORTED_FUNCTION; status = table->DecryptMessage(phContext, pMessage, MessageSeqNo, pfQOP); return status; } ",0 "static int rds_conn_info_visitor(struct rds_connection *conn, void *buffer) { struct rds_info_connection *cinfo = buffer; cinfo->next_tx_seq = conn->c_next_tx_seq; cinfo->next_rx_seq = conn->c_next_rx_seq; cinfo->laddr = conn->c_laddr; cinfo->faddr = conn->c_faddr; strncpy(cinfo->transport, conn->c_trans->t_name, sizeof(cinfo->transport)); cinfo->flags = 0; rds_conn_info_set(cinfo->flags, test_bit(RDS_IN_XMIT, &conn->c_flags), SENDING); /* XXX Future: return the state rather than these funky bits */ rds_conn_info_set(cinfo->flags, atomic_read(&conn->c_state) == RDS_CONN_CONNECTING, CONNECTING); rds_conn_info_set(cinfo->flags, atomic_read(&conn->c_state) == RDS_CONN_UP, CONNECTED); return 1; } ",0 "static void overloadedMethodFMethod(const v8::FunctionCallbackInfo& info) { if (((info.Length() == 1))) { overloadedMethodF1Method(info); return; } if (((info.Length() == 1) && (info[0]->IsNull() || V8TestInterfaceEmpty::hasInstance(info[0], info.GetIsolate())))) { overloadedMethodF2Method(info); return; } ExceptionState exceptionState(ExceptionState::ExecutionContext, ""overloadedMethodF"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } exceptionState.throwTypeError(""No function was found that matched the signature provided.""); exceptionState.throwIfNeeded(); } ",0 "void V8InjectedScriptHost::bindCallback(const v8::FunctionCallbackInfo& info) { if (info.Length() < 2 || !info[1]->IsString()) return; InjectedScriptNative* injectedScriptNative = InjectedScriptNative::fromInjectedScriptHost(info.Holder()); if (!injectedScriptNative) return; v8::Local v8groupName = info[1]->ToString(info.GetIsolate()); String16 groupName = toProtocolStringWithTypeCheck(v8groupName); int id = injectedScriptNative->bind(info[0], groupName); info.GetReturnValue().Set(id); } ",0 "s_aes_set_key(stream_aes_state * state, const unsigned char *key, int keylength) { int code = 0; if ( (keylength < 1) || (keylength > SAES_MAX_KEYLENGTH) ) return_error(gs_error_rangecheck); if (key == NULL) return_error(gs_error_invalidaccess); /* we can't set the key here because the interpreter's filter implementation wants to duplicate our state after the zfaes.c binding calls us. So stash it now and handle it in our process method. */ memcpy(state->key, key, keylength); state->keylength = keylength; if (code) { return gs_throw(gs_error_rangecheck, ""could not set AES key""); } /* return successfully */ return 0; } ",0 "bool ewk_frame_uri_changed(Evas_Object* ewkFrame) { EWK_FRAME_SD_GET_OR_RETURN(ewkFrame, smartData, false); EINA_SAFETY_ON_NULL_RETURN_VAL(smartData->frame, false); WTF::CString uri(smartData->frame->document()->url().string().utf8()); INF(""uri=%s"", uri.data()); if (!uri.data()) { ERR(""no uri""); return false; } eina_stringshare_replace(&smartData->uri, uri.data()); evas_object_smart_callback_call(ewkFrame, ""uri,changed"", (void*)smartData->uri); return true; } ",0 "void WebGraphicsContext3DDefaultImpl::getFramebufferAttachmentParameteriv(unsigned long target, unsigned long attachment, unsigned long pname, int* value) { makeContextCurrent(); if (attachment == GL_DEPTH_STENCIL_ATTACHMENT) attachment = GL_DEPTH_ATTACHMENT; // Or GL_STENCIL_ATTACHMENT, either works. glGetFramebufferAttachmentParameterivEXT(target, attachment, pname, value); } ",0 "static void initimage(Image *image, png_uint_32 opts, const char *file_name, int stride_extra) { freeimage(image); memset(&image->image, 0, sizeof image->image); image->opts = opts; image->file_name = file_name; image->stride_extra = stride_extra; } ",0 "static int hfsplus_rename(struct inode *old_dir, struct dentry *old_dentry, struct inode *new_dir, struct dentry *new_dentry) { int res; /* Unlink destination if it already exists */ if (new_dentry->d_inode) { if (S_ISDIR(new_dentry->d_inode->i_mode)) res = hfsplus_rmdir(new_dir, new_dentry); else res = hfsplus_unlink(new_dir, new_dentry); if (res) return res; } res = hfsplus_rename_cat((u32)(unsigned long)old_dentry->d_fsdata, old_dir, &old_dentry->d_name, new_dir, &new_dentry->d_name); if (!res) new_dentry->d_fsdata = old_dentry->d_fsdata; return res; } ",0 "void RenderFrameImpl::willSendRequest( blink::WebLocalFrame* frame, unsigned identifier, blink::WebURLRequest& request, const blink::WebURLResponse& redirect_response) { DCHECK(!frame_ || frame_ == frame); if (request.url().isEmpty()) return; WebFrame* top_frame = frame->top(); if (!top_frame) top_frame = frame; WebDataSource* provisional_data_source = top_frame->provisionalDataSource(); WebDataSource* top_data_source = top_frame->dataSource(); WebDataSource* data_source = provisional_data_source ? provisional_data_source : top_data_source; PageTransition transition_type = PAGE_TRANSITION_LINK; DocumentState* document_state = DocumentState::FromDataSource(data_source); DCHECK(document_state); InternalDocumentStateData* internal_data = InternalDocumentStateData::FromDocumentState(document_state); NavigationState* navigation_state = document_state->navigation_state(); transition_type = navigation_state->transition_type(); GURL request_url(request.url()); GURL new_url; if (GetContentClient()->renderer()->WillSendRequest( frame, transition_type, request_url, request.firstPartyForCookies(), &new_url)) { request.setURL(WebURL(new_url)); } if (internal_data->is_cache_policy_override_set()) request.setCachePolicy(internal_data->cache_policy_override()); WebString custom_user_agent; bool was_after_preconnect_request = false; if (request.extraData()) { RequestExtraData* old_extra_data = static_cast( request.extraData()); custom_user_agent = old_extra_data->custom_user_agent(); was_after_preconnect_request = old_extra_data->was_after_preconnect_request(); if (!custom_user_agent.isNull()) { if (custom_user_agent.isEmpty()) request.clearHTTPHeaderField(""User-Agent""); else request.setHTTPHeaderField(""User-Agent"", custom_user_agent); } } bool should_replace_current_entry = false; if (navigation_state->is_content_initiated()) { should_replace_current_entry = data_source->replacesCurrentHistoryItem(); } else { should_replace_current_entry = navigation_state->should_replace_current_entry(); } int provider_id = kInvalidServiceWorkerProviderId; if (request.targetType() == blink::WebURLRequest::TargetIsMainFrame || request.targetType() == blink::WebURLRequest::TargetIsSubframe) { if (frame->provisionalDataSource()) { ServiceWorkerNetworkProvider* provider = ServiceWorkerNetworkProvider::FromDocumentState( DocumentState::FromDataSource(frame->provisionalDataSource())); provider_id = provider->provider_id(); } } else if (frame->dataSource()) { ServiceWorkerNetworkProvider* provider = ServiceWorkerNetworkProvider::FromDocumentState( DocumentState::FromDataSource(frame->dataSource())); provider_id = provider->provider_id(); } int parent_routing_id = frame->parent() ? FromWebFrame(frame->parent())->GetRoutingID() : -1; RequestExtraData* extra_data = new RequestExtraData(); extra_data->set_visibility_state(render_view_->visibilityState()); extra_data->set_custom_user_agent(custom_user_agent); extra_data->set_was_after_preconnect_request(was_after_preconnect_request); extra_data->set_render_frame_id(routing_id_); extra_data->set_is_main_frame(frame == top_frame); extra_data->set_frame_origin( GURL(frame->document().securityOrigin().toString())); extra_data->set_parent_is_main_frame(frame->parent() == top_frame); extra_data->set_parent_render_frame_id(parent_routing_id); extra_data->set_allow_download(navigation_state->allow_download()); extra_data->set_transition_type(transition_type); extra_data->set_should_replace_current_entry(should_replace_current_entry); extra_data->set_transferred_request_child_id( navigation_state->transferred_request_child_id()); extra_data->set_transferred_request_request_id( navigation_state->transferred_request_request_id()); extra_data->set_service_worker_provider_id(provider_id); request.setExtraData(extra_data); DocumentState* top_document_state = DocumentState::FromDataSource(top_data_source); if (top_document_state) { if (request.targetType() == WebURLRequest::TargetIsPrefetch) top_document_state->set_was_prefetcher(true); if (was_after_preconnect_request) top_document_state->set_was_after_preconnect_request(true); } request.setRequestorID(render_view_->GetRoutingID()); request.setHasUserGesture(WebUserGestureIndicator::isProcessingUserGesture()); if (!navigation_state->extra_headers().empty()) { for (net::HttpUtil::HeadersIterator i( navigation_state->extra_headers().begin(), navigation_state->extra_headers().end(), ""\n""); i.GetNext(); ) { if (LowerCaseEqualsASCII(i.name(), ""referer"")) { WebString referrer = WebSecurityPolicy::generateReferrerHeader( blink::WebReferrerPolicyDefault, request.url(), WebString::fromUTF8(i.values())); request.setHTTPReferrer(referrer, blink::WebReferrerPolicyDefault); } else { request.setHTTPHeaderField(WebString::fromUTF8(i.name()), WebString::fromUTF8(i.values())); } } } if (!render_view_->renderer_preferences_.enable_referrers) request.setHTTPReferrer(WebString(), blink::WebReferrerPolicyDefault); } ",0 "FileDescriptorSet::FileDescriptorSet() : consumed_descriptor_highwater_(0) { } ",0 "static void btrfs_merge_extent_hook(struct inode *inode, struct extent_state *new, struct extent_state *other) { u64 new_size, old_size; u64 num_extents; /* not delalloc, ignore it */ if (!(other->state & EXTENT_DELALLOC)) return; if (new->start > other->start) new_size = new->end - other->start + 1; else new_size = other->end - new->start + 1; /* we're not bigger than the max, unreserve the space and go */ if (new_size <= BTRFS_MAX_EXTENT_SIZE) { spin_lock(&BTRFS_I(inode)->lock); BTRFS_I(inode)->outstanding_extents--; spin_unlock(&BTRFS_I(inode)->lock); return; } /* * We have to add up either side to figure out how many extents were * accounted for before we merged into one big extent. If the number of * extents we accounted for is <= the amount we need for the new range * then we can return, otherwise drop. Think of it like this * * [ 4k][MAX_SIZE] * * So we've grown the extent by a MAX_SIZE extent, this would mean we * need 2 outstanding extents, on one side we have 1 and the other side * we have 1 so they are == and we can return. But in this case * * [MAX_SIZE+4k][MAX_SIZE+4k] * * Each range on their own accounts for 2 extents, but merged together * they are only 3 extents worth of accounting, so we need to drop in * this case. */ old_size = other->end - other->start + 1; num_extents = div64_u64(old_size + BTRFS_MAX_EXTENT_SIZE - 1, BTRFS_MAX_EXTENT_SIZE); old_size = new->end - new->start + 1; num_extents += div64_u64(old_size + BTRFS_MAX_EXTENT_SIZE - 1, BTRFS_MAX_EXTENT_SIZE); if (div64_u64(new_size + BTRFS_MAX_EXTENT_SIZE - 1, BTRFS_MAX_EXTENT_SIZE) >= num_extents) return; spin_lock(&BTRFS_I(inode)->lock); BTRFS_I(inode)->outstanding_extents--; spin_unlock(&BTRFS_I(inode)->lock); } ",0 "match_security(struct TCP_Server_Info *server, struct smb_vol *vol) { unsigned int secFlags; if (vol->secFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL))) secFlags = vol->secFlg; else secFlags = global_secflags | vol->secFlg; switch (server->secType) { case LANMAN: if (!(secFlags & (CIFSSEC_MAY_LANMAN|CIFSSEC_MAY_PLNTXT))) return false; break; case NTLMv2: if (!(secFlags & CIFSSEC_MAY_NTLMV2)) return false; break; case NTLM: if (!(secFlags & CIFSSEC_MAY_NTLM)) return false; break; case Kerberos: if (!(secFlags & CIFSSEC_MAY_KRB5)) return false; break; case RawNTLMSSP: if (!(secFlags & CIFSSEC_MAY_NTLMSSP)) return false; break; default: /* shouldn't happen */ return false; } /* now check if signing mode is acceptable */ if ((secFlags & CIFSSEC_MAY_SIGN) == 0 && (server->sec_mode & SECMODE_SIGN_REQUIRED)) return false; else if (((secFlags & CIFSSEC_MUST_SIGN) == CIFSSEC_MUST_SIGN) && (server->sec_mode & (SECMODE_SIGN_ENABLED|SECMODE_SIGN_REQUIRED)) == 0) return false; return true; } ",0 "void HistogramEnumerateSelLdrLoadStatus(NaClErrorCode error_code) { HistogramEnumerate(""NaCl.LoadStatus.SelLdr"", error_code, NACL_ERROR_CODE_MAX, LOAD_STATUS_UNKNOWN); } ",0 "void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata, const int offset) { struct ieee80211_local *local = sdata->local; u32 flags = sdata->u.mntr_flags; #define ADJUST(_f, _s) do { \ if (flags & MONITOR_FLAG_##_f) \ local->fif_##_s += offset; \ } while (0) ADJUST(FCSFAIL, fcsfail); ADJUST(PLCPFAIL, plcpfail); ADJUST(CONTROL, control); ADJUST(CONTROL, pspoll); ADJUST(OTHER_BSS, other_bss); #undef ADJUST } ",0 "static int snd_interval_ratden(struct snd_interval *i, unsigned int rats_count, const struct snd_ratden *rats, unsigned int *nump, unsigned int *denp) { unsigned int best_num, best_diff, best_den; unsigned int k; struct snd_interval t; int err; best_num = best_den = best_diff = 0; for (k = 0; k < rats_count; ++k) { unsigned int num; unsigned int den = rats[k].den; unsigned int q = i->min; int diff; num = mul(q, den); if (num > rats[k].num_max) continue; if (num < rats[k].num_min) num = rats[k].num_max; else { unsigned int r; r = (num - rats[k].num_min) % rats[k].num_step; if (r != 0) num += rats[k].num_step - r; } diff = num - q * den; if (best_num == 0 || diff * best_den < best_diff * den) { best_diff = diff; best_den = den; best_num = num; } } if (best_den == 0) { i->empty = 1; return -EINVAL; } t.min = div_down(best_num, best_den); t.openmin = !!(best_num % best_den); best_num = best_den = best_diff = 0; for (k = 0; k < rats_count; ++k) { unsigned int num; unsigned int den = rats[k].den; unsigned int q = i->max; int diff; num = mul(q, den); if (num < rats[k].num_min) continue; if (num > rats[k].num_max) num = rats[k].num_max; else { unsigned int r; r = (num - rats[k].num_min) % rats[k].num_step; if (r != 0) num -= r; } diff = q * den - num; if (best_num == 0 || diff * best_den < best_diff * den) { best_diff = diff; best_den = den; best_num = num; } } if (best_den == 0) { i->empty = 1; return -EINVAL; } t.max = div_up(best_num, best_den); t.openmax = !!(best_num % best_den); t.integer = 0; err = snd_interval_refine(i, &t); if (err < 0) return err; if (snd_interval_single(i)) { if (nump) *nump = best_num; if (denp) *denp = best_den; } return err; } ",0 "static int mpol_new_bind(struct mempolicy *pol, const nodemask_t *nodes) { if (nodes_empty(*nodes)) return -EINVAL; pol->v.nodes = *nodes; return 0; } ",0 "void WebContentsAndroid::OnShow(JNIEnv* env, jobject obj) { web_contents_->WasShown(); } ",0 "void RenderView::OnStopFinding(const ViewMsg_StopFinding_Params& params) { WebView* view = webview(); if (!view) return; WebDocument doc = view->mainFrame()->document(); if (doc.isPluginDocument() && GetWebPluginFromPluginDocument()) { GetWebPluginFromPluginDocument()->stopFind(); return; } bool clear_selection = params.action == ViewMsg_StopFinding_Params::kClearSelection; if (clear_selection) view->focusedFrame()->executeCommand(WebString::fromUTF8(""Unselect"")); WebFrame* frame = view->mainFrame(); while (frame) { frame->stopFinding(clear_selection); frame = frame->traverseNext(false); } if (params.action == ViewMsg_StopFinding_Params::kActivateSelection) { WebFrame* focused_frame = view->focusedFrame(); if (focused_frame) { WebDocument doc = focused_frame->document(); if (!doc.isNull()) { WebNode node = doc.focusedNode(); if (!node.isNull()) node.simulateClick(); } } } } ",0 "VerifyResult SyncerUtil::VerifyUpdateConsistency( syncable::WriteTransaction* trans, const SyncEntity& update, syncable::MutableEntry* target, const bool deleted, const bool is_directory, syncable::ModelType model_type) { CHECK(target->good()); if (deleted) return VERIFY_SUCCESS; if (model_type == syncable::UNSPECIFIED) { return VERIFY_SKIP; } if (target->Get(SERVER_VERSION) > 0) { if (is_directory != target->Get(SERVER_IS_DIR) || model_type != target->GetServerModelType()) { if (target->Get(IS_DEL)) { // If we've deleted the item, we don't care. return VERIFY_SKIP; } else { LOG(ERROR) << ""Server update doesn't agree with previous updates. ""; LOG(ERROR) << "" Entry: "" << *target; LOG(ERROR) << "" Update: "" << SyncerProtoUtil::SyncEntityDebugString(update); return VERIFY_FAIL; } } if (!deleted && (target->Get(ID) == update.id()) && (target->Get(SERVER_IS_DEL) || (!target->Get(IS_UNSYNCED) && target->Get(IS_DEL) && target->Get(BASE_VERSION) > 0))) { VerifyResult result = SyncerUtil::VerifyUndelete(trans, update, target); if (VERIFY_UNDECIDED != result) return result; } } if (target->Get(BASE_VERSION) > 0) { if (is_directory != target->Get(IS_DIR) || model_type != target->GetModelType()) { LOG(ERROR) << ""Server update doesn't agree with committed item. ""; LOG(ERROR) << "" Entry: "" << *target; LOG(ERROR) << "" Update: "" << SyncerProtoUtil::SyncEntityDebugString(update); return VERIFY_FAIL; } if (target->Get(ID) == update.id()) { if (target->Get(BASE_VERSION) == update.version() && !target->Get(IS_UNSYNCED) && !SyncerProtoUtil::Compare(*target, update)) { LOG(ERROR) << ""Server update doesn't match local data with same "" ""version. A bug should be filed. Entry: "" << *target << ""Update: "" << SyncerProtoUtil::SyncEntityDebugString(update); return VERIFY_FAIL; } if (target->Get(SERVER_VERSION) > update.version()) { LOG(WARNING) << ""We've already seen a more recent version.""; LOG(WARNING) << "" Entry: "" << *target; LOG(WARNING) << "" Update: "" << SyncerProtoUtil::SyncEntityDebugString(update); return VERIFY_SKIP; } } } return VERIFY_SUCCESS; } ",0 "mem_cgroup_create(struct cgroup_subsys *ss, struct cgroup *cont) { struct mem_cgroup *memcg, *parent; long error = -ENOMEM; int node; memcg = mem_cgroup_alloc(); if (!memcg) return ERR_PTR(error); for_each_node(node) if (alloc_mem_cgroup_per_zone_info(memcg, node)) goto free_out; /* root ? */ if (cont->parent == NULL) { int cpu; enable_swap_cgroup(); parent = NULL; if (mem_cgroup_soft_limit_tree_init()) goto free_out; root_mem_cgroup = memcg; for_each_possible_cpu(cpu) { struct memcg_stock_pcp *stock = &per_cpu(memcg_stock, cpu); INIT_WORK(&stock->work, drain_local_stock); } hotcpu_notifier(memcg_cpu_hotplug_callback, 0); } else { parent = mem_cgroup_from_cont(cont->parent); memcg->use_hierarchy = parent->use_hierarchy; memcg->oom_kill_disable = parent->oom_kill_disable; } if (parent && parent->use_hierarchy) { res_counter_init(&memcg->res, &parent->res); res_counter_init(&memcg->memsw, &parent->memsw); /* * We increment refcnt of the parent to ensure that we can * safely access it on res_counter_charge/uncharge. * This refcnt will be decremented when freeing this * mem_cgroup(see mem_cgroup_put). */ mem_cgroup_get(parent); } else { res_counter_init(&memcg->res, NULL); res_counter_init(&memcg->memsw, NULL); } memcg->last_scanned_node = MAX_NUMNODES; INIT_LIST_HEAD(&memcg->oom_notify); if (parent) memcg->swappiness = mem_cgroup_swappiness(parent); atomic_set(&memcg->refcnt, 1); memcg->move_charge_at_immigrate = 0; mutex_init(&memcg->thresholds_lock); return &memcg->css; free_out: __mem_cgroup_free(memcg); return ERR_PTR(error); } ",0 "void AudioContext::removeChangedChannelCountMode(AudioNode* node) { ASSERT(isGraphOwner()); m_deferredCountModeChange.remove(node); } ",0 "png_set_strip_alpha(png_structp png_ptr) { png_debug(1, ""in png_set_strip_alpha""); if (png_ptr == NULL) return; png_ptr->flags |= PNG_FLAG_STRIP_ALPHA; } ",0 "bool CustomButton::OnMousePressed(const ui::MouseEvent& event) { if (state_ != STATE_DISABLED) { if (ShouldEnterPushedState(event) && HitTestPoint(event.location())) SetState(STATE_PRESSED); if (request_focus_on_press_) RequestFocus(); if (IsTriggerableEvent(event) && notify_action_ == NOTIFY_ON_PRESS) { NotifyClick(event); } } return true; } ",0 "void Performance::clearMeasures(const String& measure_name) { if (!user_timing_) user_timing_ = UserTiming::Create(*this); user_timing_->ClearMeasures(measure_name); } ",0 "int MaxStorageSizeForTable(int table_len) { return table_len * (k64kEntriesStore / kBaseTableLen); } ",0 "put_reg_load(struct ofpbuf *openflow, const struct mf_subfield *dst, uint64_t value) { ovs_assert(dst->n_bits <= 64); struct nx_action_reg_load *narl = put_NXAST_REG_LOAD(openflow); narl->ofs_nbits = nxm_encode_ofs_nbits(dst->ofs, dst->n_bits); narl->dst = htonl(nxm_header_from_mff(dst->field)); narl->value = htonll(value); } ",0 "void GfxDeviceNColorSpace::getCMYK(GfxColor *color, GfxCMYK *cmyk) { double x[gfxColorMaxComps], c[gfxColorMaxComps]; GfxColor color2; int i; for (i = 0; i < nComps; ++i) { x[i] = colToDbl(color->c[i]); } func->transform(x, c); for (i = 0; i < alt->getNComps(); ++i) { color2.c[i] = dblToCol(c[i]); } alt->getCMYK(&color2, cmyk); } ",0 "OneClickSigninSyncStarter::OneClickSigninSyncStarter( Profile* profile, Browser* browser, const std::string& session_index, const std::string& email, const std::string& password, StartSyncMode start_mode, bool force_same_tab_navigation, ConfirmationRequired confirmation_required) : start_mode_(start_mode), force_same_tab_navigation_(force_same_tab_navigation), confirmation_required_(confirmation_required), weak_pointer_factory_(this) { DCHECK(profile); BrowserList::AddObserver(this); Initialize(profile, browser); SigninManager* manager = SigninManagerFactory::GetForProfile(profile_); SigninManager::OAuthTokenFetchedCallback callback; callback = base::Bind(&OneClickSigninSyncStarter::ConfirmSignin, weak_pointer_factory_.GetWeakPtr()); manager->StartSignInWithCredentials(session_index, email, password, callback); } ",1 "IntRect RenderBox::reflectionBox() const { IntRect result; if (!style()->boxReflect()) return result; IntRect box = borderBoxRect(); result = box; switch (style()->boxReflect()->direction()) { case ReflectionBelow: result.move(0, box.height() + reflectionOffset()); break; case ReflectionAbove: result.move(0, -box.height() - reflectionOffset()); break; case ReflectionLeft: result.move(-box.width() - reflectionOffset(), 0); break; case ReflectionRight: result.move(box.width() + reflectionOffset(), 0); break; } return result; } ",0 "static void JPEGErrorHandler(j_common_ptr jpeg_info) { char message[JMSG_LENGTH_MAX]; ErrorManager *error_manager; ExceptionInfo *exception; Image *image; *message='\0'; error_manager=(ErrorManager *) jpeg_info->client_data; image=error_manager->image; exception=error_manager->exception; (jpeg_info->err->format_message)(jpeg_info,message); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""[%s] JPEG Trace: \""%s\"""",image->filename,message); if (error_manager->finished != MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageWarning, (char *) message,""`%s'"",image->filename); else (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError, (char *) message,""`%s'"",image->filename); longjmp(error_manager->error_recovery,1); } ",0 "static int __init usb_init(void) { int retval; if (usb_disabled()) { pr_info(""%s: USB support disabled\n"", usbcore_name); return 0; } usb_init_pool_max(); usb_debugfs_init(); usb_acpi_register(); retval = bus_register(&usb_bus_type); if (retval) goto bus_register_failed; retval = bus_register_notifier(&usb_bus_type, &usb_bus_nb); if (retval) goto bus_notifier_failed; retval = usb_major_init(); if (retval) goto major_init_failed; retval = usb_register(&usbfs_driver); if (retval) goto driver_register_failed; retval = usb_devio_init(); if (retval) goto usb_devio_init_failed; retval = usb_hub_init(); if (retval) goto hub_init_failed; retval = usb_register_device_driver(&usb_generic_driver, THIS_MODULE); if (!retval) goto out; usb_hub_cleanup(); hub_init_failed: usb_devio_cleanup(); usb_devio_init_failed: usb_deregister(&usbfs_driver); driver_register_failed: usb_major_cleanup(); major_init_failed: bus_unregister_notifier(&usb_bus_type, &usb_bus_nb); bus_notifier_failed: bus_unregister(&usb_bus_type); bus_register_failed: usb_acpi_unregister(); usb_debugfs_cleanup(); out: return retval; } ",0 "static int need_active_balance(struct lb_env *env) { struct sched_domain *sd = env->sd; if (env->idle == CPU_NEWLY_IDLE) { /* * ASYM_PACKING needs to force migrate tasks from busy but * lower priority CPUs in order to pack all tasks in the * highest priority CPUs. */ if ((sd->flags & SD_ASYM_PACKING) && sched_asym_prefer(env->dst_cpu, env->src_cpu)) return 1; } /* * The dst_cpu is idle and the src_cpu CPU has only 1 CFS task. * It's worth migrating the task if the src_cpu's capacity is reduced * because of other sched_class or IRQs if more capacity stays * available on dst_cpu. */ if ((env->idle != CPU_NOT_IDLE) && (env->src_rq->cfs.h_nr_running == 1)) { if ((check_cpu_capacity(env->src_rq, sd)) && (capacity_of(env->src_cpu)*sd->imbalance_pct < capacity_of(env->dst_cpu)*100)) return 1; } if (env->src_grp_type == group_misfit_task) return 1; return unlikely(sd->nr_balance_failed > sd->cache_nice_tries+2); } ",0 "static Image *ReadWEBPImage(const ImageInfo *image_info, ExceptionInfo *exception) { Image *image; int webp_status; MagickBooleanType status; register unsigned char *p; size_t length; ssize_t count, y; unsigned char header[12], *stream; WebPDecoderConfig configure; WebPDecBuffer *magick_restrict webp_image = &configure.output; WebPBitstreamFeatures *magick_restrict features = &configure.input; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } if (WebPInitDecoderConfig(&configure) == 0) ThrowReaderException(ResourceLimitError,""UnableToDecodeImageFile""); webp_image->colorspace=MODE_RGBA; count=ReadBlob(image,12,header); if (count != 12) ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); status=IsWEBP(header,count); if (status == MagickFalse) ThrowReaderException(CorruptImageError,""CorruptImage""); length=(size_t) (ReadWebPLSBWord(header+4)+8); if (length < 12) ThrowReaderException(CorruptImageError,""CorruptImage""); stream=(unsigned char *) AcquireQuantumMemory(length,sizeof(*stream)); if (stream == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); (void) memcpy(stream,header,12); count=ReadBlob(image,length-12,stream+12); if (count != (ssize_t) (length-12)) ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); webp_status=WebPGetFeatures(stream,length,features); if (webp_status == VP8_STATUS_OK) { image->columns=(size_t) features->width; image->rows=(size_t) features->height; image->depth=8; image->matte=features->has_alpha != 0 ? MagickTrue : MagickFalse; if (IsWEBPImageLossless(stream,length) != MagickFalse) image->quality=100; if (image_info->ping != MagickFalse) { stream=(unsigned char*) RelinquishMagickMemory(stream); (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } webp_status=WebPDecode(stream,length,&configure); } if (webp_status != VP8_STATUS_OK) { stream=(unsigned char*) RelinquishMagickMemory(stream); switch (webp_status) { case VP8_STATUS_OUT_OF_MEMORY: { ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); break; } case VP8_STATUS_INVALID_PARAM: { ThrowReaderException(CorruptImageError,""invalid parameter""); break; } case VP8_STATUS_BITSTREAM_ERROR: { ThrowReaderException(CorruptImageError,""CorruptImage""); break; } case VP8_STATUS_UNSUPPORTED_FEATURE: { ThrowReaderException(CoderError,""DataEncodingSchemeIsNotSupported""); break; } case VP8_STATUS_SUSPENDED: { ThrowReaderException(CorruptImageError,""decoder suspended""); break; } case VP8_STATUS_USER_ABORT: { ThrowReaderException(CorruptImageError,""user abort""); break; } case VP8_STATUS_NOT_ENOUGH_DATA: { ThrowReaderException(CorruptImageError,""InsufficientImageDataInFile""); break; } default: ThrowReaderException(CorruptImageError,""CorruptImage""); } } p=(unsigned char *) webp_image->u.RGBA.rgba; for (y=0; y < (ssize_t) image->rows; y++) { register PixelPacket *q; register ssize_t x; q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ScaleCharToQuantum(*p++)); SetPixelGreen(q,ScaleCharToQuantum(*p++)); SetPixelBlue(q,ScaleCharToQuantum(*p++)); SetPixelAlpha(q,ScaleCharToQuantum(*p++)); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } WebPFreeDecBuffer(webp_image); stream=(unsigned char*) RelinquishMagickMemory(stream); return(image); } ",1 "void GetMetadataFromFrame(const media::VideoFrame& frame, double* device_scale_factor, double* page_scale_factor, gfx::Vector2dF* root_scroll_offset, double* top_controls_height, double* top_controls_shown_ratio) { bool success = true; double root_scroll_offset_x, root_scroll_offset_y; success &= frame.metadata()->GetDouble( media::VideoFrameMetadata::DEVICE_SCALE_FACTOR, device_scale_factor); success &= frame.metadata()->GetDouble( media::VideoFrameMetadata::PAGE_SCALE_FACTOR, page_scale_factor); success &= frame.metadata()->GetDouble( media::VideoFrameMetadata::ROOT_SCROLL_OFFSET_X, &root_scroll_offset_x); success &= frame.metadata()->GetDouble( media::VideoFrameMetadata::ROOT_SCROLL_OFFSET_Y, &root_scroll_offset_y); success &= frame.metadata()->GetDouble( media::VideoFrameMetadata::TOP_CONTROLS_HEIGHT, top_controls_height); success &= frame.metadata()->GetDouble( media::VideoFrameMetadata::TOP_CONTROLS_SHOWN_RATIO, top_controls_shown_ratio); DCHECK(success); root_scroll_offset->set_x(root_scroll_offset_x); root_scroll_offset->set_y(root_scroll_offset_y); } ",0 "PHP_FUNCTION(openssl_x509_parse) { zval ** zcert; X509 * cert = NULL; long certresource = -1; int i; zend_bool useshortnames = 1; char * tmpstr; zval * subitem; X509_EXTENSION *extension; char *extname; BIO *bio_out; BUF_MEM *bio_buf; char buf[256]; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""Z|b"", &zcert, &useshortnames) == FAILURE) { return; } cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC); if (cert == NULL) { RETURN_FALSE; } array_init(return_value); if (cert->name) { add_assoc_string(return_value, ""name"", cert->name, 1); } /* add_assoc_bool(return_value, ""valid"", cert->valid); */ add_assoc_name_entry(return_value, ""subject"", X509_get_subject_name(cert), useshortnames TSRMLS_CC); /* hash as used in CA directories to lookup cert by subject name */ { char buf[32]; snprintf(buf, sizeof(buf), ""%08lx"", X509_subject_name_hash(cert)); add_assoc_string(return_value, ""hash"", buf, 1); } add_assoc_name_entry(return_value, ""issuer"", X509_get_issuer_name(cert), useshortnames TSRMLS_CC); add_assoc_long(return_value, ""version"", X509_get_version(cert)); add_assoc_string(return_value, ""serialNumber"", i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(cert)), 1); add_assoc_asn1_string(return_value, ""validFrom"", X509_get_notBefore(cert)); add_assoc_asn1_string(return_value, ""validTo"", X509_get_notAfter(cert)); add_assoc_long(return_value, ""validFrom_time_t"", asn1_time_to_time_t(X509_get_notBefore(cert) TSRMLS_CC)); add_assoc_long(return_value, ""validTo_time_t"", asn1_time_to_time_t(X509_get_notAfter(cert) TSRMLS_CC)); tmpstr = (char *)X509_alias_get0(cert, NULL); if (tmpstr) { add_assoc_string(return_value, ""alias"", tmpstr, 1); } /* add_assoc_long(return_value, ""signaturetypeLONG"", X509_get_signature_type(cert)); add_assoc_string(return_value, ""signaturetype"", OBJ_nid2sn(X509_get_signature_type(cert)), 1); add_assoc_string(return_value, ""signaturetypeLN"", OBJ_nid2ln(X509_get_signature_type(cert)), 1); */ MAKE_STD_ZVAL(subitem); array_init(subitem); /* NOTE: the purposes are added as integer keys - the keys match up to the X509_PURPOSE_SSL_XXX defines in x509v3.h */ for (i = 0; i < X509_PURPOSE_get_count(); i++) { int id, purpset; char * pname; X509_PURPOSE * purp; zval * subsub; MAKE_STD_ZVAL(subsub); array_init(subsub); purp = X509_PURPOSE_get0(i); id = X509_PURPOSE_get_id(purp); purpset = X509_check_purpose(cert, id, 0); add_index_bool(subsub, 0, purpset); purpset = X509_check_purpose(cert, id, 1); add_index_bool(subsub, 1, purpset); pname = useshortnames ? X509_PURPOSE_get0_sname(purp) : X509_PURPOSE_get0_name(purp); add_index_string(subsub, 2, pname, 1); /* NOTE: if purpset > 1 then it's a warning - we should mention it ? */ add_index_zval(subitem, id, subsub); } add_assoc_zval(return_value, ""purposes"", subitem); MAKE_STD_ZVAL(subitem); array_init(subitem); for (i = 0; i < X509_get_ext_count(cert); i++) { int nid; extension = X509_get_ext(cert, i); nid = OBJ_obj2nid(X509_EXTENSION_get_object(extension)); if (nid != NID_undef) { extname = (char *)OBJ_nid2sn(OBJ_obj2nid(X509_EXTENSION_get_object(extension))); } else { OBJ_obj2txt(buf, sizeof(buf)-1, X509_EXTENSION_get_object(extension), 1); extname = buf; } bio_out = BIO_new(BIO_s_mem()); if (nid == NID_subject_alt_name) { if (openssl_x509v3_subjectAltName(bio_out, extension) == 0) { BIO_get_mem_ptr(bio_out, &bio_buf); add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1); } else { zval_dtor(return_value); if (certresource == -1 && cert) { X509_free(cert); } BIO_free(bio_out); RETURN_FALSE; } } else if (X509V3_EXT_print(bio_out, extension, 0, 0)) { BIO_get_mem_ptr(bio_out, &bio_buf); add_assoc_stringl(subitem, extname, bio_buf->data, bio_buf->length, 1); } else { add_assoc_asn1_string(subitem, extname, X509_EXTENSION_get_data(extension)); } BIO_free(bio_out); } add_assoc_zval(return_value, ""extensions"", subitem); if (certresource == -1 && cert) { X509_free(cert); } } ",0 "void unix_inflight(struct file *fp) { struct sock *s = unix_get_socket(fp); if (s) { struct unix_sock *u = unix_sk(s); spin_lock(&unix_gc_lock); if (atomic_long_inc_return(&u->inflight) == 1) { BUG_ON(!list_empty(&u->link)); list_add_tail(&u->link, &gc_inflight_list); } else { BUG_ON(list_empty(&u->link)); } unix_tot_inflight++; spin_unlock(&unix_gc_lock); } } ",1 "void LayerTreeHost::RemoveLayerShouldPushProperties(Layer* layer) { layers_that_should_push_properties_.erase(layer); } ",0 "vmxnet3_on_rx_done_update_stats(VMXNET3State *s, int qidx, Vmxnet3PktStatus status) { struct UPT1_RxStats *stats = &s->rxq_descr[qidx].rxq_stats; size_t tot_len = net_rx_pkt_get_total_len(s->rx_pkt); switch (status) { case VMXNET3_PKT_STATUS_OUT_OF_BUF: stats->pktsRxOutOfBuf++; break; case VMXNET3_PKT_STATUS_ERROR: stats->pktsRxError++; break; case VMXNET3_PKT_STATUS_OK: switch (net_rx_pkt_get_packet_type(s->rx_pkt)) { case ETH_PKT_BCAST: stats->bcastPktsRxOK++; stats->bcastBytesRxOK += tot_len; break; case ETH_PKT_MCAST: stats->mcastPktsRxOK++; stats->mcastBytesRxOK += tot_len; break; case ETH_PKT_UCAST: stats->ucastPktsRxOK++; stats->ucastBytesRxOK += tot_len; break; default: g_assert_not_reached(); } if (tot_len > s->mtu) { stats->LROPktsRxOK++; stats->LROBytesRxOK += tot_len; } break; default: g_assert_not_reached(); } } ",0 "status_t Parcel::writeUniqueFileDescriptorVector(const std::vector& val) { return writeTypedVector(val, &Parcel::writeUniqueFileDescriptor); } ",0 "jsonb_object_field(PG_FUNCTION_ARGS) { Jsonb *jb = PG_GETARG_JSONB(0); text *key = PG_GETARG_TEXT_PP(1); JsonbValue *v; if (!JB_ROOT_IS_OBJECT(jb)) PG_RETURN_NULL(); v = findJsonbValueFromContainerLen(&jb->root, JB_FOBJECT, VARDATA_ANY(key), VARSIZE_ANY_EXHDR(key)); if (v != NULL) PG_RETURN_JSONB(JsonbValueToJsonb(v)); PG_RETURN_NULL(); } ",0 "void luaD_call (lua_State *L, StkId func, int nResults) { if (++L->nCcalls >= LUAI_MAXCCALLS) { if (L->nCcalls == LUAI_MAXCCALLS) luaG_runerror(L, ""C stack overflow""); else if (L->nCcalls >= (LUAI_MAXCCALLS + (LUAI_MAXCCALLS>>3))) luaD_throw(L, LUA_ERRERR); /* error while handing stack error */ } if (luaD_precall(L, func, nResults) == PCRLUA) /* is a Lua function? */ luaV_execute(L, 1); /* call it */ L->nCcalls--; luaC_checkGC(L); } ",0 "void FilePathWatcherImpl::OnFilePathChanged( InotifyReader::Watch fired_watch, const FilePath::StringType& child, bool created, bool is_directory) { if (!message_loop()->BelongsToCurrentThread()) { message_loop()->PostTask(FROM_HERE, base::Bind(&FilePathWatcherImpl::OnFilePathChanged, this, fired_watch, child, created, is_directory)); return; } DCHECK(MessageLoopForIO::current()); WatchVector::const_iterator watch_entry(watches_.begin()); for ( ; watch_entry != watches_.end(); ++watch_entry) { if (fired_watch == watch_entry->watch_) { bool change_on_target_path = child.empty() || ((child == watch_entry->subdir_) && watch_entry->linkname_.empty()) || (child == watch_entry->linkname_); DCHECK(watch_entry->subdir_.empty() || (watch_entry + 1) != watches_.end()); bool target_changed = (watch_entry->subdir_.empty() && (child == watch_entry->linkname_)) || (watch_entry->subdir_.empty() && watch_entry->linkname_.empty()) || (watch_entry->subdir_ == child && (watch_entry + 1)->subdir_.empty()); if (change_on_target_path && !UpdateWatches()) { delegate_->OnFilePathError(target_); return; } if (target_changed || (change_on_target_path && !created) || (change_on_target_path && file_util::PathExists(target_))) { delegate_->OnFilePathChanged(target_); return; } } } } ",0 "int WebSocketExperimentTask::DoWebSocketConnect() { DCHECK(!websocket_); websocket_ = context_->CreateWebSocket(config_, this); if (!websocket_) { next_state_ = STATE_NONE; return net::ERR_UNEXPECTED; } next_state_ = STATE_WEBSOCKET_CONNECT_COMPLETE; websocket_connect_start_time_ = base::TimeTicks::Now(); websocket_->Connect(); SetTimeout(config_.websocket_onopen_deadline_ms); return net::ERR_IO_PENDING; } ",0 "static int asn1_write_element(sc_context_t *ctx, unsigned int tag, const u8 * data, size_t datalen, u8 ** out, size_t * outlen) { unsigned char t; unsigned char *buf, *p; int c = 0; unsigned short_tag; unsigned char tag_char[3] = {0, 0, 0}; size_t tag_len, ii; short_tag = tag & SC_ASN1_TAG_MASK; for (tag_len = 0; short_tag >> (8 * tag_len); tag_len++) tag_char[tag_len] = (short_tag >> (8 * tag_len)) & 0xFF; if (!tag_len) tag_len = 1; if (tag_len > 1) { if ((tag_char[tag_len - 1] & SC_ASN1_TAG_PRIMITIVE) != SC_ASN1_TAG_ESCAPE_MARKER) SC_TEST_RET(ctx, SC_LOG_DEBUG_ASN1, SC_ERROR_INVALID_DATA, ""First byte of the long tag is not 'escape marker'""); for (ii = 1; ii < tag_len - 1; ii++) if (!(tag_char[ii] & 0x80)) SC_TEST_RET(ctx, SC_LOG_DEBUG_ASN1, SC_ERROR_INVALID_DATA, ""MS bit expected to be 'one'""); if (tag_char[0] & 0x80) SC_TEST_RET(ctx, SC_LOG_DEBUG_ASN1, SC_ERROR_INVALID_DATA, ""MS bit of the last byte expected to be 'zero'""); } t = tag_char[tag_len - 1] & 0x1F; switch (tag & SC_ASN1_CLASS_MASK) { case SC_ASN1_UNI: break; case SC_ASN1_APP: t |= SC_ASN1_TAG_APPLICATION; break; case SC_ASN1_CTX: t |= SC_ASN1_TAG_CONTEXT; break; case SC_ASN1_PRV: t |= SC_ASN1_TAG_PRIVATE; break; } if (tag & SC_ASN1_CONS) t |= SC_ASN1_TAG_CONSTRUCTED; if (datalen > 127) { c = 1; while (datalen >> (c << 3)) c++; } *outlen = tag_len + 1 + c + datalen; buf = malloc(*outlen); if (buf == NULL) SC_FUNC_RETURN(ctx, SC_LOG_DEBUG_ASN1, SC_ERROR_OUT_OF_MEMORY); *out = p = buf; *p++ = t; for (ii=1;ii> (c << 3)) & 0xFF; } else { *p++ = datalen & 0x7F; } memcpy(p, data, datalen); return SC_SUCCESS; } ",0 "void FileSystemManagerImpl::BindRequest( blink::mojom::FileSystemManagerRequest request) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!operation_runner_) operation_runner_ = context_->CreateFileSystemOperationRunner(); bindings_.AddBinding(this, std::move(request)); } ",0 "void IndexedDBDatabase::CreateObjectStoreAbortOperation( int64_t object_store_id) { IDB_TRACE(""IndexedDBDatabase::CreateObjectStoreAbortOperation""); RemoveObjectStore(object_store_id); } ",0 "static void RuntimeEnabledLongAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueInt(info, impl->runtimeEnabledLongAttribute()); } ",0 "static struct VP8D_COMP * create_decompressor(VP8D_CONFIG *oxcf) { VP8D_COMP *pbi = vpx_memalign(32, sizeof(VP8D_COMP)); if (!pbi) return NULL; memset(pbi, 0, sizeof(VP8D_COMP)); if (setjmp(pbi->common.error.jmp)) { pbi->common.error.setjmp = 0; remove_decompressor(pbi); return 0; } pbi->common.error.setjmp = 1; vp8_create_common(&pbi->common); pbi->common.current_video_frame = 0; pbi->ready_for_new_data = 1; /* vp8cx_init_de_quantizer() is first called here. Add check in frame_init_dequantizer() to avoid * unnecessary calling of vp8cx_init_de_quantizer() for every frame. */ vp8cx_init_de_quantizer(pbi); vp8_loop_filter_init(&pbi->common); pbi->common.error.setjmp = 0; #if CONFIG_ERROR_CONCEALMENT pbi->ec_enabled = oxcf->error_concealment; pbi->overlaps = NULL; #else (void)oxcf; pbi->ec_enabled = 0; #endif /* Error concealment is activated after a key frame has been * decoded without errors when error concealment is enabled. */ pbi->ec_active = 0; pbi->decoded_key_frame = 0; /* Independent partitions is activated when a frame updates the * token probability table to have equal probabilities over the * PREV_COEF context. */ pbi->independent_partitions = 0; vp8_setup_block_dptrs(&pbi->mb); once(initialize_dec); return pbi; } ",0 " TestEntryInfo& SetLastModifiedTime(const base::Time& time) { last_modified_time = time; return *this; } ",0 "bool Extension::LoadAppIsolation(const DictionaryValue* manifest, std::string* error) { if (!CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableExperimentalExtensionApis)) return true; Value* temp = NULL; if (!manifest->Get(keys::kIsolation, &temp)) return true; if (temp->GetType() != Value::TYPE_LIST) { *error = errors::kInvalidIsolation; return false; } ListValue* isolation_list = static_cast(temp); for (size_t i = 0; i < isolation_list->GetSize(); ++i) { std::string isolation_string; if (!isolation_list->GetString(i, &isolation_string)) { *error = ExtensionErrorUtils::FormatErrorMessage( errors::kInvalidIsolationValue, base::UintToString(i)); return false; } if (isolation_string == values::kIsolatedStorage) { is_storage_isolated_ = true; } else { LOG(WARNING) << ""Did not recognize isolation type: "" << isolation_string; } } return true; } ",0 "void Document::SetLastFocusType(WebFocusType last_focus_type) { last_focus_type_ = last_focus_type; } ",0 "ModuleExport void UnregisterVIPSImage(void) { (void) UnregisterMagickInfo(""VIPS""); } ",0 "DebuggerFunction::DebuggerFunction() : client_host_(NULL) { } ",0 "static void jas_stream_destroy(jas_stream_t *stream) { /* If the memory for the buffer was allocated with malloc, free this memory. */ if ((stream->bufmode_ & JAS_STREAM_FREEBUF) && stream->bufbase_) { JAS_DBGLOG(100, (""jas_stream_destroy freeing buffer %p\n"", stream->bufbase_)); jas_free(stream->bufbase_); stream->bufbase_ = 0; } jas_free(stream); } ",0 "static s64 cpu_rt_runtime_read(struct cgroup_subsys_state *css, struct cftype *cft) { return sched_group_rt_runtime(css_tg(css)); } ",0 "status_t CameraClient::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) { LOG1(""sendCommand (pid %d)"", getCallingPid()); int orientation; Mutex::Autolock lock(mLock); status_t result = checkPidAndHardware(); if (result != NO_ERROR) return result; if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) { orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT); if (orientation == -1) return BAD_VALUE; if (mOrientation != orientation) { mOrientation = orientation; if (mPreviewWindow != 0) { native_window_set_buffers_transform(mPreviewWindow.get(), mOrientation); } } return OK; } else if (cmd == CAMERA_CMD_ENABLE_SHUTTER_SOUND) { switch (arg1) { case 0: return enableShutterSound(false); case 1: return enableShutterSound(true); default: return BAD_VALUE; } return OK; } else if (cmd == CAMERA_CMD_PLAY_RECORDING_SOUND) { mCameraService->playSound(CameraService::SOUND_RECORDING); } else if (cmd == CAMERA_CMD_SET_VIDEO_BUFFER_COUNT) { return INVALID_OPERATION; } else if (cmd == CAMERA_CMD_PING) { return OK; } return mHardware->sendCommand(cmd, arg1, arg2); } ",0 "static int tm_spr_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) { int ret; /* Build tests */ BUILD_BUG_ON(TSO(tm_tfhar) + sizeof(u64) != TSO(tm_texasr)); BUILD_BUG_ON(TSO(tm_texasr) + sizeof(u64) != TSO(tm_tfiar)); BUILD_BUG_ON(TSO(tm_tfiar) + sizeof(u64) != TSO(ckpt_regs)); if (!cpu_has_feature(CPU_FTR_TM)) return -ENODEV; /* Flush the states */ flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); /* TFHAR register */ ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.tm_tfhar, 0, sizeof(u64)); /* TEXASR register */ if (!ret) ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.tm_texasr, sizeof(u64), 2 * sizeof(u64)); /* TFIAR register */ if (!ret) ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, &target->thread.tm_tfiar, 2 * sizeof(u64), 3 * sizeof(u64)); return ret; } ",0 "static int handle_NPP_StreamAsFile(rpc_connection_t *connection) { D(bug(""handle_NPP_StreamAsFile\n"")); PluginInstance *plugin; NPStream *stream; char *fname; int error = rpc_method_get_args(connection, RPC_TYPE_NPW_PLUGIN_INSTANCE, &plugin, RPC_TYPE_NP_STREAM, &stream, RPC_TYPE_STRING, &fname, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror(""NPP_StreamAsFile() get args"", error); return error; } g_NPP_StreamAsFile(PLUGIN_INSTANCE_NPP(plugin), stream, fname); if (fname) free(fname); return rpc_method_send_reply (connection, RPC_TYPE_INVALID); } ",0 "static int ext4_get_next_id(struct super_block *sb, struct kqid *qid) { const struct quota_format_ops *ops; if (!sb_has_quota_loaded(sb, qid->type)) return -ESRCH; ops = sb_dqopt(sb)->ops[qid->type]; if (!ops || !ops->get_next_id) return -ENOSYS; return dquot_get_next_id(sb, qid); } ",0 "int RemoveThumbnail(unsigned char * ExifSection) { if (!DirWithThumbnailPtrs || ImageInfo.ThumbnailOffset == 0 || ImageInfo.ThumbnailSize == 0){ return 0; } if (ImageInfo.ThumbnailAtEnd == FALSE){ ErrNonfatal(""Thumbnail is not at end of header, can't chop it off"", 0, 0); return 0; } { int de; int NumDirEntries; NumDirEntries = Get16u(DirWithThumbnailPtrs); for (de=0;derootfs.path ? lxc_conf->rootfs.mount : """"); if (mounted == -1) { SYSERROR(""failed to mount /proc in the container.""); /* continue only if there is no rootfs */ if (lxc_conf->rootfs.path) return -1; } else if (mounted == 1) { lxc_conf->tmp_umount_proc = 1; } return 0; } ",0 "void *ipc_alloc(int size) { void *out; if (size > PAGE_SIZE) out = vmalloc(size); else out = kmalloc(size, GFP_KERNEL); return out; } ",0 "void FreeContextBuffer_EnumerateSecurityPackages(void* contextBuffer) { int index; UINT32 cPackages; SecPkgInfoA* pPackageInfo = (SecPkgInfoA*) contextBuffer; cPackages = sizeof(SecPkgInfoA_LIST) / sizeof(*(SecPkgInfoA_LIST)); for (index = 0; index < (int) cPackages; index++) { if (pPackageInfo[index].Name) free(pPackageInfo[index].Name); if (pPackageInfo[index].Comment) free(pPackageInfo[index].Comment); } free(pPackageInfo); } ",0 "static int sd_getgeo(struct block_device *bdev, struct hd_geometry *geo) { struct scsi_disk *sdkp = scsi_disk(bdev->bd_disk); struct scsi_device *sdp = sdkp->device; struct Scsi_Host *host = sdp->host; int diskinfo[4]; /* default to most commonly used values */ diskinfo[0] = 0x40; /* 1 << 6 */ diskinfo[1] = 0x20; /* 1 << 5 */ diskinfo[2] = sdkp->capacity >> 11; /* override with calculated, extended default, or driver values */ if (host->hostt->bios_param) host->hostt->bios_param(sdp, bdev, sdkp->capacity, diskinfo); else scsicam_bios_param(bdev, sdkp->capacity, diskinfo); geo->heads = diskinfo[0]; geo->sectors = diskinfo[1]; geo->cylinders = diskinfo[2]; return 0; } ",0 "static void mcf_fec_read_bd(mcf_fec_bd *bd, uint32_t addr) { cpu_physical_memory_read(addr, bd, sizeof(*bd)); be16_to_cpus(&bd->flags); be16_to_cpus(&bd->length); be32_to_cpus(&bd->data); } ",0 " virtual void SetUp() { client_.Start(kClientId, kClientInfo, kState, InvalidationVersionMap(), MakeWeakHandle(mock_invalidation_state_tracker_.AsWeakPtr()), &mock_listener_); } ",1 "void RenderFrameImpl::DidCommitCompositorFrame() { if (BrowserPluginManager::Get()) BrowserPluginManager::Get()->DidCommitCompositorFrame(GetRoutingID()); FOR_EACH_OBSERVER( RenderFrameObserver, observers_, DidCommitCompositorFrame()); } ",0 "void AudioNode::disconnect(AudioParam* destination_param, unsigned output_index, ExceptionState& exception_state) { DCHECK(IsMainThread()); BaseAudioContext::GraphAutoLocker locker(context()); if (output_index >= Handler().NumberOfOutputs()) { exception_state.ThrowDOMException( kIndexSizeError, ExceptionMessages::IndexOutsideRange( ""output index"", output_index, 0u, ExceptionMessages::kInclusiveBound, numberOfOutputs() - 1, ExceptionMessages::kInclusiveBound)); return; } if (!DisconnectFromOutputIfConnected(output_index, *destination_param)) { exception_state.ThrowDOMException( kInvalidAccessError, ""specified destination AudioParam and node output ("" + String::Number(output_index) + "") are not connected.""); return; } } ",0 "u32 __cookie_v6_init_sequence(const struct ipv6hdr *iph, const struct tcphdr *th, __u16 *mssp) { int mssind; const __u16 mss = *mssp; for (mssind = ARRAY_SIZE(msstab) - 1; mssind ; mssind--) if (mss >= msstab[mssind]) break; *mssp = msstab[mssind]; return secure_tcp_syn_cookie(&iph->saddr, &iph->daddr, th->source, th->dest, ntohl(th->seq), mssind); } ",0 "int EC_GROUP_get_pentanomial_basis(const EC_GROUP *group, unsigned int *k1, unsigned int *k2, unsigned int *k3) { if (group == NULL) return 0; if (EC_GROUP_method_of(group)->group_set_curve != ec_GF2m_simple_group_set_curve || !((group->poly[0] != 0) && (group->poly[1] != 0) && (group->poly[2] != 0) && (group->poly[3] != 0) && (group->poly[4] == 0))) { ECerr(EC_F_EC_GROUP_GET_PENTANOMIAL_BASIS, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED); return 0; } if (k1) *k1 = group->poly[3]; if (k2) *k2 = group->poly[2]; if (k3) *k3 = group->poly[1]; return 1; } ",0 "static void sock_warn_obsolete_bsdism(const char *name) { static int warned; static char warncomm[TASK_COMM_LEN]; if (strcmp(warncomm, current->comm) && warned < 5) { strcpy(warncomm, current->comm); pr_warn(""process `%s' is using obsolete %s SO_BSDCOMPAT\n"", warncomm, name); warned++; } } ",0 "dissect_spoolss_buffer_data(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep) { BUFFER *b = (BUFFER *)di->private_data; proto_item *item; guint32 size; const guint8 *data; if (di->conformant_run) return offset; /* Dissect size and data */ offset = dissect_ndr_uint32(tvb, offset, pinfo, tree, di, drep, hf_buffer_size, &size); offset = dissect_ndr_uint8s(tvb, offset, pinfo, NULL, di, drep, hf_buffer_data, size, &data); item = proto_tree_add_item( tree, hf_buffer_data, tvb, offset - size, size, ENC_NA); /* Return buffer info */ if (b) { /* I'm not sure about this. Putting the buffer into its own tvb makes sense and the dissection code is much clearer, but the data is a proper subset of the actual tvb. Not adding the new data source makes the hex display confusing as it switches between the 'DCERPC over SMB' tvb and the buffer tvb with no visual cues as to what is going on. */ b->tvb = tvb_new_child_real_data(tvb, data, size, size); add_new_data_source(pinfo, b->tvb, ""SPOOLSS buffer""); b->item = item; b->tree = proto_item_add_subtree(item, ett_BUFFER); } return offset; } ",0 "static int labdomain(i_ctx_t * i_ctx_p, ref *space, float *ptr) { int i, code; ref CIEdict, *tempref, valref; code = array_get(imemory, space, 1, &CIEdict); if (code < 0) return code; /* If we have a Range, get the values from that */ code = dict_find_string(&CIEdict, ""Range"", &tempref); if (code > 0 && !r_has_type(tempref, t_null)) { for (i=0;i<4;i++) { code = array_get(imemory, tempref, i, &valref); if (code < 0) return code; if (r_has_type(&valref, t_integer)) ptr[i] = (float)valref.value.intval; else if (r_has_type(&valref, t_real)) ptr[i] = (float)valref.value.realval; else return_error(gs_error_typecheck); } } else { /* Default values for Lab */ for (i=0;i<2;i++) { ptr[2 * i] = -100; ptr[(2 * i) + 1] = 100; } } return 0; } ",0 "static int asepcos_get_current_df_path(sc_card_t *card, sc_path_t *path) { int r; sc_apdu_t apdu; u8 rbuf[SC_MAX_APDU_BUFFER_SIZE]; sc_format_apdu(card, &apdu, SC_APDU_CASE_2_SHORT, 0xca, 0x01, 0x83); apdu.resp = rbuf; apdu.resplen = sizeof(rbuf); apdu.le = 256; r = sc_transmit_apdu(card, &apdu); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""APDU transmit failed""); if (apdu.sw1 != 0x90 || apdu.sw2 != 0x00) return sc_check_sw(card, apdu.sw1, apdu.sw2); return asepcos_tlvpath_to_scpath(path, apdu.resp, apdu.resplen); } ",0 "ResourcePtr ResourceFetcher::fetchImage(FetchRequest& request) { if (LocalFrame* f = frame()) { if (f->document()->pageDismissalEventBeingDispatched() != Document::NoDismissal) { KURL requestURL = request.resourceRequest().url(); if (requestURL.isValid() && canRequest(Resource::Image, requestURL, request.options(), request.forPreload(), request.originRestriction())) PingLoader::loadImage(f, requestURL); return 0; } } if (request.resourceRequest().url().protocolIsData()) preCacheDataURIImage(request); request.setDefer(clientDefersImage(request.resourceRequest().url()) ? FetchRequest::DeferredByClient : FetchRequest::NoDefer); return toImageResource(requestResource(Resource::Image, request)); } ",0 "void RenderWidgetHostImpl::ParentChanged(gfx::NativeViewId new_parent) { #if defined(OS_WIN) HWND hwnd = reinterpret_cast(new_parent); if (!hwnd) hwnd = WebPluginDelegateImpl::GetDefaultWindowParent(); for (std::list::iterator i = dummy_windows_for_activation_.begin(); i != dummy_windows_for_activation_.end(); ++i) { SetParent(*i, hwnd); } #endif } ",0 "void Pack(const uint8_t* source, uint16_t* destination, unsigned pixels_per_row) { for (unsigned i = 0; i < pixels_per_row; ++i) { float scale_factor = source[3] / 255.0f; uint8_t source_r = static_cast(static_cast(source[0]) * scale_factor); uint8_t source_g = static_cast(static_cast(source[1]) * scale_factor); uint8_t source_b = static_cast(static_cast(source[2]) * scale_factor); *destination = (((source_r & 0xF8) << 8) | ((source_g & 0xFC) << 3) | ((source_b & 0xF8) >> 3)); source += 4; destination += 1; } } ",0 "error::Error GLES2DecoderPassthroughImpl::DoIsBuffer(GLuint buffer, uint32_t* result) { *result = api()->glIsBufferFn(GetBufferServiceID(api(), buffer, resources_, false)); return error::kNoError; } ",0 "vldb_reply_print(netdissect_options *ndo, register const u_char *bp, int length, int32_t opcode) { const struct rx_header *rxh; unsigned long i; if (length < (int)sizeof(struct rx_header)) return; rxh = (const struct rx_header *) bp; /* * Print out the afs call we're invoking. The table used here was * gleaned from vlserver/vldbint.xg. Check to see if it's a * Ubik call, however. */ ND_PRINT((ndo, "" vldb"")); if (is_ubik(opcode)) { ubik_reply_print(ndo, bp, length, opcode); return; } ND_PRINT((ndo, "" reply %s"", tok2str(vldb_req, ""op#%d"", opcode))); bp += sizeof(struct rx_header); /* * If it was a data packet, interpret the response */ if (rxh->type == RX_PACKET_TYPE_DATA) switch (opcode) { case 510: /* List entry */ ND_PRINT((ndo, "" count"")); INTOUT(); ND_PRINT((ndo, "" nextindex"")); INTOUT(); case 503: /* Get entry by id */ case 504: /* Get entry by name */ { unsigned long nservers, j; VECOUT(VLNAMEMAX); ND_TCHECK2(bp[0], sizeof(int32_t)); bp += sizeof(int32_t); ND_PRINT((ndo, "" numservers"")); ND_TCHECK2(bp[0], sizeof(int32_t)); nservers = EXTRACT_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, "" %lu"", nservers)); ND_PRINT((ndo, "" servers"")); for (i = 0; i < 8; i++) { ND_TCHECK2(bp[0], sizeof(int32_t)); if (i < nservers) ND_PRINT((ndo, "" %s"", intoa(((const struct in_addr *) bp)->s_addr))); bp += sizeof(int32_t); } ND_PRINT((ndo, "" partitions"")); for (i = 0; i < 8; i++) { ND_TCHECK2(bp[0], sizeof(int32_t)); j = EXTRACT_32BITS(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, "" %c"", 'a' + (int)j)); else if (i < nservers) ND_PRINT((ndo, "" %lu"", j)); bp += sizeof(int32_t); } ND_TCHECK2(bp[0], 8 * sizeof(int32_t)); bp += 8 * sizeof(int32_t); ND_PRINT((ndo, "" rwvol"")); UINTOUT(); ND_PRINT((ndo, "" rovol"")); UINTOUT(); ND_PRINT((ndo, "" backup"")); UINTOUT(); } break; case 505: /* Get new volume ID */ ND_PRINT((ndo, "" newvol"")); UINTOUT(); break; case 521: /* List entry */ case 529: /* List entry U */ ND_PRINT((ndo, "" count"")); INTOUT(); ND_PRINT((ndo, "" nextindex"")); INTOUT(); case 518: /* Get entry by ID N */ case 519: /* Get entry by name N */ { unsigned long nservers, j; VECOUT(VLNAMEMAX); ND_PRINT((ndo, "" numservers"")); ND_TCHECK2(bp[0], sizeof(int32_t)); nservers = EXTRACT_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, "" %lu"", nservers)); ND_PRINT((ndo, "" servers"")); for (i = 0; i < 13; i++) { ND_TCHECK2(bp[0], sizeof(int32_t)); if (i < nservers) ND_PRINT((ndo, "" %s"", intoa(((const struct in_addr *) bp)->s_addr))); bp += sizeof(int32_t); } ND_PRINT((ndo, "" partitions"")); for (i = 0; i < 13; i++) { ND_TCHECK2(bp[0], sizeof(int32_t)); j = EXTRACT_32BITS(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, "" %c"", 'a' + (int)j)); else if (i < nservers) ND_PRINT((ndo, "" %lu"", j)); bp += sizeof(int32_t); } ND_TCHECK2(bp[0], 13 * sizeof(int32_t)); bp += 13 * sizeof(int32_t); ND_PRINT((ndo, "" rwvol"")); UINTOUT(); ND_PRINT((ndo, "" rovol"")); UINTOUT(); ND_PRINT((ndo, "" backup"")); UINTOUT(); } break; case 526: /* Get entry by ID U */ case 527: /* Get entry by name U */ { unsigned long nservers, j; VECOUT(VLNAMEMAX); ND_PRINT((ndo, "" numservers"")); ND_TCHECK2(bp[0], sizeof(int32_t)); nservers = EXTRACT_32BITS(bp); bp += sizeof(int32_t); ND_PRINT((ndo, "" %lu"", nservers)); ND_PRINT((ndo, "" servers"")); for (i = 0; i < 13; i++) { if (i < nservers) { ND_PRINT((ndo, "" afsuuid"")); AFSUUIDOUT(); } else { ND_TCHECK2(bp[0], 44); bp += 44; } } ND_TCHECK2(bp[0], 4 * 13); bp += 4 * 13; ND_PRINT((ndo, "" partitions"")); for (i = 0; i < 13; i++) { ND_TCHECK2(bp[0], sizeof(int32_t)); j = EXTRACT_32BITS(bp); if (i < nservers && j <= 26) ND_PRINT((ndo, "" %c"", 'a' + (int)j)); else if (i < nservers) ND_PRINT((ndo, "" %lu"", j)); bp += sizeof(int32_t); } ND_TCHECK2(bp[0], 13 * sizeof(int32_t)); bp += 13 * sizeof(int32_t); ND_PRINT((ndo, "" rwvol"")); UINTOUT(); ND_PRINT((ndo, "" rovol"")); UINTOUT(); ND_PRINT((ndo, "" backup"")); UINTOUT(); } default: ; } else { /* * Otherwise, just print out the return code */ ND_PRINT((ndo, "" errcode"")); INTOUT(); } return; trunc: ND_PRINT((ndo, "" [|vldb]"")); } ",0 "static inline bool pageIsBeingDismissed(Document* document) { Frame* frame = document->frame(); return frame && frame->loader()->pageDismissalEventBeingDispatched() != FrameLoader::NoDismissal; } ",0 "get_reserved_cluster_alloc(struct inode *inode, ext4_lblk_t lblk_start, unsigned int num_blks) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); ext4_lblk_t alloc_cluster_start, alloc_cluster_end; ext4_lblk_t lblk_from, lblk_to, c_offset; unsigned int allocated_clusters = 0; alloc_cluster_start = EXT4_B2C(sbi, lblk_start); alloc_cluster_end = EXT4_B2C(sbi, lblk_start + num_blks - 1); /* max possible clusters for this allocation */ allocated_clusters = alloc_cluster_end - alloc_cluster_start + 1; trace_ext4_get_reserved_cluster_alloc(inode, lblk_start, num_blks); /* Check towards left side */ c_offset = EXT4_LBLK_COFF(sbi, lblk_start); if (c_offset) { lblk_from = EXT4_LBLK_CMASK(sbi, lblk_start); lblk_to = lblk_from + c_offset - 1; if (ext4_find_delalloc_range(inode, lblk_from, lblk_to)) allocated_clusters--; } /* Now check towards right. */ c_offset = EXT4_LBLK_COFF(sbi, lblk_start + num_blks); if (allocated_clusters && c_offset) { lblk_from = lblk_start + num_blks; lblk_to = lblk_from + (sbi->s_cluster_ratio - c_offset) - 1; if (ext4_find_delalloc_range(inode, lblk_from, lblk_to)) allocated_clusters--; } return allocated_clusters; } ",0 "WebFrame* WebFrame::traverseNext(bool wrap) const { if (Frame* frame = toImplBase()->frame()) return fromFrame(frame->tree().traverseNextWithWrap(wrap)); return 0; } ",0 " BluetoothSocketListenUsingL2capFunction() {} ",0 "int FS_Read2( void *buffer, int len, fileHandle_t f ) { if ( !fs_searchpaths ) { Com_Error( ERR_FATAL, ""Filesystem call made without initialization"" ); } if ( !f ) { return 0; } if (fsh[f].streamed) { int r; fsh[f].streamed = qfalse; r = FS_Read( buffer, len, f ); fsh[f].streamed = qtrue; return r; } else { return FS_Read( buffer, len, f); } } ",0 "static void ring_buffer_attach(struct perf_event *event, struct ring_buffer *rb) { struct ring_buffer *old_rb = NULL; unsigned long flags; if (event->rb) { /* * Should be impossible, we set this when removing * event->rb_entry and wait/clear when adding event->rb_entry. */ WARN_ON_ONCE(event->rcu_pending); old_rb = event->rb; spin_lock_irqsave(&old_rb->event_lock, flags); list_del_rcu(&event->rb_entry); spin_unlock_irqrestore(&old_rb->event_lock, flags); event->rcu_batches = get_state_synchronize_rcu(); event->rcu_pending = 1; } if (rb) { if (event->rcu_pending) { cond_synchronize_rcu(event->rcu_batches); event->rcu_pending = 0; } spin_lock_irqsave(&rb->event_lock, flags); list_add_rcu(&event->rb_entry, &rb->event_list); spin_unlock_irqrestore(&rb->event_lock, flags); } /* * Avoid racing with perf_mmap_close(AUX): stop the event * before swizzling the event::rb pointer; if it's getting * unmapped, its aux_mmap_count will be 0 and it won't * restart. See the comment in __perf_pmu_output_stop(). * * Data will inevitably be lost when set_output is done in * mid-air, but then again, whoever does it like this is * not in for the data anyway. */ if (has_aux(event)) perf_event_stop(event, 0); rcu_assign_pointer(event->rb, rb); if (old_rb) { ring_buffer_put(old_rb); /* * Since we detached before setting the new rb, so that we * could attach the new rb, we could have missed a wakeup. * Provide it now. */ wake_up_all(&event->waitq); } } ",0 " void LogClientServiceForInfo( T* /* info */, GLuint /* client_id */, const char* /* function_name */) { } ",0 "status_t OMXCodec::start(MetaData *meta) { Mutex::Autolock autoLock(mLock); if (mState != LOADED) { CODEC_LOGE(""called start in the unexpected state: %d"", mState); return UNKNOWN_ERROR; } sp params = new MetaData; if (mQuirks & kWantsNALFragments) { params->setInt32(kKeyWantsNALFragments, true); } if (meta) { int64_t startTimeUs = 0; int64_t timeUs; if (meta->findInt64(kKeyTime, &timeUs)) { startTimeUs = timeUs; } params->setInt64(kKeyTime, startTimeUs); } mCodecSpecificDataIndex = 0; mInitialBufferSubmit = true; mSignalledEOS = false; mNoMoreOutputData = false; mOutputPortSettingsHaveChanged = false; mSeekTimeUs = -1; mSeekMode = ReadOptions::SEEK_CLOSEST_SYNC; mTargetTimeUs = -1; mFilledBuffers.clear(); mPaused = false; status_t err; if (mIsEncoder) { if ((err = init()) != OK) { CODEC_LOGE(""init failed: %d"", err); return err; } params->setInt32(kKeyNumBuffers, mPortBuffers[kPortIndexInput].size()); err = mSource->start(params.get()); if (err != OK) { CODEC_LOGE(""source failed to start: %d"", err); stopOmxComponent_l(); } return err; } if ((err = mSource->start(params.get())) != OK) { CODEC_LOGE(""source failed to start: %d"", err); return err; } return init(); } ",0 "GfxPath::GfxPath() { justMoved = gFalse; size = 16; n = 0; firstX = firstY = 0; subpaths = (GfxSubpath **)gmallocn(size, sizeof(GfxSubpath *)); } ",0 "void GDataFileSystem::RequestDirectoryRefreshOnUIThread( const FilePath& file_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); directory_service_->GetEntryInfoByPath( file_path, base::Bind( &GDataFileSystem::RequestDirectoryRefreshOnUIThreadAfterGetEntryInfo, ui_weak_ptr_, file_path)); } ",0 "int PKCS7_dataFinal(PKCS7 *p7, BIO *bio) { int ret = 0; int i, j; BIO *btmp; PKCS7_SIGNER_INFO *si; EVP_MD_CTX *mdc, ctx_tmp; STACK_OF(X509_ATTRIBUTE) *sk; STACK_OF(PKCS7_SIGNER_INFO) *si_sk = NULL; ASN1_OCTET_STRING *os = NULL; if (p7 == NULL) { PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_INVALID_NULL_POINTER); return 0; } if (p7->d.ptr == NULL) { PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_NO_CONTENT); return 0; } EVP_MD_CTX_init(&ctx_tmp); i = OBJ_obj2nid(p7->type); p7->state = PKCS7_S_HEADER; switch (i) { case NID_pkcs7_data: os = p7->d.data; break; case NID_pkcs7_signedAndEnveloped: /* XXXXXXXXXXXXXXXX */ si_sk = p7->d.signed_and_enveloped->signer_info; os = p7->d.signed_and_enveloped->enc_data->enc_data; if (!os) { os = ASN1_OCTET_STRING_new(); if (!os) { PKCS7err(PKCS7_F_PKCS7_DATAFINAL, ERR_R_MALLOC_FAILURE); goto err; } p7->d.signed_and_enveloped->enc_data->enc_data = os; } break; case NID_pkcs7_enveloped: /* XXXXXXXXXXXXXXXX */ os = p7->d.enveloped->enc_data->enc_data; if (!os) { os = ASN1_OCTET_STRING_new(); if (!os) { PKCS7err(PKCS7_F_PKCS7_DATAFINAL, ERR_R_MALLOC_FAILURE); goto err; } p7->d.enveloped->enc_data->enc_data = os; } break; case NID_pkcs7_signed: si_sk = p7->d.sign->signer_info; os = PKCS7_get_octet_string(p7->d.sign->contents); /* If detached data then the content is excluded */ if (PKCS7_type_is_data(p7->d.sign->contents) && p7->detached) { ASN1_OCTET_STRING_free(os); os = NULL; p7->d.sign->contents->d.data = NULL; } break; case NID_pkcs7_digest: os = PKCS7_get_octet_string(p7->d.digest->contents); /* If detached data then the content is excluded */ if (PKCS7_type_is_data(p7->d.digest->contents) && p7->detached) { ASN1_OCTET_STRING_free(os); os = NULL; p7->d.digest->contents->d.data = NULL; } break; default: PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNSUPPORTED_CONTENT_TYPE); goto err; } if (si_sk != NULL) { for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(si_sk); i++) { si = sk_PKCS7_SIGNER_INFO_value(si_sk, i); if (si->pkey == NULL) continue; j = OBJ_obj2nid(si->digest_alg->algorithm); btmp = bio; btmp = PKCS7_find_digest(&mdc, btmp, j); if (btmp == NULL) goto err; /* * We now have the EVP_MD_CTX, lets do the signing. */ if (!EVP_MD_CTX_copy_ex(&ctx_tmp, mdc)) goto err; sk = si->auth_attr; /* * If there are attributes, we add the digest attribute and only * sign the attributes */ if (sk_X509_ATTRIBUTE_num(sk) > 0) { if (!do_pkcs7_signed_attrib(si, &ctx_tmp)) goto err; } else { unsigned char *abuf = NULL; unsigned int abuflen; abuflen = EVP_PKEY_size(si->pkey); abuf = OPENSSL_malloc(abuflen); if (!abuf) goto err; if (!EVP_SignFinal(&ctx_tmp, abuf, &abuflen, si->pkey)) { PKCS7err(PKCS7_F_PKCS7_DATAFINAL, ERR_R_EVP_LIB); goto err; } ASN1_STRING_set0(si->enc_digest, abuf, abuflen); } } } else if (i == NID_pkcs7_digest) { unsigned char md_data[EVP_MAX_MD_SIZE]; unsigned int md_len; if (!PKCS7_find_digest(&mdc, bio, OBJ_obj2nid(p7->d.digest->md->algorithm))) goto err; if (!EVP_DigestFinal_ex(mdc, md_data, &md_len)) goto err; ASN1_OCTET_STRING_set(p7->d.digest->digest, md_data, md_len); } if (!PKCS7_is_detached(p7)) { /* * NOTE(emilia): I think we only reach os == NULL here because detached * digested data support is broken. */ if (os == NULL) goto err; if (!(os->flags & ASN1_STRING_FLAG_NDEF)) { char *cont; long contlen; btmp = BIO_find_type(bio, BIO_TYPE_MEM); if (btmp == NULL) { PKCS7err(PKCS7_F_PKCS7_DATAFINAL, PKCS7_R_UNABLE_TO_FIND_MEM_BIO); goto err; } contlen = BIO_get_mem_data(btmp, &cont); /* * Mark the BIO read only then we can use its copy of the data * instead of making an extra copy. */ BIO_set_flags(btmp, BIO_FLAGS_MEM_RDONLY); BIO_set_mem_eof_return(btmp, 0); ASN1_STRING_set0(os, (unsigned char *)cont, contlen); } } ret = 1; err: EVP_MD_CTX_cleanup(&ctx_tmp); return (ret); } ",0 "static int br_mdb_copy(struct net_bridge_mdb_htable *new, struct net_bridge_mdb_htable *old, int elasticity) { struct net_bridge_mdb_entry *mp; int maxlen; int len; int i; for (i = 0; i < old->max; i++) hlist_for_each_entry(mp, &old->mhash[i], hlist[old->ver]) hlist_add_head(&mp->hlist[new->ver], &new->mhash[br_ip_hash(new, &mp->addr)]); if (!elasticity) return 0; maxlen = 0; for (i = 0; i < new->max; i++) { len = 0; hlist_for_each_entry(mp, &new->mhash[i], hlist[new->ver]) len++; if (len > maxlen) maxlen = len; } return maxlen > elasticity ? -EINVAL : 0; } ",0 "static inline struct sk_buff *hci_uart_dequeue(struct hci_uart *hu) { struct sk_buff *skb = hu->tx_skb; if (!skb) { percpu_down_read(&hu->proto_lock); if (test_bit(HCI_UART_PROTO_READY, &hu->flags)) skb = hu->proto->dequeue(hu); percpu_up_read(&hu->proto_lock); } else { hu->tx_skb = NULL; } return skb; } ",0 "pdf_process_end(fz_context *ctx, pdf_processor *proc, pdf_csi *csi) { while (csi->gstate > 0) pdf_process_grestore(ctx, proc, csi); if (proc->op_END) proc->op_END(ctx, proc); } ",0 "void mp_encode_lua_table_as_array(lua_State *L, mp_buf *buf, int level) { #if LUA_VERSION_NUM < 502 size_t len = lua_objlen(L,-1), j; #else size_t len = lua_rawlen(L,-1), j; #endif mp_encode_array(L,buf,len); for (j = 1; j <= len; j++) { lua_pushnumber(L,j); lua_gettable(L,-2); mp_encode_lua_type(L,buf,level+1); } } ",0 "static inline bool tcp_ack_is_dubious(const struct sock *sk, const int flag) { return !(flag & FLAG_NOT_DUP) || (flag & FLAG_CA_ALERT) || inet_csk(sk)->icsk_ca_state != TCP_CA_Open; } ",0 "IntSize WebPagePrivate::absoluteVisibleOverflowSize() const { if (!m_mainFrame->contentRenderer()) return IntSize(); return IntSize(m_mainFrame->contentRenderer()->rightAbsoluteVisibleOverflow(), m_mainFrame->contentRenderer()->bottomAbsoluteVisibleOverflow()); } ",0 "PassOwnPtr CCLayerTreeHost::createLayerTreeHostImpl() { return CCLayerTreeHostImpl::create(m_settings); } ",0 "void AppendFormattedComponent(const std::string& spec, const url_parse::Component& in_component, UnescapeRule::Type unescape_rules, std::wstring* output, url_parse::Component* out_component, size_t* offset_for_adjustment) { DCHECK(output); DCHECK(offset_for_adjustment); if (in_component.is_nonempty()) { out_component->begin = static_cast(output->length()); size_t offset_past_current_output = ((*offset_for_adjustment == std::wstring::npos) || (*offset_for_adjustment < output->length())) ? std::wstring::npos : (*offset_for_adjustment - output->length()); size_t* offset_into_component = (offset_past_current_output >= static_cast(in_component.len)) ? NULL : &offset_past_current_output; if (unescape_rules == UnescapeRule::NONE) { output->append(UTF8ToWideAndAdjustOffset( spec.substr(in_component.begin, in_component.len), offset_into_component)); } else { output->append(UTF16ToWideHack(UnescapeAndDecodeUTF8URLComponent( spec.substr(in_component.begin, in_component.len), unescape_rules, offset_into_component))); } out_component->len = static_cast(output->length()) - out_component->begin; if (offset_into_component) { *offset_for_adjustment = (*offset_into_component == std::wstring::npos) ? std::wstring::npos : (out_component->begin + *offset_into_component); } else if (offset_past_current_output != std::wstring::npos) { *offset_for_adjustment += out_component->len - in_component.len; } } else { out_component->reset(); } } ",0 "bool InjectedBundlePage::supportsFullScreen(WKBundlePageRef pageRef, WKFullScreenKeyboardRequestType requestType) { if (InjectedBundle::shared().testRunner()->shouldDumpFullScreenCallbacks()) InjectedBundle::shared().outputText(""supportsFullScreen() == true\n""); return true; } ",0 "bool PermissionsBubbleDialogDelegateView::ShouldShowCloseButton() const { return true; } ",0 " void AddKeyboardControllerBinding(mojo::ScopedMessagePipeHandle handle) { ash::Shell::Get()->ash_keyboard_controller()->BindRequest( ash::mojom::KeyboardControllerRequest(std::move(handle))); } ",0 " FT_Stream_New( FT_Library library, const FT_Open_Args* args, FT_Stream *astream ) { FT_Error error; FT_Memory memory; FT_Stream stream; *astream = 0; if ( !library ) return FT_Err_Invalid_Library_Handle; if ( !args ) return FT_Err_Invalid_Argument; memory = library->memory; if ( FT_NEW( stream ) ) goto Exit; stream->memory = memory; if ( args->flags & FT_OPEN_MEMORY ) { /* create a memory-based stream */ FT_Stream_OpenMemory( stream, (const FT_Byte*)args->memory_base, args->memory_size ); } else if ( args->flags & FT_OPEN_PATHNAME ) { /* create a normal system stream */ error = FT_Stream_Open( stream, args->pathname ); stream->pathname.pointer = args->pathname; } else if ( ( args->flags & FT_OPEN_STREAM ) && args->stream ) { /* use an existing, user-provided stream */ /* in this case, we do not need to allocate a new stream object */ /* since the caller is responsible for closing it himself */ FT_FREE( stream ); stream = args->stream; } else error = FT_Err_Invalid_Argument; if ( error ) FT_FREE( stream ); else stream->memory = memory; /* just to be certain */ *astream = stream; Exit: return error; } ",0 "int ignore_signals(int sig, ...) { struct sigaction sa; va_list ap; int r = 0; zero(sa); sa.sa_handler = SIG_IGN; sa.sa_flags = SA_RESTART; if (sigaction(sig, &sa, NULL) < 0) r = -errno; va_start(ap, sig); while ((sig = va_arg(ap, int)) > 0) if (sigaction(sig, &sa, NULL) < 0) r = -errno; va_end(ap); return r; } ",0 "static void reflectedCustomStringAttrAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; TestObjectV8Internal::reflectedCustomStringAttrAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "xmlParseSystemLiteral(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; int cur, l; xmlChar stop; int state = ctxt->instate; int count = 0; SHRINK; if (RAW == '""') { NEXT; stop = '""'; } else if (RAW == '\'') { NEXT; stop = '\''; } else { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_STARTED, NULL); return(NULL); } buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } ctxt->instate = XML_PARSER_SYSTEM_LITERAL; cur = CUR_CHAR(l); while ((IS_CHAR(cur)) && (cur != stop)) { /* checked */ if (len + 5 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlFree(buf); xmlErrMemory(ctxt, NULL); ctxt->instate = (xmlParserInputState) state; return(NULL); } buf = tmp; } count++; if (count > 50) { GROW; count = 0; } COPY_BUF(l,buf,len,cur); NEXTL(l); cur = CUR_CHAR(l); if (cur == 0) { GROW; SHRINK; cur = CUR_CHAR(l); } } buf[len] = 0; ctxt->instate = (xmlParserInputState) state; if (!IS_CHAR(cur)) { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); } else { NEXT; } return(buf); } ",1 "void BrowserChildProcessHostImpl::Launch( std::unique_ptr delegate, std::unique_ptr cmd_line, bool terminate_on_shutdown) { DCHECK_CURRENTLY_ON(BrowserThread::IO); GetContentClient()->browser()->AppendExtraCommandLineSwitches(cmd_line.get(), data_.id); const base::CommandLine& browser_command_line = *base::CommandLine::ForCurrentProcess(); static const char* const kForwardSwitches[] = { service_manager::switches::kDisableInProcessStackTraces, switches::kDisableLogging, switches::kEnableLogging, switches::kIPCConnectionTimeout, switches::kLoggingLevel, switches::kTraceToConsole, switches::kV, switches::kVModule, }; cmd_line->CopySwitchesFrom(browser_command_line, kForwardSwitches, arraysize(kForwardSwitches)); if (child_connection_) { cmd_line->AppendSwitchASCII(switches::kServiceRequestChannelToken, child_connection_->service_token()); } DCHECK(broker_client_invitation_); notify_child_disconnected_ = true; child_process_.reset(new ChildProcessLauncher( std::move(delegate), std::move(cmd_line), data_.id, this, std::move(broker_client_invitation_), base::Bind(&BrowserChildProcessHostImpl::OnMojoError, weak_factory_.GetWeakPtr(), base::ThreadTaskRunnerHandle::Get()), terminate_on_shutdown)); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoPostSubBufferCHROMIUM( uint64_t swap_id, GLint x, GLint y, GLint width, GLint height, GLbitfield flags) { if (!surface_->SupportsPostSubBuffer()) { InsertError(GL_INVALID_OPERATION, ""glPostSubBufferCHROMIUM is not supported for this surface.""); return error::kNoError; } client()->OnSwapBuffers(swap_id, flags); return CheckSwapBuffersResult( surface_->PostSubBuffer(x, y, width, height, base::DoNothing()), ""PostSubBuffer""); } ",0 "void RenderViewImpl::didStartProvisionalLoad(WebFrame* frame) { WebDataSource* ds = frame->provisionalDataSource(); DocumentState* document_state = DocumentState::FromDataSource(ds); if (document_state->request_time().is_null()) { double event_time = ds->triggeringEventTime(); if (event_time != 0.0) document_state->set_request_time(Time::FromDoubleT(event_time)); } document_state->set_start_load_time(Time::Now()); bool is_top_most = !frame->parent(); if (is_top_most) { navigation_gesture_ = frame->isProcessingUserGesture() ? NavigationGestureUser : NavigationGestureAuto; completed_client_redirect_src_ = Referrer(); } else if (frame->parent()->isLoading()) { document_state->navigation_state()->set_transition_type( content::PAGE_TRANSITION_AUTO_SUBFRAME); } FOR_EACH_OBSERVER( RenderViewObserver, observers_, DidStartProvisionalLoad(frame)); Send(new ViewHostMsg_DidStartProvisionalLoadForFrame( routing_id_, frame->identifier(), is_top_most, GetOpenerUrl(), ds->request().url())); } ",0 "void ExtensionService::GrantPermissions(const Extension* extension) { CHECK(extension); if (extension->CanSilentlyIncreasePermissions()) return; extension_prefs_->AddGrantedPermissions(extension->id(), extension->GetActivePermissions()); } ",0 "static void php_wddx_serialize_object(wddx_packet *packet, zval *obj) { /* OBJECTS_FIXME */ zval **ent, *fname, **varname; zval *retval = NULL; const char *key; ulong idx; char tmp_buf[WDDX_BUF_LEN]; HashTable *objhash, *sleephash; TSRMLS_FETCH(); MAKE_STD_ZVAL(fname); ZVAL_STRING(fname, ""__sleep"", 1); /* * We try to call __sleep() method on object. It's supposed to return an * array of property names to be serialized. */ if (call_user_function_ex(CG(function_table), &obj, fname, &retval, 0, 0, 1, NULL TSRMLS_CC) == SUCCESS) { if (retval && (sleephash = HASH_OF(retval))) { PHP_CLASS_ATTRIBUTES; PHP_SET_CLASS_ATTRIBUTES(obj); php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR); php_wddx_add_chunk(packet, tmp_buf); php_wddx_add_chunk_static(packet, WDDX_STRING_S); php_wddx_add_chunk_ex(packet, class_name, name_len); php_wddx_add_chunk_static(packet, WDDX_STRING_E); php_wddx_add_chunk_static(packet, WDDX_VAR_E); PHP_CLEANUP_CLASS_ATTRIBUTES(); objhash = HASH_OF(obj); for (zend_hash_internal_pointer_reset(sleephash); zend_hash_get_current_data(sleephash, (void **)&varname) == SUCCESS; zend_hash_move_forward(sleephash)) { if (Z_TYPE_PP(varname) != IS_STRING) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""__sleep should return an array only containing the names of instance-variables to serialize.""); continue; } if (zend_hash_find(objhash, Z_STRVAL_PP(varname), Z_STRLEN_PP(varname)+1, (void **)&ent) == SUCCESS) { php_wddx_serialize_var(packet, *ent, Z_STRVAL_PP(varname), Z_STRLEN_PP(varname) TSRMLS_CC); } } php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); } } else { uint key_len; PHP_CLASS_ATTRIBUTES; PHP_SET_CLASS_ATTRIBUTES(obj); php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); snprintf(tmp_buf, WDDX_BUF_LEN, WDDX_VAR_S, PHP_CLASS_NAME_VAR); php_wddx_add_chunk(packet, tmp_buf); php_wddx_add_chunk_static(packet, WDDX_STRING_S); php_wddx_add_chunk_ex(packet, class_name, name_len); php_wddx_add_chunk_static(packet, WDDX_STRING_E); php_wddx_add_chunk_static(packet, WDDX_VAR_E); PHP_CLEANUP_CLASS_ATTRIBUTES(); objhash = HASH_OF(obj); for (zend_hash_internal_pointer_reset(objhash); zend_hash_get_current_data(objhash, (void**)&ent) == SUCCESS; zend_hash_move_forward(objhash)) { if (*ent == obj) { continue; } if (zend_hash_get_current_key_ex(objhash, &key, &key_len, &idx, 0, NULL) == HASH_KEY_IS_STRING) { const char *class_name, *prop_name; zend_unmangle_property_name(key, key_len-1, &class_name, &prop_name); php_wddx_serialize_var(packet, *ent, prop_name, strlen(prop_name)+1 TSRMLS_CC); } else { key_len = slprintf(tmp_buf, sizeof(tmp_buf), ""%ld"", idx); php_wddx_serialize_var(packet, *ent, tmp_buf, key_len TSRMLS_CC); } } php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); } zval_dtor(fname); FREE_ZVAL(fname); if (retval) { zval_ptr_dtor(&retval); } } ",0 "PrintPreviewMessageHandler::~PrintPreviewMessageHandler() { } ",0 "static void free_async(struct async *as) { int i; put_pid(as->pid); if (as->cred) put_cred(as->cred); for (i = 0; i < as->urb->num_sgs; i++) { if (sg_page(&as->urb->sg[i])) kfree(sg_virt(&as->urb->sg[i])); } kfree(as->urb->sg); if (as->usbm == NULL) kfree(as->urb->transfer_buffer); else dec_usb_memory_use_count(as->usbm, &as->usbm->urb_use_count); kfree(as->urb->setup_packet); usb_free_urb(as->urb); usbfs_decrease_memory_usage(as->mem_usage); kfree(as); } ",0 " gfx::Size rwhv_create_size() const { return rwhv_create_size_; } ",0 " void pong() { EXPECT_TRUE(isMainThread()); webkit_support::QuitMessageLoop(); } ",0 "void omx_vdec::process_event_cb(void *ctxt, unsigned char id) { unsigned long p1; // Parameter - 1 unsigned long p2; // Parameter - 2 unsigned long ident; unsigned qsize=0; // qsize omx_vdec *pThis = (omx_vdec *) ctxt; if (!pThis) { DEBUG_PRINT_ERROR(""ERROR: %s()::Context is incorrect, bailing out"", __func__); return; } do { /*Read the message id's from the queue*/ pthread_mutex_lock(&pThis->m_lock); qsize = pThis->m_cmd_q.m_size; if (qsize) { pThis->m_cmd_q.pop_entry(&p1, &p2, &ident); } if (qsize == 0 && pThis->m_state != OMX_StatePause) { qsize = pThis->m_ftb_q.m_size; if (qsize) { pThis->m_ftb_q.pop_entry(&p1, &p2, &ident); } } if (qsize == 0 && pThis->m_state != OMX_StatePause) { qsize = pThis->m_etb_q.m_size; if (qsize) { pThis->m_etb_q.pop_entry(&p1, &p2, &ident); } } pthread_mutex_unlock(&pThis->m_lock); /*process message if we have one*/ if (qsize > 0) { id = ident; switch (id) { case OMX_COMPONENT_GENERATE_EVENT: if (pThis->m_cb.EventHandler) { switch (p1) { case OMX_CommandStateSet: pThis->m_state = (OMX_STATETYPE) p2; DEBUG_PRINT_HIGH(""OMX_CommandStateSet complete, m_state = %d"", pThis->m_state); pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventCmdComplete, p1, p2, NULL); break; case OMX_EventError: if (p2 == OMX_StateInvalid) { DEBUG_PRINT_ERROR(""OMX_EventError: p2 is OMX_StateInvalid""); pThis->m_state = (OMX_STATETYPE) p2; pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventError, OMX_ErrorInvalidState, p2, NULL); } else if (p2 == (unsigned long)OMX_ErrorHardware) { pThis->omx_report_error(); } else { pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventError, p2, (OMX_U32)NULL, NULL ); } break; case OMX_CommandPortDisable: DEBUG_PRINT_HIGH(""OMX_CommandPortDisable complete for port [%lu]"", p2); if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_OUTPUT_FLUSH_IN_DISABLE_PENDING)) { BITMASK_SET(&pThis->m_flags, OMX_COMPONENT_DISABLE_OUTPUT_DEFERRED); break; } if (p2 == OMX_CORE_OUTPUT_PORT_INDEX) { OMX_ERRORTYPE eRet = OMX_ErrorNone; pThis->stream_off(OMX_CORE_OUTPUT_PORT_INDEX); if (release_buffers(pThis, VDEC_BUFFER_TYPE_OUTPUT)) DEBUG_PRINT_HIGH(""Failed to release output buffers""); OMX_ERRORTYPE eRet1 = pThis->get_buffer_req(&pThis->drv_ctx.op_buf); pThis->in_reconfig = false; if (eRet != OMX_ErrorNone) { DEBUG_PRINT_ERROR(""set_buffer_req failed eRet = %d"",eRet); pThis->omx_report_error(); break; } } pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventCmdComplete, p1, p2, NULL ); break; case OMX_CommandPortEnable: DEBUG_PRINT_HIGH(""OMX_CommandPortEnable complete for port [%lu]"", p2); pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data,\ OMX_EventCmdComplete, p1, p2, NULL ); break; default: pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventCmdComplete, p1, p2, NULL ); break; } } else { DEBUG_PRINT_ERROR(""ERROR: %s()::EventHandler is NULL"", __func__); } break; case OMX_COMPONENT_GENERATE_ETB_ARBITRARY: if (pThis->empty_this_buffer_proxy_arbitrary((OMX_HANDLETYPE)p1,\ (OMX_BUFFERHEADERTYPE *)(intptr_t)p2) != OMX_ErrorNone) { DEBUG_PRINT_ERROR(""empty_this_buffer_proxy_arbitrary failure""); pThis->omx_report_error (); } break; case OMX_COMPONENT_GENERATE_ETB: { OMX_ERRORTYPE iret; iret = pThis->empty_this_buffer_proxy((OMX_HANDLETYPE)p1, (OMX_BUFFERHEADERTYPE *)p2); if (iret == OMX_ErrorInsufficientResources) { DEBUG_PRINT_ERROR(""empty_this_buffer_proxy failure due to HW overload""); pThis->omx_report_hw_overload (); } else if (iret != OMX_ErrorNone) { DEBUG_PRINT_ERROR(""empty_this_buffer_proxy failure""); pThis->omx_report_error (); } } break; case OMX_COMPONENT_GENERATE_FTB: if ( pThis->fill_this_buffer_proxy((OMX_HANDLETYPE)(intptr_t)p1,\ (OMX_BUFFERHEADERTYPE *)(intptr_t)p2) != OMX_ErrorNone) { DEBUG_PRINT_ERROR(""fill_this_buffer_proxy failure""); pThis->omx_report_error (); } break; case OMX_COMPONENT_GENERATE_COMMAND: pThis->send_command_proxy(&pThis->m_cmp,(OMX_COMMANDTYPE)p1,\ (OMX_U32)p2,(OMX_PTR)NULL); break; case OMX_COMPONENT_GENERATE_EBD: if (p2 != VDEC_S_SUCCESS && p2 != VDEC_S_INPUT_BITSTREAM_ERR) { DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_EBD failure""); pThis->omx_report_error (); } else { if (p2 == VDEC_S_INPUT_BITSTREAM_ERR && p1) { pThis->time_stamp_dts.remove_time_stamp( ((OMX_BUFFERHEADERTYPE *)(intptr_t)p1)->nTimeStamp, (pThis->drv_ctx.interlace != VDEC_InterlaceFrameProgressive) ?true:false); } if ( pThis->empty_buffer_done(&pThis->m_cmp, (OMX_BUFFERHEADERTYPE *)(intptr_t)p1) != OMX_ErrorNone) { DEBUG_PRINT_ERROR(""empty_buffer_done failure""); pThis->omx_report_error (); } } break; case OMX_COMPONENT_GENERATE_INFO_FIELD_DROPPED: { int64_t *timestamp = (int64_t *)(intptr_t)p1; if (p1) { pThis->time_stamp_dts.remove_time_stamp(*timestamp, (pThis->drv_ctx.interlace != VDEC_InterlaceFrameProgressive) ?true:false); free(timestamp); } } break; case OMX_COMPONENT_GENERATE_FBD: if (p2 != VDEC_S_SUCCESS) { DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_FBD failure""); pThis->omx_report_error (); } else if ( pThis->fill_buffer_done(&pThis->m_cmp, (OMX_BUFFERHEADERTYPE *)(intptr_t)p1) != OMX_ErrorNone ) { DEBUG_PRINT_ERROR(""fill_buffer_done failure""); pThis->omx_report_error (); } break; case OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH: DEBUG_PRINT_HIGH(""Driver flush i/p Port complete""); if (!pThis->input_flush_progress) { DEBUG_PRINT_HIGH(""WARNING: Unexpected flush from driver""); } else { pThis->execute_input_flush(); if (pThis->m_cb.EventHandler) { if (p2 != VDEC_S_SUCCESS) { DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_EVENT_INPUT_FLUSH failure""); pThis->omx_report_error (); } else { /*Check if we need generate event for Flush done*/ if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_INPUT_FLUSH_PENDING)) { BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_INPUT_FLUSH_PENDING); DEBUG_PRINT_LOW(""Input Flush completed - Notify Client""); pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventCmdComplete,OMX_CommandFlush, OMX_CORE_INPUT_PORT_INDEX,NULL ); } if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_IDLE_PENDING)) { if (pThis->stream_off(OMX_CORE_INPUT_PORT_INDEX)) { DEBUG_PRINT_ERROR(""Failed to call streamoff on OUTPUT Port""); pThis->omx_report_error (); } else { pThis->streaming[OUTPUT_PORT] = false; } if (!pThis->output_flush_progress) { DEBUG_PRINT_LOW(""Input flush done hence issue stop""); pThis->post_event ((unsigned int)NULL, VDEC_S_SUCCESS,\ OMX_COMPONENT_GENERATE_STOP_DONE); } } } } else { DEBUG_PRINT_ERROR(""ERROR: %s()::EventHandler is NULL"", __func__); } } break; case OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH: DEBUG_PRINT_HIGH(""Driver flush o/p Port complete""); if (!pThis->output_flush_progress) { DEBUG_PRINT_HIGH(""WARNING: Unexpected flush from driver""); } else { pThis->execute_output_flush(); if (pThis->m_cb.EventHandler) { if (p2 != VDEC_S_SUCCESS) { DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_EVENT_OUTPUT_FLUSH failed""); pThis->omx_report_error (); } else { /*Check if we need generate event for Flush done*/ if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_OUTPUT_FLUSH_PENDING)) { DEBUG_PRINT_LOW(""Notify Output Flush done""); BITMASK_CLEAR (&pThis->m_flags,OMX_COMPONENT_OUTPUT_FLUSH_PENDING); pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventCmdComplete,OMX_CommandFlush, OMX_CORE_OUTPUT_PORT_INDEX,NULL ); } if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_OUTPUT_FLUSH_IN_DISABLE_PENDING)) { DEBUG_PRINT_LOW(""Internal flush complete""); BITMASK_CLEAR (&pThis->m_flags, OMX_COMPONENT_OUTPUT_FLUSH_IN_DISABLE_PENDING); if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_DISABLE_OUTPUT_DEFERRED)) { pThis->post_event(OMX_CommandPortDisable, OMX_CORE_OUTPUT_PORT_INDEX, OMX_COMPONENT_GENERATE_EVENT); BITMASK_CLEAR (&pThis->m_flags, OMX_COMPONENT_DISABLE_OUTPUT_DEFERRED); BITMASK_CLEAR (&pThis->m_flags, OMX_COMPONENT_OUTPUT_DISABLE_PENDING); } } if (BITMASK_PRESENT(&pThis->m_flags ,OMX_COMPONENT_IDLE_PENDING)) { if (pThis->stream_off(OMX_CORE_OUTPUT_PORT_INDEX)) { DEBUG_PRINT_ERROR(""Failed to call streamoff on CAPTURE Port""); pThis->omx_report_error (); break; } pThis->streaming[CAPTURE_PORT] = false; if (!pThis->input_flush_progress) { DEBUG_PRINT_LOW(""Output flush done hence issue stop""); pThis->post_event ((unsigned int)NULL, VDEC_S_SUCCESS,\ OMX_COMPONENT_GENERATE_STOP_DONE); } } } } else { DEBUG_PRINT_ERROR(""ERROR: %s()::EventHandler is NULL"", __func__); } } break; case OMX_COMPONENT_GENERATE_START_DONE: DEBUG_PRINT_HIGH(""Rxd OMX_COMPONENT_GENERATE_START_DONE""); if (pThis->m_cb.EventHandler) { if (p2 != VDEC_S_SUCCESS) { DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_START_DONE Failure""); pThis->omx_report_error (); } else { DEBUG_PRINT_LOW(""OMX_COMPONENT_GENERATE_START_DONE Success""); if (BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_EXECUTE_PENDING)) { DEBUG_PRINT_LOW(""Move to executing""); BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_EXECUTE_PENDING); pThis->m_state = OMX_StateExecuting; pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventCmdComplete,OMX_CommandStateSet, OMX_StateExecuting, NULL); } else if (BITMASK_PRESENT(&pThis->m_flags, OMX_COMPONENT_PAUSE_PENDING)) { if (/*ioctl (pThis->drv_ctx.video_driver_fd, VDEC_IOCTL_CMD_PAUSE,NULL ) < */0) { DEBUG_PRINT_ERROR(""VDEC_IOCTL_CMD_PAUSE failed""); pThis->omx_report_error (); } } } } else { DEBUG_PRINT_LOW(""Event Handler callback is NULL""); } break; case OMX_COMPONENT_GENERATE_PAUSE_DONE: DEBUG_PRINT_HIGH(""Rxd OMX_COMPONENT_GENERATE_PAUSE_DONE""); if (pThis->m_cb.EventHandler) { if (p2 != VDEC_S_SUCCESS) { DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_PAUSE_DONE ret failed""); pThis->omx_report_error (); } else { pThis->complete_pending_buffer_done_cbs(); if (BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_PAUSE_PENDING)) { DEBUG_PRINT_LOW(""OMX_COMPONENT_GENERATE_PAUSE_DONE nofity""); BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_PAUSE_PENDING); pThis->m_state = OMX_StatePause; pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventCmdComplete,OMX_CommandStateSet, OMX_StatePause, NULL); } } } else { DEBUG_PRINT_ERROR(""ERROR: %s()::EventHandler is NULL"", __func__); } break; case OMX_COMPONENT_GENERATE_RESUME_DONE: DEBUG_PRINT_HIGH(""Rxd OMX_COMPONENT_GENERATE_RESUME_DONE""); if (pThis->m_cb.EventHandler) { if (p2 != VDEC_S_SUCCESS) { DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_RESUME_DONE failed""); pThis->omx_report_error (); } else { if (BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_EXECUTE_PENDING)) { DEBUG_PRINT_LOW(""Moving the decoder to execute state""); BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_EXECUTE_PENDING); pThis->m_state = OMX_StateExecuting; pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventCmdComplete,OMX_CommandStateSet, OMX_StateExecuting,NULL); } } } else { DEBUG_PRINT_ERROR(""ERROR: %s()::EventHandler is NULL"", __func__); } break; case OMX_COMPONENT_GENERATE_STOP_DONE: DEBUG_PRINT_HIGH(""Rxd OMX_COMPONENT_GENERATE_STOP_DONE""); if (pThis->m_cb.EventHandler) { if (p2 != VDEC_S_SUCCESS) { DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_STOP_DONE ret failed""); pThis->omx_report_error (); } else { pThis->complete_pending_buffer_done_cbs(); if (BITMASK_PRESENT(&pThis->m_flags,OMX_COMPONENT_IDLE_PENDING)) { DEBUG_PRINT_LOW(""OMX_COMPONENT_GENERATE_STOP_DONE Success""); BITMASK_CLEAR((&pThis->m_flags),OMX_COMPONENT_IDLE_PENDING); pThis->m_state = OMX_StateIdle; DEBUG_PRINT_LOW(""Move to Idle State""); pThis->m_cb.EventHandler(&pThis->m_cmp,pThis->m_app_data, OMX_EventCmdComplete,OMX_CommandStateSet, OMX_StateIdle,NULL); } } } else { DEBUG_PRINT_ERROR(""ERROR: %s()::EventHandler is NULL"", __func__); } break; case OMX_COMPONENT_GENERATE_PORT_RECONFIG: if (p2 == OMX_IndexParamPortDefinition) { DEBUG_PRINT_HIGH(""Rxd PORT_RECONFIG: OMX_IndexParamPortDefinition""); pThis->in_reconfig = true; } else if (p2 == OMX_IndexConfigCommonOutputCrop) { DEBUG_PRINT_HIGH(""Rxd PORT_RECONFIG: OMX_IndexConfigCommonOutputCrop""); /* Check if resolution is changed in smooth streaming mode */ if (pThis->m_smoothstreaming_mode && (pThis->framesize.nWidth != pThis->drv_ctx.video_resolution.frame_width) || (pThis->framesize.nHeight != pThis->drv_ctx.video_resolution.frame_height)) { DEBUG_PRINT_HIGH(""Resolution changed from: wxh = %dx%d to: wxh = %dx%d"", pThis->framesize.nWidth, pThis->framesize.nHeight, pThis->drv_ctx.video_resolution.frame_width, pThis->drv_ctx.video_resolution.frame_height); /* Update new resolution */ pThis->framesize.nWidth = pThis->drv_ctx.video_resolution.frame_width; pThis->framesize.nHeight = pThis->drv_ctx.video_resolution.frame_height; /* Update C2D with new resolution */ if (!pThis->client_buffers.update_buffer_req()) { DEBUG_PRINT_ERROR(""Setting C2D buffer requirements failed""); } } /* Update new crop information */ pThis->rectangle.nLeft = pThis->drv_ctx.frame_size.left; pThis->rectangle.nTop = pThis->drv_ctx.frame_size.top; pThis->rectangle.nWidth = pThis->drv_ctx.frame_size.right; pThis->rectangle.nHeight = pThis->drv_ctx.frame_size.bottom; /* Validate the new crop information */ if (pThis->rectangle.nLeft + pThis->rectangle.nWidth > pThis->drv_ctx.video_resolution.frame_width) { DEBUG_PRINT_HIGH(""Crop L[%u] + R[%u] > W[%u]"", pThis->rectangle.nLeft, pThis->rectangle.nWidth, pThis->drv_ctx.video_resolution.frame_width); pThis->rectangle.nLeft = 0; if (pThis->rectangle.nWidth > pThis->drv_ctx.video_resolution.frame_width) { DEBUG_PRINT_HIGH(""Crop R[%u] > W[%u]"", pThis->rectangle.nWidth, pThis->drv_ctx.video_resolution.frame_width); pThis->rectangle.nWidth = pThis->drv_ctx.video_resolution.frame_width; } } if (pThis->rectangle.nTop + pThis->rectangle.nHeight > pThis->drv_ctx.video_resolution.frame_height) { DEBUG_PRINT_HIGH(""Crop T[%u] + B[%u] > H[%u]"", pThis->rectangle.nTop, pThis->rectangle.nHeight, pThis->drv_ctx.video_resolution.frame_height); pThis->rectangle.nTop = 0; if (pThis->rectangle.nHeight > pThis->drv_ctx.video_resolution.frame_height) { DEBUG_PRINT_HIGH(""Crop B[%u] > H[%u]"", pThis->rectangle.nHeight, pThis->drv_ctx.video_resolution.frame_height); pThis->rectangle.nHeight = pThis->drv_ctx.video_resolution.frame_height; } } DEBUG_PRINT_HIGH(""Updated Crop Info: L: %u, T: %u, R: %u, B: %u"", pThis->rectangle.nLeft, pThis->rectangle.nTop, pThis->rectangle.nWidth, pThis->rectangle.nHeight); } else { DEBUG_PRINT_ERROR(""Rxd Invalid PORT_RECONFIG event (%lu)"", p2); break; } if (pThis->m_cb.EventHandler) { pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventPortSettingsChanged, p1, p2, NULL ); } else { DEBUG_PRINT_ERROR(""ERROR: %s()::EventHandler is NULL"", __func__); } break; case OMX_COMPONENT_GENERATE_EOS_DONE: DEBUG_PRINT_HIGH(""Rxd OMX_COMPONENT_GENERATE_EOS_DONE""); if (pThis->m_cb.EventHandler) { pThis->m_cb.EventHandler(&pThis->m_cmp, pThis->m_app_data, OMX_EventBufferFlag, OMX_CORE_OUTPUT_PORT_INDEX, OMX_BUFFERFLAG_EOS, NULL ); } else { DEBUG_PRINT_ERROR(""ERROR: %s()::EventHandler is NULL"", __func__); } pThis->prev_ts = LLONG_MAX; pThis->rst_prev_ts = true; break; case OMX_COMPONENT_GENERATE_HARDWARE_ERROR: DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_HARDWARE_ERROR""); pThis->omx_report_error (); break; case OMX_COMPONENT_GENERATE_UNSUPPORTED_SETTING: DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_UNSUPPORTED_SETTING""); pThis->omx_report_unsupported_setting(); break; case OMX_COMPONENT_GENERATE_HARDWARE_OVERLOAD: DEBUG_PRINT_ERROR(""OMX_COMPONENT_GENERATE_HARDWARE_OVERLOAD""); pThis->omx_report_hw_overload(); break; default: break; } } pthread_mutex_lock(&pThis->m_lock); qsize = pThis->m_cmd_q.m_size; if (pThis->m_state != OMX_StatePause) qsize += (pThis->m_ftb_q.m_size + pThis->m_etb_q.m_size); pthread_mutex_unlock(&pThis->m_lock); } while (qsize>0); } ",0 "void RenderFrameImpl::BindNavigationClient( mojom::NavigationClientAssociatedRequest request) { navigation_client_impl_ = std::make_unique(this); navigation_client_impl_->Bind(std::move(request)); } ",0 "int php_wddx_deserialize_ex(char *value, int vallen, zval *return_value) { wddx_stack stack; XML_Parser parser; st_entry *ent; int retval; wddx_stack_init(&stack); parser = XML_ParserCreate(""UTF-8""); XML_SetUserData(parser, &stack); XML_SetElementHandler(parser, php_wddx_push_element, php_wddx_pop_element); XML_SetCharacterDataHandler(parser, php_wddx_process_data); XML_Parse(parser, value, vallen, 1); XML_ParserFree(parser); if (stack.top == 1) { wddx_stack_top(&stack, (void**)&ent); if(ent->data == NULL) { retval = FAILURE; } else { *return_value = *(ent->data); zval_copy_ctor(return_value); retval = SUCCESS; } } else { retval = FAILURE; } wddx_stack_destroy(&stack); return retval; } ",0 "void ChromeDownloadManagerDelegate::ChooseDownloadPath( DownloadItem* item, const FilePath& suggested_path, const FileSelectedCallback& file_selected_callback) { DownloadFilePicker* file_picker = #if defined(OS_CHROMEOS) new DownloadFilePickerChromeOS(); #else new DownloadFilePicker(); #endif file_picker->Init(download_manager_, item, suggested_path, file_selected_callback); } ",0 "void GLES2DecoderImpl::MarkDrawBufferAsCleared( GLenum buffer, GLint drawbuffer_i) { Framebuffer* framebuffer = GetBoundDrawFramebuffer(); if (!framebuffer) return; GLenum attachment = 0; switch (buffer) { case GL_COLOR: DCHECK(drawbuffer_i >= 0 && drawbuffer_i < static_cast(group_->max_draw_buffers())); attachment = static_cast(GL_COLOR_ATTACHMENT0 + drawbuffer_i); break; case GL_DEPTH: attachment = GL_DEPTH_ATTACHMENT; break; case GL_STENCIL: attachment = GL_STENCIL_ATTACHMENT; break; default: NOTREACHED(); } framebuffer->MarkAttachmentAsCleared( renderbuffer_manager(), texture_manager(), attachment, true); } ",0 "void OneClickSigninSyncStarter::CreateNewSignedInProfile() { SigninManager* signin = SigninManagerFactory::GetForProfile(profile_); DCHECK(!signin->GetUsernameForAuthInProgress().empty()); DCHECK(policy_client_); size_t icon_index = g_browser_process->profile_manager()-> GetProfileInfoCache().ChooseAvatarIconIndexForNewProfile(); ProfileManager::CreateMultiProfileAsync( UTF8ToUTF16(signin->GetUsernameForAuthInProgress()), UTF8ToUTF16(ProfileInfoCache::GetDefaultAvatarIconUrl(icon_index)), base::Bind(&OneClickSigninSyncStarter::CompleteInitForNewProfile, weak_pointer_factory_.GetWeakPtr(), desktop_type_), false); } ",0 "void RenderFrameHostImpl::CopyImageAt(int x, int y) { gfx::PointF point_in_view = GetView()->TransformRootPointToViewCoordSpace(gfx::PointF(x, y)); Send(new FrameMsg_CopyImageAt(routing_id_, point_in_view.x(), point_in_view.y())); } ",0 "static void iucv_callback_rx(struct iucv_path *path, struct iucv_message *msg) { struct sock *sk = path->private; struct iucv_sock *iucv = iucv_sk(sk); struct sk_buff *skb; struct sock_msg_q *save_msg; int len; if (sk->sk_shutdown & RCV_SHUTDOWN) { pr_iucv->message_reject(path, msg); return; } spin_lock(&iucv->message_q.lock); if (!list_empty(&iucv->message_q.list) || !skb_queue_empty(&iucv->backlog_skb_q)) goto save_message; len = atomic_read(&sk->sk_rmem_alloc); len += SKB_TRUESIZE(iucv_msg_length(msg)); if (len > sk->sk_rcvbuf) goto save_message; skb = alloc_skb(iucv_msg_length(msg), GFP_ATOMIC | GFP_DMA); if (!skb) goto save_message; iucv_process_message(sk, skb, path, msg); goto out_unlock; save_message: save_msg = kzalloc(sizeof(struct sock_msg_q), GFP_ATOMIC | GFP_DMA); if (!save_msg) goto out_unlock; save_msg->path = path; save_msg->msg = *msg; list_add_tail(&save_msg->list, &iucv->message_q.list); out_unlock: spin_unlock(&iucv->message_q.lock); } ",0 "void PPAPITestBase::RunTestViaHTTP(const std::string& test_case) { FilePath document_root; ASSERT_TRUE(GetHTTPDocumentRoot(&document_root)); RunHTTPTestServer(document_root, test_case, """"); } ",0 "static void read_pnm_header(FILE *reader, struct pnm_header *ph) { int format, end, ttype; char idf[256], type[256]; char line[256]; if (fgets(line, 250, reader) == NULL) { fprintf(stderr, ""\nWARNING: fgets return a NULL value""); return; } if (line[0] != 'P') { fprintf(stderr, ""read_pnm_header:PNM:magic P missing\n""); return; } format = atoi(line + 1); if (format < 1 || format > 7) { fprintf(stderr, ""read_pnm_header:magic format %d invalid\n"", format); return; } ph->format = format; ttype = end = 0; while (fgets(line, 250, reader)) { char *s; int allow_null = 0; if (*line == '#') { continue; } s = line; if (format == 7) { s = skip_idf(s, idf); if (s == NULL || *s == 0) { return; } if (strcmp(idf, ""ENDHDR"") == 0) { end = 1; break; } if (strcmp(idf, ""WIDTH"") == 0) { s = skip_int(s, &ph->width); if (s == NULL || *s == 0) { return; } continue; } if (strcmp(idf, ""HEIGHT"") == 0) { s = skip_int(s, &ph->height); if (s == NULL || *s == 0) { return; } continue; } if (strcmp(idf, ""DEPTH"") == 0) { s = skip_int(s, &ph->depth); if (s == NULL || *s == 0) { return; } continue; } if (strcmp(idf, ""MAXVAL"") == 0) { s = skip_int(s, &ph->maxval); if (s == NULL || *s == 0) { return; } continue; } if (strcmp(idf, ""TUPLTYPE"") == 0) { s = skip_idf(s, type); if (s == NULL || *s == 0) { return; } if (strcmp(type, ""BLACKANDWHITE"") == 0) { ph->bw = 1; ttype = 1; continue; } if (strcmp(type, ""GRAYSCALE"") == 0) { ph->gray = 1; ttype = 1; continue; } if (strcmp(type, ""GRAYSCALE_ALPHA"") == 0) { ph->graya = 1; ttype = 1; continue; } if (strcmp(type, ""RGB"") == 0) { ph->rgb = 1; ttype = 1; continue; } if (strcmp(type, ""RGB_ALPHA"") == 0) { ph->rgba = 1; ttype = 1; continue; } fprintf(stderr, ""read_pnm_header:unknown P7 TUPLTYPE %s\n"", type); return; } fprintf(stderr, ""read_pnm_header:unknown P7 idf %s\n"", idf); return; } /* if(format == 7) */ /* Here format is in range [1,6] */ if (ph->width == 0) { s = skip_int(s, &ph->width); if ((s == NULL) || (*s == 0) || (ph->width < 1)) { return; } allow_null = 1; } if (ph->height == 0) { s = skip_int(s, &ph->height); if ((s == NULL) && allow_null) { continue; } if ((s == NULL) || (*s == 0) || (ph->height < 1)) { return; } if (format == 1 || format == 4) { break; } allow_null = 1; } /* here, format is in P2, P3, P5, P6 */ s = skip_int(s, &ph->maxval); if ((s == NULL) && allow_null) { continue; } if ((s == NULL) || (*s == 0)) { return; } break; }/* while(fgets( ) */ if (format == 2 || format == 3 || format > 4) { if (ph->maxval < 1 || ph->maxval > 65535) { return; } } if (ph->width < 1 || ph->height < 1) { return; } if (format == 7) { if (!end) { fprintf(stderr, ""read_pnm_header:P7 without ENDHDR\n""); return; } if (ph->depth < 1 || ph->depth > 4) { return; } if (ttype) { ph->ok = 1; } } else { ph->ok = 1; if (format == 1 || format == 4) { ph->maxval = 255; } } } ",0 "void WebGLRenderingContextBase::texSubImage2D( ExecutionContext* execution_context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, HTMLVideoElement* video, ExceptionState& exception_state) { TexImageHelperHTMLVideoElement(execution_context->GetSecurityOrigin(), kTexSubImage2D, target, level, 0, format, type, xoffset, yoffset, 0, video, SentinelEmptyRect(), 1, 0, exception_state); } ",0 "int uv_spawn(uv_loop_t* loop, uv_process_t* process, const uv_process_options_t* options) { int signal_pipe[2] = { -1, -1 }; int (*pipes)[2]; int stdio_count; QUEUE* q; ssize_t r; pid_t pid; int err; int exec_errorno; int i; assert(options->file != NULL); assert(!(options->flags & ~(UV_PROCESS_DETACHED | UV_PROCESS_SETGID | UV_PROCESS_SETUID | UV_PROCESS_WINDOWS_HIDE | UV_PROCESS_WINDOWS_VERBATIM_ARGUMENTS))); uv__handle_init(loop, (uv_handle_t*)process, UV_PROCESS); QUEUE_INIT(&process->queue); stdio_count = options->stdio_count; if (stdio_count < 3) stdio_count = 3; err = -ENOMEM; pipes = malloc(stdio_count * sizeof(*pipes)); if (pipes == NULL) goto error; for (i = 0; i < stdio_count; i++) { pipes[i][0] = -1; pipes[i][1] = -1; } for (i = 0; i < options->stdio_count; i++) { err = uv__process_init_stdio(options->stdio + i, pipes[i]); if (err) goto error; } /* This pipe is used by the parent to wait until * the child has called `execve()`. We need this * to avoid the following race condition: * * if ((pid = fork()) > 0) { * kill(pid, SIGTERM); * } * else if (pid == 0) { * execve(""/bin/cat"", argp, envp); * } * * The parent sends a signal immediately after forking. * Since the child may not have called `execve()` yet, * there is no telling what process receives the signal, * our fork or /bin/cat. * * To avoid ambiguity, we create a pipe with both ends * marked close-on-exec. Then, after the call to `fork()`, * the parent polls the read end until it EOFs or errors with EPIPE. */ err = uv__make_pipe(signal_pipe, 0); if (err) goto error; uv_signal_start(&loop->child_watcher, uv__chld, SIGCHLD); /* Acquire write lock to prevent opening new fds in worker threads */ uv_rwlock_wrlock(&loop->cloexec_lock); pid = fork(); if (pid == -1) { err = -errno; uv_rwlock_wrunlock(&loop->cloexec_lock); uv__close(signal_pipe[0]); uv__close(signal_pipe[1]); goto error; } if (pid == 0) { uv__process_child_init(options, stdio_count, pipes, signal_pipe[1]); abort(); } /* Release lock in parent process */ uv_rwlock_wrunlock(&loop->cloexec_lock); uv__close(signal_pipe[1]); process->status = 0; exec_errorno = 0; do r = read(signal_pipe[0], &exec_errorno, sizeof(exec_errorno)); while (r == -1 && errno == EINTR); if (r == 0) ; /* okay, EOF */ else if (r == sizeof(exec_errorno)) ; /* okay, read errorno */ else if (r == -1 && errno == EPIPE) ; /* okay, got EPIPE */ else abort(); uv__close(signal_pipe[0]); for (i = 0; i < options->stdio_count; i++) { err = uv__process_open_stream(options->stdio + i, pipes[i], i == 0); if (err == 0) continue; while (i--) uv__process_close_stream(options->stdio + i); goto error; } /* Only activate this handle if exec() happened successfully */ if (exec_errorno == 0) { q = uv__process_queue(loop, pid); QUEUE_INSERT_TAIL(q, &process->queue); uv__handle_start(process); } process->pid = pid; process->exit_cb = options->exit_cb; free(pipes); return exec_errorno; error: if (pipes != NULL) { for (i = 0; i < stdio_count; i++) { if (i < options->stdio_count) if (options->stdio[i].flags & (UV_INHERIT_FD | UV_INHERIT_STREAM)) continue; if (pipes[i][0] != -1) close(pipes[i][0]); if (pipes[i][1] != -1) close(pipes[i][1]); } free(pipes); } return err; } ",0 "nfsd4_cb_notify_lock_done(struct nfsd4_callback *cb, struct rpc_task *task) { /* * Since this is just an optimization, we don't try very hard if it * turns out not to succeed. We'll requeue it on NFS4ERR_DELAY, and * just quit trying on anything else. */ switch (task->tk_status) { case -NFS4ERR_DELAY: rpc_delay(task, 1 * HZ); return 0; default: return 1; } } ",0 "MODRET auth_pre_user(cmd_rec *cmd) { if (saw_first_user_cmd == FALSE) { if (pr_trace_get_level(timing_channel)) { unsigned long elapsed_ms; uint64_t finish_ms; pr_gettimeofday_millis(&finish_ms); elapsed_ms = (unsigned long) (finish_ms - session.connect_time_ms); pr_trace_msg(timing_channel, 4, ""Time before first USER: %lu ms"", elapsed_ms); } saw_first_user_cmd = TRUE; } if (logged_in) { return PR_DECLINED(cmd); } /* Close the passwd and group databases, because libc won't let us see new * entries to these files without this (only in PersistentPasswd mode). */ pr_auth_endpwent(cmd->tmp_pool); pr_auth_endgrent(cmd->tmp_pool); /* Check for a user name that exceeds PR_TUNABLE_LOGIN_MAX. */ if (strlen(cmd->arg) > PR_TUNABLE_LOGIN_MAX) { pr_log_pri(PR_LOG_NOTICE, ""USER %s (Login failed): "" ""maximum USER length exceeded"", cmd->arg); pr_response_add_err(R_501, _(""Login incorrect."")); pr_cmd_set_errno(cmd, EPERM); errno = EPERM; return PR_ERROR(cmd); } return PR_DECLINED(cmd); } ",0 "size_t ZSTD_CCtxParams_reset(ZSTD_CCtx_params* params) { return ZSTD_CCtxParams_init(params, ZSTD_CLEVEL_DEFAULT); } ",0 "void HTMLSelectElement::setMultiple(bool multiple) { bool oldMultiple = this->multiple(); int oldSelectedIndex = selectedIndex(); setAttribute(multipleAttr, multiple ? emptyAtom : nullAtom); if (oldMultiple != this->multiple()) setSelectedIndex(oldSelectedIndex); } ",0 " static uint32_t UnshiftImpl(Handle receiver, Arguments* args, uint32_t unshift_size) { UNREACHABLE(); return 0; } ",0 "static int init_rmode_tss(struct kvm *kvm) { gfn_t fn; u16 data = 0; int idx, r; idx = srcu_read_lock(&kvm->srcu); fn = kvm->arch.tss_addr >> PAGE_SHIFT; r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE); if (r < 0) goto out; data = TSS_BASE_SIZE + TSS_REDIRECTION_SIZE; r = kvm_write_guest_page(kvm, fn++, &data, TSS_IOPB_BASE_OFFSET, sizeof(u16)); if (r < 0) goto out; r = kvm_clear_guest_page(kvm, fn++, 0, PAGE_SIZE); if (r < 0) goto out; r = kvm_clear_guest_page(kvm, fn, 0, PAGE_SIZE); if (r < 0) goto out; data = ~0; r = kvm_write_guest_page(kvm, fn, &data, RMODE_TSS_SIZE - 2 * PAGE_SIZE - 1, sizeof(u8)); out: srcu_read_unlock(&kvm->srcu, idx); return r; } ",0 "void WebGL2RenderingContextBase::clearBufferuiv(GLenum buffer, GLint drawbuffer, const Vector& value, GLuint src_offset) { if (isContextLost() || !ValidateClearBuffer(""clearBufferuiv"", buffer, value.size(), src_offset)) return; ScopedRGBEmulationColorMask emulation_color_mask(this, color_mask_, drawing_buffer_.get()); ContextGL()->ClearBufferuiv(buffer, drawbuffer, value.data() + src_offset); UpdateBuffersToAutoClear(kClearBufferuiv, buffer, drawbuffer); } ",0 "int CCThreadProxy::compositorIdentifier() const { ASSERT(isMainThread()); return m_compositorIdentifier; } ",0 "MagickPrivate MagickBooleanType LocaleComponentGenesis(void) { if (locale_semaphore == (SemaphoreInfo *) NULL) locale_semaphore=AcquireSemaphoreInfo(); return(MagickTrue); } ",0 " base::FilePath GetDownloadDirectory(Browser* browser) { return GetDownloadPrefs(browser)->DownloadPath(); } ",0 "void RenderViewHostImpl::DidSelectPopupMenuItems( const std::vector& selected_indices) { Send(new ViewMsg_SelectPopupMenuItems(GetRoutingID(), false, selected_indices)); } ",0 "static long shmem_fallocate(struct file *file, int mode, loff_t offset, loff_t len) { struct inode *inode = file->f_path.dentry->d_inode; struct shmem_sb_info *sbinfo = SHMEM_SB(inode->i_sb); struct shmem_falloc shmem_falloc; pgoff_t start, index, end; int error; mutex_lock(&inode->i_mutex); if (mode & FALLOC_FL_PUNCH_HOLE) { struct address_space *mapping = file->f_mapping; loff_t unmap_start = round_up(offset, PAGE_SIZE); loff_t unmap_end = round_down(offset + len, PAGE_SIZE) - 1; if ((u64)unmap_end > (u64)unmap_start) unmap_mapping_range(mapping, unmap_start, 1 + unmap_end - unmap_start, 0); shmem_truncate_range(inode, offset, offset + len - 1); /* No need to unmap again: hole-punching leaves COWed pages */ error = 0; goto out; } /* We need to check rlimit even when FALLOC_FL_KEEP_SIZE */ error = inode_newsize_ok(inode, offset + len); if (error) goto out; start = offset >> PAGE_CACHE_SHIFT; end = (offset + len + PAGE_CACHE_SIZE - 1) >> PAGE_CACHE_SHIFT; /* Try to avoid a swapstorm if len is impossible to satisfy */ if (sbinfo->max_blocks && end - start > sbinfo->max_blocks) { error = -ENOSPC; goto out; } shmem_falloc.start = start; shmem_falloc.next = start; shmem_falloc.nr_falloced = 0; shmem_falloc.nr_unswapped = 0; spin_lock(&inode->i_lock); inode->i_private = &shmem_falloc; spin_unlock(&inode->i_lock); for (index = start; index < end; index++) { struct page *page; /* * Good, the fallocate(2) manpage permits EINTR: we may have * been interrupted because we are using up too much memory. */ if (signal_pending(current)) error = -EINTR; else if (shmem_falloc.nr_unswapped > shmem_falloc.nr_falloced) error = -ENOMEM; else error = shmem_getpage(inode, index, &page, SGP_FALLOC, NULL); if (error) { /* Remove the !PageUptodate pages we added */ shmem_undo_range(inode, (loff_t)start << PAGE_CACHE_SHIFT, (loff_t)index << PAGE_CACHE_SHIFT, true); goto undone; } /* * Inform shmem_writepage() how far we have reached. * No need for lock or barrier: we have the page lock. */ shmem_falloc.next++; if (!PageUptodate(page)) shmem_falloc.nr_falloced++; /* * If !PageUptodate, leave it that way so that freeable pages * can be recognized if we need to rollback on error later. * But set_page_dirty so that memory pressure will swap rather * than free the pages we are allocating (and SGP_CACHE pages * might still be clean: we now need to mark those dirty too). */ set_page_dirty(page); unlock_page(page); page_cache_release(page); cond_resched(); } if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > inode->i_size) i_size_write(inode, offset + len); inode->i_ctime = CURRENT_TIME; undone: spin_lock(&inode->i_lock); inode->i_private = NULL; spin_unlock(&inode->i_lock); out: mutex_unlock(&inode->i_mutex); return error; } ",0 "static bool is_empty_dir(struct ctl_table_header *head) { return head->ctl_table[0].child == sysctl_mount_point; } ",0 "static void eventHandlerAttributeAttributeSetter(v8::Local v8Value, const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestInterfaceNode* impl = V8TestInterfaceNode::toImpl(holder); impl->setEventHandlerAttribute(V8EventListenerList::getEventListener(ScriptState::current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)); } ",0 "xfs_da3_node_rebalance( struct xfs_da_state *state, struct xfs_da_state_blk *blk1, struct xfs_da_state_blk *blk2) { struct xfs_da_intnode *node1; struct xfs_da_intnode *node2; struct xfs_da_intnode *tmpnode; struct xfs_da_node_entry *btree1; struct xfs_da_node_entry *btree2; struct xfs_da_node_entry *btree_s; struct xfs_da_node_entry *btree_d; struct xfs_da3_icnode_hdr nodehdr1; struct xfs_da3_icnode_hdr nodehdr2; struct xfs_trans *tp; int count; int tmp; int swap = 0; struct xfs_inode *dp = state->args->dp; trace_xfs_da_node_rebalance(state->args); node1 = blk1->bp->b_addr; node2 = blk2->bp->b_addr; dp->d_ops->node_hdr_from_disk(&nodehdr1, node1); dp->d_ops->node_hdr_from_disk(&nodehdr2, node2); btree1 = dp->d_ops->node_tree_p(node1); btree2 = dp->d_ops->node_tree_p(node2); /* * Figure out how many entries need to move, and in which direction. * Swap the nodes around if that makes it simpler. */ if (nodehdr1.count > 0 && nodehdr2.count > 0 && ((be32_to_cpu(btree2[0].hashval) < be32_to_cpu(btree1[0].hashval)) || (be32_to_cpu(btree2[nodehdr2.count - 1].hashval) < be32_to_cpu(btree1[nodehdr1.count - 1].hashval)))) { tmpnode = node1; node1 = node2; node2 = tmpnode; dp->d_ops->node_hdr_from_disk(&nodehdr1, node1); dp->d_ops->node_hdr_from_disk(&nodehdr2, node2); btree1 = dp->d_ops->node_tree_p(node1); btree2 = dp->d_ops->node_tree_p(node2); swap = 1; } count = (nodehdr1.count - nodehdr2.count) / 2; if (count == 0) return; tp = state->args->trans; /* * Two cases: high-to-low and low-to-high. */ if (count > 0) { /* * Move elements in node2 up to make a hole. */ tmp = nodehdr2.count; if (tmp > 0) { tmp *= (uint)sizeof(xfs_da_node_entry_t); btree_s = &btree2[0]; btree_d = &btree2[count]; memmove(btree_d, btree_s, tmp); } /* * Move the req'd B-tree elements from high in node1 to * low in node2. */ nodehdr2.count += count; tmp = count * (uint)sizeof(xfs_da_node_entry_t); btree_s = &btree1[nodehdr1.count - count]; btree_d = &btree2[0]; memcpy(btree_d, btree_s, tmp); nodehdr1.count -= count; } else { /* * Move the req'd B-tree elements from low in node2 to * high in node1. */ count = -count; tmp = count * (uint)sizeof(xfs_da_node_entry_t); btree_s = &btree2[0]; btree_d = &btree1[nodehdr1.count]; memcpy(btree_d, btree_s, tmp); nodehdr1.count += count; xfs_trans_log_buf(tp, blk1->bp, XFS_DA_LOGRANGE(node1, btree_d, tmp)); /* * Move elements in node2 down to fill the hole. */ tmp = nodehdr2.count - count; tmp *= (uint)sizeof(xfs_da_node_entry_t); btree_s = &btree2[count]; btree_d = &btree2[0]; memmove(btree_d, btree_s, tmp); nodehdr2.count -= count; } /* * Log header of node 1 and all current bits of node 2. */ dp->d_ops->node_hdr_to_disk(node1, &nodehdr1); xfs_trans_log_buf(tp, blk1->bp, XFS_DA_LOGRANGE(node1, &node1->hdr, dp->d_ops->node_hdr_size)); dp->d_ops->node_hdr_to_disk(node2, &nodehdr2); xfs_trans_log_buf(tp, blk2->bp, XFS_DA_LOGRANGE(node2, &node2->hdr, dp->d_ops->node_hdr_size + (sizeof(btree2[0]) * nodehdr2.count))); /* * Record the last hashval from each block for upward propagation. * (note: don't use the swapped node pointers) */ if (swap) { node1 = blk1->bp->b_addr; node2 = blk2->bp->b_addr; dp->d_ops->node_hdr_from_disk(&nodehdr1, node1); dp->d_ops->node_hdr_from_disk(&nodehdr2, node2); btree1 = dp->d_ops->node_tree_p(node1); btree2 = dp->d_ops->node_tree_p(node2); } blk1->hashval = be32_to_cpu(btree1[nodehdr1.count - 1].hashval); blk2->hashval = be32_to_cpu(btree2[nodehdr2.count - 1].hashval); /* * Adjust the expected index for insertion. */ if (blk1->index >= nodehdr1.count) { blk2->index = blk1->index - nodehdr1.count; blk1->index = nodehdr1.count + 1; /* make it invalid */ } } ",0 "Profile* Browser::GetProfile() const { return profile(); } ",0 "static int snd_seq_ioctl_get_subscription(struct snd_seq_client *client, void *arg) { struct snd_seq_port_subscribe *subs = arg; int result; struct snd_seq_client *sender = NULL; struct snd_seq_client_port *sport = NULL; struct snd_seq_subscribers *p; result = -EINVAL; if ((sender = snd_seq_client_use_ptr(subs->sender.client)) == NULL) goto __end; if ((sport = snd_seq_port_use_ptr(sender, subs->sender.port)) == NULL) goto __end; p = snd_seq_port_get_subscription(&sport->c_src, &subs->dest); if (p) { result = 0; *subs = p->info; } else result = -ENOENT; __end: if (sport) snd_seq_port_unlock(sport); if (sender) snd_seq_client_unlock(sender); return result; } ",0 "static inline int deliver_skb(struct sk_buff *skb, struct packet_type *pt_prev, struct net_device *orig_dev) { if (unlikely(skb_orphan_frags_rx(skb, GFP_ATOMIC))) return -ENOMEM; refcount_inc(&skb->users); return pt_prev->func(skb, skb->dev, pt_prev, orig_dev); } ",0 "static loff_t ext4_max_size(int blkbits, int has_huge_files) { loff_t res; loff_t upper_limit = MAX_LFS_FILESIZE; /* small i_blocks in vfs inode? */ if (!has_huge_files || sizeof(blkcnt_t) < sizeof(u64)) { /* * CONFIG_LBDAF is not enabled implies the inode * i_block represent total blocks in 512 bytes * 32 == size of vfs inode i_blocks * 8 */ upper_limit = (1LL << 32) - 1; /* total blocks in file system block size */ upper_limit >>= (blkbits - 9); upper_limit <<= blkbits; } /* 32-bit extent-start container, ee_block */ res = 1LL << 32; res <<= blkbits; res -= 1; /* Sanity check against vm- & vfs- imposed limits */ if (res > upper_limit) res = upper_limit; return res; } ",0 "dtls1_write_message_header(SSL *s, unsigned char *p) { struct hm_header_st *msg_hdr = &s->d1->w_msg_hdr; *p++ = msg_hdr->type; l2n3(msg_hdr->msg_len, p); s2n(msg_hdr->seq, p); l2n3(msg_hdr->frag_off, p); l2n3(msg_hdr->frag_len, p); return p; } ",0 "static struct ip_tunnel __rcu **__ipgre_bucket(struct ipgre_net *ign, struct ip_tunnel_parm *parms) { __be32 remote = parms->iph.daddr; __be32 local = parms->iph.saddr; __be32 key = parms->i_key; unsigned int h = HASH(key); int prio = 0; if (local) prio |= 1; if (remote && !ipv4_is_multicast(remote)) { prio |= 2; h ^= HASH(remote); } return &ign->tunnels[prio][h]; } ",0 "const AtomicString& AXLayoutObject::liveRegionStatus() const { DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusAssertive, (""assertive"")); DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusPolite, (""polite"")); DEFINE_STATIC_LOCAL(const AtomicString, liveRegionStatusOff, (""off"")); const AtomicString& liveRegionStatus = getAOMPropertyOrARIAAttribute(AOMStringProperty::kLive); if (liveRegionStatus.isEmpty()) { switch (roleValue()) { case AlertDialogRole: case AlertRole: return liveRegionStatusAssertive; case LogRole: case StatusRole: return liveRegionStatusPolite; case TimerRole: case MarqueeRole: return liveRegionStatusOff; default: break; } } return liveRegionStatus; } ",0 "bool RenderFlexibleBox::childPreferredMainAxisContentExtentRequiresLayout(RenderBox* child, bool hasInfiniteLineLength) const { return preferredMainAxisExtentDependsOnLayout(flexBasisForChild(child), hasInfiniteLineLength) && hasOrthogonalFlow(child); } ",0 "key_ref_t keyring_search(key_ref_t keyring, struct key_type *type, const char *description) { struct keyring_search_context ctx = { .index_key.type = type, .index_key.description = description, .cred = current_cred(), .match_data.cmp = key_default_cmp, .match_data.raw_data = description, .match_data.lookup_type = KEYRING_SEARCH_LOOKUP_DIRECT, .flags = KEYRING_SEARCH_DO_STATE_CHECK, }; key_ref_t key; int ret; if (type->match_preparse) { ret = type->match_preparse(&ctx.match_data); if (ret < 0) return ERR_PTR(ret); } key = keyring_search_aux(keyring, &ctx); if (type->match_free) type->match_free(&ctx.match_data); return key; } ",0 "ssize_t ne2000_receive(NetClientState *nc, const uint8_t *buf, size_t size_) { NE2000State *s = qemu_get_nic_opaque(nc); int size = size_; uint8_t *p; unsigned int total_len, next, avail, len, index, mcast_idx; uint8_t buf1[60]; static const uint8_t broadcast_macaddr[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; #if defined(DEBUG_NE2000) printf(""NE2000: received len=%d\n"", size); #endif if (s->cmd & E8390_STOP || ne2000_buffer_full(s)) return -1; /* XXX: check this */ if (s->rxcr & 0x10) { /* promiscuous: receive all */ } else { if (!memcmp(buf, broadcast_macaddr, 6)) { /* broadcast address */ if (!(s->rxcr & 0x04)) return size; } else if (buf[0] & 0x01) { /* multicast */ if (!(s->rxcr & 0x08)) return size; mcast_idx = compute_mcast_idx(buf); if (!(s->mult[mcast_idx >> 3] & (1 << (mcast_idx & 7)))) return size; } else if (s->mem[0] == buf[0] && s->mem[2] == buf[1] && s->mem[4] == buf[2] && s->mem[6] == buf[3] && s->mem[8] == buf[4] && s->mem[10] == buf[5]) { /* match */ } else { return size; } } /* if too small buffer, then expand it */ if (size < MIN_BUF_SIZE) { memcpy(buf1, buf, size); memset(buf1 + size, 0, MIN_BUF_SIZE - size); buf = buf1; size = MIN_BUF_SIZE; } index = s->curpag << 8; if (index >= NE2000_PMEM_END) { index = s->start; } /* 4 bytes for header */ total_len = size + 4; /* address for next packet (4 bytes for CRC) */ next = index + ((total_len + 4 + 255) & ~0xff); if (next >= s->stop) next -= (s->stop - s->start); /* prepare packet header */ p = s->mem + index; s->rsr = ENRSR_RXOK; /* receive status */ /* XXX: check this */ if (buf[0] & 0x01) s->rsr |= ENRSR_PHY; p[0] = s->rsr; p[1] = next >> 8; p[2] = total_len; p[3] = total_len >> 8; index += 4; /* write packet data */ while (size > 0) { if (index <= s->stop) avail = s->stop - index; else break; len = size; if (len > avail) len = avail; memcpy(s->mem + index, buf, len); buf += len; index += len; if (index == s->stop) index = s->start; size -= len; } s->curpag = next >> 8; /* now we can signal we have received something */ s->isr |= ENISR_RX; ne2000_update_irq(s); return size_; } ",0 "trace (const char *format, ...) #else trace (format, va_alist) const char *format; va_dcl #endif { va_list args; static FILE *tracefp = (FILE *)NULL; if (tracefp == NULL) tracefp = fopen(""/tmp/bash-trace.log"", ""a+""); if (tracefp == NULL) tracefp = stderr; else fcntl (fileno (tracefp), F_SETFD, 1); /* close-on-exec */ fprintf(tracefp, ""TRACE: pid %ld: "", (long)getpid()); SH_VA_START (args, format); vfprintf (tracefp, format, args); fprintf (tracefp, ""\n""); va_end (args); fflush(tracefp); } ",0 "void hns_ppe_get_strings(struct hns_ppe_cb *ppe_cb, int stringset, u8 *data) { char *buff = (char *)data; int index = ppe_cb->index; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_rx_sw_pkt"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_rx_pkt_ok"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_rx_drop_pkt_no_bd"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_rx_alloc_buf_fail"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_rx_alloc_buf_wait"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_rx_pkt_drop_no_buf"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_rx_pkt_err_fifo_full"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_tx_bd"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_tx_pkt"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_tx_pkt_ok"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_tx_pkt_err_fifo_empty"", index); buff = buff + ETH_GSTRING_LEN; snprintf(buff, ETH_GSTRING_LEN, ""ppe%d_tx_pkt_err_csum_fail"", index); } ",0 "void SyncManager::RemoveObserver(Observer* observer) { DCHECK(thread_checker_.CalledOnValidThread()); data_->RemoveObserver(observer); } ",0 "void RenderFrameHostImpl::OnBeginNavigation( const CommonNavigationParams& common_params, const BeginNavigationParams& begin_params) { CHECK(IsBrowserSideNavigationEnabled()); if (!is_active()) return; CommonNavigationParams validated_params = common_params; GetProcess()->FilterURL(false, &validated_params.url); BeginNavigationParams validated_begin_params = begin_params; GetProcess()->FilterURL(true, &validated_begin_params.searchable_form_url); if (waiting_for_init_) { pendinging_navigate_ = base::MakeUnique( validated_params, validated_begin_params); return; } frame_tree_node()->navigator()->OnBeginNavigation( frame_tree_node(), validated_params, validated_begin_params); } ",0 "void PDFiumEngine::GetPDFiumRect(int page_index, const pp::Rect& rect, int* start_x, int* start_y, int* size_x, int* size_y) const { pp::Rect page_rect = GetScreenRect(pages_[page_index]->rect()); page_rect.Offset(-rect.x(), -rect.y()); *start_x = page_rect.x(); *start_y = page_rect.y(); *size_x = page_rect.width(); *size_y = page_rect.height(); } ",0 "static void _php_curl_set_default_options(php_curl *ch) { char *cainfo; curl_easy_setopt(ch->cp, CURLOPT_NOPROGRESS, 1); curl_easy_setopt(ch->cp, CURLOPT_VERBOSE, 0); curl_easy_setopt(ch->cp, CURLOPT_ERRORBUFFER, ch->err.str); curl_easy_setopt(ch->cp, CURLOPT_WRITEFUNCTION, curl_write); curl_easy_setopt(ch->cp, CURLOPT_FILE, (void *) ch); curl_easy_setopt(ch->cp, CURLOPT_READFUNCTION, curl_read); curl_easy_setopt(ch->cp, CURLOPT_INFILE, (void *) ch); curl_easy_setopt(ch->cp, CURLOPT_HEADERFUNCTION, curl_write_header); curl_easy_setopt(ch->cp, CURLOPT_WRITEHEADER, (void *) ch); #if !defined(ZTS) curl_easy_setopt(ch->cp, CURLOPT_DNS_USE_GLOBAL_CACHE, 1); #endif curl_easy_setopt(ch->cp, CURLOPT_DNS_CACHE_TIMEOUT, 120); curl_easy_setopt(ch->cp, CURLOPT_MAXREDIRS, 20); /* prevent infinite redirects */ cainfo = INI_STR(""openssl.cafile""); if (!(cainfo && cainfo[0] != '\0')) { cainfo = INI_STR(""curl.cainfo""); } if (cainfo && cainfo[0] != '\0') { curl_easy_setopt(ch->cp, CURLOPT_CAINFO, cainfo); } #if defined(ZTS) curl_easy_setopt(ch->cp, CURLOPT_NOSIGNAL, 1); #endif } ",0 "void ExtensionViewGuest::ApplyAttributes(const base::DictionaryValue& params) { std::string src; params.GetString(extensionview::kAttributeSrc, &src); NavigateGuest(src, false /* force_navigation */); } ",0 "EGLNativeWindowType RenderingHelper::PlatformCreateWindow( int top_left_x, int top_left_y) { HWND window = CreateWindowEx(0, L""Static"", L""VideoDecodeAcceleratorTest"", WS_OVERLAPPEDWINDOW | WS_VISIBLE, top_left_x, top_left_y, width_, height_, NULL, NULL, NULL, NULL); CHECK(window != NULL); windows_.push_back(window); return window; } ",0 "static int unlink1(struct usbtest_dev *dev, int pipe, int size, int async) { struct urb *urb; struct completion completion; int retval = 0; init_completion(&completion); urb = simple_alloc_urb(testdev_to_usbdev(dev), pipe, size, 0); if (!urb) return -ENOMEM; urb->context = &completion; urb->complete = unlink1_callback; if (usb_pipeout(urb->pipe)) { simple_fill_buf(urb); urb->transfer_flags |= URB_ZERO_PACKET; } /* keep the endpoint busy. there are lots of hc/hcd-internal * states, and testing should get to all of them over time. * * FIXME want additional tests for when endpoint is STALLing * due to errors, or is just NAKing requests. */ retval = usb_submit_urb(urb, GFP_KERNEL); if (retval != 0) { dev_err(&dev->intf->dev, ""submit fail %d\n"", retval); return retval; } /* unlinking that should always work. variable delay tests more * hcd states and code paths, even with little other system load. */ msleep(jiffies % (2 * INTERRUPT_RATE)); if (async) { while (!completion_done(&completion)) { retval = usb_unlink_urb(urb); if (retval == 0 && usb_pipein(urb->pipe)) retval = simple_check_buf(dev, urb); switch (retval) { case -EBUSY: case -EIDRM: /* we can't unlink urbs while they're completing * or if they've completed, and we haven't * resubmitted. ""normal"" drivers would prevent * resubmission, but since we're testing unlink * paths, we can't. */ ERROR(dev, ""unlink retry\n""); continue; case 0: case -EINPROGRESS: break; default: dev_err(&dev->intf->dev, ""unlink fail %d\n"", retval); return retval; } break; } } else usb_kill_urb(urb); wait_for_completion(&completion); retval = urb->status; simple_free_urb(urb); if (async) return (retval == -ECONNRESET) ? 0 : retval - 1000; else return (retval == -ENOENT || retval == -EPERM) ? 0 : retval - 2000; } ",0 "void PDFiumEngine::GetAllScreenRectsUnion(std::vector* rect_range, const pp::Point& offset_point, std::vector* rect_vector) { for (auto& range : *rect_range) { pp::Rect result_rect; std::vector rects = range.GetScreenRects(offset_point, current_zoom_, current_rotation_); for (const auto& rect : rects) result_rect = result_rect.Union(rect); rect_vector->push_back(result_rect); } } ",0 "std::unique_ptr WebContentsImpl::GetNavigationUIData( NavigationHandle* navigation_handle) { DCHECK(IsBrowserSideNavigationEnabled()); return GetContentClient()->browser()->GetNavigationUIData(navigation_handle); } ",0 "void SoftOpus::onQueueFilled(OMX_U32 portIndex) { List &inQueue = getPortQueue(0); List &outQueue = getPortQueue(1); if (mOutputPortSettingsChange != NONE) { return; } if (portIndex == 0 && mInputBufferCount < 3) { BufferInfo *info = *inQueue.begin(); OMX_BUFFERHEADERTYPE *header = info->mHeader; const uint8_t *data = header->pBuffer + header->nOffset; size_t size = header->nFilledLen; if (mInputBufferCount == 0) { CHECK(mHeader == NULL); mHeader = new OpusHeader(); memset(mHeader, 0, sizeof(*mHeader)); if (!ParseOpusHeader(data, size, mHeader)) { ALOGV(""Parsing Opus Header failed.""); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } uint8_t channel_mapping[kMaxChannels] = {0}; if (mHeader->channels <= kMaxChannelsWithDefaultLayout) { memcpy(&channel_mapping, kDefaultOpusChannelLayout, kMaxChannelsWithDefaultLayout); } else { memcpy(&channel_mapping, mHeader->stream_map, mHeader->channels); } int status = OPUS_INVALID_STATE; mDecoder = opus_multistream_decoder_create(kRate, mHeader->channels, mHeader->num_streams, mHeader->num_coupled, channel_mapping, &status); if (!mDecoder || status != OPUS_OK) { ALOGV(""opus_multistream_decoder_create failed status=%s"", opus_strerror(status)); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } status = opus_multistream_decoder_ctl(mDecoder, OPUS_SET_GAIN(mHeader->gain_db)); if (status != OPUS_OK) { ALOGV(""Failed to set OPUS header gain; status=%s"", opus_strerror(status)); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } } else if (mInputBufferCount == 1) { mCodecDelay = ns_to_samples( *(reinterpret_cast(header->pBuffer + header->nOffset)), kRate); mSamplesToDiscard = mCodecDelay; } else { mSeekPreRoll = ns_to_samples( *(reinterpret_cast(header->pBuffer + header->nOffset)), kRate); notify(OMX_EventPortSettingsChanged, 1, 0, NULL); mOutputPortSettingsChange = AWAITING_DISABLED; } inQueue.erase(inQueue.begin()); info->mOwnedByUs = false; notifyEmptyBufferDone(header); ++mInputBufferCount; return; } while (!inQueue.empty() && !outQueue.empty()) { BufferInfo *inInfo = *inQueue.begin(); OMX_BUFFERHEADERTYPE *inHeader = inInfo->mHeader; if (inHeader->nFlags & OMX_BUFFERFLAG_CODECCONFIG) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); return; } BufferInfo *outInfo = *outQueue.begin(); OMX_BUFFERHEADERTYPE *outHeader = outInfo->mHeader; if (inHeader->nFlags & OMX_BUFFERFLAG_EOS) { inQueue.erase(inQueue.begin()); inInfo->mOwnedByUs = false; notifyEmptyBufferDone(inHeader); outHeader->nFilledLen = 0; outHeader->nFlags = OMX_BUFFERFLAG_EOS; outQueue.erase(outQueue.begin()); outInfo->mOwnedByUs = false; notifyFillBufferDone(outHeader); return; } if (inHeader->nOffset == 0) { mAnchorTimeUs = inHeader->nTimeStamp; mNumFramesOutput = 0; } if (inHeader->nTimeStamp == 0) { mSamplesToDiscard = mCodecDelay; } const uint8_t *data = inHeader->pBuffer + inHeader->nOffset; const uint32_t size = inHeader->nFilledLen; int numFrames = opus_multistream_decode(mDecoder, data, size, (int16_t *)outHeader->pBuffer, kMaxOpusOutputPacketSizeSamples, 0); if (numFrames < 0) { ALOGE(""opus_multistream_decode returned %d"", numFrames); notify(OMX_EventError, OMX_ErrorUndefined, 0, NULL); return; } outHeader->nOffset = 0; if (mSamplesToDiscard > 0) { if (mSamplesToDiscard > numFrames) { mSamplesToDiscard -= numFrames; numFrames = 0; } else { numFrames -= mSamplesToDiscard; outHeader->nOffset = mSamplesToDiscard * sizeof(int16_t) * mHeader->channels; mSamplesToDiscard = 0; } } outHeader->nFilledLen = numFrames * sizeof(int16_t) * mHeader->channels; outHeader->nFlags = 0; outHeader->nTimeStamp = mAnchorTimeUs + (mNumFramesOutput * 1000000ll) / kRate; mNumFramesOutput += numFrames; inInfo->mOwnedByUs = false; inQueue.erase(inQueue.begin()); inInfo = NULL; notifyEmptyBufferDone(inHeader); inHeader = NULL; outInfo->mOwnedByUs = false; outQueue.erase(outQueue.begin()); outInfo = NULL; notifyFillBufferDone(outHeader); outHeader = NULL; ++mInputBufferCount; } } ",0 "static bool ShouldUseFixedPositionCompositing(float device_scale_factor) { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kDisableCompositingForFixedPosition)) return false; if (command_line.HasSwitch(switches::kEnableCompositingForFixedPosition)) return true; if (device_scale_factor > 1.0f && command_line.HasSwitch( switches::kEnableHighDpiCompositingForFixedPosition)) return true; return device_scale_factor > 1.0f; } ",0 "static int local_name_to_path(FsContext *ctx, V9fsPath *dir_path, const char *name, V9fsPath *target) { if (dir_path) { v9fs_path_sprintf(target, ""%s/%s"", dir_path->data, name); } else { v9fs_path_sprintf(target, ""%s"", name); } return 0; } ",1 "bool IsMalformedBlobUrl(const GURL& url) { if (!url.SchemeIsBlob()) return false; std::string canonical_origin = url::Origin::Create(url).Serialize(); canonical_origin.append(1, '/'); if (base::StartsWith(url.GetContent(), canonical_origin, base::CompareCase::INSENSITIVE_ASCII)) return false; return true; } ",0 "DGACreateColormap(int index, ClientPtr client, int id, int mode, int alloc) { ScreenPtr pScreen = screenInfo.screens[index]; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); FakedVisualList *fvlp; VisualPtr pVisual; DGAModePtr pMode; ColormapPtr pmap; if (!mode || (mode > pScreenPriv->numModes)) return BadValue; if ((alloc != AllocNone) && (alloc != AllocAll)) return BadValue; pMode = &(pScreenPriv->modes[mode - 1]); if (!(pVisual = malloc(sizeof(VisualRec)))) return BadAlloc; pVisual->vid = FakeClientID(0); pVisual->class = pMode->visualClass; pVisual->nplanes = pMode->depth; pVisual->ColormapEntries = 1 << pMode->depth; pVisual->bitsPerRGBValue = (pMode->depth + 2) / 3; switch (pVisual->class) { case PseudoColor: case GrayScale: case StaticGray: pVisual->bitsPerRGBValue = 8; /* not quite */ pVisual->redMask = 0; pVisual->greenMask = 0; pVisual->blueMask = 0; pVisual->offsetRed = 0; pVisual->offsetGreen = 0; pVisual->offsetBlue = 0; break; case DirectColor: case TrueColor: pVisual->ColormapEntries = 1 << pVisual->bitsPerRGBValue; /* fall through */ case StaticColor: pVisual->redMask = pMode->red_mask; pVisual->greenMask = pMode->green_mask; pVisual->blueMask = pMode->blue_mask; pVisual->offsetRed = BitsClear(pVisual->redMask); pVisual->offsetGreen = BitsClear(pVisual->greenMask); pVisual->offsetBlue = BitsClear(pVisual->blueMask); } if (!(fvlp = malloc(sizeof(FakedVisualList)))) { free(pVisual); return BadAlloc; } fvlp->free = FALSE; fvlp->pVisual = pVisual; fvlp->next = pScreenPriv->fakedVisuals; pScreenPriv->fakedVisuals = fvlp; LEGAL_NEW_RESOURCE(id, client); return CreateColormap(id, pScreen, pVisual, &pmap, alloc, client->index); } ",0 "int XfrmController::fillUserSaId(const XfrmId& record, xfrm_usersa_id* said) { said->daddr = record.dstAddr; said->spi = record.spi; said->family = record.addrFamily; said->proto = IPPROTO_ESP; return sizeof(*said); } ",0 "void LayerTreeHostImpl::UpdateAnimationState(bool start_ready_animations) { std::unique_ptr events = mutator_host_->CreateEvents(); const bool has_active_animations = mutator_host_->UpdateAnimationState(start_ready_animations, events.get()); if (!events->IsEmpty()) client_->PostAnimationEventsToMainThreadOnImplThread(std::move(events)); if (has_active_animations) SetNeedsOneBeginImplFrame(); } ",0 "Chapters::Atom::~Atom() {} ",0 "box_eq(PG_FUNCTION_ARGS) { BOX *box1 = PG_GETARG_BOX_P(0); BOX *box2 = PG_GETARG_BOX_P(1); PG_RETURN_BOOL(FPeq(box_ar(box1), box_ar(box2))); } ",0 "XML_SetDefaultHandler(XML_Parser parser, XML_DefaultHandler handler) { if (parser == NULL) return; parser->m_defaultHandler = handler; parser->m_defaultExpandInternalEntities = XML_FALSE; } ",0 "static void updateLogicalWidthForCenterAlignedBlock(bool isLeftToRightDirection, BidiRun* trailingSpaceRun, float& logicalLeft, float& totalLogicalWidth, float availableLogicalWidth) { float trailingSpaceWidth = 0; if (trailingSpaceRun) { totalLogicalWidth -= trailingSpaceRun->m_box->logicalWidth(); trailingSpaceWidth = min(trailingSpaceRun->m_box->logicalWidth(), (availableLogicalWidth - totalLogicalWidth + 1) / 2); trailingSpaceRun->m_box->setLogicalWidth(max(0, trailingSpaceWidth)); } if (isLeftToRightDirection) logicalLeft += max((availableLogicalWidth - totalLogicalWidth) / 2, 0); else logicalLeft += totalLogicalWidth > availableLogicalWidth ? (availableLogicalWidth - totalLogicalWidth) : (availableLogicalWidth - totalLogicalWidth) / 2 - trailingSpaceWidth; } ",0 " void Cancel() { controller_ = NULL; } ",0 "static int sd_revalidate_disk(struct gendisk *disk) { struct scsi_disk *sdkp = scsi_disk(disk); struct scsi_device *sdp = sdkp->device; unsigned char *buffer; unsigned flush = 0; SCSI_LOG_HLQUEUE(3, sd_printk(KERN_INFO, sdkp, ""sd_revalidate_disk\n"")); /* * If the device is offline, don't try and read capacity or any * of the other niceties. */ if (!scsi_device_online(sdp)) goto out; buffer = kmalloc(SD_BUF_SIZE, GFP_KERNEL); if (!buffer) { sd_printk(KERN_WARNING, sdkp, ""sd_revalidate_disk: Memory "" ""allocation failure.\n""); goto out; } sd_spinup_disk(sdkp); /* * Without media there is no reason to ask; moreover, some devices * react badly if we do. */ if (sdkp->media_present) { sd_read_capacity(sdkp, buffer); if (sd_try_extended_inquiry(sdp)) { sd_read_block_provisioning(sdkp); sd_read_block_limits(sdkp); sd_read_block_characteristics(sdkp); } sd_read_write_protect_flag(sdkp, buffer); sd_read_cache_type(sdkp, buffer); sd_read_app_tag_own(sdkp, buffer); } sdkp->first_scan = 0; /* * We now have all cache related info, determine how we deal * with flush requests. */ if (sdkp->WCE) { flush |= REQ_FLUSH; if (sdkp->DPOFUA) flush |= REQ_FUA; } blk_queue_flush(sdkp->disk->queue, flush); set_capacity(disk, sdkp->capacity); kfree(buffer); out: return 0; } ",0 "static int evr_active(struct task_struct *target, const struct user_regset *regset) { flush_spe_to_thread(target); return target->thread.used_spe ? regset->n : 0; } ",0 "bool HTMLInputElement::IsURLAttribute(const Attribute& attribute) const { return attribute.GetName() == srcAttr || attribute.GetName() == formactionAttr || TextControlElement::IsURLAttribute(attribute); } ",0 "static __poll_t sock_poll(struct file *file, poll_table *wait) { struct socket *sock = file->private_data; __poll_t events = poll_requested_events(wait), mask = 0; if (sock->ops->poll) { sock_poll_busy_loop(sock, events); mask = sock->ops->poll(file, sock, wait); } else if (sock->ops->poll_mask) { sock_poll_wait(file, sock_get_poll_head(file, events), wait); mask = sock->ops->poll_mask(sock, events); } return mask | sock_poll_busy_flag(sock); } ",0 "void V8TestObject::VoidMethodTestInterfaceEmptyArgOptionalLongArgMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_voidMethodTestInterfaceEmptyArgOptionalLongArg""); test_object_v8_internal::VoidMethodTestInterfaceEmptyArgOptionalLongArgMethod(info); } ",0 "const AtomicString& DocumentLoader::RequiredCSP() { return GetFrameLoader().RequiredCSP(); } ",0 "gs_makepixmappattern( gs_client_color * pcc, const gs_depth_bitmap * pbitmap, bool mask, const gs_matrix * pmat, long id, gs_color_space * pcspace, uint white_index, gs_gstate * pgs, gs_memory_t * mem ) { gs_pattern1_template_t pat; pixmap_info *ppmap; gs_matrix mat, smat; int code; /* check that the data is legitimate */ if ((mask) || (pcspace == 0)) { if (pbitmap->pix_depth != 1) return_error(gs_error_rangecheck); pcspace = 0; } else if (gs_color_space_get_index(pcspace) != gs_color_space_index_Indexed) return_error(gs_error_rangecheck); if (pbitmap->num_comps != 1) return_error(gs_error_rangecheck); /* allocate and initialize a pixmap_info structure for the paint proc */ if (mem == 0) mem = gs_gstate_memory(pgs); ppmap = gs_alloc_struct(mem, pixmap_info, &st_pixmap_info, ""makepximappattern"" ); if (ppmap == 0) return_error(gs_error_VMerror); ppmap->bitmap = *pbitmap; ppmap->pcspace = pcspace; ppmap->white_index = white_index; /* set up the client pattern structure */ gs_pattern1_init(&pat); uid_set_UniqueID(&pat.uid, (id == no_UniqueID) ? gs_next_ids(mem, 1) : id); pat.PaintType = (mask ? 2 : 1); pat.TilingType = 1; pat.BBox.p.x = 0; pat.BBox.p.y = 0; pat.BBox.q.x = pbitmap->size.x; pat.BBox.q.y = pbitmap->size.y; pat.XStep = (float)pbitmap->size.x; pat.YStep = (float)pbitmap->size.y; pat.PaintProc = (mask ? pixmap_remap_mask_pattern : pixmap_remap_image_pattern); pat.client_data = ppmap; /* set the ctm to be the identity */ gs_currentmatrix(pgs, &smat); gs_make_identity(&mat); gs_setmatrix(pgs, &mat); /* build the pattern, restore the previous matrix */ if (pmat == NULL) pmat = &mat; if ((code = gs_makepattern(pcc, &pat, pmat, pgs, mem)) != 0) gs_free_object(mem, ppmap, ""makebitmappattern_xform""); else { /* * If this is not a masked pattern and if the white pixel index * is outside of the representable range, we don't need to go to * the trouble of accumulating a mask that will just be all 1s. * Also, patterns that use transparency don't need a mask since * the alpha plane of the transparency buffers will be used. */ gs_pattern1_instance_t *pinst = (gs_pattern1_instance_t *)pcc->pattern; if (!mask && (white_index >= (1 << pbitmap->pix_depth))) pinst->uses_mask = false; /* overwrite the free procedure for the pattern instance */ ppmap->free_proc = pinst->rc.free; pinst->rc.free = free_pixmap_pattern; /* * Since the PaintProcs don't reference the saved color space or * color, clear these so that there isn't an extra retained * reference to the Pattern object. */ code = gs_setgray(pinst->saved, 0.0); } gs_setmatrix(pgs, &smat); return code; } ",0 "png_set_sRGB(png_structp png_ptr, png_infop info_ptr, int intent) { png_debug1(1, ""in %s storage function"", ""sRGB""); if (png_ptr == NULL || info_ptr == NULL) return; info_ptr->srgb_intent = (png_byte)intent; info_ptr->valid |= PNG_INFO_sRGB; } ",0 "void bta_av_rc_meta_rsp(tBTA_AV_CB* p_cb, tBTA_AV_DATA* p_data) { tBTA_AV_RCB* p_rcb; bool do_free = true; if ((p_cb->features & BTA_AV_FEAT_METADATA) && (p_data->hdr.layer_specific < BTA_AV_NUM_RCB)) { if ((p_data->api_meta_rsp.is_rsp && (p_cb->features & BTA_AV_FEAT_RCTG)) || (!p_data->api_meta_rsp.is_rsp && (p_cb->features & BTA_AV_FEAT_RCCT))) { p_rcb = &p_cb->rcb[p_data->hdr.layer_specific]; if (p_rcb->handle != BTA_AV_RC_HANDLE_NONE) { AVRC_MsgReq(p_rcb->handle, p_data->api_meta_rsp.label, p_data->api_meta_rsp.rsp_code, p_data->api_meta_rsp.p_pkt); do_free = false; } } } if (do_free) osi_free_and_reset((void**)&p_data->api_meta_rsp.p_pkt); } ",0 "bool IsComponentCoveredByLang(const icu::UnicodeSet& component_characters, const std::string& lang) { static const icu::UnicodeSet kASCIILetters(0x61, 0x7a); // [a-z] icu::UnicodeSet* lang_set; { AutoLock lock(lang_set_lock); if (!GetExemplarSetForLang(lang, &lang_set)) { UErrorCode status = U_ZERO_ERROR; ULocaleData* uld = ulocdata_open(lang.c_str(), &status); if (U_SUCCESS(status) && status != U_USING_DEFAULT_WARNING) { lang_set = reinterpret_cast( ulocdata_getExemplarSet(uld, NULL, 0, ULOCDATA_ES_STANDARD, &status)); if (IsCompatibleWithASCIILetters(lang)) lang_set->addAll(kASCIILetters); } else { lang_set = new icu::UnicodeSet(1, 0); } lang_set->freeze(); SetExemplarSetForLang(lang, lang_set); ulocdata_close(uld); } } return !lang_set->isEmpty() && lang_set->containsAll(component_characters); } ",0 "static void free_request_size(void *element, void *data) { struct request_queue *q = data; if (q->exit_rq_fn) q->exit_rq_fn(q, element); kfree(element); } ",0 "void CSoundFile::Tremolo(ModChannel *pChn, uint32 param) const { if (param & 0x0F) pChn->nTremoloDepth = (param & 0x0F) << 2; if (param & 0xF0) pChn->nTremoloSpeed = (param >> 4) & 0x0F; pChn->dwFlags.set(CHN_TREMOLO); } ",0 "static int pegasus_close(struct net_device *net) { pegasus_t *pegasus = netdev_priv(net); netif_stop_queue(net); if (!(pegasus->flags & PEGASUS_UNPLUG)) disable_net_traffic(pegasus); tasklet_kill(&pegasus->rx_tl); unlink_all_urbs(pegasus); return 0; } ",0 " void set_accelerator_pressed_count(int accelerator_pressed_count) { accelerator_pressed_count_ = accelerator_pressed_count; } ",0 "static void rds6_tcp_tc_info(struct socket *sock, unsigned int len, struct rds_info_iterator *iter, struct rds_info_lengths *lens) { struct rds6_info_tcp_socket tsinfo6; struct rds_tcp_connection *tc; unsigned long flags; spin_lock_irqsave(&rds_tcp_tc_list_lock, flags); if (len / sizeof(tsinfo6) < rds6_tcp_tc_count) goto out; list_for_each_entry(tc, &rds_tcp_tc_list, t_list_item) { struct sock *sk = tc->t_sock->sk; struct inet_sock *inet = inet_sk(sk); tsinfo6.local_addr = sk->sk_v6_rcv_saddr; tsinfo6.local_port = inet->inet_sport; tsinfo6.peer_addr = sk->sk_v6_daddr; tsinfo6.peer_port = inet->inet_dport; tsinfo6.hdr_rem = tc->t_tinc_hdr_rem; tsinfo6.data_rem = tc->t_tinc_data_rem; tsinfo6.last_sent_nxt = tc->t_last_sent_nxt; tsinfo6.last_expected_una = tc->t_last_expected_una; tsinfo6.last_seen_una = tc->t_last_seen_una; rds_info_copy(iter, &tsinfo6, sizeof(tsinfo6)); } out: lens->nr = rds6_tcp_tc_count; lens->each = sizeof(tsinfo6); spin_unlock_irqrestore(&rds_tcp_tc_list_lock, flags); } ",0 "gst_asf_demux_process_queued_extended_stream_objects (GstASFDemux * demux) { GSList *l; guint i; /* Parse the queued extended stream property objects and add the info * to the existing streams or add the new embedded streams, but without * activating them yet */ GST_LOG_OBJECT (demux, ""%u queued extended stream properties objects"", g_slist_length (demux->ext_stream_props)); for (l = demux->ext_stream_props, i = 0; l != NULL; l = l->next, ++i) { GstBuffer *buf = GST_BUFFER (l->data); GstMapInfo map; gst_buffer_map (buf, &map, GST_MAP_READ); GST_LOG_OBJECT (demux, ""parsing ext. stream properties object #%u"", i); gst_asf_demux_process_ext_stream_props (demux, map.data, map.size); gst_buffer_unmap (buf, &map); gst_buffer_unref (buf); } g_slist_free (demux->ext_stream_props); demux->ext_stream_props = NULL; } ",0 "static int plug_ctx_cmp(void *priv, struct list_head *a, struct list_head *b) { struct request *rqa = container_of(a, struct request, queuelist); struct request *rqb = container_of(b, struct request, queuelist); return !(rqa->mq_ctx < rqb->mq_ctx || (rqa->mq_ctx == rqb->mq_ctx && blk_rq_pos(rqa) < blk_rq_pos(rqb))); } ",0 "void RenderFrameHostImpl::SwapOut( RenderFrameProxyHost* proxy, bool is_loading) { TRACE_EVENT_ASYNC_BEGIN1(""navigation"", ""RenderFrameHostImpl::SwapOut"", this, ""frame_tree_node"", frame_tree_node_->frame_tree_node_id()); if (!is_active()) { NOTREACHED() << ""RFH should be in default state when calling SwapOut.""; return; } if (swapout_event_monitor_timeout_) { swapout_event_monitor_timeout_->Start(base::TimeDelta::FromMilliseconds( RenderViewHostImpl::kUnloadTimeoutMS)); } CHECK(proxy); if (IsRenderFrameLive()) { FrameReplicationState replication_state = proxy->frame_tree_node()->current_replication_state(); Send(new FrameMsg_SwapOut(routing_id_, proxy->GetRoutingID(), is_loading, replication_state)); } if (web_ui()) web_ui()->RenderFrameHostSwappingOut(); is_waiting_for_swapout_ack_ = true; if (frame_tree_node_->IsMainFrame()) render_view_host_->set_is_active(false); } ",0 "void WebPageProxy::hideFindUI() { process()->send(Messages::WebPage::HideFindUI(), m_pageID); } ",0 "bool Document::isInMainFrame() const { return frame() && frame()->isMainFrame(); } ",0 "osf_fix_iov_len(const struct iovec __user *iov, unsigned long count) { unsigned long i; for (i = 0 ; i < count ; i++) { int __user *iov_len_high = (int __user *)&iov[i].iov_len + 1; if (put_user(0, iov_len_high)) return -EFAULT; } return 0; } ",0 "PHP_FUNCTION(radius_cvt_addr) { const void *data; char *addr_dot; int len; struct in_addr addr; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &data, &len) == FAILURE) { return; } addr = rad_cvt_addr(data); addr_dot = inet_ntoa(addr); RETURN_STRINGL(addr_dot, strlen(addr_dot), 1); } ",0 " void OpenDevToolsWindow(const std::string& test_page) { ASSERT_TRUE(test_server()->Start()); GURL url = test_server()->GetURL(test_page); ui_test_utils::NavigateToURL(browser(), url); inspected_rvh_ = GetInspectedTab()->render_view_host(); DevToolsManager* devtools_manager = DevToolsManager::GetInstance(); devtools_manager->OpenDevToolsWindow(inspected_rvh_); DevToolsClientHost* client_host = devtools_manager->GetDevToolsClientHostFor(inspected_rvh_); window_ = client_host->AsDevToolsWindow(); RenderViewHost* client_rvh = window_->GetRenderViewHost(); client_contents_ = client_rvh->delegate()->GetAsTabContents(); ui_test_utils::WaitForNavigation(&client_contents_->controller()); } ",0 " void FrameImpl::CreateView( fidl::InterfaceRequest view_owner, fidl::InterfaceRequest services) { ui::PlatformWindowInitProperties properties; properties.view_owner_request = std::move(view_owner); window_tree_host_ = std::make_unique(std::move(properties)); window_tree_host_->InitHost(); window_tree_host_->window()->SetLayoutManager(new LayoutManagerImpl()); window_tree_host_->window()->AddChild(web_contents_->GetNativeView()); window_tree_host_->window()->Show(); window_tree_host_->Show(); web_contents_->GetNativeView()->Show(); } ",0 "bool Contains(const Collection& collection, const Key& key) { return std::find(collection.begin(), collection.end(), key) != collection.end(); } ",0 "CURLcode Curl_init_do(struct Curl_easy *data, struct connectdata *conn) { struct SingleRequest *k = &data->req; if(conn) { conn->bits.do_more = FALSE; /* by default there's no curl_do_more() to use */ /* if the protocol used doesn't support wildcards, switch it off */ if(data->state.wildcardmatch && !(conn->handler->flags & PROTOPT_WILDCARD)) data->state.wildcardmatch = FALSE; } data->state.done = FALSE; /* *_done() is not called yet */ data->state.expect100header = FALSE; if(data->set.opt_no_body) /* in HTTP lingo, no body means using the HEAD request... */ data->set.httpreq = HTTPREQ_HEAD; else if(HTTPREQ_HEAD == data->set.httpreq) /* ... but if unset there really is no perfect method that is the ""opposite"" of HEAD but in reality most people probably think GET then. The important thing is that we can't let it remain HEAD if the opt_no_body is set FALSE since then we'll behave wrong when getting HTTP. */ data->set.httpreq = HTTPREQ_GET; k->start = Curl_now(); /* start time */ k->now = k->start; /* current time is now */ k->header = TRUE; /* assume header */ k->bytecount = 0; k->buf = data->state.buffer; k->hbufp = data->state.headerbuff; k->ignorebody = FALSE; Curl_speedinit(data); Curl_pgrsSetUploadCounter(data, 0); Curl_pgrsSetDownloadCounter(data, 0); return CURLE_OK; } ",0 "WebMediaPlayer* RenderFrameImpl::CreateWebMediaPlayerForMediaStream( WebMediaPlayerClient* client) { #if defined(ENABLE_WEBRTC) #if defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) bool found_neon = (android_getCpuFeatures() & ANDROID_CPU_ARM_FEATURE_NEON) != 0; UMA_HISTOGRAM_BOOLEAN(""Platform.WebRtcNEONFound"", found_neon); #endif // defined(OS_ANDROID) && defined(ARCH_CPU_ARMEL) return new WebMediaPlayerMS(frame_, client, weak_factory_.GetWeakPtr(), new RenderMediaLog(), CreateRendererFactory()); #else return NULL; #endif // defined(ENABLE_WEBRTC) } ",0 "static int ecryptfs_fasync(int fd, struct file *file, int flag) { int rc = 0; struct file *lower_file = NULL; lower_file = ecryptfs_file_to_lower(file); if (lower_file->f_op->fasync) rc = lower_file->f_op->fasync(fd, lower_file, flag); return rc; } ",0 "PHP_FUNCTION(openssl_csr_sign) { zval ** zcert = NULL, **zcsr, **zpkey, *args = NULL; long num_days; long serial = 0L; X509 * cert = NULL, *new_cert = NULL; X509_REQ * csr; EVP_PKEY * key = NULL, *priv_key = NULL; long csr_resource, certresource = 0, keyresource = -1; int i; struct php_x509_request req; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""ZZ!Zl|a!l"", &zcsr, &zcert, &zpkey, &num_days, &args, &serial) == FAILURE) return; RETVAL_FALSE; PHP_SSL_REQ_INIT(&req); csr = php_openssl_csr_from_zval(zcsr, 0, &csr_resource TSRMLS_CC); if (csr == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""cannot get CSR from parameter 1""); return; } if (zcert) { cert = php_openssl_x509_from_zval(zcert, 0, &certresource TSRMLS_CC); if (cert == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""cannot get cert from parameter 2""); goto cleanup; } } priv_key = php_openssl_evp_from_zval(zpkey, 0, """", 1, &keyresource TSRMLS_CC); if (priv_key == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""cannot get private key from parameter 3""); goto cleanup; } if (cert && !X509_check_private_key(cert, priv_key)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""private key does not correspond to signing cert""); goto cleanup; } if (PHP_SSL_REQ_PARSE(&req, args) == FAILURE) { goto cleanup; } /* Check that the request matches the signature */ key = X509_REQ_get_pubkey(csr); if (key == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""error unpacking public key""); goto cleanup; } i = X509_REQ_verify(csr, key); if (i < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Signature verification problems""); goto cleanup; } else if (i == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Signature did not match the certificate request""); goto cleanup; } /* Now we can get on with it */ new_cert = X509_new(); if (new_cert == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""No memory""); goto cleanup; } /* Version 3 cert */ if (!X509_set_version(new_cert, 2)) goto cleanup; ASN1_INTEGER_set(X509_get_serialNumber(new_cert), serial); X509_set_subject_name(new_cert, X509_REQ_get_subject_name(csr)); if (cert == NULL) { cert = new_cert; } if (!X509_set_issuer_name(new_cert, X509_get_subject_name(cert))) { goto cleanup; } X509_gmtime_adj(X509_get_notBefore(new_cert), 0); X509_gmtime_adj(X509_get_notAfter(new_cert), (long)60*60*24*num_days); i = X509_set_pubkey(new_cert, key); if (!i) { goto cleanup; } if (req.extensions_section) { X509V3_CTX ctx; X509V3_set_ctx(&ctx, cert, new_cert, csr, NULL, 0); X509V3_set_conf_lhash(&ctx, req.req_config); if (!X509V3_EXT_add_conf(req.req_config, &ctx, req.extensions_section, new_cert)) { goto cleanup; } } /* Now sign it */ if (!X509_sign(new_cert, priv_key, req.digest)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""failed to sign it""); goto cleanup; } /* Succeeded; lets return the cert */ RETVAL_RESOURCE(zend_list_insert(new_cert, le_x509 TSRMLS_CC)); new_cert = NULL; cleanup: if (cert == new_cert) { cert = NULL; } PHP_SSL_REQ_DISPOSE(&req); if (keyresource == -1 && priv_key) { EVP_PKEY_free(priv_key); } if (key) { EVP_PKEY_free(key); } if (csr_resource == -1 && csr) { X509_REQ_free(csr); } if (certresource == -1 && cert) { X509_free(cert); } if (new_cert) { X509_free(new_cert); } } ",0 "static int php_curl_ssl_mutex_unlock(void **m) { return tsrm_mutex_unlock(*((MUTEX_T *) m)); } ",0 "void TabStrip::StoppedDraggingTab(Tab* tab, bool* is_first_tab) { int tab_data_index = GetModelIndexOfTab(tab); if (tab_data_index == -1) { return; } if (*is_first_tab) { *is_first_tab = false; PrepareForAnimation(); GenerateIdealBounds(); AnimateToIdealBounds(); } bounds_animator_.AnimateViewTo(tab, ideal_bounds(tab_data_index)); bounds_animator_.SetAnimationDelegate( tab, new ResetDraggingStateDelegate(tab), true); } ",0 "static PHP_NAMED_FUNCTION(zif_zip_read) { zval *zip_dp; zip_read_rsrc *zr_rsrc; int ret; zip_rsrc *rsrc_int; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &zip_dp) == FAILURE) { return; } ZEND_FETCH_RESOURCE(rsrc_int, zip_rsrc *, &zip_dp, -1, le_zip_dir_name, le_zip_dir); if (rsrc_int && rsrc_int->za) { if (rsrc_int->index_current >= rsrc_int->num_files) { RETURN_FALSE; } zr_rsrc = emalloc(sizeof(zip_read_rsrc)); ret = zip_stat_index(rsrc_int->za, rsrc_int->index_current, 0, &zr_rsrc->sb); if (ret != 0) { efree(zr_rsrc); RETURN_FALSE; } zr_rsrc->zf = zip_fopen_index(rsrc_int->za, rsrc_int->index_current, 0); if (zr_rsrc->zf) { rsrc_int->index_current++; ZEND_REGISTER_RESOURCE(return_value, zr_rsrc, le_zip_entry); } else { efree(zr_rsrc); RETURN_FALSE; } } else { RETURN_FALSE; } } ",0 "void BN_set_negative(BIGNUM *a, int b) { if (b && !BN_is_zero(a)) a->neg = 1; else a->neg = 0; } ",0 "void ParamTraits::Log(const param_type& p, std::string* l) { l->append(p); } ",0 "static Image *ReadMVGImage(const ImageInfo *image_info,ExceptionInfo *exception) { #define BoundingBox ""viewbox"" DrawInfo *draw_info; Image *image; MagickBooleanType status; /* Open image. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } if ((image->columns == 0) || (image->rows == 0)) { char primitive[MaxTextExtent]; register char *p; SegmentInfo bounds; /* Determine size of image canvas. */ while (ReadBlobString(image,primitive) != (char *) NULL) { for (p=primitive; (*p == ' ') || (*p == '\t'); p++) ; if (LocaleNCompare(BoundingBox,p,strlen(BoundingBox)) != 0) continue; (void) sscanf(p,""viewbox %lf %lf %lf %lf"",&bounds.x1,&bounds.y1, &bounds.x2,&bounds.y2); image->columns=(size_t) floor((bounds.x2-bounds.x1)+0.5); image->rows=(size_t) floor((bounds.y2-bounds.y1)+0.5); break; } } if ((image->columns == 0) || (image->rows == 0)) ThrowReaderException(OptionError,""MustSpecifyImageSize""); draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL); draw_info->affine.sx=image->x_resolution == 0.0 ? 1.0 : image->x_resolution/ DefaultResolution; draw_info->affine.sy=image->y_resolution == 0.0 ? 1.0 : image->y_resolution/ DefaultResolution; image->columns=(size_t) (draw_info->affine.sx*image->columns); image->rows=(size_t) (draw_info->affine.sy*image->rows); if (SetImageBackgroundColor(image) == MagickFalse) { InheritException(exception,&image->exception); image=DestroyImageList(image); return((Image *) NULL); } /* Render drawing. */ if (GetBlobStreamData(image) == (unsigned char *) NULL) draw_info->primitive=FileToString(image->filename,~0UL,exception); else { draw_info->primitive=(char *) AcquireMagickMemory(GetBlobSize(image)+1); if (draw_info->primitive != (char *) NULL) { CopyMagickMemory(draw_info->primitive,GetBlobStreamData(image), GetBlobSize(image)); draw_info->primitive[GetBlobSize(image)]='\0'; } } (void) DrawImage(image,draw_info); draw_info=DestroyDrawInfo(draw_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "htmlParseFile(const char *filename, const char *encoding) { return(htmlSAXParseFile(filename, encoding, NULL, NULL)); } ",0 "bool DownloadItemImpl::IsValidStateTransition(DownloadInternalState from, DownloadInternalState to) { #if DCHECK_IS_ON() switch (from) { case INITIAL_INTERNAL: return to == TARGET_PENDING_INTERNAL || to == INTERRUPTED_TARGET_PENDING_INTERNAL; case TARGET_PENDING_INTERNAL: return to == INTERRUPTED_TARGET_PENDING_INTERNAL || to == TARGET_RESOLVED_INTERNAL || to == CANCELLED_INTERNAL; case INTERRUPTED_TARGET_PENDING_INTERNAL: return to == TARGET_RESOLVED_INTERNAL || to == CANCELLED_INTERNAL; case TARGET_RESOLVED_INTERNAL: return to == IN_PROGRESS_INTERNAL || to == INTERRUPTED_INTERNAL || to == CANCELLED_INTERNAL; case IN_PROGRESS_INTERNAL: return to == COMPLETING_INTERNAL || to == CANCELLED_INTERNAL || to == INTERRUPTED_INTERNAL; case COMPLETING_INTERNAL: return to == COMPLETE_INTERNAL; case COMPLETE_INTERNAL: return false; case INTERRUPTED_INTERNAL: return to == RESUMING_INTERNAL || to == CANCELLED_INTERNAL; case RESUMING_INTERNAL: return to == TARGET_PENDING_INTERNAL || to == INTERRUPTED_TARGET_PENDING_INTERNAL || to == TARGET_RESOLVED_INTERNAL || to == CANCELLED_INTERNAL; case CANCELLED_INTERNAL: return false; case MAX_DOWNLOAD_INTERNAL_STATE: NOTREACHED(); } return false; #else return true; #endif // DCHECK_IS_ON() } ",0 "static void pdf_run_BX(fz_context *ctx, pdf_processor *proc) { } ",0 "smb2_echo_callback(struct mid_q_entry *mid) { struct TCP_Server_Info *server = mid->callback_data; struct smb2_echo_rsp *rsp = (struct smb2_echo_rsp *)mid->resp_buf; struct cifs_credits credits = { .value = 0, .instance = 0 }; if (mid->mid_state == MID_RESPONSE_RECEIVED || mid->mid_state == MID_RESPONSE_MALFORMED) { credits.value = le16_to_cpu(rsp->sync_hdr.CreditRequest); credits.instance = server->reconnect_instance; } DeleteMidQEntry(mid); add_credits(server, &credits, CIFS_ECHO_OP); } ",0 "void vp8cx_init_de_quantizer(VP8D_COMP *pbi) { int Q; VP8_COMMON *const pc = & pbi->common; for (Q = 0; Q < QINDEX_RANGE; Q++) { pc->Y1dequant[Q][0] = (short)vp8_dc_quant(Q, pc->y1dc_delta_q); pc->Y2dequant[Q][0] = (short)vp8_dc2quant(Q, pc->y2dc_delta_q); pc->UVdequant[Q][0] = (short)vp8_dc_uv_quant(Q, pc->uvdc_delta_q); pc->Y1dequant[Q][1] = (short)vp8_ac_yquant(Q); pc->Y2dequant[Q][1] = (short)vp8_ac2quant(Q, pc->y2ac_delta_q); pc->UVdequant[Q][1] = (short)vp8_ac_uv_quant(Q, pc->uvac_delta_q); } } ",0 "static void anotherStringAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueString(info, imp->fastGetAttribute(HTMLNames::ReflectUrlAttributeAsAStringAttr), info.GetIsolate()); } ",0 "void Browser::NavigationStateChanged(WebContents* source, content::InvalidateTypes changed_flags) { if (changed_flags) ScheduleUIUpdate(source, changed_flags); if (changed_flags & (content::INVALIDATE_TYPE_URL | content::INVALIDATE_TYPE_LOAD | content::INVALIDATE_TYPE_TAB)) command_controller_->TabStateChanged(); if (hosted_app_controller_) hosted_app_controller_->UpdateLocationBarVisibility(true); } ",0 "void WebGLRenderingContextBase::TexImageByGPU( TexImageFunctionID function_id, WebGLTexture* texture, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, CanvasImageSource* image, const IntRect& source_sub_rectangle) { DCHECK(image->IsCanvasElement() || image->IsImageBitmap()); int width = source_sub_rectangle.Width(); int height = source_sub_rectangle.Height(); ScopedTexture2DRestorer restorer(this); GLuint target_texture = texture->Object(); bool possible_direct_copy = false; if (function_id == kTexImage2D || function_id == kTexSubImage2D) { possible_direct_copy = Extensions3DUtil::CanUseCopyTextureCHROMIUM(target); } GLint copy_x_offset = xoffset; GLint copy_y_offset = yoffset; GLenum copy_target = target; if (!possible_direct_copy) { ContextGL()->GenTextures(1, &target_texture); ContextGL()->BindTexture(GL_TEXTURE_2D, target_texture); ContextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); ContextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); ContextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); ContextGL()->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); ContextGL()->TexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); copy_x_offset = 0; copy_y_offset = 0; copy_target = GL_TEXTURE_2D; } { ScopedUnpackParametersResetRestore temporaryResetUnpack(this); if (image->IsCanvasElement()) { TexImageCanvasByGPU(function_id, static_cast(image), copy_target, target_texture, copy_x_offset, copy_y_offset, source_sub_rectangle); } else { TexImageBitmapByGPU(static_cast(image), copy_target, target_texture, copy_x_offset, copy_y_offset, source_sub_rectangle); } } if (!possible_direct_copy) { GLuint tmp_fbo; ContextGL()->GenFramebuffers(1, &tmp_fbo); ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, tmp_fbo); ContextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, target_texture, 0); ContextGL()->BindTexture(texture->GetTarget(), texture->Object()); if (function_id == kTexImage2D) { ContextGL()->CopyTexSubImage2D(target, level, 0, 0, 0, 0, width, height); } else if (function_id == kTexSubImage2D) { ContextGL()->CopyTexSubImage2D(target, level, xoffset, yoffset, 0, 0, width, height); } else if (function_id == kTexSubImage3D) { ContextGL()->CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, 0, 0, width, height); } ContextGL()->FramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0); RestoreCurrentFramebuffer(); ContextGL()->DeleteFramebuffers(1, &tmp_fbo); ContextGL()->DeleteTextures(1, &target_texture); } } ",0 " vpx_codec_err_t SetFrameBufferFunctions( int num_buffers, vpx_get_frame_buffer_cb_fn_t cb_get, vpx_release_frame_buffer_cb_fn_t cb_release) { if (num_buffers > 0) { num_buffers_ = num_buffers; EXPECT_TRUE(fb_list_.CreateBufferList(num_buffers_)); } return decoder_->SetFrameBufferFunctions(cb_get, cb_release, &fb_list_); } ",0 "tvsub(register struct timeval *out, register struct timeval *in) { if((out->tv_usec -= in->tv_usec) < 0) { out->tv_sec--; out->tv_usec += 1000000; } out->tv_sec -= in->tv_sec; } ",0 "static int prb_curr_blk_in_use(struct tpacket_block_desc *pbd) { return TP_STATUS_USER & BLOCK_STATUS(pbd); } ",0 "g_NPN_Invoke(NPP instance, NPObject *npobj, NPIdentifier methodName, const NPVariant *args, uint32_t argCount, NPVariant *result) { if (!thread_check()) { npw_printf(""WARNING: NPN_Invoke not called from the main thread\n""); return false; } if (instance == NULL) return false; PluginInstance *plugin = PLUGIN_INSTANCE(instance); if (plugin == NULL) return false; if (!npobj || !npobj->_class || !npobj->_class->invoke) return false; D(bugiI(""NPN_Invoke instance=%p, npobj=%p, methodName=%p\n"", instance, npobj, methodName)); print_npvariant_args(args, argCount); npw_plugin_instance_ref(plugin); bool ret = invoke_NPN_Invoke(plugin, npobj, methodName, args, argCount, result); npw_plugin_instance_unref(plugin); gchar *result_str = string_of_NPVariant(result); D(bugiD(""NPN_Invoke return: %d (%s)\n"", ret, result_str)); g_free(result_str); return ret; } ",0 "bool OSExchangeDataProviderAura::GetString(base::string16* data) const { if ((formats_ & OSExchangeData::STRING) == 0) return false; *data = string_; return true; } ",0 "ZEND_API int zend_eval_string(char *str, zval *retval_ptr, char *string_name) /* {{{ */ { return zend_eval_stringl(str, strlen(str), retval_ptr, string_name); } /* }}} */ ",0 "static inline void vmsvga_check_size(struct vmsvga_state_s *s) { DisplaySurface *surface = qemu_console_surface(s->vga.con); if (s->new_width != surface_width(surface) || s->new_height != surface_height(surface) || s->new_depth != surface_bits_per_pixel(surface)) { int stride = (s->new_depth * s->new_width) / 8; pixman_format_code_t format = qemu_default_pixman_format(s->new_depth, true); trace_vmware_setmode(s->new_width, s->new_height, s->new_depth); surface = qemu_create_displaysurface_from(s->new_width, s->new_height, format, stride, s->vga.vram_ptr); dpy_gfx_replace_surface(s->vga.con, surface); s->invalidated = 1; } } ",0 "nfs4_state_set_mode_locked(struct nfs4_state *state, mode_t mode) { if (state->state == mode) return; /* NB! List reordering - see the reclaim code for why. */ if ((mode & FMODE_WRITE) != (state->state & FMODE_WRITE)) { if (mode & FMODE_WRITE) list_move(&state->open_states, &state->owner->so_states); else list_move_tail(&state->open_states, &state->owner->so_states); } state->state = mode; } ",1 " explicit DeferredTaskPopupListSelectSingle(WebPagePrivate* webPagePrivate, int index) : DeferredTaskType(webPagePrivate) { webPagePrivate->m_cachedPopupListSelectedIndex = index; } ",0 "ppmd_free(void *p, void *address) { (void)p; free(address); } ",0 "int snd_pcm_hw_constraint_mask64(struct snd_pcm_runtime *runtime, snd_pcm_hw_param_t var, u_int64_t mask) { struct snd_pcm_hw_constraints *constrs = &runtime->hw_constraints; struct snd_mask *maskp = constrs_mask(constrs, var); maskp->bits[0] &= (u_int32_t)mask; maskp->bits[1] &= (u_int32_t)(mask >> 32); memset(maskp->bits + 2, 0, (SNDRV_MASK_MAX-64) / 8); /* clear rest */ if (! maskp->bits[0] && ! maskp->bits[1]) return -EINVAL; return 0; } ",0 "void Browser::TabContentsFocused(TabContents* tab_content) { window_->TabContentsFocused(tab_content); } ",0 "static void ecryptfs_free_kmem_caches(void) { int i; for (i = 0; i < ARRAY_SIZE(ecryptfs_cache_infos); i++) { struct ecryptfs_cache_info *info; info = &ecryptfs_cache_infos[i]; if (*(info->cache)) kmem_cache_destroy(*(info->cache)); } } ",0 "long ext4_fallocate(struct file *file, int mode, loff_t offset, loff_t len) { struct inode *inode = file_inode(file); loff_t new_size = 0; unsigned int max_blocks; int ret = 0; int flags; ext4_lblk_t lblk; unsigned int blkbits = inode->i_blkbits; /* * Encrypted inodes can't handle collapse range or insert * range since we would need to re-encrypt blocks with a * different IV or XTS tweak (which are based on the logical * block number). * * XXX It's not clear why zero range isn't working, but we'll * leave it disabled for encrypted inodes for now. This is a * bug we should fix.... */ if (ext4_encrypted_inode(inode) && (mode & (FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_INSERT_RANGE | FALLOC_FL_ZERO_RANGE))) return -EOPNOTSUPP; /* Return error if mode is not supported */ if (mode & ~(FALLOC_FL_KEEP_SIZE | FALLOC_FL_PUNCH_HOLE | FALLOC_FL_COLLAPSE_RANGE | FALLOC_FL_ZERO_RANGE | FALLOC_FL_INSERT_RANGE)) return -EOPNOTSUPP; if (mode & FALLOC_FL_PUNCH_HOLE) return ext4_punch_hole(inode, offset, len); ret = ext4_convert_inline_data(inode); if (ret) return ret; if (mode & FALLOC_FL_COLLAPSE_RANGE) return ext4_collapse_range(inode, offset, len); if (mode & FALLOC_FL_INSERT_RANGE) return ext4_insert_range(inode, offset, len); if (mode & FALLOC_FL_ZERO_RANGE) return ext4_zero_range(file, offset, len, mode); trace_ext4_fallocate_enter(inode, offset, len, mode); lblk = offset >> blkbits; /* * We can't just convert len to max_blocks because * If blocksize = 4096 offset = 3072 and len = 2048 */ max_blocks = (EXT4_BLOCK_ALIGN(len + offset, blkbits) >> blkbits) - lblk; flags = EXT4_GET_BLOCKS_CREATE_UNWRIT_EXT; if (mode & FALLOC_FL_KEEP_SIZE) flags |= EXT4_GET_BLOCKS_KEEP_SIZE; mutex_lock(&inode->i_mutex); /* * We only support preallocation for extent-based files only */ if (!(ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS))) { ret = -EOPNOTSUPP; goto out; } if (!(mode & FALLOC_FL_KEEP_SIZE) && offset + len > i_size_read(inode)) { new_size = offset + len; ret = inode_newsize_ok(inode, new_size); if (ret) goto out; } ret = ext4_alloc_file_blocks(file, lblk, max_blocks, new_size, flags, mode); if (ret) goto out; if (file->f_flags & O_SYNC && EXT4_SB(inode->i_sb)->s_journal) { ret = jbd2_complete_transaction(EXT4_SB(inode->i_sb)->s_journal, EXT4_I(inode)->i_sync_tid); } out: mutex_unlock(&inode->i_mutex); trace_ext4_fallocate_exit(inode, offset, max_blocks, ret); return ret; } ",0 "static void f_midi_in_tasklet(unsigned long data) { struct f_midi *midi = (struct f_midi *) data; f_midi_transmit(midi); } ",0 "epass2003_sm_wrap_apdu(struct sc_card *card, struct sc_apdu *plain, struct sc_apdu *sm) { unsigned char buf[4096] = { 0 }; /* APDU buffer */ size_t buf_len = sizeof(buf); epass2003_exdata *exdata = NULL; if (!card->drv_data) return SC_ERROR_INVALID_ARGUMENTS; exdata = (epass2003_exdata *)card->drv_data; LOG_FUNC_CALLED(card->ctx); if (exdata->sm) plain->cla |= 0x0C; sm->cse = plain->cse; sm->cla = plain->cla; sm->ins = plain->ins; sm->p1 = plain->p1; sm->p2 = plain->p2; sm->lc = plain->lc; sm->le = plain->le; sm->control = plain->control; sm->flags = plain->flags; switch (sm->cla & 0x0C) { case 0x00: case 0x04: sm->datalen = plain->datalen; memcpy((void *)sm->data, plain->data, plain->datalen); sm->resplen = plain->resplen; memcpy(sm->resp, plain->resp, plain->resplen); break; case 0x0C: memset(buf, 0, sizeof(buf)); if (0 != encode_apdu(card, plain, sm, buf, &buf_len)) return SC_ERROR_CARD_CMD_FAILED; break; default: return SC_ERROR_INCORRECT_PARAMETERS; } return SC_SUCCESS; } ",0 "static HTC_SEND_FULL_ACTION ar6000_tx_queue_full(void *Context, struct htc_packet *pPacket) { struct ar6_softc *ar = (struct ar6_softc *)Context; HTC_SEND_FULL_ACTION action = HTC_SEND_FULL_KEEP; bool stopNet = false; HTC_ENDPOINT_ID Endpoint = HTC_GET_ENDPOINT_FROM_PKT(pPacket); do { if (bypasswmi) { int accessClass; if (HTC_GET_TAG_FROM_PKT(pPacket) == AR6K_CONTROL_PKT_TAG) { /* don't drop special control packets */ break; } accessClass = arEndpoint2Ac(ar,Endpoint); /* for endpoint ping testing drop Best Effort and Background */ if ((accessClass == WMM_AC_BE) || (accessClass == WMM_AC_BK)) { action = HTC_SEND_FULL_DROP; stopNet = false; } else { /* keep but stop the netqueues */ stopNet = true; } break; } if (Endpoint == ar->arControlEp) { /* under normal WMI if this is getting full, then something is running rampant * the host should not be exhausting the WMI queue with too many commands * the only exception to this is during testing using endpointping */ AR6000_SPIN_LOCK(&ar->arLock, 0); /* set flag to handle subsequent messages */ ar->arWMIControlEpFull = true; AR6000_SPIN_UNLOCK(&ar->arLock, 0); AR_DEBUG_PRINTF(ATH_DEBUG_ERR,(""WMI Control Endpoint is FULL!!! \n"")); /* no need to stop the network */ stopNet = false; break; } /* if we get here, we are dealing with data endpoints getting full */ if (HTC_GET_TAG_FROM_PKT(pPacket) == AR6K_CONTROL_PKT_TAG) { /* don't drop control packets issued on ANY data endpoint */ break; } if (ar->arNetworkType == ADHOC_NETWORK) { /* in adhoc mode, we cannot differentiate traffic priorities so there is no need to * continue, however we should stop the network */ stopNet = true; break; } /* the last MAX_HI_COOKIE_NUM ""batch"" of cookies are reserved for the highest * active stream */ if (ar->arAcStreamPriMap[arEndpoint2Ac(ar,Endpoint)] < ar->arHiAcStreamActivePri && ar->arCookieCount <= MAX_HI_COOKIE_NUM) { /* this stream's priority is less than the highest active priority, we * give preference to the highest priority stream by directing * HTC to drop the packet that overflowed */ action = HTC_SEND_FULL_DROP; /* since we are dropping packets, no need to stop the network */ stopNet = false; break; } } while (false); if (stopNet) { AR6000_SPIN_LOCK(&ar->arLock, 0); ar->arNetQueueStopped = true; AR6000_SPIN_UNLOCK(&ar->arLock, 0); /* one of the data endpoints queues is getting full..need to stop network stack * the queue will resume in ar6000_tx_complete() */ netif_stop_queue(ar->arNetDev); } return action; } ",0 "cifs_find_fid_lock_conflict(struct cifs_fid_locks *fdlocks, __u64 offset, __u64 length, __u8 type, struct cifsFileInfo *cfile, struct cifsLockInfo **conf_lock, int rw_check) { struct cifsLockInfo *li; struct cifsFileInfo *cur_cfile = fdlocks->cfile; struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; list_for_each_entry(li, &fdlocks->locks, llist) { if (offset + length <= li->offset || offset >= li->offset + li->length) continue; if (rw_check != CIFS_LOCK_OP && current->tgid == li->pid && server->ops->compare_fids(cfile, cur_cfile)) { /* shared lock prevents write op through the same fid */ if (!(li->type & server->vals->shared_lock_type) || rw_check != CIFS_WRITE_OP) continue; } if ((type & server->vals->shared_lock_type) && ((server->ops->compare_fids(cfile, cur_cfile) && current->tgid == li->pid) || type == li->type)) continue; if (conf_lock) *conf_lock = li; return true; } return false; } ",0 "static inline size_t php_mb3_int_to_char(unsigned char *buf, unsigned k) { assert(k <= 0xFFFFFFU); /* one to three bytes */ if (k <= 0xFFU) { /* 1 */ buf[0] = k; return 1U; } else if (k <= 0xFFFFU) { /* 2 */ buf[0] = k >> 8; buf[1] = k & 0xFFU; return 2U; } else { buf[0] = k >> 16; buf[1] = (k >> 8) & 0xFFU; buf[2] = k & 0xFFU; return 3U; } } ",0 " GpuChannelHost::GpuChannelHost( GpuChannelHostFactory* factory, int gpu_process_id, int client_id) : factory_(factory), gpu_process_id_(gpu_process_id), client_id_(client_id), state_(kUnconnected) { } ",1 "BlockEntry::Kind BlockGroup::GetKind() const { return kBlockGroup; } ",0 "static void bond_add_vlans_on_slave(struct bonding *bond, struct net_device *slave_dev) { struct vlan_entry *vlan; const struct net_device_ops *slave_ops = slave_dev->netdev_ops; if (!(slave_dev->features & NETIF_F_HW_VLAN_FILTER) || !(slave_ops->ndo_vlan_rx_add_vid)) return; list_for_each_entry(vlan, &bond->vlan_list, vlan_list) slave_ops->ndo_vlan_rx_add_vid(slave_dev, vlan->vlan_id); } ",0 "void AppLayerProtoDetectUnittestsRegister(void) { SCEnter(); UtRegisterTest(""AppLayerProtoDetectTest01"", AppLayerProtoDetectTest01); UtRegisterTest(""AppLayerProtoDetectTest02"", AppLayerProtoDetectTest02); UtRegisterTest(""AppLayerProtoDetectTest03"", AppLayerProtoDetectTest03); UtRegisterTest(""AppLayerProtoDetectTest04"", AppLayerProtoDetectTest04); UtRegisterTest(""AppLayerProtoDetectTest05"", AppLayerProtoDetectTest05); UtRegisterTest(""AppLayerProtoDetectTest06"", AppLayerProtoDetectTest06); UtRegisterTest(""AppLayerProtoDetectTest07"", AppLayerProtoDetectTest07); UtRegisterTest(""AppLayerProtoDetectTest08"", AppLayerProtoDetectTest08); UtRegisterTest(""AppLayerProtoDetectTest09"", AppLayerProtoDetectTest09); UtRegisterTest(""AppLayerProtoDetectTest10"", AppLayerProtoDetectTest10); UtRegisterTest(""AppLayerProtoDetectTest11"", AppLayerProtoDetectTest11); UtRegisterTest(""AppLayerProtoDetectTest12"", AppLayerProtoDetectTest12); UtRegisterTest(""AppLayerProtoDetectTest13"", AppLayerProtoDetectTest13); UtRegisterTest(""AppLayerProtoDetectTest14"", AppLayerProtoDetectTest14); UtRegisterTest(""AppLayerProtoDetectTest15"", AppLayerProtoDetectTest15); UtRegisterTest(""AppLayerProtoDetectTest16"", AppLayerProtoDetectTest16); UtRegisterTest(""AppLayerProtoDetectTest17"", AppLayerProtoDetectTest17); UtRegisterTest(""AppLayerProtoDetectTest18"", AppLayerProtoDetectTest18); UtRegisterTest(""AppLayerProtoDetectTest19"", AppLayerProtoDetectTest19); SCReturn; } ",0 "void HTMLMediaElement::SetTextTrackKindUserPreferenceForAllMediaElements( Document* document) { auto it = DocumentToElementSetMap().find(document); if (it == DocumentToElementSetMap().end()) return; DCHECK(it->value); WeakMediaElementSet& elements = *it->value; for (const auto& element : elements) element->AutomaticTrackSelectionForUpdatedUserPreference(); } ",0 "int lzxd_decompress(struct lzxd_stream *lzx, off_t out_bytes) { /* bitstream and huffman reading variables */ register unsigned int bit_buffer; register int bits_left, i=0; unsigned char *i_ptr, *i_end; register unsigned short sym; int match_length, length_footer, extra, verbatim_bits, bytes_todo; int this_run, main_element, aligned_bits, j; unsigned char *window, *runsrc, *rundest, buf[12]; unsigned int frame_size=0, end_frame, match_offset, window_posn; unsigned int R0, R1, R2; /* easy answers */ if (!lzx || (out_bytes < 0)) return MSPACK_ERR_ARGS; if (lzx->error) return lzx->error; /* flush out any stored-up bytes before we begin */ i = lzx->o_end - lzx->o_ptr; if ((off_t) i > out_bytes) i = (int) out_bytes; if (i) { if (lzx->sys->write(lzx->output, lzx->o_ptr, i) != i) { return lzx->error = MSPACK_ERR_WRITE; } lzx->o_ptr += i; lzx->offset += i; out_bytes -= i; } if (out_bytes == 0) return MSPACK_ERR_OK; /* restore local state */ RESTORE_BITS; window = lzx->window; window_posn = lzx->window_posn; R0 = lzx->R0; R1 = lzx->R1; R2 = lzx->R2; end_frame = (unsigned int)((lzx->offset + out_bytes) / LZX_FRAME_SIZE) + 1; while (lzx->frame < end_frame) { /* have we reached the reset interval? (if there is one?) */ if (lzx->reset_interval && ((lzx->frame % lzx->reset_interval) == 0)) { if (lzx->block_remaining) { D((""%d bytes remaining at reset interval"", lzx->block_remaining)) return lzx->error = MSPACK_ERR_DECRUNCH; } /* re-read the intel header and reset the huffman lengths */ lzxd_reset_state(lzx); R0 = lzx->R0; R1 = lzx->R1; R2 = lzx->R2; } /* LZX DELTA format has chunk_size, not present in LZX format */ if (lzx->is_delta) { ENSURE_BITS(16); REMOVE_BITS(16); } /* read header if necessary */ if (!lzx->header_read) { /* read 1 bit. if bit=0, intel filesize = 0. * if bit=1, read intel filesize (32 bits) */ j = 0; READ_BITS(i, 1); if (i) { READ_BITS(i, 16); READ_BITS(j, 16); } lzx->intel_filesize = (i << 16) | j; lzx->header_read = 1; } /* calculate size of frame: all frames are 32k except the final frame * which is 32kb or less. this can only be calculated when lzx->length * has been filled in. */ frame_size = LZX_FRAME_SIZE; if (lzx->length && (lzx->length - lzx->offset) < (off_t)frame_size) { frame_size = lzx->length - lzx->offset; } /* decode until one more frame is available */ bytes_todo = lzx->frame_posn + frame_size - window_posn; while (bytes_todo > 0) { /* initialise new block, if one is needed */ if (lzx->block_remaining == 0) { /* realign if previous block was an odd-sized UNCOMPRESSED block */ if ((lzx->block_type == LZX_BLOCKTYPE_UNCOMPRESSED) && (lzx->block_length & 1)) { READ_IF_NEEDED; i_ptr++; } /* read block type (3 bits) and block length (24 bits) */ READ_BITS(lzx->block_type, 3); READ_BITS(i, 16); READ_BITS(j, 8); lzx->block_remaining = lzx->block_length = (i << 8) | j; /*D((""new block t%d len %u"", lzx->block_type, lzx->block_length))*/ /* read individual block headers */ switch (lzx->block_type) { case LZX_BLOCKTYPE_ALIGNED: /* read lengths of and build aligned huffman decoding tree */ for (i = 0; i < 8; i++) { READ_BITS(j, 3); lzx->ALIGNED_len[i] = j; } BUILD_TABLE(ALIGNED); /* no break -- rest of aligned header is same as verbatim */ case LZX_BLOCKTYPE_VERBATIM: /* read lengths of and build main huffman decoding tree */ READ_LENGTHS(MAINTREE, 0, 256); READ_LENGTHS(MAINTREE, 256, LZX_NUM_CHARS + lzx->num_offsets); BUILD_TABLE(MAINTREE); /* if the literal 0xE8 is anywhere in the block... */ if (lzx->MAINTREE_len[0xE8] != 0) lzx->intel_started = 1; /* read lengths of and build lengths huffman decoding tree */ READ_LENGTHS(LENGTH, 0, LZX_NUM_SECONDARY_LENGTHS); BUILD_TABLE_MAYBE_EMPTY(LENGTH); break; case LZX_BLOCKTYPE_UNCOMPRESSED: /* because we can't assume otherwise */ lzx->intel_started = 1; /* read 1-16 (not 0-15) bits to align to bytes */ ENSURE_BITS(16); if (bits_left > 16) i_ptr -= 2; bits_left = 0; bit_buffer = 0; /* read 12 bytes of stored R0 / R1 / R2 values */ for (rundest = &buf[0], i = 0; i < 12; i++) { READ_IF_NEEDED; *rundest++ = *i_ptr++; } R0 = buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); R1 = buf[4] | (buf[5] << 8) | (buf[6] << 16) | (buf[7] << 24); R2 = buf[8] | (buf[9] << 8) | (buf[10] << 16) | (buf[11] << 24); break; default: D((""bad block type"")) return lzx->error = MSPACK_ERR_DECRUNCH; } } /* decode more of the block: * run = min(what's available, what's needed) */ this_run = lzx->block_remaining; if (this_run > bytes_todo) this_run = bytes_todo; /* assume we decode exactly this_run bytes, for now */ bytes_todo -= this_run; lzx->block_remaining -= this_run; /* decode at least this_run bytes */ switch (lzx->block_type) { case LZX_BLOCKTYPE_VERBATIM: while (this_run > 0) { READ_HUFFSYM(MAINTREE, main_element); if (main_element < LZX_NUM_CHARS) { /* literal: 0 to LZX_NUM_CHARS-1 */ window[window_posn++] = main_element; this_run--; } else { /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */ main_element -= LZX_NUM_CHARS; /* get match length */ match_length = main_element & LZX_NUM_PRIMARY_LENGTHS; if (match_length == LZX_NUM_PRIMARY_LENGTHS) { if (lzx->LENGTH_empty) { D((""LENGTH symbol needed but tree is empty"")) return lzx->error = MSPACK_ERR_DECRUNCH; } READ_HUFFSYM(LENGTH, length_footer); match_length += length_footer; } match_length += LZX_MIN_MATCH; /* get match offset */ switch ((match_offset = (main_element >> 3))) { case 0: match_offset = R0; break; case 1: match_offset = R1; R1=R0; R0 = match_offset; break; case 2: match_offset = R2; R2=R0; R0 = match_offset; break; case 3: match_offset = 1; R2=R1; R1=R0; R0 = match_offset; break; default: extra = (match_offset >= 36) ? 17 : extra_bits[match_offset]; READ_BITS(verbatim_bits, extra); match_offset = position_base[match_offset] - 2 + verbatim_bits; R2 = R1; R1 = R0; R0 = match_offset; } /* LZX DELTA uses max match length to signal even longer match */ if (match_length == LZX_MAX_MATCH && lzx->is_delta) { int extra_len = 0; ENSURE_BITS(3); /* 4 entry huffman tree */ if (PEEK_BITS(1) == 0) { REMOVE_BITS(1); /* '0' -> 8 extra length bits */ READ_BITS(extra_len, 8); } else if (PEEK_BITS(2) == 2) { REMOVE_BITS(2); /* '10' -> 10 extra length bits + 0x100 */ READ_BITS(extra_len, 10); extra_len += 0x100; } else if (PEEK_BITS(3) == 6) { REMOVE_BITS(3); /* '110' -> 12 extra length bits + 0x500 */ READ_BITS(extra_len, 12); extra_len += 0x500; } else { REMOVE_BITS(3); /* '111' -> 15 extra length bits */ READ_BITS(extra_len, 15); } match_length += extra_len; } if ((window_posn + match_length) > lzx->window_size) { D((""match ran over window wrap"")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* copy match */ rundest = &window[window_posn]; i = match_length; /* does match offset wrap the window? */ if (match_offset > window_posn) { if (match_offset > lzx->offset && (match_offset - window_posn) > lzx->ref_data_size) { D((""match offset beyond LZX stream"")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* j = length from match offset to end of window */ j = match_offset - window_posn; if (j > (int) lzx->window_size) { D((""match offset beyond window boundaries"")) return lzx->error = MSPACK_ERR_DECRUNCH; } runsrc = &window[lzx->window_size - j]; if (j < i) { /* if match goes over the window edge, do two copy runs */ i -= j; while (j-- > 0) *rundest++ = *runsrc++; runsrc = window; } while (i-- > 0) *rundest++ = *runsrc++; } else { runsrc = rundest - match_offset; while (i-- > 0) *rundest++ = *runsrc++; } this_run -= match_length; window_posn += match_length; } } /* while (this_run > 0) */ break; case LZX_BLOCKTYPE_ALIGNED: while (this_run > 0) { READ_HUFFSYM(MAINTREE, main_element); if (main_element < LZX_NUM_CHARS) { /* literal: 0 to LZX_NUM_CHARS-1 */ window[window_posn++] = main_element; this_run--; } else { /* match: LZX_NUM_CHARS + ((slot<<3) | length_header (3 bits)) */ main_element -= LZX_NUM_CHARS; /* get match length */ match_length = main_element & LZX_NUM_PRIMARY_LENGTHS; if (match_length == LZX_NUM_PRIMARY_LENGTHS) { if (lzx->LENGTH_empty) { D((""LENGTH symbol needed but tree is empty"")) return lzx->error = MSPACK_ERR_DECRUNCH; } READ_HUFFSYM(LENGTH, length_footer); match_length += length_footer; } match_length += LZX_MIN_MATCH; /* get match offset */ switch ((match_offset = (main_element >> 3))) { case 0: match_offset = R0; break; case 1: match_offset = R1; R1 = R0; R0 = match_offset; break; case 2: match_offset = R2; R2 = R0; R0 = match_offset; break; default: extra = (match_offset >= 36) ? 17 : extra_bits[match_offset]; match_offset = position_base[match_offset] - 2; if (extra > 3) { /* verbatim and aligned bits */ extra -= 3; READ_BITS(verbatim_bits, extra); match_offset += (verbatim_bits << 3); READ_HUFFSYM(ALIGNED, aligned_bits); match_offset += aligned_bits; } else if (extra == 3) { /* aligned bits only */ READ_HUFFSYM(ALIGNED, aligned_bits); match_offset += aligned_bits; } else if (extra > 0) { /* extra==1, extra==2 */ /* verbatim bits only */ READ_BITS(verbatim_bits, extra); match_offset += verbatim_bits; } else /* extra == 0 */ { /* ??? not defined in LZX specification! */ match_offset = 1; } /* update repeated offset LRU queue */ R2 = R1; R1 = R0; R0 = match_offset; } /* LZX DELTA uses max match length to signal even longer match */ if (match_length == LZX_MAX_MATCH && lzx->is_delta) { int extra_len = 0; ENSURE_BITS(3); /* 4 entry huffman tree */ if (PEEK_BITS(1) == 0) { REMOVE_BITS(1); /* '0' -> 8 extra length bits */ READ_BITS(extra_len, 8); } else if (PEEK_BITS(2) == 2) { REMOVE_BITS(2); /* '10' -> 10 extra length bits + 0x100 */ READ_BITS(extra_len, 10); extra_len += 0x100; } else if (PEEK_BITS(3) == 6) { REMOVE_BITS(3); /* '110' -> 12 extra length bits + 0x500 */ READ_BITS(extra_len, 12); extra_len += 0x500; } else { REMOVE_BITS(3); /* '111' -> 15 extra length bits */ READ_BITS(extra_len, 15); } match_length += extra_len; } if ((window_posn + match_length) > lzx->window_size) { D((""match ran over window wrap"")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* copy match */ rundest = &window[window_posn]; i = match_length; /* does match offset wrap the window? */ if (match_offset > window_posn) { if (match_offset > lzx->offset && (match_offset - window_posn) > lzx->ref_data_size) { D((""match offset beyond LZX stream"")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* j = length from match offset to end of window */ j = match_offset - window_posn; if (j > (int) lzx->window_size) { D((""match offset beyond window boundaries"")) return lzx->error = MSPACK_ERR_DECRUNCH; } runsrc = &window[lzx->window_size - j]; if (j < i) { /* if match goes over the window edge, do two copy runs */ i -= j; while (j-- > 0) *rundest++ = *runsrc++; runsrc = window; } while (i-- > 0) *rundest++ = *runsrc++; } else { runsrc = rundest - match_offset; while (i-- > 0) *rundest++ = *runsrc++; } this_run -= match_length; window_posn += match_length; } } /* while (this_run > 0) */ break; case LZX_BLOCKTYPE_UNCOMPRESSED: /* as this_run is limited not to wrap a frame, this also means it * won't wrap the window (as the window is a multiple of 32k) */ rundest = &window[window_posn]; window_posn += this_run; while (this_run > 0) { if ((i = i_end - i_ptr) == 0) { READ_IF_NEEDED; } else { if (i > this_run) i = this_run; lzx->sys->copy(i_ptr, rundest, (size_t) i); rundest += i; i_ptr += i; this_run -= i; } } break; default: return lzx->error = MSPACK_ERR_DECRUNCH; /* might as well */ } /* did the final match overrun our desired this_run length? */ if (this_run < 0) { if ((unsigned int)(-this_run) > lzx->block_remaining) { D((""overrun went past end of block by %d (%d remaining)"", -this_run, lzx->block_remaining )) return lzx->error = MSPACK_ERR_DECRUNCH; } lzx->block_remaining -= -this_run; } } /* while (bytes_todo > 0) */ /* streams don't extend over frame boundaries */ if ((window_posn - lzx->frame_posn) != frame_size) { D((""decode beyond output frame limits! %d != %d"", window_posn - lzx->frame_posn, frame_size)) return lzx->error = MSPACK_ERR_DECRUNCH; } /* re-align input bitstream */ if (bits_left > 0) ENSURE_BITS(16); if (bits_left & 15) REMOVE_BITS(bits_left & 15); /* check that we've used all of the previous frame first */ if (lzx->o_ptr != lzx->o_end) { D((""%ld avail bytes, new %d frame"", (long)(lzx->o_end - lzx->o_ptr), frame_size)) return lzx->error = MSPACK_ERR_DECRUNCH; } /* does this intel block _really_ need decoding? */ if (lzx->intel_started && lzx->intel_filesize && (lzx->frame <= 32768) && (frame_size > 10)) { unsigned char *data = &lzx->e8_buf[0]; unsigned char *dataend = &lzx->e8_buf[frame_size - 10]; signed int curpos = lzx->intel_curpos; signed int filesize = lzx->intel_filesize; signed int abs_off, rel_off; /* copy e8 block to the e8 buffer and tweak if needed */ lzx->o_ptr = data; lzx->sys->copy(&lzx->window[lzx->frame_posn], data, frame_size); while (data < dataend) { if (*data++ != 0xE8) { curpos++; continue; } abs_off = data[0] | (data[1]<<8) | (data[2]<<16) | (data[3]<<24); if ((abs_off >= -curpos) && (abs_off < filesize)) { rel_off = (abs_off >= 0) ? abs_off - curpos : abs_off + filesize; data[0] = (unsigned char) rel_off; data[1] = (unsigned char) (rel_off >> 8); data[2] = (unsigned char) (rel_off >> 16); data[3] = (unsigned char) (rel_off >> 24); } data += 4; curpos += 5; } lzx->intel_curpos += frame_size; } else { lzx->o_ptr = &lzx->window[lzx->frame_posn]; if (lzx->intel_filesize) lzx->intel_curpos += frame_size; } lzx->o_end = &lzx->o_ptr[frame_size]; /* write a frame */ i = (out_bytes < (off_t)frame_size) ? (unsigned int)out_bytes : frame_size; if (lzx->sys->write(lzx->output, lzx->o_ptr, i) != i) { return lzx->error = MSPACK_ERR_WRITE; } lzx->o_ptr += i; lzx->offset += i; out_bytes -= i; /* advance frame start position */ lzx->frame_posn += frame_size; lzx->frame++; /* wrap window / frame position pointers */ if (window_posn == lzx->window_size) window_posn = 0; if (lzx->frame_posn == lzx->window_size) lzx->frame_posn = 0; } /* while (lzx->frame < end_frame) */ if (out_bytes) { D((""bytes left to output"")) return lzx->error = MSPACK_ERR_DECRUNCH; } /* store local state */ STORE_BITS; lzx->window_posn = window_posn; lzx->R0 = R0; lzx->R1 = R1; lzx->R2 = R2; return MSPACK_ERR_OK; } ",1 "static long sctp_get_port_local(struct sock *sk, union sctp_addr *addr) { struct sctp_bind_hashbucket *head; /* hash list */ struct sctp_bind_bucket *pp; /* hash list port iterator */ struct hlist_node *node; unsigned short snum; int ret; snum = ntohs(addr->v4.sin_port); SCTP_DEBUG_PRINTK(""sctp_get_port() begins, snum=%d\n"", snum); sctp_local_bh_disable(); if (snum == 0) { /* Search for an available port. */ int low, high, remaining, index; unsigned int rover; inet_get_local_port_range(&low, &high); remaining = (high - low) + 1; rover = net_random() % remaining + low; do { rover++; if ((rover < low) || (rover > high)) rover = low; if (inet_is_reserved_local_port(rover)) continue; index = sctp_phashfn(sock_net(sk), rover); head = &sctp_port_hashtable[index]; sctp_spin_lock(&head->lock); sctp_for_each_hentry(pp, node, &head->chain) if ((pp->port == rover) && net_eq(sock_net(sk), pp->net)) goto next; break; next: sctp_spin_unlock(&head->lock); } while (--remaining > 0); /* Exhausted local port range during search? */ ret = 1; if (remaining <= 0) goto fail; /* OK, here is the one we will use. HEAD (the port * hash table list entry) is non-NULL and we hold it's * mutex. */ snum = rover; } else { /* We are given an specific port number; we verify * that it is not being used. If it is used, we will * exahust the search in the hash list corresponding * to the port number (snum) - we detect that with the * port iterator, pp being NULL. */ head = &sctp_port_hashtable[sctp_phashfn(sock_net(sk), snum)]; sctp_spin_lock(&head->lock); sctp_for_each_hentry(pp, node, &head->chain) { if ((pp->port == snum) && net_eq(pp->net, sock_net(sk))) goto pp_found; } } pp = NULL; goto pp_not_found; pp_found: if (!hlist_empty(&pp->owner)) { /* We had a port hash table hit - there is an * available port (pp != NULL) and it is being * used by other socket (pp->owner not empty); that other * socket is going to be sk2. */ int reuse = sk->sk_reuse; struct sock *sk2; SCTP_DEBUG_PRINTK(""sctp_get_port() found a possible match\n""); if (pp->fastreuse && sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING) goto success; /* Run through the list of sockets bound to the port * (pp->port) [via the pointers bind_next and * bind_pprev in the struct sock *sk2 (pp->sk)]. On each one, * we get the endpoint they describe and run through * the endpoint's list of IP (v4 or v6) addresses, * comparing each of the addresses with the address of * the socket sk. If we find a match, then that means * that this port/socket (sk) combination are already * in an endpoint. */ sk_for_each_bound(sk2, node, &pp->owner) { struct sctp_endpoint *ep2; ep2 = sctp_sk(sk2)->ep; if (sk == sk2 || (reuse && sk2->sk_reuse && sk2->sk_state != SCTP_SS_LISTENING)) continue; if (sctp_bind_addr_conflict(&ep2->base.bind_addr, addr, sctp_sk(sk2), sctp_sk(sk))) { ret = (long)sk2; goto fail_unlock; } } SCTP_DEBUG_PRINTK(""sctp_get_port(): Found a match\n""); } pp_not_found: /* If there was a hash table miss, create a new port. */ ret = 1; if (!pp && !(pp = sctp_bucket_create(head, sock_net(sk), snum))) goto fail_unlock; /* In either case (hit or miss), make sure fastreuse is 1 only * if sk->sk_reuse is too (that is, if the caller requested * SO_REUSEADDR on this socket -sk-). */ if (hlist_empty(&pp->owner)) { if (sk->sk_reuse && sk->sk_state != SCTP_SS_LISTENING) pp->fastreuse = 1; else pp->fastreuse = 0; } else if (pp->fastreuse && (!sk->sk_reuse || sk->sk_state == SCTP_SS_LISTENING)) pp->fastreuse = 0; /* We are set, so fill up all the data in the hash table * entry, tie the socket list information with the rest of the * sockets FIXME: Blurry, NPI (ipg). */ success: if (!sctp_sk(sk)->bind_hash) { inet_sk(sk)->inet_num = snum; sk_add_bind_node(sk, &pp->owner); sctp_sk(sk)->bind_hash = pp; } ret = 0; fail_unlock: sctp_spin_unlock(&head->lock); fail: sctp_local_bh_enable(); return ret; } ",0 "void WebRTCAudioDeviceTest::WaitForIOThreadCompletion() { WaitForMessageLoopCompletion( ChildProcess::current()->io_message_loop()->message_loop_proxy()); } ",0 " bool PluginInstance::ConvertPoint(double source_x, double source_y, NPCoordinateSpace source_space, double* dest_x, double* dest_y, NPCoordinateSpace dest_space) { #if defined(OS_MACOSX) CGRect main_display_bounds = CGDisplayBounds(CGMainDisplayID()); double flipped_screen_x = source_x; double flipped_screen_y = source_y; switch(source_space) { case NPCoordinateSpacePlugin: flipped_screen_x += plugin_origin_.x(); flipped_screen_y += plugin_origin_.y(); break; case NPCoordinateSpaceScreen: flipped_screen_y = main_display_bounds.size.height - flipped_screen_y; case NPCoordinateSpaceFlippedScreen: break; case NPCoordinateSpaceWindow: case NPCoordinateSpaceFlippedWindow: NOTIMPLEMENTED(); return false; default: NOTREACHED(); return false; } double target_x = flipped_screen_x; double target_y = flipped_screen_y; switch(dest_space) { case NPCoordinateSpacePlugin: target_x -= plugin_origin_.x(); target_y -= plugin_origin_.y(); break; case NPCoordinateSpaceScreen: target_y = main_display_bounds.size.height - flipped_screen_y; case NPCoordinateSpaceFlippedScreen: break; case NPCoordinateSpaceWindow: case NPCoordinateSpaceFlippedWindow: NOTIMPLEMENTED(); return false; default: NOTREACHED(); return false; } if (dest_x) *dest_x = target_x; if (dest_y) *dest_y = target_y; return true; #else NOTIMPLEMENTED(); return false; #endif } ",0 "static void tsk_rej_rx_queue(struct sock *sk) { struct sk_buff *skb; while ((skb = __skb_dequeue(&sk->sk_receive_queue))) tipc_sk_respond(sk, skb, TIPC_ERR_NO_PORT); } ",0 "bool ExtensionPrefs::IsExternalExtensionUninstalled( const std::string& id) const { const DictionaryValue* extension = GetExtensionPref(id); if (!extension) return false; int state = 0; return extension->GetInteger(kPrefState, &state) && state == static_cast(Extension::EXTERNAL_EXTENSION_UNINSTALLED); } ",0 "void Framebuffer::MarkAsDeleted() { deleted_ = true; while (!attachments_.empty()) { Attachment* attachment = attachments_.begin()->second.get(); attachment->DetachFromFramebuffer(this); attachments_.erase(attachments_.begin()); } } ",0 " void testUriUserInfoHostPort22_Bug1948038() { UriParserStateA stateA; UriUriA uriA; stateA.uri = &uriA; int res; res = uriParseUriA(&stateA, ""http://user:21@host/""); TEST_ASSERT(URI_SUCCESS == res); TEST_ASSERT(!memcmp(uriA.userInfo.first, ""user:21"", 7 * sizeof(char))); TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 7); TEST_ASSERT(!memcmp(uriA.hostText.first, ""host"", 4 * sizeof(char))); TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4); TEST_ASSERT(uriA.portText.first == NULL); TEST_ASSERT(uriA.portText.afterLast == NULL); uriFreeUriMembersA(&uriA); res = uriParseUriA(&stateA, ""http://user:1234@192.168.0.1:1234/foo.com""); TEST_ASSERT(URI_SUCCESS == res); uriFreeUriMembersA(&uriA); res = uriParseUriA(&stateA, ""http://moo:21@moo:21@moo/""); TEST_ASSERT(URI_ERROR_SYNTAX == res); uriFreeUriMembersA(&uriA); res = uriParseUriA(&stateA, ""http://moo:21@moo:21@moo:21/""); TEST_ASSERT(URI_ERROR_SYNTAX == res); uriFreeUriMembersA(&uriA); } ",0 "static int __sctp_connect(struct sock* sk, struct sockaddr *kaddrs, int addrs_size) { struct sctp_sock *sp; struct sctp_endpoint *ep; struct sctp_association *asoc = NULL; struct sctp_association *asoc2; struct sctp_transport *transport; union sctp_addr to; struct sctp_af *af; sctp_scope_t scope; long timeo; int err = 0; int addrcnt = 0; int walk_size = 0; union sctp_addr *sa_addr; void *addr_buf; sp = sctp_sk(sk); ep = sp->ep; /* connect() cannot be done on a socket that is already in ESTABLISHED * state - UDP-style peeled off socket or a TCP-style socket that * is already connected. * It cannot be done even on a TCP-style listening socket. */ if (sctp_sstate(sk, ESTABLISHED) || (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING))) { err = -EISCONN; goto out_free; } /* Walk through the addrs buffer and count the number of addresses. */ addr_buf = kaddrs; while (walk_size < addrs_size) { sa_addr = (union sctp_addr *)addr_buf; af = sctp_get_af_specific(sa_addr->sa.sa_family); /* If the address family is not supported or if this address * causes the address buffer to overflow return EINVAL. */ if (!af || (walk_size + af->sockaddr_len) > addrs_size) { err = -EINVAL; goto out_free; } err = sctp_verify_addr(sk, sa_addr, af->sockaddr_len); if (err) goto out_free; memcpy(&to, sa_addr, af->sockaddr_len); /* Check if there already is a matching association on the * endpoint (other than the one created here). */ asoc2 = sctp_endpoint_lookup_assoc(ep, sa_addr, &transport); if (asoc2 && asoc2 != asoc) { if (asoc2->state >= SCTP_STATE_ESTABLISHED) err = -EISCONN; else err = -EALREADY; goto out_free; } /* If we could not find a matching association on the endpoint, * make sure that there is no peeled-off association matching * the peer address even on another socket. */ if (sctp_endpoint_is_peeled_off(ep, sa_addr)) { err = -EADDRNOTAVAIL; goto out_free; } if (!asoc) { /* If a bind() or sctp_bindx() is not called prior to * an sctp_connectx() call, the system picks an * ephemeral port and will choose an address set * equivalent to binding with a wildcard address. */ if (!ep->base.bind_addr.port) { if (sctp_autobind(sk)) { err = -EAGAIN; goto out_free; } } else { /* * If an unprivileged user inherits a 1-many * style socket with open associations on a * privileged port, it MAY be permitted to * accept new associations, but it SHOULD NOT * be permitted to open new associations. */ if (ep->base.bind_addr.port < PROT_SOCK && !capable(CAP_NET_BIND_SERVICE)) { err = -EACCES; goto out_free; } } scope = sctp_scope(sa_addr); asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); if (!asoc) { err = -ENOMEM; goto out_free; } } /* Prime the peer's transport structures. */ transport = sctp_assoc_add_peer(asoc, sa_addr, GFP_KERNEL, SCTP_UNKNOWN); if (!transport) { err = -ENOMEM; goto out_free; } addrcnt++; addr_buf += af->sockaddr_len; walk_size += af->sockaddr_len; } err = sctp_assoc_set_bind_addr_from_ep(asoc, GFP_KERNEL); if (err < 0) { goto out_free; } err = sctp_primitive_ASSOCIATE(asoc, NULL); if (err < 0) { goto out_free; } /* Initialize sk's dport and daddr for getpeername() */ inet_sk(sk)->dport = htons(asoc->peer.port); af = sctp_get_af_specific(to.sa.sa_family); af->to_sk_daddr(&to, sk); sk->sk_err = 0; timeo = sock_sndtimeo(sk, sk->sk_socket->file->f_flags & O_NONBLOCK); err = sctp_wait_for_connect(asoc, &timeo); /* Don't free association on exit. */ asoc = NULL; out_free: SCTP_DEBUG_PRINTK(""About to exit __sctp_connect() free asoc: %p"" "" kaddrs: %p err: %d\n"", asoc, kaddrs, err); if (asoc) sctp_association_free(asoc); return err; } ",0 "gfx::Rect RenderWidgetHostViewAura::GetCaretBounds() const { const gfx::Rect rect = gfx::UnionRects(selection_anchor_rect_, selection_focus_rect_); return ConvertRectToScreen(rect); } ",0 "void LogOmniboxZeroSuggestRequest( ZeroSuggestRequestsHistogramValue request_value) { UMA_HISTOGRAM_ENUMERATION(""Omnibox.ZeroSuggestRequests"", request_value, ZERO_SUGGEST_MAX_REQUEST_HISTOGRAM_VALUE); } ",0 "static struct perf_cpu_context __percpu *find_pmu_context(int ctxn) { struct pmu *pmu; if (ctxn < 0) return NULL; list_for_each_entry(pmu, &pmus, entry) { if (pmu->task_ctx_nr == ctxn) return pmu->pmu_cpu_context; } return NULL; } ",0 "ether_hdr_print(netdissect_options *ndo, const u_char *bp, u_int length) { register const struct ether_header *ep; uint16_t length_type; ep = (const struct ether_header *)bp; ND_PRINT((ndo, ""%s > %s"", etheraddr_string(ndo, ESRC(ep)), etheraddr_string(ndo, EDST(ep)))); length_type = EXTRACT_16BITS(&ep->ether_length_type); if (!ndo->ndo_qflag) { if (length_type <= ETHERMTU) { ND_PRINT((ndo, "", 802.3"")); length = length_type; } else ND_PRINT((ndo, "", ethertype %s (0x%04x)"", tok2str(ethertype_values,""Unknown"", length_type), length_type)); } else { if (length_type <= ETHERMTU) { ND_PRINT((ndo, "", 802.3"")); length = length_type; } else ND_PRINT((ndo, "", %s"", tok2str(ethertype_values,""Unknown Ethertype (0x%04x)"", length_type))); } ND_PRINT((ndo, "", length %u: "", length)); } ",0 "void WebContentsImpl::NotifyFindMatchRectsReply( int version, const std::vector& rects, const gfx::RectF& active_rect) { if (delegate_) delegate_->FindMatchRectsReply(this, version, rects, active_rect); } ",0 "int au1100fb_drv_resume(struct platform_device *dev) { struct au1100fb_device *fbdev = platform_get_drvdata(dev); if (!fbdev) return 0; memcpy(fbdev->regs, &fbregs, sizeof(struct au1100fb_regs)); /* Restart LCD clocking */ au_writel(sys_clksrc, SYS_CLKSRC); /* Unblank the LCD */ au1100fb_fb_blank(VESA_NO_BLANKING, &fbdev->info); return 0; } ",0 "void ChromeClientImpl::SetOverscrollBehavior( const WebOverscrollBehavior& overscroll_behavior) { web_view_->SetOverscrollBehavior(overscroll_behavior); } ",0 "void TypedUrlModelAssociator::Associate( const std::string* typed_url, int64 sync_id) { DCHECK(expected_loop_ == MessageLoop::current()); DCHECK(!IsAssociated(*typed_url)); DCHECK_NE(sync_api::kInvalidId, sync_id); DCHECK(id_map_inverse_.find(sync_id) == id_map_inverse_.end()); id_map_[*typed_url] = sync_id; id_map_inverse_[sync_id] = *typed_url; } ",0 "FakePeripheral* FakeCentral::GetFakePeripheral( const std::string& peripheral_address) const { auto device_iter = devices_.find(peripheral_address); if (device_iter == devices_.end()) { return nullptr; } return static_cast(device_iter->second.get()); } ",0 "onig_match(regex_t* reg, const UChar* str, const UChar* end, const UChar* at, OnigRegion* region, OnigOptionType option) { int r; UChar *prev; OnigMatchArg msa; MATCH_ARG_INIT(msa, reg, option, region, at); #ifdef USE_COMBINATION_EXPLOSION_CHECK { int offset = at - str; STATE_CHECK_BUFF_INIT(msa, end - str, offset, reg->num_comb_exp_check); } #endif if (region #ifdef USE_POSIX_API_REGION_OPTION && !IS_POSIX_REGION(option) #endif ) { r = onig_region_resize_clear(region, reg->num_mem + 1); } else r = 0; if (r == 0) { if (ONIG_IS_OPTION_ON(option, ONIG_OPTION_CHECK_VALIDITY_OF_STRING)) { if (! ONIGENC_IS_VALID_MBC_STRING(reg->enc, str, end)) { r = ONIGERR_INVALID_WIDE_CHAR_VALUE; goto end; } } prev = (UChar* )onigenc_get_prev_char_head(reg->enc, str, at); r = match_at(reg, str, end, #ifdef USE_MATCH_RANGE_MUST_BE_INSIDE_OF_SPECIFIED_RANGE end, #endif at, prev, &msa); } end: MATCH_ARG_FREE(msa); return r; } ",0 " explicit BrowserClosedObserver(Browser* browser) { registrar_.Add(this, NotificationType::BROWSER_CLOSED, Source(browser)); ui_test_utils::RunMessageLoop(); } ",0 "ZEND_API int ZEND_FASTCALL zend_hash_str_del(HashTable *ht, const char *str, size_t len) { zend_ulong h; uint32_t nIndex; uint32_t idx; Bucket *p; Bucket *prev = NULL; IS_CONSISTENT(ht); HT_ASSERT(GC_REFCOUNT(ht) == 1); h = zend_inline_hash_func(str, len); nIndex = h | ht->nTableMask; idx = HT_HASH(ht, nIndex); while (idx != HT_INVALID_IDX) { p = HT_HASH_TO_BUCKET(ht, idx); if ((p->h == h) && p->key && (ZSTR_LEN(p->key) == len) && !memcmp(ZSTR_VAL(p->key), str, len)) { _zend_hash_del_el_ex(ht, idx, p, prev); return SUCCESS; } prev = p; idx = Z_NEXT(p->val); } return FAILURE; } ",0 "void ChromeClientImpl::DispatchViewportPropertiesDidChange( const ViewportDescription& description) const { web_view_->UpdatePageDefinedViewportConstraints(description); } ",0 "Locale& DateTimeChooserImpl::locale() { return *m_locale; } ",0 "static void alarmFiredNative(JNIEnv *env, jobject obj) { if (sAlarmCallback) { sAlarmCallback(sAlarmCallbackData); } else { ALOGE(""%s() - Alarm fired with callback not set!"", __FUNCTION__); } } ",0 "static ssize_t macvtap_get_user(struct macvtap_queue *q, struct msghdr *m, const struct iovec *iv, unsigned long total_len, size_t count, int noblock) { struct sk_buff *skb; struct macvlan_dev *vlan; unsigned long len = total_len; int err; struct virtio_net_hdr vnet_hdr = { 0 }; int vnet_hdr_len = 0; int copylen; bool zerocopy = false; if (q->flags & IFF_VNET_HDR) { vnet_hdr_len = q->vnet_hdr_sz; err = -EINVAL; if (len < vnet_hdr_len) goto err; len -= vnet_hdr_len; err = memcpy_fromiovecend((void *)&vnet_hdr, iv, 0, sizeof(vnet_hdr)); if (err < 0) goto err; if ((vnet_hdr.flags & VIRTIO_NET_HDR_F_NEEDS_CSUM) && vnet_hdr.csum_start + vnet_hdr.csum_offset + 2 > vnet_hdr.hdr_len) vnet_hdr.hdr_len = vnet_hdr.csum_start + vnet_hdr.csum_offset + 2; err = -EINVAL; if (vnet_hdr.hdr_len > len) goto err; } err = -EINVAL; if (unlikely(len < ETH_HLEN)) goto err; if (m && m->msg_control && sock_flag(&q->sk, SOCK_ZEROCOPY)) zerocopy = true; if (zerocopy) { /* There are 256 bytes to be copied in skb, so there is enough * room for skb expand head in case it is used. * The rest buffer is mapped from userspace. */ copylen = vnet_hdr.hdr_len; if (!copylen) copylen = GOODCOPY_LEN; } else copylen = len; skb = macvtap_alloc_skb(&q->sk, NET_IP_ALIGN, copylen, vnet_hdr.hdr_len, noblock, &err); if (!skb) goto err; if (zerocopy) err = zerocopy_sg_from_iovec(skb, iv, vnet_hdr_len, count); else err = skb_copy_datagram_from_iovec(skb, 0, iv, vnet_hdr_len, len); if (err) goto err_kfree; skb_set_network_header(skb, ETH_HLEN); skb_reset_mac_header(skb); skb->protocol = eth_hdr(skb)->h_proto; if (vnet_hdr_len) { err = macvtap_skb_from_vnet_hdr(skb, &vnet_hdr); if (err) goto err_kfree; } rcu_read_lock_bh(); vlan = rcu_dereference_bh(q->vlan); /* copy skb_ubuf_info for callback when skb has no error */ if (zerocopy) { skb_shinfo(skb)->destructor_arg = m->msg_control; skb_shinfo(skb)->tx_flags |= SKBTX_DEV_ZEROCOPY; } if (vlan) macvlan_start_xmit(skb, vlan->dev); else kfree_skb(skb); rcu_read_unlock_bh(); return total_len; err_kfree: kfree_skb(skb); err: rcu_read_lock_bh(); vlan = rcu_dereference_bh(q->vlan); if (vlan) vlan->dev->stats.tx_dropped++; rcu_read_unlock_bh(); return err; } ",1 "static inline void bnep_set_default_proto_filter(struct bnep_session *s) { /* (IPv4, ARP) */ s->proto_filter[0].start = ETH_P_IP; s->proto_filter[0].end = ETH_P_ARP; /* (RARP, AppleTalk) */ s->proto_filter[1].start = ETH_P_RARP; s->proto_filter[1].end = ETH_P_AARP; /* (IPX, IPv6) */ s->proto_filter[2].start = ETH_P_IPX; s->proto_filter[2].end = ETH_P_IPV6; } ",0 "int kvm_arch_vcpu_init(struct kvm_vcpu *vcpu) { int ret; /* Force users to call KVM_ARM_VCPU_INIT */ vcpu->arch.target = -1; /* Set up VGIC */ ret = kvm_vgic_vcpu_init(vcpu); if (ret) return ret; /* Set up the timer */ kvm_timer_vcpu_init(vcpu); return 0; } ",0 "void Con_DrawInput( void ) { int y; if ( clc.state != CA_DISCONNECTED && !(Key_GetCatcher( ) & KEYCATCH_CONSOLE ) ) { return; } y = con.vislines - ( SMALLCHAR_HEIGHT * 2 ); re.SetColor( con.color ); SCR_DrawSmallChar( con.xadjust + 1 * SMALLCHAR_WIDTH, y, ']' ); Field_Draw( &g_consoleField, con.xadjust + 2 * SMALLCHAR_WIDTH, y, SCREEN_WIDTH - 3 * SMALLCHAR_WIDTH, qtrue, qtrue ); } ",0 "static int round(double x) { if (x < 0) return static_cast(ceil(x - 0.5)); else return static_cast(floor(x + 0.5)); } ",0 "bool DateTimeFieldElement::isReadOnly() const { return fastHasAttribute(readonlyAttr); } ",0 "js_init() { /* This function creates the class and its definition, only once */ if (!uzbl.js.initialized) { /* it would be pretty cool to make this dynamic */ uzbl.js.classdef = kJSClassDefinitionEmpty; uzbl.js.classdef.staticFunctions = js_static_functions; uzbl.js.classref = JSClassCreate(&uzbl.js.classdef); } } ",0 "float MSG_ReadDeltaKeyFloat( msg_t *msg, int key, float oldV ) { if ( MSG_ReadBits( msg, 1 ) ) { floatint_t fi; fi.i = MSG_ReadBits( msg, 32 ) ^ key; return fi.f; } return oldV; } ",0 "GF_Box *stsh_New() { ISOM_DECL_BOX_ALLOC(GF_ShadowSyncBox, GF_ISOM_BOX_TYPE_STSH); tmp->entries = gf_list_new(); if (!tmp->entries) { gf_free(tmp); return NULL; } return (GF_Box *)tmp; } ",0 " static void Ins_RUTG( INS_ARG ) { (void)args; CUR.GS.round_state = TT_Round_Up_To_Grid; CUR.func_round = (TRound_Function)Round_Up_To_Grid; } ",0 "void WebstoreAPI::SendInstallMessageIfObserved( const std::string& extension_id, api::webstore::InstallStage install_stage) { for (ObservedInstallInfoList::const_iterator iter = install_stage_listeners_.begin(); iter != install_stage_listeners_.end(); ++iter) { if (iter->extension_id == extension_id) { iter->ipc_sender->Send(new ExtensionMsg_InlineInstallStageChanged( iter->routing_id, install_stage)); } } } ",0 " CompositedLayerRasterInvalidatorTest& Bounds(const FloatRect& bounds) { data_.chunks.back().bounds = bounds; return *this; } ",0 "GLvoid StubGLVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void* ptr) { glVertexAttribPointer(indx, size, type, normalized, stride, ptr); } ",0 "void PluginServiceImpl::OnWaitableEventSignaled( base::WaitableEvent* waitable_event) { #if defined(OS_WIN) if (waitable_event == hkcu_event_.get()) { hkcu_key_.StartWatching(); } else { hklm_key_.StartWatching(); } plugin_list_->RefreshPlugins(); PurgePluginListCache(NULL, false); #else NOTREACHED(); #endif // defined(OS_WIN) } ",0 "static int http_read_stream_all(URLContext *h, uint8_t *buf, int size) { int pos = 0; while (pos < size) { int len = http_read_stream(h, buf + pos, size - pos); if (len < 0) return len; pos += len; } return pos; } ",0 "arcCircleCenter(const pointObj *p1, const pointObj *p2, const pointObj *p3, pointObj *center, double *radius) { pointObj c; double r; /* Components of the matrices. */ double x1sq = p1->x * p1->x; double x2sq = p2->x * p2->x; double x3sq = p3->x * p3->x; double y1sq = p1->y * p1->y; double y2sq = p2->y * p2->y; double y3sq = p3->y * p3->y; double matrix_num_x[9]; double matrix_num_y[9]; double matrix_denom[9]; /* Intialize matrix_num_x */ matrix_num_x[0] = x1sq+y1sq; matrix_num_x[1] = p1->y; matrix_num_x[2] = 1.0; matrix_num_x[3] = x2sq+y2sq; matrix_num_x[4] = p2->y; matrix_num_x[5] = 1.0; matrix_num_x[6] = x3sq+y3sq; matrix_num_x[7] = p3->y; matrix_num_x[8] = 1.0; /* Intialize matrix_num_y */ matrix_num_y[0] = p1->x; matrix_num_y[1] = x1sq+y1sq; matrix_num_y[2] = 1.0; matrix_num_y[3] = p2->x; matrix_num_y[4] = x2sq+y2sq; matrix_num_y[5] = 1.0; matrix_num_y[6] = p3->x; matrix_num_y[7] = x3sq+y3sq; matrix_num_y[8] = 1.0; /* Intialize matrix_denom */ matrix_denom[0] = p1->x; matrix_denom[1] = p1->y; matrix_denom[2] = 1.0; matrix_denom[3] = p2->x; matrix_denom[4] = p2->y; matrix_denom[5] = 1.0; matrix_denom[6] = p3->x; matrix_denom[7] = p3->y; matrix_denom[8] = 1.0; /* Circle is closed, so p2 must be opposite p1 & p3. */ if ( FP_EQ(p1->x,p3->x) && FP_EQ(p1->y,p3->y) ) { c.x = (p1->x + p2->x) / 2.0; c.y = (p1->y + p2->y) / 2.0; r = sqrt( (p1->x - p2->x) * (p1->x - p2->x) + (p1->y - p2->y) * (p1->y - p2->y) ) / 2.0; } /* There is no circle here, the points are actually co-linear */ else if ( arcSegmentSide(p1, p3, p2) == FP_COLINEAR ) { return MS_FAILURE; } /* Calculate the center and radius. */ else { double denom = 2.0 * arcDeterminant3x3(matrix_denom); /* Center components */ c.x = arcDeterminant3x3(matrix_num_x) / denom; c.y = arcDeterminant3x3(matrix_num_y) / denom; /* Radius */ r = sqrt((p1->x-c.x) * (p1->x-c.x) + (p1->y-c.y) * (p1->y-c.y)); } if ( radius ) *radius = r; if ( center ) *center = c; return MS_SUCCESS; } ",0 "static enum TIFFReadDirEntryErr TIFFReadDirEntrySbyteArray(TIFF* tif, TIFFDirEntry* direntry, int8** value) { enum TIFFReadDirEntryErr err; uint32 count; void* origdata; int8* data; switch (direntry->tdir_type) { case TIFF_UNDEFINED: case TIFF_BYTE: case TIFF_SBYTE: case TIFF_SHORT: case TIFF_SSHORT: case TIFF_LONG: case TIFF_SLONG: case TIFF_LONG8: case TIFF_SLONG8: break; default: return(TIFFReadDirEntryErrType); } err=TIFFReadDirEntryArray(tif,direntry,&count,1,&origdata); if ((err!=TIFFReadDirEntryErrOk)||(origdata==0)) { *value=0; return(err); } switch (direntry->tdir_type) { case TIFF_UNDEFINED: case TIFF_BYTE: { uint8* m; uint32 n; m=(uint8*)origdata; for (n=0; ntdir_type) { case TIFF_SHORT: { uint16* ma; int8* mb; uint32 n; ma=(uint16*)origdata; mb=data; for (n=0; ntif_flags&TIFF_SWAB) TIFFSwabShort(ma); err=TIFFReadDirEntryCheckRangeSbyteShort(*ma); if (err!=TIFFReadDirEntryErrOk) break; *mb++=(int8)(*ma++); } } break; case TIFF_SSHORT: { int16* ma; int8* mb; uint32 n; ma=(int16*)origdata; mb=data; for (n=0; ntif_flags&TIFF_SWAB) TIFFSwabShort((uint16*)ma); err=TIFFReadDirEntryCheckRangeSbyteSshort(*ma); if (err!=TIFFReadDirEntryErrOk) break; *mb++=(int8)(*ma++); } } break; case TIFF_LONG: { uint32* ma; int8* mb; uint32 n; ma=(uint32*)origdata; mb=data; for (n=0; ntif_flags&TIFF_SWAB) TIFFSwabLong(ma); err=TIFFReadDirEntryCheckRangeSbyteLong(*ma); if (err!=TIFFReadDirEntryErrOk) break; *mb++=(int8)(*ma++); } } break; case TIFF_SLONG: { int32* ma; int8* mb; uint32 n; ma=(int32*)origdata; mb=data; for (n=0; ntif_flags&TIFF_SWAB) TIFFSwabLong((uint32*)ma); err=TIFFReadDirEntryCheckRangeSbyteSlong(*ma); if (err!=TIFFReadDirEntryErrOk) break; *mb++=(int8)(*ma++); } } break; case TIFF_LONG8: { uint64* ma; int8* mb; uint32 n; ma=(uint64*)origdata; mb=data; for (n=0; ntif_flags&TIFF_SWAB) TIFFSwabLong8(ma); err=TIFFReadDirEntryCheckRangeSbyteLong8(*ma); if (err!=TIFFReadDirEntryErrOk) break; *mb++=(int8)(*ma++); } } break; case TIFF_SLONG8: { int64* ma; int8* mb; uint32 n; ma=(int64*)origdata; mb=data; for (n=0; ntif_flags&TIFF_SWAB) TIFFSwabLong8((uint64*)ma); err=TIFFReadDirEntryCheckRangeSbyteSlong8(*ma); if (err!=TIFFReadDirEntryErrOk) break; *mb++=(int8)(*ma++); } } break; } _TIFFfree(origdata); if (err!=TIFFReadDirEntryErrOk) { _TIFFfree(data); return(err); } *value=data; return(TIFFReadDirEntryErrOk); } ",0 "bool AcceleratorControllerDelegateAura::CanPerformAction( AcceleratorAction action, const ui::Accelerator& accelerator, const ui::Accelerator& previous_accelerator) { switch (action) { case DEBUG_TOGGLE_DESKTOP_BACKGROUND_MODE: case DEBUG_TOGGLE_DEVICE_SCALE_FACTOR: case DEBUG_TOGGLE_ROOT_WINDOW_FULL_SCREEN: case DEBUG_TOGGLE_SHOW_DEBUG_BORDERS: case DEBUG_TOGGLE_SHOW_FPS_COUNTER: case DEBUG_TOGGLE_SHOW_PAINT_RECTS: return debug::DebugAcceleratorsEnabled(); case MAGNIFY_SCREEN_ZOOM_IN: case MAGNIFY_SCREEN_ZOOM_OUT: return CanHandleMagnifyScreen(); case SCALE_UI_DOWN: case SCALE_UI_RESET: case SCALE_UI_UP: return accelerators::IsInternalDisplayZoomEnabled(); case SHOW_MESSAGE_CENTER_BUBBLE: return CanHandleShowMessageCenterBubble(); case UNPIN: return CanHandleUnpin(); case FOCUS_SHELF: case LAUNCH_APP_0: case LAUNCH_APP_1: case LAUNCH_APP_2: case LAUNCH_APP_3: case LAUNCH_APP_4: case LAUNCH_APP_5: case LAUNCH_APP_6: case LAUNCH_APP_7: case LAUNCH_LAST_APP: case ROTATE_SCREEN: case ROTATE_WINDOW: case SHOW_SYSTEM_TRAY_BUBBLE: case TAKE_PARTIAL_SCREENSHOT: case TAKE_SCREENSHOT: case TAKE_WINDOW_SCREENSHOT: return true; #if defined(OS_CHROMEOS) case DEBUG_ADD_REMOVE_DISPLAY: case DEBUG_TOGGLE_UNIFIED_DESKTOP: return debug::DebugAcceleratorsEnabled(); case SWAP_PRIMARY_DISPLAY: return display::Screen::GetScreen()->GetNumDisplays() > 1; case TOUCH_HUD_CLEAR: case TOUCH_HUD_MODE_CHANGE: return CanHandleTouchHud(); case DISABLE_GPU_WATCHDOG: case LOCK_PRESSED: case LOCK_RELEASED: case POWER_PRESSED: case POWER_RELEASED: case TOGGLE_MIRROR_MODE: case TOUCH_HUD_PROJECTION_TOGGLE: return true; #endif default: NOTREACHED(); break; } return false; } ",0 "int rdma_resolve_addr(struct rdma_cm_id *id, struct sockaddr *src_addr, struct sockaddr *dst_addr, int timeout_ms) { struct rdma_id_private *id_priv; int ret; id_priv = container_of(id, struct rdma_id_private, id); if (id_priv->state == RDMA_CM_IDLE) { ret = cma_bind_addr(id, src_addr, dst_addr); if (ret) return ret; } if (cma_family(id_priv) != dst_addr->sa_family) return -EINVAL; if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_BOUND, RDMA_CM_ADDR_QUERY)) return -EINVAL; atomic_inc(&id_priv->refcount); memcpy(cma_dst_addr(id_priv), dst_addr, rdma_addr_size(dst_addr)); if (cma_any_addr(dst_addr)) { ret = cma_resolve_loopback(id_priv); } else { if (dst_addr->sa_family == AF_IB) { ret = cma_resolve_ib_addr(id_priv); } else { ret = rdma_resolve_ip(&addr_client, cma_src_addr(id_priv), dst_addr, &id->route.addr.dev_addr, timeout_ms, addr_handler, id_priv); } } if (ret) goto err; return 0; err: cma_comp_exch(id_priv, RDMA_CM_ADDR_QUERY, RDMA_CM_ADDR_BOUND); cma_deref_id(id_priv); return ret; } ",0 "MediaDeviceType ConvertToMediaDeviceType(MediaStreamType stream_type) { switch (stream_type) { case MEDIA_DEVICE_AUDIO_CAPTURE: return MEDIA_DEVICE_TYPE_AUDIO_INPUT; case MEDIA_DEVICE_VIDEO_CAPTURE: return MEDIA_DEVICE_TYPE_VIDEO_INPUT; default: NOTREACHED(); } return NUM_MEDIA_DEVICE_TYPES; } ",0 "static double FxEvaluateSubexpression(FxInfo *fx_info, const PixelChannel channel,const ssize_t x,const ssize_t y, const char *expression,size_t *depth,double *beta,ExceptionInfo *exception) { #define FxMaxParenthesisDepth 58 char *q, subexpression[MagickPathExtent]; double alpha, gamma; register const char *p; *beta=0.0; if (exception->severity >= ErrorException) return(0.0); while (isspace((int) ((unsigned char) *expression)) != 0) expression++; if (*expression == '\0') return(0.0); *subexpression='\0'; p=FxOperatorPrecedence(expression,exception); if (p != (const char *) NULL) { (void) CopyMagickString(subexpression,expression,(size_t) (p-expression+1)); alpha=FxEvaluateSubexpression(fx_info,channel,x,y,subexpression,depth, beta,exception); switch ((unsigned char) *p) { case '~': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); *beta=(double) (~(size_t) *beta); return(*beta); } case '!': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(*beta == 0.0 ? 1.0 : 0.0); } case '^': { *beta=pow(alpha,FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth, beta,exception)); return(*beta); } case '*': case ExponentialNotation: { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(alpha*(*beta)); } case '/': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); if (*beta == 0.0) { (void) ThrowMagickException(exception,GetMagickModule(), OptionError,""DivideByZero"",""`%s'"",expression); return(0.0); } return(alpha/(*beta)); } case '%': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); *beta=fabs(floor((*beta)+0.5)); if (*beta == 0.0) { (void) ThrowMagickException(exception,GetMagickModule(), OptionError,""DivideByZero"",""`%s'"",expression); return(0.0); } return(fmod(alpha,*beta)); } case '+': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(alpha+(*beta)); } case '-': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(alpha-(*beta)); } case LeftShiftOperator: { gamma=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); *beta=(double) ((size_t) (alpha+0.5) << (size_t) (gamma+0.5)); return(*beta); } case RightShiftOperator: { gamma=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); *beta=(double) ((size_t) (alpha+0.5) >> (size_t) (gamma+0.5)); return(*beta); } case '<': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(alpha < *beta ? 1.0 : 0.0); } case LessThanEqualOperator: { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(alpha <= *beta ? 1.0 : 0.0); } case '>': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(alpha > *beta ? 1.0 : 0.0); } case GreaterThanEqualOperator: { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(alpha >= *beta ? 1.0 : 0.0); } case EqualOperator: { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(fabs(alpha-(*beta)) < MagickEpsilon ? 1.0 : 0.0); } case NotEqualOperator: { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(fabs(alpha-(*beta)) >= MagickEpsilon ? 1.0 : 0.0); } case '&': { gamma=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); *beta=(double) ((size_t) (alpha+0.5) & (size_t) (gamma+0.5)); return(*beta); } case '|': { gamma=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); *beta=(double) ((size_t) (alpha+0.5) | (size_t) (gamma+0.5)); return(*beta); } case LogicalAndOperator: { p++; if (alpha <= 0.0) { *beta=0.0; return(*beta); } gamma=FxEvaluateSubexpression(fx_info,channel,x,y,p,depth,beta, exception); *beta=(gamma > 0.0) ? 1.0 : 0.0; return(*beta); } case LogicalOrOperator: { p++; if (alpha > 0.0) { *beta=1.0; return(*beta); } gamma=FxEvaluateSubexpression(fx_info,channel,x,y,p,depth,beta, exception); *beta=(gamma > 0.0) ? 1.0 : 0.0; return(*beta); } case '?': { (void) CopyMagickString(subexpression,++p,MagickPathExtent); q=subexpression; p=StringToken("":"",&q); if (q == (char *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(), OptionError,""UnableToParseExpression"",""`%s'"",subexpression); return(0.0); } if (fabs(alpha) >= MagickEpsilon) gamma=FxEvaluateSubexpression(fx_info,channel,x,y,p,depth,beta, exception); else gamma=FxEvaluateSubexpression(fx_info,channel,x,y,q,depth,beta, exception); return(gamma); } case '=': { char numeric[MagickPathExtent]; q=subexpression; while (isalpha((int) ((unsigned char) *q)) != 0) q++; if (*q != '\0') { (void) ThrowMagickException(exception,GetMagickModule(), OptionError,""UnableToParseExpression"",""`%s'"",subexpression); return(0.0); } ClearMagickException(exception); *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); (void) FormatLocaleString(numeric,MagickPathExtent,""%g"",*beta); (void) DeleteNodeFromSplayTree(fx_info->symbols,subexpression); (void) AddValueToSplayTree(fx_info->symbols,ConstantString( subexpression),ConstantString(numeric)); return(*beta); } case ',': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(alpha); } case ';': { *beta=FxEvaluateSubexpression(fx_info,channel,x,y,++p,depth,beta, exception); return(*beta); } default: { gamma=alpha*FxEvaluateSubexpression(fx_info,channel,x,y,p,depth,beta, exception); return(gamma); } } } if (strchr(""("",(int) *expression) != (char *) NULL) { (*depth)++; if (*depth >= FxMaxParenthesisDepth) (void) ThrowMagickException(exception,GetMagickModule(),OptionError, ""ParenthesisNestedTooDeeply"",""`%s'"",expression); (void) CopyMagickString(subexpression,expression+1,MagickPathExtent); subexpression[strlen(subexpression)-1]='\0'; gamma=FxEvaluateSubexpression(fx_info,channel,x,y,subexpression,depth, beta,exception); (*depth)--; return(gamma); } switch (*expression) { case '+': { gamma=FxEvaluateSubexpression(fx_info,channel,x,y,expression+1,depth,beta, exception); return(1.0*gamma); } case '-': { gamma=FxEvaluateSubexpression(fx_info,channel,x,y,expression+1,depth,beta, exception); return(-1.0*gamma); } case '~': { gamma=FxEvaluateSubexpression(fx_info,channel,x,y,expression+1,depth,beta, exception); return((~(size_t) (gamma+0.5))); } case 'A': case 'a': { if (LocaleNCompare(expression,""abs"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(fabs(alpha)); } #if defined(MAGICKCORE_HAVE_ACOSH) if (LocaleNCompare(expression,""acosh"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); return(acosh(alpha)); } #endif if (LocaleNCompare(expression,""acos"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(acos(alpha)); } #if defined(MAGICKCORE_HAVE_J1) if (LocaleNCompare(expression,""airy"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); if (alpha == 0.0) return(1.0); gamma=2.0*j1((MagickPI*alpha))/(MagickPI*alpha); return(gamma*gamma); } #endif #if defined(MAGICKCORE_HAVE_ASINH) if (LocaleNCompare(expression,""asinh"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); return(asinh(alpha)); } #endif if (LocaleNCompare(expression,""asin"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(asin(alpha)); } if (LocaleNCompare(expression,""alt"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(((ssize_t) alpha) & 0x01 ? -1.0 : 1.0); } if (LocaleNCompare(expression,""atan2"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); return(atan2(alpha,*beta)); } #if defined(MAGICKCORE_HAVE_ATANH) if (LocaleNCompare(expression,""atanh"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); return(atanh(alpha)); } #endif if (LocaleNCompare(expression,""atan"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(atan(alpha)); } if (LocaleCompare(expression,""a"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'B': case 'b': { if (LocaleCompare(expression,""b"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'C': case 'c': { if (LocaleNCompare(expression,""ceil"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(ceil(alpha)); } if (LocaleNCompare(expression,""clamp"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); if (alpha < 0.0) return(0.0); if (alpha > 1.0) return(1.0); return(alpha); } if (LocaleNCompare(expression,""cosh"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(cosh(alpha)); } if (LocaleNCompare(expression,""cos"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(cos(alpha)); } if (LocaleCompare(expression,""c"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'D': case 'd': { if (LocaleNCompare(expression,""debug"",5) == 0) { const char *type; alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); if (fx_info->images->colorspace == CMYKColorspace) switch (channel) { case CyanPixelChannel: type=""cyan""; break; case MagentaPixelChannel: type=""magenta""; break; case YellowPixelChannel: type=""yellow""; break; case AlphaPixelChannel: type=""opacity""; break; case BlackPixelChannel: type=""black""; break; default: type=""unknown""; break; } else switch (channel) { case RedPixelChannel: type=""red""; break; case GreenPixelChannel: type=""green""; break; case BluePixelChannel: type=""blue""; break; case AlphaPixelChannel: type=""opacity""; break; default: type=""unknown""; break; } (void) CopyMagickString(subexpression,expression+6,MagickPathExtent); if (strlen(subexpression) > 1) subexpression[strlen(subexpression)-1]='\0'; if (fx_info->file != (FILE *) NULL) (void) FormatLocaleFile(fx_info->file,""%s[%.20g,%.20g].%s: "" ""%s=%.*g\n"",fx_info->images->filename,(double) x,(double) y,type, subexpression,GetMagickPrecision(),alpha); return(0.0); } if (LocaleNCompare(expression,""drc"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return((alpha/(*beta*(alpha-1.0)+1.0))); } break; } case 'E': case 'e': { if (LocaleCompare(expression,""epsilon"") == 0) return(MagickEpsilon); #if defined(MAGICKCORE_HAVE_ERF) if (LocaleNCompare(expression,""erf"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(erf(alpha)); } #endif if (LocaleNCompare(expression,""exp"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(exp(alpha)); } if (LocaleCompare(expression,""e"") == 0) return(2.7182818284590452354); break; } case 'F': case 'f': { if (LocaleNCompare(expression,""floor"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); return(floor(alpha)); } break; } case 'G': case 'g': { if (LocaleNCompare(expression,""gauss"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); gamma=exp((-alpha*alpha/2.0))/sqrt(2.0*MagickPI); return(gamma); } if (LocaleNCompare(expression,""gcd"",3) == 0) { MagickOffsetType gcd; alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); gcd=FxGCD((MagickOffsetType) (alpha+0.5),(MagickOffsetType) (*beta+ 0.5)); return(gcd); } if (LocaleCompare(expression,""g"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'H': case 'h': { if (LocaleCompare(expression,""h"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); if (LocaleCompare(expression,""hue"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); if (LocaleNCompare(expression,""hypot"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); return(hypot(alpha,*beta)); } break; } case 'K': case 'k': { if (LocaleCompare(expression,""k"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'I': case 'i': { if (LocaleCompare(expression,""intensity"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); if (LocaleNCompare(expression,""int"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(floor(alpha)); } if (LocaleNCompare(expression,""isnan"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); return(!!IsNaN(alpha)); } if (LocaleCompare(expression,""i"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'J': case 'j': { if (LocaleCompare(expression,""j"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); #if defined(MAGICKCORE_HAVE_J0) if (LocaleNCompare(expression,""j0"",2) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+2,depth, beta,exception); return(j0(alpha)); } #endif #if defined(MAGICKCORE_HAVE_J1) if (LocaleNCompare(expression,""j1"",2) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+2,depth, beta,exception); return(j1(alpha)); } #endif #if defined(MAGICKCORE_HAVE_J1) if (LocaleNCompare(expression,""jinc"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); if (alpha == 0.0) return(1.0); gamma=(2.0*j1((MagickPI*alpha))/(MagickPI*alpha)); return(gamma); } #endif break; } case 'L': case 'l': { if (LocaleNCompare(expression,""ln"",2) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+2,depth, beta,exception); return(log(alpha)); } if (LocaleNCompare(expression,""logtwo"",6) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+6,depth, beta,exception); return(log10(alpha))/log10(2.0); } if (LocaleNCompare(expression,""log"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(log10(alpha)); } if (LocaleCompare(expression,""lightness"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'M': case 'm': { if (LocaleCompare(expression,""MaxRGB"") == 0) return(QuantumRange); if (LocaleNCompare(expression,""maxima"",6) == 0) break; if (LocaleNCompare(expression,""max"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(alpha > *beta ? alpha : *beta); } if (LocaleNCompare(expression,""minima"",6) == 0) break; if (LocaleNCompare(expression,""min"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(alpha < *beta ? alpha : *beta); } if (LocaleNCompare(expression,""mod"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); gamma=alpha-floor((alpha/(*beta)))*(*beta); return(gamma); } if (LocaleCompare(expression,""m"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'N': case 'n': { if (LocaleNCompare(expression,""not"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return((alpha < MagickEpsilon)); } if (LocaleCompare(expression,""n"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'O': case 'o': { if (LocaleCompare(expression,""Opaque"") == 0) return(1.0); if (LocaleCompare(expression,""o"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'P': case 'p': { if (LocaleCompare(expression,""phi"") == 0) return(MagickPHI); if (LocaleCompare(expression,""pi"") == 0) return(MagickPI); if (LocaleNCompare(expression,""pow"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(pow(alpha,*beta)); } if (LocaleCompare(expression,""p"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'Q': case 'q': { if (LocaleCompare(expression,""QuantumRange"") == 0) return(QuantumRange); if (LocaleCompare(expression,""QuantumScale"") == 0) return(QuantumScale); break; } case 'R': case 'r': { if (LocaleNCompare(expression,""rand"",4) == 0) { #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_FxEvaluateSubexpression) #endif alpha=GetPseudoRandomValue(fx_info->random_info); return(alpha); } if (LocaleNCompare(expression,""round"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); return(floor(alpha+0.5)); } if (LocaleCompare(expression,""r"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'S': case 's': { if (LocaleCompare(expression,""saturation"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); if (LocaleNCompare(expression,""sign"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(alpha < 0.0 ? -1.0 : 1.0); } if (LocaleNCompare(expression,""sinc"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); if (alpha == 0) return(1.0); gamma=sin((MagickPI*alpha))/(MagickPI*alpha); return(gamma); } if (LocaleNCompare(expression,""sinh"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(sinh(alpha)); } if (LocaleNCompare(expression,""sin"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(sin(alpha)); } if (LocaleNCompare(expression,""sqrt"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(sqrt(alpha)); } if (LocaleNCompare(expression,""squish"",6) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+6,depth, beta,exception); return((1.0/(1.0+exp(-alpha)))); } if (LocaleCompare(expression,""s"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'T': case 't': { if (LocaleNCompare(expression,""tanh"",4) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+4,depth, beta,exception); return(tanh(alpha)); } if (LocaleNCompare(expression,""tan"",3) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+3,depth, beta,exception); return(tan(alpha)); } if (LocaleCompare(expression,""Transparent"") == 0) return(0.0); if (LocaleNCompare(expression,""trunc"",5) == 0) { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5,depth, beta,exception); if (alpha >= 0.0) return(floor(alpha)); return(ceil(alpha)); } if (LocaleCompare(expression,""t"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'U': case 'u': { if (LocaleCompare(expression,""u"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'V': case 'v': { if (LocaleCompare(expression,""v"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'W': case 'w': { if (LocaleNCompare(expression,""while"",5) == 0) { do { alpha=FxEvaluateSubexpression(fx_info,channel,x,y,expression+5, depth,beta,exception); } while (fabs(alpha) >= MagickEpsilon); return(*beta); } if (LocaleCompare(expression,""w"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'Y': case 'y': { if (LocaleCompare(expression,""y"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } case 'Z': case 'z': { if (LocaleCompare(expression,""z"") == 0) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); break; } default: break; } q=(char *) expression; alpha=InterpretSiPrefixValue(expression,&q); if (q == expression) return(FxGetSymbol(fx_info,channel,x,y,expression,exception)); return(alpha); } ",0 "void RenderBox::repaintTreeAfterLayout() { ASSERT(RuntimeEnabledFeatures::repaintAfterLayoutEnabled()); ASSERT(!needsLayout()); const LayoutRect oldRepaintRect = previousRepaintRect(); setPreviousRepaintRect(clippedOverflowRectForRepaint(containerForRepaint())); if (view()->doingFullRepaint() && this != view()) { LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : locationOffset()); RenderObject::repaintTreeAfterLayout(); return; } if ((onlyNeededPositionedMovementLayout() && compositingState() != PaintsIntoOwnBacking) || (shouldDoFullRepaintIfSelfPaintingLayer() && hasLayer() && layer()->isSelfPaintingLayer())) { setShouldDoFullRepaintAfterLayout(true); } const LayoutRect newRepaintRect = previousRepaintRect(); bool didFullRepaint = repaintAfterLayoutIfNeeded(containerForRepaint(), shouldDoFullRepaintAfterLayout(), oldRepaintRect, &newRepaintRect); if (!didFullRepaint) repaintOverflowIfNeeded(); if (enclosingLayer()) { if (RenderLayerScrollableArea* area = enclosingLayer()->scrollableArea()) { if (area->hasVerticalBarDamage()) repaintRectangle(area->verticalBarDamage()); if (area->hasHorizontalBarDamage()) repaintRectangle(area->horizontalBarDamage()); area->resetScrollbarDamage(); } } LayoutStateMaintainer statePusher(*this, isTableRow() ? LayoutSize() : locationOffset()); RenderObject::repaintTreeAfterLayout(); } ",0 "NO_INLINE JsVar *jspeExpression() { while (!JSP_SHOULDNT_PARSE) { JsVar *a = jspeAssignmentExpression(); if (lex->tk!=',') return a; jsvUnLock(a); JSP_ASSERT_MATCH(','); } return 0; } ",0 "void VideoCaptureManager::ProcessDeviceStartRequestQueue() { DCHECK_CURRENTLY_ON(BrowserThread::IO); auto request = device_start_request_queue_.begin(); if (request == device_start_request_queue_.end()) return; VideoCaptureController* const controller = request->controller(); EmitLogMessage(""VideoCaptureManager::ProcessDeviceStartRequestQueue"", 3); if (controller->stream_type() == MEDIA_DEVICE_VIDEO_CAPTURE) { const media::VideoCaptureDeviceInfo* device_info = GetDeviceInfoById(controller->device_id()); if (!device_info) { OnDeviceLaunchFailed( controller, media::VideoCaptureError:: kVideoCaptureManagerProcessDeviceStartQueueDeviceInfoNotFound); return; } for (auto& observer : capture_observers_) observer.OnVideoCaptureStarted(device_info->descriptor.facing); } controller->CreateAndStartDeviceAsync( request->params(), static_cast(this), base::BindOnce([](scoped_refptr, scoped_refptr) {}, scoped_refptr(this), GetControllerSharedRef(controller))); } ",0 "void NavigatorImpl::DidStartProvisionalLoad( RenderFrameHostImpl* render_frame_host, const GURL& url, const base::TimeTicks& navigation_start) { bool is_main_frame = render_frame_host->frame_tree_node()->IsMainFrame(); bool is_error_page = (url.spec() == kUnreachableWebDataURL); bool is_iframe_srcdoc = (url.spec() == kAboutSrcDocURL); GURL validated_url(url); RenderProcessHost* render_process_host = render_frame_host->GetProcess(); render_process_host->FilterURL(false, &validated_url); ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl::GetInstance(); if (render_process_host->IsForGuestsOnly() && !policy->IsWebSafeScheme(validated_url.scheme())) { validated_url = GURL(url::kAboutBlankURL); } if (is_main_frame && !is_error_page) { DidStartMainFrameNavigation(validated_url, render_frame_host->GetSiteInstance(), render_frame_host->navigation_handle()); } if (delegate_) { delegate_->DidStartProvisionalLoad(render_frame_host, validated_url, is_error_page, is_iframe_srcdoc); } if (is_error_page || IsBrowserSideNavigationEnabled()) return; if (render_frame_host->navigation_handle()) { if (render_frame_host->navigation_handle()->is_transferring()) { DCHECK_EQ(url, render_frame_host->navigation_handle()->GetURL()); render_frame_host->navigation_handle()->set_is_transferring(false); return; } render_frame_host->SetNavigationHandle( std::unique_ptr()); } bool is_renderer_initiated = true; int pending_nav_entry_id = 0; bool started_from_context_menu = false; NavigationEntryImpl* pending_entry = controller_->GetPendingEntry(); if (pending_entry) { is_renderer_initiated = pending_entry->is_renderer_initiated(); pending_nav_entry_id = pending_entry->GetUniqueID(); started_from_context_menu = pending_entry->has_started_from_context_menu(); } render_frame_host->SetNavigationHandle(NavigationHandleImpl::Create( validated_url, render_frame_host->frame_tree_node(), is_renderer_initiated, false, // is_synchronous is_iframe_srcdoc, // is_srcdoc navigation_start, pending_nav_entry_id, started_from_context_menu)); } ",0 "static int cbc_aes_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct s390_aes_ctx *sctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; if (unlikely(need_fallback(sctx->key_len))) return fallback_blk_dec(desc, dst, src, nbytes); blkcipher_walk_init(&walk, dst, src, nbytes); return cbc_aes_crypt(desc, sctx->dec, &walk); } ",0 "client_connected_to_dbus (GObject *source_object, GAsyncResult *res, gpointer user_data) { FlatpakProxyClient *client = user_data; GSocketConnection *connection; GError *error = NULL; GIOStream *stream; stream = g_dbus_address_get_stream_finish (res, NULL, &error); if (stream == NULL) { g_warning (""Failed to connect to bus: %s"", error->message); g_object_unref (client); return; } connection = G_SOCKET_CONNECTION (stream); g_socket_set_blocking (g_socket_connection_get_socket (connection), FALSE); client->bus_side.connection = connection; start_reading (&client->client_side); start_reading (&client->bus_side); } ",0 "GF_Err dac3_Read(GF_Box *s, GF_BitStream *bs) { GF_AC3ConfigBox *ptr = (GF_AC3ConfigBox *)s; if (ptr == NULL) return GF_BAD_PARAM; if (ptr->cfg.is_ec3) { u32 i; ptr->cfg.brcode = gf_bs_read_int(bs, 13); ptr->cfg.nb_streams = gf_bs_read_int(bs, 3) + 1; for (i=0; icfg.nb_streams; i++) { ptr->cfg.streams[i].fscod = gf_bs_read_int(bs, 2); ptr->cfg.streams[i].bsid = gf_bs_read_int(bs, 5); ptr->cfg.streams[i].bsmod = gf_bs_read_int(bs, 5); ptr->cfg.streams[i].acmod = gf_bs_read_int(bs, 3); ptr->cfg.streams[i].lfon = gf_bs_read_int(bs, 1); gf_bs_read_int(bs, 3); ptr->cfg.streams[i].nb_dep_sub = gf_bs_read_int(bs, 4); if (ptr->cfg.streams[i].nb_dep_sub) { ptr->cfg.streams[i].chan_loc = gf_bs_read_int(bs, 9); } else { gf_bs_read_int(bs, 1); } } } else { ptr->cfg.nb_streams = 1; ptr->cfg.streams[0].fscod = gf_bs_read_int(bs, 2); ptr->cfg.streams[0].bsid = gf_bs_read_int(bs, 5); ptr->cfg.streams[0].bsmod = gf_bs_read_int(bs, 3); ptr->cfg.streams[0].acmod = gf_bs_read_int(bs, 3); ptr->cfg.streams[0].lfon = gf_bs_read_int(bs, 1); ptr->cfg.brcode = gf_bs_read_int(bs, 5); gf_bs_read_int(bs, 5); } return GF_OK; } ",0 "error::Error GLES2DecoderImpl::HandleDeleteProgram( uint32 immediate_data_size, const gles2::DeleteProgram& c) { GLuint client_id = c.program; if (client_id) { ProgramManager::ProgramInfo* info = GetProgramInfo(client_id); if (info) { if (!info->IsDeleted()) { program_manager()->MarkAsDeleted(shader_manager(), info); } } else { SetGLError(GL_INVALID_VALUE, ""glDeleteProgram: unknown program""); } } return error::kNoError; } ",0 "sched_feat_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[64]; char *cmp; int neg = 0; int i; if (cnt > 63) cnt = 63; if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT; buf[cnt] = 0; cmp = strstrip(buf); if (strncmp(cmp, ""NO_"", 3) == 0) { neg = 1; cmp += 3; } for (i = 0; sched_feat_names[i]; i++) { if (strcmp(cmp, sched_feat_names[i]) == 0) { if (neg) sysctl_sched_features &= ~(1UL << i); else sysctl_sched_features |= (1UL << i); break; } } if (!sched_feat_names[i]) return -EINVAL; *ppos += cnt; return cnt; } ",0 "static void nfsd4_cstate_assign_replay(struct nfsd4_compound_state *cstate, struct nfs4_stateowner *so) { if (!nfsd4_has_session(cstate)) { mutex_lock(&so->so_replay.rp_mutex); cstate->replay_owner = nfs4_get_stateowner(so); } } ",0 " void TestMoreDrawing() { FakeDisplayItemClient first(""first""); GraphicsContext context(GetPaintController()); InitRootChunk(); DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); GetPaintController().CommitNewDisplayItems(); InitRootChunk(); DrawRect(context, first, kBackgroundType, FloatRect(100, 100, 300, 300)); DrawRect(context, first, kForegroundType, FloatRect(100, 100, 300, 300)); GetPaintController().CommitNewDisplayItems(); } ",0 "GF_Err cat_isomedia_file(GF_ISOFile *dest, char *fileName, u32 import_flags, Double force_fps, u32 frames_per_sample, char *tmp_dir, Bool force_cat, Bool align_timelines, Bool allow_add_in_command) { u32 i, j, count, nb_tracks, nb_samp, nb_done; GF_ISOFile *orig; GF_Err e; char *opts, *multi_cat; Double ts_scale; Double dest_orig_dur; u32 dst_tk, tk_id, mtype; u64 insert_dts; Bool is_isom; GF_ISOSample *samp; Double aligned_to_DTS = 0; if (strchr(fileName, '*')) return cat_multiple_files(dest, fileName, import_flags, force_fps, frames_per_sample, tmp_dir, force_cat, align_timelines, allow_add_in_command); multi_cat = allow_add_in_command ? strchr(fileName, '+') : NULL; if (multi_cat) { multi_cat[0] = 0; multi_cat = &multi_cat[1]; } opts = strchr(fileName, ':'); if (opts && (opts[1]=='\\')) opts = strchr(fileName, ':'); e = GF_OK; /*if options are specified, reimport the file*/ is_isom = opts ? 0 : gf_isom_probe_file(fileName); if (!is_isom || opts) { orig = gf_isom_open(""temp"", GF_ISOM_WRITE_EDIT, tmp_dir); e = import_file(orig, fileName, import_flags, force_fps, frames_per_sample); if (e) return e; } else { /*we open the original file in edit mode since we may have to rewrite AVC samples*/ orig = gf_isom_open(fileName, GF_ISOM_OPEN_EDIT, tmp_dir); } while (multi_cat) { char *sep = strchr(multi_cat, '+'); if (sep) sep[0] = 0; e = import_file(orig, multi_cat, import_flags, force_fps, frames_per_sample); if (e) { gf_isom_delete(orig); return e; } if (!sep) break; sep[0]=':'; multi_cat = sep+1; } nb_samp = 0; nb_tracks = gf_isom_get_track_count(orig); for (i=0; i1)) { insert_dts = 2*gf_isom_get_sample_dts(dest, dst_tk, count) - gf_isom_get_sample_dts(dest, dst_tk, count-1); } else { insert_dts = dest_track_dur_before_cat; if (!count) insert_dts = 0; } ts_scale = gf_isom_get_media_timescale(dest, dst_tk); ts_scale /= gf_isom_get_media_timescale(orig, i+1); /*if not a new track, see if we can merge the edit list - this is a crude test that only checks we have the same edit types*/ if (nb_edits && (nb_edits == gf_isom_get_edit_segment_count(dest, dst_tk)) ) { u64 editTime, segmentDuration, mediaTime, dst_editTime, dst_segmentDuration, dst_mediaTime; u8 dst_editMode, editMode; u32 j; merge_edits = 1; for (j=0; jDTS; samp->DTS = (u64) (ts_scale * samp->DTS + (new_track ? 0 : insert_dts)); samp->CTS_Offset = (u32) (samp->CTS_Offset * ts_scale); if (gf_isom_is_self_contained(orig, i+1, di)) { e = gf_isom_add_sample(dest, dst_tk, di, samp); } else { u64 offset; GF_ISOSample *s = gf_isom_get_sample_info(orig, i+1, j+1, &di, &offset); e = gf_isom_add_sample_reference(dest, dst_tk, di, samp, offset); gf_isom_sample_del(&s); } gf_isom_sample_del(&samp); if (e) goto err_exit; e = gf_isom_copy_sample_info(dest, dst_tk, orig, i+1, j+1); if (e) goto err_exit; gf_set_progress(""Appending"", nb_done, nb_samp); nb_done++; } /*scene description and text: compute last sample duration based on original media duration*/ if (!use_ts_dur) { insert_dts = gf_isom_get_media_duration(orig, i+1) - last_DTS; gf_isom_set_last_sample_duration(dest, dst_tk, (u32) insert_dts); } if (new_track && insert_dts) { u64 media_dur = gf_isom_get_media_duration(orig, i+1); /*convert from media time to track time*/ Double rescale = (Float) gf_isom_get_timescale(dest); rescale /= (Float) gf_isom_get_media_timescale(dest, dst_tk); /*convert from orig to dst time scale*/ rescale *= ts_scale; gf_isom_set_edit_segment(dest, dst_tk, 0, (u64) (s64) (insert_dts*rescale), 0, GF_ISOM_EDIT_EMPTY); gf_isom_set_edit_segment(dest, dst_tk, (u64) (s64) (insert_dts*rescale), (u64) (s64) (media_dur*rescale), 0, GF_ISOM_EDIT_NORMAL); } else if (merge_edits) { /*convert from media time to track time*/ Double rescale = (Float) gf_isom_get_timescale(dest); rescale /= (Float) gf_isom_get_media_timescale(dest, dst_tk); /*convert from orig to dst time scale*/ rescale *= ts_scale; /*get the first edit normal mode and add the new track dur*/ for (j=nb_edits; j>0; j--) { u64 editTime, segmentDuration, mediaTime; u8 editMode; gf_isom_get_edit_segment(dest, dst_tk, j, &editTime, &segmentDuration, &mediaTime, &editMode); if (editMode==GF_ISOM_EDIT_NORMAL) { Double prev_dur = (Double) (s64) dest_track_dur_before_cat; Double dur = (Double) (s64) gf_isom_get_media_duration(orig, i+1); dur *= rescale; prev_dur *= rescale; /*safety test: some files have broken edit lists. If no more than 2 entries, check that the segment duration is less or equal to the movie duration*/ if (prev_dur < segmentDuration) { fprintf(stderr, ""Warning: suspicious edit list entry found: duration %g sec but longest track duration before cat is %g - fixing it\n"", (Double) (s64) segmentDuration/1000.0, prev_dur/1000); segmentDuration = (u64) (s64) ( (Double) (s64) (dest_track_dur_before_cat - mediaTime) * rescale ); } segmentDuration += (u64) (s64) dur; gf_isom_modify_edit_segment(dest, dst_tk, j, segmentDuration, mediaTime, editMode); break; } } } else { u64 editTime, segmentDuration, mediaTime, edit_offset; Double t; u8 editMode; u32 j, count; count = gf_isom_get_edit_segment_count(dest, dst_tk); if (count) { e = gf_isom_get_edit_segment(dest, dst_tk, count, &editTime, &segmentDuration, &mediaTime, &editMode); if (e) { fprintf(stderr, ""Error: edit segment error on destination track %u could not be retrieved.\n"", dst_tk); goto err_exit; } } else if (gf_isom_get_edit_segment_count(orig, i+1)) { /*fake empty edit segment*/ /*convert from media time to track time*/ Double rescale = (Float) gf_isom_get_timescale(dest); rescale /= (Float) gf_isom_get_media_timescale(dest, dst_tk); segmentDuration = (u64) (dest_track_dur_before_cat * rescale); editTime = 0; mediaTime = 0; gf_isom_set_edit_segment(dest, dst_tk, editTime, segmentDuration, mediaTime, GF_ISOM_EDIT_NORMAL); } else { editTime = 0; segmentDuration = 0; } /*convert to dst time scale*/ ts_scale = (Float) gf_isom_get_timescale(dest); ts_scale /= (Float) gf_isom_get_timescale(orig); edit_offset = editTime + segmentDuration; count = gf_isom_get_edit_segment_count(orig, i+1); for (j=0; j 0)) { editMode = GF_ISOM_EDIT_NORMAL; } gf_isom_set_edit_segment(dest, dst_tk, editTime, segmentDuration, mediaTime, editMode); } } } gf_set_progress(""Appending"", nb_samp, nb_samp); /*check chapters*/ for (i=0; iRemoveClient(this); } ",0 "xmlXPathFunctionLookup(xmlXPathContextPtr ctxt, const xmlChar *name) { if (ctxt == NULL) return (NULL); if (ctxt->funcLookupFunc != NULL) { xmlXPathFunction ret; xmlXPathFuncLookupFunc f; f = ctxt->funcLookupFunc; ret = f(ctxt->funcLookupData, name, NULL); if (ret != NULL) return(ret); } return(xmlXPathFunctionLookupNS(ctxt, name, NULL)); } ",0 "XML_SetCharacterDataHandler(XML_Parser parser, XML_CharacterDataHandler handler) { if (parser != NULL) parser->m_characterDataHandler = handler; } ",0 "static struct sock *ping_get_next(struct seq_file *seq, struct sock *sk) { struct ping_iter_state *state = seq->private; struct net *net = seq_file_net(seq); do { sk = sk_nulls_next(sk); } while (sk && (!net_eq(sock_net(sk), net))); if (!sk) return ping_get_first(seq, state->bucket + 1); return sk; } ",0 " void WebstoreStandaloneInstaller::OnInstallPromptDone( ExtensionInstallPrompt::Result result) { if (result == ExtensionInstallPrompt::Result::USER_CANCELED) { CompleteInstall(webstore_install::USER_CANCELLED, kUserCancelledError); return; } if (result == ExtensionInstallPrompt::Result::ABORTED || !CheckRequestorAlive()) { CompleteInstall(webstore_install::ABORTED, std::string()); return; } DCHECK(result == ExtensionInstallPrompt::Result::ACCEPTED); std::unique_ptr approval = CreateApproval(); ExtensionService* extension_service = ExtensionSystem::Get(profile_)->extension_service(); const Extension* installed_extension = extension_service->GetExtensionById(id_, true /* include disabled */); if (installed_extension) { std::string install_message; webstore_install::Result install_result = webstore_install::SUCCESS; bool done = true; if (ExtensionPrefs::Get(profile_)->IsExtensionBlacklisted(id_)) { install_result = webstore_install::BLACKLISTED; install_message = kExtensionIsBlacklisted; } else if (!extension_service->IsExtensionEnabled(id_)) { extension_service->EnableExtension(id_); } // else extension is installed and enabled; no work to be done. if (done) { CompleteInstall(install_result, install_message); return; } } scoped_refptr installer = new WebstoreInstaller(profile_, this, GetWebContents(), id_, std::move(approval), install_source_); installer->Start(); } ",1 "void tfdt_del(GF_Box *s) { gf_free(s); } ",0 "bool LayoutBlockFlow::mustDiscardMarginAfterForChild(const LayoutBox& child) const { ASSERT(!child.selfNeedsLayout()); if (!child.isWritingModeRoot()) return child.isLayoutBlockFlow() ? toLayoutBlockFlow(&child)->mustDiscardMarginAfter() : (child.style()->marginAfterCollapse() == MDISCARD); if (child.isHorizontalWritingMode() == isHorizontalWritingMode()) return child.isLayoutBlockFlow() ? toLayoutBlockFlow(&child)->mustDiscardMarginBefore() : (child.style()->marginBeforeCollapse() == MDISCARD); return false; } ",0 "static void igmp_ifc_start_timer(struct in_device *in_dev, int delay) { int tv = net_random() % delay; if (!mod_timer(&in_dev->mr_ifc_timer, jiffies+tv+2)) in_dev_hold(in_dev); } ",0 "webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( const base::FilePath& file_path, const std::string& mime_type) { if (!PluginChannelHost::IsListening()) { LOG(ERROR) << ""PluginChannelHost isn't listening""; return NULL; } bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); if (in_process_plugin) { #if defined(OS_WIN) && !defined(USE_AURA) return webkit::npapi::WebPluginDelegateImpl::Create(file_path, mime_type); #else NOTIMPLEMENTED(); return NULL; #endif } return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); } ",0 "void _mkp_exit() { } ",0 "create_posix_buf(umode_t mode) { struct create_posix *buf; buf = kzalloc(sizeof(struct create_posix), GFP_KERNEL); if (!buf) return NULL; buf->ccontext.DataOffset = cpu_to_le16(offsetof(struct create_posix, Mode)); buf->ccontext.DataLength = cpu_to_le32(4); buf->ccontext.NameOffset = cpu_to_le16(offsetof(struct create_posix, Name)); buf->ccontext.NameLength = cpu_to_le16(16); /* SMB2_CREATE_TAG_POSIX is ""0x93AD25509CB411E7B42383DE968BCD7C"" */ buf->Name[0] = 0x93; buf->Name[1] = 0xAD; buf->Name[2] = 0x25; buf->Name[3] = 0x50; buf->Name[4] = 0x9C; buf->Name[5] = 0xB4; buf->Name[6] = 0x11; buf->Name[7] = 0xE7; buf->Name[8] = 0xB4; buf->Name[9] = 0x23; buf->Name[10] = 0x83; buf->Name[11] = 0xDE; buf->Name[12] = 0x96; buf->Name[13] = 0x8B; buf->Name[14] = 0xCD; buf->Name[15] = 0x7C; buf->Mode = cpu_to_le32(mode); cifs_dbg(FYI, ""mode on posix create 0%o"", mode); return buf; } ",0 "void license_free_scope_list(SCOPE_LIST* scopeList) { UINT32 i; /* * We must NOT call license_free_binary_blob() on each scopelist->array[i] element, * because scopelist->array was allocated at once, by a single call to malloc. The elements * it contains cannot be deallocated separately then. * To make things clean, we must deallocate each scopelist->array[].data, * and finish by deallocating scopelist->array with a single call to free(). */ for (i = 0; i < scopeList->count; i++) { free(scopeList->array[i].data); } free(scopeList->array); free(scopeList); } ",0 "jpc_pchglist_t *jpc_pchglist_create() { jpc_pchglist_t *pchglist; if (!(pchglist = jas_malloc(sizeof(jpc_pchglist_t)))) { return 0; } pchglist->numpchgs = 0; pchglist->maxpchgs = 0; pchglist->pchgs = 0; return pchglist; } ",0 "void ExecuteJavaScriptWithCallback(const std::string& javascript, const JavaScriptResultCallback& callback) { auto rvh = GetRenderViewHost(); if (!rvh) return; rvh->GetMainFrame()->ExecuteJavaScript(base::UTF8ToUTF16(javascript), callback); } ",0 "static void slab_bug(struct kmem_cache *s, char *fmt, ...) { va_list args; char buf[100]; va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); va_end(args); printk(KERN_ERR ""========================================"" ""=====================================\n""); printk(KERN_ERR ""BUG %s: %s\n"", s->name, buf); printk(KERN_ERR ""----------------------------------------"" ""-------------------------------------\n\n""); } ",0 "netdev_port_features_to_ofp11(enum netdev_features features) { return htonl(features & 0xffff); } ",0 "static void eseqiv_free(struct crypto_instance *inst) { skcipher_geniv_free(inst); crypto_put_default_rng(); } ",0 "static void btm_sec_collision_timeout (TIMER_LIST_ENT *p_tle) { tBTM_STATUS status; UNUSED(p_tle); BTM_TRACE_EVENT (""btm_sec_collision_timeout()""); btm_cb.sec_collision_tle.param = 0; status = btm_sec_execute_procedure (btm_cb.p_collided_dev_rec); /* If result is pending reply from the user or from the device is pending */ if (status != BTM_CMD_STARTED) { /* There is no next procedure or start of procedure failed, notify the waiting layer */ btm_sec_dev_rec_cback_event (btm_cb.p_collided_dev_rec, status, FALSE); } } ",0 "bool Textfield::SkipDefaultKeyEventProcessing(const ui::KeyEvent& event) { #if defined(OS_LINUX) && !defined(OS_CHROMEOS) ui::TextEditKeyBindingsDelegateAuraLinux* delegate = ui::GetTextEditKeyBindingsDelegate(); std::vector commands; if (delegate && delegate->MatchEvent(event, &commands)) { for (size_t i = 0; i < commands.size(); ++i) if (IsTextEditCommandEnabled(commands[i].command())) return true; } #endif const bool is_backspace = event.key_code() == ui::VKEY_BACK; return (is_backspace && !read_only()) || event.IsUnicodeKeyCode(); } ",0 "static void perf_event_context_sched_out(struct task_struct *task, int ctxn, struct task_struct *next) { struct perf_event_context *ctx = task->perf_event_ctxp[ctxn]; struct perf_event_context *next_ctx; struct perf_event_context *parent, *next_parent; struct perf_cpu_context *cpuctx; int do_switch = 1; if (likely(!ctx)) return; cpuctx = __get_cpu_context(ctx); if (!cpuctx->task_ctx) return; rcu_read_lock(); next_ctx = next->perf_event_ctxp[ctxn]; if (!next_ctx) goto unlock; parent = rcu_dereference(ctx->parent_ctx); next_parent = rcu_dereference(next_ctx->parent_ctx); /* If neither context have a parent context; they cannot be clones. */ if (!parent && !next_parent) goto unlock; if (next_parent == ctx || next_ctx == parent || next_parent == parent) { /* * Looks like the two contexts are clones, so we might be * able to optimize the context switch. We lock both * contexts and check that they are clones under the * lock (including re-checking that neither has been * uncloned in the meantime). It doesn't matter which * order we take the locks because no other cpu could * be trying to lock both of these tasks. */ raw_spin_lock(&ctx->lock); raw_spin_lock_nested(&next_ctx->lock, SINGLE_DEPTH_NESTING); if (context_equiv(ctx, next_ctx)) { WRITE_ONCE(ctx->task, next); WRITE_ONCE(next_ctx->task, task); swap(ctx->task_ctx_data, next_ctx->task_ctx_data); /* * RCU_INIT_POINTER here is safe because we've not * modified the ctx and the above modification of * ctx->task and ctx->task_ctx_data are immaterial * since those values are always verified under * ctx->lock which we're now holding. */ RCU_INIT_POINTER(task->perf_event_ctxp[ctxn], next_ctx); RCU_INIT_POINTER(next->perf_event_ctxp[ctxn], ctx); do_switch = 0; perf_event_sync_stat(ctx, next_ctx); } raw_spin_unlock(&next_ctx->lock); raw_spin_unlock(&ctx->lock); } unlock: rcu_read_unlock(); if (do_switch) { raw_spin_lock(&ctx->lock); task_ctx_sched_out(cpuctx, ctx, EVENT_ALL); raw_spin_unlock(&ctx->lock); } } ",0 "log_data_element(int log_level, const char *file, const char *function, int line, const char *prefix, xmlNode * data, int depth, int options) { xmlNode *a_child = NULL; char *prefix_m = NULL; if (prefix == NULL) { prefix = """"; } /* Since we use the same file and line, to avoid confusing libqb, we need to use the same format strings */ if (data == NULL) { do_crm_log_alias(log_level, file, function, line, ""%s: %s"", prefix, ""No data to dump as XML""); return; } if(is_set(options, xml_log_option_dirty_add) || is_set(options, xml_log_option_dirty_add)) { __xml_log_change_element(log_level, file, function, line, prefix, data, depth, options); return; } if (is_set(options, xml_log_option_formatted)) { if (is_set(options, xml_log_option_diff_plus) && (data->children == NULL || crm_element_value(data, XML_DIFF_MARKER))) { options |= xml_log_option_diff_all; prefix_m = strdup(prefix); prefix_m[1] = '+'; prefix = prefix_m; } else if (is_set(options, xml_log_option_diff_minus) && (data->children == NULL || crm_element_value(data, XML_DIFF_MARKER))) { options |= xml_log_option_diff_all; prefix_m = strdup(prefix); prefix_m[1] = '-'; prefix = prefix_m; } } if (is_set(options, xml_log_option_diff_short) && is_not_set(options, xml_log_option_diff_all)) { /* Still searching for the actual change */ for (a_child = __xml_first_child(data); a_child != NULL; a_child = __xml_next(a_child)) { log_data_element(log_level, file, function, line, prefix, a_child, depth + 1, options); } return; } __xml_log_element(log_level, file, function, line, prefix, data, depth, options|xml_log_option_open|xml_log_option_close|xml_log_option_children); free(prefix_m); } ",0 "static int crypto_pcomp_report(struct sk_buff *skb, struct crypto_alg *alg) { return -ENOSYS; } ",0 " static int udf_load_logicalvol(struct super_block *sb, sector_t block, struct kernel_lb_addr *fileset) { struct logicalVolDesc *lvd; int i, j, offset; uint8_t type; struct udf_sb_info *sbi = UDF_SB(sb); struct genericPartitionMap *gpm; uint16_t ident; struct buffer_head *bh; unsigned int table_len; int ret = 0; bh = udf_read_tagged(sb, block, block, &ident); if (!bh) return 1; BUG_ON(ident != TAG_IDENT_LVD); lvd = (struct logicalVolDesc *)bh->b_data; table_len = le32_to_cpu(lvd->mapTableLength); if (sizeof(*lvd) + table_len > sb->s_blocksize) { udf_err(sb, ""error loading logical volume descriptor: "" ""Partition table too long (%u > %lu)\n"", table_len, sb->s_blocksize - sizeof(*lvd)); goto out_bh; } ret = udf_sb_alloc_partition_maps(sb, le32_to_cpu(lvd->numPartitionMaps)); if (ret) goto out_bh; for (i = 0, offset = 0; i < sbi->s_partitions && offset < table_len; i++, offset += gpm->partitionMapLength) { struct udf_part_map *map = &sbi->s_partmaps[i]; gpm = (struct genericPartitionMap *) &(lvd->partitionMaps[offset]); type = gpm->partitionMapType; if (type == 1) { struct genericPartitionMap1 *gpm1 = (struct genericPartitionMap1 *)gpm; map->s_partition_type = UDF_TYPE1_MAP15; map->s_volumeseqnum = le16_to_cpu(gpm1->volSeqNum); map->s_partition_num = le16_to_cpu(gpm1->partitionNum); map->s_partition_func = NULL; } else if (type == 2) { struct udfPartitionMap2 *upm2 = (struct udfPartitionMap2 *)gpm; if (!strncmp(upm2->partIdent.ident, UDF_ID_VIRTUAL, strlen(UDF_ID_VIRTUAL))) { u16 suf = le16_to_cpu(((__le16 *)upm2->partIdent. identSuffix)[0]); if (suf < 0x0200) { map->s_partition_type = UDF_VIRTUAL_MAP15; map->s_partition_func = udf_get_pblock_virt15; } else { map->s_partition_type = UDF_VIRTUAL_MAP20; map->s_partition_func = udf_get_pblock_virt20; } } else if (!strncmp(upm2->partIdent.ident, UDF_ID_SPARABLE, strlen(UDF_ID_SPARABLE))) { uint32_t loc; struct sparingTable *st; struct sparablePartitionMap *spm = (struct sparablePartitionMap *)gpm; map->s_partition_type = UDF_SPARABLE_MAP15; map->s_type_specific.s_sparing.s_packet_len = le16_to_cpu(spm->packetLength); for (j = 0; j < spm->numSparingTables; j++) { struct buffer_head *bh2; loc = le32_to_cpu( spm->locSparingTable[j]); bh2 = udf_read_tagged(sb, loc, loc, &ident); map->s_type_specific.s_sparing. s_spar_map[j] = bh2; if (bh2 == NULL) continue; st = (struct sparingTable *)bh2->b_data; if (ident != 0 || strncmp( st->sparingIdent.ident, UDF_ID_SPARING, strlen(UDF_ID_SPARING))) { brelse(bh2); map->s_type_specific.s_sparing. s_spar_map[j] = NULL; } } map->s_partition_func = udf_get_pblock_spar15; } else if (!strncmp(upm2->partIdent.ident, UDF_ID_METADATA, strlen(UDF_ID_METADATA))) { struct udf_meta_data *mdata = &map->s_type_specific.s_metadata; struct metadataPartitionMap *mdm = (struct metadataPartitionMap *) &(lvd->partitionMaps[offset]); udf_debug(""Parsing Logical vol part %d type %d id=%s\n"", i, type, UDF_ID_METADATA); map->s_partition_type = UDF_METADATA_MAP25; map->s_partition_func = udf_get_pblock_meta25; mdata->s_meta_file_loc = le32_to_cpu(mdm->metadataFileLoc); mdata->s_mirror_file_loc = le32_to_cpu(mdm->metadataMirrorFileLoc); mdata->s_bitmap_file_loc = le32_to_cpu(mdm->metadataBitmapFileLoc); mdata->s_alloc_unit_size = le32_to_cpu(mdm->allocUnitSize); mdata->s_align_unit_size = le16_to_cpu(mdm->alignUnitSize); if (mdm->flags & 0x01) mdata->s_flags |= MF_DUPLICATE_MD; udf_debug(""Metadata Ident suffix=0x%x\n"", le16_to_cpu(*(__le16 *) mdm->partIdent.identSuffix)); udf_debug(""Metadata part num=%d\n"", le16_to_cpu(mdm->partitionNum)); udf_debug(""Metadata part alloc unit size=%d\n"", le32_to_cpu(mdm->allocUnitSize)); udf_debug(""Metadata file loc=%d\n"", le32_to_cpu(mdm->metadataFileLoc)); udf_debug(""Mirror file loc=%d\n"", le32_to_cpu(mdm->metadataMirrorFileLoc)); udf_debug(""Bitmap file loc=%d\n"", le32_to_cpu(mdm->metadataBitmapFileLoc)); udf_debug(""Flags: %d %d\n"", mdata->s_flags, mdm->flags); } else { udf_debug(""Unknown ident: %s\n"", upm2->partIdent.ident); continue; } map->s_volumeseqnum = le16_to_cpu(upm2->volSeqNum); map->s_partition_num = le16_to_cpu(upm2->partitionNum); } udf_debug(""Partition (%d:%d) type %d on volume %d\n"", i, map->s_partition_num, type, map->s_volumeseqnum); } if (fileset) { struct long_ad *la = (struct long_ad *)&(lvd->logicalVolContentsUse[0]); *fileset = lelb_to_cpu(la->extLocation); udf_debug(""FileSet found in LogicalVolDesc at block=%d, partition=%d\n"", fileset->logicalBlockNum, fileset->partitionReferenceNum); } if (lvd->integritySeqExt.extLength) udf_load_logicalvolint(sb, leea_to_cpu(lvd->integritySeqExt)); out_bh: brelse(bh); return ret; } ",1 "BaseShadow::reconnectFailed( const char* reason ) { dprintf( D_ALWAYS, ""Reconnect FAILED: %s\n"", reason ); logReconnectFailedEvent( reason ); DC_Exit( JOB_SHOULD_REQUEUE ); } ",0 "static void hid_free_dynids(struct hid_driver *hdrv) { struct hid_dynid *dynid, *n; spin_lock(&hdrv->dyn_lock); list_for_each_entry_safe(dynid, n, &hdrv->dyn_list, list) { list_del(&dynid->list); kfree(dynid); } spin_unlock(&hdrv->dyn_lock); } ",0 "void RenderFrameHostManager::SendPageMessage(IPC::Message* msg, SiteInstance* instance_to_skip) { DCHECK(IPC_MESSAGE_CLASS(*msg) == PageMsgStart); DCHECK(!frame_tree_node_->parent()); if ((IPC_MESSAGE_CLASS(*msg) != PageMsgStart) || frame_tree_node_->parent()) { delete msg; return; } auto send_msg = [instance_to_skip](IPC::Sender* sender, int routing_id, IPC::Message* msg, SiteInstance* sender_instance) { if (sender_instance == instance_to_skip) return; IPC::Message* copy = new IPC::Message(*msg); copy->set_routing_id(routing_id); sender->Send(copy); }; RenderFrameProxyHost* outer_delegate_proxy = ForInnerDelegate() ? GetProxyToOuterDelegate() : nullptr; for (const auto& pair : proxy_hosts_) { if (outer_delegate_proxy != pair.second.get()) { send_msg(pair.second.get(), pair.second->GetRoutingID(), msg, pair.second->GetSiteInstance()); } } if (speculative_render_frame_host_) { send_msg(speculative_render_frame_host_.get(), speculative_render_frame_host_->GetRoutingID(), msg, speculative_render_frame_host_->GetSiteInstance()); } else if (pending_render_frame_host_) { send_msg(pending_render_frame_host_.get(), pending_render_frame_host_->GetRoutingID(), msg, pending_render_frame_host_->GetSiteInstance()); } if (render_frame_host_->GetSiteInstance() != instance_to_skip) { msg->set_routing_id(render_frame_host_->GetRoutingID()); render_frame_host_->Send(msg); } else { delete msg; } } ",0 "static char * fsmFsPath(rpmfi fi, const char * suffix) { return rstrscat(NULL, rpmfiDN(fi), rpmfiBN(fi), suffix ? suffix : """", NULL); } ",0 "static int vm_stat_get(void *_offset, u64 *val) { unsigned offset = (long)_offset; struct kvm *kvm; *val = 0; raw_spin_lock(&kvm_lock); list_for_each_entry(kvm, &vm_list, vm_list) *val += *(u32 *)((void *)kvm + offset); raw_spin_unlock(&kvm_lock); return 0; } ",0 "void RenderFrameHostImpl::CreateMediaStreamDispatcherHost( MediaStreamManager* media_stream_manager, mojom::MediaStreamDispatcherHostRequest request) { DCHECK_CURRENTLY_ON(BrowserThread::IO); if (!media_stream_dispatcher_host_) { media_stream_dispatcher_host_.reset(new MediaStreamDispatcherHost( GetProcess()->GetID(), GetRoutingID(), media_stream_manager)); } media_stream_dispatcher_host_->BindRequest(std::move(request)); } ",1 "int __glXDisp_CreateContextWithConfigSGIX(__GLXclientState *cl, GLbyte *pc) { xGLXCreateContextWithConfigSGIXReq *req = (xGLXCreateContextWithConfigSGIXReq *) pc; __GLXconfig *config; __GLXscreen *pGlxScreen; int err; if (!validGlxScreen(cl->client, req->screen, &pGlxScreen, &err)) return err; if (!validGlxFBConfig(cl->client, pGlxScreen, req->fbconfig, &config, &err)) return err; return DoCreateContext(cl, req->context, req->shareList, config, pGlxScreen, req->isDirect); } ",0 "static int xfrm_alloc_replay_state_esn(struct xfrm_replay_state_esn **replay_esn, struct xfrm_replay_state_esn **preplay_esn, struct nlattr *rta) { struct xfrm_replay_state_esn *p, *pp, *up; if (!rta) return 0; up = nla_data(rta); p = kmemdup(up, xfrm_replay_state_esn_len(up), GFP_KERNEL); if (!p) return -ENOMEM; pp = kmemdup(up, xfrm_replay_state_esn_len(up), GFP_KERNEL); if (!pp) { kfree(p); return -ENOMEM; } *replay_esn = p; *preplay_esn = pp; return 0; } ",0 "bool JSTestActiveDOMObjectPrototype::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { JSTestActiveDOMObjectPrototype* thisObject = jsCast(object); return getStaticFunctionDescriptor(exec, &JSTestActiveDOMObjectPrototypeTable, thisObject, propertyName, descriptor); } ",0 "void ReadAndVerifyTransaction(net::HttpTransaction* trans, const MockTransaction& trans_info) { std::string content; int rv = ReadTransaction(trans, &content); EXPECT_EQ(net::OK, rv); std::string expected(trans_info.data); EXPECT_EQ(expected, content); } ",0 "static inline unsigned char *read_buf_addr(struct n_tty_data *ldata, size_t i) { return &ldata->read_buf[i & (N_TTY_BUF_SIZE - 1)]; } ",0 "static void ohci_child_detach(USBPort *port1, USBDevice *child) { OHCIState *s = port1->opaque; ohci_async_cancel_device(s, child); } ",0 "void RenderFrameImpl::CommitFailedNavigation( const CommonNavigationParams& common_params, const RequestNavigationParams& request_params, bool has_stale_copy_in_cache, int error_code, const base::Optional& error_page_content, std::unique_ptr subresource_loader_factories, CommitFailedNavigationCallback callback) { TRACE_EVENT1(""navigation,benchmark,rail"", ""RenderFrameImpl::CommitFailedNavigation"", ""id"", routing_id_); DCHECK( !FrameMsg_Navigate_Type::IsSameDocument(common_params.navigation_type)); RenderFrameImpl::PrepareRenderViewForNavigation(common_params.url, request_params); sync_navigation_callback_.Cancel(); if (frame_->Parent() && error_code == net::ERR_CERT_SYMANTEC_LEGACY) { ReportLegacySymantecCert(common_params.url, true /* did_fail */); } GetContentClient()->SetActiveURL( common_params.url, frame_->Top()->GetSecurityOrigin().ToString().Utf8()); SetupLoaderFactoryBundle(std::move(subresource_loader_factories), base::nullopt /* subresource_overrides */, nullptr /* prefetch_loader_factory */); WebURLError error( error_code, 0, has_stale_copy_in_cache ? WebURLError::HasCopyInCache::kTrue : WebURLError::HasCopyInCache::kFalse, WebURLError::IsWebSecurityViolation::kFalse, common_params.url); WebURLRequest failed_request = CreateURLRequestForNavigation( common_params, request_params, /*response_override=*/nullptr, frame_->IsViewSourceModeEnabled()); if (!ShouldDisplayErrorPageForFailedLoad(error_code, common_params.url)) { std::move(callback).Run(blink::mojom::CommitResult::Aborted); Send(new FrameHostMsg_DidStopLoading(routing_id_)); browser_side_navigation_pending_ = false; browser_side_navigation_pending_url_ = GURL(); return; } blink::WebNavigationControl::FallbackContentResult fallback_result = frame_->MaybeRenderFallbackContent(error); if (fallback_result != blink::WebNavigationControl::NoFallbackContent) { if (fallback_result == blink::WebNavigationControl::NoLoadInProgress) { std::move(callback).Run(blink::mojom::CommitResult::Aborted); Send(new FrameHostMsg_DidStopLoading(routing_id_)); } else { std::move(callback).Run(blink::mojom::CommitResult::Ok); } browser_side_navigation_pending_ = false; browser_side_navigation_pending_url_ = GURL(); return; } bool is_reload_or_history = FrameMsg_Navigate_Type::IsReload(common_params.navigation_type) || FrameMsg_Navigate_Type::IsHistory(common_params.navigation_type); bool replace = is_reload_or_history || common_params.url == GetLoadingUrl() || common_params.should_replace_current_entry; std::unique_ptr history_entry; if (request_params.page_state.IsValid()) history_entry = PageStateToHistoryEntry(request_params.page_state); if (request_params.nav_entry_id == 0) { NotifyObserversOfFailedProvisionalLoad(error); if (frame_->GetProvisionalDocumentLoader()) { SendFailedProvisionalLoad(failed_request, error, frame_); } } std::string error_html; if (error_page_content.has_value()) { error_html = error_page_content.value(); GetContentClient()->renderer()->PrepareErrorPage(this, failed_request, error, nullptr); } else { GetContentClient()->renderer()->PrepareErrorPage(this, failed_request, error, &error_html); } frame_->EnableViewSourceMode(false); auto navigation_params = std::make_unique(); if (history_entry) { navigation_params->frame_load_type = WebFrameLoadType::kBackForward; navigation_params->history_item = history_entry->root(); } else if (replace) { navigation_params->frame_load_type = WebFrameLoadType::kReplaceCurrentItem; } navigation_params->service_worker_network_provider = BuildServiceWorkerNetworkProviderForNavigation(&request_params, nullptr); FillNavigationParams(common_params, request_params, navigation_params.get()); failed_request.SetURL(GURL(kUnreachableWebDataURL)); failed_request.SetCacheMode(blink::mojom::FetchCacheMode::kNoStore); navigation_params->request = failed_request; navigation_params->data = WebData(error_html.data(), error_html.length()); navigation_params->mime_type = ""text/html""; navigation_params->text_encoding = ""UTF-8""; navigation_params->unreachable_url = error.url(); std::unique_ptr document_state = BuildDocumentStateFromParams( common_params, request_params, base::TimeTicks(), std::move(callback), nullptr); base::WeakPtr weak_this = weak_factory_.GetWeakPtr(); frame_->CommitNavigation(std::move(navigation_params), std::move(document_state)); if (!weak_this) return; browser_side_navigation_pending_ = false; browser_side_navigation_pending_url_ = GURL(); } ",0 "TabSpecificContentSettings::SiteDataObserver::~SiteDataObserver() { if (tab_specific_content_settings_) tab_specific_content_settings_->RemoveSiteDataObserver(this); } ",0 "static struct ucma_context *ucma_get_ctx(struct ucma_file *file, int id) { struct ucma_context *ctx; mutex_lock(&mut); ctx = _ucma_find_context(id, file); if (!IS_ERR(ctx)) { if (ctx->closing) ctx = ERR_PTR(-EIO); else atomic_inc(&ctx->ref); } mutex_unlock(&mut); return ctx; } ",0 "void BluetoothAdapterChromeOS::OnStopDiscoveryError( const ErrorCallback& error_callback, const std::string& error_name, const std::string& error_message) { LOG(WARNING) << object_path_.value() << "": Failed to stop discovery: "" << error_name << "": "" << error_message; error_callback.Run(); } ",0 "string_has_highlight_regex (const char *string, const char *regex) { regex_t reg; int rc; if (!string || !regex || !regex[0]) return 0; if (string_regcomp (®, regex, REG_EXTENDED | REG_ICASE) != 0) return 0; rc = string_has_highlight_regex_compiled (string, ®); regfree (®); return rc; } ",0 " static base::FilePath install_dir() { base::FilePath result; PathService::Get(DIR_SW_REPORTER, &result); return result; } ",0 "void WebContentsImpl::Init(const WebContents::CreateParams& params) { visibility_ = params.initially_hidden ? Visibility::HIDDEN : Visibility::VISIBLE; if (!params.last_active_time.is_null()) last_active_time_ = params.last_active_time; DCHECK((params.routing_id == MSG_ROUTING_NONE && params.main_frame_routing_id == MSG_ROUTING_NONE && params.main_frame_widget_routing_id == MSG_ROUTING_NONE) || (params.routing_id != MSG_ROUTING_NONE && params.main_frame_routing_id != MSG_ROUTING_NONE && params.main_frame_widget_routing_id != MSG_ROUTING_NONE)); scoped_refptr site_instance = params.site_instance; if (!site_instance) site_instance = SiteInstance::Create(params.browser_context); if (params.desired_renderer_state == CreateParams::kNoRendererProcess) { static_cast(site_instance.get()) ->PreventAssociationWithSpareProcess(); } int32_t view_routing_id = params.routing_id; int32_t main_frame_widget_routing_id = params.main_frame_widget_routing_id; if (main_frame_widget_routing_id == MSG_ROUTING_NONE) { view_routing_id = site_instance->GetProcess()->GetNextRoutingID(); main_frame_widget_routing_id = site_instance->GetProcess()->GetNextRoutingID(); } DCHECK_NE(view_routing_id, main_frame_widget_routing_id); GetRenderManager()->Init( site_instance.get(), view_routing_id, params.main_frame_routing_id, main_frame_widget_routing_id, params.renderer_initiated_creation); std::string unique_name; frame_tree_.root()->SetFrameName(params.main_frame_name, unique_name); WebContentsViewDelegate* delegate = GetContentClient()->browser()->GetWebContentsViewDelegate(this); if (GuestMode::IsCrossProcessFrameGuest(this)) { view_.reset(new WebContentsViewChildFrame( this, delegate, &render_view_host_delegate_view_)); } else { view_.reset(CreateWebContentsView(this, delegate, &render_view_host_delegate_view_)); if (browser_plugin_guest_) { view_ = std::make_unique( this, browser_plugin_guest_.get(), std::move(view_), &render_view_host_delegate_view_); } } CHECK(render_view_host_delegate_view_); CHECK(view_.get()); gfx::Size initial_size = params.initial_size; view_->CreateView(initial_size, params.context); #if BUILDFLAG(ENABLE_PLUGINS) plugin_content_origin_whitelist_.reset( new PluginContentOriginWhitelist(this)); #endif registrar_.Add(this, NOTIFICATION_RENDER_WIDGET_HOST_DESTROYED, NotificationService::AllBrowserContextsAndSources()); screen_orientation_provider_.reset(new ScreenOrientationProvider(this)); manifest_manager_host_.reset(new ManifestManagerHost(this)); #if defined(OS_ANDROID) date_time_chooser_.reset(new DateTimeChooserAndroid()); #endif if (browser_plugin_guest_) browser_plugin_guest_->Init(); for (size_t i = 0; i < g_created_callbacks.Get().size(); i++) g_created_callbacks.Get().at(i).Run(this); if (params.renderer_initiated_creation) { GetRenderViewHost()->GetWidget()->set_renderer_initialized(true); GetRenderViewHost()->DispatchRenderViewCreated(); GetRenderManager()->current_frame_host()->SetRenderFrameCreated(true); } if (params.desired_renderer_state == CreateParams::kInitializeAndWarmupRendererProcess) { if (!GetRenderManager()->current_frame_host()->IsRenderFrameLive()) { GetRenderManager()->InitRenderView(GetRenderViewHost(), nullptr); } } NotifySwappedFromRenderManager( nullptr, GetRenderManager()->current_frame_host(), true); } ",0 "static int ftrace_check_record(struct dyn_ftrace *rec, int enable, int update) { unsigned long flag = 0UL; /* * If we are updating calls: * * If the record has a ref count, then we need to enable it * because someone is using it. * * Otherwise we make sure its disabled. * * If we are disabling calls, then disable all records that * are enabled. */ if (enable && (rec->flags & ~FTRACE_FL_MASK)) flag = FTRACE_FL_ENABLED; /* * If enabling and the REGS flag does not match the REGS_EN, then * do not ignore this record. Set flags to fail the compare against * ENABLED. */ if (flag && (!(rec->flags & FTRACE_FL_REGS) != !(rec->flags & FTRACE_FL_REGS_EN))) flag |= FTRACE_FL_REGS; /* If the state of this record hasn't changed, then do nothing */ if ((rec->flags & FTRACE_FL_ENABLED) == flag) return FTRACE_UPDATE_IGNORE; if (flag) { /* Save off if rec is being enabled (for return value) */ flag ^= rec->flags & FTRACE_FL_ENABLED; if (update) { rec->flags |= FTRACE_FL_ENABLED; if (flag & FTRACE_FL_REGS) { if (rec->flags & FTRACE_FL_REGS) rec->flags |= FTRACE_FL_REGS_EN; else rec->flags &= ~FTRACE_FL_REGS_EN; } } /* * If this record is being updated from a nop, then * return UPDATE_MAKE_CALL. * Otherwise, if the EN flag is set, then return * UPDATE_MODIFY_CALL_REGS to tell the caller to convert * from the non-save regs, to a save regs function. * Otherwise, * return UPDATE_MODIFY_CALL to tell the caller to convert * from the save regs, to a non-save regs function. */ if (flag & FTRACE_FL_ENABLED) return FTRACE_UPDATE_MAKE_CALL; else if (rec->flags & FTRACE_FL_REGS_EN) return FTRACE_UPDATE_MODIFY_CALL_REGS; else return FTRACE_UPDATE_MODIFY_CALL; } if (update) { /* If there's no more users, clear all flags */ if (!(rec->flags & ~FTRACE_FL_MASK)) rec->flags = 0; else /* Just disable the record (keep REGS state) */ rec->flags &= ~FTRACE_FL_ENABLED; } return FTRACE_UPDATE_MAKE_NOP; } ",0 "void SaveImpl(const char* name, v8::Local value, v8::Local context) { CHECK(!value.IsEmpty() && value->IsObject()) << name; context->Global() ->SetPrivate(context, MakeKey(name, context->GetIsolate()), value) .FromJust(); } ",0 "cmd_http_send(CMD_ARGS) { struct http *hp; int i; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); AN(av[1]); AZ(av[2]); vtc_dump(hp->vl, 4, ""send"", av[1], -1); i = write(hp->fd, av[1], strlen(av[1])); if (i != strlen(av[1])) vtc_log(hp->vl, hp->fatal, ""Write error in http_send(): %s"", strerror(errno)); } ",0 "static int napi_poll(struct napi_struct *n, struct list_head *repoll) { void *have; int work, weight; list_del_init(&n->poll_list); have = netpoll_poll_lock(n); weight = n->weight; /* This NAPI_STATE_SCHED test is for avoiding a race * with netpoll's poll_napi(). Only the entity which * obtains the lock and sees NAPI_STATE_SCHED set will * actually make the ->poll() call. Therefore we avoid * accidentally calling ->poll() when NAPI is not scheduled. */ work = 0; if (test_bit(NAPI_STATE_SCHED, &n->state)) { work = n->poll(n, weight); trace_napi_poll(n, work, weight); } WARN_ON_ONCE(work > weight); if (likely(work < weight)) goto out_unlock; /* Drivers must not modify the NAPI state if they * consume the entire weight. In such cases this code * still ""owns"" the NAPI instance and therefore can * move the instance around on the list at-will. */ if (unlikely(napi_disable_pending(n))) { napi_complete(n); goto out_unlock; } if (n->gro_list) { /* flush too old packets * If HZ < 1000, flush all packets. */ napi_gro_flush(n, HZ >= 1000); } /* Some drivers may have called napi_schedule * prior to exhausting their budget. */ if (unlikely(!list_empty(&n->poll_list))) { pr_warn_once(""%s: Budget exhausted after napi rescheduled\n"", n->dev ? n->dev->name : ""backlog""); goto out_unlock; } list_add_tail(&n->poll_list, repoll); out_unlock: netpoll_poll_unlock(have); return work; } ",0 " void OnWriteText(const std::string& text) { last_text_ = text; } ",0 "static bt_status_t init_ctrl(btrc_ctrl_callbacks_t* callbacks ) { BTIF_TRACE_EVENT(""## %s ##"", __FUNCTION__); bt_status_t result = BT_STATUS_SUCCESS; if (bt_rc_ctrl_callbacks) return BT_STATUS_DONE; bt_rc_ctrl_callbacks = callbacks; memset (&btif_rc_cb, 0, sizeof(btif_rc_cb)); btif_rc_cb.rc_vol_label=MAX_LABEL; btif_rc_cb.rc_volume=MAX_VOLUME; lbl_init(); return result; } ",0 "test_bson_append_binary (void) { const static uint8_t binary[] = {'1', '2', '3', '4'}; bson_t *b; bson_t *b2; b = bson_new (); BSON_ASSERT ( bson_append_binary (b, ""binary"", -1, BSON_SUBTYPE_USER, binary, 4)); b2 = get_bson (""test24.bson""); BSON_ASSERT_BSON_EQUAL (b, b2); bson_destroy (b); bson_destroy (b2); } ",0 "int sched_setscheduler(struct task_struct *p, int policy, const struct sched_param *param) { return __sched_setscheduler(p, policy, param, true); } ",0 "void GraphicsContext::clearRect(const FloatRect&) { notImplemented(); } ",0 "int snd_pcm_hw_constraint_list(struct snd_pcm_runtime *runtime, unsigned int cond, snd_pcm_hw_param_t var, const struct snd_pcm_hw_constraint_list *l) { return snd_pcm_hw_rule_add(runtime, cond, var, snd_pcm_hw_rule_list, (void *)l, var, -1); } ",0 "void WebContentsImpl::GenerateMHTML( const base::FilePath& file, const base::Callback& callback) { MHTMLGenerationManager::GetInstance()->SaveMHTML(this, file, callback); } ",0 "namecmp(const void *key, const void *name) { return strcmp((char *)key, *(char **)name); } ",0 "void ConfirmEmailDialogDelegate::OnCanceled() { base::ResetAndReturn(&callback_).Run(START_SYNC); } ",0 "bool GLSurfaceOzoneSurfacelessSurfaceImpl::Resize(const gfx::Size& size, float scale_factor, bool has_alpha) { if (size == GetSize()) return true; return GLSurfaceOzoneSurfaceless::Resize(size, scale_factor, true) && CreatePixmaps(); } ",0 "void WorkerThread::interruptAndDispatchInspectorCommands() { MutexLocker locker(m_workerInspectorControllerMutex); if (m_workerInspectorController) m_workerInspectorController->interruptAndDispatchInspectorCommands(); } ",0 "bool GLES2DecoderImpl::SetVertexAttribValue( const char* function_name, GLuint index, const GLfloat* value) { if (index >= state_.attrib_values.size()) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, ""index out of range""); return false; } Vec4& v = state_.attrib_values[index]; v.v[0] = value[0]; v.v[1] = value[1]; v.v[2] = value[2]; v.v[3] = value[3]; return true; } ",0 "void rose_requeue_frames(struct sock *sk) { struct sk_buff *skb, *skb_prev = NULL; /* * Requeue all the un-ack-ed frames on the output queue to be picked * up by rose_kick. This arrangement handles the possibility of an * empty output queue. */ while ((skb = skb_dequeue(&rose_sk(sk)->ack_queue)) != NULL) { if (skb_prev == NULL) skb_queue_head(&sk->sk_write_queue, skb); else skb_append(skb_prev, skb, &sk->sk_write_queue); skb_prev = skb; } } ",0 "gpc_sG(Pixel *out, const Pixel *in, const Background *back) { (void)back; out->r = out->g = out->b = sRGB(YfromRGBint(in->r, in->g, in->b)/65535); out->a = 255; } ",0 "xsltGetQNameProperty(xsltStylesheetPtr style, xmlNodePtr inst, const xmlChar *propName, int mandatory, int *hasProp, const xmlChar **nsName, const xmlChar** localName) { const xmlChar *prop; if (nsName) *nsName = NULL; if (localName) *localName = NULL; if (hasProp) *hasProp = 0; prop = xsltGetCNsProp(style, inst, propName, XSLT_NAMESPACE); if (prop == NULL) { if (mandatory) { xsltTransformError(NULL, style, inst, ""The attribute '%s' is missing.\n"", propName); style->errors++; return; } } else { const xmlChar *URI; if (xmlValidateQName(prop, 0)) { xsltTransformError(NULL, style, inst, ""The value '%s' of the attribute "" ""'%s' is not a valid QName.\n"", prop, propName); style->errors++; return; } else { /* * @prop will be in the string dict afterwards, @URI not. */ URI = xsltGetQNameURI2(style, inst, &prop); if (prop == NULL) { style->errors++; } else { *localName = prop; if (hasProp) *hasProp = 1; if (URI != NULL) { /* * Fixes bug #308441: Put the ns-name in the dict * in order to pointer compare names during XPath's * variable lookup. */ if (nsName) *nsName = xmlDictLookup(style->dict, URI, -1); /* comp->has_ns = 1; */ } } } } return; } ",1 "xfs_da_read_buf( struct xfs_trans *trans, struct xfs_inode *dp, xfs_dablk_t bno, xfs_daddr_t mappedbno, struct xfs_buf **bpp, int whichfork, const struct xfs_buf_ops *ops) { struct xfs_buf *bp; struct xfs_buf_map map; struct xfs_buf_map *mapp; int nmap; int error; *bpp = NULL; mapp = ↦ nmap = 1; error = xfs_dabuf_map(trans, dp, bno, mappedbno, whichfork, &mapp, &nmap); if (error) { /* mapping a hole is not an error, but we don't continue */ if (error == -1) error = 0; goto out_free; } error = xfs_trans_read_buf_map(dp->i_mount, trans, dp->i_mount->m_ddev_targp, mapp, nmap, 0, &bp, ops); if (error) goto out_free; if (whichfork == XFS_ATTR_FORK) xfs_buf_set_ref(bp, XFS_ATTR_BTREE_REF); else xfs_buf_set_ref(bp, XFS_DIR_BTREE_REF); /* * This verification code will be moved to a CRC verification callback * function so just leave it here unchanged until then. */ { xfs_dir2_data_hdr_t *hdr = bp->b_addr; xfs_dir2_free_t *free = bp->b_addr; xfs_da_blkinfo_t *info = bp->b_addr; uint magic, magic1; struct xfs_mount *mp = dp->i_mount; magic = be16_to_cpu(info->magic); magic1 = be32_to_cpu(hdr->magic); if (unlikely( XFS_TEST_ERROR((magic != XFS_DA_NODE_MAGIC) && (magic != XFS_DA3_NODE_MAGIC) && (magic != XFS_ATTR_LEAF_MAGIC) && (magic != XFS_ATTR3_LEAF_MAGIC) && (magic != XFS_DIR2_LEAF1_MAGIC) && (magic != XFS_DIR3_LEAF1_MAGIC) && (magic != XFS_DIR2_LEAFN_MAGIC) && (magic != XFS_DIR3_LEAFN_MAGIC) && (magic1 != XFS_DIR2_BLOCK_MAGIC) && (magic1 != XFS_DIR3_BLOCK_MAGIC) && (magic1 != XFS_DIR2_DATA_MAGIC) && (magic1 != XFS_DIR3_DATA_MAGIC) && (free->hdr.magic != cpu_to_be32(XFS_DIR2_FREE_MAGIC)) && (free->hdr.magic != cpu_to_be32(XFS_DIR3_FREE_MAGIC)), mp, XFS_ERRTAG_DA_READ_BUF, XFS_RANDOM_DA_READ_BUF))) { trace_xfs_da_btree_corrupt(bp, _RET_IP_); XFS_CORRUPTION_ERROR(""xfs_da_do_buf(2)"", XFS_ERRLEVEL_LOW, mp, info); error = XFS_ERROR(EFSCORRUPTED); xfs_trans_brelse(trans, bp); goto out_free; } } *bpp = bp; out_free: if (mapp != &map) kmem_free(mapp); return error; } ",0 "static void arm_coherent_iommu_unmap_page(struct device *dev, dma_addr_t handle, size_t size, enum dma_data_direction dir, struct dma_attrs *attrs) { struct dma_iommu_mapping *mapping = dev->archdata.mapping; dma_addr_t iova = handle & PAGE_MASK; int offset = handle & ~PAGE_MASK; int len = PAGE_ALIGN(size + offset); if (!iova) return; iommu_unmap(mapping->domain, iova, len); __free_iova(mapping, iova, len); } ",0 "void *av_malloc(size_t size) { void *ptr = NULL; #if CONFIG_MEMALIGN_HACK long diff; #endif /* let's disallow possible ambiguous cases */ if (size > (max_alloc_size - 32)) return NULL; #if CONFIG_MEMALIGN_HACK ptr = malloc(size + ALIGN); if (!ptr) return ptr; diff = ((~(long)ptr)&(ALIGN - 1)) + 1; ptr = (char *)ptr + diff; ((char *)ptr)[-1] = diff; #elif HAVE_POSIX_MEMALIGN if (size) //OS X on SDK 10.6 has a broken posix_memalign implementation if (posix_memalign(&ptr, ALIGN, size)) ptr = NULL; #elif HAVE_ALIGNED_MALLOC ptr = _aligned_malloc(size, ALIGN); #elif HAVE_MEMALIGN #ifndef __DJGPP__ ptr = memalign(ALIGN, size); #else ptr = memalign(size, ALIGN); #endif /* Why 64? * Indeed, we should align it: * on 4 for 386 * on 16 for 486 * on 32 for 586, PPro - K6-III * on 64 for K7 (maybe for P3 too). * Because L1 and L2 caches are aligned on those values. * But I don't want to code such logic here! */ /* Why 32? * For AVX ASM. SSE / NEON needs only 16. * Why not larger? Because I did not see a difference in benchmarks ... */ /* benchmarks with P3 * memalign(64) + 1 3071, 3051, 3032 * memalign(64) + 2 3051, 3032, 3041 * memalign(64) + 4 2911, 2896, 2915 * memalign(64) + 8 2545, 2554, 2550 * memalign(64) + 16 2543, 2572, 2563 * memalign(64) + 32 2546, 2545, 2571 * memalign(64) + 64 2570, 2533, 2558 * * BTW, malloc seems to do 8-byte alignment by default here. */ #else ptr = malloc(size); #endif if(!ptr && !size) { size = 1; ptr= av_malloc(1); } #if CONFIG_MEMORY_POISONING if (ptr) memset(ptr, FF_MEMORY_POISON, size); #endif return ptr; } ",0 "MAX_ROOM_NEEDED (const arguments *ap, size_t arg_index, FCHAR_T conversion, arg_type type, int flags, size_t width, int has_precision, size_t precision, int pad_ourselves) { size_t tmp_length; switch (conversion) { case 'd': case 'i': case 'u': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.30103 /* binary -> decimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Multiply by 2, as an estimate for FLAG_GROUP. */ tmp_length = xsum (tmp_length, tmp_length); /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'o': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.333334 /* binary -> octal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 1, to account for a leading sign. */ tmp_length = xsum (tmp_length, 1); break; case 'x': case 'X': # if HAVE_LONG_LONG_INT if (type == TYPE_LONGLONGINT || type == TYPE_ULONGLONGINT) tmp_length = (unsigned int) (sizeof (unsigned long long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else # endif if (type == TYPE_LONGINT || type == TYPE_ULONGINT) tmp_length = (unsigned int) (sizeof (unsigned long) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (sizeof (unsigned int) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Add 2, to account for a leading sign or alternate form. */ tmp_length = xsum (tmp_length, 2); break; case 'f': case 'F': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ else tmp_length = (unsigned int) (DBL_MAX_EXP * 0.30103 /* binary -> decimal */ * 2 /* estimate for FLAG_GROUP */ ) + 1 /* turn floor into ceil */ + 10; /* sign, decimal point etc. */ tmp_length = xsum (tmp_length, precision); break; case 'e': case 'E': case 'g': case 'G': tmp_length = 12; /* sign, decimal point, exponent etc. */ tmp_length = xsum (tmp_length, precision); break; case 'a': case 'A': if (type == TYPE_LONGDOUBLE) tmp_length = (unsigned int) (LDBL_DIG * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ else tmp_length = (unsigned int) (DBL_DIG * 0.831 /* decimal -> hexadecimal */ ) + 1; /* turn floor into ceil */ if (tmp_length < precision) tmp_length = precision; /* Account for sign, decimal point etc. */ tmp_length = xsum (tmp_length, 12); break; case 'c': # if HAVE_WINT_T && !WIDE_CHAR_VERSION if (type == TYPE_WIDE_CHAR) tmp_length = MB_CUR_MAX; else # endif tmp_length = 1; break; case 's': # if HAVE_WCHAR_T if (type == TYPE_WIDE_STRING) { # if WIDE_CHAR_VERSION /* ISO C says about %ls in fwprintf: ""If the precision is not specified or is greater than the size of the array, the array shall contain a null wide character."" So if there is a precision, we must not use wcslen. */ const wchar_t *arg = ap->arg[arg_index].a.a_wide_string; if (has_precision) tmp_length = local_wcsnlen (arg, precision); else tmp_length = local_wcslen (arg); # else /* ISO C says about %ls in fprintf: ""If a precision is specified, no more than that many bytes are written (including shift sequences, if any), and the array shall contain a null wide character if, to equal the multibyte character sequence length given by the precision, the function would need to access a wide character one past the end of the array."" So if there is a precision, we must not use wcslen. */ /* This case has already been handled separately in VASNPRINTF. */ abort (); # endif } else # endif { # if WIDE_CHAR_VERSION /* ISO C says about %s in fwprintf: ""If the precision is not specified or is greater than the size of the converted array, the converted array shall contain a null wide character."" So if there is a precision, we must not use strlen. */ /* This case has already been handled separately in VASNPRINTF. */ abort (); # else /* ISO C says about %s in fprintf: ""If the precision is not specified or greater than the size of the array, the array shall contain a null character."" So if there is a precision, we must not use strlen. */ const char *arg = ap->arg[arg_index].a.a_string; if (has_precision) tmp_length = local_strnlen (arg, precision); else tmp_length = strlen (arg); # endif } break; case 'p': tmp_length = (unsigned int) (sizeof (void *) * CHAR_BIT * 0.25 /* binary -> hexadecimal */ ) + 1 /* turn floor into ceil */ + 2; /* account for leading 0x */ break; default: abort (); } if (!pad_ourselves) { # if ENABLE_UNISTDIO /* Padding considers the number of characters, therefore the number of elements after padding may be > max (tmp_length, width) but is certainly <= tmp_length + width. */ tmp_length = xsum (tmp_length, width); # else /* Padding considers the number of elements, says POSIX. */ if (tmp_length < width) tmp_length = width; # endif } tmp_length = xsum (tmp_length, 1); /* account for trailing NUL */ return tmp_length; } ",0 "png_pass_start_col(int pass) { int x, y; ++pass; for (x=0; x<8; ++x) for (y=0; y<8; ++y) if (adam7[y][x] == pass) return x; return 0xf; } ",0 "void WebRuntimeFeatures::enableFileSystem(bool enable) { RuntimeEnabledFeatures::setFileSystemEnabled(enable); } ",0 " long vorbis_book_decodev_set(codebook *book,ogg_int32_t *a, oggpack_buffer *b,int n,int point){ if(book->used_entries>0){ ogg_int32_t *v = book->dec_buf;//(ogg_int32_t *)alloca(sizeof(*v)*book->dim); int i,j; if (!v) return -1; for(i=0;idim;j++) a[i++]=v[j]; } }else{ int i,j; for(i=0;idim;j++) a[i++]=0; } } return 0; } ",1 "void FetchContext::RecordLoadingActivity( unsigned long, const ResourceRequest&, Resource::Type, const AtomicString& fetch_initiator_name) {} ",0 "static void RaisesExceptionVoidMethodMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""raisesExceptionVoidMethod""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); impl->raisesExceptionVoidMethod(exception_state); if (exception_state.HadException()) { return; } } ",0 "base::FilePath GetSetupExeFromRegistry(InstallationLevel level, const wchar_t* app_guid) { string16 uninstall; if (GetClientStateValue(level, app_guid, kUninstallStringField, &uninstall)) { base::FilePath setup_exe_path(uninstall); if (file_util::PathExists(setup_exe_path)) return setup_exe_path; } return base::FilePath(); } ",0 "static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int target) { struct cpumask *cpus = this_cpu_cpumask_var_ptr(select_idle_mask); int core, cpu; if (!static_branch_likely(&sched_smt_present)) return -1; if (!test_idle_cores(target, false)) return -1; cpumask_and(cpus, sched_domain_span(sd), &p->cpus_allowed); for_each_cpu_wrap(core, cpus, target) { bool idle = true; for_each_cpu(cpu, cpu_smt_mask(core)) { cpumask_clear_cpu(cpu, cpus); if (!available_idle_cpu(cpu)) idle = false; } if (idle) return core; } /* * Failed to find an idle core; stop looking for one. */ set_idle_cores(target, 0); return -1; } ",0 "xdr_kadm5_policy_ent_rec(XDR *xdrs, kadm5_policy_ent_rec *objp) { return _xdr_kadm5_policy_ent_rec(xdrs, objp, KADM5_API_VERSION_4); } ",0 "bool omx_vdec::allocate_output_done(void) { bool bRet = false; unsigned j=0; if (m_out_mem_ptr == NULL) { return bRet; } if (m_out_mem_ptr) { for (; j < drv_ctx.op_buf.actualcount; j++) { if (BITMASK_ABSENT(&m_out_bm_count,j)) { break; } } } if (j == drv_ctx.op_buf.actualcount) { bRet = true; DEBUG_PRINT_HIGH(""Allocate done for all o/p buffers""); if (m_out_bEnabled) m_out_bPopulated = OMX_TRUE; } return bRet; } ",0 "void NavigationRequest::UpdateRequestNavigationParamsHistory() { NavigationController* navigation_controller = frame_tree_node_->navigator()->GetController(); request_params_.current_history_list_offset = navigation_controller->GetCurrentEntryIndex(); request_params_.current_history_list_length = navigation_controller->GetEntryCount(); } ",0 "clients_are_ready(void) { return !xorg_list_is_empty(&ready_clients); } ",0 "v8::Handle V8XMLHttpRequest::responseTextAccessorGetter(v8::Local name, const v8::AccessorInfo& info) { INC_STATS(""DOM.XMLHttpRequest.responsetext._get""); XMLHttpRequest* xmlHttpRequest = V8XMLHttpRequest::toNative(info.Holder()); ExceptionCode ec = 0; const String& text = xmlHttpRequest->responseText(ec); if (ec) return throwError(ec, info.GetIsolate()); return v8String(text); } ",0 "NPError WebPluginDelegatePepper::Device3DDestroyContext( NPDeviceContext3D* context) { #if defined(ENABLE_GPU) command_buffer_.reset(); if (nested_delegate_) { nested_delegate_->PluginDestroyed(); nested_delegate_ = NULL; } #endif // ENABLE_GPU return NPERR_NO_ERROR; } ",0 "void RenderWidgetHostViewAura::Show() { window_->Show(); if (!host_->is_hidden()) return; bool has_saved_frame = delegated_frame_host_ ? delegated_frame_host_->HasSavedFrame() : false; ui::LatencyInfo renderer_latency_info, browser_latency_info; if (has_saved_frame) { browser_latency_info.AddLatencyNumber( ui::TAB_SHOW_COMPONENT, host_->GetLatencyComponentId(), 0); } else { renderer_latency_info.AddLatencyNumber( ui::TAB_SHOW_COMPONENT, host_->GetLatencyComponentId(), 0); } host_->WasShown(renderer_latency_info); aura::Window* root = window_->GetRootWindow(); if (root) { aura::client::CursorClient* cursor_client = aura::client::GetCursorClient(root); if (cursor_client) NotifyRendererOfCursorVisibilityState(cursor_client->IsCursorVisible()); } if (delegated_frame_host_) delegated_frame_host_->WasShown(browser_latency_info); #if defined(OS_WIN) UpdateLegacyWin(); #endif } ",0 "static int check_map_func_compatibility(struct bpf_map *map, int func_id) { if (!map) return 0; /* We need a two way check, first is from map perspective ... */ switch (map->map_type) { case BPF_MAP_TYPE_PROG_ARRAY: if (func_id != BPF_FUNC_tail_call) goto error; break; case BPF_MAP_TYPE_PERF_EVENT_ARRAY: if (func_id != BPF_FUNC_perf_event_read && func_id != BPF_FUNC_perf_event_output) goto error; break; case BPF_MAP_TYPE_STACK_TRACE: if (func_id != BPF_FUNC_get_stackid) goto error; break; case BPF_MAP_TYPE_CGROUP_ARRAY: if (func_id != BPF_FUNC_skb_under_cgroup && func_id != BPF_FUNC_current_task_under_cgroup) goto error; break; case BPF_MAP_TYPE_ARRAY_OF_MAPS: case BPF_MAP_TYPE_HASH_OF_MAPS: if (func_id != BPF_FUNC_map_lookup_elem) goto error; default: break; } /* ... and second from the function itself. */ switch (func_id) { case BPF_FUNC_tail_call: if (map->map_type != BPF_MAP_TYPE_PROG_ARRAY) goto error; break; case BPF_FUNC_perf_event_read: case BPF_FUNC_perf_event_output: if (map->map_type != BPF_MAP_TYPE_PERF_EVENT_ARRAY) goto error; break; case BPF_FUNC_get_stackid: if (map->map_type != BPF_MAP_TYPE_STACK_TRACE) goto error; break; case BPF_FUNC_current_task_under_cgroup: case BPF_FUNC_skb_under_cgroup: if (map->map_type != BPF_MAP_TYPE_CGROUP_ARRAY) goto error; break; default: break; } return 0; error: verbose(""cannot pass map_type %d into func %s#%d\n"", map->map_type, func_id_name(func_id), func_id); return -EINVAL; } ",0 "static int cma_netdev_change(struct net_device *ndev, struct rdma_id_private *id_priv) { struct rdma_dev_addr *dev_addr; struct cma_ndev_work *work; dev_addr = &id_priv->id.route.addr.dev_addr; if ((dev_addr->bound_dev_if == ndev->ifindex) && memcmp(dev_addr->src_dev_addr, ndev->dev_addr, ndev->addr_len)) { printk(KERN_INFO ""RDMA CM addr change for ndev %s used by id %p\n"", ndev->name, &id_priv->id); work = kzalloc(sizeof *work, GFP_KERNEL); if (!work) return -ENOMEM; INIT_WORK(&work->work, cma_ndev_work_handler); work->id = id_priv; work->event.event = RDMA_CM_EVENT_ADDR_CHANGE; atomic_inc(&id_priv->refcount); queue_work(cma_wq, &work->work); } return 0; } ",0 " void TestInvalidationInSubsequence() { FakeDisplayItemClient container(""container""); FakeDisplayItemClient content(""content""); GraphicsContext context(GetPaintController()); InitRootChunk(); { SubsequenceRecorder r(context, container); DrawRect(context, content, kBackgroundType, FloatRect(100, 100, 300, 300)); } GetPaintController().CommitNewDisplayItems(); content.SetDisplayItemsUncached(); InitRootChunk(); { EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible( context, container)); SubsequenceRecorder r(context, container); DrawRect(context, content, kBackgroundType, FloatRect(100, 100, 300, 300)); } GetPaintController().CommitNewDisplayItems(); } ",0 "static void ahci_restart_dma(IDEDMA *dma) { /* Nothing to do, ahci_start_dma already resets s->io_buffer_offset. */ } ",0 "zip_read_data_deflate(struct archive_read *a, const void **buff, size_t *size, int64_t *offset) { struct zip *zip; ssize_t bytes_avail; const void *compressed_buff, *sp; int r; (void)offset; /* UNUSED */ zip = (struct zip *)(a->format->data); /* If the buffer hasn't been allocated, allocate it now. */ if (zip->uncompressed_buffer == NULL) { zip->uncompressed_buffer_size = 256 * 1024; zip->uncompressed_buffer = (unsigned char *)malloc(zip->uncompressed_buffer_size); if (zip->uncompressed_buffer == NULL) { archive_set_error(&a->archive, ENOMEM, ""No memory for ZIP decompression""); return (ARCHIVE_FATAL); } } r = zip_deflate_init(a, zip); if (r != ARCHIVE_OK) return (r); /* * Note: '1' here is a performance optimization. * Recall that the decompression layer returns a count of * available bytes; asking for more than that forces the * decompressor to combine reads by copying data. */ compressed_buff = sp = __archive_read_ahead(a, 1, &bytes_avail); if (0 == (zip->entry->zip_flags & ZIP_LENGTH_AT_END) && bytes_avail > zip->entry_bytes_remaining) { bytes_avail = (ssize_t)zip->entry_bytes_remaining; } if (bytes_avail <= 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Truncated ZIP file body""); return (ARCHIVE_FATAL); } if (zip->tctx_valid || zip->cctx_valid) { if (zip->decrypted_bytes_remaining < (size_t)bytes_avail) { size_t buff_remaining = zip->decrypted_buffer_size - (zip->decrypted_ptr - zip->decrypted_buffer); if (buff_remaining > (size_t)bytes_avail) buff_remaining = (size_t)bytes_avail; if (0 == (zip->entry->zip_flags & ZIP_LENGTH_AT_END) && zip->entry_bytes_remaining > 0) { if ((int64_t)(zip->decrypted_bytes_remaining + buff_remaining) > zip->entry_bytes_remaining) { if (zip->entry_bytes_remaining < (int64_t)zip->decrypted_bytes_remaining) buff_remaining = 0; else buff_remaining = (size_t)zip->entry_bytes_remaining - zip->decrypted_bytes_remaining; } } if (buff_remaining > 0) { if (zip->tctx_valid) { trad_enc_decrypt_update(&zip->tctx, compressed_buff, buff_remaining, zip->decrypted_ptr + zip->decrypted_bytes_remaining, buff_remaining); } else { size_t dsize = buff_remaining; archive_decrypto_aes_ctr_update( &zip->cctx, compressed_buff, buff_remaining, zip->decrypted_ptr + zip->decrypted_bytes_remaining, &dsize); } zip->decrypted_bytes_remaining += buff_remaining; } } bytes_avail = zip->decrypted_bytes_remaining; compressed_buff = (const char *)zip->decrypted_ptr; } /* * A bug in zlib.h: stream.next_in should be marked 'const' * but isn't (the library never alters data through the * next_in pointer, only reads it). The result: this ugly * cast to remove 'const'. */ zip->stream.next_in = (Bytef *)(uintptr_t)(const void *)compressed_buff; zip->stream.avail_in = (uInt)bytes_avail; zip->stream.total_in = 0; zip->stream.next_out = zip->uncompressed_buffer; zip->stream.avail_out = (uInt)zip->uncompressed_buffer_size; zip->stream.total_out = 0; r = inflate(&zip->stream, 0); switch (r) { case Z_OK: break; case Z_STREAM_END: zip->end_of_entry = 1; break; case Z_MEM_ERROR: archive_set_error(&a->archive, ENOMEM, ""Out of memory for ZIP decompression""); return (ARCHIVE_FATAL); default: archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, ""ZIP decompression failed (%d)"", r); return (ARCHIVE_FATAL); } /* Consume as much as the compressor actually used. */ bytes_avail = zip->stream.total_in; if (zip->tctx_valid || zip->cctx_valid) { zip->decrypted_bytes_remaining -= bytes_avail; if (zip->decrypted_bytes_remaining == 0) zip->decrypted_ptr = zip->decrypted_buffer; else zip->decrypted_ptr += bytes_avail; } /* Calculate compressed data as much as we used.*/ if (zip->hctx_valid) archive_hmac_sha1_update(&zip->hctx, sp, bytes_avail); __archive_read_consume(a, bytes_avail); zip->entry_bytes_remaining -= bytes_avail; zip->entry_compressed_bytes_read += bytes_avail; *size = zip->stream.total_out; zip->entry_uncompressed_bytes_read += zip->stream.total_out; *buff = zip->uncompressed_buffer; if (zip->end_of_entry && zip->hctx_valid) { r = check_authentication_code(a, NULL); if (r != ARCHIVE_OK) return (r); } if (zip->end_of_entry && (zip->entry->zip_flags & ZIP_LENGTH_AT_END)) { const char *p; if (NULL == (p = __archive_read_ahead(a, 24, NULL))) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Truncated ZIP end-of-file record""); return (ARCHIVE_FATAL); } /* Consume the optional PK\007\010 marker. */ if (p[0] == 'P' && p[1] == 'K' && p[2] == '\007' && p[3] == '\010') { p += 4; zip->unconsumed = 4; } if (zip->entry->flags & LA_USED_ZIP64) { zip->entry->crc32 = archive_le32dec(p); zip->entry->compressed_size = archive_le64dec(p + 4); zip->entry->uncompressed_size = archive_le64dec(p + 12); zip->unconsumed += 20; } else { zip->entry->crc32 = archive_le32dec(p); zip->entry->compressed_size = archive_le32dec(p + 4); zip->entry->uncompressed_size = archive_le32dec(p + 8); zip->unconsumed += 12; } } return (ARCHIVE_OK); } ",0 "unsigned int dictSdsHash(const void *key) { return dictGenHashFunction((unsigned char*)key, sdslen((char*)key)); } ",0 "status_t Camera3Device::waitUntilRequestReceived(int32_t requestId, nsecs_t timeout) { ATRACE_CALL(); Mutex::Autolock il(mInterfaceLock); return mRequestThread->waitUntilRequestProcessed(requestId, timeout); } ",0 "static int nfs4_proc_get_root(struct nfs_server *server, struct nfs_fh *mntfh, struct nfs_fsinfo *info) { int error; struct nfs_fattr *fattr = info->fattr; struct nfs4_label *label = NULL; error = nfs4_server_capabilities(server, mntfh); if (error < 0) { dprintk(""nfs4_get_root: getcaps error = %d\n"", -error); return error; } label = nfs4_label_alloc(server, GFP_KERNEL); if (IS_ERR(label)) return PTR_ERR(label); error = nfs4_proc_getattr(server, mntfh, fattr, label); if (error < 0) { dprintk(""nfs4_get_root: getattr error = %d\n"", -error); goto err_free_label; } if (fattr->valid & NFS_ATTR_FATTR_FSID && !nfs_fsid_equal(&server->fsid, &fattr->fsid)) memcpy(&server->fsid, &fattr->fsid, sizeof(server->fsid)); err_free_label: nfs4_label_free(label); return error; } ",0 "void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( const base::CommandLine& command_line, int child_process_id, PosixFileDescriptorInfo* mappings) { #if defined(OS_ANDROID) base::MemoryMappedFile::Region region; int fd = ui::GetMainAndroidPackFd(®ion); mappings->ShareWithRegion(kAndroidUIResourcesPakDescriptor, fd, region); fd = ui::GetCommonResourcesPackFd(®ion); mappings->ShareWithRegion(kAndroidChrome100PercentPakDescriptor, fd, region); fd = ui::GetLocalePackFd(®ion); mappings->ShareWithRegion(kAndroidLocalePakDescriptor, fd, region); fd = ui::GetSecondaryLocalePackFd(®ion); if (fd != -1) { mappings->ShareWithRegion(kAndroidSecondaryLocalePakDescriptor, fd, region); } base::FilePath app_data_path; base::PathService::Get(base::DIR_ANDROID_APP_DATA, &app_data_path); DCHECK(!app_data_path.empty()); #endif // defined(OS_ANDROID) int crash_signal_fd = GetCrashSignalFD(command_line); if (crash_signal_fd >= 0) { mappings->Share(service_manager::kCrashDumpSignal, crash_signal_fd); } } ",0 "void ResourceMetadataDB::Init() { DCHECK(blocking_task_runner_->RunsTasksOnCurrentThread()); DCHECK(!db_path_.empty()); DVLOG(1) << ""Init "" << db_path_.value(); leveldb::DB* level_db = NULL; leveldb::Options options; options.create_if_missing = true; leveldb::Status db_status = leveldb::DB::Open(options, db_path_.value(), &level_db); DCHECK(level_db); DCHECK(db_status.ok()); level_db_.reset(level_db); } ",0 "void perf_event_exit_task(struct task_struct *child) { struct perf_event *event, *tmp; int ctxn; mutex_lock(&child->perf_event_mutex); list_for_each_entry_safe(event, tmp, &child->perf_event_list, owner_entry) { list_del_init(&event->owner_entry); /* * Ensure the list deletion is visible before we clear * the owner, closes a race against perf_release() where * we need to serialize on the owner->perf_event_mutex. */ smp_wmb(); event->owner = NULL; } mutex_unlock(&child->perf_event_mutex); for_each_task_context_nr(ctxn) perf_event_exit_task_context(child, ctxn); /* * The perf_event_exit_task_context calls perf_event_task * with child's task_ctx, which generates EXIT events for * child contexts and sets child->perf_event_ctxp[] to NULL. * At this point we need to send EXIT events to cpu contexts. */ perf_event_task(child, NULL, 0); } ",0 "ExtensionsAPIClient::GetNetworkingCastPrivateDelegate() { return nullptr; } ",0 "int32_t InputDispatcher::findFocusedWindowTargetsLocked(nsecs_t currentTime, const EventEntry* entry, Vector& inputTargets, nsecs_t* nextWakeupTime) { int32_t injectionResult; String8 reason; if (mFocusedWindowHandle == NULL) { if (mFocusedApplicationHandle != NULL) { injectionResult = handleTargetsNotReadyLocked(currentTime, entry, mFocusedApplicationHandle, NULL, nextWakeupTime, ""Waiting because no window has focus but there is a "" ""focused application that may eventually add a window "" ""when it finishes starting up.""); goto Unresponsive; } ALOGI(""Dropping event because there is no focused window or focused application.""); injectionResult = INPUT_EVENT_INJECTION_FAILED; goto Failed; } if (! checkInjectionPermission(mFocusedWindowHandle, entry->injectionState)) { injectionResult = INPUT_EVENT_INJECTION_PERMISSION_DENIED; goto Failed; } reason = checkWindowReadyForMoreInputLocked(currentTime, mFocusedWindowHandle, entry, ""focused""); if (!reason.isEmpty()) { injectionResult = handleTargetsNotReadyLocked(currentTime, entry, mFocusedApplicationHandle, mFocusedWindowHandle, nextWakeupTime, reason.string()); goto Unresponsive; } injectionResult = INPUT_EVENT_INJECTION_SUCCEEDED; addWindowTargetLocked(mFocusedWindowHandle, InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS, BitSet32(0), inputTargets); Failed: Unresponsive: nsecs_t timeSpentWaitingForApplication = getTimeSpentWaitingForApplicationLocked(currentTime); updateDispatchStatisticsLocked(currentTime, entry, injectionResult, timeSpentWaitingForApplication); #if DEBUG_FOCUS ALOGD(""findFocusedWindow finished: injectionResult=%d, "" ""timeSpentWaitingForApplication=%0.1fms"", injectionResult, timeSpentWaitingForApplication / 1000000.0); #endif return injectionResult; } ",0 "bool SetStoreLoginFunction::RunImpl() { if (!IsWebStoreURL(profile_, source_url())) return false; std::string login; EXTENSION_FUNCTION_VALIDATE(args_->GetString(0, &login)); ExtensionService* service = profile_->GetExtensionService(); ExtensionPrefs* prefs = service->extension_prefs(); prefs->SetWebStoreLogin(login); return true; } ",0 "RenderFrameHostImpl::GetRemoteAssociatedInterfaces() { if (!remote_associated_interfaces_) { mojom::AssociatedInterfaceProviderAssociatedPtr remote_interfaces; IPC::ChannelProxy* channel = GetProcess()->GetChannel(); if (channel) { RenderProcessHostImpl* process = static_cast(GetProcess()); process->GetRemoteRouteProvider()->GetRoute( GetRoutingID(), mojo::MakeRequest(&remote_interfaces)); } else { mojo::MakeRequestAssociatedWithDedicatedPipe(&remote_interfaces); } remote_associated_interfaces_.reset(new AssociatedInterfaceProviderImpl( std::move(remote_interfaces))); } return remote_associated_interfaces_.get(); } ",0 "void ChromePasswordManagerClient::UserModifiedPasswordField() { if (GetMetricsRecorder()) { GetMetricsRecorder()->RecordUserModifiedPasswordField(); } } ",0 "void WebContentsImpl::UpdateTitleForEntry(NavigationEntry* entry, const base::string16& title) { base::string16 final_title; bool explicit_set; if (entry && entry->GetURL().SchemeIsFile() && title.empty()) { final_title = base::UTF8ToUTF16(entry->GetURL().ExtractFileName()); explicit_set = false; // Don't count synthetic titles toward the set limit. } else { base::TrimWhitespace(title, base::TRIM_ALL, &final_title); explicit_set = true; } if (entry) { if (final_title == entry->GetTitle()) return; // Nothing changed, don't bother. entry->SetTitle(final_title); } else { if (page_title_when_no_navigation_entry_ == final_title) return; // Nothing changed, don't bother. page_title_when_no_navigation_entry_ = final_title; } view_->SetPageTitle(final_title); for (auto& observer : observers_) observer.TitleWasSet(entry, explicit_set); if (entry == controller_.GetEntryAtOffset(0)) NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); } ",0 "SYSCALL_DEFINE3(getpeername, int, fd, struct sockaddr __user *, usockaddr, int __user *, usockaddr_len) { return __sys_getpeername(fd, usockaddr, usockaddr_len); } ",0 " Ins_UTP( INS_ARG ) { FT_UShort point; FT_Byte mask; point = (FT_UShort)args[0]; if ( BOUNDS( point, CUR.zp0.n_points ) ) { if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; return; } mask = 0xFF; if ( CUR.GS.freeVector.x != 0 ) mask &= ~FT_CURVE_TAG_TOUCH_X; if ( CUR.GS.freeVector.y != 0 ) mask &= ~FT_CURVE_TAG_TOUCH_Y; CUR.zp0.tags[point] &= mask; } ",0 " ConversionContext(const PropertyTreeState& layer_state, const gfx::Vector2dF& layer_offset, const FloatSize& visual_rect_subpixel_offset, cc::DisplayItemList& cc_list) : layer_state_(layer_state), layer_offset_(layer_offset), current_transform_(layer_state.Transform()), current_clip_(layer_state.Clip()), current_effect_(layer_state.Effect()), chunk_to_layer_mapper_(layer_state_, layer_offset_, visual_rect_subpixel_offset), cc_list_(cc_list) {} ",0 "void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( std::unique_ptr swap_promise) { swap_promises_for_main_thread_scroll_update_.push_back( std::move(swap_promise)); } ",0 "void OxideQQuickWebViewPrivate::AddMessageToConsole( int level, const QString& message, int line_no, const QString& source_id) { Q_Q(OxideQQuickWebView); OxideQQuickWebView::LogMessageSeverityLevel oxideLevel = OxideQQuickWebView::LogSeverityInfo; if (level >= 0 && level <= OxideQQuickWebView::LogSeverityFatal) { oxideLevel = static_cast(level); } emit q->javaScriptConsoleMessage( oxideLevel, message, line_no, source_id); } ",0 "static int _nfs4_proc_destroy_clientid(struct nfs_client *clp, struct rpc_cred *cred) { struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_DESTROY_CLIENTID], .rpc_argp = clp, .rpc_cred = cred, }; int status; status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); if (status) dprintk(""NFS: Got error %d from the server %s on "" ""DESTROY_CLIENTID."", status, clp->cl_hostname); return status; } ",0 "void GLES2DecoderImpl::DoAttachShader( GLuint program_client_id, GLint shader_client_id) { Program* program = GetProgramInfoNotShader( program_client_id, ""glAttachShader""); if (!program) { return; } Shader* shader = GetShaderInfoNotProgram(shader_client_id, ""glAttachShader""); if (!shader) { return; } if (!program->AttachShader(shader_manager(), shader)) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glAttachShader"", ""can not attach more than one shader of the same type.""); return; } api()->glAttachShaderFn(program->service_id(), shader->service_id()); } ",0 "bool trace_clock_in_ns(struct trace_array *tr) { if (trace_clocks[tr->clock_id].in_ns) return true; return false; } ",0 "void ExtensionInstallDialogView::UpdateInstallResultHistogram(bool accepted) const { if (prompt_->type() == ExtensionInstallPrompt::INSTALL_PROMPT) UMA_HISTOGRAM_BOOLEAN(""Extensions.InstallPrompt.Accepted"", accepted); } ",0 " PendingFileChooser(const ViewHostMsg_RunFileChooser_Params& p, WebFileChooserCompletion* c) : params(p), completion(c) { } ",0 "static int alloc_kmem_cache_cpus(struct kmem_cache *s, gfp_t flags) { int cpu; for_each_online_cpu(cpu) { struct kmem_cache_cpu *c = get_cpu_slab(s, cpu); if (c) continue; c = alloc_kmem_cache_cpu(s, cpu, flags); if (!c) { free_kmem_cache_cpus(s); return 0; } s->cpu_slab[cpu] = c; } return 1; } ",0 "void V8TestObject::ReflectLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_reflectLongAttribute_Getter""); test_object_v8_internal::ReflectLongAttributeAttributeGetter(info); } ",0 "static bool pi_test_and_clear_on(struct pi_desc *pi_desc) { return test_and_clear_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control); } ",0 "GF_Err uuid_dump(GF_Box *a, FILE * trace) { gf_isom_box_dump_start(a, ""UUIDBox"", trace); fprintf(trace, "">\n""); gf_isom_box_dump_done(""UUIDBox"", a, trace); return GF_OK; } ",0 "buffer_add_range(int fd, struct evbuffer *evb, struct range *range) { char buf[BUFSIZ]; size_t n, range_sz; ssize_t nread; if (lseek(fd, range->start, SEEK_SET) == -1) return (0); range_sz = range->end - range->start + 1; while (range_sz) { n = MINIMUM(range_sz, sizeof(buf)); if ((nread = read(fd, buf, n)) == -1) return (0); evbuffer_add(evb, buf, nread); range_sz -= nread; } return (1); } ",1 "GURL BrowserPpapiHostImpl::GetPluginURLForInstance(PP_Instance instance) { auto it = instance_map_.find(instance); if (it == instance_map_.end()) return GURL(); return it->second->renderer_data.plugin_url; } ",0 "static OMX_U32 setPFramesSpacing(int32_t iFramesInterval, int32_t frameRate) { if (iFramesInterval < 0) { return 0xFFFFFFFF; } else if (iFramesInterval == 0) { return 0; } OMX_U32 ret = frameRate * iFramesInterval - 1; return ret; } ",0 "void WebPagePrivate::unlockOrientation() { return m_client->unlockOrientation(); } ",0 "MagickExport MagickSizeType GetPixelCacheNexusExtent(const Cache cache, NexusInfo *nexus_info) { CacheInfo *magick_restrict cache_info; MagickSizeType extent; assert(cache != NULL); cache_info=(CacheInfo *) cache; assert(cache_info->signature == MagickSignature); extent=(MagickSizeType) nexus_info->region.width*nexus_info->region.height; if (extent == 0) return((MagickSizeType) cache_info->columns*cache_info->rows); return(extent); } ",0 "void RenderViewImpl::DidPlay(WebKit::WebMediaPlayer* player) { Send(new ViewHostMsg_MediaNotification(routing_id_, reinterpret_cast(player), player->hasVideo(), player->hasAudio(), true)); } ",0 "static int nf_tables_rule_notify(const struct nft_ctx *ctx, const struct nft_rule *rule, int event) { struct sk_buff *skb; int err; if (!ctx->report && !nfnetlink_has_listeners(ctx->net, NFNLGRP_NFTABLES)) return 0; err = -ENOBUFS; skb = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL); if (skb == NULL) goto err; err = nf_tables_fill_rule_info(skb, ctx->net, ctx->portid, ctx->seq, event, 0, ctx->afi->family, ctx->table, ctx->chain, rule); if (err < 0) { kfree_skb(skb); goto err; } err = nfnetlink_send(skb, ctx->net, ctx->portid, NFNLGRP_NFTABLES, ctx->report, GFP_KERNEL); err: if (err < 0) { nfnetlink_set_err(ctx->net, ctx->portid, NFNLGRP_NFTABLES, err); } return err; } ",0 "void RenderWidgetHostViewAura::DetachFromInputMethod() { ui::InputMethod* input_method = GetInputMethod(); if (input_method && input_method->GetTextInputClient() == this) input_method->SetFocusedTextInputClient(NULL); } ",0 "void GLES2DecoderImpl::DoVertexAttrib2fv(GLuint index, const GLfloat* v) { VertexAttribManager::VertexAttribInfo* info = vertex_attrib_manager_.GetVertexAttribInfo(index); if (!info) { SetGLError(GL_INVALID_VALUE, ""glVertexAttrib2fv: index out of range""); return; } VertexAttribManager::VertexAttribInfo::Vec4 value; value.v[0] = v[0]; value.v[1] = v[1]; value.v[2] = 0.0f; value.v[3] = 1.0f; info->set_value(value); glVertexAttrib2fv(index, v); } ",0 "void WebPageProxy::handleGestureEvent(const WebGestureEvent& event) { if (!isValid()) return; process()->responsivenessTimer()->start(); process()->send(Messages::WebPage::GestureEvent(event), m_pageID); } ",0 "process_add_identity(SocketEntry *e, int version) { Idtab *tab = idtab_lookup(version); Identity *id; int success = 0, confirm = 0; u_int seconds; char *comment = NULL; time_t death = 0; struct sshkey *k = NULL; u_char ctype; int r = SSH_ERR_INTERNAL_ERROR; switch (version) { #ifdef WITH_SSH1 case 1: r = agent_decode_rsa1(e->request, &k); break; #endif /* WITH_SSH1 */ case 2: r = sshkey_private_deserialize(e->request, &k); break; } if (r != 0 || k == NULL || (r = sshbuf_get_cstring(e->request, &comment, NULL)) != 0) { error(""%s: decode private key: %s"", __func__, ssh_err(r)); goto err; } while (sshbuf_len(e->request)) { if ((r = sshbuf_get_u8(e->request, &ctype)) != 0) { error(""%s: buffer error: %s"", __func__, ssh_err(r)); goto err; } switch (ctype) { case SSH_AGENT_CONSTRAIN_LIFETIME: if ((r = sshbuf_get_u32(e->request, &seconds)) != 0) { error(""%s: bad lifetime constraint: %s"", __func__, ssh_err(r)); goto err; } death = monotime() + seconds; break; case SSH_AGENT_CONSTRAIN_CONFIRM: confirm = 1; break; default: error(""%s: Unknown constraint %d"", __func__, ctype); err: sshbuf_reset(e->request); free(comment); sshkey_free(k); goto send; } } success = 1; if (lifetime && !death) death = monotime() + lifetime; if ((id = lookup_identity(k, version)) == NULL) { id = xcalloc(1, sizeof(Identity)); id->key = k; TAILQ_INSERT_TAIL(&tab->idlist, id, next); /* Increment the number of identities. */ tab->nentries++; } else { sshkey_free(k); free(id->comment); } id->comment = comment; id->death = death; id->confirm = confirm; send: send_status(e, success); } ",0 "bool AXObject::accessibilityIsIgnored() const { updateCachedAttributeValuesIfNeeded(); return m_cachedIsIgnored; } ",0 "bool SendKeyEvent(const std::string type, int key_value, int key_code, std::string key_name, int modifiers, aura::WindowTreeHost* host) { ui::EventType event_type = ui::ET_UNKNOWN; if (type == kKeyDown) event_type = ui::ET_KEY_PRESSED; else if (type == kKeyUp) event_type = ui::ET_KEY_RELEASED; if (event_type == ui::ET_UNKNOWN) return false; ui::KeyboardCode code = static_cast(key_code); if (code == ui::VKEY_UNKNOWN) { if (event_type == ui::ET_KEY_RELEASED) { ui::InputMethod* input_method = host->window()->GetProperty( aura::client::kRootWindowInputMethodKey); if (!input_method) return false; ui::TextInputClient* tic = input_method->GetTextInputClient(); SendProcessKeyEvent(ui::ET_KEY_PRESSED, host); tic->InsertChar(static_cast(key_value), ui::EF_NONE); SendProcessKeyEvent(ui::ET_KEY_RELEASED, host); } } else { if (event_type == ui::ET_KEY_RELEASED) { static int keys_seen = 0; if (code == ui::VKEY_BACK) { UMA_HISTOGRAM_CUSTOM_COUNTS( ""VirtualKeyboard.KeystrokesBetweenBackspaces"", keys_seen, 1, 1000, 50); keys_seen = 0; } else { ++keys_seen; } } ui::DomCode dom_code = ui::DomCode::NONE; if (!key_name.empty()) dom_code = ui::KeycodeConverter::CodeStringToDomCode(key_name.c_str()); if (dom_code == ui::DomCode::NONE) dom_code = ui::UsLayoutKeyboardCodeToDomCode(code); CHECK(dom_code != ui::DomCode::NONE); ui::KeyEvent event( event_type, code, dom_code, modifiers); ui::EventDispatchDetails details = host->event_processor()->OnEventFromSource(&event); CHECK(!details.dispatcher_destroyed); } return true; } ",0 "scoped_ptr AppCacheBackendImpl::TransferHostOut(int host_id) { HostMap::iterator found = hosts_.find(host_id); if (found == hosts_.end()) { NOTREACHED(); return scoped_ptr(); } AppCacheHost* transferree = found->second; found->second = new AppCacheHost(host_id, frontend_, service_); transferree->PrepareForTransfer(); return scoped_ptr(transferree); } ",0 "bool InspectorPageAgent::deviceMetricsChanged(int width, int height, double deviceScaleFactor, bool emulateViewport, bool fitWindow, double fontScaleFactor, bool textAutosizing) { int currentWidth = static_cast(m_state->getLong(PageAgentState::pageAgentScreenWidthOverride)); int currentHeight = static_cast(m_state->getLong(PageAgentState::pageAgentScreenHeightOverride)); double currentDeviceScaleFactor = m_state->getDouble(PageAgentState::pageAgentDeviceScaleFactorOverride, 1); bool currentEmulateViewport = m_state->getBoolean(PageAgentState::pageAgentEmulateViewport); bool currentFitWindow = m_state->getBoolean(PageAgentState::pageAgentFitWindow); double currentFontScaleFactor = m_state->getDouble(PageAgentState::fontScaleFactor, 1); bool currentTextAutosizing = m_state->getBoolean(PageAgentState::pageAgentTextAutosizingOverride); return width != currentWidth || height != currentHeight || deviceScaleFactor != currentDeviceScaleFactor || emulateViewport != currentEmulateViewport || fitWindow != currentFitWindow || fontScaleFactor != currentFontScaleFactor || textAutosizing != currentTextAutosizing; } ",0 "static void uv__process_close_stream(uv_stdio_container_t* container) { if (!(container->flags & UV_CREATE_PIPE)) return; uv__stream_close((uv_stream_t*)container->data.stream); } ",0 "struct rpc_task *rpc_run_task(const struct rpc_task_setup *task_setup_data) { struct rpc_task *task; task = rpc_new_task(task_setup_data); if (IS_ERR(task)) goto out; rpc_task_set_client(task, task_setup_data->rpc_client); rpc_task_set_rpc_message(task, task_setup_data->rpc_message); if (task->tk_action == NULL) rpc_call_start(task); atomic_inc(&task->tk_count); rpc_execute(task); out: return task; } ",0 "gsm_xsmp_server_finalize (GObject *object) { GsmXsmpServer *xsmp_server; g_return_if_fail (object != NULL); g_return_if_fail (GSM_IS_XSMP_SERVER (object)); xsmp_server = GSM_XSMP_SERVER (object); g_return_if_fail (xsmp_server->priv != NULL); IceFreeListenObjs (xsmp_server->priv->num_xsmp_sockets, xsmp_server->priv->xsmp_sockets); if (xsmp_server->priv->client_store != NULL) { g_object_unref (xsmp_server->priv->client_store); } G_OBJECT_CLASS (gsm_xsmp_server_parent_class)->finalize (object); } ",0 "void LiveSyncTest::SetUpInProcessBrowserTestFixture() { net::RuleBasedHostResolverProc* resolver = new net::RuleBasedHostResolverProc(host_resolver()); resolver->AllowDirectLookup(""*.google.com""); resolver->AllowDirectLookup(""*.thawte.com""); resolver->AllowDirectLookup(""*.geotrust.com""); resolver->AllowDirectLookup(""*.gstatic.com""); mock_host_resolver_override_.reset( new net::ScopedDefaultHostResolverProc(resolver)); } ",0 " BrowserPolicyConnector::GetUserCloudPolicyDataStore() const { return user_data_store_.get(); } ",0 " ShellWindow::CreateParams::CreateParams() : frame(ShellWindow::CreateParams::FRAME_CHROME), bounds(10, 10, kDefaultWidth, kDefaultHeight) { } ",0 " destroy_size( FT_Memory memory, FT_Size size, FT_Driver driver ) { /* finalize client-specific data */ if ( size->generic.finalizer ) size->generic.finalizer( size ); /* finalize format-specific stuff */ if ( driver->clazz->done_size ) driver->clazz->done_size( size ); FT_FREE( size->internal ); FT_FREE( size ); } ",0 "void ptlock_free(struct page *page) { kmem_cache_free(page_ptl_cachep, page->ptl); } ",0 "std::string TemplateURL::GetExtensionId() const { DCHECK(extension_info_); return extension_info_->extension_id; } ",0 "xsltIf(xsltTransformContextPtr ctxt, xmlNodePtr contextNode, xmlNodePtr inst, xsltStylePreCompPtr castedComp) { int res = 0; #ifdef XSLT_REFACTORED xsltStyleItemIfPtr comp = (xsltStyleItemIfPtr) castedComp; #else xsltStylePreCompPtr comp = castedComp; #endif if ((ctxt == NULL) || (contextNode == NULL) || (inst == NULL)) return; if ((comp == NULL) || (comp->test == NULL) || (comp->comp == NULL)) { xsltTransformError(ctxt, NULL, inst, ""Internal error in xsltIf(): "" ""The XSLT 'if' instruction was not compiled.\n""); return; } #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext, ""xsltIf: test %s\n"", comp->test)); #endif #ifdef XSLT_FAST_IF { xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; xmlDocPtr oldXPContextDoc = xpctxt->doc; xmlNsPtr *oldXPNamespaces = xpctxt->namespaces; xmlNodePtr oldXPContextNode = xpctxt->node; int oldXPProximityPosition = xpctxt->proximityPosition; int oldXPContextSize = xpctxt->contextSize; int oldXPNsNr = xpctxt->nsNr; xmlDocPtr oldLocalFragmentTop = ctxt->localRVT; xpctxt->node = contextNode; if (comp != NULL) { #ifdef XSLT_REFACTORED if (comp->inScopeNs != NULL) { xpctxt->namespaces = comp->inScopeNs->list; xpctxt->nsNr = comp->inScopeNs->xpathNumber; } else { xpctxt->namespaces = NULL; xpctxt->nsNr = 0; } #else xpctxt->namespaces = comp->nsList; xpctxt->nsNr = comp->nsNr; #endif } else { xpctxt->namespaces = NULL; xpctxt->nsNr = 0; } /* * This XPath function is optimized for boolean results. */ res = xmlXPathCompiledEvalToBoolean(comp->comp, xpctxt); /* * Cleanup fragments created during evaluation of the * ""select"" expression. */ if (oldLocalFragmentTop != ctxt->localRVT) xsltReleaseLocalRVTs(ctxt, oldLocalFragmentTop); xpctxt->doc = oldXPContextDoc; xpctxt->node = oldXPContextNode; xpctxt->contextSize = oldXPContextSize; xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->nsNr = oldXPNsNr; xpctxt->namespaces = oldXPNamespaces; } #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext, ""xsltIf: test evaluate to %d\n"", res)); #endif if (res == -1) { ctxt->state = XSLT_STATE_STOPPED; goto error; } if (res == 1) { /* * Instantiate the sequence constructor of xsl:if. */ xsltApplySequenceConstructor(ctxt, contextNode, inst->children, NULL); } #else /* XSLT_FAST_IF */ { xmlXPathObjectPtr xpobj = NULL; /* * OLD CODE: */ { xmlXPathContextPtr xpctxt = ctxt->xpathCtxt; xmlDocPtr oldXPContextDoc = xpctxt->doc; xmlNsPtr *oldXPNamespaces = xpctxt->namespaces; xmlNodePtr oldXPContextNode = xpctxt->node; int oldXPProximityPosition = xpctxt->proximityPosition; int oldXPContextSize = xpctxt->contextSize; int oldXPNsNr = xpctxt->nsNr; xpctxt->node = contextNode; if (comp != NULL) { #ifdef XSLT_REFACTORED if (comp->inScopeNs != NULL) { xpctxt->namespaces = comp->inScopeNs->list; xpctxt->nsNr = comp->inScopeNs->xpathNumber; } else { xpctxt->namespaces = NULL; xpctxt->nsNr = 0; } #else xpctxt->namespaces = comp->nsList; xpctxt->nsNr = comp->nsNr; #endif } else { xpctxt->namespaces = NULL; xpctxt->nsNr = 0; } /* * This XPath function is optimized for boolean results. */ xpobj = xmlXPathCompiledEval(comp->comp, xpctxt); xpctxt->doc = oldXPContextDoc; xpctxt->node = oldXPContextNode; xpctxt->contextSize = oldXPContextSize; xpctxt->proximityPosition = oldXPProximityPosition; xpctxt->nsNr = oldXPNsNr; xpctxt->namespaces = oldXPNamespaces; } if (xpobj != NULL) { if (xpobj->type != XPATH_BOOLEAN) xpobj = xmlXPathConvertBoolean(xpobj); if (xpobj->type == XPATH_BOOLEAN) { res = xpobj->boolval; #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt,XSLT_TRACE_IF,xsltGenericDebug(xsltGenericDebugContext, ""xsltIf: test evaluate to %d\n"", res)); #endif if (res) { xsltApplySequenceConstructor(ctxt, contextNode, inst->children, NULL); } } else { #ifdef WITH_XSLT_DEBUG_PROCESS XSLT_TRACE(ctxt, XSLT_TRACE_IF, xsltGenericDebug(xsltGenericDebugContext, ""xsltIf: test didn't evaluate to a boolean\n"")); #endif ctxt->state = XSLT_STATE_STOPPED; } xmlXPathFreeObject(xpobj); } else { ctxt->state = XSLT_STATE_STOPPED; } } #endif /* else of XSLT_FAST_IF */ error: return; } ",1 "void LayerTreeHostQt::notifyAnimationStarted(const WebCore::GraphicsLayer*, double time) { } ",0 "moffset(struct magic_set *ms, struct magic *m) { switch (m->type) { case FILE_BYTE: return CAST(int32_t, (ms->offset + sizeof(char))); case FILE_SHORT: case FILE_BESHORT: case FILE_LESHORT: return CAST(int32_t, (ms->offset + sizeof(short))); case FILE_LONG: case FILE_BELONG: case FILE_LELONG: case FILE_MELONG: return CAST(int32_t, (ms->offset + sizeof(int32_t))); case FILE_QUAD: case FILE_BEQUAD: case FILE_LEQUAD: return CAST(int32_t, (ms->offset + sizeof(int64_t))); case FILE_STRING: case FILE_PSTRING: case FILE_BESTRING16: case FILE_LESTRING16: if (m->reln == '=' || m->reln == '!') return ms->offset + m->vallen; else { union VALUETYPE *p = &ms->ms_value; uint32_t t; if (*m->value.s == '\0') p->s[strcspn(p->s, ""\n"")] = '\0'; t = CAST(uint32_t, (ms->offset + strlen(p->s))); if (m->type == FILE_PSTRING) t += (uint32_t)file_pstring_length_size(m); return t; } case FILE_DATE: case FILE_BEDATE: case FILE_LEDATE: case FILE_MEDATE: return CAST(int32_t, (ms->offset + sizeof(uint32_t))); case FILE_LDATE: case FILE_BELDATE: case FILE_LELDATE: case FILE_MELDATE: return CAST(int32_t, (ms->offset + sizeof(uint32_t))); case FILE_QDATE: case FILE_BEQDATE: case FILE_LEQDATE: return CAST(int32_t, (ms->offset + sizeof(uint64_t))); case FILE_QLDATE: case FILE_BEQLDATE: case FILE_LEQLDATE: return CAST(int32_t, (ms->offset + sizeof(uint64_t))); case FILE_FLOAT: case FILE_BEFLOAT: case FILE_LEFLOAT: return CAST(int32_t, (ms->offset + sizeof(float))); case FILE_DOUBLE: case FILE_BEDOUBLE: case FILE_LEDOUBLE: return CAST(int32_t, (ms->offset + sizeof(double))); case FILE_REGEX: if ((m->str_flags & REGEX_OFFSET_START) != 0) return CAST(int32_t, ms->search.offset); else return CAST(int32_t, (ms->search.offset + ms->search.rm_len)); case FILE_SEARCH: if ((m->str_flags & REGEX_OFFSET_START) != 0) return CAST(int32_t, ms->search.offset); else return CAST(int32_t, (ms->search.offset + m->vallen)); case FILE_CLEAR: case FILE_DEFAULT: case FILE_INDIRECT: return ms->offset; default: return 0; } } ",0 "static int spl_array_has_dimension_ex(int check_inherited, zval *object, zval *offset, int check_empty TSRMLS_DC) /* {{{ */ { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(object TSRMLS_CC); long index; zval *rv, **tmp; if (check_inherited && intern->fptr_offset_has) { SEPARATE_ARG_IF_REF(offset); zend_call_method_with_1_params(&object, Z_OBJCE_P(object), &intern->fptr_offset_has, ""offsetExists"", &rv, offset); zval_ptr_dtor(&offset); if (rv && zend_is_true(rv)) { zval_ptr_dtor(&rv); return 1; } if (rv) { zval_ptr_dtor(&rv); } return 0; } switch(Z_TYPE_P(offset)) { case IS_STRING: { HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (zend_symtable_find(ht, Z_STRVAL_P(offset), Z_STRLEN_P(offset)+1, (void **) &tmp) != FAILURE) { switch (check_empty) { case 0: return Z_TYPE_PP(tmp) != IS_NULL; case 2: return 1; default: return zend_is_true(*tmp); } } } return 0; case IS_DOUBLE: case IS_RESOURCE: case IS_BOOL: case IS_LONG: { HashTable *ht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (offset->type == IS_DOUBLE) { index = (long)Z_DVAL_P(offset); } else { index = Z_LVAL_P(offset); } if (zend_hash_index_find(ht, index, (void **)&tmp) != FAILURE) { switch (check_empty) { case 0: return Z_TYPE_PP(tmp) != IS_NULL; case 2: return 1; default: return zend_is_true(*tmp); } } return 0; } default: zend_error(E_WARNING, ""Illegal offset type""); } return 0; } /* }}} */ ",0 "unsigned find_get_pages(struct address_space *mapping, pgoff_t start, unsigned int nr_pages, struct page **pages) { unsigned int i; unsigned int ret; read_lock_irq(&mapping->tree_lock); ret = radix_tree_gang_lookup(&mapping->page_tree, (void **)pages, start, nr_pages); for (i = 0; i < ret; i++) page_cache_get(pages[i]); read_unlock_irq(&mapping->tree_lock); return ret; } ",0 "static void v9fs_lcreate(void *opaque) { int32_t dfid, flags, mode; gid_t gid; ssize_t err = 0; ssize_t offset = 7; V9fsString name; V9fsFidState *fidp; struct stat stbuf; V9fsQID qid; int32_t iounit; V9fsPDU *pdu = opaque; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, ""dsddd"", &dfid, &name, &flags, &mode, &gid); if (err < 0) { goto out_nofid; } trace_v9fs_lcreate(pdu->tag, pdu->id, dfid, flags, mode, gid); if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(""."", name.data) || !strcmp("".."", name.data)) { err = -EEXIST; goto out_nofid; } fidp = get_fid(pdu, dfid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } flags = get_dotl_openflags(pdu->s, flags); err = v9fs_co_open2(pdu, fidp, &name, gid, flags | O_CREAT, mode, &stbuf); if (err < 0) { goto out; } fidp->fid_type = P9_FID_FILE; fidp->open_flags = flags; if (flags & O_EXCL) { /* * We let the host file system do O_EXCL check * We should not reclaim such fd */ fidp->flags |= FID_NON_RECLAIMABLE; } iounit = get_iounit(pdu, &fidp->path); stat_to_qid(&stbuf, &qid); err = pdu_marshal(pdu, offset, ""Qd"", &qid, iounit); if (err < 0) { goto out; } err += offset; trace_v9fs_lcreate_return(pdu->tag, pdu->id, qid.type, qid.version, qid.path, iounit); out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); v9fs_string_free(&name); } ",0 "bool asn1_write_OID(struct asn1_data *data, const char *OID) { DATA_BLOB blob; if (!asn1_push_tag(data, ASN1_OID)) return false; if (!ber_write_OID_String(NULL, &blob, OID)) { data->has_error = true; return false; } if (!asn1_write(data, blob.data, blob.length)) { data_blob_free(&blob); data->has_error = true; return false; } data_blob_free(&blob); return asn1_pop_tag(data); } ",0 "void SoftOpus::onPortFlushCompleted(OMX_U32 portIndex) { if (portIndex == 0 && mDecoder != NULL) { mNumFramesOutput = 0; opus_multistream_decoder_ctl(mDecoder, OPUS_RESET_STATE); mAnchorTimeUs = 0; mSamplesToDiscard = mSeekPreRoll; } } ",0 "void WebContentsImpl::CollapseSelection() { RenderFrameHost* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->GetFrameInputHandler()->CollapseSelection(); } ",0 "mrb_fd_cloexec(mrb_state *mrb, int fd) { #if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC) int flags, flags2; flags = fcntl(fd, F_GETFD); if (flags == -1) { mrb_bug(mrb, ""mrb_fd_cloexec: fcntl(%S, F_GETFD) failed: %S"", mrb_fixnum_value(fd), mrb_fixnum_value(errno)); } if (fd <= 2) { flags2 = flags & ~FD_CLOEXEC; /* Clear CLOEXEC for standard file descriptors: 0, 1, 2. */ } else { flags2 = flags | FD_CLOEXEC; /* Set CLOEXEC for non-standard file descriptors: 3, 4, 5, ... */ } if (flags != flags2) { if (fcntl(fd, F_SETFD, flags2) == -1) { mrb_bug(mrb, ""mrb_fd_cloexec: fcntl(%S, F_SETFD, %S) failed: %S"", mrb_fixnum_value(fd), mrb_fixnum_value(flags2), mrb_fixnum_value(errno)); } } #endif } ",0 "static int l2tp_ip_disconnect(struct sock *sk, int flags) { if (sock_flag(sk, SOCK_ZAPPED)) return 0; return udp_disconnect(sk, flags); } ",0 "badauth(OM_uint32 maj, OM_uint32 minor, SVCXPRT *xprt) { if (log_badauth != NULL) (*log_badauth)(maj, minor, &xprt->xp_raddr, log_badauth_data); if (log_badauth2 != NULL) (*log_badauth2)(maj, minor, xprt, log_badauth2_data); } ",0 "WaveShaperNode* BaseAudioContext::createWaveShaper( ExceptionState& exception_state) { DCHECK(IsMainThread()); return WaveShaperNode::Create(*this, exception_state); } ",0 "void PrintingMessageFilter::OnGetDefaultPrintSettings(IPC::Message* reply_msg) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); scoped_refptr printer_query; if (!profile_io_data_->printing_enabled()->GetValue()) { OnGetDefaultPrintSettingsReply(printer_query, reply_msg); return; } print_job_manager_->PopPrinterQuery(0, &printer_query); if (!printer_query.get()) { printer_query = new printing::PrinterQuery; printer_query->SetWorkerDestination(print_job_manager_->destination()); } GetPrintSettingsForRenderViewParams params; params.ask_user_for_settings = printing::PrinterQuery::DEFAULTS; params.expected_page_count = 0; params.has_selection = false; params.margin_type = printing::DEFAULT_MARGINS; BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&PrintingMessageFilter::GetPrintSettingsForRenderView, this, reply_msg->routing_id(), params, base::Bind(&PrintingMessageFilter::OnGetDefaultPrintSettingsReply, this, printer_query, reply_msg), printer_query)); } ",0 "const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src, int *dst_length, int *consumed, int length) { int i, si, di; uint8_t *dst; int bufidx; h->nal_ref_idc = src[0] >> 5; h->nal_unit_type = src[0] & 0x1F; src++; length--; #define STARTCODE_TEST \ if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \ if (src[i + 2] != 3 && src[i + 2] != 0) { \ /* startcode, so we must be past the end */ \ length = i; \ } \ break; \ } #if HAVE_FAST_UNALIGNED #define FIND_FIRST_ZERO \ if (i > 0 && !src[i]) \ i--; \ while (src[i]) \ i++ #if HAVE_FAST_64BIT for (i = 0; i + 1 < length; i += 9) { if (!((~AV_RN64A(src + i) & (AV_RN64A(src + i) - 0x0100010001000101ULL)) & 0x8000800080008080ULL)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; i -= 7; } #else for (i = 0; i + 1 < length; i += 5) { if (!((~AV_RN32A(src + i) & (AV_RN32A(src + i) - 0x01000101U)) & 0x80008080U)) continue; FIND_FIRST_ZERO; STARTCODE_TEST; i -= 3; } #endif #else for (i = 0; i + 1 < length; i += 2) { if (src[i]) continue; if (i > 0 && src[i - 1] == 0) i--; STARTCODE_TEST; } #endif bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0; av_fast_padded_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+MAX_MBPAIR_SIZE); dst = h->rbsp_buffer[bufidx]; if (!dst) return NULL; if(i>=length-1){ //no escaped 0 *dst_length= length; *consumed= length+1; //+1 for the header if(h->avctx->flags2 & CODEC_FLAG2_FAST){ return src; }else{ memcpy(dst, src, length); return dst; } } memcpy(dst, src, i); si = di = i; while (si + 2 < length) { if (src[si + 2] > 3) { dst[di++] = src[si++]; dst[di++] = src[si++]; } else if (src[si] == 0 && src[si + 1] == 0 && src[si + 2] != 0) { if (src[si + 2] == 3) { // escape dst[di++] = 0; dst[di++] = 0; si += 3; continue; } else // next start code goto nsc; } dst[di++] = src[si++]; } while (si < length) dst[di++] = src[si++]; nsc: memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE); *dst_length = di; *consumed = si + 1; // +1 for the header /* FIXME store exact number of bits in the getbitcontext * (it is needed for decoding) */ return dst; } ",0 "bool Document::CanExecuteScripts(ReasonForCallingCanExecuteScripts reason) { DCHECK(GetFrame()) << ""you are querying canExecuteScripts on a non contextDocument.""; if (IsSandboxed(kSandboxScripts) && !ContentSecurityPolicy::ShouldBypassMainWorld(this)) { if (reason == kAboutToExecuteScript) { AddConsoleMessage(ConsoleMessage::Create( kSecurityMessageSource, mojom::ConsoleMessageLevel::kError, ""Blocked script execution in '"" + Url().ElidedString() + ""' because the document's frame is sandboxed and the "" ""'allow-scripts' permission is not set."")); } return false; } if (!GetFrame()->Client()) return false; WebContentSettingsClient* settings_client = GetFrame()->GetContentSettingsClient(); Settings* settings = GetFrame()->GetSettings(); bool script_enabled = settings && settings->GetScriptEnabled(); if (settings_client) script_enabled = settings_client->AllowScript(script_enabled); if (!script_enabled && reason == kAboutToExecuteScript && settings_client) settings_client->DidNotAllowScript(); return script_enabled; } ",0 "bool FrameLoader::isMixedContent(SecurityOrigin* context, const KURL& url) { if (context->protocol() != ""https"") return false; // We only care about HTTPS security origins. if (!url.isValid() || SchemeRegistry::shouldTreatURLSchemeAsSecure(url.protocol())) return false; // Loading these protocols is secure. return true; } ",0 " JingleSessionManager::~JingleSessionManager() { Close(); } ",1 "int sctp_do_peeloff(struct sock *sk, sctp_assoc_t id, struct socket **sockp) { struct sctp_association *asoc = sctp_id2assoc(sk, id); struct sctp_sock *sp = sctp_sk(sk); struct socket *sock; int err = 0; if (!asoc) return -EINVAL; /* An association cannot be branched off from an already peeled-off * socket, nor is this supported for tcp style sockets. */ if (!sctp_style(sk, UDP)) return -EINVAL; /* Create a new socket. */ err = sock_create(sk->sk_family, SOCK_SEQPACKET, IPPROTO_SCTP, &sock); if (err < 0) return err; sctp_copy_sock(sock->sk, sk, asoc); /* Make peeled-off sockets more like 1-1 accepted sockets. * Set the daddr and initialize id to something more random */ sp->pf->to_sk_daddr(&asoc->peer.primary_addr, sk); /* Populate the fields of the newsk from the oldsk and migrate the * asoc to the newsk. */ sctp_sock_migrate(sk, sock->sk, asoc, SCTP_SOCKET_UDP_HIGH_BANDWIDTH); *sockp = sock; return err; } ",1 "static int sctp_v6_available(union sctp_addr *addr, struct sctp_sock *sp) { int type; const struct in6_addr *in6 = (const struct in6_addr *)&addr->v6.sin6_addr; type = ipv6_addr_type(in6); if (IPV6_ADDR_ANY == type) return 1; if (type == IPV6_ADDR_MAPPED) { if (sp && !sp->v4mapped) return 0; if (sp && ipv6_only_sock(sctp_opt2sk(sp))) return 0; sctp_v6_map_v4(addr); return sctp_get_af_specific(AF_INET)->available(addr, sp); } if (!(type & IPV6_ADDR_UNICAST)) return 0; return ipv6_chk_addr(sock_net(&sp->inet.sk), in6, NULL, 0); } ",0 "int __alloc_bootmem_huge_page(struct hstate *h) { struct huge_bootmem_page *m; int nr_nodes, node; for_each_node_mask_to_alloc(h, nr_nodes, node, &node_states[N_MEMORY]) { void *addr; addr = memblock_alloc_try_nid_raw( huge_page_size(h), huge_page_size(h), 0, MEMBLOCK_ALLOC_ACCESSIBLE, node); if (addr) { /* * Use the beginning of the huge page to store the * huge_bootmem_page struct (until gather_bootmem * puts them into the mem_map). */ m = addr; goto found; } } return 0; found: BUG_ON(!IS_ALIGNED(virt_to_phys(m), huge_page_size(h))); /* Put them into a private list first because mem_map is not up yet */ INIT_LIST_HEAD(&m->list); list_add(&m->list, &huge_boot_pages); m->hstate = h; return 1; } ",0 "void ChildProcessSecurityPolicyImpl::GrantReadFile(int child_id, const FilePath& file) { GrantPermissionsForFile(child_id, file, kReadFilePermissions); } ",0 "static bool coroutine_fn wait_serialising_requests(BdrvTrackedRequest *self) { BlockDriverState *bs = self->bs; BdrvTrackedRequest *req; bool retry; bool waited = false; if (!bs->serialising_in_flight) { return false; } do { retry = false; QLIST_FOREACH(req, &bs->tracked_requests, list) { if (req == self || (!req->serialising && !self->serialising)) { continue; } if (tracked_request_overlaps(req, self->overlap_offset, self->overlap_bytes)) { /* Hitting this means there was a reentrant request, for * example, a block driver issuing nested requests. This must * never happen since it means deadlock. */ assert(qemu_coroutine_self() != req->co); /* If the request is already (indirectly) waiting for us, or * will wait for us as soon as it wakes up, then just go on * (instead of producing a deadlock in the former case). */ if (!req->waiting_for) { self->waiting_for = req; qemu_co_queue_wait(&req->wait_queue); self->waiting_for = NULL; retry = true; waited = true; break; } } } } while (retry); return waited; } ",0 "void UrlmonUrlRequestManager::OnReadComplete(int request_id, const std::string& data) { DCHECK_NE(request_id, -1); DVLOG(1) << __FUNCTION__ << "" id: "" << request_id; DCHECK(LookupRequest(request_id) != NULL); ++calling_delegate_; delegate_->OnReadComplete(request_id, data); --calling_delegate_; DVLOG(1) << __FUNCTION__ << "" done id: "" << request_id; } ",0 "void shm_destroy_orphaned(struct ipc_namespace *ns) { down_write(&shm_ids(ns).rwsem); if (shm_ids(ns).in_use) idr_for_each(&shm_ids(ns).ipcs_idr, &shm_try_destroy_orphaned, ns); up_write(&shm_ids(ns).rwsem); } ",0 "static bool remove_xps_queue_cpu(struct net_device *dev, struct xps_dev_maps *dev_maps, int cpu, u16 offset, u16 count) { int num_tc = dev->num_tc ? : 1; bool active = false; int tci; for (tci = cpu * num_tc; num_tc--; tci++) { int i, j; for (i = count, j = offset; i--; j++) { if (!remove_xps_queue(dev_maps, cpu, j)) break; } active |= i < 0; } return active; } ",0 "void ContentSecurityPolicy::ReportInvalidSandboxFlags( const String& invalid_flags) { LogToConsole( ""Error while parsing the 'sandbox' Content Security Policy directive: "" + invalid_flags); } ",0 "http_atotm (const char *time_string) { /* NOTE: Solaris strptime man page claims that %n and %t match white space, but that's not universally available. Instead, we simply use ` ' to mean ""skip all WS"", which works under all strptime implementations I've tested. */ static const char *time_formats[] = { ""%a, %d %b %Y %T"", /* rfc1123: Thu, 29 Jan 1998 22:12:57 */ ""%A, %d-%b-%y %T"", /* rfc850: Thursday, 29-Jan-98 22:12:57 */ ""%a %b %d %T %Y"", /* asctime: Thu Jan 29 22:12:57 1998 */ ""%a, %d-%b-%Y %T"" /* cookies: Thu, 29-Jan-1998 22:12:57 (used in Set-Cookie, defined in the Netscape cookie specification.) */ }; const char *oldlocale; char savedlocale[256]; size_t i; time_t ret = (time_t) -1; /* Solaris strptime fails to recognize English month names in non-English locales, which we work around by temporarily setting locale to C before invoking strptime. */ oldlocale = setlocale (LC_TIME, NULL); if (oldlocale) { size_t l = strlen (oldlocale) + 1; if (l >= sizeof savedlocale) savedlocale[0] = '\0'; else memcpy (savedlocale, oldlocale, l); } else savedlocale[0] = '\0'; setlocale (LC_TIME, ""C""); for (i = 0; i < countof (time_formats); i++) { struct tm t; /* Some versions of strptime use the existing contents of struct tm to recalculate the date according to format. Zero it out to prevent stack garbage from influencing strptime. */ xzero (t); if (check_end (strptime (time_string, time_formats[i], &t))) { ret = timegm (&t); break; } } /* Restore the previous locale. */ if (savedlocale[0]) setlocale (LC_TIME, savedlocale); return ret; } ",0 "static int cm_migrate(struct ib_cm_id *cm_id) { struct cm_id_private *cm_id_priv; unsigned long flags; int ret = 0; cm_id_priv = container_of(cm_id, struct cm_id_private, id); spin_lock_irqsave(&cm_id_priv->lock, flags); if (cm_id->state == IB_CM_ESTABLISHED && (cm_id->lap_state == IB_CM_LAP_UNINIT || cm_id->lap_state == IB_CM_LAP_IDLE)) { cm_id->lap_state = IB_CM_LAP_IDLE; cm_id_priv->av = cm_id_priv->alt_av; } else ret = -EINVAL; spin_unlock_irqrestore(&cm_id_priv->lock, flags); return ret; } ",0 "static struct nfs4_opendata *nfs4_open_recoverdata_alloc(struct nfs_open_context *ctx, struct nfs4_state *state) { struct nfs4_opendata *opendata; opendata = nfs4_opendata_alloc(&ctx->path, state->owner, 0, NULL); if (opendata == NULL) return ERR_PTR(-ENOMEM); opendata->state = state; atomic_inc(&state->count); return opendata; } ",1 "static void perWorldReadOnlyAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectV8Internal::perWorldReadOnlyAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "int avpriv_dv_produce_packet(DVDemuxContext *c, AVPacket *pkt, uint8_t* buf, int buf_size) { int size, i; uint8_t *ppcm[4] = {0}; if (buf_size < DV_PROFILE_BYTES || !(c->sys = avpriv_dv_frame_profile(c->sys, buf, buf_size)) || buf_size < c->sys->frame_size) { return -1; /* Broken frame, or not enough data */ } /* Queueing audio packet */ /* FIXME: in case of no audio/bad audio we have to do something */ size = dv_extract_audio_info(c, buf); for (i = 0; i < c->ach; i++) { c->audio_pkt[i].size = size; c->audio_pkt[i].pts = c->abytes * 30000*8 / c->ast[i]->codec->bit_rate; ppcm[i] = c->audio_buf[i]; } dv_extract_audio(buf, ppcm, c->sys); /* We work with 720p frames split in half, thus even frames have * channels 0,1 and odd 2,3. */ if (buf[1] & 0x0C) { c->audio_pkt[2].size = c->audio_pkt[3].size = 0; } else { c->audio_pkt[0].size = c->audio_pkt[1].size = 0; c->abytes += size; } } else { c->abytes += size; } ",1 "static av_cold int hevc_init_context(AVCodecContext *avctx) { HEVCContext *s = avctx->priv_data; int i; s->avctx = avctx; s->HEVClc = av_mallocz(sizeof(HEVCLocalContext)); if (!s->HEVClc) goto fail; s->HEVClcList[0] = s->HEVClc; s->sList[0] = s; s->cabac_state = av_malloc(HEVC_CONTEXTS); if (!s->cabac_state) goto fail; s->output_frame = av_frame_alloc(); if (!s->output_frame) goto fail; for (i = 0; i < FF_ARRAY_ELEMS(s->DPB); i++) { s->DPB[i].frame = av_frame_alloc(); if (!s->DPB[i].frame) goto fail; s->DPB[i].tf.f = s->DPB[i].frame; } s->max_ra = INT_MAX; s->md5_ctx = av_md5_alloc(); if (!s->md5_ctx) goto fail; ff_bswapdsp_init(&s->bdsp); s->context_initialized = 1; s->eos = 0; ff_hevc_reset_sei(&s->sei); return 0; fail: hevc_decode_free(avctx); return AVERROR(ENOMEM); } ",0 " static void SendAck(QuicConnection* connection) { connection->SendAck(); } ",0 "PrepareFrameAndViewForPrint::PrepareFrameAndViewForPrint( const ViewMsg_Print_Params& print_params, WebFrame* frame, WebNode* node, WebView* web_view) : frame_(frame), web_view_(web_view), expected_pages_count_(0), use_browser_overlays_(true) { int dpi = static_cast(print_params.dpi); #if defined(OS_MACOSX) dpi = printing::kPointsPerInch; #endif // defined(OS_MACOSX) print_canvas_size_.set_width( ConvertUnit(print_params.printable_size.width(), dpi, print_params.desired_dpi)); print_canvas_size_.set_height( ConvertUnit(print_params.printable_size.height(), dpi, print_params.desired_dpi)); gfx::Size print_layout_size(print_canvas_size_); print_layout_size.set_height(static_cast( static_cast(print_layout_size.height()) * 1.25)); prev_view_size_ = web_view->size(); web_view->resize(print_layout_size); WebNode node_to_print; if (node) node_to_print = *node; expected_pages_count_ = frame->printBegin( print_canvas_size_, node_to_print, static_cast(print_params.dpi), &use_browser_overlays_); } ",0 "PHP_FUNCTION(stripslashes) { zend_string *str; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""S"", &str) == FAILURE) { return; } ZVAL_STRINGL(return_value, ZSTR_VAL(str), ZSTR_LEN(str)); php_stripslashes(Z_STR_P(return_value)); } ",0 "int nfc_llcp_set_remote_gb(struct nfc_dev *dev, u8 *gb, u8 gb_len) { struct nfc_llcp_local *local; if (gb_len < 3 || gb_len > NFC_MAX_GT_LEN) return -EINVAL; local = nfc_llcp_find_local(dev); if (local == NULL) { pr_err(""No LLCP device\n""); return -ENODEV; } memset(local->remote_gb, 0, NFC_MAX_GT_LEN); memcpy(local->remote_gb, gb, gb_len); local->remote_gb_len = gb_len; if (memcmp(local->remote_gb, llcp_magic, 3)) { pr_err(""MAC does not support LLCP\n""); return -EINVAL; } return nfc_llcp_parse_gb_tlv(local, &local->remote_gb[3], local->remote_gb_len - 3); } ",0 "static int validatecieaspace(i_ctx_t * i_ctx_p, ref **r) { int code; float value[9]; ref CIEdict, *CIEspace = *r, *tempref; if (!r_is_array(CIEspace)) return_error(gs_error_typecheck); /* Validate parameters, check we have enough operands */ if (r_size(CIEspace) != 2) return_error(gs_error_rangecheck); code = array_get(imemory, CIEspace, 1, &CIEdict); if (code < 0) return code; check_read_type(CIEdict, t_dictionary); /* Check white point exists, and is an array of three numbers */ code = checkWhitePoint(i_ctx_p, &CIEdict); if (code != 0) return code; /* Remaining parameters are optional, but we must validate * them if they are present */ code = dict_find_string(&CIEdict, ""RangeA"", &tempref); if (code > 0 && !r_has_type(tempref, t_null)) { /* Array of two numbers A0 < A1 */ if (!r_is_array(tempref)) return_error(gs_error_typecheck); if (r_size(tempref) != 2) return_error(gs_error_rangecheck); code = get_cie_param_array(imemory, tempref, 2, value); if (code < 0) return code; if (value[1] < value[0]) return_error(gs_error_rangecheck); } code = dict_find_string(&CIEdict, ""DecodeA"", &tempref); if (code > 0 && !r_has_type(tempref, t_null)) { check_proc(*tempref); } code = dict_find_string(&CIEdict, ""MatrixA"", &tempref); if (code > 0 && !r_has_type(tempref, t_null)) { if (!r_is_array(tempref)) return_error(gs_error_typecheck); if (r_size(tempref) != 3) return_error(gs_error_rangecheck); code = get_cie_param_array(imemory, tempref, 3, value); if (code < 0) return code; } code = checkRangeLMN(i_ctx_p, &CIEdict); if (code != 0) return code; code = checkDecodeLMN(i_ctx_p, &CIEdict); if (code != 0) return code; code = checkMatrixLMN(i_ctx_p, &CIEdict); if (code != 0) return code; code = checkBlackPoint(i_ctx_p, &CIEdict); if (code != 0) return code; *r = 0; return 0; } ",0 "GF_Err lsr1_AddBox(GF_Box *s, GF_Box *a) { GF_LASeRSampleEntryBox *ptr = (GF_LASeRSampleEntryBox *)s; switch (a->type) { case GF_ISOM_BOX_TYPE_LSRC: if (ptr->lsr_config) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->lsr_config = (GF_LASERConfigurationBox *)a; break; case GF_ISOM_BOX_TYPE_M4DS: if (ptr->descr) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->descr = (GF_MPEG4ExtensionDescriptorsBox *)a; break; default: return gf_isom_box_add_default(s, a); } return GF_OK; } ",0 "dmxBEFreeGlyphSet(ScreenPtr pScreen, GlyphSetPtr glyphSet) { dmxGlyphPrivPtr glyphPriv = DMX_GET_GLYPH_PRIV(glyphSet); int idx = pScreen->myNum; DMXScreenInfo *dmxScreen = &dmxScreens[idx]; if (glyphPriv->glyphSets[idx]) { XRenderFreeGlyphSet(dmxScreen->beDisplay, glyphPriv->glyphSets[idx]); glyphPriv->glyphSets[idx] = (GlyphSet) 0; return TRUE; } return FALSE; } ",0 "int32 WebContentsImpl::GetMaxPageID() { return GetMaxPageIDForSiteInstance(GetSiteInstance()); } ",0 "nfsd4_decode_commit(struct nfsd4_compoundargs *argp, struct nfsd4_commit *commit) { DECODE_HEAD; READ_BUF(12); p = xdr_decode_hyper(p, &commit->co_offset); commit->co_count = be32_to_cpup(p++); DECODE_TAIL; } ",0 "static void set_orig_addr(struct msghdr *m, struct tipc_msg *msg) { DECLARE_SOCKADDR(struct sockaddr_tipc *, addr, m->msg_name); if (addr) { addr->family = AF_TIPC; addr->addrtype = TIPC_ADDR_ID; memset(&addr->addr, 0, sizeof(addr->addr)); addr->addr.id.ref = msg_origport(msg); addr->addr.id.node = msg_orignode(msg); addr->addr.name.domain = 0; /* could leave uninitialized */ addr->scope = 0; /* could leave uninitialized */ m->msg_namelen = sizeof(struct sockaddr_tipc); } } ",0 "static int mmu_memory_cache_free_objects(struct kvm_mmu_memory_cache *cache) { return cache->nobjs; } ",0 "static int pppol2tp_session_ioctl(struct l2tp_session *session, unsigned int cmd, unsigned long arg) { struct ifreq ifr; int err = 0; struct sock *sk; int val = (int) arg; struct pppol2tp_session *ps = l2tp_session_priv(session); struct l2tp_tunnel *tunnel = session->tunnel; struct pppol2tp_ioc_stats stats; l2tp_dbg(session, PPPOL2TP_MSG_CONTROL, ""%s: pppol2tp_session_ioctl(cmd=%#x, arg=%#lx)\n"", session->name, cmd, arg); sk = ps->sock; sock_hold(sk); switch (cmd) { case SIOCGIFMTU: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; err = -EFAULT; if (copy_from_user(&ifr, (void __user *) arg, sizeof(struct ifreq))) break; ifr.ifr_mtu = session->mtu; if (copy_to_user((void __user *) arg, &ifr, sizeof(struct ifreq))) break; l2tp_info(session, PPPOL2TP_MSG_CONTROL, ""%s: get mtu=%d\n"", session->name, session->mtu); err = 0; break; case SIOCSIFMTU: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; err = -EFAULT; if (copy_from_user(&ifr, (void __user *) arg, sizeof(struct ifreq))) break; session->mtu = ifr.ifr_mtu; l2tp_info(session, PPPOL2TP_MSG_CONTROL, ""%s: set mtu=%d\n"", session->name, session->mtu); err = 0; break; case PPPIOCGMRU: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; err = -EFAULT; if (put_user(session->mru, (int __user *) arg)) break; l2tp_info(session, PPPOL2TP_MSG_CONTROL, ""%s: get mru=%d\n"", session->name, session->mru); err = 0; break; case PPPIOCSMRU: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; err = -EFAULT; if (get_user(val, (int __user *) arg)) break; session->mru = val; l2tp_info(session, PPPOL2TP_MSG_CONTROL, ""%s: set mru=%d\n"", session->name, session->mru); err = 0; break; case PPPIOCGFLAGS: err = -EFAULT; if (put_user(ps->flags, (int __user *) arg)) break; l2tp_info(session, PPPOL2TP_MSG_CONTROL, ""%s: get flags=%d\n"", session->name, ps->flags); err = 0; break; case PPPIOCSFLAGS: err = -EFAULT; if (get_user(val, (int __user *) arg)) break; ps->flags = val; l2tp_info(session, PPPOL2TP_MSG_CONTROL, ""%s: set flags=%d\n"", session->name, ps->flags); err = 0; break; case PPPIOCGL2TPSTATS: err = -ENXIO; if (!(sk->sk_state & PPPOX_CONNECTED)) break; memset(&stats, 0, sizeof(stats)); stats.tunnel_id = tunnel->tunnel_id; stats.session_id = session->session_id; pppol2tp_copy_stats(&stats, &session->stats); if (copy_to_user((void __user *) arg, &stats, sizeof(stats))) break; l2tp_info(session, PPPOL2TP_MSG_CONTROL, ""%s: get L2TP stats\n"", session->name); err = 0; break; default: err = -ENOSYS; break; } sock_put(sk); return err; } ",0 " void SendScrollBeginAckIfNeeded(InputEventAckState ack_result) { MockWidgetInputHandler::MessageVector events = GetAndResetDispatchedMessages(); SendScrollBeginAckIfNeeded(events, ack_result); } ",0 "static const char *am_request_hostname(request_rec *r) { const char *url; apr_uri_t uri; int ret; url = am_reconstruct_url(r); ret = apr_uri_parse(r->pool, url, &uri); if (ret != APR_SUCCESS) { AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, ""Failed to parse request URL: %s"", url); return NULL; } if (uri.hostname == NULL) { /* This shouldn't happen, since the request URL is built with a hostname, * but log a message to make any debuggin around this code easier. */ AM_LOG_RERROR(APLOG_MARK, APLOG_ERR, 0, r, ""No hostname in request URL: %s"", url); return NULL; } return uri.hostname; } ",0 "static tBTM_STATUS btm_sec_send_hci_disconnect (tBTM_SEC_DEV_REC *p_dev_rec, UINT8 reason, UINT16 conn_handle) { UINT8 old_state = p_dev_rec->sec_state; tBTM_STATUS status = BTM_CMD_STARTED; BTM_TRACE_EVENT (""btm_sec_send_hci_disconnect: handle:0x%x, reason=0x%x"", conn_handle, reason); /* if some other thread disconnecting, we do not send second command */ if (BTM_SEC_STATE_DISCONNECTING != old_state) { p_dev_rec->sec_state = BTM_SEC_STATE_DISCONNECTING; #if BTM_DISC_DURING_RS == TRUE /* If a Role Switch is in progress, delay the HCI Disconnect to avoid controller problem (4329B1) */ if (p_dev_rec->rs_disc_pending == BTM_SEC_RS_PENDING && p_dev_rec->hci_handle == conn_handle) { BTM_TRACE_DEBUG(""RS in progress - Set DISC Pending flag in btm_sec_send_hci_disconnect to delay disconnect""); p_dev_rec->rs_disc_pending = BTM_SEC_DISC_PENDING; status = BTM_SUCCESS; } else #endif /* Tear down the HCI link */ if (!btsnd_hcic_disconnect (conn_handle, reason)) { /* could not send disconnect. restore old state */ p_dev_rec->sec_state = old_state; status = BTM_NO_RESOURCES; } } return (status); } ",0 "exsltDateNormalize (exsltDateValPtr dt) { exsltDateValPtr dur, tmp; if (dt == NULL) return; if (((dt->type & XS_TIME) != XS_TIME) && (dt->value.date.tzo == 0)) return; dur = exsltDateCreateDate(XS_DURATION); if (dur == NULL) return; tmp = _exsltDateAdd(dt, dur); if (tmp == NULL) return; memcpy(dt, tmp, sizeof(exsltDateVal)); exsltDateFreeDate(tmp); exsltDateFreeDate(dur); dt->value.date.tzo = 0; } ",0 "void ThreadWatcher::ResetHangCounters() { DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); unresponsive_count_ = 0; hung_processing_complete_ = false; } ",0 "static u8 coolkey_class(unsigned long object_id) { return (object_id >> 24) & 0xff; } ",0 "v8::Persistent V8TestMediaQueryListListener::GetRawTemplate() { V8BindingPerIsolateData* data = V8BindingPerIsolateData::current(); V8BindingPerIsolateData::TemplateMap::iterator result = data->rawTemplateMap().find(&info); if (result != data->rawTemplateMap().end()) return result->second; v8::HandleScope handleScope; v8::Persistent templ = createRawTemplate(); data->rawTemplateMap().add(&info, templ); return templ; } ",0 "static int proxy_name_to_path(FsContext *ctx, V9fsPath *dir_path, const char *name, V9fsPath *target) { if (dir_path) { v9fs_path_sprintf(target, ""%s/%s"", dir_path->data, name); } else { v9fs_path_sprintf(target, ""%s"", name); } return 0; } ",0 "static int rtecp_decipher(sc_card_t *card, const u8 *data, size_t data_len, u8 *out, size_t out_len) { int r; assert(card && card->ctx && data && out); /* decipher */ r = rtecp_cipher(card, data, data_len, out, out_len, 0); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r); } ",0 "static int netlbl_cipsov4_listall_cb(struct cipso_v4_doi *doi_def, void *arg) { int ret_val = -ENOMEM; struct netlbl_cipsov4_doiwalk_arg *cb_arg = arg; void *data; data = genlmsg_put(cb_arg->skb, NETLINK_CB(cb_arg->nl_cb->skb).pid, cb_arg->seq, &netlbl_cipsov4_gnl_family, NLM_F_MULTI, NLBL_CIPSOV4_C_LISTALL); if (data == NULL) goto listall_cb_failure; ret_val = nla_put_u32(cb_arg->skb, NLBL_CIPSOV4_A_DOI, doi_def->doi); if (ret_val != 0) goto listall_cb_failure; ret_val = nla_put_u32(cb_arg->skb, NLBL_CIPSOV4_A_MTYPE, doi_def->type); if (ret_val != 0) goto listall_cb_failure; return genlmsg_end(cb_arg->skb, data); listall_cb_failure: genlmsg_cancel(cb_arg->skb, data); return ret_val; } ",0 "server_request_free(struct server_request *req) { int i, rc=1, lock=0; if (req->base.questions) { for (i = 0; i < req->base.nquestions; ++i) mm_free(req->base.questions[i]); mm_free(req->base.questions); } if (req->port) { EVDNS_LOCK(req->port); lock=1; if (req->port->pending_replies == req) { if (req->next_pending && req->next_pending != req) req->port->pending_replies = req->next_pending; else req->port->pending_replies = NULL; } rc = --req->port->refcnt; } if (req->response) { mm_free(req->response); } server_request_free_answers(req); if (req->next_pending && req->next_pending != req) { req->next_pending->prev_pending = req->prev_pending; req->prev_pending->next_pending = req->next_pending; } if (rc == 0) { EVDNS_UNLOCK(req->port); /* ????? nickm */ server_port_free(req->port); mm_free(req); return (1); } if (lock) EVDNS_UNLOCK(req->port); mm_free(req); return (0); } ",0 "static int __must_check ffs_do_descs(unsigned count, char *data, unsigned len, ffs_entity_callback entity, void *priv) { const unsigned _len = len; unsigned long num = 0; ENTER(); for (;;) { int ret; if (num == count) data = NULL; /* Record ""descriptor"" entity */ ret = entity(FFS_DESCRIPTOR, (u8 *)num, (void *)data, priv); if (unlikely(ret < 0)) { pr_debug(""entity DESCRIPTOR(%02lx); ret = %d\n"", num, ret); return ret; } if (!data) return _len - len; ret = ffs_do_single_desc(data, len, entity, priv); if (unlikely(ret < 0)) { pr_debug(""%s returns %d\n"", __func__, ret); return ret; } len -= ret; data += ret; ++num; } } ",0 "bool AuthenticatorBleVerifyingSheetModel::IsActivityIndicatorVisible() const { return true; } ",0 "rdpsnd_process_packet(uint8 opcode, STREAM s) { uint16 vol_left, vol_right; static uint16 tick, format; static uint8 packet_index; switch (opcode) { case SNDC_WAVE: in_uint16_le(s, tick); in_uint16_le(s, format); in_uint8(s, packet_index); in_uint8s(s, 3); logger(Sound, Debug, ""rdpsnd_process_packet(), RDPSND_WRITE(tick: %u, format: %u, index: %u, data: %u bytes)\n"", (unsigned) tick, (unsigned) format, (unsigned) packet_index, (unsigned) s->size - 8); if (format >= MAX_FORMATS) { logger(Sound, Error, ""rdpsnd_process_packet(), invalid format index""); break; } if (!device_open || (format != current_format)) { /* * If we haven't selected a device by now, then either * we've failed to find a working device, or the server * is sending bogus SNDC_WAVE. */ if (!current_driver) { rdpsnd_send_waveconfirm(tick, packet_index); break; } if (!device_open && !current_driver->wave_out_open()) { rdpsnd_send_waveconfirm(tick, packet_index); break; } if (!current_driver->wave_out_set_format(&formats[format])) { rdpsnd_send_waveconfirm(tick, packet_index); current_driver->wave_out_close(); device_open = False; break; } device_open = True; current_format = format; } rdpsnd_queue_write(rdpsnd_dsp_process (s->p, s->end - s->p, current_driver, &formats[current_format]), tick, packet_index); return; break; case SNDC_CLOSE: logger(Sound, Debug, ""rdpsnd_process_packet(), SNDC_CLOSE()""); if (device_open) current_driver->wave_out_close(); device_open = False; break; case SNDC_FORMATS: rdpsnd_process_negotiate(s); break; case SNDC_TRAINING: rdpsnd_process_training(s); break; case SNDC_SETVOLUME: in_uint16_le(s, vol_left); in_uint16_le(s, vol_right); logger(Sound, Debug, ""rdpsnd_process_packet(), SNDC_SETVOLUME(left: 0x%04x (%u %%), right: 0x%04x (%u %%))"", (unsigned) vol_left, (unsigned) vol_left / 655, (unsigned) vol_right, (unsigned) vol_right / 655); if (device_open) current_driver->wave_out_volume(vol_left, vol_right); break; default: logger(Sound, Warning, ""rdpsnd_process_packet(), Unhandled opcode 0x%x"", opcode); break; } } ",0 "static void nf_tables_expr_destroy(const struct nft_ctx *ctx, struct nft_expr *expr) { if (expr->ops->destroy) expr->ops->destroy(ctx, expr); module_put(expr->ops->type->owner); } ",0 "LocalCardMigrationExperimentalFlag GetLocalCardMigrationExperimentalFlag() { if (!base::FeatureList::IsEnabled(kAutofillCreditCardLocalCardMigration)) return LocalCardMigrationExperimentalFlag::kMigrationDisabled; std::string param = base::GetFieldTrialParamValueByFeature( kAutofillCreditCardLocalCardMigration, kAutofillCreditCardLocalCardMigrationParameterName); if (param == kAutofillCreditCardLocalCardMigrationParameterWithoutSettingsPage) { return LocalCardMigrationExperimentalFlag::kMigrationWithoutSettingsPage; } return LocalCardMigrationExperimentalFlag::kMigrationIncludeSettingsPage; } ",0 "CloudPolicySubsystem::CloudPolicySubsystem() : refresh_pref_name_(NULL) {} ",0 "SocketStream::ResponseHeaders::ResponseHeaders() : IOBuffer() {} ",0 "static void ext4_free_io_end(ext4_io_end_t *io) { BUG_ON(!io); iput(io->inode); kfree(io); } ",1 "static apr_status_t reset_banner(void *dummy) { banner_locked = 0; ap_server_tokens = SrvTk_FULL; server_banner = NULL; server_description = NULL; return APR_SUCCESS; } ",0 "nfsd4_putrootfh(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, void *arg) { __be32 status; fh_put(&cstate->current_fh); status = exp_pseudoroot(rqstp, &cstate->current_fh); return status; } ",0 "int MemBackendImpl::DoomEntry(const std::string& key, const CompletionCallback& callback) { EntryMap::iterator it = entries_.find(key); if (it == entries_.end()) return net::ERR_FAILED; it->second->Doom(); return net::OK; } ",0 "void sctp_chunk_assign_ssn(struct sctp_chunk *chunk) { struct sctp_datamsg *msg; struct sctp_chunk *lchunk; struct sctp_stream *stream; __u16 ssn; __u16 sid; if (chunk->has_ssn) return; /* All fragments will be on the same stream */ sid = ntohs(chunk->subh.data_hdr->stream); stream = &chunk->asoc->ssnmap->out; /* Now assign the sequence number to the entire message. * All fragments must have the same stream sequence number. */ msg = chunk->msg; list_for_each_entry(lchunk, &msg->chunks, frag_list) { if (lchunk->chunk_hdr->flags & SCTP_DATA_UNORDERED) { ssn = 0; } else { if (lchunk->chunk_hdr->flags & SCTP_DATA_LAST_FRAG) ssn = sctp_ssn_next(stream, sid); else ssn = sctp_ssn_peek(stream, sid); } lchunk->subh.data_hdr->ssn = htons(ssn); lchunk->has_ssn = 1; } } ",0 "ReportLedBadType(CompatInfo *info, LedInfo *ledi, const char *field, const char *wanted) { return ReportBadType(info->ctx, ""indicator map"", field, xkb_atom_text(info->ctx, ledi->led.name), wanted); } ",0 "ObjectBackedNativeHandler::ObjectBackedNativeHandler(ScriptContext* context) : router_data_(context->isolate()), context_(context), object_template_(context->isolate(), v8::ObjectTemplate::New(context->isolate())) { } ",0 "cupsdReadClient(cupsd_client_t *con) /* I - Client to read from */ { char line[32768], /* Line from client... */ locale[64], /* Locale */ *ptr; /* Pointer into strings */ http_status_t status; /* Transfer status */ ipp_state_t ipp_state; /* State of IPP transfer */ int bytes; /* Number of bytes to POST */ char *filename; /* Name of file for GET/HEAD */ char buf[1024]; /* Buffer for real filename */ struct stat filestats; /* File information */ mime_type_t *type; /* MIME type of file */ cupsd_printer_t *p; /* Printer */ static unsigned request_id = 0; /* Request ID for temp files */ status = HTTP_STATUS_CONTINUE; cupsdLogClient(con, CUPSD_LOG_DEBUG2, ""cupsdReadClient: error=%d, used=%d, state=%s, data_encoding=HTTP_ENCODING_%s, data_remaining="" CUPS_LLFMT "", request=%p(%s), file=%d"", httpError(con->http), (int)httpGetReady(con->http), httpStateString(httpGetState(con->http)), httpIsChunked(con->http) ? ""CHUNKED"" : ""LENGTH"", CUPS_LLCAST httpGetRemaining(con->http), con->request, con->request ? ippStateString(ippGetState(con->request)) : """", con->file); if (httpGetState(con->http) == HTTP_STATE_GET_SEND || httpGetState(con->http) == HTTP_STATE_POST_SEND || httpGetState(con->http) == HTTP_STATE_STATUS) { /* * If we get called in the wrong state, then something went wrong with the * connection and we need to shut it down... */ if (!httpGetReady(con->http) && recv(httpGetFd(con->http), buf, 1, MSG_PEEK) < 1) { /* * Connection closed... */ cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Closing on EOF.""); cupsdCloseClient(con); return; } cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Closing on unexpected HTTP read state %s."", httpStateString(httpGetState(con->http))); cupsdCloseClient(con); return; } #ifdef HAVE_SSL if (con->auto_ssl) { /* * Automatically check for a SSL/TLS handshake... */ con->auto_ssl = 0; if (recv(httpGetFd(con->http), buf, 1, MSG_PEEK) == 1 && (!buf[0] || !strchr(""DGHOPT"", buf[0]))) { /* * Encrypt this connection... */ cupsdLogClient(con, CUPSD_LOG_DEBUG2, ""Saw first byte %02X, auto-negotiating SSL/TLS session."", buf[0] & 255); if (cupsd_start_tls(con, HTTP_ENCRYPTION_ALWAYS)) cupsdCloseClient(con); return; } } #endif /* HAVE_SSL */ switch (httpGetState(con->http)) { case HTTP_STATE_WAITING : /* * See if we've received a request line... */ con->operation = httpReadRequest(con->http, con->uri, sizeof(con->uri)); if (con->operation == HTTP_STATE_ERROR || con->operation == HTTP_STATE_UNKNOWN_METHOD || con->operation == HTTP_STATE_UNKNOWN_VERSION) { if (httpError(con->http)) cupsdLogClient(con, CUPSD_LOG_DEBUG, ""HTTP_STATE_WAITING Closing for error %d (%s)"", httpError(con->http), strerror(httpError(con->http))); else cupsdLogClient(con, CUPSD_LOG_DEBUG, ""HTTP_STATE_WAITING Closing on error: %s"", cupsLastErrorString()); cupsdCloseClient(con); return; } /* * Ignore blank request lines... */ if (con->operation == HTTP_STATE_WAITING) break; /* * Clear other state variables... */ con->bytes = 0; con->file = -1; con->file_ready = 0; con->pipe_pid = 0; con->username[0] = '\0'; con->password[0] = '\0'; cupsdClearString(&con->command); cupsdClearString(&con->options); cupsdClearString(&con->query_string); if (con->request) { ippDelete(con->request); con->request = NULL; } if (con->response) { ippDelete(con->response); con->response = NULL; } if (con->language) { cupsLangFree(con->language); con->language = NULL; } #ifdef HAVE_GSSAPI con->have_gss = 0; con->gss_uid = 0; #endif /* HAVE_GSSAPI */ /* * Handle full URLs in the request line... */ if (strcmp(con->uri, ""*"")) { char scheme[HTTP_MAX_URI], /* Method/scheme */ userpass[HTTP_MAX_URI], /* Username:password */ hostname[HTTP_MAX_URI], /* Hostname */ resource[HTTP_MAX_URI]; /* Resource path */ int port; /* Port number */ /* * Separate the URI into its components... */ if (httpSeparateURI(HTTP_URI_CODING_MOST, con->uri, scheme, sizeof(scheme), userpass, sizeof(userpass), hostname, sizeof(hostname), &port, resource, sizeof(resource)) < HTTP_URI_STATUS_OK) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""Bad URI \""%s\"" in request."", con->uri); cupsdSendError(con, HTTP_STATUS_METHOD_NOT_ALLOWED, CUPSD_AUTH_NONE); cupsdCloseClient(con); return; } /* * Only allow URIs with the servername, localhost, or an IP * address... */ if (strcmp(scheme, ""file"") && _cups_strcasecmp(hostname, ServerName) && _cups_strcasecmp(hostname, ""localhost"") && !cupsArrayFind(ServerAlias, hostname) && !isdigit(hostname[0]) && hostname[0] != '[') { /* * Nope, we don't do proxies... */ cupsdLogClient(con, CUPSD_LOG_ERROR, ""Bad URI \""%s\"" in request."", con->uri); cupsdSendError(con, HTTP_STATUS_METHOD_NOT_ALLOWED, CUPSD_AUTH_NONE); cupsdCloseClient(con); return; } /* * Copy the resource portion back into the URI; both resource and * con->uri are HTTP_MAX_URI bytes in size... */ strlcpy(con->uri, resource, sizeof(con->uri)); } /* * Process the request... */ gettimeofday(&(con->start), NULL); cupsdLogClient(con, CUPSD_LOG_DEBUG, ""%s %s HTTP/%d.%d"", httpStateString(con->operation) + 11, con->uri, httpGetVersion(con->http) / 100, httpGetVersion(con->http) % 100); if (!cupsArrayFind(ActiveClients, con)) { cupsArrayAdd(ActiveClients, con); cupsdSetBusyState(); } case HTTP_STATE_OPTIONS : case HTTP_STATE_DELETE : case HTTP_STATE_GET : case HTTP_STATE_HEAD : case HTTP_STATE_POST : case HTTP_STATE_PUT : case HTTP_STATE_TRACE : /* * Parse incoming parameters until the status changes... */ while ((status = httpUpdate(con->http)) == HTTP_STATUS_CONTINUE) if (!httpGetReady(con->http)) break; if (status != HTTP_STATUS_OK && status != HTTP_STATUS_CONTINUE) { if (httpError(con->http) && httpError(con->http) != EPIPE) cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Closing for error %d (%s) while reading headers."", httpError(con->http), strerror(httpError(con->http))); else cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Closing on EOF while reading headers.""); cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE); cupsdCloseClient(con); return; } break; default : if (!httpGetReady(con->http) && recv(httpGetFd(con->http), buf, 1, MSG_PEEK) < 1) { /* * Connection closed... */ cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Closing on EOF.""); cupsdCloseClient(con); return; } break; /* Anti-compiler-warning-code */ } /* * Handle new transfers... */ cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Read: status=%d"", status); if (status == HTTP_STATUS_OK) { if (httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE)[0]) { /* * Figure out the locale from the Accept-Language and Content-Type * fields... */ if ((ptr = strchr(httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE), ',')) != NULL) *ptr = '\0'; if ((ptr = strchr(httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE), ';')) != NULL) *ptr = '\0'; if ((ptr = strstr(httpGetField(con->http, HTTP_FIELD_CONTENT_TYPE), ""charset="")) != NULL) { /* * Combine language and charset, and trim any extra params in the * content-type. */ snprintf(locale, sizeof(locale), ""%s.%s"", httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE), ptr + 8); if ((ptr = strchr(locale, ',')) != NULL) *ptr = '\0'; } else snprintf(locale, sizeof(locale), ""%s.UTF-8"", httpGetField(con->http, HTTP_FIELD_ACCEPT_LANGUAGE)); con->language = cupsLangGet(locale); } else con->language = cupsLangGet(DefaultLocale); cupsdAuthorize(con); if (!_cups_strncasecmp(httpGetField(con->http, HTTP_FIELD_CONNECTION), ""Keep-Alive"", 10) && KeepAlive) httpSetKeepAlive(con->http, HTTP_KEEPALIVE_ON); else if (!_cups_strncasecmp(httpGetField(con->http, HTTP_FIELD_CONNECTION), ""close"", 5)) httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF); if (!httpGetField(con->http, HTTP_FIELD_HOST)[0] && httpGetVersion(con->http) >= HTTP_VERSION_1_1) { /* * HTTP/1.1 and higher require the ""Host:"" field... */ if (!cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE)) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""Missing Host: field in request.""); cupsdCloseClient(con); return; } } else if (!valid_host(con)) { /* * Access to localhost must use ""localhost"" or the corresponding IPv4 * or IPv6 values in the Host: field. */ cupsdLogClient(con, CUPSD_LOG_ERROR, ""Request from \""%s\"" using invalid Host: field \""%s\""."", httpGetHostname(con->http, NULL, 0), httpGetField(con->http, HTTP_FIELD_HOST)); if (!cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } else if (con->operation == HTTP_STATE_OPTIONS) { /* * Do OPTIONS command... */ if (con->best && con->best->type != CUPSD_AUTH_NONE) { httpClearFields(con->http); if (!cupsdSendHeader(con, HTTP_STATUS_UNAUTHORIZED, NULL, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } if (!_cups_strcasecmp(httpGetField(con->http, HTTP_FIELD_CONNECTION), ""Upgrade"") && strstr(httpGetField(con->http, HTTP_FIELD_UPGRADE), ""TLS/"") != NULL && !httpIsEncrypted(con->http)) { #ifdef HAVE_SSL /* * Do encryption stuff... */ httpClearFields(con->http); if (!cupsdSendHeader(con, HTTP_STATUS_SWITCHING_PROTOCOLS, NULL, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } if (cupsd_start_tls(con, HTTP_ENCRYPTION_REQUIRED)) { cupsdCloseClient(con); return; } #else if (!cupsdSendError(con, HTTP_STATUS_NOT_IMPLEMENTED, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } #endif /* HAVE_SSL */ } httpClearFields(con->http); httpSetField(con->http, HTTP_FIELD_ALLOW, ""GET, HEAD, OPTIONS, POST, PUT""); httpSetField(con->http, HTTP_FIELD_CONTENT_LENGTH, ""0""); if (!cupsdSendHeader(con, HTTP_STATUS_OK, NULL, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } else if (!is_path_absolute(con->uri)) { /* * Protect against malicious users! */ cupsdLogClient(con, CUPSD_LOG_ERROR, ""Request for non-absolute resource \""%s\""."", con->uri); if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } else { if (!_cups_strcasecmp(httpGetField(con->http, HTTP_FIELD_CONNECTION), ""Upgrade"") && !httpIsEncrypted(con->http)) { #ifdef HAVE_SSL /* * Do encryption stuff... */ httpClearFields(con->http); if (!cupsdSendHeader(con, HTTP_STATUS_SWITCHING_PROTOCOLS, NULL, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } if (cupsd_start_tls(con, HTTP_ENCRYPTION_REQUIRED)) { cupsdCloseClient(con); return; } #else if (!cupsdSendError(con, HTTP_STATUS_NOT_IMPLEMENTED, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } #endif /* HAVE_SSL */ } if ((status = cupsdIsAuthorized(con, NULL)) != HTTP_STATUS_OK) { cupsdSendError(con, status, CUPSD_AUTH_NONE); cupsdCloseClient(con); return; } if (httpGetExpect(con->http) && (con->operation == HTTP_STATE_POST || con->operation == HTTP_STATE_PUT)) { if (httpGetExpect(con->http) == HTTP_STATUS_CONTINUE) { /* * Send 100-continue header... */ if (httpWriteResponse(con->http, HTTP_STATUS_CONTINUE)) { cupsdCloseClient(con); return; } } else { /* * Send 417-expectation-failed header... */ httpClearFields(con->http); httpSetField(con->http, HTTP_FIELD_CONTENT_LENGTH, ""0""); cupsdSendError(con, HTTP_STATUS_EXPECTATION_FAILED, CUPSD_AUTH_NONE); cupsdCloseClient(con); return; } } switch (httpGetState(con->http)) { case HTTP_STATE_GET_SEND : cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Processing GET %s"", con->uri); if ((!strncmp(con->uri, ""/ppd/"", 5) || !strncmp(con->uri, ""/printers/"", 10) || !strncmp(con->uri, ""/classes/"", 9)) && !strcmp(con->uri + strlen(con->uri) - 4, "".ppd"")) { /* * Send PPD file - get the real printer name since printer * names are not case sensitive but filenames can be... */ con->uri[strlen(con->uri) - 4] = '\0'; /* Drop "".ppd"" */ if (!strncmp(con->uri, ""/ppd/"", 5)) p = cupsdFindPrinter(con->uri + 5); else if (!strncmp(con->uri, ""/printers/"", 10)) p = cupsdFindPrinter(con->uri + 10); else { p = cupsdFindClass(con->uri + 9); if (p) { int i; /* Looping var */ for (i = 0; i < p->num_printers; i ++) { if (!(p->printers[i]->type & CUPS_PRINTER_CLASS)) { char ppdname[1024];/* PPD filename */ snprintf(ppdname, sizeof(ppdname), ""%s/ppd/%s.ppd"", ServerRoot, p->printers[i]->name); if (!access(ppdname, 0)) { p = p->printers[i]; break; } } } if (i >= p->num_printers) p = NULL; } } if (p) { snprintf(con->uri, sizeof(con->uri), ""/ppd/%s.ppd"", p->name); } else { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } } else if ((!strncmp(con->uri, ""/icons/"", 7) || !strncmp(con->uri, ""/printers/"", 10) || !strncmp(con->uri, ""/classes/"", 9)) && !strcmp(con->uri + strlen(con->uri) - 4, "".png"")) { /* * Send icon file - get the real queue name since queue names are * not case sensitive but filenames can be... */ con->uri[strlen(con->uri) - 4] = '\0'; /* Drop "".png"" */ if (!strncmp(con->uri, ""/icons/"", 7)) p = cupsdFindPrinter(con->uri + 7); else if (!strncmp(con->uri, ""/printers/"", 10)) p = cupsdFindPrinter(con->uri + 10); else { p = cupsdFindClass(con->uri + 9); if (p) { int i; /* Looping var */ for (i = 0; i < p->num_printers; i ++) { if (!(p->printers[i]->type & CUPS_PRINTER_CLASS)) { char ppdname[1024];/* PPD filename */ snprintf(ppdname, sizeof(ppdname), ""%s/ppd/%s.ppd"", ServerRoot, p->printers[i]->name); if (!access(ppdname, 0)) { p = p->printers[i]; break; } } } if (i >= p->num_printers) p = NULL; } } if (p) snprintf(con->uri, sizeof(con->uri), ""/icons/%s.png"", p->name); else { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } } if ((!strncmp(con->uri, ""/admin"", 6) && strcmp(con->uri, ""/admin/conf/cupsd.conf"") && strncmp(con->uri, ""/admin/log/"", 11)) || !strncmp(con->uri, ""/printers"", 9) || !strncmp(con->uri, ""/classes"", 8) || !strncmp(con->uri, ""/help"", 5) || !strncmp(con->uri, ""/jobs"", 5)) { if (!WebInterface) { /* * Web interface is disabled. Show an appropriate message... */ if (!cupsdSendError(con, HTTP_STATUS_CUPS_WEBIF_DISABLED, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } /* * Send CGI output... */ if (!strncmp(con->uri, ""/admin"", 6)) { cupsdSetStringf(&con->command, ""%s/cgi-bin/admin.cgi"", ServerBin); cupsdSetString(&con->options, strchr(con->uri + 6, '?')); } else if (!strncmp(con->uri, ""/printers"", 9)) { cupsdSetStringf(&con->command, ""%s/cgi-bin/printers.cgi"", ServerBin); if (con->uri[9] && con->uri[10]) cupsdSetString(&con->options, con->uri + 9); else cupsdSetString(&con->options, NULL); } else if (!strncmp(con->uri, ""/classes"", 8)) { cupsdSetStringf(&con->command, ""%s/cgi-bin/classes.cgi"", ServerBin); if (con->uri[8] && con->uri[9]) cupsdSetString(&con->options, con->uri + 8); else cupsdSetString(&con->options, NULL); } else if (!strncmp(con->uri, ""/jobs"", 5)) { cupsdSetStringf(&con->command, ""%s/cgi-bin/jobs.cgi"", ServerBin); if (con->uri[5] && con->uri[6]) cupsdSetString(&con->options, con->uri + 5); else cupsdSetString(&con->options, NULL); } else { cupsdSetStringf(&con->command, ""%s/cgi-bin/help.cgi"", ServerBin); if (con->uri[5] && con->uri[6]) cupsdSetString(&con->options, con->uri + 5); else cupsdSetString(&con->options, NULL); } if (!cupsdSendCommand(con, con->command, con->options, 0)) { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } else cupsdLogRequest(con, HTTP_STATUS_OK); if (httpGetVersion(con->http) <= HTTP_VERSION_1_0) httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF); } else if (!strncmp(con->uri, ""/admin/log/"", 11) && (strchr(con->uri + 11, '/') || strlen(con->uri) == 11)) { /* * GET can only be done to configuration files directly under * /admin/conf... */ cupsdLogClient(con, CUPSD_LOG_ERROR, ""Request for subdirectory \""%s\""."", con->uri); if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } else { /* * Serve a file... */ if ((filename = get_file(con, &filestats, buf, sizeof(buf))) == NULL) { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } type = mimeFileType(MimeDatabase, filename, NULL, NULL); cupsdLogClient(con, CUPSD_LOG_DEBUG, ""filename=\""%s\"", type=%s/%s"", filename, type ? type->super : """", type ? type->type : """"); if (is_cgi(con, filename, &filestats, type)) { /* * Note: con->command and con->options were set by * is_cgi()... */ if (!cupsdSendCommand(con, con->command, con->options, 0)) { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } else cupsdLogRequest(con, HTTP_STATUS_OK); if (httpGetVersion(con->http) <= HTTP_VERSION_1_0) httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF); break; } if (!check_if_modified(con, &filestats)) { if (!cupsdSendError(con, HTTP_STATUS_NOT_MODIFIED, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } else { if (type == NULL) strlcpy(line, ""text/plain"", sizeof(line)); else snprintf(line, sizeof(line), ""%s/%s"", type->super, type->type); if (!write_file(con, HTTP_STATUS_OK, filename, line, &filestats)) { cupsdCloseClient(con); return; } } } break; case HTTP_STATE_POST_RECV : /* * See if the POST request includes a Content-Length field, and if * so check the length against any limits that are set... */ if (httpGetField(con->http, HTTP_FIELD_CONTENT_LENGTH)[0] && MaxRequestSize > 0 && httpGetLength2(con->http) > MaxRequestSize) { /* * Request too large... */ if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } else if (httpGetLength2(con->http) < 0) { /* * Negative content lengths are invalid! */ if (!cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } /* * See what kind of POST request this is; for IPP requests the * content-type field will be ""application/ipp""... */ if (!strcmp(httpGetField(con->http, HTTP_FIELD_CONTENT_TYPE), ""application/ipp"")) con->request = ippNew(); else if (!WebInterface) { /* * Web interface is disabled. Show an appropriate message... */ if (!cupsdSendError(con, HTTP_STATUS_CUPS_WEBIF_DISABLED, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } else if ((!strncmp(con->uri, ""/admin"", 6) && strncmp(con->uri, ""/admin/log/"", 11)) || !strncmp(con->uri, ""/printers"", 9) || !strncmp(con->uri, ""/classes"", 8) || !strncmp(con->uri, ""/help"", 5) || !strncmp(con->uri, ""/jobs"", 5)) { /* * CGI request... */ if (!strncmp(con->uri, ""/admin"", 6)) { cupsdSetStringf(&con->command, ""%s/cgi-bin/admin.cgi"", ServerBin); cupsdSetString(&con->options, strchr(con->uri + 6, '?')); } else if (!strncmp(con->uri, ""/printers"", 9)) { cupsdSetStringf(&con->command, ""%s/cgi-bin/printers.cgi"", ServerBin); if (con->uri[9] && con->uri[10]) cupsdSetString(&con->options, con->uri + 9); else cupsdSetString(&con->options, NULL); } else if (!strncmp(con->uri, ""/classes"", 8)) { cupsdSetStringf(&con->command, ""%s/cgi-bin/classes.cgi"", ServerBin); if (con->uri[8] && con->uri[9]) cupsdSetString(&con->options, con->uri + 8); else cupsdSetString(&con->options, NULL); } else if (!strncmp(con->uri, ""/jobs"", 5)) { cupsdSetStringf(&con->command, ""%s/cgi-bin/jobs.cgi"", ServerBin); if (con->uri[5] && con->uri[6]) cupsdSetString(&con->options, con->uri + 5); else cupsdSetString(&con->options, NULL); } else { cupsdSetStringf(&con->command, ""%s/cgi-bin/help.cgi"", ServerBin); if (con->uri[5] && con->uri[6]) cupsdSetString(&con->options, con->uri + 5); else cupsdSetString(&con->options, NULL); } if (httpGetVersion(con->http) <= HTTP_VERSION_1_0) httpSetKeepAlive(con->http, HTTP_KEEPALIVE_OFF); } else { /* * POST to a file... */ if ((filename = get_file(con, &filestats, buf, sizeof(buf))) == NULL) { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } type = mimeFileType(MimeDatabase, filename, NULL, NULL); if (!is_cgi(con, filename, &filestats, type)) { /* * Only POST to CGI's... */ if (!cupsdSendError(con, HTTP_STATUS_UNAUTHORIZED, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } } break; case HTTP_STATE_PUT_RECV : /* * Validate the resource name... */ if (strcmp(con->uri, ""/admin/conf/cupsd.conf"")) { /* * PUT can only be done to the cupsd.conf file... */ cupsdLogClient(con, CUPSD_LOG_ERROR, ""Disallowed PUT request for \""%s\""."", con->uri); if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } /* * See if the PUT request includes a Content-Length field, and if * so check the length against any limits that are set... */ if (httpGetField(con->http, HTTP_FIELD_CONTENT_LENGTH)[0] && MaxRequestSize > 0 && httpGetLength2(con->http) > MaxRequestSize) { /* * Request too large... */ if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } else if (httpGetLength2(con->http) < 0) { /* * Negative content lengths are invalid! */ if (!cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } break; } /* * Open a temporary file to hold the request... */ cupsdSetStringf(&con->filename, ""%s/%08x"", RequestRoot, request_id ++); con->file = open(con->filename, O_WRONLY | O_CREAT | O_TRUNC, 0640); if (con->file < 0) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""Unable to create request file \""%s\"": %s"", con->filename, strerror(errno)); if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } fchmod(con->file, 0640); fchown(con->file, RunUser, Group); fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC); break; case HTTP_STATE_DELETE : case HTTP_STATE_TRACE : cupsdSendError(con, HTTP_STATUS_NOT_IMPLEMENTED, CUPSD_AUTH_NONE); cupsdCloseClient(con); return; case HTTP_STATE_HEAD : if (!strncmp(con->uri, ""/printers/"", 10) && !strcmp(con->uri + strlen(con->uri) - 4, "".ppd"")) { /* * Send PPD file - get the real printer name since printer * names are not case sensitive but filenames can be... */ con->uri[strlen(con->uri) - 4] = '\0'; /* Drop "".ppd"" */ if ((p = cupsdFindPrinter(con->uri + 10)) != NULL) snprintf(con->uri, sizeof(con->uri), ""/ppd/%s.ppd"", p->name); else { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } cupsdLogRequest(con, HTTP_STATUS_NOT_FOUND); break; } } else if (!strncmp(con->uri, ""/printers/"", 10) && !strcmp(con->uri + strlen(con->uri) - 4, "".png"")) { /* * Send PNG file - get the real printer name since printer * names are not case sensitive but filenames can be... */ con->uri[strlen(con->uri) - 4] = '\0'; /* Drop "".ppd"" */ if ((p = cupsdFindPrinter(con->uri + 10)) != NULL) snprintf(con->uri, sizeof(con->uri), ""/icons/%s.png"", p->name); else { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } cupsdLogRequest(con, HTTP_STATUS_NOT_FOUND); break; } } else if (!WebInterface) { httpClearFields(con->http); if (!cupsdSendHeader(con, HTTP_STATUS_OK, NULL, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } cupsdLogRequest(con, HTTP_STATUS_OK); break; } if ((!strncmp(con->uri, ""/admin"", 6) && strcmp(con->uri, ""/admin/conf/cupsd.conf"") && strncmp(con->uri, ""/admin/log/"", 11)) || !strncmp(con->uri, ""/printers"", 9) || !strncmp(con->uri, ""/classes"", 8) || !strncmp(con->uri, ""/help"", 5) || !strncmp(con->uri, ""/jobs"", 5)) { /* * CGI output... */ httpClearFields(con->http); if (!cupsdSendHeader(con, HTTP_STATUS_OK, ""text/html"", CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } cupsdLogRequest(con, HTTP_STATUS_OK); } else if (!strncmp(con->uri, ""/admin/log/"", 11) && (strchr(con->uri + 11, '/') || strlen(con->uri) == 11)) { /* * HEAD can only be done to configuration files under * /admin/conf... */ cupsdLogClient(con, CUPSD_LOG_ERROR, ""Request for subdirectory \""%s\""."", con->uri); if (!cupsdSendError(con, HTTP_STATUS_FORBIDDEN, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } cupsdLogRequest(con, HTTP_STATUS_FORBIDDEN); break; } else if ((filename = get_file(con, &filestats, buf, sizeof(buf))) == NULL) { httpClearFields(con->http); if (!cupsdSendHeader(con, HTTP_STATUS_NOT_FOUND, ""text/html"", CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } cupsdLogRequest(con, HTTP_STATUS_NOT_FOUND); } else if (!check_if_modified(con, &filestats)) { if (!cupsdSendError(con, HTTP_STATUS_NOT_MODIFIED, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } cupsdLogRequest(con, HTTP_STATUS_NOT_MODIFIED); } else { /* * Serve a file... */ type = mimeFileType(MimeDatabase, filename, NULL, NULL); if (type == NULL) strlcpy(line, ""text/plain"", sizeof(line)); else snprintf(line, sizeof(line), ""%s/%s"", type->super, type->type); httpClearFields(con->http); httpSetField(con->http, HTTP_FIELD_LAST_MODIFIED, httpGetDateString(filestats.st_mtime)); httpSetLength(con->http, (size_t)filestats.st_size); if (!cupsdSendHeader(con, HTTP_STATUS_OK, line, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } cupsdLogRequest(con, HTTP_STATUS_OK); } break; default : break; /* Anti-compiler-warning-code */ } } } /* * Handle any incoming data... */ switch (httpGetState(con->http)) { case HTTP_STATE_PUT_RECV : do { if ((bytes = httpRead2(con->http, line, sizeof(line))) < 0) { if (httpError(con->http) && httpError(con->http) != EPIPE) cupsdLogClient(con, CUPSD_LOG_DEBUG, ""HTTP_STATE_PUT_RECV Closing for error %d (%s)"", httpError(con->http), strerror(httpError(con->http))); else cupsdLogClient(con, CUPSD_LOG_DEBUG, ""HTTP_STATE_PUT_RECV Closing on EOF.""); cupsdCloseClient(con); return; } else if (bytes > 0) { con->bytes += bytes; if (MaxRequestSize > 0 && con->bytes > MaxRequestSize) { close(con->file); con->file = -1; unlink(con->filename); cupsdClearString(&con->filename); if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } if (write(con->file, line, (size_t)bytes) < bytes) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""Unable to write %d bytes to \""%s\"": %s"", bytes, con->filename, strerror(errno)); close(con->file); con->file = -1; unlink(con->filename); cupsdClearString(&con->filename); if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } } else if (httpGetState(con->http) == HTTP_STATE_PUT_RECV) { cupsdCloseClient(con); return; } } while (httpGetState(con->http) == HTTP_STATE_PUT_RECV && httpGetReady(con->http)); if (httpGetState(con->http) == HTTP_STATE_STATUS) { /* * End of file, see how big it is... */ fstat(con->file, &filestats); close(con->file); con->file = -1; if (filestats.st_size > MaxRequestSize && MaxRequestSize > 0) { /* * Request is too big; remove it and send an error... */ unlink(con->filename); cupsdClearString(&con->filename); if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } /* * Install the configuration file... */ status = install_cupsd_conf(con); /* * Return the status to the client... */ if (!cupsdSendError(con, status, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } break; case HTTP_STATE_POST_RECV : do { if (con->request && con->file < 0) { /* * Grab any request data from the connection... */ if (!httpWait(con->http, 0)) return; if ((ipp_state = ippRead(con->http, con->request)) == IPP_STATE_ERROR) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""IPP read error: %s"", cupsLastErrorString()); cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE); cupsdCloseClient(con); return; } else if (ipp_state != IPP_STATE_DATA) { if (httpGetState(con->http) == HTTP_STATE_POST_SEND) { cupsdSendError(con, HTTP_STATUS_BAD_REQUEST, CUPSD_AUTH_NONE); cupsdCloseClient(con); return; } if (httpGetReady(con->http)) continue; break; } else { cupsdLogClient(con, CUPSD_LOG_DEBUG, ""%d.%d %s %d"", con->request->request.op.version[0], con->request->request.op.version[1], ippOpString(con->request->request.op.operation_id), con->request->request.op.request_id); con->bytes += (off_t)ippLength(con->request); } } if (con->file < 0 && httpGetState(con->http) != HTTP_STATE_POST_SEND) { /* * Create a file as needed for the request data... */ cupsdSetStringf(&con->filename, ""%s/%08x"", RequestRoot, request_id ++); con->file = open(con->filename, O_WRONLY | O_CREAT | O_TRUNC, 0640); if (con->file < 0) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""Unable to create request file \""%s\"": %s"", con->filename, strerror(errno)); if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } fchmod(con->file, 0640); fchown(con->file, RunUser, Group); fcntl(con->file, F_SETFD, fcntl(con->file, F_GETFD) | FD_CLOEXEC); } if (httpGetState(con->http) != HTTP_STATE_POST_SEND) { if (!httpWait(con->http, 0)) return; else if ((bytes = httpRead2(con->http, line, sizeof(line))) < 0) { if (httpError(con->http) && httpError(con->http) != EPIPE) cupsdLogClient(con, CUPSD_LOG_DEBUG, ""HTTP_STATE_POST_SEND Closing for error %d (%s)"", httpError(con->http), strerror(httpError(con->http))); else cupsdLogClient(con, CUPSD_LOG_DEBUG, ""HTTP_STATE_POST_SEND Closing on EOF.""); cupsdCloseClient(con); return; } else if (bytes > 0) { con->bytes += bytes; if (MaxRequestSize > 0 && con->bytes > MaxRequestSize) { close(con->file); con->file = -1; unlink(con->filename); cupsdClearString(&con->filename); if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } if (write(con->file, line, (size_t)bytes) < bytes) { cupsdLogClient(con, CUPSD_LOG_ERROR, ""Unable to write %d bytes to \""%s\"": %s"", bytes, con->filename, strerror(errno)); close(con->file); con->file = -1; unlink(con->filename); cupsdClearString(&con->filename); if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } } else if (httpGetState(con->http) == HTTP_STATE_POST_RECV) return; else if (httpGetState(con->http) != HTTP_STATE_POST_SEND) { cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Closing on unexpected state %s."", httpStateString(httpGetState(con->http))); cupsdCloseClient(con); return; } } } while (httpGetState(con->http) == HTTP_STATE_POST_RECV && httpGetReady(con->http)); if (httpGetState(con->http) == HTTP_STATE_POST_SEND) { if (con->file >= 0) { fstat(con->file, &filestats); close(con->file); con->file = -1; if (filestats.st_size > MaxRequestSize && MaxRequestSize > 0) { /* * Request is too big; remove it and send an error... */ unlink(con->filename); cupsdClearString(&con->filename); if (con->request) { /* * Delete any IPP request data... */ ippDelete(con->request); con->request = NULL; } if (!cupsdSendError(con, HTTP_STATUS_REQUEST_TOO_LARGE, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } else if (filestats.st_size == 0) { /* * Don't allow empty file... */ unlink(con->filename); cupsdClearString(&con->filename); } if (con->command) { if (!cupsdSendCommand(con, con->command, con->options, 0)) { if (!cupsdSendError(con, HTTP_STATUS_NOT_FOUND, CUPSD_AUTH_NONE)) { cupsdCloseClient(con); return; } } else cupsdLogRequest(con, HTTP_STATUS_OK); } } if (con->request) { cupsdProcessIPPRequest(con); if (con->filename) { unlink(con->filename); cupsdClearString(&con->filename); } return; } } break; default : break; /* Anti-compiler-warning-code */ } if (httpGetState(con->http) == HTTP_STATE_WAITING) { if (!httpGetKeepAlive(con->http)) { cupsdLogClient(con, CUPSD_LOG_DEBUG, ""Closing because Keep-Alive is disabled.""); cupsdCloseClient(con); } else { cupsArrayRemove(ActiveClients, con); cupsdSetBusyState(); } } } ",0 "bool IsNameType(const AutofillField& field) { return field.Type().group() == NAME || field.Type().group() == NAME_BILLING || field.Type().GetStorableType() == CREDIT_CARD_NAME_FULL || field.Type().GetStorableType() == CREDIT_CARD_NAME_FIRST || field.Type().GetStorableType() == CREDIT_CARD_NAME_LAST; } ",0 " ActionBoxTest() {} ",0 "SYSCALL_DEFINE4(rt_sigtimedwait, const sigset_t __user *, uthese, siginfo_t __user *, uinfo, const struct timespec __user *, uts, size_t, sigsetsize) { sigset_t these; struct timespec ts; siginfo_t info; int ret; /* XXX: Don't preclude handling different sized sigset_t's. */ if (sigsetsize != sizeof(sigset_t)) return -EINVAL; if (copy_from_user(&these, uthese, sizeof(these))) return -EFAULT; if (uts) { if (copy_from_user(&ts, uts, sizeof(ts))) return -EFAULT; } ret = do_sigtimedwait(&these, &info, uts ? &ts : NULL); if (ret > 0 && uinfo) { if (copy_siginfo_to_user(uinfo, &info)) ret = -EFAULT; } return ret; } ",0 "bool Editor::findString(const String& target, FindOptions options) { VisibleSelection selection = frame().selection().computeVisibleSelectionInDOMTreeDeprecated(); Range* resultRange = findRangeOfString( target, EphemeralRange(selection.start(), selection.end()), static_cast(options | FindAPICall)); if (!resultRange) return false; frame().selection().setSelection( SelectionInDOMTree::Builder() .setBaseAndExtent(EphemeralRange(resultRange)) .build()); frame().selection().revealSelection(); return true; } ",0 "static ssize_t driver_override_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct platform_device *pdev = to_platform_device(dev); char *driver_override, *old = pdev->driver_override, *cp; if (count > PATH_MAX) return -EINVAL; driver_override = kstrndup(buf, count, GFP_KERNEL); if (!driver_override) return -ENOMEM; cp = strchr(driver_override, '\n'); if (cp) *cp = '\0'; if (strlen(driver_override)) { pdev->driver_override = driver_override; } else { kfree(driver_override); pdev->driver_override = NULL; } kfree(old); return count; } ",1 " AudioInputStreamPtr CreateAudioInput() { AudioInputStreamPtr p; ExpectDelegateCreation(); impl_ = std::make_unique( mojo::MakeRequest(&p), std::move(client_ptr_), base::BindOnce(&MockDelegateFactory::CreateDelegate, base::Unretained(&mock_delegate_factory_)), base::BindOnce(&MockClient::Initialized, base::Unretained(&client_)), base::BindOnce(&MockDeleter::Finished, base::Unretained(&deleter_))); EXPECT_TRUE(p.is_bound()); return p; } ",0 " AudioRendererImplTest() {} ",0 "ATSParser::ATSParser(uint32_t flags) : mFlags(flags), mAbsoluteTimeAnchorUs(-1ll), mTimeOffsetValid(false), mTimeOffsetUs(0ll), mLastRecoveredPTS(-1ll), mNumTSPacketsParsed(0), mNumPCRs(0) { mPSISections.add(0 /* PID */, new PSISection); } ",0 "int kvm_clear_dirty_log_protect(struct kvm *kvm, struct kvm_clear_dirty_log *log, bool *flush) { struct kvm_memslots *slots; struct kvm_memory_slot *memslot; int as_id, id; gfn_t offset; unsigned long i, n; unsigned long *dirty_bitmap; unsigned long *dirty_bitmap_buffer; as_id = log->slot >> 16; id = (u16)log->slot; if (as_id >= KVM_ADDRESS_SPACE_NUM || id >= KVM_USER_MEM_SLOTS) return -EINVAL; if ((log->first_page & 63) || (log->num_pages & 63)) return -EINVAL; slots = __kvm_memslots(kvm, as_id); memslot = id_to_memslot(slots, id); dirty_bitmap = memslot->dirty_bitmap; if (!dirty_bitmap) return -ENOENT; n = kvm_dirty_bitmap_bytes(memslot); if (log->first_page > memslot->npages || log->num_pages > memslot->npages - log->first_page) return -EINVAL; *flush = false; dirty_bitmap_buffer = kvm_second_dirty_bitmap(memslot); if (copy_from_user(dirty_bitmap_buffer, log->dirty_bitmap, n)) return -EFAULT; spin_lock(&kvm->mmu_lock); for (offset = log->first_page, i = offset / BITS_PER_LONG, n = log->num_pages / BITS_PER_LONG; n--; i++, offset += BITS_PER_LONG) { unsigned long mask = *dirty_bitmap_buffer++; atomic_long_t *p = (atomic_long_t *) &dirty_bitmap[i]; if (!mask) continue; mask &= atomic_long_fetch_andnot(mask, p); /* * mask contains the bits that really have been cleared. This * never includes any bits beyond the length of the memslot (if * the length is not aligned to 64 pages), therefore it is not * a problem if userspace sets them in log->dirty_bitmap. */ if (mask) { *flush = true; kvm_arch_mmu_enable_log_dirty_pt_masked(kvm, memslot, offset, mask); } } spin_unlock(&kvm->mmu_lock); return 0; } ",0 "static int __ext4_get_inode_loc(struct inode *inode, struct ext4_iloc *iloc, int in_mem) { struct ext4_group_desc *gdp; struct buffer_head *bh; struct super_block *sb = inode->i_sb; ext4_fsblk_t block; int inodes_per_block, inode_offset; iloc->bh = NULL; if (!ext4_valid_inum(sb, inode->i_ino)) return -EFSCORRUPTED; iloc->block_group = (inode->i_ino - 1) / EXT4_INODES_PER_GROUP(sb); gdp = ext4_get_group_desc(sb, iloc->block_group, NULL); if (!gdp) return -EIO; /* * Figure out the offset within the block group inode table */ inodes_per_block = EXT4_SB(sb)->s_inodes_per_block; inode_offset = ((inode->i_ino - 1) % EXT4_INODES_PER_GROUP(sb)); block = ext4_inode_table(sb, gdp) + (inode_offset / inodes_per_block); iloc->offset = (inode_offset % inodes_per_block) * EXT4_INODE_SIZE(sb); bh = sb_getblk(sb, block); if (unlikely(!bh)) return -ENOMEM; if (!buffer_uptodate(bh)) { lock_buffer(bh); /* * If the buffer has the write error flag, we have failed * to write out another inode in the same block. In this * case, we don't have to read the block because we may * read the old inode data successfully. */ if (buffer_write_io_error(bh) && !buffer_uptodate(bh)) set_buffer_uptodate(bh); if (buffer_uptodate(bh)) { /* someone brought it uptodate while we waited */ unlock_buffer(bh); goto has_buffer; } /* * If we have all information of the inode in memory and this * is the only valid inode in the block, we need not read the * block. */ if (in_mem) { struct buffer_head *bitmap_bh; int i, start; start = inode_offset & ~(inodes_per_block - 1); /* Is the inode bitmap in cache? */ bitmap_bh = sb_getblk(sb, ext4_inode_bitmap(sb, gdp)); if (unlikely(!bitmap_bh)) goto make_io; /* * If the inode bitmap isn't in cache then the * optimisation may end up performing two reads instead * of one, so skip it. */ if (!buffer_uptodate(bitmap_bh)) { brelse(bitmap_bh); goto make_io; } for (i = start; i < start + inodes_per_block; i++) { if (i == inode_offset) continue; if (ext4_test_bit(i, bitmap_bh->b_data)) break; } brelse(bitmap_bh); if (i == start + inodes_per_block) { /* all other inodes are free, so skip I/O */ memset(bh->b_data, 0, bh->b_size); set_buffer_uptodate(bh); unlock_buffer(bh); goto has_buffer; } } make_io: /* * If we need to do any I/O, try to pre-readahead extra * blocks from the inode table. */ if (EXT4_SB(sb)->s_inode_readahead_blks) { ext4_fsblk_t b, end, table; unsigned num; __u32 ra_blks = EXT4_SB(sb)->s_inode_readahead_blks; table = ext4_inode_table(sb, gdp); /* s_inode_readahead_blks is always a power of 2 */ b = block & ~((ext4_fsblk_t) ra_blks - 1); if (table > b) b = table; end = b + ra_blks; num = EXT4_INODES_PER_GROUP(sb); if (ext4_has_group_desc_csum(sb)) num -= ext4_itable_unused_count(sb, gdp); table += num / inodes_per_block; if (end > table) end = table; while (b <= end) sb_breadahead(sb, b++); } /* * There are other valid inodes in the buffer, this inode * has in-inode xattrs, or we don't have this inode in memory. * Read the block from disk. */ trace_ext4_load_inode(inode); get_bh(bh); bh->b_end_io = end_buffer_read_sync; submit_bh(READ | REQ_META | REQ_PRIO, bh); wait_on_buffer(bh); if (!buffer_uptodate(bh)) { EXT4_ERROR_INODE_BLOCK(inode, block, ""unable to read itable block""); brelse(bh); return -EIO; } } has_buffer: iloc->bh = bh; return 0; } ",0 "ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht) { begin_write(ht); zend_hash_graceful_destroy(TS_HASH(ht)); end_write(ht); #ifdef ZTS tsrm_mutex_free(ht->mx_reader); tsrm_mutex_free(ht->mx_reader); #endif } ",1 "void PageInfoBubbleView::SetPermissionInfo( const PermissionInfoList& permission_info_list, ChosenObjectInfoList chosen_object_info_list) { if (permissions_view_->has_children()) return; GridLayout* layout = GridLayout::CreateAndInstall(permissions_view_); ChromeLayoutProvider* layout_provider = ChromeLayoutProvider::Get(); const int list_item_padding = layout_provider->GetDistanceMetric(DISTANCE_CONTROL_LIST_VERTICAL); if (!permission_info_list.empty() || !chosen_object_info_list.empty()) { layout->AddPaddingRow(0, list_item_padding); } else { layout->AddPaddingRow(0, layout_provider->GetDistanceMetric( views::DISTANCE_UNRELATED_CONTROL_VERTICAL)); return; } constexpr float kFixed = 0.f; constexpr float kStretchy = 1.f; int side_margin = layout_provider->GetInsetsMetric(views::INSETS_DIALOG).left(); views::ColumnSet* permissions_set = layout->AddColumnSet(kPermissionColumnSetId); permissions_set->AddPaddingColumn(kFixed, side_margin); permissions_set->AddColumn(GridLayout::CENTER, GridLayout::CENTER, kFixed, GridLayout::FIXED, kIconColumnWidth, 0); permissions_set->AddPaddingColumn( kFixed, layout_provider->GetDistanceMetric( views::DISTANCE_RELATED_LABEL_HORIZONTAL)); permissions_set->AddColumn(GridLayout::LEADING, GridLayout::CENTER, kFixed, GridLayout::USE_PREF, 0, 0); permissions_set->AddPaddingColumn( 1, layout_provider->GetDistanceMetric( views::DISTANCE_RELATED_CONTROL_HORIZONTAL)); permissions_set->AddColumn(GridLayout::TRAILING, GridLayout::FILL, kStretchy, GridLayout::USE_PREF, 0, 0); permissions_set->AddPaddingColumn(kFixed, side_margin); constexpr int kChosenObjectSectionId = 1; views::ColumnSet* chosen_object_set = layout->AddColumnSet(kChosenObjectSectionId); chosen_object_set->AddPaddingColumn(kFixed, side_margin); chosen_object_set->AddColumn(GridLayout::FILL, GridLayout::FILL, kStretchy, GridLayout::USE_PREF, 0, 0); chosen_object_set->AddPaddingColumn(kFixed, side_margin); for (const auto& permission : permission_info_list) { std::unique_ptr selector = base::MakeUnique( profile_, web_contents() ? web_contents()->GetVisibleURL() : GURL::EmptyGURL(), permission, layout); selector->AddObserver(this); selector_rows_.push_back(std::move(selector)); } if (ui::MaterialDesignController::IsSecondaryUiMaterial()) { const int maximum_width = ChromeLayoutProvider::Get()->GetDistanceMetric( views::DISTANCE_BUTTON_MAX_LINKABLE_WIDTH); int combobox_width = 0; for (const auto& selector : selector_rows_) { int curr_width = selector->GetComboboxWidth(); if (maximum_width >= curr_width) combobox_width = std::max(combobox_width, curr_width); } for (const auto& selector : selector_rows_) selector->SetMinComboboxWidth(combobox_width); } for (auto& object : chosen_object_info_list) { layout->StartRow( 1, kChosenObjectSectionId, PermissionSelectorRow::MinHeightForPermissionRow() + list_item_padding); auto object_view = std::make_unique(std::move(object)); object_view->AddObserver(this); layout->AddView(object_view.release()); } layout->AddPaddingRow(kFixed, list_item_padding); layout->Layout(permissions_view_); SizeToContents(); } ",0 "static inline struct hlist_head *dev_name_hash(struct net *net, const char *name) { unsigned int hash = full_name_hash(net, name, strnlen(name, IFNAMSIZ)); return &net->dev_name_head[hash_32(hash, NETDEV_HASHBITS)]; } ",0 "int phar_open_executed_filename(char *alias, int alias_len, char **error TSRMLS_DC) /* {{{ */ { char *fname; zval *halt_constant; php_stream *fp; int fname_len; char *actual = NULL; int ret; if (error) { *error = NULL; } fname = (char*)zend_get_executed_filename(TSRMLS_C); fname_len = strlen(fname); if (phar_open_parsed_phar(fname, fname_len, alias, alias_len, 0, REPORT_ERRORS, NULL, 0 TSRMLS_CC) == SUCCESS) { return SUCCESS; } if (!strcmp(fname, ""[no active file]"")) { if (error) { spprintf(error, 0, ""cannot initialize a phar outside of PHP execution""); } return FAILURE; } MAKE_STD_ZVAL(halt_constant); if (0 == zend_get_constant(""__COMPILER_HALT_OFFSET__"", 24, halt_constant TSRMLS_CC)) { FREE_ZVAL(halt_constant); if (error) { spprintf(error, 0, ""__HALT_COMPILER(); must be declared in a phar""); } return FAILURE; } FREE_ZVAL(halt_constant); #if PHP_API_VERSION < 20100412 if (PG(safe_mode) && (!php_checkuid(fname, NULL, CHECKUID_ALLOW_ONLY_FILE))) { return FAILURE; } #endif if (php_check_open_basedir(fname TSRMLS_CC)) { return FAILURE; } fp = php_stream_open_wrapper(fname, ""rb"", IGNORE_URL|STREAM_MUST_SEEK|REPORT_ERRORS, &actual); if (!fp) { if (error) { spprintf(error, 0, ""unable to open phar for reading \""%s\"""", fname); } if (actual) { efree(actual); } return FAILURE; } if (actual) { fname = actual; fname_len = strlen(actual); } ret = phar_open_from_fp(fp, fname, fname_len, alias, alias_len, REPORT_ERRORS, NULL, 0, error TSRMLS_CC); if (actual) { efree(actual); } return ret; } /* }}} */ ",0 "void RenderViewTest::Resize(gfx::Size new_size, bool is_fullscreen_granted) { ResizeParams params; params.screen_info = ScreenInfo(); params.new_size = new_size; params.physical_backing_size = new_size; params.top_controls_height = 0.f; params.browser_controls_shrink_blink_size = false; params.is_fullscreen_granted = is_fullscreen_granted; params.display_mode = blink::kWebDisplayModeBrowser; std::unique_ptr resize_message(new ViewMsg_Resize(0, params)); OnMessageReceived(*resize_message); } ",0 "static int do_encode(AVCodecContext *avctx, const AVFrame *frame, int *got_packet) { int ret; *got_packet = 0; av_packet_unref(avctx->internal->buffer_pkt); avctx->internal->buffer_pkt_valid = 0; if (avctx->codec_type == AVMEDIA_TYPE_VIDEO) { ret = avcodec_encode_video2(avctx, avctx->internal->buffer_pkt, frame, got_packet); } else if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { ret = avcodec_encode_audio2(avctx, avctx->internal->buffer_pkt, frame, got_packet); } else { ret = AVERROR(EINVAL); } if (ret >= 0 && *got_packet) { av_assert0(!avctx->internal->buffer_pkt->data || avctx->internal->buffer_pkt->buf); avctx->internal->buffer_pkt_valid = 1; ret = 0; } else { av_packet_unref(avctx->internal->buffer_pkt); } return ret; } ",0 "void SynchronousCompositorImpl::RegisterWithClient() { DCHECK(CalledOnValidThread()); DCHECK(output_surface_); DCHECK(synchronous_input_handler_proxy_); DCHECK(!registered_with_client_); registered_with_client_ = true; compositor_client_->DidInitializeCompositor(this); output_surface_->SetTreeActivationCallback( base::Bind(&SynchronousCompositorImpl::DidActivatePendingTree, weak_ptr_factory_.GetWeakPtr())); synchronous_input_handler_proxy_->SetOnlySynchronouslyAnimateRootFlings(this); } ",0 "static int nr_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; struct nr_sock *nr = nr_sk(sk); int val = 0; int len; if (level != SOL_NETROM) return -ENOPROTOOPT; if (get_user(len, optlen)) return -EFAULT; if (len < 0) return -EINVAL; switch (optname) { case NETROM_T1: val = nr->t1 / HZ; break; case NETROM_T2: val = nr->t2 / HZ; break; case NETROM_N2: val = nr->n2; break; case NETROM_T4: val = nr->t4 / HZ; break; case NETROM_IDLE: val = nr->idle / (60 * HZ); break; default: return -ENOPROTOOPT; } len = min_t(unsigned int, len, sizeof(int)); if (put_user(len, optlen)) return -EFAULT; return copy_to_user(optval, &val, len) ? -EFAULT : 0; } ",0 "static int php_session_rfc1867_callback(unsigned int event, void *event_data, void **extra TSRMLS_DC) /* {{{ */ { php_session_rfc1867_progress *progress; int retval = SUCCESS; if (php_session_rfc1867_orig_callback) { retval = php_session_rfc1867_orig_callback(event, event_data, extra TSRMLS_CC); } if (!PS(rfc1867_enabled)) { return retval; } progress = PS(rfc1867_progress); switch(event) { case MULTIPART_EVENT_START: { multipart_event_start *data = (multipart_event_start *) event_data; progress = ecalloc(1, sizeof(php_session_rfc1867_progress)); progress->content_length = data->content_length; progress->sname_len = strlen(PS(session_name)); PS(rfc1867_progress) = progress; } break; case MULTIPART_EVENT_FORMDATA: { multipart_event_formdata *data = (multipart_event_formdata *) event_data; size_t value_len; if (Z_TYPE(progress->sid) && progress->key.c) { break; } /* orig callback may have modified *data->newlength */ if (data->newlength) { value_len = *data->newlength; } else { value_len = data->length; } if (data->name && data->value && value_len) { size_t name_len = strlen(data->name); if (name_len == progress->sname_len && memcmp(data->name, PS(session_name), name_len) == 0) { zval_dtor(&progress->sid); ZVAL_STRINGL(&progress->sid, (*data->value), value_len, 1); } else if (name_len == PS(rfc1867_name).len && memcmp(data->name, PS(rfc1867_name).c, name_len) == 0) { smart_str_free(&progress->key); smart_str_appendl(&progress->key, PS(rfc1867_prefix).c, PS(rfc1867_prefix).len); smart_str_appendl(&progress->key, *data->value, value_len); smart_str_0(&progress->key); progress->apply_trans_sid = PS(use_trans_sid); php_session_rfc1867_early_find_sid(progress TSRMLS_CC); } } } break; case MULTIPART_EVENT_FILE_START: { multipart_event_file_start *data = (multipart_event_file_start *) event_data; /* Do nothing when $_POST[""PHP_SESSION_UPLOAD_PROGRESS""] is not set * or when we have no session id */ if (!Z_TYPE(progress->sid) || !progress->key.c) { break; } /* First FILE_START event, initializing data */ if (!progress->data) { if (PS(rfc1867_freq) >= 0) { progress->update_step = PS(rfc1867_freq); } else if (PS(rfc1867_freq) < 0) { /* % of total size */ progress->update_step = progress->content_length * -PS(rfc1867_freq) / 100; } progress->next_update = 0; progress->next_update_time = 0.0; ALLOC_INIT_ZVAL(progress->data); array_init(progress->data); ALLOC_INIT_ZVAL(progress->post_bytes_processed); ZVAL_LONG(progress->post_bytes_processed, data->post_bytes_processed); ALLOC_INIT_ZVAL(progress->files); array_init(progress->files); add_assoc_long_ex(progress->data, ""start_time"", sizeof(""start_time""), (long)sapi_get_request_time(TSRMLS_C)); add_assoc_long_ex(progress->data, ""content_length"", sizeof(""content_length""), progress->content_length); add_assoc_zval_ex(progress->data, ""bytes_processed"", sizeof(""bytes_processed""), progress->post_bytes_processed); add_assoc_bool_ex(progress->data, ""done"", sizeof(""done""), 0); add_assoc_zval_ex(progress->data, ""files"", sizeof(""files""), progress->files); php_rinit_session(0 TSRMLS_CC); PS(id) = estrndup(Z_STRVAL(progress->sid), Z_STRLEN(progress->sid)); PS(apply_trans_sid) = progress->apply_trans_sid; PS(send_cookie) = 0; } ALLOC_INIT_ZVAL(progress->current_file); array_init(progress->current_file); ALLOC_INIT_ZVAL(progress->current_file_bytes_processed); ZVAL_LONG(progress->current_file_bytes_processed, 0); /* Each uploaded file has its own array. Trying to make it close to $_FILES entries. */ add_assoc_string_ex(progress->current_file, ""field_name"", sizeof(""field_name""), data->name, 1); add_assoc_string_ex(progress->current_file, ""name"", sizeof(""name""), *data->filename, 1); add_assoc_null_ex(progress->current_file, ""tmp_name"", sizeof(""tmp_name"")); add_assoc_long_ex(progress->current_file, ""error"", sizeof(""error""), 0); add_assoc_bool_ex(progress->current_file, ""done"", sizeof(""done""), 0); add_assoc_long_ex(progress->current_file, ""start_time"", sizeof(""start_time""), (long)time(NULL)); add_assoc_zval_ex(progress->current_file, ""bytes_processed"", sizeof(""bytes_processed""), progress->current_file_bytes_processed); add_next_index_zval(progress->files, progress->current_file); Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } break; case MULTIPART_EVENT_FILE_DATA: { multipart_event_file_data *data = (multipart_event_file_data *) event_data; if (!Z_TYPE(progress->sid) || !progress->key.c) { break; } Z_LVAL_P(progress->current_file_bytes_processed) = data->offset + data->length; Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } break; case MULTIPART_EVENT_FILE_END: { multipart_event_file_end *data = (multipart_event_file_end *) event_data; if (!Z_TYPE(progress->sid) || !progress->key.c) { break; } if (data->temp_filename) { add_assoc_string_ex(progress->current_file, ""tmp_name"", sizeof(""tmp_name""), data->temp_filename, 1); } add_assoc_long_ex(progress->current_file, ""error"", sizeof(""error""), data->cancel_upload); add_assoc_bool_ex(progress->current_file, ""done"", sizeof(""done""), 1); Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 0 TSRMLS_CC); } break; case MULTIPART_EVENT_END: { multipart_event_end *data = (multipart_event_end *) event_data; if (Z_TYPE(progress->sid) && progress->key.c) { if (PS(rfc1867_cleanup)) { php_session_rfc1867_cleanup(progress TSRMLS_CC); } else { add_assoc_bool_ex(progress->data, ""done"", sizeof(""done""), 1); Z_LVAL_P(progress->post_bytes_processed) = data->post_bytes_processed; php_session_rfc1867_update(progress, 1 TSRMLS_CC); } php_rshutdown_session_globals(TSRMLS_C); } if (progress->data) { zval_ptr_dtor(&progress->data); } zval_dtor(&progress->sid); smart_str_free(&progress->key); efree(progress); progress = NULL; PS(rfc1867_progress) = NULL; } break; } if (progress && progress->cancel_upload) { return FAILURE; } return retval; } /* }}} */ ",0 "void RenderFlexibleBox::prepareChildForPositionedLayout(RenderBox* child, LayoutUnit mainAxisOffset, LayoutUnit crossAxisOffset, PositionedLayoutMode layoutMode) { ASSERT(child->isOutOfFlowPositioned()); child->containingBlock()->insertPositionedObject(child); RenderLayer* childLayer = child->layer(); LayoutUnit inlinePosition = isColumnFlow() ? crossAxisOffset : mainAxisOffset; if (layoutMode == FlipForRowReverse && style()->flexDirection() == FlowRowReverse) inlinePosition = mainAxisExtent() - mainAxisOffset; childLayer->setStaticInlinePosition(inlinePosition); LayoutUnit staticBlockPosition = isColumnFlow() ? mainAxisOffset : crossAxisOffset; if (childLayer->staticBlockPosition() != staticBlockPosition) { childLayer->setStaticBlockPosition(staticBlockPosition); if (child->style()->hasStaticBlockPosition(style()->isHorizontalWritingMode())) child->setChildNeedsLayout(MarkOnlyThis); } } ",0 " virtual void TearDown() { libvpx_test::ClearSystemState(); } ",0 "static void red_client_remove_channel(RedChannelClient *rcc) { pthread_mutex_lock(&rcc->client->lock); ring_remove(&rcc->client_link); rcc->client->channels_num--; pthread_mutex_unlock(&rcc->client->lock); } ",0 "void RenderView::ApplyWebPreferences(const WebPreferences& prefs, WebView* web_view) { WebSettings* settings = web_view->GetSettings(); ApplyFontsFromMap(prefs.standard_font_family_map, SetStandardFontFamilyWrapper, settings); ApplyFontsFromMap(prefs.fixed_font_family_map, SetFixedFontFamilyWrapper, settings); ApplyFontsFromMap(prefs.serif_font_family_map, SetSerifFontFamilyWrapper, settings); ApplyFontsFromMap(prefs.sans_serif_font_family_map, SetSansSerifFontFamilyWrapper, settings); ApplyFontsFromMap(prefs.cursive_font_family_map, SetCursiveFontFamilyWrapper, settings); ApplyFontsFromMap(prefs.fantasy_font_family_map, SetFantasyFontFamilyWrapper, settings); ApplyFontsFromMap(prefs.pictograph_font_family_map, SetPictographFontFamilyWrapper, settings); settings->SetDefaultFontSize(prefs.default_font_size); settings->SetDefaultFixedFontSize(prefs.default_fixed_font_size); settings->SetMinimumFontSize(prefs.minimum_font_size); settings->SetMinimumLogicalFontSize(prefs.minimum_logical_font_size); settings->SetDefaultTextEncodingName( WebString::FromASCII(prefs.default_encoding)); settings->SetJavaScriptEnabled(prefs.javascript_enabled); settings->SetWebSecurityEnabled(prefs.web_security_enabled); settings->SetLoadsImagesAutomatically(prefs.loads_images_automatically); settings->SetImagesEnabled(prefs.images_enabled); settings->SetPluginsEnabled(prefs.plugins_enabled); settings->SetDOMPasteAllowed(prefs.dom_paste_enabled); settings->SetTextAreasAreResizable(prefs.text_areas_are_resizable); settings->SetAllowScriptsToCloseWindows(prefs.allow_scripts_to_close_windows); settings->SetDownloadableBinaryFontsEnabled(prefs.remote_fonts_enabled); settings->SetJavaScriptCanAccessClipboard( prefs.javascript_can_access_clipboard); WebRuntimeFeatures::EnableXSLT(prefs.xslt_enabled); settings->SetXSSAuditorEnabled(prefs.xss_auditor_enabled); settings->SetDNSPrefetchingEnabled(prefs.dns_prefetching_enabled); blink::WebNetworkStateNotifier::SetSaveDataEnabled( prefs.data_saver_enabled && !base::FeatureList::IsEnabled(features::kDataSaverHoldback)); settings->SetLocalStorageEnabled(prefs.local_storage_enabled); settings->SetSyncXHRInDocumentsEnabled(prefs.sync_xhr_in_documents_enabled); WebRuntimeFeatures::EnableDatabase(prefs.databases_enabled); settings->SetOfflineWebApplicationCacheEnabled( prefs.application_cache_enabled); settings->SetHistoryEntryRequiresUserGesture( prefs.history_entry_requires_user_gesture); settings->SetHyperlinkAuditingEnabled(prefs.hyperlink_auditing_enabled); settings->SetCookieEnabled(prefs.cookie_enabled); settings->SetNavigateOnDragDrop(prefs.navigate_on_drag_drop); settings->SetAllowUniversalAccessFromFileURLs( prefs.allow_universal_access_from_file_urls); settings->SetAllowFileAccessFromFileURLs( prefs.allow_file_access_from_file_urls); settings->SetWebGL1Enabled(prefs.webgl1_enabled); settings->SetWebGL2Enabled(prefs.webgl2_enabled); settings->SetWebGLErrorsToConsoleEnabled( prefs.webgl_errors_to_console_enabled); settings->SetMockScrollbarsEnabled(prefs.mock_scrollbars_enabled); settings->SetHideScrollbars(prefs.hide_scrollbars); WebRuntimeFeatures::EnableAccelerated2dCanvas( prefs.accelerated_2d_canvas_enabled); settings->SetMinimumAccelerated2dCanvasSize( prefs.minimum_accelerated_2d_canvas_size); settings->SetAntialiased2dCanvasEnabled( !prefs.antialiased_2d_canvas_disabled); settings->SetAntialiasedClips2dCanvasEnabled( prefs.antialiased_clips_2d_canvas_enabled); settings->SetAccelerated2dCanvasMSAASampleCount( prefs.accelerated_2d_canvas_msaa_sample_count); web_view->SetTabsToLinks(prefs.tabs_to_links); settings->SetAllowRunningOfInsecureContent( prefs.allow_running_insecure_content); settings->SetDisableReadingFromCanvas(prefs.disable_reading_from_canvas); settings->SetStrictMixedContentChecking(prefs.strict_mixed_content_checking); settings->SetStrictlyBlockBlockableMixedContent( prefs.strictly_block_blockable_mixed_content); settings->SetStrictMixedContentCheckingForPlugin( prefs.block_mixed_plugin_content); settings->SetStrictPowerfulFeatureRestrictions( prefs.strict_powerful_feature_restrictions); settings->SetAllowGeolocationOnInsecureOrigins( prefs.allow_geolocation_on_insecure_origins); settings->SetPasswordEchoEnabled(prefs.password_echo_enabled); settings->SetShouldPrintBackgrounds(prefs.should_print_backgrounds); settings->SetShouldClearDocumentBackground( prefs.should_clear_document_background); settings->SetEnableScrollAnimator(prefs.enable_scroll_animator); WebRuntimeFeatures::EnableTouchEventFeatureDetection( prefs.touch_event_feature_detection_enabled); settings->SetMaxTouchPoints(prefs.pointer_events_max_touch_points); settings->SetAvailablePointerTypes(prefs.available_pointer_types); settings->SetPrimaryPointerType( static_cast(prefs.primary_pointer_type)); settings->SetAvailableHoverTypes(prefs.available_hover_types); settings->SetPrimaryHoverType( static_cast(prefs.primary_hover_type)); settings->SetEnableTouchAdjustment(prefs.touch_adjustment_enabled); settings->SetBarrelButtonForDragEnabled(prefs.barrel_button_for_drag_enabled); settings->SetShouldRespectImageOrientation( prefs.should_respect_image_orientation); settings->SetEditingBehavior( static_cast(prefs.editing_behavior)); settings->SetSupportsMultipleWindows(prefs.supports_multiple_windows); settings->SetMainFrameClipsContent(!prefs.record_whole_document); settings->SetSmartInsertDeleteEnabled(prefs.smart_insert_delete_enabled); settings->SetSpatialNavigationEnabled(prefs.spatial_navigation_enabled); settings->SetSelectionIncludesAltImageText(true); settings->SetV8CacheOptions( static_cast(prefs.v8_cache_options)); settings->SetImageAnimationPolicy( static_cast(prefs.animation_policy)); settings->SetPresentationRequiresUserGesture( prefs.user_gesture_required_for_presentation); settings->SetTextTrackMarginPercentage(prefs.text_track_margin_percentage); web_view->SetDefaultPageScaleLimits(prefs.default_minimum_page_scale_factor, prefs.default_maximum_page_scale_factor); settings->SetSavePreviousDocumentResources( static_cast( prefs.save_previous_document_resources)); #if defined(OS_ANDROID) settings->SetAllowCustomScrollbarInMainFrame(false); settings->SetTextAutosizingEnabled(prefs.text_autosizing_enabled); settings->SetAccessibilityFontScaleFactor(prefs.font_scale_factor); settings->SetDeviceScaleAdjustment(prefs.device_scale_adjustment); settings->SetFullscreenSupported(prefs.fullscreen_supported); web_view->SetIgnoreViewportTagScaleLimits(prefs.force_enable_zoom); settings->SetAutoZoomFocusedNodeToLegibleScale(true); settings->SetDoubleTapToZoomEnabled(prefs.double_tap_to_zoom_enabled); settings->SetMediaPlaybackGestureWhitelistScope( blink::WebString::FromUTF8(prefs.media_playback_gesture_whitelist_scope)); settings->SetDefaultVideoPosterURL( WebString::FromASCII(prefs.default_video_poster_url.spec())); settings->SetSupportDeprecatedTargetDensityDPI( prefs.support_deprecated_target_density_dpi); settings->SetUseLegacyBackgroundSizeShorthandBehavior( prefs.use_legacy_background_size_shorthand_behavior); settings->SetWideViewportQuirkEnabled(prefs.wide_viewport_quirk); settings->SetUseWideViewport(prefs.use_wide_viewport); settings->SetForceZeroLayoutHeight(prefs.force_zero_layout_height); settings->SetViewportMetaLayoutSizeQuirk( prefs.viewport_meta_layout_size_quirk); settings->SetViewportMetaMergeContentQuirk( prefs.viewport_meta_merge_content_quirk); settings->SetViewportMetaNonUserScalableQuirk( prefs.viewport_meta_non_user_scalable_quirk); settings->SetViewportMetaZeroValuesQuirk( prefs.viewport_meta_zero_values_quirk); settings->SetClobberUserAgentInitialScaleQuirk( prefs.clobber_user_agent_initial_scale_quirk); settings->SetIgnoreMainFrameOverflowHiddenQuirk( prefs.ignore_main_frame_overflow_hidden_quirk); settings->SetReportScreenSizeInPhysicalPixelsQuirk( prefs.report_screen_size_in_physical_pixels_quirk); settings->SetShouldReuseGlobalForUnownedMainFrame( prefs.resue_global_for_unowned_main_frame); settings->SetProgressBarCompletion( static_cast( prefs.progress_bar_completion)); settings->SetPreferHiddenVolumeControls(true); settings->SetSpellCheckEnabledByDefault(prefs.spellcheck_enabled_by_default); const bool is_jelly_bean = base::android::BuildInfo::GetInstance()->sdk_int() <= base::android::SDK_VERSION_JELLY_BEAN_MR2; settings->SetForcePreloadNoneForMediaElements(is_jelly_bean); WebRuntimeFeatures::EnableVideoFullscreenOrientationLock( prefs.video_fullscreen_orientation_lock_enabled); WebRuntimeFeatures::EnableVideoRotateToFullscreen( prefs.video_rotate_to_fullscreen_enabled); WebRuntimeFeatures::EnableVideoFullscreenDetection( prefs.video_fullscreen_detection_enabled); settings->SetEmbeddedMediaExperienceEnabled( prefs.embedded_media_experience_enabled); settings->SetPagePopupsSuppressed(prefs.page_popups_suppressed); settings->SetMediaDownloadInProductHelpEnabled( prefs.enable_media_download_in_product_help); settings->SetDoNotUpdateSelectionOnMutatingSelectionRange( prefs.do_not_update_selection_on_mutating_selection_range); WebRuntimeFeatures::EnableCSSHexAlphaColor(prefs.css_hex_alpha_color_enabled); WebRuntimeFeatures::EnableScrollTopLeftInterop( prefs.scroll_top_left_interop_enabled); #endif // defined(OS_ANDROID) switch (prefs.autoplay_policy) { case AutoplayPolicy::kNoUserGestureRequired: settings->SetAutoplayPolicy( WebSettings::AutoplayPolicy::kNoUserGestureRequired); break; case AutoplayPolicy::kUserGestureRequired: settings->SetAutoplayPolicy( WebSettings::AutoplayPolicy::kUserGestureRequired); break; case AutoplayPolicy::kUserGestureRequiredForCrossOrigin: settings->SetAutoplayPolicy( WebSettings::AutoplayPolicy::kUserGestureRequiredForCrossOrigin); break; case AutoplayPolicy::kDocumentUserActivationRequired: settings->SetAutoplayPolicy( WebSettings::AutoplayPolicy::kDocumentUserActivationRequired); break; } settings->SetViewportEnabled(prefs.viewport_enabled); settings->SetViewportMetaEnabled(prefs.viewport_meta_enabled); settings->SetShrinksViewportContentToFit( prefs.shrinks_viewport_contents_to_fit); settings->SetViewportStyle( static_cast(prefs.viewport_style)); settings->SetLoadWithOverviewMode(prefs.initialize_at_minimum_page_scale); settings->SetMainFrameResizesAreOrientationChanges( prefs.main_frame_resizes_are_orientation_changes); settings->SetUseSolidColorScrollbars(prefs.use_solid_color_scrollbars); settings->SetShowContextMenuOnMouseUp(prefs.context_menu_on_mouse_up); settings->SetAlwaysShowContextMenuOnTouch( prefs.always_show_context_menu_on_touch); settings->SetHideDownloadUI(prefs.hide_download_ui); WebRuntimeFeatures::EnableBackgroundVideoTrackOptimization( prefs.background_video_track_optimization_enabled); WebRuntimeFeatures::EnableNewRemotePlaybackPipeline( base::FeatureList::IsEnabled(media::kNewRemotePlaybackPipeline)); settings->SetPresentationReceiver(prefs.presentation_receiver); settings->SetMediaControlsEnabled(prefs.media_controls_enabled); settings->SetLowPriorityIframesThreshold( static_cast( prefs.low_priority_iframes_threshold)); #if defined(OS_MACOSX) settings->SetDoubleTapToZoomEnabled(true); web_view->SetMaximumLegibleScale(prefs.default_maximum_page_scale_factor); #endif #if defined(OS_WIN) WebRuntimeFeatures::EnableMiddleClickAutoscroll(true); #endif } ",0 "ssize_t mfill_zeropage(struct mm_struct *dst_mm, unsigned long start, unsigned long len, bool *mmap_changing) { return __mcopy_atomic(dst_mm, start, 0, len, true, mmap_changing); } ",0 "const CHAR* DoRemoveURLWhitespace(const CHAR* input, int input_len, CanonOutputT* buffer, int* output_len, bool* potentially_dangling_markup) { int found_whitespace = false; for (int i = 0; i < input_len; i++) { if (!IsRemovableURLWhitespace(input[i])) continue; found_whitespace = true; break; } if (!found_whitespace) { *output_len = input_len; return input; } if (input_len > 5 && input[0] == 'd' && input[1] == 'a' && input[2] == 't' && input[3] == 'a' && input[4] == ':') { *output_len = input_len; return input; } for (int i = 0; i < input_len; i++) { if (!IsRemovableURLWhitespace(input[i])) { if (potentially_dangling_markup && input[i] == 0x3C) *potentially_dangling_markup = true; buffer->push_back(input[i]); } } *output_len = buffer->length(); return buffer->data(); } ",0 "SPL_METHOD(Array, key) { if (zend_parse_parameters_none() == FAILURE) { return; } spl_array_iterator_key(getThis(), return_value TSRMLS_CC); } /* }}} */ void spl_array_iterator_key(zval *object, zval *return_value TSRMLS_DC) /* {{{ */ ",0 "poly_contain(PG_FUNCTION_ARGS) { POLYGON *polya = PG_GETARG_POLYGON_P(0); POLYGON *polyb = PG_GETARG_POLYGON_P(1); bool result; /* * Quick check to see if bounding box is contained. */ if (polya->npts > 0 && polyb->npts > 0 && DatumGetBool(DirectFunctionCall2(box_contain, BoxPGetDatum(&polya->boundbox), BoxPGetDatum(&polyb->boundbox)))) { int i; LSEG s; s.p[0] = polyb->p[polyb->npts - 1]; result = true; for (i = 0; i < polyb->npts && result; i++) { s.p[1] = polyb->p[i]; result = lseg_inside_poly(s.p, s.p + 1, polya, 0); s.p[0] = s.p[1]; } } else { result = false; } /* * Avoid leaking memory for toasted inputs ... needed for rtree indexes */ PG_FREE_IF_COPY(polya, 0); PG_FREE_IF_COPY(polyb, 1); PG_RETURN_BOOL(result); } ",0 "static void enabledAtRuntimeAttrAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectV8Internal::enabledAtRuntimeAttrAttributeSetter(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "bool HTMLMediaElement::seeking() const { return seeking_; } ",0 "static ssize_t show_tabletMouseMiddle(struct device *dev, struct device_attribute *attr, char *buf) { struct aiptek *aiptek = dev_get_drvdata(dev); return snprintf(buf, PAGE_SIZE, ""%s\n"", map_val_to_str(mouse_button_map, aiptek->curSetting.mouseButtonMiddle)); } ",0 "bool JSArray::deleteProperty(ExecState* exec, const Identifier& propertyName) { bool isArrayIndex; unsigned i = propertyName.toArrayIndex(isArrayIndex); if (isArrayIndex) return deleteProperty(exec, i); if (propertyName == exec->propertyNames().length) return false; return JSObject::deleteProperty(exec, propertyName); } ",0 "status_t OMXNodeInstance::prepareForAdaptivePlayback( OMX_U32 portIndex, OMX_BOOL enable, OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight) { Mutex::Autolock autolock(mLock); CLOG_CONFIG(prepareForAdaptivePlayback, ""%s:%u en=%d max=%ux%u"", portString(portIndex), portIndex, enable, maxFrameWidth, maxFrameHeight); OMX_INDEXTYPE index; OMX_STRING name = const_cast( ""OMX.google.android.index.prepareForAdaptivePlayback""); OMX_ERRORTYPE err = OMX_GetExtensionIndex(mHandle, name, &index); if (err != OMX_ErrorNone) { CLOG_ERROR_IF(enable, getExtensionIndex, err, ""%s"", name); return StatusFromOMXError(err); } PrepareForAdaptivePlaybackParams params; InitOMXParams(¶ms); params.nPortIndex = portIndex; params.bEnable = enable; params.nMaxFrameWidth = maxFrameWidth; params.nMaxFrameHeight = maxFrameHeight; err = OMX_SetParameter(mHandle, index, ¶ms); CLOG_IF_ERROR(setParameter, err, ""%s(%#x): %s:%u en=%d max=%ux%u"", name, index, portString(portIndex), portIndex, enable, maxFrameWidth, maxFrameHeight); return StatusFromOMXError(err); } ",0 "static int writeBufferToContigStrips(TIFF* out, uint8* buf, uint32 imagelength) { uint32 row, nrows, rowsperstrip; tstrip_t strip = 0; tsize_t stripsize; TIFFGetFieldDefaulted(out, TIFFTAG_ROWSPERSTRIP, &rowsperstrip); for (row = 0; row < imagelength; row += rowsperstrip) { nrows = (row + rowsperstrip > imagelength) ? imagelength - row : rowsperstrip; stripsize = TIFFVStripSize(out, nrows); if (TIFFWriteEncodedStrip(out, strip++, buf, stripsize) < 0) { TIFFError(TIFFFileName(out), ""Error, can't write strip %u"", strip - 1); return 1; } buf += stripsize; } return 0; } ",0 "static int em_adc(struct x86_emulate_ctxt *ctxt) { emulate_2op_SrcV(ctxt, ""adc""); return X86EMUL_CONTINUE; } ",0 "int ssl3_get_cert_verify(SSL *s) { EVP_PKEY *pkey=NULL; unsigned char *p; int al,ok,ret=0; long n; int type=0,i,j; X509 *peer; const EVP_MD *md = NULL; EVP_MD_CTX mctx; EVP_MD_CTX_init(&mctx); n=s->method->ssl_get_message(s, SSL3_ST_SR_CERT_VRFY_A, SSL3_ST_SR_CERT_VRFY_B, -1, SSL3_RT_MAX_PLAIN_LENGTH, &ok); if (!ok) return((int)n); if (s->session->peer != NULL) { peer=s->session->peer; pkey=X509_get_pubkey(peer); type=X509_certificate_type(peer,pkey); } else { peer=NULL; pkey=NULL; } if (s->s3->tmp.message_type != SSL3_MT_CERTIFICATE_VERIFY) { s->s3->tmp.reuse_message=1; if ((peer != NULL) && (type & EVP_PKT_SIGN)) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_MISSING_VERIFY_MESSAGE); goto f_err; } ret=1; goto end; } if (peer == NULL) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_NO_CLIENT_CERT_RECEIVED); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } if (!(type & EVP_PKT_SIGN)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_SIGNATURE_FOR_NON_SIGNING_CERTIFICATE); al=SSL_AD_ILLEGAL_PARAMETER; goto f_err; } if (s->s3->change_cipher_spec) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_CCS_RECEIVED_EARLY); al=SSL_AD_UNEXPECTED_MESSAGE; goto f_err; } /* we now have a signature that we need to verify */ p=(unsigned char *)s->init_msg; /* Check for broken implementations of GOST ciphersuites */ /* If key is GOST and n is exactly 64, it is bare * signature without length field */ if (n==64 && (pkey->type==NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) ) { i=64; } else { if (SSL_USE_SIGALGS(s)) { int rv = tls12_check_peer_sigalg(&md, s, p, pkey); if (rv == -1) { al = SSL_AD_INTERNAL_ERROR; goto f_err; } else if (rv == 0) { al = SSL_AD_DECODE_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, ""USING TLSv1.2 HASH %s\n"", EVP_MD_name(md)); #endif p += 2; n -= 2; } n2s(p,i); n-=2; if (i > n) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_LENGTH_MISMATCH); al=SSL_AD_DECODE_ERROR; goto f_err; } } j=EVP_PKEY_size(pkey); if ((i > j) || (n > j) || (n <= 0)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_WRONG_SIGNATURE_SIZE); al=SSL_AD_DECODE_ERROR; goto f_err; } if (SSL_USE_SIGALGS(s)) { long hdatalen = 0; void *hdata; hdatalen = BIO_get_mem_data(s->s3->handshake_buffer, &hdata); if (hdatalen <= 0) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_INTERNAL_ERROR); al=SSL_AD_INTERNAL_ERROR; goto f_err; } #ifdef SSL_DEBUG fprintf(stderr, ""Using TLS 1.2 with client verify alg %s\n"", EVP_MD_name(md)); #endif if (!EVP_VerifyInit_ex(&mctx, md, NULL) || !EVP_VerifyUpdate(&mctx, hdata, hdatalen)) { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, ERR_R_EVP_LIB); al=SSL_AD_INTERNAL_ERROR; goto f_err; } if (EVP_VerifyFinal(&mctx, p , i, pkey) <= 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_SIGNATURE); goto f_err; } } else #ifndef OPENSSL_NO_RSA if (pkey->type == EVP_PKEY_RSA) { i=RSA_verify(NID_md5_sha1, s->s3->tmp.cert_verify_md, MD5_DIGEST_LENGTH+SHA_DIGEST_LENGTH, p, i, pkey->pkey.rsa); if (i < 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_DECRYPT); goto f_err; } if (i == 0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_RSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_DSA if (pkey->type == EVP_PKEY_DSA) { j=DSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.dsa); if (j <= 0) { /* bad signature */ al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,SSL_R_BAD_DSA_SIGNATURE); goto f_err; } } else #endif #ifndef OPENSSL_NO_ECDSA if (pkey->type == EVP_PKEY_EC) { j=ECDSA_verify(pkey->save_type, &(s->s3->tmp.cert_verify_md[MD5_DIGEST_LENGTH]), SHA_DIGEST_LENGTH,p,i,pkey->pkey.ec); if (j <= 0) { /* bad signature */ al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else #endif if (pkey->type == NID_id_GostR3410_94 || pkey->type == NID_id_GostR3410_2001) { unsigned char signature[64]; int idx; EVP_PKEY_CTX *pctx = EVP_PKEY_CTX_new(pkey,NULL); EVP_PKEY_verify_init(pctx); if (i!=64) { fprintf(stderr,""GOST signature length is %d"",i); } for (idx=0;idx<64;idx++) { signature[63-idx]=p[idx]; } j=EVP_PKEY_verify(pctx,signature,64,s->s3->tmp.cert_verify_md,32); EVP_PKEY_CTX_free(pctx); if (j<=0) { al=SSL_AD_DECRYPT_ERROR; SSLerr(SSL_F_SSL3_GET_CERT_VERIFY, SSL_R_BAD_ECDSA_SIGNATURE); goto f_err; } } else { SSLerr(SSL_F_SSL3_GET_CERT_VERIFY,ERR_R_INTERNAL_ERROR); al=SSL_AD_UNSUPPORTED_CERTIFICATE; goto f_err; } ret=1; if (0) { f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); } end: if (s->s3->handshake_buffer) { BIO_free(s->s3->handshake_buffer); s->s3->handshake_buffer = NULL; s->s3->flags &= ~TLS1_FLAGS_KEEP_HANDSHAKE; } EVP_MD_CTX_cleanup(&mctx); EVP_PKEY_free(pkey); return(ret); } ",1 "static void activityLoggingGetterForAllWorldsLongAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""activityLoggingGetterForAllWorldsLongAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState); imp->setActivityLoggingGetterForAllWorldsLongAttribute(cppValue); } ",0 "TabStripGtk::~TabStripGtk() { model_->RemoveObserver(this); tabstrip_.Destroy(); std::vector::iterator iterator = tab_data_.begin(); for (; iterator < tab_data_.end(); iterator++) { delete iterator->tab; } tab_data_.clear(); RemoveMessageLoopObserver(); } ",0 "static int opl3_set_instr (int dev, int voice, int instr_no) { if (voice < 0 || voice >= devc->nr_voice) return 0; if (instr_no < 0 || instr_no >= SBFM_MAXINSTR) instr_no = 0; /* Acoustic piano (usually) */ devc->act_i[voice] = &devc->i_map[instr_no]; return 0; } ",0 "int git_index_set_caps(git_index *index, int caps) { unsigned int old_ignore_case; assert(index); old_ignore_case = index->ignore_case; if (caps == GIT_INDEXCAP_FROM_OWNER) { git_repository *repo = INDEX_OWNER(index); int val; if (!repo) return create_index_error( -1, ""cannot access repository to set index caps""); if (!git_repository__cvar(&val, repo, GIT_CVAR_IGNORECASE)) index->ignore_case = (val != 0); if (!git_repository__cvar(&val, repo, GIT_CVAR_FILEMODE)) index->distrust_filemode = (val == 0); if (!git_repository__cvar(&val, repo, GIT_CVAR_SYMLINKS)) index->no_symlinks = (val == 0); } else { index->ignore_case = ((caps & GIT_INDEXCAP_IGNORE_CASE) != 0); index->distrust_filemode = ((caps & GIT_INDEXCAP_NO_FILEMODE) != 0); index->no_symlinks = ((caps & GIT_INDEXCAP_NO_SYMLINKS) != 0); } if (old_ignore_case != index->ignore_case) { git_index__set_ignore_case(index, (bool)index->ignore_case); } return 0; } ",0 "static void nested_ept_inject_page_fault(struct kvm_vcpu *vcpu, struct x86_exception *fault) { struct vmcs12 *vmcs12 = get_vmcs12(vcpu); u32 exit_reason; if (fault->error_code & PFERR_RSVD_MASK) exit_reason = EXIT_REASON_EPT_MISCONFIG; else exit_reason = EXIT_REASON_EPT_VIOLATION; nested_vmx_vmexit(vcpu, exit_reason, 0, vcpu->arch.exit_qualification); vmcs12->guest_physical_address = fault->address; } ",0 "static gboolean irssi_ssl_verify(SSL *ssl, SSL_CTX *ctx, X509 *cert) { if (SSL_get_verify_result(ssl) != X509_V_OK) { unsigned char md[EVP_MAX_MD_SIZE]; unsigned int n; char *str; g_warning(""Could not verify SSL servers certificate:""); if ((str = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0)) == NULL) g_warning("" Could not get subject-name from peer certificate""); else { g_warning("" Subject : %s"", str); free(str); } if ((str = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0)) == NULL) g_warning("" Could not get issuer-name from peer certificate""); else { g_warning("" Issuer : %s"", str); free(str); } if (! X509_digest(cert, EVP_md5(), md, &n)) g_warning("" Could not get fingerprint from peer certificate""); else { char hex[] = ""0123456789ABCDEF""; char fp[EVP_MAX_MD_SIZE*3]; if (n < sizeof(fp)) { unsigned int i; for (i = 0; i < n; i++) { fp[i*3+0] = hex[(md[i] >> 4) & 0xF]; fp[i*3+1] = hex[(md[i] >> 0) & 0xF]; fp[i*3+2] = i == n - 1 ? '\0' : ':'; } g_warning("" MD5 Fingerprint : %s"", fp); } } return FALSE; } return TRUE; } ",1 "int __kmem_cache_shrink(struct kmem_cache *cachep) { int ret = 0; int node; struct kmem_cache_node *n; drain_cpu_caches(cachep); check_irq_on(); for_each_kmem_cache_node(cachep, node, n) { drain_freelist(cachep, n, INT_MAX); ret += !list_empty(&n->slabs_full) || !list_empty(&n->slabs_partial); } return (ret ? 1 : 0); } ",0 "bool InspectorController::handleTouchEvent(LocalFrame* frame, const PlatformTouchEvent& event) { m_overlay->handleTouchEvent(event); if (InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent()) return domAgent->handleTouchEvent(frame, event); return false; } ",0 "void BookmarkManagerView::ExecuteCommand(int id) { switch (id) { case IDS_BOOKMARK_MANAGER_IMPORT_MENU: UserMetrics::RecordAction(L""BookmarkManager_Import"", profile_); ShowImportBookmarksFileChooser(); break; case IDS_BOOKMARK_MANAGER_EXPORT_MENU: UserMetrics::RecordAction(L""BookmarkManager_Export"", profile_); ShowExportBookmarksFileChooser(); break; default: NOTREACHED(); break; } } ",0 "static void unsignedLongAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""unsignedLongAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(unsigned, cppValue, toUInt32(jsValue, exceptionState), exceptionState); imp->setUnsignedLongAttribute(cppValue); } ",0 "void WebGraphicsContext3DDefaultImpl::deleteProgram(unsigned program) { makeContextCurrent(); glDeleteProgram(program); } ",0 " BlockedPluginInfoBarDelegate::~BlockedPluginInfoBarDelegate() { UserMetrics::RecordAction(UserMetricsAction(""BlockedPluginInfobar.Closed"")); } ",0 "static int aes_ccm_init_key(EVP_CIPHER_CTX *ctx, const unsigned char *key, const unsigned char *iv, int enc) { EVP_AES_CCM_CTX *cctx = EVP_C_DATA(EVP_AES_CCM_CTX,ctx); if (!iv && !key) return 1; if (key) do { #ifdef HWAES_CAPABLE if (HWAES_CAPABLE) { HWAES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) HWAES_encrypt); cctx->str = NULL; cctx->key_set = 1; break; } else #endif #ifdef VPAES_CAPABLE if (VPAES_CAPABLE) { vpaes_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) vpaes_encrypt); cctx->str = NULL; cctx->key_set = 1; break; } #endif AES_set_encrypt_key(key, EVP_CIPHER_CTX_key_length(ctx) * 8, &cctx->ks.ks); CRYPTO_ccm128_init(&cctx->ccm, cctx->M, cctx->L, &cctx->ks, (block128_f) AES_encrypt); cctx->str = NULL; cctx->key_set = 1; } while (0); if (iv) { memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, 15 - cctx->L); cctx->iv_set = 1; } return 1; } ",0 "static void checkdup(JF, js_Ast *list, js_Ast *end) { char nbuf[32], sbuf[32]; const char *needle, *straw; if (end->a->type == EXP_NUMBER) needle = jsV_numbertostring(J, nbuf, end->a->number); else needle = end->a->string; while (list->a != end) { if (list->a->type == end->type) { js_Ast *prop = list->a->a; if (prop->type == EXP_NUMBER) straw = jsV_numbertostring(J, sbuf, prop->number); else straw = prop->string; if (!strcmp(needle, straw)) jsC_error(J, list, ""duplicate property '%s' in object literal"", needle); } list = list->b; } } ",0 "static int ecb_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct des3_ede_x86_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; blkcipher_walk_init(&walk, dst, src, nbytes); return ecb_crypt(desc, &walk, ctx->enc_expkey); } ",0 "bool venc_dev::venc_set_markltr(OMX_U32 frameIdx) { DEBUG_PRINT_LOW(""venc_set_goldenframe""); int rc = true; struct v4l2_control control; control.id = V4L2_CID_MPEG_VIDC_VIDEO_MARKLTRFRAME; control.value = frameIdx; rc = ioctl(m_nDriver_fd, VIDIOC_S_CTRL, &control); if (rc) { DEBUG_PRINT_ERROR(""Failed to set ltrmode %d"", rc); return false; } DEBUG_PRINT_LOW(""Success IOCTL set control for id=%x, val=%d"", control.id, control.value); return true; } ",0 " PersonalDataManager* GetPersonalDataManager() { return PersonalDataManagerFactory::GetForProfile(browser()->profile()); } ",0 "int64 TypedUrlModelAssociator::GetSyncIdFromChromeId( const std::string& typed_url) { TypedUrlToSyncIdMap::const_iterator iter = id_map_.find(typed_url); return iter == id_map_.end() ? sync_api::kInvalidId : iter->second; } ",0 "void RenderViewImpl::OnCustomContextMenuAction( const CustomContextMenuContext& custom_context, unsigned action) { if (custom_context.request_id) { ContextMenuClient* client = pending_context_menus_.Lookup(custom_context.request_id); if (client) client->OnMenuAction(custom_context.request_id, action); } else { webview()->performCustomContextMenuAction(action); } } ",0 "static struct domain_device *sas_ex_discover_expander( struct domain_device *parent, int phy_id) { struct sas_expander_device *parent_ex = rphy_to_expander_device(parent->rphy); struct ex_phy *phy = &parent->ex_dev.ex_phy[phy_id]; struct domain_device *child = NULL; struct sas_rphy *rphy; struct sas_expander_device *edev; struct asd_sas_port *port; int res; if (phy->routing_attr == DIRECT_ROUTING) { SAS_DPRINTK(""ex %016llx:0x%x:D <--> ex %016llx:0x%x is not "" ""allowed\n"", SAS_ADDR(parent->sas_addr), phy_id, SAS_ADDR(phy->attached_sas_addr), phy->attached_phy_id); return NULL; } child = sas_alloc_device(); if (!child) return NULL; phy->port = sas_port_alloc(&parent->rphy->dev, phy_id); /* FIXME: better error handling */ BUG_ON(sas_port_add(phy->port) != 0); switch (phy->attached_dev_type) { case SAS_EDGE_EXPANDER_DEVICE: rphy = sas_expander_alloc(phy->port, SAS_EDGE_EXPANDER_DEVICE); break; case SAS_FANOUT_EXPANDER_DEVICE: rphy = sas_expander_alloc(phy->port, SAS_FANOUT_EXPANDER_DEVICE); break; default: rphy = NULL; /* shut gcc up */ BUG(); } port = parent->port; child->rphy = rphy; get_device(&rphy->dev); edev = rphy_to_expander_device(rphy); child->dev_type = phy->attached_dev_type; kref_get(&parent->kref); child->parent = parent; child->port = port; child->iproto = phy->attached_iproto; child->tproto = phy->attached_tproto; memcpy(child->sas_addr, phy->attached_sas_addr, SAS_ADDR_SIZE); sas_hash_addr(child->hashed_sas_addr, child->sas_addr); sas_ex_get_linkrate(parent, child, phy); edev->level = parent_ex->level + 1; parent->port->disc.max_level = max(parent->port->disc.max_level, edev->level); sas_init_dev(child); sas_fill_in_rphy(child, rphy); sas_rphy_add(rphy); spin_lock_irq(&parent->port->dev_list_lock); list_add_tail(&child->dev_list_node, &parent->port->dev_list); spin_unlock_irq(&parent->port->dev_list_lock); res = sas_discover_expander(child); if (res) { sas_rphy_delete(rphy); spin_lock_irq(&parent->port->dev_list_lock); list_del(&child->dev_list_node); spin_unlock_irq(&parent->port->dev_list_lock); sas_put_device(child); return NULL; } list_add_tail(&child->siblings, &parent->ex_dev.children); return child; } ",0 "static void print_func_help_header(struct trace_buffer *buf, struct seq_file *m, unsigned int flags) { bool tgid = flags & TRACE_ITER_RECORD_TGID; print_event_info(buf, m); seq_printf(m, ""# TASK-PID CPU# %s TIMESTAMP FUNCTION\n"", tgid ? ""TGID "" : """"); seq_printf(m, ""# | | | %s | |\n"", tgid ? "" | "" : """"); } ",0 "void AudioInputRendererHost::OnStartDevice(int stream_id, int session_id) { VLOG(1) << ""AudioInputRendererHost::OnStartDevice(stream_id="" << stream_id << "", session_id = "" << session_id << "")""; session_entries_[session_id] = stream_id; media_stream_manager_->audio_input_device_manager()->Start(session_id, this); } ",0 "struct posix_acl *orangefs_get_acl(struct inode *inode, int type) { struct posix_acl *acl; int ret; char *key = NULL, *value = NULL; switch (type) { case ACL_TYPE_ACCESS: key = XATTR_NAME_POSIX_ACL_ACCESS; break; case ACL_TYPE_DEFAULT: key = XATTR_NAME_POSIX_ACL_DEFAULT; break; default: gossip_err(""orangefs_get_acl: bogus value of type %d\n"", type); return ERR_PTR(-EINVAL); } /* * Rather than incurring a network call just to determine the exact * length of the attribute, I just allocate a max length to save on * the network call. Conceivably, we could pass NULL to * orangefs_inode_getxattr() to probe the length of the value, but * I don't do that for now. */ value = kmalloc(ORANGEFS_MAX_XATTR_VALUELEN, GFP_KERNEL); if (value == NULL) return ERR_PTR(-ENOMEM); gossip_debug(GOSSIP_ACL_DEBUG, ""inode %pU, key %s, type %d\n"", get_khandle_from_ino(inode), key, type); ret = orangefs_inode_getxattr(inode, key, value, ORANGEFS_MAX_XATTR_VALUELEN); /* if the key exists, convert it to an in-memory rep */ if (ret > 0) { acl = posix_acl_from_xattr(&init_user_ns, value, ret); } else if (ret == -ENODATA || ret == -ENOSYS) { acl = NULL; } else { gossip_err(""inode %pU retrieving acl's failed with error %d\n"", get_khandle_from_ino(inode), ret); acl = ERR_PTR(ret); } /* kfree(NULL) is safe, so don't worry if value ever got used */ kfree(value); return acl; } ",0 "int f2fs_issue_flush(struct f2fs_sb_info *sbi) { struct flush_cmd_control *fcc = SM_I(sbi)->fcc_info; struct flush_cmd cmd; int ret; if (test_opt(sbi, NOBARRIER)) return 0; if (!test_opt(sbi, FLUSH_MERGE)) { ret = submit_flush_wait(sbi); atomic_inc(&fcc->issued_flush); return ret; } if (atomic_inc_return(&fcc->issing_flush) == 1) { ret = submit_flush_wait(sbi); atomic_dec(&fcc->issing_flush); atomic_inc(&fcc->issued_flush); return ret; } init_completion(&cmd.wait); llist_add(&cmd.llnode, &fcc->issue_list); /* update issue_list before we wake up issue_flush thread */ smp_mb(); if (waitqueue_active(&fcc->flush_wait_queue)) wake_up(&fcc->flush_wait_queue); if (fcc->f2fs_issue_flush) { wait_for_completion(&cmd.wait); atomic_dec(&fcc->issing_flush); } else { struct llist_node *list; list = llist_del_all(&fcc->issue_list); if (!list) { wait_for_completion(&cmd.wait); atomic_dec(&fcc->issing_flush); } else { struct flush_cmd *tmp, *next; ret = submit_flush_wait(sbi); llist_for_each_entry_safe(tmp, next, list, llnode) { if (tmp == &cmd) { cmd.ret = ret; atomic_dec(&fcc->issing_flush); continue; } tmp->ret = ret; complete(&tmp->wait); } } } return cmd.ret; } ",0 "static int compat_do_ebt_get_ctl(struct sock *sk, int cmd, void __user *user, int *len) { int ret; struct compat_ebt_replace tmp; struct ebt_table *t; if (!capable(CAP_NET_ADMIN)) return -EPERM; /* try real handler in case userland supplied needed padding */ if ((cmd == EBT_SO_GET_INFO || cmd == EBT_SO_GET_INIT_INFO) && *len != sizeof(tmp)) return do_ebt_get_ctl(sk, cmd, user, len); if (copy_from_user(&tmp, user, sizeof(tmp))) return -EFAULT; t = find_table_lock(sock_net(sk), tmp.name, &ret, &ebt_mutex); if (!t) return ret; xt_compat_lock(NFPROTO_BRIDGE); switch (cmd) { case EBT_SO_GET_INFO: tmp.nentries = t->private->nentries; ret = compat_table_info(t->private, &tmp); if (ret) goto out; tmp.valid_hooks = t->valid_hooks; if (copy_to_user(user, &tmp, *len) != 0) { ret = -EFAULT; break; } ret = 0; break; case EBT_SO_GET_INIT_INFO: tmp.nentries = t->table->nentries; tmp.entries_size = t->table->entries_size; tmp.valid_hooks = t->table->valid_hooks; if (copy_to_user(user, &tmp, *len) != 0) { ret = -EFAULT; break; } ret = 0; break; case EBT_SO_GET_ENTRIES: case EBT_SO_GET_INIT_ENTRIES: /* * try real handler first in case of userland-side padding. * in case we are dealing with an 'ordinary' 32 bit binary * without 64bit compatibility padding, this will fail right * after copy_from_user when the *len argument is validated. * * the compat_ variant needs to do one pass over the kernel * data set to adjust for size differences before it the check. */ if (copy_everything_to_user(t, user, len, cmd) == 0) ret = 0; else ret = compat_copy_everything_to_user(t, user, len, cmd); break; default: ret = -EINVAL; } out: xt_compat_flush_offsets(NFPROTO_BRIDGE); xt_compat_unlock(NFPROTO_BRIDGE); mutex_unlock(&ebt_mutex); return ret; } ",0 "pgp_free_blob(pgp_blob_t *blob) { if (blob) { if (blob->parent) { pgp_blob_t **p; /* remove blob from list of parent's children */ for (p = &blob->parent->files; *p != NULL && *p != blob; p = &(*p)->next) ; if (*p == blob) *p = blob->next; } sc_file_free(blob->file); if (blob->data) free(blob->data); free(blob); } } ",0 " void didFailLoaderCreation() { m_callback->sendFailure(""Couldn't create a loader""); dispose(); } ",0 "e1000e_write_ext_rx_descr(E1000ECore *core, uint8_t *desc, struct NetRxPkt *pkt, const E1000E_RSSInfo *rss_info, uint16_t length) { union e1000_rx_desc_extended *d = (union e1000_rx_desc_extended *) desc; memset(&d->wb, 0, sizeof(d->wb)); d->wb.upper.length = cpu_to_le16(length); e1000e_build_rx_metadata(core, pkt, pkt != NULL, rss_info, &d->wb.lower.hi_dword.rss, &d->wb.lower.mrq, &d->wb.upper.status_error, &d->wb.lower.hi_dword.csum_ip.ip_id, &d->wb.upper.vlan); } ",0 "bool SiteInstanceImpl::HasWrongProcessForURL(const GURL& url) { if (!HasProcess()) return false; if (IsRendererDebugURL(url)) return false; if (url == url::kAboutBlankURL) return false; GURL site_url = GetSiteForURL(browsing_instance_->browser_context(), url); return !RenderProcessHostImpl::IsSuitableHost( GetProcess(), browsing_instance_->browser_context(), site_url); } ",0 "bool BrowserMainLoop::IsUsingMus() { #if defined(USE_AURA) return aura::Env::GetInstance()->mode() == aura::Env::Mode::MUS; #else return false; #endif } ",0 "void InjectedBundlePage::didCancelClientRedirectForFrame(WKBundlePageRef page, WKBundleFrameRef frame, const void* clientInfo) { static_cast(const_cast(clientInfo))->didCancelClientRedirectForFrame(frame); } ",0 " Ins_FLIPRGON( INS_ARG ) { FT_UShort I, K, L; K = (FT_UShort)args[1]; L = (FT_UShort)args[0]; if ( BOUNDS( K, CUR.pts.n_points ) || BOUNDS( L, CUR.pts.n_points ) ) { if ( CUR.pedantic_hinting ) CUR.error = TT_Err_Invalid_Reference; return; } for ( I = L; I <= K; I++ ) CUR.pts.tags[I] |= FT_CURVE_TAG_ON; } ",0 "void USBMountObserver::OpenFileBrowse(const std::string& url, const std::string& device_path, bool small) { Browser* browser; Profile* profile; profile = BrowserList::GetLastActive()->profile(); if (small) { browser = FileBrowseUI::OpenPopup(profile, url, FileBrowseUI::kSmallPopupWidth, FileBrowseUI::kSmallPopupHeight); } else { browser = FileBrowseUI::OpenPopup(profile, url, FileBrowseUI::kPopupWidth, FileBrowseUI::kPopupHeight); } registrar_.Add(this, NotificationType::BROWSER_CLOSED, Source(browser)); BrowserIterator iter = FindBrowserForPath(device_path); if (iter == browsers_.end()) { BrowserWithPath new_browser; new_browser.browser = browser; new_browser.device_path = device_path; browsers_.push_back(new_browser); } else { iter->browser = browser; } } ",0 "camera_metadata_t *place_camera_metadata(void *dst, size_t dst_size, size_t entry_capacity, size_t data_capacity) { if (dst == NULL) return NULL; size_t memory_needed = calculate_camera_metadata_size(entry_capacity, data_capacity); if (memory_needed > dst_size) return NULL; camera_metadata_t *metadata = (camera_metadata_t*)dst; metadata->version = CURRENT_METADATA_VERSION; metadata->flags = 0; metadata->entry_count = 0; metadata->entry_capacity = entry_capacity; metadata->entries_start = ALIGN_TO(sizeof(camera_metadata_t), ENTRY_ALIGNMENT); metadata->data_count = 0; metadata->data_capacity = data_capacity; metadata->size = memory_needed; size_t data_unaligned = (uint8_t*)(get_entries(metadata) + metadata->entry_capacity) - (uint8_t*)metadata; metadata->data_start = ALIGN_TO(data_unaligned, DATA_ALIGNMENT); assert(validate_camera_metadata_structure(metadata, NULL) == OK); return metadata; } ",0 "u32 blk_mq_unique_tag(struct request *rq) { struct request_queue *q = rq->q; struct blk_mq_hw_ctx *hctx; int hwq = 0; if (q->mq_ops) { hctx = q->mq_ops->map_queue(q, rq->mq_ctx->cpu); hwq = hctx->queue_num; } return (hwq << BLK_MQ_UNIQUE_TAG_BITS) | (rq->tag & BLK_MQ_UNIQUE_TAG_MASK); } ",0 "void V8Debugger::setPauseOnNextStatement(bool pause) { if (m_runningNestedMessageLoop) return; if (pause) v8::Debug::DebugBreak(m_isolate); else v8::Debug::CancelDebugBreak(m_isolate); } ",0 "static void reparent_to_kthreadd(void) { write_lock_irq(&tasklist_lock); ptrace_unlink(current); /* Reparent to init */ current->real_parent = current->parent = kthreadd_task; list_move_tail(¤t->sibling, ¤t->real_parent->children); /* Set the exit signal to SIGCHLD so we signal init on exit */ current->exit_signal = SIGCHLD; if (task_nice(current) < 0) set_user_nice(current, 0); /* cpus_allowed? */ /* rt_priority? */ /* signals? */ memcpy(current->signal->rlim, init_task.signal->rlim, sizeof(current->signal->rlim)); atomic_inc(&init_cred.usage); commit_creds(&init_cred); write_unlock_irq(&tasklist_lock); } ",0 "void mark_client_saved_ready(ClientPtr client) { if (xorg_list_is_empty(&client->ready)) xorg_list_append(&client->ready, &saved_ready_clients); } ",0 "static void rds_conn_message_info(struct socket *sock, unsigned int len, struct rds_info_iterator *iter, struct rds_info_lengths *lens, int want_send) { struct hlist_head *head; struct list_head *list; struct rds_connection *conn; struct rds_message *rm; unsigned int total = 0; unsigned long flags; size_t i; len /= sizeof(struct rds_info_message); rcu_read_lock(); for (i = 0, head = rds_conn_hash; i < ARRAY_SIZE(rds_conn_hash); i++, head++) { hlist_for_each_entry_rcu(conn, head, c_hash_node) { if (want_send) list = &conn->c_send_queue; else list = &conn->c_retrans; spin_lock_irqsave(&conn->c_lock, flags); /* XXX too lazy to maintain counts.. */ list_for_each_entry(rm, list, m_conn_item) { total++; if (total <= len) rds_inc_info_copy(&rm->m_inc, iter, conn->c_laddr, conn->c_faddr, 0); } spin_unlock_irqrestore(&conn->c_lock, flags); } } rcu_read_unlock(); lens->nr = total; lens->each = sizeof(struct rds_info_message); } ",0 "String HTMLFormElement::method() const { return FormSubmission::Attributes::methodString(m_attributes.method()); } ",0 "ExtensionPrefs::ExtensionPrefs( PrefService* prefs, const FilePath& root_dir, ExtensionPrefValueMap* extension_pref_value_map) : prefs_(prefs), install_directory_(root_dir), extension_pref_value_map_(extension_pref_value_map), content_settings_store_(new ExtensionContentSettingsStore()) { CleanupBadExtensionKeys(root_dir, prefs_); MakePathsRelative(); InitPrefStore(); content_settings_store_->AddObserver(this); } ",0 "bool xmp_files_put_xmp(XmpFilePtr xf, XmpPtr xmp) { CHECK_PTR(xf, false); CHECK_PTR(xmp, false); RESET_ERROR; auto txf = reinterpret_cast(xf); try { txf->PutXMP(*reinterpret_cast(xmp)); } catch (const XMP_Error &e) { set_error(e); return false; } return true; } ",0 "_SSL_socket (SSL_CTX *ctx, int sd) { SSL *ssl; if (!(ssl = SSL_new (ctx))) /* FATAL */ __SSL_critical_error (""SSL_new""); SSL_set_fd (ssl, sd); if (ctx->method == SSLv23_client_method()) SSL_set_connect_state (ssl); else SSL_set_accept_state(ssl); return (ssl); } ",0 "static void HTMLElementAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueFast(info, WTF::GetPtr(impl->htmlElementAttribute()), impl); } ",0 "pdf14_clist_update_params(pdf14_clist_device * pdev, const gs_gstate * pgs, bool crop_blend_params, gs_pdf14trans_params_t *group_params) { gs_pdf14trans_params_t params = { 0 }; gx_device * pcdev; int changed = 0; int code = 0; gs_composite_t *pct_new = NULL; params.crop_blend_params = crop_blend_params; params.pdf14_op = PDF14_SET_BLEND_PARAMS; if (pgs->blend_mode != pdev->blend_mode) { changed |= PDF14_SET_BLEND_MODE; params.blend_mode = pdev->blend_mode = pgs->blend_mode; } if (pgs->text_knockout != pdev->text_knockout) { changed |= PDF14_SET_TEXT_KNOCKOUT; params.text_knockout = pdev->text_knockout = pgs->text_knockout; } if (pgs->shape.alpha != pdev->shape) { changed |= PDF14_SET_SHAPE_ALPHA; params.shape.alpha = pdev->shape = pgs->shape.alpha; } if (pgs->opacity.alpha != pdev->opacity) { changed |= PDF14_SET_OPACITY_ALPHA; params.opacity.alpha = pdev->opacity = pgs->opacity.alpha; } if (pgs->overprint != pdev->overprint) { changed |= PDF14_SET_OVERPRINT; params.overprint = pdev->overprint = pgs->overprint; } if (pgs->overprint_mode != pdev->overprint_mode) { changed |= PDF14_SET_OVERPRINT_MODE; params.overprint_mode = pdev->overprint_mode = pgs->overprint_mode; } if (crop_blend_params) { params.ctm = group_params->ctm; params.bbox = group_params->bbox; } params.changed = changed; /* Avoid recursion when we have a PDF14_SET_BLEND_PARAMS forced and apply now to the target. Otherwise we send of te compositor action to the pdf14 device at this time. This is due to the fact that we need to often perform this operation when we are already starting to do a compositor action */ if (changed != 0) { code = gs_create_pdf14trans(&pct_new, ¶ms, pgs->memory); if (code < 0) return code; code = dev_proc(pdev->target, create_compositor) (pdev->target, &pcdev, pct_new, (gs_gstate *)pgs, pgs->memory, NULL); gs_free_object(pgs->memory, pct_new, ""pdf14_clist_update_params""); } return code; } ",0 "static int vmx_interrupt_allowed(struct kvm_vcpu *vcpu) { return (!to_vmx(vcpu)->nested.nested_run_pending && vmcs_readl(GUEST_RFLAGS) & X86_EFLAGS_IF) && !(vmcs_read32(GUEST_INTERRUPTIBILITY_INFO) & (GUEST_INTR_STATE_STI | GUEST_INTR_STATE_MOV_SS)); } ",0 "config_vars( config_tree *ptree ) { attr_val *curr_var; int len; curr_var = HEAD_PFIFO(ptree->vars); for (; curr_var != NULL; curr_var = curr_var->link) { /* Determine which variable to set and set it */ switch (curr_var->attr) { case T_Broadcastdelay: proto_config(PROTO_BROADDELAY, 0, curr_var->value.d, NULL); break; case T_Tick: proto_config(PROTO_ADJ, 0, curr_var->value.d, NULL); break; case T_Driftfile: if ('\0' == curr_var->value.s[0]) { stats_drift_file = 0; msyslog(LOG_INFO, ""config: driftfile disabled\n""); } else stats_config(STATS_FREQ_FILE, curr_var->value.s); break; case T_Ident: sys_ident = curr_var->value.s; break; case T_WanderThreshold: /* FALLTHROUGH */ case T_Nonvolatile: wander_threshold = curr_var->value.d; break; case T_Leapfile: stats_config(STATS_LEAP_FILE, curr_var->value.s); break; case T_Pidfile: stats_config(STATS_PID_FILE, curr_var->value.s); break; case T_Logfile: if (-1 == change_logfile(curr_var->value.s, 0)) msyslog(LOG_ERR, ""Cannot open logfile %s: %m"", curr_var->value.s); break; case T_Saveconfigdir: if (saveconfigdir != NULL) free(saveconfigdir); len = strlen(curr_var->value.s); if (0 == len) { saveconfigdir = NULL; } else if (DIR_SEP != curr_var->value.s[len - 1] #ifdef SYS_WINNT /* slash is also a dir. sep. on Windows */ && '/' != curr_var->value.s[len - 1] #endif ) { len++; saveconfigdir = emalloc(len + 1); snprintf(saveconfigdir, len + 1, ""%s%c"", curr_var->value.s, DIR_SEP); } else { saveconfigdir = estrdup( curr_var->value.s); } break; case T_Automax: #ifdef AUTOKEY sys_automax = curr_var->value.i; #endif break; default: msyslog(LOG_ERR, ""config_vars(): unexpected token %d"", curr_var->attr); } } } ",0 "static inline int all_zeroes(__le32 *p, __le32 *q) { while (p < q) if (*p++) return 0; return 1; } ",0 "void QQuickWebViewPrivate::handleProxyAuthenticationRequiredRequest(const QString& hostname, uint16_t port, const QString& prefilledUsername, QString& username, QString& password) { Q_Q(QQuickWebView); QtDialogRunner dialogRunner(q); if (!dialogRunner.initForProxyAuthentication(hostname, port, prefilledUsername)) return; dialogRunner.run(); username = dialogRunner.username(); password = dialogRunner.password(); } ",0 "static void do_shm_rmid(struct ipc_namespace *ns, struct kern_ipc_perm *ipcp) { struct shmid_kernel *shp; shp = container_of(ipcp, struct shmid_kernel, shm_perm); if (shp->shm_nattch) { shp->shm_perm.mode |= SHM_DEST; /* Do not find it any more */ shp->shm_perm.key = IPC_PRIVATE; shm_unlock(shp); } else shm_destroy(ns, shp); } ",0 "void kvm_arch_vcpu_put(struct kvm_vcpu *vcpu) { } ",0 "void Document::decrementActiveParserCount() { --m_activeParserCount; if (!frame()) return; #if ENABLE(THREADED_HTML_PARSER) loader()->checkLoadComplete(); #endif frame()->loader()->checkLoadComplete(); } ",0 " TestResourceMultiBuffer* multibuffer() { return url_index_->last_url_data()->test_multibuffer(); } ",0 "xsltCopyNamespace(xsltTransformContextPtr ctxt ATTRIBUTE_UNUSED, xmlNodePtr elem, xmlNsPtr ns) { if ((ns == NULL) || (ns->type != XML_NAMESPACE_DECL)) return(NULL); /* * One can add namespaces only on element nodes */ if ((elem != NULL) && (elem->type != XML_ELEMENT_NODE)) return(xmlNewNs(NULL, ns->href, ns->prefix)); else return(xmlNewNs(elem, ns->href, ns->prefix)); } ",0 "acl_new_entry(struct archive_acl *acl, int type, int permset, int tag, int id) { struct archive_acl_entry *ap, *aq; /* Type argument must be a valid NFS4 or POSIX.1e type. * The type must agree with anything already set and * the permset must be compatible. */ if (type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) { if (acl->acl_types & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) { return (NULL); } if (permset & ~(ARCHIVE_ENTRY_ACL_PERMS_NFS4 | ARCHIVE_ENTRY_ACL_INHERITANCE_NFS4)) { return (NULL); } } else if (type & ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) { if (acl->acl_types & ~ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) { return (NULL); } if (permset & ~ARCHIVE_ENTRY_ACL_PERMS_POSIX1E) { return (NULL); } } else { return (NULL); } /* Verify the tag is valid and compatible with NFS4 or POSIX.1e. */ switch (tag) { case ARCHIVE_ENTRY_ACL_USER: case ARCHIVE_ENTRY_ACL_USER_OBJ: case ARCHIVE_ENTRY_ACL_GROUP: case ARCHIVE_ENTRY_ACL_GROUP_OBJ: /* Tags valid in both NFS4 and POSIX.1e */ break; case ARCHIVE_ENTRY_ACL_MASK: case ARCHIVE_ENTRY_ACL_OTHER: /* Tags valid only in POSIX.1e. */ if (type & ~ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) { return (NULL); } break; case ARCHIVE_ENTRY_ACL_EVERYONE: /* Tags valid only in NFS4. */ if (type & ~ARCHIVE_ENTRY_ACL_TYPE_NFS4) { return (NULL); } break; default: /* No other values are valid. */ return (NULL); } if (acl->acl_text_w != NULL) { free(acl->acl_text_w); acl->acl_text_w = NULL; } if (acl->acl_text != NULL) { free(acl->acl_text); acl->acl_text = NULL; } /* * If there's a matching entry already in the list, overwrite it. * NFSv4 entries may be repeated and are not overwritten. * * TODO: compare names of no id is provided (needs more rework) */ ap = acl->acl_head; aq = NULL; while (ap != NULL) { if (((type & ARCHIVE_ENTRY_ACL_TYPE_NFS4) == 0) && ap->type == type && ap->tag == tag && ap->id == id) { if (id != -1 || (tag != ARCHIVE_ENTRY_ACL_USER && tag != ARCHIVE_ENTRY_ACL_GROUP)) { ap->permset = permset; return (ap); } } aq = ap; ap = ap->next; } /* Add a new entry to the end of the list. */ ap = (struct archive_acl_entry *)calloc(1, sizeof(*ap)); if (ap == NULL) return (NULL); if (aq == NULL) acl->acl_head = ap; else aq->next = ap; ap->type = type; ap->tag = tag; ap->id = id; ap->permset = permset; acl->acl_types |= type; return (ap); } ",0 "void RenderThreadImpl::SetFlingCurveParameters( const std::vector& new_touchpad, const std::vector& new_touchscreen) { webkit_platform_support_->SetFlingCurveParameters(new_touchpad, new_touchscreen); } ",0 "void red_channel_client_pipe_add_tail_no_push(RedChannelClient *rcc, PipeItem *item) { spice_assert(rcc); rcc->pipe_size++; ring_add_before(&item->link, &rcc->pipe); } ",0 "static int hot_add_disk(struct mddev *mddev, dev_t dev) { char b[BDEVNAME_SIZE]; int err; struct md_rdev *rdev; if (!mddev->pers) return -ENODEV; if (mddev->major_version != 0) { printk(KERN_WARNING ""%s: HOT_ADD may only be used with"" "" version-0 superblocks.\n"", mdname(mddev)); return -EINVAL; } if (!mddev->pers->hot_add_disk) { printk(KERN_WARNING ""%s: personality does not support diskops!\n"", mdname(mddev)); return -EINVAL; } rdev = md_import_device(dev, -1, 0); if (IS_ERR(rdev)) { printk(KERN_WARNING ""md: error, md_import_device() returned %ld\n"", PTR_ERR(rdev)); return -EINVAL; } if (mddev->persistent) rdev->sb_start = calc_dev_sboffset(rdev); else rdev->sb_start = i_size_read(rdev->bdev->bd_inode) / 512; rdev->sectors = rdev->sb_start; if (test_bit(Faulty, &rdev->flags)) { printk(KERN_WARNING ""md: can not hot-add faulty %s disk to %s!\n"", bdevname(rdev->bdev,b), mdname(mddev)); err = -EINVAL; goto abort_export; } if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_start(mddev); clear_bit(In_sync, &rdev->flags); rdev->desc_nr = -1; rdev->saved_raid_disk = -1; err = bind_rdev_to_array(rdev, mddev); if (err) goto abort_clustered; /* * The rest should better be atomic, we can have disk failures * noticed in interrupt contexts ... */ rdev->raid_disk = -1; md_update_sb(mddev, 1); if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_finish(mddev); /* * Kick recovery, maybe this spare has to be added to the * array immediately. */ set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); md_new_event(mddev); return 0; abort_clustered: if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_cancel(mddev); abort_export: export_rdev(rdev); return err; } ",0 "void pdf_delete(pdf_t *pdf) { int i; for (i=0; in_xrefs; i++) { free(pdf->xrefs[i].creator); free(pdf->xrefs[i].entries); free(pdf->xrefs[i].kids); } free(pdf->name); free(pdf->xrefs); free(pdf); } ",0 "void VirtualAuthenticator::GetUniqueId(GetUniqueIdCallback callback) { std::move(callback).Run(unique_id_); } ",0 "static void set_emss(struct iwch_ep *ep, u16 opt) { PDBG(""%s ep %p opt %u\n"", __func__, ep, opt); ep->emss = T3C_DATA(ep->com.tdev)->mtus[G_TCPOPT_MSS(opt)] - 40; if (G_TCPOPT_TSTAMP(opt)) ep->emss -= 12; if (ep->emss < 128) ep->emss = 128; PDBG(""emss=%d\n"", ep->emss); } ",0 "static int __hwahc_op_mmcie_add(struct wusbhc *wusbhc, u8 interval, u8 repeat_cnt, u8 handle, struct wuie_hdr *wuie) { struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc); struct wahc *wa = &hwahc->wa; u8 iface_no = wa->usb_iface->cur_altsetting->desc.bInterfaceNumber; return usb_control_msg(wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0), WUSB_REQ_ADD_MMC_IE, USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, interval << 8 | repeat_cnt, handle << 8 | iface_no, wuie, wuie->bLength, USB_CTRL_SET_TIMEOUT); } ",0 "void PrintWebViewHelper::RequestPrintPreview() { old_print_pages_params_.reset(); Send(new PrintHostMsg_RequestPrintPreview(routing_id())); } ",0 "static void btreeParseCellPtr( MemPage *pPage, /* Page containing the cell */ u8 *pCell, /* Pointer to the cell text. */ CellInfo *pInfo /* Fill in this structure */ ){ u8 *pIter; /* For scanning through pCell */ u32 nPayload; /* Number of bytes of cell payload */ u64 iKey; /* Extracted Key value */ assert( sqlite3_mutex_held(pPage->pBt->mutex) ); assert( pPage->leaf==0 || pPage->leaf==1 ); assert( pPage->intKeyLeaf ); assert( pPage->childPtrSize==0 ); pIter = pCell; /* The next block of code is equivalent to: ** ** pIter += getVarint32(pIter, nPayload); ** ** The code is inlined to avoid a function call. */ nPayload = *pIter; if( nPayload>=0x80 ){ u8 *pEnd = &pIter[8]; nPayload &= 0x7f; do{ nPayload = (nPayload<<7) | (*++pIter & 0x7f); }while( (*pIter)>=0x80 && pIternKey); ** ** The code is inlined to avoid a function call. */ iKey = *pIter; if( iKey>=0x80 ){ u8 *pEnd = &pIter[7]; iKey &= 0x7f; while(1){ iKey = (iKey<<7) | (*++pIter & 0x7f); if( (*pIter)<0x80 ) break; if( pIter>=pEnd ){ iKey = (iKey<<8) | *++pIter; break; } } } pIter++; pInfo->nKey = *(i64*)&iKey; pInfo->nPayload = nPayload; pInfo->pPayload = pIter; testcase( nPayload==pPage->maxLocal ); testcase( nPayload==pPage->maxLocal+1 ); if( nPayload<=pPage->maxLocal ){ /* This is the (easy) common case where the entire payload fits ** on the local page. No overflow is required. */ pInfo->nSize = nPayload + (u16)(pIter - pCell); if( pInfo->nSize<4 ) pInfo->nSize = 4; pInfo->nLocal = (u16)nPayload; }else{ btreeParseCellAdjustSizeForOverflow(pPage, pCell, pInfo); } } ",0 "Element* Document::ElementFromPoint(int x, int y) const { if (GetLayoutViewItem().IsNull()) return nullptr; return TreeScope::ElementFromPoint(x, y); } ",0 "sctp_disposition_t sctp_sf_eat_data_fast_4_4(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *chunk = arg; int error; if (!sctp_vtag_verify(chunk, asoc)) { sctp_add_cmd_sf(commands, SCTP_CMD_REPORT_BAD_TAG, SCTP_NULL()); return sctp_sf_pdiscard(net, ep, asoc, type, arg, commands); } if (!sctp_chunk_length_valid(chunk, sizeof(sctp_data_chunk_t))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands); error = sctp_eat_data(asoc, chunk, commands ); switch (error) { case SCTP_IERROR_NO_ERROR: case SCTP_IERROR_HIGH_TSN: case SCTP_IERROR_DUP_TSN: case SCTP_IERROR_IGNORE_TSN: case SCTP_IERROR_BAD_STREAM: break; case SCTP_IERROR_NO_DATA: goto consume; case SCTP_IERROR_PROTO_VIOLATION: return sctp_sf_abort_violation(net, ep, asoc, chunk, commands, (u8 *)chunk->subh.data_hdr, sizeof(sctp_datahdr_t)); default: BUG(); } /* Go a head and force a SACK, since we are shutting down. */ /* Implementor's Guide. * * While in SHUTDOWN-SENT state, the SHUTDOWN sender MUST immediately * respond to each received packet containing one or more DATA chunk(s) * with a SACK, a SHUTDOWN chunk, and restart the T2-shutdown timer */ if (chunk->end_of_packet) { /* We must delay the chunk creation since the cumulative * TSN has not been updated yet. */ sctp_add_cmd_sf(commands, SCTP_CMD_GEN_SHUTDOWN, SCTP_NULL()); sctp_add_cmd_sf(commands, SCTP_CMD_GEN_SACK, SCTP_FORCE()); sctp_add_cmd_sf(commands, SCTP_CMD_TIMER_RESTART, SCTP_TO(SCTP_EVENT_TIMEOUT_T2_SHUTDOWN)); } consume: return SCTP_DISPOSITION_CONSUME; } ",0 "void DownloadItemImpl::Cancel(bool user_cancel) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); last_reason_ = user_cancel ? content::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED : content::DOWNLOAD_INTERRUPT_REASON_USER_SHUTDOWN; VLOG(20) << __FUNCTION__ << ""() download = "" << DebugString(true); if (!IsPartialDownload()) { return; } download_stats::RecordDownloadCount(download_stats::CANCELLED_COUNT); TransitionTo(CANCELLED); if (user_cancel) delegate_->DownloadStopped(this); } ",0 "DevToolsWindow* DevToolsWindow::FindDevToolsWindow( DevToolsAgentHost* agent_host) { DevToolsWindows* instances = &g_instances.Get(); content::DevToolsManager* manager = content::DevToolsManager::GetInstance(); for (DevToolsWindows::iterator it(instances->begin()); it != instances->end(); ++it) { if (manager->GetDevToolsAgentHostFor((*it)->frontend_host_.get()) == agent_host) return *it; } return NULL; } ",0 "void ThreadWatcherObserver::SetupNotifications( const base::TimeDelta& wakeup_interval) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); ThreadWatcherObserver* observer = new ThreadWatcherObserver(wakeup_interval); observer->registrar_.Add( observer, chrome::NOTIFICATION_BROWSER_OPENED, content::NotificationService::AllBrowserContextsAndSources()); observer->registrar_.Add(observer, chrome::NOTIFICATION_BROWSER_CLOSED, content::NotificationService::AllSources()); observer->registrar_.Add(observer, chrome::NOTIFICATION_TAB_PARENTED, content::NotificationService::AllSources()); observer->registrar_.Add(observer, chrome::NOTIFICATION_TAB_CLOSING, content::NotificationService::AllSources()); observer->registrar_.Add(observer, content::NOTIFICATION_LOAD_START, content::NotificationService::AllSources()); observer->registrar_.Add(observer, content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); observer->registrar_.Add(observer, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, content::NotificationService::AllSources()); observer->registrar_.Add(observer, content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, content::NotificationService::AllSources()); observer->omnibox_url_opened_subscription_ = OmniboxEventGlobalTracker::GetInstance()->RegisterCallback( base::Bind(&ThreadWatcherObserver::OnURLOpenedFromOmnibox, base::Unretained(observer))); } ",0 "static inline bool tcp_sack_extend(struct tcp_sack_block *sp, u32 seq, u32 end_seq) { if (!after(seq, sp->end_seq) && !after(sp->start_seq, end_seq)) { if (before(seq, sp->start_seq)) sp->start_seq = seq; if (after(end_seq, sp->end_seq)) sp->end_seq = end_seq; return true; } return false; } ",0 "void LocalFrameClientImpl::ScrollRectToVisibleInParentFrame( const WebRect& rect_to_scroll, const WebScrollIntoViewParams& params) { web_frame_->Client()->ScrollRectToVisibleInParentFrame(rect_to_scroll, params); } ",0 "ExtensionsUpdatedObserver::ExtensionsUpdatedObserver( ExtensionProcessManager* manager, AutomationProvider* automation, IPC::Message* reply_message) : manager_(manager), automation_(automation->AsWeakPtr()), reply_message_(reply_message), updater_finished_(false) { registrar_.Add(this, content::NOTIFICATION_LOAD_STOP, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_INSTALL_NOT_ALLOWED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATE_FOUND, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_EXTENSION_UPDATING_FINISHED, content::NotificationService::AllSources()); } ",0 "void AXLayoutObject::ariaOwnsElements(AXObjectVector& owns) const { accessibilityChildrenFromAttribute(aria_ownsAttr, owns); } ",0 "void echoCommand(client *c) { addReplyBulk(c,c->argv[1]); } ",0 "PS_SERIALIZER_ENCODE_FUNC(wddx) { wddx_packet *packet; zend_string *str; PS_ENCODE_VARS; packet = php_wddx_constructor(); php_wddx_packet_start(packet, NULL, 0); php_wddx_add_chunk_static(packet, WDDX_STRUCT_S); PS_ENCODE_LOOP( php_wddx_serialize_var(packet, struc, key); ); php_wddx_add_chunk_static(packet, WDDX_STRUCT_E); php_wddx_packet_end(packet); smart_str_0(packet); str = zend_string_copy(packet->s); php_wddx_destructor(packet); return str; } ",0 "void TestScopedKeyboardHook::LockSpecificKey(ui::DomCode dom_code) { keyboard_lock_active_ = true; locked_key_ = dom_code; } ",0 "void EnsureCookiesFlushed(BrowserContext* browser_context) { BrowserContext::ForEachStoragePartition( browser_context, base::BindRepeating([](StoragePartition* partition) { base::RunLoop run_loop; partition->GetCookieManagerForBrowserProcess()->FlushCookieStore( run_loop.QuitClosure()); run_loop.Run(); })); } ",0 "void HttpProxyClientSocket::DoCallback(int result) { DCHECK_NE(ERR_IO_PENDING, result); DCHECK(!user_callback_.is_null()); CompletionCallback c = user_callback_; user_callback_.Reset(); c.Run(result); } ",0 "static int crypto_givcipher_report(struct sk_buff *skb, struct crypto_alg *alg) { return -ENOSYS; } ",0 "static bool ExecuteMoveDownAndModifySelection(LocalFrame& frame, Event*, EditorCommandSource, const String&) { frame.Selection().Modify(SelectionModifyAlteration::kExtend, SelectionModifyDirection::kForward, TextGranularity::kLine, SetSelectionBy::kUser); return true; } ",0 "static int TSS_checkhmac1(unsigned char *buffer, const uint32_t command, const unsigned char *ononce, const unsigned char *key, unsigned int keylen, ...) { uint32_t bufsize; uint16_t tag; uint32_t ordinal; uint32_t result; unsigned char *enonce; unsigned char *continueflag; unsigned char *authdata; unsigned char testhmac[SHA1_DIGEST_SIZE]; unsigned char paramdigest[SHA1_DIGEST_SIZE]; struct sdesc *sdesc; unsigned int dlen; unsigned int dpos; va_list argp; int ret; bufsize = LOAD32(buffer, TPM_SIZE_OFFSET); tag = LOAD16(buffer, 0); ordinal = command; result = LOAD32N(buffer, TPM_RETURN_OFFSET); if (tag == TPM_TAG_RSP_COMMAND) return 0; if (tag != TPM_TAG_RSP_AUTH1_COMMAND) return -EINVAL; authdata = buffer + bufsize - SHA1_DIGEST_SIZE; continueflag = authdata - 1; enonce = continueflag - TPM_NONCE_SIZE; sdesc = init_sdesc(hashalg); if (IS_ERR(sdesc)) { pr_info(""trusted_key: can't alloc %s\n"", hash_alg); return PTR_ERR(sdesc); } ret = crypto_shash_init(&sdesc->shash); if (ret < 0) goto out; ret = crypto_shash_update(&sdesc->shash, (const u8 *)&result, sizeof result); if (ret < 0) goto out; ret = crypto_shash_update(&sdesc->shash, (const u8 *)&ordinal, sizeof ordinal); if (ret < 0) goto out; va_start(argp, keylen); for (;;) { dlen = va_arg(argp, unsigned int); if (dlen == 0) break; dpos = va_arg(argp, unsigned int); ret = crypto_shash_update(&sdesc->shash, buffer + dpos, dlen); if (ret < 0) break; } va_end(argp); if (!ret) ret = crypto_shash_final(&sdesc->shash, paramdigest); if (ret < 0) goto out; ret = TSS_rawhmac(testhmac, key, keylen, SHA1_DIGEST_SIZE, paramdigest, TPM_NONCE_SIZE, enonce, TPM_NONCE_SIZE, ononce, 1, continueflag, 0, 0); if (ret < 0) goto out; if (memcmp(testhmac, authdata, SHA1_DIGEST_SIZE)) ret = -EINVAL; out: kzfree(sdesc); return ret; } ",0 " TemplateURLRef::SearchTermsArgs::ContextualSearchParams::ContextualSearchParams( int version, const std::string& selection, const std::string& base_page_url, int now_on_tap_version) : version(version), start(base::string16::npos), end(base::string16::npos), selection(selection), base_page_url(base_page_url), now_on_tap_version(now_on_tap_version) {} ",1 "MojoResult Core::Close(MojoHandle handle) { RequestContext request_context; scoped_refptr dispatcher; { base::AutoLock lock(handles_->GetLock()); MojoResult rv = handles_->GetAndRemoveDispatcher(handle, &dispatcher); if (rv != MOJO_RESULT_OK) return rv; } dispatcher->Close(); return MOJO_RESULT_OK; } ",0 " void FindInterceptPatternMatchInDatabase() { FindInterceptPatternMatch(true); } ",0 "sg_open(struct inode *inode, struct file *filp) { int dev = iminor(inode); int flags = filp->f_flags; struct request_queue *q; Sg_device *sdp; Sg_fd *sfp; int retval; nonseekable_open(inode, filp); if ((flags & O_EXCL) && (O_RDONLY == (flags & O_ACCMODE))) return -EPERM; /* Can't lock it with read only access */ sdp = sg_get_dev(dev); if (IS_ERR(sdp)) return PTR_ERR(sdp); SCSI_LOG_TIMEOUT(3, sg_printk(KERN_INFO, sdp, ""sg_open: flags=0x%x\n"", flags)); /* This driver's module count bumped by fops_get in */ /* Prevent the device driver from vanishing while we sleep */ retval = scsi_device_get(sdp->device); if (retval) goto sg_put; retval = scsi_autopm_get_device(sdp->device); if (retval) goto sdp_put; /* scsi_block_when_processing_errors() may block so bypass * check if O_NONBLOCK. Permits SCSI commands to be issued * during error recovery. Tread carefully. */ if (!((flags & O_NONBLOCK) || scsi_block_when_processing_errors(sdp->device))) { retval = -ENXIO; /* we are in error recovery for this device */ goto error_out; } mutex_lock(&sdp->open_rel_lock); if (flags & O_NONBLOCK) { if (flags & O_EXCL) { if (sdp->open_cnt > 0) { retval = -EBUSY; goto error_mutex_locked; } } else { if (sdp->exclude) { retval = -EBUSY; goto error_mutex_locked; } } } else { retval = open_wait(sdp, flags); if (retval) /* -ERESTARTSYS or -ENODEV */ goto error_mutex_locked; } /* N.B. at this point we are holding the open_rel_lock */ if (flags & O_EXCL) sdp->exclude = true; if (sdp->open_cnt < 1) { /* no existing opens */ sdp->sgdebug = 0; q = sdp->device->request_queue; sdp->sg_tablesize = queue_max_segments(q); } sfp = sg_add_sfp(sdp); if (IS_ERR(sfp)) { retval = PTR_ERR(sfp); goto out_undo; } filp->private_data = sfp; sdp->open_cnt++; mutex_unlock(&sdp->open_rel_lock); retval = 0; sg_put: kref_put(&sdp->d_ref, sg_device_destroy); return retval; out_undo: if (flags & O_EXCL) { sdp->exclude = false; /* undo if error */ wake_up_interruptible(&sdp->open_wait); } error_mutex_locked: mutex_unlock(&sdp->open_rel_lock); error_out: scsi_autopm_put_device(sdp->device); sdp_put: scsi_device_put(sdp->device); goto sg_put; } ",0 "int sock_create_kern(struct net *net, int family, int type, int protocol, struct socket **res) { return __sock_create(net, family, type, protocol, res, 1); } ",0 "void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */ { zend_function *func; zend_abstract_info ai; if ((ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) && !(ce->ce_flags & (ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) { memset(&ai, 0, sizeof(ai)); ZEND_HASH_FOREACH_PTR(&ce->function_table, func) { zend_verify_abstract_class_function(func, &ai); } ZEND_HASH_FOREACH_END(); if (ai.cnt) { zend_error_noreturn(E_ERROR, ""Class %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods ("" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT "")"", ZSTR_VAL(ce->name), ai.cnt, ai.cnt > 1 ? ""s"" : """", DISPLAY_ABSTRACT_FN(0), DISPLAY_ABSTRACT_FN(1), DISPLAY_ABSTRACT_FN(2) ); } } } /* }}} */ ",0 "int X509_REQ_check_private_key(X509_REQ *x, EVP_PKEY *k) { EVP_PKEY *xk = NULL; int ok = 0; xk = X509_REQ_get_pubkey(x); switch (EVP_PKEY_cmp(xk, k)) { case 1: ok = 1; break; case 0: X509err(X509_F_X509_REQ_CHECK_PRIVATE_KEY, X509_R_KEY_VALUES_MISMATCH); break; case -1: X509err(X509_F_X509_REQ_CHECK_PRIVATE_KEY, X509_R_KEY_TYPE_MISMATCH); break; case -2: #ifndef OPENSSL_NO_EC if (k->type == EVP_PKEY_EC) { X509err(X509_F_X509_REQ_CHECK_PRIVATE_KEY, ERR_R_EC_LIB); break; } #endif #ifndef OPENSSL_NO_DH if (k->type == EVP_PKEY_DH) { /* No idea */ X509err(X509_F_X509_REQ_CHECK_PRIVATE_KEY, X509_R_CANT_CHECK_DH_KEY); break; } #endif X509err(X509_F_X509_REQ_CHECK_PRIVATE_KEY, X509_R_UNKNOWN_KEY_TYPE); } EVP_PKEY_free(xk); return (ok); } ",0 "void InspectorOverlay::paint(GraphicsContext& context) { if (isEmpty()) return; GraphicsContextStateSaver stateSaver(context); FrameView* view = overlayPage()->mainFrame()->view(); ASSERT(!view->needsLayout()); view->paint(&context, IntRect(0, 0, view->width(), view->height())); } ",0 "conn *conn_new(const int sfd, enum conn_states init_state, const int event_flags, const int read_buffer_size, enum network_transport transport, struct event_base *base, void *ssl) { conn *c; assert(sfd >= 0 && sfd < max_fds); c = conns[sfd]; if (NULL == c) { if (!(c = (conn *)calloc(1, sizeof(conn)))) { STATS_LOCK(); stats.malloc_fails++; STATS_UNLOCK(); fprintf(stderr, ""Failed to allocate connection object\n""); return NULL; } MEMCACHED_CONN_CREATE(c); c->read = NULL; c->sendmsg = NULL; c->write = NULL; c->rbuf = c->wbuf = 0; c->ilist = 0; c->suffixlist = 0; c->iov = 0; c->msglist = 0; c->hdrbuf = 0; c->rsize = read_buffer_size; c->wsize = DATA_BUFFER_SIZE; c->isize = ITEM_LIST_INITIAL; c->suffixsize = SUFFIX_LIST_INITIAL; c->iovsize = IOV_LIST_INITIAL; c->msgsize = MSG_LIST_INITIAL; c->hdrsize = 0; c->rbuf = (char *)malloc((size_t)c->rsize); c->wbuf = (char *)malloc((size_t)c->wsize); c->ilist = (item **)malloc(sizeof(item *) * c->isize); c->suffixlist = (char **)malloc(sizeof(char *) * c->suffixsize); c->iov = (struct iovec *)malloc(sizeof(struct iovec) * c->iovsize); c->msglist = (struct msghdr *)malloc(sizeof(struct msghdr) * c->msgsize); if (c->rbuf == 0 || c->wbuf == 0 || c->ilist == 0 || c->iov == 0 || c->msglist == 0 || c->suffixlist == 0) { conn_free(c); STATS_LOCK(); stats.malloc_fails++; STATS_UNLOCK(); fprintf(stderr, ""Failed to allocate buffers for connection\n""); return NULL; } STATS_LOCK(); stats_state.conn_structs++; STATS_UNLOCK(); c->sfd = sfd; conns[sfd] = c; } c->transport = transport; c->protocol = settings.binding_protocol; /* unix socket mode doesn't need this, so zeroed out. but why * is this done for every command? presumably for UDP * mode. */ if (!settings.socketpath) { c->request_addr_size = sizeof(c->request_addr); } else { c->request_addr_size = 0; } if (transport == tcp_transport && init_state == conn_new_cmd) { if (getpeername(sfd, (struct sockaddr *) &c->request_addr, &c->request_addr_size)) { perror(""getpeername""); memset(&c->request_addr, 0, sizeof(c->request_addr)); } } if (settings.verbose > 1) { if (init_state == conn_listening) { fprintf(stderr, ""<%d server listening (%s)\n"", sfd, prot_text(c->protocol)); } else if (IS_UDP(transport)) { fprintf(stderr, ""<%d server listening (udp)\n"", sfd); } else if (c->protocol == negotiating_prot) { fprintf(stderr, ""<%d new auto-negotiating client connection\n"", sfd); } else if (c->protocol == ascii_prot) { fprintf(stderr, ""<%d new ascii client connection.\n"", sfd); } else if (c->protocol == binary_prot) { fprintf(stderr, ""<%d new binary client connection.\n"", sfd); } else { fprintf(stderr, ""<%d new unknown (%d) client connection\n"", sfd, c->protocol); assert(false); } } #ifdef TLS c->ssl = NULL; c->ssl_wbuf = NULL; c->ssl_enabled = false; #endif c->state = init_state; c->rlbytes = 0; c->cmd = -1; c->rbytes = c->wbytes = 0; c->wcurr = c->wbuf; c->rcurr = c->rbuf; c->ritem = 0; c->icurr = c->ilist; c->suffixcurr = c->suffixlist; c->ileft = 0; c->suffixleft = 0; c->iovused = 0; c->msgcurr = 0; c->msgused = 0; c->sasl_started = false; c->authenticated = false; c->last_cmd_time = current_time; /* initialize for idle kicker */ #ifdef EXTSTORE c->io_wraplist = NULL; c->io_wrapleft = 0; #endif c->write_and_go = init_state; c->write_and_free = 0; c->item = 0; c->noreply = false; #ifdef TLS if (ssl) { c->ssl = (SSL*)ssl; c->read = ssl_read; c->sendmsg = ssl_sendmsg; c->write = ssl_write; c->ssl_enabled = true; SSL_set_info_callback(c->ssl, ssl_callback); } else #else assert(ssl == NULL); #endif { c->read = tcp_read; c->sendmsg = tcp_sendmsg; c->write = tcp_write; } event_set(&c->event, sfd, event_flags, event_handler, (void *)c); event_base_set(base, &c->event); c->ev_flags = event_flags; if (event_add(&c->event, 0) == -1) { perror(""event_add""); return NULL; } STATS_LOCK(); stats_state.curr_conns++; stats.total_conns++; STATS_UNLOCK(); MEMCACHED_CONN_ALLOCATE(c->sfd); return c; } ",0 "_xdr_kadm5_principal_ent_rec(XDR *xdrs, kadm5_principal_ent_rec *objp, int v) { unsigned int n; if (!xdr_krb5_principal(xdrs, &objp->principal)) { return (FALSE); } if (!xdr_krb5_timestamp(xdrs, &objp->princ_expire_time)) { return (FALSE); } if (!xdr_krb5_timestamp(xdrs, &objp->last_pwd_change)) { return (FALSE); } if (!xdr_krb5_timestamp(xdrs, &objp->pw_expiration)) { return (FALSE); } if (!xdr_krb5_deltat(xdrs, &objp->max_life)) { return (FALSE); } if (!xdr_nulltype(xdrs, (void **) &objp->mod_name, xdr_krb5_principal)) { return (FALSE); } if (!xdr_krb5_timestamp(xdrs, &objp->mod_date)) { return (FALSE); } if (!xdr_krb5_flags(xdrs, &objp->attributes)) { return (FALSE); } if (!xdr_krb5_kvno(xdrs, &objp->kvno)) { return (FALSE); } if (!xdr_krb5_kvno(xdrs, &objp->mkvno)) { return (FALSE); } if (!xdr_nullstring(xdrs, &objp->policy)) { return (FALSE); } if (!xdr_long(xdrs, &objp->aux_attributes)) { return (FALSE); } if (!xdr_krb5_deltat(xdrs, &objp->max_renewable_life)) { return (FALSE); } if (!xdr_krb5_timestamp(xdrs, &objp->last_success)) { return (FALSE); } if (!xdr_krb5_timestamp(xdrs, &objp->last_failed)) { return (FALSE); } if (!xdr_krb5_kvno(xdrs, &objp->fail_auth_count)) { return (FALSE); } if (!xdr_krb5_int16(xdrs, &objp->n_key_data)) { return (FALSE); } if (!xdr_krb5_int16(xdrs, &objp->n_tl_data)) { return (FALSE); } if (!xdr_nulltype(xdrs, (void **) &objp->tl_data, xdr_krb5_tl_data)) { return FALSE; } n = objp->n_key_data; if (!xdr_array(xdrs, (caddr_t *) &objp->key_data, &n, ~0, sizeof(krb5_key_data), xdr_krb5_key_data_nocontents)) { return (FALSE); } return (TRUE); } ",0 "void NetworkChangeNotifier::NotifyObserversOfOnlineStateChange() { if (g_network_change_notifier) { g_network_change_notifier->online_state_observer_list_->Notify( &OnlineStateObserver::OnOnlineStateChanged, !IsOffline()); } } ",0 "int xt_compat_check_entry_offsets(const void *base, unsigned int target_offset, unsigned int next_offset) { const struct compat_xt_entry_target *t; const char *e = base; if (target_offset + sizeof(*t) > next_offset) return -EINVAL; t = (void *)(e + target_offset); if (t->u.target_size < sizeof(*t)) return -EINVAL; if (target_offset + t->u.target_size > next_offset) return -EINVAL; if (strcmp(t->u.user.name, XT_STANDARD_TARGET) == 0 && target_offset + sizeof(struct compat_xt_standard_target) != next_offset) return -EINVAL; return 0; } ",1 "void btif_hh_remove_device(bt_bdaddr_t bd_addr) { int i; btif_hh_device_t *p_dev; btif_hh_added_device_t *p_added_dev; LOG_INFO(""%s: bda = %02x:%02x:%02x:%02x:%02x:%02x"", __FUNCTION__, bd_addr.address[0], bd_addr.address[1], bd_addr.address[2], bd_addr.address[3], bd_addr.address[4], bd_addr.address[5]); for (i = 0; i < BTIF_HH_MAX_ADDED_DEV; i++) { p_added_dev = &btif_hh_cb.added_devices[i]; if (memcmp(&(p_added_dev->bd_addr),&bd_addr, 6) == 0) { BTA_HhRemoveDev(p_added_dev->dev_handle); btif_storage_remove_hid_info(&(p_added_dev->bd_addr)); memset(&(p_added_dev->bd_addr), 0, 6); p_added_dev->dev_handle = BTA_HH_INVALID_HANDLE; break; } } p_dev = btif_hh_find_dev_by_bda(&bd_addr); if (p_dev == NULL) { BTIF_TRACE_WARNING("" Oops, can't find device [%02x:%02x:%02x:%02x:%02x:%02x]"", bd_addr.address[0], bd_addr.address[1], bd_addr.address[2], bd_addr.address[3], bd_addr.address[4], bd_addr.address[5]); return; } /* need to notify up-layer device is disconnected to avoid state out of sync with up-layer */ HAL_CBACK(bt_hh_callbacks, connection_state_cb, &(p_dev->bd_addr), BTHH_CONN_STATE_DISCONNECTED); p_dev->dev_status = BTHH_CONN_STATE_UNKNOWN; p_dev->dev_handle = BTA_HH_INVALID_HANDLE; p_dev->ready_for_data = FALSE; if (btif_hh_cb.device_num > 0) { btif_hh_cb.device_num--; } else { BTIF_TRACE_WARNING(""%s: device_num = 0"", __FUNCTION__); } p_dev->hh_keep_polling = 0; p_dev->hh_poll_thread_id = -1; BTIF_TRACE_DEBUG(""%s: uhid fd = %d"", __FUNCTION__, p_dev->fd); if (p_dev->fd >= 0) { bta_hh_co_destroy(p_dev->fd); p_dev->fd = -1; } } ",0 "char *nd_get_link(struct nameidata *nd) { return nd->saved_names[nd->depth]; } ",0 "void ext4_msg (struct super_block * sb, const char *prefix, const char *fmt, ...) { va_list args; va_start(args, fmt); printk(""%sEXT4-fs (%s): "", prefix, sb->s_id); vprintk(fmt, args); printk(""\n""); va_end(args); } ",0 "GlobalHistogramAllocator::ReleaseForTesting() { GlobalHistogramAllocator* histogram_allocator = Get(); if (!histogram_allocator) return nullptr; PersistentMemoryAllocator* memory_allocator = histogram_allocator->memory_allocator(); PersistentMemoryAllocator::Iterator iter(memory_allocator); const PersistentHistogramData* data; while ((data = iter.GetNextOfObject()) != nullptr) { StatisticsRecorder::ForgetHistogramForTesting(data->name); DCHECK_NE(kResultHistogram, data->name); } subtle::Release_Store(&g_histogram_allocator, 0); return WrapUnique(histogram_allocator); }; ",1 "xmlBufAddLen(xmlBufPtr buf, size_t len) { if ((buf == NULL) || (buf->error)) return(-1); CHECK_COMPAT(buf) if (len > (buf->size - buf->use)) return(-1); buf->use += len; UPDATE_COMPAT(buf) if (buf->size > buf->use) buf->content[buf->use] = 0; else return(-1); return(0); } ",0 "void RenderFrameImpl::OnImeSetComposition( const base::string16& text, const std::vector& underlines, int selection_start, int selection_end) { if (!IsPepperAcceptingCompositionEvents()) { pepper_composition_text_ = text; } else { if (pepper_composition_text_.empty() && !text.empty()) { render_view_->focused_pepper_plugin()->HandleCompositionStart( base::string16()); } if (!pepper_composition_text_.empty() && text.empty()) { render_view_->focused_pepper_plugin()->HandleCompositionEnd( base::string16()); } pepper_composition_text_ = text; if (!pepper_composition_text_.empty()) { render_view_->focused_pepper_plugin()->HandleCompositionUpdate( pepper_composition_text_, underlines, selection_start, selection_end); } } } ",0 "xfs_attr3_leaf_lookup_int( struct xfs_buf *bp, struct xfs_da_args *args) { struct xfs_attr_leafblock *leaf; struct xfs_attr3_icleaf_hdr ichdr; struct xfs_attr_leaf_entry *entry; struct xfs_attr_leaf_entry *entries; struct xfs_attr_leaf_name_local *name_loc; struct xfs_attr_leaf_name_remote *name_rmt; xfs_dahash_t hashval; int probe; int span; trace_xfs_attr_leaf_lookup(args); leaf = bp->b_addr; xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); entries = xfs_attr3_leaf_entryp(leaf); if (ichdr.count >= args->geo->blksize / 8) return -EFSCORRUPTED; /* * Binary search. (note: small blocks will skip this loop) */ hashval = args->hashval; probe = span = ichdr.count / 2; for (entry = &entries[probe]; span > 4; entry = &entries[probe]) { span /= 2; if (be32_to_cpu(entry->hashval) < hashval) probe += span; else if (be32_to_cpu(entry->hashval) > hashval) probe -= span; else break; } if (!(probe >= 0 && (!ichdr.count || probe < ichdr.count))) return -EFSCORRUPTED; if (!(span <= 4 || be32_to_cpu(entry->hashval) == hashval)) return -EFSCORRUPTED; /* * Since we may have duplicate hashval's, find the first matching * hashval in the leaf. */ while (probe > 0 && be32_to_cpu(entry->hashval) >= hashval) { entry--; probe--; } while (probe < ichdr.count && be32_to_cpu(entry->hashval) < hashval) { entry++; probe++; } if (probe == ichdr.count || be32_to_cpu(entry->hashval) != hashval) { args->index = probe; return -ENOATTR; } /* * Duplicate keys may be present, so search all of them for a match. */ for (; probe < ichdr.count && (be32_to_cpu(entry->hashval) == hashval); entry++, probe++) { /* * GROT: Add code to remove incomplete entries. */ /* * If we are looking for INCOMPLETE entries, show only those. * If we are looking for complete entries, show only those. */ if ((args->flags & XFS_ATTR_INCOMPLETE) != (entry->flags & XFS_ATTR_INCOMPLETE)) { continue; } if (entry->flags & XFS_ATTR_LOCAL) { name_loc = xfs_attr3_leaf_name_local(leaf, probe); if (name_loc->namelen != args->namelen) continue; if (memcmp(args->name, name_loc->nameval, args->namelen) != 0) continue; if (!xfs_attr_namesp_match(args->flags, entry->flags)) continue; args->index = probe; return -EEXIST; } else { name_rmt = xfs_attr3_leaf_name_remote(leaf, probe); if (name_rmt->namelen != args->namelen) continue; if (memcmp(args->name, name_rmt->name, args->namelen) != 0) continue; if (!xfs_attr_namesp_match(args->flags, entry->flags)) continue; args->index = probe; args->rmtvaluelen = be32_to_cpu(name_rmt->valuelen); args->rmtblkno = be32_to_cpu(name_rmt->valueblk); args->rmtblkcnt = xfs_attr3_rmt_blocks( args->dp->i_mount, args->rmtvaluelen); return -EEXIST; } } args->index = probe; return -ENOATTR; } ",0 "cib_diff_notify(int options, const char *client, const char *call_id, const char *op, xmlNode * update, int result, xmlNode * diff) { int add_updates = 0; int add_epoch = 0; int add_admin_epoch = 0; int del_updates = 0; int del_epoch = 0; int del_admin_epoch = 0; int log_level = LOG_DEBUG_2; if (diff == NULL) { return; } if (result != pcmk_ok) { log_level = LOG_WARNING; } cib_diff_version_details(diff, &add_admin_epoch, &add_epoch, &add_updates, &del_admin_epoch, &del_epoch, &del_updates); if (add_updates != del_updates) { do_crm_log(log_level, ""Update (client: %s%s%s): %d.%d.%d -> %d.%d.%d (%s)"", client, call_id ? "", call:"" : """", call_id ? call_id : """", del_admin_epoch, del_epoch, del_updates, add_admin_epoch, add_epoch, add_updates, pcmk_strerror(result)); } else if (diff != NULL) { do_crm_log(log_level, ""Local-only Change (client:%s%s%s): %d.%d.%d (%s)"", client, call_id ? "", call: "" : """", call_id ? call_id : """", add_admin_epoch, add_epoch, add_updates, pcmk_strerror(result)); } do_cib_notify(options, op, update, result, diff, T_CIB_DIFF_NOTIFY); } ",0 "static void charactersHandler(void* closure, const xmlChar* s, int len) { if (hackAroundLibXMLEntityBug(closure)) return; getTokenizer(closure)->characters(s, len); } ",0 "FileTransfer::setClientSocketTimeout(int timeout) { int old_val = clientSockTimeout; clientSockTimeout = timeout; return old_val; } ",0 "void HTMLInputElement::CloneNonAttributePropertiesFrom(const Element& source, CloneChildrenFlag flag) { const HTMLInputElement& source_element = ToHTMLInputElement(source); non_attribute_value_ = source_element.non_attribute_value_; has_dirty_value_ = source_element.has_dirty_value_; setChecked(source_element.is_checked_); dirty_checkedness_ = source_element.dirty_checkedness_; is_indeterminate_ = source_element.is_indeterminate_; input_type_->CopyNonAttributeProperties(source_element); TextControlElement::CloneNonAttributePropertiesFrom(source, flag); needs_to_update_view_value_ = true; input_type_view_->UpdateView(); } ",0 "perf_cgroup_set_shadow_time(struct perf_event *event, u64 now) { struct perf_cgroup_info *t; t = per_cpu_ptr(event->cgrp->info, event->cpu); event->shadow_ctx_time = now - t->timestamp; } ",0 "static void fixup_low_keys(struct btrfs_root *root, struct btrfs_path *path, struct btrfs_disk_key *key, int level) { int i; struct extent_buffer *t; for (i = level; i < BTRFS_MAX_LEVEL; i++) { int tslot = path->slots[i]; if (!path->nodes[i]) break; t = path->nodes[i]; tree_mod_log_set_node_key(root->fs_info, t, tslot, 1); btrfs_set_node_key(t, key, tslot); btrfs_mark_buffer_dirty(path->nodes[i]); if (tslot != 0) break; } } ",0 "static void elementAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(Element*, cppValue, V8Element::toNativeWithTypeCheck(info.GetIsolate(), jsValue)); imp->setElementAttribute(WTF::getPtr(cppValue)); } ",0 "void bdput(struct block_device *bdev) { iput(bdev->bd_inode); } ",0 "int kvm_init(void *opaque, unsigned vcpu_size, unsigned vcpu_align, struct module *module) { int r; int cpu; r = kvm_arch_init(opaque); if (r) goto out_fail; /* * kvm_arch_init makes sure there's at most one caller * for architectures that support multiple implementations, * like intel and amd on x86. * kvm_arch_init must be called before kvm_irqfd_init to avoid creating * conflicts in case kvm is already setup for another implementation. */ r = kvm_irqfd_init(); if (r) goto out_irqfd; if (!zalloc_cpumask_var(&cpus_hardware_enabled, GFP_KERNEL)) { r = -ENOMEM; goto out_free_0; } r = kvm_arch_hardware_setup(); if (r < 0) goto out_free_0a; for_each_online_cpu(cpu) { smp_call_function_single(cpu, kvm_arch_check_processor_compat, &r, 1); if (r < 0) goto out_free_1; } r = cpuhp_setup_state_nocalls(CPUHP_AP_KVM_STARTING, ""AP_KVM_STARTING"", kvm_starting_cpu, kvm_dying_cpu); if (r) goto out_free_2; register_reboot_notifier(&kvm_reboot_notifier); /* A kmem cache lets us meet the alignment requirements of fx_save. */ if (!vcpu_align) vcpu_align = __alignof__(struct kvm_vcpu); kvm_vcpu_cache = kmem_cache_create(""kvm_vcpu"", vcpu_size, vcpu_align, 0, NULL); if (!kvm_vcpu_cache) { r = -ENOMEM; goto out_free_3; } r = kvm_async_pf_init(); if (r) goto out_free; kvm_chardev_ops.owner = module; kvm_vm_fops.owner = module; kvm_vcpu_fops.owner = module; r = misc_register(&kvm_dev); if (r) { pr_err(""kvm: misc device register failed\n""); goto out_unreg; } register_syscore_ops(&kvm_syscore_ops); kvm_preempt_ops.sched_in = kvm_sched_in; kvm_preempt_ops.sched_out = kvm_sched_out; r = kvm_init_debug(); if (r) { pr_err(""kvm: create debugfs files failed\n""); goto out_undebugfs; } r = kvm_vfio_ops_init(); WARN_ON(r); return 0; out_undebugfs: unregister_syscore_ops(&kvm_syscore_ops); misc_deregister(&kvm_dev); out_unreg: kvm_async_pf_deinit(); out_free: kmem_cache_destroy(kvm_vcpu_cache); out_free_3: unregister_reboot_notifier(&kvm_reboot_notifier); cpuhp_remove_state_nocalls(CPUHP_AP_KVM_STARTING); out_free_2: out_free_1: kvm_arch_hardware_unsetup(); out_free_0a: free_cpumask_var(cpus_hardware_enabled); out_free_0: kvm_irqfd_exit(); out_irqfd: kvm_arch_exit(); out_fail: return r; } ",0 "int snd_pcm_update_state(struct snd_pcm_substream *substream, struct snd_pcm_runtime *runtime) { snd_pcm_uframes_t avail; if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) avail = snd_pcm_playback_avail(runtime); else avail = snd_pcm_capture_avail(runtime); if (avail > runtime->avail_max) runtime->avail_max = avail; if (runtime->status->state == SNDRV_PCM_STATE_DRAINING) { if (avail >= runtime->buffer_size) { snd_pcm_drain_done(substream); return -EPIPE; } } else { if (avail >= runtime->stop_threshold) { xrun(substream); return -EPIPE; } } if (runtime->twake) { if (avail >= runtime->twake) wake_up(&runtime->tsleep); } else if (avail >= runtime->control->avail_min) wake_up(&runtime->sleep); return 0; } ",0 "zend_bool php_openssl_pkey_init_dh(DH *dh) { if (!dh->p || !dh->g) { return 0; } if (dh->pub_key) { return 1; } PHP_OPENSSL_RAND_ADD_TIME(); if (!DH_generate_key(dh)) { return 0; } /* all good */ return 1; } ",0 "static int snd_usb_audio_free(struct snd_usb_audio *chip) { struct snd_usb_endpoint *ep, *n; list_for_each_entry_safe(ep, n, &chip->ep_list, list) snd_usb_endpoint_free(ep); mutex_destroy(&chip->mutex); if (!atomic_read(&chip->shutdown)) dev_set_drvdata(&chip->dev->dev, NULL); kfree(chip); return 0; } ",0 "ProcRenderScale (ClientPtr client) { return BadImplementation; } ",0 "void CSoundFile::ResetMidiCfg() { memset(&m_MidiCfg, 0, sizeof(m_MidiCfg)); lstrcpy(&m_MidiCfg.szMidiGlb[MIDIOUT_START*32], ""FF""); lstrcpy(&m_MidiCfg.szMidiGlb[MIDIOUT_STOP*32], ""FC""); lstrcpy(&m_MidiCfg.szMidiGlb[MIDIOUT_NOTEON*32], ""9c n v""); lstrcpy(&m_MidiCfg.szMidiGlb[MIDIOUT_NOTEOFF*32], ""9c n 0""); lstrcpy(&m_MidiCfg.szMidiGlb[MIDIOUT_PROGRAM*32], ""Cc p""); lstrcpy(&m_MidiCfg.szMidiSFXExt[0], ""F0F000z""); for (int iz=0; iz<16; iz++) wsprintf(&m_MidiCfg.szMidiZXXExt[iz*32], ""F0F001%02X"", iz*8); } ",0 "static long dm_dax_direct_access(struct dax_device *dax_dev, pgoff_t pgoff, long nr_pages, void **kaddr, pfn_t *pfn) { struct mapped_device *md = dax_get_private(dax_dev); sector_t sector = pgoff * PAGE_SECTORS; struct dm_target *ti; long len, ret = -EIO; int srcu_idx; ti = dm_dax_get_live_target(md, sector, &srcu_idx); if (!ti) goto out; if (!ti->type->direct_access) goto out; len = max_io_len(sector, ti) / PAGE_SECTORS; if (len < 1) goto out; nr_pages = min(len, nr_pages); if (ti->type->direct_access) ret = ti->type->direct_access(ti, pgoff, nr_pages, kaddr, pfn); out: dm_put_live_table(md, srcu_idx); return ret; } ",0 "Document::Document(const DocumentInit& initializer, DocumentClassFlags document_classes) : ContainerNode(0, kCreateDocument), TreeScope(*this), has_nodes_with_placeholder_style_(false), evaluate_media_queries_on_style_recalc_(false), pending_sheet_layout_(kNoLayoutWithPendingSheets), frame_(initializer.GetFrame()), dom_window_(frame_ ? frame_->DomWindow() : nullptr), imports_controller_(this, initializer.ImportsController()), parser_(this, nullptr), context_features_(ContextFeatures::DefaultSwitch()), well_formed_(false), implementation_(this, nullptr), printing_(kNotPrinting), paginated_for_screen_(false), compatibility_mode_(kNoQuirksMode), compatibility_mode_locked_(false), has_autofocused_(false), clear_focused_element_timer_( TaskRunnerHelper::Get(TaskType::kUnspecedTimer, this), this, &Document::ClearFocusedElementTimerFired), dom_tree_version_(++global_tree_version_), style_version_(0), listener_types_(0), mutation_observer_types_(0), style_engine_(this, nullptr), style_sheet_list_(this, nullptr), visited_link_state_(VisitedLinkState::Create(*this)), visually_ordered_(false), ready_state_(kComplete), parsing_state_(kFinishedParsing), goto_anchor_needed_after_stylesheets_load_(false), contains_validity_style_rules_(false), contains_plugins_(false), ignore_destructive_write_count_(0), throw_on_dynamic_markup_insertion_count_(0), markers_(new DocumentMarkerController(*this)), update_focus_appearance_timer_( TaskRunnerHelper::Get(TaskType::kUnspecedTimer, this), this, &Document::UpdateFocusAppearanceTimerFired), css_target_(nullptr), load_event_progress_(kLoadEventCompleted), start_time_(CurrentTime()), script_runner_(ScriptRunner::Create(this)), xml_version_(""1.0""), xml_standalone_(kStandaloneUnspecified), has_xml_declaration_(0), design_mode_(false), is_running_exec_command_(false), has_annotated_regions_(false), annotated_regions_dirty_(false), document_classes_(document_classes), is_view_source_(false), saw_elements_in_known_namespaces_(false), is_srcdoc_document_(initializer.ShouldTreatURLAsSrcdocDocument()), is_mobile_document_(false), layout_view_(0), context_document_(initializer.ContextDocument()), has_fullscreen_supplement_(false), load_event_delay_count_(0), load_event_delay_timer_( TaskRunnerHelper::Get(TaskType::kNetworking, this), this, &Document::LoadEventDelayTimerFired), plugin_loading_timer_( TaskRunnerHelper::Get(TaskType::kUnspecedLoading, this), this, &Document::PluginLoadingTimerFired), document_timing_(*this), write_recursion_is_too_deep_(false), write_recursion_depth_(0), registration_context_(initializer.RegistrationContext(this)), element_data_cache_clear_timer_( TaskRunnerHelper::Get(TaskType::kUnspecedTimer, this), this, &Document::ElementDataCacheClearTimerFired), timeline_(DocumentTimeline::Create(this)), compositor_pending_animations_(new CompositorPendingAnimations(*this)), template_document_host_(nullptr), did_associate_form_controls_timer_( TaskRunnerHelper::Get(TaskType::kUnspecedLoading, this), this, &Document::DidAssociateFormControlsTimerFired), timers_(TaskRunnerHelper::Get(TaskType::kTimer, this)), has_viewport_units_(false), parser_sync_policy_(kAllowAsynchronousParsing), node_count_(0), would_load_reason_(WouldLoadReason::kInvalid), password_count_(0), logged_field_edit_(false), engagement_level_(mojom::blink::EngagementLevel::NONE) { if (frame_) { DCHECK(frame_->GetPage()); ProvideContextFeaturesToDocumentFrom(*this, *frame_->GetPage()); fetcher_ = frame_->Loader().GetDocumentLoader()->Fetcher(); FrameFetchContext::ProvideDocumentToContext(fetcher_->Context(), this); CustomElementRegistry* registry = frame_->DomWindow() ? frame_->DomWindow()->MaybeCustomElements() : nullptr; if (registry && registration_context_) registry->Entangle(registration_context_); } else if (imports_controller_) { fetcher_ = FrameFetchContext::CreateFetcherFromDocument(this); } else { fetcher_ = ResourceFetcher::Create( nullptr, Platform::Current()->CurrentThread()->GetWebTaskRunner()); } DCHECK(fetcher_); root_scroller_controller_ = RootScrollerController::Create(*this); if (initializer.ShouldSetURL()) { SetURL(initializer.Url()); } else { UpdateBaseURL(); } InitSecurityContext(initializer); InitDNSPrefetch(); InstanceCounters::IncrementCounter(InstanceCounters::kDocumentCounter); lifecycle_.AdvanceTo(DocumentLifecycle::kInactive); style_engine_ = StyleEngine::Create(*this); DCHECK(!ParentDocument() || !ParentDocument()->IsContextSuspended()); #ifndef NDEBUG liveDocumentSet().insert(this); #endif } ",0 "ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( int route_id, ServiceWorkerProviderType provider_type, bool is_parent_frame_secure) : ServiceWorkerNetworkProvider(route_id, provider_type, GetNextProviderId(), is_parent_frame_secure) {} ",0 "static void sysctl_print_dir(struct ctl_dir *dir) { if (dir->header.parent) sysctl_print_dir(dir->header.parent); pr_cont(""%s/"", dir->header.ctl_table[0].procname); } ",0 "void PeopleHandler::DisplaySpinner() { configuring_sync_ = true; const int kTimeoutSec = 30; DCHECK(!engine_start_timer_); engine_start_timer_.reset(new base::OneShotTimer()); engine_start_timer_->Start(FROM_HERE, base::TimeDelta::FromSeconds(kTimeoutSec), this, &PeopleHandler::DisplayTimeout); FireWebUIListener(""page-status-changed"", base::Value(kSpinnerPageStatus)); } ",0 "void FrameView::didAddScrollbar(Scrollbar* scrollbar, ScrollbarOrientation orientation) { ScrollableArea::didAddScrollbar(scrollbar, orientation); if (AXObjectCache* cache = axObjectCache()) cache->handleScrollbarUpdate(this); } ",0 "void rand_drbg_cleanup_entropy(RAND_DRBG *drbg, unsigned char *out, size_t outlen) { if (drbg->seed_pool == NULL) { if (drbg->secure) OPENSSL_secure_clear_free(out, outlen); else OPENSSL_clear_free(out, outlen); } } ",0 "static bool CheckGsm(const uint8_t* buffer, int buffer_size) { RCHECK(buffer_size >= 1024); // Need enough data to do a decent check. int offset = 0; while (offset < buffer_size) { RCHECK((buffer[offset] & 0xf0) == 0xd0); offset += 33; } return true; } ",0 "bool xmp_get_localized_text(XmpPtr xmp, const char *schema, const char *name, const char *genericLang, const char *specificLang, XmpStringPtr actualLang, XmpStringPtr itemValue, uint32_t *propsBits) { CHECK_PTR(xmp, false); RESET_ERROR; bool ret = false; try { auto txmp = reinterpret_cast(xmp); XMP_OptionBits optionBits; ret = txmp->GetLocalizedText(schema, name, genericLang, specificLang, STRING(actualLang), STRING(itemValue), &optionBits); if (propsBits) { *propsBits = optionBits; } } catch (const XMP_Error &e) { set_error(e); ret = false; } return ret; } ",0 "static TCGv gen_lea_modrm_1(AddressParts a) { TCGv ea; TCGV_UNUSED(ea); if (a.index >= 0) { if (a.scale == 0) { ea = cpu_regs[a.index]; } else { tcg_gen_shli_tl(cpu_A0, cpu_regs[a.index], a.scale); ea = cpu_A0; } if (a.base >= 0) { tcg_gen_add_tl(cpu_A0, ea, cpu_regs[a.base]); ea = cpu_A0; } } else if (a.base >= 0) { ea = cpu_regs[a.base]; } if (TCGV_IS_UNUSED(ea)) { tcg_gen_movi_tl(cpu_A0, a.disp); ea = cpu_A0; } else if (a.disp != 0) { tcg_gen_addi_tl(cpu_A0, ea, a.disp); ea = cpu_A0; } return ea; } ",0 "void llc_conn_resend_i_pdu_as_cmd(struct sock *sk, u8 nr, u8 first_p_bit) { struct sk_buff *skb; struct llc_pdu_sn *pdu; u16 nbr_unack_pdus; struct llc_sock *llc; u8 howmany_resend = 0; llc_conn_remove_acked_pdus(sk, nr, &nbr_unack_pdus); if (!nbr_unack_pdus) goto out; /* * Process unack PDUs only if unack queue is not empty; remove * appropriate PDUs, fix them up, and put them on mac_pdu_q. */ llc = llc_sk(sk); while ((skb = skb_dequeue(&llc->pdu_unack_q)) != NULL) { pdu = llc_pdu_sn_hdr(skb); llc_pdu_set_cmd_rsp(skb, LLC_PDU_CMD); llc_pdu_set_pf_bit(skb, first_p_bit); skb_queue_tail(&sk->sk_write_queue, skb); first_p_bit = 0; llc->vS = LLC_I_GET_NS(pdu); howmany_resend++; } if (howmany_resend > 0) llc->vS = (llc->vS + 1) % LLC_2_SEQ_NBR_MODULO; /* any PDUs to re-send are queued up; start sending to MAC */ llc_conn_send_pdus(sk); out:; } ",0 "int ip6_fragment(struct sk_buff *skb, int (*output)(struct sk_buff *)) { struct sk_buff *frag; struct rt6_info *rt = (struct rt6_info*)skb_dst(skb); struct ipv6_pinfo *np = skb->sk ? inet6_sk(skb->sk) : NULL; struct ipv6hdr *tmp_hdr; struct frag_hdr *fh; unsigned int mtu, hlen, left, len; int hroom, troom; __be32 frag_id = 0; int ptr, offset = 0, err=0; u8 *prevhdr, nexthdr = 0; struct net *net = dev_net(skb_dst(skb)->dev); hlen = ip6_find_1stfragopt(skb, &prevhdr); nexthdr = *prevhdr; mtu = ip6_skb_dst_mtu(skb); /* We must not fragment if the socket is set to force MTU discovery * or if the skb it not generated by a local socket. */ if (unlikely(!skb->local_df && skb->len > mtu) || (IP6CB(skb)->frag_max_size && IP6CB(skb)->frag_max_size > mtu)) { if (skb->sk && dst_allfrag(skb_dst(skb))) sk_nocaps_add(skb->sk, NETIF_F_GSO_MASK); skb->dev = skb_dst(skb)->dev; icmpv6_send(skb, ICMPV6_PKT_TOOBIG, 0, mtu); IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS); kfree_skb(skb); return -EMSGSIZE; } if (np && np->frag_size < mtu) { if (np->frag_size) mtu = np->frag_size; } mtu -= hlen + sizeof(struct frag_hdr); if (skb_has_frag_list(skb)) { int first_len = skb_pagelen(skb); struct sk_buff *frag2; if (first_len - hlen > mtu || ((first_len - hlen) & 7) || skb_cloned(skb)) goto slow_path; skb_walk_frags(skb, frag) { /* Correct geometry. */ if (frag->len > mtu || ((frag->len & 7) && frag->next) || skb_headroom(frag) < hlen) goto slow_path_clean; /* Partially cloned skb? */ if (skb_shared(frag)) goto slow_path_clean; BUG_ON(frag->sk); if (skb->sk) { frag->sk = skb->sk; frag->destructor = sock_wfree; } skb->truesize -= frag->truesize; } err = 0; offset = 0; frag = skb_shinfo(skb)->frag_list; skb_frag_list_init(skb); /* BUILD HEADER */ *prevhdr = NEXTHDR_FRAGMENT; tmp_hdr = kmemdup(skb_network_header(skb), hlen, GFP_ATOMIC); if (!tmp_hdr) { IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS); return -ENOMEM; } __skb_pull(skb, hlen); fh = (struct frag_hdr*)__skb_push(skb, sizeof(struct frag_hdr)); __skb_push(skb, hlen); skb_reset_network_header(skb); memcpy(skb_network_header(skb), tmp_hdr, hlen); ipv6_select_ident(fh, rt); fh->nexthdr = nexthdr; fh->reserved = 0; fh->frag_off = htons(IP6_MF); frag_id = fh->identification; first_len = skb_pagelen(skb); skb->data_len = first_len - skb_headlen(skb); skb->len = first_len; ipv6_hdr(skb)->payload_len = htons(first_len - sizeof(struct ipv6hdr)); dst_hold(&rt->dst); for (;;) { /* Prepare header of the next frame, * before previous one went down. */ if (frag) { frag->ip_summed = CHECKSUM_NONE; skb_reset_transport_header(frag); fh = (struct frag_hdr*)__skb_push(frag, sizeof(struct frag_hdr)); __skb_push(frag, hlen); skb_reset_network_header(frag); memcpy(skb_network_header(frag), tmp_hdr, hlen); offset += skb->len - hlen - sizeof(struct frag_hdr); fh->nexthdr = nexthdr; fh->reserved = 0; fh->frag_off = htons(offset); if (frag->next != NULL) fh->frag_off |= htons(IP6_MF); fh->identification = frag_id; ipv6_hdr(frag)->payload_len = htons(frag->len - sizeof(struct ipv6hdr)); ip6_copy_metadata(frag, skb); } err = output(skb); if(!err) IP6_INC_STATS(net, ip6_dst_idev(&rt->dst), IPSTATS_MIB_FRAGCREATES); if (err || !frag) break; skb = frag; frag = skb->next; skb->next = NULL; } kfree(tmp_hdr); if (err == 0) { IP6_INC_STATS(net, ip6_dst_idev(&rt->dst), IPSTATS_MIB_FRAGOKS); ip6_rt_put(rt); return 0; } while (frag) { skb = frag->next; kfree_skb(frag); frag = skb; } IP6_INC_STATS(net, ip6_dst_idev(&rt->dst), IPSTATS_MIB_FRAGFAILS); ip6_rt_put(rt); return err; slow_path_clean: skb_walk_frags(skb, frag2) { if (frag2 == frag) break; frag2->sk = NULL; frag2->destructor = NULL; skb->truesize += frag2->truesize; } } slow_path: if ((skb->ip_summed == CHECKSUM_PARTIAL) && skb_checksum_help(skb)) goto fail; left = skb->len - hlen; /* Space per frame */ ptr = hlen; /* Where to start from */ /* * Fragment the datagram. */ *prevhdr = NEXTHDR_FRAGMENT; hroom = LL_RESERVED_SPACE(rt->dst.dev); troom = rt->dst.dev->needed_tailroom; /* * Keep copying data until we run out. */ while(left > 0) { len = left; /* IF: it doesn't fit, use 'mtu' - the data space left */ if (len > mtu) len = mtu; /* IF: we are not sending up to and including the packet end then align the next start on an eight byte boundary */ if (len < left) { len &= ~7; } /* * Allocate buffer. */ if ((frag = alloc_skb(len + hlen + sizeof(struct frag_hdr) + hroom + troom, GFP_ATOMIC)) == NULL) { NETDEBUG(KERN_INFO ""IPv6: frag: no memory for new fragment!\n""); IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS); err = -ENOMEM; goto fail; } /* * Set up data on packet */ ip6_copy_metadata(frag, skb); skb_reserve(frag, hroom); skb_put(frag, len + hlen + sizeof(struct frag_hdr)); skb_reset_network_header(frag); fh = (struct frag_hdr *)(skb_network_header(frag) + hlen); frag->transport_header = (frag->network_header + hlen + sizeof(struct frag_hdr)); /* * Charge the memory for the fragment to any owner * it might possess */ if (skb->sk) skb_set_owner_w(frag, skb->sk); /* * Copy the packet header into the new buffer. */ skb_copy_from_linear_data(skb, skb_network_header(frag), hlen); /* * Build fragment header. */ fh->nexthdr = nexthdr; fh->reserved = 0; if (!frag_id) { ipv6_select_ident(fh, rt); frag_id = fh->identification; } else fh->identification = frag_id; /* * Copy a block of the IP datagram. */ if (skb_copy_bits(skb, ptr, skb_transport_header(frag), len)) BUG(); left -= len; fh->frag_off = htons(offset); if (left > 0) fh->frag_off |= htons(IP6_MF); ipv6_hdr(frag)->payload_len = htons(frag->len - sizeof(struct ipv6hdr)); ptr += len; offset += len; /* * Put this fragment into the sending queue. */ err = output(frag); if (err) goto fail; IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGCREATES); } IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGOKS); consume_skb(skb); return err; fail: IP6_INC_STATS(net, ip6_dst_idev(skb_dst(skb)), IPSTATS_MIB_FRAGFAILS); kfree_skb(skb); return err; } ",0 "void HTMLInputElement::postDispatchEventHandler(Event* event, void* dataFromPreDispatch) { OwnPtr state = adoptPtr(static_cast(dataFromPreDispatch)); if (!state) return; m_inputType->didDispatchClick(event, *state); } ",0 " OVS_REQUIRES(ofproto_mutex) { uint32_t hash = hash_learned_cookie(learn->cookie, learn->table_id); struct learned_cookie *c; HMAP_FOR_EACH_WITH_HASH (c, u.hmap_node, hash, &ofproto->learned_cookies) { if (c->cookie == learn->cookie && c->table_id == learn->table_id) { c->n += delta; ovs_assert(c->n >= 0); if (!c->n) { hmap_remove(&ofproto->learned_cookies, &c->u.hmap_node); ovs_list_push_back(dead_cookies, &c->u.list_node); } return; } } ovs_assert(delta > 0); c = xmalloc(sizeof *c); hmap_insert(&ofproto->learned_cookies, &c->u.hmap_node, hash); c->cookie = learn->cookie; c->table_id = learn->table_id; c->n = delta; } ",0 "brcmf_configure_arp_nd_offload(struct brcmf_if *ifp, bool enable) { s32 err; u32 mode; if (enable) mode = BRCMF_ARP_OL_AGENT | BRCMF_ARP_OL_PEER_AUTO_REPLY; else mode = 0; /* Try to set and enable ARP offload feature, this may fail, then it */ /* is simply not supported and err 0 will be returned */ err = brcmf_fil_iovar_int_set(ifp, ""arp_ol"", mode); if (err) { brcmf_dbg(TRACE, ""failed to set ARP offload mode to 0x%x, err = %d\n"", mode, err); err = 0; } else { err = brcmf_fil_iovar_int_set(ifp, ""arpoe"", enable); if (err) { brcmf_dbg(TRACE, ""failed to configure (%d) ARP offload err = %d\n"", enable, err); err = 0; } else brcmf_dbg(TRACE, ""successfully configured (%d) ARP offload to 0x%x\n"", enable, mode); } err = brcmf_fil_iovar_int_set(ifp, ""ndoe"", enable); if (err) { brcmf_dbg(TRACE, ""failed to configure (%d) ND offload err = %d\n"", enable, err); err = 0; } else brcmf_dbg(TRACE, ""successfully configured (%d) ND offload to 0x%x\n"", enable, mode); return err; } ",0 "void WebContentsImpl::UpdateEncoding(RenderFrameHost* render_frame_host, const std::string& encoding) { SetEncoding(encoding); } ",0 "WebContents* WebContents::Create(const WebContents::CreateParams& params) { FrameTreeNode* opener_node = nullptr; if (params.opener_render_frame_id != MSG_ROUTING_NONE) { RenderFrameHostImpl* opener_rfh = RenderFrameHostImpl::FromID( params.opener_render_process_id, params.opener_render_frame_id); if (opener_rfh) opener_node = opener_rfh->frame_tree_node(); } return WebContentsImpl::CreateWithOpener(params, opener_node); } ",0 "void HTMLMediaElement::scheduleTextTrackResourceLoad() { BLINK_MEDIA_LOG << ""scheduleTextTrackResourceLoad("" << (void*)this << "")""; m_pendingActionFlags |= LoadTextTrackResource; if (!m_loadTimer.isActive()) m_loadTimer.startOneShot(0, BLINK_FROM_HERE); } ",0 "int32_t VolumeGetStereoPosition(EffectContext *pContext, int16_t *position){ LVM_ControlParams_t ActiveParams; /* Current control Parameters */ LVM_ReturnStatus_en LvmStatus = LVM_SUCCESS; /* Function call status */ LVM_INT16 balance; LvmStatus = LVM_GetControlParameters(pContext->pBundledContext->hInstance, &ActiveParams); LVM_ERROR_CHECK(LvmStatus, ""LVM_GetControlParameters"", ""VolumeGetStereoPosition"") if(LvmStatus != LVM_SUCCESS) return -EINVAL; balance = VolumeConvertStereoPosition(pContext->pBundledContext->positionSaved); if(pContext->pBundledContext->bStereoPositionEnabled == LVM_TRUE){ if(balance != ActiveParams.VC_Balance){ return -EINVAL; } } *position = (LVM_INT16)pContext->pBundledContext->positionSaved; // Convert dB to millibels return 0; } /* end VolumeGetStereoPosition */ ",0 "XRecordFreeData(XRecordInterceptData *data) { /* we can do this cast because that is what we really allocated */ struct intercept_queue *iq = (struct intercept_queue *)data; struct reply_buffer *rbp = NULL; struct mem_cache_str *cache = iq->cache; /* * figure out what reply_buffer this points at * and decrement its ref_count. */ if (data->data) { for (rbp = cache->reply_buffers; rbp; rbp = rbp->next) { if (data->data >= rbp->buf && data->data < rbp->buf + rbp->nbytes) { assert(rbp->ref_count > 0); rbp->ref_count--; break; } } /* it's an error if we didn't find something to free */ assert(rbp); } /* * If the display is still open, put this back on the free queue. * * Otherwise the display is closed and we won't reuse this, so free it. * See if we can free the reply buffer, too. * If we can, see if this is the last reply buffer and if so * free the list of reply buffers. */ if (cache->display_closed == False) { iq->next = cache->inter_data; cache->inter_data = iq; } else { if (rbp && rbp->ref_count == 0) { struct reply_buffer *rbp2, **rbp_next_p; /* Have to search the list again to find the prev element. This is not the common case, so don't slow down the code above by doing it then. */ for (rbp_next_p = &cache->reply_buffers; *rbp_next_p; ) { rbp2 = *rbp_next_p; if (rbp == rbp2) { *rbp_next_p = rbp2->next; break; } else { rbp_next_p = &rbp2->next; } } XFree(rbp->buf); XFree(rbp); } XFree(iq); cache->inter_data_count--; if (cache->reply_buffers == NULL && cache->inter_data_count == 0) { XFree(cache); /* all finished */ } } } ",0 "static int __ext4_ext_check(const char *function, unsigned int line, struct inode *inode, struct ext4_extent_header *eh, int depth) { const char *error_msg; int max = 0; if (unlikely(eh->eh_magic != EXT4_EXT_MAGIC)) { error_msg = ""invalid magic""; goto corrupted; } if (unlikely(le16_to_cpu(eh->eh_depth) != depth)) { error_msg = ""unexpected eh_depth""; goto corrupted; } if (unlikely(eh->eh_max == 0)) { error_msg = ""invalid eh_max""; goto corrupted; } max = ext4_ext_max_entries(inode, depth); if (unlikely(le16_to_cpu(eh->eh_max) > max)) { error_msg = ""too large eh_max""; goto corrupted; } if (unlikely(le16_to_cpu(eh->eh_entries) > le16_to_cpu(eh->eh_max))) { error_msg = ""invalid eh_entries""; goto corrupted; } if (!ext4_valid_extent_entries(inode, eh, depth)) { error_msg = ""invalid extent entries""; goto corrupted; } return 0; corrupted: ext4_error_inode(inode, function, line, 0, ""bad header/extent: %s - magic %x, "" ""entries %u, max %u(%u), depth %u(%u)"", error_msg, le16_to_cpu(eh->eh_magic), le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max), max, le16_to_cpu(eh->eh_depth), depth); return -EIO; } ",0 "static void arcmsr_write_ioctldata2iop_in_DWORD(struct AdapterControlBlock *acb) { uint8_t *pQbuffer; struct QBUFFER __iomem *pwbuffer; uint8_t *buf1 = NULL; uint32_t __iomem *iop_data; uint32_t allxfer_len = 0, data_len, *buf2 = NULL, data; if (acb->acb_flags & ACB_F_MESSAGE_WQBUFFER_READED) { buf1 = kmalloc(128, GFP_ATOMIC); buf2 = (uint32_t *)buf1; if (buf1 == NULL) return; acb->acb_flags &= (~ACB_F_MESSAGE_WQBUFFER_READED); pwbuffer = arcmsr_get_iop_wqbuffer(acb); iop_data = (uint32_t __iomem *)pwbuffer->data; while ((acb->wqbuf_getIndex != acb->wqbuf_putIndex) && (allxfer_len < 124)) { pQbuffer = &acb->wqbuffer[acb->wqbuf_getIndex]; *buf1 = *pQbuffer; acb->wqbuf_getIndex++; acb->wqbuf_getIndex %= ARCMSR_MAX_QBUFFER; buf1++; allxfer_len++; } data_len = allxfer_len; buf1 = (uint8_t *)buf2; while (data_len >= 4) { data = *buf2++; writel(data, iop_data); iop_data++; data_len -= 4; } if (data_len) { data = *buf2; writel(data, iop_data); } writel(allxfer_len, &pwbuffer->data_len); kfree(buf1); arcmsr_iop_message_wrote(acb); } } ",0 "void ContainerNode::recalcChildStyle(StyleRecalcChange change) { ASSERT(document().inStyleRecalc()); ASSERT(change >= UpdatePseudoElements || childNeedsStyleRecalc()); ASSERT(!needsStyleRecalc()); if (change < Force && hasRareData() && childNeedsStyleRecalc()) checkForChildrenAdjacentRuleChanges(); StyleResolver& styleResolver = document().ensureStyleResolver(); Text* lastTextNode = nullptr; for (Node* child = lastChild(); child; child = child->previousSibling()) { if (child->isTextNode()) { toText(child)->recalcTextStyle(change, lastTextNode); lastTextNode = toText(child); } else if (child->isElementNode()) { Element* element = toElement(child); if (element->shouldCallRecalcStyle(change)) element->recalcStyle(change, lastTextNode); else if (element->supportsStyleSharing()) styleResolver.addToStyleSharingList(*element); if (element->layoutObject()) lastTextNode = nullptr; } } } ",0 "void V8TestObject::DoubleOrStringOrNullAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_doubleOrStringOrNullAttribute_Getter""); test_object_v8_internal::DoubleOrStringOrNullAttributeAttributeGetter(info); } ",0 "static void rds_ib_remove_one(struct ib_device *device) { struct rds_ib_device *rds_ibdev; rds_ibdev = ib_get_client_data(device, &rds_ib_client); if (!rds_ibdev) return; rds_ib_dev_shutdown(rds_ibdev); /* stop connection attempts from getting a reference to this device. */ ib_set_client_data(device, &rds_ib_client, NULL); down_write(&rds_ib_devices_lock); list_del_rcu(&rds_ibdev->list); up_write(&rds_ib_devices_lock); /* * This synchronize rcu is waiting for readers of both the ib * client data and the devices list to finish before we drop * both of those references. */ synchronize_rcu(); rds_ib_dev_put(rds_ibdev); rds_ib_dev_put(rds_ibdev); } ",0 "static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct des_sparc64_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; int err; blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; des_sparc64_load_keys(&ctx->encrypt_expkey[0]); while ((nbytes = walk.nbytes)) { unsigned int block_len = nbytes & DES_BLOCK_MASK; if (likely(block_len)) { des_sparc64_cbc_encrypt((const u64 *)walk.src.virt.addr, (u64 *) walk.dst.virt.addr, block_len, (u64 *) walk.iv); } nbytes &= DES_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } fprs_write(0); return err; } ",0 "void RecordDownloadCount(DownloadCountTypes type) { UMA_HISTOGRAM_ENUMERATION(""Download.Counts"", type, DOWNLOAD_COUNT_TYPES_LAST_ENTRY); } ",0 "char *bin2hex(const unsigned char *p, size_t len) { ssize_t slen; char *s; slen = len * 2 + 1; if (slen % 4) slen += 4 - (slen % 4); s = calloc(slen, 1); if (unlikely(!s)) quithere(1, ""Failed to calloc""); __bin2hex(s, p, len); return s; } ",0 "static void edge_interrupt_callback(struct urb *urb) { struct edgeport_serial *edge_serial = urb->context; struct usb_serial_port *port; struct edgeport_port *edge_port; struct device *dev; unsigned char *data = urb->transfer_buffer; int length = urb->actual_length; int port_number; int function; int retval; __u8 lsr; __u8 msr; int status = urb->status; switch (status) { case 0: /* success */ break; case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: /* this urb is terminated, clean up */ dev_dbg(&urb->dev->dev, ""%s - urb shutting down with status: %d\n"", __func__, status); return; default: dev_err(&urb->dev->dev, ""%s - nonzero urb status received: "" ""%d\n"", __func__, status); goto exit; } if (!length) { dev_dbg(&urb->dev->dev, ""%s - no data in urb\n"", __func__); goto exit; } dev = &edge_serial->serial->dev->dev; usb_serial_debug_data(dev, __func__, length, data); if (length != 2) { dev_dbg(dev, ""%s - expecting packet of size 2, got %d\n"", __func__, length); goto exit; } port_number = TIUMP_GET_PORT_FROM_CODE(data[0]); function = TIUMP_GET_FUNC_FROM_CODE(data[0]); dev_dbg(dev, ""%s - port_number %d, function %d, info 0x%x\n"", __func__, port_number, function, data[1]); port = edge_serial->serial->port[port_number]; edge_port = usb_get_serial_port_data(port); if (!edge_port) { dev_dbg(dev, ""%s - edge_port not found\n"", __func__); return; } switch (function) { case TIUMP_INTERRUPT_CODE_LSR: lsr = map_line_status(data[1]); if (lsr & UMP_UART_LSR_DATA_MASK) { /* Save the LSR event for bulk read completion routine */ dev_dbg(dev, ""%s - LSR Event Port %u LSR Status = %02x\n"", __func__, port_number, lsr); edge_port->lsr_event = 1; edge_port->lsr_mask = lsr; } else { dev_dbg(dev, ""%s - ===== Port %d LSR Status = %02x ======\n"", __func__, port_number, lsr); handle_new_lsr(edge_port, 0, lsr, 0); } break; case TIUMP_INTERRUPT_CODE_MSR: /* MSR */ /* Copy MSR from UMP */ msr = data[1]; dev_dbg(dev, ""%s - ===== Port %u MSR Status = %02x ======\n"", __func__, port_number, msr); handle_new_msr(edge_port, msr); break; default: dev_err(&urb->dev->dev, ""%s - Unknown Interrupt code from UMP %x\n"", __func__, data[1]); break; } exit: retval = usb_submit_urb(urb, GFP_ATOMIC); if (retval) dev_err(&urb->dev->dev, ""%s - usb_submit_urb failed with result %d\n"", __func__, retval); } ",0 "static void jslLexRegex() { lex->tokenValue = jsvNewFromEmptyString(); if (!lex->tokenValue) { lex->tk = LEX_EOF; return; } JsvStringIterator it; jsvStringIteratorNew(&it, lex->tokenValue, 0); jsvStringIteratorAppend(&it, '/'); jslGetNextCh(); while (lex->currCh && lex->currCh!='/') { if (lex->currCh == '\\') { jsvStringIteratorAppend(&it, lex->currCh); jslGetNextCh(); } else if (lex->currCh=='\n') { /* Was a newline - this is now allowed * unless we're a template string */ break; } jsvStringIteratorAppend(&it, lex->currCh); jslGetNextCh(); } lex->tk = LEX_REGEX; if (lex->currCh!='/') { lex->tk++; // +1 gets you to 'unfinished X' } else { jsvStringIteratorAppend(&it, '/'); jslGetNextCh(); while (lex->currCh=='g' || lex->currCh=='i' || lex->currCh=='m' || lex->currCh=='y' || lex->currCh=='u') { jslTokenAppendChar(lex->currCh); jsvStringIteratorAppend(&it, lex->currCh); jslGetNextCh(); } } jsvStringIteratorFree(&it); } ",0 "void SaveCardBubbleControllerImpl::UpdateIcon() { Browser* browser = chrome::FindBrowserWithWebContents(web_contents()); LocationBar* location_bar = browser->window()->GetLocationBar(); location_bar->UpdateSaveCreditCardIcon(); } ",0 "xar_read_data(struct archive_read *a, const void **buff, size_t *size, int64_t *offset) { struct xar *xar; size_t used; int r; xar = (struct xar *)(a->format->data); if (xar->entry_unconsumed) { __archive_read_consume(a, xar->entry_unconsumed); xar->entry_unconsumed = 0; } if (xar->end_of_file || xar->entry_remaining <= 0) { r = ARCHIVE_EOF; goto abort_read_data; } if (xar->entry_init) { r = rd_contents_init(a, xar->entry_encoding, xar->entry_a_sum.alg, xar->entry_e_sum.alg); if (r != ARCHIVE_OK) { xar->entry_remaining = 0; return (r); } xar->entry_init = 0; } *buff = NULL; r = rd_contents(a, buff, size, &used, xar->entry_remaining); if (r != ARCHIVE_OK) goto abort_read_data; *offset = xar->entry_total; xar->entry_total += *size; xar->total += *size; xar->offset += used; xar->entry_remaining -= used; xar->entry_unconsumed = used; if (xar->entry_remaining == 0) { if (xar->entry_total != xar->entry_size) { archive_set_error(&(a->archive), ARCHIVE_ERRNO_MISC, ""Decompressed size error""); r = ARCHIVE_FATAL; goto abort_read_data; } r = checksum_final(a, xar->entry_a_sum.val, xar->entry_a_sum.len, xar->entry_e_sum.val, xar->entry_e_sum.len); if (r != ARCHIVE_OK) goto abort_read_data; } return (ARCHIVE_OK); abort_read_data: *buff = NULL; *size = 0; *offset = xar->total; return (r); } ",0 "static int qeth_clear_channels(struct qeth_card *card) { int rc1 = 0, rc2 = 0, rc3 = 0; QETH_CARD_TEXT(card, 3, ""clearchs""); rc1 = qeth_clear_channel(&card->read); rc2 = qeth_clear_channel(&card->write); rc3 = qeth_clear_channel(&card->data); if (rc1) return rc1; if (rc2) return rc2; return rc3; } ",0 "void payt_del(GF_Box *s) { GF_PAYTBox *payt = (GF_PAYTBox *)s; if (payt->payloadString) gf_free(payt->payloadString); gf_free(payt); } ",0 "HB_Error HB_GPOS_Select_Language( HB_GPOSHeader* gpos, HB_UInt language_tag, HB_UShort script_index, HB_UShort* language_index, HB_UShort* req_feature_index ) { HB_UShort n; HB_ScriptList* sl; HB_ScriptRecord* sr; HB_ScriptTable* s; HB_LangSysRecord* lsr; if ( !gpos || !language_index || !req_feature_index ) return ERR(HB_Err_Invalid_Argument); sl = &gpos->ScriptList; sr = sl->ScriptRecord; if ( script_index >= sl->ScriptCount ) return ERR(HB_Err_Invalid_Argument); s = &sr[script_index].Script; lsr = s->LangSysRecord; for ( n = 0; n < s->LangSysCount; n++ ) if ( language_tag == lsr[n].LangSysTag ) { *language_index = n; *req_feature_index = lsr[n].LangSys.ReqFeatureIndex; return HB_Err_Ok; } return HB_Err_Not_Covered; } ",0 "void WebContentsImpl::DidChangeLoadProgress(double progress) { if (delegate_) delegate_->LoadProgressChanged(this, progress); } ",0 "static void strictFloatAttrSetter(v8::Local name, v8::Local value, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.strictFloat._set""); TestObj* imp = V8TestObj::toNative(info.Holder()); float v = static_cast(value->NumberValue()); imp->setStrictFloat(v); return; } ",0 "static inline bool perf_tryget_cgroup(struct perf_event *event) { return css_tryget(&event->cgrp->css); } ",0 "JSValue jsTestObjReflectedIntegralAttr(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast(asObject(slotBase)); UNUSED_PARAM(exec); TestObj* impl = static_cast(castedThis->impl()); JSValue result = jsNumber(impl->getIntegralAttribute(WebCore::HTMLNames::reflectedintegralattrAttr)); return result; } ",0 "error::Error GLES2DecoderImpl::HandlePathParameterfCHROMIUM( uint32_t immediate_data_size, const volatile void* cmd_data) { static const char kFunctionName[] = ""glPathParameterfCHROMIUM""; const volatile gles2::cmds::PathParameterfCHROMIUM& c = *static_cast( cmd_data); if (!features().chromium_path_rendering) return error::kUnknownCommand; GLuint service_id = 0; if (!path_manager()->GetPath(static_cast(c.path), &service_id)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, kFunctionName, ""invalid path name""); return error::kNoError; } GLenum pname = static_cast(c.pname); GLfloat value = static_cast(c.value); bool hasValueError = false; switch (pname) { case GL_PATH_STROKE_WIDTH_CHROMIUM: case GL_PATH_MITER_LIMIT_CHROMIUM: hasValueError = std::isnan(value) || !std::isfinite(value) || value < 0; break; case GL_PATH_STROKE_BOUND_CHROMIUM: value = std::max(std::min(1.0f, value), 0.0f); break; case GL_PATH_END_CAPS_CHROMIUM: hasValueError = !validators_->path_parameter_cap_values.IsValid( static_cast(value)); break; case GL_PATH_JOIN_STYLE_CHROMIUM: hasValueError = !validators_->path_parameter_join_values.IsValid( static_cast(value)); break; default: DCHECK(!validators_->path_parameter.IsValid(pname)); LOCAL_SET_GL_ERROR_INVALID_ENUM(kFunctionName, pname, ""pname""); return error::kNoError; } DCHECK(validators_->path_parameter.IsValid(pname)); if (hasValueError) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, kFunctionName, ""value not correct""); return error::kNoError; } api()->glPathParameterfNVFn(service_id, pname, value); return error::kNoError; } ",0 "static inline void yam_rx_flag(struct net_device *dev, struct yam_port *yp) { if (yp->dcd && yp->rx_len >= 3 && yp->rx_len < YAM_MAX_FRAME) { int pkt_len = yp->rx_len - 2 + 1; /* -CRC + kiss */ struct sk_buff *skb; if ((yp->rx_crch & yp->rx_crcl) != 0xFF) { /* Bad crc */ } else { if (!(skb = dev_alloc_skb(pkt_len))) { printk(KERN_WARNING ""%s: memory squeeze, dropping packet\n"", dev->name); ++dev->stats.rx_dropped; } else { unsigned char *cp; cp = skb_put(skb, pkt_len); *cp++ = 0; /* KISS kludge */ memcpy(cp, yp->rx_buf, pkt_len - 1); skb->protocol = ax25_type_trans(skb, dev); netif_rx(skb); ++dev->stats.rx_packets; } } } yp->rx_len = 0; yp->rx_crcl = 0x21; yp->rx_crch = 0xf3; } ",0 "ofputil_put_group_prop_ntr_selection_method(enum ofp_version ofp_version, const struct ofputil_group_props *gp, struct ofpbuf *openflow) { struct ntr_group_prop_selection_method *prop; size_t start; start = openflow->size; ofpbuf_put_zeros(openflow, sizeof *prop); oxm_put_field_array(openflow, &gp->fields, ofp_version); prop = ofpbuf_at_assert(openflow, start, sizeof *prop); prop->type = htons(OFPGPT15_EXPERIMENTER); prop->experimenter = htonl(NTR_VENDOR_ID); prop->exp_type = htonl(NTRT_SELECTION_METHOD); strcpy(prop->selection_method, gp->selection_method); prop->selection_method_param = htonll(gp->selection_method_param); ofpprop_end(openflow, start); } ",0 "static int skcipher_all_sg_nents(struct skcipher_ctx *ctx) { struct skcipher_sg_list *sgl; struct scatterlist *sg; int nents = 0; list_for_each_entry(sgl, &ctx->tsgl, list) { sg = sgl->sg; while (!sg->length) sg++; nents += sg_nents(sg); } return nents; } ",0 "static inline int xfrm_replay_verify_len(struct xfrm_replay_state_esn *replay_esn, struct nlattr *rp) { struct xfrm_replay_state_esn *up; int ulen; if (!replay_esn || !rp) return 0; up = nla_data(rp); ulen = xfrm_replay_state_esn_len(up); /* Check the overall length and the internal bitmap length to avoid * potential overflow. */ if (nla_len(rp) < ulen || xfrm_replay_state_esn_len(replay_esn) != ulen || replay_esn->bmp_len != up->bmp_len) return -EINVAL; if (up->replay_window > up->bmp_len * sizeof(__u32) * 8) return -EINVAL; return 0; } ",0 "static int ssl_security_cert_key(SSL *s, SSL_CTX *ctx, X509 *x, int op) { int secbits; EVP_PKEY *pkey = X509_get_pubkey(x); if (pkey) { secbits = EVP_PKEY_security_bits(pkey); EVP_PKEY_free(pkey); } else secbits = -1; if (s) return ssl_security(s, op, secbits, 0, x); else return ssl_ctx_security(ctx, op, secbits, 0, x); } ",0 "static void vhost_zerocopy_done_signal(struct kref *kref) { struct vhost_ubuf_ref *ubufs = container_of(kref, struct vhost_ubuf_ref, kref); wake_up(&ubufs->wait); } ",0 "static void __exit cleanup_ipmi(void) { int count; if (!initialized) return; atomic_notifier_chain_unregister(&panic_notifier_list, &panic_block); /* * This can't be called if any interfaces exist, so no worry * about shutting down the interfaces. */ /* * Tell the timer to stop, then wait for it to stop. This * avoids problems with race conditions removing the timer * here. */ atomic_inc(&stop_operation); del_timer_sync(&ipmi_timer); driver_unregister(&ipmidriver.driver); initialized = 0; /* Check for buffer leaks. */ count = atomic_read(&smi_msg_inuse_count); if (count != 0) pr_warn(""SMI message count %d at exit\n"", count); count = atomic_read(&recv_msg_inuse_count); if (count != 0) pr_warn(""recv message count %d at exit\n"", count); } ",0 " ~TestSafeBrowsingBlockingPage() { if (wait_for_delete_) { MessageLoopForUI::current()->Quit(); } } ",0 "Document& Document::ensureTemplateDocument() { if (isTemplateDocument()) return *this; if (m_templateDocument) return *m_templateDocument; if (isHTMLDocument()) { DocumentInit init = DocumentInit::fromContext(contextDocument(), blankURL()).withNewRegistrationContext(); m_templateDocument = HTMLDocument::create(init); } else { m_templateDocument = Document::create(DocumentInit(blankURL())); } m_templateDocument->m_templateDocumentHost = this; // balanced in dtor. return *m_templateDocument.get(); } ",0 "static void rds_conn_info(struct socket *sock, unsigned int len, struct rds_info_iterator *iter, struct rds_info_lengths *lens) { rds_for_each_conn_info(sock, len, iter, lens, rds_conn_info_visitor, sizeof(struct rds_info_connection)); } ",0 "static noinline int split_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct btrfs_path *path, struct btrfs_key *new_key, unsigned long split_offset) { struct extent_buffer *leaf; struct btrfs_item *item; struct btrfs_item *new_item; int slot; char *buf; u32 nritems; u32 item_size; u32 orig_offset; struct btrfs_disk_key disk_key; leaf = path->nodes[0]; BUG_ON(btrfs_leaf_free_space(root, leaf) < sizeof(struct btrfs_item)); btrfs_set_path_blocking(path); item = btrfs_item_nr(path->slots[0]); orig_offset = btrfs_item_offset(leaf, item); item_size = btrfs_item_size(leaf, item); buf = kmalloc(item_size, GFP_NOFS); if (!buf) return -ENOMEM; read_extent_buffer(leaf, buf, btrfs_item_ptr_offset(leaf, path->slots[0]), item_size); slot = path->slots[0] + 1; nritems = btrfs_header_nritems(leaf); if (slot != nritems) { /* shift the items */ memmove_extent_buffer(leaf, btrfs_item_nr_offset(slot + 1), btrfs_item_nr_offset(slot), (nritems - slot) * sizeof(struct btrfs_item)); } btrfs_cpu_key_to_disk(&disk_key, new_key); btrfs_set_item_key(leaf, &disk_key, slot); new_item = btrfs_item_nr(slot); btrfs_set_item_offset(leaf, new_item, orig_offset); btrfs_set_item_size(leaf, new_item, item_size - split_offset); btrfs_set_item_offset(leaf, item, orig_offset + item_size - split_offset); btrfs_set_item_size(leaf, item, split_offset); btrfs_set_header_nritems(leaf, nritems + 1); /* write the data for the start of the original item */ write_extent_buffer(leaf, buf, btrfs_item_ptr_offset(leaf, path->slots[0]), split_offset); /* write the data for the new item */ write_extent_buffer(leaf, buf + split_offset, btrfs_item_ptr_offset(leaf, slot), item_size - split_offset); btrfs_mark_buffer_dirty(leaf); BUG_ON(btrfs_leaf_free_space(root, leaf) < 0); kfree(buf); return 0; } ",0 "clump_splay_walk_bwd_init(clump_splay_walker *sw, const gs_ref_memory_t *mem) { clump_t *cp = mem->root; if (cp) { SANITY_CHECK(cp); sw->from = SPLAY_FROM_RIGHT; while (cp->right) { cp = cp->right; } } sw->cp = cp; sw->end = NULL; return cp; } ",0 "rad_get_attr(struct rad_handle *h, const void **value, size_t *len) { int type; if (h->resp_pos >= h->resp_len) return 0; if (h->resp_pos + 2 > h->resp_len) { generr(h, ""Malformed attribute in response""); return -1; } type = h->response[h->resp_pos++]; *len = h->response[h->resp_pos++] - 2; if (h->resp_pos + (int) *len > h->resp_len) { generr(h, ""Malformed attribute in response""); return -1; } *value = &h->response[h->resp_pos]; h->resp_pos += *len; return type; } ",0 "static void DeprecateAsSameValueMeasureAsSameValueOverloadedMethod1Method(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); impl->deprecateAsSameValueMeasureAsSameValueOverloadedMethod(); } ",0 "should_get_mime_list (NautilusFile *file) { return lacks_mime_list (file) && !file->details->loading_directory; } ",0 "static int pnm_getint16(jas_stream_t *in, int *val) { int v; int c; if ((c = jas_stream_getc(in)) == EOF) { return -1; } v = c & 0xff; if ((c = jas_stream_getc(in)) == EOF) { return -1; } v = (v << 8) | (c & 0xff); *val = v; return 0; } ",0 "static int nfs4_proc_readdir(struct dentry *dentry, struct rpc_cred *cred, u64 cookie, struct page *page, unsigned int count, int plus) { struct nfs4_exception exception = { }; int err; do { err = nfs4_handle_exception(NFS_SERVER(dentry->d_inode), _nfs4_proc_readdir(dentry, cred, cookie, page, count, plus), &exception); } while (exception.retry); return err; } ",0 "void InjectedBundlePage::didFailLoadForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t identifier, WKErrorRef error) { if (!InjectedBundle::shared().isTestRunning()) return; if (!InjectedBundle::shared().testRunner()->shouldDumpResourceLoadCallbacks()) return; StringBuilder stringBuilder; dumpResourceURL(identifier, stringBuilder); stringBuilder.appendLiteral("" - didFailLoadingWithError: ""); dumpErrorDescriptionSuitableForTestResult(error, stringBuilder); stringBuilder.append('\n'); InjectedBundle::shared().outputText(stringBuilder.toString()); } ",0 "static const char *set_http_method(cmd_parms *cmd, void *conf, const char *arg) { const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); if (err != NULL) return err; ap_method_register(cmd->pool, arg); return NULL; } ",0 "static unsigned long elf_map(struct file *filep, unsigned long addr, struct elf_phdr *eppnt, int prot, int type, unsigned long total_size) { unsigned long map_addr; unsigned long size = eppnt->p_filesz + ELF_PAGEOFFSET(eppnt->p_vaddr); unsigned long off = eppnt->p_offset - ELF_PAGEOFFSET(eppnt->p_vaddr); addr = ELF_PAGESTART(addr); size = ELF_PAGEALIGN(size); /* mmap() will return -EINVAL if given a zero size, but a * segment with zero filesize is perfectly valid */ if (!size) return addr; down_write(¤t->mm->mmap_sem); /* * total_size is the size of the ELF (interpreter) image. * The _first_ mmap needs to know the full size, otherwise * randomization might put this image into an overlapping * position with the ELF binary image. (since size < total_size) * So we first map the 'big' image - and unmap the remainder at * the end. (which unmap is needed for ELF images with holes.) */ if (total_size) { total_size = ELF_PAGEALIGN(total_size); map_addr = do_mmap(filep, addr, total_size, prot, type, off); if (!BAD_ADDR(map_addr)) do_munmap(current->mm, map_addr+size, total_size-size); } else map_addr = do_mmap(filep, addr, size, prot, type, off); up_write(¤t->mm->mmap_sem); return(map_addr); } ",0 "void arm_iommu_detach_device(struct device *dev) { struct dma_iommu_mapping *mapping; mapping = to_dma_iommu_mapping(dev); if (!mapping) { dev_warn(dev, ""Not attached\n""); return; } iommu_detach_device(mapping->domain, dev); kref_put(&mapping->kref, release_iommu_mapping); dev->archdata.mapping = NULL; set_dma_ops(dev, NULL); pr_debug(""Detached IOMMU controller from %s device.\n"", dev_name(dev)); } ",0 "int sx_sasl_auth(sx_plugin_t p, sx_t s, const char *appname, const char *mech, const char *user, const char *pass) { _sx_sasl_t ctx = (_sx_sasl_t) p->private; _sx_sasl_sess_t sctx = NULL; Gsasl_session *sd; char *buf = NULL, *out = NULL; char hostname[256]; int ret, ns; size_t buflen, outlen; nad_t nad; assert((p != NULL)); assert((s != NULL)); assert((appname != NULL)); assert((mech != NULL)); assert((user != NULL)); assert((pass != NULL)); if(s->type != type_CLIENT || s->state != state_STREAM) { _sx_debug(ZONE, ""need client in stream state for sasl auth""); return 1; } /* handshake start */ ret = gsasl_client_start(ctx->gsasl_ctx, mech, &sd); if(ret != GSASL_OK) { _sx_debug(ZONE, ""gsasl_client_start failed, not authing; (%d): %s"", ret, gsasl_strerror(ret)); return 1; } /* get hostname */ hostname[0] = '\0'; gethostname(hostname, 256); hostname[255] = '\0'; /* cleanup any existing session context */ sctx = gsasl_session_hook_get(sd); if (sctx != NULL) free(sctx); /* allocate and initialize our per session context */ sctx = (_sx_sasl_sess_t) calloc(1, sizeof(struct _sx_sasl_sess_st)); sctx->s = s; sctx->ctx = ctx; /* set user data in session handle */ gsasl_session_hook_set(sd, (void *) sctx); gsasl_property_set(sd, GSASL_AUTHID, user); gsasl_property_set(sd, GSASL_PASSWORD, pass); gsasl_property_set(sd, GSASL_SERVICE, appname); gsasl_property_set(sd, GSASL_HOSTNAME, hostname); /* handshake step */ ret = gsasl_step(sd, NULL, 0, &out, &outlen); if(ret != GSASL_OK && ret != GSASL_NEEDS_MORE) { _sx_debug(ZONE, ""gsasl_step failed, not authing; (%d): %s"", ret, gsasl_strerror(ret)); gsasl_finish(sd); return 1; } /* save userdata */ s->plugin_data[p->index] = (void *) sd; /* in progress */ _sx_debug(ZONE, ""sending auth request to server, mech '%s': %.*s"", mech, outlen, out); /* encode the challenge */ ret = gsasl_base64_to(out, outlen, &buf, &buflen); if(ret != GSASL_OK) { _sx_debug(ZONE, ""gsasl_base64_to failed, not authing; (%d): %s"", ret, gsasl_strerror(ret)); gsasl_finish(sd); if (out != NULL) free(out); return 1; } free(out); /* build the nad */ nad = nad_new(); ns = nad_add_namespace(nad, uri_SASL, NULL); nad_append_elem(nad, ns, ""auth"", 0); nad_append_attr(nad, -1, ""mechanism"", mech); if(buf != NULL) { nad_append_cdata(nad, buf, buflen, 1); free(buf); } /* its away */ sx_nad_write(s, nad); return 0; } ",0 "JBIG2Bitmap::JBIG2Bitmap(Guint segNumA, int wA, int hA): JBIG2Segment(segNumA) { w = wA; h = hA; line = (wA + 7) >> 3; if (w <= 0 || h <= 0 || line <= 0 || h >= (INT_MAX - 1) / line) { error(errSyntaxError, -1, ""invalid width/height""); data = NULL; return; } data = (Guchar *)gmalloc_checkoverflow(h * line + 1); if (data != NULL) { data[h * line] = 0; } } ",0 "static int scsi_disk_initfn(SCSIDevice *dev) { DriveInfo *dinfo; uint8_t scsi_type; if (!dev->conf.bs) { scsi_type = TYPE_DISK; /* will die in scsi_initfn() */ } else { dinfo = drive_get_by_blockdev(dev->conf.bs); scsi_type = dinfo->media_cd ? TYPE_ROM : TYPE_DISK; } return scsi_initfn(dev, scsi_type); } ",0 "void Vec4::GetValues(GLuint* values) const { DCHECK(values); switch (type_) { case SHADER_VARIABLE_FLOAT: for (size_t ii = 0; ii < 4; ++ii) values[ii] = static_cast(v_[ii].float_value); break; case SHADER_VARIABLE_INT: for (size_t ii = 0; ii < 4; ++ii) values[ii] = static_cast(v_[ii].int_value); break; case SHADER_VARIABLE_UINT: for (size_t ii = 0; ii < 4; ++ii) values[ii] = v_[ii].uint_value; break; default: NOTREACHED(); break; } } ",0 "void InProcessBrowserTest::PrepareTestCommandLine(CommandLine* command_line) { test_launcher_utils::PrepareBrowserCommandLineForTests(command_line); if (dom_automation_enabled_) command_line->AppendSwitch(switches::kDomAutomationController); command_line->AppendSwitchASCII(switches::kTestType, kBrowserTestType); #if defined(OS_WIN) command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, command_line->GetProgram()); #else FilePath subprocess_path; PathService::Get(base::FILE_EXE, &subprocess_path); #if defined(OS_MACOSX) subprocess_path = subprocess_path.DirName().DirName(); DCHECK_EQ(subprocess_path.BaseName().value(), ""Contents""); subprocess_path = subprocess_path.Append(""Versions"").Append(chrome::kChromeVersion); subprocess_path = subprocess_path.Append(chrome::kHelperProcessExecutablePath); #endif command_line->AppendSwitchPath(switches::kBrowserSubprocessPath, subprocess_path); #endif if (!tab_closeable_state_watcher_enabled_) command_line->AppendSwitch(switches::kDisableTabCloseableStateWatcher); } ",0 "GF_Err stsg_Size(GF_Box *s) { GF_SubTrackSampleGroupBox *ptr = (GF_SubTrackSampleGroupBox *)s; ptr->size += 6 + 4 * ptr->nb_groups; return GF_OK; } ",0 "WebUI::TypeID ChromeWebUIControllerFactory::GetWebUIType( content::BrowserContext* browser_context, const GURL& url) const { Profile* profile = Profile::FromBrowserContext(browser_context); WebUIFactoryFunction function = GetWebUIFactoryFunction(NULL, profile, url); return function ? reinterpret_cast(function) : WebUI::kNoWebUI; } ",0 "WORD32 ih264d_parse_pps(dec_struct_t * ps_dec, dec_bit_stream_t * ps_bitstrm) { UWORD8 uc_temp; dec_seq_params_t * ps_sps = NULL; dec_pic_params_t * ps_pps = NULL; UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer; UWORD32 *pu4_bitstrm_ofst = &ps_dec->ps_bitstrm->u4_ofst; /* Variables used for error resilience checks */ UWORD32 u4_temp; WORD32 i_temp; /* For High profile related syntax elements */ UWORD8 u1_more_data_flag; WORD32 i4_i; /*--------------------------------------------------------------------*/ /* Decode pic_parameter_set_id and find corresponding pic params */ /*--------------------------------------------------------------------*/ u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u4_temp & MASK_ERR_PIC_SET_ID) return ERROR_INV_SPS_PPS_T; ps_pps = ps_dec->pv_scratch_sps_pps; *ps_pps = ps_dec->ps_pps[u4_temp]; ps_pps->u1_pic_parameter_set_id = (WORD8)u4_temp; COPYTHECONTEXT(""PPS: pic_parameter_set_id"",ps_pps->u1_pic_parameter_set_id); /************************************************/ /* initilization of High profile syntax element */ /************************************************/ ps_pps->i4_transform_8x8_mode_flag = 0; ps_pps->i4_pic_scaling_matrix_present_flag = 0; /*--------------------------------------------------------------------*/ /* Decode seq_parameter_set_id and map it to a seq_parameter_set */ /*--------------------------------------------------------------------*/ u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u4_temp & MASK_ERR_SEQ_SET_ID) return ERROR_INV_SPS_PPS_T; COPYTHECONTEXT(""PPS: seq_parameter_set_id"",u4_temp); ps_sps = &ps_dec->ps_sps[u4_temp]; ps_pps->ps_sps = ps_sps; /*--------------------------------------------------------------------*/ /* Decode entropy_coding_mode */ /*--------------------------------------------------------------------*/ ps_pps->u1_entropy_coding_mode = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT(""PPS: entropy_coding_mode_flag"",ps_pps->u1_entropy_coding_mode); ps_pps->u1_pic_order_present_flag = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT(""PPS: pic_order_present_flag"",ps_pps->u1_pic_order_present_flag); /*--------------------------------------------------------------------*/ /* Decode num_slice_groups_minus1 */ /*--------------------------------------------------------------------*/ u4_temp = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf) + 1; if(u4_temp != 1) { UWORD32 i4_error_code; i4_error_code = ERROR_FEATURE_UNAVAIL; return i4_error_code; } ps_pps->u1_num_slice_groups = u4_temp; COPYTHECONTEXT(""PPS: num_slice_groups_minus1"",ps_pps->u1_num_slice_groups -1); /*--------------------------------------------------------------------*/ /* Other parameter set values */ /*--------------------------------------------------------------------*/ u4_temp = 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u4_temp > H264_MAX_REF_IDX) return ERROR_REF_IDX; ps_pps->u1_num_ref_idx_lx_active[0] = u4_temp; COPYTHECONTEXT(""PPS: num_ref_idx_l0_active_minus1"", ps_pps->u1_num_ref_idx_lx_active[0] - 1); u4_temp = 1 + ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if(u4_temp > H264_MAX_REF_IDX) return ERROR_REF_IDX; ps_pps->u1_num_ref_idx_lx_active[1] = u4_temp; COPYTHECONTEXT(""PPS: num_ref_idx_l1_active_minus1"", ps_pps->u1_num_ref_idx_lx_active[1] - 1); ps_pps->u1_wted_pred_flag = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT(""PPS: weighted prediction u4_flag"",ps_pps->u1_wted_pred_flag); uc_temp = ih264d_get_bits_h264(ps_bitstrm, 2); COPYTHECONTEXT(""PPS: weighted_bipred_idc"",uc_temp); ps_pps->u1_wted_bipred_idc = uc_temp; if(ps_pps->u1_wted_bipred_idc > MAX_WEIGHT_BIPRED_IDC) return ERROR_INV_SPS_PPS_T; i_temp = 26 + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if((i_temp < 0) || (i_temp > 51)) return ERROR_INV_RANGE_QP_T; ps_pps->u1_pic_init_qp = i_temp; COPYTHECONTEXT(""PPS: pic_init_qp_minus26"",ps_pps->u1_pic_init_qp - 26); i_temp = 26 + ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if((i_temp < 0) || (i_temp > 51)) return ERROR_INV_RANGE_QP_T; ps_pps->u1_pic_init_qs = i_temp; COPYTHECONTEXT(""PPS: pic_init_qs_minus26"",ps_pps->u1_pic_init_qs - 26); i_temp = ih264d_sev(pu4_bitstrm_ofst, pu4_bitstrm_buf); if((i_temp < -12) || (i_temp > 12)) return ERROR_INV_RANGE_QP_T; ps_pps->i1_chroma_qp_index_offset = i_temp; COPYTHECONTEXT(""PPS: chroma_qp_index_offset"",ps_pps->i1_chroma_qp_index_offset); /***************************************************************************/ /* initialize second_chroma_qp_index_offset to i1_chroma_qp_index_offset if */ /* second_chroma_qp_index_offset is not present in bit-ps_bitstrm */ /***************************************************************************/ ps_pps->i1_second_chroma_qp_index_offset = ps_pps->i1_chroma_qp_index_offset; ps_pps->u1_deblocking_filter_parameters_present_flag = ih264d_get_bit_h264( ps_bitstrm); COPYTHECONTEXT(""PPS: deblocking_filter_control_present_flag"", ps_pps->u1_deblocking_filter_parameters_present_flag); ps_pps->u1_constrained_intra_pred_flag = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT(""PPS: constrained_intra_pred_flag"", ps_pps->u1_constrained_intra_pred_flag); ps_pps->u1_redundant_pic_cnt_present_flag = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT(""PPS: redundant_pic_cnt_present_flag"", ps_pps->u1_redundant_pic_cnt_present_flag); /* High profile related syntax elements */ u1_more_data_flag = MORE_RBSP_DATA(ps_bitstrm); if(u1_more_data_flag && (ps_pps->ps_sps->u1_profile_idc == HIGH_PROFILE_IDC)) { /* read transform_8x8_mode_flag */ ps_pps->i4_transform_8x8_mode_flag = (WORD32)ih264d_get_bit_h264( ps_bitstrm); /* read pic_scaling_matrix_present_flag */ ps_pps->i4_pic_scaling_matrix_present_flag = (WORD32)ih264d_get_bit_h264(ps_bitstrm); if(ps_pps->i4_pic_scaling_matrix_present_flag) { /* read the scaling matrices */ for(i4_i = 0; i4_i < (6 + (ps_pps->i4_transform_8x8_mode_flag << 1)); i4_i++) { ps_pps->u1_pic_scaling_list_present_flag[i4_i] = ih264d_get_bit_h264(ps_bitstrm); if(ps_pps->u1_pic_scaling_list_present_flag[i4_i]) { if(i4_i < 6) { ih264d_scaling_list( ps_pps->i2_pic_scalinglist4x4[i4_i], 16, &ps_pps->u1_pic_use_default_scaling_matrix_flag[i4_i], ps_bitstrm); } else { ih264d_scaling_list( ps_pps->i2_pic_scalinglist8x8[i4_i - 6], 64, &ps_pps->u1_pic_use_default_scaling_matrix_flag[i4_i], ps_bitstrm); } } } } /* read second_chroma_qp_index_offset syntax element */ ps_pps->i1_second_chroma_qp_index_offset = ih264d_sev( pu4_bitstrm_ofst, pu4_bitstrm_buf); if((ps_pps->i1_second_chroma_qp_index_offset + 12) > 24) return ERROR_INV_RANGE_QP_T; } /* In case bitstream read has exceeded the filled size, then return an error */ if(ps_bitstrm->u4_ofst > ps_bitstrm->u4_max_ofst + 8) { return ERROR_INV_SPS_PPS_T; } ps_pps->u1_is_valid = TRUE; ps_dec->ps_pps[ps_pps->u1_pic_parameter_set_id] = *ps_pps; return OK; } ",0 "void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) { TRACE_EVENT1(""browser,navigation"", ""NavigationControllerImpl::LoadURLWithParams"", ""url"", params.url.possibly_invalid_spec()); if (HandleDebugURL(params.url, params.transition_type)) { if (!base::CommandLine::ForCurrentProcess()->HasSwitch( cc::switches::kEnableGpuBenchmarking)) return; } switch (params.load_type) { case LOAD_TYPE_DEFAULT: case LOAD_TYPE_HTTP_POST: break; case LOAD_TYPE_DATA: if (!params.url.SchemeIs(url::kDataScheme)) { NOTREACHED() << ""Data load must use data scheme.""; return; } break; default: NOTREACHED(); break; }; needs_reload_ = false; bool override = false; switch (params.override_user_agent) { case UA_OVERRIDE_INHERIT: override = ShouldKeepOverride(GetLastCommittedEntry()); break; case UA_OVERRIDE_TRUE: override = true; break; case UA_OVERRIDE_FALSE: override = false; break; default: NOTREACHED(); break; } std::unique_ptr entry; int frame_tree_node_id = params.frame_tree_node_id; if (frame_tree_node_id != -1 || !params.frame_name.empty()) { FrameTreeNode* node = params.frame_tree_node_id != -1 ? delegate_->GetFrameTree()->FindByID(params.frame_tree_node_id) : delegate_->GetFrameTree()->FindByName(params.frame_name); if (node && !node->IsMainFrame()) { DCHECK(GetLastCommittedEntry()); frame_tree_node_id = node->frame_tree_node_id(); entry = GetLastCommittedEntry()->Clone(); entry->AddOrUpdateFrameEntry( node, -1, -1, nullptr, static_cast(params.source_site_instance.get()), params.url, params.referrer, params.redirect_chain, PageState(), ""GET"", -1); } } if (!entry) { entry = NavigationEntryImpl::FromNavigationEntry(CreateNavigationEntry( params.url, params.referrer, params.transition_type, params.is_renderer_initiated, params.extra_headers, browser_context_)); entry->set_source_site_instance( static_cast(params.source_site_instance.get())); entry->SetRedirectChain(params.redirect_chain); } entry->set_frame_tree_node_id(frame_tree_node_id); if (params.should_replace_current_entry && entries_.size() > 0) entry->set_should_replace_entry(true); entry->set_should_clear_history_list(params.should_clear_history_list); entry->SetIsOverridingUserAgent(override); entry->set_transferred_global_request_id( params.transferred_global_request_id); #if defined(OS_ANDROID) if (params.intent_received_timestamp > 0) { entry->set_intent_received_timestamp( base::TimeTicks() + base::TimeDelta::FromMilliseconds(params.intent_received_timestamp)); } entry->set_has_user_gesture(params.has_user_gesture); #endif switch (params.load_type) { case LOAD_TYPE_DEFAULT: break; case LOAD_TYPE_HTTP_POST: entry->SetHasPostData(true); entry->SetPostData(params.post_data); break; case LOAD_TYPE_DATA: entry->SetBaseURLForDataURL(params.base_url_for_data_url); entry->SetVirtualURL(params.virtual_url_for_data_url); #if defined(OS_ANDROID) entry->SetDataURLAsString(params.data_url_as_string); #endif entry->SetCanLoadLocalResources(params.can_load_local_resources); break; default: NOTREACHED(); break; }; entry->set_started_from_context_menu(params.started_from_context_menu); LoadEntry(std::move(entry)); } ",0 "val_unwrap_iov_args( OM_uint32 *minor_status, gss_ctx_id_t context_handle, int *conf_state, gss_qop_t *qop_state, gss_iov_buffer_desc *iov, int iov_count) { /* Initialize outputs. */ if (minor_status != NULL) *minor_status = 0; /* Validate arguments. */ if (minor_status == NULL) return (GSS_S_CALL_INACCESSIBLE_WRITE); if (context_handle == GSS_C_NO_CONTEXT) return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); if (iov == GSS_C_NO_IOV_BUFFER) return (GSS_S_CALL_INACCESSIBLE_READ); return (GSS_S_COMPLETE); } ",0 "static zend_object_value spl_heap_object_new_ex(zend_class_entry *class_type, spl_heap_object **obj, zval *orig, int clone_orig TSRMLS_DC) /* {{{ */ { zend_object_value retval; spl_heap_object *intern; zend_class_entry *parent = class_type; int inherited = 0; intern = ecalloc(1, sizeof(spl_heap_object)); *obj = intern; ALLOC_INIT_ZVAL(intern->retval); zend_object_std_init(&intern->std, class_type TSRMLS_CC); object_properties_init(&intern->std, class_type); intern->flags = 0; intern->fptr_cmp = NULL; intern->debug_info = NULL; if (orig) { spl_heap_object *other = (spl_heap_object*)zend_object_store_get_object(orig TSRMLS_CC); intern->ce_get_iterator = other->ce_get_iterator; if (clone_orig) { int i; intern->heap = spl_ptr_heap_clone(other->heap TSRMLS_CC); for (i = 0; i < intern->heap->count; ++i) { if (intern->heap->elements[i]) { Z_ADDREF_P((zval *)intern->heap->elements[i]); } } } else { intern->heap = other->heap; } intern->flags = other->flags; } else { intern->heap = spl_ptr_heap_init(spl_ptr_heap_zval_max_cmp, spl_ptr_heap_zval_ctor, spl_ptr_heap_zval_dtor); } retval.handlers = &spl_handler_SplHeap; while (parent) { if (parent == spl_ce_SplPriorityQueue) { intern->heap->cmp = spl_ptr_pqueue_zval_cmp; intern->flags = SPL_PQUEUE_EXTR_DATA; retval.handlers = &spl_handler_SplPriorityQueue; break; } if (parent == spl_ce_SplMinHeap) { intern->heap->cmp = spl_ptr_heap_zval_min_cmp; break; } if (parent == spl_ce_SplMaxHeap) { intern->heap->cmp = spl_ptr_heap_zval_max_cmp; break; } if (parent == spl_ce_SplHeap) { break; } parent = parent->parent; inherited = 1; } retval.handle = zend_objects_store_put(intern, (zend_objects_store_dtor_t)zend_objects_destroy_object, spl_heap_object_free_storage, NULL TSRMLS_CC); if (!parent) { /* this must never happen */ php_error_docref(NULL TSRMLS_CC, E_COMPILE_ERROR, ""Internal compiler error, Class is not child of SplHeap""); } if (inherited) { zend_hash_find(&class_type->function_table, ""compare"", sizeof(""compare""), (void **) &intern->fptr_cmp); if (intern->fptr_cmp->common.scope == parent) { intern->fptr_cmp = NULL; } zend_hash_find(&class_type->function_table, ""count"", sizeof(""count""), (void **) &intern->fptr_count); if (intern->fptr_count->common.scope == parent) { intern->fptr_count = NULL; } } return retval; } /* }}} */ ",0 "ElementShadow* Element::shadow() const { return hasRareData() ? elementRareData()->shadow() : 0; } ",0 "void HTMLMediaElement::ScheduleNextSourceChild() { pending_action_flags_ |= kLoadMediaResource; load_timer_.StartOneShot(TimeDelta(), FROM_HERE); } ",0 "void Document::UpdateStyleAndLayout(ForcedLayoutStatus status) { DCHECK(IsMainThread()); LocalFrameView* frame_view = View(); if (status == IsForcedLayout && frame_view) frame_view->WillStartForcedLayout(); HTMLFrameOwnerElement::PluginDisposeSuspendScope suspend_plugin_dispose; ScriptForbiddenScope forbid_script; DCHECK(!frame_view || !frame_view->IsInPerformLayout()) << ""View layout should not be re-entrant""; if (HTMLFrameOwnerElement* owner = LocalOwner()) owner->GetDocument().UpdateStyleAndLayout(); UpdateStyleAndLayoutTree(); if (!IsActive()) return; if (frame_view && frame_view->NeedsLayout()) frame_view->UpdateLayout(); if (Lifecycle().GetState() < DocumentLifecycle::kLayoutClean) Lifecycle().AdvanceTo(DocumentLifecycle::kLayoutClean); if (AXObjectCache* cache = ExistingAXObjectCache()) cache->ProcessUpdatesAfterLayout(*this); if (LocalFrameView* frame_view_anchored = View()) frame_view_anchored->PerformScrollAnchoringAdjustments(); if (status == IsForcedLayout && frame_view) frame_view->DidFinishForcedLayout(); } ",0 "void InterstitialPageImpl::CancelForNavigation() { Disable(); if (new_navigation_) TakeActionOnResourceDispatcher(RESUME); else TakeActionOnResourceDispatcher(CANCEL); } ",0 "sd_read_write_protect_flag(struct scsi_disk *sdkp, unsigned char *buffer) { int res; struct scsi_device *sdp = sdkp->device; struct scsi_mode_data data; int old_wp = sdkp->write_prot; set_disk_ro(sdkp->disk, 0); if (sdp->skip_ms_page_3f) { sd_printk(KERN_NOTICE, sdkp, ""Assuming Write Enabled\n""); return; } if (sdp->use_192_bytes_for_3f) { res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 192, &data, NULL); } else { /* * First attempt: ask for all pages (0x3F), but only 4 bytes. * We have to start carefully: some devices hang if we ask * for more than is available. */ res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 4, &data, NULL); /* * Second attempt: ask for page 0 When only page 0 is * implemented, a request for page 3F may return Sense Key * 5: Illegal Request, Sense Code 24: Invalid field in * CDB. */ if (!scsi_status_is_good(res)) res = sd_do_mode_sense(sdp, 0, 0, buffer, 4, &data, NULL); /* * Third attempt: ask 255 bytes, as we did earlier. */ if (!scsi_status_is_good(res)) res = sd_do_mode_sense(sdp, 0, 0x3F, buffer, 255, &data, NULL); } if (!scsi_status_is_good(res)) { sd_printk(KERN_WARNING, sdkp, ""Test WP failed, assume Write Enabled\n""); } else { sdkp->write_prot = ((data.device_specific & 0x80) != 0); set_disk_ro(sdkp->disk, sdkp->write_prot); if (sdkp->first_scan || old_wp != sdkp->write_prot) { sd_printk(KERN_NOTICE, sdkp, ""Write Protect is %s\n"", sdkp->write_prot ? ""on"" : ""off""); sd_printk(KERN_DEBUG, sdkp, ""Mode Sense: %02x %02x %02x %02x\n"", buffer[0], buffer[1], buffer[2], buffer[3]); } } } ",0 "construct_mac_tlv(struct sc_card *card, unsigned char *apdu_buf, size_t data_tlv_len, size_t le_tlv_len, unsigned char *mac_tlv, size_t * mac_tlv_len, const unsigned char key_type) { size_t block_size = (KEY_TYPE_AES == key_type ? 16 : 8); unsigned char mac[4096] = { 0 }; size_t mac_len; unsigned char icv[16] = { 0 }; int i = (KEY_TYPE_AES == key_type ? 15 : 7); epass2003_exdata *exdata = NULL; if (!card->drv_data) return SC_ERROR_INVALID_ARGUMENTS; exdata = (epass2003_exdata *)card->drv_data; if (0 == data_tlv_len && 0 == le_tlv_len) { mac_len = block_size; } else { /* padding */ *(apdu_buf + block_size + data_tlv_len + le_tlv_len) = 0x80; if ((data_tlv_len + le_tlv_len + 1) % block_size) mac_len = (((data_tlv_len + le_tlv_len + 1) / block_size) + 1) * block_size + block_size; else mac_len = data_tlv_len + le_tlv_len + 1 + block_size; memset((apdu_buf + block_size + data_tlv_len + le_tlv_len + 1), 0, (mac_len - (data_tlv_len + le_tlv_len + 1))); } /* increase icv */ for (; i >= 0; i--) { if (exdata->icv_mac[i] == 0xff) { exdata->icv_mac[i] = 0; } else { exdata->icv_mac[i]++; break; } } /* calculate MAC */ memset(icv, 0, sizeof(icv)); memcpy(icv, exdata->icv_mac, 16); if (KEY_TYPE_AES == key_type) { aes128_encrypt_cbc(exdata->sk_mac, 16, icv, apdu_buf, mac_len, mac); memcpy(mac_tlv + 2, &mac[mac_len - 16], 8); } else { unsigned char iv[8] = { 0 }; unsigned char tmp[8] = { 0 }; des_encrypt_cbc(exdata->sk_mac, 8, icv, apdu_buf, mac_len, mac); des_decrypt_cbc(&exdata->sk_mac[8], 8, iv, &mac[mac_len - 8], 8, tmp); memset(iv, 0x00, 8); des_encrypt_cbc(exdata->sk_mac, 8, iv, tmp, 8, mac_tlv + 2); } *mac_tlv_len = 2 + 8; return 0; } ",1 "SWFShape_addGradientFillStyle(SWFShape shape, SWFGradient gradient, byte flags) { SWFFillStyle fill = newSWFGradientFillStyle(gradient, flags); if(addFillStyle(shape, fill) < 0) { destroySWFFillStyle(fill); return NULL; } return fill; } ",0 " instance_id::FakeGCMDriverForInstanceID* gcm_driver() const { return gcm_driver_; } ",0 "status_t OMXCodec::parseHEVCCodecSpecificData( const void *data, size_t size, unsigned *profile, unsigned *level) { const uint8_t *ptr = (const uint8_t *)data; if (size < 7 || ptr[0] != 1) { return ERROR_MALFORMED; } *profile = (ptr[1] & 31); *level = ptr[12]; ptr += 22; size -= 22; size_t numofArrays = (char)ptr[0]; ptr += 1; size -= 1; size_t j = 0, i = 0; for (i = 0; i < numofArrays; i++) { ptr += 1; size -= 1; size_t numofNals = U16_AT(ptr); ptr += 2; size -= 2; for (j = 0;j < numofNals;j++) { if (size < 2) { return ERROR_MALFORMED; } size_t length = U16_AT(ptr); ptr += 2; size -= 2; if (size < length) { return ERROR_MALFORMED; } addCodecSpecificData(ptr, length); ptr += length; size -= length; } } return OK; } ",0 "void SyncManager::SyncInternal::ReEncryptEverything(WriteTransaction* trans) { Cryptographer* cryptographer = trans->GetCryptographer(); if (!cryptographer || !cryptographer->is_ready()) return; syncable::ModelTypeSet encrypted_types = GetEncryptedTypes(trans); ModelSafeRoutingInfo routes; registrar_->GetModelSafeRoutingInfo(&routes); std::string tag; for (syncable::ModelTypeSet::Iterator iter = encrypted_types.First(); iter.Good(); iter.Inc()) { if (iter.Get() == syncable::PASSWORDS || iter.Get() == syncable::NIGORI || routes.count(iter.Get()) == 0) continue; ReadNode type_root(trans); tag = syncable::ModelTypeToRootTag(iter.Get()); if (!type_root.InitByTagLookup(tag)) { continue; } std::queue to_visit; int64 child_id = type_root.GetFirstChildId(); to_visit.push(child_id); while (!to_visit.empty()) { child_id = to_visit.front(); to_visit.pop(); if (child_id == kInvalidId) continue; WriteNode child(trans); if (!child.InitByIdLookup(child_id)) { NOTREACHED(); continue; } if (child.GetIsFolder()) { to_visit.push(child.GetFirstChildId()); } if (child.GetEntry()->Get(syncable::UNIQUE_SERVER_TAG).empty()) { child.ResetFromSpecifics(); } to_visit.push(child.GetSuccessorId()); } } if (routes.count(syncable::PASSWORDS) > 0) { ReadNode passwords_root(trans); std::string passwords_tag = syncable::ModelTypeToRootTag(syncable::PASSWORDS); if (passwords_root.InitByTagLookup(passwords_tag)) { int64 child_id = passwords_root.GetFirstChildId(); while (child_id != kInvalidId) { WriteNode child(trans); if (!child.InitByIdLookup(child_id)) { NOTREACHED(); return; } child.SetPasswordSpecifics(child.GetPasswordSpecifics()); child_id = child.GetSuccessorId(); } } } FOR_EACH_OBSERVER(SyncManager::Observer, observers_, OnEncryptionComplete()); } ",0 "void RenderView::OnGetAccessibilityTree() { if (accessibility_.get()) accessibility_->clear(); accessibility_.reset(WebAccessibilityCache::create()); accessibility_->initialize(webview()); WebAccessibilityObject src_tree = webview()->accessibilityObject(); webkit_glue::WebAccessibility dst_tree(src_tree, accessibility_.get()); Send(new ViewHostMsg_AccessibilityTree(routing_id_, dst_tree)); } ",0 "int compat_get_timespec(struct timespec *ts, const void __user *uts) { if (COMPAT_USE_64BIT_TIME) return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0; else return __compat_get_timespec(ts, uts); } ",0 "static void ndp_sock_close(struct ndp *ndp) { close(ndp->sock); } ",0 "static int ext4_ext_try_to_merge_right(struct inode *inode, struct ext4_ext_path *path, struct ext4_extent *ex) { struct ext4_extent_header *eh; unsigned int depth, len; int merge_done = 0; int uninitialized = 0; depth = ext_depth(inode); BUG_ON(path[depth].p_hdr == NULL); eh = path[depth].p_hdr; while (ex < EXT_LAST_EXTENT(eh)) { if (!ext4_can_extents_be_merged(inode, ex, ex + 1)) break; /* merge with next extent! */ if (ext4_ext_is_uninitialized(ex)) uninitialized = 1; ex->ee_len = cpu_to_le16(ext4_ext_get_actual_len(ex) + ext4_ext_get_actual_len(ex + 1)); if (uninitialized) ext4_ext_mark_uninitialized(ex); if (ex + 1 < EXT_LAST_EXTENT(eh)) { len = (EXT_LAST_EXTENT(eh) - ex - 1) * sizeof(struct ext4_extent); memmove(ex + 1, ex + 2, len); } le16_add_cpu(&eh->eh_entries, -1); merge_done = 1; WARN_ON(eh->eh_entries == 0); if (!eh->eh_entries) EXT4_ERROR_INODE(inode, ""eh->eh_entries = 0!""); } return merge_done; } ",0 "int CMS_decrypt(CMS_ContentInfo *cms, EVP_PKEY *pk, X509 *cert, BIO *dcont, BIO *out, unsigned int flags) { int r; BIO *cont; if (OBJ_obj2nid(CMS_get0_type(cms)) != NID_pkcs7_enveloped) { CMSerr(CMS_F_CMS_DECRYPT, CMS_R_TYPE_NOT_ENVELOPED_DATA); return 0; } if (!dcont && !check_content(cms)) return 0; if (flags & CMS_DEBUG_DECRYPT) cms->d.envelopedData->encryptedContentInfo->debug = 1; else cms->d.envelopedData->encryptedContentInfo->debug = 0; if (!pk && !cert && !dcont && !out) return 1; if (pk && !CMS_decrypt_set1_pkey(cms, pk, cert)) r = cms_copy_content(out, cont, flags); do_free_upto(cont, dcont); return r; } ",1 "static int get_int32_equal(QEMUFile *f, void *pv, size_t size) { int32_t *v = pv; int32_t v2; qemu_get_sbe32s(f, &v2); if (*v == v2) { return 0; } return -EINVAL; } ",0 "bool SVGAnimateElement::hasValidAttributeType() { SVGElement* targetElement = this->targetElement(); if (!targetElement) return false; return m_animatedPropertyType != AnimatedUnknown && !hasInvalidCSSAttributeType(); } ",0 "bool Tab::ShouldRenderAsNormalTab() const { return !data().pinned || (width() >= (TabStyle::GetPinnedWidth() + kPinnedTabExtraWidthToRenderAsNormal)); } ",0 "int generic_key_instantiate(struct key *key, struct key_preparsed_payload *prep) { int ret; pr_devel(""==>%s()\n"", __func__); ret = key_payload_reserve(key, prep->quotalen); if (ret == 0) { key->type_data.p[0] = prep->type_data[0]; key->type_data.p[1] = prep->type_data[1]; rcu_assign_keypointer(key, prep->payload[0]); key->payload.data2[1] = prep->payload[1]; prep->type_data[0] = NULL; prep->type_data[1] = NULL; prep->payload[0] = NULL; prep->payload[1] = NULL; } pr_devel(""<==%s() = %d\n"", __func__, ret); return ret; } ",0 "static int readWepKeyRid(struct airo_info *ai, WepKeyRid *wkr, int temp, int lock) { return PC4500_readrid(ai, temp ? RID_WEP_TEMP : RID_WEP_PERM, wkr, sizeof(*wkr), lock); } ",0 "static void __reg_deduce_bounds(struct bpf_reg_state *reg) { /* Learn sign from signed bounds. * If we cannot cross the sign boundary, then signed and unsigned bounds * are the same, so combine. This works even in the negative case, e.g. * -3 s<= x s<= -1 implies 0xf...fd u<= x u<= 0xf...ff. */ if (reg->smin_value >= 0 || reg->smax_value < 0) { reg->smin_value = reg->umin_value = max_t(u64, reg->smin_value, reg->umin_value); reg->smax_value = reg->umax_value = min_t(u64, reg->smax_value, reg->umax_value); return; } /* Learn sign from unsigned bounds. Signed bounds cross the sign * boundary, so we must be careful. */ if ((s64)reg->umax_value >= 0) { /* Positive. We can't learn anything from the smin, but smax * is positive, hence safe. */ reg->smin_value = reg->umin_value; reg->smax_value = reg->umax_value = min_t(u64, reg->smax_value, reg->umax_value); } else if ((s64)reg->umin_value < 0) { /* Negative. We can't learn anything from the smax, but smin * is negative, hence safe. */ reg->smin_value = reg->umin_value = max_t(u64, reg->smin_value, reg->umin_value); reg->smax_value = reg->umax_value; } } ",0 "bool DataReductionProxySettings::IsDataReductionProxyUnreachable() { DCHECK(thread_checker_.CalledOnValidThread()); return unreachable_; } ",0 "static int shmem_replace_page(struct page **pagep, gfp_t gfp, struct shmem_inode_info *info, pgoff_t index) { struct page *oldpage, *newpage; struct address_space *swap_mapping; pgoff_t swap_index; int error; oldpage = *pagep; swap_index = page_private(oldpage); swap_mapping = page_mapping(oldpage); /* * We have arrived here because our zones are constrained, so don't * limit chance of success by further cpuset and node constraints. */ gfp &= ~GFP_CONSTRAINT_MASK; newpage = shmem_alloc_page(gfp, info, index); if (!newpage) return -ENOMEM; page_cache_get(newpage); copy_highpage(newpage, oldpage); flush_dcache_page(newpage); __set_page_locked(newpage); SetPageUptodate(newpage); SetPageSwapBacked(newpage); set_page_private(newpage, swap_index); SetPageSwapCache(newpage); /* * Our caller will very soon move newpage out of swapcache, but it's * a nice clean interface for us to replace oldpage by newpage there. */ spin_lock_irq(&swap_mapping->tree_lock); error = shmem_radix_tree_replace(swap_mapping, swap_index, oldpage, newpage); if (!error) { __inc_zone_page_state(newpage, NR_FILE_PAGES); __dec_zone_page_state(oldpage, NR_FILE_PAGES); } spin_unlock_irq(&swap_mapping->tree_lock); if (unlikely(error)) { /* * Is this possible? I think not, now that our callers check * both PageSwapCache and page_private after getting page lock; * but be defensive. Reverse old to newpage for clear and free. */ oldpage = newpage; } else { mem_cgroup_replace_page_cache(oldpage, newpage); lru_cache_add_anon(newpage); *pagep = newpage; } ClearPageSwapCache(oldpage); set_page_private(oldpage, 0); unlock_page(oldpage); page_cache_release(oldpage); page_cache_release(oldpage); return error; } ",0 "PHP_FUNCTION(pg_field_table) { zval *result; pgsql_result_handle *pg_result; zend_long fnum = -1; zend_bool return_oid = 0; Oid oid; smart_str hash_key = {0}; char *table_name; zend_resource *field_table; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""rl|b"", &result, &fnum, &return_oid) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, ""PostgreSQL result"", le_result); if (fnum < 0 || fnum >= PQnfields(pg_result->result)) { php_error_docref(NULL, E_WARNING, ""Bad field offset specified""); RETURN_FALSE; } oid = PQftable(pg_result->result, (int)fnum); if (InvalidOid == oid) { RETURN_FALSE; } if (return_oid) { #if UINT_MAX > ZEND_LONG_MAX /* Oid is unsigned int, we don't need this code, where LONG is wider */ if (oid > ZEND_LONG_MAX) { smart_str oidstr = {0}; smart_str_append_unsigned(&oidstr, oid); smart_str_0(&oidstr); RETURN_STR(oidstr.s); } else #endif RETURN_LONG((zend_long)oid); } /* try to lookup the table name in the resource list */ smart_str_appends(&hash_key, ""pgsql_table_oid_""); smart_str_append_unsigned(&hash_key, oid); smart_str_0(&hash_key); if ((field_table = zend_hash_find_ptr(&EG(regular_list), hash_key.s)) != NULL) { smart_str_free(&hash_key); RETURN_STRING((char *)field_table->ptr); } else { /* Not found, lookup by querying PostgreSQL system tables */ PGresult *tmp_res; smart_str querystr = {0}; zend_resource new_field_table; smart_str_appends(&querystr, ""select relname from pg_class where oid=""); smart_str_append_unsigned(&querystr, oid); smart_str_0(&querystr); if ((tmp_res = PQexec(pg_result->conn, querystr.s->val)) == NULL || PQresultStatus(tmp_res) != PGRES_TUPLES_OK) { if (tmp_res) { PQclear(tmp_res); } smart_str_free(&querystr); smart_str_free(&hash_key); RETURN_FALSE; } smart_str_free(&querystr); if ((table_name = PQgetvalue(tmp_res, 0, 0)) == NULL) { PQclear(tmp_res); smart_str_free(&hash_key); RETURN_FALSE; } new_field_table.type = le_string; new_field_table.ptr = estrdup(table_name); zend_hash_update_mem(&EG(regular_list), hash_key.s, (void *)&new_field_table, sizeof(zend_resource)); smart_str_free(&hash_key); PQclear(tmp_res); RETURN_STRING(table_name); } } ",0 "static void vmx_vcpu_load(struct kvm_vcpu *vcpu, int cpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); bool already_loaded = vmx->loaded_vmcs->cpu == cpu; if (!already_loaded) { loaded_vmcs_clear(vmx->loaded_vmcs); local_irq_disable(); crash_disable_local_vmclear(cpu); /* * Read loaded_vmcs->cpu should be before fetching * loaded_vmcs->loaded_vmcss_on_cpu_link. * See the comments in __loaded_vmcs_clear(). */ smp_rmb(); list_add(&vmx->loaded_vmcs->loaded_vmcss_on_cpu_link, &per_cpu(loaded_vmcss_on_cpu, cpu)); crash_enable_local_vmclear(cpu); local_irq_enable(); } if (per_cpu(current_vmcs, cpu) != vmx->loaded_vmcs->vmcs) { per_cpu(current_vmcs, cpu) = vmx->loaded_vmcs->vmcs; vmcs_load(vmx->loaded_vmcs->vmcs); } if (!already_loaded) { void *gdt = get_current_gdt_ro(); unsigned long sysenter_esp; kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); /* * Linux uses per-cpu TSS and GDT, so set these when switching * processors. See 22.2.4. */ vmcs_writel(HOST_TR_BASE, (unsigned long)this_cpu_ptr(&cpu_tss)); vmcs_writel(HOST_GDTR_BASE, (unsigned long)gdt); /* 22.2.4 */ /* * VM exits change the host TR limit to 0x67 after a VM * exit. This is okay, since 0x67 covers everything except * the IO bitmap and have have code to handle the IO bitmap * being lost after a VM exit. */ BUILD_BUG_ON(IO_BITMAP_OFFSET - 1 != 0x67); rdmsrl(MSR_IA32_SYSENTER_ESP, sysenter_esp); vmcs_writel(HOST_IA32_SYSENTER_ESP, sysenter_esp); /* 22.2.3 */ vmx->loaded_vmcs->cpu = cpu; } /* Setup TSC multiplier */ if (kvm_has_tsc_control && vmx->current_tsc_ratio != vcpu->arch.tsc_scaling_ratio) decache_tsc_multiplier(vmx); vmx_vcpu_pi_load(vcpu, cpu); vmx->host_pkru = read_pkru(); } ",0 "void BrowserCommandController::UpdateShowSyncState(bool show_main_ui) { if (is_locked_fullscreen_) return; command_updater_.UpdateCommandEnabled( IDC_SHOW_SIGNIN, show_main_ui && pref_signin_allowed_.GetValue()); } ",0 " void WaitUntilScreenshotIsReady() { if (!encoding_screenshot_in_progress_) return; message_loop_runner_ = new content::MessageLoopRunner; message_loop_runner_->Run(); } ",0 "static Frame* CreateNewWindow(LocalFrame& opener_frame, const FrameLoadRequest& request, const WebWindowFeatures& features, NavigationPolicy policy, bool& created) { Page* old_page = opener_frame.GetPage(); if (!old_page) return nullptr; policy = EffectiveNavigationPolicy(policy, WebViewImpl::CurrentInputEvent(), features); const SandboxFlags sandbox_flags = opener_frame.GetDocument()->IsSandboxed( kSandboxPropagatesToAuxiliaryBrowsingContexts) ? opener_frame.GetSecurityContext()->GetSandboxFlags() : kSandboxNone; Page* page = old_page->GetChromeClient().CreateWindow( &opener_frame, request, features, policy, sandbox_flags); if (!page) return nullptr; if (page == old_page) return &opener_frame.Tree().Top(); DCHECK(page->MainFrame()); LocalFrame& frame = *ToLocalFrame(page->MainFrame()); page->SetWindowFeatures(features); frame.View()->SetCanHaveScrollbars(features.scrollbars_visible); IntRect window_rect = page->GetChromeClient().RootWindowRect(); IntSize viewport_size = page->GetChromeClient().PageRect().Size(); if (features.x_set) window_rect.SetX(features.x); if (features.y_set) window_rect.SetY(features.y); if (features.width_set) window_rect.SetWidth(features.width + (window_rect.Width() - viewport_size.Width())); if (features.height_set) window_rect.SetHeight(features.height + (window_rect.Height() - viewport_size.Height())); page->GetChromeClient().SetWindowRectWithAdjustment(window_rect, frame); page->GetChromeClient().Show(policy); probe::windowCreated(&opener_frame, &frame); created = true; return &frame; } ",0 "gfx::Rect BrowserWindowGtk::GetInstantBounds() { return ui::GetWidgetScreenBounds(contents_container_->widget()); } ",0 "static void hns_rcb_comm_exc_irq_en( struct rcb_common_cb *rcb_common, int en) { u32 clr_vlue = 0xfffffffful; u32 msk_vlue = en ? 0 : 0xfffffffful; /* clr int*/ dsaf_write_dev(rcb_common, RCB_COM_INTSTS_ECC_ERR_REG, clr_vlue); dsaf_write_dev(rcb_common, RCB_COM_SF_CFG_RING_STS, clr_vlue); dsaf_write_dev(rcb_common, RCB_COM_SF_CFG_BD_RINT_STS, clr_vlue); dsaf_write_dev(rcb_common, RCB_COM_RINT_TX_PKT_REG, clr_vlue); dsaf_write_dev(rcb_common, RCB_COM_AXI_ERR_STS, clr_vlue); /*en msk*/ dsaf_write_dev(rcb_common, RCB_COM_INTMASK_ECC_ERR_REG, msk_vlue); dsaf_write_dev(rcb_common, RCB_COM_SF_CFG_INTMASK_RING, msk_vlue); /*for tx bd neednot cacheline, so msk sf_txring_fbd_intmask (bit 1)**/ dsaf_write_dev(rcb_common, RCB_COM_SF_CFG_INTMASK_BD, msk_vlue | 2); dsaf_write_dev(rcb_common, RCB_COM_INTMSK_TX_PKT_REG, msk_vlue); dsaf_write_dev(rcb_common, RCB_COM_AXI_WR_ERR_INTMASK, msk_vlue); } ",0 "int iwl_update_bcast_stations(struct iwl_priv *priv) { struct iwl_rxon_context *ctx; int ret = 0; for_each_context(priv, ctx) { ret = iwl_update_bcast_station(priv, ctx); if (ret) break; } return ret; } ",0 "static int alloc_initial_descbuffers(struct b43_dmaring *ring) { int i, err = -ENOMEM; struct b43_dmadesc_generic *desc; struct b43_dmadesc_meta *meta; for (i = 0; i < ring->nr_slots; i++) { desc = ring->ops->idx2desc(ring, i, &meta); err = setup_rx_descbuffer(ring, desc, meta, GFP_KERNEL); if (err) { b43err(ring->dev->wl, ""Failed to allocate initial descbuffers\n""); goto err_unwind; } } mb(); ring->used_slots = ring->nr_slots; err = 0; out: return err; err_unwind: for (i--; i >= 0; i--) { desc = ring->ops->idx2desc(ring, i, &meta); unmap_descbuffer(ring, meta->dmaaddr, ring->rx_buffersize, 0); dev_kfree_skb(meta->skb); } goto out; } ",0 "void HTMLMediaElement::cancelledRemotePlaybackRequest() { if (remotePlaybackClient()) remotePlaybackClient()->promptCancelled(); } ",0 "static void __init hugetlb_register_all_nodes(void) { int nid; for_each_node_state(nid, N_MEMORY) { struct node *node = node_devices[nid]; if (node->dev.id == nid) hugetlb_register_node(node); } /* * Let the node device driver know we're here so it can * [un]register hstate attributes on node hotplug. */ register_hugetlbfs_with_node(hugetlb_register_node, hugetlb_unregister_node); } ",0 "void WebGLRenderingContextBase::TexImageHelperCanvasRenderingContextHost( const SecurityOrigin* security_origin, TexImageFunctionID function_id, GLenum target, GLint level, GLint internalformat, GLenum format, GLenum type, GLint xoffset, GLint yoffset, GLint zoffset, CanvasRenderingContextHost* context_host, const IntRect& source_sub_rectangle, GLsizei depth, GLint unpack_image_height, ExceptionState& exception_state) { const char* func_name = GetTexImageFunctionName(function_id); if (isContextLost()) return; if (!ValidateCanvasRenderingContextHost(security_origin, func_name, context_host, exception_state)) return; WebGLTexture* texture = ValidateTexImageBinding(func_name, function_id, target); if (!texture) return; TexImageFunctionType function_type; if (function_id == kTexImage2D) function_type = kTexImage; else function_type = kTexSubImage; if (!ValidateTexFunc(func_name, function_type, kSourceHTMLCanvasElement, target, level, internalformat, source_sub_rectangle.Width(), source_sub_rectangle.Height(), depth, 0, format, type, xoffset, yoffset, zoffset)) return; bool selecting_sub_rectangle = false; if (!ValidateTexImageSubRectangle( func_name, function_id, context_host, source_sub_rectangle, depth, unpack_image_height, &selecting_sub_rectangle)) { return; } bool is_webgl_canvas = context_host->Is3d(); WebGLRenderingContextBase* source_canvas_webgl_context = nullptr; SourceImageStatus source_image_status = kInvalidSourceImageStatus; scoped_refptr image; bool upload_via_gpu = (function_id == kTexImage2D || function_id == kTexSubImage2D) && CanUseTexImageViaGPU(format, type); if (is_webgl_canvas && upload_via_gpu) { source_canvas_webgl_context = ToWebGLRenderingContextBase(context_host->RenderingContext()); } else { image = context_host->GetSourceImageForCanvas( &source_image_status, kPreferAcceleration, FloatSize(source_sub_rectangle.Width(), source_sub_rectangle.Height())); if (source_image_status != kNormalSourceImageStatus) return; } upload_via_gpu &= source_canvas_webgl_context || (image->IsStaticBitmapImage() && image->IsTextureBacked()); if (upload_via_gpu) { AcceleratedStaticBitmapImage* accel_image = nullptr; if (image) { accel_image = static_cast( ToStaticBitmapImage(image.get())); } IntRect adjusted_source_sub_rectangle = source_sub_rectangle; if (!unpack_flip_y_) { adjusted_source_sub_rectangle.SetY(context_host->Size().Height() - adjusted_source_sub_rectangle.MaxY()); } if (function_id == kTexImage2D) { TexImage2DBase(target, level, internalformat, source_sub_rectangle.Width(), source_sub_rectangle.Height(), 0, format, type, nullptr); TexImageViaGPU(function_id, texture, target, level, 0, 0, 0, accel_image, source_canvas_webgl_context, adjusted_source_sub_rectangle, unpack_premultiply_alpha_, unpack_flip_y_); } else { TexImageViaGPU(function_id, texture, target, level, xoffset, yoffset, 0, accel_image, source_canvas_webgl_context, adjusted_source_sub_rectangle, unpack_premultiply_alpha_, unpack_flip_y_); } } else { DCHECK(!(function_id == kTexSubImage2D || function_id == kTexSubImage2D) || (depth == 1 && unpack_image_height == 0)); DCHECK(image); TexImageImpl(function_id, target, level, internalformat, xoffset, yoffset, zoffset, format, type, image.get(), WebGLImageConversion::kHtmlDomCanvas, unpack_flip_y_, unpack_premultiply_alpha_, source_sub_rectangle, depth, unpack_image_height); } } ",0 "void ipmi_smi_watchdog_pretimeout(struct ipmi_smi *intf) { if (intf->in_shutdown) return; atomic_set(&intf->watchdog_pretimeouts_to_deliver, 1); tasklet_schedule(&intf->recv_tasklet); } ",0 "create_task_thread_func (GTask *task, gpointer source_object, gpointer task_data, GCancellable *cancellable) { CreateJob *job; CommonJob *common; int count; GFile *dest; g_autofree gchar *dest_uri = NULL; char *basename; char *filename, *filename2, *new_filename; char *filename_base, *suffix; char *dest_fs_type; GError *error; gboolean res; gboolean filename_is_utf8; char *primary, *secondary, *details; int response; char *data; int length; GFileOutputStream *out; gboolean handled_invalid_filename; int max_length, offset; job = task_data; common = &job->common; nautilus_progress_info_start (job->common.progress); handled_invalid_filename = FALSE; dest_fs_type = NULL; filename = NULL; dest = NULL; max_length = get_max_name_length (job->dest_dir); verify_destination (common, job->dest_dir, NULL, -1); if (job_aborted (common)) { goto aborted; } filename = g_strdup (job->filename); filename_is_utf8 = FALSE; if (filename) { filename_is_utf8 = g_utf8_validate (filename, -1, NULL); } if (filename == NULL) { if (job->make_dir) { /* localizers: the initial name of a new folder */ filename = g_strdup (_(""Untitled Folder"")); filename_is_utf8 = TRUE; /* Pass in utf8 */ } else { if (job->src != NULL) { basename = g_file_get_basename (job->src); /* localizers: the initial name of a new template document */ filename = g_strdup_printf (""%s"", basename); g_free (basename); } if (filename == NULL) { /* localizers: the initial name of a new empty document */ filename = g_strdup (_(""Untitled Document"")); filename_is_utf8 = TRUE; /* Pass in utf8 */ } } } make_file_name_valid_for_dest_fs (filename, dest_fs_type); if (filename_is_utf8) { dest = g_file_get_child_for_display_name (job->dest_dir, filename, NULL); } if (dest == NULL) { dest = g_file_get_child (job->dest_dir, filename); } count = 1; retry: error = NULL; if (job->make_dir) { res = g_file_make_directory (dest, common->cancellable, &error); if (res) { GFile *real; real = map_possibly_volatile_file_to_real (dest, common->cancellable, &error); if (real == NULL) { res = FALSE; } else { g_object_unref (dest); dest = real; } } if (res && common->undo_info != NULL) { nautilus_file_undo_info_create_set_data (NAUTILUS_FILE_UNDO_INFO_CREATE (common->undo_info), dest, NULL, 0); } } else { if (job->src) { res = g_file_copy (job->src, dest, G_FILE_COPY_NONE, common->cancellable, NULL, NULL, &error); if (res) { GFile *real; real = map_possibly_volatile_file_to_real (dest, common->cancellable, &error); if (real == NULL) { res = FALSE; } else { g_object_unref (dest); dest = real; } } if (res && common->undo_info != NULL) { gchar *uri; uri = g_file_get_uri (job->src); nautilus_file_undo_info_create_set_data (NAUTILUS_FILE_UNDO_INFO_CREATE (common->undo_info), dest, uri, 0); g_free (uri); } } else { data = """"; length = 0; if (job->src_data) { data = job->src_data; length = job->length; } out = g_file_create (dest, G_FILE_CREATE_NONE, common->cancellable, &error); if (out) { GFile *real; real = map_possibly_volatile_file_to_real_on_write (dest, out, common->cancellable, &error); if (real == NULL) { res = FALSE; g_object_unref (out); } else { g_object_unref (dest); dest = real; res = g_output_stream_write_all (G_OUTPUT_STREAM (out), data, length, NULL, common->cancellable, &error); if (res) { res = g_output_stream_close (G_OUTPUT_STREAM (out), common->cancellable, &error); if (res && common->undo_info != NULL) { nautilus_file_undo_info_create_set_data (NAUTILUS_FILE_UNDO_INFO_CREATE (common->undo_info), dest, data, length); } } /* This will close if the write failed and we didn't close */ g_object_unref (out); } } else { res = FALSE; } } } if (res) { job->created_file = g_object_ref (dest); nautilus_file_changes_queue_file_added (dest); dest_uri = g_file_get_uri (dest); if (job->has_position) { nautilus_file_changes_queue_schedule_position_set (dest, job->position, common->screen_num); } else if (eel_uri_is_desktop (dest_uri)) { nautilus_file_changes_queue_schedule_position_remove (dest); } } else { g_assert (error != NULL); if (IS_IO_ERROR (error, INVALID_FILENAME) && !handled_invalid_filename) { handled_invalid_filename = TRUE; g_assert (dest_fs_type == NULL); dest_fs_type = query_fs_type (job->dest_dir, common->cancellable); if (count == 1) { new_filename = g_strdup (filename); } else { filename_base = eel_filename_strip_extension (filename); offset = strlen (filename_base); suffix = g_strdup (filename + offset); filename2 = g_strdup_printf (""%s %d%s"", filename_base, count, suffix); new_filename = NULL; if (max_length > 0 && strlen (filename2) > max_length) { new_filename = shorten_utf8_string (filename2, strlen (filename2) - max_length); } if (new_filename == NULL) { new_filename = g_strdup (filename2); } g_free (filename2); g_free (suffix); } if (make_file_name_valid_for_dest_fs (new_filename, dest_fs_type)) { g_object_unref (dest); if (filename_is_utf8) { dest = g_file_get_child_for_display_name (job->dest_dir, new_filename, NULL); } if (dest == NULL) { dest = g_file_get_child (job->dest_dir, new_filename); } g_free (new_filename); g_error_free (error); goto retry; } g_free (new_filename); } if (IS_IO_ERROR (error, EXISTS)) { g_object_unref (dest); dest = NULL; filename_base = eel_filename_strip_extension (filename); offset = strlen (filename_base); suffix = g_strdup (filename + offset); filename2 = g_strdup_printf (""%s %d%s"", filename_base, ++count, suffix); if (max_length > 0 && strlen (filename2) > max_length) { new_filename = shorten_utf8_string (filename2, strlen (filename2) - max_length); if (new_filename != NULL) { g_free (filename2); filename2 = new_filename; } } make_file_name_valid_for_dest_fs (filename2, dest_fs_type); if (filename_is_utf8) { dest = g_file_get_child_for_display_name (job->dest_dir, filename2, NULL); } if (dest == NULL) { dest = g_file_get_child (job->dest_dir, filename2); } g_free (filename2); g_free (suffix); g_error_free (error); goto retry; } else if (IS_IO_ERROR (error, CANCELLED)) { g_error_free (error); } /* Other error */ else { if (job->make_dir) { primary = f (_(""Error while creating directory %B.""), dest); } else { primary = f (_(""Error while creating file %B.""), dest); } secondary = f (_(""There was an error creating the directory in %F.""), job->dest_dir); details = error->message; response = run_warning (common, primary, secondary, details, FALSE, CANCEL, SKIP, NULL); g_error_free (error); if (response == 0 || response == GTK_RESPONSE_DELETE_EVENT) { abort_job (common); } else if (response == 1) /* skip */ { /* do nothing */ } else { g_assert_not_reached (); } } } aborted: if (dest) { g_object_unref (dest); } g_free (filename); g_free (dest_fs_type); } ",0 "BlobRegistry::~BlobRegistry() { } ",0 "channel_still_open(void) { u_int i; Channel *c; for (i = 0; i < channels_alloc; i++) { c = channels[i]; if (c == NULL) continue; switch (c->type) { case SSH_CHANNEL_X11_LISTENER: case SSH_CHANNEL_PORT_LISTENER: case SSH_CHANNEL_RPORT_LISTENER: case SSH_CHANNEL_MUX_LISTENER: case SSH_CHANNEL_CLOSED: case SSH_CHANNEL_AUTH_SOCKET: case SSH_CHANNEL_DYNAMIC: case SSH_CHANNEL_CONNECTING: case SSH_CHANNEL_ZOMBIE: case SSH_CHANNEL_ABANDONED: case SSH_CHANNEL_UNIX_LISTENER: case SSH_CHANNEL_RUNIX_LISTENER: continue; case SSH_CHANNEL_LARVAL: if (!compat20) fatal(""cannot happen: SSH_CHANNEL_LARVAL""); continue; case SSH_CHANNEL_OPENING: case SSH_CHANNEL_OPEN: case SSH_CHANNEL_X11_OPEN: case SSH_CHANNEL_MUX_CLIENT: return 1; case SSH_CHANNEL_INPUT_DRAINING: case SSH_CHANNEL_OUTPUT_DRAINING: if (!compat13) fatal(""cannot happen: OUT_DRAIN""); return 1; default: fatal(""channel_still_open: bad channel type %d"", c->type); /* NOTREACHED */ } } return 0; } ",0 "bool AXNodeObject::isPasswordField() const { Node* node = this->getNode(); if (!isHTMLInputElement(node)) return false; AccessibilityRole ariaRole = ariaRoleAttribute(); if (ariaRole != TextFieldRole && ariaRole != UnknownRole) return false; return toHTMLInputElement(node)->type() == InputTypeNames::password; } ",0 "void ShellSurface::SetFullscreen(bool fullscreen) { TRACE_EVENT1(""exo"", ""ShellSurface::SetFullscreen"", ""fullscreen"", fullscreen); if (!widget_) CreateShellSurfaceWidget(ui::SHOW_STATE_FULLSCREEN); ScopedConfigure scoped_configure(this, true); widget_->SetFullscreen(fullscreen); } ",0 "JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, TestMediaQueryListListener* impl) { return wrap(exec, globalObject, impl); } ",0 "static void ar6000_dump_skb(struct sk_buff *skb) { u_char *ch; for (ch = A_NETBUF_DATA(skb); (unsigned long)ch < ((unsigned long)A_NETBUF_DATA(skb) + A_NETBUF_LEN(skb)); ch++) { AR_DEBUG_PRINTF(ATH_DEBUG_WARN,(""%2.2x "", *ch)); } AR_DEBUG_PRINTF(ATH_DEBUG_WARN,(""\n"")); } ",0 "bool BrowserTabStripController::IsIncognito() { return browser_->profile()->IsOffTheRecord(); } ",0 "SProcPseudoramiXQueryScreens(ClientPtr client) { REQUEST(xXineramaQueryScreensReq); TRACE; swaps(&stuff->length); REQUEST_SIZE_MATCH(xXineramaQueryScreensReq); return ProcPseudoramiXQueryScreens(client); } ",0 "nautilus_directory_remove_file_monitors (NautilusDirectory *directory, NautilusFile *file) { GList *result, **list, *node, *next; Monitor *monitor; g_assert (NAUTILUS_IS_DIRECTORY (directory)); g_assert (NAUTILUS_IS_FILE (file)); g_assert (file->details->directory == directory); result = NULL; list = &directory->details->monitor_list; for (node = directory->details->monitor_list; node != NULL; node = next) { next = node->next; monitor = node->data; if (monitor->file == file) { *list = g_list_remove_link (*list, node); result = g_list_concat (node, result); request_counter_remove_request (directory->details->monitor_counters, monitor->request); } } /* XXX - do we need to remove anything from the work queue? */ nautilus_directory_async_state_changed (directory); return (FileMonitors *) result; } ",0 "std::string SerializeOriginIntoDatabaseKey(const url::Origin& origin) { return base::MD5String(origin.host()); } ",0 "void TabStrip::UpdateTabsClosingMap(int index, int delta) { if (tabs_closing_map_.empty()) return; if (delta == -1 && tabs_closing_map_.find(index - 1) != tabs_closing_map_.end() && tabs_closing_map_.find(index) != tabs_closing_map_.end()) { const Tabs& tabs(tabs_closing_map_[index]); tabs_closing_map_[index - 1].insert(tabs_closing_map_[index - 1].end(), tabs.begin(), tabs.end()); } TabsClosingMap updated_map; for (auto& i : tabs_closing_map_) { if (i.first > index) updated_map[i.first + delta] = i.second; else if (i.first < index) updated_map[i.first] = i.second; } if (delta > 0 && tabs_closing_map_.find(index) != tabs_closing_map_.end()) updated_map[index + delta] = tabs_closing_map_[index]; tabs_closing_map_.swap(updated_map); } ",0 "int ndp_msg_next_opt_offset(struct ndp_msg *msg, int offset, enum ndp_msg_opt_type opt_type) { unsigned char *opts_start = ndp_msg_payload_opts(msg); unsigned char *ptr = opts_start; size_t len = ndp_msg_payload_opts_len(msg); uint8_t opt_raw_type = ndp_msg_opt_type_info(opt_type)->raw_type; bool ignore = true; if (offset == -1) { offset = 0; ignore = false; } ptr += offset; len -= offset; while (len > 0) { uint8_t cur_opt_raw_type = ptr[0]; unsigned int cur_opt_len = ptr[1] << 3; /* convert to bytes */ if (!cur_opt_len || len < cur_opt_len) break; if (cur_opt_raw_type == opt_raw_type && !ignore) return ptr - opts_start; ptr += cur_opt_len; len -= cur_opt_len; ignore = false; } return -1; } ",0 "static void *timers_next(struct seq_file *m, void *v, loff_t *pos) { struct timers_private *tp = m->private; return seq_list_next(v, &tp->task->signal->posix_timers, pos); } ",0 "static void btif_hl_disable(void){ BTIF_TRACE_DEBUG(""%s"", __FUNCTION__); if ((p_btif_hl_cb->state != BTIF_HL_STATE_DISABLING) && (p_btif_hl_cb->state != BTIF_HL_STATE_DISABLED)) { btif_hl_set_state(BTIF_HL_STATE_DISABLING); BTA_HlDisable(); } } ",0 "EventTarget* Document::ErrorEventTarget() { return domWindow(); } ",0 "QDeclarativeComponent* QQuickWebViewExperimental::proxyAuthenticationDialog() const { Q_D(const QQuickWebView); return d->proxyAuthenticationDialog; } ",0 "static void zlib_exit(struct crypto_tfm *tfm) { struct zlib_ctx *ctx = crypto_tfm_ctx(tfm); zlib_comp_exit(ctx); zlib_decomp_exit(ctx); } ",0 "bool ChromeContentBrowserClient::ShouldDisableSiteIsolation() { constexpr int kDefaultMemoryThresholdMb = 1024; if (base::FeatureList::IsEnabled( features::kSitePerProcessOnlyForHighMemoryClients)) { int memory_threshold_mb = base::GetFieldTrialParamByFeatureAsInt( features::kSitePerProcessOnlyForHighMemoryClients, features::kSitePerProcessOnlyForHighMemoryClientsParamName, kDefaultMemoryThresholdMb); return base::SysInfo::AmountOfPhysicalMemoryMB() <= memory_threshold_mb; } #if defined(OS_ANDROID) if (base::SysInfo::AmountOfPhysicalMemoryMB() <= kDefaultMemoryThresholdMb) { return true; } #endif return false; } ",0 "OmniboxViewViews::OmniboxViewViews(OmniboxEditController* controller, Profile* profile, CommandUpdater* command_updater, bool popup_window_mode, LocationBarView* location_bar, const gfx::FontList& font_list) : OmniboxView(profile, controller, command_updater), popup_window_mode_(popup_window_mode), security_level_(ToolbarModel::NONE), saved_selection_for_focus_change_(gfx::Range::InvalidRange()), ime_composing_before_change_(false), delete_at_end_pressed_(false), location_bar_view_(location_bar), ime_candidate_window_open_(false), select_all_on_mouse_release_(false), select_all_on_gesture_tap_(false) { set_border(NULL); set_id(VIEW_ID_OMNIBOX); SetFontList(font_list); } ",0 "void Document::SetPrinting(PrintingState state) { bool was_printing = Printing(); printing_ = state; bool is_printing = Printing(); if ((was_printing != is_printing) && documentElement() && GetFrame() && !GetFrame()->IsMainFrame() && GetFrame()->Owner() && GetFrame()->Owner()->IsDisplayNone()) { documentElement()->LazyReattachIfAttached(); } } ",0 "MagickExport Image *NewMagickImage(const ImageInfo *image_info, const size_t width,const size_t height,const MagickPixelPacket *background) { CacheView *image_view; ExceptionInfo *exception; Image *image; ssize_t y; MagickBooleanType status; assert(image_info != (const ImageInfo *) NULL); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); assert(image_info->signature == MagickSignature); assert(background != (const MagickPixelPacket *) NULL); image=AcquireImage(image_info); image->columns=width; image->rows=height; image->colorspace=background->colorspace; image->matte=background->matte; image->fuzz=background->fuzz; image->depth=background->depth; status=MagickTrue; exception=(&image->exception); 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 IndexPacket *magick_restrict indexes; register PixelPacket *magick_restrict q; register ssize_t x; if (status == MagickFalse) continue; q=QueueCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) { status=MagickFalse; continue; } indexes=GetCacheViewAuthenticIndexQueue(image_view); for (x=0; x < (ssize_t) image->columns; x++) { SetPixelPacket(image,background,q,indexes+x); q++; } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; } image_view=DestroyCacheView(image_view); if (status == MagickFalse) image=DestroyImage(image); return(image); } ",0 "error::Error GLES2DecoderPassthroughImpl::PatchGetNumericResults(GLenum pname, GLsizei length, T* params) { if (length < 1) { return error::kNoError; } switch (pname) { case GL_NUM_EXTENSIONS: params[0] = 0; break; case GL_TEXTURE_BINDING_2D: case GL_TEXTURE_BINDING_CUBE_MAP: case GL_TEXTURE_BINDING_2D_ARRAY: case GL_TEXTURE_BINDING_3D: if (*params != 0 && !GetClientID(&resources_->texture_id_map, *params, params)) { return error::kInvalidArguments; } break; case GL_ARRAY_BUFFER_BINDING: case GL_ELEMENT_ARRAY_BUFFER_BINDING: case GL_PIXEL_PACK_BUFFER_BINDING: case GL_PIXEL_UNPACK_BUFFER_BINDING: case GL_TRANSFORM_FEEDBACK_BUFFER_BINDING: case GL_COPY_READ_BUFFER_BINDING: case GL_COPY_WRITE_BUFFER_BINDING: case GL_UNIFORM_BUFFER_BINDING: if (*params != 0 && !GetClientID(&resources_->buffer_id_map, *params, params)) { return error::kInvalidArguments; } break; case GL_RENDERBUFFER_BINDING: if (*params != 0 && !GetClientID(&resources_->renderbuffer_id_map, *params, params)) { return error::kInvalidArguments; } break; case GL_SAMPLER_BINDING: if (*params != 0 && !GetClientID(&resources_->sampler_id_map, *params, params)) { return error::kInvalidArguments; } break; case GL_ACTIVE_PROGRAM: if (*params != 0 && !GetClientID(&resources_->program_id_map, *params, params)) { return error::kInvalidArguments; } break; case GL_FRAMEBUFFER_BINDING: case GL_READ_FRAMEBUFFER_BINDING: if (*params != 0 && !GetClientID(&framebuffer_id_map_, *params, params)) { return error::kInvalidArguments; } break; case GL_TRANSFORM_FEEDBACK_BINDING: if (*params != 0 && !GetClientID(&transform_feedback_id_map_, *params, params)) { return error::kInvalidArguments; } break; case GL_VERTEX_ARRAY_BINDING: if (*params != 0 && !GetClientID(&vertex_array_id_map_, *params, params)) { return error::kInvalidArguments; } break; case GL_VIEWPORT: if (length < 4) { return error::kInvalidArguments; } std::copy(std::begin(viewport_), std::end(viewport_), params); break; case GL_SCISSOR_BOX: if (length < 4) { return error::kInvalidArguments; } std::copy(std::begin(scissor_), std::end(scissor_), params); break; default: break; } return error::kNoError; } ",0 "static int nfc_llcp_wks_sap(char *service_name, size_t service_name_len) { int sap, num_wks; pr_debug(""%s\n"", service_name); if (service_name == NULL) return -EINVAL; num_wks = ARRAY_SIZE(wks); for (sap = 0; sap < num_wks; sap++) { if (wks[sap] == NULL) continue; if (strncmp(wks[sap], service_name, service_name_len) == 0) return sap; } return -EINVAL; } ",0 " virtual void InfoBarClosed() { if (!action_taken_) UMA_HISTOGRAM_COUNTS(""DefaultBrowserWarning.Ignored"", 1); delete this; } ",0 "dissect_NOTIFY_INFO_DATA_printer(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, proto_item *item, dcerpc_info *di, guint8 *drep, guint16 field) { guint32 value1; switch (field) { /* String notify data */ case PRINTER_NOTIFY_SERVER_NAME: case PRINTER_NOTIFY_PRINTER_NAME: case PRINTER_NOTIFY_SHARE_NAME: case PRINTER_NOTIFY_DRIVER_NAME: case PRINTER_NOTIFY_COMMENT: case PRINTER_NOTIFY_LOCATION: case PRINTER_NOTIFY_SEPFILE: case PRINTER_NOTIFY_PRINT_PROCESSOR: case PRINTER_NOTIFY_PARAMETERS: case PRINTER_NOTIFY_DATATYPE: case PRINTER_NOTIFY_PORT_NAME: offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_notify_info_data_bufsize, &value1); offset = dissect_ndr_pointer_cb( tvb, offset, pinfo, tree, di, drep, dissect_notify_info_data_buffer, NDR_POINTER_UNIQUE, ""String"", hf_notify_info_data_buffer, cb_notify_str_postprocess, GINT_TO_POINTER(printer_notify_hf_index(field))); break; case PRINTER_NOTIFY_ATTRIBUTES: /* Value 1 is the printer attributes */ offset = dissect_printer_attributes( tvb, offset, pinfo, tree, di, drep); offset = dissect_ndr_uint32( tvb, offset, pinfo, NULL, di, drep, hf_notify_info_data_value2, NULL); break; case PRINTER_NOTIFY_STATUS: { guint32 status; /* Value 1 is the printer status */ offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_printer_status, &status); offset = dissect_ndr_uint32( tvb, offset, pinfo, NULL, di, drep, hf_notify_info_data_value2, NULL); proto_item_append_text( item, "": %s"", val_to_str_ext_const(status, &printer_status_vals_ext, ""Unknown"")); break; } /* Unknown notify data */ case PRINTER_NOTIFY_SECURITY_DESCRIPTOR: /* Secdesc */ case PRINTER_NOTIFY_DEVMODE: /* Devicemode */ offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_notify_info_data_bufsize, &value1); offset = dissect_ndr_pointer( tvb, offset, pinfo, tree, di, drep, dissect_notify_info_data_buffer, NDR_POINTER_UNIQUE, ""Buffer"", hf_notify_info_data_buffer); break; default: offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_notify_info_data_value1, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_notify_info_data_value2, NULL); break; } return offset; } ",0 "void CrosLibrary::TestApi::SetBrightnessLibrary( BrightnessLibrary* library, bool own) { library_->brightness_lib_.SetImpl(library, own); } ",1 "quint64 QQuickWebViewPrivate::exceededDatabaseQuota(const QString& databaseName, const QString& displayName, WKSecurityOriginRef securityOrigin, quint64 currentQuota, quint64 currentOriginUsage, quint64 currentDatabaseUsage, quint64 expectedUsage) { Q_Q(QQuickWebView); QtDialogRunner dialogRunner(q); if (!dialogRunner.initForDatabaseQuotaDialog(databaseName, displayName, securityOrigin, currentQuota, currentOriginUsage, currentDatabaseUsage, expectedUsage)) return 0; dialogRunner.run(); return dialogRunner.wasAccepted() ? dialogRunner.databaseQuota() : 0; } ",0 "ZEND_API zval* ZEND_FASTCALL _zend_hash_update(HashTable *ht, zend_string *key, zval *pData ZEND_FILE_LINE_DC) { return _zend_hash_add_or_update_i(ht, key, pData, HASH_UPDATE ZEND_FILE_LINE_RELAY_CC); } ",0 "void CL_Vid_Restart_f( void ) { Cvar_Set( ""com_expectedhunkusage"", ""-1"" ); if( CL_VideoRecording( ) ) { CL_CloseAVI( ); } if(clc.demorecording) CL_StopRecord_f(); S_StopAllSounds(); if(!FS_ConditionalRestart(clc.checksumFeed, qtrue)) { if(com_sv_running->integer) { Hunk_ClearToMark(); } else { Hunk_Clear(); } CL_ShutdownUI(); CL_ShutdownCGame(); CL_ShutdownRef(); CL_ResetPureClientAtServer(); FS_ClearPakReferences( FS_UI_REF | FS_CGAME_REF ); S_BeginRegistration(); // all sound handles are now invalid cls.rendererStarted = qfalse; cls.uiStarted = qfalse; cls.cgameStarted = qfalse; cls.soundRegistered = qfalse; autoupdateChecked = qfalse; Cvar_Set( ""cl_paused"", ""0"" ); CL_InitRef(); CL_StartHunkUsers(qfalse); if(clc.state > CA_CONNECTED && clc.state != CA_CINEMATIC) { cls.cgameStarted = qtrue; CL_InitCGame(); CL_SendPureChecksums(); } } } ",0 "static int amd_gpio_probe(struct platform_device *pdev) { int ret = 0; int irq_base; struct resource *res; struct amd_gpio *gpio_dev; gpio_dev = devm_kzalloc(&pdev->dev, sizeof(struct amd_gpio), GFP_KERNEL); if (!gpio_dev) return -ENOMEM; spin_lock_init(&gpio_dev->lock); res = platform_get_resource(pdev, IORESOURCE_MEM, 0); if (!res) { dev_err(&pdev->dev, ""Failed to get gpio io resource.\n""); return -EINVAL; } gpio_dev->base = devm_ioremap_nocache(&pdev->dev, res->start, resource_size(res)); if (!gpio_dev->base) return -ENOMEM; irq_base = platform_get_irq(pdev, 0); if (irq_base < 0) { dev_err(&pdev->dev, ""Failed to get gpio IRQ.\n""); return -EINVAL; } gpio_dev->pdev = pdev; gpio_dev->gc.direction_input = amd_gpio_direction_input; gpio_dev->gc.direction_output = amd_gpio_direction_output; gpio_dev->gc.get = amd_gpio_get_value; gpio_dev->gc.set = amd_gpio_set_value; gpio_dev->gc.set_debounce = amd_gpio_set_debounce; gpio_dev->gc.dbg_show = amd_gpio_dbg_show; gpio_dev->gc.base = 0; gpio_dev->gc.label = pdev->name; gpio_dev->gc.owner = THIS_MODULE; gpio_dev->gc.parent = &pdev->dev; gpio_dev->gc.ngpio = TOTAL_NUMBER_OF_PINS; #if defined(CONFIG_OF_GPIO) gpio_dev->gc.of_node = pdev->dev.of_node; #endif gpio_dev->groups = kerncz_groups; gpio_dev->ngroups = ARRAY_SIZE(kerncz_groups); amd_pinctrl_desc.name = dev_name(&pdev->dev); gpio_dev->pctrl = pinctrl_register(&amd_pinctrl_desc, &pdev->dev, gpio_dev); if (IS_ERR(gpio_dev->pctrl)) { dev_err(&pdev->dev, ""Couldn't register pinctrl driver\n""); return PTR_ERR(gpio_dev->pctrl); } ret = gpiochip_add_data(&gpio_dev->gc, gpio_dev); if (ret) goto out1; ret = gpiochip_add_pin_range(&gpio_dev->gc, dev_name(&pdev->dev), 0, 0, TOTAL_NUMBER_OF_PINS); if (ret) { dev_err(&pdev->dev, ""Failed to add pin range\n""); goto out2; } ret = gpiochip_irqchip_add(&gpio_dev->gc, &amd_gpio_irqchip, 0, handle_simple_irq, IRQ_TYPE_NONE); if (ret) { dev_err(&pdev->dev, ""could not add irqchip\n""); ret = -ENODEV; goto out2; } gpiochip_set_chained_irqchip(&gpio_dev->gc, &amd_gpio_irqchip, irq_base, amd_gpio_irq_handler); platform_set_drvdata(pdev, gpio_dev); dev_dbg(&pdev->dev, ""amd gpio driver loaded\n""); return ret; out2: gpiochip_remove(&gpio_dev->gc); out1: pinctrl_unregister(gpio_dev->pctrl); return ret; } ",1 "lex(struct scanner *s, union lvalue *val) { skip_more_whitespace_and_comments: /* Skip spaces. */ while (is_space(peek(s))) if (next(s) == '\n') return TOK_END_OF_LINE; /* Skip comments. */ if (chr(s, '#')) { skip_to_eol(s); goto skip_more_whitespace_and_comments; } /* See if we're done. */ if (eof(s)) return TOK_END_OF_FILE; /* New token. */ s->token_line = s->line; s->token_column = s->column; s->buf_pos = 0; /* LHS Keysym. */ if (chr(s, '<')) { while (peek(s) != '>' && !eol(s)) buf_append(s, next(s)); if (!chr(s, '>')) { scanner_err(s, ""unterminated keysym literal""); return TOK_ERROR; } if (!buf_append(s, '\0')) { scanner_err(s, ""keysym literal is too long""); return TOK_ERROR; } val->string.str = s->buf; val->string.len = s->buf_pos; return TOK_LHS_KEYSYM; } /* Colon. */ if (chr(s, ':')) return TOK_COLON; if (chr(s, '!')) return TOK_BANG; if (chr(s, '~')) return TOK_TILDE; /* String literal. */ if (chr(s, '\""')) { while (!eof(s) && !eol(s) && peek(s) != '\""') { if (chr(s, '\\')) { uint8_t o; if (chr(s, '\\')) { buf_append(s, '\\'); } else if (chr(s, '""')) { buf_append(s, '""'); } else if (chr(s, 'x') || chr(s, 'X')) { if (hex(s, &o)) buf_append(s, (char) o); else scanner_warn(s, ""illegal hexadecimal escape sequence in string literal""); } else if (oct(s, &o)) { buf_append(s, (char) o); } else { scanner_warn(s, ""unknown escape sequence (%c) in string literal"", peek(s)); /* Ignore. */ } } else { buf_append(s, next(s)); } } if (!chr(s, '\""')) { scanner_err(s, ""unterminated string literal""); return TOK_ERROR; } if (!buf_append(s, '\0')) { scanner_err(s, ""string literal is too long""); return TOK_ERROR; } if (!is_valid_utf8(s->buf, s->buf_pos - 1)) { scanner_err(s, ""string literal is not a valid UTF-8 string""); return TOK_ERROR; } val->string.str = s->buf; val->string.len = s->buf_pos; return TOK_STRING; } /* Identifier or include. */ if (is_alpha(peek(s)) || peek(s) == '_') { s->buf_pos = 0; while (is_alnum(peek(s)) || peek(s) == '_') buf_append(s, next(s)); if (!buf_append(s, '\0')) { scanner_err(s, ""identifier is too long""); return TOK_ERROR; } if (streq(s->buf, ""include"")) return TOK_INCLUDE; val->string.str = s->buf; val->string.len = s->buf_pos; return TOK_IDENT; } /* Discard rest of line. */ skip_to_eol(s); scanner_err(s, ""unrecognized token""); return TOK_ERROR; } ",1 "void Player::pause() { if (m_paused) return; m_paused = true; updateTimingState(currentTime()); cancelAnimationOnCompositor(); } ",0 "const Tracks* Segment::GetTracks() const { return m_pTracks; } ",1 "void RenderProcessHostImpl::SuddenTerminationChanged(bool enabled) { SetSuddenTerminationAllowed(enabled); } ",0 "void __comps_objmrtree_set(COMPS_ObjMRTree *rt, char *key, size_t len, COMPS_Object *ndata) { static COMPS_HSListItem *it; COMPS_HSList *subnodes; COMPS_ObjMRTreeData *rtd; static COMPS_ObjMRTreeData *rtdata; size_t _len, offset=0; unsigned x, found = 0; char ended;//, tmpch; if (rt->subnodes == NULL) return; subnodes = rt->subnodes; while (offset != len) { found = 0; for (it = subnodes->first; it != NULL; it = it->next) { if (((COMPS_ObjMRTreeData*)it->data)->key[0] == key[offset]) { found = 1; break; } } if (!found) { // not found in subnodes; create new subnode rtd = comps_objmrtree_data_create(key+offset, ndata); comps_hslist_append(subnodes, rtd, 0); rt->len++; return; } else { rtdata = (COMPS_ObjMRTreeData*)it->data; ended = 0; for (x=1; ;x++) { if (rtdata->key[x] == 0) ended += 1; if (x == len - offset) ended += 2; if (ended != 0) break; if (key[offset+x] != rtdata->key[x]) break; } if (ended == 3) { //keys equals; append new data comps_objlist_append_x(rtdata->data, ndata); rt->len++; return; } else if (ended == 2) { //global key ends first; make global leaf comps_hslist_remove(subnodes, it); it->next = NULL; rtd = comps_objmrtree_data_create(key+offset, ndata); comps_hslist_append(subnodes, rtd, 0); ((COMPS_ObjMRTreeData*)subnodes->last->data)->subnodes->last = it; ((COMPS_ObjMRTreeData*)subnodes->last->data)->subnodes->first = it; _len = strlen(key + offset); memmove(rtdata->key,rtdata->key + _len, strlen(rtdata->key) - _len); rtdata->key[strlen(rtdata->key) - _len] = 0; rtdata->key = realloc(rtdata->key, sizeof(char)* (strlen(rtdata->key)+1)); rt->len++; return; } else if (ended == 1) { //local key ends first; go deeper subnodes = rtdata->subnodes; offset += x; } else { /* keys differ */ COMPS_ObjList *tmpdata = rtdata->data; COMPS_HSList *tmphslist = rtdata->subnodes; rtdata->subnodes = comps_hslist_create(); comps_hslist_init(rtdata->subnodes, NULL, NULL, &comps_objmrtree_data_destroy_v); int cmpret = strcmp(key+offset+x, rtdata->key+x); rtdata->data = COMPS_OBJECT_CREATE(COMPS_ObjList, NULL); if (cmpret > 0) { rtd = comps_objmrtree_data_create(rtdata->key+x, (COMPS_Object*)tmpdata); comps_hslist_destroy(&rtd->subnodes); rtd->subnodes = tmphslist; comps_hslist_append(rtdata->subnodes, rtd, 0); rtd = comps_objmrtree_data_create(key+offset+x, (COMPS_Object*)ndata); comps_hslist_append(rtdata->subnodes, rtd, 0); } else { rtd = comps_objmrtree_data_create(key+offset+x, (COMPS_Object*)ndata); comps_hslist_append(rtdata->subnodes, rtd, 0); rtd = comps_objmrtree_data_create(rtdata->key+x, (COMPS_Object*)tmpdata); comps_hslist_destroy(&rtd->subnodes); rtd->subnodes = tmphslist; comps_hslist_append(rtdata->subnodes, rtd, 0); } rtdata->key = realloc(rtdata->key, sizeof(char)*(x+1)); rtdata->key[x] = 0; rt->len++; return; } } } } ",0 "int main(int argc, char *argv[]) { int opt; char *line; progname = basename(argv[0]); #if POSIXLY_CORRECT cmd_line_options = POSIXLY_CMD_LINE_OPTIONS; #else if (getenv(POSIXLY_CORRECT_STR)) posixly_correct = 1; if (!posixly_correct) cmd_line_options = CMD_LINE_OPTIONS; else cmd_line_options = POSIXLY_CMD_LINE_OPTIONS; #endif setlocale(LC_CTYPE, """"); setlocale(LC_MESSAGES, """"); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); /* Align `#effective:' comments to column 40 for tty's */ if (!posixly_correct && isatty(fileno(stdout))) print_options |= TEXT_SMART_INDENT; while ((opt = getopt_long(argc, argv, cmd_line_options, long_options, NULL)) != -1) { switch (opt) { case 'a': /* acl only */ if (posixly_correct) goto synopsis; opt_print_acl = 1; break; case 'd': /* default acl only */ opt_print_default_acl = 1; break; case 'c': /* no comments */ if (posixly_correct) goto synopsis; opt_comments = 0; break; case 'e': /* all #effective comments */ if (posixly_correct) goto synopsis; print_options |= TEXT_ALL_EFFECTIVE; break; case 'E': /* no #effective comments */ if (posixly_correct) goto synopsis; print_options &= ~(TEXT_SOME_EFFECTIVE | TEXT_ALL_EFFECTIVE); break; case 'R': /* recursive */ if (posixly_correct) goto synopsis; walk_flags |= WALK_TREE_RECURSIVE; break; case 'L': /* follow all symlinks */ if (posixly_correct) goto synopsis; walk_flags |= WALK_TREE_LOGICAL; walk_flags &= ~WALK_TREE_PHYSICAL; break; case 'P': /* skip all symlinks */ if (posixly_correct) goto synopsis; walk_flags |= WALK_TREE_PHYSICAL; walk_flags &= ~WALK_TREE_LOGICAL; break; case 's': /* skip files with only base entries */ if (posixly_correct) goto synopsis; opt_skip_base = 1; break; case 'p': if (posixly_correct) goto synopsis; opt_strip_leading_slash = 0; break; case 't': if (posixly_correct) goto synopsis; opt_tabular = 1; break; case 'n': /* numeric */ opt_numeric = 1; print_options |= TEXT_NUMERIC_IDS; break; case 'v': /* print version */ printf(""%s "" VERSION ""\n"", progname); return 0; case 'h': /* help */ help(); return 0; case ':': /* option missing */ case '?': /* unknown option */ default: goto synopsis; } } if (!(opt_print_acl || opt_print_default_acl)) { opt_print_acl = 1; if (!posixly_correct) opt_print_default_acl = 1; } if ((optind == argc) && !posixly_correct) goto synopsis; do { if (optind == argc || strcmp(argv[optind], ""-"") == 0) { while ((line = next_line(stdin)) != NULL) { if (*line == '\0') continue; had_errors += walk_tree(line, walk_flags, 0, do_print, NULL); } if (!feof(stdin)) { fprintf(stderr, _(""%s: Standard input: %s\n""), progname, strerror(errno)); had_errors++; } } else had_errors += walk_tree(argv[optind], walk_flags, 0, do_print, NULL); optind++; } while (optind < argc); return had_errors ? 1 : 0; synopsis: fprintf(stderr, _(""Usage: %s [-%s] file ...\n""), progname, cmd_line_options); fprintf(stderr, _(""Try `%s --help' for more information.\n""), progname); return 2; } ",0 "static struct rpc_clnt * rpc_new_client(const struct rpc_create_args *args, struct rpc_xprt *xprt) { struct rpc_program *program = args->program; struct rpc_version *version; struct rpc_clnt *clnt = NULL; struct rpc_auth *auth; int err; size_t len; /* sanity check the name before trying to print it */ err = -EINVAL; len = strlen(args->servername); if (len > RPC_MAXNETNAMELEN) goto out_no_rpciod; len++; dprintk(""RPC: creating %s client for %s (xprt %p)\n"", program->name, args->servername, xprt); err = rpciod_up(); if (err) goto out_no_rpciod; err = -EINVAL; if (!xprt) goto out_no_xprt; if (args->version >= program->nrvers) goto out_err; version = program->version[args->version]; if (version == NULL) goto out_err; err = -ENOMEM; clnt = kzalloc(sizeof(*clnt), GFP_KERNEL); if (!clnt) goto out_err; clnt->cl_parent = clnt; clnt->cl_server = clnt->cl_inline_name; if (len > sizeof(clnt->cl_inline_name)) { char *buf = kmalloc(len, GFP_KERNEL); if (buf != NULL) clnt->cl_server = buf; else len = sizeof(clnt->cl_inline_name); } strlcpy(clnt->cl_server, args->servername, len); clnt->cl_xprt = xprt; clnt->cl_procinfo = version->procs; clnt->cl_maxproc = version->nrprocs; clnt->cl_protname = program->name; clnt->cl_prog = args->prognumber ? : program->number; clnt->cl_vers = version->number; clnt->cl_stats = program->stats; clnt->cl_metrics = rpc_alloc_iostats(clnt); err = -ENOMEM; if (clnt->cl_metrics == NULL) goto out_no_stats; clnt->cl_program = program; INIT_LIST_HEAD(&clnt->cl_tasks); spin_lock_init(&clnt->cl_lock); if (!xprt_bound(clnt->cl_xprt)) clnt->cl_autobind = 1; clnt->cl_timeout = xprt->timeout; if (args->timeout != NULL) { memcpy(&clnt->cl_timeout_default, args->timeout, sizeof(clnt->cl_timeout_default)); clnt->cl_timeout = &clnt->cl_timeout_default; } clnt->cl_rtt = &clnt->cl_rtt_default; rpc_init_rtt(&clnt->cl_rtt_default, clnt->cl_timeout->to_initval); clnt->cl_principal = NULL; if (args->client_name) { clnt->cl_principal = kstrdup(args->client_name, GFP_KERNEL); if (!clnt->cl_principal) goto out_no_principal; } atomic_set(&clnt->cl_count, 1); err = rpc_setup_pipedir(clnt, program->pipe_dir_name); if (err < 0) goto out_no_path; auth = rpcauth_create(args->authflavor, clnt); if (IS_ERR(auth)) { printk(KERN_INFO ""RPC: Couldn't create auth handle (flavor %u)\n"", args->authflavor); err = PTR_ERR(auth); goto out_no_auth; } /* save the nodename */ clnt->cl_nodelen = strlen(init_utsname()->nodename); if (clnt->cl_nodelen > UNX_MAXNODENAME) clnt->cl_nodelen = UNX_MAXNODENAME; memcpy(clnt->cl_nodename, init_utsname()->nodename, clnt->cl_nodelen); rpc_register_client(clnt); return clnt; out_no_auth: if (!IS_ERR(clnt->cl_path.dentry)) { rpc_remove_client_dir(clnt->cl_path.dentry); rpc_put_mount(); } out_no_path: kfree(clnt->cl_principal); out_no_principal: rpc_free_iostats(clnt->cl_metrics); out_no_stats: if (clnt->cl_server != clnt->cl_inline_name) kfree(clnt->cl_server); kfree(clnt); out_err: xprt_put(xprt); out_no_xprt: rpciod_down(); out_no_rpciod: return ERR_PTR(err); } ",0 "APIPermission* CreateAPIPermission(const APIPermissionInfo* permission) { return new T(permission); } ",0 "static void hns_xgmac_config_pad_and_crc(void *mac_drv, u8 newval) { struct mac_driver *drv = (struct mac_driver *)mac_drv; u32 origin = dsaf_read_dev(drv, XGMAC_MAC_CONTROL_REG); dsaf_set_bit(origin, XGMAC_CTL_TX_PAD_B, !!newval); dsaf_set_bit(origin, XGMAC_CTL_TX_FCS_B, !!newval); dsaf_set_bit(origin, XGMAC_CTL_RX_FCS_B, !!newval); dsaf_write_dev(drv, XGMAC_MAC_CONTROL_REG, origin); } ",0 " int GetInUseCount(const GURL& origin) { return inuse_[origin]; } ",0 "void Browser::ViewSourceForTab(WebContents* source, const GURL& page_url) { DCHECK(source); TabContents* tab_contents = chrome::GetTabContentsAt(this, tab_strip_model_->GetIndexOfWebContents(source)); chrome::ViewSource(this, tab_contents); } ",0 "void WebPage::executeJavaScriptFunction(const std::vector &function, const std::vector &args, JavaScriptVariant& returnValue) { if (!d->m_mainFrame) { returnValue.setType(JavaScriptVariant::Exception); return; } JSC::Bindings::RootObject* root = d->m_mainFrame->script()->bindingRootObject(); if (!root) { returnValue.setType(JavaScriptVariant::Exception); return; } JSC::ExecState* exec = root->globalObject()->globalExec(); JSGlobalContextRef ctx = toGlobalRef(exec); JSC::JSLockHolder lock(exec); WTF::Vector argListRef(args.size()); for (unsigned i = 0; i < args.size(); ++i) argListRef[i] = BlackBerryJavaScriptVariantToJSValueRef(ctx, args[i]); JSValueRef windowObjectValue = windowObject(); JSObjectRef obj = JSValueToObject(ctx, windowObjectValue, 0); JSObjectRef thisObject = obj; for (unsigned i = 0; i < function.size(); ++i) { JSStringRef str = JSStringCreateWithUTF8CString(function[i].c_str()); thisObject = obj; obj = JSValueToObject(ctx, JSObjectGetProperty(ctx, obj, str, 0), 0); JSStringRelease(str); if (!obj) break; } JSObjectRef functionObject = obj; JSValueRef result = 0; if (functionObject && thisObject) result = JSObjectCallAsFunction(ctx, functionObject, thisObject, args.size(), argListRef.data(), 0); if (!result) { returnValue.setType(JavaScriptVariant::Exception); return; } returnValue = JSValueRefToBlackBerryJavaScriptVariant(ctx, result); } ",0 "void WebSocketJob::OnSentData(SocketStream* socket, int amount_sent) { DCHECK_NE(INITIALIZED, state_); if (state_ == CLOSED) return; if (state_ == CONNECTING) { OnSentHandshakeRequest(socket, amount_sent); return; } if (delegate_) { DCHECK(state_ == OPEN || state_ == CLOSING); DCHECK_GT(amount_sent, 0); DCHECK(current_buffer_); current_buffer_->DidConsume(amount_sent); if (current_buffer_->BytesRemaining() > 0) return; amount_sent = send_frame_handler_->GetOriginalBufferSize(); DCHECK_GT(amount_sent, 0); current_buffer_ = NULL; send_frame_handler_->ReleaseCurrentBuffer(); delegate_->OnSentData(socket, amount_sent); MessageLoopForIO::current()->PostTask( FROM_HERE, NewRunnableMethod(this, &WebSocketJob::SendPending)); } } ",1 " NonGarbageCollectedContainer(Object* obj, int y) : obj_(obj), y_(y) {} ",0 "void OfflineAudioDestinationHandler::RestartRendering() { DCHECK(IsMainThread()); PrepareTaskRunnerForRendering(); }; ",0 "BGD_DECLARE(void) gdImageCopyRotated (gdImagePtr dst, gdImagePtr src, double dstX, double dstY, int srcX, int srcY, int srcWidth, int srcHeight, int angle) { double dx, dy; double radius = sqrt (srcWidth * srcWidth + srcHeight * srcHeight); double aCos = cos (angle * .0174532925); double aSin = sin (angle * .0174532925); double scX = srcX + ((double) srcWidth) / 2; double scY = srcY + ((double) srcHeight) / 2; int cmap[gdMaxColors]; int i; /* 2.0.34: transparency preservation. The transparentness of the transparent color is more important than its hue. */ if (src->transparent != -1) { if (dst->transparent == -1) { dst->transparent = src->transparent; } } for (i = 0; (i < gdMaxColors); i++) { cmap[i] = (-1); } for (dy = dstY - radius; (dy <= dstY + radius); dy++) { for (dx = dstX - radius; (dx <= dstX + radius); dx++) { double sxd = (dx - dstX) * aCos - (dy - dstY) * aSin; double syd = (dy - dstY) * aCos + (dx - dstX) * aSin; int sx = sxd + scX; int sy = syd + scY; if ((sx >= srcX) && (sx < srcX + srcWidth) && (sy >= srcY) && (sy < srcY + srcHeight)) { int c = gdImageGetPixel (src, sx, sy); /* 2.0.34: transparency wins */ if (c == src->transparent) { gdImageSetPixel (dst, dx, dy, dst->transparent); } else if (!src->trueColor) { /* Use a table to avoid an expensive lookup on every single pixel */ if (cmap[c] == -1) { cmap[c] = gdImageColorResolveAlpha (dst, gdImageRed (src, c), gdImageGreen (src, c), gdImageBlue (src, c), gdImageAlpha (src, c)); } gdImageSetPixel (dst, dx, dy, cmap[c]); } else { gdImageSetPixel (dst, dx, dy, gdImageColorResolveAlpha (dst, gdImageRed (src, c), gdImageGreen (src, c), gdImageBlue (src, c), gdImageAlpha (src, c))); } } } } } ",0 "void RenderFrameHostImpl::SetNavigationRequest( std::unique_ptr navigation_request) { DCHECK(navigation_request); if (FrameMsg_Navigate_Type::IsSameDocument( navigation_request->common_params().navigation_type)) { same_document_navigation_request_ = std::move(navigation_request); return; } navigation_requests_[navigation_request->navigation_handle() ->GetNavigationId()] = std::move(navigation_request); } ",0 "static u8 llcp_tlv8(u8 *tlv, u8 type) { if (tlv[0] != type || tlv[1] != llcp_tlv_length[tlv[0]]) return 0; return tlv[2]; } ",0 " base::FilePath DestinationFile(Browser* browser, const base::FilePath& file) { return GetDownloadDirectory(browser).Append(file.BaseName()); } ",0 "externalEntityInitProcessor2(XML_Parser parser, const char *start, const char *end, const char **endPtr) { const char *next = start; /* XmlContentTok doesn't always set the last arg */ int tok = XmlContentTok(parser->m_encoding, start, end, &next); switch (tok) { case XML_TOK_BOM: /* If we are at the end of the buffer, this would cause the next stage, i.e. externalEntityInitProcessor3, to pass control directly to doContent (by detecting XML_TOK_NONE) without processing any xml text declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. */ if (next == end && !parser->m_parsingStatus.finalBuffer) { *endPtr = next; return XML_ERROR_NONE; } start = next; break; case XML_TOK_PARTIAL: if (!parser->m_parsingStatus.finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } parser->m_eventPtr = start; return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (!parser->m_parsingStatus.finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } parser->m_eventPtr = start; return XML_ERROR_PARTIAL_CHAR; } parser->m_processor = externalEntityInitProcessor3; return externalEntityInitProcessor3(parser, start, end, endPtr); } ",0 "static int cac_set_security_env(sc_card_t *card, const sc_security_env_t *env, int se_num) { int r = SC_SUCCESS; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, ""flags=%08lx op=%d alg=%d algf=%08x algr=%08x kr0=%02x, krfl=%""SC_FORMAT_LEN_SIZE_T""u\n"", env->flags, env->operation, env->algorithm, env->algorithm_flags, env->algorithm_ref, env->key_ref[0], env->key_ref_len); if (env->algorithm != SC_ALGORITHM_RSA) { r = SC_ERROR_NO_CARD_SUPPORT; } SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r); } ",0 "static int server_finish(SSL *s) { unsigned char *p; if (s->state == SSL2_ST_SEND_SERVER_FINISHED_A) { p = (unsigned char *)s->init_buf->data; *(p++) = SSL2_MT_SERVER_FINISHED; if (s->session->session_id_length > sizeof s->session->session_id) { SSLerr(SSL_F_SERVER_FINISH, ERR_R_INTERNAL_ERROR); return -1; } memcpy(p, s->session->session_id, (unsigned int)s->session->session_id_length); /* p+=s->session->session_id_length; */ s->state = SSL2_ST_SEND_SERVER_FINISHED_B; s->init_num = s->session->session_id_length + 1; s->init_off = 0; } /* SSL2_ST_SEND_SERVER_FINISHED_B */ return (ssl2_do_write(s)); } ",0 " virtual void run() { if (WebDevToolsAgent* webagent = m_descriptor->agent()) webagent->dispatchOnInspectorBackend(m_descriptor->message()); } ",0 "void InputMethodWin::OnInputLocaleChanged() { active_ = imm32_manager_.SetInputLanguage(); locale_ = imm32_manager_.GetInputLanguageName(); direction_ = imm32_manager_.GetTextDirection(); OnInputMethodChanged(); } ",1 "SkColor TestRenderWidgetHostView::background_color() const { return background_color_; } ",0 "void BluetoothRemoteGATTServer::AddToActiveAlgorithms( ScriptPromiseResolver* resolver) { auto result = m_activeAlgorithms.add(resolver); CHECK(result.isNewEntry); } ",0 "void PaymentRequest::OnPayerInfoSelected(mojom::PayerDetailPtr payer_info) { client_->OnPayerDetailChange(std::move(payer_info)); } ",0 "semaphore_t *semaphore_new(unsigned int value) { semaphore_t *ret = osi_malloc(sizeof(semaphore_t)); if (ret) { ret->fd = eventfd(value, EFD_SEMAPHORE); if (ret->fd == INVALID_FD) { LOG_ERROR(""%s unable to allocate semaphore: %s"", __func__, strerror(errno)); osi_free(ret); ret = NULL; } } return ret; } ",0 "void WebPage::playSoundIfAnchorIsTarget() const { d->m_touchEventHandler->playSoundIfAnchorIsTarget(); } ",0 "static unsigned int kvm_current_mmio_generation(struct kvm *kvm) { /* * Init kvm generation close to MMIO_MAX_GEN to easily test the * code of handling generation number wrap-around. */ return (kvm_memslots(kvm)->generation + MMIO_MAX_GEN - 150) & MMIO_GEN_MASK; } ",0 "void TestingAutomationProvider::ReloadJSON( DictionaryValue* args, IPC::Message* reply_message) { if (SendErrorIfModalDialogActive(this, reply_message)) return; WebContents* web_contents; std::string error; if (!GetTabFromJSONArgs(args, &web_contents, &error)) { AutomationJSONReply(this, reply_message).SendError(error); return; } NavigationController& controller = web_contents->GetController(); new NavigationNotificationObserver(&controller, this, reply_message, 1, false, true); controller.Reload(false); } ",0 "void xmlInitGlobals(void) { if (xmlThrDefMutex == NULL) xmlThrDefMutex = xmlNewMutex(); } ",0 "void bitmap_writer_reuse_bitmaps(struct packing_data *to_pack) { if (prepare_bitmap_git() < 0) return; writer.reused = kh_init_sha1(); rebuild_existing_bitmaps(to_pack, writer.reused, writer.show_progress); } ",0 "vrrp_garp_rep_handler(vector_t *strvec) { vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp); unsigned repeats; /* The min value should be 1, but allow 0 to maintain backward compatibility * with pre v2.0.7 */ if (!read_unsigned_strvec(strvec, 1, &repeats, 0, UINT_MAX, true)) { report_config_error(CONFIG_GENERAL_ERROR, ""(%s): garp_master_repeat '%s' invalid - ignoring"", vrrp->iname, FMT_STR_VSLOT(strvec, 1)); return; } if (repeats == 0) { report_config_error(CONFIG_GENERAL_ERROR, ""(%s): garp_master_repeat must be greater than 0, setting to 1"", vrrp->iname); repeats = 1; } vrrp->garp_rep = repeats; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoClearBufferfi(GLenum buffer, GLint drawbuffers, GLfloat depth, GLint stencil) { api()->glClearBufferfiFn(buffer, drawbuffers, depth, stencil); return error::kNoError; } ",0 "static inline dma_addr_t pci_map_single_debug(struct pci_dev *pdev, void *ptr, size_t size, int direction) { dma_addr_t addr = pci_map_single(pdev, ptr, size, direction); if (addr + size > 0x100000000LL) pr_crit(""%s: pci_map_single() returned memory at 0x%llx!\n"", pci_name(pdev), (unsigned long long)addr); return addr; } ",0 "void BluetoothSocketAbstractConnectFunction::OnConnect( scoped_refptr socket) { DCHECK_CURRENTLY_ON(work_thread_id()); BluetoothApiSocket* api_socket = GetSocket(params_->socket_id); if (!api_socket) { Respond(Error(kSocketNotFoundError)); return; } api_socket->AdoptConnectedSocket(socket, params_->address, device::BluetoothUUID(params_->uuid)); socket_event_dispatcher_->OnSocketConnect(extension_id(), params_->socket_id); Respond(ArgumentList(bluetooth_socket::Connect::Results::Create())); } ",0 "void WebGL2RenderingContextBase::deleteFramebuffer( WebGLFramebuffer* framebuffer) { if (framebuffer && framebuffer->Opaque()) { SynthesizeGLError(GL_INVALID_OPERATION, ""deleteFramebuffer"", ""cannot delete an opaque framebuffer""); return; } if (!DeleteObject(framebuffer)) return; GLenum target = 0; if (framebuffer == framebuffer_binding_) { if (framebuffer == read_framebuffer_binding_) { target = GL_FRAMEBUFFER; framebuffer_binding_ = nullptr; read_framebuffer_binding_ = nullptr; } else { target = GL_DRAW_FRAMEBUFFER; framebuffer_binding_ = nullptr; } } else if (framebuffer == read_framebuffer_binding_) { target = GL_READ_FRAMEBUFFER; read_framebuffer_binding_ = nullptr; } if (target) { GetDrawingBuffer()->Bind(target); } } ",0 "void GfxState::setFillColorSpace(GfxColorSpace *colorSpace) { if (fillColorSpace) { delete fillColorSpace; } fillColorSpace = colorSpace; } ",0 "void WebPageProxy::viewScaleFactorDidChange(double scaleFactor) { m_viewScaleFactor = scaleFactor; } ",0 "error::Error GLES2DecoderImpl::HandleVertexAttribDivisorANGLE( uint32 immediate_data_size, const gles2::VertexAttribDivisorANGLE& c) { if (!feature_info_->feature_flags().angle_instanced_arrays) { SetGLError(GL_INVALID_OPERATION, ""glVertexAttribDivisorANGLE"", ""function not available""); } GLuint index = c.index; GLuint divisor = c.divisor; if (index >= group_->max_vertex_attribs()) { SetGLError(GL_INVALID_VALUE, ""glVertexAttribDivisorANGLE"", ""index out of range""); return error::kNoError; } vertex_attrib_manager_->SetDivisor( index, divisor); glVertexAttribDivisorANGLE(index, divisor); return error::kNoError; } ",0 " void Reset() { finished_ = false; waiting_ = false; result_.clear(); } ",0 "struct bio *bio_clone_mddev(struct bio *bio, gfp_t gfp_mask, struct mddev *mddev) { if (!mddev || !mddev->bio_set) return bio_clone(bio, gfp_mask); return bio_clone_bioset(bio, gfp_mask, mddev->bio_set); } ",0 "poppler_page_get_transition (PopplerPage *page) { PageTransition *trans; PopplerPageTransition *transition; Object obj; g_return_val_if_fail (POPPLER_IS_PAGE (page), NULL); trans = new PageTransition (page->page->getTrans (&obj)); obj.free (); if (!trans->isOk ()) { delete trans; return NULL; } transition = poppler_page_transition_new (); switch (trans->getType ()) { case transitionReplace: transition->type = POPPLER_PAGE_TRANSITION_REPLACE; break; case transitionSplit: transition->type = POPPLER_PAGE_TRANSITION_SPLIT; break; case transitionBlinds: transition->type = POPPLER_PAGE_TRANSITION_BLINDS; break; case transitionBox: transition->type = POPPLER_PAGE_TRANSITION_BOX; break; case transitionWipe: transition->type = POPPLER_PAGE_TRANSITION_WIPE; break; case transitionDissolve: transition->type = POPPLER_PAGE_TRANSITION_DISSOLVE; break; case transitionGlitter: transition->type = POPPLER_PAGE_TRANSITION_GLITTER; break; case transitionFly: transition->type = POPPLER_PAGE_TRANSITION_FLY; break; case transitionPush: transition->type = POPPLER_PAGE_TRANSITION_PUSH; break; case transitionCover: transition->type = POPPLER_PAGE_TRANSITION_COVER; break; case transitionUncover: transition->type = POPPLER_PAGE_TRANSITION_UNCOVER; break; case transitionFade: transition->type = POPPLER_PAGE_TRANSITION_FADE; break; default: g_assert_not_reached (); } transition->alignment = (trans->getAlignment() == transitionHorizontal) ? POPPLER_PAGE_TRANSITION_HORIZONTAL : POPPLER_PAGE_TRANSITION_VERTICAL; transition->direction = (trans->getDirection() == transitionInward) ? POPPLER_PAGE_TRANSITION_INWARD : POPPLER_PAGE_TRANSITION_OUTWARD; transition->duration = trans->getDuration(); transition->angle = trans->getAngle(); transition->scale = trans->getScale(); transition->rectangular = trans->isRectangular(); delete trans; return transition; } ",0 "static void cmd_xrunannotator(const char *tag, const char *sequence, int usinguid) { const char *cmd = usinguid ? ""UID Xrunannotator"" : ""Xrunannotator""; clock_t start = clock(); char mytime[100]; int c, r = 0; if (backend_current) { /* remote mailbox */ prot_printf(backend_current->out, ""%s %s %s "", tag, cmd, sequence); if (!pipe_command(backend_current, 65536)) { pipe_including_tag(backend_current, tag, 0); } return; } /* local mailbox */ /* we're expecting no more arguments */ c = prot_getc(imapd_in); if (c == '\r') c = prot_getc(imapd_in); if (c != '\n') { prot_printf(imapd_out, ""%s BAD Unexpected extra arguments to %s\r\n"", tag, cmd); eatline(imapd_in, c); return; } r = index_run_annotator(imapd_index, sequence, usinguid, &imapd_namespace, imapd_userisadmin); snprintf(mytime, sizeof(mytime), ""%2.3f"", (clock() - start) / (double) CLOCKS_PER_SEC); if (r) prot_printf(imapd_out, ""%s NO %s (%s sec)\r\n"", tag, error_message(r), mytime); else prot_printf(imapd_out, ""%s OK %s (%s sec)\r\n"", tag, error_message(IMAP_OK_COMPLETED), mytime); } ",0 "HandleAliasDef(KeyNamesInfo *info, KeyAliasDef *def, enum merge_mode merge) { AliasInfo *old, new; darray_foreach(old, info->aliases) { if (old->alias == def->alias) { if (def->real == old->real) { log_vrb(info->ctx, 1, ""Alias of %s for %s declared more than once; "" ""First definition ignored\n"", KeyNameText(info->ctx, def->alias), KeyNameText(info->ctx, def->real)); } else { xkb_atom_t use, ignore; use = (merge == MERGE_AUGMENT ? old->real : def->real); ignore = (merge == MERGE_AUGMENT ? def->real : old->real); log_warn(info->ctx, ""Multiple definitions for alias %s; "" ""Using %s, ignoring %s\n"", KeyNameText(info->ctx, old->alias), KeyNameText(info->ctx, use), KeyNameText(info->ctx, ignore)); old->real = use; } old->merge = merge; return true; } } InitAliasInfo(&new, merge, def->alias, def->real); darray_append(info->aliases, new); return true; } ",0 "void WebPageProxy::setCustomUserAgent(const String& customUserAgent) { if (m_customUserAgent == customUserAgent) return; m_customUserAgent = customUserAgent; if (m_customUserAgent.isEmpty()) { setUserAgent(standardUserAgent(m_applicationNameForUserAgent)); return; } setUserAgent(m_customUserAgent); } ",0 "AcceleratedStaticBitmapImage::AcceleratedStaticBitmapImage( sk_sp image, base::WeakPtr&& context_provider_wrapper) : paint_image_content_id_(cc::PaintImage::GetNextContentId()) { CHECK(image && image->isTextureBacked()); texture_holder_ = std::make_unique( std::move(image), std::move(context_provider_wrapper)); thread_checker_.DetachFromThread(); } ",1 "rgb2g(fz_context *ctx, fz_color_converter *cc, float *dv, const float *sv) { dv[0] = sv[0] * 0.3f + sv[1] * 0.59f + sv[2] * 0.11f; } ",0 "void md_error(struct mddev *mddev, struct md_rdev *rdev) { if (!rdev || test_bit(Faulty, &rdev->flags)) return; if (!mddev->pers || !mddev->pers->error_handler) return; mddev->pers->error_handler(mddev,rdev); if (mddev->degraded) set_bit(MD_RECOVERY_RECOVER, &mddev->recovery); sysfs_notify_dirent_safe(rdev->sysfs_state); set_bit(MD_RECOVERY_INTR, &mddev->recovery); set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); md_wakeup_thread(mddev->thread); if (mddev->event_work.func) queue_work(md_misc_wq, &mddev->event_work); md_new_event_inintr(mddev); } ",0 "static int audit_field_compare(struct task_struct *tsk, const struct cred *cred, struct audit_field *f, struct audit_context *ctx, struct audit_names *name) { switch (f->val) { /* process to file object comparisons */ case AUDIT_COMPARE_UID_TO_OBJ_UID: return audit_compare_uid(cred->uid, name, f, ctx); case AUDIT_COMPARE_GID_TO_OBJ_GID: return audit_compare_gid(cred->gid, name, f, ctx); case AUDIT_COMPARE_EUID_TO_OBJ_UID: return audit_compare_uid(cred->euid, name, f, ctx); case AUDIT_COMPARE_EGID_TO_OBJ_GID: return audit_compare_gid(cred->egid, name, f, ctx); case AUDIT_COMPARE_AUID_TO_OBJ_UID: return audit_compare_uid(tsk->loginuid, name, f, ctx); case AUDIT_COMPARE_SUID_TO_OBJ_UID: return audit_compare_uid(cred->suid, name, f, ctx); case AUDIT_COMPARE_SGID_TO_OBJ_GID: return audit_compare_gid(cred->sgid, name, f, ctx); case AUDIT_COMPARE_FSUID_TO_OBJ_UID: return audit_compare_uid(cred->fsuid, name, f, ctx); case AUDIT_COMPARE_FSGID_TO_OBJ_GID: return audit_compare_gid(cred->fsgid, name, f, ctx); /* uid comparisons */ case AUDIT_COMPARE_UID_TO_AUID: return audit_uid_comparator(cred->uid, f->op, tsk->loginuid); case AUDIT_COMPARE_UID_TO_EUID: return audit_uid_comparator(cred->uid, f->op, cred->euid); case AUDIT_COMPARE_UID_TO_SUID: return audit_uid_comparator(cred->uid, f->op, cred->suid); case AUDIT_COMPARE_UID_TO_FSUID: return audit_uid_comparator(cred->uid, f->op, cred->fsuid); /* auid comparisons */ case AUDIT_COMPARE_AUID_TO_EUID: return audit_uid_comparator(tsk->loginuid, f->op, cred->euid); case AUDIT_COMPARE_AUID_TO_SUID: return audit_uid_comparator(tsk->loginuid, f->op, cred->suid); case AUDIT_COMPARE_AUID_TO_FSUID: return audit_uid_comparator(tsk->loginuid, f->op, cred->fsuid); /* euid comparisons */ case AUDIT_COMPARE_EUID_TO_SUID: return audit_uid_comparator(cred->euid, f->op, cred->suid); case AUDIT_COMPARE_EUID_TO_FSUID: return audit_uid_comparator(cred->euid, f->op, cred->fsuid); /* suid comparisons */ case AUDIT_COMPARE_SUID_TO_FSUID: return audit_uid_comparator(cred->suid, f->op, cred->fsuid); /* gid comparisons */ case AUDIT_COMPARE_GID_TO_EGID: return audit_gid_comparator(cred->gid, f->op, cred->egid); case AUDIT_COMPARE_GID_TO_SGID: return audit_gid_comparator(cred->gid, f->op, cred->sgid); case AUDIT_COMPARE_GID_TO_FSGID: return audit_gid_comparator(cred->gid, f->op, cred->fsgid); /* egid comparisons */ case AUDIT_COMPARE_EGID_TO_SGID: return audit_gid_comparator(cred->egid, f->op, cred->sgid); case AUDIT_COMPARE_EGID_TO_FSGID: return audit_gid_comparator(cred->egid, f->op, cred->fsgid); /* sgid comparison */ case AUDIT_COMPARE_SGID_TO_FSGID: return audit_gid_comparator(cred->sgid, f->op, cred->fsgid); default: WARN(1, ""Missing AUDIT_COMPARE define. Report as a bug\n""); return 0; } return 0; } ",0 "void SessionService::Init() { registrar_.Add(this, content::NOTIFICATION_TAB_PARENTED, content::NotificationService::AllSources()); registrar_.Add(this, content::NOTIFICATION_TAB_CLOSED, content::NotificationService::AllSources()); registrar_.Add(this, content::NOTIFICATION_NAV_LIST_PRUNED, content::NotificationService::AllSources()); registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_CHANGED, content::NotificationService::AllSources()); registrar_.Add(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_BROWSER_OPENED, content::NotificationService::AllBrowserContextsAndSources()); registrar_.Add( this, chrome::NOTIFICATION_TAB_CONTENTS_APPLICATION_EXTENSION_CHANGED, content::NotificationService::AllSources()); } ",0 "void snro_del(GF_Box *s) { GF_SeqOffHintEntryBox *snro = (GF_SeqOffHintEntryBox *)s; gf_free(snro); } ",0 "IntRect RenderBox::overflowClipRect(const IntPoint& location, OverlayScrollbarSizeRelevancy relevancy) { IntRect clipRect(location + IntSize(borderLeft(), borderTop()), size() - IntSize(borderLeft() + borderRight(), borderTop() + borderBottom())); if (layer()) clipRect.contract(layer()->verticalScrollbarWidth(relevancy), layer()->horizontalScrollbarHeight(relevancy)); return clipRect; } ",0 "aiff_next_chunk_iterator (SF_PRIVATE *psf, SF_CHUNK_ITERATOR * iterator) { return psf_next_chunk_iterator (&psf->rchunks, iterator) ; } /* aiff_next_chunk_iterator */ ",0 "static int mov_get_dnxhd_codec_tag(AVFormatContext *s, MOVTrack *track) { int tag = MKTAG('A','V','d','n'); if (track->par->profile != FF_PROFILE_UNKNOWN && track->par->profile != FF_PROFILE_DNXHD) tag = MKTAG('A','V','d','h'); return tag; } ",0 "void GLES2Implementation::BindFramebufferHelper(GLenum target, GLuint framebuffer) { bool changed = false; switch (target) { case GL_FRAMEBUFFER: if (bound_framebuffer_ != framebuffer || bound_read_framebuffer_ != framebuffer) { bound_framebuffer_ = framebuffer; bound_read_framebuffer_ = framebuffer; changed = true; } break; case GL_READ_FRAMEBUFFER: DCHECK(capabilities_.major_version >= 3 || IsChromiumFramebufferMultisampleAvailable()); if (bound_read_framebuffer_ != framebuffer) { bound_read_framebuffer_ = framebuffer; changed = true; } break; case GL_DRAW_FRAMEBUFFER: DCHECK(capabilities_.major_version >= 3 || IsChromiumFramebufferMultisampleAvailable()); if (bound_framebuffer_ != framebuffer) { bound_framebuffer_ = framebuffer; changed = true; } break; default: SetGLErrorInvalidEnum(""glBindFramebuffer"", target, ""target""); return; } if (changed) { if (framebuffer != 0) GetIdAllocator(IdNamespaces::kFramebuffers)->MarkAsUsed(framebuffer); helper_->BindFramebuffer(target, framebuffer); } } ",0 "void *mlx5_get_send_wqe(struct mlx5_ib_qp *qp, int n) { return get_wqe(qp, qp->sq.offset + (n << MLX5_IB_SQ_STRIDE)); } ",0 "gfx::Image Browser::GetCurrentPageIcon() const { WebContents* web_contents = chrome::GetActiveWebContents(this); FaviconTabHelper* favicon_tab_helper = web_contents ? FaviconTabHelper::FromWebContents(web_contents) : NULL; return favicon_tab_helper ? favicon_tab_helper->GetFavicon() : gfx::Image(); } ",0 "void RenderBlock::removeChild(RenderObject* oldChild) { if (documentBeingDestroyed()) { RenderBox::removeChild(oldChild); return; } TemporaryChange columnFlowSplitEnabled(gColumnFlowSplitEnabled, false); RenderObject* prev = oldChild->previousSibling(); RenderObject* next = oldChild->nextSibling(); bool canMergeAnonymousBlocks = canMergeContiguousAnonymousBlocks(oldChild, prev, next); if (canMergeAnonymousBlocks && prev && next) { prev->setNeedsLayoutAndPrefWidthsRecalc(); RenderBlockFlow* nextBlock = toRenderBlockFlow(next); RenderBlockFlow* prevBlock = toRenderBlockFlow(prev); if (prev->childrenInline() != next->childrenInline()) { RenderBlock* inlineChildrenBlock = prev->childrenInline() ? prevBlock : nextBlock; RenderBlock* blockChildrenBlock = prev->childrenInline() ? nextBlock : prevBlock; ASSERT(!inlineChildrenBlock->continuation()); RefPtr newStyle = RenderStyle::createAnonymousStyleWithDisplay(style(), BLOCK); bool inlineChildrenBlockHasLayer = inlineChildrenBlock->hasLayer(); inlineChildrenBlock->setStyle(newStyle); children()->removeChildNode(this, inlineChildrenBlock, inlineChildrenBlockHasLayer); blockChildrenBlock->children()->insertChildNode(blockChildrenBlock, inlineChildrenBlock, prev == inlineChildrenBlock ? blockChildrenBlock->firstChild() : 0, inlineChildrenBlockHasLayer || blockChildrenBlock->hasLayer()); next->setNeedsLayoutAndPrefWidthsRecalc(); if (inlineChildrenBlock == prevBlock) prev = 0; else next = 0; } else { nextBlock->moveAllChildrenIncludingFloatsTo(prevBlock, nextBlock->hasLayer() || prevBlock->hasLayer()); nextBlock->deleteLineBoxTree(); nextBlock->destroy(); next = 0; } } RenderBox::removeChild(oldChild); RenderObject* child = prev ? prev : next; if (canMergeAnonymousBlocks && child && !child->previousSibling() && !child->nextSibling() && canCollapseAnonymousBlockChild()) { collapseAnonymousBlockChild(this, toRenderBlock(child)); } else if (((prev && prev->isAnonymousBlock()) || (next && next->isAnonymousBlock())) && canCollapseAnonymousBlockChild()) { RenderBlock* anonymousBlock = toRenderBlock((prev && prev->isAnonymousBlock()) ? prev : next); if ((anonymousBlock->previousSibling() || anonymousBlock->nextSibling()) && (!anonymousBlock->previousSibling() || (anonymousBlock->previousSibling()->style()->styleType() != NOPSEUDO && anonymousBlock->previousSibling()->isFloating() && !anonymousBlock->previousSibling()->previousSibling())) && (!anonymousBlock->nextSibling() || (anonymousBlock->nextSibling()->style()->styleType() != NOPSEUDO && anonymousBlock->nextSibling()->isFloating() && !anonymousBlock->nextSibling()->nextSibling()))) { collapseAnonymousBlockChild(this, anonymousBlock); } } if (!firstChild()) { if (childrenInline()) deleteLineBoxTree(); if (!beingDestroyed() && isAnonymousBlockContinuation() && !oldChild->isListMarker()) { RenderObject* containingBlockIgnoringAnonymous = containingBlock(); while (containingBlockIgnoringAnonymous && containingBlockIgnoringAnonymous->isAnonymousBlock()) containingBlockIgnoringAnonymous = containingBlockIgnoringAnonymous->containingBlock(); for (RenderObject* curr = this; curr; curr = curr->previousInPreOrder(containingBlockIgnoringAnonymous)) { if (curr->virtualContinuation() != this) continue; RenderBoxModelObject* nextContinuation = continuation(); if (curr->isRenderInline()) toRenderInline(curr)->setContinuation(nextContinuation); else if (curr->isRenderBlock()) toRenderBlock(curr)->setContinuation(nextContinuation); else ASSERT_NOT_REACHED(); break; } setContinuation(0); destroy(); } } } ",0 "static int l2cap_sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t len) { struct sock *sk = sock->sk; int err = 0; BT_DBG(""sock %p, sk %p"", sock, sk); err = sock_error(sk); if (err) return err; if (msg->msg_flags & MSG_OOB) return -EOPNOTSUPP; /* Check outgoing MTU */ if (sk->sk_type != SOCK_RAW && len > l2cap_pi(sk)->omtu) return -EINVAL; lock_sock(sk); if (sk->sk_state == BT_CONNECTED) err = l2cap_do_send(sk, msg, len); else err = -ENOTCONN; release_sock(sk); return err; } ",0 " tt_face_get_name( TT_Face face, FT_UShort nameid, FT_String** name ) { FT_Memory memory = face->root.memory; FT_Error error = FT_Err_Ok; FT_String* result = NULL; FT_UShort n; TT_NameEntryRec* rec; FT_Int found_apple = -1; FT_Int found_apple_roman = -1; FT_Int found_apple_english = -1; FT_Int found_win = -1; FT_Int found_unicode = -1; FT_Bool is_english = 0; TT_NameEntry_ConvertFunc convert; FT_ASSERT( name ); rec = face->name_table.names; for ( n = 0; n < face->num_names; n++, rec++ ) { /* According to the OpenType 1.3 specification, only Microsoft or */ /* Apple platform IDs might be used in the `name' table. The */ /* `Unicode' platform is reserved for the `cmap' table, and the */ /* `ISO' one is deprecated. */ /* */ /* However, the Apple TrueType specification doesn't say the same */ /* thing and goes to suggest that all Unicode `name' table entries */ /* should be coded in UTF-16 (in big-endian format I suppose). */ /* */ if ( rec->nameID == nameid && rec->stringLength > 0 ) { switch ( rec->platformID ) { case TT_PLATFORM_APPLE_UNICODE: case TT_PLATFORM_ISO: /* there is `languageID' to check there. We should use this */ /* field only as a last solution when nothing else is */ /* available. */ /* */ found_unicode = n; break; case TT_PLATFORM_MACINTOSH: /* This is a bit special because some fonts will use either */ /* an English language id, or a Roman encoding id, to indicate */ /* the English version of its font name. */ /* */ if ( rec->languageID == TT_MAC_LANGID_ENGLISH ) found_apple_english = n; else if ( rec->encodingID == TT_MAC_ID_ROMAN ) found_apple_roman = n; break; case TT_PLATFORM_MICROSOFT: /* we only take a non-English name when there is nothing */ /* else available in the font */ /* */ if ( found_win == -1 || ( rec->languageID & 0x3FF ) == 0x009 ) { switch ( rec->encodingID ) { case TT_MS_ID_SYMBOL_CS: case TT_MS_ID_UNICODE_CS: case TT_MS_ID_UCS_4: is_english = FT_BOOL( ( rec->languageID & 0x3FF ) == 0x009 ); found_win = n; break; default: ; } } break; default: ; } } } found_apple = found_apple_roman; if ( found_apple_english >= 0 ) found_apple = found_apple_english; /* some fonts contain invalid Unicode or Macintosh formatted entries; */ /* we will thus favor names encoded in Windows formats if available */ /* (provided it is an English name) */ /* */ convert = NULL; if ( found_win >= 0 && !( found_apple >= 0 && !is_english ) ) { rec = face->name_table.names + found_win; switch ( rec->encodingID ) { /* all Unicode strings are encoded using UTF-16BE */ case TT_MS_ID_UNICODE_CS: case TT_MS_ID_SYMBOL_CS: convert = tt_name_entry_ascii_from_utf16; break; case TT_MS_ID_UCS_4: /* Apparently, if this value is found in a name table entry, it is */ /* documented as `full Unicode repertoire'. Experience with the */ /* MsGothic font shipped with Windows Vista shows that this really */ /* means UTF-16 encoded names (UCS-4 values are only used within */ /* charmaps). */ convert = tt_name_entry_ascii_from_utf16; break; default: ; } } else if ( found_apple >= 0 ) { rec = face->name_table.names + found_apple; convert = tt_name_entry_ascii_from_other; } else if ( found_unicode >= 0 ) { rec = face->name_table.names + found_unicode; convert = tt_name_entry_ascii_from_utf16; } if ( rec && convert ) { if ( rec->string == NULL ) { FT_Stream stream = face->name_table.stream; if ( FT_QNEW_ARRAY ( rec->string, rec->stringLength ) || FT_STREAM_SEEK( rec->stringOffset ) || FT_STREAM_READ( rec->string, rec->stringLength ) ) { FT_FREE( rec->string ); rec->stringLength = 0; result = NULL; goto Exit; } } result = convert( rec, memory ); } Exit: *name = result; return error; } ",0 "static int update_raid_disks(struct mddev *mddev, int raid_disks) { int rv; struct md_rdev *rdev; /* change the number of raid disks */ if (mddev->pers->check_reshape == NULL) return -EINVAL; if (mddev->ro) return -EROFS; if (raid_disks <= 0 || (mddev->max_disks && raid_disks >= mddev->max_disks)) return -EINVAL; if (mddev->sync_thread || test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || mddev->reshape_position != MaxSector) return -EBUSY; rdev_for_each(rdev, mddev) { if (mddev->raid_disks < raid_disks && rdev->data_offset < rdev->new_data_offset) return -EINVAL; if (mddev->raid_disks > raid_disks && rdev->data_offset > rdev->new_data_offset) return -EINVAL; } mddev->delta_disks = raid_disks - mddev->raid_disks; if (mddev->delta_disks < 0) mddev->reshape_backwards = 1; else if (mddev->delta_disks > 0) mddev->reshape_backwards = 0; rv = mddev->pers->check_reshape(mddev); if (rv < 0) { mddev->delta_disks = 0; mddev->reshape_backwards = 0; } return rv; } ",0 "void UsbTabHelper::GetChooserService( content::RenderFrameHost* render_frame_host, mojo::InterfaceRequest request) { FrameUsbServices* frame_usb_services = GetFrameUsbService(render_frame_host); if (!frame_usb_services->chooser_service) { frame_usb_services->chooser_service.reset( #if defined(OS_ANDROID) new WebUsbChooserServiceAndroid(render_frame_host)); #else new WebUsbChooserServiceDesktop(render_frame_host)); #endif // defined(OS_ANDROID) } frame_usb_services->chooser_service->Bind(std::move(request)); } ",0 "static int piv_restore_security_env(sc_card_t *card, int se_num) { LOG_FUNC_CALLED(card->ctx); LOG_FUNC_RETURN(card->ctx, SC_SUCCESS); } ",0 "EditorClient& Editor::client() const { if (Page* page = frame().page()) return page->editorClient(); return emptyEditorClient(); } ",0 "MagickExport MagickBooleanType SetQuantumEndian(const Image *image, QuantumInfo *quantum_info,const EndianType endian) { assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickSignature); quantum_info->endian=endian; return(SetQuantumDepth(image,quantum_info,quantum_info->depth)); } ",0 "void ContextState::UpdateWindowRectangles() const { if (!feature_info_->feature_flags().ext_window_rectangles) { return; } if (current_draw_framebuffer_client_id == 0) { api()->glWindowRectanglesEXTFn(GL_EXCLUSIVE_EXT, 0, nullptr); } else { DCHECK_LE(static_cast(num_window_rectangles), GetMaxWindowRectangles()); const GLint* data = num_window_rectangles ? window_rectangles_.data() : nullptr; api()->glWindowRectanglesEXTFn(window_rectangles_mode, num_window_rectangles, data); } } ",0 "static void remote_device_properties_callback(bt_status_t status, bt_bdaddr_t *bd_addr, int num_properties, bt_property_t *properties) { if (!checkCallbackThread()) { ALOGE(""Callback: '%s' is not called on the correct thread"", __FUNCTION__); return; } ALOGV(""%s: Status is: %d, Properties: %d"", __FUNCTION__, status, num_properties); if (status != BT_STATUS_SUCCESS) { ALOGE(""%s: Status %d is incorrect"", __FUNCTION__, status); return; } callbackEnv->PushLocalFrame(ADDITIONAL_NREFS); jobjectArray props; jbyteArray addr; jintArray types; jbyteArray val; jclass mclass; val = (jbyteArray) callbackEnv->NewByteArray(num_properties); if (val == NULL) { ALOGE(""%s: Error allocating byteArray"", __FUNCTION__); return; } mclass = callbackEnv->GetObjectClass(val); /* Initialize the jobjectArray and jintArray here itself and send the initialized array pointers alone to get_properties */ props = callbackEnv->NewObjectArray(num_properties, mclass, NULL); if (props == NULL) { ALOGE(""%s: Error allocating object Array for properties"", __FUNCTION__); return; } types = (jintArray)callbackEnv->NewIntArray(num_properties); if (types == NULL) { ALOGE(""%s: Error allocating int Array for values"", __FUNCTION__); return; } callbackEnv->DeleteLocalRef(mclass); callbackEnv->DeleteLocalRef(val); addr = callbackEnv->NewByteArray(sizeof(bt_bdaddr_t)); if (addr == NULL) goto Fail; if (addr) callbackEnv->SetByteArrayRegion(addr, 0, sizeof(bt_bdaddr_t), (jbyte*)bd_addr); if (get_properties(num_properties, properties, &types, &props) < 0) { if (props) callbackEnv->DeleteLocalRef(props); if (types) callbackEnv->DeleteLocalRef(types); callbackEnv->PopLocalFrame(NULL); return; } callbackEnv->CallVoidMethod(sJniCallbacksObj, method_devicePropertyChangedCallback, addr, types, props); checkAndClearExceptionFromCallback(callbackEnv, __FUNCTION__); callbackEnv->DeleteLocalRef(props); callbackEnv->DeleteLocalRef(types); callbackEnv->DeleteLocalRef(addr); callbackEnv->PopLocalFrame(NULL); return; Fail: ALOGE(""Error while allocation byte array in %s"", __FUNCTION__); } ",0 "void LayerTreeHostImpl::DidFinishImplFrame() { current_begin_frame_tracker_.Finish(); decoded_image_tracker_.NotifyFrameFinished(); } ",0 "static int __init setup_slub_debug(char *str) { slub_debug = DEBUG_DEFAULT_FLAGS; if (*str++ != '=' || !*str) /* * No options specified. Switch on full debugging. */ goto out; if (*str == ',') /* * No options but restriction on slabs. This means full * debugging for slabs matching a pattern. */ goto check_slabs; slub_debug = 0; if (*str == '-') /* * Switch off all debugging measures. */ goto out; /* * Determine which debug features should be switched on */ for (; *str && *str != ','; str++) { switch (tolower(*str)) { case 'f': slub_debug |= SLAB_DEBUG_FREE; break; case 'z': slub_debug |= SLAB_RED_ZONE; break; case 'p': slub_debug |= SLAB_POISON; break; case 'u': slub_debug |= SLAB_STORE_USER; break; case 't': slub_debug |= SLAB_TRACE; break; default: printk(KERN_ERR ""slub_debug option '%c' "" ""unknown. skipped\n"", *str); } } check_slabs: if (*str == ',') slub_debug_slabs = str + 1; out: return 1; } ",0 "void reset_phy(void) { char *name = ""egiga0""; unsigned short reg; if (miiphy_set_current_dev(name)) return; /* RGMII clk transition on data stable */ if (miiphy_read(name, CONFIG_PHY_BASE_ADR, PHY_SPEC_CTRL_REG, ®)) printf(""Error reading PHY spec ctrl reg\n""); if (miiphy_write(name, CONFIG_PHY_BASE_ADR, PHY_SPEC_CTRL_REG, reg | PHY_RGMII_CLK_STABLE | PHY_CLSA)) printf(""Error writing PHY spec ctrl reg\n""); /* leds setup */ if (miiphy_write(name, CONFIG_PHY_BASE_ADR, PHY_LED_SEL_REG, PHY_LED0_LINK | PHY_LED1_ACT | PHY_LED2_INT)) printf(""Error writing PHY LED reg\n""); /* reset the phy */ miiphy_reset(name, CONFIG_PHY_BASE_ADR); } ",0 "static int nntp_hcache_namer(const char *path, char *dest, size_t destlen) { return snprintf(dest, destlen, ""%s.hcache"", path); } ",0 "int sr_get_mcn(struct cdrom_device_info *cdi, struct cdrom_mcn *mcn) { Scsi_CD *cd = cdi->handle; struct packet_command cgc; char *buffer = kmalloc(32, GFP_KERNEL | SR_GFP_DMA(cd)); int result; if (!buffer) return -ENOMEM; memset(&cgc, 0, sizeof(struct packet_command)); cgc.cmd[0] = GPCMD_READ_SUBCHANNEL; cgc.cmd[2] = 0x40; /* I do want the subchannel info */ cgc.cmd[3] = 0x02; /* Give me medium catalog number info */ cgc.cmd[8] = 24; cgc.buffer = buffer; cgc.buflen = 24; cgc.data_direction = DMA_FROM_DEVICE; cgc.timeout = IOCTL_TIMEOUT; result = sr_do_ioctl(cd, &cgc); memcpy(mcn->medium_catalog_number, buffer + 9, 13); mcn->medium_catalog_number[13] = 0; kfree(buffer); return result; } ",0 "void PrintToPdfCallback(Metafile* metafile, const FilePath& path) { metafile->SaveTo(path); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&base::DeletePointer, metafile)); } ",0 "static void ims_pcu_destroy_application_mode(struct ims_pcu *pcu) { if (pcu->setup_complete) { pcu->setup_complete = false; mb(); /* make sure flag setting is not reordered */ if (pcu->gamepad) ims_pcu_destroy_gamepad(pcu); ims_pcu_destroy_buttons(pcu); ims_pcu_destroy_backlight(pcu); if (pcu->device_id != IMS_PCU_PCU_B_DEVICE_ID) sysfs_remove_group(&pcu->dev->kobj, &ims_pcu_ofn_attr_group); } } ",0 "static int blk_mq_queue_reinit_notify(struct notifier_block *nb, unsigned long action, void *hcpu) { struct request_queue *q; /* * Before new mappings are established, hotadded cpu might already * start handling requests. This doesn't break anything as we map * offline CPUs to first hardware queue. We will re-init the queue * below to get optimal settings. */ if (action != CPU_DEAD && action != CPU_DEAD_FROZEN && action != CPU_ONLINE && action != CPU_ONLINE_FROZEN) return NOTIFY_OK; mutex_lock(&all_q_mutex); /* * We need to freeze and reinit all existing queues. Freezing * involves synchronous wait for an RCU grace period and doing it * one by one may take a long time. Start freezing all queues in * one swoop and then wait for the completions so that freezing can * take place in parallel. */ list_for_each_entry(q, &all_q_list, all_q_node) blk_mq_freeze_queue_start(q); list_for_each_entry(q, &all_q_list, all_q_node) { blk_mq_freeze_queue_wait(q); /* * timeout handler can't touch hw queue during the * reinitialization */ del_timer_sync(&q->timeout); } list_for_each_entry(q, &all_q_list, all_q_node) blk_mq_queue_reinit(q); list_for_each_entry(q, &all_q_list, all_q_node) blk_mq_unfreeze_queue(q); mutex_unlock(&all_q_mutex); return NOTIFY_OK; } ",0 "WebContentsImpl* WebContentsImpl::GetFocusedWebContents() { return GetOutermostWebContents()->node_.focused_web_contents(); } ",0 "static void cassignop(JF, js_Ast *exp, int opcode) { js_Ast *lhs = exp->a; js_Ast *rhs = exp->b; cassignop1(J, F, lhs); cexp(J, F, rhs); emitline(J, F, exp); emit(J, F, opcode); cassignop2(J, F, lhs, 0); } ",0 "static void hns_gmac_get_pausefrm_cfg(void *mac_drv, u32 *rx_pause_en, u32 *tx_pause_en) { u32 pause_en; struct mac_driver *drv = (struct mac_driver *)mac_drv; pause_en = dsaf_read_dev(drv, GMAC_PAUSE_EN_REG); *rx_pause_en = dsaf_get_bit(pause_en, GMAC_PAUSE_EN_RX_FDFC_B); *tx_pause_en = dsaf_get_bit(pause_en, GMAC_PAUSE_EN_TX_FDFC_B); } ",0 "kadm5_rename_principal(void *server_handle, krb5_principal source, krb5_principal target) { krb5_db_entry *kdb; osa_princ_ent_rec adb; krb5_error_code ret; kadm5_server_handle_t handle = server_handle; krb5_int16 stype, i; krb5_data *salt = NULL; CHECK_HANDLE(server_handle); krb5_clear_error_message(handle->context); if (source == NULL || target == NULL) return EINVAL; if ((ret = kdb_get_entry(handle, target, &kdb, &adb)) == 0) { kdb_free_entry(handle, kdb, &adb); return(KADM5_DUP); } if ((ret = kdb_get_entry(handle, source, &kdb, &adb))) return ret; /* Transform salts as necessary. */ for (i = 0; i < kdb->n_key_data; i++) { ret = krb5_dbe_compute_salt(handle->context, &kdb->key_data[i], kdb->princ, &stype, &salt); if (ret == KRB5_KDB_BAD_SALTTYPE) ret = KADM5_NO_RENAME_SALT; if (ret) goto done; kdb->key_data[i].key_data_type[1] = KRB5_KDB_SALTTYPE_SPECIAL; free(kdb->key_data[i].key_data_contents[1]); kdb->key_data[i].key_data_contents[1] = (krb5_octet *)salt->data; kdb->key_data[i].key_data_length[1] = salt->length; kdb->key_data[i].key_data_ver = 2; free(salt); salt = NULL; } kadm5_free_principal(handle->context, kdb->princ); ret = kadm5_copy_principal(handle->context, target, &kdb->princ); if (ret) { kdb->princ = NULL; /* so freeing the dbe doesn't lose */ goto done; } if ((ret = kdb_put_entry(handle, kdb, &adb))) goto done; ret = kdb_delete_entry(handle, source); done: krb5_free_data(handle->context, salt); kdb_free_entry(handle, kdb, &adb); return ret; } ",0 "static unsigned long mem_cgroup_read_events(struct mem_cgroup *memcg, enum mem_cgroup_events_index idx) { unsigned long val = 0; int cpu; for_each_online_cpu(cpu) val += per_cpu(memcg->stat->events[idx], cpu); #ifdef CONFIG_HOTPLUG_CPU spin_lock(&memcg->pcp_counter_lock); val += memcg->nocpu_base.events[idx]; spin_unlock(&memcg->pcp_counter_lock); #endif return val; } ",0 "bool Framebuffer::IsCleared() const { for (AttachmentMap::const_iterator it = attachments_.begin(); it != attachments_.end(); ++it) { Attachment* attachment = it->second.get(); if (!attachment->cleared()) { return false; } } return true; } ",0 "static void cm_format_sidr_req_event(struct cm_work *work, struct ib_cm_id *listen_id) { struct cm_sidr_req_msg *sidr_req_msg; struct ib_cm_sidr_req_event_param *param; sidr_req_msg = (struct cm_sidr_req_msg *) work->mad_recv_wc->recv_buf.mad; param = &work->cm_event.param.sidr_req_rcvd; param->pkey = __be16_to_cpu(sidr_req_msg->pkey); param->listen_id = listen_id; param->port = work->port->port_num; work->cm_event.private_data = &sidr_req_msg->private_data; } ",0 "int git_pkt_parse_line( git_pkt **head, const char *line, const char **out, size_t bufflen) { int ret; int32_t len; /* Not even enough for the length */ if (bufflen > 0 && bufflen < PKT_LEN_SIZE) return GIT_EBUFS; len = parse_len(line); if (len < 0) { /* * If we fail to parse the length, it might be because the * server is trying to send us the packfile already. */ if (bufflen >= 4 && !git__prefixcmp(line, ""PACK"")) { giterr_clear(); *out = line; return pack_pkt(head); } return (int)len; } /* * If we were given a buffer length, then make sure there is * enough in the buffer to satisfy this line */ if (bufflen > 0 && bufflen < (size_t)len) return GIT_EBUFS; /* * The length has to be exactly 0 in case of a flush * packet or greater than PKT_LEN_SIZE, as the decoded * length includes its own encoded length of four bytes. */ if (len != 0 && len < PKT_LEN_SIZE) return GIT_ERROR; line += PKT_LEN_SIZE; /* * TODO: How do we deal with empty lines? Try again? with the next * line? */ if (len == PKT_LEN_SIZE) { *head = NULL; *out = line; return 0; } if (len == 0) { /* Flush pkt */ *out = line; return flush_pkt(head); } len -= PKT_LEN_SIZE; /* the encoded length includes its own size */ if (*line == GIT_SIDE_BAND_DATA) ret = data_pkt(head, line, len); else if (*line == GIT_SIDE_BAND_PROGRESS) ret = sideband_progress_pkt(head, line, len); else if (*line == GIT_SIDE_BAND_ERROR) ret = sideband_error_pkt(head, line, len); else if (!git__prefixcmp(line, ""ACK"")) ret = ack_pkt(head, line, len); else if (!git__prefixcmp(line, ""NAK"")) ret = nak_pkt(head); else if (!git__prefixcmp(line, ""ERR "")) ret = err_pkt(head, line, len); else if (*line == '#') ret = comment_pkt(head, line, len); else if (!git__prefixcmp(line, ""ok"")) ret = ok_pkt(head, line, len); else if (!git__prefixcmp(line, ""ng"")) ret = ng_pkt(head, line, len); else if (!git__prefixcmp(line, ""unpack"")) ret = unpack_pkt(head, line, len); else ret = ref_pkt(head, line, len); *out = line + len; return ret; } ",1 " void AllowState(LifecycleUnitState allowed_state) { allowed_states_.insert(allowed_state); } ",0 "void GLES2DecoderImpl::DoSwapBuffers(uint64_t swap_id, GLbitfield flags) { bool is_offscreen = !!offscreen_target_frame_buffer_.get(); int this_frame_number = frame_number_++; TRACE_EVENT_INSTANT2( ""test_gpu"", ""SwapBuffersLatency"", TRACE_EVENT_SCOPE_THREAD, ""GLImpl"", static_cast(gl::GetGLImplementation()), ""width"", (is_offscreen ? offscreen_size_.width() : surface_->GetSize().width())); TRACE_EVENT2(""gpu"", ""GLES2DecoderImpl::DoSwapBuffers"", ""offscreen"", is_offscreen, ""frame"", this_frame_number); ScopedGPUTrace scoped_gpu_trace(gpu_tracer_.get(), kTraceDecoder, ""GLES2Decoder"", ""SwapBuffer""); bool is_tracing; TRACE_EVENT_CATEGORY_GROUP_ENABLED(TRACE_DISABLED_BY_DEFAULT(""gpu.debug""), &is_tracing); if (is_tracing) { ScopedFramebufferBinder binder(this, GetBoundDrawFramebufferServiceId()); gpu_state_tracer_->TakeSnapshotWithCurrentFramebuffer( is_offscreen ? offscreen_size_ : surface_->GetSize()); } ClearScheduleCALayerState(); if (is_offscreen) { TRACE_EVENT2(""gpu"", ""Offscreen"", ""width"", offscreen_size_.width(), ""height"", offscreen_size_.height()); if (offscreen_single_buffer_) return; if (offscreen_size_ != offscreen_saved_color_texture_->size()) { if (workarounds().needs_offscreen_buffer_workaround) { offscreen_saved_frame_buffer_->Create(); api()->glFinishFn(); } ReleaseNotInUseBackTextures(); DCHECK(offscreen_saved_color_format_); offscreen_saved_color_texture_->AllocateStorage( offscreen_size_, offscreen_saved_color_format_, false); offscreen_saved_frame_buffer_->AttachRenderTexture( offscreen_saved_color_texture_.get()); if (offscreen_size_.width() != 0 && offscreen_size_.height() != 0) { if (offscreen_saved_frame_buffer_->CheckStatus() != GL_FRAMEBUFFER_COMPLETE) { LOG(ERROR) << ""GLES2DecoderImpl::ResizeOffscreenFramebuffer failed "" << ""because offscreen saved FBO was incomplete.""; MarkContextLost(error::kUnknown); group_->LoseContexts(error::kUnknown); return; } { ScopedFramebufferBinder binder(this, offscreen_saved_frame_buffer_->id()); api()->glClearColorFn(0, 0, 0, BackBufferAlphaClearColor()); state_.SetDeviceColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); ClearDeviceWindowRectangles(); api()->glClearFn(GL_COLOR_BUFFER_BIT); RestoreClearState(); } } } if (offscreen_size_.width() == 0 || offscreen_size_.height() == 0) return; ScopedGLErrorSuppressor suppressor(""GLES2DecoderImpl::DoSwapBuffers"", error_state_.get()); if (IsOffscreenBufferMultisampled()) { ScopedResolvedFramebufferBinder binder(this, true, false); } else { ScopedFramebufferBinder binder(this, offscreen_target_frame_buffer_->id()); if (offscreen_target_buffer_preserved_) { offscreen_saved_color_texture_->Copy(); } else { offscreen_saved_color_texture_.swap(offscreen_target_color_texture_); offscreen_target_frame_buffer_->AttachRenderTexture( offscreen_target_color_texture_.get()); offscreen_saved_frame_buffer_->AttachRenderTexture( offscreen_saved_color_texture_.get()); } if (!gl_version_info().is_angle) api()->glFlushFn(); } } else if (supports_async_swap_) { TRACE_EVENT_ASYNC_BEGIN0(""gpu"", ""AsyncSwapBuffers"", swap_id); client()->OnSwapBuffers(swap_id, flags); surface_->SwapBuffersAsync( base::BindOnce(&GLES2DecoderImpl::FinishAsyncSwapBuffers, weak_ptr_factory_.GetWeakPtr(), swap_id), base::DoNothing()); } else { client()->OnSwapBuffers(swap_id, flags); FinishSwapBuffers(surface_->SwapBuffers(base::DoNothing())); } ExitCommandProcessingEarly(); } ",0 " InputMethodIBus* input_method() const { return input_method_; } ",0 "void ShellContentUtilityClient::RegisterNetworkBinders( service_manager::BinderRegistry* registry) { network_service_test_helper_->RegisterNetworkBinders(registry); } ",0 "venc_dev::venc_dev(class omx_venc *venc_class) { int i = 0; venc_handle = venc_class; etb = ebd = ftb = fbd = 0; for (i = 0; i < MAX_PORT; i++) streaming[i] = false; stopped = 1; paused = false; async_thread_created = false; color_format = 0; hw_overload = false; pthread_mutex_init(&pause_resume_mlock, NULL); pthread_cond_init(&pause_resume_cond, NULL); memset(&extradata_info, 0, sizeof(extradata_info)); memset(&idrperiod, 0, sizeof(idrperiod)); memset(&multislice, 0, sizeof(multislice)); memset (&slice_mode, 0 , sizeof(slice_mode)); memset(&m_sVenc_cfg, 0, sizeof(m_sVenc_cfg)); memset(&rate_ctrl, 0, sizeof(rate_ctrl)); memset(&bitrate, 0, sizeof(bitrate)); memset(&intra_period, 0, sizeof(intra_period)); memset(&codec_profile, 0, sizeof(codec_profile)); memset(&set_param, 0, sizeof(set_param)); memset(&time_inc, 0, sizeof(time_inc)); memset(&m_sInput_buff_property, 0, sizeof(m_sInput_buff_property)); memset(&m_sOutput_buff_property, 0, sizeof(m_sOutput_buff_property)); memset(&session_qp, 0, sizeof(session_qp)); memset(&entropy, 0, sizeof(entropy)); memset(&dbkfilter, 0, sizeof(dbkfilter)); memset(&intra_refresh, 0, sizeof(intra_refresh)); memset(&hec, 0, sizeof(hec)); memset(&voptimecfg, 0, sizeof(voptimecfg)); memset(&capability, 0, sizeof(capability)); memset(&m_debug,0,sizeof(m_debug)); memset(&hier_layers,0,sizeof(hier_layers)); is_searchrange_set = false; enable_mv_narrow_searchrange = false; supported_rc_modes = RC_ALL; camera_mode_enabled = false; memset(<rinfo, 0, sizeof(ltrinfo)); sess_priority.priority = 1; operating_rate = 0; char property_value[PROPERTY_VALUE_MAX] = {0}; property_get(""vidc.enc.log.in"", property_value, ""0""); m_debug.in_buffer_log = atoi(property_value); property_get(""vidc.enc.log.out"", property_value, ""0""); m_debug.out_buffer_log = atoi(property_value); property_get(""vidc.enc.log.extradata"", property_value, ""0""); m_debug.extradata_log = atoi(property_value); snprintf(m_debug.log_loc, PROPERTY_VALUE_MAX, ""%s"", BUFFER_LOG_LOC); } ",0 "RenderFrameImpl* RenderFrameImpl::FromWebFrame(blink::WebFrame* web_frame) { FrameMap::iterator iter = g_frame_map.Get().find(web_frame); if (iter != g_frame_map.Get().end()) return iter->second; return nullptr; } ",0 "bool RenderMenuList::itemIsEnabled(unsigned listIndex) const { const Vector& listItems = toHTMLSelectElement(node())->listItems(); if (listIndex >= listItems.size()) return false; HTMLElement* element = listItems[listIndex]; if (!element->hasTagName(optionTag)) return false; bool groupEnabled = true; if (Element* parentElement = element->parentElement()) { if (parentElement->hasTagName(optgroupTag)) groupEnabled = !static_cast(parentElement)->disabled(); } if (!groupEnabled) return false; return element->isEnabledFormControl(); } ",0 "ChildURLLoaderFactoryBundle* RenderFrameImpl::GetLoaderFactoryBundle() { if (!loader_factories_) { RenderFrameImpl* creator = RenderFrameImpl::FromWebFrame( frame_->Parent() ? frame_->Parent() : frame_->Opener()); if (creator) { auto bundle_info = base::WrapUnique(static_cast( creator->GetLoaderFactoryBundle()->Clone().release())); loader_factories_ = base::MakeRefCounted( std::move(bundle_info)); } else { SetupLoaderFactoryBundle(nullptr, base::nullopt /* subresource_overrides */, nullptr /* prefetch_loader_factory */); } } return loader_factories_.get(); } ",0 "PHP_FUNCTION(unlink) { char *filename; int filename_len; php_stream_wrapper *wrapper; zval *zcontext = NULL; php_stream_context *context = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""p|r"", &filename, &filename_len, &zcontext) == FAILURE) { RETURN_FALSE; } context = php_stream_context_from_zval(zcontext, 0); wrapper = php_stream_locate_url_wrapper(filename, NULL, 0 TSRMLS_CC); if (!wrapper || !wrapper->wops) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to locate stream wrapper""); RETURN_FALSE; } if (!wrapper->wops->unlink) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""%s does not allow unlinking"", wrapper->wops->label ? wrapper->wops->label : ""Wrapper""); RETURN_FALSE; } RETURN_BOOL(wrapper->wops->unlink(wrapper, filename, REPORT_ERRORS, context TSRMLS_CC)); } ",0 "void HTMLInputElement::AppendToFormData(FormData& form_data) { if (input_type_->IsFormDataAppendable()) input_type_->AppendToFormData(form_data); } ",0 "void HTMLFormControlElement::DidChangeForm() { ListedElement::DidChangeForm(); if (formOwner() && isConnected() && CanBeSuccessfulSubmitButton()) formOwner()->InvalidateDefaultButtonStyle(); } ",0 "static int ebb_set(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, const void *kbuf, const void __user *ubuf) { int ret = 0; /* Build tests */ BUILD_BUG_ON(TSO(ebbrr) + sizeof(unsigned long) != TSO(ebbhr)); BUILD_BUG_ON(TSO(ebbhr) + sizeof(unsigned long) != TSO(bescr)); if (!cpu_has_feature(CPU_FTR_ARCH_207S)) return -ENODEV; if (target->thread.used_ebb) return -ENODATA; ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.ebbrr, 0, sizeof(unsigned long)); if (!ret) ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.ebbhr, sizeof(unsigned long), 2 * sizeof(unsigned long)); if (!ret) ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &target->thread.bescr, 2 * sizeof(unsigned long), 3 * sizeof(unsigned long)); return ret; } ",0 "static NavigationPolicy MaybeCheckCSP( const ResourceRequest& request, NavigationType type, LocalFrame* frame, NavigationPolicy policy, bool should_check_main_world_content_security_policy, ContentSecurityPolicy::CheckHeaderType check_header_type) { return policy; } ",0 "static void fcrypt_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { const struct fcrypt_ctx *ctx = crypto_tfm_ctx(tfm); struct { __be32 l, r; } X; memcpy(&X, src, sizeof(X)); F_ENCRYPT(X.l, X.r, ctx->sched[0xf]); F_ENCRYPT(X.r, X.l, ctx->sched[0xe]); F_ENCRYPT(X.l, X.r, ctx->sched[0xd]); F_ENCRYPT(X.r, X.l, ctx->sched[0xc]); F_ENCRYPT(X.l, X.r, ctx->sched[0xb]); F_ENCRYPT(X.r, X.l, ctx->sched[0xa]); F_ENCRYPT(X.l, X.r, ctx->sched[0x9]); F_ENCRYPT(X.r, X.l, ctx->sched[0x8]); F_ENCRYPT(X.l, X.r, ctx->sched[0x7]); F_ENCRYPT(X.r, X.l, ctx->sched[0x6]); F_ENCRYPT(X.l, X.r, ctx->sched[0x5]); F_ENCRYPT(X.r, X.l, ctx->sched[0x4]); F_ENCRYPT(X.l, X.r, ctx->sched[0x3]); F_ENCRYPT(X.r, X.l, ctx->sched[0x2]); F_ENCRYPT(X.l, X.r, ctx->sched[0x1]); F_ENCRYPT(X.r, X.l, ctx->sched[0x0]); memcpy(dst, &X, sizeof(X)); } ",0 "next_bss_le(struct brcmf_scan_results *list, struct brcmf_bss_info_le *bss) { if (bss == NULL) return list->bss_info_le; return (struct brcmf_bss_info_le *)((unsigned long)bss + le32_to_cpu(bss->length)); } ",0 "static int copy_stack_state(struct bpf_verifier_state *dst, const struct bpf_verifier_state *src) { if (!src->stack) return 0; if (WARN_ON_ONCE(dst->allocated_stack < src->allocated_stack)) { /* internal bug, make state invalid to reject the program */ memset(dst, 0, sizeof(*dst)); return -EFAULT; } memcpy(dst->stack, src->stack, sizeof(*src->stack) * (src->allocated_stack / BPF_REG_SIZE)); return 0; } ",0 "int btrfs_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags) { struct btrfs_root *root = BTRFS_I(dentry->d_inode)->root; /* * The permission on security.* and system.* is not checked * in permission(). */ if (btrfs_root_readonly(root)) return -EROFS; /* * If this is a request for a synthetic attribute in the system.* * namespace use the generic infrastructure to resolve a handler * for it via sb->s_xattr. */ if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) return generic_setxattr(dentry, name, value, size, flags); if (!btrfs_is_valid_xattr(name)) return -EOPNOTSUPP; if (!strncmp(name, XATTR_BTRFS_PREFIX, XATTR_BTRFS_PREFIX_LEN)) return btrfs_set_prop(dentry->d_inode, name, value, size, flags); if (size == 0) value = """"; /* empty EA, do not remove */ return __btrfs_setxattr(NULL, dentry->d_inode, name, value, size, flags); } ",0 "__always_inline long __get_user_pages_unlocked(struct task_struct *tsk, struct mm_struct *mm, unsigned long start, unsigned long nr_pages, int write, int force, struct page **pages, unsigned int gup_flags) { long ret; int locked = 1; down_read(&mm->mmap_sem); ret = __get_user_pages_locked(tsk, mm, start, nr_pages, write, force, pages, NULL, &locked, false, gup_flags); if (locked) up_read(&mm->mmap_sem); return ret; } ",0 "bool VaapiVideoDecodeAccelerator::CanDecodeOnIOThread() { return false; } ",0 "void BookmarksExportFunction::FileSelected(const base::FilePath& path, int index, void* params) { #if !defined(OS_ANDROID) bookmark_html_writer::WriteBookmarks(profile(), path, NULL); #endif Release(); // Balanced in BookmarksIOFunction::SelectFile() } ",0 "static struct hlist_head *rds_conn_bucket(__be32 laddr, __be32 faddr) { static u32 rds_hash_secret __read_mostly; unsigned long hash; net_get_random_once(&rds_hash_secret, sizeof(rds_hash_secret)); /* Pass NULL, don't need struct net for hash */ hash = __inet_ehashfn(be32_to_cpu(laddr), 0, be32_to_cpu(faddr), 0, rds_hash_secret); return &rds_conn_hash[hash & RDS_CONNECTION_HASH_MASK]; } ",0 "void NuPlayer::GenericSource::fetchTextData( uint32_t sendWhat, media_track_type type, int32_t curGen, sp packets, sp msg) { int32_t msgGeneration; CHECK(msg->findInt32(""generation"", &msgGeneration)); if (msgGeneration != curGen) { return; } int32_t avail; if (packets->hasBufferAvailable(&avail)) { return; } int64_t timeUs; CHECK(msg->findInt64(""timeUs"", &timeUs)); int64_t subTimeUs; readBuffer(type, timeUs, &subTimeUs); int64_t delayUs = subTimeUs - timeUs; if (msg->what() == kWhatFetchSubtitleData) { const int64_t oneSecUs = 1000000ll; delayUs -= oneSecUs; } sp msg2 = new AMessage(sendWhat, this); msg2->setInt32(""generation"", msgGeneration); msg2->post(delayUs < 0 ? 0 : delayUs); } ",0 "static void free_arg_pages(struct linux_binprm *bprm) { } ",0 "cpu_to_phys_group(int cpu, const struct cpumask *cpu_map, struct sched_group **sg, struct cpumask *mask) { int group; #ifdef CONFIG_SCHED_BOOK cpumask_and(mask, cpu_book_mask(cpu), cpu_map); group = cpumask_first(mask); #elif defined(CONFIG_SCHED_MC) cpumask_and(mask, cpu_coregroup_mask(cpu), cpu_map); group = cpumask_first(mask); #elif defined(CONFIG_SCHED_SMT) cpumask_and(mask, topology_thread_cpumask(cpu), cpu_map); group = cpumask_first(mask); #else group = cpu; #endif if (sg) *sg = &per_cpu(sched_group_phys, group).sg; return group; } ",0 "void setJSTestObjStringAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast(thisObject); TestObj* impl = static_cast(castedThis->impl()); impl->setStringAttr(ustringToString(value.isEmpty() ? UString() : value.toString(exec)->value(exec))); } ",0 "static inline int tg_has_rt_tasks(struct task_group *tg) { struct task_struct *g, *p; do_each_thread(g, p) { if (rt_task(p) && rt_rq_of_se(&p->rt)->tg == tg) return 1; } while_each_thread(g, p); return 0; } ",0 " bool DisplayItemList::lastDisplayItemIsNoopBegin() const { if (m_newDisplayItems.isEmpty()) return false; const auto& lastDisplayItem = m_newDisplayItems.last(); return lastDisplayItem.isBegin() && !lastDisplayItem.drawsContent(); } ",0 "DSA *d2i_DSA_PUBKEY_bio(BIO *bp, DSA **dsa) { return ASN1_d2i_bio_of(DSA,DSA_new,d2i_DSA_PUBKEY,bp,dsa); } ",0 "static enum skb_state defer_bh(struct usbnet *dev, struct sk_buff *skb, struct sk_buff_head *list, enum skb_state state) { unsigned long flags; enum skb_state old_state; struct skb_data *entry = (struct skb_data *) skb->cb; spin_lock_irqsave(&list->lock, flags); old_state = entry->state; entry->state = state; __skb_unlink(skb, list); /* defer_bh() is never called with list == &dev->done. * spin_lock_nested() tells lockdep that it is OK to take * dev->done.lock here with list->lock held. */ spin_lock_nested(&dev->done.lock, SINGLE_DEPTH_NESTING); __skb_queue_tail(&dev->done, skb); if (dev->done.qlen == 1) tasklet_schedule(&dev->bh); spin_unlock(&dev->done.lock); spin_unlock_irqrestore(&list->lock, flags); return old_state; } ",0 "mm_answer_gss_checkmic(int sock, Buffer *m) { gss_buffer_desc gssbuf, mic; OM_uint32 ret; u_int len; gssbuf.value = buffer_get_string(m, &len); gssbuf.length = len; mic.value = buffer_get_string(m, &len); mic.length = len; ret = ssh_gssapi_checkmic(gsscontext, &gssbuf, &mic); free(gssbuf.value); free(mic.value); buffer_clear(m); buffer_put_int(m, ret); mm_request_send(sock, MONITOR_ANS_GSSCHECKMIC, m); if (!GSS_ERROR(ret)) monitor_permit(mon_dispatch, MONITOR_REQ_GSSUSEROK, 1); return (0); } ",0 "hook_add_to_infolist (struct t_infolist *infolist, const char *arguments) { const char *pos_arguments; char *type; int i, type_int; if (!infolist) return 0; type = NULL; pos_arguments = NULL; if (arguments && arguments[0]) { pos_arguments = strchr (arguments, ','); if (pos_arguments) { type = string_strndup (arguments, pos_arguments - arguments); pos_arguments++; } else type = strdup (arguments); } type_int = (type) ? hook_search_type (type) : -1; for (i = 0; i < HOOK_NUM_TYPES; i++) { if ((type_int < 0) || (type_int == i)) hook_add_to_infolist_type (infolist, i, pos_arguments); } if (type) free (type); return 1; } ",0 "static void echo_char_raw(unsigned char c, struct n_tty_data *ldata) { if (c == ECHO_OP_START) { add_echo_byte(ECHO_OP_START, ldata); add_echo_byte(ECHO_OP_START, ldata); } else { add_echo_byte(c, ldata); } } ",0 "void DevToolsWindow::AddFileSystem() { CHECK(web_contents_->GetURL().SchemeIs(chrome::kChromeDevToolsScheme)); file_helper_->AddFileSystem( base::Bind(&DevToolsWindow::FileSystemAdded, weak_factory_.GetWeakPtr()), base::Bind(&DevToolsWindow::ShowDevToolsConfirmInfoBar, weak_factory_.GetWeakPtr())); } ",0 "xsltParseContentError(xsltStylesheetPtr style, xmlNodePtr node) { if ((style == NULL) || (node == NULL)) return; if (IS_XSLT_ELEM(node)) xsltTransformError(NULL, style, node, ""The XSLT-element '%s' is not allowed at this position.\n"", node->name); else xsltTransformError(NULL, style, node, ""The element '%s' is not allowed at this position.\n"", node->name); style->errors++; } ",0 "static void timeout_doall_arg(SSL_SESSION *s, TIMEOUT_PARAM *p) { if ((p->time == 0) || (p->time > (s->time + s->timeout))) { /* timeout */ /* * The reason we don't call SSL_CTX_remove_session() is to save on * locking overhead */ (void)lh_SSL_SESSION_delete(p->cache, s); SSL_SESSION_list_remove(p->ctx, s); s->not_resumable = 1; if (p->ctx->remove_session_cb != NULL) p->ctx->remove_session_cb(p->ctx, s); SSL_SESSION_free(s); } } ",0 "print_string(char *s, ssize_t len, int dl, const uint8_t *data) { uint8_t c; const uint8_t *e, *p; ssize_t bytes = 0; ssize_t r; e = data + dl; while (data < e) { c = *data++; if (c == '\0') { /* If rest is all NULL, skip it. */ for (p = data; p < e; p++) if (*p != '\0') break; if (p == e) break; } if (!isascii(c) || !isprint(c)) { if (s) { if (len < 5) { errno = ENOBUFS; return -1; } r = snprintf(s, len, ""\\%03o"", c); len -= r; bytes += r; s += r; } else bytes += 4; continue; } switch (c) { case '""': /* FALLTHROUGH */ case '\'': /* FALLTHROUGH */ case '$': /* FALLTHROUGH */ case '`': /* FALLTHROUGH */ case '\\': /* FALLTHROUGH */ case '|': /* FALLTHROUGH */ case '&': if (s) { if (len < 3) { errno = ENOBUFS; return -1; } *s++ = '\\'; len--; } bytes++; break; } if (s) { *s++ = c; len--; } bytes++; } /* NULL */ if (s) *s = '\0'; bytes++; return bytes; } ",0 "static ssize_t srpt_tpg_enable_show(struct config_item *item, char *page) { struct se_portal_group *se_tpg = to_tpg(item); struct srpt_port *sport = container_of(se_tpg, struct srpt_port, port_tpg_1); return snprintf(page, PAGE_SIZE, ""%d\n"", (sport->enabled) ? 1: 0); } ",0 "static void SQLITE_NOINLINE btreeLeaveAll(sqlite3 *db){ int i; Btree *p; assert( sqlite3_mutex_held(db->mutex) ); for(i=0; inDb; i++){ p = db->aDb[i].pBt; if( p ) sqlite3BtreeLeave(p); } } ",0 "void RenderingHelper::PlatformInitialize() {} ",0 "void ih264d_cavlc_parse_chroma_dc(dec_mb_info_t *ps_cur_mb_info, WORD16 *pi2_coeff_block, dec_bit_stream_t *ps_bitstrm, UWORD32 u4_scale_u, UWORD32 u4_scale_v, WORD32 i4_mb_inter_inc) { UWORD32 u4_total_coeff, u4_trailing_ones, u4_total_coeff_tone, u4_code; UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst; const UWORD8 *pu1_cav_chromdc = (const UWORD8*)gau1_ih264d_cav_chromdc_vld; UNUSED(i4_mb_inter_inc); /******************************************************************/ /* Chroma DC Block for U component */ /******************************************************************/ NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 8); u4_code = pu1_cav_chromdc[u4_code]; FLUSHBITS(u4_bitstream_offset, ((u4_code & 0x7) + 1)); ps_bitstrm->u4_ofst = u4_bitstream_offset; u4_total_coeff = (u4_code >> 5); if(u4_total_coeff) { WORD32 i_z0, i_z1, i_z2, i_z3; tu_sblk4x4_coeff_data_t *ps_tu_4x4; dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle; WORD16 ai2_dc_coef[4]; UWORD8 pu1_inv_scan[4] = { 0, 1, 2, 3 }; WORD16 *pi2_coeff_data = (WORD16 *)ps_dec->pv_parse_tu_coeff_data; ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data; u4_trailing_ones = ((u4_code >> 3) & 0x3); u4_total_coeff_tone = (u4_total_coeff << 16) | u4_trailing_ones; ih264d_rest_of_residual_cav_chroma_dc_block(u4_total_coeff_tone, ps_bitstrm); ai2_dc_coef[0] = 0; ai2_dc_coef[1] = 0; ai2_dc_coef[2] = 0; ai2_dc_coef[3] = 0; ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4, ai2_dc_coef, pu1_inv_scan); /*-------------------------------------------------------------------*/ /* Inverse 2x2 transform and scaling of chroma DC */ /*-------------------------------------------------------------------*/ i_z0 = (ai2_dc_coef[0] + ai2_dc_coef[2]); i_z1 = (ai2_dc_coef[0] - ai2_dc_coef[2]); i_z2 = (ai2_dc_coef[1] - ai2_dc_coef[3]); i_z3 = (ai2_dc_coef[1] + ai2_dc_coef[3]); /*-----------------------------------------------------------*/ /* Scaling and storing the values back */ /*-----------------------------------------------------------*/ *pi2_coeff_data++ = ((i_z0 + i_z3) * u4_scale_u) >> 5; *pi2_coeff_data++ = ((i_z0 - i_z3) * u4_scale_u) >> 5; *pi2_coeff_data++ = ((i_z1 + i_z2) * u4_scale_u) >> 5; *pi2_coeff_data++ = ((i_z1 - i_z2) * u4_scale_u) >> 5; ps_dec->pv_parse_tu_coeff_data = (void *)pi2_coeff_data; SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag,1); } /******************************************************************/ /* Chroma DC Block for V component */ /******************************************************************/ pi2_coeff_block += 64; u4_bitstream_offset = ps_bitstrm->u4_ofst; NEXTBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 8); u4_code = pu1_cav_chromdc[u4_code]; FLUSHBITS(u4_bitstream_offset, ((u4_code & 0x7) + 1)); ps_bitstrm->u4_ofst = u4_bitstream_offset; u4_total_coeff = (u4_code >> 5); if(u4_total_coeff) { WORD32 i_z0, i_z1, i_z2, i_z3; tu_sblk4x4_coeff_data_t *ps_tu_4x4; dec_struct_t *ps_dec = (dec_struct_t *)ps_bitstrm->pv_codec_handle; WORD16 ai2_dc_coef[4]; UWORD8 pu1_inv_scan[4] = { 0, 1, 2, 3 }; WORD16 *pi2_coeff_data = (WORD16 *)ps_dec->pv_parse_tu_coeff_data; ps_tu_4x4 = (tu_sblk4x4_coeff_data_t *)ps_dec->pv_parse_tu_coeff_data; u4_trailing_ones = ((u4_code >> 3) & 0x3); u4_total_coeff_tone = (u4_total_coeff << 16) | u4_trailing_ones; ih264d_rest_of_residual_cav_chroma_dc_block(u4_total_coeff_tone, ps_bitstrm); ai2_dc_coef[0] = 0; ai2_dc_coef[1] = 0; ai2_dc_coef[2] = 0; ai2_dc_coef[3] = 0; ih264d_unpack_coeff4x4_dc_4x4blk(ps_tu_4x4, ai2_dc_coef, pu1_inv_scan); /*-------------------------------------------------------------------*/ /* Inverse 2x2 transform and scaling of chroma DC */ /*-------------------------------------------------------------------*/ i_z0 = (ai2_dc_coef[0] + ai2_dc_coef[2]); i_z1 = (ai2_dc_coef[0] - ai2_dc_coef[2]); i_z2 = (ai2_dc_coef[1] - ai2_dc_coef[3]); i_z3 = (ai2_dc_coef[1] + ai2_dc_coef[3]); /*-----------------------------------------------------------*/ /* Scaling and storing the values back */ /*-----------------------------------------------------------*/ *pi2_coeff_data++ = ((i_z0 + i_z3) * u4_scale_v) >> 5; *pi2_coeff_data++ = ((i_z0 - i_z3) * u4_scale_v) >> 5; *pi2_coeff_data++ = ((i_z1 + i_z2) * u4_scale_v) >> 5; *pi2_coeff_data++ = ((i_z1 - i_z2) * u4_scale_v) >> 5; ps_dec->pv_parse_tu_coeff_data = (void *)pi2_coeff_data; SET_BIT(ps_cur_mb_info->u1_yuv_dc_block_flag,2); } } ",0 "exsltFuncFunctionFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr oldResult, ret; exsltFuncData *data; exsltFuncFunctionData *func; xmlNodePtr paramNode, oldInsert, fake; int oldBase; xsltStackElemPtr params = NULL, param; xsltTransformContextPtr tctxt = xsltXPathGetTransformContext(ctxt); int i, notSet; struct objChain { struct objChain *next; xmlXPathObjectPtr obj; }; struct objChain *savedObjChain = NULL, *savedObj; /* * retrieve func:function template */ data = (exsltFuncData *) xsltGetExtData (tctxt, EXSLT_FUNCTIONS_NAMESPACE); oldResult = data->result; data->result = NULL; func = (exsltFuncFunctionData*) xmlHashLookup2 (data->funcs, ctxt->context->functionURI, ctxt->context->function); /* * params handling */ if (nargs > func->nargs) { xsltGenericError(xsltGenericErrorContext, ""{%s}%s: called with too many arguments\n"", ctxt->context->functionURI, ctxt->context->function); ctxt->error = XPATH_INVALID_ARITY; return; } if (func->content != NULL) { paramNode = func->content->prev; } else paramNode = NULL; if ((paramNode == NULL) && (func->nargs != 0)) { xsltGenericError(xsltGenericErrorContext, ""exsltFuncFunctionFunction: nargs != 0 and "" ""param == NULL\n""); return; } if (tctxt->funcLevel > MAX_FUNC_RECURSION) { xsltGenericError(xsltGenericErrorContext, ""{%s}%s: detected a recursion\n"", ctxt->context->functionURI, ctxt->context->function); ctxt->error = XPATH_MEMORY_ERROR; return; } tctxt->funcLevel++; /* * We have a problem with the evaluation of function parameters. * The original library code did not evaluate XPath expressions until * the last moment. After version 1.1.17 of the libxslt, the logic * of other parts of the library was changed, and the evaluation of * XPath expressions within parameters now takes place as soon as the * parameter is parsed/evaluated (xsltParseStylesheetCallerParam). * This means that the parameters need to be evaluated in lexical * order (since a variable is ""in scope"" as soon as it is declared). * However, on entry to this routine, the values (from the caller) are * in reverse order (held on the XPath context variable stack). To * accomplish what is required, I have added code to pop the XPath * objects off of the stack at the beginning and save them, then use * them (in the reverse order) as the params are evaluated. This * requires an xmlMalloc/xmlFree for each param set by the caller, * which is not very nice. There is probably a much better solution * (like change other code to delay the evaluation). */ /* * In order to give the function params and variables a new 'scope' * we change varsBase in the context. */ oldBase = tctxt->varsBase; tctxt->varsBase = tctxt->varsNr; /* If there are any parameters */ if (paramNode != NULL) { /* Fetch the stored argument values from the caller */ for (i = 0; i < nargs; i++) { savedObj = xmlMalloc(sizeof(struct objChain)); savedObj->next = savedObjChain; savedObj->obj = valuePop(ctxt); savedObjChain = savedObj; } /* * Prepare to process params in reverse order. First, go to * the beginning of the param chain. */ for (i = 1; i <= func->nargs; i++) { if (paramNode->prev == NULL) break; paramNode = paramNode->prev; } /* * i has total # params found, nargs is number which are present * as arguments from the caller * Calculate the number of un-set parameters */ notSet = func->nargs - nargs; for (; i > 0; i--) { param = xsltParseStylesheetCallerParam (tctxt, paramNode); if (i > notSet) { /* if parameter value set */ param->computed = 1; if (param->value != NULL) xmlXPathFreeObject(param->value); savedObj = savedObjChain; /* get next val from chain */ param->value = savedObj->obj; savedObjChain = savedObjChain->next; xmlFree(savedObj); } xsltLocalVariablePush(tctxt, param, -1); param->next = params; params = param; paramNode = paramNode->next; } } /* * actual processing */ fake = xmlNewDocNode(tctxt->output, NULL, (const xmlChar *)""fake"", NULL); oldInsert = tctxt->insert; tctxt->insert = fake; xsltApplyOneTemplate (tctxt, xmlXPathGetContextNode(ctxt), func->content, NULL, NULL); xsltLocalVariablePop(tctxt, tctxt->varsBase, -2); tctxt->insert = oldInsert; tctxt->varsBase = oldBase; /* restore original scope */ if (params != NULL) xsltFreeStackElemList(params); if (data->error != 0) goto error; if (data->result != NULL) { ret = data->result; } else ret = xmlXPathNewCString(""""); data->result = oldResult; /* * It is an error if the instantiation of the template results in * the generation of result nodes. */ if (fake->children != NULL) { #ifdef LIBXML_DEBUG_ENABLED xmlDebugDumpNode (stderr, fake, 1); #endif xsltGenericError(xsltGenericErrorContext, ""{%s}%s: cannot write to result tree while "" ""executing a function\n"", ctxt->context->functionURI, ctxt->context->function); xmlFreeNode(fake); goto error; } xmlFreeNode(fake); valuePush(ctxt, ret); error: /* * IMPORTANT: This enables previously tree fragments marked as * being results of a function, to be garbage-collected after * the calling process exits. */ xsltExtensionInstructionResultFinalize(tctxt); tctxt->funcLevel--; } ",1 " Render_Text( int first_glyph ) { FT_F26Dot6 start_x, start_y, step_x, step_y, x, y; int i; const unsigned char* p; start_x = 4; start_y = 32 + size->metrics.y_ppem; step_x = size->metrics.x_ppem + 4; step_y = size->metrics.y_ppem + 10; x = start_x; y = start_y; i = first_glyph; p = Text; while ( i > 0 && *p ) { p++; i--; } while ( *p ) { if ( !( error = LoadChar( FT_Get_Char_Index( face, (unsigned char)*p ), hinted ) ) ) { #ifdef DEBUG if ( i <= first_glyph + 6 ) { LOG(( ""metrics[%02d] = [%x %x]\n"", i, glyph->metrics.horiBearingX, glyph->metrics.horiAdvance )); if ( i == first_glyph + 6 ) LOG(( ""-------------------------\n"" )); } #endif Render_Glyph( x, y ); x += ( glyph->metrics.horiAdvance >> 6 ) + 1; if ( x + size->metrics.x_ppem > bit.width ) { x = start_x; y += step_y; if ( y >= bit.rows ) return FT_Err_Ok; } } else Fail++; i++; p++; } return FT_Err_Ok; } ",0 " bool readDate(v8::Handle* value) { double numberValue; if (!doReadNumber(&numberValue)) return false; *value = v8DateOrNaN(numberValue, isolate()); return true; } ",0 "static int orinoco_ioctl_setport3(struct net_device *dev, struct iw_request_info *info, void *wrqu, char *extra) { struct orinoco_private *priv = ndev_priv(dev); int val = *((int *) extra); int err = 0; unsigned long flags; if (orinoco_lock(priv, &flags) != 0) return -EBUSY; switch (val) { case 0: /* Try to do IEEE ad-hoc mode */ if (!priv->has_ibss) { err = -EINVAL; break; } priv->prefer_port3 = 0; break; case 1: /* Try to do Lucent proprietary ad-hoc mode */ if (!priv->has_port3) { err = -EINVAL; break; } priv->prefer_port3 = 1; break; default: err = -EINVAL; } if (!err) { /* Actually update the mode we are using */ set_port_type(priv); err = -EINPROGRESS; } orinoco_unlock(priv, &flags); return err; } ",0 " TextureManager* texture_manager() { return group_->texture_manager(); } ",0 "base::UnguessableToken LocalFrameClientImpl::GetDevToolsFrameToken() const { return web_frame_->Client()->GetDevToolsFrameToken(); } ",0 "void LoadingPredictor::Shutdown() { DCHECK(!shutdown_); resource_prefetch_predictor_->Shutdown(); shutdown_ = true; } ",0 "json_t *json_false(void) { static json_t the_false = {JSON_FALSE, (size_t)-1}; return &the_false; } ",0 "bool PictureLayer::Update(ResourceUpdateQueue* queue, const OcclusionTracker* occlusion) { update_source_frame_number_ = layer_tree_host()->source_frame_number(); bool updated = Layer::Update(queue, occlusion); bool can_use_lcd_text_changed = UpdateCanUseLCDText(); gfx::Rect visible_layer_rect = gfx::ScaleToEnclosingRect( visible_content_rect(), 1.f / contents_scale_x()); gfx::Size layer_size = paint_properties().bounds; if (last_updated_visible_content_rect_ == visible_content_rect() && recording_source_->GetSize() == layer_size && !can_use_lcd_text_changed && pending_invalidation_.IsEmpty()) { return updated; } TRACE_EVENT1(""cc"", ""PictureLayer::Update"", ""source_frame_number"", layer_tree_host()->source_frame_number()); devtools_instrumentation::ScopedLayerTreeTask update_layer( devtools_instrumentation::kUpdateLayer, id(), layer_tree_host()->id()); pending_invalidation_.Swap(&recording_invalidation_); pending_invalidation_.Clear(); if (layer_tree_host()->settings().record_full_layer) { visible_layer_rect = gfx::Rect(layer_size); } DCHECK(client_); updated |= recording_source_->UpdateAndExpandInvalidation( client_, &recording_invalidation_, can_use_lcd_text_for_update_, layer_size, visible_layer_rect, update_source_frame_number_, Picture::RECORD_NORMALLY); last_updated_visible_content_rect_ = visible_content_rect(); if (updated) { SetNeedsPushProperties(); } else { recording_invalidation_.Clear(); } return updated; } ",0 "int NETSCAPE_SPKI_sign(NETSCAPE_SPKI *x, EVP_PKEY *pkey, const EVP_MD *md) { return(ASN1_item_sign(ASN1_ITEM_rptr(NETSCAPE_SPKAC), x->sig_algor,NULL, x->signature, x->spkac,pkey,md)); } ",0 "static void vmsvga_io_write(void *opaque, hwaddr addr, uint64_t data, unsigned size) { struct vmsvga_state_s *s = opaque; switch (addr) { case SVGA_IO_MUL * SVGA_INDEX_PORT: vmsvga_index_write(s, addr, data); break; case SVGA_IO_MUL * SVGA_VALUE_PORT: vmsvga_value_write(s, addr, data); break; case SVGA_IO_MUL * SVGA_BIOS_PORT: vmsvga_bios_write(s, addr, data); break; } } ",0 "LocationBar* TestBrowserWindow::GetLocationBar() const { return const_cast(&location_bar_); } ",0 "static int mem_write(jas_stream_obj_t *obj, char *buf, int cnt) { size_t n; int ret; jas_stream_memobj_t *m = (jas_stream_memobj_t *)obj; size_t newbufsize; size_t newpos; assert(buf); assert(cnt >= 0); JAS_DBGLOG(100, (""mem_write(%p, %p, %d)\n"", obj, buf, cnt)); newpos = m->pos_ + cnt; if (newpos > m->bufsize_ && m->growable_) { newbufsize = m->bufsize_; while (newbufsize < newpos) { if (!jas_safe_size_mul(newbufsize, 2, &newbufsize)) { JAS_DBGLOG(100, (""new buffer size would cause overflow\n"")); return -1; } } JAS_DBGLOG(100, (""mem_write resizing from %d to %zu\n"", m->bufsize_, newbufsize)); assert(newbufsize > 0); if (mem_resize(m, newbufsize)) { return -1; } } if (m->pos_ > m->len_) { /* The current position is beyond the end of the file, so pad the file to the current position with zeros. */ n = JAS_MIN(m->pos_, m->bufsize_) - m->len_; if (n > 0) { memset(&m->buf_[m->len_], 0, n); m->len_ += n; } if (m->pos_ != m->len_) { /* The buffer is not big enough. */ return 0; } } n = m->bufsize_ - m->pos_; ret = JAS_MIN(n, cnt); if (ret > 0) { memcpy(&m->buf_[m->pos_], buf, ret); m->pos_ += ret; } if (m->pos_ > m->len_) { m->len_ = m->pos_; } assert(ret == cnt); return ret; } ",0 "void PageHandler::RenderWidgetHostVisibilityChanged( RenderWidgetHost* widget_host, bool became_visible) { if (!screencast_enabled_) return; NotifyScreencastVisibility(became_visible); } ",0 "static int abort_sasl(aClient *cptr) { if (cptr->local->sasl_out == 0 || cptr->local->sasl_complete) return 0; cptr->local->sasl_out = cptr->local->sasl_complete = 0; sendto_one(cptr, err_str(ERR_SASLABORTED), me.name, BadPtr(cptr->name) ? ""*"" : cptr->name); if (*cptr->local->sasl_agent) { aClient *agent_p = find_client(cptr->local->sasl_agent, NULL); if (agent_p != NULL) { sendto_server(NULL, 0, 0, "":%s SASL %s %s D A"", me.name, AGENT_SID(agent_p), encode_puid(cptr)); return 0; } } sendto_server(NULL, 0, 0, "":%s SASL * %s D A"", me.name, encode_puid(cptr)); return 0; } ",0 "static bool StartsWith(const uint8_t* buffer, size_t buffer_size, const uint8_t* prefix, size_t prefix_size) { return (prefix_size <= buffer_size && memcmp(buffer, prefix, prefix_size) == 0); } ",0 "_abort_step(uint32_t job_id, uint32_t step_id) { step_complete_msg_t resp; slurm_msg_t resp_msg; slurm_msg_t_init(&resp_msg); int rc, rc2; resp.job_id = job_id; resp.job_step_id = step_id; resp.range_first = 0; resp.range_last = 0; resp.step_rc = 1; resp.jobacct = jobacctinfo_create(NULL); resp_msg.msg_type = REQUEST_STEP_COMPLETE; resp_msg.data = &resp; rc2 = slurm_send_recv_controller_rc_msg(&resp_msg, &rc); /* Note: we are ignoring the RPC return code */ jobacctinfo_destroy(resp.jobacct); return rc2; } ",0 "static int xts_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct aesni_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); return glue_xts_crypt_128bit(&aesni_dec_xts, desc, dst, src, nbytes, XTS_TWEAK_CAST(aesni_xts_tweak), aes_ctx(ctx->raw_tweak_ctx), aes_ctx(ctx->raw_crypt_ctx)); } ",0 "xfs_set_mode(struct inode *inode, umode_t mode) { int error = 0; if (mode != inode->i_mode) { struct iattr iattr; iattr.ia_valid = ATTR_MODE | ATTR_CTIME; iattr.ia_mode = mode; iattr.ia_ctime = current_fs_time(inode->i_sb); error = xfs_setattr_nonsize(XFS_I(inode), &iattr, XFS_ATTR_NOACL); } return error; } ",0 "MagickExport MagickBooleanType DrawClipPath(Image *image, const DrawInfo *draw_info,const char *id,ExceptionInfo *exception) { const char *clip_path; Image *clipping_mask; MagickBooleanType status; clip_path=GetImageArtifact(image,id); if (clip_path == (const char *) NULL) return(MagickFalse); clipping_mask=DrawClippingMask(image,draw_info,draw_info->clip_mask,clip_path, exception); if (clipping_mask == (Image *) NULL) return(MagickFalse); status=SetImageMask(image,WritePixelMask,clipping_mask,exception); clipping_mask=DestroyImage(clipping_mask); return(status); } ",0 " void CheckSuggestions(int expected_page_id, const Suggestion& suggestion0) { std::vector suggestion_vector; suggestion_vector.push_back(suggestion0); external_delegate_->CheckSuggestions(expected_page_id, 1, &suggestion_vector[0]); } ",0 "void RenderViewImpl::DidPause(WebKit::WebMediaPlayer* player) { Send(new ViewHostMsg_MediaNotification(routing_id_, reinterpret_cast(player), player->hasVideo(), player->hasAudio(), false)); } ",0 "handle_disassoc(netdissect_options *ndo, const u_char *p, u_int length) { struct mgmt_body_t pbody; memset(&pbody, 0, sizeof(pbody)); if (!ND_TTEST2(*p, IEEE802_11_REASON_LEN)) return 0; if (length < IEEE802_11_REASON_LEN) return 0; pbody.reason_code = EXTRACT_LE_16BITS(p); ND_PRINT((ndo, "": %s"", (pbody.reason_code < NUM_REASONS) ? reason_text[pbody.reason_code] : ""Reserved"")); return 1; } ",0 "createCroppedImage(struct image_data *image, struct crop_mask *crop, unsigned char **read_buff_ptr, unsigned char **crop_buff_ptr) { tsize_t cropsize; unsigned char *read_buff = NULL; unsigned char *crop_buff = NULL; unsigned char *new_buff = NULL; static tsize_t prev_cropsize = 0; read_buff = *read_buff_ptr; /* process full image, no crop buffer needed */ crop_buff = read_buff; *crop_buff_ptr = read_buff; crop->combined_width = image->width; crop->combined_length = image->length; cropsize = crop->bufftotal; crop_buff = *crop_buff_ptr; if (!crop_buff) { crop_buff = (unsigned char *)_TIFFmalloc(cropsize); *crop_buff_ptr = crop_buff; _TIFFmemset(crop_buff, 0, cropsize); prev_cropsize = cropsize; } else { if (prev_cropsize < cropsize) { new_buff = _TIFFrealloc(crop_buff, cropsize); if (!new_buff) { free (crop_buff); crop_buff = (unsigned char *)_TIFFmalloc(cropsize); } else crop_buff = new_buff; _TIFFmemset(crop_buff, 0, cropsize); } } if (!crop_buff) { TIFFError(""createCroppedImage"", ""Unable to allocate/reallocate crop buffer""); return (-1); } *crop_buff_ptr = crop_buff; if (crop->crop_mode & CROP_INVERT) { switch (crop->photometric) { /* Just change the interpretation */ case PHOTOMETRIC_MINISWHITE: case PHOTOMETRIC_MINISBLACK: image->photometric = crop->photometric; break; case INVERT_DATA_ONLY: case INVERT_DATA_AND_TAG: if (invertImage(image->photometric, image->spp, image->bps, crop->combined_width, crop->combined_length, crop_buff)) { TIFFError(""createCroppedImage"", ""Failed to invert colorspace for image or cropped selection""); return (-1); } if (crop->photometric == INVERT_DATA_AND_TAG) { switch (image->photometric) { case PHOTOMETRIC_MINISWHITE: image->photometric = PHOTOMETRIC_MINISBLACK; break; case PHOTOMETRIC_MINISBLACK: image->photometric = PHOTOMETRIC_MINISWHITE; break; default: break; } } break; default: break; } } if (crop->crop_mode & CROP_MIRROR) { if (mirrorImage(image->spp, image->bps, crop->mirror, crop->combined_width, crop->combined_length, crop_buff)) { TIFFError(""createCroppedImage"", ""Failed to mirror image or cropped selection %s"", (crop->rotation == MIRROR_HORIZ) ? ""horizontally"" : ""vertically""); return (-1); } } if (crop->crop_mode & CROP_ROTATE) /* rotate should be last as it can reallocate the buffer */ { if (rotateImage(crop->rotation, image, &crop->combined_width, &crop->combined_length, crop_buff_ptr)) { TIFFError(""createCroppedImage"", ""Failed to rotate image or cropped selection by %d degrees"", crop->rotation); return (-1); } } if (crop_buff == read_buff) /* we used the read buffer for the crop buffer */ *read_buff_ptr = NULL; /* so we don't try to free it later */ return (0); } /* end createCroppedImage */ ",0 "static void __init trim_bios_range(void) { /* * A special case is the first 4Kb of memory; * This is a BIOS owned area, not kernel ram, but generally * not listed as such in the E820 table. * * This typically reserves additional memory (64KiB by default) * since some BIOSes are known to corrupt low memory. See the * Kconfig help text for X86_RESERVE_LOW. */ e820_update_range(0, PAGE_SIZE, E820_RAM, E820_RESERVED); /* * special case: Some BIOSen report the PC BIOS * area (640->1Mb) as ram even though it is not. * take them out. */ e820_remove_range(BIOS_BEGIN, BIOS_END - BIOS_BEGIN, E820_RAM, 1); sanitize_e820_map(e820.map, ARRAY_SIZE(e820.map), &e820.nr_map); } ",0 "BlockReopenQueue *bdrv_reopen_queue(BlockReopenQueue *bs_queue, BlockDriverState *bs, int flags) { assert(bs != NULL); BlockReopenQueueEntry *bs_entry; if (bs_queue == NULL) { bs_queue = g_new0(BlockReopenQueue, 1); QSIMPLEQ_INIT(bs_queue); } if (bs->file) { bdrv_reopen_queue(bs_queue, bs->file, flags); } bs_entry = g_new0(BlockReopenQueueEntry, 1); QSIMPLEQ_INSERT_TAIL(bs_queue, bs_entry, entry); bs_entry->state.bs = bs; bs_entry->state.flags = flags; return bs_queue; } ",0 "int_unix_date(uint32_t dos_date) { struct tm t; if (dos_date == 0) return(0); interpret_dos_date(dos_date, &t); t.tm_wday = 1; t.tm_yday = 1; t.tm_isdst = 0; return (mktime(&t)); } ",0 "unsigned long AudioHandler::ChannelCount() { return channel_count_; } ",0 "GF_Err unkn_Write(GF_Box *s, GF_BitStream *bs) { GF_Err e; u32 type = s->type; GF_UnknownBox *ptr = (GF_UnknownBox *)s; if (!s) return GF_BAD_PARAM; ptr->type = ptr->original_4cc; e = gf_isom_box_write_header(s, bs); ptr->type = type; if (e) return e; if (ptr->dataSize && ptr->data) { gf_bs_write_data(bs, ptr->data, ptr->dataSize); } return GF_OK; } ",0 "void btif_av_move_idle(RawAddress bd_addr) { /* inform the application that ACL is disconnected and move to idle state */ btif_sm_state_t state = btif_sm_get_state(btif_av_cb.sm_handle); BTIF_TRACE_WARNING(""%s: ACL Disconnected state %d bd_addr=%s peer_bda=%s"", __func__, state, bd_addr.ToString().c_str(), btif_av_cb.peer_bda.ToString().c_str()); if (state == BTIF_AV_STATE_OPENING && (bd_addr == btif_av_cb.peer_bda)) { BTIF_TRACE_DEBUG( ""%s: Moving State from Opening to Idle due to ACL disconnect"", __func__); btif_report_connection_state(BTAV_CONNECTION_STATE_DISCONNECTED, &(btif_av_cb.peer_bda)); btif_sm_change_state(btif_av_cb.sm_handle, BTIF_AV_STATE_IDLE); } } ",0 "void HTMLMediaElement::setPlaybackRate(double rate, ExceptionState& exception_state) { BLINK_MEDIA_LOG << ""setPlaybackRate("" << (void*)this << "", "" << rate << "")""; if (GetLoadType() == WebMediaPlayer::kLoadTypeMediaStream) return; if (rate != 0.0 && (rate < kMinRate || rate > kMaxRate)) { UseCounter::Count(GetDocument(), WebFeature::kHTMLMediaElementMediaPlaybackRateOutOfRange); exception_state.ThrowDOMException( DOMExceptionCode::kNotSupportedError, ""The provided playback rate ("" + String::Number(rate) + "") is not in the "" + ""supported playback range.""); return; } if (playback_rate_ != rate) { playback_rate_ = rate; ScheduleEvent(event_type_names::kRatechange); } UpdatePlaybackRate(); } ",0 "static inline int pipelined_send(struct msg_queue *msq, struct msg_msg *msg) { struct msg_receiver *msr, *t; list_for_each_entry_safe(msr, t, &msq->q_receivers, r_list) { if (testmsg(msg, msr->r_msgtype, msr->r_mode) && !security_msg_queue_msgrcv(msq, msg, msr->r_tsk, msr->r_msgtype, msr->r_mode)) { list_del(&msr->r_list); if (msr->r_maxsize < msg->m_ts) { /* initialize pipelined send ordering */ msr->r_msg = NULL; wake_up_process(msr->r_tsk); /* barrier (B) see barrier comment below */ smp_wmb(); msr->r_msg = ERR_PTR(-E2BIG); } else { msr->r_msg = NULL; msq->q_lrpid = task_pid_vnr(msr->r_tsk); msq->q_rtime = get_seconds(); wake_up_process(msr->r_tsk); /* * Ensure that the wakeup is visible before * setting r_msg, as the receiving can otherwise * exit - once r_msg is set, the receiver can * continue. See lockless receive part 1 and 2 * in do_msgrcv(). Barrier (B). */ smp_wmb(); msr->r_msg = msg; return 1; } } } return 0; } ",0 "static inline struct futex_hash_bucket *queue_lock(struct futex_q *q) { struct futex_hash_bucket *hb; get_futex_key_refs(&q->key); hb = hash_futex(&q->key); q->lock_ptr = &hb->lock; spin_lock(&hb->lock); return hb; } ",1 "void showTree(const WebCore::Range* range) { if (range && range->boundaryPointsValid()) { range->startContainer()->showTreeAndMark(range->startContainer(), ""S"", range->endContainer(), ""E""); fprintf(stderr, ""start offset: %d, end offset: %d\n"", range->startOffset(), range->endOffset()); } } ",0 "void Browser::DidNavigateToPendingEntry(TabContents* tab) { if (tab == GetSelectedTabContents()) UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE); } ",0 "int oidc_content_handler(request_rec *r) { oidc_cfg *c = ap_get_module_config(r->server->module_config, &auth_openidc_module); int rc = DECLINED; if (oidc_util_request_matches_url(r, oidc_get_redirect_uri(r, c))) { if (oidc_util_request_has_parameter(r, OIDC_REDIRECT_URI_REQUEST_INFO)) { oidc_session_t *session = NULL; oidc_session_load(r, &session); /* handle request for session info */ rc = oidc_handle_info_request(r, c, session); /* free resources allocated for the session */ oidc_session_free(r, session); } } return rc; } ",0 "void CapturerMac::EnableCapture(bool enable) { capturing_ = enable; } ",0 "static void ext4_update_bh_state(struct buffer_head *bh, unsigned long flags) { unsigned long old_state; unsigned long new_state; flags &= EXT4_MAP_FLAGS; /* Dummy buffer_head? Set non-atomically. */ if (!bh->b_page) { bh->b_state = (bh->b_state & ~EXT4_MAP_FLAGS) | flags; return; } /* * Someone else may be modifying b_state. Be careful! This is ugly but * once we get rid of using bh as a container for mapping information * to pass to / from get_block functions, this can go away. */ do { old_state = READ_ONCE(bh->b_state); new_state = (old_state & ~EXT4_MAP_FLAGS) | flags; } while (unlikely( cmpxchg(&bh->b_state, old_state, new_state) != old_state)); } ",0 "static int raw_rcv_skb(struct sock * sk, struct sk_buff * skb) { /* Charge it to the socket. */ if (ip_queue_rcv_skb(sk, skb) < 0) { kfree_skb(skb); return NET_RX_DROP; } return NET_RX_SUCCESS; } ",0 "htmlCtxtReadFd(htmlParserCtxtPtr ctxt, int fd, const char *URL, const char *encoding, int options) { xmlParserInputBufferPtr input; xmlParserInputPtr stream; if (fd < 0) return (NULL); if (ctxt == NULL) return (NULL); xmlInitParser(); htmlCtxtReset(ctxt); input = xmlParserInputBufferCreateFd(fd, XML_CHAR_ENCODING_NONE); if (input == NULL) return (NULL); stream = xmlNewIOInputStream(ctxt, input, XML_CHAR_ENCODING_NONE); if (stream == NULL) { xmlFreeParserInputBuffer(input); return (NULL); } inputPush(ctxt, stream); return (htmlDoRead(ctxt, URL, encoding, options, 1)); } ",0 "int NavigationControllerImpl::GetEntryCount() const { DCHECK(entries_.size() <= max_entry_count()); return static_cast(entries_.size()); } ",0 " State(v8::Handle composite, StateBase* next) : StateBase(composite, next) { } ",0 "error::Error GLES2DecoderPassthroughImpl::DoIsShader(GLuint shader, uint32_t* result) { *result = api()->glIsShaderFn(GetShaderServiceID(shader, resources_)); return error::kNoError; } ",0 "Lockable* DynamicMetadataProvider::lock() { m_lock->rdlock(); return this; } ",0 "bool JSTestMediaQueryListListenerConstructor::getOwnPropertyDescriptor(JSObject* object, ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor) { return getStaticValueDescriptor(exec, &JSTestMediaQueryListListenerConstructorTable, jsCast(object), propertyName, descriptor); } ",0 " void ExtendSubframeUnloadTimeoutForTerminationPing(RenderFrameHostImpl* rfh) { rfh->SetSubframeUnloadTimeoutForTesting(base::TimeDelta::FromSeconds(30)); } ",0 "X509_VERIFY_PARAM_set1_email(X509_VERIFY_PARAM *param, const char *email, size_t emaillen) { return int_x509_param_set1(¶m->id->email, ¶m->id->emaillen, email, emaillen); } ",0 "void VideoCaptureManager::SetPhotoOptions( int session_id, media::mojom::PhotoSettingsPtr settings, media::VideoCaptureDevice::SetPhotoOptionsCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); VideoCaptureController* controller = LookupControllerBySessionId(session_id); if (!controller) return; if (controller->IsDeviceAlive()) { controller->SetPhotoOptions(std::move(settings), std::move(callback)); return; } photo_request_queue_.emplace_back( session_id, base::Bind(&VideoCaptureController::SetPhotoOptions, base::Unretained(controller), base::Passed(&settings), base::Passed(&callback))); } ",0 "void ShelfLayoutManager::PrepareForShutdown() { in_shutdown_ = true; Shell::Get()->activation_client()->RemoveObserver(this); } ",0 "static u32 vmx_exec_control(struct vcpu_vmx *vmx) { u32 exec_control = vmcs_config.cpu_based_exec_ctrl; if (!vm_need_tpr_shadow(vmx->vcpu.kvm)) { exec_control &= ~CPU_BASED_TPR_SHADOW; #ifdef CONFIG_X86_64 exec_control |= CPU_BASED_CR8_STORE_EXITING | CPU_BASED_CR8_LOAD_EXITING; #endif } if (!enable_ept) exec_control |= CPU_BASED_CR3_STORE_EXITING | CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_INVLPG_EXITING; return exec_control; } ",0 "static int ext4_verify_csum_type(struct super_block *sb, struct ext4_super_block *es) { if (!ext4_has_feature_metadata_csum(sb)) return 1; return es->s_checksum_type == EXT4_CRC32C_CHKSUM; } ",0 " void RenderFrameHostManager::EnsureRenderFrameHostVisibilityConsistent() { if (render_frame_host_->GetView() && render_frame_host_->render_view_host()->GetWidget()->is_hidden() != delegate_->IsHidden()) { if (delegate_->IsHidden()) { render_frame_host_->GetView()->Hide(); } else { render_frame_host_->GetView()->Show(); } } } ",1 "static void overloadedPerWorldBindingsMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::overloadedPerWorldBindingsMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void LocalDOMWindow::setDefaultStatus(const String& string) { default_status_ = string; } ",0 "WebRTCVoidRequest::ExtraData* WebRTCVoidRequest::extraData() const { RefPtr data = m_private->extraData(); if (!data) return 0; return static_cast(data.get())->extraData(); } ",0 "_pango_Is_Emoji_Emoji_Default (gunichar ch) { return _pango_Is_Emoji_Presentation (ch); } ",0 "static int vfio_pci_open(void *device_data) { struct vfio_pci_device *vdev = device_data; int ret = 0; if (!try_module_get(THIS_MODULE)) return -ENODEV; mutex_lock(&driver_lock); if (!vdev->refcnt) { ret = vfio_pci_enable(vdev); if (ret) goto error; vfio_spapr_pci_eeh_open(vdev->pdev); } vdev->refcnt++; error: mutex_unlock(&driver_lock); if (ret) module_put(THIS_MODULE); return ret; } ",0 "void re_yyset_lval (YYSTYPE * yylval_param , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yylval = yylval_param; } ",0 "void HTMLTextAreaElement::updateFocusAppearance(bool restorePreviousSelection) { if (!restorePreviousSelection || !hasCachedSelection()) { setSelectionRange(0, 0); } else restoreCachedSelection(); if (document().frame()) document().frame()->selection().revealSelection(); } ",0 "static ssize_t ocfs2_file_write_iter(struct kiocb *iocb, struct iov_iter *from) { int direct_io, rw_level; ssize_t written = 0; ssize_t ret; size_t count = iov_iter_count(from); struct file *file = iocb->ki_filp; struct inode *inode = file_inode(file); struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); int full_coherency = !(osb->s_mount_opt & OCFS2_MOUNT_COHERENCY_BUFFERED); void *saved_ki_complete = NULL; int append_write = ((iocb->ki_pos + count) >= i_size_read(inode) ? 1 : 0); trace_ocfs2_file_aio_write(inode, file, file->f_path.dentry, (unsigned long long)OCFS2_I(inode)->ip_blkno, file->f_path.dentry->d_name.len, file->f_path.dentry->d_name.name, (unsigned int)from->nr_segs); /* GRRRRR */ if (count == 0) return 0; direct_io = iocb->ki_flags & IOCB_DIRECT ? 1 : 0; inode_lock(inode); /* * Concurrent O_DIRECT writes are allowed with * mount_option ""coherency=buffered"". * For append write, we must take rw EX. */ rw_level = (!direct_io || full_coherency || append_write); ret = ocfs2_rw_lock(inode, rw_level); if (ret < 0) { mlog_errno(ret); goto out_mutex; } /* * O_DIRECT writes with ""coherency=full"" need to take EX cluster * inode_lock to guarantee coherency. */ if (direct_io && full_coherency) { /* * We need to take and drop the inode lock to force * other nodes to drop their caches. Buffered I/O * already does this in write_begin(). */ ret = ocfs2_inode_lock(inode, NULL, 1); if (ret < 0) { mlog_errno(ret); goto out; } ocfs2_inode_unlock(inode, 1); } ret = generic_write_checks(iocb, from); if (ret <= 0) { if (ret) mlog_errno(ret); goto out; } count = ret; ret = ocfs2_prepare_inode_for_write(file, iocb->ki_pos, count); if (ret < 0) { mlog_errno(ret); goto out; } if (direct_io && !is_sync_kiocb(iocb) && ocfs2_is_io_unaligned(inode, count, iocb->ki_pos)) { /* * Make it a sync io if it's an unaligned aio. */ saved_ki_complete = xchg(&iocb->ki_complete, NULL); } /* communicate with ocfs2_dio_end_io */ ocfs2_iocb_set_rw_locked(iocb, rw_level); written = __generic_file_write_iter(iocb, from); /* buffered aio wouldn't have proper lock coverage today */ BUG_ON(written == -EIOCBQUEUED && !(iocb->ki_flags & IOCB_DIRECT)); /* * deep in g_f_a_w_n()->ocfs2_direct_IO we pass in a ocfs2_dio_end_io * function pointer which is called when o_direct io completes so that * it can unlock our rw lock. * Unfortunately there are error cases which call end_io and others * that don't. so we don't have to unlock the rw_lock if either an * async dio is going to do it in the future or an end_io after an * error has already done it. */ if ((written == -EIOCBQUEUED) || (!ocfs2_iocb_is_rw_locked(iocb))) { rw_level = -1; } if (unlikely(written <= 0)) goto out; if (((file->f_flags & O_DSYNC) && !direct_io) || IS_SYNC(inode)) { ret = filemap_fdatawrite_range(file->f_mapping, iocb->ki_pos - written, iocb->ki_pos - 1); if (ret < 0) written = ret; if (!ret) { ret = jbd2_journal_force_commit(osb->journal->j_journal); if (ret < 0) written = ret; } if (!ret) ret = filemap_fdatawait_range(file->f_mapping, iocb->ki_pos - written, iocb->ki_pos - 1); } out: if (saved_ki_complete) xchg(&iocb->ki_complete, saved_ki_complete); if (rw_level != -1) ocfs2_rw_unlock(inode, rw_level); out_mutex: inode_unlock(inode); if (written) ret = written; return ret; } ",0 "static void update_canvas_size(AVCodecContext *avctx, int w, int h) { WebPContext *s = avctx->priv_data; if (s->width && s->width != w) { av_log(avctx, AV_LOG_WARNING, ""Width mismatch. %d != %d\n"", s->width, w); } s->width = w; if (s->height && s->height != h) { av_log(avctx, AV_LOG_WARNING, ""Height mismatch. %d != %d\n"", s->height, h); } s->height = h; } ",0 "static void inotify_remove_from_idr(struct fsnotify_group *group, struct inotify_inode_mark *i_mark) { spinlock_t *idr_lock = &group->inotify_data.idr_lock; struct inotify_inode_mark *found_i_mark = NULL; int wd; spin_lock(idr_lock); wd = i_mark->wd; /* * does this i_mark think it is in the idr? we shouldn't get called * if it wasn't.... */ if (wd == -1) { WARN_ONCE(1, ""%s: i_mark=%p i_mark->wd=%d i_mark->group=%p"" "" i_mark->inode=%p\n"", __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group, i_mark->fsn_mark.i.inode); goto out; } /* Lets look in the idr to see if we find it */ found_i_mark = inotify_idr_find_locked(group, wd); if (unlikely(!found_i_mark)) { WARN_ONCE(1, ""%s: i_mark=%p i_mark->wd=%d i_mark->group=%p"" "" i_mark->inode=%p\n"", __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group, i_mark->fsn_mark.i.inode); goto out; } /* * We found an mark in the idr at the right wd, but it's * not the mark we were told to remove. eparis seriously * fucked up somewhere. */ if (unlikely(found_i_mark != i_mark)) { WARN_ONCE(1, ""%s: i_mark=%p i_mark->wd=%d i_mark->group=%p "" ""mark->inode=%p found_i_mark=%p found_i_mark->wd=%d "" ""found_i_mark->group=%p found_i_mark->inode=%p\n"", __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group, i_mark->fsn_mark.i.inode, found_i_mark, found_i_mark->wd, found_i_mark->fsn_mark.group, found_i_mark->fsn_mark.i.inode); goto out; } /* * One ref for being in the idr * one ref held by the caller trying to kill us * one ref grabbed by inotify_idr_find */ if (unlikely(atomic_read(&i_mark->fsn_mark.refcnt) < 3)) { printk(KERN_ERR ""%s: i_mark=%p i_mark->wd=%d i_mark->group=%p"" "" i_mark->inode=%p\n"", __func__, i_mark, i_mark->wd, i_mark->fsn_mark.group, i_mark->fsn_mark.i.inode); /* we can't really recover with bad ref cnting.. */ BUG(); } do_inotify_remove_from_idr(group, i_mark); out: /* match the ref taken by inotify_idr_find_locked() */ if (found_i_mark) fsnotify_put_mark(&found_i_mark->fsn_mark); i_mark->wd = -1; spin_unlock(idr_lock); } ",0 "get_usage (uint8_t * report_descriptor, size_t size, unsigned short *usage_page, unsigned short *usage) { size_t i = 0; int size_code; int data_len, key_size; int usage_found = 0, usage_page_found = 0; while (i < size) { int key = report_descriptor[i]; int key_cmd = key & 0xfc; if ((key & 0xf0) == 0xf0) { fprintf (stderr, ""invalid data received.\n""); return -1; } else { size_code = key & 0x3; switch (size_code) { case 0: case 1: case 2: data_len = size_code; break; case 3: data_len = 4; break; default: /* Can't ever happen since size_code is & 0x3 */ data_len = 0; break; }; key_size = 1; } if (key_cmd == 0x4) { *usage_page = get_bytes (report_descriptor, size, data_len, i); usage_page_found = 1; } if (key_cmd == 0x8) { *usage = get_bytes (report_descriptor, size, data_len, i); usage_found = 1; } if (usage_page_found && usage_found) return 0; /* success */ i += data_len + key_size; } return -1; /* failure */ } ",0 "static u32 avc_emulation_bytes_remove_count(const char *buffer, u32 nal_size) { u32 i = 0, emulation_bytes_count = 0; u8 num_zero = 0; while (i < nal_size) { /*ISO 14496-10: ""Within the NAL unit, any four-byte sequence that starts with 0x000003 other than the following sequences shall not occur at any byte-aligned position: \96 0x00000300 \96 0x00000301 \96 0x00000302 \96 0x00000303"" */ if (num_zero == 2 && buffer[i] == 0x03 && i+1 < nal_size /*next byte is readable*/ && buffer[i+1] < 0x04) { /*emulation code found*/ num_zero = 0; emulation_bytes_count++; i++; } if (!buffer[i]) num_zero++; else num_zero = 0; i++; } return emulation_bytes_count; } ",0 "static bool encode_search_options_request(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_search_options_control *lsoc = talloc_get_type(in, struct ldb_search_options_control); struct asn1_data *data = asn1_init(mem_ctx); if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { return false; } if (!asn1_write_Integer(data, lsoc->search_options)) { return false; } if (!asn1_pop_tag(data)) { return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { return false; } talloc_free(data); return true; } ",0 " void DownloadItemImplDelegate::ShowDownloadInShell(DownloadItemImpl* download) { } ",0 " TestRenderFrame* frame() { return static_cast(view()->GetMainRenderFrame()); } ",0 "int test_gf2m_mod_mul(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b[2], *c, *d, *e, *f, *g, *h; int i, j, ret = 0; int p0[] = { 163, 7, 6, 3, 0, -1 }; int p1[] = { 193, 15, 0, -1 }; a = BN_new(); b[0] = BN_new(); b[1] = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); f = BN_new(); g = BN_new(); h = BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 1024, 0, 0); BN_bntest_rand(c, 1024, 0, 0); BN_bntest_rand(d, 1024, 0, 0); for (j = 0; j < 2; j++) { BN_GF2m_mod_mul(e, a, c, b[j], ctx); # if 0 /* make test uses ouput in bc but bc can't * handle GF(2^m) arithmetic */ if (bp != NULL) { if (!results) { BN_print(bp, a); BIO_puts(bp, "" * ""); BN_print(bp, c); BIO_puts(bp, "" % ""); BN_print(bp, b[j]); BIO_puts(bp, "" - ""); BN_print(bp, e); BIO_puts(bp, ""\n""); } } # endif BN_GF2m_add(f, a, d); BN_GF2m_mod_mul(g, f, c, b[j], ctx); BN_GF2m_mod_mul(h, d, c, b[j], ctx); BN_GF2m_add(f, e, g); BN_GF2m_add(f, f, h); /* Test that (a+d)*c = a*c + d*c. */ if (!BN_is_zero(f)) { fprintf(stderr, ""GF(2^m) modular multiplication test failed!\n""); goto err; } } } ret = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); BN_free(e); BN_free(f); BN_free(g); BN_free(h); return ret; } ",0 "void CLASS foveon_decoder (unsigned size, unsigned code) { static unsigned huff[1024]; struct decode *cur; int i, len; if (!code) { for (i=0; i < size; i++) huff[i] = get4(); memset (first_decode, 0, sizeof first_decode); free_decode = first_decode; } cur = free_decode++; if (free_decode > first_decode+2048) { #ifdef LIBRAW_LIBRARY_BUILD throw LIBRAW_EXCEPTION_DECODE_RAW; #else fprintf (stderr,_(""%s: decoder table overflow\n""), ifname); longjmp (failure, 2); #endif } if (code) for (i=0; i < size; i++) if (huff[i] == code) { cur->leaf = i; return; } if ((len = code >> 27) > 26) return; code = (len+1) << 27 | (code & 0x3ffffff) << 1; cur->branch[0] = free_decode; foveon_decoder (size, code); cur->branch[1] = free_decode; foveon_decoder (size, code+1); } ",0 "PassRefPtrWillBeRawPtr SVGFEColorMatrixElement::build(SVGFilterBuilder* filterBuilder, Filter* filter) { FilterEffect* input1 = filterBuilder->getEffectById(AtomicString(m_in1->currentValue()->value())); if (!input1) return nullptr; Vector filterValues; ColorMatrixType filterType = m_type->currentValue()->enumValue(); if (!hasAttribute(SVGNames::valuesAttr)) { switch (filterType) { case FECOLORMATRIX_TYPE_MATRIX: for (size_t i = 0; i < 20; i++) filterValues.append((i % 6) ? 0 : 1); break; case FECOLORMATRIX_TYPE_HUEROTATE: filterValues.append(0); break; case FECOLORMATRIX_TYPE_SATURATE: filterValues.append(1); break; default: break; } } else { RefPtrWillBeRawPtr values = m_values->currentValue(); size_t size = values->length(); if ((filterType == FECOLORMATRIX_TYPE_MATRIX && size != 20) || (filterType == FECOLORMATRIX_TYPE_HUEROTATE && size != 1) || (filterType == FECOLORMATRIX_TYPE_SATURATE && size != 1)) return nullptr; filterValues = values->toFloatVector(); } RefPtrWillBeRawPtr effect = FEColorMatrix::create(filter, filterType, filterValues); effect->inputEffects().append(input1); return effect.release(); } ",0 "void WebUILoginView::OpenProxySettings() { ProxySettingsDialog* dialog = new ProxySettingsDialog(NULL, GetNativeWindow()); dialog->Show(); } ",0 "void FrameFetchContext::PopulateResourceRequest( Resource::Type type, const ClientHintsPreferences& hints_preferences, const FetchParameters::ResourceWidth& resource_width, ResourceRequest& request) { ModifyRequestForCSP(request); AddClientHintsIfNecessary(hints_preferences, resource_width, request); AddCSPHeaderIfNecessary(type, request); } ",0 "bool WebGL2RenderingContextBase::IsBufferBoundToTransformFeedback( WebGLBuffer* buffer) { DCHECK(buffer); return transform_feedback_binding_->IsBufferBoundToTransformFeedback(buffer); } ",0 "onig_get_capture_tree(OnigRegion* region) { return region->history_root; } ",0 "RIL_register (const RIL_RadioFunctions *callbacks) { int ret; int flags; RLOGI(""SIM_COUNT: %d"", SIM_COUNT); if (callbacks == NULL) { RLOGE(""RIL_register: RIL_RadioFunctions * null""); return; } if (callbacks->version < RIL_VERSION_MIN) { RLOGE(""RIL_register: version %d is to old, min version is %d"", callbacks->version, RIL_VERSION_MIN); return; } RLOGE(""RIL_register: RIL version %d"", callbacks->version); if (s_registerCalled > 0) { RLOGE(""RIL_register has been called more than once. "" ""Subsequent call ignored""); return; } memcpy(&s_callbacks, callbacks, sizeof (RIL_RadioFunctions)); /* Initialize socket1 parameters */ s_ril_param_socket = { RIL_SOCKET_1, /* socket_id */ -1, /* fdListen */ -1, /* fdCommand */ PHONE_PROCESS, /* processName */ &s_commands_event, /* commands_event */ &s_listen_event, /* listen_event */ processCommandsCallback, /* processCommandsCallback */ NULL, /* p_rs */ RIL_TELEPHONY_SOCKET /* type */ }; #if (SIM_COUNT >= 2) s_ril_param_socket2 = { RIL_SOCKET_2, /* socket_id */ -1, /* fdListen */ -1, /* fdCommand */ PHONE_PROCESS, /* processName */ &s_commands_event_socket2, /* commands_event */ &s_listen_event_socket2, /* listen_event */ processCommandsCallback, /* processCommandsCallback */ NULL, /* p_rs */ RIL_TELEPHONY_SOCKET /* type */ }; #endif #if (SIM_COUNT >= 3) s_ril_param_socket3 = { RIL_SOCKET_3, /* socket_id */ -1, /* fdListen */ -1, /* fdCommand */ PHONE_PROCESS, /* processName */ &s_commands_event_socket3, /* commands_event */ &s_listen_event_socket3, /* listen_event */ processCommandsCallback, /* processCommandsCallback */ NULL, /* p_rs */ RIL_TELEPHONY_SOCKET /* type */ }; #endif #if (SIM_COUNT >= 4) s_ril_param_socket4 = { RIL_SOCKET_4, /* socket_id */ -1, /* fdListen */ -1, /* fdCommand */ PHONE_PROCESS, /* processName */ &s_commands_event_socket4, /* commands_event */ &s_listen_event_socket4, /* listen_event */ processCommandsCallback, /* processCommandsCallback */ NULL, /* p_rs */ RIL_TELEPHONY_SOCKET /* type */ }; #endif s_registerCalled = 1; RLOGI(""s_registerCalled flag set, %d"", s_started); for (int i = 0; i < (int)NUM_ELEMS(s_commands); i++) { assert(i == s_commands[i].requestNumber); } for (int i = 0; i < (int)NUM_ELEMS(s_unsolResponses); i++) { assert(i + RIL_UNSOL_RESPONSE_BASE == s_unsolResponses[i].requestNumber); } if (s_started == 0) { RIL_startEventLoop(); } startListen(RIL_SOCKET_1, &s_ril_param_socket); #if (SIM_COUNT >= 2) startListen(RIL_SOCKET_2, &s_ril_param_socket2); #endif /* (SIM_COUNT == 2) */ #if (SIM_COUNT >= 3) startListen(RIL_SOCKET_3, &s_ril_param_socket3); #endif /* (SIM_COUNT == 3) */ #if (SIM_COUNT >= 4) startListen(RIL_SOCKET_4, &s_ril_param_socket4); #endif /* (SIM_COUNT == 4) */ #if 1 char *inst = NULL; if (strlen(RIL_getRilSocketName()) >= strlen(SOCKET_NAME_RIL)) { inst = RIL_getRilSocketName() + strlen(SOCKET_NAME_RIL); } char rildebug[MAX_DEBUG_SOCKET_NAME_LENGTH] = SOCKET_NAME_RIL_DEBUG; if (inst != NULL) { strlcat(rildebug, inst, MAX_DEBUG_SOCKET_NAME_LENGTH); } s_fdDebug = android_get_control_socket(rildebug); if (s_fdDebug < 0) { RLOGE(""Failed to get socket : %s errno:%d"", rildebug, errno); exit(-1); } ret = listen(s_fdDebug, 4); if (ret < 0) { RLOGE(""Failed to listen on ril debug socket '%d': %s"", s_fdDebug, strerror(errno)); exit(-1); } ril_event_set (&s_debug_event, s_fdDebug, true, debugCallback, NULL); rilEventAddWakeup (&s_debug_event); #endif } ",0 "void vlan_setup(struct net_device *dev) { ether_setup(dev); dev->priv_flags |= IFF_802_1Q_VLAN; dev->priv_flags &= ~IFF_XMIT_DST_RELEASE; dev->tx_queue_len = 0; dev->netdev_ops = &vlan_netdev_ops; dev->destructor = free_netdev; dev->ethtool_ops = &vlan_ethtool_ops; memset(dev->broadcast, 0, ETH_ALEN); } ",1 "bool NodeIterator::NodePointer::moveToPrevious(Node* root) { if (!node) return false; if (!isPointerBeforeNode) { isPointerBeforeNode = true; return true; } node = NodeTraversal::previous(*node, root); return node; } ",0 "findVisual (ScreenPtr pScreen, VisualID vid) { VisualPtr pVisual; int v; for (v = 0; v < pScreen->numVisuals; v++) { pVisual = pScreen->visuals + v; if (pVisual->vid == vid) return pVisual; } return 0; } ",0 "static int shutdown_vlan(struct lxc_handler *handler, struct lxc_netdev *netdev) { return 0; } ",0 "Mat_Create4(const char* matname) { FILE *fp = NULL; mat_t *mat = NULL; #if defined(_WIN32) && defined(_MSC_VER) wchar_t* wname = utf82u(matname); if ( NULL != wname ) { fp = _wfopen(wname, L""w+b""); free(wname); } #else fp = fopen(matname, ""w+b""); #endif if ( !fp ) return NULL; mat = (mat_t*)malloc(sizeof(*mat)); if ( NULL == mat ) { fclose(fp); Mat_Critical(""Couldn't allocate memory for the MAT file""); return NULL; } mat->fp = fp; mat->header = NULL; mat->subsys_offset = NULL; mat->filename = strdup_printf(""%s"",matname); mat->version = MAT_FT_MAT4; mat->byteswap = 0; mat->mode = 0; mat->bof = 0; mat->next_index = 0; mat->num_datasets = 0; #if defined(MAT73) && MAT73 mat->refs_id = -1; #endif mat->dir = NULL; Mat_Rewind(mat); return mat; } ",0 "IPCThreadState* IPCThreadState::selfOrNull() { if (gHaveTLS) { const pthread_key_t k = gTLS; IPCThreadState* st = (IPCThreadState*)pthread_getspecific(k); return st; } return NULL; } ",0 "void ParamTraits::Log( const param_type& p, std::string* l) { l->append(""(""); LogParam(p.url, l); l->append("",""); LogParam(p.policy, l); l->append("")""); } ",0 "png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length) { unsigned int i; png_debug(1, ""in png_handle_eXIf""); if ((png_ptr->mode & PNG_HAVE_IHDR) == 0) png_chunk_error(png_ptr, ""missing IHDR""); if (length < 2) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""too short""); return; } else if (info_ptr == NULL || (info_ptr->valid & PNG_INFO_eXIf) != 0) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""duplicate""); return; } info_ptr->free_me |= PNG_FREE_EXIF; info_ptr->eXIf_buf = png_voidcast(png_bytep, png_malloc_warn(png_ptr, length)); if (info_ptr->eXIf_buf == NULL) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""out of memory""); return; } for (i = 0; i < length; i++) { png_byte buf[1]; png_crc_read(png_ptr, buf, 1); info_ptr->eXIf_buf[i] = buf[0]; if (i == 1 && buf[0] != 'M' && buf[0] != 'I' && info_ptr->eXIf_buf[0] != buf[0]) { png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""incorrect byte-order specifier""); png_free(png_ptr, info_ptr->eXIf_buf); info_ptr->eXIf_buf = NULL; return; } } if (png_crc_finish(png_ptr, 0) != 0) return; png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf); png_free(png_ptr, info_ptr->eXIf_buf); info_ptr->eXIf_buf = NULL; } ",0 " void PepperVideoRenderer2D::OnFlushDone(int result, const base::Time& paint_start, webrtc::DesktopFrame* buffer) { DCHECK(CalledOnValidThread()); DCHECK(flush_pending_); software_video_renderer_->GetStats()->video_paint_ms()->Record( (base::Time::Now() - paint_start).InMilliseconds()); flush_pending_ = false; ReturnBuffer(buffer); if (merge_buffer_) { buffer = merge_buffer_; merge_buffer_ = nullptr; FlushBuffer(merge_clip_area_, buffer, merge_region_); } } ",0 "static int ecryptfs_process_flags(struct ecryptfs_crypt_stat *crypt_stat, char *page_virt, int *bytes_read) { int rc = 0; int i; u32 flags; flags = get_unaligned_be32(page_virt); for (i = 0; i < ((sizeof(ecryptfs_flag_map) / sizeof(struct ecryptfs_flag_map_elem))); i++) if (flags & ecryptfs_flag_map[i].file_flag) { crypt_stat->flags |= ecryptfs_flag_map[i].local_flag; } else crypt_stat->flags &= ~(ecryptfs_flag_map[i].local_flag); /* Version is in top 8 bits of the 32-bit flag vector */ crypt_stat->file_version = ((flags >> 24) & 0xFF); (*bytes_read) = 4; return rc; } ",0 "nextproto4_cksum(netdissect_options *ndo, const struct ip *ip, const uint8_t *data, u_int len, u_int covlen, u_int next_proto) { struct phdr { uint32_t src; uint32_t dst; u_char mbz; u_char proto; uint16_t len; } ph; struct cksum_vec vec[2]; /* pseudo-header.. */ ph.len = htons((uint16_t)len); ph.mbz = 0; ph.proto = next_proto; UNALIGNED_MEMCPY(&ph.src, &ip->ip_src, sizeof(uint32_t)); if (IP_HL(ip) == 5) UNALIGNED_MEMCPY(&ph.dst, &ip->ip_dst, sizeof(uint32_t)); else ph.dst = ip_finddst(ndo, ip); vec[0].ptr = (const uint8_t *)(void *)&ph; vec[0].len = sizeof(ph); vec[1].ptr = data; vec[1].len = covlen; return (in_cksum(vec, 2)); } ",0 "static void activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttributeAttributeSetterCallbackForMainWorld(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); TestObjectPythonV8Internal::activityLoggingAccessForIsolatedWorldsPerWorldBindingsLongAttributeAttributeSetterForMainWorld(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "int get_ctty(pid_t pid, dev_t *ret_devnr, char **ret) { _cleanup_free_ char *fn = NULL, *b = NULL; dev_t devnr; int r; r = get_ctty_devnr(pid, &devnr); if (r < 0) return r; r = device_path_make_canonical(S_IFCHR, devnr, &fn); if (r < 0) { if (r != -ENOENT) /* No symlink for this in /dev/char/? */ return r; if (major(devnr) == 136) { /* This is an ugly hack: PTY devices are not listed in /dev/char/, as they don't follow the * Linux device model. This means we have no nice way to match them up against their actual * device node. Let's hence do the check by the fixed, assigned major number. Normally we try * to avoid such fixed major/minor matches, but there appears to nother nice way to handle * this. */ if (asprintf(&b, ""pts/%u"", minor(devnr)) < 0) return -ENOMEM; } else { /* Probably something similar to the ptys which have no symlink in /dev/char/. Let's return * something vaguely useful. */ r = device_path_make_major_minor(S_IFCHR, devnr, &fn); if (r < 0) return r; } } if (!b) { const char *w; w = path_startswith(fn, ""/dev/""); if (w) { b = strdup(w); if (!b) return -ENOMEM; } else b = TAKE_PTR(fn); } if (ret) *ret = TAKE_PTR(b); if (ret_devnr) *ret_devnr = devnr; return 0; } ",0 " void dump_mm(const struct mm_struct *mm) { pr_emerg(""mm %px mmap %px seqnum %d task_size %lu\n"" #ifdef CONFIG_MMU ""get_unmapped_area %px\n"" #endif ""mmap_base %lu mmap_legacy_base %lu highest_vm_end %lu\n"" ""pgd %px mm_users %d mm_count %d pgtables_bytes %lu map_count %d\n"" ""hiwater_rss %lx hiwater_vm %lx total_vm %lx locked_vm %lx\n"" ""pinned_vm %lx data_vm %lx exec_vm %lx stack_vm %lx\n"" ""start_code %lx end_code %lx start_data %lx end_data %lx\n"" ""start_brk %lx brk %lx start_stack %lx\n"" ""arg_start %lx arg_end %lx env_start %lx env_end %lx\n"" ""binfmt %px flags %lx core_state %px\n"" #ifdef CONFIG_AIO ""ioctx_table %px\n"" #endif #ifdef CONFIG_MEMCG ""owner %px "" #endif ""exe_file %px\n"" #ifdef CONFIG_MMU_NOTIFIER ""mmu_notifier_mm %px\n"" #endif #ifdef CONFIG_NUMA_BALANCING ""numa_next_scan %lu numa_scan_offset %lu numa_scan_seq %d\n"" #endif ""tlb_flush_pending %d\n"" ""def_flags: %#lx(%pGv)\n"", mm, mm->mmap, mm->vmacache_seqnum, mm->task_size, #ifdef CONFIG_MMU mm->get_unmapped_area, #endif mm->mmap_base, mm->mmap_legacy_base, mm->highest_vm_end, mm->pgd, atomic_read(&mm->mm_users), atomic_read(&mm->mm_count), mm_pgtables_bytes(mm), mm->map_count, mm->hiwater_rss, mm->hiwater_vm, mm->total_vm, mm->locked_vm, mm->pinned_vm, mm->data_vm, mm->exec_vm, mm->stack_vm, mm->start_code, mm->end_code, mm->start_data, mm->end_data, mm->start_brk, mm->brk, mm->start_stack, mm->arg_start, mm->arg_end, mm->env_start, mm->env_end, mm->binfmt, mm->flags, mm->core_state, #ifdef CONFIG_AIO mm->ioctx_table, #endif #ifdef CONFIG_MEMCG mm->owner, #endif mm->exe_file, #ifdef CONFIG_MMU_NOTIFIER mm->mmu_notifier_mm, #endif #ifdef CONFIG_NUMA_BALANCING mm->numa_next_scan, mm->numa_scan_offset, mm->numa_scan_seq, #endif atomic_read(&mm->tlb_flush_pending), mm->def_flags, &mm->def_flags ); } ",1 "AXNode* AXTree::GetFromId(int32_t id) const { auto iter = id_map_.find(id); return iter != id_map_.end() ? iter->second : nullptr; } ",0 "poppler_page_transition_copy (PopplerPageTransition *transition) { PopplerPageTransition *new_transition; new_transition = poppler_page_transition_new (); *new_transition = *transition; return new_transition; } ",0 " GetSyncableServiceForType(syncer::ModelType type) { if (!profile_) { // For tests. return base::WeakPtr(); } switch (type) { case syncer::PREFERENCES: return PrefServiceSyncable::FromProfile( profile_)->GetSyncableService()->AsWeakPtr(); case syncer::AUTOFILL: case syncer::AUTOFILL_PROFILE: { if (!web_data_service_.get()) return base::WeakPtr(); if (type == syncer::AUTOFILL) { return AutocompleteSyncableService::FromWebDataService( web_data_service_)->AsWeakPtr(); } else { return AutofillProfileSyncableService::FromWebDataService( web_data_service_)->AsWeakPtr(); } } case syncer::APPS: case syncer::EXTENSIONS: return extension_system_->extension_service()->AsWeakPtr(); case syncer::SEARCH_ENGINES: return TemplateURLServiceFactory::GetForProfile(profile_)->AsWeakPtr(); case syncer::APP_SETTINGS: case syncer::EXTENSION_SETTINGS: return extension_system_->extension_service()->settings_frontend()-> GetBackendForSync(type)->AsWeakPtr(); #if defined(ENABLE_THEMES) case syncer::THEMES: return ThemeServiceFactory::GetForProfile(profile_)-> GetThemeSyncableService()->AsWeakPtr(); #endif case syncer::HISTORY_DELETE_DIRECTIVES: { HistoryService* history = HistoryServiceFactory::GetForProfile( profile_, Profile::EXPLICIT_ACCESS); return history ? history->AsWeakPtr() : base::WeakPtr(); } #if !defined(OS_ANDROID) case syncer::SYNCED_NOTIFICATIONS: { notifier::ChromeNotifierService* notifier_service = notifier::ChromeNotifierServiceFactory::GetForProfile( profile_, Profile::EXPLICIT_ACCESS); return notifier_service ? notifier_service->AsWeakPtr() : base::WeakPtr(); } #endif case syncer::DICTIONARY: return SpellcheckServiceFactory::GetForProfile(profile_)-> GetCustomDictionary()->AsWeakPtr(); case syncer::FAVICON_IMAGES: case syncer::FAVICON_TRACKING: return ProfileSyncServiceFactory::GetForProfile(profile_)-> GetSessionModelAssociator()->GetFaviconCache()->AsWeakPtr(); default: NOTREACHED(); return base::WeakPtr(); } } ",0 "simple_error (void) { DBusMessage *message; message = dbus_message_new (DBUS_MESSAGE_TYPE_ERROR); if (message == NULL) _dbus_assert_not_reached (""oom""); if (!dbus_message_set_error_name (message, ""foo.bar"")) _dbus_assert_not_reached (""oom""); set_reply_serial (message); return message; } ",0 "linux_md_create_device_not_seen_cb (gpointer user_data) { LinuxMdCreateData *data = user_data; throw_error (data->context, ERROR_FAILED, ""Error assembling array: timeout (10s) waiting for array to show up""); g_signal_handler_disconnect (data->daemon, data->device_added_signal_handler_id); linux_md_create_data_unref (data); return FALSE; } ",0 "static void vfio_pci_remove(struct pci_dev *pdev) { struct vfio_pci_device *vdev; vdev = vfio_del_group_dev(&pdev->dev); if (!vdev) return; vfio_iommu_group_put(pdev->dev.iommu_group, &pdev->dev); kfree(vdev->region); kfree(vdev); if (vfio_pci_is_vga(pdev)) { vga_client_register(pdev, NULL, NULL, NULL); vga_set_legacy_decoding(pdev, VGA_RSRC_NORMAL_IO | VGA_RSRC_NORMAL_MEM | VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM); } if (!disable_idle_d3) pci_set_power_state(pdev, PCI_D0); } ",0 "static ssize_t macvtap_put_user(struct macvtap_queue *q, const struct sk_buff *skb, const struct iovec *iv, int len) { struct macvlan_dev *vlan; int ret; int vnet_hdr_len = 0; if (q->flags & IFF_VNET_HDR) { struct virtio_net_hdr vnet_hdr; vnet_hdr_len = q->vnet_hdr_sz; if ((len -= vnet_hdr_len) < 0) return -EINVAL; ret = macvtap_skb_to_vnet_hdr(skb, &vnet_hdr); if (ret) return ret; if (memcpy_toiovecend(iv, (void *)&vnet_hdr, 0, sizeof(vnet_hdr))) return -EFAULT; } len = min_t(int, skb->len, len); ret = skb_copy_datagram_const_iovec(skb, 0, iv, vnet_hdr_len, len); rcu_read_lock_bh(); vlan = rcu_dereference_bh(q->vlan); if (vlan) macvlan_count_rx(vlan, len, ret == 0, 0); rcu_read_unlock_bh(); return ret ? ret : (len + vnet_hdr_len); } ",0 "static int set_journal_csum_feature_set(struct super_block *sb) { int ret = 1; int compat, incompat; struct ext4_sb_info *sbi = EXT4_SB(sb); if (ext4_has_metadata_csum(sb)) { /* journal checksum v3 */ compat = 0; incompat = JBD2_FEATURE_INCOMPAT_CSUM_V3; } else { /* journal checksum v1 */ compat = JBD2_FEATURE_COMPAT_CHECKSUM; incompat = 0; } jbd2_journal_clear_features(sbi->s_journal, JBD2_FEATURE_COMPAT_CHECKSUM, 0, JBD2_FEATURE_INCOMPAT_CSUM_V3 | JBD2_FEATURE_INCOMPAT_CSUM_V2); if (test_opt(sb, JOURNAL_ASYNC_COMMIT)) { ret = jbd2_journal_set_features(sbi->s_journal, compat, 0, JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT | incompat); } else if (test_opt(sb, JOURNAL_CHECKSUM)) { ret = jbd2_journal_set_features(sbi->s_journal, compat, 0, incompat); jbd2_journal_clear_features(sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT); } else { jbd2_journal_clear_features(sbi->s_journal, 0, 0, JBD2_FEATURE_INCOMPAT_ASYNC_COMMIT); } return ret; } ",0 "static int ext4_dax_pmd_fault(struct vm_area_struct *vma, unsigned long addr, pmd_t *pmd, unsigned int flags) { int result; handle_t *handle = NULL; struct inode *inode = file_inode(vma->vm_file); struct super_block *sb = inode->i_sb; bool write = flags & FAULT_FLAG_WRITE; if (write) { sb_start_pagefault(sb); file_update_time(vma->vm_file); handle = ext4_journal_start_sb(sb, EXT4_HT_WRITE_PAGE, ext4_chunk_trans_blocks(inode, PMD_SIZE / PAGE_SIZE)); } if (IS_ERR(handle)) result = VM_FAULT_SIGBUS; else result = __dax_pmd_fault(vma, addr, pmd, flags, ext4_get_block_dax, ext4_end_io_unwritten); if (write) { if (!IS_ERR(handle)) ext4_journal_stop(handle); sb_end_pagefault(sb); } return result; } ",1 "error::Error GLES2DecoderPassthroughImpl::DoUniform3iv( GLint location, GLsizei count, const volatile GLint* v) { api()->glUniform3ivFn(location, count, const_cast(v)); return error::kNoError; } ",0 "static void ReflectBooleanAttributeAttributeSetter( v8::Local v8_value, const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); V0CustomElementProcessingStack::CallbackDeliveryScope delivery_scope; ExceptionState exception_state(isolate, ExceptionState::kSetterContext, ""TestObject"", ""reflectBooleanAttribute""); bool cpp_value = NativeValueTraits::NativeValue(info.GetIsolate(), v8_value, exception_state); if (exception_state.HadException()) return; impl->SetBooleanAttribute(html_names::kReflectbooleanattributeAttr, cpp_value); } ",0 "IMPEG2D_ERROR_CODES_T impeg2d_dec_seq_ext_data(dec_state_t *ps_dec) { stream_t *ps_stream; UWORD32 u4_start_code; IMPEG2D_ERROR_CODES_T e_error; e_error = (IMPEG2D_ERROR_CODES_T) IVD_ERROR_NONE; ps_stream = &ps_dec->s_bit_stream; u4_start_code = impeg2d_bit_stream_nxt(ps_stream,START_CODE_LEN); while( (u4_start_code == EXTENSION_START_CODE || u4_start_code == USER_DATA_START_CODE) && (IMPEG2D_ERROR_CODES_T)IVD_ERROR_NONE == e_error) { if(u4_start_code == USER_DATA_START_CODE) { impeg2d_dec_user_data(ps_dec); } else { impeg2d_bit_stream_flush(ps_stream,START_CODE_LEN); u4_start_code = impeg2d_bit_stream_nxt(ps_stream,EXT_ID_LEN); switch(u4_start_code) { case SEQ_DISPLAY_EXT_ID: impeg2d_dec_seq_disp_ext(ps_dec); break; case SEQ_SCALABLE_EXT_ID: e_error = IMPEG2D_SCALABILITIY_NOT_SUPPORTED; break; default: /* In case its a reserved extension code */ impeg2d_bit_stream_flush(ps_stream,EXT_ID_LEN); impeg2d_peek_next_start_code(ps_dec); break; } } u4_start_code = impeg2d_bit_stream_nxt(ps_stream,START_CODE_LEN); } return e_error; } ",1 "Browser::CreateParams Browser::CreateParams::CreateForApp( const std::string& app_name, bool trusted_source, const gfx::Rect& window_bounds, Profile* profile, bool user_gesture) { DCHECK(!app_name.empty()); CreateParams params(TYPE_POPUP, profile, user_gesture); params.app_name = app_name; params.trusted_source = trusted_source; params.initial_bounds = window_bounds; return params; } ",0 "static void _ht_node_free_kv(HtKv *kv) { free (kv->key); free (kv); } ",0 "BOOL update_bounds_is_null(rdpBounds* bounds) { if ((bounds->left == 0) && (bounds->top == 0) && (bounds->right == 0) && (bounds->bottom == 0)) return TRUE; return FALSE; } ",0 "WORD32 ih264d_start_of_pic(dec_struct_t *ps_dec, WORD32 i4_poc, pocstruct_t *ps_temp_poc, UWORD16 u2_frame_num, dec_pic_params_t *ps_pps) { pocstruct_t *ps_prev_poc = &ps_dec->s_cur_pic_poc; pocstruct_t *ps_cur_poc = ps_temp_poc; pic_buffer_t *pic_buf; ivd_video_decode_op_t * ps_dec_output = (ivd_video_decode_op_t *)ps_dec->pv_dec_out; dec_slice_params_t *ps_cur_slice = ps_dec->ps_cur_slice; dec_seq_params_t *ps_seq = ps_pps->ps_sps; UWORD8 u1_bottom_field_flag = ps_cur_slice->u1_bottom_field_flag; UWORD8 u1_field_pic_flag = ps_cur_slice->u1_field_pic_flag; /* high profile related declarations */ high_profile_tools_t s_high_profile; WORD32 ret; H264_MUTEX_LOCK(&ps_dec->process_disp_mutex); ps_prev_poc->i4_pic_order_cnt_lsb = ps_cur_poc->i4_pic_order_cnt_lsb; ps_prev_poc->i4_pic_order_cnt_msb = ps_cur_poc->i4_pic_order_cnt_msb; ps_prev_poc->i4_delta_pic_order_cnt_bottom = ps_cur_poc->i4_delta_pic_order_cnt_bottom; ps_prev_poc->i4_delta_pic_order_cnt[0] = ps_cur_poc->i4_delta_pic_order_cnt[0]; ps_prev_poc->i4_delta_pic_order_cnt[1] = ps_cur_poc->i4_delta_pic_order_cnt[1]; ps_prev_poc->u1_bot_field = ps_dec->ps_cur_slice->u1_bottom_field_flag; ps_prev_poc->i4_prev_frame_num_ofst = ps_cur_poc->i4_prev_frame_num_ofst; ps_prev_poc->u2_frame_num = u2_frame_num; ps_dec->i1_prev_mb_qp_delta = 0; ps_dec->i1_next_ctxt_idx = 0; ps_dec->u4_nmb_deblk = 0; if(ps_dec->u4_num_cores == 1) ps_dec->u4_nmb_deblk = 1; if(ps_seq->u1_mb_aff_flag == 1) { ps_dec->u4_nmb_deblk = 0; if(ps_dec->u4_num_cores > 2) ps_dec->u4_num_cores = 2; } ps_dec->u4_use_intrapred_line_copy = 0; if (ps_seq->u1_mb_aff_flag == 0) { ps_dec->u4_use_intrapred_line_copy = 1; } ps_dec->u4_app_disable_deblk_frm = 0; /* If degrade is enabled, set the degrade flags appropriately */ if(ps_dec->i4_degrade_type && ps_dec->i4_degrade_pics) { WORD32 degrade_pic; ps_dec->i4_degrade_pic_cnt++; degrade_pic = 0; /* If degrade is to be done in all frames, then do not check further */ switch(ps_dec->i4_degrade_pics) { case 4: { degrade_pic = 1; break; } case 3: { if(ps_cur_slice->u1_slice_type != I_SLICE) degrade_pic = 1; break; } case 2: { /* If pic count hits non-degrade interval or it is an islice, then do not degrade */ if((ps_cur_slice->u1_slice_type != I_SLICE) && (ps_dec->i4_degrade_pic_cnt != ps_dec->i4_nondegrade_interval)) degrade_pic = 1; break; } case 1: { /* Check if the current picture is non-ref */ if(0 == ps_cur_slice->u1_nal_ref_idc) { degrade_pic = 1; } break; } } if(degrade_pic) { if(ps_dec->i4_degrade_type & 0x2) ps_dec->u4_app_disable_deblk_frm = 1; /* MC degrading is done only for non-ref pictures */ if(0 == ps_cur_slice->u1_nal_ref_idc) { if(ps_dec->i4_degrade_type & 0x4) ps_dec->i4_mv_frac_mask = 0; if(ps_dec->i4_degrade_type & 0x8) ps_dec->i4_mv_frac_mask = 0; } } else ps_dec->i4_degrade_pic_cnt = 0; } { dec_err_status_t * ps_err = ps_dec->ps_dec_err_status; if(ps_dec->u1_sl_typ_5_9 && ((ps_cur_slice->u1_slice_type == I_SLICE) || (ps_cur_slice->u1_slice_type == SI_SLICE))) ps_err->u1_cur_pic_type = PIC_TYPE_I; else ps_err->u1_cur_pic_type = PIC_TYPE_UNKNOWN; if(ps_err->u1_pic_aud_i == PIC_TYPE_I) { ps_err->u1_cur_pic_type = PIC_TYPE_I; ps_err->u1_pic_aud_i = PIC_TYPE_UNKNOWN; } if(ps_cur_slice->u1_nal_unit_type == IDR_SLICE_NAL) { if(ps_err->u1_err_flag) ih264d_reset_ref_bufs(ps_dec->ps_dpb_mgr); ps_err->u1_err_flag = ACCEPT_ALL_PICS; } } if(ps_dec->u1_init_dec_flag && ps_dec->s_prev_seq_params.u1_eoseq_pending) { /* Reset the decoder picture buffers */ WORD32 j; for(j = 0; j < MAX_DISP_BUFS_NEW; j++) { ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, j, BUF_MGR_REF); ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, ps_dec->au1_pic_buf_id_mv_buf_id_map[j], BUF_MGR_REF); ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, j, BUF_MGR_IO); } /* reset the decoder structure parameters related to buffer handling */ ps_dec->u1_second_field = 0; ps_dec->i4_cur_display_seq = 0; /********************************************************************/ /* indicate in the decoder output i4_status that some frames are being */ /* dropped, so that it resets timestamp and wait for a new sequence */ /********************************************************************/ ps_dec->s_prev_seq_params.u1_eoseq_pending = 0; } ret = ih264d_init_pic(ps_dec, u2_frame_num, i4_poc, ps_pps); if(ret != OK) return ret; ps_dec->pv_parse_tu_coeff_data = ps_dec->pv_pic_tu_coeff_data; ps_dec->pv_proc_tu_coeff_data = ps_dec->pv_pic_tu_coeff_data; ps_dec->ps_nmb_info = ps_dec->ps_frm_mb_info; if(ps_dec->u1_separate_parse) { UWORD16 pic_wd = ps_dec->u4_width_at_init; UWORD16 pic_ht = ps_dec->u4_height_at_init; UWORD32 num_mbs; if((NULL != ps_dec->ps_cur_sps) && (1 == (ps_dec->ps_cur_sps->u1_is_valid))) { pic_wd = ps_dec->u2_pic_wd; pic_ht = ps_dec->u2_pic_ht; } num_mbs = (pic_wd * pic_ht) >> 8; if(ps_dec->pu1_dec_mb_map) { memset((void *)ps_dec->pu1_dec_mb_map, 0, num_mbs); } if(ps_dec->pu1_recon_mb_map) { memset((void *)ps_dec->pu1_recon_mb_map, 0, num_mbs); } if(ps_dec->pu2_slice_num_map) { memset((void *)ps_dec->pu2_slice_num_map, 0, (num_mbs * sizeof(UWORD16))); } } ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); ps_dec->u2_cur_slice_num = 0; /* Initialize all the HP toolsets to zero */ ps_dec->s_high_profile.u1_scaling_present = 0; ps_dec->s_high_profile.u1_transform8x8_present = 0; /* Get Next Free Picture */ if(1 == ps_dec->u4_share_disp_buf) { UWORD32 i; /* Free any buffer that is in the queue to be freed */ for(i = 0; i < MAX_DISP_BUFS_NEW; i++) { if(0 == ps_dec->u4_disp_buf_to_be_freed[i]) continue; ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, i, BUF_MGR_IO); ps_dec->u4_disp_buf_to_be_freed[i] = 0; ps_dec->u4_disp_buf_mapping[i] = 0; } } if(!(u1_field_pic_flag && 0 != ps_dec->u1_top_bottom_decoded)) //ps_dec->u1_second_field)) { pic_buffer_t *ps_cur_pic; WORD32 cur_pic_buf_id, cur_mv_buf_id; col_mv_buf_t *ps_col_mv; while(1) { ps_cur_pic = (pic_buffer_t *)ih264_buf_mgr_get_next_free( (buf_mgr_t *)ps_dec->pv_pic_buf_mgr, &cur_pic_buf_id); if(ps_cur_pic == NULL) { ps_dec->i4_error_code = ERROR_UNAVAIL_PICBUF_T; return ERROR_UNAVAIL_PICBUF_T; } if(0 == ps_dec->u4_disp_buf_mapping[cur_pic_buf_id]) { break; } } ps_col_mv = (col_mv_buf_t *)ih264_buf_mgr_get_next_free((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, &cur_mv_buf_id); if(ps_col_mv == NULL) { ps_dec->i4_error_code = ERROR_UNAVAIL_MVBUF_T; return ERROR_UNAVAIL_MVBUF_T; } ps_dec->ps_cur_pic = ps_cur_pic; ps_dec->u1_pic_buf_id = cur_pic_buf_id; ps_cur_pic->u4_ts = ps_dec->u4_ts; ps_cur_pic->u1_mv_buf_id = cur_mv_buf_id; ps_dec->au1_pic_buf_id_mv_buf_id_map[cur_pic_buf_id] = cur_mv_buf_id; ps_cur_pic->pu1_col_zero_flag = (UWORD8 *)ps_col_mv->pv_col_zero_flag; ps_cur_pic->ps_mv = (mv_pred_t *)ps_col_mv->pv_mv; ps_dec->au1_pic_buf_ref_flag[cur_pic_buf_id] = 0; if(ps_dec->u1_first_slice_in_stream) { /*make first entry of list0 point to cur pic,so that if first Islice is in error, ref pic struct will have valid entries*/ ps_dec->ps_ref_pic_buf_lx[0] = ps_dec->ps_dpb_mgr->ps_init_dpb[0]; *(ps_dec->ps_dpb_mgr->ps_init_dpb[0][0]) = *ps_cur_pic; /* Initialize for field reference as well */ *(ps_dec->ps_dpb_mgr->ps_init_dpb[0][MAX_REF_BUFS]) = *ps_cur_pic; } if(!ps_dec->ps_cur_pic) { WORD32 j; H264_DEC_DEBUG_PRINT(""------- Display Buffers Reset --------\n""); for(j = 0; j < MAX_DISP_BUFS_NEW; j++) { ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, j, BUF_MGR_REF); ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, ps_dec->au1_pic_buf_id_mv_buf_id_map[j], BUF_MGR_REF); ih264_buf_mgr_release((buf_mgr_t *)ps_dec->pv_pic_buf_mgr, j, BUF_MGR_IO); } ps_dec->i4_cur_display_seq = 0; ps_dec->i4_prev_max_display_seq = 0; ps_dec->i4_max_poc = 0; ps_cur_pic = (pic_buffer_t *)ih264_buf_mgr_get_next_free( (buf_mgr_t *)ps_dec->pv_pic_buf_mgr, &cur_pic_buf_id); if(ps_cur_pic == NULL) { ps_dec->i4_error_code = ERROR_UNAVAIL_PICBUF_T; return ERROR_UNAVAIL_PICBUF_T; } ps_col_mv = (col_mv_buf_t *)ih264_buf_mgr_get_next_free((buf_mgr_t *)ps_dec->pv_mv_buf_mgr, &cur_mv_buf_id); if(ps_col_mv == NULL) { ps_dec->i4_error_code = ERROR_UNAVAIL_MVBUF_T; return ERROR_UNAVAIL_MVBUF_T; } ps_dec->ps_cur_pic = ps_cur_pic; ps_dec->u1_pic_buf_id = cur_pic_buf_id; ps_cur_pic->u4_ts = ps_dec->u4_ts; ps_dec->apv_buf_id_pic_buf_map[cur_pic_buf_id] = (void *)ps_cur_pic; ps_cur_pic->u1_mv_buf_id = cur_mv_buf_id; ps_dec->au1_pic_buf_id_mv_buf_id_map[cur_pic_buf_id] = cur_mv_buf_id; ps_cur_pic->pu1_col_zero_flag = (UWORD8 *)ps_col_mv->pv_col_zero_flag; ps_cur_pic->ps_mv = (mv_pred_t *)ps_col_mv->pv_mv; ps_dec->au1_pic_buf_ref_flag[cur_pic_buf_id] = 0; } ps_dec->ps_cur_pic->u1_picturetype = u1_field_pic_flag; ps_dec->ps_cur_pic->u4_pack_slc_typ = SKIP_NONE; H264_DEC_DEBUG_PRINT(""got a buffer\n""); } else { H264_DEC_DEBUG_PRINT(""did not get a buffer\n""); } ps_dec->u4_pic_buf_got = 1; ps_dec->ps_cur_pic->i4_poc = i4_poc; ps_dec->ps_cur_pic->i4_frame_num = u2_frame_num; ps_dec->ps_cur_pic->i4_pic_num = u2_frame_num; ps_dec->ps_cur_pic->i4_top_field_order_cnt = ps_pps->i4_top_field_order_cnt; ps_dec->ps_cur_pic->i4_bottom_field_order_cnt = ps_pps->i4_bottom_field_order_cnt; ps_dec->ps_cur_pic->i4_avg_poc = ps_pps->i4_avg_poc; ps_dec->ps_cur_pic->u4_time_stamp = ps_dec->u4_pts; ps_dec->s_cur_pic = *(ps_dec->ps_cur_pic); if(u1_field_pic_flag && u1_bottom_field_flag) { WORD32 i4_temp_poc; WORD32 i4_top_field_order_poc, i4_bot_field_order_poc; /* Point to odd lines, since it's bottom field */ ps_dec->s_cur_pic.pu1_buf1 += ps_dec->s_cur_pic.u2_frm_wd_y; ps_dec->s_cur_pic.pu1_buf2 += ps_dec->s_cur_pic.u2_frm_wd_uv; ps_dec->s_cur_pic.pu1_buf3 += ps_dec->s_cur_pic.u2_frm_wd_uv; ps_dec->s_cur_pic.ps_mv += ((ps_dec->u2_pic_ht * ps_dec->u2_pic_wd) >> 5); ps_dec->s_cur_pic.pu1_col_zero_flag += ((ps_dec->u2_pic_ht * ps_dec->u2_pic_wd) >> 5); ps_dec->ps_cur_pic->u1_picturetype |= BOT_FLD; i4_top_field_order_poc = ps_dec->ps_cur_pic->i4_top_field_order_cnt; i4_bot_field_order_poc = ps_dec->ps_cur_pic->i4_bottom_field_order_cnt; i4_temp_poc = MIN(i4_top_field_order_poc, i4_bot_field_order_poc); ps_dec->ps_cur_pic->i4_avg_poc = i4_temp_poc; } ps_cur_slice->u1_mbaff_frame_flag = ps_seq->u1_mb_aff_flag && (!u1_field_pic_flag); ps_dec->ps_cur_pic->u1_picturetype |= (ps_cur_slice->u1_mbaff_frame_flag << 2); ps_dec->ps_cur_mb_row = ps_dec->ps_nbr_mb_row; //[0]; ps_dec->ps_cur_mb_row++; //Increment by 1 ,so that left mb will always be valid ps_dec->ps_top_mb_row = ps_dec->ps_nbr_mb_row + ((ps_dec->u2_frm_wd_in_mbs + 1) << (1 - ps_dec->ps_cur_sps->u1_frame_mbs_only_flag)); ps_dec->ps_top_mb_row++; //Increment by 1 ,so that left mb will always be valid ps_dec->pu1_y = ps_dec->pu1_y_scratch[0]; ps_dec->pu1_u = ps_dec->pu1_u_scratch[0]; ps_dec->pu1_v = ps_dec->pu1_v_scratch[0]; ps_dec->u1_yuv_scratch_idx = 0; /* CHANGED CODE */ ps_dec->ps_mv_cur = ps_dec->s_cur_pic.ps_mv; ps_dec->ps_mv_top = ps_dec->ps_mv_top_p[0]; /* CHANGED CODE */ ps_dec->u1_mv_top_p = 0; ps_dec->u1_mb_idx = 0; /* CHANGED CODE */ ps_dec->ps_mv_left = ps_dec->s_cur_pic.ps_mv; ps_dec->pu1_yleft = 0; ps_dec->pu1_uleft = 0; ps_dec->pu1_vleft = 0; ps_dec->u1_not_wait_rec = 2; ps_dec->u2_total_mbs_coded = 0; ps_dec->i4_submb_ofst = -(SUB_BLK_SIZE); ps_dec->u4_pred_info_idx = 0; ps_dec->u4_pred_info_pkd_idx = 0; ps_dec->u4_dma_buf_idx = 0; ps_dec->ps_mv = ps_dec->s_cur_pic.ps_mv; ps_dec->ps_mv_bank_cur = ps_dec->s_cur_pic.ps_mv; ps_dec->pu1_col_zero_flag = ps_dec->s_cur_pic.pu1_col_zero_flag; ps_dec->ps_part = ps_dec->ps_parse_part_params; ps_dec->i2_prev_slice_mbx = -1; ps_dec->i2_prev_slice_mby = 0; ps_dec->u2_mv_2mb[0] = 0; ps_dec->u2_mv_2mb[1] = 0; ps_dec->u1_last_pic_not_decoded = 0; ps_dec->u2_cur_slice_num_dec_thread = 0; ps_dec->u2_cur_slice_num_bs = 0; ps_dec->u4_intra_pred_line_ofst = 0; ps_dec->pu1_cur_y_intra_pred_line = ps_dec->pu1_y_intra_pred_line; ps_dec->pu1_cur_u_intra_pred_line = ps_dec->pu1_u_intra_pred_line; ps_dec->pu1_cur_v_intra_pred_line = ps_dec->pu1_v_intra_pred_line; ps_dec->pu1_cur_y_intra_pred_line_base = ps_dec->pu1_y_intra_pred_line; ps_dec->pu1_cur_u_intra_pred_line_base = ps_dec->pu1_u_intra_pred_line; ps_dec->pu1_cur_v_intra_pred_line_base = ps_dec->pu1_v_intra_pred_line; ps_dec->pu1_prev_y_intra_pred_line = ps_dec->pu1_y_intra_pred_line + (ps_dec->u2_frm_wd_in_mbs * MB_SIZE); ps_dec->pu1_prev_u_intra_pred_line = ps_dec->pu1_u_intra_pred_line + ps_dec->u2_frm_wd_in_mbs * BLK8x8SIZE * YUV420SP_FACTOR; ps_dec->pu1_prev_v_intra_pred_line = ps_dec->pu1_v_intra_pred_line + ps_dec->u2_frm_wd_in_mbs * BLK8x8SIZE; ps_dec->ps_deblk_mbn = ps_dec->ps_deblk_pic; ps_dec->ps_deblk_mbn_curr = ps_dec->ps_deblk_mbn; ps_dec->ps_deblk_mbn_prev = ps_dec->ps_deblk_mbn + ps_dec->u1_recon_mb_grp; /* Initialize The Function Pointer Depending Upon the Entropy and MbAff Flag */ { if(ps_cur_slice->u1_mbaff_frame_flag) { ps_dec->pf_compute_bs = ih264d_compute_bs_mbaff; ps_dec->pf_mvpred = ih264d_mvpred_mbaff; } else { ps_dec->pf_compute_bs = ih264d_compute_bs_non_mbaff; ps_dec->u1_cur_mb_fld_dec_flag = ps_cur_slice->u1_field_pic_flag; } } /* Set up the Parameter for DMA transfer */ { UWORD8 u1_field_pic_flag = ps_dec->ps_cur_slice->u1_field_pic_flag; UWORD8 u1_mbaff = ps_cur_slice->u1_mbaff_frame_flag; UWORD8 uc_lastmbs = (((ps_dec->u2_pic_wd) >> 4) % (ps_dec->u1_recon_mb_grp >> u1_mbaff)); UWORD16 ui16_lastmbs_widthY = (uc_lastmbs ? (uc_lastmbs << 4) : ((ps_dec->u1_recon_mb_grp >> u1_mbaff) << 4)); UWORD16 ui16_lastmbs_widthUV = uc_lastmbs ? (uc_lastmbs << 3) : ((ps_dec->u1_recon_mb_grp >> u1_mbaff) << 3); ps_dec->s_tran_addrecon.pu1_dest_y = ps_dec->s_cur_pic.pu1_buf1; ps_dec->s_tran_addrecon.pu1_dest_u = ps_dec->s_cur_pic.pu1_buf2; ps_dec->s_tran_addrecon.pu1_dest_v = ps_dec->s_cur_pic.pu1_buf3; ps_dec->s_tran_addrecon.u2_frm_wd_y = ps_dec->u2_frm_wd_y << u1_field_pic_flag; ps_dec->s_tran_addrecon.u2_frm_wd_uv = ps_dec->u2_frm_wd_uv << u1_field_pic_flag; if(u1_field_pic_flag) { ui16_lastmbs_widthY += ps_dec->u2_frm_wd_y; ui16_lastmbs_widthUV += ps_dec->u2_frm_wd_uv; } /* Normal Increment of Pointer */ ps_dec->s_tran_addrecon.u4_inc_y[0] = ((ps_dec->u1_recon_mb_grp << 4) >> u1_mbaff); ps_dec->s_tran_addrecon.u4_inc_uv[0] = ((ps_dec->u1_recon_mb_grp << 4) >> u1_mbaff); /* End of Row Increment */ ps_dec->s_tran_addrecon.u4_inc_y[1] = (ui16_lastmbs_widthY + (PAD_LEN_Y_H << 1) + ps_dec->s_tran_addrecon.u2_frm_wd_y * ((15 << u1_mbaff) + u1_mbaff)); ps_dec->s_tran_addrecon.u4_inc_uv[1] = (ui16_lastmbs_widthUV + (PAD_LEN_UV_H << 2) + ps_dec->s_tran_addrecon.u2_frm_wd_uv * ((15 << u1_mbaff) + u1_mbaff)); /* Assign picture numbers to each frame/field */ /* only once per picture. */ ih264d_assign_pic_num(ps_dec); ps_dec->s_tran_addrecon.u2_mv_top_left_inc = (ps_dec->u1_recon_mb_grp << 2) - 1 - (u1_mbaff << 2); ps_dec->s_tran_addrecon.u2_mv_left_inc = ((ps_dec->u1_recon_mb_grp >> u1_mbaff) - 1) << (4 + u1_mbaff); } /**********************************************************************/ /* High profile related initialization at pictrue level */ /**********************************************************************/ if(ps_seq->u1_profile_idc == HIGH_PROFILE_IDC) { if((ps_seq->i4_seq_scaling_matrix_present_flag) || (ps_pps->i4_pic_scaling_matrix_present_flag)) { ih264d_form_scaling_matrix_picture(ps_seq, ps_pps, ps_dec); ps_dec->s_high_profile.u1_scaling_present = 1; } else { ih264d_form_default_scaling_matrix(ps_dec); } if(ps_pps->i4_transform_8x8_mode_flag) { ps_dec->s_high_profile.u1_transform8x8_present = 1; } } else { ih264d_form_default_scaling_matrix(ps_dec); } /* required while reading the transform_size_8x8 u4_flag */ ps_dec->s_high_profile.u1_direct_8x8_inference_flag = ps_seq->u1_direct_8x8_inference_flag; ps_dec->s_high_profile.s_cavlc_ctxt = ps_dec->s_cavlc_ctxt; ps_dec->i1_recon_in_thread3_flag = 1; ps_dec->ps_frame_buf_ip_recon = &ps_dec->s_tran_addrecon; if(ps_dec->u1_separate_parse) { memcpy(&ps_dec->s_tran_addrecon_parse, &ps_dec->s_tran_addrecon, sizeof(tfr_ctxt_t)); if(ps_dec->u4_num_cores >= 3 && ps_dec->i1_recon_in_thread3_flag) { memcpy(&ps_dec->s_tran_iprecon, &ps_dec->s_tran_addrecon, sizeof(tfr_ctxt_t)); ps_dec->ps_frame_buf_ip_recon = &ps_dec->s_tran_iprecon; } } ih264d_init_deblk_tfr_ctxt(ps_dec,&(ps_dec->s_pad_mgr), &(ps_dec->s_tran_addrecon), ps_dec->u2_frm_wd_in_mbs, 0); ps_dec->ps_cur_deblk_mb = ps_dec->ps_deblk_pic; ps_dec->u4_cur_deblk_mb_num = 0; ps_dec->u4_deblk_mb_x = 0; ps_dec->u4_deblk_mb_y = 0; ps_dec->pu4_wt_ofsts = ps_dec->pu4_wts_ofsts_mat; H264_MUTEX_UNLOCK(&ps_dec->process_disp_mutex); return OK; } ",1 "f2flac16_clip_array (const float *src, int32_t *dest, int count, int normalize) { float normfact, scaled_value ; normfact = normalize ? (8.0 * 0x1000) : 1.0 ; while (--count >= 0) { scaled_value = src [count] * normfact ; if (CPU_CLIPS_POSITIVE == 0 && scaled_value >= (1.0 * 0x7FFF)) { dest [count] = 0x7FFF ; continue ; } ; if (CPU_CLIPS_NEGATIVE == 0 && scaled_value <= (-8.0 * 0x1000)) { dest [count] = 0x8000 ; continue ; } ; dest [count] = lrintf (scaled_value) ; } ; } /* f2flac16_clip_array */ ",0 " CaptionButtonModel(uint32_t visible_button_mask, uint32_t enabled_button_mask) : visible_button_mask_(visible_button_mask), enabled_button_mask_(enabled_button_mask) {} ",0 "int dev_set_mtu(struct net_device *dev, int new_mtu) { int err, orig_mtu; if (new_mtu == dev->mtu) return 0; /* MTU must be positive. */ if (new_mtu < 0) return -EINVAL; if (!netif_device_present(dev)) return -ENODEV; err = call_netdevice_notifiers(NETDEV_PRECHANGEMTU, dev); err = notifier_to_errno(err); if (err) return err; orig_mtu = dev->mtu; err = __dev_set_mtu(dev, new_mtu); if (!err) { err = call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); err = notifier_to_errno(err); if (err) { /* setting mtu back and notifying everyone again, * so that they have a chance to revert changes. */ __dev_set_mtu(dev, orig_mtu); call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); } } return err; } ",0 "char *cunescape_length(const char *s, size_t length) { char *r, *t; const char *f; assert(s); /* Undoes C style string escaping */ r = new(char, length+1); if (!r) return r; for (f = s, t = r; f < s + length; f++) { if (*f != '\\') { *(t++) = *f; continue; } f++; switch (*f) { case 'a': *(t++) = '\a'; break; case 'b': *(t++) = '\b'; break; case 'f': *(t++) = '\f'; break; case 'n': *(t++) = '\n'; break; case 'r': *(t++) = '\r'; break; case 't': *(t++) = '\t'; break; case 'v': *(t++) = '\v'; break; case '\\': *(t++) = '\\'; break; case '""': *(t++) = '""'; break; case '\'': *(t++) = '\''; break; case 's': /* This is an extension of the XDG syntax files */ *(t++) = ' '; break; case 'x': { /* hexadecimal encoding */ int a, b; a = unhexchar(f[1]); b = unhexchar(f[2]); if (a < 0 || b < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = 'x'; } else { *(t++) = (char) ((a << 4) | b); f += 2; } break; } case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': { /* octal encoding */ int a, b, c; a = unoctchar(f[0]); b = unoctchar(f[1]); c = unoctchar(f[2]); if (a < 0 || b < 0 || c < 0) { /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = f[0]; } else { *(t++) = (char) ((a << 6) | (b << 3) | c); f += 2; } break; } case 0: /* premature end of string.*/ *(t++) = '\\'; goto finish; default: /* Invalid escape code, let's take it literal then */ *(t++) = '\\'; *(t++) = *f; break; } } finish: *t = 0; return r; } ",0 " exsltCryptoPopString (xmlXPathParserContextPtr ctxt, int nargs, xmlChar ** str) { int str_len = 0; if ((nargs < 1) || (nargs > 2)) { xmlXPathSetArityError (ctxt); return 0; } *str = xmlXPathPopString (ctxt); str_len = xmlUTF8Strlen (*str); if (str_len == 0) { xmlXPathReturnEmptyString (ctxt); xmlFree (*str); return 0; } return str_len; } ",1 "generateReference(const char *custom1, const char *custom2) { static uint ref_counter = 0; const char *local_cust1 = custom1; const char *local_cust2 = custom2; int reference_len = 4; char *since_epoch = NULL; reference_len += 20; /* too big */ reference_len += 40; /* too big */ if (local_cust1 == NULL) { local_cust1 = ""_empty_""; } reference_len += strlen(local_cust1); if (local_cust2 == NULL) { local_cust2 = ""_empty_""; } reference_len += strlen(local_cust2); since_epoch = calloc(1, reference_len); if (since_epoch != NULL) { sprintf(since_epoch, ""%s-%s-%lu-%u"", local_cust1, local_cust2, (unsigned long)time(NULL), ref_counter++); } return since_epoch; } ",0 "static int alloc_ds_buffer(int cpu) { int node = cpu_to_node(cpu); struct debug_store *ds; ds = kmalloc_node(sizeof(*ds), GFP_KERNEL | __GFP_ZERO, node); if (unlikely(!ds)) return -ENOMEM; per_cpu(cpu_hw_events, cpu).ds = ds; return 0; } ",0 "ui::Clipboard* ClipboardMessageFilter::GetClipboard() { static ui::Clipboard* clipboard = new ui::Clipboard; return clipboard; } ",0 "void RenderFrameImpl::didChangeThemeColor() { if (frame_->parent()) return; Send(new FrameHostMsg_DidChangeThemeColor( routing_id_, frame_->document().themeColor())); } ",0 "void RenderFrameHostImpl::SetHasReceivedUserGesture() { Send(new FrameMsg_SetHasReceivedUserGesture(routing_id_)); } ",0 "static int logi_dj_reset_resume(struct hid_device *hdev) { int retval; struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev); retval = logi_dj_recv_switch_to_dj_mode(djrcv_dev, 0); if (retval < 0) { dev_err(&hdev->dev, ""%s:logi_dj_recv_switch_to_dj_mode returned error:%d\n"", __func__, retval); } return 0; } ",0 "char* MACH0_(get_cpusubtype)(struct MACH0_(obj_t)* bin) { if (bin) { return MACH0_(get_cpusubtype_from_hdr) (&bin->hdr); } return strdup (""Unknown""); } ",0 "match_security(struct TCP_Server_Info *server, struct smb_vol *vol) { unsigned int secFlags; if (vol->secFlg & (~(CIFSSEC_MUST_SIGN | CIFSSEC_MUST_SEAL))) secFlags = vol->secFlg; else secFlags = global_secflags | vol->secFlg; switch (server->secType) { case LANMAN: if (!(secFlags & (CIFSSEC_MAY_LANMAN|CIFSSEC_MAY_PLNTXT))) return false; break; case NTLMv2: if (!(secFlags & CIFSSEC_MAY_NTLMV2)) return false; break; case NTLM: if (!(secFlags & CIFSSEC_MAY_NTLM)) return false; break; case Kerberos: if (!(secFlags & CIFSSEC_MAY_KRB5)) return false; break; case RawNTLMSSP: if (!(secFlags & CIFSSEC_MAY_NTLMSSP)) return false; break; default: /* shouldn't happen */ return false; } /* now check if signing mode is acceptible */ if ((secFlags & CIFSSEC_MAY_SIGN) == 0 && (server->secMode & SECMODE_SIGN_REQUIRED)) return false; else if (((secFlags & CIFSSEC_MUST_SIGN) == CIFSSEC_MUST_SIGN) && (server->secMode & (SECMODE_SIGN_ENABLED|SECMODE_SIGN_REQUIRED)) == 0) return false; return true; } ",0 "_pixman_bits_image_init (pixman_image_t * image, pixman_format_code_t format, int width, int height, uint32_t * bits, int rowstride, pixman_bool_t clear) { uint32_t *free_me = NULL; if (!bits && width && height) { int rowstride_bytes; free_me = bits = create_bits (format, width, height, &rowstride_bytes, clear); if (!bits) return FALSE; rowstride = rowstride_bytes / (int) sizeof (uint32_t); } _pixman_image_init (image); image->type = BITS; image->bits.format = format; image->bits.width = width; image->bits.height = height; image->bits.bits = bits; image->bits.free_me = free_me; image->bits.read_func = NULL; image->bits.write_func = NULL; image->bits.rowstride = rowstride; image->bits.indexed = NULL; image->common.property_changed = bits_image_property_changed; _pixman_image_reset_clip_region (image); return TRUE; } ",0 "SProcDeleteProperty(ClientPtr client) { REQUEST(xDeletePropertyReq); swaps(&stuff->length); REQUEST_SIZE_MATCH(xDeletePropertyReq); swapl(&stuff->window); swapl(&stuff->property); return ((*ProcVector[X_DeleteProperty]) (client)); } ",0 "static void nfs_mark_uptodate(struct page *page, unsigned int base, unsigned int count) { if (PageUptodate(page)) return; if (base != 0) return; if (count != nfs_page_length(page)) return; SetPageUptodate(page); } ",0 "kadm5_get_principal(void *server_handle, krb5_principal principal, kadm5_principal_ent_t entry, long in_mask) { krb5_db_entry *kdb; osa_princ_ent_rec adb; krb5_error_code ret = 0; long mask; int i; kadm5_server_handle_t handle = server_handle; CHECK_HANDLE(server_handle); krb5_clear_error_message(handle->context); /* * In version 1, all the defined fields are always returned. * entry is a pointer to a kadm5_principal_ent_t_v1 that should be * filled with allocated memory. */ mask = in_mask; memset(entry, 0, sizeof(*entry)); if (principal == NULL) return EINVAL; if ((ret = kdb_get_entry(handle, principal, &kdb, &adb))) return ret; if ((mask & KADM5_POLICY) && adb.policy && (adb.aux_attributes & KADM5_POLICY)) { if ((entry->policy = strdup(adb.policy)) == NULL) { ret = ENOMEM; goto done; } } if (mask & KADM5_AUX_ATTRIBUTES) entry->aux_attributes = adb.aux_attributes; if ((mask & KADM5_PRINCIPAL) && (ret = krb5_copy_principal(handle->context, kdb->princ, &entry->principal))) { goto done; } if (mask & KADM5_PRINC_EXPIRE_TIME) entry->princ_expire_time = kdb->expiration; if ((mask & KADM5_LAST_PWD_CHANGE) && (ret = krb5_dbe_lookup_last_pwd_change(handle->context, kdb, &(entry->last_pwd_change)))) { goto done; } if (mask & KADM5_PW_EXPIRATION) entry->pw_expiration = kdb->pw_expiration; if (mask & KADM5_MAX_LIFE) entry->max_life = kdb->max_life; /* this is a little non-sensical because the function returns two */ /* values that must be checked separately against the mask */ if ((mask & KADM5_MOD_NAME) || (mask & KADM5_MOD_TIME)) { ret = krb5_dbe_lookup_mod_princ_data(handle->context, kdb, &(entry->mod_date), &(entry->mod_name)); if (ret) { goto done; } if (! (mask & KADM5_MOD_TIME)) entry->mod_date = 0; if (! (mask & KADM5_MOD_NAME)) { krb5_free_principal(handle->context, entry->mod_name); entry->mod_name = NULL; } } if (mask & KADM5_ATTRIBUTES) entry->attributes = kdb->attributes; if (mask & KADM5_KVNO) for (entry->kvno = 0, i=0; in_key_data; i++) if ((krb5_kvno) kdb->key_data[i].key_data_kvno > entry->kvno) entry->kvno = kdb->key_data[i].key_data_kvno; if (mask & KADM5_MKVNO) { ret = krb5_dbe_get_mkvno(handle->context, kdb, &entry->mkvno); if (ret) goto done; } if (mask & KADM5_MAX_RLIFE) entry->max_renewable_life = kdb->max_renewable_life; if (mask & KADM5_LAST_SUCCESS) entry->last_success = kdb->last_success; if (mask & KADM5_LAST_FAILED) entry->last_failed = kdb->last_failed; if (mask & KADM5_FAIL_AUTH_COUNT) entry->fail_auth_count = kdb->fail_auth_count; if (mask & KADM5_TL_DATA) { krb5_tl_data *tl, *tl2; entry->tl_data = NULL; tl = kdb->tl_data; while (tl) { if (tl->tl_data_type > 255) { if ((tl2 = dup_tl_data(tl)) == NULL) { ret = ENOMEM; goto done; } tl2->tl_data_next = entry->tl_data; entry->tl_data = tl2; entry->n_tl_data++; } tl = tl->tl_data_next; } } if (mask & KADM5_KEY_DATA) { entry->n_key_data = kdb->n_key_data; if(entry->n_key_data) { entry->key_data = malloc(entry->n_key_data*sizeof(krb5_key_data)); if (entry->key_data == NULL) { ret = ENOMEM; goto done; } } else entry->key_data = NULL; for (i = 0; i < entry->n_key_data; i++) ret = krb5_copy_key_data_contents(handle->context, &kdb->key_data[i], &entry->key_data[i]); if (ret) goto done; } ret = KADM5_OK; done: if (ret && entry->principal) { krb5_free_principal(handle->context, entry->principal); entry->principal = NULL; } kdb_free_entry(handle, kdb, &adb); return ret; } ",0 "bool AppCacheDatabase::DeleteCache(int64_t cache_id) { if (!LazyOpen(kDontCreate)) return false; static const char kSql[] = ""DELETE FROM Caches WHERE cache_id = ?""; sql::Statement statement(db_->GetCachedStatement(SQL_FROM_HERE, kSql)); statement.BindInt64(0, cache_id); return statement.Run(); } ",0 " WebsiteSettingsTest() : cert_id_(0), url_(""http://www.example.com"") {} ",0 "static ssize_t revision_show(struct device *dev, struct device_attribute *attr, char *buf) { struct bmc_device *bmc = to_bmc_device(dev); struct ipmi_device_id id; int rv; rv = bmc_get_device_id(NULL, bmc, &id, NULL, NULL); if (rv) return rv; return snprintf(buf, 20, ""%u\n"", id.device_revision & 0x0F); } ",0 "static void put_ctx(struct perf_event_context *ctx) { if (atomic_dec_and_test(&ctx->refcount)) { if (ctx->parent_ctx) put_ctx(ctx->parent_ctx); if (ctx->task) put_task_struct(ctx->task); kfree_rcu(ctx, rcu_head); } } ",0 "void RenderProcessHostImpl::WidgetHidden() { if (backgrounded_) return; DCHECK_EQ(backgrounded_, (visible_widgets_ == 0)); visible_widgets_--; DCHECK_GE(visible_widgets_, 0); if (visible_widgets_ == 0) { DCHECK(!backgrounded_); SetBackgrounded(true); } } ",0 "void print_vma_addr(char *prefix, unsigned long ip) { struct mm_struct *mm = current->mm; struct vm_area_struct *vma; /* * Do not print if we are in atomic * contexts (in exception stacks, etc.): */ if (preempt_count()) return; down_read(&mm->mmap_sem); vma = find_vma(mm, ip); if (vma && vma->vm_file) { struct file *f = vma->vm_file; char *buf = (char *)__get_free_page(GFP_KERNEL); if (buf) { char *p, *s; p = d_path(&f->f_path, buf, PAGE_SIZE); if (IS_ERR(p)) p = ""?""; s = strrchr(p, '/'); if (s) p = s+1; printk(""%s%s[%lx+%lx]"", prefix, p, vma->vm_start, vma->vm_end - vma->vm_start); free_page((unsigned long)buf); } } up_read(¤t->mm->mmap_sem); } ",0 " static int kvm_vm_ioctl_set_pit2(struct kvm *kvm, struct kvm_pit_state2 *ps) { int start = 0; u32 prev_legacy, cur_legacy; mutex_lock(&kvm->arch.vpit->pit_state.lock); prev_legacy = kvm->arch.vpit->pit_state.flags & KVM_PIT_FLAGS_HPET_LEGACY; cur_legacy = ps->flags & KVM_PIT_FLAGS_HPET_LEGACY; if (!prev_legacy && cur_legacy) start = 1; memcpy(&kvm->arch.vpit->pit_state.channels, &ps->channels, sizeof(kvm->arch.vpit->pit_state.channels)); kvm->arch.vpit->pit_state.flags = ps->flags; kvm_pit_load_count(kvm, 0, kvm->arch.vpit->pit_state.channels[0].count, start); mutex_unlock(&kvm->arch.vpit->pit_state.lock); return 0; } ",1 "static void bond_netpoll_cleanup(struct net_device *bond_dev) { } ",0 "void RenderWidgetHostViewAndroid::SetIsLoading(bool is_loading) { } ",0 "dwarf_elf_object_access_get_byte_order(void* obj_in) { dwarf_elf_object_access_internals_t*obj = (dwarf_elf_object_access_internals_t*)obj_in; return obj->endianness; } ",0 "AppCacheDispatcherHost::~AppCacheDispatcherHost() {} ",0 "__be32 nfsd4_encode_fattr_to_buf(__be32 **p, int words, struct svc_fh *fhp, struct svc_export *exp, struct dentry *dentry, u32 *bmval, struct svc_rqst *rqstp, int ignore_crossmnt) { struct xdr_buf dummy; struct xdr_stream xdr; __be32 ret; svcxdr_init_encode_from_buffer(&xdr, &dummy, *p, words << 2); ret = nfsd4_encode_fattr(&xdr, fhp, exp, dentry, bmval, rqstp, ignore_crossmnt); *p = xdr.p; return ret; } ",0 "void RenderWidgetHostViewAura::ShowContextMenu( const ContextMenuParams& params) { RenderViewHost* rvh = RenderViewHost::From(host_); if (!rvh) return; RenderViewHostDelegate* delegate = rvh->GetDelegate(); if (!delegate) return; RenderViewHostDelegateView* delegate_view = delegate->GetDelegateView(); if (!delegate_view) return; delegate_view->ShowContextMenu(GetFocusedFrame(), params); } ",0 "void BlockPainter::PaintChildren(const PaintInfo& paint_info, const LayoutPoint& paint_offset) { for (LayoutBox* child = layout_block_.FirstChildBox(); child; child = child->NextSiblingBox()) PaintChild(*child, paint_info, paint_offset); } ",0 "ListAttributeTargetObserver::ListAttributeTargetObserver( const AtomicString& id, HTMLInputElement* element) : IdTargetObserver(element->GetTreeScope().GetIdTargetObserverRegistry(), id), element_(element) {} ",0 "jp2_box_t *jp2_box_create(int type) { jp2_box_t *box; jp2_boxinfo_t *boxinfo; if (!(box = jas_malloc(sizeof(jp2_box_t)))) { return 0; } memset(box, 0, sizeof(jp2_box_t)); box->type = type; box->len = 0; if (!(boxinfo = jp2_boxinfolookup(type))) { return 0; } box->info = boxinfo; box->ops = &boxinfo->ops; return box; } ",0 "bool ExtensionPrefs::IsOrphanedExtensionAcknowledged( const std::string& extension_id) { return ReadExtensionPrefBoolean(extension_id, kPrefOrphanAcknowledged); } ",0 "static jboolean Bitmap_hasAlpha(JNIEnv* env, jobject, jlong bitmapHandle) { SkBitmap* bitmap = reinterpret_cast(bitmapHandle); return !bitmap->isOpaque() ? JNI_TRUE : JNI_FALSE; } ",0 "static void set_banner(apr_pool_t *pconf) { if (ap_server_tokens == SrvTk_PRODUCT_ONLY) { ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT); } else if (ap_server_tokens == SrvTk_MINIMAL) { ap_add_version_component(pconf, AP_SERVER_BASEVERSION); } else if (ap_server_tokens == SrvTk_MINOR) { ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT ""/"" AP_SERVER_MINORREVISION); } else if (ap_server_tokens == SrvTk_MAJOR) { ap_add_version_component(pconf, AP_SERVER_BASEPRODUCT ""/"" AP_SERVER_MAJORVERSION); } else { ap_add_version_component(pconf, AP_SERVER_BASEVERSION "" ("" PLATFORM "")""); } /* * Lock the server_banner string if we're not displaying * the full set of tokens */ if (ap_server_tokens != SrvTk_FULL) { banner_locked++; } server_description = AP_SERVER_BASEVERSION "" ("" PLATFORM "")""; } ",0 "const char* BackgroundStateToString(bool is_backgrounded) { if (is_backgrounded) { return ""backgrounded""; } else { return ""foregrounded""; } } ",0 "ImageDataPlatformBackend::~ImageDataPlatformBackend() { } ",0 "int RECORD_LAYER_read_pending(const RECORD_LAYER *rl) { return SSL3_BUFFER_get_left(&rl->rbuf) != 0; } ",0 " void SendScrollUpdateAck(MockWidgetInputHandler::MessageVector& messages, InputEventAckState ack_result) { for (size_t i = 0; i < messages.size(); ++i) { MockWidgetInputHandler::DispatchedEventMessage* event = messages[i]->ToEvent(); if (event && event->Event()->web_event->GetType() == WebInputEvent::kGestureScrollUpdate && event->HasCallback()) { event->CallCallback(ack_result); return; } } EXPECT_TRUE(false); } ",0 " void SetUpOverscrollEnvironmentWithDebounce(int debounce_interval_in_ms) { SetUpOverscrollEnvironmentImpl(debounce_interval_in_ms); } ",0 "static int composite_abort_control(int sub_api, struct usbi_transfer *itransfer) { struct libusb_transfer *transfer = USBI_TRANSFER_TO_LIBUSB_TRANSFER(itransfer); struct windows_transfer_priv *transfer_priv = usbi_transfer_get_os_priv(itransfer); struct windows_device_priv *priv = _device_priv(transfer->dev_handle->dev); return priv->usb_interface[transfer_priv->interface_number].apib-> abort_control(priv->usb_interface[transfer_priv->interface_number].sub_api, itransfer);} ",0 "static void release_callchain_buffers_rcu(struct rcu_head *head) { struct callchain_cpus_entries *entries; int cpu; entries = container_of(head, struct callchain_cpus_entries, rcu_head); for_each_possible_cpu(cpu) kfree(entries->cpu_entries[cpu]); kfree(entries); } ",0 "static int nfs4_xdr_enc_open_noattr(struct rpc_rqst *req, __be32 *p, struct nfs_openargs *args) { struct xdr_stream xdr; struct compound_hdr hdr = { .nops = 3, }; int status; xdr_init_encode(&xdr, &req->rq_snd_buf, p); encode_compound_hdr(&xdr, &hdr); status = encode_putfh(&xdr, args->fh); if (status) goto out; status = encode_open(&xdr, args); if (status) goto out; status = encode_getfattr(&xdr, args->bitmask); out: return status; } ",0 "bool ValidateCharacter(unsigned char c) { if (c >= 32 && c <= 126 && c != '""' && c != '$' && c != '`' && c != '@' && c != '\\' && c != '\'') return true; if (c >= 9 && c <= 13) return true; return false; } ",0 "static int hash_enable_power(struct hash_device_data *device_data, bool restore_device_state) { int ret = 0; struct device *dev = device_data->dev; spin_lock(&device_data->power_state_lock); if (!device_data->power_state) { ret = regulator_enable(device_data->regulator); if (ret) { dev_err(dev, ""%s: regulator_enable() failed!\n"", __func__); goto out; } ret = clk_enable(device_data->clk); if (ret) { dev_err(dev, ""%s: clk_enable() failed!\n"", __func__); ret = regulator_disable( device_data->regulator); goto out; } device_data->power_state = true; } if (device_data->restore_dev_state) { if (restore_device_state) { device_data->restore_dev_state = false; hash_resume_state(device_data, &device_data->state); } } out: spin_unlock(&device_data->power_state_lock); return ret; } ",0 "void RenderThreadImpl::DoNotSuspendWebKitSharedTimer() { suspend_webkit_shared_timer_ = false; } ",0 "GpuTextureResultR16_L16 GpuTextureUMAHelper() { if (g_r16_is_present && g_l16_is_present) { return GpuTextureResultR16_L16::kHaveR16AndL16; } else if (g_r16_is_present) { return GpuTextureResultR16_L16::kHaveR16; } else if (g_l16_is_present) { return GpuTextureResultR16_L16::kHaveL16; } return GpuTextureResultR16_L16::kHaveNone; } ",0 "RTCVoidRequestImpl::~RTCVoidRequestImpl() { } ",0 "scoped_refptr Document::GetTaskRunner(TaskType type) { if (ContextDocument() && ContextDocument()->GetFrame()) return ContextDocument()->GetFrame()->FrameScheduler()->GetTaskRunner(type); return Platform::Current()->CurrentThread()->GetWebTaskRunner(); } ",0 "PHP_MSHUTDOWN_FUNCTION(exif) { UNREGISTER_INI_ENTRIES(); return SUCCESS; } ",0 "SyntheticMotion(DeviceIntPtr dev, int x, int y) { int screenno = 0; #ifdef PANORAMIX if (!noPanoramiXExtension) screenno = dev->spriteInfo->sprite->screen->myNum; #endif PostSyntheticMotion(dev, x, y, screenno, (syncEvents.playingEvents) ? syncEvents.time. milliseconds : currentTime.milliseconds); } ",0 "void __init fork_init(unsigned long mempages) { #ifndef __HAVE_ARCH_TASK_STRUCT_ALLOCATOR #ifndef ARCH_MIN_TASKALIGN #define ARCH_MIN_TASKALIGN L1_CACHE_BYTES #endif /* create a slab on which task_structs can be allocated */ task_struct_cachep = kmem_cache_create(""task_struct"", sizeof(struct task_struct), ARCH_MIN_TASKALIGN, SLAB_PANIC | SLAB_NOTRACK, NULL); #endif /* do the arch specific task caches init */ arch_task_cache_init(); /* * The default maximum number of threads is set to a safe * value: the thread structures can take up at most half * of memory. */ max_threads = mempages / (8 * THREAD_SIZE / PAGE_SIZE); /* * we need to allow at least 20 threads to boot a system */ if(max_threads < 20) max_threads = 20; init_task.signal->rlim[RLIMIT_NPROC].rlim_cur = max_threads/2; init_task.signal->rlim[RLIMIT_NPROC].rlim_max = max_threads/2; init_task.signal->rlim[RLIMIT_SIGPENDING] = init_task.signal->rlim[RLIMIT_NPROC]; } ",0 "static WORD32 ihevcd_parse_sub_layer_hrd_parameters(bitstrm_t *ps_bitstrm, sub_lyr_hrd_params_t *ps_sub_layer_hrd_params, WORD32 cpb_cnt, WORD32 sub_pic_cpb_params_present_flag) { WORD32 ret = (IHEVCD_ERROR_T)IHEVCD_SUCCESS; WORD32 i; for(i = 0; i <= cpb_cnt; i++) { UEV_PARSE(""bit_rate_value_minus1[ i ]"", ps_sub_layer_hrd_params->au4_bit_rate_value_minus1[i], ps_bitstrm); UEV_PARSE(""cpb_size_value_minus1[ i ]"", ps_sub_layer_hrd_params->au4_cpb_size_value_minus1[i], ps_bitstrm); if(sub_pic_cpb_params_present_flag) { UEV_PARSE(""cpb_size_du_value_minus1[ i ]"", ps_sub_layer_hrd_params->au4_cpb_size_du_value_minus1[i], ps_bitstrm); UEV_PARSE(""bit_rate_du_value_minus1[ i ]"", ps_sub_layer_hrd_params->au4_bit_rate_du_value_minus1[i], ps_bitstrm); } BITS_PARSE(""cbr_flag[ i ]"", ps_sub_layer_hrd_params->au1_cbr_flag[i], ps_bitstrm, 1); } return ret; } ",0 "bool DevToolsAgent::OnMessageReceived(const IPC::Message& message) { bool handled = true; IPC_BEGIN_MESSAGE_MAP(DevToolsAgent, message) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Attach, OnAttach) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_Detach, OnDetach) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_FrontendLoaded, OnFrontendLoaded) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, OnDispatchOnInspectorBackend) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_InspectElement, OnInspectElement) IPC_MESSAGE_HANDLER(DevToolsMsg_SetupDevToolsClient, OnSetupDevToolsClient) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() if (message.type() == ViewMsg_Navigate::ID) OnNavigate(); // Don't want to swallow the message. return handled; } ",0 "unpause_activation_timed_cancel (ActivateParameters *parameters) { if (!parameters->timed_wait_active) { activation_start_timed_cancel (parameters); } } ",0 "void BrowserEventRouter::TabPinnedStateChanged(WebContents* contents, int index) { TabStripModel* tab_strip = NULL; int tab_index; if (ExtensionTabUtil::GetTabStripModel(contents, &tab_strip, &tab_index)) { DictionaryValue* changed_properties = new DictionaryValue(); changed_properties->SetBoolean(tab_keys::kPinnedKey, tab_strip->IsTabPinned(tab_index)); DispatchTabUpdatedEvent(contents, changed_properties); } } ",0 "string_modifier_check(struct magic_set *ms, struct magic *m) { if ((ms->flags & MAGIC_CHECK) == 0) return 0; if ((m->type != FILE_REGEX || (m->str_flags & REGEX_LINE_COUNT) == 0) && (m->type != FILE_PSTRING && (m->str_flags & PSTRING_LEN) != 0)) { file_magwarn(ms, ""'/BHhLl' modifiers are only allowed for pascal strings\n""); return -1; } switch (m->type) { case FILE_BESTRING16: case FILE_LESTRING16: if (m->str_flags != 0) { file_magwarn(ms, ""no modifiers allowed for 16-bit strings\n""); return -1; } break; case FILE_STRING: case FILE_PSTRING: if ((m->str_flags & REGEX_OFFSET_START) != 0) { file_magwarn(ms, ""'/%c' only allowed on regex and search\n"", CHAR_REGEX_OFFSET_START); return -1; } break; case FILE_SEARCH: if (m->str_range == 0) { file_magwarn(ms, ""missing range; defaulting to %d\n"", STRING_DEFAULT_RANGE); m->str_range = STRING_DEFAULT_RANGE; return -1; } break; case FILE_REGEX: if ((m->str_flags & STRING_COMPACT_WHITESPACE) != 0) { file_magwarn(ms, ""'/%c' not allowed on regex\n"", CHAR_COMPACT_WHITESPACE); return -1; } if ((m->str_flags & STRING_COMPACT_OPTIONAL_WHITESPACE) != 0) { file_magwarn(ms, ""'/%c' not allowed on regex\n"", CHAR_COMPACT_OPTIONAL_WHITESPACE); return -1; } break; default: file_magwarn(ms, ""coding error: m->type=%d\n"", m->type); return -1; } return 0; } ",0 "void ResourceDispatcherHostImpl::OnTransferRequestToNewPage(int new_routing_id, int request_id) { PendingRequestList::iterator i = pending_requests_.find( GlobalRequestID(filter_->child_id(), request_id)); if (i == pending_requests_.end()) { DVLOG(1) << ""Updating a request that wasn't found""; return; } net::URLRequest* request = i->second; ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); info->set_route_id(new_routing_id); } ",0 "void GLES2DecoderPassthroughImpl::RestoreTextureUnitBindings( unsigned unit) const {} ",0 "static __inline__ int scm_check_creds(struct ucred *creds) { const struct cred *cred = current_cred(); kuid_t uid = make_kuid(cred->user_ns, creds->uid); kgid_t gid = make_kgid(cred->user_ns, creds->gid); if (!uid_valid(uid) || !gid_valid(gid)) return -EINVAL; if ((creds->pid == task_tgid_vnr(current) || ns_capable(task_active_pid_ns(current)->user_ns, CAP_SYS_ADMIN)) && ((uid_eq(uid, cred->uid) || uid_eq(uid, cred->euid) || uid_eq(uid, cred->suid)) || ns_capable(cred->user_ns, CAP_SETUID)) && ((gid_eq(gid, cred->gid) || gid_eq(gid, cred->egid) || gid_eq(gid, cred->sgid)) || ns_capable(cred->user_ns, CAP_SETGID))) { return 0; } return -EPERM; } ",0 "Guint JBIG2HuffmanDecoder::readBit() { if (bufLen == 0) { buf = str->getChar(); bufLen = 8; } --bufLen; return (buf >> bufLen) & 1; } ",0 " ChromeRenderProcessHostBackgroundingTest() {} ",0 "BrotliState* BrotliCreateState( brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) { BrotliState* state = 0; if (!alloc_func && !free_func) { state = (BrotliState*)malloc(sizeof(BrotliState)); } else if (alloc_func && free_func) { state = (BrotliState*)alloc_func(opaque, sizeof(BrotliState)); } if (state == 0) { (void)BROTLI_FAILURE(); return 0; } BrotliStateInitWithCustomAllocators(state, alloc_func, free_func, opaque); return state; } ",0 "static struct sock *netlink_seq_socket_idx(struct seq_file *seq, loff_t pos) { struct nl_seq_iter *iter = seq->private; int i, j; struct sock *s; struct hlist_node *node; loff_t off = 0; for (i = 0; i < MAX_LINKS; i++) { struct nl_pid_hash *hash = &nl_table[i].hash; for (j = 0; j <= hash->mask; j++) { sk_for_each(s, node, &hash->table[j]) { if (sock_net(s) != seq_file_net(seq)) continue; if (off == pos) { iter->link = i; iter->hash_idx = j; return s; } ++off; } } } return NULL; } ",0 "static void defense_work_handler(struct work_struct *work) { struct netns_ipvs *ipvs = container_of(work, struct netns_ipvs, defense_work.work); update_defense_level(ipvs); if (atomic_read(&ipvs->dropentry)) ip_vs_random_dropentry(ipvs->net); schedule_delayed_work(&ipvs->defense_work, DEFENSE_TIMER_PERIOD); } ",0 "int nfs_refresh_inode(struct inode *inode, struct nfs_fattr *fattr) { int status; if ((fattr->valid & NFS_ATTR_FATTR) == 0) return 0; spin_lock(&inode->i_lock); status = nfs_refresh_inode_locked(inode, fattr); spin_unlock(&inode->i_lock); return status; } ",0 "void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error) { if (plugin_widget_.get()) { if (sent_initial_response_to_plugin_) { plugin_widget_->didFailLoading(error); sent_initial_response_to_plugin_ = false; } plugin_widget_ = NULL; } } ",0 "nfs41_proc_secinfo_no_name(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fsinfo *info, struct nfs4_secinfo_flavors *flavors) { struct nfs4_exception exception = { }; int err; do { err = _nfs41_proc_secinfo_no_name(server, fhandle, info, flavors); switch (err) { case 0: case -NFS4ERR_WRONGSEC: case -NFS4ERR_NOTSUPP: break; default: err = nfs4_handle_exception(server, err, &exception); } } while (exception.retry); return err; } ",0 "viz::FrameSinkId CompositorImpl::GetFrameSinkId() { return frame_sink_id_; } ",0 "png_set_iCCP(png_structp png_ptr, png_infop info_ptr, png_charp name, int compression_type, png_charp profile, png_uint_32 proflen) { png_charp new_iccp_name; png_charp new_iccp_profile; png_uint_32 length; png_debug1(1, ""in %s storage function"", ""iCCP""); if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) return; length = png_strlen(name)+1; new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length); if (new_iccp_name == NULL) { png_warning(png_ptr, ""Insufficient memory to process iCCP chunk.""); return; } png_memcpy(new_iccp_name, name, length); new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen); if (new_iccp_profile == NULL) { png_free (png_ptr, new_iccp_name); png_warning(png_ptr, ""Insufficient memory to process iCCP profile.""); return; } png_memcpy(new_iccp_profile, profile, (png_size_t)proflen); png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, 0); info_ptr->iccp_proflen = proflen; info_ptr->iccp_name = new_iccp_name; info_ptr->iccp_profile = new_iccp_profile; /* Compression is always zero but is here so the API and info structure * does not have to change if we introduce multiple compression types */ info_ptr->iccp_compression = (png_byte)compression_type; #ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_ICCP; #endif info_ptr->valid |= PNG_INFO_iCCP; } ",0 " int ToHistogramSample(AutofillMetrics::CardUploadDecisionMetric metric) { for (int sample = 0; sample < metric + 1; ++sample) if (metric & (1 << sample)) return sample; NOTREACHED(); return 0; } ",0 "static RedLinkInfo *reds_init_client_connection(int socket) { RedLinkInfo *link; RedsStream *stream; int delay_val = 1; int flags; if ((flags = fcntl(socket, F_GETFL)) == -1) { spice_warning(""accept failed, %s"", strerror(errno)); goto error; } if (fcntl(socket, F_SETFL, flags | O_NONBLOCK) == -1) { spice_warning(""accept failed, %s"", strerror(errno)); goto error; } if (setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) { if (errno != ENOTSUP) { spice_warning(""setsockopt failed, %s"", strerror(errno)); } } link = spice_new0(RedLinkInfo, 1); stream = spice_new0(RedsStream, 1); stream->info = spice_new0(SpiceChannelEventInfo, 1); link->stream = stream; stream->socket = socket; /* gather info + send event */ /* deprecated fields. Filling them for backward compatibility */ stream->info->llen = sizeof(stream->info->laddr); stream->info->plen = sizeof(stream->info->paddr); getsockname(stream->socket, (struct sockaddr*)(&stream->info->laddr), &stream->info->llen); getpeername(stream->socket, (struct sockaddr*)(&stream->info->paddr), &stream->info->plen); stream->info->flags |= SPICE_CHANNEL_EVENT_FLAG_ADDR_EXT; stream->info->llen_ext = sizeof(stream->info->laddr_ext); stream->info->plen_ext = sizeof(stream->info->paddr_ext); getsockname(stream->socket, (struct sockaddr*)(&stream->info->laddr_ext), &stream->info->llen_ext); getpeername(stream->socket, (struct sockaddr*)(&stream->info->paddr_ext), &stream->info->plen_ext); reds_stream_push_channel_event(stream, SPICE_CHANNEL_EVENT_CONNECTED); openssl_init(link); return link; error: return NULL; } ",0 "static int wddx_stack_push(wddx_stack *stack, void *element, int size) { if (stack->top >= stack->max) { /* we need to allocate more memory */ stack->elements = (void **) erealloc(stack->elements, (sizeof(void **) * (stack->max += STACK_BLOCK_SIZE))); } stack->elements[stack->top] = (void *) emalloc(size); memcpy(stack->elements[stack->top], element, size); return stack->top++; } ",0 "bool ParamTraits::Read(const base::Pickle* m, base::PickleIterator* iter, param_type* r) { const char* column_major_data; if (!iter->ReadBytes(&column_major_data, sizeof(SkMScalar) * 16)) return false; r->matrix().setColMajor( reinterpret_cast(column_major_data)); return true; } ",0 "void WebResourceService::EndFetch() { in_fetch_ = false; } ",0 "TabStripNotificationObserver::~TabStripNotificationObserver() { } ",0 "void InfoBarContainer::ViewHierarchyChanged(bool is_add, views::View* parent, views::View* child) { if (parent == this && child->GetParent() == this) { if (delegate_) { delegate_->InfoBarContainerSizeChanged(false); } } } ",0 "static inline struct anon_vma *anon_vma_alloc(void) { struct anon_vma *anon_vma; anon_vma = kmem_cache_alloc(anon_vma_cachep, GFP_KERNEL); if (anon_vma) { atomic_set(&anon_vma->refcount, 1); /* * Initialise the anon_vma root to point to itself. If called * from fork, the root will be reset to the parents anon_vma. */ anon_vma->root = anon_vma; } return anon_vma; } ",0 "dnslabel_table_init(struct dnslabel_table *table) { table->n_labels = 0; } ",0 "static int __jfs_set_acl(tid_t tid, struct inode *inode, int type, struct posix_acl *acl) { char *ea_name; int rc; int size = 0; char *value = NULL; switch (type) { case ACL_TYPE_ACCESS: ea_name = XATTR_NAME_POSIX_ACL_ACCESS; if (acl) { rc = posix_acl_equiv_mode(acl, &inode->i_mode); if (rc < 0) return rc; inode->i_ctime = CURRENT_TIME; mark_inode_dirty(inode); if (rc == 0) acl = NULL; } break; case ACL_TYPE_DEFAULT: ea_name = XATTR_NAME_POSIX_ACL_DEFAULT; break; default: return -EINVAL; } if (acl) { size = posix_acl_xattr_size(acl->a_count); value = kmalloc(size, GFP_KERNEL); if (!value) return -ENOMEM; rc = posix_acl_to_xattr(&init_user_ns, acl, value, size); if (rc < 0) goto out; } rc = __jfs_setxattr(tid, inode, ea_name, value, size, 0); out: kfree(value); if (!rc) set_cached_acl(inode, type, acl); return rc; } ",1 "METHODDEF(JDIMENSION) get_text_rgb_cmyk_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading text-format PPM files with any maxval and converting to CMYK */ { ppm_source_ptr source = (ppm_source_ptr)sinfo; FILE *infile = source->pub.input_file; register JSAMPROW ptr; register JSAMPLE *rescale = source->rescale; JDIMENSION col; unsigned int maxval = source->maxval; ptr = source->pub.buffer[0]; if (maxval == MAXJSAMPLE) { for (col = cinfo->image_width; col > 0; col--) { JSAMPLE r = read_pbm_integer(cinfo, infile, maxval); JSAMPLE g = read_pbm_integer(cinfo, infile, maxval); JSAMPLE b = read_pbm_integer(cinfo, infile, maxval); rgb_to_cmyk(r, g, b, ptr, ptr + 1, ptr + 2, ptr + 3); ptr += 4; } } else { for (col = cinfo->image_width; col > 0; col--) { JSAMPLE r = rescale[read_pbm_integer(cinfo, infile, maxval)]; JSAMPLE g = rescale[read_pbm_integer(cinfo, infile, maxval)]; JSAMPLE b = rescale[read_pbm_integer(cinfo, infile, maxval)]; rgb_to_cmyk(r, g, b, ptr, ptr + 1, ptr + 2, ptr + 3); ptr += 4; } } return 1; } ",0 "static v8::Local wrapInShadowTemplate(v8::Local wrapper, ScriptWrappable* scriptWrappable, v8::Isolate* isolate) { static int shadowTemplateKey; // This address is used for a key to look up the dom template. V8PerIsolateData* data = V8PerIsolateData::from(isolate); v8::Local shadowTemplate = data->existingDOMTemplate(&shadowTemplateKey); if (shadowTemplate.IsEmpty()) { shadowTemplate = v8::FunctionTemplate::New(isolate); if (shadowTemplate.IsEmpty()) return v8::Local(); shadowTemplate->SetClassName(v8AtomicString(isolate, ""HTMLDocument"")); shadowTemplate->Inherit(V8HTMLDocument::domTemplate(isolate)); shadowTemplate->InstanceTemplate()->SetInternalFieldCount(V8HTMLDocument::internalFieldCount); data->setDOMTemplate(&shadowTemplateKey, shadowTemplate); } v8::Local shadowConstructor; if (!shadowTemplate->GetFunction(isolate->GetCurrentContext()).ToLocal(&shadowConstructor)) return v8::Local(); v8::Local shadow; if (!V8ScriptRunner::instantiateObject(isolate, shadowConstructor).ToLocal(&shadow)) return v8::Local(); if (!v8CallBoolean(shadow->SetPrototype(isolate->GetCurrentContext(), wrapper))) return v8::Local(); V8DOMWrapper::setNativeInfo(wrapper, &V8HTMLDocument::wrapperTypeInfo, scriptWrappable); return shadow; } ",0 "PHP_FUNCTION(stream_socket_recvfrom) { php_stream *stream; zval *zstream, *zremote = NULL; char *remote_addr = NULL; int remote_addr_len; long to_read = 0; char *read_buf; long flags = 0; int recvd; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rl|lz"", &zstream, &to_read, &flags, &zremote) == FAILURE) { RETURN_FALSE; } php_stream_from_zval(stream, &zstream); if (zremote) { zval_dtor(zremote); ZVAL_NULL(zremote); } if (to_read <= 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Length parameter must be greater than 0""); RETURN_FALSE; } read_buf = safe_emalloc(1, to_read, 1); recvd = php_stream_xport_recvfrom(stream, read_buf, to_read, flags, NULL, NULL, zremote ? &remote_addr : NULL, zremote ? &remote_addr_len : NULL TSRMLS_CC); if (recvd >= 0) { if (zremote) { ZVAL_STRINGL(zremote, remote_addr, remote_addr_len, 0); } read_buf[recvd] = '\0'; RETURN_STRINGL(read_buf, recvd, 0); } efree(read_buf); RETURN_FALSE; } ",0 "static int null_hash_setkey(struct crypto_shash *tfm, const u8 *key, unsigned int keylen) { return 0; } ",0 "static void mpage_put_bnr_to_bhs(struct mpage_da_data *mpd, sector_t logical, struct buffer_head *exbh) { struct inode *inode = mpd->inode; struct address_space *mapping = inode->i_mapping; int blocks = exbh->b_size >> inode->i_blkbits; sector_t pblock = exbh->b_blocknr, cur_logical; struct buffer_head *head, *bh; pgoff_t index, end; struct pagevec pvec; int nr_pages, i; index = logical >> (PAGE_CACHE_SHIFT - inode->i_blkbits); end = (logical + blocks - 1) >> (PAGE_CACHE_SHIFT - inode->i_blkbits); cur_logical = index << (PAGE_CACHE_SHIFT - inode->i_blkbits); pagevec_init(&pvec, 0); while (index <= end) { /* XXX: optimize tail */ nr_pages = pagevec_lookup(&pvec, mapping, index, PAGEVEC_SIZE); if (nr_pages == 0) break; for (i = 0; i < nr_pages; i++) { struct page *page = pvec.pages[i]; index = page->index; if (index > end) break; index++; BUG_ON(!PageLocked(page)); BUG_ON(PageWriteback(page)); BUG_ON(!page_has_buffers(page)); bh = page_buffers(page); head = bh; /* skip blocks out of the range */ do { if (cur_logical >= logical) break; cur_logical++; } while ((bh = bh->b_this_page) != head); do { if (cur_logical >= logical + blocks) break; if (buffer_delay(bh) || buffer_unwritten(bh)) { BUG_ON(bh->b_bdev != inode->i_sb->s_bdev); if (buffer_delay(bh)) { clear_buffer_delay(bh); bh->b_blocknr = pblock; } else { /* * unwritten already should have * blocknr assigned. Verify that */ clear_buffer_unwritten(bh); BUG_ON(bh->b_blocknr != pblock); } } else if (buffer_mapped(bh)) BUG_ON(bh->b_blocknr != pblock); cur_logical++; pblock++; } while ((bh = bh->b_this_page) != head); } pagevec_release(&pvec); } } ",1 "pkinit_eku_authorize(krb5_context context, krb5_certauth_moddata moddata, const uint8_t *cert, size_t cert_len, krb5_const_principal princ, const void *opts, const struct _krb5_db_entry_new *db_entry, char ***authinds_out) { krb5_error_code ret; int valid_eku; const struct certauth_req_opts *req_opts = opts; *authinds_out = NULL; /* Verify the client EKU. */ ret = verify_client_eku(context, req_opts->plgctx, req_opts->reqctx, &valid_eku); if (ret) return ret; if (!valid_eku) { TRACE_PKINIT_SERVER_EKU_REJECT(context); return KRB5KDC_ERR_INCONSISTENT_KEY_PURPOSE; } return 0; } ",1 "static json_t *json_object_deep_copy(const json_t *object) { json_t *result; void *iter; result = json_object(); if(!result) return NULL; /* Cannot use json_object_foreach because object has to be cast non-const */ iter = json_object_iter((json_t *)object); while(iter) { const char *key; const json_t *value; key = json_object_iter_key(iter); value = json_object_iter_value(iter); json_object_set_new_nocheck(result, key, json_deep_copy(value)); iter = json_object_iter_next((json_t *)object, iter); } return result; } ",0 " MockAutofillDownloadManager(AutofillDriver* driver, AutofillDownloadManager::Observer* observer) : TestAutofillDownloadManager(driver, observer) {} ",0 " void CheckForUpdates() { if (integration_service_ && integration_service_->file_system()) { integration_service_->file_system()->CheckForUpdates(); } } ",0 "void inet_csk_listen_stop(struct sock *sk) { struct inet_connection_sock *icsk = inet_csk(sk); struct request_sock *acc_req; struct request_sock *req; inet_csk_delete_keepalive_timer(sk); /* make all the listen_opt local to us */ acc_req = reqsk_queue_yank_acceptq(&icsk->icsk_accept_queue); /* Following specs, it would be better either to send FIN * (and enter FIN-WAIT-1, it is normal close) * or to send active reset (abort). * Certainly, it is pretty dangerous while synflood, but it is * bad justification for our negligence 8) * To be honest, we are not able to make either * of the variants now. --ANK */ reqsk_queue_destroy(&icsk->icsk_accept_queue); while ((req = acc_req) != NULL) { struct sock *child = req->sk; acc_req = req->dl_next; local_bh_disable(); bh_lock_sock(child); WARN_ON(sock_owned_by_user(child)); sock_hold(child); sk->sk_prot->disconnect(child, O_NONBLOCK); sock_orphan(child); percpu_counter_inc(sk->sk_prot->orphan_count); inet_csk_destroy_sock(child); bh_unlock_sock(child); local_bh_enable(); sock_put(child); sk_acceptq_removed(sk); __reqsk_free(req); } WARN_ON(sk->sk_ack_backlog); } ",0 "int __init icmpv6_init(void) { int err; err = register_pernet_subsys(&icmpv6_sk_ops); if (err < 0) return err; err = -EAGAIN; if (inet6_add_protocol(&icmpv6_protocol, IPPROTO_ICMPV6) < 0) goto fail; err = inet6_register_icmp_sender(icmp6_send); if (err) goto sender_reg_err; return 0; sender_reg_err: inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6); fail: pr_err(""Failed to register ICMP6 protocol\n""); unregister_pernet_subsys(&icmpv6_sk_ops); return err; } ",0 "static void rds_send_remove_from_sock(struct list_head *messages, int status) { unsigned long flags; struct rds_sock *rs = NULL; struct rds_message *rm; while (!list_empty(messages)) { int was_on_sock = 0; rm = list_entry(messages->next, struct rds_message, m_conn_item); list_del_init(&rm->m_conn_item); /* * If we see this flag cleared then we're *sure* that someone * else beat us to removing it from the sock. If we race * with their flag update we'll get the lock and then really * see that the flag has been cleared. * * The message spinlock makes sure nobody clears rm->m_rs * while we're messing with it. It does not prevent the * message from being removed from the socket, though. */ spin_lock_irqsave(&rm->m_rs_lock, flags); if (!test_bit(RDS_MSG_ON_SOCK, &rm->m_flags)) goto unlock_and_drop; if (rs != rm->m_rs) { if (rs) { rds_wake_sk_sleep(rs); sock_put(rds_rs_to_sk(rs)); } rs = rm->m_rs; if (rs) sock_hold(rds_rs_to_sk(rs)); } if (!rs) goto unlock_and_drop; spin_lock(&rs->rs_lock); if (test_and_clear_bit(RDS_MSG_ON_SOCK, &rm->m_flags)) { struct rm_rdma_op *ro = &rm->rdma; struct rds_notifier *notifier; list_del_init(&rm->m_sock_item); rds_send_sndbuf_remove(rs, rm); if (ro->op_active && ro->op_notifier && (ro->op_notify || (ro->op_recverr && status))) { notifier = ro->op_notifier; list_add_tail(¬ifier->n_list, &rs->rs_notify_queue); if (!notifier->n_status) notifier->n_status = status; rm->rdma.op_notifier = NULL; } was_on_sock = 1; rm->m_rs = NULL; } spin_unlock(&rs->rs_lock); unlock_and_drop: spin_unlock_irqrestore(&rm->m_rs_lock, flags); rds_message_put(rm); if (was_on_sock) rds_message_put(rm); } if (rs) { rds_wake_sk_sleep(rs); sock_put(rds_rs_to_sk(rs)); } } ",0 "cleanup_childpid(gpointer data) { int* pid = static_cast(data); int status; int rv = waitpid(*pid, &status, WNOHANG); if (rv <= 0) { kill(*pid, SIGKILL); waitpid(*pid, &status, 0); } gnash::log_debug(""Child process exited with status %s"", status); delete pid; return FALSE; } ",0 "const ResourceDispatcherHostRequestInfo* ResourceDispatcherHost::InfoForRequest( const URLRequest* request) { const ResourceDispatcherHostRequestInfo* info = static_cast( request->GetUserData(NULL)); DLOG_IF(WARNING, !info) << ""Request doesn't seem to have our data""; return info; } ",0 "void InlineLoginHandlerImpl::SetExtraInitParams(base::DictionaryValue& params) { params.SetString(""service"", ""chromiumsync""); Profile* profile = Profile::FromWebUI(web_ui()); if (IsSystemProfile(profile)) params.SetBoolean(""dontResizeNonEmbeddedPages"", true); content::WebContents* contents = web_ui()->GetWebContents(); const GURL& current_url = contents->GetURL(); signin_metrics::Reason reason = signin::GetSigninReasonForPromoURL(current_url); const GURL& url = GaiaUrls::GetInstance()->embedded_signin_url(); params.SetBoolean(""isNewGaiaFlow"", true); params.SetString(""clientId"", GaiaUrls::GetInstance()->oauth2_chrome_client_id()); params.SetString(""gaiaPath"", url.path().substr(1)); std::string flow; switch (reason) { case signin_metrics::Reason::REASON_ADD_SECONDARY_ACCOUNT: flow = ""addaccount""; break; case signin_metrics::Reason::REASON_REAUTHENTICATION: case signin_metrics::Reason::REASON_UNLOCK: flow = ""reauth""; break; case signin_metrics::Reason::REASON_FORCED_SIGNIN_PRIMARY_ACCOUNT: flow = ""enterprisefsi""; break; default: flow = ""signin""; break; } params.SetString(""flow"", flow); content::WebContentsObserver::Observe(contents); LogHistogramValue(signin_metrics::HISTOGRAM_SHOWN); } ",0 "void NavigationController::FinishRestore(int selected_index) { DCHECK(selected_index >= 0 && selected_index < entry_count()); ConfigureEntriesForRestore(&entries_); set_max_restored_page_id(entry_count()); last_committed_entry_index_ = selected_index; } ",0 "ProcRenderQueryDithers(ClientPtr client) { return BadImplementation; } ",0 "bool SessionStore::StorageKeyMatchesLocalSession( const std::string& storage_key) const { std::string session_tag; int tab_node_id; bool success = DecodeStorageKey(storage_key, &session_tag, &tab_node_id); DCHECK(success); return session_tag == local_session_info_.session_tag; } ",0 "void AppCacheUpdateJob::NotifySingleHost(AppCacheHost* host, AppCacheEventID event_id) { std::vector ids(1, host->host_id()); host->frontend()->OnEventRaised(ids, event_id); } ",0 "void BackendIO::DoomEntry(const std::string& key) { operation_ = OP_DOOM; key_ = key; } ",0 "void nntp_group_unread_stat(struct NntpData *nntp_data) { nntp_data->unread = 0; if (nntp_data->last_message == 0 || nntp_data->first_message > nntp_data->last_message) return; nntp_data->unread = nntp_data->last_message - nntp_data->first_message + 1; for (unsigned int i = 0; i < nntp_data->newsrc_len; i++) { anum_t first = nntp_data->newsrc_ent[i].first; if (first < nntp_data->first_message) first = nntp_data->first_message; anum_t last = nntp_data->newsrc_ent[i].last; if (last > nntp_data->last_message) last = nntp_data->last_message; if (first <= last) nntp_data->unread -= last - first + 1; } } ",0 "bool HTMLDocumentParser::isExecutingScript() const { if (!m_scriptRunner) return false; return m_scriptRunner->isExecutingScript(); } ",0 "static int update_thread_context(AVCodecContext *dst, const AVCodecContext *src) { PNGDecContext *psrc = src->priv_data; PNGDecContext *pdst = dst->priv_data; int ret; if (dst == src) return 0; ff_thread_release_buffer(dst, &pdst->picture); if (psrc->picture.f->data[0] && (ret = ff_thread_ref_frame(&pdst->picture, &psrc->picture)) < 0) return ret; if (CONFIG_APNG_DECODER && dst->codec_id == AV_CODEC_ID_APNG) { pdst->width = psrc->width; pdst->height = psrc->height; pdst->bit_depth = psrc->bit_depth; pdst->color_type = psrc->color_type; pdst->compression_type = psrc->compression_type; pdst->interlace_type = psrc->interlace_type; pdst->filter_type = psrc->filter_type; pdst->cur_w = psrc->cur_w; pdst->cur_h = psrc->cur_h; pdst->x_offset = psrc->x_offset; pdst->y_offset = psrc->y_offset; pdst->has_trns = psrc->has_trns; memcpy(pdst->transparent_color_be, psrc->transparent_color_be, sizeof(pdst->transparent_color_be)); pdst->dispose_op = psrc->dispose_op; memcpy(pdst->palette, psrc->palette, sizeof(pdst->palette)); pdst->state |= psrc->state & (PNG_IHDR | PNG_PLTE); ff_thread_release_buffer(dst, &pdst->last_picture); if (psrc->last_picture.f->data[0] && (ret = ff_thread_ref_frame(&pdst->last_picture, &psrc->last_picture)) < 0) return ret; ff_thread_release_buffer(dst, &pdst->previous_picture); if (psrc->previous_picture.f->data[0] && (ret = ff_thread_ref_frame(&pdst->previous_picture, &psrc->previous_picture)) < 0) return ret; } return 0; } ",0 "ossl_cipher_free(void *ptr) { EVP_CIPHER_CTX_free(ptr); } ",0 "RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, int32 routing_id) { DCHECK(routing_id != MSG_ROUTING_NONE); if (g_create_render_frame_impl) return g_create_render_frame_impl(render_view, routing_id); else return new RenderFrameImpl(render_view, routing_id); } ",0 "static int vhost_attach_cgroups(struct vhost_dev *dev) { struct vhost_attach_cgroups_struct attach; attach.owner = current; vhost_work_init(&attach.work, vhost_attach_cgroups_work); vhost_work_queue(dev, &attach.work); vhost_work_flush(dev, &attach.work); return attach.ret; } ",0 "static void locationWithPerWorldBindingsAttributeGetterCallbackForMainWorld(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectPythonV8Internal::locationWithPerWorldBindingsAttributeGetterForMainWorld(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void BlinkTestRunner::SetDeviceScaleFactor(float factor) { content::SetDeviceScaleFactor(render_view(), factor); } ",0 "void PaintArtifactCompositor::RemoveChildLayers() { cc::LayerTreeHost* host = root_layer_->layer_tree_host(); if (!host) return; for (auto child : root_layer_->children()) { host->UnregisterElement(child->element_id(), cc::ElementListType::ACTIVE); } root_layer_->RemoveAllChildren(); if (extra_data_for_testing_enabled_) { extra_data_for_testing_->content_layers.clear(); extra_data_for_testing_->synthesized_clip_layers.clear(); extra_data_for_testing_->scroll_hit_test_layers.clear(); } } ",0 "static PHP_INI_MH(OnUpdate_zlib_output_handler) { if (stage == PHP_INI_STAGE_RUNTIME && (php_output_get_status(TSRMLS_C) & PHP_OUTPUT_SENT)) { php_error_docref(""ref.outcontrol"" TSRMLS_CC, E_WARNING, ""Cannot change zlib.output_handler - headers already sent""); return FAILURE; } return OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); } ",0 "do_init (int event_fd, pid_t initial_pid, struct sock_fprog *seccomp_prog) { int initial_exit_status = 1; LockFile *lock; for (lock = lock_files; lock != NULL; lock = lock->next) { int fd = open (lock->path, O_RDONLY | O_CLOEXEC); if (fd == -1) die_with_error (""Unable to open lock file %s"", lock->path); struct flock l = { .l_type = F_RDLCK, .l_whence = SEEK_SET, .l_start = 0, .l_len = 0 }; if (fcntl (fd, F_SETLK, &l) < 0) die_with_error (""Unable to lock file %s"", lock->path); /* Keep fd open to hang on to lock */ lock->fd = fd; } /* Optionally bind our lifecycle to that of the caller */ handle_die_with_parent (); if (seccomp_prog != NULL && prctl (PR_SET_SECCOMP, SECCOMP_MODE_FILTER, seccomp_prog) != 0) die_with_error (""prctl(PR_SET_SECCOMP)""); while (TRUE) { pid_t child; int status; child = wait (&status); if (child == initial_pid && event_fd != -1) { uint64_t val; int res UNUSED; initial_exit_status = propagate_exit_status (status); val = initial_exit_status + 1; res = write (event_fd, &val, 8); /* Ignore res, if e.g. the parent died and closed event_fd we don't want to error out here */ } if (child == -1 && errno != EINTR) { if (errno != ECHILD) die_with_error (""init wait()""); break; } } /* Close FDs. */ for (lock = lock_files; lock != NULL; lock = lock->next) { if (lock->fd >= 0) { close (lock->fd); lock->fd = -1; } } return initial_exit_status; } ",0 "_nfs4_opendata_reclaim_to_nfs4_state(struct nfs4_opendata *data) { struct inode *inode = data->state->inode; struct nfs4_state *state = data->state; int ret; if (!data->rpc_done) { if (data->rpc_status) { ret = data->rpc_status; goto err; } /* cached opens have already been processed */ goto update; } ret = nfs_refresh_inode(inode, &data->f_attr); if (ret) goto err; if (data->o_res.delegation_type != 0) nfs4_opendata_check_deleg(data, state); update: update_open_stateid(state, &data->o_res.stateid, NULL, data->o_arg.fmode); atomic_inc(&state->count); return state; err: return ERR_PTR(ret); } ",0 " void writeArrayBuffer(const ArrayBuffer& arrayBuffer) { append(ArrayBufferTag); doWriteArrayBuffer(arrayBuffer); } ",0 "feed_table_inline_tag(struct table *tbl, char *line, struct table_mode *mode, int width) { check_rowcol(tbl, mode); pushdata(tbl, tbl->row, tbl->col, line); if (width >= 0) { check_minimum0(tbl, width); addcontentssize(tbl, width); setwidth(tbl, mode); } } ",0 "dtls1_buffer_message(SSL *s, int is_ccs) { pitem *item; hm_fragment *frag; unsigned char seq64be[8]; /* this function is called immediately after a message has * been serialized */ OPENSSL_assert(s->init_off == 0); frag = dtls1_hm_fragment_new(s->init_num, 0); memcpy(frag->fragment, s->init_buf->data, s->init_num); if ( is_ccs) { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + ((s->version==DTLS1_VERSION)?DTLS1_CCS_HEADER_LENGTH:3) == (unsigned int)s->init_num); } else { OPENSSL_assert(s->d1->w_msg_hdr.msg_len + DTLS1_HM_HEADER_LENGTH == (unsigned int)s->init_num); } frag->msg_header.msg_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.seq = s->d1->w_msg_hdr.seq; frag->msg_header.type = s->d1->w_msg_hdr.type; frag->msg_header.frag_off = 0; frag->msg_header.frag_len = s->d1->w_msg_hdr.msg_len; frag->msg_header.is_ccs = is_ccs; /* save current state*/ frag->msg_header.saved_retransmit_state.enc_write_ctx = s->enc_write_ctx; frag->msg_header.saved_retransmit_state.write_hash = s->write_hash; frag->msg_header.saved_retransmit_state.compress = s->compress; frag->msg_header.saved_retransmit_state.session = s->session; frag->msg_header.saved_retransmit_state.epoch = s->d1->w_epoch; memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)>>8); seq64be[7] = (unsigned char)(dtls1_get_queue_priority(frag->msg_header.seq, frag->msg_header.is_ccs)); item = pitem_new(seq64be, frag); if ( item == NULL) { dtls1_hm_fragment_free(frag); return 0; } #if 0 fprintf( stderr, ""buffered messge: \ttype = %xx\n"", msg_buf->type); fprintf( stderr, ""\t\t\t\t\tlen = %d\n"", msg_buf->len); fprintf( stderr, ""\t\t\t\t\tseq_num = %d\n"", msg_buf->seq_num); #endif pqueue_insert(s->d1->sent_messages, item); return 1; } ",0 "ZEND_API int clean_non_persistent_function_full(zval *zv) /* {{{ */ { zend_function *function = Z_PTR_P(zv); return (function->type == ZEND_INTERNAL_FUNCTION) ? ZEND_HASH_APPLY_KEEP : ZEND_HASH_APPLY_REMOVE; } /* }}} */ ",0 "raptor_rdfxml_check_propertyAttribute_name(const char *name) { int i; if(*name == '_') return 1; for(i = 0; raptor_rdf_ns_terms_info[i].name; i++) if(!strcmp(raptor_rdf_ns_terms_info[i].name, (const char*)name)) return raptor_rdf_ns_terms_info[i].allowed_as_propertyAttribute; return -1; } ",0 "void Browser::OpenBookmarkManagerEditNode(int64 node_id) { OpenBookmarkManagerWithHash(""e="", node_id); } ",0 "bool Job::ResolveDnsNonBlocking(const std::string& host, ResolveDnsOperation op, std::string* output, bool* terminate) { CheckIsOnWorkerThread(); if (abandoned_) { return false; } num_dns_ += 1; bool rv; if (GetDnsFromLocalCache(host, op, output, &rv)) { return rv; } if (num_dns_ <= last_num_dns_) { ScheduleRestartWithBlockingDns(); *terminate = true; return false; } if (dns_cache_.size() >= kMaxUniqueResolveDnsPerExec) { return false; } DCHECK(!should_restart_with_blocking_dns_); bool completed_synchronously; if (!PostDnsOperationAndWait(host, op, &completed_synchronously)) return false; // Was cancelled. if (completed_synchronously) { CHECK(GetDnsFromLocalCache(host, op, output, &rv)); return rv; } abandoned_ = true; *terminate = true; last_num_dns_ = num_dns_; return false; } ",1 "ChildProcessSecurityPolicy* ChildProcessSecurityPolicy::GetInstance() { return Singleton::get(); } ",0 "std::vector Shell::GetContainersFromAllRootWindows( int container_id, aura::Window* priority_root) { std::vector containers; aura::Window::Windows root_windows = GetAllRootWindows(); for (aura::Window::Windows::const_iterator it = root_windows.begin(); it != root_windows.end(); ++it) { aura::Window* container = (*it)->GetChildById(container_id); if (container) { if (priority_root && priority_root->Contains(container)) containers.insert(containers.begin(), container); else containers.push_back(container); } } return containers; } ",0 "static inline int in_stable_tree(struct rmap_item *rmap_item) { return rmap_item->address & STABLE_FLAG; } ",0 "struct nl_msg *nlmsg_convert(struct nlmsghdr *hdr) { struct nl_msg *nm; nm = __nlmsg_alloc(NLMSG_ALIGN(hdr->nlmsg_len)); if (!nm) return NULL; memcpy(nm->nm_nlh, hdr, hdr->nlmsg_len); return nm; } ",0 "static void vmx_set_msr_bitmap(struct kvm_vcpu *vcpu) { unsigned long *msr_bitmap; if (is_guest_mode(vcpu)) msr_bitmap = vmx_msr_bitmap_nested; else if (vcpu->arch.apic_base & X2APIC_ENABLE) { if (is_long_mode(vcpu)) msr_bitmap = vmx_msr_bitmap_longmode_x2apic; else msr_bitmap = vmx_msr_bitmap_legacy_x2apic; } else { if (is_long_mode(vcpu)) msr_bitmap = vmx_msr_bitmap_longmode; else msr_bitmap = vmx_msr_bitmap_legacy; } vmcs_write64(MSR_BITMAP, __pa(msr_bitmap)); } ",1 "static int sctp_setsockopt_hmac_ident(struct sock *sk, char __user *optval, unsigned int optlen) { struct net *net = sock_net(sk); struct sctp_hmacalgo *hmacs; u32 idents; int err; if (!net->sctp.auth_enable) return -EACCES; if (optlen < sizeof(struct sctp_hmacalgo)) return -EINVAL; hmacs= memdup_user(optval, optlen); if (IS_ERR(hmacs)) return PTR_ERR(hmacs); idents = hmacs->shmac_num_idents; if (idents == 0 || idents > SCTP_AUTH_NUM_HMACS || (idents * sizeof(u16)) > (optlen - sizeof(struct sctp_hmacalgo))) { err = -EINVAL; goto out; } err = sctp_auth_ep_set_hmacs(sctp_sk(sk)->ep, hmacs); out: kfree(hmacs); return err; } ",0 "mrb_init_class(mrb_state *mrb) { struct RClass *bob; /* BasicObject */ struct RClass *obj; /* Object */ struct RClass *mod; /* Module */ struct RClass *cls; /* Class */ /* boot class hierarchy */ bob = boot_defclass(mrb, 0); obj = boot_defclass(mrb, bob); mrb->object_class = obj; mod = boot_defclass(mrb, obj); mrb->module_class = mod;/* obj -> mod */ cls = boot_defclass(mrb, mod); mrb->class_class = cls; /* obj -> cls */ /* fix-up loose ends */ bob->c = obj->c = mod->c = cls->c = cls; make_metaclass(mrb, bob); make_metaclass(mrb, obj); make_metaclass(mrb, mod); make_metaclass(mrb, cls); /* name basic classes */ mrb_define_const(mrb, bob, ""BasicObject"", mrb_obj_value(bob)); mrb_define_const(mrb, obj, ""BasicObject"", mrb_obj_value(bob)); mrb_define_const(mrb, obj, ""Object"", mrb_obj_value(obj)); mrb_define_const(mrb, obj, ""Module"", mrb_obj_value(mod)); mrb_define_const(mrb, obj, ""Class"", mrb_obj_value(cls)); /* name each classes */ mrb_class_name_class(mrb, NULL, bob, mrb_intern_lit(mrb, ""BasicObject"")); mrb_class_name_class(mrb, NULL, obj, mrb_intern_lit(mrb, ""Object"")); /* 15.2.1 */ mrb_class_name_class(mrb, NULL, mod, mrb_intern_lit(mrb, ""Module"")); /* 15.2.2 */ mrb_class_name_class(mrb, NULL, cls, mrb_intern_lit(mrb, ""Class"")); /* 15.2.3 */ mrb->proc_class = mrb_define_class(mrb, ""Proc"", mrb->object_class); /* 15.2.17 */ MRB_SET_INSTANCE_TT(mrb->proc_class, MRB_TT_PROC); MRB_SET_INSTANCE_TT(cls, MRB_TT_CLASS); mrb_define_method(mrb, bob, ""initialize"", mrb_bob_init, MRB_ARGS_NONE()); mrb_define_method(mrb, bob, ""!"", mrb_bob_not, MRB_ARGS_NONE()); mrb_define_method(mrb, bob, ""=="", mrb_obj_equal_m, MRB_ARGS_REQ(1)); /* 15.3.1.3.1 */ mrb_define_method(mrb, bob, ""!="", mrb_obj_not_equal_m, MRB_ARGS_REQ(1)); mrb_define_method(mrb, bob, ""__id__"", mrb_obj_id_m, MRB_ARGS_NONE()); /* 15.3.1.3.3 */ mrb_define_method(mrb, bob, ""__send__"", mrb_f_send, MRB_ARGS_ANY()); /* 15.3.1.3.4 */ mrb_define_method(mrb, bob, ""instance_eval"", mrb_obj_instance_eval, MRB_ARGS_ANY()); /* 15.3.1.3.18 */ mrb_define_class_method(mrb, cls, ""new"", mrb_class_new_class, MRB_ARGS_OPT(1)); mrb_define_method(mrb, cls, ""superclass"", mrb_class_superclass, MRB_ARGS_NONE()); /* 15.2.3.3.4 */ mrb_define_method(mrb, cls, ""new"", mrb_instance_new, MRB_ARGS_ANY()); /* 15.2.3.3.3 */ mrb_define_method(mrb, cls, ""initialize"", mrb_class_initialize, MRB_ARGS_OPT(1)); /* 15.2.3.3.1 */ mrb_define_method(mrb, cls, ""inherited"", mrb_bob_init, MRB_ARGS_REQ(1)); MRB_SET_INSTANCE_TT(mod, MRB_TT_MODULE); mrb_define_method(mrb, mod, ""class_variable_defined?"", mrb_mod_cvar_defined, MRB_ARGS_REQ(1)); /* 15.2.2.4.16 */ mrb_define_method(mrb, mod, ""class_variable_get"", mrb_mod_cvar_get, MRB_ARGS_REQ(1)); /* 15.2.2.4.17 */ mrb_define_method(mrb, mod, ""class_variable_set"", mrb_mod_cvar_set, MRB_ARGS_REQ(2)); /* 15.2.2.4.18 */ mrb_define_method(mrb, mod, ""extend_object"", mrb_mod_extend_object, MRB_ARGS_REQ(1)); /* 15.2.2.4.25 */ mrb_define_method(mrb, mod, ""extended"", mrb_bob_init, MRB_ARGS_REQ(1)); /* 15.2.2.4.26 */ mrb_define_method(mrb, mod, ""prepended"", mrb_bob_init, MRB_ARGS_REQ(1)); mrb_define_method(mrb, mod, ""prepend_features"", mrb_mod_prepend_features, MRB_ARGS_REQ(1)); mrb_define_method(mrb, mod, ""include?"", mrb_mod_include_p, MRB_ARGS_REQ(1)); /* 15.2.2.4.28 */ mrb_define_method(mrb, mod, ""append_features"", mrb_mod_append_features, MRB_ARGS_REQ(1)); /* 15.2.2.4.10 */ mrb_define_method(mrb, mod, ""class_eval"", mrb_mod_module_eval, MRB_ARGS_ANY()); /* 15.2.2.4.15 */ mrb_define_method(mrb, mod, ""included"", mrb_bob_init, MRB_ARGS_REQ(1)); /* 15.2.2.4.29 */ mrb_define_method(mrb, mod, ""included_modules"", mrb_mod_included_modules, MRB_ARGS_NONE()); /* 15.2.2.4.30 */ mrb_define_method(mrb, mod, ""initialize"", mrb_mod_initialize, MRB_ARGS_NONE()); /* 15.2.2.4.31 */ mrb_define_method(mrb, mod, ""instance_methods"", mrb_mod_instance_methods, MRB_ARGS_ANY()); /* 15.2.2.4.33 */ mrb_define_method(mrb, mod, ""method_defined?"", mrb_mod_method_defined, MRB_ARGS_REQ(1)); /* 15.2.2.4.34 */ mrb_define_method(mrb, mod, ""module_eval"", mrb_mod_module_eval, MRB_ARGS_ANY()); /* 15.2.2.4.35 */ mrb_define_method(mrb, mod, ""module_function"", mrb_mod_module_function, MRB_ARGS_ANY()); mrb_define_method(mrb, mod, ""private"", mrb_mod_dummy_visibility, MRB_ARGS_ANY()); /* 15.2.2.4.36 */ mrb_define_method(mrb, mod, ""protected"", mrb_mod_dummy_visibility, MRB_ARGS_ANY()); /* 15.2.2.4.37 */ mrb_define_method(mrb, mod, ""public"", mrb_mod_dummy_visibility, MRB_ARGS_ANY()); /* 15.2.2.4.38 */ mrb_define_method(mrb, mod, ""remove_class_variable"", mrb_mod_remove_cvar, MRB_ARGS_REQ(1)); /* 15.2.2.4.39 */ mrb_define_method(mrb, mod, ""remove_method"", mrb_mod_remove_method, MRB_ARGS_ANY()); /* 15.2.2.4.41 */ mrb_define_method(mrb, mod, ""method_removed"", mrb_bob_init, MRB_ARGS_REQ(1)); mrb_define_method(mrb, mod, ""attr_reader"", mrb_mod_attr_reader, MRB_ARGS_ANY()); /* 15.2.2.4.13 */ mrb_define_method(mrb, mod, ""attr_writer"", mrb_mod_attr_writer, MRB_ARGS_ANY()); /* 15.2.2.4.14 */ mrb_define_method(mrb, mod, ""to_s"", mrb_mod_to_s, MRB_ARGS_NONE()); mrb_define_method(mrb, mod, ""inspect"", mrb_mod_to_s, MRB_ARGS_NONE()); mrb_define_method(mrb, mod, ""alias_method"", mrb_mod_alias, MRB_ARGS_ANY()); /* 15.2.2.4.8 */ mrb_define_method(mrb, mod, ""ancestors"", mrb_mod_ancestors, MRB_ARGS_NONE()); /* 15.2.2.4.9 */ mrb_define_method(mrb, mod, ""undef_method"", mrb_mod_undef, MRB_ARGS_ANY()); /* 15.2.2.4.41 */ mrb_define_method(mrb, mod, ""const_defined?"", mrb_mod_const_defined, MRB_ARGS_ARG(1,1)); /* 15.2.2.4.20 */ mrb_define_method(mrb, mod, ""const_get"", mrb_mod_const_get, MRB_ARGS_REQ(1)); /* 15.2.2.4.21 */ mrb_define_method(mrb, mod, ""const_set"", mrb_mod_const_set, MRB_ARGS_REQ(2)); /* 15.2.2.4.23 */ mrb_define_method(mrb, mod, ""constants"", mrb_mod_constants, MRB_ARGS_OPT(1)); /* 15.2.2.4.24 */ mrb_define_method(mrb, mod, ""remove_const"", mrb_mod_remove_const, MRB_ARGS_REQ(1)); /* 15.2.2.4.40 */ mrb_define_method(mrb, mod, ""const_missing"", mrb_mod_const_missing, MRB_ARGS_REQ(1)); mrb_define_method(mrb, mod, ""define_method"", mod_define_method, MRB_ARGS_ARG(1,1)); mrb_define_method(mrb, mod, ""class_variables"", mrb_mod_class_variables, MRB_ARGS_NONE()); /* 15.2.2.4.19 */ mrb_define_method(mrb, mod, ""==="", mrb_mod_eqq, MRB_ARGS_REQ(1)); mrb_define_class_method(mrb, mod, ""constants"", mrb_mod_s_constants, MRB_ARGS_ANY()); /* 15.2.2.3.1 */ mrb_define_class_method(mrb, mod, ""nesting"", mrb_mod_s_nesting, MRB_ARGS_REQ(0)); /* 15.2.2.3.2 */ mrb_undef_method(mrb, cls, ""append_features""); mrb_undef_method(mrb, cls, ""extend_object""); mrb->top_self = (struct RObject*)mrb_obj_alloc(mrb, MRB_TT_OBJECT, mrb->object_class); mrb_define_singleton_method(mrb, mrb->top_self, ""inspect"", inspect_main, MRB_ARGS_NONE()); mrb_define_singleton_method(mrb, mrb->top_self, ""to_s"", inspect_main, MRB_ARGS_NONE()); mrb_define_singleton_method(mrb, mrb->top_self, ""define_method"", top_define_method, MRB_ARGS_ARG(1,1)); } ",0 "void DownloadController::RecordDownloadCancelReason( DownloadCancelReason reason) { UMA_HISTOGRAM_ENUMERATION( ""MobileDownload.CancelReason"", reason, CANCEL_REASON_MAX); } ",0 "static int fallback_init_blk(struct crypto_tfm *tfm) { const char *name = tfm->__crt_alg->cra_name; struct s390_aes_ctx *sctx = crypto_tfm_ctx(tfm); sctx->fallback.blk = crypto_alloc_blkcipher(name, 0, CRYPTO_ALG_ASYNC | CRYPTO_ALG_NEED_FALLBACK); if (IS_ERR(sctx->fallback.blk)) { pr_err(""Allocating AES fallback algorithm %s failed\n"", name); return PTR_ERR(sctx->fallback.blk); } return 0; } ",0 "int ipmi_si_remove_by_dev(struct device *dev) { struct smi_info *e; int rv = -ENOENT; mutex_lock(&smi_infos_lock); list_for_each_entry(e, &smi_infos, link) { if (e->io.dev == dev) { cleanup_one_si(e); rv = 0; break; } } mutex_unlock(&smi_infos_lock); return rv; } ",0 "bool HFSBTreeIterator::Next() { if (!ReadCurrentLeaf()) return false; GetLeafData(); // keyLength auto parent_id = OSSwapBigToHostInt32(*GetLeafData()); auto key_string_length = OSSwapBigToHostInt16(*GetLeafData()); auto key_string = reinterpret_cast(&leaf_data_[current_leaf_offset_]); for (uint16_t i = 0; i < key_string_length; ++i, current_leaf_offset_ += sizeof(uint16_t)) { key_string[i] = OSSwapBigToHostInt16(key_string[i]); } base::string16 key(key_string, key_string_length); current_record_.record_type = OSSwapBigToHostInt16(*GetLeafData()); current_record_.unexported = false; current_leaf_offset_ -= sizeof(int16_t); switch (current_record_.record_type) { case kHFSPlusFolderRecord: { auto folder = GetLeafData(); ConvertBigEndian(folder); ++leaf_records_read_; ++current_leaf_records_read_; if (IsKeyUnexported(key) || unexported_parents_.find(parent_id) != unexported_parents_.end()) { unexported_parents_.insert(folder->folderID); current_record_.unexported = true; } if (parent_id != 0) { auto parent_name = folder_cnid_map_.find(parent_id); if (parent_name != folder_cnid_map_.end()) key = parent_name->second + kFilePathSeparator + key; } folder_cnid_map_[folder->folderID] = key; current_record_.path = key; current_record_.folder = folder; break; } case kHFSPlusFileRecord: { auto file = GetLeafData(); ConvertBigEndian(file); ++leaf_records_read_; ++current_leaf_records_read_; base::string16 path = folder_cnid_map_[parent_id] + kFilePathSeparator + key; current_record_.path = path; current_record_.file = file; current_record_.unexported = unexported_parents_.find(parent_id) != unexported_parents_.end(); break; } case kHFSPlusFolderThreadRecord: case kHFSPlusFileThreadRecord: { GetLeafData(); // recordType GetLeafData(); // reserved GetLeafData(); // parentID auto string_length = OSSwapBigToHostInt16(*GetLeafData()); for (uint16_t i = 0; i < string_length; ++i) GetLeafData(); ++leaf_records_read_; ++current_leaf_records_read_; break; } default: DLOG(ERROR) << ""Unknown record type "" << current_record_.record_type; return false; } if (current_leaf_records_read_ >= current_leaf_->numRecords) { current_leaf_number_ = current_leaf_->fLink; read_current_leaf_ = false; } return true; } ",0 "void ServiceWorkerContextCore::UnregisterServiceWorker( const GURL& scope, UnregistrationCallback callback) { DCHECK_CURRENTLY_ON(BrowserThread::IO); job_coordinator_->Unregister( scope, base::BindOnce(&ServiceWorkerContextCore::UnregistrationComplete, AsWeakPtr(), scope, std::move(callback))); } ",0 "flatpak_proxy_class_init (FlatpakProxyClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); GSocketServiceClass *socket_service_class = G_SOCKET_SERVICE_CLASS (klass); object_class->get_property = flatpak_proxy_get_property; object_class->set_property = flatpak_proxy_set_property; object_class->finalize = flatpak_proxy_finalize; socket_service_class->incoming = flatpak_proxy_incoming; g_object_class_install_property (object_class, PROP_DBUS_ADDRESS, g_param_spec_string (""dbus-address"", """", """", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); g_object_class_install_property (object_class, PROP_SOCKET_PATH, g_param_spec_string (""socket-path"", """", """", NULL, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); } ",0 "void Parcel::setDataPosition(size_t pos) const { if (pos > INT32_MAX) { abort(); } mDataPos = pos; mNextObjectHint = 0; } ",0 "void RenderBox::computePositionedLogicalWidth(LogicalExtentComputedValues& computedValues) const { if (isReplaced()) { computePositionedLogicalWidthReplaced(computedValues); return; } const RenderBoxModelObject* containerBlock = toRenderBoxModelObject(container()); const LayoutUnit containerLogicalWidth = containingBlockLogicalWidthForPositioned(containerBlock); TextDirection containerDirection = containerBlock->style()->direction(); bool isHorizontal = isHorizontalWritingMode(); const LayoutUnit bordersPlusPadding = borderAndPaddingLogicalWidth(); const Length marginLogicalLeft = isHorizontal ? style()->marginLeft() : style()->marginTop(); const Length marginLogicalRight = isHorizontal ? style()->marginRight() : style()->marginBottom(); Length logicalLeftLength = style()->logicalLeft(); Length logicalRightLength = style()->logicalRight(); /*---------------------------------------------------------------------------*\ * For the purposes of this section and the next, the term ""static position"" * (of an element) refers, roughly, to the position an element would have had * in the normal flow. More precisely: * * * The static position for 'left' is the distance from the left edge of the * containing block to the left margin edge of a hypothetical box that would * have been the first box of the element if its 'position' property had * been 'static' and 'float' had been 'none'. The value is negative if the * hypothetical box is to the left of the containing block. * * The static position for 'right' is the distance from the right edge of the * containing block to the right margin edge of the same hypothetical box as * above. The value is positive if the hypothetical box is to the left of the * containing block's edge. * * But rather than actually calculating the dimensions of that hypothetical box, * user agents are free to make a guess at its probable position. * * For the purposes of calculating the static position, the containing block of * fixed positioned elements is the initial containing block instead of the * viewport, and all scrollable boxes should be assumed to be scrolled to their * origin. \*---------------------------------------------------------------------------*/ computeInlineStaticDistance(logicalLeftLength, logicalRightLength, this, containerBlock, containerLogicalWidth); computePositionedLogicalWidthUsing(style()->logicalWidth(), containerBlock, containerDirection, containerLogicalWidth, bordersPlusPadding, logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, computedValues); if (!style()->logicalMaxWidth().isUndefined()) { LogicalExtentComputedValues maxValues; computePositionedLogicalWidthUsing(style()->logicalMaxWidth(), containerBlock, containerDirection, containerLogicalWidth, bordersPlusPadding, logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, maxValues); if (computedValues.m_extent > maxValues.m_extent) { computedValues.m_extent = maxValues.m_extent; computedValues.m_position = maxValues.m_position; computedValues.m_margins.m_start = maxValues.m_margins.m_start; computedValues.m_margins.m_end = maxValues.m_margins.m_end; } } if (!style()->logicalMinWidth().isZero() || style()->logicalMinWidth().isIntrinsic()) { LogicalExtentComputedValues minValues; computePositionedLogicalWidthUsing(style()->logicalMinWidth(), containerBlock, containerDirection, containerLogicalWidth, bordersPlusPadding, logicalLeftLength, logicalRightLength, marginLogicalLeft, marginLogicalRight, minValues); if (computedValues.m_extent < minValues.m_extent) { computedValues.m_extent = minValues.m_extent; computedValues.m_position = minValues.m_position; computedValues.m_margins.m_start = minValues.m_margins.m_start; computedValues.m_margins.m_end = minValues.m_margins.m_end; } } computedValues.m_extent += bordersPlusPadding; } ",0 "void FrameLoader::SaveScrollAnchor() { if (!RuntimeEnabledFeatures::ScrollAnchorSerializationEnabled()) return; if (!document_loader_ || !document_loader_->GetHistoryItem() || !frame_->View()) return; if (NeedsHistoryItemRestore(document_loader_->LoadType()) && !document_loader_->GetInitialScrollState().was_scrolled_by_user) return; HistoryItem* history_item = document_loader_->GetHistoryItem(); if (ScrollableArea* layout_scrollable_area = frame_->View()->LayoutViewport()) { ScrollAnchor* scroll_anchor = layout_scrollable_area->GetScrollAnchor(); DCHECK(scroll_anchor); const SerializedAnchor& serialized_anchor = scroll_anchor->GetSerializedAnchor(); if (serialized_anchor.IsValid()) { history_item->SetScrollAnchorData( {serialized_anchor.selector, WebFloatPoint(serialized_anchor.relative_offset.X(), serialized_anchor.relative_offset.Y()), serialized_anchor.simhash}); } } } ",0 "static int irda_recvmsg_dgram(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size, int flags) { struct sock *sk = sock->sk; struct irda_sock *self = irda_sk(sk); struct sk_buff *skb; size_t copied; int err; IRDA_DEBUG(4, ""%s()\n"", __func__); skb = skb_recv_datagram(sk, flags & ~MSG_DONTWAIT, flags & MSG_DONTWAIT, &err); if (!skb) return err; skb_reset_transport_header(skb); copied = skb->len; if (copied > size) { IRDA_DEBUG(2, ""%s(), Received truncated frame (%zd < %zd)!\n"", __func__, copied, size); copied = size; msg->msg_flags |= MSG_TRUNC; } skb_copy_datagram_iovec(skb, 0, msg->msg_iov, copied); skb_free_datagram(sk, skb); /* * Check if we have previously stopped IrTTP and we know * have more free space in our rx_queue. If so tell IrTTP * to start delivering frames again before our rx_queue gets * empty */ if (self->rx_flow == FLOW_STOP) { if ((atomic_read(&sk->sk_rmem_alloc) << 2) <= sk->sk_rcvbuf) { IRDA_DEBUG(2, ""%s(), Starting IrTTP\n"", __func__); self->rx_flow = FLOW_START; irttp_flow_request(self->tsap, FLOW_START); } } return copied; } ",1 "local void outb_check(void *dummy) { size_t len; (void)dummy; Trace((""-- launched decompress check thread"")); do { possess(outb_check_more); wait_for(outb_check_more, TO_BE, 1); len = out_len; g.out_check = CHECK(g.out_check, out_copy, len); Trace((""-- decompress checked %lu bytes"", len)); twist(outb_check_more, TO, 0); } while (len); Trace((""-- exited decompress check thread"")); } ",0 "static int unpack_pkt(git_pkt **out, const char *line, size_t len) { git_pkt_unpack *pkt; GIT_UNUSED(len); pkt = git__malloc(sizeof(*pkt)); GITERR_CHECK_ALLOC(pkt); pkt->type = GIT_PKT_UNPACK; if (!git__prefixcmp(line, ""unpack ok"")) pkt->unpack_ok = 1; else pkt->unpack_ok = 0; *out = (git_pkt *)pkt; return 0; } ",0 "void RedirectHostsToTestData(const char* const urls[], size_t size) { net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); base::FilePath base_path; GetTestDataDirectory(&base_path); for (size_t i = 0; i < size; ++i) { const GURL url(urls[i]); EXPECT_TRUE(url.is_valid()); filter->AddUrlInterceptor( url, URLRequestMockHTTPJob::CreateInterceptor(base_path)); } } ",0 "bool ReturnsInvalidPath(int dir_type) { base::FilePath path; bool result = PathService::Get(dir_type, &path); return !result && path.empty(); } ",0 "BGD_DECLARE(void) gdImageCopyResized (gdImagePtr dst, gdImagePtr src, int dstX, int dstY, int srcX, int srcY, int dstW, int dstH, int srcW, int srcH) { int c; int x, y; int tox, toy; int ydest; int i; int colorMap[gdMaxColors]; /* Stretch vectors */ int *stx; int *sty; /* We only need to use floating point to determine the correct stretch vector for one line's worth. */ if (overflow2(sizeof (int), srcW)) { return; } if (overflow2(sizeof (int), srcH)) { return; } stx = (int *) gdMalloc (sizeof (int) * srcW); if (!stx) { return; } sty = (int *) gdMalloc (sizeof (int) * srcH); if (!sty) { gdFree(stx); return; } /* Fixed by Mao Morimoto 2.0.16 */ for (i = 0; (i < srcW); i++) { stx[i] = dstW * (i + 1) / srcW - dstW * i / srcW; } for (i = 0; (i < srcH); i++) { sty[i] = dstH * (i + 1) / srcH - dstH * i / srcH; } for (i = 0; (i < gdMaxColors); i++) { colorMap[i] = (-1); } toy = dstY; for (y = srcY; (y < (srcY + srcH)); y++) { for (ydest = 0; (ydest < sty[y - srcY]); ydest++) { tox = dstX; for (x = srcX; (x < (srcX + srcW)); x++) { int nc = 0; int mapTo; if (!stx[x - srcX]) { continue; } if (dst->trueColor) { /* 2.0.9: Thorben Kundinger: Maybe the source image is not a truecolor image */ if (!src->trueColor) { int tmp = gdImageGetPixel (src, x, y); mapTo = gdImageGetTrueColorPixel (src, x, y); if (gdImageGetTransparent (src) == tmp) { /* 2.0.21, TK: not tox++ */ tox += stx[x - srcX]; continue; } } else { /* TK: old code follows */ mapTo = gdImageGetTrueColorPixel (src, x, y); /* Added 7/24/95: support transparent copies */ if (gdImageGetTransparent (src) == mapTo) { /* 2.0.21, TK: not tox++ */ tox += stx[x - srcX]; continue; } } } else { c = gdImageGetPixel (src, x, y); /* Added 7/24/95: support transparent copies */ if (gdImageGetTransparent (src) == c) { tox += stx[x - srcX]; continue; } if (src->trueColor) { /* Remap to the palette available in the destination image. This is slow and works badly. */ mapTo = gdImageColorResolveAlpha (dst, gdTrueColorGetRed (c), gdTrueColorGetGreen (c), gdTrueColorGetBlue (c), gdTrueColorGetAlpha (c)); } else { /* Have we established a mapping for this color? */ if (colorMap[c] == (-1)) { /* If it's the same image, mapping is trivial */ if (dst == src) { nc = c; } else { /* Find or create the best match */ /* 2.0.5: can't use gdTrueColorGetRed, etc with palette */ nc = gdImageColorResolveAlpha (dst, gdImageRed (src, c), gdImageGreen (src, c), gdImageBlue (src, c), gdImageAlpha (src, c)); } colorMap[c] = nc; } mapTo = colorMap[c]; } } for (i = 0; (i < stx[x - srcX]); i++) { gdImageSetPixel (dst, tox, toy, mapTo); tox++; } } toy++; } } gdFree (stx); gdFree (sty); } ",0 "ScriptPromise BluetoothRemoteGATTServer::connect(ScriptState* scriptState) { m_device->bluetooth()->addDevice(device()->id(), device()); ScriptPromiseResolver* resolver = ScriptPromiseResolver::create(scriptState); ScriptPromise promise = resolver->promise(); mojom::blink::WebBluetoothService* service = m_device->bluetooth()->service(); service->RemoteServerConnect( device()->id(), convertToBaseCallback(WTF::bind( &BluetoothRemoteGATTServer::ConnectCallback, wrapPersistent(this), wrapPersistent(resolver)))); return promise; } ",0 "static void release_ds_buffers(void) { } ",0 "static void srpt_send_done(struct ib_cq *cq, struct ib_wc *wc) { struct srpt_rdma_ch *ch = cq->cq_context; struct srpt_send_ioctx *ioctx = container_of(wc->wr_cqe, struct srpt_send_ioctx, ioctx.cqe); enum srpt_command_state state; state = srpt_set_cmd_state(ioctx, SRPT_STATE_DONE); WARN_ON(state != SRPT_STATE_CMD_RSP_SENT && state != SRPT_STATE_MGMT_RSP_SENT); atomic_inc(&ch->sq_wr_avail); if (wc->status != IB_WC_SUCCESS) { pr_info(""sending response for ioctx 0x%p failed"" "" with status %d\n"", ioctx, wc->status); atomic_dec(&ch->req_lim); srpt_abort_cmd(ioctx); goto out; } if (state != SRPT_STATE_DONE) { srpt_unmap_sg_to_ib_sge(ch, ioctx); transport_generic_free_cmd(&ioctx->cmd, 0); } else { pr_err(""IB completion has been received too late for"" "" wr_id = %u.\n"", ioctx->ioctx.index); } out: while (!list_empty(&ch->cmd_wait_list) && srpt_get_ch_state(ch) == CH_LIVE && (ioctx = srpt_get_send_ioctx(ch)) != NULL) { struct srpt_recv_ioctx *recv_ioctx; recv_ioctx = list_first_entry(&ch->cmd_wait_list, struct srpt_recv_ioctx, wait_list); list_del(&recv_ioctx->wait_list); srpt_handle_new_iu(ch, recv_ioctx, ioctx); } } ",0 "static void pcd_req_sense(struct pcd_unit *cd, char *fun) { char rs_cmd[12] = { 0x03, 0, 0, 0, 16, 0, 0, 0, 0, 0, 0, 0 }; char buf[16]; int r, c; r = pcd_command(cd, rs_cmd, 16, ""Request sense""); mdelay(1); if (!r) pcd_completion(cd, buf, ""Request sense""); cd->last_sense = -1; c = 2; if (!r) { if (fun) printk(""%s: %s: Sense key: %x, ASC: %x, ASQ: %x\n"", cd->name, fun, buf[2] & 0xf, buf[12], buf[13]); c = buf[2] & 0xf; cd->last_sense = c | ((buf[12] & 0xff) << 8) | ((buf[13] & 0xff) << 16); } if ((c == 2) || (c == 6)) cd->changed = 1; } ",0 "static int sctp_setsockopt_add_streams(struct sock *sk, char __user *optval, unsigned int optlen) { struct sctp_association *asoc; struct sctp_add_streams params; int retval = -EINVAL; if (optlen != sizeof(params)) goto out; if (copy_from_user(¶ms, optval, optlen)) { retval = -EFAULT; goto out; } asoc = sctp_id2assoc(sk, params.sas_assoc_id); if (!asoc) goto out; retval = sctp_send_add_streams(asoc, ¶ms); out: return retval; } ",0 "void SafeBrowsingBlockingPage::CommandReceived(const std::string& cmd) { std::string command(cmd); // Make a local copy so we can modify it. if (command.length() > 1 && command[0] == '""') { command = command.substr(1, command.length() - 2); } RecordUserReactionTime(command); if (command == kDoReportCommand) { SetReportingPreference(true); return; } if (command == kDontReportCommand) { SetReportingPreference(false); return; } if (command == kLearnMoreCommand) { GURL url; SBThreatType threat_type = unsafe_resources_[0].threat_type; if (threat_type == SB_THREAT_TYPE_URL_MALWARE) { url = google_util::AppendGoogleLocaleParam(GURL(kLearnMoreMalwareUrl)); } else if (threat_type == SB_THREAT_TYPE_URL_PHISHING || threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) { url = google_util::AppendGoogleLocaleParam(GURL(kLearnMorePhishingUrl)); } else { NOTREACHED(); } OpenURLParams params( url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); web_contents_->OpenURL(params); return; } if (command == kLearnMoreCommandV2) { GURL url; SBThreatType threat_type = unsafe_resources_[0].threat_type; if (threat_type == SB_THREAT_TYPE_URL_MALWARE) { url = google_util::AppendGoogleLocaleParam(GURL(kLearnMoreMalwareUrlV2)); } else if (threat_type == SB_THREAT_TYPE_URL_PHISHING || threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL) { url = google_util::AppendGoogleLocaleParam(GURL(kLearnMorePhishingUrlV2)); } else { NOTREACHED(); } OpenURLParams params( url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); web_contents_->OpenURL(params); return; } if (command == kShowPrivacyCommand) { GURL url(l10n_util::GetStringUTF8(IDS_SAFE_BROWSING_PRIVACY_POLICY_URL)); OpenURLParams params( url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); web_contents_->OpenURL(params); return; } bool proceed_blocked = false; if (command == kProceedCommand) { if (IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)) { proceed_blocked = true; } else { interstitial_page_->Proceed(); return; } } if (command == kTakeMeBackCommand || proceed_blocked) { if (is_main_frame_load_blocked_) { interstitial_page_->DontProceed(); return; } if (web_contents_->GetController().CanGoBack()) { web_contents_->GetController().GoBack(); } else { web_contents_->GetController().LoadURL( GURL(chrome::kChromeUINewTabURL), content::Referrer(), content::PAGE_TRANSITION_AUTO_TOPLEVEL, std::string()); } return; } int element_index = 0; size_t colon_index = command.find(':'); if (colon_index != std::string::npos) { DCHECK(colon_index < command.size() - 1); bool result = base::StringToInt(base::StringPiece(command.begin() + colon_index + 1, command.end()), &element_index); command = command.substr(0, colon_index); DCHECK(result); } if (element_index >= static_cast(unsafe_resources_.size())) { NOTREACHED(); return; } std::string bad_url_spec = unsafe_resources_[element_index].url.spec(); if (command == kReportErrorCommand) { SBThreatType threat_type = unsafe_resources_[element_index].threat_type; DCHECK(threat_type == SB_THREAT_TYPE_URL_PHISHING || threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); GURL report_url = safe_browsing_util::GeneratePhishingReportUrl( kSbReportPhishingErrorUrl, bad_url_spec, threat_type == SB_THREAT_TYPE_CLIENT_SIDE_PHISHING_URL); OpenURLParams params( report_url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); web_contents_->OpenURL(params); return; } if (command == kShowDiagnosticCommand) { std::string diagnostic = base::StringPrintf(kSbDiagnosticUrl, net::EscapeQueryParamValue(bad_url_spec, true).c_str()); GURL diagnostic_url(diagnostic); diagnostic_url = google_util::AppendGoogleLocaleParam(diagnostic_url); DCHECK(unsafe_resources_[element_index].threat_type == SB_THREAT_TYPE_URL_MALWARE); OpenURLParams params( diagnostic_url, Referrer(), CURRENT_TAB, content::PAGE_TRANSITION_LINK, false); web_contents_->OpenURL(params); return; } if (command == kExpandedSeeMore) { return; } NOTREACHED() << ""Unexpected command: "" << command; } ",1 " parse_encoding( T1_Face face, T1_Loader loader ) { T1_Parser parser = &loader->parser; FT_Byte* cur; FT_Byte* limit = parser->root.limit; PSAux_Service psaux = (PSAux_Service)face->psaux; T1_Skip_Spaces( parser ); cur = parser->root.cursor; if ( cur >= limit ) { FT_ERROR(( ""parse_encoding: out of bounds\n"" )); parser->root.error = FT_THROW( Invalid_File_Format ); return; } /* if we have a number or `[', the encoding is an array, */ /* and we must load it now */ if ( ft_isdigit( *cur ) || *cur == '[' ) { T1_Encoding encode = &face->type1.encoding; FT_Int count, n; PS_Table char_table = &loader->encoding_table; FT_Memory memory = parser->root.memory; FT_Error error; FT_Bool only_immediates = 0; /* read the number of entries in the encoding; should be 256 */ if ( *cur == '[' ) { count = 256; only_immediates = 1; parser->root.cursor++; } else count = (FT_Int)T1_ToInt( parser ); T1_Skip_Spaces( parser ); if ( parser->root.cursor >= limit ) return; /* we use a T1_Table to store our charnames */ loader->num_chars = encode->num_chars = count; if ( FT_NEW_ARRAY( encode->char_index, count ) || FT_NEW_ARRAY( encode->char_name, count ) || FT_SET_ERROR( psaux->ps_table_funcs->init( char_table, count, memory ) ) ) { parser->root.error = error; return; } /* We need to `zero' out encoding_table.elements */ for ( n = 0; n < count; n++ ) { char* notdef = (char *)"".notdef""; T1_Add_Table( char_table, n, notdef, 8 ); } /* Now we need to read records of the form */ /* */ /* ... charcode /charname ... */ /* */ /* for each entry in our table. */ /* */ /* We simply look for a number followed by an immediate */ /* name. Note that this ignores correctly the sequence */ /* that is often seen in type1 fonts: */ /* */ /* 0 1 255 { 1 index exch /.notdef put } for dup */ /* */ /* used to clean the encoding array before anything else. */ /* */ /* Alternatively, if the array is directly given as */ /* */ /* /Encoding [ ... ] */ /* */ /* we only read immediates. */ n = 0; T1_Skip_Spaces( parser ); while ( parser->root.cursor < limit ) { cur = parser->root.cursor; /* we stop when we encounter a `def' or `]' */ if ( *cur == 'd' && cur + 3 < limit ) { if ( cur[1] == 'e' && cur[2] == 'f' && IS_PS_DELIM( cur[3] ) ) { FT_TRACE6(( ""encoding end\n"" )); cur += 3; break; } } if ( *cur == ']' ) { FT_TRACE6(( ""encoding end\n"" )); cur++; break; } /* check whether we've found an entry */ if ( ft_isdigit( *cur ) || only_immediates ) { FT_Int charcode; if ( only_immediates ) charcode = n; else { charcode = (FT_Int)T1_ToInt( parser ); T1_Skip_Spaces( parser ); } cur = parser->root.cursor; parser->root.cursor = cur; T1_Skip_PS_Token( parser ); if ( parser->root.cursor >= limit ) return; if ( parser->root.error ) return; len = parser->root.cursor - cur; parser->root.error = T1_Add_Table( char_table, charcode, cur, len + 1 ); if ( parser->root.error ) return; char_table->elements[charcode][len] = '\0'; n++; } else if ( only_immediates ) { /* Since the current position is not updated for */ /* immediates-only mode we would get an infinite loop if */ /* we don't do anything here. */ /* */ /* This encoding array is not valid according to the type1 */ /* specification (it might be an encoding for a CID type1 */ /* font, however), so we conclude that this font is NOT a */ /* type1 font. */ parser->root.error = FT_THROW( Unknown_File_Format ); return; } } else { T1_Skip_PS_Token( parser ); if ( parser->root.error ) return; } T1_Skip_Spaces( parser ); } face->type1.encoding_type = T1_ENCODING_TYPE_ARRAY; parser->root.cursor = cur; } ",1 "static void absFunc(sqlite3_context *context, int argc, sqlite3_value **argv){ assert( argc==1 ); UNUSED_PARAMETER(argc); switch( sqlite3_value_type(argv[0]) ){ case SQLITE_INTEGER: { i64 iVal = sqlite3_value_int64(argv[0]); if( iVal<0 ){ if( iVal==SMALLEST_INT64 ){ /* IMP: R-31676-45509 If X is the integer -9223372036854775808 ** then abs(X) throws an integer overflow error since there is no ** equivalent positive 64-bit two complement value. */ sqlite3_result_error(context, ""integer overflow"", -1); return; } iVal = -iVal; } sqlite3_result_int64(context, iVal); break; } case SQLITE_NULL: { /* IMP: R-37434-19929 Abs(X) returns NULL if X is NULL. */ sqlite3_result_null(context); break; } default: { /* Because sqlite3_value_double() returns 0.0 if the argument is not ** something that can be converted into a number, we have: ** IMP: R-01992-00519 Abs(X) returns 0.0 if X is a string or blob ** that cannot be converted to a numeric value. */ double rVal = sqlite3_value_double(argv[0]); if( rVal<0 ) rVal = -rVal; sqlite3_result_double(context, rVal); break; } } } ",0 "pick_fallback_dpid(void) { struct eth_addr ea; eth_addr_nicira_random(&ea); return eth_addr_to_uint64(ea); } ",0 "DictionaryValue* AppNotificationToValue( const sync_pb::AppNotification& proto) { DictionaryValue* value = new DictionaryValue(); SET_STR(guid); SET_STR(app_id); SET_INT64(creation_timestamp_ms); SET_STR(title); SET_STR(body_text); SET_STR(link_url); SET_STR(link_text); return value; } ",0 "static int omninet_port_probe(struct usb_serial_port *port) { struct omninet_data *od; od = kzalloc(sizeof(*od), GFP_KERNEL); if (!od) return -ENOMEM; usb_set_serial_port_data(port, od); return 0; } ",0 "static u32 rateset_to_mask(struct ieee80211_supported_band *sband, u8 *rates, u8 rates_len) { u8 i; u32 mask = 0; for (i = 0; i < rates_len; i++) { int rate = (rates[i] & 0x7f) * 5; int ridx; for (ridx = 0; ridx < sband->n_bitrates; ridx++) { struct ieee80211_rate *srate = &sband->bitrates[ridx]; if (rate == srate->bitrate) { mask |= 1 << ridx; break; } } if (ridx == sband->n_bitrates) return 0; /* rate not found */ } return mask; } ",0 "int send_xmessage_using_uids(struct proclistlist *pll, char *message){ int num_users; int lokke; int *uids=get_userlist(pll,&num_users); for(lokke=0;lokkepw_dir); if(send_xmessage(xauthpath,message)==1){ free(uids); return 1; } } free(uids); return 0; } ",0 "static int cipso_v4_genopt(unsigned char *buf, u32 buf_len, const struct cipso_v4_doi *doi_def, const struct netlbl_lsm_secattr *secattr) { int ret_val; u32 iter; if (buf_len <= CIPSO_V4_HDR_LEN) return -ENOSPC; /* XXX - This code assumes only one tag per CIPSO option which isn't * really a good assumption to make but since we only support the MAC * tags right now it is a safe assumption. */ iter = 0; do { memset(buf, 0, buf_len); switch (doi_def->tags[iter]) { case CIPSO_V4_TAG_RBITMAP: ret_val = cipso_v4_gentag_rbm(doi_def, secattr, &buf[CIPSO_V4_HDR_LEN], buf_len - CIPSO_V4_HDR_LEN); break; case CIPSO_V4_TAG_ENUM: ret_val = cipso_v4_gentag_enum(doi_def, secattr, &buf[CIPSO_V4_HDR_LEN], buf_len - CIPSO_V4_HDR_LEN); break; case CIPSO_V4_TAG_RANGE: ret_val = cipso_v4_gentag_rng(doi_def, secattr, &buf[CIPSO_V4_HDR_LEN], buf_len - CIPSO_V4_HDR_LEN); break; case CIPSO_V4_TAG_LOCAL: ret_val = cipso_v4_gentag_loc(doi_def, secattr, &buf[CIPSO_V4_HDR_LEN], buf_len - CIPSO_V4_HDR_LEN); break; default: return -EPERM; } iter++; } while (ret_val < 0 && iter < CIPSO_V4_TAG_MAXCNT && doi_def->tags[iter] != CIPSO_V4_TAG_INVALID); if (ret_val < 0) return ret_val; cipso_v4_gentag_hdr(doi_def, buf, ret_val); return CIPSO_V4_HDR_LEN + ret_val; } ",0 "static int pcm_chmap_ctl_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) { struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol); uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; uinfo->count = 0; uinfo->count = info->max_channels; uinfo->value.integer.min = 0; uinfo->value.integer.max = SNDRV_CHMAP_LAST; return 0; } ",0 "static void rawsock_report_error(struct sock *sk, int err) { pr_debug(""sk=%p err=%d\n"", sk, err); sk->sk_shutdown = SHUTDOWN_MASK; sk->sk_err = -err; sk->sk_error_report(sk); rawsock_write_queue_purge(sk); } ",0 "piv_read_binary(sc_card_t *card, unsigned int idx, unsigned char *buf, size_t count, unsigned long flags) { piv_private_data_t * priv = PIV_DATA(card); int enumtag; int r; u8 *rbuf = NULL; size_t rbuflen = 0; const u8 *body; size_t bodylen; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (priv->selected_obj < 0) LOG_FUNC_RETURN(card->ctx, SC_ERROR_INTERNAL); enumtag = piv_objects[priv->selected_obj].enumtag; if (priv->rwb_state == -1) { r = piv_get_cached_data(card, enumtag, &rbuf, &rbuflen); if (r >=0) { /* an object with no data will be considered not found */ /* Discovery tag = 0x73, all others are 0x53 */ if (!rbuf || rbuf[0] == 0x00 || ((rbuf[0]&0xDF) == 0x53 && rbuf[1] == 0x00)) { r = SC_ERROR_FILE_NOT_FOUND; goto err; } sc_log(card->ctx, ""DEE rbuf=%p,rbuflen=%""SC_FORMAT_LEN_SIZE_T""u,"", rbuf, rbuflen); body = sc_asn1_find_tag(card->ctx, rbuf, rbuflen, rbuf[0], &bodylen); if (body == NULL) { /* if missing, assume its the body */ /* DEE bug in the beta card */ sc_log(card->ctx, "" ***** tag 0x53 MISSING""); r = SC_ERROR_INVALID_DATA; goto err; } if (bodylen > body - rbuf + rbuflen) { sc_log(card->ctx, "" ***** tag length > then data: %""SC_FORMAT_LEN_SIZE_T""u>%""SC_FORMAT_LEN_PTRDIFF_T""u+%""SC_FORMAT_LEN_SIZE_T""u"", bodylen, body - rbuf, rbuflen); r = SC_ERROR_INVALID_DATA; goto err; } /* if cached obj has internal interesting data (cert or pub key) */ if (priv->return_only_cert || piv_objects[enumtag].flags & PIV_OBJECT_TYPE_PUBKEY) { r = piv_cache_internal_data(card, enumtag); if (r < 0) goto err; } } priv->rwb_state = 0; } if (priv->return_only_cert || piv_objects[enumtag].flags & PIV_OBJECT_TYPE_PUBKEY) { rbuf = priv->obj_cache[enumtag].internal_obj_data; rbuflen = priv->obj_cache[enumtag].internal_obj_len; } else { rbuf = priv->obj_cache[enumtag].obj_data; rbuflen = priv->obj_cache[enumtag].obj_len; } /* rbuf rbuflen has pointer and length to cached data */ if ( rbuflen < idx + count) count = rbuflen - idx; if (count <= 0) { r = 0; priv->rwb_state = 1; } else { memcpy(buf, rbuf + idx, count); r = count; } err: LOG_FUNC_RETURN(card->ctx, r); } ",0 " static void Create(chrome::mojom::ZipFileCreatorRequest request) { mojo::MakeStrongBinding(base::MakeUnique(), std::move(request)); } ",0 "static int opaam(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; int immediate = op->operands[0].immediate * op->operands[0].sign; data[l++] = 0xd4; if (immediate == 0) { data[l++] = 0x0a; } else if (immediate < 256 && immediate > -129) { data[l++] = immediate; } return l; } ",0 "void Dispatcher::ClearPortData(int port_id) { port_to_tab_id_map_.erase(port_id); } ",0 "static int crypto_gcm_verify(struct aead_request *req, struct crypto_gcm_req_priv_ctx *pctx) { struct crypto_aead *aead = crypto_aead_reqtfm(req); u8 *auth_tag = pctx->auth_tag; u8 *iauth_tag = pctx->iauth_tag; unsigned int authsize = crypto_aead_authsize(aead); unsigned int cryptlen = req->cryptlen - authsize; crypto_xor(auth_tag, iauth_tag, 16); scatterwalk_map_and_copy(iauth_tag, req->src, cryptlen, authsize, 0); return crypto_memneq(iauth_tag, auth_tag, authsize) ? -EBADMSG : 0; } ",0 "void WebRuntimeFeatures::EnableTimerThrottlingForBackgroundTabs(bool enable) { RuntimeEnabledFeatures::SetTimerThrottlingForBackgroundTabsEnabled(enable); } ",0 "int vcc_connect(struct socket *sock, int itf, short vpi, int vci) { struct atm_dev *dev; struct atm_vcc *vcc = ATM_SD(sock); int error; pr_debug(""(vpi %d, vci %d)\n"", vpi, vci); if (sock->state == SS_CONNECTED) return -EISCONN; if (sock->state != SS_UNCONNECTED) return -EINVAL; if (!(vpi || vci)) return -EINVAL; if (vpi != ATM_VPI_UNSPEC && vci != ATM_VCI_UNSPEC) clear_bit(ATM_VF_PARTIAL, &vcc->flags); else if (test_bit(ATM_VF_PARTIAL, &vcc->flags)) return -EINVAL; pr_debug(""(TX: cl %d,bw %d-%d,sdu %d; "" ""RX: cl %d,bw %d-%d,sdu %d,AAL %s%d)\n"", vcc->qos.txtp.traffic_class, vcc->qos.txtp.min_pcr, vcc->qos.txtp.max_pcr, vcc->qos.txtp.max_sdu, vcc->qos.rxtp.traffic_class, vcc->qos.rxtp.min_pcr, vcc->qos.rxtp.max_pcr, vcc->qos.rxtp.max_sdu, vcc->qos.aal == ATM_AAL5 ? """" : vcc->qos.aal == ATM_AAL0 ? """" : "" ??? code "", vcc->qos.aal == ATM_AAL0 ? 0 : vcc->qos.aal); if (!test_bit(ATM_VF_HASQOS, &vcc->flags)) return -EBADFD; if (vcc->qos.txtp.traffic_class == ATM_ANYCLASS || vcc->qos.rxtp.traffic_class == ATM_ANYCLASS) return -EINVAL; if (likely(itf != ATM_ITF_ANY)) { dev = try_then_request_module(atm_dev_lookup(itf), ""atm-device-%d"", itf); } else { dev = NULL; mutex_lock(&atm_dev_mutex); if (!list_empty(&atm_devs)) { dev = list_entry(atm_devs.next, struct atm_dev, dev_list); atm_dev_hold(dev); } mutex_unlock(&atm_dev_mutex); } if (!dev) return -ENODEV; error = __vcc_connect(vcc, dev, vpi, vci); if (error) { atm_dev_put(dev); return error; } if (vpi == ATM_VPI_UNSPEC || vci == ATM_VCI_UNSPEC) set_bit(ATM_VF_PARTIAL, &vcc->flags); if (test_bit(ATM_VF_READY, &ATM_SD(sock)->flags)) sock->state = SS_CONNECTED; return 0; } ",0 "void PepperMediaDeviceManager::OnStreamGenerated( int request_id, const std::string& label, const StreamDeviceInfoArray& audio_device_array, const StreamDeviceInfoArray& video_device_array) {} ",0 "SYSCALL_DEFINE1(uselib, const char __user *, library) { struct file *file; struct filename *tmp = getname(library); int error = PTR_ERR(tmp); static const struct open_flags uselib_flags = { .open_flag = O_LARGEFILE | O_RDONLY | __FMODE_EXEC, .acc_mode = MAY_READ | MAY_EXEC | MAY_OPEN, .intent = LOOKUP_OPEN, .lookup_flags = LOOKUP_FOLLOW, }; if (IS_ERR(tmp)) goto out; file = do_filp_open(AT_FDCWD, tmp, &uselib_flags); putname(tmp); error = PTR_ERR(file); if (IS_ERR(file)) goto out; error = -EINVAL; if (!S_ISREG(file_inode(file)->i_mode)) goto exit; error = -EACCES; if (file->f_path.mnt->mnt_flags & MNT_NOEXEC) goto exit; fsnotify_open(file); error = -ENOEXEC; if(file->f_op) { struct linux_binfmt * fmt; read_lock(&binfmt_lock); list_for_each_entry(fmt, &formats, lh) { if (!fmt->load_shlib) continue; if (!try_module_get(fmt->module)) continue; read_unlock(&binfmt_lock); error = fmt->load_shlib(file); read_lock(&binfmt_lock); put_binfmt(fmt); if (error != -ENOEXEC) break; } read_unlock(&binfmt_lock); } exit: fput(file); out: return error; } ",0 "HRESULT CGaiaCredentialBase::Initialize(IGaiaCredentialProvider* provider) { LOGFN(INFO); DCHECK(provider); provider_ = provider; return S_OK; } ",0 "static int sha512_neon_update(struct shash_desc *desc, const u8 *data, unsigned int len) { struct sha512_state *sctx = shash_desc_ctx(desc); unsigned int partial = sctx->count[0] % SHA512_BLOCK_SIZE; int res; /* Handle the fast case right here */ if (partial + len < SHA512_BLOCK_SIZE) { sctx->count[0] += len; if (sctx->count[0] < len) sctx->count[1]++; memcpy(sctx->buf + partial, data, len); return 0; } if (!may_use_simd()) { res = crypto_sha512_update(desc, data, len); } else { kernel_neon_begin(); res = __sha512_neon_update(desc, data, len, partial); kernel_neon_end(); } return res; } ",0 "void DevToolsWindow::ActivateWindow() { if (IsDocked() && GetInspectedBrowserWindow()) web_contents_->GetView()->Focus(); else if (!IsDocked() && !browser_->window()->IsActive()) browser_->window()->Activate(); } ",0 "Layer* LayerTreeHost::LayerById(int id) const { auto iter = layer_id_map_.find(id); return iter != layer_id_map_.end() ? iter->second : nullptr; } ",0 "static int tg3_phy_cl45_read(struct tg3 *tp, u32 devad, u32 addr, u32 *val) { int err; err = tg3_writephy(tp, MII_TG3_MMD_CTRL, devad); if (err) goto done; err = tg3_writephy(tp, MII_TG3_MMD_ADDRESS, addr); if (err) goto done; err = tg3_writephy(tp, MII_TG3_MMD_CTRL, MII_TG3_MMD_CTRL_DATA_NOINC | devad); if (err) goto done; err = tg3_readphy(tp, MII_TG3_MMD_ADDRESS, val); done: return err; } ",0 "WebMediaPlayer::CORSMode HTMLMediaElement::corsMode() const { const AtomicString& crossOriginMode = fastGetAttribute(crossoriginAttr); if (crossOriginMode.isNull()) return WebMediaPlayer::CORSModeUnspecified; if (equalIgnoringCase(crossOriginMode, ""use-credentials"")) return WebMediaPlayer::CORSModeUseCredentials; return WebMediaPlayer::CORSModeAnonymous; } ",0 "bool GetAllWindowsFunction::RunImpl() { bool populate_tabs = false; if (HasOptionalArgument(0)) { DictionaryValue* args; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(0, &args)); if (args->HasKey(keys::kPopulateKey)) { EXTENSION_FUNCTION_VALIDATE(args->GetBoolean(keys::kPopulateKey, &populate_tabs)); } } result_.reset(new ListValue()); Profile* incognito_profile = include_incognito() ? profile()->GetOffTheRecordProfile() : NULL; for (BrowserList::const_iterator browser = BrowserList::begin(); browser != BrowserList::end(); ++browser) { if ((*browser)->profile() == profile() || (*browser)->profile() == incognito_profile) { static_cast(result_.get())-> Append(ExtensionTabUtil::CreateWindowValue(*browser, populate_tabs)); } } return true; } ",0 "void RenderFrameImpl::CommitSyncNavigation( std::unique_ptr info) { auto navigation_params = WebNavigationParams::CreateFromInfo(*info); navigation_params->service_worker_network_provider = BuildServiceWorkerNetworkProviderForNavigation( nullptr /* request_params */, nullptr /* controller_service_worker_info */); frame_->CommitNavigation(std::move(navigation_params), BuildDocumentState()); } ",0 "void TabStrip::PrepareForAnimation() { if (!IsDragSessionActive() && !TabDragController::IsAttachedTo(this)) { for (int i = 0; i < tab_count(); ++i) tab_at(i)->set_dragging(false); } } ",0 "SMB2_tdis(const unsigned int xid, struct cifs_tcon *tcon) { struct smb_rqst rqst; struct smb2_tree_disconnect_req *req; /* response is trivial */ int rc = 0; struct cifs_ses *ses = tcon->ses; int flags = 0; unsigned int total_len; struct kvec iov[1]; struct kvec rsp_iov; int resp_buf_type; cifs_dbg(FYI, ""Tree Disconnect\n""); if (!ses || !(ses->server)) return -EIO; if ((tcon->need_reconnect) || (tcon->ses->need_reconnect)) return 0; rc = smb2_plain_req_init(SMB2_TREE_DISCONNECT, tcon, (void **) &req, &total_len); if (rc) return rc; if (smb3_encryption_required(tcon)) flags |= CIFS_TRANSFORM_REQ; flags |= CIFS_NO_RESP; iov[0].iov_base = (char *)req; iov[0].iov_len = total_len; memset(&rqst, 0, sizeof(struct smb_rqst)); rqst.rq_iov = iov; rqst.rq_nvec = 1; rc = cifs_send_recv(xid, ses, &rqst, &resp_buf_type, flags, &rsp_iov); cifs_small_buf_release(req); if (rc) cifs_stats_fail_inc(tcon, SMB2_TREE_DISCONNECT_HE); return rc; } ",0 "void CL_DownloadsComplete( void ) { #ifdef USE_CURL if(clc.cURLUsed) { clc.cURLUsed = qfalse; CL_cURL_Shutdown(); if( clc.cURLDisconnected ) { if(clc.downloadRestart) { FS_Restart(clc.checksumFeed); clc.downloadRestart = qfalse; } clc.cURLDisconnected = qfalse; CL_Reconnect_f(); return; } } #endif if (clc.downloadRestart) { clc.downloadRestart = qfalse; FS_Restart(clc.checksumFeed); // We possibly downloaded a pak, restart the file system to load it CL_AddReliableCommand(""donedl"", qfalse); return; } clc.state = CA_LOADING; Com_EventLoop(); if ( clc.state != CA_LOADING ) { return; } Cvar_Set(""r_uiFullScreen"", ""0""); CL_FlushMemory(); cls.cgameStarted = qtrue; CL_InitCGame(); CL_SendPureChecksums(); CL_WritePacket(); CL_WritePacket(); CL_WritePacket(); } ",0 "error::Error GLES2DecoderPassthroughImpl::DoOverlayPromotionHintCHROMIUM( GLuint texture, GLboolean promotion_hint, GLint display_x, GLint display_y, GLint display_width, GLint display_height) { NOTIMPLEMENTED(); return error::kNoError; } ",0 "static int show_smap(struct seq_file *m, void *v) { struct proc_maps_private *priv = m->private; struct task_struct *task = priv->task; struct vm_area_struct *vma = v; struct mem_size_stats mss; struct mm_walk smaps_walk = { .pmd_entry = smaps_pte_range, .mm = vma->vm_mm, .private = &mss, }; memset(&mss, 0, sizeof mss); mss.vma = vma; /* mmap_sem is held in m_start */ if (vma->vm_mm && !is_vm_hugetlb_page(vma)) walk_page_range(vma->vm_start, vma->vm_end, &smaps_walk); show_map_vma(m, vma); seq_printf(m, ""Size: %8lu kB\n"" ""Rss: %8lu kB\n"" ""Pss: %8lu kB\n"" ""Shared_Clean: %8lu kB\n"" ""Shared_Dirty: %8lu kB\n"" ""Private_Clean: %8lu kB\n"" ""Private_Dirty: %8lu kB\n"" ""Referenced: %8lu kB\n"" ""Anonymous: %8lu kB\n"" ""AnonHugePages: %8lu kB\n"" ""Swap: %8lu kB\n"" ""KernelPageSize: %8lu kB\n"" ""MMUPageSize: %8lu kB\n"" ""Locked: %8lu kB\n"", (vma->vm_end - vma->vm_start) >> 10, mss.resident >> 10, (unsigned long)(mss.pss >> (10 + PSS_SHIFT)), mss.shared_clean >> 10, mss.shared_dirty >> 10, mss.private_clean >> 10, mss.private_dirty >> 10, mss.referenced >> 10, mss.anonymous >> 10, mss.anonymous_thp >> 10, mss.swap >> 10, vma_kernel_pagesize(vma) >> 10, vma_mmu_pagesize(vma) >> 10, (vma->vm_flags & VM_LOCKED) ? (unsigned long)(mss.pss >> (10 + PSS_SHIFT)) : 0); if (m->count < m->size) /* vma is copied successfully */ m->version = (vma != get_gate_vma(task->mm)) ? vma->vm_start : 0; return 0; } ",0 "uint32_t GetNumberPayloads(size_t handle) { mp4object *mp4 = (mp4object *)handle; if (mp4) { return mp4->indexcount; } return 0; } ",0 "int CLASS parse_tiff_ifd (int base) { unsigned entries, tag, type, len, plen=16, save; int ifd, use_cm=0, cfa, i, j, c, ima_len=0; int blrr=1, blrc=1, dblack[] = { 0,0,0,0 }; char software[64], *cbuf, *cp; uchar cfa_pat[16], cfa_pc[] = { 0,1,2,3 }, tab[256]; double cc[4][4], cm[4][3], cam_xyz[4][3], num; double ab[]={ 1,1,1,1 }, asn[] = { 0,0,0,0 }, xyz[] = { 1,1,1 }; int sony_curve[] = { 0,0,0,0,0,4095 }; #ifndef WITH_MMAP_HACK unsigned sony_offset=0, sony_length=0, sony_key=0; #endif struct jhead jh; #ifndef WITH_MMAP_HACK unsigned *buf; FILE *sfp; #endif /* WITH_MMAP_HACK */ if (tiff_nifds >= (int) sizeof tiff_ifd / (int) sizeof tiff_ifd[0]) return 1; ifd = tiff_nifds++; for (j=0; j < 4; j++) for (i=0; i < 4; i++) cc[j][i] = i == j; entries = get2(); if (entries > 512) return 1; while (entries--) { tiff_get (base, &tag, &type, &len, &save); switch (tag) { case 5: width = get2(); break; case 6: height = get2(); break; case 7: width += get2(); break; case 9: filters = get2(); break; case 17: case 18: if (type == 3 && len == 1) cam_mul[(tag-17)*2] = get2() / 256.0; break; case 23: if (type == 3) iso_speed = get2(); break; case 36: case 37: case 38: cam_mul[tag-0x24] = get2(); break; case 39: if (len < 50 || cam_mul[0]) break; fseek (ifp, 12, SEEK_CUR); FORC3 cam_mul[c] = get2(); break; case 46: if (type != 7 || fgetc(ifp) != 0xff || fgetc(ifp) != 0xd8) break; thumb_offset = ftell(ifp) - 2; thumb_length = len; break; case 61440: /* Fuji HS10 table */ parse_tiff_ifd (base); break; case 2: case 256: case 61441: /* ImageWidth */ tiff_ifd[ifd].width = getint(type); break; case 3: case 257: case 61442: /* ImageHeight */ tiff_ifd[ifd].height = getint(type); break; case 258: /* BitsPerSample */ case 61443: tiff_ifd[ifd].samples = len & 7; tiff_ifd[ifd].bps = getint(type); break; case 61446: raw_height = 0; load_raw = &CLASS packed_load_raw; load_flags = get4() && (filters=0x16161616) ? 24:80; break; case 259: /* Compression */ tiff_ifd[ifd].comp = get2(); break; case 262: /* PhotometricInterpretation */ tiff_ifd[ifd].phint = get2(); break; case 270: /* ImageDescription */ fread (desc, 512, 1, ifp); break; case 271: /* Make */ fgets (make, 64, ifp); break; case 272: /* Model */ fgets (model, 64, ifp); break; case 280: /* Panasonic RW2 offset */ if (type != 4) break; load_raw = &CLASS panasonic_load_raw; load_flags = 0x2008; case 273: /* StripOffset */ case 513: /* JpegIFOffset */ case 61447: tiff_ifd[ifd].offset = get4()+base; if (!tiff_ifd[ifd].bps && tiff_ifd[ifd].offset > 0) { fseek (ifp, tiff_ifd[ifd].offset, SEEK_SET); if (ljpeg_start (&jh, 1)) { tiff_ifd[ifd].comp = 6; tiff_ifd[ifd].width = jh.wide; tiff_ifd[ifd].height = jh.high; tiff_ifd[ifd].bps = jh.bits; tiff_ifd[ifd].samples = jh.clrs; if (!(jh.sraw || (jh.clrs & 1))) tiff_ifd[ifd].width *= jh.clrs; i = order; parse_tiff (tiff_ifd[ifd].offset + 12); order = i; } } break; case 274: /* Orientation */ tiff_ifd[ifd].flip = ""50132467""[get2() & 7]-'0'; break; case 277: /* SamplesPerPixel */ tiff_ifd[ifd].samples = getint(type) & 7; break; case 279: /* StripByteCounts */ case 514: case 61448: tiff_ifd[ifd].bytes = get4(); break; case 61454: FORC3 cam_mul[(4-c) % 3] = getint(type); break; case 305: case 11: /* Software */ fgets (software, 64, ifp); if (!strncmp(software,""Adobe"",5) || !strncmp(software,""dcraw"",5) || !strncmp(software,""UFRaw"",5) || !strncmp(software,""Bibble"",6) || !strncmp(software,""Nikon Scan"",10) || !strcmp (software,""Digital Photo Professional"")) is_raw = 0; break; case 306: /* DateTime */ get_timestamp(0); break; case 315: /* Artist */ fread (artist, 64, 1, ifp); break; case 322: /* TileWidth */ tile_width = getint(type); break; case 323: /* TileLength */ tile_length = getint(type); break; case 324: /* TileOffsets */ tiff_ifd[ifd].offset = len > 1 ? ftell(ifp) : get4(); if (len == 4) { load_raw = &CLASS sinar_4shot_load_raw; is_raw = 5; } break; case 330: /* SubIFDs */ if (!strcmp(model,""DSLR-A100"") && tiff_ifd[ifd].width == 3872) { load_raw = &CLASS sony_arw_load_raw; data_offset = get4()+base; ifd++; break; } while (len--) { i = ftell(ifp); fseek (ifp, get4()+base, SEEK_SET); if (parse_tiff_ifd (base)) break; fseek (ifp, i+4, SEEK_SET); } break; case 400: strcpy (make, ""Sarnoff""); maximum = 0xfff; break; case 28688: FORC4 sony_curve[c+1] = get2() >> 2 & 0xfff; for (i=0; i < 5; i++) for (j = sony_curve[i]+1; j <= sony_curve[i+1]; j++) curve[j] = curve[j-1] + (1 << i); break; #ifndef WITH_MMAP_HACK case 29184: sony_offset = get4(); break; case 29185: sony_length = get4(); break; case 29217: sony_key = get4(); break; #endif case 29264: parse_minolta (ftell(ifp)); raw_width = 0; break; case 29443: FORC4 cam_mul[c ^ (c < 2)] = get2(); break; case 29459: FORC4 cam_mul[c] = get2(); i = (cam_mul[1] == 1024 && cam_mul[2] == 1024) << 1; SWAP (cam_mul[i],cam_mul[i+1]) break; case 33405: /* Model2 */ fgets (model2, 64, ifp); break; case 33422: /* CFAPattern */ case 64777: /* Kodak P-series */ if ((plen=len) > 16) plen = 16; fread (cfa_pat, 1, plen, ifp); for (colors=cfa=i=0; i < (int) plen; i++) { colors += !(cfa & (1 << cfa_pat[i])); cfa |= 1 << cfa_pat[i]; } if (cfa == 070) memcpy (cfa_pc,""\003\004\005"",3); /* CMY */ if (cfa == 072) memcpy (cfa_pc,""\005\003\004\001"",4); /* GMCY */ goto guess_cfa_pc; case 33424: case 65024: fseek (ifp, get4()+base, SEEK_SET); parse_kodak_ifd (base); break; case 33434: /* ExposureTime */ shutter = getreal(type); break; case 33437: /* FNumber */ aperture = getreal(type); break; case 34306: /* Leaf white balance */ FORC4 cam_mul[c ^ 1] = 4096.0 / get2(); break; case 34307: /* Leaf CatchLight color matrix */ fread (software, 1, 7, ifp); if (strncmp(software,""MATRIX"",6)) break; colors = 4; for (raw_color = i=0; i < 3; i++) { FORC4 fscanf (ifp, ""%f"", &rgb_cam[i][c^1]); if (!use_camera_wb) continue; num = 0; FORC4 num += rgb_cam[i][c]; FORC4 rgb_cam[i][c] /= num; } break; case 34310: /* Leaf metadata */ parse_mos (ftell(ifp)); case 34303: strcpy (make, ""Leaf""); break; case 34665: /* EXIF tag */ fseek (ifp, get4()+base, SEEK_SET); parse_exif (base); break; case 34853: /* GPSInfo tag */ fseek (ifp, get4()+base, SEEK_SET); parse_gps (base); break; case 34675: /* InterColorProfile */ case 50831: /* AsShotICCProfile */ profile_offset = ftell(ifp); profile_length = len; break; case 37122: /* CompressedBitsPerPixel */ kodak_cbpp = get4(); break; case 37386: /* FocalLength */ focal_len = getreal(type); break; case 37393: /* ImageNumber */ shot_order = getint(type); break; case 37400: /* old Kodak KDC tag */ for (raw_color = i=0; i < 3; i++) { getreal(type); FORC3 rgb_cam[i][c] = getreal(type); } break; case 46275: /* Imacon tags */ strcpy (make, ""Imacon""); data_offset = ftell(ifp); ima_len = len; break; case 46279: if (!ima_len) break; fseek (ifp, 78, SEEK_CUR); raw_width = get4(); raw_height = get4(); left_margin = get4() & 7; width = raw_width - left_margin - (get4() & 7); top_margin = get4() & 7; height = raw_height - top_margin - (get4() & 7); if (raw_width == 7262) { height = 5444; width = 7244; left_margin = 7; } fseek (ifp, 52, SEEK_CUR); FORC3 cam_mul[c] = getreal(11); fseek (ifp, 114, SEEK_CUR); flip = (get2() >> 7) * 90; if (width * height * 6 == ima_len) { if (flip % 180 == 90) SWAP(width,height); filters = flip = 0; } sprintf (model, ""Ixpress %d-Mp"", height*width/1000000); load_raw = &CLASS imacon_full_load_raw; if (filters) { if (left_margin & 1) filters = 0x61616161; load_raw = &CLASS unpacked_load_raw; } maximum = 0xffff; break; case 50454: /* Sinar tag */ case 50455: if (!(cbuf = (char *) malloc(len))) break; fread (cbuf, 1, len, ifp); for (cp = cbuf-1; cp && cp < cbuf+len; cp = strchr(cp,'\n')) if (!strncmp (++cp,""Neutral "",8)) sscanf (cp+8, ""%f %f %f"", cam_mul, cam_mul+1, cam_mul+2); free (cbuf); break; case 50458: if (!make[0]) strcpy (make, ""Hasselblad""); break; case 50459: /* Hasselblad tag */ i = order; j = ftell(ifp); c = tiff_nifds; order = get2(); fseek (ifp, j+(get2(),get4()), SEEK_SET); parse_tiff_ifd (j); maximum = 0xffff; tiff_nifds = c; order = i; break; case 50706: /* DNGVersion */ FORC4 dng_version = (dng_version << 8) + fgetc(ifp); if (!make[0]) strcpy (make, ""DNG""); is_raw = 1; break; case 50710: /* CFAPlaneColor */ if (len > 4) len = 4; colors = len; fread (cfa_pc, 1, colors, ifp); guess_cfa_pc: FORCC tab[cfa_pc[c]] = c; cdesc[c] = 0; for (i=16; i--; ) filters = filters << 2 | tab[cfa_pat[i % plen]]; break; case 50711: /* CFALayout */ if (get2() == 2) { fuji_width = 1; filters = 0x49494949; } break; case 291: case 50712: /* LinearizationTable */ linear_table (len); break; case 50713: /* BlackLevelRepeatDim */ blrr = get2(); blrc = get2(); break; case 61450: blrr = blrc = 2; case 50714: /* BlackLevel */ black = getreal(type); if (!filters || !~filters) break; dblack[0] = black; dblack[1] = (blrc == 2) ? getreal(type):dblack[0]; dblack[2] = (blrr == 2) ? getreal(type):dblack[0]; dblack[3] = (blrc == 2 && blrr == 2) ? getreal(type):dblack[1]; if (colors == 3) filters |= ((filters >> 2 & 0x22222222) | (filters << 2 & 0x88888888)) & filters << 1; FORC4 cblack[filters >> (c << 1) & 3] = dblack[c]; black = 0; break; case 50715: /* BlackLevelDeltaH */ case 50716: /* BlackLevelDeltaV */ for (num=i=0; i < (int) len; i++) num += getreal(type); black += num/len + 0.5; break; case 50717: /* WhiteLevel */ maximum = getint(type); break; case 50718: /* DefaultScale */ pixel_aspect = getreal(type); pixel_aspect /= getreal(type); break; case 50721: /* ColorMatrix1 */ if (use_cm) break; /* Prioritize Matrix2 over Matrix1 (UF) */ case 50722: /* ColorMatrix2 */ FORCC for (j=0; j < 3; j++) cm[c][j] = getreal(type); use_cm = 1; break; case 50723: /* CameraCalibration1 */ case 50724: /* CameraCalibration2 */ for (i=0; i < colors; i++) FORCC cc[i][c] = getreal(type); break; case 50727: /* AnalogBalance */ FORCC ab[c] = getreal(type); break; case 50728: /* AsShotNeutral */ FORCC asn[c] = getreal(type); break; case 50729: /* AsShotWhiteXY */ xyz[0] = getreal(type); xyz[1] = getreal(type); xyz[2] = 1 - xyz[0] - xyz[1]; FORC3 xyz[c] /= d65_white[c]; break; case 50740: /* DNGPrivateData */ if (dng_version) break; parse_minolta (j = get4()+base); fseek (ifp, j, SEEK_SET); parse_tiff_ifd (base); break; case 50752: read_shorts (cr2_slice, 3); break; case 50829: /* ActiveArea */ top_margin = getint(type); left_margin = getint(type); height = getint(type) - top_margin; width = getint(type) - left_margin; break; case 64772: /* Kodak P-series */ if (len < 13) break; fseek (ifp, 16, SEEK_CUR); data_offset = get4(); fseek (ifp, 28, SEEK_CUR); data_offset += get4(); load_raw = &CLASS packed_load_raw; break; case 65026: if (type == 2) fgets (model2, 64, ifp); } fseek (ifp, save, SEEK_SET); } #ifndef WITH_MMAP_HACK if (sony_length && (buf = (unsigned *) malloc(sony_length))) { fseek (ifp, sony_offset, SEEK_SET); fread (buf, sony_length, 1, ifp); sony_decrypt (buf, sony_length/4, 1, sony_key); sfp = ifp; if ((ifp = tmpfile())) { fwrite (buf, sony_length, 1, ifp); fseek (ifp, 0, SEEK_SET); parse_tiff_ifd (-sony_offset); fclose (ifp); } ifp = sfp; free (buf); } #endif /* WITH_MMAP_HACK */ for (i=0; i < colors; i++) FORCC cc[i][c] *= ab[i]; if (use_cm) { FORCC for (i=0; i < 3; i++) for (cam_xyz[c][i]=j=0; j < colors; j++) cam_xyz[c][i] += cc[c][j] * cm[j][i] * xyz[i]; cam_xyz_coeff (cam_xyz); } if (asn[0]) { cam_mul[3] = 0; FORCC cam_mul[c] = 1 / asn[c]; } if (!use_cm) FORCC pre_mul[c] /= cc[c][c]; return 0; } ",0 "struct kern_ipc_perm *ipc_lock_check(struct ipc_ids *ids, int id) { struct kern_ipc_perm *out; out = ipc_lock(ids, id); if (IS_ERR(out)) return out; if (ipc_checkid(out, id)) { ipc_unlock(out); return ERR_PTR(-EIDRM); } return out; } ",0 "void webCoreInitializeScriptWrappableForInterface(WebCore::TestObjectPython* object) { WebCore::initializeScriptWrappableForInterface(object); } ",0 "void DocumentThreadableLoader::handlePreflightFailure(const String& url, const String& errorDescription) { ResourceError error(errorDomainBlinkInternal, 0, url, errorDescription); m_actualRequest = ResourceRequest(); ThreadableLoaderClient* client = m_client; clear(); client->didFailAccessControlCheck(error); } ",0 "std::string OutOfProcessInstance::Prompt(const std::string& question, const std::string& default_answer) { pp::Var result = ModalDialog(this, ""prompt"", question, default_answer); return result.is_string() ? result.AsString() : std::string(); } ",0 "GLSLArrayName::GLSLArrayName(const std::string& name) : element_index_(-1) { if (name.size() < 4) return; if (name.back() != ']') return; size_t open_pos = name.find_last_of('['); if (open_pos >= name.size() - 2) return; base::CheckedNumeric index = 0; size_t last = name.size() - 1; for (size_t pos = open_pos + 1; pos < last; ++pos) { int8_t digit = name[pos] - '0'; if (digit < 0 || digit > 9) return; index = index * 10 + digit; } if (!index.IsValid()) return; element_index_ = index.ValueOrDie(); base_name_ = name.substr(0, open_pos); } ",0 "void RenderWidgetHostImpl::RendererIsUnresponsive( base::RepeatingClosure restart_hang_monitor_timeout) { NotificationService::current()->Notify( NOTIFICATION_RENDER_WIDGET_HOST_HANG, Source(this), NotificationService::NoDetails()); is_unresponsive_ = true; if (delegate_) { delegate_->RendererUnresponsive(this, std::move(restart_hang_monitor_timeout)); } } ",0 "void Document::childrenChanged(const ChildrenChange& change) { ContainerNode::childrenChanged(change); m_documentElement = ElementTraversal::firstWithin(*this); } ",0 " void fakeDraw() { if (m_isDirty) return; m_isDirty = true; Platform::current()->currentThread()->addTaskObserver(this); } ",0 "cmsBool Read8bitTables(cmsContext ContextID, cmsIOHANDLER* io, cmsPipeline* lut, int nChannels) { cmsUInt8Number* Temp = NULL; int i, j; cmsToneCurve* Tables[cmsMAXCHANNELS]; if (nChannels > cmsMAXCHANNELS) return FALSE; if (nChannels <= 0) return FALSE; memset(Tables, 0, sizeof(Tables)); Temp = (cmsUInt8Number*) _cmsMalloc(ContextID, 256); if (Temp == NULL) return FALSE; for (i=0; i < nChannels; i++) { Tables[i] = cmsBuildTabulatedToneCurve16(ContextID, 256, NULL); if (Tables[i] == NULL) goto Error; } for (i=0; i < nChannels; i++) { if (io ->Read(io, Temp, 256, 1) != 1) goto Error; for (j=0; j < 256; j++) Tables[i]->Table16[j] = (cmsUInt16Number) FROM_8_TO_16(Temp[j]); } _cmsFree(ContextID, Temp); Temp = NULL; if (!cmsPipelineInsertStage(lut, cmsAT_END, cmsStageAllocToneCurves(ContextID, nChannels, Tables))) goto Error; for (i=0; i < nChannels; i++) cmsFreeToneCurve(Tables[i]); return TRUE; Error: for (i=0; i < nChannels; i++) { if (Tables[i]) cmsFreeToneCurve(Tables[i]); } if (Temp) _cmsFree(ContextID, Temp); return FALSE; } ",0 "ScriptPromise ImageCapture::takePhoto(ScriptState* script_state) { ScriptPromiseResolver* resolver = ScriptPromiseResolver::Create(script_state); ScriptPromise promise = resolver->Promise(); if (TrackIsInactive(*stream_track_)) { resolver->Reject(DOMException::Create( kInvalidStateError, ""The associated Track is in an invalid state."")); return promise; } if (!service_) { resolver->Reject(DOMException::Create(kNotFoundError, kNoServiceError)); return promise; } service_requests_.insert(resolver); service_->TakePhoto(stream_track_->Component()->Source()->Id(), ConvertToBaseCallback(WTF::Bind( &ImageCapture::OnMojoTakePhoto, WrapPersistent(this), WrapPersistent(resolver)))); return promise; } ",0 "bool IsNetworkSettingsConfigEnabled() { return !base::CommandLine::ForCurrentProcess()->HasSwitch( chromeos::switches::kDisableNetworkSettingsConfig); } ",0 "static int ext4_ext_convert_to_initialized(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, ext4_lblk_t iblock, unsigned int max_blocks) { struct ext4_extent *ex, newex, orig_ex; struct ext4_extent *ex1 = NULL; struct ext4_extent *ex2 = NULL; struct ext4_extent *ex3 = NULL; struct ext4_extent_header *eh; ext4_lblk_t ee_block; unsigned int allocated, ee_len, depth; ext4_fsblk_t newblock; int err = 0; int ret = 0; depth = ext_depth(inode); eh = path[depth].p_hdr; ex = path[depth].p_ext; ee_block = le32_to_cpu(ex->ee_block); ee_len = ext4_ext_get_actual_len(ex); allocated = ee_len - (iblock - ee_block); newblock = iblock - ee_block + ext_pblock(ex); ex2 = ex; orig_ex.ee_block = ex->ee_block; orig_ex.ee_len = cpu_to_le16(ee_len); ext4_ext_store_pblock(&orig_ex, ext_pblock(ex)); err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto out; /* If extent has less than 2*EXT4_EXT_ZERO_LEN zerout directly */ if (ee_len <= 2*EXT4_EXT_ZERO_LEN) { err = ext4_ext_zeroout(inode, &orig_ex); if (err) goto fix_extent_len; /* update the extent length and mark as initialized */ ex->ee_block = orig_ex.ee_block; ex->ee_len = orig_ex.ee_len; ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); ext4_ext_dirty(handle, inode, path + depth); /* zeroed the full extent */ return allocated; } /* ex1: ee_block to iblock - 1 : uninitialized */ if (iblock > ee_block) { ex1 = ex; ex1->ee_len = cpu_to_le16(iblock - ee_block); ext4_ext_mark_uninitialized(ex1); ex2 = &newex; } /* * for sanity, update the length of the ex2 extent before * we insert ex3, if ex1 is NULL. This is to avoid temporary * overlap of blocks. */ if (!ex1 && allocated > max_blocks) ex2->ee_len = cpu_to_le16(max_blocks); /* ex3: to ee_block + ee_len : uninitialised */ if (allocated > max_blocks) { unsigned int newdepth; /* If extent has less than EXT4_EXT_ZERO_LEN zerout directly */ if (allocated <= EXT4_EXT_ZERO_LEN) { /* * iblock == ee_block is handled by the zerouout * at the beginning. * Mark first half uninitialized. * Mark second half initialized and zero out the * initialized extent */ ex->ee_block = orig_ex.ee_block; ex->ee_len = cpu_to_le16(ee_len - allocated); ext4_ext_mark_uninitialized(ex); ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); ext4_ext_dirty(handle, inode, path + depth); ex3 = &newex; ex3->ee_block = cpu_to_le32(iblock); ext4_ext_store_pblock(ex3, newblock); ex3->ee_len = cpu_to_le16(allocated); err = ext4_ext_insert_extent(handle, inode, path, ex3, 0); if (err == -ENOSPC) { err = ext4_ext_zeroout(inode, &orig_ex); if (err) goto fix_extent_len; ex->ee_block = orig_ex.ee_block; ex->ee_len = orig_ex.ee_len; ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); ext4_ext_dirty(handle, inode, path + depth); /* blocks available from iblock */ return allocated; } else if (err) goto fix_extent_len; /* * We need to zero out the second half because * an fallocate request can update file size and * converting the second half to initialized extent * implies that we can leak some junk data to user * space. */ err = ext4_ext_zeroout(inode, ex3); if (err) { /* * We should actually mark the * second half as uninit and return error * Insert would have changed the extent */ depth = ext_depth(inode); ext4_ext_drop_refs(path); path = ext4_ext_find_extent(inode, iblock, path); if (IS_ERR(path)) { err = PTR_ERR(path); return err; } /* get the second half extent details */ ex = path[depth].p_ext; err = ext4_ext_get_access(handle, inode, path + depth); if (err) return err; ext4_ext_mark_uninitialized(ex); ext4_ext_dirty(handle, inode, path + depth); return err; } /* zeroed the second half */ return allocated; } ex3 = &newex; ex3->ee_block = cpu_to_le32(iblock + max_blocks); ext4_ext_store_pblock(ex3, newblock + max_blocks); ex3->ee_len = cpu_to_le16(allocated - max_blocks); ext4_ext_mark_uninitialized(ex3); err = ext4_ext_insert_extent(handle, inode, path, ex3, 0); if (err == -ENOSPC) { err = ext4_ext_zeroout(inode, &orig_ex); if (err) goto fix_extent_len; /* update the extent length and mark as initialized */ ex->ee_block = orig_ex.ee_block; ex->ee_len = orig_ex.ee_len; ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); ext4_ext_dirty(handle, inode, path + depth); /* zeroed the full extent */ /* blocks available from iblock */ return allocated; } else if (err) goto fix_extent_len; /* * The depth, and hence eh & ex might change * as part of the insert above. */ newdepth = ext_depth(inode); /* * update the extent length after successful insert of the * split extent */ orig_ex.ee_len = cpu_to_le16(ee_len - ext4_ext_get_actual_len(ex3)); depth = newdepth; ext4_ext_drop_refs(path); path = ext4_ext_find_extent(inode, iblock, path); if (IS_ERR(path)) { err = PTR_ERR(path); goto out; } eh = path[depth].p_hdr; ex = path[depth].p_ext; if (ex2 != &newex) ex2 = ex; err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto out; allocated = max_blocks; /* If extent has less than EXT4_EXT_ZERO_LEN and we are trying * to insert a extent in the middle zerout directly * otherwise give the extent a chance to merge to left */ if (le16_to_cpu(orig_ex.ee_len) <= EXT4_EXT_ZERO_LEN && iblock != ee_block) { err = ext4_ext_zeroout(inode, &orig_ex); if (err) goto fix_extent_len; /* update the extent length and mark as initialized */ ex->ee_block = orig_ex.ee_block; ex->ee_len = orig_ex.ee_len; ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); ext4_ext_dirty(handle, inode, path + depth); /* zero out the first half */ /* blocks available from iblock */ return allocated; } } /* * If there was a change of depth as part of the * insertion of ex3 above, we need to update the length * of the ex1 extent again here */ if (ex1 && ex1 != ex) { ex1 = ex; ex1->ee_len = cpu_to_le16(iblock - ee_block); ext4_ext_mark_uninitialized(ex1); ex2 = &newex; } /* ex2: iblock to iblock + maxblocks-1 : initialised */ ex2->ee_block = cpu_to_le32(iblock); ext4_ext_store_pblock(ex2, newblock); ex2->ee_len = cpu_to_le16(allocated); if (ex2 != ex) goto insert; /* * New (initialized) extent starts from the first block * in the current extent. i.e., ex2 == ex * We have to see if it can be merged with the extent * on the left. */ if (ex2 > EXT_FIRST_EXTENT(eh)) { /* * To merge left, pass ""ex2 - 1"" to try_to_merge(), * since it merges towards right _only_. */ ret = ext4_ext_try_to_merge(inode, path, ex2 - 1); if (ret) { err = ext4_ext_correct_indexes(handle, inode, path); if (err) goto out; depth = ext_depth(inode); ex2--; } } /* * Try to Merge towards right. This might be required * only when the whole extent is being written to. * i.e. ex2 == ex and ex3 == NULL. */ if (!ex3) { ret = ext4_ext_try_to_merge(inode, path, ex2); if (ret) { err = ext4_ext_correct_indexes(handle, inode, path); if (err) goto out; } } /* Mark modified extent as dirty */ err = ext4_ext_dirty(handle, inode, path + depth); goto out; insert: err = ext4_ext_insert_extent(handle, inode, path, &newex, 0); if (err == -ENOSPC) { err = ext4_ext_zeroout(inode, &orig_ex); if (err) goto fix_extent_len; /* update the extent length and mark as initialized */ ex->ee_block = orig_ex.ee_block; ex->ee_len = orig_ex.ee_len; ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); ext4_ext_dirty(handle, inode, path + depth); /* zero out the first half */ return allocated; } else if (err) goto fix_extent_len; out: ext4_ext_show_leaf(inode, path); return err ? err : allocated; fix_extent_len: ex->ee_block = orig_ex.ee_block; ex->ee_len = orig_ex.ee_len; ext4_ext_store_pblock(ex, ext_pblock(&orig_ex)); ext4_ext_mark_uninitialized(ex); ext4_ext_dirty(handle, inode, path + depth); return err; } ",0 "static inline bool isObservable(JSTestInterface* jsTestInterface) { if (jsTestInterface->hasCustomProperties()) return true; return false; } ",0 "shmem_write_begin(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned flags, struct page **pagep, void **fsdata) { struct inode *inode = mapping->host; pgoff_t index = pos >> PAGE_CACHE_SHIFT; return shmem_getpage(inode, index, pagep, SGP_WRITE, NULL); } ",0 "extern int get_u16(unsigned short *val, const char *arg, int base) { unsigned long res; char *ptr; if (!arg || !*arg) return -1; errno = 0; res = strtoul(arg, &ptr, base); if (!ptr || ptr == arg || *ptr || res > 0xFFFF || errno != 0) return -1; *val = res; return 0; } ",0 "void Document::SetContentLanguage(const AtomicString& language) { if (content_language_ == language) return; content_language_ = language; SetNeedsStyleRecalc(kSubtreeStyleChange, StyleChangeReasonForTracing::Create( style_change_reason::kLanguage)); } ",0 "void QuotaManager::DeleteOnCorrectThread() const { if (!io_thread_->BelongsToCurrentThread()) { io_thread_->DeleteSoon(FROM_HERE, this); return; } delete this; } ",0 "void QQuickWebView::setAllowAnyHTTPSCertificateForLocalHost(bool allow) { Q_D(QQuickWebView); d->m_allowAnyHTTPSCertificateForLocalHost = allow; } ",0 "int btrfs_add_dead_root(struct btrfs_root *root) { spin_lock(&root->fs_info->trans_lock); list_add(&root->root_list, &root->fs_info->dead_roots); spin_unlock(&root->fs_info->trans_lock); return 0; } ",0 " static void do_perf_sw_event(enum perf_type_id type, u32 event_id, u64 nr, int nmi, struct perf_sample_data *data, struct pt_regs *regs) { struct swevent_htable *swhash = &__get_cpu_var(swevent_htable); struct perf_event *event; struct hlist_node *node; struct hlist_head *head; rcu_read_lock(); head = find_swevent_head_rcu(swhash, type, event_id); if (!head) goto end; hlist_for_each_entry_rcu(event, node, head, hlist_entry) { if (perf_swevent_match(event, type, event_id, data, regs)) perf_swevent_event(event, nr, nmi, data, regs); } end: rcu_read_unlock(); } ",1 "tmpClearBuffer(Buffer *buf) { if (buf->pagerSource == NULL && writeBufferCache(buf) == 0) { buf->firstLine = NULL; buf->topLine = NULL; buf->currentLine = NULL; buf->lastLine = NULL; } } ",0 "void NavigationControllerImpl::NotifyEntryChanged( const NavigationEntry* entry) { EntryChangedDetails det; det.changed_entry = entry; det.index = GetIndexOfEntry( NavigationEntryImpl::FromNavigationEntry(entry)); delegate_->NotifyNavigationEntryChanged(det); } ",0 "XineramaRegisterConnectionBlockCallback(void (*func) (void)) { XineramaConnectionCallbackList *newlist; if (!(newlist = malloc(sizeof(XineramaConnectionCallbackList)))) return FALSE; newlist->next = ConnectionCallbackList; newlist->func = func; ConnectionCallbackList = newlist; return TRUE; } ",0 "static MagickBooleanType WriteUYVYImage(const ImageInfo *image_info, Image *image) { MagickPixelPacket pixel; Image *uyvy_image; MagickBooleanType full, status; register const PixelPacket *p; register ssize_t x; ssize_t y; /* Open output image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); assert(image != (Image *) NULL); assert(image->signature == MagickSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if ((image->columns % 2) != 0) image->columns++; status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception); if (status == MagickFalse) return(status); /* Accumulate two pixels, then output. */ uyvy_image=CloneImage(image,0,0,MagickTrue,&image->exception); if (uyvy_image == (Image *) NULL) ThrowWriterException(ResourceLimitError,image->exception.reason); (void) TransformImageColorspace(uyvy_image,YCbCrColorspace); full=MagickFalse; (void) ResetMagickMemory(&pixel,0,sizeof(MagickPixelPacket)); for (y=0; y < (ssize_t) image->rows; y++) { p=GetVirtualPixels(uyvy_image,0,y,image->columns,1,&image->exception); if (p == (const PixelPacket *) NULL) break; for (x=0; x < (ssize_t) image->columns; x++) { if (full != MagickFalse) { pixel.green=(pixel.green+GetPixelGreen(p))/2; pixel.blue=(pixel.blue+GetPixelBlue(p))/2; (void) WriteBlobByte(image,ScaleQuantumToChar((Quantum) pixel.green)); (void) WriteBlobByte(image,ScaleQuantumToChar((Quantum) pixel.red)); (void) WriteBlobByte(image,ScaleQuantumToChar((Quantum) pixel.blue)); (void) WriteBlobByte(image,ScaleQuantumToChar( GetPixelRed(p))); } pixel.red=(double) GetPixelRed(p); pixel.green=(double) GetPixelGreen(p); pixel.blue=(double) GetPixelBlue(p); full=full == MagickFalse ? MagickTrue : MagickFalse; p++; } status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } uyvy_image=DestroyImage(uyvy_image); (void) CloseBlob(image); return(MagickTrue); } ",0 "static inline bool compare_hash_inputs(const struct rtable *rt1, const struct rtable *rt2) { return ((((__force u32)rt1->rt_key_dst ^ (__force u32)rt2->rt_key_dst) | ((__force u32)rt1->rt_key_src ^ (__force u32)rt2->rt_key_src) | (rt1->rt_iif ^ rt2->rt_iif)) == 0); } ",0 "scoped_ptr LayerTreeHost::CreateThreaded( LayerTreeHostClient* client, SharedBitmapManager* manager, const LayerTreeSettings& settings, scoped_refptr impl_task_runner) { DCHECK(impl_task_runner); scoped_ptr layer_tree_host( new LayerTreeHost(client, manager, settings)); layer_tree_host->InitializeThreaded(impl_task_runner); return layer_tree_host.Pass(); } ",0 "short *XRRRates (Display *dpy, int screen, int sizeID, int *nrates) { XRRScreenConfiguration *config; XExtDisplayInfo *info = XRRFindDisplay(dpy); short *rates; LockDisplay(dpy); if ((config = _XRRValidateCache(dpy, info, screen))) { rates = XRRConfigRates (config, sizeID, nrates); UnlockDisplay(dpy); return rates; } else { UnlockDisplay(dpy); *nrates = 0; return NULL; } } ",0 "static vpx_codec_err_t vp8_get_last_ref_updates(vpx_codec_alg_priv_t *ctx, va_list args) { int *update_info = va_arg(args, int *); if (update_info && !ctx->yv12_frame_buffers.use_frame_threads) { VP8D_COMP *pbi = (VP8D_COMP *)ctx->yv12_frame_buffers.pbi[0]; *update_info = pbi->common.refresh_alt_ref_frame * (int) VP8_ALTR_FRAME + pbi->common.refresh_golden_frame * (int) VP8_GOLD_FRAME + pbi->common.refresh_last_frame * (int) VP8_LAST_FRAME; return VPX_CODEC_OK; } else return VPX_CODEC_INVALID_PARAM; } ",0 "static unsigned int unix_dgram_poll(struct file *file, struct socket *sock, poll_table *wait) { struct sock *sk = sock->sk, *other; unsigned int mask, writable; sock_poll_wait(file, sk_sleep(sk), wait); mask = 0; /* exceptional events? */ if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) mask |= POLLERR | (sock_flag(sk, SOCK_SELECT_ERR_QUEUE) ? POLLPRI : 0); if (sk->sk_shutdown & RCV_SHUTDOWN) mask |= POLLRDHUP | POLLIN | POLLRDNORM; if (sk->sk_shutdown == SHUTDOWN_MASK) mask |= POLLHUP; /* readable? */ if (!skb_queue_empty(&sk->sk_receive_queue)) mask |= POLLIN | POLLRDNORM; /* Connection-based need to check for termination and startup */ if (sk->sk_type == SOCK_SEQPACKET) { if (sk->sk_state == TCP_CLOSE) mask |= POLLHUP; /* connection hasn't started yet? */ if (sk->sk_state == TCP_SYN_SENT) return mask; } /* No write status requested, avoid expensive OUT tests. */ if (!(poll_requested_events(wait) & (POLLWRBAND|POLLWRNORM|POLLOUT))) return mask; writable = unix_writable(sk); other = unix_peer_get(sk); if (other) { if (unix_peer(other) != sk) { sock_poll_wait(file, &unix_sk(other)->peer_wait, wait); if (unix_recvq_full(other)) writable = 0; } sock_put(other); } if (writable) mask |= POLLOUT | POLLWRNORM | POLLWRBAND; else set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); return mask; } ",1 "void read_sequence_header(decoder_info_t *decoder_info, stream_t *stream) { decoder_info->width = get_flc(16, stream); decoder_info->height = get_flc(16, stream); decoder_info->log2_sb_size = get_flc(3, stream); decoder_info->pb_split = get_flc(1, stream); decoder_info->tb_split_enable = get_flc(1, stream); decoder_info->max_num_ref = get_flc(2, stream) + 1; decoder_info->interp_ref = get_flc(2, stream); decoder_info->max_delta_qp = get_flc(1, stream); decoder_info->deblocking = get_flc(1, stream); decoder_info->clpf = get_flc(1, stream); decoder_info->use_block_contexts = get_flc(1, stream); decoder_info->bipred = get_flc(2, stream); decoder_info->qmtx = get_flc(1, stream); if (decoder_info->qmtx) { decoder_info->qmtx_offset = get_flc(6, stream) - 32; } decoder_info->subsample = get_flc(2, stream); decoder_info->subsample = // 0: 400 1: 420 2: 422 3: 444 (decoder_info->subsample & 1) * 20 + (decoder_info->subsample & 2) * 22 + ((decoder_info->subsample & 3) == 3) * 2 + 400; decoder_info->num_reorder_pics = get_flc(4, stream); if (decoder_info->subsample != 400) { decoder_info->cfl_intra = get_flc(1, stream); decoder_info->cfl_inter = get_flc(1, stream); } decoder_info->bitdepth = get_flc(1, stream) ? 10 : 8; if (decoder_info->bitdepth == 10) decoder_info->bitdepth += 2 * get_flc(1, stream); decoder_info->input_bitdepth = get_flc(1, stream) ? 10 : 8; if (decoder_info->input_bitdepth == 10) decoder_info->input_bitdepth += 2 * get_flc(1, stream); } ",1 "const ResourceRequest& DocumentLoader::originalRequestCopy() const { return m_originalRequestCopy; } ",0 "static int handle_lan_get_msg_cmd(struct ipmi_smi *intf, struct ipmi_smi_msg *msg) { struct cmd_rcvr *rcvr; int rv = 0; unsigned char netfn; unsigned char cmd; unsigned char chan; struct ipmi_user *user = NULL; struct ipmi_lan_addr *lan_addr; struct ipmi_recv_msg *recv_msg; if (msg->rsp_size < 12) { /* Message not big enough, just ignore it. */ ipmi_inc_stat(intf, invalid_commands); return 0; } if (msg->rsp[2] != 0) { /* An error getting the response, just ignore it. */ return 0; } netfn = msg->rsp[6] >> 2; cmd = msg->rsp[10]; chan = msg->rsp[3] & 0xf; rcu_read_lock(); rcvr = find_cmd_rcvr(intf, netfn, cmd, chan); if (rcvr) { user = rcvr->user; kref_get(&user->refcount); } else user = NULL; rcu_read_unlock(); if (user == NULL) { /* We didn't find a user, just give up. */ ipmi_inc_stat(intf, unhandled_commands); /* * Don't do anything with these messages, just allow * them to be freed. */ rv = 0; } else { recv_msg = ipmi_alloc_recv_msg(); if (!recv_msg) { /* * We couldn't allocate memory for the * message, so requeue it for handling later. */ rv = 1; kref_put(&user->refcount, free_user); } else { /* Extract the source address from the data. */ lan_addr = (struct ipmi_lan_addr *) &recv_msg->addr; lan_addr->addr_type = IPMI_LAN_ADDR_TYPE; lan_addr->session_handle = msg->rsp[4]; lan_addr->remote_SWID = msg->rsp[8]; lan_addr->local_SWID = msg->rsp[5]; lan_addr->lun = msg->rsp[9] & 3; lan_addr->channel = msg->rsp[3] & 0xf; lan_addr->privilege = msg->rsp[3] >> 4; /* * Extract the rest of the message information * from the IPMB header. */ recv_msg->user = user; recv_msg->recv_type = IPMI_CMD_RECV_TYPE; recv_msg->msgid = msg->rsp[9] >> 2; recv_msg->msg.netfn = msg->rsp[6] >> 2; recv_msg->msg.cmd = msg->rsp[10]; recv_msg->msg.data = recv_msg->msg_data; /* * We chop off 12, not 11 bytes because the checksum * at the end also needs to be removed. */ recv_msg->msg.data_len = msg->rsp_size - 12; memcpy(recv_msg->msg_data, &msg->rsp[11], msg->rsp_size - 12); if (deliver_response(intf, recv_msg)) ipmi_inc_stat(intf, unhandled_commands); else ipmi_inc_stat(intf, handled_commands); } } return rv; } ",0 "gid_t from_kgid(struct user_namespace *targ, kgid_t kgid) { /* Map the gid from a global kernel gid */ return map_id_up(&targ->gid_map, __kgid_val(kgid)); } ",0 " void MediaElementAudioSourceHandler::SetFormat(size_t number_of_channels, float source_sample_rate) { if (number_of_channels != source_number_of_channels_ || source_sample_rate != source_sample_rate_) { if (!number_of_channels || number_of_channels > BaseAudioContext::MaxNumberOfChannels() || !AudioUtilities::IsValidAudioBufferSampleRate(source_sample_rate)) { DLOG(ERROR) << ""setFormat("" << number_of_channels << "", "" << source_sample_rate << "") - unhandled format change""; Locker locker(*this); source_number_of_channels_ = 0; source_sample_rate_ = 0; return; } Locker locker(*this); source_number_of_channels_ = number_of_channels; source_sample_rate_ = source_sample_rate; if (source_sample_rate != Context()->sampleRate()) { double scale_factor = source_sample_rate / Context()->sampleRate(); multi_channel_resampler_ = std::make_unique( scale_factor, number_of_channels); } else { multi_channel_resampler_.reset(); } { BaseAudioContext::GraphAutoLocker context_locker(Context()); Output(0).SetNumberOfChannels(number_of_channels); } } } ",1 "bool FrameLoaderClient::canCachePage() const { return true; } ",0 "static void i6300esb_restart_timer(I6300State *d, int stage) { int64_t timeout; if (!d->enabled) return; d->stage = stage; if (d->stage <= 1) timeout = d->timer1_preload; else timeout = d->timer2_preload; if (d->clock_scale == CLOCK_SCALE_1KHZ) timeout <<= 15; else timeout <<= 5; /* Get the timeout in nanoseconds. */ timeout = timeout * 30; /* on a PCI bus, 1 tick is 30 ns*/ i6300esb_debug(""stage %d, timeout %"" PRIi64 ""\n"", d->stage, timeout); timer_mod(d->timer, qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) + timeout); } ",0 "void RenderView::OnDisassociateFromPopupCount() { if (decrement_shared_popup_at_destruction_) shared_popup_counter_->data--; shared_popup_counter_ = new SharedRenderViewCounter(0); decrement_shared_popup_at_destruction_ = false; } ",0 "pango_glyph_string_get_type (void) { static GType our_type = 0; if (G_UNLIKELY (our_type == 0)) our_type = g_boxed_type_register_static (I_(""PangoGlyphString""), (GBoxedCopyFunc)pango_glyph_string_copy, (GBoxedFreeFunc)pango_glyph_string_free); return our_type; } ",0 "static inline bool containsKanaLetters(const String& pattern) { const UChar* characters = pattern.characters(); unsigned length = pattern.length(); for (unsigned i = 0; i < length; ++i) { if (isKanaLetter(characters[i])) return true; } return false; } ",0 "void RenderWidgetHostImpl::ShowContextMenuAtPoint(const gfx::Point& point) { Send(new ViewMsg_ShowContextMenu( GetRoutingID(), ui::MENU_SOURCE_MOUSE, point)); } ",0 "std::unique_ptr CreateNoDelegate( AudioInputDelegate::EventHandler* event_handler) { return nullptr; } ",0 " void NotifyObserversOfDNSChange() { NetworkChangeNotifier::NotifyObserversOfDNSChange(); } ",1 "int _yr_re_fiber_sync( RE_FIBER_LIST* fiber_list, RE_FIBER_POOL* fiber_pool, RE_FIBER* fiber_to_sync) { RE_SPLIT_ID_TYPE splits_executed[RE_MAX_SPLIT_ID]; RE_SPLIT_ID_TYPE splits_executed_count = 0; RE_SPLIT_ID_TYPE split_id, splits_executed_idx; int split_already_executed; RE_REPEAT_ARGS* repeat_args; RE_REPEAT_ANY_ARGS* repeat_any_args; RE_FIBER* fiber; RE_FIBER* last; RE_FIBER* prev; RE_FIBER* next; RE_FIBER* branch_a; RE_FIBER* branch_b; fiber = fiber_to_sync; prev = fiber_to_sync->prev; last = fiber_to_sync->next; while(fiber != last) { uint8_t opcode = *fiber->ip; switch(opcode) { case RE_OPCODE_SPLIT_A: case RE_OPCODE_SPLIT_B: split_id = *(RE_SPLIT_ID_TYPE*)(fiber->ip + 1); split_already_executed = FALSE; for (splits_executed_idx = 0; splits_executed_idx < splits_executed_count; splits_executed_idx++) { if (split_id == splits_executed[splits_executed_idx]) { split_already_executed = TRUE; break; } } if (split_already_executed) { fiber = _yr_re_fiber_kill(fiber_list, fiber_pool, fiber); } else { branch_a = fiber; FAIL_ON_ERROR(_yr_re_fiber_split( fiber_list, fiber_pool, branch_a, &branch_b)); if (opcode == RE_OPCODE_SPLIT_B) yr_swap(branch_a, branch_b, RE_FIBER*); branch_a->ip += (sizeof(RE_SPLIT_ID_TYPE) + 3); branch_b->ip += *(int16_t*)( branch_b->ip + 1 // opcode size + sizeof(RE_SPLIT_ID_TYPE)); splits_executed[splits_executed_count] = split_id; splits_executed_count++; } break; case RE_OPCODE_REPEAT_START_GREEDY: case RE_OPCODE_REPEAT_START_UNGREEDY: repeat_args = (RE_REPEAT_ARGS*)(fiber->ip + 1); assert(repeat_args->max > 0); branch_a = fiber; if (repeat_args->min == 0) { FAIL_ON_ERROR(_yr_re_fiber_split( fiber_list, fiber_pool, branch_a, &branch_b)); if (opcode == RE_OPCODE_REPEAT_START_UNGREEDY) yr_swap(branch_a, branch_b, RE_FIBER*); branch_b->ip += repeat_args->offset; } branch_a->stack[++branch_a->sp] = 0; branch_a->ip += (1 + sizeof(RE_REPEAT_ARGS)); break; case RE_OPCODE_REPEAT_END_GREEDY: case RE_OPCODE_REPEAT_END_UNGREEDY: repeat_args = (RE_REPEAT_ARGS*)(fiber->ip + 1); fiber->stack[fiber->sp]++; if (fiber->stack[fiber->sp] < repeat_args->min) { fiber->ip += repeat_args->offset; break; } branch_a = fiber; if (fiber->stack[fiber->sp] < repeat_args->max) { FAIL_ON_ERROR(_yr_re_fiber_split( fiber_list, fiber_pool, branch_a, &branch_b)); if (opcode == RE_OPCODE_REPEAT_END_GREEDY) yr_swap(branch_a, branch_b, RE_FIBER*); branch_a->sp--; branch_b->ip += repeat_args->offset; } branch_a->ip += (1 + sizeof(RE_REPEAT_ARGS)); break; case RE_OPCODE_REPEAT_ANY_GREEDY: case RE_OPCODE_REPEAT_ANY_UNGREEDY: repeat_any_args = (RE_REPEAT_ANY_ARGS*)(fiber->ip + 1); if (fiber->rc == -1) fiber->rc = 0; if (fiber->rc < repeat_any_args->min) { fiber->rc++; fiber = fiber->next; } else if (fiber->rc < repeat_any_args->max) { next = fiber->next; branch_a = fiber; FAIL_ON_ERROR(_yr_re_fiber_split( fiber_list, fiber_pool, branch_a, &branch_b)); if (opcode == RE_OPCODE_REPEAT_ANY_UNGREEDY) yr_swap(branch_a, branch_b, RE_FIBER*); branch_a->rc++; branch_b->ip += (1 + sizeof(RE_REPEAT_ANY_ARGS)); branch_b->rc = -1; _yr_re_fiber_sync(fiber_list, fiber_pool, branch_b); fiber = next; } else { fiber->ip += (1 + sizeof(RE_REPEAT_ANY_ARGS)); fiber->rc = -1; } break; case RE_OPCODE_JUMP: fiber->ip += *(int16_t*)(fiber->ip + 1); break; default: if (_yr_re_fiber_exists(fiber_list, fiber, prev)) fiber = _yr_re_fiber_kill(fiber_list, fiber_pool, fiber); else fiber = fiber->next; } } return ERROR_SUCCESS; } ",0 "int equalizer_get_band_freq_range(equalizer_context_t *context __unused, int32_t band, uint32_t *low, uint32_t *high) { ALOGV(""%s: band: %d"", __func__, band); *low = equalizer_band_freq_range[band][0]; *high = equalizer_band_freq_range[band][1]; return 0; } ",0 "static int decode_map(codebook *s, oggpack_buffer *b, ogg_int32_t *v, int point){ ogg_uint32_t entry = decode_packed_entry_number(s,b); int i; if(oggpack_eop(b))return(-1); /* 1 used by test file 0 */ /* according to decode type */ switch(s->dec_type){ case 1:{ /* packed vector of values */ int mask=(1<q_bits)-1; for(i=0;idim;i++){ v[i]=entry&mask; entry>>=s->q_bits; } break; } case 2:{ /* packed vector of column offsets */ int mask=(1<q_pack)-1; for(i=0;idim;i++){ if(s->q_bits<=8) v[i]=((unsigned char *)(s->q_val))[entry&mask]; else v[i]=((ogg_uint16_t *)(s->q_val))[entry&mask]; entry>>=s->q_pack; } break; } case 3:{ /* offset into array */ void *ptr=((char *)s->q_val)+entry*s->q_pack; if(s->q_bits<=8){ for(i=0;idim;i++) v[i]=((unsigned char *)ptr)[i]; }else{ for(i=0;idim;i++) v[i]=((ogg_uint16_t *)ptr)[i]; } break; } default: return -1; } /* we have the unpacked multiplicands; compute final vals */ { int shiftM = point-s->q_delp; ogg_int32_t add = point-s->q_minp; int mul = s->q_del; if(add>0) add= s->q_min >> add; else add= s->q_min << -add; if (shiftM<0) { mul <<= -shiftM; shiftM = 0; } add <<= shiftM; for(i=0;idim;i++) v[i]= ((add + v[i] * mul) >> shiftM); if(s->q_seq) for(i=1;idim;i++) v[i]+=v[i-1]; } return 0; } ",1 "void TracingControllerImpl::CompleteFlush() { if (trace_data_endpoint_) { trace_data_endpoint_->ReceiveTraceFinalContents( std::move(filtered_metadata_)); } filtered_metadata_.reset(nullptr); trace_data_endpoint_ = nullptr; trace_config_ = nullptr; drainer_ = nullptr; } ",0 "static void vmx_flush_tlb(struct kvm_vcpu *vcpu) { vpid_sync_context(to_vmx(vcpu)); if (enable_ept) { if (!VALID_PAGE(vcpu->arch.mmu.root_hpa)) return; ept_sync_context(construct_eptp(vcpu->arch.mmu.root_hpa)); } } ",0 "void WebContentsImpl::CopyToFindPboard() { #if defined(OS_MACOSX) RenderFrameHost* focused_frame = GetFocusedFrame(); if (!focused_frame) return; focused_frame->GetFrameInputHandler()->CopyToFindPboard(); RecordAction(base::UserMetricsAction(""CopyToFindPboard"")); #endif } ",0 " handle get_less(handle h) { return m_nodes[h].lt & 0x7FFFFFFF; } ",0 "void Browser::FindReply(WebContents* web_contents, int request_id, int number_of_matches, const gfx::Rect& selection_rect, int active_match_ordinal, bool final_update) { FindTabHelper* find_tab_helper = FindTabHelper::FromWebContents(web_contents); if (!find_tab_helper) return; find_tab_helper->HandleFindReply(request_id, number_of_matches, selection_rect, active_match_ordinal, final_update); } ",0 "void LauncherView::ButtonPressed(views::Button* sender, const views::Event& event) { if (dragging_) return; if (sender == overflow_button_) ShowOverflowMenu(); if (!delegate_) return; int view_index = view_model_->GetIndexOfView(sender); if (view_index == -1) return; switch (model_->items()[view_index].type) { case TYPE_TABBED: case TYPE_APP_PANEL: case TYPE_APP_SHORTCUT: case TYPE_PLATFORM_APP: delegate_->ItemClicked(model_->items()[view_index], event.flags()); break; case TYPE_APP_LIST: Shell::GetInstance()->ToggleAppList(); break; case TYPE_BROWSER_SHORTCUT: if (event.flags() & ui::EF_CONTROL_DOWN) delegate_->CreateNewWindow(); else delegate_->CreateNewTab(); break; } } ",1 "static int veth_set_tx_csum(struct net_device *dev, u32 data) { if (data) dev->features |= NETIF_F_NO_CSUM; else dev->features &= ~NETIF_F_NO_CSUM; return 0; } ",0 " pim_print(netdissect_options *ndo, register const u_char *bp, register u_int len, const u_char *bp2) { register const u_char *ep; register const struct pim *pim = (const struct pim *)bp; ep = (const u_char *)ndo->ndo_snapend; if (bp >= ep) return; #ifdef notyet /* currently we see only version and type */ ND_TCHECK(pim->pim_rsv); #endif switch (PIM_VER(pim->pim_typever)) { case 2: if (!ndo->ndo_vflag) { ND_PRINT((ndo, ""PIMv%u, %s, length %u"", PIM_VER(pim->pim_typever), tok2str(pimv2_type_values,""Unknown Type"",PIM_TYPE(pim->pim_typever)), len)); return; } else { ND_PRINT((ndo, ""PIMv%u, length %u\n\t%s"", PIM_VER(pim->pim_typever), len, tok2str(pimv2_type_values,""Unknown Type"",PIM_TYPE(pim->pim_typever)))); pimv2_print(ndo, bp, len, bp2); } break; default: ND_PRINT((ndo, ""PIMv%u, length %u"", PIM_VER(pim->pim_typever), len)); break; } return; } ",1 "void GLES2DecoderWithShaderTestBase::SetupIndexBuffer() { DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, client_element_buffer_id_, kServiceElementBufferId); static const GLshort indices[] = {100, 1, 2, 3, 4, 5, 6, 7, 100, 9}; COMPILE_ASSERT(arraysize(indices) == kNumIndices, Indices_is_not_10); DoBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices)); DoBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(indices), indices); } ",0 "static void _fb_wrunlock(void) { slurm_mutex_lock(&file_bcast_mutex); fb_write_lock--; pthread_cond_broadcast(&file_bcast_cond); slurm_mutex_unlock(&file_bcast_mutex); } ",0 "transform_height(png_const_structp pp, png_byte colour_type, png_byte bit_depth) { switch (bit_size(pp, colour_type, bit_depth)) { case 1: case 2: case 4: return 1; /* Total of 128 pixels */ case 8: return 2; /* Total of 256 pixels/bytes */ case 16: return 512; /* Total of 65536 pixels */ case 24: case 32: return 512; /* 65536 pixels */ case 48: case 64: return 2048;/* 4 x 65536 pixels. */ # define TRANSFORM_HEIGHTMAX 2048 default: return 0; /* Error, will be caught later */ } } ",0 "static ssize_t ucma_accept(struct ucma_file *file, const char __user *inbuf, int in_len, int out_len) { struct rdma_ucm_accept cmd; struct rdma_conn_param conn_param; struct ucma_context *ctx; int ret; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; ctx = ucma_get_ctx_dev(file, cmd.id); if (IS_ERR(ctx)) return PTR_ERR(ctx); if (cmd.conn_param.valid) { ucma_copy_conn_param(ctx->cm_id, &conn_param, &cmd.conn_param); mutex_lock(&file->mut); ret = __rdma_accept(ctx->cm_id, &conn_param, NULL); if (!ret) ctx->uid = cmd.uid; mutex_unlock(&file->mut); } else ret = __rdma_accept(ctx->cm_id, NULL, NULL); ucma_put_ctx(ctx); return ret; } ",0 "static void DeletePCPMap(pcp_info_t *pcp_msg_info) { uint16_t iport = pcp_msg_info->int_port; /* private port */ uint8_t proto = pcp_msg_info->protocol; int r=-1; /* remove the mapping */ /* remove all the mappings for this client */ int index; unsigned short eport2, iport2; char iaddr2[INET6_ADDRSTRLEN]; int proto2; char desc[64]; unsigned int timestamp; #ifdef ENABLE_UPNPPINHOLE int uid = -1; #endif /* ENABLE_UPNPPINHOLE */ /* iterate through all rules and delete the requested ones */ for (index = 0 ; (!pcp_msg_info->is_fw && get_redirect_rule_by_index(index, 0, &eport2, iaddr2, sizeof(iaddr2), &iport2, &proto2, desc, sizeof(desc), 0, 0, ×tamp, 0, 0) >= 0) #ifdef ENABLE_UPNPPINHOLE || (pcp_msg_info->is_fw && (uid=upnp_get_pinhole_uid_by_index(index))>=0 && upnp_get_pinhole_info((unsigned short)uid, NULL, 0, NULL, iaddr2, sizeof(iaddr2), &iport2, &proto2, desc, sizeof(desc), ×tamp, NULL) >= 0) #endif /* ENABLE_UPNPPINHOLE */ ; index++) if(0 == strcmp(iaddr2, pcp_msg_info->mapped_str) && (proto2==proto) && ((iport2==iport) || (iport==0))) { if(0 != strcmp(desc, pcp_msg_info->desc)) { /* nonce does not match */ pcp_msg_info->result_code = PCP_ERR_NOT_AUTHORIZED; syslog(LOG_ERR, ""Unauthorized to remove PCP mapping internal port %hu, protocol %s"", iport, (pcp_msg_info->protocol == IPPROTO_TCP)?""TCP"":""UDP""); return; } else if (!pcp_msg_info->is_fw) { r = _upnp_delete_redir(eport2, proto2); } else { #ifdef ENABLE_UPNPPINHOLE r = upnp_delete_inboundpinhole(uid); #endif /* ENABLE_UPNPPINHOLE */ } break; } if (r >= 0) { syslog(LOG_INFO, ""PCP: %s port %hu mapping removed"", proto2==IPPROTO_TCP?""TCP"":""UDP"", eport2); } else { syslog(LOG_ERR, ""Failed to remove PCP mapping internal port %hu, protocol %s"", iport, (pcp_msg_info->protocol == IPPROTO_TCP)?""TCP"":""UDP""); pcp_msg_info->result_code = PCP_ERR_NO_RESOURCES; } } ",0 "static void ehci_register_companion(USBBus *bus, USBPort *ports[], uint32_t portcount, uint32_t firstport, Error **errp) { EHCIState *s = container_of(bus, EHCIState, bus); uint32_t i; if (firstport + portcount > NB_PORTS) { error_setg(errp, ""firstport must be between 0 and %u"", NB_PORTS - portcount); return; } for (i = 0; i < portcount; i++) { if (s->companion_ports[firstport + i]) { error_setg(errp, ""firstport %u asks for ports %u-%u,"" "" but port %u has a companion assigned already"", firstport, firstport, firstport + portcount - 1, firstport + i); return; } } for (i = 0; i < portcount; i++) { s->companion_ports[firstport + i] = ports[i]; s->ports[firstport + i].speedmask |= USB_SPEED_MASK_LOW | USB_SPEED_MASK_FULL; /* Ensure devs attached before the initial reset go to the companion */ s->portsc[firstport + i] = PORTSC_POWNER; } s->companion_count++; s->caps[0x05] = (s->companion_count << 4) | portcount; } ",0 "brcmf_set_wsec_mode(struct net_device *ndev, struct cfg80211_connect_params *sme) { struct brcmf_cfg80211_profile *profile = ndev_to_prof(ndev); struct brcmf_cfg80211_security *sec; s32 pval = 0; s32 gval = 0; s32 wsec; s32 err = 0; if (sme->crypto.n_ciphers_pairwise) { switch (sme->crypto.ciphers_pairwise[0]) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: pval = WEP_ENABLED; break; case WLAN_CIPHER_SUITE_TKIP: pval = TKIP_ENABLED; break; case WLAN_CIPHER_SUITE_CCMP: pval = AES_ENABLED; break; case WLAN_CIPHER_SUITE_AES_CMAC: pval = AES_ENABLED; break; default: brcmf_err(""invalid cipher pairwise (%d)\n"", sme->crypto.ciphers_pairwise[0]); return -EINVAL; } } if (sme->crypto.cipher_group) { switch (sme->crypto.cipher_group) { case WLAN_CIPHER_SUITE_WEP40: case WLAN_CIPHER_SUITE_WEP104: gval = WEP_ENABLED; break; case WLAN_CIPHER_SUITE_TKIP: gval = TKIP_ENABLED; break; case WLAN_CIPHER_SUITE_CCMP: gval = AES_ENABLED; break; case WLAN_CIPHER_SUITE_AES_CMAC: gval = AES_ENABLED; break; default: brcmf_err(""invalid cipher group (%d)\n"", sme->crypto.cipher_group); return -EINVAL; } } brcmf_dbg(CONN, ""pval (%d) gval (%d)\n"", pval, gval); /* In case of privacy, but no security and WPS then simulate */ /* setting AES. WPS-2.0 allows no security */ if (brcmf_find_wpsie(sme->ie, sme->ie_len) && !pval && !gval && sme->privacy) pval = AES_ENABLED; wsec = pval | gval; err = brcmf_fil_bsscfg_int_set(netdev_priv(ndev), ""wsec"", wsec); if (err) { brcmf_err(""error (%d)\n"", err); return err; } sec = &profile->sec; sec->cipher_pairwise = sme->crypto.ciphers_pairwise[0]; sec->cipher_group = sme->crypto.cipher_group; return err; } ",0 "static int sas_get_phy_discover(struct domain_device *dev, int phy_id, struct smp_resp *disc_resp) { int res; u8 *disc_req; disc_req = alloc_smp_req(DISCOVER_REQ_SIZE); if (!disc_req) return -ENOMEM; disc_req[1] = SMP_DISCOVER; disc_req[9] = phy_id; res = smp_execute_task(dev, disc_req, DISCOVER_REQ_SIZE, disc_resp, DISCOVER_RESP_SIZE); if (res) goto out; else if (disc_resp->result != SMP_RESP_FUNC_ACC) { res = disc_resp->result; goto out; } out: kfree(disc_req); return res; } ",0 "void AuthenticatorBlePowerOnManualSheetModel::OnAccept() { dialog_model()->ContinueWithFlowAfterBleAdapterPowered(); } ",0 "void xrevrangeCommand(client *c) { xrangeGenericCommand(c,1); } ",0 "nfs_mark_request_commit(struct nfs_page *req, struct pnfs_layout_segment *lseg, struct nfs_commit_info *cinfo) { if (pnfs_mark_request_commit(req, lseg, cinfo)) return; nfs_request_add_commit_list(req, &cinfo->mds->list, cinfo); } ",0 "static void write_volume_label(DOS_FS * fs, char *label) { time_t now = time(NULL); struct tm *mtime = localtime(&now); off_t offset; int created; DIR_ENT de; created = 0; offset = find_volume_de(fs, &de); if (offset == 0) { created = 1; offset = alloc_rootdir_entry(fs, &de, label); } memcpy(de.name, label, 11); de.time = htole16((unsigned short)((mtime->tm_sec >> 1) + (mtime->tm_min << 5) + (mtime->tm_hour << 11))); de.date = htole16((unsigned short)(mtime->tm_mday + ((mtime->tm_mon + 1) << 5) + ((mtime->tm_year - 80) << 9))); if (created) { de.attr = ATTR_VOLUME; de.ctime_ms = 0; de.ctime = de.time; de.cdate = de.date; de.adate = de.date; de.starthi = 0; de.start = 0; de.size = 0; } fs_write(offset, sizeof(DIR_ENT), &de); } ",0 "static void hwahc_disconnect(struct usb_interface *usb_iface) { struct usb_hcd *usb_hcd; struct wusbhc *wusbhc; struct hwahc *hwahc; usb_hcd = usb_get_intfdata(usb_iface); wusbhc = usb_hcd_to_wusbhc(usb_hcd); hwahc = container_of(wusbhc, struct hwahc, wusbhc); wusbhc_b_destroy(&hwahc->wusbhc); usb_remove_hcd(usb_hcd); hwahc_destroy(hwahc); usb_put_hcd(usb_hcd); } ",0 "void NavigationControllerImpl::HandleRendererDebugURL( FrameTreeNode* frame_tree_node, const GURL& url) { if (!frame_tree_node->current_frame_host()->IsRenderFrameLive()) { if (!IsInitialNavigation()) { DiscardNonCommittedEntries(); return; } frame_tree_node->render_manager()->InitializeRenderFrameIfNecessary( frame_tree_node->current_frame_host()); } frame_tree_node->current_frame_host()->HandleRendererDebugURL(url); } ",0 "void V4L2JpegEncodeAccelerator::EncodedInstance::EnqueueOutput() { DCHECK(parent_->encoder_task_runner_->BelongsToCurrentThread()); while (running_job_queue_.size() > OutputBufferQueuedCount() && !free_output_buffers_.empty()) { if (!EnqueueOutputRecord()) return; } if (!output_streamon_ && OutputBufferQueuedCount()) { __u32 type = V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE; IOCTL_OR_ERROR_RETURN(VIDIOC_STREAMON, &type); output_streamon_ = true; } } ",0 "int dma_supported(struct device *dev, u64 mask) { if (mask < (u64)arm_dma_limit) return 0; return 1; } ",0 " cff_decoder_init( CFF_Decoder* decoder, TT_Face face, CFF_Size size, CFF_GlyphSlot slot, FT_Bool hinting, FT_Render_Mode hint_mode ) { CFF_Font cff = (CFF_Font)face->extra.data; /* clear everything */ FT_MEM_ZERO( decoder, sizeof ( *decoder ) ); /* initialize builder */ cff_builder_init( &decoder->builder, face, size, slot, hinting ); /* initialize Type2 decoder */ decoder->cff = cff; decoder->num_globals = cff->global_subrs_index.count; decoder->globals = cff->global_subrs; decoder->globals_bias = cff_compute_bias( cff->top_font.font_dict.charstring_type, decoder->num_globals ); decoder->hint_mode = hint_mode; } ",0 "void tcp_init_sock(struct sock *sk) { struct inet_connection_sock *icsk = inet_csk(sk); struct tcp_sock *tp = tcp_sk(sk); tp->out_of_order_queue = RB_ROOT; tcp_init_xmit_timers(sk); tcp_prequeue_init(tp); INIT_LIST_HEAD(&tp->tsq_node); icsk->icsk_rto = TCP_TIMEOUT_INIT; tp->mdev_us = jiffies_to_usecs(TCP_TIMEOUT_INIT); minmax_reset(&tp->rtt_min, tcp_time_stamp, ~0U); /* So many TCP implementations out there (incorrectly) count the * initial SYN frame in their delayed-ACK and congestion control * algorithms that we must have the following bandaid to talk * efficiently to them. -DaveM */ tp->snd_cwnd = TCP_INIT_CWND; /* There's a bubble in the pipe until at least the first ACK. */ tp->app_limited = ~0U; /* See draft-stevens-tcpca-spec-01 for discussion of the * initialization of these values. */ tp->snd_ssthresh = TCP_INFINITE_SSTHRESH; tp->snd_cwnd_clamp = ~0; tp->mss_cache = TCP_MSS_DEFAULT; tp->reordering = sock_net(sk)->ipv4.sysctl_tcp_reordering; tcp_assign_congestion_control(sk); tp->tsoffset = 0; sk->sk_state = TCP_CLOSE; sk->sk_write_space = sk_stream_write_space; sock_set_flag(sk, SOCK_USE_WRITE_QUEUE); icsk->icsk_sync_mss = tcp_sync_mss; sk->sk_sndbuf = sysctl_tcp_wmem[1]; sk->sk_rcvbuf = sysctl_tcp_rmem[1]; sk_sockets_allocated_inc(sk); } ",0 "void InputDispatcher::dropInboundEventLocked(EventEntry* entry, DropReason dropReason) { const char* reason; switch (dropReason) { case DROP_REASON_POLICY: #if DEBUG_INBOUND_EVENT_DETAILS ALOGD(""Dropped event because policy consumed it.""); #endif reason = ""inbound event was dropped because the policy consumed it""; break; case DROP_REASON_DISABLED: if (mLastDropReason != DROP_REASON_DISABLED) { ALOGI(""Dropped event because input dispatch is disabled.""); } reason = ""inbound event was dropped because input dispatch is disabled""; break; case DROP_REASON_APP_SWITCH: ALOGI(""Dropped event because of pending overdue app switch.""); reason = ""inbound event was dropped because of pending overdue app switch""; break; case DROP_REASON_BLOCKED: ALOGI(""Dropped event because the current application is not responding and the user "" ""has started interacting with a different application.""); reason = ""inbound event was dropped because the current application is not responding "" ""and the user has started interacting with a different application""; break; case DROP_REASON_STALE: ALOGI(""Dropped event because it is stale.""); reason = ""inbound event was dropped because it is stale""; break; default: ALOG_ASSERT(false); return; } switch (entry->type) { case EventEntry::TYPE_KEY: { CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS, reason); synthesizeCancelationEventsForAllConnectionsLocked(options); break; } case EventEntry::TYPE_MOTION: { MotionEntry* motionEntry = static_cast(entry); if (motionEntry->source & AINPUT_SOURCE_CLASS_POINTER) { CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, reason); synthesizeCancelationEventsForAllConnectionsLocked(options); } else { CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS, reason); synthesizeCancelationEventsForAllConnectionsLocked(options); } break; } } } ",0 " saml2md::MetadataProvider* SHIBSP_DLLLOCAL DynamicMetadataProviderFactory(const DOMElement* const & e) { return new DynamicMetadataProvider(e); } ",0 "AppCacheResponseWriter* AppCacheUpdateJob::CreateResponseWriter() { AppCacheResponseWriter* writer = storage_->CreateResponseWriter(manifest_url_, group_->group_id()); stored_response_ids_.push_back(writer->response_id()); return writer; } ",0 "XmlConfigParser* XmlConfigParser::FromContext(void* ctx) { return static_cast(ctx); } ",0 "static void pdf_run_w(fz_context *ctx, pdf_processor *proc, float linewidth) { pdf_run_processor *pr = (pdf_run_processor *)proc; pdf_gstate *gstate = pdf_flush_text(ctx, pr); pr->dev->flags &= ~FZ_DEVFLAG_LINEWIDTH_UNDEFINED; gstate->stroke_state = fz_unshare_stroke_state(ctx, gstate->stroke_state); gstate->stroke_state->linewidth = linewidth; } ",0 "xscale2pmu_write_event_select(u32 val) { asm volatile(""mcr p14, 0, %0, c8, c1, 0"" : : ""r""(val)); } ",0 "GlobalHistogramAllocator* GlobalHistogramAllocator::Get() { return reinterpret_cast( subtle::Acquire_Load(&g_histogram_allocator)); } ",0 "static int des3_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int key_len) { struct s390_des_ctx *ctx = crypto_tfm_ctx(tfm); u32 *flags = &tfm->crt_flags; if (!(crypto_memneq(key, &key[DES_KEY_SIZE], DES_KEY_SIZE) && crypto_memneq(&key[DES_KEY_SIZE], &key[DES_KEY_SIZE * 2], DES_KEY_SIZE)) && (*flags & CRYPTO_TFM_REQ_WEAK_KEY)) { *flags |= CRYPTO_TFM_RES_WEAK_KEY; return -EINVAL; } memcpy(ctx->key, key, key_len); return 0; } ",0 "static int sas_check_level_subtractive_boundary(struct domain_device *dev) { struct expander_device *ex = &dev->ex_dev; struct domain_device *child; u8 sub_addr[8] = {0, }; list_for_each_entry(child, &ex->children, siblings) { if (child->dev_type != SAS_EDGE_EXPANDER_DEVICE && child->dev_type != SAS_FANOUT_EXPANDER_DEVICE) continue; if (sub_addr[0] == 0) { sas_find_sub_addr(child, sub_addr); continue; } else { u8 s2[8]; if (sas_find_sub_addr(child, s2) && (SAS_ADDR(sub_addr) != SAS_ADDR(s2))) { SAS_DPRINTK(""ex %016llx->%016llx-?->%016llx "" ""diverges from subtractive "" ""boundary %016llx\n"", SAS_ADDR(dev->sas_addr), SAS_ADDR(child->sas_addr), SAS_ADDR(s2), SAS_ADDR(sub_addr)); sas_ex_disable_port(child, s2); } } } return 0; } ",0 "void RenderViewHostImpl::Shutdown() { if (run_modal_reply_msg_) { Send(run_modal_reply_msg_); run_modal_reply_msg_ = NULL; RenderViewHostImpl* opener = RenderViewHostImpl::FromID(GetProcess()->GetID(), run_modal_opener_id_); if (opener) { opener->StartHangMonitorTimeout(TimeDelta::FromMilliseconds( hung_renderer_delay_ms_)); opener->increment_in_flight_event_count(); } run_modal_opener_id_ = MSG_ROUTING_NONE; } RenderWidgetHostImpl::Shutdown(); } ",0 "int UDPSocketWin::Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback) { return SendToOrWrite(buf, buf_len, NULL, callback); } ",0 "int yr_re_ast_create( RE_AST** re_ast) { *re_ast = (RE_AST*) yr_malloc(sizeof(RE_AST)); if (*re_ast == NULL) return ERROR_INSUFFICIENT_MEMORY; (*re_ast)->flags = 0; (*re_ast)->root_node = NULL; return ERROR_SUCCESS; } ",0 "bool ThreadWatcherList::IsRegistered(const BrowserThread::ID thread_id) { DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); return nullptr != ThreadWatcherList::Find(thread_id); } ",0 "static int splice_from_pipe_feed(struct pipe_inode_info *pipe, struct splice_desc *sd, splice_actor *actor) { int ret; while (pipe->nrbufs) { struct pipe_buffer *buf = pipe->bufs + pipe->curbuf; sd->len = buf->len; if (sd->len > sd->total_len) sd->len = sd->total_len; ret = pipe_buf_confirm(pipe, buf); if (unlikely(ret)) { if (ret == -ENODATA) ret = 0; return ret; } ret = actor(pipe, buf, sd); if (ret <= 0) return ret; buf->offset += ret; buf->len -= ret; sd->num_spliced += ret; sd->len -= ret; sd->pos += ret; sd->total_len -= ret; if (!buf->len) { pipe_buf_release(pipe, buf); pipe->curbuf = (pipe->curbuf + 1) & (pipe->buffers - 1); pipe->nrbufs--; if (pipe->files) sd->need_wakeup = true; } if (!sd->total_len) return 0; } return 1; } ",0 "getCPS(struct rx_call *call, afs_int32 aid, prlist *alist, afs_int32 *over, afs_int32 *cid) { afs_int32 code; struct ubik_trans *tt; afs_int32 temp; struct prentry tentry; *over = 0; alist->prlist_len = 0; alist->prlist_val = NULL; code = Initdb(); if (code != PRSUCCESS) return code; code = ubik_BeginTransReadAny(dbase, UBIK_READTRANS, &tt); if (code) return code; code = ubik_SetLock(tt, 1, 1, LOCKREAD); if (code) ABORT_WITH(tt, code); code = read_DbHeader(tt); if (code) ABORT_WITH(tt, code); temp = FindByID(tt, aid); if (!temp) ABORT_WITH(tt, PRNOENT); code = pr_ReadEntry(tt, 0, temp, &tentry); if (code) ABORT_WITH(tt, code); /* afs does authenticate now */ code = WhoIsThis(call, tt, cid); if (code || !AccessOK(tt, *cid, &tentry, PRP_MEMBER_MEM, PRP_MEMBER_ANY)) ABORT_WITH(tt, PRPERM); code = GetList(tt, &tentry, alist, 1); if (code != PRSUCCESS) ABORT_WITH(tt, code); code = ubik_EndTrans(tt); return code; } ",0 "int bpf_check(struct bpf_prog **prog, union bpf_attr *attr) { char __user *log_ubuf = NULL; struct bpf_verifier_env *env; int ret = -EINVAL; /* 'struct bpf_verifier_env' can be global, but since it's not small, * allocate/free it every time bpf_check() is called */ env = kzalloc(sizeof(struct bpf_verifier_env), GFP_KERNEL); if (!env) return -ENOMEM; env->insn_aux_data = vzalloc(sizeof(struct bpf_insn_aux_data) * (*prog)->len); ret = -ENOMEM; if (!env->insn_aux_data) goto err_free_env; env->prog = *prog; /* grab the mutex to protect few globals used by verifier */ mutex_lock(&bpf_verifier_lock); if (attr->log_level || attr->log_buf || attr->log_size) { /* user requested verbose verifier output * and supplied buffer to store the verification trace */ log_level = attr->log_level; log_ubuf = (char __user *) (unsigned long) attr->log_buf; log_size = attr->log_size; log_len = 0; ret = -EINVAL; /* log_* values have to be sane */ if (log_size < 128 || log_size > UINT_MAX >> 8 || log_level == 0 || log_ubuf == NULL) goto err_unlock; ret = -ENOMEM; log_buf = vmalloc(log_size); if (!log_buf) goto err_unlock; } else { log_level = 0; } ret = replace_map_fd_with_map_ptr(env); if (ret < 0) goto skip_full_check; env->explored_states = kcalloc(env->prog->len, sizeof(struct bpf_verifier_state_list *), GFP_USER); ret = -ENOMEM; if (!env->explored_states) goto skip_full_check; ret = check_cfg(env); if (ret < 0) goto skip_full_check; env->allow_ptr_leaks = capable(CAP_SYS_ADMIN); ret = do_check(env); skip_full_check: while (pop_stack(env, NULL) >= 0); free_states(env); if (ret == 0) /* program is valid, convert *(u32*)(ctx + off) accesses */ ret = convert_ctx_accesses(env); if (ret == 0) ret = fixup_bpf_calls(env); if (log_level && log_len >= log_size - 1) { BUG_ON(log_len >= log_size); /* verifier log exceeded user supplied buffer */ ret = -ENOSPC; /* fall through to return what was recorded */ } /* copy verifier log back to user space including trailing zero */ if (log_level && copy_to_user(log_ubuf, log_buf, log_len + 1) != 0) { ret = -EFAULT; goto free_log_buf; } if (ret == 0 && env->used_map_cnt) { /* if program passed verifier, update used_maps in bpf_prog_info */ env->prog->aux->used_maps = kmalloc_array(env->used_map_cnt, sizeof(env->used_maps[0]), GFP_KERNEL); if (!env->prog->aux->used_maps) { ret = -ENOMEM; goto free_log_buf; } memcpy(env->prog->aux->used_maps, env->used_maps, sizeof(env->used_maps[0]) * env->used_map_cnt); env->prog->aux->used_map_cnt = env->used_map_cnt; /* program is valid. Convert pseudo bpf_ld_imm64 into generic * bpf_ld_imm64 instructions */ convert_pseudo_ld_imm64(env); } free_log_buf: if (log_level) vfree(log_buf); if (!env->prog->aux->used_maps) /* if we didn't copy map pointers into bpf_prog_info, release * them now. Otherwise free_bpf_prog_info() will release them. */ release_maps(env); *prog = env->prog; err_unlock: mutex_unlock(&bpf_verifier_lock); vfree(env->insn_aux_data); err_free_env: kfree(env); return ret; } ",0 "static void *allocSpace( struct ReusableSpace *p, /* Bulk memory available for allocation */ void *pBuf, /* Pointer to a prior allocation */ int nByte /* Bytes of memory needed */ ){ assert( EIGHT_BYTE_ALIGNMENT(p->pSpace) ); if( pBuf==0 ){ nByte = ROUND8(nByte); if( nByte <= p->nFree ){ p->nFree -= nByte; pBuf = &p->pSpace[p->nFree]; }else{ p->nNeeded += nByte; } } assert( EIGHT_BYTE_ALIGNMENT(pBuf) ); return pBuf; } ",0 " void OnCallbackFired() { callback_counter_--; } ",0 "cifs_writev(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos) { struct file *file = iocb->ki_filp; struct cifsFileInfo *cfile = (struct cifsFileInfo *)file->private_data; struct inode *inode = file->f_mapping->host; struct cifsInodeInfo *cinode = CIFS_I(inode); struct TCP_Server_Info *server = tlink_tcon(cfile->tlink)->ses->server; ssize_t rc = -EACCES; BUG_ON(iocb->ki_pos != pos); /* * We need to hold the sem to be sure nobody modifies lock list * with a brlock that prevents writing. */ down_read(&cinode->lock_sem); if (!cifs_find_lock_conflict(cfile, pos, iov_length(iov, nr_segs), server->vals->exclusive_lock_type, NULL, CIFS_WRITE_OP)) { mutex_lock(&inode->i_mutex); rc = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos); mutex_unlock(&inode->i_mutex); } if (rc > 0) { ssize_t err; err = generic_write_sync(file, pos, rc); if (err < 0 && rc > 0) rc = err; } up_read(&cinode->lock_sem); return rc; } ",0 "void BrowserCommandController::UpdateCommandsForMultipleProfiles() { bool show_main_ui = IsShowingMainUI(window() && window()->IsFullscreen()); command_updater_.UpdateCommandEnabled(IDC_SHOW_AVATAR_MENU, show_main_ui && !profile()->IsOffTheRecord() && ProfileManager::IsMultipleProfilesEnabled()); } ",0 "xmlXPtrRangeCheckOrder(xmlXPathObjectPtr range) { int tmp; xmlNodePtr tmp2; if (range == NULL) return; if (range->type != XPATH_RANGE) return; if (range->user2 == NULL) return; tmp = xmlXPtrCmpPoints(range->user, range->index, range->user2, range->index2); if (tmp == -1) { tmp2 = range->user; range->user = range->user2; range->user2 = tmp2; tmp = range->index; range->index = range->index2; range->index2 = tmp; } } ",0 "SurfaceHitTestReadyNotifier::SurfaceHitTestReadyNotifier( RenderWidgetHostViewBase* target_view) : target_view_(target_view) { surface_manager_ = GetFrameSinkManager()->surface_manager(); } ",0 "static void iscsi_allocationmap_clear(IscsiLun *iscsilun, int64_t sector_num, int nb_sectors) { int64_t cluster_num, nb_clusters; if (iscsilun->allocationmap == NULL) { return; } cluster_num = DIV_ROUND_UP(sector_num, iscsilun->cluster_sectors); nb_clusters = (sector_num + nb_sectors) / iscsilun->cluster_sectors - cluster_num; if (nb_clusters > 0) { bitmap_clear(iscsilun->allocationmap, cluster_num, nb_clusters); } } ",0 "void DevToolsAgentFilter::OnDispatchOnInspectorBackend( const std::string& message) { if (!WebDevToolsAgent::shouldInterruptForMessage( WebString::fromUTF8(message))) { message_handled_ = false; return; } WebDevToolsAgent::interruptAndDispatch( new MessageImpl(message, current_routing_id_)); render_thread_loop_->PostTask( FROM_HERE, NewRunnableFunction(&WebDevToolsAgent::processPendingMessages)); } ",0 "hook_focus (struct t_weechat_plugin *plugin, const char *area, t_hook_callback_focus *callback, void *callback_data) { struct t_hook *new_hook; struct t_hook_focus *new_hook_focus; int priority; const char *ptr_area; if (!area || !area[0] || !callback) return NULL; new_hook = malloc (sizeof (*new_hook)); if (!new_hook) return NULL; new_hook_focus = malloc (sizeof (*new_hook_focus)); if (!new_hook_focus) { free (new_hook); return NULL; } hook_get_priority_and_name (area, &priority, &ptr_area); hook_init_data (new_hook, plugin, HOOK_TYPE_FOCUS, priority, callback_data); new_hook->hook_data = new_hook_focus; new_hook_focus->callback = callback; new_hook_focus->area = strdup ((ptr_area) ? ptr_area : area); hook_add_to_list (new_hook); return new_hook; } ",0 "int streamDeleteItem(stream *s, streamID *id) { int deleted = 0; streamIterator si; streamIteratorStart(&si,s,id,id,0); streamID myid; int64_t numfields; if (streamIteratorGetID(&si,&myid,&numfields)) { streamIteratorRemoveEntry(&si,&myid); deleted = 1; } return deleted; } ",0 "static void ssh_hostport_setup(const char *host, int port, Conf *conf, char **savedhost, int *savedport, char **loghost_ret) { char *loghost = conf_get_str(conf, CONF_loghost); if (loghost_ret) *loghost_ret = loghost; if (*loghost) { char *tmphost; char *colon; tmphost = dupstr(loghost); *savedport = 22; /* default ssh port */ /* * A colon suffix on the hostname string also lets us affect * savedport. (Unless there are multiple colons, in which case * we assume this is an unbracketed IPv6 literal.) */ colon = host_strrchr(tmphost, ':'); if (colon && colon == host_strchr(tmphost, ':')) { *colon++ = '\0'; if (*colon) *savedport = atoi(colon); } *savedhost = host_strduptrim(tmphost); sfree(tmphost); } else { *savedhost = host_strduptrim(host); if (port < 0) port = 22; /* default ssh port */ *savedport = port; } } ",0 "void SoundPool::moveToFront_l(SoundChannel* channel) { for (List::iterator iter = mChannels.begin(); iter != mChannels.end(); ++iter) { if (*iter == channel) { mChannels.erase(iter); mChannels.push_front(channel); break; } } } ",0 "mm_answer_sign(int sock, Buffer *m) { struct ssh *ssh = active_state; /* XXX */ extern int auth_sock; /* XXX move to state struct? */ struct sshkey *key; struct sshbuf *sigbuf = NULL; u_char *p = NULL, *signature = NULL; char *alg = NULL; size_t datlen, siglen, alglen; int r, is_proof = 0; u_int keyid; const char proof_req[] = ""hostkeys-prove-00@openssh.com""; debug3(""%s"", __func__); if ((r = sshbuf_get_u32(m, &keyid)) != 0 || (r = sshbuf_get_string(m, &p, &datlen)) != 0 || (r = sshbuf_get_cstring(m, &alg, &alglen)) != 0) fatal(""%s: buffer error: %s"", __func__, ssh_err(r)); if (keyid > INT_MAX) fatal(""%s: invalid key ID"", __func__); /* * Supported KEX types use SHA1 (20 bytes), SHA256 (32 bytes), * SHA384 (48 bytes) and SHA512 (64 bytes). * * Otherwise, verify the signature request is for a hostkey * proof. * * XXX perform similar check for KEX signature requests too? * it's not trivial, since what is signed is the hash, rather * than the full kex structure... */ if (datlen != 20 && datlen != 32 && datlen != 48 && datlen != 64) { /* * Construct expected hostkey proof and compare it to what * the client sent us. */ if (session_id2_len == 0) /* hostkeys is never first */ fatal(""%s: bad data length: %zu"", __func__, datlen); if ((key = get_hostkey_public_by_index(keyid, ssh)) == NULL) fatal(""%s: no hostkey for index %d"", __func__, keyid); if ((sigbuf = sshbuf_new()) == NULL) fatal(""%s: sshbuf_new"", __func__); if ((r = sshbuf_put_cstring(sigbuf, proof_req)) != 0 || (r = sshbuf_put_string(sigbuf, session_id2, session_id2_len)) != 0 || (r = sshkey_puts(key, sigbuf)) != 0) fatal(""%s: couldn't prepare private key "" ""proof buffer: %s"", __func__, ssh_err(r)); if (datlen != sshbuf_len(sigbuf) || memcmp(p, sshbuf_ptr(sigbuf), sshbuf_len(sigbuf)) != 0) fatal(""%s: bad data length: %zu, hostkey proof len %zu"", __func__, datlen, sshbuf_len(sigbuf)); sshbuf_free(sigbuf); is_proof = 1; } /* save session id, it will be passed on the first call */ if (session_id2_len == 0) { session_id2_len = datlen; session_id2 = xmalloc(session_id2_len); memcpy(session_id2, p, session_id2_len); } if ((key = get_hostkey_by_index(keyid)) != NULL) { if ((r = sshkey_sign(key, &signature, &siglen, p, datlen, alg, datafellows)) != 0) fatal(""%s: sshkey_sign failed: %s"", __func__, ssh_err(r)); } else if ((key = get_hostkey_public_by_index(keyid, ssh)) != NULL && auth_sock > 0) { if ((r = ssh_agent_sign(auth_sock, key, &signature, &siglen, p, datlen, alg, datafellows)) != 0) { fatal(""%s: ssh_agent_sign failed: %s"", __func__, ssh_err(r)); } } else fatal(""%s: no hostkey from index %d"", __func__, keyid); debug3(""%s: %s signature %p(%zu)"", __func__, is_proof ? ""KEX"" : ""hostkey proof"", signature, siglen); sshbuf_reset(m); if ((r = sshbuf_put_string(m, signature, siglen)) != 0) fatal(""%s: buffer error: %s"", __func__, ssh_err(r)); free(alg); free(p); free(signature); mm_request_send(sock, MONITOR_ANS_SIGN, m); /* Turn on permissions for getpwnam */ monitor_permit(mon_dispatch, MONITOR_REQ_PWNAM, 1); return (0); } ",0 "static void *mxf_resolve_strong_ref(MXFContext *mxf, UID *strong_ref, enum MXFMetadataSetType type) { int i; if (!strong_ref) return NULL; for (i = 0; i < mxf->metadata_sets_count; i++) { if (!memcmp(*strong_ref, mxf->metadata_sets[i]->uid, 16) && (type == AnyType || mxf->metadata_sets[i]->type == type)) { return mxf->metadata_sets[i]; } } return NULL; } ",0 " std::string ToLayerName(PaintedShape painted_shape) { switch (painted_shape) { case TOP_LEFT_CIRCLE: return ""TOP_LEFT_CIRCLE""; case TOP_RIGHT_CIRCLE: return ""TOP_RIGHT_CIRCLE""; case BOTTOM_RIGHT_CIRCLE: return ""BOTTOM_RIGHT_CIRCLE""; case BOTTOM_LEFT_CIRCLE: return ""BOTTOM_LEFT_CIRCLE""; case HORIZONTAL_RECT: return ""HORIZONTAL_RECT""; case VERTICAL_RECT: return ""VERTICAL_RECT""; case PAINTED_SHAPE_COUNT: NOTREACHED() << ""The PAINTED_SHAPE_COUNT value should never be used.""; return ""PAINTED_SHAPE_COUNT""; } return ""UNKNOWN""; } ",0 "void RenderView::OnScriptEvalRequest(const std::wstring& frame_xpath, const std::wstring& jscript) { EvaluateScript(frame_xpath, jscript); } ",0 "pdf14_ok_to_optimize(gx_device *dev) { bool using_blend_cs; pdf14_default_colorspace_t pdf14_cs = pdf14_determine_default_blend_cs(dev, false, &using_blend_cs); gsicc_colorbuffer_t dev_icc_cs; bool ok = false; int tag_depth = device_encodes_tags(dev) ? 8 : 0; cmm_dev_profile_t *dev_profile; int code = dev_proc(dev, get_profile)(dev, &dev_profile); if (code < 0) return false; check_device_compatible_encoding(dev); if (dev->color_info.separable_and_linear != GX_CINFO_SEP_LIN_STANDARD) return false; dev_icc_cs = dev_profile->device_profile[0]->data_cs; /* If the outputprofile is not ""standard"" then colors converted to device color */ /* during clist writing won't match the colors written for the pdf14 clist dev */ if (!(dev_icc_cs == gsGRAY || dev_icc_cs == gsRGB || dev_icc_cs == gsCMYK)) return false; /* can't handle funky output profiles */ switch (pdf14_cs) { case PDF14_DeviceGray: ok = dev->color_info.max_gray == 255 && dev->color_info.depth == 8 + tag_depth; break; case PDF14_DeviceRGB: ok = dev->color_info.max_color == 255 && dev->color_info.depth == 24 + tag_depth; break; case PDF14_DeviceCMYK: ok = dev->color_info.max_color == 255 && dev->color_info.depth == 32 + tag_depth; break; case PDF14_DeviceCMYKspot: ok = false; /* punt for this case */ break; case PDF14_DeviceCustom: /* * We are using the output device's process color model. The * color_info for the PDF 1.4 compositing device needs to match * the output device, but it may not have been contone. */ ok = dev->color_info.depth == dev->color_info.num_components * 8 + tag_depth; break; default: /* Should not occur */ ok = false; } return ok; } ",0 "void AutomationProvider::UninstallExtension(int extension_handle, bool* success) { *success = false; const Extension* extension = GetExtension(extension_handle); ExtensionService* service = profile_->GetExtensionService(); if (extension && service) { ExtensionUnloadNotificationObserver observer; service->UninstallExtension(extension->id(), false); *success = observer.did_receive_unload_notification(); } } ",0 "int apply_to_page_range(struct mm_struct *mm, unsigned long addr, unsigned long size, pte_fn_t fn, void *data) { pgd_t *pgd; unsigned long next; unsigned long end = addr + size; int err; BUG_ON(addr >= end); pgd = pgd_offset(mm, addr); do { next = pgd_addr_end(addr, end); err = apply_to_pud_range(mm, pgd, addr, next, fn, data); if (err) break; } while (pgd++, addr = next, addr != end); return err; } ",0 "void QQuickWebViewPrivate::_q_onIconChangedForPageURL(const QUrl& pageURL, const QUrl& iconURL) { Q_Q(QQuickWebView); if (q->url() != pageURL) return; setIcon(iconURL); } ",0 "OJPEGReadHeaderInfo(TIFF* tif) { static const char module[]=""OJPEGReadHeaderInfo""; OJPEGState* sp=(OJPEGState*)tif->tif_data; assert(sp->readheader_done==0); sp->image_width=tif->tif_dir.td_imagewidth; sp->image_length=tif->tif_dir.td_imagelength; if isTiled(tif) { sp->strile_width=tif->tif_dir.td_tilewidth; sp->strile_length=tif->tif_dir.td_tilelength; sp->strile_length_total=((sp->image_length+sp->strile_length-1)/sp->strile_length)*sp->strile_length; } else { sp->strile_width=sp->image_width; sp->strile_length=tif->tif_dir.td_rowsperstrip; sp->strile_length_total=sp->image_length; } if (tif->tif_dir.td_samplesperpixel==1) { sp->samples_per_pixel=1; sp->plane_sample_offset=0; sp->samples_per_pixel_per_plane=sp->samples_per_pixel; sp->subsampling_hor=1; sp->subsampling_ver=1; } else { if (tif->tif_dir.td_samplesperpixel!=3) { TIFFErrorExt(tif->tif_clientdata,module,""SamplesPerPixel %d not supported for this compression scheme"",sp->samples_per_pixel); return(0); } sp->samples_per_pixel=3; sp->plane_sample_offset=0; if (tif->tif_dir.td_planarconfig==PLANARCONFIG_CONTIG) sp->samples_per_pixel_per_plane=3; else sp->samples_per_pixel_per_plane=1; } if (sp->strile_lengthimage_length) { if (sp->strile_length%(sp->subsampling_ver*8)!=0) { TIFFErrorExt(tif->tif_clientdata,module,""Incompatible vertical subsampling and image strip/tile length""); return(0); } sp->restart_interval=(uint16)(((sp->strile_width+sp->subsampling_hor*8-1)/(sp->subsampling_hor*8))*(sp->strile_length/(sp->subsampling_ver*8))); } if (OJPEGReadHeaderInfoSec(tif)==0) return(0); sp->sos_end[0].log=1; sp->sos_end[0].in_buffer_source=sp->in_buffer_source; sp->sos_end[0].in_buffer_next_strile=sp->in_buffer_next_strile; sp->sos_end[0].in_buffer_file_pos=sp->in_buffer_file_pos-sp->in_buffer_togo; sp->sos_end[0].in_buffer_file_togo=sp->in_buffer_file_togo+sp->in_buffer_togo; sp->readheader_done=1; return(1); } ",0 "int snd_timer_start(struct snd_timer_instance *timeri, unsigned int ticks) { if (timeri == NULL || ticks < 1) return -EINVAL; if (timeri->flags & SNDRV_TIMER_IFLG_SLAVE) return snd_timer_start_slave(timeri, true); else return snd_timer_start1(timeri, true, ticks); } ",0 "static int cxusb_nano2_frontend_attach(struct dvb_usb_adapter *adap) { if (usb_set_interface(adap->dev->udev, 0, 1) < 0) err(""set interface failed""); cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0); /* reset the tuner and demodulator */ cxusb_bluebird_gpio_rw(adap->dev, 0x04, 0); cxusb_bluebird_gpio_pulse(adap->dev, 0x01, 1); cxusb_bluebird_gpio_pulse(adap->dev, 0x02, 1); adap->fe_adap[0].fe = dvb_attach(zl10353_attach, &cxusb_zl10353_xc3028_config, &adap->dev->i2c_adap); if ((adap->fe_adap[0].fe) != NULL) return 0; adap->fe_adap[0].fe = dvb_attach(mt352_attach, &cxusb_mt352_xc3028_config, &adap->dev->i2c_adap); if ((adap->fe_adap[0].fe) != NULL) return 0; return -EIO; } ",0 "void HTMLFormControlElement::removedFrom(ContainerNode* insertionPoint) { fieldSetAncestorsSetNeedsValidityCheck(insertionPoint); hideVisibleValidationMessage(); m_hasValidationMessage = false; m_ancestorDisabledState = AncestorDisabledStateUnknown; m_dataListAncestorState = Unknown; setNeedsWillValidateCheck(); HTMLElement::removedFrom(insertionPoint); FormAssociatedElement::removedFrom(insertionPoint); document().removeFormAssociation(this); } ",0 "void ChromotingInstance::UnregisterLoggingInstance() { base::AutoLock lock(g_logging_lock.Get()); if (this != g_logging_instance.Get().get()) return; g_has_logging_instance = false; g_logging_instance.Get().reset(); g_logging_task_runner.Get() = NULL; VLOG(1) << ""Unregistering global log handler""; } ",0 "static PHP_METHOD(PDOStatement, execute) { zval *input_params = NULL; int ret = 1; PHP_STMT_GET_OBJ; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""|a!"", &input_params)) { RETURN_FALSE; } PDO_STMT_CLEAR_ERR(); if (input_params) { struct pdo_bound_param_data param; zval **tmp; uint str_length; ulong num_index; if (stmt->bound_params) { zend_hash_destroy(stmt->bound_params); FREE_HASHTABLE(stmt->bound_params); stmt->bound_params = NULL; } zend_hash_internal_pointer_reset(Z_ARRVAL_P(input_params)); while (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(input_params), (void*)&tmp)) { memset(¶m, 0, sizeof(param)); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(input_params), ¶m.name, &str_length, &num_index, 0, NULL)) { /* yes this is correct. we don't want to count the null byte. ask wez */ param.namelen = str_length - 1; param.paramno = -1; } else { /* we're okay to be zero based here */ if (num_index < 0) { pdo_raise_impl_error(stmt->dbh, stmt, ""HY093"", NULL TSRMLS_CC); RETURN_FALSE; } param.paramno = num_index; } param.param_type = PDO_PARAM_STR; MAKE_STD_ZVAL(param.parameter); MAKE_COPY_ZVAL(tmp, param.parameter); if (!really_register_bound_param(¶m, stmt, 1 TSRMLS_CC)) { if (param.parameter) { zval_ptr_dtor(¶m.parameter); } RETURN_FALSE; } zend_hash_move_forward(Z_ARRVAL_P(input_params)); } } if (PDO_PLACEHOLDER_NONE == stmt->supports_placeholders) { /* handle the emulated parameter binding, * stmt->active_query_string holds the query with binds expanded and * quoted. */ ret = pdo_parse_params(stmt, stmt->query_string, stmt->query_stringlen, &stmt->active_query_string, &stmt->active_query_stringlen TSRMLS_CC); if (ret == 0) { /* no changes were made */ stmt->active_query_string = stmt->query_string; stmt->active_query_stringlen = stmt->query_stringlen; ret = 1; } else if (ret == -1) { /* something broke */ PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } } else if (!dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_PRE TSRMLS_CC)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } if (stmt->methods->executer(stmt TSRMLS_CC)) { if (stmt->active_query_string && stmt->active_query_string != stmt->query_string) { efree(stmt->active_query_string); } stmt->active_query_string = NULL; if (!stmt->executed) { /* this is the first execute */ if (stmt->dbh->alloc_own_columns && !stmt->columns) { /* for ""big boy"" drivers, we need to allocate memory to fetch * the results into, so lets do that now */ ret = pdo_stmt_describe_columns(stmt TSRMLS_CC); } stmt->executed = 1; } if (ret && !dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_POST TSRMLS_CC)) { RETURN_FALSE; } RETURN_BOOL(ret); } if (stmt->active_query_string && stmt->active_query_string != stmt->query_string) { efree(stmt->active_query_string); } stmt->active_query_string = NULL; PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } ",0 "PHP_FUNCTION(imagepsloadfont) { char *file; int file_len, f_ind, *font; #ifdef PHP_WIN32 struct stat st; #endif if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""p"", &file, &file_len) == FAILURE) { return; } #ifdef PHP_WIN32 if (VCWD_STAT(file, &st) < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Font file not found (%s)"", file); RETURN_FALSE; } #endif f_ind = T1_AddFont(file); if (f_ind < 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""T1Lib Error (%i): %s"", f_ind, T1_StrError(f_ind)); RETURN_FALSE; } if (T1_LoadFont(f_ind)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Couldn't load the font""); RETURN_FALSE; } font = (int *) emalloc(sizeof(int)); *font = f_ind; ZEND_REGISTER_RESOURCE(return_value, font, le_ps_font); } ",0 "tree_max_len(Node* node, ScanEnv* env) { OnigLen len; OnigLen tmax; len = 0; switch (NODE_TYPE(node)) { case NODE_LIST: do { tmax = tree_max_len(NODE_CAR(node), env); len = distance_add(len, tmax); } while (IS_NOT_NULL(node = NODE_CDR(node))); break; case NODE_ALT: do { tmax = tree_max_len(NODE_CAR(node), env); if (len < tmax) len = tmax; } while (IS_NOT_NULL(node = NODE_CDR(node))); break; case NODE_STRING: { StrNode* sn = STR_(node); len = (OnigLen )(sn->end - sn->s); } break; case NODE_CTYPE: case NODE_CCLASS: len = ONIGENC_MBC_MAXLEN_DIST(env->enc); break; case NODE_BACKREF: if (! NODE_IS_CHECKER(node)) { int i; int* backs; MemEnv* mem_env = SCANENV_MEMENV(env); BackRefNode* br = BACKREF_(node); if (NODE_IS_RECURSION(node)) { len = INFINITE_LEN; break; } backs = BACKREFS_P(br); for (i = 0; i < br->back_num; i++) { tmax = tree_max_len(mem_env[backs[i]].node, env); if (len < tmax) len = tmax; } } break; #ifdef USE_CALL case NODE_CALL: if (! NODE_IS_RECURSION(node)) len = tree_max_len(NODE_BODY(node), env); else len = INFINITE_LEN; break; #endif case NODE_QUANT: { QuantNode* qn = QUANT_(node); if (qn->upper != 0) { len = tree_max_len(NODE_BODY(node), env); if (len != 0) { if (! IS_REPEAT_INFINITE(qn->upper)) len = distance_multiply(len, qn->upper); else len = INFINITE_LEN; } } } break; case NODE_BAG: { BagNode* en = BAG_(node); switch (en->type) { case BAG_MEMORY: if (NODE_IS_MAX_FIXED(node)) len = en->max_len; else { if (NODE_IS_MARK1(node)) len = INFINITE_LEN; else { NODE_STATUS_ADD(node, MARK1); len = tree_max_len(NODE_BODY(node), env); NODE_STATUS_REMOVE(node, MARK1); en->max_len = len; NODE_STATUS_ADD(node, MAX_FIXED); } } break; case BAG_OPTION: case BAG_STOP_BACKTRACK: len = tree_max_len(NODE_BODY(node), env); break; case BAG_IF_ELSE: { OnigLen tlen, elen; len = tree_max_len(NODE_BODY(node), env); if (IS_NOT_NULL(en->te.Then)) { tlen = tree_max_len(en->te.Then, env); len = distance_add(len, tlen); } if (IS_NOT_NULL(en->te.Else)) elen = tree_max_len(en->te.Else, env); else elen = 0; if (elen > len) len = elen; } break; } } break; case NODE_ANCHOR: case NODE_GIMMICK: default: break; } return len; } ",0 "static int mct_u232_set_line_ctrl(struct usb_serial_port *port, unsigned char lcr) { int rc; unsigned char *buf; buf = kmalloc(MCT_U232_MAX_SIZE, GFP_KERNEL); if (buf == NULL) return -ENOMEM; buf[0] = lcr; rc = usb_control_msg(port->serial->dev, usb_sndctrlpipe(port->serial->dev, 0), MCT_U232_SET_LINE_CTRL_REQUEST, MCT_U232_SET_REQUEST_TYPE, 0, 0, buf, MCT_U232_SET_LINE_CTRL_SIZE, WDR_TIMEOUT); if (rc < 0) dev_err(&port->dev, ""Set LINE CTRL 0x%x failed (error = %d)\n"", lcr, rc); dev_dbg(&port->dev, ""set_line_ctrl: 0x%x\n"", lcr); kfree(buf); return rc; } /* mct_u232_set_line_ctrl */ ",0 "FloatPoint WebPagePrivate::mapToTransformedFloatPoint(const FloatPoint& point) const { return m_transformationMatrix->mapPoint(point); } ",0 "void BrowserView::TabDetachedAt(WebContents* contents, int index, bool was_active) { if (was_active) { web_contents_close_handler_->ActiveTabChanged(); contents_web_view_->SetWebContents(nullptr); infobar_container_->ChangeInfoBarManager(nullptr); UpdateDevToolsForContents(nullptr, true); } } ",0 "static int proxy_fstat(FsContext *fs_ctx, int fid_type, V9fsFidOpenState *fs, struct stat *stbuf) { int fd; if (fid_type == P9_FID_DIR) { fd = dirfd(fs->dir.stream); } else { fd = fs->fd; } return fstat(fd, stbuf); } ",0 "const Extension* ExtensionBrowserTest::LoadExtensionIncognito( const base::FilePath& path) { return LoadExtensionWithFlags(path, kFlagEnableFileAccess | kFlagEnableIncognito); } ",0 "void BluetoothOptionsHandler::DeviceFound(const std::string& adapter_id, chromeos::BluetoothDevice* device) { VLOG(2) << ""Device found on "" << adapter_id; DCHECK(device); web_ui_->CallJavascriptFunction( ""options.SystemOptions.addBluetoothDevice"", device->AsDictionary()); } ",1 "set_ics(E1000State *s, int index, uint32_t val) { DBGOUT(INTERRUPT, ""set_ics %x, ICR %x, IMR %x\n"", val, s->mac_reg[ICR], s->mac_reg[IMS]); set_interrupt_cause(s, 0, val | s->mac_reg[ICR]); } ",0 "report_invalid_token(JsonLexContext *lex) { char *token; int toklen; /* Separate out the offending token. */ toklen = lex->token_terminator - lex->token_start; token = palloc(toklen + 1); memcpy(token, lex->token_start, toklen); token[toklen] = '\0'; ereport(ERROR, (errcode(ERRCODE_INVALID_TEXT_REPRESENTATION), errmsg(""invalid input syntax for type json""), errdetail(""Token \""%s\"" is invalid."", token), report_json_context(lex))); } ",0 "void Gfx::opSetStrokeColorN(Object args[], int numArgs) { GfxColor color; GfxPattern *pattern; int i; if (state->getStrokeColorSpace()->getMode() == csPattern) { if (numArgs > 1) { if (!((GfxPatternColorSpace *)state->getStrokeColorSpace()) ->getUnder() || numArgs - 1 != ((GfxPatternColorSpace *)state->getStrokeColorSpace()) ->getUnder()->getNComps()) { error(getPos(), ""Incorrect number of arguments in 'SCN' command""); return; } for (i = 0; i < numArgs - 1 && i < gfxColorMaxComps; ++i) { if (args[i].isNum()) { color.c[i] = dblToCol(args[i].getNum()); } } state->setStrokeColor(&color); out->updateStrokeColor(state); } if (args[numArgs-1].isName() && (pattern = res->lookupPattern(args[numArgs-1].getName(), this))) { state->setStrokePattern(pattern); } } else { if (numArgs != state->getStrokeColorSpace()->getNComps()) { error(getPos(), ""Incorrect number of arguments in 'SCN' command""); return; } state->setStrokePattern(NULL); for (i = 0; i < numArgs && i < gfxColorMaxComps; ++i) { if (args[i].isNum()) { color.c[i] = dblToCol(args[i].getNum()); } } state->setStrokeColor(&color); out->updateStrokeColor(state); } } ",0 "status_t MediaRecorder::start() { ALOGV(""start""); if (mMediaRecorder == NULL) { ALOGE(""media recorder is not initialized yet""); return INVALID_OPERATION; } if (!(mCurrentState & MEDIA_RECORDER_PREPARED)) { ALOGE(""start called in an invalid state: %d"", mCurrentState); return INVALID_OPERATION; } status_t ret = mMediaRecorder->start(); if (OK != ret) { ALOGE(""start failed: %d"", ret); mCurrentState = MEDIA_RECORDER_ERROR; return ret; } mCurrentState = MEDIA_RECORDER_RECORDING; return ret; } ",0 "static MagickBooleanType ReadPSDChannel(Image *image,const PSDInfo *psd_info, LayerInfo* layer_info,const size_t channel, const PSDCompressionType compression,ExceptionInfo *exception) { Image *channel_image, *mask; MagickOffsetType offset; MagickBooleanType status; channel_image=image; mask=(Image *) NULL; if (layer_info->channel_info[channel].type < -1) { /* Ignore mask that is not a user supplied layer mask, if the mask is disabled or if the flags have unsupported values. */ if (layer_info->channel_info[channel].type != -2 || (layer_info->mask.flags > 3) || (layer_info->mask.flags & 0x02)) { SeekBlob(image,layer_info->channel_info[channel].size-2,SEEK_CUR); return(MagickTrue); } mask=CloneImage(image,layer_info->mask.page.width, layer_info->mask.page.height,MagickFalse,exception); SetImageType(mask,GrayscaleType,exception); channel_image=mask; } offset=TellBlob(channel_image); status=MagickTrue; switch(compression) { case Raw: status=ReadPSDChannelRaw(channel_image,psd_info->channels, layer_info->channel_info[channel].type,exception); break; case RLE: { MagickOffsetType *offsets; offsets=ReadPSDRLEOffsets(channel_image,psd_info,channel_image->rows); if (offsets == (MagickOffsetType *) NULL) ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); status=ReadPSDChannelRLE(channel_image,psd_info, layer_info->channel_info[channel].type,offsets,exception); offsets=(MagickOffsetType *) RelinquishMagickMemory(offsets); } break; case ZipWithPrediction: case ZipWithoutPrediction: #ifdef MAGICKCORE_ZLIB_DELEGATE status=ReadPSDChannelZip(channel_image,layer_info->channels, layer_info->channel_info[channel].type,compression, layer_info->channel_info[channel].size-2,exception); #else SeekBlob(image,offset+layer_info->channel_info[channel].size-2,SEEK_SET); (void) ThrowMagickException(exception,GetMagickModule(), MissingDelegateWarning,""DelegateLibrarySupportNotBuiltIn"", ""'%s' (ZLIB)"",image->filename); #endif break; default: SeekBlob(image,offset+layer_info->channel_info[channel].size-2,SEEK_SET); (void) ThrowMagickException(exception,GetMagickModule(),TypeWarning, ""CompressionNotSupported"",""'%.20g'"",(double) compression); break; } if (status == MagickFalse) { if (mask != (Image *) NULL) DestroyImage(mask); SeekBlob(image,offset+layer_info->channel_info[channel].size-2,SEEK_SET); ThrowBinaryException(CoderError,""UnableToDecompressImage"", image->filename); } if (mask != (Image *) NULL) { if (status != MagickFalse) { PixelInfo color; layer_info->mask.image=CloneImage(image,image->columns,image->rows, MagickTrue,exception); layer_info->mask.image->alpha_trait=UndefinedPixelTrait; GetPixelInfo(layer_info->mask.image,&color); color.red=layer_info->mask.background == 0 ? 0 : QuantumRange; SetImageColor(layer_info->mask.image,&color,exception); (void) CompositeImage(layer_info->mask.image,mask,OverCompositeOp, MagickTrue,layer_info->mask.page.x,layer_info->mask.page.y, exception); } DestroyImage(mask); } return(status); } ",0 "static bool kvm_vcpu_check_breakpoint(struct kvm_vcpu *vcpu, int *r) { struct kvm_run *kvm_run = vcpu->run; unsigned long eip = vcpu->arch.emulate_ctxt.eip; u32 dr6 = 0; if (unlikely(vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) && (vcpu->arch.guest_debug_dr7 & DR7_BP_EN_MASK)) { dr6 = kvm_vcpu_check_hw_bp(eip, 0, vcpu->arch.guest_debug_dr7, vcpu->arch.eff_db); if (dr6 != 0) { kvm_run->debug.arch.dr6 = dr6 | DR6_FIXED_1; kvm_run->debug.arch.pc = kvm_rip_read(vcpu) + get_segment_base(vcpu, VCPU_SREG_CS); kvm_run->debug.arch.exception = DB_VECTOR; kvm_run->exit_reason = KVM_EXIT_DEBUG; *r = EMULATE_USER_EXIT; return true; } } if (unlikely(vcpu->arch.dr7 & DR7_BP_EN_MASK)) { dr6 = kvm_vcpu_check_hw_bp(eip, 0, vcpu->arch.dr7, vcpu->arch.db); if (dr6 != 0) { vcpu->arch.dr6 &= ~15; vcpu->arch.dr6 |= dr6; kvm_queue_exception(vcpu, DB_VECTOR); *r = EMULATE_DONE; return true; } } return false; } ",0 "static void release_pte_pages(pte_t *pte, pte_t *_pte) { while (--_pte >= pte) { pte_t pteval = *_pte; if (!pte_none(pteval)) release_pte_page(pte_page(pteval)); } } ",0 "static unsigned LodePNGText_copy(LodePNGInfo* dest, const LodePNGInfo* source) { size_t i = 0; dest->text_keys = 0; dest->text_strings = 0; dest->text_num = 0; for(i = 0; i < source->text_num; i++) { CERROR_TRY_RETURN(lodepng_add_text(dest, source->text_keys[i], source->text_strings[i])); } return 0; } ",0 "static inline void unix_remove_socket(struct sock *sk) { spin_lock(&unix_table_lock); __unix_remove_socket(sk); spin_unlock(&unix_table_lock); } ",0 " void VarianceTest::ZeroTest() { for (int i = 0; i <= 255; ++i) { memset(src_, i, block_size_); for (int j = 0; j <= 255; ++j) { memset(ref_, j, block_size_); unsigned int sse; unsigned int var; REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse)); EXPECT_EQ(0u, var) << ""src values: "" << i << ""ref values: "" << j; } } } ",1 "void BubbleManager::CloseBubblesOwnedBy(const content::RenderFrameHost* frame) { CloseAllMatchingBubbles(nullptr, frame, BUBBLE_CLOSE_FRAME_DESTROYED); } ",0 "static int enable_large_pages(void) { #if defined(HAVE_GETPAGESIZES) && defined(HAVE_MEMCNTL) int ret = -1; size_t sizes[32]; int avail = getpagesizes(sizes, 32); if (avail != -1) { size_t max = sizes[0]; struct memcntl_mha arg = {0}; int ii; for (ii = 1; ii < avail; ++ii) { if (max < sizes[ii]) { max = sizes[ii]; } } arg.mha_flags = 0; arg.mha_pagesize = max; arg.mha_cmd = MHA_MAPSIZE_BSSBRK; if (memcntl(0, 0, MC_HAT_ADVISE, (caddr_t)&arg, 0, 0) == -1) { fprintf(stderr, ""Failed to set large pages: %s\n"", strerror(errno)); fprintf(stderr, ""Will use default page size\n""); } else { ret = 0; } } else { fprintf(stderr, ""Failed to get supported pagesizes: %s\n"", strerror(errno)); fprintf(stderr, ""Will use default page size\n""); } return ret; #else return -1; #endif } ",0 " MockWebMediaPlayer* MockMediaPlayer() { return media_player_; } ",0 "void X509_STORE_CTX_set_time(X509_STORE_CTX *ctx, unsigned long flags, time_t t) { X509_VERIFY_PARAM_set_time(ctx->param, t); } ",0 "void Browser::OnDidBlockFramebust(content::WebContents* web_contents, const GURL& url) { TabSpecificContentSettings* content_settings = TabSpecificContentSettings::FromWebContents(web_contents); DCHECK(content_settings); content_settings->OnFramebustBlocked( url, FramebustBlockTabHelper::ClickCallback()); } ",0 "static int vmx_set_hv_timer(struct kvm_vcpu *vcpu, u64 guest_deadline_tsc) { struct vcpu_vmx *vmx = to_vmx(vcpu); u64 tscl = rdtsc(); u64 guest_tscl = kvm_read_l1_tsc(vcpu, tscl); u64 delta_tsc = max(guest_deadline_tsc, guest_tscl) - guest_tscl; /* Convert to host delta tsc if tsc scaling is enabled */ if (vcpu->arch.tsc_scaling_ratio != kvm_default_tsc_scaling_ratio && u64_shl_div_u64(delta_tsc, kvm_tsc_scaling_ratio_frac_bits, vcpu->arch.tsc_scaling_ratio, &delta_tsc)) return -ERANGE; /* * If the delta tsc can't fit in the 32 bit after the multi shift, * we can't use the preemption timer. * It's possible that it fits on later vmentries, but checking * on every vmentry is costly so we just use an hrtimer. */ if (delta_tsc >> (cpu_preemption_timer_multi + 32)) return -ERANGE; vmx->hv_deadline_tsc = tscl + delta_tsc; vmcs_set_bits(PIN_BASED_VM_EXEC_CONTROL, PIN_BASED_VMX_PREEMPTION_TIMER); return 0; } ",0 "static int do_xfer(struct xfer_header *xfer) { int r = 0; if (xfer->use_replication) { /* Initial non-blocking sync */ r = xfer_initialsync(xfer); if (r) return r; } r = xfer_deactivate(xfer); if (!r) { if (xfer->use_replication) { /* Final sync with write locks on mailboxes */ r = xfer_finalsync(xfer); } else { r = xfer_localcreate(xfer); if (!r) r = xfer_undump(xfer); } } if (r) { /* Something failed, revert back to local server */ xfer_recover(xfer); return r; } /* Successful dump of all mailboxes to remote server. * Remove them locally and activate them on remote. * Note - we don't report errors if this fails! */ xfer_delete(xfer); xfer_reactivate(xfer); return 0; } ",0 "static Eina_Bool _ewk_view_smart_zoom_set(Ewk_View_Smart_Data* smartData, float zoom, Evas_Coord centerX, Evas_Coord centerY) { double px, py; Evas_Coord x, y, width, height; Eina_Bool result; ewk_frame_scroll_size_get(smartData->main_frame, &width, &height); ewk_frame_scroll_pos_get(smartData->main_frame, &x, &y); if (width + smartData->view.w > 0) px = static_cast(x + centerX) / (width + smartData->view.w); else px = 0.0; if (height + smartData->view.h > 0) py = static_cast(y + centerY) / (height + smartData->view.h); else py = 0.0; result = ewk_frame_page_zoom_set(smartData->main_frame, zoom); ewk_frame_scroll_size_get(smartData->main_frame, &width, &height); x = (width + smartData->view.w) * px - centerX; y = (height + smartData->view.h) * py - centerY; ewk_frame_scroll_set(smartData->main_frame, x, y); return result; } ",0 " void LocalFileSystem::fileSystemNotAvailable( PassRefPtrWillBeRawPtr context, PassRefPtr callbacks) { context->postTask(createCrossThreadTask(&reportFailure, callbacks->release(), FileError::ABORT_ERR)); } ",1 "GF_ISOFile *package_file(char *file_name, char *fcc, const char *tmpdir, Bool make_wgt) { fprintf(stderr, ""XML Not supported in this build of GPAC - cannot package file\n""); return NULL; } ",0 "session_by_pid(pid_t pid) { int i; debug(""session_by_pid: pid %ld"", (long)pid); for (i = 0; i < sessions_nalloc; i++) { Session *s = &sessions[i]; if (s->used && s->pid == pid) return s; } error(""session_by_pid: unknown pid %ld"", (long)pid); session_dump(); return NULL; } ",0 "std::string SecurityStyleToProtocolSecurityState( blink::WebSecurityStyle security_style) { switch (security_style) { case blink::kWebSecurityStyleUnknown: return Security::SecurityStateEnum::Unknown; case blink::kWebSecurityStyleNeutral: return Security::SecurityStateEnum::Neutral; case blink::kWebSecurityStyleInsecure: return Security::SecurityStateEnum::Insecure; case blink::kWebSecurityStyleSecure: return Security::SecurityStateEnum::Secure; default: NOTREACHED(); return Security::SecurityStateEnum::Unknown; } } ",0 " bool readNumberObject(v8::Handle* value) { double number; if (!doReadNumber(&number)) return false; *value = v8::NumberObject::New(isolate(), number); return true; } ",0 " static void Ins_RCVT( INS_ARG ) { int index; if ( BOUNDS( args[0], CUR.cvtSize ) ) { CUR.error = TT_Err_Invalid_Reference; return; } index=args[0]; args[0] = CUR_Func_read_cvt( index ); DBG_PRINT3("" cvt[%d]%d:%d"", index, CUR.cvt[index], args[0]); } ",0 "static void pmcraid_soft_reset(struct pmcraid_cmd *cmd) { struct pmcraid_instance *pinstance = cmd->drv_inst; u32 int_reg; u32 doorbell; /* There will be an interrupt when Transition to Operational bit is * set so tasklet would execute next reset task. The timeout handler * would re-initiate a reset */ cmd->cmd_done = pmcraid_ioa_reset; cmd->timer.data = (unsigned long)cmd; cmd->timer.expires = jiffies + msecs_to_jiffies(PMCRAID_TRANSOP_TIMEOUT); cmd->timer.function = (void (*)(unsigned long))pmcraid_timeout_handler; if (!timer_pending(&cmd->timer)) add_timer(&cmd->timer); /* Enable destructive diagnostics on IOA if it is not yet in * operational state */ doorbell = DOORBELL_RUNTIME_RESET | DOORBELL_ENABLE_DESTRUCTIVE_DIAGS; /* Since we do RESET_ALERT and Start BIST we have to again write * MSIX Doorbell to indicate the interrupt mode */ if (pinstance->interrupt_mode) { iowrite32(DOORBELL_INTR_MODE_MSIX, pinstance->int_regs.host_ioa_interrupt_reg); ioread32(pinstance->int_regs.host_ioa_interrupt_reg); } iowrite32(doorbell, pinstance->int_regs.host_ioa_interrupt_reg); ioread32(pinstance->int_regs.host_ioa_interrupt_reg), int_reg = ioread32(pinstance->int_regs.ioa_host_interrupt_reg); pmcraid_info(""Waiting for IOA to become operational %x:%x\n"", ioread32(pinstance->int_regs.host_ioa_interrupt_reg), int_reg); } ",0 "bool DesktopWindowTreeHostX11::IsKeyLocked(ui::DomCode dom_code) { return keyboard_hook_ && keyboard_hook_->IsKeyLocked(dom_code); } ",0 "static int spl_dllist_it_valid(zend_object_iterator *iter) /* {{{ */ { spl_dllist_it *iterator = (spl_dllist_it *)iter; spl_ptr_llist_element *element = iterator->traverse_pointer; return (element != NULL ? SUCCESS : FAILURE); } /* }}} */ ",0 "static void parse_from_existing(struct branch *b) { if (is_null_sha1(b->sha1)) { hashclr(b->branch_tree.versions[0].sha1); hashclr(b->branch_tree.versions[1].sha1); } else { unsigned long size; char *buf; buf = read_object_with_reference(b->sha1, commit_type, &size, b->sha1); parse_from_commit(b, buf, size); free(buf); } } ",0 "void WebView::startTrackingMouseLeave() { if (m_trackingMouseLeave) return; m_trackingMouseLeave = true; TRACKMOUSEEVENT trackMouseEvent; trackMouseEvent.cbSize = sizeof(TRACKMOUSEEVENT); trackMouseEvent.dwFlags = TME_LEAVE; trackMouseEvent.hwndTrack = m_window; ::TrackMouseEvent(&trackMouseEvent); } ",0 "void Browser::TabPinnedStateChanged(TabContentsWrapper* contents, int index) { SessionService* session_service = SessionServiceFactory::GetForProfileIfExisting(profile()); if (session_service) { session_service->SetPinnedState( session_id(), GetTabContentsWrapperAt(index)->restore_tab_helper()->session_id(), tab_handler_->GetTabStripModel()->IsTabPinned(index)); } } ",0 "void CrostiniUpgrader::RemoveObserver(CrostiniUpgraderUIObserver* observer) { upgrader_observers_.RemoveObserver(observer); } ",0 "GfxICCBasedColorSpace::~GfxICCBasedColorSpace() { delete alt; #ifdef USE_CMS if (transform != NULL) { if (transform->unref() == 0) delete transform; } if (lineTransform != NULL) { if (lineTransform->unref() == 0) delete lineTransform; } #endif } ",0 "void putname(struct filename *name) { if (unlikely(!audit_dummy_context())) return audit_putname(name); final_putname(name); } ",0 "void GLES2DecoderImpl::DoFinish() { glFinish(); ProcessPendingReadPixels(); ProcessPendingQueries(); } ",0 "WebProcessProxy::~WebProcessProxy() { if (m_webConnection) m_webConnection->invalidate(); } ",0 "static bool get_nic_from_line(char *p, char **nic) { char user[100], type[100], br[100]; int ret; ret = sscanf(p, ""%99[^ \t\n] %99[^ \t\n] %99[^ \t\n] %99[^ \t\n]"", user, type, br, *nic); if (ret != 4) return false; return true; } ",0 "INST_HANDLER (eor) { // EOR Rd, Rr int d = ((buf[0] >> 4) & 0xf) | ((buf[1] & 1) << 4); int r = (buf[0] & 0xf) | ((buf[1] & 2) << 3); ESIL_A (""r%d,r%d,^,"", r, d); // 0: Rd ^ Rr __generic_bitop_flags (op); // up flags ESIL_A (""r%d,=,"", d); // Rd = Result } ",0 "static int cbc_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { return glue_cbc_encrypt_128bit(GLUE_FUNC_CAST(__cast6_encrypt), desc, dst, src, nbytes); } ",0 "ResourceDispatcherHostImpl::CreateLoginDelegate( ResourceLoader* loader, net::AuthChallengeInfo* auth_info) { if (!delegate_) return NULL; return delegate_->CreateLoginDelegate(auth_info, loader->request()); } ",0 "R_API RBinFile *r_bin_file_find_by_object_id(RBin *bin, ut32 binobj_id) { RListIter *iter; RBinFile *binfile; r_list_foreach (bin->binfiles, iter, binfile) { if (r_bin_file_object_find_by_id (binfile, binobj_id)) { return binfile; } } return NULL; } ",0 "void *js_malloc(js_State *J, int size) { void *ptr = J->alloc(J->actx, NULL, size); if (!ptr) js_outofmemory(J); return ptr; } ",0 "FPDF_PAGE PDFiumEngine::Form_GetCurrentPage(FPDF_FORMFILLINFO* param, FPDF_DOCUMENT document) { PDFiumEngine* engine = static_cast(param); int index = engine->last_page_mouse_down_; if (index == -1) { index = engine->GetMostVisiblePage(); if (index == -1) { NOTREACHED(); return nullptr; } } return engine->pages_[index]->GetPage(); } ",0 "static void lsi_reselect(LSIState *s, lsi_request *p) { int id; assert(s->current == NULL); QTAILQ_REMOVE(&s->queue, p, next); s->current = p; id = (p->tag >> 8) & 0xf; s->ssid = id | 0x80; /* LSI53C700 Family Compatibility, see LSI53C895A 4-73 */ if (!(s->dcntl & LSI_DCNTL_COM)) { s->sfbr = 1 << (id & 0x7); } trace_lsi_reselect(id); s->scntl1 |= LSI_SCNTL1_CON; lsi_set_phase(s, PHASE_MI); s->msg_action = p->out ? LSI_MSG_ACTION_DOUT : LSI_MSG_ACTION_DIN; s->current->dma_len = p->pending; lsi_add_msg_byte(s, 0x80); if (s->current->tag & LSI_TAG_VALID) { lsi_add_msg_byte(s, 0x20); lsi_add_msg_byte(s, p->tag & 0xff); } if (lsi_irq_on_rsl(s)) { lsi_script_scsi_interrupt(s, LSI_SIST0_RSL, 0); } } ",0 "void FrameLoader::addExtraFieldsToMainResourceRequest(ResourceRequest& request) { addExtraFieldsToRequest(request, m_loadType, true, false); } ",0 "EncodedJSValue JSC_HOST_CALL JSDataViewConstructor::constructJSDataView(ExecState* exec) { if (exec->argument(0).isNull() || !exec->argument(0).isObject()) return throwVMTypeError(exec); RefPtr view = constructArrayBufferViewWithArrayBufferArgument(exec); if (!view.get()) { setDOMException(exec, INDEX_SIZE_ERR); return JSValue::encode(jsUndefined()); } JSDataViewConstructor* jsConstructor = jsCast(exec->callee()); return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), view.get()))); } ",0 "void ContainerNode::takeAllChildrenFrom(ContainerNode* oldParent) { NodeVector children; getChildNodes(oldParent, children); oldParent->removeAllChildren(); for (unsigned i = 0; i < children.size(); ++i) { ExceptionCode ec = 0; if (children[i]->attached()) children[i]->detach(); RefPtr child = document()->adoptNode(children[i].release(), ec); ASSERT(!ec); parserAddChild(child.get()); treeScope()->adoptIfNeeded(child.get()); if (attached() && !child->attached()) child->attach(); } } ",0 "bool GpuProcessHost::Send(IPC::Message* msg) { DCHECK(CalledOnValidThread()); if (process_->GetHost()->IsChannelOpening()) { queued_messages_.push(msg); return true; } return process_->Send(msg); } ",0 "static int __sha256_ssse3_update(struct shash_desc *desc, const u8 *data, unsigned int len, unsigned int partial) { struct sha256_state *sctx = shash_desc_ctx(desc); unsigned int done = 0; sctx->count += len; if (partial) { done = SHA256_BLOCK_SIZE - partial; memcpy(sctx->buf + partial, data, done); sha256_transform_asm(sctx->buf, sctx->state, 1); } if (len - done >= SHA256_BLOCK_SIZE) { const unsigned int rounds = (len - done) / SHA256_BLOCK_SIZE; sha256_transform_asm(data + done, sctx->state, (u64) rounds); done += rounds * SHA256_BLOCK_SIZE; } memcpy(sctx->buf, data + done, len - done); return 0; } ",0 "static void on_error_msg(nw_ses *ses, const char *msg) { log_error(""peer: %s: %s"", nw_sock_human_addr(&ses->peer_addr), msg); } ",0 "WORD32 ih264d_process_intra_mb(dec_struct_t * ps_dec, dec_mb_info_t * ps_cur_mb_info, UWORD8 u1_mb_num) { UWORD8 u1_mb_type = ps_cur_mb_info->u1_mb_type; UWORD8 uc_temp = ps_cur_mb_info->u1_mb_ngbr_availablity; UWORD8 u1_top_available = BOOLEAN(uc_temp & TOP_MB_AVAILABLE_MASK); UWORD8 u1_left_available = BOOLEAN(uc_temp & LEFT_MB_AVAILABLE_MASK); UWORD8 u1_use_top_right_mb = BOOLEAN(uc_temp & TOP_RIGHT_MB_AVAILABLE_MASK); UWORD8 u1_use_top_left_mb = BOOLEAN(uc_temp & TOP_LEFT_MB_AVAILABLE_MASK); UWORD8 uc_useTopMB = u1_top_available; UWORD16 u2_use_left_mb = u1_left_available; UWORD16 u2_use_left_mb_pack; UWORD8 *pu1_luma_pred_buffer; /* CHANGED CODE */ UWORD8 *pu1_luma_rec_buffer; UWORD8 *puc_top; mb_neigbour_params_t *ps_left_mb; mb_neigbour_params_t *ps_top_mb; mb_neigbour_params_t *ps_top_right_mb; mb_neigbour_params_t *ps_curmb; UWORD16 u2_mbx = ps_cur_mb_info->u2_mbx; UWORD32 ui_pred_width, ui_rec_width; WORD16 *pi2_y_coeff; UWORD8 u1_mbaff, u1_topmb, u1_mb_field_decoding_flag; UWORD32 u4_num_pmbair; UWORD16 ui2_luma_csbp = ps_cur_mb_info->u2_luma_csbp; UWORD8 *pu1_yleft, *pu1_ytop_left; /* Chroma variables*/ UWORD8 *pu1_top_u; UWORD8 *pu1_uleft; UWORD8 *pu1_u_top_left; /* CHANGED CODE */ UWORD8 *pu1_mb_cb_rei1_buffer, *pu1_mb_cr_rei1_buffer; UWORD32 u4_recwidth_cr; /* CHANGED CODE */ tfr_ctxt_t *ps_frame_buf = ps_dec->ps_frame_buf_ip_recon; UWORD32 u4_luma_dc_only_csbp = 0; UWORD32 u4_luma_dc_only_cbp = 0; UWORD8 *pu1_prev_intra4x4_pred_mode_data = (UWORD8 *)ps_dec->pv_proc_tu_coeff_data; //Pointer to keep track of intra4x4_pred_mode data in pv_proc_tu_coeff_data buffer u1_mbaff = ps_dec->ps_cur_slice->u1_mbaff_frame_flag; u1_topmb = ps_cur_mb_info->u1_topmb; u4_num_pmbair = (u1_mb_num >> u1_mbaff); /*--------------------------------------------------------------------*/ /* Find the current MB's mb params */ /*--------------------------------------------------------------------*/ u1_mb_field_decoding_flag = ps_cur_mb_info->u1_mb_field_decodingflag; ps_curmb = ps_cur_mb_info->ps_curmb; ps_top_mb = ps_cur_mb_info->ps_top_mb; ps_left_mb = ps_cur_mb_info->ps_left_mb; ps_top_right_mb = ps_cur_mb_info->ps_top_right_mb; /*--------------------------------------------------------------------*/ /* Check whether neighbouring MB is Inter MB and */ /* constrained intra pred is 1. */ /*--------------------------------------------------------------------*/ u2_use_left_mb_pack = (u2_use_left_mb << 8) + u2_use_left_mb; if(ps_dec->ps_cur_pps->u1_constrained_intra_pred_flag) { UWORD8 u1_left = (UWORD8)u2_use_left_mb; uc_useTopMB = uc_useTopMB && ((ps_top_mb->u1_mb_type != P_MB) && (ps_top_mb->u1_mb_type != B_MB)); u2_use_left_mb = u2_use_left_mb && ((ps_left_mb->u1_mb_type != P_MB) && (ps_left_mb->u1_mb_type != B_MB)); u2_use_left_mb_pack = (u2_use_left_mb << 8) + u2_use_left_mb; if(u1_mbaff) { if(u1_mb_field_decoding_flag ^ ps_left_mb->u1_mb_fld) { u1_left = u1_left && (((ps_left_mb + 1)->u1_mb_type != P_MB) && ((ps_left_mb + 1)->u1_mb_type != B_MB)); u2_use_left_mb = u2_use_left_mb && u1_left; if(u1_mb_field_decoding_flag) u2_use_left_mb_pack = (u1_left << 8) + (u2_use_left_mb_pack & 0xff); else u2_use_left_mb_pack = (u2_use_left_mb << 8) + (u2_use_left_mb); } } u1_use_top_right_mb = u1_use_top_right_mb && ((ps_top_right_mb->u1_mb_type != P_MB) && (ps_top_right_mb->u1_mb_type != B_MB)); u1_use_top_left_mb = u1_use_top_left_mb && ((ps_cur_mb_info->u1_topleft_mbtype != P_MB) && (ps_cur_mb_info->u1_topleft_mbtype != B_MB)); } /*********************Common pointer calculations *************************/ /* CHANGED CODE */ pu1_luma_pred_buffer = ps_dec->pu1_y; pu1_luma_rec_buffer = ps_frame_buf->pu1_dest_y + (u4_num_pmbair << 4); pu1_mb_cb_rei1_buffer = ps_frame_buf->pu1_dest_u + (u4_num_pmbair << 3) * YUV420SP_FACTOR; pu1_mb_cr_rei1_buffer = ps_frame_buf->pu1_dest_v + (u4_num_pmbair << 3); ui_pred_width = MB_SIZE; ui_rec_width = ps_dec->u2_frm_wd_y << u1_mb_field_decoding_flag; u4_recwidth_cr = ps_dec->u2_frm_wd_uv << u1_mb_field_decoding_flag; /************* Current and top luma pointer *****************/ if(u1_mbaff) { if(u1_topmb == 0) { pu1_luma_rec_buffer += ( u1_mb_field_decoding_flag ? (ui_rec_width >> 1) : (ui_rec_width << 4)); pu1_mb_cb_rei1_buffer += ( u1_mb_field_decoding_flag ? (u4_recwidth_cr >> 1) : (u4_recwidth_cr << 3)); pu1_mb_cr_rei1_buffer += ( u1_mb_field_decoding_flag ? (u4_recwidth_cr >> 1) : (u4_recwidth_cr << 3)); } } /* CHANGED CODE */ if(ps_dec->u4_use_intrapred_line_copy == 1) { puc_top = ps_dec->pu1_prev_y_intra_pred_line + (ps_cur_mb_info->u2_mbx << 4); pu1_top_u = ps_dec->pu1_prev_u_intra_pred_line + (ps_cur_mb_info->u2_mbx << 3) * YUV420SP_FACTOR; } else { puc_top = pu1_luma_rec_buffer - ui_rec_width; pu1_top_u = pu1_mb_cb_rei1_buffer - u4_recwidth_cr; } /* CHANGED CODE */ /************* Left pointer *****************/ pu1_yleft = pu1_luma_rec_buffer - 1; pu1_uleft = pu1_mb_cb_rei1_buffer - 1 * YUV420SP_FACTOR; /**************Top Left pointer calculation**********/ pu1_ytop_left = puc_top - 1; pu1_u_top_left = pu1_top_u - 1 * YUV420SP_FACTOR; /* CHANGED CODE */ PROFILE_DISABLE_INTRA_PRED() { pu1_prev_intra4x4_pred_mode_data = (UWORD8 *)ps_dec->pv_proc_tu_coeff_data; if(u1_mb_type == I_4x4_MB && ps_cur_mb_info->u1_tran_form8x8 == 0) { ps_dec->pv_proc_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_proc_tu_coeff_data + 32); } else if (u1_mb_type == I_4x4_MB && ps_cur_mb_info->u1_tran_form8x8 == 1) { ps_dec->pv_proc_tu_coeff_data = (void *)((UWORD8 *)ps_dec->pv_proc_tu_coeff_data + 8); } } if(!ps_cur_mb_info->u1_tran_form8x8) { u4_luma_dc_only_csbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec, ps_cur_mb_info, 1); } else { if(!ps_dec->ps_cur_pps->u1_entropy_coding_mode) { u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff4x4_mb(ps_dec, ps_cur_mb_info, 1); } else { u4_luma_dc_only_cbp = ih264d_unpack_luma_coeff8x8_mb(ps_dec, ps_cur_mb_info); } } pi2_y_coeff = ps_dec->pi2_coeff_data; if(u1_mb_type != I_4x4_MB) { UWORD8 u1_intrapred_mode = MB_TYPE_TO_INTRA_16x16_MODE(u1_mb_type); /*--------------------------------------------------------------------*/ /* 16x16 IntraPrediction */ /*--------------------------------------------------------------------*/ { UWORD8 u1_packed_modes = (u1_top_available << 1) + u1_left_available; UWORD8 u1_err_code = (u1_intrapred_mode & 1) ? u1_intrapred_mode : (u1_intrapred_mode ^ 2); if((u1_err_code & u1_packed_modes) ^ u1_err_code) { u1_intrapred_mode = 0; ps_dec->i4_error_code = ERROR_INTRAPRED; } } { UWORD8 au1_ngbr_pels[33]; /* Get neighbour pixels */ /* left pels */ if(u2_use_left_mb) { WORD32 i; for(i = 0; i < 16; i++) au1_ngbr_pels[16 - 1 - i] = pu1_yleft[i * ui_rec_width]; } else { memset(au1_ngbr_pels, 0, 16); } /* top left pels */ au1_ngbr_pels[16] = *pu1_ytop_left; /* top pels */ if(uc_useTopMB) { memcpy(au1_ngbr_pels + 16 + 1, puc_top, 16); } else { memset(au1_ngbr_pels + 16 + 1, 0, 16); } PROFILE_DISABLE_INTRA_PRED() ps_dec->apf_intra_pred_luma_16x16[u1_intrapred_mode]( au1_ngbr_pels, pu1_luma_rec_buffer, 1, ui_rec_width, ((uc_useTopMB << 2) | u2_use_left_mb)); } { UWORD32 i; WORD16 ai2_tmp[16]; for(i = 0; i < 16; i++) { WORD16 *pi2_level = pi2_y_coeff + (i << 4); UWORD8 *pu1_pred_sblk = pu1_luma_rec_buffer + ((i & 0x3) * BLK_SIZE) + (i >> 2) * (ui_rec_width << 2); PROFILE_DISABLE_IQ_IT_RECON() { if(CHECKBIT(ps_cur_mb_info->u2_luma_csbp, i)) { ps_dec->pf_iquant_itrans_recon_luma_4x4( pi2_level, pu1_pred_sblk, pu1_pred_sblk, ui_rec_width, ui_rec_width, gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6], (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[0], ps_cur_mb_info->u1_qp_div6, ai2_tmp, 1, pi2_level); } else if((CHECKBIT(u4_luma_dc_only_csbp, i)) && pi2_level[0] != 0) { ps_dec->pf_iquant_itrans_recon_luma_4x4_dc( pi2_level, pu1_pred_sblk, pu1_pred_sblk, ui_rec_width, ui_rec_width, gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6], (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[0], ps_cur_mb_info->u1_qp_div6, ai2_tmp, 1, pi2_level); } } } } } else if(!ps_cur_mb_info->u1_tran_form8x8) { UWORD8 u1_is_left_sub_block, u1_is_top_sub_block = uc_useTopMB; UWORD8 u1_sub_blk_x, u1_sub_blk_y, u1_sub_mb_num; WORD8 i1_top_pred_mode; WORD8 i1_left_pred_mode; UWORD8 *pu1_top, *pu1_left, *pu1_top_left, *pu1_top_right; WORD8 *pi1_cur_pred_mode, *pi1_left_pred_mode, *pc_topPredMode; UWORD16 ui2_left_pred_buf_width = 0xffff; WORD8 i1_intra_pred; UWORD8 *pu1_prev_intra4x4_pred_mode_flag = pu1_prev_intra4x4_pred_mode_data; UWORD8 *pu1_rem_intra4x4_pred_mode = pu1_prev_intra4x4_pred_mode_data + 16; WORD16 *pi2_y_coeff1; UWORD8 u1_cur_sub_block; UWORD16 ui2_top_rt_mask; /*--------------------------------------------------------------------*/ /* 4x4 IntraPrediction */ /*--------------------------------------------------------------------*/ /* Calculation of Top Right subblock mask */ /* */ /* (a) Set it to default mask */ /* [It has 0 for sublocks which will never have top-right sub block] */ /* */ /* (b) If top MB is not available */ /* Clear the bits of the first row sub blocks */ /* */ /* (c) Set/Clear bit for top-right sublock of MB */ /* [5 sub-block in decoding order] based on TOP RIGHT MB availablity */ /*--------------------------------------------------------------------*/ pu1_top = puc_top; ui2_top_rt_mask = (u1_use_top_right_mb << 3) | (0x5750); if(uc_useTopMB) ui2_top_rt_mask |= 0x7; /*Top Related initialisations*/ pi1_cur_pred_mode = ps_cur_mb_info->ps_curmb->pi1_intrapredmodes; pc_topPredMode = ps_cur_mb_info->ps_top_mb->pi1_intrapredmodes; /*-------------------------------------- if(u1_mbaff) { pi1_cur_pred_mode += (u2_mbx << 2); pc_topPredMode = pi1_cur_pred_mode + ps_cur_mb_info->i1_offset; pi1_cur_pred_mode += (u1_topmb) ? 0: 4; }*/ if(u1_top_available) { if(ps_top_mb->u1_mb_type == I_4x4_MB) *(WORD32*)pi1_cur_pred_mode = *(WORD32*)pc_topPredMode; else *(WORD32*)pi1_cur_pred_mode = (uc_useTopMB) ? DC_DC_DC_DC : NOT_VALID; } else *(WORD32*)pi1_cur_pred_mode = NOT_VALID; /* CHANGED CODE */ /* CHANGED CODE */ /*Left Related initialisations*/ pi1_left_pred_mode = ps_dec->pi1_left_pred_mode; if(!u1_mbaff) { if(u1_left_available) { if(ps_left_mb->u1_mb_type != I_4x4_MB) *(WORD32*)pi1_left_pred_mode = (u2_use_left_mb_pack) ? DC_DC_DC_DC : NOT_VALID; } else { *(WORD32*)pi1_left_pred_mode = NOT_VALID; } } else { UWORD8 u1_curMbfld = ps_cur_mb_info->u1_mb_field_decodingflag; UWORD8 u1_leftMbfld = ps_left_mb->u1_mb_fld; if(u1_curMbfld ^ u1_leftMbfld) { if(u1_topmb | ((u1_topmb == 0) && ((ps_curmb - 1)->u1_mb_type != I_4x4_MB))) { if(u1_left_available) { if(ps_left_mb->u1_mb_type != I_4x4_MB) { if(CHECKBIT(u2_use_left_mb_pack,0) == 0) *(WORD32*)pi1_left_pred_mode = NOT_VALID; else *(WORD32*)pi1_left_pred_mode = DC_DC_DC_DC; } } else *(WORD32*)pi1_left_pred_mode = NOT_VALID; if(u1_curMbfld) { if(u1_left_available) { if((ps_left_mb + 1)->u1_mb_type != I_4x4_MB) { if(u2_use_left_mb_pack >> 8) *(WORD32*)(pi1_left_pred_mode + 4) = DC_DC_DC_DC; else *(WORD32*)(pi1_left_pred_mode + 4) = NOT_VALID; } } else *(WORD32*)(pi1_left_pred_mode + 4) = NOT_VALID; pi1_left_pred_mode[1] = pi1_left_pred_mode[2]; pi1_left_pred_mode[2] = pi1_left_pred_mode[4]; pi1_left_pred_mode[3] = pi1_left_pred_mode[6]; *(WORD32*)(pi1_left_pred_mode + 4) = *(WORD32*)pi1_left_pred_mode; } else { pi1_left_pred_mode[7] = pi1_left_pred_mode[3]; pi1_left_pred_mode[6] = pi1_left_pred_mode[3]; pi1_left_pred_mode[5] = pi1_left_pred_mode[2]; pi1_left_pred_mode[4] = pi1_left_pred_mode[2]; pi1_left_pred_mode[3] = pi1_left_pred_mode[1]; pi1_left_pred_mode[2] = pi1_left_pred_mode[1]; pi1_left_pred_mode[1] = pi1_left_pred_mode[0]; } } pi1_left_pred_mode += (u1_topmb) ? 0 : 4; } else { pi1_left_pred_mode += (u1_topmb) ? 0 : 4; if(u1_left_available) { if(ps_left_mb->u1_mb_type != I_4x4_MB) *(WORD32*)pi1_left_pred_mode = (u2_use_left_mb_pack) ? DC_DC_DC_DC : NOT_VALID; } else *(WORD32*)pi1_left_pred_mode = NOT_VALID; } } /* One time pointer initialisations*/ pi2_y_coeff1 = pi2_y_coeff; pu1_top_left = pu1_ytop_left; /* Scan the sub-blocks in Raster Scan Order */ for(u1_sub_mb_num = 0; u1_sub_mb_num < 16; u1_sub_mb_num++) { UWORD8 au1_ngbr_pels[13]; u1_sub_blk_x = u1_sub_mb_num & 0x3; u1_sub_blk_y = u1_sub_mb_num >> 2; i1_top_pred_mode = pi1_cur_pred_mode[u1_sub_blk_x]; i1_left_pred_mode = pi1_left_pred_mode[u1_sub_blk_y]; u1_use_top_right_mb = (!!CHECKBIT(ui2_top_rt_mask, u1_sub_mb_num)); /*********** left subblock availability**********/ if(u1_sub_blk_x) u1_is_left_sub_block = 1; else u1_is_left_sub_block = (u1_sub_blk_y < 2) ? (CHECKBIT(u2_use_left_mb_pack, 0)) : (u2_use_left_mb_pack >> 8); /* CHANGED CODE */ if(u1_sub_blk_y) u1_is_top_sub_block = 1; /* CHANGED CODE */ /***************** Top *********************/ if(ps_dec->u4_use_intrapred_line_copy == 1) { if(u1_sub_blk_y) pu1_top = pu1_luma_rec_buffer - ui_rec_width; else pu1_top = puc_top + (u1_sub_blk_x << 2); } else { pu1_top = pu1_luma_rec_buffer - ui_rec_width; } /***************** Top Right *********************/ pu1_top_right = pu1_top + 4; /***************** Top Left *********************/ pu1_top_left = pu1_top - 1; /***************** Left *********************/ pu1_left = pu1_luma_rec_buffer - 1; /* CHANGED CODE */ /*---------------------------------------------------------------*/ /* Calculation of Intra prediction mode */ /*---------------------------------------------------------------*/ i1_intra_pred = ((i1_left_pred_mode < 0) | (i1_top_pred_mode < 0)) ? DC : MIN(i1_left_pred_mode, i1_top_pred_mode); { UWORD8 u1_packed_modes = (u1_is_top_sub_block << 1) + u1_is_left_sub_block; UWORD8 *pu1_intra_err_codes = (UWORD8 *)gau1_ih264d_intra_pred_err_code; UWORD8 uc_b2b0 = ((u1_sub_mb_num & 4) >> 1) | (u1_sub_mb_num & 1); UWORD8 uc_b3b1 = ((u1_sub_mb_num & 8) >> 2) | ((u1_sub_mb_num & 2) >> 1); u1_cur_sub_block = (uc_b3b1 << 2) + uc_b2b0; PROFILE_DISABLE_INTRA_PRED() if(!pu1_prev_intra4x4_pred_mode_flag[u1_cur_sub_block]) { i1_intra_pred = pu1_rem_intra4x4_pred_mode[u1_cur_sub_block] + (pu1_rem_intra4x4_pred_mode[u1_cur_sub_block] >= i1_intra_pred); } { UWORD8 u1_err_code = pu1_intra_err_codes[i1_intra_pred]; if((u1_err_code & u1_packed_modes) ^ u1_err_code) { i1_intra_pred = 0; ps_dec->i4_error_code = ERROR_INTRAPRED; } } } { /* Get neighbour pixels */ /* left pels */ if(u1_is_left_sub_block) { WORD32 i; for(i = 0; i < 4; i++) au1_ngbr_pels[4 - 1 - i] = pu1_left[i * ui_rec_width]; } else { memset(au1_ngbr_pels, 0, 4); } /* top left pels */ au1_ngbr_pels[4] = *pu1_top_left; /* top pels */ if(u1_is_top_sub_block) { memcpy(au1_ngbr_pels + 4 + 1, pu1_top, 4); } else { memset(au1_ngbr_pels + 4 + 1, 0, 4); } /* top right pels */ if(u1_use_top_right_mb) { memcpy(au1_ngbr_pels + 4 * 2 + 1, pu1_top_right, 4); } else if(u1_is_top_sub_block) { memset(au1_ngbr_pels + 4 * 2 + 1, au1_ngbr_pels[4 * 2], 4); } } PROFILE_DISABLE_INTRA_PRED() ps_dec->apf_intra_pred_luma_4x4[i1_intra_pred]( au1_ngbr_pels, pu1_luma_rec_buffer, 1, ui_rec_width, ((u1_is_top_sub_block << 2) | u1_is_left_sub_block)); /* CHANGED CODE */ if(CHECKBIT(ui2_luma_csbp, u1_sub_mb_num)) { WORD16 ai2_tmp[16]; PROFILE_DISABLE_IQ_IT_RECON() { if(CHECKBIT(u4_luma_dc_only_csbp, u1_sub_mb_num)) { ps_dec->pf_iquant_itrans_recon_luma_4x4_dc( pi2_y_coeff1, pu1_luma_rec_buffer, pu1_luma_rec_buffer, ui_rec_width, ui_rec_width, gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6], (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[0], ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0, NULL); } else { ps_dec->pf_iquant_itrans_recon_luma_4x4( pi2_y_coeff1, pu1_luma_rec_buffer, pu1_luma_rec_buffer, ui_rec_width, ui_rec_width, gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qp_rem6], (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[0], ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0, NULL); } } } /*---------------------------------------------------------------*/ /* Update sub block number */ /*---------------------------------------------------------------*/ pi2_y_coeff1 += 16; pu1_luma_rec_buffer += (u1_sub_blk_x == 3) ? (ui_rec_width << 2) - 12 : 4; pu1_luma_pred_buffer += (u1_sub_blk_x == 3) ? (ui_pred_width << 2) - 12 : 4; /* CHANGED CODE */ pi1_cur_pred_mode[u1_sub_blk_x] = i1_intra_pred; pi1_left_pred_mode[u1_sub_blk_y] = i1_intra_pred; } } else if((u1_mb_type == I_4x4_MB) && (ps_cur_mb_info->u1_tran_form8x8 == 1)) { UWORD8 u1_is_left_sub_block, u1_is_top_sub_block = uc_useTopMB; UWORD8 u1_sub_blk_x, u1_sub_blk_y, u1_sub_mb_num; WORD8 i1_top_pred_mode; WORD8 i1_left_pred_mode; UWORD8 *pu1_top, *pu1_left, *pu1_top_left; WORD8 *pi1_cur_pred_mode, *pi1_left_pred_mode, *pc_topPredMode; UWORD16 ui2_left_pred_buf_width = 0xffff; WORD8 i1_intra_pred; UWORD8 *pu1_prev_intra4x4_pred_mode_flag = pu1_prev_intra4x4_pred_mode_data; UWORD8 *pu1_rem_intra4x4_pred_mode = pu1_prev_intra4x4_pred_mode_data + 4; WORD16 *pi2_y_coeff1; UWORD16 ui2_top_rt_mask; UWORD32 u4_4x4_left_offset = 0; /*--------------------------------------------------------------------*/ /* 8x8 IntraPrediction */ /*--------------------------------------------------------------------*/ /* Calculation of Top Right subblock mask */ /* */ /* (a) Set it to default mask */ /* [It has 0 for sublocks which will never have top-right sub block] */ /* */ /* (b) If top MB is not available */ /* Clear the bits of the first row sub blocks */ /* */ /* (c) Set/Clear bit for top-right sublock of MB */ /* [5 sub-block in decoding order] based on TOP RIGHT MB availablity */ /* */ /* ui2_top_rt_mask: marks availibility of top right(neighbour) */ /* in the 8x8 Block ordering */ /* */ /* tr0 tr1 */ /* 0 1 tr3 */ /* 2 3 */ /* */ /* Top rights for 0 is in top MB */ /* top right of 1 will be in top right MB */ /* top right of 3 in right MB and hence not available */ /* This corresponds to ui2_top_rt_mask having default value 0x4 */ /*--------------------------------------------------------------------*/ ui2_top_rt_mask = (u1_use_top_right_mb << 1) | (0x4); if(uc_useTopMB) { ui2_top_rt_mask |= 0x1; } /* Top Related initialisations */ pi1_cur_pred_mode = ps_cur_mb_info->ps_curmb->pi1_intrapredmodes; pc_topPredMode = ps_cur_mb_info->ps_top_mb->pi1_intrapredmodes; /* if(u1_mbaff) { pi1_cur_pred_mode += (u2_mbx << 2); pc_topPredMode = pi1_cur_pred_mode + ps_cur_mb_info->i1_offset; pi1_cur_pred_mode += (u1_topmb) ? 0: 4; } */ if(u1_top_available) { if(ps_top_mb->u1_mb_type == I_4x4_MB) { *(WORD32*)pi1_cur_pred_mode = *(WORD32*)pc_topPredMode; } else { *(WORD32*)pi1_cur_pred_mode = (uc_useTopMB) ? DC_DC_DC_DC : NOT_VALID; } } else { *(WORD32*)pi1_cur_pred_mode = NOT_VALID; } pu1_top = puc_top - 8; /*Left Related initialisations*/ pi1_left_pred_mode = ps_dec->pi1_left_pred_mode; if(!u1_mbaff) { if(u1_left_available) { if(ps_left_mb->u1_mb_type != I_4x4_MB) { *(WORD32*)pi1_left_pred_mode = (u2_use_left_mb_pack) ? DC_DC_DC_DC : NOT_VALID; } } else { *(WORD32*)pi1_left_pred_mode = NOT_VALID; } } else { UWORD8 u1_curMbfld = ps_cur_mb_info->u1_mb_field_decodingflag; UWORD8 u1_leftMbfld = ps_left_mb->u1_mb_fld; if((!u1_curMbfld) && (u1_leftMbfld)) { u4_4x4_left_offset = 1; } if(u1_curMbfld ^ u1_leftMbfld) { if(u1_topmb | ((u1_topmb == 0) && ((ps_curmb - 1)->u1_mb_type != I_4x4_MB))) { if(u1_left_available) { if(ps_left_mb->u1_mb_type != I_4x4_MB) { if(CHECKBIT(u2_use_left_mb_pack,0) == 0) { *(WORD32*)pi1_left_pred_mode = NOT_VALID; } else { *(WORD32*)pi1_left_pred_mode = DC_DC_DC_DC; } } } else { *(WORD32*)pi1_left_pred_mode = NOT_VALID; } if(u1_curMbfld) { if(u1_left_available) { if((ps_left_mb + 1)->u1_mb_type != I_4x4_MB) { if(u2_use_left_mb_pack >> 8) { *(WORD32*)(pi1_left_pred_mode + 4) = DC_DC_DC_DC; } else { *(WORD32*)(pi1_left_pred_mode + 4) = NOT_VALID; } } } else { *(WORD32*)(pi1_left_pred_mode + 4) = NOT_VALID; } pi1_left_pred_mode[1] = pi1_left_pred_mode[2]; pi1_left_pred_mode[2] = pi1_left_pred_mode[4]; pi1_left_pred_mode[3] = pi1_left_pred_mode[6]; *(WORD32*)(pi1_left_pred_mode + 4) = *(WORD32*)pi1_left_pred_mode; } else { pi1_left_pred_mode[7] = pi1_left_pred_mode[3]; pi1_left_pred_mode[6] = pi1_left_pred_mode[3]; pi1_left_pred_mode[5] = pi1_left_pred_mode[2]; pi1_left_pred_mode[4] = pi1_left_pred_mode[2]; pi1_left_pred_mode[3] = pi1_left_pred_mode[1]; pi1_left_pred_mode[2] = pi1_left_pred_mode[1]; pi1_left_pred_mode[1] = pi1_left_pred_mode[0]; } } pi1_left_pred_mode += (u1_topmb) ? 0 : 4; } else { pi1_left_pred_mode += (u1_topmb) ? 0 : 4; if(u1_left_available) { if(ps_left_mb->u1_mb_type != I_4x4_MB) { *(WORD32*)pi1_left_pred_mode = (u2_use_left_mb_pack) ? DC_DC_DC_DC : NOT_VALID; } } else { *(WORD32*)pi1_left_pred_mode = NOT_VALID; } } } /* One time pointer initialisations*/ pi2_y_coeff1 = pi2_y_coeff; if(u1_use_top_left_mb) { pu1_top_left = pu1_ytop_left; } else { pu1_top_left = NULL; } /* Scan the sub-blocks in Raster Scan Order */ for(u1_sub_mb_num = 0; u1_sub_mb_num < 4; u1_sub_mb_num++) { u1_sub_blk_x = (u1_sub_mb_num & 0x1); u1_sub_blk_y = (u1_sub_mb_num >> 1); i1_top_pred_mode = pi1_cur_pred_mode[u1_sub_blk_x << 1]; i1_left_pred_mode = pi1_left_pred_mode[u1_sub_blk_y << 1]; if(2 == u1_sub_mb_num) { i1_left_pred_mode = pi1_left_pred_mode[(u1_sub_blk_y << 1) + u4_4x4_left_offset]; } u1_use_top_right_mb = (!!CHECKBIT(ui2_top_rt_mask, u1_sub_mb_num)); /*********** left subblock availability**********/ if(u1_sub_blk_x) { u1_is_left_sub_block = 1; } else { u1_is_left_sub_block = (u1_sub_blk_y < 1) ? (CHECKBIT(u2_use_left_mb_pack, 0)) : (u2_use_left_mb_pack >> 8); } /***************** Top *********************/ if(u1_sub_blk_y) { u1_is_top_sub_block = 1; pu1_top = /*pu1_luma_pred_buffer*/pu1_luma_rec_buffer - ui_rec_width; } else { pu1_top += 8; } /***************** Left *********************/ if((u1_sub_blk_x) | (u4_num_pmbair != 0)) { pu1_left = /*pu1_luma_pred_buffer*/pu1_luma_rec_buffer - 1; ui2_left_pred_buf_width = ui_rec_width; } else { pu1_left = pu1_yleft; pu1_yleft += (ui_rec_width << 3); ui2_left_pred_buf_width = ui_rec_width; } /***************** Top Left *********************/ if(u1_sub_mb_num) { pu1_top_left = (u1_sub_blk_x) ? pu1_top - 1 : pu1_left - ui_rec_width; if((u1_sub_blk_x && (!u1_is_top_sub_block)) || ((!u1_sub_blk_x) && (!u1_is_left_sub_block))) { pu1_top_left = NULL; } } /*---------------------------------------------------------------*/ /* Calculation of Intra prediction mode */ /*---------------------------------------------------------------*/ i1_intra_pred = ((i1_left_pred_mode < 0) | (i1_top_pred_mode < 0)) ? DC : MIN(i1_left_pred_mode, i1_top_pred_mode); { UWORD8 u1_packed_modes = (u1_is_top_sub_block << 1) + u1_is_left_sub_block; UWORD8 *pu1_intra_err_codes = (UWORD8 *)gau1_ih264d_intra_pred_err_code; /********************************************************************/ /* Same intra4x4_pred_mode array is filled with intra4x4_pred_mode */ /* for a MB with 8x8 intrapredicition */ /********************************************************************/ PROFILE_DISABLE_INTRA_PRED() if(!pu1_prev_intra4x4_pred_mode_flag[u1_sub_mb_num]) { i1_intra_pred = pu1_rem_intra4x4_pred_mode[u1_sub_mb_num] + (pu1_rem_intra4x4_pred_mode[u1_sub_mb_num] >= i1_intra_pred); } { UWORD8 u1_err_code = pu1_intra_err_codes[i1_intra_pred]; if((u1_err_code & u1_packed_modes) ^ u1_err_code) { i1_intra_pred = 0; ps_dec->i4_error_code = ERROR_INTRAPRED; } } } { UWORD8 au1_ngbr_pels[25]; WORD32 ngbr_avail; ngbr_avail = u1_is_left_sub_block << 0; ngbr_avail |= u1_is_top_sub_block << 2; if(pu1_top_left) ngbr_avail |= 1 << 1; ngbr_avail |= u1_use_top_right_mb << 3; PROFILE_DISABLE_INTRA_PRED() { ps_dec->pf_intra_pred_ref_filtering(pu1_left, pu1_top_left, pu1_top, au1_ngbr_pels, ui2_left_pred_buf_width, ngbr_avail); ps_dec->apf_intra_pred_luma_8x8[i1_intra_pred]( au1_ngbr_pels, pu1_luma_rec_buffer, 1, ui_rec_width, ((u1_is_top_sub_block << 2) | u1_is_left_sub_block)); } } /* Inverse Transform and Reconstruction */ if(CHECKBIT(ps_cur_mb_info->u1_cbp, u1_sub_mb_num)) { WORD16 *pi2_scale_matrix_ptr; WORD16 ai2_tmp[64]; pi2_scale_matrix_ptr = ps_dec->s_high_profile.i2_scalinglist8x8[0]; PROFILE_DISABLE_IQ_IT_RECON() { if(CHECKBIT(u4_luma_dc_only_cbp, u1_sub_mb_num)) { ps_dec->pf_iquant_itrans_recon_luma_8x8_dc( pi2_y_coeff1, pu1_luma_rec_buffer, pu1_luma_rec_buffer, ui_rec_width, ui_rec_width, gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6], (UWORD16 *)pi2_scale_matrix_ptr, ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0, NULL); } else { ps_dec->pf_iquant_itrans_recon_luma_8x8( pi2_y_coeff1, pu1_luma_rec_buffer, pu1_luma_rec_buffer, ui_rec_width, ui_rec_width, gau1_ih264d_dequant8x8_cavlc[ps_cur_mb_info->u1_qp_rem6], (UWORD16 *)pi2_scale_matrix_ptr, ps_cur_mb_info->u1_qp_div6, ai2_tmp, 0, NULL); } } } /*---------------------------------------------------------------*/ /* Update sub block number */ /*---------------------------------------------------------------*/ pi2_y_coeff1 += 64; pu1_luma_rec_buffer += (u1_sub_blk_x == 1) ? (ui_rec_width << 3) - (8 * 1) : 8; /*---------------------------------------------------------------*/ /* Pred mode filled in terms of 4x4 block so replicated in 2 */ /* locations. */ /*---------------------------------------------------------------*/ pi1_cur_pred_mode[u1_sub_blk_x << 1] = i1_intra_pred; pi1_cur_pred_mode[(u1_sub_blk_x << 1) + 1] = i1_intra_pred; pi1_left_pred_mode[u1_sub_blk_y << 1] = i1_intra_pred; pi1_left_pred_mode[(u1_sub_blk_y << 1) + 1] = i1_intra_pred; } } /* Decode Chroma Block */ ih264d_unpack_chroma_coeff4x4_mb(ps_dec, ps_cur_mb_info); /*--------------------------------------------------------------------*/ /* Chroma Blocks decoding */ /*--------------------------------------------------------------------*/ { UWORD8 u1_intra_chrom_pred_mode; UWORD8 u1_chroma_cbp = (UWORD8)(ps_cur_mb_info->u1_cbp >> 4); /*--------------------------------------------------------------------*/ /* Perform Chroma intra prediction */ /*--------------------------------------------------------------------*/ u1_intra_chrom_pred_mode = CHROMA_TO_LUMA_INTRA_MODE( ps_cur_mb_info->u1_chroma_pred_mode); { UWORD8 u1_packed_modes = (u1_top_available << 1) + u1_left_available; UWORD8 u1_err_code = (u1_intra_chrom_pred_mode & 1) ? u1_intra_chrom_pred_mode : (u1_intra_chrom_pred_mode ^ 2); if((u1_err_code & u1_packed_modes) ^ u1_err_code) { u1_intra_chrom_pred_mode = 0; ps_dec->i4_error_code = ERROR_INTRAPRED; } } /* CHANGED CODE */ if(u1_chroma_cbp != CBPC_ALLZERO) { UWORD16 u2_chroma_csbp = (u1_chroma_cbp == CBPC_ACZERO) ? 0 : ps_cur_mb_info->u2_chroma_csbp; UWORD32 u4_scale_u; UWORD32 u4_scale_v; { UWORD16 au2_ngbr_pels[33]; UWORD8 *pu1_ngbr_pels = (UWORD8 *)au2_ngbr_pels; UWORD16 *pu2_left_uv; UWORD16 *pu2_topleft_uv; WORD32 use_left1 = (u2_use_left_mb_pack & 0x0ff); WORD32 use_left2 = (u2_use_left_mb_pack & 0xff00) >> 8; pu2_left_uv = (UWORD16 *)pu1_uleft; pu2_topleft_uv = (UWORD16 *)pu1_u_top_left; /* Get neighbour pixels */ /* left pels */ if(u2_use_left_mb_pack) { WORD32 i; if(use_left1) { for(i = 0; i < 4; i++) au2_ngbr_pels[8 - 1 - i] = pu2_left_uv[i * u4_recwidth_cr / YUV420SP_FACTOR]; } else { memset(au2_ngbr_pels + 4, 0, 4 * sizeof(UWORD16)); } if(use_left2) { for(i = 4; i < 8; i++) au2_ngbr_pels[8 - 1 - i] = pu2_left_uv[i * u4_recwidth_cr / YUV420SP_FACTOR]; } else { memset(au2_ngbr_pels, 0, 4 * sizeof(UWORD16)); } } else { memset(au2_ngbr_pels, 0, 8 * sizeof(UWORD16)); } /* top left pels */ au2_ngbr_pels[8] = *pu2_topleft_uv; /* top pels */ if(uc_useTopMB) { memcpy(au2_ngbr_pels + 8 + 1, pu1_top_u, 8 * sizeof(UWORD16)); } else { memset(au2_ngbr_pels + 8 + 1, 0, 8 * sizeof(UWORD16)); } PROFILE_DISABLE_INTRA_PRED() ps_dec->apf_intra_pred_chroma[u1_intra_chrom_pred_mode]( pu1_ngbr_pels, pu1_mb_cb_rei1_buffer, 1, u4_recwidth_cr, ((uc_useTopMB << 2) | (use_left2 << 4) | use_left1)); } u4_scale_u = ps_cur_mb_info->u1_qpc_div6; u4_scale_v = ps_cur_mb_info->u1_qpcr_div6; pi2_y_coeff = ps_dec->pi2_coeff_data; { UWORD32 i; WORD16 ai2_tmp[16]; for(i = 0; i < 4; i++) { WORD16 *pi2_level = pi2_y_coeff + (i << 4); UWORD8 *pu1_pred_sblk = pu1_mb_cb_rei1_buffer + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) + (i >> 1) * (u4_recwidth_cr << 2); PROFILE_DISABLE_IQ_IT_RECON() { if(CHECKBIT(u2_chroma_csbp, i)) { ps_dec->pf_iquant_itrans_recon_chroma_4x4( pi2_level, pu1_pred_sblk, pu1_pred_sblk, u4_recwidth_cr, u4_recwidth_cr, gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6], (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[1], u4_scale_u, ai2_tmp, pi2_level); } else if(pi2_level[0] != 0) { ps_dec->pf_iquant_itrans_recon_chroma_4x4_dc( pi2_level, pu1_pred_sblk, pu1_pred_sblk, u4_recwidth_cr, u4_recwidth_cr, gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpc_rem6], (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[1], u4_scale_u, ai2_tmp, pi2_level); } } } } pi2_y_coeff += MB_CHROM_SIZE; u2_chroma_csbp = u2_chroma_csbp >> 4; { UWORD32 i; WORD16 ai2_tmp[16]; for(i = 0; i < 4; i++) { WORD16 *pi2_level = pi2_y_coeff + (i << 4); UWORD8 *pu1_pred_sblk = pu1_mb_cb_rei1_buffer + 1 + ((i & 0x1) * BLK_SIZE * YUV420SP_FACTOR) + (i >> 1) * (u4_recwidth_cr << 2); PROFILE_DISABLE_IQ_IT_RECON() { if(CHECKBIT(u2_chroma_csbp, i)) { ps_dec->pf_iquant_itrans_recon_chroma_4x4( pi2_level, pu1_pred_sblk, pu1_pred_sblk, u4_recwidth_cr, u4_recwidth_cr, gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6], (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[2], u4_scale_v, ai2_tmp, pi2_level); } else if(pi2_level[0] != 0) { ps_dec->pf_iquant_itrans_recon_chroma_4x4_dc( pi2_level, pu1_pred_sblk, pu1_pred_sblk, u4_recwidth_cr, u4_recwidth_cr, gau2_ih264_iquant_scale_4x4[ps_cur_mb_info->u1_qpcr_rem6], (UWORD16 *)ps_dec->s_high_profile.i2_scalinglist4x4[2], u4_scale_v, ai2_tmp, pi2_level); } } } } } else { /* If no inverse transform is needed, pass recon buffer pointer */ /* to Intraprediction module instead of pred buffer pointer */ { UWORD16 au2_ngbr_pels[33]; UWORD8 *pu1_ngbr_pels = (UWORD8 *)au2_ngbr_pels; UWORD16 *pu2_left_uv; UWORD16 *pu2_topleft_uv; WORD32 use_left1 = (u2_use_left_mb_pack & 0x0ff); WORD32 use_left2 = (u2_use_left_mb_pack & 0xff00) >> 8; pu2_topleft_uv = (UWORD16 *)pu1_u_top_left; pu2_left_uv = (UWORD16 *)pu1_uleft; /* Get neighbour pixels */ /* left pels */ if(u2_use_left_mb_pack) { WORD32 i; if(use_left1) { for(i = 0; i < 4; i++) au2_ngbr_pels[8 - 1 - i] = pu2_left_uv[i * u4_recwidth_cr / YUV420SP_FACTOR]; } else { memset(au2_ngbr_pels + 4, 0, 4 * sizeof(UWORD16)); } if(use_left2) { for(i = 4; i < 8; i++) au2_ngbr_pels[8 - 1 - i] = pu2_left_uv[i * u4_recwidth_cr / YUV420SP_FACTOR]; } else { memset(au2_ngbr_pels, 0, 4 * sizeof(UWORD16)); } } else { memset(au2_ngbr_pels, 0, 8 * sizeof(UWORD16)); } /* top left pels */ au2_ngbr_pels[8] = *pu2_topleft_uv; /* top pels */ if(uc_useTopMB) { memcpy(au2_ngbr_pels + 8 + 1, pu1_top_u, 8 * sizeof(UWORD16)); } else { memset(au2_ngbr_pels + 8 + 1, 0, 8 * sizeof(UWORD16)); } PROFILE_DISABLE_INTRA_PRED() ps_dec->apf_intra_pred_chroma[u1_intra_chrom_pred_mode]( pu1_ngbr_pels, pu1_mb_cb_rei1_buffer, 1, u4_recwidth_cr, ((uc_useTopMB << 2) | (use_left2 << 4) | use_left1)); } } } return OK; } ",1 "static inline int virtio_scsi_get_lun(uint8_t *lun) { return ((lun[2] << 8) | lun[3]) & 0x3FFF; } ",0 "void FrameView::setScrollPosition(const IntPoint& scrollPoint, ScrollBehavior scrollBehavior) { cancelProgrammaticScrollAnimation(); TemporaryChange changeInProgrammaticScroll(m_inProgrammaticScroll, true); m_maintainScrollPositionAnchor = nullptr; IntPoint newScrollPosition = adjustScrollPositionWithinRange(scrollPoint); if (newScrollPosition == scrollPosition()) return; if (scrollBehavior == ScrollBehaviorAuto) { RenderObject* renderer = m_frame->document()->documentElement() ? m_frame->document()->documentElement()->renderer() : 0; if (renderer) scrollBehavior = renderer->style()->scrollBehavior(); else scrollBehavior = ScrollBehaviorInstant; } ScrollView::setScrollPosition(newScrollPosition, scrollBehavior); } ",0 "process_rename(u_int32_t id) { char *oldpath, *newpath; int r, status; struct stat sb; if ((r = sshbuf_get_cstring(iqueue, &oldpath, NULL)) != 0 || (r = sshbuf_get_cstring(iqueue, &newpath, NULL)) != 0) fatal(""%s: buffer error: %s"", __func__, ssh_err(r)); debug3(""request %u: rename"", id); logit(""rename old \""%s\"" new \""%s\"""", oldpath, newpath); status = SSH2_FX_FAILURE; if (lstat(oldpath, &sb) == -1) status = errno_to_portable(errno); else if (S_ISREG(sb.st_mode)) { /* Race-free rename of regular files */ if (link(oldpath, newpath) == -1) { if (errno == EOPNOTSUPP) { struct stat st; /* * fs doesn't support links, so fall back to * stat+rename. This is racy. */ if (stat(newpath, &st) == -1) { if (rename(oldpath, newpath) == -1) status = errno_to_portable(errno); else status = SSH2_FX_OK; } } else { status = errno_to_portable(errno); } } else if (unlink(oldpath) == -1) { status = errno_to_portable(errno); /* clean spare link */ unlink(newpath); } else status = SSH2_FX_OK; } else if (stat(newpath, &sb) == -1) { if (rename(oldpath, newpath) == -1) status = errno_to_portable(errno); else status = SSH2_FX_OK; } send_status(id, status); free(oldpath); free(newpath); } ",0 "void BrowserView::ShowCreateChromeAppShortcutsDialog( Profile* profile, const extensions::Extension* app) { chrome::ShowCreateChromeAppShortcutsDialog(GetNativeWindow(), profile, app); } ",0 "ImageTransportFactoryAndroid* ImageTransportFactoryAndroid::GetInstance() { if (!g_factory) { if (CompositorImpl::UsesDirectGL()) g_factory = new DirectGLImageTransportFactory(); else g_factory = new CmdBufferImageTransportFactory(); } return g_factory; } ",0 "void GranularityStrategyTest::SetupVerticalAlign(String str1, String str2, String str3, size_t sel_begin, size_t sel_end) { SetInnerHTML( """" """" """" """" """" ""
"" """" """"); SetupTextSpan(str1, str2, str3, sel_begin, sel_end); } ",0 " void SetHovered(bool is_mouse_hovered) { MoveMouse(0, is_mouse_hovered ? 10 : top_container_->height() + 100); } ",0 "int JBIG2Stream::lookChar() { if (dataPtr && dataPtr < dataEnd) { return (*dataPtr ^ 0xff) & 0xff; } return EOF; } ",0 "static uint64_t generatePageID() { static uint64_t uniquePageID = 1; return uniquePageID++; } ",0 "static inline void FixupUsername(const std::string& text, const url_parse::Component& part, std::string* url) { if (!part.is_valid()) return; url->append(text, part.begin, part.len); } ",0 "void GetWebRTCSessionDescriptionFromSessionDescriptionCallback( base::OnceCallback description_callback, blink::WebRTCSessionDescription* web_description) { const webrtc::SessionDescriptionInterface* description = std::move(description_callback).Run(); if (description) { std::string sdp; description->ToString(&sdp); web_description->Initialize(blink::WebString::FromUTF8(description->type()), blink::WebString::FromUTF8(sdp)); } } ",0 "static int reds_set_migration_dest_info(const char* dest, int port, int secure_port, const char* cert_subject) { RedsMigSpice *spice_migration = NULL; reds_mig_release(); if ((port == -1 && secure_port == -1) || !dest) { return FALSE; } spice_migration = spice_new0(RedsMigSpice, 1); spice_migration->port = port; spice_migration->sport = secure_port; spice_migration->host = spice_strdup(dest); if (cert_subject) { spice_migration->cert_subject = spice_strdup(cert_subject); } reds->mig_spice = spice_migration; return TRUE; } ",0 "static void tsc_khz_changed(void *data) { struct cpufreq_freqs *freq = data; unsigned long khz = 0; if (data) khz = freq->new; else if (!boot_cpu_has(X86_FEATURE_CONSTANT_TSC)) khz = cpufreq_quick_get(raw_smp_processor_id()); if (!khz) khz = tsc_khz; __this_cpu_write(cpu_tsc_khz, khz); } ",0 "ilinear(int fixed_srgb) { return u16d(65535 * sRGB_to_d[fixed_srgb]); } ",0 "static v8::Handle V8TestNamedConstructorConstructorCallback(const v8::Arguments& args) { INC_STATS(""DOM.TestNamedConstructor.Constructor""); if (!args.IsConstructCall()) return V8Proxy::throwTypeError(""DOM object constructor cannot be called as a function.""); if (ConstructorMode::current() == ConstructorMode::WrapExistingObject) return args.Holder(); Frame* frame = V8Proxy::retrieveFrameForCurrentContext(); if (!frame) return V8Proxy::throwError(V8Proxy::ReferenceError, ""TestNamedConstructor constructor associated frame is unavailable"", args.GetIsolate()); Document* document = frame->document(); toV8(document, args.GetIsolate()); if (args.Length() < 1) return V8Proxy::throwNotEnoughArgumentsError(); ExceptionCode ec = 0; STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str1, MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str2, MAYBE_MISSING_PARAMETER(args, 1, DefaultIsUndefined)); STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, str3, MAYBE_MISSING_PARAMETER(args, 2, DefaultIsNullString)); RefPtr impl = TestNamedConstructor::createForJSConstructor(document, str1, str2, str3, ec); v8::Handle wrapper = args.Holder(); if (ec) goto fail; V8DOMWrapper::setDOMWrapper(wrapper, &V8TestNamedConstructorConstructor::info, impl.get()); V8DOMWrapper::setJSWrapperForActiveDOMObject(impl.release(), v8::Persistent::New(wrapper), args.GetIsolate()); return args.Holder(); fail: return throwError(ec, args.GetIsolate()); } ",1 "static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt) { struct sctp_sock *sp = sctp_sk(sk); struct sctp_endpoint *ep = sp->ep; int cnt; struct sctp_bind_addr *bp = &ep->base.bind_addr; int retval = 0; void *addr_buf; union sctp_addr *sa_addr; struct sctp_af *af; SCTP_DEBUG_PRINTK(""sctp_bindx_rem (sk: %p, addrs: %p, addrcnt: %d)\n"", sk, addrs, addrcnt); addr_buf = addrs; for (cnt = 0; cnt < addrcnt; cnt++) { /* If the bind address list is empty or if there is only one * bind address, there is nothing more to be removed (we need * at least one address here). */ if (list_empty(&bp->address_list) || (sctp_list_single_entry(&bp->address_list))) { retval = -EBUSY; goto err_bindx_rem; } sa_addr = addr_buf; af = sctp_get_af_specific(sa_addr->sa.sa_family); if (!af) { retval = -EINVAL; goto err_bindx_rem; } if (!af->addr_valid(sa_addr, sp, NULL)) { retval = -EADDRNOTAVAIL; goto err_bindx_rem; } if (sa_addr->v4.sin_port && sa_addr->v4.sin_port != htons(bp->port)) { retval = -EINVAL; goto err_bindx_rem; } if (!sa_addr->v4.sin_port) sa_addr->v4.sin_port = htons(bp->port); /* FIXME - There is probably a need to check if sk->sk_saddr and * sk->sk_rcv_addr are currently set to one of the addresses to * be removed. This is something which needs to be looked into * when we are fixing the outstanding issues with multi-homing * socket routing and failover schemes. Refer to comments in * sctp_do_bind(). -daisy */ retval = sctp_del_bind_addr(bp, sa_addr); addr_buf += af->sockaddr_len; err_bindx_rem: if (retval < 0) { /* Failed. Add the ones that has been removed back */ if (cnt > 0) sctp_bindx_add(sk, addrs, cnt); return retval; } } return retval; } ",0 "static inline void hub_usb3_port_prepare_disable(struct usb_hub *hub, struct usb_port *port_dev) { } ",0 "const GURL& DownloadItemImpl::GetTabReferrerUrl() const { return request_info_.tab_referrer_url; } ",0 "static int ipv4_sysctl_rtcache_flush(ctl_table *__ctl, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { if (write) { int flush_delay; ctl_table ctl; struct net *net; memcpy(&ctl, __ctl, sizeof(ctl)); ctl.data = &flush_delay; proc_dointvec(&ctl, write, buffer, lenp, ppos); net = (struct net *)__ctl->extra1; rt_cache_flush(net, flush_delay); return 0; } return -EINVAL; } ",0 "void OffscreenCanvas::PushFrame(scoped_refptr canvas_resource, const SkIRect& damage_rect) { DCHECK(needs_push_frame_); needs_push_frame_ = false; current_frame_damage_rect_.join(damage_rect); if (current_frame_damage_rect_.isEmpty() || !canvas_resource) return; const base::TimeTicks commit_start_time = WTF::CurrentTimeTicks(); GetOrCreateResourceDispatcher()->DispatchFrame( std::move(canvas_resource), commit_start_time, current_frame_damage_rect_, !RenderingContext()->IsOriginTopLeft() /* needs_vertical_flip */, IsOpaque()); current_frame_damage_rect_ = SkIRect::MakeEmpty(); } ",0 "bool AutofillManager::IsFormNonSecure(const FormData& form) const { return !client_->IsContextSecure() || (form.action.is_valid() && form.action.SchemeIs(""http"")); } ",0 "static int ssl_parse_hello_verify_request( mbedtls_ssl_context *ssl ) { const unsigned char *p = ssl->in_msg + mbedtls_ssl_hs_hdr_len( ssl ); int major_ver, minor_ver; unsigned char cookie_len; MBEDTLS_SSL_DEBUG_MSG( 2, ( ""=> parse hello verify request"" ) ); /* * struct { * ProtocolVersion server_version; * opaque cookie<0..2^8-1>; * } HelloVerifyRequest; */ MBEDTLS_SSL_DEBUG_BUF( 3, ""server version"", p, 2 ); mbedtls_ssl_read_version( &major_ver, &minor_ver, ssl->conf->transport, p ); p += 2; /* * Since the RFC is not clear on this point, accept DTLS 1.0 (TLS 1.1) * even is lower than our min version. */ if( major_ver < MBEDTLS_SSL_MAJOR_VERSION_3 || minor_ver < MBEDTLS_SSL_MINOR_VERSION_2 || major_ver > ssl->conf->max_major_ver || minor_ver > ssl->conf->max_minor_ver ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( ""bad server version"" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_PROTOCOL_VERSION ); return( MBEDTLS_ERR_SSL_BAD_HS_PROTOCOL_VERSION ); } cookie_len = *p++; MBEDTLS_SSL_DEBUG_BUF( 3, ""cookie"", p, cookie_len ); if( ( ssl->in_msg + ssl->in_msglen ) - p < cookie_len ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( ""cookie length does not match incoming message size"" ) ); mbedtls_ssl_send_alert_message( ssl, MBEDTLS_SSL_ALERT_LEVEL_FATAL, MBEDTLS_SSL_ALERT_MSG_DECODE_ERROR ); return( MBEDTLS_ERR_SSL_BAD_HS_SERVER_HELLO ); } mbedtls_free( ssl->handshake->verify_cookie ); ssl->handshake->verify_cookie = mbedtls_calloc( 1, cookie_len ); if( ssl->handshake->verify_cookie == NULL ) { MBEDTLS_SSL_DEBUG_MSG( 1, ( ""alloc failed (%d bytes)"", cookie_len ) ); return( MBEDTLS_ERR_SSL_ALLOC_FAILED ); } memcpy( ssl->handshake->verify_cookie, p, cookie_len ); ssl->handshake->verify_cookie_len = cookie_len; /* Start over at ClientHello */ ssl->state = MBEDTLS_SSL_CLIENT_HELLO; mbedtls_ssl_reset_checksum( ssl ); mbedtls_ssl_recv_flight_completed( ssl ); MBEDTLS_SSL_DEBUG_MSG( 2, ( ""<= parse hello verify request"" ) ); return( 0 ); } ",0 "void Document::StyleResolverMayHaveChanged() { if (HasNodesWithPlaceholderStyle()) { SetNeedsStyleRecalc(kSubtreeStyleChange, StyleChangeReasonForTracing::Create( style_change_reason::kCleanupPlaceholderStyles)); } if (DidLayoutWithPendingStylesheets() && HaveRenderBlockingResourcesLoaded()) { pending_sheet_layout_ = kIgnoreLayoutWithPendingSheets; DCHECK(GetLayoutView() || ImportsController()); if (GetLayoutView()) GetLayoutView()->InvalidatePaintForViewAndCompositedLayers(); } } ",0 "_PUBLIC_ size_t strlen_m_ext_term(const char *s, const charset_t src_charset, const charset_t dst_charset) { if (!s) { return 0; } return strlen_m_ext(s, src_charset, dst_charset) + 1; } ",0 "static bool handle_client_startup(PgSocket *client, PktHdr *pkt) { const char *passwd; const uint8_t *key; bool ok; SBuf *sbuf = &client->sbuf; /* don't tolerate partial packets */ if (incomplete_pkt(pkt)) { disconnect_client(client, true, ""client sent partial pkt in startup phase""); return false; } if (client->wait_for_welcome) { if (finish_client_login(client)) { /* the packet was already parsed */ sbuf_prepare_skip(sbuf, pkt->len); return true; } else return false; } switch (pkt->type) { case PKT_SSLREQ: slog_noise(client, ""C: req SSL""); slog_noise(client, ""P: nak""); /* reject SSL attempt */ if (!sbuf_answer(&client->sbuf, ""N"", 1)) { disconnect_client(client, false, ""failed to nak SSL""); return false; } break; case PKT_STARTUP_V2: disconnect_client(client, true, ""Old V2 protocol not supported""); return false; case PKT_STARTUP: if (client->pool && !client->wait_for_user_conn && !client->wait_for_user) { disconnect_client(client, true, ""client re-sent startup pkt""); return false; } if (client->wait_for_user) { client->wait_for_user = false; if (!finish_set_pool(client, false)) return false; } else if (!decide_startup_pool(client, pkt)) { return false; } break; case 'p': /* PasswordMessage */ /* haven't requested it */ if (cf_auth_type <= AUTH_TRUST) { disconnect_client(client, true, ""unrequested passwd pkt""); return false; } ok = mbuf_get_string(&pkt->data, &passwd); if (ok && check_client_passwd(client, passwd)) { if (!finish_client_login(client)) return false; } else { disconnect_client(client, true, ""Auth failed""); return false; } break; case PKT_CANCEL: if (mbuf_avail_for_read(&pkt->data) == BACKENDKEY_LEN && mbuf_get_bytes(&pkt->data, BACKENDKEY_LEN, &key)) { memcpy(client->cancel_key, key, BACKENDKEY_LEN); accept_cancel_request(client); } else disconnect_client(client, false, ""bad cancel request""); return false; default: disconnect_client(client, false, ""bad packet""); return false; } sbuf_prepare_skip(sbuf, pkt->len); client->request_time = get_cached_time(); return true; } ",0 "INST_HANDLER (st) { // ST X, Rr ESIL_A (""r%d,"", ((buf[1] & 1) << 4) | ((buf[0] >> 4) & 0xf)); __generic_ld_st ( op, ""ram"", 'x', // use index register X 0, // no use RAMP* registers (buf[0] & 0xf) == 0xe ? -1 // pre decremented : (buf[0] & 0xf) == 0xd ? 1 // post increment : 0, // no increment 0, // offset always 0 1); // store operation (st) } ",0 "WebContents* WebContents::FromRenderViewHost(RenderViewHost* rvh) { if (!rvh) return nullptr; return rvh->GetDelegate()->GetAsWebContents(); } ",0 "Response NetworkHandler::SetExtraHTTPHeaders( std::unique_ptr headers) { std::vector> new_headers; std::unique_ptr object = headers->toValue(); for (size_t i = 0; i < object->size(); ++i) { auto entry = object->at(i); std::string value; if (!entry.second->asString(&value)) return Response::InvalidParams(""Invalid header value, string expected""); if (!net::HttpUtil::IsValidHeaderName(entry.first)) return Response::InvalidParams(""Invalid header name""); if (!net::HttpUtil::IsValidHeaderValue(value)) return Response::InvalidParams(""Invalid header value""); new_headers.emplace_back(entry.first, value); } extra_headers_.swap(new_headers); return Response::FallThrough(); } ",0 "static int userfaultfd_zeropage(struct userfaultfd_ctx *ctx, unsigned long arg) { __s64 ret; struct uffdio_zeropage uffdio_zeropage; struct uffdio_zeropage __user *user_uffdio_zeropage; struct userfaultfd_wake_range range; user_uffdio_zeropage = (struct uffdio_zeropage __user *) arg; ret = -EAGAIN; if (READ_ONCE(ctx->mmap_changing)) goto out; ret = -EFAULT; if (copy_from_user(&uffdio_zeropage, user_uffdio_zeropage, /* don't copy ""zeropage"" last field */ sizeof(uffdio_zeropage)-sizeof(__s64))) goto out; ret = validate_range(ctx->mm, uffdio_zeropage.range.start, uffdio_zeropage.range.len); if (ret) goto out; ret = -EINVAL; if (uffdio_zeropage.mode & ~UFFDIO_ZEROPAGE_MODE_DONTWAKE) goto out; if (mmget_not_zero(ctx->mm)) { ret = mfill_zeropage(ctx->mm, uffdio_zeropage.range.start, uffdio_zeropage.range.len, &ctx->mmap_changing); mmput(ctx->mm); } else { return -ESRCH; } if (unlikely(put_user(ret, &user_uffdio_zeropage->zeropage))) return -EFAULT; if (ret < 0) goto out; /* len == 0 would wake all */ BUG_ON(!ret); range.len = ret; if (!(uffdio_zeropage.mode & UFFDIO_ZEROPAGE_MODE_DONTWAKE)) { range.start = uffdio_zeropage.range.start; wake_userfault(ctx, &range); } ret = range.len == uffdio_zeropage.range.len ? 0 : -EAGAIN; out: return ret; } ",0 "PHP_FUNCTION(pg_escape_literal) { php_pgsql_escape_internal(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); } ",0 "_zip_cdir_write(zip_t *za, const zip_filelist_t *filelist, zip_uint64_t survivors) { zip_uint64_t offset, size; zip_string_t *comment; zip_uint8_t buf[EOCDLEN + EOCD64LEN + EOCD64LOCLEN]; zip_buffer_t *buffer; zip_int64_t off; zip_uint64_t i; bool is_zip64; int ret; if ((off = zip_source_tell_write(za->src)) < 0) { _zip_error_set_from_source(&za->error, za->src); return -1; } offset = (zip_uint64_t)off; is_zip64 = false; for (i=0; ientry+filelist[i].idx; if ((ret=_zip_dirent_write(za, entry->changes ? entry->changes : entry->orig, ZIP_FL_CENTRAL)) < 0) return -1; if (ret) is_zip64 = true; } if ((off = zip_source_tell_write(za->src)) < 0) { _zip_error_set_from_source(&za->error, za->src); return -1; } size = (zip_uint64_t)off - offset; if (offset > ZIP_UINT32_MAX || survivors > ZIP_UINT16_MAX) is_zip64 = true; if ((buffer = _zip_buffer_new(buf, sizeof(buf))) == NULL) { zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return -1; } if (is_zip64) { _zip_buffer_put(buffer, EOCD64_MAGIC, 4); _zip_buffer_put_64(buffer, EOCD64LEN-12); _zip_buffer_put_16(buffer, 45); _zip_buffer_put_16(buffer, 45); _zip_buffer_put_32(buffer, 0); _zip_buffer_put_32(buffer, 0); _zip_buffer_put_64(buffer, survivors); _zip_buffer_put_64(buffer, survivors); _zip_buffer_put_64(buffer, size); _zip_buffer_put_64(buffer, offset); _zip_buffer_put(buffer, EOCD64LOC_MAGIC, 4); _zip_buffer_put_32(buffer, 0); _zip_buffer_put_64(buffer, offset+size); _zip_buffer_put_32(buffer, 1); } _zip_buffer_put(buffer, EOCD_MAGIC, 4); _zip_buffer_put_32(buffer, 0); _zip_buffer_put_16(buffer, (zip_uint16_t)(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : survivors)); _zip_buffer_put_16(buffer, (zip_uint16_t)(survivors >= ZIP_UINT16_MAX ? ZIP_UINT16_MAX : survivors)); _zip_buffer_put_32(buffer, size >= ZIP_UINT32_MAX ? ZIP_UINT32_MAX : (zip_uint32_t)size); _zip_buffer_put_32(buffer, offset >= ZIP_UINT32_MAX ? ZIP_UINT32_MAX : (zip_uint32_t)offset); comment = za->comment_changed ? za->comment_changes : za->comment_orig; _zip_buffer_put_16(buffer, (zip_uint16_t)(comment ? comment->length : 0)); if (!_zip_buffer_ok(buffer)) { zip_error_set(&za->error, ZIP_ER_INTERNAL, 0); _zip_buffer_free(buffer); return -1; } if (_zip_write(za, _zip_buffer_data(buffer), _zip_buffer_offset(buffer)) < 0) { _zip_buffer_free(buffer); return -1; } _zip_buffer_free(buffer); if (comment) { if (_zip_write(za, comment->raw, comment->length) < 0) { return -1; } } return (zip_int64_t)size; } ",0 "static void usb_debugfs_cleanup(void) { debugfs_remove_recursive(usb_debug_root); } ",0 "int TabStrip::GetSizeNeededForTabs(const std::vector& tabs) { int width = 0; for (size_t i = 0; i < tabs.size(); ++i) { Tab* tab = tabs[i]; width += tab->width(); if (i > 0 && tab->data().mini != tabs[i - 1]->data().mini) width += kMiniToNonMiniGap; } if (tabs.size() > 0) width += tab_h_offset() * static_cast(tabs.size() - 1); return width; } ",0 "void curlfile_register_class(TSRMLS_D) { zend_class_entry ce; INIT_CLASS_ENTRY( ce, ""CURLFile"", curlfile_funcs ); curl_CURLFile_class = zend_register_internal_class(&ce TSRMLS_CC); zend_declare_property_string(curl_CURLFile_class, ""name"", sizeof(""name"")-1, """", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(curl_CURLFile_class, ""mime"", sizeof(""mime"")-1, """", ZEND_ACC_PUBLIC TSRMLS_CC); zend_declare_property_string(curl_CURLFile_class, ""postname"", sizeof(""postname"")-1, """", ZEND_ACC_PUBLIC TSRMLS_CC); } ",0 "MagickExport CustomStreamInfo *DestroyCustomStreamInfo( CustomStreamInfo *custom_stream) { (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); assert(custom_stream != (CustomStreamInfo *) NULL); assert(custom_stream->signature == MagickCoreSignature); custom_stream->signature=(~MagickCoreSignature); custom_stream=(CustomStreamInfo *) RelinquishMagickMemory(custom_stream); return(custom_stream); } ",0 "u16d(double d) { d = closestinteger(d); return (png_uint_16)d; } ",0 "static __net_exit void ipv4_mib_exit_net(struct net *net) { snmp_mib_free((void __percpu **)net->mib.icmpmsg_statistics); snmp_mib_free((void __percpu **)net->mib.icmp_statistics); snmp_mib_free((void __percpu **)net->mib.udplite_statistics); snmp_mib_free((void __percpu **)net->mib.udp_statistics); snmp_mib_free((void __percpu **)net->mib.net_statistics); snmp_mib_free((void __percpu **)net->mib.ip_statistics); snmp_mib_free((void __percpu **)net->mib.tcp_statistics); } ",0 "SharedMemoryHandleProvider::SharedMemoryHandleProvider() { #if DCHECK_IS_ON() map_ref_count_ = 0; #endif } ",0 "static int peer_recv_tpkt_pdu(freerdp_peer* client, wStream* s) { rdpRdp* rdp; UINT16 length; UINT16 pduType; UINT16 pduLength; UINT16 pduSource; UINT16 channelId; UINT16 securityFlags; rdp = client->context->rdp; if (!rdp_read_header(rdp, s, &length, &channelId)) { fprintf(stderr, ""Incorrect RDP header.\n""); return -1; } if (rdp->settings->DisableEncryption) { if (!rdp_read_security_header(s, &securityFlags)) return -1; if (securityFlags & SEC_ENCRYPT) { if (!rdp_decrypt(rdp, s, length - 4, securityFlags)) { fprintf(stderr, ""rdp_decrypt failed\n""); return -1; } } } if (channelId != MCS_GLOBAL_CHANNEL_ID) { if(!freerdp_channel_peer_process(client, s, channelId)) return -1; } else { if (!rdp_read_share_control_header(s, &pduLength, &pduType, &pduSource)) return -1; client->settings->PduSource = pduSource; switch (pduType) { case PDU_TYPE_DATA: if (!peer_recv_data_pdu(client, s)) return -1; break; default: fprintf(stderr, ""Client sent pduType %d\n"", pduType); return -1; } } return 0; } ",0 "static void aio_free_ring(struct kioctx *ctx) { int i; for (i = 0; i < ctx->nr_pages; i++) { pr_debug(""pid(%d) [%d] page->count=%d\n"", current->pid, i, page_count(ctx->ring_pages[i])); put_page(ctx->ring_pages[i]); } put_aio_ring_file(ctx); if (ctx->ring_pages && ctx->ring_pages != ctx->internal_pages) kfree(ctx->ring_pages); } ",0 "int wc_ecc_is_valid_idx(int n) { int x; for (x = 0; ecc_sets[x].size != 0; x++) ; /* -1 is a valid index --- indicating that the domain params were supplied by the user */ if ((n >= ECC_CUSTOM_IDX) && (n < x)) { return 1; } return 0; } ",0 "status_t String8::appendFormat(const char* fmt, ...) { va_list args; va_start(args, fmt); status_t result = appendFormatV(fmt, args); va_end(args); return result; } ",0 "static u32 vmx_get_pkru(struct kvm_vcpu *vcpu) { return to_vmx(vcpu)->guest_pkru; } ",0 "int sctp_copy_local_addr_list(struct net *net, struct sctp_bind_addr *bp, sctp_scope_t scope, gfp_t gfp, int copy_flags) { struct sctp_sockaddr_entry *addr; int error = 0; rcu_read_lock(); list_for_each_entry_rcu(addr, &net->sctp.local_addr_list, list) { if (!addr->valid) continue; if (sctp_in_scope(net, &addr->a, scope)) { /* Now that the address is in scope, check to see if * the address type is really supported by the local * sock as well as the remote peer. */ if ((((AF_INET == addr->a.sa.sa_family) && (copy_flags & SCTP_ADDR4_PEERSUPP))) || (((AF_INET6 == addr->a.sa.sa_family) && (copy_flags & SCTP_ADDR6_ALLOWED) && (copy_flags & SCTP_ADDR6_PEERSUPP)))) { error = sctp_add_bind_addr(bp, &addr->a, SCTP_ADDR_SRC, GFP_ATOMIC); if (error) goto end_copy; } } } end_copy: rcu_read_unlock(); return error; } ",0 "url::Origin GetOriginForURLLoaderFactory( const CommonNavigationParams& common_params) { GURL target_url = common_params.url; if (target_url.SchemeIs(url::kAboutScheme)) return common_params.initiator_origin.value_or(url::Origin()); return url::Origin::Create(target_url); } ",0 "QQmlComponent* OxideQQuickWebView::confirmDialog() const { Q_D(const OxideQQuickWebView); return d->confirm_dialog_; } ",0 "static int touch(char* path, mode_t mode) { int fd = open(path, O_RDWR | O_CREAT | O_EXCL | O_NOFOLLOW, mode); if (fd == -1) { if (errno == EEXIST) { return 0; } else { ERROR(""Failed to open(%s): %s\n"", path, strerror(errno)); return -1; } } close(fd); return 0; } ",0 "static void hns_xgmac_get_regs(void *mac_drv, void *data) { u32 i = 0; struct mac_driver *drv = (struct mac_driver *)mac_drv; u32 *regs = data; u64 qtmp; /* base config registers */ regs[0] = dsaf_read_dev(drv, XGMAC_INT_STATUS_REG); regs[1] = dsaf_read_dev(drv, XGMAC_INT_ENABLE_REG); regs[2] = dsaf_read_dev(drv, XGMAC_INT_SET_REG); regs[3] = dsaf_read_dev(drv, XGMAC_IERR_U_INFO_REG); regs[4] = dsaf_read_dev(drv, XGMAC_OVF_INFO_REG); regs[5] = dsaf_read_dev(drv, XGMAC_OVF_CNT_REG); regs[6] = dsaf_read_dev(drv, XGMAC_PORT_MODE_REG); regs[7] = dsaf_read_dev(drv, XGMAC_CLK_ENABLE_REG); regs[8] = dsaf_read_dev(drv, XGMAC_RESET_REG); regs[9] = dsaf_read_dev(drv, XGMAC_LINK_CONTROL_REG); regs[10] = dsaf_read_dev(drv, XGMAC_LINK_STATUS_REG); regs[11] = dsaf_read_dev(drv, XGMAC_SPARE_REG); regs[12] = dsaf_read_dev(drv, XGMAC_SPARE_CNT_REG); regs[13] = dsaf_read_dev(drv, XGMAC_MAC_ENABLE_REG); regs[14] = dsaf_read_dev(drv, XGMAC_MAC_CONTROL_REG); regs[15] = dsaf_read_dev(drv, XGMAC_MAC_IPG_REG); regs[16] = dsaf_read_dev(drv, XGMAC_MAC_MSG_CRC_EN_REG); regs[17] = dsaf_read_dev(drv, XGMAC_MAC_MSG_IMG_REG); regs[18] = dsaf_read_dev(drv, XGMAC_MAC_MSG_FC_CFG_REG); regs[19] = dsaf_read_dev(drv, XGMAC_MAC_MSG_TC_CFG_REG); regs[20] = dsaf_read_dev(drv, XGMAC_MAC_PAD_SIZE_REG); regs[21] = dsaf_read_dev(drv, XGMAC_MAC_MIN_PKT_SIZE_REG); regs[22] = dsaf_read_dev(drv, XGMAC_MAC_MAX_PKT_SIZE_REG); regs[23] = dsaf_read_dev(drv, XGMAC_MAC_PAUSE_CTRL_REG); regs[24] = dsaf_read_dev(drv, XGMAC_MAC_PAUSE_TIME_REG); regs[25] = dsaf_read_dev(drv, XGMAC_MAC_PAUSE_GAP_REG); regs[26] = dsaf_read_dev(drv, XGMAC_MAC_PAUSE_LOCAL_MAC_H_REG); regs[27] = dsaf_read_dev(drv, XGMAC_MAC_PAUSE_LOCAL_MAC_L_REG); regs[28] = dsaf_read_dev(drv, XGMAC_MAC_PAUSE_PEER_MAC_H_REG); regs[29] = dsaf_read_dev(drv, XGMAC_MAC_PAUSE_PEER_MAC_L_REG); regs[30] = dsaf_read_dev(drv, XGMAC_MAC_PFC_PRI_EN_REG); regs[31] = dsaf_read_dev(drv, XGMAC_MAC_1588_CTRL_REG); regs[32] = dsaf_read_dev(drv, XGMAC_MAC_1588_TX_PORT_DLY_REG); regs[33] = dsaf_read_dev(drv, XGMAC_MAC_1588_RX_PORT_DLY_REG); regs[34] = dsaf_read_dev(drv, XGMAC_MAC_1588_ASYM_DLY_REG); regs[35] = dsaf_read_dev(drv, XGMAC_MAC_1588_ADJUST_CFG_REG); regs[36] = dsaf_read_dev(drv, XGMAC_MAC_Y1731_ETH_TYPE_REG); regs[37] = dsaf_read_dev(drv, XGMAC_MAC_MIB_CONTROL_REG); regs[38] = dsaf_read_dev(drv, XGMAC_MAC_WAN_RATE_ADJUST_REG); regs[39] = dsaf_read_dev(drv, XGMAC_MAC_TX_ERR_MARK_REG); regs[40] = dsaf_read_dev(drv, XGMAC_MAC_TX_LF_RF_CONTROL_REG); regs[41] = dsaf_read_dev(drv, XGMAC_MAC_RX_LF_RF_STATUS_REG); regs[42] = dsaf_read_dev(drv, XGMAC_MAC_TX_RUNT_PKT_CNT_REG); regs[43] = dsaf_read_dev(drv, XGMAC_MAC_RX_RUNT_PKT_CNT_REG); regs[44] = dsaf_read_dev(drv, XGMAC_MAC_RX_PREAM_ERR_PKT_CNT_REG); regs[45] = dsaf_read_dev(drv, XGMAC_MAC_TX_LF_RF_TERM_PKT_CNT_REG); regs[46] = dsaf_read_dev(drv, XGMAC_MAC_TX_SN_MISMATCH_PKT_CNT_REG); regs[47] = dsaf_read_dev(drv, XGMAC_MAC_RX_ERR_MSG_CNT_REG); regs[48] = dsaf_read_dev(drv, XGMAC_MAC_RX_ERR_EFD_CNT_REG); regs[49] = dsaf_read_dev(drv, XGMAC_MAC_ERR_INFO_REG); regs[50] = dsaf_read_dev(drv, XGMAC_MAC_DBG_INFO_REG); regs[51] = dsaf_read_dev(drv, XGMAC_PCS_BASER_SYNC_THD_REG); regs[52] = dsaf_read_dev(drv, XGMAC_PCS_STATUS1_REG); regs[53] = dsaf_read_dev(drv, XGMAC_PCS_BASER_STATUS1_REG); regs[54] = dsaf_read_dev(drv, XGMAC_PCS_BASER_STATUS2_REG); regs[55] = dsaf_read_dev(drv, XGMAC_PCS_BASER_SEEDA_0_REG); regs[56] = dsaf_read_dev(drv, XGMAC_PCS_BASER_SEEDA_1_REG); regs[57] = dsaf_read_dev(drv, XGMAC_PCS_BASER_SEEDB_0_REG); regs[58] = dsaf_read_dev(drv, XGMAC_PCS_BASER_SEEDB_1_REG); regs[59] = dsaf_read_dev(drv, XGMAC_PCS_BASER_TEST_CONTROL_REG); regs[60] = dsaf_read_dev(drv, XGMAC_PCS_BASER_TEST_ERR_CNT_REG); regs[61] = dsaf_read_dev(drv, XGMAC_PCS_DBG_INFO_REG); regs[62] = dsaf_read_dev(drv, XGMAC_PCS_DBG_INFO1_REG); regs[63] = dsaf_read_dev(drv, XGMAC_PCS_DBG_INFO2_REG); regs[64] = dsaf_read_dev(drv, XGMAC_PCS_DBG_INFO3_REG); regs[65] = dsaf_read_dev(drv, XGMAC_PMA_ENABLE_REG); regs[66] = dsaf_read_dev(drv, XGMAC_PMA_CONTROL_REG); regs[67] = dsaf_read_dev(drv, XGMAC_PMA_SIGNAL_STATUS_REG); regs[68] = dsaf_read_dev(drv, XGMAC_PMA_DBG_INFO_REG); regs[69] = dsaf_read_dev(drv, XGMAC_PMA_FEC_ABILITY_REG); regs[70] = dsaf_read_dev(drv, XGMAC_PMA_FEC_CONTROL_REG); regs[71] = dsaf_read_dev(drv, XGMAC_PMA_FEC_CORR_BLOCK_CNT__REG); regs[72] = dsaf_read_dev(drv, XGMAC_PMA_FEC_UNCORR_BLOCK_CNT__REG); /* status registers */ #define hns_xgmac_cpy_q(p, q) \ do {\ *(p) = (u32)(q);\ *((p) + 1) = (u32)((q) >> 32);\ } while (0) qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_FRAGMENT); hns_xgmac_cpy_q(®s[73], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_UNDERSIZE); hns_xgmac_cpy_q(®s[75], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_UNDERMIN); hns_xgmac_cpy_q(®s[77], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_64OCTETS); hns_xgmac_cpy_q(®s[79], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_65TO127OCTETS); hns_xgmac_cpy_q(®s[81], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_128TO255OCTETS); hns_xgmac_cpy_q(®s[83], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_256TO511OCTETS); hns_xgmac_cpy_q(®s[85], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_512TO1023OCTETS); hns_xgmac_cpy_q(®s[87], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_1024TO1518OCTETS); hns_xgmac_cpy_q(®s[89], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_1519TOMAXOCTETS); hns_xgmac_cpy_q(®s[91], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_1519TOMAXOCTETSOK); hns_xgmac_cpy_q(®s[93], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_OVERSIZE); hns_xgmac_cpy_q(®s[95], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PKTS_JABBER); hns_xgmac_cpy_q(®s[97], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_GOODPKTS); hns_xgmac_cpy_q(®s[99], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_GOODOCTETS); hns_xgmac_cpy_q(®s[101], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_TOTAL_PKTS); hns_xgmac_cpy_q(®s[103], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_TOTALOCTETS); hns_xgmac_cpy_q(®s[105], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_UNICASTPKTS); hns_xgmac_cpy_q(®s[107], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_MULTICASTPKTS); hns_xgmac_cpy_q(®s[109], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_BROADCASTPKTS); hns_xgmac_cpy_q(®s[111], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PRI0PAUSEPKTS); hns_xgmac_cpy_q(®s[113], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PRI1PAUSEPKTS); hns_xgmac_cpy_q(®s[115], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PRI2PAUSEPKTS); hns_xgmac_cpy_q(®s[117], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PRI3PAUSEPKTS); hns_xgmac_cpy_q(®s[119], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PRI4PAUSEPKTS); hns_xgmac_cpy_q(®s[121], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PRI5PAUSEPKTS); hns_xgmac_cpy_q(®s[123], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PRI6PAUSEPKTS); hns_xgmac_cpy_q(®s[125], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_PRI7PAUSEPKTS); hns_xgmac_cpy_q(®s[127], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_MACCTRLPKTS); hns_xgmac_cpy_q(®s[129], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_1731PKTS); hns_xgmac_cpy_q(®s[131], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_1588PKTS); hns_xgmac_cpy_q(®s[133], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_FROMAPPGOODPKTS); hns_xgmac_cpy_q(®s[135], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_FROMAPPBADPKTS); hns_xgmac_cpy_q(®s[137], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_ERRALLPKTS); hns_xgmac_cpy_q(®s[139], qtmp); /* RX */ qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_FRAGMENT); hns_xgmac_cpy_q(®s[141], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTSUNDERSIZE); hns_xgmac_cpy_q(®s[143], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_UNDERMIN); hns_xgmac_cpy_q(®s[145], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_64OCTETS); hns_xgmac_cpy_q(®s[147], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_65TO127OCTETS); hns_xgmac_cpy_q(®s[149], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_128TO255OCTETS); hns_xgmac_cpy_q(®s[151], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_256TO511OCTETS); hns_xgmac_cpy_q(®s[153], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_512TO1023OCTETS); hns_xgmac_cpy_q(®s[155], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_1024TO1518OCTETS); hns_xgmac_cpy_q(®s[157], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_1519TOMAXOCTETS); hns_xgmac_cpy_q(®s[159], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_1519TOMAXOCTETSOK); hns_xgmac_cpy_q(®s[161], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_OVERSIZE); hns_xgmac_cpy_q(®s[163], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PKTS_JABBER); hns_xgmac_cpy_q(®s[165], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_GOODPKTS); hns_xgmac_cpy_q(®s[167], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_GOODOCTETS); hns_xgmac_cpy_q(®s[169], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_TOTAL_PKTS); hns_xgmac_cpy_q(®s[171], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_TOTALOCTETS); hns_xgmac_cpy_q(®s[173], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_UNICASTPKTS); hns_xgmac_cpy_q(®s[175], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_MULTICASTPKTS); hns_xgmac_cpy_q(®s[177], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_BROADCASTPKTS); hns_xgmac_cpy_q(®s[179], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PRI0PAUSEPKTS); hns_xgmac_cpy_q(®s[181], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PRI1PAUSEPKTS); hns_xgmac_cpy_q(®s[183], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PRI2PAUSEPKTS); hns_xgmac_cpy_q(®s[185], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PRI3PAUSEPKTS); hns_xgmac_cpy_q(®s[187], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PRI4PAUSEPKTS); hns_xgmac_cpy_q(®s[189], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PRI5PAUSEPKTS); hns_xgmac_cpy_q(®s[191], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PRI6PAUSEPKTS); hns_xgmac_cpy_q(®s[193], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_PRI7PAUSEPKTS); hns_xgmac_cpy_q(®s[195], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_MACCTRLPKTS); hns_xgmac_cpy_q(®s[197], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_SENDAPPGOODPKTS); hns_xgmac_cpy_q(®s[199], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_TX_SENDAPPBADPKTS); hns_xgmac_cpy_q(®s[201], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_1731PKTS); hns_xgmac_cpy_q(®s[203], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_SYMBOLERRPKTS); hns_xgmac_cpy_q(®s[205], qtmp); qtmp = hns_mac_reg_read64(drv, XGMAC_RX_FCSERRPKTS); hns_xgmac_cpy_q(®s[207], qtmp); /* mark end of mac regs */ for (i = 208; i < 214; i++) regs[i] = 0xaaaaaaaa; } ",0 "int regulator_bulk_disable(int num_consumers, struct regulator_bulk_data *consumers) { int i; int ret, r; for (i = num_consumers - 1; i >= 0; --i) { ret = regulator_disable(consumers[i].consumer); if (ret != 0) goto err; } return 0; err: pr_err(""Failed to disable %s: %d\n"", consumers[i].supply, ret); for (++i; i < num_consumers; ++i) { r = regulator_enable(consumers[i].consumer); if (r != 0) pr_err(""Failed to reename %s: %d\n"", consumers[i].supply, r); } return ret; } ",0 "ScriptValue WebGLRenderingContextBase::GetUnsignedIntParameter( ScriptState* script_state, GLenum pname) { GLint value = 0; if (!isContextLost()) ContextGL()->GetIntegerv(pname, &value); return WebGLAny(script_state, static_cast(value)); } ",0 "static void pcrypt_aead_exit_tfm(struct crypto_aead *tfm) { struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(tfm); crypto_free_aead(ctx->child); } ",0 "decode_time3(__be32 *p, struct timespec *time) { time->tv_sec = ntohl(*p++); time->tv_nsec = ntohl(*p++); return p; } ",0 "static int coolkey_ecc_op(sc_card_t *card, const u8 * data, size_t datalen, u8 * out, size_t outlen) { int r; const u8 *crypt_in; u8 **crypt_out_p; u8 ins = 0; size_t crypt_in_len, *crypt_out_len_p; coolkey_private_data_t * priv = COOLKEY_DATA(card); coolkey_compute_ecc_params_t params; size_t params_len; u8 key_number; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, ""datalen=%""SC_FORMAT_LEN_SIZE_T""u outlen=%""SC_FORMAT_LEN_SIZE_T""u\n"", datalen, outlen); crypt_in = data; crypt_in_len = datalen; crypt_out_p = &out; crypt_out_len_p = &outlen; key_number = priv->key_id; params.location = COOLKEY_CRYPT_LOCATION_APDU; if (priv->key_id > 0xff) { r = SC_ERROR_NO_DEFAULT_KEY; goto done; } switch (priv->operation) { case SC_SEC_OPERATION_DERIVE: ins = COOLKEY_INS_COMPUTE_ECC_KEY_AGREEMENT; break; case SC_SEC_OPERATION_SIGN: ins = COOLKEY_INS_COMPUTE_ECC_SIGNATURE; break; default: r = SC_ERROR_NOT_SUPPORTED; goto done; } params_len = (sizeof(params) - sizeof(params.buf)) + crypt_in_len; ushort2bebytes(params.buf_len, crypt_in_len); if (crypt_in_len) { memcpy(params.buf, crypt_in, crypt_in_len); } r = coolkey_apdu_io(card, COOLKEY_CLASS, ins, key_number, COOLKEY_CRYPT_ONE_STEP, (u8 *)¶ms, params_len, crypt_out_p, crypt_out_len_p, priv->nonce, sizeof(priv->nonce)); done: return r; } ",0 "void CNBL::NBComplete() { m_BuffersDone++; m_MappedBuffersDetached--; } ",0 "void FakeCentral::AddFakeService(const std::string& peripheral_address, const device::BluetoothUUID& service_uuid, AddFakeServiceCallback callback) { FakePeripheral* fake_peripheral = GetFakePeripheral(peripheral_address); if (fake_peripheral == nullptr) { std::move(callback).Run(base::nullopt); return; } std::move(callback).Run(fake_peripheral->AddFakeService(service_uuid)); } ",0 "bool WebMediaPlayerMS::DidLoadingProgress() { DCHECK(thread_checker_.CalledOnValidThread()); return true; } ",0 "void FrameLoader::stop() { RefPtr protector(m_frame); if (m_frame->document()->parser()) m_frame->document()->parser()->stopParsing(); m_frame->document()->finishParsing(); if (m_iconLoader) m_iconLoader->stopLoading(); } ",0 "AppListSyncableService::CreateSyncItem( const std::string& item_id, sync_pb::AppListSpecifics::AppListItemType item_type) { DCHECK(!ContainsKey(sync_items_, item_id)); SyncItem* sync_item = new SyncItem(item_id, item_type); sync_items_[item_id] = sync_item; return sync_item; } ",0 "jbig2_dump_huffman_state(Jbig2HuffmanState *hs) { fprintf(stderr, ""huffman state %08x %08x offset %d.%d\n"", hs->this_word, hs->next_word, hs->offset, hs->offset_bits); } ",0 "loop_set_status(struct loop_device *lo, const struct loop_info64 *info) { int err; struct loop_func_table *xfer; kuid_t uid = current_uid(); if (lo->lo_encrypt_key_size && !uid_eq(lo->lo_key_owner, uid) && !capable(CAP_SYS_ADMIN)) return -EPERM; if (lo->lo_state != Lo_bound) return -ENXIO; if ((unsigned int) info->lo_encrypt_key_size > LO_KEY_SIZE) return -EINVAL; /* I/O need to be drained during transfer transition */ blk_mq_freeze_queue(lo->lo_queue); err = loop_release_xfer(lo); if (err) goto exit; if (info->lo_encrypt_type) { unsigned int type = info->lo_encrypt_type; if (type >= MAX_LO_CRYPT) return -EINVAL; xfer = xfer_funcs[type]; if (xfer == NULL) return -EINVAL; } else xfer = NULL; err = loop_init_xfer(lo, xfer, info); if (err) goto exit; if (lo->lo_offset != info->lo_offset || lo->lo_sizelimit != info->lo_sizelimit) { if (figure_loop_size(lo, info->lo_offset, info->lo_sizelimit)) { err = -EFBIG; goto exit; } } loop_config_discard(lo); memcpy(lo->lo_file_name, info->lo_file_name, LO_NAME_SIZE); memcpy(lo->lo_crypt_name, info->lo_crypt_name, LO_NAME_SIZE); lo->lo_file_name[LO_NAME_SIZE-1] = 0; lo->lo_crypt_name[LO_NAME_SIZE-1] = 0; if (!xfer) xfer = &none_funcs; lo->transfer = xfer->transfer; lo->ioctl = xfer->ioctl; if ((lo->lo_flags & LO_FLAGS_AUTOCLEAR) != (info->lo_flags & LO_FLAGS_AUTOCLEAR)) lo->lo_flags ^= LO_FLAGS_AUTOCLEAR; lo->lo_encrypt_key_size = info->lo_encrypt_key_size; lo->lo_init[0] = info->lo_init[0]; lo->lo_init[1] = info->lo_init[1]; if (info->lo_encrypt_key_size) { memcpy(lo->lo_encrypt_key, info->lo_encrypt_key, info->lo_encrypt_key_size); lo->lo_key_owner = uid; } /* update dio if lo_offset or transfer is changed */ __loop_update_dio(lo, lo->use_dio); exit: blk_mq_unfreeze_queue(lo->lo_queue); if (!err && (info->lo_flags & LO_FLAGS_PARTSCAN) && !(lo->lo_flags & LO_FLAGS_PARTSCAN)) { lo->lo_flags |= LO_FLAGS_PARTSCAN; lo->lo_disk->flags &= ~GENHD_FL_NO_PART_SCAN; loop_reread_partitions(lo, lo->lo_device); } return err; } ",0 "void RootWindowHostLinux::SetCapture() { } ",0 "int effect_lib_create(const effect_uuid_t *uuid, int32_t sessionId, int32_t ioId, effect_handle_t *pHandle) { int ret; int i; ALOGV(""%s: sessionId: %d, ioId: %d"", __func__, sessionId, ioId); if (lib_init() != 0) return init_status; if (pHandle == NULL || uuid == NULL) return -EINVAL; for (i = 0; descriptors[i] != NULL; i++) { if (memcmp(uuid, &descriptors[i]->uuid, sizeof(effect_uuid_t)) == 0) break; } if (descriptors[i] == NULL) return -EINVAL; effect_context_t *context; if (memcmp(uuid, &equalizer_descriptor.uuid, sizeof(effect_uuid_t)) == 0) { equalizer_context_t *eq_ctxt = (equalizer_context_t *) calloc(1, sizeof(equalizer_context_t)); context = (effect_context_t *)eq_ctxt; context->ops.init = equalizer_init; context->ops.reset = equalizer_reset; context->ops.set_parameter = equalizer_set_parameter; context->ops.get_parameter = equalizer_get_parameter; context->ops.set_device = equalizer_set_device; context->ops.enable = equalizer_enable; context->ops.disable = equalizer_disable; context->ops.start = equalizer_start; context->ops.stop = equalizer_stop; context->desc = &equalizer_descriptor; eq_ctxt->ctl = NULL; } else if (memcmp(uuid, &bassboost_descriptor.uuid, sizeof(effect_uuid_t)) == 0) { bassboost_context_t *bass_ctxt = (bassboost_context_t *) calloc(1, sizeof(bassboost_context_t)); context = (effect_context_t *)bass_ctxt; context->ops.init = bassboost_init; context->ops.reset = bassboost_reset; context->ops.set_parameter = bassboost_set_parameter; context->ops.get_parameter = bassboost_get_parameter; context->ops.set_device = bassboost_set_device; context->ops.enable = bassboost_enable; context->ops.disable = bassboost_disable; context->ops.start = bassboost_start; context->ops.stop = bassboost_stop; context->desc = &bassboost_descriptor; bass_ctxt->ctl = NULL; } else if (memcmp(uuid, &virtualizer_descriptor.uuid, sizeof(effect_uuid_t)) == 0) { virtualizer_context_t *virt_ctxt = (virtualizer_context_t *) calloc(1, sizeof(virtualizer_context_t)); context = (effect_context_t *)virt_ctxt; context->ops.init = virtualizer_init; context->ops.reset = virtualizer_reset; context->ops.set_parameter = virtualizer_set_parameter; context->ops.get_parameter = virtualizer_get_parameter; context->ops.set_device = virtualizer_set_device; context->ops.enable = virtualizer_enable; context->ops.disable = virtualizer_disable; context->ops.start = virtualizer_start; context->ops.stop = virtualizer_stop; context->desc = &virtualizer_descriptor; virt_ctxt->ctl = NULL; } else if ((memcmp(uuid, &aux_env_reverb_descriptor.uuid, sizeof(effect_uuid_t)) == 0) || (memcmp(uuid, &ins_env_reverb_descriptor.uuid, sizeof(effect_uuid_t)) == 0) || (memcmp(uuid, &aux_preset_reverb_descriptor.uuid, sizeof(effect_uuid_t)) == 0) || (memcmp(uuid, &ins_preset_reverb_descriptor.uuid, sizeof(effect_uuid_t)) == 0)) { reverb_context_t *reverb_ctxt = (reverb_context_t *) calloc(1, sizeof(reverb_context_t)); context = (effect_context_t *)reverb_ctxt; context->ops.init = reverb_init; context->ops.reset = reverb_reset; context->ops.set_parameter = reverb_set_parameter; context->ops.get_parameter = reverb_get_parameter; context->ops.set_device = reverb_set_device; context->ops.enable = reverb_enable; context->ops.disable = reverb_disable; context->ops.start = reverb_start; context->ops.stop = reverb_stop; if (memcmp(uuid, &aux_env_reverb_descriptor.uuid, sizeof(effect_uuid_t)) == 0) { context->desc = &aux_env_reverb_descriptor; reverb_auxiliary_init(reverb_ctxt); } else if (memcmp(uuid, &ins_env_reverb_descriptor.uuid, sizeof(effect_uuid_t)) == 0) { context->desc = &ins_env_reverb_descriptor; reverb_insert_init(reverb_ctxt); } else if (memcmp(uuid, &aux_preset_reverb_descriptor.uuid, sizeof(effect_uuid_t)) == 0) { context->desc = &aux_preset_reverb_descriptor; reverb_auxiliary_init(reverb_ctxt); } else if (memcmp(uuid, &ins_preset_reverb_descriptor.uuid, sizeof(effect_uuid_t)) == 0) { context->desc = &ins_preset_reverb_descriptor; reverb_preset_init(reverb_ctxt); } reverb_ctxt->ctl = NULL; } else { return -EINVAL; } context->itfe = &effect_interface; context->state = EFFECT_STATE_UNINITIALIZED; context->out_handle = (audio_io_handle_t)ioId; ret = context->ops.init(context); if (ret < 0) { ALOGW(""%s init failed"", __func__); free(context); return ret; } context->state = EFFECT_STATE_INITIALIZED; pthread_mutex_lock(&lock); list_add_tail(&created_effects_list, &context->effects_list_node); output_context_t *out_ctxt = get_output(ioId); if (out_ctxt != NULL) add_effect_to_output(out_ctxt, context); pthread_mutex_unlock(&lock); *pHandle = (effect_handle_t)context; ALOGV(""%s created context %p"", __func__, context); return 0; } ",0 "static void free_render_context(ASS_Renderer *render_priv) { ass_cache_dec_ref(render_priv->state.font); free(render_priv->state.family); ass_drawing_free(render_priv->state.clip_drawing); render_priv->state.font = NULL; render_priv->state.family = NULL; render_priv->state.clip_drawing = NULL; TextInfo *text_info = &render_priv->text_info; for (int n = 0; n < text_info->length; n++) ass_drawing_free(text_info->glyphs[n].drawing); text_info->length = 0; } ",0 "bool BaseAudioContext::WouldTaintOrigin(const KURL& url) const { if (url.ProtocolIsData()) { return false; } Document* document = GetDocument(); if (document && document->GetSecurityOrigin()) { return !document->GetSecurityOrigin()->CanRequest(url); } return true; } ",0 " NavigationLogger(WebContents* web_contents) : WebContentsObserver(web_contents) {} ",0 "void security_mac_salt_key(const BYTE* session_key_blob, const BYTE* client_random, const BYTE* server_random, BYTE* output) { /* MacSaltKey = First128Bits(SessionKeyBlob) */ memcpy(output, session_key_blob, 16); } ",0 "void PageSerializer::serialize(Page* page) { serializeFrame(page->deprecatedLocalMainFrame()); } ",0 "bool HasWebRequestScheme(const GURL& url) { return (url.SchemeIs(url::kAboutScheme) || url.SchemeIs(url::kFileScheme) || url.SchemeIs(url::kFileSystemScheme) || url.SchemeIs(url::kFtpScheme) || url.SchemeIs(url::kHttpScheme) || url.SchemeIs(url::kHttpsScheme) || url.SchemeIs(extensions::kExtensionScheme)); } ",0 "static void __devexit pmcraid_remove(struct pci_dev *pdev) { struct pmcraid_instance *pinstance = pci_get_drvdata(pdev); /* remove the management interface (/dev file) for this device */ pmcraid_release_chrdev(pinstance); /* remove host template from scsi midlayer */ scsi_remove_host(pinstance->host); /* block requests from mid-layer */ scsi_block_requests(pinstance->host); /* initiate shutdown adapter */ pmcraid_shutdown(pdev); pmcraid_disable_interrupts(pinstance, ~0); flush_work_sync(&pinstance->worker_q); pmcraid_kill_tasklets(pinstance); pmcraid_unregister_interrupt_handler(pinstance); pmcraid_release_buffers(pinstance); iounmap(pinstance->mapped_dma_addr); pci_release_regions(pdev); scsi_host_put(pinstance->host); pci_disable_device(pdev); return; } ",0 "static MagickBooleanType IsSVG(const unsigned char *magick,const size_t length) { if (length < 4) return(MagickFalse); if (LocaleNCompare((const char *) magick,""?xml"",4) == 0) return(MagickTrue); return(MagickFalse); } ",0 "RenderFrameHostCreatedObserver::~RenderFrameHostCreatedObserver() { } ",0 " Ins_SHC( TT_ExecContext exc, FT_Long* args ) { TT_GlyphZoneRec zp; FT_UShort refp; FT_F26Dot6 dx, dy; FT_Short contour, bounds; FT_UShort start, limit, i; contour = (FT_Short)args[0]; bounds = ( exc->GS.gep2 == 0 ) ? 1 : exc->zp2.n_contours; if ( BOUNDS( contour, bounds ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); return; } if ( Compute_Point_Displacement( exc, &dx, &dy, &zp, &refp ) ) return; if ( contour == 0 ) start = 0; else start = (FT_UShort)( exc->zp2.contours[contour - 1] + 1 - exc->zp2.first_point ); /* we use the number of points if in the twilight zone */ if ( exc->GS.gep2 == 0 ) limit = exc->zp2.n_points; else limit = (FT_UShort)( exc->zp2.contours[contour] - exc->zp2.first_point + 1 ); for ( i = start; i < limit; i++ ) { if ( zp.cur != exc->zp2.cur || refp != i ) Move_Zp2_Point( exc, i, dx, dy, TRUE ); } } ",0 "static int samldb_first_step(struct samldb_ctx *ac) { if (ac->steps == NULL) { return ldb_operr(ldb_module_get_ctx(ac->module)); } ac->curstep = ac->steps; return ac->curstep->fn(ac); } ",0 "struct net_device *__ip_dev_find(struct net *net, __be32 addr, bool devref) { u32 hash = inet_addr_hash(net, addr); struct net_device *result = NULL; struct in_ifaddr *ifa; rcu_read_lock(); hlist_for_each_entry_rcu(ifa, &inet_addr_lst[hash], hash) { if (ifa->ifa_local == addr) { struct net_device *dev = ifa->ifa_dev->dev; if (!net_eq(dev_net(dev), net)) continue; result = dev; break; } } if (!result) { struct flowi4 fl4 = { .daddr = addr }; struct fib_result res = { 0 }; struct fib_table *local; /* Fallback to FIB local table so that communication * over loopback subnets work. */ local = fib_get_table(net, RT_TABLE_LOCAL); if (local && !fib_table_lookup(local, &fl4, &res, FIB_LOOKUP_NOREF) && res.type == RTN_LOCAL) result = FIB_RES_DEV(res); } if (result && devref) dev_hold(result); rcu_read_unlock(); return result; } ",0 "bool AXNodeObject::isPressed() const { if (!isButton()) return false; Node* node = this->getNode(); if (!node) return false; if (ariaRoleAttribute() == ToggleButtonRole) { if (equalIgnoringCase(getAttribute(aria_pressedAttr), ""true"") || equalIgnoringCase(getAttribute(aria_pressedAttr), ""mixed"")) return true; return false; } return node->isActive(); } ",1 "static void acm_softint(struct work_struct *work) { struct acm *acm = container_of(work, struct acm, work); dev_vdbg(&acm->data->dev, ""%s\n"", __func__); tty_port_tty_wakeup(&acm->port); } ",0 "struct lh_table* lh_kptr_table_new(int size, const char *name, lh_entry_free_fn *free_fn) { return lh_table_new(size, name, free_fn, lh_ptr_hash, lh_ptr_equal); } ",0 "hextoint(int c) { if (!isascii((unsigned char) c)) return -1; if (isdigit((unsigned char) c)) return c - '0'; if ((c >= 'a') && (c <= 'f')) return c + 10 - 'a'; if (( c>= 'A') && (c <= 'F')) return c + 10 - 'A'; return -1; } ",0 "xfs_inode_ag_walk_grab( struct xfs_inode *ip, int flags) { struct inode *inode = VFS_I(ip); bool newinos = !!(flags & XFS_AGITER_INEW_WAIT); ASSERT(rcu_read_lock_held()); /* * check for stale RCU freed inode * * If the inode has been reallocated, it doesn't matter if it's not in * the AG we are walking - we are walking for writeback, so if it * passes all the ""valid inode"" checks and is dirty, then we'll write * it back anyway. If it has been reallocated and still being * initialised, the XFS_INEW check below will catch it. */ spin_lock(&ip->i_flags_lock); if (!ip->i_ino) goto out_unlock_noent; /* avoid new or reclaimable inodes. Leave for reclaim code to flush */ if ((!newinos && __xfs_iflags_test(ip, XFS_INEW)) || __xfs_iflags_test(ip, XFS_IRECLAIMABLE | XFS_IRECLAIM)) goto out_unlock_noent; spin_unlock(&ip->i_flags_lock); /* nothing to sync during shutdown */ if (XFS_FORCED_SHUTDOWN(ip->i_mount)) return -EFSCORRUPTED; /* If we can't grab the inode, it must on it's way to reclaim. */ if (!igrab(inode)) return -ENOENT; /* inode is valid */ return 0; out_unlock_noent: spin_unlock(&ip->i_flags_lock); return -ENOENT; } ",0 "void WebSocketJob::Wakeup() { if (!waiting_) return; waiting_ = false; DCHECK(callback_); MessageLoopForIO::current()->PostTask( FROM_HERE, NewRunnableMethod(this, &WebSocketJob::RetryPendingIO)); } ",1 "static void freeDebugCallbackArgs(int number, char **args) { for (int i = 0; i < number; i++) { if (args[i] != NULL) { free(args[i]); } } free(args); } ",0 "NPObject* WebPluginProxy::GetPluginElement() { if (plugin_element_) return plugin_element_; int npobject_route_id = channel_->GenerateRouteID(); bool success = false; Send(new PluginHostMsg_GetPluginElement(route_id_, npobject_route_id, &success)); if (!success) return NULL; plugin_element_ = NPObjectProxy::Create( channel_, npobject_route_id, containing_window_, page_url_); return plugin_element_; } ",0 "int FS_FTell( fileHandle_t f ) { int pos; if ( fsh[f].zipFile == qtrue ) { pos = unztell( fsh[f].handleFiles.file.z ); } else { pos = ftell( fsh[f].handleFiles.file.o ); } return pos; } ",0 "ProcCopyColormapAndFree(ClientPtr client) { Colormap mid; ColormapPtr pSrcMap; REQUEST(xCopyColormapAndFreeReq); int rc; REQUEST_SIZE_MATCH(xCopyColormapAndFreeReq); mid = stuff->mid; LEGAL_NEW_RESOURCE(mid, client); rc = dixLookupResourceByType((void **) &pSrcMap, stuff->srcCmap, RT_COLORMAP, client, DixReadAccess | DixRemoveAccess); if (rc == Success) return CopyColormapAndFree(mid, pSrcMap, client->index); client->errorValue = stuff->srcCmap; return rc; } ",0 "MagickExport MagickBooleanType GetOneVirtualPixel(const Image *image, const ssize_t x,const ssize_t y,PixelPacket *pixel,ExceptionInfo *exception) { CacheInfo *magick_restrict cache_info; const int id = GetOpenMPThreadId(); const PixelPacket *magick_restrict pixels; assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickSignature); *pixel=image->background_color; if (cache_info->methods.get_one_virtual_pixel_from_handler != (GetOneVirtualPixelFromHandler) NULL) return(cache_info->methods.get_one_virtual_pixel_from_handler(image, GetPixelCacheVirtualMethod(image),x,y,pixel,exception)); assert(id < (int) cache_info->number_threads); pixels=GetVirtualPixelsFromNexus(image,GetPixelCacheVirtualMethod(image),x,y, 1UL,1UL,cache_info->nexus_info[id],exception); if (pixels == (const PixelPacket *) NULL) return(MagickFalse); *pixel=(*pixels); return(MagickTrue); } ",0 "int dev_set_mtu(struct net_device *dev, int new_mtu) { const struct net_device_ops *ops = dev->netdev_ops; int err; if (new_mtu == dev->mtu) return 0; /* MTU must be positive. */ if (new_mtu < 0) return -EINVAL; if (!netif_device_present(dev)) return -ENODEV; err = 0; if (ops->ndo_change_mtu) err = ops->ndo_change_mtu(dev, new_mtu); else dev->mtu = new_mtu; if (!err && dev->flags & IFF_UP) call_netdevice_notifiers(NETDEV_CHANGEMTU, dev); return err; } ",0 "void AudioFlinger::EffectChain::setEffectSuspendedAll_l(bool suspend) { sp desc; ssize_t index = mSuspendedEffects.indexOfKey((int)kKeyForSuspendAll); if (suspend) { if (index >= 0) { desc = mSuspendedEffects.valueAt(index); } else { desc = new SuspendedEffectDesc(); mSuspendedEffects.add((int)kKeyForSuspendAll, desc); ALOGV(""setEffectSuspendedAll_l() add entry for 0""); } if (desc->mRefCount++ == 0) { Vector< sp > effects; getSuspendEligibleEffects(effects); for (size_t i = 0; i < effects.size(); i++) { setEffectSuspended_l(&effects[i]->desc().type, true); } } } else { if (index < 0) { return; } desc = mSuspendedEffects.valueAt(index); if (desc->mRefCount <= 0) { ALOGW(""setEffectSuspendedAll_l() restore refcount should not be 0 %d"", desc->mRefCount); desc->mRefCount = 1; } if (--desc->mRefCount == 0) { Vector types; for (size_t i = 0; i < mSuspendedEffects.size(); i++) { if (mSuspendedEffects.keyAt(i) == (int)kKeyForSuspendAll) { continue; } types.add(&mSuspendedEffects.valueAt(i)->mType); } for (size_t i = 0; i < types.size(); i++) { setEffectSuspended_l(types[i], false); } ALOGV(""setEffectSuspendedAll_l() remove entry for %08x"", mSuspendedEffects.keyAt(index)); mSuspendedEffects.removeItem((int)kKeyForSuspendAll); } } } ",0 "static bool readBoolFromInt(void const*& buffer, size_t& size) { int32_t i; FlattenableUtils::read(buffer, size, i); return static_cast(i); } ",0 "static bool ndp_msg_check_opts(struct ndp_msg *msg) { unsigned char *ptr = ndp_msg_payload_opts(msg); size_t len = ndp_msg_payload_opts_len(msg); struct ndp_msg_opt_type_info *info; while (len > 0) { uint8_t cur_opt_raw_type = ptr[0]; unsigned int cur_opt_len = ptr[1] << 3; /* convert to bytes */ if (!cur_opt_len) return false; if (len < cur_opt_len) break; info = ndp_msg_opt_type_info_by_raw_type(cur_opt_raw_type); if (info) { if (cur_opt_len < info->raw_struct_size || (info->check_valid && !info->check_valid(ptr))) ptr[0] = __INVALID_OPT_TYPE_MAGIC; } ptr += cur_opt_len; len -= cur_opt_len; } return true; } ",0 "static inline int hci_test_bit(int nr, void *addr) { return *((__u32 *) addr + (nr >> 5)) & ((__u32) 1 << (nr & 31)); } ",0 "static void ToColor_SI8_Alpha(SkColor dst[], const void* src, int width, SkColorTable* ctable) { SkASSERT(width > 0); const uint8_t* s = (const uint8_t*)src; const SkPMColor* colors = ctable->lockColors(); do { *dst++ = SkUnPreMultiply::PMColorToColor(colors[*s++]); } while (--width != 0); ctable->unlockColors(); } ",0 " explicit DummyBrightnessControlDelegate(bool consume) : consume_(consume), handle_brightness_down_count_(0), handle_brightness_up_count_(0) { } ",0 "static int adjust_pool_surplus(struct hstate *h, nodemask_t *nodes_allowed, int delta) { int nr_nodes, node; VM_BUG_ON(delta != -1 && delta != 1); if (delta < 0) { for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { if (h->surplus_huge_pages_node[node]) goto found; } } else { for_each_node_mask_to_free(h, nr_nodes, node, nodes_allowed) { if (h->surplus_huge_pages_node[node] < h->nr_huge_pages_node[node]) goto found; } } return 0; found: h->surplus_huge_pages += delta; h->surplus_huge_pages_node[node] += delta; return 1; } ",0 "ecc_generate (const gcry_sexp_t genparms, gcry_sexp_t *r_skey) { gpg_err_code_t rc; unsigned int nbits; elliptic_curve_t E; ECC_secret_key sk; gcry_mpi_t Gx = NULL; gcry_mpi_t Gy = NULL; gcry_mpi_t Qx = NULL; gcry_mpi_t Qy = NULL; char *curve_name = NULL; gcry_sexp_t l1; mpi_ec_t ctx = NULL; gcry_sexp_t curve_info = NULL; gcry_sexp_t curve_flags = NULL; gcry_mpi_t base = NULL; gcry_mpi_t public = NULL; gcry_mpi_t secret = NULL; int flags = 0; memset (&E, 0, sizeof E); memset (&sk, 0, sizeof sk); rc = _gcry_pk_util_get_nbits (genparms, &nbits); if (rc) return rc; /* Parse the optional ""curve"" parameter. */ l1 = sexp_find_token (genparms, ""curve"", 0); if (l1) { curve_name = _gcry_sexp_nth_string (l1, 1); sexp_release (l1); if (!curve_name) return GPG_ERR_INV_OBJ; /* No curve name or value too large. */ } /* Parse the optional flags list. */ l1 = sexp_find_token (genparms, ""flags"", 0); if (l1) { rc = _gcry_pk_util_parse_flaglist (l1, &flags, NULL); sexp_release (l1); if (rc) goto leave; } /* Parse the deprecated optional transient-key flag. */ l1 = sexp_find_token (genparms, ""transient-key"", 0); if (l1) { flags |= PUBKEY_FLAG_TRANSIENT_KEY; sexp_release (l1); } /* NBITS is required if no curve name has been given. */ if (!nbits && !curve_name) return GPG_ERR_NO_OBJ; /* No NBITS parameter. */ rc = _gcry_ecc_fill_in_curve (nbits, curve_name, &E, &nbits); if (rc) goto leave; if (DBG_CIPHER) { log_debug (""ecgen curve info: %s/%s\n"", _gcry_ecc_model2str (E.model), _gcry_ecc_dialect2str (E.dialect)); if (E.name) log_debug (""ecgen curve used: %s\n"", E.name); log_printmpi (""ecgen curve p"", E.p); log_printmpi (""ecgen curve a"", E.a); log_printmpi (""ecgen curve b"", E.b); log_printmpi (""ecgen curve n"", E.n); log_printmpi (""ecgen curve h"", E.h); log_printpnt (""ecgen curve G"", &E.G, NULL); } ctx = _gcry_mpi_ec_p_internal_new (E.model, E.dialect, flags, E.p, E.a, E.b); if (E.model == MPI_EC_MONTGOMERY) rc = nist_generate_key (&sk, &E, ctx, flags, nbits, &Qx, NULL); else if ((flags & PUBKEY_FLAG_EDDSA)) rc = _gcry_ecc_eddsa_genkey (&sk, &E, ctx, flags); else rc = nist_generate_key (&sk, &E, ctx, flags, nbits, &Qx, &Qy); if (rc) goto leave; /* Copy data to the result. */ Gx = mpi_new (0); Gy = mpi_new (0); if (E.model != MPI_EC_MONTGOMERY) { if (_gcry_mpi_ec_get_affine (Gx, Gy, &sk.E.G, ctx)) log_fatal (""ecgen: Failed to get affine coordinates for %s\n"", ""G""); base = _gcry_ecc_ec2os (Gx, Gy, sk.E.p); } if ((sk.E.dialect == ECC_DIALECT_ED25519 || E.model == MPI_EC_MONTGOMERY) && !(flags & PUBKEY_FLAG_NOCOMP)) { unsigned char *encpk; unsigned int encpklen; if (E.model != MPI_EC_MONTGOMERY) /* (Gx and Gy are used as scratch variables) */ rc = _gcry_ecc_eddsa_encodepoint (&sk.Q, ctx, Gx, Gy, !!(flags & PUBKEY_FLAG_COMP), &encpk, &encpklen); else { encpk = _gcry_mpi_get_buffer_extra (Qx, nbits/8, -1, &encpklen, NULL); if (encpk == NULL) rc = gpg_err_code_from_syserror (); else { encpk[0] = 0x40; encpklen++; } } if (rc) goto leave; public = mpi_new (0); mpi_set_opaque (public, encpk, encpklen*8); } else { if (!Qx) { /* This is the case for a key from _gcry_ecc_eddsa_generate with no compression. */ Qx = mpi_new (0); Qy = mpi_new (0); if (_gcry_mpi_ec_get_affine (Qx, Qy, &sk.Q, ctx)) log_fatal (""ecgen: Failed to get affine coordinates for %s\n"", ""Q""); } public = _gcry_ecc_ec2os (Qx, Qy, sk.E.p); } secret = sk.d; sk.d = NULL; if (E.name) { rc = sexp_build (&curve_info, NULL, ""(curve %s)"", E.name); if (rc) goto leave; } if ((flags & PUBKEY_FLAG_PARAM) || (flags & PUBKEY_FLAG_EDDSA) || (flags & PUBKEY_FLAG_DJB_TWEAK)) { rc = sexp_build (&curve_flags, NULL, ((flags & PUBKEY_FLAG_PARAM) && (flags & PUBKEY_FLAG_EDDSA))? ""(flags param eddsa)"" : ((flags & PUBKEY_FLAG_PARAM) && (flags & PUBKEY_FLAG_EDDSA))? ""(flags param djb-tweak)"" : ((flags & PUBKEY_FLAG_PARAM))? ""(flags param)"" : ((flags & PUBKEY_FLAG_EDDSA))? ""(flags eddsa)"" : ""(flags djb-tweak)"" ); if (rc) goto leave; } if ((flags & PUBKEY_FLAG_PARAM) && E.name) rc = sexp_build (r_skey, NULL, ""(key-data"" "" (public-key"" "" (ecc%S%S(p%m)(a%m)(b%m)(g%m)(n%m)(h%m)(q%m)))"" "" (private-key"" "" (ecc%S%S(p%m)(a%m)(b%m)(g%m)(n%m)(h%m)(q%m)(d%m)))"" "" )"", curve_info, curve_flags, sk.E.p, sk.E.a, sk.E.b, base, sk.E.n, sk.E.h, public, curve_info, curve_flags, sk.E.p, sk.E.a, sk.E.b, base, sk.E.n, sk.E.h, public, secret); else rc = sexp_build (r_skey, NULL, ""(key-data"" "" (public-key"" "" (ecc%S%S(q%m)))"" "" (private-key"" "" (ecc%S%S(q%m)(d%m)))"" "" )"", curve_info, curve_flags, public, curve_info, curve_flags, public, secret); if (rc) goto leave; if (DBG_CIPHER) { log_printmpi (""ecgen result p"", sk.E.p); log_printmpi (""ecgen result a"", sk.E.a); log_printmpi (""ecgen result b"", sk.E.b); log_printmpi (""ecgen result G"", base); log_printmpi (""ecgen result n"", sk.E.n); log_printmpi (""ecgen result h"", sk.E.h); log_printmpi (""ecgen result Q"", public); log_printmpi (""ecgen result d"", secret); if ((flags & PUBKEY_FLAG_EDDSA)) log_debug (""ecgen result using Ed25519+EdDSA\n""); } leave: mpi_free (secret); mpi_free (public); mpi_free (base); { _gcry_ecc_curve_free (&sk.E); point_free (&sk.Q); mpi_free (sk.d); } _gcry_ecc_curve_free (&E); mpi_free (Gx); mpi_free (Gy); mpi_free (Qx); mpi_free (Qy); _gcry_mpi_ec_free (ctx); xfree (curve_name); sexp_release (curve_flags); sexp_release (curve_info); return rc; } ",0 "static PHP_METHOD(PDOStatement, fetchAll) { long how = PDO_FETCH_USE_DEFAULT; zval *data, *return_all; zval *arg2; zend_class_entry *old_ce; zval *old_ctor_args, *ctor_args = NULL; int error = 0, flags, old_arg_count; PHP_STMT_GET_OBJ; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""|lzz"", &how, &arg2, &ctor_args)) { RETURN_FALSE; } if (!pdo_stmt_verify_mode(stmt, how, 1 TSRMLS_CC)) { RETURN_FALSE; } old_ce = stmt->fetch.cls.ce; old_ctor_args = stmt->fetch.cls.ctor_args; old_arg_count = stmt->fetch.cls.fci.param_count; do_fetch_opt_finish(stmt, 0 TSRMLS_CC); switch(how & ~PDO_FETCH_FLAGS) { case PDO_FETCH_CLASS: switch(ZEND_NUM_ARGS()) { case 0: case 1: stmt->fetch.cls.ce = zend_standard_class_def; break; case 3: if (Z_TYPE_P(ctor_args) != IS_NULL && Z_TYPE_P(ctor_args) != IS_ARRAY) { pdo_raise_impl_error(stmt->dbh, stmt, ""HY000"", ""ctor_args must be either NULL or an array"" TSRMLS_CC); error = 1; break; } if (Z_TYPE_P(ctor_args) != IS_ARRAY || !zend_hash_num_elements(Z_ARRVAL_P(ctor_args))) { ctor_args = NULL; } /* no break */ case 2: stmt->fetch.cls.ctor_args = ctor_args; /* we're not going to free these */ if (Z_TYPE_P(arg2) != IS_STRING) { pdo_raise_impl_error(stmt->dbh, stmt, ""HY000"", ""Invalid class name (should be a string)"" TSRMLS_CC); error = 1; break; } else { stmt->fetch.cls.ce = zend_fetch_class(Z_STRVAL_P(arg2), Z_STRLEN_P(arg2), ZEND_FETCH_CLASS_AUTO TSRMLS_CC); if (!stmt->fetch.cls.ce) { pdo_raise_impl_error(stmt->dbh, stmt, ""HY000"", ""could not find user-specified class"" TSRMLS_CC); error = 1; break; } } } if (!error) { do_fetch_class_prepare(stmt TSRMLS_CC); } break; case PDO_FETCH_FUNC: switch(ZEND_NUM_ARGS()) { case 0: case 1: pdo_raise_impl_error(stmt->dbh, stmt, ""HY000"", ""no fetch function specified"" TSRMLS_CC); error = 1; break; case 3: case 2: stmt->fetch.func.function = arg2; if (do_fetch_func_prepare(stmt TSRMLS_CC) == 0) { error = 1; } break; } break; case PDO_FETCH_COLUMN: switch(ZEND_NUM_ARGS()) { case 0: case 1: stmt->fetch.column = how & PDO_FETCH_GROUP ? -1 : 0; break; case 2: convert_to_long(arg2); stmt->fetch.column = Z_LVAL_P(arg2); break; case 3: pdo_raise_impl_error(stmt->dbh, stmt, ""HY000"", ""Third parameter not allowed for PDO::FETCH_COLUMN"" TSRMLS_CC); error = 1; } break; default: if (ZEND_NUM_ARGS() > 1) { pdo_raise_impl_error(stmt->dbh, stmt, ""HY000"", ""Extraneous additional parameters"" TSRMLS_CC); error = 1; } } flags = how & PDO_FETCH_FLAGS; if ((how & ~PDO_FETCH_FLAGS) == PDO_FETCH_USE_DEFAULT) { flags |= stmt->default_fetch_type & PDO_FETCH_FLAGS; how |= stmt->default_fetch_type & ~PDO_FETCH_FLAGS; } if (!error) { PDO_STMT_CLEAR_ERR(); MAKE_STD_ZVAL(data); if ( (how & PDO_FETCH_GROUP) || how == PDO_FETCH_KEY_PAIR || (how == PDO_FETCH_USE_DEFAULT && stmt->default_fetch_type == PDO_FETCH_KEY_PAIR) ) { array_init(return_value); return_all = return_value; } else { return_all = 0; } if (!do_fetch(stmt, TRUE, data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC)) { FREE_ZVAL(data); error = 2; } } if (!error) { if ((how & PDO_FETCH_GROUP)) { do { MAKE_STD_ZVAL(data); } while (do_fetch(stmt, TRUE, data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC)); } else if (how == PDO_FETCH_KEY_PAIR || (how == PDO_FETCH_USE_DEFAULT && stmt->default_fetch_type == PDO_FETCH_KEY_PAIR)) { while (do_fetch(stmt, TRUE, data, how | flags, PDO_FETCH_ORI_NEXT, 0, return_all TSRMLS_CC)); } else { array_init(return_value); do { add_next_index_zval(return_value, data); MAKE_STD_ZVAL(data); } while (do_fetch(stmt, TRUE, data, how | flags, PDO_FETCH_ORI_NEXT, 0, 0 TSRMLS_CC)); } FREE_ZVAL(data); } do_fetch_opt_finish(stmt, 0 TSRMLS_CC); stmt->fetch.cls.ce = old_ce; stmt->fetch.cls.ctor_args = old_ctor_args; stmt->fetch.cls.fci.param_count = old_arg_count; if (error) { PDO_HANDLE_STMT_ERR(); if (error != 2) { RETURN_FALSE; } else { /* on no results, return an empty array */ if (Z_TYPE_P(return_value) != IS_ARRAY) { array_init(return_value); } return; } } } ",0 "static struct user_ta_elf *ta_elf(const TEE_UUID *uuid, struct user_ta_ctx *utc) { struct user_ta_elf *elf; elf = find_ta_elf(uuid, utc); if (elf) goto out; elf = calloc(1, sizeof(*elf)); if (!elf) goto out; elf->uuid = *uuid; TAILQ_INSERT_TAIL(&utc->elfs, elf, link); out: return elf; } ",0 "static int fill_in_write_vector(struct kvec *vec, struct nfsd4_write *write) { int i = 1; int buflen = write->wr_buflen; vec[0].iov_base = write->wr_head.iov_base; vec[0].iov_len = min_t(int, buflen, write->wr_head.iov_len); buflen -= vec[0].iov_len; while (buflen) { vec[i].iov_base = page_address(write->wr_pagelist[i - 1]); vec[i].iov_len = min_t(int, PAGE_SIZE, buflen); buflen -= vec[i].iov_len; i++; } return i; } ",0 "static int skb_checksum_setup_ipv6(struct sk_buff *skb, bool recalculate) { int err; u8 nexthdr; unsigned int off; unsigned int len; bool fragment; bool done; __sum16 *csum; fragment = false; done = false; off = sizeof(struct ipv6hdr); err = skb_maybe_pull_tail(skb, off, MAX_IPV6_HDR_LEN); if (err < 0) goto out; nexthdr = ipv6_hdr(skb)->nexthdr; len = sizeof(struct ipv6hdr) + ntohs(ipv6_hdr(skb)->payload_len); while (off <= len && !done) { switch (nexthdr) { case IPPROTO_DSTOPTS: case IPPROTO_HOPOPTS: case IPPROTO_ROUTING: { struct ipv6_opt_hdr *hp; err = skb_maybe_pull_tail(skb, off + sizeof(struct ipv6_opt_hdr), MAX_IPV6_HDR_LEN); if (err < 0) goto out; hp = OPT_HDR(struct ipv6_opt_hdr, skb, off); nexthdr = hp->nexthdr; off += ipv6_optlen(hp); break; } case IPPROTO_AH: { struct ip_auth_hdr *hp; err = skb_maybe_pull_tail(skb, off + sizeof(struct ip_auth_hdr), MAX_IPV6_HDR_LEN); if (err < 0) goto out; hp = OPT_HDR(struct ip_auth_hdr, skb, off); nexthdr = hp->nexthdr; off += ipv6_authlen(hp); break; } case IPPROTO_FRAGMENT: { struct frag_hdr *hp; err = skb_maybe_pull_tail(skb, off + sizeof(struct frag_hdr), MAX_IPV6_HDR_LEN); if (err < 0) goto out; hp = OPT_HDR(struct frag_hdr, skb, off); if (hp->frag_off & htons(IP6_OFFSET | IP6_MF)) fragment = true; nexthdr = hp->nexthdr; off += sizeof(struct frag_hdr); break; } default: done = true; break; } } err = -EPROTO; if (!done || fragment) goto out; csum = skb_checksum_setup_ip(skb, nexthdr, off); if (IS_ERR(csum)) return PTR_ERR(csum); if (recalculate) *csum = ~csum_ipv6_magic(&ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr, skb->len - off, nexthdr, 0); err = 0; out: return err; } ",0 " ProxyPlatform() : m_platform(blink::Platform::current()), m_elapsedSeconds(0.) { } ",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); } } ",0 "static pfn_t spte_to_pfn(u64 pte) { return (pte & PT64_BASE_ADDR_MASK) >> PAGE_SHIFT; } ",0 "static pid_t get_task_reaper_pid(pid_t task) { int sock[2]; pid_t pid; pid_t ret = -1; char v = '0'; struct ucred cred; if (socketpair(AF_UNIX, SOCK_DGRAM, 0, sock) < 0) { perror(""socketpair""); return -1; } pid = fork(); if (pid < 0) goto out; if (!pid) { close(sock[1]); write_task_init_pid_exit(sock[0], task); } if (!recv_creds(sock[1], &cred, &v)) goto out; ret = cred.pid; out: close(sock[0]); close(sock[1]); return ret; } ",0 "uoff_t str_to_uofft(const char *str) { #ifdef UOFF_T_LONG_LONG return (uoff_t)strtoull(str, NULL, 10); #else return (uoff_t)strtoul(str, NULL, 10); #endif } ",0 "SubstituteData FrameLoader::defaultSubstituteDataForURL(const KURL& url) { if (!shouldTreatURLAsSrcdocDocument(url)) return SubstituteData(); String srcdoc = m_frame->ownerElement()->fastGetAttribute(srcdocAttr); ASSERT(!srcdoc.isNull()); CString encodedSrcdoc = srcdoc.utf8(); return SubstituteData(SharedBuffer::create(encodedSrcdoc.data(), encodedSrcdoc.length()), ""text/html"", ""UTF-8"", KURL()); } ",0 "static int emulator_has_longmode(struct x86_emulate_ctxt *ctxt) { u32 eax, ebx, ecx, edx; eax = 0x80000001; ecx = 0; ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx); return edx & bit(X86_FEATURE_LM); } ",0 "void HTMLPreloadScanner::processToken() { if (m_inStyle) { if (m_token.type() == HTMLTokenTypes::Character) m_cssScanner.scan(m_token); else if (m_token.type() == HTMLTokenTypes::EndTag) { m_inStyle = false; m_cssScanner.reset(); } } if (m_token.type() != HTMLTokenTypes::StartTag) return; PreloadTask task(m_token); m_tokenizer->updateStateFor(task.tagName()); if (task.tagName() == styleTag) m_inStyle = true; if (task.tagName() == baseTag) updatePredictedBaseElementURL(KURL(m_document->url(), task.baseElementHref())); task.preload(m_document, m_predictedBaseElementURL.isEmpty() ? m_document->baseURL() : m_predictedBaseElementURL); } ",1 "void set_breakpoint(struct arch_hw_breakpoint *brk) { preempt_disable(); __set_breakpoint(brk); preempt_enable(); } ",0 "mrb_obj_is_instance_of(mrb_state *mrb, mrb_value obj, struct RClass* c) { if (mrb_obj_class(mrb, obj) == c) return TRUE; return FALSE; } ",0 "static Layer* FindFirstScrollableLayer(Layer* layer) { if (!layer) return NULL; if (layer->scrollable()) return layer; for (size_t i = 0; i < layer->children().size(); ++i) { Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); if (found) return found; } return NULL; } ",0 "static void replaceableReadonlyLongAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueInt(info, imp->replaceableReadonlyLongAttribute()); } ",0 "static void focus(WKPageRef page, const void* clientInfo) { PlatformWebView* view = static_cast(const_cast(clientInfo)); view->focus(); view->setWindowIsKey(true); } ",0 "PHP_FUNCTION(stream_resolve_include_path) { char *filename, *resolved_path; int filename_len; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &filename, &filename_len) == FAILURE) { return; } resolved_path = zend_resolve_path(filename, filename_len TSRMLS_CC); if (resolved_path) { RETURN_STRING(resolved_path, 0); } RETURN_FALSE; } ",1 "bool BlobURLRequestJob::ReadItem() { if (remaining_bytes_ == 0) return true; if (current_item_index_ >= blob_data_->items().size()) { NotifyFailure(net::ERR_FAILED); return false; } int bytes_to_read = ComputeBytesToRead(); if (bytes_to_read == 0) { AdvanceItem(); return ReadItem(); } const BlobData::Item& item = blob_data_->items().at(current_item_index_); if (item.type() == BlobData::Item::TYPE_BYTES) return ReadBytesItem(item, bytes_to_read); if (IsFileType(item.type())) { return ReadFileItem(GetFileStreamReader(current_item_index_), bytes_to_read); } NOTREACHED(); return false; } ",0 "int SSLClientSocketOpenSSL::Write(IOBuffer* buf, int buf_len, const CompletionCallback& callback) { user_write_buf_ = buf; user_write_buf_len_ = buf_len; int rv = DoWriteLoop(OK); if (rv == ERR_IO_PENDING) { user_write_callback_ = callback; } else { user_write_buf_ = NULL; user_write_buf_len_ = 0; } return rv; } ",0 "AP_DECLARE(long) ap_get_client_block(request_rec *r, char *buffer, apr_size_t bufsiz) { apr_status_t rv; apr_bucket_brigade *bb; if (r->remaining < 0 || (!r->read_chunked && r->remaining == 0)) { return 0; } bb = apr_brigade_create(r->pool, r->connection->bucket_alloc); if (bb == NULL) { r->connection->keepalive = AP_CONN_CLOSE; return -1; } rv = ap_get_brigade(r->input_filters, bb, AP_MODE_READBYTES, APR_BLOCK_READ, bufsiz); /* We lose the failure code here. This is why ap_get_client_block should * not be used. */ if (rv == AP_FILTER_ERROR) { /* AP_FILTER_ERROR means a filter has responded already, * we are DONE. */ apr_brigade_destroy(bb); return -1; } if (rv != APR_SUCCESS) { apr_bucket *e; /* work around our silent swallowing of error messages by mapping * error codes at this point, and sending an error bucket back * upstream. */ apr_brigade_cleanup(bb); e = ap_bucket_error_create( ap_map_http_request_error(rv, HTTP_BAD_REQUEST), NULL, r->pool, r->connection->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, e); e = apr_bucket_eos_create(r->connection->bucket_alloc); APR_BRIGADE_INSERT_TAIL(bb, e); rv = ap_pass_brigade(r->output_filters, bb); if (APR_SUCCESS != rv) { ap_log_rerror(APLOG_MARK, APLOG_INFO, rv, r, APLOGNO(02484) ""Error while writing error response""); } /* if we actually fail here, we want to just return and * stop trying to read data from the client. */ r->connection->keepalive = AP_CONN_CLOSE; apr_brigade_destroy(bb); return -1; } /* If this fails, it means that a filter is written incorrectly and that * it needs to learn how to properly handle APR_BLOCK_READ requests by * returning data when requested. */ AP_DEBUG_ASSERT(!APR_BRIGADE_EMPTY(bb)); /* Check to see if EOS in the brigade. * * If so, we have to leave a nugget for the *next* ap_get_client_block * call to return 0. */ if (APR_BUCKET_IS_EOS(APR_BRIGADE_LAST(bb))) { if (r->read_chunked) { r->remaining = -1; } else { r->remaining = 0; } } rv = apr_brigade_flatten(bb, buffer, &bufsiz); if (rv != APR_SUCCESS) { apr_brigade_destroy(bb); return -1; } /* XXX yank me? */ r->read_length += bufsiz; apr_brigade_destroy(bb); return bufsiz; } ",0 "void InfoBar::AnimateClose() { bool restore_focus = true; #if defined(OS_WIN) if (GetWidget() && !ui::DoesWindowBelongToActiveWindow(GetWidget()->GetNativeView())) { restore_focus = false; } #endif // defined(OS_WIN) DestroyFocusTracker(restore_focus); animation_->Hide(); } ",0 "PHP_FUNCTION(call_user_func_array) { zval *params, *retval_ptr = NULL; zend_fcall_info fci; zend_fcall_info_cache fci_cache; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""fa/"", &fci, &fci_cache, ¶ms) == FAILURE) { return; } zend_fcall_info_args(&fci, params TSRMLS_CC); fci.retval_ptr_ptr = &retval_ptr; if (zend_call_function(&fci, &fci_cache TSRMLS_CC) == SUCCESS && fci.retval_ptr_ptr && *fci.retval_ptr_ptr) { COPY_PZVAL_TO_ZVAL(*return_value, *fci.retval_ptr_ptr); } zend_fcall_info_args_clear(&fci, 1); } ",0 "__releases(bitlock) __acquires(bitlock) { struct va_format vaf; va_list args; struct ext4_super_block *es = EXT4_SB(sb)->s_es; es->s_last_error_ino = cpu_to_le32(ino); es->s_last_error_block = cpu_to_le64(block); __save_error_info(sb, function, line); va_start(args, fmt); vaf.fmt = fmt; vaf.va = &args; printk(KERN_CRIT ""EXT4-fs error (device %s): %s:%d: group %u, "", sb->s_id, function, line, grp); if (ino) printk(KERN_CONT ""inode %lu: "", ino); if (block) printk(KERN_CONT ""block %llu:"", (unsigned long long) block); printk(KERN_CONT ""%pV\n"", &vaf); va_end(args); if (test_opt(sb, ERRORS_CONT)) { ext4_commit_super(sb, 0); return; } ext4_unlock_group(sb, grp); ext4_handle_error(sb); /* * We only get here in the ERRORS_RO case; relocking the group * may be dangerous, but nothing bad will happen since the * filesystem will have already been marked read/only and the * journal has been aborted. We return 1 as a hint to callers * who might what to use the return value from * ext4_grp_locked_error() to distinguish between the * ERRORS_CONT and ERRORS_RO case, and perhaps return more * aggressively from the ext4 function in question, with a * more appropriate error code. */ ext4_lock_group(sb, grp); return; } ",0 "PHP_FUNCTION(imagexbm) { _php_image_output_ctx(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_XBM, ""XBM"", gdImageXbmCtx); } ",0 "const String& ContentSecurityPolicy::getSelfProtocol() const { return m_selfProtocol; } ",0 "static char *skip_over_blank(char *cp) { while (*cp && isspace(*cp)) cp++; return cp; } ",0 "DisplayItemClient& TestPaintArtifact::NewClient() { dummy_clients_.push_back(std::make_unique()); return *dummy_clients_.back(); } ",0 "void FileAPIMessageFilter::OnTouchFile( int request_id, const GURL& path, const base::Time& last_access_time, const base::Time& last_modified_time) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); FileSystemURL url(path); base::PlatformFileError error; if (!HasPermissionsForFile(url, kCreateFilePermissions, &error)) { Send(new FileSystemMsg_DidFail(request_id, error)); return; } FileSystemOperation* operation = GetNewOperation(url, request_id); if (!operation) return; operation->TouchFile( url, last_access_time, last_modified_time, base::Bind(&FileAPIMessageFilter::DidFinish, this, request_id)); } ",0 "static void set_ftrace_pid_task(struct pid *pid) { if (pid == ftrace_swapper_pid) set_ftrace_swapper(); else set_ftrace_pid(pid); } ",0 "static VP8Frame *vp8_find_free_buffer(VP8Context *s) { VP8Frame *frame = NULL; int i; for (i = 0; i < 5; i++) if (&s->frames[i] != s->framep[VP56_FRAME_CURRENT] && &s->frames[i] != s->framep[VP56_FRAME_PREVIOUS] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN] && &s->frames[i] != s->framep[VP56_FRAME_GOLDEN2]) { frame = &s->frames[i]; break; } if (i == 5) { av_log(s->avctx, AV_LOG_FATAL, ""Ran out of free frames!\n""); abort(); } if (frame->tf.f->data[0]) vp8_release_frame(s, frame); return frame; } ",0 "GF_Err stsg_dump(GF_Box *a, FILE * trace) { u32 i; GF_SubTrackSampleGroupBox *p = (GF_SubTrackSampleGroupBox *)a; gf_isom_box_dump_start(a, ""SubTrackSampleGroupBox"", trace); if (p->grouping_type) fprintf(trace, ""grouping_type=\""%s\"""", gf_4cc_to_str(p->grouping_type) ); fprintf(trace, "">\n""); for (i = 0; i < p->nb_groups; i++) { fprintf(trace, ""\n"", p->group_description_index[i]); } if (!p->size) fprintf(trace, ""\n""); gf_isom_box_dump_done(""SubTrackSampleGroupBox"", a, trace); return GF_OK; } ",0 "LocalFrameClient* LocalFrame::Client() const { return static_cast(Frame::Client()); } ",0 "static ssize_t unix_stream_sendpage(struct socket *socket, struct page *page, int offset, size_t size, int flags) { int err; bool send_sigpipe = false; bool init_scm = true; struct scm_cookie scm; struct sock *other, *sk = socket->sk; struct sk_buff *skb, *newskb = NULL, *tail = NULL; if (flags & MSG_OOB) return -EOPNOTSUPP; other = unix_peer(sk); if (!other || sk->sk_state != TCP_ESTABLISHED) return -ENOTCONN; if (false) { alloc_skb: unix_state_unlock(other); mutex_unlock(&unix_sk(other)->readlock); newskb = sock_alloc_send_pskb(sk, 0, 0, flags & MSG_DONTWAIT, &err, 0); if (!newskb) goto err; } /* we must acquire readlock as we modify already present * skbs in the sk_receive_queue and mess with skb->len */ err = mutex_lock_interruptible(&unix_sk(other)->readlock); if (err) { err = flags & MSG_DONTWAIT ? -EAGAIN : -ERESTARTSYS; goto err; } if (sk->sk_shutdown & SEND_SHUTDOWN) { err = -EPIPE; send_sigpipe = true; goto err_unlock; } unix_state_lock(other); if (sock_flag(other, SOCK_DEAD) || other->sk_shutdown & RCV_SHUTDOWN) { err = -EPIPE; send_sigpipe = true; goto err_state_unlock; } if (init_scm) { err = maybe_init_creds(&scm, socket, other); if (err) goto err_state_unlock; init_scm = false; } skb = skb_peek_tail(&other->sk_receive_queue); if (tail && tail == skb) { skb = newskb; } else if (!skb || !unix_skb_scm_eq(skb, &scm)) { if (newskb) { skb = newskb; } else { tail = skb; goto alloc_skb; } } else if (newskb) { /* this is fast path, we don't necessarily need to * call to kfree_skb even though with newskb == NULL * this - does no harm */ consume_skb(newskb); newskb = NULL; } if (skb_append_pagefrags(skb, page, offset, size)) { tail = skb; goto alloc_skb; } skb->len += size; skb->data_len += size; skb->truesize += size; atomic_add(size, &sk->sk_wmem_alloc); if (newskb) { err = unix_scm_to_skb(&scm, skb, false); if (err) goto err_state_unlock; spin_lock(&other->sk_receive_queue.lock); __skb_queue_tail(&other->sk_receive_queue, newskb); spin_unlock(&other->sk_receive_queue.lock); } unix_state_unlock(other); mutex_unlock(&unix_sk(other)->readlock); other->sk_data_ready(other); scm_destroy(&scm); return size; err_state_unlock: unix_state_unlock(other); err_unlock: mutex_unlock(&unix_sk(other)->readlock); err: kfree_skb(newskb); if (send_sigpipe && !(flags & MSG_NOSIGNAL)) send_sig(SIGPIPE, current, 0); if (!init_scm) scm_destroy(&scm); return err; } ",0 "void WebPageProxy::didChooseFilesForOpenPanel(const Vector& fileURLs) { if (!isValid()) return; #if ENABLE(WEB_PROCESS_SANDBOX) for (size_t i = 0; i < fileURLs.size(); ++i) { SandboxExtension::Handle sandboxExtensionHandle; SandboxExtension::createHandle(fileURLs[i], SandboxExtension::ReadOnly, sandboxExtensionHandle); process()->send(Messages::WebPage::ExtendSandboxForFileFromOpenPanel(sandboxExtensionHandle), m_pageID); } #endif process()->send(Messages::WebPage::DidChooseFilesForOpenPanel(fileURLs), m_pageID); m_openPanelResultListener->invalidate(); m_openPanelResultListener = 0; } ",0 "void DownloadItemImpl::SetDisplayName(const base::FilePath& name) { display_name_ = name; } ",0 "void Pack(const uint8_t* source, uint16_t* destination, unsigned pixels_per_row) { for (unsigned i = 0; i < pixels_per_row; ++i) { float scale_factor = source[3] / 255.0f; uint8_t source_r = static_cast(static_cast(source[0]) * scale_factor); uint8_t source_g = static_cast(static_cast(source[1]) * scale_factor); uint8_t source_b = static_cast(static_cast(source[2]) * scale_factor); *destination = (((source_r & 0xF8) << 8) | ((source_g & 0xF8) << 3) | ((source_b & 0xF8) >> 2) | (source[3] >> 7)); source += 4; destination += 1; } } ",0 "static inline struct shmid_kernel *shm_lock(struct ipc_namespace *ns, int id) { struct kern_ipc_perm *ipcp = ipc_lock(&shm_ids(ns), id); /* * Callers of shm_lock() must validate the status of the returned ipc * object pointer (as returned by ipc_lock()), and error out as * appropriate. */ if (IS_ERR(ipcp)) return (void *)ipcp; return container_of(ipcp, struct shmid_kernel, shm_perm); } ",0 "bool GLSurfaceOzoneSurfacelessSurfaceImpl::IsSurfaceless() const { return false; } ",0 "ia64_patch_vtop (unsigned long start, unsigned long end) { s32 *offp = (s32 *) start; u64 ip; while (offp < (s32 *) end) { ip = (u64) offp + *offp; /* replace virtual address with corresponding physical address: */ ia64_patch_imm64(ip, ia64_tpa(get_imm64(ip))); ia64_fc((void *) ip); ++offp; } ia64_sync_i(); ia64_srlz_i(); } ",0 "int CL_ScaledMilliseconds( void ) { return Sys_Milliseconds() * com_timescale->value; } ",0 "spnego_gss_set_sec_context_option( OM_uint32 *minor_status, gss_ctx_id_t *context_handle, const gss_OID desired_object, const gss_buffer_t value) { OM_uint32 ret; ret = gss_set_sec_context_option(minor_status, context_handle, desired_object, value); return (ret); } ",1 "void RenderViewImpl::OnSetCompositionFromExistingText( int start, int end, const std::vector& underlines) { if (!webview()) return; webview()->setCompositionFromExistingText(start, end, underlines); } ",0 "AXObject* AXNodeObject::computeParent() const { ASSERT(!isDetached()); if (Node* parentNode = getParentNodeForComputeParent(getNode())) return axObjectCache().getOrCreate(parentNode); return nullptr; } ",0 "static void CustomGetterLongAttributeAttributeSetter( v8::Local v8_value, const v8::FunctionCallbackInfo& info) { v8::Isolate* isolate = info.GetIsolate(); ALLOW_UNUSED_LOCAL(isolate); v8::Local holder = info.Holder(); ALLOW_UNUSED_LOCAL(holder); TestObject* impl = V8TestObject::ToImpl(holder); ExceptionState exception_state(isolate, ExceptionState::kSetterContext, ""TestObject"", ""customGetterLongAttribute""); int32_t cpp_value = NativeValueTraits::NativeValue(info.GetIsolate(), v8_value, exception_state); if (exception_state.HadException()) return; impl->setCustomGetterLongAttribute(cpp_value); } ",0 "static void gcm_hash_assoc_done(struct crypto_async_request *areq, int err) { struct aead_request *req = areq->data; __gcm_hash_assoc_done(req, err); } ",0 "pgm_print(netdissect_options *ndo, register const u_char *bp, register u_int length, register const u_char *bp2) { register const struct pgm_header *pgm; register const struct ip *ip; register char ch; uint16_t sport, dport; u_int nla_afnum; char nla_buf[INET6_ADDRSTRLEN]; register const struct ip6_hdr *ip6; uint8_t opt_type, opt_len; uint32_t seq, opts_len, len, offset; pgm = (const struct pgm_header *)bp; ip = (const struct ip *)bp2; if (IP_V(ip) == 6) ip6 = (const struct ip6_hdr *)bp2; else ip6 = NULL; ch = '\0'; if (!ND_TTEST(pgm->pgm_dport)) { if (ip6) { ND_PRINT((ndo, ""%s > %s: [|pgm]"", ip6addr_string(ndo, &ip6->ip6_src), ip6addr_string(ndo, &ip6->ip6_dst))); return; } else { ND_PRINT((ndo, ""%s > %s: [|pgm]"", ipaddr_string(ndo, &ip->ip_src), ipaddr_string(ndo, &ip->ip_dst))); return; } } sport = EXTRACT_16BITS(&pgm->pgm_sport); dport = EXTRACT_16BITS(&pgm->pgm_dport); if (ip6) { if (ip6->ip6_nxt == IPPROTO_PGM) { ND_PRINT((ndo, ""%s.%s > %s.%s: "", ip6addr_string(ndo, &ip6->ip6_src), tcpport_string(ndo, sport), ip6addr_string(ndo, &ip6->ip6_dst), tcpport_string(ndo, dport))); } else { ND_PRINT((ndo, ""%s > %s: "", tcpport_string(ndo, sport), tcpport_string(ndo, dport))); } } else { if (ip->ip_p == IPPROTO_PGM) { ND_PRINT((ndo, ""%s.%s > %s.%s: "", ipaddr_string(ndo, &ip->ip_src), tcpport_string(ndo, sport), ipaddr_string(ndo, &ip->ip_dst), tcpport_string(ndo, dport))); } else { ND_PRINT((ndo, ""%s > %s: "", tcpport_string(ndo, sport), tcpport_string(ndo, dport))); } } ND_TCHECK(*pgm); ND_PRINT((ndo, ""PGM, length %u"", EXTRACT_16BITS(&pgm->pgm_length))); if (!ndo->ndo_vflag) return; ND_PRINT((ndo, "" 0x%02x%02x%02x%02x%02x%02x "", pgm->pgm_gsid[0], pgm->pgm_gsid[1], pgm->pgm_gsid[2], pgm->pgm_gsid[3], pgm->pgm_gsid[4], pgm->pgm_gsid[5])); switch (pgm->pgm_type) { case PGM_SPM: { const struct pgm_spm *spm; spm = (const struct pgm_spm *)(pgm + 1); ND_TCHECK(*spm); bp = (const u_char *) (spm + 1); switch (EXTRACT_16BITS(&spm->pgms_nla_afi)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in_addr); break; case AFNUM_INET6: ND_TCHECK2(*bp, sizeof(struct in6_addr)); addrtostr6(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in6_addr); break; default: goto trunc; break; } ND_PRINT((ndo, ""SPM seq %u trail %u lead %u nla %s"", EXTRACT_32BITS(&spm->pgms_seq), EXTRACT_32BITS(&spm->pgms_trailseq), EXTRACT_32BITS(&spm->pgms_leadseq), nla_buf)); break; } case PGM_POLL: { const struct pgm_poll *poll_msg; poll_msg = (const struct pgm_poll *)(pgm + 1); ND_TCHECK(*poll_msg); ND_PRINT((ndo, ""POLL seq %u round %u"", EXTRACT_32BITS(&poll_msg->pgmp_seq), EXTRACT_16BITS(&poll_msg->pgmp_round))); bp = (const u_char *) (poll_msg + 1); break; } case PGM_POLR: { const struct pgm_polr *polr; uint32_t ivl, rnd, mask; polr = (const struct pgm_polr *)(pgm + 1); ND_TCHECK(*polr); bp = (const u_char *) (polr + 1); switch (EXTRACT_16BITS(&polr->pgmp_nla_afi)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in_addr); break; case AFNUM_INET6: ND_TCHECK2(*bp, sizeof(struct in6_addr)); addrtostr6(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in6_addr); break; default: goto trunc; break; } ND_TCHECK2(*bp, sizeof(uint32_t)); ivl = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_TCHECK2(*bp, sizeof(uint32_t)); rnd = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_TCHECK2(*bp, sizeof(uint32_t)); mask = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, ""POLR seq %u round %u nla %s ivl %u rnd 0x%08x "" ""mask 0x%08x"", EXTRACT_32BITS(&polr->pgmp_seq), EXTRACT_16BITS(&polr->pgmp_round), nla_buf, ivl, rnd, mask)); break; } case PGM_ODATA: { const struct pgm_data *odata; odata = (const struct pgm_data *)(pgm + 1); ND_TCHECK(*odata); ND_PRINT((ndo, ""ODATA trail %u seq %u"", EXTRACT_32BITS(&odata->pgmd_trailseq), EXTRACT_32BITS(&odata->pgmd_seq))); bp = (const u_char *) (odata + 1); break; } case PGM_RDATA: { const struct pgm_data *rdata; rdata = (const struct pgm_data *)(pgm + 1); ND_TCHECK(*rdata); ND_PRINT((ndo, ""RDATA trail %u seq %u"", EXTRACT_32BITS(&rdata->pgmd_trailseq), EXTRACT_32BITS(&rdata->pgmd_seq))); bp = (const u_char *) (rdata + 1); break; } case PGM_NAK: case PGM_NULLNAK: case PGM_NCF: { const struct pgm_nak *nak; char source_buf[INET6_ADDRSTRLEN], group_buf[INET6_ADDRSTRLEN]; nak = (const struct pgm_nak *)(pgm + 1); ND_TCHECK(*nak); bp = (const u_char *) (nak + 1); /* * Skip past the source, saving info along the way * and stopping if we don't have enough. */ switch (EXTRACT_16BITS(&nak->pgmn_source_afi)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, source_buf, sizeof(source_buf)); bp += sizeof(struct in_addr); break; case AFNUM_INET6: ND_TCHECK2(*bp, sizeof(struct in6_addr)); addrtostr6(bp, source_buf, sizeof(source_buf)); bp += sizeof(struct in6_addr); break; default: goto trunc; break; } /* * Skip past the group, saving info along the way * and stopping if we don't have enough. */ bp += (2 * sizeof(uint16_t)); switch (EXTRACT_16BITS(bp)) { case AFNUM_INET: ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, group_buf, sizeof(group_buf)); bp += sizeof(struct in_addr); break; case AFNUM_INET6: ND_TCHECK2(*bp, sizeof(struct in6_addr)); addrtostr6(bp, group_buf, sizeof(group_buf)); bp += sizeof(struct in6_addr); break; default: goto trunc; break; } /* * Options decoding can go here. */ switch (pgm->pgm_type) { case PGM_NAK: ND_PRINT((ndo, ""NAK "")); break; case PGM_NULLNAK: ND_PRINT((ndo, ""NNAK "")); break; case PGM_NCF: ND_PRINT((ndo, ""NCF "")); break; default: break; } ND_PRINT((ndo, ""(%s -> %s), seq %u"", source_buf, group_buf, EXTRACT_32BITS(&nak->pgmn_seq))); break; } case PGM_ACK: { const struct pgm_ack *ack; ack = (const struct pgm_ack *)(pgm + 1); ND_TCHECK(*ack); ND_PRINT((ndo, ""ACK seq %u"", EXTRACT_32BITS(&ack->pgma_rx_max_seq))); bp = (const u_char *) (ack + 1); break; } case PGM_SPMR: ND_PRINT((ndo, ""SPMR"")); break; default: ND_PRINT((ndo, ""UNKNOWN type 0x%02x"", pgm->pgm_type)); break; } if (pgm->pgm_options & PGM_OPT_BIT_PRESENT) { /* * make sure there's enough for the first option header */ if (!ND_TTEST2(*bp, PGM_MIN_OPT_LEN)) { ND_PRINT((ndo, ""[|OPT]"")); return; } /* * That option header MUST be an OPT_LENGTH option * (see the first paragraph of section 9.1 in RFC 3208). */ opt_type = *bp++; if ((opt_type & PGM_OPT_MASK) != PGM_OPT_LENGTH) { ND_PRINT((ndo, ""[First option bad, should be PGM_OPT_LENGTH, is %u]"", opt_type & PGM_OPT_MASK)); return; } opt_len = *bp++; if (opt_len != 4) { ND_PRINT((ndo, ""[Bad OPT_LENGTH option, length %u != 4]"", opt_len)); return; } opts_len = EXTRACT_16BITS(bp); if (opts_len < 4) { ND_PRINT((ndo, ""[Bad total option length %u < 4]"", opts_len)); return; } bp += sizeof(uint16_t); ND_PRINT((ndo, "" OPTS LEN %d"", opts_len)); opts_len -= 4; while (opts_len) { if (opts_len < PGM_MIN_OPT_LEN) { ND_PRINT((ndo, ""[Total option length leaves no room for final option]"")); return; } opt_type = *bp++; opt_len = *bp++; if (opt_len < PGM_MIN_OPT_LEN) { ND_PRINT((ndo, ""[Bad option, length %u < %u]"", opt_len, PGM_MIN_OPT_LEN)); break; } if (opts_len < opt_len) { ND_PRINT((ndo, ""[Total option length leaves no room for final option]"")); return; } if (!ND_TTEST2(*bp, opt_len - 2)) { ND_PRINT((ndo, "" [|OPT]"")); return; } switch (opt_type & PGM_OPT_MASK) { case PGM_OPT_LENGTH: if (opt_len != 4) { ND_PRINT((ndo, ""[Bad OPT_LENGTH option, length %u != 4]"", opt_len)); return; } ND_PRINT((ndo, "" OPTS LEN (extra?) %d"", EXTRACT_16BITS(bp))); bp += sizeof(uint16_t); opts_len -= 4; break; case PGM_OPT_FRAGMENT: if (opt_len != 16) { ND_PRINT((ndo, ""[Bad OPT_FRAGMENT option, length %u != 16]"", opt_len)); return; } bp += 2; seq = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); offset = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); len = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "" FRAG seq %u off %u len %u"", seq, offset, len)); opts_len -= 16; break; case PGM_OPT_NAK_LIST: bp += 2; opt_len -= sizeof(uint32_t); /* option header */ ND_PRINT((ndo, "" NAK LIST"")); while (opt_len) { if (opt_len < sizeof(uint32_t)) { ND_PRINT((ndo, ""[Option length not a multiple of 4]"")); return; } ND_TCHECK2(*bp, sizeof(uint32_t)); ND_PRINT((ndo, "" %u"", EXTRACT_32BITS(bp))); bp += sizeof(uint32_t); opt_len -= sizeof(uint32_t); opts_len -= sizeof(uint32_t); } break; case PGM_OPT_JOIN: if (opt_len != 8) { ND_PRINT((ndo, ""[Bad OPT_JOIN option, length %u != 8]"", opt_len)); return; } bp += 2; seq = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "" JOIN %u"", seq)); opts_len -= 8; break; case PGM_OPT_NAK_BO_IVL: if (opt_len != 12) { ND_PRINT((ndo, ""[Bad OPT_NAK_BO_IVL option, length %u != 12]"", opt_len)); return; } bp += 2; offset = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); seq = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "" BACKOFF ivl %u ivlseq %u"", offset, seq)); opts_len -= 12; break; case PGM_OPT_NAK_BO_RNG: if (opt_len != 12) { ND_PRINT((ndo, ""[Bad OPT_NAK_BO_RNG option, length %u != 12]"", opt_len)); return; } bp += 2; offset = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); seq = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "" BACKOFF max %u min %u"", offset, seq)); opts_len -= 12; break; case PGM_OPT_REDIRECT: bp += 2; nla_afnum = EXTRACT_16BITS(bp); bp += (2 * sizeof(uint16_t)); switch (nla_afnum) { case AFNUM_INET: if (opt_len != 4 + sizeof(struct in_addr)) { ND_PRINT((ndo, ""[Bad OPT_REDIRECT option, length %u != 4 + address size]"", opt_len)); return; } ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in_addr); opts_len -= 4 + sizeof(struct in_addr); break; case AFNUM_INET6: if (opt_len != 4 + sizeof(struct in6_addr)) { ND_PRINT((ndo, ""[Bad OPT_REDIRECT option, length %u != 4 + address size]"", opt_len)); return; } ND_TCHECK2(*bp, sizeof(struct in6_addr)); addrtostr6(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in6_addr); opts_len -= 4 + sizeof(struct in6_addr); break; default: goto trunc; break; } ND_PRINT((ndo, "" REDIRECT %s"", nla_buf)); break; case PGM_OPT_PARITY_PRM: if (opt_len != 8) { ND_PRINT((ndo, ""[Bad OPT_PARITY_PRM option, length %u != 8]"", opt_len)); return; } bp += 2; len = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "" PARITY MAXTGS %u"", len)); opts_len -= 8; break; case PGM_OPT_PARITY_GRP: if (opt_len != 8) { ND_PRINT((ndo, ""[Bad OPT_PARITY_GRP option, length %u != 8]"", opt_len)); return; } bp += 2; seq = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "" PARITY GROUP %u"", seq)); opts_len -= 8; break; case PGM_OPT_CURR_TGSIZE: if (opt_len != 8) { ND_PRINT((ndo, ""[Bad OPT_CURR_TGSIZE option, length %u != 8]"", opt_len)); return; } bp += 2; len = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); ND_PRINT((ndo, "" PARITY ATGS %u"", len)); opts_len -= 8; break; case PGM_OPT_NBR_UNREACH: if (opt_len != 4) { ND_PRINT((ndo, ""[Bad OPT_NBR_UNREACH option, length %u != 4]"", opt_len)); return; } bp += 2; ND_PRINT((ndo, "" NBR_UNREACH"")); opts_len -= 4; break; case PGM_OPT_PATH_NLA: ND_PRINT((ndo, "" PATH_NLA [%d]"", opt_len)); bp += opt_len; opts_len -= opt_len; break; case PGM_OPT_SYN: if (opt_len != 4) { ND_PRINT((ndo, ""[Bad OPT_SYN option, length %u != 4]"", opt_len)); return; } bp += 2; ND_PRINT((ndo, "" SYN"")); opts_len -= 4; break; case PGM_OPT_FIN: if (opt_len != 4) { ND_PRINT((ndo, ""[Bad OPT_FIN option, length %u != 4]"", opt_len)); return; } bp += 2; ND_PRINT((ndo, "" FIN"")); opts_len -= 4; break; case PGM_OPT_RST: if (opt_len != 4) { ND_PRINT((ndo, ""[Bad OPT_RST option, length %u != 4]"", opt_len)); return; } bp += 2; ND_PRINT((ndo, "" RST"")); opts_len -= 4; break; case PGM_OPT_CR: ND_PRINT((ndo, "" CR"")); bp += opt_len; opts_len -= opt_len; break; case PGM_OPT_CRQST: if (opt_len != 4) { ND_PRINT((ndo, ""[Bad OPT_CRQST option, length %u != 4]"", opt_len)); return; } bp += 2; ND_PRINT((ndo, "" CRQST"")); opts_len -= 4; break; case PGM_OPT_PGMCC_DATA: bp += 2; offset = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); nla_afnum = EXTRACT_16BITS(bp); bp += (2 * sizeof(uint16_t)); switch (nla_afnum) { case AFNUM_INET: if (opt_len != 12 + sizeof(struct in_addr)) { ND_PRINT((ndo, ""[Bad OPT_PGMCC_DATA option, length %u != 12 + address size]"", opt_len)); return; } ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in_addr); opts_len -= 12 + sizeof(struct in_addr); break; case AFNUM_INET6: if (opt_len != 12 + sizeof(struct in6_addr)) { ND_PRINT((ndo, ""[Bad OPT_PGMCC_DATA option, length %u != 12 + address size]"", opt_len)); return; } ND_TCHECK2(*bp, sizeof(struct in6_addr)); addrtostr6(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in6_addr); opts_len -= 12 + sizeof(struct in6_addr); break; default: goto trunc; break; } ND_PRINT((ndo, "" PGMCC DATA %u %s"", offset, nla_buf)); break; case PGM_OPT_PGMCC_FEEDBACK: bp += 2; offset = EXTRACT_32BITS(bp); bp += sizeof(uint32_t); nla_afnum = EXTRACT_16BITS(bp); bp += (2 * sizeof(uint16_t)); switch (nla_afnum) { case AFNUM_INET: if (opt_len != 12 + sizeof(struct in_addr)) { ND_PRINT((ndo, ""[Bad OPT_PGMCC_DATA option, length %u != 12 + address size]"", opt_len)); return; } ND_TCHECK2(*bp, sizeof(struct in_addr)); addrtostr(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in_addr); opts_len -= 12 + sizeof(struct in_addr); break; case AFNUM_INET6: if (opt_len != 12 + sizeof(struct in6_addr)) { ND_PRINT((ndo, ""[Bad OPT_PGMCC_DATA option, length %u != 12 + address size]"", opt_len)); return; } ND_TCHECK2(*bp, sizeof(struct in6_addr)); addrtostr6(bp, nla_buf, sizeof(nla_buf)); bp += sizeof(struct in6_addr); opts_len -= 12 + sizeof(struct in6_addr); break; default: goto trunc; break; } ND_PRINT((ndo, "" PGMCC FEEDBACK %u %s"", offset, nla_buf)); break; default: ND_PRINT((ndo, "" OPT_%02X [%d] "", opt_type, opt_len)); bp += opt_len; opts_len -= opt_len; break; } if (opt_type & PGM_OPT_END) break; } } ND_PRINT((ndo, "" [%u]"", length)); if (ndo->ndo_packettype == PT_PGM_ZMTP1 && (pgm->pgm_type == PGM_ODATA || pgm->pgm_type == PGM_RDATA)) zmtp1_print_datagram(ndo, bp, EXTRACT_16BITS(&pgm->pgm_length)); return; trunc: ND_PRINT((ndo, ""[|pgm]"")); if (ch != '\0') ND_PRINT((ndo, "">"")); } ",1 "PHPAPI zend_string *php_addslashes(zend_string *str, int should_free) { /* maximum string length, worst case situation */ char *source, *target; char *end; size_t offset; zend_string *new_str; if (!str) { return ZSTR_EMPTY_ALLOC(); } source = ZSTR_VAL(str); end = source + ZSTR_LEN(str); while (source < end) { switch (*source) { case '\0': case '\'': case '\""': case '\\': goto do_escape; default: source++; break; } } if (!should_free) { return zend_string_copy(str); } return str; do_escape: offset = source - (char *)ZSTR_VAL(str); new_str = zend_string_alloc(offset + (2 * (ZSTR_LEN(str) - offset)), 0); memcpy(ZSTR_VAL(new_str), ZSTR_VAL(str), offset); target = ZSTR_VAL(new_str) + offset; while (source < end) { switch (*source) { case '\0': *target++ = '\\'; *target++ = '0'; break; case '\'': case '\""': case '\\': *target++ = '\\'; /* break is missing *intentionally* */ default: *target++ = *source; break; } source++; } *target = 0; if (should_free) { zend_string_release(str); } if (ZSTR_LEN(new_str) - (target - ZSTR_VAL(new_str)) > 16) { new_str = zend_string_truncate(new_str, target - ZSTR_VAL(new_str), 0); } else { ZSTR_LEN(new_str) = target - ZSTR_VAL(new_str); } return new_str; } ",0 "void RenderWidgetHostImpl::LostCapture() { if (touch_emulator_) touch_emulator_->CancelTouch(); Send(new InputMsg_MouseCaptureLost(routing_id_)); if (delegate_) delegate_->LostCapture(this); } ",0 "void ThreadWatcherList::WakeUpAll() { DCHECK(WatchDogThread::CurrentlyOnWatchDogThread()); if (!g_thread_watcher_list_) return; for (RegistrationList::iterator it = g_thread_watcher_list_->registered_.begin(); g_thread_watcher_list_->registered_.end() != it; ++it) it->second->WakeUp(); } ",0 "static void blk_mq_run_work_fn(struct work_struct *work) { struct blk_mq_hw_ctx *hctx; hctx = container_of(work, struct blk_mq_hw_ctx, run_work.work); __blk_mq_run_hw_queue(hctx); } ",0 "jv jv_parser_next(struct jv_parser* p) { if (p->eof) return jv_invalid(); if (!p->curr_buf) return jv_invalid(); // Need a buffer if (p->bom_strip_position == 0xff) { if (!(p->flags & JV_PARSE_SEQ)) return jv_invalid_with_msg(jv_string(""Malformed BOM"")); p->st =JV_PARSER_WAITING_FOR_RS; parser_reset(p); } jv value = jv_invalid(); if ((p->flags & JV_PARSE_STREAMING) && stream_check_done(p, &value)) return value; char ch; presult msg = 0; while (!msg && p->curr_buf_pos < p->curr_buf_length) { ch = p->curr_buf[p->curr_buf_pos++]; if (p->st == JV_PARSER_WAITING_FOR_RS) { if (ch == '\n') { p->line++; p->column = 0; } else { p->column++; } if (ch == '\036') p->st = JV_PARSER_NORMAL; continue; // need to resync, wait for RS } msg = scan(p, ch, &value); } if (msg == OK) { return value; } else if (msg) { jv_free(value); if (ch != '\036' && (p->flags & JV_PARSE_SEQ)) { p->st = JV_PARSER_WAITING_FOR_RS; value = make_error(p, ""%s at line %d, column %d (need RS to resync)"", msg, p->line, p->column); parser_reset(p); return value; } value = make_error(p, ""%s at line %d, column %d"", msg, p->line, p->column); parser_reset(p); if (!(p->flags & JV_PARSE_SEQ)) { p->curr_buf = 0; p->curr_buf_pos = 0; } // Else ch must be RS; don't clear buf so we can start parsing again after this ch return value; } else if (p->curr_buf_is_partial) { assert(p->curr_buf_pos == p->curr_buf_length); return jv_invalid(); } else { p->eof = 1; assert(p->curr_buf_pos == p->curr_buf_length); jv_free(value); if (p->st == JV_PARSER_WAITING_FOR_RS) return make_error(p, ""Unfinished abandoned text at EOF at line %d, column %d"", p->line, p->column); if (p->st != JV_PARSER_NORMAL) { value = make_error(p, ""Unfinished string at EOF at line %d, column %d"", p->line, p->column); parser_reset(p); p->st = JV_PARSER_WAITING_FOR_RS; return value; } if ((msg = check_literal(p))) { value = make_error(p, ""%s at EOF at line %d, column %d"", msg, p->line, p->column); parser_reset(p); p->st = JV_PARSER_WAITING_FOR_RS; return value; } if (((p->flags & JV_PARSE_STREAMING) && p->stacklen != 0) || (!(p->flags & JV_PARSE_STREAMING) && p->stackpos != 0)) { value = make_error(p, ""Unfinished JSON term at EOF at line %d, column %d"", p->line, p->column); parser_reset(p); p->st = JV_PARSER_WAITING_FOR_RS; return value; } if ((p->flags & JV_PARSE_STREAMING) && jv_is_valid(p->next)) { value = JV_ARRAY(jv_copy(p->path), p->next); // except in streaming mode we've got to make it [path,value] } else { value = p->next; } p->next = jv_invalid(); if ((p->flags & JV_PARSE_SEQ) && !p->last_ch_was_ws && jv_get_kind(value) == JV_KIND_NUMBER) { jv_free(value); return make_error(p, ""Potentially truncated top-level numeric value at EOF at line %d, column %d"", p->line, p->column); } return value; } } ",0 "dissect_rpcap_heur_tcp (tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data) { if (check_rpcap_heur (tvb, TRUE)) { /* This is probably a rpcap tcp package */ tcp_dissect_pdus (tvb, pinfo, tree, rpcap_desegment, 8, get_rpcap_pdu_len, dissect_rpcap, data); return TRUE; } return FALSE; } ",0 "static bool is_blacklisted_cpu(void) { if (boot_cpu_data.x86_vendor != X86_VENDOR_INTEL) return false; if (boot_cpu_data.x86 == 0x0f) { /* * On Pentium 4, camellia-asm is slower than original assembler * implementation because excessive uses of 64bit rotate and * left-shifts (which are really slow on P4) needed to store and * handle 128bit block in two 64bit registers. */ return true; } return false; } ",0 "xmlParseStartTag2(xmlParserCtxtPtr ctxt, const xmlChar **pref, const xmlChar **URI, int *tlen) { const xmlChar *localname; const xmlChar *prefix; const xmlChar *attname; const xmlChar *aprefix; const xmlChar *nsname; xmlChar *attvalue; const xmlChar **atts = ctxt->atts; int maxatts = ctxt->maxatts; int nratts, nbatts, nbdef; int i, j, nbNs, attval, oldline, oldcol, inputNr; const xmlChar *base; unsigned long cur; int nsNr = ctxt->nsNr; if (RAW != '<') return(NULL); NEXT1; /* * NOTE: it is crucial with the SAX2 API to never call SHRINK beyond that * point since the attribute values may be stored as pointers to * the buffer and calling SHRINK would destroy them ! * The Shrinking is only possible once the full set of attribute * callbacks have been done. */ reparse: SHRINK; base = ctxt->input->base; cur = ctxt->input->cur - ctxt->input->base; inputNr = ctxt->inputNr; oldline = ctxt->input->line; oldcol = ctxt->input->col; nbatts = 0; nratts = 0; nbdef = 0; nbNs = 0; attval = 0; /* Forget any namespaces added during an earlier parse of this element. */ ctxt->nsNr = nsNr; localname = xmlParseQName(ctxt, &prefix); if (localname == NULL) { xmlFatalErrMsg(ctxt, XML_ERR_NAME_REQUIRED, ""StartTag: invalid element name\n""); return(NULL); } *tlen = ctxt->input->cur - ctxt->input->base - cur; /* * Now parse the attributes, it ends up with the ending * * (S Attribute)* S? */ SKIP_BLANKS; GROW; if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr)) goto base_changed; while (((RAW != '>') && ((RAW != '/') || (NXT(1) != '>')) && (IS_BYTE_CHAR(RAW))) && (ctxt->instate != XML_PARSER_EOF)) { const xmlChar *q = CUR_PTR; unsigned int cons = ctxt->input->consumed; int len = -1, alloc = 0; attname = xmlParseAttribute2(ctxt, prefix, localname, &aprefix, &attvalue, &len, &alloc); if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr)) { if ((attvalue != NULL) && (alloc != 0)) xmlFree(attvalue); attvalue = NULL; goto base_changed; } if ((attname != NULL) && (attvalue != NULL)) { if (len < 0) len = xmlStrlen(attvalue); if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) { const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len); xmlURIPtr uri; if (URL == NULL) { xmlErrMemory(ctxt, ""dictionary allocation failure""); if ((attvalue != NULL) && (alloc != 0)) xmlFree(attvalue); return(NULL); } if (*URL != 0) { uri = xmlParseURI((const char *) URL); if (uri == NULL) { xmlNsErr(ctxt, XML_WAR_NS_URI, ""xmlns: '%s' is not a valid URI\n"", URL, NULL, NULL); } else { if (uri->scheme == NULL) { xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE, ""xmlns: URI %s is not absolute\n"", URL, NULL, NULL); } xmlFreeURI(uri); } if (URL == ctxt->str_xml_ns) { if (attname != ctxt->str_xml) { xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, ""xml namespace URI cannot be the default namespace\n"", NULL, NULL, NULL); } goto skip_default_ns; } if ((len == 29) && (xmlStrEqual(URL, BAD_CAST ""http://www.w3.org/2000/xmlns/""))) { xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, ""reuse of the xmlns namespace name is forbidden\n"", NULL, NULL, NULL); goto skip_default_ns; } } /* * check that it's not a defined namespace */ for (j = 1;j <= nbNs;j++) if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL) break; if (j <= nbNs) xmlErrAttributeDup(ctxt, NULL, attname); else if (nsPush(ctxt, NULL, URL) > 0) nbNs++; skip_default_ns: if ((attvalue != NULL) && (alloc != 0)) { xmlFree(attvalue); attvalue = NULL; } if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>')))) break; if (!IS_BLANK_CH(RAW)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, ""attributes construct error\n""); break; } SKIP_BLANKS; if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr)) goto base_changed; continue; } if (aprefix == ctxt->str_xmlns) { const xmlChar *URL = xmlDictLookup(ctxt->dict, attvalue, len); xmlURIPtr uri; if (attname == ctxt->str_xml) { if (URL != ctxt->str_xml_ns) { xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, ""xml namespace prefix mapped to wrong URI\n"", NULL, NULL, NULL); } /* * Do not keep a namespace definition node */ goto skip_ns; } if (URL == ctxt->str_xml_ns) { if (attname != ctxt->str_xml) { xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, ""xml namespace URI mapped to wrong prefix\n"", NULL, NULL, NULL); } goto skip_ns; } if (attname == ctxt->str_xmlns) { xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, ""redefinition of the xmlns prefix is forbidden\n"", NULL, NULL, NULL); goto skip_ns; } if ((len == 29) && (xmlStrEqual(URL, BAD_CAST ""http://www.w3.org/2000/xmlns/""))) { xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, ""reuse of the xmlns namespace name is forbidden\n"", NULL, NULL, NULL); goto skip_ns; } if ((URL == NULL) || (URL[0] == 0)) { xmlNsErr(ctxt, XML_NS_ERR_XML_NAMESPACE, ""xmlns:%s: Empty XML namespace is not allowed\n"", attname, NULL, NULL); goto skip_ns; } else { uri = xmlParseURI((const char *) URL); if (uri == NULL) { xmlNsErr(ctxt, XML_WAR_NS_URI, ""xmlns:%s: '%s' is not a valid URI\n"", attname, URL, NULL); } else { if ((ctxt->pedantic) && (uri->scheme == NULL)) { xmlNsWarn(ctxt, XML_WAR_NS_URI_RELATIVE, ""xmlns:%s: URI %s is not absolute\n"", attname, URL, NULL); } xmlFreeURI(uri); } } /* * check that it's not a defined namespace */ for (j = 1;j <= nbNs;j++) if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname) break; if (j <= nbNs) xmlErrAttributeDup(ctxt, aprefix, attname); else if (nsPush(ctxt, attname, URL) > 0) nbNs++; skip_ns: if ((attvalue != NULL) && (alloc != 0)) { xmlFree(attvalue); attvalue = NULL; } if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>')))) break; if (!IS_BLANK_CH(RAW)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, ""attributes construct error\n""); break; } SKIP_BLANKS; if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr)) goto base_changed; continue; } /* * Add the pair to atts */ if ((atts == NULL) || (nbatts + 5 > maxatts)) { if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) { if (attvalue[len] == 0) xmlFree(attvalue); goto failed; } maxatts = ctxt->maxatts; atts = ctxt->atts; } ctxt->attallocs[nratts++] = alloc; atts[nbatts++] = attname; atts[nbatts++] = aprefix; atts[nbatts++] = NULL; /* the URI will be fetched later */ atts[nbatts++] = attvalue; attvalue += len; atts[nbatts++] = attvalue; /* * tag if some deallocation is needed */ if (alloc != 0) attval = 1; } else { if ((attvalue != NULL) && (attvalue[len] == 0)) xmlFree(attvalue); } failed: GROW if (ctxt->instate == XML_PARSER_EOF) break; if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr)) goto base_changed; if ((RAW == '>') || (((RAW == '/') && (NXT(1) == '>')))) break; if (!IS_BLANK_CH(RAW)) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, ""attributes construct error\n""); break; } SKIP_BLANKS; if ((cons == ctxt->input->consumed) && (q == CUR_PTR) && (attname == NULL) && (attvalue == NULL)) { xmlFatalErr(ctxt, XML_ERR_INTERNAL_ERROR, ""xmlParseStartTag: problem parsing attributes\n""); break; } GROW; if ((ctxt->input->base != base) || (inputNr != ctxt->inputNr)) goto base_changed; } /* * The attributes defaulting */ if (ctxt->attsDefault != NULL) { xmlDefAttrsPtr defaults; defaults = xmlHashLookup2(ctxt->attsDefault, localname, prefix); if (defaults != NULL) { for (i = 0;i < defaults->nbAttrs;i++) { attname = defaults->values[5 * i]; aprefix = defaults->values[5 * i + 1]; /* * special work for namespaces defaulted defs */ if ((attname == ctxt->str_xmlns) && (aprefix == NULL)) { /* * check that it's not a defined namespace */ for (j = 1;j <= nbNs;j++) if (ctxt->nsTab[ctxt->nsNr - 2 * j] == NULL) break; if (j <= nbNs) continue; nsname = xmlGetNamespace(ctxt, NULL); if (nsname != defaults->values[5 * i + 2]) { if (nsPush(ctxt, NULL, defaults->values[5 * i + 2]) > 0) nbNs++; } } else if (aprefix == ctxt->str_xmlns) { /* * check that it's not a defined namespace */ for (j = 1;j <= nbNs;j++) if (ctxt->nsTab[ctxt->nsNr - 2 * j] == attname) break; if (j <= nbNs) continue; nsname = xmlGetNamespace(ctxt, attname); if (nsname != defaults->values[2]) { if (nsPush(ctxt, attname, defaults->values[5 * i + 2]) > 0) nbNs++; } } else { /* * check that it's not a defined attribute */ for (j = 0;j < nbatts;j+=5) { if ((attname == atts[j]) && (aprefix == atts[j+1])) break; } if (j < nbatts) continue; if ((atts == NULL) || (nbatts + 5 > maxatts)) { if (xmlCtxtGrowAttrs(ctxt, nbatts + 5) < 0) { return(NULL); } maxatts = ctxt->maxatts; atts = ctxt->atts; } atts[nbatts++] = attname; atts[nbatts++] = aprefix; if (aprefix == NULL) atts[nbatts++] = NULL; else atts[nbatts++] = xmlGetNamespace(ctxt, aprefix); atts[nbatts++] = defaults->values[5 * i + 2]; atts[nbatts++] = defaults->values[5 * i + 3]; if ((ctxt->standalone == 1) && (defaults->values[5 * i + 4] != NULL)) { xmlValidityError(ctxt, XML_DTD_STANDALONE_DEFAULTED, ""standalone: attribute %s on %s defaulted from external subset\n"", attname, localname); } nbdef++; } } } } /* * The attributes checkings */ for (i = 0; i < nbatts;i += 5) { /* * The default namespace does not apply to attribute names. */ if (atts[i + 1] != NULL) { nsname = xmlGetNamespace(ctxt, atts[i + 1]); if (nsname == NULL) { xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, ""Namespace prefix %s for %s on %s is not defined\n"", atts[i + 1], atts[i], localname); } atts[i + 2] = nsname; } else nsname = NULL; /* * [ WFC: Unique Att Spec ] * No attribute name may appear more than once in the same * start-tag or empty-element tag. * As extended by the Namespace in XML REC. */ for (j = 0; j < i;j += 5) { if (atts[i] == atts[j]) { if (atts[i+1] == atts[j+1]) { xmlErrAttributeDup(ctxt, atts[i+1], atts[i]); break; } if ((nsname != NULL) && (atts[j + 2] == nsname)) { xmlNsErr(ctxt, XML_NS_ERR_ATTRIBUTE_REDEFINED, ""Namespaced Attribute %s in '%s' redefined\n"", atts[i], nsname, NULL); break; } } } } nsname = xmlGetNamespace(ctxt, prefix); if ((prefix != NULL) && (nsname == NULL)) { xmlNsErr(ctxt, XML_NS_ERR_UNDEFINED_NAMESPACE, ""Namespace prefix %s on %s is not defined\n"", prefix, localname, NULL); } *pref = prefix; *URI = nsname; /* * SAX: Start of Element ! */ if ((ctxt->sax != NULL) && (ctxt->sax->startElementNs != NULL) && (!ctxt->disableSAX)) { if (nbNs > 0) ctxt->sax->startElementNs(ctxt->userData, localname, prefix, nsname, nbNs, &ctxt->nsTab[ctxt->nsNr - 2 * nbNs], nbatts / 5, nbdef, atts); else ctxt->sax->startElementNs(ctxt->userData, localname, prefix, nsname, 0, NULL, nbatts / 5, nbdef, atts); } /* * Free up attribute allocated strings if needed */ if (attval != 0) { for (i = 3,j = 0; j < nratts;i += 5,j++) if ((ctxt->attallocs[j] != 0) && (atts[i] != NULL)) xmlFree((xmlChar *) atts[i]); } return(localname); base_changed: /* * the attribute strings are valid iif the base didn't changed */ if (attval != 0) { for (i = 3,j = 0; j < nratts;i += 5,j++) if ((ctxt->attallocs[j] != 0) && (atts[i] != NULL)) xmlFree((xmlChar *) atts[i]); } /* * We can't switch from one entity to another in the middle * of a start tag */ if (inputNr != ctxt->inputNr) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, ""Start tag doesn't start and stop in the same entity\n""); return(NULL); } ctxt->input->cur = ctxt->input->base + cur; ctxt->input->line = oldline; ctxt->input->col = oldcol; if (ctxt->wellFormed == 1) { goto reparse; } return(NULL); } ",0 "void ParamTraits::Write(Message* m, const param_type& p) { WriteParam(m, p.string()); WriteParam(m, p.is_null()); } ",0 "void Document::DecrementLoadEventDelayCount() { DCHECK(load_event_delay_count_); --load_event_delay_count_; if (!load_event_delay_count_) CheckLoadEventSoon(); } ",0 "UINT32 nla_read_header(wStream* s) { UINT32 length = 0; if (s->pointer[1] & 0x80) { if ((s->pointer[1] & ~(0x80)) == 1) { length = s->pointer[2]; length += 3; Stream_Seek(s, 3); } else if ((s->pointer[1] & ~(0x80)) == 2) { length = (s->pointer[2] << 8) | s->pointer[3]; length += 4; Stream_Seek(s, 4); } else { fprintf(stderr, ""Error reading TSRequest!\n""); } } else { length = s->pointer[1]; length += 2; Stream_Seek(s, 2); } return length; } ",0 " void VerifyHostedDocumentJSONFile(const GDataFile* gdata_file, const FilePath& file_path) { ASSERT_TRUE(gdata_file != NULL); std::string error; JSONFileValueSerializer serializer(file_path); scoped_ptr value(serializer.Deserialize(NULL, &error)); ASSERT_TRUE(value.get()) << ""Parse error "" << file_path.value() << "": "" << error; DictionaryValue* dict_value = NULL; ASSERT_TRUE(value->GetAsDictionary(&dict_value)); std::string edit_url, resource_id; EXPECT_TRUE(dict_value->GetString(""url"", &edit_url)); EXPECT_TRUE(dict_value->GetString(""resource_id"", &resource_id)); EXPECT_EQ(gdata_file->alternate_url().spec(), edit_url); EXPECT_EQ(gdata_file->resource_id(), resource_id); } ",0 "char* FLTGetTimeExpression(FilterEncodingNode *psFilterNode, layerObj *lp) { char* pszExpression = NULL; const char* pszTimeField; const char* pszTimeValue; if (psFilterNode == NULL || lp == NULL) return NULL; if (psFilterNode->eType != FILTER_NODE_TYPE_TEMPORAL) return NULL; pszTimeValue = FLTGetDuring(psFilterNode, &pszTimeField); if (pszTimeField && pszTimeValue) { expressionObj old_filter; msInitExpression(&old_filter); msCopyExpression(&old_filter, &lp->filter); /* save existing filter */ msFreeExpression(&lp->filter); if (msLayerSetTimeFilter(lp, pszTimeValue, pszTimeField) == MS_TRUE) { pszExpression = msStrdup(lp->filter.string); } msCopyExpression(&lp->filter, &old_filter); /* restore old filter */ msFreeExpression(&old_filter); } return pszExpression; } ",0 "static int elf_idx(struct user_ta_ctx *utc, vaddr_t r_va, size_t r_size) { struct user_ta_elf *elf; int idx = 0; TAILQ_FOREACH(elf, &utc->elfs, link) { size_t n; for (n = 0; n < elf->num_segs; n++) if (elf->segs[n].va == r_va && elf->segs[n].size == r_size) return idx; idx++; } return -1; } ",0 "lowercase_str (char *str) { bool changed = false; for (; *str; str++) if (c_isupper (*str)) { changed = true; *str = c_tolower (*str); } return changed; } ",0 "int TS_OBJ_print_bio(BIO *bio, const ASN1_OBJECT *obj) { char obj_txt[128]; int len = OBJ_obj2txt(obj_txt, sizeof(obj_txt), obj, 0); BIO_write(bio, obj_txt, len); BIO_write(bio, ""\n"", 1); return 1; } ",1 "kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen, const struct sshbuf *shared_secret) { struct kex *kex = ssh->kex; u_char *keys[NKEYS]; u_int i, j, mode, ctos; int r; for (i = 0; i < NKEYS; i++) { if ((r = derive_key(ssh, 'A'+i, kex->we_need, hash, hashlen, shared_secret, &keys[i])) != 0) { for (j = 0; j < i; j++) free(keys[j]); return r; } } for (mode = 0; mode < MODE_MAX; mode++) { ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); kex->newkeys[mode]->enc.iv = keys[ctos ? 0 : 1]; kex->newkeys[mode]->enc.key = keys[ctos ? 2 : 3]; kex->newkeys[mode]->mac.key = keys[ctos ? 4 : 5]; } return 0; } ",0 "pp::Rect PDFiumEngine::GetVisibleRect() const { pp::Rect rv; rv.set_x(static_cast(position_.x() / current_zoom_)); rv.set_y(static_cast(position_.y() / current_zoom_)); rv.set_width(static_cast(ceil(plugin_size_.width() / current_zoom_))); rv.set_height(static_cast(ceil(plugin_size_.height() / current_zoom_))); return rv; } ",0 "void WebPagePrivate::setCompositorDrawsRootLayer(bool compositorDrawsRootLayer) { #if USE(ACCELERATED_COMPOSITING) if (m_page->settings()->forceCompositingMode() == compositorDrawsRootLayer) return; m_page->settings()->setForceCompositingMode(compositorDrawsRootLayer); m_backingStore->d->updateSuspendScreenUpdateState(); if (!m_mainFrame) return; if (FrameView* view = m_mainFrame->view()) view->updateCompositingLayers(); #endif } ",0 "JavaScriptCallFrames V8Debugger::currentCallFrames(int limit) { if (!m_isolate->InContext()) return JavaScriptCallFrames(); v8::Local currentCallFramesV8; if (m_executionState.IsEmpty()) { v8::Local currentCallFramesFunction = v8::Local::Cast(m_debuggerScript.Get(m_isolate)->Get(toV8StringInternalized(m_isolate, ""currentCallFrames""))); currentCallFramesV8 = v8::Debug::Call(debuggerContext(), currentCallFramesFunction, v8::Integer::New(m_isolate, limit)).ToLocalChecked(); } else { v8::Local argv[] = { m_executionState, v8::Integer::New(m_isolate, limit) }; currentCallFramesV8 = callDebuggerMethod(""currentCallFrames"", PROTOCOL_ARRAY_LENGTH(argv), argv).ToLocalChecked(); } DCHECK(!currentCallFramesV8.IsEmpty()); if (!currentCallFramesV8->IsArray()) return JavaScriptCallFrames(); v8::Local callFramesArray = currentCallFramesV8.As(); JavaScriptCallFrames callFrames; for (size_t i = 0; i < callFramesArray->Length(); ++i) { v8::Local callFrameValue; if (!callFramesArray->Get(debuggerContext(), i).ToLocal(&callFrameValue)) return JavaScriptCallFrames(); if (!callFrameValue->IsObject()) return JavaScriptCallFrames(); v8::Local callFrameObject = callFrameValue.As(); callFrames.push_back(JavaScriptCallFrame::create(debuggerContext(), v8::Local::Cast(callFrameObject))); } return callFrames; } ",0 "static int virtio_net_can_receive(NetClientState *nc) { VirtIONet *n = qemu_get_nic_opaque(nc); VirtIODevice *vdev = VIRTIO_DEVICE(n); VirtIONetQueue *q = virtio_net_get_subqueue(nc); if (!vdev->vm_running) { return 0; } if (nc->queue_index >= n->curr_queues) { return 0; } if (!virtio_queue_ready(q->rx_vq) || !(vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) { return 0; } return 1; } ",0 "status_t Camera2Client::unlock() { ATRACE_CALL(); ALOGV(""%s: E"", __FUNCTION__); Mutex::Autolock icl(mBinderSerializationLock); ALOGV(""%s: Camera %d: Unlock call from pid %d; current client pid %d"", __FUNCTION__, mCameraId, getCallingPid(), mClientPid); if (mClientPid == getCallingPid()) { SharedParameters::Lock l(mParameters); if (l.mParameters.state == Parameters::RECORD || l.mParameters.state == Parameters::VIDEO_SNAPSHOT) { ALOGD(""Not allowed to unlock camera during recording.""); return INVALID_OPERATION; } mClientPid = 0; mRemoteCallback.clear(); mSharedCameraCallbacks.clear(); return OK; } ALOGE(""%s: Camera %d: Unlock call from pid %d; currently locked to pid %d"", __FUNCTION__, mCameraId, getCallingPid(), mClientPid); return EBUSY; } ",0 "kdc_make_s4u2self_rep(krb5_context context, krb5_keyblock *tgs_subkey, krb5_keyblock *tgs_session, krb5_pa_s4u_x509_user *req_s4u_user, krb5_kdc_rep *reply, krb5_enc_kdc_rep_part *reply_encpart) { krb5_error_code code; krb5_data *data = NULL; krb5_pa_s4u_x509_user rep_s4u_user; krb5_pa_data padata; krb5_enctype enctype; krb5_keyusage usage; memset(&rep_s4u_user, 0, sizeof(rep_s4u_user)); rep_s4u_user.user_id.nonce = req_s4u_user->user_id.nonce; rep_s4u_user.user_id.user = req_s4u_user->user_id.user; rep_s4u_user.user_id.options = req_s4u_user->user_id.options & KRB5_S4U_OPTS_USE_REPLY_KEY_USAGE; code = encode_krb5_s4u_userid(&rep_s4u_user.user_id, &data); if (code != 0) goto cleanup; if (req_s4u_user->user_id.options & KRB5_S4U_OPTS_USE_REPLY_KEY_USAGE) usage = KRB5_KEYUSAGE_PA_S4U_X509_USER_REPLY; else usage = KRB5_KEYUSAGE_PA_S4U_X509_USER_REQUEST; code = krb5_c_make_checksum(context, req_s4u_user->cksum.checksum_type, tgs_subkey != NULL ? tgs_subkey : tgs_session, usage, data, &rep_s4u_user.cksum); if (code != 0) goto cleanup; krb5_free_data(context, data); data = NULL; code = encode_krb5_pa_s4u_x509_user(&rep_s4u_user, &data); if (code != 0) goto cleanup; padata.magic = KV5M_PA_DATA; padata.pa_type = KRB5_PADATA_S4U_X509_USER; padata.length = data->length; padata.contents = (krb5_octet *)data->data; code = add_pa_data_element(context, &padata, &reply->padata, FALSE); if (code != 0) goto cleanup; free(data); data = NULL; if (tgs_subkey != NULL) enctype = tgs_subkey->enctype; else enctype = tgs_session->enctype; /* * Owing to a bug in Windows, unkeyed checksums were used for older * enctypes, including rc4-hmac. A forthcoming workaround for this * includes the checksum bytes in the encrypted padata. */ if ((req_s4u_user->user_id.options & KRB5_S4U_OPTS_USE_REPLY_KEY_USAGE) && enctype_requires_etype_info_2(enctype) == FALSE) { padata.length = req_s4u_user->cksum.length + rep_s4u_user.cksum.length; padata.contents = malloc(padata.length); if (padata.contents == NULL) { code = ENOMEM; goto cleanup; } memcpy(padata.contents, req_s4u_user->cksum.contents, req_s4u_user->cksum.length); memcpy(&padata.contents[req_s4u_user->cksum.length], rep_s4u_user.cksum.contents, rep_s4u_user.cksum.length); code = add_pa_data_element(context,&padata, &reply_encpart->enc_padata, FALSE); if (code != 0) { free(padata.contents); goto cleanup; } } cleanup: if (rep_s4u_user.cksum.contents != NULL) krb5_free_checksum_contents(context, &rep_s4u_user.cksum); krb5_free_data(context, data); return code; } ",0 "static int huff_reader_build_canonical(HuffReader *r, int *code_lengths, int alphabet_size) { int len = 0, sym, code = 0, ret; int max_code_length = 0; uint16_t *codes; /* special-case 1 symbol since the vlc reader cannot handle it */ for (sym = 0; sym < alphabet_size; sym++) { if (code_lengths[sym] > 0) { len++; code = sym; if (len > 1) break; } } if (len == 1) { r->nb_symbols = 1; r->simple_symbols[0] = code; r->simple = 1; return 0; } for (sym = 0; sym < alphabet_size; sym++) max_code_length = FFMAX(max_code_length, code_lengths[sym]); if (max_code_length == 0 || max_code_length > MAX_HUFFMAN_CODE_LENGTH) return AVERROR(EINVAL); codes = av_malloc_array(alphabet_size, sizeof(*codes)); if (!codes) return AVERROR(ENOMEM); code = 0; r->nb_symbols = 0; for (len = 1; len <= max_code_length; len++) { for (sym = 0; sym < alphabet_size; sym++) { if (code_lengths[sym] != len) continue; codes[sym] = code++; r->nb_symbols++; } code <<= 1; } if (!r->nb_symbols) { av_free(codes); return AVERROR_INVALIDDATA; } ret = init_vlc(&r->vlc, 8, alphabet_size, code_lengths, sizeof(*code_lengths), sizeof(*code_lengths), codes, sizeof(*codes), sizeof(*codes), 0); if (ret < 0) { av_free(codes); return ret; } r->simple = 0; av_free(codes); return 0; } ",0 "void WebKitTestResultPrinter::PrintImageFooter() { if (state_ != IN_IMAGE_BLOCK) return; if (!capture_text_only_) { *output_ << ""#EOF\n""; output_->flush(); } state_ = AFTER_TEST; } ",0 "std::string ChromotingHost::GenerateHostAuthToken( const std::string& encoded_client_token) { return encoded_client_token; } ",0 "static void print_sg(struct iovec *sg, int cnt) { int i; printf(""sg[%d]: {"", cnt); for (i = 0; i < cnt; i++) { if (i) { printf("", ""); } printf(""(%p, %zd)"", sg[i].iov_base, sg[i].iov_len); } printf(""}\n""); } ",0 "sp_lookup(struct shared_policy *sp, unsigned long start, unsigned long end) { struct rb_node *n = sp->root.rb_node; while (n) { struct sp_node *p = rb_entry(n, struct sp_node, nd); if (start >= p->end) n = n->rb_right; else if (end <= p->start) n = n->rb_left; else break; } if (!n) return NULL; for (;;) { struct sp_node *w = NULL; struct rb_node *prev = rb_prev(n); if (!prev) break; w = rb_entry(prev, struct sp_node, nd); if (w->end <= start) break; n = prev; } return rb_entry(n, struct sp_node, nd); } ",0 "void post_init_entity_util_avg(struct sched_entity *se) { } ",0 "void Shell::PlatformSetIsLoading(bool loading) { if (loading) gtk_spinner_start(GTK_SPINNER(spinner_)); else gtk_spinner_stop(GTK_SPINNER(spinner_)); } ",0 "static int vmx_get_vmx_msr(struct kvm_vcpu *vcpu, u32 msr_index, u64 *pdata) { struct vcpu_vmx *vmx = to_vmx(vcpu); switch (msr_index) { case MSR_IA32_VMX_BASIC: *pdata = vmx->nested.nested_vmx_basic; break; case MSR_IA32_VMX_TRUE_PINBASED_CTLS: case MSR_IA32_VMX_PINBASED_CTLS: *pdata = vmx_control_msr( vmx->nested.nested_vmx_pinbased_ctls_low, vmx->nested.nested_vmx_pinbased_ctls_high); if (msr_index == MSR_IA32_VMX_PINBASED_CTLS) *pdata |= PIN_BASED_ALWAYSON_WITHOUT_TRUE_MSR; break; case MSR_IA32_VMX_TRUE_PROCBASED_CTLS: case MSR_IA32_VMX_PROCBASED_CTLS: *pdata = vmx_control_msr( vmx->nested.nested_vmx_procbased_ctls_low, vmx->nested.nested_vmx_procbased_ctls_high); if (msr_index == MSR_IA32_VMX_PROCBASED_CTLS) *pdata |= CPU_BASED_ALWAYSON_WITHOUT_TRUE_MSR; break; case MSR_IA32_VMX_TRUE_EXIT_CTLS: case MSR_IA32_VMX_EXIT_CTLS: *pdata = vmx_control_msr( vmx->nested.nested_vmx_exit_ctls_low, vmx->nested.nested_vmx_exit_ctls_high); if (msr_index == MSR_IA32_VMX_EXIT_CTLS) *pdata |= VM_EXIT_ALWAYSON_WITHOUT_TRUE_MSR; break; case MSR_IA32_VMX_TRUE_ENTRY_CTLS: case MSR_IA32_VMX_ENTRY_CTLS: *pdata = vmx_control_msr( vmx->nested.nested_vmx_entry_ctls_low, vmx->nested.nested_vmx_entry_ctls_high); if (msr_index == MSR_IA32_VMX_ENTRY_CTLS) *pdata |= VM_ENTRY_ALWAYSON_WITHOUT_TRUE_MSR; break; case MSR_IA32_VMX_MISC: *pdata = vmx_control_msr( vmx->nested.nested_vmx_misc_low, vmx->nested.nested_vmx_misc_high); break; case MSR_IA32_VMX_CR0_FIXED0: *pdata = vmx->nested.nested_vmx_cr0_fixed0; break; case MSR_IA32_VMX_CR0_FIXED1: *pdata = vmx->nested.nested_vmx_cr0_fixed1; break; case MSR_IA32_VMX_CR4_FIXED0: *pdata = vmx->nested.nested_vmx_cr4_fixed0; break; case MSR_IA32_VMX_CR4_FIXED1: *pdata = vmx->nested.nested_vmx_cr4_fixed1; break; case MSR_IA32_VMX_VMCS_ENUM: *pdata = vmx->nested.nested_vmx_vmcs_enum; break; case MSR_IA32_VMX_PROCBASED_CTLS2: *pdata = vmx_control_msr( vmx->nested.nested_vmx_secondary_ctls_low, vmx->nested.nested_vmx_secondary_ctls_high); break; case MSR_IA32_VMX_EPT_VPID_CAP: *pdata = vmx->nested.nested_vmx_ept_caps | ((u64)vmx->nested.nested_vmx_vpid_caps << 32); break; case MSR_IA32_VMX_VMFUNC: *pdata = vmx->nested.nested_vmx_vmfunc_controls; break; default: return 1; } return 0; } ",0 "xfs_da_shrink_inode( xfs_da_args_t *args, xfs_dablk_t dead_blkno, struct xfs_buf *dead_buf) { xfs_inode_t *dp; int done, error, w, count; xfs_trans_t *tp; xfs_mount_t *mp; trace_xfs_da_shrink_inode(args); dp = args->dp; w = args->whichfork; tp = args->trans; mp = dp->i_mount; if (w == XFS_DATA_FORK) count = mp->m_dirblkfsbs; else count = 1; for (;;) { /* * Remove extents. If we get ENOSPC for a dir we have to move * the last block to the place we want to kill. */ error = xfs_bunmapi(tp, dp, dead_blkno, count, xfs_bmapi_aflag(w)|XFS_BMAPI_METADATA, 0, args->firstblock, args->flist, &done); if (error == ENOSPC) { if (w != XFS_DATA_FORK) break; error = xfs_da3_swap_lastblock(args, &dead_blkno, &dead_buf); if (error) break; } else { break; } } xfs_trans_binval(tp, dead_buf); return error; } ",0 "WallpaperManager::WallpaperManager() : binding_(this), pending_inactive_(nullptr), activation_client_observer_(this), window_observer_(this), weak_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::UI); wallpaper::WallpaperManagerBase::SetPathIds( chrome::DIR_USER_DATA, chrome::DIR_CHROMEOS_WALLPAPERS, chrome::DIR_CHROMEOS_CUSTOM_WALLPAPERS); SetDefaultWallpaperPathsFromCommandLine( base::CommandLine::ForCurrentProcess()); registrar_.Add(this, chrome::NOTIFICATION_LOGIN_USER_CHANGED, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_LOGIN_OR_LOCK_WEBUI_VISIBLE, content::NotificationService::AllSources()); registrar_.Add(this, chrome::NOTIFICATION_WALLPAPER_ANIMATION_FINISHED, content::NotificationService::AllSources()); task_runner_ = base::CreateSequencedTaskRunnerWithTraits( {base::MayBlock(), base::TaskPriority::USER_BLOCKING, base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN}); user_manager::UserManager::Get()->AddSessionStateObserver(this); content::ServiceManagerConnection* connection = content::ServiceManagerConnection::GetForProcess(); if (connection && connection->GetConnector()) { ash::mojom::WallpaperControllerPtr wallpaper_controller_ptr; connection->GetConnector()->BindInterface(ash::mojom::kServiceName, &wallpaper_controller_ptr); ash::mojom::WallpaperPickerPtr picker; binding_.Bind(mojo::MakeRequest(&picker)); wallpaper_controller_ptr->SetWallpaperPicker(std::move(picker)); } } ",0 "static char *ConvertUTF16ToUTF8(const char *content,size_t *length) { char *utf8; int bits, byte, c, encoding; register ssize_t i; size_t extent; ssize_t j; utf8=(char *) AcquireQuantumMemory(*length+1,sizeof(*utf8)); if (utf8 == (char *) NULL) return((char *) NULL); encoding=(*content == '\xFE') ? 1 : (*content == '\xFF') ? 0 : -1; if (encoding == -1) { /* Already UTF-8. */ (void) CopyMagickMemory(utf8,content,*length*sizeof(*utf8)); utf8[*length]='\0'; return(utf8); } j=0; extent=(*length); for (i=2; i < (ssize_t) (*length-1); i+=2) { c=(encoding != 0) ? ((content[i] & 0xff) << 8) | (content[i+1] & 0xff) : ((content[i+1] & 0xff) << 8) | (content[i] & 0xff); if ((c >= 0xd800) && (c <= 0xdfff) && ((i+=2) < (ssize_t) (*length-1))) { byte=(encoding != 0) ? ((content[i] & 0xff) << 8) | (content[i+1] & 0xff) : ((content[i+1] & 0xff) << 8) | (content[i] & 0xff); c=(((c & 0x3ff) << 10) | (byte & 0x3ff))+0x10000; } if ((size_t) (j+MaxTextExtent) > extent) { extent=(size_t) j+MaxTextExtent; utf8=(char *) ResizeQuantumMemory(utf8,extent,sizeof(*utf8)); if (utf8 == (char *) NULL) return(utf8); } if (c < 0x80) { utf8[j]=c; j++; continue; } /* Multi-byte UTF-8 sequence. */ byte=c; for (bits=0; byte != 0; byte/=2) bits++; bits=(bits-2)/5; utf8[j++]=(0xFF << (7-bits)) | (c >> (6*bits)); while (bits != 0) { bits--; utf8[j]=0x80 | ((c >> (6*bits)) & 0x3f); j++; } } *length=(size_t) j; utf8=(char *) ResizeQuantumMemory(utf8,*length,sizeof(*utf8)); if (utf8 != (char *) NULL) utf8[*length]='\0'; return(utf8); } ",0 "ZEND_API int add_property_string_ex(zval *arg, const char *key, uint key_len, const char *str, int duplicate TSRMLS_DC) /* {{{ */ { zval *tmp; zval *z_key; size_t _len = strlen(str); if (UNEXPECTED(_len > INT_MAX)) { zend_error_noreturn(E_ERROR, ""String overflow, max size is %d"", INT_MAX); } MAKE_STD_ZVAL(tmp); ZVAL_STRINGL(tmp, str, _len, duplicate); MAKE_STD_ZVAL(z_key); ZVAL_STRINGL(z_key, key, key_len-1, 1); Z_OBJ_HANDLER_P(arg, write_property)(arg, z_key, tmp, 0 TSRMLS_CC); zval_ptr_dtor(&tmp); /* write_property will add 1 to refcount */ zval_ptr_dtor(&z_key); return SUCCESS; } /* }}} */ ",0 "static void *ndp_msg_payload_opts_offset(struct ndp_msg *msg, int offset) { unsigned char *ptr = ndp_msg_payload_opts(msg); return ptr + offset; } ",0 "void TabStrip::OnThemeChanged() { FrameColorsChanged(); } ",0 "views::View* BrowserView::GetTabContentsContainerView() const { return contents_container_; } ",0 " GLES2DecoderWithShaderTest() : GLES2DecoderWithShaderTestBase() { } ",0 "static int pcrypt_aead_init_tfm(struct crypto_aead *tfm) { int cpu, cpu_index; struct aead_instance *inst = aead_alg_instance(tfm); struct pcrypt_instance_ctx *ictx = aead_instance_ctx(inst); struct pcrypt_aead_ctx *ctx = crypto_aead_ctx(tfm); struct crypto_aead *cipher; cpu_index = (unsigned int)atomic_inc_return(&ictx->tfm_count) % cpumask_weight(cpu_online_mask); ctx->cb_cpu = cpumask_first(cpu_online_mask); for (cpu = 0; cpu < cpu_index; cpu++) ctx->cb_cpu = cpumask_next(ctx->cb_cpu, cpu_online_mask); cipher = crypto_spawn_aead(&ictx->spawn); if (IS_ERR(cipher)) return PTR_ERR(cipher); ctx->child = cipher; crypto_aead_set_reqsize(tfm, sizeof(struct pcrypt_request) + sizeof(struct aead_request) + crypto_aead_reqsize(cipher)); return 0; } ",0 "void SettingLevelBubbleView::SetIcon(SkBitmap* icon) { DCHECK(icon); icon_ = icon; SchedulePaint(); } ",0 "static int crypto_rfc4309_setauthsize(struct crypto_aead *parent, unsigned int authsize) { struct crypto_rfc4309_ctx *ctx = crypto_aead_ctx(parent); switch (authsize) { case 8: case 12: case 16: break; default: return -EINVAL; } return crypto_aead_setauthsize(ctx->child, authsize); } ",0 "void RenderView::CreatedPluginWindow(gfx::PluginWindowHandle window) { #if defined(USE_X11) RenderThread::current()->Send(new ViewHostMsg_CreatePluginContainer( routing_id(), window)); #endif } ",0 "static int __hwahc_op_set_num_dnts(struct wusbhc *wusbhc, u8 interval, u8 slots) { struct hwahc *hwahc = container_of(wusbhc, struct hwahc, wusbhc); struct wahc *wa = &hwahc->wa; return usb_control_msg(wa->usb_dev, usb_sndctrlpipe(wa->usb_dev, 0), WUSB_REQ_SET_NUM_DNTS, USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE, interval << 8 | slots, wa->usb_iface->cur_altsetting->desc.bInterfaceNumber, NULL, 0, USB_CTRL_SET_TIMEOUT); } ",0 "static int can_open_delegated(struct nfs_delegation *delegation, fmode_t fmode) { if (delegation == NULL) return 0; if ((delegation->type & fmode) != fmode) return 0; if (test_bit(NFS_DELEGATION_RETURNING, &delegation->flags)) return 0; nfs_mark_delegation_referenced(delegation); return 1; } ",0 "xsltCompilerVarInfoFree(xsltCompilerCtxtPtr cctxt) { xsltVarInfoPtr ivar = cctxt->ivars, ivartmp; while (ivar) { ivartmp = ivar; ivar = ivar->next; xmlFree(ivartmp); } } ",0 "check_definition(const char *buf) { const char *p; def_t* def; size_t def_name_len; char *str; if (buf[0] != '$') return false; if (!isalpha(buf[1]) && buf[1] != '_') return NULL; for (p = buf + 2; *p; p++) { if (*p == '=') break; if (!isalnum(*p) && !isdigit(*p) && *p != '_') return NULL; } def_name_len = (size_t)(p - &buf[1]); p += strspn(p, "" \t""); if (*p != '=') return NULL; if ((def = find_definition(&buf[1], def_name_len, true))) { FREE(def->value); def->fn = NULL; /* Allow a standard definition to be overridden */ } else { def = MALLOC(sizeof(*def)); def->name_len = def_name_len; str = MALLOC(def->name_len + 1); strncpy(str, &buf[1], def->name_len); str[def->name_len] = '\0'; def->name = str; if (!LIST_EXISTS(defs)) defs = alloc_list(free_definition, NULL); list_add(defs, def); } /* Skip leading whitespace */ p += strspn(p + 1, "" \t"") + 1; def->value_len = strlen(p); if (p[def->value_len - 1] == '\\') { /* Remove trailing whitespace */ while (def->value_len >= 2 && isblank(p[def->value_len - 2])) def->value_len--; if (def->value_len < 2) { /* If the string has nothing except spaces and terminating '\' * point to the string terminator. */ p += def->value_len; def->value_len = 0; } def->multiline = true; } else def->multiline = false; str = MALLOC(def->value_len + 1); strcpy(str, p); def->value = str; /* If it a multiline definition, we need to mark the end of the first line * by overwriting the '\' with the line end marker. */ if (def->value_len >= 2 && def->multiline) def->value[def->value_len - 1] = DEF_LINE_END[0]; return def; } ",0 " static TT_F26Dot6 Free_Project( EXEC_OPS TT_F26Dot6 Vx, TT_F26Dot6 Vy ) { THROW_PATENTED; return 0; } ",0 "void NavigateNamedFrame(const ToRenderFrameHost& caller_frame, const GURL& url, const std::string& name) { bool success = false; EXPECT_TRUE(ExecuteScriptAndExtractBool( caller_frame, ""window.domAutomationController.send("" "" !!window.open('"" + url.spec() + ""', '"" + name + ""'));"", &success)); EXPECT_TRUE(success); } ",0 "int mlx5_ib_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask, struct ib_udata *udata) { struct mlx5_ib_dev *dev = to_mdev(ibqp->device); struct mlx5_ib_qp *qp = to_mqp(ibqp); struct mlx5_ib_modify_qp ucmd = {}; enum ib_qp_type qp_type; enum ib_qp_state cur_state, new_state; size_t required_cmd_sz; int err = -EINVAL; int port; enum rdma_link_layer ll = IB_LINK_LAYER_UNSPECIFIED; if (ibqp->rwq_ind_tbl) return -ENOSYS; if (udata && udata->inlen) { required_cmd_sz = offsetof(typeof(ucmd), reserved) + sizeof(ucmd.reserved); if (udata->inlen < required_cmd_sz) return -EINVAL; if (udata->inlen > sizeof(ucmd) && !ib_is_udata_cleared(udata, sizeof(ucmd), udata->inlen - sizeof(ucmd))) return -EOPNOTSUPP; if (ib_copy_from_udata(&ucmd, udata, min(udata->inlen, sizeof(ucmd)))) return -EFAULT; if (ucmd.comp_mask || memchr_inv(&ucmd.reserved, 0, sizeof(ucmd.reserved)) || memchr_inv(&ucmd.burst_info.reserved, 0, sizeof(ucmd.burst_info.reserved))) return -EOPNOTSUPP; } if (unlikely(ibqp->qp_type == IB_QPT_GSI)) return mlx5_ib_gsi_modify_qp(ibqp, attr, attr_mask); if (ibqp->qp_type == IB_QPT_DRIVER) qp_type = qp->qp_sub_type; else qp_type = (unlikely(ibqp->qp_type == MLX5_IB_QPT_HW_GSI)) ? IB_QPT_GSI : ibqp->qp_type; if (qp_type == MLX5_IB_QPT_DCT) return mlx5_ib_modify_dct(ibqp, attr, attr_mask, udata); mutex_lock(&qp->mutex); cur_state = attr_mask & IB_QP_CUR_STATE ? attr->cur_qp_state : qp->state; new_state = attr_mask & IB_QP_STATE ? attr->qp_state : cur_state; if (!(cur_state == new_state && cur_state == IB_QPS_RESET)) { port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; ll = dev->ib_dev.get_link_layer(&dev->ib_dev, port); } if (qp->flags & MLX5_IB_QP_UNDERLAY) { if (attr_mask & ~(IB_QP_STATE | IB_QP_CUR_STATE)) { mlx5_ib_dbg(dev, ""invalid attr_mask 0x%x when underlay QP is used\n"", attr_mask); goto out; } } else if (qp_type != MLX5_IB_QPT_REG_UMR && qp_type != MLX5_IB_QPT_DCI && !ib_modify_qp_is_ok(cur_state, new_state, qp_type, attr_mask, ll)) { mlx5_ib_dbg(dev, ""invalid QP state transition from %d to %d, qp_type %d, attr_mask 0x%x\n"", cur_state, new_state, ibqp->qp_type, attr_mask); goto out; } else if (qp_type == MLX5_IB_QPT_DCI && !modify_dci_qp_is_ok(cur_state, new_state, attr_mask)) { mlx5_ib_dbg(dev, ""invalid QP state transition from %d to %d, qp_type %d, attr_mask 0x%x\n"", cur_state, new_state, qp_type, attr_mask); goto out; } if ((attr_mask & IB_QP_PORT) && (attr->port_num == 0 || attr->port_num > dev->num_ports)) { mlx5_ib_dbg(dev, ""invalid port number %d. number of ports is %d\n"", attr->port_num, dev->num_ports); goto out; } if (attr_mask & IB_QP_PKEY_INDEX) { port = attr_mask & IB_QP_PORT ? attr->port_num : qp->port; if (attr->pkey_index >= dev->mdev->port_caps[port - 1].pkey_table_len) { mlx5_ib_dbg(dev, ""invalid pkey index %d\n"", attr->pkey_index); goto out; } } if (attr_mask & IB_QP_MAX_QP_RD_ATOMIC && attr->max_rd_atomic > (1 << MLX5_CAP_GEN(dev->mdev, log_max_ra_res_qp))) { mlx5_ib_dbg(dev, ""invalid max_rd_atomic value %d\n"", attr->max_rd_atomic); goto out; } if (attr_mask & IB_QP_MAX_DEST_RD_ATOMIC && attr->max_dest_rd_atomic > (1 << MLX5_CAP_GEN(dev->mdev, log_max_ra_req_qp))) { mlx5_ib_dbg(dev, ""invalid max_dest_rd_atomic value %d\n"", attr->max_dest_rd_atomic); goto out; } if (cur_state == new_state && cur_state == IB_QPS_RESET) { err = 0; goto out; } err = __mlx5_ib_modify_qp(ibqp, attr, attr_mask, cur_state, new_state, &ucmd); out: mutex_unlock(&qp->mutex); return err; } ",0 "jpeg_start_decompress_encap(OJPEGState* sp, jpeg_decompress_struct* cinfo) { if( SETJMP(sp->exit_jmpbuf) ) return 0; else { jpeg_start_decompress(cinfo); return 1; } } ",0 "void NPN_ForceRedraw(NPP id) { NOTIMPLEMENTED(); } ",0 "static int instantiate_none(struct lxc_handler *handler, struct lxc_netdev *netdev) { netdev->ifindex = 0; return 0; } ",0 "void JBIG2Stream::readSegments() { Guint segNum, segFlags, segType, page, segLength; Guint refFlags, nRefSegs; Guint *refSegs; Goffset segDataPos; int c1, c2, c3; Guint i; while (readULong(&segNum)) { if (!readUByte(&segFlags)) { goto eofError1; } segType = segFlags & 0x3f; if (!readUByte(&refFlags)) { goto eofError1; } nRefSegs = refFlags >> 5; if (nRefSegs == 7) { if ((c1 = curStr->getChar()) == EOF || (c2 = curStr->getChar()) == EOF || (c3 = curStr->getChar()) == EOF) { goto eofError1; } refFlags = (refFlags << 24) | (c1 << 16) | (c2 << 8) | c3; nRefSegs = refFlags & 0x1fffffff; for (i = 0; i < (nRefSegs + 9) >> 3; ++i) { if ((c1 = curStr->getChar()) == EOF) { goto eofError1; } } } refSegs = (Guint *)gmallocn(nRefSegs, sizeof(Guint)); if (segNum <= 256) { for (i = 0; i < nRefSegs; ++i) { if (!readUByte(&refSegs[i])) { goto eofError2; } } } else if (segNum <= 65536) { for (i = 0; i < nRefSegs; ++i) { if (!readUWord(&refSegs[i])) { goto eofError2; } } } else { for (i = 0; i < nRefSegs; ++i) { if (!readULong(&refSegs[i])) { goto eofError2; } } } if (segFlags & 0x40) { if (!readULong(&page)) { goto eofError2; } } else { if (!readUByte(&page)) { goto eofError2; } } if (!readULong(&segLength)) { goto eofError2; } segDataPos = curStr->getPos(); if (!pageBitmap && ((segType >= 4 && segType <= 7) || (segType >= 20 && segType <= 43))) { error(errSyntaxError, curStr->getPos(), ""First JBIG2 segment associated with a page must be a page information segment""); goto syntaxError; } switch (segType) { case 0: if (!readSymbolDictSeg(segNum, segLength, refSegs, nRefSegs)) { goto syntaxError; } break; case 4: readTextRegionSeg(segNum, gFalse, gFalse, segLength, refSegs, nRefSegs); break; case 6: readTextRegionSeg(segNum, gTrue, gFalse, segLength, refSegs, nRefSegs); break; case 7: readTextRegionSeg(segNum, gTrue, gTrue, segLength, refSegs, nRefSegs); break; case 16: readPatternDictSeg(segNum, segLength); break; case 20: readHalftoneRegionSeg(segNum, gFalse, gFalse, segLength, refSegs, nRefSegs); break; case 22: readHalftoneRegionSeg(segNum, gTrue, gFalse, segLength, refSegs, nRefSegs); break; case 23: readHalftoneRegionSeg(segNum, gTrue, gTrue, segLength, refSegs, nRefSegs); break; case 36: readGenericRegionSeg(segNum, gFalse, gFalse, segLength); break; case 38: readGenericRegionSeg(segNum, gTrue, gFalse, segLength); break; case 39: readGenericRegionSeg(segNum, gTrue, gTrue, segLength); break; case 40: readGenericRefinementRegionSeg(segNum, gFalse, gFalse, segLength, refSegs, nRefSegs); break; case 42: readGenericRefinementRegionSeg(segNum, gTrue, gFalse, segLength, refSegs, nRefSegs); break; case 43: readGenericRefinementRegionSeg(segNum, gTrue, gTrue, segLength, refSegs, nRefSegs); break; case 48: readPageInfoSeg(segLength); break; case 50: readEndOfStripeSeg(segLength); break; case 52: readProfilesSeg(segLength); break; case 53: readCodeTableSeg(segNum, segLength); break; case 62: readExtensionSeg(segLength); break; default: error(errSyntaxError, curStr->getPos(), ""Unknown segment type in JBIG2 stream""); for (i = 0; i < segLength; ++i) { if ((c1 = curStr->getChar()) == EOF) { goto eofError2; } } break; } if (segLength != 0xffffffff) { Goffset segExtraBytes = segDataPos + segLength - curStr->getPos(); if (segExtraBytes > 0) { error(errSyntaxError, curStr->getPos(), ""{0:d} extraneous byte{1:s} after segment"", segExtraBytes, (segExtraBytes > 1) ? ""s"" : """"); int trash; for (Goffset i = segExtraBytes; i > 0; i--) { readByte(&trash); } } else if (segExtraBytes < 0) { error(errSyntaxError, curStr->getPos(), ""Previous segment handler read too many bytes""); } } gfree(refSegs); } return; syntaxError: gfree(refSegs); return; eofError2: gfree(refSegs); eofError1: error(errSyntaxError, curStr->getPos(), ""Unexpected EOF in JBIG2 stream""); } ",1 "static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file, QDict *options, int flags, BlockDriver *drv, Error **errp) { int ret, open_flags; const char *filename; const char *node_name = NULL; Error *local_err = NULL; assert(drv != NULL); assert(bs->file == NULL); assert(options != NULL && bs->options != options); if (file != NULL) { filename = file->filename; } else { filename = qdict_get_try_str(options, ""filename""); } if (drv->bdrv_needs_filename && !filename) { error_setg(errp, ""The '%s' block driver requires a file name"", drv->format_name); return -EINVAL; } trace_bdrv_open_common(bs, filename ?: """", flags, drv->format_name); node_name = qdict_get_try_str(options, ""node-name""); ret = bdrv_assign_node_name(bs, node_name, errp); if (ret < 0) { return ret; } qdict_del(options, ""node-name""); /* bdrv_open() with directly using a protocol as drv. This layer is already * opened, so assign it to bs (while file becomes a closed BlockDriverState) * and return immediately. */ if (file != NULL && drv->bdrv_file_open) { bdrv_swap(file, bs); return 0; } bs->open_flags = flags; bs->guest_block_size = 512; bs->request_alignment = 512; bs->zero_beyond_eof = true; open_flags = bdrv_open_flags(bs, flags); bs->read_only = !(open_flags & BDRV_O_RDWR); if (use_bdrv_whitelist && !bdrv_is_whitelisted(drv, bs->read_only)) { error_setg(errp, !bs->read_only && bdrv_is_whitelisted(drv, true) ? ""Driver '%s' can only be used for read-only devices"" : ""Driver '%s' is not whitelisted"", drv->format_name); return -ENOTSUP; } assert(bs->copy_on_read == 0); /* bdrv_new() and bdrv_close() make it so */ if (flags & BDRV_O_COPY_ON_READ) { if (!bs->read_only) { bdrv_enable_copy_on_read(bs); } else { error_setg(errp, ""Can't use copy-on-read on read-only device""); return -EINVAL; } } if (filename != NULL) { pstrcpy(bs->filename, sizeof(bs->filename), filename); } else { bs->filename[0] = '\0'; } bs->drv = drv; bs->opaque = g_malloc0(drv->instance_size); bs->enable_write_cache = !!(flags & BDRV_O_CACHE_WB); /* Open the image, either directly or using a protocol */ if (drv->bdrv_file_open) { assert(file == NULL); assert(!drv->bdrv_needs_filename || filename != NULL); ret = drv->bdrv_file_open(bs, options, open_flags, &local_err); } else { if (file == NULL) { error_setg(errp, ""Can't use '%s' as a block driver for the "" ""protocol level"", drv->format_name); ret = -EINVAL; goto free_and_fail; } bs->file = file; ret = drv->bdrv_open(bs, options, open_flags, &local_err); } if (ret < 0) { if (local_err) { error_propagate(errp, local_err); } else if (bs->filename[0]) { error_setg_errno(errp, -ret, ""Could not open '%s'"", bs->filename); } else { error_setg_errno(errp, -ret, ""Could not open image""); } goto free_and_fail; } ret = refresh_total_sectors(bs, bs->total_sectors); if (ret < 0) { error_setg_errno(errp, -ret, ""Could not refresh total sector count""); goto free_and_fail; } bdrv_refresh_limits(bs); assert(bdrv_opt_mem_align(bs) != 0); assert((bs->request_alignment != 0) || bs->sg); #ifndef _WIN32 if (bs->is_temporary) { assert(bs->filename[0] != '\0'); unlink(bs->filename); } #endif return 0; free_and_fail: bs->file = NULL; g_free(bs->opaque); bs->opaque = NULL; bs->drv = NULL; return ret; } ",0 "static void MSLIgnorableWhitespace(void *context,const xmlChar *c,int length) { MSLInfo *msl_info; /* Receiving some ignorable whitespaces from the parser. */ (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" SAX.ignorableWhitespace(%.30s, %d)"",c,length); msl_info=(MSLInfo *) context; (void) msl_info; } ",0 "create_toolbar_button(Evas_Object *window, const char *icon_name) { Evas_Object *button = elm_button_add(window); Evas_Object *icon = elm_icon_add(window); elm_icon_standard_set(icon, icon_name); evas_object_size_hint_max_set(icon, TOOL_BAR_ICON_SIZE, TOOL_BAR_ICON_SIZE); evas_object_color_set(icon, 44, 44, 102, 128); evas_object_show(icon); elm_object_part_content_set(button, ""icon"", icon); evas_object_size_hint_min_set(button, TOOL_BAR_BUTTON_SIZE, TOOL_BAR_BUTTON_SIZE); return button; } ",0 "void EventBindings::MatchAgainstEventFilter( const v8::FunctionCallbackInfo& args) { v8::Isolate* isolate = args.GetIsolate(); typedef std::set MatcherIDs; EventFilter& event_filter = g_event_filter.Get(); std::string event_name = *v8::String::Utf8Value(args[0]); EventFilteringInfo info = ParseFromObject(args[1]->ToObject(isolate), isolate); MatcherIDs matched_event_filters = event_filter.MatchEvent( event_name, info, context()->GetRenderFrame()->GetRoutingID()); v8::Local array( v8::Array::New(isolate, matched_event_filters.size())); int i = 0; for (MatcherIDs::iterator it = matched_event_filters.begin(); it != matched_event_filters.end(); ++it) { array->Set(v8::Integer::New(isolate, i++), v8::Integer::New(isolate, *it)); } args.GetReturnValue().Set(array); } ",0 "NTSTATUS fd_close(files_struct *fsp) { int ret; if (fsp->dptr) { dptr_CloseDir(fsp); } if (fsp->fh->fd == -1) { return NT_STATUS_OK; /* What we used to call a stat open. */ } if (fsp->fh->ref_count > 1) { return NT_STATUS_OK; /* Shared handle. Only close last reference. */ } ret = SMB_VFS_CLOSE(fsp); fsp->fh->fd = -1; if (ret == -1) { return map_nt_error_from_unix(errno); } return NT_STATUS_OK; } ",0 "_copy_to_pages(struct page **pages, size_t pgbase, const char *p, size_t len) { struct page **pgto; char *vto; size_t copy; pgto = pages + (pgbase >> PAGE_CACHE_SHIFT); pgbase &= ~PAGE_CACHE_MASK; for (;;) { copy = PAGE_CACHE_SIZE - pgbase; if (copy > len) copy = len; vto = kmap_atomic(*pgto, KM_USER0); memcpy(vto + pgbase, p, copy); kunmap_atomic(vto, KM_USER0); len -= copy; if (len == 0) break; pgbase += copy; if (pgbase == PAGE_CACHE_SIZE) { flush_dcache_page(*pgto); pgbase = 0; pgto++; } p += copy; } flush_dcache_page(*pgto); } ",0 "void AppListController::ShowAppList(Profile* requested_profile) { DCHECK(requested_profile); ScopedKeepAlive show_app_list_keepalive; content::BrowserThread::PostBlockingPoolTask( FROM_HERE, base::Bind(SetDidRunForNDayActiveStats)); if (win8::IsSingleWindowMetroMode()) { chrome::AppMetroInfoBarDelegateWin::Create( requested_profile, chrome::AppMetroInfoBarDelegateWin::SHOW_APP_LIST, std::string()); return; } InvalidatePendingProfileLoads(); if (IsAppListVisible() && (requested_profile == profile())) { current_view_->GetWidget()->Show(); current_view_->GetWidget()->Activate(); return; } SaveProfilePathToLocalState(requested_profile->GetPath()); DismissAppList(); PopulateViewFromProfile(requested_profile); DCHECK(current_view_); EnsureHaveKeepAliveForView(); gfx::Point cursor = gfx::Screen::GetNativeScreen()->GetCursorScreenPoint(); UpdateArrowPositionAndAnchorPoint(cursor); current_view_->GetWidget()->Show(); current_view_->GetWidget()->GetTopLevelWidget()->UpdateWindowIcon(); current_view_->GetWidget()->Activate(); RecordAppListLaunch(); } ",0 "void SyncBackendHost::InitCore(const Core::DoInitializeOptions& options) { sync_thread_.message_loop()->PostTask(FROM_HERE, NewRunnableMethod(core_.get(), &SyncBackendHost::Core::DoInitialize, options)); } ",0 "void ThumbnailGenerator::WidgetHidden(RenderWidgetHost* widget) { WidgetThumbnail* wt = GetDataForHost(widget); wt->last_hidden = base::TimeTicks::Now(); EraseHostFromShownList(widget); if (!wt->thumbnail.isNull()) return; wt->thumbnail = GetThumbnailForRenderer(widget); } ",0 "image_transform_png_set_palette_to_rgb_set(PNG_CONST image_transform *this, transform_display *that, png_structp pp, png_infop pi) { png_set_palette_to_rgb(pp); this->next->set(this->next, that, pp, pi); } ",1 "static int coalesce_t2(struct smb_hdr *psecond, struct smb_hdr *pTargetSMB) { struct smb_t2_rsp *pSMB2 = (struct smb_t2_rsp *)psecond; struct smb_t2_rsp *pSMBt = (struct smb_t2_rsp *)pTargetSMB; char *data_area_of_target; char *data_area_of_buf2; int remaining; __u16 byte_count, total_data_size, total_in_buf, total_in_buf2; total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); if (total_data_size != get_unaligned_le16(&pSMB2->t2_rsp.TotalDataCount)) cFYI(1, ""total data size of primary and secondary t2 differ""); total_in_buf = get_unaligned_le16(&pSMBt->t2_rsp.DataCount); remaining = total_data_size - total_in_buf; if (remaining < 0) return -EINVAL; if (remaining == 0) /* nothing to do, ignore */ return 0; total_in_buf2 = get_unaligned_le16(&pSMB2->t2_rsp.DataCount); if (remaining < total_in_buf2) { cFYI(1, ""transact2 2nd response contains too much data""); } /* find end of first SMB data area */ data_area_of_target = (char *)&pSMBt->hdr.Protocol + get_unaligned_le16(&pSMBt->t2_rsp.DataOffset); /* validate target area */ data_area_of_buf2 = (char *)&pSMB2->hdr.Protocol + get_unaligned_le16(&pSMB2->t2_rsp.DataOffset); data_area_of_target += total_in_buf; /* copy second buffer into end of first buffer */ memcpy(data_area_of_target, data_area_of_buf2, total_in_buf2); total_in_buf += total_in_buf2; put_unaligned_le16(total_in_buf, &pSMBt->t2_rsp.DataCount); byte_count = get_bcc_le(pTargetSMB); byte_count += total_in_buf2; put_bcc_le(byte_count, pTargetSMB); byte_count = pTargetSMB->smb_buf_length; byte_count += total_in_buf2; /* BB also add check that we are not beyond maximum buffer size */ pTargetSMB->smb_buf_length = byte_count; if (remaining == total_in_buf2) { cFYI(1, ""found the last secondary response""); return 0; /* we are done */ } else /* more responses to go */ return 1; } ",0 " MetricsStateManagerTest() : is_metrics_reporting_enabled_(false) { MetricsService::RegisterPrefs(prefs_.registry()); } ",0 "void WorkerGlobalScopeFileSystem::webkitRequestFileSystem(WorkerGlobalScope& worker, int type, long long size, PassOwnPtr successCallback, PassOwnPtr errorCallback) { ExecutionContext* secureContext = worker.executionContext(); if (!secureContext->securityOrigin()->canAccessFileSystem()) { DOMFileSystem::scheduleCallback(&worker, errorCallback, FileError::create(FileError::SECURITY_ERR)); return; } FileSystemType fileSystemType = static_cast(type); if (!DOMFileSystemBase::isValidType(fileSystemType)) { DOMFileSystem::scheduleCallback(&worker, errorCallback, FileError::create(FileError::INVALID_MODIFICATION_ERR)); return; } LocalFileSystem::from(worker)->requestFileSystem(&worker, fileSystemType, size, FileSystemCallbacks::create(successCallback, errorCallback, &worker, fileSystemType)); } ",0 " void InitializeDatabase(crypto::ScopedPK11Slot system_slot) { crypto::ScopedPK11Slot system_slot_copy = crypto::ScopedPK11Slot(PK11_ReferenceSlot(system_slot.get())); auto database = std::make_unique( std::move(system_slot) /* public_slot */, crypto::ScopedPK11Slot() /* private_slot */); database->SetSystemSlot(std::move(system_slot_copy)); system_token_cert_database_ = std::move(database); VLOG(1) << ""SystemTokenCertDBInitializer: Passing system token NSS "" ""database to CertLoader.""; CertLoader::Get()->SetSystemNSSDB(system_token_cert_database_.get()); } ",0 "archive_acl_to_text_w(struct archive_acl *acl, ssize_t *text_len, int flags, struct archive *a) { int count; ssize_t length; size_t len; const wchar_t *wname; const wchar_t *prefix; wchar_t separator; struct archive_acl_entry *ap; int id, r, want_type; wchar_t *wp, *ws; want_type = archive_acl_text_want_type(acl, flags); /* Both NFSv4 and POSIX.1 types found */ if (want_type == 0) return (NULL); if (want_type == ARCHIVE_ENTRY_ACL_TYPE_POSIX1E) flags |= ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT; length = archive_acl_text_len(acl, want_type, flags, 1, a, NULL); if (length == 0) return (NULL); if (flags & ARCHIVE_ENTRY_ACL_STYLE_SEPARATOR_COMMA) separator = L','; else separator = L'\n'; /* Now, allocate the string and actually populate it. */ wp = ws = (wchar_t *)malloc(length * sizeof(wchar_t)); if (wp == NULL) { if (errno == ENOMEM) __archive_errx(1, ""No memory""); return (NULL); } count = 0; if ((want_type & ARCHIVE_ENTRY_ACL_TYPE_ACCESS) != 0) { append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_USER_OBJ, flags, NULL, acl->mode & 0700, -1); *wp++ = separator; append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_GROUP_OBJ, flags, NULL, acl->mode & 0070, -1); *wp++ = separator; append_entry_w(&wp, NULL, ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_OTHER, flags, NULL, acl->mode & 0007, -1); count += 3; } for (ap = acl->acl_head; ap != NULL; ap = ap->next) { if ((ap->type & want_type) == 0) continue; /* * Filemode-mapping ACL entries are stored exclusively in * ap->mode so they should not be in the list */ if ((ap->type == ARCHIVE_ENTRY_ACL_TYPE_ACCESS) && (ap->tag == ARCHIVE_ENTRY_ACL_USER_OBJ || ap->tag == ARCHIVE_ENTRY_ACL_GROUP_OBJ || ap->tag == ARCHIVE_ENTRY_ACL_OTHER)) continue; if (ap->type == ARCHIVE_ENTRY_ACL_TYPE_DEFAULT && (flags & ARCHIVE_ENTRY_ACL_STYLE_MARK_DEFAULT) != 0) prefix = L""default:""; else prefix = NULL; r = archive_mstring_get_wcs(a, &ap->name, &wname); if (r == 0) { if (count > 0) *wp++ = separator; if (flags & ARCHIVE_ENTRY_ACL_STYLE_EXTRA_ID) id = ap->id; else id = -1; append_entry_w(&wp, prefix, ap->type, ap->tag, flags, wname, ap->permset, id); count++; } else if (r < 0 && errno == ENOMEM) { free(ws); return (NULL); } } /* Add terminating character */ *wp++ = L'\0'; len = wcslen(ws); if ((ssize_t)len > (length - 1)) __archive_errx(1, ""Buffer overrun""); if (text_len != NULL) *text_len = len; return (ws); } ",0 "void GpuProcessHostUIShim::OnGraphicsInfoCollected( const content::GPUInfo& gpu_info) { TRACE_EVENT0(""test_gpu"", ""OnGraphicsInfoCollected""); GpuDataManagerImpl::GetInstance()->UpdateGpuInfo(gpu_info); } ",0 "bool RenderWidgetHostViewAura::SetSelectionRange(const gfx::Range& range) { NOTIMPLEMENTED(); return false; } ",0 "nautilus_file_operations_move (GList *files, GArray *relative_item_points, GFile *target_dir, GtkWindow *parent_window, NautilusCopyCallback done_callback, gpointer done_callback_data) { GTask *task; CopyMoveJob *job; job = op_job_new (CopyMoveJob, parent_window); job->is_move = TRUE; job->done_callback = done_callback; job->done_callback_data = done_callback_data; job->files = g_list_copy_deep (files, (GCopyFunc) g_object_ref, NULL); job->destination = g_object_ref (target_dir); /* Need to indicate the destination for the operation notification open * button. */ nautilus_progress_info_set_destination (((CommonJob *) job)->progress, target_dir); if (relative_item_points != NULL && relative_item_points->len > 0) { job->icon_positions = g_memdup (relative_item_points->data, sizeof (GdkPoint) * relative_item_points->len); job->n_icon_positions = relative_item_points->len; } job->debuting_files = g_hash_table_new_full (g_file_hash, (GEqualFunc) g_file_equal, g_object_unref, NULL); inhibit_power_manager ((CommonJob *) job, _(""Moving Files"")); if (!nautilus_file_undo_manager_is_operating ()) { GFile *src_dir; src_dir = g_file_get_parent (files->data); if (g_file_has_uri_scheme (g_list_first (files)->data, ""trash"")) { job->common.undo_info = nautilus_file_undo_info_ext_new (NAUTILUS_FILE_UNDO_OP_RESTORE_FROM_TRASH, g_list_length (files), src_dir, target_dir); } else { job->common.undo_info = nautilus_file_undo_info_ext_new (NAUTILUS_FILE_UNDO_OP_MOVE, g_list_length (files), src_dir, target_dir); } g_object_unref (src_dir); } task = g_task_new (NULL, job->common.cancellable, move_task_done, job); g_task_set_task_data (task, job, NULL); g_task_run_in_thread (task, move_task_thread_func); g_object_unref (task); } ",0 "sp MediaPlayerService::Client::createPlayer(player_type playerType) { sp p = mPlayer; if ((p != NULL) && (p->playerType() != playerType)) { ALOGV(""delete player""); p.clear(); } if (p == NULL) { p = MediaPlayerFactory::createPlayer(playerType, this, notify, mPid); } if (p != NULL) { p->setUID(mUID); } return p; } ",0 "int SafeSock::peek(char &c) { while(!_msgReady) { if(_timeout > 0) { Selector selector; selector.set_timeout( _timeout ); selector.add_fd( _sock, Selector::IO_READ ); selector.execute(); if ( selector.timed_out() ) { return 0; } else if ( !selector.has_ready() ) { dprintf(D_NETWORK, ""select returns %d, recv failed\n"", selector.select_retval() ); return 0; } } (void)handle_incoming_packet(); } if(_longMsg) // long message return _longMsg->peek(c); else // short message return _shortMsg.peek(c); } ",0 "xfs_file_mmap( struct file *filp, struct vm_area_struct *vma) { vma->vm_ops = &xfs_file_vm_ops; file_accessed(filp); return 0; } ",0 "int CMS_RecipientInfo_type(CMS_RecipientInfo *ri) { return ri->type; } ",0 "void ImageBitmapFactories::ImageBitmapLoader::LoadBlobAsync( Blob* blob) { loader_->Start(blob->GetBlobDataHandle()); } ",1 "static void packet_dev_mclist_delete(struct net_device *dev, struct packet_mclist **mlp) { struct packet_mclist *ml; while ((ml = *mlp) != NULL) { if (ml->ifindex == dev->ifindex) { packet_dev_mc(dev, ml, -1); *mlp = ml->next; kfree(ml); } else mlp = &ml->next; } } ",0 "static void serializedScriptValueMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::serializedScriptValueMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " void testUriHostIpFuture() { } ",0 "DecodeUnits(int field, char *lowtoken, int *val) { int type; datetkn *tp; if (deltacache[field] != NULL && strncmp(lowtoken, deltacache[field]->token, TOKMAXLEN) == 0) tp = deltacache[field]; else tp = datebsearch(lowtoken, deltatktbl, szdeltatktbl); deltacache[field] = tp; if (tp == NULL) { type = UNKNOWN_FIELD; *val = 0; } else { type = tp->type; if (type == TZ || type == DTZ) *val = FROMVAL(tp); else *val = tp->value; } return type; } /* DecodeUnits() */ ",0 "int lxc_write_to_file(const char *filename, const void* buf, size_t count, bool add_newline) { int fd, saved_errno; ssize_t ret; fd = open(filename, O_WRONLY | O_TRUNC | O_CREAT | O_CLOEXEC, 0666); if (fd < 0) return -1; ret = lxc_write_nointr(fd, buf, count); if (ret < 0) goto out_error; if ((size_t)ret != count) goto out_error; if (add_newline) { ret = lxc_write_nointr(fd, ""\n"", 1); if (ret != 1) goto out_error; } close(fd); return 0; out_error: saved_errno = errno; close(fd); errno = saved_errno; return -1; } ",0 "base::FilePath WebRunnerBrowserContext::GetCachePath() const { NOTIMPLEMENTED(); return base::FilePath(); } ",0 "GLvoid StubGLEnable(GLenum cap) { glEnable(cap); } ",0 "static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; Index *pPk; int nPk; int i, j; sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) */ if( !db->init.imposterTable ){ for(i=0; inCol; i++){ if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ pTab->aCol[i].notNull = OE_Abort; } } } /* The remaining transformations only apply to b-tree tables, not to ** virtual tables */ if( IN_DECLARE_VTAB ) return; /* Convert the OP_CreateTable opcode that would normally create the ** root-page for the table into an OP_CreateIndex opcode. The index ** created will become the PRIMARY KEY index. */ if( pParse->addrCrTab ){ assert( v ); sqlite3VdbeChangeOpcode(v, pParse->addrCrTab, OP_CreateIndex); } /* Locate the PRIMARY KEY index. Or, if this table was originally ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. */ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed ) return; pPk = sqlite3PrimaryKeyIndex(pTab); pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master ** table entry. This is only required if currently generating VDBE ** code for a CREATE TABLE (not when parsing one as part of reading ** a database schema). */ if( v ){ assert( db->init.busy==0 ); sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); } /* ** Remove all redundant columns from the PRIMARY KEY. For example, change ** ""PRIMARY KEY(a,b,a,b,c,b,c,d)"" into just ""PRIMARY KEY(a,b,c,d)"". Later ** code assumes the PRIMARY KEY contains no repeated columns. */ for(i=j=1; inKeyCol; i++){ if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){ pPk->nColumn--; }else{ pPk->aiColumn[j++] = pPk->aiColumn[i]; } } pPk->nKeyCol = j; } assert( pPk!=0 ); pPk->isCovering = 1; if( !db->init.imposterTable ) pPk->uniqNotNull = 1; nPk = pPk->nKeyCol; /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; /* Update the in-memory representation of all UNIQUE indices by converting ** the final rowid column into one or more columns of the PRIMARY KEY. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int n; if( IsPrimaryKeyIndex(pIdx) ) continue; for(i=n=0; iaiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++; } if( n==0 ){ /* This index is a superset of the primary key */ pIdx->nColumn = pIdx->nKeyCol; continue; } if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; for(i=0, j=pIdx->nKeyCol; iaiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){ pIdx->aiColumn[j] = pPk->aiColumn[i]; pIdx->azColl[j] = pPk->azColl[i]; j++; } } assert( pIdx->nColumn>=pIdx->nKeyCol+n ); assert( pIdx->nColumn>=j ); } /* Add all table columns to the PRIMARY KEY index */ if( nPknCol ){ if( resizeIndexObject(db, pPk, pTab->nCol) ) return; for(i=0, j=nPk; inCol; i++){ if( !hasColumn(pPk->aiColumn, j, i) ){ assert( jnColumn ); pPk->aiColumn[j] = i; pPk->azColl[j] = sqlite3StrBINARY; j++; } } assert( pPk->nColumn==j ); assert( pTab->nCol==j ); }else{ pPk->nColumn = pTab->nCol; } } ",0 "static u32 bond_fix_features(struct net_device *dev, u32 features) { struct slave *slave; struct bonding *bond = netdev_priv(dev); u32 mask; int i; read_lock(&bond->lock); if (!bond->first_slave) { /* Disable adding VLANs to empty bond. But why? --mq */ features |= NETIF_F_VLAN_CHALLENGED; goto out; } mask = features; features &= ~NETIF_F_ONE_FOR_ALL; features |= NETIF_F_ALL_FOR_ALL; bond_for_each_slave(bond, slave, i) { features = netdev_increment_features(features, slave->dev->features, mask); } out: read_unlock(&bond->lock); return features; } ",0 "WebGLTexture* WebGLRenderingContextBase::ValidateTextureBinding( const char* function_name, GLenum target) { WebGLTexture* tex = nullptr; switch (target) { case GL_TEXTURE_2D: tex = texture_units_[active_texture_unit_].texture2d_binding_.Get(); break; case GL_TEXTURE_CUBE_MAP: tex = texture_units_[active_texture_unit_].texture_cube_map_binding_.Get(); break; case GL_TEXTURE_3D: if (!IsWebGL2OrHigher()) { SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid texture target""); return nullptr; } tex = texture_units_[active_texture_unit_].texture3d_binding_.Get(); break; case GL_TEXTURE_2D_ARRAY: if (!IsWebGL2OrHigher()) { SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid texture target""); return nullptr; } tex = texture_units_[active_texture_unit_].texture2d_array_binding_.Get(); break; case GL_TEXTURE_VIDEO_IMAGE_WEBGL: if (!ExtensionEnabled(kWebGLVideoTextureName)) { SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid texture target""); return nullptr; } tex = texture_units_[active_texture_unit_] .texture_video_image_binding_.Get(); break; default: SynthesizeGLError(GL_INVALID_ENUM, function_name, ""invalid texture target""); return nullptr; } if (!tex) SynthesizeGLError(GL_INVALID_OPERATION, function_name, ""no texture bound to target""); return tex; } ",0 "ProcGrabServer(ClientPtr client) { int rc; REQUEST_SIZE_MATCH(xReq); if (grabState != GrabNone && client != grabClient) { ResetCurrentRequest(client); client->sequence--; BITSET(grabWaiters, client->index); IgnoreClient(client); return Success; } rc = OnlyListenToOneClient(client); if (rc != Success) return rc; grabState = GrabKickout; grabClient = client; if (ServerGrabCallback) { ServerGrabInfoRec grabinfo; grabinfo.client = client; grabinfo.grabstate = SERVER_GRABBED; CallCallbacks(&ServerGrabCallback, (void *) &grabinfo); } return Success; } ",0 "xsltAllocateExtraCtxt(xsltTransformContextPtr ctxt) { if (ctxt->extrasNr >= ctxt->extrasMax) { int i; if (ctxt->extrasNr == 0) { ctxt->extrasMax = 20; ctxt->extras = (xsltRuntimeExtraPtr) xmlMalloc(ctxt->extrasMax * sizeof(xsltRuntimeExtra)); if (ctxt->extras == NULL) { xmlGenericError(xmlGenericErrorContext, ""xsltAllocateExtraCtxt: out of memory\n""); ctxt->state = XSLT_STATE_ERROR; return(0); } for (i = 0;i < ctxt->extrasMax;i++) { ctxt->extras[i].info = NULL; ctxt->extras[i].deallocate = NULL; ctxt->extras[i].val.ptr = NULL; } } else { xsltRuntimeExtraPtr tmp; ctxt->extrasMax += 100; tmp = (xsltRuntimeExtraPtr) xmlRealloc(ctxt->extras, ctxt->extrasMax * sizeof(xsltRuntimeExtra)); if (tmp == NULL) { xmlGenericError(xmlGenericErrorContext, ""xsltAllocateExtraCtxt: out of memory\n""); ctxt->state = XSLT_STATE_ERROR; return(0); } ctxt->extras = tmp; for (i = ctxt->extrasNr;i < ctxt->extrasMax;i++) { ctxt->extras[i].info = NULL; ctxt->extras[i].deallocate = NULL; ctxt->extras[i].val.ptr = NULL; } } } return(ctxt->extrasNr++); } ",0 "void FrameLoader::finishedLoadingDocument(DocumentLoader* loader) { #if PLATFORM(WIN) || PLATFORM(CHROMIUM) if (m_stateMachine.creatingInitialEmptyDocument()) return; #endif const String& responseMIMEType = loader->responseMIMEType(); #if PLATFORM(MAC) m_client->finishedLoading(loader); if (!ArchiveFactory::isArchiveMimeType(responseMIMEType)) return; #else if (!ArchiveFactory::isArchiveMimeType(responseMIMEType)) { m_client->finishedLoading(loader); return; } #endif RefPtr archive(ArchiveFactory::create(loader->mainResourceData().get(), responseMIMEType)); if (!archive) return; loader->addAllArchiveResources(archive.get()); ArchiveResource* mainResource = archive->mainResource(); loader->setParsedArchiveData(mainResource->data()); writer()->setMIMEType(mainResource->mimeType()); closeURL(); didOpenURL(mainResource->url()); String userChosenEncoding = documentLoader()->overrideEncoding(); bool encodingIsUserChosen = !userChosenEncoding.isNull(); writer()->setEncoding(encodingIsUserChosen ? userChosenEncoding : mainResource->textEncoding(), encodingIsUserChosen); ASSERT(m_frame->document()); addData(mainResource->data()->data(), mainResource->data()->size()); } ",0 "content::WebContents* GetWebContentsByFrameID(int render_process_id, int render_frame_id) { content::RenderFrameHost* render_frame_host = content::RenderFrameHost::FromID(render_process_id, render_frame_id); if (!render_frame_host) return NULL; return content::WebContents::FromRenderFrameHost(render_frame_host); } ",0 "void CCThreadProxy::setNeedsCommitOnCCThread() { ASSERT(isImplThread()); TRACE_EVENT(""CCThreadProxy::setNeedsCommitOnCCThread"", this, 0); m_schedulerOnCCThread->requestCommit(); } ",0 " void HTMLMediaElement::MediaLoadingFailed(WebMediaPlayer::NetworkState error, const String& message) { BLINK_MEDIA_LOG << ""MediaLoadingFailed("" << (void*)this << "", "" << static_cast(error) << "", message='"" << message << ""')""; StopPeriodicTimers(); if (ready_state_ < kHaveMetadata && load_state_ == kLoadingFromSourceElement) { if (current_source_node_) { current_source_node_->ScheduleErrorEvent(); } else { BLINK_MEDIA_LOG << ""mediaLoadingFailed("" << (void*)this << "") - error event not sent, was removed""; } ForgetResourceSpecificTracks(); if (HavePotentialSourceChild()) { BLINK_MEDIA_LOG << ""mediaLoadingFailed("" << (void*)this << "") - scheduling next ""; ScheduleNextSourceChild(); } else { BLINK_MEDIA_LOG << ""mediaLoadingFailed("" << (void*)this << "") - no more elements, waiting""; WaitForSourceChange(); } return; } if (error == WebMediaPlayer::kNetworkStateNetworkError && ready_state_ >= kHaveMetadata) { MediaEngineError(MediaError::Create(MediaError::kMediaErrNetwork, message)); } else if (error == WebMediaPlayer::kNetworkStateDecodeError) { MediaEngineError(MediaError::Create(MediaError::kMediaErrDecode, message)); } else if ((error == WebMediaPlayer::kNetworkStateFormatError || error == WebMediaPlayer::kNetworkStateNetworkError) && load_state_ == kLoadingFromSrcAttr) { if (message.IsEmpty()) { NoneSupported(BuildElementErrorMessage( error == WebMediaPlayer::kNetworkStateFormatError ? ""Format error"" : ""Network error"")); } else { NoneSupported(message); } } UpdateDisplayState(); } ",1 "set_lookup(struct ctl_table_root *root) { return ¤t_user_ns()->set; } ",0 "static void vmx_set_cr0(struct kvm_vcpu *vcpu, unsigned long cr0) { struct vcpu_vmx *vmx = to_vmx(vcpu); unsigned long hw_cr0; hw_cr0 = (cr0 & ~KVM_GUEST_CR0_MASK); if (enable_unrestricted_guest) hw_cr0 |= KVM_VM_CR0_ALWAYS_ON_UNRESTRICTED_GUEST; else { hw_cr0 |= KVM_VM_CR0_ALWAYS_ON; if (vmx->rmode.vm86_active && (cr0 & X86_CR0_PE)) enter_pmode(vcpu); if (!vmx->rmode.vm86_active && !(cr0 & X86_CR0_PE)) enter_rmode(vcpu); } #ifdef CONFIG_X86_64 if (vcpu->arch.efer & EFER_LME) { if (!is_paging(vcpu) && (cr0 & X86_CR0_PG)) enter_lmode(vcpu); if (is_paging(vcpu) && !(cr0 & X86_CR0_PG)) exit_lmode(vcpu); } #endif if (enable_ept && !enable_unrestricted_guest) ept_update_paging_mode_cr0(&hw_cr0, cr0, vcpu); vmcs_writel(CR0_READ_SHADOW, cr0); vmcs_writel(GUEST_CR0, hw_cr0); vcpu->arch.cr0 = cr0; /* depends on vcpu->arch.cr0 to be set to a new value */ vmx->emulation_required = emulation_required(vcpu); } ",0 "static void mark_map_reg(struct bpf_reg_state *regs, u32 regno, u32 id, bool is_null) { struct bpf_reg_state *reg = ®s[regno]; if (reg->type == PTR_TO_MAP_VALUE_OR_NULL && reg->id == id) { /* Old offset (both fixed and variable parts) should * have been known-zero, because we don't allow pointer * arithmetic on pointers that might be NULL. */ if (WARN_ON_ONCE(reg->smin_value || reg->smax_value || !tnum_equals_const(reg->var_off, 0) || reg->off)) { __mark_reg_known_zero(reg); reg->off = 0; } if (is_null) { reg->type = SCALAR_VALUE; } else if (reg->map_ptr->inner_map_meta) { reg->type = CONST_PTR_TO_MAP; reg->map_ptr = reg->map_ptr->inner_map_meta; } else { reg->type = PTR_TO_MAP_VALUE; } /* We don't need id from this point onwards anymore, thus we * should better reset it, so that state pruning has chances * to take effect. */ reg->id = 0; } } ",0 "int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) { struct bonding *bond = netdev_priv(bond_dev); struct slave *slave, *oldcurrent; struct sockaddr addr; u32 old_features = bond_dev->features; /* slave is not a slave or master is not master of this slave */ if (!(slave_dev->flags & IFF_SLAVE) || (slave_dev->master != bond_dev)) { pr_err(""%s: Error: cannot release %s.\n"", bond_dev->name, slave_dev->name); return -EINVAL; } block_netpoll_tx(); netdev_bonding_change(bond_dev, NETDEV_RELEASE); write_lock_bh(&bond->lock); slave = bond_get_slave_by_dev(bond, slave_dev); if (!slave) { /* not a slave of this bond */ pr_info(""%s: %s not enslaved\n"", bond_dev->name, slave_dev->name); write_unlock_bh(&bond->lock); unblock_netpoll_tx(); return -EINVAL; } /* unregister rx_handler early so bond_handle_frame wouldn't be called * for this slave anymore. */ netdev_rx_handler_unregister(slave_dev); write_unlock_bh(&bond->lock); synchronize_net(); write_lock_bh(&bond->lock); if (!bond->params.fail_over_mac) { if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) && bond->slave_cnt > 1) pr_warning(""%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n"", bond_dev->name, slave_dev->name, slave->perm_hwaddr, bond_dev->name, slave_dev->name); } /* Inform AD package of unbinding of slave. */ if (bond->params.mode == BOND_MODE_8023AD) { /* must be called before the slave is * detached from the list */ bond_3ad_unbind_slave(slave); } pr_info(""%s: releasing %s interface %s\n"", bond_dev->name, bond_is_active_slave(slave) ? ""active"" : ""backup"", slave_dev->name); oldcurrent = bond->curr_active_slave; bond->current_arp_slave = NULL; /* release the slave from its bond */ bond_detach_slave(bond, slave); if (bond->primary_slave == slave) bond->primary_slave = NULL; if (oldcurrent == slave) bond_change_active_slave(bond, NULL); if (bond_is_lb(bond)) { /* Must be called only after the slave has been * detached from the list and the curr_active_slave * has been cleared (if our_slave == old_current), * but before a new active slave is selected. */ write_unlock_bh(&bond->lock); bond_alb_deinit_slave(bond, slave); write_lock_bh(&bond->lock); } if (oldcurrent == slave) { /* * Note that we hold RTNL over this sequence, so there * is no concern that another slave add/remove event * will interfere. */ write_unlock_bh(&bond->lock); read_lock(&bond->lock); write_lock_bh(&bond->curr_slave_lock); bond_select_active_slave(bond); write_unlock_bh(&bond->curr_slave_lock); read_unlock(&bond->lock); write_lock_bh(&bond->lock); } if (bond->slave_cnt == 0) { bond_set_carrier(bond); /* if the last slave was removed, zero the mac address * of the master so it will be set by the application * to the mac address of the first slave */ memset(bond_dev->dev_addr, 0, bond_dev->addr_len); if (bond_vlan_used(bond)) { pr_warning(""%s: Warning: clearing HW address of %s while it still has VLANs.\n"", bond_dev->name, bond_dev->name); pr_warning(""%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n"", bond_dev->name); } } write_unlock_bh(&bond->lock); unblock_netpoll_tx(); bond_compute_features(bond); if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && (old_features & NETIF_F_VLAN_CHALLENGED)) pr_info(""%s: last VLAN challenged slave %s left bond %s. VLAN blocking is removed\n"", bond_dev->name, slave_dev->name, bond_dev->name); /* must do this from outside any spinlocks */ bond_destroy_slave_symlinks(bond_dev, slave_dev); bond_del_vlans_from_slave(bond, slave_dev); /* If the mode USES_PRIMARY, then we should only remove its * promisc and mc settings if it was the curr_active_slave, but that was * already taken care of above when we detached the slave */ if (!USES_PRIMARY(bond->params.mode)) { /* unset promiscuity level from slave */ if (bond_dev->flags & IFF_PROMISC) dev_set_promiscuity(slave_dev, -1); /* unset allmulti level from slave */ if (bond_dev->flags & IFF_ALLMULTI) dev_set_allmulti(slave_dev, -1); /* flush master's mc_list from slave */ netif_addr_lock_bh(bond_dev); bond_mc_list_flush(bond_dev, slave_dev); netif_addr_unlock_bh(bond_dev); } netdev_set_bond_master(slave_dev, NULL); slave_disable_netpoll(slave); /* close slave before restoring its mac address */ dev_close(slave_dev); if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { /* restore original (""permanent"") mac address */ memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); addr.sa_family = slave_dev->type; dev_set_mac_address(slave_dev, &addr); } dev_set_mtu(slave_dev, slave->original_mtu); slave_dev->priv_flags &= ~IFF_BONDING; kfree(slave); return 0; /* deletion OK */ } ",0 "static int rb_check_bpage(struct ring_buffer_per_cpu *cpu_buffer, struct buffer_page *bpage) { unsigned long val = (unsigned long)bpage; if (RB_WARN_ON(cpu_buffer, val & RB_FLAG_MASK)) return 1; return 0; } ",0 "static bool is_pointer_value(struct bpf_verifier_env *env, int regno) { return __is_pointer_value(env->allow_ptr_leaks, reg_state(env, regno)); } ",0 "bool pch_copy (void) { return p_copy[OLD] && p_copy[NEW]; } ",0 "void DocumentWriter::end() { m_frame->loader()->didEndDocument(); endIfNotLoadingMainResource(); } ",0 "void ProcessCommitResponseCommand::ProcessSuccessfulCommitResponse( const sync_pb::SyncEntity& committed_entry, const CommitResponse_EntryResponse& entry_response, const syncable::Id& pre_commit_id, syncable::MutableEntry* local_entry, bool syncing_was_set, set* deleted_folders) { DCHECK(local_entry->Get(IS_UNSYNCED)); if (!UpdateVersionAfterCommit(committed_entry, entry_response, pre_commit_id, local_entry)) { LOG(ERROR) << ""Bad version in commit return for "" << *local_entry << "" new_id:"" << entry_response.id() << "" new_version:"" << entry_response.version(); return; } if (!ChangeIdAfterCommit(entry_response, pre_commit_id, local_entry)) { return; } UpdateServerFieldsAfterCommit(committed_entry, entry_response, local_entry); if (syncing_was_set) { OverrideClientFieldsAfterCommit(committed_entry, entry_response, local_entry); local_entry->Put(IS_UNSYNCED, false); } if (local_entry->Get(IS_DIR) && local_entry->Get(IS_DEL)) { deleted_folders->insert(local_entry->Get(ID)); } } ",0 "bool SoftVPX::outputBufferSafe(OMX_BUFFERHEADERTYPE *outHeader) { uint32_t width = outputBufferWidth(); uint32_t height = outputBufferHeight(); uint64_t nFilledLen = width; nFilledLen *= height; if (nFilledLen > UINT32_MAX / 3) { ALOGE(""b/29421675, nFilledLen overflow %llu w %u h %u"", nFilledLen, width, height); android_errorWriteLog(0x534e4554, ""29421675""); return false; } else if (outHeader->nAllocLen < outHeader->nFilledLen) { ALOGE(""b/27597103, buffer too small""); android_errorWriteLog(0x534e4554, ""27597103""); return false; } return true; } ",1 "int lxcfs_rmdir(const char *path) { if (strncmp(path, ""/cgroup"", 7) == 0) return cg_rmdir(path); return -EINVAL; } ",0 "int security_transition_sid_user(u32 ssid, u32 tsid, u16 tclass, const char *objname, u32 *out_sid) { return security_compute_sid(ssid, tsid, tclass, AVTAB_TRANSITION, objname, out_sid, false); } ",0 "reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) { XML_Char *data; if (! parser->m_commentHandler) { if (parser->m_defaultHandler) reportDefault(parser, enc, start, end); return 1; } data = poolStoreString(&parser->m_tempPool, enc, start + enc->minBytesPerChar * 4, end - enc->minBytesPerChar * 3); if (! data) return 0; normalizeLines(data); parser->m_commentHandler(parser->m_handlerArg, data); poolClear(&parser->m_tempPool); return 1; } ",0 "ScopedTextureBinder::~ScopedTextureBinder() { ScopedGLErrorSuppressor suppressor(""ScopedTextureBinder::dtor"", error_state_); RestoreCurrentTextureBindings(state_, target_, 0); state_->RestoreActiveTexture(); } ",0 "static Image *ReadEXRImage(const ImageInfo *image_info,ExceptionInfo *exception) { const ImfHeader *hdr_info; Image *image; ImageInfo *read_info; ImfInputFile *file; ImfRgba *scanline; int max_x, max_y, min_x, min_y; MagickBooleanType status; register ssize_t x; register PixelPacket *q; ssize_t y; /* Open image. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } read_info=CloneImageInfo(image_info); if (IsPathAccessible(read_info->filename) == MagickFalse) { (void) AcquireUniqueFilename(read_info->filename); (void) ImageToFile(image,read_info->filename,exception); } file=ImfOpenInputFile(read_info->filename); if (file == (ImfInputFile *) NULL) { ThrowFileException(exception,BlobError,""UnableToOpenBlob"", ImfErrorMessage()); if (LocaleCompare(image_info->filename,read_info->filename) != 0) (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); return((Image *) NULL); } hdr_info=ImfInputHeader(file); ImfHeaderDisplayWindow(hdr_info,&min_x,&min_y,&max_x,&max_y); image->columns=max_x-min_x+1UL; image->rows=max_y-min_y+1UL; image->matte=MagickTrue; SetImageColorspace(image,RGBColorspace); if (image_info->ping != MagickFalse) { (void) ImfCloseInputFile(file); if (LocaleCompare(image_info->filename,read_info->filename) != 0) (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); } scanline=(ImfRgba *) AcquireQuantumMemory(image->columns,sizeof(*scanline)); if (scanline == (ImfRgba *) NULL) { (void) ImfCloseInputFile(file); if (LocaleCompare(image_info->filename,read_info->filename) != 0) (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); } for (y=0; y < (ssize_t) image->rows; y++) { q=QueueAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; ResetMagickMemory(scanline,0,image->columns*sizeof(*scanline)); ImfInputSetFrameBuffer(file,scanline-min_x-image->columns*(min_y+y),1, image->columns); ImfInputReadPixels(file,min_y+y,min_y+y); for (x=0; x < (ssize_t) image->columns; x++) { SetPixelRed(q,ClampToQuantum((MagickRealType) QuantumRange* ImfHalfToFloat(scanline[x].r))); SetPixelGreen(q,ClampToQuantum((MagickRealType) QuantumRange* ImfHalfToFloat(scanline[x].g))); SetPixelBlue(q,ClampToQuantum((MagickRealType) QuantumRange* ImfHalfToFloat(scanline[x].b))); SetPixelAlpha(q,ClampToQuantum((MagickRealType) QuantumRange* ImfHalfToFloat(scanline[x].a))); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } scanline=(ImfRgba *) RelinquishMagickMemory(scanline); (void) ImfCloseInputFile(file); if (LocaleCompare(image_info->filename,read_info->filename) != 0) (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "void GLES2DecoderImpl::DoMultiDrawEndCHROMIUM() { MultiDrawManager::ResultData result; if (!multi_draw_manager_->End(&result)) { MarkContextLost(error::kGuilty); group_->LoseContexts(error::kInnocent); return; } switch (result.draw_function) { case MultiDrawManager::DrawFunction::DrawArrays: DoMultiDrawArrays(""glMultiDrawArraysWEBGL"", false, result.mode, result.firsts.data(), result.counts.data(), nullptr, result.drawcount); break; case MultiDrawManager::DrawFunction::DrawArraysInstanced: DoMultiDrawArrays(""glMultiDrawArraysInstancedWEBGL"", true, result.mode, result.firsts.data(), result.counts.data(), result.instance_counts.data(), result.drawcount); break; case MultiDrawManager::DrawFunction::DrawElements: DoMultiDrawElements(""glMultiDrawElementsWEBGL"", false, result.mode, result.counts.data(), result.type, result.offsets.data(), nullptr, result.drawcount); break; case MultiDrawManager::DrawFunction::DrawElementsInstanced: DoMultiDrawElements(""glMultiDrawElementsInstancedWEBGL"", true, result.mode, result.counts.data(), result.type, result.offsets.data(), result.instance_counts.data(), result.drawcount); break; default: NOTREACHED(); MarkContextLost(error::kGuilty); group_->LoseContexts(error::kInnocent); } } ",0 "bool XMLHttpRequest::initSend(ExceptionState& es) { if (!scriptExecutionContext()) return false; if (m_state != OPENED || m_loader) { es.throwDOMException(InvalidStateError, ExceptionMessages::failedToExecute(""send"", ""XMLHttpRequest"", ""the object's state must be OPENED."")); return false; } m_error = false; return true; } ",0 " double ConvolverNode::latencyTime() const { return m_reverb ? m_reverb->latencyFrames() / static_cast(sampleRate()) : 0; } ",1 "int git_indexwriter_commit(git_indexwriter *writer) { int error; git_oid checksum = {{ 0 }}; if (!writer->should_write) return 0; git_vector_sort(&writer->index->entries); git_vector_sort(&writer->index->reuc); if ((error = write_index(&checksum, writer->index, &writer->file)) < 0) { git_indexwriter_cleanup(writer); return error; } if ((error = git_filebuf_commit(&writer->file)) < 0) return error; if ((error = git_futils_filestamp_check( &writer->index->stamp, writer->index->index_file_path)) < 0) { giterr_set(GITERR_OS, ""could not read index timestamp""); return -1; } writer->index->on_disk = 1; git_oid_cpy(&writer->index->checksum, &checksum); git_index_free(writer->index); writer->index = NULL; return 0; } ",0 "static void atrtr_set_default(struct net_device *dev) { atrtr_default.dev = dev; atrtr_default.flags = RTF_UP; atrtr_default.gateway.s_net = htons(0); atrtr_default.gateway.s_node = 0; } ",0 " StatisticsCB NewStatisticsCB() { return base::Bind(&MockStatisticsCB::OnStatistics, base::Unretained(&statistics_cb_)); } ",0 "static int ip_route_input_mc(struct sk_buff *skb, __be32 daddr, __be32 saddr, u8 tos, struct net_device *dev, int our) { unsigned int hash; struct rtable *rth; __be32 spec_dst; struct in_device *in_dev = __in_dev_get_rcu(dev); u32 itag = 0; int err; /* Primary sanity checks. */ if (in_dev == NULL) return -EINVAL; if (ipv4_is_multicast(saddr) || ipv4_is_lbcast(saddr) || ipv4_is_loopback(saddr) || skb->protocol != htons(ETH_P_IP)) goto e_inval; if (ipv4_is_zeronet(saddr)) { if (!ipv4_is_local_multicast(daddr)) goto e_inval; spec_dst = inet_select_addr(dev, 0, RT_SCOPE_LINK); } else { err = fib_validate_source(skb, saddr, 0, tos, 0, dev, &spec_dst, &itag); if (err < 0) goto e_err; } rth = rt_dst_alloc(init_net.loopback_dev, IN_DEV_CONF_GET(in_dev, NOPOLICY), false); if (!rth) goto e_nobufs; #ifdef CONFIG_IP_ROUTE_CLASSID rth->dst.tclassid = itag; #endif rth->dst.output = ip_rt_bug; rth->rt_key_dst = daddr; rth->rt_key_src = saddr; rth->rt_genid = rt_genid(dev_net(dev)); rth->rt_flags = RTCF_MULTICAST; rth->rt_type = RTN_MULTICAST; rth->rt_key_tos = tos; rth->rt_dst = daddr; rth->rt_src = saddr; rth->rt_route_iif = dev->ifindex; rth->rt_iif = dev->ifindex; rth->rt_oif = 0; rth->rt_mark = skb->mark; rth->rt_gateway = daddr; rth->rt_spec_dst= spec_dst; rth->rt_peer_genid = 0; rth->peer = NULL; rth->fi = NULL; if (our) { rth->dst.input= ip_local_deliver; rth->rt_flags |= RTCF_LOCAL; } #ifdef CONFIG_IP_MROUTE if (!ipv4_is_local_multicast(daddr) && IN_DEV_MFORWARD(in_dev)) rth->dst.input = ip_mr_input; #endif RT_CACHE_STAT_INC(in_slow_mc); hash = rt_hash(daddr, saddr, dev->ifindex, rt_genid(dev_net(dev))); rth = rt_intern_hash(hash, rth, skb, dev->ifindex); return IS_ERR(rth) ? PTR_ERR(rth) : 0; e_nobufs: return -ENOBUFS; e_inval: return -EINVAL; e_err: return err; } ",0 " Ins_WCVTP( TT_ExecContext exc, FT_Long* args ) { FT_ULong I = (FT_ULong)args[0]; if ( BOUNDSL( I, exc->cvtSize ) ) { if ( exc->pedantic_hinting ) ARRAY_BOUND_ERROR; } else exc->func_write_cvt( exc, I, args[1] ); } ",0 "views::View* AutofillDialogViews::GetLoadingShieldForTesting() { return loading_shield_; } ",0 "bool WindowsUpdateFunction::RunImpl() { int window_id = extension_misc::kUnknownWindowId; EXTENSION_FUNCTION_VALIDATE(args_->GetInteger(0, &window_id)); DictionaryValue* update_props; EXTENSION_FUNCTION_VALIDATE(args_->GetDictionary(1, &update_props)); WindowController* controller; if (!GetWindowFromWindowID(this, window_id, &controller)) return false; #if defined(OS_WIN) if (win8::IsSingleWindowMetroMode()) { SetResult(controller->CreateWindowValue()); return true; } #endif ui::WindowShowState show_state = ui::SHOW_STATE_DEFAULT; // No change. std::string state_str; if (update_props->HasKey(keys::kShowStateKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetString(keys::kShowStateKey, &state_str)); if (state_str == keys::kShowStateValueNormal) { show_state = ui::SHOW_STATE_NORMAL; } else if (state_str == keys::kShowStateValueMinimized) { show_state = ui::SHOW_STATE_MINIMIZED; } else if (state_str == keys::kShowStateValueMaximized) { show_state = ui::SHOW_STATE_MAXIMIZED; } else if (state_str == keys::kShowStateValueFullscreen) { show_state = ui::SHOW_STATE_FULLSCREEN; } else { error_ = keys::kInvalidWindowStateError; return false; } } if (show_state != ui::SHOW_STATE_FULLSCREEN && show_state != ui::SHOW_STATE_DEFAULT) controller->SetFullscreenMode(false, GetExtension()->url()); switch (show_state) { case ui::SHOW_STATE_MINIMIZED: controller->window()->Minimize(); break; case ui::SHOW_STATE_MAXIMIZED: controller->window()->Maximize(); break; case ui::SHOW_STATE_FULLSCREEN: if (controller->window()->IsMinimized() || controller->window()->IsMaximized()) controller->window()->Restore(); controller->SetFullscreenMode(true, GetExtension()->url()); break; case ui::SHOW_STATE_NORMAL: controller->window()->Restore(); break; default: break; } gfx::Rect bounds; if (controller->window()->IsMinimized()) bounds = controller->window()->GetRestoredBounds(); else bounds = controller->window()->GetBounds(); bool set_bounds = false; int bounds_val; if (update_props->HasKey(keys::kLeftKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kLeftKey, &bounds_val)); bounds.set_x(bounds_val); set_bounds = true; } if (update_props->HasKey(keys::kTopKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kTopKey, &bounds_val)); bounds.set_y(bounds_val); set_bounds = true; } if (update_props->HasKey(keys::kWidthKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kWidthKey, &bounds_val)); bounds.set_width(bounds_val); set_bounds = true; } if (update_props->HasKey(keys::kHeightKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetInteger( keys::kHeightKey, &bounds_val)); bounds.set_height(bounds_val); set_bounds = true; } if (set_bounds) { if (show_state == ui::SHOW_STATE_MINIMIZED || show_state == ui::SHOW_STATE_MAXIMIZED || show_state == ui::SHOW_STATE_FULLSCREEN) { error_ = keys::kInvalidWindowStateError; return false; } controller->window()->SetBounds(bounds); } bool active_val = false; if (update_props->HasKey(keys::kFocusedKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean( keys::kFocusedKey, &active_val)); if (active_val) { if (show_state == ui::SHOW_STATE_MINIMIZED) { error_ = keys::kInvalidWindowStateError; return false; } controller->window()->Activate(); } else { if (show_state == ui::SHOW_STATE_MAXIMIZED || show_state == ui::SHOW_STATE_FULLSCREEN) { error_ = keys::kInvalidWindowStateError; return false; } controller->window()->Deactivate(); } } bool draw_attention = false; if (update_props->HasKey(keys::kDrawAttentionKey)) { EXTENSION_FUNCTION_VALIDATE(update_props->GetBoolean( keys::kDrawAttentionKey, &draw_attention)); controller->window()->FlashFrame(draw_attention); } SetResult(controller->CreateWindowValue()); return true; } ",0 "cib_ipc_closed(qb_ipcs_connection_t *c) { cib_client_t *cib_client = qb_ipcs_context_get(c); crm_trace(""Connection %p closed"", c); CRM_ASSERT(cib_client != NULL); CRM_ASSERT(cib_client->id != NULL); if (!g_hash_table_remove(client_list, cib_client->id)) { crm_err(""Client %s not found in the hashtable"", cib_client->name); } return 0; } ",0 "int __sys_recvmmsg(int fd, struct mmsghdr __user *mmsg, unsigned int vlen, unsigned int flags, struct timespec *timeout) { int fput_needed, err, datagrams; struct socket *sock; struct mmsghdr __user *entry; struct compat_mmsghdr __user *compat_entry; struct msghdr msg_sys; struct timespec64 end_time; struct timespec64 timeout64; if (timeout && poll_select_set_timeout(&end_time, timeout->tv_sec, timeout->tv_nsec)) return -EINVAL; datagrams = 0; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) return err; if (likely(!(flags & MSG_ERRQUEUE))) { err = sock_error(sock->sk); if (err) { datagrams = err; goto out_put; } } entry = mmsg; compat_entry = (struct compat_mmsghdr __user *)mmsg; while (datagrams < vlen) { /* * No need to ask LSM for more than the first datagram. */ if (MSG_CMSG_COMPAT & flags) { err = ___sys_recvmsg(sock, (struct user_msghdr __user *)compat_entry, &msg_sys, flags & ~MSG_WAITFORONE, datagrams); if (err < 0) break; err = __put_user(err, &compat_entry->msg_len); ++compat_entry; } else { err = ___sys_recvmsg(sock, (struct user_msghdr __user *)entry, &msg_sys, flags & ~MSG_WAITFORONE, datagrams); if (err < 0) break; err = put_user(err, &entry->msg_len); ++entry; } if (err) break; ++datagrams; /* MSG_WAITFORONE turns on MSG_DONTWAIT after one packet */ if (flags & MSG_WAITFORONE) flags |= MSG_DONTWAIT; if (timeout) { ktime_get_ts64(&timeout64); *timeout = timespec64_to_timespec( timespec64_sub(end_time, timeout64)); if (timeout->tv_sec < 0) { timeout->tv_sec = timeout->tv_nsec = 0; break; } /* Timeout, return less than vlen datagrams */ if (timeout->tv_nsec == 0 && timeout->tv_sec == 0) break; } /* Out of band data, return right away */ if (msg_sys.msg_flags & MSG_OOB) break; cond_resched(); } if (err == 0) goto out_put; if (datagrams == 0) { datagrams = err; goto out_put; } /* * We may return less entries than requested (vlen) if the * sock is non block and there aren't enough datagrams... */ if (err != -EAGAIN) { /* * ... or if recvmsg returns an error after we * received some datagrams, where we record the * error to return on the next call or if the * app asks about it using getsockopt(SO_ERROR). */ sock->sk->sk_err = -err; } out_put: fput_light(sock->file, fput_needed); return datagrams; } ",0 "static int cxusb_rc_query(struct dvb_usb_device *d) { u8 ircode[4]; cxusb_ctrl_msg(d, CMD_GET_IR_CODE, NULL, 0, ircode, 4); if (ircode[2] || ircode[3]) rc_keydown(d->rc_dev, RC_TYPE_UNKNOWN, RC_SCANCODE_RC5(ircode[2], ircode[3]), 0); return 0; } ",0 "bool InProcessBrowserTest::SetUpUserDataDirectory() { return true; } ",0 "void Browser::EnterFullscreenModeForTab( WebContents* web_contents, const GURL& origin, const blink::WebFullscreenOptions& options) { exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab( web_contents, origin); } ",0 "GLuint GetRenderbufferServiceID(gl::GLApi* api, GLuint client_id, PassthroughResources* resources, bool create_if_missing) { return GetServiceID(client_id, &resources->renderbuffer_id_map, create_if_missing, [api]() { GLuint service_id = 0; api->glGenRenderbuffersEXTFn(1, &service_id); return service_id; }); } ",0 "PHP_MINFO_FUNCTION(mcrypt) /* {{{ */ { char **modules; char mcrypt_api_no[16]; int i, count; smart_str tmp1 = {0}; smart_str tmp2 = {0}; modules = mcrypt_list_algorithms(MCG(algorithms_dir), &count); if (count == 0) { smart_str_appends(&tmp1, ""none""); } for (i = 0; i < count; i++) { smart_str_appends(&tmp1, modules[i]); smart_str_appendc(&tmp1, ' '); } smart_str_0(&tmp1); mcrypt_free_p(modules, count); modules = mcrypt_list_modes(MCG(modes_dir), &count); if (count == 0) { smart_str_appends(&tmp2, ""none""); } for (i = 0; i < count; i++) { smart_str_appends(&tmp2, modules[i]); smart_str_appendc(&tmp2, ' '); } smart_str_0 (&tmp2); mcrypt_free_p (modules, count); snprintf (mcrypt_api_no, 16, ""%d"", MCRYPT_API_VERSION); php_info_print_table_start(); php_info_print_table_header(2, ""mcrypt support"", ""enabled""); php_info_print_table_header(2, ""mcrypt_filter support"", ""enabled""); php_info_print_table_row(2, ""Version"", LIBMCRYPT_VERSION); php_info_print_table_row(2, ""Api No"", mcrypt_api_no); php_info_print_table_row(2, ""Supported ciphers"", tmp1.c); php_info_print_table_row(2, ""Supported modes"", tmp2.c); smart_str_free(&tmp1); smart_str_free(&tmp2); php_info_print_table_end(); DISPLAY_INI_ENTRIES(); } /* }}} */ ",1 "bool NotificationService::HasKey(const NotificationSourceMap& map, const NotificationSource& source) { return map.find(source.map_key()) != map.end(); } ",0 "ZEND_API void ZEND_FASTCALL zend_hash_get_current_key_zval_ex(const HashTable *ht, zval *key, HashPosition *pos) { uint32_t idx = *pos; Bucket *p; IS_CONSISTENT(ht); if (idx == HT_INVALID_IDX) { ZVAL_NULL(key); } else { p = ht->arData + idx; if (p->key) { ZVAL_STR_COPY(key, p->key); } else { ZVAL_LONG(key, p->h); } } } ",0 "BrowserContextIOData::BrowserContextIOData() : resource_context_(new ResourceContext(this)), temporary_saved_permission_context_( new TemporarySavedPermissionContext()) {} ",0 "rsvp_obj_print(netdissect_options *ndo, const u_char *pptr, u_int plen, const u_char *tptr, const char *ident, u_int tlen, const struct rsvp_common_header *rsvp_com_header) { const struct rsvp_object_header *rsvp_obj_header; const u_char *obj_tptr; union { const struct rsvp_obj_integrity_t *rsvp_obj_integrity; const struct rsvp_obj_frr_t *rsvp_obj_frr; } obj_ptr; u_short rsvp_obj_len,rsvp_obj_ctype,obj_tlen,intserv_serv_tlen; int hexdump,processed,padbytes,error_code,error_value,i,sigcheck; union { float f; uint32_t i; } bw; uint8_t namelen; u_int action, subchannel; while(tlen>=sizeof(struct rsvp_object_header)) { /* did we capture enough for fully decoding the object header ? */ ND_TCHECK2(*tptr, sizeof(struct rsvp_object_header)); rsvp_obj_header = (const struct rsvp_object_header *)tptr; rsvp_obj_len=EXTRACT_16BITS(rsvp_obj_header->length); rsvp_obj_ctype=rsvp_obj_header->ctype; if(rsvp_obj_len % 4) { ND_PRINT((ndo, ""%sERROR: object header size %u not a multiple of 4"", ident, rsvp_obj_len)); return -1; } if(rsvp_obj_len < sizeof(struct rsvp_object_header)) { ND_PRINT((ndo, ""%sERROR: object header too short %u < %lu"", ident, rsvp_obj_len, (unsigned long)sizeof(const struct rsvp_object_header))); return -1; } ND_PRINT((ndo, ""%s%s Object (%u) Flags: [%s"", ident, tok2str(rsvp_obj_values, ""Unknown"", rsvp_obj_header->class_num), rsvp_obj_header->class_num, ((rsvp_obj_header->class_num) & 0x80) ? ""ignore"" : ""reject"")); if (rsvp_obj_header->class_num > 128) ND_PRINT((ndo, "" %s"", ((rsvp_obj_header->class_num) & 0x40) ? ""and forward"" : ""silently"")); ND_PRINT((ndo, "" if unknown], Class-Type: %s (%u), length: %u"", tok2str(rsvp_ctype_values, ""Unknown"", ((rsvp_obj_header->class_num)<<8)+rsvp_obj_ctype), rsvp_obj_ctype, rsvp_obj_len)); if(tlen < rsvp_obj_len) { ND_PRINT((ndo, ""%sERROR: object goes past end of objects TLV"", ident)); return -1; } obj_tptr=tptr+sizeof(struct rsvp_object_header); obj_tlen=rsvp_obj_len-sizeof(struct rsvp_object_header); /* did we capture enough for fully decoding the object ? */ if (!ND_TTEST2(*tptr, rsvp_obj_len)) return -1; hexdump=FALSE; switch(rsvp_obj_header->class_num) { case RSVP_OBJ_SESSION: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return -1; ND_PRINT((ndo, ""%s IPv4 DestAddress: %s, Protocol ID: 0x%02x"", ident, ipaddr_string(ndo, obj_tptr), *(obj_tptr + sizeof(struct in_addr)))); ND_PRINT((ndo, ""%s Flags: [0x%02x], DestPort %u"", ident, *(obj_tptr+5), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return -1; ND_PRINT((ndo, ""%s IPv6 DestAddress: %s, Protocol ID: 0x%02x"", ident, ip6addr_string(ndo, obj_tptr), *(obj_tptr + sizeof(struct in6_addr)))); ND_PRINT((ndo, ""%s Flags: [0x%02x], DestPort %u"", ident, *(obj_tptr+sizeof(struct in6_addr)+1), EXTRACT_16BITS(obj_tptr + sizeof(struct in6_addr) + 2))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_TUNNEL_IPV6: if (obj_tlen < 36) return -1; ND_PRINT((ndo, ""%s IPv6 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), ip6addr_string(ndo, obj_tptr + 20))); obj_tlen-=36; obj_tptr+=36; break; case RSVP_CTYPE_14: /* IPv6 p2mp LSP Tunnel */ if (obj_tlen < 26) return -1; ND_PRINT((ndo, ""%s IPv6 P2MP LSP ID: 0x%08x, Tunnel ID: 0x%04x, Extended Tunnel ID: %s"", ident, EXTRACT_32BITS(obj_tptr), EXTRACT_16BITS(obj_tptr+6), ip6addr_string(ndo, obj_tptr + 8))); obj_tlen-=26; obj_tptr+=26; break; case RSVP_CTYPE_13: /* IPv4 p2mp LSP Tunnel */ if (obj_tlen < 12) return -1; ND_PRINT((ndo, ""%s IPv4 P2MP LSP ID: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ipaddr_string(ndo, obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; case RSVP_CTYPE_TUNNEL_IPV4: case RSVP_CTYPE_UNI_IPV4: if (obj_tlen < 12) return -1; ND_PRINT((ndo, ""%s IPv4 Tunnel EndPoint: %s, Tunnel ID: 0x%04x, Extended Tunnel ID: %s"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ipaddr_string(ndo, obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; default: hexdump=TRUE; } break; case RSVP_OBJ_CONFIRM: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < sizeof(struct in_addr)) return -1; ND_PRINT((ndo, ""%s IPv4 Receiver Address: %s"", ident, ipaddr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in_addr); obj_tptr+=sizeof(struct in_addr); break; case RSVP_CTYPE_IPV6: if (obj_tlen < sizeof(struct in6_addr)) return -1; ND_PRINT((ndo, ""%s IPv6 Receiver Address: %s"", ident, ip6addr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in6_addr); obj_tptr+=sizeof(struct in6_addr); break; default: hexdump=TRUE; } break; case RSVP_OBJ_NOTIFY_REQ: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < sizeof(struct in_addr)) return -1; ND_PRINT((ndo, ""%s IPv4 Notify Node Address: %s"", ident, ipaddr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in_addr); obj_tptr+=sizeof(struct in_addr); break; case RSVP_CTYPE_IPV6: if (obj_tlen < sizeof(struct in6_addr)) return-1; ND_PRINT((ndo, ""%s IPv6 Notify Node Address: %s"", ident, ip6addr_string(ndo, obj_tptr))); obj_tlen-=sizeof(struct in6_addr); obj_tptr+=sizeof(struct in6_addr); break; default: hexdump=TRUE; } break; case RSVP_OBJ_SUGGESTED_LABEL: /* fall through */ case RSVP_OBJ_UPSTREAM_LABEL: /* fall through */ case RSVP_OBJ_RECOVERY_LABEL: /* fall through */ case RSVP_OBJ_LABEL: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: while(obj_tlen >= 4 ) { ND_PRINT((ndo, ""%s Label: %u"", ident, EXTRACT_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; } break; case RSVP_CTYPE_2: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Generalized Label: %u"", ident, EXTRACT_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; case RSVP_CTYPE_3: if (obj_tlen < 12) return-1; ND_PRINT((ndo, ""%s Waveband ID: %u%s Start Label: %u, Stop Label: %u"", ident, EXTRACT_32BITS(obj_tptr), ident, EXTRACT_32BITS(obj_tptr+4), EXTRACT_32BITS(obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; default: hexdump=TRUE; } break; case RSVP_OBJ_STYLE: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Reservation Style: %s, Flags: [0x%02x]"", ident, tok2str(rsvp_resstyle_values, ""Unknown"", EXTRACT_24BITS(obj_tptr+1)), *(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; case RSVP_OBJ_SENDER_TEMPLATE: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Source Port: %u"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Source Port: %u"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_13: /* IPv6 p2mp LSP tunnel */ if (obj_tlen < 40) return-1; ND_PRINT((ndo, ""%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"" ""%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), ident, ip6addr_string(ndo, obj_tptr+20), EXTRACT_16BITS(obj_tptr + 38))); obj_tlen-=40; obj_tptr+=40; break; case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s IPv4 Tunnel Sender Address: %s, LSP-ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_12: /* IPv4 p2mp LSP tunnel */ if (obj_tlen < 16) return-1; ND_PRINT((ndo, ""%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"" ""%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ident, ipaddr_string(ndo, obj_tptr+8), EXTRACT_16BITS(obj_tptr + 12))); obj_tlen-=16; obj_tptr+=16; break; default: hexdump=TRUE; } break; case RSVP_OBJ_LABEL_REQ: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: while(obj_tlen >= 4 ) { ND_PRINT((ndo, ""%s L3 Protocol ID: %s"", ident, tok2str(ethertype_values, ""Unknown Protocol (0x%04x)"", EXTRACT_16BITS(obj_tptr + 2)))); obj_tlen-=4; obj_tptr+=4; } break; case RSVP_CTYPE_2: if (obj_tlen < 12) return-1; ND_PRINT((ndo, ""%s L3 Protocol ID: %s"", ident, tok2str(ethertype_values, ""Unknown Protocol (0x%04x)"", EXTRACT_16BITS(obj_tptr + 2)))); ND_PRINT((ndo, "",%s merge capability"",((*(obj_tptr + 4)) & 0x80) ? ""no"" : """" )); ND_PRINT((ndo, ""%s Minimum VPI/VCI: %u/%u"", ident, (EXTRACT_16BITS(obj_tptr+4))&0xfff, (EXTRACT_16BITS(obj_tptr + 6)) & 0xfff)); ND_PRINT((ndo, ""%s Maximum VPI/VCI: %u/%u"", ident, (EXTRACT_16BITS(obj_tptr+8))&0xfff, (EXTRACT_16BITS(obj_tptr + 10)) & 0xfff)); obj_tlen-=12; obj_tptr+=12; break; case RSVP_CTYPE_3: if (obj_tlen < 12) return-1; ND_PRINT((ndo, ""%s L3 Protocol ID: %s"", ident, tok2str(ethertype_values, ""Unknown Protocol (0x%04x)"", EXTRACT_16BITS(obj_tptr + 2)))); ND_PRINT((ndo, ""%s Minimum/Maximum DLCI: %u/%u, %s%s bit DLCI"", ident, (EXTRACT_32BITS(obj_tptr+4))&0x7fffff, (EXTRACT_32BITS(obj_tptr+8))&0x7fffff, (((EXTRACT_16BITS(obj_tptr+4)>>7)&3) == 0 ) ? ""10"" : """", (((EXTRACT_16BITS(obj_tptr + 4) >> 7) & 3) == 2 ) ? ""23"" : """")); obj_tlen-=12; obj_tptr+=12; break; case RSVP_CTYPE_4: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s LSP Encoding Type: %s (%u)"", ident, tok2str(gmpls_encoding_values, ""Unknown"", *obj_tptr), *obj_tptr)); ND_PRINT((ndo, ""%s Switching Type: %s (%u), Payload ID: %s (0x%04x)"", ident, tok2str(gmpls_switch_cap_values, ""Unknown"", *(obj_tptr+1)), *(obj_tptr+1), tok2str(gmpls_payload_values, ""Unknown"", EXTRACT_16BITS(obj_tptr+2)), EXTRACT_16BITS(obj_tptr + 2))); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; case RSVP_OBJ_RRO: case RSVP_OBJ_ERO: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: while(obj_tlen >= 4 ) { u_char length; ND_TCHECK2(*obj_tptr, 4); length = *(obj_tptr + 1); ND_PRINT((ndo, ""%s Subobject Type: %s, length %u"", ident, tok2str(rsvp_obj_xro_values, ""Unknown %u"", RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)), length)); if (length == 0) { /* prevent infinite loops */ ND_PRINT((ndo, ""%s ERROR: zero length ERO subtype"", ident)); break; } switch(RSVP_OBJ_XRO_MASK_SUBOBJ(*obj_tptr)) { u_char prefix_length; case RSVP_OBJ_XRO_IPV4: if (length != 8) { ND_PRINT((ndo, "" ERROR: length != 8"")); goto invalid; } ND_TCHECK2(*obj_tptr, 8); prefix_length = *(obj_tptr+6); if (prefix_length != 32) { ND_PRINT((ndo, "" ERROR: Prefix length %u != 32"", prefix_length)); goto invalid; } ND_PRINT((ndo, "", %s, %s/%u, Flags: [%s]"", RSVP_OBJ_XRO_MASK_LOOSE(*obj_tptr) ? ""Loose"" : ""Strict"", ipaddr_string(ndo, obj_tptr+2), *(obj_tptr+6), bittok2str(rsvp_obj_rro_flag_values, ""none"", *(obj_tptr + 7)))); /* rfc3209 says that this field is rsvd. */ break; case RSVP_OBJ_XRO_LABEL: if (length != 8) { ND_PRINT((ndo, "" ERROR: length != 8"")); goto invalid; } ND_TCHECK2(*obj_tptr, 8); ND_PRINT((ndo, "", Flags: [%s] (%#x), Class-Type: %s (%u), %u"", bittok2str(rsvp_obj_rro_label_flag_values, ""none"", *(obj_tptr+2)), *(obj_tptr+2), tok2str(rsvp_ctype_values, ""Unknown"", *(obj_tptr+3) + 256*RSVP_OBJ_RRO), *(obj_tptr+3), EXTRACT_32BITS(obj_tptr + 4))); } obj_tlen-=*(obj_tptr+1); obj_tptr+=*(obj_tptr+1); } break; default: hexdump=TRUE; } break; case RSVP_OBJ_HELLO: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: case RSVP_CTYPE_2: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Source Instance: 0x%08x, Destination Instance: 0x%08x"", ident, EXTRACT_32BITS(obj_tptr), EXTRACT_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; break; default: hexdump=TRUE; } break; case RSVP_OBJ_RESTART_CAPABILITY: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Restart Time: %ums, Recovery Time: %ums"", ident, EXTRACT_32BITS(obj_tptr), EXTRACT_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; break; default: hexdump=TRUE; } break; case RSVP_OBJ_SESSION_ATTRIBUTE: switch(rsvp_obj_ctype) { case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 4) return-1; namelen = *(obj_tptr+3); if (obj_tlen < 4+namelen) return-1; ND_PRINT((ndo, ""%s Session Name: "", ident)); for (i = 0; i < namelen; i++) safeputchar(ndo, *(obj_tptr + 4 + i)); ND_PRINT((ndo, ""%s Setup Priority: %u, Holding Priority: %u, Flags: [%s] (%#x)"", ident, (int)*obj_tptr, (int)*(obj_tptr+1), bittok2str(rsvp_session_attribute_flag_values, ""none"", *(obj_tptr+2)), *(obj_tptr + 2))); obj_tlen-=4+*(obj_tptr+3); obj_tptr+=4+*(obj_tptr+3); break; default: hexdump=TRUE; } break; case RSVP_OBJ_GENERALIZED_UNI: switch(rsvp_obj_ctype) { int subobj_type,af,subobj_len,total_subobj_len; case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; /* read variable length subobjects */ total_subobj_len = obj_tlen; while(total_subobj_len > 0) { subobj_len = EXTRACT_16BITS(obj_tptr); subobj_type = (EXTRACT_16BITS(obj_tptr+2))>>8; af = (EXTRACT_16BITS(obj_tptr+2))&0x00FF; ND_PRINT((ndo, ""%s Subobject Type: %s (%u), AF: %s (%u), length: %u"", ident, tok2str(rsvp_obj_generalized_uni_values, ""Unknown"", subobj_type), subobj_type, tok2str(af_values, ""Unknown"", af), af, subobj_len)); if(subobj_len == 0) goto invalid; switch(subobj_type) { case RSVP_GEN_UNI_SUBOBJ_SOURCE_TNA_ADDRESS: case RSVP_GEN_UNI_SUBOBJ_DESTINATION_TNA_ADDRESS: switch(af) { case AFNUM_INET: if (subobj_len < 8) return -1; ND_PRINT((ndo, ""%s UNI IPv4 TNA address: %s"", ident, ipaddr_string(ndo, obj_tptr + 4))); break; case AFNUM_INET6: if (subobj_len < 20) return -1; ND_PRINT((ndo, ""%s UNI IPv6 TNA address: %s"", ident, ip6addr_string(ndo, obj_tptr + 4))); break; case AFNUM_NSAP: if (subobj_len) { /* unless we have a TLV parser lets just hexdump */ hexdump=TRUE; } break; } break; case RSVP_GEN_UNI_SUBOBJ_DIVERSITY: if (subobj_len) { /* unless we have a TLV parser lets just hexdump */ hexdump=TRUE; } break; case RSVP_GEN_UNI_SUBOBJ_EGRESS_LABEL: if (subobj_len < 16) { return -1; } ND_PRINT((ndo, ""%s U-bit: %x, Label type: %u, Logical port id: %u, Label: %u"", ident, ((EXTRACT_32BITS(obj_tptr+4))>>31), ((EXTRACT_32BITS(obj_tptr+4))&0xFF), EXTRACT_32BITS(obj_tptr+8), EXTRACT_32BITS(obj_tptr + 12))); break; case RSVP_GEN_UNI_SUBOBJ_SERVICE_LEVEL: if (subobj_len < 8) { return -1; } ND_PRINT((ndo, ""%s Service level: %u"", ident, (EXTRACT_32BITS(obj_tptr + 4)) >> 24)); break; default: hexdump=TRUE; break; } total_subobj_len-=subobj_len; obj_tptr+=subobj_len; obj_tlen+=subobj_len; } if (total_subobj_len) { /* unless we have a TLV parser lets just hexdump */ hexdump=TRUE; } break; default: hexdump=TRUE; } break; case RSVP_OBJ_RSVP_HOP: switch(rsvp_obj_ctype) { case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; if (obj_tlen) hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */ break; case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Previous/Next Interface: %s, Logical Interface Handle: 0x%08x"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_32BITS(obj_tptr + 16))); obj_tlen-=20; obj_tptr+=20; hexdump=TRUE; /* unless we have a TLV parser lets just hexdump */ break; default: hexdump=TRUE; } break; case RSVP_OBJ_TIME_VALUES: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Refresh Period: %ums"", ident, EXTRACT_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; /* those three objects do share the same semantics */ case RSVP_OBJ_SENDER_TSPEC: case RSVP_OBJ_ADSPEC: case RSVP_OBJ_FLOWSPEC: switch(rsvp_obj_ctype) { case RSVP_CTYPE_2: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Msg-Version: %u, length: %u"", ident, (*obj_tptr & 0xf0) >> 4, EXTRACT_16BITS(obj_tptr + 2) << 2)); obj_tptr+=4; /* get to the start of the service header */ obj_tlen-=4; while (obj_tlen >= 4) { intserv_serv_tlen=EXTRACT_16BITS(obj_tptr+2)<<2; ND_PRINT((ndo, ""%s Service Type: %s (%u), break bit %s set, Service length: %u"", ident, tok2str(rsvp_intserv_service_type_values,""unknown"",*(obj_tptr)), *(obj_tptr), (*(obj_tptr+1)&0x80) ? """" : ""not"", intserv_serv_tlen)); obj_tptr+=4; /* get to the start of the parameter list */ obj_tlen-=4; while (intserv_serv_tlen>=4) { processed = rsvp_intserv_print(ndo, obj_tptr, obj_tlen); if (processed == 0) break; obj_tlen-=processed; intserv_serv_tlen-=processed; obj_tptr+=processed; } } break; default: hexdump=TRUE; } break; case RSVP_OBJ_FILTERSPEC: switch(rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Source Port: %u"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Source Port: %u"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_3: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Source Address: %s, Flow Label: %u"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_24BITS(obj_tptr + 17))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_TUNNEL_IPV6: if (obj_tlen < 20) return-1; ND_PRINT((ndo, ""%s Source Address: %s, LSP-ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 18))); obj_tlen-=20; obj_tptr+=20; break; case RSVP_CTYPE_13: /* IPv6 p2mp LSP tunnel */ if (obj_tlen < 40) return-1; ND_PRINT((ndo, ""%s IPv6 Tunnel Sender Address: %s, LSP ID: 0x%04x"" ""%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x"", ident, ip6addr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+18), ident, ip6addr_string(ndo, obj_tptr+20), EXTRACT_16BITS(obj_tptr + 38))); obj_tlen-=40; obj_tptr+=40; break; case RSVP_CTYPE_TUNNEL_IPV4: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Source Address: %s, LSP-ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr + 6))); obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_12: /* IPv4 p2mp LSP tunnel */ if (obj_tlen < 16) return-1; ND_PRINT((ndo, ""%s IPv4 Tunnel Sender Address: %s, LSP ID: 0x%04x"" ""%s Sub-Group Originator ID: %s, Sub-Group ID: 0x%04x"", ident, ipaddr_string(ndo, obj_tptr), EXTRACT_16BITS(obj_tptr+6), ident, ipaddr_string(ndo, obj_tptr+8), EXTRACT_16BITS(obj_tptr + 12))); obj_tlen-=16; obj_tptr+=16; break; default: hexdump=TRUE; } break; case RSVP_OBJ_FASTREROUTE: /* the differences between c-type 1 and 7 are minor */ obj_ptr.rsvp_obj_frr = (const struct rsvp_obj_frr_t *)obj_tptr; switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: /* new style */ if (obj_tlen < sizeof(struct rsvp_obj_frr_t)) return-1; bw.i = EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); ND_PRINT((ndo, ""%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps"", ident, (int)obj_ptr.rsvp_obj_frr->setup_prio, (int)obj_ptr.rsvp_obj_frr->hold_prio, (int)obj_ptr.rsvp_obj_frr->hop_limit, bw.f * 8 / 1000000)); ND_PRINT((ndo, ""%s Include-any: 0x%08x, Exclude-any: 0x%08x, Include-all: 0x%08x"", ident, EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any), EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any), EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_all))); obj_tlen-=sizeof(struct rsvp_obj_frr_t); obj_tptr+=sizeof(struct rsvp_obj_frr_t); break; case RSVP_CTYPE_TUNNEL_IPV4: /* old style */ if (obj_tlen < 16) return-1; bw.i = EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->bandwidth); ND_PRINT((ndo, ""%s Setup Priority: %u, Holding Priority: %u, Hop-limit: %u, Bandwidth: %.10g Mbps"", ident, (int)obj_ptr.rsvp_obj_frr->setup_prio, (int)obj_ptr.rsvp_obj_frr->hold_prio, (int)obj_ptr.rsvp_obj_frr->hop_limit, bw.f * 8 / 1000000)); ND_PRINT((ndo, ""%s Include Colors: 0x%08x, Exclude Colors: 0x%08x"", ident, EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->include_any), EXTRACT_32BITS(obj_ptr.rsvp_obj_frr->exclude_any))); obj_tlen-=16; obj_tptr+=16; break; default: hexdump=TRUE; } break; case RSVP_OBJ_DETOUR: switch(rsvp_obj_ctype) { case RSVP_CTYPE_TUNNEL_IPV4: while(obj_tlen >= 8) { ND_PRINT((ndo, ""%s PLR-ID: %s, Avoid-Node-ID: %s"", ident, ipaddr_string(ndo, obj_tptr), ipaddr_string(ndo, obj_tptr + 4))); obj_tlen-=8; obj_tptr+=8; } break; default: hexdump=TRUE; } break; case RSVP_OBJ_CLASSTYPE: case RSVP_OBJ_CLASSTYPE_OLD: /* fall through */ switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: ND_PRINT((ndo, ""%s CT: %u"", ident, EXTRACT_32BITS(obj_tptr) & 0x7)); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; case RSVP_OBJ_ERROR_SPEC: switch(rsvp_obj_ctype) { case RSVP_CTYPE_3: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV4: if (obj_tlen < 8) return-1; error_code=*(obj_tptr+5); error_value=EXTRACT_16BITS(obj_tptr+6); ND_PRINT((ndo, ""%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)"", ident, ipaddr_string(ndo, obj_tptr), *(obj_tptr+4), ident, tok2str(rsvp_obj_error_code_values,""unknown"",error_code), error_code)); switch (error_code) { case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING: ND_PRINT((ndo, "", Error Value: %s (%u)"", tok2str(rsvp_obj_error_code_routing_values,""unknown"",error_value), error_value)); break; case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE: /* fall through */ case RSVP_OBJ_ERROR_SPEC_CODE_DIFFSERV_TE_OLD: ND_PRINT((ndo, "", Error Value: %s (%u)"", tok2str(rsvp_obj_error_code_diffserv_te_values,""unknown"",error_value), error_value)); break; default: ND_PRINT((ndo, "", Unknown Error Value (%u)"", error_value)); break; } obj_tlen-=8; obj_tptr+=8; break; case RSVP_CTYPE_4: /* fall through - FIXME add TLV parser */ case RSVP_CTYPE_IPV6: if (obj_tlen < 20) return-1; error_code=*(obj_tptr+17); error_value=EXTRACT_16BITS(obj_tptr+18); ND_PRINT((ndo, ""%s Error Node Address: %s, Flags: [0x%02x]%s Error Code: %s (%u)"", ident, ip6addr_string(ndo, obj_tptr), *(obj_tptr+16), ident, tok2str(rsvp_obj_error_code_values,""unknown"",error_code), error_code)); switch (error_code) { case RSVP_OBJ_ERROR_SPEC_CODE_ROUTING: ND_PRINT((ndo, "", Error Value: %s (%u)"", tok2str(rsvp_obj_error_code_routing_values,""unknown"",error_value), error_value)); break; default: break; } obj_tlen-=20; obj_tptr+=20; break; default: hexdump=TRUE; } break; case RSVP_OBJ_PROPERTIES: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; padbytes = EXTRACT_16BITS(obj_tptr+2); ND_PRINT((ndo, ""%s TLV count: %u, padding bytes: %u"", ident, EXTRACT_16BITS(obj_tptr), padbytes)); obj_tlen-=4; obj_tptr+=4; /* loop through as long there is anything longer than the TLV header (2) */ while(obj_tlen >= 2 + padbytes) { ND_PRINT((ndo, ""%s %s TLV (0x%02x), length: %u"", /* length includes header */ ident, tok2str(rsvp_obj_prop_tlv_values,""unknown"",*obj_tptr), *obj_tptr, *(obj_tptr + 1))); if (obj_tlen < *(obj_tptr+1)) return-1; if (*(obj_tptr+1) < 2) return -1; print_unknown_data(ndo, obj_tptr + 2, ""\n\t\t"", *(obj_tptr + 1) - 2); obj_tlen-=*(obj_tptr+1); obj_tptr+=*(obj_tptr+1); } break; default: hexdump=TRUE; } break; case RSVP_OBJ_MESSAGE_ID: /* fall through */ case RSVP_OBJ_MESSAGE_ID_ACK: /* fall through */ case RSVP_OBJ_MESSAGE_ID_LIST: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: case RSVP_CTYPE_2: if (obj_tlen < 8) return-1; ND_PRINT((ndo, ""%s Flags [0x%02x], epoch: %u"", ident, *obj_tptr, EXTRACT_24BITS(obj_tptr + 1))); obj_tlen-=4; obj_tptr+=4; /* loop through as long there are no messages left */ while(obj_tlen >= 4) { ND_PRINT((ndo, ""%s Message-ID 0x%08x (%u)"", ident, EXTRACT_32BITS(obj_tptr), EXTRACT_32BITS(obj_tptr))); obj_tlen-=4; obj_tptr+=4; } break; default: hexdump=TRUE; } break; case RSVP_OBJ_INTEGRITY: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < sizeof(struct rsvp_obj_integrity_t)) return-1; obj_ptr.rsvp_obj_integrity = (const struct rsvp_obj_integrity_t *)obj_tptr; ND_PRINT((ndo, ""%s Key-ID 0x%04x%08x, Sequence 0x%08x%08x, Flags [%s]"", ident, EXTRACT_16BITS(obj_ptr.rsvp_obj_integrity->key_id), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->key_id+2), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->sequence+4), bittok2str(rsvp_obj_integrity_flag_values, ""none"", obj_ptr.rsvp_obj_integrity->flags))); ND_PRINT((ndo, ""%s MD5-sum 0x%08x%08x%08x%08x "", ident, EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+4), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest+8), EXTRACT_32BITS(obj_ptr.rsvp_obj_integrity->digest + 12))); sigcheck = signature_verify(ndo, pptr, plen, obj_ptr.rsvp_obj_integrity->digest, rsvp_clear_checksum, rsvp_com_header); ND_PRINT((ndo, "" (%s)"", tok2str(signature_check_values, ""Unknown"", sigcheck))); obj_tlen+=sizeof(struct rsvp_obj_integrity_t); obj_tptr+=sizeof(struct rsvp_obj_integrity_t); break; default: hexdump=TRUE; } break; case RSVP_OBJ_ADMIN_STATUS: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Flags [%s]"", ident, bittok2str(rsvp_obj_admin_status_flag_values, ""none"", EXTRACT_32BITS(obj_tptr)))); obj_tlen-=4; obj_tptr+=4; break; default: hexdump=TRUE; } break; case RSVP_OBJ_LABEL_SET: switch(rsvp_obj_ctype) { case RSVP_CTYPE_1: if (obj_tlen < 4) return-1; action = (EXTRACT_16BITS(obj_tptr)>>8); ND_PRINT((ndo, ""%s Action: %s (%u), Label type: %u"", ident, tok2str(rsvp_obj_label_set_action_values, ""Unknown"", action), action, ((EXTRACT_32BITS(obj_tptr) & 0x7F)))); switch (action) { case LABEL_SET_INCLUSIVE_RANGE: case LABEL_SET_EXCLUSIVE_RANGE: /* fall through */ /* only a couple of subchannels are expected */ if (obj_tlen < 12) return -1; ND_PRINT((ndo, ""%s Start range: %u, End range: %u"", ident, EXTRACT_32BITS(obj_tptr+4), EXTRACT_32BITS(obj_tptr + 8))); obj_tlen-=12; obj_tptr+=12; break; default: obj_tlen-=4; obj_tptr+=4; subchannel = 1; while(obj_tlen >= 4 ) { ND_PRINT((ndo, ""%s Subchannel #%u: %u"", ident, subchannel, EXTRACT_32BITS(obj_tptr))); obj_tptr+=4; obj_tlen-=4; subchannel++; } break; } break; default: hexdump=TRUE; } break; case RSVP_OBJ_S2L: switch (rsvp_obj_ctype) { case RSVP_CTYPE_IPV4: if (obj_tlen < 4) return-1; ND_PRINT((ndo, ""%s Sub-LSP destination address: %s"", ident, ipaddr_string(ndo, obj_tptr))); obj_tlen-=4; obj_tptr+=4; break; case RSVP_CTYPE_IPV6: if (obj_tlen < 16) return-1; ND_PRINT((ndo, ""%s Sub-LSP destination address: %s"", ident, ip6addr_string(ndo, obj_tptr))); obj_tlen-=16; obj_tptr+=16; break; default: hexdump=TRUE; } break; /* * FIXME those are the defined objects that lack a decoder * you are welcome to contribute code ;-) */ case RSVP_OBJ_SCOPE: case RSVP_OBJ_POLICY_DATA: case RSVP_OBJ_ACCEPT_LABEL_SET: case RSVP_OBJ_PROTECTION: default: if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, obj_tptr, ""\n\t "", obj_tlen); /* FIXME indentation */ break; } /* do we also want to see a hex dump ? */ if (ndo->ndo_vflag > 1 || hexdump == TRUE) print_unknown_data(ndo, tptr + sizeof(struct rsvp_object_header), ""\n\t "", /* FIXME indentation */ rsvp_obj_len - sizeof(struct rsvp_object_header)); tptr+=rsvp_obj_len; tlen-=rsvp_obj_len; } return 0; invalid: ND_PRINT((ndo, ""%s"", istr)); return -1; trunc: ND_PRINT((ndo, ""\n\t\t"")); ND_PRINT((ndo, ""%s"", tstr)); return -1; } ",1 "static void usage(void) { printf(PACKAGE "" "" VERSION ""\n""); printf(""-p TCP port number to listen on (default: 11211)\n"" ""-U UDP port number to listen on (default: 11211, 0 is off)\n"" ""-s UNIX socket path to listen on (disables network support)\n"" ""-A enable ascii \""shutdown\"" command\n"" ""-a access mask for UNIX socket, in octal (default: 0700)\n"" ""-l interface to listen on (default: INADDR_ANY, all addresses)\n"" "" may be specified as host:port. If you don't specify\n"" "" a port number, the value you specified with -p or -U is\n"" "" used. You may specify multiple addresses separated by comma\n"" "" or by using -l multiple times\n"" ""-d run as a daemon\n"" ""-r maximize core file limit\n"" ""-u assume identity of (only when run as root)\n"" ""-m max memory to use for items in megabytes (default: 64 MB)\n"" ""-M return error on memory exhausted (rather than removing items)\n"" ""-c max simultaneous connections (default: 1024)\n"" ""-k lock down all paged memory. Note that there is a\n"" "" limit on how much memory you may lock. Trying to\n"" "" allocate more than that would fail, so be sure you\n"" "" set the limit correctly for the user you started\n"" "" the daemon with (not for -u user;\n"" "" under sh this is done with 'ulimit -S -l NUM_KB').\n"" ""-v verbose (print errors/warnings while in event loop)\n"" ""-vv very verbose (also print client commands/reponses)\n"" ""-vvv extremely verbose (also print internal state transitions)\n"" ""-h print this help and exit\n"" ""-i print memcached and libevent license\n"" ""-V print version and exit\n"" ""-P save PID in , only used with -d option\n"" ""-f chunk size growth factor (default: 1.25)\n"" ""-n minimum space allocated for key+value+flags (default: 48)\n""); printf(""-L Try to use large memory pages (if available). Increasing\n"" "" the memory page size could reduce the number of TLB misses\n"" "" and improve the performance. In order to get large pages\n"" "" from the OS, memcached will allocate the total item-cache\n"" "" in one large chunk.\n""); printf(""-D Use as the delimiter between key prefixes and IDs.\n"" "" This is used for per-prefix stats reporting. The default is\n"" "" \"":\"" (colon). If this option is specified, stats collection\n"" "" is turned on automatically; if not, then it may be turned on\n"" "" by sending the \""stats detail on\"" command to the server.\n""); printf(""-t number of threads to use (default: 4)\n""); printf(""-R Maximum number of requests per event, limits the number of\n"" "" requests process for a given connection to prevent \n"" "" starvation (default: 20)\n""); printf(""-C Disable use of CAS\n""); printf(""-b Set the backlog queue limit (default: 1024)\n""); printf(""-B Binding protocol - one of ascii, binary, or auto (default)\n""); printf(""-I Override the size of each slab page. Adjusts max item size\n"" "" (default: 1mb, min: 1k, max: 128m)\n""); #ifdef ENABLE_SASL printf(""-S Turn on Sasl authentication\n""); #endif printf(""-F Disable flush_all command\n""); printf(""-X Disable stats cachedump and lru_crawler metadump commands\n""); printf(""-o Comma separated list of extended or experimental options\n"" "" - maxconns_fast: immediately close new\n"" "" connections if over maxconns limit\n"" "" - hashpower: An integer multiplier for how large the hash\n"" "" table should be. Can be grown at runtime if not big enough.\n"" "" Set this based on \""STAT hash_power_level\"" before a \n"" "" restart.\n"" "" - tail_repair_time: Time in seconds that indicates how long to wait before\n"" "" forcefully taking over the LRU tail item whose refcount has leaked.\n"" "" Disabled by default; dangerous option.\n"" "" - hash_algorithm: The hash table algorithm\n"" "" default is jenkins hash. options: jenkins, murmur3\n"" "" - lru_crawler: Enable LRU Crawler background thread\n"" "" - lru_crawler_sleep: Microseconds to sleep between items\n"" "" default is 100.\n"" "" - lru_crawler_tocrawl: Max items to crawl per slab per run\n"" "" default is 0 (unlimited)\n"" "" - lru_maintainer: Enable new LRU system + background thread\n"" "" - hot_lru_pct: Pct of slab memory to reserve for hot lru.\n"" "" (requires lru_maintainer)\n"" "" - warm_lru_pct: Pct of slab memory to reserve for warm lru.\n"" "" (requires lru_maintainer)\n"" "" - hot_max_age: Items idle longer than this drop from hot lru.\n"" "" - cold_max_factor: Items idle longer than cold lru age * this drop from warm.\n"" "" - temporary_ttl: TTL's below this use separate LRU, cannot be evicted.\n"" "" (requires lru_maintainer)\n"" "" - idle_timeout: Timeout for idle connections\n"" "" - (EXPERIMENTAL) slab_chunk_max: Maximum slab size. Do not change without extreme care.\n"" "" - watcher_logbuf_size: Size in kilobytes of per-watcher write buffer.\n"" "" - worker_logbuf_Size: Size in kilobytes of per-worker-thread buffer\n"" "" read by background thread. Which is then written to watchers.\n"" "" - track_sizes: Enable dynamic reports for 'stats sizes' command.\n"" "" - no_inline_ascii_resp: Save up to 24 bytes per item. Small perf hit in ASCII,\n"" "" no perf difference in binary protocol. Speeds up sets.\n"" "" - modern: Enables 'modern' defaults. Options that will be default in future.\n"" "" enables: slab_chunk_max:512k,slab_reassign,slab_automove=1,maxconns_fast,\n"" "" hash_algorithm=murmur3,lru_crawler,lru_maintainer,no_inline_ascii_resp\n"" ); return; } ",0 "load_gimp_2_6_file (gconstpointer data) { Gimp *gimp = GIMP (data); GimpImage *image; gchar *filename; GFile *file; filename = g_build_filename (g_getenv (""GIMP_TESTING_ABS_TOP_SRCDIR""), ""app/tests/files/gimp-2-6-file.xcf"", NULL); file = g_file_new_for_path (filename); g_free (filename); image = gimp_test_load_image (gimp, file); /* The image file was constructed by running * gimp_write_and_read_file (FALSE, FALSE) in GIMP 2.6 by * copy-pasting the code to GIMP 2.6 and adapting it to changes in * the core API, so we can use gimp_assert_mainimage() to make sure * the file was loaded successfully. */ gimp_assert_mainimage (image, FALSE /*with_unusual_stuff*/, FALSE /*compat_paths*/, FALSE /*use_gimp_2_8_features*/); } ",0 "void PPB_URLLoader_Impl::Close() { if (loader_.get()) loader_->cancel(); else if (main_document_loader_) GetFrameForResource(this)->stopLoading(); } ",0 "int kvm_arch_vcpu_ioctl_get_regs(struct kvm_vcpu *vcpu, struct kvm_regs *regs) { if (vcpu->arch.emulate_regs_need_sync_to_vcpu) { /* * We are here if userspace calls get_regs() in the middle of * instruction emulation. Registers state needs to be copied * back from emulation context to vcpu. Userspace shouldn't do * that usually, but some bad designed PV devices (vmware * backdoor interface) need this to work */ emulator_writeback_register_cache(&vcpu->arch.emulate_ctxt); vcpu->arch.emulate_regs_need_sync_to_vcpu = false; } regs->rax = kvm_register_read(vcpu, VCPU_REGS_RAX); regs->rbx = kvm_register_read(vcpu, VCPU_REGS_RBX); regs->rcx = kvm_register_read(vcpu, VCPU_REGS_RCX); regs->rdx = kvm_register_read(vcpu, VCPU_REGS_RDX); regs->rsi = kvm_register_read(vcpu, VCPU_REGS_RSI); regs->rdi = kvm_register_read(vcpu, VCPU_REGS_RDI); regs->rsp = kvm_register_read(vcpu, VCPU_REGS_RSP); regs->rbp = kvm_register_read(vcpu, VCPU_REGS_RBP); #ifdef CONFIG_X86_64 regs->r8 = kvm_register_read(vcpu, VCPU_REGS_R8); regs->r9 = kvm_register_read(vcpu, VCPU_REGS_R9); regs->r10 = kvm_register_read(vcpu, VCPU_REGS_R10); regs->r11 = kvm_register_read(vcpu, VCPU_REGS_R11); regs->r12 = kvm_register_read(vcpu, VCPU_REGS_R12); regs->r13 = kvm_register_read(vcpu, VCPU_REGS_R13); regs->r14 = kvm_register_read(vcpu, VCPU_REGS_R14); regs->r15 = kvm_register_read(vcpu, VCPU_REGS_R15); #endif regs->rip = kvm_rip_read(vcpu); regs->rflags = kvm_get_rflags(vcpu); return 0; } ",0 "static jboolean removeBondNative(JNIEnv* env, jobject obj, jbyteArray address) { ALOGV(""%s:"",__FUNCTION__); jbyte *addr; jboolean result; if (!sBluetoothInterface) return JNI_FALSE; addr = env->GetByteArrayElements(address, NULL); if (addr == NULL) { jniThrowIOException(env, EINVAL); return JNI_FALSE; } int ret = sBluetoothInterface->remove_bond((bt_bdaddr_t *)addr); env->ReleaseByteArrayElements(address, addr, 0); result = (ret == BT_STATUS_SUCCESS) ? JNI_TRUE : JNI_FALSE; return result; } ",0 "static void n_tty_kick_worker(struct tty_struct *tty) { struct n_tty_data *ldata = tty->disc_data; /* Did the input worker stop? Restart it */ if (unlikely(ldata->no_room)) { ldata->no_room = 0; WARN_RATELIMIT(tty->port->itty == NULL, ""scheduling with invalid itty\n""); /* see if ldisc has been killed - if so, this means that * even though the ldisc has been halted and ->buf.work * cancelled, ->buf.work is about to be rescheduled */ WARN_RATELIMIT(test_bit(TTY_LDISC_HALTED, &tty->flags), ""scheduling buffer work for halted ldisc\n""); tty_buffer_restart_work(tty->port); } } ",0 "status_t MediaPlayer::getParameter(int key, Parcel *reply) { ALOGV(""MediaPlayer::getParameter(%d)"", key); Mutex::Autolock _l(mLock); if (mPlayer != NULL) { return mPlayer->getParameter(key, reply); } ALOGV(""getParameter: no active player""); return INVALID_OPERATION; } ",0 "GpuCommandBufferStub::~GpuCommandBufferStub() { Destroy(); GpuChannelManager* gpu_channel_manager = channel_->gpu_channel_manager(); gpu_channel_manager->Send(new GpuHostMsg_DestroyCommandBuffer(surface_id())); } ",0 " png_write_finish_row(png_structp png_ptr) { #ifdef PNG_WRITE_INTERLACING_SUPPORTED /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* Start of interlace block */ int png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0}; /* Offset to next interlace block */ int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1}; /* Start of interlace block in the y direction */ int png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1}; /* Offset to next interlace block in the y direction */ int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif int ret; png_debug(1, ""in png_write_finish_row""); /* Next row */ png_ptr->row_number++; /* See if we are done */ if (png_ptr->row_number < png_ptr->num_rows) return; #ifdef PNG_WRITE_INTERLACING_SUPPORTED /* If interlaced, go to next pass */ if (png_ptr->interlaced) { png_ptr->row_number = 0; if (png_ptr->transformations & PNG_INTERLACE) { png_ptr->pass++; } else { /* Loop until we find a non-zero width or height pass */ do { png_ptr->pass++; if (png_ptr->pass >= 7) break; png_ptr->usr_width = (png_ptr->width + png_pass_inc[png_ptr->pass] - 1 - png_pass_start[png_ptr->pass]) / png_pass_inc[png_ptr->pass]; png_ptr->num_rows = (png_ptr->height + png_pass_yinc[png_ptr->pass] - 1 - png_pass_ystart[png_ptr->pass]) / png_pass_yinc[png_ptr->pass]; if (png_ptr->transformations & PNG_INTERLACE) break; } while (png_ptr->usr_width == 0 || png_ptr->num_rows == 0); } /* Reset the row above the image for the next pass */ if (png_ptr->pass < 7) { if (png_ptr->prev_row != NULL) png_memset(png_ptr->prev_row, 0, (png_size_t)(PNG_ROWBYTES(png_ptr->usr_channels* png_ptr->usr_bit_depth, png_ptr->width)) + 1); return; } } #endif /* If we get here, we've just written the last row, so we need to flush the compressor */ do { /* Tell the compressor we are done */ ret = deflate(&png_ptr->zstream, Z_FINISH); /* Check for an error */ if (ret == Z_OK) { /* Check to see if we need more room */ if (!(png_ptr->zstream.avail_out)) { png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size); png_ptr->zstream.next_out = png_ptr->zbuf; png_ptr->zstream.avail_out = (uInt)png_ptr->zbuf_size; } } else if (ret != Z_STREAM_END) { if (png_ptr->zstream.msg != NULL) png_error(png_ptr, png_ptr->zstream.msg); else png_error(png_ptr, ""zlib error""); } } while (ret != Z_STREAM_END); /* Write any extra space */ if (png_ptr->zstream.avail_out < png_ptr->zbuf_size) { png_write_IDAT(png_ptr, png_ptr->zbuf, png_ptr->zbuf_size - png_ptr->zstream.avail_out); } deflateReset(&png_ptr->zstream); png_ptr->zstream.data_type = Z_BINARY; } ",1 "gx_dc_pattern_save_dc( const gx_device_color * pdevc, gx_device_color_saved * psdc ) { psdc->type = pdevc->type; if (pdevc->ccolor_valid) { psdc->colors.pattern.id = pdevc->ccolor.pattern->pattern_id; psdc->colors.pattern.phase = pdevc->phase; } else { /* The client color has been changed to a non-pattern color, but device color has not been created yet. */ psdc->colors.pattern.id = gs_no_id; psdc->colors.pattern.phase.x = psdc->colors.pattern.phase.y = 0; } } ",0 "static void usbnet_bh (unsigned long param) { struct usbnet *dev = (struct usbnet *) param; struct sk_buff *skb; struct skb_data *entry; while ((skb = skb_dequeue (&dev->done))) { entry = (struct skb_data *) skb->cb; switch (entry->state) { case rx_done: entry->state = rx_cleanup; rx_process (dev, skb); continue; case tx_done: kfree(entry->urb->sg); case rx_cleanup: usb_free_urb (entry->urb); dev_kfree_skb (skb); continue; default: netdev_dbg(dev->net, ""bogus skb state %d\n"", entry->state); } } /* restart RX again after disabling due to high error rate */ clear_bit(EVENT_RX_KILL, &dev->flags); /* waiting for all pending urbs to complete? * only then can we forgo submitting anew */ if (waitqueue_active(&dev->wait)) { if (dev->txq.qlen + dev->rxq.qlen + dev->done.qlen == 0) wake_up_all(&dev->wait); } else if (netif_running (dev->net) && netif_device_present (dev->net) && netif_carrier_ok(dev->net) && !timer_pending (&dev->delay) && !test_bit (EVENT_RX_HALT, &dev->flags)) { int temp = dev->rxq.qlen; if (temp < RX_QLEN(dev)) { if (rx_alloc_submit(dev, GFP_ATOMIC) == -ENOLINK) return; if (temp != dev->rxq.qlen) netif_dbg(dev, link, dev->net, ""rxqlen %d --> %d\n"", temp, dev->rxq.qlen); if (dev->rxq.qlen < RX_QLEN(dev)) tasklet_schedule (&dev->bh); } if (dev->txq.qlen < TX_QLEN (dev)) netif_wake_queue (dev->net); } } ",0 "static int ip_vs_rs_hash(struct ip_vs_dest *dest) { unsigned hash; if (!list_empty(&dest->d_list)) { return 0; } /* * Hash by proto,addr,port, * which are the parameters of the real service. */ hash = ip_vs_rs_hashkey(dest->af, &dest->addr, dest->port); list_add(&dest->d_list, &ip_vs_rtable[hash]); return 1; } ",0 "bool RenderViewHostImpl::IsFullscreen() const { return delegate_->IsFullscreenForCurrentTab(); } ",0 "size_t RenderWidgetHost::BackingStoreMemorySize() { return BackingStoreManager::MemorySize(); } ",0 "status_t Parcel::readInt32Vector(std::vector* val) const { return readTypedVector(val, &Parcel::readInt32); } ",0 "void AddMainWebResources(content::WebUIDataSource* html_source) { html_source->AddResourcePath(""media_router.js"", IDR_MEDIA_ROUTER_JS); html_source->AddResourcePath(""media_router_common.css"", IDR_MEDIA_ROUTER_COMMON_CSS); html_source->AddResourcePath(""media_router.css"", IDR_MEDIA_ROUTER_CSS); html_source->AddResourcePath(""media_router_data.js"", IDR_MEDIA_ROUTER_DATA_JS); html_source->AddResourcePath(""media_router_ui_interface.js"", IDR_MEDIA_ROUTER_UI_INTERFACE_JS); html_source->AddResourcePath(""polymer_config.js"", IDR_MEDIA_ROUTER_POLYMER_CONFIG_JS); } ",1 "void GDataEntry::SerializeToString(std::string* serialized_proto) const { const GDataFile* file = AsGDataFileConst(); const GDataDirectory* dir = AsGDataDirectoryConst(); if (file) { scoped_ptr proto(new GDataFileProto()); file->ToProto(proto.get()); const bool ok = proto->SerializeToString(serialized_proto); DCHECK(ok); } else if (dir) { scoped_ptr proto(new GDataDirectoryProto()); dir->ToProto(proto.get()); const bool ok = proto->SerializeToString(serialized_proto); DCHECK(ok); } } ",0 "ftrace_ops_test(struct ftrace_ops *ops, unsigned long ip) { struct ftrace_hash *filter_hash; struct ftrace_hash *notrace_hash; int ret; filter_hash = rcu_dereference_raw(ops->filter_hash); notrace_hash = rcu_dereference_raw(ops->notrace_hash); if ((ftrace_hash_empty(filter_hash) || ftrace_lookup_ip(filter_hash, ip)) && (ftrace_hash_empty(notrace_hash) || !ftrace_lookup_ip(notrace_hash, ip))) ret = 1; else ret = 0; return ret; } ",0 "static int gup_p4d_range(pgd_t pgd, unsigned long addr, unsigned long end, int write, struct page **pages, int *nr) { unsigned long next; p4d_t *p4dp; p4dp = p4d_offset(&pgd, addr); do { p4d_t p4d = READ_ONCE(*p4dp); next = p4d_addr_end(addr, end); if (p4d_none(p4d)) return 0; BUILD_BUG_ON(p4d_huge(p4d)); if (unlikely(is_hugepd(__hugepd(p4d_val(p4d))))) { if (!gup_huge_pd(__hugepd(p4d_val(p4d)), addr, P4D_SHIFT, next, write, pages, nr)) return 0; } else if (!gup_pud_range(p4d, addr, next, write, pages, nr)) return 0; } while (p4dp++, addr = next, addr != end); return 1; } ",0 "static jboolean Region_equals(JNIEnv* env, jobject clazz, jlong r1Handle, jlong r2Handle) { const SkRegion *r1 = reinterpret_cast(r1Handle); const SkRegion *r2 = reinterpret_cast(r2Handle); return boolTojboolean(*r1 == *r2); } ",0 "static zend_string *unserialize_str(const unsigned char **p, size_t len, size_t maxlen) { size_t i, j; zend_string *str = zend_string_safe_alloc(1, len, 0, 0); unsigned char *end = *(unsigned char **)p+maxlen; if (end < *p) { zend_string_free(str); return NULL; } for (i = 0; i < len; i++) { if (*p >= end) { zend_string_free(str); return NULL; } if (**p != '\\') { ZSTR_VAL(str)[i] = (char)**p; } else { unsigned char ch = 0; for (j = 0; j < 2; j++) { (*p)++; if (**p >= '0' && **p <= '9') { ch = (ch << 4) + (**p -'0'); } else if (**p >= 'a' && **p <= 'f') { ch = (ch << 4) + (**p -'a'+10); } else if (**p >= 'A' && **p <= 'F') { ch = (ch << 4) + (**p -'A'+10); } else { zend_string_free(str); return NULL; } } ZSTR_VAL(str)[i] = (char)ch; } (*p)++; } ZSTR_VAL(str)[i] = 0; ZSTR_LEN(str) = i; return str; } ",0 "void WebPluginDelegateProxy::CopyFromTransportToBacking(const gfx::Rect& rect) { if (!backing_store_canvas_.get()) { return; } #if defined(OS_MACOSX) const size_t stride = skia::PlatformCanvas::StrideForWidth(plugin_rect_.width()); const size_t chunk_size = 4 * rect.width(); uint8* source_data = static_cast(transport_store_->memory()) + rect.y() * stride + 4 * rect.x(); int dest_starting_row = plugin_rect_.height() - rect.y() - 1; DCHECK(backing_store_.size() > 0); uint8* target_data = &(backing_store_[0]) + dest_starting_row * stride + 4 * rect.x(); for (int row = 0; row < rect.height(); ++row) { memcpy(target_data, source_data, chunk_size); source_data += stride; target_data -= stride; } #else BlitCanvasToCanvas(backing_store_canvas_.get(), rect, transport_store_canvas_.get(), rect.origin()); #endif backing_store_painted_ = backing_store_painted_.Union(rect); } ",0 "static void handle_binary_protocol_error(conn *c) { write_bin_error(c, PROTOCOL_BINARY_RESPONSE_EINVAL, NULL, 0); if (settings.verbose) { fprintf(stderr, ""Protocol error (opcode %02x), close connection %d\n"", c->binary_header.request.opcode, c->sfd); } c->write_and_go = conn_closing; } ",0 " void GM2TabStyle::PaintTabBackground(gfx::Canvas* canvas, bool active, int fill_id, int y_inset, const SkPath* clip) const { DCHECK(!y_inset || fill_id); const SkColor active_color = tab_->controller()->GetTabBackgroundColor(TAB_ACTIVE); const SkColor inactive_color = tab_->GetThemeProvider()->GetDisplayProperty( ThemeProperties::SHOULD_FILL_BACKGROUND_TAB_COLOR) ? tab_->controller()->GetTabBackgroundColor(TAB_INACTIVE) : SK_ColorTRANSPARENT; const SkColor stroke_color = tab_->controller()->GetToolbarTopSeparatorColor(); const bool paint_hover_effect = !active && IsHoverActive(); const float stroke_thickness = GetStrokeThickness(active); PaintTabBackgroundFill(canvas, active, paint_hover_effect, active_color, inactive_color, fill_id, y_inset); if (stroke_thickness > 0) { gfx::ScopedCanvas scoped_canvas(clip ? canvas : nullptr); if (clip) canvas->sk_canvas()->clipPath(*clip, SkClipOp::kDifference, true); PaintBackgroundStroke(canvas, active, stroke_color); } PaintSeparators(canvas); } ",1 "void RootWindow::OnLayerAnimationScheduled( ui::LayerAnimationSequence* animation) { } ",0 "static void TIFFReadPhotoshopLayers(const ImageInfo *image_info,Image *image, ExceptionInfo *exception) { const char *option; const StringInfo *profile; Image *layers; ImageInfo *clone_info; PSDInfo info; register ssize_t i; if (GetImageListLength(image) != 1) return; if ((image_info->number_scenes == 1) && (image_info->scene == 0)) return; option=GetImageOption(image_info,""tiff:ignore-layers""); if (option != (const char * ) NULL) return; profile=GetImageProfile(image,""tiff:37724""); if (profile == (const StringInfo *) NULL) return; for (i=0; i < (ssize_t) profile->length-8; i++) { if (LocaleNCompare((const char *) (profile->datum+i), image->endian == MSBEndian ? ""8BIM"" : ""MIB8"",4) != 0) continue; i+=4; if ((LocaleNCompare((const char *) (profile->datum+i), image->endian == MSBEndian ? ""Layr"" : ""ryaL"",4) == 0) || (LocaleNCompare((const char *) (profile->datum+i), image->endian == MSBEndian ? ""LMsk"" : ""ksML"",4) == 0) || (LocaleNCompare((const char *) (profile->datum+i), image->endian == MSBEndian ? ""Lr16"" : ""61rL"",4) == 0) || (LocaleNCompare((const char *) (profile->datum+i), image->endian == MSBEndian ? ""Lr32"" : ""23rL"",4) == 0)) break; } i+=4; if (i >= (ssize_t) (profile->length-8)) return; layers=CloneImage(image,0,0,MagickTrue,exception); (void) DeleteImageProfile(layers,""tiff:37724""); AttachBlob(layers->blob,profile->datum,profile->length); SeekBlob(layers,(MagickOffsetType) i,SEEK_SET); InitPSDInfo(image, layers, &info); clone_info=CloneImageInfo(image_info); clone_info->number_scenes=0; (void) ReadPSDLayers(layers,clone_info,&info,MagickFalse,exception); clone_info=DestroyImageInfo(clone_info); /* we need to set the datum in case a realloc happend */ ((StringInfo *) profile)->datum=GetBlobStreamData(layers); InheritException(exception,&layers->exception); DeleteImageFromList(&layers); if (layers != (Image *) NULL) { SetImageArtifact(image,""tiff:has-layers"",""true""); AppendImageToList(&image,layers); while (layers != (Image *) NULL) { SetImageArtifact(layers,""tiff:has-layers"",""true""); DetachBlob(layers->blob); layers=GetNextImageInList(layers); } } } ",0 "static int llc_ui_create(struct net *net, struct socket *sock, int protocol, int kern) { struct sock *sk; int rc = -ESOCKTNOSUPPORT; if (!ns_capable(net->user_ns, CAP_NET_RAW)) return -EPERM; if (!net_eq(net, &init_net)) return -EAFNOSUPPORT; if (likely(sock->type == SOCK_DGRAM || sock->type == SOCK_STREAM)) { rc = -ENOMEM; sk = llc_sk_alloc(net, PF_LLC, GFP_KERNEL, &llc_proto, kern); if (sk) { rc = 0; llc_ui_sk_init(sock, sk); } } return rc; } ",0 "void Document::SetEncodingData(const DocumentEncodingData& new_data) { if (title_element_ && Encoding() != new_data.Encoding() && !ElementTraversal::FirstWithin(*title_element_) && Encoding() == Latin1Encoding() && title_element_->textContent().ContainsOnlyLatin1()) { CString original_bytes = title_element_->textContent().Latin1(); std::unique_ptr codec = NewTextCodec(new_data.Encoding()); String correctly_decoded_title = codec->Decode( original_bytes.data(), original_bytes.length(), WTF::kDataEOF); title_element_->setTextContent(correctly_decoded_title); } DCHECK(new_data.Encoding().IsValid()); encoding_data_ = new_data; bool should_use_visual_ordering = encoding_data_.Encoding().UsesVisualOrdering(); if (should_use_visual_ordering != visually_ordered_) { visually_ordered_ = should_use_visual_ordering; if (!GetLayoutViewItem().IsNull()) { GetLayoutViewItem().MutableStyleRef().SetRtlOrdering( visually_ordered_ ? EOrder::kVisual : EOrder::kLogical); } SetNeedsStyleRecalc(kSubtreeStyleChange, StyleChangeReasonForTracing::Create( StyleChangeReason::kVisuallyOrdered)); } } ",0 "static struct sock *netlink_lookup(struct net *net, int protocol, u32 portid) { struct netlink_table *table = &nl_table[protocol]; struct sock *sk; rcu_read_lock(); sk = __netlink_lookup(table, portid, net); if (sk) sock_hold(sk); rcu_read_unlock(); return sk; } ",0 "WebKit::WebView* RenderViewImpl::GetWebView() { return webview(); } ",0 "void ExecuteJavaScriptAndWaitForLoadStop(WebContents* web_contents, const std::string script) { TestNavigationObserver observer(web_contents); static_cast(web_contents) ->GetMainFrame() ->ExecuteJavaScriptForTests(base::UTF8ToUTF16(script)); observer.Wait(); } ",0 "void OnDragDataGetStandalone(GtkWidget* widget, GdkDragContext* context, GtkSelectionData* selection_data, guint target_type, guint time, const DownloadItem* item) { OnDragDataGetForDownloadItem(selection_data, target_type, item); } ",0 " void DestroyTabletModeWindowManager() { Shell::Get()->tablet_mode_controller()->SetEnabledForTest(false); EXPECT_FALSE(TabletModeControllerTestApi().tablet_mode_window_manager()); } ",0 "png_get_user_chunk_ptr(png_structp png_ptr) { return (png_ptr? png_ptr->user_chunk_ptr : NULL); } ",0 "print_sep(struct table *t, int row, int type, int maxcol, Str buf) { int forbid; int rule_mode; int i, k, l, m; if (row >= 0) check_row(t, row); check_row(t, row + 1); if ((type == T_TOP || type == T_BOTTOM) && t->border_mode == BORDER_THICK) { rule_mode = BORDER_THICK; } else { rule_mode = BORDER_THIN; } forbid = 1; if (type == T_TOP) forbid |= 2; else if (type == T_BOTTOM) forbid |= 8; else if (t->tabattr[row + 1][0] & HTT_Y) { forbid |= 4; } if (t->border_mode != BORDER_NOWIN) { push_symbol(buf, RULE(t->border_mode, forbid), symbol_width, 1); } for (i = 0; i <= maxcol; i++) { forbid = 10; if (type != T_BOTTOM && (t->tabattr[row + 1][i] & HTT_Y)) { if (t->tabattr[row + 1][i] & HTT_X) { goto do_last_sep; } else { for (k = row; k >= 0 && t->tabattr[k] && (t->tabattr[k][i] & HTT_Y); k--) ; m = t->tabwidth[i] + 2 * t->cellpadding; for (l = i + 1; l <= t->maxcol && (t->tabattr[row][l] & HTT_X); l++) m += t->tabwidth[l] + t->cellspacing; print_item(t, k, i, m, buf); } } else { int w = t->tabwidth[i] + 2 * t->cellpadding; if (RULE_WIDTH == 2) w = (w + 1) / RULE_WIDTH; push_symbol(buf, RULE(rule_mode, forbid), symbol_width, w); } do_last_sep: if (i < maxcol) { forbid = 0; if (type == T_TOP) forbid |= 2; else if (t->tabattr[row][i + 1] & HTT_X) { forbid |= 2; } if (type == T_BOTTOM) forbid |= 8; else { if (t->tabattr[row + 1][i + 1] & HTT_X) { forbid |= 8; } if (t->tabattr[row + 1][i + 1] & HTT_Y) { forbid |= 4; } if (t->tabattr[row + 1][i] & HTT_Y) { forbid |= 1; } } if (forbid != 15) /* forbid==15 means 'no rule at all' */ push_symbol(buf, RULE(rule_mode, forbid), symbol_width, 1); } } forbid = 4; if (type == T_TOP) forbid |= 2; if (type == T_BOTTOM) forbid |= 8; if (t->tabattr[row + 1][maxcol] & HTT_Y) { forbid |= 1; } if (t->border_mode != BORDER_NOWIN) push_symbol(buf, RULE(t->border_mode, forbid), symbol_width, 1); } ",0 "jint Java_com_android_server_wifi_WifiNative_registerNatives(JNIEnv* env, jclass clazz) { return AndroidRuntime::registerNativeMethods(env, ""com/android/server/wifi/WifiNative"", gWifiMethods, NELEM(gWifiMethods)); } ",0 "void GLES2DecoderImpl::DoFramebufferTextureMultiviewOVR( GLenum target, GLenum attachment, GLuint client_texture_id, GLint level, GLint base_view_index, GLsizei num_views) { NOTREACHED(); } ",0 "void Editor::ReappliedEditing(UndoStep* cmd) { EventQueueScope scope; DispatchEditableContentChangedEvents(cmd->StartingRootEditableElement(), cmd->EndingRootEditableElement()); DispatchInputEventEditableContentChanged( cmd->StartingRootEditableElement(), cmd->EndingRootEditableElement(), InputEvent::InputType::kHistoryRedo, g_null_atom, InputEvent::EventIsComposing::kNotComposing); const SelectionInDOMTree& new_selection = CorrectedSelectionAfterCommand( cmd->EndingSelection(), GetFrame().GetDocument()); ChangeSelectionAfterCommand(new_selection, SetSelectionData::Builder() .SetShouldCloseTyping(true) .SetShouldClearTypingStyle(true) .Build()); last_edit_command_ = nullptr; undo_stack_->RegisterUndoStep(cmd); RespondToChangedContents(new_selection.Base()); } ",0 "void inet_hash(struct sock *sk) { if (sk->sk_state != TCP_CLOSE) { local_bh_disable(); __inet_hash(sk); local_bh_enable(); } } ",0 "static void convert_32s_C1P1(const OPJ_INT32* pSrc, OPJ_INT32* const* pDst, OPJ_SIZE_T length) { memcpy(pDst[0], pSrc, length * sizeof(OPJ_INT32)); } ",0 "void php_wddx_destructor(wddx_packet *packet) { smart_str_free(packet); efree(packet); } ",0 "static int igmp_xmarksources(struct ip_mc_list *pmc, int nsrcs, __be32 *srcs) { struct ip_sf_list *psf; int i, scount; scount = 0; for (psf=pmc->sources; psf; psf=psf->sf_next) { if (scount == nsrcs) break; for (i=0; isf_count[MCAST_INCLUDE] || pmc->sfcount[MCAST_EXCLUDE] != psf->sf_count[MCAST_EXCLUDE]) continue; if (srcs[i] == psf->sf_inaddr) { scount++; break; } } } pmc->gsquery = 0; if (scount == nsrcs) /* all sources excluded */ return 0; return 1; } ",0 "void WebGL2RenderingContextBase::beginQuery(GLenum target, WebGLQuery* query) { bool deleted; DCHECK(query); if (!CheckObjectToBeBound(""beginQuery"", query, deleted)) return; if (deleted) { SynthesizeGLError(GL_INVALID_OPERATION, ""beginQuery"", ""attempted to begin a deleted query object""); return; } if (query->GetTarget() && query->GetTarget() != target) { SynthesizeGLError(GL_INVALID_OPERATION, ""beginQuery"", ""query type does not match target""); return; } switch (target) { case GL_ANY_SAMPLES_PASSED: case GL_ANY_SAMPLES_PASSED_CONSERVATIVE: { if (current_boolean_occlusion_query_) { SynthesizeGLError(GL_INVALID_OPERATION, ""beginQuery"", ""a query is already active for target""); return; } current_boolean_occlusion_query_ = query; } break; case GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN: { if (current_transform_feedback_primitives_written_query_) { SynthesizeGLError(GL_INVALID_OPERATION, ""beginQuery"", ""a query is already active for target""); return; } current_transform_feedback_primitives_written_query_ = query; } break; case GL_TIME_ELAPSED_EXT: { if (!ExtensionEnabled(kEXTDisjointTimerQueryWebGL2Name)) { SynthesizeGLError(GL_INVALID_ENUM, ""beginQuery"", ""invalid target""); return; } if (current_elapsed_query_) { SynthesizeGLError(GL_INVALID_OPERATION, ""beginQuery"", ""a query is already active for target""); return; } current_elapsed_query_ = query; } break; default: SynthesizeGLError(GL_INVALID_ENUM, ""beginQuery"", ""invalid target""); return; } if (!query->GetTarget()) query->SetTarget(target); ContextGL()->BeginQueryEXT(target, query->Object()); } ",0 "void TabsCaptureVisibleTabFunction::SendResultFromBitmap( const SkBitmap& screen_capture) { std::vector data; SkAutoLockPixels screen_capture_lock(screen_capture); bool encoded = false; std::string mime_type; switch (image_format_) { case FORMAT_JPEG: encoded = gfx::JPEGCodec::Encode( reinterpret_cast(screen_capture.getAddr32(0, 0)), gfx::JPEGCodec::FORMAT_SkBitmap, screen_capture.width(), screen_capture.height(), static_cast(screen_capture.rowBytes()), image_quality_, &data); mime_type = keys::kMimeTypeJpeg; break; case FORMAT_PNG: encoded = gfx::PNGCodec::EncodeBGRASkBitmap( screen_capture, true, // Discard transparency. &data); mime_type = keys::kMimeTypePng; break; default: NOTREACHED() << ""Invalid image format.""; } if (!encoded) { error_ = keys::kInternalVisibleTabCaptureError; SendResponse(false); return; } std::string base64_result; base::StringPiece stream_as_string( reinterpret_cast(vector_as_array(&data)), data.size()); base::Base64Encode(stream_as_string, &base64_result); base64_result.insert(0, base::StringPrintf(""data:%s;base64,"", mime_type.c_str())); SetResult(new StringValue(base64_result)); SendResponse(true); } ",0 " static int nested_vmx_check_permission(struct kvm_vcpu *vcpu) { if (!to_vmx(vcpu)->nested.vmxon) { kvm_queue_exception(vcpu, UD_VECTOR); return 0; } return 1; } ",1 "ZSTD_CDict* ZSTD_createCDict(const void* dict, size_t dictSize, int compressionLevel) { ZSTD_compressionParameters cParams = ZSTD_getCParams(compressionLevel, 0, dictSize); return ZSTD_createCDict_advanced(dict, dictSize, ZSTD_dlm_byCopy, ZSTD_dct_auto, cParams, ZSTD_defaultCMem); } ",0 "status_t AudioFlinger::EffectModule::setAudioSource(audio_source_t source) { Mutex::Autolock _l(mLock); if (mStatus != NO_ERROR) { return mStatus; } status_t status = NO_ERROR; if ((mDescriptor.flags & EFFECT_FLAG_AUDIO_SOURCE_MASK) == EFFECT_FLAG_AUDIO_SOURCE_IND) { uint32_t size = 0; status = (*mEffectInterface)->command(mEffectInterface, EFFECT_CMD_SET_AUDIO_SOURCE, sizeof(audio_source_t), &source, &size, NULL); } return status; } ",0 "bt_status_t btif_storage_get_ble_local_key(UINT8 key_type, char *key_value, int key_length) { const char* name; switch(key_type) { case BTIF_DM_LE_LOCAL_KEY_IR: name = ""LE_LOCAL_KEY_IR""; break; case BTIF_DM_LE_LOCAL_KEY_IRK: name = ""LE_LOCAL_KEY_IRK""; break; case BTIF_DM_LE_LOCAL_KEY_DHK: name = ""LE_LOCAL_KEY_DHK""; break; case BTIF_DM_LE_LOCAL_KEY_ER: name = ""LE_LOCAL_KEY_ER""; break; default: return BT_STATUS_FAIL; } size_t length = key_length; int ret = btif_config_get_bin(""Adapter"", name, (uint8_t *)key_value, &length); return ret ? BT_STATUS_SUCCESS : BT_STATUS_FAIL; } ",0 "scoped_refptr Document::StyleForPage(int page_index) { UpdateDistribution(); return EnsureStyleResolver().StyleForPage(page_index); } ",0 "Action::AuthStatus PolicyKitBackend::authorizeAction(const QString &action) { switch (PolkitQt::Auth::computeAndObtainAuth(action)) { case PolkitQt::Auth::Yes: return Action::StatusAuthorized; default: return Action::StatusDenied; } } ",0 "static int __xml_build_schema_list(void) { int lpc, max; const char *base = get_schema_root(); struct dirent **namelist = NULL; max = scandir(base, &namelist, schema_filter, schema_sort); __xml_schema_add(1, 0.0, ""pacemaker-0.6"", ""crm.dtd"", ""upgrade06.xsl"", 3); __xml_schema_add(1, 0.0, ""transitional-0.6"", ""crm-transitional.dtd"", ""upgrade06.xsl"", 3); __xml_schema_add(2, 0.0, ""pacemaker-0.7"", ""pacemaker-1.0.rng"", NULL, 0); if (max < 0) { crm_notice(""scandir(%s) failed: %s (%d)"", base, strerror(errno), errno); } else { for (lpc = 0; lpc < max; lpc++) { int next = 0; float version = 0.0; char *transform = NULL; sscanf(namelist[lpc]->d_name, ""pacemaker-%f.rng"", &version); if((lpc + 1) < max) { float next_version = 0.0; sscanf(namelist[lpc+1]->d_name, ""pacemaker-%f.rng"", &next_version); if(floor(version) < floor(next_version)) { struct stat s; char *xslt = NULL; transform = crm_strdup_printf(""upgrade-%.1f.xsl"", version); xslt = get_schema_path(NULL, transform); if(stat(xslt, &s) != 0) { crm_err(""Transform %s not found"", xslt); free(xslt); __xml_schema_add(2, version, NULL, NULL, NULL, -1); break; } else { free(xslt); } } } else { next = -1; } __xml_schema_add(2, version, NULL, NULL, transform, next); free(namelist[lpc]); free(transform); } } /* 1.1 was the old name for -next */ __xml_schema_add(2, 0.0, ""pacemaker-1.1"", ""pacemaker-next.rng"", NULL, 0); __xml_schema_add(2, 0.0, ""pacemaker-next"", ""pacemaker-next.rng"", NULL, -1); __xml_schema_add(0, 0.0, ""none"", ""N/A"", NULL, -1); free(namelist); return TRUE; } ",0 "long Cluster::CreateBlockGroup( long long start_offset, long long size, long long discard_padding) { assert(m_entries); assert(m_entries_size > 0); assert(m_entries_count >= 0); assert(m_entries_count < m_entries_size); IMkvReader* const pReader = m_pSegment->m_pReader; long long pos = start_offset; const long long stop = start_offset + size; long long prev = 1; //nonce long long next = 0; //nonce long long duration = -1; //really, this is unsigned long long bpos = -1; long long bsize = -1; while (pos < stop) { long len; const long long id = ReadUInt(pReader, pos, len); assert(id >= 0); //TODO assert((pos + len) <= stop); pos += len; //consume ID const long long size = ReadUInt(pReader, pos, len); assert(size >= 0); //TODO assert((pos + len) <= stop); pos += len; //consume size if (id == 0x21) //Block ID { if (bpos < 0) //Block ID { bpos = pos; bsize = size; } } else if (id == 0x1B) //Duration ID { assert(size <= 8); duration = UnserializeUInt(pReader, pos, size); assert(duration >= 0); //TODO } else if (id == 0x7B) //ReferenceBlock { assert(size <= 8); const long size_ = static_cast(size); long long time; long status = UnserializeInt(pReader, pos, size_, time); assert(status == 0); if (status != 0) return -1; if (time <= 0) //see note above prev = time; else //weird next = time; } pos += size; //consume payload assert(pos <= stop); } assert(pos == stop); assert(bpos >= 0); assert(bsize >= 0); const long idx = m_entries_count; BlockEntry** const ppEntry = m_entries + idx; BlockEntry*& pEntry = *ppEntry; pEntry = new (std::nothrow) BlockGroup( this, idx, bpos, bsize, prev, next, duration, discard_padding); if (pEntry == NULL) return -1; //generic error BlockGroup* const p = static_cast(pEntry); const long status = p->Parse(); if (status == 0) //success { ++m_entries_count; return 0; } delete pEntry; pEntry = 0; return status; } ",1 "static inline LayoutUnit adjustLogicalLineTop(ShapeInsideInfo* shapeInsideInfo, InlineIterator start, InlineIterator end, const WordMeasurements& wordMeasurements) { if (!shapeInsideInfo || end != start) return 0; float minWidth = firstPositiveWidth(wordMeasurements); ASSERT(minWidth || wordMeasurements.isEmpty()); if (minWidth > 0 && shapeInsideInfo->adjustLogicalLineTop(minWidth)) return shapeInsideInfo->logicalLineTop(); return shapeInsideInfo->shapeLogicalBottom(); } ",0 "static int proc_cwd_link(struct dentry *dentry, struct path *path) { struct task_struct *task = get_proc_task(d_inode(dentry)); int result = -ENOENT; if (task) { task_lock(task); if (task->fs) { get_fs_pwd(task->fs, path); result = 0; } task_unlock(task); put_task_struct(task); } return result; } ",0 "int jbd2_journal_get_undo_access(handle_t *handle, struct buffer_head *bh) { int err; struct journal_head *jh = jbd2_journal_add_journal_head(bh); char *committed_data = NULL; JBUFFER_TRACE(jh, ""entry""); /* * Do this first --- it can drop the journal lock, so we want to * make sure that obtaining the committed_data is done * atomically wrt. completion of any outstanding commits. */ err = do_get_write_access(handle, jh, 1); if (err) goto out; repeat: if (!jh->b_committed_data) { committed_data = jbd2_alloc(jh2bh(jh)->b_size, GFP_NOFS); if (!committed_data) { printk(KERN_EMERG ""%s: No memory for committed data\n"", __func__); err = -ENOMEM; goto out; } } jbd_lock_bh_state(bh); if (!jh->b_committed_data) { /* Copy out the current buffer contents into the * preserved, committed copy. */ JBUFFER_TRACE(jh, ""generate b_committed data""); if (!committed_data) { jbd_unlock_bh_state(bh); goto repeat; } jh->b_committed_data = committed_data; committed_data = NULL; memcpy(jh->b_committed_data, bh->b_data, bh->b_size); } jbd_unlock_bh_state(bh); out: jbd2_journal_put_journal_head(jh); if (unlikely(committed_data)) jbd2_free(committed_data, bh->b_size); return err; } ",0 "add_server(struct manager_ctx *manager, struct server *server) { int ret = check_port(manager, server); if (ret == -1) { LOGE(""port is not available, please check.""); return -1; } bool new = false; cork_hash_table_put(server_table, (void *)server->port, (void *)server, &new, NULL, NULL); char *cmd = construct_command_line(manager, server); if (system(cmd) == -1) { ERROR(""add_server_system""); return -1; } return 0; } ",0 "void ShellContentBrowserClient::ResourceDispatcherHostCreated() { resource_dispatcher_host_delegate_.reset( base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kRunLayoutTest) ? new LayoutTestResourceDispatcherHostDelegate : new ShellResourceDispatcherHostDelegate); ResourceDispatcherHost::Get()->SetDelegate( resource_dispatcher_host_delegate_.get()); } ",0 "void RenderWidgetHostImpl::DispatchInputEventWithLatencyInfo( const blink::WebInputEvent& event, ui::LatencyInfo* latency) { latency_tracker_.OnInputEvent(event, latency); for (auto& observer : input_event_observers_) observer.OnInputEvent(event); } ",0 "void Document::loadEventDelayTimerFired(Timer*) { if (frame()) frame()->loader().checkCompleted(); } ",0 "void OxideQQuickWebViewPrivate::ContentBlocked() { Q_Q(OxideQQuickWebView); emit q->blockedContentChanged(); } ",0 "void ForeignSessionHelper::DeleteForeignSession( JNIEnv* env, const JavaParamRef& obj, const JavaParamRef& session_tag) { OpenTabsUIDelegate* open_tabs = GetOpenTabsUIDelegate(profile_); if (open_tabs) open_tabs->DeleteForeignSession(ConvertJavaStringToUTF8(env, session_tag)); } ",0 "static uint8_t msix_pending_mask(int vector) { return 1 << (vector % 8); } ",0 "static int follow_dotdot(struct nameidata *nd) { while(1) { struct dentry *old = nd->path.dentry; if (nd->path.dentry == nd->root.dentry && nd->path.mnt == nd->root.mnt) { break; } if (nd->path.dentry != nd->path.mnt->mnt_root) { /* rare case of legitimate dget_parent()... */ nd->path.dentry = dget_parent(nd->path.dentry); dput(old); if (unlikely(!path_connected(&nd->path))) return -ENOENT; break; } if (!follow_up(&nd->path)) break; } follow_mount(&nd->path); nd->inode = nd->path.dentry->d_inode; return 0; } ",0 "void FragmentPaintPropertyTreeBuilder::UpdatePerspective() { DCHECK(properties_); if (NeedsPaintPropertyUpdate()) { if (NeedsPerspective(object_)) { const ComputedStyle& style = object_.StyleRef(); TransformPaintPropertyNode::State state; state.matrix.ApplyPerspective(style.Perspective()); state.origin = PerspectiveOrigin(ToLayoutBox(object_)) + ToLayoutSize(context_.current.paint_offset); state.flattens_inherited_transform = context_.current.should_flatten_inherited_transform; if (RuntimeEnabledFeatures::SlimmingPaintV2Enabled() || RuntimeEnabledFeatures::BlinkGenPropertyTreesEnabled()) state.rendering_context_id = context_.current.rendering_context_id; OnUpdate(properties_->UpdatePerspective(context_.current.transform, std::move(state))); } else { OnClear(properties_->ClearPerspective()); } } if (properties_->Perspective()) { context_.current.transform = properties_->Perspective(); context_.current.should_flatten_inherited_transform = false; } } ",1 "static int intel_pmu_handle_irq(struct pt_regs *regs) { struct perf_sample_data data; struct cpu_hw_events *cpuc; int bit, loops; u64 status; int handled; perf_sample_data_init(&data, 0); cpuc = &__get_cpu_var(cpu_hw_events); /* * Some chipsets need to unmask the LVTPC in a particular spot * inside the nmi handler. As a result, the unmasking was pushed * into all the nmi handlers. * * This handler doesn't seem to have any issues with the unmasking * so it was left at the top. */ apic_write(APIC_LVTPC, APIC_DM_NMI); intel_pmu_disable_all(); handled = intel_pmu_drain_bts_buffer(); status = intel_pmu_get_status(); if (!status) { intel_pmu_enable_all(0); return handled; } loops = 0; again: intel_pmu_ack_status(status); if (++loops > 100) { WARN_ONCE(1, ""perfevents: irq loop stuck!\n""); perf_event_print_debug(); intel_pmu_reset(); goto done; } inc_irq_stat(apic_perf_irqs); intel_pmu_lbr_read(); /* * PEBS overflow sets bit 62 in the global status register */ if (__test_and_clear_bit(62, (unsigned long *)&status)) { handled++; x86_pmu.drain_pebs(regs); } for_each_set_bit(bit, (unsigned long *)&status, X86_PMC_IDX_MAX) { struct perf_event *event = cpuc->events[bit]; handled++; if (!test_bit(bit, cpuc->active_mask)) continue; if (!intel_pmu_save_and_restart(event)) continue; data.period = event->hw.last_period; if (perf_event_overflow(event, 1, &data, regs)) x86_pmu_stop(event, 0); } /* * Repeat if there is more work to be done: */ status = intel_pmu_get_status(); if (status) goto again; done: intel_pmu_enable_all(0); return handled; } ",1 "gss_krb5int_extract_authtime_from_sec_context(OM_uint32 *minor_status, const gss_ctx_id_t context_handle, const gss_OID desired_oid, gss_buffer_set_t *data_set) { krb5_gss_ctx_id_rec *ctx; gss_buffer_desc rep; ctx = (krb5_gss_ctx_id_rec *) context_handle; rep.value = &ctx->krb_times.authtime; rep.length = sizeof(ctx->krb_times.authtime); return generic_gss_add_buffer_set_member(minor_status, &rep, data_set); } ",0 "static void ping_set_saddr(struct sock *sk, struct sockaddr *saddr) { if (saddr->sa_family == AF_INET) { struct inet_sock *isk = inet_sk(sk); struct sockaddr_in *addr = (struct sockaddr_in *) saddr; isk->inet_rcv_saddr = isk->inet_saddr = addr->sin_addr.s_addr; #if IS_ENABLED(CONFIG_IPV6) } else if (saddr->sa_family == AF_INET6) { struct sockaddr_in6 *addr = (struct sockaddr_in6 *) saddr; struct ipv6_pinfo *np = inet6_sk(sk); sk->sk_v6_rcv_saddr = np->saddr = addr->sin6_addr; #endif } } ",0 "void ShellSurface::SetParent(ShellSurface* parent) { TRACE_EVENT1(""exo"", ""ShellSurface::SetParent"", ""parent"", parent ? base::UTF16ToASCII(parent->title_) : ""null""); if (parent_) { parent_->RemoveObserver(this); if (widget_) wm::RemoveTransientChild(parent_, widget_->GetNativeWindow()); } parent_ = parent ? parent->GetWidget()->GetNativeWindow() : nullptr; if (parent_) { parent_->AddObserver(this); if (widget_) wm::AddTransientChild(parent_, widget_->GetNativeWindow()); } } ",0 " static void Ins_IUP( INS_ARG ) { struct LOC_Ins_IUP V; unsigned char mask; Long first_point; /* first point of contour */ Long end_point; /* end point (last+1) of contour */ Long first_touched; /* first touched point in contour */ Long cur_touched; /* current touched point in contour */ Long point; /* current point */ Long contour; /* current contour */ (void)args; if ( CUR.opcode & 1 ) { mask = TT_Flag_Touched_X; V.orgs = CUR.pts.org_x; V.curs = CUR.pts.cur_x; } else { mask = TT_Flag_Touched_Y; V.orgs = CUR.pts.org_y; V.curs = CUR.pts.cur_y; } contour = 0; point = 0; do { end_point = CUR.pts.contours[contour]; first_point = point; while ( point <= end_point && (CUR.pts.touch[point] & mask) == 0 ) point++; if ( point <= end_point ) { first_touched = point; cur_touched = point; point++; while ( point <= end_point ) { if ( (CUR.pts.touch[point] & mask) != 0 ) { Interp( (Int)(cur_touched + 1), (Int)(point - 1), (Int)cur_touched, (Int)point, &V ); cur_touched = point; } point++; } if ( cur_touched == first_touched ) Shift( (Int)first_point, (Int)end_point, (Int)cur_touched, &V ); else { Interp((Int)(cur_touched + 1), (Int)(end_point), (Int)(cur_touched), (Int)(first_touched), &V ); Interp((Int)(first_point), (Int)(first_touched - 1), (Int)(cur_touched), (Int)(first_touched), &V ); } } contour++; } while ( contour < CUR.pts.n_contours ); } ",0 "static void smaps_account(struct mem_size_stats *mss, struct page *page, unsigned long size, bool young, bool dirty) { int mapcount; if (PageAnon(page)) mss->anonymous += size; mss->resident += size; /* Accumulate the size in pages that have been accessed. */ if (young || PageReferenced(page)) mss->referenced += size; mapcount = page_mapcount(page); if (mapcount >= 2) { u64 pss_delta; if (dirty || PageDirty(page)) mss->shared_dirty += size; else mss->shared_clean += size; pss_delta = (u64)size << PSS_SHIFT; do_div(pss_delta, mapcount); mss->pss += pss_delta; } else { if (dirty || PageDirty(page)) mss->private_dirty += size; else mss->private_clean += size; mss->pss += (u64)size << PSS_SHIFT; } } ",0 " parse_buildchar( T1_Face face, T1_Loader loader ) { face->len_buildchar = T1_ToFixedArray( &loader->parser, 0, NULL, 0 ); return; } ",0 "void RenderWidgetHostViewAura::SelectionBoundsChanged( const ViewHostMsg_SelectionBounds_Params& params) { if (selection_anchor_rect_ == params.anchor_rect && selection_focus_rect_ == params.focus_rect) return; selection_anchor_rect_ = params.anchor_rect; selection_focus_rect_ = params.focus_rect; if (GetInputMethod()) GetInputMethod()->OnCaretBoundsChanged(this); if (touch_editing_client_) { touch_editing_client_->OnSelectionOrCursorChanged(selection_anchor_rect_, selection_focus_rect_); } } ",0 "ClipboardMessageFilter::~ClipboardMessageFilter() { } ",0 "bool PrintRenderFrameHelper::PreviewPageRendered(int page_number, PdfMetafileSkia* metafile) { DCHECK_GE(page_number, FIRST_PAGE_INDEX); if (!print_preview_context_.IsModifiable() || !print_preview_context_.generate_draft_pages()) { DCHECK(!metafile); return true; } if (!metafile) { NOTREACHED(); print_preview_context_.set_error( PREVIEW_ERROR_PAGE_RENDERED_WITHOUT_METAFILE); return false; } PrintHostMsg_DidPreviewPage_Params preview_page_params; if (!CopyMetafileDataToSharedMem(*metafile, &preview_page_params.metafile_data_handle)) { LOG(ERROR) << ""CopyMetafileDataToSharedMem failed""; print_preview_context_.set_error(PREVIEW_ERROR_METAFILE_COPY_FAILED); return false; } preview_page_params.data_size = metafile->GetDataSize(); preview_page_params.page_number = page_number; preview_page_params.preview_request_id = print_pages_params_->params.preview_request_id; Send(new PrintHostMsg_DidPreviewPage(routing_id(), preview_page_params)); return true; } ",1 "void ComponentUpdaterPolicyTest::SetUpOnMainThread() { const auto config = component_updater::MakeChromeComponentUpdaterConfigurator( base::CommandLine::ForCurrentProcess(), g_browser_process->local_state()); const auto urls = config->UpdateUrl(); ASSERT_EQ(1u, urls.size()); post_interceptor_ = std::make_unique( urls, &https_server_); https_server_.StartAcceptingConnections(); PolicyTest::SetUpOnMainThread(); } ",0 " void writeBooleanObject(bool value) { append(value ? TrueObjectTag : FalseObjectTag); } ",0 "void WebGLRenderingContextBase::TexImageCanvasByGPU( TexImageFunctionID function_id, HTMLCanvasElement* canvas, GLenum target, GLuint target_texture, GLint xoffset, GLint yoffset, const IntRect& source_sub_rectangle) { if (!canvas->Is3d()) { ImageBuffer* buffer = canvas->GetOrCreateImageBuffer(); if (buffer && !buffer->CopyToPlatformTexture( FunctionIDToSnapshotReason(function_id), ContextGL(), target, target_texture, unpack_premultiply_alpha_, unpack_flip_y_, IntPoint(xoffset, yoffset), source_sub_rectangle)) { NOTREACHED(); } } else { WebGLRenderingContextBase* gl = ToWebGLRenderingContextBase(canvas->RenderingContext()); ScopedTexture2DRestorer restorer(gl); if (!gl->GetDrawingBuffer()->CopyToPlatformTexture( ContextGL(), target, target_texture, unpack_premultiply_alpha_, !unpack_flip_y_, IntPoint(xoffset, yoffset), source_sub_rectangle, kBackBuffer)) { NOTREACHED(); } } } ",0 "copy_entries_to_user(unsigned int total_size, const struct xt_table *table, void __user *userptr) { unsigned int off, num; const struct ipt_entry *e; struct xt_counters *counters; const struct xt_table_info *private = table->private; int ret = 0; const void *loc_cpu_entry; counters = alloc_counters(table); if (IS_ERR(counters)) return PTR_ERR(counters); loc_cpu_entry = private->entries; /* FIXME: use iterator macros --RR */ /* ... then go back and fix counters and names */ for (off = 0, num = 0; off < total_size; off += e->next_offset, num++){ unsigned int i; const struct xt_entry_match *m; const struct xt_entry_target *t; e = loc_cpu_entry + off; if (copy_to_user(userptr + off, e, sizeof(*e))) { ret = -EFAULT; goto free_counters; } if (copy_to_user(userptr + off + offsetof(struct ipt_entry, counters), &counters[num], sizeof(counters[num])) != 0) { ret = -EFAULT; goto free_counters; } for (i = sizeof(struct ipt_entry); i < e->target_offset; i += m->u.match_size) { m = (void *)e + i; if (xt_match_to_user(m, userptr + off + i)) { ret = -EFAULT; goto free_counters; } } t = ipt_get_target_c(e); if (xt_target_to_user(t, userptr + off + e->target_offset)) { ret = -EFAULT; goto free_counters; } } free_counters: vfree(counters); return ret; } ",0 "clock_t jiffies_to_clock_t(long x) { #if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0 # if HZ < USER_HZ return x * (USER_HZ / HZ); # else return x / (HZ / USER_HZ); # endif #else return div_u64((u64)x * TICK_NSEC, NSEC_PER_SEC / USER_HZ); #endif } ",0 "dtls1_min_mtu(void) { return (g_probable_mtu[(sizeof(g_probable_mtu) / sizeof(g_probable_mtu[0])) - 1]); } ",0 "WebBluetoothServiceImpl::~WebBluetoothServiceImpl() { DCHECK_CURRENTLY_ON(BrowserThread::UI); ClearState(); } ",0 "void RenderViewImpl::DidAutoResize(const blink::WebSize& newSize) { RenderWidget::DidAutoResize(newSize); } ",0 "bool ScriptResource::CanUseCacheValidator() const { if (HasClientsOrObservers()) return false; return Resource::CanUseCacheValidator(); } ",0 "void SoundPool::setPriority(int channelID, int priority) { ALOGV(""setPriority(%d, %d)"", channelID, priority); Mutex::Autolock lock(&mLock); SoundChannel* channel = findChannel(channelID); if (channel) { channel->setPriority(priority); } } ",0 "static void __shadow_walk_next(struct kvm_shadow_walk_iterator *iterator, u64 spte) { if (is_last_spte(spte, iterator->level)) { iterator->level = 0; return; } iterator->shadow_addr = spte & PT64_BASE_ADDR_MASK; --iterator->level; } ",0 "netdutils::Status XfrmController::ipSecSetEncapSocketOwner(const android::base::unique_fd& socket, int newUid, uid_t callerUid) { ALOGD(""XfrmController:%s, line=%d"", __FUNCTION__, __LINE__); const int fd = socket.get(); struct stat info; if (fstat(fd, &info)) { return netdutils::statusFromErrno(errno, ""Failed to stat socket file descriptor""); } if (info.st_uid != callerUid) { return netdutils::statusFromErrno(EPERM, ""fchown disabled for non-owner calls""); } if (S_ISSOCK(info.st_mode) == 0) { return netdutils::statusFromErrno(EINVAL, ""File descriptor was not a socket""); } int optval; socklen_t optlen; netdutils::Status status = getSyscallInstance().getsockopt(Fd(socket), IPPROTO_UDP, UDP_ENCAP, &optval, &optlen); if (status != netdutils::status::ok) { return status; } if (optval != UDP_ENCAP_ESPINUDP && optval != UDP_ENCAP_ESPINUDP_NON_IKE) { return netdutils::statusFromErrno(EINVAL, ""Socket did not have UDP-encap sockopt set""); } if (fchown(fd, newUid, -1)) { return netdutils::statusFromErrno(errno, ""Failed to fchown socket file descriptor""); } return netdutils::status::ok; } ",1 "xfs_attr3_leaf_hdr_to_disk( struct xfs_attr_leafblock *to, struct xfs_attr3_icleaf_hdr *from) { int i; ASSERT(from->magic == XFS_ATTR_LEAF_MAGIC || from->magic == XFS_ATTR3_LEAF_MAGIC); if (from->magic == XFS_ATTR3_LEAF_MAGIC) { struct xfs_attr3_leaf_hdr *hdr3 = (struct xfs_attr3_leaf_hdr *)to; hdr3->info.hdr.forw = cpu_to_be32(from->forw); hdr3->info.hdr.back = cpu_to_be32(from->back); hdr3->info.hdr.magic = cpu_to_be16(from->magic); hdr3->count = cpu_to_be16(from->count); hdr3->usedbytes = cpu_to_be16(from->usedbytes); hdr3->firstused = cpu_to_be16(from->firstused); hdr3->holes = from->holes; hdr3->pad1 = 0; for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) { hdr3->freemap[i].base = cpu_to_be16(from->freemap[i].base); hdr3->freemap[i].size = cpu_to_be16(from->freemap[i].size); } return; } to->hdr.info.forw = cpu_to_be32(from->forw); to->hdr.info.back = cpu_to_be32(from->back); to->hdr.info.magic = cpu_to_be16(from->magic); to->hdr.count = cpu_to_be16(from->count); to->hdr.usedbytes = cpu_to_be16(from->usedbytes); to->hdr.firstused = cpu_to_be16(from->firstused); to->hdr.holes = from->holes; to->hdr.pad1 = 0; for (i = 0; i < XFS_ATTR_LEAF_MAPSIZE; i++) { to->hdr.freemap[i].base = cpu_to_be16(from->freemap[i].base); to->hdr.freemap[i].size = cpu_to_be16(from->freemap[i].size); } } ",0 " void ClientSession::Disconnect() { connection_->Disconnect(); authenticated_ = false; RestoreEventState(); } ",1 "void ContainerNode::appendChild(PassRefPtr newChild, ExceptionState& es) { RefPtr protect(this); ASSERT(refCount() || parentOrShadowHostNode()); if (!checkAddChild(this, newChild.get(), es)) return; if (newChild == m_lastChild) // nothing to do return; NodeVector targets; collectChildrenAndRemoveFromOldParent(newChild.get(), targets, es); if (es.hadException()) return; if (targets.isEmpty()) return; if (!checkAcceptChildGuaranteedNodeTypes(this, newChild.get(), es)) return; InspectorInstrumentation::willInsertDOMNode(&document(), this); ChildListMutationScope mutation(this); for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) { Node* child = it->get(); if (child->parentNode()) break; treeScope().adoptIfNeeded(child); { NoEventDispatchAssertion assertNoEventDispatch; appendChildToContainer(child, this); } updateTreeAfterInsertion(this, child); } dispatchSubtreeModifiedEvent(); } ",0 "static void ehci_update_frindex(EHCIState *ehci, int uframes) { int i; if (!ehci_enabled(ehci) && ehci->pstate == EST_INACTIVE) { return; } for (i = 0; i < uframes; i++) { ehci->frindex++; if (ehci->frindex == 0x00002000) { ehci_raise_irq(ehci, USBSTS_FLR); } if (ehci->frindex == 0x00004000) { ehci_raise_irq(ehci, USBSTS_FLR); ehci->frindex = 0; if (ehci->usbsts_frindex >= 0x00004000) { ehci->usbsts_frindex -= 0x00004000; } else { ehci->usbsts_frindex = 0; } } } } ",0 " void DownloadController::OnDownloadUpdated(DownloadItem* item) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (item->IsDangerous() && (item->GetState() != DownloadItem::CANCELLED)) OnDangerousDownload(item); JNIEnv* env = base::android::AttachCurrentThread(); ScopedJavaLocalRef jguid = ConvertUTF8ToJavaString(env, item->GetGuid()); ScopedJavaLocalRef jurl = ConvertUTF8ToJavaString(env, item->GetURL().spec()); ScopedJavaLocalRef jmime_type = ConvertUTF8ToJavaString(env, item->GetMimeType()); ScopedJavaLocalRef jpath = ConvertUTF8ToJavaString(env, item->GetTargetFilePath().value()); ScopedJavaLocalRef jfilename = ConvertUTF8ToJavaString( env, item->GetTargetFilePath().BaseName().value()); ScopedJavaLocalRef joriginal_url = ConvertUTF8ToJavaString(env, item->GetOriginalUrl().spec()); ScopedJavaLocalRef jreferrer_url = ConvertUTF8ToJavaString(env, item->GetReferrerUrl().spec()); ui::PageTransition base_transition = ui::PageTransitionStripQualifier(item->GetTransitionType()); bool user_initiated = item->GetTransitionType() & ui::PAGE_TRANSITION_FROM_ADDRESS_BAR || base_transition == ui::PAGE_TRANSITION_TYPED || base_transition == ui::PAGE_TRANSITION_AUTO_BOOKMARK || base_transition == ui::PAGE_TRANSITION_GENERATED || base_transition == ui::PAGE_TRANSITION_RELOAD || base_transition == ui::PAGE_TRANSITION_KEYWORD; bool hasUserGesture = item->HasUserGesture() || user_initiated; switch (item->GetState()) { case DownloadItem::IN_PROGRESS: { base::TimeDelta time_delta; item->TimeRemaining(&time_delta); Java_DownloadController_onDownloadUpdated( env, GetJavaObject()->Controller(env), jurl, jmime_type, jfilename, jpath, item->GetReceivedBytes(), jguid, item->PercentComplete(), time_delta.InMilliseconds(), hasUserGesture, item->IsPaused(), item->GetBrowserContext()->IsOffTheRecord()); break; } case DownloadItem::COMPLETE: item->RemoveObserver(this); Java_DownloadController_onDownloadCompleted( env, GetJavaObject()->Controller(env), jurl, jmime_type, jfilename, jpath, item->GetReceivedBytes(), jguid, joriginal_url, jreferrer_url, hasUserGesture); DownloadController::RecordDownloadCancelReason( DownloadController::CANCEL_REASON_NOT_CANCELED); break; case DownloadItem::CANCELLED: Java_DownloadController_onDownloadCancelled( env, GetJavaObject()->Controller(env), jguid); break; case DownloadItem::INTERRUPTED: Java_DownloadController_onDownloadInterrupted( env, GetJavaObject()->Controller(env), jurl, jmime_type, jfilename, jpath, item->GetReceivedBytes(), jguid, item->CanResume(), IsInterruptedDownloadAutoResumable(item), item->GetBrowserContext()->IsOffTheRecord()); item->RemoveObserver(this); break; case DownloadItem::MAX_DOWNLOAD_STATE: NOTREACHED(); } } ",0 " void SendNotifications(blink::mojom::AppCacheEventID event_id) { for (auto* frontend : hosts_to_notify_) frontend->EventRaised(event_id); } ",0 "static bool setup_stratum_socket(struct pool *pool) { struct addrinfo servinfobase, *servinfo, *hints, *p; char *sockaddr_url, *sockaddr_port; int sockd; int ret; mutex_lock(&pool->stratum_lock); pool->stratum_active = false; if (pool->sock) { /* FIXME: change to LOG_DEBUG if issue #88 resolved */ applog(LOG_INFO, ""Closing %s socket"", get_pool_name(pool)); CLOSESOCKET(pool->sock); } pool->sock = 0; mutex_unlock(&pool->stratum_lock); hints = &pool->stratum_hints; memset(hints, 0, sizeof(struct addrinfo)); hints->ai_family = AF_UNSPEC; hints->ai_socktype = SOCK_STREAM; servinfo = &servinfobase; if (!pool->rpc_proxy && opt_socks_proxy) { pool->rpc_proxy = opt_socks_proxy; extract_sockaddr(pool->rpc_proxy, &pool->sockaddr_proxy_url, &pool->sockaddr_proxy_port); pool->rpc_proxytype = PROXY_SOCKS5; } if (pool->rpc_proxy) { sockaddr_url = pool->sockaddr_proxy_url; sockaddr_port = pool->sockaddr_proxy_port; } else { sockaddr_url = pool->sockaddr_url; sockaddr_port = pool->stratum_port; } ret = getaddrinfo(sockaddr_url, sockaddr_port, hints, &servinfo); if (ret) { applog(LOG_INFO, ""getaddrinfo() in setup_stratum_socket() returned %i: %s"", ret, gai_strerror(ret)); if (!pool->probed) { applog(LOG_WARNING, ""Failed to resolve (wrong URL?) %s:%s"", sockaddr_url, sockaddr_port); pool->probed = true; } else { applog(LOG_INFO, ""Failed to getaddrinfo for %s:%s"", sockaddr_url, sockaddr_port); } return false; } for (p = servinfo; p != NULL; p = p->ai_next) { sockd = socket(p->ai_family, p->ai_socktype, p->ai_protocol); if (sockd == -1) { applog(LOG_DEBUG, ""Failed socket""); continue; } /* Iterate non blocking over entries returned by getaddrinfo * to cope with round robin DNS entries, finding the first one * we can connect to quickly. */ noblock_socket(sockd); if (connect(sockd, p->ai_addr, p->ai_addrlen) == -1) { struct timeval tv_timeout = {1, 0}; int selret; fd_set rw; if (!sock_connecting()) { CLOSESOCKET(sockd); applog(LOG_DEBUG, ""Failed sock connect""); continue; } retry: FD_ZERO(&rw); FD_SET(sockd, &rw); selret = select(sockd + 1, NULL, &rw, NULL, &tv_timeout); if (selret > 0 && FD_ISSET(sockd, &rw)) { socklen_t len; int err, n; len = sizeof(err); n = getsockopt(sockd, SOL_SOCKET, SO_ERROR, (char *)&err, &len); if (!n && !err) { applog(LOG_DEBUG, ""Succeeded delayed connect""); block_socket(sockd); break; } } if (selret < 0 && interrupted()) goto retry; CLOSESOCKET(sockd); applog(LOG_DEBUG, ""Select timeout/failed connect""); continue; } applog(LOG_WARNING, ""Succeeded immediate connect""); block_socket(sockd); break; } if (p == NULL) { applog(LOG_INFO, ""Failed to connect to stratum on %s:%s"", sockaddr_url, sockaddr_port); freeaddrinfo(servinfo); return false; } freeaddrinfo(servinfo); if (pool->rpc_proxy) { switch (pool->rpc_proxytype) { case PROXY_HTTP_1_0: if (!http_negotiate(pool, sockd, true)) return false; break; case PROXY_HTTP: if (!http_negotiate(pool, sockd, false)) return false; break; case PROXY_SOCKS5: case PROXY_SOCKS5H: if (!socks5_negotiate(pool, sockd)) return false; break; case PROXY_SOCKS4: if (!socks4_negotiate(pool, sockd, false)) return false; break; case PROXY_SOCKS4A: if (!socks4_negotiate(pool, sockd, true)) return false; break; default: applog(LOG_WARNING, ""Unsupported proxy type for %s:%s"", pool->sockaddr_proxy_url, pool->sockaddr_proxy_port); return false; break; } } if (!pool->sockbuf) { pool->sockbuf = (char *)calloc(RBUFSIZE, 1); if (!pool->sockbuf) quithere(1, ""Failed to calloc pool sockbuf""); pool->sockbuf_size = RBUFSIZE; } pool->sock = sockd; keep_sockalive(sockd); return true; } ",0 "void jas_matrix_setall(jas_matrix_t *matrix, jas_seqent_t val) { int i; int j; jas_seqent_t *rowstart; int rowstep; jas_seqent_t *data; if (jas_matrix_numrows(matrix) > 0 && jas_matrix_numcols(matrix) > 0) { assert(matrix->rows_); rowstep = jas_matrix_rowstep(matrix); for (i = matrix->numrows_, rowstart = matrix->rows_[0]; i > 0; --i, rowstart += rowstep) { for (j = matrix->numcols_, data = rowstart; j > 0; --j, ++data) { *data = val; } } } } ",0 "wake_affine_idle(int this_cpu, int prev_cpu, int sync) { /* * If this_cpu is idle, it implies the wakeup is from interrupt * context. Only allow the move if cache is shared. Otherwise an * interrupt intensive workload could force all tasks onto one * node depending on the IO topology or IRQ affinity settings. * * If the prev_cpu is idle and cache affine then avoid a migration. * There is no guarantee that the cache hot data from an interrupt * is more important than cache hot data on the prev_cpu and from * a cpufreq perspective, it's better to have higher utilisation * on one CPU. */ if (available_idle_cpu(this_cpu) && cpus_share_cache(this_cpu, prev_cpu)) return available_idle_cpu(prev_cpu) ? prev_cpu : this_cpu; if (sync && cpu_rq(this_cpu)->nr_running == 1) return this_cpu; return nr_cpumask_bits; } ",0 "gs_flushpage(gs_gstate * pgs) { gx_device *dev = gs_currentdevice(pgs); return (*dev_proc(dev, sync_output)) (dev); } ",0 "static void ImplementedAsVoidMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); impl->implementedAsMethodName(); } ",0 "void DownloadManagerImpl::SetDelegate(DownloadManagerDelegate* delegate) { delegate_ = delegate; } ",0 "hcom_client_create_stream ( OUT p_hsm_com_stream_hdl_t *p_stream_hdl, IN p_hsm_com_client_hdl_t p_client_hdl, IN char *socket_path, IN int max_conx, IN int max_data_len ) { return HSM_COM_OK; } ",0 "void comps_objrtree_set_x(COMPS_ObjRTree *rt, char *key, COMPS_Object *data) { __comps_objrtree_set(rt, key, strlen(key), data); } ",0 "i915_gem_execbuffer_sync_rings(struct drm_i915_gem_object *obj, struct intel_ring_buffer *to) { struct intel_ring_buffer *from = obj->ring; u32 seqno; int ret, idx; if (from == NULL || to == from) return 0; /* XXX gpu semaphores are implicated in various hard hangs on SNB */ if (!intel_enable_semaphores(obj->base.dev)) return i915_gem_object_wait_rendering(obj); idx = intel_ring_sync_index(from, to); seqno = obj->last_rendering_seqno; if (seqno <= from->sync_seqno[idx]) return 0; if (seqno == from->outstanding_lazy_request) { struct drm_i915_gem_request *request; request = kzalloc(sizeof(*request), GFP_KERNEL); if (request == NULL) return -ENOMEM; ret = i915_add_request(from, NULL, request); if (ret) { kfree(request); return ret; } seqno = request->seqno; } from->sync_seqno[idx] = seqno; return to->sync_to(to, from, seqno - 1); } ",0 "bool HeadlessWebContentsImpl::AttachClient(HeadlessDevToolsClient* client) { return HeadlessDevToolsClientImpl::From(client)->AttachToHost( agent_host_.get()); } ",0 "static int sane_signal_64_frame(unsigned long sp) { struct signal_frame_64 __user *sf; unsigned long pinfo, puc; sf = (struct signal_frame_64 __user *) sp; if (read_user_stack_64((unsigned long __user *) &sf->pinfo, &pinfo) || read_user_stack_64((unsigned long __user *) &sf->puc, &puc)) return 0; return pinfo == (unsigned long) &sf->info && puc == (unsigned long) &sf->uc; } ",0 "PHP_MSHUTDOWN_FUNCTION(curl) { curl_global_cleanup(); #ifdef PHP_CURL_NEED_OPENSSL_TSL if (php_curl_openssl_tsl) { int i, c = CRYPTO_num_locks(); CRYPTO_set_id_callback(NULL); CRYPTO_set_locking_callback(NULL); for (i = 0; i < c; ++i) { tsrm_mutex_free(php_curl_openssl_tsl[i]); } free(php_curl_openssl_tsl); php_curl_openssl_tsl = NULL; } #endif UNREGISTER_INI_ENTRIES(); return SUCCESS; } ",0 "void ResourceLoader::DidFail(const WebURLError& error, int64_t encoded_data_length, int64_t encoded_body_length, int64_t decoded_body_length) { resource_->SetEncodedDataLength(encoded_data_length); resource_->SetEncodedBodyLength(encoded_body_length); resource_->SetDecodedBodyLength(decoded_body_length); HandleError(error); } ",0 "pipe_poll(struct file *filp, poll_table *wait) { unsigned int mask; struct pipe_inode_info *pipe = filp->private_data; int nrbufs; poll_wait(filp, &pipe->wait, wait); /* Reading only -- no need for acquiring the semaphore. */ nrbufs = pipe->nrbufs; mask = 0; if (filp->f_mode & FMODE_READ) { mask = (nrbufs > 0) ? POLLIN | POLLRDNORM : 0; if (!pipe->writers && filp->f_version != pipe->w_counter) mask |= POLLHUP; } if (filp->f_mode & FMODE_WRITE) { mask |= (nrbufs < pipe->buffers) ? POLLOUT | POLLWRNORM : 0; /* * Most Unices do not set POLLERR for FIFOs but on Linux they * behave exactly like pipes for poll(). */ if (!pipe->readers) mask |= POLLERR; } return mask; } ",0 " ScriptPromise ImageBitmapFactories::createImageBitmap(EventTarget& eventTarget, Blob* blob, ExceptionState& exceptionState) { if (!blob) { exceptionState.throwTypeError(""The blob provided is invalid.""); return ScriptPromise(); } RefPtr resolver = ScriptPromiseResolver::create(eventTarget.executionContext()); ScriptPromise promise = resolver->promise(); RefPtr loader = ImageBitmapFactories::ImageBitmapLoader::create(from(eventTarget), resolver, IntRect()); from(eventTarget).addLoader(loader); loader->loadBlobAsync(eventTarget.executionContext(), blob); return promise; } ",0 "static pte_t make_huge_pte(struct vm_area_struct *vma, struct page *page, int writable) { pte_t entry; if (writable) { entry = pte_mkwrite(pte_mkdirty(mk_pte(page, vma->vm_page_prot))); } else { entry = huge_pte_wrprotect(mk_pte(page, vma->vm_page_prot)); } entry = pte_mkyoung(entry); entry = pte_mkhuge(entry); entry = arch_make_huge_pte(entry, vma, page, writable); return entry; } ",0 "static void handle_http_errors(URLContext *h, int error) { av_assert0(error < 0); http_write_reply(h, error); } ",0 "static void emitarg(JF, int value) { emitraw(J, F, value); } ",0 "String Notification::tag() const { return m_data.tag; } ",0 "bool ContentSecurityPolicy::AllowInlineScript( Element* element, const String& context_url, const String& nonce, const WTF::OrdinalNumber& context_line, const String& script_content, InlineType inline_type, SecurityViolationReportingPolicy reporting_policy) const { DCHECK(element); Vector csp_hash_values; FillInCSPHashValues(script_content, script_hash_algorithms_used_, &csp_hash_values); bool is_allowed = true; for (const auto& policy : policies_) { is_allowed &= CheckScriptHashAgainstPolicy(csp_hash_values, policy, inline_type) || policy->AllowInlineScript(element, context_url, nonce, context_line, reporting_policy, script_content); } return is_allowed; } ",0 "void ChromeRenderMessageFilter::OverrideThreadForMessage( const IPC::Message& message, BrowserThread::ID* thread) { switch (message.type()) { case ChromeViewHostMsg_ResourceTypeStats::ID: case ExtensionHostMsg_AddListener::ID: case ExtensionHostMsg_RemoveListener::ID: case ExtensionHostMsg_AddLazyListener::ID: case ExtensionHostMsg_RemoveLazyListener::ID: case ExtensionHostMsg_CloseChannel::ID: case ExtensionHostMsg_ShouldUnloadAck::ID: case ExtensionHostMsg_UnloadAck::ID: case ChromeViewHostMsg_UpdatedCacheStats::ID: *thread = BrowserThread::UI; break; default: break; } } ",0 "WebKitTestController::WebKitTestController() : main_window_(NULL), test_phase_(BETWEEN_TESTS), is_leak_detection_enabled_( base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnableLeakDetection)), crash_when_leak_found_(false), devtools_frontend_(NULL) { CHECK(!instance_); instance_ = this; if (is_leak_detection_enabled_) { std::string switchValue = base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kEnableLeakDetection); crash_when_leak_found_ = switchValue == switches::kCrashOnFailure; } printer_.reset(new WebKitTestResultPrinter(&std::cout, &std::cerr)); if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kEncodeBinary)) printer_->set_encode_binary_data(true); registrar_.Add(this, NOTIFICATION_RENDERER_PROCESS_CREATED, NotificationService::AllSources()); GpuDataManager::GetInstance()->AddObserver(this); ResetAfterLayoutTest(); } ",0 " net::CompletionOnceCallback deletion_callback() { return base::BindOnce(&AppCacheServiceImplTest::OnDeleteAppCachesComplete, base::Unretained(this)); } ",0 "bool CSPSourceList::parseNonce(const UChar* begin, const UChar* end, String& nonce) { size_t nonceLength = end - begin; const char* prefix = ""'nonce-""; if (nonceLength <= strlen(prefix) || !equalIgnoringCase(prefix, begin, strlen(prefix))) return true; const UChar* position = begin + strlen(prefix); const UChar* nonceBegin = position; ASSERT(position < end); skipWhile(position, end); ASSERT(nonceBegin <= position); if (position + 1 != end || *position != '\'' || position == nonceBegin) return false; nonce = String(nonceBegin, position - nonceBegin); return true; } ",0 "static void megasas_scsi_reset(DeviceState *dev) { MegasasState *s = MEGASAS(dev); megasas_soft_reset(s); } ",0 "FPDF_BOOL PDFiumEngine::Pause_NeedToPauseNow(IFSDK_PAUSE* param) { PDFiumEngine* engine = static_cast(param); return (base::Time::Now() - engine->last_progressive_start_time_). InMilliseconds() > engine->progressive_paint_timeout_; } ",0 "static inline int __sock_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg, size_t size) { int err = security_socket_sendmsg(sock, msg, size); return err ?: __sock_sendmsg_nosec(iocb, sock, msg, size); } ",0 "bool RenderMediaClient::IsKeySystemsUpdateNeeded() { DVLOG(2) << __func__; DCHECK(thread_checker_.CalledOnValidThread()); if (!has_updated_) { DCHECK(is_update_needed_); return true; } if (!is_update_needed_) return false; static const int kMinUpdateIntervalInMilliseconds = 1000; if ((tick_clock_->NowTicks() - last_update_time_ticks_).InMilliseconds() < kMinUpdateIntervalInMilliseconds) { return false; } return true; } ",0 "gio_poll_dispatch_add(enum qb_loop_priority p, int32_t fd, int32_t evts, void *data, qb_ipcs_dispatch_fn_t fn) { struct gio_to_qb_poll *adaptor; GIOChannel *channel; int32_t res = 0; res = qb_array_index(gio_map, fd, (void**)&adaptor); if (res < 0) { crm_err(""Array lookup failed for fd=%d: %d"", fd, res); return res; } crm_trace(""Adding fd=%d to mainloop as adapater %p"", fd, adaptor); if (adaptor->is_used) { crm_err(""Adapter for descriptor %d is still in-use"", fd); return -EEXIST; } /* channel is created with ref_count = 1 */ channel = g_io_channel_unix_new(fd); if (!channel) { crm_err(""No memory left to add fd=%d"", fd); return -ENOMEM; } /* Because unlike the poll() API, glib doesn't tell us about HUPs by default */ evts |= (G_IO_HUP|G_IO_NVAL|G_IO_ERR); adaptor->channel = channel; adaptor->fn = fn; adaptor->events = evts; adaptor->data = data; adaptor->p = p; adaptor->is_used = QB_TRUE; adaptor->source = g_io_add_watch_full(channel, G_PRIORITY_DEFAULT, evts, gio_read_socket, adaptor, gio_poll_destroy); /* Now that mainloop now holds a reference to adaptor->channel, * thanks to g_io_add_watch_full(), drop ours from g_io_channel_unix_new(). * * This means that adaptor->channel will be free'd by: * g_main_context_dispatch() * -> g_source_destroy_internal() * -> g_source_callback_unref() * shortly after gio_poll_destroy() completes */ g_io_channel_unref(adaptor->channel); crm_trace(""Added to mainloop with gsource id=%d, ref=%d"", adaptor->source, gio_adapter_refcount(adaptor)); if(adaptor->source > 0) { return 0; } return -EINVAL; } ",0 "int __init ecryptfs_init_crypto(void) { mutex_init(&key_tfm_list_mutex); INIT_LIST_HEAD(&key_tfm_list); return 0; } ",0 "static EVP_MD * php_openssl_get_evp_md_from_algo(zend_long algo) { /* {{{ */ EVP_MD *mdtype; switch (algo) { case OPENSSL_ALGO_SHA1: mdtype = (EVP_MD *) EVP_sha1(); break; case OPENSSL_ALGO_MD5: mdtype = (EVP_MD *) EVP_md5(); break; case OPENSSL_ALGO_MD4: mdtype = (EVP_MD *) EVP_md4(); break; #ifdef HAVE_OPENSSL_MD2_H case OPENSSL_ALGO_MD2: mdtype = (EVP_MD *) EVP_md2(); break; #endif #if OPENSSL_VERSION_NUMBER < 0x10100000L || defined (LIBRESSL_VERSION_NUMBER) case OPENSSL_ALGO_DSS1: mdtype = (EVP_MD *) EVP_dss1(); break; #endif #if OPENSSL_VERSION_NUMBER >= 0x0090708fL case OPENSSL_ALGO_SHA224: mdtype = (EVP_MD *) EVP_sha224(); break; case OPENSSL_ALGO_SHA256: mdtype = (EVP_MD *) EVP_sha256(); break; case OPENSSL_ALGO_SHA384: mdtype = (EVP_MD *) EVP_sha384(); break; case OPENSSL_ALGO_SHA512: mdtype = (EVP_MD *) EVP_sha512(); break; case OPENSSL_ALGO_RMD160: mdtype = (EVP_MD *) EVP_ripemd160(); break; #endif default: return NULL; break; } return mdtype; } /* }}} */ ",0 "GahpClient::condor_job_update_constrained(const char *schedd_name, const char *constraint, ClassAd *update_ad) { static const char* command = ""CONDOR_JOB_UPDATE_CONSTRAINED""; MyString ad_string; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!schedd_name) schedd_name=NULLSTRING; if (!constraint) constraint=NULLSTRING; if (!update_ad) { ad_string=NULLSTRING; } else { if ( useXMLClassads ) { ClassAdXMLUnparser unparser; unparser.SetUseCompactSpacing( true ); unparser.SetOutputType( false ); unparser.SetOutputTargetType( false ); unparser.Unparse( update_ad, ad_string ); } else { NewClassAdUnparser unparser; unparser.SetUseCompactSpacing( true ); unparser.SetOutputType( false ); unparser.SetOutputTargetType( false ); unparser.Unparse( update_ad, ad_string ); } } std::string reqline; char *esc1 = strdup( escapeGahpString(schedd_name) ); char *esc2 = strdup( escapeGahpString(constraint) ); char *esc3 = strdup( escapeGahpString(ad_string.Value()) ); int x = sprintf( reqline, ""%s %s %s"", esc1, esc2, esc3 ); free( esc1 ); free( esc2 ); free( esc3 ); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,deleg_proxy); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { if (result->argc != 3) { EXCEPT(""Bad %s Result"",command); } int rc = 1; if ( result->argv[1][0] == 'S' ) { rc = 0; } if ( strcasecmp(result->argv[2], NULLSTRING) ) { error_string = result->argv[2]; } else { error_string = """"; } delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 "void DXVAVideoDecodeAccelerator::NotifyPictureReady( const media::Picture& picture) { if (state_ != kUninitialized && client_) client_->PictureReady(picture); } ",0 "ebt_do_match(struct ebt_entry_match *m, const struct sk_buff *skb, struct xt_action_param *par) { par->match = m->u.match; par->matchinfo = m->data; return m->u.match->match(skb, par) ? EBT_MATCH : EBT_NOMATCH; } ",0 "WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info, const int argc,const char **argv,ExceptionInfo *exception) { const char *option; GeometryInfo geometry_info; ssize_t count; register ssize_t i; /* Initialize method variables. */ assert(image_info != (ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); if (argc < 0) return(MagickTrue); /* Set the image settings. */ for (i=0; i < (ssize_t) argc; i++) { option=argv[i]; if (IsCommandOption(option) == MagickFalse) continue; count=ParseCommandOption(MagickCommandOptions,MagickFalse,option); count=MagickMax(count,0L); if ((i+count) >= (ssize_t) argc) break; switch (*(option+1)) { case 'a': { if (LocaleCompare(""adjoin"",option+1) == 0) { image_info->adjoin=(*option == '-') ? MagickTrue : MagickFalse; break; } if (LocaleCompare(""antialias"",option+1) == 0) { image_info->antialias=(*option == '-') ? MagickTrue : MagickFalse; break; } if (LocaleCompare(""attenuate"",option+1) == 0) { if (*option == '+') { (void) DeleteImageOption(image_info,option+1); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""authenticate"",option+1) == 0) { if (*option == '+') (void) CloneString(&image_info->authenticate,(char *) NULL); else (void) CloneString(&image_info->authenticate,argv[i+1]); break; } break; } case 'b': { if (LocaleCompare(""background"",option+1) == 0) { if (*option == '+') { (void) DeleteImageOption(image_info,option+1); (void) QueryColorDatabase(MogrifyBackgroundColor, &image_info->background_color,exception); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); (void) QueryColorDatabase(argv[i+1],&image_info->background_color, exception); break; } if (LocaleCompare(""bias"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""0.0""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""black-point-compensation"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""false""); break; } (void) SetImageOption(image_info,option+1,""true""); break; } if (LocaleCompare(""blue-primary"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""0.0""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""bordercolor"",option+1) == 0) { if (*option == '+') { (void) DeleteImageOption(image_info,option+1); (void) QueryColorDatabase(MogrifyBorderColor, &image_info->border_color,exception); break; } (void) QueryColorDatabase(argv[i+1],&image_info->border_color, exception); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""box"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,""undercolor"",""none""); break; } (void) SetImageOption(image_info,""undercolor"",argv[i+1]); break; } break; } case 'c': { if (LocaleCompare(""cache"",option+1) == 0) { MagickSizeType limit; limit=MagickResourceInfinity; if (LocaleCompare(""unlimited"",argv[i+1]) != 0) limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+1],100.0); (void) SetMagickResourceLimit(MemoryResource,limit); (void) SetMagickResourceLimit(MapResource,2*limit); break; } if (LocaleCompare(""caption"",option+1) == 0) { if (*option == '+') { (void) DeleteImageOption(image_info,option+1); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""channel"",option+1) == 0) { if (*option == '+') { image_info->channel=DefaultChannels; break; } image_info->channel=(ChannelType) ParseChannelOption(argv[i+1]); break; } if (LocaleCompare(""colors"",option+1) == 0) { image_info->colors=StringToUnsignedLong(argv[i+1]); break; } if (LocaleCompare(""colorspace"",option+1) == 0) { if (*option == '+') { image_info->colorspace=UndefinedColorspace; (void) SetImageOption(image_info,option+1,""undefined""); break; } image_info->colorspace=(ColorspaceType) ParseCommandOption( MagickColorspaceOptions,MagickFalse,argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""comment"",option+1) == 0) { if (*option == '+') { (void) DeleteImageOption(image_info,option+1); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""compose"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""compress"",option+1) == 0) { if (*option == '+') { image_info->compression=UndefinedCompression; (void) SetImageOption(image_info,option+1,""undefined""); break; } image_info->compression=(CompressionType) ParseCommandOption( MagickCompressOptions,MagickFalse,argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'd': { if (LocaleCompare(""debug"",option+1) == 0) { if (*option == '+') (void) SetLogEventMask(""none""); else (void) SetLogEventMask(argv[i+1]); image_info->debug=IsEventLogging(); break; } if (LocaleCompare(""define"",option+1) == 0) { if (*option == '+') { if (LocaleNCompare(argv[i+1],""registry:"",9) == 0) (void) DeleteImageRegistry(argv[i+1]+9); else (void) DeleteImageOption(image_info,argv[i+1]); break; } if (LocaleNCompare(argv[i+1],""registry:"",9) == 0) { (void) DefineImageRegistry(StringRegistryType,argv[i+1]+9, exception); break; } (void) DefineImageOption(image_info,argv[i+1]); break; } if (LocaleCompare(""delay"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""0""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""density"",option+1) == 0) { /* Set image density. */ if (*option == '+') { if (image_info->density != (char *) NULL) image_info->density=DestroyString(image_info->density); (void) SetImageOption(image_info,option+1,""72""); break; } (void) CloneString(&image_info->density,argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""depth"",option+1) == 0) { if (*option == '+') { image_info->depth=MAGICKCORE_QUANTUM_DEPTH; break; } image_info->depth=StringToUnsignedLong(argv[i+1]); break; } if (LocaleCompare(""direction"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""display"",option+1) == 0) { if (*option == '+') { if (image_info->server_name != (char *) NULL) image_info->server_name=DestroyString( image_info->server_name); break; } (void) CloneString(&image_info->server_name,argv[i+1]); break; } if (LocaleCompare(""dispose"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""dither"",option+1) == 0) { if (*option == '+') { image_info->dither=MagickFalse; (void) SetImageOption(image_info,option+1,""none""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); image_info->dither=MagickTrue; break; } break; } case 'e': { if (LocaleCompare(""encoding"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""endian"",option+1) == 0) { if (*option == '+') { image_info->endian=UndefinedEndian; (void) SetImageOption(image_info,option+1,""undefined""); break; } image_info->endian=(EndianType) ParseCommandOption( MagickEndianOptions,MagickFalse,argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""extract"",option+1) == 0) { /* Set image extract geometry. */ if (*option == '+') { if (image_info->extract != (char *) NULL) image_info->extract=DestroyString(image_info->extract); break; } (void) CloneString(&image_info->extract,argv[i+1]); break; } break; } case 'f': { if (LocaleCompare(""family"",option+1) == 0) { if (*option != '+') (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""fill"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""none""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""filter"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""font"",option+1) == 0) { if (*option == '+') { if (image_info->font != (char *) NULL) image_info->font=DestroyString(image_info->font); break; } (void) CloneString(&image_info->font,argv[i+1]); break; } if (LocaleCompare(""format"",option+1) == 0) { register const char *q; for (q=strchr(argv[i+1],'%'); q != (char *) NULL; q=strchr(q+1,'%')) if (strchr(""Agkrz@[#"",*(q+1)) != (char *) NULL) image_info->ping=MagickFalse; (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""fuzz"",option+1) == 0) { if (*option == '+') { image_info->fuzz=0.0; (void) SetImageOption(image_info,option+1,""0""); break; } image_info->fuzz=StringToDoubleInterval(argv[i+1],(double) QuantumRange+1.0); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'g': { if (LocaleCompare(""gravity"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""green-primary"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""0.0""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'i': { if (LocaleCompare(""intensity"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""intent"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""interlace"",option+1) == 0) { if (*option == '+') { image_info->interlace=UndefinedInterlace; (void) SetImageOption(image_info,option+1,""undefined""); break; } image_info->interlace=(InterlaceType) ParseCommandOption( MagickInterlaceOptions,MagickFalse,argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""interline-spacing"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""interpolate"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""interword-spacing"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'k': { if (LocaleCompare(""kerning"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""undefined""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'l': { if (LocaleCompare(""label"",option+1) == 0) { if (*option == '+') { (void) DeleteImageOption(image_info,option+1); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""limit"",option+1) == 0) { MagickSizeType limit; ResourceType type; if (*option == '+') break; type=(ResourceType) ParseCommandOption(MagickResourceOptions, MagickFalse,argv[i+1]); limit=MagickResourceInfinity; if (LocaleCompare(""unlimited"",argv[i+2]) != 0) limit=(MagickSizeType) SiPrefixToDoubleInterval(argv[i+2],100.0); (void) SetMagickResourceLimit(type,limit); break; } if (LocaleCompare(""list"",option+1) == 0) { ssize_t list; /* Display configuration list. */ list=ParseCommandOption(MagickListOptions,MagickFalse,argv[i+1]); switch (list) { case MagickCoderOptions: { (void) ListCoderInfo((FILE *) NULL,exception); break; } case MagickColorOptions: { (void) ListColorInfo((FILE *) NULL,exception); break; } case MagickConfigureOptions: { (void) ListConfigureInfo((FILE *) NULL,exception); break; } case MagickDelegateOptions: { (void) ListDelegateInfo((FILE *) NULL,exception); break; } case MagickFontOptions: { (void) ListTypeInfo((FILE *) NULL,exception); break; } case MagickFormatOptions: { (void) ListMagickInfo((FILE *) NULL,exception); break; } case MagickLocaleOptions: { (void) ListLocaleInfo((FILE *) NULL,exception); break; } case MagickLogOptions: { (void) ListLogInfo((FILE *) NULL,exception); break; } case MagickMagicOptions: { (void) ListMagicInfo((FILE *) NULL,exception); break; } case MagickMimeOptions: { (void) ListMimeInfo((FILE *) NULL,exception); break; } case MagickModuleOptions: { (void) ListModuleInfo((FILE *) NULL,exception); break; } case MagickPolicyOptions: { (void) ListPolicyInfo((FILE *) NULL,exception); break; } case MagickResourceOptions: { (void) ListMagickResourceInfo((FILE *) NULL,exception); break; } case MagickThresholdOptions: { (void) ListThresholdMaps((FILE *) NULL,exception); break; } default: { (void) ListCommandOptions((FILE *) NULL,(CommandOption) list, exception); break; } } break; } if (LocaleCompare(""log"",option+1) == 0) { if (*option == '+') break; (void) SetLogFormat(argv[i+1]); break; } if (LocaleCompare(""loop"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""0""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'm': { if (LocaleCompare(""matte"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""false""); break; } (void) SetImageOption(image_info,option+1,""true""); break; } if (LocaleCompare(""mattecolor"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,argv[i+1]); (void) QueryColorDatabase(MogrifyMatteColor, &image_info->matte_color,exception); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); (void) QueryColorDatabase(argv[i+1],&image_info->matte_color, exception); break; } if (LocaleCompare(""metric"",option+1) == 0) { if (*option == '+') { (void) DeleteImageOption(image_info,option+1); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""monitor"",option+1) == 0) { (void) SetImageInfoProgressMonitor(image_info,MonitorProgress, (void *) NULL); break; } if (LocaleCompare(""monochrome"",option+1) == 0) { image_info->monochrome=(*option == '-') ? MagickTrue : MagickFalse; break; } break; } case 'o': { if (LocaleCompare(""orient"",option+1) == 0) { if (*option == '+') { image_info->orientation=UndefinedOrientation; (void) SetImageOption(image_info,option+1,""undefined""); break; } image_info->orientation=(OrientationType) ParseCommandOption( MagickOrientationOptions,MagickFalse,argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } } case 'p': { if (LocaleCompare(""page"",option+1) == 0) { char *canonical_page, page[MaxTextExtent]; const char *image_option; MagickStatusType flags; RectangleInfo geometry; if (*option == '+') { (void) DeleteImageOption(image_info,option+1); (void) CloneString(&image_info->page,(char *) NULL); break; } (void) memset(&geometry,0,sizeof(geometry)); image_option=GetImageOption(image_info,""page""); if (image_option != (const char *) NULL) (void) ParseAbsoluteGeometry(image_option,&geometry); canonical_page=GetPageGeometry(argv[i+1]); flags=ParseAbsoluteGeometry(canonical_page,&geometry); canonical_page=DestroyString(canonical_page); (void) FormatLocaleString(page,MaxTextExtent,""%lux%lu"", (unsigned long) geometry.width,(unsigned long) geometry.height); if (((flags & XValue) != 0) || ((flags & YValue) != 0)) (void) FormatLocaleString(page,MaxTextExtent,""%lux%lu%+ld%+ld"", (unsigned long) geometry.width,(unsigned long) geometry.height, (long) geometry.x,(long) geometry.y); (void) SetImageOption(image_info,option+1,page); (void) CloneString(&image_info->page,page); break; } if (LocaleCompare(""pen"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""none""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""ping"",option+1) == 0) { image_info->ping=(*option == '-') ? MagickTrue : MagickFalse; break; } if (LocaleCompare(""pointsize"",option+1) == 0) { if (*option == '+') geometry_info.rho=0.0; else (void) ParseGeometry(argv[i+1],&geometry_info); image_info->pointsize=geometry_info.rho; break; } if (LocaleCompare(""precision"",option+1) == 0) { (void) SetMagickPrecision(StringToInteger(argv[i+1])); break; } if (LocaleCompare(""preview"",option+1) == 0) { /* Preview image. */ if (*option == '+') { image_info->preview_type=UndefinedPreview; break; } image_info->preview_type=(PreviewType) ParseCommandOption( MagickPreviewOptions,MagickFalse,argv[i+1]); break; } break; } case 'q': { if (LocaleCompare(""quality"",option+1) == 0) { /* Set image compression quality. */ if (*option == '+') { image_info->quality=UndefinedCompressionQuality; (void) SetImageOption(image_info,option+1,""0""); break; } image_info->quality=StringToUnsignedLong(argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""quiet"",option+1) == 0) { static WarningHandler warning_handler = (WarningHandler) NULL; if (*option == '+') { /* Restore error or warning messages. */ warning_handler=SetWarningHandler(warning_handler); break; } /* Suppress error or warning messages. */ warning_handler=SetWarningHandler((WarningHandler) NULL); break; } break; } case 'r': { if (LocaleCompare(""red-primary"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""0.0""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 's': { if (LocaleCompare(""sampling-factor"",option+1) == 0) { /* Set image sampling factor. */ if (*option == '+') { if (image_info->sampling_factor != (char *) NULL) image_info->sampling_factor=DestroyString( image_info->sampling_factor); break; } (void) CloneString(&image_info->sampling_factor,argv[i+1]); break; } if (LocaleCompare(""scene"",option+1) == 0) { /* Set image scene. */ if (*option == '+') { image_info->scene=0; (void) SetImageOption(image_info,option+1,""0""); break; } image_info->scene=StringToUnsignedLong(argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""seed"",option+1) == 0) { unsigned long seed; if (*option == '+') { seed=(unsigned long) time((time_t *) NULL); SetRandomSecretKey(seed); break; } seed=StringToUnsignedLong(argv[i+1]); SetRandomSecretKey(seed); break; } if (LocaleCompare(""size"",option+1) == 0) { if (*option == '+') { if (image_info->size != (char *) NULL) image_info->size=DestroyString(image_info->size); break; } (void) CloneString(&image_info->size,argv[i+1]); break; } if (LocaleCompare(""stroke"",option+1) == 0) { if (*option == '+') (void) SetImageOption(image_info,option+1,""none""); else (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""strokewidth"",option+1) == 0) { if (*option == '+') (void) SetImageOption(image_info,option+1,""0""); else (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""style"",option+1) == 0) { if (*option == '+') (void) SetImageOption(image_info,option+1,""none""); else (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""synchronize"",option+1) == 0) { if (*option == '+') { image_info->synchronize=MagickFalse; break; } image_info->synchronize=MagickTrue; break; } break; } case 't': { if (LocaleCompare(""taint"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""false""); break; } (void) SetImageOption(image_info,option+1,""true""); break; } if (LocaleCompare(""texture"",option+1) == 0) { if (*option == '+') { if (image_info->texture != (char *) NULL) image_info->texture=DestroyString(image_info->texture); break; } (void) CloneString(&image_info->texture,argv[i+1]); break; } if (LocaleCompare(""tile-offset"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""0""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""transparent-color"",option+1) == 0) { if (*option == '+') { (void) QueryColorDatabase(""none"",&image_info->transparent_color, exception); (void) SetImageOption(image_info,option+1,""none""); break; } (void) QueryColorDatabase(argv[i+1],&image_info->transparent_color, exception); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""type"",option+1) == 0) { if (*option == '+') { image_info->type=UndefinedType; (void) SetImageOption(image_info,option+1,""undefined""); break; } image_info->type=(ImageType) ParseCommandOption(MagickTypeOptions, MagickFalse,argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'u': { if (LocaleCompare(""undercolor"",option+1) == 0) { if (*option == '+') { (void) DeleteImageOption(image_info,option+1); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""units"",option+1) == 0) { if (*option == '+') { image_info->units=UndefinedResolution; (void) SetImageOption(image_info,option+1,""undefined""); break; } image_info->units=(ResolutionType) ParseCommandOption( MagickResolutionOptions,MagickFalse,argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'v': { if (LocaleCompare(""verbose"",option+1) == 0) { if (*option == '+') { image_info->verbose=MagickFalse; break; } image_info->verbose=MagickTrue; image_info->ping=MagickFalse; break; } if (LocaleCompare(""view"",option+1) == 0) { if (*option == '+') { if (image_info->view != (char *) NULL) image_info->view=DestroyString(image_info->view); break; } (void) CloneString(&image_info->view,argv[i+1]); break; } if (LocaleCompare(""virtual-pixel"",option+1) == 0) { if (*option == '+') { image_info->virtual_pixel_method=UndefinedVirtualPixelMethod; (void) SetImageOption(image_info,option+1,""undefined""); break; } image_info->virtual_pixel_method=(VirtualPixelMethod) ParseCommandOption(MagickVirtualPixelOptions,MagickFalse, argv[i+1]); (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } case 'w': { if (LocaleCompare(""weight"",option+1) == 0) { if (*option == '+') (void) SetImageOption(image_info,option+1,""0""); else (void) SetImageOption(image_info,option+1,argv[i+1]); break; } if (LocaleCompare(""white-point"",option+1) == 0) { if (*option == '+') { (void) SetImageOption(image_info,option+1,""0.0""); break; } (void) SetImageOption(image_info,option+1,argv[i+1]); break; } break; } default: break; } i+=count; } return(MagickTrue); } ",0 "void UrlFetcher::Core::DoStart() { DCHECK(network_task_runner_->BelongsToCurrentThread()); request_.reset(new net::URLRequest( url_, this, request_context_getter_->GetURLRequestContext())); switch (method_) { case GET: break; case POST: DCHECK(!upload_content_.empty()); DCHECK(!upload_content_type_.empty()); request_->set_method(""POST""); request_headers_.SetHeader(net::HttpRequestHeaders::kContentType, upload_content_type_); request_->AppendBytesToUpload( upload_content_.data(), static_cast(upload_content_.length())); break; } request_->SetExtraRequestHeaders(request_headers_); request_->Start(); } ",0 "void reclaim_free(DOS_FS * fs) { int reclaimed; uint32_t i; if (verbose) printf(""Checking for unused clusters.\n""); reclaimed = 0; for (i = 2; i < fs->clusters + 2; i++) { FAT_ENTRY curEntry; get_fat(&curEntry, fs->fat, i, fs); if (!get_owner(fs, i) && curEntry.value && !FAT_IS_BAD(fs, curEntry.value)) { set_fat(fs, i, 0); reclaimed++; } } if (reclaimed) printf(""Reclaimed %d unused cluster%s (%llu bytes).\n"", (int)reclaimed, reclaimed == 1 ? """" : ""s"", (unsigned long long)reclaimed * fs->cluster_size); } ",0 "void RenderFrameImpl::OnMixedContentFound( const FrameMsg_MixedContentFound_Params& params) { blink::WebSourceLocation source_location; source_location.url = WebString::FromLatin1(params.source_location.url); source_location.line_number = params.source_location.line_number; source_location.column_number = params.source_location.column_number; auto request_context = static_cast( params.request_context_type); frame_->MixedContentFound(params.main_resource_url, params.mixed_content_url, request_context, params.was_allowed, params.had_redirect, source_location); } ",0 "bool RenderFrameHostImpl::CanCommitOrigin( const url::Origin& origin, const GURL& url) { if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDisableWebSecurity)) { return true; } if (origin.scheme() == url::kFileScheme) { WebPreferences prefs = render_view_host_->GetWebkitPreferences(); if (prefs.allow_universal_access_from_file_urls) return true; } if (origin.unique()) return true; if (url.IsStandard() && !origin.IsSamePhysicalOriginWith(url::Origin::Create(url))) return false; GURL origin_url = origin.GetPhysicalOrigin().GetURL(); return CanCommitURL(origin_url); } ",0 "X509_STORE_CTX *X509_STORE_CTX_new(void) { X509_STORE_CTX *ctx; ctx = (X509_STORE_CTX *)OPENSSL_malloc(sizeof(X509_STORE_CTX)); if (!ctx) { X509err(X509_F_X509_STORE_CTX_NEW, ERR_R_MALLOC_FAILURE); return NULL; } memset(ctx, 0, sizeof(X509_STORE_CTX)); return ctx; } ",0 "next_learn_with_delete(const struct rule_actions *actions, const struct ofpact_learn *start) { const struct ofpact *pos; for (pos = start ? ofpact_next(&start->ofpact) : actions->ofpacts; pos < ofpact_end(actions->ofpacts, actions->ofpacts_len); pos = ofpact_next(pos)) { if (pos->type == OFPACT_LEARN) { const struct ofpact_learn *learn = ofpact_get_LEARN(pos); if (learn->flags & NX_LEARN_F_DELETE_LEARNED) { return learn; } } } return NULL; } ",0 "bool OSExchangeData::HasAnyFormat( int formats, const std::set& custom_formats) const { if ((formats & STRING) != 0 && HasString()) return true; if ((formats & URL) != 0 && HasURL()) return true; #if defined(OS_WIN) if ((formats & FILE_CONTENTS) != 0 && provider_->HasFileContents()) return true; #endif #if defined(OS_WIN) || defined(USE_AURA) if ((formats & HTML) != 0 && provider_->HasHtml()) return true; #endif if ((formats & FILE_NAME) != 0 && provider_->HasFile()) return true; for (std::set::const_iterator i = custom_formats.begin(); i != custom_formats.end(); ++i) { if (HasCustomFormat(*i)) return true; } return false; } ",0 "ofport_is_internal_or_patch(const struct ofproto *p, const struct ofport *port) { return !strcmp(netdev_get_type(port->netdev), ofproto_port_open_type(p->type, ""internal"")) || !strcmp(netdev_get_type(port->netdev), ofproto_port_open_type(p->type, ""patch"")); } ",0 "static int einj_get_available_error_type(u32 *type) { int rc; mutex_lock(&einj_mutex); rc = __einj_get_available_error_type(type); mutex_unlock(&einj_mutex); return rc; } ",0 "void ChromeContentBrowserClient::OnTrustAnchorUsed( const std::string& username_hash) { policy::PolicyCertServiceFactory::SetUsedPolicyCertificates(username_hash); } ",0 " void AddRegistryKeyWatcher(const wchar_t* key_path) { DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); auto reg_key = std::make_unique(HKEY_CURRENT_USER, key_path, KEY_NOTIFY); if (reg_key->Valid() && reg_key->StartWatching( base::Bind(&OpenSystemSettingsHelper::OnRegistryKeyChanged, weak_ptr_factory_.GetWeakPtr()))) { registry_key_watchers_.push_back(std::move(reg_key)); } } ",0 "void ExternalProtocolHandler::RecordHandleStateMetrics(bool checkbox_selected, BlockState block_state) { HandleState handle_state = DONT_LAUNCH; switch (block_state) { case DONT_BLOCK: handle_state = checkbox_selected ? CHECKED_LAUNCH : LAUNCH; break; case BLOCK: handle_state = checkbox_selected ? CHECKED_DONT_LAUNCH_DEPRECATED : DONT_LAUNCH; break; case UNKNOWN: NOTREACHED(); return; } DCHECK_NE(CHECKED_DONT_LAUNCH_DEPRECATED, handle_state); UMA_HISTOGRAM_ENUMERATION(kHandleStateMetric, handle_state, HANDLE_STATE_LAST); } ",0 "zip_time(const char *p) { int msTime, msDate; struct tm ts; msTime = (0xff & (unsigned)p[0]) + 256 * (0xff & (unsigned)p[1]); msDate = (0xff & (unsigned)p[2]) + 256 * (0xff & (unsigned)p[3]); memset(&ts, 0, sizeof(ts)); ts.tm_year = ((msDate >> 9) & 0x7f) + 80; /* Years since 1900. */ ts.tm_mon = ((msDate >> 5) & 0x0f) - 1; /* Month number. */ ts.tm_mday = msDate & 0x1f; /* Day of month. */ ts.tm_hour = (msTime >> 11) & 0x1f; ts.tm_min = (msTime >> 5) & 0x3f; ts.tm_sec = (msTime << 1) & 0x3e; ts.tm_isdst = -1; return mktime(&ts); } ",0 "static v8::Handle idAttrGetter(v8::Local name, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.id._get""); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Integer::New(imp->id()); } ",0 "void DiceTurnSyncOnHelper::SyncStartupFailed() { DCHECK(sync_startup_tracker_); sync_startup_tracker_.reset(); ShowSyncConfirmationUI(); } ",0 "static size_t mptsas_config_pack(uint8_t **data, const char *fmt, ...) { va_list ap; size_t ret; va_start(ap, fmt); ret = vpack(data, fmt, ap); va_end(ap); if (data) { assert(ret / 4 < 256 && (ret % 4) == 0); stb_p(*data + 1, ret / 4); } return ret; } ",0 "int print_filename(char *pathname, struct inode *inode) { char str[11], dummy[12], dummy2[12]; /* overflow safe */ char *userstr, *groupstr; int padchars; struct passwd *user; struct group *group; struct tm *t; if(short_ls) { printf(""%s\n"", pathname); return 1; } user = getpwuid(inode->uid); if(user == NULL) { int res = snprintf(dummy, 12, ""%d"", inode->uid); if(res < 0) EXIT_UNSQUASH(""snprintf failed in print_filename()\n""); else if(res >= 12) /* unsigned int shouldn't ever need more than 11 bytes * (including terminating '\0') to print in base 10 */ userstr = ""*""; else userstr = dummy; } else userstr = user->pw_name; group = getgrgid(inode->gid); if(group == NULL) { int res = snprintf(dummy2, 12, ""%d"", inode->gid); if(res < 0) EXIT_UNSQUASH(""snprintf failed in print_filename()\n""); else if(res >= 12) /* unsigned int shouldn't ever need more than 11 bytes * (including terminating '\0') to print in base 10 */ groupstr = ""*""; else groupstr = dummy2; } else groupstr = group->gr_name; printf(""%s %s/%s "", modestr(str, inode->mode), userstr, groupstr); switch(inode->mode & S_IFMT) { case S_IFREG: case S_IFDIR: case S_IFSOCK: case S_IFIFO: case S_IFLNK: padchars = TOTALCHARS - strlen(userstr) - strlen(groupstr); printf(""%*lld "", padchars > 0 ? padchars : 0, inode->data); break; case S_IFCHR: case S_IFBLK: padchars = TOTALCHARS - strlen(userstr) - strlen(groupstr) - 7; printf(""%*s%3d,%3d "", padchars > 0 ? padchars : 0, "" "", (int) inode->data >> 8, (int) inode->data & 0xff); break; } t = localtime(&inode->time); printf(""%d-%02d-%02d %02d:%02d %s"", t->tm_year + 1900, t->tm_mon + 1, t->tm_mday, t->tm_hour, t->tm_min, pathname); if((inode->mode & S_IFMT) == S_IFLNK) printf("" -> %s"", inode->symlink); printf(""\n""); return 1; } ",0 "static int coolkey_read_object(sc_card_t *card, unsigned long object_id, size_t offset, u8 *out_buf, size_t out_len, u8 *nonce, size_t nonce_size) { coolkey_read_object_param_t params; u8 *out_ptr; size_t left = 0; size_t len; int r; ulong2bebytes(¶ms.object_id[0], object_id); out_ptr = out_buf; left = out_len; do { ulong2bebytes(¶ms.offset[0], offset); params.length = MIN(left, COOLKEY_MAX_CHUNK_SIZE); len = left+2; r = coolkey_apdu_io(card, COOLKEY_CLASS, COOLKEY_INS_READ_OBJECT, 0, 0, (u8 *)¶ms, sizeof(params), &out_ptr, &len, nonce, nonce_size); if (r < 0) { goto fail; } /* sanity check to make sure we don't overflow left */ if ((left < len) || (len == 0)) { r = SC_ERROR_INTERNAL; goto fail; } out_ptr += len; offset += len; left -= len; } while (left != 0); return out_len; fail: return r; } ",0 "static inline int compute_score(struct sock *sk, struct net *net, __be32 saddr, unsigned short hnum, __be16 sport, __be32 daddr, __be16 dport, int dif) { int score = -1; if (net_eq(sock_net(sk), net) && udp_sk(sk)->udp_port_hash == hnum && !ipv6_only_sock(sk)) { struct inet_sock *inet = inet_sk(sk); score = (sk->sk_family == PF_INET ? 2 : 1); if (inet->inet_rcv_saddr) { if (inet->inet_rcv_saddr != daddr) return -1; score += 4; } if (inet->inet_daddr) { if (inet->inet_daddr != saddr) return -1; score += 4; } if (inet->inet_dport) { if (inet->inet_dport != sport) return -1; score += 4; } if (sk->sk_bound_dev_if) { if (sk->sk_bound_dev_if != dif) return -1; score += 4; } } return score; } ",0 "void HTMLLinkElement::StartLoadingDynamicSheet() { DCHECK(GetLinkStyle()); GetLinkStyle()->StartLoadingDynamicSheet(); } ",0 "static inline int __dev_xmit_skb(struct sk_buff *skb, struct Qdisc *q, struct net_device *dev, struct netdev_queue *txq) { spinlock_t *root_lock = qdisc_lock(q); bool contended = qdisc_is_running(q); int rc; /* * Heuristic to force contended enqueues to serialize on a * separate lock before trying to get qdisc main lock. * This permits __QDISC_STATE_RUNNING owner to get the lock more often * and dequeue packets faster. */ if (unlikely(contended)) spin_lock(&q->busylock); spin_lock(root_lock); if (unlikely(test_bit(__QDISC_STATE_DEACTIVATED, &q->state))) { kfree_skb(skb); rc = NET_XMIT_DROP; } else if ((q->flags & TCQ_F_CAN_BYPASS) && !qdisc_qlen(q) && qdisc_run_begin(q)) { /* * This is a work-conserving queue; there are no old skbs * waiting to be sent out; and the qdisc is not running - * xmit the skb directly. */ if (!(dev->priv_flags & IFF_XMIT_DST_RELEASE)) skb_dst_force(skb); qdisc_skb_cb(skb)->pkt_len = skb->len; qdisc_bstats_update(q, skb); if (sch_direct_xmit(skb, q, dev, txq, root_lock)) { if (unlikely(contended)) { spin_unlock(&q->busylock); contended = false; } __qdisc_run(q); } else qdisc_run_end(q); rc = NET_XMIT_SUCCESS; } else { skb_dst_force(skb); rc = qdisc_enqueue_root(skb, q); if (qdisc_run_begin(q)) { if (unlikely(contended)) { spin_unlock(&q->busylock); contended = false; } __qdisc_run(q); } } spin_unlock(root_lock); if (unlikely(contended)) spin_unlock(&q->busylock); return rc; } ",0 "void CL_DemoCompleted( void ) { char buffer[ MAX_STRING_CHARS ]; if( cl_timedemo && cl_timedemo->integer ) { int time; time = Sys_Milliseconds() - clc.timeDemoStart; if( time > 0 ) { Com_sprintf( buffer, sizeof( buffer ), ""%i frames %3.1f seconds %3.1f fps %d.0/%.1f/%d.0/%.1f ms\n"", clc.timeDemoFrames, time/1000.0, clc.timeDemoFrames*1000.0 / time, clc.timeDemoMinDuration, time / (float)clc.timeDemoFrames, clc.timeDemoMaxDuration, CL_DemoFrameDurationSDev( ) ); Com_Printf( ""%s"", buffer ); if( cl_timedemoLog && strlen( cl_timedemoLog->string ) > 0 ) { int i; int numFrames; fileHandle_t f; if( ( clc.timeDemoFrames - 1 ) > MAX_TIMEDEMO_DURATIONS ) numFrames = MAX_TIMEDEMO_DURATIONS; else numFrames = clc.timeDemoFrames - 1; f = FS_FOpenFileWrite( cl_timedemoLog->string ); if( f ) { FS_Printf( f, ""# %s"", buffer ); for( i = 0; i < numFrames; i++ ) FS_Printf( f, ""%d\n"", clc.timeDemoDurations[ i ] ); FS_FCloseFile( f ); Com_Printf( ""%s written\n"", cl_timedemoLog->string ); } else { Com_Printf( ""Couldn't open %s for writing\n"", cl_timedemoLog->string ); } } } } CL_Disconnect( qtrue ); CL_NextDemo(); } ",0 "SPL_METHOD(SplFileObject, fputcsv) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape; char *delim = NULL, *enclo = NULL, *esc = NULL; int d_len = 0, e_len = 0, esc_len = 0, ret; zval *fields = NULL; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""a|sss"", &fields, &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { case 4: if (esc_len != 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""escape must be a character""); RETURN_FALSE; } escape = esc[0]; /* no break */ case 3: if (e_len != 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""enclosure must be a character""); RETURN_FALSE; } enclosure = enclo[0]; /* no break */ case 2: if (d_len != 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""delimiter must be a character""); RETURN_FALSE; } delimiter = delim[0]; /* no break */ case 1: case 0: break; } ret = php_fputcsv(intern->u.file.stream, fields, delimiter, enclosure, escape TSRMLS_CC); RETURN_LONG(ret); } } ",1 "void WebContentsImpl::DidCancelLoading() { controller_.DiscardNonCommittedEntries(); NotifyNavigationStateChanged(INVALIDATE_TYPE_URL); } ",0 "static void *receive_thread (void __attribute__((unused)) *arg) { return (network_receive () ? (void *) 1 : (void *) 0); } /* void *receive_thread */ ",0 "MagickExport void DestroyImagePixels(Image *image) { CacheInfo *magick_restrict cache_info; assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickCoreSignature); if (cache_info->methods.destroy_pixel_handler != (DestroyPixelHandler) NULL) { cache_info->methods.destroy_pixel_handler(image); return; } image->cache=DestroyPixelCache(image->cache); } ",0 "static void jas_icctxt_destroy(jas_iccattrval_t *attrval) { jas_icctxt_t *txt = &attrval->data.txt; if (txt->string) { jas_free(txt->string); txt->string = 0; } } ",0 "static struct segment *current_segment(struct playlist *pls) { return pls->segments[pls->cur_seq_no - pls->start_seq_no]; } ",0 "int TabStrip::UpdateIdealBoundsForPinnedTabs(int* first_non_pinned_index) { layout_helper_->UpdateIdealBoundsForPinnedTabs(&tabs_); if (first_non_pinned_index) *first_non_pinned_index = layout_helper_->first_non_pinned_tab_index(); return layout_helper_->first_non_pinned_tab_x(); } ",0 "String8 String8::getBasePath(void) const { char* ext; const char* const str = mString; ext = find_extension(); if (ext == NULL) return String8(*this); else return String8(str, ext - str); } ",0 "void BindDiscardableMemoryRequestOnIO( discardable_memory::mojom::DiscardableSharedMemoryManagerRequest request, discardable_memory::DiscardableSharedMemoryManager* manager) { DCHECK_CURRENTLY_ON(BrowserThread::IO); service_manager::BindSourceInfo source_info; manager->Bind(std::move(request), source_info); } ",0 "static struct sadb_msg *pfkey_get_base_msg(struct sk_buff *skb, int *errp) { struct sadb_msg *hdr = NULL; if (skb->len < sizeof(*hdr)) { *errp = -EMSGSIZE; } else { hdr = (struct sadb_msg *) skb->data; if (hdr->sadb_msg_version != PF_KEY_V2 || hdr->sadb_msg_reserved != 0 || (hdr->sadb_msg_type <= SADB_RESERVED || hdr->sadb_msg_type > SADB_MAX)) { hdr = NULL; *errp = -EINVAL; } else if (hdr->sadb_msg_len != (skb->len / sizeof(uint64_t)) || hdr->sadb_msg_len < (sizeof(struct sadb_msg) / sizeof(uint64_t))) { hdr = NULL; *errp = -EMSGSIZE; } else { *errp = 0; } } return hdr; } ",0 "static struct perf_callchain_entry *get_callchain_entry(int *rctx) { int cpu; struct callchain_cpus_entries *entries; *rctx = get_recursion_context(__get_cpu_var(callchain_recursion)); if (*rctx == -1) return NULL; entries = rcu_dereference(callchain_cpus_entries); if (!entries) return NULL; cpu = smp_processor_id(); return &entries->cpu_entries[cpu][*rctx]; } ",0 "static int mpeg4_decode_gop_header(MpegEncContext *s, GetBitContext *gb) { int hours, minutes, seconds; if (!show_bits(gb, 23)) { av_log(s->avctx, AV_LOG_WARNING, ""GOP header invalid\n""); return AVERROR_INVALIDDATA; } hours = get_bits(gb, 5); minutes = get_bits(gb, 6); check_marker(s->avctx, gb, ""in gop_header""); seconds = get_bits(gb, 6); s->time_base = seconds + 60*(minutes + 60*hours); skip_bits1(gb); skip_bits1(gb); return 0; } ",0 "void ShellSurface::OnSurfaceDestroying(Surface* surface) { if (resizer_) EndDrag(false /* revert */); if (widget_) SetMainSurface(widget_->GetNativeWindow(), nullptr); surface->RemoveSurfaceObserver(this); surface_ = nullptr; if (widget_) widget_->Hide(); if (!surface_destroyed_callback_.is_null()) surface_destroyed_callback_.Run(); } ",0 "void UnloadController::TabInsertedAt(content::WebContents* contents, int index, bool foreground) { TabAttachedImpl(contents); } ",0 "void Browser::OpenBookmarkManagerAddNodeIn(int64 node_id) { OpenBookmarkManagerWithHash(""a="", node_id); } ",0 "static String valueToDateTimeString(double value, AtomicString type) { DateComponents components; if (type == InputTypeNames::date) components.setMillisecondsSinceEpochForDate(value); else if (type == InputTypeNames::datetime_local) components.setMillisecondsSinceEpochForDateTimeLocal(value); else if (type == InputTypeNames::month) components.setMonthsSinceEpoch(value); else if (type == InputTypeNames::time) components.setMillisecondsSinceMidnight(value); else if (type == InputTypeNames::week) components.setMillisecondsSinceEpochForWeek(value); else ASSERT_NOT_REACHED(); return components.type() == DateComponents::Invalid ? String() : components.toString(); } ",0 "ResourceCoordinatorService::~ResourceCoordinatorService() { ref_factory_.reset(); } ",0 "void copy_user_huge_page(struct page *dst, struct page *src, unsigned long addr, struct vm_area_struct *vma, unsigned int pages_per_huge_page) { int i; if (unlikely(pages_per_huge_page > MAX_ORDER_NR_PAGES)) { copy_user_gigantic_page(dst, src, addr, vma, pages_per_huge_page); return; } might_sleep(); for (i = 0; i < pages_per_huge_page; i++) { cond_resched(); copy_user_highpage(dst + i, src + i, addr + i*PAGE_SIZE, vma); } } ",0 "static bool blk_pm_allow_request(struct request *rq) { switch (rq->q->rpm_status) { case RPM_RESUMING: case RPM_SUSPENDING: return rq->rq_flags & RQF_PM; case RPM_SUSPENDED: return false; default: return true; } } ",0 " TestingProfile* GetProfile() { return profile_.get(); } ",0 "void FrameView::setVisibleContentScaleFactor(float visibleContentScaleFactor) { if (m_visibleContentScaleFactor == visibleContentScaleFactor) return; m_visibleContentScaleFactor = visibleContentScaleFactor; updateScrollbars(scrollOffset()); } ",0 "void red_channel_receive(RedChannel *channel) { RingItem *link; RingItem *next; RedChannelClient *rcc; RING_FOREACH_SAFE(link, next, &channel->clients) { rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link); red_channel_client_receive(rcc); } } ",0 "void RenderViewImpl::frameDetached(WebFrame* frame) { if (is_loading_) { pending_frame_tree_update_ = true; FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); return; } if (!updating_frame_tree_) SendUpdatedFrameTree(frame); FOR_EACH_OBSERVER(RenderViewObserver, observers_, FrameDetached(frame)); } ",0 "static HashTable *date_object_get_gc_timezone(zval *object, zval ***table, int *n TSRMLS_DC) { *table = NULL; *n = 0; return zend_std_get_properties(object TSRMLS_CC); } ",0 "bool RenderProcessHostImpl::HasConnection() const { return channel_.get() != NULL; } ",0 "filter_datapoints(peer_t *p) { int i, idx; double sum, wavg; datapoint_t *fdp; #if 0 /* Simulations have shown that use of *averaged* offset for p->filter_offset * is in fact worse than simply using last received one: with large poll intervals * (>= 2048) averaging code uses offset values which are outdated by hours, * and time/frequency correction goes totally wrong when fed essentially bogus offsets. */ int got_newest; double minoff, maxoff, w; double x = x; /* for compiler */ double oldest_off = oldest_off; double oldest_age = oldest_age; double newest_off = newest_off; double newest_age = newest_age; fdp = p->filter_datapoint; minoff = maxoff = fdp[0].d_offset; for (i = 1; i < NUM_DATAPOINTS; i++) { if (minoff > fdp[i].d_offset) minoff = fdp[i].d_offset; if (maxoff < fdp[i].d_offset) maxoff = fdp[i].d_offset; } idx = p->datapoint_idx; /* most recent datapoint's index */ /* Average offset: * Drop two outliers and take weighted average of the rest: * most_recent/2 + older1/4 + older2/8 ... + older5/32 + older6/32 * we use older6/32, not older6/64 since sum of weights should be 1: * 1/2 + 1/4 + 1/8 + 1/16 + 1/32 + 1/32 = 1 */ wavg = 0; w = 0.5; /* n-1 * --- dispersion(i) * filter_dispersion = \ ------------- * / (i+1) * --- 2 * i=0 */ got_newest = 0; sum = 0; for (i = 0; i < NUM_DATAPOINTS; i++) { VERB5 { bb_error_msg(""datapoint[%d]: off:%f disp:%f(%f) age:%f%s"", i, fdp[idx].d_offset, fdp[idx].d_dispersion, dispersion(&fdp[idx]), G.cur_time - fdp[idx].d_recv_time, (minoff == fdp[idx].d_offset || maxoff == fdp[idx].d_offset) ? "" (outlier by offset)"" : """" ); } sum += dispersion(&fdp[idx]) / (2 << i); if (minoff == fdp[idx].d_offset) { minoff -= 1; /* so that we don't match it ever again */ } else if (maxoff == fdp[idx].d_offset) { maxoff += 1; } else { oldest_off = fdp[idx].d_offset; oldest_age = G.cur_time - fdp[idx].d_recv_time; if (!got_newest) { got_newest = 1; newest_off = oldest_off; newest_age = oldest_age; } x = oldest_off * w; wavg += x; w /= 2; } idx = (idx - 1) & (NUM_DATAPOINTS - 1); } p->filter_dispersion = sum; wavg += x; /* add another older6/64 to form older6/32 */ /* Fix systematic underestimation with large poll intervals. * Imagine that we still have a bit of uncorrected drift, * and poll interval is big (say, 100 sec). Offsets form a progression: * 0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 - 0.7 is most recent. * The algorithm above drops 0.0 and 0.7 as outliers, * and then we have this estimation, ~25% off from 0.7: * 0.1/32 + 0.2/32 + 0.3/16 + 0.4/8 + 0.5/4 + 0.6/2 = 0.503125 */ x = oldest_age - newest_age; if (x != 0) { x = newest_age / x; /* in above example, 100 / (600 - 100) */ if (x < 1) { /* paranoia check */ x = (newest_off - oldest_off) * x; /* 0.5 * 100/500 = 0.1 */ wavg += x; } } p->filter_offset = wavg; #else fdp = p->filter_datapoint; idx = p->datapoint_idx; /* most recent datapoint's index */ /* filter_offset: simply use the most recent value */ p->filter_offset = fdp[idx].d_offset; /* n-1 * --- dispersion(i) * filter_dispersion = \ ------------- * / (i+1) * --- 2 * i=0 */ wavg = 0; sum = 0; for (i = 0; i < NUM_DATAPOINTS; i++) { sum += dispersion(&fdp[idx]) / (2 << i); wavg += fdp[idx].d_offset; idx = (idx - 1) & (NUM_DATAPOINTS - 1); } wavg /= NUM_DATAPOINTS; p->filter_dispersion = sum; #endif /* +----- -----+ ^ 1/2 * | n-1 | * | --- | * | 1 \ 2 | * filter_jitter = | --- * / (avg-offset_j) | * | n --- | * | j=0 | * +----- -----+ * where n is the number of valid datapoints in the filter (n > 1); * if filter_jitter < precision then filter_jitter = precision */ sum = 0; for (i = 0; i < NUM_DATAPOINTS; i++) { sum += SQUARE(wavg - fdp[i].d_offset); } sum = SQRT(sum / NUM_DATAPOINTS); p->filter_jitter = sum > G_precision_sec ? sum : G_precision_sec; VERB4 bb_error_msg(""filter offset:%+f disp:%f jitter:%f"", p->filter_offset, p->filter_dispersion, p->filter_jitter); } ",0 "void RenderViewImpl::numberOfWheelEventHandlersChanged(unsigned num_handlers) { Send(new ViewHostMsg_DidChangeNumWheelEvents(routing_id_, num_handlers)); } ",0 "ftrace_allocate_pages(unsigned long num_to_init) { struct ftrace_page *start_pg; struct ftrace_page *pg; int order; int cnt; if (!num_to_init) return 0; start_pg = pg = kzalloc(sizeof(*pg), GFP_KERNEL); if (!pg) return NULL; /* * Try to allocate as much as possible in one continues * location that fills in all of the space. We want to * waste as little space as possible. */ for (;;) { cnt = ftrace_allocate_records(pg, num_to_init); if (cnt < 0) goto free_pages; num_to_init -= cnt; if (!num_to_init) break; pg->next = kzalloc(sizeof(*pg), GFP_KERNEL); if (!pg->next) goto free_pages; pg = pg->next; } return start_pg; free_pages: while (start_pg) { order = get_count_order(pg->size / ENTRIES_PER_PAGE); free_pages((unsigned long)pg->records, order); start_pg = pg->next; kfree(pg); pg = start_pg; } pr_info(""ftrace: FAILED to allocate memory for functions\n""); return NULL; } ",0 "static int has_svm(void) { const char *msg; if (!cpu_has_svm(&msg)) { printk(KERN_INFO ""has_svm: %s\n"", msg); return 0; } return 1; } ",0 "static inline struct sock *udp_v4_mcast_next(struct net *net, struct sock *sk, __be16 loc_port, __be32 loc_addr, __be16 rmt_port, __be32 rmt_addr, int dif) { struct hlist_nulls_node *node; struct sock *s = sk; unsigned short hnum = ntohs(loc_port); sk_nulls_for_each_from(s, node) { if (__udp_is_mcast_sock(net, s, loc_port, loc_addr, rmt_port, rmt_addr, dif, hnum)) goto found; } s = NULL; found: return s; } ",0 "static void WillDispatchTabCreatedEvent(WebContents* contents, bool active, Profile* profile, const Extension* extension, ListValue* event_args) { DictionaryValue* tab_value = ExtensionTabUtil::CreateTabValue( contents, extension); event_args->Clear(); event_args->Append(tab_value); tab_value->SetBoolean(tab_keys::kSelectedKey, active); } ",0 " ExecuteSelectParams(Type type, const std::wstring& title, const FilePath& default_path, const FileTypeInfo* file_types, int file_type_index, const std::wstring& default_extension, RunState run_state, HWND owner, void* params) : type(type), title(title), default_path(default_path), file_type_index(file_type_index), default_extension(default_extension), run_state(run_state), owner(owner), params(params) { if (file_types) { this->file_types = *file_types; } else { this->file_types.include_all_files = true; } } ",0 "status_t MyOggExtractor::seekToTime(int64_t timeUs) { timeUs -= mSeekPreRollUs; if (timeUs < 0) { timeUs = 0; } if (mTableOfContents.isEmpty()) { uint64_t bps = approxBitrate(); if (bps <= 0) { return INVALID_OPERATION; } off64_t pos = timeUs * bps / 8000000ll; ALOGV(""seeking to offset %lld"", (long long)pos); return seekToOffset(pos); } size_t left = 0; size_t right_plus_one = mTableOfContents.size(); while (left < right_plus_one) { size_t center = left + (right_plus_one - left) / 2; const TOCEntry &entry = mTableOfContents.itemAt(center); if (timeUs < entry.mTimeUs) { right_plus_one = center; } else if (timeUs > entry.mTimeUs) { left = center + 1; } else { left = center; break; } } if (left == mTableOfContents.size()) { --left; } const TOCEntry &entry = mTableOfContents.itemAt(left); ALOGV(""seeking to entry %zu / %zu at offset %lld"", left, mTableOfContents.size(), (long long)entry.mPageOffset); return seekToOffset(entry.mPageOffset); } ",0 "static int vop_virtio_copy_to_user(struct vop_vdev *vdev, void __user *ubuf, size_t len, u64 daddr, size_t dlen, int vr_idx) { struct vop_device *vpdev = vdev->vpdev; void __iomem *dbuf = vpdev->hw_ops->ioremap(vpdev, daddr, len); struct vop_vringh *vvr = &vdev->vvr[vr_idx]; struct vop_info *vi = dev_get_drvdata(&vpdev->dev); size_t dma_alignment = 1 << vi->dma_ch->device->copy_align; bool x200 = is_dma_copy_aligned(vi->dma_ch->device, 1, 1, 1); size_t dma_offset, partlen; int err; if (!VOP_USE_DMA) { if (copy_to_user(ubuf, (void __force *)dbuf, len)) { err = -EFAULT; dev_err(vop_dev(vdev), ""%s %d err %d\n"", __func__, __LINE__, err); goto err; } vdev->in_bytes += len; err = 0; goto err; } dma_offset = daddr - round_down(daddr, dma_alignment); daddr -= dma_offset; len += dma_offset; /* * X100 uses DMA addresses as seen by the card so adding * the aperture base is not required for DMA. However x200 * requires DMA addresses to be an offset into the bar so * add the aperture base for x200. */ if (x200) daddr += vpdev->aper->pa; while (len) { partlen = min_t(size_t, len, VOP_INT_DMA_BUF_SIZE); err = vop_sync_dma(vdev, vvr->buf_da, daddr, ALIGN(partlen, dma_alignment)); if (err) { dev_err(vop_dev(vdev), ""%s %d err %d\n"", __func__, __LINE__, err); goto err; } if (copy_to_user(ubuf, vvr->buf + dma_offset, partlen - dma_offset)) { err = -EFAULT; dev_err(vop_dev(vdev), ""%s %d err %d\n"", __func__, __LINE__, err); goto err; } daddr += partlen; ubuf += partlen; dbuf += partlen; vdev->in_bytes_dma += partlen; vdev->in_bytes += partlen; len -= partlen; dma_offset = 0; } err = 0; err: vpdev->hw_ops->iounmap(vpdev, dbuf); dev_dbg(vop_dev(vdev), ""%s: ubuf %p dbuf %p len 0x%lx vr_idx 0x%x\n"", __func__, ubuf, dbuf, len, vr_idx); return err; } ",0 "void Resource::SetRevalidatingRequest(const ResourceRequest& request) { SECURITY_CHECK(redirect_chain_.IsEmpty()); SECURITY_CHECK(!is_unused_preload_); DCHECK(!request.IsNull()); CHECK(!is_revalidation_start_forbidden_); is_revalidating_ = true; resource_request_ = request; status_ = ResourceStatus::kNotStarted; } ",0 "void BrowserMainLoop::EndStartupTracing() { DCHECK(is_tracing_startup_for_duration_); is_tracing_startup_for_duration_ = false; TracingController::GetInstance()->StopTracing( TracingController::CreateFileEndpoint( startup_trace_file_, base::Bind(OnStoppedStartupTracing, startup_trace_file_))); } ",0 "dump_hash (char *buf, const unsigned char *hash) { int i; for (i = 0; i < MD5_DIGEST_SIZE; i++, hash++) { *buf++ = XNUM_TO_digit (*hash >> 4); *buf++ = XNUM_TO_digit (*hash & 0xf); } *buf = '\0'; } ",0 "xfs_rw_iunlock( struct xfs_inode *ip, int type) { xfs_iunlock(ip, type); if (type & XFS_IOLOCK_EXCL) mutex_unlock(&VFS_I(ip)->i_mutex); } ",0 "void TestController::didReceiveMessageFromInjectedBundle(WKStringRef messageName, WKTypeRef messageBody) { #if PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) if (WKStringIsEqualToUTF8CString(messageName, ""EventSender"")) { ASSERT(WKGetTypeID(messageBody) == WKDictionaryGetTypeID()); WKDictionaryRef messageBodyDictionary = static_cast(messageBody); WKRetainPtr subMessageKey(AdoptWK, WKStringCreateWithUTF8CString(""SubMessage"")); WKStringRef subMessageName = static_cast(WKDictionaryGetItemForKey(messageBodyDictionary, subMessageKey.get())); if (WKStringIsEqualToUTF8CString(subMessageName, ""MouseDown"") || WKStringIsEqualToUTF8CString(subMessageName, ""MouseUp"")) { WKRetainPtr buttonKey = adoptWK(WKStringCreateWithUTF8CString(""Button"")); unsigned button = static_cast(WKUInt64GetValue(static_cast(WKDictionaryGetItemForKey(messageBodyDictionary, buttonKey.get())))); WKRetainPtr modifiersKey = adoptWK(WKStringCreateWithUTF8CString(""Modifiers"")); WKEventModifiers modifiers = static_cast(WKUInt64GetValue(static_cast(WKDictionaryGetItemForKey(messageBodyDictionary, modifiersKey.get())))); WKPageSetShouldSendEventsSynchronously(mainWebView()->page(), false); if (WKStringIsEqualToUTF8CString(subMessageName, ""MouseDown"")) m_eventSenderProxy->mouseDown(button, modifiers); else m_eventSenderProxy->mouseUp(button, modifiers); return; } if (WKStringIsEqualToUTF8CString(subMessageName, ""KeyDown"")) { didReceiveKeyDownMessageFromInjectedBundle(messageBodyDictionary, false); return; } ASSERT_NOT_REACHED(); } #endif if (!m_currentInvocation) return; m_currentInvocation->didReceiveMessageFromInjectedBundle(messageName, messageBody); } ",0 "void OMXCodec::setG711Format(int32_t sampleRate, int32_t numChannels) { CHECK(!mIsEncoder); setRawAudioFormat(kPortIndexInput, sampleRate, numChannels); } ",0 "png_set_compression_window_bits(png_structp png_ptr, int window_bits) { if (png_ptr == NULL) return; if (window_bits > 15) png_warning(png_ptr, ""Only compression windows <= 32k supported by PNG""); else if (window_bits < 8) png_warning(png_ptr, ""Only compression windows >= 256 supported by PNG""); #ifndef WBITS_8_OK /* Avoid libpng bug with 256-byte windows */ if (window_bits == 8) { png_warning(png_ptr, ""Compression window is being reset to 512""); window_bits = 9; } #endif png_ptr->flags |= PNG_FLAG_ZLIB_CUSTOM_WINDOW_BITS; png_ptr->zlib_window_bits = window_bits; } ",0 "routes_are_duplicate (const NMPlatformIP4Route *a, const NMPlatformIP4Route *b, gboolean consider_gateway_and_metric) { return a->network == b->network && a->plen == b->plen && (!consider_gateway_and_metric || (a->gateway == b->gateway && a->metric == b->metric)); } ",0 "int kvm_read_nested_guest_page(struct kvm_vcpu *vcpu, gfn_t gfn, void *data, int offset, int len, u32 access) { return kvm_read_guest_page_mmu(vcpu, vcpu->arch.walk_mmu, gfn, data, offset, len, access); } ",0 "static bool is_pointer_value(struct bpf_verifier_env *env, int regno) { return __is_pointer_value(env->allow_ptr_leaks, cur_regs(env) + regno); } ",0 "static int kvm_vcpu_ioctl_x86_set_xsave(struct kvm_vcpu *vcpu, struct kvm_xsave *guest_xsave) { u64 xstate_bv = *(u64 *)&guest_xsave->region[XSAVE_HDR_OFFSET / sizeof(u32)]; if (cpu_has_xsave) { /* * Here we allow setting states that are not present in * CPUID leaf 0xD, index 0, EDX:EAX. This is for compatibility * with old userspace. */ if (xstate_bv & ~kvm_supported_xcr0()) return -EINVAL; memcpy(&vcpu->arch.guest_fpu.state->xsave, guest_xsave->region, vcpu->arch.guest_xstate_size); } else { if (xstate_bv & ~XSTATE_FPSSE) return -EINVAL; memcpy(&vcpu->arch.guest_fpu.state->fxsave, guest_xsave->region, sizeof(struct i387_fxsave_struct)); } return 0; } ",0 "gst_asf_demux_find_stream_with_complete_payload (GstASFDemux * demux) { AsfPayload *best_payload = NULL; AsfStream *best_stream = NULL; guint i; for (i = 0; i < demux->num_streams; ++i) { AsfStream *stream; int j; stream = &demux->stream[i]; /* Don't push any data until we have at least one payload that falls within * the current segment. This way we can remove out-of-segment payloads that * don't need to be decoded after a seek, sending only data from the * keyframe directly before our segment start */ if (stream->payloads->len > 0) { AsfPayload *payload = NULL; gint last_idx; if (GST_ASF_DEMUX_IS_REVERSE_PLAYBACK (demux->segment)) { /* Reverse playback */ if (stream->is_video) { /* We have to push payloads from KF to the first frame we accumulated (reverse order) */ if (stream->reverse_kf_ready) { payload = &g_array_index (stream->payloads, AsfPayload, stream->kf_pos); if (G_UNLIKELY (!GST_CLOCK_TIME_IS_VALID (payload->ts))) { /* TODO : remove payload from the list? */ continue; } } else { continue; } } else { /* find first complete payload with timestamp */ for (j = stream->payloads->len - 1; j >= 0 && (payload == NULL || !GST_CLOCK_TIME_IS_VALID (payload->ts)); --j) { payload = &g_array_index (stream->payloads, AsfPayload, j); } /* If there's a complete payload queued for this stream */ if (!gst_asf_payload_is_complete (payload)) continue; } } else { /* find last payload with timestamp */ for (last_idx = stream->payloads->len - 1; last_idx >= 0 && (payload == NULL || !GST_CLOCK_TIME_IS_VALID (payload->ts)); --last_idx) { payload = &g_array_index (stream->payloads, AsfPayload, last_idx); } /* if this is first payload after seek we might need to update the segment */ if (GST_CLOCK_TIME_IS_VALID (payload->ts)) gst_asf_demux_check_segment_ts (demux, payload->ts); if (G_UNLIKELY (GST_CLOCK_TIME_IS_VALID (payload->ts) && (payload->ts < demux->segment.start))) { if (G_UNLIKELY ((!demux->keyunit_sync) && (!demux->accurate) && payload->keyframe)) { GST_DEBUG_OBJECT (stream->pad, ""Found keyframe, updating segment start to %"" GST_TIME_FORMAT, GST_TIME_ARGS (payload->ts)); demux->segment.start = payload->ts; demux->segment.time = payload->ts; } else { GST_DEBUG_OBJECT (stream->pad, ""Last queued payload has timestamp %"" GST_TIME_FORMAT "" which is before our segment start %"" GST_TIME_FORMAT "", not pushing yet"", GST_TIME_ARGS (payload->ts), GST_TIME_ARGS (demux->segment.start)); continue; } } payload = NULL; /* find first complete payload with timestamp */ for (j = 0; j < stream->payloads->len && (payload == NULL || !GST_CLOCK_TIME_IS_VALID (payload->ts)); ++j) { payload = &g_array_index (stream->payloads, AsfPayload, j); } /* Now see if there's a complete payload queued for this stream */ if (!gst_asf_payload_is_complete (payload)) continue; } /* ... and whether its timestamp is lower than the current best */ if (best_stream == NULL || best_payload->ts > payload->ts) { best_stream = stream; best_payload = payload; } } } return best_stream; } ",0 "void DownloadItemImpl::DestinationError( DownloadInterruptReason reason, int64_t bytes_so_far, std::unique_ptr secure_hash) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(state_ == TARGET_PENDING_INTERNAL || state_ == IN_PROGRESS_INTERNAL); DVLOG(20) << __func__ << ""() reason:"" << DownloadInterruptReasonToString(reason) << "" this:"" << DebugString(true); InterruptWithPartialState(bytes_so_far, std::move(secure_hash), reason); UpdateObservers(); } ",0 "v8::Local V8DOMWrapper::instantiateV8Object(V8Proxy* proxy, V8ClassIndex::V8WrapperType descriptorType, V8ClassIndex::V8WrapperType cptrType, void* impl) { if (descriptorType == V8ClassIndex::HTMLCOLLECTION && static_cast(impl)->type() == DocAll) descriptorType = V8ClassIndex::HTMLALLCOLLECTION; if (V8IsolatedWorld::getEntered()) { proxy = 0; } else if (!proxy) proxy = V8Proxy::retrieve(); v8::Local instance; if (proxy) instance = proxy->createWrapperFromCache(descriptorType); else { v8::Local function = getTemplate(descriptorType)->GetFunction(); instance = SafeAllocation::newInstance(function); } if (!instance.IsEmpty()) { setDOMWrapper(instance, V8ClassIndex::ToInt(cptrType), impl); } return instance; } ",0 "void SocketStream::Close() { DCHECK(base::MessageLoop::current()) << ""The current base::MessageLoop must exist""; DCHECK_EQ(base::MessageLoop::TYPE_IO, base::MessageLoop::current()->type()) << ""The current base::MessageLoop must be TYPE_IO""; if (next_state_ == STATE_NONE) return; base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&SocketStream::DoClose, this)); } ",0 "bool Extension::HasAPIPermission(APIPermission::ID permission) const { base::AutoLock auto_lock(runtime_data_lock_); return runtime_data_.GetActivePermissions()->HasAPIPermission(permission); } ",0 "static struct dentry *proc_task_instantiate(struct inode *dir, struct dentry *dentry, struct task_struct *task, const void *ptr) { struct dentry *error = ERR_PTR(-ENOENT); struct inode *inode; inode = proc_pid_make_inode(dir->i_sb, task); if (!inode) goto out; inode->i_mode = S_IFDIR|S_IRUGO|S_IXUGO; inode->i_op = &proc_tid_base_inode_operations; inode->i_fop = &proc_tid_base_operations; inode->i_flags|=S_IMMUTABLE; inode->i_nlink = 2 + pid_entry_count_dirs(tid_base_stuff, ARRAY_SIZE(tid_base_stuff)); d_set_d_op(dentry, &pid_dentry_operations); d_add(dentry, inode); /* Close the race of the process dying before we return the dentry */ if (pid_revalidate(dentry, NULL)) error = NULL; out: return error; } ",0 "void CLASS kodak_ycbcr_load_raw() { short buf[384], *bp; int row, col, len, c, i, j, k, y[2][2], cb, cr, rgb[3]; ushort *ip; for (row=0; row < height; row+=2) for (col=0; col < width; col+=128) { len = MIN (128, width-col); kodak_65000_decode (buf, len*3); y[0][1] = y[1][1] = cb = cr = 0; for (bp=buf, i=0; i < len; i+=2, bp+=2) { cb += bp[4]; cr += bp[5]; rgb[1] = -((cb + cr + 2) >> 2); rgb[2] = rgb[1] + cb; rgb[0] = rgb[1] + cr; for (j=0; j < 2; j++) for (k=0; k < 2; k++) { if ((y[j][k] = y[j][k^1] + *bp++) >> 10) derror(); ip = image[(row+j)*width + col+i+k]; FORC3 ip[c] = curve[LIM(y[j][k]+rgb[c], 0, 0xfff)]; } } } } ",0 "static bool BetterSniffMPEG4( const sp &source, String8 *mimeType, float *confidence, sp *meta) { static const off64_t kMaxScanOffset = 128ll; off64_t offset = 0ll; bool foundGoodFileType = false; off64_t moovAtomEndOffset = -1ll; bool done = false; while (!done && offset < kMaxScanOffset) { uint32_t hdr[2]; if (source->readAt(offset, hdr, 8) < 8) { return false; } uint64_t chunkSize = ntohl(hdr[0]); uint32_t chunkType = ntohl(hdr[1]); off64_t chunkDataOffset = offset + 8; if (chunkSize == 1) { if (source->readAt(offset + 8, &chunkSize, 8) < 8) { return false; } chunkSize = ntoh64(chunkSize); chunkDataOffset += 8; if (chunkSize < 16) { return false; } } else if (chunkSize < 8) { return false; } off64_t chunkDataSize = offset + chunkSize - chunkDataOffset; char chunkstring[5]; MakeFourCCString(chunkType, chunkstring); ALOGV(""saw chunk type %s, size %"" PRIu64 "" @ %lld"", chunkstring, chunkSize, (long long)offset); switch (chunkType) { case FOURCC('f', 't', 'y', 'p'): { if (chunkDataSize < 8) { return false; } uint32_t numCompatibleBrands = (chunkDataSize - 8) / 4; for (size_t i = 0; i < numCompatibleBrands + 2; ++i) { if (i == 1) { continue; } uint32_t brand; if (source->readAt( chunkDataOffset + 4 * i, &brand, 4) < 4) { return false; } brand = ntohl(brand); if (isCompatibleBrand(brand)) { foundGoodFileType = true; break; } } if (!foundGoodFileType) { return false; } break; } case FOURCC('m', 'o', 'o', 'v'): { moovAtomEndOffset = offset + chunkSize; done = true; break; } default: break; } offset += chunkSize; } if (!foundGoodFileType) { return false; } *mimeType = MEDIA_MIMETYPE_CONTAINER_MPEG4; *confidence = 0.4f; if (moovAtomEndOffset >= 0) { *meta = new AMessage; (*meta)->setInt64(""meta-data-size"", moovAtomEndOffset); ALOGV(""found metadata size: %lld"", (long long)moovAtomEndOffset); } return true; } ",0 "void ShelfBackgroundAnimator::AnimationValues::SetTargetValues( SkColor target_color) { initial_color_ = current_color_; target_color_ = target_color; } ",0 "chunk_repack(chunk_t *chunk) { if (chunk->datalen && chunk->data != &chunk->mem[0]) { memmove(chunk->mem, chunk->data, chunk->datalen); } chunk->data = &chunk->mem[0]; } ",0 "ikev2_sa_print(netdissect_options *ndo, u_char tpay, const struct isakmp_gen *ext1, u_int osa_length, const u_char *ep, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth) { const struct isakmp_gen *ext; struct isakmp_gen e; u_int sa_length; const u_char *cp; int i; int pcount; u_char np; u_int item_len; ND_TCHECK(*ext1); UNALIGNED_MEMCPY(&e, ext1, sizeof(e)); ikev2_pay_print(ndo, ""sa"", e.critical); /* * ikev2_sub0_print() guarantees that this is >= 4. */ osa_length= ntohs(e.len); sa_length = osa_length - 4; ND_PRINT((ndo,"" len=%d"", sa_length)); /* * Print the payloads. */ cp = (const u_char *)(ext1 + 1); pcount = 0; for (np = ISAKMP_NPTYPE_P; np != 0; np = e.np) { pcount++; ext = (const struct isakmp_gen *)cp; if (sa_length < sizeof(*ext)) goto toolong; ND_TCHECK(*ext); UNALIGNED_MEMCPY(&e, ext, sizeof(e)); /* * Since we can't have a payload length of less than 4 bytes, * we need to bail out here if the generic header is nonsensical * or truncated, otherwise we could loop forever processing * zero-length items or otherwise misdissect the packet. */ item_len = ntohs(e.len); if (item_len <= 4) goto trunc; if (sa_length < item_len) goto toolong; ND_TCHECK2(*cp, item_len); depth++; ND_PRINT((ndo,""\n"")); for (i = 0; i < depth; i++) ND_PRINT((ndo,"" "")); ND_PRINT((ndo,""("")); if (np == ISAKMP_NPTYPE_P) { cp = ikev2_p_print(ndo, np, pcount, ext, item_len, ep, depth); if (cp == NULL) { /* error, already reported */ return NULL; } } else { ND_PRINT((ndo, ""%s"", NPSTR(np))); cp += item_len; } ND_PRINT((ndo,"")"")); depth--; sa_length -= item_len; } return cp; toolong: /* * Skip the rest of the SA. */ cp += sa_length; ND_PRINT((ndo,"" [|%s]"", NPSTR(tpay))); return cp; trunc: ND_PRINT((ndo,"" [|%s]"", NPSTR(tpay))); return NULL; } ",1 " static TimeDelta GetNudgeDelayTimeDelta(const ModelType& model_type, SyncManager::SyncInternal* core) { NudgeDelayStrategy delay_type = GetNudgeDelayStrategy(model_type); return GetNudgeDelayTimeDeltaFromType(delay_type, model_type, core); } ",0 "hstore_eq(PG_FUNCTION_ARGS) { int res = DatumGetInt32(DirectFunctionCall2(hstore_cmp, PG_GETARG_DATUM(0), PG_GETARG_DATUM(1))); PG_RETURN_BOOL(res == 0); } ",0 "void avrc_flush_cmd_q(uint8_t handle) { AVRC_TRACE_DEBUG(""AVRC: Flushing command queue for handle=0x%02x"", handle); avrc_cb.ccb_int[handle].flags &= ~AVRC_CB_FLAGS_RSP_PENDING; alarm_cancel(avrc_cb.ccb_int[handle].tle); fixed_queue_free(avrc_cb.ccb_int[handle].cmd_q, osi_free); avrc_cb.ccb_int[handle].cmd_q = NULL; } ",0 "PHP_PGSQL_API int php_pgsql_insert(PGconn *pg_link, const char *table, zval *var_array, ulong opt, char **sql TSRMLS_DC) { zval **val, *converted = NULL; char buf[256]; char *fld; smart_str querystr = {0}; int key_type, ret = FAILURE; uint fld_len; ulong num_idx; HashPosition pos; assert(pg_link != NULL); assert(table != NULL); assert(Z_TYPE_P(var_array) == IS_ARRAY); if (zend_hash_num_elements(Z_ARRVAL_P(var_array)) == 0) { smart_str_appends(&querystr, ""INSERT INTO ""); build_tablename(&querystr, pg_link, table); smart_str_appends(&querystr, "" DEFAULT VALUES""); goto no_values; } /* convert input array if needed */ if (!(opt & PGSQL_DML_NO_CONV)) { MAKE_STD_ZVAL(converted); array_init(converted); if (php_pgsql_convert(pg_link, table, var_array, converted, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == FAILURE) { goto cleanup; } var_array = converted; } smart_str_appends(&querystr, ""INSERT INTO ""); build_tablename(&querystr, pg_link, table); smart_str_appends(&querystr, "" (""); zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos); while ((key_type = zend_hash_get_current_key_ex(Z_ARRVAL_P(var_array), &fld, &fld_len, &num_idx, 0, &pos)) != HASH_KEY_NON_EXISTANT) { if (key_type == HASH_KEY_IS_LONG) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Expects associative array for values to be inserted""); goto cleanup; } smart_str_appendl(&querystr, fld, fld_len - 1); smart_str_appendc(&querystr, ','); zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos); } querystr.len--; smart_str_appends(&querystr, "") VALUES (""); /* make values string */ for (zend_hash_internal_pointer_reset_ex(Z_ARRVAL_P(var_array), &pos); zend_hash_get_current_data_ex(Z_ARRVAL_P(var_array), (void **)&val, &pos) == SUCCESS; zend_hash_move_forward_ex(Z_ARRVAL_P(var_array), &pos)) { /* we can avoid the key_type check here, because we tested it in the other loop */ switch(Z_TYPE_PP(val)) { case IS_STRING: smart_str_appendl(&querystr, Z_STRVAL_PP(val), Z_STRLEN_PP(val)); break; case IS_LONG: smart_str_append_long(&querystr, Z_LVAL_PP(val)); break; case IS_DOUBLE: smart_str_appendl(&querystr, buf, snprintf(buf, sizeof(buf), ""%F"", Z_DVAL_PP(val))); break; default: /* should not happen */ php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Report this error to php-dev@lists.php.net, type = %d"", Z_TYPE_PP(val)); goto cleanup; break; } smart_str_appendc(&querystr, ','); } /* Remove the trailing "","" */ querystr.len--; smart_str_appends(&querystr, "");""); no_values: smart_str_0(&querystr); if ((opt & (PGSQL_DML_EXEC|PGSQL_DML_ASYNC)) && do_exec(&querystr, PGRES_COMMAND_OK, pg_link, (opt & PGSQL_CONV_OPTS) TSRMLS_CC) == 0) { ret = SUCCESS; } else if (opt & PGSQL_DML_STRING) { ret = SUCCESS; } cleanup: if (!(opt & PGSQL_DML_NO_CONV) && converted) { zval_dtor(converted); FREE_ZVAL(converted); } if (ret == SUCCESS && (opt & PGSQL_DML_STRING)) { *sql = querystr.c; } else { smart_str_free(&querystr); } return ret; } ",0 " explicit DelayedResponse( RequestDelayingSitePerProcessBrowserTest* test_harness) : test_harness_(test_harness) {} ",0 "void DomOperationObserver::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_DOM_OPERATION_RESPONSE) { content::Details dom_op_details(details); if (dom_op_details->automation_id == automation_id_) OnDomOperationCompleted(dom_op_details->json); } else if (type == chrome::NOTIFICATION_APP_MODAL_DIALOG_SHOWN) { OnModalDialogShown(); } else { DCHECK_EQ(chrome::NOTIFICATION_WEB_CONTENT_SETTINGS_CHANGED, type); WebContents* web_contents = content::Source(source).ptr(); if (web_contents) { TabSpecificContentSettings* tab_content_settings = TabSpecificContentSettings::FromWebContents(web_contents); if (tab_content_settings && tab_content_settings->IsContentBlocked( CONTENT_SETTINGS_TYPE_JAVASCRIPT)) OnJavascriptBlocked(); } } } ",0 "ofproto_init_max_ports(struct ofproto *ofproto, uint16_t max_ports) { ovs_assert(max_ports <= ofp_to_u16(OFPP_MAX)); ofproto->max_ports = max_ports; } ",0 "void HWNDMessageHandler::ResetWindowRegion(bool force, bool redraw) { if ((window_ex_style() & WS_EX_COMPOSITED) == 0 && !custom_window_region_ && (!delegate_->IsUsingCustomFrame() || !delegate_->IsWidgetWindow())) { if (force) SetWindowRgn(hwnd(), NULL, redraw); return; } HRGN current_rgn = CreateRectRgn(0, 0, 0, 0); int current_rgn_result = GetWindowRgn(hwnd(), current_rgn); CRect window_rect; GetWindowRect(hwnd(), &window_rect); HRGN new_region; if (custom_window_region_) { new_region = ::CreateRectRgn(0, 0, 0, 0); ::CombineRgn(new_region, custom_window_region_.Get(), NULL, RGN_COPY); } else if (IsMaximized()) { HMONITOR monitor = MonitorFromWindow(hwnd(), MONITOR_DEFAULTTONEAREST); MONITORINFO mi; mi.cbSize = sizeof mi; base::win::GetMonitorInfoWrapper(monitor, &mi); CRect work_rect = mi.rcWork; work_rect.OffsetRect(-window_rect.left, -window_rect.top); new_region = CreateRectRgnIndirect(&work_rect); } else { gfx::Path window_mask; delegate_->GetWindowMask( gfx::Size(window_rect.Width(), window_rect.Height()), &window_mask); new_region = gfx::CreateHRGNFromSkPath(window_mask); } if (current_rgn_result == ERROR || !EqualRgn(current_rgn, new_region)) { SetWindowRgn(hwnd(), new_region, redraw); } else { DeleteObject(new_region); } DeleteObject(current_rgn); } ",0 "OSExchangeData::DownloadFileInfo::~DownloadFileInfo() {} ",0 "int RenderThreadImpl::GenerateRoutingID() { int32_t routing_id = MSG_ROUTING_NONE; render_message_filter()->GenerateRoutingID(&routing_id); return routing_id; } ",0 "struct sched_domain *build_sched_domain(struct sched_domain_topology_level *tl, const struct cpumask *cpu_map, struct sched_domain_attr *attr, struct sched_domain *child, int cpu) { struct sched_domain *sd = sd_init(tl, cpu); if (!sd) return child; cpumask_and(sched_domain_span(sd), cpu_map, tl->mask(cpu)); if (child) { sd->level = child->level + 1; sched_domain_level_max = max(sched_domain_level_max, sd->level); child->parent = sd; sd->child = child; if (!cpumask_subset(sched_domain_span(child), sched_domain_span(sd))) { pr_err(""BUG: arch topology borken\n""); #ifdef CONFIG_SCHED_DEBUG pr_err("" the %s domain not a subset of the %s domain\n"", child->name, sd->name); #endif /* Fixup, ensure @sd has at least @child cpus. */ cpumask_or(sched_domain_span(sd), sched_domain_span(sd), sched_domain_span(child)); } } set_domain_attribute(sd, attr); return sd; } ",0 "void RenderWidgetHostImpl::Focus() { Send(new ViewMsg_SetFocus(routing_id_, true)); } ",0 "float LayerTreeHostImpl::BottomControlsHeight() const { return active_tree_->bottom_controls_height(); } ",0 "static trans_t* AllocTrans( char *original, char *translated[MAX_LANGUAGES] ) { trans_t *t; int i; t = malloc( sizeof( trans_t ) ); memset( t, 0, sizeof( trans_t ) ); if ( original ) { strncpy( t->original, original, MAX_TRANS_STRING ); } if ( translated ) { for ( i = 0; i < MAX_LANGUAGES; i++ ) strncpy( t->translated[i], translated[i], MAX_TRANS_STRING ); } return t; } ",0 "void FrameView::getTickmarks(Vector& tickmarks) const { if (!m_tickmarks.isEmpty()) tickmarks = m_tickmarks; else tickmarks = frame().document()->markers().renderedRectsForMarkers(DocumentMarker::TextMatch); } ",0 "create_server_socket(const char *host, const char *port) { struct addrinfo hints; struct addrinfo *result, *rp, *ipv4v6bindall; int s, server_sock; memset(&hints, 0, sizeof(struct addrinfo)); hints.ai_family = AF_UNSPEC; /* Return IPv4 and IPv6 choices */ hints.ai_socktype = SOCK_DGRAM; /* We want a UDP socket */ hints.ai_flags = AI_PASSIVE | AI_ADDRCONFIG; /* For wildcard IP address */ hints.ai_protocol = IPPROTO_UDP; s = getaddrinfo(host, port, &hints, &result); if (s != 0) { LOGE(""getaddrinfo: %s"", gai_strerror(s)); return -1; } rp = result; /* * On Linux, with net.ipv6.bindv6only = 0 (the default), getaddrinfo(NULL) with * AI_PASSIVE returns 0.0.0.0 and :: (in this order). AI_PASSIVE was meant to * return a list of addresses to listen on, but it is impossible to listen on * 0.0.0.0 and :: at the same time, if :: implies dualstack mode. */ if (!host) { ipv4v6bindall = result; /* Loop over all address infos found until a IPV6 address is found. */ while (ipv4v6bindall) { if (ipv4v6bindall->ai_family == AF_INET6) { rp = ipv4v6bindall; /* Take first IPV6 address available */ break; } ipv4v6bindall = ipv4v6bindall->ai_next; /* Get next address info, if any */ } } for (/*rp = result*/; rp != NULL; rp = rp->ai_next) { server_sock = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol); if (server_sock == -1) { continue; } if (rp->ai_family == AF_INET6) { int ipv6only = host ? 1 : 0; setsockopt(server_sock, IPPROTO_IPV6, IPV6_V6ONLY, &ipv6only, sizeof(ipv6only)); } int opt = 1; setsockopt(server_sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); s = bind(server_sock, rp->ai_addr, rp->ai_addrlen); if (s == 0) { /* We managed to bind successfully! */ break; } else { ERROR(""bind""); } close(server_sock); } if (rp == NULL) { LOGE(""cannot bind""); return -1; } freeaddrinfo(result); return server_sock; } ",0 "megasas_get_pd_info(struct megasas_instance *instance, struct scsi_device *sdev) { int ret; struct megasas_cmd *cmd; struct megasas_dcmd_frame *dcmd; struct MR_PRIV_DEVICE *mr_device_priv_data; u16 device_id = 0; device_id = (sdev->channel * MEGASAS_MAX_DEV_PER_CHANNEL) + sdev->id; cmd = megasas_get_cmd(instance); if (!cmd) { dev_err(&instance->pdev->dev, ""Failed to get cmd %s\n"", __func__); return; } dcmd = &cmd->frame->dcmd; memset(instance->pd_info, 0, sizeof(*instance->pd_info)); memset(dcmd->mbox.b, 0, MFI_MBOX_SIZE); dcmd->mbox.s[0] = cpu_to_le16(device_id); dcmd->cmd = MFI_CMD_DCMD; dcmd->cmd_status = 0xFF; dcmd->sge_count = 1; dcmd->flags = MFI_FRAME_DIR_READ; dcmd->timeout = 0; dcmd->pad_0 = 0; dcmd->data_xfer_len = cpu_to_le32(sizeof(struct MR_PD_INFO)); dcmd->opcode = cpu_to_le32(MR_DCMD_PD_GET_INFO); megasas_set_dma_settings(instance, dcmd, instance->pd_info_h, sizeof(struct MR_PD_INFO)); if ((instance->adapter_type != MFI_SERIES) && !instance->mask_interrupts) ret = megasas_issue_blocked_cmd(instance, cmd, MFI_IO_TIMEOUT_SECS); else ret = megasas_issue_polled(instance, cmd); switch (ret) { case DCMD_SUCCESS: mr_device_priv_data = sdev->hostdata; le16_to_cpus((u16 *)&instance->pd_info->state.ddf.pdType); mr_device_priv_data->interface_type = instance->pd_info->state.ddf.pdType.intf; break; case DCMD_TIMEOUT: switch (dcmd_timeout_ocr_possible(instance)) { case INITIATE_OCR: cmd->flags |= DRV_DCMD_SKIP_REFIRE; megasas_reset_fusion(instance->host, MFI_IO_TIMEOUT_OCR); break; case KILL_ADAPTER: megaraid_sas_kill_hba(instance); break; case IGNORE_TIMEOUT: dev_info(&instance->pdev->dev, ""Ignore DCMD timeout: %s %d\n"", __func__, __LINE__); break; } break; } if (ret != DCMD_TIMEOUT) megasas_return_cmd(instance, cmd); return; } ",0 "int inet_csk_get_port(struct sock *sk, unsigned short snum) { bool reuse = sk->sk_reuse && sk->sk_state != TCP_LISTEN; struct inet_hashinfo *hinfo = sk->sk_prot->h.hashinfo; int ret = 1, port = snum; struct inet_bind_hashbucket *head; struct net *net = sock_net(sk); struct inet_bind_bucket *tb = NULL; kuid_t uid = sock_i_uid(sk); if (!port) { head = inet_csk_find_open_port(sk, &tb, &port); if (!head) return ret; if (!tb) goto tb_not_found; goto success; } head = &hinfo->bhash[inet_bhashfn(net, port, hinfo->bhash_size)]; spin_lock_bh(&head->lock); inet_bind_bucket_for_each(tb, &head->chain) if (net_eq(ib_net(tb), net) && tb->port == port) goto tb_found; tb_not_found: tb = inet_bind_bucket_create(hinfo->bind_bucket_cachep, net, head, port); if (!tb) goto fail_unlock; tb_found: if (!hlist_empty(&tb->owners)) { if (sk->sk_reuse == SK_FORCE_REUSE) goto success; if ((tb->fastreuse > 0 && reuse) || sk_reuseport_match(tb, sk)) goto success; if (inet_csk_bind_conflict(sk, tb, true, true)) goto fail_unlock; } success: if (!hlist_empty(&tb->owners)) { tb->fastreuse = reuse; if (sk->sk_reuseport) { tb->fastreuseport = FASTREUSEPORT_ANY; tb->fastuid = uid; tb->fast_rcv_saddr = sk->sk_rcv_saddr; tb->fast_ipv6_only = ipv6_only_sock(sk); #if IS_ENABLED(CONFIG_IPV6) tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; #endif } else { tb->fastreuseport = 0; } } else { if (!reuse) tb->fastreuse = 0; if (sk->sk_reuseport) { /* We didn't match or we don't have fastreuseport set on * the tb, but we have sk_reuseport set on this socket * and we know that there are no bind conflicts with * this socket in this tb, so reset our tb's reuseport * settings so that any subsequent sockets that match * our current socket will be put on the fast path. * * If we reset we need to set FASTREUSEPORT_STRICT so we * do extra checking for all subsequent sk_reuseport * socks. */ if (!sk_reuseport_match(tb, sk)) { tb->fastreuseport = FASTREUSEPORT_STRICT; tb->fastuid = uid; tb->fast_rcv_saddr = sk->sk_rcv_saddr; tb->fast_ipv6_only = ipv6_only_sock(sk); #if IS_ENABLED(CONFIG_IPV6) tb->fast_v6_rcv_saddr = sk->sk_v6_rcv_saddr; #endif } } else { tb->fastreuseport = 0; } } if (!inet_csk(sk)->icsk_bind_hash) inet_bind_hash(sk, tb, port); WARN_ON(inet_csk(sk)->icsk_bind_hash != tb); ret = 0; fail_unlock: spin_unlock_bh(&head->lock); return ret; } ",0 "static int gfs2_block_truncate_page(struct address_space *mapping, loff_t from) { struct inode *inode = mapping->host; struct gfs2_inode *ip = GFS2_I(inode); unsigned long index = from >> PAGE_CACHE_SHIFT; unsigned offset = from & (PAGE_CACHE_SIZE-1); unsigned blocksize, iblock, length, pos; struct buffer_head *bh; struct page *page; int err; page = grab_cache_page(mapping, index); if (!page) return 0; blocksize = inode->i_sb->s_blocksize; length = blocksize - (offset & (blocksize - 1)); iblock = index << (PAGE_CACHE_SHIFT - inode->i_sb->s_blocksize_bits); if (!page_has_buffers(page)) create_empty_buffers(page, blocksize, 0); /* Find the buffer that contains ""offset"" */ bh = page_buffers(page); pos = blocksize; while (offset >= pos) { bh = bh->b_this_page; iblock++; pos += blocksize; } err = 0; if (!buffer_mapped(bh)) { gfs2_block_map(inode, iblock, bh, 0); /* unmapped? It's a hole - nothing to do */ if (!buffer_mapped(bh)) goto unlock; } /* Ok, it's mapped. Make sure it's up-to-date */ if (PageUptodate(page)) set_buffer_uptodate(bh); if (!buffer_uptodate(bh)) { err = -EIO; ll_rw_block(READ, 1, &bh); wait_on_buffer(bh); /* Uhhuh. Read error. Complain and punt. */ if (!buffer_uptodate(bh)) goto unlock; err = 0; } if (!gfs2_is_writeback(ip)) gfs2_trans_add_bh(ip->i_gl, bh, 0); zero_user(page, offset, length); mark_buffer_dirty(bh); unlock: unlock_page(page); page_cache_release(page); return err; } ",0 "static void blitter_set_dst_dim(struct vrend_blitter_ctx *blit_ctx, unsigned width, unsigned height) { blit_ctx->dst_width = width; blit_ctx->dst_height = height; } ",0 "static int cqspi_set_protocol(struct spi_nor *nor, const int read) { struct cqspi_flash_pdata *f_pdata = nor->priv; f_pdata->inst_width = CQSPI_INST_TYPE_SINGLE; f_pdata->addr_width = CQSPI_INST_TYPE_SINGLE; f_pdata->data_width = CQSPI_INST_TYPE_SINGLE; if (read) { switch (nor->flash_read) { case SPI_NOR_NORMAL: case SPI_NOR_FAST: f_pdata->data_width = CQSPI_INST_TYPE_SINGLE; break; case SPI_NOR_DUAL: f_pdata->data_width = CQSPI_INST_TYPE_DUAL; break; case SPI_NOR_QUAD: f_pdata->data_width = CQSPI_INST_TYPE_QUAD; break; default: return -EINVAL; } } cqspi_configure(nor); return 0; } ",0 "static void jpg_put_pixel_rows(j_decompress_ptr cinfo, jpg_dest_t *dinfo, JDIMENSION rows_supplied) { JSAMPLE *bufptr; int cmptno; JDIMENSION x; uint_fast32_t width; JAS_DBGLOG(10, (""jpg_put_pixel_rows(%p, %p)\n"", cinfo, dinfo)); if (dinfo->error) { return; } assert(cinfo->output_components == jas_image_numcmpts(dinfo->image)); for (cmptno = 0; cmptno < cinfo->output_components; ++cmptno) { width = jas_image_cmptwidth(dinfo->image, cmptno); bufptr = (dinfo->buffer[0]) + cmptno; for (x = 0; x < width; ++x) { jas_matrix_set(dinfo->data, 0, x, GETJSAMPLE(*bufptr)); bufptr += cinfo->output_components; } JAS_DBGLOG(10, ( ""jas_image_writecmpt called for component %d row %lu\n"", cmptno, JAS_CAST(unsigned long, dinfo->row))); if (jas_image_writecmpt(dinfo->image, cmptno, 0, dinfo->row, width, 1, dinfo->data)) { dinfo->error = 1; } } dinfo->row += rows_supplied; } ",0 "static uint64_t sysbus_esp_mem_read(void *opaque, hwaddr addr, unsigned int size) { SysBusESPState *sysbus = opaque; uint32_t saddr; saddr = addr >> sysbus->it_shift; return esp_reg_read(&sysbus->esp, saddr); } ",0 "scoped_refptr AudioOutputController::CreateLowLatency( EventHandler* event_handler, AudioParameters params, SyncReader* sync_reader) { DCHECK(sync_reader); if (!CheckParameters(params)) return NULL; if (!AudioManager::GetAudioManager()) return NULL; scoped_refptr controller(new AudioOutputController( event_handler, 0, sync_reader)); controller->message_loop_ = AudioManager::GetAudioManager()->GetMessageLoop(); controller->message_loop_->PostTask( FROM_HERE, NewRunnableMethod(controller.get(), &AudioOutputController::DoCreate, params)); return controller; } ",0 "void LockScreenMediaControlsView::SeekTo(double seek_progress) { DCHECK(position_.has_value()); media_controller_remote_->SeekTo(seek_progress * position_->duration()); } ",0 "void __cpuinit init_idle(struct task_struct *idle, int cpu) { struct rq *rq = cpu_rq(cpu); unsigned long flags; raw_spin_lock_irqsave(&rq->lock, flags); __sched_fork(idle); idle->state = TASK_RUNNING; idle->se.exec_start = sched_clock(); do_set_cpus_allowed(idle, cpumask_of(cpu)); /* * We're having a chicken and egg problem, even though we are * holding rq->lock, the cpu isn't yet set to this cpu so the * lockdep check in task_group() will fail. * * Similar case to sched_fork(). / Alternatively we could * use task_rq_lock() here and obtain the other rq->lock. * * Silence PROVE_RCU */ rcu_read_lock(); __set_task_cpu(idle, cpu); rcu_read_unlock(); rq->curr = rq->idle = idle; #if defined(CONFIG_SMP) idle->on_cpu = 1; #endif raw_spin_unlock_irqrestore(&rq->lock, flags); /* Set the preempt count _outside_ the spinlocks! */ task_thread_info(idle)->preempt_count = 0; /* * The idle tasks have their own, simple scheduling class: */ idle->sched_class = &idle_sched_class; ftrace_graph_init_idle_task(idle, cpu); } ",0 "static int vm_stat_get_per_vm(void *data, u64 *val) { struct kvm_stat_data *stat_data = (struct kvm_stat_data *)data; *val = *(ulong *)((void *)stat_data->kvm + stat_data->offset); return 0; } ",0 "static int bt_seq_open(struct inode *inode, struct file *file) { struct bt_sock_list *sk_list; struct bt_seq_state *s; sk_list = PDE_DATA(inode); s = __seq_open_private(file, &bt_seq_ops, sizeof(struct bt_seq_state)); if (!s) return -ENOMEM; s->l = sk_list; return 0; } ",0 "static void dns_resolver_free_preparse(struct key_preparsed_payload *prep) { pr_devel(""==>%s()\n"", __func__); kfree(prep->payload[0]); } ",0 "void HTMLFormElement::RemovedFrom(ContainerNode* insertion_point) { if (has_elements_associated_by_parser_) { Node& root = NodeTraversal::HighestAncestorOrSelf(*this); if (!listed_elements_are_dirty_) { ListedElement::List elements(ListedElements()); NotifyFormRemovedFromTree(elements, root); } else { ListedElement::List elements; CollectListedElements( NodeTraversal::HighestAncestorOrSelf(*insertion_point), elements); NotifyFormRemovedFromTree(elements, root); CollectListedElements(root, elements); NotifyFormRemovedFromTree(elements, root); } if (!image_elements_are_dirty_) { HeapVector> images(ImageElements()); NotifyFormRemovedFromTree(images, root); } else { HeapVector> images; CollectImageElements( NodeTraversal::HighestAncestorOrSelf(*insertion_point), images); NotifyFormRemovedFromTree(images, root); CollectImageElements(root, images); NotifyFormRemovedFromTree(images, root); } } GetDocument().GetFormController().WillDeleteForm(this); HTMLElement::RemovedFrom(insertion_point); } ",0 "RenderFrameImpl::UniqueNameFrameAdapter::UniqueNameFrameAdapter( RenderFrameImpl* render_frame) : render_frame_(render_frame) {} ",0 "static void __get_guid(struct ipmi_smi *intf) { int rv; struct bmc_device *bmc = intf->bmc; bmc->dyn_guid_set = 2; intf->null_user_handler = guid_handler; rv = send_guid_cmd(intf, 0); if (rv) /* Send failed, no GUID available. */ bmc->dyn_guid_set = 0; wait_event(intf->waitq, bmc->dyn_guid_set != 2); /* dyn_guid_set makes the guid data available. */ smp_rmb(); intf->null_user_handler = NULL; } ",0 "MagickExport char *RemoveImageProperty(Image *image, const char *property) { char *value; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image->filename); if (image->properties == (void *) NULL) return((char *) NULL); value=(char *) RemoveNodeFromSplayTree((SplayTreeInfo *) image->properties, property); return(value); } ",0 "void DocumentLoader::UpdateForSameDocumentNavigation( const KURL& new_url, SameDocumentNavigationSource same_document_navigation_source, scoped_refptr data, HistoryScrollRestorationType scroll_restoration_type, FrameLoadType type, Document* initiating_document) { if (type == kFrameLoadTypeStandard && initiating_document && !initiating_document->CanCreateHistoryEntry()) { type = kFrameLoadTypeReplaceCurrentItem; } KURL old_url = request_.Url(); original_request_.SetURL(new_url); request_.SetURL(new_url); SetReplacesCurrentHistoryItem(type != kFrameLoadTypeStandard); if (same_document_navigation_source == kSameDocumentNavigationHistoryApi) { request_.SetHTTPMethod(HTTPNames::GET); request_.SetHTTPBody(nullptr); } ClearRedirectChain(); if (is_client_redirect_) AppendRedirect(old_url); AppendRedirect(new_url); SetHistoryItemStateForCommit( history_item_.Get(), type, same_document_navigation_source == kSameDocumentNavigationHistoryApi ? HistoryNavigationType::kHistoryApi : HistoryNavigationType::kFragment); history_item_->SetDocumentState(frame_->GetDocument()->FormElementsState()); if (same_document_navigation_source == kSameDocumentNavigationHistoryApi) { history_item_->SetStateObject(std::move(data)); history_item_->SetScrollRestorationType(scroll_restoration_type); } HistoryCommitType commit_type = LoadTypeToCommitType(type); frame_->FrameScheduler()->DidCommitProvisionalLoad( commit_type == kHistoryInertCommit, type == kFrameLoadTypeReload, frame_->IsLocalRoot()); GetLocalFrameClient().DispatchDidNavigateWithinPage( history_item_.Get(), commit_type, initiating_document); } ",0 "void DataReductionProxySettings::MaybeActivateDataReductionProxy( bool at_startup) { DCHECK(thread_checker_.CalledOnValidThread()); PrefService* prefs = GetOriginalProfilePrefs(); if (!prefs) return; if (spdy_proxy_auth_enabled_.GetValue() && at_startup) { int64_t last_enabled_time = prefs->GetInt64(prefs::kDataReductionProxyLastEnabledTime); if (last_enabled_time != 0) { RecordDaysSinceEnabledMetric( (clock_->Now() - base::Time::FromInternalValue(last_enabled_time)) .InDays()); } int64_t last_savings_cleared_time = prefs->GetInt64( prefs::kDataReductionProxySavingsClearedNegativeSystemClock); if (last_savings_cleared_time != 0) { int32_t days_since_savings_cleared = (clock_->Now() - base::Time::FromInternalValue(last_savings_cleared_time)) .InDays(); if (days_since_savings_cleared == 0) days_since_savings_cleared = 1; UMA_HISTOGRAM_CUSTOM_COUNTS( ""DataReductionProxy.DaysSinceSavingsCleared.NegativeSystemClock"", days_since_savings_cleared, 1, 365, 50); } } if (spdy_proxy_auth_enabled_.GetValue() && !prefs->GetBoolean(prefs::kDataReductionProxyWasEnabledBefore)) { prefs->SetBoolean(prefs::kDataReductionProxyWasEnabledBefore, true); ResetDataReductionStatistics(); } if (!at_startup) { if (IsDataReductionProxyEnabled()) { RecordSettingsEnabledState(DATA_REDUCTION_SETTINGS_ACTION_OFF_TO_ON); prefs->SetInt64(prefs::kDataReductionProxyLastEnabledTime, clock_->Now().ToInternalValue()); RecordDaysSinceEnabledMetric(0); } else { RecordSettingsEnabledState(DATA_REDUCTION_SETTINGS_ACTION_ON_TO_OFF); } } if (at_startup && !data_reduction_proxy_service_->Initialized()) deferred_initialization_ = true; else UpdateIOData(at_startup); } ",1 " DevToolsSanityTest() : window_(NULL), inspected_rvh_(NULL) {} ",0 " SendTabToSelfInfoBarDelegate::~SendTabToSelfInfoBarDelegate() {} ",0 "void PrintRenderFrameHelper::OnPrintPreview( const base::DictionaryValue& settings) { if (ipc_nesting_level_ > 1) return; print_preview_context_.OnPrintPreview(); UMA_HISTOGRAM_ENUMERATION(""PrintPreview.PreviewEvent"", PREVIEW_EVENT_REQUESTED, PREVIEW_EVENT_MAX); if (!print_preview_context_.source_frame()) { DidFinishPrinting(FAIL_PREVIEW); return; } if (!UpdatePrintSettings(print_preview_context_.source_frame(), print_preview_context_.source_node(), settings)) { if (print_preview_context_.last_error() != PREVIEW_ERROR_BAD_SETTING) { DidFinishPrinting(INVALID_SETTINGS); } else { DidFinishPrinting(FAIL_PREVIEW); } return; } if (print_pages_params_->params.is_first_request && !print_preview_context_.IsModifiable()) { PrintHostMsg_SetOptionsFromDocument_Params options; if (SetOptionsFromPdfDocument(&options)) Send(new PrintHostMsg_SetOptionsFromDocument(routing_id(), options)); } is_print_ready_metafile_sent_ = false; print_pages_params_->params.supports_alpha_blend = true; bool generate_draft_pages = false; if (!settings.GetBoolean(kSettingGenerateDraftData, &generate_draft_pages)) { NOTREACHED(); } print_preview_context_.set_generate_draft_pages(generate_draft_pages); PrepareFrameForPreviewDocument(); } ",0 "void EventConverterEvdevImpl::DispatchMouseButton(const input_event& input) { if (!cursor_) return; OnButtonChange(input.code, input.value, TimeDeltaFromInputEvent(input)); } ",0 "bool Document::TasksNeedSuspension() { Page* page = this->GetPage(); return page && page->Paused(); } ",0 "HistogramBase* LinearHistogram::FactoryGetWithRangeDescription( const std::string& name, Sample minimum, Sample maximum, uint32_t bucket_count, int32_t flags, const DescriptionPair descriptions[]) { bool valid_arguments = Histogram::InspectConstructionArguments( name, &minimum, &maximum, &bucket_count); DCHECK(valid_arguments); return Factory(name, minimum, maximum, bucket_count, flags, descriptions) .Build(); } ",0 "static void gen_movl_seg_T0(DisasContext *s, int seg_reg) { if (s->pe && !s->vm86) { tcg_gen_trunc_tl_i32(cpu_tmp2_i32, cpu_T0); gen_helper_load_seg(cpu_env, tcg_const_i32(seg_reg), cpu_tmp2_i32); /* abort translation because the addseg value may change or because ss32 may change. For R_SS, translation must always stop as a special handling must be done to disable hardware interrupts for the next instruction */ if (seg_reg == R_SS || (s->code32 && seg_reg < R_FS)) s->is_jmp = DISAS_TB_JUMP; } else { gen_op_movl_seg_T0_vm(seg_reg); if (seg_reg == R_SS) s->is_jmp = DISAS_TB_JUMP; } } ",0 "fst_attach(struct net_device *dev, unsigned short encoding, unsigned short parity) { /* * Setting currently fixed in FarSync card so we check and forget */ if (encoding != ENCODING_NRZ || parity != PARITY_CRC16_PR1_CCITT) return -EINVAL; return 0; } ",0 "bool GLES2DecoderImpl::UnmapBufferHelper(Buffer* buffer, GLenum target) { DCHECK(buffer); const Buffer::MappedRange* mapped_range = buffer->GetMappedRange(); if (!mapped_range) return true; if (!AllBitsSet(mapped_range->access, GL_MAP_WRITE_BIT) || AllBitsSet(mapped_range->access, GL_MAP_FLUSH_EXPLICIT_BIT)) { } else if (!WasContextLost()) { void* mem = mapped_range->GetShmPointer(); DCHECK(mem); DCHECK(mapped_range->pointer); memcpy(mapped_range->pointer, mem, mapped_range->size); if (buffer->shadowed()) { buffer->SetRange(mapped_range->offset, mapped_range->size, mem); } } buffer->RemoveMappedRange(); if (WasContextLost()) return true; GLboolean rt = api()->glUnmapBufferFn(target); if (rt == GL_FALSE) { LOG(ERROR) << ""glUnmapBuffer unexpectedly returned GL_FALSE""; MarkContextLost(error::kGuilty); group_->LoseContexts(error::kInnocent); return false; } return true; } ",0 "static js_Ast *identifieropt(js_State *J) { if (J->lookahead == TK_IDENTIFIER) return identifier(J); return NULL; } ",0 "void BookmarkDrag::BeginDrag(Profile* profile, const std::vector& nodes) { new BookmarkDrag(profile, nodes); } ",0 "GraphicsContext3DPrivate::GraphicsContext3DPrivate(GraphicsContext3D* context, HostWindow* hostWindow, GraphicsContext3D::RenderStyle renderStyle) : m_context(context) , m_hostWindow(hostWindow) , m_surface(0) , m_platformContext(0) , m_surfaceOwner(0) { if (renderStyle == GraphicsContext3D::RenderToCurrentGLContext) { m_platformContext = QOpenGLContext::currentContext(); m_surface = m_platformContext->surface(); return; } #if USE(GRAPHICS_SURFACE) QWindow* window = new QWindow; window->setSurfaceType(QSurface::OpenGLSurface); window->setGeometry(-10, -10, 1, 1); window->create(); m_surface = window; m_surfaceOwner = window; m_platformContext = new QOpenGLContext(window); if (!m_platformContext->create()) return; makeCurrentIfNeeded(); IntSize surfaceSize(m_context->m_currentWidth, m_context->m_currentHeight); m_surfaceFlags = GraphicsSurface::SupportsTextureTarget | GraphicsSurface::SupportsSharing; if (!surfaceSize.isEmpty()) m_graphicsSurface = GraphicsSurface::create(surfaceSize, m_surfaceFlags, m_platformContext); #endif } ",0 "static int fpu_insn(RAnal* anal, RAnalOp* op, ut16 code){ op->family = R_ANAL_OP_FAMILY_FPU; return op->size; } ",0 " cff_index_load_offsets( CFF_Index idx ) { FT_Error error = CFF_Err_Ok; FT_Stream stream = idx->stream; FT_Memory memory = stream->memory; if ( idx->count > 0 && idx->offsets == NULL ) { FT_Byte offsize = idx->off_size; FT_ULong data_size; FT_Byte* p; FT_Byte* p_end; FT_ULong* poff; data_size = (FT_ULong)( idx->count + 1 ) * offsize; if ( FT_NEW_ARRAY( idx->offsets, idx->count + 1 ) || FT_STREAM_SEEK( idx->start + 3 ) || FT_FRAME_ENTER( data_size ) ) goto Exit; poff = idx->offsets; p = (FT_Byte*)stream->cursor; p_end = p + data_size; switch ( offsize ) { case 1: for ( ; p < p_end; p++, poff++ ) poff[0] = p[0]; break; case 2: for ( ; p < p_end; p += 2, poff++ ) poff[0] = FT_PEEK_USHORT( p ); break; case 3: for ( ; p < p_end; p += 3, poff++ ) poff[0] = FT_PEEK_OFF3( p ); break; default: for ( ; p < p_end; p += 4, poff++ ) poff[0] = FT_PEEK_ULONG( p ); } FT_FRAME_EXIT(); } Exit: if ( error ) FT_FREE( idx->offsets ); return error; } ",0 "void RenderFrameImpl::OnReload(bool ignore_cache) { frame_->reload(ignore_cache); } ",0 "void BrowserWindowGtk::ShowAvatarBubble(WebContents* web_contents, const gfx::Rect& rect) { GtkWidget* widget = web_contents->GetContentNativeView(); new AvatarMenuBubbleGtk(browser_.get(), widget, BubbleGtk::ARROW_LOCATION_TOP_LEFT, &rect); } ",0 "static inline int read_pid(char *str, pid_t *pid) { char *endptr; errno = 0; long int pidtmp = strtol(str, &endptr, 10); if ((errno == ERANGE && (pidtmp == LONG_MAX || pidtmp == LONG_MIN)) || (errno != 0 && pidtmp == 0)) { return 1; } if (endptr == NULL || endptr[0]!='\0') { return 1; } *pid = (pid_t)pidtmp; return 0; } ",0 "bool GdkRectMatchesTabFaviconBounds(const GdkRectangle& gdk_rect, TabGtk* tab) { gfx::Rect favicon_bounds = tab->favicon_bounds(); return gdk_rect.x == favicon_bounds.x() + tab->x() && gdk_rect.y == favicon_bounds.y() + tab->y() && gdk_rect.width == favicon_bounds.width() && gdk_rect.height == favicon_bounds.height(); } ",0 "MPEG4Source::~MPEG4Source() { if (mStarted) { stop(); } free(mCurrentSampleInfoSizes); free(mCurrentSampleInfoOffsets); } ",0 " bool IsNewNode(const AXNode* node) { return new_nodes.find(node) != new_nodes.end(); } ",0 "bool LookupMatchInTopDomains(const icu::UnicodeString& ustr_skeleton) { std::string skeleton; ustr_skeleton.toUTF8String(skeleton); DCHECK_NE(skeleton.back(), '.'); auto labels = base::SplitStringPiece(skeleton, ""."", base::KEEP_WHITESPACE, base::SPLIT_WANT_ALL); if (labels.size() > kNumberOfLabelsToCheck) { labels.erase(labels.begin(), labels.begin() + labels.size() - kNumberOfLabelsToCheck); } while (labels.size() > 1) { std::string partial_skeleton = base::JoinString(labels, "".""); if (net::LookupStringInFixedSet( g_graph, g_graph_length, partial_skeleton.data(), partial_skeleton.length()) != net::kDafsaNotFound) return true; labels.erase(labels.begin()); } return false; } ",0 "static int should_we_balance(struct lb_env *env) { struct sched_group *sg = env->sd->groups; int cpu, balance_cpu = -1; /* * Ensure the balancing environment is consistent; can happen * when the softirq triggers 'during' hotplug. */ if (!cpumask_test_cpu(env->dst_cpu, env->cpus)) return 0; /* * In the newly idle case, we will allow all the CPUs * to do the newly idle load balance. */ if (env->idle == CPU_NEWLY_IDLE) return 1; /* Try to find first idle CPU */ for_each_cpu_and(cpu, group_balance_mask(sg), env->cpus) { if (!idle_cpu(cpu)) continue; balance_cpu = cpu; break; } if (balance_cpu == -1) balance_cpu = group_balance_cpu(sg); /* * First idle CPU or the first CPU(busiest) in this sched group * is eligible for doing load balancing at this and above domains. */ return balance_cpu == env->dst_cpu; } ",0 "void ChangeListLoader::OnDirectoryLoadComplete( const DirectoryFetchInfo& directory_fetch_info, FileError error) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); util::Log(logging::LOG_INFO, ""Fast-fetch complete: %s => %s"", directory_fetch_info.ToString().c_str(), FileErrorToString(error).c_str()); const std::string& local_id = directory_fetch_info.local_id(); LoadCallbackMap::iterator it = pending_load_callback_.find(local_id); if (it != pending_load_callback_.end()) { DVLOG(1) << ""Running callback for "" << local_id; const std::vector& callbacks = it->second; for (size_t i = 0; i < callbacks.size(); ++i) { base::MessageLoopProxy::current()->PostTask( FROM_HERE, base::Bind(callbacks[i], error)); } pending_load_callback_.erase(it); } } ",0 "static void computeLogicalLeftPositionedOffset(int& logicalLeftPos, const RenderBox* child, int logicalWidthValue, const RenderBoxModelObject* containerBlock, int containerLogicalWidth) { if (containerBlock->isHorizontalWritingMode() != child->isHorizontalWritingMode() && containerBlock->style()->isFlippedBlocksWritingMode()) { logicalLeftPos = containerLogicalWidth - logicalWidthValue - logicalLeftPos; logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderRight() : containerBlock->borderBottom()); } else logicalLeftPos += (child->isHorizontalWritingMode() ? containerBlock->borderLeft() : containerBlock->borderTop()); } ",0 "int usbnet_write_cmd(struct usbnet *dev, u8 cmd, u8 reqtype, u16 value, u16 index, const void *data, u16 size) { int ret; if (usb_autopm_get_interface(dev->intf) < 0) return -ENODEV; ret = __usbnet_write_cmd(dev, cmd, reqtype, value, index, data, size); usb_autopm_put_interface(dev->intf); return ret; } ",0 "void GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM( GLenum target, GLint image_id) { TRACE_EVENT0(""gpu"", ""GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM""); TextureRef* texture_ref = texture_manager()->GetTextureInfoForTargetUnlessDefault(&state_, target); if (!texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glReleaseTexImage2DCHROMIUM"", ""no texture bound""); return; } gl::GLImage* image = image_manager()->LookupImage(image_id); if (!image) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glReleaseTexImage2DCHROMIUM"", ""no image found with the given ID""); return; } Texture::ImageState image_state; if (texture_ref->texture()->GetLevelImage(target, 0, &image_state) != image) return; if (image_state == Texture::BOUND) { ScopedGLErrorSuppressor suppressor( ""GLES2DecoderImpl::DoReleaseTexImage2DCHROMIUM"", error_state_.get()); image->ReleaseTexImage(target); texture_manager()->SetLevelInfo(texture_ref, target, 0, GL_RGBA, 0, 0, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, gfx::Rect()); } texture_manager()->SetLevelImage(texture_ref, target, 0, nullptr, Texture::UNBOUND); } ",0 "static void cma_set_loopback(struct sockaddr *addr) { switch (addr->sa_family) { case AF_INET: ((struct sockaddr_in *) addr)->sin_addr.s_addr = htonl(INADDR_LOOPBACK); break; case AF_INET6: ipv6_addr_set(&((struct sockaddr_in6 *) addr)->sin6_addr, 0, 0, 0, htonl(1)); break; default: ib_addr_set(&((struct sockaddr_ib *) addr)->sib_addr, 0, 0, 0, htonl(1)); break; } } ",0 "etheraddr_string(netdissect_options *ndo, register const u_char *ep) { register int i; register char *cp; register struct enamemem *tp; int oui; char buf[BUFSIZE]; tp = lookup_emem(ndo, ep); if (tp->e_name) return (tp->e_name); #ifdef USE_ETHER_NTOHOST if (!ndo->ndo_nflag) { char buf2[BUFSIZE]; if (ether_ntohost(buf2, (const struct ether_addr *)ep) == 0) { tp->e_name = strdup(buf2); if (tp->e_name == NULL) (*ndo->ndo_error)(ndo, ""etheraddr_string: strdup(buf2)""); return (tp->e_name); } } #endif cp = buf; oui = EXTRACT_24BITS(ep); *cp++ = hex[*ep >> 4 ]; *cp++ = hex[*ep++ & 0xf]; for (i = 5; --i >= 0;) { *cp++ = ':'; *cp++ = hex[*ep >> 4 ]; *cp++ = hex[*ep++ & 0xf]; } if (!ndo->ndo_nflag) { snprintf(cp, BUFSIZE - (2 + 5*3), "" (oui %s)"", tok2str(oui_values, ""Unknown"", oui)); } else *cp = '\0'; tp->e_name = strdup(buf); if (tp->e_name == NULL) (*ndo->ndo_error)(ndo, ""etheraddr_string: strdup(buf)""); return (tp->e_name); } ",0 "static void coeff_filter(double *coeff, int n, const double kernel[4]) { double prev1 = coeff[1], prev2 = coeff[2], prev3 = coeff[3]; for (int i = 0; i <= n; ++i) { double res = coeff[i + 0] * kernel[0] + (prev1 + coeff[i + 1]) * kernel[1] + (prev2 + coeff[i + 2]) * kernel[2] + (prev3 + coeff[i + 3]) * kernel[3]; prev3 = prev2; prev2 = prev1; prev1 = coeff[i]; coeff[i] = res; } } ",0 "another_hunk (enum diff difftype, bool rev) { char *s; lin context = 0; size_t chars_read; char numbuf0[LINENUM_LENGTH_BOUND + 1]; char numbuf1[LINENUM_LENGTH_BOUND + 1]; char numbuf2[LINENUM_LENGTH_BOUND + 1]; char numbuf3[LINENUM_LENGTH_BOUND + 1]; set_hunkmax(); while (p_end >= 0) { if (p_end == p_efake) p_end = p_bfake; /* don't free twice */ else free(p_line[p_end]); p_end--; } assert(p_end == -1); p_efake = -1; if (p_c_function) { free (p_c_function); p_c_function = NULL; } p_max = hunkmax; /* gets reduced when --- found */ if (difftype == CONTEXT_DIFF || difftype == NEW_CONTEXT_DIFF) { file_offset line_beginning = file_tell (pfp); /* file pos of the current line */ lin repl_beginning = 0; /* index of --- line */ lin fillcnt = 0; /* #lines of missing ptrn or repl */ lin fillsrc; /* index of first line to copy */ lin filldst; /* index of first missing line */ bool ptrn_spaces_eaten = false; /* ptrn was slightly misformed */ bool some_context = false; /* (perhaps internal) context seen */ bool repl_could_be_missing = true; bool ptrn_missing = false; /* The pattern was missing. */ bool repl_missing = false; /* Likewise for replacement. */ file_offset repl_backtrack_position = 0; /* file pos of first repl line */ lin repl_patch_line; /* input line number for same */ lin repl_context; /* context for same */ lin ptrn_prefix_context = -1; /* lines in pattern prefix context */ lin ptrn_suffix_context = -1; /* lines in pattern suffix context */ lin repl_prefix_context = -1; /* lines in replac. prefix context */ lin ptrn_copiable = 0; /* # of copiable lines in ptrn */ lin repl_copiable = 0; /* Likewise for replacement. */ /* Pacify 'gcc -Wall'. */ fillsrc = filldst = repl_patch_line = repl_context = 0; chars_read = get_line (); if (chars_read == (size_t) -1 || chars_read <= 8 || strncmp (buf, ""********"", 8) != 0) { next_intuit_at(line_beginning,p_input_line); return chars_read == (size_t) -1 ? -1 : 0; } s = buf; while (*s == '*') s++; if (*s == ' ') { p_c_function = s; while (*s != '\n') s++; *s = '\0'; p_c_function = savestr (p_c_function); if (! p_c_function) return -1; } p_hunk_beg = p_input_line + 1; while (p_end < p_max) { chars_read = get_line (); if (chars_read == (size_t) -1) return -1; if (!chars_read) { if (repl_beginning && repl_could_be_missing) { repl_missing = true; goto hunk_done; } if (p_max - p_end < 4) { strcpy (buf, "" \n""); /* assume blank lines got chopped */ chars_read = 3; } else { fatal (""unexpected end of file in patch""); } } p_end++; if (p_end == hunkmax) fatal (""unterminated hunk starting at line %s; giving up at line %s: %s"", format_linenum (numbuf0, pch_hunk_beg ()), format_linenum (numbuf1, p_input_line), buf); assert(p_end < hunkmax); p_Char[p_end] = *buf; p_len[p_end] = 0; p_line[p_end] = 0; switch (*buf) { case '*': if (strnEQ(buf, ""********"", 8)) { if (repl_beginning && repl_could_be_missing) { repl_missing = true; goto hunk_done; } else fatal (""unexpected end of hunk at line %s"", format_linenum (numbuf0, p_input_line)); } if (p_end != 0) { if (repl_beginning && repl_could_be_missing) { repl_missing = true; goto hunk_done; } fatal (""unexpected '***' at line %s: %s"", format_linenum (numbuf0, p_input_line), buf); } context = 0; p_len[p_end] = strlen (buf); if (! (p_line[p_end] = savestr (buf))) { p_end--; return -1; } for (s = buf; *s && !ISDIGIT (*s); s++) /* do nothing */ ; if (strnEQ(s,""0,0"",3)) remove_prefix (s, 2); s = scan_linenum (s, &p_first); if (*s == ',') { while (*s && !ISDIGIT (*s)) s++; scan_linenum (s, &p_ptrn_lines); p_ptrn_lines += 1 - p_first; if (p_ptrn_lines < 0) malformed (); } else if (p_first) p_ptrn_lines = 1; else { p_ptrn_lines = 0; p_first = 1; } if (p_first >= LINENUM_MAX - p_ptrn_lines || p_ptrn_lines >= LINENUM_MAX - 6) malformed (); p_max = p_ptrn_lines + 6; /* we need this much at least */ while (p_max + 1 >= hunkmax) if (! grow_hunkmax ()) return -1; p_max = hunkmax; break; case '-': if (buf[1] != '-') goto change_line; if (ptrn_prefix_context == -1) ptrn_prefix_context = context; ptrn_suffix_context = context; if (repl_beginning || (p_end != p_ptrn_lines + 1 + (p_Char[p_end - 1] == '\n'))) { if (p_end == 1) { /* 'Old' lines were omitted. Set up to fill them in from 'new' context lines. */ ptrn_missing = true; p_end = p_ptrn_lines + 1; ptrn_prefix_context = ptrn_suffix_context = -1; fillsrc = p_end + 1; filldst = 1; fillcnt = p_ptrn_lines; } else if (! repl_beginning) fatal (""%s '---' at line %s; check line numbers at line %s"", (p_end <= p_ptrn_lines ? ""Premature"" : ""Overdue""), format_linenum (numbuf0, p_input_line), format_linenum (numbuf1, p_hunk_beg)); else if (! repl_could_be_missing) fatal (""duplicate '---' at line %s; check line numbers at line %s"", format_linenum (numbuf0, p_input_line), format_linenum (numbuf1, p_hunk_beg + repl_beginning)); else { repl_missing = true; goto hunk_done; } } repl_beginning = p_end; repl_backtrack_position = file_tell (pfp); repl_patch_line = p_input_line; repl_context = context; p_len[p_end] = strlen (buf); if (! (p_line[p_end] = savestr (buf))) { p_end--; return -1; } p_Char[p_end] = '='; for (s = buf; *s && ! ISDIGIT (*s); s++) /* do nothing */ ; s = scan_linenum (s, &p_newfirst); if (*s == ',') { do { if (!*++s) malformed (); } while (! ISDIGIT (*s)); scan_linenum (s, &p_repl_lines); p_repl_lines += 1 - p_newfirst; if (p_repl_lines < 0) malformed (); } else if (p_newfirst) p_repl_lines = 1; else { p_repl_lines = 0; p_newfirst = 1; } if (p_newfirst >= LINENUM_MAX - p_repl_lines || p_repl_lines >= LINENUM_MAX - p_end) malformed (); p_max = p_repl_lines + p_end; while (p_max + 1 >= hunkmax) if (! grow_hunkmax ()) return -1; if (p_repl_lines != ptrn_copiable && (p_prefix_context != 0 || context != 0 || p_repl_lines != 1)) repl_could_be_missing = false; context = 0; break; case '+': case '!': repl_could_be_missing = false; change_line: s = buf + 1; chars_read--; if (*s == '\n' && canonicalize_ws) { strcpy (s, "" \n""); chars_read = 2; } if (*s == ' ' || *s == '\t') { s++; chars_read--; } else if (repl_beginning && repl_could_be_missing) { repl_missing = true; goto hunk_done; } if (! repl_beginning) { if (ptrn_prefix_context == -1) ptrn_prefix_context = context; } else { if (repl_prefix_context == -1) repl_prefix_context = context; } chars_read -= (1 < chars_read && p_end == (repl_beginning ? p_max : p_ptrn_lines) && incomplete_line ()); p_len[p_end] = chars_read; p_line[p_end] = savebuf (s, chars_read); if (chars_read && ! p_line[p_end]) { p_end--; return -1; } context = 0; break; case '\t': case '\n': /* assume spaces got eaten */ s = buf; if (*buf == '\t') { s++; chars_read--; } if (repl_beginning && repl_could_be_missing && (!ptrn_spaces_eaten || difftype == NEW_CONTEXT_DIFF) ) { repl_missing = true; goto hunk_done; } chars_read -= (1 < chars_read && p_end == (repl_beginning ? p_max : p_ptrn_lines) && incomplete_line ()); p_len[p_end] = chars_read; p_line[p_end] = savebuf (buf, chars_read); if (chars_read && ! p_line[p_end]) { p_end--; return -1; } if (p_end != p_ptrn_lines + 1) { ptrn_spaces_eaten |= (repl_beginning != 0); some_context = true; context++; if (repl_beginning) repl_copiable++; else ptrn_copiable++; p_Char[p_end] = ' '; } break; case ' ': s = buf + 1; chars_read--; if (*s == '\n' && canonicalize_ws) { strcpy (s, ""\n""); chars_read = 2; } if (*s == ' ' || *s == '\t') { s++; chars_read--; } else if (repl_beginning && repl_could_be_missing) { repl_missing = true; goto hunk_done; } some_context = true; context++; if (repl_beginning) repl_copiable++; else ptrn_copiable++; chars_read -= (1 < chars_read && p_end == (repl_beginning ? p_max : p_ptrn_lines) && incomplete_line ()); p_len[p_end] = chars_read; p_line[p_end] = savebuf (s, chars_read); if (chars_read && ! p_line[p_end]) { p_end--; return -1; } break; default: if (repl_beginning && repl_could_be_missing) { repl_missing = true; goto hunk_done; } malformed (); } } hunk_done: if (p_end >=0 && !repl_beginning) fatal (""no '---' found in patch at line %s"", format_linenum (numbuf0, pch_hunk_beg ())); if (repl_missing) { /* reset state back to just after --- */ p_input_line = repl_patch_line; context = repl_context; for (p_end--; p_end > repl_beginning; p_end--) free(p_line[p_end]); Fseek (pfp, repl_backtrack_position, SEEK_SET); /* redundant 'new' context lines were omitted - set */ /* up to fill them in from the old file context */ fillsrc = 1; filldst = repl_beginning+1; fillcnt = p_repl_lines; p_end = p_max; } else if (! ptrn_missing && ptrn_copiable != repl_copiable) fatal (""context mangled in hunk at line %s"", format_linenum (numbuf0, p_hunk_beg)); else if (!some_context && fillcnt == 1) { /* the first hunk was a null hunk with no context */ /* and we were expecting one line -- fix it up. */ while (filldst < p_end) { p_line[filldst] = p_line[filldst+1]; p_Char[filldst] = p_Char[filldst+1]; p_len[filldst] = p_len[filldst+1]; filldst++; } #if 0 repl_beginning--; /* this doesn't need to be fixed */ #endif p_end--; p_first++; /* do append rather than insert */ fillcnt = 0; p_ptrn_lines = 0; } p_prefix_context = ((repl_prefix_context == -1 || (ptrn_prefix_context != -1 && ptrn_prefix_context < repl_prefix_context)) ? ptrn_prefix_context : repl_prefix_context); p_suffix_context = ((ptrn_suffix_context != -1 && ptrn_suffix_context < context) ? ptrn_suffix_context : context); if (p_prefix_context == -1 || p_suffix_context == -1) fatal (""replacement text or line numbers mangled in hunk at line %s"", format_linenum (numbuf0, p_hunk_beg)); if (difftype == CONTEXT_DIFF && (fillcnt || (p_first > 1 && p_prefix_context + p_suffix_context < ptrn_copiable))) { if (verbosity == VERBOSE) say (""%s\n%s\n%s\n"", ""(Fascinating -- this is really a new-style context diff but without"", ""the telltale extra asterisks on the *** line that usually indicate"", ""the new style...)""); diff_type = difftype = NEW_CONTEXT_DIFF; } /* if there were omitted context lines, fill them in now */ if (fillcnt) { p_bfake = filldst; /* remember where not to free() */ p_efake = filldst + fillcnt - 1; while (fillcnt-- > 0) { while (fillsrc <= p_end && fillsrc != repl_beginning && p_Char[fillsrc] != ' ') fillsrc++; if (p_end < fillsrc || fillsrc == repl_beginning) { fatal (""replacement text or line numbers mangled in hunk at line %s"", format_linenum (numbuf0, p_hunk_beg)); } p_line[filldst] = p_line[fillsrc]; p_Char[filldst] = p_Char[fillsrc]; p_len[filldst] = p_len[fillsrc]; fillsrc++; filldst++; } while (fillsrc <= p_end && fillsrc != repl_beginning) { if (p_Char[fillsrc] == ' ') fatal (""replacement text or line numbers mangled in hunk at line %s"", format_linenum (numbuf0, p_hunk_beg)); fillsrc++; } if (debug & 64) printf (""fillsrc %s, filldst %s, rb %s, e+1 %s\n"", format_linenum (numbuf0, fillsrc), format_linenum (numbuf1, filldst), format_linenum (numbuf2, repl_beginning), format_linenum (numbuf3, p_end + 1)); assert(fillsrc==p_end+1 || fillsrc==repl_beginning); assert(filldst==p_end+1 || filldst==repl_beginning); } } else if (difftype == UNI_DIFF) { file_offset line_beginning = file_tell (pfp); /* file pos of the current line */ lin fillsrc; /* index of old lines */ lin filldst; /* index of new lines */ char ch = '\0'; chars_read = get_line (); if (chars_read == (size_t) -1 || chars_read <= 4 || strncmp (buf, ""@@ -"", 4) != 0) { next_intuit_at(line_beginning,p_input_line); return chars_read == (size_t) -1 ? -1 : 0; } s = scan_linenum (buf + 4, &p_first); if (*s == ',') s = scan_linenum (s + 1, &p_ptrn_lines); else p_ptrn_lines = 1; if (p_first >= LINENUM_MAX - p_ptrn_lines) malformed (); if (*s == ' ') s++; if (*s != '+') malformed (); s = scan_linenum (s + 1, &p_newfirst); if (*s == ',') s = scan_linenum (s + 1, &p_repl_lines); else p_repl_lines = 1; if (p_newfirst >= LINENUM_MAX - p_repl_lines) malformed (); if (*s == ' ') s++; if (*s++ != '@') malformed (); if (*s++ == '@' && *s == ' ') { p_c_function = s; while (*s != '\n') s++; *s = '\0'; p_c_function = savestr (p_c_function); if (! p_c_function) return -1; } if (!p_ptrn_lines) p_first++; /* do append rather than insert */ if (!p_repl_lines) p_newfirst++; if (p_ptrn_lines >= LINENUM_MAX - (p_repl_lines + 1)) malformed (); p_max = p_ptrn_lines + p_repl_lines + 1; while (p_max + 1 >= hunkmax) if (! grow_hunkmax ()) return -1; fillsrc = 1; filldst = fillsrc + p_ptrn_lines; p_end = filldst + p_repl_lines; sprintf (buf, ""*** %s,%s ****\n"", format_linenum (numbuf0, p_first), format_linenum (numbuf1, p_first + p_ptrn_lines - 1)); p_len[0] = strlen (buf); if (! (p_line[0] = savestr (buf))) { p_end = -1; return -1; } p_Char[0] = '*'; sprintf (buf, ""--- %s,%s ----\n"", format_linenum (numbuf0, p_newfirst), format_linenum (numbuf1, p_newfirst + p_repl_lines - 1)); p_len[filldst] = strlen (buf); if (! (p_line[filldst] = savestr (buf))) { p_end = 0; return -1; } p_Char[filldst++] = '='; p_prefix_context = -1; p_hunk_beg = p_input_line + 1; while (fillsrc <= p_ptrn_lines || filldst <= p_end) { chars_read = get_line (); if (!chars_read) { if (p_max - filldst < 3) { strcpy (buf, "" \n""); /* assume blank lines got chopped */ chars_read = 2; } else { fatal (""unexpected end of file in patch""); } } if (chars_read == (size_t) -1) s = 0; else if (*buf == '\t' || *buf == '\n') { ch = ' '; /* assume the space got eaten */ s = savebuf (buf, chars_read); } else { ch = *buf; s = savebuf (buf+1, --chars_read); } if (chars_read && ! s) { while (--filldst > p_ptrn_lines) free(p_line[filldst]); p_end = fillsrc-1; return -1; } switch (ch) { case '-': if (fillsrc > p_ptrn_lines) { free(s); p_end = filldst-1; malformed (); } chars_read -= fillsrc == p_ptrn_lines && incomplete_line (); p_Char[fillsrc] = ch; p_line[fillsrc] = s; p_len[fillsrc++] = chars_read; break; case '=': ch = ' '; /* FALL THROUGH */ case ' ': if (fillsrc > p_ptrn_lines) { free(s); while (--filldst > p_ptrn_lines) free(p_line[filldst]); p_end = fillsrc-1; malformed (); } context++; chars_read -= fillsrc == p_ptrn_lines && incomplete_line (); p_Char[fillsrc] = ch; p_line[fillsrc] = s; p_len[fillsrc++] = chars_read; s = savebuf (s, chars_read); if (chars_read && ! s) { while (--filldst > p_ptrn_lines) free(p_line[filldst]); p_end = fillsrc-1; return -1; } /* FALL THROUGH */ case '+': if (filldst > p_end) { free(s); while (--filldst > p_ptrn_lines) free(p_line[filldst]); p_end = fillsrc-1; malformed (); } chars_read -= filldst == p_end && incomplete_line (); p_Char[filldst] = ch; p_line[filldst] = s; p_len[filldst++] = chars_read; break; default: p_end = filldst; malformed (); } if (ch != ' ') { if (p_prefix_context == -1) p_prefix_context = context; context = 0; } }/* while */ if (p_prefix_context == -1) malformed (); p_suffix_context = context; } else { /* normal diff--fake it up */ char hunk_type; int i; lin min, max; file_offset line_beginning = file_tell (pfp); p_prefix_context = p_suffix_context = 0; chars_read = get_line (); if (chars_read == (size_t) -1 || !chars_read || !ISDIGIT (*buf)) { next_intuit_at(line_beginning,p_input_line); return chars_read == (size_t) -1 ? -1 : 0; } s = scan_linenum (buf, &p_first); if (*s == ',') { s = scan_linenum (s + 1, &p_ptrn_lines); p_ptrn_lines += 1 - p_first; } else p_ptrn_lines = (*s != 'a'); if (p_first >= LINENUM_MAX - p_ptrn_lines) malformed (); hunk_type = *s; if (hunk_type == 'a') p_first++; /* do append rather than insert */ s = scan_linenum (s + 1, &min); if (*s == ',') scan_linenum (s + 1, &max); else max = min; if (min > max || max - min == LINENUM_MAX) malformed (); if (hunk_type == 'd') min++; p_newfirst = min; p_repl_lines = max - min + 1; if (p_newfirst >= LINENUM_MAX - p_repl_lines) malformed (); if (p_ptrn_lines >= LINENUM_MAX - (p_repl_lines + 1)) malformed (); p_end = p_ptrn_lines + p_repl_lines + 1; while (p_end + 1 >= hunkmax) if (! grow_hunkmax ()) { p_end = -1; return -1; } sprintf (buf, ""*** %s,%s\n"", format_linenum (numbuf0, p_first), format_linenum (numbuf1, p_first + p_ptrn_lines - 1)); p_len[0] = strlen (buf); if (! (p_line[0] = savestr (buf))) { p_end = -1; return -1; } p_Char[0] = '*'; for (i=1; i<=p_ptrn_lines; i++) { chars_read = get_line (); if (chars_read == (size_t) -1) { p_end = i - 1; return -1; } if (!chars_read) fatal (""unexpected end of file in patch at line %s"", format_linenum (numbuf0, p_input_line)); if (buf[0] != '<' || (buf[1] != ' ' && buf[1] != '\t')) fatal (""'<' followed by space or tab expected at line %s of patch"", format_linenum (numbuf0, p_input_line)); chars_read -= 2 + (i == p_ptrn_lines && incomplete_line ()); p_len[i] = chars_read; p_line[i] = savebuf (buf + 2, chars_read); if (chars_read && ! p_line[i]) { p_end = i-1; return -1; } p_Char[i] = '-'; } if (hunk_type == 'c') { chars_read = get_line (); if (chars_read == (size_t) -1) { p_end = i - 1; return -1; } if (! chars_read) fatal (""unexpected end of file in patch at line %s"", format_linenum (numbuf0, p_input_line)); if (*buf != '-') fatal (""'---' expected at line %s of patch"", format_linenum (numbuf0, p_input_line)); } sprintf (buf, ""--- %s,%s\n"", format_linenum (numbuf0, min), format_linenum (numbuf1, max)); p_len[i] = strlen (buf); if (! (p_line[i] = savestr (buf))) { p_end = i-1; return -1; } p_Char[i] = '='; for (i++; i<=p_end; i++) { chars_read = get_line (); if (chars_read == (size_t) -1) { p_end = i - 1; return -1; } if (!chars_read) fatal (""unexpected end of file in patch at line %s"", format_linenum (numbuf0, p_input_line)); if (buf[0] != '>' || (buf[1] != ' ' && buf[1] != '\t')) fatal (""'>' followed by space or tab expected at line %s of patch"", format_linenum (numbuf0, p_input_line)); chars_read -= 2 + (i == p_end && incomplete_line ()); p_len[i] = chars_read; p_line[i] = savebuf (buf + 2, chars_read); if (chars_read && ! p_line[i]) { p_end = i-1; return -1; } p_Char[i] = '+'; } } if (rev) /* backwards patch? */ if (!pch_swap()) say (""Not enough memory to swap next hunk!\n""); assert (p_end + 1 < hunkmax); p_Char[p_end + 1] = '^'; /* add a stopper for apply_hunk */ if (debug & 2) { lin i; for (i = 0; i <= p_end + 1; i++) { fprintf (stderr, ""%s %c"", format_linenum (numbuf0, i), p_Char[i]); if (p_Char[i] == '*') fprintf (stderr, "" %s,%s\n"", format_linenum (numbuf0, p_first), format_linenum (numbuf1, p_ptrn_lines)); else if (p_Char[i] == '=') fprintf (stderr, "" %s,%s\n"", format_linenum (numbuf0, p_newfirst), format_linenum (numbuf1, p_repl_lines)); else if (p_Char[i] != '^') { fputs("" |"", stderr); pch_write_line (i, stderr); } else fputc('\n', stderr); } fflush (stderr); } return 1; } ",0 "void RenderWidgetHostImpl::Shutdown() { RejectMouseLockOrUnlockIfNecessary(); if (process_->HasConnection()) { bool rv = Send(new ViewMsg_Close(routing_id_)); DCHECK(rv); } Destroy(); } ",0 " ~ClearNetworkErrorLoggingTester() { net::URLRequestContext* request_context = profile_->GetRequestContext()->GetURLRequestContext(); DCHECK_EQ(delegate_.get(), request_context->network_error_logging_delegate()); request_context->set_network_error_logging_delegate(nullptr); } ",0 "static MagickBooleanType AcquireQuantumPixels(QuantumInfo *quantum_info, const size_t extent) { register ssize_t i; assert(quantum_info != (QuantumInfo *) NULL); assert(quantum_info->signature == MagickSignature); quantum_info->number_threads=(size_t) GetMagickResourceLimit(ThreadResource); quantum_info->pixels=(unsigned char **) AcquireQuantumMemory( quantum_info->number_threads,sizeof(*quantum_info->pixels)); if (quantum_info->pixels == (unsigned char **) NULL) return(MagickFalse); quantum_info->extent=extent; (void) ResetMagickMemory(quantum_info->pixels,0,quantum_info->number_threads* sizeof(*quantum_info->pixels)); for (i=0; i < (ssize_t) quantum_info->number_threads; i++) { quantum_info->pixels[i]=(unsigned char *) AcquireQuantumMemory(extent+1, sizeof(**quantum_info->pixels)); if (quantum_info->pixels[i] == (unsigned char *) NULL) { while (--i >= 0) quantum_info->pixels[i]=(unsigned char *) RelinquishMagickMemory( quantum_info->pixels[i]); return(MagickFalse); } (void) ResetMagickMemory(quantum_info->pixels[i],0,(extent+1)* sizeof(**quantum_info->pixels)); quantum_info->pixels[i][extent]=QuantumSignature; } return(MagickTrue); } ",0 "WebCore::FloatRect ewk_view_page_rect_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET(ewkView, smartData); EWK_VIEW_PRIV_GET(smartData, priv); WebCore::Frame* main_frame = priv->page->mainFrame(); return main_frame->view()->frameRect(); } ",0 "static int parsePCPOption(uint8_t* pcp_buf, int remain, pcp_info_t *pcp_msg_info) { #ifdef DEBUG char third_addr[INET6_ADDRSTRLEN]; #endif /* DEBUG */ unsigned short option_length; /* Do centralized option sanity checks here. */ if (remain < (int)PCP_OPTION_HDR_SIZE) { pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION; return 0; } option_length = READNU16(pcp_buf + 2) + 4; /* len */ if (remain < option_length) { pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION; return 0; } switch (pcp_buf[0]) { /* code */ case PCP_OPTION_3RD_PARTY: if (option_length != PCP_3RD_PARTY_OPTION_SIZE) { pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION; return 0; } #ifdef DEBUG syslog(LOG_DEBUG, ""PCP OPTION: \t Third party\n""); syslog(LOG_DEBUG, ""Third PARTY IP: \t %s\n"", inet_ntop(AF_INET6, pcp_buf + 4, third_addr, INET6_ADDRSTRLEN)); #endif if (pcp_msg_info->thirdp_ip ) { syslog(LOG_ERR, ""PCP: THIRD PARTY OPTION was already present. \n""); pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION; return 0; } else { pcp_msg_info->thirdp_ip = (struct in6_addr *)(pcp_buf + 4); pcp_msg_info->mapped_ip = (struct in6_addr *)(pcp_buf + 4); } break; case PCP_OPTION_PREF_FAIL: if (option_length != PCP_PREFER_FAIL_OPTION_SIZE) { pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION; return 0; } #ifdef DEBUG syslog(LOG_DEBUG, ""PCP OPTION: \t Prefer failure \n""); #endif if (pcp_msg_info->opcode != PCP_OPCODE_MAP) { syslog(LOG_DEBUG, ""PCP: Unsupported OPTION for given OPCODE.\n""); pcp_msg_info->result_code = PCP_ERR_MALFORMED_REQUEST; } if (pcp_msg_info->pfailure_present != 0 ) { syslog(LOG_DEBUG, ""PCP: PREFER FAILURE OPTION was already present.\n""); pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION; } else { pcp_msg_info->pfailure_present = 1; } break; case PCP_OPTION_FILTER: /* TODO fully implement filter */ if (option_length != PCP_FILTER_OPTION_SIZE) { pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION; return 0; } #ifdef DEBUG syslog(LOG_DEBUG, ""PCP OPTION: \t Filter\n""); #endif if (pcp_msg_info->opcode != PCP_OPCODE_MAP) { syslog(LOG_ERR, ""PCP: Unsupported OPTION for given OPCODE.\n""); pcp_msg_info->result_code = PCP_ERR_MALFORMED_REQUEST; return 0; } break; #ifdef PCP_FLOWP case PCP_OPTION_FLOW_PRIORITY: #ifdef DEBUG syslog(LOG_DEBUG, ""PCP OPTION: \t Flow priority\n""); #endif if (option_length != PCP_FLOW_PRIORITY_OPTION_SIZE) { syslog(LOG_ERR, ""PCP: Error processing DSCP. sizeof %d and remaining %d. flow len %d \n"", PCP_FLOW_PRIORITY_OPTION_SIZE, remain, READNU16(pcp_buf + 2)); pcp_msg_info->result_code = PCP_ERR_MALFORMED_OPTION; return 0; } #ifdef DEBUG syslog(LOG_DEBUG, ""DSCP UP: \t %d\n"", pcp_buf[4]); syslog(LOG_DEBUG, ""DSCP DOWN: \t %d\n"", pcp_buf[5]); #endif pcp_msg_info->dscp_up = pcp_buf[4]; pcp_msg_info->dscp_down = pcp_buf[5]; pcp_msg_info->flowp_present = 1; break; #endif default: if (pcp_buf[0] < 128) { syslog(LOG_ERR, ""PCP: Unrecognized mandatory PCP OPTION: %d \n"", (int)pcp_buf[0]); /* Mandatory to understand */ pcp_msg_info->result_code = PCP_ERR_UNSUPP_OPTION; remain = 0; break; } /* TODO - log optional not understood options? */ break; } return option_length; } ",0 "static void dwc3_resume_gadget(struct dwc3 *dwc) { if (dwc->gadget_driver && dwc->gadget_driver->resume) { spin_unlock(&dwc->lock); dwc->gadget_driver->resume(&dwc->gadget); spin_lock(&dwc->lock); } } ",0 "void RenderViewHostImpl::ClearFocusedNode() { Send(new ViewMsg_ClearFocusedNode(GetRoutingID())); } ",0 "kwsfree (kwset_t kws) { struct kwset *kwset; kwset = (struct kwset *) kws; obstack_free(&kwset->obstack, NULL); free(kws); } ",0 "QPointF QQuickWebViewPrivate::contentPos() const { Q_Q(const QQuickWebView); return QPointF(q->contentX(), q->contentY()); } ",0 "int vnc_send_framebuffer_update(VncState *vs, int x, int y, int w, int h) { int n = 0; switch(vs->vnc_encoding) { case VNC_ENCODING_ZLIB: n = vnc_zlib_send_framebuffer_update(vs, x, y, w, h); break; case VNC_ENCODING_HEXTILE: vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_HEXTILE); n = vnc_hextile_send_framebuffer_update(vs, x, y, w, h); break; case VNC_ENCODING_TIGHT: n = vnc_tight_send_framebuffer_update(vs, x, y, w, h); break; case VNC_ENCODING_TIGHT_PNG: n = vnc_tight_png_send_framebuffer_update(vs, x, y, w, h); break; case VNC_ENCODING_ZRLE: n = vnc_zrle_send_framebuffer_update(vs, x, y, w, h); break; case VNC_ENCODING_ZYWRLE: n = vnc_zywrle_send_framebuffer_update(vs, x, y, w, h); break; default: vnc_framebuffer_update(vs, x, y, w, h, VNC_ENCODING_RAW); n = vnc_raw_send_framebuffer_update(vs, x, y, w, h); break; } return n; } ",0 "PaintLayerScrollableArea::PreventRelayoutScope::NeedsRelayoutList() { DEFINE_STATIC_LOCAL( Persistent>>, needs_relayout_list, (MakeGarbageCollected>>())); return *needs_relayout_list; } ",0 "WebKitWebInspector* webkit_web_view_get_inspector(WebKitWebView* webView) { g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0); return webView->priv->webInspector.get(); } ",0 "static void perWorldMethodMethodForMainWorld(const v8::FunctionCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); imp->perWorldMethod(); } ",0 "char *php_http_url_to_string(const php_http_url_t *url, char **url_str, size_t *url_len, zend_bool persistent) { php_http_buffer_t buf; php_http_buffer_init_ex(&buf, PHP_HTTP_BUFFER_DEFAULT_SIZE, persistent ? PHP_HTTP_BUFFER_INIT_PERSISTENT : 0); if (url->scheme && *url->scheme) { php_http_buffer_appendl(&buf, url->scheme); php_http_buffer_appends(&buf, ""://""); } else if ((url->user && *url->user) || (url->host && *url->host)) { php_http_buffer_appends(&buf, ""//""); } if (url->user && *url->user) { php_http_buffer_appendl(&buf, url->user); if (url->pass && *url->pass) { php_http_buffer_appends(&buf, "":""); php_http_buffer_appendl(&buf, url->pass); } php_http_buffer_appends(&buf, ""@""); } if (url->host && *url->host) { php_http_buffer_appendl(&buf, url->host); if (url->port) { php_http_buffer_appendf(&buf, "":%hu"", url->port); } } if (url->path && *url->path) { if (*url->path != '/') { php_http_buffer_appends(&buf, ""/""); } php_http_buffer_appendl(&buf, url->path); } else if (buf.used) { php_http_buffer_appends(&buf, ""/""); } if (url->query && *url->query) { php_http_buffer_appends(&buf, ""?""); php_http_buffer_appendl(&buf, url->query); } if (url->fragment && *url->fragment) { php_http_buffer_appends(&buf, ""#""); php_http_buffer_appendl(&buf, url->fragment); } php_http_buffer_shrink(&buf); php_http_buffer_fix(&buf); if (url_len) { *url_len = buf.used; } if (url_str) { *url_str = buf.data; } return buf.data; } ",0 "pvscsi_request_cancelled(SCSIRequest *req) { PVSCSIRequest *pvscsi_req = req->hba_private; PVSCSIState *s = pvscsi_req->dev; if (pvscsi_req->completed) { return; } if (pvscsi_req->dev->resetting) { pvscsi_req->cmp.hostStatus = BTSTAT_BUSRESET; } else { pvscsi_req->cmp.hostStatus = BTSTAT_ABORTQUEUE; } pvscsi_complete_request(s, pvscsi_req); } ",0 "bool BrowserActionButton::OnMousePressed(const views::MouseEvent& e) { showing_context_menu_ = e.IsRightMouseButton(); if (showing_context_menu_) { SetButtonPushed(); gfx::Point point = gfx::Point(0, 0); ConvertPointToScreen(this, &point); point.Offset(0, height()); if (!context_menu_.get()) context_menu_.reset(new ExtensionActionContextMenu()); context_menu_->Run(extension(), point); SetButtonNotPushed(); return false; } else if (IsPopup()) { return MenuButton::OnMousePressed(e); } return TextButton::OnMousePressed(e); } ",0 "int blk_init_allocated_queue(struct request_queue *q) { WARN_ON_ONCE(q->mq_ops); q->fq = blk_alloc_flush_queue(q, NUMA_NO_NODE, q->cmd_size); if (!q->fq) return -ENOMEM; if (q->init_rq_fn && q->init_rq_fn(q, q->fq->flush_rq, GFP_KERNEL)) goto out_free_flush_queue; if (blk_init_rl(&q->root_rl, q, GFP_KERNEL)) goto out_exit_flush_rq; INIT_WORK(&q->timeout_work, blk_timeout_work); q->queue_flags |= QUEUE_FLAG_DEFAULT; /* * This also sets hw/phys segments, boundary and size */ blk_queue_make_request(q, blk_queue_bio); q->sg_reserved_size = INT_MAX; if (elevator_init(q)) goto out_exit_flush_rq; return 0; out_exit_flush_rq: if (q->exit_rq_fn) q->exit_rq_fn(q, q->fq->flush_rq); out_free_flush_queue: blk_free_flush_queue(q->fq); return -ENOMEM; } ",1 "static ssize_t ndp_to_end_show(struct device *d, struct device_attribute *attr, char *buf) { struct usbnet *dev = netdev_priv(to_net_dev(d)); struct cdc_ncm_ctx *ctx = (struct cdc_ncm_ctx *)dev->data[0]; return sprintf(buf, ""%c\n"", ctx->drvflags & CDC_NCM_FLAG_NDP_TO_END ? 'Y' : 'N'); } ",0 "static unsigned int find_next_to_unuse(struct swap_info_struct *si, unsigned int prev) { unsigned int max = si->max; unsigned int i = prev; unsigned char count; /* * No need for swap_lock here: we're just looking * for whether an entry is in use, not modifying it; false * hits are okay, and sys_swapoff() has already prevented new * allocations from this area (while holding swap_lock). */ for (;;) { if (++i >= max) { if (!prev) { i = 0; break; } /* * No entries in use at top of swap_map, * loop back to start and recheck there. */ max = prev + 1; prev = 0; i = 1; } count = si->swap_map[i]; if (count && swap_count(count) != SWAP_MAP_BAD) break; } return i; } ",0 "struct sock *sk_clone_lock(const struct sock *sk, const gfp_t priority) { struct sock *newsk; bool is_charged = true; newsk = sk_prot_alloc(sk->sk_prot, priority, sk->sk_family); if (newsk != NULL) { struct sk_filter *filter; sock_copy(newsk, sk); /* SANITY */ if (likely(newsk->sk_net_refcnt)) get_net(sock_net(newsk)); sk_node_init(&newsk->sk_node); sock_lock_init(newsk); bh_lock_sock(newsk); newsk->sk_backlog.head = newsk->sk_backlog.tail = NULL; newsk->sk_backlog.len = 0; atomic_set(&newsk->sk_rmem_alloc, 0); /* * sk_wmem_alloc set to one (see sk_free() and sock_wfree()) */ atomic_set(&newsk->sk_wmem_alloc, 1); atomic_set(&newsk->sk_omem_alloc, 0); skb_queue_head_init(&newsk->sk_receive_queue); skb_queue_head_init(&newsk->sk_write_queue); rwlock_init(&newsk->sk_callback_lock); lockdep_set_class_and_name(&newsk->sk_callback_lock, af_callback_keys + newsk->sk_family, af_family_clock_key_strings[newsk->sk_family]); newsk->sk_dst_cache = NULL; newsk->sk_wmem_queued = 0; newsk->sk_forward_alloc = 0; atomic_set(&newsk->sk_drops, 0); newsk->sk_send_head = NULL; newsk->sk_userlocks = sk->sk_userlocks & ~SOCK_BINDPORT_LOCK; sock_reset_flag(newsk, SOCK_DONE); skb_queue_head_init(&newsk->sk_error_queue); filter = rcu_dereference_protected(newsk->sk_filter, 1); if (filter != NULL) /* though it's an empty new sock, the charging may fail * if sysctl_optmem_max was changed between creation of * original socket and cloning */ is_charged = sk_filter_charge(newsk, filter); if (unlikely(!is_charged || xfrm_sk_clone_policy(newsk, sk))) { /* It is still raw copy of parent, so invalidate * destructor and make plain sk_free() */ newsk->sk_destruct = NULL; bh_unlock_sock(newsk); sk_free(newsk); newsk = NULL; goto out; } RCU_INIT_POINTER(newsk->sk_reuseport_cb, NULL); newsk->sk_err = 0; newsk->sk_err_soft = 0; newsk->sk_priority = 0; newsk->sk_incoming_cpu = raw_smp_processor_id(); atomic64_set(&newsk->sk_cookie, 0); mem_cgroup_sk_alloc(newsk); cgroup_sk_alloc(&newsk->sk_cgrp_data); /* * Before updating sk_refcnt, we must commit prior changes to memory * (Documentation/RCU/rculist_nulls.txt for details) */ smp_wmb(); atomic_set(&newsk->sk_refcnt, 2); /* * Increment the counter in the same struct proto as the master * sock (sk_refcnt_debug_inc uses newsk->sk_prot->socks, that * is the same as sk->sk_prot->socks, as this field was copied * with memcpy). * * This _changes_ the previous behaviour, where * tcp_create_openreq_child always was incrementing the * equivalent to tcp_prot->socks (inet_sock_nr), so this have * to be taken into account in all callers. -acme */ sk_refcnt_debug_inc(newsk); sk_set_socket(newsk, NULL); newsk->sk_wq = NULL; if (newsk->sk_prot->sockets_allocated) sk_sockets_allocated_inc(newsk); if (sock_needs_netstamp(sk) && newsk->sk_flags & SK_FLAGS_TIMESTAMP) net_enable_timestamp(); } out: return newsk; } ",0 "linux_md_create_data_new (DBusGMethodInvocation *context, Daemon *daemon, const char *first_component_objpath) { LinuxMdCreateData *data; data = g_new0 (LinuxMdCreateData, 1); data->refcount = 1; data->context = context; data->daemon = g_object_ref (daemon); data->first_component_objpath = g_strdup (first_component_objpath); return data; } ",0 "ProcPutImage(ClientPtr client) { GC *pGC; DrawablePtr pDraw; long length; /* length of scanline server padded */ long lengthProto; /* length of scanline protocol padded */ char *tmpImage; REQUEST(xPutImageReq); REQUEST_AT_LEAST_SIZE(xPutImageReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); if (stuff->format == XYBitmap) { if ((stuff->depth != 1) || (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad)) return BadMatch; length = BitmapBytePad(stuff->width + stuff->leftPad); } else if (stuff->format == XYPixmap) { if ((pDraw->depth != stuff->depth) || (stuff->leftPad >= (unsigned int) screenInfo.bitmapScanlinePad)) return BadMatch; length = BitmapBytePad(stuff->width + stuff->leftPad); length *= stuff->depth; } else if (stuff->format == ZPixmap) { if ((pDraw->depth != stuff->depth) || (stuff->leftPad != 0)) return BadMatch; length = PixmapBytePad(stuff->width, stuff->depth); } else { client->errorValue = stuff->format; return BadValue; } tmpImage = (char *) &stuff[1]; lengthProto = length; if (lengthProto >= (INT32_MAX / stuff->height)) return BadLength; if ((bytes_to_int32(lengthProto * stuff->height) + bytes_to_int32(sizeof(xPutImageReq))) != client->req_len) return BadLength; ReformatImage(tmpImage, lengthProto * stuff->height, stuff->format == ZPixmap ? BitsPerPixel(stuff->depth) : 1, ClientOrder(client)); (*pGC->ops->PutImage) (pDraw, pGC, stuff->depth, stuff->dstX, stuff->dstY, stuff->width, stuff->height, stuff->leftPad, stuff->format, tmpImage); return Success; } ",1 "status_t CameraService::BasicClient::finishCameraOps() { if (mOpsActive) { mAppOpsManager.finishOp(AppOpsManager::OP_CAMERA, mClientUid, mClientPackageName); mOpsActive = false; } mAppOpsManager.stopWatchingMode(mOpsCallback); mOpsCallback.clear(); return OK; } ",0 "static int crypto_cbc_setkey(struct crypto_tfm *parent, const u8 *key, unsigned int keylen) { struct crypto_cbc_ctx *ctx = crypto_tfm_ctx(parent); struct crypto_cipher *child = ctx->child; int err; crypto_cipher_clear_flags(child, CRYPTO_TFM_REQ_MASK); crypto_cipher_set_flags(child, crypto_tfm_get_flags(parent) & CRYPTO_TFM_REQ_MASK); err = crypto_cipher_setkey(child, key, keylen); crypto_tfm_set_flags(parent, crypto_cipher_get_flags(child) & CRYPTO_TFM_RES_MASK); return err; } ",0 "static void tg3_nvram_get_pagesize(struct tg3 *tp, u32 nvmcfg1) { switch (nvmcfg1 & NVRAM_CFG1_5752PAGE_SIZE_MASK) { case FLASH_5752PAGE_SIZE_256: tp->nvram_pagesize = 256; break; case FLASH_5752PAGE_SIZE_512: tp->nvram_pagesize = 512; break; case FLASH_5752PAGE_SIZE_1K: tp->nvram_pagesize = 1024; break; case FLASH_5752PAGE_SIZE_2K: tp->nvram_pagesize = 2048; break; case FLASH_5752PAGE_SIZE_4K: tp->nvram_pagesize = 4096; break; case FLASH_5752PAGE_SIZE_264: tp->nvram_pagesize = 264; break; case FLASH_5752PAGE_SIZE_528: tp->nvram_pagesize = 528; break; } } ",0 "image_transform_ini_end(PNG_CONST image_transform *this, transform_display *that) { UNUSED(this) UNUSED(that) } ",1 "static void ahci_reg_init(AHCIState *s) { int i; s->control_regs.cap = (s->ports - 1) | (AHCI_NUM_COMMAND_SLOTS << 8) | (AHCI_SUPPORTED_SPEED_GEN1 << AHCI_SUPPORTED_SPEED) | HOST_CAP_NCQ | HOST_CAP_AHCI; s->control_regs.impl = (1 << s->ports) - 1; s->control_regs.version = AHCI_VERSION_1_0; for (i = 0; i < s->ports; i++) { s->dev[i].port_state = STATE_RUN; } } ",0 "WebBackForwardListItem* WebProcessProxy::webBackForwardItem(uint64_t itemID) const { return m_backForwardListItemMap.get(itemID).get(); } ",0 "static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req) { __be32 *p; RESERVE_SPACE(4); WRITE32(OP_READLINK); return 0; } ",0 "COMPS_HSList* comps_objmrtree_keys(COMPS_ObjMRTree * rt) { return __comps_objmrtree_all(rt, 0); } ",0 "static void wakeupdispatch(struct tipc_port *tport) { struct sock *sk = (struct sock *)tport->usr_handle; sk->sk_write_space(sk); } ",0 "struct inode *btrfs_iget(struct super_block *s, struct btrfs_key *location, struct btrfs_root *root, int *new) { struct inode *inode; inode = btrfs_iget_locked(s, location, root); if (!inode) return ERR_PTR(-ENOMEM); if (inode->i_state & I_NEW) { btrfs_read_locked_inode(inode); if (!is_bad_inode(inode)) { inode_tree_add(inode); unlock_new_inode(inode); if (new) *new = 1; } else { unlock_new_inode(inode); iput(inode); inode = ERR_PTR(-ESTALE); } } return inode; } ",0 "static void run(const char* source_path, const char* label, uid_t uid, gid_t gid, userid_t userid, bool multi_user, bool full_write) { struct fuse_global global; struct fuse fuse_default; struct fuse fuse_read; struct fuse fuse_write; struct fuse_handler handler_default; struct fuse_handler handler_read; struct fuse_handler handler_write; pthread_t thread_default; pthread_t thread_read; pthread_t thread_write; memset(&global, 0, sizeof(global)); memset(&fuse_default, 0, sizeof(fuse_default)); memset(&fuse_read, 0, sizeof(fuse_read)); memset(&fuse_write, 0, sizeof(fuse_write)); memset(&handler_default, 0, sizeof(handler_default)); memset(&handler_read, 0, sizeof(handler_read)); memset(&handler_write, 0, sizeof(handler_write)); pthread_mutex_init(&global.lock, NULL); global.package_to_appid = hashmapCreate(256, str_hash, str_icase_equals); global.uid = uid; global.gid = gid; global.multi_user = multi_user; global.next_generation = 0; global.inode_ctr = 1; memset(&global.root, 0, sizeof(global.root)); global.root.nid = FUSE_ROOT_ID; /* 1 */ global.root.refcount = 2; global.root.namelen = strlen(source_path); global.root.name = strdup(source_path); global.root.userid = userid; global.root.uid = AID_ROOT; global.root.under_android = false; strcpy(global.source_path, source_path); if (multi_user) { global.root.perm = PERM_PRE_ROOT; snprintf(global.obb_path, sizeof(global.obb_path), ""%s/obb"", source_path); } else { global.root.perm = PERM_ROOT; snprintf(global.obb_path, sizeof(global.obb_path), ""%s/Android/obb"", source_path); } fuse_default.global = &global; fuse_read.global = &global; fuse_write.global = &global; global.fuse_default = &fuse_default; global.fuse_read = &fuse_read; global.fuse_write = &fuse_write; snprintf(fuse_default.dest_path, PATH_MAX, ""/mnt/runtime/default/%s"", label); snprintf(fuse_read.dest_path, PATH_MAX, ""/mnt/runtime/read/%s"", label); snprintf(fuse_write.dest_path, PATH_MAX, ""/mnt/runtime/write/%s"", label); handler_default.fuse = &fuse_default; handler_read.fuse = &fuse_read; handler_write.fuse = &fuse_write; handler_default.token = 0; handler_read.token = 1; handler_write.token = 2; umask(0); if (multi_user) { /* Multi-user storage is fully isolated per user, so ""other"" * permissions are completely masked off. */ if (fuse_setup(&fuse_default, AID_SDCARD_RW, 0006) || fuse_setup(&fuse_read, AID_EVERYBODY, 0027) || fuse_setup(&fuse_write, AID_EVERYBODY, full_write ? 0007 : 0027)) { ERROR(""failed to fuse_setup\n""); exit(1); } } else { /* Physical storage is readable by all users on device, but * the Android directories are masked off to a single user * deep inside attr_from_stat(). */ if (fuse_setup(&fuse_default, AID_SDCARD_RW, 0006) || fuse_setup(&fuse_read, AID_EVERYBODY, full_write ? 0027 : 0022) || fuse_setup(&fuse_write, AID_EVERYBODY, full_write ? 0007 : 0022)) { ERROR(""failed to fuse_setup\n""); exit(1); } } /* Drop privs */ if (setgroups(sizeof(kGroups) / sizeof(kGroups[0]), kGroups) < 0) { ERROR(""cannot setgroups: %s\n"", strerror(errno)); exit(1); } if (setgid(gid) < 0) { ERROR(""cannot setgid: %s\n"", strerror(errno)); exit(1); } if (setuid(uid) < 0) { ERROR(""cannot setuid: %s\n"", strerror(errno)); exit(1); } if (multi_user) { fs_prepare_dir(global.obb_path, 0775, uid, gid); } if (pthread_create(&thread_default, NULL, start_handler, &handler_default) || pthread_create(&thread_read, NULL, start_handler, &handler_read) || pthread_create(&thread_write, NULL, start_handler, &handler_write)) { ERROR(""failed to pthread_create\n""); exit(1); } watch_package_list(&global); ERROR(""terminated prematurely\n""); exit(1); } ",0 "void MSG_WriteDeltaFloat( msg_t *msg, float oldV, float newV ) { floatint_t fi; if ( oldV == newV ) { MSG_WriteBits( msg, 0, 1 ); return; } fi.f = newV; MSG_WriteBits( msg, 1, 1 ); MSG_WriteBits( msg, fi.i, 32 ); } ",0 " void GotAllCookies() { net::CookieList master_cookie_list; for (const auto& pair : cookies_) master_cookie_list.push_back(pair.second); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce(&CookieRetriever::SendCookiesResponseOnUI, this, master_cookie_list)); } ",0 "local void parallel_compress(void) { long seq; /* sequence number */ struct space *curr; /* input data to compress */ struct space *next; /* input data that follows curr */ struct space *hold; /* input data that follows next */ struct space *dict; /* dictionary for next compression */ struct job *job; /* job for compress, then write */ int more; /* true if more input to read */ unsigned hash; /* hash for rsyncable */ unsigned char *scan; /* next byte to compute hash on */ unsigned char *end; /* after end of data to compute hash on */ unsigned char *last; /* position after last hit */ size_t left; /* last hit in curr to end of curr */ size_t len; /* for various length computations */ /* if first time or after an option change, setup the job lists */ setup_jobs(); /* start write thread */ writeth = launch(write_thread, NULL); /* read from input and start compress threads (write thread will pick up the output of the compress threads) */ seq = 0; next = get_space(&in_pool); next->len = readn(g.ind, next->buf, next->size); hold = NULL; dict = NULL; scan = next->buf; hash = RSYNCHIT; left = 0; do { /* create a new job */ job = MALLOC(sizeof(struct job)); if (job == NULL) bail(""not enough memory"", """"); job->calc = new_lock(0); /* update input spaces */ curr = next; next = hold; hold = NULL; /* get more input if we don't already have some */ if (next == NULL) { next = get_space(&in_pool); next->len = readn(g.ind, next->buf, next->size); } /* if rsyncable, generate block lengths and prepare curr for job to likely have less than size bytes (up to the last hash hit) */ job->lens = NULL; if (g.rsync && curr->len) { /* compute the hash function starting where we last left off to cover either size bytes or to EOF, whichever is less, through the data in curr (and in the next loop, through next) -- save the block lengths resulting from the hash hits in the job->lens list */ if (left == 0) { /* scan is in curr */ last = curr->buf; end = curr->buf + curr->len; while (scan < end) { hash = ((hash << 1) ^ *scan++) & RSYNCMASK; if (hash == RSYNCHIT) { len = scan - last; append_len(job, len); last = scan; } } /* continue scan in next */ left = scan - last; scan = next->buf; } /* scan in next for enough bytes to fill curr, or what is available in next, whichever is less (if next isn't full, then we're at the end of the file) -- the bytes in curr since the last hit, stored in left, counts towards the size of the first block */ last = next->buf; len = curr->size - curr->len; if (len > next->len) len = next->len; end = next->buf + len; while (scan < end) { hash = ((hash << 1) ^ *scan++) & RSYNCMASK; if (hash == RSYNCHIT) { len = (scan - last) + left; left = 0; append_len(job, len); last = scan; } } append_len(job, 0); /* create input in curr for job up to last hit or entire buffer if no hits at all -- save remainder in next and possibly hold */ len = (job->lens->len == 1 ? scan : last) - next->buf; if (len) { /* got hits in next, or no hits in either -- copy to curr */ memcpy(curr->buf + curr->len, next->buf, len); curr->len += len; memmove(next->buf, next->buf + len, next->len - len); next->len -= len; scan -= len; left = 0; } else if (job->lens->len != 1 && left && next->len) { /* had hits in curr, but none in next, and last hit in curr wasn't right at the end, so we have input there to save -- use curr up to the last hit, save the rest, moving next to hold */ hold = next; next = get_space(&in_pool); memcpy(next->buf, curr->buf + (curr->len - left), left); next->len = left; curr->len -= left; } else { /* else, last match happened to be right at the end of curr, or we're at the end of the input compressing the rest */ left = 0; } } /* compress curr->buf to curr->len -- compress thread will drop curr */ job->in = curr; /* set job->more if there is more to compress after curr */ more = next->len != 0; job->more = more; /* provide dictionary for this job, prepare dictionary for next job */ job->out = dict; if (more && g.setdict) { if (curr->len >= DICT || job->out == NULL) { dict = curr; use_space(dict); } else { dict = get_space(&dict_pool); len = DICT - curr->len; memcpy(dict->buf, job->out->buf + (job->out->len - len), len); memcpy(dict->buf + len, curr->buf, curr->len); dict->len = DICT; } } /* preparation of job is complete */ job->seq = seq; Trace((""-- read #%ld%s"", seq, more ? """" : "" (last)"")); if (++seq < 1) bail(""input too long: "", g.inf); /* start another compress thread if needed */ if (cthreads < seq && cthreads < g.procs) { (void)launch(compress_thread, NULL); cthreads++; } /* put job at end of compress list, let all the compressors know */ possess(compress_have); job->next = NULL; *compress_tail = job; compress_tail = &(job->next); twist(compress_have, BY, +1); } while (more); drop_space(next); /* wait for the write thread to complete (we leave the compress threads out there and waiting in case there is another stream to compress) */ join(writeth); writeth = NULL; Trace((""-- write thread joined"")); } ",0 "CStarter::removeTempExecuteDir( void ) { if( is_gridshell ) { return true; } MyString dir_name = ""dir_""; dir_name += (int)daemonCore->getpid(); #if !defined(WIN32) if (condorPrivSepHelper() != NULL) { MyString path_name; path_name.sprintf(""%s/%s"", Execute, dir_name.Value()); if (!privsep_remove_dir(path_name.Value())) { dprintf(D_ALWAYS, ""privsep_remove_dir failed for %s\n"", path_name.Value()); return false; } return true; } #endif Directory execute_dir( Execute, PRIV_ROOT ); if ( execute_dir.Find_Named_Entry( dir_name.Value() ) ) { chdir(Execute); dprintf( D_FULLDEBUG, ""Removing %s%c%s\n"", Execute, DIR_DELIM_CHAR, dir_name.Value() ); return execute_dir.Remove_Current_File(); } return true; } ",0 "AuthBackend::AuthBackend() : QObject(nullptr) , d(new Private) { } ",0 "void WebMediaPlayerMS::ExitPictureInPicture( blink::WebMediaPlayer::PipWindowClosedCallback callback) { delegate_->DidPictureInPictureModeEnd(delegate_id_, std::move(callback)); OnPictureInPictureModeEnded(); } ",0 "RenderThreadImpl::GetGpuFactories() { DCHECK(IsMainThread()); scoped_refptr gpu_channel_host = GetGpuChannel(); const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); scoped_refptr gpu_factories; scoped_refptr media_task_runner = GetMediaThreadTaskRunner(); if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) { if (!gpu_va_context_provider_.get() || gpu_va_context_provider_->DestroyedOnMainThread()) { if (!gpu_channel_host.get()) { gpu_channel_host = EstablishGpuChannelSync( CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE); } blink::WebGraphicsContext3D::Attributes attributes; bool lose_context_when_out_of_memory = false; gpu_va_context_provider_ = ContextProviderCommandBuffer::Create( make_scoped_ptr( WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext( gpu_channel_host.get(), attributes, lose_context_when_out_of_memory, GURL(""chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D""), WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)), ""GPU-VideoAccelerator-Offscreen""); } } if (gpu_va_context_provider_.get()) { gpu_factories = RendererGpuVideoAcceleratorFactories::Create( gpu_channel_host.get(), media_task_runner, gpu_va_context_provider_); } return gpu_factories; } ",0 "void MockPrinter::ResetPrinter() { printer_status_ = PRINTER_READY; document_cookie_ = -1; } ",0 "mojom::Renderer* RenderProcessHostImpl::GetRendererInterface() { return renderer_interface_.get(); } ",0 "static int mcryptd_hash_digest_enqueue(struct ahash_request *req) { return mcryptd_hash_enqueue(req, mcryptd_hash_digest); } ",0 "NetworkActionPredictor::TransitionalMatch::TransitionalMatch() { } ",0 "void RenderView::OnPaste() { if (!webview()) return; webview()->focusedFrame()->executeCommand(WebString::fromUTF8(""Paste"")); } ",0 "static int perf_sysexit_enable(struct ftrace_event_call *call) { int ret = 0; int num; num = ((struct syscall_metadata *)call->data)->syscall_nr; mutex_lock(&syscall_trace_lock); if (!sys_perf_refcount_exit) ret = register_trace_sys_exit(perf_syscall_exit, NULL); if (ret) { pr_info(""event trace: Could not activate"" ""syscall exit trace point""); } else { set_bit(num, enabled_perf_exit_syscalls); sys_perf_refcount_exit++; } mutex_unlock(&syscall_trace_lock); return ret; } ",0 "do_times(int fd, int verb, const struct stat *sb) { /* strlen(2^64) == 20; strlen(10^6) == 7 */ char buf[(20 + 7 + 2) * 2 + 2]; (void)snprintf(buf, sizeof(buf), ""T%llu 0 %llu 0\n"", (unsigned long long) (sb->st_mtime < 0 ? 0 : sb->st_mtime), (unsigned long long) (sb->st_atime < 0 ? 0 : sb->st_atime)); if (verb) { fprintf(stderr, ""File mtime %lld atime %lld\n"", (long long)sb->st_mtime, (long long)sb->st_atime); fprintf(stderr, ""Sending file timestamps: %s"", buf); } (void) atomicio(vwrite, fd, buf, strlen(buf)); return (response()); } ",0 "gsm_xsmp_server_start (GsmXsmpServer *server) { GIOChannel *channel; int i; for (i = 0; i < server->priv->num_local_xsmp_sockets; i++) { GsmIceConnectionData *data; data = g_new0 (GsmIceConnectionData, 1); data->server = server; data->listener = server->priv->xsmp_sockets[i]; channel = g_io_channel_unix_new (IceGetListenConnectionNumber (server->priv->xsmp_sockets[i])); g_io_add_watch_full (channel, G_PRIORITY_DEFAULT, G_IO_IN | G_IO_HUP | G_IO_ERR, (GIOFunc)accept_ice_connection, data, (GDestroyNotify)g_free); g_io_channel_unref (channel); } } ",0 "int fz_colorspace_is_rgb(fz_context *ctx, const fz_colorspace *cs) { return cs && cs->type == FZ_COLORSPACE_RGB; } ",0 " fz_catch(ctx) { pdf_drop_obj(ctx, encrypt); pdf_drop_obj(ctx, id); pdf_drop_obj(ctx, obj); pdf_drop_obj(ctx, info); fz_free(ctx, list); fz_rethrow(ctx); } ",0 "void GLES2DecoderImpl::DeleteQueriesEXTHelper( GLsizei n, const GLuint* client_ids) { for (GLsizei ii = 0; ii < n; ++ii) { QueryManager::Query* query = query_manager_->GetQuery(client_ids[ii]); if (query && !query->IsDeleted()) { if (query == current_query_) { current_query_ = NULL; } query->Destroy(true); query_manager_->RemoveQuery(client_ids[ii]); } } } ",0 "static MagickBooleanType ReadPSDLayersInternal(Image *image, const ImageInfo *image_info,const PSDInfo *psd_info, const MagickBooleanType skip_layers,ExceptionInfo *exception) { char type[4]; LayerInfo *layer_info; MagickSizeType size; MagickBooleanType status; register ssize_t i; ssize_t count, j, number_layers; size=GetPSDSize(psd_info,image); if (size == 0) { /* Skip layers & masks. */ (void) ReadBlobLong(image); count=ReadBlob(image,4,(unsigned char *) type); if (count == 4) ReversePSDString(image,type,(size_t) count); if ((count != 4) || (LocaleNCompare(type,""8BIM"",4) != 0)) return(MagickTrue); else { count=ReadBlob(image,4,(unsigned char *) type); if (count == 4) ReversePSDString(image,type,4); if ((count == 4) && ((LocaleNCompare(type,""Lr16"",4) == 0) || (LocaleNCompare(type,""Lr32"",4) == 0))) size=GetPSDSize(psd_info,image); else return(MagickTrue); } } if (size == 0) return(MagickTrue); layer_info=(LayerInfo *) NULL; number_layers=(ssize_t) ReadBlobSignedShort(image); if (number_layers < 0) { /* The first alpha channel in the merged result contains the transparency data for the merged result. */ number_layers=MagickAbsoluteValue(number_layers); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" negative layer count corrected for""); image->alpha_trait=BlendPixelTrait; } /* We only need to know if the image has an alpha channel */ if (skip_layers != MagickFalse) return(MagickTrue); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" image contains %.20g layers"",(double) number_layers); if (number_layers == 0) ThrowBinaryException(CorruptImageError,""InvalidNumberOfLayers"", image->filename); layer_info=(LayerInfo *) AcquireQuantumMemory((size_t) number_layers, sizeof(*layer_info)); if (layer_info == (LayerInfo *) NULL) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" allocation of LayerInfo failed""); ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); } (void) memset(layer_info,0,(size_t) number_layers*sizeof(*layer_info)); for (i=0; i < number_layers; i++) { ssize_t x, y; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" reading layer #%.20g"",(double) i+1); layer_info[i].page.y=(ssize_t) ReadBlobSignedLong(image); layer_info[i].page.x=(ssize_t) ReadBlobSignedLong(image); y=(ssize_t) ReadBlobSignedLong(image); x=(ssize_t) ReadBlobSignedLong(image); layer_info[i].page.width=(size_t) (x-layer_info[i].page.x); layer_info[i].page.height=(size_t) (y-layer_info[i].page.y); layer_info[i].channels=ReadBlobShort(image); if (layer_info[i].channels > MaxPSDChannels) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError,""MaximumChannelsExceeded"", image->filename); } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" offset(%.20g,%.20g), size(%.20g,%.20g), channels=%.20g"", (double) layer_info[i].page.x,(double) layer_info[i].page.y, (double) layer_info[i].page.height,(double) layer_info[i].page.width,(double) layer_info[i].channels); for (j=0; j < (ssize_t) layer_info[i].channels; j++) { layer_info[i].channel_info[j].type=(short) ReadBlobShort(image); if ((layer_info[i].channel_info[j].type < -4) || (layer_info[i].channel_info[j].type > 4)) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError,""NoSuchImageChannel"", image->filename); } layer_info[i].channel_info[j].size=(size_t) GetPSDSize(psd_info, image); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" channel[%.20g]: type=%.20g, size=%.20g"",(double) j, (double) layer_info[i].channel_info[j].type, (double) layer_info[i].channel_info[j].size); } if (CheckPSDChannels(psd_info,&layer_info[i]) == MagickFalse) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError,""ImproperImageHeader"", image->filename); } count=ReadBlob(image,4,(unsigned char *) type); if (count == 4) ReversePSDString(image,type,4); if ((count != 4) || (LocaleNCompare(type,""8BIM"",4) != 0)) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" layer type was %.4s instead of 8BIM"", type); layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError,""ImproperImageHeader"", image->filename); } count=ReadBlob(image,4,(unsigned char *) layer_info[i].blendkey); if (count != 4) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError,""ImproperImageHeader"", image->filename); } ReversePSDString(image,layer_info[i].blendkey,4); layer_info[i].opacity=(Quantum) ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); layer_info[i].clipping=(unsigned char) ReadBlobByte(image); layer_info[i].flags=(unsigned char) ReadBlobByte(image); layer_info[i].visible=!(layer_info[i].flags & 0x02); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" blend=%.4s, opacity=%.20g, clipping=%s, flags=%d, visible=%s"", layer_info[i].blendkey,(double) layer_info[i].opacity, layer_info[i].clipping ? ""true"" : ""false"",layer_info[i].flags, layer_info[i].visible ? ""true"" : ""false""); (void) ReadBlobByte(image); /* filler */ size=ReadBlobLong(image); if (size != 0) { MagickSizeType combined_length, length; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" layer contains additional info""); length=ReadBlobLong(image); combined_length=length+4; if (length != 0) { /* Layer mask info. */ layer_info[i].mask.page.y=(ssize_t) ReadBlobSignedLong(image); layer_info[i].mask.page.x=(ssize_t) ReadBlobSignedLong(image); layer_info[i].mask.page.height=(size_t) (ReadBlobSignedLong(image)-layer_info[i].mask.page.y); layer_info[i].mask.page.width=(size_t) ( ReadBlobSignedLong(image)-layer_info[i].mask.page.x); layer_info[i].mask.background=(unsigned char) ReadBlobByte( image); layer_info[i].mask.flags=(unsigned char) ReadBlobByte(image); if (!(layer_info[i].mask.flags & 0x01)) { layer_info[i].mask.page.y=layer_info[i].mask.page.y- layer_info[i].page.y; layer_info[i].mask.page.x=layer_info[i].mask.page.x- layer_info[i].page.x; } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" layer mask: offset(%.20g,%.20g), size(%.20g,%.20g), length=%.20g"", (double) layer_info[i].mask.page.x,(double) layer_info[i].mask.page.y,(double) layer_info[i].mask.page.width,(double) layer_info[i].mask.page.height,(double) ((MagickOffsetType) length)-18); /* Skip over the rest of the layer mask information. */ if (DiscardBlobBytes(image,(MagickSizeType) (length-18)) == MagickFalse) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError, ""UnexpectedEndOfFile"",image->filename); } } length=ReadBlobLong(image); combined_length+=length+4; if (length != 0) { /* Layer blending ranges info. */ if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" layer blending ranges: length=%.20g"",(double) ((MagickOffsetType) length)); if (DiscardBlobBytes(image,length) == MagickFalse) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError, ""UnexpectedEndOfFile"",image->filename); } } /* Layer name. */ length=(MagickSizeType) (unsigned char) ReadBlobByte(image); combined_length+=length+1; if (length > 0) (void) ReadBlob(image,(size_t) length++,layer_info[i].name); layer_info[i].name[length]='\0'; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" layer name: %s"",layer_info[i].name); if ((length % 4) != 0) { length=4-(length % 4); combined_length+=length; /* Skip over the padding of the layer name */ if (DiscardBlobBytes(image,length) == MagickFalse) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError, ""UnexpectedEndOfFile"",image->filename); } } length=(MagickSizeType) size-combined_length; if (length > 0) { unsigned char *info; if (length > GetBlobSize(image)) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError, ""InsufficientImageDataInFile"",image->filename); } layer_info[i].info=AcquireStringInfo((const size_t) length); info=GetStringInfoDatum(layer_info[i].info); (void) ReadBlob(image,(const size_t) length,info); } } } for (i=0; i < number_layers; i++) { if ((layer_info[i].page.width == 0) || (layer_info[i].page.height == 0)) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" layer data is empty""); if (layer_info[i].info != (StringInfo *) NULL) layer_info[i].info=DestroyStringInfo(layer_info[i].info); continue; } /* Allocate layered image. */ layer_info[i].image=CloneImage(image,layer_info[i].page.width, layer_info[i].page.height,MagickFalse,exception); if (layer_info[i].image == (Image *) NULL) { layer_info=DestroyLayerInfo(layer_info,number_layers); if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" allocation of image for layer %.20g failed"",(double) i); ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); } if (layer_info[i].info != (StringInfo *) NULL) { (void) SetImageProfile(layer_info[i].image,""psd:additional-info"", layer_info[i].info,exception); layer_info[i].info=DestroyStringInfo(layer_info[i].info); } } if (image_info->ping != MagickFalse) { AttachPSDLayers(image,layer_info,number_layers); return(MagickTrue); } status=MagickTrue; for (i=0; i < number_layers; i++) { if ((layer_info[i].image == (Image *) NULL) || (PSDSkipImage(image_info,i) != MagickFalse)) { for (j=0; j < (ssize_t) layer_info[i].channels; j++) { if (DiscardBlobBytes(image,(MagickSizeType) layer_info[i].channel_info[j].size) == MagickFalse) { layer_info=DestroyLayerInfo(layer_info,number_layers); ThrowBinaryException(CorruptImageError, ""UnexpectedEndOfFile"",image->filename); } } continue; } if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" reading data for layer %.20g"",(double) i); status=ReadPSDLayer(image,image_info,psd_info,&layer_info[i], exception); if (status == MagickFalse) break; status=SetImageProgress(image,LoadImagesTag,(MagickOffsetType) i, (MagickSizeType) number_layers); if (status == MagickFalse) break; } if (status != MagickFalse) AttachPSDLayers(image,layer_info,number_layers); else layer_info=DestroyLayerInfo(layer_info,number_layers); return(status); } ",0 "int vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) { int error = may_create(dir, dentry); if (error) return error; if (!dir->i_op->mkdir) return -EPERM; mode &= (S_IRWXUGO|S_ISVTX); error = security_inode_mkdir(dir, dentry, mode); if (error) return error; vfs_dq_init(dir); error = dir->i_op->mkdir(dir, dentry, mode); if (!error) fsnotify_mkdir(dir, dentry); return error; } ",0 "ssh_session(void) { int type; int interactive = 0; int have_tty = 0; struct winsize ws; char *cp; const char *display; /* Enable compression if requested. */ if (options.compression) { options.compression_level); if (options.compression_level < 1 || options.compression_level > 9) fatal(""Compression level must be from 1 (fast) to "" ""9 (slow, best).""); /* Send the request. */ packet_start(SSH_CMSG_REQUEST_COMPRESSION); packet_put_int(options.compression_level); packet_send(); packet_write_wait(); type = packet_read(); if (type == SSH_SMSG_SUCCESS) packet_start_compression(options.compression_level); else if (type == SSH_SMSG_FAILURE) logit(""Warning: Remote host refused compression.""); else packet_disconnect(""Protocol error waiting for "" ""compression response.""); } /* Allocate a pseudo tty if appropriate. */ if (tty_flag) { debug(""Requesting pty.""); /* Start the packet. */ packet_start(SSH_CMSG_REQUEST_PTY); /* Store TERM in the packet. There is no limit on the length of the string. */ cp = getenv(""TERM""); if (!cp) cp = """"; packet_put_cstring(cp); /* Store window size in the packet. */ if (ioctl(fileno(stdin), TIOCGWINSZ, &ws) < 0) memset(&ws, 0, sizeof(ws)); packet_put_int((u_int)ws.ws_row); packet_put_int((u_int)ws.ws_col); packet_put_int((u_int)ws.ws_xpixel); packet_put_int((u_int)ws.ws_ypixel); /* Store tty modes in the packet. */ tty_make_modes(fileno(stdin), NULL); /* Send the packet, and wait for it to leave. */ packet_send(); packet_write_wait(); /* Read response from the server. */ type = packet_read(); if (type == SSH_SMSG_SUCCESS) { interactive = 1; have_tty = 1; } else if (type == SSH_SMSG_FAILURE) logit(""Warning: Remote host failed or refused to "" ""allocate a pseudo tty.""); else packet_disconnect(""Protocol error waiting for pty "" ""request response.""); } /* Request X11 forwarding if enabled and DISPLAY is set. */ display = getenv(""DISPLAY""); display = getenv(""DISPLAY""); if (display == NULL && options.forward_x11) debug(""X11 forwarding requested but DISPLAY not set""); if (options.forward_x11 && display != NULL) { char *proto, *data; /* Get reasonable local authentication information. */ client_x11_get_proto(display, options.xauth_location, options.forward_x11_trusted, options.forward_x11_timeout, &proto, &data); /* Request forwarding with authentication spoofing. */ debug(""Requesting X11 forwarding with authentication "" ""spoofing.""); /* Request forwarding with authentication spoofing. */ debug(""Requesting X11 forwarding with authentication "" ""spoofing.""); x11_request_forwarding_with_spoofing(0, display, proto, data, 0); /* Read response from the server. */ type = packet_read(); if (type == SSH_SMSG_SUCCESS) { interactive = 1; } else if (type == SSH_SMSG_FAILURE) { logit(""Warning: Remote host denied X11 forwarding.""); } else { packet_disconnect(""Protocol error waiting for X11 "" ""forwarding""); } } /* Tell the packet module whether this is an interactive session. */ packet_set_interactive(interactive, options.ip_qos_interactive, options.ip_qos_bulk); /* Request authentication agent forwarding if appropriate. */ check_agent_present(); if (options.forward_agent) { debug(""Requesting authentication agent forwarding.""); auth_request_forwarding(); /* Read response from the server. */ type = packet_read(); packet_check_eom(); if (type != SSH_SMSG_SUCCESS) logit(""Warning: Remote host denied authentication agent forwarding.""); } /* Initiate port forwardings. */ ssh_init_stdio_forwarding(); ssh_init_forwarding(); /* Execute a local command */ if (options.local_command != NULL && options.permit_local_command) ssh_local_cmd(options.local_command); /* * If requested and we are not interested in replies to remote * forwarding requests, then let ssh continue in the background. */ if (fork_after_authentication_flag) { if (options.exit_on_forward_failure && options.num_remote_forwards > 0) { debug(""deferring postauth fork until remote forward "" ""confirmation received""); } else fork_postauth(); } /* * If a command was specified on the command line, execute the * command now. Otherwise request the server to start a shell. */ if (buffer_len(&command) > 0) { int len = buffer_len(&command); if (len > 900) len = 900; debug(""Sending command: %.*s"", len, (u_char *)buffer_ptr(&command)); packet_start(SSH_CMSG_EXEC_CMD); packet_put_string(buffer_ptr(&command), buffer_len(&command)); packet_send(); packet_write_wait(); } else { debug(""Requesting shell.""); packet_start(SSH_CMSG_EXEC_SHELL); packet_send(); packet_write_wait(); } /* Enter the interactive session. */ return client_loop(have_tty, tty_flag ? options.escape_char : SSH_ESCAPECHAR_NONE, 0); } ",1 "MagickExport void SetImageInfoFile(ImageInfo *image_info,FILE *file) { assert(image_info != (ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); image_info->file=file; } ",0 "static int kye_tablet_enable(struct hid_device *hdev) { struct list_head *list; struct list_head *head; struct hid_report *report; __s32 *value; list = &hdev->report_enum[HID_FEATURE_REPORT].report_list; list_for_each(head, list) { report = list_entry(head, struct hid_report, list); if (report->id == 5) break; } if (head == list) { hid_err(hdev, ""tablet-enabling feature report not found\n""); return -ENODEV; } if (report->maxfield < 1 || report->field[0]->report_count < 7) { hid_err(hdev, ""invalid tablet-enabling feature report\n""); return -ENODEV; } value = report->field[0]->value; value[0] = 0x12; value[1] = 0x10; value[2] = 0x11; value[3] = 0x12; value[4] = 0x00; value[5] = 0x00; value[6] = 0x00; hid_hw_request(hdev, report, HID_REQ_SET_REPORT); return 0; } ",0 "bool ExtensionsDisabled(const base::CommandLine& command_line) { return command_line.HasSwitch(switches::kDisableExtensions) || command_line.HasSwitch(switches::kDisableExtensionsExcept); } ",0 "void V8TestObject::ElementAttributeAttributeSetterCallback( const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_elementAttribute_Setter""); v8::Local v8_value = info[0]; test_object_v8_internal::ElementAttributeAttributeSetter(v8_value, info); } ",0 "static bool canAccessAncestor(const SecurityOrigin* activeSecurityOrigin, Frame* targetFrame) { if (!targetFrame) return false; for (Frame* ancestorFrame = targetFrame; ancestorFrame; ancestorFrame = ancestorFrame->tree()->parent()) { Document* ancestorDocument = ancestorFrame->document(); if (!ancestorDocument) return true; const SecurityOrigin* ancestorSecurityOrigin = ancestorDocument->securityOrigin(); if (activeSecurityOrigin->canAccess(ancestorSecurityOrigin)) return true; } return false; } ",0 "static MagickBooleanType ReadPSDChannelRaw(Image *image,const size_t channels, const ssize_t type,ExceptionInfo *exception) { MagickBooleanType status; size_t row_size; ssize_t count, y; unsigned char *pixels; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" layer data is RAW""); row_size=GetPSDRowSize(image); pixels=(unsigned char *) AcquireQuantumMemory(row_size,sizeof(*pixels)); if (pixels == (unsigned char *) NULL) ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); status=MagickTrue; for (y=0; y < (ssize_t) image->rows; y++) { status=MagickFalse; count=ReadBlob(image,row_size,pixels); if (count != (ssize_t) row_size) { status=MagickFalse; break; } status=ReadPSDChannelPixels(image,channels,y,type,pixels,exception); if (status == MagickFalse) break; } pixels=(unsigned char *) RelinquishMagickMemory(pixels); return(status); } ",0 "CMS_ContentInfo *CMS_sign_receipt(CMS_SignerInfo *si, X509 *signcert, EVP_PKEY *pkey, STACK_OF(X509) *certs, unsigned int flags) { CMS_SignerInfo *rct_si; CMS_ContentInfo *cms = NULL; ASN1_OCTET_STRING **pos, *os; BIO *rct_cont = NULL; int r = 0; flags &= ~(CMS_STREAM | CMS_TEXT); /* Not really detached but avoids content being allocated */ flags |= CMS_PARTIAL | CMS_BINARY | CMS_DETACHED; if (!pkey || !signcert) { CMSerr(CMS_F_CMS_SIGN_RECEIPT, CMS_R_NO_KEY_OR_CERT); return NULL; } /* Initialize signed data */ cms = CMS_sign(NULL, NULL, certs, NULL, flags); if (!cms) goto err; /* Set inner content type to signed receipt */ if (!CMS_set1_eContentType(cms, OBJ_nid2obj(NID_id_smime_ct_receipt))) goto err; rct_si = CMS_add1_signer(cms, signcert, pkey, NULL, flags); if (!rct_si) { CMSerr(CMS_F_CMS_SIGN_RECEIPT, CMS_R_ADD_SIGNER_ERROR); goto err; } os = cms_encode_Receipt(si); if (!os) goto err; /* Set content to digest */ rct_cont = BIO_new_mem_buf(os->data, os->length); if (!rct_cont) goto err; /* Add msgSigDigest attribute */ if (!cms_msgSigDigest_add1(rct_si, si)) goto err; /* Finalize structure */ if (!CMS_final(cms, rct_cont, NULL, flags)) goto err; /* Set embedded content */ pos = CMS_get0_content(cms); *pos = os; r = 1; err: if (rct_cont) BIO_free(rct_cont); if (r) return cms; CMS_ContentInfo_free(cms); return NULL; } ",0 "accept_jobs(cupsd_client_t *con, /* I - Client connection */ ipp_attribute_t *uri) /* I - Printer or class URI */ { http_status_t status; /* Policy status */ cups_ptype_t dtype; /* Destination type (printer/class) */ cupsd_printer_t *printer; /* Printer data */ cupsdLogMessage(CUPSD_LOG_DEBUG2, ""accept_jobs(%p[%d], %s)"", con, con->number, uri->values[0].string.text); /* * Is the destination valid? */ if (!cupsdValidateDest(uri->values[0].string.text, &dtype, &printer)) { /* * Bad URI... */ send_ipp_status(con, IPP_NOT_FOUND, _(""The printer or class does not exist."")); return; } /* * Check policy... */ if ((status = cupsdCheckPolicy(printer->op_policy_ptr, con, NULL)) != HTTP_OK) { send_http_error(con, status, printer); return; } /* * Accept jobs sent to the printer... */ printer->accepting = 1; printer->state_message[0] = '\0'; cupsdAddEvent(CUPSD_EVENT_PRINTER_STATE, printer, NULL, ""Now accepting jobs.""); if (dtype & CUPS_PRINTER_CLASS) { cupsdMarkDirty(CUPSD_DIRTY_CLASSES); cupsdLogMessage(CUPSD_LOG_INFO, ""Class \""%s\"" now accepting jobs (\""%s\"")."", printer->name, get_username(con)); } else { cupsdMarkDirty(CUPSD_DIRTY_PRINTERS); cupsdLogMessage(CUPSD_LOG_INFO, ""Printer \""%s\"" now accepting jobs (\""%s\"")."", printer->name, get_username(con)); } /* * Everything was ok, so return OK status... */ con->response->request.status.status_code = IPP_OK; } ",0 "static int rtnl_fdb_add(struct sk_buff *skb, struct nlmsghdr *nlh) { struct net *net = sock_net(skb->sk); struct ndmsg *ndm; struct nlattr *tb[NDA_MAX+1]; struct net_device *dev; u8 *addr; u16 vid; int err; err = nlmsg_parse(nlh, sizeof(*ndm), tb, NDA_MAX, NULL); if (err < 0) return err; ndm = nlmsg_data(nlh); if (ndm->ndm_ifindex == 0) { pr_info(""PF_BRIDGE: RTM_NEWNEIGH with invalid ifindex\n""); return -EINVAL; } dev = __dev_get_by_index(net, ndm->ndm_ifindex); if (dev == NULL) { pr_info(""PF_BRIDGE: RTM_NEWNEIGH with unknown ifindex\n""); return -ENODEV; } if (!tb[NDA_LLADDR] || nla_len(tb[NDA_LLADDR]) != ETH_ALEN) { pr_info(""PF_BRIDGE: RTM_NEWNEIGH with invalid address\n""); return -EINVAL; } addr = nla_data(tb[NDA_LLADDR]); err = fdb_vid_parse(tb[NDA_VLAN], &vid); if (err) return err; err = -EOPNOTSUPP; /* Support fdb on master device the net/bridge default case */ if ((!ndm->ndm_flags || ndm->ndm_flags & NTF_MASTER) && (dev->priv_flags & IFF_BRIDGE_PORT)) { struct net_device *br_dev = netdev_master_upper_dev_get(dev); const struct net_device_ops *ops = br_dev->netdev_ops; err = ops->ndo_fdb_add(ndm, tb, dev, addr, vid, nlh->nlmsg_flags); if (err) goto out; else ndm->ndm_flags &= ~NTF_MASTER; } /* Embedded bridge, macvlan, and any other device support */ if ((ndm->ndm_flags & NTF_SELF)) { if (dev->netdev_ops->ndo_fdb_add) err = dev->netdev_ops->ndo_fdb_add(ndm, tb, dev, addr, vid, nlh->nlmsg_flags); else err = ndo_dflt_fdb_add(ndm, tb, dev, addr, vid, nlh->nlmsg_flags); if (!err) { rtnl_fdb_notify(dev, addr, vid, RTM_NEWNEIGH, ndm->ndm_state); ndm->ndm_flags &= ~NTF_SELF; } } out: return err; } ",0 "void CSSStyleSheet::EnableRuleAccessForInspector() { enable_rule_access_for_inspector_ = true; } ",0 "QQuickWebView::QQuickWebView(WKContextRef contextRef, WKPageGroupRef pageGroupRef, QQuickItem* parent) : QQuickFlickable(parent) , d_ptr(createPrivateObject(this)) , m_experimental(new QQuickWebViewExperimental(this)) { Q_D(QQuickWebView); d->initialize(contextRef, pageGroupRef); } ",0 "static void parse_fpe(struct pt_regs *regs) { int code = 0; unsigned long fpscr; flush_fp_to_thread(current); fpscr = current->thread.fpscr.val; /* Invalid operation */ if ((fpscr & FPSCR_VE) && (fpscr & FPSCR_VX)) code = FPE_FLTINV; /* Overflow */ else if ((fpscr & FPSCR_OE) && (fpscr & FPSCR_OX)) code = FPE_FLTOVF; /* Underflow */ else if ((fpscr & FPSCR_UE) && (fpscr & FPSCR_UX)) code = FPE_FLTUND; /* Divide by zero */ else if ((fpscr & FPSCR_ZE) && (fpscr & FPSCR_ZX)) code = FPE_FLTDIV; /* Inexact result */ else if ((fpscr & FPSCR_XE) && (fpscr & FPSCR_XX)) code = FPE_FLTRES; _exception(SIGFPE, regs, code, regs->nip); } ",0 " bool readImageData(v8::Handle* value) { uint32_t width; uint32_t height; uint32_t pixelDataLength; if (!doReadUint32(&width)) return false; if (!doReadUint32(&height)) return false; if (!doReadUint32(&pixelDataLength)) return false; if (m_position + pixelDataLength > m_length) return false; RefPtrWillBeRawPtr imageData = ImageData::create(IntSize(width, height)); Uint8ClampedArray* pixelArray = imageData->data(); ASSERT(pixelArray); ASSERT(pixelArray->length() >= pixelDataLength); memcpy(pixelArray->data(), m_buffer + m_position, pixelDataLength); m_position += pixelDataLength; *value = toV8(imageData.release(), m_scriptState->context()->Global(), isolate()); return true; } ",0 "bool ChromeDownloadManagerDelegate::ShouldOpenDownload( DownloadItem* item, const content::DownloadOpenDelayedCallback& callback) { #if BUILDFLAG(ENABLE_EXTENSIONS) if (download_crx_util::IsExtensionDownload(*item) && !extensions::WebstoreInstaller::GetAssociatedApproval(*item)) { scoped_refptr crx_installer = download_crx_util::OpenChromeExtension(profile_, *item); registrar_.Add( this, extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::Source(crx_installer.get())); crx_installers_[crx_installer.get()] = callback; item->UpdateObservers(); return false; } #endif return true; } ",0 "int ssl2_pending(const SSL *s) { return SSL_in_init(s) ? 0 : s->s2->ract_data_length; } ",0 "void LocalDOMWindow::DispatchLoadEvent() { Event* load_event(Event::Create(EventTypeNames::load)); DocumentLoader* document_loader = GetFrame() ? GetFrame()->Loader().GetDocumentLoader() : nullptr; if (document_loader && document_loader->GetTiming().LoadEventStart().is_null()) { DocumentLoadTiming& timing = document_loader->GetTiming(); timing.MarkLoadEventStart(); DispatchEvent(load_event, document()); timing.MarkLoadEventEnd(); DCHECK(document_loader->Fetcher()); if (GetFrame() && document_loader == GetFrame()->Loader().GetDocumentLoader() && document_loader->Fetcher()->CountPreloads()) { unused_preloads_timer_.StartOneShot(kUnusedPreloadTimeoutInSeconds, FROM_HERE); } } else { DispatchEvent(load_event, document()); } if (GetFrame()) { WindowPerformance* performance = DOMWindowPerformance::performance(*this); DCHECK(performance); performance->NotifyNavigationTimingToObservers(); } FrameOwner* owner = GetFrame() ? GetFrame()->Owner() : nullptr; if (owner) owner->DispatchLoad(); TRACE_EVENT_INSTANT1(""devtools.timeline"", ""MarkLoad"", TRACE_EVENT_SCOPE_THREAD, ""data"", InspectorMarkLoadEvent::Data(GetFrame())); probe::loadEventFired(GetFrame()); } ",0 "iasecc_sdo_get_tagged_data(struct sc_card *card, int sdo_tag, struct iasecc_sdo *sdo) { struct sc_context *ctx = card->ctx; struct sc_apdu apdu; unsigned char sbuf[0x100]; size_t offs = sizeof(sbuf) - 1; unsigned char rbuf[0x400]; int rv; LOG_FUNC_CALLED(ctx); sbuf[offs--] = 0x80; sbuf[offs--] = sdo_tag & 0xFF; if ((sdo_tag >> 8) & 0xFF) sbuf[offs--] = (sdo_tag >> 8) & 0xFF; sbuf[offs] = sizeof(sbuf) - offs - 1; offs--; sbuf[offs--] = sdo->sdo_ref & 0x9F; sbuf[offs--] = sdo->sdo_class | IASECC_OBJECT_REF_LOCAL; sbuf[offs--] = IASECC_SDO_TAG_HEADER; sbuf[offs] = sizeof(sbuf) - offs - 1; offs--; sbuf[offs--] = IASECC_SDO_TEMPLATE_TAG; sbuf[offs] = sizeof(sbuf) - offs - 1; offs--; sbuf[offs] = 0x4D; sc_format_apdu(card, &apdu, SC_APDU_CASE_4_SHORT, 0xCB, 0x3F, 0xFF); apdu.data = sbuf + offs; apdu.datalen = sizeof(sbuf) - offs; apdu.lc = sizeof(sbuf) - offs; apdu.resp = rbuf; apdu.resplen = sizeof(rbuf); apdu.le = 0x100; rv = sc_transmit_apdu(card, &apdu); LOG_TEST_RET(ctx, rv, ""APDU transmit failed""); rv = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(ctx, rv, ""SDO get data error""); rv = iasecc_sdo_parse(card, apdu.resp, apdu.resplen, sdo); LOG_TEST_RET(ctx, rv, ""cannot parse SDO data""); LOG_FUNC_RETURN(ctx, rv); } ",0 "PHP_MINIT_FUNCTION(finfo) { zend_class_entry _finfo_class_entry; INIT_CLASS_ENTRY(_finfo_class_entry, ""finfo"", finfo_class_functions); _finfo_class_entry.create_object = finfo_objects_new; finfo_class_entry = zend_register_internal_class(&_finfo_class_entry TSRMLS_CC); /* copy the standard object handlers to you handler table */ memcpy(&finfo_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers)); le_fileinfo = zend_register_list_destructors_ex(finfo_resource_destructor, NULL, ""file_info"", module_number); REGISTER_LONG_CONSTANT(""FILEINFO_NONE"", MAGIC_NONE, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""FILEINFO_SYMLINK"", MAGIC_SYMLINK, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""FILEINFO_MIME"", MAGIC_MIME, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""FILEINFO_MIME_TYPE"", MAGIC_MIME_TYPE, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""FILEINFO_MIME_ENCODING"",MAGIC_MIME_ENCODING, CONST_CS|CONST_PERSISTENT); /* REGISTER_LONG_CONSTANT(""FILEINFO_COMPRESS"", MAGIC_COMPRESS, CONST_CS|CONST_PERSISTENT); disabled, as it does fork now */ REGISTER_LONG_CONSTANT(""FILEINFO_DEVICES"", MAGIC_DEVICES, CONST_CS|CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""FILEINFO_CONTINUE"", MAGIC_CONTINUE, CONST_CS|CONST_PERSISTENT); #ifdef MAGIC_PRESERVE_ATIME REGISTER_LONG_CONSTANT(""FILEINFO_PRESERVE_ATIME"", MAGIC_PRESERVE_ATIME, CONST_CS|CONST_PERSISTENT); #endif #ifdef MAGIC_RAW REGISTER_LONG_CONSTANT(""FILEINFO_RAW"", MAGIC_RAW, CONST_CS|CONST_PERSISTENT); #endif return SUCCESS; } ",0 "void AudioOutputDeviceTest::StartAudioDevice(bool synchronized_io) { const int kInputChannels = synchronized_io ? 2 : 0; if (synchronized_io) { audio_device_->InitializeIO(default_audio_parameters_, kInputChannels, &callback_); } else { audio_device_->Initialize(default_audio_parameters_, &callback_); } audio_device_->Start(); EXPECT_CALL(audio_output_ipc_, AddDelegate(audio_device_.get())) .WillOnce(Return(kStreamId)); EXPECT_CALL(audio_output_ipc_, CreateStream(kStreamId, _, _)); io_loop_.RunAllPending(); } ",0 " void set_cookie_value(string value) { decoder_->cookie_value_ = value; } ",0 "void jsB_initregexp(js_State *J) { js_pushobject(J, J->RegExp_prototype); { jsB_propf(J, ""RegExp.prototype.toString"", Rp_toString, 0); jsB_propf(J, ""RegExp.prototype.test"", Rp_test, 0); jsB_propf(J, ""RegExp.prototype.exec"", Rp_exec, 0); } js_newcconstructor(J, jsB_RegExp, jsB_new_RegExp, ""RegExp"", 1); js_defglobal(J, ""RegExp"", JS_DONTENUM); } ",0 "bool Truncated(const std::string& input, const size_t byte_size, std::string* output) { size_t prev = input.length(); TruncateUTF8ToByteSize(input, byte_size, output); return prev != output->length(); } ",0 "vrrp_gnotify_handler(vector_t *strvec) { vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group); if (vgroup->script) { report_config_error(CONFIG_GENERAL_ERROR, ""vrrp group %s: notify script already specified - ignoring %s"", vgroup->gname, FMT_STR_VSLOT(strvec,1)); return; } vgroup->script = set_vrrp_notify_script(strvec, 4); vgroup->notify_exec = true; } ",0 "xps_decode_font_char_imp(xps_font_t *font, int code) { byte *table; /* no cmap selected: return identity */ if (font->cmapsubtable <= 0) return code; table = font->data + font->cmapsubtable; switch (u16(table)) { case 0: /* Apple standard 1-to-1 mapping. */ { int i, length = u16(&table[2]) - 6; if (length < 0 || length > 256) return gs_error_invalidfont; for (i=0;i 65535) return gs_error_invalidfont; for (i2 = 0; i2 < segCount2 - 3; i2 += 2) { int delta = s16(idDelta + i2), roff = s16(idRangeOffset + i2); int start = u16(startCount + i2); int end = u16(endCount + i2); int glyph, i; if (end < start) return gs_error_invalidfont; for (i=start;i<=end;i++) { if (roff == 0) { glyph = (i + delta) & 0xffff; } else { glyph = u16(idRangeOffset + i2 + roff + ((i - start) << 1)); } if (glyph == code) { return i; } } } } return 0; case 6: /* Single interval lookup. */ { int ch, i, length = u16(&table[8]); int firstCode = u16(&table[6]); if (length < 0 || length > 65535) return gs_error_invalidfont; for (i=0;i= startGlyphCode && code <= (startGlyphCode + (endCharCode - startCharCode))) { return startGlyphCode + (code - startCharCode); } } } return 0; case 2: /* High-byte mapping through table. */ case 8: /* Mixed 16-bit and 32-bit coverage (like 2) */ default: gs_warn1(""unknown cmap format: %d\n"", u16(table)); return 0; } return 0; } ",0 "ScriptValue WebGLRenderingContextBase::getBufferParameter( ScriptState* script_state, GLenum target, GLenum pname) { if (isContextLost() || !ValidateBufferTarget(""getBufferParameter"", target)) return ScriptValue::CreateNull(script_state); switch (pname) { case GL_BUFFER_USAGE: { GLint value = 0; ContextGL()->GetBufferParameteriv(target, pname, &value); return WebGLAny(script_state, static_cast(value)); } case GL_BUFFER_SIZE: { GLint value = 0; ContextGL()->GetBufferParameteriv(target, pname, &value); if (!IsWebGL2OrHigher()) return WebGLAny(script_state, value); return WebGLAny(script_state, static_cast(value)); } default: SynthesizeGLError(GL_INVALID_ENUM, ""getBufferParameter"", ""invalid parameter name""); return ScriptValue::CreateNull(script_state); } } ",0 "DEFINE_RUN_ONCE_STATIC(ossl_init_register_atexit) { #ifdef OPENSSL_INIT_DEBUG fprintf(stderr, ""OPENSSL_INIT: ossl_init_register_atexit()\n""); #endif #ifndef OPENSSL_SYS_UEFI # ifdef _WIN32 /* We use _onexit() in preference because it gets called on DLL unload */ if (_onexit(win32atexit) == NULL) return 0; # else if (atexit(OPENSSL_cleanup) != 0) return 0; # endif #endif return 1; } ",0 "PHP_METHOD(SoapServer, fault) { char *code, *string, *actor=NULL, *name=NULL; int code_len, string_len, actor_len = 0, name_len = 0; zval* details = NULL; soapServicePtr service; xmlCharEncodingHandlerPtr old_encoding; SOAP_SERVER_BEGIN_CODE(); FETCH_THIS_SERVICE(service); old_encoding = SOAP_GLOBAL(encoding); SOAP_GLOBAL(encoding) = service->encoding; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""ss|szs"", &code, &code_len, &string, &string_len, &actor, &actor_len, &details, &name, &name_len) == FAILURE) { return; } soap_server_fault(code, string, actor, details, name TSRMLS_CC); SOAP_GLOBAL(encoding) = old_encoding; SOAP_SERVER_END_CODE(); } ",0 "void FileDescriptorSet::GetDescriptors(int* buffer) const { for (std::vector::const_iterator i = descriptors_.begin(); i != descriptors_.end(); ++i) { *(buffer++) = i->fd; } } ",0 "sched_feat_write(struct file *filp, const char __user *ubuf, size_t cnt, loff_t *ppos) { char buf[64]; char *cmp; int neg = 0; int i; if (cnt > 63) cnt = 63; if (copy_from_user(&buf, ubuf, cnt)) return -EFAULT; buf[cnt] = 0; cmp = strstrip(buf); if (strncmp(buf, ""NO_"", 3) == 0) { neg = 1; cmp += 3; } for (i = 0; sched_feat_names[i]; i++) { if (strcmp(cmp, sched_feat_names[i]) == 0) { if (neg) sysctl_sched_features &= ~(1UL << i); else sysctl_sched_features |= (1UL << i); break; } } if (!sched_feat_names[i]) return -EINVAL; *ppos += cnt; return cnt; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoGetProgramResourceiv( GLuint program, GLenum program_interface, GLuint index, GLsizei prop_count, const GLenum* props, GLsizei bufsize, GLsizei* length, GLint* params) { api()->glGetProgramResourceivFn(GetProgramServiceID(program, resources_), program_interface, index, prop_count, props, bufsize, length, params); return error::kNoError; } ",0 "IntSize GraphicsContext3DPrivate::platformLayerSize() const { return IntSize(m_context->m_currentWidth, m_context->m_currentHeight); } ",0 "static int async_chainiv_schedule_work(struct async_chainiv_ctx *ctx) { int queued; int err = ctx->err; if (!ctx->queue.qlen) { smp_mb__before_atomic(); clear_bit(CHAINIV_STATE_INUSE, &ctx->state); if (!ctx->queue.qlen || test_and_set_bit(CHAINIV_STATE_INUSE, &ctx->state)) goto out; } queued = queue_work(kcrypto_wq, &ctx->postponed); BUG_ON(!queued); out: return err; } ",0 "status_t ACodec::setVideoFormatOnPort( OMX_U32 portIndex, int32_t width, int32_t height, OMX_VIDEO_CODINGTYPE compressionFormat, float frameRate) { OMX_PARAM_PORTDEFINITIONTYPE def; InitOMXParams(&def); def.nPortIndex = portIndex; OMX_VIDEO_PORTDEFINITIONTYPE *video_def = &def.format.video; status_t err = mOMX->getParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); if (err != OK) { return err; } if (portIndex == kPortIndexInput) { const size_t X = 64 * 1024; if (def.nBufferSize < X) { def.nBufferSize = X; } } if (def.eDomain != OMX_PortDomainVideo) { ALOGE(""expected video port, got %s(%d)"", asString(def.eDomain), def.eDomain); return FAILED_TRANSACTION; } video_def->nFrameWidth = width; video_def->nFrameHeight = height; if (portIndex == kPortIndexInput) { video_def->eCompressionFormat = compressionFormat; video_def->eColorFormat = OMX_COLOR_FormatUnused; if (frameRate >= 0) { video_def->xFramerate = (OMX_U32)(frameRate * 65536.0f); } } err = mOMX->setParameter( mNode, OMX_IndexParamPortDefinition, &def, sizeof(def)); return err; } ",0 "xmlXPtrEvalXPointer(xmlXPathParserContextPtr ctxt) { if (ctxt->valueTab == NULL) { /* Allocate the value stack */ ctxt->valueTab = (xmlXPathObjectPtr *) xmlMalloc(10 * sizeof(xmlXPathObjectPtr)); if (ctxt->valueTab == NULL) { xmlXPtrErrMemory(""allocating evaluation context""); return; } ctxt->valueNr = 0; ctxt->valueMax = 10; ctxt->value = NULL; } SKIP_BLANKS; if (CUR == '/') { xmlXPathRoot(ctxt); xmlXPtrEvalChildSeq(ctxt, NULL); } else { xmlChar *name; name = xmlXPathParseName(ctxt); if (name == NULL) XP_ERROR(XPATH_EXPR_ERROR); if (CUR == '(') { xmlXPtrEvalFullXPtr(ctxt, name); /* Short evaluation */ return; } else { /* this handle both Bare Names and Child Sequences */ xmlXPtrEvalChildSeq(ctxt, name); } } SKIP_BLANKS; if (CUR != 0) XP_ERROR(XPATH_EXPR_ERROR); } ",0 "int js_isnumber(js_State *J, int idx) { return stackidx(J, idx)->type == JS_TNUMBER; } ",0 "int vrend_renderer_resource_get_info(int res_handle, struct vrend_renderer_resource_info *info) { struct vrend_resource *res; int elsize; if (!info) return EINVAL; res = vrend_resource_lookup(res_handle, 0); if (!res) return EINVAL; elsize = util_format_get_blocksize(res->base.format); info->handle = res_handle; info->tex_id = res->id; info->width = res->base.width0; info->height = res->base.height0; info->depth = res->base.depth0; info->format = res->base.format; info->flags = res->y_0_top ? VIRGL_RESOURCE_Y_0_TOP : 0; info->stride = util_format_get_nblocksx(res->base.format, u_minify(res->base.width0, 0)) * elsize; return 0; } ",0 "AirPDcapRsnaMng( UCHAR *decrypt_data, guint mac_header_len, guint *decrypt_len, PAIRPDCAP_KEY_ITEM key, AIRPDCAP_SEC_ASSOCIATION *sa, INT offset) { INT ret_value=1; UCHAR *try_data; guint try_data_len = *decrypt_len; if (*decrypt_len > try_data_len) { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsnaMng"", ""Invalid decryption length"", AIRPDCAP_DEBUG_LEVEL_3); return AIRPDCAP_RET_UNSUCCESS; } /* allocate a temp buffer for the decryption loop */ try_data=(UCHAR *)g_malloc(try_data_len); /* start of loop added by GCS */ for(/* sa */; sa != NULL ;sa=sa->next) { if (sa->validKey==FALSE) { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsnaMng"", ""Key not yet valid"", AIRPDCAP_DEBUG_LEVEL_3); continue; } /* copy the encrypted data into a temp buffer */ memcpy(try_data, decrypt_data, *decrypt_len); if (sa->wpa.key_ver==1) { /* CCMP -> HMAC-MD5 is the EAPOL-Key MIC, RC4 is the EAPOL-Key encryption algorithm */ AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsnaMng"", ""TKIP"", AIRPDCAP_DEBUG_LEVEL_3); DEBUG_DUMP(""ptk"", sa->wpa.ptk, 64); DEBUG_DUMP(""ptk portion used"", AIRPDCAP_GET_TK(sa->wpa.ptk), 16); ret_value=AirPDcapTkipDecrypt(try_data+offset, *decrypt_len-offset, try_data+AIRPDCAP_TA_OFFSET, AIRPDCAP_GET_TK(sa->wpa.ptk)); if (ret_value){ AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsnaMng"", ""TKIP failed!"", AIRPDCAP_DEBUG_LEVEL_3); continue; } AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsnaMng"", ""TKIP DECRYPTED!!!"", AIRPDCAP_DEBUG_LEVEL_3); /* remove MIC (8bytes) and ICV (4bytes) from the end of packet */ *decrypt_len-=12; break; } else { /* AES-CCMP -> HMAC-SHA1-128 is the EAPOL-Key MIC, AES wep_key wrap is the EAPOL-Key encryption algorithm */ AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsnaMng"", ""CCMP"", AIRPDCAP_DEBUG_LEVEL_3); ret_value=AirPDcapCcmpDecrypt(try_data, mac_header_len, (INT)*decrypt_len, AIRPDCAP_GET_TK(sa->wpa.ptk)); if (ret_value) continue; AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsnaMng"", ""CCMP DECRYPTED!!!"", AIRPDCAP_DEBUG_LEVEL_3); /* remove MIC (8bytes) from the end of packet */ *decrypt_len-=8; break; } } /* end of loop */ /* none of the keys worked */ if(sa == NULL) { g_free(try_data); return ret_value; } if (*decrypt_len > try_data_len || *decrypt_len < 8) { AIRPDCAP_DEBUG_PRINT_LINE(""AirPDcapRsnaMng"", ""Invalid decryption length"", AIRPDCAP_DEBUG_LEVEL_3); g_free(try_data); return AIRPDCAP_RET_UNSUCCESS; } /* copy the decrypted data into the decrypt buffer GCS*/ memcpy(decrypt_data, try_data, *decrypt_len); g_free(try_data); /* remove protection bit */ decrypt_data[1]&=0xBF; /* remove TKIP/CCMP header */ offset = mac_header_len; *decrypt_len-=8; memmove(decrypt_data+offset, decrypt_data+offset+8, *decrypt_len-offset); if (key!=NULL) { if (sa->key!=NULL) memcpy(key, sa->key, sizeof(AIRPDCAP_KEY_ITEM)); else memset(key, 0, sizeof(AIRPDCAP_KEY_ITEM)); memcpy(key->KeyData.Wpa.Ptk, sa->wpa.ptk, AIRPDCAP_WPA_PTK_LEN); /* copy the PTK to the key structure for future use by wireshark */ if (sa->wpa.key_ver==AIRPDCAP_WPA_KEY_VER_NOT_CCMP) key->KeyType=AIRPDCAP_KEY_TYPE_TKIP; else if (sa->wpa.key_ver==AIRPDCAP_WPA_KEY_VER_AES_CCMP) key->KeyType=AIRPDCAP_KEY_TYPE_CCMP; } return AIRPDCAP_RET_SUCCESS; } ",0 "static void airo_set_multicast_list(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; if ((dev->flags ^ ai->flags) & IFF_PROMISC) { change_bit(FLAG_PROMISC, &ai->flags); if (down_trylock(&ai->sem) != 0) { set_bit(JOB_PROMISC, &ai->jobs); wake_up_interruptible(&ai->thr_wait); } else airo_set_promisc(ai); } if ((dev->flags&IFF_ALLMULTI) || !netdev_mc_empty(dev)) { /* Turn on multicast. (Should be already setup...) */ } } ",0 "const RECTANGLE_16* region16_rects(const REGION16* region, UINT32* nbRects) { REGION16_DATA* data; if (nbRects) *nbRects = 0; if (!region) return NULL; data = region->data; if (!data) return NULL; if (nbRects) *nbRects = data->nbRects; return (RECTANGLE_16*)(data + 1); } ",0 "static void prb_close_block(struct tpacket_kbdq_core *pkc1, struct tpacket_block_desc *pbd1, struct packet_sock *po, unsigned int stat) { __u32 status = TP_STATUS_USER | stat; struct tpacket3_hdr *last_pkt; struct tpacket_hdr_v1 *h1 = &pbd1->hdr.bh1; struct sock *sk = &po->sk; if (po->stats.stats3.tp_drops) status |= TP_STATUS_LOSING; last_pkt = (struct tpacket3_hdr *)pkc1->prev; last_pkt->tp_next_offset = 0; /* Get the ts of the last pkt */ if (BLOCK_NUM_PKTS(pbd1)) { h1->ts_last_pkt.ts_sec = last_pkt->tp_sec; h1->ts_last_pkt.ts_nsec = last_pkt->tp_nsec; } else { /* Ok, we tmo'd - so get the current time. * * It shouldn't really happen as we don't close empty * blocks. See prb_retire_rx_blk_timer_expired(). */ struct timespec ts; getnstimeofday(&ts); h1->ts_last_pkt.ts_sec = ts.tv_sec; h1->ts_last_pkt.ts_nsec = ts.tv_nsec; } smp_wmb(); /* Flush the block */ prb_flush_block(pkc1, pbd1, status); sk->sk_data_ready(sk); pkc1->kactive_blk_num = GET_NEXT_PRB_BLK_NUM(pkc1); } ",0 "GahpServer::err_pipe_ready(int /*pipe_end*/) { int count = 0; char buff[5001]; buff[0] = '\0'; while (((count = (daemonCore->Read_Pipe(m_gahp_errorfd, &buff, 5000))))>0) { char *prev_line = buff; char *newline = buff - 1; buff[count]='\0'; while ( (newline = strchr( newline + 1, '\n' ) ) != NULL ) { *newline = '\0'; dprintf( D_FULLDEBUG, ""GAHP[%d] (stderr) -> %s%s\n"", m_gahp_pid, m_gahp_error_buffer.c_str(), prev_line ); prev_line = newline + 1; m_gahp_error_buffer = """"; } m_gahp_error_buffer += prev_line; } return TRUE; } ",0 "static void cm_work_handler(struct work_struct *_work) { struct cm_work *work = container_of(_work, struct cm_work, work.work); int ret; switch (work->cm_event.event) { case IB_CM_REQ_RECEIVED: ret = cm_req_handler(work); break; case IB_CM_MRA_RECEIVED: ret = cm_mra_handler(work); break; case IB_CM_REJ_RECEIVED: ret = cm_rej_handler(work); break; case IB_CM_REP_RECEIVED: ret = cm_rep_handler(work); break; case IB_CM_RTU_RECEIVED: ret = cm_rtu_handler(work); break; case IB_CM_USER_ESTABLISHED: ret = cm_establish_handler(work); break; case IB_CM_DREQ_RECEIVED: ret = cm_dreq_handler(work); break; case IB_CM_DREP_RECEIVED: ret = cm_drep_handler(work); break; case IB_CM_SIDR_REQ_RECEIVED: ret = cm_sidr_req_handler(work); break; case IB_CM_SIDR_REP_RECEIVED: ret = cm_sidr_rep_handler(work); break; case IB_CM_LAP_RECEIVED: ret = cm_lap_handler(work); break; case IB_CM_APR_RECEIVED: ret = cm_apr_handler(work); break; case IB_CM_TIMEWAIT_EXIT: ret = cm_timewait_handler(work); break; default: ret = -EINVAL; break; } if (ret) cm_free_work(work); } ",0 "void EglRenderingVDAClient::CreateDecoder() { CHECK(decoder_deleted()); #if defined(OS_WIN) scoped_refptr decoder = new DXVAVideoDecodeAccelerator(this, base::GetCurrentProcessHandle()); #else // OS_WIN scoped_refptr decoder = new OmxVideoDecodeAccelerator(this); decoder->SetEglState(egl_display(), egl_context()); #endif // OS_WIN decoder_ = decoder.release(); SetState(CS_DECODER_SET); if (decoder_deleted()) return; media::VideoCodecProfile profile = media::H264PROFILE_BASELINE; if (profile_ != -1) profile = static_cast(profile_); CHECK(decoder_->Initialize(profile)); } ",1 "GF_Err trgr_Size(GF_Box *s) { GF_TrackGroupBox *ptr = (GF_TrackGroupBox *)s; return gf_isom_box_array_size(s, ptr->groups); } ",0 "static std::unique_ptr GenericTimerData(ExecutionContext* context, int timer_id) { std::unique_ptr value = TracedValue::Create(); value->SetInteger(""timerId"", timer_id); if (LocalFrame* frame = FrameForExecutionContext(context)) value->SetString(""frame"", ToHexString(frame)); return value; } ",0 "void WebContentsImpl::ShowContextMenu(const ContextMenuParams& params) { if (delegate_ && delegate_->HandleContextMenu(params)) return; render_view_host_delegate_view_->ShowContextMenu(params); } ",0 "static int compat_do_replace(struct net *net, void __user *user, unsigned int len) { int ret, i, countersize, size64; struct ebt_table_info *newinfo; struct ebt_replace tmp; struct ebt_entries_buf_state state; void *entries_tmp; ret = compat_copy_ebt_replace_from_user(&tmp, user, len); if (ret) { /* try real handler in case userland supplied needed padding */ if (ret == -EINVAL && do_replace(net, user, len) == 0) ret = 0; return ret; } countersize = COUNTER_OFFSET(tmp.nentries) * nr_cpu_ids; newinfo = vmalloc(sizeof(*newinfo) + countersize); if (!newinfo) return -ENOMEM; if (countersize) memset(newinfo->counters, 0, countersize); memset(&state, 0, sizeof(state)); newinfo->entries = vmalloc(tmp.entries_size); if (!newinfo->entries) { ret = -ENOMEM; goto free_newinfo; } if (copy_from_user( newinfo->entries, tmp.entries, tmp.entries_size) != 0) { ret = -EFAULT; goto free_entries; } entries_tmp = newinfo->entries; xt_compat_lock(NFPROTO_BRIDGE); ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); if (ret < 0) goto out_unlock; pr_debug(""tmp.entries_size %d, kern off %d, user off %d delta %d\n"", tmp.entries_size, state.buf_kern_offset, state.buf_user_offset, xt_compat_calc_jump(NFPROTO_BRIDGE, tmp.entries_size)); size64 = ret; newinfo->entries = vmalloc(size64); if (!newinfo->entries) { vfree(entries_tmp); ret = -ENOMEM; goto out_unlock; } memset(&state, 0, sizeof(state)); state.buf_kern_start = newinfo->entries; state.buf_kern_len = size64; ret = compat_copy_entries(entries_tmp, tmp.entries_size, &state); BUG_ON(ret < 0); /* parses same data again */ vfree(entries_tmp); tmp.entries_size = size64; for (i = 0; i < NF_BR_NUMHOOKS; i++) { char __user *usrptr; if (tmp.hook_entry[i]) { unsigned int delta; usrptr = (char __user *) tmp.hook_entry[i]; delta = usrptr - tmp.entries; usrptr += xt_compat_calc_jump(NFPROTO_BRIDGE, delta); tmp.hook_entry[i] = (struct ebt_entries __user *)usrptr; } } xt_compat_flush_offsets(NFPROTO_BRIDGE); xt_compat_unlock(NFPROTO_BRIDGE); ret = do_replace_finish(net, &tmp, newinfo); if (ret == 0) return ret; free_entries: vfree(newinfo->entries); free_newinfo: vfree(newinfo); return ret; out_unlock: xt_compat_flush_offsets(NFPROTO_BRIDGE); xt_compat_unlock(NFPROTO_BRIDGE); goto free_entries; } ",0 " void Stop() { EXPECT_CALL(*vc_impl_, StopCapture(capture_client())) .Times(1) .WillOnce(CaptureStopped(capture_client(), vc_impl_.get())); EXPECT_CALL(*vc_manager_, RemoveDevice(_, _)) .WillOnce(Return()); decoder_->Stop(media::NewExpectedClosure()); message_loop_->RunAllPending(); } ",0 "MediaElementAudioSourceNode::~MediaElementAudioSourceNode() { ASSERT(!isInitialized()); } ",0 "void CommandBufferProxyImpl::SetNeedsVSync(bool needs_vsync) { CheckLock(); base::AutoLock lock(last_state_lock_); if (last_state_.error != gpu::error::kNoError) return; Send(new GpuCommandBufferMsg_SetNeedsVSync(route_id_, needs_vsync)); } ",0 "MagickExport DrawInfo *CloneDrawInfo(const ImageInfo *image_info, const DrawInfo *draw_info) { DrawInfo *clone_info; clone_info=(DrawInfo *) AcquireMagickMemory(sizeof(*clone_info)); if (clone_info == (DrawInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,""MemoryAllocationFailed""); GetDrawInfo(image_info,clone_info); if (draw_info == (DrawInfo *) NULL) return(clone_info); if (clone_info->primitive != (char *) NULL) (void) CloneString(&clone_info->primitive,draw_info->primitive); if (draw_info->geometry != (char *) NULL) (void) CloneString(&clone_info->geometry,draw_info->geometry); clone_info->viewbox=draw_info->viewbox; clone_info->affine=draw_info->affine; clone_info->gravity=draw_info->gravity; clone_info->fill=draw_info->fill; clone_info->stroke=draw_info->stroke; clone_info->stroke_width=draw_info->stroke_width; if (draw_info->fill_pattern != (Image *) NULL) clone_info->fill_pattern=CloneImage(draw_info->fill_pattern,0,0,MagickTrue, &draw_info->fill_pattern->exception); else if (draw_info->tile != (Image *) NULL) clone_info->fill_pattern=CloneImage(draw_info->tile,0,0,MagickTrue, &draw_info->tile->exception); clone_info->tile=NewImageList(); /* tile is deprecated */ if (draw_info->stroke_pattern != (Image *) NULL) clone_info->stroke_pattern=CloneImage(draw_info->stroke_pattern,0,0, MagickTrue,&draw_info->stroke_pattern->exception); clone_info->stroke_antialias=draw_info->stroke_antialias; clone_info->text_antialias=draw_info->text_antialias; clone_info->fill_rule=draw_info->fill_rule; clone_info->linecap=draw_info->linecap; clone_info->linejoin=draw_info->linejoin; clone_info->miterlimit=draw_info->miterlimit; clone_info->dash_offset=draw_info->dash_offset; clone_info->decorate=draw_info->decorate; clone_info->compose=draw_info->compose; if (draw_info->text != (char *) NULL) (void) CloneString(&clone_info->text,draw_info->text); if (draw_info->font != (char *) NULL) (void) CloneString(&clone_info->font,draw_info->font); if (draw_info->metrics != (char *) NULL) (void) CloneString(&clone_info->metrics,draw_info->metrics); if (draw_info->family != (char *) NULL) (void) CloneString(&clone_info->family,draw_info->family); clone_info->style=draw_info->style; clone_info->stretch=draw_info->stretch; clone_info->weight=draw_info->weight; if (draw_info->encoding != (char *) NULL) (void) CloneString(&clone_info->encoding,draw_info->encoding); clone_info->pointsize=draw_info->pointsize; clone_info->kerning=draw_info->kerning; clone_info->interline_spacing=draw_info->interline_spacing; clone_info->interword_spacing=draw_info->interword_spacing; clone_info->direction=draw_info->direction; if (draw_info->density != (char *) NULL) (void) CloneString(&clone_info->density,draw_info->density); clone_info->align=draw_info->align; clone_info->undercolor=draw_info->undercolor; clone_info->border_color=draw_info->border_color; if (draw_info->server_name != (char *) NULL) (void) CloneString(&clone_info->server_name,draw_info->server_name); if (draw_info->dash_pattern != (double *) NULL) { register ssize_t x; for (x=0; fabs(draw_info->dash_pattern[x]) >= DrawEpsilon; x++) ; clone_info->dash_pattern=(double *) AcquireQuantumMemory((size_t) x+1UL, sizeof(*clone_info->dash_pattern)); if (clone_info->dash_pattern == (double *) NULL) ThrowFatalException(ResourceLimitFatalError, ""UnableToAllocateDashPattern""); (void) CopyMagickMemory(clone_info->dash_pattern,draw_info->dash_pattern, (size_t) (x+1)*sizeof(*clone_info->dash_pattern)); } clone_info->gradient=draw_info->gradient; if (draw_info->gradient.stops != (StopInfo *) NULL) { size_t number_stops; number_stops=clone_info->gradient.number_stops; clone_info->gradient.stops=(StopInfo *) AcquireQuantumMemory((size_t) number_stops,sizeof(*clone_info->gradient.stops)); if (clone_info->gradient.stops == (StopInfo *) NULL) ThrowFatalException(ResourceLimitFatalError, ""UnableToAllocateDashPattern""); (void) CopyMagickMemory(clone_info->gradient.stops, draw_info->gradient.stops,(size_t) number_stops* sizeof(*clone_info->gradient.stops)); } if (draw_info->clip_mask != (char *) NULL) (void) CloneString(&clone_info->clip_mask,draw_info->clip_mask); clone_info->bounds=draw_info->bounds; clone_info->clip_units=draw_info->clip_units; clone_info->render=draw_info->render; clone_info->fill_opacity=draw_info->fill_opacity; clone_info->stroke_opacity=draw_info->stroke_opacity; clone_info->element_reference=draw_info->element_reference; clone_info->debug=IsEventLogging(); return(clone_info); } ",0 " ~WorkerData() {} ",0 "MagickExport void RemoveDuplicateLayers(Image **images, ExceptionInfo *exception) { register Image *curr, *next; RectangleInfo bounds; assert((*images) != (const Image *) NULL); assert((*images)->signature == MagickCoreSignature); if ((*images)->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",(*images)->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); curr=GetFirstImageInList(*images); for (; (next=GetNextImageInList(curr)) != (Image *) NULL; curr=next) { if ( curr->columns != next->columns || curr->rows != next->rows || curr->page.x != next->page.x || curr->page.y != next->page.y ) continue; bounds=CompareImagesBounds(curr,next,CompareAnyLayer,exception); if ( bounds.x < 0 ) { /* the two images are the same, merge time delays and delete one. */ size_t time; time = curr->delay*1000/curr->ticks_per_second; time += next->delay*1000/next->ticks_per_second; next->ticks_per_second = 100L; next->delay = time*curr->ticks_per_second/1000; next->iterations = curr->iterations; *images = curr; (void) DeleteImageFromList(images); } } *images = GetFirstImageInList(*images); } ",1 "modifier_read(png_structp ppIn, png_bytep pb, png_size_t st) { png_const_structp pp = ppIn; png_modifier *pm = voidcast(png_modifier*, png_get_io_ptr(pp)); if (pm == NULL || pm->this.pread != pp) png_error(pp, ""bad modifier_read call""); modifier_read_imp(pm, pb, st); } ",0 "vrrp_master(vrrp_t * vrrp) { /* Send the VRRP advert */ vrrp_state_master_tx(vrrp); } ",0 "WebDevToolsAgentImpl::WebDevToolsAgentImpl( WebViewImpl* webViewImpl, WebDevToolsAgentClient* client) : m_hostId(client->hostIdentifier()) , m_client(client) , m_webViewImpl(webViewImpl) , m_attached(false) , m_generatingEvent(false) , m_deviceMetricsEnabled(false) , m_emulateViewportEnabled(false) , m_originalViewportEnabled(false) , m_isOverlayScrollbarsEnabled(false) , m_touchEventEmulationEnabled(false) { ASSERT(m_hostId > 0); ClientMessageLoopAdapter::ensureClientMessageLoopCreated(m_client); } ",0 "ssh_packet_set_tos(struct ssh *ssh, int tos) { if (!ssh_packet_connection_is_on_socket(ssh)) return; switch (ssh_packet_connection_af(ssh)) { case AF_INET: debug3(""%s: set IP_TOS 0x%02x"", __func__, tos); if (setsockopt(ssh->state->connection_in, IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) < 0) error(""setsockopt IP_TOS %d: %.100s:"", tos, strerror(errno)); break; case AF_INET6: debug3(""%s: set IPV6_TCLASS 0x%02x"", __func__, tos); if (setsockopt(ssh->state->connection_in, IPPROTO_IPV6, IPV6_TCLASS, &tos, sizeof(tos)) < 0) error(""setsockopt IPV6_TCLASS %d: %.100s:"", tos, strerror(errno)); break; } } ",0 "static void command_port_read_callback(struct urb *urb) { struct usb_serial_port *command_port = urb->context; struct whiteheat_command_private *command_info; int status = urb->status; unsigned char *data = urb->transfer_buffer; int result; command_info = usb_get_serial_port_data(command_port); if (!command_info) { dev_dbg(&urb->dev->dev, ""%s - command_info is NULL, exiting.\n"", __func__); return; } if (!urb->actual_length) { dev_dbg(&urb->dev->dev, ""%s - empty response, exiting.\n"", __func__); return; } if (status) { dev_dbg(&urb->dev->dev, ""%s - nonzero urb status: %d\n"", __func__, status); if (status != -ENOENT) command_info->command_finished = WHITEHEAT_CMD_FAILURE; wake_up(&command_info->wait_command); return; } usb_serial_debug_data(&command_port->dev, __func__, urb->actual_length, data); if (data[0] == WHITEHEAT_CMD_COMPLETE) { command_info->command_finished = WHITEHEAT_CMD_COMPLETE; wake_up(&command_info->wait_command); } else if (data[0] == WHITEHEAT_CMD_FAILURE) { command_info->command_finished = WHITEHEAT_CMD_FAILURE; wake_up(&command_info->wait_command); } else if (data[0] == WHITEHEAT_EVENT) { /* These are unsolicited reports from the firmware, hence no waiting command to wakeup */ dev_dbg(&urb->dev->dev, ""%s - event received\n"", __func__); } else if ((data[0] == WHITEHEAT_GET_DTR_RTS) && (urb->actual_length - 1 <= sizeof(command_info->result_buffer))) { memcpy(command_info->result_buffer, &data[1], urb->actual_length - 1); command_info->command_finished = WHITEHEAT_CMD_COMPLETE; wake_up(&command_info->wait_command); } else dev_dbg(&urb->dev->dev, ""%s - bad reply from firmware\n"", __func__); /* Continue trying to always read */ result = usb_submit_urb(command_port->read_urb, GFP_ATOMIC); if (result) dev_dbg(&urb->dev->dev, ""%s - failed resubmitting read urb, error %d\n"", __func__, result); } ",0 "gs_heap_status(gs_memory_t * mem, gs_memory_status_t * pstat) { gs_malloc_memory_t *mmem = (gs_malloc_memory_t *) mem; pstat->allocated = mmem->used + heap_available(); pstat->used = mmem->used; pstat->is_thread_safe = true; /* this allocator has a mutex (monitor) and IS thread safe */ } ",0 "bool TabStrip::OnMouseDragged(const ui::MouseEvent& event) { ContinueDrag(this, event); return true; } ",0 "bool jsvIsStringEqualOrStartsWithOffset(JsVar *var, const char *str, bool isStartsWith, size_t startIdx, bool ignoreCase) { if (!jsvHasCharacterData(var)) { return 0; // not a string so not equal! } JsvStringIterator it; jsvStringIteratorNew(&it, var, startIdx); if (ignoreCase) { while (jsvStringIteratorHasChar(&it) && *str && jsvStringCharToLower(jsvStringIteratorGetChar(&it)) == jsvStringCharToLower(*str)) { str++; jsvStringIteratorNext(&it); } } else { while (jsvStringIteratorHasChar(&it) && *str && jsvStringIteratorGetChar(&it) == *str) { str++; jsvStringIteratorNext(&it); } } bool eq = (isStartsWith && !*str) || jsvStringIteratorGetChar(&it)==*str; // should both be 0 if equal jsvStringIteratorFree(&it); return eq; } ",0 "static void cm_free_work(struct cm_work *work) { if (work->mad_recv_wc) ib_free_recv_mad(work->mad_recv_wc); kfree(work); } ",0 "void TabStrip::AnimateToIdealBounds() { for (int i = 0; i < tab_count(); ++i) { Tab* tab = tab_at(i); if (tab->dragging() && !bounds_animator_.IsAnimating(tab)) continue; const gfx::Rect& target_bounds = ideal_bounds(i); if (bounds_animator_.GetTargetBounds(tab) == target_bounds) continue; bounds_animator_.AnimateViewTo( tab, target_bounds, tab->dragging() ? nullptr : std::make_unique(this, tab)); } if (bounds_animator_.GetTargetBounds(new_tab_button_) != new_tab_button_bounds_) bounds_animator_.AnimateViewTo(new_tab_button_, new_tab_button_bounds_); } ",0 "void StyleResolver::appendAuthorStyleSheets(unsigned firstNew, const Vector >& styleSheets) { unsigned size = styleSheets.size(); for (unsigned i = firstNew; i < size; ++i) { CSSStyleSheet* cssSheet = styleSheets[i].get(); ASSERT(!cssSheet->disabled()); if (cssSheet->mediaQueries() && !m_medium->eval(cssSheet->mediaQueries(), &m_viewportDependentMediaQueryResults)) continue; StyleSheetContents* sheet = cssSheet->contents(); ContainerNode* scopingNode = ScopedStyleResolver::scopingNodeFor(cssSheet); if (!scopingNode && cssSheet->ownerNode() && cssSheet->ownerNode()->isInShadowTree()) continue; ScopedStyleResolver* resolver = ensureScopedStyleResolver(scopingNode); ASSERT(resolver); resolver->addRulesFromSheet(sheet, *m_medium, this); m_inspectorCSSOMWrappers.collectFromStyleSheetIfNeeded(cssSheet); } } ",0 "MagickExport size_t GetPixelCacheChannels(const Cache cache) { CacheInfo *restrict cache_info; assert(cache != (Cache) NULL); cache_info=(CacheInfo *) cache; assert(cache_info->signature == MagickSignature); if (cache_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", cache_info->filename); return(cache_info->channels); } ",0 "void DownloadManagerImpl::AddUrlDownloadHandler( UniqueUrlDownloadHandlerPtr downloader) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (downloader) url_download_handlers_.push_back(std::move(downloader)); } ",0 "static int mov_read_seek(AVFormatContext *s, int stream_index, int64_t sample_time, int flags) { AVStream *st; int64_t seek_timestamp, timestamp; int sample; int i; if (stream_index >= s->nb_streams) return AVERROR_INVALIDDATA; if (sample_time < 0) sample_time = 0; st = s->streams[stream_index]; sample = mov_seek_stream(s, st, sample_time, flags); if (sample < 0) return sample; /* adjust seek timestamp to found sample timestamp */ seek_timestamp = st->index_entries[sample].timestamp; for (i = 0; i < s->nb_streams; i++) { st = s->streams[i]; if (stream_index == i) continue; timestamp = av_rescale_q(seek_timestamp, s->streams[stream_index]->time_base, st->time_base); mov_seek_stream(s, st, timestamp, flags); } return 0; } ",0 "static int do_insn_ioctl(struct comedi_device *dev, struct comedi_insn __user *arg, void *file) { struct comedi_insn insn; unsigned int *data = NULL; int ret = 0; data = kmalloc(sizeof(unsigned int) * MAX_SAMPLES, GFP_KERNEL); if (!data) { ret = -ENOMEM; goto error; } if (copy_from_user(&insn, arg, sizeof(struct comedi_insn))) { ret = -EFAULT; goto error; } /* This is where the behavior of insn and insnlist deviate. */ if (insn.n > MAX_SAMPLES) insn.n = MAX_SAMPLES; if (insn.insn & INSN_MASK_WRITE) { if (copy_from_user(data, insn.data, insn.n * sizeof(unsigned int))) { ret = -EFAULT; goto error; } } ret = parse_insn(dev, &insn, data, file); if (ret < 0) goto error; if (insn.insn & INSN_MASK_READ) { if (copy_to_user(insn.data, data, insn.n * sizeof(unsigned int))) { ret = -EFAULT; goto error; } } ret = insn.n; error: kfree(data); return ret; } ",0 "int kvm_vm_ioctl_irq_line(struct kvm *kvm, struct kvm_irq_level *irq_event, bool line_status) { if (!irqchip_in_kernel(kvm)) return -ENXIO; irq_event->status = kvm_set_irq(kvm, KVM_USERSPACE_IRQ_SOURCE_ID, irq_event->irq, irq_event->level, line_status); return 0; } ",0 "ar6000_display_roam_time(WMI_TARGET_ROAM_TIME *p) { A_PRINTF(""Disconnect Data : BSSID: ""); AR6000_PRINT_BSSID(p->disassoc_bssid); A_PRINTF("" RSSI %d DISASSOC Time %d NO_TXRX_TIME %d\n"", p->disassoc_bss_rssi,p->disassoc_time, p->no_txrx_time); A_PRINTF(""Connect Data: BSSID: ""); AR6000_PRINT_BSSID(p->assoc_bssid); A_PRINTF("" RSSI %d ASSOC Time %d TXRX_TIME %d\n"", p->assoc_bss_rssi,p->assoc_time, p->allow_txrx_time); } ",0 "static void user_read_data(png_structp png_ptr, png_bytep data, png_size_t length) { struct rwpng_read_data *read_data = (struct rwpng_read_data *)png_get_io_ptr(png_ptr); png_size_t read = fread(data, 1, length, read_data->fp); if (!read) { png_error(png_ptr, ""Read error""); } read_data->bytes_read += read; } ",0 "static BOOL CALLBACK ClipDCToChild(HWND window, LPARAM param) { ClipState* clip_state = reinterpret_cast(param); if (GetParent(window) == clip_state->parent && IsWindowVisible(window)) { RECT bounds; GetWindowRect(window, &bounds); ExcludeClipRect(clip_state->dc, bounds.left - clip_state->x, bounds.top - clip_state->y, bounds.right - clip_state->x, bounds.bottom - clip_state->y); } return TRUE; } ",0 "void OmniboxViewWin::PasteAndGo(const string16& text) { if (CanPasteAndGo(text)) model_->PasteAndGo(); } ",0 "Eina_Bool ewk_view_paint(Ewk_View_Private_Data* priv, cairo_t* cr, const Eina_Rectangle* area) { EINA_SAFETY_ON_NULL_RETURN_VAL(priv, false); EINA_SAFETY_ON_NULL_RETURN_VAL(cr, false); EINA_SAFETY_ON_NULL_RETURN_VAL(area, false); WebCore::FrameView* view = priv->mainFrame->view(); EINA_SAFETY_ON_NULL_RETURN_VAL(view, false); if (view->needsLayout()) view->forceLayout(); WebCore::GraphicsContext graphicsContext(cr); WebCore::IntRect rect(area->x, area->y, area->w, area->h); cairo_save(cr); graphicsContext.save(); graphicsContext.clip(rect); if (view->isTransparent()) graphicsContext.clearRect(rect); view->paint(&graphicsContext, rect); graphicsContext.restore(); cairo_restore(cr); return true; } ",0 "static int x25_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; int val, len, rc = -ENOPROTOOPT; if (level != SOL_X25 || optname != X25_QBITINCL) goto out; rc = -EFAULT; if (get_user(len, optlen)) goto out; len = min_t(unsigned int, len, sizeof(int)); rc = -EINVAL; if (len < 0) goto out; rc = -EFAULT; if (put_user(len, optlen)) goto out; val = test_bit(X25_Q_BIT_FLAG, &x25_sk(sk)->flags); rc = copy_to_user(optval, &val, len) ? -EFAULT : 0; out: return rc; } ",0 "hrtick_start_fair(struct rq *rq, struct task_struct *p) { } ",0 "static int opor(RAsm *a, ut8 * data, const Opcode *op) { if (op->operands[1].type & OT_CONSTANT) { if (op->operands[0].type & OT_GPREG && op->operands[0].type & OT_WORD) { return process_16bit_group_1 (a, data, op, 0x08); } if (!is_al_reg (&op->operands[0])) { return process_group_1 (a, data, op); } } return process_1byte_op (a, data, op, 0x08); } ",0 "bool CreateIndex(sql::Database* db, const IndexInfo& info) { std::string sql; if (info.unique) sql += ""CREATE UNIQUE INDEX ""; else sql += ""CREATE INDEX ""; sql += info.index_name; sql += "" ON ""; sql += info.table_name; sql += info.columns; return db->Execute(sql.c_str()); } ",0 "void FrameLoader::CommitNavigation(const FrameLoadRequest& passed_request, FrameLoadType frame_load_type, HistoryItem* history_item) { CHECK(!passed_request.OriginDocument()); CHECK(passed_request.FrameName().IsEmpty()); CHECK(!passed_request.TriggeringEvent()); CHECK(!passed_request.Form()); return LoadInternal(passed_request, frame_load_type, history_item, false /* check_with_client */); } ",0 "void GlobalHistogramAllocator::CreateWithLocalMemory( size_t size, uint64_t id, StringPiece name) { Set(WrapUnique(new GlobalHistogramAllocator( std::make_unique(size, id, name)))); } ",0 "GDataFileSystem::CreateDirectoryParams::~CreateDirectoryParams() { } ",0 "bool SessionModelAssociator::WriteTabContentsToSyncModel( const SyncedWindowDelegate& window, const SyncedTabDelegate& tab, int64 sync_id, sync_api::WriteTransaction* trans) { DCHECK(CalledOnValidThread()); sync_api::WriteNode tab_node(trans); if (!tab_node.InitByIdLookup(sync_id)) { LOG(ERROR) << ""Failed to look up tab node "" << sync_id; return false; } sync_pb::SessionSpecifics session_s; session_s.set_session_tag(GetCurrentMachineTag()); sync_pb::SessionTab* tab_s = session_s.mutable_tab(); SessionID::id_type tab_id = tab.GetSessionId(); tab_s->set_tab_id(tab_id); tab_s->set_window_id(tab.GetWindowId()); const int current_index = tab.GetCurrentEntryIndex(); const int min_index = std::max(0, current_index - max_sync_navigation_count); const int max_index = std::min(current_index + max_sync_navigation_count, tab.GetEntryCount()); const int pending_index = tab.GetPendingEntryIndex(); tab_s->set_pinned(window.IsTabPinned(&tab)); if (tab.HasExtensionAppId()) { tab_s->set_extension_app_id(tab.GetExtensionAppId()); } for (int i = min_index; i < max_index; ++i) { const NavigationEntry* entry = (i == pending_index) ? tab.GetPendingEntry() : tab.GetEntryAtIndex(i); DCHECK(entry); if (entry->virtual_url().is_valid()) { if (i == max_index - 1) { VLOG(1) << ""Associating tab "" << tab_id << "" with sync id "" << sync_id << "", url "" << entry->virtual_url().possibly_invalid_spec() << "" and title "" << entry->title(); } TabNavigation tab_nav; tab_nav.SetFromNavigationEntry(*entry); sync_pb::TabNavigation* nav_s = tab_s->add_navigation(); PopulateSessionSpecificsNavigation(&tab_nav, nav_s); } } tab_s->set_current_navigation_index(current_index); tab_node.SetSessionSpecifics(session_s); SessionTab* session_tab = synced_session_tracker_.GetSessionTab(GetCurrentMachineTag(), tab_s->tab_id(), false); PopulateSessionTabFromSpecifics(*tab_s, base::Time::Now(), session_tab); return true; } ",1 "void JSTestObjOwner::finalize(JSC::Handle handle, void* context) { JSTestObj* jsTestObj = jsCast(handle.get().asCell()); DOMWrapperWorld* world = static_cast(context); uncacheWrapper(world, jsTestObj->impl(), jsTestObj); jsTestObj->releaseImpl(); } ",0 "bool RenderWidgetHostViewAura::GetSelectionRange(gfx::Range* range) const { if (!text_input_manager_ || !GetFocusedWidget()) return false; const TextInputManager::TextSelection* selection = text_input_manager_->GetTextSelection(GetFocusedWidget()->GetView()); if (!selection) return false; range->set_start(selection->range().start()); range->set_end(selection->range().end()); return true; } ",0 "off_t vfs_transfer_file(files_struct *in, files_struct *out, off_t n) { return transfer_file_internal((void *)in, (void *)out, n, vfs_pread_fn, vfs_pwrite_fn); } ",0 "uint32_t GLES2Util::GLErrorBitToGLError(uint32_t error_bit) { switch (error_bit) { case gl_error_bit::kInvalidEnum: return GL_INVALID_ENUM; case gl_error_bit::kInvalidValue: return GL_INVALID_VALUE; case gl_error_bit::kInvalidOperation: return GL_INVALID_OPERATION; case gl_error_bit::kOutOfMemory: return GL_OUT_OF_MEMORY; case gl_error_bit::kInvalidFramebufferOperation: return GL_INVALID_FRAMEBUFFER_OPERATION; case gl_error_bit::kContextLost: return GL_CONTEXT_LOST_KHR; default: NOTREACHED(); return GL_NO_ERROR; } } ",0 "static IW_INLINE iw_tmpsample linear_to_gamma_sample(iw_tmpsample v_linear, double gamma) { return pow(v_linear,1.0/gamma); } ",0 "ImportArrayTIFF_Rational ( const TIFF_Manager::TagInfo & tagInfo, const bool nativeEndian, SXMPMeta * xmp, const char * xmpNS, const char * xmpProp ) { try { // Don't let errors with one stop the others. XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr; xmp->DeleteProperty ( xmpNS, xmpProp ); // ! Don't keep appending, create a new array. for ( size_t i = 0; i < tagInfo.count; ++i, binPtr += 2 ) { XMP_Uns32 binNum = GetUns32AsIs ( &binPtr[0] ); XMP_Uns32 binDenom = GetUns32AsIs ( &binPtr[1] ); if ( ! nativeEndian ) { binNum = Flip4 ( binNum ); binDenom = Flip4 ( binDenom ); } char strValue[40]; snprintf ( strValue, sizeof(strValue), ""%lu/%lu"", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Using sizeof(strValue) is safe. xmp->AppendArrayItem ( xmpNS, xmpProp, kXMP_PropArrayIsOrdered, strValue ); } } catch ( ... ) { } } // ImportArrayTIFF_Rational ",0 "void blk_rq_bio_prep(struct request_queue *q, struct request *rq, struct bio *bio) { if (bio_has_data(bio)) rq->nr_phys_segments = bio_phys_segments(q, bio); else if (bio_op(bio) == REQ_OP_DISCARD) rq->nr_phys_segments = 1; rq->__data_len = bio->bi_iter.bi_size; rq->bio = rq->biotail = bio; if (bio->bi_disk) rq->rq_disk = bio->bi_disk; } ",0 "syncer::ModelTypeSet SupervisedUserService::GetPreferredDataTypes() const { if (!ProfileIsSupervised()) return syncer::ModelTypeSet(); syncer::ModelTypeSet result; result.Put(syncer::EXTENSIONS); result.Put(syncer::EXTENSION_SETTINGS); result.Put(syncer::APPS); result.Put(syncer::APP_SETTINGS); result.Put(syncer::APP_NOTIFICATIONS); result.Put(syncer::APP_LIST); return result; } ",0 "bool RenderFrameDevToolsAgentHost::IsChildFrame() { return frame_tree_node_ && frame_tree_node_->parent(); } ",0 "static void updateHashChain(Hash* hash, size_t wpos, unsigned hashval, unsigned short numzeros) { hash->val[wpos] = (int)hashval; if(hash->head[hashval] != -1) hash->chain[wpos] = hash->head[hashval]; hash->head[hashval] = wpos; hash->zeros[wpos] = numzeros; if(hash->headz[numzeros] != -1) hash->chainz[wpos] = hash->headz[numzeros]; hash->headz[numzeros] = wpos; } ",0 "static void pmcraid_internal_done(struct pmcraid_cmd *cmd) { pmcraid_info(""response internal cmd CDB[0] = %x ioasc = %x\n"", cmd->ioa_cb->ioarcb.cdb[0], le32_to_cpu(cmd->ioa_cb->ioasa.ioasc)); /* Some of the internal commands are sent with callers blocking for the * response. Same will be indicated as part of cmd->completion_req * field. Response path needs to wake up any waiters waiting for cmd * completion if this flag is set. */ if (cmd->completion_req) { cmd->completion_req = 0; complete(&cmd->wait_for_completion); } /* most of the internal commands are completed by caller itself, so * no need to return the command block back to free pool until we are * required to do so (e.g once done with initialization). */ if (cmd->release) { cmd->release = 0; pmcraid_return_cmd(cmd); } } ",0 "static int whiteheat_port_remove(struct usb_serial_port *port) { struct whiteheat_private *info; info = usb_get_serial_port_data(port); kfree(info); return 0; } ",0 " FT_New_Library( FT_Memory memory, FT_Library *alibrary ) { FT_Library library = 0; FT_Error error; if ( !memory ) return FT_Err_Invalid_Argument; #ifdef FT_DEBUG_LEVEL_ERROR /* init debugging support */ ft_debug_init(); #endif /* first of all, allocate the library object */ if ( FT_NEW( library ) ) return error; library->memory = memory; #ifdef FT_CONFIG_OPTION_PIC /* initialize position independent code containers */ error = ft_pic_container_init( library ); if ( error ) goto Fail; #endif /* allocate the render pool */ library->raster_pool_size = FT_RENDER_POOL_SIZE; #if FT_RENDER_POOL_SIZE > 0 if ( FT_ALLOC( library->raster_pool, FT_RENDER_POOL_SIZE ) ) goto Fail; #endif library->version_major = FREETYPE_MAJOR; library->version_minor = FREETYPE_MINOR; library->version_patch = FREETYPE_PATCH; /* That's ok now */ *alibrary = library; return FT_Err_Ok; Fail: #ifdef FT_CONFIG_OPTION_PIC ft_pic_container_destroy( library ); #endif FT_FREE( library ); return error; } ",0 "static bool is_kernel_event(struct perf_event *event) { return event->owner == EVENT_OWNER_KERNEL; } ",0 "void luaD_seterrorobj (lua_State *L, int errcode, StkId oldtop) { switch (errcode) { case LUA_ERRMEM: { setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); break; } case LUA_ERRERR: { setsvalue2s(L, oldtop, luaS_newliteral(L, ""error in error handling"")); break; } case LUA_ERRSYNTAX: case LUA_ERRRUN: { setobjs2s(L, oldtop, L->top - 1); /* error message on current top */ break; } } L->top = oldtop + 1; } ",0 "void FrameLoader::receivedFirstData() { writer()->begin(m_workingURL, false); dispatchDidCommitLoad(); dispatchDidClearWindowObjectsInAllWorlds(); if (m_documentLoader) { String ptitle = m_documentLoader->title(); if (!ptitle.isNull()) m_client->dispatchDidReceiveTitle(ptitle); } m_workingURL = KURL(); double delay; String url; if (!m_documentLoader) return; if (m_frame->inViewSourceMode()) return; if (!parseHTTPRefresh(m_documentLoader->response().httpHeaderField(""Refresh""), false, delay, url)) return; if (url.isEmpty()) url = m_URL.string(); else url = m_frame->document()->completeURL(url).string(); m_frame->redirectScheduler()->scheduleRedirect(delay, url); } ",0 "static std::string SizeToString(const gfx::Size& max_size) { return base::IntToString(max_size.width()) + ""x"" + base::IntToString(max_size.height()); } ",0 "static __net_init int rt_genid_init(struct net *net) { get_random_bytes(&net->ipv4.rt_genid, sizeof(net->ipv4.rt_genid)); get_random_bytes(&net->ipv4.dev_addr_genid, sizeof(net->ipv4.dev_addr_genid)); return 0; } ",0 "v8::Handle V8WebGLRenderingContext::uniformMatrix4fvCallback(const v8::Arguments& args) { INC_STATS(""DOM.WebGLRenderingContext.uniformMatrix4fv()""); return uniformMatrixHelper(args, 4); } ",0 "void WebContentsImpl::OnDidRunInsecureContent( const std::string& security_origin, const GURL& target_url) { LOG(INFO) << security_origin << "" ran insecure content from "" << target_url.possibly_invalid_spec(); RecordAction(UserMetricsAction(""SSL.RanInsecureContent"")); if (EndsWith(security_origin, kDotGoogleDotCom, false)) RecordAction(UserMetricsAction(""SSL.RanInsecureContentGoogle"")); controller_.ssl_manager()->DidRunInsecureContent(security_origin); displayed_insecure_content_ = true; SSLManager::NotifySSLInternalStateChanged( GetController().GetBrowserContext()); } ",0 "void PushMessagingServiceImpl::GetEncryptionInfoForAppId( const std::string& app_id, const std::string& sender_id, gcm::GCMEncryptionProvider::EncryptionInfoCallback callback) { if (PushMessagingAppIdentifier::UseInstanceID(app_id)) { GetInstanceIDDriver()->GetInstanceID(app_id)->GetEncryptionInfo( NormalizeSenderInfo(sender_id), callback); } else { GetGCMDriver()->GetEncryptionInfo(app_id, callback); } } ",0 "mrb_dup(mrb_state *mrb, int fd, mrb_bool *failed) { int new_fd; *failed = FALSE; if (fd < 0) return fd; new_fd = dup(fd); if (new_fd == -1) *failed = TRUE; return new_fd; } ",0 "static int __init serpent_mod_init(void) { return crypto_register_algs(srp_algs, ARRAY_SIZE(srp_algs)); } ",0 "lvm2_lv_create_device_added_cb (Daemon *daemon, const char *object_path, gpointer user_data) { CreateLvm2LVData *data = user_data; Device *device; g_debug (""added %s"", object_path); device = lvm2_lv_create_has_lv (data); if (device != NULL) { /* yay! it is.. now create the file system if requested */ lvm2_lv_create_found_device (device, data); g_signal_handler_disconnect (daemon, data->device_added_signal_handler_id); g_signal_handler_disconnect (daemon, data->device_changed_signal_handler_id); g_source_remove (data->device_added_timeout_id); lvm2_lv_create_data_unref (data); } } ",0 "static void ext_key_event(VncState *vs, int down, uint32_t sym, uint16_t keycode) { /* if the user specifies a keyboard layout, always use it */ if (keyboard_layout) { key_event(vs, down, sym); } else { trace_vnc_key_event_ext(down, sym, keycode, code2name(keycode)); do_key_event(vs, down, keycode, sym); } } ",0 "actionWord( JobAction action, bool past ) { switch( action ) { case JA_RELEASE_JOBS: return past ? ""released"" : ""release""; break; case JA_HOLD_JOBS: return past ? ""held"" : ""hold""; break; case JA_SUSPEND_JOBS: return past ? ""suspended"" : ""suspend""; break; case JA_CONTINUE_JOBS: return past ? ""continued"" : ""continue""; break; case JA_REMOVE_JOBS: case JA_REMOVE_X_JOBS: return past ? ""removed"" : ""remove""; break; case JA_VACATE_JOBS: return past ? ""vacated"" : ""vacate""; break; case JA_VACATE_FAST_JOBS: return past ? ""fast-vacated"" : ""fast-vacate""; break; default: fprintf( stderr, ""ERROR: Unknown action: %d\n"", action ); exit( 1 ); break; } return NULL; } ",0 "void* Type_LUTA2B_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) { cmsUInt32Number BaseOffset; cmsUInt8Number inputChan; // Number of input channels cmsUInt8Number outputChan; // Number of output channels cmsUInt32Number offsetB; // Offset to first ""B"" curve cmsUInt32Number offsetMat; // Offset to matrix cmsUInt32Number offsetM; // Offset to first ""M"" curve cmsUInt32Number offsetC; // Offset to CLUT cmsUInt32Number offsetA; // Offset to first ""A"" curve cmsPipeline* NewLUT = NULL; BaseOffset = io ->Tell(io) - sizeof(_cmsTagBase); if (!_cmsReadUInt8Number(io, &inputChan)) return NULL; if (!_cmsReadUInt8Number(io, &outputChan)) return NULL; if (!_cmsReadUInt16Number(io, NULL)) return NULL; if (!_cmsReadUInt32Number(io, &offsetB)) return NULL; if (!_cmsReadUInt32Number(io, &offsetMat)) return NULL; if (!_cmsReadUInt32Number(io, &offsetM)) return NULL; if (!_cmsReadUInt32Number(io, &offsetC)) return NULL; if (!_cmsReadUInt32Number(io, &offsetA)) return NULL; NewLUT = cmsPipelineAlloc(self ->ContextID, inputChan, outputChan); if (NewLUT == NULL) return NULL; if (offsetA!= 0) { if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, ReadSetOfCurves(self, io, BaseOffset + offsetA, inputChan))) goto Error; } if (offsetC != 0) { if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, ReadCLUT(self, io, BaseOffset + offsetC, inputChan, outputChan))) goto Error; } if (offsetM != 0) { if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, ReadSetOfCurves(self, io, BaseOffset + offsetM, outputChan))) goto Error; } if (offsetMat != 0) { if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, ReadMatrix(self, io, BaseOffset + offsetMat))) goto Error; } if (offsetB != 0) { if (!cmsPipelineInsertStage(NewLUT, cmsAT_END, ReadSetOfCurves(self, io, BaseOffset + offsetB, outputChan))) goto Error; } *nItems = 1; return NewLUT; Error: cmsPipelineFree(NewLUT); return NULL; cmsUNUSED_PARAMETER(SizeOfTag); } ",0 " ~FlagsStateSingleton() {} ",0 "png_push_have_info(png_structp png_ptr, png_infop info_ptr) { if (png_ptr->info_fn != NULL) (*(png_ptr->info_fn))(png_ptr, info_ptr); } ",0 "void AudioOutputDevice::Start() { DCHECK(callback_) << ""Initialize hasn't been called""; message_loop()->PostTask(FROM_HERE, base::Bind(&AudioOutputDevice::CreateStreamOnIOThread, this, audio_parameters_, input_channels_)); } ",0 "void Browser::OpenPrivacyDashboardTabAndActivate() { OpenURL(GURL(kPrivacyDashboardUrl), GURL(), NEW_FOREGROUND_TAB, PageTransition::LINK); window_->Activate(); } ",0 "void TabHelper::SetExtensionAppById(const std::string& extension_app_id) { const Extension* extension = GetExtension(extension_app_id); if (extension) SetExtensionApp(extension); } ",0 "static int hid_device_probe(struct device *dev) { struct hid_driver *hdrv = to_hid_driver(dev->driver); struct hid_device *hdev = to_hid_device(dev); const struct hid_device_id *id; int ret = 0; if (down_interruptible(&hdev->driver_lock)) return -EINTR; if (down_interruptible(&hdev->driver_input_lock)) { ret = -EINTR; goto unlock_driver_lock; } hdev->io_started = false; if (!hdev->driver) { id = hid_match_device(hdev, hdrv); if (id == NULL) { ret = -ENODEV; goto unlock; } hdev->driver = hdrv; if (hdrv->probe) { ret = hdrv->probe(hdev, id); } else { /* default probe */ ret = hid_open_report(hdev); if (!ret) ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT); } if (ret) { hid_close_report(hdev); hdev->driver = NULL; } } unlock: if (!hdev->io_started) up(&hdev->driver_input_lock); unlock_driver_lock: up(&hdev->driver_lock); return ret; } ",0 "int main(int argc, char **argv) { if (argc < 2) { usage(argv[0]); return -1; } const command_t *command = find_command(argv[1]); if (!command) { printf(""Unrecognized command '%s'.\n"", argv[1]); return -2; } if (!command->handler) { printf(""Unhandled command '%s'.\n"", argv[1]); return -3; } return command->handler(argc - 2, &argv[2]); } ",0 "static ssize_t show_slab_objects(struct kmem_cache *s, char *buf, unsigned long flags) { unsigned long total = 0; int node; int x; unsigned long *nodes; unsigned long *per_cpu; nodes = kzalloc(2 * sizeof(unsigned long) * nr_node_ids, GFP_KERNEL); if (!nodes) return -ENOMEM; per_cpu = nodes + nr_node_ids; if (flags & SO_CPU) { int cpu; for_each_possible_cpu(cpu) { struct kmem_cache_cpu *c = get_cpu_slab(s, cpu); if (!c || c->node < 0) continue; if (c->page) { if (flags & SO_TOTAL) x = c->page->objects; else if (flags & SO_OBJECTS) x = c->page->inuse; else x = 1; total += x; nodes[c->node] += x; } per_cpu[c->node]++; } } if (flags & SO_ALL) { for_each_node_state(node, N_NORMAL_MEMORY) { struct kmem_cache_node *n = get_node(s, node); if (flags & SO_TOTAL) x = atomic_long_read(&n->total_objects); else if (flags & SO_OBJECTS) x = atomic_long_read(&n->total_objects) - count_partial(n, count_free); else x = atomic_long_read(&n->nr_slabs); total += x; nodes[node] += x; } } else if (flags & SO_PARTIAL) { for_each_node_state(node, N_NORMAL_MEMORY) { struct kmem_cache_node *n = get_node(s, node); if (flags & SO_TOTAL) x = count_partial(n, count_total); else if (flags & SO_OBJECTS) x = count_partial(n, count_inuse); else x = n->nr_partial; total += x; nodes[node] += x; } } x = sprintf(buf, ""%lu"", total); #ifdef CONFIG_NUMA for_each_node_state(node, N_NORMAL_MEMORY) if (nodes[node]) x += sprintf(buf + x, "" N%d=%lu"", node, nodes[node]); #endif kfree(nodes); return x + sprintf(buf + x, ""\n""); } ",0 "void FlagsState::ConvertFlagsToSwitches(FlagsStorage* flags_storage, base::CommandLine* command_line, SentinelsMode sentinels) { if (command_line->HasSwitch(switches::kNoExperiments)) return; std::set enabled_experiments; GetSanitizedEnabledFlagsForCurrentPlatform(flags_storage, &enabled_experiments); NameToSwitchAndValueMap name_to_switch_map; for (size_t i = 0; i < num_experiments; ++i) { const Experiment& e = experiments[i]; if (e.type == Experiment::SINGLE_VALUE) { SetFlagToSwitchMapping(e.internal_name, e.command_line_switch, e.command_line_value, &name_to_switch_map); } else if (e.type == Experiment::MULTI_VALUE) { for (int j = 0; j < e.num_choices; ++j) { SetFlagToSwitchMapping(e.NameForChoice(j), e.choices[j].command_line_switch, e.choices[j].command_line_value, &name_to_switch_map); } } else { DCHECK_EQ(e.type, Experiment::ENABLE_DISABLE_VALUE); SetFlagToSwitchMapping(e.NameForChoice(0), std::string(), std::string(), &name_to_switch_map); SetFlagToSwitchMapping(e.NameForChoice(1), e.command_line_switch, e.command_line_value, &name_to_switch_map); SetFlagToSwitchMapping(e.NameForChoice(2), e.disable_command_line_switch, e.disable_command_line_value, &name_to_switch_map); } } if (sentinels == kAddSentinels) { command_line->AppendSwitch(switches::kFlagSwitchesBegin); flags_switches_.insert( std::pair(switches::kFlagSwitchesBegin, std::string())); } for (const std::string& experiment_name : enabled_experiments) { NameToSwitchAndValueMap::const_iterator name_to_switch_it = name_to_switch_map.find(experiment_name); if (name_to_switch_it == name_to_switch_map.end()) { NOTREACHED(); continue; } const std::pair& switch_and_value_pair = name_to_switch_it->second; CHECK(!switch_and_value_pair.first.empty()); command_line->AppendSwitchASCII(switch_and_value_pair.first, switch_and_value_pair.second); flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second; } if (sentinels == kAddSentinels) { command_line->AppendSwitch(switches::kFlagSwitchesEnd); flags_switches_.insert( std::pair(switches::kFlagSwitchesEnd, std::string())); } } ",0 "void OmniboxViewViews::ApplyCaretVisibility() { SetCursorEnabled(model()->is_caret_visible()); if (location_bar_view_) location_bar_view_->OnOmniboxFocused(); } ",0 " void testUriUserInfoHostPort23_Bug3510198_4() { UriParserStateA stateA; UriUriA uriA; stateA.uri = &uriA; int res; res = uriParseUriA(&stateA, ""http"" ""://"" ""!$&'()*+,;=:password"" ""@"" ""host"" ""/""); TEST_ASSERT(URI_SUCCESS == res); TEST_ASSERT(!memcmp(uriA.userInfo.first, ""!$&'()*+,;=:password"", 20 * sizeof(char))); TEST_ASSERT(uriA.userInfo.afterLast - uriA.userInfo.first == 20); TEST_ASSERT(!memcmp(uriA.hostText.first, ""host"", 4 * sizeof(char))); TEST_ASSERT(uriA.hostText.afterLast - uriA.hostText.first == 4); TEST_ASSERT(uriA.portText.first == NULL); TEST_ASSERT(uriA.portText.afterLast == NULL); uriFreeUriMembersA(&uriA); } ",0 " tt_cmap6_validate( FT_Byte* table, FT_Validator valid ) { FT_Byte* p; FT_UInt length, count; if ( table + 10 > valid->limit ) FT_INVALID_TOO_SHORT; p = table + 2; length = TT_NEXT_USHORT( p ); p = table + 8; /* skip language and start index */ count = TT_NEXT_USHORT( p ); if ( table + length > valid->limit || length < 10 + count * 2 ) FT_INVALID_TOO_SHORT; /* check glyph indices */ if ( valid->level >= FT_VALIDATE_TIGHT ) { FT_UInt gindex; for ( ; count > 0; count-- ) { gindex = TT_NEXT_USHORT( p ); if ( gindex >= TT_VALID_GLYPH_COUNT( valid ) ) FT_INVALID_GLYPH_ID; } } return FT_Err_Ok; } ",0 "static struct kiocb *__aio_get_req(struct kioctx *ctx) { struct kiocb *req = NULL; req = kmem_cache_alloc(kiocb_cachep, GFP_KERNEL); if (unlikely(!req)) return NULL; req->ki_flags = 0; req->ki_users = 2; req->ki_key = 0; req->ki_ctx = ctx; req->ki_cancel = NULL; req->ki_retry = NULL; req->ki_dtor = NULL; req->private = NULL; req->ki_iovec = NULL; INIT_LIST_HEAD(&req->ki_run_list); req->ki_eventfd = NULL; return req; } ",0 "png_get_sBIT(png_structp png_ptr, png_infop info_ptr, png_color_8p *sig_bit) { png_debug1(1, ""in %s retrieval function"", ""sBIT""); if (png_ptr != NULL && info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) && sig_bit != NULL) { *sig_bit = &(info_ptr->sig_bit); return (PNG_INFO_sBIT); } return (0); } ",0 "int perf_event_task_enable(void) { struct perf_event *event; mutex_lock(¤t->perf_event_mutex); list_for_each_entry(event, ¤t->perf_event_list, owner_entry) perf_event_for_each_child(event, perf_event_enable); mutex_unlock(¤t->perf_event_mutex); return 0; } ",0 "static __sum16 tcp_v4_checksum_init(struct sk_buff *skb) { const struct iphdr *iph = ip_hdr(skb); if (skb->ip_summed == CHECKSUM_COMPLETE) { if (!tcp_v4_check(skb->len, iph->saddr, iph->daddr, skb->csum)) { skb->ip_summed = CHECKSUM_UNNECESSARY; return 0; } } skb->csum = csum_tcpudp_nofold(iph->saddr, iph->daddr, skb->len, IPPROTO_TCP, 0); if (skb->len <= 76) { return __skb_checksum_complete(skb); } return 0; } ",0 "void GLES2DecoderImpl::DoUniform2fv( GLint fake_location, GLsizei count, const GLfloat* value) { GLenum type = 0; GLint real_location = -1; if (!PrepForSetUniformByLocation( fake_location, ""glUniform2fv"", &real_location, &type, &count)) { return; } if (type == GL_BOOL_VEC2) { GLsizei num_values = count * 2; scoped_array temp(new GLint[num_values]); for (GLsizei ii = 0; ii < num_values; ++ii) { temp[ii] = static_cast(value[ii] != 0.0f); } glUniform2iv(real_location, count, temp.get()); } else { glUniform2fv(real_location, count, value); } } ",0 "static inline void free_rt_sched_group(struct task_group *tg) { } ",0 "xsltCompileLocationPathPattern(xsltParserContextPtr ctxt, int novar) { SKIP_BLANKS; if ((CUR == '/') && (NXT(1) == '/')) { /* * since we reverse the query * a leading // can be safely ignored */ NEXT; NEXT; ctxt->comp->priority = 0.5; /* '//' means not 0 priority */ xsltCompileRelativePathPattern(ctxt, NULL, novar); } else if (CUR == '/') { /* * We need to find root as the parent */ NEXT; SKIP_BLANKS; PUSH(XSLT_OP_ROOT, NULL, NULL, novar); if ((CUR != 0) && (CUR != '|')) { PUSH(XSLT_OP_PARENT, NULL, NULL, novar); xsltCompileRelativePathPattern(ctxt, NULL, novar); } } else if (CUR == '*') { xsltCompileRelativePathPattern(ctxt, NULL, novar); } else if (CUR == '@') { xsltCompileRelativePathPattern(ctxt, NULL, novar); } else { xmlChar *name; name = xsltScanNCName(ctxt); if (name == NULL) { xsltTransformError(NULL, NULL, NULL, ""xsltCompileLocationPathPattern : Name expected\n""); ctxt->error = 1; return; } SKIP_BLANKS; if ((CUR == '(') && !xmlXPathIsNodeType(name)) { xsltCompileIdKeyPattern(ctxt, name, 1, novar, 0); if ((CUR == '/') && (NXT(1) == '/')) { PUSH(XSLT_OP_ANCESTOR, NULL, NULL, novar); NEXT; NEXT; SKIP_BLANKS; xsltCompileRelativePathPattern(ctxt, NULL, novar); } else if (CUR == '/') { PUSH(XSLT_OP_PARENT, NULL, NULL, novar); NEXT; SKIP_BLANKS; xsltCompileRelativePathPattern(ctxt, NULL, novar); } return; } xsltCompileRelativePathPattern(ctxt, name, novar); } error: return; } ",1 "SPL_METHOD(SplFileObject, fgetcsv) { spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char delimiter = intern->u.file.delimiter, enclosure = intern->u.file.enclosure, escape = intern->u.file.escape; char *delim = NULL, *enclo = NULL, *esc = NULL; int d_len = 0, e_len = 0, esc_len = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""|sss"", &delim, &d_len, &enclo, &e_len, &esc, &esc_len) == SUCCESS) { switch(ZEND_NUM_ARGS()) { case 3: if (esc_len != 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""escape must be a character""); RETURN_FALSE; } escape = esc[0]; /* no break */ case 2: if (e_len != 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""enclosure must be a character""); RETURN_FALSE; } enclosure = enclo[0]; /* no break */ case 1: if (d_len != 1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""delimiter must be a character""); RETURN_FALSE; } delimiter = delim[0]; /* no break */ case 0: break; } spl_filesystem_file_read_csv(intern, delimiter, enclosure, escape, return_value TSRMLS_CC); } } ",1 "void SharedWorkerDevToolsAgentHost::DispatchProtocolMessage( DevToolsSession* session, const std::string& message) { session->DispatchProtocolMessage(message); } ",0 "void Document::attachNodeIterator(NodeIterator* ni) { m_nodeIterators.add(ni); } ",0 "CatalogueOpenFont (pointer client, FontPathElementPtr fpe, Mask flags, char *name, int namelen, fsBitmapFormat format, fsBitmapFormatMask fmask, XID id, FontPtr *pFont, char **aliasName, FontPtr non_cachable_font) { CataloguePtr cat = fpe->private; FontPathElementPtr subfpe; FontDirectoryPtr dir; int i, status; CatalogueRescan (fpe); for (i = 0; i < cat->fpeCount; i++) { subfpe = cat->fpeList[i]; dir = subfpe->private; status = FontFileOpenFont(client, subfpe, flags, name, namelen, format, fmask, id, pFont, aliasName, non_cachable_font); if (status == Successful || status == FontNameAlias) return status; } return BadFontName; } ",0 "void MockInputMethod::SetResultTextForNextKey(const base::string16& result) { result_text_ = result; } ",0 "void StartupBrowserCreator::ProcessCommandLineAlreadyRunning( const base::CommandLine& command_line, const base::FilePath& cur_dir, const base::FilePath& profile_path) { ProfileManager* profile_manager = g_browser_process->profile_manager(); Profile* profile = profile_manager->GetProfileByPath(profile_path); if (!profile) { profile_manager->CreateProfileAsync( profile_path, base::BindRepeating(&ProcessCommandLineOnProfileCreated, command_line, cur_dir), base::string16(), std::string()); return; } StartupBrowserCreator startup_browser_creator; startup_browser_creator.ProcessCmdLineImpl( command_line, cur_dir, /*process_startup=*/false, profile, Profiles()); } ",0 "error::Error GLES2DecoderImpl::DoCompressedTexImage2D( GLenum target, GLint level, GLenum internal_format, GLsizei width, GLsizei height, GLint border, GLsizei image_size, const void* data) { if (!validators_->texture_target.IsValid(target)) { SetGLErrorInvalidEnum(""glCompressedTexImage2D"", target, ""target""); return error::kNoError; } if (!validators_->compressed_texture_format.IsValid( internal_format)) { SetGLErrorInvalidEnum( ""glCompressedTexImage2D"", internal_format, ""internal_format""); return error::kNoError; } if (!texture_manager()->ValidForTarget(target, level, width, height, 1) || border != 0) { SetGLError(GL_INVALID_VALUE, ""glCompressedTexImage2D"", ""dimensions out of range""); return error::kNoError; } TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); if (!info) { SetGLError(GL_INVALID_VALUE, ""glCompressedTexImage2D"", ""unknown texture target""); return error::kNoError; } if (info->IsImmutable()) { SetGLError(GL_INVALID_OPERATION, ""glCompressedTexImage2D"", ""texture is immutable""); return error::kNoError; } if (!ValidateCompressedTexDimensions( ""glCompressedTexImage2D"", level, width, height, internal_format) || !ValidateCompressedTexFuncData( ""glCompressedTexImage2D"", width, height, internal_format, image_size)) { return error::kNoError; } if (info->IsAttachedToFramebuffer()) { state_dirty_ = true; framebuffer_manager()->IncFramebufferStateChangeCount(); } scoped_array zero; if (!data) { zero.reset(new int8[image_size]); memset(zero.get(), 0, image_size); data = zero.get(); } CopyRealGLErrorsToWrapper(); glCompressedTexImage2D( target, level, internal_format, width, height, border, image_size, data); GLenum error = PeekGLError(); if (error == GL_NO_ERROR) { texture_manager()->SetLevelInfo( info, target, level, internal_format, width, height, 1, border, 0, 0, true); } return error::kNoError; } ",0 "static void nfs4_proc_commit_setup(struct nfs_commit_data *data, struct rpc_message *msg) { struct nfs_server *server = NFS_SERVER(data->inode); if (data->commit_done_cb == NULL) data->commit_done_cb = nfs4_commit_done_cb; data->res.server = server; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT]; nfs41_init_sequence(&data->args.seq_args, &data->res.seq_res, 1); } ",0 " ExtensionInfoBar::ExtensionInfoBar(ExtensionInfoBarDelegate* delegate) : InfoBar(delegate), delegate_(delegate), ALLOW_THIS_IN_INITIALIZER_LIST(tracker_(this)) { delegate_->set_observer(this); ExtensionHost* extension_host = delegate_->extension_host(); gfx::Size sz = extension_host->view()->GetPreferredSize(); if (sz.height() > 0) sz.set_height(sz.height() + 1); set_target_height(sz.height()); SetupIconAndMenu(); extension_host->view()->SetContainer(this); extension_host->view()->set_parent_owned(false); AddChildView(extension_host->view()); } ",1 "static void snd_timer_user_disconnect(struct snd_timer_instance *timeri) { struct snd_timer_user *tu = timeri->callback_data; tu->disconnected = true; wake_up(&tu->qchange_sleep); } ",0 "static void vmx_disable_shadow_vmcs(struct vcpu_vmx *vmx) { vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL, SECONDARY_EXEC_SHADOW_VMCS); vmcs_write64(VMCS_LINK_POINTER, -1ull); } ",0 "void HTMLMediaElement::PauseInternal() { BLINK_MEDIA_LOG << ""pauseInternal("" << (void*)this << "")""; if (network_state_ == kNetworkEmpty) InvokeResourceSelectionAlgorithm(); can_autoplay_ = false; if (!paused_) { paused_ = true; ScheduleTimeupdateEvent(false); ScheduleEvent(EventTypeNames::pause); SetOfficialPlaybackPosition(CurrentPlaybackPosition()); ScheduleRejectPlayPromises(DOMExceptionCode::kAbortError); } UpdatePlayState(); } ",0 "static int uio_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf) { struct uio_device *idev = vma->vm_private_data; struct page *page; unsigned long offset; int mi = uio_find_mem_index(vma); if (mi < 0) return VM_FAULT_SIGBUS; /* * We need to subtract mi because userspace uses offset = N*PAGE_SIZE * to use mem[N]. */ offset = (vmf->pgoff - mi) << PAGE_SHIFT; if (idev->info->mem[mi].memtype == UIO_MEM_LOGICAL) page = virt_to_page(idev->info->mem[mi].addr + offset); else page = vmalloc_to_page((void *)(unsigned long)idev->info->mem[mi].addr + offset); get_page(page); vmf->page = page; return 0; } ",0 "mrb_io_close_on_exec_p(mrb_state *mrb, mrb_value self) { #if defined(F_GETFD) && defined(F_SETFD) && defined(FD_CLOEXEC) struct mrb_io *fptr; int ret; fptr = io_get_open_fptr(mrb, self); if (fptr->fd2 >= 0) { if ((ret = fcntl(fptr->fd2, F_GETFD)) == -1) mrb_sys_fail(mrb, ""F_GETFD failed""); if (!(ret & FD_CLOEXEC)) return mrb_false_value(); } if ((ret = fcntl(fptr->fd, F_GETFD)) == -1) mrb_sys_fail(mrb, ""F_GETFD failed""); if (!(ret & FD_CLOEXEC)) return mrb_false_value(); return mrb_true_value(); #else mrb_raise(mrb, E_NOTIMP_ERROR, ""IO#close_on_exec? is not supported on the platform""); return mrb_false_value(); #endif } ",0 "void *__kmalloc(size_t size, gfp_t flags) { return __do_kmalloc(size, flags, _RET_IP_); } ",0 "coproc_flush () { #if MULTIPLE_COPROCS cpl_flush (); #else coproc_dispose (&sh_coproc); #endif } ",0 "int iwl_send_lq_cmd(struct iwl_priv *priv, struct iwl_rxon_context *ctx, struct iwl_link_quality_cmd *lq, u8 flags, bool init) { int ret = 0; unsigned long flags_spin; struct iwl_host_cmd cmd = { .id = REPLY_TX_LINK_QUALITY_CMD, .len = { sizeof(struct iwl_link_quality_cmd), }, .flags = flags, .data = { lq, }, }; if (WARN_ON(lq->sta_id == IWL_INVALID_STATION)) return -EINVAL; spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin); if (!(priv->stations[lq->sta_id].used & IWL_STA_DRIVER_ACTIVE)) { spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin); return -EINVAL; } spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin); iwl_dump_lq_cmd(priv, lq); if (WARN_ON(init && (cmd.flags & CMD_ASYNC))) return -EINVAL; if (is_lq_table_valid(priv, ctx, lq)) ret = iwl_trans_send_cmd(trans(priv), &cmd); else ret = -EINVAL; if (cmd.flags & CMD_ASYNC) return ret; if (init) { IWL_DEBUG_INFO(priv, ""init LQ command complete, "" ""clearing sta addition status for sta %d\n"", lq->sta_id); spin_lock_irqsave(&priv->shrd->sta_lock, flags_spin); priv->stations[lq->sta_id].used &= ~IWL_STA_UCODE_INPROGRESS; spin_unlock_irqrestore(&priv->shrd->sta_lock, flags_spin); } return ret; } ",0 "static int sctp6_rcv(struct sk_buff *skb) { return sctp_rcv(skb) ? -1 : 0; } ",0 "void DevToolsWindow::OpenDevToolsWindow( scoped_refptr agent_host, Profile* profile) { if (!profile) profile = Profile::FromBrowserContext(agent_host->GetBrowserContext()); if (!profile) return; std::string type = agent_host->GetType(); bool is_worker = type == DevToolsAgentHost::kTypeServiceWorker || type == DevToolsAgentHost::kTypeSharedWorker; if (!agent_host->GetFrontendURL().empty()) { bool is_v8_only = type == ""node""; DevToolsWindow::OpenExternalFrontend(profile, agent_host->GetFrontendURL(), agent_host, is_worker, is_v8_only); return; } if (is_worker) { DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host); return; } if (type == content::DevToolsAgentHost::kTypeFrame) { DevToolsWindow::OpenDevToolsWindowForFrame(profile, agent_host); return; } content::WebContents* web_contents = agent_host->GetWebContents(); if (web_contents) DevToolsWindow::OpenDevToolsWindow(web_contents); } ",0 "bool PrintingNodeOrPdfFrame(const WebFrame* frame, const WebNode& node) { if (!node.isNull()) return true; std::string mime(frame->dataSource()->response().mimeType().utf8()); return mime == ""application/pdf""; } ",0 "directory_count_cancel (NautilusDirectory *directory) { if (directory->details->count_in_progress != NULL) { g_cancellable_cancel (directory->details->count_in_progress->cancellable); directory->details->count_in_progress = NULL; } } ",0 " static void Begin(const wchar_t* const protocols[], const base::Closure& on_finished_callback) { delete instance_; instance_ = new OpenSystemSettingsHelper(protocols, on_finished_callback); } ",0 "void BlobData::appendBlob(const KURL& url, long long offset, long long length) { m_items.append(BlobDataItem(url, offset, length)); } ",0 "static void webkit_web_view_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec) { WebKitWebView* webView = WEBKIT_WEB_VIEW(object); switch(prop_id) { case PROP_TITLE: g_value_set_string(value, webkit_web_view_get_title(webView)); break; case PROP_URI: g_value_set_string(value, webkit_web_view_get_uri(webView)); break; case PROP_COPY_TARGET_LIST: g_value_set_boxed(value, webkit_web_view_get_copy_target_list(webView)); break; case PROP_PASTE_TARGET_LIST: g_value_set_boxed(value, webkit_web_view_get_paste_target_list(webView)); break; case PROP_EDITABLE: g_value_set_boolean(value, webkit_web_view_get_editable(webView)); break; case PROP_SETTINGS: g_value_set_object(value, webkit_web_view_get_settings(webView)); break; case PROP_WEB_INSPECTOR: g_value_set_object(value, webkit_web_view_get_inspector(webView)); break; case PROP_VIEWPORT_ATTRIBUTES: g_value_set_object(value, webkit_web_view_get_viewport_attributes(webView)); break; case PROP_WINDOW_FEATURES: g_value_set_object(value, webkit_web_view_get_window_features(webView)); break; case PROP_TRANSPARENT: g_value_set_boolean(value, webkit_web_view_get_transparent(webView)); break; case PROP_ZOOM_LEVEL: g_value_set_float(value, webkit_web_view_get_zoom_level(webView)); break; case PROP_FULL_CONTENT_ZOOM: g_value_set_boolean(value, webkit_web_view_get_full_content_zoom(webView)); break; case PROP_ENCODING: g_value_set_string(value, webkit_web_view_get_encoding(webView)); break; case PROP_CUSTOM_ENCODING: g_value_set_string(value, webkit_web_view_get_custom_encoding(webView)); break; case PROP_LOAD_STATUS: g_value_set_enum(value, webkit_web_view_get_load_status(webView)); break; case PROP_PROGRESS: g_value_set_double(value, webkit_web_view_get_progress(webView)); break; case PROP_ICON_URI: g_value_set_string(value, webkit_web_view_get_icon_uri(webView)); break; case PROP_IM_CONTEXT: g_value_set_object(value, webkit_web_view_get_im_context(webView)); break; case PROP_VIEW_MODE: g_value_set_enum(value, webkit_web_view_get_view_mode(webView)); break; #ifndef GTK_API_VERSION_2 case PROP_HADJUSTMENT: g_value_set_object(value, getHorizontalAdjustment(webView)); break; case PROP_VADJUSTMENT: g_value_set_object(value, getVerticalAdjustment(webView)); break; case PROP_HSCROLL_POLICY: g_value_set_enum(value, getHorizontalScrollPolicy(webView)); break; case PROP_VSCROLL_POLICY: g_value_set_enum(value, getVerticalScrollPolicy(webView)); break; #endif default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); } } ",0 "static void TIFFSetProperties(TIFF *tiff,const ImageInfo *image_info, Image *image) { const char *value; value=GetImageArtifact(image,""tiff:document""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_DOCUMENTNAME,value); value=GetImageArtifact(image,""tiff:hostcomputer""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_HOSTCOMPUTER,value); value=GetImageArtifact(image,""tiff:artist""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_ARTIST,value); value=GetImageArtifact(image,""tiff:timestamp""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_DATETIME,value); value=GetImageArtifact(image,""tiff:make""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_MAKE,value); value=GetImageArtifact(image,""tiff:model""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_MODEL,value); value=GetImageArtifact(image,""tiff:software""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_SOFTWARE,value); value=GetImageArtifact(image,""tiff:copyright""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_COPYRIGHT,value); value=GetImageArtifact(image,""kodak-33423""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,33423,value); value=GetImageArtifact(image,""kodak-36867""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,36867,value); value=GetImageProperty(image,""label""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_PAGENAME,value); value=GetImageProperty(image,""comment""); if (value != (const char *) NULL) (void) TIFFSetField(tiff,TIFFTAG_IMAGEDESCRIPTION,value); value=GetImageArtifact(image,""tiff:subfiletype""); if (value != (const char *) NULL) { if (LocaleCompare(value,""REDUCEDIMAGE"") == 0) (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_REDUCEDIMAGE); else if (LocaleCompare(value,""PAGE"") == 0) (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE); else if (LocaleCompare(value,""MASK"") == 0) (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_MASK); } else { uint16 page, pages; page=(uint16) image->scene; pages=(uint16) GetImageListLength(image); if ((image_info->adjoin != MagickFalse) && (pages > 1)) (void) TIFFSetField(tiff,TIFFTAG_SUBFILETYPE,FILETYPE_PAGE); (void) TIFFSetField(tiff,TIFFTAG_PAGENUMBER,page,pages); } } ",0 "void fillWidgetProperties(AXObject& axObject, protocol::Array& properties) { AccessibilityRole role = axObject.roleValue(); String autocomplete = axObject.ariaAutoComplete(); if (!autocomplete.isEmpty()) properties.addItem( createProperty(AXWidgetAttributesEnum::Autocomplete, createValue(autocomplete, AXValueTypeEnum::Token))); if (axObject.hasAttribute(HTMLNames::aria_haspopupAttr)) { bool hasPopup = axObject.ariaHasPopup(); properties.addItem(createProperty(AXWidgetAttributesEnum::Haspopup, createBooleanValue(hasPopup))); } int headingLevel = axObject.headingLevel(); if (headingLevel > 0) { properties.addItem(createProperty(AXWidgetAttributesEnum::Level, createValue(headingLevel))); } int hierarchicalLevel = axObject.hierarchicalLevel(); if (hierarchicalLevel > 0 || axObject.hasAttribute(HTMLNames::aria_levelAttr)) { properties.addItem(createProperty(AXWidgetAttributesEnum::Level, createValue(hierarchicalLevel))); } if (roleAllowsMultiselectable(role)) { bool multiselectable = axObject.isMultiSelectable(); properties.addItem(createProperty(AXWidgetAttributesEnum::Multiselectable, createBooleanValue(multiselectable))); } if (roleAllowsOrientation(role)) { AccessibilityOrientation orientation = axObject.orientation(); switch (orientation) { case AccessibilityOrientationVertical: properties.addItem( createProperty(AXWidgetAttributesEnum::Orientation, createValue(""vertical"", AXValueTypeEnum::Token))); break; case AccessibilityOrientationHorizontal: properties.addItem( createProperty(AXWidgetAttributesEnum::Orientation, createValue(""horizontal"", AXValueTypeEnum::Token))); break; case AccessibilityOrientationUndefined: break; } } if (role == TextFieldRole) { properties.addItem( createProperty(AXWidgetAttributesEnum::Multiline, createBooleanValue(axObject.isMultiline()))); } if (roleAllowsReadonly(role)) { properties.addItem( createProperty(AXWidgetAttributesEnum::Readonly, createBooleanValue(axObject.isReadOnly()))); } if (roleAllowsRequired(role)) { properties.addItem( createProperty(AXWidgetAttributesEnum::Required, createBooleanValue(axObject.isRequired()))); } if (roleAllowsSort(role)) { } if (axObject.isRange()) { properties.addItem( createProperty(AXWidgetAttributesEnum::Valuemin, createValue(axObject.minValueForRange()))); properties.addItem( createProperty(AXWidgetAttributesEnum::Valuemax, createValue(axObject.maxValueForRange()))); properties.addItem( createProperty(AXWidgetAttributesEnum::Valuetext, createValue(axObject.valueDescription()))); } } ",0 "int GetSwitchValueAsInt(const CommandLine& command_line, const std::string& switch_name) { int value; if (!base::StringToInt(command_line.GetSwitchValueASCII(switch_name), &value)) { return 0; } return value; } ",0 "GF_Err EncodeBIFSChunk(GF_SceneManager *ctx, char *bifsOutputFile, GF_Err (*AUCallback)(GF_ISOSample *)) { GF_Err e; char *data; u32 data_len; GF_BifsEncoder *bifsenc; GF_InitialObjectDescriptor *iod; u32 i, j, count; GF_StreamContext *sc; GF_ESD *esd; Bool encode_names, delete_bcfg; GF_BIFSConfig *bcfg; GF_AUContext *au; char szRad[GF_MAX_PATH], *ext; char szName[1024]; FILE *f; strcpy(szRad, bifsOutputFile); ext = strrchr(szRad, '.'); if (ext) ext[0] = 0; /* step3: encoding all AUs in ctx->streams starting at AU index 1 (0 is SceneReplace from previous context) */ bifsenc = gf_bifs_encoder_new(ctx->scene_graph); e = GF_OK; iod = (GF_InitialObjectDescriptor *) ctx->root_od; /*if no iod check we only have one bifs*/ if (!iod) { count = 0; for (i=0; istreams); i++) { sc = gf_list_get(ctx->streams, i); if (sc->streamType == GF_STREAM_OD) count++; } if (!iod && count>1) return GF_NOT_SUPPORTED; } count = gf_list_count(ctx->streams); for (i=0; istreams, i); esd = NULL; if (sc->streamType != GF_STREAM_SCENE) continue; esd = NULL; if (iod) { for (j=0; jESDescriptors); j++) { esd = gf_list_get(iod->ESDescriptors, j); if (esd->decoderConfig && esd->decoderConfig->streamType == GF_STREAM_SCENE) { if (!sc->ESID) sc->ESID = esd->ESID; if (sc->ESID == esd->ESID) { break; } } /*special BIFS direct import from NHNT*/ else if (gf_list_count(iod->ESDescriptors)==1) { sc->ESID = esd->ESID; break; } esd = NULL; } } if (!esd) { esd = gf_odf_desc_esd_new(2); if (!esd) return GF_OUT_OF_MEM; gf_odf_desc_del((GF_Descriptor *) esd->decoderConfig->decoderSpecificInfo); esd->decoderConfig->decoderSpecificInfo = NULL; esd->ESID = sc->ESID; esd->decoderConfig->streamType = GF_STREAM_SCENE; } if (!esd->decoderConfig) return GF_OUT_OF_MEM; /*should NOT happen (means inputctx is not properly setup)*/ if (!esd->decoderConfig->decoderSpecificInfo) { bcfg = (GF_BIFSConfig*)gf_odf_desc_new(GF_ODF_BIFS_CFG_TAG); delete_bcfg = 1; } /*regular retrieve from ctx*/ else if (esd->decoderConfig->decoderSpecificInfo->tag == GF_ODF_BIFS_CFG_TAG) { bcfg = (GF_BIFSConfig *)esd->decoderConfig->decoderSpecificInfo; delete_bcfg = 0; } /*should not happen either (unless loading from MP4 in which case BIFSc is not decoded)*/ else { bcfg = gf_odf_get_bifs_config(esd->decoderConfig->decoderSpecificInfo, esd->decoderConfig->objectTypeIndication); delete_bcfg = 1; } /*NO CHANGE TO BIFSC otherwise the generated update will not match the input context*/ nbb = GetNbBits(ctx->max_node_id); if (!bcfg->nodeIDbits) bcfg->nodeIDbits=nbb; if (bcfg->nodeIDbitsmax_route_id); if (!bcfg->routeIDbits) bcfg->routeIDbits = nbb; if (bcfg->routeIDbitsmax_proto_id); if (!bcfg->protoIDbits) bcfg->protoIDbits=nbb; if (bcfg->protoIDbitsESID, bcfg, encode_names, 0); if (delete_bcfg) gf_odf_desc_del((GF_Descriptor *)bcfg); /*setup MP4 track*/ if (!esd->slConfig) esd->slConfig = (GF_SLConfig *) gf_odf_desc_new(GF_ODF_SLC_TAG); if (sc->timeScale) esd->slConfig->timestampResolution = sc->timeScale; if (!esd->slConfig->timestampResolution) esd->slConfig->timestampResolution = 1000; esd->ESID = sc->ESID; gf_bifs_encoder_get_config(bifsenc, sc->ESID, &data, &data_len); if (esd->decoderConfig->decoderSpecificInfo) gf_odf_desc_del((GF_Descriptor *) esd->decoderConfig->decoderSpecificInfo); esd->decoderConfig->decoderSpecificInfo = (GF_DefaultDescriptor *) gf_odf_desc_new(GF_ODF_DSI_TAG); esd->decoderConfig->decoderSpecificInfo->data = data; esd->decoderConfig->decoderSpecificInfo->dataLength = data_len; esd->decoderConfig->objectTypeIndication = gf_bifs_encoder_get_version(bifsenc, sc->ESID); for (j=1; jAUs); j++) { char *data; u32 data_len; au = gf_list_get(sc->AUs, j); e = gf_bifs_encode_au(bifsenc, sc->ESID, au->commands, &data, &data_len); if (data) { sprintf(szName, ""%s%02d.bifs"", szRad, j); f = gf_fopen(szName, ""wb""); gf_fwrite(data, data_len, 1, f); gf_fclose(f); gf_free(data); } } } gf_bifs_encoder_del(bifsenc); return e; } ",0 "static u32 filter_rcv(struct sock *sk, struct sk_buff *buf) { struct socket *sock = sk->sk_socket; struct tipc_msg *msg = buf_msg(buf); unsigned int limit = rcvbuf_limit(sk, buf); u32 res = TIPC_OK; /* Reject message if it is wrong sort of message for socket */ if (msg_type(msg) > TIPC_DIRECT_MSG) return TIPC_ERR_NO_PORT; if (sock->state == SS_READY) { if (msg_connected(msg)) return TIPC_ERR_NO_PORT; } else { res = filter_connect(tipc_sk(sk), &buf); if (res != TIPC_OK || buf == NULL) return res; } /* Reject message if there isn't room to queue it */ if (sk_rmem_alloc_get(sk) + buf->truesize >= limit) return TIPC_ERR_OVERLOAD; /* Enqueue message */ TIPC_SKB_CB(buf)->handle = 0; __skb_queue_tail(&sk->sk_receive_queue, buf); skb_set_owner_r(buf, sk); sk->sk_data_ready(sk, 0); return TIPC_OK; } ",0 "static void ib_uverbs_detach_umcast(struct ib_qp *qp, struct ib_uqp_object *uobj) { struct ib_uverbs_mcast_entry *mcast, *tmp; list_for_each_entry_safe(mcast, tmp, &uobj->mcast_list, list) { ib_detach_mcast(qp, &mcast->gid, mcast->lid); list_del(&mcast->list); kfree(mcast); } } ",0 "static int read_exceptions(struct pstore *ps, int (*callback)(void *callback_context, chunk_t old, chunk_t new), void *callback_context) { int r, full = 1; /* * Keeping reading chunks and inserting exceptions until * we find a partially full area. */ for (ps->current_area = 0; full; ps->current_area++) { r = area_io(ps, READ); if (r) return r; r = insert_exceptions(ps, callback, callback_context, &full); if (r) return r; } ps->current_area--; return 0; } ",1 "bool FrameLoader::prepareForCommit() { PluginScriptForbiddenScope forbidPluginDestructorScripting; DocumentLoader* pdl = m_provisionalDocumentLoader; if (m_frame->document()) { unsigned nodeCount = 0; for (Frame* frame = m_frame; frame; frame = frame->tree().traverseNext()) { if (frame->isLocalFrame()) { LocalFrame* localFrame = toLocalFrame(frame); nodeCount += localFrame->document()->nodeCount(); } } unsigned totalNodeCount = InstanceCounters::counterValue(InstanceCounters::NodeCounter); float ratio = static_cast(nodeCount) / totalNodeCount; ThreadState::current()->schedulePageNavigationGCIfNeeded(ratio); } SubframeLoadingDisabler disabler(m_frame->document()); if (m_documentLoader) { client()->dispatchWillClose(); dispatchUnloadEvent(); } m_frame->detachChildren(); if (pdl != m_provisionalDocumentLoader) return false; if (m_documentLoader) { FrameNavigationDisabler navigationDisabler(*m_frame); TemporaryChange inDetachDocumentLoader(m_protectProvisionalLoader, true); detachDocumentLoader(m_documentLoader); } if (!m_frame->client()) return false; ASSERT(m_provisionalDocumentLoader == pdl); if (m_frame->document()) m_frame->document()->detach(); m_documentLoader = m_provisionalDocumentLoader.release(); takeObjectSnapshot(); return true; } ",0 "void ChromeRenderMessageFilter::OnExtensionShouldUnloadAck( const std::string& extension_id, int sequence_id) { if (profile_->GetExtensionProcessManager()) profile_->GetExtensionProcessManager()->OnShouldUnloadAck( extension_id, sequence_id); } ",0 "test_bson_build_child_deep (void) { union { bson_t b; bson_impl_alloc_t a; } u; int count = 0; bson_init (&u.b); BSON_ASSERT ((u.b.flags & BSON_FLAG_INLINE)); test_bson_build_child_deep_1 (&u.b, &count); BSON_ASSERT (!(u.b.flags & BSON_FLAG_INLINE)); BSON_ASSERT ((u.b.flags & BSON_FLAG_STATIC)); BSON_ASSERT (!(u.b.flags & BSON_FLAG_NO_FREE)); BSON_ASSERT (!(u.b.flags & BSON_FLAG_RDONLY)); BSON_ASSERT (bson_validate (&u.b, BSON_VALIDATE_NONE, NULL)); BSON_ASSERT (((bson_impl_alloc_t *) &u.b)->alloclen == 1024); BSON_ASSERT_BSON_EQUAL_FILE (&u.b, ""test39.bson""); bson_destroy (&u.b); } ",0 "static void __exit exit_iso9660_fs(void) { unregister_filesystem(&iso9660_fs_type); #ifdef CONFIG_ZISOFS zisofs_cleanup(); #endif destroy_inodecache(); } ",0 " ProfileSyncService::GetLastSessionSnapshot() const { if (backend_.get() && backend_initialized_) { return backend_->GetLastSessionSnapshot(); } NOTREACHED(); return browser_sync::sessions::SyncSessionSnapshot(); } ",0 "void mcryptd_flusher(struct work_struct *__work) { struct mcryptd_alg_cstate *alg_cpu_state; struct mcryptd_alg_state *alg_state; struct mcryptd_flush_list *flist; int cpu; cpu = smp_processor_id(); alg_cpu_state = container_of(to_delayed_work(__work), struct mcryptd_alg_cstate, flush); alg_state = alg_cpu_state->alg_state; if (alg_cpu_state->cpu != cpu) pr_debug(""mcryptd error: work on cpu %d, should be cpu %d\n"", cpu, alg_cpu_state->cpu); if (alg_cpu_state->flusher_engaged) { flist = per_cpu_ptr(mcryptd_flist, cpu); mutex_lock(&flist->lock); list_del(&alg_cpu_state->flush_list); alg_cpu_state->flusher_engaged = false; mutex_unlock(&flist->lock); alg_state->flusher(alg_cpu_state); } } ",0 "static int nf_tables_gettable(struct sock *nlsk, struct sk_buff *skb, const struct nlmsghdr *nlh, const struct nlattr * const nla[]) { const struct nfgenmsg *nfmsg = nlmsg_data(nlh); const struct nft_af_info *afi; const struct nft_table *table; struct sk_buff *skb2; struct net *net = sock_net(skb->sk); int family = nfmsg->nfgen_family; int err; if (nlh->nlmsg_flags & NLM_F_DUMP) { struct netlink_dump_control c = { .dump = nf_tables_dump_tables, }; return netlink_dump_start(nlsk, skb, nlh, &c); } afi = nf_tables_afinfo_lookup(net, family, false); if (IS_ERR(afi)) return PTR_ERR(afi); table = nf_tables_table_lookup(afi, nla[NFTA_TABLE_NAME]); if (IS_ERR(table)) return PTR_ERR(table); if (table->flags & NFT_TABLE_INACTIVE) return -ENOENT; skb2 = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); if (!skb2) return -ENOMEM; err = nf_tables_fill_table_info(skb2, net, NETLINK_CB(skb).portid, nlh->nlmsg_seq, NFT_MSG_NEWTABLE, 0, family, table); if (err < 0) goto err; return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); err: kfree_skb(skb2); return err; } ",0 " ClickModifierTest() { } ",0 " AutocompleteEditModel::GetStateForTabSwitch() { if (user_input_in_progress_) { const string16 user_text(UserTextFromDisplayText(view_->GetText())); if (user_text.empty()) { view_->RevertAll(); view_->SelectAll(true); } else { InternalSetUserText(user_text); } } return State(user_input_in_progress_, user_text_, keyword_, is_keyword_hint_); } ",0 "base::FilePath DownloadManagerImpl::GetDefaultDownloadDirectory() { base::FilePath default_download_directory; #if defined(USE_X11) default_download_directory = GetTemporaryDownloadDirectory(); #else if (delegate_) { base::FilePath website_save_directory; // Unused bool skip_dir_check = false; // Unused delegate_->GetSaveDir(GetBrowserContext(), &website_save_directory, &default_download_directory, &skip_dir_check); } #endif if (default_download_directory.empty()) { default_download_directory = GetContentClient()->browser()->GetDefaultDownloadDirectory(); } return default_download_directory; } ",0 "nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create) { DECODE_HEAD; READ_BUF(4); create->cr_type = be32_to_cpup(p++); switch (create->cr_type) { case NF4LNK: READ_BUF(4); create->cr_datalen = be32_to_cpup(p++); READ_BUF(create->cr_datalen); create->cr_data = svcxdr_dupstr(argp, p, create->cr_datalen); if (!create->cr_data) return nfserr_jukebox; break; case NF4BLK: case NF4CHR: READ_BUF(8); create->cr_specdata1 = be32_to_cpup(p++); create->cr_specdata2 = be32_to_cpup(p++); break; case NF4SOCK: case NF4FIFO: case NF4DIR: default: break; } READ_BUF(4); create->cr_namelen = be32_to_cpup(p++); READ_BUF(create->cr_namelen); SAVEMEM(create->cr_name, create->cr_namelen); if ((status = check_filename(create->cr_name, create->cr_namelen))) return status; status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr, &create->cr_acl, &create->cr_label, ¤t->fs->umask); if (status) goto out; DECODE_TAIL; } ",0 "bool HostNPScriptObject::Disconnect(const NPVariant* args, uint32_t arg_count, NPVariant* result) { CHECK_EQ(base::PlatformThread::CurrentId(), np_thread_id_); if (arg_count != 0) { SetException(""disconnect: bad number of arguments""); return false; } DisconnectInternal(); return true; } ",0 "iperf_set_test_bind_address(struct iperf_test *ipt, char *bind_address) { ipt->bind_address = strdup(bind_address); } ",0 "static void vfio_pci_disable(struct vfio_pci_device *vdev) { struct pci_dev *pdev = vdev->pdev; struct vfio_pci_dummy_resource *dummy_res, *tmp; int i, bar; /* Stop the device from further DMA */ pci_clear_master(pdev); vfio_pci_set_irqs_ioctl(vdev, VFIO_IRQ_SET_DATA_NONE | VFIO_IRQ_SET_ACTION_TRIGGER, vdev->irq_type, 0, 0, NULL); vdev->virq_disabled = false; for (i = 0; i < vdev->num_regions; i++) vdev->region[i].ops->release(vdev, &vdev->region[i]); vdev->num_regions = 0; kfree(vdev->region); vdev->region = NULL; /* don't krealloc a freed pointer */ vfio_config_free(vdev); for (bar = PCI_STD_RESOURCES; bar <= PCI_STD_RESOURCE_END; bar++) { if (!vdev->barmap[bar]) continue; pci_iounmap(pdev, vdev->barmap[bar]); pci_release_selected_regions(pdev, 1 << bar); vdev->barmap[bar] = NULL; } list_for_each_entry_safe(dummy_res, tmp, &vdev->dummy_resources_list, res_next) { list_del(&dummy_res->res_next); release_resource(&dummy_res->resource); kfree(dummy_res); } vdev->needs_reset = true; /* * If we have saved state, restore it. If we can reset the device, * even better. Resetting with current state seems better than * nothing, but saving and restoring current state without reset * is just busy work. */ if (pci_load_and_free_saved_state(pdev, &vdev->pci_saved_state)) { pr_info(""%s: Couldn't reload %s saved state\n"", __func__, dev_name(&pdev->dev)); if (!vdev->reset_works) goto out; pci_save_state(pdev); } /* * Disable INTx and MSI, presumably to avoid spurious interrupts * during reset. Stolen from pci_reset_function() */ pci_write_config_word(pdev, PCI_COMMAND, PCI_COMMAND_INTX_DISABLE); /* * Try to reset the device. The success of this is dependent on * being able to lock the device, which is not always possible. */ if (vdev->reset_works && !pci_try_reset_function(pdev)) vdev->needs_reset = false; pci_restore_state(pdev); out: pci_disable_device(pdev); vfio_pci_try_bus_reset(vdev); if (!disable_idle_d3) pci_set_power_state(pdev, PCI_D3hot); } ",0 "bool HarfBuzzShaper::shapeHarfBuzzRuns() { HarfBuzzScopedPtr harfBuzzBuffer(hb_buffer_create(), hb_buffer_destroy); HarfBuzzRunCache& runCache = harfBuzzRunCache(); const FontDescription& fontDescription = m_font->fontDescription(); const String& localeString = fontDescription.locale(); CString locale = localeString.latin1(); HarfBuzzRun* previousRun = nullptr; for (unsigned i = 0; i < m_harfBuzzRuns.size(); ++i) { unsigned runIndex = m_run.rtl() ? m_harfBuzzRuns.size() - i - 1 : i; HarfBuzzRun* currentRun = m_harfBuzzRuns[runIndex].get(); const SimpleFontData* currentFontData = currentRun->fontData(); FontPlatformData* platformData = const_cast(¤tFontData->platformData()); HarfBuzzFace* face = platformData->harfBuzzFace(); if (!face) return false; hb_buffer_set_language(harfBuzzBuffer.get(), hb_language_from_string(locale.data(), locale.length())); hb_buffer_set_script(harfBuzzBuffer.get(), currentRun->script()); hb_buffer_set_direction(harfBuzzBuffer.get(), currentRun->direction()); const UChar* src = m_normalizedBuffer.get() + currentRun->startIndex(); std::wstring key(src, src + currentRun->numCharacters()); CachedShapingResults* cachedResults = runCache.find(key); if (cachedResults) { if (isValidCachedResult(m_font, currentRun->direction(), localeString, cachedResults)) { currentRun->applyShapeResult(cachedResults->buffer); setGlyphPositionsForHarfBuzzRun(currentRun, cachedResults->buffer, previousRun); hb_buffer_clear_contents(harfBuzzBuffer.get()); runCache.moveToBack(cachedResults); previousRun = currentRun; continue; } runCache.remove(cachedResults); } static const uint16_t preContext = space; hb_buffer_add_utf16(harfBuzzBuffer.get(), &preContext, 1, 1, 0); addToHarfBuzzBufferInternal(harfBuzzBuffer.get(), fontDescription, m_normalizedBuffer.get(), currentRun->startIndex(), currentRun->numCharacters()); if (fontDescription.isVerticalAnyUpright()) face->setScriptForVerticalGlyphSubstitution(harfBuzzBuffer.get()); HarfBuzzScopedPtr harfBuzzFont(face->createFont(), hb_font_destroy); hb_shape(harfBuzzFont.get(), harfBuzzBuffer.get(), m_features.isEmpty() ? 0 : m_features.data(), m_features.size()); currentRun->applyShapeResult(harfBuzzBuffer.get()); setGlyphPositionsForHarfBuzzRun(currentRun, harfBuzzBuffer.get(), previousRun); runCache.insert(key, new CachedShapingResults(harfBuzzBuffer.get(), m_font, currentRun->direction(), localeString)); harfBuzzBuffer.set(hb_buffer_create()); previousRun = currentRun; } return true; } ",0 "void CrostiniUpgrader::Upgrade(const ContainerId& container_id) { container_id_ = container_id; CrostiniManager::GetForProfile(profile_)->UpgradeContainer( container_id_, ContainerVersion::STRETCH, ContainerVersion::BUSTER, base::BindOnce(&CrostiniUpgrader::OnUpgrade, weak_ptr_factory_.GetWeakPtr())); } ",0 "static inline int common_perm_path(int op, const struct path *path, u32 mask) { struct path_cond cond = { d_backing_inode(path->dentry)->i_uid, d_backing_inode(path->dentry)->i_mode }; if (!mediated_filesystem(path->dentry)) return 0; return common_perm(op, path, mask, &cond); } ",0 "static struct sco_conn *sco_conn_add(struct hci_conn *hcon) { struct hci_dev *hdev = hcon->hdev; struct sco_conn *conn = hcon->sco_data; if (conn) return conn; conn = kzalloc(sizeof(struct sco_conn), GFP_KERNEL); if (!conn) return NULL; spin_lock_init(&conn->lock); hcon->sco_data = conn; conn->hcon = hcon; if (hdev->sco_mtu > 0) conn->mtu = hdev->sco_mtu; else conn->mtu = 60; BT_DBG(""hcon %p conn %p"", hcon, conn); return conn; } ",0 "void VariationsService::RemoveObserver(Observer* observer) { DCHECK(thread_checker_.CalledOnValidThread()); observer_list_.RemoveObserver(observer); } ",0 "static inline void perf_cgroup_sched_in(struct task_struct *task) { } ",0 " TestDelegate() : last_used_id_(0) {} ",0 "static void ide_reset(IDEState *s) { #ifdef DEBUG_IDE printf(""ide: reset\n""); #endif if (s->pio_aiocb) { blk_aio_cancel(s->pio_aiocb); s->pio_aiocb = NULL; } if (s->drive_kind == IDE_CFATA) s->mult_sectors = 0; else s->mult_sectors = MAX_MULT_SECTORS; /* ide regs */ s->feature = 0; s->error = 0; s->nsector = 0; s->sector = 0; s->lcyl = 0; s->hcyl = 0; /* lba48 */ s->hob_feature = 0; s->hob_sector = 0; s->hob_nsector = 0; s->hob_lcyl = 0; s->hob_hcyl = 0; s->select = 0xa0; s->status = READY_STAT | SEEK_STAT; s->lba48 = 0; /* ATAPI specific */ s->sense_key = 0; s->asc = 0; s->cdrom_changed = 0; s->packet_transfer_size = 0; s->elementary_transfer_size = 0; s->io_buffer_index = 0; s->cd_sector_size = 0; s->atapi_dma = 0; s->tray_locked = 0; s->tray_open = 0; /* ATA DMA state */ s->io_buffer_size = 0; s->req_nb_sectors = 0; ide_set_signature(s); /* init the transfer handler so that 0xffff is returned on data accesses */ s->end_transfer_func = ide_dummy_transfer_stop; ide_dummy_transfer_stop(s); s->media_changed = 0; } ",0 "void HTMLMediaElement::stopPeriodicTimers() { m_progressEventTimer.stop(); m_playbackProgressTimer.stop(); m_checkViewportIntersectionTimer.stop(); } ",0 "SiteInstance* WebContentsImpl::GetPendingSiteInstance() const { RenderViewHost* dest_rvh = render_manager_.pending_render_view_host() ? render_manager_.pending_render_view_host() : render_manager_.current_host(); return dest_rvh->GetSiteInstance(); } ",0 "v8::MaybeLocal ModuleSystem::Require( const std::string& module_name) { v8::Local v8_module_name; if (!ToV8String(GetIsolate(), module_name, &v8_module_name)) return v8::MaybeLocal(); v8::EscapableHandleScope handle_scope(GetIsolate()); v8::Local value = RequireForJsInner( v8_module_name); if (value.IsEmpty() || !value->IsObject()) return v8::MaybeLocal(); return handle_scope.Escape(value.As()); } ",0 "static struct page *kvm_pfn_to_page(pfn_t pfn) { if (is_error_pfn(pfn)) return KVM_ERR_PTR_BAD_PAGE; if (kvm_is_mmio_pfn(pfn)) { WARN_ON(1); return KVM_ERR_PTR_BAD_PAGE; } return pfn_to_page(pfn); } ",0 "isdn_net_receive(struct net_device *ndev, struct sk_buff *skb) { isdn_net_local *lp = netdev_priv(ndev); isdn_net_local *olp = lp; /* original 'lp' */ #ifdef CONFIG_ISDN_X25 struct concap_proto *cprot = lp -> netdev -> cprot; #endif lp->transcount += skb->len; lp->stats.rx_packets++; lp->stats.rx_bytes += skb->len; if (lp->master) { /* Bundling: If device is a slave-device, deliver to master, also * handle master's statistics and hangup-timeout */ ndev = lp->master; lp = netdev_priv(ndev); lp->stats.rx_packets++; lp->stats.rx_bytes += skb->len; } skb->dev = ndev; skb->pkt_type = PACKET_HOST; skb_reset_mac_header(skb); #ifdef ISDN_DEBUG_NET_DUMP isdn_dumppkt(""R:"", skb->data, skb->len, 40); #endif switch (lp->p_encap) { case ISDN_NET_ENCAP_ETHER: /* Ethernet over ISDN */ olp->huptimer = 0; lp->huptimer = 0; skb->protocol = isdn_net_type_trans(skb, ndev); break; case ISDN_NET_ENCAP_UIHDLC: /* HDLC with UI-frame (for ispa with -h1 option) */ olp->huptimer = 0; lp->huptimer = 0; skb_pull(skb, 2); /* Fall through */ case ISDN_NET_ENCAP_RAWIP: /* RAW-IP without MAC-Header */ olp->huptimer = 0; lp->huptimer = 0; skb->protocol = htons(ETH_P_IP); break; case ISDN_NET_ENCAP_CISCOHDLCK: isdn_net_ciscohdlck_receive(lp, skb); return; case ISDN_NET_ENCAP_CISCOHDLC: /* CISCO-HDLC IP with type field and fake I-frame-header */ skb_pull(skb, 2); /* Fall through */ case ISDN_NET_ENCAP_IPTYP: /* IP with type field */ olp->huptimer = 0; lp->huptimer = 0; skb->protocol = *(__be16 *)&(skb->data[0]); skb_pull(skb, 2); if (*(unsigned short *) skb->data == 0xFFFF) skb->protocol = htons(ETH_P_802_3); break; #ifdef CONFIG_ISDN_PPP case ISDN_NET_ENCAP_SYNCPPP: /* huptimer is done in isdn_ppp_push_higher */ isdn_ppp_receive(lp->netdev, olp, skb); return; #endif default: #ifdef CONFIG_ISDN_X25 /* try if there are generic sync_device receiver routines */ if(cprot) if(cprot -> pops) if( cprot -> pops -> data_ind){ cprot -> pops -> data_ind(cprot,skb); return; }; #endif /* CONFIG_ISDN_X25 */ printk(KERN_WARNING ""%s: unknown encapsulation, dropping\n"", lp->netdev->dev->name); kfree_skb(skb); return; } netif_rx(skb); return; } ",0 "void HTMLSelectElement::restoreFormControlState(const FormControlState& state) { recalcListItems(); const Vector& items = listItems(); size_t itemsSize = items.size(); if (!itemsSize) return; for (size_t i = 0; i < itemsSize; ++i) { if (!items[i]->hasLocalName(optionTag)) continue; toHTMLOptionElement(items[i])->setSelectedState(false); } if (!multiple()) { size_t foundIndex = searchOptionsForValue(state[0], 0, itemsSize); if (foundIndex != kNotFound) toHTMLOptionElement(items[foundIndex])->setSelectedState(true); } else { size_t startIndex = 0; for (size_t i = 0; i < state.valueSize(); ++i) { const String& value = state[i]; size_t foundIndex = searchOptionsForValue(value, startIndex, itemsSize); if (foundIndex == kNotFound) foundIndex = searchOptionsForValue(value, 0, startIndex); if (foundIndex == kNotFound) continue; toHTMLOptionElement(items[foundIndex])->setSelectedState(true); startIndex = foundIndex + 1; } } setOptionsChangedOnRenderer(); setNeedsValidityCheck(); } ",0 "static int srpt_ch_list_empty(struct srpt_device *sdev) { int res; spin_lock_irq(&sdev->spinlock); res = list_empty(&sdev->rch_list); spin_unlock_irq(&sdev->spinlock); return res; } ",0 "bool WebPagePrivate::executeJavaScriptInIsolatedWorld(const ScriptSourceCode& sourceCode, JavaScriptDataType& returnType, BlackBerry::Platform::String& returnValue) { if (!m_isolatedWorld) m_isolatedWorld = m_mainFrame->script()->createWorld(); ScriptValue result = m_mainFrame->script()->evaluateInWorld(sourceCode, m_isolatedWorld.get()); JSC::JSValue value = result.jsValue(); if (!value) { returnType = JSException; return false; } if (value.isUndefined()) returnType = JSUndefined; else if (value.isNull()) returnType = JSNull; else if (value.isBoolean()) returnType = JSBoolean; else if (value.isNumber()) returnType = JSNumber; else if (value.isString()) returnType = JSString; else if (value.isObject()) returnType = JSObject; else returnType = JSUndefined; if (returnType == JSBoolean || returnType == JSNumber || returnType == JSString || returnType == JSObject) { JSC::ExecState* exec = m_mainFrame->script()->globalObject(mainThreadNormalWorld())->globalExec(); returnValue = result.toString(exec); } return true; } ",0 "void set_data_blkaddr(struct dnode_of_data *dn) { f2fs_wait_on_page_writeback(dn->node_page, NODE, true); __set_data_blkaddr(dn); if (set_page_dirty(dn->node_page)) dn->node_changed = true; } ",0 "PendingExtensionManager* ExtensionService::pending_extension_manager() { return &pending_extension_manager_; } ",0 "void NavigationController::RendererDidNavigateToSamePage( const ViewHostMsg_FrameNavigate_Params& params) { NavigationEntry* existing_entry = GetEntryWithPageID( tab_contents_->GetSiteInstance(), params.page_id); existing_entry->set_unique_id(pending_entry_->unique_id()); existing_entry->set_url(params.url); DiscardNonCommittedEntries(); } ",0 "void DiskCacheBackendTest::BackendRecoverInsert() { BackendTransaction(""insert_empty1"", 0, false); ASSERT_TRUE(success_) << ""insert_empty1""; BackendTransaction(""insert_empty2"", 0, false); ASSERT_TRUE(success_) << ""insert_empty2""; BackendTransaction(""insert_empty3"", 0, false); ASSERT_TRUE(success_) << ""insert_empty3""; BackendTransaction(""insert_one1"", 1, false); ASSERT_TRUE(success_) << ""insert_one1""; BackendTransaction(""insert_one2"", 1, false); ASSERT_TRUE(success_) << ""insert_one2""; BackendTransaction(""insert_one3"", 1, false); ASSERT_TRUE(success_) << ""insert_one3""; BackendTransaction(""insert_load1"", 100, true); ASSERT_TRUE(success_) << ""insert_load1""; BackendTransaction(""insert_load2"", 100, true); ASSERT_TRUE(success_) << ""insert_load2""; } ",0 "bool WebGLRenderingContextBase::IsXRDeviceCompatible( const XRDevice* xr_device) { return xr_device == compatible_xr_device_; } ",0 "void jswrap_graphics_setPixel(JsVar *parent, int x, int y, JsVar *color) { JsGraphics gfx; if (!graphicsGetFromVar(&gfx, parent)) return; unsigned int col = gfx.data.fgColor; if (!jsvIsUndefined(color)) col = (unsigned int)jsvGetInteger(color); graphicsSetPixel(&gfx, (short)x, (short)y, col); gfx.data.cursorX = (short)x; gfx.data.cursorY = (short)y; graphicsSetVar(&gfx); // gfx data changed because modified area } ",0 "new_dev_store(struct mddev *mddev, const char *buf, size_t len) { /* buf must be %d:%d\n? giving major and minor numbers */ /* The new device is added to the array. * If the array has a persistent superblock, we read the * superblock to initialise info and check validity. * Otherwise, only checking done is that in bind_rdev_to_array, * which mainly checks size. */ char *e; int major = simple_strtoul(buf, &e, 10); int minor; dev_t dev; struct md_rdev *rdev; int err; if (!*buf || *e != ':' || !e[1] || e[1] == '\n') return -EINVAL; minor = simple_strtoul(e+1, &e, 10); if (*e && *e != '\n') return -EINVAL; dev = MKDEV(major, minor); if (major != MAJOR(dev) || minor != MINOR(dev)) return -EOVERFLOW; flush_workqueue(md_misc_wq); err = mddev_lock(mddev); if (err) return err; if (mddev->persistent) { rdev = md_import_device(dev, mddev->major_version, mddev->minor_version); if (!IS_ERR(rdev) && !list_empty(&mddev->disks)) { struct md_rdev *rdev0 = list_entry(mddev->disks.next, struct md_rdev, same_set); err = super_types[mddev->major_version] .load_super(rdev, rdev0, mddev->minor_version); if (err < 0) goto out; } } else if (mddev->external) rdev = md_import_device(dev, -2, -1); else rdev = md_import_device(dev, -1, -1); if (IS_ERR(rdev)) { mddev_unlock(mddev); return PTR_ERR(rdev); } err = bind_rdev_to_array(rdev, mddev); out: if (err) export_rdev(rdev); mddev_unlock(mddev); return err ? err : len; } ",0 "void FrameLoader::didEndDocument() { m_isLoadingMainResource = false; } ",0 "chunk_copy(const chunk_t *in_chunk) { chunk_t *newch = tor_memdup(in_chunk, CHUNK_ALLOC_SIZE(in_chunk->memlen)); total_bytes_allocated_in_chunks += CHUNK_ALLOC_SIZE(in_chunk->memlen); #ifdef DEBUG_CHUNK_ALLOC newch->DBG_alloc = CHUNK_ALLOC_SIZE(in_chunk->memlen); #endif newch->next = NULL; if (in_chunk->data) { off_t offset = in_chunk->data - in_chunk->mem; newch->data = newch->mem + offset; } return newch; } ",0 "static int enable_smi_window(struct kvm_vcpu *vcpu) { return 0; } ",0 "void OMXNodeInstance::setHandle(OMX::node_id node_id, OMX_HANDLETYPE handle) { mNodeID = node_id; CLOG_LIFE(allocateNode, ""handle=%p"", handle); CHECK(mHandle == NULL); mHandle = handle; } ",0 "mrb_io_sync(mrb_state *mrb, mrb_value self) { struct mrb_io *fptr; fptr = io_get_open_fptr(mrb, self); return mrb_bool_value(fptr->sync); } ",0 "void Element::addActiveAnimation(Animation* animation) { ElementRareData* rareData = ensureElementRareData(); if (!rareData->activeAnimations()) rareData->setActiveAnimations(adoptPtr(new Vector)); rareData->activeAnimations()->append(animation); } ",0 "WebContents* DownloadItemImpl::GetWebContents() const { if (request_handle_.get()) return request_handle_->GetWebContents(); return NULL; } ",0 "bool HeapAllocator::expandInlineVectorBacking(void* address, size_t newSize) { return backingExpand(address, newSize); } ",0 "static inline int ablkcipher_next_fast(struct ablkcipher_request *req, struct ablkcipher_walk *walk) { walk->src.page = scatterwalk_page(&walk->in); walk->src.offset = offset_in_page(walk->in.offset); walk->dst.page = scatterwalk_page(&walk->out); walk->dst.offset = offset_in_page(walk->out.offset); return 0; } ",0 "void SelectionController::HandleGestureLongTap( const GestureEventWithHitTestResults& targeted_event) { TRACE_EVENT0(""blink"", ""SelectionController::handleGestureLongTap""); SetCaretAtHitTestResult(targeted_event.GetHitTestResult()); } ",0 "void WebContentsImpl::SetAccessibilityMode(ui::AXMode mode) { if (mode == accessibility_mode_) return; if (IsNeverVisible()) return; accessibility_mode_ = mode; for (FrameTreeNode* node : frame_tree_.Nodes()) { UpdateAccessibilityModeOnFrame(node->current_frame_host()); RenderFrameHost* pending_frame_host = node->render_manager()->pending_frame_host(); if (pending_frame_host) UpdateAccessibilityModeOnFrame(pending_frame_host); } } ",0 "WebGraphicsContext3DProvider* AcceleratedStaticBitmapImage::ContextProvider() const { if (!IsValid()) return nullptr; return texture_holder_->ContextProvider(); } ",0 "array_new_indexed_plist_write(dict_param_list * plist, ref * parray, const ref * pwanted, gs_ref_memory_t *imem) { check_array(*parray); check_write(*parray); plist->u.w.write = array_new_indexed_param_write; ref_param_write_init((iparam_list *) plist, pwanted, imem); plist->dict = *parray; plist->int_keys = true; return 0; } ",0 "int64_t ga_get_fd_handle(GAState *s, Error **errp) { int64_t handle; g_assert(s->pstate_filepath); /* we blacklist commands and avoid operations that potentially require * writing to disk when we're in a frozen state. this includes opening * new files, so we should never get here in that situation */ g_assert(!ga_is_frozen(s)); handle = s->pstate.fd_counter++; /* This should never happen on a reasonable timeframe, as guest-file-open * would have to be issued 2^63 times */ if (s->pstate.fd_counter == INT64_MAX) { abort(); } if (!write_persistent_state(&s->pstate, s->pstate_filepath)) { error_setg(errp, ""failed to commit persistent state to disk""); } return handle; } ",0 "std::vector Extension::GetPermissionMessageStrings() const { base::AutoLock auto_lock(runtime_data_lock_); if (IsTrustedId(id())) return std::vector(); else return runtime_data_.GetActivePermissions()->GetWarningMessages(GetType()); } ",0 "void HTMLFormControlElement::reset() { setAutofilled(false); resetImpl(); } ",0 "smtp_send_thread(thread_t * thread) { smtp_t *smtp = THREAD_ARG(thread); if (thread->type == THREAD_WRITE_TIMEOUT) { log_message(LOG_INFO, ""Timeout sending data to remote SMTP server %s."" , FMT_SMTP_HOST()); SMTP_FSM_READ(QUIT, thread, 0); return 0; } SMTP_FSM_SEND(smtp->stage, thread); /* Handle END command */ if (smtp->stage == END) { SMTP_FSM_READ(QUIT, thread, 0); return 0; } /* Registering next smtp command processing thread */ if (smtp->stage != ERROR) { thread_add_read(thread->master, smtp_read_thread, smtp, thread->u.fd, global_data->smtp_connection_to); thread_del_write(thread); } else { log_message(LOG_INFO, ""Can not send data to remote SMTP server %s."" , FMT_SMTP_HOST()); SMTP_FSM_READ(QUIT, thread, 0); } return 0; } ",0 "buf_new(void) { buf_t *buf = tor_malloc_zero(sizeof(buf_t)); buf->magic = BUFFER_MAGIC; buf->default_chunk_size = 4096; return buf; } ",0 "void GLES2DecoderImpl::DoGetShaderiv(GLuint shader_id, GLenum pname, GLint* params, GLsizei params_size) { Shader* shader = GetShaderInfoNotProgram(shader_id, ""glGetShaderiv""); if (!shader) { return; } switch (pname) { case GL_COMPILE_STATUS: case GL_INFO_LOG_LENGTH: case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: CompileShaderAndExitCommandProcessingEarly(shader); break; default: break; } switch (pname) { case GL_SHADER_SOURCE_LENGTH: *params = shader->source().size(); if (*params) ++(*params); return; case GL_COMPILE_STATUS: *params = compile_shader_always_succeeds_ ? true : shader->valid(); return; case GL_INFO_LOG_LENGTH: *params = shader->log_info().size(); if (*params) ++(*params); return; case GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE: *params = shader->translated_source().size(); if (*params) ++(*params); return; default: break; } api()->glGetShaderivFn(shader->service_id(), pname, params); } ",0 " v8::Isolate* isolate() const { return m_scriptState->isolate(); } ",0 "place_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int initial) { u64 vruntime = cfs_rq->min_vruntime; /* * The 'current' period is already promised to the current tasks, * however the extra weight of the new task will slow them down a * little, place the new task so that it fits in the slot that * stays open at the end. */ if (initial && sched_feat(START_DEBIT)) vruntime += sched_vslice(cfs_rq, se); /* sleeps up to a single latency don't count. */ if (!initial) { unsigned long thresh = sysctl_sched_latency; /* * Halve their sleep time's effect, to allow * for a gentler effect of sleepers: */ if (sched_feat(GENTLE_FAIR_SLEEPERS)) thresh >>= 1; vruntime -= thresh; } /* ensure we never gain time by being placed backwards. */ se->vruntime = max_vruntime(se->vruntime, vruntime); } ",0 "file_getpos(struct file *file, fpos_t *pos) { if (fgetpos(file->file, pos)) { /* This is unexpected, so perror it */ perror(file->file_name); stop(file, READ_ERROR_CODE, ""fgetpos""); } } ",0 "void RenderLayerCompositor::assignLayersToBackingsInternal(RenderLayer* layer, SquashingState& squashingState, bool& layersChanged) { if (allocateOrClearCompositedLayerMapping(layer)) layersChanged = true; if (layer->reflectionInfo()) assignLayersToBackingsForReflectionLayer(layer->reflectionInfo()->reflectionLayer(), layersChanged); if (layerSquashingEnabled()) { if (requiresSquashing(layer->compositingReasons())) { ASSERT(!layer->hasCompositedLayerMapping()); ASSERT(squashingState.hasMostRecentMapping); IntPoint offsetFromAbsoluteForSquashedLayer = computeOffsetFromAbsolute(layer); IntSize offsetFromSquashingCLM(offsetFromAbsoluteForSquashedLayer.x() - squashingState.offsetFromAbsoluteForSquashingCLM.x(), offsetFromAbsoluteForSquashedLayer.y() - squashingState.offsetFromAbsoluteForSquashingCLM.y()); squashingState.mostRecentMapping->addRenderLayerToSquashingGraphicsLayer(layer, offsetFromSquashingCLM, squashingState.nextSquashedLayerIndex); squashingState.nextSquashedLayerIndex++; layersChanged = true; layer->clipper().clearClipRectsIncludingDescendants(); } else { if (layer->compositingState() == PaintsIntoGroupedBacking) { ASSERT(layer->groupedMapping()); layer->setGroupedMapping(0); layer->setShouldInvalidateNextBacking(true); } } } if (layer->shouldInvalidateNextBacking()) { if (layer->compositingState() == PaintsIntoGroupedBacking && squashingState.mostRecentMapping->squashingLayer()) { squashingState.mostRecentMapping->squashingLayer()->setNeedsDisplay(); } else { RenderLayer* enclosingLayer = layer->enclosingCompositingLayerForRepaint(ExcludeSelf); if (enclosingLayer->hasCompositedLayerMapping()) enclosingLayer->compositedLayerMapping()->setContentsNeedDisplay(); } layer->setShouldInvalidateNextBacking(false); } if (layer->stackingNode()->isStackingContainer()) { RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NegativeZOrderChildren); while (RenderLayerStackingNode* curNode = iterator.next()) assignLayersToBackingsInternal(curNode->layer(), squashingState, layersChanged); } if (layerSquashingEnabled()) { if (layer->compositingState() == PaintsIntoOwnBacking || layer->compositingState() == HasOwnBackingButPaintsIntoAncestor) { ASSERT(!requiresSquashing(layer->compositingReasons())); IntPoint offsetFromAbsoluteForSquashingCLM = computeOffsetFromAbsolute(layer); squashingState.updateSquashingStateForNewMapping(layer->compositedLayerMapping(), layer->hasCompositedLayerMapping(), offsetFromAbsoluteForSquashingCLM); } } RenderLayerStackingNodeIterator iterator(*layer->stackingNode(), NormalFlowChildren | PositiveZOrderChildren); while (RenderLayerStackingNode* curNode = iterator.next()) assignLayersToBackingsInternal(curNode->layer(), squashingState, layersChanged); } ",0 "bool IsStrongEtag(const std::string& etag) { return etag.size() > 2 && etag[0] == '""'; } ",0 "int phar_free_alias(phar_archive_data *phar, char *alias, int alias_len) /* {{{ */ { if (phar->refcount || phar->is_persistent) { return FAILURE; } /* this archive has no open references, so emit an E_STRICT and remove it */ if (zend_hash_str_del(&(PHAR_G(phar_fname_map)), phar->fname, phar->fname_len) != SUCCESS) { return FAILURE; } /* invalidate phar cache */ PHAR_G(last_phar) = NULL; PHAR_G(last_phar_name) = PHAR_G(last_alias) = NULL; return SUCCESS; } /* }}} */ ",0 "static ssize_t btrfs_direct_IO(struct kiocb *iocb, struct iov_iter *iter, loff_t offset) { struct file *file = iocb->ki_filp; struct inode *inode = file->f_mapping->host; struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_dio_data dio_data = { 0 }; size_t count = 0; int flags = 0; bool wakeup = true; bool relock = false; ssize_t ret; if (check_direct_IO(BTRFS_I(inode)->root, iocb, iter, offset)) return 0; inode_dio_begin(inode); smp_mb__after_atomic(); /* * The generic stuff only does filemap_write_and_wait_range, which * isn't enough if we've written compressed pages to this area, so * we need to flush the dirty pages again to make absolutely sure * that any outstanding dirty pages are on disk. */ count = iov_iter_count(iter); if (test_bit(BTRFS_INODE_HAS_ASYNC_EXTENT, &BTRFS_I(inode)->runtime_flags)) filemap_fdatawrite_range(inode->i_mapping, offset, offset + count - 1); if (iov_iter_rw(iter) == WRITE) { /* * If the write DIO is beyond the EOF, we need update * the isize, but it is protected by i_mutex. So we can * not unlock the i_mutex at this case. */ if (offset + count <= inode->i_size) { mutex_unlock(&inode->i_mutex); relock = true; } ret = btrfs_delalloc_reserve_space(inode, count); if (ret) goto out; dio_data.outstanding_extents = div64_u64(count + BTRFS_MAX_EXTENT_SIZE - 1, BTRFS_MAX_EXTENT_SIZE); /* * We need to know how many extents we reserved so that we can * do the accounting properly if we go over the number we * originally calculated. Abuse current->journal_info for this. */ dio_data.reserve = round_up(count, root->sectorsize); current->journal_info = &dio_data; } else if (test_bit(BTRFS_INODE_READDIO_NEED_LOCK, &BTRFS_I(inode)->runtime_flags)) { inode_dio_end(inode); flags = DIO_LOCKING | DIO_SKIP_HOLES; wakeup = false; } ret = __blockdev_direct_IO(iocb, inode, BTRFS_I(inode)->root->fs_info->fs_devices->latest_bdev, iter, offset, btrfs_get_blocks_direct, NULL, btrfs_submit_direct, flags); if (iov_iter_rw(iter) == WRITE) { current->journal_info = NULL; if (ret < 0 && ret != -EIOCBQUEUED) { if (dio_data.reserve) btrfs_delalloc_release_space(inode, dio_data.reserve); } else if (ret >= 0 && (size_t)ret < count) btrfs_delalloc_release_space(inode, count - (size_t)ret); } out: if (wakeup) inode_dio_end(inode); if (relock) mutex_lock(&inode->i_mutex); return ret; } ",0 "CustomElementRegistry* LocalDOMWindow::MaybeCustomElements() const { return custom_elements_; } ",0 "static void deliver_smi_err_response(struct ipmi_smi *intf, struct ipmi_smi_msg *msg, unsigned char err) { msg->rsp[0] = msg->data[0] | 4; msg->rsp[1] = msg->data[1]; msg->rsp[2] = err; msg->rsp_size = 3; /* It's an error, so it will never requeue, no need to check return. */ handle_one_recv_msg(intf, msg); } ",0 "auth_select_file(struct sc_card *card, const struct sc_path *in_path, struct sc_file **file_out) { struct sc_path path; struct sc_file *tmp_file = NULL; size_t offs, ii; int rv; LOG_FUNC_CALLED(card->ctx); assert(card != NULL && in_path != NULL); memcpy(&path, in_path, sizeof(struct sc_path)); sc_log(card->ctx, ""in_path; type=%d, path=%s, out %p"", in_path->type, sc_print_path(in_path), file_out); sc_log(card->ctx, ""current path; type=%d, path=%s"", auth_current_df->path.type, sc_print_path(&auth_current_df->path)); if (auth_current_ef) sc_log(card->ctx, ""current file; type=%d, path=%s"", auth_current_ef->path.type, sc_print_path(&auth_current_ef->path)); if (path.type == SC_PATH_TYPE_PARENT || path.type == SC_PATH_TYPE_FILE_ID) { sc_file_free(auth_current_ef); auth_current_ef = NULL; rv = iso_ops->select_file(card, &path, &tmp_file); LOG_TEST_RET(card->ctx, rv, ""select file failed""); if (!tmp_file) return SC_ERROR_OBJECT_NOT_FOUND; if (path.type == SC_PATH_TYPE_PARENT) { memcpy(&tmp_file->path, &auth_current_df->path, sizeof(struct sc_path)); if (tmp_file->path.len > 2) tmp_file->path.len -= 2; sc_file_free(auth_current_df); sc_file_dup(&auth_current_df, tmp_file); } else { if (tmp_file->type == SC_FILE_TYPE_DF) { sc_concatenate_path(&tmp_file->path, &auth_current_df->path, &path); sc_file_free(auth_current_df); sc_file_dup(&auth_current_df, tmp_file); } else { sc_file_free(auth_current_ef); sc_file_dup(&auth_current_ef, tmp_file); sc_concatenate_path(&auth_current_ef->path, &auth_current_df->path, &path); } } if (file_out) sc_file_dup(file_out, tmp_file); sc_file_free(tmp_file); } else if (path.type == SC_PATH_TYPE_DF_NAME) { rv = iso_ops->select_file(card, &path, NULL); if (rv) { sc_file_free(auth_current_ef); auth_current_ef = NULL; } LOG_TEST_RET(card->ctx, rv, ""select file failed""); } else { for (offs = 0; offs < path.len && offs < auth_current_df->path.len; offs += 2) if (path.value[offs] != auth_current_df->path.value[offs] || path.value[offs + 1] != auth_current_df->path.value[offs + 1]) break; sc_log(card->ctx, ""offs %""SC_FORMAT_LEN_SIZE_T""u"", offs); if (offs && offs < auth_current_df->path.len) { size_t deep = auth_current_df->path.len - offs; sc_log(card->ctx, ""deep %""SC_FORMAT_LEN_SIZE_T""u"", deep); for (ii=0; iipath, sizeof(struct sc_path)); tmp_path.type = SC_PATH_TYPE_PARENT; rv = auth_select_file (card, &tmp_path, file_out); LOG_TEST_RET(card->ctx, rv, ""select file failed""); } } if (path.len - offs > 0) { struct sc_path tmp_path; memset(&tmp_path, 0, sizeof(struct sc_path)); tmp_path.type = SC_PATH_TYPE_FILE_ID; tmp_path.len = 2; for (ii=0; ii < path.len - offs; ii+=2) { memcpy(tmp_path.value, path.value + offs + ii, 2); rv = auth_select_file(card, &tmp_path, file_out); LOG_TEST_RET(card->ctx, rv, ""select file failed""); } } else if (path.len - offs == 0 && file_out) { if (sc_compare_path(&path, &auth_current_df->path)) sc_file_dup(file_out, auth_current_df); else if (auth_current_ef) sc_file_dup(file_out, auth_current_ef); else LOG_TEST_RET(card->ctx, SC_ERROR_INTERNAL, ""No current EF""); } } LOG_FUNC_RETURN(card->ctx, 0); } ",1 "searchKeyNum(void) { char *d; int n = 1; d = searchKeyData(); if (d != NULL) n = atoi(d); return n * PREC_NUM; } ",0 "AppCacheHost::~AppCacheHost() { service_->RemoveObserver(this); FOR_EACH_OBSERVER(Observer, observers_, OnDestructionImminent(this)); if (associated_cache_.get()) associated_cache_->UnassociateHost(this); if (group_being_updated_.get()) group_being_updated_->RemoveUpdateObserver(this); storage()->CancelDelegateCallbacks(this); if (service()->quota_manager_proxy() && !origin_in_use_.is_empty()) service()->quota_manager_proxy()->NotifyOriginNoLongerInUse(origin_in_use_); } ",0 "update_next_balance(struct sched_domain *sd, unsigned long *next_balance) { unsigned long interval, next; /* used by idle balance, so cpu_busy = 0 */ interval = get_sd_balance_interval(sd, 0); next = sd->last_balance + interval; if (time_after(*next_balance, next)) *next_balance = next; } ",0 "static __init int setup_vmcs_config(struct vmcs_config *vmcs_conf) { u32 vmx_msr_low, vmx_msr_high; u32 min, opt, min2, opt2; u32 _pin_based_exec_control = 0; u32 _cpu_based_exec_control = 0; u32 _cpu_based_2nd_exec_control = 0; u32 _vmexit_control = 0; u32 _vmentry_control = 0; min = CPU_BASED_HLT_EXITING | #ifdef CONFIG_X86_64 CPU_BASED_CR8_LOAD_EXITING | CPU_BASED_CR8_STORE_EXITING | #endif CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING | CPU_BASED_USE_IO_BITMAPS | CPU_BASED_MOV_DR_EXITING | CPU_BASED_USE_TSC_OFFSETING | CPU_BASED_MWAIT_EXITING | CPU_BASED_MONITOR_EXITING | CPU_BASED_INVLPG_EXITING | CPU_BASED_RDPMC_EXITING; opt = CPU_BASED_TPR_SHADOW | CPU_BASED_USE_MSR_BITMAPS | CPU_BASED_ACTIVATE_SECONDARY_CONTROLS; if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PROCBASED_CTLS, &_cpu_based_exec_control) < 0) return -EIO; #ifdef CONFIG_X86_64 if ((_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)) _cpu_based_exec_control &= ~CPU_BASED_CR8_LOAD_EXITING & ~CPU_BASED_CR8_STORE_EXITING; #endif if (_cpu_based_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) { min2 = 0; opt2 = SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE | SECONDARY_EXEC_WBINVD_EXITING | SECONDARY_EXEC_ENABLE_VPID | SECONDARY_EXEC_ENABLE_EPT | SECONDARY_EXEC_UNRESTRICTED_GUEST | SECONDARY_EXEC_PAUSE_LOOP_EXITING | SECONDARY_EXEC_RDTSCP | SECONDARY_EXEC_ENABLE_INVPCID | SECONDARY_EXEC_APIC_REGISTER_VIRT | SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY | SECONDARY_EXEC_SHADOW_VMCS; if (adjust_vmx_controls(min2, opt2, MSR_IA32_VMX_PROCBASED_CTLS2, &_cpu_based_2nd_exec_control) < 0) return -EIO; } #ifndef CONFIG_X86_64 if (!(_cpu_based_2nd_exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) _cpu_based_exec_control &= ~CPU_BASED_TPR_SHADOW; #endif if (!(_cpu_based_exec_control & CPU_BASED_TPR_SHADOW)) _cpu_based_2nd_exec_control &= ~( SECONDARY_EXEC_APIC_REGISTER_VIRT | SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE | SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY); if (_cpu_based_2nd_exec_control & SECONDARY_EXEC_ENABLE_EPT) { /* CR3 accesses and invlpg don't need to cause VM Exits when EPT enabled */ _cpu_based_exec_control &= ~(CPU_BASED_CR3_LOAD_EXITING | CPU_BASED_CR3_STORE_EXITING | CPU_BASED_INVLPG_EXITING); rdmsr(MSR_IA32_VMX_EPT_VPID_CAP, vmx_capability.ept, vmx_capability.vpid); } min = 0; #ifdef CONFIG_X86_64 min |= VM_EXIT_HOST_ADDR_SPACE_SIZE; #endif opt = VM_EXIT_SAVE_IA32_PAT | VM_EXIT_LOAD_IA32_PAT | VM_EXIT_ACK_INTR_ON_EXIT; if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_EXIT_CTLS, &_vmexit_control) < 0) return -EIO; min = PIN_BASED_EXT_INTR_MASK | PIN_BASED_NMI_EXITING; opt = PIN_BASED_VIRTUAL_NMIS | PIN_BASED_POSTED_INTR; if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_PINBASED_CTLS, &_pin_based_exec_control) < 0) return -EIO; if (!(_cpu_based_2nd_exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) || !(_vmexit_control & VM_EXIT_ACK_INTR_ON_EXIT)) _pin_based_exec_control &= ~PIN_BASED_POSTED_INTR; min = 0; opt = VM_ENTRY_LOAD_IA32_PAT; if (adjust_vmx_controls(min, opt, MSR_IA32_VMX_ENTRY_CTLS, &_vmentry_control) < 0) return -EIO; rdmsr(MSR_IA32_VMX_BASIC, vmx_msr_low, vmx_msr_high); /* IA-32 SDM Vol 3B: VMCS size is never greater than 4kB. */ if ((vmx_msr_high & 0x1fff) > PAGE_SIZE) return -EIO; #ifdef CONFIG_X86_64 /* IA-32 SDM Vol 3B: 64-bit CPUs always have VMX_BASIC_MSR[48]==0. */ if (vmx_msr_high & (1u<<16)) return -EIO; #endif /* Require Write-Back (WB) memory type for VMCS accesses. */ if (((vmx_msr_high >> 18) & 15) != 6) return -EIO; vmcs_conf->size = vmx_msr_high & 0x1fff; vmcs_conf->order = get_order(vmcs_config.size); vmcs_conf->revision_id = vmx_msr_low; vmcs_conf->pin_based_exec_ctrl = _pin_based_exec_control; vmcs_conf->cpu_based_exec_ctrl = _cpu_based_exec_control; vmcs_conf->cpu_based_2nd_exec_ctrl = _cpu_based_2nd_exec_control; vmcs_conf->vmexit_ctrl = _vmexit_control; vmcs_conf->vmentry_ctrl = _vmentry_control; cpu_has_load_ia32_efer = allow_1_setting(MSR_IA32_VMX_ENTRY_CTLS, VM_ENTRY_LOAD_IA32_EFER) && allow_1_setting(MSR_IA32_VMX_EXIT_CTLS, VM_EXIT_LOAD_IA32_EFER); cpu_has_load_perf_global_ctrl = allow_1_setting(MSR_IA32_VMX_ENTRY_CTLS, VM_ENTRY_LOAD_IA32_PERF_GLOBAL_CTRL) && allow_1_setting(MSR_IA32_VMX_EXIT_CTLS, VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL); /* * Some cpus support VM_ENTRY_(LOAD|SAVE)_IA32_PERF_GLOBAL_CTRL * but due to arrata below it can't be used. Workaround is to use * msr load mechanism to switch IA32_PERF_GLOBAL_CTRL. * * VM Exit May Incorrectly Clear IA32_PERF_GLOBAL_CTRL [34:32] * * AAK155 (model 26) * AAP115 (model 30) * AAT100 (model 37) * BC86,AAY89,BD102 (model 44) * BA97 (model 46) * */ if (cpu_has_load_perf_global_ctrl && boot_cpu_data.x86 == 0x6) { switch (boot_cpu_data.x86_model) { case 26: case 30: case 37: case 44: case 46: cpu_has_load_perf_global_ctrl = false; printk_once(KERN_WARNING""kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL "" ""does not work properly. Using workaround\n""); break; default: break; } } return 0; } ",0 "bool GLES2DecoderPassthroughImpl::MakeCurrent() { if (!context_.get()) return false; if (WasContextLost()) { LOG(ERROR) << "" GLES2DecoderPassthroughImpl: Trying to make lost context "" ""current.""; return false; } if (!context_->MakeCurrent(surface_.get())) { LOG(ERROR) << "" GLES2DecoderPassthroughImpl: Context lost during MakeCurrent.""; MarkContextLost(error::kMakeCurrentFailed); group_->LoseContexts(error::kUnknown); return false; } DCHECK_EQ(api(), gl::g_current_gl_context); if (CheckResetStatus()) { LOG(ERROR) << "" GLES2DecoderPassthroughImpl: Context reset detected after "" ""MakeCurrent.""; group_->LoseContexts(error::kUnknown); return false; } ProcessReadPixels(false); ProcessQueries(false); resources_->DestroyPendingTextures(/*has_context=*/true); return true; } ",0 "void GLES2Implementation::InvalidateCachedExtensions() { cached_extension_string_ = nullptr; cached_extensions_.clear(); } ",0 "void V8TestObject::LocationWithPerWorldBindingsAttributeGetterCallbackForMainWorld(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_locationWithPerWorldBindings_Getter""); test_object_v8_internal::LocationWithPerWorldBindingsAttributeGetterForMainWorld(info); } ",0 "ListValue* SyncEntitiesToValue( const ::google::protobuf::RepeatedPtrField& entities, bool include_specifics) { ListValue* list = new ListValue(); ::google::protobuf::RepeatedPtrField::const_iterator it; for (it = entities.begin(); it != entities.end(); ++it) { list->Append(SyncEntityToValue(*it, include_specifics)); } return list; } ",0 "void LayerTreeCoordinator::syncFixedLayers() { if (!m_webPage->corePage()->settings() || !m_webPage->corePage()->settings()->acceleratedCompositingForFixedPositionEnabled()) return; if (!m_webPage->mainFrame()->view()->hasViewportConstrainedObjects()) return; RenderLayer* rootRenderLayer = m_webPage->mainFrame()->contentRenderer()->compositor()->rootRenderLayer(); ASSERT(rootRenderLayer); if (rootRenderLayer->firstChild()) updateOffsetFromViewportForLayer(rootRenderLayer->firstChild()); } ",0 "static void ssh_gotdata(Ssh ssh, const unsigned char *data, int datalen) { /* Log raw data, if we're in that mode. */ if (ssh->logctx) log_packet(ssh->logctx, PKT_INCOMING, -1, NULL, data, datalen, 0, NULL, NULL, 0, NULL); crBegin(ssh->ssh_gotdata_crstate); /* * To begin with, feed the characters one by one to the * protocol initialisation / selection function do_ssh_init(). * When that returns 0, we're done with the initial greeting * exchange and can move on to packet discipline. */ while (1) { int ret; /* need not be kept across crReturn */ if (datalen == 0) crReturnV; /* more data please */ ret = ssh->do_ssh_init(ssh, *data); data++; datalen--; if (ret == 0) break; } /* * We emerge from that loop when the initial negotiation is * over and we have selected an s_rdpkt function. Now pass * everything to s_rdpkt, and then pass the resulting packets * to the proper protocol handler. */ while (1) { while (bufchain_size(&ssh->queued_incoming_data) > 0 || datalen > 0) { if (ssh->frozen) { ssh_queue_incoming_data(ssh, &data, &datalen); /* This uses up all data and cannot cause anything interesting * to happen; indeed, for anything to happen at all, we must * return, so break out. */ break; } else if (bufchain_size(&ssh->queued_incoming_data) > 0) { /* This uses up some or all data, and may freeze the * session. */ ssh_process_queued_incoming_data(ssh); } else { /* This uses up some or all data, and may freeze the * session. */ ssh_process_incoming_data(ssh, &data, &datalen); } /* FIXME this is probably EBW. */ if (ssh->state == SSH_STATE_CLOSED) return; } /* We're out of data. Go and get some more. */ crReturnV; } crFinishV; } ",0 "void WebPagePrivate::didReceiveTouchEventMode(TouchEventMode mode) { if (mode != m_touchEventMode) m_client->touchEventModeChanged(toPlatformTouchEventMode(mode)); m_touchEventMode = mode; } ",0 "comics_document_get_page_size (EvDocument *document, EvPage *page, double *width, double *height) { GdkPixbufLoader *loader; char **argv; guchar buf[1024]; gboolean success, got_size = FALSE; gint outpipe = -1; GPid child_pid; gssize bytes; GdkPixbuf *pixbuf; gchar *filename; ComicsDocument *comics_document = COMICS_DOCUMENT (document); if (!comics_document->decompress_tmp) { argv = extract_argv (document, page->index); success = g_spawn_async_with_pipes (NULL, argv, NULL, G_SPAWN_SEARCH_PATH | G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, &child_pid, NULL, &outpipe, NULL, NULL); g_strfreev (argv); g_return_if_fail (success == TRUE); loader = gdk_pixbuf_loader_new (); g_signal_connect (loader, ""area-prepared"", G_CALLBACK (get_page_size_area_prepared_cb), &got_size); while (outpipe >= 0) { bytes = read (outpipe, buf, 1024); if (bytes > 0) gdk_pixbuf_loader_write (loader, buf, bytes, NULL); if (bytes <= 0 || got_size) { close (outpipe); outpipe = -1; gdk_pixbuf_loader_close (loader, NULL); } } pixbuf = gdk_pixbuf_loader_get_pixbuf (loader); if (pixbuf) { if (width) *width = gdk_pixbuf_get_width (pixbuf); if (height) *height = gdk_pixbuf_get_height (pixbuf); } g_spawn_close_pid (child_pid); g_object_unref (loader); } else { filename = g_build_filename (comics_document->dir, (char *) comics_document->page_names->pdata[page->index], NULL); pixbuf = gdk_pixbuf_new_from_file (filename, NULL); if (pixbuf) { if (width) *width = gdk_pixbuf_get_width (pixbuf); if (height) *height = gdk_pixbuf_get_height (pixbuf); g_object_unref (pixbuf); } g_free (filename); } } ",0 "size_t ZSTD_CCtxParam_getParameter( ZSTD_CCtx_params* CCtxParams, ZSTD_cParameter param, unsigned* value) { switch(param) { case ZSTD_p_format : *value = CCtxParams->format; break; case ZSTD_p_compressionLevel : *value = CCtxParams->compressionLevel; break; case ZSTD_p_windowLog : *value = CCtxParams->cParams.windowLog; break; case ZSTD_p_hashLog : *value = CCtxParams->cParams.hashLog; break; case ZSTD_p_chainLog : *value = CCtxParams->cParams.chainLog; break; case ZSTD_p_searchLog : *value = CCtxParams->cParams.searchLog; break; case ZSTD_p_minMatch : *value = CCtxParams->cParams.searchLength; break; case ZSTD_p_targetLength : *value = CCtxParams->cParams.targetLength; break; case ZSTD_p_compressionStrategy : *value = (unsigned)CCtxParams->cParams.strategy; break; case ZSTD_p_contentSizeFlag : *value = CCtxParams->fParams.contentSizeFlag; break; case ZSTD_p_checksumFlag : *value = CCtxParams->fParams.checksumFlag; break; case ZSTD_p_dictIDFlag : *value = !CCtxParams->fParams.noDictIDFlag; break; case ZSTD_p_forceMaxWindow : *value = CCtxParams->forceWindow; break; case ZSTD_p_forceAttachDict : *value = CCtxParams->attachDictPref; break; case ZSTD_p_nbWorkers : #ifndef ZSTD_MULTITHREAD assert(CCtxParams->nbWorkers == 0); #endif *value = CCtxParams->nbWorkers; break; case ZSTD_p_jobSize : #ifndef ZSTD_MULTITHREAD return ERROR(parameter_unsupported); #else *value = CCtxParams->jobSize; break; #endif case ZSTD_p_overlapSizeLog : #ifndef ZSTD_MULTITHREAD return ERROR(parameter_unsupported); #else *value = CCtxParams->overlapSizeLog; break; #endif case ZSTD_p_enableLongDistanceMatching : *value = CCtxParams->ldmParams.enableLdm; break; case ZSTD_p_ldmHashLog : *value = CCtxParams->ldmParams.hashLog; break; case ZSTD_p_ldmMinMatch : *value = CCtxParams->ldmParams.minMatchLength; break; case ZSTD_p_ldmBucketSizeLog : *value = CCtxParams->ldmParams.bucketSizeLog; break; case ZSTD_p_ldmHashEveryLog : *value = CCtxParams->ldmParams.hashEveryLog; break; default: return ERROR(parameter_unsupported); } return 0; } ",0 "call_reserve(struct rpc_task *task) { dprint_status(task); task->tk_status = 0; task->tk_action = call_reserveresult; xprt_reserve(task); } ",0 "static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr) /* {{{ */ { /* This is how the time string is formatted: snprintf(p, sizeof(p), ""%02d%02d%02d%02d%02d%02dZ"",ts->tm_year%100, ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); */ time_t ret; struct tm thetime; char * strbuf; char * thestr; long gmadjust = 0; size_t timestr_len; if (ASN1_STRING_type(timestr) != V_ASN1_UTCTIME && ASN1_STRING_type(timestr) != V_ASN1_GENERALIZEDTIME) { php_error_docref(NULL, E_WARNING, ""illegal ASN1 data type for timestamp""); return (time_t)-1; } timestr_len = (size_t)ASN1_STRING_length(timestr); if (timestr_len != strlen((const char *)ASN1_STRING_get0_data(timestr))) { php_error_docref(NULL, E_WARNING, ""illegal length in timestamp""); return (time_t)-1; } if (timestr_len < 13 && timestr_len != 11) { php_error_docref(NULL, E_WARNING, ""unable to parse time string %s correctly"", timestr->data); return (time_t)-1; } if (ASN1_STRING_type(timestr) == V_ASN1_GENERALIZEDTIME && timestr_len < 15) { php_error_docref(NULL, E_WARNING, ""unable to parse time string %s correctly"", timestr->data); return (time_t)-1; } strbuf = estrdup((const char *)ASN1_STRING_get0_data(timestr)); memset(&thetime, 0, sizeof(thetime)); /* we work backwards so that we can use atoi more easily */ thestr = strbuf + timestr_len - 3; if (timestr_len == 11) { thetime.tm_sec = 0; } else { thetime.tm_sec = atoi(thestr); *thestr = '\0'; thestr -= 2; } thetime.tm_min = atoi(thestr); *thestr = '\0'; thestr -= 2; thetime.tm_hour = atoi(thestr); *thestr = '\0'; thestr -= 2; thetime.tm_mday = atoi(thestr); *thestr = '\0'; thestr -= 2; thetime.tm_mon = atoi(thestr)-1; *thestr = '\0'; if( ASN1_STRING_type(timestr) == V_ASN1_UTCTIME ) { thestr -= 2; thetime.tm_year = atoi(thestr); if (thetime.tm_year < 68) { thetime.tm_year += 100; } } else if( ASN1_STRING_type(timestr) == V_ASN1_GENERALIZEDTIME ) { thestr -= 4; thetime.tm_year = atoi(thestr) - 1900; } thetime.tm_isdst = -1; ret = mktime(&thetime); #if HAVE_TM_GMTOFF gmadjust = thetime.tm_gmtoff; #else /* ** If correcting for daylight savings time, we set the adjustment to ** the value of timezone - 3600 seconds. Otherwise, we need to overcorrect and ** set the adjustment to the main timezone + 3600 seconds. */ gmadjust = -(thetime.tm_isdst ? (long)timezone - 3600 : (long)timezone); #endif ret += gmadjust; efree(strbuf); return ret; } /* }}} */ ",0 "int sctp_do_sm(struct net *net, sctp_event_t event_type, sctp_subtype_t subtype, sctp_state_t state, struct sctp_endpoint *ep, struct sctp_association *asoc, void *event_arg, gfp_t gfp) { sctp_cmd_seq_t commands; const sctp_sm_table_entry_t *state_fn; sctp_disposition_t status; int error = 0; typedef const char *(printfn_t)(sctp_subtype_t); static printfn_t *table[] = { NULL, sctp_cname, sctp_tname, sctp_oname, sctp_pname, }; printfn_t *debug_fn __attribute__ ((unused)) = table[event_type]; /* Look up the state function, run it, and then process the * side effects. These three steps are the heart of lksctp. */ state_fn = sctp_sm_lookup_event(net, event_type, state, subtype); sctp_init_cmd_seq(&commands); debug_pre_sfn(); status = state_fn->fn(net, ep, asoc, subtype, event_arg, &commands); debug_post_sfn(); error = sctp_side_effects(event_type, subtype, state, ep, asoc, event_arg, status, &commands, gfp); debug_post_sfx(); return error; } ",0 "void Parcel::freeDataNoInit() { if (mOwner) { LOG_ALLOC(""Parcel %p: freeing other owner data"", this); mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie); } else { LOG_ALLOC(""Parcel %p: freeing allocated data"", this); releaseObjects(); if (mData) { LOG_ALLOC(""Parcel %p: freeing with %zu capacity"", this, mDataCapacity); pthread_mutex_lock(&gParcelGlobalAllocSizeLock); gParcelGlobalAllocSize -= mDataCapacity; gParcelGlobalAllocCount--; pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); free(mData); } if (mObjects) free(mObjects); } } ",0 "exsltStrAlignFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlChar *str, *padding, *alignment, *ret; int str_l, padding_l; if ((nargs < 2) || (nargs > 3)) { xmlXPathSetArityError(ctxt); return; } if (nargs == 3) alignment = xmlXPathPopString(ctxt); else alignment = NULL; padding = xmlXPathPopString(ctxt); str = xmlXPathPopString(ctxt); str_l = xmlUTF8Strlen (str); padding_l = xmlUTF8Strlen (padding); if (str_l == padding_l) { xmlXPathReturnString (ctxt, str); xmlFree(padding); xmlFree(alignment); return; } if (str_l > padding_l) { ret = xmlUTF8Strndup (str, padding_l); } else { if (xmlStrEqual(alignment, (const xmlChar *) ""right"")) { ret = xmlUTF8Strndup (padding, padding_l - str_l); ret = xmlStrcat (ret, str); } else if (xmlStrEqual(alignment, (const xmlChar *) ""center"")) { int left = (padding_l - str_l) / 2; int right_start; ret = xmlUTF8Strndup (padding, left); ret = xmlStrcat (ret, str); right_start = xmlUTF8Strsize (padding, left + str_l); ret = xmlStrcat (ret, padding + right_start); } else { int str_s; str_s = xmlStrlen (str); ret = xmlStrdup (str); ret = xmlStrcat (ret, padding + str_s); } } xmlXPathReturnString (ctxt, ret); xmlFree(str); xmlFree(padding); xmlFree(alignment); } ",1 "static void customLongAttributeAttributeSetterCallback(v8::Local, v8::Local jsValue, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMSetter""); V8TestObjectPython::customLongAttributeAttributeSetterCustom(jsValue, info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 " bool SetUpEncryption() { #if defined(OS_MACOSX) Encryptor::UseMockKeychain(true); #endif UserShare* share = sync_manager_.GetUserShare(); int64 nigori_id = GetIdForDataType(syncable::NIGORI); if (nigori_id == kInvalidId) return false; WriteTransaction trans(FROM_HERE, share); Cryptographer* cryptographer = trans.GetCryptographer(); if (!cryptographer) return false; KeyParams params = {""localhost"", ""dummy"", ""foobar""}; cryptographer->AddKey(params); sync_pb::NigoriSpecifics nigori; cryptographer->GetKeys(nigori.mutable_encrypted()); WriteNode node(&trans); EXPECT_TRUE(node.InitByIdLookup(nigori_id)); node.SetNigoriSpecifics(nigori); return cryptographer->is_ready(); } ",0 "void id_link(int id, void *ptr) { g_hash_table_insert(g_ids, id_key(id), ptr); } ",0 "xsmp_get_restart_style_hint (GsmClient *client) { SmProp *prop; GsmClientRestartStyle hint; g_debug (""GsmXSMPClient: getting restart style""); hint = GSM_CLIENT_RESTART_IF_RUNNING; prop = find_property (GSM_XSMP_CLIENT (client), SmRestartStyleHint, NULL); if (!prop || strcmp (prop->type, SmCARD8) != 0) { return GSM_CLIENT_RESTART_IF_RUNNING; } switch (((unsigned char *)prop->vals[0].value)[0]) { case SmRestartIfRunning: hint = GSM_CLIENT_RESTART_IF_RUNNING; break; case SmRestartAnyway: hint = GSM_CLIENT_RESTART_ANYWAY; break; case SmRestartImmediately: hint = GSM_CLIENT_RESTART_IMMEDIATELY; break; case SmRestartNever: hint = GSM_CLIENT_RESTART_NEVER; break; default: break; } return hint; } ",0 "void CustomButton::OnMouseEntered(const ui::MouseEvent& event) { if (state_ != STATE_DISABLED) SetState(STATE_HOVERED); } ",0 "rpcapd_discard(SOCKET sock, uint32 len) { char errbuf[PCAP_ERRBUF_SIZE + 1]; // keeps the error string, prior to be printed if (len != 0) { if (sock_discard(sock, len, errbuf, PCAP_ERRBUF_SIZE) == -1) { rpcapd_log(LOGPRIO_ERROR, ""Read from client failed: %s"", errbuf); return -1; } } return 0; } ",0 "PHP_METHOD(Phar, stopBuffering) { char *error; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters_none() == FAILURE) { return; } if (PHAR_G(readonly) && !phar_obj->archive->is_data) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""Cannot write out phar archive, phar is read-only""); return; } phar_obj->archive->donotflush = 0; phar_flush(phar_obj->archive, 0, 0, 0, &error); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0, ""%s"", error); efree(error); } } ",0 "_archive_filter_bytes(struct archive *_a, int n) { struct archive_read_filter *f = get_filter(_a, n); return f == NULL ? -1 : f->position; } ",0 "ChromeAppCacheService* StoragePartitionImpl::GetAppCacheService() { return appcache_service_.get(); } ",0 "BGD_DECLARE(void) gdImageTiff(gdImagePtr im, FILE *outFile) { gdIOCtx *out = gdNewFileCtx(outFile); if (out == NULL) return; gdImageTiffCtx(im, out); /* what's an fg again? */ out->gd_free(out); } ",0 "void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint client_id) { BufferManager::BufferInfo* info = NULL; GLuint service_id = 0; if (client_id != 0) { info = GetBufferInfo(client_id); if (!info) { glGenBuffersARB(1, &service_id); CreateBufferInfo(client_id, service_id); info = GetBufferInfo(client_id); IdAllocator* id_allocator = group_->GetIdAllocator(id_namespaces::kBuffers); id_allocator->MarkAsUsed(client_id); } } if (info) { if (!buffer_manager()->SetTarget(info, target)) { SetGLError(GL_INVALID_OPERATION, ""glBindBuffer: buffer bound to more than 1 target""); return; } service_id = info->service_id(); } switch (target) { case GL_ARRAY_BUFFER: bound_array_buffer_ = info; break; case GL_ELEMENT_ARRAY_BUFFER: bound_element_array_buffer_ = info; break; default: NOTREACHED(); // Validation should prevent us getting here. break; } glBindBuffer(target, service_id); } ",0 "void Document::pushCurrentScript(Element* newCurrentScript) { DCHECK(isHTMLScriptElement(newCurrentScript) || isSVGScriptElement(newCurrentScript)); m_currentScriptStack.append(newCurrentScript); } ",0 "parse_fs_coord_pixel_center( const char **pcur, uint *fs_coord_pixel_center ) { uint i; for (i = 0; i < Elements(tgsi_fs_coord_pixel_center_names); i++) { const char *cur = *pcur; if (str_match_nocase_whole( &cur, tgsi_fs_coord_pixel_center_names[i])) { *fs_coord_pixel_center = i; *pcur = cur; return TRUE; } } return FALSE; } ",0 "TIFFVStripSize64(TIFF* tif, uint32 nrows) { static const char module[] = ""TIFFVStripSize64""; TIFFDirectory *td = &tif->tif_dir; if (nrows==(uint32)(-1)) nrows=td->td_imagelength; if ((td->td_planarconfig==PLANARCONFIG_CONTIG)&& (td->td_photometric == PHOTOMETRIC_YCBCR)&& (!isUpSampled(tif))) { /* * Packed YCbCr data contain one Cb+Cr for every * HorizontalSampling*VerticalSampling Y values. * Must also roundup width and height when calculating * since images that are not a multiple of the * horizontal/vertical subsampling area include * YCbCr data for the extended image. */ uint16 ycbcrsubsampling[2]; uint16 samplingblock_samples; uint32 samplingblocks_hor; uint32 samplingblocks_ver; uint64 samplingrow_samples; uint64 samplingrow_size; if(td->td_samplesperpixel!=3) { TIFFErrorExt(tif->tif_clientdata,module, ""Invalid td_samplesperpixel value""); return 0; } TIFFGetFieldDefaulted(tif,TIFFTAG_YCBCRSUBSAMPLING,ycbcrsubsampling+0, ycbcrsubsampling+1); if ((ycbcrsubsampling[0] != 1 && ycbcrsubsampling[0] != 2 && ycbcrsubsampling[0] != 4) ||(ycbcrsubsampling[1] != 1 && ycbcrsubsampling[1] != 2 && ycbcrsubsampling[1] != 4)) { TIFFErrorExt(tif->tif_clientdata,module, ""Invalid YCbCr subsampling (%dx%d)"", ycbcrsubsampling[0], ycbcrsubsampling[1] ); return 0; } samplingblock_samples=ycbcrsubsampling[0]*ycbcrsubsampling[1]+2; samplingblocks_hor=TIFFhowmany_32(td->td_imagewidth,ycbcrsubsampling[0]); samplingblocks_ver=TIFFhowmany_32(nrows,ycbcrsubsampling[1]); samplingrow_samples=_TIFFMultiply64(tif,samplingblocks_hor,samplingblock_samples,module); samplingrow_size=TIFFhowmany8_64(_TIFFMultiply64(tif,samplingrow_samples,td->td_bitspersample,module)); return(_TIFFMultiply64(tif,samplingrow_size,samplingblocks_ver,module)); } else return(_TIFFMultiply64(tif,nrows,TIFFScanlineSize64(tif),module)); } ",0 "ImportTIFF_DSDTable ( const TIFF_Manager & tiff, const TIFF_Manager::TagInfo & tagInfo, SXMPMeta * xmp, const char * xmpNS, const char * xmpProp ) { try { // Don't let errors with one stop the others. const XMP_Uns8 * bytePtr = (XMP_Uns8*)tagInfo.dataPtr; const XMP_Uns8 * byteEnd = bytePtr + tagInfo.dataLen; XMP_Uns16 columns = *((XMP_Uns16*)bytePtr); XMP_Uns16 rows = *((XMP_Uns16*)(bytePtr+2)); if ( ! tiff.IsNativeEndian() ) { columns = Flip2 ( columns ); rows = Flip2 ( rows ); } char buffer[20]; snprintf ( buffer, sizeof(buffer), ""%d"", columns ); // AUDIT: Use of sizeof(buffer) is safe. xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, ""Columns"", buffer ); snprintf ( buffer, sizeof(buffer), ""%d"", rows ); // AUDIT: Use of sizeof(buffer) is safe. xmp->SetStructField ( xmpNS, xmpProp, kXMP_NS_EXIF, ""Rows"", buffer ); std::string arrayPath; SXMPUtils::ComposeStructFieldPath ( xmpNS, xmpProp, kXMP_NS_EXIF, ""Settings"", &arrayPath ); bytePtr += 4; // Move to the list of settings. UTF16Unit * utf16Ptr = (UTF16Unit*)bytePtr; UTF16Unit * utf16End = (UTF16Unit*)byteEnd; std::string utf8; while ( utf16Ptr < utf16End ) { size_t nameLen = 0; while ( utf16Ptr[nameLen] != 0 ) ++nameLen; ++nameLen; // ! Include the terminating nul. if ( (utf16Ptr + nameLen) > utf16End ) goto BadExif; try { FromUTF16 ( utf16Ptr, nameLen, &utf8, tiff.IsBigEndian() ); } catch ( ... ) { goto BadExif; // Ignore the tag if there are conversion errors. } xmp->AppendArrayItem ( xmpNS, arrayPath.c_str(), kXMP_PropArrayIsOrdered, utf8.c_str() ); utf16Ptr += nameLen; } return; BadExif: // Ignore the tag if the table is ill-formed. xmp->DeleteProperty ( xmpNS, xmpProp ); return; } catch ( ... ) { } } // ImportTIFF_DSDTable ",0 " bool PrintWebViewHelper::InitPrintSettingsAndPrepareFrame( WebKit::WebFrame* frame, WebKit::WebNode* node, scoped_ptr* prepare) { if (!InitPrintSettings(frame, node, false)) return false; DCHECK(!prepare->get()); prepare->reset(new PrepareFrameAndViewForPrint(print_pages_params_->params, frame, node)); UpdatePrintableSizeInPrintParameters(frame, node, prepare->get(), &print_pages_params_->params); Send(new PrintHostMsg_DidGetDocumentCookie( routing_id(), print_pages_params_->params.document_cookie)); return true; } ",1 "static struct mount *propagation_next(struct mount *m, struct mount *origin) { /* are there any slaves of this mount? */ if (!IS_MNT_NEW(m) && !list_empty(&m->mnt_slave_list)) return first_slave(m); while (1) { struct mount *master = m->mnt_master; if (master == origin->mnt_master) { struct mount *next = next_peer(m); return (next == origin) ? NULL : next; } else if (m->mnt_slave.next != &master->mnt_slave_list) return next_slave(m); /* back at master */ m = master; } } ",0 "void kernel_restart_prepare(char *cmd) { blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd); system_state = SYSTEM_RESTART; usermodehelper_disable(); device_shutdown(); } ",0 "static int parse_arg_object_to_string(zval **arg, char **p, int *pl, int type TSRMLS_DC) /* {{{ */ { if (Z_OBJ_HANDLER_PP(arg, cast_object)) { zval *obj; MAKE_STD_ZVAL(obj); if (Z_OBJ_HANDLER_P(*arg, cast_object)(*arg, obj, type TSRMLS_CC) == SUCCESS) { zval_ptr_dtor(arg); *arg = obj; *pl = Z_STRLEN_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } efree(obj); } /* Standard PHP objects */ if (Z_OBJ_HT_PP(arg) == &std_object_handlers || !Z_OBJ_HANDLER_PP(arg, cast_object)) { SEPARATE_ZVAL_IF_NOT_REF(arg); if (zend_std_cast_object_tostring(*arg, *arg, type TSRMLS_CC) == SUCCESS) { *pl = Z_STRLEN_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } } if (!Z_OBJ_HANDLER_PP(arg, cast_object) && Z_OBJ_HANDLER_PP(arg, get)) { int use_copy; zval *z = Z_OBJ_HANDLER_PP(arg, get)(*arg TSRMLS_CC); Z_ADDREF_P(z); if(Z_TYPE_P(z) != IS_OBJECT) { zval_dtor(*arg); Z_TYPE_P(*arg) = IS_NULL; zend_make_printable_zval(z, *arg, &use_copy); if (!use_copy) { ZVAL_ZVAL(*arg, z, 1, 1); } *pl = Z_STRLEN_PP(arg); *p = Z_STRVAL_PP(arg); return SUCCESS; } zval_ptr_dtor(&z); } return FAILURE; } /* }}} */ ",0 "void RenderView::OnSetInitialFocus(bool reverse) { if (!webview()) return; webview()->setInitialFocus(reverse); } ",0 "void NotifyPluginDirChanged(const FilePath& path, bool error) { if (error) { NOTREACHED(); return; } VLOG(1) << ""Watched path changed: "" << path.value(); webkit::npapi::PluginList::Singleton()->RefreshPlugins(); BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::Bind(&PluginService::PurgePluginListCache, static_cast(NULL), false)); } ",0 "void TabStripModel::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { switch (type) { case content::NOTIFICATION_WEB_CONTENTS_DESTROYED: { int index = GetIndexOfWebContents( content::Source(source).ptr()); if (index != TabStripModel::kNoTab) { DetachTabContentsAt(index); } break; } case chrome::NOTIFICATION_EXTENSION_UNLOADED: { const extensions::Extension* extension = content::Details( details)->extension; for (int i = count() - 1; i >= 0; i--) { WebContents* contents = GetWebContentsAtImpl(i); if (extensions::TabHelper::FromWebContents(contents)-> extension_app() == extension) { InternalCloseTab(contents, i, false); } } break; } default: NOTREACHED(); } } ",0 "OMX_U32 omx_venc::dev_set_message_thread_id(pthread_t tid) { return handle->venc_set_message_thread_id(tid); } ",0 "void SanitizeGeneratedFileName(std::string& filename) { if (!filename.empty()) { TrimString(filename, ""."", &filename); #if defined(OS_WIN) std::string::size_type pos = filename.find_last_not_of("" .""); if (pos == std::string::npos) filename.resize(0); else filename.resize(++pos); #endif ReplaceSubstringsAfterOffset(&filename, 0, ""/"", ""_""); ReplaceSubstringsAfterOffset(&filename, 0, ""\\"", ""_""); } } ",0 "static inline unsigned int flags2pevents(int flags) { unsigned int pevents = 0; if(flags & SOCK_THREAD_FD_WR) pevents |= POLLOUT; if(flags & SOCK_THREAD_FD_RD) pevents |= POLLIN; pevents |= POLL_EXCEPTION_EVENTS; return pevents; } ",0 "WebMediaPlayer* RenderViewImpl::createMediaPlayer( WebFrame* frame, WebMediaPlayerClient* client) { FOR_EACH_OBSERVER( RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); media::MessageLoopFactory* message_loop_factory = new media::MessageLoopFactory(); media::FilterCollection* collection = new media::FilterCollection(); RenderMediaLog* render_media_log = new RenderMediaLog(); RenderAudioSourceProvider* audio_source_provider = NULL; const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); if (!cmd_line->HasSwitch(switches::kDisableAudio)) { audio_source_provider = new RenderAudioSourceProvider(); AudioRendererImpl* audio_renderer = new AudioRendererImpl(audio_source_provider); collection->AddAudioRenderer(audio_renderer); } #if defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) WebGraphicsContext3DCommandBufferImpl* context3d = static_cast( webview()->graphicsContext3D()); if (context_is_web_graphics_context_3d_command_buffer_impl_ && context3d) { MessageLoop* factories_loop = RenderThreadImpl::current()->compositor_thread() ? RenderThreadImpl::current()->compositor_thread()->GetWebThread() ->message_loop() : MessageLoop::current(); GpuChannelHost* gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync( content::CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); collection->AddVideoDecoder(new media::GpuVideoDecoder( message_loop_factory->GetMessageLoop(""GpuVideoDecoder""), factories_loop, new RendererGpuVideoDecoderFactories( gpu_channel_host, factories_loop, context3d))); } #endif webkit_media::WebMediaPlayerImpl* media_player = content::GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( this, frame, client, AsWeakPtr(), collection, audio_source_provider, message_loop_factory, media_stream_impl_.get(), render_media_log); #if defined(OS_ANDROID) #else if (!media_player) { media_player = new webkit_media::WebMediaPlayerImpl( frame, client, AsWeakPtr(), collection, audio_source_provider, message_loop_factory, media_stream_impl_.get(), render_media_log); } #endif return media_player; } ",0 "static void pmcraid_frame_auto_sense(struct pmcraid_cmd *cmd) { u8 *sense_buf = cmd->scsi_cmd->sense_buffer; struct pmcraid_resource_entry *res = cmd->scsi_cmd->device->hostdata; struct pmcraid_ioasa *ioasa = &cmd->ioa_cb->ioasa; u32 ioasc = le32_to_cpu(ioasa->ioasc); u32 failing_lba = 0; memset(sense_buf, 0, SCSI_SENSE_BUFFERSIZE); cmd->scsi_cmd->result = SAM_STAT_CHECK_CONDITION; if (RES_IS_VSET(res->cfg_entry) && ioasc == PMCRAID_IOASC_ME_READ_ERROR_NO_REALLOC && ioasa->u.vset.failing_lba_hi != 0) { sense_buf[0] = 0x72; sense_buf[1] = PMCRAID_IOASC_SENSE_KEY(ioasc); sense_buf[2] = PMCRAID_IOASC_SENSE_CODE(ioasc); sense_buf[3] = PMCRAID_IOASC_SENSE_QUAL(ioasc); sense_buf[7] = 12; sense_buf[8] = 0; sense_buf[9] = 0x0A; sense_buf[10] = 0x80; failing_lba = le32_to_cpu(ioasa->u.vset.failing_lba_hi); sense_buf[12] = (failing_lba & 0xff000000) >> 24; sense_buf[13] = (failing_lba & 0x00ff0000) >> 16; sense_buf[14] = (failing_lba & 0x0000ff00) >> 8; sense_buf[15] = failing_lba & 0x000000ff; failing_lba = le32_to_cpu(ioasa->u.vset.failing_lba_lo); sense_buf[16] = (failing_lba & 0xff000000) >> 24; sense_buf[17] = (failing_lba & 0x00ff0000) >> 16; sense_buf[18] = (failing_lba & 0x0000ff00) >> 8; sense_buf[19] = failing_lba & 0x000000ff; } else { sense_buf[0] = 0x70; sense_buf[2] = PMCRAID_IOASC_SENSE_KEY(ioasc); sense_buf[12] = PMCRAID_IOASC_SENSE_CODE(ioasc); sense_buf[13] = PMCRAID_IOASC_SENSE_QUAL(ioasc); if (ioasc == PMCRAID_IOASC_ME_READ_ERROR_NO_REALLOC) { if (RES_IS_VSET(res->cfg_entry)) failing_lba = le32_to_cpu(ioasa->u. vset.failing_lba_lo); sense_buf[0] |= 0x80; sense_buf[3] = (failing_lba >> 24) & 0xff; sense_buf[4] = (failing_lba >> 16) & 0xff; sense_buf[5] = (failing_lba >> 8) & 0xff; sense_buf[6] = failing_lba & 0xff; } sense_buf[7] = 6; /* additional length */ } } ",0 "static void peer_abort_upcall(struct iwch_ep *ep) { struct iw_cm_event event; PDBG(""%s ep %p\n"", __func__, ep); memset(&event, 0, sizeof(event)); event.event = IW_CM_EVENT_CLOSE; event.status = -ECONNRESET; if (ep->com.cm_id) { PDBG(""abort delivered ep %p cm_id %p tid %d\n"", ep, ep->com.cm_id, ep->hwtid); ep->com.cm_id->event_handler(ep->com.cm_id, &event); ep->com.cm_id->rem_ref(ep->com.cm_id); ep->com.cm_id = NULL; ep->com.qp = NULL; } } ",0 "QMimeData *IRCView::createMimeDataFromSelection() const { const QTextDocumentFragment fragment(textCursor()); return new IrcViewMimeData(fragment); } ",0 "void HTMLFormElement::setDemoted(bool demoted) { if (demoted) UseCounter::count(document(), UseCounter::DemotedFormElement); m_wasDemoted = demoted; } ",0 "static void motor_off_callback(unsigned long nr) { unsigned char mask = ~(0x10 << UNIT(nr)); set_dor(FDC(nr), mask, 0); } ",0 "static int handle_vmread(struct kvm_vcpu *vcpu) { unsigned long field; u64 field_value; unsigned long exit_qualification = vmcs_readl(EXIT_QUALIFICATION); u32 vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); gva_t gva = 0; if (!nested_vmx_check_permission(vcpu) || !nested_vmx_check_vmcs12(vcpu)) return 1; /* Decode instruction info and find the field to read */ field = kvm_register_read(vcpu, (((vmx_instruction_info) >> 28) & 0xf)); /* Read the field, zero-extended to a u64 field_value */ if (!vmcs12_read_any(vcpu, field, &field_value)) { nested_vmx_failValid(vcpu, VMXERR_UNSUPPORTED_VMCS_COMPONENT); skip_emulated_instruction(vcpu); return 1; } /* * Now copy part of this value to register or memory, as requested. * Note that the number of bits actually copied is 32 or 64 depending * on the guest's mode (32 or 64 bit), not on the given field's length. */ if (vmx_instruction_info & (1u << 10)) { kvm_register_write(vcpu, (((vmx_instruction_info) >> 3) & 0xf), field_value); } else { if (get_vmx_mem_address(vcpu, exit_qualification, vmx_instruction_info, &gva)) return 1; /* _system ok, as nested_vmx_check_permission verified cpl=0 */ kvm_write_guest_virt_system(&vcpu->arch.emulate_ctxt, gva, &field_value, (is_long_mode(vcpu) ? 8 : 4), NULL); } nested_vmx_succeed(vcpu); skip_emulated_instruction(vcpu); return 1; } ",0 "void GLES2DecoderImpl::DoBindBuffer(GLenum target, GLuint client_id) { BufferManager::BufferInfo* info = NULL; GLuint service_id = 0; if (client_id != 0) { info = GetBufferInfo(client_id); if (!info) { if (!group_->bind_generates_resource()) { LOG(ERROR) << ""glBindBuffer: id not generated by glGenBuffers""; current_decoder_error_ = error::kGenericError; return; } glGenBuffersARB(1, &service_id); CreateBufferInfo(client_id, service_id); info = GetBufferInfo(client_id); IdAllocatorInterface* id_allocator = group_->GetIdAllocator(id_namespaces::kBuffers); id_allocator->MarkAsUsed(client_id); } } if (info) { if (!buffer_manager()->SetTarget(info, target)) { SetGLError(GL_INVALID_OPERATION, ""glBindBuffer"", ""buffer bound to more than 1 target""); return; } service_id = info->service_id(); } switch (target) { case GL_ARRAY_BUFFER: bound_array_buffer_ = info; break; case GL_ELEMENT_ARRAY_BUFFER: bound_element_array_buffer_ = info; break; default: NOTREACHED(); // Validation should prevent us getting here. break; } glBindBuffer(target, service_id); } ",0 " explicit NavigationHandleWatcher(WebContents* web_contents) : WebContentsObserver(web_contents) {} ",0 "acc_ctx_new(OM_uint32 *minor_status, gss_buffer_t buf, gss_ctx_id_t *ctx, spnego_gss_cred_id_t spcred, gss_buffer_t *mechToken, gss_buffer_t *mechListMIC, OM_uint32 *negState, send_token_flag *return_token) { OM_uint32 tmpmin, ret, req_flags; gss_OID_set supported_mechSet, mechTypes; gss_buffer_desc der_mechTypes; gss_OID mech_wanted; spnego_gss_ctx_id_t sc = NULL; ret = GSS_S_DEFECTIVE_TOKEN; der_mechTypes.length = 0; der_mechTypes.value = NULL; *mechToken = *mechListMIC = GSS_C_NO_BUFFER; supported_mechSet = mechTypes = GSS_C_NO_OID_SET; *return_token = ERROR_TOKEN_SEND; *negState = REJECT; *minor_status = 0; ret = get_negTokenInit(minor_status, buf, &der_mechTypes, &mechTypes, &req_flags, mechToken, mechListMIC); if (ret != GSS_S_COMPLETE) { goto cleanup; } ret = get_negotiable_mechs(minor_status, spcred, GSS_C_ACCEPT, &supported_mechSet); if (ret != GSS_S_COMPLETE) { *return_token = NO_TOKEN_SEND; goto cleanup; } /* * Select the best match between the list of mechs * that the initiator requested and the list that * the acceptor will support. */ mech_wanted = negotiate_mech(supported_mechSet, mechTypes, negState); if (*negState == REJECT) { ret = GSS_S_BAD_MECH; goto cleanup; } sc = (spnego_gss_ctx_id_t)*ctx; if (sc != NULL) { gss_release_buffer(&tmpmin, &sc->DER_mechTypes); assert(mech_wanted != GSS_C_NO_OID); } else sc = create_spnego_ctx(); if (sc == NULL) { ret = GSS_S_FAILURE; *return_token = NO_TOKEN_SEND; goto cleanup; } sc->mech_set = mechTypes; mechTypes = GSS_C_NO_OID_SET; sc->internal_mech = mech_wanted; sc->DER_mechTypes = der_mechTypes; der_mechTypes.length = 0; der_mechTypes.value = NULL; if (*negState == REQUEST_MIC) sc->mic_reqd = 1; *return_token = INIT_TOKEN_SEND; sc->firstpass = 1; *ctx = (gss_ctx_id_t)sc; ret = GSS_S_COMPLETE; cleanup: gss_release_oid_set(&tmpmin, &mechTypes); gss_release_oid_set(&tmpmin, &supported_mechSet); if (der_mechTypes.length != 0) gss_release_buffer(&tmpmin, &der_mechTypes); return ret; } ",1 "SystemTray* Shell::GetPrimarySystemTray() { return GetPrimaryRootWindowController()->GetSystemTray(); } ",0 "static enum audit_state audit_filter_task(struct task_struct *tsk, char **key) { struct audit_entry *e; enum audit_state state; rcu_read_lock(); list_for_each_entry_rcu(e, &audit_filter_list[AUDIT_FILTER_TASK], list) { if (audit_filter_rules(tsk, &e->rule, NULL, NULL, &state, true)) { if (state == AUDIT_RECORD_CONTEXT) *key = kstrdup(e->rule.filterkey, GFP_ATOMIC); rcu_read_unlock(); return state; } } rcu_read_unlock(); return AUDIT_BUILD_CONTEXT; } ",0 "static Bool FFD_CanHandleURLInService(GF_InputService *plug, const char *url) { char szURL[2048], *sep; FFDemux *ffd; const char *this_url; if (!plug || !url) return GF_FALSE; ffd = (FFDemux *)plug->priv; this_url = gf_service_get_url(ffd->service); if (!this_url) return GF_FALSE; strcpy(szURL, this_url); sep = strrchr(szURL, '#'); if (sep) sep[0] = 0; if ((url[0] != '#') && strnicmp(szURL, url, sizeof(char)*strlen(szURL))) return GF_FALSE; sep = strrchr(url, '#'); if (sep && !stricmp(sep, ""#video"") && (ffd->video_st>=0)) return GF_TRUE; if (sep && !stricmp(sep, ""#audio"") && (ffd->audio_st>=0)) return GF_TRUE; return GF_FALSE; } ",0 "hstore_contained(PG_FUNCTION_ARGS) { PG_RETURN_DATUM(DirectFunctionCall2(hstore_contains, PG_GETARG_DATUM(1), PG_GETARG_DATUM(0) )); } ",0 "void Range::selectNodeContents(Node* refNode, ExceptionCode& ec) { if (!m_start.container()) { ec = INVALID_STATE_ERR; return; } if (!refNode) { ec = NOT_FOUND_ERR; return; } for (Node* n = refNode; n; n = n->parentNode()) { switch (n->nodeType()) { case Node::ATTRIBUTE_NODE: case Node::CDATA_SECTION_NODE: case Node::COMMENT_NODE: case Node::DOCUMENT_FRAGMENT_NODE: case Node::DOCUMENT_NODE: case Node::ELEMENT_NODE: case Node::ENTITY_REFERENCE_NODE: case Node::PROCESSING_INSTRUCTION_NODE: case Node::TEXT_NODE: case Node::XPATH_NAMESPACE_NODE: break; case Node::DOCUMENT_TYPE_NODE: case Node::ENTITY_NODE: case Node::NOTATION_NODE: ec = RangeException::INVALID_NODE_TYPE_ERR; return; } } if (m_ownerDocument != refNode->document()) setDocument(refNode->document()); m_start.setToStartOfNode(refNode); m_end.setToEndOfNode(refNode); } ",0 "void dump_camera_metadata(const camera_metadata_t *metadata, int fd, int verbosity) { dump_indented_camera_metadata(metadata, fd, verbosity, 0); } ",0 "LocalFrameClientImpl* LocalFrameClientImpl::Create(WebLocalFrameImpl* frame) { return new LocalFrameClientImpl(frame); } ",0 "bool ShouldTabShowCloseButton(int capacity, bool is_pinned_tab, bool is_active_tab) { if (is_pinned_tab) return false; else if (is_active_tab) return true; else return capacity >= 3; } ",0 "static void opj_pi_update_encode_not_poc ( opj_cp_t *p_cp, OPJ_UINT32 p_num_comps, OPJ_UINT32 p_tileno, OPJ_INT32 p_tx0, OPJ_INT32 p_tx1, OPJ_INT32 p_ty0, OPJ_INT32 p_ty1, OPJ_UINT32 p_max_prec, OPJ_UINT32 p_max_res, OPJ_UINT32 p_dx_min, OPJ_UINT32 p_dy_min) { /* loop*/ OPJ_UINT32 pino; /* tile coding parameter*/ opj_tcp_t *l_tcp = 00; /* current poc being updated*/ opj_poc_t * l_current_poc = 00; /* number of pocs*/ OPJ_UINT32 l_poc_bound; /* preconditions in debug*/ assert(p_cp != 00); assert(p_tileno < p_cp->tw * p_cp->th); /* initializations*/ l_tcp = &p_cp->tcps [p_tileno]; /* number of iterations in the loop */ l_poc_bound = l_tcp->numpocs+1; /* start at first element, and to make sure the compiler will not make a calculation each time in the loop store a pointer to the current element to modify rather than l_tcp->pocs[i]*/ l_current_poc = l_tcp->pocs; for (pino = 0; pino < l_poc_bound ; ++pino) { l_current_poc->compS = 0; l_current_poc->compE = p_num_comps;/*p_image->numcomps;*/ l_current_poc->resS = 0; l_current_poc->resE = p_max_res; l_current_poc->layS = 0; l_current_poc->layE = l_tcp->numlayers; l_current_poc->prg = l_tcp->prg; l_current_poc->prcS = 0; l_current_poc->prcE = p_max_prec; l_current_poc->txS = (OPJ_UINT32)p_tx0; l_current_poc->txE = (OPJ_UINT32)p_tx1; l_current_poc->tyS = (OPJ_UINT32)p_ty0; l_current_poc->tyE = (OPJ_UINT32)p_ty1; l_current_poc->dx = p_dx_min; l_current_poc->dy = p_dy_min; ++ l_current_poc; } } ",0 "void RenderWidgetHostViewAndroid::SetTooltipText( const string16& tooltip_text) { } ",0 "static void print_ip_ins(const char *fmt, unsigned char *p) { int i; printk(KERN_CONT ""%s"", fmt); for (i = 0; i < MCOUNT_INSN_SIZE; i++) printk(KERN_CONT ""%s%02x"", i ? "":"" : """", p[i]); } ",0 "void PasswordAutofillAgent::SetAutofillAgent(AutofillAgent* autofill_agent) { AutofillAgent* agent = autofill_agent_.get(); if (agent) agent->RemoveFormObserver(this); autofill_agent_ = autofill_agent->GetWeakPtr(); autofill_agent->AddFormObserver(this); } ",0 "_krb5_pk_mk_padata(krb5_context context, void *c, int ic_flags, int win2k, const KDC_REQ_BODY *req_body, unsigned nonce, METHOD_DATA *md) { krb5_pk_init_ctx ctx = c; int win2k_compat; if (ctx->id->certs == NULL && ctx->anonymous == 0) { krb5_set_error_message(context, HEIM_PKINIT_NO_PRIVATE_KEY, N_(""PKINIT: No user certificate given"", """")); return HEIM_PKINIT_NO_PRIVATE_KEY; } win2k_compat = krb5_config_get_bool_default(context, NULL, win2k, ""realms"", req_body->realm, ""pkinit_win2k"", NULL); if (win2k_compat) { ctx->require_binding = krb5_config_get_bool_default(context, NULL, TRUE, ""realms"", req_body->realm, ""pkinit_win2k_require_binding"", NULL); ctx->type = PKINIT_WIN2K; } else ctx->type = PKINIT_27; ctx->require_eku = krb5_config_get_bool_default(context, NULL, TRUE, ""realms"", req_body->realm, ""pkinit_require_eku"", NULL); if (ic_flags & KRB5_INIT_CREDS_NO_C_NO_EKU_CHECK) ctx->require_eku = 0; if (ctx->id->flags & PKINIT_BTMM) ctx->require_eku = 0; ctx->require_krbtgt_otherName = krb5_config_get_bool_default(context, NULL, TRUE, ""realms"", req_body->realm, ""pkinit_require_krbtgt_otherName"", NULL); ctx->require_hostname_match = krb5_config_get_bool_default(context, NULL, FALSE, ""realms"", req_body->realm, ""pkinit_require_hostname_match"", NULL); ctx->trustedCertifiers = krb5_config_get_bool_default(context, NULL, TRUE, ""realms"", req_body->realm, ""pkinit_trustedCertifiers"", NULL); return pk_mk_padata(context, ctx, req_body, nonce, md); } ",0 "bool ChromeClientImpl::OpenJavaScriptAlertDelegate(LocalFrame* frame, const String& message) { NotifyPopupOpeningObservers(); WebLocalFrameImpl* webframe = WebLocalFrameImpl::FromFrame(frame); if (webframe->Client()) { if (WebUserGestureIndicator::IsProcessingUserGesture()) WebUserGestureIndicator::DisableTimeout(); webframe->Client()->RunModalAlertDialog(message); return true; } return false; } ",0 "qboolean FS_ConditionalRestart(int checksumFeed, qboolean disconnect) { if(fs_gamedirvar->modified) { if(FS_FilenameCompare(lastValidGame, fs_gamedirvar->string) && (*lastValidGame || FS_FilenameCompare(fs_gamedirvar->string, com_basegame->string)) && (*fs_gamedirvar->string || FS_FilenameCompare(lastValidGame, com_basegame->string))) { Com_GameRestart(checksumFeed, disconnect); return qtrue; } else fs_gamedirvar->modified = qfalse; } if(checksumFeed != fs_checksumFeed) FS_Restart(checksumFeed); else if(fs_numServerPaks && !fs_reordered) FS_ReorderPurePaks(); return qfalse; } ",0 "GF_Err trak_Size(GF_Box *s) { GF_Err e; GF_TrackBox *ptr = (GF_TrackBox *)s; if (ptr->Header) { e = gf_isom_box_size((GF_Box *) ptr->Header); if (e) return e; ptr->size += ptr->Header->size; } if (ptr->udta) { e = gf_isom_box_size((GF_Box *) ptr->udta); if (e) return e; ptr->size += ptr->udta->size; } if (ptr->References) { e = gf_isom_box_size((GF_Box *) ptr->References); if (e) return e; ptr->size += ptr->References->size; } if (ptr->editBox) { e = gf_isom_box_size((GF_Box *) ptr->editBox); if (e) return e; ptr->size += ptr->editBox->size; } if (ptr->Media) { e = gf_isom_box_size((GF_Box *) ptr->Media); if (e) return e; ptr->size += ptr->Media->size; } if (ptr->meta) { e = gf_isom_box_size((GF_Box *) ptr->meta); if (e) return e; ptr->size += ptr->meta->size; } if (ptr->groups) { e = gf_isom_box_size((GF_Box *) ptr->groups); if (e) return e; ptr->size += ptr->groups->size; } return GF_OK; } ",0 "static inline Image *GetImageCache(const ImageInfo *image_info,const char *path, ExceptionInfo *exception) { char key[MaxTextExtent]; ExceptionInfo *sans_exception; Image *image; ImageInfo *read_info; /* Read an image into a image cache if not already present. Return the image that is in the cache under that filename. */ (void) FormatLocaleString(key,MaxTextExtent,""cache:%s"",path); sans_exception=AcquireExceptionInfo(); image=(Image *) GetImageRegistry(ImageRegistryType,key,sans_exception); sans_exception=DestroyExceptionInfo(sans_exception); if (image != (Image *) NULL) return(image); read_info=CloneImageInfo(image_info); (void) CopyMagickString(read_info->filename,path,MaxTextExtent); image=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); if (image != (Image *) NULL) (void) SetImageRegistry(ImageRegistryType,key,image,exception); return(image); } ",0 "static int _nfs4_proc_link(struct inode *inode, struct inode *dir, struct qstr *name) { struct nfs_server *server = NFS_SERVER(inode); struct nfs4_link_arg arg = { .fh = NFS_FH(inode), .dir_fh = NFS_FH(dir), .name = name, .bitmask = server->attr_bitmask, }; struct nfs4_link_res res = { .server = server, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LINK], .rpc_argp = &arg, .rpc_resp = &res, }; int status = -ENOMEM; res.fattr = nfs_alloc_fattr(); if (res.fattr == NULL) goto out; status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); if (!status) { update_changeattr(dir, &res.cinfo); nfs_post_op_update_inode(inode, res.fattr); } out: nfs_free_fattr(res.fattr); return status; } ",0 "LayerTreeHostImpl::FrameData::~FrameData() {} ",0 " virtual ~NonGarbageCollectedContainerRoot() {} ",0 "ofputil_append_ipfix_stat(struct ovs_list *replies, const struct ofputil_ipfix_stats *ois) { struct nx_ipfix_stats_reply *reply = ofpmp_append(replies, sizeof *reply); ofputil_ipfix_stats_to_reply(ois, reply); } ",0 "void WebContentsImpl::UpdateState(RenderViewHost* rvh, int32 page_id, const PageState& page_state) { DCHECK(rvh == GetRenderViewHost() || render_manager_.IsOnSwappedOutList(rvh)); int entry_index = controller_.GetEntryIndexWithPageID( rvh->GetSiteInstance(), page_id); if (entry_index < 0) return; NavigationEntry* entry = controller_.GetEntryAtIndex(entry_index); if (page_state == entry->GetPageState()) return; // Nothing to update. entry->SetPageState(page_state); controller_.NotifyEntryChanged(entry, entry_index); } ",0 "xmlXPtrGetEndPoint(xmlXPathObjectPtr obj, xmlNodePtr *node, int *indx) { if ((obj == NULL) || (node == NULL) || (indx == NULL)) return(-1); switch (obj->type) { case XPATH_POINT: *node = obj->user; if (obj->index <= 0) *indx = 0; else *indx = obj->index; return(0); case XPATH_RANGE: *node = obj->user; if (obj->index <= 0) *indx = 0; else *indx = obj->index; return(0); default: break; } return(-1); } ",0 "bool ExecuteScriptWithUserGestureControl(RenderFrameHost* frame, const std::string& script, bool user_gesture) { std::string expected_response = ""ExecuteScript-"" + base::GenerateGUID(); std::string new_script = base::StringPrintf( R""( %s; // Original script. window.domAutomationController.send('%s'); )"", script.c_str(), expected_response.c_str()); std::unique_ptr value; if (!ExecuteScriptHelper(frame, new_script, user_gesture, &value) || !value.get()) { return false; } DCHECK_EQ(base::Value::Type::STRING, value->type()); std::string actual_response; if (value->GetAsString(&actual_response)) DCHECK_EQ(expected_response, actual_response); return true; } ",0 "const char * CLASS foveon_camf_param (const char *block, const char *param) { unsigned idx, num; char *pos, *cp, *dp; for (idx=0; idx < meta_length; idx += sget4(pos+8)) { pos = meta_data + idx; if (strncmp (pos, ""CMb"", 3)) break; if (pos[3] != 'P') continue; if (strcmp (block, pos+sget4(pos+12))) continue; cp = pos + sget4(pos+16); num = sget4(cp); dp = pos + sget4(cp+4); while (num--) { cp += 8; if (!strcmp (param, dp+sget4(cp))) return dp+sget4(cp+4); } } return 0; } ",0 " virtual void TearDown() { semaphore_free(done); AllocationTestHarness::TearDown(); } ",0 "static int ehci_state_advqueue(EHCIQueue *q) { #if 0 /* TO-DO: 4.10.2 - paragraph 2 * if I-bit is set to 1 and QH is not active * go to horizontal QH */ if (I-bit set) { ehci_set_state(ehci, async, EST_HORIZONTALQH); goto out; } #endif /* * want data and alt-next qTD is valid */ if (((q->qh.token & QTD_TOKEN_TBYTES_MASK) != 0) && (NLPTR_TBIT(q->qh.altnext_qtd) == 0)) { q->qtdaddr = q->qh.altnext_qtd; ehci_set_state(q->ehci, q->async, EST_FETCHQTD); /* * next qTD is valid */ } else if (NLPTR_TBIT(q->qh.next_qtd) == 0) { q->qtdaddr = q->qh.next_qtd; ehci_set_state(q->ehci, q->async, EST_FETCHQTD); /* * no valid qTD, try next QH */ } else { ehci_set_state(q->ehci, q->async, EST_HORIZONTALQH); } return 1; } ",0 "inline void FrameView::forceLayoutParentViewIfNeeded() { RenderPart* ownerRenderer = m_frame->ownerRenderer(); if (!ownerRenderer || !ownerRenderer->frame()) return; RenderBox* contentBox = embeddedContentBox(); if (!contentBox) return; RenderSVGRoot* svgRoot = toRenderSVGRoot(contentBox); if (svgRoot->everHadLayout() && !svgRoot->needsLayout()) return; RefPtr frameView = ownerRenderer->frame()->view(); ownerRenderer->setNeedsLayoutAndPrefWidthsRecalcAndFullPaintInvalidation(); ASSERT(frameView); frameView->layout(); } ",0 "void AppLauncherHandler::OnLearnMore(const base::ListValue* args) { RecordAppLauncherPromoHistogram(apps::APP_LAUNCHER_PROMO_LEARN_MORE); } ",0 " Finalize_Profile_Table( RAS_ARG ) { UShort n; PProfile p; n = ras.num_Profs; p = ras.fProfile; if ( n > 1 && p ) { while ( n > 0 ) { Int bottom, top; if ( n > 1 ) p->link = (PProfile)( p->offset + p->height ); else p->link = NULL; if ( p->flags & Flow_Up ) { bottom = (Int)p->start; top = (Int)( p->start + p->height - 1 ); } else { bottom = (Int)( p->start - p->height + 1 ); top = (Int)p->start; p->start = bottom; p->offset += p->height - 1; } if ( Insert_Y_Turn( RAS_VARS bottom ) || Insert_Y_Turn( RAS_VARS top + 1 ) ) return FAILURE; p = p->link; n--; } } else ras.fProfile = NULL; return SUCCESS; } ",0 "static const PixelPacket *GetVirtualPixelsCache(const Image *image) { CacheInfo *magick_restrict cache_info; const int id = GetOpenMPThreadId(); assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickSignature); assert(id < (int) cache_info->number_threads); return(GetVirtualPixelsNexus(image->cache,cache_info->nexus_info[id])); } ",0 "bool WebDriverCommand::Init(Response* const response) { std::string session_id = GetPathVariable(2); if (session_id.length() == 0) { response->SetError( new Error(kBadRequest, ""No session ID specified"")); return false; } VLOG(1) << ""Fetching session: "" << session_id; session_ = SessionManager::GetInstance()->GetSession(session_id); if (session_ == NULL) { response->SetError( new Error(kSessionNotFound, ""Session not found: "" + session_id)); return false; } scoped_ptr error(session_->WaitForAllTabsToStopLoading()); if (error.get()) { LOG(WARNING) << error->ToString(); } error.reset(session_->SwitchToTopFrameIfCurrentFrameInvalid()); if (error.get()) { LOG(WARNING) << error->ToString(); } response->SetField(""sessionId"", Value::CreateStringValue(session_id)); return true; } ",1 "aspath_aggregate_mpath (struct aspath *as1, struct aspath *as2) { int i; int minlen; int match; int from1,from2; struct assegment *seg1 = as1->segments; struct assegment *seg2 = as2->segments; struct aspath *aspath = NULL; struct assegment *asset; struct assegment *prevseg = NULL; match = 0; minlen = 0; aspath = NULL; asset = NULL; /* First of all check common leading sequence. */ while (seg1 && seg2) { /* Check segment type. */ if (seg1->type != seg2->type) break; /* Minimum segment length. */ minlen = min (seg1->length, seg2->length); for (match = 0; match < minlen; match++) if (seg1->as[match] != seg2->as[match]) break; if (match) { struct assegment *seg = assegment_new (seg1->type, 0); seg = assegment_append_asns (seg, seg1->as, match); if (! aspath) { aspath = aspath_new (); aspath->segments = seg; } else prevseg->next = seg; prevseg = seg; } if (match != minlen || match != seg1->length || seg1->length != seg2->length) break; seg1 = seg1->next; seg2 = seg2->next; } if (! aspath) aspath = aspath_new(); /* Make as-set using rest of all information. */ from1 = from2 = match; while (seg1 || seg2) { if (seg1) { if (seg1->type == AS_SEQUENCE) { asset = aspath_aggregate_as_set_add (aspath, asset, seg1->as[from1]); from1++; if (from1 >= seg1->length) { from1 = 0; seg1 = seg1->next; } } else { for (i = from1; i < seg1->length; i++) asset = aspath_aggregate_as_set_add (aspath, asset, seg1->as[i]); from1 = 0; seg1 = seg1->next; } } if (seg2) { if (seg2->type == AS_SEQUENCE) { asset = aspath_aggregate_as_set_add (aspath, asset, seg2->as[from2]); from2++; if (from2 >= seg2->length) { from2 = 0; seg2 = seg2->next; } } else { for (i = from2; i < seg2->length; i++) asset = aspath_aggregate_as_set_add (aspath, asset, seg2->as[i]); from2 = 0; seg2 = seg2->next; } } if (asset->length == 1) asset->type = AS_SEQUENCE; asset = NULL; } assegment_normalise (aspath->segments); aspath_str_update (aspath); return aspath; } ",0 "ScriptPromise BaseAudioContext::decodeAudioData( ScriptState* script_state, DOMArrayBuffer* audio_data, V8DecodeSuccessCallback* success_callback, ExceptionState& exception_state) { return decodeAudioData(script_state, audio_data, success_callback, nullptr, exception_state); } ",0 "bool RenderWidgetHostViewAura::GetCompositionCharacterBounds( uint32_t index, gfx::Rect* rect) const { DCHECK(rect); if (!text_input_manager_ || !text_input_manager_->GetActiveWidget()) return false; const TextInputManager::CompositionRangeInfo* composition_range_info = text_input_manager_->GetCompositionRangeInfo(); if (index >= composition_range_info->character_bounds.size()) return false; *rect = ConvertRectToScreen(composition_range_info->character_bounds[index]); return true; } ",0 "void RenderFrameImpl::JavaScriptIsolatedWorldRequest::Completed( const blink::WebVector>& result) { if (!render_frame_impl_) { delete this; return; } base::Value value; if (!result.empty()) { v8::Local context = render_frame_impl_.get()->frame_->MainWorldScriptContext(); v8::Context::Scope context_scope(context); V8ValueConverterImpl converter; converter.SetDateAllowed(true); converter.SetRegExpAllowed(true); std::unique_ptr new_value = converter.FromV8Value(*result.begin(), context); if (new_value) value = base::Value::FromUniquePtrValue(std::move(new_value)); } std::move(callback_).Run(std::move(value)); delete this; } ",0 "static bool ExecuteInsertOrderedList(LocalFrame& frame, Event*, EditorCommandSource, const String&) { DCHECK(frame.GetDocument()); return InsertListCommand::Create(*frame.GetDocument(), InsertListCommand::kOrderedList) ->Apply(); } ",0 "static int hci_sock_blacklist_add(struct hci_dev *hdev, void __user *arg) { bdaddr_t bdaddr; int err; if (copy_from_user(&bdaddr, arg, sizeof(bdaddr))) return -EFAULT; hci_dev_lock(hdev); err = hci_blacklist_add(hdev, &bdaddr, 0); hci_dev_unlock(hdev); return err; } ",0 " error::Error GLES2DecoderPassthroughImpl::DoLinkProgram(GLuint program) { TRACE_EVENT0(""gpu"", ""GLES2DecoderPassthroughImpl::DoLinkProgram""); SCOPED_UMA_HISTOGRAM_TIMER(""GPU.PassthroughDoLinkProgramTime""); api()->glLinkProgramFn(GetProgramServiceID(program, resources_)); ExitCommandProcessingEarly(); return error::kNoError; } ",1 "int cipso_v4_validate(const struct sk_buff *skb, unsigned char **option) { unsigned char *opt = *option; unsigned char *tag; unsigned char opt_iter; unsigned char err_offset = 0; u8 opt_len; u8 tag_len; struct cipso_v4_doi *doi_def = NULL; u32 tag_iter; /* caller already checks for length values that are too large */ opt_len = opt[1]; if (opt_len < 8) { err_offset = 1; goto validate_return; } rcu_read_lock(); doi_def = cipso_v4_doi_search(get_unaligned_be32(&opt[2])); if (doi_def == NULL) { err_offset = 2; goto validate_return_locked; } opt_iter = CIPSO_V4_HDR_LEN; tag = opt + opt_iter; while (opt_iter < opt_len) { for (tag_iter = 0; doi_def->tags[tag_iter] != tag[0];) if (doi_def->tags[tag_iter] == CIPSO_V4_TAG_INVALID || ++tag_iter == CIPSO_V4_TAG_MAXCNT) { err_offset = opt_iter; goto validate_return_locked; } tag_len = tag[1]; if (tag_len > (opt_len - opt_iter)) { err_offset = opt_iter + 1; goto validate_return_locked; } switch (tag[0]) { case CIPSO_V4_TAG_RBITMAP: if (tag_len < CIPSO_V4_TAG_RBM_BLEN) { err_offset = opt_iter + 1; goto validate_return_locked; } /* We are already going to do all the verification * necessary at the socket layer so from our point of * view it is safe to turn these checks off (and less * work), however, the CIPSO draft says we should do * all the CIPSO validations here but it doesn't * really specify _exactly_ what we need to validate * ... so, just make it a sysctl tunable. */ if (cipso_v4_rbm_strictvalid) { if (cipso_v4_map_lvl_valid(doi_def, tag[3]) < 0) { err_offset = opt_iter + 3; goto validate_return_locked; } if (tag_len > CIPSO_V4_TAG_RBM_BLEN && cipso_v4_map_cat_rbm_valid(doi_def, &tag[4], tag_len - 4) < 0) { err_offset = opt_iter + 4; goto validate_return_locked; } } break; case CIPSO_V4_TAG_ENUM: if (tag_len < CIPSO_V4_TAG_ENUM_BLEN) { err_offset = opt_iter + 1; goto validate_return_locked; } if (cipso_v4_map_lvl_valid(doi_def, tag[3]) < 0) { err_offset = opt_iter + 3; goto validate_return_locked; } if (tag_len > CIPSO_V4_TAG_ENUM_BLEN && cipso_v4_map_cat_enum_valid(doi_def, &tag[4], tag_len - 4) < 0) { err_offset = opt_iter + 4; goto validate_return_locked; } break; case CIPSO_V4_TAG_RANGE: if (tag_len < CIPSO_V4_TAG_RNG_BLEN) { err_offset = opt_iter + 1; goto validate_return_locked; } if (cipso_v4_map_lvl_valid(doi_def, tag[3]) < 0) { err_offset = opt_iter + 3; goto validate_return_locked; } if (tag_len > CIPSO_V4_TAG_RNG_BLEN && cipso_v4_map_cat_rng_valid(doi_def, &tag[4], tag_len - 4) < 0) { err_offset = opt_iter + 4; goto validate_return_locked; } break; case CIPSO_V4_TAG_LOCAL: /* This is a non-standard tag that we only allow for * local connections, so if the incoming interface is * not the loopback device drop the packet. */ if (!(skb->dev->flags & IFF_LOOPBACK)) { err_offset = opt_iter; goto validate_return_locked; } if (tag_len != CIPSO_V4_TAG_LOC_BLEN) { err_offset = opt_iter + 1; goto validate_return_locked; } break; default: err_offset = opt_iter; goto validate_return_locked; } tag += tag_len; opt_iter += tag_len; } validate_return_locked: rcu_read_unlock(); validate_return: *option = opt + err_offset; return err_offset; } ",0 "scoped_refptr CreateFieldTrial( const std::string& trial_name, int total_probability, const std::string& default_group_name, int* default_group_number) { return FieldTrialList::FactoryGetFieldTrial( trial_name, total_probability, default_group_name, base::FieldTrialList::kNoExpirationYear, 1, 1, base::FieldTrial::SESSION_RANDOMIZED, default_group_number); } ",0 "void ChromotingInstance::SendTrappedKey(uint32 usb_keycode, bool pressed) { scoped_ptr data(new base::DictionaryValue()); data->SetInteger(""usbKeycode"", usb_keycode); data->SetBoolean(""pressed"", pressed); PostChromotingMessage(""trappedKeyEvent"", data.Pass()); } ",0 "PHPAPI char *xml_utf8_encode(const char *s, int len, int *newlen, const XML_Char *encoding) { int pos = len; char *newbuf; unsigned int c; unsigned short (*encoder)(unsigned char) = NULL; xml_encoding *enc = xml_get_encoding(encoding); *newlen = 0; if (enc) { encoder = enc->encoding_function; } else { /* If the target encoding was unknown, fail */ return NULL; } if (encoder == NULL) { /* If no encoder function was specified, return the data as-is. */ newbuf = emalloc(len + 1); memcpy(newbuf, s, len); *newlen = len; newbuf[*newlen] = '\0'; return newbuf; } /* This is the theoretical max (will never get beyond len * 2 as long * as we are converting from single-byte characters, though) */ newbuf = safe_emalloc(len, 4, 1); while (pos > 0) { c = encoder ? encoder((unsigned char)(*s)) : (unsigned short)(*s); if (c < 0x80) { newbuf[(*newlen)++] = (char) c; } else if (c < 0x800) { newbuf[(*newlen)++] = (0xc0 | (c >> 6)); newbuf[(*newlen)++] = (0x80 | (c & 0x3f)); } else if (c < 0x10000) { newbuf[(*newlen)++] = (0xe0 | (c >> 12)); newbuf[(*newlen)++] = (0xc0 | ((c >> 6) & 0x3f)); newbuf[(*newlen)++] = (0x80 | (c & 0x3f)); } else if (c < 0x200000) { newbuf[(*newlen)++] = (0xf0 | (c >> 18)); newbuf[(*newlen)++] = (0xe0 | ((c >> 12) & 0x3f)); newbuf[(*newlen)++] = (0xc0 | ((c >> 6) & 0x3f)); newbuf[(*newlen)++] = (0x80 | (c & 0x3f)); } pos--; s++; } newbuf[*newlen] = 0; newbuf = erealloc(newbuf, (*newlen)+1); return newbuf; } ",0 "void HandleChromeDebugURL(const GURL& url) { DCHECK(IsRendererDebugURL(url) && !url.SchemeIs(url::kJavaScriptScheme)); if (url == kChromeUIBadCastCrashURL) { LOG(ERROR) << ""Intentionally crashing (with bad cast)"" << "" because user navigated to "" << url.spec(); internal::BadCastCrashIntentionally(); } else if (url == kChromeUICrashURL) { LOG(ERROR) << ""Intentionally crashing (with null pointer dereference)"" << "" because user navigated to "" << url.spec(); internal::CrashIntentionally(); } else if (url == kChromeUIDumpURL) { base::debug::DumpWithoutCrashing(); #if defined(OS_WIN) || defined(OS_POSIX) } else if (url == kChromeUIKillURL) { LOG(ERROR) << ""Intentionally terminating current process because user"" "" navigated to "" << url.spec(); #if defined(OS_WIN) base::Process::TerminateCurrentProcessImmediately( base::win::kProcessKilledExitCode); #elif defined(OS_POSIX) PCHECK(kill(base::Process::Current().Pid(), SIGTERM) == 0); #endif #endif // defined(OS_WIN) || defined(OS_POSIX) } else if (url == kChromeUIHangURL) { LOG(ERROR) << ""Intentionally hanging ourselves with sleep infinite loop"" << "" because user navigated to "" << url.spec(); for (;;) { base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1)); } } else if (url == kChromeUIShorthangURL) { LOG(ERROR) << ""Intentionally sleeping renderer for 20 seconds"" << "" because user navigated to "" << url.spec(); base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(20)); } else if (url == kChromeUIMemoryExhaustURL) { LOG(ERROR) << ""Intentionally exhausting renderer memory because user navigated to "" << url.spec(); ExhaustMemory(); } else if (url == kChromeUICheckCrashURL) { LOG(ERROR) << ""Intentionally causing CHECK because user navigated to "" << url.spec(); CHECK(false); } #if defined(OS_WIN) if (url == kChromeUIHeapCorruptionCrashURL) { LOG(ERROR) << ""Intentionally causing heap corruption because user navigated to "" << url.spec(); base::debug::win::TerminateWithHeapCorruption(); } #endif #if DCHECK_IS_ON() if (url == kChromeUICrashDcheckURL) { LOG(ERROR) << ""Intentionally causing DCHECK because user navigated to "" << url.spec(); DCHECK(false) << ""Intentional DCHECK.""; } #endif #if defined(ADDRESS_SANITIZER) MaybeTriggerAsanError(url); #endif // ADDRESS_SANITIZER } ",0 "int PKCS7_ISSUER_AND_SERIAL_digest(PKCS7_ISSUER_AND_SERIAL *data, const EVP_MD *type, unsigned char *md, unsigned int *len) { return(ASN1_item_digest(ASN1_ITEM_rptr(PKCS7_ISSUER_AND_SERIAL),type, (char *)data,md,len)); } ",0 " ~LogStateSaver() { logging::SetMinLogLevel(old_min_log_level_); } ",0 "PepperDeviceEnumerationHostHelper::~PepperDeviceEnumerationHostHelper() {} ",0 "int search_binary_handler(struct linux_binprm *bprm) { bool need_retry = IS_ENABLED(CONFIG_MODULES); struct linux_binfmt *fmt; int retval; /* This allows 4 levels of binfmt rewrites before failing hard. */ if (bprm->recursion_depth > 5) return -ELOOP; retval = security_bprm_check(bprm); if (retval) return retval; retval = -ENOENT; retry: read_lock(&binfmt_lock); list_for_each_entry(fmt, &formats, lh) { if (!try_module_get(fmt->module)) continue; read_unlock(&binfmt_lock); bprm->recursion_depth++; retval = fmt->load_binary(bprm); read_lock(&binfmt_lock); put_binfmt(fmt); bprm->recursion_depth--; if (retval < 0 && !bprm->mm) { /* we got to flush_old_exec() and failed after it */ read_unlock(&binfmt_lock); force_sigsegv(SIGSEGV, current); return retval; } if (retval != -ENOEXEC || !bprm->file) { read_unlock(&binfmt_lock); return retval; } } read_unlock(&binfmt_lock); if (need_retry) { if (printable(bprm->buf[0]) && printable(bprm->buf[1]) && printable(bprm->buf[2]) && printable(bprm->buf[3])) return retval; if (request_module(""binfmt-%04x"", *(ushort *)(bprm->buf + 2)) < 0) return retval; need_retry = false; goto retry; } return retval; } ",0 "void RenderFrameHostManager::OnSetHasReceivedUserGesture() { for (const auto& pair : proxy_hosts_) { pair.second->Send( new FrameMsg_SetHasReceivedUserGesture(pair.second->GetRoutingID())); } } ",0 " void MoveBobIntoID2Runner() { if (!done_) { MoveBobIntoID2(); done_ = true; } } ",0 "DownloadShelf* BrowserWindowGtk::GetDownloadShelf() { if (!download_shelf_.get()) download_shelf_.reset(new DownloadShelfGtk(browser_.get(), render_area_vbox_)); return download_shelf_.get(); } ",0 "void AwContents::SetViewVisibility(JNIEnv* env, jobject obj, bool visible) { DCHECK_CURRENTLY_ON(BrowserThread::UI); browser_view_renderer_.SetViewVisibility(visible); } ",0 " MockQuotaManagerProxy() : QuotaManagerProxy(nullptr, nullptr), notify_storage_accessed_count_(0), notify_storage_modified_count_(0), last_delta_(0), mock_manager_(new MockQuotaManager) { manager_ = mock_manager_.get(); } ",0 "bool DevToolsAgentFilter::OnMessageReceived(const IPC::Message& message) { message_handled_ = true; current_routing_id_ = message.routing_id(); IPC_BEGIN_MESSAGE_MAP(DevToolsAgentFilter, message) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DebuggerCommand, OnDebuggerCommand) IPC_MESSAGE_HANDLER(DevToolsAgentMsg_DispatchOnInspectorBackend, OnDispatchOnInspectorBackend) IPC_MESSAGE_UNHANDLED(message_handled_ = false) IPC_END_MESSAGE_MAP() return message_handled_; } ",0 "bool IsSigninFrameClientCertUserSelectionEnabled() { return !base::CommandLine::ForCurrentProcess()->HasSwitch( kDisableSigninFrameClientCertUserSelection); } ",0 "PHP_FUNCTION(openssl_pkey_export) { struct php_x509_request req; zval * zpkey, * args = NULL, *out; char * passphrase = NULL; size_t passphrase_len = 0; int pem_write = 0; zend_resource *key_resource = NULL; EVP_PKEY * key; BIO * bio_out = NULL; const EVP_CIPHER * cipher; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""zz/|s!a!"", &zpkey, &out, &passphrase, &passphrase_len, &args) == FAILURE) { return; } RETVAL_FALSE; PHP_OPENSSL_CHECK_SIZE_T_TO_INT(passphrase_len, passphrase); key = php_openssl_evp_from_zval(zpkey, 0, passphrase, passphrase_len, 0, &key_resource); if (key == NULL) { php_error_docref(NULL, E_WARNING, ""cannot get key from parameter 1""); RETURN_FALSE; } PHP_SSL_REQ_INIT(&req); if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) { bio_out = BIO_new(BIO_s_mem()); if (passphrase && req.priv_key_encrypt) { if (req.priv_key_encrypt_cipher) { cipher = req.priv_key_encrypt_cipher; } else { cipher = (EVP_CIPHER *) EVP_des_ede3_cbc(); } } else { cipher = NULL; } switch (EVP_PKEY_base_id(key)) { #ifdef HAVE_EVP_PKEY_EC case EVP_PKEY_EC: pem_write = PEM_write_bio_ECPrivateKey(bio_out, EVP_PKEY_get1_EC_KEY(key), cipher, (unsigned char *)passphrase, (int)passphrase_len, NULL, NULL); break; #endif default: pem_write = PEM_write_bio_PrivateKey(bio_out, key, cipher, (unsigned char *)passphrase, (int)passphrase_len, NULL, NULL); break; } if (pem_write) { /* Success! * If returning the output as a string, do so now */ char * bio_mem_ptr; long bio_mem_len; RETVAL_TRUE; bio_mem_len = BIO_get_mem_data(bio_out, &bio_mem_ptr); zval_dtor(out); ZVAL_STRINGL(out, bio_mem_ptr, bio_mem_len); } } PHP_SSL_REQ_DISPOSE(&req); if (key_resource == NULL && key) { EVP_PKEY_free(key); } if (bio_out) { BIO_free(bio_out); } } ",0 "static int jas_iccprof_puttagtab(jas_stream_t *out, jas_icctagtab_t *tagtab) { int i; jas_icctagtabent_t *tagtabent; if (jas_iccputuint32(out, tagtab->numents)) goto error; for (i = 0; i < JAS_CAST(int, tagtab->numents); ++i) { tagtabent = &tagtab->ents[i]; if (jas_iccputuint32(out, tagtabent->tag) || jas_iccputuint32(out, tagtabent->off) || jas_iccputuint32(out, tagtabent->len)) goto error; } return 0; error: return -1; } ",0 "void AllViewsStoppedLoadingObserver::OnNoMorePendingLoads( content::WebContents* web_contents) { if (!automation_) { delete this; return; } TabSet::iterator iter = pending_tabs_.find(web_contents); if (iter == pending_tabs_.end()) { LOG(ERROR) << ""Received OnNoMorePendingLoads for tab without "" << ""OnFirstPendingLoad.""; return; } pending_tabs_.erase(iter); CheckIfNoMorePendingLoads(); } ",0 "static void php_zip_object_free_storage(void *object TSRMLS_DC) /* {{{ */ { ze_zip_object * intern = (ze_zip_object *) object; int i; if (!intern) { return; } if (intern->za) { if (zip_close(intern->za) != 0) { _zip_free(intern->za); } intern->za = NULL; } if (intern->buffers_cnt>0) { for (i=0; ibuffers_cnt; i++) { efree(intern->buffers[i]); } efree(intern->buffers); } intern->za = NULL; #if (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION == 1 && PHP_RELEASE_VERSION > 2) || (PHP_MAJOR_VERSION == 5 && PHP_MINOR_VERSION > 1) || (PHP_MAJOR_VERSION > 5) zend_object_std_dtor(&intern->zo TSRMLS_CC); #else if (intern->zo.guards) { zend_hash_destroy(intern->zo.guards); FREE_HASHTABLE(intern->zo.guards); } if (intern->zo.properties) { zend_hash_destroy(intern->zo.properties); FREE_HASHTABLE(intern->zo.properties); } #endif if (intern->filename) { efree(intern->filename); } efree(intern); } /* }}} */ ",0 " void WtsSessionProcessDelegate::Core::KillProcess(DWORD exit_code) { DCHECK(main_task_runner_->BelongsToCurrentThread()); channel_.reset(); if (launch_elevated_) { if (job_.IsValid()) { TerminateJobObject(job_, exit_code); } } else { if (worker_process_.IsValid()) { TerminateProcess(worker_process_, exit_code); } } } ",1 " Init_Display( void ) { grInitDevices(); bit.mode = gr_pixel_mode_gray; bit.width = DIM_X; bit.rows = DIM_Y; bit.grays = 256; surface = grNewSurface( 0, &bit ); if ( !surface ) PanicZ( ""could not allocate display surface\n"" ); graph_init = 1; } ",0 "DetectPrefilterBuildNonPrefilterList(DetectEngineThreadCtx *det_ctx, SignatureMask mask, uint8_t alproto) { uint32_t x = 0; for (x = 0; x < det_ctx->non_pf_store_cnt; x++) { /* only if the mask matches this rule can possibly match, * so build the non_mpm array only for match candidates */ const SignatureMask rule_mask = det_ctx->non_pf_store_ptr[x].mask; const uint8_t rule_alproto = det_ctx->non_pf_store_ptr[x].alproto; if ((rule_mask & mask) == rule_mask && (rule_alproto == 0 || rule_alproto == alproto)) { // TODO dce? det_ctx->non_pf_id_array[det_ctx->non_pf_id_cnt++] = det_ctx->non_pf_store_ptr[x].id; } } } ",0 "void BrowserWindowGtk::UpdateTitleBar() { TRACE_EVENT0(""ui::gtk"", ""BrowserWindowGtk::UpdateTitleBar""); string16 title = browser_->GetWindowTitleForCurrentTab(); gtk_window_set_title(window_, UTF16ToUTF8(title).c_str()); if (ShouldShowWindowIcon()) titlebar_->UpdateTitleAndIcon(); } ",0 "ProcPolyFillRectangle(ClientPtr client) { int things; GC *pGC; DrawablePtr pDraw; REQUEST(xPolyFillRectangleReq); REQUEST_AT_LEAST_SIZE(xPolyFillRectangleReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixWriteAccess); things = (client->req_len << 2) - sizeof(xPolyFillRectangleReq); if (things & 4) return BadLength; things >>= 3; if (things) (*pGC->ops->PolyFillRect) (pDraw, pGC, things, (xRectangle *) &stuff[1]); return Success; } ",0 "commit_metadata(struct svc_fh *fhp) { struct inode *inode = d_inode(fhp->fh_dentry); const struct export_operations *export_ops = inode->i_sb->s_export_op; if (!EX_ISSYNC(fhp->fh_export)) return 0; if (export_ops->commit_metadata) return export_ops->commit_metadata(inode); return sync_inode_metadata(inode, 1); } ",0 "bool QueryManager::ProcessPendingTransferQueries() { while (!pending_transfer_queries_.empty()) { Query* query = pending_transfer_queries_.front().get(); if (!query->Process()) { return false; } if (query->pending()) { break; } query->RunCallbacks(); pending_transfer_queries_.pop_front(); } return true; } ",0 "MockPrinter::MockPrinter() : dpi_(printing::kPointsPerInch), max_shrink_(2.0), min_shrink_(1.25), desired_dpi_(printing::kPointsPerInch), selection_only_(false), document_cookie_(-1), current_document_cookie_(0), printer_status_(PRINTER_READY), number_pages_(0), page_number_(0), is_first_request_(true), preview_request_id_(0), display_header_footer_(false), date_(ASCIIToUTF16(""date"")), title_(ASCIIToUTF16(""title"")), url_(ASCIIToUTF16(""url"")), use_invalid_settings_(false) { page_size_.SetSize(static_cast(8.5 * dpi_), static_cast(11.0 * dpi_)); printable_size_.SetSize(static_cast((7.5 * dpi_)), static_cast((10.0 * dpi_))); margin_left_ = margin_top_ = static_cast(0.5 * dpi_); } ",0 "v8::Local V8Proxy::instrumentedCallFunction(Frame* frame, v8::Handle function, v8::Handle receiver, int argc, v8::Handle args[]) { V8GCController::checkMemoryUsage(); if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth) return handleMaxRecursionDepthExceeded(); ScriptExecutionContext* context = frame ? frame->document() : 0; InspectorInstrumentationCookie cookie; if (InspectorInstrumentation::hasFrontends() && context) { String resourceName; int lineNumber; resourceInfo(function, resourceName, lineNumber); cookie = InspectorInstrumentation::willCallFunction(context, resourceName, lineNumber); } v8::Local result; { #if PLATFORM(CHROMIUM) TRACE_EVENT1(""v8"", ""v8.callFunction"", ""callsite"", resourceString(function).utf8()); #endif V8RecursionScope recursionScope(context); result = function->Call(receiver, argc, args); } InspectorInstrumentation::didCallFunction(cookie); if (v8::V8::IsDead()) handleFatalErrorInV8(); return result; } ",0 "void Document::AdjustFloatQuadsForScrollAndAbsoluteZoom( Vector& quads, const LayoutObject& layout_object) const { if (!View()) return; for (wtf_size_t i = 0; i < quads.size(); ++i) { AdjustForAbsoluteZoom::AdjustFloatQuad(quads[i], layout_object); } } ",0 "static void inet6_ifa_notify(int event, struct inet6_ifaddr *ifa) { struct sk_buff *skb; struct net *net = dev_net(ifa->idev->dev); int err = -ENOBUFS; skb = nlmsg_new(inet6_ifaddr_msgsize(), GFP_ATOMIC); if (skb == NULL) goto errout; err = inet6_fill_ifaddr(skb, ifa, 0, 0, event, 0); if (err < 0) { /* -EMSGSIZE implies BUG in inet6_ifaddr_msgsize() */ WARN_ON(err == -EMSGSIZE); kfree_skb(skb); goto errout; } rtnl_notify(skb, net, 0, RTNLGRP_IPV6_IFADDR, NULL, GFP_ATOMIC); return; errout: if (err < 0) rtnl_set_sk_err(net, RTNLGRP_IPV6_IFADDR, err); } ",0 " gfx::SelectionBound GetSelectionBoundFromRect(const gfx::Rect& rect) { gfx::SelectionBound bound; bound.SetEdge(gfx::PointF(rect.origin()), gfx::PointF(rect.bottom_left())); return bound; } ",0 "static int _nfs4_proc_getattr(struct nfs_server *server, struct nfs_fh *fhandle, struct nfs_fattr *fattr) { struct nfs4_getattr_arg args = { .fh = fhandle, .bitmask = server->attr_bitmask, }; struct nfs4_getattr_res res = { .fattr = fattr, .server = server, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_GETATTR], .rpc_argp = &args, .rpc_resp = &res, }; nfs_fattr_init(fattr); return nfs4_call_sync(server->client, server, &msg, &args.seq_args, &res.seq_res, 0); } ",0 "void InProcessBrowserTest::QuitBrowsers() { if (chrome::GetTotalBrowserCount() == 0) { chrome::NotifyAppTerminating(); return; } base::MessageLoopForUI::current()->PostTask(FROM_HERE, base::Bind(&chrome::AttemptExit)); content::RunMessageLoop(); #if defined(OS_MACOSX) content::RunAllPendingInMessageLoop(); delete autorelease_pool_; autorelease_pool_ = NULL; #endif } ",0 "WebKitWebView* kit(WebCore::Page* corePage) { if (!corePage) return 0; ASSERT(corePage->chrome()); WebKit::ChromeClient* client = static_cast(corePage->chrome()->client()); return client ? static_cast(client->webView()) : 0; } ",0 "GF_Err dinf_Read(GF_Box *s, GF_BitStream *bs) { GF_Err e = gf_isom_box_array_read(s, bs, dinf_AddBox); if (e) { return e; } if (!((GF_DataInformationBox *)s)->dref) { GF_LOG(GF_LOG_ERROR, GF_LOG_CONTAINER, (""[iso file] Missing dref box in dinf\n"")); ((GF_DataInformationBox *)s)->dref = (GF_DataReferenceBox *)gf_isom_box_new(GF_ISOM_BOX_TYPE_DREF); } return GF_OK; } ",1 "void WebProcessProxy::didGetSitesWithPluginData(const Vector& sites, uint64_t callbackID) { m_context->pluginSiteDataManager()->didGetSitesWithData(sites, callbackID); } ",0 "XRenderFindDisplay (Display *dpy) { XRenderExtDisplayInfo *dpyinfo; dpyinfo = XRenderExtFindDisplay (&XRenderExtensionInfo, dpy); if (!dpyinfo) dpyinfo = XRenderExtAddDisplay (&XRenderExtensionInfo, dpy, XRenderExtensionName); return dpyinfo; } ",0 "static int pmcraid_check_ioctl_buffer( int cmd, void __user *arg, struct pmcraid_ioctl_header *hdr ) { int rc = 0; int access = VERIFY_READ; if (copy_from_user(hdr, arg, sizeof(struct pmcraid_ioctl_header))) { pmcraid_err(""couldn't copy ioctl header from user buffer\n""); return -EFAULT; } /* check for valid driver signature */ rc = memcmp(hdr->signature, PMCRAID_IOCTL_SIGNATURE, sizeof(hdr->signature)); if (rc) { pmcraid_err(""signature verification failed\n""); return -EINVAL; } /* check for appropriate buffer access */ if ((_IOC_DIR(cmd) & _IOC_READ) == _IOC_READ) access = VERIFY_WRITE; rc = access_ok(access, (arg + sizeof(struct pmcraid_ioctl_header)), hdr->buffer_length); if (!rc) { pmcraid_err(""access failed for user buffer of size %d\n"", hdr->buffer_length); return -EFAULT; } return 0; } ",0 "int qeth_configure_cq(struct qeth_card *card, enum qeth_cq cq) { int rc; if (card->options.cq == QETH_CQ_NOTAVAILABLE) { rc = -1; goto out; } else { if (card->options.cq == cq) { rc = 0; goto out; } if (card->state != CARD_STATE_DOWN && card->state != CARD_STATE_RECOVER) { rc = -1; goto out; } qeth_free_qdio_buffers(card); card->options.cq = cq; rc = 0; } out: return rc; } ",0 "SWFShape_drawScaledLineTo(SWFShape shape, int x, int y) { SWFShape_drawScaledLine(shape, x-shape->xpos, y-shape->ypos); } ",0 "void DiskCacheBackendTest::BackendTransaction(const std::string& name, int num_entries, bool load) { success_ = false; ASSERT_TRUE(CopyTestCache(name)); DisableFirstCleanup(); uint32_t mask; if (load) { mask = 0xf; SetMaxSize(0x100000); } else { mask = 0; SetMaxSize(0); } SetMask(mask); InitCache(); ASSERT_EQ(num_entries + 1, cache_->GetEntryCount()); std::string key(""the first key""); disk_cache::Entry* entry1; ASSERT_NE(net::OK, OpenEntry(key, &entry1)); int actual = cache_->GetEntryCount(); if (num_entries != actual) { ASSERT_TRUE(load); ASSERT_EQ(num_entries - 1, actual); } cache_.reset(); cache_impl_ = NULL; ASSERT_TRUE(CheckCacheIntegrity(cache_path_, new_eviction_, MaxSize(), mask)); success_ = true; } ",0 "static void vmci_transport_set_buffer_size(struct vsock_sock *vsk, u64 val) { if (val < vmci_trans(vsk)->queue_pair_min_size) vmci_trans(vsk)->queue_pair_min_size = val; if (val > vmci_trans(vsk)->queue_pair_max_size) vmci_trans(vsk)->queue_pair_max_size = val; vmci_trans(vsk)->queue_pair_size = val; } ",0 "static int samldb_check_sAMAccountName(struct samldb_ctx *ac) { struct ldb_context *ldb = ldb_module_get_ctx(ac->module); const char *name; int ret; struct ldb_result *res; const char * const noattrs[] = { NULL }; if (ldb_msg_find_element(ac->msg, ""sAMAccountName"") == NULL) { ret = samldb_generate_sAMAccountName(ldb, ac->msg); if (ret != LDB_SUCCESS) { return ret; } } name = ldb_msg_find_attr_as_string(ac->msg, ""sAMAccountName"", NULL); if (name == NULL) { /* The ""sAMAccountName"" cannot be nothing */ ldb_set_errstring(ldb, ""samldb: Empty account names aren't allowed!""); return LDB_ERR_CONSTRAINT_VIOLATION; } ret = dsdb_module_search(ac->module, ac, &res, ldb_get_default_basedn(ldb), LDB_SCOPE_SUBTREE, noattrs, DSDB_FLAG_NEXT_MODULE, ac->req, ""(sAMAccountName=%s)"", ldb_binary_encode_string(ac, name)); if (ret != LDB_SUCCESS) { return ret; } if (res->count != 0) { ldb_asprintf_errstring(ldb, ""samldb: Account name (sAMAccountName) '%s' already in use!"", name); talloc_free(res); return LDB_ERR_ENTRY_ALREADY_EXISTS; } talloc_free(res); return samldb_next_step(ac); } ",0 "TIFFFetchNormalTag(TIFF* tif, TIFFDirEntry* dp, int recover) { static const char module[] = ""TIFFFetchNormalTag""; enum TIFFReadDirEntryErr err; uint32 fii; const TIFFField* fip = NULL; TIFFReadDirectoryFindFieldInfo(tif,dp->tdir_tag,&fii); if( fii == FAILED_FII ) { TIFFErrorExt(tif->tif_clientdata, ""TIFFFetchNormalTag"", ""No definition found for tag %d"", dp->tdir_tag); return 0; } fip=tif->tif_fields[fii]; assert(fip != NULL); /* should not happen */ assert(fip->set_field_type!=TIFF_SETGET_OTHER); /* if so, we shouldn't arrive here but deal with this in specialized code */ assert(fip->set_field_type!=TIFF_SETGET_INT); /* if so, we shouldn't arrive here as this is only the case for pseudo-tags */ err=TIFFReadDirEntryErrOk; switch (fip->set_field_type) { case TIFF_SETGET_UNDEFINED: break; case TIFF_SETGET_ASCII: { uint8* data; assert(fip->field_passcount==0); err=TIFFReadDirEntryByteArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { uint8* ma; uint32 mb; int n; ma=data; mb=0; while (mb<(uint32)dp->tdir_count) { if (*ma==0) break; ma++; mb++; } if (mb+1<(uint32)dp->tdir_count) TIFFWarningExt(tif->tif_clientdata,module,""ASCII value for tag \""%s\"" contains null byte in value; value incorrectly truncated during reading due to implementation limitations"",fip->field_name); else if (mb+1>(uint32)dp->tdir_count) { uint8* o; TIFFWarningExt(tif->tif_clientdata,module,""ASCII value for tag \""%s\"" does not end in null byte"",fip->field_name); if ((uint32)dp->tdir_count+1!=dp->tdir_count+1) o=NULL; else o=_TIFFmalloc((uint32)dp->tdir_count+1); if (o==NULL) { if (data!=NULL) _TIFFfree(data); return(0); } _TIFFmemcpy(o,data,(uint32)dp->tdir_count); o[(uint32)dp->tdir_count]=0; if (data!=0) _TIFFfree(data); data=o; } n=TIFFSetField(tif,dp->tdir_tag,data); if (data!=0) _TIFFfree(data); if (!n) return(0); } } break; case TIFF_SETGET_UINT8: { uint8 data=0; assert(fip->field_readcount==1); assert(fip->field_passcount==0); err=TIFFReadDirEntryByte(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { if (!TIFFSetField(tif,dp->tdir_tag,data)) return(0); } } break; case TIFF_SETGET_UINT16: { uint16 data; assert(fip->field_readcount==1); assert(fip->field_passcount==0); err=TIFFReadDirEntryShort(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { if (!TIFFSetField(tif,dp->tdir_tag,data)) return(0); } } break; case TIFF_SETGET_UINT32: { uint32 data; assert(fip->field_readcount==1); assert(fip->field_passcount==0); err=TIFFReadDirEntryLong(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { if (!TIFFSetField(tif,dp->tdir_tag,data)) return(0); } } break; case TIFF_SETGET_UINT64: { uint64 data; assert(fip->field_readcount==1); assert(fip->field_passcount==0); err=TIFFReadDirEntryLong8(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { if (!TIFFSetField(tif,dp->tdir_tag,data)) return(0); } } break; case TIFF_SETGET_FLOAT: { float data; assert(fip->field_readcount==1); assert(fip->field_passcount==0); err=TIFFReadDirEntryFloat(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { if (!TIFFSetField(tif,dp->tdir_tag,data)) return(0); } } break; case TIFF_SETGET_DOUBLE: { double data; assert(fip->field_readcount==1); assert(fip->field_passcount==0); err=TIFFReadDirEntryDouble(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { if (!TIFFSetField(tif,dp->tdir_tag,data)) return(0); } } break; case TIFF_SETGET_IFD8: { uint64 data; assert(fip->field_readcount==1); assert(fip->field_passcount==0); err=TIFFReadDirEntryIfd8(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { if (!TIFFSetField(tif,dp->tdir_tag,data)) return(0); } } break; case TIFF_SETGET_UINT16_PAIR: { uint16* data; assert(fip->field_readcount==2); assert(fip->field_passcount==0); if (dp->tdir_count!=2) { TIFFWarningExt(tif->tif_clientdata,module, ""incorrect count for field \""%s\"", expected 2, got %d"", fip->field_name,(int)dp->tdir_count); return(0); } err=TIFFReadDirEntryShortArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,data[0],data[1]); _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C0_UINT8: { uint8* data; assert(fip->field_readcount>=1); assert(fip->field_passcount==0); if (dp->tdir_count!=(uint64)fip->field_readcount) { TIFFWarningExt(tif->tif_clientdata,module, ""incorrect count for field \""%s\"", expected %d, got %d"", fip->field_name,(int) fip->field_readcount, (int)dp->tdir_count); return 0; } else { err=TIFFReadDirEntryByteArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C0_UINT16: { uint16* data; assert(fip->field_readcount>=1); assert(fip->field_passcount==0); if (dp->tdir_count!=(uint64)fip->field_readcount) /* corrupt file */; else { err=TIFFReadDirEntryShortArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C0_UINT32: { uint32* data; assert(fip->field_readcount>=1); assert(fip->field_passcount==0); if (dp->tdir_count!=(uint64)fip->field_readcount) /* corrupt file */; else { err=TIFFReadDirEntryLongArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C0_FLOAT: { float* data; assert(fip->field_readcount>=1); assert(fip->field_passcount==0); if (dp->tdir_count!=(uint64)fip->field_readcount) /* corrupt file */; else { err=TIFFReadDirEntryFloatArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C16_ASCII: { uint8* data; assert(fip->field_readcount==TIFF_VARIABLE); assert(fip->field_passcount==1); if (dp->tdir_count>0xFFFF) err=TIFFReadDirEntryErrCount; else { err=TIFFReadDirEntryByteArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) { TIFFWarningExt(tif->tif_clientdata,module,""ASCII value for tag \""%s\"" does not end in null byte. Forcing it to be null"",fip->field_name); data[dp->tdir_count-1] = '\0'; } m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C16_UINT8: { uint8* data; assert(fip->field_readcount==TIFF_VARIABLE); assert(fip->field_passcount==1); if (dp->tdir_count>0xFFFF) err=TIFFReadDirEntryErrCount; else { err=TIFFReadDirEntryByteArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C16_UINT16: { uint16* data; assert(fip->field_readcount==TIFF_VARIABLE); assert(fip->field_passcount==1); if (dp->tdir_count>0xFFFF) err=TIFFReadDirEntryErrCount; else { err=TIFFReadDirEntryShortArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C16_UINT32: { uint32* data; assert(fip->field_readcount==TIFF_VARIABLE); assert(fip->field_passcount==1); if (dp->tdir_count>0xFFFF) err=TIFFReadDirEntryErrCount; else { err=TIFFReadDirEntryLongArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C16_UINT64: { uint64* data; assert(fip->field_readcount==TIFF_VARIABLE); assert(fip->field_passcount==1); if (dp->tdir_count>0xFFFF) err=TIFFReadDirEntryErrCount; else { err=TIFFReadDirEntryLong8Array(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C16_FLOAT: { float* data; assert(fip->field_readcount==TIFF_VARIABLE); assert(fip->field_passcount==1); if (dp->tdir_count>0xFFFF) err=TIFFReadDirEntryErrCount; else { err=TIFFReadDirEntryFloatArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C16_DOUBLE: { double* data; assert(fip->field_readcount==TIFF_VARIABLE); assert(fip->field_passcount==1); if (dp->tdir_count>0xFFFF) err=TIFFReadDirEntryErrCount; else { err=TIFFReadDirEntryDoubleArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C16_IFD8: { uint64* data; assert(fip->field_readcount==TIFF_VARIABLE); assert(fip->field_passcount==1); if (dp->tdir_count>0xFFFF) err=TIFFReadDirEntryErrCount; else { err=TIFFReadDirEntryIfd8Array(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint16)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } } break; case TIFF_SETGET_C32_ASCII: { uint8* data; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntryByteArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; if( dp->tdir_count > 0 && data[dp->tdir_count-1] != '\0' ) { TIFFWarningExt(tif->tif_clientdata,module,""ASCII value for tag \""%s\"" does not end in null byte. Forcing it to be null"",fip->field_name); data[dp->tdir_count-1] = '\0'; } m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_UINT8: { uint8* data; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntryByteArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_SINT8: { int8* data = NULL; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntrySbyteArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_UINT16: { uint16* data; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntryShortArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_SINT16: { int16* data = NULL; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntrySshortArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_UINT32: { uint32* data; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntryLongArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_SINT32: { int32* data = NULL; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntrySlongArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_UINT64: { uint64* data; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntryLong8Array(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_SINT64: { int64* data = NULL; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntrySlong8Array(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_FLOAT: { float* data; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntryFloatArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_DOUBLE: { double* data; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntryDoubleArray(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; case TIFF_SETGET_C32_IFD8: { uint64* data; assert(fip->field_readcount==TIFF_VARIABLE2); assert(fip->field_passcount==1); err=TIFFReadDirEntryIfd8Array(tif,dp,&data); if (err==TIFFReadDirEntryErrOk) { int m; m=TIFFSetField(tif,dp->tdir_tag,(uint32)(dp->tdir_count),data); if (data!=0) _TIFFfree(data); if (!m) return(0); } } break; default: assert(0); /* we should never get here */ break; } if (err!=TIFFReadDirEntryErrOk) { TIFFReadDirEntryOutputErr(tif,err,module,fip->field_name,recover); return(0); } return(1); } ",0 "static bool ExecuteMakeTextWritingDirectionLeftToRight(LocalFrame& frame, Event*, EditorCommandSource, const String&) { MutableStylePropertySet* style = MutableStylePropertySet::Create(kHTMLQuirksMode); style->SetProperty(CSSPropertyUnicodeBidi, CSSValueIsolate); style->SetProperty(CSSPropertyDirection, CSSValueLtr); frame.GetEditor().ApplyStyle( style, InputEvent::InputType::kFormatSetBlockTextDirection); return true; } ",0 "void setFunctionProperty(v8::Local context, v8::Local obj, const char* name, v8::FunctionCallback callback, v8::Local external) { v8::Local funcName = toV8StringInternalized(context->GetIsolate(), name); v8::Local func; if (!V8_FUNCTION_NEW_REMOVE_PROTOTYPE(context, callback, external, 0).ToLocal(&func)) return; func->SetName(funcName); if (!obj->Set(context, funcName, func).FromMaybe(false)) return; } ",0 "void RenderViewImpl::OnCut() { if (!webview()) return; base::AutoReset handling_select_range(&handling_select_range_, true); webview()->focusedFrame()->executeCommand(WebString::fromUTF8(""Cut"")); } ",0 "void HTMLStyleElement::NotifyLoadedSheetAndAllCriticalSubresources( LoadedSheetErrorStatus error_status) { bool is_load_event = error_status == kNoErrorLoadingSubresource; if (fired_load_ && is_load_event) return; loaded_sheet_ = is_load_event; GetDocument() .GetTaskRunner(TaskType::kDOMManipulation) ->PostTask(FROM_HERE, WTF::Bind(&HTMLStyleElement::DispatchPendingEvent, WrapPersistent(this), WTF::Passed(IncrementLoadEventDelayCount::Create( GetDocument())))); fired_load_ = true; } ",0 "void HTMLFormElement::Disassociate(HTMLImageElement& e) { image_elements_are_dirty_ = true; image_elements_.clear(); RemoveFromPastNamesMap(e); } ",0 "bool SyncManager::SyncInternal::OpenDirectory() { DCHECK(!initialized_) << ""Should only happen once""; change_observer_ = browser_sync::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr()); WeakHandle transaction_observer( browser_sync::MakeWeakHandle(js_mutation_event_observer_.AsWeakPtr())); syncable::DirOpenResult open_result = syncable::NOT_INITIALIZED; if (testing_mode_ == TEST_IN_MEMORY) { open_result = directory()->OpenInMemoryForTest( username_for_share(), this, transaction_observer); } else { open_result = directory()->Open( database_path_, username_for_share(), this, transaction_observer); } if (open_result != syncable::OPENED) { LOG(ERROR) << ""Could not open share for:"" << username_for_share(); return false; } connection_manager()->set_client_id(directory()->cache_guid()); return true; } ",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; } ",0 "efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries) { struct efx_channel *other_channel[EFX_MAX_CHANNELS], *channel; u32 old_rxq_entries, old_txq_entries; unsigned i; int rc; efx_stop_all(efx); efx_fini_channels(efx); /* Clone channels */ memset(other_channel, 0, sizeof(other_channel)); for (i = 0; i < efx->n_channels; i++) { channel = efx_alloc_channel(efx, i, efx->channel[i]); if (!channel) { rc = -ENOMEM; goto out; } other_channel[i] = channel; } /* Swap entry counts and channel pointers */ old_rxq_entries = efx->rxq_entries; old_txq_entries = efx->txq_entries; efx->rxq_entries = rxq_entries; efx->txq_entries = txq_entries; for (i = 0; i < efx->n_channels; i++) { channel = efx->channel[i]; efx->channel[i] = other_channel[i]; other_channel[i] = channel; } rc = efx_probe_channels(efx); if (rc) goto rollback; efx_init_napi(efx); /* Destroy old channels */ for (i = 0; i < efx->n_channels; i++) { efx_fini_napi_channel(other_channel[i]); efx_remove_channel(other_channel[i]); } out: /* Free unused channel structures */ for (i = 0; i < efx->n_channels; i++) kfree(other_channel[i]); efx_init_channels(efx); efx_start_all(efx); return rc; rollback: /* Swap back */ efx->rxq_entries = old_rxq_entries; efx->txq_entries = old_txq_entries; for (i = 0; i < efx->n_channels; i++) { channel = efx->channel[i]; efx->channel[i] = other_channel[i]; other_channel[i] = channel; } goto out; } ",0 " virtual void PSNRPktHook(const vpx_codec_cx_pkt_t *pkt) { if (!frame0_psnr_) frame0_psnr_ = pkt->data.psnr.psnr[0]; EXPECT_NEAR(pkt->data.psnr.psnr[0], frame0_psnr_, 2.0); } ",0 "get_start_time_for_pid (pid_t pid, GError **error) { guint64 start_time; #if !defined(HAVE_FREEBSD) && !defined(HAVE_NETBSD) && !defined(HAVE_OPENBSD) gchar *filename; gchar *contents; size_t length; gchar **tokens; guint num_tokens; gchar *p; gchar *endp; start_time = 0; contents = NULL; filename = g_strdup_printf (""/proc/%d/stat"", pid); if (!g_file_get_contents (filename, &contents, &length, error)) goto out; /* start time is the token at index 19 after the '(process name)' entry - since only this * field can contain the ')' character, search backwards for this to avoid malicious * processes trying to fool us */ p = strrchr (contents, ')'); if (p == NULL) { g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_FAILED, ""Error parsing file %s"", filename); goto out; } p += 2; /* skip ') ' */ if (p - contents >= (int) length) { g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_FAILED, ""Error parsing file %s"", filename); goto out; } tokens = g_strsplit (p, "" "", 0); num_tokens = g_strv_length (tokens); if (num_tokens < 20) { g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_FAILED, ""Error parsing file %s"", filename); goto out; } start_time = strtoull (tokens[19], &endp, 10); if (endp == tokens[19]) { g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_FAILED, ""Error parsing file %s"", filename); goto out; } g_strfreev (tokens); out: g_free (filename); g_free (contents); #else #ifdef HAVE_NETBSD struct kinfo_proc2 p; #else struct kinfo_proc p; #endif start_time = 0; if (! get_kinfo_proc (pid, &p)) { g_set_error (error, POLKIT_ERROR, POLKIT_ERROR_FAILED, ""Error obtaining start time for %d (%s)"", (gint) pid, g_strerror (errno)); goto out; } #ifdef HAVE_FREEBSD start_time = (guint64) p.ki_start.tv_sec; #else start_time = (guint64) p.p_ustart_sec; #endif out: #endif return start_time; } ",0 "static void iwbmp_write_pixels_uncompressed(struct iwbmpwcontext *wctx, struct iw_image *img) { int j; iw_byte *dstrow = NULL; const iw_byte *srcrow; dstrow = iw_mallocz(wctx->ctx,wctx->unc_dst_bpr); if(!dstrow) goto done; for(j=img->height-1;j>=0;j--) { srcrow = &img->pixels[j*img->bpr]; switch(wctx->bitcount) { case 32: bmpw_convert_row_16_32(wctx,srcrow,dstrow,img->width); break; case 24: bmpw_convert_row_24(wctx,srcrow,dstrow,img->width); break; case 16: bmpw_convert_row_16_32(wctx,srcrow,dstrow,img->width); break; case 8: bmpw_convert_row_8(srcrow,dstrow,img->width); break; case 4: bmpw_convert_row_4(srcrow,dstrow,img->width); break; case 1: bmpw_convert_row_1(srcrow,dstrow,img->width); break; } iwbmp_write(wctx,dstrow,wctx->unc_dst_bpr); } done: if(dstrow) iw_free(wctx->ctx,dstrow); return; } ",0 " static int uipc_setup_server_locked(tUIPC_CH_ID ch_id, char *name, tUIPC_RCV_CBACK *cback) { int fd; BTIF_TRACE_EVENT(""SETUP CHANNEL SERVER %d"", ch_id); if (ch_id >= UIPC_CH_NUM) return -1; UIPC_LOCK(); fd = create_server_socket(name); if (fd < 0) { BTIF_TRACE_ERROR(""failed to setup %s"", name, strerror(errno)); UIPC_UNLOCK(); return -1; } BTIF_TRACE_EVENT(""ADD SERVER FD TO ACTIVE SET %d"", fd); FD_SET(fd, &uipc_main.active_set); uipc_main.max_fd = MAX(uipc_main.max_fd, fd); uipc_main.ch[ch_id].srvfd = fd; uipc_main.ch[ch_id].cback = cback; uipc_main.ch[ch_id].read_poll_tmo_ms = DEFAULT_READ_POLL_TMO_MS; /* trigger main thread to update read set */ uipc_wakeup_locked(); UIPC_UNLOCK(); return 0; } ",0 "void tlb_remove_table(struct mmu_gather *tlb, void *table) { struct mmu_table_batch **batch = &tlb->batch; /* * When there's less then two users of this mm there cannot be a * concurrent page-table walk. */ if (atomic_read(&tlb->mm->mm_users) < 2) { __tlb_remove_table(table); return; } if (*batch == NULL) { *batch = (struct mmu_table_batch *)__get_free_page(GFP_NOWAIT | __GFP_NOWARN); if (*batch == NULL) { tlb_remove_table_one(table); return; } (*batch)->nr = 0; } (*batch)->tables[(*batch)->nr++] = table; if ((*batch)->nr == MAX_TABLE_BATCH) tlb_table_flush(tlb); } ",0 " bool WebSocketHandshake::ProcessHeaders(const HttpResponseHeaders& headers) { if (!GetSingleHeader(headers, ""websocket-origin"", &ws_origin_)) return false; if (!GetSingleHeader(headers, ""websocket-location"", &ws_location_)) return false; if (!protocol_.empty() && !GetSingleHeader(headers, ""websocket-protocol"", &ws_protocol_)) return false; return true; } ",1 "static void _out_result(conn_t out, nad_t nad) { int attr; jid_t from, to; char *rkey; int rkeylen; attr = nad_find_attr(nad, 0, -1, ""from"", NULL); if(attr < 0 || (from = jid_new(NAD_AVAL(nad, attr), NAD_AVAL_L(nad, attr))) == NULL) { log_debug(ZONE, ""missing or invalid from on db result packet""); nad_free(nad); return; } attr = nad_find_attr(nad, 0, -1, ""to"", NULL); if(attr < 0 || (to = jid_new(NAD_AVAL(nad, attr), NAD_AVAL_L(nad, attr))) == NULL) { log_debug(ZONE, ""missing or invalid to on db result packet""); jid_free(from); nad_free(nad); return; } rkey = s2s_route_key(NULL, to->domain, from->domain); rkeylen = strlen(rkey); /* key is valid */ if(nad_find_attr(nad, 0, -1, ""type"", ""valid"") >= 0) { log_write(out->s2s->log, LOG_NOTICE, ""[%d] [%s, port=%d] outgoing route '%s' is now valid%s%s"", out->fd->fd, out->ip, out->port, rkey, (out->s->flags & SX_SSL_WRAPPER) ? "", TLS negotiated"" : """", out->s->compressed ? "", ZLIB compression enabled"" : """"); xhash_put(out->states, pstrdup(xhash_pool(out->states), rkey), (void *) conn_VALID); /* !!! small leak here */ log_debug(ZONE, ""%s valid, flushing queue"", rkey); /* flush the queue */ out_flush_route_queue(out->s2s, rkey, rkeylen); free(rkey); jid_free(from); jid_free(to); nad_free(nad); return; } /* invalid */ log_write(out->s2s->log, LOG_NOTICE, ""[%d] [%s, port=%d] outgoing route '%s' is now invalid"", out->fd->fd, out->ip, out->port, rkey); /* close connection */ log_write(out->s2s->log, LOG_NOTICE, ""[%d] [%s, port=%d] closing connection"", out->fd->fd, out->ip, out->port); /* report stream error */ sx_error(out->s, stream_err_INVALID_ID, ""dialback negotiation failed""); /* close the stream */ sx_close(out->s); /* bounce queue */ out_bounce_route_queue(out->s2s, rkey, rkeylen, stanza_err_SERVICE_UNAVAILABLE); free(rkey); jid_free(from); jid_free(to); nad_free(nad); } ",1 "static int ipx_setsockopt(struct socket *sock, int level, int optname, char __user *optval, unsigned int optlen) { struct sock *sk = sock->sk; int opt; int rc = -EINVAL; lock_sock(sk); if (optlen != sizeof(int)) goto out; rc = -EFAULT; if (get_user(opt, (unsigned int __user *)optval)) goto out; rc = -ENOPROTOOPT; if (!(level == SOL_IPX && optname == IPX_TYPE)) goto out; ipx_sk(sk)->type = opt; rc = 0; out: release_sock(sk); return rc; } ",0 "void ExtensionInstalledBubbleGtk::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == chrome::NOTIFICATION_EXTENSION_LOADED) { const Extension* extension = content::Details(details).ptr(); if (extension == extension_) { MessageLoopForUI::current()->PostTask( FROM_HERE, base::Bind(&ExtensionInstalledBubbleGtk::ShowInternal, this)); } } else if (type == chrome::NOTIFICATION_EXTENSION_UNLOADED) { const Extension* extension = content::Details(details)->extension; if (extension == extension_) extension_ = NULL; } else { NOTREACHED() << L""Received unexpected notification""; } } ",0 "static double GetFillAlpha(PolygonInfo *polygon_info,const double mid, const MagickBooleanType fill,const FillRule fill_rule,const ssize_t x, const ssize_t y,double *stroke_alpha) { double alpha, beta, distance, subpath_alpha; PointInfo delta; register const PointInfo *q; register EdgeInfo *p; register ssize_t i; ssize_t j, winding_number; /* Compute fill & stroke opacity for this (x,y) point. */ *stroke_alpha=0.0; subpath_alpha=0.0; p=polygon_info->edges; for (j=0; j < (ssize_t) polygon_info->number_edges; j++, p++) { if ((double) y <= (p->bounds.y1-mid-0.5)) break; if ((double) y > (p->bounds.y2+mid+0.5)) { (void) DestroyEdge(polygon_info,(size_t) j); continue; } if (((double) x <= (p->bounds.x1-mid-0.5)) || ((double) x > (p->bounds.x2+mid+0.5))) continue; i=(ssize_t) MagickMax((double) p->highwater,1.0); for ( ; i < (ssize_t) p->number_points; i++) { if ((double) y <= (p->points[i-1].y-mid-0.5)) break; if ((double) y > (p->points[i].y+mid+0.5)) continue; if (p->scanline != (double) y) { p->scanline=(double) y; p->highwater=(size_t) i; } /* Compute distance between a point and an edge. */ q=p->points+i-1; delta.x=(q+1)->x-q->x; delta.y=(q+1)->y-q->y; beta=delta.x*(x-q->x)+delta.y*(y-q->y); if (beta <= 0.0) { delta.x=(double) x-q->x; delta.y=(double) y-q->y; distance=delta.x*delta.x+delta.y*delta.y; } else { alpha=delta.x*delta.x+delta.y*delta.y; if (beta >= alpha) { delta.x=(double) x-(q+1)->x; delta.y=(double) y-(q+1)->y; distance=delta.x*delta.x+delta.y*delta.y; } else { alpha=PerceptibleReciprocal(alpha); beta=delta.x*(y-q->y)-delta.y*(x-q->x); distance=alpha*beta*beta; } } /* Compute stroke & subpath opacity. */ beta=0.0; if (p->ghostline == MagickFalse) { alpha=mid+0.5; if ((*stroke_alpha < 1.0) && (distance <= ((alpha+0.25)*(alpha+0.25)))) { alpha=mid-0.5; if (distance <= ((alpha+0.25)*(alpha+0.25))) *stroke_alpha=1.0; else { beta=1.0; if (fabs(distance-1.0) >= MagickEpsilon) beta=sqrt((double) distance); alpha=beta-mid-0.5; if (*stroke_alpha < ((alpha-0.25)*(alpha-0.25))) *stroke_alpha=(alpha-0.25)*(alpha-0.25); } } } if ((fill == MagickFalse) || (distance > 1.0) || (subpath_alpha >= 1.0)) continue; if (distance <= 0.0) { subpath_alpha=1.0; continue; } if (distance > 1.0) continue; if (fabs(beta) < MagickEpsilon) { beta=1.0; if (fabs(distance-1.0) >= MagickEpsilon) beta=sqrt(distance); } alpha=beta-1.0; if (subpath_alpha < (alpha*alpha)) subpath_alpha=alpha*alpha; } } /* Compute fill opacity. */ if (fill == MagickFalse) return(0.0); if (subpath_alpha >= 1.0) return(1.0); /* Determine winding number. */ winding_number=0; p=polygon_info->edges; for (j=0; j < (ssize_t) polygon_info->number_edges; j++, p++) { if ((double) y <= p->bounds.y1) break; if (((double) y > p->bounds.y2) || ((double) x <= p->bounds.x1)) continue; if ((double) x > p->bounds.x2) { winding_number+=p->direction ? 1 : -1; continue; } i=(ssize_t) MagickMax((double) p->highwater,1.0); for ( ; i < (ssize_t) (p->number_points-1); i++) if ((double) y <= p->points[i].y) break; q=p->points+i-1; if ((((q+1)->x-q->x)*(y-q->y)) <= (((q+1)->y-q->y)*(x-q->x))) winding_number+=p->direction ? 1 : -1; } if (fill_rule != NonZeroRule) { if ((MagickAbsoluteValue(winding_number) & 0x01) != 0) return(1.0); } else if (MagickAbsoluteValue(winding_number) != 0) return(1.0); return(subpath_alpha); } ",0 "int ext4_convert_unwritten_extents(handle_t *handle, struct inode *inode, loff_t offset, ssize_t len) { unsigned int max_blocks; int ret = 0; int ret2 = 0; struct ext4_map_blocks map; unsigned int credits, blkbits = inode->i_blkbits; map.m_lblk = offset >> blkbits; max_blocks = EXT4_MAX_BLOCKS(len, offset, blkbits); /* * This is somewhat ugly but the idea is clear: When transaction is * reserved, everything goes into it. Otherwise we rather start several * smaller transactions for conversion of each extent separately. */ if (handle) { handle = ext4_journal_start_reserved(handle, EXT4_HT_EXT_CONVERT); if (IS_ERR(handle)) return PTR_ERR(handle); credits = 0; } else { /* * credits to insert 1 extent into extent tree */ credits = ext4_chunk_trans_blocks(inode, max_blocks); } while (ret >= 0 && ret < max_blocks) { map.m_lblk += ret; map.m_len = (max_blocks -= ret); if (credits) { handle = ext4_journal_start(inode, EXT4_HT_MAP_BLOCKS, credits); if (IS_ERR(handle)) { ret = PTR_ERR(handle); break; } } ret = ext4_map_blocks(handle, inode, &map, EXT4_GET_BLOCKS_IO_CONVERT_EXT); if (ret <= 0) ext4_warning(inode->i_sb, ""inode #%lu: block %u: len %u: "" ""ext4_ext_map_blocks returned %d"", inode->i_ino, map.m_lblk, map.m_len, ret); ext4_mark_inode_dirty(handle, inode); if (credits) ret2 = ext4_journal_stop(handle); if (ret <= 0 || ret2) break; } if (!credits) ret2 = ext4_journal_stop(handle); return ret > 0 ? ret2 : ret; } ",0 "static unsigned long get_min_memlimit(const char *cgroup) { char *copy = strdupa(cgroup); unsigned long memlimit = 0, retlimit; retlimit = get_memlimit(copy); while (strcmp(copy, ""/"") != 0) { copy = dirname(copy); memlimit = get_memlimit(copy); if (memlimit != -1 && memlimit < retlimit) retlimit = memlimit; }; return retlimit; } ",0 "void BaseMultipleFieldsDateAndTimeInputType::stepAttributeChanged() { updateInnerTextValue(); } ",0 "struct client_session *mk_session_get(int socket) { struct client_session *cs; struct rb_node *node; node = cs_list->rb_node; while (node) { cs = container_of(node, struct client_session, _rb_head); if (socket < cs->socket) node = node->rb_left; else if (socket > cs->socket) node = node->rb_right; else { return cs; } } return NULL; } ",0 "static int gdLayerOverlay (int dst, int src) { int a1, a2; a1 = gdAlphaMax - gdTrueColorGetAlpha(dst); a2 = gdAlphaMax - gdTrueColorGetAlpha(src); return ( ((gdAlphaMax - a1*a2/gdAlphaMax) << 24) + (gdAlphaOverlayColor( gdTrueColorGetRed(src), gdTrueColorGetRed(dst), gdRedMax ) << 16) + (gdAlphaOverlayColor( gdTrueColorGetGreen(src), gdTrueColorGetGreen(dst), gdGreenMax ) << 8) + (gdAlphaOverlayColor( gdTrueColorGetBlue(src), gdTrueColorGetBlue(dst), gdBlueMax )) ); } ",0 "PHP_METHOD(DateTimeImmutable, __construct) { zval *timezone_object = NULL; char *time_str = NULL; int time_str_len = 0; zend_error_handling error_handling; zend_replace_error_handling(EH_THROW, NULL, &error_handling TSRMLS_CC); if (SUCCESS == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""|sO!"", &time_str, &time_str_len, &timezone_object, date_ce_timezone)) { php_date_initialize(zend_object_store_get_object(getThis() TSRMLS_CC), time_str, time_str_len, NULL, timezone_object, 1 TSRMLS_CC); } zend_restore_error_handling(&error_handling TSRMLS_CC); } ",0 " virtual void RunCallback() { if (callback_) { callback_->Run(error_code(), buffer_.get(), bytes_read_); delete callback_; } } ",0 "GLvoid StubGLReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void* pixels) { glReadPixels(x, y, width, height, format, type, pixels); } ",0 "static unsigned int fanout_demux_hash(struct packet_fanout *f, struct sk_buff *skb, unsigned int num) { return reciprocal_scale(__skb_get_hash_symmetric(skb), num); } ",0 "static void pcd_probe_capabilities(void) { int unit, r; char buffer[32]; char cmd[12] = { 0x5a, 1 << 3, 0x2a, 0, 0, 0, 0, 18, 0, 0, 0, 0 }; struct pcd_unit *cd; for (unit = 0, cd = pcd; unit < PCD_UNITS; unit++, cd++) { if (!cd->present) continue; r = pcd_atapi(cd, cmd, 18, buffer, ""mode sense capabilities""); if (r) continue; /* we should now have the cap page */ if ((buffer[11] & 1) == 0) cd->info.mask |= CDC_CD_R; if ((buffer[11] & 2) == 0) cd->info.mask |= CDC_CD_RW; if ((buffer[12] & 1) == 0) cd->info.mask |= CDC_PLAY_AUDIO; if ((buffer[14] & 1) == 0) cd->info.mask |= CDC_LOCK; if ((buffer[14] & 8) == 0) cd->info.mask |= CDC_OPEN_TRAY; if ((buffer[14] >> 6) == 0) cd->info.mask |= CDC_CLOSE_TRAY; } } ",0 "unsigned AXNodeObject::hierarchicalLevel() const { Node* node = this->getNode(); if (!node || !node->isElementNode()) return 0; Element* element = toElement(node); String levelStr = element->getAttribute(aria_levelAttr); if (!levelStr.isEmpty()) { int level = levelStr.toInt(); if (level > 0) return level; return 1; } if (roleValue() != TreeItemRole) return 0; unsigned level = 1; for (AXObject* parent = parentObject(); parent; parent = parent->parentObject()) { AccessibilityRole parentRole = parent->roleValue(); if (parentRole == GroupRole) level++; else if (parentRole == TreeRole) break; } return level; } ",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)); } ",0 "static inline void register_fair_sched_group(struct task_group *tg, int cpu) { list_add_rcu(&tg->cfs_rq[cpu]->leaf_cfs_rq_list, &cpu_rq(cpu)->leaf_cfs_rq_list); } ",0 "static void __ldsem_wake_readers(struct ld_semaphore *sem) { struct ldsem_waiter *waiter, *next; struct task_struct *tsk; long adjust, count; /* Try to grant read locks to all readers on the read wait list. * Note the 'active part' of the count is incremented by * the number of readers before waking any processes up. */ adjust = sem->wait_readers * (LDSEM_ACTIVE_BIAS - LDSEM_WAIT_BIAS); count = ldsem_atomic_update(adjust, sem); do { if (count > 0) break; if (ldsem_cmpxchg(&count, count - adjust, sem)) return; } while (1); list_for_each_entry_safe(waiter, next, &sem->read_wait, list) { tsk = waiter->task; smp_mb(); waiter->task = NULL; wake_up_process(tsk); put_task_struct(tsk); } INIT_LIST_HEAD(&sem->read_wait); sem->wait_readers = 0; } ",0 "std::vector PageHandler::ForAgentHost( DevToolsAgentHostImpl* host) { return DevToolsSession::HandlersForAgentHost( host, Page::Metainfo::domainName); } ",0 "static void activityLoggedInIsolatedWorldMethodMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""activityLoggedInIsolatedWorldMethod"", ""TestObject"", info.Holder(), info.GetIsolate()); if (UNLIKELY(info.Length() < 1)) { exceptionState.throwTypeError(ExceptionMessages::notEnoughArguments(1, info.Length())); exceptionState.throwIfNeeded(); return; } TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, longArg, toInt32(info[0], exceptionState), exceptionState); imp->activityLoggedInIsolatedWorldMethod(longArg); } ",0 "WORD32 ihevcd_set_processor(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op) { ihevcd_cxa_ctl_set_processor_ip_t *ps_ip; ihevcd_cxa_ctl_set_processor_op_t *ps_op; codec_t *ps_codec = (codec_t *)ps_codec_obj->pv_codec_handle; ps_ip = (ihevcd_cxa_ctl_set_processor_ip_t *)pv_api_ip; ps_op = (ihevcd_cxa_ctl_set_processor_op_t *)pv_api_op; ps_codec->e_processor_arch = (IVD_ARCH_T)ps_ip->u4_arch; ps_codec->e_processor_soc = (IVD_SOC_T)ps_ip->u4_soc; ihevcd_init_function_ptr(ps_codec); ihevcd_update_function_ptr(ps_codec); if(ps_codec->e_processor_soc && (ps_codec->e_processor_soc <= SOC_HISI_37X)) { /* 8th bit indicates if format conversion is to be done ahead */ if(ps_codec->e_processor_soc & 0x80) ps_codec->u4_enable_fmt_conv_ahead = 1; /* Lower 7 bit indicate NCTB - if non-zero */ ps_codec->e_processor_soc &= 0x7F; if(ps_codec->e_processor_soc) ps_codec->u4_nctb = ps_codec->e_processor_soc; } if((ps_codec->e_processor_soc == SOC_HISI_37X) && (ps_codec->i4_num_cores == 2)) { ps_codec->u4_nctb = 2; } ps_op->u4_error_code = 0; return IV_SUCCESS; } ",0 "bool BitReaderCore::SkipBitsSmall(int num_bits) { DCHECK_GE(num_bits, 0); uint64_t dummy; while (num_bits >= kRegWidthInBits) { if (!ReadBitsInternal(kRegWidthInBits, &dummy)) return false; num_bits -= kRegWidthInBits; } return ReadBitsInternal(num_bits, &dummy); } ",0 "webkit::npapi::WebPluginDelegate* RenderViewImpl::CreatePluginDelegate( const FilePath& file_path, const std::string& mime_type) { if (!PluginChannelHost::IsListening()) { LOG(ERROR) << ""PluginChannelHost isn't listening""; return NULL; } bool in_process_plugin = RenderProcess::current()->UseInProcessPlugins(); if (in_process_plugin) { #if defined(OS_WIN) && !defined(USE_AURA) return webkit::npapi::WebPluginDelegateImpl::Create( file_path, mime_type, gfx::NativeViewFromId(host_window_)); #else NOTIMPLEMENTED(); return NULL; #endif } return new WebPluginDelegateProxy(mime_type, AsWeakPtr()); } ",0 "void post_message(omx_video *omx, unsigned char id) { DEBUG_PRINT_LOW(""omx_venc: post_message %d"", id); write(omx->m_pipe_out, &id, 1); } ",0 "void MediaElementAudioSourceNode::SetFormat(size_t number_of_channels, float sample_rate) { GetMediaElementAudioSourceHandler().SetFormat(number_of_channels, sample_rate); } ",0 "static void handle_request(int fd) { ALOGV(""handle_request(%d)\n"", fd); ScopedFd closer(fd); debugger_request_t request; memset(&request, 0, sizeof(request)); int status = read_request(fd, &request); if (status != 0) { return; } ALOGW(""debuggerd: handling request: pid=%d uid=%d gid=%d tid=%d\n"", request.pid, request.uid, request.gid, request.tid); #if defined(__LP64__) if (is32bit(request.tid)) { if (request.action == DEBUGGER_ACTION_DUMP_BACKTRACE || request.action == DEBUGGER_ACTION_DUMP_TOMBSTONE) { redirect_to_32(fd, &request); } else { ALOGE(""debuggerd: Not allowed to redirect action %d to 32 bit debuggerd\n"", request.action); } return; } #endif pid_t fork_pid = fork(); if (fork_pid == -1) { ALOGE(""debuggerd: failed to fork: %s\n"", strerror(errno)); } else if (fork_pid == 0) { worker_process(fd, request); } else { monitor_worker_process(fork_pid, request); } } ",0 "static void WBMPWriteInteger(Image *image,const size_t value) { int bits, flag, n; register ssize_t i; unsigned char buffer[5], octet; n=1; bits=28; flag=MagickFalse; for (i=4; i >= 0; i--) { octet=(unsigned char) ((value >> bits) & 0x7f); if ((flag == 0) && (octet != 0)) { flag=MagickTrue; n=i+1; } buffer[4-i]=octet | (i && (flag || octet))*(0x01 << 7); bits-=7; } (void) WriteBlob(image,(size_t) n,buffer+5-n); } ",0 "AtomicString PerformanceNavigationTiming::type() const { DocumentLoader* loader = GetDocumentLoader(); if (GetFrame() && loader) return GetNavigationType(loader->GetNavigationType(), GetFrame()->GetDocument()); return ""navigate""; } ",0 "ResourceError WebFrameLoaderClient::interruptForPolicyChangeError( const ResourceRequest& request) { return ResourceError(kInternalErrorDomain, ERR_POLICY_CHANGE, request.url().string(), String()); } ",0 "struct crypto_instance *crypto_alloc_instance(const char *name, struct crypto_alg *alg) { struct crypto_instance *inst; struct crypto_spawn *spawn; int err; inst = crypto_alloc_instance2(name, alg, 0); if (IS_ERR(inst)) goto out; spawn = crypto_instance_ctx(inst); err = crypto_init_spawn(spawn, alg, inst, CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_ASYNC); if (err) goto err_free_inst; return inst; err_free_inst: kfree(inst); inst = ERR_PTR(err); out: return inst; } ",0 " SitePerProcessHighDPIBrowserTest() {} ",0 "static ssize_t double_flag_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count, enum transparent_hugepage_flag enabled, enum transparent_hugepage_flag req_madv) { if (!memcmp(""always"", buf, min(sizeof(""always"")-1, count))) { set_bit(enabled, &transparent_hugepage_flags); clear_bit(req_madv, &transparent_hugepage_flags); } else if (!memcmp(""madvise"", buf, min(sizeof(""madvise"")-1, count))) { clear_bit(enabled, &transparent_hugepage_flags); set_bit(req_madv, &transparent_hugepage_flags); } else if (!memcmp(""never"", buf, min(sizeof(""never"")-1, count))) { clear_bit(enabled, &transparent_hugepage_flags); clear_bit(req_madv, &transparent_hugepage_flags); } else return -EINVAL; return count; } ",0 " Ins_PUSHW( TT_ExecContext exc, FT_Long* args ) { FT_UShort L, K; L = (FT_UShort)( exc->opcode - 0xB8 + 1 ); if ( BOUNDS( L, exc->stackSize + 1 - exc->top ) ) { exc->error = FT_THROW( Stack_Overflow ); return; } exc->IP++; for ( K = 0; K < L; K++ ) args[K] = GetShortIns( exc ); exc->step_ins = FALSE; } ",0 "static void n_tty_close(struct tty_struct *tty) { struct n_tty_data *ldata = tty->disc_data; if (tty->link) n_tty_packet_mode_flush(tty); vfree(ldata); tty->disc_data = NULL; } ",0 "static int tcm_loop_is_state_remove(struct se_cmd *se_cmd) { /* * Assume struct scsi_cmnd is not in remove state.. */ return 0; } ",0 "int SafeSock::get_ptr(void *&ptr, char delim) { int size; while(!_msgReady) { if(_timeout > 0) { Selector selector; selector.set_timeout( _timeout ); selector.add_fd( _sock, Selector::IO_READ ); selector.execute(); if ( selector.timed_out() ) { return 0; } else if ( !selector.has_ready() ) { dprintf(D_NETWORK, ""select returns %d, recv failed\n"", selector.select_retval() ); return 0; } } (void)handle_incoming_packet(); } if(_longMsg) { // long message size = _longMsg->getPtr(ptr, delim); return size; } else { // short message size = _shortMsg.getPtr(ptr, delim); return size; } } ",0 "bool roleAllowsRequired(AccessibilityRole role) { return role == ComboBoxRole || role == CellRole || role == ListBoxRole || role == RadioGroupRole || role == SpinButtonRole || role == TextFieldRole || role == TreeRole || role == ColumnHeaderRole || role == RowHeaderRole || role == TreeGridRole; } ",0 "static inline double GetFITSPixelRange(const size_t depth) { return((double) ((MagickOffsetType) GetQuantumRange(depth))); } ",0 "void HTMLMediaElement::RejectPlayPromises(DOMExceptionCode code, const String& message) { play_promise_reject_list_.AppendVector(play_promise_resolvers_); play_promise_resolvers_.clear(); RejectPlayPromisesInternal(code, message); } ",0 "bool AudioRendererAlgorithm::OutputSlowerPlayback(uint8* dest) { DCHECK_LT(index_into_window_, window_size_); DCHECK_LT(playback_rate_, 1.0); DCHECK_NE(playback_rate_, 0.0); if (audio_buffer_.forward_bytes() < bytes_per_frame_) return false; int input_step = ceil(window_size_ * playback_rate_); AlignToFrameBoundary(&input_step); int output_step = window_size_; DCHECK_LT(input_step, output_step); int bytes_to_crossfade = bytes_in_crossfade_; if (muted_ || bytes_to_crossfade > input_step) bytes_to_crossfade = 0; int intro_crossfade_begin = input_step - bytes_to_crossfade; int intro_crossfade_end = input_step; int outtro_crossfade_begin = output_step - bytes_to_crossfade; if (index_into_window_ < intro_crossfade_begin) { CopyWithAdvance(dest); index_into_window_ += bytes_per_frame_; return true; } if (index_into_window_ < intro_crossfade_end) { int offset = index_into_window_ - intro_crossfade_begin; uint8* place_to_copy = crossfade_buffer_.get() + offset; CopyWithoutAdvance(place_to_copy); CopyWithAdvance(dest); index_into_window_ += bytes_per_frame_; return true; } int audio_buffer_offset = index_into_window_ - intro_crossfade_end; if (audio_buffer_.forward_bytes() < audio_buffer_offset + bytes_per_frame_) return false; DCHECK_GE(index_into_window_, intro_crossfade_end); CopyWithoutAdvance(dest, audio_buffer_offset); if (index_into_window_ >= outtro_crossfade_begin) { int offset_into_crossfade_buffer = index_into_window_ - outtro_crossfade_begin; uint8* intro_frame_ptr = crossfade_buffer_.get() + offset_into_crossfade_buffer; OutputCrossfadedFrame(dest, intro_frame_ptr); } index_into_window_ += bytes_per_frame_; return true; } ",1 "void Document::removeFocusedNodeOfSubtree(Node* node, bool amongChildrenOnly) { if (!m_focusedNode || this->inPageCache()) // If the document is in the page cache, then we don't need to clear out the focused node. return; Node* focusedNode = node->treeScope()->focusedNode(); if (!focusedNode) return; bool nodeInSubtree = false; if (amongChildrenOnly) nodeInSubtree = focusedNode->isDescendantOf(node); else nodeInSubtree = (focusedNode == node) || focusedNode->isDescendantOf(node); if (nodeInSubtree) document()->focusedNodeRemoved(); } ",0 "static inline void flush_slab(struct kmem_cache *s, struct kmem_cache_cpu *c) { stat(c, CPUSLAB_FLUSH); slab_lock(c->page); deactivate_slab(s, c); } ",0 "void WebContentsImpl::OnEnumerateDirectory(int request_id, const base::FilePath& path) { if (!delegate_) return; ChildProcessSecurityPolicyImpl* policy = ChildProcessSecurityPolicyImpl::GetInstance(); if (policy->CanReadFile(GetRenderProcessHost()->GetID(), path)) delegate_->EnumerateDirectory(this, request_id, path); } ",0 "TargetHandler::Throttle::Throttle( base::WeakPtr target_handler, content::NavigationHandle* navigation_handle) : content::NavigationThrottle(navigation_handle), target_handler_(target_handler) { target_handler->throttles_.insert(this); } ",0 "void ResultNoOp(bool success) { } ",0 "bool ShouldNavigateBack(const NavigationController& controller, OverscrollMode mode) { return mode == (base::i18n::IsRTL() ? OVERSCROLL_WEST : OVERSCROLL_EAST) && controller.CanGoBack(); } ",0 "void nfc_llcp_send_to_raw_sock(struct nfc_llcp_local *local, struct sk_buff *skb, u8 direction) { struct sk_buff *skb_copy = NULL, *nskb; struct sock *sk; u8 *data; read_lock(&local->raw_sockets.lock); sk_for_each(sk, &local->raw_sockets.head) { if (sk->sk_state != LLCP_BOUND) continue; if (skb_copy == NULL) { skb_copy = __pskb_copy_fclone(skb, NFC_RAW_HEADER_SIZE, GFP_ATOMIC, true); if (skb_copy == NULL) continue; data = skb_push(skb_copy, NFC_RAW_HEADER_SIZE); data[0] = local->dev ? local->dev->idx : 0xFF; data[1] = direction & 0x01; data[1] |= (RAW_PAYLOAD_LLCP << 1); } nskb = skb_clone(skb_copy, GFP_ATOMIC); if (!nskb) continue; if (sock_queue_rcv_skb(sk, nskb)) kfree_skb(nskb); } read_unlock(&local->raw_sockets.lock); kfree_skb(skb_copy); } ",0 "GBool DCTStream::readJFIFMarker() { int length, i; char buf[5]; int c; length = read16(); length -= 2; if (length >= 5) { for (i = 0; i < 5; ++i) { if ((c = str->getChar()) == EOF) { error(errSyntaxError, getPos(), ""Bad DCT APP0 marker""); return gFalse; } buf[i] = c; } length -= 5; if (!memcmp(buf, ""JFIF\0"", 5)) { gotJFIFMarker = gTrue; } } while (length > 0) { if (str->getChar() == EOF) { error(errSyntaxError, getPos(), ""Bad DCT APP0 marker""); return gFalse; } --length; } return gTrue; } ",0 "void nfs4_copy_stateid(nfs4_stateid *dst, struct nfs4_state *state, fl_owner_t fl_owner) { struct nfs4_lock_state *lsp; int seq; do { seq = read_seqbegin(&state->seqlock); memcpy(dst, &state->stateid, sizeof(*dst)); } while (read_seqretry(&state->seqlock, seq)); if (test_bit(LK_STATE_IN_USE, &state->flags) == 0) return; spin_lock(&state->state_lock); lsp = __nfs4_find_lock_state(state, fl_owner); if (lsp != NULL && (lsp->ls_flags & NFS_LOCK_INITIALIZED) != 0) memcpy(dst, &lsp->ls_stateid, sizeof(*dst)); spin_unlock(&state->state_lock); nfs4_put_lock_state(lsp); } ",0 "SYSCALL_DEFINE0(getpgrp) { return sys_getpgid(0); } ",0 "static int vp8_read_mv_component(VP56RangeCoder *c, const uint8_t *p) { return read_mv_component(c, p, 0); } ",0 "static GF_Err gf_isom_dump_srt_track(GF_ISOFile *the_file, u32 track, FILE *dump) { u32 i, j, k, count, di, len, ts, cur_frame; u64 start, end; GF_Tx3gSampleEntryBox *txtd; GF_BitStream *bs; char szDur[100]; GF_TrackBox *trak = gf_isom_get_track_from_file(the_file, track); if (!trak) return GF_BAD_PARAM; switch (trak->Media->handler->handlerType) { case GF_ISOM_MEDIA_TEXT: case GF_ISOM_MEDIA_SUBT: break; default: return GF_BAD_PARAM; } ts = trak->Media->mediaHeader->timeScale; cur_frame = 0; end = 0; count = gf_isom_get_sample_count(the_file, track); for (i=0; iDTS; if (s->dataLength==2) { gf_isom_sample_del(&s); continue; } if (i+1DTS; gf_isom_sample_del(&next); } } else { end = gf_isom_get_media_duration(the_file, track) ; } cur_frame++; fprintf(dump, ""%d\n"", cur_frame); tx3g_format_time(start, ts, szDur, GF_TRUE); fprintf(dump, ""%s --> "", szDur); tx3g_format_time(end, ts, szDur, GF_TRUE); fprintf(dump, ""%s\n"", szDur); bs = gf_bs_new(s->data, s->dataLength, GF_BITSTREAM_READ); txt = gf_isom_parse_texte_sample(bs); gf_bs_del(bs); txtd = (GF_Tx3gSampleEntryBox *)gf_list_get(trak->Media->information->sampleTable->SampleDescription->other_boxes, di-1); if (!txt->len) { fprintf(dump, ""\n""); } else { u32 styles, char_num, new_styles, color, new_color; u16 utf16Line[10000]; /*UTF16*/ if ((txt->len>2) && ((unsigned char) txt->text[0] == (unsigned char) 0xFE) && ((unsigned char) txt->text[1] == (unsigned char) 0xFF)) { memcpy(utf16Line, txt->text+2, sizeof(char)*txt->len); ( ((char *)utf16Line)[txt->len] ) = 0; len = txt->len; } else { u8 *str = (u8 *) (txt->text); size_t res = gf_utf8_mbstowcs(utf16Line, 10000, (const char **) &str); if (res==(size_t)-1) return GF_NON_COMPLIANT_BITSTREAM; len = (u32) res; utf16Line[len] = 0; } char_num = 0; styles = 0; new_styles = txtd->default_style.style_flags; color = new_color = txtd->default_style.text_color; for (j=0; jstyles) { new_styles = txtd->default_style.style_flags; new_color = txtd->default_style.text_color; for (k=0; kstyles->entry_count; k++) { if (txt->styles->styles[k].startCharOffset>char_num) continue; if (txt->styles->styles[k].endCharOffsetstyles->styles[k].style_flags & (GF_TXT_STYLE_ITALIC | GF_TXT_STYLE_BOLD | GF_TXT_STYLE_UNDERLINED)) { new_styles = txt->styles->styles[k].style_flags; new_color = txt->styles->styles[k].text_color; break; } } } if (new_styles != styles) { if ((new_styles & GF_TXT_STYLE_BOLD) && !(styles & GF_TXT_STYLE_BOLD)) fprintf(dump, """"); if ((new_styles & GF_TXT_STYLE_ITALIC) && !(styles & GF_TXT_STYLE_ITALIC)) fprintf(dump, """"); if ((new_styles & GF_TXT_STYLE_UNDERLINED) && !(styles & GF_TXT_STYLE_UNDERLINED)) fprintf(dump, """"); if ((styles & GF_TXT_STYLE_UNDERLINED) && !(new_styles & GF_TXT_STYLE_UNDERLINED)) fprintf(dump, """"); if ((styles & GF_TXT_STYLE_ITALIC) && !(new_styles & GF_TXT_STYLE_ITALIC)) fprintf(dump, """"); if ((styles & GF_TXT_STYLE_BOLD) && !(new_styles & GF_TXT_STYLE_BOLD)) fprintf(dump, """"); styles = new_styles; } if (new_color != color) { if (new_color ==txtd->default_style.text_color) { fprintf(dump, """"); } else { fprintf(dump, """", gf_color_get_name(new_color) ); } color = new_color; } /*not sure if styles must be reseted at line breaks in srt...*/ is_new_line = GF_FALSE; if ((utf16Line[j]=='\n') || (utf16Line[j]=='\r') ) { if ((utf16Line[j]=='\r') && (utf16Line[j+1]=='\n')) j++; fprintf(dump, ""\n""); is_new_line = GF_TRUE; } if (!is_new_line) { size_t sl; char szChar[30]; s16 swT[2], *swz; swT[0] = utf16Line[j]; swT[1] = 0; swz= (s16 *)swT; sl = gf_utf8_wcstombs(szChar, 30, (const unsigned short **) &swz); if (sl == (size_t)-1) sl=0; szChar[(u32) sl]=0; fprintf(dump, ""%s"", szChar); } char_num++; } new_styles = 0; if (new_styles != styles) { if (styles & GF_TXT_STYLE_UNDERLINED) fprintf(dump, """"); if (styles & GF_TXT_STYLE_ITALIC) fprintf(dump, """"); if (styles & GF_TXT_STYLE_BOLD) fprintf(dump, """"); } if (color != txtd->default_style.text_color) { fprintf(dump, """"); } fprintf(dump, ""\n""); } gf_isom_sample_del(&s); gf_isom_delete_text_sample(txt); fprintf(dump, ""\n""); gf_set_progress(""SRT Extract"", i, count); } if (count) gf_set_progress(""SRT Extract"", i, count); return GF_OK; } ",0 "daemon_linux_lvm2_lv_remove_authorized_cb (Daemon *daemon, Device *device, DBusGMethodInvocation *context, const gchar *action_id, guint num_user_data, gpointer *user_data_elements) { const gchar *group_uuid = user_data_elements[0]; const gchar *uuid = user_data_elements[1]; /* TODO: use options: gchar **options = user_data_elements[2]; */ gchar *lv_name; guint n; gchar *argv[10]; /* Unfortunately lvchange does not (yet - file a bug) accept UUIDs - so find the LV name for this * UUID by looking at PVs */ lv_name = find_lvm2_lv_name_for_uuids (daemon, group_uuid, uuid); if (lv_name == NULL) { throw_error (context, ERROR_FAILED, ""Cannot find LV with UUID `%s'"", uuid); goto out; } n = 0; argv[n++] = ""lvremove""; argv[n++] = lv_name; argv[n++] = ""--force""; argv[n++] = NULL; if (!job_new (context, ""LinuxLvm2LVRemove"", TRUE, NULL, argv, NULL, linux_lvm2_lv_remove_completed_cb, FALSE, NULL, NULL)) { goto out; } out: g_free (lv_name); } ",0 "void __napi_complete(struct napi_struct *n) { BUG_ON(!test_bit(NAPI_STATE_SCHED, &n->state)); list_del_init(&n->poll_list); smp_mb__before_atomic(); clear_bit(NAPI_STATE_SCHED, &n->state); } ",0 "static int v9fs_xattr_get_acl(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size) { struct v9fs_session_info *v9ses; struct posix_acl *acl; int error; v9ses = v9fs_dentry2v9ses(dentry); /* * We allow set/get/list of acl when access=client is not specified */ if ((v9ses->flags & V9FS_ACCESS_MASK) != V9FS_ACCESS_CLIENT) return v9fs_xattr_get(dentry, handler->name, buffer, size); acl = v9fs_get_cached_acl(inode, handler->flags); if (IS_ERR(acl)) return PTR_ERR(acl); if (acl == NULL) return -ENODATA; error = posix_acl_to_xattr(&init_user_ns, acl, buffer, size); posix_acl_release(acl); return error; } ",0 " virtual ~VP9WorkerThreadTest() {} ",0 "bool UnprivilegedProcessDelegate::Send(IPC::Message* message) { DCHECK(main_task_runner_->BelongsToCurrentThread()); return channel_->Send(message); } ",0 "static STACK_OF(X509) * load_all_certs_from_file(char *certfile) { STACK_OF(X509_INFO) *sk=NULL; STACK_OF(X509) *stack=NULL, *ret=NULL; BIO *in=NULL; X509_INFO *xi; TSRMLS_FETCH(); if(!(stack = sk_X509_new_null())) { php_error_docref(NULL TSRMLS_CC, E_ERROR, ""memory allocation failure""); goto end; } if (php_openssl_safe_mode_chk(certfile TSRMLS_CC)) { sk_X509_free(stack); goto end; } if(!(in=BIO_new_file(certfile, ""r""))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""error opening the file, %s"", certfile); sk_X509_free(stack); goto end; } /* This loads from a file, a stack of x509/crl/pkey sets */ if(!(sk=PEM_X509_INFO_read_bio(in, NULL, NULL, NULL))) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""error reading the file, %s"", certfile); sk_X509_free(stack); goto end; } /* scan over it and pull out the certs */ while (sk_X509_INFO_num(sk)) { xi=sk_X509_INFO_shift(sk); if (xi->x509 != NULL) { sk_X509_push(stack,xi->x509); xi->x509=NULL; } X509_INFO_free(xi); } if(!sk_X509_num(stack)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""no certificates in file, %s"", certfile); sk_X509_free(stack); goto end; } ret=stack; end: BIO_free(in); sk_X509_INFO_free(sk); return ret; } ",0 "PHP_FUNCTION(imagegd2) { _php_image_output(INTERNAL_FUNCTION_PARAM_PASSTHRU, PHP_GDIMG_TYPE_GD2, ""GD2"", gdImageGd2); } ",0 "void SkiaOutputSurfaceImpl::BindToClient(OutputSurfaceClient* client) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); DCHECK(client); DCHECK(!client_); client_ = client; } ",0 "void imap_logout(struct ImapData **idata) { /* we set status here to let imap_handle_untagged know we _expect_ to * receive a bye response (so it doesn't freak out and close the conn) */ (*idata)->status = IMAP_BYE; imap_cmd_start(*idata, ""LOGOUT""); if (ImapPollTimeout <= 0 || mutt_socket_poll((*idata)->conn, ImapPollTimeout) != 0) { while (imap_cmd_step(*idata) == IMAP_CMD_CONTINUE) ; } mutt_socket_close((*idata)->conn); imap_free_idata(idata); } ",0 "bool Document::shouldDisplaySeamlesslyWithParent() const { #if ENABLE(IFRAME_SEAMLESS) if (!RuntimeEnabledFeatures::seamlessIFramesEnabled()) return false; HTMLFrameOwnerElement* ownerElement = this->ownerElement(); if (!ownerElement) return false; return m_mayDisplaySeamlesslyWithParent && ownerElement->hasTagName(iframeTag) && ownerElement->fastHasAttribute(seamlessAttr); #else return false; #endif } ",0 "void GfxICCBasedColorSpace::getDefaultRanges(double *decodeLow, double *decodeRange, int maxImgPixel) { alt->getDefaultRanges(decodeLow, decodeRange, maxImgPixel); #if 0 int i; for (i = 0; i < nComps; ++i) { decodeLow[i] = rangeMin[i]; decodeRange[i] = rangeMax[i] - rangeMin[i]; } #endif } ",0 "static inline SkRegion* GetSkRegion(JNIEnv* env, jobject regionObject) { jlong regionHandle = env->GetLongField(regionObject, gRegion_nativeInstanceFieldID); SkRegion* region = reinterpret_cast(regionHandle); SkASSERT(region != NULL); return region; } ",0 "static struct sock *netlink_lookup(struct net *net, int protocol, u32 pid) { struct nl_pid_hash *hash = &nl_table[protocol].hash; struct hlist_head *head; struct sock *sk; struct hlist_node *node; read_lock(&nl_table_lock); head = nl_pid_hashfn(hash, pid); sk_for_each(sk, node, head) { if (net_eq(sock_net(sk), net) && (nlk_sk(sk)->pid == pid)) { sock_hold(sk); goto found; } } sk = NULL; found: read_unlock(&nl_table_lock); return sk; } ",0 "void AwContents::SetWindowVisibility(JNIEnv* env, jobject obj, bool visible) { DCHECK_CURRENTLY_ON(BrowserThread::UI); browser_view_renderer_.SetWindowVisibility(visible); } ",0 "status_t ProCamera2Client::createDefaultRequest(int templateId, /*out*/ camera_metadata** request) { ATRACE_CALL(); ALOGV(""%s (templateId = 0x%x)"", __FUNCTION__, templateId); if (request) { *request = NULL; } status_t res; if ( (res = checkPid(__FUNCTION__) ) != OK) return res; Mutex::Autolock icl(mBinderSerializationLock); if (!mDevice.get()) return DEAD_OBJECT; CameraMetadata metadata; if ( (res = mDevice->createDefaultRequest(templateId, &metadata) ) == OK) { *request = metadata.release(); } return res; } ",0 "double Document::timerAlignmentInterval() const { Page* p = page(); if (!p) return ExecutionContext::timerAlignmentInterval(); return p->timerAlignmentInterval(); } ",0 "Node::InsertionNotificationRequest HTMLIFrameElement::InsertedInto( ContainerNode* insertion_point) { InsertionNotificationRequest result = HTMLFrameElementBase::InsertedInto(insertion_point); if (insertion_point->IsInDocumentTree() && GetDocument().IsHTMLDocument()) ToHTMLDocument(GetDocument()).AddNamedItem(name_); LogAddElementIfIsolatedWorldAndInDocument(""iframe"", srcAttr); return result; } ",0 "bool TreeView::IsExpanded(TreeModelNode* node) { TreeModelNode* parent = model_->GetParent(node); if (!parent) return true; if (!IsExpanded(parent)) return false; NodeDetails* details = GetNodeDetails(node); return (TreeView_GetItemState(tree_view_, details->tree_item, TVIS_EXPANDED) & TVIS_EXPANDED) != 0; } ",0 "bool InspectorController::handleMouseEvent(Frame* frame, const PlatformMouseEvent& event) { m_overlay->handleMouseEvent(event); if (event.type() == PlatformEvent::MouseMoved) { if (InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent()) domAgent->handleMouseMove(frame, event); return false; } if (event.type() == PlatformEvent::MousePressed) { if (InspectorDOMAgent* domAgent = m_instrumentingAgents->inspectorDOMAgent()) return domAgent->handleMousePress(); } return false; } ",0 " explicit TestResourceMultiBuffer(UrlData* url_data, int shift) : ResourceMultiBuffer(url_data, shift) {} ",0 "xmlParseAttValueComplex(xmlParserCtxtPtr ctxt, int *attlen, int normalize) { xmlChar limit = 0; xmlChar *buf = NULL; xmlChar *rep = NULL; int len = 0; int buf_size = 0; int c, l, in_space = 0; xmlChar *current = NULL; xmlEntityPtr ent; if (NXT(0) == '""') { ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; limit = '""'; NEXT; } else if (NXT(0) == '\'') { limit = '\''; ctxt->instate = XML_PARSER_ATTRIBUTE_VALUE; NEXT; } else { xmlFatalErr(ctxt, XML_ERR_ATTRIBUTE_NOT_STARTED, NULL); return(NULL); } /* * allocate a translation buffer. */ buf_size = XML_PARSER_BUFFER_SIZE; buf = (xmlChar *) xmlMallocAtomic(buf_size * sizeof(xmlChar)); if (buf == NULL) goto mem_error; /* * OK loop until we reach one of the ending char or a size limit. */ c = CUR_CHAR(l); while ((NXT(0) != limit) && /* checked */ (IS_CHAR(c)) && (c != '<')) { if (c == 0) break; if (c == '&') { in_space = 0; if (NXT(1) == '#') { int val = xmlParseCharRef(ctxt); if (val == '&') { if (ctxt->replaceEntities) { if (len > buf_size - 10) { growBuffer(buf, 10); } buf[len++] = '&'; } else { /* * The reparsing will be done in xmlStringGetNodeList() * called by the attribute() function in SAX.c */ if (len > buf_size - 10) { growBuffer(buf, 10); } buf[len++] = '&'; buf[len++] = '#'; buf[len++] = '3'; buf[len++] = '8'; buf[len++] = ';'; } } else if (val != 0) { if (len > buf_size - 10) { growBuffer(buf, 10); } len += xmlCopyChar(0, &buf[len], val); } } else { ent = xmlParseEntityRef(ctxt); ctxt->nbentities++; if (ent != NULL) ctxt->nbentities += ent->owner; if ((ent != NULL) && (ent->etype == XML_INTERNAL_PREDEFINED_ENTITY)) { if (len > buf_size - 10) { growBuffer(buf, 10); } if ((ctxt->replaceEntities == 0) && (ent->content[0] == '&')) { buf[len++] = '&'; buf[len++] = '#'; buf[len++] = '3'; buf[len++] = '8'; buf[len++] = ';'; } else { buf[len++] = ent->content[0]; } } else if ((ent != NULL) && (ctxt->replaceEntities != 0)) { if (ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) { rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, 0, 0, 0); if (rep != NULL) { current = rep; while (*current != 0) { /* non input consuming */ if ((*current == 0xD) || (*current == 0xA) || (*current == 0x9)) { buf[len++] = 0x20; current++; } else buf[len++] = *current++; if (len > buf_size - 10) { growBuffer(buf, 10); } } xmlFree(rep); rep = NULL; } } else { if (len > buf_size - 10) { growBuffer(buf, 10); } if (ent->content != NULL) buf[len++] = ent->content[0]; } } else if (ent != NULL) { int i = xmlStrlen(ent->name); const xmlChar *cur = ent->name; /* * This may look absurd but is needed to detect * entities problems */ if ((ent->etype != XML_INTERNAL_PREDEFINED_ENTITY) && (ent->content != NULL)) { rep = xmlStringDecodeEntities(ctxt, ent->content, XML_SUBSTITUTE_REF, 0, 0, 0); if (rep != NULL) { xmlFree(rep); rep = NULL; } } /* * Just output the reference */ buf[len++] = '&'; while (len > buf_size - i - 10) { growBuffer(buf, i + 10); } for (;i > 0;i--) buf[len++] = *cur++; buf[len++] = ';'; } } } else { if ((c == 0x20) || (c == 0xD) || (c == 0xA) || (c == 0x9)) { if ((len != 0) || (!normalize)) { if ((!normalize) || (!in_space)) { COPY_BUF(l,buf,len,0x20); while (len > buf_size - 10) { growBuffer(buf, 10); } } in_space = 1; } } else { in_space = 0; COPY_BUF(l,buf,len,c); if (len > buf_size - 10) { growBuffer(buf, 10); } } NEXTL(l); } GROW; c = CUR_CHAR(l); } if ((in_space) && (normalize)) { while ((len > 0) && (buf[len - 1] == 0x20)) len--; } buf[len] = 0; if (RAW == '<') { xmlFatalErr(ctxt, XML_ERR_LT_IN_ATTRIBUTE, NULL); } else if (RAW != limit) { if ((c != 0) && (!IS_CHAR(c))) { xmlFatalErrMsg(ctxt, XML_ERR_INVALID_CHAR, ""invalid character in attribute value\n""); } else { xmlFatalErrMsg(ctxt, XML_ERR_ATTRIBUTE_NOT_FINISHED, ""AttValue: ' expected\n""); } } else NEXT; if (attlen != NULL) *attlen = len; return(buf); mem_error: xmlErrMemory(ctxt, NULL); if (buf != NULL) xmlFree(buf); if (rep != NULL) xmlFree(rep); return(NULL); } ",1 "void HTMLStyleElement::DidNotifySubtreeInsertionsToDocument() { if (StyleElement::ProcessStyleSheet(GetDocument(), *this) == StyleElement::kProcessingFatalError) NotifyLoadedSheetAndAllCriticalSubresources( kErrorOccurredLoadingSubresource); } ",1 "PHP_FUNCTION(pg_lo_unlink) { zval *pgsql_link = NULL; long oid_long; char *oid_string, *end_ptr; int oid_strlen; PGconn *pgsql; Oid oid; int id = -1; int argc = ZEND_NUM_ARGS(); /* accept string type since Oid type is unsigned int */ if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rs"", &pgsql_link, &oid_string, &oid_strlen) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""rl"", &pgsql_link, &oid_long) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID specified""); RETURN_FALSE; } oid = (Oid)oid_long; } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""s"", &oid_string, &oid_strlen) == SUCCESS) { oid = (Oid)strtoul(oid_string, &end_ptr, 10); if ((oid_string+oid_strlen) != end_ptr) { /* wrong integer format */ php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Wrong OID value passed""); RETURN_FALSE; } id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, argc TSRMLS_CC, ""l"", &oid_long) == SUCCESS) { if (oid_long <= InvalidOid) { php_error_docref(NULL TSRMLS_CC, E_NOTICE, ""Invalid OID is specified""); RETURN_FALSE; } oid = (Oid)oid_long; id = PGG(default_link); CHECK_DEFAULT_LINK(id); } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Requires 1 or 2 arguments""); RETURN_FALSE; } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (lo_unlink(pgsql, oid) == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to delete PostgreSQL large object %u"", oid); RETURN_FALSE; } RETURN_TRUE; } ",0 "void GLManager::SetupBaseContext() { if (use_count_) { #if defined(OS_ANDROID) base_share_group_ = new scoped_refptr(new gl::GLShareGroup); gfx::Size size(4, 4); base_surface_ = new scoped_refptr( gl::init::CreateOffscreenGLSurface(size)); base_context_ = new scoped_refptr(gl::init::CreateGLContext( base_share_group_->get(), base_surface_->get(), gl::GLContextAttribs())); g_gpu_feature_info.ApplyToGLContext(base_context_->get()); #endif } ++use_count_; } ",0 "nautilus_mime_activate_file (GtkWindow *parent_window, NautilusWindowSlot *slot, NautilusFile *file, const char *launch_directory, NautilusWindowOpenFlags flags) { GList *files; g_return_if_fail (NAUTILUS_IS_FILE (file)); files = g_list_prepend (NULL, file); nautilus_mime_activate_files (parent_window, slot, files, launch_directory, flags, FALSE); g_list_free (files); } ",0 " AutoFillQueryXmlParser::AutoFillQueryXmlParser( std::vector* field_types, UploadRequired* upload_required) : field_types_(field_types), upload_required_(upload_required) { DCHECK(upload_required_); } ",1 "bool AutocompleteEditModel::UpdatePermanentText( const string16& new_permanent_text) { const bool visibly_changed_permanent_text = (permanent_text_ != new_permanent_text) && (!user_input_in_progress_ || !has_focus_); permanent_text_ = new_permanent_text; return visibly_changed_permanent_text; } ",0 " void InitializeWithFailingProofVerification() { Initialize(false); std::unique_ptr proof_verifier( new FailingProofVerifier); std::unique_ptr crypto_client_config = std::make_unique( std::move(proof_verifier), quic::TlsClientHandshaker::CreateSslCtx()); client_peer_->quic_transport()->set_crypto_client_config( std::move(crypto_client_config)); client_peer_->quic_transport()->InitializeCryptoStream(); server_peer_->quic_transport()->InitializeCryptoStream(); } ",0 "packed_cell_free(packed_cell_t *cell) { packed_cell_free_unchecked(cell); } ",0 "cmsBool IsEmptyLayer(cmsMAT3* m, cmsVEC3* off) { cmsFloat64Number diff = 0; cmsMAT3 Ident; int i; if (m == NULL && off == NULL) return TRUE; // NULL is allowed as an empty layer if (m == NULL && off != NULL) return FALSE; // This is an internal error _cmsMAT3identity(&Ident); for (i=0; i < 3*3; i++) diff += fabs(((cmsFloat64Number*)m)[i] - ((cmsFloat64Number*)&Ident)[i]); for (i=0; i < 3; i++) diff += fabs(((cmsFloat64Number*)off)[i]); return (diff < 0.002); } ",0 "mode_t dest_mode(mode_t flist_mode, mode_t stat_mode, int dflt_perms, int exists) { int new_mode; /* If the file already exists, we'll return the local permissions, * possibly tweaked by the --executability option. */ if (exists) { new_mode = (flist_mode & ~CHMOD_BITS) | (stat_mode & CHMOD_BITS); if (preserve_executability && S_ISREG(flist_mode)) { /* If the source file is executable, grant execute * rights to everyone who can read, but ONLY if the * file isn't already executable. */ if (!(flist_mode & 0111)) new_mode &= ~0111; else if (!(stat_mode & 0111)) new_mode |= (new_mode & 0444) >> 2; } } else { /* Apply destination default permissions and turn * off special permissions. */ new_mode = flist_mode & (~CHMOD_BITS | dflt_perms); } return new_mode; } ",0 "static void setup_dell_poweredge_oem_data_handler(struct smi_info *smi_info) { struct ipmi_device_id *id = &smi_info->device_id; if (id->manufacturer_id == DELL_IANA_MFR_ID) { if (id->device_id == DELL_POWEREDGE_8G_BMC_DEVICE_ID && id->device_revision == DELL_POWEREDGE_8G_BMC_DEVICE_REV && id->ipmi_version == DELL_POWEREDGE_8G_BMC_IPMI_VERSION) { smi_info->oem_data_avail_handler = oem_data_avail_to_receive_msg_avail; } else if (ipmi_version_major(id) < 1 || (ipmi_version_major(id) == 1 && ipmi_version_minor(id) < 5)) { smi_info->oem_data_avail_handler = oem_data_avail_to_receive_msg_avail; } } } ",0 " GetAdditionalAllowedSchemesForFileSystem( std::vector* additional_allowed_schemes) { additional_allowed_schemes->push_back(kExtensionScheme); } ",0 "static int check_cert(X509_STORE *ctx, X509 *x, STACK_OF(X509) *untrustedchain, int purpose) { int ret=0; X509_STORE_CTX *csc; TSRMLS_FETCH(); csc = X509_STORE_CTX_new(); if (csc == NULL) { php_error_docref(NULL TSRMLS_CC, E_ERROR, ""memory allocation failure""); return 0; } X509_STORE_CTX_init(csc, ctx, x, untrustedchain); if(purpose >= 0) { X509_STORE_CTX_set_purpose(csc, purpose); } ret = X509_verify_cert(csc); X509_STORE_CTX_free(csc); return ret; } ",0 "int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, struct usb_dev_state *owner) { int rc; struct usb_dev_state **powner; rc = find_port_owner(hdev, port1, &powner); if (rc) return rc; if (*powner) return -EBUSY; *powner = owner; return rc; } ",0 "void PrintWebViewHelper::PrintPreviewContext::InitWithFrame( blink::WebLocalFrame* web_frame) { DCHECK(web_frame); DCHECK(!IsRendering()); state_ = INITIALIZED; source_frame_.Reset(web_frame); source_node_.reset(); } ",0 "static struct dentry *ext4_fh_to_parent(struct super_block *sb, struct fid *fid, int fh_len, int fh_type) { return generic_fh_to_parent(sb, fid, fh_len, fh_type, ext4_nfs_get_inode); } ",0 "void InjectedBundlePage::didReceiveContentLengthForResource(WKBundlePageRef, WKBundleFrameRef, uint64_t, uint64_t) { } ",0 "xmlXPathCompAndExpr(xmlXPathParserContextPtr ctxt) { xmlXPathCompEqualityExpr(ctxt); CHECK_ERROR; SKIP_BLANKS; while ((CUR == 'a') && (NXT(1) == 'n') && (NXT(2) == 'd')) { int op1 = ctxt->comp->last; SKIP(3); SKIP_BLANKS; xmlXPathCompEqualityExpr(ctxt); CHECK_ERROR; PUSH_BINARY_EXPR(XPATH_OP_AND, op1, ctxt->comp->last, 0, 0); SKIP_BLANKS; } } ",0 "png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length) { png_alloc_size_t limit = PNG_SIZE_MAX; if (png_ptr->unknown_chunk.data != NULL) { png_free(png_ptr, png_ptr->unknown_chunk.data); png_ptr->unknown_chunk.data = NULL; } # ifdef PNG_SET_USER_LIMITS_SUPPORTED if (png_ptr->user_chunk_malloc_max > 0 && png_ptr->user_chunk_malloc_max < limit) limit = png_ptr->user_chunk_malloc_max; # elif PNG_USER_CHUNK_MALLOC_MAX > 0 if (PNG_USER_CHUNK_MALLOC_MAX < limit) limit = PNG_USER_CHUNK_MALLOC_MAX; # endif if (length <= limit) { PNG_CSTRING_FROM_CHUNK(png_ptr->unknown_chunk.name, png_ptr->chunk_name); /* The following is safe because of the PNG_SIZE_MAX init above */ png_ptr->unknown_chunk.size = (size_t)length/*SAFE*/; /* 'mode' is a flag array, only the bottom four bits matter here */ png_ptr->unknown_chunk.location = (png_byte)png_ptr->mode/*SAFE*/; if (length == 0) png_ptr->unknown_chunk.data = NULL; else { /* Do a 'warn' here - it is handled below. */ png_ptr->unknown_chunk.data = png_voidcast(png_bytep, png_malloc_warn(png_ptr, length)); } } if (png_ptr->unknown_chunk.data == NULL && length > 0) { /* This is benign because we clean up correctly */ png_crc_finish(png_ptr, length); png_chunk_benign_error(png_ptr, ""unknown chunk exceeds memory limits""); return 0; } else { if (length > 0) png_crc_read(png_ptr, png_ptr->unknown_chunk.data, length); png_crc_finish(png_ptr, 0); return 1; } } ",0 "void SetJavaExceptionInfo(const char* info_string) { static crashpad::StringAnnotation<5 * 4096> exception_info(""exception_info""); if (info_string) { exception_info.Set(info_string); } else { exception_info.Clear(); } } ",0 "void NPN_ReloadPlugins(NPBool reloadPages) { DLOG(INFO) << ""NPN_ReloadPlugin is not implemented yet.""; } ",0 " static void CopyElementsImpl(FixedArrayBase* from, uint32_t from_start, FixedArrayBase* to, ElementsKind from_kind, uint32_t to_start, int packed_size, int copy_size) { UNREACHABLE(); } ",0 "static int trimDynamic(dynamicPtr *dp) { /* 2.0.21: we don't reallocate memory we don't own */ if(!dp->freeOK) { return TRUE; } return gdReallocDynamic(dp, dp->logicalSize); } ",0 "static int vsr_get(struct task_struct *target, const struct user_regset *regset, unsigned int pos, unsigned int count, void *kbuf, void __user *ubuf) { u64 buf[32]; int ret, i; flush_tmregs_to_thread(target); flush_fp_to_thread(target); flush_altivec_to_thread(target); flush_vsx_to_thread(target); for (i = 0; i < 32 ; i++) buf[i] = target->thread.fp_state.fpr[i][TS_VSRLOWOFFSET]; ret = user_regset_copyout(&pos, &count, &kbuf, &ubuf, buf, 0, 32 * sizeof(double)); return ret; } ",0 "get_ofp14_async_config_prop_by_prop_type(uint64_t prop_type) { FOR_EACH_ASYNC_PROP (ap) { if (prop_type == ap->prop_type) { return ap; } } return NULL; } ",0 "mlist_free(struct mlist *mlist) { struct mlist *ml; if (mlist == NULL) return; for (ml = mlist->next; ml != mlist;) { struct mlist *next = ml->next; if (ml->map) apprentice_unmap(ml->map); free(ml); ml = next; } free(ml); } ",0 "scan_sources (GList *files, SourceInfo *source_info, CommonJob *job, OpKind kind) { GList *l; GFile *file; g_autoptr (GHashTable) scanned = NULL; memset (source_info, 0, sizeof (SourceInfo)); source_info->op = kind; scanned = g_hash_table_new_full (g_str_hash, g_str_equal, (GDestroyNotify) g_free, NULL); report_preparing_count_progress (job, source_info); for (l = files; l != NULL && !job_aborted (job); l = l->next) { file = l->data; scan_file (file, source_info, job, scanned); } /* Make sure we report the final count */ report_preparing_count_progress (job, source_info); } ",0 "static void activityLoggedAttrGetter1AttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""activityLoggedAttrGetter1"", ""TestObject"", info.Holder(), info.GetIsolate()); TestObject* imp = V8TestObject::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState); imp->setActivityLoggedAttrGetter1(cppValue); } ",0 "CSSStyleSheet::InspectorMutationScope::~InspectorMutationScope() { style_sheet_->DisableRuleAccessForInspector(); } ",0 "static void vcc_sock_destruct(struct sock *sk) { if (atomic_read(&sk->sk_rmem_alloc)) printk(KERN_DEBUG ""%s: rmem leakage (%d bytes) detected.\n"", __func__, atomic_read(&sk->sk_rmem_alloc)); if (atomic_read(&sk->sk_wmem_alloc)) printk(KERN_DEBUG ""%s: wmem leakage (%d bytes) detected.\n"", __func__, atomic_read(&sk->sk_wmem_alloc)); } ",0 "scoped_ptr GDataDirectory::ToProtoVector() const { scoped_ptr entries(new GDataEntryProtoVector); for (GDataFileCollection::const_iterator iter = child_files().begin(); iter != child_files().end(); ++iter) { GDataEntryProto proto; iter->second->ToProto(&proto); entries->push_back(proto); } for (GDataDirectoryCollection::const_iterator iter = child_directories().begin(); iter != child_directories().end(); ++iter) { GDataEntryProto proto; static_cast(iter->second)->ToProtoFull(&proto); entries->push_back(proto); } return entries.Pass(); } ",0 "nfs_check_exportfs(void) { pid_t pid; int rc, status; static char nfs_exportfs_tempfile[] = ""/tmp/exportfs.XXXXXX""; /* * Close any existing temporary copies of output from exportfs. * We have already called unlink() so file will be deleted. */ if (nfs_exportfs_temp_fd >= 0) close(nfs_exportfs_temp_fd); nfs_exportfs_temp_fd = mkstemp(nfs_exportfs_tempfile); if (nfs_exportfs_temp_fd < 0) return (SA_SYSTEM_ERR); unlink(nfs_exportfs_tempfile); fcntl(nfs_exportfs_temp_fd, F_SETFD, FD_CLOEXEC); pid = fork(); if (pid < 0) { (void) close(nfs_exportfs_temp_fd); nfs_exportfs_temp_fd = -1; return (SA_SYSTEM_ERR); } if (pid > 0) { while ((rc = waitpid(pid, &status, 0)) <= 0 && errno == EINTR); if (rc <= 0) { (void) close(nfs_exportfs_temp_fd); nfs_exportfs_temp_fd = -1; return (SA_SYSTEM_ERR); } if (!WIFEXITED(status) || WEXITSTATUS(status) != 0) { (void) close(nfs_exportfs_temp_fd); nfs_exportfs_temp_fd = -1; return (SA_CONFIG_ERR); } return (SA_OK); } /* child */ /* exportfs -v */ if (dup2(nfs_exportfs_temp_fd, STDOUT_FILENO) < 0) exit(1); rc = execlp(""/usr/sbin/exportfs"", ""exportfs"", ""-v"", NULL); if (rc < 0) { exit(1); } exit(0); } ",0 "void vrend_set_scissor_state(struct vrend_context *ctx, uint32_t start_slot, uint32_t num_scissor, struct pipe_scissor_state *ss) { int i, idx; if (start_slot > PIPE_MAX_VIEWPORTS || num_scissor > (PIPE_MAX_VIEWPORTS - start_slot)) { vrend_report_buffer_error(ctx, 0); return; } for (i = 0; i < num_scissor; i++) { idx = start_slot + i; ctx->sub->ss[idx] = ss[i]; ctx->sub->scissor_state_dirty |= (1 << idx); } } ",0 "static void VoidMethodInt32ArrayArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""voidMethodInt32ArrayArg""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } NotShared int32_array_arg; int32_array_arg = ToNotShared>(info.GetIsolate(), info[0], exception_state); if (exception_state.HadException()) return; if (!int32_array_arg) { exception_state.ThrowTypeError(ExceptionMessages::ArgumentNotOfType(0, ""Int32Array"")); return; } impl->voidMethodInt32ArrayArg(int32_array_arg); } ",0 "int RunLengthStream::getChars(int nChars, Guchar *buffer) { int n, m; n = 0; while (n < nChars) { if (bufPtr >= bufEnd) { if (!fillBuf()) { break; } } m = (int)(bufEnd - bufPtr); if (m > nChars - n) { m = nChars - n; } memcpy(buffer + n, bufPtr, m); bufPtr += m; n += m; } return n; } ",0 "static struct rb_node **fuse_find_polled_node(struct fuse_conn *fc, u64 kh, struct rb_node **parent_out) { struct rb_node **link = &fc->polled_files.rb_node; struct rb_node *last = NULL; while (*link) { struct fuse_file *ff; last = *link; ff = rb_entry(last, struct fuse_file, polled_node); if (kh < ff->kh) link = &last->rb_left; else if (kh > ff->kh) link = &last->rb_right; else return link; } if (parent_out) *parent_out = last; return link; } ",0 "xmlParsePI(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; int cur, l; const xmlChar *target; xmlParserInputState state; int count = 0; if ((RAW == '<') && (NXT(1) == '?')) { xmlParserInputPtr input = ctxt->input; state = ctxt->instate; ctxt->instate = XML_PARSER_PI; /* * this is a Processing Instruction. */ SKIP(2); SHRINK; /* * Parse the target name and check for special support like * namespace. */ target = xmlParsePITarget(ctxt); if (target != NULL) { if ((RAW == '?') && (NXT(1) == '>')) { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, ""PI declaration doesn't start and stop in the same entity\n""); } SKIP(2); /* * SAX: PI detected. */ if ((ctxt->sax) && (!ctxt->disableSAX) && (ctxt->sax->processingInstruction != NULL)) ctxt->sax->processingInstruction(ctxt->userData, target, NULL); if (ctxt->instate != XML_PARSER_EOF) ctxt->instate = state; return; } buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); ctxt->instate = state; return; } cur = CUR; if (!IS_BLANK(cur)) { xmlFatalErrMsgStr(ctxt, XML_ERR_SPACE_REQUIRED, ""ParsePI: PI %s space expected\n"", target); } SKIP_BLANKS; cur = CUR_CHAR(l); while (IS_CHAR(cur) && /* checked */ ((cur != '?') || (NXT(1) != '>'))) { if (len + 5 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); ctxt->instate = state; return; } buf = tmp; } count++; if (count > 50) { GROW; count = 0; } COPY_BUF(l,buf,len,cur); NEXTL(l); cur = CUR_CHAR(l); if (cur == 0) { SHRINK; GROW; cur = CUR_CHAR(l); } } buf[len] = 0; if (cur != '?') { xmlFatalErrMsgStr(ctxt, XML_ERR_PI_NOT_FINISHED, ""ParsePI: PI %s never end ...\n"", target); } else { if (input != ctxt->input) { xmlFatalErrMsg(ctxt, XML_ERR_SPACE_REQUIRED, ""PI declaration doesn't start and stop in the same entity\n""); } SKIP(2); #ifdef LIBXML_CATALOG_ENABLED if (((state == XML_PARSER_MISC) || (state == XML_PARSER_START)) && (xmlStrEqual(target, XML_CATALOG_PI))) { xmlCatalogAllow allow = xmlCatalogGetDefaults(); if ((allow == XML_CATA_ALLOW_DOCUMENT) || (allow == XML_CATA_ALLOW_ALL)) xmlParseCatalogPI(ctxt, buf); } #endif /* * SAX: PI detected. */ if ((ctxt->sax) && (!ctxt->disableSAX) && (ctxt->sax->processingInstruction != NULL)) ctxt->sax->processingInstruction(ctxt->userData, target, buf); } xmlFree(buf); } else { xmlFatalErr(ctxt, XML_ERR_PI_NOT_STARTED, NULL); } if (ctxt->instate != XML_PARSER_EOF) ctxt->instate = state; } } ",0 "int ssl_set_client_hello_version(SSL *s) { int ver_min, ver_max, ret; ret = ssl_get_client_min_max_version(s, &ver_min, &ver_max); if (ret != 0) return ret; s->client_version = s->version = ver_max; return 0; } ",0 "void FileSystemOperationRunner::DidCreateSnapshot( const OperationID id, SnapshotFileCallback callback, base::File::Error rv, const base::File::Info& file_info, const base::FilePath& platform_path, scoped_refptr file_ref) { if (is_beginning_operation_) { finished_operations_.insert(id); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&FileSystemOperationRunner::DidCreateSnapshot, weak_ptr_, id, std::move(callback), rv, file_info, platform_path, std::move(file_ref))); return; } std::move(callback).Run(rv, file_info, platform_path, std::move(file_ref)); FinishOperation(id); } ",0 "static v8::Handle enabledAtRuntimeAttr1AttrGetter(v8::Local name, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.enabledAtRuntimeAttr1._get""); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Integer::New(imp->enabledAtRuntimeAttr1()); } ",0 "SoftAVC::~SoftAVC() { CHECK_EQ(deInitDecoder(), (status_t)OK); } ",0 " WebstoreInlineInstallerForTest(WebContents* contents, content::RenderFrameHost* host, const std::string& extension_id, const GURL& requestor_url, const Callback& callback) : WebstoreInlineInstaller( contents, host, kTestExtensionId, requestor_url, base::Bind(&WebstoreInlineInstallerForTest::InstallCallback, base::Unretained(this))), install_result_target_(nullptr), programmable_prompt_(nullptr) {} ",0 "void AXNodeObject::insertChild(AXObject* child, unsigned index) { if (!child) return; child->clearChildren(); if (child->accessibilityIsIgnored()) { const auto& children = child->children(); size_t length = children.size(); for (size_t i = 0; i < length; ++i) m_children.insert(index + i, children[i]); } else { ASSERT(child->parentObject() == this); m_children.insert(index, child); } } ",0 " BpCameraRecordingProxy(const sp& impl) : BpInterface(impl) { } ",0 "AwContents::GetWebContents(JNIEnv* env, jobject obj) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(web_contents_); if (!web_contents_) return base::android::ScopedJavaLocalRef(); return web_contents_->GetJavaWebContents(); } ",0 "static PlatformWheelEvent constructRelativeWheelEvent(const PlatformWheelEvent& e, FramelessScrollView* parent, FramelessScrollView* child) { IntPoint pos = parent->convertSelfToChild(child, e.position()); PlatformWheelEvent relativeEvent = e; IntPoint& relativePos = const_cast(relativeEvent.position()); relativePos.setX(pos.x()); relativePos.setY(pos.y()); return relativeEvent; } ",0 "static void SetColorBalance(double red,double green,double blue, FPXColorTwistMatrix *color_twist) { FPXColorTwistMatrix blue_effect, green_effect, result, rgb_effect, rg_effect, red_effect; /* Set image color balance in color twist matrix. */ assert(color_twist != (FPXColorTwistMatrix *) NULL); red=sqrt((double) red)-1.0; green=sqrt((double) green)-1.0; blue=sqrt((double) blue)-1.0; red_effect.byy=1.0; red_effect.byc1=0.0; red_effect.byc2=0.299*red; red_effect.dummy1_zero=0.0; red_effect.bc1y=(-0.299)*red; red_effect.bc1c1=1.0-0.299*red; red_effect.bc1c2=(-0.299)*red; red_effect.dummy2_zero=0.0; red_effect.bc2y=0.701*red; red_effect.bc2c1=0.0; red_effect.bc2c2=1.0+0.402*red; red_effect.dummy3_zero=0.0; red_effect.dummy4_zero=0.0; red_effect.dummy5_zero=0.0; red_effect.dummy6_zero=0.0; red_effect.dummy7_one=1.0; green_effect.byy=1.0; green_effect.byc1=(-0.114)*green; green_effect.byc2=(-0.299)*green; green_effect.dummy1_zero=0.0; green_effect.bc1y=(-0.587)*green; green_effect.bc1c1=1.0-0.473*green; green_effect.bc1c2=0.299*green; green_effect.dummy2_zero=0.0; green_effect.bc2y=(-0.587)*green; green_effect.bc2c1=0.114*green; green_effect.bc2c2=1.0-0.288*green; green_effect.dummy3_zero=0.0; green_effect.dummy4_zero=0.0; green_effect.dummy5_zero=0.0; green_effect.dummy6_zero=0.0; green_effect.dummy7_one=1.0; blue_effect.byy=1.0; blue_effect.byc1=0.114*blue; blue_effect.byc2=0.0; blue_effect.dummy1_zero=0.0; blue_effect.bc1y=0.886*blue; blue_effect.bc1c1=1.0+0.772*blue; blue_effect.bc1c2=0.0; blue_effect.dummy2_zero=0.0; blue_effect.bc2y=(-0.114)*blue; blue_effect.bc2c1=(-0.114)*blue; blue_effect.bc2c2=1.0-0.114*blue; blue_effect.dummy3_zero=0.0; blue_effect.dummy4_zero=0.0; blue_effect.dummy5_zero=0.0; blue_effect.dummy6_zero=0.0; blue_effect.dummy7_one=1.0; ColorTwistMultiply(red_effect,green_effect,&rg_effect); ColorTwistMultiply(rg_effect,blue_effect,&rgb_effect); ColorTwistMultiply(*color_twist,rgb_effect,&result); *color_twist=result; } ",0 "PHP_FUNCTION(pg_prepare) { zval *pgsql_link = NULL; char *query, *stmtname; size_t query_len, stmtname_len; int id = -1, argc = ZEND_NUM_ARGS(); int leftover = 0; PGconn *pgsql; PGresult *pgsql_result; ExecStatusType status; pgsql_result_handle *pg_result; if (argc == 2) { if (zend_parse_parameters(argc, ""ss"", &stmtname, &stmtname_len, &query, &query_len) == FAILURE) { return; } id = FETCH_DEFAULT_LINK(); CHECK_DEFAULT_LINK(id); } else { if (zend_parse_parameters(argc, ""rss"", &pgsql_link, &stmtname, &stmtname_len, &query, &query_len) == FAILURE) { return; } } if (pgsql_link == NULL && id == -1) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, pgsql_link, id, ""PostgreSQL link"", le_link, le_plink); if (PQ_SETNONBLOCKING(pgsql, 0)) { php_error_docref(NULL, E_NOTICE,""Cannot set connection to blocking mode""); RETURN_FALSE; } while ((pgsql_result = PQgetResult(pgsql))) { PQclear(pgsql_result); leftover = 1; } if (leftover) { php_error_docref(NULL, E_NOTICE, ""Found results on this connection. Use pg_get_result() to get these results first""); } pgsql_result = PQprepare(pgsql, stmtname, query, 0, NULL); if ((PGG(auto_reset_persistent) & 2) && PQstatus(pgsql) != CONNECTION_OK) { PQclear(pgsql_result); PQreset(pgsql); pgsql_result = PQprepare(pgsql, stmtname, query, 0, NULL); } if (pgsql_result) { status = PQresultStatus(pgsql_result); } else { status = (ExecStatusType) PQstatus(pgsql); } switch (status) { case PGRES_EMPTY_QUERY: case PGRES_BAD_RESPONSE: case PGRES_NONFATAL_ERROR: case PGRES_FATAL_ERROR: PHP_PQ_ERROR(""Query failed: %s"", pgsql); PQclear(pgsql_result); RETURN_FALSE; break; case PGRES_COMMAND_OK: /* successful command that did not return rows */ default: if (pgsql_result) { pg_result = (pgsql_result_handle *) emalloc(sizeof(pgsql_result_handle)); pg_result->conn = pgsql; pg_result->result = pgsql_result; pg_result->row = 0; ZEND_REGISTER_RESOURCE(return_value, pg_result, le_result); } else { PQclear(pgsql_result); RETURN_FALSE; } break; } } ",0 "static void reset_interrupt(void) { debugt(__func__, """"); result(); /* get the status ready for set_fdc */ if (FDCS->reset) { pr_info(""reset set in interrupt, calling %pf\n"", cont->error); cont->error(); /* a reset just after a reset. BAD! */ } cont->redo(); } ",0 "bool WebContentsImpl::RequestKeyboardLock( RenderWidgetHostImpl* render_widget_host, bool esc_key_locked) { DCHECK(render_widget_host); if (render_widget_host->delegate()->GetAsWebContents() != this) { NOTREACHED(); return false; } if (GetOuterWebContents()) return false; esc_key_locked_ = esc_key_locked; keyboard_lock_widget_ = render_widget_host; if (delegate_) delegate_->RequestKeyboardLock(this, esc_key_locked_); return true; } ",0 "error::Error GLES2DecoderImpl::HandleCompressedTexImage2D( uint32 immediate_data_size, const gles2::CompressedTexImage2D& c) { GLenum target = static_cast(c.target); GLint level = static_cast(c.level); GLenum internal_format = static_cast(c.internalformat); GLsizei width = static_cast(c.width); GLsizei height = static_cast(c.height); GLint border = static_cast(c.border); GLsizei image_size = static_cast(c.imageSize); uint32 data_shm_id = static_cast(c.data_shm_id); uint32 data_shm_offset = static_cast(c.data_shm_offset); const void* data = NULL; if (data_shm_id != 0 || data_shm_offset != 0) { data = GetSharedMemoryAs( data_shm_id, data_shm_offset, image_size); if (!data) { return error::kOutOfBounds; } } return DoCompressedTexImage2D( target, level, internal_format, width, height, border, image_size, data); } ",0 " explicit PreloadTask(const HTMLToken& token) : m_tagName(token.name().data(), token.name().size()) , m_linkIsStyleSheet(false) , m_linkMediaAttributeIsScreen(true) , m_inputIsImage(false) { processAttributes(token.attributes()); } ",0 " gray_raster_done( FT_Raster raster ) { /* nothing */ FT_UNUSED( raster ); } ",0 "void CL_RefTagFree( void ) { Z_FreeTags( TAG_RENDERER ); return; } ",0 "void set_numabalancing_state(bool enabled) { if (enabled) sched_feat_set(""NUMA""); else sched_feat_set(""NO_NUMA""); } ",0 "static __net_init int sysctl_route_net_init(struct net *net) { struct ctl_table *tbl; tbl = ipv4_route_flush_table; if (!net_eq(net, &init_net)) { tbl = kmemdup(tbl, sizeof(ipv4_route_flush_table), GFP_KERNEL); if (tbl == NULL) goto err_dup; /* Don't export sysctls to unprivileged users */ if (net->user_ns != &init_user_ns) tbl[0].procname = NULL; } tbl[0].extra1 = net; net->ipv4.route_hdr = register_net_sysctl(net, ""net/ipv4/route"", tbl); if (net->ipv4.route_hdr == NULL) goto err_reg; return 0; err_reg: if (tbl != ipv4_route_flush_table) kfree(tbl); err_dup: return -ENOMEM; } ",0 "static int analyzeAggregatesInSelect(Walker *pWalker, Select *pSelect){ UNUSED_PARAMETER(pWalker); UNUSED_PARAMETER(pSelect); return WRC_Continue; } ",0 "filter_list_free (GList *filters) { g_list_free_full (filters, (GDestroyNotify)filter_free); } ",0 "static int __init set_tracepoint_printk(char *str) { if ((strcmp(str, ""=0"") != 0 && strcmp(str, ""=off"") != 0)) tracepoint_printk = 1; return 1; } ",0 "void inode_dio_done(struct inode *inode) { if (atomic_dec_and_test(&inode->i_dio_count)) wake_up_bit(&inode->i_state, __I_DIO_WAKEUP); } ",0 "void WebRuntimeFeatures::enableEncryptedMedia(bool enable) { RuntimeEnabledFeatures::setEncryptedMediaEnabled(enable); RuntimeEnabledFeatures::setEncryptedMediaAnyVersionEnabled( RuntimeEnabledFeatures::encryptedMediaEnabled() || RuntimeEnabledFeatures::prefixedEncryptedMediaEnabled()); } ",0 "PHP_FUNCTION(dom_document_adopt_node) { DOM_NOT_IMPLEMENTED(); } ",0 "void kvm_queue_exception_e(struct kvm_vcpu *vcpu, unsigned nr, u32 error_code) { kvm_multiple_exception(vcpu, nr, true, error_code, false); } ",0 "unsigned long long random_ull(void) { int fd; uint64_t ull; ssize_t r; if ((fd = open(""/dev/urandom"", O_RDONLY|O_CLOEXEC|O_NOCTTY)) < 0) goto fallback; r = loop_read(fd, &ull, sizeof(ull), true); close_nointr_nofail(fd); if (r != sizeof(ull)) goto fallback; return ull; fallback: return random() * RAND_MAX + random(); } ",0 "static int http_write(URLContext *h, const uint8_t *buf, int size) { char temp[11] = """"; /* 32-bit hex + CRLF + nul */ int ret; char crlf[] = ""\r\n""; HTTPContext *s = h->priv_data; if (!s->chunked_post) { /* non-chunked data is sent without any special encoding */ return ffurl_write(s->hd, buf, size); } /* silently ignore zero-size data since chunk encoding that would * signal EOF */ if (size > 0) { /* upload data using chunked encoding */ snprintf(temp, sizeof(temp), ""%x\r\n"", size); if ((ret = ffurl_write(s->hd, temp, strlen(temp))) < 0 || (ret = ffurl_write(s->hd, buf, size)) < 0 || (ret = ffurl_write(s->hd, crlf, sizeof(crlf) - 1)) < 0) return ret; } return size; } ",0 "void BrowserView::RotatePaneFocus(bool forwards) { std::vector accessible_panes; GetAccessiblePanes(&accessible_panes); int pane_count = static_cast(accessible_panes.size()); int special_index = -1; std::vector accessible_views( accessible_panes.begin(), accessible_panes.end()); accessible_views.push_back(GetTabContentsContainerView()); if (devtools_container_->visible()) accessible_views.push_back(devtools_container_); int count = static_cast(accessible_views.size()); const views::View* focused_view = GetFocusManager()->GetFocusedView(); int index = -1; if (focused_view) { for (int i = 0; i < count; ++i) { if (accessible_views[i] == focused_view || accessible_views[i]->Contains(focused_view)) { index = i; break; } } } if (focused_view && index >= pane_count) GetFocusManager()->StoreFocusedView(); #if defined(OS_CHROMEOS) && defined(USE_AURA) special_index = count; ++count; #endif for (;;) { if (forwards) index = (index + 1) % count; else index = ((index - 1) + count) % count; if (index == special_index) { #if defined(USE_ASH) ash::Shell::GetInstance()->RotateFocus( forwards ? ash::Shell::FORWARD : ash::Shell::BACKWARD); #endif break; } else if (index < pane_count) { if (accessible_panes[index]->SetPaneFocusAndFocusDefault()) break; } else { accessible_views[index]->RequestFocus(); break; } } } ",0 "void WebPluginDelegateProxy::OnCancelDocumentLoad() { plugin_->CancelDocumentLoad(); } ",0 "void InputMethodIBus::set_ibus_client( scoped_ptr new_client) { ibus_client_.swap(new_client); } ",0 "static void hw_perf_event_destroy(struct perf_event *event) { if (atomic_dec_and_mutex_lock(&active_events, &pmu_reserve_mutex)) { /* * We must not call the destroy function with interrupts * disabled. */ on_each_cpu(reset_counters, (void *)(long)mipspmu->num_counters, 1); mipspmu_free_irq(); mutex_unlock(&pmu_reserve_mutex); } } ",0 "load_option_panel(void) { Str src; struct param_ptr *p; struct sel_c *s; #ifdef USE_M17N wc_ces_list *c; #endif int x, i; Str tmp; Buffer *buf; if (optionpanel_str == NULL) optionpanel_str = Sprintf(optionpanel_src1, w3m_version, html_quote(localCookie()->ptr), _(CMT_HELPER)); #ifdef USE_M17N #ifdef ENABLE_NLS OptionCharset = SystemCharset; /* FIXME */ #endif if (!OptionEncode) { optionpanel_str = wc_Str_conv(optionpanel_str, OptionCharset, InnerCharset); for (i = 0; sections[i].name != NULL; i++) { sections[i].name = wc_conv(_(sections[i].name), OptionCharset, InnerCharset)->ptr; for (p = sections[i].params; p->name; p++) { p->comment = wc_conv(_(p->comment), OptionCharset, InnerCharset)->ptr; if (p->inputtype == PI_SEL_C #ifdef USE_COLOR && p->select != colorstr #endif ) { for (s = (struct sel_c *)p->select; s->text != NULL; s++) { s->text = wc_conv(_(s->text), OptionCharset, InnerCharset)->ptr; } } } } #ifdef USE_COLOR for (s = colorstr; s->text; s++) s->text = wc_conv(_(s->text), OptionCharset, InnerCharset)->ptr; #endif OptionEncode = TRUE; } #endif src = Strdup(optionpanel_str); Strcat_charp(src, ""
""); for (i = 0; sections[i].name != NULL; i++) { Strcat_m_charp(src, ""

"", sections[i].name, ""

"", NULL); p = sections[i].params; Strcat_charp(src, """"); while (p->name) { Strcat_m_charp(src, ""\n""); p++; } Strcat_charp(src, """"); Strcat_charp(src, ""
"", p->comment, NULL); Strcat(src, Sprintf("""", (int)(28 * pixel_per_char))); switch (p->inputtype) { case PI_TEXT: Strcat_m_charp(src, ""name, "" value=\"""", html_quote(to_str(p)->ptr), ""\"">"", NULL); break; case PI_ONOFF: x = atoi(to_str(p)->ptr); Strcat_m_charp(src, ""name, "" value=1"", (x ? "" checked"" : """"), "">YES  name, "" value=0"", (x ? """" : "" checked""), "">NO"", NULL); break; case PI_SEL_C: tmp = to_str(p); Strcat_m_charp(src, """"); break; #ifdef USE_M17N case PI_CODE: tmp = to_str(p); Strcat_m_charp(src, """"); break; #endif } Strcat_charp(src, ""


""); } Strcat_charp(src, ""
""); buf = loadHTMLString(src); #ifdef USE_M17N if (buf) buf->document_charset = OptionCharset; #endif return buf; } ",0 "parse_response_status (ksba_ocsp_t ocsp, unsigned char const **data, size_t *datalen, size_t *rlength) { gpg_error_t err; struct tag_info ti; char *oid; *rlength = 0; /* Parse the OCSPResponse sequence. */ err = parse_sequence (data, datalen, &ti); if (err) return err; /* Parse the OCSPResponseStatus. */ err = parse_enumerated (data, datalen, &ti, 1); if (err) return err; switch (**data) { case 0: ocsp->response_status = KSBA_OCSP_RSPSTATUS_SUCCESS; break; case 1: ocsp->response_status = KSBA_OCSP_RSPSTATUS_MALFORMED; break; case 2: ocsp->response_status = KSBA_OCSP_RSPSTATUS_INTERNAL; break; case 3: ocsp->response_status = KSBA_OCSP_RSPSTATUS_TRYLATER; break; case 5: ocsp->response_status = KSBA_OCSP_RSPSTATUS_SIGREQUIRED; break; case 6: ocsp->response_status = KSBA_OCSP_RSPSTATUS_UNAUTHORIZED; break; default: ocsp->response_status = KSBA_OCSP_RSPSTATUS_OTHER; break; } parse_skip (data, datalen, &ti); if (ocsp->response_status) return 0; /* This is an error reponse; we have to stop here. */ /* We have a successful reponse status, thus we check that ResponseBytes are actually available. */ err = parse_context_tag (data, datalen, &ti, 0); if (err) return err; err = parse_sequence (data, datalen, &ti); if (err) return err; err = parse_object_id_into_str (data, datalen, &oid); if (err) return err; if (strcmp (oid, oidstr_ocsp_basic)) { xfree (oid); return gpg_error (GPG_ERR_UNSUPPORTED_PROTOCOL); } xfree (oid); /* Check that the next field is an octet string. */ err = parse_octet_string (data, datalen, &ti); if (err) return err; *rlength = ti.length; return 0; } ",0 "void LayerTreeHost::InitializeThreaded( scoped_refptr main_task_runner, scoped_refptr impl_task_runner) { task_runner_provider_ = TaskRunnerProvider::Create(main_task_runner, impl_task_runner); std::unique_ptr proxy_main = base::MakeUnique(this, task_runner_provider_.get()); InitializeProxy(std::move(proxy_main)); } ",0 "static int in_standby(struct audio_stream *stream) { UNUSED(stream); FNLOG(); return 0; } ",0 "void QQuickWebViewExperimental::setTransparentBackground(bool enable) { Q_D(QQuickWebView); d->setTransparentBackground(enable); } ",0 "static void rps_trigger_softirq(void *data) { struct softnet_data *sd = data; ____napi_schedule(sd, &sd->backlog); sd->received_rps++; } ",0 "void TaskManagerHandler::HandleKillProcesses(const ListValue* unique_ids) { for (ListValue::const_iterator i = unique_ids->begin(); i != unique_ids->end(); ++i) { int unique_id = parseIndex(*i); int resource_index = model_->GetResourceIndexByUniqueId(unique_id); if (resource_index == -1) continue; task_manager_->KillProcess(resource_index); } } ",0 "void PasswordAutofillAgent::PasswordValueGatekeeper::ShowValue( blink::WebInputElement* element) { if (!element->isNull() && !element->suggestedValue().isEmpty()) element->setValue(element->suggestedValue(), true); } ",0 "static int unix_dgram_connect(struct socket *sock, struct sockaddr *addr, int alen, int flags) { struct sock *sk = sock->sk; struct net *net = sock_net(sk); struct sockaddr_un *sunaddr = (struct sockaddr_un *)addr; struct sock *other; unsigned int hash; int err; if (addr->sa_family != AF_UNSPEC) { err = unix_mkname(sunaddr, alen, &hash); if (err < 0) goto out; alen = err; if (test_bit(SOCK_PASSCRED, &sock->flags) && !unix_sk(sk)->addr && (err = unix_autobind(sock)) != 0) goto out; restart: other = unix_find_other(net, sunaddr, alen, sock->type, hash, &err); if (!other) goto out; unix_state_double_lock(sk, other); /* Apparently VFS overslept socket death. Retry. */ if (sock_flag(other, SOCK_DEAD)) { unix_state_double_unlock(sk, other); sock_put(other); goto restart; } err = -EPERM; if (!unix_may_send(sk, other)) goto out_unlock; err = security_unix_may_send(sk->sk_socket, other->sk_socket); if (err) goto out_unlock; } else { /* * 1003.1g breaking connected state with AF_UNSPEC */ other = NULL; unix_state_double_lock(sk, other); } /* * If it was connected, reconnect. */ if (unix_peer(sk)) { struct sock *old_peer = unix_peer(sk); unix_peer(sk) = other; unix_dgram_peer_wake_disconnect_wakeup(sk, old_peer); unix_state_double_unlock(sk, other); if (other != old_peer) unix_dgram_disconnected(sk, old_peer); sock_put(old_peer); } else { unix_peer(sk) = other; unix_state_double_unlock(sk, other); } return 0; out_unlock: unix_state_double_unlock(sk, other); sock_put(other); out: return err; } ",0 "static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info) { struct shared_msr_entry *msr; switch (msr_info->index) { #ifdef CONFIG_X86_64 case MSR_FS_BASE: msr_info->data = vmcs_readl(GUEST_FS_BASE); break; case MSR_GS_BASE: msr_info->data = vmcs_readl(GUEST_GS_BASE); break; case MSR_KERNEL_GS_BASE: vmx_load_host_state(to_vmx(vcpu)); msr_info->data = to_vmx(vcpu)->msr_guest_kernel_gs_base; break; #endif case MSR_EFER: return kvm_get_msr_common(vcpu, msr_info); case MSR_IA32_TSC: msr_info->data = guest_read_tsc(vcpu); break; case MSR_IA32_SYSENTER_CS: msr_info->data = vmcs_read32(GUEST_SYSENTER_CS); break; case MSR_IA32_SYSENTER_EIP: msr_info->data = vmcs_readl(GUEST_SYSENTER_EIP); break; case MSR_IA32_SYSENTER_ESP: msr_info->data = vmcs_readl(GUEST_SYSENTER_ESP); break; case MSR_IA32_BNDCFGS: if (!kvm_mpx_supported()) return 1; msr_info->data = vmcs_read64(GUEST_BNDCFGS); break; case MSR_IA32_MCG_EXT_CTL: if (!msr_info->host_initiated && !(to_vmx(vcpu)->msr_ia32_feature_control & FEATURE_CONTROL_LMCE)) return 1; msr_info->data = vcpu->arch.mcg_ext_ctl; break; case MSR_IA32_FEATURE_CONTROL: msr_info->data = to_vmx(vcpu)->msr_ia32_feature_control; break; case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC: if (!nested_vmx_allowed(vcpu)) return 1; return vmx_get_vmx_msr(vcpu, msr_info->index, &msr_info->data); case MSR_IA32_XSS: if (!vmx_xsaves_supported()) return 1; msr_info->data = vcpu->arch.ia32_xss; break; case MSR_TSC_AUX: if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated) return 1; /* Otherwise falls through */ default: msr = find_msr_entry(to_vmx(vcpu), msr_info->index); if (msr) { msr_info->data = msr->data; break; } return kvm_get_msr_common(vcpu, msr_info); } return 0; } ",0 "int ndp_msg_new(struct ndp_msg **p_msg, enum ndp_msg_type msg_type) { struct ndp_msg *msg; if (msg_type == NDP_MSG_ALL) return -EINVAL; msg = ndp_msg_alloc(); if (!msg) return -ENOMEM; ndp_msg_init(msg, msg_type); *p_msg = msg; return 0; } ",0 "AutofillDialogViews::SuggestedButton::~SuggestedButton() {} ",0 "mrb_class_new_class(mrb_state *mrb, mrb_value cv) { mrb_int n; mrb_value super, blk; mrb_value new_class; mrb_sym mid; n = mrb_get_args(mrb, ""|C&"", &super, &blk); if (n == 0) { super = mrb_obj_value(mrb->object_class); } new_class = mrb_obj_value(mrb_class_new(mrb, mrb_class_ptr(super))); mid = mrb_intern_lit(mrb, ""initialize""); if (!mrb_func_basic_p(mrb, new_class, mid, mrb_bob_init)) { mrb_funcall_with_block(mrb, new_class, mid, n, &super, blk); } mrb_class_inherited(mrb, mrb_class_ptr(super), mrb_class_ptr(new_class)); return new_class; } ",0 "iperf_set_test_json_output(struct iperf_test *ipt, int json_output) { ipt->json_output = json_output; } ",0 "static void svm_hwapic_isr_update(struct kvm *kvm, int isr) { return; } ",0 "void LiveSyncTest::SetUpCommandLine(CommandLine* cl) { if (!cl->HasSwitch(switches::kSyncNotificationMethod)) cl->AppendSwitchASCII(switches::kSyncNotificationMethod, ""p2p""); if (!cl->HasSwitch(switches::kEnableSyncSessions)) cl->AppendSwitch(switches::kEnableSyncSessions); if (!cl->HasSwitch(switches::kEnableSyncTypedUrls)) cl->AppendSwitch(switches::kEnableSyncTypedUrls); if (!cl->HasSwitch(switches::kDisableBackgroundNetworking)) cl->AppendSwitch(switches::kDisableBackgroundNetworking); } ",0 "fep_client_open (const char *address) { FepClient *client; struct sockaddr_un sun; ssize_t sun_len; int retval; if (!address) address = getenv (""LIBFEP_CONTROL_SOCK""); if (!address) return NULL; if (strlen (address) + 1 >= sizeof(sun.sun_path)) { fep_log (FEP_LOG_LEVEL_WARNING, ""unix domain socket path too long: %d + 1 >= %d"", strlen (address), sizeof (sun.sun_path)); free (address); return NULL; } client = xzalloc (sizeof(FepClient)); client->filter_running = false; client->messages = NULL; memset (&sun, 0, sizeof(struct sockaddr_un)); sun.sun_family = AF_UNIX; #ifdef __linux__ sun.sun_path[0] = '\0'; memcpy (sun.sun_path + 1, address, strlen (address)); sun_len = offsetof (struct sockaddr_un, sun_path) + strlen (address) + 1; #else memcpy (sun.sun_path, address, strlen (address)); sun_len = sizeof (struct sockaddr_un); #endif client->control = socket (AF_UNIX, SOCK_STREAM, 0); if (client->control < 0) { free (client); return NULL; } retval = connect (client->control, (const struct sockaddr *) &sun, sun_len); if (retval < 0) { close (client->control); free (client); return NULL; } return client; } ",1 "int GetIconResourceIndex() { return InstallDetails::Get().mode().app_icon_resource_index; } ",0 "FileTransfer::ExpandFileTransferList( char const *src_path, char const *dest_dir, char const *iwd, int max_depth, FileTransferList &expanded_list ) { ASSERT( src_path ); ASSERT( dest_dir ); ASSERT( iwd ); expanded_list.push_back( FileTransferItem() ); FileTransferItem &file_xfer_item = expanded_list.back(); file_xfer_item.src_name = src_path; file_xfer_item.dest_dir = dest_dir; if( IsUrl(src_path) ) { return true; } std::string full_src_path; if( is_relative_to_cwd( src_path ) ) { full_src_path = iwd; if( full_src_path.length() > 0 ) { full_src_path += DIR_DELIM_CHAR; } } full_src_path += src_path; StatInfo st( full_src_path.c_str() ); if( st.Error() != 0 ) { return false; } #ifndef WIN32 file_xfer_item.file_mode = (condor_mode_t)st.GetMode(); #endif size_t srclen = file_xfer_item.src_name.length(); bool trailing_slash = srclen > 0 && src_path[srclen-1] == DIR_DELIM_CHAR; file_xfer_item.is_symlink = st.IsSymlink(); file_xfer_item.is_directory = st.IsDirectory(); if( !file_xfer_item.is_directory ) { return true; } if( !trailing_slash && file_xfer_item.is_symlink ) { return true; } if( max_depth == 0 ) { return true; // this is not considered an error } if( max_depth > 0 ) { max_depth--; } std::string dest_dir_buf; if( trailing_slash ) { expanded_list.pop_back(); } else { dest_dir_buf = dest_dir; if( dest_dir_buf.length() > 0 ) { dest_dir_buf += DIR_DELIM_CHAR; } dest_dir_buf += condor_basename(src_path); dest_dir = dest_dir_buf.c_str(); } Directory dir( &st ); dir.Rewind(); bool rc = true; char const *file_in_dir; while( (file_in_dir=dir.Next()) != NULL ) { std::string file_full_path = src_path; if( !trailing_slash ) { file_full_path += DIR_DELIM_CHAR; } file_full_path += file_in_dir; if( !ExpandFileTransferList( file_full_path.c_str(), dest_dir, iwd, max_depth, expanded_list ) ) { rc = false; } } return rc; } ",0 "GLvoid StubGLDisableVertexAttribArray(GLuint index) { glDisableVertexAttribArray(index); } ",0 "MagickExport Image *FlipImage(const Image *image,ExceptionInfo *exception) { #define FlipImageTag ""Flip/Image"" CacheView *flip_view, *image_view; Image *flip_image; MagickBooleanType status; MagickOffsetType progress; RectangleInfo page; ssize_t y; assert(image != (const 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); flip_image=CloneImage(image,image->columns,image->rows,MagickTrue,exception); if (flip_image == (Image *) NULL) return((Image *) NULL); /* Flip image. */ status=MagickTrue; progress=0; page=image->page; image_view=AcquireVirtualCacheView(image,exception); flip_view=AcquireAuthenticCacheView(flip_image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(status) \ magick_threads(image,flip_image,1,1) #endif for (y=0; y < (ssize_t) flip_image->rows; y++) { register const Quantum *restrict p; register Quantum *restrict q; register ssize_t x; if (status == MagickFalse) continue; p=GetCacheViewVirtualPixels(image_view,0,y,image->columns,1,exception); q=QueueCacheViewAuthenticPixels(flip_view,0,(ssize_t) (flip_image->rows-y- 1),flip_image->columns,1,exception); if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL)) { status=MagickFalse; continue; } for (x=0; x < (ssize_t) flip_image->columns; x++) { register ssize_t i; if (GetPixelReadMask(image,p) == 0) { SetPixelBackgoundColor(flip_image,q); p+=GetPixelChannels(image); q+=GetPixelChannels(flip_image); continue; } for (i=0; i < (ssize_t) GetPixelChannels(image); i++) { PixelChannel channel=GetPixelChannelChannel(image,i); PixelTrait traits=GetPixelChannelTraits(image,channel); PixelTrait flip_traits=GetPixelChannelTraits(flip_image,channel); if ((traits == UndefinedPixelTrait) || (flip_traits == UndefinedPixelTrait)) continue; SetPixelChannel(flip_image,channel,p[i],q); } p+=GetPixelChannels(image); q+=GetPixelChannels(flip_image); } if (SyncCacheViewAuthenticPixels(flip_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_FlipImage) #endif proceed=SetImageProgress(image,FlipImageTag,progress++,image->rows); if (proceed == MagickFalse) status=MagickFalse; } } flip_view=DestroyCacheView(flip_view); image_view=DestroyCacheView(image_view); flip_image->type=image->type; if (page.height != 0) page.y=(ssize_t) (page.height-flip_image->rows-page.y); flip_image->page=page; if (status == MagickFalse) flip_image=DestroyImage(flip_image); return(flip_image); } ",0 "void FrameLoader::checkIfRunInsecureContent(SecurityOrigin* context, const KURL& url) { if (!isMixedContent(context, url)) return; String message = String::format(""The page at %s ran insecure content from %s.\n"", m_URL.string().utf8().data(), url.string().utf8().data()); m_frame->domWindow()->console()->addMessage(HTMLMessageSource, LogMessageType, WarningMessageLevel, message, 1, String()); m_client->didRunInsecureContent(context); } ",0 "vips_foreign_load_gif_scan_comment_ext( VipsForeignLoadGif *gif, GifByteType *extension ) { VIPS_DEBUG_MSG( ""gifload: type: comment\n"" ); if( !gif->comment ) { /* Up to 257 with a NULL terminator. */ char comment[257]; vips_strncpy( comment, (char *) (extension + 1), 256 ); comment[extension[0]] = '\0'; gif->comment = g_strdup( comment ); } while( extension != NULL ) if( vips_foreign_load_gif_ext_next( gif, &extension ) ) return( -1 ); return( 0 ); } ",0 " UserGestureToken* GetUserGestureToken() const { return user_gesture_token_.get(); } ",0 "void CustomButton::OnMouseReleased(const ui::MouseEvent& event) { if (state_ == STATE_DISABLED) return; if (!HitTestPoint(event.location())) { SetState(STATE_NORMAL); return; } SetState(STATE_HOVERED); if (IsTriggerableEvent(event) && notify_action_ == NOTIFY_ON_RELEASE) { NotifyClick(event); } } ",0 "int BN_GF2m_mod_sqrt_arr(BIGNUM *r, const BIGNUM *a, const int p[], BN_CTX *ctx) { int ret = 0; BIGNUM *u; bn_check_top(a); if (!p[0]) { /* reduction mod 1 => return 0 */ BN_zero(r); return 1; } BN_CTX_start(ctx); if ((u = BN_CTX_get(ctx)) == NULL) goto err; if (!BN_set_bit(u, p[0] - 1)) goto err; ret = BN_GF2m_mod_exp_arr(r, a, u, p, ctx); bn_check_top(r); err: BN_CTX_end(ctx); return ret; } ",0 "static void srpt_refresh_port_work(struct work_struct *work) { struct srpt_port *sport = container_of(work, struct srpt_port, work); srpt_refresh_port(sport); } ",0 "std::unique_ptr TestingDomainReliabilityServiceFactoryFunction( content::BrowserContext* context) { const void* kKey = TestingDomainReliabilityServiceFactoryUserData::kKey; TestingDomainReliabilityServiceFactoryUserData* data = static_cast( context->GetUserData(kKey)); EXPECT_TRUE(data); EXPECT_EQ(data->context, context); EXPECT_FALSE(data->attached); data->attached = true; return base::WrapUnique(data->service); } ",0 " static bool packet_extra_vlan_len_allowed(const struct net_device *dev, struct sk_buff *skb) { /* Earlier code assumed this would be a VLAN pkt, double-check * this now that we have the actual packet in hand. We can only * do this check on Ethernet devices. */ if (unlikely(dev->type != ARPHRD_ETHER)) return false; skb_reset_mac_header(skb); return likely(eth_hdr(skb)->h_proto == htons(ETH_P_8021Q)); } ",0 "PHP_FUNCTION(substr_count) { char *haystack, *needle; zend_long offset = 0, length = 0; int ac = ZEND_NUM_ARGS(); int count = 0; size_t haystack_len, needle_len; char *p, *endp, cmp; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""ss|ll"", &haystack, &haystack_len, &needle, &needle_len, &offset, &length) == FAILURE) { return; } if (needle_len == 0) { php_error_docref(NULL, E_WARNING, ""Empty substring""); RETURN_FALSE; } p = haystack; endp = p + haystack_len; if (offset < 0) { php_error_docref(NULL, E_WARNING, ""Offset should be greater than or equal to 0""); RETURN_FALSE; } if ((size_t)offset > haystack_len) { php_error_docref(NULL, E_WARNING, ""Offset value "" ZEND_LONG_FMT "" exceeds string length"", offset); RETURN_FALSE; } p += offset; if (ac == 4) { if (length <= 0) { php_error_docref(NULL, E_WARNING, ""Length should be greater than 0""); RETURN_FALSE; } if (length > (haystack_len - offset)) { php_error_docref(NULL, E_WARNING, ""Length value "" ZEND_LONG_FMT "" exceeds string length"", length); RETURN_FALSE; } endp = p + length; } if (needle_len == 1) { cmp = needle[0]; while ((p = memchr(p, cmp, endp - p))) { count++; p++; } } else { while ((p = (char*)php_memnstr(p, needle, needle_len, endp))) { p += needle_len; count++; } } RETURN_LONG(count); } ",0 "static iw_tmpsample get_raw_sample_flt32(struct iw_context *ctx, int x, int y, int channel) { size_t z; z = y*ctx->img1.bpr + (ctx->img1_numchannels_physical*x + channel)*4; return (iw_tmpsample)iw_get_float32(&ctx->img1.pixels[z]); } ",0 "void AddUsageStatsWorkItems(const InstallationState& original_state, const InstallerState& installer_state, WorkItemList* install_list) { DCHECK(installer_state.operation() == InstallerState::MULTI_INSTALL || installer_state.operation() == InstallerState::MULTI_UPDATE); HKEY root_key = installer_state.root_key(); bool value_found = false; DWORD usagestats = 0; const Products& products = installer_state.products(); for (Products::const_iterator scan = products.begin(), end = products.end(); !value_found && scan != end; ++scan) { BrowserDistribution* dist = (*scan)->distribution(); const ProductState* product_state = original_state.GetNonVersionedProductState( installer_state.system_install(), dist->GetType()); value_found = product_state->GetUsageStats(&usagestats); } if (value_found) { std::wstring state_key( installer_state.multi_package_binaries_distribution()->GetStateKey()); install_list->AddCreateRegKeyWorkItem(root_key, state_key); install_list->AddSetRegValueWorkItem(root_key, state_key, google_update::kRegUsageStatsField, usagestats, false); for (Products::const_iterator scan = products.begin(), end = products.end(); scan != end; ++scan) { BrowserDistribution* dist = (*scan)->distribution(); if (installer_state.system_install()) { install_list->AddDeleteRegValueWorkItem( root_key, dist->GetStateMediumKey(), google_update::kRegUsageStatsField); install_list->AddDeleteRegValueWorkItem( HKEY_CURRENT_USER, dist->GetStateKey(), google_update::kRegUsageStatsField); } install_list->AddDeleteRegValueWorkItem(root_key, dist->GetStateKey(), google_update::kRegUsageStatsField); } } } ",0 "::testing::AssertionResult AssertTimesMatch(const char* t1_expr, const char* t2_expr, const base::Time& t1, const base::Time& t2) { if (t1 == t2) return ::testing::AssertionSuccess(); return ::testing::AssertionFailure() << t1_expr << "" and "" << t2_expr << "" (internal values: "" << t1.ToInternalValue() << "" and "" << t2.ToInternalValue() << "") (proto time: "" << browser_sync::TimeToProtoTime(t1) << "" and "" << browser_sync::TimeToProtoTime(t2) << "") do not match""; } ",1 "cmd_http_txresp(CMD_ARGS) { struct http *hp; const char *proto = ""HTTP/1.1""; const char *status = ""200""; const char *msg = ""Ok""; int bodylen = 0; char *b, *c; char *body = NULL, *nullbody; int nolen = 0; (void)cmd; (void)vl; CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); ONLY_SERVER(hp, av); assert(!strcmp(av[0], ""txresp"")); av++; VSB_clear(hp->vsb); /* send a ""Content-Length: 0"" header unless something else happens */ REPLACE(body, """"); nullbody = body; for(; *av != NULL; av++) { if (!strcmp(*av, ""-proto"")) { proto = av[1]; av++; } else if (!strcmp(*av, ""-status"")) { status = av[1]; av++; } else if (!strcmp(*av, ""-msg"")) { msg = av[1]; av++; continue; } else break; } VSB_printf(hp->vsb, ""%s %s %s%s"", proto, status, msg, nl); for(; *av != NULL; av++) { if (!strcmp(*av, ""-nolen"")) { nolen = 1; } else if (!strcmp(*av, ""-hdr"")) { VSB_printf(hp->vsb, ""%s%s"", av[1], nl); av++; } else break; } for(; *av != NULL; av++) { if (!strcmp(*av, ""-body"")) { assert(body == nullbody); REPLACE(body, av[1]); AN(body); av++; bodylen = strlen(body); for (b = body; *b != '\0'; b++) { if(*b == '\\' && b[1] == '0') { *b = '\0'; for(c = b+1; *c != '\0'; c++) { *c = c[1]; } b++; bodylen--; } } } else if (!strcmp(*av, ""-bodylen"")) { assert(body == nullbody); body = synth_body(av[1], 0); bodylen = strlen(body); av++; } else if (!strcmp(*av, ""-gzipresidual"")) { hp->gzipresidual = strtoul(av[1], NULL, 0); av++; } else if (!strcmp(*av, ""-gziplevel"")) { hp->gziplevel = strtoul(av[1], NULL, 0); av++; } else if (!strcmp(*av, ""-gziplen"")) { assert(body == nullbody); b = synth_body(av[1], 1); gzip_body(hp, b, &body, &bodylen); VSB_printf(hp->vsb, ""Content-Encoding: gzip%s"", nl); av++; } else if (!strcmp(*av, ""-gzipbody"")) { assert(body == nullbody); gzip_body(hp, av[1], &body, &bodylen); VSB_printf(hp->vsb, ""Content-Encoding: gzip%s"", nl); av++; } else break; } if (*av != NULL) vtc_log(hp->vl, 0, ""Unknown http txresp spec: %s\n"", *av); if (body != NULL && !nolen) VSB_printf(hp->vsb, ""Content-Length: %d%s"", bodylen, nl); VSB_cat(hp->vsb, nl); if (body != NULL) VSB_bcat(hp->vsb, body, bodylen); http_write(hp, 4, ""txresp""); } ",0 "void DesktopSessionWin::OnPermanentError() { DCHECK(main_task_runner_->BelongsToCurrentThread()); launcher_.reset(); daemon_process()->CloseDesktopSession(id()); } ",0 "void PushMessagingServiceImpl::IncreasePushSubscriptionCount(int add, bool is_pending) { DCHECK_GT(add, 0); if (push_subscription_count_ + pending_push_subscription_count_ == 0) { GetGCMDriver()->AddAppHandler(kPushMessagingAppIdentifierPrefix, this); } if (is_pending) { pending_push_subscription_count_ += add; } else { #if BUILDFLAG(ENABLE_BACKGROUND) if (UseBackgroundMode() && g_browser_process->background_mode_manager() && !push_subscription_count_) { g_browser_process->background_mode_manager()->RegisterTrigger( profile_, this, false /* should_notify_user */); } #endif // BUILDFLAG(ENABLE_BACKGROUND) push_subscription_count_ += add; } } ",0 "void RenderFrameHostImpl::RequestAXTreeSnapshot(AXTreeSnapshotCallback callback, ui::AXMode ax_mode) { static int next_id = 1; int callback_id = next_id++; Send(new AccessibilityMsg_SnapshotTree(routing_id_, callback_id, ax_mode.mode())); ax_tree_snapshot_callbacks_.insert( std::make_pair(callback_id, std::move(callback))); } ",0 " parse_subrs( T1_Face face, T1_Loader loader ) { T1_Parser parser = &loader->parser; PS_Table table = &loader->subrs; FT_Memory memory = parser->root.memory; FT_Error error; FT_Int num_subrs; PSAux_Service psaux = (PSAux_Service)face->psaux; T1_Skip_Spaces( parser ); /* test for empty array */ if ( parser->root.cursor < parser->root.limit && *parser->root.cursor == '[' ) { T1_Skip_PS_Token( parser ); T1_Skip_Spaces ( parser ); if ( parser->root.cursor >= parser->root.limit || *parser->root.cursor != ']' ) parser->root.error = FT_THROW( Invalid_File_Format ); return; } num_subrs = (FT_Int)T1_ToInt( parser ); /* position the parser right before the `dup' of the first subr */ T1_Skip_PS_Token( parser ); /* `array' */ if ( parser->root.error ) return; T1_Skip_Spaces( parser ); /* initialize subrs array -- with synthetic fonts it is possible */ /* we get here twice */ if ( !loader->num_subrs ) { error = psaux->ps_table_funcs->init( table, num_subrs, memory ); if ( error ) goto Fail; } /* the format is simple: */ /* */ /* `index' + binary data */ /* */ for (;;) { FT_Long idx, size; FT_Byte* base; /* If we are out of data, or if the next token isn't `dup', */ /* we are done. */ if ( parser->root.cursor + 4 >= parser->root.limit || ft_strncmp( (char*)parser->root.cursor, ""dup"", 3 ) != 0 ) break; T1_Skip_PS_Token( parser ); /* `dup' */ idx = T1_ToInt( parser ); if ( !read_binary_data( parser, &size, &base, IS_INCREMENTAL ) ) return; /* The binary string is followed by one token, e.g. `NP' */ /* (bound to `noaccess put') or by two separate tokens: */ /* `noaccess' & `put'. We position the parser right */ /* before the next `dup', if any. */ T1_Skip_PS_Token( parser ); /* `NP' or `|' or `noaccess' */ if ( parser->root.error ) return; T1_Skip_Spaces ( parser ); if ( parser->root.cursor + 4 < parser->root.limit && ft_strncmp( (char*)parser->root.cursor, ""put"", 3 ) == 0 ) { T1_Skip_PS_Token( parser ); /* skip `put' */ T1_Skip_Spaces ( parser ); } /* with synthetic fonts it is possible we get here twice */ if ( loader->num_subrs ) continue; /* some fonts use a value of -1 for lenIV to indicate that */ /* the charstrings are unencoded */ /* */ /* thanks to Tom Kacvinsky for pointing this out */ /* */ if ( face->type1.private_dict.lenIV >= 0 ) { FT_Byte* temp; /* some fonts define empty subr records -- this is not totally */ /* compliant to the specification (which says they should at */ /* least contain a `return'), but we support them anyway */ if ( size < face->type1.private_dict.lenIV ) { error = FT_THROW( Invalid_File_Format ); goto Fail; } /* t1_decrypt() shouldn't write to base -- make temporary copy */ if ( FT_ALLOC( temp, size ) ) goto Fail; FT_MEM_COPY( temp, base, size ); psaux->t1_decrypt( temp, size, 4330 ); size -= face->type1.private_dict.lenIV; error = T1_Add_Table( table, (FT_Int)idx, temp + face->type1.private_dict.lenIV, size ); FT_FREE( temp ); } else error = T1_Add_Table( table, (FT_Int)idx, base, size ); if ( error ) goto Fail; } if ( !loader->num_subrs ) loader->num_subrs = num_subrs; return; Fail: parser->root.error = error; } ",0 "zoutputpage(i_ctx_t *i_ctx_p) { os_ptr op = osp; int code; check_type(op[-1], t_integer); check_type(*op, t_boolean); if (gs_debug[':']) { gs_main_instance *minst = get_minst_from_memory((gs_memory_t *)i_ctx_p->memory.current->non_gc_memory); print_resource_usage(minst, &(i_ctx_p->memory), ""Outputpage start""); } code = gs_output_page(igs, (int)op[-1].value.intval, op->value.boolval); if (code < 0) return code; pop(2); if (gs_debug[':']) { gs_main_instance *minst = get_minst_from_memory((gs_memory_t *)i_ctx_p->memory.current->non_gc_memory); print_resource_usage(minst, &(i_ctx_p->memory), ""Outputpage end""); } return 0; } ",0 "ViewMsg_Navigate_Type::Value GetNavigationType( BrowserContext* browser_context, const NavigationEntryImpl& entry, NavigationController::ReloadType reload_type) { switch (reload_type) { case NavigationControllerImpl::RELOAD: return ViewMsg_Navigate_Type::RELOAD; case NavigationControllerImpl::RELOAD_IGNORING_CACHE: return ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE; case NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL: return ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; case NavigationControllerImpl::NO_RELOAD: break; // Fall through to rest of function. } if (entry.restore_type() == NavigationEntryImpl::RESTORE_LAST_SESSION_EXITED_CLEANLY) { if (entry.GetHasPostData()) return ViewMsg_Navigate_Type::RESTORE_WITH_POST; return ViewMsg_Navigate_Type::RESTORE; } return ViewMsg_Navigate_Type::NORMAL; } ",0 "inline void HarfBuzzRunCache::remove(CachedShapingResults* node) { CachedShapingResultsLRUNode* lruNode = *node->lru; m_harfBuzzRunLRU.erase(node->lru); m_harfBuzzRunMap.erase(lruNode->entry); delete lruNode; delete node; } ",0 " void WebsiteSettingsPopupView::OnPermissionChanged( const WebsiteSettingsUI::PermissionInfo& permission) { presenter_->OnSitePermissionChanged(permission.type, permission.setting); } ",0 "void BrowserWindowGtk::UserChangedTheme() { SetBackgroundColor(); InvalidateWindow(); UpdateWindowShape(bounds_.width(), bounds_.height()); } ",0 "static void ep_rbtree_insert(struct eventpoll *ep, struct epitem *epi) { int kcmp; struct rb_node **p = &ep->rbr.rb_node, *parent = NULL; struct epitem *epic; while (*p) { parent = *p; epic = rb_entry(parent, struct epitem, rbn); kcmp = ep_cmp_ffd(&epi->ffd, &epic->ffd); if (kcmp > 0) p = &parent->rb_right; else p = &parent->rb_left; } rb_link_node(&epi->rbn, parent, p); rb_insert_color(&epi->rbn, &ep->rbr); } ",0 "int32_t PPB_URLLoader_Impl::Open( const ::ppapi::URLRequestInfoData& request_data, int requestor_pid, scoped_refptr callback) { if (main_document_loader_) return PP_ERROR_INPROGRESS; int32_t rv = ValidateCallback(callback); if (rv != PP_OK) return rv; ::ppapi::URLRequestInfoData filled_in_request_data = request_data; if (URLRequestRequiresUniversalAccess(filled_in_request_data) && !has_universal_access_) { Log(PP_LOGLEVEL_ERROR, ""PPB_URLLoader.Open: The URL you're requesting is "" "" on a different security origin than your plugin. To request "" "" cross-origin resources, see "" "" PP_URLREQUESTPROPERTY_ALLOWCROSSORIGINREQUESTS.""); return PP_ERROR_NOACCESS; } if (loader_.get()) return PP_ERROR_INPROGRESS; WebFrame* frame = GetFrameForResource(this); if (!frame) return PP_ERROR_FAILED; WebURLRequest web_request; if (!CreateWebURLRequest(&filled_in_request_data, frame, &web_request)) return PP_ERROR_FAILED; web_request.setRequestorProcessID(requestor_pid); request_data_ = filled_in_request_data; WebURLLoaderOptions options; if (has_universal_access_) { options.allowCredentials = true; options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyAllow; } else { options.untrustedHTTP = true; if (request_data_.allow_cross_origin_requests) { options.allowCredentials = request_data_.allow_credentials; options.crossOriginRequestPolicy = WebURLLoaderOptions::CrossOriginRequestPolicyUseAccessControl; } else { options.allowCredentials = true; } } is_asynchronous_load_suspended_ = false; loader_.reset(frame->createAssociatedURLLoader(options)); if (!loader_.get()) return PP_ERROR_FAILED; loader_->loadAsynchronously(web_request, this); RegisterCallback(callback); return PP_OK_COMPLETIONPENDING; } ",0 " static int adjust_scalar_min_max_vals(struct bpf_verifier_env *env, struct bpf_insn *insn, struct bpf_reg_state *dst_reg, struct bpf_reg_state src_reg) { struct bpf_reg_state *regs = cur_regs(env); u8 opcode = BPF_OP(insn->code); bool src_known, dst_known; s64 smin_val, smax_val; u64 umin_val, umax_val; if (BPF_CLASS(insn->code) != BPF_ALU64) { /* 32-bit ALU ops are (32,32)->64 */ coerce_reg_to_size(dst_reg, 4); coerce_reg_to_size(&src_reg, 4); } smin_val = src_reg.smin_value; smax_val = src_reg.smax_value; umin_val = src_reg.umin_value; umax_val = src_reg.umax_value; src_known = tnum_is_const(src_reg.var_off); dst_known = tnum_is_const(dst_reg->var_off); switch (opcode) { case BPF_ADD: if (signed_add_overflows(dst_reg->smin_value, smin_val) || signed_add_overflows(dst_reg->smax_value, smax_val)) { dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { dst_reg->smin_value += smin_val; dst_reg->smax_value += smax_val; } if (dst_reg->umin_value + umin_val < umin_val || dst_reg->umax_value + umax_val < umax_val) { dst_reg->umin_value = 0; dst_reg->umax_value = U64_MAX; } else { dst_reg->umin_value += umin_val; dst_reg->umax_value += umax_val; } dst_reg->var_off = tnum_add(dst_reg->var_off, src_reg.var_off); break; case BPF_SUB: if (signed_sub_overflows(dst_reg->smin_value, smax_val) || signed_sub_overflows(dst_reg->smax_value, smin_val)) { /* Overflow possible, we know nothing */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { dst_reg->smin_value -= smax_val; dst_reg->smax_value -= smin_val; } if (dst_reg->umin_value < umax_val) { /* Overflow possible, we know nothing */ dst_reg->umin_value = 0; dst_reg->umax_value = U64_MAX; } else { /* Cannot overflow (as long as bounds are consistent) */ dst_reg->umin_value -= umax_val; dst_reg->umax_value -= umin_val; } dst_reg->var_off = tnum_sub(dst_reg->var_off, src_reg.var_off); break; case BPF_MUL: dst_reg->var_off = tnum_mul(dst_reg->var_off, src_reg.var_off); if (smin_val < 0 || dst_reg->smin_value < 0) { /* Ain't nobody got time to multiply that sign */ __mark_reg_unbounded(dst_reg); __update_reg_bounds(dst_reg); break; } /* Both values are positive, so we can work with unsigned and * copy the result to signed (unless it exceeds S64_MAX). */ if (umax_val > U32_MAX || dst_reg->umax_value > U32_MAX) { /* Potential overflow, we know nothing */ __mark_reg_unbounded(dst_reg); /* (except what we can learn from the var_off) */ __update_reg_bounds(dst_reg); break; } dst_reg->umin_value *= umin_val; dst_reg->umax_value *= umax_val; if (dst_reg->umax_value > S64_MAX) { /* Overflow possible, we know nothing */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { dst_reg->smin_value = dst_reg->umin_value; dst_reg->smax_value = dst_reg->umax_value; } break; case BPF_AND: if (src_known && dst_known) { __mark_reg_known(dst_reg, dst_reg->var_off.value & src_reg.var_off.value); break; } /* We get our minimum from the var_off, since that's inherently * bitwise. Our maximum is the minimum of the operands' maxima. */ dst_reg->var_off = tnum_and(dst_reg->var_off, src_reg.var_off); dst_reg->umin_value = dst_reg->var_off.value; dst_reg->umax_value = min(dst_reg->umax_value, umax_val); if (dst_reg->smin_value < 0 || smin_val < 0) { /* Lose signed bounds when ANDing negative numbers, * ain't nobody got time for that. */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { /* ANDing two positives gives a positive, so safe to * cast result into s64. */ dst_reg->smin_value = dst_reg->umin_value; dst_reg->smax_value = dst_reg->umax_value; } /* We may learn something more from the var_off */ __update_reg_bounds(dst_reg); break; case BPF_OR: if (src_known && dst_known) { __mark_reg_known(dst_reg, dst_reg->var_off.value | src_reg.var_off.value); break; } /* We get our maximum from the var_off, and our minimum is the * maximum of the operands' minima */ dst_reg->var_off = tnum_or(dst_reg->var_off, src_reg.var_off); dst_reg->umin_value = max(dst_reg->umin_value, umin_val); dst_reg->umax_value = dst_reg->var_off.value | dst_reg->var_off.mask; if (dst_reg->smin_value < 0 || smin_val < 0) { /* Lose signed bounds when ORing negative numbers, * ain't nobody got time for that. */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; } else { /* ORing two positives gives a positive, so safe to * cast result into s64. */ dst_reg->smin_value = dst_reg->umin_value; dst_reg->smax_value = dst_reg->umax_value; } /* We may learn something more from the var_off */ __update_reg_bounds(dst_reg); break; case BPF_LSH: if (umax_val > 63) { /* Shifts greater than 63 are undefined. This includes * shifts by a negative number. */ mark_reg_unknown(env, regs, insn->dst_reg); break; } /* We lose all sign bit information (except what we can pick * up from var_off) */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; /* If we might shift our top bit out, then we know nothing */ if (dst_reg->umax_value > 1ULL << (63 - umax_val)) { dst_reg->umin_value = 0; dst_reg->umax_value = U64_MAX; } else { dst_reg->umin_value <<= umin_val; dst_reg->umax_value <<= umax_val; } if (src_known) dst_reg->var_off = tnum_lshift(dst_reg->var_off, umin_val); else dst_reg->var_off = tnum_lshift(tnum_unknown, umin_val); /* We may learn something more from the var_off */ __update_reg_bounds(dst_reg); break; case BPF_RSH: if (umax_val > 63) { /* Shifts greater than 63 are undefined. This includes * shifts by a negative number. */ mark_reg_unknown(env, regs, insn->dst_reg); break; } /* BPF_RSH is an unsigned shift. If the value in dst_reg might * be negative, then either: * 1) src_reg might be zero, so the sign bit of the result is * unknown, so we lose our signed bounds * 2) it's known negative, thus the unsigned bounds capture the * signed bounds * 3) the signed bounds cross zero, so they tell us nothing * about the result * If the value in dst_reg is known nonnegative, then again the * unsigned bounts capture the signed bounds. * Thus, in all cases it suffices to blow away our signed bounds * and rely on inferring new ones from the unsigned bounds and * var_off of the result. */ dst_reg->smin_value = S64_MIN; dst_reg->smax_value = S64_MAX; if (src_known) dst_reg->var_off = tnum_rshift(dst_reg->var_off, umin_val); else dst_reg->var_off = tnum_rshift(tnum_unknown, umin_val); dst_reg->umin_value >>= umax_val; dst_reg->umax_value >>= umin_val; /* We may learn something more from the var_off */ __update_reg_bounds(dst_reg); break; default: mark_reg_unknown(env, regs, insn->dst_reg); break; } __reg_deduce_bounds(dst_reg); __reg_bound_offset(dst_reg); return 0; } ",1 "void page_unlock_anon_vma_read(struct anon_vma *anon_vma) { anon_vma_unlock_read(anon_vma); } ",0 "static inline __maybe_unused int h2s_id(const struct h2s *h2s) { return h2s ? h2s->id : 0; } ",0 "rtadv_make_socket (vrf_id_t vrf_id) { int sock; int ret; struct icmp6_filter filter; if ( zserv_privs.change (ZPRIVS_RAISE) ) zlog_err (""rtadv_make_socket: could not raise privs, %s"", safe_strerror (errno) ); sock = vrf_socket (AF_INET6, SOCK_RAW, IPPROTO_ICMPV6, vrf_id); if ( zserv_privs.change (ZPRIVS_LOWER) ) zlog_err (""rtadv_make_socket: could not lower privs, %s"", safe_strerror (errno) ); /* When we can't make ICMPV6 socket simply back. Router advertisement feature will not be supported. */ if (sock < 0) { close (sock); return -1; } ret = setsockopt_ipv6_pktinfo (sock, 1); if (ret < 0) { close (sock); return ret; } ret = setsockopt_ipv6_multicast_loop (sock, 0); if (ret < 0) { close (sock); return ret; } ret = setsockopt_ipv6_unicast_hops (sock, 255); if (ret < 0) { close (sock); return ret; } ret = setsockopt_ipv6_multicast_hops (sock, 255); if (ret < 0) { close (sock); return ret; } ret = setsockopt_ipv6_hoplimit (sock, 1); if (ret < 0) { close (sock); return ret; } ICMP6_FILTER_SETBLOCKALL(&filter); ICMP6_FILTER_SETPASS (ND_ROUTER_SOLICIT, &filter); ICMP6_FILTER_SETPASS (ND_ROUTER_ADVERT, &filter); ret = setsockopt (sock, IPPROTO_ICMPV6, ICMP6_FILTER, &filter, sizeof (struct icmp6_filter)); if (ret < 0) { zlog_info (""ICMP6_FILTER set fail: %s"", safe_strerror (errno)); return ret; } return sock; } ",0 "bool ExtensionOptionsGuest::IsPreferredSizeModeEnabled() const { return true; } ",0 "static int inet6_dump_fib(struct sk_buff *skb, struct netlink_callback *cb) { struct net *net = sock_net(skb->sk); unsigned int h, s_h; unsigned int e = 0, s_e; struct rt6_rtnl_dump_arg arg; struct fib6_walker_t *w; struct fib6_table *tb; struct hlist_head *head; int res = 0; s_h = cb->args[0]; s_e = cb->args[1]; w = (void *)cb->args[2]; if (!w) { /* New dump: * * 1. hook callback destructor. */ cb->args[3] = (long)cb->done; cb->done = fib6_dump_done; /* * 2. allocate and initialize walker. */ w = kzalloc(sizeof(*w), GFP_ATOMIC); if (!w) return -ENOMEM; w->func = fib6_dump_node; cb->args[2] = (long)w; } arg.skb = skb; arg.cb = cb; arg.net = net; w->args = &arg; rcu_read_lock(); for (h = s_h; h < FIB6_TABLE_HASHSZ; h++, s_e = 0) { e = 0; head = &net->ipv6.fib_table_hash[h]; hlist_for_each_entry_rcu(tb, head, tb6_hlist) { if (e < s_e) goto next; res = fib6_dump_table(tb, skb, cb); if (res != 0) goto out; next: e++; } } out: rcu_read_unlock(); cb->args[1] = e; cb->args[0] = h; res = res < 0 ? res : skb->len; if (res <= 0) fib6_dump_end(cb); return res; } ",0 "scoped_refptr CreateBufferForTransfer( const T& input, UsbEndpointDirection direction, size_t size) { if (size >= kMaxTransferLength) return NULL; scoped_refptr buffer = new net::IOBuffer(std::max(static_cast(1), size)); if (direction == device::USB_DIRECTION_INBOUND) { return buffer; } else if (direction == device::USB_DIRECTION_OUTBOUND) { if (input.data.get() && size <= input.data->size()) { memcpy(buffer->data(), input.data->data(), size); return buffer; } } NOTREACHED(); return NULL; } ",0 "static void dwc3_reset_gadget(struct dwc3 *dwc) { if (!dwc->gadget_driver) return; if (dwc->gadget.speed != USB_SPEED_UNKNOWN) { spin_unlock(&dwc->lock); usb_gadget_udc_reset(&dwc->gadget, dwc->gadget_driver); spin_lock(&dwc->lock); } } ",0 "static void *load_bytes(RBinFile *arch, const ut8 *buf, ut64 sz, ut64 loadaddr, Sdb *sdb){ void *res = NULL; RBuffer *tbuf = NULL; if (!buf || !sz || sz == UT64_MAX) { return NULL; } tbuf = r_buf_new (); if (!tbuf) { return NULL; } r_buf_set_bytes (tbuf, buf, sz); res = r_bin_dex_new_buf (tbuf); r_buf_free (tbuf); return res; } ",0 "void LayerWebKitThread::releaseLayerResources() { deleteTextures(); size_t listSize = m_sublayers.size(); for (size_t i = 0; i < listSize; ++i) m_sublayers[i]->releaseLayerResources(); listSize = m_overlays.size(); for (size_t i = 0; i < listSize; ++i) m_overlays[i]->releaseLayerResources(); if (maskLayer()) maskLayer()->releaseLayerResources(); if (replicaLayer()) replicaLayer()->releaseLayerResources(); } ",0 "unsigned SkiaOutputSurfaceImpl::UpdateGpuFence() { return 0; } ",0 "void Document::initSecurityContext(const DocumentInit& initializer) { DCHECK(!getSecurityOrigin()); if (!initializer.hasSecurityContext()) { m_cookieURL = KURL(ParsedURLString, emptyString()); setSecurityOrigin(SecurityOrigin::createUnique()); initContentSecurityPolicy(); return; } enforceSandboxFlags(initializer.getSandboxFlags()); setInsecureRequestPolicy(initializer.getInsecureRequestPolicy()); if (initializer.insecureNavigationsToUpgrade()) { for (auto toUpgrade : *initializer.insecureNavigationsToUpgrade()) addInsecureNavigationUpgrade(toUpgrade); } if (isSandboxed(SandboxOrigin)) { m_cookieURL = m_url; setSecurityOrigin(SecurityOrigin::createUnique()); if (initializer.owner() && initializer.owner()->getSecurityOrigin()->isPotentiallyTrustworthy()) getSecurityOrigin()->setUniqueOriginIsPotentiallyTrustworthy(true); if (initializer.owner() && initializer.owner()->getSecurityOrigin()->canLoadLocalResources()) getSecurityOrigin()->grantLoadLocalResources(); } else if (initializer.owner()) { m_cookieURL = initializer.owner()->cookieURL(); setSecurityOrigin(initializer.owner()->getSecurityOrigin()); } else { m_cookieURL = m_url; setSecurityOrigin(SecurityOrigin::create(m_url)); } if (initializer.isHostedInReservedIPRange()) { setAddressSpace(getSecurityOrigin()->isLocalhost() ? WebAddressSpaceLocal : WebAddressSpacePrivate); } else if (getSecurityOrigin()->isLocal()) { setAddressSpace(WebAddressSpaceLocal); } else { setAddressSpace(WebAddressSpacePublic); } if (importsController()) { setContentSecurityPolicy(importsController()->master()->contentSecurityPolicy()); } else { initContentSecurityPolicy(); } if (getSecurityOrigin()->hasSuborigin()) enforceSuborigin(*getSecurityOrigin()->suborigin()); if (Settings* settings = initializer.settings()) { if (!settings->webSecurityEnabled()) { getSecurityOrigin()->grantUniversalAccess(); } else if (getSecurityOrigin()->isLocal()) { if (settings->allowUniversalAccessFromFileURLs()) { getSecurityOrigin()->grantUniversalAccess(); } else if (!settings->allowFileAccessFromFileURLs()) { getSecurityOrigin()->blockLocalAccessFromLocalOrigin(); } } } if (initializer.shouldTreatURLAsSrcdocDocument()) { m_isSrcdocDocument = true; setBaseURLOverride(initializer.parentBaseURL()); } if (getSecurityOrigin()->isUnique() && SecurityOrigin::create(m_url)->isPotentiallyTrustworthy()) getSecurityOrigin()->setUniqueOriginIsPotentiallyTrustworthy(true); if (getSecurityOrigin()->hasSuborigin()) enforceSuborigin(*getSecurityOrigin()->suborigin()); } ",0 "static void __d_rehash(struct dentry * entry, struct hlist_bl_head *b) { BUG_ON(!d_unhashed(entry)); hlist_bl_lock(b); entry->d_flags |= DCACHE_RCUACCESS; hlist_bl_add_head_rcu(&entry->d_hash, b); hlist_bl_unlock(b); } ",0 "static void snd_usbmidi_emagic_output(struct snd_usb_midi_out_endpoint *ep, struct urb *urb) { int port0 = ep->current_port; uint8_t *buf = urb->transfer_buffer; int buf_free = ep->max_transfer; int length, i; for (i = 0; i < 0x10; ++i) { /* round-robin, starting at the last current port */ int portnum = (port0 + i) & 15; struct usbmidi_out_port *port = &ep->ports[portnum]; if (!port->active) continue; if (snd_rawmidi_transmit_peek(port->substream, buf, 1) != 1) { port->active = 0; continue; } if (portnum != ep->current_port) { if (buf_free < 2) break; ep->current_port = portnum; buf[0] = 0xf5; buf[1] = (portnum + 1) & 15; buf += 2; buf_free -= 2; } if (buf_free < 1) break; length = snd_rawmidi_transmit(port->substream, buf, buf_free); if (length > 0) { buf += length; buf_free -= length; if (buf_free < 1) break; } } if (buf_free < ep->max_transfer && buf_free > 0) { *buf = 0xff; --buf_free; } urb->transfer_buffer_length = ep->max_transfer - buf_free; } ",0 "void __free_ep(struct kref *kref) { struct iwch_ep *ep; ep = container_of(container_of(kref, struct iwch_ep_common, kref), struct iwch_ep, com); PDBG(""%s ep %p state %s\n"", __func__, ep, states[state_read(&ep->com)]); if (test_bit(RELEASE_RESOURCES, &ep->com.flags)) { cxgb3_remove_tid(ep->com.tdev, (void *)ep, ep->hwtid); dst_release(ep->dst); l2t_release(ep->com.tdev, ep->l2t); } kfree(ep); } ",0 "vop_query_offset(struct vop_vdev *vdev, unsigned long offset, unsigned long *size, unsigned long *pa) { struct vop_device *vpdev = vdev->vpdev; unsigned long start = MIC_DP_SIZE; int i; /* * MMAP interface is as follows: * offset region * 0x0 virtio device_page * 0x1000 first vring * 0x1000 + size of 1st vring second vring * .... */ if (!offset) { *pa = virt_to_phys(vpdev->hw_ops->get_dp(vpdev)); *size = MIC_DP_SIZE; return 0; } for (i = 0; i < vdev->dd->num_vq; i++) { struct vop_vringh *vvr = &vdev->vvr[i]; if (offset == start) { *pa = virt_to_phys(vvr->vring.va); *size = vvr->vring.len; return 0; } start += vvr->vring.len; } return -1; } ",0 "void ResourceDispatcherHostImpl::RemovePendingRequest(int child_id, int request_id) { PendingRequestList::iterator i = pending_requests_.find( GlobalRequestID(child_id, request_id)); if (i == pending_requests_.end()) { NOTREACHED() << ""Trying to remove a request that's not here""; return; } RemovePendingRequest(i); } ",0 "void PaintLayerScrollableArea::ScrollbarVisibilityChanged() { UpdateScrollbarEnabledState(); layer_->GetLayoutObject().SetNeedsPaintPropertyUpdate(); layer_->ClearClipRects(); if (LayoutView* view = GetLayoutBox()->View()) view->ClearHitTestCache(); } ",0 "void AutofillPopupWarningView::CreateContent() { AutofillPopupController* controller = popup_view_->controller(); int horizontal_margin = GetHorizontalMargin(); int vertical_margin = AutofillPopupBaseView::GetCornerRadius(); SetLayoutManager(std::make_unique()); SetBorder(views::CreateEmptyBorder( gfx::Insets(vertical_margin, horizontal_margin))); views::Label* text_label = CreateLabelWithColorReadabilityDisabled( controller->GetElidedValueAt(line_number_), ChromeTextContext::CONTEXT_BODY_TEXT_LARGE, ChromeTextStyle::STYLE_RED); text_label->SetEnabledColor(popup_view_->GetWarningColor()); text_label->SetMultiLine(true); int max_width = std::min(kAutofillPopupMaxWidth, PopupViewCommon().CalculateMaxWidth( gfx::ToEnclosingRect(controller->element_bounds()), controller->container_view())); max_width -= 2 * horizontal_margin; text_label->SetMaximumWidth(max_width); text_label->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); AddChildView(text_label); } ",0 "static inline unsigned long realpath_cache_key(const char *path, int path_len) /* {{{ */ { register unsigned long h; const char *e = path + path_len; for (h = 2166136261U; path < e;) { h *= 16777619; h ^= *path++; } return h; } /* }}} */ ",0 "bool QQuickWebViewExperimental::useDefaultContentItemSize() const { Q_D(const QQuickWebView); return d->m_useDefaultContentItemSize; } ",0 "static void packet_cached_dev_assign(struct packet_sock *po, struct net_device *dev) { rcu_assign_pointer(po->cached_dev, dev); } ",0 "bool WindowsCreateFunction::ShouldOpenIncognitoWindow( const windows::Create::Params::CreateData* create_data, std::vector* urls, std::string* error) { Profile* profile = Profile::FromBrowserContext(browser_context()); const IncognitoModePrefs::Availability incognito_availability = IncognitoModePrefs::GetAvailability(profile->GetPrefs()); bool incognito = false; if (create_data && create_data->incognito) { incognito = *create_data->incognito; if (incognito && incognito_availability == IncognitoModePrefs::DISABLED) { *error = keys::kIncognitoModeIsDisabled; return false; } if (!incognito && incognito_availability == IncognitoModePrefs::FORCED) { *error = keys::kIncognitoModeIsForced; return false; } } else if (incognito_availability == IncognitoModePrefs::FORCED) { incognito = true; } if (incognito && !profile->IsGuestSession()) { std::string first_url_erased; for (size_t i = 0; i < urls->size();) { if (IsURLAllowedInIncognito((*urls)[i], profile)) { i++; } else { if (first_url_erased.empty()) first_url_erased = (*urls)[i].spec(); urls->erase(urls->begin() + i); } } if (urls->empty() && !first_url_erased.empty()) { *error = ErrorUtils::FormatErrorMessage( keys::kURLsNotAllowedInIncognitoError, first_url_erased); return false; } } return incognito; } ",0 "static void snd_usbmidi_error_timer(unsigned long data) { struct snd_usb_midi *umidi = (struct snd_usb_midi *)data; unsigned int i, j; spin_lock(&umidi->disc_lock); if (umidi->disconnected) { spin_unlock(&umidi->disc_lock); return; } for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { struct snd_usb_midi_in_endpoint *in = umidi->endpoints[i].in; if (in && in->error_resubmit) { in->error_resubmit = 0; for (j = 0; j < INPUT_URBS; ++j) { if (atomic_read(&in->urbs[j]->use_count)) continue; in->urbs[j]->dev = umidi->dev; snd_usbmidi_submit_urb(in->urbs[j], GFP_ATOMIC); } } if (umidi->endpoints[i].out) snd_usbmidi_do_output(umidi->endpoints[i].out); } spin_unlock(&umidi->disc_lock); } ",0 "void QQuickWebViewPrivate::_q_onUrlChanged() { updateIcon(); } ",0 "int64 BaseNode::GetExternalId() const { return GetEntry()->Get(syncable::LOCAL_EXTERNAL_ID); } ",0 "static int handle_invept(struct kvm_vcpu *vcpu) { u32 vmx_instruction_info, types; unsigned long type; gva_t gva; struct x86_exception e; struct { u64 eptp, gpa; } operand; if (!(nested_vmx_secondary_ctls_high & SECONDARY_EXEC_ENABLE_EPT) || !(nested_vmx_ept_caps & VMX_EPT_INVEPT_BIT)) { kvm_queue_exception(vcpu, UD_VECTOR); return 1; } if (!nested_vmx_check_permission(vcpu)) return 1; if (!kvm_read_cr0_bits(vcpu, X86_CR0_PE)) { kvm_queue_exception(vcpu, UD_VECTOR); return 1; } vmx_instruction_info = vmcs_read32(VMX_INSTRUCTION_INFO); type = kvm_register_readl(vcpu, (vmx_instruction_info >> 28) & 0xf); types = (nested_vmx_ept_caps >> VMX_EPT_EXTENT_SHIFT) & 6; if (!(types & (1UL << type))) { nested_vmx_failValid(vcpu, VMXERR_INVALID_OPERAND_TO_INVEPT_INVVPID); return 1; } /* According to the Intel VMX instruction reference, the memory * operand is read even if it isn't needed (e.g., for type==global) */ if (get_vmx_mem_address(vcpu, vmcs_readl(EXIT_QUALIFICATION), vmx_instruction_info, &gva)) return 1; if (kvm_read_guest_virt(&vcpu->arch.emulate_ctxt, gva, &operand, sizeof(operand), &e)) { kvm_inject_page_fault(vcpu, &e); return 1; } switch (type) { case VMX_EPT_EXTENT_GLOBAL: kvm_mmu_sync_roots(vcpu); kvm_make_request(KVM_REQ_TLB_FLUSH, vcpu); nested_vmx_succeed(vcpu); break; default: /* Trap single context invalidation invept calls */ BUG_ON(1); break; } skip_emulated_instruction(vcpu); return 1; } ",0 "static struct reply_buffer *alloc_reply_buffer( XExtDisplayInfo *info, int nbytes) { struct mem_cache_str *cache = (struct mem_cache_str *)info->data; struct reply_buffer *rbp; struct reply_buffer *saved_rb = NULL; /* * First look for an allocated buffer that is not in use. * If we have a big enough buffer, use that, otherwise * realloc an existing one. */ for (rbp = cache->reply_buffers; rbp; rbp = rbp->next) { if (rbp->ref_count == 0) { if (rbp->nbytes >= nbytes) return rbp; else saved_rb = rbp; } } if (saved_rb) { saved_rb->buf = (unsigned char *)Xrealloc(saved_rb->buf, nbytes); if (!saved_rb->buf) { saved_rb->nbytes = 0; return NULL; } saved_rb->nbytes = nbytes; return saved_rb; } /* * nothing available; malloc a new struct */ rbp = (struct reply_buffer *)Xmalloc(sizeof(struct reply_buffer)); if (!rbp) return NULL; rbp->buf = (unsigned char *)Xmalloc(nbytes); if (!rbp->buf) { Xfree(rbp); return NULL; } rbp->nbytes = nbytes; rbp->ref_count = 0; rbp->next = cache->reply_buffers; cache->reply_buffers = rbp; return rbp; } ",0 "static void activityLoggingAccessForAllWorldsMethodMethod(const v8::FunctionCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); imp->activityLoggingAccessForAllWorldsMethod(); } ",0 "getname6(netdissect_options *ndo, const u_char *ap) { register struct hostent *hp; union { struct in6_addr addr; struct for_hash_addr { char fill[14]; uint16_t d; } addra; } addr; struct h6namemem *p; register const char *cp; char ntop_buf[INET6_ADDRSTRLEN]; memcpy(&addr, ap, sizeof(addr)); p = &h6nametable[addr.addra.d & (HASHNAMESIZE-1)]; for (; p->nxt; p = p->nxt) { if (memcmp(&p->addr, &addr, sizeof(addr)) == 0) return (p->name); } p->addr = addr.addr; p->nxt = newh6namemem(ndo); /* * Do not print names if -n was given. */ if (!ndo->ndo_nflag) { #ifdef HAVE_CASPER if (capdns != NULL) { hp = cap_gethostbyaddr(capdns, (char *)&addr, sizeof(addr), AF_INET6); } else #endif hp = gethostbyaddr((char *)&addr, sizeof(addr), AF_INET6); if (hp) { char *dotp; p->name = strdup(hp->h_name); if (p->name == NULL) (*ndo->ndo_error)(ndo, ""getname6: strdup(hp->h_name)""); if (ndo->ndo_Nflag) { /* Remove domain qualifications */ dotp = strchr(p->name, '.'); if (dotp) *dotp = '\0'; } return (p->name); } } cp = addrtostr6(ap, ntop_buf, sizeof(ntop_buf)); p->name = strdup(cp); if (p->name == NULL) (*ndo->ndo_error)(ndo, ""getname6: strdup(cp)""); return (p->name); } ",0 "int SSL_library_init(void) { #ifndef OPENSSL_NO_DES EVP_add_cipher(EVP_des_cbc()); EVP_add_cipher(EVP_des_ede3_cbc()); #endif #ifndef OPENSSL_NO_IDEA EVP_add_cipher(EVP_idea_cbc()); #endif #ifndef OPENSSL_NO_RC4 EVP_add_cipher(EVP_rc4()); #if !defined(OPENSSL_NO_MD5) && (defined(__x86_64) || defined(__x86_64__)) EVP_add_cipher(EVP_rc4_hmac_md5()); #endif #endif #ifndef OPENSSL_NO_RC2 EVP_add_cipher(EVP_rc2_cbc()); /* Not actually used for SSL/TLS but this makes PKCS#12 work * if an application only calls SSL_library_init(). */ EVP_add_cipher(EVP_rc2_40_cbc()); #endif #ifndef OPENSSL_NO_AES EVP_add_cipher(EVP_aes_128_cbc()); EVP_add_cipher(EVP_aes_192_cbc()); EVP_add_cipher(EVP_aes_256_cbc()); EVP_add_cipher(EVP_aes_128_gcm()); EVP_add_cipher(EVP_aes_256_gcm()); #if 0 /* Disabled because of timing side-channel leaks. */ #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_SHA1) EVP_add_cipher(EVP_aes_128_cbc_hmac_sha1()); EVP_add_cipher(EVP_aes_256_cbc_hmac_sha1()); #endif #endif #endif #ifndef OPENSSL_NO_CAMELLIA #endif #ifndef OPENSSL_NO_CAMELLIA EVP_add_cipher(EVP_camellia_128_cbc()); EVP_add_cipher(EVP_camellia_256_cbc()); #endif #ifndef OPENSSL_NO_SEED EVP_add_cipher(EVP_seed_cbc()); #endif #ifndef OPENSSL_NO_MD5 EVP_add_digest(EVP_md5()); EVP_add_digest_alias(SN_md5,""ssl2-md5""); EVP_add_digest_alias(SN_md5,""ssl3-md5""); #endif #ifndef OPENSSL_NO_SHA EVP_add_digest(EVP_sha1()); /* RSA with sha1 */ EVP_add_digest_alias(SN_sha1,""ssl3-sha1""); EVP_add_digest_alias(SN_sha1WithRSAEncryption,SN_sha1WithRSA); #endif #ifndef OPENSSL_NO_SHA256 EVP_add_digest(EVP_sha224()); EVP_add_digest(EVP_sha256()); #endif #ifndef OPENSSL_NO_SHA512 EVP_add_digest(EVP_sha384()); EVP_add_digest(EVP_sha512()); #endif #if !defined(OPENSSL_NO_SHA) && !defined(OPENSSL_NO_DSA) EVP_add_digest(EVP_dss1()); /* DSA with sha1 */ EVP_add_digest_alias(SN_dsaWithSHA1,SN_dsaWithSHA1_2); EVP_add_digest_alias(SN_dsaWithSHA1,""DSS1""); EVP_add_digest_alias(SN_dsaWithSHA1,""dss1""); #endif #ifndef OPENSSL_NO_ECDSA EVP_add_digest(EVP_ecdsa()); #endif /* If you want support for phased out ciphers, add the following */ #if 0 EVP_add_digest(EVP_sha()); EVP_add_digest(EVP_dss()); #endif #ifndef OPENSSL_NO_COMP /* This will initialise the built-in compression algorithms. The value returned is a STACK_OF(SSL_COMP), but that can be discarded safely */ (void)SSL_COMP_get_compression_methods(); #endif /* initialize cipher/digest methods table */ ssl_load_ciphers(); return(1); } ",1 " IW_IMPL(void) iw_set_output_density(struct iw_context *ctx, double x, double y, int code) { ctx->img2.density_code = code; ctx->img2.density_x = x; ctx->img2.density_y = y; } ",0 "void AXObjectCacheImpl::postNotification(Node* node, AXNotification notification) { if (!node) return; postNotification(get(node), notification); } ",0 "void Document::cancelParsing() { if (!m_parser) return; detachParser(); explicitClose(); } ",0 "static Image *ReadTILEImage(const ImageInfo *image_info, ExceptionInfo *exception) { Image *image, *tile_image; ImageInfo *read_info; /* Initialize Image structure. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); *read_info->magick='\0'; tile_image=ReadImage(read_info,exception); read_info=DestroyImageInfo(read_info); if (tile_image == (Image *) NULL) return((Image *) NULL); image=AcquireImage(image_info); if ((image->columns == 0) || (image->rows == 0)) ThrowReaderException(OptionError,""MustSpecifyImageSize""); if (*image_info->filename == '\0') ThrowReaderException(OptionError,""MustSpecifyAnImageName""); image->colorspace=tile_image->colorspace; image->matte=tile_image->matte; if (image->matte != MagickFalse) (void) SetImageBackgroundColor(image); (void) CopyMagickString(image->filename,image_info->filename,MaxTextExtent); if (LocaleCompare(tile_image->magick,""PATTERN"") == 0) { tile_image->tile_offset.x=0; tile_image->tile_offset.y=0; } (void) TextureImage(image,tile_image); tile_image=DestroyImage(tile_image); if (image->colorspace == GRAYColorspace) image->type=GrayscaleType; return(GetFirstImageInList(image)); } ",1 "ClientHintsPreferences FrameFetchContext::GetClientHintsPreferences() const { if (IsDetached()) return frozen_state_->client_hints_preferences; if (!document_) return ClientHintsPreferences(); return document_->GetClientHintsPreferences(); } ",0 "GF_Err edts_dump(GF_Box *a, FILE * trace) { GF_EditBox *p; p = (GF_EditBox *)a; gf_isom_box_dump_start(a, ""EditBox"", trace); fprintf(trace, "">\n""); if (p->size) gf_isom_box_dump_ex(p->editList, trace, GF_ISOM_BOX_TYPE_ELST); gf_isom_box_dump_done(""EditBox"", a, trace); return GF_OK; } ",0 "static void FixupPort(const std::string& text, const url_parse::Component& part, std::string* url) { if (!part.is_valid()) return; url->append("":""); url->append(text, part.begin, part.len); } ",0 "static void on_srv_rfc_listen_started(tBTA_JV_RFCOMM_START *p_start, uint32_t id) { pthread_mutex_lock(&slot_lock); rfc_slot_t *slot = find_rfc_slot_by_id(id); if (!slot) goto out; if (p_start->status == BTA_JV_SUCCESS) { slot->rfc_handle = p_start->handle; } else cleanup_rfc_slot(slot); out:; pthread_mutex_unlock(&slot_lock); } ",0 "static void svm_set_nmi_mask(struct kvm_vcpu *vcpu, bool masked) { struct vcpu_svm *svm = to_svm(vcpu); if (masked) { svm->vcpu.arch.hflags |= HF_NMI_MASK; set_intercept(svm, INTERCEPT_IRET); } else { svm->vcpu.arch.hflags &= ~HF_NMI_MASK; clr_intercept(svm, INTERCEPT_IRET); } } ",0 "void address_space_stb(AddressSpace *as, hwaddr addr, uint32_t val, MemTxAttrs attrs, MemTxResult *result) { uint8_t v = val; MemTxResult r; r = address_space_rw(as, addr, attrs, &v, 1, 1); if (result) { *result = r; } } ",0 "static inline void avg_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ int i,j; for (i=0; i < height; i++) { for (j=0; j < width; j++) { dst[j] = (dst[j] + ((2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15) + 1) >> 1; } src += stride; dst += stride; } } ",0 "static bool ieee80211_tx_pending_skb(struct ieee80211_local *local, struct sk_buff *skb) { struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); struct ieee80211_sub_if_data *sdata; struct sta_info *sta; struct ieee80211_hdr *hdr; bool result; struct ieee80211_chanctx_conf *chanctx_conf; sdata = vif_to_sdata(info->control.vif); if (info->flags & IEEE80211_TX_INTFL_NEED_TXPROCESSING) { chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); if (unlikely(!chanctx_conf)) { dev_kfree_skb(skb); return true; } result = ieee80211_tx(sdata, skb, true, chanctx_conf->def.chan->band); } else { struct sk_buff_head skbs; __skb_queue_head_init(&skbs); __skb_queue_tail(&skbs, skb); hdr = (struct ieee80211_hdr *)skb->data; sta = sta_info_get(sdata, hdr->addr1); result = __ieee80211_tx(local, &skbs, skb->len, sta, true); } return result; } ",0 " skip_comment( FT_Byte* *acur, FT_Byte* limit ) { FT_Byte* cur = *acur; while ( cur < limit ) { if ( IS_PS_NEWLINE( *cur ) ) break; cur++; } *acur = cur; } ",0 "HTStructured *HTML_new(HTParentAnchor *anchor, HTFormat format_out, HTStream *stream) { HTStructured *me; CTRACE((tfp, ""start HTML_new\n"")); if (format_out != WWW_PLAINTEXT && format_out != WWW_PRESENT) { HTStream *intermediate = HTStreamStack(WWW_HTML, format_out, stream, anchor); if (intermediate) return HTMLGenerator(intermediate); fprintf(stderr, ""\n** Internal error: can't parse HTML to %s\n"", HTAtom_name(format_out)); exit_immediately(EXIT_FAILURE); } me = typecalloc(HTStructured); if (me == NULL) outofmem(__FILE__, ""HTML_new""); /* * This used to call 'get_styles()' only on the first time through this * function. However, if the user reloads a page with ^R, the styles[] * array is not necessarily the same as it was from 'get_styles()'. So * we reinitialize the whole thing. */ get_styles(); me->isa = &HTMLPresentation; me->node_anchor = anchor; me->CurrentA = NULL; me->CurrentANum = 0; me->base_href = NULL; me->map_address = NULL; HTChunkInit(&me->title, 128); HTChunkInit(&me->object, 128); me->object_started = FALSE; me->object_declare = FALSE; me->object_shapes = FALSE; me->object_ismap = FALSE; me->object_id = NULL; me->object_title = NULL; me->object_data = NULL; me->object_type = NULL; me->object_classid = NULL; me->object_codebase = NULL; me->object_codetype = NULL; me->object_usemap = NULL; me->object_name = NULL; HTChunkInit(&me->option, 128); me->first_option = TRUE; me->LastOptionValue = NULL; me->LastOptionChecked = FALSE; me->select_disabled = FALSE; HTChunkInit(&me->textarea, 128); me->textarea_name = NULL; me->textarea_name_cs = -1; me->textarea_accept_cs = NULL; me->textarea_cols = 0; me->textarea_rows = 4; me->textarea_id = NULL; HTChunkInit(&me->math, 128); HTChunkInit(&me->style_block, 128); HTChunkInit(&me->script, 128); me->text = 0; me->style_change = YES; /* Force check leading to text creation */ me->new_style = default_style; me->old_style = 0; me->current_default_alignment = HT_LEFT; me->sp = (me->stack + MAX_NESTING - 1); me->skip_stack = 0; me->sp->tag_number = -1; /* INVALID */ me->sp->style = default_style; /* INVALID */ me->sp->style->alignment = HT_LEFT; me->stack_overrun = FALSE; me->Division_Level = -1; me->Underline_Level = 0; me->Quote_Level = 0; me->UsePlainSpace = FALSE; me->HiddenValue = FALSE; me->lastraw = -1; /* * Used for nested lists. - FM */ me->List_Nesting_Level = -1; /* counter for list nesting level */ LYZero_OL_Counter(me); /* Initializes OL_Counter[] and OL_Type[] */ me->Last_OL_Count = 0; /* last count in ordered lists */ me->Last_OL_Type = '1'; /* last type in ordered lists */ me->inA = FALSE; me->inAPPLET = FALSE; me->inAPPLETwithP = FALSE; me->inBadBASE = FALSE; me->inBadHREF = FALSE; me->inBadHTML = FALSE; me->inBASE = FALSE; me->node_anchor->inBASE = FALSE; me->inBoldA = FALSE; me->inBoldH = FALSE; me->inCAPTION = FALSE; me->inCREDIT = FALSE; me->inFIG = FALSE; me->inFIGwithP = FALSE; me->inFONT = FALSE; me->inFORM = FALSE; me->inLABEL = FALSE; me->inP = FALSE; me->inPRE = FALSE; me->inSELECT = FALSE; me->inTABLE = FALSE; me->inUnderline = FALSE; me->needBoldH = FALSE; me->comment_start = NULL; me->comment_end = NULL; #ifdef USE_COLOR_STYLE #ifdef LY_FIND_LEAKS if (Style_className == 0) { atexit(free_Style_className); } #endif addClassName("""", """", (size_t) 0); class_string[0] = '\0'; #endif /* * Create a chartrans stage info structure for the anchor, if it does not * exist already (in which case the default MIME stage info will be loaded * as well), and load the HTML stage info into me->UCI and me->UCLYhndl. - * FM */ LYGetChartransInfo(me); UCTransParams_clear(&me->T); /* * Load the existing or default input charset info into the holding * elements. We'll believe what is indicated for UCT_STAGE_PARSER. - FM */ me->inUCLYhndl = HTAnchor_getUCLYhndl(me->node_anchor, UCT_STAGE_PARSER); if (me->inUCLYhndl < 0) { me->inUCLYhndl = HTAnchor_getUCLYhndl(me->node_anchor, UCT_STAGE_MIME); me->inUCI = HTAnchor_getUCInfoStage(me->node_anchor, UCT_STAGE_MIME); } else { me->inUCI = HTAnchor_getUCInfoStage(me->node_anchor, UCT_STAGE_PARSER); } /* * Load the existing or default output charset info into the holding * elements, UCT_STAGE_STRUCTURED should be the same as UCT_STAGE_TEXT at * this point, but we could check, perhaps. - FM */ me->outUCI = HTAnchor_getUCInfoStage(me->node_anchor, UCT_STAGE_STRUCTURED); me->outUCLYhndl = HTAnchor_getUCLYhndl(me->node_anchor, UCT_STAGE_STRUCTURED); me->target = stream; if (stream) me->targetClass = *stream->isa; /* Copy pointers */ return (HTStructured *) me; } ",0 "__sum16 __skb_checksum_complete_head(struct sk_buff *skb, int len) { __sum16 sum; sum = csum_fold(skb_checksum(skb, 0, len, skb->csum)); if (likely(!sum)) { if (unlikely(skb->ip_summed == CHECKSUM_COMPLETE)) netdev_rx_csum_fault(skb->dev); skb->ip_summed = CHECKSUM_UNNECESSARY; } return sum; } ",0 "static void LocationWithCallWithAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueFast(info, WTF::GetPtr(impl->locationWithCallWith()), impl); } ",0 "int hostap_set_encryption(local_info_t *local) { u16 val, old_val; int i, keylen, len, idx; char keybuf[WEP_KEY_LEN + 1]; enum { NONE, WEP, OTHER } encrypt_type; idx = local->crypt_info.tx_keyidx; if (local->crypt_info.crypt[idx] == NULL || local->crypt_info.crypt[idx]->ops == NULL) encrypt_type = NONE; else if (strcmp(local->crypt_info.crypt[idx]->ops->name, ""WEP"") == 0) encrypt_type = WEP; else encrypt_type = OTHER; if (local->func->get_rid(local->dev, HFA384X_RID_CNFWEPFLAGS, &val, 2, 1) < 0) { printk(KERN_DEBUG ""Could not read current WEP flags.\n""); goto fail; } le16_to_cpus(&val); old_val = val; if (encrypt_type != NONE || local->privacy_invoked) val |= HFA384X_WEPFLAGS_PRIVACYINVOKED; else val &= ~HFA384X_WEPFLAGS_PRIVACYINVOKED; if (local->open_wep || encrypt_type == NONE || ((local->ieee_802_1x || local->wpa) && local->host_decrypt)) val &= ~HFA384X_WEPFLAGS_EXCLUDEUNENCRYPTED; else val |= HFA384X_WEPFLAGS_EXCLUDEUNENCRYPTED; if ((encrypt_type != NONE || local->privacy_invoked) && (encrypt_type == OTHER || local->host_encrypt)) val |= HFA384X_WEPFLAGS_HOSTENCRYPT; else val &= ~HFA384X_WEPFLAGS_HOSTENCRYPT; if ((encrypt_type != NONE || local->privacy_invoked) && (encrypt_type == OTHER || local->host_decrypt)) val |= HFA384X_WEPFLAGS_HOSTDECRYPT; else val &= ~HFA384X_WEPFLAGS_HOSTDECRYPT; if (val != old_val && hostap_set_word(local->dev, HFA384X_RID_CNFWEPFLAGS, val)) { printk(KERN_DEBUG ""Could not write new WEP flags (0x%x)\n"", val); goto fail; } if (encrypt_type != WEP) return 0; /* 104-bit support seems to require that all the keys are set to the * same keylen */ keylen = 6; /* first 5 octets */ len = local->crypt_info.crypt[idx]->ops->get_key(keybuf, sizeof(keybuf), NULL, local->crypt_info.crypt[idx]->priv); if (idx >= 0 && idx < WEP_KEYS && len > 5) keylen = WEP_KEY_LEN + 1; /* first 13 octets */ for (i = 0; i < WEP_KEYS; i++) { memset(keybuf, 0, sizeof(keybuf)); if (local->crypt_info.crypt[i]) { (void) local->crypt_info.crypt[i]->ops->get_key( keybuf, sizeof(keybuf), NULL, local->crypt_info.crypt[i]->priv); } if (local->func->set_rid(local->dev, HFA384X_RID_CNFDEFAULTKEY0 + i, keybuf, keylen)) { printk(KERN_DEBUG ""Could not set key %d (len=%d)\n"", i, keylen); goto fail; } } if (hostap_set_word(local->dev, HFA384X_RID_CNFWEPDEFAULTKEYID, idx)) { printk(KERN_DEBUG ""Could not set default keyid %d\n"", idx); goto fail; } return 0; fail: printk(KERN_DEBUG ""%s: encryption setup failed\n"", local->dev->name); return -1; } ",0 "GraphicsLayer* FrameView::layerForScrollCorner() const { RenderView* renderView = this->renderView(); if (!renderView) return 0; return renderView->compositor()->layerForScrollCorner(); } ",0 "static bool cmd_cfa_access_metadata_storage(IDEState *s, uint8_t cmd) { switch (s->feature) { case 0x02: /* Inquiry Metadata Storage */ ide_cfata_metadata_inquiry(s); break; case 0x03: /* Read Metadata Storage */ ide_cfata_metadata_read(s); break; case 0x04: /* Write Metadata Storage */ ide_cfata_metadata_write(s); break; default: ide_abort_command(s); return true; } ide_transfer_start(s, s->io_buffer, 0x200, ide_transfer_stop); s->status = 0x00; /* NOTE: READY is _not_ set */ ide_set_irq(s->bus); return false; } ",0 "static int nf_tables_getgen(struct sock *nlsk, struct sk_buff *skb, const struct nlmsghdr *nlh, const struct nlattr * const nla[]) { struct net *net = sock_net(skb->sk); struct sk_buff *skb2; int err; skb2 = alloc_skb(NLMSG_GOODSIZE, GFP_KERNEL); if (skb2 == NULL) return -ENOMEM; err = nf_tables_fill_gen_info(skb2, net, NETLINK_CB(skb).portid, nlh->nlmsg_seq); if (err < 0) goto err; return nlmsg_unicast(nlsk, skb2, NETLINK_CB(skb).portid); err: kfree_skb(skb2); return err; } ",0 "e1000e_intmgr_collect_delayed_causes(E1000ECore *core) { uint32_t res; if (msix_enabled(core->owner)) { assert(core->delayed_causes == 0); return 0; } res = core->delayed_causes; core->delayed_causes = 0; e1000e_intrmgr_stop_delay_timers(core); return res; } ",0 "unsigned int inet_addr_type_table(struct net *net, __be32 addr, u32 tb_id) { return __inet_dev_addr_type(net, NULL, addr, tb_id); } ",0 "static void perf_output_read_group(struct perf_output_handle *handle, struct perf_event *event, u64 enabled, u64 running) { struct perf_event *leader = event->group_leader, *sub; u64 read_format = event->attr.read_format; u64 values[5]; int n = 0; values[n++] = 1 + leader->nr_siblings; if (read_format & PERF_FORMAT_TOTAL_TIME_ENABLED) values[n++] = enabled; if (read_format & PERF_FORMAT_TOTAL_TIME_RUNNING) values[n++] = running; if (leader != event) leader->pmu->read(leader); values[n++] = perf_event_count(leader); if (read_format & PERF_FORMAT_ID) values[n++] = primary_event_id(leader); __output_copy(handle, values, n * sizeof(u64)); list_for_each_entry(sub, &leader->sibling_list, group_entry) { n = 0; if (sub != event) sub->pmu->read(sub); values[n++] = perf_event_count(sub); if (read_format & PERF_FORMAT_ID) values[n++] = primary_event_id(sub); __output_copy(handle, values, n * sizeof(u64)); } } ",0 "ZSTD_encodeSequences_bmi2( void* dst, size_t dstCapacity, FSE_CTable const* CTable_MatchLength, BYTE const* mlCodeTable, FSE_CTable const* CTable_OffsetBits, BYTE const* ofCodeTable, FSE_CTable const* CTable_LitLength, BYTE const* llCodeTable, seqDef const* sequences, size_t nbSeq, int longOffsets) { return ZSTD_encodeSequences_body(dst, dstCapacity, CTable_MatchLength, mlCodeTable, CTable_OffsetBits, ofCodeTable, CTable_LitLength, llCodeTable, sequences, nbSeq, longOffsets); } ",0 "irc_server_add_to_infolist (struct t_infolist *infolist, struct t_irc_server *server) { struct t_infolist_item *ptr_item; if (!infolist || !server) return 0; ptr_item = weechat_infolist_new_item (infolist); if (!ptr_item) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""name"", server->name)) return 0; if (!weechat_infolist_new_var_pointer (ptr_item, ""buffer"", server->buffer)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""buffer_name"", (server->buffer) ? weechat_buffer_get_string (server->buffer, ""name"") : """")) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""buffer_short_name"", (server->buffer) ? weechat_buffer_get_string (server->buffer, ""short_name"") : """")) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""addresses"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_ADDRESSES))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""proxy"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PROXY))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""ipv6"", IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_IPV6))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""ssl"", IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""ssl_cert"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SSL_CERT))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""ssl_dhkey_size"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SSL_DHKEY_SIZE))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""ssl_verify"", IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_SSL_VERIFY))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""password"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_PASSWORD))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""sasl_mechanism"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_SASL_MECHANISM))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""sasl_username"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_USERNAME))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""sasl_password"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_SASL_PASSWORD))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""autoconnect"", IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOCONNECT))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""autoreconnect"", IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTORECONNECT))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""autoreconnect_delay"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTORECONNECT_DELAY))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""nicks"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_NICKS))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""username"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_USERNAME))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""realname"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_REALNAME))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""local_hostname"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_LOCAL_HOSTNAME))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""command"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_COMMAND))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""command_delay"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_COMMAND_DELAY))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""autojoin"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_AUTOJOIN))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""autorejoin"", IRC_SERVER_OPTION_BOOLEAN(server, IRC_SERVER_OPTION_AUTOREJOIN))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""autorejoin_delay"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AUTOREJOIN_DELAY))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""connection_timeout"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_CONNECTION_TIMEOUT))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""anti_flood_prio_high"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_HIGH))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""anti_flood_prio_low"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_ANTI_FLOOD_PRIO_LOW))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""away_check"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""away_check_max_nicks"", IRC_SERVER_OPTION_INTEGER(server, IRC_SERVER_OPTION_AWAY_CHECK_MAX_NICKS))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""default_msg_part"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_MSG_PART))) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""default_msg_quit"", IRC_SERVER_OPTION_STRING(server, IRC_SERVER_OPTION_DEFAULT_MSG_QUIT))) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""temp_server"", server->temp_server)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""index_current_address"", server->index_current_address)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""current_address"", server->current_address)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""current_ip"", server->current_ip)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""current_port"", server->current_port)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""sock"", server->sock)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""is_connected"", server->is_connected)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""ssl_connected"", server->ssl_connected)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""unterminated_message"", server->unterminated_message)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""nick"", server->nick)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""nick_modes"", server->nick_modes)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""isupport"", server->isupport)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""prefix_modes"", server->prefix_modes)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""prefix_chars"", server->prefix_chars)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""reconnect_delay"", server->reconnect_delay)) return 0; if (!weechat_infolist_new_var_time (ptr_item, ""reconnect_start"", server->reconnect_start)) return 0; if (!weechat_infolist_new_var_time (ptr_item, ""command_time"", server->command_time)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""reconnect_join"", server->reconnect_join)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""disable_autojoin"", server->disable_autojoin)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""is_away"", server->is_away)) return 0; if (!weechat_infolist_new_var_string (ptr_item, ""away_message"", server->away_message)) return 0; if (!weechat_infolist_new_var_time (ptr_item, ""away_time"", server->away_time)) return 0; if (!weechat_infolist_new_var_integer (ptr_item, ""lag"", server->lag)) return 0; if (!weechat_infolist_new_var_buffer (ptr_item, ""lag_check_time"", &(server->lag_check_time), sizeof (struct timeval))) return 0; if (!weechat_infolist_new_var_time (ptr_item, ""lag_next_check"", server->lag_next_check)) return 0; if (!weechat_infolist_new_var_time (ptr_item, ""lag_last_refresh"", server->lag_last_refresh)) return 0; if (!weechat_infolist_new_var_time (ptr_item, ""last_user_message"", server->last_user_message)) return 0; if (!weechat_infolist_new_var_time (ptr_item, ""last_away_check"", server->last_away_check)) return 0; return 1; } ",0 " RenderLayer* InRegionScrollableArea::layer() const { ASSERT(!m_isNull); return m_layer; } ",0 "new_files_cancel (NautilusDirectory *directory) { GList *l; NewFilesState *state; if (directory->details->new_files_in_progress != NULL) { for (l = directory->details->new_files_in_progress; l != NULL; l = l->next) { state = l->data; g_cancellable_cancel (state->cancellable); state->directory = NULL; } g_list_free (directory->details->new_files_in_progress); directory->details->new_files_in_progress = NULL; } } ",0 "bool RenderViewImpl::ShouldDisplayScrollbars(int width, int height) const { return (!send_preferred_size_changes_ || (disable_scrollbars_size_limit_.width() <= width || disable_scrollbars_size_limit_.height() <= height)); } ",0 "rpl_dio_printopt(netdissect_options *ndo, const struct rpl_dio_genoption *opt, u_int length) { if(length < RPL_DIO_GENOPTION_LEN) return; length -= RPL_DIO_GENOPTION_LEN; ND_TCHECK(opt->rpl_dio_len); while((opt->rpl_dio_type == RPL_OPT_PAD0 && (const u_char *)opt < ndo->ndo_snapend) || ND_TTEST2(*opt,(opt->rpl_dio_len+2))) { unsigned int optlen = opt->rpl_dio_len+2; if(opt->rpl_dio_type == RPL_OPT_PAD0) { optlen = 1; ND_PRINT((ndo, "" opt:pad0"")); } else { ND_PRINT((ndo, "" opt:%s len:%u "", tok2str(rpl_subopt_values, ""subopt:%u"", opt->rpl_dio_type), optlen)); if(ndo->ndo_vflag > 2) { unsigned int paylen = opt->rpl_dio_len; if(paylen > length) paylen = length; hex_print(ndo, "" "", ((const uint8_t *)opt) + RPL_DIO_GENOPTION_LEN, /* content of DIO option */ paylen); } } opt = (const struct rpl_dio_genoption *)(((const char *)opt) + optlen); length -= optlen; } return; trunc: ND_PRINT((ndo,"" [|truncated]"")); return; } ",0 "std::string InputMethodIBus::GetInputLocale() { return """"; } ",0 "static bool ExecuteMoveWordLeftAndModifySelection(LocalFrame& frame, Event*, EditorCommandSource, const String&) { frame.Selection().Modify(SelectionModifyAlteration::kExtend, SelectionModifyDirection::kLeft, TextGranularity::kWord, SetSelectionBy::kUser); return true; } ",0 "void TestDataReductionProxyConfig::SetWarmupURLFetchAttemptCounts( base::Optional previous_attempt_counts) { previous_attempt_counts_ = previous_attempt_counts; } ",0 "static long kvm_vcpu_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm_vcpu *vcpu = filp->private_data; void __user *argp = (void __user *)arg; int r; struct kvm_fpu *fpu = NULL; struct kvm_sregs *kvm_sregs = NULL; if (vcpu->kvm->mm != current->mm) return -EIO; if (unlikely(_IOC_TYPE(ioctl) != KVMIO)) return -EINVAL; #if defined(CONFIG_S390) || defined(CONFIG_PPC) || defined(CONFIG_MIPS) /* * Special cases: vcpu ioctls that are asynchronous to vcpu execution, * so vcpu_load() would break it. */ if (ioctl == KVM_S390_INTERRUPT || ioctl == KVM_S390_IRQ || ioctl == KVM_INTERRUPT) return kvm_arch_vcpu_ioctl(filp, ioctl, arg); #endif r = vcpu_load(vcpu); if (r) return r; switch (ioctl) { case KVM_RUN: r = -EINVAL; if (arg) goto out; if (unlikely(vcpu->pid != current->pids[PIDTYPE_PID].pid)) { /* The thread running this VCPU changed. */ struct pid *oldpid = vcpu->pid; struct pid *newpid = get_task_pid(current, PIDTYPE_PID); rcu_assign_pointer(vcpu->pid, newpid); if (oldpid) synchronize_rcu(); put_pid(oldpid); } r = kvm_arch_vcpu_ioctl_run(vcpu, vcpu->run); trace_kvm_userspace_exit(vcpu->run->exit_reason, r); break; case KVM_GET_REGS: { struct kvm_regs *kvm_regs; r = -ENOMEM; kvm_regs = kzalloc(sizeof(struct kvm_regs), GFP_KERNEL); if (!kvm_regs) goto out; r = kvm_arch_vcpu_ioctl_get_regs(vcpu, kvm_regs); if (r) goto out_free1; r = -EFAULT; if (copy_to_user(argp, kvm_regs, sizeof(struct kvm_regs))) goto out_free1; r = 0; out_free1: kfree(kvm_regs); break; } case KVM_SET_REGS: { struct kvm_regs *kvm_regs; r = -ENOMEM; kvm_regs = memdup_user(argp, sizeof(*kvm_regs)); if (IS_ERR(kvm_regs)) { r = PTR_ERR(kvm_regs); goto out; } r = kvm_arch_vcpu_ioctl_set_regs(vcpu, kvm_regs); kfree(kvm_regs); break; } case KVM_GET_SREGS: { kvm_sregs = kzalloc(sizeof(struct kvm_sregs), GFP_KERNEL); r = -ENOMEM; if (!kvm_sregs) goto out; r = kvm_arch_vcpu_ioctl_get_sregs(vcpu, kvm_sregs); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, kvm_sregs, sizeof(struct kvm_sregs))) goto out; r = 0; break; } case KVM_SET_SREGS: { kvm_sregs = memdup_user(argp, sizeof(*kvm_sregs)); if (IS_ERR(kvm_sregs)) { r = PTR_ERR(kvm_sregs); kvm_sregs = NULL; goto out; } r = kvm_arch_vcpu_ioctl_set_sregs(vcpu, kvm_sregs); break; } case KVM_GET_MP_STATE: { struct kvm_mp_state mp_state; r = kvm_arch_vcpu_ioctl_get_mpstate(vcpu, &mp_state); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, &mp_state, sizeof(mp_state))) goto out; r = 0; break; } case KVM_SET_MP_STATE: { struct kvm_mp_state mp_state; r = -EFAULT; if (copy_from_user(&mp_state, argp, sizeof(mp_state))) goto out; r = kvm_arch_vcpu_ioctl_set_mpstate(vcpu, &mp_state); break; } case KVM_TRANSLATE: { struct kvm_translation tr; r = -EFAULT; if (copy_from_user(&tr, argp, sizeof(tr))) goto out; r = kvm_arch_vcpu_ioctl_translate(vcpu, &tr); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, &tr, sizeof(tr))) goto out; r = 0; break; } case KVM_SET_GUEST_DEBUG: { struct kvm_guest_debug dbg; r = -EFAULT; if (copy_from_user(&dbg, argp, sizeof(dbg))) goto out; r = kvm_arch_vcpu_ioctl_set_guest_debug(vcpu, &dbg); break; } case KVM_SET_SIGNAL_MASK: { struct kvm_signal_mask __user *sigmask_arg = argp; struct kvm_signal_mask kvm_sigmask; sigset_t sigset, *p; p = NULL; if (argp) { r = -EFAULT; if (copy_from_user(&kvm_sigmask, argp, sizeof(kvm_sigmask))) goto out; r = -EINVAL; if (kvm_sigmask.len != sizeof(sigset)) goto out; r = -EFAULT; if (copy_from_user(&sigset, sigmask_arg->sigset, sizeof(sigset))) goto out; p = &sigset; } r = kvm_vcpu_ioctl_set_sigmask(vcpu, p); break; } case KVM_GET_FPU: { fpu = kzalloc(sizeof(struct kvm_fpu), GFP_KERNEL); r = -ENOMEM; if (!fpu) goto out; r = kvm_arch_vcpu_ioctl_get_fpu(vcpu, fpu); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, fpu, sizeof(struct kvm_fpu))) goto out; r = 0; break; } case KVM_SET_FPU: { fpu = memdup_user(argp, sizeof(*fpu)); if (IS_ERR(fpu)) { r = PTR_ERR(fpu); fpu = NULL; goto out; } r = kvm_arch_vcpu_ioctl_set_fpu(vcpu, fpu); break; } default: r = kvm_arch_vcpu_ioctl(filp, ioctl, arg); } out: vcpu_put(vcpu); kfree(fpu); kfree(kvm_sregs); return r; } ",0 " bool scroll_update() const { return scroll_update_; } ",0 "static void smbXcli_negprot_smb2_done(struct tevent_req *subreq) { struct tevent_req *req = tevent_req_callback_data(subreq, struct tevent_req); struct smbXcli_negprot_state *state = tevent_req_data(req, struct smbXcli_negprot_state); struct smbXcli_conn *conn = state->conn; size_t security_offset, security_length; DATA_BLOB blob; NTSTATUS status; struct iovec *iov; uint8_t *body; size_t i; uint16_t dialect_revision; struct smb2_negotiate_contexts c = { .num_contexts = 0, }; uint32_t negotiate_context_offset = 0; uint16_t negotiate_context_count = 0; DATA_BLOB negotiate_context_blob = data_blob_null; size_t avail; size_t ctx_ofs; size_t needed; struct smb2_negotiate_context *preauth = NULL; uint16_t hash_count; uint16_t salt_length; uint16_t hash_selected; struct hc_sha512state sctx; struct smb2_negotiate_context *cipher = NULL; struct iovec sent_iov[3]; static const struct smb2cli_req_expected_response expected[] = { { .status = NT_STATUS_OK, .body_size = 0x41 } }; status = smb2cli_req_recv(subreq, state, &iov, expected, ARRAY_SIZE(expected)); if (tevent_req_nterror(req, status)) { return; } body = (uint8_t *)iov[1].iov_base; dialect_revision = SVAL(body, 4); for (i=0; i < ARRAY_SIZE(smb2cli_prots); i++) { if (smb2cli_prots[i].proto < state->conn->min_protocol) { continue; } if (smb2cli_prots[i].proto > state->conn->max_protocol) { continue; } if (smb2cli_prots[i].smb2_dialect != dialect_revision) { continue; } conn->protocol = smb2cli_prots[i].proto; break; } if (conn->protocol == PROTOCOL_NONE) { TALLOC_FREE(subreq); if (state->conn->min_protocol >= PROTOCOL_SMB2_02) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } if (dialect_revision != SMB2_DIALECT_REVISION_2FF) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } /* make sure we do not loop forever */ state->conn->min_protocol = PROTOCOL_SMB2_02; /* * send a SMB2 negprot, in order to negotiate * the SMB2 dialect. */ subreq = smbXcli_negprot_smb2_subreq(state); if (tevent_req_nomem(subreq, req)) { return; } tevent_req_set_callback(subreq, smbXcli_negprot_smb2_done, req); return; } conn->smb2.server.security_mode = SVAL(body, 2); if (conn->protocol >= PROTOCOL_SMB3_10) { negotiate_context_count = SVAL(body, 6); } blob = data_blob_const(body + 8, 16); status = GUID_from_data_blob(&blob, &conn->smb2.server.guid); if (tevent_req_nterror(req, status)) { return; } conn->smb2.server.capabilities = IVAL(body, 24); conn->smb2.server.max_trans_size= IVAL(body, 28); conn->smb2.server.max_read_size = IVAL(body, 32); conn->smb2.server.max_write_size= IVAL(body, 36); conn->smb2.server.system_time = BVAL(body, 40); conn->smb2.server.start_time = BVAL(body, 48); security_offset = SVAL(body, 56); security_length = SVAL(body, 58); if (security_offset != SMB2_HDR_BODY + iov[1].iov_len) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } if (security_length > iov[2].iov_len) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } conn->smb2.server.gss_blob = data_blob_talloc(conn, iov[2].iov_base, security_length); if (tevent_req_nomem(conn->smb2.server.gss_blob.data, req)) { return; } if (conn->protocol < PROTOCOL_SMB3_10) { TALLOC_FREE(subreq); if (conn->smb2.server.capabilities & SMB2_CAP_ENCRYPTION) { conn->smb2.server.cipher = SMB2_ENCRYPTION_AES128_CCM; } tevent_req_done(req); return; } if (conn->smb2.server.capabilities & SMB2_CAP_ENCRYPTION) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } negotiate_context_offset = IVAL(body, 60); if (negotiate_context_offset < security_offset) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } ctx_ofs = negotiate_context_offset - security_offset; if (ctx_ofs > iov[2].iov_len) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } avail = iov[2].iov_len - security_length; needed = iov[2].iov_len - ctx_ofs; if (needed > avail) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } negotiate_context_blob.data = (uint8_t *)iov[2].iov_base; negotiate_context_blob.length = iov[2].iov_len; negotiate_context_blob.data += ctx_ofs; negotiate_context_blob.length -= ctx_ofs; status = smb2_negotiate_context_parse(state, negotiate_context_blob, &c); if (tevent_req_nterror(req, status)) { return; } if (negotiate_context_count != c.num_contexts) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } preauth = smb2_negotiate_context_find(&c, SMB2_PREAUTH_INTEGRITY_CAPABILITIES); if (preauth == NULL) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } if (preauth->data.length < 6) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } hash_count = SVAL(preauth->data.data, 0); salt_length = SVAL(preauth->data.data, 2); hash_selected = SVAL(preauth->data.data, 4); if (hash_count != 1) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } if (preauth->data.length != (6 + salt_length)) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } if (hash_selected != SMB2_PREAUTH_INTEGRITY_SHA512) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } cipher = smb2_negotiate_context_find(&c, SMB2_ENCRYPTION_CAPABILITIES); if (cipher != NULL) { uint16_t cipher_count; if (cipher->data.length < 2) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } cipher_count = SVAL(cipher->data.data, 0); if (cipher_count > 1) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } if (cipher->data.length != (2 + 2 * cipher_count)) { tevent_req_nterror(req, NT_STATUS_INVALID_NETWORK_RESPONSE); return; } if (cipher_count == 1) { uint16_t cipher_selected; cipher_selected = SVAL(cipher->data.data, 2); switch (cipher_selected) { case SMB2_ENCRYPTION_AES128_GCM: case SMB2_ENCRYPTION_AES128_CCM: conn->smb2.server.cipher = cipher_selected; break; } } } /* First we hash the request */ smb2cli_req_get_sent_iov(subreq, sent_iov); samba_SHA512_Init(&sctx); samba_SHA512_Update(&sctx, conn->smb2.preauth_sha512, sizeof(conn->smb2.preauth_sha512)); for (i = 0; i < 3; i++) { samba_SHA512_Update(&sctx, sent_iov[i].iov_base, sent_iov[i].iov_len); } samba_SHA512_Final(conn->smb2.preauth_sha512, &sctx); TALLOC_FREE(subreq); /* And now we hash the response */ samba_SHA512_Init(&sctx); samba_SHA512_Update(&sctx, conn->smb2.preauth_sha512, sizeof(conn->smb2.preauth_sha512)); for (i = 0; i < 3; i++) { samba_SHA512_Update(&sctx, iov[i].iov_base, iov[i].iov_len); } samba_SHA512_Final(conn->smb2.preauth_sha512, &sctx); tevent_req_done(req); } ",0 "void AutocompleteController::NotifyChanged(bool notify_default_match) { if (delegate_) delegate_->OnResultChanged(notify_default_match); if (done_) { content::NotificationService::current()->Notify( chrome::NOTIFICATION_AUTOCOMPLETE_CONTROLLER_RESULT_READY, content::Source(this), content::NotificationService::NoDetails()); } } ",0 "void WebKitTestController::OpenURL(const GURL& url) { if (test_phase_ != DURING_TEST) return; Shell::CreateNewWindow(main_window_->web_contents()->GetBrowserContext(), url, main_window_->web_contents()->GetSiteInstance(), gfx::Size()); } ",0 "static int inet6_set_link_af(struct net_device *dev, const struct nlattr *nla) { int err = -EINVAL; struct inet6_dev *idev = __in6_dev_get(dev); struct nlattr *tb[IFLA_INET6_MAX + 1]; if (!idev) return -EAFNOSUPPORT; if (nla_parse_nested(tb, IFLA_INET6_MAX, nla, NULL) < 0) BUG(); if (tb[IFLA_INET6_TOKEN]) { err = inet6_set_iftoken(idev, nla_data(tb[IFLA_INET6_TOKEN])); if (err) return err; } if (tb[IFLA_INET6_ADDR_GEN_MODE]) { u8 mode = nla_get_u8(tb[IFLA_INET6_ADDR_GEN_MODE]); if (mode != IN6_ADDR_GEN_MODE_EUI64 && mode != IN6_ADDR_GEN_MODE_NONE) return -EINVAL; idev->addr_gen_mode = mode; err = 0; } return err; } ",0 "static double highResUpTime() { static LARGE_INTEGER qpcLast; static DWORD tickCountLast; static bool inited; LARGE_INTEGER qpc; QueryPerformanceCounter(&qpc); DWORD tickCount = GetTickCount(); if (inited) { __int64 qpcElapsed = ((qpc.QuadPart - qpcLast.QuadPart) * 1000) / qpcFrequency.QuadPart; __int64 tickCountElapsed; if (tickCount >= tickCountLast) tickCountElapsed = (tickCount - tickCountLast); else { #if COMPILER(MINGW) __int64 tickCountLarge = tickCount + 0x100000000ULL; #else __int64 tickCountLarge = tickCount + 0x100000000I64; #endif tickCountElapsed = tickCountLarge - tickCountLast; } __int64 diff = tickCountElapsed - qpcElapsed; if (diff > 500 || diff < -500) syncedTime = false; } else inited = true; qpcLast = qpc; tickCountLast = tickCount; return (1000.0 * qpc.QuadPart) / static_cast(qpcFrequency.QuadPart); } ",0 "void MockNetworkTransaction::SetQuicServerInfo( QuicServerInfo* quic_server_info) { } ",0 "rend_service_load_auth_keys(rend_service_t *s, const char *hfname) { int r = 0; char *cfname = NULL; char *client_keys_str = NULL; strmap_t *parsed_clients = strmap_new(); FILE *cfile, *hfile; open_file_t *open_cfile = NULL, *open_hfile = NULL; char desc_cook_out[3*REND_DESC_COOKIE_LEN_BASE64+1]; char service_id[16+1]; char buf[1500]; /* Load client keys and descriptor cookies, if available. */ cfname = rend_service_path(s, client_keys_fname); client_keys_str = read_file_to_str(cfname, RFTS_IGNORE_MISSING, NULL); if (client_keys_str) { if (rend_parse_client_keys(parsed_clients, client_keys_str) < 0) { log_warn(LD_CONFIG, ""Previously stored client_keys file could not "" ""be parsed.""); goto err; } else { log_info(LD_CONFIG, ""Parsed %d previously stored client entries."", strmap_size(parsed_clients)); } } /* Prepare client_keys and hostname files. */ if (!(cfile = start_writing_to_stdio_file(cfname, OPEN_FLAGS_REPLACE | O_TEXT, 0600, &open_cfile))) { log_warn(LD_CONFIG, ""Could not open client_keys file %s"", escaped(cfname)); goto err; } if (!(hfile = start_writing_to_stdio_file(hfname, OPEN_FLAGS_REPLACE | O_TEXT, 0600, &open_hfile))) { log_warn(LD_CONFIG, ""Could not open hostname file %s"", escaped(hfname)); goto err; } /* Either use loaded keys for configured clients or generate new * ones if a client is new. */ SMARTLIST_FOREACH_BEGIN(s->clients, rend_authorized_client_t *, client) { rend_authorized_client_t *parsed = strmap_get(parsed_clients, client->client_name); int written; size_t len; /* Copy descriptor cookie from parsed entry or create new one. */ if (parsed) { memcpy(client->descriptor_cookie, parsed->descriptor_cookie, REND_DESC_COOKIE_LEN); } else { crypto_rand((char *) client->descriptor_cookie, REND_DESC_COOKIE_LEN); } /* For compatibility with older tor clients, this does not * truncate the padding characters, unlike rend_auth_encode_cookie. */ if (base64_encode(desc_cook_out, 3*REND_DESC_COOKIE_LEN_BASE64+1, (char *) client->descriptor_cookie, REND_DESC_COOKIE_LEN, 0) < 0) { log_warn(LD_BUG, ""Could not base64-encode descriptor cookie.""); goto err; } /* Copy client key from parsed entry or create new one if required. */ if (parsed && parsed->client_key) { client->client_key = crypto_pk_dup_key(parsed->client_key); } else if (s->auth_type == REND_STEALTH_AUTH) { /* Create private key for client. */ crypto_pk_t *prkey = NULL; if (!(prkey = crypto_pk_new())) { log_warn(LD_BUG,""Error constructing client key""); goto err; } if (crypto_pk_generate_key(prkey)) { log_warn(LD_BUG,""Error generating client key""); crypto_pk_free(prkey); goto err; } if (crypto_pk_check_key(prkey) <= 0) { log_warn(LD_BUG,""Generated client key seems invalid""); crypto_pk_free(prkey); goto err; } client->client_key = prkey; } /* Add entry to client_keys file. */ written = tor_snprintf(buf, sizeof(buf), ""client-name %s\ndescriptor-cookie %s\n"", client->client_name, desc_cook_out); if (written < 0) { log_warn(LD_BUG, ""Could not write client entry.""); goto err; } if (client->client_key) { char *client_key_out = NULL; if (crypto_pk_write_private_key_to_string(client->client_key, &client_key_out, &len) != 0) { log_warn(LD_BUG, ""Internal error: "" ""crypto_pk_write_private_key_to_string() failed.""); goto err; } if (rend_get_service_id(client->client_key, service_id)<0) { log_warn(LD_BUG, ""Internal error: couldn't encode service ID.""); /* * len is string length, not buffer length, but last byte is NUL * anyway. */ memwipe(client_key_out, 0, len); tor_free(client_key_out); goto err; } written = tor_snprintf(buf + written, sizeof(buf) - written, ""client-key\n%s"", client_key_out); memwipe(client_key_out, 0, len); tor_free(client_key_out); if (written < 0) { log_warn(LD_BUG, ""Could not write client entry.""); goto err; } } else { strlcpy(service_id, s->service_id, sizeof(service_id)); } if (fputs(buf, cfile) < 0) { log_warn(LD_FS, ""Could not append client entry to file: %s"", strerror(errno)); goto err; } /* Add line to hostname file. This is not the same encoding as in * client_keys. */ char *encoded_cookie = rend_auth_encode_cookie(client->descriptor_cookie, s->auth_type); if (!encoded_cookie) { log_warn(LD_BUG, ""Could not base64-encode descriptor cookie.""); goto err; } tor_snprintf(buf, sizeof(buf), ""%s.onion %s # client: %s\n"", service_id, encoded_cookie, client->client_name); memwipe(encoded_cookie, 0, strlen(encoded_cookie)); tor_free(encoded_cookie); if (fputs(buf, hfile)<0) { log_warn(LD_FS, ""Could not append host entry to file: %s"", strerror(errno)); goto err; } } SMARTLIST_FOREACH_END(client); finish_writing_to_file(open_cfile); finish_writing_to_file(open_hfile); goto done; err: r = -1; if (open_cfile) abort_writing_to_file(open_cfile); if (open_hfile) abort_writing_to_file(open_hfile); done: if (client_keys_str) { memwipe(client_keys_str, 0, strlen(client_keys_str)); tor_free(client_keys_str); } strmap_free(parsed_clients, rend_authorized_client_strmap_item_free); if (cfname) { memwipe(cfname, 0, strlen(cfname)); tor_free(cfname); } /* Clear stack buffers that held key-derived material. */ memwipe(buf, 0, sizeof(buf)); memwipe(desc_cook_out, 0, sizeof(desc_cook_out)); memwipe(service_id, 0, sizeof(service_id)); return r; } ",0 "zend_bool php_std_auto_global_callback(char *name, uint name_len) { zend_printf(""%s\n"", name); return 0; /* don't rearm */ } ",0 "static void local_socket_close_notify(asocket* s) { s->ready = local_socket_ready; s->shutdown = NULL; s->close = local_socket_close; SendFail(s->fd, ""closed""); s->close(s); } ",0 "void Parcel::Blob::release() { if (mMapped && mData) { ::munmap(mData, mSize); } clear(); } ",0 "verify_client_eku(krb5_context context, pkinit_kdc_context plgctx, pkinit_kdc_req_context reqctx, int *eku_accepted) { krb5_error_code retval; *eku_accepted = 0; if (plgctx->opts->require_eku == 0) { pkiDebug(""%s: configuration requests no EKU checking\n"", __FUNCTION__); *eku_accepted = 1; retval = 0; goto out; } retval = crypto_check_cert_eku(context, plgctx->cryptoctx, reqctx->cryptoctx, plgctx->idctx, 0, /* kdc cert */ plgctx->opts->accept_secondary_eku, eku_accepted); if (retval) { pkiDebug(""%s: Error from crypto_check_cert_eku %d (%s)\n"", __FUNCTION__, retval, error_message(retval)); goto out; } out: pkiDebug(""%s: returning retval %d, eku_accepted %d\n"", __FUNCTION__, retval, *eku_accepted); return retval; } ",0 "int can_nice(const struct task_struct *p, const int nice) { /* convert nice value [19,-20] to rlimit style value [1,40] */ int nice_rlim = 20 - nice; return (nice_rlim <= task_rlimit(p, RLIMIT_NICE) || capable(CAP_SYS_NICE)); } ",0 "static FontViewBase *FVAny(void) { return (FontViewBase *) fv_list; } ",0 "static bool megasas_frame_is_sense64(MegasasCmd *cmd) { return cmd->flags & MFI_FRAME_SENSE64; } ",0 "void kvm_before_handle_nmi(struct kvm_vcpu *vcpu) { percpu_write(current_vcpu, vcpu); } ",0 "X509_VERIFY_PARAM_get_depth(const X509_VERIFY_PARAM *param) { return param->depth; } ",0 "static void vmx_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2) { *info1 = vmcs_readl(EXIT_QUALIFICATION); *info2 = vmcs_read32(VM_EXIT_INTR_INFO); } ",0 "static int compat_target_to_user(struct ebt_entry_target *t, void __user **dstptr, unsigned int *size) { const struct xt_target *target = t->u.target; struct compat_ebt_entry_mwt __user *cm = *dstptr; int off = xt_compat_target_offset(target); compat_uint_t tsize = t->target_size - off; if (WARN_ON(off >= t->target_size)) return -EINVAL; if (copy_to_user(cm->u.name, target->name, strlen(target->name) + 1) || put_user(tsize, &cm->match_size)) return -EFAULT; if (target->compat_to_user) { if (target->compat_to_user(cm->data, t->data)) return -EFAULT; } else { if (xt_data_to_user(cm->data, t->data, target->usersize, tsize, COMPAT_XT_ALIGN(tsize))) return -EFAULT; } *size -= ebt_compat_entry_padsize() + off; *dstptr = cm->data; *dstptr += tsize; return 0; } ",0 "handle_t *ext4_journal_start_sb(struct super_block *sb, int nblocks) { journal_t *journal; if (sb->s_flags & MS_RDONLY) return ERR_PTR(-EROFS); /* Special case here: if the journal has aborted behind our * backs (eg. EIO in the commit thread), then we still need to * take the FS itself readonly cleanly. */ journal = EXT4_SB(sb)->s_journal; if (journal) { if (is_journal_aborted(journal)) { ext4_abort(sb, __func__, ""Detected aborted journal""); return ERR_PTR(-EROFS); } return jbd2_journal_start(journal, nblocks); } return ext4_get_nojournal(); } ",0 "static EAS_RESULT Parse_lins (SDLS_SYNTHESIZER_DATA *pDLSData, EAS_I32 pos, EAS_I32 size) { EAS_RESULT result; EAS_U32 temp; EAS_I32 endChunk; EAS_I32 chunkPos; /* seek to start of chunk */ if ((result = EAS_HWFileSeek(pDLSData->hwInstData, pDLSData->fileHandle, pos)) != EAS_SUCCESS) return result; /* read to end of chunk */ endChunk = pos + size; while (pos < endChunk) { chunkPos = pos; /* get the next chunk type */ if ((result = NextChunk(pDLSData, &pos, &temp, &size)) != EAS_SUCCESS) return result; /* only instrument chunks are useful */ if (temp != CHUNK_INS) continue; if ((result = Parse_ins(pDLSData, chunkPos + 12, size)) != EAS_SUCCESS) return result; } return EAS_SUCCESS; } ",0 "static int start_command_port(struct usb_serial *serial) { struct usb_serial_port *command_port; struct whiteheat_command_private *command_info; int retval = 0; command_port = serial->port[COMMAND_PORT]; command_info = usb_get_serial_port_data(command_port); mutex_lock(&command_info->mutex); if (!command_info->port_running) { /* Work around HCD bugs */ usb_clear_halt(serial->dev, command_port->read_urb->pipe); retval = usb_submit_urb(command_port->read_urb, GFP_KERNEL); if (retval) { dev_err(&serial->dev->dev, ""%s - failed submitting read urb, error %d\n"", __func__, retval); goto exit; } } command_info->port_running++; exit: mutex_unlock(&command_info->mutex); return retval; } ",0 "Browser* InProcessBrowserTest::CreateBrowser(Profile* profile) { Browser* browser = new Browser( Browser::CreateParams(profile, chrome::GetActiveDesktop())); AddBlankTabAndShow(browser); return browser; } ",0 "fire_sched_out_preempt_notifiers(struct task_struct *curr, struct task_struct *next) { if (static_key_false(&preempt_notifier_key)) __fire_sched_out_preempt_notifiers(curr, next); } ",0 "static inline int timer_delete_hook(struct k_itimer *timer) { const struct k_clock *kc = timer->kclock; if (WARN_ON_ONCE(!kc || !kc->timer_del)) return -EINVAL; return kc->timer_del(timer); } ",0 "check_allowed_to_delegate_to(krb5_context context, krb5_const_principal client, const krb5_db_entry *server, krb5_const_principal proxy) { /* Can't get a TGT (otherwise it would be unconstrained delegation) */ if (krb5_is_tgs_principal(proxy)) return KRB5KDC_ERR_POLICY; /* Must be in same realm */ if (!krb5_realm_compare(context, server->princ, proxy)) return KRB5KDC_ERR_POLICY; return krb5_db_check_allowed_to_delegate(context, client, server, proxy); } ",0 "MagickExport int ErrorBlob(const Image *image) { BlobInfo *magick_restrict blob_info; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); assert(image->blob != (BlobInfo *) NULL); assert(image->blob->type != UndefinedStream); blob_info=image->blob; switch (blob_info->type) { case UndefinedStream: case StandardStream: break; case FileStream: case PipeStream: { blob_info->error=ferror(blob_info->file_info.file); break; } case ZipStream: { #if defined(MAGICKCORE_ZLIB_DELEGATE) (void) gzerror(blob_info->file_info.gzfile,&blob_info->error); #endif break; } case BZipStream: { #if defined(MAGICKCORE_BZLIB_DELEGATE) (void) BZ2_bzerror(blob_info->file_info.bzfile,&blob_info->error); #endif break; } case FifoStream: { blob_info->error=0; break; } case BlobStream: break; case CustomStream: break; } return(blob_info->error); } ",0 "static int lg_event(struct hid_device *hdev, struct hid_field *field, struct hid_usage *usage, __s32 value) { struct lg_drv_data *drv_data = hid_get_drvdata(hdev); if ((drv_data->quirks & LG_INVERT_HWHEEL) && usage->code == REL_HWHEEL) { input_event(field->hidinput->input, usage->type, usage->code, -value); return 1; } if (drv_data->quirks & LG_FF4) { return lg4ff_adjust_input_event(hdev, field, usage, value, drv_data); } return 0; } ",0 "standard_info(png_structp pp, png_infop pi) { standard_display *dp = voidcast(standard_display*, png_get_progressive_ptr(pp)); /* Call with nImages==1 because the progressive reader can only produce one * image. */ standard_info_imp(dp, pp, pi, 1 /*only one image*/); } ",0 " virtual void SetUp() { UUT_ = GET_PARAM(2); /* Set up guard blocks for an inner block centered in the outer block */ for (int i = 0; i < kOutputBufferSize; ++i) { if (IsIndexInBorder(i)) output_[i] = 255; else output_[i] = 0; } ::libvpx_test::ACMRandom prng; for (int i = 0; i < kInputBufferSize; ++i) input_[i] = prng.Rand8Extremes(); } ",1 "print_outgoing_header (Header *header) { switch (header->type) { case G_DBUS_MESSAGE_TYPE_METHOD_CALL: g_print (""C%d: -> %s call %s.%s at %s\n"", header->serial, header->destination ? header->destination : ""(no dest)"", header->interface ? header->interface : """", header->member ? header->member : """", header->path ? header->path : """"); break; case G_DBUS_MESSAGE_TYPE_METHOD_RETURN: g_print (""C%d: -> %s return from B%d\n"", header->serial, header->destination ? header->destination : ""(no dest)"", header->reply_serial); break; case G_DBUS_MESSAGE_TYPE_ERROR: g_print (""C%d: -> %s return error %s from B%d\n"", header->serial, header->destination ? header->destination : ""(no dest)"", header->error_name ? header->error_name : ""(no error)"", header->reply_serial); break; case G_DBUS_MESSAGE_TYPE_SIGNAL: g_print (""C%d: -> %s signal %s.%s at %s\n"", header->serial, header->destination ? header->destination : ""all"", header->interface ? header->interface : """", header->member ? header->member : """", header->path ? header->path : """"); break; default: g_print (""unknown message type\n""); } } ",0 "gfx::Size RootWindowHost::GetNativeScreenSize() { ::Display* xdisplay = base::MessagePumpX::GetDefaultXDisplay(); return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); } ",0 "void ScriptController::disableEval(const String& errorMessage) { if (!m_windowShell->isContextInitialized()) return; v8::HandleScope handleScope(m_isolate); v8::Local v8Context = m_windowShell->context(); v8Context->AllowCodeGenerationFromStrings(false); v8Context->SetErrorMessageForCodeGenerationFromStrings(v8String(errorMessage, m_isolate)); } ",0 "void RenderFrameHostImpl::OnSwapOutACK() { OnSwappedOut(); } ",0 "static void vmxnet3_cleanup(NetClientState *nc) { VMXNET3State *s = qemu_get_nic_opaque(nc); s->nic = NULL; } ",0 " cfm_network_addr_print(netdissect_options *ndo, register const u_char *tptr) { u_int network_addr_type; u_int hexdump = FALSE; /* * Altough AFIs are tpically 2 octects wide, * 802.1ab specifies that this field width * is only once octet */ network_addr_type = *tptr; ND_PRINT((ndo, ""\n\t Network Address Type %s (%u)"", tok2str(af_values, ""Unknown"", network_addr_type), network_addr_type)); /* * Resolve the passed in Address. */ switch(network_addr_type) { case AFNUM_INET: ND_PRINT((ndo, "", %s"", ipaddr_string(ndo, tptr + 1))); break; case AFNUM_INET6: ND_PRINT((ndo, "", %s"", ip6addr_string(ndo, tptr + 1))); break; default: hexdump = TRUE; break; } return hexdump; } ",1 "static inline int ap_test_config_domain(unsigned int domain) { if (!ap_configuration) return 1; return ap_test_config(ap_configuration->aqm, domain); } ",0 "void WebFrameLoaderClient::dispatchDidStartProvisionalLoad() { WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl(); if (!ds) { NOTREACHED() << ""Attempting to provisional load but there isn't one""; return; } GURL url = ds->request().url(); DCHECK(!ds->hasRedirectChain()); bool completing_client_redirect = false; if (expected_client_redirect_src_.is_valid()) { DCHECK(expected_client_redirect_dest_.SchemeIs(""javascript"") || expected_client_redirect_dest_ == url); ds->appendRedirect(expected_client_redirect_src_); completing_client_redirect = true; } ds->appendRedirect(url); if (webframe_->client()) { webframe_->client()->didStartProvisionalLoad(webframe_); if (completing_client_redirect) webframe_->client()->didCompleteClientRedirect( webframe_, expected_client_redirect_src_); } } ",0 "int tty_add_file(struct tty_struct *tty, struct file *file) { struct tty_file_private *priv; priv = kmalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; priv->tty = tty; priv->file = file; file->private_data = priv; spin_lock(&tty_files_lock); list_add(&priv->list, &tty->tty_files); spin_unlock(&tty_files_lock); return 0; } ",0 "void RenderViewImpl::CheckPreferredSize() { if (!send_preferred_size_changes_ || !webview()) return; gfx::Size size(webview()->mainFrame()->contentsPreferredWidth(), webview()->mainFrame()->documentElementScrollHeight()); double zoom_factor = WebView::zoomLevelToZoomFactor(webview()->zoomLevel()); size.set_width(static_cast(size.width() * zoom_factor)); size.set_height(static_cast(size.height() * zoom_factor)); if (size == preferred_size_) return; preferred_size_ = size; Send(new ViewHostMsg_DidContentsPreferredSizeChange(routing_id_, preferred_size_)); } ",0 "HTMLKeygenElement::HTMLKeygenElement(Document& document, HTMLFormElement* form) : HTMLFormControlElementWithState(keygenTag, document, form) { ScriptWrappable::init(this); ensureUserAgentShadowRoot(); } ",0 "void RenderViewImpl::OnUpdateTargetURLAck() { if (target_url_status_ == TARGET_PENDING) Send(new ViewHostMsg_UpdateTargetURL(GetRoutingID(), pending_target_url_)); target_url_status_ = TARGET_NONE; } ",0 "node_get_verbose_nickname(const node_t *node, char *verbose_name_out) { const char *nickname = node_get_nickname(node); int is_named = node_is_named(node); verbose_name_out[0] = '$'; base16_encode(verbose_name_out+1, HEX_DIGEST_LEN+1, node->identity, DIGEST_LEN); if (!nickname) return; verbose_name_out[1+HEX_DIGEST_LEN] = is_named ? '=' : '~'; strlcpy(verbose_name_out+1+HEX_DIGEST_LEN+1, nickname, MAX_NICKNAME_LEN+1); } ",0 "void RenderBox::paintFillLayer(const PaintInfo& paintInfo, const Color& c, const FillLayer* fillLayer, const LayoutRect& rect, BackgroundBleedAvoidance bleedAvoidance, CompositeOperator op, RenderObject* backgroundObject) { paintFillLayerExtended(paintInfo, c, fillLayer, rect, bleedAvoidance, 0, LayoutSize(), op, backgroundObject); } ",0 "static void Sp_concat(js_State *J) { int i, top = js_gettop(J); int n; char * volatile out; const char *s; if (top == 1) return; s = checkstring(J, 0); n = strlen(s); out = js_malloc(J, n + 1); strcpy(out, s); if (js_try(J)) { js_free(J, out); js_throw(J); } for (i = 1; i < top; ++i) { s = js_tostring(J, i); n += strlen(s); out = js_realloc(J, out, n + 1); strcat(out, s); } js_pushstring(J, out); js_endtry(J); js_free(J, out); } ",0 "externalSubsetDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name, const xmlChar *ExternalID, const xmlChar *SystemID) { callbacks++; if (quiet) return; fprintf(SAXdebug, ""SAX.externalSubset(%s,"", name); if (ExternalID == NULL) fprintf(SAXdebug, "" ,""); else fprintf(SAXdebug, "" %s,"", ExternalID); if (SystemID == NULL) fprintf(SAXdebug, "" )\n""); else fprintf(SAXdebug, "" %s)\n"", SystemID); } ",0 "static int kvm_vm_ioctl_get_pit(struct kvm *kvm, struct kvm_pit_state *ps) { int r = 0; mutex_lock(&kvm->arch.vpit->pit_state.lock); memcpy(ps, &kvm->arch.vpit->pit_state, sizeof(struct kvm_pit_state)); mutex_unlock(&kvm->arch.vpit->pit_state.lock); return r; } ",0 "void put_futex_key(int fshared, union futex_key *key) { drop_futex_key_refs(key); } ",0 "static struct inotify_inode_mark *inotify_idr_find_locked(struct fsnotify_group *group, int wd) { struct idr *idr = &group->inotify_data.idr; spinlock_t *idr_lock = &group->inotify_data.idr_lock; struct inotify_inode_mark *i_mark; assert_spin_locked(idr_lock); i_mark = idr_find(idr, wd); if (i_mark) { struct fsnotify_mark *fsn_mark = &i_mark->fsn_mark; fsnotify_get_mark(fsn_mark); /* One ref for being in the idr, one ref we just took */ BUG_ON(atomic_read(&fsn_mark->refcnt) < 2); } return i_mark; } ",0 "void RenderWidget::OnRequestMoveAck() { DCHECK(pending_window_rect_count_); pending_window_rect_count_--; } ",0 "u32 kernel_sock_ip_overhead(struct sock *sk) { struct inet_sock *inet; struct ip_options_rcu *opt; u32 overhead = 0; #if IS_ENABLED(CONFIG_IPV6) struct ipv6_pinfo *np; struct ipv6_txoptions *optv6 = NULL; #endif /* IS_ENABLED(CONFIG_IPV6) */ if (!sk) return overhead; switch (sk->sk_family) { case AF_INET: inet = inet_sk(sk); overhead += sizeof(struct iphdr); opt = rcu_dereference_protected(inet->inet_opt, sock_owned_by_user(sk)); if (opt) overhead += opt->opt.optlen; return overhead; #if IS_ENABLED(CONFIG_IPV6) case AF_INET6: np = inet6_sk(sk); overhead += sizeof(struct ipv6hdr); if (np) optv6 = rcu_dereference_protected(np->opt, sock_owned_by_user(sk)); if (optv6) overhead += (optv6->opt_flen + optv6->opt_nflen); return overhead; #endif /* IS_ENABLED(CONFIG_IPV6) */ default: /* Returns 0 overhead if the socket is not ipv4 or ipv6 */ return overhead; } } ",0 "JSTestMediaQueryListListenerConstructor::JSTestMediaQueryListListenerConstructor(Structure* structure, JSDOMGlobalObject* globalObject) : DOMConstructorObject(structure, globalObject) { } ",0 "int main(int argc, char *argv[]) { int ret; struct lxc_lock *lock; lock = lxc_newlock(NULL, NULL); if (!lock) { fprintf(stderr, ""%d: failed to get unnamed lock\n"", __LINE__); exit(1); } ret = lxclock(lock, 0); if (ret) { fprintf(stderr, ""%d: failed to take unnamed lock (%d)\n"", __LINE__, ret); exit(1); } ret = lxcunlock(lock); if (ret) { fprintf(stderr, ""%d: failed to put unnamed lock (%d)\n"", __LINE__, ret); exit(1); } lxc_putlock(lock); lock = lxc_newlock(""/var/lib/lxc"", mycontainername); if (!lock) { fprintf(stderr, ""%d: failed to get lock\n"", __LINE__); exit(1); } struct stat sb; char *pathname = RUNTIME_PATH ""/lock/lxc/var/lib/lxc/""; ret = stat(pathname, &sb); if (ret != 0) { fprintf(stderr, ""%d: filename %s not created\n"", __LINE__, pathname); exit(1); } lxc_putlock(lock); test_two_locks(); fprintf(stderr, ""all tests passed\n""); exit(ret); } ",1 "void PwnMessageHelper::FileSystemCreate(RenderProcessHost* process, int request_id, GURL path, bool exclusive, bool is_directory, bool recursive) { TestFileapiOperationWaiter waiter( process->GetStoragePartition()->GetFileSystemContext()); IPC::IpcSecurityTestUtil::PwnMessageReceived( process->GetChannel(), FileSystemHostMsg_Create(request_id, path, exclusive, is_directory, recursive)); if (waiter.did_start_update()) waiter.WaitForEndUpdate(); } ",0 "bool RenderViewImpl::ForceCompositingModeEnabled() { return webkit_preferences_.force_compositing_mode; } ",0 "static void coroutine_fn v9fs_link(void *opaque) { V9fsPDU *pdu = opaque; int32_t dfid, oldfid; V9fsFidState *dfidp, *oldfidp; V9fsString name; size_t offset = 7; int err = 0; v9fs_string_init(&name); err = pdu_unmarshal(pdu, offset, ""dds"", &dfid, &oldfid, &name); if (err < 0) { goto out_nofid; } trace_v9fs_link(pdu->tag, pdu->id, dfid, oldfid, name.data); if (name_is_illegal(name.data)) { err = -ENOENT; goto out_nofid; } if (!strcmp(""."", name.data) || !strcmp("".."", name.data)) { err = -EEXIST; goto out_nofid; } dfidp = get_fid(pdu, dfid); if (dfidp == NULL) { err = -ENOENT; goto out_nofid; } oldfidp = get_fid(pdu, oldfid); if (oldfidp == NULL) { err = -ENOENT; goto out; } err = v9fs_co_link(pdu, oldfidp, dfidp, &name); if (!err) { err = offset; } put_fid(pdu, oldfidp); out: put_fid(pdu, dfidp); out_nofid: v9fs_string_free(&name); pdu_complete(pdu, err); } ",0 "GahpClient::getVersion() { return server->m_gahp_version; } ",0 "ikev2_ID_print(netdissect_options *ndo, u_char tpay, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { const struct ikev2_id *idp; struct ikev2_id id; int id_len, idtype_len, i; unsigned int dumpascii, dumphex; const unsigned char *typedata; idp = (const struct ikev2_id *)ext; ND_TCHECK(*idp); UNALIGNED_MEMCPY(&id, ext, sizeof(id)); ikev2_pay_print(ndo, NPSTR(tpay), id.h.critical); id_len = ntohs(id.h.len); ND_PRINT((ndo,"" len=%d"", id_len - 4)); if (2 < ndo->ndo_vflag && 4 < id_len) { /* Print the entire payload in hex */ ND_PRINT((ndo,"" "")); if (!rawprint(ndo, (const uint8_t *)(ext + 1), id_len - 4)) goto trunc; } idtype_len =id_len - sizeof(struct ikev2_id); dumpascii = 0; dumphex = 0; typedata = (const unsigned char *)(ext)+sizeof(struct ikev2_id); switch(id.type) { case ID_IPV4_ADDR: ND_PRINT((ndo, "" ipv4:"")); dumphex=1; break; case ID_FQDN: ND_PRINT((ndo, "" fqdn:"")); dumpascii=1; break; case ID_RFC822_ADDR: ND_PRINT((ndo, "" rfc822:"")); dumpascii=1; break; case ID_IPV6_ADDR: ND_PRINT((ndo, "" ipv6:"")); dumphex=1; break; case ID_DER_ASN1_DN: ND_PRINT((ndo, "" dn:"")); dumphex=1; break; case ID_DER_ASN1_GN: ND_PRINT((ndo, "" gn:"")); dumphex=1; break; case ID_KEY_ID: ND_PRINT((ndo, "" keyid:"")); dumphex=1; break; } if(dumpascii) { ND_TCHECK2(*typedata, idtype_len); for(i=0; i iter = CreateIterator(); ASSERT_THAT(iter->OpenNextEntry(&entry1), IsOk()); char key2[2000]; char key3[20000]; CacheTestFillBuffer(key2, sizeof(key2), true); CacheTestFillBuffer(key3, sizeof(key3), true); key2[sizeof(key2) - 1] = '\0'; key3[sizeof(key3) - 1] = '\0'; ASSERT_THAT(CreateEntry(key2, &entry2), IsOk()); ASSERT_THAT(CreateEntry(key3, &entry3), IsOk()); const int kBufSize = 20000; scoped_refptr buf(new net::IOBuffer(kBufSize)); memset(buf->data(), 0, kBufSize); EXPECT_EQ(100, WriteData(entry2, 0, 0, buf.get(), 100, false)); EXPECT_EQ(kBufSize, WriteData(entry3, 0, 0, buf.get(), kBufSize, false)); EXPECT_NE(net::OK, iter->OpenNextEntry(&entry4)); EXPECT_EQ(0, cache_->GetEntryCount()); EXPECT_NE(net::OK, CreateEntry(""cache is disabled"", &entry4)); EXPECT_EQ(100, ReadData(entry2, 0, 0, buf.get(), 100)); EXPECT_EQ(100, WriteData(entry2, 0, 0, buf.get(), 100, false)); EXPECT_EQ(100, WriteData(entry2, 1, 0, buf.get(), 100, false)); EXPECT_EQ(kBufSize, ReadData(entry3, 0, 0, buf.get(), kBufSize)); EXPECT_EQ(kBufSize, WriteData(entry3, 0, 0, buf.get(), kBufSize, false)); EXPECT_EQ(kBufSize, WriteData(entry3, 1, 0, buf.get(), kBufSize, false)); std::string key = entry2->GetKey(); EXPECT_EQ(sizeof(key2) - 1, key.size()); key = entry3->GetKey(); EXPECT_EQ(sizeof(key3) - 1, key.size()); entry1->Close(); entry2->Close(); entry3->Close(); FlushQueueForTest(); // Flushing the Close posts a task to restart the cache. FlushQueueForTest(); // This one actually allows that task to complete. EXPECT_EQ(0, cache_->GetEntryCount()); } ",0 "static void srpt_mad_send_handler(struct ib_mad_agent *mad_agent, struct ib_mad_send_wc *mad_wc) { ib_destroy_ah(mad_wc->send_buf->ah); ib_free_send_mad(mad_wc->send_buf); } ",0 " ~ResourceClientProxy() { } ",0 "ssh_packet_set_protocol_flags(struct ssh *ssh, u_int protocol_flags) { ssh->state->remote_protocol_flags = protocol_flags; } ",0 "VOID ParaNdis_QueueRSSDpc(PARANDIS_ADAPTER *pContext, ULONG MessageIndex, PGROUP_AFFINITY pTargetAffinity) { #if PARANDIS_SUPPORT_RSS NdisMQueueDpcEx(pContext->InterruptHandle, MessageIndex, pTargetAffinity, NULL); #else UNREFERENCED_PARAMETER(pContext); UNREFERENCED_PARAMETER(MessageIndex); UNREFERENCED_PARAMETER(pTargetAffinity); ASSERT(FALSE); #endif } ",0 "void TopSitesImpl::Init(const base::FilePath& db_name) { backend_ = new TopSitesBackend(); backend_->Init(db_name); backend_->GetMostVisitedThumbnails( base::Bind(&TopSitesImpl::OnGotMostVisitedThumbnails, base::Unretained(this)), &cancelable_task_tracker_); } ",0 "static int check_stack_read(struct bpf_verifier_env *env, struct bpf_func_state *reg_state /* func where register points to */, int off, int size, int value_regno) { struct bpf_verifier_state *vstate = env->cur_state; struct bpf_func_state *state = vstate->frame[vstate->curframe]; int i, slot = -off - 1, spi = slot / BPF_REG_SIZE; u8 *stype; if (reg_state->allocated_stack <= slot) { verbose(env, ""invalid read from stack off %d+0 size %d\n"", off, size); return -EACCES; } stype = reg_state->stack[spi].slot_type; if (stype[0] == STACK_SPILL) { if (size != BPF_REG_SIZE) { verbose(env, ""invalid size of register spill\n""); return -EACCES; } for (i = 1; i < BPF_REG_SIZE; i++) { if (stype[(slot - i) % BPF_REG_SIZE] != STACK_SPILL) { verbose(env, ""corrupted spill memory\n""); return -EACCES; } } if (value_regno >= 0) { /* restore register state from stack */ state->regs[value_regno] = reg_state->stack[spi].spilled_ptr; /* mark reg as written since spilled pointer state likely * has its liveness marks cleared by is_state_visited() * which resets stack/reg liveness for state transitions */ state->regs[value_regno].live |= REG_LIVE_WRITTEN; } mark_reg_read(env, ®_state->stack[spi].spilled_ptr, reg_state->stack[spi].spilled_ptr.parent); return 0; } else { int zeros = 0; for (i = 0; i < size; i++) { if (stype[(slot - i) % BPF_REG_SIZE] == STACK_MISC) continue; if (stype[(slot - i) % BPF_REG_SIZE] == STACK_ZERO) { zeros++; continue; } verbose(env, ""invalid read from stack off %d+%d size %d\n"", off, i, size); return -EACCES; } mark_reg_read(env, ®_state->stack[spi].spilled_ptr, reg_state->stack[spi].spilled_ptr.parent); if (value_regno >= 0) { if (zeros == size) { /* any size read into register is zero extended, * so the whole register == const_zero */ __mark_reg_const_zero(&state->regs[value_regno]); } else { /* have read misc data from the stack */ mark_reg_unknown(env, state->regs, value_regno); } state->regs[value_regno].live |= REG_LIVE_WRITTEN; } return 0; } } ",0 "PolkitQt1::Authority::Result PolkitResultEventLoop::result() const { return m_result; } ",0 "int ip6_mr_input(struct sk_buff *skb) { struct mfc6_cache *cache; struct net *net = dev_net(skb->dev); struct mr6_table *mrt; struct flowi6 fl6 = { .flowi6_iif = skb->dev->ifindex, .flowi6_mark = skb->mark, }; int err; err = ip6mr_fib_lookup(net, &fl6, &mrt); if (err < 0) { kfree_skb(skb); return err; } read_lock(&mrt_lock); cache = ip6mr_cache_find(mrt, &ipv6_hdr(skb)->saddr, &ipv6_hdr(skb)->daddr); if (!cache) { int vif = ip6mr_find_vif(mrt, skb->dev); if (vif >= 0) cache = ip6mr_cache_find_any(mrt, &ipv6_hdr(skb)->daddr, vif); } /* * No usable cache entry */ if (!cache) { int vif; vif = ip6mr_find_vif(mrt, skb->dev); if (vif >= 0) { int err = ip6mr_cache_unresolved(mrt, vif, skb); read_unlock(&mrt_lock); return err; } read_unlock(&mrt_lock); kfree_skb(skb); return -ENODEV; } ip6_mr_forward(net, mrt, skb, cache); read_unlock(&mrt_lock); return 0; } ",0 "static void perf_adjust_freq_unthr_context(struct perf_event_context *ctx, int needs_unthr) { struct perf_event *event; struct hw_perf_event *hwc; u64 now, period = TICK_NSEC; s64 delta; /* * only need to iterate over all events iff: * - context have events in frequency mode (needs freq adjust) * - there are events to unthrottle on this cpu */ if (!(ctx->nr_freq || needs_unthr)) return; raw_spin_lock(&ctx->lock); perf_pmu_disable(ctx->pmu); list_for_each_entry_rcu(event, &ctx->event_list, event_entry) { if (event->state != PERF_EVENT_STATE_ACTIVE) continue; if (!event_filter_match(event)) continue; hwc = &event->hw; if (needs_unthr && hwc->interrupts == MAX_INTERRUPTS) { hwc->interrupts = 0; perf_log_throttle(event, 1); event->pmu->start(event, 0); } if (!event->attr.freq || !event->attr.sample_freq) continue; /* * stop the event and update event->count */ event->pmu->stop(event, PERF_EF_UPDATE); now = local64_read(&event->count); delta = now - hwc->freq_count_stamp; hwc->freq_count_stamp = now; /* * restart the event * reload only if value has changed * we have stopped the event so tell that * to perf_adjust_period() to avoid stopping it * twice. */ if (delta > 0) perf_adjust_period(event, period, delta, false); event->pmu->start(event, delta > 0 ? PERF_EF_RELOAD : 0); } perf_pmu_enable(ctx->pmu); raw_spin_unlock(&ctx->lock); } ",0 "daemon_msg_open_req(uint8 ver, struct daemon_slpars *pars, uint32 plen, char *source, size_t sourcelen) { char errbuf[PCAP_ERRBUF_SIZE]; // buffer for network errors char errmsgbuf[PCAP_ERRBUF_SIZE]; // buffer for errors to send to the client pcap_t *fp; // pcap_t main variable int nread; char sendbuf[RPCAP_NETBUF_SIZE]; // temporary buffer in which data to be sent is buffered int sendbufidx = 0; // index which keeps the number of bytes currently buffered struct rpcap_openreply *openreply; // open reply message if (plen > sourcelen - 1) { pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, ""Source string too long""); goto error; } nread = sock_recv(pars->sockctrl, source, plen, SOCK_RECEIVEALL_YES|SOCK_EOF_IS_ERROR, errbuf, PCAP_ERRBUF_SIZE); if (nread == -1) { rpcapd_log(LOGPRIO_ERROR, ""Read from client failed: %s"", errbuf); return -1; } source[nread] = '\0'; plen -= nread; if (is_url(source)) { pcap_snprintf(errmsgbuf, PCAP_ERRBUF_SIZE, ""Source string refers to a remote device""); goto error; } if ((fp = pcap_open_live(source, 1500 /* fake snaplen */, 0 /* no promis */, 1000 /* fake timeout */, errmsgbuf)) == NULL) goto error; if (sock_bufferize(NULL, sizeof(struct rpcap_header), NULL, &sendbufidx, RPCAP_NETBUF_SIZE, SOCKBUF_CHECKONLY, errmsgbuf, PCAP_ERRBUF_SIZE) == -1) goto error; rpcap_createhdr((struct rpcap_header *) sendbuf, ver, RPCAP_MSG_OPEN_REPLY, 0, sizeof(struct rpcap_openreply)); openreply = (struct rpcap_openreply *) &sendbuf[sendbufidx]; if (sock_bufferize(NULL, sizeof(struct rpcap_openreply), NULL, &sendbufidx, RPCAP_NETBUF_SIZE, SOCKBUF_CHECKONLY, errmsgbuf, PCAP_ERRBUF_SIZE) == -1) goto error; memset(openreply, 0, sizeof(struct rpcap_openreply)); openreply->linktype = htonl(pcap_datalink(fp)); openreply->tzoff = 0; /* This is always 0 for live captures */ pcap_close(fp); if (sock_send(pars->sockctrl, sendbuf, sendbufidx, errbuf, PCAP_ERRBUF_SIZE) == -1) { rpcapd_log(LOGPRIO_ERROR, ""Send to client failed: %s"", errbuf); return -1; } return 0; error: if (rpcap_senderror(pars->sockctrl, ver, PCAP_ERR_OPEN, errmsgbuf, errbuf) == -1) { rpcapd_log(LOGPRIO_ERROR, ""Send to client failed: %s"", errbuf); return -1; } if (rpcapd_discard(pars->sockctrl, plen) == -1) { return -1; } return 0; } ",0 "bool AXNodeObject::isGenericFocusableElement() const { if (!canSetFocusAttribute()) return false; if (isControl()) return false; if (m_ariaRole != UnknownRole) return false; if (hasContentEditableAttributeSet()) return false; if (roleValue() == WebAreaRole) return false; if (isHTMLBodyElement(getNode())) return false; if (roleValue() == SVGRootRole) return false; return true; } ",0 "static int __writepage(struct page *page, struct writeback_control *wbc, void *data) { struct address_space *mapping = data; int ret = ext4_writepage(page, wbc); mapping_set_error(mapping, ret); return ret; } ",0 "void ParamTraits::Log(const param_type& p, std::string* l) { ParamTraits::Log(p.ToInternalValue(), l); } ",0 "void HTMLFormControlElement::requiredAttributeChanged() { setNeedsValidityCheck(); pseudoStateChanged(CSSSelector::PseudoRequired); pseudoStateChanged(CSSSelector::PseudoOptional); } ",0 "static void process_lock_setup_atfork(void) { pthread_atfork(cgm_lock, cgm_unlock, cgm_unlock); } ",0 "static int wddx_stack_destroy(wddx_stack *stack) { register int i; if (stack->elements) { for (i = 0; i < stack->top; i++) { if (((st_entry *)stack->elements[i])->data) { zval_ptr_dtor(&((st_entry *)stack->elements[i])->data); } if (((st_entry *)stack->elements[i])->varname) { efree(((st_entry *)stack->elements[i])->varname); } efree(stack->elements[i]); } efree(stack->elements); } return SUCCESS; } ",0 " void SpoolAllPagesWithBoundariesForTesting( WebCanvas* canvas, const FloatSize& page_size_in_pixels) { DispatchEventsForPrintingOnAllFrames(); if (!GetFrame()->GetDocument() || GetFrame()->GetDocument()->GetLayoutViewItem().IsNull()) return; GetFrame()->View()->UpdateAllLifecyclePhasesExceptPaint(); if (!GetFrame()->GetDocument() || GetFrame()->GetDocument()->GetLayoutViewItem().IsNull()) return; ComputePageRects(page_size_in_pixels); const float page_width = page_size_in_pixels.Width(); size_t num_pages = PageRects().size(); int total_height = num_pages * (page_size_in_pixels.Height() + 1) - 1; IntRect all_pages_rect(0, 0, page_width, total_height); PaintRecordBuilder builder(all_pages_rect, &canvas->getMetaData()); GraphicsContext& context = builder.Context(); context.SetPrinting(true); context.BeginRecording(all_pages_rect); context.FillRect(FloatRect(0, 0, page_width, total_height), Color::kWhite); int current_height = 0; for (size_t page_index = 0; page_index < num_pages; page_index++) { if (page_index > 0) { context.Save(); context.SetStrokeColor(Color(0, 0, 255)); context.SetFillColor(Color(0, 0, 255)); context.DrawLine(IntPoint(0, current_height), IntPoint(page_width, current_height)); context.Restore(); } AffineTransform transform; transform.Translate(0, current_height); #if defined(OS_WIN) || defined(OS_MACOSX) float scale = GetPageShrink(page_index); transform.Scale(scale, scale); #endif context.Save(); context.ConcatCTM(transform); SpoolPage(context, page_index, all_pages_rect); context.Restore(); current_height += page_size_in_pixels.Height() + 1; } canvas->drawPicture(context.EndRecording()); } ",0 "static int emulator_read_pmc(struct x86_emulate_ctxt *ctxt, u32 pmc, u64 *pdata) { return kvm_pmu_read_pmc(emul_to_vcpu(ctxt), pmc, pdata); } ",0 "mm_bsdauth_query(void *ctx, char **name, char **infotxt, u_int *numprompts, char ***prompts, u_int **echo_on) { Buffer m; u_int success; char *challenge; debug3(""%s: entering"", __func__); buffer_init(&m); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHQUERY, &m); mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_BSDAUTHQUERY, &m); success = buffer_get_int(&m); if (success == 0) { debug3(""%s: no challenge"", __func__); buffer_free(&m); return (-1); } /* Get the challenge, and format the response */ challenge = buffer_get_string(&m, NULL); buffer_free(&m); mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); (*prompts)[0] = challenge; debug3(""%s: received challenge: %s"", __func__, challenge); return (0); } ",0 "void *jas_realloc(void *ptr, size_t size) { void *result; jas_mb_t *mb; jas_mb_t *old_mb; size_t old_size; size_t ext_size; size_t mem; JAS_DBGLOG(100, (""jas_realloc(%x, %zu)\n"", ptr, size)); if (!ptr) { return jas_malloc(size); } if (ptr && !size) { jas_free(ptr); } if (!jas_safe_size_add(size, JAS_MB_SIZE, &ext_size)) { jas_eprintf(""requested memory size is too large\n""); return 0; } old_mb = jas_get_mb(ptr); old_size = old_mb->size; JAS_DBGLOG(101, (""jas_realloc: old_mb=%x; old_size=%zu\n"", old_mb, old_size)); if (size > old_size) { if (!jas_safe_size_add(jas_mem, ext_size, &mem) || mem > jas_max_mem) { jas_eprintf(""maximum memory limit would be exceeded\n""); return 0; } } else { if (!jas_safe_size_sub(jas_mem, old_size - size, &jas_mem)) { jas_eprintf(""heap corruption detected\n""); abort(); } } JAS_DBGLOG(100, (""jas_realloc: realloc(%p, %zu)\n"", old_mb, ext_size)); if (!(mb = realloc(old_mb, ext_size))) { result = 0; } else { result = jas_mb_get_data(mb); mb->size = size; jas_mem = mem; } JAS_DBGLOG(100, (""jas_realloc(%p, %zu) -> %p (%p)\n"", ptr, size, result, mb)); JAS_DBGLOG(102, (""max_mem=%zu; mem=%zu\n"", jas_max_mem, jas_mem)); return result; } ",0 "ofputil_decode_ofp10_phy_port(struct ofputil_phy_port *pp, const struct ofp10_phy_port *opp) { pp->port_no = u16_to_ofp(ntohs(opp->port_no)); pp->hw_addr = opp->hw_addr; ovs_strlcpy(pp->name, opp->name, OFP_MAX_PORT_NAME_LEN); pp->config = ntohl(opp->config) & OFPPC10_ALL; pp->state = ntohl(opp->state) & OFPPS10_ALL; pp->curr = netdev_port_features_from_ofp10(opp->curr); pp->advertised = netdev_port_features_from_ofp10(opp->advertised); pp->supported = netdev_port_features_from_ofp10(opp->supported); pp->peer = netdev_port_features_from_ofp10(opp->peer); pp->curr_speed = netdev_features_to_bps(pp->curr, 0) / 1000; pp->max_speed = netdev_features_to_bps(pp->supported, 0) / 1000; return 0; } ",0 "void PaintPatcher::DerefPatch() { DCHECK(begin_paint_.is_patched()); DCHECK(end_paint_.is_patched()); --refcount_; if (refcount_ == 0) { begin_paint_.Unpatch(); end_paint_.Unpatch(); } } ",0 "unix_client_disconnect(hsm_com_client_hdl_t *hdl) { if(unix_sck_send_disconnect(hdl, 2) != HSM_COM_OK) { return(-1); } close(hdl->client_fd); hdl->client_state = HSM_COM_C_STATE_IN; return HSM_COM_OK; } ",0 "static int shutdown_other_smbds(struct db_record *rec, const struct connections_key *key, const struct connections_data *crec, void *private_data) { const char *ip = (const char *)private_data; if (!process_exists(crec->pid)) { return 0; } if (procid_is_me(&crec->pid)) { return 0; } if (strcmp(ip, crec->addr) != 0) { return 0; } DEBUG(0,(""shutdown_other_smbds: shutting down pid %u "" ""(IP %s)\n"", (unsigned int)procid_to_pid(&crec->pid), ip)); messaging_send(smbd_messaging_context(), crec->pid, MSG_SHUTDOWN, &data_blob_null); return 0; } ",0 "void InputHandler::setInputModeEnabled(bool active) { FocusLog(LogLevelInfo, ""InputHandler::setInputModeEnabled '%s', override is '%s'"" , active ? ""true"" : ""false"" , m_webPage->m_dumpRenderTree || Platform::Settings::instance()->alwaysShowKeyboardOnFocus() ? ""true"" : ""false""); m_inputModeEnabled = active; if (isInputModeEnabled() && isActiveTextEdit() && !m_currentFocusElement->document()->frame()->selection()->isFocused()) m_currentFocusElement->document()->frame()->selection()->setFocused(true); } ",0 "static void tsc210x_timer_tick(void *opaque) { TSC210xState *s = opaque; /* Timer ticked -- a set of conversions has been finished. */ if (!s->busy) return; s->busy = 0; s->dav |= mode_regs[s->function]; tsc210x_pin_update(s); qemu_irq_lower(s->davint); } ",0 "static gboolean motion_notify_event(GtkWidget *text_view, GdkEventMotion *event) { gint x, y; gtk_text_view_window_to_buffer_coords(GTK_TEXT_VIEW(text_view), GTK_TEXT_WINDOW_WIDGET, event->x, event->y, &x, &y); set_cursor_if_appropriate(GTK_TEXT_VIEW(text_view), x, y); return FALSE; } ",0 "bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { FastSetActiveURL(active_url_, active_url_hash_); if (decoder_.get() && message.type() != GpuCommandBufferMsg_Echo::ID && message.type() != GpuCommandBufferMsg_RetireSyncPoint::ID && message.type() != GpuCommandBufferMsg_WaitSyncPoint::ID) { if (!MakeCurrent()) return false; } bool handled = true; IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, OnInitialize); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer, OnSetGetBuffer); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetSharedStateBuffer, OnSetSharedStateBuffer); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, OnSetParent); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Echo, OnEcho); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, OnGetStateFast); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, OnCreateTransferBuffer); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, OnRegisterTransferBuffer); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_DestroyTransferBuffer, OnDestroyTransferBuffer); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetTransferBuffer, OnGetTransferBuffer); IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateVideoDecoder, OnCreateVideoDecoder) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyVideoDecoder, OnDestroyVideoDecoder) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetSurfaceVisible, OnSetSurfaceVisible) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DiscardBackbuffer, OnDiscardBackbuffer) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_EnsureBackbuffer, OnEnsureBackbuffer) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_RetireSyncPoint, OnRetireSyncPoint) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_WaitSyncPoint, OnWaitSyncPoint) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SignalSyncPoint, OnSignalSyncPoint) IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SendClientManagedMemoryStats, OnReceivedClientManagedMemoryStats) IPC_MESSAGE_HANDLER( GpuCommandBufferMsg_SetClientHasMemoryAllocationChangedCallback, OnSetClientHasMemoryAllocationChangedCallback) IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP() ScheduleDelayedWork(kHandleMoreWorkPeriodMs); DCHECK(handled); return handled; } ",0 "ofputil_decode_tlv_table_mod(const struct ofp_header *oh, struct ofputil_tlv_table_mod *ttm) { struct ofpbuf msg = ofpbuf_const_initializer(oh, ntohs(oh->length)); ofpraw_pull_assert(&msg); struct nx_tlv_table_mod *nx_ttm = ofpbuf_pull(&msg, sizeof *nx_ttm); ttm->command = ntohs(nx_ttm->command); if (ttm->command > NXTTMC_CLEAR) { VLOG_WARN_RL(&bad_ofmsg_rl, ""tlv table mod command (%u) is out of range"", ttm->command); return OFPERR_NXTTMFC_BAD_COMMAND; } return decode_tlv_table_mappings(&msg, TUN_METADATA_NUM_OPTS, &ttm->mappings); } ",0 "void WebGLRenderingContextBase::DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, long long offset, GLsizei primcount) { if (!ValidateDrawElements(""drawElementsInstancedANGLE"", type, offset)) return; if (!bound_vertex_array_object_->IsAllEnabledAttribBufferBound()) { SynthesizeGLError(GL_INVALID_OPERATION, ""drawElementsInstancedANGLE"", ""no buffer is bound to enabled attribute""); return; } ScopedRGBEmulationColorMask emulation_color_mask(this, color_mask_, drawing_buffer_.get()); ClearIfComposited(); ContextGL()->DrawElementsInstancedANGLE( mode, count, type, reinterpret_cast(static_cast(offset)), primcount); MarkContextChanged(kCanvasChanged); } ",0 "void FormAttributeTargetObserver::idTargetChanged() { m_element->formAttributeTargetChanged(); } ",0 "static int bin_mem(RCore *r, int mode) { RList *mem = NULL; if (!r) return false; if (!IS_MODE_JSON(mode)) { if (!(IS_MODE_RAD (mode) || IS_MODE_SET (mode))) { r_cons_println (""[Memory]\n""); } } if (!(mem = r_bin_get_mem (r->bin))) { if (IS_MODE_JSON (mode)) { r_cons_print(""[]""); } return false; } if (IS_MODE_JSON (mode)) { r_cons_print (""[""); bin_mem_print (mem, 7, 0, R_CORE_BIN_JSON); r_cons_println (""]""); return true; } else if (!(IS_MODE_RAD (mode) || IS_MODE_SET (mode))) { bin_mem_print (mem, 7, 0, mode); } return true; } ",0 "Document* DocumentInit::ContextDocument() const { return context_document_; } ",0 "static int nfs4_xdr_enc_open_downgrade(struct rpc_rqst *req, __be32 *p, struct nfs_closeargs *args) { struct xdr_stream xdr; struct compound_hdr hdr = { .nops = 3, }; int status; xdr_init_encode(&xdr, &req->rq_snd_buf, p); encode_compound_hdr(&xdr, &hdr); status = encode_putfh(&xdr, args->fh); if (status) goto out; status = encode_open_downgrade(&xdr, args); if (status != 0) goto out; status = encode_getfattr(&xdr, args->bitmask); out: return status; } ",0 "GamepadBuilder::GamepadBuilder(const std::string& gamepad_id, GamepadMapping mapping, device::mojom::XRHandedness handedness) : mapping_(mapping) { DCHECK_LT(gamepad_id.size(), Gamepad::kIdLengthCap); auto mapping_str = GamepadMappingToString(mapping); DCHECK_LT(mapping_str.size(), Gamepad::kMappingLengthCap); gamepad_.connected = true; gamepad_.timestamp = base::TimeTicks::Now().since_origin().InMicroseconds(); gamepad_.hand = MojoToGamepadHandedness(handedness); CopyToUString(base::UTF8ToUTF16(gamepad_id), gamepad_.id, Gamepad::kIdLengthCap); CopyToUString(base::UTF8ToUTF16(mapping_str), gamepad_.mapping, Gamepad::kMappingLengthCap); } ",0 "void omx_vdec::fill_aspect_ratio_info( struct vdec_aspectratioinfo *aspect_ratio_info, OMX_QCOM_EXTRADATA_FRAMEINFO *frame_info) { m_extradata = frame_info; m_extradata->aspectRatio.aspectRatioX = aspect_ratio_info->par_width; m_extradata->aspectRatio.aspectRatioY = aspect_ratio_info->par_height; DEBUG_PRINT_LOW(""aspectRatioX %u aspectRatioY %u"", (unsigned int)m_extradata->aspectRatio.aspectRatioX, (unsigned int)m_extradata->aspectRatio.aspectRatioY); } ",0 "BasePage* BaseArena::findPageFromAddress(Address address) { for (BasePage* page = m_firstPage; page; page = page->next()) { if (page->contains(address)) return page; } for (BasePage* page = m_firstUnsweptPage; page; page = page->next()) { if (page->contains(address)) return page; } return nullptr; } ",0 "nfs4_callback_svc(void *vrqstp) { int err; struct svc_rqst *rqstp = vrqstp; set_freezable(); while (!kthread_should_stop()) { /* * Listen for a request on the socket */ err = svc_recv(rqstp, MAX_SCHEDULE_TIMEOUT); if (err == -EAGAIN || err == -EINTR) continue; svc_process(rqstp); } return 0; } ",1 "SendTabToSelfEntry::~SendTabToSelfEntry() {} ",0 "vmxnet3_pop_next_tx_descr(VMXNET3State *s, int qidx, struct Vmxnet3_TxDesc *txd, uint32_t *descr_idx) { Vmxnet3Ring *ring = &s->txq_descr[qidx].tx_ring; PCIDevice *d = PCI_DEVICE(s); vmxnet3_ring_read_curr_cell(d, ring, txd); if (txd->gen == vmxnet3_ring_curr_gen(ring)) { /* Only read after generation field verification */ smp_rmb(); /* Re-read to be sure we got the latest version */ vmxnet3_ring_read_curr_cell(d, ring, txd); VMXNET3_RING_DUMP(VMW_RIPRN, ""TX"", qidx, ring); *descr_idx = vmxnet3_ring_curr_cell_idx(ring); vmxnet3_inc_tx_consumption_counter(s, qidx); return true; } return false; } ",0 "static int sched_feat_set(char *cmp) { int i; int neg = 0; if (strncmp(cmp, ""NO_"", 3) == 0) { neg = 1; cmp += 3; } for (i = 0; i < __SCHED_FEAT_NR; i++) { if (strcmp(cmp, sched_feat_names[i]) == 0) { if (neg) { sysctl_sched_features &= ~(1UL << i); sched_feat_disable(i); } else { sysctl_sched_features |= (1UL << i); sched_feat_enable(i); } break; } } return i; } ",0 "static void atomic_switch_perf_msrs(struct vcpu_vmx *vmx) { int i, nr_msrs; struct perf_guest_switch_msr *msrs; msrs = perf_guest_get_msrs(&nr_msrs); if (!msrs) return; for (i = 0; i < nr_msrs; i++) if (msrs[i].host == msrs[i].guest) clear_atomic_switch_msr(vmx, msrs[i].msr); else add_atomic_switch_msr(vmx, msrs[i].msr, msrs[i].guest, msrs[i].host); } ",0 "void PrintViewManager::OnShowScriptedPrintPreview(content::RenderFrameHost* rfh, bool source_is_modifiable) { DCHECK(print_preview_rfh_); if (rfh != print_preview_rfh_) return; PrintPreviewDialogController* dialog_controller = PrintPreviewDialogController::GetInstance(); if (!dialog_controller) { PrintPreviewDone(); return; } dialog_controller->PrintPreview(web_contents()); PrintHostMsg_RequestPrintPreview_Params params; params.is_modifiable = source_is_modifiable; PrintPreviewUI::SetInitialParams( dialog_controller->GetPrintPreviewForContents(web_contents()), params); } ",1 "void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled) { m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled); if (mainFrame() && mainFrame()->settings()) mainFrame()->settings()->setTouchEventEmulationEnabled(enabled); } ",0 "int wc_ecc_sign_hash_ex(const byte* in, word32 inlen, WC_RNG* rng, ecc_key* key, mp_int *r, mp_int *s) { int err; #ifndef WOLFSSL_SP_MATH mp_int* e; #if !defined(WOLFSSL_ASYNC_CRYPT) || !defined(HAVE_CAVIUM_V) mp_int e_lcl; #endif #endif /* !WOLFSSL_SP_MATH */ DECLARE_CURVE_SPECS(1) if (in == NULL || r == NULL || s == NULL || key == NULL || rng == NULL) return ECC_BAD_ARG_E; /* is this a private key? */ if (key->type != ECC_PRIVATEKEY && key->type != ECC_PRIVATEKEY_ONLY) { return ECC_BAD_ARG_E; } /* is the IDX valid ? */ if (wc_ecc_is_valid_idx(key->idx) != 1) { return ECC_BAD_ARG_E; } #ifdef WOLFSSL_SP_MATH if (key->idx != ECC_CUSTOM_IDX && ecc_sets[key->idx].id == ECC_SECP256R1) return sp_ecc_sign_256(in, inlen, rng, &key->k, r, s, key->heap); else return WC_KEY_SIZE_E; #else #ifdef WOLFSSL_HAVE_SP_ECC #if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ECC) && \ defined(WOLFSSL_ASYNC_CRYPT_TEST) if (key->asyncDev.marker != WOLFSSL_ASYNC_MARKER_ECC) #endif { #ifndef WOLFSSL_SP_NO_256 if (key->idx != ECC_CUSTOM_IDX && ecc_sets[key->idx].id == ECC_SECP256R1) return sp_ecc_sign_256(in, inlen, rng, &key->k, r, s, key->heap); #endif } #endif /* WOLFSSL_HAVE_SP_ECC */ #if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ECC) && \ defined(WOLFSSL_ASYNC_CRYPT_TEST) if (key->asyncDev.marker == WOLFSSL_ASYNC_MARKER_ECC) { if (wc_AsyncTestInit(&key->asyncDev, ASYNC_TEST_ECC_SIGN)) { WC_ASYNC_TEST* testDev = &key->asyncDev.test; testDev->eccSign.in = in; testDev->eccSign.inSz = inlen; testDev->eccSign.rng = rng; testDev->eccSign.key = key; testDev->eccSign.r = r; testDev->eccSign.s = s; return WC_PENDING_E; } } #endif #if defined(WOLFSSL_ASYNC_CRYPT) && defined(HAVE_CAVIUM_V) err = wc_ecc_alloc_mpint(key, &key->e); if (err != 0) return err; e = key->e; #else e = &e_lcl; #endif /* get the hash and load it as a bignum into 'e' */ /* init the bignums */ if ((err = mp_init(e)) != MP_OKAY) { return err; } /* load curve info */ err = wc_ecc_curve_load(key->dp, &curve, ECC_CURVE_FIELD_ORDER); /* load digest into e */ if (err == MP_OKAY) { /* we may need to truncate if hash is longer than key size */ word32 orderBits = mp_count_bits(curve->order); /* truncate down to byte size, may be all that's needed */ if ((WOLFSSL_BIT_SIZE * inlen) > orderBits) inlen = (orderBits + WOLFSSL_BIT_SIZE - 1) / WOLFSSL_BIT_SIZE; err = mp_read_unsigned_bin(e, (byte*)in, inlen); /* may still need bit truncation too */ if (err == MP_OKAY && (WOLFSSL_BIT_SIZE * inlen) > orderBits) mp_rshb(e, WOLFSSL_BIT_SIZE - (orderBits & 0x7)); } /* make up a key and export the public copy */ if (err == MP_OKAY) { int loop_check = 0; ecc_key pubkey; #if defined(WOLFSSL_ASYNC_CRYPT) && defined(WC_ASYNC_ENABLE_ECC) if (key->asyncDev.marker == WOLFSSL_ASYNC_MARKER_ECC) { #if defined(HAVE_CAVIUM_V) || defined(HAVE_INTEL_QA) #ifdef HAVE_CAVIUM_V if (NitroxEccIsCurveSupported(key)) #endif { word32 keySz = key->dp->size; mp_int* k; #ifdef HAVE_CAVIUM_V err = wc_ecc_alloc_mpint(key, &key->signK); if (err != 0) return err; k = key->signK; #else mp_int k_lcl; k = &k_lcl; #endif err = mp_init(k); /* make sure r and s are allocated */ #ifdef HAVE_CAVIUM_V /* Nitrox V needs single buffer for R and S */ if (err == MP_OKAY) err = wc_bigint_alloc(&key->r->raw, NitroxEccGetSize(key)*2); /* Nitrox V only needs Prime and Order */ if (err == MP_OKAY) err = wc_ecc_curve_load(key->dp, &curve, (ECC_CURVE_FIELD_PRIME | ECC_CURVE_FIELD_ORDER)); #else if (err == MP_OKAY) err = wc_bigint_alloc(&key->r->raw, key->dp->size); if (err == MP_OKAY) err = wc_ecc_curve_load(key->dp, &curve, ECC_CURVE_FIELD_ALL); #endif if (err == MP_OKAY) err = wc_bigint_alloc(&key->s->raw, key->dp->size); /* load e and k */ if (err == MP_OKAY) err = wc_mp_to_bigint_sz(e, &e->raw, keySz); if (err == MP_OKAY) err = wc_mp_to_bigint_sz(&key->k, &key->k.raw, keySz); if (err == MP_OKAY) err = wc_ecc_gen_k(rng, key->dp->size, k, curve->order); if (err == MP_OKAY) err = wc_mp_to_bigint_sz(k, &k->raw, keySz); #ifdef HAVE_CAVIUM_V if (err == MP_OKAY) err = NitroxEcdsaSign(key, &e->raw, &key->k.raw, &k->raw, &r->raw, &s->raw, &curve->prime->raw, &curve->order->raw); #else if (err == MP_OKAY) err = IntelQaEcdsaSign(&key->asyncDev, &e->raw, &key->k.raw, &k->raw, &r->raw, &s->raw, &curve->Af->raw, &curve->Bf->raw, &curve->prime->raw, &curve->order->raw, &curve->Gx->raw, &curve->Gy->raw); #endif #ifndef HAVE_CAVIUM_V mp_clear(e); mp_clear(k); #endif wc_ecc_curve_free(curve); return err; } #endif /* HAVE_CAVIUM_V || HAVE_INTEL_QA */ } #endif /* WOLFSSL_ASYNC_CRYPT */ /* don't use async for key, since we don't support async return here */ if ((err = wc_ecc_init_ex(&pubkey, key->heap, INVALID_DEVID)) == MP_OKAY) { #ifdef WOLFSSL_CUSTOM_CURVES /* if custom curve, apply params to pubkey */ if (key->idx == ECC_CUSTOM_IDX) { err = wc_ecc_set_custom_curve(&pubkey, key->dp); } #endif for (; err == MP_OKAY;) { if (++loop_check > 64) { err = RNG_FAILURE_E; break; } err = wc_ecc_make_key_ex(rng, key->dp->size, &pubkey, key->dp->id); if (err != MP_OKAY) break; /* find r = x1 mod n */ err = mp_mod(pubkey.pubkey.x, curve->order, r); if (err != MP_OKAY) break; if (mp_iszero(r) == MP_YES) { #ifndef ALT_ECC_SIZE mp_clear(pubkey.pubkey.x); mp_clear(pubkey.pubkey.y); mp_clear(pubkey.pubkey.z); #endif mp_forcezero(&pubkey.k); } else { /* find s = (e + xr)/k */ err = mp_invmod(&pubkey.k, curve->order, &pubkey.k); if (err != MP_OKAY) break; /* s = xr */ err = mp_mulmod(&key->k, r, curve->order, s); if (err != MP_OKAY) break; /* s = e + xr */ err = mp_add(e, s, s); if (err != MP_OKAY) break; /* s = e + xr */ err = mp_mod(s, curve->order, s); if (err != MP_OKAY) break; /* s = (e + xr)/k */ err = mp_mulmod(s, &pubkey.k, curve->order, s); if (mp_iszero(s) == MP_NO) break; } } wc_ecc_free(&pubkey); } } mp_clear(e); wc_ecc_curve_free(curve); #endif /* WOLFSSL_SP_MATH */ return err; } ",1 "static void setFunctionBreakpoint(ConsoleHelper& helper, v8::Local function, V8DebuggerAgentImpl::BreakpointSource source, const String16& condition, bool enable) { V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent(); if (!debuggerAgent) return; String16 scriptId = String16::fromInteger(function->ScriptId()); int lineNumber = function->GetScriptLineNumber(); int columnNumber = function->GetScriptColumnNumber(); if (lineNumber == v8::Function::kLineOffsetNotFound || columnNumber == v8::Function::kLineOffsetNotFound) return; if (enable) debuggerAgent->setBreakpointAt(scriptId, lineNumber, columnNumber, source, condition); else debuggerAgent->removeBreakpointAt(scriptId, lineNumber, columnNumber, source); } ",0 "static void bat_socket_add_packet(struct socket_client *socket_client, struct icmp_packet_rr *icmp_packet, size_t icmp_len) { struct socket_packet *socket_packet; socket_packet = kmalloc(sizeof(*socket_packet), GFP_ATOMIC); if (!socket_packet) return; INIT_LIST_HEAD(&socket_packet->list); memcpy(&socket_packet->icmp_packet, icmp_packet, icmp_len); socket_packet->icmp_len = icmp_len; spin_lock_bh(&socket_client->lock); /* while waiting for the lock the socket_client could have been * deleted */ if (!socket_client_hash[icmp_packet->uid]) { spin_unlock_bh(&socket_client->lock); kfree(socket_packet); return; } list_add_tail(&socket_packet->list, &socket_client->queue_list); socket_client->queue_len++; if (socket_client->queue_len > 100) { socket_packet = list_first_entry(&socket_client->queue_list, struct socket_packet, list); list_del(&socket_packet->list); kfree(socket_packet); socket_client->queue_len--; } spin_unlock_bh(&socket_client->lock); wake_up(&socket_client->queue_wait); } ",0 "void RenderFrameImpl::OnSelectAll() { AutoResetMember handling_select_range( this, &RenderFrameImpl::handling_select_range_, true); frame_->ExecuteCommand(WebString::FromUTF8(""SelectAll"")); } ",0 "void WebProcessProxy::shouldTerminate(bool& shouldTerminate) { if (!m_pageMap.isEmpty() || (m_downloadProxyMap && !m_downloadProxyMap->isEmpty()) || !m_context->shouldTerminate(this)) { shouldTerminate = false; return; } shouldTerminate = true; disconnect(); } ",0 "static void aes_decrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm)); if (!irq_fpu_usable()) crypto_aes_decrypt_x86(ctx, dst, src); else { kernel_fpu_begin(); aesni_dec(ctx, dst, src); kernel_fpu_end(); } } ",0 "static int flakey_iterate_devices(struct dm_target *ti, iterate_devices_callout_fn fn, void *data) { struct flakey_c *fc = ti->private; return fn(ti, fc->dev, fc->start, ti->len, data); } ",0 "void GLES2DecoderImpl::DoDidUseTexImageIfNeeded( Texture* texture, GLenum textarget) { if (texture && !texture->IsAttachedToFramebuffer()) { gfx::GLImage* image = texture->GetLevelImage(textarget, 0); if (image) { ScopedGLErrorSuppressor suppressor( ""GLES2DecoderImpl::DoDidUseTexImageIfNeeded"", GetErrorState()); glBindTexture(textarget, texture->service_id()); image->DidUseTexImage(); RestoreCurrentTextureBindings(&state_, textarget); } } } ",0 "void ParamTraits::Write(Message* m, const gfx::Size& p) { m->WriteInt(p.width()); m->WriteInt(p.height()); } ",0 "pipe_write(struct kiocb *iocb, const struct iovec *_iov, unsigned long nr_segs, loff_t ppos) { struct file *filp = iocb->ki_filp; struct pipe_inode_info *pipe = filp->private_data; ssize_t ret; int do_wakeup; struct iovec *iov = (struct iovec *)_iov; size_t total_len; ssize_t chars; total_len = iov_length(iov, nr_segs); /* Null write succeeds. */ if (unlikely(total_len == 0)) return 0; do_wakeup = 0; ret = 0; __pipe_lock(pipe); if (!pipe->readers) { send_sig(SIGPIPE, current, 0); ret = -EPIPE; goto out; } /* We try to merge small writes */ chars = total_len & (PAGE_SIZE-1); /* size of the last buffer */ if (pipe->nrbufs && chars != 0) { int lastbuf = (pipe->curbuf + pipe->nrbufs - 1) & (pipe->buffers - 1); struct pipe_buffer *buf = pipe->bufs + lastbuf; const struct pipe_buf_operations *ops = buf->ops; int offset = buf->offset + buf->len; if (ops->can_merge && offset + chars <= PAGE_SIZE) { int error, atomic = 1; void *addr; error = ops->confirm(pipe, buf); if (error) goto out; iov_fault_in_pages_read(iov, chars); redo1: if (atomic) addr = kmap_atomic(buf->page); else addr = kmap(buf->page); error = pipe_iov_copy_from_user(offset + addr, iov, chars, atomic); if (atomic) kunmap_atomic(addr); else kunmap(buf->page); ret = error; do_wakeup = 1; if (error) { if (atomic) { atomic = 0; goto redo1; } goto out; } buf->len += chars; total_len -= chars; ret = chars; if (!total_len) goto out; } } for (;;) { int bufs; if (!pipe->readers) { send_sig(SIGPIPE, current, 0); if (!ret) ret = -EPIPE; break; } bufs = pipe->nrbufs; if (bufs < pipe->buffers) { int newbuf = (pipe->curbuf + bufs) & (pipe->buffers-1); struct pipe_buffer *buf = pipe->bufs + newbuf; struct page *page = pipe->tmp_page; char *src; int error, atomic = 1; if (!page) { page = alloc_page(GFP_HIGHUSER); if (unlikely(!page)) { ret = ret ? : -ENOMEM; break; } pipe->tmp_page = page; } /* Always wake up, even if the copy fails. Otherwise * we lock up (O_NONBLOCK-)readers that sleep due to * syscall merging. * FIXME! Is this really true? */ do_wakeup = 1; chars = PAGE_SIZE; if (chars > total_len) chars = total_len; iov_fault_in_pages_read(iov, chars); redo2: if (atomic) src = kmap_atomic(page); else src = kmap(page); error = pipe_iov_copy_from_user(src, iov, chars, atomic); if (atomic) kunmap_atomic(src); else kunmap(page); if (unlikely(error)) { if (atomic) { atomic = 0; goto redo2; } if (!ret) ret = error; break; } ret += chars; /* Insert it into the buffer array */ buf->page = page; buf->ops = &anon_pipe_buf_ops; buf->offset = 0; buf->len = chars; buf->flags = 0; if (is_packetized(filp)) { buf->ops = &packet_pipe_buf_ops; buf->flags = PIPE_BUF_FLAG_PACKET; } pipe->nrbufs = ++bufs; pipe->tmp_page = NULL; total_len -= chars; if (!total_len) break; } if (bufs < pipe->buffers) continue; if (filp->f_flags & O_NONBLOCK) { if (!ret) ret = -EAGAIN; break; } if (signal_pending(current)) { if (!ret) ret = -ERESTARTSYS; break; } if (do_wakeup) { wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); do_wakeup = 0; } pipe->waiting_writers++; pipe_wait(pipe); pipe->waiting_writers--; } out: __pipe_unlock(pipe); if (do_wakeup) { wake_up_interruptible_sync_poll(&pipe->wait, POLLIN | POLLRDNORM); kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN); } if (ret > 0 && sb_start_write_trylock(file_inode(filp)->i_sb)) { int err = file_update_time(filp); if (err) ret = err; sb_end_write(file_inode(filp)->i_sb); } return ret; } ",0 "static void __lockfunc tty_ldisc_unlock_pair(struct tty_struct *tty, struct tty_struct *tty2) { __tty_ldisc_unlock(tty); if (tty2) __tty_ldisc_unlock(tty2); } ",0 "PassRefPtr HTMLFormElement::create(Document& document) { UseCounter::count(&document, UseCounter::FormElement); return adoptRef(new HTMLFormElement(formTag, document)); } ",0 "js_Regexp *js_toregexp(js_State *J, int idx) { js_Value *v = stackidx(J, idx); if (v->type == JS_TOBJECT && v->u.object->type == JS_CREGEXP) return &v->u.object->u.r; js_typeerror(J, ""not a regexp""); } ",0 "void TextureManager::SetLevelInfo( TextureManager::TextureInfo* info, GLenum target, GLint level, GLenum internal_format, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, bool cleared) { DCHECK(info); if (!info->CanRender(feature_info_)) { DCHECK_NE(0, num_unrenderable_textures_); --num_unrenderable_textures_; } if (!info->SafeToRenderFrom()) { DCHECK_NE(0, num_unsafe_textures_); --num_unsafe_textures_; } num_uncleared_mips_ -= info->num_uncleared_mips(); DCHECK_GE(num_uncleared_mips_, 0); mem_represented_ -= info->estimated_size(); info->SetLevelInfo( feature_info_, target, level, internal_format, width, height, depth, border, format, type, cleared); mem_represented_ += info->estimated_size(); UpdateMemRepresented(); num_uncleared_mips_ += info->num_uncleared_mips(); if (!info->CanRender(feature_info_)) { ++num_unrenderable_textures_; } if (!info->SafeToRenderFrom()) { ++num_unsafe_textures_; } } ",0 "MagickExport NexusInfo **AcquirePixelCacheNexus(const size_t number_threads) { NexusInfo **magick_restrict nexus_info; register ssize_t i; nexus_info=(NexusInfo **) MagickAssumeAligned(AcquireAlignedMemory( number_threads,sizeof(*nexus_info))); if (nexus_info == (NexusInfo **) NULL) ThrowFatalException(ResourceLimitFatalError,""MemoryAllocationFailed""); nexus_info[0]=(NexusInfo *) AcquireQuantumMemory(number_threads, sizeof(**nexus_info)); if (nexus_info[0] == (NexusInfo *) NULL) ThrowFatalException(ResourceLimitFatalError,""MemoryAllocationFailed""); (void) ResetMagickMemory(nexus_info[0],0,number_threads*sizeof(**nexus_info)); for (i=0; i < (ssize_t) number_threads; i++) { nexus_info[i]=(&nexus_info[0][i]); nexus_info[i]->signature=MagickSignature; } return(nexus_info); } ",0 "static void nfs_set_open_stateid_locked(struct nfs4_state *state, nfs4_stateid *stateid, fmode_t fmode) { switch (fmode) { case FMODE_READ: set_bit(NFS_O_RDONLY_STATE, &state->flags); break; case FMODE_WRITE: set_bit(NFS_O_WRONLY_STATE, &state->flags); break; case FMODE_READ|FMODE_WRITE: set_bit(NFS_O_RDWR_STATE, &state->flags); } if (!nfs_need_update_open_stateid(state, stateid)) return; if (test_bit(NFS_DELEGATED_STATE, &state->flags) == 0) nfs4_stateid_copy(&state->stateid, stateid); nfs4_stateid_copy(&state->open_stateid, stateid); } ",0 "void StartupBrowserCreator::RegisterLocalStatePrefs( PrefRegistrySimple* registry) { #if !defined(OS_CHROMEOS) registry->RegisterBooleanPref(prefs::kPromotionalTabsEnabled, true); registry->RegisterBooleanPref(prefs::kCommandLineFlagSecurityWarningsEnabled, true); #endif registry->RegisterBooleanPref(prefs::kSuppressUnsupportedOSWarning, false); registry->RegisterBooleanPref(prefs::kWasRestarted, false); } ",0 "static void ffs_func_unbind(struct usb_configuration *c, struct usb_function *f) { struct ffs_function *func = ffs_func_from_usb(f); struct ffs_data *ffs = func->ffs; struct f_fs_opts *opts = container_of(f->fi, struct f_fs_opts, func_inst); struct ffs_ep *ep = func->eps; unsigned count = ffs->eps_count; unsigned long flags; ENTER(); if (ffs->func == func) { ffs_func_eps_disable(func); ffs->func = NULL; } if (!--opts->refcnt) functionfs_unbind(ffs); /* cleanup after autoconfig */ spin_lock_irqsave(&func->ffs->eps_lock, flags); do { if (ep->ep && ep->req) usb_ep_free_request(ep->ep, ep->req); ep->req = NULL; ++ep; } while (--count); spin_unlock_irqrestore(&func->ffs->eps_lock, flags); kfree(func->eps); func->eps = NULL; /* * eps, descriptors and interfaces_nums are allocated in the * same chunk so only one free is required. */ func->function.fs_descriptors = NULL; func->function.hs_descriptors = NULL; func->function.ss_descriptors = NULL; func->interfaces_nums = NULL; ffs_event_add(ffs, FUNCTIONFS_UNBIND); } ",0 "int sc_file_set_prop_attr(sc_file_t *file, const u8 *prop_attr, size_t prop_attr_len) { u8 *tmp; if (!sc_file_valid(file)) { return SC_ERROR_INVALID_ARGUMENTS; } if (prop_attr == NULL) { if (file->prop_attr != NULL) free(file->prop_attr); file->prop_attr = NULL; file->prop_attr_len = 0; return SC_SUCCESS; } tmp = (u8 *) realloc(file->prop_attr, prop_attr_len); if (!tmp) { if (file->prop_attr) free(file->prop_attr); file->prop_attr = NULL; file->prop_attr_len = 0; return SC_ERROR_OUT_OF_MEMORY; } file->prop_attr = tmp; memcpy(file->prop_attr, prop_attr, prop_attr_len); file->prop_attr_len = prop_attr_len; return SC_SUCCESS; } ",0 " struct request *blk_mq_tag_to_rq(struct blk_mq_tags *tags, unsigned int tag) { struct request *rq = tags->rqs[tag]; /* mq_ctx of flush rq is always cloned from the corresponding req */ struct blk_flush_queue *fq = blk_get_flush_queue(rq->q, rq->mq_ctx); if (!is_flush_request(rq, fq, tag)) return rq; return fq->flush_rq; } ",1 " ContentEncoding::ContentCompression::ContentCompression() : algo(0), settings(NULL), settings_len(0) { } ",1 "static int opfdivr(RAsm *a, ut8 *data, const Opcode *op) { int l = 0; switch (op->operands_count) { case 1: if ( op->operands[0].type & OT_MEMORY ) { if ( op->operands[0].type & OT_DWORD ) { data[l++] = 0xd8; data[l++] = 0x38 | op->operands[0].regs[0]; } else if ( op->operands[0].type & OT_QWORD ) { data[l++] = 0xdc; data[l++] = 0x38 | op->operands[0].regs[0]; } else { return -1; } } else { return -1; } break; case 2: if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[0].reg == 0 && op->operands[1].type & OT_FPUREG & ~OT_REGALL ) { data[l++] = 0xd8; data[l++] = 0xf8 | op->operands[1].reg; } else if ( op->operands[0].type & OT_FPUREG & ~OT_REGALL && op->operands[1].type & OT_FPUREG & ~OT_REGALL && op->operands[1].reg == 0 ) { data[l++] = 0xdc; data[l++] = 0xf0 | op->operands[0].reg; } else { return -1; } break; default: return -1; } return l; } ",0 "bool btif_get_device_type(const BD_ADDR bd_addr, int *p_device_type) { if (p_device_type == NULL) return FALSE; bt_bdaddr_t bda; bdcpy(bda.address, bd_addr); bdstr_t bd_addr_str; bdaddr_to_string(&bda, bd_addr_str, sizeof(bd_addr_str)); if (!btif_config_get_int(bd_addr_str, ""DevType"", p_device_type)) return FALSE; LOG_DEBUG(LOG_TAG, ""%s: Device [%s] type %d"", __FUNCTION__, bd_addr_str, *p_device_type); return TRUE; } ",0 "void __key_link(struct key *key, struct assoc_array_edit **_edit) { __key_get(key); assoc_array_insert_set_object(*_edit, keyring_key_to_ptr(key)); assoc_array_apply_edit(*_edit); *_edit = NULL; } ",0 "error::Error GLES2DecoderImpl::HandleGetInternalformativ( uint32_t immediate_data_size, const volatile void* cmd_data) { if (!feature_info_->IsWebGL2OrES3Context()) return error::kUnknownCommand; const volatile gles2::cmds::GetInternalformativ& c = *static_cast(cmd_data); GLenum target = static_cast(c.target); GLenum format = static_cast(c.format); GLenum pname = static_cast(c.pname); if (!validators_->render_buffer_target.IsValid(target)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(""glGetInternalformativ"", target, ""target""); return error::kNoError; } if (!validators_->render_buffer_format.IsValid(format)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(""glGetInternalformativ"", format, ""internalformat""); return error::kNoError; } if (!validators_->internal_format_parameter.IsValid(pname)) { LOCAL_SET_GL_ERROR_INVALID_ENUM(""glGetInternalformativ"", pname, ""pname""); return error::kNoError; } typedef cmds::GetInternalformativ::Result Result; GLsizei num_values = 0; std::vector samples; if (gl_version_info().IsLowerThanGL(4, 2)) { if (!GLES2Util::IsIntegerFormat(format)) { GLint max_samples = renderbuffer_manager()->max_samples(); while (max_samples > 0) { samples.push_back(max_samples); --max_samples; } } switch (pname) { case GL_NUM_SAMPLE_COUNTS: num_values = 1; break; case GL_SAMPLES: num_values = static_cast(samples.size()); break; default: NOTREACHED(); break; } } else { switch (pname) { case GL_NUM_SAMPLE_COUNTS: num_values = 1; break; case GL_SAMPLES: { GLint value = 0; api()->glGetInternalformativFn(target, format, GL_NUM_SAMPLE_COUNTS, 1, &value); num_values = static_cast(value); } break; default: NOTREACHED(); break; } } Result* result = GetSharedMemoryAs( c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); GLint* params = result ? result->GetData() : nullptr; if (params == nullptr) { return error::kOutOfBounds; } if (result->size != 0) { return error::kInvalidArguments; } if (gl_version_info().IsLowerThanGL(4, 2)) { switch (pname) { case GL_NUM_SAMPLE_COUNTS: params[0] = static_cast(samples.size()); break; case GL_SAMPLES: for (size_t ii = 0; ii < samples.size(); ++ii) { params[ii] = samples[ii]; } break; default: NOTREACHED(); break; } } else { api()->glGetInternalformativFn(target, format, pname, num_values, params); } result->SetNumResults(num_values); return error::kNoError; } ",0 "pdf_close_processor(fz_context *ctx, pdf_processor *proc) { if (proc && proc->close_processor) { proc->close_processor(ctx, proc); proc->close_processor = NULL; } } ",0 "void PasswordAutofillAgent::OnDynamicFormsSeen() { SendPasswordForms(false /* only_visible */); } ",0 "int av_get_audio_frame_duration(AVCodecContext *avctx, int frame_bytes) { return get_audio_frame_duration(avctx->codec_id, avctx->sample_rate, avctx->channels, avctx->block_align, avctx->codec_tag, avctx->bits_per_coded_sample, avctx->bit_rate, avctx->extradata, avctx->frame_size, frame_bytes); } ",0 "String Document::nodeName() const { return ""#document""; } ",0 "error::Error GLES2DecoderImpl::HandleGetTransformFeedbackVarying( uint32 immediate_data_size, const void* cmd_data) { if (!unsafe_es3_apis_enabled()) return error::kUnknownCommand; const gles2::cmds::GetTransformFeedbackVarying& c = *static_cast(cmd_data); GLuint program_id = c.program; GLuint index = c.index; uint32 name_bucket_id = c.name_bucket_id; typedef cmds::GetTransformFeedbackVarying::Result Result; Result* result = GetSharedMemoryAs( c.result_shm_id, c.result_shm_offset, sizeof(*result)); if (!result) { return error::kOutOfBounds; } if (result->success != 0) { return error::kInvalidArguments; } Program* program = GetProgramInfoNotShader( program_id, ""glGetTransformFeedbackVarying""); if (!program) { return error::kNoError; } GLuint service_id = program->service_id(); GLint link_status = GL_FALSE; glGetProgramiv(service_id, GL_LINK_STATUS, &link_status); if (link_status != GL_TRUE) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glGetTransformFeedbackVarying"", ""program not linked""); return error::kNoError; } GLint max_length = 0; glGetProgramiv( service_id, GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH, &max_length); max_length = std::max(1, max_length); std::vector buffer(max_length); GLsizei length = 0; GLsizei size = 0; GLenum type = 0; LOCAL_COPY_REAL_GL_ERRORS_TO_WRAPPER(""GetTransformFeedbackVarying""); glGetTransformFeedbackVarying( service_id, index, max_length, &length, &size, &type, &buffer[0]); GLenum error = glGetError(); if (error != GL_NO_ERROR) { LOCAL_SET_GL_ERROR(error, ""glGetTransformFeedbackVarying"", """"); return error::kNoError; } result->success = 1; // true. result->size = static_cast(size); result->type = static_cast(type); Bucket* bucket = CreateBucket(name_bucket_id); DCHECK(length >= 0 && length < max_length); buffer[length] = '\0'; // Just to be safe. bucket->SetFromString(&buffer[0]); return error::kNoError; } ",0 "PrintPreviewHandler::~PrintPreviewHandler() { if (select_file_dialog_.get()) select_file_dialog_->ListenerDestroyed(); } ",0 " TestNetworkErrorLoggingService* network_error_logging_service() const { return test_network_error_logging_service_; } ",0 "void avrc_send_next_vendor_cmd(uint8_t handle) { BT_HDR* p_next_cmd; uint8_t next_label; while ((p_next_cmd = (BT_HDR*)fixed_queue_try_dequeue( avrc_cb.ccb_int[handle].cmd_q)) != NULL) { p_next_cmd->event &= 0xFF; /* opcode */ next_label = (p_next_cmd->layer_specific) >> 8; /* extract label */ p_next_cmd->layer_specific &= 0xFF; /* AVCT_DATA_CTRL or AVCT_DATA_BROWSE */ AVRC_TRACE_DEBUG( ""AVRC: Dequeuing command 0x%08x (handle=0x%02x, label=0x%02x)"", p_next_cmd, handle, next_label); /* Send the message */ if ((AVCT_MsgReq(handle, next_label, AVCT_CMD, p_next_cmd)) == AVCT_SUCCESS) { /* Start command timer to wait for response */ avrc_start_cmd_timer(handle, next_label, AVRC_MSG_MASK_IS_VENDOR_CMD); return; } } if (p_next_cmd == NULL) { /* cmd queue empty */ avrc_cb.ccb_int[handle].flags &= ~AVRC_CB_FLAGS_RSP_PENDING; } } ",0 "static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *cb) { int wp_idx = 0; int if_idx = 0; int wp_start = cb->args[0]; int if_start = cb->args[1]; struct cfg80211_registered_device *rdev; struct wireless_dev *wdev; mutex_lock(&cfg80211_mutex); list_for_each_entry(rdev, &cfg80211_rdev_list, list) { if (!net_eq(wiphy_net(&rdev->wiphy), sock_net(skb->sk))) continue; if (wp_idx < wp_start) { wp_idx++; continue; } if_idx = 0; mutex_lock(&rdev->devlist_mtx); list_for_each_entry(wdev, &rdev->netdev_list, list) { if (if_idx < if_start) { if_idx++; continue; } if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).pid, cb->nlh->nlmsg_seq, NLM_F_MULTI, rdev, wdev->netdev) < 0) { mutex_unlock(&rdev->devlist_mtx); goto out; } if_idx++; } mutex_unlock(&rdev->devlist_mtx); wp_idx++; } out: mutex_unlock(&cfg80211_mutex); cb->args[0] = wp_idx; cb->args[1] = if_idx; return skb->len; } ",0 "void PaintController::EndSubsequence(const DisplayItemClient& client, size_t start) { size_t end = new_display_item_list_.size(); if (RuntimeEnabledFeatures::PaintUnderInvalidationCheckingEnabled() && IsCheckingUnderInvalidation()) { SubsequenceMarkers* markers = GetSubsequenceMarkers(client); if (!markers && start != end) { ShowSequenceUnderInvalidationError( ""under-invalidation : unexpected subsequence"", client, start, end); CHECK(false); } if (markers && markers->end - markers->start != end - start) { ShowSequenceUnderInvalidationError( ""under-invalidation: new subsequence wrong length"", client, start, end); CHECK(false); } } if (start == end) { return; } new_paint_chunks_.ForceNewChunk(); DCHECK(!new_cached_subsequences_.Contains(&client)) << ""Multiple subsequences for client: "" << client.DebugName(); new_cached_subsequences_.insert(&client, SubsequenceMarkers(start, end)); last_cached_subsequence_end_ = end; } ",0 "bool SessionService::CreateTabsAndWindows( const std::vector& data, std::map* tabs, std::map* windows) { for (std::vector::const_iterator i = data.begin(); i != data.end(); ++i) { const SessionCommand::id_type kCommandSetWindowBounds2 = 10; const SessionCommand* command = *i; switch (command->id()) { case kCommandSetTabWindow: { SessionID::id_type payload[2]; if (!command->GetPayload(payload, sizeof(payload))) return true; GetTab(payload[1], tabs)->window_id.set_id(payload[0]); break; } case kCommandSetWindowBounds2: { WindowBoundsPayload2 payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; GetWindow(payload.window_id, windows)->bounds.SetRect(payload.x, payload.y, payload.w, payload.h); GetWindow(payload.window_id, windows)->show_state = payload.is_maximized ? ui::SHOW_STATE_MAXIMIZED : ui::SHOW_STATE_NORMAL; break; } case kCommandSetWindowBounds3: { WindowBoundsPayload3 payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; GetWindow(payload.window_id, windows)->bounds.SetRect(payload.x, payload.y, payload.w, payload.h); ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; if (payload.show_state > ui::SHOW_STATE_DEFAULT && payload.show_state < ui::SHOW_STATE_END && payload.show_state != ui::SHOW_STATE_INACTIVE) { show_state = static_cast(payload.show_state); } else { NOTREACHED(); } GetWindow(payload.window_id, windows)->show_state = show_state; break; } case kCommandSetTabIndexInWindow: { TabIndexInWindowPayload payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; GetTab(payload.id, tabs)->tab_visual_index = payload.index; break; } case kCommandTabClosed: case kCommandWindowClosed: { ClosedPayload payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; if (command->id() == kCommandTabClosed) { delete GetTab(payload.id, tabs); tabs->erase(payload.id); } else { delete GetWindow(payload.id, windows); windows->erase(payload.id); } break; } case kCommandTabNavigationPathPrunedFromBack: { TabNavigationPathPrunedFromBackPayload payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; SessionTab* tab = GetTab(payload.id, tabs); tab->navigations.erase( FindClosestNavigationWithIndex(&(tab->navigations), payload.index), tab->navigations.end()); break; } case kCommandTabNavigationPathPrunedFromFront: { TabNavigationPathPrunedFromFrontPayload payload; if (!command->GetPayload(&payload, sizeof(payload)) || payload.index <= 0) { return true; } SessionTab* tab = GetTab(payload.id, tabs); tab->current_navigation_index = std::max(-1, tab->current_navigation_index - payload.index); for (std::vector::iterator i = tab->navigations.begin(); i != tab->navigations.end();) { i->set_index(i->index() - payload.index); if (i->index() < 0) i = tab->navigations.erase(i); else ++i; } break; } case kCommandUpdateTabNavigation: { TabNavigation navigation; SessionID::id_type tab_id; if (!RestoreUpdateTabNavigationCommand(*command, &navigation, &tab_id)) return true; SessionTab* tab = GetTab(tab_id, tabs); std::vector::iterator i = FindClosestNavigationWithIndex(&(tab->navigations), navigation.index()); if (i != tab->navigations.end() && i->index() == navigation.index()) *i = navigation; else tab->navigations.insert(i, navigation); break; } case kCommandSetSelectedNavigationIndex: { SelectedNavigationIndexPayload payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; GetTab(payload.id, tabs)->current_navigation_index = payload.index; break; } case kCommandSetSelectedTabInIndex: { SelectedTabInIndexPayload payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; GetWindow(payload.id, windows)->selected_tab_index = payload.index; break; } case kCommandSetWindowType: { WindowTypePayload payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; GetWindow(payload.id, windows)->is_constrained = false; GetWindow(payload.id, windows)->type = BrowserTypeForWindowType( static_cast(payload.index)); break; } case kCommandSetPinnedState: { PinnedStatePayload payload; if (!command->GetPayload(&payload, sizeof(payload))) return true; GetTab(payload.tab_id, tabs)->pinned = payload.pinned_state; break; } case kCommandSetExtensionAppID: { SessionID::id_type tab_id; std::string extension_app_id; if (!RestoreSetTabExtensionAppIDCommand( *command, &tab_id, &extension_app_id)) { return true; } GetTab(tab_id, tabs)->extension_app_id.swap(extension_app_id); break; } default: return true; } } return true; } ",1 "void TabSpecificContentSettings::AppCacheAccessed(const GURL& manifest_url, bool blocked_by_policy) { if (blocked_by_policy) { blocked_local_shared_objects_.appcaches()->AddAppCache(manifest_url); OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, std::string()); } else { allowed_local_shared_objects_.appcaches()->AddAppCache(manifest_url); OnContentAccessed(CONTENT_SETTINGS_TYPE_COOKIES); } } ",0 "fcmp_gt(struct sh_fpu_soft_struct *fregs, struct pt_regs *regs, int m, int n) { if (CMP(CMP) > 0) regs->sr |= 1; else regs->sr &= ~1; return 0; } ",0 "virDomainSaveImageDefineXML(virConnectPtr conn, const char *file, const char *dxml, unsigned int flags) { VIR_DEBUG(""conn=%p, file=%s, dxml=%s, flags=%x"", conn, NULLSTR(file), NULLSTR(dxml), flags); virResetLastError(); virCheckConnectReturn(conn, -1); virCheckReadOnlyGoto(conn->flags, error); virCheckNonNullArgGoto(file, error); virCheckNonNullArgGoto(dxml, error); VIR_EXCLUSIVE_FLAGS_GOTO(VIR_DOMAIN_SAVE_RUNNING, VIR_DOMAIN_SAVE_PAUSED, error); if (conn->driver->domainSaveImageDefineXML) { int ret; char *absolute_file; /* We must absolutize the file path as the read is done out of process */ if (virFileAbsPath(file, &absolute_file) < 0) { virReportError(VIR_ERR_INTERNAL_ERROR, ""%s"", _(""could not build absolute input file path"")); goto error; } ret = conn->driver->domainSaveImageDefineXML(conn, absolute_file, dxml, flags); VIR_FREE(absolute_file); if (ret < 0) goto error; return ret; } virReportUnsupportedError(); error: virDispatchError(conn); return -1; } ",0 "void unregister_key_type(struct key_type *ktype) { down_write(&key_types_sem); list_del_init(&ktype->link); downgrade_write(&key_types_sem); key_gc_keytype(ktype); pr_notice(""Key type %s unregistered\n"", ktype->name); up_read(&key_types_sem); } ",0 "static int mxf_edit_unit_absolute_offset(MXFContext *mxf, MXFIndexTable *index_table, int64_t edit_unit, AVRational edit_rate, int64_t *edit_unit_out, int64_t *offset_out, MXFPartition **partition_out, int nag) { int i; int64_t offset_temp = 0; edit_unit = av_rescale_q(edit_unit, index_table->segments[0]->index_edit_rate, edit_rate); for (i = 0; i < index_table->nb_segments; i++) { MXFIndexTableSegment *s = index_table->segments[i]; edit_unit = FFMAX(edit_unit, s->index_start_position); /* clamp if trying to seek before start */ if (edit_unit < s->index_start_position + s->index_duration) { int64_t index = edit_unit - s->index_start_position; if (s->edit_unit_byte_count) offset_temp += s->edit_unit_byte_count * index; else if (s->nb_index_entries) { if (s->nb_index_entries == 2 * s->index_duration + 1) index *= 2; /* Avid index */ if (index < 0 || index >= s->nb_index_entries) { av_log(mxf->fc, AV_LOG_ERROR, ""IndexSID %i segment at %""PRId64"" IndexEntryArray too small\n"", index_table->index_sid, s->index_start_position); return AVERROR_INVALIDDATA; } offset_temp = s->stream_offset_entries[index]; } else { av_log(mxf->fc, AV_LOG_ERROR, ""IndexSID %i segment at %""PRId64"" missing EditUnitByteCount and IndexEntryArray\n"", index_table->index_sid, s->index_start_position); return AVERROR_INVALIDDATA; } if (edit_unit_out) *edit_unit_out = av_rescale_q(edit_unit, edit_rate, s->index_edit_rate); return mxf_absolute_bodysid_offset(mxf, index_table->body_sid, offset_temp, offset_out, partition_out); } else { /* EditUnitByteCount == 0 for VBR indexes, which is fine since they use explicit StreamOffsets */ offset_temp += s->edit_unit_byte_count * s->index_duration; } } if (nag) av_log(mxf->fc, AV_LOG_ERROR, ""failed to map EditUnit %""PRId64"" in IndexSID %i to an offset\n"", edit_unit, index_table->index_sid); return AVERROR_INVALIDDATA; } ",0 " bool quirkContainer() const { return m_quirkContainer; } ",0 "bgp_vpn_ip_print(netdissect_options *ndo, const u_char *pptr, u_int addr_length) { /* worst case string is s fully formatted v6 address */ static char addr[sizeof(""1234:5678:89ab:cdef:1234:5678:89ab:cdef"")]; char *pos = addr; switch(addr_length) { case (sizeof(struct in_addr) << 3): /* 32 */ ND_TCHECK2(pptr[0], sizeof(struct in_addr)); snprintf(pos, sizeof(addr), ""%s"", ipaddr_string(ndo, pptr)); break; case (sizeof(struct in6_addr) << 3): /* 128 */ ND_TCHECK2(pptr[0], sizeof(struct in6_addr)); snprintf(pos, sizeof(addr), ""%s"", ip6addr_string(ndo, pptr)); break; default: snprintf(pos, sizeof(addr), ""bogus address length %u"", addr_length); break; } pos += strlen(pos); trunc: *(pos) = '\0'; return (addr); } ",0 "void RenderViewImpl::DismissDateTimeDialog() { DCHECK(date_time_picker_client_); date_time_picker_client_.reset(); } ",0 "FcCacheInsert (FcCache *cache, struct stat *cache_stat) { FcCacheSkip **update[FC_CACHE_MAX_LEVEL]; FcCacheSkip *s, **next; int i, level; lock_cache (); /* * Find links along each chain */ next = fcCacheChains; for (i = fcCacheMaxLevel; --i >= 0; ) { for (; (s = next[i]); next = s->next) if (s->cache > cache) break; update[i] = &next[i]; } /* * Create new list element */ level = random_level (); if (level > fcCacheMaxLevel) { level = fcCacheMaxLevel + 1; update[fcCacheMaxLevel] = &fcCacheChains[fcCacheMaxLevel]; fcCacheMaxLevel = level; } s = malloc (sizeof (FcCacheSkip) + (level - 1) * sizeof (FcCacheSkip *)); if (!s) return FcFalse; s->cache = cache; s->size = cache->size; FcRefInit (&s->ref, 1); if (cache_stat) { s->cache_dev = cache_stat->st_dev; s->cache_ino = cache_stat->st_ino; s->cache_mtime = cache_stat->st_mtime; #ifdef HAVE_STRUCT_STAT_ST_MTIM s->cache_mtime_nano = cache_stat->st_mtim.tv_nsec; #else s->cache_mtime_nano = 0; #endif } else { s->cache_dev = 0; s->cache_ino = 0; s->cache_mtime = 0; s->cache_mtime_nano = 0; } /* * Insert into all fcCacheChains */ for (i = 0; i < level; i++) { s->next[i] = *update[i]; *update[i] = s; } unlock_cache (); return FcTrue; } ",0 "int dev_forward_skb(struct net_device *dev, struct sk_buff *skb) { skb_orphan(skb); if (!(dev->flags & IFF_UP)) return NET_RX_DROP; if (skb->len > (dev->mtu + dev->hard_header_len)) return NET_RX_DROP; skb_set_dev(skb, dev); skb->tstamp.tv64 = 0; skb->pkt_type = PACKET_HOST; skb->protocol = eth_type_trans(skb, dev); return netif_rx(skb); } ",1 "error::Error GLES2DecoderImpl::HandleTexImage2D( uint32 immediate_data_size, const gles2::TexImage2D& c) { TRACE_EVENT0(""gpu"", ""GLES2DecoderImpl::HandleTexImage2D""); tex_image_2d_failed_ = true; GLenum target = static_cast(c.target); GLint level = static_cast(c.level); GLint internal_format = static_cast(c.internalformat); GLsizei width = static_cast(c.width); GLsizei height = static_cast(c.height); GLint border = static_cast(c.border); GLenum format = static_cast(c.format); GLenum type = static_cast(c.type); uint32 pixels_shm_id = static_cast(c.pixels_shm_id); uint32 pixels_shm_offset = static_cast(c.pixels_shm_offset); uint32 pixels_size; if (!GLES2Util::ComputeImageDataSize( width, height, format, type, unpack_alignment_, &pixels_size)) { return error::kOutOfBounds; } const void* pixels = NULL; if (pixels_shm_id != 0 || pixels_shm_offset != 0) { pixels = GetSharedMemoryAs( pixels_shm_id, pixels_shm_offset, pixels_size); if (!pixels) { return error::kOutOfBounds; } } return DoTexImage2D( target, level, internal_format, width, height, border, format, type, pixels, pixels_size); } ",0 "static nl_sock * wifi_create_nl_socket(int port) { struct nl_sock *sock = nl_socket_alloc(); if (sock == NULL) { ALOGE(""Could not create handle""); return NULL; } wifi_socket_set_local_port(sock, port); struct sockaddr *addr = NULL; if (nl_connect(sock, NETLINK_GENERIC)) { ALOGE(""Could not connect handle""); nl_socket_free(sock); return NULL; } /* if (nl_socket_set_nonblocking(sock)) { ALOGE(""Could make socket non-blocking""); nl_socket_free(sock); return NULL; } */ return sock; } ",0 "mobility_print(netdissect_options *ndo, const u_char *bp, const u_char *bp2 _U_) { const struct ip6_mobility *mh; const u_char *ep; unsigned mhlen, hlen; uint8_t type; mh = (const struct ip6_mobility *)bp; /* 'ep' points to the end of available data. */ ep = ndo->ndo_snapend; if (!ND_TTEST(mh->ip6m_len)) { /* * There's not enough captured data to include the * mobility header length. * * Our caller expects us to return the length, however, * so return a value that will run to the end of the * captured data. * * XXX - ""ip6_print()"" doesn't do anything with the * returned length, however, as it breaks out of the * header-processing loop. */ mhlen = ep - bp; goto trunc; } mhlen = (mh->ip6m_len + 1) << 3; /* XXX ip6m_cksum */ ND_TCHECK(mh->ip6m_type); type = mh->ip6m_type; if (type <= IP6M_MAX && mhlen < ip6m_hdrlen[type]) { ND_PRINT((ndo, ""(header length %u is too small for type %u)"", mhlen, type)); goto trunc; } ND_PRINT((ndo, ""mobility: %s"", tok2str(ip6m_str, ""type-#%u"", type))); switch (type) { case IP6M_BINDING_REQUEST: hlen = IP6M_MINLEN; break; case IP6M_HOME_TEST_INIT: case IP6M_CAREOF_TEST_INIT: hlen = IP6M_MINLEN; if (ndo->ndo_vflag) { ND_TCHECK2(*mh, hlen + 8); ND_PRINT((ndo, "" %s Init Cookie=%08x:%08x"", type == IP6M_HOME_TEST_INIT ? ""Home"" : ""Care-of"", EXTRACT_32BITS(&bp[hlen]), EXTRACT_32BITS(&bp[hlen + 4]))); } hlen += 8; break; case IP6M_HOME_TEST: case IP6M_CAREOF_TEST: ND_TCHECK(mh->ip6m_data16[0]); ND_PRINT((ndo, "" nonce id=0x%x"", EXTRACT_16BITS(&mh->ip6m_data16[0]))); hlen = IP6M_MINLEN; if (ndo->ndo_vflag) { ND_TCHECK2(*mh, hlen + 8); ND_PRINT((ndo, "" %s Init Cookie=%08x:%08x"", type == IP6M_HOME_TEST ? ""Home"" : ""Care-of"", EXTRACT_32BITS(&bp[hlen]), EXTRACT_32BITS(&bp[hlen + 4]))); } hlen += 8; if (ndo->ndo_vflag) { ND_TCHECK2(*mh, hlen + 8); ND_PRINT((ndo, "" %s Keygen Token=%08x:%08x"", type == IP6M_HOME_TEST ? ""Home"" : ""Care-of"", EXTRACT_32BITS(&bp[hlen]), EXTRACT_32BITS(&bp[hlen + 4]))); } hlen += 8; break; case IP6M_BINDING_UPDATE: ND_TCHECK(mh->ip6m_data16[0]); ND_PRINT((ndo, "" seq#=%u"", EXTRACT_16BITS(&mh->ip6m_data16[0]))); hlen = IP6M_MINLEN; ND_TCHECK2(*mh, hlen + 1); if (bp[hlen] & 0xf0) ND_PRINT((ndo, "" "")); if (bp[hlen] & 0x80) ND_PRINT((ndo, ""A"")); if (bp[hlen] & 0x40) ND_PRINT((ndo, ""H"")); if (bp[hlen] & 0x20) ND_PRINT((ndo, ""L"")); if (bp[hlen] & 0x10) ND_PRINT((ndo, ""K"")); /* Reserved (4bits) */ hlen += 1; /* Reserved (8bits) */ hlen += 1; ND_TCHECK2(*mh, hlen + 2); /* units of 4 secs */ ND_PRINT((ndo, "" lifetime=%u"", EXTRACT_16BITS(&bp[hlen]) << 2)); hlen += 2; break; case IP6M_BINDING_ACK: ND_TCHECK(mh->ip6m_data8[0]); ND_PRINT((ndo, "" status=%u"", mh->ip6m_data8[0])); if (mh->ip6m_data8[1] & 0x80) ND_PRINT((ndo, "" K"")); /* Reserved (7bits) */ hlen = IP6M_MINLEN; ND_TCHECK2(*mh, hlen + 2); ND_PRINT((ndo, "" seq#=%u"", EXTRACT_16BITS(&bp[hlen]))); hlen += 2; ND_TCHECK2(*mh, hlen + 2); /* units of 4 secs */ ND_PRINT((ndo, "" lifetime=%u"", EXTRACT_16BITS(&bp[hlen]) << 2)); hlen += 2; break; case IP6M_BINDING_ERROR: ND_TCHECK(mh->ip6m_data8[0]); ND_PRINT((ndo, "" status=%u"", mh->ip6m_data8[0])); /* Reserved */ hlen = IP6M_MINLEN; ND_TCHECK2(*mh, hlen + 16); ND_PRINT((ndo, "" homeaddr %s"", ip6addr_string(ndo, &bp[hlen]))); hlen += 16; break; default: ND_PRINT((ndo, "" len=%u"", mh->ip6m_len)); return(mhlen); break; } if (ndo->ndo_vflag) if (mobility_opt_print(ndo, &bp[hlen], mhlen - hlen)) goto trunc; return(mhlen); trunc: ND_PRINT((ndo, ""%s"", tstr)); return(-1); } ",1 "static bt_status_t btif_in_get_adapter_properties(void) { bt_property_t properties[6]; uint32_t num_props; bt_bdaddr_t addr; bt_bdname_t name; bt_scan_mode_t mode; uint32_t disc_timeout; bt_bdaddr_t bonded_devices[BTM_SEC_MAX_DEVICE_RECORDS]; bt_uuid_t local_uuids[BT_MAX_NUM_UUIDS]; num_props = 0; /* BD_ADDR */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_BDADDR, sizeof(addr), &addr); btif_storage_get_adapter_property(&properties[num_props]); num_props++; /* BD_NAME */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_BDNAME, sizeof(name), &name); btif_storage_get_adapter_property(&properties[num_props]); num_props++; /* SCAN_MODE */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_ADAPTER_SCAN_MODE, sizeof(mode), &mode); btif_storage_get_adapter_property(&properties[num_props]); num_props++; /* DISC_TIMEOUT */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT, sizeof(disc_timeout), &disc_timeout); btif_storage_get_adapter_property(&properties[num_props]); num_props++; /* BONDED_DEVICES */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_ADAPTER_BONDED_DEVICES, sizeof(bonded_devices), bonded_devices); btif_storage_get_adapter_property(&properties[num_props]); num_props++; /* LOCAL UUIDs */ BTIF_STORAGE_FILL_PROPERTY(&properties[num_props], BT_PROPERTY_UUIDS, sizeof(local_uuids), local_uuids); btif_storage_get_adapter_property(&properties[num_props]); num_props++; HAL_CBACK(bt_hal_cbacks, adapter_properties_cb, BT_STATUS_SUCCESS, num_props, properties); return BT_STATUS_SUCCESS; } ",0 "const gfx::FontList& Textfield::GetFontList() const { return GetRenderText()->font_list(); } ",0 "static int compat_sock_ioctl_trans(struct file *file, struct socket *sock, unsigned int cmd, unsigned long arg) { void __user *argp = compat_ptr(arg); struct sock *sk = sock->sk; struct net *net = sock_net(sk); if (cmd >= SIOCDEVPRIVATE && cmd <= (SIOCDEVPRIVATE + 15)) return compat_ifr_data_ioctl(net, cmd, argp); switch (cmd) { case SIOCSIFBR: case SIOCGIFBR: return old_bridge_ioctl(argp); case SIOCGIFCONF: return compat_dev_ifconf(net, argp); case SIOCETHTOOL: return ethtool_ioctl(net, argp); case SIOCWANDEV: return compat_siocwandev(net, argp); case SIOCGIFMAP: case SIOCSIFMAP: return compat_sioc_ifmap(net, cmd, argp); case SIOCADDRT: case SIOCDELRT: return routing_ioctl(net, sock, cmd, argp); case SIOCGSTAMP: return do_siocgstamp(net, sock, cmd, argp); case SIOCGSTAMPNS: return do_siocgstampns(net, sock, cmd, argp); case SIOCBONDSLAVEINFOQUERY: case SIOCBONDINFOQUERY: case SIOCSHWTSTAMP: case SIOCGHWTSTAMP: return compat_ifr_data_ioctl(net, cmd, argp); case FIOSETOWN: case SIOCSPGRP: case FIOGETOWN: case SIOCGPGRP: case SIOCBRADDBR: case SIOCBRDELBR: case SIOCGIFVLAN: case SIOCSIFVLAN: case SIOCADDDLCI: case SIOCDELDLCI: case SIOCGSKNS: return sock_ioctl(file, cmd, arg); case SIOCGIFFLAGS: case SIOCSIFFLAGS: case SIOCGIFMETRIC: case SIOCSIFMETRIC: case SIOCGIFMTU: case SIOCSIFMTU: case SIOCGIFMEM: case SIOCSIFMEM: case SIOCGIFHWADDR: case SIOCSIFHWADDR: case SIOCADDMULTI: case SIOCDELMULTI: case SIOCGIFINDEX: case SIOCGIFADDR: case SIOCSIFADDR: case SIOCSIFHWBROADCAST: case SIOCDIFADDR: case SIOCGIFBRDADDR: case SIOCSIFBRDADDR: case SIOCGIFDSTADDR: case SIOCSIFDSTADDR: case SIOCGIFNETMASK: case SIOCSIFNETMASK: case SIOCSIFPFLAGS: case SIOCGIFPFLAGS: case SIOCGIFTXQLEN: case SIOCSIFTXQLEN: case SIOCBRADDIF: case SIOCBRDELIF: case SIOCSIFNAME: case SIOCGMIIPHY: case SIOCGMIIREG: case SIOCSMIIREG: case SIOCSARP: case SIOCGARP: case SIOCDARP: case SIOCATMARK: case SIOCBONDENSLAVE: case SIOCBONDRELEASE: case SIOCBONDSETHWADDR: case SIOCBONDCHANGEACTIVE: case SIOCGIFNAME: return sock_do_ioctl(net, sock, cmd, arg); } return -ENOIOCTLCMD; } ",0 "gst_qtdemux_handle_src_event (GstPad * pad, GstEvent * event) { gboolean res = TRUE; GstQTDemux *qtdemux = GST_QTDEMUX (gst_pad_get_parent (pad)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: if (qtdemux->pullbased) { res = gst_qtdemux_do_seek (qtdemux, pad, event); } else { GST_DEBUG_OBJECT (qtdemux, ""cannot seek in streaming mode""); res = FALSE; } gst_event_unref (event); break; case GST_EVENT_QOS: case GST_EVENT_NAVIGATION: res = FALSE; gst_event_unref (event); break; default: res = gst_pad_event_default (pad, event); break; } gst_object_unref (qtdemux); return res; } ",0 "static bool check_client_passwd(PgSocket *client, const char *passwd) { char md5[MD5_PASSWD_LEN + 1]; const char *correct; PgUser *user = client->auth_user; /* disallow empty passwords */ if (!*passwd || !*user->passwd) return false; switch (cf_auth_type) { case AUTH_PLAIN: return strcmp(user->passwd, passwd) == 0; case AUTH_CRYPT: correct = crypt(user->passwd, (char *)client->tmp_login_salt); return correct && strcmp(correct, passwd) == 0; case AUTH_MD5: if (strlen(passwd) != MD5_PASSWD_LEN) return false; if (!isMD5(user->passwd)) pg_md5_encrypt(user->passwd, user->name, strlen(user->name), user->passwd); pg_md5_encrypt(user->passwd + 3, (char *)client->tmp_login_salt, 4, md5); return strcmp(md5, passwd) == 0; } return false; } ",0 "void ContentSecurityPolicy::ReportViolation( const String& directive_text, const DirectiveType& effective_type, const String& console_message, const KURL& blocked_url, const Vector& report_endpoints, bool use_reporting_api, const String& header, ContentSecurityPolicyHeaderType header_type, ViolationType violation_type, std::unique_ptr source_location, LocalFrame* context_frame, RedirectStatus redirect_status, Element* element, const String& source) { DCHECK(violation_type == kURLViolation || blocked_url.IsEmpty()); if (!execution_context_ && !context_frame) { DCHECK(effective_type == DirectiveType::kChildSrc || effective_type == DirectiveType::kFrameSrc || effective_type == DirectiveType::kPluginTypes); return; } DCHECK((execution_context_ && !context_frame) || ((effective_type == DirectiveType::kFrameAncestors) && context_frame)); SecurityPolicyViolationEventInit* violation_data = SecurityPolicyViolationEventInit::Create(); ExecutionContext* relevant_context = context_frame ? context_frame->GetDocument() : execution_context_; DCHECK(relevant_context); GatherSecurityPolicyViolationEventData( violation_data, relevant_context, directive_text, effective_type, blocked_url, header, redirect_status, header_type, violation_type, std::move(source_location), source); if (!violation_data->sourceFile().IsEmpty() && ShouldBypassContentSecurityPolicy(KURL(violation_data->sourceFile()), execution_context_)) { return; } PostViolationReport(violation_data, context_frame, report_endpoints, use_reporting_api); if (execution_context_) { execution_context_->GetTaskRunner(TaskType::kNetworking) ->PostTask( FROM_HERE, WTF::Bind(&ContentSecurityPolicy::DispatchViolationEvents, WrapPersistent(this), WrapPersistent(violation_data), WrapPersistent(element))); } } ",0 "int can_migrate_task(struct task_struct *p, struct lb_env *env) { int tsk_cache_hot; lockdep_assert_held(&env->src_rq->lock); /* * We do not migrate tasks that are: * 1) throttled_lb_pair, or * 2) cannot be migrated to this CPU due to cpus_allowed, or * 3) running (obviously), or * 4) are cache-hot on their current CPU. */ if (throttled_lb_pair(task_group(p), env->src_cpu, env->dst_cpu)) return 0; if (!cpumask_test_cpu(env->dst_cpu, &p->cpus_allowed)) { int cpu; schedstat_inc(p->se.statistics.nr_failed_migrations_affine); env->flags |= LBF_SOME_PINNED; /* * Remember if this task can be migrated to any other CPU in * our sched_group. We may want to revisit it if we couldn't * meet load balance goals by pulling other tasks on src_cpu. * * Avoid computing new_dst_cpu for NEWLY_IDLE or if we have * already computed one in current iteration. */ if (env->idle == CPU_NEWLY_IDLE || (env->flags & LBF_DST_PINNED)) return 0; /* Prevent to re-select dst_cpu via env's CPUs: */ for_each_cpu_and(cpu, env->dst_grpmask, env->cpus) { if (cpumask_test_cpu(cpu, &p->cpus_allowed)) { env->flags |= LBF_DST_PINNED; env->new_dst_cpu = cpu; break; } } return 0; } /* Record that we found atleast one task that could run on dst_cpu */ env->flags &= ~LBF_ALL_PINNED; if (task_running(env->src_rq, p)) { schedstat_inc(p->se.statistics.nr_failed_migrations_running); return 0; } /* * Aggressive migration if: * 1) destination numa is preferred * 2) task is cache cold, or * 3) too many balance attempts have failed. */ tsk_cache_hot = migrate_degrades_locality(p, env); if (tsk_cache_hot == -1) tsk_cache_hot = task_hot(p, env); if (tsk_cache_hot <= 0 || env->sd->nr_balance_failed > env->sd->cache_nice_tries) { if (tsk_cache_hot == 1) { schedstat_inc(env->sd->lb_hot_gained[env->idle]); schedstat_inc(p->se.statistics.nr_forced_migrations); } return 1; } schedstat_inc(p->se.statistics.nr_failed_migrations_hot); return 0; } ",0 "CheckScreenPrivate(ScreenPtr pScreen) { SetupScreen(pScreen); if (!pPriv) return; if (!pPriv->attr && !pPriv->events && !pPriv->hasWindow && pPriv->installedMap == None) { free(pPriv); SetScreenPrivate(pScreen, NULL); pScreen->screensaver.ExternalScreenSaver = NULL; } } ",0 "ofputil_append_ofp11_group_desc_reply(const struct ofputil_group_desc *gds, const struct ovs_list *buckets, struct ovs_list *replies, enum ofp_version version) { struct ofpbuf *reply = ofpbuf_from_list(ovs_list_back(replies)); struct ofp11_group_desc_stats *ogds; struct ofputil_bucket *bucket; size_t start_ogds; start_ogds = reply->size; ofpbuf_put_zeros(reply, sizeof *ogds); LIST_FOR_EACH (bucket, list_node, buckets) { ofputil_put_ofp11_bucket(bucket, reply, version); } ogds = ofpbuf_at_assert(reply, start_ogds, sizeof *ogds); ogds->length = htons(reply->size - start_ogds); ogds->type = gds->type; ogds->group_id = htonl(gds->group_id); ofpmp_postappend(replies, start_ogds); } ",0 "void GLES2DecoderImpl::DoCompressedTexSubImage2D( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei image_size, const void * data) { TextureManager::TextureInfo* info = GetTextureInfoForTarget(target); if (!info) { SetGLError(GL_INVALID_OPERATION, ""glCompressedTexSubImage2D"", ""unknown texture for target""); return; } GLenum type = 0; GLenum internal_format = 0; if (!info->GetLevelType(target, level, &type, &internal_format)) { SetGLError( GL_INVALID_OPERATION, ""glCompressedTexSubImage2D"", ""level does not exist.""); return; } if (internal_format != format) { SetGLError( GL_INVALID_OPERATION, ""glCompressedTexSubImage2D"", ""format does not match internal format.""); return; } if (!info->ValidForTexture( target, level, xoffset, yoffset, width, height, format, type)) { SetGLError(GL_INVALID_VALUE, ""glCompressedTexSubImage2D"", ""bad dimensions.""); return; } if (!ValidateCompressedTexFuncData( ""glCompressedTexSubImage2D"", width, height, format, image_size) || !ValidateCompressedTexSubDimensions( ""glCompressedTexSubImage2D"", target, level, xoffset, yoffset, width, height, format, info)) { return; } glCompressedTexSubImage2D( target, level, xoffset, yoffset, width, height, format, image_size, data); } ",0 "void FrameLoader::didFirstLayout() { if (Page* page = m_frame->page()) if (isBackForwardLoadType(m_loadType) && page->backForwardList()) history()->restoreScrollPositionAndViewState(); m_firstLayoutDone = true; m_client->dispatchDidFirstLayout(); } ",0 "static int ptrace_do_wait(struct wait_opts *wo, struct task_struct *tsk) { struct task_struct *p; list_for_each_entry(p, &tsk->ptraced, ptrace_entry) { int ret = wait_consider_task(wo, 1, p); if (ret) return ret; } return 0; } ",0 "_gnutls_handshake_hash_buffers_clear (gnutls_session_t session) { _gnutls_hash_deinit (&session->internals.handshake_mac_handle_md5, NULL); _gnutls_hash_deinit (&session->internals.handshake_mac_handle_sha, NULL); _gnutls_handshake_buffer_clear (session); } ",0 "copy_attr_error (struct error_context *ctx, char const *fmt, ...) { int err = errno; va_list ap; /* use verror module to print error message */ va_start (ap, fmt); verror (0, err, fmt, ap); va_end (ap); } ",0 "void Browser::TabStripEmpty() { MessageLoop::current()->PostTask( FROM_HERE, method_factory_.NewRunnableMethod(&Browser::CloseFrame)); } ",0 "int perf_cpu_time_max_percent_handler(struct ctl_table *table, int write, void __user *buffer, size_t *lenp, loff_t *ppos) { int ret = proc_dointvec(table, write, buffer, lenp, ppos); if (ret || !write) return ret; if (sysctl_perf_cpu_time_max_percent == 100 || sysctl_perf_cpu_time_max_percent == 0) { printk(KERN_WARNING ""perf: Dynamic interrupt throttling disabled, can hang your system!\n""); WRITE_ONCE(perf_sample_allowed_ns, 0); } else { update_perf_cpu_limits(); } return 0; } ",0 "void SchedulerHelper::SetPumpPolicy(size_t queue_index, TaskQueueManager::PumpPolicy pump_policy) { CheckOnValidThread(); return task_queue_manager_->SetPumpPolicy(queue_index, pump_policy); } ",0 "cleanup(struct archive_read *a) { struct mtree *mtree; struct mtree_entry *p, *q; mtree = (struct mtree *)(a->format->data); p = mtree->entries; while (p != NULL) { q = p->next; free(p->name); free_options(p->options); free(p); p = q; } archive_string_free(&mtree->line); archive_string_free(&mtree->current_dir); archive_string_free(&mtree->contents_name); archive_entry_linkresolver_free(mtree->resolver); free(mtree->buff); free(mtree); (a->format->data) = NULL; return (ARCHIVE_OK); } ",0 "void bdrv_swap(BlockDriverState *bs_new, BlockDriverState *bs_old) { BlockDriverState tmp; /* The code needs to swap the node_name but simply swapping node_list won't * work so first remove the nodes from the graph list, do the swap then * insert them back if needed. */ if (bs_new->node_name[0] != '\0') { QTAILQ_REMOVE(&graph_bdrv_states, bs_new, node_list); } if (bs_old->node_name[0] != '\0') { QTAILQ_REMOVE(&graph_bdrv_states, bs_old, node_list); } /* bs_new must be anonymous and shouldn't have anything fancy enabled */ assert(bs_new->device_name[0] == '\0'); assert(QLIST_EMPTY(&bs_new->dirty_bitmaps)); assert(bs_new->job == NULL); assert(bs_new->dev == NULL); assert(bs_new->in_use == 0); assert(bs_new->io_limits_enabled == false); assert(!throttle_have_timer(&bs_new->throttle_state)); tmp = *bs_new; *bs_new = *bs_old; *bs_old = tmp; /* there are some fields that should not be swapped, move them back */ bdrv_move_feature_fields(&tmp, bs_old); bdrv_move_feature_fields(bs_old, bs_new); bdrv_move_feature_fields(bs_new, &tmp); /* bs_new shouldn't be in bdrv_states even after the swap! */ assert(bs_new->device_name[0] == '\0'); /* Check a few fields that should remain attached to the device */ assert(bs_new->dev == NULL); assert(bs_new->job == NULL); assert(bs_new->in_use == 0); assert(bs_new->io_limits_enabled == false); assert(!throttle_have_timer(&bs_new->throttle_state)); /* insert the nodes back into the graph node list if needed */ if (bs_new->node_name[0] != '\0') { QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs_new, node_list); } if (bs_old->node_name[0] != '\0') { QTAILQ_INSERT_TAIL(&graph_bdrv_states, bs_old, node_list); } bdrv_rebind(bs_new); bdrv_rebind(bs_old); } ",0 " void LockToOrigin(const GURL& gurl) { origin_lock_ = gurl; } ",0 "static X509_REQ * php_openssl_csr_from_zval(zval ** val, int makeresource, long * resourceval TSRMLS_DC) { X509_REQ * csr = NULL; char * filename = NULL; BIO * in; if (resourceval) { *resourceval = -1; } if (Z_TYPE_PP(val) == IS_RESOURCE) { void * what; int type; what = zend_fetch_resource(val TSRMLS_CC, -1, ""OpenSSL X.509 CSR"", &type, 1, le_csr); if (what) { if (resourceval) { *resourceval = Z_LVAL_PP(val); } return (X509_REQ*)what; } return NULL; } else if (Z_TYPE_PP(val) != IS_STRING) { return NULL; } if (Z_STRLEN_PP(val) > 7 && memcmp(Z_STRVAL_PP(val), ""file://"", sizeof(""file://"") - 1) == 0) { filename = Z_STRVAL_PP(val) + (sizeof(""file://"") - 1); } if (filename) { if (php_openssl_open_base_dir_chk(filename TSRMLS_CC)) { return NULL; } in = BIO_new_file(filename, ""r""); } else { in = BIO_new_mem_buf(Z_STRVAL_PP(val), Z_STRLEN_PP(val)); } csr = PEM_read_bio_X509_REQ(in, NULL,NULL,NULL); BIO_free(in); return csr; } ",0 "void AutocompleteEditModel::Revert() { SetInputInProgress(false); paste_state_ = NONE; InternalSetUserText(string16()); keyword_.clear(); is_keyword_hint_ = false; has_temporary_text_ = false; view_->SetWindowTextAndCaretPos(permanent_text_, has_focus_ ? permanent_text_.length() : 0, false, true); AutocompleteActionPredictor* action_predictor = AutocompleteActionPredictorFactory::GetForProfile(profile_); if (action_predictor) action_predictor->ClearTransitionalMatches(); } ",0 "static void vmxnet3_process_tx_queue(VMXNET3State *s, int qidx) { struct Vmxnet3_TxDesc txd; uint32_t txd_idx; uint32_t data_len; hwaddr data_pa; for (;;) { if (!vmxnet3_pop_next_tx_descr(s, qidx, &txd, &txd_idx)) { break; } vmxnet3_dump_tx_descr(&txd); if (!s->skip_current_tx_pkt) { data_len = (txd.len > 0) ? txd.len : VMXNET3_MAX_TX_BUF_SIZE; data_pa = le64_to_cpu(txd.addr); if (!vmxnet_tx_pkt_add_raw_fragment(s->tx_pkt, data_pa, data_len)) { s->skip_current_tx_pkt = true; } } if (s->tx_sop) { vmxnet3_tx_retrieve_metadata(s, &txd); s->tx_sop = false; } if (txd.eop) { if (!s->skip_current_tx_pkt) { vmxnet_tx_pkt_parse(s->tx_pkt); if (s->needs_vlan) { vmxnet_tx_pkt_setup_vlan_header(s->tx_pkt, s->tci); } vmxnet_tx_pkt_setup_vlan_header(s->tx_pkt, s->tci); } vmxnet3_send_packet(s, qidx); } else { vmxnet3_on_tx_done_update_stats(s, qidx, VMXNET3_PKT_STATUS_ERROR); } vmxnet3_complete_packet(s, qidx, txd_idx); s->tx_sop = true; s->skip_current_tx_pkt = false; vmxnet_tx_pkt_reset(s->tx_pkt); } } ",1 "static int StreamTcpPacketStateClosing(ThreadVars *tv, Packet *p, StreamTcpThread *stt, TcpSession *ssn, PacketQueue *pq) { if (ssn == NULL) return -1; if (p->tcph->th_flags & TH_RST) { if (!StreamTcpValidateRst(ssn, p)) return -1; StreamTcpPacketSetState(p, ssn, TCP_CLOSED); SCLogDebug(""ssn %p: Reset received state changed to TCP_CLOSED"", ssn); if (PKT_IS_TOSERVER(p)) { if ((p->tcph->th_flags & TH_ACK) && StreamTcpValidateAck(ssn, &ssn->server, p) == 0) StreamTcpUpdateLastAck(ssn, &ssn->server, StreamTcpResetGetMaxAck(&ssn->server, TCP_GET_ACK(p))); StreamTcpUpdateLastAck(ssn, &ssn->client, StreamTcpResetGetMaxAck(&ssn->client, TCP_GET_SEQ(p))); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->client, p, pq); } else { if ((p->tcph->th_flags & TH_ACK) && StreamTcpValidateAck(ssn, &ssn->client, p) == 0) StreamTcpUpdateLastAck(ssn, &ssn->client, StreamTcpResetGetMaxAck(&ssn->client, TCP_GET_ACK(p))); StreamTcpUpdateLastAck(ssn, &ssn->server, StreamTcpResetGetMaxAck(&ssn->server, TCP_GET_SEQ(p))); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->server, p, pq); } } else if (p->tcph->th_flags & TH_SYN) { SCLogDebug(""ssn (%p): SYN pkt on Closing"", ssn); StreamTcpSetEvent(p, STREAM_SHUTDOWN_SYN_RESEND); return -1; } else if (p->tcph->th_flags & TH_ACK) { if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { if (!StreamTcpValidateTimestamp(ssn, p)) return -1; } if (PKT_IS_TOSERVER(p)) { SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to server: SEQ "" ""%"" PRIu32 "", ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); int retransmission = 0; if (StreamTcpPacketIsRetransmission(&ssn->client, p)) { SCLogDebug(""ssn %p: packet is retransmission"", ssn); retransmission = 1; } if (TCP_GET_SEQ(p) != ssn->client.next_seq) { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 """" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->client.next_seq); StreamTcpSetEvent(p, STREAM_CLOSING_ACK_WRONG_SEQ); return -1; } if (StreamTcpValidateAck(ssn, &ssn->server, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_CLOSING_INVALID_ACK); return -1; } if (!retransmission) { StreamTcpPacketSetState(p, ssn, TCP_TIME_WAIT); SCLogDebug(""ssn %p: state changed to TCP_TIME_WAIT"", ssn); ssn->client.window = TCP_GET_WINDOW(p) << ssn->client.wscale; } StreamTcpUpdateLastAck(ssn, &ssn->server, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->server.next_seq, TCP_GET_ACK(p))) ssn->server.next_seq = TCP_GET_ACK(p); StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->client, p, pq); SCLogDebug(""ssn %p: =+ next SEQ %"" PRIu32 "", last ACK "" ""%"" PRIu32 """", ssn, ssn->client.next_seq, ssn->server.last_ack); } else { /* implied to client */ SCLogDebug(""ssn %p: pkt (%"" PRIu32 "") is to client: SEQ "" ""%"" PRIu32 "", ACK %"" PRIu32 """", ssn, p->payload_len, TCP_GET_SEQ(p), TCP_GET_ACK(p)); int retransmission = 0; if (StreamTcpPacketIsRetransmission(&ssn->server, p)) { SCLogDebug(""ssn %p: packet is retransmission"", ssn); retransmission = 1; } if (TCP_GET_SEQ(p) != ssn->server.next_seq) { SCLogDebug(""ssn %p: -> SEQ mismatch, packet SEQ %"" PRIu32 """" "" != %"" PRIu32 "" from stream"", ssn, TCP_GET_SEQ(p), ssn->server.next_seq); StreamTcpSetEvent(p, STREAM_CLOSING_ACK_WRONG_SEQ); return -1; } if (StreamTcpValidateAck(ssn, &ssn->client, p) == -1) { SCLogDebug(""ssn %p: rejecting because of invalid ack value"", ssn); StreamTcpSetEvent(p, STREAM_CLOSING_INVALID_ACK); return -1; } if (!retransmission) { StreamTcpPacketSetState(p, ssn, TCP_TIME_WAIT); SCLogDebug(""ssn %p: state changed to TCP_TIME_WAIT"", ssn); ssn->client.window = TCP_GET_WINDOW(p) << ssn->client.wscale; } StreamTcpUpdateLastAck(ssn, &ssn->client, TCP_GET_ACK(p)); if (ssn->flags & STREAMTCP_FLAG_TIMESTAMP) { StreamTcpHandleTimestamp(ssn, p); } /* Update the next_seq, in case if we have missed the client packet and server has already received and acked it */ if (SEQ_LT(ssn->client.next_seq, TCP_GET_ACK(p))) ssn->client.next_seq = TCP_GET_ACK(p); StreamTcpReassembleHandleSegment(tv, stt->ra_ctx, ssn, &ssn->server, p, pq); SCLogDebug(""StreamTcpPacketStateClosing (%p): =+ next SEQ "" ""%"" PRIu32 "", last ACK %"" PRIu32 """", ssn, ssn->server.next_seq, ssn->client.last_ack); } } else { SCLogDebug(""ssn %p: default case"", ssn); } return 0; } ",0 "bool btif_config_set_int(const char *section, const char *key, int value) { assert(config != NULL); assert(section != NULL); assert(key != NULL); pthread_mutex_lock(&lock); config_set_int(config, section, key, value); pthread_mutex_unlock(&lock); return true; } ",0 " ExternalProtocolHandlerTest() {} ",0 "void ftrace_dump(enum ftrace_dump_mode oops_dump_mode) { /* use static because iter can be a bit big for the stack */ static struct trace_iterator iter; static atomic_t dump_running; struct trace_array *tr = &global_trace; unsigned int old_userobj; unsigned long flags; int cnt = 0, cpu; /* Only allow one dump user at a time. */ if (atomic_inc_return(&dump_running) != 1) { atomic_dec(&dump_running); return; } /* * Always turn off tracing when we dump. * We don't need to show trace output of what happens * between multiple crashes. * * If the user does a sysrq-z, then they can re-enable * tracing with echo 1 > tracing_on. */ tracing_off(); local_irq_save(flags); printk_nmi_direct_enter(); /* Simulate the iterator */ trace_init_global_iter(&iter); for_each_tracing_cpu(cpu) { atomic_inc(&per_cpu_ptr(iter.trace_buffer->data, cpu)->disabled); } old_userobj = tr->trace_flags & TRACE_ITER_SYM_USEROBJ; /* don't look at user memory in panic mode */ tr->trace_flags &= ~TRACE_ITER_SYM_USEROBJ; switch (oops_dump_mode) { case DUMP_ALL: iter.cpu_file = RING_BUFFER_ALL_CPUS; break; case DUMP_ORIG: iter.cpu_file = raw_smp_processor_id(); break; case DUMP_NONE: goto out_enable; default: printk(KERN_TRACE ""Bad dumping mode, switching to all CPUs dump\n""); iter.cpu_file = RING_BUFFER_ALL_CPUS; } printk(KERN_TRACE ""Dumping ftrace buffer:\n""); /* Did function tracer already get disabled? */ if (ftrace_is_dead()) { printk(""# WARNING: FUNCTION TRACING IS CORRUPTED\n""); printk(""# MAY BE MISSING FUNCTION EVENTS\n""); } /* * We need to stop all tracing on all CPUS to read the * the next buffer. This is a bit expensive, but is * not done often. We fill all what we can read, * and then release the locks again. */ while (!trace_empty(&iter)) { if (!cnt) printk(KERN_TRACE ""---------------------------------\n""); cnt++; /* reset all but tr, trace, and overruns */ memset(&iter.seq, 0, sizeof(struct trace_iterator) - offsetof(struct trace_iterator, seq)); iter.iter_flags |= TRACE_FILE_LAT_FMT; iter.pos = -1; if (trace_find_next_entry_inc(&iter) != NULL) { int ret; ret = print_trace_line(&iter); if (ret != TRACE_TYPE_NO_CONSUME) trace_consume(&iter); } touch_nmi_watchdog(); trace_printk_seq(&iter.seq); } if (!cnt) printk(KERN_TRACE "" (ftrace buffer empty)\n""); else printk(KERN_TRACE ""---------------------------------\n""); out_enable: tr->trace_flags |= old_userobj; for_each_tracing_cpu(cpu) { atomic_dec(&per_cpu_ptr(iter.trace_buffer->data, cpu)->disabled); } atomic_dec(&dump_running); printk_nmi_direct_exit(); local_irq_restore(flags); } ",0 "int sock_send_fd(int sock_fd, const uint8_t* buf, int len, int send_fd) { ssize_t ret; struct msghdr msg; unsigned char *buffer = (unsigned char *)buf; memset(&msg, 0, sizeof(msg)); struct cmsghdr *cmsg; char msgbuf[CMSG_SPACE(1)]; asrt(send_fd != -1); if(sock_fd == -1 || send_fd == -1) return -1; msg.msg_control = msgbuf; msg.msg_controllen = sizeof msgbuf; cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; cmsg->cmsg_len = CMSG_LEN(sizeof send_fd); memcpy(CMSG_DATA(cmsg), &send_fd, sizeof send_fd); int ret_len = len; while (len > 0) { struct iovec iv; memset(&iv, 0, sizeof(iv)); iv.iov_base = buffer; iv.iov_len = len; msg.msg_iov = &iv; msg.msg_iovlen = 1; do { ret = sendmsg(sock_fd, &msg, MSG_NOSIGNAL); } while (ret < 0 && errno == EINTR); if (ret < 0) { BTIF_TRACE_ERROR(""fd:%d, send_fd:%d, sendmsg ret:%d, errno:%d, %s"", sock_fd, send_fd, (int)ret, errno, strerror(errno)); ret_len = -1; break; } buffer += ret; len -= ret; memset(&msg, 0, sizeof(msg)); } BTIF_TRACE_DEBUG(""close fd:%d after sent"", send_fd); close(send_fd); return ret_len; } ",1 "static iw_float32 iw_get_float32(const iw_byte *m) { int k; union su_union { iw_byte c[4]; iw_float32 f; } volatile su; for(k=0;k<4;k++) { su.c[k] = m[k]; } return su.f; } ",0 "void sched_exec(void) { struct task_struct *p = current; unsigned long flags; struct rq *rq; int dest_cpu; rq = task_rq_lock(p, &flags); dest_cpu = p->sched_class->select_task_rq(rq, p, SD_BALANCE_EXEC, 0); if (dest_cpu == smp_processor_id()) goto unlock; /* * select_task_rq() can race against ->cpus_allowed */ if (cpumask_test_cpu(dest_cpu, &p->cpus_allowed) && likely(cpu_active(dest_cpu)) && migrate_task(p, dest_cpu)) { struct migration_arg arg = { p, dest_cpu }; task_rq_unlock(rq, &flags); stop_one_cpu(cpu_of(rq), migration_cpu_stop, &arg); return; } unlock: task_rq_unlock(rq, &flags); } ",0 "JSObject* createReferenceError(JSGlobalObject* globalObject, const UString& message) { ASSERT(!message.isEmpty()); return ErrorInstance::create(globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message); } ",0 "static void nfs4_proc_commit_setup(struct nfs_write_data *data, struct rpc_message *msg) { struct nfs_server *server = NFS_SERVER(data->inode); if (data->lseg) { data->args.bitmask = NULL; data->res.fattr = NULL; } else data->args.bitmask = server->cache_consistency_bitmask; if (!data->write_done_cb) data->write_done_cb = nfs4_commit_done_cb; data->res.server = server; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_COMMIT]; } ",0 "int rdma_set_ib_paths(struct rdma_cm_id *id, struct ib_sa_path_rec *path_rec, int num_paths) { struct rdma_id_private *id_priv; int ret; id_priv = container_of(id, struct rdma_id_private, id); if (!cma_comp_exch(id_priv, RDMA_CM_ADDR_RESOLVED, RDMA_CM_ROUTE_RESOLVED)) return -EINVAL; id->route.path_rec = kmemdup(path_rec, sizeof *path_rec * num_paths, GFP_KERNEL); if (!id->route.path_rec) { ret = -ENOMEM; goto err; } id->route.num_paths = num_paths; return 0; err: cma_comp_exch(id_priv, RDMA_CM_ROUTE_RESOLVED, RDMA_CM_ADDR_RESOLVED); return ret; } ",0 "scoped_refptr WebGLRenderingContextBase::VideoFrameToImage( HTMLVideoElement* video, int already_uploaded_id, WebMediaPlayer::VideoFrameUploadMetadata* out_metadata) { const IntSize& visible_size = video->videoVisibleSize(); if (visible_size.IsEmpty()) { SynthesizeGLError(GL_INVALID_VALUE, ""tex(Sub)Image2D"", ""video visible size is empty""); return nullptr; } ImageBuffer* buf = generated_image_cache_.GetImageBuffer(visible_size); if (!buf) { SynthesizeGLError(GL_OUT_OF_MEMORY, ""texImage2D"", ""out of memory""); return nullptr; } IntRect dest_rect(0, 0, visible_size.Width(), visible_size.Height()); video->PaintCurrentFrame(buf->Canvas(), dest_rect, nullptr, already_uploaded_id, out_metadata); return buf->NewImageSnapshot(); } ",0 "xsltRegisterTmpRVT(xsltTransformContextPtr ctxt, xmlDocPtr RVT) { if ((ctxt == NULL) || (RVT == NULL)) return(-1); /* * We'll restrict the lifetime of user-created fragments * insinde an xsl:variable and xsl:param to the lifetime of the * var/param itself. */ if (ctxt->contextVariable != NULL) { RVT->next = (xmlNodePtr) XSLT_TCTXT_VARIABLE(ctxt)->fragment; XSLT_TCTXT_VARIABLE(ctxt)->fragment = RVT; return(0); } RVT->next = (xmlNodePtr) ctxt->tmpRVT; if (ctxt->tmpRVT != NULL) ctxt->tmpRVT->prev = (xmlNodePtr) RVT; ctxt->tmpRVT = RVT; return(0); } ",0 "generic_file_splice_write(struct pipe_inode_info *pipe, struct file *out, loff_t *ppos, size_t len, unsigned int flags) { struct address_space *mapping = out->f_mapping; struct inode *inode = mapping->host; struct splice_desc sd = { .total_len = len, .flags = flags, .pos = *ppos, .u.file = out, }; ssize_t ret; pipe_lock(pipe); splice_from_pipe_begin(&sd); do { ret = splice_from_pipe_next(pipe, &sd); if (ret <= 0) break; mutex_lock_nested(&inode->i_mutex, I_MUTEX_CHILD); ret = file_remove_suid(out); if (!ret) { ret = file_update_time(out); if (!ret) ret = splice_from_pipe_feed(pipe, &sd, pipe_to_file); } mutex_unlock(&inode->i_mutex); } while (ret > 0); splice_from_pipe_end(pipe, &sd); pipe_unlock(pipe); if (sd.num_spliced) ret = sd.num_spliced; if (ret > 0) { int err; err = generic_write_sync(out, *ppos, ret); if (err) ret = err; else *ppos += ret; balance_dirty_pages_ratelimited(mapping); } return ret; } ",0 "size_t RenderView::GetRenderViewCount() { return g_view_map.Get().size(); } ",0 "void omx_vdec::perf_control::request_cores(int frame_duration_us) { if (frame_duration_us > MIN_FRAME_DURATION_FOR_PERF_REQUEST_US) { return; } load_lib(); if (m_perf_lock_acquire && m_perf_handle < 0) { int arg = 0x700 /*base value*/ + 2 /*cores*/; m_perf_handle = m_perf_lock_acquire(m_perf_handle, 0, &arg, sizeof(arg)/sizeof(int)); if (m_perf_handle) { DEBUG_PRINT_HIGH(""perf lock acquired""); } } } ",0 "void Pack(const float* source, uint16_t* destination, unsigned pixels_per_row) { for (unsigned i = 0; i < pixels_per_row; ++i) { destination[0] = ConvertFloatToHalfFloat(source[3]); source += 4; destination += 1; } } ",0 "static int lang_run_file(RCore *core, RLang *lang, const char *file) { r_core_sysenv_begin (core, NULL); return r_lang_run_file (core->lang, file); } ",0 "void proc_clear_tty(struct task_struct *p) { unsigned long flags; struct tty_struct *tty; spin_lock_irqsave(&p->sighand->siglock, flags); tty = p->signal->tty; p->signal->tty = NULL; spin_unlock_irqrestore(&p->sighand->siglock, flags); tty_kref_put(tty); } ",0 " bool tryGet(const v8::Handle& handle, T* valueOut) { typename HandleToT::iterator result = m_map.find(*handle); if (result != m_map.end()) { *valueOut = result->value; return true; } return false; } ",0 "PHP_FUNCTION(dom_document_get_elements_by_tag_name) { zval *id; xmlDocPtr docp; int name_len; dom_object *intern, *namednode; char *name; xmlChar *local; if (zend_parse_method_parameters(ZEND_NUM_ARGS() TSRMLS_CC, getThis(), ""Os"", &id, dom_document_class_entry, &name, &name_len) == FAILURE) { return; } DOM_GET_OBJ(docp, id, xmlDocPtr, intern); php_dom_create_interator(return_value, DOM_NODELIST TSRMLS_CC); namednode = (dom_object *)zend_objects_get_address(return_value TSRMLS_CC); local = xmlCharStrndup(name, name_len); dom_namednode_iter(intern, 0, namednode, NULL, local, NULL TSRMLS_CC); } ",0 "bool RenderWidgetHostImpl::OnMessageReceived(const IPC::Message &msg) { bool handled = true; bool msg_is_ok = true; IPC_BEGIN_MESSAGE_MAP_EX(RenderWidgetHostImpl, msg, msg_is_ok) IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewReady, OnMsgRenderViewReady) IPC_MESSAGE_HANDLER(ViewHostMsg_RenderViewGone, OnMsgRenderViewGone) IPC_MESSAGE_HANDLER(ViewHostMsg_Close, OnMsgClose) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateScreenRects_ACK, OnMsgUpdateScreenRectsAck) IPC_MESSAGE_HANDLER(ViewHostMsg_RequestMove, OnMsgRequestMove) IPC_MESSAGE_HANDLER(ViewHostMsg_SetTooltipText, OnMsgSetTooltipText) IPC_MESSAGE_HANDLER(ViewHostMsg_PaintAtSize_ACK, OnMsgPaintAtSizeAck) IPC_MESSAGE_HANDLER(ViewHostMsg_CompositorSurfaceBuffersSwapped, OnCompositorSurfaceBuffersSwapped) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateRect, OnMsgUpdateRect) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateIsDelayed, OnMsgUpdateIsDelayed) IPC_MESSAGE_HANDLER(ViewHostMsg_HandleInputEvent_ACK, OnMsgInputEventAck) IPC_MESSAGE_HANDLER(ViewHostMsg_BeginSmoothScroll, OnMsgBeginSmoothScroll) IPC_MESSAGE_HANDLER(ViewHostMsg_SelectRange_ACK, OnMsgSelectRangeAck) IPC_MESSAGE_HANDLER(ViewHostMsg_Focus, OnMsgFocus) IPC_MESSAGE_HANDLER(ViewHostMsg_Blur, OnMsgBlur) IPC_MESSAGE_HANDLER(ViewHostMsg_HasTouchEventHandlers, OnMsgHasTouchEventHandlers) IPC_MESSAGE_HANDLER(ViewHostMsg_SetCursor, OnMsgSetCursor) IPC_MESSAGE_HANDLER(ViewHostMsg_TextInputStateChanged, OnMsgTextInputStateChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCompositionRangeChanged, OnMsgImeCompositionRangeChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_ImeCancelComposition, OnMsgImeCancelComposition) IPC_MESSAGE_HANDLER(ViewHostMsg_DidActivateAcceleratedCompositing, OnMsgDidActivateAcceleratedCompositing) IPC_MESSAGE_HANDLER(ViewHostMsg_LockMouse, OnMsgLockMouse) IPC_MESSAGE_HANDLER(ViewHostMsg_UnlockMouse, OnMsgUnlockMouse) IPC_MESSAGE_HANDLER(ViewHostMsg_ShowDisambiguationPopup, OnMsgShowDisambiguationPopup) #if defined(OS_MACOSX) IPC_MESSAGE_HANDLER(ViewHostMsg_PluginFocusChanged, OnMsgPluginFocusChanged) IPC_MESSAGE_HANDLER(ViewHostMsg_StartPluginIme, OnMsgStartPluginIme) IPC_MESSAGE_HANDLER(ViewHostMsg_AllocateFakePluginWindowHandle, OnAllocateFakePluginWindowHandle) IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyFakePluginWindowHandle, OnDestroyFakePluginWindowHandle) IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetIOSurface, OnAcceleratedSurfaceSetIOSurface) IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceSetTransportDIB, OnAcceleratedSurfaceSetTransportDIB) IPC_MESSAGE_HANDLER(ViewHostMsg_AcceleratedSurfaceBuffersSwapped, OnAcceleratedSurfaceBuffersSwapped) #endif #if defined(OS_ANDROID) IPC_MESSAGE_HANDLER(ViewHostMsg_UpdateFrameInfo, OnMsgUpdateFrameInfo) #endif #if defined(TOOLKIT_GTK) IPC_MESSAGE_HANDLER(ViewHostMsg_CreatePluginContainer, OnMsgCreatePluginContainer) IPC_MESSAGE_HANDLER(ViewHostMsg_DestroyPluginContainer, OnMsgDestroyPluginContainer) #endif #if defined(OS_WIN) IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowCreated, OnWindowlessPluginDummyWindowCreated) IPC_MESSAGE_HANDLER(ViewHostMsg_WindowlessPluginDummyWindowDestroyed, OnWindowlessPluginDummyWindowDestroyed) #endif #if defined(OS_CHROMEOS) // http://crbug.com/162981 IPC_MESSAGE_HANDLER(ViewHostMsg_GetWindowRect, OnMsgGetWindowRect) IPC_MESSAGE_HANDLER(ViewHostMsg_GetRootWindowRect, OnMsgGetRootWindowRect) #endif IPC_MESSAGE_UNHANDLED(handled = false) IPC_END_MESSAGE_MAP_EX() if (!msg_is_ok) { RecordAction(UserMetricsAction(""BadMessageTerminate_RWH"")); GetProcess()->ReceivedBadMessage(); } return handled; } ",0 " void ClientUsageTracker::GetCachedOrigins(std::set* origins) const { DCHECK(origins); for (HostUsageMap::const_iterator host_iter = cached_usage_.begin(); host_iter != cached_usage_.end(); host_iter++) { const UsageMap& origin_map = host_iter->second; for (UsageMap::const_iterator origin_iter = origin_map.begin(); origin_iter != origin_map.end(); origin_iter++) { origins->insert(origin_iter->first); } } } ",0 "static int csnmp_config_add_data_instance(data_definition_t *dd, oconfig_item_t *ci) { char buffer[DATA_MAX_NAME_LEN]; int status; status = cf_util_get_string_buffer(ci, buffer, sizeof(buffer)); if (status != 0) return status; if (dd->is_table) { /* Instance is an OID */ dd->instance.oid.oid_len = MAX_OID_LEN; if (!read_objid(buffer, dd->instance.oid.oid, &dd->instance.oid.oid_len)) { ERROR(""snmp plugin: read_objid (%s) failed."", buffer); return (-1); } } else { /* Instance is a simple string */ sstrncpy(dd->instance.string, buffer, sizeof(dd->instance.string)); } return (0); } /* int csnmp_config_add_data_instance */ ",0 "ancillary(const char *name) { return PNG_CHUNK_ANCILLARY(PNG_U32(name[0], name[1], name[2], name[3])); } ",0 "void BubbleManager::RemoveBubbleManagerObserver( BubbleManagerObserver* observer) { observers_.RemoveObserver(observer); } ",0 "dtls1_process_buffered_records(SSL *s) { pitem *item; item = pqueue_peek(s->d1->unprocessed_rcds.q); if (item) { /* Check if epoch is current. */ if (s->d1->unprocessed_rcds.epoch != s->d1->r_epoch) return(1); /* Nothing to do. */ /* Process all the records. */ while (pqueue_peek(s->d1->unprocessed_rcds.q)) { dtls1_get_unprocessed_record(s); if ( ! dtls1_process_record(s)) return(0); dtls1_buffer_record(s, &(s->d1->processed_rcds), s->s3->rrec.seq_num); } } /* sync epoch numbers once all the unprocessed records * have been processed */ s->d1->processed_rcds.epoch = s->d1->r_epoch; s->d1->unprocessed_rcds.epoch = s->d1->r_epoch + 1; return(1); } ",0 "int nfs4_proc_setclientid_confirm(struct nfs_client *clp, struct nfs4_setclientid_res *arg, struct rpc_cred *cred) { struct nfs_fsinfo fsinfo; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETCLIENTID_CONFIRM], .rpc_argp = arg, .rpc_resp = &fsinfo, .rpc_cred = cred, }; unsigned long now; int status; dprintk(""NFS call setclientid_confirm auth=%s, (client ID %llx)\n"", clp->cl_rpcclient->cl_auth->au_ops->au_name, clp->cl_clientid); now = jiffies; status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT); if (status == 0) { spin_lock(&clp->cl_lock); clp->cl_lease_time = fsinfo.lease_time * HZ; clp->cl_last_renewal = now; spin_unlock(&clp->cl_lock); } dprintk(""NFS reply setclientid_confirm: %d\n"", status); return status; } ",0 "PHP_METHOD(Phar, startBuffering) { PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters_none() == FAILURE) { return; } phar_obj->arc.archive->donotflush = 1; } ",0 "static void customGetterLongAttributeAttributeSetter(v8::Local jsValue, const v8::PropertyCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::SetterContext, ""customGetterLongAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState); imp->setCustomGetterLongAttribute(cppValue); } ",0 "vrrp_gglobal_tracking_handler(__attribute__((unused)) vector_t *strvec) { vrrp_sgroup_t *vgroup = LIST_TAIL_DATA(vrrp_data->vrrp_sync_group); report_config_error(CONFIG_GENERAL_ERROR, ""(%s) global_tracking is deprecated. Use track_interface/script/file on the sync group"", vgroup->gname); vgroup->sgroup_tracking_weight = true; } ",0 "bool ATSParser::Program::switchPIDs(const Vector &infos) { bool success = false; if (mStreams.size() == infos.size()) { size_t i; KeyedVector > oldType2PIDs, newType2PIDs; for (i = 0; i < mStreams.size(); ++i) { ssize_t index = oldType2PIDs.indexOfKey(mStreams[i]->type()); if (index < 0) { oldType2PIDs.add(mStreams[i]->type(), Vector()); } oldType2PIDs.editValueFor(mStreams[i]->type()).push_back(mStreams[i]->pid()); } for (i = 0; i < infos.size(); ++i) { ssize_t index = newType2PIDs.indexOfKey(infos[i].mType); if (index < 0) { newType2PIDs.add(infos[i].mType, Vector()); } newType2PIDs.editValueFor(infos[i].mType).push_back(infos[i].mPID); } if (oldType2PIDs.size() == newType2PIDs.size()) { success = true; for (i = 0; i < oldType2PIDs.size(); ++i) { if (oldType2PIDs.keyAt(i) != newType2PIDs.keyAt(i) || oldType2PIDs[i].size() != newType2PIDs[i].size()) { success = false; break; } } } if (success) { KeyedVector > temp; for (i = 0; i < mStreams.size(); ++i) { temp.add(mStreams.keyAt(i), mStreams.editValueAt(i)); } mStreams.clear(); for (i = 0; i < temp.size(); ++i) { ssize_t index = newType2PIDs.indexOfKey(temp[i]->type()); if (index < 0) { return false; } Vector &newPIDs = newType2PIDs.editValueAt(index); if (newPIDs.isEmpty()) { return false; } Vector::iterator it = newPIDs.begin(); temp.editValueAt(i)->setPID(*it); mStreams.add(temp[i]->pid(), temp.editValueAt(i)); newPIDs.erase(it); } } } return success; } ",0 " virtual ~PowerPopupView() { } ",0 "void WebContentsImpl::SetBrowserPluginGuest(BrowserPluginGuest* guest) { CHECK(!browser_plugin_guest_); browser_plugin_guest_.reset(guest); } ",0 " bool testToStringCharsRequiredHelper(const wchar_t * text) { UriParserStateW state; UriUriW uri; state.uri = &uri; int res = uriParseUriW(&state, text); if (res != 0) { uriFreeUriMembersW(&uri); return false; } int charsRequired; if (uriToStringCharsRequiredW(&uri, &charsRequired) != 0) { uriFreeUriMembersW(&uri); return false; } EXPECT_EQ(charsRequired, wcslen(text)); wchar_t * buffer = new wchar_t[charsRequired + 1]; if (uriToStringW(buffer, &uri, charsRequired + 1, NULL) != 0) { uriFreeUriMembersW(&uri); delete [] buffer; return false; } if (uriToStringW(buffer, &uri, charsRequired, NULL) == 0) { uriFreeUriMembersW(&uri); delete [] buffer; return false; } uriFreeUriMembersW(&uri); delete [] buffer; return true; } ",0 "static v8::Handle strawberryAttrGetter(v8::Local name, const v8::AccessorInfo& info) { INC_STATS(""DOM.TestObj.strawberry._get""); TestObj* imp = V8TestObj::toNative(info.Holder()); return v8::Integer::New(imp->blueberry()); } ",0 "HRESULT CGaiaCredentialBase::OnUserAuthenticated(BSTR authentication_info, BSTR* status_text) { USES_CONVERSION; DCHECK(status_text); logon_ui_process_ = INVALID_HANDLE_VALUE; std::string json_string; base::UTF16ToUTF8(OLE2CW(authentication_info), ::SysStringLen(authentication_info), &json_string); std::unique_ptr properties = base::JSONReader::ReadDeprecated( json_string, base::JSON_ALLOW_TRAILING_COMMAS); if (!properties || !properties->is_dict()) { LOGFN(ERROR) << ""base::JSONReader::Read failed to translate to JSON""; *status_text = AllocErrorString(IDS_INVALID_UI_RESPONSE_BASE); return E_FAIL; } std::unique_ptr dict = base::DictionaryValue::From(std::move(properties)); HRESULT hr = ValidateResult(dict.get(), status_text); if (FAILED(hr)) { LOGFN(ERROR) << ""ValidateResult hr="" << putHR(hr); return hr; } hr = ValidateOrCreateUser(dict.get(), &domain_, &username_, &user_sid_, status_text); if (FAILED(hr)) { LOGFN(ERROR) << ""ValidateOrCreateUser hr="" << putHR(hr); return hr; } authentication_results_ = std::move(dict); password_ = ::SysAllocString( GetDictString(authentication_results_, kKeyPassword).c_str()); if (events_) events_->SetFieldInteractiveState(this, FID_SUBMIT, CPFIS_DISABLED); if (!AreCredentialsValid()) { DisplayPasswordField(IDS_PASSWORD_UPDATE_NEEDED_BASE); return S_FALSE; } result_status_ = STATUS_SUCCESS; return provider_->OnUserAuthenticated(static_cast(this), username_, password_, user_sid_, TRUE); } ",0 "static int hns_nic_init_affinity_mask(int q_num, int ring_idx, struct hnae_ring *ring, cpumask_t *mask) { int cpu; /* Diffrent irq banlance between 16core and 32core. * The cpu mask set by ring index according to the ring flag * which indicate the ring is tx or rx. */ if (q_num == num_possible_cpus()) { if (is_tx_ring(ring)) cpu = ring_idx; else cpu = ring_idx - q_num; } else { if (is_tx_ring(ring)) cpu = ring_idx * 2; else cpu = (ring_idx - q_num) * 2 + 1; } cpumask_clear(mask); cpumask_set_cpu(cpu, mask); return cpu; } ",0 "static void checkPtrmap( IntegrityCk *pCheck, /* Integrity check context */ Pgno iChild, /* Child page number */ u8 eType, /* Expected pointer map type */ Pgno iParent /* Expected pointer map parent page number */ ){ int rc; u8 ePtrmapType; Pgno iPtrmapParent; rc = ptrmapGet(pCheck->pBt, iChild, &ePtrmapType, &iPtrmapParent); if( rc!=SQLITE_OK ){ if( rc==SQLITE_NOMEM || rc==SQLITE_IOERR_NOMEM ) pCheck->mallocFailed = 1; checkAppendMsg(pCheck, ""Failed to read ptrmap key=%d"", iChild); return; } if( ePtrmapType!=eType || iPtrmapParent!=iParent ){ checkAppendMsg(pCheck, ""Bad ptr map entry key=%d expected=(%d,%d) got=(%d,%d)"", iChild, eType, iParent, ePtrmapType, iPtrmapParent); } } ",0 "static void xtea_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { u32 y, z, sum = 0; u32 limit = XTEA_DELTA * XTEA_ROUNDS; struct xtea_ctx *ctx = crypto_tfm_ctx(tfm); const __le32 *in = (const __le32 *)src; __le32 *out = (__le32 *)dst; y = le32_to_cpu(in[0]); z = le32_to_cpu(in[1]); while (sum != limit) { y += ((z << 4 ^ z >> 5) + z) ^ (sum + ctx->KEY[sum&3]); sum += XTEA_DELTA; z += ((y << 4 ^ y >> 5) + y) ^ (sum + ctx->KEY[sum>>11 &3]); } out[0] = cpu_to_le32(y); out[1] = cpu_to_le32(z); } ",0 "static void enforcedRangeUnsignedLongLongAttrAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectV8Internal::enforcedRangeUnsignedLongLongAttrAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "void WebsiteSettings::OnRevokeSSLErrorBypassButtonPressed() { DCHECK(chrome_ssl_host_state_delegate_); chrome_ssl_host_state_delegate_->RevokeUserAllowExceptionsHard( site_url().host()); did_revoke_user_ssl_decisions_ = true; } ",0 "bool SetCurrentDirectory(const FilePath& path) { base::ThreadRestrictions::AssertIOAllowed(); int ret = chdir(path.value().c_str()); return !ret; } ",0 "static unsigned int sock_poll(struct file *file, poll_table *wait) { struct socket *sock; /* * We can't return errors to poll, so it's either yes or no. */ sock = file->private_data; return sock->ops->poll(file, sock, wait); } ",0 "void RenderViewImpl::OnFindReplyAck() { if (queued_find_reply_message_.get()) { Send(queued_find_reply_message_.release()); } } ",0 "layer_resize(int layer, int x_size, int y_size) { int old_height; int old_width; struct map_tile* tile; int tile_width; int tile_height; struct map_tile* tilemap; struct map_trigger* trigger; struct map_zone* zone; int x, y, i; old_width = s_map->layers[layer].width; old_height = s_map->layers[layer].height; if (!(tilemap = malloc(x_size * y_size * sizeof(struct map_tile)))) return false; for (x = 0; x < x_size; ++x) { for (y = 0; y < y_size; ++y) { if (x < old_width && y < old_height) { tilemap[x + y * x_size] = s_map->layers[layer].tilemap[x + y * old_width]; } else { tile = &tilemap[x + y * x_size]; tile->frames_left = tileset_get_delay(s_map->tileset, 0); tile->tile_index = 0; } } } free(s_map->layers[layer].tilemap); s_map->layers[layer].tilemap = tilemap; s_map->layers[layer].width = x_size; s_map->layers[layer].height = y_size; tileset_get_size(s_map->tileset, &tile_width, &tile_height); s_map->width = 0; s_map->height = 0; for (i = 0; i < s_map->num_layers; ++i) { if (!s_map->layers[i].is_parallax) { s_map->width = fmax(s_map->width, s_map->layers[i].width * tile_width); s_map->height = fmax(s_map->height, s_map->layers[i].height * tile_height); } } for (i = (int)vector_len(s_map->zones) - 1; i >= 0; --i) { zone = vector_get(s_map->zones, i); if (zone->bounds.x1 >= s_map->width || zone->bounds.y1 >= s_map->height) vector_remove(s_map->zones, i); else { if (zone->bounds.x2 > s_map->width) zone->bounds.x2 = s_map->width; if (zone->bounds.y2 > s_map->height) zone->bounds.y2 = s_map->height; } } for (i = (int)vector_len(s_map->triggers) - 1; i >= 0; --i) { trigger = vector_get(s_map->triggers, i); if (trigger->x >= s_map->width || trigger->y >= s_map->height) vector_remove(s_map->triggers, i); } return true; } ",1 "static ssize_t ib_ucm_send_dreq(struct ib_ucm_file *file, const char __user *inbuf, int in_len, int out_len) { return ib_ucm_send_private_data(file, inbuf, in_len, ib_send_cm_dreq); } ",0 "int AwMainDelegate::RunProcess( const std::string& process_type, const content::MainFunctionParams& main_function_params) { if (process_type.empty()) { AwBrowserDependencyFactoryImpl::InstallInstance(); browser_runner_.reset(content::BrowserMainRunner::Create()); int exit_code = browser_runner_->Initialize(main_function_params); DCHECK_LT(exit_code, 0); g_allow_wait_in_ui_thread.Get().reset( new ScopedAllowWaitForLegacyWebViewApi); return 0; } return -1; } ",0 "static unsigned get_mmio_spte_access(u64 spte) { u64 mask = generation_mmio_spte_mask(MMIO_MAX_GEN) | shadow_mmio_mask; return (spte & ~mask) & ~PAGE_MASK; } ",0 "SYSCALL_DEFINE5(get_mempolicy, int __user *, policy, unsigned long __user *, nmask, unsigned long, maxnode, unsigned long, addr, unsigned long, flags) { int err; int uninitialized_var(pval); nodemask_t nodes; if (nmask != NULL && maxnode < MAX_NUMNODES) return -EINVAL; err = do_get_mempolicy(&pval, &nodes, addr, flags); if (err) return err; if (policy && put_user(pval, policy)) return -EFAULT; if (nmask) err = copy_nodes_to_user(nmask, maxnode, &nodes); return err; } ",0 "void NPN_InvalidateRect(NPP id, NPRect *invalidRect) { scoped_refptr plugin = FindInstance(id); DCHECK(plugin.get() != NULL); if (plugin.get() && plugin->webplugin()) { if (invalidRect) { #if defined(OS_WIN) if (!plugin->windowless()) { RECT rect = {0}; rect.left = invalidRect->left; rect.right = invalidRect->right; rect.top = invalidRect->top; rect.bottom = invalidRect->bottom; ::InvalidateRect(plugin->window_handle(), &rect, FALSE); return; } #endif gfx::Rect rect(invalidRect->left, invalidRect->top, invalidRect->right - invalidRect->left, invalidRect->bottom - invalidRect->top); plugin->webplugin()->InvalidateRect(rect); } else { plugin->webplugin()->Invalidate(); } } } ",0 "long ContentEncoding::ParseContentEncAESSettingsEntry( long long start, long long size, IMkvReader* pReader, ContentEncAESSettings* aes) { assert(pReader); assert(aes); long long pos = start; const long long stop = start + size; while (pos < stop) { long long id, size; const long status = ParseElementHeader(pReader, pos, stop, id, size); if (status < 0) // error return status; if (id == 0x7E8) { aes->cipher_mode = UnserializeUInt(pReader, pos, size); if (aes->cipher_mode != 1) return E_FILE_FORMAT_INVALID; } pos += size; // consume payload assert(pos <= stop); } return 0; } ",1 "int MemBackendImpl::CreateEntry(const std::string& key, Entry** entry, const CompletionCallback& callback) { std::pair create_result = entries_.insert(EntryMap::value_type(key, nullptr)); const bool did_insert = create_result.second; if (!did_insert) return net::ERR_FAILED; MemEntryImpl* cache_entry = new MemEntryImpl(weak_factory_.GetWeakPtr(), key, net_log_); create_result.first->second = cache_entry; *entry = cache_entry; return net::OK; } ",0 "get_schema_path(const char *name, const char *file) { const char *base = get_schema_root(); if(file) { return crm_strdup_printf(""%s/%s"", base, file); } return crm_strdup_printf(""%s/%s.rng"", base, name); } ",0 "void addReplyError(client *c, const char *err) { addReplyErrorLength(c,err,strlen(err)); } ",0 "static int check2ndT2(struct smb_hdr *pSMB, unsigned int maxBufSize) { struct smb_t2_rsp *pSMBt; int remaining; __u16 total_data_size, data_in_this_rsp; if (pSMB->Command != SMB_COM_TRANSACTION2) return 0; /* check for plausible wct, bcc and t2 data and parm sizes */ /* check for parm and data offset going beyond end of smb */ if (pSMB->WordCount != 10) { /* coalesce_t2 depends on this */ cFYI(1, ""invalid transact2 word count""); return -EINVAL; } pSMBt = (struct smb_t2_rsp *)pSMB; total_data_size = get_unaligned_le16(&pSMBt->t2_rsp.TotalDataCount); data_in_this_rsp = get_unaligned_le16(&pSMBt->t2_rsp.DataCount); remaining = total_data_size - data_in_this_rsp; if (remaining == 0) return 0; else if (remaining < 0) { cFYI(1, ""total data %d smaller than data in frame %d"", total_data_size, data_in_this_rsp); return -EINVAL; } else { cFYI(1, ""missing %d bytes from transact2, check next response"", remaining); if (total_data_size > maxBufSize) { cERROR(1, ""TotalDataSize %d is over maximum buffer %d"", total_data_size, maxBufSize); return -EINVAL; } return remaining; } } ",0 "bool XSSAuditor::filterObjectToken(const FilterTokenRequest& request) { ASSERT(request.token.type() == HTMLToken::StartTag); ASSERT(hasName(request.token, objectTag)); bool didBlockScript = false; if (isContainedInRequest(decodedSnippetForName(request))) { didBlockScript |= eraseAttributeIfInjected(request, dataAttr, blankURL().string(), SrcLikeAttribute); didBlockScript |= eraseAttributeIfInjected(request, typeAttr); didBlockScript |= eraseAttributeIfInjected(request, classidAttr); } return didBlockScript; } ",0 "BOOLEAN ParaNdis_IsSendPossible(PARANDIS_ADAPTER *pContext) { BOOLEAN b; b = !pContext->bSurprizeRemoved && pContext->bConnected && pContext->SendState == srsEnabled; return b; } ",0 "int drm_mode_create_dvi_i_properties(struct drm_device *dev) { struct drm_property *dvi_i_selector; struct drm_property *dvi_i_subconnector; int i; if (dev->mode_config.dvi_i_select_subconnector_property) return 0; dvi_i_selector = drm_property_create(dev, DRM_MODE_PROP_ENUM, ""select subconnector"", ARRAY_SIZE(drm_dvi_i_select_enum_list)); for (i = 0; i < ARRAY_SIZE(drm_dvi_i_select_enum_list); i++) drm_property_add_enum(dvi_i_selector, i, drm_dvi_i_select_enum_list[i].type, drm_dvi_i_select_enum_list[i].name); dev->mode_config.dvi_i_select_subconnector_property = dvi_i_selector; dvi_i_subconnector = drm_property_create(dev, DRM_MODE_PROP_ENUM | DRM_MODE_PROP_IMMUTABLE, ""subconnector"", ARRAY_SIZE(drm_dvi_i_subconnector_enum_list)); for (i = 0; i < ARRAY_SIZE(drm_dvi_i_subconnector_enum_list); i++) drm_property_add_enum(dvi_i_subconnector, i, drm_dvi_i_subconnector_enum_list[i].type, drm_dvi_i_subconnector_enum_list[i].name); dev->mode_config.dvi_i_subconnector_property = dvi_i_subconnector; return 0; } ",0 "int BlobURLRequestJob::GetResponseCode() const { if (!response_info_.get()) return -1; return response_info_->headers->response_code(); } ",0 "get_param_option(char *name) { struct param_ptr *p; p = search_param(name); return p ? to_str(p)->ptr : NULL; } ",0 "NOINLINE void ResetThread_CACHE( std::unique_ptr thread) { volatile int inhibit_comdat = __LINE__; ALLOW_UNUSED_LOCAL(inhibit_comdat); thread.reset(); } ",0 "void HTMLFormControlElement::setFormMethod(const AtomicString& value) { setAttribute(kFormmethodAttr, value); } ",0 "static void VoidMethodNullableSequenceLongArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""voidMethodNullableSequenceLongArg""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); if (UNLIKELY(info.Length() < 1)) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } base::Optional> long_sequence_arg; if (!info[0]->IsNullOrUndefined()) { long_sequence_arg = NativeValueTraits>::NativeValue(info.GetIsolate(), info[0], exception_state); if (exception_state.HadException()) return; } impl->voidMethodNullableSequenceLongArg(long_sequence_arg); } ",0 "static struct sock *x25_make_new(struct sock *osk) { struct sock *sk = NULL; struct x25_sock *x25, *ox25; if (osk->sk_type != SOCK_SEQPACKET) goto out; if ((sk = x25_alloc_socket(sock_net(osk))) == NULL) goto out; x25 = x25_sk(sk); sk->sk_type = osk->sk_type; sk->sk_priority = osk->sk_priority; sk->sk_protocol = osk->sk_protocol; sk->sk_rcvbuf = osk->sk_rcvbuf; sk->sk_sndbuf = osk->sk_sndbuf; sk->sk_state = TCP_ESTABLISHED; sk->sk_backlog_rcv = osk->sk_backlog_rcv; sock_copy_flags(sk, osk); ox25 = x25_sk(osk); x25->t21 = ox25->t21; x25->t22 = ox25->t22; x25->t23 = ox25->t23; x25->t2 = ox25->t2; x25->flags = ox25->flags; x25->facilities = ox25->facilities; x25->dte_facilities = ox25->dte_facilities; x25->cudmatchlength = ox25->cudmatchlength; clear_bit(X25_INTERRUPT_FLAG, &x25->flags); x25_init_timers(sk); out: return sk; } ",0 " create_response(const char *nurl, const char *method, unsigned int *rp_code) { char *page, *fpath; struct MHD_Response *resp = NULL; if (!strncmp(nurl, URL_BASE_API_1_1, strlen(URL_BASE_API_1_1))) { resp = create_response_api(nurl, method, rp_code); } else { fpath = get_path(nurl, server_data.www_dir); resp = create_response_file(nurl, method, rp_code, fpath); free(fpath); } } ",1 "IW_IMPL(void) iw_get_output_image(struct iw_context *ctx, struct iw_image *img) { int k; iw_zeromem(img,sizeof(struct iw_image)); img->width = ctx->optctx.width; img->height = ctx->optctx.height; img->imgtype = ctx->optctx.imgtype; img->sampletype = ctx->img2.sampletype; img->bit_depth = ctx->optctx.bit_depth; img->pixels = (iw_byte*)ctx->optctx.pixelsptr; img->bpr = ctx->optctx.bpr; img->density_code = ctx->img2.density_code; img->density_x = ctx->img2.density_x; img->density_y = ctx->img2.density_y; img->rendering_intent = ctx->img2.rendering_intent; img->has_bkgdlabel = ctx->optctx.has_bkgdlabel; for(k=0;k<4;k++) { if(ctx->optctx.bit_depth==8) { img->bkgdlabel.c[k] = ((double)ctx->optctx.bkgdlabel[k])/255.0; } else { img->bkgdlabel.c[k] = ((double)ctx->optctx.bkgdlabel[k])/65535.0; } } img->has_colorkey_trns = ctx->optctx.has_colorkey_trns; img->colorkey[0] = ctx->optctx.colorkey[0]; img->colorkey[1] = ctx->optctx.colorkey[1]; img->colorkey[2] = ctx->optctx.colorkey[2]; if(ctx->reduced_output_maxcolor_flag) { img->reduced_maxcolors = 1; if(IW_IMGTYPE_IS_GRAY(img->imgtype)) { img->maxcolorcode[IW_CHANNELTYPE_GRAY] = ctx->img2_ci[0].maxcolorcode_int; if(IW_IMGTYPE_HAS_ALPHA(img->imgtype)) { img->maxcolorcode[IW_CHANNELTYPE_ALPHA] = ctx->img2_ci[1].maxcolorcode_int; } } else { img->maxcolorcode[IW_CHANNELTYPE_RED] = ctx->img2_ci[0].maxcolorcode_int; img->maxcolorcode[IW_CHANNELTYPE_GREEN] = ctx->img2_ci[1].maxcolorcode_int; img->maxcolorcode[IW_CHANNELTYPE_BLUE] = ctx->img2_ci[2].maxcolorcode_int; if(IW_IMGTYPE_HAS_ALPHA(img->imgtype)) { img->maxcolorcode[IW_CHANNELTYPE_ALPHA] = ctx->img2_ci[3].maxcolorcode_int; } } } } ",0 "tar_sparse_init (struct tar_sparse_file *file) { memset (file, 0, sizeof *file); if (!sparse_select_optab (file)) return false; if (file->optab->init) return file->optab->init (file); return true; } ",0 "static void r_bin_mdmp_free_pe32_bin(void *pe_bin_) { struct Pe32_r_bin_mdmp_pe_bin *pe_bin = pe_bin_; if (pe_bin) { sdb_free (pe_bin->bin->kv); Pe32_r_bin_pe_free (pe_bin->bin); R_FREE (pe_bin); } } ",0 "static void __net_exit dev_proc_net_exit(struct net *net) { wext_proc_exit(net); proc_net_remove(net, ""ptype""); proc_net_remove(net, ""softnet_stat""); proc_net_remove(net, ""dev""); } ",0 "get_page_geometry (char *name, struct pagedef *page) { char *ptr; int n; for (ptr = name; *ptr; ptr++) *ptr = (char)tolower((int)*ptr); for (n = 0; n < MAX_PAPERNAMES; n++) { if (strcmp(name, PaperTable[n].name) == 0) { page->width = PaperTable[n].width; page->length = PaperTable[n].length; strncpy (page->name, PaperTable[n].name, 15); page->name[15] = '\0'; return (0); } } return (1); } ",0 "tgs_parse_request(krb5_context context, krb5_kdc_configuration *config, KDC_REQ_BODY *b, const PA_DATA *tgs_req, hdb_entry_ex **krbtgt, krb5_enctype *krbtgt_etype, krb5_ticket **ticket, const char **e_text, const char *from, const struct sockaddr *from_addr, time_t **csec, int **cusec, AuthorizationData **auth_data, krb5_keyblock **replykey, int *rk_is_subkey) { static char failed[] = """"; krb5_ap_req ap_req; krb5_error_code ret; krb5_principal princ; krb5_auth_context ac = NULL; krb5_flags ap_req_options; krb5_flags verify_ap_req_flags; krb5_crypto crypto; krb5uint32 krbtgt_kvno; /* kvno used for the PA-TGS-REQ AP-REQ Ticket */ krb5uint32 krbtgt_kvno_try; int kvno_search_tries = 4; /* number of kvnos to try when tkt_vno == 0 */ const Keys *krbtgt_keys;/* keyset for TGT tkt_vno */ Key *tkey; krb5_keyblock *subkey = NULL; unsigned usage; *auth_data = NULL; *csec = NULL; *cusec = NULL; *replykey = NULL; memset(&ap_req, 0, sizeof(ap_req)); ret = krb5_decode_ap_req(context, &tgs_req->padata_value, &ap_req); if(ret){ const char *msg = krb5_get_error_message(context, ret); kdc_log(context, config, 0, ""Failed to decode AP-REQ: %s"", msg); krb5_free_error_message(context, msg); goto out; } if(!get_krbtgt_realm(&ap_req.ticket.sname)){ /* XXX check for ticket.sname == req.sname */ kdc_log(context, config, 0, ""PA-DATA is not a ticket-granting ticket""); ret = KRB5KDC_ERR_POLICY; /* ? */ goto out; } _krb5_principalname2krb5_principal(context, &princ, ap_req.ticket.sname, ap_req.ticket.realm); krbtgt_kvno = ap_req.ticket.enc_part.kvno ? *ap_req.ticket.enc_part.kvno : 0; ret = _kdc_db_fetch(context, config, princ, HDB_F_GET_KRBTGT, &krbtgt_kvno, NULL, krbtgt); if (ret == HDB_ERR_NOT_FOUND_HERE) { /* XXX Factor out this unparsing of the same princ all over */ char *p; ret = krb5_unparse_name(context, princ, &p); if (ret != 0) p = failed; krb5_free_principal(context, princ); kdc_log(context, config, 5, ""Ticket-granting ticket account %s does not have secrets at "" ""this KDC, need to proxy"", p); if (ret == 0) free(p); ret = HDB_ERR_NOT_FOUND_HERE; goto out; } else if (ret == HDB_ERR_KVNO_NOT_FOUND) { char *p; ret = krb5_unparse_name(context, princ, &p); if (ret != 0) p = failed; krb5_free_principal(context, princ); kdc_log(context, config, 5, ""Ticket-granting ticket account %s does not have keys for "" ""kvno %d at this KDC"", p, krbtgt_kvno); if (ret == 0) free(p); ret = HDB_ERR_KVNO_NOT_FOUND; goto out; } else if (ret == HDB_ERR_NO_MKEY) { char *p; ret = krb5_unparse_name(context, princ, &p); if (ret != 0) p = failed; krb5_free_principal(context, princ); kdc_log(context, config, 5, ""Missing master key for decrypting keys for ticket-granting "" ""ticket account %s with kvno %d at this KDC"", p, krbtgt_kvno); if (ret == 0) free(p); ret = HDB_ERR_KVNO_NOT_FOUND; goto out; } else if (ret) { const char *msg = krb5_get_error_message(context, ret); char *p; ret = krb5_unparse_name(context, princ, &p); if (ret != 0) p = failed; krb5_free_principal(context, princ); kdc_log(context, config, 0, ""Ticket-granting ticket not found in database: %s"", msg); krb5_free_error_message(context, msg); if (ret == 0) free(p); ret = KRB5KRB_AP_ERR_NOT_US; goto out; } krbtgt_kvno_try = krbtgt_kvno ? krbtgt_kvno : (*krbtgt)->entry.kvno; *krbtgt_etype = ap_req.ticket.enc_part.etype; next_kvno: krbtgt_keys = hdb_kvno2keys(context, &(*krbtgt)->entry, krbtgt_kvno_try); ret = hdb_enctype2key(context, &(*krbtgt)->entry, krbtgt_keys, ap_req.ticket.enc_part.etype, &tkey); if (ret && krbtgt_kvno == 0 && kvno_search_tries > 0) { kvno_search_tries--; krbtgt_kvno_try--; goto next_kvno; } else if (ret) { char *str = NULL, *p = NULL; krb5_enctype_to_string(context, ap_req.ticket.enc_part.etype, &str); krb5_unparse_name(context, princ, &p); kdc_log(context, config, 0, ""No server key with enctype %s found for %s"", str ? str : """", p ? p : """"); free(str); free(p); ret = KRB5KRB_AP_ERR_BADKEYVER; goto out; } if (b->kdc_options.validate) verify_ap_req_flags = KRB5_VERIFY_AP_REQ_IGNORE_INVALID; else verify_ap_req_flags = 0; ret = krb5_verify_ap_req2(context, &ac, &ap_req, princ, &tkey->key, verify_ap_req_flags, &ap_req_options, ticket, KRB5_KU_TGS_REQ_AUTH); if (ret == KRB5KRB_AP_ERR_BAD_INTEGRITY && kvno_search_tries > 0) { kvno_search_tries--; krbtgt_kvno_try--; goto next_kvno; } krb5_free_principal(context, princ); if(ret) { const char *msg = krb5_get_error_message(context, ret); kdc_log(context, config, 0, ""Failed to verify AP-REQ: %s"", msg); krb5_free_error_message(context, msg); goto out; } { krb5_authenticator auth; ret = krb5_auth_con_getauthenticator(context, ac, &auth); if (ret == 0) { *csec = malloc(sizeof(**csec)); if (*csec == NULL) { krb5_free_authenticator(context, &auth); kdc_log(context, config, 0, ""malloc failed""); goto out; } **csec = auth->ctime; *cusec = malloc(sizeof(**cusec)); if (*cusec == NULL) { krb5_free_authenticator(context, &auth); kdc_log(context, config, 0, ""malloc failed""); goto out; } **cusec = auth->cusec; krb5_free_authenticator(context, &auth); } } ret = tgs_check_authenticator(context, config, ac, b, e_text, &(*ticket)->ticket.key); if (ret) { krb5_auth_con_free(context, ac); goto out; } usage = KRB5_KU_TGS_REQ_AUTH_DAT_SUBKEY; *rk_is_subkey = 1; ret = krb5_auth_con_getremotesubkey(context, ac, &subkey); if(ret){ const char *msg = krb5_get_error_message(context, ret); krb5_auth_con_free(context, ac); kdc_log(context, config, 0, ""Failed to get remote subkey: %s"", msg); krb5_free_error_message(context, msg); goto out; } if(subkey == NULL){ usage = KRB5_KU_TGS_REQ_AUTH_DAT_SESSION; *rk_is_subkey = 0; ret = krb5_auth_con_getkey(context, ac, &subkey); if(ret) { const char *msg = krb5_get_error_message(context, ret); krb5_auth_con_free(context, ac); kdc_log(context, config, 0, ""Failed to get session key: %s"", msg); krb5_free_error_message(context, msg); goto out; } } if(subkey == NULL){ krb5_auth_con_free(context, ac); kdc_log(context, config, 0, ""Failed to get key for enc-authorization-data""); ret = KRB5KRB_AP_ERR_BAD_INTEGRITY; /* ? */ goto out; } *replykey = subkey; if (b->enc_authorization_data) { krb5_data ad; ret = krb5_crypto_init(context, subkey, 0, &crypto); if (ret) { const char *msg = krb5_get_error_message(context, ret); krb5_auth_con_free(context, ac); kdc_log(context, config, 0, ""krb5_crypto_init failed: %s"", msg); krb5_free_error_message(context, msg); goto out; } ret = krb5_decrypt_EncryptedData (context, crypto, usage, b->enc_authorization_data, &ad); krb5_crypto_destroy(context, crypto); if(ret){ krb5_auth_con_free(context, ac); kdc_log(context, config, 0, ""Failed to decrypt enc-authorization-data""); ret = KRB5KRB_AP_ERR_BAD_INTEGRITY; /* ? */ goto out; } ALLOC(*auth_data); if (*auth_data == NULL) { krb5_auth_con_free(context, ac); ret = KRB5KRB_AP_ERR_BAD_INTEGRITY; /* ? */ goto out; } ret = decode_AuthorizationData(ad.data, ad.length, *auth_data, NULL); if(ret){ krb5_auth_con_free(context, ac); free(*auth_data); *auth_data = NULL; kdc_log(context, config, 0, ""Failed to decode authorization data""); ret = KRB5KRB_AP_ERR_BAD_INTEGRITY; /* ? */ goto out; } } krb5_auth_con_free(context, ac); out: free_AP_REQ(&ap_req); return ret; } ",0 "static PHP_FUNCTION(preg_grep) { char *regex; /* Regular expression */ int regex_len; zval *input; /* Input array */ long flags = 0; /* Match control flags */ pcre_cache_entry *pce; /* Compiled regular expression */ /* Get arguments and do error checking */ if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""sa|l"", ®ex, ®ex_len, &input, &flags) == FAILURE) { return; } /* Compile regex or get it from cache. */ if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) { RETURN_FALSE; } php_pcre_grep_impl(pce, input, return_value, flags TSRMLS_CC); } ",0 "static int snd_seq_open(struct inode *inode, struct file *file) { int c, mode; /* client id */ struct snd_seq_client *client; struct snd_seq_user_client *user; int err; err = nonseekable_open(inode, file); if (err < 0) return err; if (mutex_lock_interruptible(®ister_mutex)) return -ERESTARTSYS; client = seq_create_client1(-1, SNDRV_SEQ_DEFAULT_EVENTS); if (client == NULL) { mutex_unlock(®ister_mutex); return -ENOMEM; /* failure code */ } mode = snd_seq_file_flags(file); if (mode & SNDRV_SEQ_LFLG_INPUT) client->accept_input = 1; if (mode & SNDRV_SEQ_LFLG_OUTPUT) client->accept_output = 1; user = &client->data.user; user->fifo = NULL; user->fifo_pool_size = 0; if (mode & SNDRV_SEQ_LFLG_INPUT) { user->fifo_pool_size = SNDRV_SEQ_DEFAULT_CLIENT_EVENTS; user->fifo = snd_seq_fifo_new(user->fifo_pool_size); if (user->fifo == NULL) { seq_free_client1(client); kfree(client); mutex_unlock(®ister_mutex); return -ENOMEM; } } usage_alloc(&client_usage, 1); client->type = USER_CLIENT; mutex_unlock(®ister_mutex); c = client->number; file->private_data = client; /* fill client data */ user->file = file; sprintf(client->name, ""Client-%d"", c); client->data.user.owner = get_pid(task_pid(current)); /* make others aware this new client */ snd_seq_system_client_ev_client_start(c); return 0; } ",0 "ofputil_pull_ofp11_match(struct ofpbuf *buf, const struct tun_table *tun_table, const struct vl_mff_map *vl_mff_map, struct match *match, uint16_t *padded_match_len) { struct ofp11_match_header *omh = buf->data; uint16_t match_len; if (buf->size < sizeof *omh) { return OFPERR_OFPBMC_BAD_LEN; } match_len = ntohs(omh->length); switch (ntohs(omh->type)) { case OFPMT_STANDARD: { struct ofp11_match *om; if (match_len != sizeof *om || buf->size < sizeof *om) { return OFPERR_OFPBMC_BAD_LEN; } om = ofpbuf_pull(buf, sizeof *om); if (padded_match_len) { *padded_match_len = match_len; } return ofputil_match_from_ofp11_match(om, match); } case OFPMT_OXM: if (padded_match_len) { *padded_match_len = ROUND_UP(match_len, 8); } return oxm_pull_match(buf, tun_table, vl_mff_map, match); default: return OFPERR_OFPBMC_BAD_TYPE; } } ",0 "static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb, struct net_device *dev) { if (!pskb_inet_may_pull(skb)) goto tx_err; switch (skb->protocol) { case htons(ETH_P_IP): sit_tunnel_xmit__(skb, dev, IPPROTO_IPIP); break; case htons(ETH_P_IPV6): ipip6_tunnel_xmit(skb, dev); break; #if IS_ENABLED(CONFIG_MPLS) case htons(ETH_P_MPLS_UC): sit_tunnel_xmit__(skb, dev, IPPROTO_MPLS); break; #endif default: goto tx_err; } return NETDEV_TX_OK; tx_err: dev->stats.tx_errors++; kfree_skb(skb); return NETDEV_TX_OK; } ",0 "static int __init dm_multipath_init(void) { int r; /* allocate a slab for the dm_ios */ _mpio_cache = KMEM_CACHE(dm_mpath_io, 0); if (!_mpio_cache) return -ENOMEM; r = dm_register_target(&multipath_target); if (r < 0) { DMERR(""register failed %d"", r); kmem_cache_destroy(_mpio_cache); return -EINVAL; } kmultipathd = alloc_workqueue(""kmpathd"", WQ_MEM_RECLAIM, 0); if (!kmultipathd) { DMERR(""failed to create workqueue kmpathd""); dm_unregister_target(&multipath_target); kmem_cache_destroy(_mpio_cache); return -ENOMEM; } /* * A separate workqueue is used to handle the device handlers * to avoid overloading existing workqueue. Overloading the * old workqueue would also create a bottleneck in the * path of the storage hardware device activation. */ kmpath_handlerd = alloc_ordered_workqueue(""kmpath_handlerd"", WQ_MEM_RECLAIM); if (!kmpath_handlerd) { DMERR(""failed to create workqueue kmpath_handlerd""); destroy_workqueue(kmultipathd); dm_unregister_target(&multipath_target); kmem_cache_destroy(_mpio_cache); return -ENOMEM; } DMINFO(""version %u.%u.%u loaded"", multipath_target.version[0], multipath_target.version[1], multipath_target.version[2]); return r; } ",0 "void DefaultTabHandler::CreateHistoricalTab(TabContentsWrapper* contents) { delegate_->AsBrowser()->CreateHistoricalTab(contents); } ",0 "static int load_dh_params(SSL_CTX *ctx, char *file) { DH *ret = 0; BIO *bio; if ((bio = BIO_new_file(file, ""r"")) == NULL) { spice_warning(""Could not open DH file""); return -1; } ret = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); BIO_free(bio); if (ret == 0) { spice_warning(""Could not read DH params""); return -1; } if (SSL_CTX_set_tmp_dh(ctx, ret) < 0) { spice_warning(""Could not set DH params""); return -1; } return 0; } ",0 "void InProcessBrowserTest::AddTabAtIndexToBrowser( Browser* browser, int index, const GURL& url, content::PageTransition transition) { browser::NavigateParams params(browser, url, transition); params.tabstrip_index = index; params.disposition = NEW_FOREGROUND_TAB; browser::Navigate(¶ms); } ",0 "void BrowserRenderProcessHost::AppendRendererCommandLine( CommandLine* command_line, bool* has_cmd_prefix) const { if (logging::DialogsAreSuppressed()) command_line->AppendSwitch(switches::kNoErrorDialogs); command_line->AppendSwitchWithValue(switches::kProcessType, switches::kRendererProcess); const CommandLine& browser_command_line = *CommandLine::ForCurrentProcess(); PropogateBrowserCommandLineToRenderer(browser_command_line, command_line); const std::string locale = g_browser_process->GetApplicationLocale(); command_line->AppendSwitchWithValue(switches::kLang, ASCIIToWide(locale)); std::string field_trial_states; FieldTrialList::StatesToString(&field_trial_states); if (!field_trial_states.empty()) { command_line->AppendSwitchWithValue(switches::kForceFieldTestNameAndValue, ASCIIToWide(field_trial_states)); } #if defined(OS_POSIX) *has_cmd_prefix = browser_command_line.HasSwitch(switches::kRendererCmdPrefix); if (*has_cmd_prefix) { const std::wstring prefix = browser_command_line.GetSwitchValue(switches::kRendererCmdPrefix); command_line->PrependWrapper(prefix); } #else *has_cmd_prefix = false; #endif // defined(OS_POSIX) ChildProcessHost::SetCrashReporterCommandLine(command_line); const std::wstring& profile_path = browser_command_line.GetSwitchValue(switches::kUserDataDir); if (!profile_path.empty()) command_line->AppendSwitchWithValue(switches::kUserDataDir, profile_path); } ",0 "static int vmx_restore_vmx_ept_vpid_cap(struct vcpu_vmx *vmx, u64 data) { u64 vmx_ept_vpid_cap; vmx_ept_vpid_cap = vmx_control_msr(vmx->nested.nested_vmx_ept_caps, vmx->nested.nested_vmx_vpid_caps); /* Every bit is either reserved or a feature bit. */ if (!is_bitwise_subset(vmx_ept_vpid_cap, data, -1ULL)) return -EINVAL; vmx->nested.nested_vmx_ept_caps = data; vmx->nested.nested_vmx_vpid_caps = data >> 32; return 0; } ",0 "static void muscle_load_single_acl(sc_file_t* file, int operation, unsigned short acl) { int key; /* Everybody by default.... */ sc_file_add_acl_entry(file, operation, SC_AC_NONE, 0); if(acl == 0xFFFF) { sc_file_add_acl_entry(file, operation, SC_AC_NEVER, 0); return; } for(key = 0; key < 16; key++) { if(acl >> key & 1) { sc_file_add_acl_entry(file, operation, SC_AC_CHV, key); } } } ",0 "static void ndisc_recv_na(struct sk_buff *skb) { struct nd_msg *msg = (struct nd_msg *)skb_transport_header(skb); struct in6_addr *saddr = &ipv6_hdr(skb)->saddr; const struct in6_addr *daddr = &ipv6_hdr(skb)->daddr; u8 *lladdr = NULL; u32 ndoptlen = skb_tail_pointer(skb) - (skb_transport_header(skb) + offsetof(struct nd_msg, opt)); struct ndisc_options ndopts; struct net_device *dev = skb->dev; struct inet6_ifaddr *ifp; struct neighbour *neigh; if (skb->len < sizeof(struct nd_msg)) { ND_PRINTK(2, warn, ""NA: packet too short\n""); return; } if (ipv6_addr_is_multicast(&msg->target)) { ND_PRINTK(2, warn, ""NA: target address is multicast\n""); return; } if (ipv6_addr_is_multicast(daddr) && msg->icmph.icmp6_solicited) { ND_PRINTK(2, warn, ""NA: solicited NA is multicasted\n""); return; } if (!ndisc_parse_options(msg->opt, ndoptlen, &ndopts)) { ND_PRINTK(2, warn, ""NS: invalid ND option\n""); return; } if (ndopts.nd_opts_tgt_lladdr) { lladdr = ndisc_opt_addr_data(ndopts.nd_opts_tgt_lladdr, dev); if (!lladdr) { ND_PRINTK(2, warn, ""NA: invalid link-layer address length\n""); return; } } ifp = ipv6_get_ifaddr(dev_net(dev), &msg->target, dev, 1); if (ifp) { if (skb->pkt_type != PACKET_LOOPBACK && (ifp->flags & IFA_F_TENTATIVE)) { addrconf_dad_failure(ifp); return; } /* What should we make now? The advertisement is invalid, but ndisc specs say nothing about it. It could be misconfiguration, or an smart proxy agent tries to help us :-) We should not print the error if NA has been received from loopback - it is just our own unsolicited advertisement. */ if (skb->pkt_type != PACKET_LOOPBACK) ND_PRINTK(1, warn, ""NA: someone advertises our address %pI6 on %s!\n"", &ifp->addr, ifp->idev->dev->name); in6_ifa_put(ifp); return; } neigh = neigh_lookup(&nd_tbl, &msg->target, dev); if (neigh) { u8 old_flags = neigh->flags; struct net *net = dev_net(dev); if (neigh->nud_state & NUD_FAILED) goto out; /* * Don't update the neighbor cache entry on a proxy NA from * ourselves because either the proxied node is off link or it * has already sent a NA to us. */ if (lladdr && !memcmp(lladdr, dev->dev_addr, dev->addr_len) && net->ipv6.devconf_all->forwarding && net->ipv6.devconf_all->proxy_ndp && pneigh_lookup(&nd_tbl, net, &msg->target, dev, 0)) { /* XXX: idev->cnf.proxy_ndp */ goto out; } neigh_update(neigh, lladdr, msg->icmph.icmp6_solicited ? NUD_REACHABLE : NUD_STALE, NEIGH_UPDATE_F_WEAK_OVERRIDE| (msg->icmph.icmp6_override ? NEIGH_UPDATE_F_OVERRIDE : 0)| NEIGH_UPDATE_F_OVERRIDE_ISROUTER| (msg->icmph.icmp6_router ? NEIGH_UPDATE_F_ISROUTER : 0)); if ((old_flags & ~neigh->flags) & NTF_ROUTER) { /* * Change: router to host */ rt6_clean_tohost(dev_net(dev), saddr); } out: neigh_release(neigh); } } ",0 "__tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout) { return ldsem_down_write(&tty->ldisc_sem, timeout); } ",0 "float MediaPlayerService::AudioOutput::msecsPerFrame() const { Mutex::Autolock lock(mLock); return mMsecsPerFrame; } ",0 "static void gen_op_update_neg_cc(void) { tcg_gen_mov_tl(cpu_cc_dst, cpu_T0); tcg_gen_neg_tl(cpu_cc_src, cpu_T0); tcg_gen_movi_tl(cpu_cc_srcT, 0); } ",0 "WKRetainPtr PlatformWebView::windowSnapshotImage() { return 0; } ",0 "static int mmap_kmem(struct file *file, struct vm_area_struct *vma) { unsigned long pfn; /* Turn a kernel-virtual address into a physical page frame */ pfn = __pa((u64)vma->vm_pgoff << PAGE_SHIFT) >> PAGE_SHIFT; /* * RED-PEN: on some architectures there is more mapped memory than * available in mem_map which pfn_valid checks for. Perhaps should add a * new macro here. * * RED-PEN: vmalloc is not supported right now. */ if (!pfn_valid(pfn)) return -EIO; vma->vm_pgoff = pfn; return mmap_mem(file, vma); } ",0 "static int ext4_ext_convert_to_initialized(handle_t *handle, struct inode *inode, struct ext4_map_blocks *map, struct ext4_ext_path **ppath, int flags) { struct ext4_ext_path *path = *ppath; struct ext4_sb_info *sbi; struct ext4_extent_header *eh; struct ext4_map_blocks split_map; struct ext4_extent zero_ex1, zero_ex2; struct ext4_extent *ex, *abut_ex; ext4_lblk_t ee_block, eof_block; unsigned int ee_len, depth, map_len = map->m_len; int allocated = 0, max_zeroout = 0; int err = 0; int split_flag = EXT4_EXT_DATA_VALID2; ext_debug(""ext4_ext_convert_to_initialized: inode %lu, logical"" ""block %llu, max_blocks %u\n"", inode->i_ino, (unsigned long long)map->m_lblk, map_len); sbi = EXT4_SB(inode->i_sb); eof_block = (inode->i_size + inode->i_sb->s_blocksize - 1) >> inode->i_sb->s_blocksize_bits; if (eof_block < map->m_lblk + map_len) eof_block = map->m_lblk + map_len; depth = ext_depth(inode); eh = path[depth].p_hdr; ex = path[depth].p_ext; ee_block = le32_to_cpu(ex->ee_block); ee_len = ext4_ext_get_actual_len(ex); zero_ex1.ee_len = 0; zero_ex2.ee_len = 0; trace_ext4_ext_convert_to_initialized_enter(inode, map, ex); /* Pre-conditions */ BUG_ON(!ext4_ext_is_unwritten(ex)); BUG_ON(!in_range(map->m_lblk, ee_block, ee_len)); /* * Attempt to transfer newly initialized blocks from the currently * unwritten extent to its neighbor. This is much cheaper * than an insertion followed by a merge as those involve costly * memmove() calls. Transferring to the left is the common case in * steady state for workloads doing fallocate(FALLOC_FL_KEEP_SIZE) * followed by append writes. * * Limitations of the current logic: * - L1: we do not deal with writes covering the whole extent. * This would require removing the extent if the transfer * is possible. * - L2: we only attempt to merge with an extent stored in the * same extent tree node. */ if ((map->m_lblk == ee_block) && /* See if we can merge left */ (map_len < ee_len) && /*L1*/ (ex > EXT_FIRST_EXTENT(eh))) { /*L2*/ ext4_lblk_t prev_lblk; ext4_fsblk_t prev_pblk, ee_pblk; unsigned int prev_len; abut_ex = ex - 1; prev_lblk = le32_to_cpu(abut_ex->ee_block); prev_len = ext4_ext_get_actual_len(abut_ex); prev_pblk = ext4_ext_pblock(abut_ex); ee_pblk = ext4_ext_pblock(ex); /* * A transfer of blocks from 'ex' to 'abut_ex' is allowed * upon those conditions: * - C1: abut_ex is initialized, * - C2: abut_ex is logically abutting ex, * - C3: abut_ex is physically abutting ex, * - C4: abut_ex can receive the additional blocks without * overflowing the (initialized) length limit. */ if ((!ext4_ext_is_unwritten(abut_ex)) && /*C1*/ ((prev_lblk + prev_len) == ee_block) && /*C2*/ ((prev_pblk + prev_len) == ee_pblk) && /*C3*/ (prev_len < (EXT_INIT_MAX_LEN - map_len))) { /*C4*/ err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto out; trace_ext4_ext_convert_to_initialized_fastpath(inode, map, ex, abut_ex); /* Shift the start of ex by 'map_len' blocks */ ex->ee_block = cpu_to_le32(ee_block + map_len); ext4_ext_store_pblock(ex, ee_pblk + map_len); ex->ee_len = cpu_to_le16(ee_len - map_len); ext4_ext_mark_unwritten(ex); /* Restore the flag */ /* Extend abut_ex by 'map_len' blocks */ abut_ex->ee_len = cpu_to_le16(prev_len + map_len); /* Result: number of initialized blocks past m_lblk */ allocated = map_len; } } else if (((map->m_lblk + map_len) == (ee_block + ee_len)) && (map_len < ee_len) && /*L1*/ ex < EXT_LAST_EXTENT(eh)) { /*L2*/ /* See if we can merge right */ ext4_lblk_t next_lblk; ext4_fsblk_t next_pblk, ee_pblk; unsigned int next_len; abut_ex = ex + 1; next_lblk = le32_to_cpu(abut_ex->ee_block); next_len = ext4_ext_get_actual_len(abut_ex); next_pblk = ext4_ext_pblock(abut_ex); ee_pblk = ext4_ext_pblock(ex); /* * A transfer of blocks from 'ex' to 'abut_ex' is allowed * upon those conditions: * - C1: abut_ex is initialized, * - C2: abut_ex is logically abutting ex, * - C3: abut_ex is physically abutting ex, * - C4: abut_ex can receive the additional blocks without * overflowing the (initialized) length limit. */ if ((!ext4_ext_is_unwritten(abut_ex)) && /*C1*/ ((map->m_lblk + map_len) == next_lblk) && /*C2*/ ((ee_pblk + ee_len) == next_pblk) && /*C3*/ (next_len < (EXT_INIT_MAX_LEN - map_len))) { /*C4*/ err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto out; trace_ext4_ext_convert_to_initialized_fastpath(inode, map, ex, abut_ex); /* Shift the start of abut_ex by 'map_len' blocks */ abut_ex->ee_block = cpu_to_le32(next_lblk - map_len); ext4_ext_store_pblock(abut_ex, next_pblk - map_len); ex->ee_len = cpu_to_le16(ee_len - map_len); ext4_ext_mark_unwritten(ex); /* Restore the flag */ /* Extend abut_ex by 'map_len' blocks */ abut_ex->ee_len = cpu_to_le16(next_len + map_len); /* Result: number of initialized blocks past m_lblk */ allocated = map_len; } } if (allocated) { /* Mark the block containing both extents as dirty */ ext4_ext_dirty(handle, inode, path + depth); /* Update path to point to the right extent */ path[depth].p_ext = abut_ex; goto out; } else allocated = ee_len - (map->m_lblk - ee_block); WARN_ON(map->m_lblk < ee_block); /* * It is safe to convert extent to initialized via explicit * zeroout only if extent is fully inside i_size or new_size. */ split_flag |= ee_block + ee_len <= eof_block ? EXT4_EXT_MAY_ZEROOUT : 0; if (EXT4_EXT_MAY_ZEROOUT & split_flag) max_zeroout = sbi->s_extent_max_zeroout_kb >> (inode->i_sb->s_blocksize_bits - 10); if (IS_ENCRYPTED(inode)) max_zeroout = 0; /* * five cases: * 1. split the extent into three extents. * 2. split the extent into two extents, zeroout the head of the first * extent. * 3. split the extent into two extents, zeroout the tail of the second * extent. * 4. split the extent into two extents with out zeroout. * 5. no splitting needed, just possibly zeroout the head and / or the * tail of the extent. */ split_map.m_lblk = map->m_lblk; split_map.m_len = map->m_len; if (max_zeroout && (allocated > split_map.m_len)) { if (allocated <= max_zeroout) { /* case 3 or 5 */ zero_ex1.ee_block = cpu_to_le32(split_map.m_lblk + split_map.m_len); zero_ex1.ee_len = cpu_to_le16(allocated - split_map.m_len); ext4_ext_store_pblock(&zero_ex1, ext4_ext_pblock(ex) + split_map.m_lblk + split_map.m_len - ee_block); err = ext4_ext_zeroout(inode, &zero_ex1); if (err) goto out; split_map.m_len = allocated; } if (split_map.m_lblk - ee_block + split_map.m_len < max_zeroout) { /* case 2 or 5 */ if (split_map.m_lblk != ee_block) { zero_ex2.ee_block = ex->ee_block; zero_ex2.ee_len = cpu_to_le16(split_map.m_lblk - ee_block); ext4_ext_store_pblock(&zero_ex2, ext4_ext_pblock(ex)); err = ext4_ext_zeroout(inode, &zero_ex2); if (err) goto out; } split_map.m_len += split_map.m_lblk - ee_block; split_map.m_lblk = ee_block; allocated = map->m_len; } } err = ext4_split_extent(handle, inode, ppath, &split_map, split_flag, flags); if (err > 0) err = 0; out: /* If we have gotten a failure, don't zero out status tree */ if (!err) { err = ext4_zeroout_es(inode, &zero_ex1); if (!err) err = ext4_zeroout_es(inode, &zero_ex2); } return err ? err : allocated; } ",0 "bool HTMLMediaElement::shouldAutoplay() { if (document().isSandboxed(SandboxAutomaticFeatures)) return false; return m_autoplaying && m_paused && autoplay(); } ",0 "void RenderThreadImpl::Shutdown() { ChildThreadImpl::Shutdown(); quota_dispatcher_.reset(); file_system_dispatcher_.reset(); WebFileSystemImpl::DeleteThreadSpecificInstance(); blink::MainThreadIsolate()->DumpAndResetStats(); if (base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kDumpBlinkRuntimeCallStats)) blink::LogRuntimeCallStats(); if (!base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kSingleProcess)) base::Process::TerminateCurrentProcessImmediately(0); } ",0 "kex_free_newkeys(struct newkeys *newkeys) { if (newkeys == NULL) return; if (newkeys->enc.key) { explicit_bzero(newkeys->enc.key, newkeys->enc.key_len); free(newkeys->enc.key); newkeys->enc.key = NULL; } if (newkeys->enc.iv) { explicit_bzero(newkeys->enc.iv, newkeys->enc.iv_len); free(newkeys->enc.iv); newkeys->enc.iv = NULL; } free(newkeys->enc.name); explicit_bzero(&newkeys->enc, sizeof(newkeys->enc)); free(newkeys->comp.name); explicit_bzero(&newkeys->comp, sizeof(newkeys->comp)); mac_clear(&newkeys->mac); if (newkeys->mac.key) { explicit_bzero(newkeys->mac.key, newkeys->mac.key_len); free(newkeys->mac.key); newkeys->mac.key = NULL; } free(newkeys->mac.name); explicit_bzero(&newkeys->mac, sizeof(newkeys->mac)); explicit_bzero(newkeys, sizeof(*newkeys)); free(newkeys); } ",0 " TestFlashMessageLoop::TestFlashMessageLoop(TestingInstance* instance) : TestCase(instance), message_loop_(NULL), callback_factory_(this) { } ",1 "tsize_t t2p_write_pdf_trailer(T2P* t2p, TIFF* output) { tsize_t written = 0; char buffer[32]; int buflen = 0; size_t i = 0; for (i = 0; i < sizeof(t2p->pdf_fileid) - 8; i += 8) snprintf(t2p->pdf_fileid + i, 9, ""%.8X"", rand()); written += t2pWriteFile(output, (tdata_t) ""trailer\n<<\n/Size "", 17); buflen = snprintf(buffer, sizeof(buffer), ""%lu"", (unsigned long)(t2p->pdf_xrefcount+1)); check_snprintf_ret(t2p, buflen, buffer); written += t2pWriteFile(output, (tdata_t) buffer, buflen); written += t2pWriteFile(output, (tdata_t) ""\n/Root "", 7); buflen=snprintf(buffer, sizeof(buffer), ""%lu"", (unsigned long)t2p->pdf_catalog); check_snprintf_ret(t2p, buflen, buffer); written += t2pWriteFile(output, (tdata_t) buffer, buflen); written += t2pWriteFile(output, (tdata_t) "" 0 R \n/Info "", 12); buflen=snprintf(buffer, sizeof(buffer), ""%lu"", (unsigned long)t2p->pdf_info); check_snprintf_ret(t2p, buflen, buffer); written += t2pWriteFile(output, (tdata_t) buffer, buflen); written += t2pWriteFile(output, (tdata_t) "" 0 R \n/ID[<"", 11); written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid, sizeof(t2p->pdf_fileid) - 1); written += t2pWriteFile(output, (tdata_t) ""><"", 2); written += t2pWriteFile(output, (tdata_t) t2p->pdf_fileid, sizeof(t2p->pdf_fileid) - 1); written += t2pWriteFile(output, (tdata_t) "">]\n>>\nstartxref\n"", 16); buflen=snprintf(buffer, sizeof(buffer), ""%lu"", (unsigned long)t2p->pdf_startxref); check_snprintf_ret(t2p, buflen, buffer); written += t2pWriteFile(output, (tdata_t) buffer, buflen); written += t2pWriteFile(output, (tdata_t) ""\n%%EOF\n"", 7); return(written); } ",0 "static inline void gen_goto_tb(DisasContext *s, int tb_num, target_ulong eip) { target_ulong pc = s->cs_base + eip; if (use_goto_tb(s, pc)) { /* jump to same page: we can use a direct jump */ tcg_gen_goto_tb(tb_num); gen_jmp_im(eip); tcg_gen_exit_tb((uintptr_t)s->tb + tb_num); } else { /* jump to another page: currently not optimized */ gen_jmp_im(eip); gen_eob(s); } } ",0 "static int __kvm_read_guest_page(struct kvm_memory_slot *slot, gfn_t gfn, void *data, int offset, int len) { int r; unsigned long addr; addr = gfn_to_hva_memslot_prot(slot, gfn, NULL); if (kvm_is_error_hva(addr)) return -EFAULT; r = __copy_from_user(data, (void __user *)addr + offset, len); if (r) return -EFAULT; return 0; } ",0 "int drm_mode_page_flip_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { struct drm_mode_crtc_page_flip *page_flip = data; struct drm_mode_object *obj; struct drm_crtc *crtc; struct drm_framebuffer *fb; struct drm_pending_vblank_event *e = NULL; unsigned long flags; int ret = -EINVAL; if (page_flip->flags & ~DRM_MODE_PAGE_FLIP_FLAGS || page_flip->reserved != 0) return -EINVAL; mutex_lock(&dev->mode_config.mutex); obj = drm_mode_object_find(dev, page_flip->crtc_id, DRM_MODE_OBJECT_CRTC); if (!obj) goto out; crtc = obj_to_crtc(obj); if (crtc->fb == NULL) { /* The framebuffer is currently unbound, presumably * due to a hotplug event, that userspace has not * yet discovered. */ ret = -EBUSY; goto out; } if (crtc->funcs->page_flip == NULL) goto out; obj = drm_mode_object_find(dev, page_flip->fb_id, DRM_MODE_OBJECT_FB); if (!obj) goto out; fb = obj_to_fb(obj); if (page_flip->flags & DRM_MODE_PAGE_FLIP_EVENT) { ret = -ENOMEM; spin_lock_irqsave(&dev->event_lock, flags); if (file_priv->event_space < sizeof e->event) { spin_unlock_irqrestore(&dev->event_lock, flags); goto out; } file_priv->event_space -= sizeof e->event; spin_unlock_irqrestore(&dev->event_lock, flags); e = kzalloc(sizeof *e, GFP_KERNEL); if (e == NULL) { spin_lock_irqsave(&dev->event_lock, flags); file_priv->event_space += sizeof e->event; spin_unlock_irqrestore(&dev->event_lock, flags); goto out; } e->event.base.type = DRM_EVENT_FLIP_COMPLETE; e->event.base.length = sizeof e->event; e->event.user_data = page_flip->user_data; e->base.event = &e->event.base; e->base.file_priv = file_priv; e->base.destroy = (void (*) (struct drm_pending_event *)) kfree; } ret = crtc->funcs->page_flip(crtc, fb, e); if (ret) { spin_lock_irqsave(&dev->event_lock, flags); file_priv->event_space += sizeof e->event; spin_unlock_irqrestore(&dev->event_lock, flags); kfree(e); } out: mutex_unlock(&dev->mode_config.mutex); return ret; } ",0 "void comps_rtree_unite(COMPS_RTree *rt1, COMPS_RTree *rt2) { COMPS_HSList *tmplist, *tmp_subnodes; COMPS_HSListItem *it; struct Pair { COMPS_HSList * subnodes; char * key; char added; } *pair, *parent_pair; pair = malloc(sizeof(struct Pair)); pair->subnodes = rt2->subnodes; pair->key = NULL; tmplist = comps_hslist_create(); comps_hslist_init(tmplist, NULL, NULL, &free); comps_hslist_append(tmplist, pair, 0); while (tmplist->first != NULL) { it = tmplist->first; comps_hslist_remove(tmplist, tmplist->first); tmp_subnodes = ((struct Pair*)it->data)->subnodes; parent_pair = (struct Pair*) it->data; free(it); for (it = tmp_subnodes->first; it != NULL; it=it->next) { pair = malloc(sizeof(struct Pair)); pair->subnodes = ((COMPS_RTreeData*)it->data)->subnodes; if (parent_pair->key != NULL) { pair->key = malloc(sizeof(char) * (strlen(((COMPS_RTreeData*)it->data)->key) + strlen(parent_pair->key) + 1)); memcpy(pair->key, parent_pair->key, sizeof(char) * strlen(parent_pair->key)); memcpy(pair->key + strlen(parent_pair->key), ((COMPS_RTreeData*)it->data)->key, sizeof(char)*(strlen(((COMPS_RTreeData*)it->data)->key)+1)); } else { pair->key = malloc(sizeof(char)* (strlen(((COMPS_RTreeData*)it->data)->key) +1)); memcpy(pair->key, ((COMPS_RTreeData*)it->data)->key, sizeof(char)*(strlen(((COMPS_RTreeData*)it->data)->key)+1)); } /* current node has data */ if (((COMPS_RTreeData*)it->data)->data != NULL) { comps_rtree_set(rt1, pair->key, rt2->data_cloner(((COMPS_RTreeData*)it->data)->data)); } if (((COMPS_RTreeData*)it->data)->subnodes->first) { comps_hslist_append(tmplist, pair, 0); } else { free(pair->key); free(pair); } } free(parent_pair->key); free(parent_pair); } comps_hslist_destroy(&tmplist); } ",1 "bool HFSIterator::IsDecmpfsCompressed() { if (IsDirectory()) return false; const HFSPlusCatalogFile* file = catalog_->current_record()->file; return file->bsdInfo.ownerFlags & UF_COMPRESSED; } ",0 "void NavigatorImpl::DidFailProvisionalLoadWithError( RenderFrameHostImpl* render_frame_host, const FrameHostMsg_DidFailProvisionalLoadWithError_Params& params) { VLOG(1) << ""Failed Provisional Load: "" << params.url.possibly_invalid_spec() << "", error_code: "" << params.error_code << "", error_description: "" << params.error_description << "", showing_repost_interstitial: "" << params.showing_repost_interstitial << "", frame_id: "" << render_frame_host->GetRoutingID(); GURL validated_url(params.url); RenderProcessHost* render_process_host = render_frame_host->GetProcess(); render_process_host->FilterURL(false, &validated_url); if (net::ERR_ABORTED == params.error_code) { FrameTreeNode* root = render_frame_host->frame_tree_node()->frame_tree()->root(); if (root->render_manager()->interstitial_page() != NULL) { LOG(WARNING) << ""Discarding message during interstitial.""; return; } } DiscardPendingEntryIfNeeded(render_frame_host->navigation_handle()); if (delegate_) { delegate_->DidFailProvisionalLoadWithError( render_frame_host, validated_url, params.error_code, params.error_description, params.was_ignored_by_handler); } } ",0 "int qeth_threads_running(struct qeth_card *card, unsigned long threads) { unsigned long flags; int rc = 0; spin_lock_irqsave(&card->thread_mask_lock, flags); rc = (card->thread_running_mask & threads); spin_unlock_irqrestore(&card->thread_mask_lock, flags); return rc; } ",0 "void AppLauncherHandler::OnExtensionPreferenceChanged() { base::DictionaryValue dictionary; FillAppDictionary(&dictionary); web_ui()->CallJavascriptFunction(""ntp.appsPrefChangeCallback"", dictionary); } ",0 "int dut_mode_send(uint16_t opcode, uint8_t* buf, uint8_t len) { LOG_INFO(""dut_mode_send""); /* sanity check */ if (interface_ready() == FALSE) return BT_STATUS_NOT_READY; return btif_dut_mode_send(opcode, buf, len); } ",0 "void ContextState::UpdateWindowRectanglesForBoundDrawFramebufferClientID( GLuint client_id) { bool old_id_nonzero = current_draw_framebuffer_client_id != 0; bool new_id_nonzero = client_id != 0; current_draw_framebuffer_client_id = client_id; if (old_id_nonzero ^ new_id_nonzero) { UpdateWindowRectangles(); } } ",0 "static char *super_fgets_w(char **b, int *blen, Image *file) { int c, len; unsigned char *p, *q; len=*blen; p=(unsigned char *) (*b); for (q=p; ; q++) { c=ReadBlobLSBSignedShort(file); if ((c == -1) || (c == '\n')) break; if (EOFBlob(file)) break; if ((q-p+1) >= (int) len) { int tlen; tlen=q-p; len<<=1; p=(unsigned char *) ResizeQuantumMemory(p,(size_t) (len+2),sizeof(*p)); *b=(char *) p; if (p == (unsigned char *) NULL) break; q=p+tlen; } *q=(unsigned char) c; } *blen=0; if ((*b) != (char *) NULL) { int tlen; tlen=q-p; if (tlen == 0) return (char *) NULL; p[tlen] = '\0'; *blen=++tlen; } return((char *) p); } ",0 "bool SafeSock :: init_MD(CONDOR_MD_MODE /* mode */, KeyInfo * key, const char * keyId) { bool inited = true; if (mdChecker_) { delete mdChecker_; mdChecker_ = 0; } if (key) { mdChecker_ = new Condor_MD_MAC(key); } if (_longMsg) { inited = _longMsg->verifyMD(mdChecker_); } else { inited = _shortMsg.verifyMD(mdChecker_); } if( !_outMsg.init_MD(keyId) ) { inited = false; } return inited; } ",0 "void LayerTreeHost::CalculateLCDTextMetricsCallback(Layer* layer) { if (!layer->SupportsLCDText()) return; lcd_text_metrics_.total_num_cc_layers++; if (layer->draw_properties().can_use_lcd_text) { lcd_text_metrics_.total_num_cc_layers_can_use_lcd_text++; if (layer->contents_opaque()) lcd_text_metrics_.total_num_cc_layers_will_use_lcd_text++; } } ",0 "int TabStrip::OnDragUpdated(const DropTargetEvent& event) { UpdateDropIndex(event); if (!drop_info_->file_supported) return ui::DragDropTypes::DRAG_NONE; return GetDropEffect(event); } ",0 "void BrowserCommandController::TabBlockedStateChanged( content::WebContents* contents, int index) { PrintingStateChanged(); FullscreenStateChanged(); UpdateCommandsForFind(); UpdateCommandsForMediaRouter(); } ",0 "gs_id get_mem_hdr_id (void *ptr) { return (*((hdr_id_t *)((byte *)ptr) - HDR_ID_OFFSET)); } ",0 "bool OxideQQuickWebViewPrivate::CanCreateWindows() const { Q_Q(const OxideQQuickWebView); return q->receivers(SIGNAL(newViewRequested(OxideQNewViewRequest*))) > 0; } ",0 "static inline gfp_t htlb_alloc_mask(struct hstate *h) { if (hugepages_treat_as_movable || hugepage_migration_supported(h)) return GFP_HIGHUSER_MOVABLE; else return GFP_HIGHUSER; } ",0 " aura::Window* CreateWindowInWatchedContainer(const InitParams& params) { aura::test::TestWindowDelegate* delegate = NULL; if (!params.can_maximize) { delegate = aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(); delegate->set_window_component(HTCAPTION); if (!params.max_size.IsEmpty()) delegate->set_maximum_size(params.max_size); } aura::Window* window = aura::test::CreateTestWindowWithDelegateAndType( delegate, params.type, 0, params.bounds, NULL, params.show_on_creation); int32_t behavior = ui::mojom::kResizeBehaviorNone; behavior |= params.can_resize ? ui::mojom::kResizeBehaviorCanResize : 0; behavior |= params.can_maximize ? ui::mojom::kResizeBehaviorCanMaximize : 0; window->SetProperty(aura::client::kResizeBehaviorKey, behavior); aura::Window* container = Shell::GetContainer( Shell::GetPrimaryRootWindow(), wm::kSwitchableWindowContainerIds[0]); container->AddChild(window); return window; } ",0 "xsltRegisterExtModuleFunction(const xmlChar * name, const xmlChar * URI, xmlXPathFunction function) { if ((name == NULL) || (URI == NULL) || (function == NULL)) return (-1); if (xsltFunctionsHash == NULL) xsltFunctionsHash = xmlHashCreate(10); if (xsltFunctionsHash == NULL) return (-1); xmlMutexLock(xsltExtMutex); xmlHashUpdateEntry2(xsltFunctionsHash, name, URI, XML_CAST_FPTR(function), NULL); xmlMutexUnlock(xsltExtMutex); return (0); } ",0 "FrameTreeNode* RenderFrameHostImpl::AddChild( std::unique_ptr child, int process_id, int frame_routing_id) { CHECK_EQ(process_id, GetProcess()->GetID()); child->render_manager()->Init(GetSiteInstance(), render_view_host()->GetRoutingID(), frame_routing_id, MSG_ROUTING_NONE, false); frame_tree_node_->render_manager()->CreateProxiesForChildFrame(child.get()); children_.push_back(std::move(child)); return children_.back().get(); } ",0 "rt6_print(netdissect_options *ndo, register const u_char *bp, const u_char *bp2 _U_) { register const struct ip6_rthdr *dp; register const struct ip6_rthdr0 *dp0; register const u_char *ep; int i, len; register const struct in6_addr *addr; dp = (const struct ip6_rthdr *)bp; len = dp->ip6r_len; /* 'ep' points to the end of available data. */ ep = ndo->ndo_snapend; ND_TCHECK(dp->ip6r_segleft); ND_PRINT((ndo, ""srcrt (len=%d"", dp->ip6r_len)); /*)*/ ND_PRINT((ndo, "", type=%d"", dp->ip6r_type)); ND_PRINT((ndo, "", segleft=%d"", dp->ip6r_segleft)); switch (dp->ip6r_type) { case IPV6_RTHDR_TYPE_0: case IPV6_RTHDR_TYPE_2: /* Mobile IPv6 ID-20 */ dp0 = (const struct ip6_rthdr0 *)dp; ND_TCHECK(dp0->ip6r0_reserved); if (dp0->ip6r0_reserved || ndo->ndo_vflag) { ND_PRINT((ndo, "", rsv=0x%0x"", EXTRACT_32BITS(&dp0->ip6r0_reserved))); } if (len % 2 == 1) goto trunc; len >>= 1; addr = &dp0->ip6r0_addr[0]; for (i = 0; i < len; i++) { if ((const u_char *)(addr + 1) > ep) goto trunc; ND_PRINT((ndo, "", [%d]%s"", i, ip6addr_string(ndo, addr))); addr++; } /*(*/ ND_PRINT((ndo, "") "")); return((dp0->ip6r0_len + 1) << 3); break; default: goto trunc; break; } trunc: ND_PRINT((ndo, ""[|srcrt]"")); return -1; } ",1 "void RenderFrameDevToolsAgentHost::SignalSynchronousSwapCompositorFrame( RenderFrameHost* frame_host, viz::CompositorFrameMetadata frame_metadata) { scoped_refptr dtah(FindAgentHost( static_cast(frame_host)->frame_tree_node())); if (dtah) { base::PostTaskWithTraits( FROM_HERE, {BrowserThread::UI}, base::BindOnce( &RenderFrameDevToolsAgentHost::SynchronousSwapCompositorFrame, dtah.get(), std::move(frame_metadata))); } } ",0 "size_t tls12_get_psigalgs(SSL *s, const unsigned char **psigs) { /* If Suite B mode use Suite B sigalgs only, ignore any other * preferences. */ #ifndef OPENSSL_NO_EC switch (tls1_suiteb(s)) { case SSL_CERT_FLAG_SUITEB_128_LOS: *psigs = suiteb_sigalgs; return sizeof(suiteb_sigalgs); case SSL_CERT_FLAG_SUITEB_128_LOS_ONLY: *psigs = suiteb_sigalgs; return 2; case SSL_CERT_FLAG_SUITEB_192_LOS: *psigs = suiteb_sigalgs + 2; return 2; } #endif /* If server use client authentication sigalgs if not NULL */ if (s->server && s->cert->client_sigalgs) { *psigs = s->cert->client_sigalgs; return s->cert->client_sigalgslen; } else if (s->cert->conf_sigalgs) { *psigs = s->cert->conf_sigalgs; return s->cert->conf_sigalgslen; } else { *psigs = tls12_sigalgs; return sizeof(tls12_sigalgs); } } ",0 "int do_execve(const char *filename, const char __user *const __user *__argv, const char __user *const __user *__envp) { struct user_arg_ptr argv = { .ptr.native = __argv }; struct user_arg_ptr envp = { .ptr.native = __envp }; return do_execve_common(filename, argv, envp); } ",0 "bson_iter_key (const bson_iter_t *iter) /* IN */ { BSON_ASSERT (iter); return bson_iter_key_unsafe (iter); } ",0 "xmlParseElementContentDecl(xmlParserCtxtPtr ctxt, const xmlChar *name, xmlElementContentPtr *result) { xmlElementContentPtr tree = NULL; int inputid = ctxt->input->id; int res; *result = NULL; if (RAW != '(') { xmlFatalErrMsgStr(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, ""xmlParseElementContentDecl : %s '(' expected\n"", name); return(-1); } NEXT; GROW; if (ctxt->instate == XML_PARSER_EOF) return(-1); SKIP_BLANKS; if (CMP7(CUR_PTR, '#', 'P', 'C', 'D', 'A', 'T', 'A')) { tree = xmlParseElementMixedContentDecl(ctxt, inputid); res = XML_ELEMENT_TYPE_MIXED; } else { tree = xmlParseElementChildrenContentDeclPriv(ctxt, inputid, 1); res = XML_ELEMENT_TYPE_ELEMENT; } SKIP_BLANKS; *result = tree; return(res); } ",0 "static int airo_get_power(struct net_device *dev, struct iw_request_info *info, struct iw_param *vwrq, char *extra) { struct airo_info *local = dev->ml_priv; __le16 mode; readConfigRid(local, 1); mode = local->config.powerSaveMode; if ((vwrq->disabled = (mode == POWERSAVE_CAM))) return 0; if ((vwrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) { vwrq->value = le16_to_cpu(local->config.fastListenDelay) * 1024; vwrq->flags = IW_POWER_TIMEOUT; } else { vwrq->value = le16_to_cpu(local->config.fastListenInterval) * 1024; vwrq->flags = IW_POWER_PERIOD; } if ((local->config.rmode & RXMODE_MASK) == RXMODE_ADDR) vwrq->flags |= IW_POWER_UNICAST_R; else vwrq->flags |= IW_POWER_ALL_R; return 0; } ",0 "static int setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keysize) { struct salsa20_ctx *ctx = crypto_tfm_ctx(tfm); salsa20_keysetup(ctx, key, keysize); return 0; } ",0 "php_mysqlnd_sha256_pk_request_response_read(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC) { zend_uchar buf[SHA256_PK_REQUEST_RESP_BUFFER_SIZE]; zend_uchar *p = buf; zend_uchar *begin = buf; MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE * packet= (MYSQLND_PACKET_SHA256_PK_REQUEST_RESPONSE *) _packet; DBG_ENTER(""php_mysqlnd_sha256_pk_request_response_read""); /* leave space for terminating safety \0 */ PACKET_READ_HEADER_AND_BODY(packet, conn, buf, sizeof(buf), ""SHA256_PK_REQUEST_RESPONSE"", PROT_SHA256_PK_REQUEST_RESPONSE_PACKET); BAIL_IF_NO_MORE_DATA; p++; BAIL_IF_NO_MORE_DATA; packet->public_key_len = packet->header.size - (p - buf); packet->public_key = mnd_emalloc(packet->public_key_len + 1); memcpy(packet->public_key, p, packet->public_key_len); packet->public_key[packet->public_key_len] = '\0'; DBG_RETURN(PASS); premature_end: DBG_ERR_FMT(""OK packet %d bytes shorter than expected"", p - begin - packet->header.size); php_error_docref(NULL TSRMLS_CC, E_WARNING, ""SHA256_PK_REQUEST_RESPONSE packet ""MYSQLND_SZ_T_SPEC"" bytes shorter than expected"", p - begin - packet->header.size); DBG_RETURN(FAIL); } ",0 "static void blk_mq_map_swqueue(struct request_queue *q) { unsigned int i; struct blk_mq_hw_ctx *hctx; struct blk_mq_ctx *ctx; struct blk_mq_tag_set *set = q->tag_set; queue_for_each_hw_ctx(q, hctx, i) { cpumask_clear(hctx->cpumask); hctx->nr_ctx = 0; } /* * Map software to hardware queues */ queue_for_each_ctx(q, ctx, i) { /* If the cpu isn't online, the cpu is mapped to first hctx */ if (!cpu_online(i)) continue; hctx = q->mq_ops->map_queue(q, i); cpumask_set_cpu(i, hctx->cpumask); cpumask_set_cpu(i, hctx->tags->cpumask); ctx->index_hw = hctx->nr_ctx; hctx->ctxs[hctx->nr_ctx++] = ctx; } queue_for_each_hw_ctx(q, hctx, i) { struct blk_mq_ctxmap *map = &hctx->ctx_map; /* * If no software queues are mapped to this hardware queue, * disable it and free the request entries. */ if (!hctx->nr_ctx) { if (set->tags[i]) { blk_mq_free_rq_map(set, set->tags[i], i); set->tags[i] = NULL; } hctx->tags = NULL; continue; } /* unmapped hw queue can be remapped after CPU topo changed */ if (!set->tags[i]) set->tags[i] = blk_mq_init_rq_map(set, i); hctx->tags = set->tags[i]; WARN_ON(!hctx->tags); /* * Set the map size to the number of mapped software queues. * This is more accurate and more efficient than looping * over all possibly mapped software queues. */ map->size = DIV_ROUND_UP(hctx->nr_ctx, map->bits_per_word); /* * Initialize batch roundrobin counts */ hctx->next_cpu = cpumask_first(hctx->cpumask); hctx->next_cpu_batch = BLK_MQ_CPU_WORK_BATCH; } } ",0 " virtual ~DeleteViewAnimationDelegate() {} ",0 " void CloudPolicyController::SetState( CloudPolicyController::ControllerState new_state) { state_ = new_state; backend_.reset(); // Discard any pending requests. base::Time now(base::Time::NowFromSystemTime()); base::Time refresh_at; base::Time last_refresh(cache_->last_policy_refresh_time()); if (last_refresh.is_null()) last_refresh = now; bool inform_notifier_done = false; switch (state_) { case STATE_TOKEN_UNMANAGED: notifier_->Inform(CloudPolicySubsystem::UNMANAGED, CloudPolicySubsystem::NO_DETAILS, PolicyNotifier::POLICY_CONTROLLER); break; case STATE_TOKEN_UNAVAILABLE: case STATE_TOKEN_VALID: refresh_at = now; break; case STATE_POLICY_VALID: effective_policy_refresh_error_delay_ms_ = kPolicyRefreshErrorDelayInMilliseconds; refresh_at = last_refresh + base::TimeDelta::FromMilliseconds(GetRefreshDelay()); notifier_->Inform(CloudPolicySubsystem::SUCCESS, CloudPolicySubsystem::NO_DETAILS, PolicyNotifier::POLICY_CONTROLLER); break; case STATE_TOKEN_ERROR: notifier_->Inform(CloudPolicySubsystem::NETWORK_ERROR, CloudPolicySubsystem::BAD_DMTOKEN, PolicyNotifier::POLICY_CONTROLLER); inform_notifier_done = true; case STATE_POLICY_ERROR: if (!inform_notifier_done) { notifier_->Inform(CloudPolicySubsystem::NETWORK_ERROR, CloudPolicySubsystem::POLICY_NETWORK_ERROR, PolicyNotifier::POLICY_CONTROLLER); } refresh_at = now + base::TimeDelta::FromMilliseconds( effective_policy_refresh_error_delay_ms_); effective_policy_refresh_error_delay_ms_ = std::min(effective_policy_refresh_error_delay_ms_ * 2, policy_refresh_rate_ms_); break; case STATE_POLICY_UNAVAILABLE: effective_policy_refresh_error_delay_ms_ = policy_refresh_rate_ms_; refresh_at = now + base::TimeDelta::FromMilliseconds( effective_policy_refresh_error_delay_ms_); notifier_->Inform(CloudPolicySubsystem::NETWORK_ERROR, CloudPolicySubsystem::POLICY_NETWORK_ERROR, PolicyNotifier::POLICY_CONTROLLER); break; } scheduler_->CancelDelayedWork(); if (!refresh_at.is_null()) { int64 delay = std::max((refresh_at - now).InMilliseconds(), 0); scheduler_->PostDelayedWork( base::Bind(&CloudPolicyController::DoWork, base::Unretained(this)), delay); } } ",1 "void FreeMatShaper(cmsContext ContextID, void* Data) { if (Data != NULL) _cmsFree(ContextID, Data); } ",0 "static void xfrm_update_ae_params(struct xfrm_state *x, struct nlattr **attrs) { struct nlattr *rp = attrs[XFRMA_REPLAY_VAL]; struct nlattr *re = attrs[XFRMA_REPLAY_ESN_VAL]; struct nlattr *lt = attrs[XFRMA_LTIME_VAL]; struct nlattr *et = attrs[XFRMA_ETIMER_THRESH]; struct nlattr *rt = attrs[XFRMA_REPLAY_THRESH]; if (re) { struct xfrm_replay_state_esn *replay_esn; replay_esn = nla_data(re); memcpy(x->replay_esn, replay_esn, xfrm_replay_state_esn_len(replay_esn)); memcpy(x->preplay_esn, replay_esn, xfrm_replay_state_esn_len(replay_esn)); } if (rp) { struct xfrm_replay_state *replay; replay = nla_data(rp); memcpy(&x->replay, replay, sizeof(*replay)); memcpy(&x->preplay, replay, sizeof(*replay)); } if (lt) { struct xfrm_lifetime_cur *ltime; ltime = nla_data(lt); x->curlft.bytes = ltime->bytes; x->curlft.packets = ltime->packets; x->curlft.add_time = ltime->add_time; x->curlft.use_time = ltime->use_time; } if (et) x->replay_maxage = nla_get_u32(et); if (rt) x->replay_maxdiff = nla_get_u32(rt); } ",0 "bool RenderView::runModalBeforeUnloadDialog( WebFrame* frame, const WebString& message) { if (is_swapped_out_) return true; bool success = false; string16 ignored_result; SendAndRunNestedMessageLoop(new ViewHostMsg_RunBeforeUnloadConfirm( routing_id_, frame->document().url(), message, &success, &ignored_result)); return success; } ",0 "void DevToolsAgent::runtimeFeatureStateChanged( const WebKit::WebString& feature, bool enabled) { Send(new DevToolsHostMsg_RuntimePropertyChanged( routing_id(), feature.utf8(), enabled ? ""true"" : ""false"")); } ",0 "void GLES2Implementation::UseProgramHelper(GLuint program) { if (current_program_ != program) { current_program_ = program; helper_->UseProgram(program); } } ",0 "void ip_mc_drop_socket(struct sock *sk) { struct inet_sock *inet = inet_sk(sk); struct ip_mc_socklist *iml; struct net *net = sock_net(sk); if (inet->mc_list == NULL) return; rtnl_lock(); while ((iml = rtnl_dereference(inet->mc_list)) != NULL) { struct in_device *in_dev; inet->mc_list = iml->next_rcu; in_dev = inetdev_by_index(net, iml->multi.imr_ifindex); (void) ip_mc_leave_src(sk, iml, in_dev); if (in_dev != NULL) ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr); /* decrease mem now to avoid the memleak warning */ atomic_sub(sizeof(*iml), &sk->sk_omem_alloc); kfree_rcu(iml, rcu); } rtnl_unlock(); } ",0 "void V8TestObject::MeasureOverloadedMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_measureOverloadedMethod""); test_object_v8_internal::MeasureOverloadedMethodMethod(info); } ",0 " static void v9fs_walk(void *opaque) { int name_idx; V9fsFidState *newfidp = NULL; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; err = pdu_unmarshal(pdu, offset, ""ddw"", &fid, &newfid, &nwnames); if (err < 0) { pdu_complete(pdu, err); return ; } V9fsFidState *newfidp = NULL; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; err = pdu_unmarshal(pdu, offset, ""ddw"", &fid, &newfid, &nwnames); if (err < 0) { for (i = 0; i < nwnames; i++) { err = pdu_unmarshal(pdu, offset, ""s"", &wnames[i]); if (err < 0) { goto out_nofid; } if (name_is_illegal(wnames[i].data)) { err = -ENOENT; goto out_nofid; } offset += err; } } else if (nwnames > P9_MAXWELEM) { err = -EINVAL; goto out_nofid; } fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } v9fs_path_init(&dpath); v9fs_path_init(&path); /* * Both dpath and path initially poin to fidp. * Needed to handle request with nwnames == 0 */ v9fs_path_copy(&dpath, &fidp->path); err = -ENOENT; goto out_nofid; } ",1 "ReadPipeAsync(HANDLE pipe, LPVOID buffer, DWORD size, DWORD count, LPHANDLE events) { return AsyncPipeOp(read, pipe, buffer, size, count, events); } ",0 " static void Bind(int process_id, int routing_id, media::mojom::RemoterFactoryRequest request) { mojo::MakeStrongBinding( base::MakeUnique(process_id, routing_id), std::move(request)); } ",0 "void RenderViewTest::LoadHTML(const char* html) { std::string url_str = ""data:text/html;charset=utf-8,""; url_str.append(html); GURL url(url_str); GetMainFrame()->loadRequest(WebURLRequest(url)); ProcessPendingMessages(); } ",0 " const Vp9LoopFilter& GetLoopFilter() const { return vp9_parser_.GetLoopFilter(); } ",1 "void OffscreenCanvasSurfaceImpl::SetBeginFrameSource( cc::BeginFrameSource* begin_frame_source) {} ",1 "static void _perf_event_disable(struct perf_event *event) { struct perf_event_context *ctx = event->ctx; struct task_struct *task = ctx->task; if (!task) { /* * Disable the event on the cpu that it's on */ cpu_function_call(event->cpu, __perf_event_disable, event); return; } retry: if (!task_function_call(task, __perf_event_disable, event)) return; raw_spin_lock_irq(&ctx->lock); /* * If the event is still active, we need to retry the cross-call. */ if (event->state == PERF_EVENT_STATE_ACTIVE) { raw_spin_unlock_irq(&ctx->lock); /* * Reload the task pointer, it might have been changed by * a concurrent perf_event_context_sched_out(). */ task = ctx->task; goto retry; } /* * Since we have the lock this context can't be scheduled * in, so we can change the state safely. */ if (event->state == PERF_EVENT_STATE_INACTIVE) { update_group_times(event); event->state = PERF_EVENT_STATE_OFF; } raw_spin_unlock_irq(&ctx->lock); } ",0 "GF_Err cprt_Size(GF_Box *s) { GF_CopyrightBox *ptr = (GF_CopyrightBox *)s; ptr->size += 2; if (ptr->notice) ptr->size += strlen(ptr->notice) + 1; return GF_OK; } ",0 "instance_handler(vector_t *strvec) { if (!strvec) return; if (!reload) { if (!global_data->instance_name) { global_data->instance_name = set_value(strvec); use_pid_dir = true; } else report_config_error(CONFIG_GENERAL_ERROR, ""Duplicate instance definition %s - ignoring"", FMT_STR_VSLOT(strvec, 1)); } } ",0 "horizontalDifferenceF(float *ip, int n, int stride, uint16 *wp, uint16 *FromLT2) { int32 r1, g1, b1, a1, r2, g2, b2, a2, mask; float fltsize = Fltsize; #define CLAMP(v) ( (v<(float)0.) ? 0 \ : (v<(float)2.) ? FromLT2[(int)(v*fltsize)] \ : (v>(float)24.2) ? 2047 \ : LogK1*log(v*LogK2) + 0.5 ) mask = CODE_MASK; if (n >= stride) { if (stride == 3) { r2 = wp[0] = (uint16) CLAMP(ip[0]); g2 = wp[1] = (uint16) CLAMP(ip[1]); b2 = wp[2] = (uint16) CLAMP(ip[2]); n -= 3; while (n > 0) { n -= 3; wp += 3; ip += 3; r1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1; g1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1; b1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1; } } else if (stride == 4) { r2 = wp[0] = (uint16) CLAMP(ip[0]); g2 = wp[1] = (uint16) CLAMP(ip[1]); b2 = wp[2] = (uint16) CLAMP(ip[2]); a2 = wp[3] = (uint16) CLAMP(ip[3]); n -= 4; while (n > 0) { n -= 4; wp += 4; ip += 4; r1 = (int32) CLAMP(ip[0]); wp[0] = (uint16)((r1-r2) & mask); r2 = r1; g1 = (int32) CLAMP(ip[1]); wp[1] = (uint16)((g1-g2) & mask); g2 = g1; b1 = (int32) CLAMP(ip[2]); wp[2] = (uint16)((b1-b2) & mask); b2 = b1; a1 = (int32) CLAMP(ip[3]); wp[3] = (uint16)((a1-a2) & mask); a2 = a1; } } else { ip += n - 1; /* point to last one */ wp += n - 1; /* point to last one */ n -= stride; while (n > 0) { REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp[stride] -= wp[0]; wp[stride] &= mask; wp--; ip--) n -= stride; } REPEAT(stride, wp[0] = (uint16) CLAMP(ip[0]); wp--; ip--) } } } ",1 "clump_splay_app(clump_t *root, gs_ref_memory_t *imem, splay_app_result_t (*fn)(clump_t *, void *), void *arg) { clump_t *step_to; clump_t *cp = root; int from = SPLAY_FROM_ABOVE; splay_app_result_t res; SANITY_CHECK(cp); while (cp) { if (from == SPLAY_FROM_ABOVE) { /* We have arrived from above. Step left. */ step_to = cp->left; if (step_to) { from = SPLAY_FROM_ABOVE; cp = step_to; } else { /* No left to step to, so imagine we have just arrived from the left */ from = SPLAY_FROM_LEFT; } } if (from == SPLAY_FROM_LEFT) { /* We have arrived from the left. Step right. */ step_to = cp->right; if (step_to) { from = SPLAY_FROM_ABOVE; cp = step_to; } else { /* No right to step to, so imagine we have just arrived from the right. */ from = SPLAY_FROM_RIGHT; } } if (from == SPLAY_FROM_RIGHT) { /* We have arrived from the right. Step up. */ step_to = cp->parent; if (step_to) { from = (step_to->left == cp ? SPLAY_FROM_LEFT : SPLAY_FROM_RIGHT); } res = fn(cp, arg); if (res & SPLAY_APP_STOP) return cp; cp = step_to; } } return cp; } ",0 "int sm_looptest_fast_mode_start(p_fm_config_conx_hdlt hdl, fm_mgr_type_t mgr, int argc, char *argv[]) { fm_mgr_config_errno_t res; fm_msg_ret_code_t ret_code; int numpkts=4; uint8_t data[BUF_SZ]; if (argc > 1) { printf(""Error: only 1 argument expected\n""); return 0; } if (argc == 1) { numpkts = atol(argv[0]); if (numpkts < 0 || numpkts > 10) { printf(""Error: number of packets must be from 0 to 10\n""); return 0; } } *(int*)data = numpkts; if((res = fm_mgr_simple_query(hdl, FM_ACT_GET, FM_DT_SM_LOOP_TEST_FAST_MODE_START, mgr, BUF_SZ, data, &ret_code)) != FM_CONF_OK) { fprintf(stderr, ""sm_looptest_fast_mode_start: Failed to retrieve data: \n"" ""\tError:(%d) %s \n\tRet code:(%d) %s\n"", res, fm_mgr_get_error_str(res),ret_code, fm_mgr_get_resp_error_str(ret_code)); } else { printf(""Successfully sent Loop Test Fast Mode START control (%d inject packets) to local SM instance\n"", numpkts); data[BUF_SZ-1]=0; printf(""%s"", (char*) data); } return 0; } ",0 "inline bool HasScripting() { return (NPNFuncs.version >= NPVERS_HAS_NPRUNTIME_SCRIPTING); } ",0 "static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) { void __user *uaddr = (void __user *)(long)reg->addr; u64 val; int ret; ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id)); if (ret != 0) return -EFAULT; return kvm_arm_timer_set_reg(vcpu, reg->id, val); } ",0 "long Track::GetType() const { return m_info.type; } ",0 "bool PlatformSensorFusion::IsSuspended() { for (auto& client : clients_) { if (!client.IsSuspended()) return false; } return true; } ",0 "void Document::UnregisterNodeListWithIdNameCache(const LiveNodeListBase* list) { DCHECK(node_lists_[kInvalidateOnIdNameAttrChange].Contains(list)); node_lists_[kInvalidateOnIdNameAttrChange].erase(list); } ",0 "void InterstitialPageImpl::InterstitialPageRVHDelegateView::HidePopupMenu() { NOTREACHED() << ""InterstitialPage does not support showing popup menus.""; } ",0 "static inline void __pipe_unlock(struct pipe_inode_info *pipe) { mutex_unlock(&pipe->mutex); } ",0 "void WebLocalFrameImpl::ReloadLoFiImages() { GetFrame()->GetDocument()->Fetcher()->ReloadLoFiImages(); } ",0 "static void cqspi_configure(struct spi_nor *nor) { struct cqspi_flash_pdata *f_pdata = nor->priv; struct cqspi_st *cqspi = f_pdata->cqspi; const unsigned int sclk = f_pdata->clk_rate; int switch_cs = (cqspi->current_cs != f_pdata->cs); int switch_ck = (cqspi->sclk != sclk); if ((cqspi->current_page_size != nor->page_size) || (cqspi->current_erase_size != nor->mtd.erasesize) || (cqspi->current_addr_width != nor->addr_width)) switch_cs = 1; if (switch_cs || switch_ck) cqspi_controller_enable(cqspi, 0); /* Switch chip select. */ if (switch_cs) { cqspi->current_cs = f_pdata->cs; cqspi_configure_cs_and_sizes(nor); } /* Setup baudrate divisor and delays */ if (switch_ck) { cqspi->sclk = sclk; cqspi_config_baudrate_div(cqspi); cqspi_delay(nor); cqspi_readdata_capture(cqspi, 1, f_pdata->read_delay); } if (switch_cs || switch_ck) cqspi_controller_enable(cqspi, 1); } ",0 "static int intel_snb_pebs_broken(int cpu) { u32 rev = UINT_MAX; /* default to broken for unknown models */ switch (cpu_data(cpu).x86_model) { case 42: /* SNB */ rev = 0x28; break; case 45: /* SNB-EP */ switch (cpu_data(cpu).x86_mask) { case 6: rev = 0x618; break; case 7: rev = 0x70c; break; } } return (cpu_data(cpu).microcode < rev); } ",0 "static inline bool nested_svm_intr(struct vcpu_svm *svm) { if (!is_guest_mode(&svm->vcpu)) return true; if (!(svm->vcpu.arch.hflags & HF_VINTR_MASK)) return true; if (!(svm->vcpu.arch.hflags & HF_HIF_MASK)) return false; /* * if vmexit was already requested (by intercepted exception * for instance) do not overwrite it with ""external interrupt"" * vmexit. */ if (svm->nested.exit_required) return false; svm->vmcb->control.exit_code = SVM_EXIT_INTR; svm->vmcb->control.exit_info_1 = 0; svm->vmcb->control.exit_info_2 = 0; if (svm->nested.intercept & 1ULL) { /* * The #vmexit can't be emulated here directly because this * code path runs with irqs and preemption disabled. A * #vmexit emulation might sleep. Only signal request for * the #vmexit here. */ svm->nested.exit_required = true; trace_kvm_nested_intr_vmexit(svm->vmcb->save.rip); return false; } return true; } ",0 "void RecordDaysSinceEnabledMetric(int days_since_enabled) { UMA_HISTOGRAM_CUSTOM_COUNTS(""DataReductionProxy.DaysSinceEnabled"", days_since_enabled, 0, 365 * 10, 100); } ",0 " void UpdateProviderPolicy(const PolicyMap& policy) { PolicyMap policy_with_defaults; policy_with_defaults.CopyFrom(policy); #if defined(OS_CHROMEOS) SetEnterpriseUsersDefaults(&policy_with_defaults); #endif provider_.UpdateChromePolicy(policy_with_defaults); DCHECK(base::MessageLoopCurrent::Get()); base::RunLoop loop; loop.RunUntilIdle(); } ",0 " static void finalizeStreamTask(void* context) { OwnPtr blobRegistryContext = adoptPtr(static_cast(context)); blobRegistry().finalizeStream(blobRegistryContext->url); } ",1 "bool GLES2DecoderImpl::Initialize( const scoped_refptr& surface, const scoped_refptr& context, const gfx::Size& size, const DisallowedExtensions& disallowed_extensions, const char* allowed_extensions, const std::vector& attribs) { DCHECK(context); DCHECK(!context_.get()); surface_ = surface; context_ = context; if (!MakeCurrent()) { LOG(ERROR) << ""GLES2DecoderImpl::Initialize failed because "" << ""MakeCurrent failed.""; Destroy(); return false; } if (!group_->Initialize(disallowed_extensions, allowed_extensions)) { LOG(ERROR) << ""GpuScheduler::InitializeCommon failed because group "" << ""failed to initialize.""; Destroy(); return false; } CHECK_GL_ERROR(); disallowed_extensions_ = disallowed_extensions; vertex_attrib_manager_.Initialize(group_->max_vertex_attribs()); util_.set_num_compressed_texture_formats( validators_->compressed_texture_format.GetValues().size()); if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { glEnableVertexAttribArray(0); } glGenBuffersARB(1, &attrib_0_buffer_id_); glBindBuffer(GL_ARRAY_BUFFER, attrib_0_buffer_id_); glVertexAttribPointer(0, 1, GL_FLOAT, GL_FALSE, 0, NULL); glBindBuffer(GL_ARRAY_BUFFER, 0); glGenBuffersARB(1, &fixed_attrib_buffer_id_); texture_units_.reset( new TextureUnit[group_->max_texture_units()]); for (uint32 tt = 0; tt < group_->max_texture_units(); ++tt) { glActiveTexture(GL_TEXTURE0 + tt); TextureManager::TextureInfo* info; if (feature_info_->feature_flags().oes_egl_image_external) { info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_EXTERNAL_OES); texture_units_[tt].bound_texture_external_oes = info; glBindTexture(GL_TEXTURE_EXTERNAL_OES, info->service_id()); } info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_CUBE_MAP); texture_units_[tt].bound_texture_cube_map = info; glBindTexture(GL_TEXTURE_CUBE_MAP, info->service_id()); info = texture_manager()->GetDefaultTextureInfo(GL_TEXTURE_2D); texture_units_[tt].bound_texture_2d = info; glBindTexture(GL_TEXTURE_2D, info->service_id()); } glActiveTexture(GL_TEXTURE0); CHECK_GL_ERROR(); ContextCreationAttribParser attrib_parser; if (!attrib_parser.Parse(attribs)) return false; GLint v = 0; glGetIntegerv(GL_ALPHA_BITS, &v); back_buffer_color_format_ = (attrib_parser.alpha_size_ != 0 && v > 0) ? GL_RGBA : GL_RGB; glGetIntegerv(GL_DEPTH_BITS, &v); back_buffer_has_depth_ = attrib_parser.depth_size_ != 0 && v > 0; glGetIntegerv(GL_STENCIL_BITS, &v); back_buffer_has_stencil_ = attrib_parser.stencil_size_ != 0 && v > 0; if (surface_->IsOffscreen()) { if (attrib_parser.samples_ > 0 && attrib_parser.sample_buffers_ > 0 && (context_->HasExtension(""GL_EXT_framebuffer_multisample"") || context_->HasExtension(""GL_ANGLE_framebuffer_multisample""))) { GLint max_sample_count = 1; glGetIntegerv(GL_MAX_SAMPLES_EXT, &max_sample_count); offscreen_target_samples_ = std::min(attrib_parser.samples_, max_sample_count); } else { offscreen_target_samples_ = 1; } if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2) { const bool rgb8_supported = context_->HasExtension(""GL_OES_rgb8_rgba8""); if (rgb8_supported && offscreen_target_samples_ > 1) { offscreen_target_color_format_ = attrib_parser.alpha_size_ > 0 ? GL_RGBA8 : GL_RGB8; } else { offscreen_target_samples_ = 1; offscreen_target_color_format_ = attrib_parser.alpha_size_ > 0 ? GL_RGBA : GL_RGB; } const bool depth24_stencil8_supported = context_->HasExtension(""GL_OES_packed_depth_stencil""); VLOG(1) << ""GL_OES_packed_depth_stencil "" << (depth24_stencil8_supported ? """" : ""not "") << ""supported.""; if ((attrib_parser.depth_size_ > 0 || attrib_parser.stencil_size_ > 0) && depth24_stencil8_supported) { offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; offscreen_target_stencil_format_ = 0; } else { offscreen_target_depth_format_ = attrib_parser.depth_size_ > 0 ? GL_DEPTH_COMPONENT16 : 0; offscreen_target_stencil_format_ = attrib_parser.stencil_size_ > 0 ? GL_STENCIL_INDEX8 : 0; } } else { offscreen_target_color_format_ = attrib_parser.alpha_size_ > 0 ? GL_RGBA : GL_RGB; const bool depth24_stencil8_supported = context_->HasExtension(""GL_EXT_packed_depth_stencil""); VLOG(1) << ""GL_EXT_packed_depth_stencil "" << (depth24_stencil8_supported ? """" : ""not "") << ""supported.""; if ((attrib_parser.depth_size_ > 0 || attrib_parser.stencil_size_ > 0) && depth24_stencil8_supported) { offscreen_target_depth_format_ = GL_DEPTH24_STENCIL8; offscreen_target_stencil_format_ = 0; } else { offscreen_target_depth_format_ = attrib_parser.depth_size_ > 0 ? GL_DEPTH_COMPONENT : 0; offscreen_target_stencil_format_ = attrib_parser.stencil_size_ > 0 ? GL_STENCIL_INDEX : 0; } } offscreen_saved_color_format_ = attrib_parser.alpha_size_ > 0 ? GL_RGBA : GL_RGB; offscreen_target_frame_buffer_.reset(new FrameBuffer(this)); offscreen_target_frame_buffer_->Create(); if (IsOffscreenBufferMultisampled()) { offscreen_target_color_render_buffer_.reset(new RenderBuffer(this)); offscreen_target_color_render_buffer_->Create(); } else { offscreen_target_color_texture_.reset(new Texture(this)); offscreen_target_color_texture_->Create(); } offscreen_target_depth_render_buffer_.reset(new RenderBuffer(this)); offscreen_target_depth_render_buffer_->Create(); offscreen_target_stencil_render_buffer_.reset(new RenderBuffer(this)); offscreen_target_stencil_render_buffer_->Create(); offscreen_saved_frame_buffer_.reset(new FrameBuffer(this)); offscreen_saved_frame_buffer_->Create(); offscreen_saved_color_texture_.reset(new Texture(this)); offscreen_saved_color_texture_->Create(); if (!ResizeOffscreenFrameBuffer(size)) { LOG(ERROR) << ""Could not allocate offscreen buffer storage.""; Destroy(); return false; } DoBindFramebuffer(GL_FRAMEBUFFER, 0); } if (gfx::GetGLImplementation() != gfx::kGLImplementationEGLGLES2) { glEnable(GL_VERTEX_PROGRAM_POINT_SIZE); glEnable(GL_POINT_SPRITE); } has_arb_robustness_ = context->HasExtension(""GL_ARB_robustness""); #if defined(OS_MACOSX) const char* vendor_str = reinterpret_cast( glGetString(GL_VENDOR)); needs_mac_nvidia_driver_workaround_ = vendor_str && strstr(vendor_str, ""NVIDIA""); #endif if (!InitializeShaderTranslator()) { return false; } return true; } ",0 "void SpeechSynthesis::resume() { if (!currentSpeechUtterance()) return; m_platformSpeechSynthesizer->resume(); } ",0 "bool Extension::LoadThemeTints(const DictionaryValue* theme_value, string16* error) { const DictionaryValue* tints_value = NULL; if (!theme_value->GetDictionary(keys::kThemeTints, &tints_value)) return true; for (DictionaryValue::Iterator iter(*tints_value); !iter.IsAtEnd(); iter.Advance()) { const ListValue* tint_list = NULL; double v = 0.0; if (!iter.value().GetAsList(&tint_list) || tint_list->GetSize() != 3 || !tint_list->GetDouble(0, &v) || !tint_list->GetDouble(1, &v) || !tint_list->GetDouble(2, &v)) { *error = ASCIIToUTF16(errors::kInvalidThemeTints); return false; } } theme_tints_.reset(tints_value->DeepCopy()); return true; } ",0 "static Image *ReadOneMNGImage(MngInfo* mng_info, const ImageInfo *image_info, ExceptionInfo *exception) { char page_geometry[MaxTextExtent]; Image *image; MagickBooleanType logging; volatile int first_mng_object, object_id, term_chunk_found, skip_to_iend; volatile ssize_t image_count=0; MagickBooleanType status; MagickOffsetType offset; MngBox default_fb, fb, previous_fb; #if defined(MNG_INSERT_LAYERS) PixelPacket mng_background_color; #endif register unsigned char *p; register ssize_t i; size_t count; ssize_t loop_level; volatile short skipping_loop; #if defined(MNG_INSERT_LAYERS) unsigned int mandatory_back=0; #endif volatile unsigned int #ifdef MNG_OBJECT_BUFFERS mng_background_object=0, #endif mng_type=0; /* 0: PNG or JNG; 1: MNG; 2: MNG-LC; 3: MNG-VLC */ size_t default_frame_timeout, frame_timeout, #if defined(MNG_INSERT_LAYERS) image_height, image_width, #endif length; /* These delays are all measured in image ticks_per_second, * not in MNG ticks_per_second */ volatile size_t default_frame_delay, final_delay, final_image_delay, frame_delay, #if defined(MNG_INSERT_LAYERS) insert_layers, #endif mng_iterations=1, simplicity=0, subframe_height=0, subframe_width=0; previous_fb.top=0; previous_fb.bottom=0; previous_fb.left=0; previous_fb.right=0; default_fb.top=0; default_fb.bottom=0; default_fb.left=0; default_fb.right=0; logging=LogMagickEvent(CoderEvent,GetMagickModule(), "" Enter ReadOneMNGImage()""); image=mng_info->image; if (LocaleCompare(image_info->magick,""MNG"") == 0) { char magic_number[MaxTextExtent]; /* Verify MNG signature. */ count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number); if (memcmp(magic_number,""\212MNG\r\n\032\n"",8) != 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); /* Initialize some nonzero members of the MngInfo structure. */ for (i=0; i < MNG_MAX_OBJECTS; i++) { mng_info->object_clip[i].right=(ssize_t) PNG_UINT_31_MAX; mng_info->object_clip[i].bottom=(ssize_t) PNG_UINT_31_MAX; } mng_info->exists[0]=MagickTrue; } skipping_loop=(-1); first_mng_object=MagickTrue; mng_type=0; #if defined(MNG_INSERT_LAYERS) insert_layers=MagickFalse; /* should be False when converting or mogrifying */ #endif default_frame_delay=0; default_frame_timeout=0; frame_delay=0; final_delay=1; mng_info->ticks_per_second=1UL*image->ticks_per_second; object_id=0; skip_to_iend=MagickFalse; term_chunk_found=MagickFalse; mng_info->framing_mode=1; #if defined(MNG_INSERT_LAYERS) mandatory_back=MagickFalse; #endif #if defined(MNG_INSERT_LAYERS) mng_background_color=image->background_color; #endif default_fb=mng_info->frame; previous_fb=mng_info->frame; do { char type[MaxTextExtent]; if (LocaleCompare(image_info->magick,""MNG"") == 0) { unsigned char *chunk; /* Read a new chunk. */ type[0]='\0'; (void) ConcatenateMagickString(type,""errr"",MaxTextExtent); length=ReadBlobMSBLong(image); count=(size_t) ReadBlob(image,4,(unsigned char *) type); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Reading MNG chunk type %c%c%c%c, length: %.20g"", type[0],type[1],type[2],type[3],(double) length); if (length > PNG_UINT_31_MAX) { status=MagickFalse; break; } if (count == 0) ThrowReaderException(CorruptImageError,""CorruptImage""); p=NULL; chunk=(unsigned char *) NULL; if (length != 0) { if (length > GetBlobSize(image)) ThrowReaderException(CorruptImageError, ""InsufficientImageDataInFile""); chunk=(unsigned char *) AcquireQuantumMemory(length+ MagickPathExtent,sizeof(*chunk)); if (chunk == (unsigned char *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); for (i=0; i < (ssize_t) length; i++) { int c; c=ReadBlobByte(image); if (c == EOF) break; chunk[i]=(unsigned char) c; } p=chunk; } (void) ReadBlobMSBLong(image); /* read crc word */ #if !defined(JNG_SUPPORTED) if (memcmp(type,mng_JHDR,4) == 0) { skip_to_iend=MagickTrue; if (mng_info->jhdr_warning == 0) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""JNGCompressNotSupported"",""`%s'"",image->filename); mng_info->jhdr_warning++; } #endif if (memcmp(type,mng_DHDR,4) == 0) { skip_to_iend=MagickTrue; if (mng_info->dhdr_warning == 0) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""DeltaPNGNotSupported"",""`%s'"",image->filename); mng_info->dhdr_warning++; } if (memcmp(type,mng_MEND,4) == 0) break; if (skip_to_iend) { if (memcmp(type,mng_IEND,4) == 0) skip_to_iend=MagickFalse; if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Skip to IEND.""); continue; } if (memcmp(type,mng_MHDR,4) == 0) { if (length != 28) { chunk=(unsigned char *) RelinquishMagickMemory(chunk); ThrowReaderException(CorruptImageError,""CorruptImage""); } mng_info->mng_width=(size_t) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); mng_info->mng_height=(size_t) ((p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]); if (logging != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" MNG width: %.20g"",(double) mng_info->mng_width); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" MNG height: %.20g"",(double) mng_info->mng_height); } p+=8; mng_info->ticks_per_second=(size_t) mng_get_long(p); if (mng_info->ticks_per_second == 0) default_frame_delay=0; else default_frame_delay=1UL*image->ticks_per_second/ mng_info->ticks_per_second; frame_delay=default_frame_delay; simplicity=0; /* Skip nominal layer count, frame count, and play time */ p+=16; simplicity=(size_t) mng_get_long(p); mng_type=1; /* Full MNG */ if ((simplicity != 0) && ((simplicity | 11) == 11)) mng_type=2; /* LC */ if ((simplicity != 0) && ((simplicity | 9) == 9)) mng_type=3; /* VLC */ #if defined(MNG_INSERT_LAYERS) if (mng_type != 3) insert_layers=MagickTrue; #endif if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) return(DestroyImageList(image)); image=SyncNextImageInList(image); mng_info->image=image; } if ((mng_info->mng_width > 65535L) || (mng_info->mng_height > 65535L)) { chunk=(unsigned char *) RelinquishMagickMemory(chunk); ThrowReaderException(ImageError,""WidthOrHeightExceedsLimit""); } (void) FormatLocaleString(page_geometry,MaxTextExtent, ""%.20gx%.20g+0+0"",(double) mng_info->mng_width,(double) mng_info->mng_height); mng_info->frame.left=0; mng_info->frame.right=(ssize_t) mng_info->mng_width; mng_info->frame.top=0; mng_info->frame.bottom=(ssize_t) mng_info->mng_height; mng_info->clip=default_fb=previous_fb=mng_info->frame; for (i=0; i < MNG_MAX_OBJECTS; i++) mng_info->object_clip[i]=mng_info->frame; chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_TERM,4) == 0) { int repeat=0; if (length != 0) repeat=p[0]; if (repeat == 3 && length > 8) { final_delay=(png_uint_32) mng_get_long(&p[2]); mng_iterations=(png_uint_32) mng_get_long(&p[6]); if (mng_iterations == PNG_UINT_31_MAX) mng_iterations=0; image->iterations=mng_iterations; term_chunk_found=MagickTrue; } if (logging != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" repeat=%d, final_delay=%.20g, iterations=%.20g"", repeat,(double) final_delay, (double) image->iterations); } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_DEFI,4) == 0) { if (mng_type == 3) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""DEFI chunk found in MNG-VLC datastream"",""`%s'"", image->filename); if (length > 1) { object_id=(p[0] << 8) | p[1]; if (mng_type == 2 && object_id != 0) (void) ThrowMagickException(&image->exception, GetMagickModule(), CoderError,""Nonzero object_id in MNG-LC datastream"", ""`%s'"", image->filename); if (object_id > MNG_MAX_OBJECTS) { /* Instead of using a warning we should allocate a larger MngInfo structure and continue. */ (void) ThrowMagickException(&image->exception, GetMagickModule(), CoderError, ""object id too large"",""`%s'"",image->filename); object_id=MNG_MAX_OBJECTS; } if (mng_info->exists[object_id]) if (mng_info->frozen[object_id]) { chunk=(unsigned char *) RelinquishMagickMemory(chunk); (void) ThrowMagickException(&image->exception, GetMagickModule(),CoderError, ""DEFI cannot redefine a frozen MNG object"",""`%s'"", image->filename); continue; } mng_info->exists[object_id]=MagickTrue; if (length > 2) mng_info->invisible[object_id]=p[2]; /* Extract object offset info. */ if (length > 11) { mng_info->x_off[object_id]=(ssize_t) ((p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]); mng_info->y_off[object_id]=(ssize_t) ((p[8] << 24) | (p[9] << 16) | (p[10] << 8) | p[11]); if (logging != MagickFalse) { (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" x_off[%d]: %.20g, y_off[%d]: %.20g"", object_id,(double) mng_info->x_off[object_id], object_id,(double) mng_info->y_off[object_id]); } } /* Extract object clipping info. */ if (length > 27) mng_info->object_clip[object_id]= mng_read_box(mng_info->frame,0, &p[12]); } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_bKGD,4) == 0) { mng_info->have_global_bkgd=MagickFalse; if (length > 5) { mng_info->mng_global_bkgd.red= ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1])); mng_info->mng_global_bkgd.green= ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3])); mng_info->mng_global_bkgd.blue= ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5])); mng_info->have_global_bkgd=MagickTrue; } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_BACK,4) == 0) { #if defined(MNG_INSERT_LAYERS) if (length > 6) mandatory_back=p[6]; else mandatory_back=0; if (mandatory_back && length > 5) { mng_background_color.red= ScaleShortToQuantum((unsigned short) ((p[0] << 8) | p[1])); mng_background_color.green= ScaleShortToQuantum((unsigned short) ((p[2] << 8) | p[3])); mng_background_color.blue= ScaleShortToQuantum((unsigned short) ((p[4] << 8) | p[5])); mng_background_color.opacity=OpaqueOpacity; } #ifdef MNG_OBJECT_BUFFERS if (length > 8) mng_background_object=(p[7] << 8) | p[8]; #endif #endif chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_PLTE,4) == 0) { /* Read global PLTE. */ if (length && (length < 769)) { if (mng_info->global_plte == (png_colorp) NULL) mng_info->global_plte=(png_colorp) AcquireQuantumMemory(256, sizeof(*mng_info->global_plte)); for (i=0; i < (ssize_t) (length/3); i++) { mng_info->global_plte[i].red=p[3*i]; mng_info->global_plte[i].green=p[3*i+1]; mng_info->global_plte[i].blue=p[3*i+2]; } mng_info->global_plte_length=(unsigned int) (length/3); } #ifdef MNG_LOOSE for ( ; i < 256; i++) { mng_info->global_plte[i].red=i; mng_info->global_plte[i].green=i; mng_info->global_plte[i].blue=i; } if (length != 0) mng_info->global_plte_length=256; #endif else mng_info->global_plte_length=0; chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_tRNS,4) == 0) { /* read global tRNS */ if (length > 0 && length < 257) for (i=0; i < (ssize_t) length; i++) mng_info->global_trns[i]=p[i]; #ifdef MNG_LOOSE for ( ; i < 256; i++) mng_info->global_trns[i]=255; #endif mng_info->global_trns_length=(unsigned int) length; chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_gAMA,4) == 0) { if (length == 4) { ssize_t igamma; igamma=mng_get_long(p); mng_info->global_gamma=((float) igamma)*0.00001; mng_info->have_global_gama=MagickTrue; } else mng_info->have_global_gama=MagickFalse; chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_cHRM,4) == 0) { /* Read global cHRM */ if (length == 32) { mng_info->global_chrm.white_point.x=0.00001*mng_get_long(p); mng_info->global_chrm.white_point.y=0.00001*mng_get_long(&p[4]); mng_info->global_chrm.red_primary.x=0.00001*mng_get_long(&p[8]); mng_info->global_chrm.red_primary.y=0.00001* mng_get_long(&p[12]); mng_info->global_chrm.green_primary.x=0.00001* mng_get_long(&p[16]); mng_info->global_chrm.green_primary.y=0.00001* mng_get_long(&p[20]); mng_info->global_chrm.blue_primary.x=0.00001* mng_get_long(&p[24]); mng_info->global_chrm.blue_primary.y=0.00001* mng_get_long(&p[28]); mng_info->have_global_chrm=MagickTrue; } else mng_info->have_global_chrm=MagickFalse; chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_sRGB,4) == 0) { /* Read global sRGB. */ if (length != 0) { mng_info->global_srgb_intent= Magick_RenderingIntent_from_PNG_RenderingIntent(p[0]); mng_info->have_global_srgb=MagickTrue; } else mng_info->have_global_srgb=MagickFalse; chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_iCCP,4) == 0) { /* To do: */ /* Read global iCCP. */ if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_FRAM,4) == 0) { if (mng_type == 3) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""FRAM chunk found in MNG-VLC datastream"",""`%s'"", image->filename); if ((mng_info->framing_mode == 2) || (mng_info->framing_mode == 4)) image->delay=frame_delay; frame_delay=default_frame_delay; frame_timeout=default_frame_timeout; fb=default_fb; if (length > 0) if (p[0]) mng_info->framing_mode=p[0]; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Framing_mode=%d"",mng_info->framing_mode); if (length > 6) { /* Note the delay and frame clipping boundaries. */ p++; /* framing mode */ while (*p && ((p-chunk) < (ssize_t) length)) p++; /* frame name */ p++; /* frame name terminator */ if ((p-chunk) < (ssize_t) (length-4)) { int change_delay, change_timeout, change_clipping; change_delay=(*p++); change_timeout=(*p++); change_clipping=(*p++); p++; /* change_sync */ if (change_delay && (p-chunk) < (ssize_t) (length-4)) { frame_delay=1UL*image->ticks_per_second* mng_get_long(p); if (mng_info->ticks_per_second != 0) frame_delay/=mng_info->ticks_per_second; else frame_delay=PNG_UINT_31_MAX; if (change_delay == 2) default_frame_delay=frame_delay; p+=4; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Framing_delay=%.20g"",(double) frame_delay); } if (change_timeout && (p-chunk) < (ssize_t) (length-4)) { frame_timeout=1UL*image->ticks_per_second* mng_get_long(p); if (mng_info->ticks_per_second != 0) frame_timeout/=mng_info->ticks_per_second; else frame_timeout=PNG_UINT_31_MAX; if (change_timeout == 2) default_frame_timeout=frame_timeout; p+=4; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Framing_timeout=%.20g"",(double) frame_timeout); } if (change_clipping && (p-chunk) < (ssize_t) (length-17)) { fb=mng_read_box(previous_fb,(char) p[0],&p[1]); p+=17; previous_fb=fb; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Frame_clip: L=%.20g R=%.20g T=%.20g B=%.20g"", (double) fb.left,(double) fb.right,(double) fb.top, (double) fb.bottom); if (change_clipping == 2) default_fb=fb; } } } mng_info->clip=fb; mng_info->clip=mng_minimum_box(fb,mng_info->frame); subframe_width=(size_t) (mng_info->clip.right -mng_info->clip.left); subframe_height=(size_t) (mng_info->clip.bottom -mng_info->clip.top); /* Insert a background layer behind the frame if framing_mode is 4. */ #if defined(MNG_INSERT_LAYERS) if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" subframe_width=%.20g, subframe_height=%.20g"",(double) subframe_width,(double) subframe_height); if (insert_layers && (mng_info->framing_mode == 4) && (subframe_width) && (subframe_height)) { /* Allocate next image structure. */ if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL) { AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) return(DestroyImageList(image)); image=SyncNextImageInList(image); } mng_info->image=image; if (term_chunk_found) { image->start_loop=MagickTrue; image->iterations=mng_iterations; term_chunk_found=MagickFalse; } else image->start_loop=MagickFalse; image->columns=subframe_width; image->rows=subframe_height; image->page.width=subframe_width; image->page.height=subframe_height; image->page.x=mng_info->clip.left; image->page.y=mng_info->clip.top; image->background_color=mng_background_color; image->matte=MagickFalse; image->delay=0; (void) SetImageBackgroundColor(image); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Insert backgd layer, L=%.20g, R=%.20g T=%.20g, B=%.20g"", (double) mng_info->clip.left,(double) mng_info->clip.right, (double) mng_info->clip.top,(double) mng_info->clip.bottom); } #endif chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_CLIP,4) == 0) { unsigned int first_object, last_object; /* Read CLIP. */ if (length > 3) { first_object=(p[0] << 8) | p[1]; last_object=(p[2] << 8) | p[3]; p+=4; for (i=(int) first_object; i <= (int) last_object; i++) { if (mng_info->exists[i] && !mng_info->frozen[i]) { MngBox box; box=mng_info->object_clip[i]; if ((p-chunk) < (ssize_t) (length-17)) mng_info->object_clip[i]= mng_read_box(box,(char) p[0],&p[1]); } } } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_SAVE,4) == 0) { for (i=1; i < MNG_MAX_OBJECTS; i++) if (mng_info->exists[i]) { mng_info->frozen[i]=MagickTrue; #ifdef MNG_OBJECT_BUFFERS if (mng_info->ob[i] != (MngBuffer *) NULL) mng_info->ob[i]->frozen=MagickTrue; #endif } if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if ((memcmp(type,mng_DISC,4) == 0) || (memcmp(type,mng_SEEK,4) == 0)) { /* Read DISC or SEEK. */ if ((length == 0) || !memcmp(type,mng_SEEK,4)) { for (i=1; i < MNG_MAX_OBJECTS; i++) MngInfoDiscardObject(mng_info,i); } else { register ssize_t j; for (j=1; j < (ssize_t) length; j+=2) { i=p[j-1] << 8 | p[j]; MngInfoDiscardObject(mng_info,i); } } if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_MOVE,4) == 0) { size_t first_object, last_object; /* read MOVE */ if (length > 3) { first_object=(p[0] << 8) | p[1]; last_object=(p[2] << 8) | p[3]; p+=4; for (i=(ssize_t) first_object; i <= (ssize_t) last_object; i++) { if ((i < 0) || (i >= MNG_MAX_OBJECTS)) continue; if (mng_info->exists[i] && !mng_info->frozen[i] && (p-chunk) < (ssize_t) (length-8)) { MngPair new_pair; MngPair old_pair; old_pair.a=mng_info->x_off[i]; old_pair.b=mng_info->y_off[i]; new_pair=mng_read_pair(old_pair,(int) p[0],&p[1]); mng_info->x_off[i]=new_pair.a; mng_info->y_off[i]=new_pair.b; } } } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_LOOP,4) == 0) { ssize_t loop_iters=1; if (length > 4) { loop_level=chunk[0]; mng_info->loop_active[loop_level]=1; /* mark loop active */ /* Record starting point. */ loop_iters=mng_get_long(&chunk[1]); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" LOOP level %.20g has %.20g iterations "", (double) loop_level, (double) loop_iters); if (loop_iters == 0) skipping_loop=loop_level; else { mng_info->loop_jump[loop_level]=TellBlob(image); mng_info->loop_count[loop_level]=loop_iters; } mng_info->loop_iteration[loop_level]=0; } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_ENDL,4) == 0) { if (length > 0) { loop_level=chunk[0]; if (skipping_loop > 0) { if (skipping_loop == loop_level) { /* Found end of zero-iteration loop. */ skipping_loop=(-1); mng_info->loop_active[loop_level]=0; } } else { if (mng_info->loop_active[loop_level] == 1) { mng_info->loop_count[loop_level]--; mng_info->loop_iteration[loop_level]++; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" ENDL: LOOP level %.20g has %.20g remaining iters "", (double) loop_level,(double) mng_info->loop_count[loop_level]); if (mng_info->loop_count[loop_level] != 0) { offset=SeekBlob(image, mng_info->loop_jump[loop_level], SEEK_SET); if (offset < 0) { chunk=(unsigned char *) RelinquishMagickMemory( chunk); ThrowReaderException(CorruptImageError, ""ImproperImageHeader""); } } else { short last_level; /* Finished loop. */ mng_info->loop_active[loop_level]=0; last_level=(-1); for (i=0; i < loop_level; i++) if (mng_info->loop_active[i] == 1) last_level=(short) i; loop_level=last_level; } } } } chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_CLON,4) == 0) { if (mng_info->clon_warning == 0) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""CLON is not implemented yet"",""`%s'"", image->filename); mng_info->clon_warning++; } if (memcmp(type,mng_MAGN,4) == 0) { png_uint_16 magn_first, magn_last, magn_mb, magn_ml, magn_mr, magn_mt, magn_mx, magn_my, magn_methx, magn_methy; if (length > 1) magn_first=(p[0] << 8) | p[1]; else magn_first=0; if (length > 3) magn_last=(p[2] << 8) | p[3]; else magn_last=magn_first; #ifndef MNG_OBJECT_BUFFERS if (magn_first || magn_last) if (mng_info->magn_warning == 0) { (void) ThrowMagickException(&image->exception, GetMagickModule(),CoderError, ""MAGN is not implemented yet for nonzero objects"", ""`%s'"",image->filename); mng_info->magn_warning++; } #endif if (length > 4) magn_methx=p[4]; else magn_methx=0; if (length > 6) magn_mx=(p[5] << 8) | p[6]; else magn_mx=1; if (magn_mx == 0) magn_mx=1; if (length > 8) magn_my=(p[7] << 8) | p[8]; else magn_my=magn_mx; if (magn_my == 0) magn_my=1; if (length > 10) magn_ml=(p[9] << 8) | p[10]; else magn_ml=magn_mx; if (magn_ml == 0) magn_ml=1; if (length > 12) magn_mr=(p[11] << 8) | p[12]; else magn_mr=magn_mx; if (magn_mr == 0) magn_mr=1; if (length > 14) magn_mt=(p[13] << 8) | p[14]; else magn_mt=magn_my; if (magn_mt == 0) magn_mt=1; if (length > 16) magn_mb=(p[15] << 8) | p[16]; else magn_mb=magn_my; if (magn_mb == 0) magn_mb=1; if (length > 17) magn_methy=p[17]; else magn_methy=magn_methx; if (magn_methx > 5 || magn_methy > 5) if (mng_info->magn_warning == 0) { (void) ThrowMagickException(&image->exception, GetMagickModule(),CoderError, ""Unknown MAGN method in MNG datastream"",""`%s'"", image->filename); mng_info->magn_warning++; } #ifdef MNG_OBJECT_BUFFERS /* Magnify existing objects in the range magn_first to magn_last */ #endif if (magn_first == 0 || magn_last == 0) { /* Save the magnification factors for object 0 */ mng_info->magn_mb=magn_mb; mng_info->magn_ml=magn_ml; mng_info->magn_mr=magn_mr; mng_info->magn_mt=magn_mt; mng_info->magn_mx=magn_mx; mng_info->magn_my=magn_my; mng_info->magn_methx=magn_methx; mng_info->magn_methy=magn_methy; } } if (memcmp(type,mng_PAST,4) == 0) { if (mng_info->past_warning == 0) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""PAST is not implemented yet"",""`%s'"", image->filename); mng_info->past_warning++; } if (memcmp(type,mng_SHOW,4) == 0) { if (mng_info->show_warning == 0) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""SHOW is not implemented yet"",""`%s'"", image->filename); mng_info->show_warning++; } if (memcmp(type,mng_sBIT,4) == 0) { if (length < 4) mng_info->have_global_sbit=MagickFalse; else { mng_info->global_sbit.gray=p[0]; mng_info->global_sbit.red=p[0]; mng_info->global_sbit.green=p[1]; mng_info->global_sbit.blue=p[2]; mng_info->global_sbit.alpha=p[3]; mng_info->have_global_sbit=MagickTrue; } } if (memcmp(type,mng_pHYs,4) == 0) { if (length > 8) { mng_info->global_x_pixels_per_unit= (size_t) mng_get_long(p); mng_info->global_y_pixels_per_unit= (size_t) mng_get_long(&p[4]); mng_info->global_phys_unit_type=p[8]; mng_info->have_global_phys=MagickTrue; } else mng_info->have_global_phys=MagickFalse; } if (memcmp(type,mng_pHYg,4) == 0) { if (mng_info->phyg_warning == 0) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""pHYg is not implemented."",""`%s'"",image->filename); mng_info->phyg_warning++; } if (memcmp(type,mng_BASI,4) == 0) { skip_to_iend=MagickTrue; if (mng_info->basi_warning == 0) (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""BASI is not implemented yet"",""`%s'"", image->filename); mng_info->basi_warning++; #ifdef MNG_BASI_SUPPORTED if (length > 11) { basi_width=(size_t) ((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]); basi_height=(size_t) ((p[4] << 24) | (p[5] << 16) | (p[6] << 8) | p[7]); basi_color_type=p[8]; basi_compression_method=p[9]; basi_filter_type=p[10]; basi_interlace_method=p[11]; } if (length > 13) basi_red=(p[12] << 8) & p[13]; else basi_red=0; if (length > 15) basi_green=(p[14] << 8) & p[15]; else basi_green=0; if (length > 17) basi_blue=(p[16] << 8) & p[17]; else basi_blue=0; if (length > 19) basi_alpha=(p[18] << 8) & p[19]; else { if (basi_sample_depth == 16) basi_alpha=65535L; else basi_alpha=255; } if (length > 20) basi_viewable=p[20]; else basi_viewable=0; #endif chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } if (memcmp(type,mng_IHDR,4) #if defined(JNG_SUPPORTED) && memcmp(type,mng_JHDR,4) #endif ) { /* Not an IHDR or JHDR chunk */ if (length != 0) chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } /* Process IHDR */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Processing %c%c%c%c chunk"",type[0],type[1],type[2],type[3]); mng_info->exists[object_id]=MagickTrue; mng_info->viewable[object_id]=MagickTrue; if (mng_info->invisible[object_id]) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Skipping invisible object""); skip_to_iend=MagickTrue; chunk=(unsigned char *) RelinquishMagickMemory(chunk); continue; } #if defined(MNG_INSERT_LAYERS) if (length < 8) { chunk=(unsigned char *) RelinquishMagickMemory(chunk); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } image_width=(size_t) mng_get_long(p); image_height=(size_t) mng_get_long(&p[4]); #endif chunk=(unsigned char *) RelinquishMagickMemory(chunk); /* Insert a transparent background layer behind the entire animation if it is not full screen. */ #if defined(MNG_INSERT_LAYERS) if (insert_layers && mng_type && first_mng_object) { if ((mng_info->clip.left > 0) || (mng_info->clip.top > 0) || (image_width < mng_info->mng_width) || (mng_info->clip.right < (ssize_t) mng_info->mng_width) || (image_height < mng_info->mng_height) || (mng_info->clip.bottom < (ssize_t) mng_info->mng_height)) { if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) return(DestroyImageList(image)); image=SyncNextImageInList(image); } mng_info->image=image; if (term_chunk_found) { image->start_loop=MagickTrue; image->iterations=mng_iterations; term_chunk_found=MagickFalse; } else image->start_loop=MagickFalse; /* Make a background rectangle. */ image->delay=0; image->columns=mng_info->mng_width; image->rows=mng_info->mng_height; image->page.width=mng_info->mng_width; image->page.height=mng_info->mng_height; image->page.x=0; image->page.y=0; image->background_color=mng_background_color; (void) SetImageBackgroundColor(image); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Inserted transparent background layer, W=%.20g, H=%.20g"", (double) mng_info->mng_width,(double) mng_info->mng_height); } } /* Insert a background layer behind the upcoming image if framing_mode is 3, and we haven't already inserted one. */ if (insert_layers && (mng_info->framing_mode == 3) && (subframe_width) && (subframe_height) && (simplicity == 0 || (simplicity & 0x08))) { if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) return(DestroyImageList(image)); image=SyncNextImageInList(image); } mng_info->image=image; if (term_chunk_found) { image->start_loop=MagickTrue; image->iterations=mng_iterations; term_chunk_found=MagickFalse; } else image->start_loop=MagickFalse; image->delay=0; image->columns=subframe_width; image->rows=subframe_height; image->page.width=subframe_width; image->page.height=subframe_height; image->page.x=mng_info->clip.left; image->page.y=mng_info->clip.top; image->background_color=mng_background_color; image->matte=MagickFalse; (void) SetImageBackgroundColor(image); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Insert background layer, L=%.20g, R=%.20g T=%.20g, B=%.20g"", (double) mng_info->clip.left,(double) mng_info->clip.right, (double) mng_info->clip.top,(double) mng_info->clip.bottom); } #endif /* MNG_INSERT_LAYERS */ first_mng_object=MagickFalse; if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) return(DestroyImageList(image)); image=SyncNextImageInList(image); } mng_info->image=image; status=SetImageProgress(image,LoadImagesTag,TellBlob(image), GetBlobSize(image)); if (status == MagickFalse) break; if (term_chunk_found) { image->start_loop=MagickTrue; term_chunk_found=MagickFalse; } else image->start_loop=MagickFalse; if (mng_info->framing_mode == 1 || mng_info->framing_mode == 3) { image->delay=frame_delay; frame_delay=default_frame_delay; } else image->delay=0; image->page.width=mng_info->mng_width; image->page.height=mng_info->mng_height; image->page.x=mng_info->x_off[object_id]; image->page.y=mng_info->y_off[object_id]; image->iterations=mng_iterations; /* Seek back to the beginning of the IHDR or JHDR chunk's length field. */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Seeking back to beginning of %c%c%c%c chunk"",type[0],type[1], type[2],type[3]); offset=SeekBlob(image,-((ssize_t) length+12),SEEK_CUR); if (offset < 0) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } mng_info->image=image; mng_info->mng_type=mng_type; mng_info->object_id=object_id; if (memcmp(type,mng_IHDR,4) == 0) image=ReadOnePNGImage(mng_info,image_info,exception); #if defined(JNG_SUPPORTED) else image=ReadOneJNGImage(mng_info,image_info,exception); #endif if (image == (Image *) NULL) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""exit ReadJNGImage() with error""); return((Image *) NULL); } if (image->columns == 0 || image->rows == 0) { (void) CloseBlob(image); return(DestroyImageList(image)); } mng_info->image=image; if (mng_type) { MngBox crop_box; if (mng_info->magn_methx || mng_info->magn_methy) { png_uint_32 magnified_height, magnified_width; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Processing MNG MAGN chunk""); if (mng_info->magn_methx == 1) { magnified_width=mng_info->magn_ml; if (image->columns > 1) magnified_width += mng_info->magn_mr; if (image->columns > 2) magnified_width += (png_uint_32) ((image->columns-2)*(mng_info->magn_mx)); } else { magnified_width=(png_uint_32) image->columns; if (image->columns > 1) magnified_width += mng_info->magn_ml-1; if (image->columns > 2) magnified_width += mng_info->magn_mr-1; if (image->columns > 3) magnified_width += (png_uint_32) ((image->columns-3)*(mng_info->magn_mx-1)); } if (mng_info->magn_methy == 1) { magnified_height=mng_info->magn_mt; if (image->rows > 1) magnified_height += mng_info->magn_mb; if (image->rows > 2) magnified_height += (png_uint_32) ((image->rows-2)*(mng_info->magn_my)); } else { magnified_height=(png_uint_32) image->rows; if (image->rows > 1) magnified_height += mng_info->magn_mt-1; if (image->rows > 2) magnified_height += mng_info->magn_mb-1; if (image->rows > 3) magnified_height += (png_uint_32) ((image->rows-3)*(mng_info->magn_my-1)); } if (magnified_height > image->rows || magnified_width > image->columns) { Image *large_image; int yy; ssize_t m, y; register ssize_t x; register PixelPacket *n, *q; PixelPacket *next, *prev; png_uint_16 magn_methx, magn_methy; /* Allocate next image structure. */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Allocate magnified image""); AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) return(DestroyImageList(image)); large_image=SyncNextImageInList(image); large_image->columns=magnified_width; large_image->rows=magnified_height; magn_methx=mng_info->magn_methx; magn_methy=mng_info->magn_methy; #if (MAGICKCORE_QUANTUM_DEPTH > 16) #define QM unsigned short if (magn_methx != 1 || magn_methy != 1) { /* Scale pixels to unsigned shorts to prevent overflow of intermediate values of interpolations */ for (y=0; y < (ssize_t) image->rows; y++) { q=GetAuthenticPixels(image,0,y,image->columns,1, exception); for (x=(ssize_t) image->columns-1; x >= 0; x--) { SetPixelRed(q,ScaleQuantumToShort( GetPixelRed(q))); SetPixelGreen(q,ScaleQuantumToShort( GetPixelGreen(q))); SetPixelBlue(q,ScaleQuantumToShort( GetPixelBlue(q))); SetPixelOpacity(q,ScaleQuantumToShort( GetPixelOpacity(q))); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } } #else #define QM Quantum #endif if (image->matte != MagickFalse) (void) SetImageBackgroundColor(large_image); else { large_image->background_color.opacity=OpaqueOpacity; (void) SetImageBackgroundColor(large_image); if (magn_methx == 4) magn_methx=2; if (magn_methx == 5) magn_methx=3; if (magn_methy == 4) magn_methy=2; if (magn_methy == 5) magn_methy=3; } /* magnify the rows into the right side of the large image */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Magnify the rows to %.20g"",(double) large_image->rows); m=(ssize_t) mng_info->magn_mt; yy=0; length=(size_t) image->columns; next=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*next)); prev=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*prev)); if ((prev == (PixelPacket *) NULL) || (next == (PixelPacket *) NULL)) { image=DestroyImageList(image); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } n=GetAuthenticPixels(image,0,0,image->columns,1,exception); (void) CopyMagickMemory(next,n,length); for (y=0; y < (ssize_t) image->rows; y++) { if (y == 0) m=(ssize_t) mng_info->magn_mt; else if (magn_methy > 1 && y == (ssize_t) image->rows-2) m=(ssize_t) mng_info->magn_mb; else if (magn_methy <= 1 && y == (ssize_t) image->rows-1) m=(ssize_t) mng_info->magn_mb; else if (magn_methy > 1 && y == (ssize_t) image->rows-1) m=1; else m=(ssize_t) mng_info->magn_my; n=prev; prev=next; next=n; if (y < (ssize_t) image->rows-1) { n=GetAuthenticPixels(image,0,y+1,image->columns,1, exception); (void) CopyMagickMemory(next,n,length); } for (i=0; i < m; i++, yy++) { register PixelPacket *pixels; assert(yy < (ssize_t) large_image->rows); pixels=prev; n=next; q=GetAuthenticPixels(large_image,0,yy,large_image->columns, 1,exception); q+=(large_image->columns-image->columns); for (x=(ssize_t) image->columns-1; x >= 0; x--) { /* To do: get color as function of indexes[x] */ /* if (image->storage_class == PseudoClass) { } */ if (magn_methy <= 1) { /* replicate previous */ SetPixelRGBO(q,(pixels)); } else if (magn_methy == 2 || magn_methy == 4) { if (i == 0) { SetPixelRGBO(q,(pixels)); } else { /* Interpolate */ SetPixelRed(q, ((QM) (((ssize_t) (2*i*(GetPixelRed(n) -GetPixelRed(pixels)+m))/ ((ssize_t) (m*2)) +GetPixelRed(pixels))))); SetPixelGreen(q, ((QM) (((ssize_t) (2*i*(GetPixelGreen(n) -GetPixelGreen(pixels)+m))/ ((ssize_t) (m*2)) +GetPixelGreen(pixels))))); SetPixelBlue(q, ((QM) (((ssize_t) (2*i*(GetPixelBlue(n) -GetPixelBlue(pixels)+m))/ ((ssize_t) (m*2)) +GetPixelBlue(pixels))))); if (image->matte != MagickFalse) SetPixelOpacity(q, ((QM) (((ssize_t) (2*i*(GetPixelOpacity(n) -GetPixelOpacity(pixels)+m)) /((ssize_t) (m*2))+ GetPixelOpacity(pixels))))); } if (magn_methy == 4) { /* Replicate nearest */ if (i <= ((m+1) << 1)) SetPixelOpacity(q, (*pixels).opacity+0); else SetPixelOpacity(q, (*n).opacity+0); } } else /* if (magn_methy == 3 || magn_methy == 5) */ { /* Replicate nearest */ if (i <= ((m+1) << 1)) { SetPixelRGBO(q,(pixels)); } else { SetPixelRGBO(q,(n)); } if (magn_methy == 5) { SetPixelOpacity(q, (QM) (((ssize_t) (2*i* (GetPixelOpacity(n) -GetPixelOpacity(pixels)) +m))/((ssize_t) (m*2)) +GetPixelOpacity(pixels))); } } n++; q++; pixels++; } /* x */ if (SyncAuthenticPixels(large_image,exception) == 0) break; } /* i */ } /* y */ prev=(PixelPacket *) RelinquishMagickMemory(prev); next=(PixelPacket *) RelinquishMagickMemory(next); length=image->columns; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Delete original image""); DeleteImageFromList(&image); image=large_image; mng_info->image=image; /* magnify the columns */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Magnify the columns to %.20g"",(double) image->columns); for (y=0; y < (ssize_t) image->rows; y++) { register PixelPacket *pixels; q=GetAuthenticPixels(image,0,y,image->columns,1,exception); pixels=q+(image->columns-length); n=pixels+1; for (x=(ssize_t) (image->columns-length); x < (ssize_t) image->columns; x++) { /* To do: Rewrite using Get/Set***PixelComponent() */ if (x == (ssize_t) (image->columns-length)) m=(ssize_t) mng_info->magn_ml; else if (magn_methx > 1 && x == (ssize_t) image->columns-2) m=(ssize_t) mng_info->magn_mr; else if (magn_methx <= 1 && x == (ssize_t) image->columns-1) m=(ssize_t) mng_info->magn_mr; else if (magn_methx > 1 && x == (ssize_t) image->columns-1) m=1; else m=(ssize_t) mng_info->magn_mx; for (i=0; i < m; i++) { if (magn_methx <= 1) { /* replicate previous */ SetPixelRGBO(q,(pixels)); } else if (magn_methx == 2 || magn_methx == 4) { if (i == 0) { SetPixelRGBO(q,(pixels)); } /* To do: Rewrite using Get/Set***PixelComponent() */ else { /* Interpolate */ SetPixelRed(q, (QM) ((2*i*( GetPixelRed(n) -GetPixelRed(pixels))+m) /((ssize_t) (m*2))+ GetPixelRed(pixels))); SetPixelGreen(q, (QM) ((2*i*( GetPixelGreen(n) -GetPixelGreen(pixels))+m) /((ssize_t) (m*2))+ GetPixelGreen(pixels))); SetPixelBlue(q, (QM) ((2*i*( GetPixelBlue(n) -GetPixelBlue(pixels))+m) /((ssize_t) (m*2))+ GetPixelBlue(pixels))); if (image->matte != MagickFalse) SetPixelOpacity(q, (QM) ((2*i*( GetPixelOpacity(n) -GetPixelOpacity(pixels))+m) /((ssize_t) (m*2))+ GetPixelOpacity(pixels))); } if (magn_methx == 4) { /* Replicate nearest */ if (i <= ((m+1) << 1)) { SetPixelOpacity(q, GetPixelOpacity(pixels)+0); } else { SetPixelOpacity(q, GetPixelOpacity(n)+0); } } } else /* if (magn_methx == 3 || magn_methx == 5) */ { /* Replicate nearest */ if (i <= ((m+1) << 1)) { SetPixelRGBO(q,(pixels)); } else { SetPixelRGBO(q,(n)); } if (magn_methx == 5) { /* Interpolate */ SetPixelOpacity(q, (QM) ((2*i*( GetPixelOpacity(n) -GetPixelOpacity(pixels))+m)/ ((ssize_t) (m*2)) +GetPixelOpacity(pixels))); } } q++; } n++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } #if (MAGICKCORE_QUANTUM_DEPTH > 16) if (magn_methx != 1 || magn_methy != 1) { /* Rescale pixels to Quantum */ for (y=0; y < (ssize_t) image->rows; y++) { q=GetAuthenticPixels(image,0,y,image->columns,1,exception); for (x=(ssize_t) image->columns-1; x >= 0; x--) { SetPixelRed(q,ScaleShortToQuantum( GetPixelRed(q))); SetPixelGreen(q,ScaleShortToQuantum( GetPixelGreen(q))); SetPixelBlue(q,ScaleShortToQuantum( GetPixelBlue(q))); SetPixelOpacity(q,ScaleShortToQuantum( GetPixelOpacity(q))); q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } } #endif if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Finished MAGN processing""); } } /* Crop_box is with respect to the upper left corner of the MNG. */ crop_box.left=mng_info->image_box.left+mng_info->x_off[object_id]; crop_box.right=mng_info->image_box.right+mng_info->x_off[object_id]; crop_box.top=mng_info->image_box.top+mng_info->y_off[object_id]; crop_box.bottom=mng_info->image_box.bottom+mng_info->y_off[object_id]; crop_box=mng_minimum_box(crop_box,mng_info->clip); crop_box=mng_minimum_box(crop_box,mng_info->frame); crop_box=mng_minimum_box(crop_box,mng_info->object_clip[object_id]); if ((crop_box.left != (mng_info->image_box.left +mng_info->x_off[object_id])) || (crop_box.right != (mng_info->image_box.right +mng_info->x_off[object_id])) || (crop_box.top != (mng_info->image_box.top +mng_info->y_off[object_id])) || (crop_box.bottom != (mng_info->image_box.bottom +mng_info->y_off[object_id]))) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Crop the PNG image""); if ((crop_box.left < crop_box.right) && (crop_box.top < crop_box.bottom)) { Image *im; RectangleInfo crop_info; /* Crop_info is with respect to the upper left corner of the image. */ crop_info.x=(crop_box.left-mng_info->x_off[object_id]); crop_info.y=(crop_box.top-mng_info->y_off[object_id]); crop_info.width=(size_t) (crop_box.right-crop_box.left); crop_info.height=(size_t) (crop_box.bottom-crop_box.top); image->page.width=image->columns; image->page.height=image->rows; image->page.x=0; image->page.y=0; im=CropImage(image,&crop_info,exception); if (im != (Image *) NULL) { image->columns=im->columns; image->rows=im->rows; im=DestroyImage(im); image->page.width=image->columns; image->page.height=image->rows; image->page.x=crop_box.left; image->page.y=crop_box.top; } } else { /* No pixels in crop area. The MNG spec still requires a layer, though, so make a single transparent pixel in the top left corner. */ image->columns=1; image->rows=1; image->colors=2; (void) SetImageBackgroundColor(image); image->page.width=1; image->page.height=1; image->page.x=0; image->page.y=0; } } #ifndef PNG_READ_EMPTY_PLTE_SUPPORTED image=mng_info->image; #endif } #if (MAGICKCORE_QUANTUM_DEPTH > 16) /* PNG does not handle depths greater than 16 so reduce it even * if lossy, and promote any depths > 8 to 16. */ if (image->depth > 16) image->depth=16; #endif #if (MAGICKCORE_QUANTUM_DEPTH > 8) if (image->depth > 8) { /* To do: fill low byte properly */ image->depth=16; } if (LosslessReduceDepthOK(image) != MagickFalse) image->depth = 8; #endif GetImageException(image,exception); if (image_info->number_scenes != 0) { if (mng_info->scenes_found > (ssize_t) (image_info->first_scene+image_info->number_scenes)) break; } if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Finished reading image datastream.""); } while (LocaleCompare(image_info->magick,""MNG"") == 0); (void) CloseBlob(image); if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Finished reading all image datastreams.""); #if defined(MNG_INSERT_LAYERS) if (insert_layers && !mng_info->image_found && (mng_info->mng_width) && (mng_info->mng_height)) { /* Insert a background layer if nothing else was found. */ if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" No images found. Inserting a background layer.""); if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL) { /* Allocate next image structure. */ AcquireNextImage(image_info,image); if (GetNextImageInList(image) == (Image *) NULL) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Allocation failed, returning NULL.""); return(DestroyImageList(image)); } image=SyncNextImageInList(image); } image->columns=mng_info->mng_width; image->rows=mng_info->mng_height; image->page.width=mng_info->mng_width; image->page.height=mng_info->mng_height; image->page.x=0; image->page.y=0; image->background_color=mng_background_color; image->matte=MagickFalse; if (image_info->ping == MagickFalse) (void) SetImageBackgroundColor(image); mng_info->image_found++; } #endif image->iterations=mng_iterations; if (mng_iterations == 1) image->start_loop=MagickTrue; while (GetPreviousImageInList(image) != (Image *) NULL) { image_count++; if (image_count > 10*mng_info->image_found) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"" No beginning""); (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""Linked list is corrupted, beginning of list not found"", ""`%s'"",image_info->filename); return(DestroyImageList(image)); } image=GetPreviousImageInList(image); if (GetNextImageInList(image) == (Image *) NULL) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"" Corrupt list""); (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""Linked list is corrupted; next_image is NULL"",""`%s'"", image_info->filename); } } if (mng_info->ticks_per_second && mng_info->image_found > 1 && GetNextImageInList(image) == (Image *) NULL) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" First image null""); (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""image->next for first image is NULL but shouldn't be."", ""`%s'"",image_info->filename); } if (mng_info->image_found == 0) { if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" No visible images found.""); (void) ThrowMagickException(&image->exception,GetMagickModule(), CoderError,""No visible images in file"",""`%s'"",image_info->filename); return(DestroyImageList(image)); } if (mng_info->ticks_per_second) final_delay=1UL*MagickMax(image->ticks_per_second,1L)* final_delay/mng_info->ticks_per_second; else image->start_loop=MagickTrue; /* Find final nonzero image delay */ final_image_delay=0; while (GetNextImageInList(image) != (Image *) NULL) { if (image->delay) final_image_delay=image->delay; image=GetNextImageInList(image); } if (final_delay < final_image_delay) final_delay=final_image_delay; image->delay=final_delay; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" image->delay=%.20g, final_delay=%.20g"",(double) image->delay, (double) final_delay); if (logging != MagickFalse) { int scene; scene=0; image=GetFirstImageInList(image); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" Before coalesce:""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" scene 0 delay=%.20g"",(double) image->delay); while (GetNextImageInList(image) != (Image *) NULL) { image=GetNextImageInList(image); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" scene %.20g delay=%.20g"",(double) scene++,(double) image->delay); } } image=GetFirstImageInList(image); #ifdef MNG_COALESCE_LAYERS if (insert_layers) { Image *next_image, *next; size_t scene; if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),"" Coalesce Images""); scene=image->scene; next_image=CoalesceImages(image,&image->exception); if (next_image == (Image *) NULL) ThrowReaderException(ResourceLimitError,""MemoryAllocationFailed""); image=DestroyImageList(image); image=next_image; for (next=image; next != (Image *) NULL; next=next_image) { next->page.width=mng_info->mng_width; next->page.height=mng_info->mng_height; next->page.x=0; next->page.y=0; next->scene=scene++; next_image=GetNextImageInList(next); if (next_image == (Image *) NULL) break; if (next->delay == 0) { scene--; next_image->previous=GetPreviousImageInList(next); if (GetPreviousImageInList(next) == (Image *) NULL) image=next_image; else next->previous->next=next_image; next=DestroyImage(next); } } } #endif while (GetNextImageInList(image) != (Image *) NULL) image=GetNextImageInList(image); image->dispose=BackgroundDispose; if (logging != MagickFalse) { int scene; scene=0; image=GetFirstImageInList(image); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" After coalesce:""); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" scene 0 delay=%.20g dispose=%.20g"",(double) image->delay, (double) image->dispose); while (GetNextImageInList(image) != (Image *) NULL) { image=GetNextImageInList(image); (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" scene %.20g delay=%.20g dispose=%.20g"",(double) scene++, (double) image->delay,(double) image->dispose); } } if (logging != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" exit ReadOneJNGImage();""); return(image); } ",0 "void RenderFrameHostImpl::SetRenderFrameCreated(bool created) { if (created && delegate_) CHECK(!delegate_->IsBeingDestroyed()); bool was_created = render_frame_created_; render_frame_created_ = created; if (delegate_ && (created != was_created)) { if (created) { SetUpMojoIfNeeded(); delegate_->RenderFrameCreated(this); } else { delegate_->RenderFrameDeleted(this); } } if (created && render_widget_host_) { mojom::WidgetPtr widget; GetRemoteInterfaces()->GetInterface(&widget); render_widget_host_->SetWidget(std::move(widget)); if (frame_input_handler_) { mojom::WidgetInputHandlerAssociatedPtr widget_handler; mojom::WidgetInputHandlerHostPtr host; mojom::WidgetInputHandlerHostRequest host_request = mojo::MakeRequest(&host); frame_input_handler_->GetWidgetInputHandler( mojo::MakeRequest(&widget_handler), std::move(host)); render_widget_host_->SetWidgetInputHandler(std::move(widget_handler), std::move(host_request)); } render_widget_host_->input_router()->SetFrameTreeNodeId( frame_tree_node_->frame_tree_node_id()); viz::mojom::InputTargetClientPtr input_target_client; remote_interfaces_->GetInterface(&input_target_client); input_target_client_ = input_target_client.get(); render_widget_host_->SetInputTargetClient(std::move(input_target_client)); render_widget_host_->InitForFrame(); } if (enabled_bindings_ && created) { if (!frame_bindings_control_) GetRemoteAssociatedInterfaces()->GetInterface(&frame_bindings_control_); frame_bindings_control_->AllowBindings(enabled_bindings_); } } ",0 "void NsEnable(preproc_effect_t *effect) { webrtc::NoiseSuppression *ns = static_cast(effect->engine); ALOGV(""NsEnable ns %p"", ns); ns->Enable(true); } ",0 "void DevToolsClient::SendToAgent(const IPC::Message& tools_agent_message) { Send(new DevToolsHostMsg_ForwardToAgent(routing_id(), tools_agent_message)); } ",0 "void GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped( const GpuHostMsg_AcceleratedSurfaceBuffersSwapped_Params& params) { TRACE_EVENT0(""gpu"", ""GpuProcessHost::OnAcceleratedSurfaceBuffersSwapped""); base::ScopedClosureRunner scoped_completion_runner( base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, host_id_, params.route_id, params.surface_id, true, base::TimeTicks(), base::TimeDelta())); gfx::PluginWindowHandle handle = GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(params.surface_id); if (!handle) { TRACE_EVENT1(""gpu"", ""SurfaceIDNotFound_RoutingToUI"", ""surface_id"", params.surface_id); #if defined(USE_AURA) scoped_completion_runner.Release(); RouteOnUIThread(GpuHostMsg_AcceleratedSurfaceBuffersSwapped(params)); #endif return; } scoped_refptr presenter( AcceleratedPresenter::GetForWindow(handle)); if (!presenter) { TRACE_EVENT1(""gpu"", ""EarlyOut_NativeWindowNotFound"", ""handle"", handle); return; } scoped_completion_runner.Release(); presenter->AsyncPresentAndAcknowledge( params.size, params.surface_handle, base::Bind(&AcceleratedSurfaceBuffersSwappedCompleted, host_id_, params.route_id, params.surface_id)); } ",1 "static int em_sysenter(struct x86_emulate_ctxt *ctxt) { const struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct cs, ss; u64 msr_data; u16 cs_sel, ss_sel; u64 efer = 0; ops->get_msr(ctxt, MSR_EFER, &efer); /* inject #GP if in real mode */ if (ctxt->mode == X86EMUL_MODE_REAL) return emulate_gp(ctxt, 0); /* * Not recognized on AMD in compat mode (but is recognized in legacy * mode). */ if ((ctxt->mode == X86EMUL_MODE_PROT32) && (efer & EFER_LMA) && !vendor_intel(ctxt)) return emulate_ud(ctxt); /* XXX sysenter/sysexit have not been tested in 64bit mode. * Therefore, we inject an #UD. */ if (ctxt->mode == X86EMUL_MODE_PROT64) return emulate_ud(ctxt); setup_syscalls_segments(ctxt, &cs, &ss); ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data); switch (ctxt->mode) { case X86EMUL_MODE_PROT32: if ((msr_data & 0xfffc) == 0x0) return emulate_gp(ctxt, 0); break; case X86EMUL_MODE_PROT64: if (msr_data == 0x0) return emulate_gp(ctxt, 0); break; default: break; } ctxt->eflags &= ~(EFLG_VM | EFLG_IF); cs_sel = (u16)msr_data; cs_sel &= ~SELECTOR_RPL_MASK; ss_sel = cs_sel + 8; ss_sel &= ~SELECTOR_RPL_MASK; if (ctxt->mode == X86EMUL_MODE_PROT64 || (efer & EFER_LMA)) { cs.d = 0; cs.l = 1; } ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS); ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); ops->get_msr(ctxt, MSR_IA32_SYSENTER_EIP, &msr_data); ctxt->_eip = msr_data; ops->get_msr(ctxt, MSR_IA32_SYSENTER_ESP, &msr_data); *reg_write(ctxt, VCPU_REGS_RSP) = msr_data; return X86EMUL_CONTINUE; } ",0 "static int skcipher_walk_aead_common(struct skcipher_walk *walk, struct aead_request *req, bool atomic) { struct crypto_aead *tfm = crypto_aead_reqtfm(req); int err; walk->flags &= ~SKCIPHER_WALK_PHYS; scatterwalk_start(&walk->in, req->src); scatterwalk_start(&walk->out, req->dst); scatterwalk_copychunks(NULL, &walk->in, req->assoclen, 2); scatterwalk_copychunks(NULL, &walk->out, req->assoclen, 2); walk->iv = req->iv; walk->oiv = req->iv; if (req->base.flags & CRYPTO_TFM_REQ_MAY_SLEEP) walk->flags |= SKCIPHER_WALK_SLEEP; else walk->flags &= ~SKCIPHER_WALK_SLEEP; walk->blocksize = crypto_aead_blocksize(tfm); walk->stride = crypto_aead_chunksize(tfm); walk->ivsize = crypto_aead_ivsize(tfm); walk->alignmask = crypto_aead_alignmask(tfm); err = skcipher_walk_first(walk); if (atomic) walk->flags &= ~SKCIPHER_WALK_SLEEP; return err; } ",0 "int set_camera_metadata_vendor_tag_ops(const vendor_tag_query_ops_t* ops) { (void) ops; ALOGE(""%s: This function has been deprecated"", __FUNCTION__); return ERROR; } ",0 " void HTMLStyleElement::RemovedFrom(ContainerNode* insertion_point) { HTMLElement::RemovedFrom(insertion_point); StyleElement::RemovedFrom(*this, insertion_point); } ",0 "int GetWindowId(base::DictionaryValue* window) { int id = kUndefinedId; if (window) window->GetInteger(keys::kIdKey, &id); return id; } ",0 "MagickExport ssize_t WriteBlobMSBLongLong(Image *image, const MagickSizeType value) { unsigned char buffer[8]; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); buffer[0]=(unsigned char) (value >> 56); buffer[1]=(unsigned char) (value >> 48); buffer[2]=(unsigned char) (value >> 40); buffer[3]=(unsigned char) (value >> 32); buffer[4]=(unsigned char) (value >> 24); buffer[5]=(unsigned char) (value >> 16); buffer[6]=(unsigned char) (value >> 8); buffer[7]=(unsigned char) value; return(WriteBlobStream(image,8,buffer)); } ",0 " virtual DictionaryValue* Get() { DictionaryValue* dict = DictionaryPrefUpdate::Get(); DictionaryValue* extension = NULL; if (!dict->GetDictionary(extension_id_, &extension)) { extension = new DictionaryValue(); dict->Set(extension_id_, extension); } return extension; } ",0 "void ProfileSyncService::ClearUnrecoverableError() { unrecoverable_error_detected_ = false; unrecoverable_error_message_.clear(); unrecoverable_error_location_ = tracked_objects::Location(); } ",0 "struct sock *unix_peer_get(struct sock *s) { struct sock *peer; unix_state_lock(s); peer = unix_peer(s); if (peer) sock_hold(peer); unix_state_unlock(s); return peer; } ",0 "mm_skey_query(void *ctx, char **name, char **infotxt, u_int *numprompts, char ***prompts, u_int **echo_on) { Buffer m; u_int success; char *challenge; debug3(""%s: entering"", __func__); buffer_init(&m); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_SKEYQUERY, &m); mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_SKEYQUERY, &m); success = buffer_get_int(&m); if (success == 0) { debug3(""%s: no challenge"", __func__); buffer_free(&m); return (-1); } /* Get the challenge, and format the response */ challenge = buffer_get_string(&m, NULL); buffer_free(&m); debug3(""%s: received challenge: %s"", __func__, challenge); mm_chall_setup(name, infotxt, numprompts, prompts, echo_on); xasprintf(*prompts, ""%s%s"", challenge, SKEY_PROMPT); free(challenge); return (0); } ",0 "FileSystemOperation::ScopedQuotaNotifier::ScopedQuotaNotifier( FileSystemContext* context, const GURL& origin_url, FileSystemType type) : origin_url_(origin_url), type_(type) { DCHECK(context); DCHECK(type_ != kFileSystemTypeUnknown); quota_util_ = context->GetQuotaUtil(type_); if (quota_util_) { DCHECK(quota_util_->proxy()); quota_util_->proxy()->StartUpdateOrigin(origin_url_, type_); } } ",0 "bool Extension::CheckConflictingFeatures(std::string* utf8_error) const { if (has_lazy_background_page() && HasAPIPermission(APIPermission::kWebRequest)) { *utf8_error = errors::kWebRequestConflictsWithLazyBackground; return false; } return true; } ",0 "void AutocompleteResult::Swap(AutocompleteResult* other) { const size_t default_match_offset = default_match_ - begin(); const size_t other_default_match_offset = other->default_match_ - other->begin(); matches_.swap(other->matches_); default_match_ = begin() + other_default_match_offset; other->default_match_ = other->begin() + default_match_offset; alternate_nav_url_.Swap(&(other->alternate_nav_url_)); } ",0 "static int do_pkcs7_signed_attrib(PKCS7_SIGNER_INFO *si, EVP_MD_CTX *mctx) { unsigned char md_data[EVP_MAX_MD_SIZE]; unsigned int md_len; /* Add signing time if not already present */ if (!PKCS7_get_signed_attribute(si, NID_pkcs9_signingTime)) { if (!PKCS7_add0_attrib_signing_time(si, NULL)) { PKCS7err(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB, ERR_R_MALLOC_FAILURE); return 0; } } /* Add digest */ if (!EVP_DigestFinal_ex(mctx, md_data, &md_len)) { PKCS7err(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB, ERR_R_EVP_LIB); return 0; } if (!PKCS7_add1_attrib_digest(si, md_data, md_len)) { PKCS7err(PKCS7_F_DO_PKCS7_SIGNED_ATTRIB, ERR_R_MALLOC_FAILURE); return 0; } /* Now sign the attributes */ if (!PKCS7_SIGNER_INFO_sign(si)) return 0; return 1; } ",0 "inline int web_client_api_request_v1_alarm_log(RRDHOST *host, struct web_client *w, char *url) { uint32_t after = 0; while(url) { char *value = mystrsep(&url, ""?&""); if (!value || !*value) continue; char *name = mystrsep(&value, ""=""); if(!name || !*name) continue; if(!value || !*value) continue; if(!strcmp(name, ""after"")) after = (uint32_t)strtoul(value, NULL, 0); } buffer_flush(w->response.data); w->response.data->contenttype = CT_APPLICATION_JSON; health_alarm_log2json(host, w->response.data, after); return 200; } ",0 "void initialize_dirent_tail(struct ext4_dir_entry_tail *t, unsigned int blocksize) { memset(t, 0, sizeof(struct ext4_dir_entry_tail)); t->det_rec_len = ext4_rec_len_to_disk( sizeof(struct ext4_dir_entry_tail), blocksize); t->det_reserved_ft = EXT4_FT_DIR_CSUM; } ",0 "static int __tcp_grow_window(const struct sock *sk, const struct sk_buff *skb) { struct tcp_sock *tp = tcp_sk(sk); /* Optimize this! */ int truesize = tcp_win_from_space(skb->truesize) >> 1; int window = tcp_win_from_space(sysctl_tcp_rmem[2]) >> 1; while (tp->rcv_ssthresh <= window) { if (truesize <= skb->len) return 2 * inet_csk(sk)->icsk_ack.rcv_mss; truesize >>= 1; window >>= 1; } return 0; } ",0 "void DelegatedFrameHost::RequestCopyOfOutput( std::unique_ptr request) { if (!request->has_area()) request->set_area(gfx::Rect(current_frame_size_in_dip_)); if (request_copy_of_output_callback_for_testing_.is_null()) { client_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput( std::move(request)); } else { request_copy_of_output_callback_for_testing_.Run(std::move(request)); } } ",0 " bool NeedsPaintPropertyUpdate() const { return object_.NeedsPaintPropertyUpdate() || full_context_.force_subtree_update; } ",0 "static ssize_t pagemap_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) { struct task_struct *task = get_proc_task(file->f_path.dentry->d_inode); struct mm_struct *mm; struct pagemapread pm; int ret = -ESRCH; struct mm_walk pagemap_walk = {}; unsigned long src; unsigned long svpfn; unsigned long start_vaddr; unsigned long end_vaddr; int copied = 0; if (!task) goto out; mm = mm_for_maps(task); ret = PTR_ERR(mm); if (!mm || IS_ERR(mm)) goto out_task; ret = -EINVAL; /* file position must be aligned */ if ((*ppos % PM_ENTRY_BYTES) || (count % PM_ENTRY_BYTES)) goto out_task; ret = 0; if (!count) goto out_task; pm.len = PM_ENTRY_BYTES * (PAGEMAP_WALK_SIZE >> PAGE_SHIFT); pm.buffer = kmalloc(pm.len, GFP_TEMPORARY); ret = -ENOMEM; if (!pm.buffer) goto out_mm; pagemap_walk.pmd_entry = pagemap_pte_range; pagemap_walk.pte_hole = pagemap_pte_hole; #ifdef CONFIG_HUGETLB_PAGE pagemap_walk.hugetlb_entry = pagemap_hugetlb_range; #endif pagemap_walk.mm = mm; pagemap_walk.private = ± src = *ppos; svpfn = src / PM_ENTRY_BYTES; start_vaddr = svpfn << PAGE_SHIFT; end_vaddr = TASK_SIZE_OF(task); /* watch out for wraparound */ if (svpfn > TASK_SIZE_OF(task) >> PAGE_SHIFT) start_vaddr = end_vaddr; /* * The odds are that this will stop walking way * before end_vaddr, because the length of the * user buffer is tracked in ""pm"", and the walk * will stop when we hit the end of the buffer. */ ret = 0; while (count && (start_vaddr < end_vaddr)) { int len; unsigned long end; pm.pos = 0; end = (start_vaddr + PAGEMAP_WALK_SIZE) & PAGEMAP_WALK_MASK; /* overflow ? */ if (end < start_vaddr || end > end_vaddr) end = end_vaddr; down_read(&mm->mmap_sem); ret = walk_page_range(start_vaddr, end, &pagemap_walk); up_read(&mm->mmap_sem); start_vaddr = end; len = min(count, PM_ENTRY_BYTES * pm.pos); if (copy_to_user(buf, pm.buffer, len)) { ret = -EFAULT; goto out_free; } copied += len; buf += len; count -= len; } *ppos += copied; if (!ret || ret == PM_END_OF_BUFFER) ret = copied; out_free: kfree(pm.buffer); out_mm: mmput(mm); out_task: put_task_struct(task); out: return ret; } ",0 "static struct dquot **f2fs_get_dquots(struct inode *inode) { return F2FS_I(inode)->i_dquot; } ",0 " void OnSitesWithFlashDataFetched(const std::vector& sites) { domains_ = sites; } ",0 "void ff_thread_report_progress(ThreadFrame *f, int progress, int field) { } ",0 "status_t MPEG4Source::parseTrackFragmentRun(off64_t offset, off64_t size) { ALOGV(""MPEG4Extractor::parseTrackFragmentRun""); if (size < 8) { return -EINVAL; } enum { kDataOffsetPresent = 0x01, kFirstSampleFlagsPresent = 0x04, kSampleDurationPresent = 0x100, kSampleSizePresent = 0x200, kSampleFlagsPresent = 0x400, kSampleCompositionTimeOffsetPresent = 0x800, }; uint32_t flags; if (!mDataSource->getUInt32(offset, &flags)) { return ERROR_MALFORMED; } uint8_t version = flags >> 24; flags &= 0xffffff; ALOGV(""fragment run version: 0x%02x, flags: 0x%06x"", version, flags); if ((flags & kFirstSampleFlagsPresent) && (flags & kSampleFlagsPresent)) { return -EINVAL; } uint32_t sampleCount; if (!mDataSource->getUInt32(offset + 4, &sampleCount)) { return ERROR_MALFORMED; } offset += 8; size -= 8; uint64_t dataOffset = mTrackFragmentHeaderInfo.mDataOffset; uint32_t firstSampleFlags = 0; if (flags & kDataOffsetPresent) { if (size < 4) { return -EINVAL; } int32_t dataOffsetDelta; if (!mDataSource->getUInt32(offset, (uint32_t*)&dataOffsetDelta)) { return ERROR_MALFORMED; } dataOffset = mTrackFragmentHeaderInfo.mBaseDataOffset + dataOffsetDelta; offset += 4; size -= 4; } if (flags & kFirstSampleFlagsPresent) { if (size < 4) { return -EINVAL; } if (!mDataSource->getUInt32(offset, &firstSampleFlags)) { return ERROR_MALFORMED; } offset += 4; size -= 4; } uint32_t sampleDuration = 0, sampleSize = 0, sampleFlags = 0, sampleCtsOffset = 0; size_t bytesPerSample = 0; if (flags & kSampleDurationPresent) { bytesPerSample += 4; } else if (mTrackFragmentHeaderInfo.mFlags & TrackFragmentHeaderInfo::kDefaultSampleDurationPresent) { sampleDuration = mTrackFragmentHeaderInfo.mDefaultSampleDuration; } else if (mTrex) { sampleDuration = mTrex->default_sample_duration; } if (flags & kSampleSizePresent) { bytesPerSample += 4; } else if (mTrackFragmentHeaderInfo.mFlags & TrackFragmentHeaderInfo::kDefaultSampleSizePresent) { sampleSize = mTrackFragmentHeaderInfo.mDefaultSampleSize; } else { sampleSize = mTrackFragmentHeaderInfo.mDefaultSampleSize; } if (flags & kSampleFlagsPresent) { bytesPerSample += 4; } else if (mTrackFragmentHeaderInfo.mFlags & TrackFragmentHeaderInfo::kDefaultSampleFlagsPresent) { sampleFlags = mTrackFragmentHeaderInfo.mDefaultSampleFlags; } else { sampleFlags = mTrackFragmentHeaderInfo.mDefaultSampleFlags; } if (flags & kSampleCompositionTimeOffsetPresent) { bytesPerSample += 4; } else { sampleCtsOffset = 0; } if (size < (off64_t)(sampleCount * bytesPerSample)) { return -EINVAL; } Sample tmp; for (uint32_t i = 0; i < sampleCount; ++i) { if (flags & kSampleDurationPresent) { if (!mDataSource->getUInt32(offset, &sampleDuration)) { return ERROR_MALFORMED; } offset += 4; } if (flags & kSampleSizePresent) { if (!mDataSource->getUInt32(offset, &sampleSize)) { return ERROR_MALFORMED; } offset += 4; } if (flags & kSampleFlagsPresent) { if (!mDataSource->getUInt32(offset, &sampleFlags)) { return ERROR_MALFORMED; } offset += 4; } if (flags & kSampleCompositionTimeOffsetPresent) { if (!mDataSource->getUInt32(offset, &sampleCtsOffset)) { return ERROR_MALFORMED; } offset += 4; } ALOGV(""adding sample %d at offset 0x%08"" PRIx64 "", size %u, duration %u, "" "" flags 0x%08x"", i + 1, dataOffset, sampleSize, sampleDuration, (flags & kFirstSampleFlagsPresent) && i == 0 ? firstSampleFlags : sampleFlags); tmp.offset = dataOffset; tmp.size = sampleSize; tmp.duration = sampleDuration; tmp.compositionOffset = sampleCtsOffset; mCurrentSamples.add(tmp); dataOffset += sampleSize; } mTrackFragmentHeaderInfo.mDataOffset = dataOffset; return OK; } ",0 " SendThumbnailTask(HWND aeropeek_window, const gfx::Rect& content_bounds, const gfx::Size& aeropeek_size, const SkBitmap& tab_bitmap, base::WaitableEvent* ready) : aeropeek_window_(aeropeek_window), content_bounds_(content_bounds), aeropeek_size_(aeropeek_size), tab_bitmap_(tab_bitmap), ready_(ready) { } ",0 "find_interface_by_number(long devnum) { pcap_if_t *dev, *devlist; long i; char ebuf[PCAP_ERRBUF_SIZE]; char *device; if (pcap_findalldevs(&devlist, ebuf) < 0) error(""%s"", ebuf); /* * Look for the devnum-th entry in the list of devices (1-based). */ for (i = 0, dev = devlist; i < devnum-1 && dev != NULL; i++, dev = dev->next) ; if (dev == NULL) error(""Invalid adapter index""); device = strdup(dev->name); pcap_freealldevs(devlist); return (device); } ",0 "static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) { __be32 *p; *res = 60; if (unlikely(bitmap[0] & (FATTR4_WORD0_LEASE_TIME - 1U))) return -EIO; if (likely(bitmap[0] & FATTR4_WORD0_LEASE_TIME)) { READ_BUF(4); READ32(*res); bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; } dprintk(""%s: file size=%u\n"", __func__, (unsigned int)*res); return 0; } ",0 "static int composite_release_interface(int sub_api, struct libusb_device_handle *dev_handle, int iface) { struct windows_device_priv *priv = _device_priv(dev_handle->dev); return priv->usb_interface[iface].apib-> release_interface(priv->usb_interface[iface].sub_api, dev_handle, iface); } ",0 "static int l2tp_ip6_backlog_recv(struct sock *sk, struct sk_buff *skb) { int rc; /* Charge it to the socket, dropping if the queue is full. */ rc = sock_queue_rcv_skb(sk, skb); if (rc < 0) goto drop; return 0; drop: IP_INC_STATS(&init_net, IPSTATS_MIB_INDISCARDS); kfree_skb(skb); return -1; } ",0 "_dbus_header_cache_revalidate (DBusHeader *header) { DBusTypeReader array; DBusTypeReader reader; int i; i = 0; while (i <= DBUS_HEADER_FIELD_LAST) { header->fields[i].value_pos = _DBUS_HEADER_FIELD_VALUE_NONEXISTENT; ++i; } _dbus_type_reader_init (&reader, header->byte_order, &_dbus_header_signature_str, FIELDS_ARRAY_SIGNATURE_OFFSET, &header->data, FIELDS_ARRAY_LENGTH_OFFSET); _dbus_type_reader_recurse (&reader, &array); while (_dbus_type_reader_get_current_type (&array) != DBUS_TYPE_INVALID) { DBusTypeReader sub; DBusTypeReader variant; unsigned char field_code; _dbus_type_reader_recurse (&array, &sub); _dbus_assert (_dbus_type_reader_get_current_type (&sub) == DBUS_TYPE_BYTE); _dbus_type_reader_read_basic (&sub, &field_code); /* Unknown fields should be ignored */ if (field_code > DBUS_HEADER_FIELD_LAST) goto next_field; _dbus_type_reader_next (&sub); _dbus_assert (_dbus_type_reader_get_current_type (&sub) == DBUS_TYPE_VARIANT); _dbus_type_reader_recurse (&sub, &variant); _dbus_header_cache_one (header, field_code, &variant); next_field: _dbus_type_reader_next (&array); } } ",0 "unsigned find_get_pages_contig(struct address_space *mapping, pgoff_t index, unsigned int nr_pages, struct page **pages) { unsigned int i; unsigned int ret; read_lock_irq(&mapping->tree_lock); ret = radix_tree_gang_lookup(&mapping->page_tree, (void **)pages, index, nr_pages); for (i = 0; i < ret; i++) { if (pages[i]->mapping == NULL || pages[i]->index != index) break; page_cache_get(pages[i]); index++; } read_unlock_irq(&mapping->tree_lock); return i; } ",0 "xmlXPathCastToBoolean (xmlXPathObjectPtr val) { int ret = 0; if (val == NULL) return(0); switch (val->type) { case XPATH_UNDEFINED: #ifdef DEBUG_EXPR xmlGenericError(xmlGenericErrorContext, ""BOOLEAN: undefined\n""); #endif ret = 0; break; case XPATH_NODESET: case XPATH_XSLT_TREE: ret = xmlXPathCastNodeSetToBoolean(val->nodesetval); break; case XPATH_STRING: ret = xmlXPathCastStringToBoolean(val->stringval); break; case XPATH_NUMBER: ret = xmlXPathCastNumberToBoolean(val->floatval); break; case XPATH_BOOLEAN: ret = val->boolval; break; case XPATH_USERS: case XPATH_POINT: case XPATH_RANGE: case XPATH_LOCATIONSET: TODO; ret = 0; break; } return(ret); } ",0 "DEFINE_RUN_ONCE_STATIC_ALT(ossl_init_no_load_crypto_strings, ossl_init_load_crypto_strings) { /* Do nothing in this case */ return 1; } ",0 "fatal (char const *format, ...) { va_list args; fprintf (stderr, ""%s: **** "", program_name); va_start (args, format); vfprintf (stderr, format, args); va_end (args); putc ('\n', stderr); fflush (stderr); fatal_exit (0); } ",0 "static int rm_read_close(AVFormatContext *s) { int i; for (i=0;inb_streams;i++) ff_rm_free_rmstream(s->streams[i]->priv_data); return 0; } ",0 " void ClearStates() { state_ = NULL; deleted_ = NULL; delegate_ = NULL; } ",0 "copy_opt_anc_info(OptAnc* to, OptAnc* from) { *to = *from; } ",0 "void RenderWidgetHostImpl::RemoveKeyboardListener( KeyboardListener* listener) { keyboard_listeners_.remove(listener); } ",0 "uriCommonTest(const char *filename, const char *result, const char *err, const char *base) { char *temp; FILE *o, *f; char str[1024]; int res = 0, i, ret; temp = resultFilename(filename, """", "".res""); if (temp == NULL) { fprintf(stderr, ""Out of memory\n""); fatalError(); } o = fopen(temp, ""wb""); if (o == NULL) { fprintf(stderr, ""failed to open output file %s\n"", temp); free(temp); return(-1); } f = fopen(filename, ""rb""); if (f == NULL) { fprintf(stderr, ""failed to open input file %s\n"", filename); fclose(o); if (temp != NULL) { unlink(temp); free(temp); } return(-1); } while (1) { /* * read one line in string buffer. */ if (fgets (&str[0], sizeof (str) - 1, f) == NULL) break; /* * remove the ending spaces */ i = strlen(str); while ((i > 0) && ((str[i - 1] == '\n') || (str[i - 1] == '\r') || (str[i - 1] == ' ') || (str[i - 1] == '\t'))) { i--; str[i] = 0; } nb_tests++; handleURI(str, base, o); } fclose(f); fclose(o); if (result != NULL) { ret = compareFiles(temp, result); if (ret) { fprintf(stderr, ""Result for %s failed in %s\n"", filename, result); res = 1; } } if (err != NULL) { ret = compareFileMem(err, testErrors, testErrorsSize); if (ret != 0) { fprintf(stderr, ""Error for %s failed\n"", filename); res = 1; } } if (temp != NULL) { unlink(temp); free(temp); } return(res); } ",0 "static PHP_MINIT_FUNCTION(pcre) { REGISTER_INI_ENTRIES(); REGISTER_LONG_CONSTANT(""PREG_PATTERN_ORDER"", PREG_PATTERN_ORDER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_SET_ORDER"", PREG_SET_ORDER, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_OFFSET_CAPTURE"", PREG_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_SPLIT_NO_EMPTY"", PREG_SPLIT_NO_EMPTY, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_SPLIT_DELIM_CAPTURE"", PREG_SPLIT_DELIM_CAPTURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_SPLIT_OFFSET_CAPTURE"", PREG_SPLIT_OFFSET_CAPTURE, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_GREP_INVERT"", PREG_GREP_INVERT, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_NO_ERROR"", PHP_PCRE_NO_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_INTERNAL_ERROR"", PHP_PCRE_INTERNAL_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_BACKTRACK_LIMIT_ERROR"", PHP_PCRE_BACKTRACK_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_RECURSION_LIMIT_ERROR"", PHP_PCRE_RECURSION_LIMIT_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_BAD_UTF8_ERROR"", PHP_PCRE_BAD_UTF8_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_LONG_CONSTANT(""PREG_BAD_UTF8_OFFSET_ERROR"", PHP_PCRE_BAD_UTF8_OFFSET_ERROR, CONST_CS | CONST_PERSISTENT); REGISTER_STRING_CONSTANT(""PCRE_VERSION"", (char *)pcre_version(), CONST_CS | CONST_PERSISTENT); return SUCCESS; } ",0 "xmlXPathCompMultiplicativeExpr(xmlXPathParserContextPtr ctxt) { xmlXPathCompUnaryExpr(ctxt); CHECK_ERROR; SKIP_BLANKS; while ((CUR == '*') || ((CUR == 'd') && (NXT(1) == 'i') && (NXT(2) == 'v')) || ((CUR == 'm') && (NXT(1) == 'o') && (NXT(2) == 'd'))) { int op = -1; int op1 = ctxt->comp->last; if (CUR == '*') { op = 0; NEXT; } else if (CUR == 'd') { op = 1; SKIP(3); } else if (CUR == 'm') { op = 2; SKIP(3); } SKIP_BLANKS; xmlXPathCompUnaryExpr(ctxt); CHECK_ERROR; PUSH_BINARY_EXPR(XPATH_OP_MULT, op1, ctxt->comp->last, op, 0); SKIP_BLANKS; } } ",0 "void WebGL2RenderingContextBase::uniformMatrix4fv( const WebGLUniformLocation* location, GLboolean transpose, MaybeShared v) { WebGLRenderingContextBase::uniformMatrix4fv(location, transpose, v); } ",0 "update_info_linux_md_component (Device *device) { if (g_strcmp0 (device->priv->id_type, ""linux_raid_member"") == 0) { const gchar *md_comp_level; gint md_comp_num_raid_devices; const gchar *md_comp_uuid; const gchar *md_comp_home_host; const gchar *md_comp_name; const gchar *md_comp_version; gchar *md_name; gchar *s; int md_comp_position; md_comp_position = -1; device_set_device_is_linux_md_component (device, TRUE); /* linux_md_component_holder and linux_md_component_state */ if (device->priv->holders_objpath->len == 1) { Device *holder; gchar **state_tokens; device_set_linux_md_component_holder (device, device->priv->holders_objpath->pdata[0]); state_tokens = NULL; holder = daemon_local_find_by_object_path (device->priv->daemon, device->priv->holders_objpath->pdata[0]); if (holder != NULL && holder->priv->device_is_linux_md) { gchar *dev_name; gchar *md_dev_path; gchar *state_contents; gchar *slot_contents; gint slot_number; gchar *endp; dev_name = g_path_get_basename (device->priv->native_path); md_dev_path = g_strdup_printf (""%s/md/dev-%s"", holder->priv->native_path, dev_name); state_contents = sysfs_get_string (md_dev_path, ""state""); g_strstrip (state_contents); state_tokens = g_strsplit (state_contents, "","", 0); slot_contents = sysfs_get_string (md_dev_path, ""slot""); g_strstrip (slot_contents); slot_number = strtol (slot_contents, &endp, 0); if (endp != NULL && *endp == '\0') { md_comp_position = slot_number; } g_free (slot_contents); g_free (state_contents); g_free (md_dev_path); g_free (dev_name); } device_set_linux_md_component_state (device, state_tokens); g_strfreev (state_tokens); } else { /* no holder, nullify properties */ device_set_linux_md_component_holder (device, NULL); device_set_linux_md_component_state (device, NULL); } md_comp_level = g_udev_device_get_property (device->priv->d, ""MD_LEVEL""); md_comp_num_raid_devices = g_udev_device_get_property_as_int (device->priv->d, ""MD_DEVICES""); md_comp_uuid = g_udev_device_get_property (device->priv->d, ""MD_UUID""); md_name = g_strdup (g_udev_device_get_property (device->priv->d, ""MD_NAME"")); s = NULL; if (md_name != NULL) s = strstr (md_name, "":""); if (s != NULL) { *s = '\0'; md_comp_home_host = md_name; md_comp_name = s + 1; } else { md_comp_home_host = """"; md_comp_name = md_name; } md_comp_version = device->priv->id_version; device_set_linux_md_component_level (device, md_comp_level); device_set_linux_md_component_position (device, md_comp_position); device_set_linux_md_component_num_raid_devices (device, md_comp_num_raid_devices); device_set_linux_md_component_uuid (device, md_comp_uuid); device_set_linux_md_component_home_host (device, md_comp_home_host); device_set_linux_md_component_name (device, md_comp_name); device_set_linux_md_component_version (device, md_comp_version); g_free (md_name); } else { device_set_device_is_linux_md_component (device, FALSE); device_set_linux_md_component_level (device, NULL); device_set_linux_md_component_position (device, -1); device_set_linux_md_component_num_raid_devices (device, 0); device_set_linux_md_component_uuid (device, NULL); device_set_linux_md_component_home_host (device, NULL); device_set_linux_md_component_name (device, NULL); device_set_linux_md_component_version (device, NULL); device_set_linux_md_component_holder (device, NULL); device_set_linux_md_component_state (device, NULL); } return TRUE; } ",0 "static MagickBooleanType WriteImageChannels(const PSDInfo *psd_info, const ImageInfo *image_info,Image *image,Image *next_image, const MagickBooleanType separate,ExceptionInfo *exception) { size_t channels, packet_size; unsigned char *compact_pixels; /* Write uncompressed pixels as separate planes. */ channels=1; packet_size=next_image->depth > 8UL ? 2UL : 1UL; compact_pixels=(unsigned char *) NULL; if (next_image->compression == RLECompression) { compact_pixels=(unsigned char *) AcquireQuantumMemory(2*channels* next_image->columns,packet_size*sizeof(*compact_pixels)); if (compact_pixels == (unsigned char *) NULL) ThrowWriterException(ResourceLimitError,""MemoryAllocationFailed""); } if (IsImageGray(next_image) != MagickFalse) { if (next_image->compression == RLECompression) { /* Packbits compression. */ (void) WriteBlobMSBShort(image,1); WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,GrayQuantum,exception); if (next_image->alpha_trait != UndefinedPixelTrait) WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,AlphaQuantum,exception); } WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, GrayQuantum,MagickTrue,exception); if (next_image->alpha_trait != UndefinedPixelTrait) WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, AlphaQuantum,separate,exception); (void) SetImageProgress(image,SaveImagesTag,0,1); } else if (next_image->storage_class == PseudoClass) { if (next_image->compression == RLECompression) { /* Packbits compression. */ (void) WriteBlobMSBShort(image,1); WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,IndexQuantum,exception); if (next_image->alpha_trait != UndefinedPixelTrait) WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,AlphaQuantum,exception); } WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, IndexQuantum,MagickTrue,exception); if (next_image->alpha_trait != UndefinedPixelTrait) WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, AlphaQuantum,separate,exception); (void) SetImageProgress(image,SaveImagesTag,0,1); } else { if (next_image->colorspace == CMYKColorspace) (void) NegateCMYK(next_image,exception); if (next_image->compression == RLECompression) { /* Packbits compression. */ (void) WriteBlobMSBShort(image,1); WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,RedQuantum,exception); WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,GreenQuantum,exception); WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,BlueQuantum,exception); if (next_image->colorspace == CMYKColorspace) WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,BlackQuantum,exception); if (next_image->alpha_trait != UndefinedPixelTrait) WritePackbitsLength(psd_info,image_info,image,next_image, compact_pixels,AlphaQuantum,exception); } (void) SetImageProgress(image,SaveImagesTag,0,6); WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, RedQuantum,MagickTrue,exception); (void) SetImageProgress(image,SaveImagesTag,1,6); WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, GreenQuantum,separate,exception); (void) SetImageProgress(image,SaveImagesTag,2,6); WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, BlueQuantum,separate,exception); (void) SetImageProgress(image,SaveImagesTag,3,6); if (next_image->colorspace == CMYKColorspace) WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, BlackQuantum,separate,exception); (void) SetImageProgress(image,SaveImagesTag,4,6); if (next_image->alpha_trait != UndefinedPixelTrait) WriteOneChannel(psd_info,image_info,image,next_image,compact_pixels, AlphaQuantum,separate,exception); (void) SetImageProgress(image,SaveImagesTag,5,6); if (next_image->colorspace == CMYKColorspace) (void) NegateCMYK(next_image,exception); } if (next_image->compression == RLECompression) compact_pixels=(unsigned char *) RelinquishMagickMemory(compact_pixels); return(MagickTrue); } ",1 "static void sctp_assoc_free_asconf_acks(struct sctp_association *asoc) { struct sctp_chunk *ack; struct sctp_chunk *tmp; list_for_each_entry_safe(ack, tmp, &asoc->asconf_ack_list, transmitted_list) { list_del_init(&ack->transmitted_list); sctp_chunk_free(ack); } } ",0 "IntSize WebPagePrivate::screenSize() const { return Platform::Graphics::Screen::primaryScreen()->size(); } ",0 " void WebSocketExperimentRunner::OnTaskCompleted(int result) { if (result == net::ERR_ABORTED) { task_.reset(); DLOG(INFO) << ""WebSocketExperiment Task is canceled.""; Release(); return; } task_->SaveResult(); task_.reset(); DoLoop(); } ",1 "static UWORD32 ihevcd_map_error(IHEVCD_ERROR_T e_error) { UWORD32 error_code = 0; error_code = e_error; switch(error_code) { case IHEVCD_SUCCESS : break; case IHEVCD_INIT_NOT_DONE: case IHEVCD_LEVEL_UNSUPPORTED: case IHEVCD_NUM_REF_UNSUPPORTED: case IHEVCD_NUM_REORDER_UNSUPPORTED: case IHEVCD_NUM_EXTRA_DISP_UNSUPPORTED: case IHEVCD_INSUFFICIENT_MEM_MVBANK: case IHEVCD_INSUFFICIENT_MEM_PICBUF: error_code |= 1 << IVD_FATALERROR; break; case IHEVCD_INVALID_DISP_STRD: case IHEVCD_CXA_VERS_BUF_INSUFFICIENT: case IHEVCD_UNSUPPORTED_VPS_ID: case IHEVCD_UNSUPPORTED_SPS_ID: case IHEVCD_UNSUPPORTED_PPS_ID: case IHEVCD_UNSUPPORTED_CHROMA_FMT_IDC: case IHEVCD_UNSUPPORTED_BIT_DEPTH: case IHEVCD_BUF_MGR_ERROR: case IHEVCD_NO_FREE_MVBANK: case IHEVCD_NO_FREE_PICBUF: case IHEVCD_SLICE_IN_HEADER_MODE: case IHEVCD_END_OF_SEQUENCE: break; default: break; } return error_code; } ",0 "void WebContentsImpl::DidReceiveCompositorFrame() { for (auto& observer : observers_) observer.DidReceiveCompositorFrame(); } ",0 "static struct zonelist *policy_zonelist(gfp_t gfp, struct mempolicy *policy, int nd) { switch (policy->mode) { case MPOL_PREFERRED: if (!(policy->flags & MPOL_F_LOCAL)) nd = policy->v.preferred_node; break; case MPOL_BIND: /* * Normally, MPOL_BIND allocations are node-local within the * allowed nodemask. However, if __GFP_THISNODE is set and the * current node isn't part of the mask, we use the zonelist for * the first node in the mask instead. */ if (unlikely(gfp & __GFP_THISNODE) && unlikely(!node_isset(nd, policy->v.nodes))) nd = first_node(policy->v.nodes); break; default: BUG(); } return node_zonelist(nd, gfp); } ",0 "MagickExport MagickOffsetType TellBlob(const Image *image) { BlobInfo *magick_restrict blob_info; MagickOffsetType offset; assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); assert(image->blob != (BlobInfo *) NULL); assert(image->blob->type != UndefinedStream); blob_info=image->blob; offset=(-1); switch (blob_info->type) { case UndefinedStream: case StandardStream: break; case FileStream: { offset=ftell(blob_info->file_info.file); break; } case PipeStream: break; case ZipStream: { #if defined(MAGICKCORE_ZLIB_DELEGATE) offset=(MagickOffsetType) gztell(blob_info->file_info.gzfile); #endif break; } case BZipStream: break; case FifoStream: break; case BlobStream: { offset=blob_info->offset; break; } case CustomStream: { if (blob_info->custom_stream->teller != (CustomStreamTeller) NULL) offset=blob_info->custom_stream->teller(blob_info->custom_stream->data); break; } } return(offset); } ",0 "void RenderViewImpl::PpapiPluginCreated(RendererPpapiHost* host) { FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidCreatePepperPlugin(host)); } ",0 "static int pow2gt (int x) { --x; x|=x>>1; x|=x>>2; x|=x>>4; x|=x>>8; x|=x>>16; return x+1; } ",0 "OxideQQuickWebViewAttached* OxideQQuickWebView::qmlAttachedProperties( QObject* object) { return new OxideQQuickWebViewAttached(object); } ",0 " void RunCurrentTasks() { size_t posted_tasks_size = runner_->GetPostedTasks().size(); for (size_t i = 0; i < posted_tasks_size; ++i) { runner_->RunNextTask(); } } ",0 "bool RootWindow::ProcessMouseEvent(Window* target, MouseEvent* event) { if (!target->IsVisible()) return false; EventFilters filters; GetEventFiltersToNotify(target->parent(), &filters); for (EventFilters::const_reverse_iterator it = filters.rbegin(), rend = filters.rend(); it != rend; ++it) { if ((*it)->PreHandleMouseEvent(target, event)) return true; } if (!target->delegate()) return false; return target->delegate()->OnMouseEvent(event); } ",0 "void sctp_write_space(struct sock *sk) { struct sctp_association *asoc; /* Wake up the tasks in each wait queue. */ list_for_each_entry(asoc, &((sctp_sk(sk))->ep->asocs), asocs) { __sctp_write_space(asoc); } } ",0 "CairoImageOutputDev::CairoImageOutputDev() { images = NULL; numImages = 0; size = 0; imgDrawCbk = NULL; imgDrawCbkData = NULL; } ",0 "void WebContentsImpl::RequestMediaAccessPermission( const MediaStreamRequest& request, const MediaResponseCallback& callback) { if (delegate_) { delegate_->RequestMediaAccessPermission(this, request, callback); } else { callback.Run(MediaStreamDevices(), MEDIA_DEVICE_FAILED_DUE_TO_SHUTDOWN, scoped_ptr()); } } ",0 "void HTMLMediaElement::onVisibilityChangedForAutoplay(bool isVisible) { if (!isVisible) return; if (shouldAutoplay()) { m_paused = false; scheduleEvent(EventTypeNames::play); scheduleNotifyPlaying(); m_autoplaying = false; updatePlayState(); } m_autoplayVisibilityObserver->stop(); m_autoplayVisibilityObserver = nullptr; } ",0 " Ins_MDRP( TT_ExecContext exc, FT_Long* args ) { FT_UShort point = 0; FT_F26Dot6 org_dist, distance, minimum_distance; minimum_distance = exc->GS.minimum_distance; #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->GS.freeVector.x != 0 && !( exc->sph_tweak_flags & SPH_TWEAK_NORMAL_ROUND ) ) minimum_distance = 0; #endif /* TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY */ point = (FT_UShort)args[0]; if ( BOUNDS( point, exc->zp1.n_points ) || BOUNDS( exc->GS.rp0, exc->zp0.n_points ) ) { if ( exc->pedantic_hinting ) exc->error = FT_THROW( Invalid_Reference ); goto Fail; } /* XXX: Is there some undocumented feature while in the */ /* twilight zone? */ /* XXX: UNDOCUMENTED: twilight zone special case */ if ( exc->GS.gep0 == 0 || exc->GS.gep1 == 0 ) { FT_Vector* vec1 = &exc->zp1.org[point]; FT_Vector* vec2 = &exc->zp0.org[exc->GS.rp0]; org_dist = DUALPROJ( vec1, vec2 ); } else { FT_Vector* vec1 = &exc->zp1.orus[point]; FT_Vector* vec2 = &exc->zp0.orus[exc->GS.rp0]; if ( exc->metrics.x_scale == exc->metrics.y_scale ) { /* this should be faster */ org_dist = DUALPROJ( vec1, vec2 ); org_dist = FT_MulFix( org_dist, exc->metrics.x_scale ); } else { FT_Vector vec; vec.x = FT_MulFix( SUB_LONG( vec1->x, vec2->x ), exc->metrics.x_scale ); vec.y = FT_MulFix( SUB_LONG( vec1->y, vec2->y ), exc->metrics.y_scale ); org_dist = FAST_DUALPROJ( &vec ); } } /* single width cut-in test */ /* |org_dist - single_width_value| < single_width_cutin */ if ( exc->GS.single_width_cutin > 0 && org_dist < exc->GS.single_width_value + exc->GS.single_width_cutin && org_dist > exc->GS.single_width_value - exc->GS.single_width_cutin ) { if ( org_dist >= 0 ) org_dist = exc->GS.single_width_value; else org_dist = -exc->GS.single_width_value; } /* round flag */ if ( ( exc->opcode & 4 ) != 0 ) { #ifdef TT_SUPPORT_SUBPIXEL_HINTING_INFINALITY if ( SUBPIXEL_HINTING_INFINALITY && exc->ignore_x_mode && exc->GS.freeVector.x != 0 ) distance = Round_None( exc, org_dist, exc->tt_metrics.compensations[exc->opcode & 3] ); else #endif distance = exc->func_round( exc, org_dist, exc->tt_metrics.compensations[exc->opcode & 3] ); } else distance = Round_None( exc, org_dist, exc->tt_metrics.compensations[exc->opcode & 3] ); /* minimum distance flag */ if ( ( exc->opcode & 8 ) != 0 ) { if ( org_dist >= 0 ) { if ( distance < minimum_distance ) distance = minimum_distance; } else { if ( distance > NEG_LONG( minimum_distance ) ) distance = NEG_LONG( minimum_distance ); } } /* now move the point */ org_dist = PROJECT( exc->zp1.cur + point, exc->zp0.cur + exc->GS.rp0 ); exc->func_move( exc, &exc->zp1, point, SUB_LONG( distance, org_dist ) ); Fail: exc->GS.rp1 = exc->GS.rp0; exc->GS.rp2 = point; if ( ( exc->opcode & 16 ) != 0 ) exc->GS.rp0 = point; } ",0 "static int bond_add_vlan(struct bonding *bond, unsigned short vlan_id) { struct vlan_entry *vlan; pr_debug(""bond: %s, vlan id %d\n"", (bond ? bond->dev->name : ""None""), vlan_id); vlan = kzalloc(sizeof(struct vlan_entry), GFP_KERNEL); if (!vlan) return -ENOMEM; INIT_LIST_HEAD(&vlan->vlan_list); vlan->vlan_id = vlan_id; write_lock_bh(&bond->lock); list_add_tail(&vlan->vlan_list, &bond->vlan_list); write_unlock_bh(&bond->lock); pr_debug(""added VLAN ID %d on bond %s\n"", vlan_id, bond->dev->name); return 0; } ",0 "WTF::String EditorClientBlackBerry::getAutoCorrectSuggestionForMisspelledWord(const WTF::String& misspelledWord) { notImplemented(); return WTF::String(); } ",0 " const Extension* GetExtension() { const ExtensionList* extensions = browser()->profile()->GetExtensionService()->extensions(); for (size_t i = 0; i < extensions->size(); ++i) { if ((*extensions)[i]->name() == ""App Test"") return (*extensions)[i]; } NOTREACHED(); return NULL; } ",0 "void tcm_loop_drop_scsi_hba( struct se_wwn *wwn) { struct tcm_loop_hba *tl_hba = container_of(wwn, struct tcm_loop_hba, tl_hba_wwn); int host_no = tl_hba->sh->host_no; /* * Call device_unregister() on the original tl_hba->dev. * tcm_loop_fabric_scsi.c:tcm_loop_release_adapter() will * release *tl_hba; */ device_unregister(&tl_hba->dev); printk(KERN_INFO ""TCM_Loop_ConfigFS: Deallocated emulated Target"" "" SAS Address: %s at Linux/SCSI Host ID: %d\n"", config_item_name(&wwn->wwn_group.cg_item), host_no); } ",0 " void CWebServer::Cmd_GetVersion(WebEmSession & session, const request& req, Json::Value &root) { root[""status""] = ""OK""; root[""title""] = ""GetVersion""; root[""version""] = szAppVersion; root[""hash""] = szAppHash; root[""build_time""] = szAppDate; CdzVents* dzvents = CdzVents::GetInstance(); root[""dzvents_version""] = dzvents->GetVersion(); root[""python_version""] = szPyVersion; if (session.rights != 2) { root[""UseUpdate""] = false; root[""HaveUpdate""] = false; } else { root[""UseUpdate""] = g_bUseUpdater; root[""HaveUpdate""] = m_mainworker.IsUpdateAvailable(false); root[""DomoticzUpdateURL""] = m_mainworker.m_szDomoticzUpdateURL; root[""SystemName""] = m_mainworker.m_szSystemName; root[""Revision""] = m_mainworker.m_iRevision; } } ",0 "METHODDEF(JDIMENSION) get_gray_rgb_row(j_compress_ptr cinfo, cjpeg_source_ptr sinfo) /* This version is for reading raw-byte-format PGM files with any maxval and converting to extended RGB */ { ppm_source_ptr source = (ppm_source_ptr)sinfo; register JSAMPROW ptr; register U_CHAR *bufferptr; register JSAMPLE *rescale = source->rescale; JDIMENSION col; unsigned int maxval = source->maxval; register int rindex = rgb_red[cinfo->in_color_space]; register int gindex = rgb_green[cinfo->in_color_space]; register int bindex = rgb_blue[cinfo->in_color_space]; register int aindex = alpha_index[cinfo->in_color_space]; register int ps = rgb_pixelsize[cinfo->in_color_space]; if (!ReadOK(source->pub.input_file, source->iobuffer, source->buffer_width)) ERREXIT(cinfo, JERR_INPUT_EOF); ptr = source->pub.buffer[0]; bufferptr = source->iobuffer; if (maxval == MAXJSAMPLE) { if (aindex >= 0) GRAY_RGB_READ_LOOP(*bufferptr++, ptr[aindex] = 0xFF;) else GRAY_RGB_READ_LOOP(*bufferptr++,) } else { if (aindex >= 0) GRAY_RGB_READ_LOOP(rescale[UCH(*bufferptr++)], ptr[aindex] = 0xFF;) else GRAY_RGB_READ_LOOP(rescale[UCH(*bufferptr++)],) } return 1; } ",0 "static void pxa2xx_pwrmode_write(CPUARMState *env, const ARMCPRegInfo *ri, uint64_t value) { PXA2xxState *s = (PXA2xxState *)ri->opaque; static const char *pwrmode[8] = { ""Normal"", ""Idle"", ""Deep-idle"", ""Standby"", ""Sleep"", ""reserved (!)"", ""reserved (!)"", ""Deep-sleep"", }; if (value & 8) { printf(""%s: CPU voltage change attempt\n"", __func__); } switch (value & 7) { case 0: /* Do nothing */ break; case 1: /* Idle */ if (!(s->cm_regs[CCCR >> 2] & (1U << 31))) { /* CPDIS */ cpu_interrupt(CPU(s->cpu), CPU_INTERRUPT_HALT); break; } /* Fall through. */ case 2: /* Deep-Idle */ cpu_interrupt(CPU(s->cpu), CPU_INTERRUPT_HALT); s->pm_regs[RCSR >> 2] |= 0x8; /* Set GPR */ goto message; case 3: s->cpu->env.uncached_cpsr = ARM_CPU_MODE_SVC; s->cpu->env.daif = PSTATE_A | PSTATE_F | PSTATE_I; s->cpu->env.cp15.c1_sys = 0; s->cpu->env.cp15.c1_coproc = 0; s->cpu->env.cp15.ttbr0_el1 = 0; s->cpu->env.cp15.c3 = 0; s->pm_regs[PSSR >> 2] |= 0x8; /* Set STS */ s->pm_regs[RCSR >> 2] |= 0x8; /* Set GPR */ /* * The scratch-pad register is almost universally used * for storing the return address on suspend. For the * lack of a resuming bootloader, perform a jump * directly to that address. */ memset(s->cpu->env.regs, 0, 4 * 15); s->cpu->env.regs[15] = s->pm_regs[PSPR >> 2]; #if 0 buffer = 0xe59ff000; /* ldr pc, [pc, #0] */ cpu_physical_memory_write(0, &buffer, 4); buffer = s->pm_regs[PSPR >> 2]; cpu_physical_memory_write(8, &buffer, 4); #endif /* Suspend */ cpu_interrupt(current_cpu, CPU_INTERRUPT_HALT); goto message; default: message: printf(""%s: machine entered %s mode\n"", __func__, pwrmode[value & 7]); } } ",0 "static int pva_probe(AVProbeData * pd) { const unsigned char *buf = pd->buf; int len = pva_check(buf); if (len < 0) return 0; if (pd->buf_size >= len + 8 && pva_check(buf + len) >= 0) return AVPROBE_SCORE_EXTENSION; return AVPROBE_SCORE_MAX / 4; } ",0 "static LayoutUnit alignContentSpaceBetweenChildren(LayoutUnit availableFreeSpace, EAlignContent alignContent, unsigned numberOfLines) { if (availableFreeSpace > 0 && numberOfLines > 1) { if (alignContent == AlignContentSpaceBetween) return availableFreeSpace / (numberOfLines - 1); if (alignContent == AlignContentSpaceAround || alignContent == AlignContentStretch) return availableFreeSpace / numberOfLines; } return 0; } ",0 "static struct fb_info *file_fb_info(struct file *file) { struct inode *inode = file_inode(file); int fbidx = iminor(inode); struct fb_info *info = registered_fb[fbidx]; if (info != file->private_data) info = NULL; return info; } ",0 "static void cparams(JF, js_Ast *list, js_Ast *fname) { F->numparams = listlength(list); while (list) { checkfutureword(J, F, list->a); addlocal(J, F, list->a, 0); list = list->b; } } ",0 "static int tcos_delete_file(sc_card_t *card, const sc_path_t *path) { int r; u8 sbuf[2]; sc_apdu_t apdu; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); if (path->type != SC_PATH_TYPE_FILE_ID && path->len != 2) { sc_debug(card->ctx, SC_LOG_DEBUG_NORMAL, ""File type has to be SC_PATH_TYPE_FILE_ID\n""); SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_NORMAL, SC_ERROR_INVALID_ARGUMENTS); } sbuf[0] = path->value[0]; sbuf[1] = path->value[1]; sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xE4, 0x00, 0x00); apdu.cla |= 0x80; apdu.lc = 2; apdu.datalen = 2; apdu.data = sbuf; r = sc_transmit_apdu(card, &apdu); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, ""APDU transmit failed""); return sc_check_sw(card, apdu.sw1, apdu.sw2); } ",0 "static void CL_OldGame(void) { if(cl_oldGameSet) { cl_oldGameSet = qfalse; Cvar_Set2(""fs_game"", cl_oldGame, qtrue); FS_ConditionalRestart(clc.checksumFeed, qfalse); } } ",0 "unsigned __dm_get_module_param(unsigned *module_param, unsigned def, unsigned max) { unsigned param = ACCESS_ONCE(*module_param); unsigned modified_param = 0; if (!param) modified_param = def; else if (param > max) modified_param = max; if (modified_param) { (void)cmpxchg(module_param, param, modified_param); param = modified_param; } return param; } ",0 "void FileAPIMessageFilter::DidWrite(int request_id, base::PlatformFileError result, int64 bytes, bool complete) { if (result == base::PLATFORM_FILE_OK) { Send(new FileSystemMsg_DidWrite(request_id, bytes, complete)); if (complete) UnregisterOperation(request_id); } else { Send(new FileSystemMsg_DidFail(request_id, result)); UnregisterOperation(request_id); } } ",0 "static void mem_cgroup_may_update_nodemask(struct mem_cgroup *memcg) { int nid; /* * numainfo_events > 0 means there was at least NUMAINFO_EVENTS_TARGET * pagein/pageout changes since the last update. */ if (!atomic_read(&memcg->numainfo_events)) return; if (atomic_inc_return(&memcg->numainfo_updating) > 1) return; /* make a nodemask where this memcg uses memory from */ memcg->scan_nodes = node_states[N_HIGH_MEMORY]; for_each_node_mask(nid, node_states[N_HIGH_MEMORY]) { if (!test_mem_cgroup_node_reclaimable(memcg, nid, false)) node_clear(nid, memcg->scan_nodes); } atomic_set(&memcg->numainfo_events, 0); atomic_set(&memcg->numainfo_updating, 0); } ",0 "void ResourceDispatcherHostImpl::OnCancelRequest(int request_id) { CancelRequest(filter_->child_id(), request_id, true); } ",0 "BrowserActionsContainer::BrowserActionsContainer( Profile* profile, ToolbarView* toolbar) : profile_(profile), toolbar_(toolbar), popup_(NULL), popup_button_(NULL), model_(NULL), resize_gripper_(NULL), chevron_(NULL), suppress_chevron_(false), resize_amount_(0), animation_target_size_(0), ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) { SetID(VIEW_ID_BROWSER_ACTION_TOOLBAR); ExtensionsService* extension_service = profile->GetExtensionsService(); if (!extension_service) // The |extension_service| can be NULL in Incognito. return; registrar_.Add(this, NotificationType::EXTENSION_HOST_VIEW_SHOULD_CLOSE, Source(profile_)); model_ = extension_service->toolbar_model(); model_->AddObserver(this); resize_animation_.reset(new SlideAnimation(this)); resize_gripper_ = new views::ResizeGripper(this); resize_gripper_->SetVisible(false); AddChildView(resize_gripper_); ResourceBundle& rb = ResourceBundle::GetSharedInstance(); SkBitmap* chevron_image = rb.GetBitmapNamed(IDR_BOOKMARK_BAR_CHEVRONS); chevron_ = new views::MenuButton(NULL, std::wstring(), this, false); chevron_->SetVisible(false); chevron_->SetIcon(*chevron_image); chevron_->EnableCanvasFlippingForRTLUI(true); AddChildView(chevron_); int predefined_width = profile_->GetPrefs()->GetInteger(prefs::kBrowserActionContainerWidth); container_size_ = gfx::Size(predefined_width, kButtonSize); } ",1 "static ssize_t objects_partial_show(struct kmem_cache *s, char *buf) { return show_slab_objects(s, buf, SO_PARTIAL|SO_OBJECTS); } ",0 "static int process_cpu_clock_get(const clockid_t which_clock, struct timespec *tp) { return posix_cpu_clock_get(PROCESS_CLOCK, tp); } ",0 "void TabsExecuteScriptFunction::OnExecuteCodeFinished( const std::string& error, const GURL& on_url, const base::ListValue& result) { if (error.empty()) SetResult(result.CreateDeepCopy()); ExecuteCodeInTabFunction::OnExecuteCodeFinished(error, on_url, result); } ",0 "String Document::nodeName() const { return ""#document""; } ",0 "XcursorXcFileLoadAllImages (XcursorFile *file) { XcursorFileHeader *fileHeader; XcursorImage *image; XcursorImages *images; int nimage; int n; int toc; if (!file) return NULL; fileHeader = _XcursorReadFileHeader (file); if (!fileHeader) return NULL; nimage = 0; for (n = 0; n < fileHeader->ntoc; n++) { switch (fileHeader->tocs[n].type) { case XCURSOR_IMAGE_TYPE: nimage++; break; } } images = XcursorImagesCreate (nimage); if (!images) { _XcursorFileHeaderDestroy (fileHeader); return NULL; } for (toc = 0; toc < fileHeader->ntoc; toc++) { switch (fileHeader->tocs[toc].type) { case XCURSOR_IMAGE_TYPE: image = _XcursorReadImage (file, fileHeader, toc); if (image) { images->images[images->nimage] = image; images->nimage++; } break; } } _XcursorFileHeaderDestroy (fileHeader); if (images->nimage != nimage) { XcursorImagesDestroy (images); images = NULL; } return images; } ",0 "void NuPlayer::GenericSource::queueDiscontinuityIfNeeded( bool seeking, bool formatChange, media_track_type trackType, Track *track) { if ((seeking || formatChange) && (trackType == MEDIA_TRACK_TYPE_AUDIO || trackType == MEDIA_TRACK_TYPE_VIDEO)) { ATSParser::DiscontinuityType type = (formatChange && seeking) ? ATSParser::DISCONTINUITY_FORMATCHANGE : ATSParser::DISCONTINUITY_NONE; track->mPackets->queueDiscontinuity(type, NULL /* extra */, true /* discard */); } } ",0 "static int hub_port_wait_reset(struct usb_hub *hub, int port1, struct usb_device *udev, unsigned int delay, bool warm) { int delay_time, ret; u16 portstatus; u16 portchange; for (delay_time = 0; delay_time < HUB_RESET_TIMEOUT; delay_time += delay) { /* wait to give the device a chance to reset */ msleep(delay); /* read and decode port status */ ret = hub_port_status(hub, port1, &portstatus, &portchange); if (ret < 0) return ret; /* The port state is unknown until the reset completes. */ if (!(portstatus & USB_PORT_STAT_RESET)) break; /* switch to the long delay after two short delay failures */ if (delay_time >= 2 * HUB_SHORT_RESET_TIME) delay = HUB_LONG_RESET_TIME; dev_dbg(&hub->ports[port1 - 1]->dev, ""not %sreset yet, waiting %dms\n"", warm ? ""warm "" : """", delay); } if ((portstatus & USB_PORT_STAT_RESET)) return -EBUSY; if (hub_port_warm_reset_required(hub, port1, portstatus)) return -ENOTCONN; /* Device went away? */ if (!(portstatus & USB_PORT_STAT_CONNECTION)) return -ENOTCONN; /* bomb out completely if the connection bounced. A USB 3.0 * connection may bounce if multiple warm resets were issued, * but the device may have successfully re-connected. Ignore it. */ if (!hub_is_superspeed(hub->hdev) && (portchange & USB_PORT_STAT_C_CONNECTION)) return -ENOTCONN; if (!(portstatus & USB_PORT_STAT_ENABLE)) return -EBUSY; if (!udev) return 0; if (hub_is_wusb(hub)) udev->speed = USB_SPEED_WIRELESS; else if (hub_is_superspeed(hub->hdev)) udev->speed = USB_SPEED_SUPER; else if (portstatus & USB_PORT_STAT_HIGH_SPEED) udev->speed = USB_SPEED_HIGH; else if (portstatus & USB_PORT_STAT_LOW_SPEED) udev->speed = USB_SPEED_LOW; else udev->speed = USB_SPEED_FULL; return 0; } ",0 "gfx::NativeWindow AppListController::GetAppListWindow() { if (!IsAppListVisible()) return NULL; return current_view_ ? current_view_->GetWidget()->GetNativeWindow() : NULL; } ",0 "static int ahash_sha1_init(struct ahash_request *req) { struct crypto_ahash *tfm = crypto_ahash_reqtfm(req); struct hash_ctx *ctx = crypto_ahash_ctx(tfm); ctx->config.data_format = HASH_DATA_8_BITS; ctx->config.algorithm = HASH_ALGO_SHA1; ctx->config.oper_mode = HASH_OPER_MODE_HASH; ctx->digestsize = SHA1_DIGEST_SIZE; return hash_init(req); } ",0 "static inline LineContribType *_gdContributionsCalc(unsigned int line_size, unsigned int src_size, double scale_d, const interpolation_method pFilter) { double width_d; double scale_f_d = 1.0; const double filter_width_d = DEFAULT_BOX_RADIUS; int windows_size; unsigned int u; LineContribType *res; if (scale_d < 1.0) { width_d = filter_width_d / scale_d; scale_f_d = scale_d; } else { width_d= filter_width_d; } windows_size = 2 * (int)ceil(width_d) + 1; res = _gdContributionsAlloc(line_size, windows_size); if (res == NULL) { return NULL; } for (u = 0; u < line_size; u++) { const double dCenter = (double)u / scale_d; /* get the significant edge points affecting the pixel */ register int iLeft = MAX(0, (int)floor (dCenter - width_d)); int iRight = MIN((int)ceil(dCenter + width_d), (int)src_size - 1); double dTotalWeight = 0.0; int iSrc; /* Cut edge points to fit in filter window in case of spill-off */ if (iRight - iLeft + 1 > windows_size) { if (iLeft < ((int)src_size - 1 / 2)) { iLeft++; } else { iRight--; } } res->ContribRow[u].Left = iLeft; res->ContribRow[u].Right = iRight; for (iSrc = iLeft; iSrc <= iRight; iSrc++) { dTotalWeight += (res->ContribRow[u].Weights[iSrc-iLeft] = scale_f_d * (*pFilter)(scale_f_d * (dCenter - (double)iSrc))); } if (dTotalWeight < 0.0) { _gdContributionsFree(res); return NULL; } if (dTotalWeight > 0.0) { for (iSrc = iLeft; iSrc <= iRight; iSrc++) { res->ContribRow[u].Weights[iSrc-iLeft] /= dTotalWeight; } } } return res; } ",0 "static int ip_vs_genl_get_cmd(struct sk_buff *skb, struct genl_info *info) { struct sk_buff *msg; void *reply; int ret, cmd, reply_cmd; struct net *net; net = skb_sknet(skb); cmd = info->genlhdr->cmd; if (cmd == IPVS_CMD_GET_SERVICE) reply_cmd = IPVS_CMD_NEW_SERVICE; else if (cmd == IPVS_CMD_GET_INFO) reply_cmd = IPVS_CMD_SET_INFO; else if (cmd == IPVS_CMD_GET_CONFIG) reply_cmd = IPVS_CMD_SET_CONFIG; else { pr_err(""unknown Generic Netlink command\n""); return -EINVAL; } msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) return -ENOMEM; mutex_lock(&__ip_vs_mutex); reply = genlmsg_put_reply(msg, info, &ip_vs_genl_family, 0, reply_cmd); if (reply == NULL) goto nla_put_failure; switch (cmd) { case IPVS_CMD_GET_SERVICE: { struct ip_vs_service *svc; svc = ip_vs_genl_find_service(net, info->attrs[IPVS_CMD_ATTR_SERVICE]); if (IS_ERR(svc)) { ret = PTR_ERR(svc); goto out_err; } else if (svc) { ret = ip_vs_genl_fill_service(msg, svc); if (ret) goto nla_put_failure; } else { ret = -ESRCH; goto out_err; } break; } case IPVS_CMD_GET_CONFIG: { struct ip_vs_timeout_user t; __ip_vs_get_timeouts(net, &t); #ifdef CONFIG_IP_VS_PROTO_TCP if (nla_put_u32(msg, IPVS_CMD_ATTR_TIMEOUT_TCP, t.tcp_timeout) || nla_put_u32(msg, IPVS_CMD_ATTR_TIMEOUT_TCP_FIN, t.tcp_fin_timeout)) goto nla_put_failure; #endif #ifdef CONFIG_IP_VS_PROTO_UDP if (nla_put_u32(msg, IPVS_CMD_ATTR_TIMEOUT_UDP, t.udp_timeout)) goto nla_put_failure; #endif break; } case IPVS_CMD_GET_INFO: if (nla_put_u32(msg, IPVS_INFO_ATTR_VERSION, IP_VS_VERSION_CODE) || nla_put_u32(msg, IPVS_INFO_ATTR_CONN_TAB_SIZE, ip_vs_conn_tab_size)) goto nla_put_failure; break; } genlmsg_end(msg, reply); ret = genlmsg_reply(msg, info); goto out; nla_put_failure: pr_err(""not enough space in Netlink message\n""); ret = -EMSGSIZE; out_err: nlmsg_free(msg); out: mutex_unlock(&__ip_vs_mutex); return ret; } ",0 "void __init idt_setup_apic_and_irq_gates(void) { int i = FIRST_EXTERNAL_VECTOR; void *entry; idt_setup_from_table(idt_table, apic_idts, ARRAY_SIZE(apic_idts), true); for_each_clear_bit_from(i, system_vectors, FIRST_SYSTEM_VECTOR) { entry = irq_entries_start + 8 * (i - FIRST_EXTERNAL_VECTOR); set_intr_gate(i, entry); } for_each_clear_bit_from(i, system_vectors, NR_VECTORS) { #ifdef CONFIG_X86_LOCAL_APIC set_bit(i, system_vectors); set_intr_gate(i, spurious_interrupt); #else entry = irq_entries_start + 8 * (i - FIRST_EXTERNAL_VECTOR); set_intr_gate(i, entry); #endif } } ",0 "void ExtensionDevToolsClientHost::SendDetachedEvent() { if (!EventRouter::Get(profile_)) return; std::unique_ptr args( OnDetach::Create(debuggee_, detach_reason_)); auto event = std::make_unique(events::DEBUGGER_ON_DETACH, OnDetach::kEventName, std::move(args), profile_); EventRouter::Get(profile_)->DispatchEventToExtension(extension_id(), std::move(event)); } ",0 "void DownloadItemImpl::OnTargetPathSelected(const FilePath& target_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK_EQ(TARGET_DISPOSITION_PROMPT, target_disposition_); target_path_ = target_path; } ",0 "void Splash::setBlendFunc(SplashBlendFunc func) { state->blendFunc = func; } ",0 "BrowserView::~BrowserView() { #if defined(USE_ASH) launcher_item_controller_.reset(); #endif preview_controller_.reset(NULL); browser_->tab_strip_model()->RemoveObserver(this); #if defined(OS_WIN) && !defined(USE_AURA) ticker_.Stop(); ticker_.UnregisterTickHandler(&hung_window_detector_); if (jumplist_) { jumplist_->Terminate(); } #endif download_shelf_.reset(); if (tabstrip_) { tabstrip_->parent()->RemoveChildView(tabstrip_); delete tabstrip_; tabstrip_ = NULL; } RemoveAllChildViews(true); browser_.reset(); } ",0 "void setJSTestObjStrawberry(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast(thisObject); TestObj* impl = static_cast(castedThis->impl()); impl->setBlueberry(toint(value)); } ",0 "bool Texture::AllocateStorage(const gfx::Size& size) { DCHECK_NE(id_, 0u); ScopedGLErrorSuppressor suppressor(decoder_); ScopedTexture2DBinder binder(decoder_, id_); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); glTexImage2D(GL_TEXTURE_2D, 0, // mip level GL_RGBA, size.width(), size.height(), 0, // border GL_RGBA, GL_UNSIGNED_BYTE, NULL); size_ = size; return glGetError() == GL_NO_ERROR; } ",0 "bool Document::NeedsLayoutTreeUpdateForNode(const Node& node) const { if (!node.CanParticipateInFlatTree()) return false; if (!NeedsLayoutTreeUpdate()) return false; if (!node.isConnected()) return false; if (NeedsFullLayoutTreeUpdate() || node.NeedsStyleRecalc() || node.NeedsStyleInvalidation()) return true; for (const ContainerNode* ancestor = LayoutTreeBuilderTraversal::Parent(node); ancestor; ancestor = LayoutTreeBuilderTraversal::Parent(*ancestor)) { if (ShadowRoot* root = ancestor->GetShadowRoot()) { if (root->NeedsStyleRecalc() || root->NeedsStyleInvalidation() || root->NeedsAdjacentStyleRecalc()) { return true; } } if (ancestor->NeedsStyleRecalc() || ancestor->NeedsStyleInvalidation() || ancestor->NeedsAdjacentStyleRecalc()) { return true; } } return false; } ",0 "void DrawingBuffer::MailboxReleasedGpu(RefPtr color_buffer, const gpu::SyncToken& sync_token, bool lost_resource) { if (color_buffer == front_color_buffer_) front_color_buffer_ = nullptr; color_buffer->receive_sync_token = sync_token; if (destruction_in_progress_ || color_buffer->size != size_ || gl_->GetGraphicsResetStatusKHR() != GL_NO_ERROR || lost_resource || is_hidden_) { return; } size_t cache_limit = 1; if (ShouldUseChromiumImage()) cache_limit = 4; while (recycled_color_buffer_queue_.size() >= cache_limit) recycled_color_buffer_queue_.TakeLast(); recycled_color_buffer_queue_.push_front(color_buffer); } ",0 "static void __exit ipgre_fini(void) { rtnl_link_unregister(&ipgre_tap_ops); rtnl_link_unregister(&ipgre_link_ops); if (gre_del_protocol(&ipgre_protocol, GREPROTO_CISCO) < 0) printk(KERN_INFO ""ipgre close: can't remove protocol\n""); unregister_pernet_device(&ipgre_net_ops); } ",0 "void Document::ClearResizedForViewportUnits() { EnsureStyleResolver().ClearResizedForViewportUnits(); } ",0 "void AutofillManager::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { registry->RegisterDoublePref( prefs::kAutofillBillingCustomerNumber, 0.0, user_prefs::PrefRegistrySyncable::SYNCABLE_PRIORITY_PREF); registry->RegisterIntegerPref( prefs::kAutofillCreditCardSigninPromoImpressionCount, 0); registry->RegisterBooleanPref( prefs::kAutofillEnabled, true, user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterIntegerPref( prefs::kAutofillLastVersionDeduped, 0, user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterIntegerPref( prefs::kAutofillLastVersionDisusedAddressesDeleted, 0, user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); registry->RegisterBooleanPref(prefs::kAutofillWalletImportEnabled, true); registry->RegisterBooleanPref( prefs::kAutofillWalletImportStorageCheckboxState, true); registry->RegisterIntegerPref( prefs::kAutofillAcceptSaveCreditCardPromptState, prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE); registry->RegisterIntegerPref( prefs::kAutofillLastVersionDisusedCreditCardsDeleted, 0); registry->RegisterBooleanPref(prefs::kAutofillCreditCardEnabled, true); registry->RegisterBooleanPref(prefs::kAutofillOrphanRowsRemoved, false); } ",0 "static void OverloadedMethodC2Method(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); TestInterfaceEmpty* test_interface_empty_arg; test_interface_empty_arg = V8TestInterfaceEmpty::ToImplWithTypeCheck(info.GetIsolate(), info[0]); if (!test_interface_empty_arg) { V8ThrowException::ThrowTypeError(info.GetIsolate(), ExceptionMessages::FailedToExecute(""overloadedMethodC"", ""TestObject"", ExceptionMessages::ArgumentNotOfType(0, ""TestInterfaceEmpty""))); return; } impl->overloadedMethodC(test_interface_empty_arg); } ",0 "static ssize_t ap_depth_show(struct device *dev, struct device_attribute *attr, char *buf) { struct ap_device *ap_dev = to_ap_dev(dev); return snprintf(buf, PAGE_SIZE, ""%d\n"", ap_dev->queue_depth); } ",0 "static int fuse_wait_on_page_writeback(struct inode *inode, pgoff_t index) { struct fuse_inode *fi = get_fuse_inode(inode); wait_event(fi->page_waitq, !fuse_page_is_writeback(inode, index)); return 0; } ",0 "void HWNDMessageHandler::OnActivateApp(BOOL active, DWORD thread_id) { if (delegate_->IsWidgetWindow() && !active && thread_id != GetCurrentThreadId()) { delegate_->HandleAppDeactivated(); if (!remove_standard_frame_ && !delegate_->IsUsingCustomFrame()) DefWindowProcWithRedrawLock(WM_NCACTIVATE, FALSE, 0); } } ",0 "void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str, int width, int height, GfxImageColorMap *colorMap, int *maskColors, GBool inlineImg) { unsigned char *buffer; unsigned int *dest; int x, y; ImageStream *imgStr; Guchar *pix; int i; double *ctm; QMatrix matrix; int is_identity_transform; buffer = (unsigned char *)gmalloc (width * height * 4); /* TODO: Do we want to cache these? */ imgStr = new ImageStream(str, width, colorMap->getNumPixelComps(), colorMap->getBits()); imgStr->reset(); /* ICCBased color space doesn't do any color correction * so check its underlying color space as well */ is_identity_transform = colorMap->getColorSpace()->getMode() == csDeviceRGB || (colorMap->getColorSpace()->getMode() == csICCBased && ((GfxICCBasedColorSpace*)colorMap->getColorSpace())->getAlt()->getMode() == csDeviceRGB); if (maskColors) { for (y = 0; y < height; y++) { dest = (unsigned int *) (buffer + y * 4 * width); pix = imgStr->getLine(); colorMap->getRGBLine (pix, dest, width); for (x = 0; x < width; x++) { for (i = 0; i < colorMap->getNumPixelComps(); ++i) { if (pix[i] < maskColors[2*i] * 255|| pix[i] > maskColors[2*i+1] * 255) { *dest = *dest | 0xff000000; break; } } pix += colorMap->getNumPixelComps(); dest++; } } m_image = new QImage(buffer, width, height, QImage::Format_ARGB32); } else { for (y = 0; y < height; y++) { dest = (unsigned int *) (buffer + y * 4 * width); pix = imgStr->getLine(); colorMap->getRGBLine (pix, dest, width); } m_image = new QImage(buffer, width, height, QImage::Format_RGB32); } if (m_image == NULL || m_image->isNull()) { qDebug() << ""Null image""; delete imgStr; return; } ctm = state->getCTM(); matrix.setMatrix(ctm[0] / width, ctm[1] / width, -ctm[2] / height, -ctm[3] / height, ctm[2] + ctm[4], ctm[3] + ctm[5]); m_painter->setMatrix(matrix, true); m_painter->drawImage( QPoint(0,0), *m_image ); delete m_image; m_image = 0; free (buffer); delete imgStr; } ",1 "DefragDoSturgesNovakTest(int policy, u_char *expected, size_t expected_len) { int i; int ret = 0; DefragInit(); /* * Build the packets. */ int id = 1; Packet *packets[17]; memset(packets, 0x00, sizeof(packets)); /* * Original fragments. */ /* A*24 at 0. */ packets[0] = BuildTestPacket(id, 0, 1, 'A', 24); /* B*15 at 32. */ packets[1] = BuildTestPacket(id, 32 >> 3, 1, 'B', 16); /* C*24 at 48. */ packets[2] = BuildTestPacket(id, 48 >> 3, 1, 'C', 24); /* D*8 at 80. */ packets[3] = BuildTestPacket(id, 80 >> 3, 1, 'D', 8); /* E*16 at 104. */ packets[4] = BuildTestPacket(id, 104 >> 3, 1, 'E', 16); /* F*24 at 120. */ packets[5] = BuildTestPacket(id, 120 >> 3, 1, 'F', 24); /* G*16 at 144. */ packets[6] = BuildTestPacket(id, 144 >> 3, 1, 'G', 16); /* H*16 at 160. */ packets[7] = BuildTestPacket(id, 160 >> 3, 1, 'H', 16); /* I*8 at 176. */ packets[8] = BuildTestPacket(id, 176 >> 3, 1, 'I', 8); /* * Overlapping subsequent fragments. */ /* J*32 at 8. */ packets[9] = BuildTestPacket(id, 8 >> 3, 1, 'J', 32); /* K*24 at 48. */ packets[10] = BuildTestPacket(id, 48 >> 3, 1, 'K', 24); /* L*24 at 72. */ packets[11] = BuildTestPacket(id, 72 >> 3, 1, 'L', 24); /* M*24 at 96. */ packets[12] = BuildTestPacket(id, 96 >> 3, 1, 'M', 24); /* N*8 at 128. */ packets[13] = BuildTestPacket(id, 128 >> 3, 1, 'N', 8); /* O*8 at 152. */ packets[14] = BuildTestPacket(id, 152 >> 3, 1, 'O', 8); /* P*8 at 160. */ packets[15] = BuildTestPacket(id, 160 >> 3, 1, 'P', 8); /* Q*16 at 176. */ packets[16] = BuildTestPacket(id, 176 >> 3, 0, 'Q', 16); default_policy = policy; /* Send all but the last. */ for (i = 0; i < 9; i++) { Packet *tp = Defrag(NULL, NULL, packets[i], NULL); if (tp != NULL) { SCFree(tp); goto end; } if (ENGINE_ISSET_EVENT(packets[i], IPV4_FRAG_OVERLAP)) { goto end; } } int overlap = 0; for (; i < 16; i++) { Packet *tp = Defrag(NULL, NULL, packets[i], NULL); if (tp != NULL) { SCFree(tp); goto end; } if (ENGINE_ISSET_EVENT(packets[i], IPV4_FRAG_OVERLAP)) { overlap++; } } if (!overlap) { goto end; } /* And now the last one. */ Packet *reassembled = Defrag(NULL, NULL, packets[16], NULL); if (reassembled == NULL) { goto end; } if (IPV4_GET_HLEN(reassembled) != 20) { goto end; } if (IPV4_GET_IPLEN(reassembled) != 20 + 192) { goto end; } if (memcmp(GET_PKT_DATA(reassembled) + 20, expected, expected_len) != 0) { goto end; } SCFree(reassembled); /* Make sure all frags were returned back to the pool. */ if (defrag_context->frag_pool->outstanding != 0) { goto end; } ret = 1; end: for (i = 0; i < 17; i++) { SCFree(packets[i]); } DefragDestroy(); return ret; } ",1 "void Element::scheduleSyntheticStyleChange() { if (postAttachCallbacksAreSuspended()) queuePostAttachCallback(needsSyntheticStyleChangeCallback, this); else setNeedsStyleRecalc(SyntheticStyleChange); } ",0 "static void coroutine_fn v9fs_readlink(void *opaque) { V9fsPDU *pdu = opaque; size_t offset = 7; V9fsString target; int32_t fid; int err = 0; V9fsFidState *fidp; err = pdu_unmarshal(pdu, offset, ""d"", &fid); if (err < 0) { goto out_nofid; } trace_v9fs_readlink(pdu->tag, pdu->id, fid); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -ENOENT; goto out_nofid; } v9fs_string_init(&target); err = v9fs_co_readlink(pdu, &fidp->path, &target); if (err < 0) { goto out; } err = pdu_marshal(pdu, offset, ""s"", &target); if (err < 0) { v9fs_string_free(&target); goto out; } err += offset; trace_v9fs_readlink_return(pdu->tag, pdu->id, target.data); v9fs_string_free(&target); out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); } ",0 "ecryptfs_unlocked_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { struct file *lower_file = ecryptfs_file_to_lower(file); long rc = -ENOTTY; if (!lower_file->f_op->unlocked_ioctl) return rc; switch (cmd) { case FITRIM: case FS_IOC_GETFLAGS: case FS_IOC_SETFLAGS: case FS_IOC_GETVERSION: case FS_IOC_SETVERSION: rc = lower_file->f_op->unlocked_ioctl(lower_file, cmd, arg); fsstack_copy_attr_all(file_inode(file), file_inode(lower_file)); return rc; default: return rc; } } ",0 "static void blk_mq_free_rq_map(struct blk_mq_tag_set *set, struct blk_mq_tags *tags, unsigned int hctx_idx) { struct page *page; if (tags->rqs && set->ops->exit_request) { int i; for (i = 0; i < tags->nr_tags; i++) { if (!tags->rqs[i]) continue; set->ops->exit_request(set->driver_data, tags->rqs[i], hctx_idx, i); tags->rqs[i] = NULL; } } while (!list_empty(&tags->page_list)) { page = list_first_entry(&tags->page_list, struct page, lru); list_del_init(&page->lru); __free_pages(page, page->private); } kfree(tags->rqs); blk_mq_free_tags(tags); } ",0 "SYSCALL_DEFINE5(io_getevents, aio_context_t, ctx_id, long, min_nr, long, nr, struct io_event __user *, events, struct timespec __user *, timeout) { struct kioctx *ioctx = lookup_ioctx(ctx_id); long ret = -EINVAL; if (likely(ioctx)) { if (likely(min_nr <= nr && min_nr >= 0)) ret = read_events(ioctx, min_nr, nr, events, timeout); percpu_ref_put(&ioctx->users); } return ret; } ",0 "static int setup_partitions(VP8Context *s, const uint8_t *buf, int buf_size) { const uint8_t *sizes = buf; int i; int ret; s->num_coeff_partitions = 1 << vp8_rac_get_uint(&s->c, 2); buf += 3 * (s->num_coeff_partitions - 1); buf_size -= 3 * (s->num_coeff_partitions - 1); if (buf_size < 0) return -1; for (i = 0; i < s->num_coeff_partitions - 1; i++) { int size = AV_RL24(sizes + 3 * i); if (buf_size - size < 0) return -1; ret = ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, size); if (ret < 0) return ret; buf += size; buf_size -= size; } return ff_vp56_init_range_decoder(&s->coeff_partition[i], buf, buf_size); } ",0 "size_t BackendImpl::DumpMemoryStats( base::trace_event::ProcessMemoryDump* pmd, const std::string& parent_absolute_name) const { return 0u; } ",0 " TestCase& DisableMyFilesVolume() { enable_myfiles_volume.emplace(false); return *this; } ",0 "void RenderFrameHostImpl::ResetNavigationRequests() { navigation_request_.reset(); same_document_navigation_request_.reset(); } ",0 "void ShelfWidget::set_default_last_focusable_child( bool default_last_focusable_child) { delegate_view_->set_default_last_focusable_child( default_last_focusable_child); } ",0 "void TabStrip::MaybeStartDrag( Tab* tab, const ui::LocatedEvent& event, const ui::ListSelectionModel& original_selection) { if (IsAnimating() || tab->closing() || controller_->HasAvailableDragActions() == 0) { return; } if (IsImmersiveStyle()) return; int model_index = GetModelIndexOfTab(tab); if (!IsValidModelIndex(model_index)) { CHECK(false); return; } std::vector tabs; int size_to_selected = 0; int x = tab->GetMirroredXInView(event.x()); int y = event.y(); for (int i = 0; i < tab_count(); ++i) { Tab* other_tab = tab_at(i); if (IsTabSelected(other_tab)) { tabs.push_back(other_tab); if (other_tab == tab) { size_to_selected = GetSizeNeededForTabs(tabs); x = size_to_selected - tab->width() + x; } } } DCHECK(!tabs.empty()); DCHECK(std::find(tabs.begin(), tabs.end(), tab) != tabs.end()); ui::ListSelectionModel selection_model; if (!original_selection.IsSelected(model_index)) selection_model.Copy(original_selection); drag_controller_.reset(); TabDragController::DetachBehavior detach_behavior = TabDragController::DETACHABLE; TabDragController::MoveBehavior move_behavior = TabDragController::REORDER; DCHECK(event.type() == ui::ET_MOUSE_PRESSED || event.type() == ui::ET_GESTURE_BEGIN); if (touch_layout_.get() && ((event.type() == ui::ET_MOUSE_PRESSED && (((event.flags() & ui::EF_FROM_TOUCH) && static_cast(event).IsLeftMouseButton()) || (!(event.flags() & ui::EF_FROM_TOUCH) && static_cast(event).IsControlDown()))) || (event.type() == ui::ET_GESTURE_BEGIN && !event.IsControlDown()))) { move_behavior = TabDragController::MOVE_VISIBILE_TABS; } views::Widget* widget = GetWidget(); #if defined(OS_WIN) if (win8::IsSingleWindowMetroMode()) detach_behavior = TabDragController::NOT_DETACHABLE; #endif if (event.type() == ui::ET_GESTURE_BEGIN) widget->SetCapture(this); drag_controller_.reset(new TabDragController); drag_controller_->Init( this, tab, tabs, gfx::Point(x, y), event.x(), selection_model, detach_behavior, move_behavior, EventSourceFromEvent(event)); } ",0 "static inline void gen_op_ld_v(DisasContext *s, int idx, TCGv t0, TCGv a0) { tcg_gen_qemu_ld_tl(t0, a0, s->mem_index, idx | MO_LE); } ",0 "void HTMLInputElement::SetShouldRevealPassword(bool value) { if (!!should_reveal_password_ == value) return; should_reveal_password_ = value; LazyReattachIfAttached(); } ",0 "float GetDeviceScaleFactor() { DCHECK_NE(0.0f, g_device_scale_factor); return g_device_scale_factor; } ",0 "bool debugfs_initialized(void) { return debugfs_registered; } ",0 "void ScriptController::evaluateInIsolatedWorld(unsigned worldID, const Vector& sources, Vector* results) { evaluateInIsolatedWorld(worldID, sources, 0, results); } ",0 "static inline void release_metapath(struct metapath *mp) { int i; for (i = 0; i < GFS2_MAX_META_HEIGHT; i++) { if (mp->mp_bh[i] == NULL) break; brelse(mp->mp_bh[i]); } } ",0 "void EventConverterEvdevImpl::ReleaseMouseButtons() { base::TimeDelta timestamp = ui::EventTimeForNow(); for (int code = BTN_MOUSE; code < BTN_JOYSTICK; ++code) OnButtonChange(code, false /* down */, timestamp); } ",0 "static int clean_non_persistent_class(zval *zv) /* {{{ */ { zend_class_entry *ce = Z_PTR_P(zv); return (ce->type == ZEND_INTERNAL_CLASS) ? ZEND_HASH_APPLY_STOP : ZEND_HASH_APPLY_REMOVE; } /* }}} */ ",0 "static int _nfs4_do_set_security_label(struct inode *inode, struct nfs4_label *ilabel, struct nfs_fattr *fattr, struct nfs4_label *olabel) { struct iattr sattr = {0}; struct nfs_server *server = NFS_SERVER(inode); const u32 bitmask[3] = { 0, 0, FATTR4_WORD2_SECURITY_LABEL }; struct nfs_setattrargs arg = { .fh = NFS_FH(inode), .iap = &sattr, .server = server, .bitmask = bitmask, .label = ilabel, }; struct nfs_setattrres res = { .fattr = fattr, .label = olabel, .server = server, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETATTR], .rpc_argp = &arg, .rpc_resp = &res, }; int status; nfs4_stateid_copy(&arg.stateid, &zero_stateid); status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); if (status) dprintk(""%s failed: %d\n"", __func__, status); return status; } ",0 "static void checkMutexLeave(sqlite3_mutex *p){ CheckMutex *pCheck = (CheckMutex*)p; pGlobalMutexMethods->xMutexLeave(pCheck->mutex); } ",0 "void fiin_del(GF_Box *s) { FDItemInformationBox *ptr = (FDItemInformationBox *)s; if (ptr == NULL) return; if (ptr->partition_entries) gf_isom_box_array_del(ptr->partition_entries); if (ptr->session_info) gf_isom_box_del((GF_Box*)ptr->session_info); if (ptr->group_id_to_name) gf_isom_box_del((GF_Box*)ptr->group_id_to_name); gf_free(ptr); } ",0 "cvt_8(union VALUETYPE *p, const struct magic *m) { DO_CVT(b, (uint8_t)); } ",0 "static int sctp_wait_for_sndbuf(struct sctp_association *asoc, long *timeo_p, size_t msg_len) { struct sock *sk = asoc->base.sk; int err = 0; long current_timeo = *timeo_p; DEFINE_WAIT(wait); pr_debug(""%s: asoc:%p, timeo:%ld, msg_len:%zu\n"", __func__, asoc, *timeo_p, msg_len); /* Increment the association's refcnt. */ sctp_association_hold(asoc); /* Wait on the association specific sndbuf space. */ for (;;) { prepare_to_wait_exclusive(&asoc->wait, &wait, TASK_INTERRUPTIBLE); if (!*timeo_p) goto do_nonblock; if (sk->sk_err || asoc->state >= SCTP_STATE_SHUTDOWN_PENDING || asoc->base.dead) goto do_error; if (signal_pending(current)) goto do_interrupted; if (msg_len <= sctp_wspace(asoc)) break; /* Let another process have a go. Since we are going * to sleep anyway. */ release_sock(sk); current_timeo = schedule_timeout(current_timeo); if (sk != asoc->base.sk) goto do_error; lock_sock(sk); *timeo_p = current_timeo; } out: finish_wait(&asoc->wait, &wait); /* Release the association's refcnt. */ sctp_association_put(asoc); return err; do_error: err = -EPIPE; goto out; do_interrupted: err = sock_intr_errno(*timeo_p); goto out; do_nonblock: err = -EAGAIN; goto out; } ",1 " WebContents* GetInspectedTab() { return browser()->tab_strip_model()->GetWebContentsAt(0); } ",0 "int pipe_to_file(struct pipe_inode_info *pipe, struct pipe_buffer *buf, struct splice_desc *sd) { struct file *file = sd->u.file; struct address_space *mapping = file->f_mapping; unsigned int offset, this_len; struct page *page; void *fsdata; int ret; offset = sd->pos & ~PAGE_CACHE_MASK; this_len = sd->len; if (this_len + offset > PAGE_CACHE_SIZE) this_len = PAGE_CACHE_SIZE - offset; ret = pagecache_write_begin(file, mapping, sd->pos, this_len, AOP_FLAG_UNINTERRUPTIBLE, &page, &fsdata); if (unlikely(ret)) goto out; if (buf->page != page) { char *src = kmap_atomic(buf->page); char *dst = kmap_atomic(page); memcpy(dst + offset, src + buf->offset, this_len); flush_dcache_page(page); kunmap_atomic(dst); kunmap_atomic(src); } ret = pagecache_write_end(file, mapping, sd->pos, this_len, this_len, page, fsdata); out: return ret; } ",0 "static void tx3g_dump_rgba8(FILE * trace, char *name, u32 col) { fprintf(trace, ""%s=\""%x %x %x %x\"""", name, (col>>16)&0xFF, (col>>8)&0xFF, (col)&0xFF, (col>>24)&0xFF); } ",0 "static void vmx_cancel_hv_timer(struct kvm_vcpu *vcpu) { struct vcpu_vmx *vmx = to_vmx(vcpu); vmx->hv_deadline_tsc = -1; vmcs_clear_bits(PIN_BASED_VM_EXEC_CONTROL, PIN_BASED_VMX_PREEMPTION_TIMER); } ",0 "void ThreadHeap::VisitPersistentRoots(Visitor* visitor) { DCHECK(thread_state_->InAtomicMarkingPause()); TRACE_EVENT0(""blink_gc"", ""ThreadHeap::visitPersistentRoots""); thread_state_->VisitPersistents(visitor); } ",0 "find_var_ent(uschar * name) { int first = 0; int last = var_table_size; while (last > first) { int middle = (first + last)/2; int c = Ustrcmp(name, var_table[middle].name); if (c > 0) { first = middle + 1; continue; } if (c < 0) { last = middle; continue; } return &var_table[middle]; } return NULL; } ",0 "static void octetMethodMethodCallback(const v8::FunctionCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMMethod""); TestObjectPythonV8Internal::octetMethodMethod(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "MockPrinter::~MockPrinter() { } ",0 "table_mod__(struct oftable *oftable, const struct ofputil_table_mod *tm) { if (tm->miss == OFPUTIL_TABLE_MISS_DEFAULT) { /* This is how an OFPT_TABLE_MOD decodes if it doesn't specify any * table-miss configuration (because the protocol used doesn't have * such a concept), so there's nothing to do. */ } else { atomic_store_relaxed(&oftable->miss_config, tm->miss); } unsigned int new_eviction = oftable->eviction; if (tm->eviction == OFPUTIL_TABLE_EVICTION_ON) { new_eviction |= EVICTION_OPENFLOW; } else if (tm->eviction == OFPUTIL_TABLE_EVICTION_OFF) { new_eviction &= ~EVICTION_OPENFLOW; } if (new_eviction != oftable->eviction) { ovs_mutex_lock(&ofproto_mutex); oftable_configure_eviction(oftable, new_eviction, oftable->eviction_fields, oftable->n_eviction_fields); ovs_mutex_unlock(&ofproto_mutex); } if (tm->vacancy != OFPUTIL_TABLE_VACANCY_DEFAULT) { ovs_mutex_lock(&ofproto_mutex); oftable->vacancy_down = tm->table_vacancy.vacancy_down; oftable->vacancy_up = tm->table_vacancy.vacancy_up; if (tm->vacancy == OFPUTIL_TABLE_VACANCY_OFF) { oftable->vacancy_event = 0; } else if (!oftable->vacancy_event) { uint8_t vacancy = oftable_vacancy(oftable); oftable->vacancy_event = (vacancy < oftable->vacancy_up ? OFPTR_VACANCY_UP : OFPTR_VACANCY_DOWN); } ovs_mutex_unlock(&ofproto_mutex); } } ",0 "void BlinkTestRunner::ClearGeofencingMockProvider() { content::ClearGeofencingMockProvider(); } ",0 "bool ParamTraits::Read(const Message* m, PickleIterator* iter, param_type* r) { int64 value; if (!ParamTraits::Read(m, iter, &value)) return false; *r = base::Time::FromInternalValue(value); return true; } ",0 "void AccessibilityUIElement::setSelectedTextRange(unsigned location, unsigned length) { } ",0 "void DownloadManagerImpl::InterceptNavigation( std::unique_ptr resource_request, std::vector url_chain, scoped_refptr response, mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints, net::CertStatus cert_status, int frame_tree_node_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!delegate_) return; const GURL& url = resource_request->url; const std::string& method = resource_request->method; ResourceRequestInfo::WebContentsGetter web_contents_getter = base::BindRepeating(&GetWebContents, ChildProcessHost::kInvalidUniqueID, MSG_ROUTING_NONE, frame_tree_node_id); base::OnceCallback on_download_checks_done = base::BindOnce( &DownloadManagerImpl::InterceptNavigationOnChecksComplete, weak_factory_.GetWeakPtr(), web_contents_getter, std::move(resource_request), std::move(url_chain), std::move(response), cert_status, std::move(url_loader_client_endpoints)); delegate_->CheckDownloadAllowed(web_contents_getter, url, method, std::move(on_download_checks_done)); } ",0 "Node* Range::commonAncestorContainer(Node* containerA, Node* containerB) { for (Node* parentA = containerA; parentA; parentA = parentA->parentNode()) { for (Node* parentB = containerB; parentB; parentB = parentB->parentNode()) { if (parentA == parentB) return parentA; } } return 0; } ",0 "static void hns_xgmac_get_pausefrm_cfg(void *mac_drv, u32 *rx_en, u32 *tx_en) { struct mac_driver *drv = (struct mac_driver *)mac_drv; u32 pause_ctrl; pause_ctrl = dsaf_read_dev(drv, XGMAC_MAC_PAUSE_CTRL_REG); *rx_en = dsaf_get_bit(pause_ctrl, XGMAC_PAUSE_CTL_RX_B); *tx_en = dsaf_get_bit(pause_ctrl, XGMAC_PAUSE_CTL_TX_B); } ",0 "ssize_t v9fs_get_xattr(FsContext *ctx, const char *path, const char *name, void *value, size_t size) { XattrOperations *xops = get_xattr_operations(ctx->xops, name); if (xops) { return xops->getxattr(ctx, path, name, value, size); } errno = EOPNOTSUPP; return -1; } ",0 "void sock_release(struct socket *sock) { if (sock->ops) { struct module *owner = sock->ops->owner; sock->ops->release(sock); sock->ops = NULL; module_put(owner); } if (rcu_dereference_protected(sock->wq, 1)->fasync_list) printk(KERN_ERR ""sock_release: fasync list not empty!\n""); percpu_sub(sockets_in_use, 1); if (!sock->file) { iput(SOCK_INODE(sock)); return; } sock->file = NULL; } ",0 "ContentClient* RenderViewTest::CreateContentClient() { return new TestContentClient; } ",0 "VerifyTcpChecksum( tCompletePhysicalAddress *pDataPages, ULONG ulDataLength, ULONG ulStartOffset, tTcpIpPacketParsingResult known, ULONG whatToFix) { USHORT phcs; tTcpIpPacketParsingResult res = known; IPHeader *pIpHeader = (IPHeader *)RtlOffsetToPointer(pDataPages[0].Virtual, ulStartOffset); TCPHeader *pTcpHeader = (TCPHeader *)RtlOffsetToPointer(pIpHeader, res.ipHeaderSize); USHORT saved = pTcpHeader->tcp_xsum; USHORT xxpHeaderAndPayloadLen = GetXxpHeaderAndPayloadLen(pIpHeader, res); if (ulDataLength >= res.ipHeaderSize) { phcs = CalculateIpPseudoHeaderChecksum(pIpHeader, res, xxpHeaderAndPayloadLen); res.xxpCheckSum = CompareNetCheckSumOnEndSystem(phcs, saved) ? ppresPCSOK : ppresCSBad; if (res.xxpCheckSum != ppresPCSOK || whatToFix) { if (whatToFix & pcrFixPHChecksum) { if (ulDataLength >= (ULONG)(res.ipHeaderSize + sizeof(*pTcpHeader))) { pTcpHeader->tcp_xsum = phcs; res.fixedXxpCS = res.xxpCheckSum != ppresPCSOK; } else res.xxpStatus = ppresXxpIncomplete; } else if (res.xxpFull) { pTcpHeader->tcp_xsum = phcs; CalculateTcpChecksumGivenPseudoCS(pTcpHeader, pDataPages, ulStartOffset + res.ipHeaderSize, xxpHeaderAndPayloadLen); if (CompareNetCheckSumOnEndSystem(pTcpHeader->tcp_xsum, saved)) res.xxpCheckSum = ppresCSOK; if (!(whatToFix & pcrFixXxpChecksum)) pTcpHeader->tcp_xsum = saved; else res.fixedXxpCS = res.xxpCheckSum == ppresCSBad || res.xxpCheckSum == ppresPCSOK; } else if (whatToFix) { res.xxpStatus = ppresXxpIncomplete; } } else if (res.xxpFull) { CalculateTcpChecksumGivenPseudoCS(pTcpHeader, pDataPages, ulStartOffset + res.ipHeaderSize, xxpHeaderAndPayloadLen); if (CompareNetCheckSumOnEndSystem(pTcpHeader->tcp_xsum, saved)) res.xxpCheckSum = ppresCSOK; pTcpHeader->tcp_xsum = saved; } } else res.ipCheckSum = ppresIPTooShort; return res; } ",0 "archive_read_format_lha_read_header(struct archive_read *a, struct archive_entry *entry) { struct archive_string linkname; struct archive_string pathname; struct lha *lha; const unsigned char *p; const char *signature; int err; lha_crc16_init(); a->archive.archive_format = ARCHIVE_FORMAT_LHA; if (a->archive.archive_format_name == NULL) a->archive.archive_format_name = ""lha""; lha = (struct lha *)(a->format->data); lha->decompress_init = 0; lha->end_of_entry = 0; lha->end_of_entry_cleanup = 0; lha->entry_unconsumed = 0; if ((p = __archive_read_ahead(a, H_SIZE, NULL)) == NULL) { /* * LHa archiver added 0 to the tail of its archive file as * the mark of the end of the archive. */ signature = __archive_read_ahead(a, sizeof(signature[0]), NULL); if (signature == NULL || signature[0] == 0) return (ARCHIVE_EOF); return (truncated_error(a)); } signature = (const char *)p; if (lha->found_first_header == 0 && signature[0] == 'M' && signature[1] == 'Z') { /* This is an executable? Must be self-extracting... */ err = lha_skip_sfx(a); if (err < ARCHIVE_WARN) return (err); if ((p = __archive_read_ahead(a, sizeof(*p), NULL)) == NULL) return (truncated_error(a)); signature = (const char *)p; } /* signature[0] == 0 means the end of an LHa archive file. */ if (signature[0] == 0) return (ARCHIVE_EOF); /* * Check the header format and method type. */ if (lha_check_header_format(p) != 0) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Bad LHa file""); return (ARCHIVE_FATAL); } /* We've found the first header. */ lha->found_first_header = 1; /* Set a default value and common data */ lha->header_size = 0; lha->level = p[H_LEVEL_OFFSET]; lha->method[0] = p[H_METHOD_OFFSET+1]; lha->method[1] = p[H_METHOD_OFFSET+2]; lha->method[2] = p[H_METHOD_OFFSET+3]; if (memcmp(lha->method, ""lhd"", 3) == 0) lha->directory = 1; else lha->directory = 0; if (memcmp(lha->method, ""lh0"", 3) == 0 || memcmp(lha->method, ""lz4"", 3) == 0) lha->entry_is_compressed = 0; else lha->entry_is_compressed = 1; lha->compsize = 0; lha->origsize = 0; lha->setflag = 0; lha->birthtime = 0; lha->birthtime_tv_nsec = 0; lha->mtime = 0; lha->mtime_tv_nsec = 0; lha->atime = 0; lha->atime_tv_nsec = 0; lha->mode = (lha->directory)? 0777 : 0666; lha->uid = 0; lha->gid = 0; archive_string_empty(&lha->dirname); archive_string_empty(&lha->filename); lha->dos_attr = 0; if (lha->opt_sconv != NULL) lha->sconv = lha->opt_sconv; else lha->sconv = NULL; switch (p[H_LEVEL_OFFSET]) { case 0: err = lha_read_file_header_0(a, lha); break; case 1: err = lha_read_file_header_1(a, lha); break; case 2: err = lha_read_file_header_2(a, lha); break; case 3: err = lha_read_file_header_3(a, lha); break; default: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Unsupported LHa header level %d"", p[H_LEVEL_OFFSET]); err = ARCHIVE_FATAL; break; } if (err < ARCHIVE_WARN) return (err); if (!lha->directory && archive_strlen(&lha->filename) == 0) /* The filename has not been set */ return (truncated_error(a)); /* * Make a pathname from a dirname and a filename. */ archive_string_concat(&lha->dirname, &lha->filename); archive_string_init(&pathname); archive_string_init(&linkname); archive_string_copy(&pathname, &lha->dirname); if ((lha->mode & AE_IFMT) == AE_IFLNK) { /* * Extract the symlink-name if it's included in the pathname. */ if (!lha_parse_linkname(&linkname, &pathname)) { /* We couldn't get the symlink-name. */ archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Unknown symlink-name""); archive_string_free(&pathname); archive_string_free(&linkname); return (ARCHIVE_FAILED); } } else { /* * Make sure a file-type is set. * The mode has been overridden if it is in the extended data. */ lha->mode = (lha->mode & ~AE_IFMT) | ((lha->directory)? AE_IFDIR: AE_IFREG); } if ((lha->setflag & UNIX_MODE_IS_SET) == 0 && (lha->dos_attr & 1) != 0) lha->mode &= ~(0222);/* read only. */ /* * Set basic file parameters. */ if (archive_entry_copy_pathname_l(entry, pathname.s, pathname.length, lha->sconv) != 0) { if (errno == ENOMEM) { archive_set_error(&a->archive, ENOMEM, ""Can't allocate memory for Pathname""); return (ARCHIVE_FATAL); } archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Pathname cannot be converted "" ""from %s to current locale."", archive_string_conversion_charset_name(lha->sconv)); err = ARCHIVE_WARN; } archive_string_free(&pathname); if (archive_strlen(&linkname) > 0) { if (archive_entry_copy_symlink_l(entry, linkname.s, linkname.length, lha->sconv) != 0) { if (errno == ENOMEM) { archive_set_error(&a->archive, ENOMEM, ""Can't allocate memory for Linkname""); return (ARCHIVE_FATAL); } archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Linkname cannot be converted "" ""from %s to current locale."", archive_string_conversion_charset_name(lha->sconv)); err = ARCHIVE_WARN; } } else archive_entry_set_symlink(entry, NULL); archive_string_free(&linkname); /* * When a header level is 0, there is a possibility that * a pathname and a symlink has '\' character, a directory * separator in DOS/Windows. So we should convert it to '/'. */ if (p[H_LEVEL_OFFSET] == 0) lha_replace_path_separator(lha, entry); archive_entry_set_mode(entry, lha->mode); archive_entry_set_uid(entry, lha->uid); archive_entry_set_gid(entry, lha->gid); if (archive_strlen(&lha->uname) > 0) archive_entry_set_uname(entry, lha->uname.s); if (archive_strlen(&lha->gname) > 0) archive_entry_set_gname(entry, lha->gname.s); if (lha->setflag & BIRTHTIME_IS_SET) { archive_entry_set_birthtime(entry, lha->birthtime, lha->birthtime_tv_nsec); archive_entry_set_ctime(entry, lha->birthtime, lha->birthtime_tv_nsec); } else { archive_entry_unset_birthtime(entry); archive_entry_unset_ctime(entry); } archive_entry_set_mtime(entry, lha->mtime, lha->mtime_tv_nsec); if (lha->setflag & ATIME_IS_SET) archive_entry_set_atime(entry, lha->atime, lha->atime_tv_nsec); else archive_entry_unset_atime(entry); if (lha->directory || archive_entry_symlink(entry) != NULL) archive_entry_unset_size(entry); else archive_entry_set_size(entry, lha->origsize); /* * Prepare variables used to read a file content. */ lha->entry_bytes_remaining = lha->compsize; lha->entry_offset = 0; lha->entry_crc_calculated = 0; /* * This file does not have a content. */ if (lha->directory || lha->compsize == 0) lha->end_of_entry = 1; sprintf(lha->format_name, ""lha -%c%c%c-"", lha->method[0], lha->method[1], lha->method[2]); a->archive.archive_format_name = lha->format_name; return (err); } ",0 "int CloseDatabase( SQLHENV hEnv, SQLHDBC hDbc ) { SQLDisconnect( hDbc ); SQLFreeConnect( hDbc ); SQLFreeEnv( hEnv ); return 1; } ",0 " bool focused() const { return focused_; } ",0 "void read_fragment_4(unsigned int fragment, long long *start_block, int *size) { TRACE(""read_fragment: reading fragment %d\n"", fragment); struct squashfs_fragment_entry *fragment_entry; fragment_entry = &fragment_table[fragment]; *start_block = fragment_entry->start_block; *size = fragment_entry->size; } ",0 "SortDirection AXTableCell::getSortDirection() const { if (roleValue() != RowHeaderRole && roleValue() != ColumnHeaderRole) return SortDirectionUndefined; const AtomicString& ariaSort = getAOMPropertyOrARIAAttribute(AOMStringProperty::kSort); if (ariaSort.isEmpty()) return SortDirectionUndefined; if (equalIgnoringCase(ariaSort, ""none"")) return SortDirectionNone; if (equalIgnoringCase(ariaSort, ""ascending"")) return SortDirectionAscending; if (equalIgnoringCase(ariaSort, ""descending"")) return SortDirectionDescending; if (equalIgnoringCase(ariaSort, ""other"")) return SortDirectionOther; return SortDirectionUndefined; } ",1 "static struct ucma_context *ucma_get_ctx_dev(struct ucma_file *file, int id) { struct ucma_context *ctx = ucma_get_ctx(file, id); if (IS_ERR(ctx)) return ctx; if (!ctx->cm_id->device) { ucma_put_ctx(ctx); return ERR_PTR(-EINVAL); } return ctx; } ",0 "bool ACodec::describeDefaultColorFormat(DescribeColorFormatParams ¶ms) { MediaImage &image = params.sMediaImage; memset(&image, 0, sizeof(image)); image.mType = MediaImage::MEDIA_IMAGE_TYPE_UNKNOWN; image.mNumPlanes = 0; const OMX_COLOR_FORMATTYPE fmt = params.eColorFormat; image.mWidth = params.nFrameWidth; image.mHeight = params.nFrameHeight; if (fmt != OMX_COLOR_FormatYUV420Planar && fmt != OMX_COLOR_FormatYUV420PackedPlanar && fmt != OMX_COLOR_FormatYUV420SemiPlanar && fmt != OMX_COLOR_FormatYUV420PackedSemiPlanar && fmt != HAL_PIXEL_FORMAT_YV12) { ALOGW(""do not know color format 0x%x = %d"", fmt, fmt); return false; } if (params.nStride != 0 && params.nSliceHeight == 0) { ALOGW(""using sliceHeight=%u instead of what codec advertised (=0)"", params.nFrameHeight); params.nSliceHeight = params.nFrameHeight; } if (params.nStride == 0 || params.nSliceHeight == 0) { ALOGW(""cannot describe color format 0x%x = %d with stride=%u and sliceHeight=%u"", fmt, fmt, params.nStride, params.nSliceHeight); return false; } image.mType = MediaImage::MEDIA_IMAGE_TYPE_YUV; image.mNumPlanes = 3; image.mBitDepth = 8; image.mPlane[image.Y].mOffset = 0; image.mPlane[image.Y].mColInc = 1; image.mPlane[image.Y].mRowInc = params.nStride; image.mPlane[image.Y].mHorizSubsampling = 1; image.mPlane[image.Y].mVertSubsampling = 1; switch ((int)fmt) { case HAL_PIXEL_FORMAT_YV12: if (params.bUsingNativeBuffers) { size_t ystride = align(params.nStride, 16); size_t cstride = align(params.nStride / 2, 16); image.mPlane[image.Y].mRowInc = ystride; image.mPlane[image.V].mOffset = ystride * params.nSliceHeight; image.mPlane[image.V].mColInc = 1; image.mPlane[image.V].mRowInc = cstride; image.mPlane[image.V].mHorizSubsampling = 2; image.mPlane[image.V].mVertSubsampling = 2; image.mPlane[image.U].mOffset = image.mPlane[image.V].mOffset + (cstride * params.nSliceHeight / 2); image.mPlane[image.U].mColInc = 1; image.mPlane[image.U].mRowInc = cstride; image.mPlane[image.U].mHorizSubsampling = 2; image.mPlane[image.U].mVertSubsampling = 2; break; } else { } case OMX_COLOR_FormatYUV420Planar: case OMX_COLOR_FormatYUV420PackedPlanar: image.mPlane[image.U].mOffset = params.nStride * params.nSliceHeight; image.mPlane[image.U].mColInc = 1; image.mPlane[image.U].mRowInc = params.nStride / 2; image.mPlane[image.U].mHorizSubsampling = 2; image.mPlane[image.U].mVertSubsampling = 2; image.mPlane[image.V].mOffset = image.mPlane[image.U].mOffset + (params.nStride * params.nSliceHeight / 4); image.mPlane[image.V].mColInc = 1; image.mPlane[image.V].mRowInc = params.nStride / 2; image.mPlane[image.V].mHorizSubsampling = 2; image.mPlane[image.V].mVertSubsampling = 2; break; case OMX_COLOR_FormatYUV420SemiPlanar: case OMX_COLOR_FormatYUV420PackedSemiPlanar: image.mPlane[image.U].mOffset = params.nStride * params.nSliceHeight; image.mPlane[image.U].mColInc = 2; image.mPlane[image.U].mRowInc = params.nStride; image.mPlane[image.U].mHorizSubsampling = 2; image.mPlane[image.U].mVertSubsampling = 2; image.mPlane[image.V].mOffset = image.mPlane[image.U].mOffset + 1; image.mPlane[image.V].mColInc = 2; image.mPlane[image.V].mRowInc = params.nStride; image.mPlane[image.V].mHorizSubsampling = 2; image.mPlane[image.V].mVertSubsampling = 2; break; default: TRESPASS(); } return true; } ",0 "void HTMLElement::accessKeyAction(bool sendMouseEvents) { dispatchSimulatedClick(0, sendMouseEvents); } ",0 "ModuleExport size_t RegisterPSImage(void) { MagickInfo *entry; entry=SetMagickInfo(""EPI""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->seekable_stream=MagickTrue; entry->adjoin=MagickFalse; entry->blob_support=MagickFalse; entry->seekable_stream=MagickTrue; entry->description=ConstantString( ""Encapsulated PostScript Interchange format""); entry->mime_type=ConstantString(""application/postscript""); entry->module=ConstantString(""PS""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""EPS""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->seekable_stream=MagickTrue; entry->magick=(IsImageFormatHandler *) IsPS; entry->adjoin=MagickFalse; entry->blob_support=MagickFalse; entry->seekable_stream=MagickTrue; entry->description=ConstantString(""Encapsulated PostScript""); entry->mime_type=ConstantString(""application/postscript""); entry->module=ConstantString(""PS""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""EPSF""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->seekable_stream=MagickTrue; entry->magick=(IsImageFormatHandler *) IsPS; entry->adjoin=MagickFalse; entry->blob_support=MagickFalse; entry->seekable_stream=MagickTrue; entry->description=ConstantString(""Encapsulated PostScript""); entry->mime_type=ConstantString(""application/postscript""); entry->module=ConstantString(""PS""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""EPSI""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->seekable_stream=MagickTrue; entry->magick=(IsImageFormatHandler *) IsPS; entry->adjoin=MagickFalse; entry->blob_support=MagickFalse; entry->seekable_stream=MagickTrue; entry->description=ConstantString( ""Encapsulated PostScript Interchange format""); entry->mime_type=ConstantString(""application/postscript""); entry->module=ConstantString(""PS""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""PS""); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->seekable_stream=MagickTrue; entry->magick=(IsImageFormatHandler *) IsPS; entry->mime_type=ConstantString(""application/postscript""); entry->module=ConstantString(""PS""); entry->blob_support=MagickFalse; entry->seekable_stream=MagickTrue; entry->description=ConstantString(""PostScript""); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "void *Type_NamedColor_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) { cmsUInt32Number vendorFlag; // Bottom 16 bits for ICC use cmsUInt32Number count; // Count of named colors cmsUInt32Number nDeviceCoords; // Num of device coordinates char prefix[32]; // Prefix for each color name char suffix[32]; // Suffix for each color name cmsNAMEDCOLORLIST* v; cmsUInt32Number i; *nItems = 0; if (!_cmsReadUInt32Number(io, &vendorFlag)) return NULL; if (!_cmsReadUInt32Number(io, &count)) return NULL; if (!_cmsReadUInt32Number(io, &nDeviceCoords)) return NULL; if (io -> Read(io, prefix, 32, 1) != 1) return NULL; if (io -> Read(io, suffix, 32, 1) != 1) return NULL; prefix[31] = suffix[31] = 0; v = cmsAllocNamedColorList(self ->ContextID, count, nDeviceCoords, prefix, suffix); if (v == NULL) { cmsSignalError(self->ContextID, cmsERROR_RANGE, ""Too many named colors '%d'"", count); return NULL; } if (nDeviceCoords > cmsMAXCHANNELS) { cmsSignalError(self->ContextID, cmsERROR_RANGE, ""Too many device coordinates '%d'"", nDeviceCoords); return 0; } for (i=0; i < count; i++) { cmsUInt16Number PCS[3]; cmsUInt16Number Colorant[cmsMAXCHANNELS]; char Root[33]; memset(Colorant, 0, sizeof(Colorant)); if (io -> Read(io, Root, 32, 1) != 1) return NULL; Root[32] = 0; // To prevent exploits if (!_cmsReadUInt16Array(io, 3, PCS)) goto Error; if (!_cmsReadUInt16Array(io, nDeviceCoords, Colorant)) goto Error; if (!cmsAppendNamedColor(v, Root, PCS, Colorant)) goto Error; } *nItems = 1; return (void*) v ; Error: cmsFreeNamedColorList(v); return NULL; cmsUNUSED_PARAMETER(SizeOfTag); } ",0 "void AutocompleteController::CheckIfDone() { for (ACProviders::const_iterator i(providers_.begin()); i != providers_.end(); ++i) { if (!(*i)->done()) { done_ = false; return; } } done_ = true; } ",0 "void AudioInputRendererHost::OnData(media::AudioInputController* controller, const uint8* data, uint32 size) { NOTREACHED() << ""Only low-latency mode is supported.""; } ",0 "int main (int UNUSED argc, char UNUSED *argv[]) { int opt; char cmd[128]; int args_processed = 0; int pid = -1; config_permissions(); bdt_log(""\n:::::::::::::::::::::::::::::::::::::::::::::::::::""); bdt_log("":: Bluedroid test app starting""); if ( HAL_load() < 0 ) { perror(""HAL failed to initialize, exit\n""); unlink(PID_FILE); exit(0); } setup_test_env(); /* Automatically perform the init */ bdt_init(); while(!main_done) { char line[128]; /* command prompt */ printf( "">"" ); fflush(stdout); fgets (line, 128, stdin); if (line[0]!= '\0') { /* remove linefeed */ line[strlen(line)-1] = 0; process_cmd(line, 0); memset(line, '\0', 128); } } /* FIXME: Commenting this out as for some reason, the application does not exit otherwise*/ HAL_unload(); bdt_log("":: Bluedroid test app terminating""); return 0; } ",0 "ImageBitmap::~ImageBitmap() {} ",0 "xmlCleanSpecialAttrCallback(void *payload, void *data, const xmlChar *fullname, const xmlChar *fullattr, const xmlChar *unused ATTRIBUTE_UNUSED) { xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) data; if (((long) payload) == XML_ATTRIBUTE_CDATA) { xmlHashRemoveEntry2(ctxt->attsSpecial, fullname, fullattr, NULL); } } ",0 "const AutocompleteResult& AutocompleteEditModel::result() const { return autocomplete_controller_->result(); } ",0 "static int do_fault(struct mm_struct *mm, struct vm_area_struct *vma, unsigned long address, pte_t *page_table, pmd_t *pmd, unsigned int flags, pte_t orig_pte) { pgoff_t pgoff = (((address & PAGE_MASK) - vma->vm_start) >> PAGE_SHIFT) + vma->vm_pgoff; pte_unmap(page_table); if (!(flags & FAULT_FLAG_WRITE)) return do_read_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); if (!(vma->vm_flags & VM_SHARED)) return do_cow_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); return do_shared_fault(mm, vma, address, pmd, pgoff, flags, orig_pte); } ",1 "static inline void atalk_remove_socket(struct sock *sk) { write_lock_bh(&atalk_sockets_lock); sk_del_node_init(sk); write_unlock_bh(&atalk_sockets_lock); } ",0 "bool RenderWidgetHostImpl::Send(IPC::Message* msg) { return process_->Send(msg); } ",0 "static void replaceCharsetInMediaType(String& mediaType, const String& charsetValue) { unsigned int pos = 0, len = 0; findCharsetInMediaType(mediaType, pos, len); if (!len) { return; } while (len) { mediaType.replace(pos, len, charsetValue); unsigned int start = pos + charsetValue.length(); findCharsetInMediaType(mediaType, pos, len, start); } } ",0 "static void ReadBlobDoublesMSB(Image * image, size_t len, double *data) { while (len >= 8) { *data++ = ReadBlobDouble(image); len -= sizeof(double); } if (len > 0) (void) SeekBlob(image, len, SEEK_CUR); } ",0 "void gdImageFilledPolygon (gdImagePtr im, gdPointPtr p, int n, int c) { int i; int y; int miny, maxy, pmaxy; int x1, y1; int x2, y2; int ind1, ind2; int ints; int fill_color; if (n <= 0) { return; } if (overflow2(sizeof(int), n)) { return; } if (c == gdAntiAliased) { fill_color = im->AA_color; } else { fill_color = c; } if (!im->polyAllocated) { im->polyInts = (int *) gdMalloc(sizeof(int) * n); im->polyAllocated = n; } if (im->polyAllocated < n) { while (im->polyAllocated < n) { im->polyAllocated *= 2; } if (overflow2(sizeof(int), im->polyAllocated)) { return; } im->polyInts = (int *) gdRealloc(im->polyInts, sizeof(int) * im->polyAllocated); } miny = p[0].y; maxy = p[0].y; for (i = 1; i < n; i++) { if (p[i].y < miny) { miny = p[i].y; } if (p[i].y > maxy) { maxy = p[i].y; } } /* necessary special case: horizontal line */ if (n > 1 && miny == maxy) { x1 = x2 = p[0].x; for (i = 1; (i < n); i++) { if (p[i].x < x1) { x1 = p[i].x; } else if (p[i].x > x2) { x2 = p[i].x; } } gdImageLine(im, x1, miny, x2, miny, c); return; } pmaxy = maxy; /* 2.0.16: Optimization by Ilia Chipitsine -- don't waste time offscreen */ if (miny < 0) { miny = 0; } if (maxy >= gdImageSY(im)) { maxy = gdImageSY(im) - 1; } /* Fix in 1.3: count a vertex only once */ for (y = miny; y <= maxy; y++) { /*1.4 int interLast = 0; */ /* int dirLast = 0; */ /* int interFirst = 1; */ ints = 0; for (i = 0; i < n; i++) { if (!i) { ind1 = n - 1; ind2 = 0; } else { ind1 = i - 1; ind2 = i; } y1 = p[ind1].y; y2 = p[ind2].y; if (y1 < y2) { x1 = p[ind1].x; x2 = p[ind2].x; } else if (y1 > y2) { y2 = p[ind1].y; y1 = p[ind2].y; x2 = p[ind1].x; x1 = p[ind2].x; } else { continue; } /* Do the following math as float intermediately, and round to ensure * that Polygon and FilledPolygon for the same set of points have the * same footprint. */ if (y >= y1 && y < y2) { im->polyInts[ints++] = (float) ((y - y1) * (x2 - x1)) / (float) (y2 - y1) + 0.5 + x1; } else if (y == pmaxy && y == y2) { im->polyInts[ints++] = x2; } } qsort(im->polyInts, ints, sizeof(int), gdCompareInt); for (i = 0; i < ints - 1; i += 2) { gdImageLine(im, im->polyInts[i], y, im->polyInts[i + 1], y, fill_color); } } /* If we are drawing this AA, then redraw the border with AA lines. */ if (c == gdAntiAliased) { gdImagePolygon(im, p, n, c); } } ",0 "test_gc_gray_mark(void) { mrb_state *mrb = mrb_open(); mrb_value obj_v, value_v; struct RBasic *obj; size_t gray_num = 0; mrb_gc *gc = &mrb->gc; puts(""test_gc_gray_mark""); puts("" in MRB_TT_CLASS""); obj = (struct RBasic*)mrb->object_class; paint_gray(obj); gray_num = gc_gray_mark(mrb, gc, obj); mrb_assert(is_black(obj)); mrb_assert(gray_num > 1); puts("" in MRB_TT_ARRAY""); obj_v = mrb_ary_new(mrb); value_v = mrb_str_new_lit(mrb, ""test""); paint_gray(mrb_basic_ptr(obj_v)); paint_partial_white(gc, mrb_basic_ptr(value_v)); mrb_ary_push(mrb, obj_v, value_v); gray_num = gc_gray_mark(mrb, gc, mrb_basic_ptr(obj_v)); mrb_assert(is_black(mrb_basic_ptr(obj_v))); mrb_assert(is_gray(mrb_basic_ptr(value_v))); mrb_assert(gray_num == 1); mrb_close(mrb); } ",0 "const std::string& SyncerProtoUtil::NameFromCommitEntryResponse( const CommitResponse_EntryResponse& entry) { if (entry.has_non_unique_name()) return entry.non_unique_name(); return entry.name(); } ",0 "static int mov_read_dvc1(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; uint8_t profile_level; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; if (atom.size >= (1<<28) || atom.size < 7) return AVERROR_INVALIDDATA; profile_level = avio_r8(pb); if (profile_level & 0xf0 != 0xc0) return 0; av_free(st->codec->extradata); st->codec->extradata_size = 0; st->codec->extradata = av_mallocz(atom.size - 7 + FF_INPUT_BUFFER_PADDING_SIZE); if (!st->codec->extradata) return AVERROR(ENOMEM); st->codec->extradata_size = atom.size - 7; avio_seek(pb, 6, SEEK_CUR); avio_read(pb, st->codec->extradata, st->codec->extradata_size); return 0; } ",0 "void ChromeContentBrowserClient::CreateMediaRemoter( content::RenderFrameHost* render_frame_host, media::mojom::RemotingSourcePtr source, media::mojom::RemoterRequest request) { CastRemotingConnector::CreateMediaRemoter( render_frame_host, std::move(source), std::move(request)); } ",0 "static int jpc_dec_process_crg(jpc_dec_t *dec, jpc_ms_t *ms) { int cmptno; jpc_dec_cmpt_t *cmpt; jpc_crg_t *crg; crg = &ms->parms.crg; for (cmptno = 0, cmpt = dec->cmpts; cmptno < dec->numcomps; ++cmptno, ++cmpt) { /* Ignore the information in the CRG marker segment for now. This information serves no useful purpose for decoding anyhow. Some other parts of the code need to be changed if these lines are uncommented. cmpt->hsubstep = crg->comps[cmptno].hoff; cmpt->vsubstep = crg->comps[cmptno].voff; */ } return 0; } ",0 "int usbnet_change_mtu (struct net_device *net, int new_mtu) { struct usbnet *dev = netdev_priv(net); int ll_mtu = new_mtu + net->hard_header_len; int old_hard_mtu = dev->hard_mtu; int old_rx_urb_size = dev->rx_urb_size; if (new_mtu <= 0) return -EINVAL; if ((ll_mtu % dev->maxpacket) == 0) return -EDOM; net->mtu = new_mtu; dev->hard_mtu = net->mtu + net->hard_header_len; if (dev->rx_urb_size == old_hard_mtu) { dev->rx_urb_size = dev->hard_mtu; if (dev->rx_urb_size > old_rx_urb_size) usbnet_unlink_rx_urbs(dev); } /* max qlen depend on hard_mtu and rx_urb_size */ usbnet_update_max_qlen(dev); return 0; } ",0 "static inline ssize_t RandomX(RandomInfo *random_info,const size_t columns) { return((ssize_t) (columns*GetPseudoRandomValue(random_info))); } ",0 "static int ehci_process_itd(EHCIState *ehci, EHCIitd *itd, uint32_t addr) { USBDevice *dev; USBEndpoint *ep; uint32_t i, len, pid, dir, devaddr, endp; uint32_t pg, off, ptr1, ptr2, max, mult; ehci->periodic_sched_active = PERIODIC_ACTIVE; dir =(itd->bufptr[1] & ITD_BUFPTR_DIRECTION); devaddr = get_field(itd->bufptr[0], ITD_BUFPTR_DEVADDR); endp = get_field(itd->bufptr[0], ITD_BUFPTR_EP); max = get_field(itd->bufptr[1], ITD_BUFPTR_MAXPKT); mult = get_field(itd->bufptr[2], ITD_BUFPTR_MULT); for(i = 0; i < 8; i++) { if (itd->transact[i] & ITD_XACT_ACTIVE) { pg = get_field(itd->transact[i], ITD_XACT_PGSEL); off = itd->transact[i] & ITD_XACT_OFFSET_MASK; len = get_field(itd->transact[i], ITD_XACT_LENGTH); if (len > max * mult) { len = max * mult; } if (len > BUFF_SIZE || pg > 6) { return -1; } ptr1 = (itd->bufptr[pg] & ITD_BUFPTR_MASK); qemu_sglist_init(&ehci->isgl, ehci->device, 2, ehci->as); if (off + len > 4096) { /* transfer crosses page border */ if (pg == 6) { qemu_sglist_destroy(&ehci->isgl); return -1; /* avoid page pg + 1 */ } ptr2 = (itd->bufptr[pg + 1] & ITD_BUFPTR_MASK); uint32_t len2 = off + len - 4096; uint32_t len1 = len - len2; qemu_sglist_add(&ehci->isgl, ptr1 + off, len1); qemu_sglist_add(&ehci->isgl, ptr2, len2); } else { qemu_sglist_add(&ehci->isgl, ptr1 + off, len); } pid = dir ? USB_TOKEN_IN : USB_TOKEN_OUT; dev = ehci_find_device(ehci, devaddr); ep = usb_ep_get(dev, pid, endp); if (ep && ep->type == USB_ENDPOINT_XFER_ISOC) { usb_packet_setup(&ehci->ipacket, pid, ep, 0, addr, false, (itd->transact[i] & ITD_XACT_IOC) != 0); usb_packet_map(&ehci->ipacket, &ehci->isgl); usb_handle_packet(dev, &ehci->ipacket); usb_packet_unmap(&ehci->ipacket, &ehci->isgl); } else { DPRINTF(""ISOCH: attempt to addess non-iso endpoint\n""); ehci->ipacket.status = USB_RET_NAK; ehci->ipacket.actual_length = 0; } qemu_sglist_destroy(&ehci->isgl); switch (ehci->ipacket.status) { case USB_RET_SUCCESS: break; default: fprintf(stderr, ""Unexpected iso usb result: %d\n"", ehci->ipacket.status); /* Fall through */ case USB_RET_IOERROR: case USB_RET_NODEV: /* 3.3.2: XACTERR is only allowed on IN transactions */ if (dir) { itd->transact[i] |= ITD_XACT_XACTERR; ehci_raise_irq(ehci, USBSTS_ERRINT); } break; case USB_RET_BABBLE: itd->transact[i] |= ITD_XACT_BABBLE; ehci_raise_irq(ehci, USBSTS_ERRINT); break; case USB_RET_NAK: /* no data for us, so do a zero-length transfer */ ehci->ipacket.actual_length = 0; break; } if (!dir) { set_field(&itd->transact[i], len - ehci->ipacket.actual_length, ITD_XACT_LENGTH); /* OUT */ } else { set_field(&itd->transact[i], ehci->ipacket.actual_length, ITD_XACT_LENGTH); /* IN */ } if (itd->transact[i] & ITD_XACT_IOC) { ehci_raise_irq(ehci, USBSTS_INT); } itd->transact[i] &= ~ITD_XACT_ACTIVE; } } return 0; } ",0 " static void Ins_GETINFO( INS_ARG ) { Long K; K = 0; /* We return then Windows 3.1 version number */ /* for the font scaler */ if ( (args[0] & 1) != 0 ) K = 3; /* Has the glyph been rotated ? */ if ( CUR.metrics.rotated ) K |= 0x80; /* Has the glyph been stretched ? */ if ( CUR.metrics.stretched ) K |= 0x100; args[0] = K; } ",0 "void AwContents::EnableOnNewPicture(JNIEnv* env, jobject obj, jboolean enabled) { DCHECK_CURRENTLY_ON(BrowserThread::UI); browser_view_renderer_.EnableOnNewPicture(enabled); } ",0 "bool hasErrorInfo(ExecState* exec, JSObject* error) { return error->hasProperty(exec, Identifier(exec, linePropertyName)) || error->hasProperty(exec, Identifier(exec, sourceURLPropertyName)); } ",0 "static void __exit ipx_proto_finito(void) { ipx_proc_exit(); ipx_unregister_sysctl(); unregister_netdevice_notifier(&ipx_dev_notifier); ipxitf_cleanup(); if (pSNAP_datalink) { unregister_snap_client(pSNAP_datalink); pSNAP_datalink = NULL; } if (p8022_datalink) { unregister_8022_client(p8022_datalink); p8022_datalink = NULL; } dev_remove_pack(&ipx_8023_packet_type); if (p8023_datalink) { destroy_8023_client(p8023_datalink); p8023_datalink = NULL; } dev_remove_pack(&ipx_dix_packet_type); if (pEII_datalink) { destroy_EII_client(pEII_datalink); pEII_datalink = NULL; } proto_unregister(&ipx_proto); sock_unregister(ipx_family_ops.family); } ",0 "static int nfs4_do_create(struct inode *dir, struct dentry *dentry, struct nfs4_createdata *data) { int status = nfs4_call_sync(NFS_SERVER(dir)->client, NFS_SERVER(dir), &data->msg, &data->arg.seq_args, &data->res.seq_res, 1); if (status == 0) { update_changeattr(dir, &data->res.dir_cinfo); nfs_post_op_update_inode(dir, data->res.dir_fattr); status = nfs_instantiate(dentry, data->res.fh, data->res.fattr); } return status; } ",0 "void BackgroundLoaderOfflinerTest::OnCancel(const SavePageRequest& request) { DCHECK(!cancel_callback_called_); cancel_callback_called_ = true; } ",0 "JsVar *jspEvaluate(const char *str, bool stringIsStatic) { /* using a memory area is more efficient, but the interpreter * may use substrings from it for function code. This means that * if the string goes away, everything gets corrupted - hence * the option here. */ JsVar *evCode; if (stringIsStatic) evCode = jsvNewNativeString((char*)str, strlen(str)); else evCode = jsvNewFromString(str); if (!evCode) return 0; JsVar *v = 0; if (!jsvIsMemoryFull()) v = jspEvaluateVar(evCode, 0, 0); jsvUnLock(evCode); return v; } ",0 "static int ecb_decrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct crypto_sparc64_aes_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); struct blkcipher_walk walk; u64 *key_end; int err; blkcipher_walk_init(&walk, dst, src, nbytes); err = blkcipher_walk_virt(desc, &walk); desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; ctx->ops->load_decrypt_keys(&ctx->key[0]); key_end = &ctx->key[ctx->expanded_key_length / sizeof(u64)]; while ((nbytes = walk.nbytes)) { unsigned int block_len = nbytes & AES_BLOCK_MASK; if (likely(block_len)) { ctx->ops->ecb_decrypt(key_end, (const u64 *) walk.src.virt.addr, (u64 *) walk.dst.virt.addr, block_len); } nbytes &= AES_BLOCK_SIZE - 1; err = blkcipher_walk_done(desc, &walk, nbytes); } fprs_write(0); return err; } ",0 " ~FPDF_SYSFONTINFO_WITHMETRICS() { FPDF_FreeDefaultSystemFontInfo(default_sysfontinfo); } ",0 "static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev) { char name[IFNAMSIZ]; int err; err = dev_get_phys_port_name(dev, name, sizeof(name)); if (err) { if (err == -EOPNOTSUPP) return 0; return err; } if (nla_put(skb, IFLA_PHYS_PORT_NAME, strlen(name), name)) return -EMSGSIZE; return 0; } ",0 "bool xmp_serialize(XmpPtr xmp, XmpStringPtr buffer, uint32_t options, uint32_t padding) { RESET_ERROR; return xmp_serialize_and_format(xmp, buffer, options, padding, ""\n"", "" "", 0); } ",0 " virtual ~WebDragSourceAura() { base::MessageLoopForUI::current()->RemoveObserver(this); } ",0 "void btrfs_test_destroy_inode(struct inode *inode) { btrfs_drop_extent_cache(inode, 0, (u64)-1, 0); kmem_cache_free(btrfs_inode_cachep, BTRFS_I(inode)); } ",0 "int kvm_create_lapic(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic; ASSERT(vcpu != NULL); apic_debug(""apic_init %d\n"", vcpu->vcpu_id); apic = kzalloc(sizeof(*apic), GFP_KERNEL); if (!apic) goto nomem; vcpu->arch.apic = apic; apic->regs = (void *)get_zeroed_page(GFP_KERNEL); if (!apic->regs) { printk(KERN_ERR ""malloc apic regs error for vcpu %x\n"", vcpu->vcpu_id); goto nomem_free_apic; } apic->vcpu = vcpu; hrtimer_init(&apic->lapic_timer.timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS); apic->lapic_timer.timer.function = apic_timer_fn; /* * APIC is created enabled. This will prevent kvm_lapic_set_base from * thinking that APIC satet has changed. */ vcpu->arch.apic_base = MSR_IA32_APICBASE_ENABLE; kvm_lapic_set_base(vcpu, APIC_DEFAULT_PHYS_BASE | MSR_IA32_APICBASE_ENABLE); static_key_slow_inc(&apic_sw_disabled.key); /* sw disabled at reset */ kvm_lapic_reset(vcpu); kvm_iodevice_init(&apic->dev, &apic_mmio_ops); return 0; nomem_free_apic: kfree(apic); nomem: return -ENOMEM; } ",0 "static const PixelPacket *GetVirtualPixelCache(const Image *image, const VirtualPixelMethod virtual_pixel_method,const ssize_t x,const ssize_t y, const size_t columns,const size_t rows,ExceptionInfo *exception) { CacheInfo *restrict cache_info; const int id = GetOpenMPThreadId(); assert(image != (const Image *) NULL); assert(image->signature == MagickSignature); assert(image->cache != (Cache) NULL); cache_info=(CacheInfo *) image->cache; assert(cache_info->signature == MagickSignature); assert(id < (int) cache_info->number_threads); return(GetVirtualPixelsFromNexus(image,virtual_pixel_method,x,y,columns,rows, cache_info->nexus_info[id],exception)); } ",0 " virtual void EndPassHook(void) { if (bits_total_) { const double file_size_in_kb = bits_total_ / 1000.; // bits per kilobit duration_ = (last_pts_ + 1) * timebase_; effective_datarate_ = (bits_total_ - bits_in_last_frame_) / 1000.0 / (cfg_.rc_buf_initial_sz / 1000.0 + duration_); file_datarate_ = file_size_in_kb / duration_; } } ",0 "copy_resource(fz_context *ctx, pdf_filter_processor *p, pdf_obj *key, const char *name) { pdf_obj *res, *obj; if (!name || name[0] == 0) return; res = pdf_dict_get(ctx, p->old_rdb, key); obj = pdf_dict_gets(ctx, res, name); if (obj) { res = pdf_dict_get(ctx, p->new_rdb, key); if (!res) { res = pdf_new_dict(ctx, pdf_get_bound_document(ctx, p->new_rdb), 1); pdf_dict_put_drop(ctx, p->new_rdb, key, res); } pdf_dict_putp(ctx, res, name, obj); } } ",0 "xmlXPathRegisterFuncLookup (xmlXPathContextPtr ctxt, xmlXPathFuncLookupFunc f, void *funcCtxt) { if (ctxt == NULL) return; ctxt->funcLookupFunc = f; ctxt->funcLookupData = funcCtxt; } ",0 "can_prune_leaf(xmlNode * xml_node) { xmlNode *cIter = NULL; xmlAttrPtr pIter = NULL; gboolean can_prune = TRUE; const char *name = crm_element_name(xml_node); if (safe_str_eq(name, XML_TAG_RESOURCE_REF) || safe_str_eq(name, XML_CIB_TAG_OBJ_REF) || safe_str_eq(name, XML_ACL_TAG_ROLE_REF) || safe_str_eq(name, XML_ACL_TAG_ROLE_REFv1)) { return FALSE; } for (pIter = crm_first_attr(xml_node); pIter != NULL; pIter = pIter->next) { const char *p_name = (const char *)pIter->name; if (strcmp(p_name, XML_ATTR_ID) == 0) { continue; } can_prune = FALSE; } cIter = __xml_first_child(xml_node); while (cIter) { xmlNode *child = cIter; cIter = __xml_next(cIter); if (can_prune_leaf(child)) { free_xml(child); } else { can_prune = FALSE; } } return can_prune; } ",0 "PHP_FUNCTION(openssl_csr_new) { struct php_x509_request req; zval * args = NULL, * dn, *attribs = NULL; zval * out_pkey; X509_REQ * csr = NULL; int we_made_the_key = 1; long key_resource; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""az|a!a!"", &dn, &out_pkey, &args, &attribs) == FAILURE) { return; } RETVAL_FALSE; PHP_SSL_REQ_INIT(&req); if (PHP_SSL_REQ_PARSE(&req, args) == SUCCESS) { /* Generate or use a private key */ if (Z_TYPE_P(out_pkey) != IS_NULL) { req.priv_key = php_openssl_evp_from_zval(&out_pkey, 0, NULL, 0, &key_resource TSRMLS_CC); if (req.priv_key != NULL) { we_made_the_key = 0; } } if (req.priv_key == NULL) { php_openssl_generate_private_key(&req TSRMLS_CC); } if (req.priv_key == NULL) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Unable to generate a private key""); } else { csr = X509_REQ_new(); if (csr) { if (php_openssl_make_REQ(&req, csr, dn, attribs TSRMLS_CC) == SUCCESS) { X509V3_CTX ext_ctx; X509V3_set_ctx(&ext_ctx, NULL, NULL, csr, NULL, 0); X509V3_set_conf_lhash(&ext_ctx, req.req_config); /* Add extensions */ if (req.request_extensions_section && !X509V3_EXT_REQ_add_conf(req.req_config, &ext_ctx, req.request_extensions_section, csr)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Error loading extension section %s"", req.request_extensions_section); } else { RETVAL_TRUE; if (X509_REQ_sign(csr, req.priv_key, req.digest)) { RETVAL_RESOURCE(zend_list_insert(csr, le_csr TSRMLS_CC)); csr = NULL; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Error signing request""); } if (we_made_the_key) { /* and a resource for the private key */ zval_dtor(out_pkey); ZVAL_RESOURCE(out_pkey, zend_list_insert(req.priv_key, le_key TSRMLS_CC)); req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */ } else if (key_resource != -1) { req.priv_key = NULL; /* make sure the cleanup code doesn't zap it! */ } } } else { if (!we_made_the_key) { /* if we have not made the key we are not supposed to zap it by calling dispose! */ req.priv_key = NULL; } } } } } if (csr) { X509_REQ_free(csr); } PHP_SSL_REQ_DISPOSE(&req); } ",0 "void d_instantiate(struct dentry *entry, struct inode * inode) { BUG_ON(!hlist_unhashed(&entry->d_u.d_alias)); if (inode) spin_lock(&inode->i_lock); __d_instantiate(entry, inode); if (inode) spin_unlock(&inode->i_lock); security_d_instantiate(entry, inode); } ",0 "static void announce_device(struct usb_device *udev) { u16 bcdDevice = le16_to_cpu(udev->descriptor.bcdDevice); dev_info(&udev->dev, ""New USB device found, idVendor=%04x, idProduct=%04x, bcdDevice=%2x.%02x\n"", le16_to_cpu(udev->descriptor.idVendor), le16_to_cpu(udev->descriptor.idProduct), bcdDevice >> 8, bcdDevice & 0xff); dev_info(&udev->dev, ""New USB device strings: Mfr=%d, Product=%d, SerialNumber=%d\n"", udev->descriptor.iManufacturer, udev->descriptor.iProduct, udev->descriptor.iSerialNumber); show_string(udev, ""Product"", udev->product); show_string(udev, ""Manufacturer"", udev->manufacturer); show_string(udev, ""SerialNumber"", udev->serial); } ",0 "static void ssh_comp_none_cleanup(void *handle) { } ",0 "static inline u32 get_mask(int size) { if (size == 1) return 0xff; else if (size == 2) return 0xffff; else return 0xffffffff; } ",0 "static void local_socket_destroy(asocket* s) { apacket *p, *n; int exit_on_close = s->exit_on_close; D(""LS(%d): destroying fde.fd=%d"", s->id, s->fde.fd); /* IMPORTANT: the remove closes the fd ** that belongs to this socket */ fdevent_remove(&s->fde); /* dispose of any unwritten data */ for (p = s->pkt_first; p; p = n) { D(""LS(%d): discarding %d bytes"", s->id, p->len); n = p->next; put_apacket(p); } remove_socket(s); free(s); if (exit_on_close) { D(""local_socket_destroy: exiting""); exit(1); } } ",0 "static int send_bulk_static_data(struct snd_usb_midi_out_endpoint *ep, const void *data, int len) { int err = 0; void *buf = kmemdup(data, len, GFP_KERNEL); if (!buf) return -ENOMEM; dump_urb(""sending"", buf, len); if (ep->urbs[0].urb) err = usb_bulk_msg(ep->umidi->dev, ep->urbs[0].urb->pipe, buf, len, NULL, 250); kfree(buf); return err; } ",0 "PermissionsData::PermissionsData( const ExtensionId& extension_id, Manifest::Type manifest_type, Manifest::Location location, std::unique_ptr initial_permissions) : extension_id_(extension_id), manifest_type_(manifest_type), location_(location), active_permissions_unsafe_(std::move(initial_permissions)), withheld_permissions_unsafe_(std::make_unique()) {} ",0 "queue_expected_reply (ProxySide *side, guint32 serial, ExpectedReplyType type) { g_hash_table_replace (side->expected_replies, GUINT_TO_POINTER (serial), GUINT_TO_POINTER (type)); } ",0 "void MSG_WriteDeltaUsercmdKey( msg_t *msg, int key, usercmd_t *from, usercmd_t *to ) { if ( to->serverTime - from->serverTime < 256 ) { MSG_WriteBits( msg, 1, 1 ); MSG_WriteBits( msg, to->serverTime - from->serverTime, 8 ); } else { MSG_WriteBits( msg, 0, 1 ); MSG_WriteBits( msg, to->serverTime, 32 ); } if (from->angles[0] == to->angles[0] && from->angles[1] == to->angles[1] && from->angles[2] == to->angles[2] && from->forwardmove == to->forwardmove && from->rightmove == to->rightmove && from->upmove == to->upmove && from->buttons == to->buttons && from->weapon == to->weapon) { MSG_WriteBits( msg, 0, 1 ); // no change oldsize += 7; return; } key ^= to->serverTime; MSG_WriteBits( msg, 1, 1 ); MSG_WriteDeltaKey( msg, key, from->angles[0], to->angles[0], 16 ); MSG_WriteDeltaKey( msg, key, from->angles[1], to->angles[1], 16 ); MSG_WriteDeltaKey( msg, key, from->angles[2], to->angles[2], 16 ); MSG_WriteDeltaKey( msg, key, from->forwardmove, to->forwardmove, 8 ); MSG_WriteDeltaKey( msg, key, from->rightmove, to->rightmove, 8 ); MSG_WriteDeltaKey( msg, key, from->upmove, to->upmove, 8 ); MSG_WriteDeltaKey( msg, key, from->buttons, to->buttons, 16 ); MSG_WriteDeltaKey( msg, key, from->weapon, to->weapon, 8 ); } ",0 "void InputHandler::handleInputLocaleChanged(bool isRTL) { if (!isActiveTextEdit()) return; ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); RenderObject* renderer = m_currentFocusElement->renderer(); if (!renderer) return; Editor* editor = m_currentFocusElement->document()->frame()->editor(); ASSERT(editor); if ((renderer->style()->direction() == RTL) != isRTL) editor->setBaseWritingDirection(isRTL ? RightToLeftWritingDirection : LeftToRightWritingDirection); } ",0 "static int check_cfg(struct bpf_verifier_env *env) { struct bpf_insn *insns = env->prog->insnsi; int insn_cnt = env->prog->len; int ret = 0; int i, t; ret = check_subprogs(env); if (ret < 0) return ret; insn_state = kcalloc(insn_cnt, sizeof(int), GFP_KERNEL); if (!insn_state) return -ENOMEM; insn_stack = kcalloc(insn_cnt, sizeof(int), GFP_KERNEL); if (!insn_stack) { kfree(insn_state); return -ENOMEM; } insn_state[0] = DISCOVERED; /* mark 1st insn as discovered */ insn_stack[0] = 0; /* 0 is the first instruction */ cur_stack = 1; peek_stack: if (cur_stack == 0) goto check_state; t = insn_stack[cur_stack - 1]; if (BPF_CLASS(insns[t].code) == BPF_JMP) { u8 opcode = BPF_OP(insns[t].code); if (opcode == BPF_EXIT) { goto mark_explored; } else if (opcode == BPF_CALL) { ret = push_insn(t, t + 1, FALLTHROUGH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; if (t + 1 < insn_cnt) env->explored_states[t + 1] = STATE_LIST_MARK; if (insns[t].src_reg == BPF_PSEUDO_CALL) { env->explored_states[t] = STATE_LIST_MARK; ret = push_insn(t, t + insns[t].imm + 1, BRANCH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; } } else if (opcode == BPF_JA) { if (BPF_SRC(insns[t].code) != BPF_K) { ret = -EINVAL; goto err_free; } /* unconditional jump with single edge */ ret = push_insn(t, t + insns[t].off + 1, FALLTHROUGH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; /* tell verifier to check for equivalent states * after every call and jump */ if (t + 1 < insn_cnt) env->explored_states[t + 1] = STATE_LIST_MARK; } else { /* conditional jump with two edges */ env->explored_states[t] = STATE_LIST_MARK; ret = push_insn(t, t + 1, FALLTHROUGH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; ret = push_insn(t, t + insns[t].off + 1, BRANCH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; } } else { /* all other non-branch instructions with single * fall-through edge */ ret = push_insn(t, t + 1, FALLTHROUGH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; } mark_explored: insn_state[t] = EXPLORED; if (cur_stack-- <= 0) { verbose(env, ""pop stack internal bug\n""); ret = -EFAULT; goto err_free; } goto peek_stack; check_state: for (i = 0; i < insn_cnt; i++) { if (insn_state[i] != EXPLORED) { verbose(env, ""unreachable insn %d\n"", i); ret = -EINVAL; goto err_free; } } ret = 0; /* cfg looks good */ err_free: kfree(insn_state); kfree(insn_stack); return ret; } ",0 "int hns_rcb_buf_size2type(u32 buf_size) { int bd_size_type; switch (buf_size) { case 512: bd_size_type = HNS_BD_SIZE_512_TYPE; break; case 1024: bd_size_type = HNS_BD_SIZE_1024_TYPE; break; case 2048: bd_size_type = HNS_BD_SIZE_2048_TYPE; break; case 4096: bd_size_type = HNS_BD_SIZE_4096_TYPE; break; default: bd_size_type = -EINVAL; } return bd_size_type; } ",0 "void InspectorPageAgent::WillRunJavaScriptDialog() { GetFrontend()->flush(); } ",0 " LIBOPENMPT_MODPLUG_API unsigned int ModPlug_InstrumentName(ModPlugFile* file, unsigned int qual, char* buff) { const char* str; unsigned int retval; size_t tmpretval; if(!file) return 0; str = openmpt_module_get_instrument_name(file->mod,qual-1); if(!str){ if(buff){ *buff = '\0'; } return 0; } tmpretval = strlen(str); if(tmpretval>=INT_MAX){ tmpretval = INT_MAX-1; } retval = (int)tmpretval; if(buff){ memcpy(buff,str,retval+1); buff[retval] = '\0'; } openmpt_free_string(str); return retval; } ",1 " void OpenDevToolsWindowForSharedWorker(WorkerData* worker_data) { Profile* profile = browser()->profile(); window_ = DevToolsWindow::CreateDevToolsWindowForWorker(profile); window_->Show(DevToolsToggleAction::Show()); scoped_refptr agent_host( DevToolsAgentHost::GetForWorker( worker_data->worker_process_id, worker_data->worker_route_id)); DevToolsManager::GetInstance()->RegisterDevToolsClientHostFor( agent_host.get(), window_->GetDevToolsClientHostForTest()); RenderViewHost* client_rvh = window_->GetRenderViewHost(); WebContents* client_contents = WebContents::FromRenderViewHost(client_rvh); if (client_contents->IsLoading()) { content::WindowedNotificationObserver observer( content::NOTIFICATION_LOAD_STOP, content::Source( &client_contents->GetController())); observer.Wait(); } } ",0 "bool LaunchBrowser(const CommandLine& command_line, Profile* profile, const std::wstring& cur_dir, bool process_startup, int* return_code, BrowserInit* browser_init) { in_startup = process_startup; DCHECK(profile); if (command_line.HasSwitch(switches::kIncognito)) profile = profile->GetOffTheRecordProfile(); BrowserInit::LaunchWithProfile lwp(cur_dir, command_line, browser_init); bool launched = lwp.Launch(profile, process_startup); in_startup = false; if (!launched) { LOG(ERROR) << ""launch error""; if (return_code) *return_code = ResultCodes::INVALID_CMDLINE_URL; return false; } #if defined(OS_CHROMEOS) TabOverviewMessageListener::instance(); const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); if (parsed_command_line.HasSwitch(switches::kEnableGView)) { chromeos::GViewRequestInterceptor::GetGViewRequestInterceptor(); } if (process_startup) { chromeos::MountLibrary* lib = chromeos::MountLibrary::Get(); chromeos::USBMountObserver* observe = chromeos::USBMountObserver::Get(); observe->set_profile(profile); lib->AddObserver(observe); } #endif return true; } ",0 "void release_open_intent(struct nameidata *nd) { if (nd->intent.open.file->f_path.dentry == NULL) put_filp(nd->intent.open.file); else fput(nd->intent.open.file); } ",0 "int vm_munmap(unsigned long start, size_t len) { return __vm_munmap(start, len, false); } ",0 "int sr_audio_ioctl(struct cdrom_device_info *cdi, unsigned int cmd, void *arg) { switch (cmd) { case CDROMREADTOCHDR: return sr_read_tochdr(cdi, arg); case CDROMREADTOCENTRY: return sr_read_tocentry(cdi, arg); case CDROMPLAYTRKIND: return sr_play_trkind(cdi, arg); default: return -EINVAL; } } ",0 "bool HTMLSelectElement::childShouldCreateRenderer(const NodeRenderingContext& childContext) const { if (!HTMLFormControlElementWithState::childShouldCreateRenderer(childContext)) return false; if (!usesMenuList()) return childContext.node()->hasTagName(HTMLNames::optionTag) || isHTMLOptGroupElement(childContext.node()); return false; } ",0 "static int chmd_fast_find(struct mschm_decompressor *base, struct mschmd_header *chm, const char *filename, struct mschmd_file *f_ptr, int f_size) { struct mschm_decompressor_p *self = (struct mschm_decompressor_p *) base; struct mspack_system *sys; struct mspack_file *fh; /* p and end are initialised to prevent MSVC warning about ""potentially"" * uninitialised usage. This is provably untrue, but MS won't fix: * https://developercommunity.visualstudio.com/content/problem/363489/c4701-false-positive-warning.html */ const unsigned char *chunk, *p = NULL, *end = NULL; int err = MSPACK_ERR_OK, result = -1; unsigned int n, sec; if (!self || !chm || !f_ptr || (f_size != sizeof(struct mschmd_file))) { return MSPACK_ERR_ARGS; } sys = self->system; /* clear the results structure */ memset(f_ptr, 0, f_size); if (!(fh = sys->open(sys, chm->filename, MSPACK_SYS_OPEN_READ))) { return MSPACK_ERR_OPEN; } /* go through PMGI chunk hierarchy to reach PMGL chunk */ if (chm->index_root < chm->num_chunks) { n = chm->index_root; for (;;) { if (!(chunk = read_chunk(self, chm, fh, n))) { sys->close(fh); return self->error; } /* search PMGI/PMGL chunk. exit early if no entry found */ if ((result = search_chunk(chm, chunk, filename, &p, &end)) <= 0) { break; } /* found result. loop around for next chunk if this is PMGI */ if (chunk[3] == 0x4C) break; else READ_ENCINT(n); } } else { /* PMGL chunks only, search from first_pmgl to last_pmgl */ for (n = chm->first_pmgl; n <= chm->last_pmgl; n = EndGetI32(&chunk[pmgl_NextChunk])) { if (!(chunk = read_chunk(self, chm, fh, n))) { err = self->error; break; } /* search PMGL chunk. exit if file found */ if ((result = search_chunk(chm, chunk, filename, &p, &end)) > 0) { break; } /* stop simple infinite loops: can't visit the same chunk twice */ if ((int)n == EndGetI32(&chunk[pmgl_NextChunk])) { break; } } } /* if we found a file, read it */ if (result > 0) { READ_ENCINT(sec); f_ptr->section = (sec == 0) ? (struct mschmd_section *) &chm->sec0 : (struct mschmd_section *) &chm->sec1; READ_ENCINT(f_ptr->offset); READ_ENCINT(f_ptr->length); } else if (result < 0) { err = MSPACK_ERR_DATAFORMAT; } sys->close(fh); return self->error = err; chunk_end: D((""read beyond end of chunk entries"")) sys->close(fh); return self->error = MSPACK_ERR_DATAFORMAT; } ",0 "ofputil_pull_bands(struct ofpbuf *msg, size_t len, uint16_t *n_bands, struct ofpbuf *bands) { const struct ofp13_meter_band_header *ombh; struct ofputil_meter_band *mb; uint16_t n = 0; ombh = ofpbuf_try_pull(msg, len); if (!ombh) { return OFPERR_OFPBRC_BAD_LEN; } while (len >= sizeof (struct ofp13_meter_band_drop)) { size_t ombh_len = ntohs(ombh->len); /* All supported band types have the same length. */ if (ombh_len != sizeof (struct ofp13_meter_band_drop)) { return OFPERR_OFPBRC_BAD_LEN; } mb = ofpbuf_put_uninit(bands, sizeof *mb); mb->type = ntohs(ombh->type); if (mb->type != OFPMBT13_DROP && mb->type != OFPMBT13_DSCP_REMARK) { return OFPERR_OFPMMFC_BAD_BAND; } mb->rate = ntohl(ombh->rate); mb->burst_size = ntohl(ombh->burst_size); mb->prec_level = (mb->type == OFPMBT13_DSCP_REMARK) ? ((struct ofp13_meter_band_dscp_remark *)ombh)->prec_level : 0; n++; len -= ombh_len; ombh = ALIGNED_CAST(struct ofp13_meter_band_header *, (char *) ombh + ombh_len); } if (len) { return OFPERR_OFPBRC_BAD_LEN; } *n_bands = n; return 0; } ",0 " TestLoadTerminationListener* load_termination_listener() { return load_termination_listener_; } ",0 "RenderFrameHostImpl* PrepareToDuplicateHosts(Shell* shell, int* target_routing_id) { GURL foo(""http://foo.com/simple_page.html""); NavigateToURL(shell, foo); EXPECT_EQ(base::ASCIIToUTF16(""OK""), shell->web_contents()->GetTitle()); ShellAddedObserver shell2_observer; EXPECT_TRUE(ExecuteScript(shell, ""window.open(document.URL + '#2');"")); Shell* shell2 = shell2_observer.GetShell(); EXPECT_EQ(shell->web_contents()->GetMainFrame()->GetProcess()->GetID(), shell2->web_contents()->GetMainFrame()->GetProcess()->GetID()); *target_routing_id = shell2->web_contents()->GetRenderViewHost()->GetRoutingID(); EXPECT_NE(*target_routing_id, shell->web_contents()->GetRenderViewHost()->GetRoutingID()); GURL extension_url(""https://bar.com/simple_page.html""); WebContentsImpl* wc = static_cast(shell->web_contents()); wc->GetFrameTree()->root()->navigator()->RequestOpenURL( wc->GetFrameTree()->root()->current_frame_host(), extension_url, false, nullptr, std::string(), Referrer(), WindowOpenDisposition::CURRENT_TAB, false, false, true, blink::WebTriggeringEventInfo::kFromTrustedEvent); RenderFrameHostImpl* next_rfh; if (IsBrowserSideNavigationEnabled()) next_rfh = wc->GetRenderManagerForTesting()->speculative_frame_host(); else next_rfh = wc->GetRenderManagerForTesting()->pending_frame_host(); EXPECT_TRUE(next_rfh); EXPECT_NE(shell->web_contents()->GetRenderProcessHost()->GetID(), next_rfh->GetProcess()->GetID()); return next_rfh; } ",0 "static int tls_process_cke_gost(SSL *s, PACKET *pkt, int *al) { #ifndef OPENSSL_NO_GOST EVP_PKEY_CTX *pkey_ctx; EVP_PKEY *client_pub_pkey = NULL, *pk = NULL; unsigned char premaster_secret[32]; const unsigned char *start; size_t outlen = 32, inlen; unsigned long alg_a; int Ttag, Tclass; long Tlen; long sess_key_len; const unsigned char *data; int ret = 0; /* Get our certificate private key */ alg_a = s->s3->tmp.new_cipher->algorithm_auth; if (alg_a & SSL_aGOST12) { /* * New GOST ciphersuites have SSL_aGOST01 bit too */ pk = s->cert->pkeys[SSL_PKEY_GOST12_512].privatekey; if (pk == NULL) { pk = s->cert->pkeys[SSL_PKEY_GOST12_256].privatekey; } if (pk == NULL) { pk = s->cert->pkeys[SSL_PKEY_GOST01].privatekey; } } else if (alg_a & SSL_aGOST01) { pk = s->cert->pkeys[SSL_PKEY_GOST01].privatekey; } pkey_ctx = EVP_PKEY_CTX_new(pk, NULL); if (pkey_ctx == NULL) { *al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, ERR_R_MALLOC_FAILURE); return 0; } if (EVP_PKEY_decrypt_init(pkey_ctx) <= 0) { *al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, ERR_R_INTERNAL_ERROR); return 0; } /* * If client certificate is present and is of the same type, maybe * use it for key exchange. Don't mind errors from * EVP_PKEY_derive_set_peer, because it is completely valid to use a * client certificate for authorization only. */ client_pub_pkey = X509_get0_pubkey(s->session->peer); if (client_pub_pkey) { if (EVP_PKEY_derive_set_peer(pkey_ctx, client_pub_pkey) <= 0) ERR_clear_error(); } /* Decrypt session key */ sess_key_len = PACKET_remaining(pkt); if (!PACKET_get_bytes(pkt, &data, sess_key_len)) { *al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, ERR_R_INTERNAL_ERROR); goto err; } if (ASN1_get_object((const unsigned char **)&data, &Tlen, &Ttag, &Tclass, sess_key_len) != V_ASN1_CONSTRUCTED || Ttag != V_ASN1_SEQUENCE || Tclass != V_ASN1_UNIVERSAL) { *al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, SSL_R_DECRYPTION_FAILED); goto err; } start = data; inlen = Tlen; if (EVP_PKEY_decrypt (pkey_ctx, premaster_secret, &outlen, start, inlen) <= 0) { *al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, SSL_R_DECRYPTION_FAILED); goto err; } /* Generate master secret */ if (!ssl_generate_master_secret(s, premaster_secret, sizeof(premaster_secret), 0)) { *al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, ERR_R_INTERNAL_ERROR); goto err; } /* Check if pubkey from client certificate was used */ if (EVP_PKEY_CTX_ctrl (pkey_ctx, -1, -1, EVP_PKEY_CTRL_PEER_KEY, 2, NULL) > 0) s->statem.no_cert_verify = 1; ret = 1; err: EVP_PKEY_CTX_free(pkey_ctx); return ret; #else /* Should never happen */ *al = SSL_AD_INTERNAL_ERROR; SSLerr(SSL_F_TLS_PROCESS_CKE_GOST, ERR_R_INTERNAL_ERROR); return 0; #endif } ",0 "void DownloadItemImpl::SetDangerType(content::DownloadDangerType danger_type) { danger_type_ = danger_type; SafetyState updated_value = IsDangerous() ? DownloadItem::DANGEROUS : DownloadItem::SAFE; if (updated_value != safety_state_) { safety_state_ = updated_value; bound_net_log_.AddEvent( net::NetLog::TYPE_DOWNLOAD_ITEM_SAFETY_STATE_UPDATED, base::Bind(&download_net_logs::ItemCheckedCallback, GetDangerType(), GetSafetyState())); UpdateObservers(); } } ",0 "int shmem_unuse(swp_entry_t swap, struct page *page) { return 0; } ",0 "rc_free_icc_profile(gs_memory_t * mem, void *ptr_in, client_name_t cname) { cmm_profile_t *profile = (cmm_profile_t *)ptr_in; gs_memory_t *mem_nongc = profile->memory; if_debug2m(gs_debug_flag_icc, mem, ""[icc] rc decrement profile = 0x%p rc = %ld\n"", ptr_in, profile->rc.ref_count); if (profile->rc.ref_count <= 1 ) { /* Clear out the buffer if it is full */ if (profile->buffer != NULL) { gs_free_object(mem_nongc, profile->buffer, ""rc_free_icc_profile(buffer)""); profile->buffer = NULL; } if_debug0m(gs_debug_flag_icc, mem, ""[icc] profile freed\n""); /* Release this handle if it has been set */ if (profile->profile_handle != NULL) { profile->release(profile->profile_handle); profile->profile_handle = NULL; } /* Release the name if it has been set */ if (profile->name != NULL) { gs_free_object(mem_nongc, profile->name,""rc_free_icc_profile(name)""); profile->name = NULL; profile->name_length = 0; } profile->hash_is_valid = 0; if (profile->lock != NULL) { gx_monitor_free(profile->lock); profile->lock = NULL; } /* If we had a DeviceN profile with names deallocate that now */ if (profile->spotnames != NULL) { /* Free the linked list in this object */ gsicc_free_spotnames(profile->spotnames, mem_nongc); /* Free the main object */ gs_free_object(mem_nongc, profile->spotnames, ""rc_free_icc_profile(spotnames)""); } /* If we allocated a buffer to hold the v2 profile then free that */ if (profile->v2_data != NULL) { gs_free_object(mem_nongc, profile->v2_data, ""rc_free_icc_profile(v2_data)""); } gs_free_object(mem_nongc, profile, ""rc_free_icc_profile""); } } ",0 "InputDispatcher::ConfigurationChangedEntry::~ConfigurationChangedEntry() { } ",0 "bool mdiobus_is_registered_device(struct mii_bus *bus, int addr) { return bus->mdio_map[addr]; } ",0 "void GfxICCBasedCache::put(int numA, int genA, GfxICCBasedColorSpace *cs) { int i; if (cache[GFX_ICCBASED_CACHE_SIZE-1].num > 0) { delete cache[GFX_ICCBASED_CACHE_SIZE-1].colorSpace; } for (i = GFX_ICCBASED_CACHE_SIZE-1; i > 0; i--) { if (cache[i - 1].num > 0) cache[i] = cache[i - 1]; } cache[0].num = numA; cache[0].gen = genA; cache[0].colorSpace = (GfxICCBasedColorSpace *)cs->copy(); } ",0 "void Dispatcher::OnSetSystemFont(const std::string& font_family, const std::string& font_size) { system_font_family_ = font_family; system_font_size_ = font_size; } ",0 "struct task_struct *find_lock_task_mm(struct task_struct *p) { struct task_struct *t; rcu_read_lock(); for_each_thread(p, t) { task_lock(t); if (likely(t->mm)) goto found; task_unlock(t); } t = NULL; found: rcu_read_unlock(); return t; } ",0 "ModuleExport void UnregisterSTEGANOImage(void) { (void) UnregisterMagickInfo(""STEGANO""); } ",0 "void OmniboxViewViews::OnGestureEvent(ui::GestureEvent* event) { if (!HasFocus() && event->type() == ui::ET_GESTURE_TAP_DOWN) { select_all_on_gesture_tap_ = true; saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); } if (select_all_on_gesture_tap_ && event->type() == ui::ET_GESTURE_TAP) SelectAll(false); if (event->type() == ui::ET_GESTURE_TAP || event->type() == ui::ET_GESTURE_TAP_CANCEL || event->type() == ui::ET_GESTURE_TWO_FINGER_TAP || event->type() == ui::ET_GESTURE_SCROLL_BEGIN || event->type() == ui::ET_GESTURE_PINCH_BEGIN || event->type() == ui::ET_GESTURE_LONG_PRESS || event->type() == ui::ET_GESTURE_LONG_TAP) { select_all_on_gesture_tap_ = false; } views::Textfield::OnGestureEvent(event); } ",0 "static void _ewk_view_on_mouse_wheel(void* data, Evas* eventType, Evas_Object* callback, void* eventInfo) { Evas_Event_Mouse_Wheel* wheelEvent = static_cast(eventInfo); Ewk_View_Smart_Data* smartData = static_cast(data); EINA_SAFETY_ON_NULL_RETURN(smartData->api); EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_wheel); smartData->api->mouse_wheel(smartData, wheelEvent); } ",0 "static int btrfs_releasepage(struct page *page, gfp_t gfp_flags) { if (PageWriteback(page) || PageDirty(page)) return 0; return __btrfs_releasepage(page, gfp_flags & GFP_NOFS); } ",0 "int is_file_shm_hugepages(struct file *file) { return file->f_op == &shm_file_operations_huge; } ",0 "unsigned char *lpAppendInteger(unsigned char *lp, int64_t value) { char buf[LONG_STR_SIZE]; int slen = ll2string(buf,sizeof(buf),value); return lpAppend(lp,(unsigned char*)buf,slen); } ",0 "static void br_mdb_free(struct rcu_head *head) { struct net_bridge_mdb_htable *mdb = container_of(head, struct net_bridge_mdb_htable, rcu); struct net_bridge_mdb_htable *old = mdb->old; mdb->old = NULL; kfree(old->mhash); kfree(old); } ",0 " void OnNotifyDeviceAuthorized(int stream_id, media::OutputDeviceStatus device_status, const media::AudioParameters& output_params, const std::string& matched_device_id) { EXPECT_TRUE(IsValidDeviceId(matched_device_id)); OnDeviceAuthorized(stream_id, device_status, output_params, matched_device_id); auth_run_loop_->Quit(); } ",0 "xfs_setfilesize_trans_alloc( struct xfs_ioend *ioend) { struct xfs_mount *mp = XFS_I(ioend->io_inode)->i_mount; struct xfs_trans *tp; int error; error = xfs_trans_alloc(mp, &M_RES(mp)->tr_fsyncts, 0, 0, 0, &tp); if (error) return error; ioend->io_append_trans = tp; /* * We may pass freeze protection with a transaction. So tell lockdep * we released it. */ __sb_writers_release(ioend->io_inode->i_sb, SB_FREEZE_FS); /* * We hand off the transaction to the completion thread now, so * clear the flag here. */ current_restore_flags_nested(&tp->t_pflags, PF_FSTRANS); return 0; } ",0 "static void vmx_enable_tdp(void) { kvm_mmu_set_mask_ptes(VMX_EPT_READABLE_MASK, enable_ept_ad_bits ? VMX_EPT_ACCESS_BIT : 0ull, enable_ept_ad_bits ? VMX_EPT_DIRTY_BIT : 0ull, 0ull, VMX_EPT_EXECUTABLE_MASK, cpu_has_vmx_ept_execute_only() ? 0ull : VMX_EPT_READABLE_MASK, VMX_EPT_RWX_MASK, 0ull); ept_set_mmio_spte_mask(); kvm_enable_tdp(); } ",0 "status_t Parcel::writeString16Vector(const std::vector& val) { return writeTypedVector(val, &Parcel::writeString16); } ",0 "void GLES2Implementation::FlushHelper() { helper_->CommandBufferHelper::Flush(); if (aggressively_free_resources_) FreeEverything(); } ",0 "static Image *ReadSCTImage(const ImageInfo *image_info,ExceptionInfo *exception) { char magick[2]; Image *image; MagickBooleanType status; MagickRealType height, width; Quantum pixel; register IndexPacket *indexes; register ssize_t i, x; register PixelPacket *q; ssize_t count, y; unsigned char buffer[768]; size_t separations, separations_mask, units; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read control block. */ count=ReadBlob(image,80,buffer); (void) count; count=ReadBlob(image,2,(unsigned char *) magick); if ((LocaleNCompare((char *) magick,""CT"",2) != 0) && (LocaleNCompare((char *) magick,""LW"",2) != 0) && (LocaleNCompare((char *) magick,""BM"",2) != 0) && (LocaleNCompare((char *) magick,""PG"",2) != 0) && (LocaleNCompare((char *) magick,""TX"",2) != 0)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if ((LocaleNCompare((char *) magick,""LW"",2) == 0) || (LocaleNCompare((char *) magick,""BM"",2) == 0) || (LocaleNCompare((char *) magick,""PG"",2) == 0) || (LocaleNCompare((char *) magick,""TX"",2) == 0)) ThrowReaderException(CoderError,""OnlyContinuousTonePictureSupported""); count=ReadBlob(image,174,buffer); count=ReadBlob(image,768,buffer); /* Read paramter block. */ units=1UL*ReadBlobByte(image); if (units == 0) image->units=PixelsPerCentimeterResolution; separations=1UL*ReadBlobByte(image); separations_mask=ReadBlobMSBShort(image); count=ReadBlob(image,14,buffer); buffer[14]='\0'; height=StringToDouble((char *) buffer,(char **) NULL); count=ReadBlob(image,14,buffer); width=StringToDouble((char *) buffer,(char **) NULL); count=ReadBlob(image,12,buffer); buffer[12]='\0'; image->rows=StringToUnsignedLong((char *) buffer); count=ReadBlob(image,12,buffer); image->columns=StringToUnsignedLong((char *) buffer); count=ReadBlob(image,200,buffer); count=ReadBlob(image,768,buffer); if (separations_mask == 0x0f) SetImageColorspace(image,CMYKColorspace); image->x_resolution=1.0*image->columns/width; image->y_resolution=1.0*image->rows/height; if (image_info->ping != MagickFalse) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } /* Convert SCT raster image to pixel packets. */ for (y=0; y < (ssize_t) image->rows; y++) { for (i=0; i < (ssize_t) separations; i++) { q=GetAuthenticPixels(image,0,y,image->columns,1,exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(image); for (x=0; x < (ssize_t) image->columns; x++) { pixel=(Quantum) ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); if (image->colorspace == CMYKColorspace) pixel=(Quantum) (QuantumRange-pixel); switch (i) { case 0: { SetPixelRed(q,pixel); SetPixelGreen(q,pixel); SetPixelBlue(q,pixel); break; } case 1: { SetPixelGreen(q,pixel); break; } case 2: { SetPixelBlue(q,pixel); break; } case 3: { if (image->colorspace == CMYKColorspace) SetPixelBlack(indexes+x,pixel); break; } } q++; } if (SyncAuthenticPixels(image,exception) == MagickFalse) break; if ((image->columns % 2) != 0) (void) ReadBlobByte(image); /* pad */ } status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y, image->rows); if (status == MagickFalse) break; } if (EOFBlob(image) != MagickFalse) ThrowFileException(exception,CorruptImageError,""UnexpectedEndOfFile"", image->filename); (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "void ContentSecurityPolicy::setOverrideAllowInlineStyle(bool value) { m_overrideInlineStyleAllowed = value; } ",0 " virtual ~MockCanceledAfterSentPluginProcessHostClient() {} ",0 "static int next_valid_format(void) { int probed_format; probed_format = DRS->probed_format; while (1) { if (probed_format >= 8 || !DP->autodetect[probed_format]) { DRS->probed_format = 0; return 1; } if (floppy_type[DP->autodetect[probed_format]].sect) { DRS->probed_format = probed_format; return 0; } probed_format++; } } ",0 "nfsd4_access(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, struct nfsd4_access *access) { if (access->ac_req_access & ~NFS3_ACCESS_FULL) return nfserr_inval; access->ac_resp_access = access->ac_req_access; return nfsd_access(rqstp, &cstate->current_fh, &access->ac_resp_access, &access->ac_supported); } ",0 "static void lsi_set_irq(LSIState *s, int level) { PCIDevice *d = PCI_DEVICE(s); if (s->ext_irq) { qemu_set_irq(s->ext_irq, level); } else { pci_set_irq(d, level); } } ",0 "void Dispatcher::AddStatus(const std::string& pattern) { mg_set_uri_callback(context_, (root_ + pattern).c_str(), &SendStatus, NULL); } ",1 "enum nss_status _nss_mymachines_getgrnam_r( const char *name, struct group *gr, char *buffer, size_t buflen, int *errnop) { _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL; _cleanup_bus_message_unref_ sd_bus_message* reply = NULL; _cleanup_bus_flush_close_unref_ sd_bus *bus = NULL; const char *p, *e, *machine; uint32_t mapped; uid_t gid; size_t l; int r; assert(name); assert(gr); p = startswith(name, ""vg-""); if (!p) goto not_found; e = strrchr(p, '-'); if (!e || e == p) goto not_found; r = parse_gid(e + 1, &gid); if (r < 0) goto not_found; machine = strndupa(p, e - p); if (!machine_name_is_valid(machine)) goto not_found; r = sd_bus_open_system(&bus); if (r < 0) goto fail; r = sd_bus_call_method(bus, ""org.freedesktop.machine1"", ""/org/freedesktop/machine1"", ""org.freedesktop.machine1.Manager"", ""MapFromMachineGroup"", &error, &reply, ""su"", machine, (uint32_t) gid); if (r < 0) { if (sd_bus_error_has_name(&error, BUS_ERROR_NO_SUCH_GROUP_MAPPING)) goto not_found; goto fail; } r = sd_bus_message_read(reply, ""u"", &mapped); if (r < 0) goto fail; l = sizeof(char*) + strlen(name) + 1; if (buflen < l) { *errnop = ENOMEM; return NSS_STATUS_TRYAGAIN; } memzero(buffer, sizeof(char*)); strcpy(buffer + sizeof(char*), name); gr->gr_name = buffer + sizeof(char*); gr->gr_gid = gid; gr->gr_passwd = (char*) ""*""; /* locked */ gr->gr_mem = (char**) buffer; *errnop = 0; return NSS_STATUS_SUCCESS; not_found: *errnop = 0; return NSS_STATUS_NOTFOUND; fail: *errnop = -r; return NSS_STATUS_UNAVAIL; } ",1 "IndexedDBDatabaseError IndexedDBDatabase::CreateError( uint16_t code, const base::string16& message, IndexedDBTransaction* transaction) { transaction->IncrementNumErrorsSent(); return IndexedDBDatabaseError(code, message); } ",0 " void Start(const gfx::Range& path_bounds) { path_bounds_ = path_bounds; animation_.Start(); } ",0 "bool CParaNdisTX::Pause() { PNET_BUFFER_LIST NBL = nullptr; bool res; DoWithTXLock([this, &NBL, &res]() { NBL = RemoveAllNonWaitingNBLs(); res = (!m_VirtQueue.HasPacketsInHW() && m_WaitingList.IsEmpty()); }); if(NBL != nullptr) { NdisMSendNetBufferListsComplete(m_Context->MiniportHandle, NBL, 0); } return res; } ",0 "void RendererSchedulerImpl::SetStoppingWhenBackgroundedEnabled(bool enabled) { main_thread_only().stopping_when_backgrounded_enabled = enabled; } ",0 " bool IsLastInArray() const { return is_last_in_array_; } ",0 "void PaymentRequestState::HasEnrolledInstrument(StatusCallback callback) { if (!get_all_instruments_finished_) { DCHECK(!has_enrolled_instrument_callback_); has_enrolled_instrument_callback_ = std::move(callback); return; } base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&PaymentRequestState::CheckHasEnrolledInstrument, weak_ptr_factory_.GetWeakPtr(), std::move(callback))); } ",0 "set_default_router_id(data_t *data, char *new_id) { if (!new_id || !new_id[0]) return; data->router_id = MALLOC(strlen(new_id)+1); strcpy(data->router_id, new_id); } ",0 "static req_table_t* req_subprocess_env(request_rec *r) { req_table_t* t = apr_palloc(r->pool, sizeof(req_table_t)); t->r = r; t->t = r->subprocess_env; t->n = ""subprocess_env""; return t; } ",0 "void MemStream::reset() { bufPtr = buf + start; } ",0 "void SavePackage::OnDownloadDestroyed(DownloadItem* download) { StopObservation(); } ",0 "static void ghash_async_exit_tfm(struct crypto_tfm *tfm) { struct ghash_async_ctx *ctx = crypto_tfm_ctx(tfm); cryptd_free_ahash(ctx->cryptd_tfm); } ",0 "TEE_Result syscall_cipher_update(unsigned long state, const void *src, size_t src_len, void *dst, uint64_t *dst_len) { return tee_svc_cipher_update_helper(state, false /* last_block */, src, src_len, dst, dst_len); } ",0 "static size_t curl_read(char *data, size_t size, size_t nmemb, void *ctx) { php_curl *ch = (php_curl *)ctx; php_curl_read *t = ch->handlers->read; int length = 0; switch (t->method) { case PHP_CURL_DIRECT: if (t->fp) { length = fread(data, size, nmemb, t->fp); } break; case PHP_CURL_USER: { zval argv[3]; zval retval; int error; zend_fcall_info fci; ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); if (t->res) { ZVAL_RES(&argv[1], t->res); Z_ADDREF(argv[1]); } else { ZVAL_NULL(&argv[1]); } ZVAL_LONG(&argv[2], (int)size * nmemb); fci.size = sizeof(fci); fci.function_table = EG(function_table); ZVAL_COPY_VALUE(&fci.function_name, &t->func_name); fci.object = NULL; fci.retval = &retval; fci.param_count = 3; fci.params = argv; fci.no_separation = 0; fci.symbol_table = NULL; ch->in_callback = 1; error = zend_call_function(&fci, &t->fci_cache); ch->in_callback = 0; if (error == FAILURE) { php_error_docref(NULL, E_WARNING, ""Cannot call the CURLOPT_READFUNCTION""); #if LIBCURL_VERSION_NUM >= 0x070c01 /* 7.12.1 */ length = CURL_READFUNC_ABORT; #endif } else if (!Z_ISUNDEF(retval)) { _php_curl_verify_handlers(ch, 1); if (Z_TYPE(retval) == IS_STRING) { length = MIN((int) (size * nmemb), Z_STRLEN(retval)); memcpy(data, Z_STRVAL(retval), length); } zval_ptr_dtor(&retval); } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); zval_ptr_dtor(&argv[2]); break; } } return length; } ",0 "void WebGLRenderingContextBase::vertexAttrib4fv(GLuint index, const Vector& v) { if (isContextLost()) return; if (v.size() < 4) { SynthesizeGLError(GL_INVALID_VALUE, ""vertexAttrib4fv"", ""invalid array""); return; } ContextGL()->VertexAttrib4fv(index, v.data()); SetVertexAttribType(index, kFloat32ArrayType); } ",0 "int64_t xbzrle_cache_resize(int64_t new_size) { PageCache *new_cache; int64_t ret; if (new_size < TARGET_PAGE_SIZE) { return -1; } XBZRLE_cache_lock(); if (XBZRLE.cache != NULL) { if (pow2floor(new_size) == migrate_xbzrle_cache_size()) { goto out_new_size; } new_cache = cache_init(new_size / TARGET_PAGE_SIZE, TARGET_PAGE_SIZE); if (!new_cache) { error_report(""Error creating cache""); ret = -1; goto out; } cache_fini(XBZRLE.cache); XBZRLE.cache = new_cache; } out_new_size: ret = pow2floor(new_size); out: XBZRLE_cache_unlock(); return ret; } ",0 "void ResourceDispatcherHostImpl::ClearLoginDelegateForRequest( net::URLRequest* request) { ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); if (info) { ResourceLoader* loader = GetLoader(info->GetGlobalRequestID()); if (loader) loader->ClearLoginDelegate(); } } ",0 "void RenderWidgetHostImpl::GotResponseToKeyboardLockRequest(bool allowed) { DCHECK(keyboard_lock_requested_); keyboard_lock_allowed_ = allowed; if (keyboard_lock_allowed_) LockKeyboard(); else UnlockKeyboard(); } ",0 "V0CustomElementMicrotaskRunQueue* Document::customElementMicrotaskRunQueue() { if (!m_customElementMicrotaskRunQueue) m_customElementMicrotaskRunQueue = V0CustomElementMicrotaskRunQueue::create(); return m_customElementMicrotaskRunQueue.get(); } ",0 "static void usb_release_interface(struct device *dev) { struct usb_interface *intf = to_usb_interface(dev); struct usb_interface_cache *intfc = altsetting_to_usb_interface_cache(intf->altsetting); kref_put(&intfc->ref, usb_release_interface_cache); usb_put_dev(interface_to_usbdev(intf)); kfree(intf); } ",0 "ZSTDLIB_API size_t ZSTD_CCtx_setPledgedSrcSize(ZSTD_CCtx* cctx, unsigned long long pledgedSrcSize) { DEBUGLOG(4, ""ZSTD_CCtx_setPledgedSrcSize to %u bytes"", (U32)pledgedSrcSize); if (cctx->streamStage != zcss_init) return ERROR(stage_wrong); cctx->pledgedSrcSizePlusOne = pledgedSrcSize+1; return 0; } ",0 "static int avi_read_seek(AVFormatContext *s, int stream_index, int64_t timestamp, int flags) { AVIContext *avi = s->priv_data; AVStream *st; int i, index; int64_t pos, pos_min; AVIStream *ast; /* Does not matter which stream is requested dv in avi has the * stream information in the first video stream. */ if (avi->dv_demux) stream_index = 0; if (!avi->index_loaded) { /* we only load the index on demand */ avi_load_index(s); avi->index_loaded |= 1; } av_assert0(stream_index >= 0); st = s->streams[stream_index]; ast = st->priv_data; index = av_index_search_timestamp(st, timestamp * FFMAX(ast->sample_size, 1), flags); if (index < 0) { if (st->nb_index_entries > 0) av_log(s, AV_LOG_DEBUG, ""Failed to find timestamp %""PRId64 "" in index %""PRId64 "" .. %""PRId64 ""\n"", timestamp * FFMAX(ast->sample_size, 1), st->index_entries[0].timestamp, st->index_entries[st->nb_index_entries - 1].timestamp); return AVERROR_INVALIDDATA; } /* find the position */ pos = st->index_entries[index].pos; timestamp = st->index_entries[index].timestamp / FFMAX(ast->sample_size, 1); av_log(s, AV_LOG_TRACE, ""XX %""PRId64"" %d %""PRId64""\n"", timestamp, index, st->index_entries[index].timestamp); if (CONFIG_DV_DEMUXER && avi->dv_demux) { /* One and only one real stream for DV in AVI, and it has video */ /* offsets. Calling with other stream indexes should have failed */ /* the av_index_search_timestamp call above. */ if (avio_seek(s->pb, pos, SEEK_SET) < 0) return -1; /* Feed the DV video stream version of the timestamp to the */ /* DV demux so it can synthesize correct timestamps. */ ff_dv_offset_reset(avi->dv_demux, timestamp); avi->stream_index = -1; return 0; } pos_min = pos; for (i = 0; i < s->nb_streams; i++) { AVStream *st2 = s->streams[i]; AVIStream *ast2 = st2->priv_data; ast2->packet_size = ast2->remaining = 0; if (ast2->sub_ctx) { seek_subtitle(st, st2, timestamp); continue; } if (st2->nb_index_entries <= 0) continue; index = av_index_search_timestamp(st2, av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), flags | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (index < 0) index = 0; ast2->seek_pos = st2->index_entries[index].pos; pos_min = FFMIN(pos_min,ast2->seek_pos); } for (i = 0; i < s->nb_streams; i++) { AVStream *st2 = s->streams[i]; AVIStream *ast2 = st2->priv_data; if (ast2->sub_ctx || st2->nb_index_entries <= 0) continue; index = av_index_search_timestamp( st2, av_rescale_q(timestamp, st->time_base, st2->time_base) * FFMAX(ast2->sample_size, 1), flags | AVSEEK_FLAG_BACKWARD | (st2->codecpar->codec_type != AVMEDIA_TYPE_VIDEO ? AVSEEK_FLAG_ANY : 0)); if (index < 0) index = 0; while (!avi->non_interleaved && index>0 && st2->index_entries[index-1].pos >= pos_min) index--; ast2->frame_offset = st2->index_entries[index].timestamp; } /* do the seek */ if (avio_seek(s->pb, pos_min, SEEK_SET) < 0) { av_log(s, AV_LOG_ERROR, ""Seek failed\n""); return -1; } avi->stream_index = -1; avi->dts_max = INT_MIN; return 0; } ",0 "media::AudioCodec CodecIdToMediaAudioCodec(AudioTrackRecorder::CodecId id) { switch (id) { case AudioTrackRecorder::CodecId::PCM: return media::kCodecPCM; case AudioTrackRecorder::CodecId::OPUS: return media::kCodecOpus; case AudioTrackRecorder::CodecId::LAST: return media::kUnknownAudioCodec; } NOTREACHED() << ""Unsupported audio codec""; return media::kUnknownAudioCodec; } ",0 "static bool parse_diff(struct pool *pool, json_t *val) { double old_diff, diff; if (opt_diff_mult == 0.0) diff = json_number_value(json_array_get(val, 0)) * pool->algorithm.diff_multiplier1; else diff = json_number_value(json_array_get(val, 0)) * opt_diff_mult; if (diff == 0) return false; cg_wlock(&pool->data_lock); old_diff = pool->swork.diff; pool->swork.diff = diff; cg_wunlock(&pool->data_lock); if (old_diff != diff) { int idiff = diff; if ((double)idiff == diff) applog(pool == current_pool() ? LOG_NOTICE : LOG_DEBUG, ""%s difficulty changed to %d"", get_pool_name(pool), idiff); else applog(pool == current_pool() ? LOG_NOTICE : LOG_DEBUG, ""%s difficulty changed to %.3f"", get_pool_name(pool), diff); } else applog(LOG_DEBUG, ""%s difficulty set to %f"", get_pool_name(pool), diff); return true; } ",0 "OMX_ERRORTYPE SimpleSoftOMXComponent::getParameter( OMX_INDEXTYPE index, OMX_PTR params) { Mutex::Autolock autoLock(mLock); return internalGetParameter(index, params); } ",0 "static int perf_exclude_event(struct perf_event *event, struct pt_regs *regs) { if (event->hw.state & PERF_HES_STOPPED) return 1; if (regs) { if (event->attr.exclude_user && user_mode(regs)) return 1; if (event->attr.exclude_kernel && !user_mode(regs)) return 1; } return 0; } ",0 "static int unlink_urbs (struct usbnet *dev, struct sk_buff_head *q) { unsigned long flags; struct sk_buff *skb; int count = 0; spin_lock_irqsave (&q->lock, flags); while (!skb_queue_empty(q)) { struct skb_data *entry; struct urb *urb; int retval; skb_queue_walk(q, skb) { entry = (struct skb_data *) skb->cb; if (entry->state != unlink_start) goto found; } break; found: entry->state = unlink_start; urb = entry->urb; /* * Get reference count of the URB to avoid it to be * freed during usb_unlink_urb, which may trigger * use-after-free problem inside usb_unlink_urb since * usb_unlink_urb is always racing with .complete * handler(include defer_bh). */ usb_get_urb(urb); spin_unlock_irqrestore(&q->lock, flags); retval = usb_unlink_urb (urb); if (retval != -EINPROGRESS && retval != 0) netdev_dbg(dev->net, ""unlink urb err, %d\n"", retval); else count++; usb_put_urb(urb); spin_lock_irqsave(&q->lock, flags); } spin_unlock_irqrestore (&q->lock, flags); return count; } ",0 " FT_New_Face_From_FOND( FT_Library library, Handle fond, FT_Long face_index, FT_Face* aface ) { short have_sfnt, have_lwfn = 0; ResID sfnt_id, fond_id; OSType fond_type; Str255 fond_name; Str255 lwfn_file_name; UInt8 path_lwfn[PATH_MAX]; OSErr err; FT_Error error = FT_Err_Ok; GetResInfo( fond, &fond_id, &fond_type, fond_name ); if ( ResError() != noErr || fond_type != TTAG_FOND ) return FT_THROW( Invalid_File_Format ); parse_fond( *fond, &have_sfnt, &sfnt_id, lwfn_file_name, face_index ); if ( lwfn_file_name[0] ) { ResFileRefNum res; res = HomeResFile( fond ); if ( noErr != ResError() ) goto found_no_lwfn_file; { UInt8 path_fond[PATH_MAX]; FSRef ref; err = FSGetForkCBInfo( res, kFSInvalidVolumeRefNum, NULL, NULL, NULL, &ref, NULL ); if ( noErr != err ) goto found_no_lwfn_file; err = FSRefMakePath( &ref, path_fond, sizeof ( path_fond ) ); if ( noErr != err ) goto found_no_lwfn_file; error = lookup_lwfn_by_fond( path_fond, lwfn_file_name, path_lwfn, sizeof ( path_lwfn ) ); if ( !error ) have_lwfn = 1; } } if ( have_lwfn && ( !have_sfnt || PREFER_LWFN ) ) error = FT_New_Face_From_LWFN( library, path_lwfn, face_index, aface ); else error = FT_THROW( Unknown_File_Format ); found_no_lwfn_file: if ( have_sfnt && error ) error = FT_New_Face_From_SFNT( library, sfnt_id, face_index, aface ); return error; } ",0 "size_t GLES2Util::RenderbufferBytesPerPixel(int format) { switch (format) { case GL_STENCIL_INDEX8: return 1; case GL_RGBA4: case GL_RGB565: case GL_RGB5_A1: case GL_DEPTH_COMPONENT16: return 2; case GL_RGB: case GL_RGBA: case GL_DEPTH24_STENCIL8_OES: case GL_RGB8_OES: case GL_RGBA8_OES: case GL_DEPTH_COMPONENT24_OES: return 4; default: return 0; } } ",0 "bt_status_t btif_set_adapter_property(const bt_property_t *property) { btif_storage_req_t req; bt_status_t status = BT_STATUS_SUCCESS; int storage_req_id = BTIF_CORE_STORAGE_NOTIFY_STATUS; /* default */ char bd_name[BTM_MAX_LOC_BD_NAME_LEN +1]; UINT16 name_len = 0; BTIF_TRACE_EVENT(""btif_set_adapter_property type: %d, len %d, 0x%x"", property->type, property->len, property->val); if (!btif_is_enabled()) return BT_STATUS_NOT_READY; switch(property->type) { case BT_PROPERTY_BDNAME: { name_len = property->len > BTM_MAX_LOC_BD_NAME_LEN ? BTM_MAX_LOC_BD_NAME_LEN: property->len; memcpy(bd_name,property->val, name_len); bd_name[name_len] = '\0'; BTIF_TRACE_EVENT(""set property name : %s"", (char *)bd_name); BTA_DmSetDeviceName((char *)bd_name); storage_req_id = BTIF_CORE_STORAGE_ADAPTER_WRITE; } break; case BT_PROPERTY_ADAPTER_SCAN_MODE: { bt_scan_mode_t mode = *(bt_scan_mode_t*)property->val; tBTA_DM_DISC disc_mode; tBTA_DM_CONN conn_mode; switch(mode) { case BT_SCAN_MODE_NONE: disc_mode = BTA_DM_NON_DISC; conn_mode = BTA_DM_NON_CONN; break; case BT_SCAN_MODE_CONNECTABLE: disc_mode = BTA_DM_NON_DISC; conn_mode = BTA_DM_CONN; break; case BT_SCAN_MODE_CONNECTABLE_DISCOVERABLE: disc_mode = BTA_DM_GENERAL_DISC; conn_mode = BTA_DM_CONN; break; default: BTIF_TRACE_ERROR(""invalid scan mode (0x%x)"", mode); return BT_STATUS_PARM_INVALID; } BTIF_TRACE_EVENT(""set property scan mode : %x"", mode); BTA_DmSetVisibility(disc_mode, conn_mode, BTA_DM_IGNORE, BTA_DM_IGNORE); storage_req_id = BTIF_CORE_STORAGE_ADAPTER_WRITE; } break; case BT_PROPERTY_ADAPTER_DISCOVERY_TIMEOUT: { /* Nothing to do beside store the value in NV. Java will change the SCAN_MODE property after setting timeout, if required */ storage_req_id = BTIF_CORE_STORAGE_ADAPTER_WRITE; } break; case BT_PROPERTY_BDADDR: case BT_PROPERTY_UUIDS: case BT_PROPERTY_ADAPTER_BONDED_DEVICES: case BT_PROPERTY_REMOTE_FRIENDLY_NAME: /* no write support through HAL, these properties are only populated from BTA events */ status = BT_STATUS_FAIL; break; default: BTIF_TRACE_ERROR(""btif_get_adapter_property : invalid type %d"", property->type); status = BT_STATUS_FAIL; break; } if (storage_req_id != BTIF_CORE_STORAGE_NO_ACTION) { /* pass on to storage for updating local database */ memset(&(req.write_req.bd_addr), 0, sizeof(bt_bdaddr_t)); memcpy(&(req.write_req.prop), property, sizeof(bt_property_t)); return btif_transfer_context(execute_storage_request, storage_req_id, (char*)&req, sizeof(btif_storage_req_t)+property->len, btif_in_storage_request_copy_cb); } return status; } ",0 "static int nfs_fattr3_to_stat(uint32_t *p, struct inode *inode) { uint32_t mode; size_t i; if (!inode) return 0; /* offsetof(struct fattr3, type) = 0 */ switch (ntoh32(net_read_uint32(p + 0))) { case NF3REG: inode->i_mode = S_IFREG; break; case NF3DIR: inode->i_mode = S_IFDIR; break; case NF3BLK: inode->i_mode = S_IFBLK; break; case NF3CHR: inode->i_mode = S_IFCHR; break; case NF3LNK: inode->i_mode = S_IFLNK; break; case NF3SOCK: inode->i_mode = S_IFSOCK; break; case NF3FIFO: inode->i_mode = S_IFIFO; break; default: printf(""%s: invalid mode %x\n"", __func__, ntoh32(net_read_uint32(p + 0))); return -EIO; } /* offsetof(struct fattr3, mode) = 4 */ mode = ntoh32(net_read_uint32(p + 1)); for (i = 0; i < ARRAY_SIZE(nfs3_mode_bits); ++i) { if (mode & nfs3_mode_bits[i].nfsmode) inode->i_mode |= nfs3_mode_bits[i].statmode; } /* offsetof(struct fattr3, size) = 20 */ inode->i_size = ntoh64(net_read_uint64(p + 5)); return 0; } ",0 "base::string16 no_user_str() { return l10n_util::GetStringUTF16(IDS_PASSWORD_MANAGER_EMPTY_LOGIN); } ",0 "status_t Camera3Device::flush(int64_t *frameNumber) { ATRACE_CALL(); ALOGV(""%s: Camera %d: Flushing all requests"", __FUNCTION__, mId); Mutex::Autolock il(mInterfaceLock); NotificationListener* listener; { Mutex::Autolock l(mOutputLock); listener = mListener; } { Mutex::Autolock l(mLock); mRequestThread->clear(listener, /*out*/frameNumber); } status_t res; if (mHal3Device->common.version >= CAMERA_DEVICE_API_VERSION_3_1) { res = mRequestThread->flush(); } else { Mutex::Autolock l(mLock); res = waitUntilDrainedLocked(); } return res; } ",0 "static int irda_create(struct net *net, struct socket *sock, int protocol, int kern) { struct sock *sk; struct irda_sock *self; if (net != &init_net) return -EAFNOSUPPORT; /* Check for valid socket type */ switch (sock->type) { case SOCK_STREAM: /* For TTP connections with SAR disabled */ case SOCK_SEQPACKET: /* For TTP connections with SAR enabled */ case SOCK_DGRAM: /* For TTP Unitdata or LMP Ultra transfers */ break; default: return -ESOCKTNOSUPPORT; } /* Allocate networking socket */ sk = sk_alloc(net, PF_IRDA, GFP_KERNEL, &irda_proto, kern); if (sk == NULL) return -ENOMEM; self = irda_sk(sk); pr_debug(""%s() : self is %p\n"", __func__, self); init_waitqueue_head(&self->query_wait); switch (sock->type) { case SOCK_STREAM: sock->ops = &irda_stream_ops; self->max_sdu_size_rx = TTP_SAR_DISABLE; break; case SOCK_SEQPACKET: sock->ops = &irda_seqpacket_ops; self->max_sdu_size_rx = TTP_SAR_UNBOUND; break; case SOCK_DGRAM: switch (protocol) { #ifdef CONFIG_IRDA_ULTRA case IRDAPROTO_ULTRA: sock->ops = &irda_ultra_ops; /* Initialise now, because we may send on unbound * sockets. Jean II */ self->max_data_size = ULTRA_MAX_DATA - LMP_PID_HEADER; self->max_header_size = IRDA_MAX_HEADER + LMP_PID_HEADER; break; #endif /* CONFIG_IRDA_ULTRA */ case IRDAPROTO_UNITDATA: sock->ops = &irda_dgram_ops; /* We let Unitdata conn. be like seqpack conn. */ self->max_sdu_size_rx = TTP_SAR_UNBOUND; break; default: sk_free(sk); return -ESOCKTNOSUPPORT; } break; default: sk_free(sk); return -ESOCKTNOSUPPORT; } /* Initialise networking socket struct */ sock_init_data(sock, sk); /* Note : set sk->sk_refcnt to 1 */ sk->sk_family = PF_IRDA; sk->sk_protocol = protocol; /* Register as a client with IrLMP */ self->ckey = irlmp_register_client(0, NULL, NULL, NULL); self->mask.word = 0xffff; self->rx_flow = self->tx_flow = FLOW_START; self->nslots = DISCOVERY_DEFAULT_SLOTS; self->daddr = DEV_ADDR_ANY; /* Until we get connected */ self->saddr = 0x0; /* so IrLMP assign us any link */ return 0; } ",1 "void FocusNotifier(WebPluginDelegateImpl *instance) { uint32 process_id = getpid(); uint32 instance_id = reinterpret_cast(instance); PluginThread* plugin_thread = PluginThread::current(); if (plugin_thread) { plugin_thread->Send( new PluginProcessHostMsg_PluginReceivedFocus(process_id, instance_id)); } } ",0 "void AXLayoutObject::addInlineTextBoxChildren(bool force) { Settings* settings = getDocument()->settings(); if (!force && (!settings || !settings->getInlineTextBoxAccessibilityEnabled())) return; if (!getLayoutObject() || !getLayoutObject()->isText()) return; if (getLayoutObject()->needsLayout()) { return; } LayoutText* layoutText = toLayoutText(getLayoutObject()); for (RefPtr box = layoutText->firstAbstractInlineTextBox(); box.get(); box = box->nextInlineTextBox()) { AXObject* axObject = axObjectCache().getOrCreate(box.get()); if (!axObject->accessibilityIsIgnored()) m_children.push_back(axObject); } } ",0 "void netdev_adjacent_rename_links(struct net_device *dev, char *oldname) { struct netdev_adjacent *iter; struct net *net = dev_net(dev); list_for_each_entry(iter, &dev->adj_list.upper, list) { if (!net_eq(net,dev_net(iter->dev))) continue; netdev_adjacent_sysfs_del(iter->dev, oldname, &iter->dev->adj_list.lower); netdev_adjacent_sysfs_add(iter->dev, dev, &iter->dev->adj_list.lower); } list_for_each_entry(iter, &dev->adj_list.lower, list) { if (!net_eq(net,dev_net(iter->dev))) continue; netdev_adjacent_sysfs_del(iter->dev, oldname, &iter->dev->adj_list.upper); netdev_adjacent_sysfs_add(iter->dev, dev, &iter->dev->adj_list.upper); } } ",0 "int UDPSocketWin::JoinGroup( const IPAddressNumber& group_address) const { DCHECK(CalledOnValidThread()); if (!is_connected()) return ERR_SOCKET_NOT_CONNECTED; switch (group_address.size()) { case kIPv4AddressSize: { if (addr_family_ != AF_INET) return ERR_ADDRESS_INVALID; ip_mreq mreq; mreq.imr_interface.s_addr = htonl(multicast_interface_); memcpy(&mreq.imr_multiaddr, &group_address[0], kIPv4AddressSize); int rv = setsockopt(socket_, IPPROTO_IP, IP_ADD_MEMBERSHIP, reinterpret_cast(&mreq), sizeof(mreq)); if (rv) return MapSystemError(WSAGetLastError()); return OK; } case kIPv6AddressSize: { if (addr_family_ != AF_INET6) return ERR_ADDRESS_INVALID; ipv6_mreq mreq; mreq.ipv6mr_interface = multicast_interface_; memcpy(&mreq.ipv6mr_multiaddr, &group_address[0], kIPv6AddressSize); int rv = setsockopt(socket_, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, reinterpret_cast(&mreq), sizeof(mreq)); if (rv) return MapSystemError(WSAGetLastError()); return OK; } default: NOTREACHED() << ""Invalid address family""; return ERR_ADDRESS_INVALID; } } ",0 "xfs_attr_leaf_removename(xfs_da_args_t *args) { xfs_inode_t *dp; struct xfs_buf *bp; int error, committed, forkoff; trace_xfs_attr_leaf_removename(args); /* * Remove the attribute. */ dp = args->dp; args->blkno = 0; error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, -1, &bp); if (error) return error; error = xfs_attr3_leaf_lookup_int(bp, args); if (error == ENOATTR) { xfs_trans_brelse(args->trans, bp); return error; } xfs_attr3_leaf_remove(bp, args); /* * If the result is small enough, shrink it all into the inode. */ if ((forkoff = xfs_attr_shortform_allfit(bp, dp))) { xfs_bmap_init(args->flist, args->firstblock); error = xfs_attr3_leaf_to_shortform(bp, args, forkoff); /* bp is gone due to xfs_da_shrink_inode */ if (!error) { error = xfs_bmap_finish(&args->trans, args->flist, &committed); } if (error) { ASSERT(committed); args->trans = NULL; xfs_bmap_cancel(args->flist); return error; } /* * bmap_finish() may have committed the last trans and started * a new one. We need the inode to be in all transactions. */ if (committed) xfs_trans_ijoin(args->trans, dp, 0); } return 0; } ",0 "static int gs_cmd_reset(struct gs_usb *gsusb, struct gs_can *gsdev) { struct gs_device_mode *dm; struct usb_interface *intf = gsdev->iface; int rc; dm = kzalloc(sizeof(*dm), GFP_KERNEL); if (!dm) return -ENOMEM; dm->mode = GS_CAN_MODE_RESET; rc = usb_control_msg(interface_to_usbdev(intf), usb_sndctrlpipe(interface_to_usbdev(intf), 0), GS_USB_BREQ_MODE, USB_DIR_OUT|USB_TYPE_VENDOR|USB_RECIP_INTERFACE, gsdev->channel, 0, dm, sizeof(*dm), 1000); return rc; } ",0 "ObjectIdSet GetSequenceOfIdsStartingAt(size_t start, size_t count) { ObjectIdSet ids; for (size_t i = start; i < start + count; ++i) ids.insert(GetIdForIndex(i)); return ids; } ",0 "vips_tracked_get_mem_highwater( void ) { size_t mx; vips_tracked_init(); g_mutex_lock( vips_tracked_mutex ); mx = vips_tracked_mem_highwater; g_mutex_unlock( vips_tracked_mutex ); return( mx ); } ",0 "alloc_clnt_odstate(struct nfs4_client *clp) { struct nfs4_clnt_odstate *co; co = kmem_cache_zalloc(odstate_slab, GFP_KERNEL); if (co) { co->co_client = clp; atomic_set(&co->co_odcount, 1); } return co; } ",0 "static int mov_read_wfex(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; int ret; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; if ((ret = ff_get_wav_header(c->fc, pb, st->codecpar, atom.size, 0)) < 0) av_log(c->fc, AV_LOG_WARNING, ""get_wav_header failed\n""); return ret; } ",0 "TEE_Result syscall_obj_generate_key(unsigned long obj, unsigned long key_size, const struct utee_attribute *usr_params, unsigned long param_count) { TEE_Result res; struct tee_ta_session *sess; const struct tee_cryp_obj_type_props *type_props; struct tee_obj *o; struct tee_cryp_obj_secret *key; size_t byte_size; TEE_Attribute *params = NULL; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; res = tee_obj_get(to_user_ta_ctx(sess->ctx), tee_svc_uref_to_vaddr(obj), &o); if (res != TEE_SUCCESS) return res; /* Must be a transient object */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_PERSISTENT) != 0) return TEE_ERROR_BAD_STATE; /* Must not be initialized already */ if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) != 0) return TEE_ERROR_BAD_STATE; /* Find description of object */ type_props = tee_svc_find_type_props(o->info.objectType); if (!type_props) return TEE_ERROR_NOT_SUPPORTED; /* Check that maxKeySize follows restrictions */ if (key_size % type_props->quanta != 0) return TEE_ERROR_NOT_SUPPORTED; if (key_size < type_props->min_size) return TEE_ERROR_NOT_SUPPORTED; if (key_size > type_props->max_size) return TEE_ERROR_NOT_SUPPORTED; params = malloc(sizeof(TEE_Attribute) * param_count); if (!params) return TEE_ERROR_OUT_OF_MEMORY; res = copy_in_attrs(to_user_ta_ctx(sess->ctx), usr_params, param_count, params); if (res != TEE_SUCCESS) goto out; res = tee_svc_cryp_check_attr(ATTR_USAGE_GENERATE_KEY, type_props, params, param_count); if (res != TEE_SUCCESS) goto out; switch (o->info.objectType) { case TEE_TYPE_AES: case TEE_TYPE_DES: case TEE_TYPE_DES3: case TEE_TYPE_HMAC_MD5: case TEE_TYPE_HMAC_SHA1: case TEE_TYPE_HMAC_SHA224: case TEE_TYPE_HMAC_SHA256: case TEE_TYPE_HMAC_SHA384: case TEE_TYPE_HMAC_SHA512: case TEE_TYPE_GENERIC_SECRET: byte_size = key_size / 8; /* * We have to do it like this because the parity bits aren't * counted when telling the size of the key in bits. */ if (o->info.objectType == TEE_TYPE_DES || o->info.objectType == TEE_TYPE_DES3) { byte_size = (key_size + key_size / 7) / 8; } key = (struct tee_cryp_obj_secret *)o->attr; if (byte_size > key->alloc_size) { res = TEE_ERROR_EXCESS_DATA; goto out; } res = crypto_rng_read((void *)(key + 1), byte_size); if (res != TEE_SUCCESS) goto out; key->key_size = byte_size; /* Set bits for all known attributes for this object type */ o->have_attrs = (1 << type_props->num_type_attrs) - 1; break; case TEE_TYPE_RSA_KEYPAIR: res = tee_svc_obj_generate_key_rsa(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_DSA_KEYPAIR: res = tee_svc_obj_generate_key_dsa(o, type_props, key_size); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_DH_KEYPAIR: res = tee_svc_obj_generate_key_dh(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; case TEE_TYPE_ECDSA_KEYPAIR: case TEE_TYPE_ECDH_KEYPAIR: res = tee_svc_obj_generate_key_ecc(o, type_props, key_size, params, param_count); if (res != TEE_SUCCESS) goto out; break; default: res = TEE_ERROR_BAD_FORMAT; } out: free(params); if (res == TEE_SUCCESS) { o->info.keySize = key_size; o->info.handleFlags |= TEE_HANDLE_FLAG_INITIALIZED; } return res; } ",0 "COMPS_ObjRTreeData * comps_objrtree_data_create_n(char *key, size_t keylen, COMPS_Object *data) { COMPS_ObjRTreeData * rtd; rtd = __comps_objrtree_data_create(key, keylen, data); return rtd; } ",0 "static jboolean Region_quickRejectIIII(JNIEnv* env, jobject region, jint left, jint top, jint right, jint bottom) { SkIRect ir; ir.set(left, top, right, bottom); bool result = GetSkRegion(env, region)->quickReject(ir); return boolTojboolean(result); } ",0 " void TestPlaybackRate(double playback_rate, int buffer_size_in_frames, int total_frames_requested) { int initial_bytes_enqueued = bytes_enqueued_; int initial_bytes_buffered = algorithm_.bytes_buffered(); algorithm_.SetPlaybackRate(static_cast(playback_rate)); scoped_array buffer( new uint8[buffer_size_in_frames * algorithm_.bytes_per_frame()]); if (playback_rate == 0.0) { int frames_written = algorithm_.FillBuffer(buffer.get(), buffer_size_in_frames); EXPECT_EQ(0, frames_written); return; } int frames_remaining = total_frames_requested; while (frames_remaining > 0) { int frames_requested = std::min(buffer_size_in_frames, frames_remaining); int frames_written = algorithm_.FillBuffer(buffer.get(), frames_requested); CHECK_GT(frames_written, 0); CheckFakeData(buffer.get(), frames_written, playback_rate); frames_remaining -= frames_written; } int bytes_requested = total_frames_requested * algorithm_.bytes_per_frame(); int bytes_consumed = ComputeConsumedBytes(initial_bytes_enqueued, initial_bytes_buffered); if (playback_rate == 1.0) { EXPECT_EQ(bytes_requested, bytes_consumed); return; } static const double kMaxAcceptableDelta = 0.01; double actual_playback_rate = 1.0 * bytes_consumed / bytes_requested; double delta = std::abs(1.0 - (actual_playback_rate / playback_rate)); EXPECT_LE(delta, kMaxAcceptableDelta); } ",1 "static void __net_exit ip_rt_do_proc_exit(struct net *net) { remove_proc_entry(""rt_cache"", net->proc_net_stat); remove_proc_entry(""rt_cache"", net->proc_net); #ifdef CONFIG_IP_ROUTE_CLASSID remove_proc_entry(""rt_acct"", net->proc_net); #endif } ",0 "static int proc_root_link(struct dentry *dentry, struct path *path) { struct task_struct *task = get_proc_task(d_inode(dentry)); int result = -ENOENT; if (task) { result = get_task_root(task, path); put_task_struct(task); } return result; } ",0 "static ssize_t ucma_join_multicast(struct ucma_file *file, const char __user *inbuf, int in_len, int out_len) { struct rdma_ucm_join_mcast cmd; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; if (!rdma_addr_size_kss(&cmd.addr)) return -EINVAL; return ucma_process_join(file, &cmd, out_len); } ",0 "bson_iter_key_len (const bson_iter_t *iter) { /* * f i e l d n a m e \0 _ * ^ ^ * | | * iter->key iter->d1 * */ BSON_ASSERT (iter->d1 > iter->key); return iter->d1 - iter->key - 1; } ",0 "static unsigned int perf_poll(struct file *file, poll_table *wait) { struct perf_event *event = file->private_data; struct ring_buffer *rb; unsigned int events = POLL_HUP; /* * Race between perf_event_set_output() and perf_poll(): perf_poll() * grabs the rb reference but perf_event_set_output() overrides it. * Here is the timeline for two threads T1, T2: * t0: T1, rb = rcu_dereference(event->rb) * t1: T2, old_rb = event->rb * t2: T2, event->rb = new rb * t3: T2, ring_buffer_detach(old_rb) * t4: T1, ring_buffer_attach(rb1) * t5: T1, poll_wait(event->waitq) * * To avoid this problem, we grab mmap_mutex in perf_poll() * thereby ensuring that the assignment of the new ring buffer * and the detachment of the old buffer appear atomic to perf_poll() */ mutex_lock(&event->mmap_mutex); rcu_read_lock(); rb = rcu_dereference(event->rb); if (rb) { ring_buffer_attach(event, rb); events = atomic_xchg(&rb->poll, 0); } rcu_read_unlock(); mutex_unlock(&event->mmap_mutex); poll_wait(file, &event->waitq, wait); return events; } ",0 "bool GLES2DecoderImpl::DoIsBuffer(GLuint client_id) { const BufferManager::BufferInfo* info = GetBufferInfo(client_id); return info && info->IsValid(); } ",0 "void InotifyReader::OnInotifyEvent(const inotify_event* event) { if (event->mask & IN_IGNORED) return; FilePath::StringType child(event->len ? event->name : FILE_PATH_LITERAL("""")); base::AutoLock auto_lock(lock_); for (WatcherSet::iterator watcher = watchers_[event->wd].begin(); watcher != watchers_[event->wd].end(); ++watcher) { (*watcher)->OnFilePathChanged(event->wd, child, event->mask & (IN_CREATE | IN_MOVED_TO), event->mask & IN_ISDIR); } } ",0 "cifs_prune_tlinks(struct work_struct *work) { struct cifs_sb_info *cifs_sb = container_of(work, struct cifs_sb_info, prune_tlinks.work); struct rb_root *root = &cifs_sb->tlink_tree; struct rb_node *node = rb_first(root); struct rb_node *tmp; struct tcon_link *tlink; /* * Because we drop the spinlock in the loop in order to put the tlink * it's not guarded against removal of links from the tree. The only * places that remove entries from the tree are this function and * umounts. Because this function is non-reentrant and is canceled * before umount can proceed, this is safe. */ spin_lock(&cifs_sb->tlink_tree_lock); node = rb_first(root); while (node != NULL) { tmp = node; node = rb_next(tmp); tlink = rb_entry(tmp, struct tcon_link, tl_rbnode); if (test_bit(TCON_LINK_MASTER, &tlink->tl_flags) || atomic_read(&tlink->tl_count) != 0 || time_after(tlink->tl_time + TLINK_IDLE_EXPIRE, jiffies)) continue; cifs_get_tlink(tlink); clear_bit(TCON_LINK_IN_TREE, &tlink->tl_flags); rb_erase(tmp, root); spin_unlock(&cifs_sb->tlink_tree_lock); cifs_put_tlink(tlink); spin_lock(&cifs_sb->tlink_tree_lock); } spin_unlock(&cifs_sb->tlink_tree_lock); queue_delayed_work(cifsiod_wq, &cifs_sb->prune_tlinks, TLINK_IDLE_EXPIRE); } ",0 "error::Error GLES2DecoderImpl::HandleQueryCounterEXT( uint32_t immediate_data_size, const volatile void* cmd_data) { const volatile gles2::cmds::QueryCounterEXT& c = *static_cast(cmd_data); GLuint client_id = static_cast(c.id); GLenum target = static_cast(c.target); int32_t sync_shm_id = static_cast(c.sync_data_shm_id); uint32_t sync_shm_offset = static_cast(c.sync_data_shm_offset); uint32_t submit_count = static_cast(c.submit_count); switch (target) { case GL_TIMESTAMP: if (!query_manager_->GPUTimingAvailable()) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glQueryCounterEXT"", ""not enabled for timing queries""); return error::kNoError; } break; default: LOCAL_SET_GL_ERROR( GL_INVALID_ENUM, ""glQueryCounterEXT"", ""unknown query target""); return error::kNoError; } scoped_refptr buffer = GetSharedMemoryBuffer(sync_shm_id); if (!buffer) return error::kInvalidArguments; QuerySync* sync = static_cast( buffer->GetDataAddress(sync_shm_offset, sizeof(QuerySync))); if (!sync) return error::kOutOfBounds; QueryManager::Query* query = query_manager_->GetQuery(client_id); if (!query) { if (!query_manager_->IsValidQuery(client_id)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glQueryCounterEXT"", ""id not made by glGenQueriesEXT""); return error::kNoError; } query = query_manager_->CreateQuery(target, client_id, std::move(buffer), sync); } else { if (query->target() != target) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glQueryCounterEXT"", ""target does not match""); return error::kNoError; } else if (query->sync() != sync) { DLOG(ERROR) << ""Shared memory used by query not the same as before""; return error::kInvalidArguments; } } query_manager_->QueryCounter(query, submit_count); return error::kNoError; } ",0 "static struct node* lookup_node_and_path_by_id_locked(struct fuse* fuse, __u64 nid, char* buf, size_t bufsize) { struct node* node = lookup_node_by_id_locked(fuse, nid); if (node && get_node_path_locked(node, buf, bufsize) < 0) { node = NULL; } return node; } ",0 "InputDispatcher::EventEntry::EventEntry(int32_t type, nsecs_t eventTime, uint32_t policyFlags) : refCount(1), type(type), eventTime(eventTime), policyFlags(policyFlags), injectionState(NULL), dispatchInProgress(false) { } ",0 " bool ReadDirectoryAndCompare(const FilePath& file_path, GDataDirectory* directory) { file_system_->ReadDirectoryByPathAsync( file_path, base::Bind(&CallbackHelper::ReadDirectoryCallback, callback_helper_.get())); message_loop_.RunAllPending(); if (directory == NULL) { return (callback_helper_->last_error_ == base::PLATFORM_FILE_ERROR_NOT_FOUND && callback_helper_->directory_proto_ == NULL); } if (callback_helper_->last_error_ != base::PLATFORM_FILE_OK) return false; scoped_ptr directory_proto = callback_helper_->directory_proto_.Pass(); return (directory->resource_id() == directory_proto->gdata_entry().resource_id()); } ",0 "void on_l2cap_psm_assigned(int id, int psm) { l2cap_socket *sock; /* Setup ETM settings: * mtu will be set below */ pthread_mutex_lock(&state_lock); sock = btsock_l2cap_find_by_id_l(id); sock->channel = psm; if(btSock_start_l2cap_server_l(sock) != BT_STATUS_SUCCESS) { btsock_l2cap_free_l(sock); } pthread_mutex_unlock(&state_lock); } ",0 "skip_space(struct table *t, char *line, struct table_linfo *linfo, int checkminimum) { int skip = 0, s = linfo->prev_spaces; Lineprop ctype, prev_ctype = linfo->prev_ctype; Str prevchar = linfo->prevchar; int w = linfo->length; int min = 1; if (*line == '<' && line[strlen(line) - 1] == '>') { if (checkminimum) check_minimum0(t, visible_length(line)); return 0; } while (*line) { char *save = line, *c = line; int ec, len, wlen, plen; ctype = get_mctype(line); len = get_mcwidth(line); wlen = plen = get_mclen(line); if (min < w) min = w; if (ctype == PC_ASCII && IS_SPACE(*c)) { w = 0; s++; } else { if (*c == '&') { ec = getescapechar(&line); if (ec >= 0) { c = conv_entity(ec); ctype = get_mctype(c); len = get_strwidth(c); wlen = line - save; plen = get_mclen(c); } } if (prevchar->length && is_boundary((unsigned char *)prevchar->ptr, (unsigned char *)c)) { w = len; } else { w += len; } if (s > 0) { #ifdef USE_M17N if (ctype == PC_KANJI1 && prev_ctype == PC_KANJI1) skip += s; else #endif skip += s - 1; } s = 0; prev_ctype = ctype; } set_prevchar(prevchar, c, plen); line = save + wlen; } if (s > 1) { skip += s - 1; linfo->prev_spaces = 1; } else { linfo->prev_spaces = s; } linfo->prev_ctype = prev_ctype; linfo->prevchar = prevchar; if (checkminimum) { if (min < w) min = w; linfo->length = w; check_minimum0(t, min); } return skip; } ",0 "static void ipa_draw_arc(wmfAPI * API, wmfDrawArc_t * draw_arc) { util_draw_arc(API, draw_arc, magick_arc_open); } ",0 "static int brcmf_cfg80211_stop_ap(struct wiphy *wiphy, struct net_device *ndev) { struct brcmf_if *ifp = netdev_priv(ndev); s32 err; struct brcmf_fil_bss_enable_le bss_enable; struct brcmf_join_params join_params; brcmf_dbg(TRACE, ""Enter\n""); if (ifp->vif->wdev.iftype == NL80211_IFTYPE_AP) { /* Due to most likely deauths outstanding we sleep */ /* first to make sure they get processed by fw. */ msleep(400); if (ifp->vif->mbss) { err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); return err; } /* First BSS doesn't get a full reset */ if (ifp->bsscfgidx == 0) brcmf_fil_iovar_int_set(ifp, ""closednet"", 0); memset(&join_params, 0, sizeof(join_params)); err = brcmf_fil_cmd_data_set(ifp, BRCMF_C_SET_SSID, &join_params, sizeof(join_params)); if (err < 0) brcmf_err(""SET SSID error (%d)\n"", err); err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_DOWN, 1); if (err < 0) brcmf_err(""BRCMF_C_DOWN error %d\n"", err); err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_AP, 0); if (err < 0) brcmf_err(""setting AP mode failed %d\n"", err); if (brcmf_feat_is_enabled(ifp, BRCMF_FEAT_MBSS)) brcmf_fil_iovar_int_set(ifp, ""mbss"", 0); brcmf_fil_cmd_int_set(ifp, BRCMF_C_SET_REGULATORY, ifp->vif->is_11d); /* Bring device back up so it can be used again */ err = brcmf_fil_cmd_int_set(ifp, BRCMF_C_UP, 1); if (err < 0) brcmf_err(""BRCMF_C_UP error %d\n"", err); brcmf_vif_clear_mgmt_ies(ifp->vif); } else { bss_enable.bsscfgidx = cpu_to_le32(ifp->bsscfgidx); bss_enable.enable = cpu_to_le32(0); err = brcmf_fil_iovar_data_set(ifp, ""bss"", &bss_enable, sizeof(bss_enable)); if (err < 0) brcmf_err(""bss_enable config failed %d\n"", err); } brcmf_set_mpc(ifp, 1); brcmf_configure_arp_nd_offload(ifp, true); clear_bit(BRCMF_VIF_STATUS_AP_CREATED, &ifp->vif->sme_state); brcmf_net_setcarrier(ifp, false); return err; } ",0 "xmlParseEncName(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = 10; xmlChar cur; cur = CUR; if (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z'))) { buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } buf[len++] = cur; NEXT; cur = CUR; while (((cur >= 'a') && (cur <= 'z')) || ((cur >= 'A') && (cur <= 'Z')) || ((cur >= '0') && (cur <= '9')) || (cur == '.') || (cur == '_') || (cur == '-')) { if (len + 1 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlErrMemory(ctxt, NULL); xmlFree(buf); return(NULL); } buf = tmp; } buf[len++] = cur; NEXT; cur = CUR; if (cur == 0) { SHRINK; GROW; cur = CUR; } } buf[len] = 0; } else { xmlFatalErr(ctxt, XML_ERR_ENCODING_NAME, NULL); } return(buf); } ",0 "const Extension* ExtensionService::GetExtensionById( const std::string& id, bool include_disabled) const { return GetExtensionByIdInternal(id, true, include_disabled, false); } ",0 "xmlParseElementChildrenContentDeclPriv(xmlParserCtxtPtr ctxt, int inputchk, int depth) { xmlElementContentPtr ret = NULL, cur = NULL, last = NULL, op = NULL; const xmlChar *elem; xmlChar type = 0; if (((depth > 128) && ((ctxt->options & XML_PARSE_HUGE) == 0)) || (depth > 2048)) { xmlFatalErrMsgInt(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED, ""xmlParseElementChildrenContentDecl : depth %d too deep, use XML_PARSE_HUGE\n"", depth); return(NULL); } SKIP_BLANKS; GROW; if (RAW == '(') { int inputid = ctxt->input->id; /* Recurse on first child */ NEXT; SKIP_BLANKS; cur = ret = xmlParseElementChildrenContentDeclPriv(ctxt, inputid, depth + 1); SKIP_BLANKS; GROW; } else { elem = xmlParseName(ctxt); if (elem == NULL) { xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, NULL); return(NULL); } cur = ret = xmlNewDocElementContent(ctxt->myDoc, elem, XML_ELEMENT_CONTENT_ELEMENT); if (cur == NULL) { xmlErrMemory(ctxt, NULL); return(NULL); } GROW; if (RAW == '?') { cur->ocur = XML_ELEMENT_CONTENT_OPT; NEXT; } else if (RAW == '*') { cur->ocur = XML_ELEMENT_CONTENT_MULT; NEXT; } else if (RAW == '+') { cur->ocur = XML_ELEMENT_CONTENT_PLUS; NEXT; } else { cur->ocur = XML_ELEMENT_CONTENT_ONCE; } GROW; } SKIP_BLANKS; SHRINK; while ((RAW != ')') && (ctxt->instate != XML_PARSER_EOF)) { /* * Each loop we parse one separator and one element. */ if (RAW == ',') { if (type == 0) type = CUR; /* * Detect ""Name | Name , Name"" error */ else if (type != CUR) { xmlFatalErrMsgInt(ctxt, XML_ERR_SEPARATOR_REQUIRED, ""xmlParseElementChildrenContentDecl : '%c' expected\n"", type); if ((last != NULL) && (last != ret)) xmlFreeDocElementContent(ctxt->myDoc, last); if (ret != NULL) xmlFreeDocElementContent(ctxt->myDoc, ret); return(NULL); } NEXT; op = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_SEQ); if (op == NULL) { if ((last != NULL) && (last != ret)) xmlFreeDocElementContent(ctxt->myDoc, last); xmlFreeDocElementContent(ctxt->myDoc, ret); return(NULL); } if (last == NULL) { op->c1 = ret; if (ret != NULL) ret->parent = op; ret = cur = op; } else { cur->c2 = op; if (op != NULL) op->parent = cur; op->c1 = last; if (last != NULL) last->parent = op; cur =op; last = NULL; } } else if (RAW == '|') { if (type == 0) type = CUR; /* * Detect ""Name , Name | Name"" error */ else if (type != CUR) { xmlFatalErrMsgInt(ctxt, XML_ERR_SEPARATOR_REQUIRED, ""xmlParseElementChildrenContentDecl : '%c' expected\n"", type); if ((last != NULL) && (last != ret)) xmlFreeDocElementContent(ctxt->myDoc, last); if (ret != NULL) xmlFreeDocElementContent(ctxt->myDoc, ret); return(NULL); } NEXT; op = xmlNewDocElementContent(ctxt->myDoc, NULL, XML_ELEMENT_CONTENT_OR); if (op == NULL) { if ((last != NULL) && (last != ret)) xmlFreeDocElementContent(ctxt->myDoc, last); if (ret != NULL) xmlFreeDocElementContent(ctxt->myDoc, ret); return(NULL); } if (last == NULL) { op->c1 = ret; if (ret != NULL) ret->parent = op; ret = cur = op; } else { cur->c2 = op; if (op != NULL) op->parent = cur; op->c1 = last; if (last != NULL) last->parent = op; cur =op; last = NULL; } } else { xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_FINISHED, NULL); if ((last != NULL) && (last != ret)) xmlFreeDocElementContent(ctxt->myDoc, last); if (ret != NULL) xmlFreeDocElementContent(ctxt->myDoc, ret); return(NULL); } GROW; SKIP_BLANKS; GROW; if (RAW == '(') { int inputid = ctxt->input->id; /* Recurse on second child */ NEXT; SKIP_BLANKS; last = xmlParseElementChildrenContentDeclPriv(ctxt, inputid, depth + 1); SKIP_BLANKS; } else { elem = xmlParseName(ctxt); if (elem == NULL) { xmlFatalErr(ctxt, XML_ERR_ELEMCONTENT_NOT_STARTED, NULL); if (ret != NULL) xmlFreeDocElementContent(ctxt->myDoc, ret); return(NULL); } last = xmlNewDocElementContent(ctxt->myDoc, elem, XML_ELEMENT_CONTENT_ELEMENT); if (last == NULL) { if (ret != NULL) xmlFreeDocElementContent(ctxt->myDoc, ret); return(NULL); } if (RAW == '?') { last->ocur = XML_ELEMENT_CONTENT_OPT; NEXT; } else if (RAW == '*') { last->ocur = XML_ELEMENT_CONTENT_MULT; NEXT; } else if (RAW == '+') { last->ocur = XML_ELEMENT_CONTENT_PLUS; NEXT; } else { last->ocur = XML_ELEMENT_CONTENT_ONCE; } } SKIP_BLANKS; GROW; } if ((cur != NULL) && (last != NULL)) { cur->c2 = last; if (last != NULL) last->parent = cur; } if (ctxt->input->id != inputchk) { xmlFatalErrMsg(ctxt, XML_ERR_ENTITY_BOUNDARY, ""Element content declaration doesn't start and stop in"" "" the same entity\n""); } NEXT; if (RAW == '?') { if (ret != NULL) { if ((ret->ocur == XML_ELEMENT_CONTENT_PLUS) || (ret->ocur == XML_ELEMENT_CONTENT_MULT)) ret->ocur = XML_ELEMENT_CONTENT_MULT; else ret->ocur = XML_ELEMENT_CONTENT_OPT; } NEXT; } else if (RAW == '*') { if (ret != NULL) { ret->ocur = XML_ELEMENT_CONTENT_MULT; cur = ret; /* * Some normalization: * (a | b* | c?)* == (a | b | c)* */ while ((cur != NULL) && (cur->type == XML_ELEMENT_CONTENT_OR)) { if ((cur->c1 != NULL) && ((cur->c1->ocur == XML_ELEMENT_CONTENT_OPT) || (cur->c1->ocur == XML_ELEMENT_CONTENT_MULT))) cur->c1->ocur = XML_ELEMENT_CONTENT_ONCE; if ((cur->c2 != NULL) && ((cur->c2->ocur == XML_ELEMENT_CONTENT_OPT) || (cur->c2->ocur == XML_ELEMENT_CONTENT_MULT))) cur->c2->ocur = XML_ELEMENT_CONTENT_ONCE; cur = cur->c2; } } NEXT; } else if (RAW == '+') { if (ret != NULL) { int found = 0; if ((ret->ocur == XML_ELEMENT_CONTENT_OPT) || (ret->ocur == XML_ELEMENT_CONTENT_MULT)) ret->ocur = XML_ELEMENT_CONTENT_MULT; else ret->ocur = XML_ELEMENT_CONTENT_PLUS; /* * Some normalization: * (a | b*)+ == (a | b)* * (a | b?)+ == (a | b)* */ while ((cur != NULL) && (cur->type == XML_ELEMENT_CONTENT_OR)) { if ((cur->c1 != NULL) && ((cur->c1->ocur == XML_ELEMENT_CONTENT_OPT) || (cur->c1->ocur == XML_ELEMENT_CONTENT_MULT))) { cur->c1->ocur = XML_ELEMENT_CONTENT_ONCE; found = 1; } if ((cur->c2 != NULL) && ((cur->c2->ocur == XML_ELEMENT_CONTENT_OPT) || (cur->c2->ocur == XML_ELEMENT_CONTENT_MULT))) { cur->c2->ocur = XML_ELEMENT_CONTENT_ONCE; found = 1; } cur = cur->c2; } if (found) ret->ocur = XML_ELEMENT_CONTENT_MULT; } NEXT; } return(ret); } ",0 "MagickExport MagickBooleanType StripImage(Image *image,ExceptionInfo *exception) { MagickBooleanType status; assert(image != (Image *) NULL); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); (void) exception; DestroyImageProfiles(image); (void) DeleteImageProperty(image,""comment""); (void) DeleteImageProperty(image,""date:create""); (void) DeleteImageProperty(image,""date:modify""); status=SetImageArtifact(image,""png:exclude-chunk"", ""bKGD,cHRM,EXIF,gAMA,iCCP,iTXt,sRGB,tEXt,zCCP,zTXt,date""); return(status); } ",0 "static void *proc_pid_follow_link(struct dentry *dentry, struct nameidata *nd) { struct inode *inode = dentry->d_inode; int error = -EACCES; /* We don't need a base pointer in the /proc filesystem */ path_put(&nd->path); /* Are we allowed to snoop on the tasks file descriptors? */ if (!proc_fd_access_allowed(inode)) goto out; error = PROC_I(inode)->op.proc_get_link(inode, &nd->path); out: return ERR_PTR(error); } ",0 "StatusBubble* BrowserWindowGtk::GetStatusBubble() { return status_bubble_.get(); } ",0 "static int ioctl_fiemap(struct file *filp, unsigned long arg) { struct fiemap fiemap; struct fiemap __user *ufiemap = (struct fiemap __user *) arg; struct fiemap_extent_info fieinfo = { 0, }; struct inode *inode = file_inode(filp); struct super_block *sb = inode->i_sb; u64 len; int error; if (!inode->i_op->fiemap) return -EOPNOTSUPP; if (copy_from_user(&fiemap, ufiemap, sizeof(fiemap))) return -EFAULT; if (fiemap.fm_extent_count > FIEMAP_MAX_EXTENTS) return -EINVAL; error = fiemap_check_ranges(sb, fiemap.fm_start, fiemap.fm_length, &len); if (error) return error; fieinfo.fi_flags = fiemap.fm_flags; fieinfo.fi_extents_max = fiemap.fm_extent_count; fieinfo.fi_extents_start = ufiemap->fm_extents; if (fiemap.fm_extent_count != 0 && !access_ok(VERIFY_WRITE, fieinfo.fi_extents_start, fieinfo.fi_extents_max * sizeof(struct fiemap_extent))) return -EFAULT; if (fieinfo.fi_flags & FIEMAP_FLAG_SYNC) filemap_write_and_wait(inode->i_mapping); error = inode->i_op->fiemap(inode, &fieinfo, fiemap.fm_start, len); fiemap.fm_flags = fieinfo.fi_flags; fiemap.fm_mapped_extents = fieinfo.fi_extents_mapped; if (copy_to_user(ufiemap, &fiemap, sizeof(fiemap))) error = -EFAULT; return error; } ",0 "http_EstimateWS(const struct http *fm, unsigned how, uint16_t *nhd) { unsigned u, l; l = 0; *nhd = HTTP_HDR_FIRST; CHECK_OBJ_NOTNULL(fm, HTTP_MAGIC); for (u = 0; u < fm->nhd; u++) { if (fm->hd[u].b == NULL) continue; if (fm->hdf[u] & HDF_FILTER) continue; #define HTTPH(a, b, c, d, e, f, g) \ if (((e) & how) && http_IsHdr(&fm->hd[u], (b))) \ continue; #include ""http_headers.h"" #undef HTTPH l += PRNDUP(Tlen(fm->hd[u]) + 1); (*nhd)++; } return (l); } ",0 "void GpuVideoDecodeAccelerator::Initialize( const media::VideoCodecProfile profile, IPC::Message* init_done_msg) { DCHECK(!video_decode_accelerator_.get()); DCHECK(!init_done_msg_); DCHECK(init_done_msg); init_done_msg_ = init_done_msg; if (!stub_) return; #if !defined(OS_WIN) if (!make_context_current_.Run()) { NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); return; } #endif #if defined(OS_WIN) if (base::win::GetVersion() < base::win::VERSION_WIN7) { NOTIMPLEMENTED() << ""HW video decode acceleration not available.""; NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); return; } DLOG(INFO) << ""Initializing DXVA HW decoder for windows.""; video_decode_accelerator_.reset(new DXVAVideoDecodeAccelerator( this, make_context_current_)); #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) video_decode_accelerator_.reset(new OmxVideoDecodeAccelerator( gfx::GLSurfaceEGL::GetHardwareDisplay(), stub_->decoder()->GetGLContext()->GetHandle(), this, make_context_current_)); #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) gfx::GLContextGLX* glx_context = static_cast(stub_->decoder()->GetGLContext()); GLXContext glx_context_handle = static_cast(glx_context->GetHandle()); video_decode_accelerator_.reset(new VaapiVideoDecodeAccelerator( glx_context->display(), glx_context_handle, this, make_context_current_)); #elif defined(OS_MACOSX) video_decode_accelerator_.reset(new MacVideoDecodeAccelerator( static_cast( stub_->decoder()->GetGLContext()->GetHandle()), this)); #else NOTIMPLEMENTED() << ""HW video decode acceleration not available.""; NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); return; #endif if (!video_decode_accelerator_->Initialize(profile)) NotifyError(media::VideoDecodeAccelerator::PLATFORM_FAILURE); } ",0 "static bool link_master_filtered(struct net_device *dev, int master_idx) { struct net_device *master; if (!master_idx) return false; master = netdev_master_upper_dev_get(dev); if (!master || master->ifindex != master_idx) return true; return false; } ",0 "static void cleanup_timers(struct list_head *head, cputime_t utime, cputime_t stime, unsigned long long sum_exec_runtime) { struct cpu_timer_list *timer, *next; cputime_t ptime = cputime_add(utime, stime); list_for_each_entry_safe(timer, next, head, entry) { list_del_init(&timer->entry); if (cputime_lt(timer->expires.cpu, ptime)) { timer->expires.cpu = cputime_zero; } else { timer->expires.cpu = cputime_sub(timer->expires.cpu, ptime); } } ++head; list_for_each_entry_safe(timer, next, head, entry) { list_del_init(&timer->entry); if (cputime_lt(timer->expires.cpu, utime)) { timer->expires.cpu = cputime_zero; } else { timer->expires.cpu = cputime_sub(timer->expires.cpu, utime); } } ++head; list_for_each_entry_safe(timer, next, head, entry) { list_del_init(&timer->entry); if (timer->expires.sched < sum_exec_runtime) { timer->expires.sched = 0; } else { timer->expires.sched -= sum_exec_runtime; } } } ",0 "void TabStripModel::AddObserver(TabStripModelObserver* observer) { observers_.AddObserver(observer); } ",0 "int kvm_unmap_hva_range(struct kvm *kvm, unsigned long start, unsigned long end) { return kvm_handle_hva_range(kvm, start, end, 0, kvm_unmap_rmapp); } ",0 "seamless_send(const char *command, const char *format, ...) { STREAM s; size_t len; va_list argp; char *escaped, buf[1025]; len = snprintf(buf, sizeof(buf) - 1, ""%s,%u,"", command, seamless_serial); assert(len < (sizeof(buf) - 1)); va_start(argp, format); len += vsnprintf(buf + len, sizeof(buf) - len - 1, format, argp); va_end(argp); assert(len < (sizeof(buf) - 1)); escaped = utils_string_escape(buf); len = snprintf(buf, sizeof(buf), ""%s"", escaped); free(escaped); assert(len < (sizeof(buf) - 1)); buf[len] = '\n'; buf[len + 1] = '\0'; len++; s = channel_init(seamless_channel, len); out_uint8p(s, buf, len) s_mark_end(s); logger(Core, Debug, ""seamless_send(), sending '%s'"", buf); channel_send(s, seamless_channel); return seamless_serial++; } ",0 "krb5_gss_verify_mic(minor_status, context_handle, message_buffer, token_buffer, qop_state) OM_uint32 *minor_status; gss_ctx_id_t context_handle; gss_buffer_t message_buffer; gss_buffer_t token_buffer; gss_qop_t *qop_state; { OM_uint32 rstat; rstat = kg_unseal(minor_status, context_handle, token_buffer, message_buffer, NULL, qop_state, KG_TOK_MIC_MSG); return(rstat); } ",0 "int udf_write_inode(struct inode *inode, struct writeback_control *wbc) { return udf_update_inode(inode, wbc->sync_mode == WB_SYNC_ALL); } ",0 "monitor_allowed_key(u_char *blob, u_int bloblen) { /* make sure key is allowed */ if (key_blob == NULL || key_bloblen != bloblen || timingsafe_bcmp(key_blob, blob, key_bloblen)) return (0); return (1); } ",0 "bool HTMLInputElement::LayoutObjectIsNeeded(const ComputedStyle& style) { return input_type_->LayoutObjectIsNeeded() && TextControlElement::LayoutObjectIsNeeded(style); } ",0 "static jboolean android_net_wifi_setScanningMacOui(JNIEnv *env, jclass cls, jint iface, jbyteArray param) { JNIHelper helper(env); wifi_interface_handle handle = getIfaceHandle(helper, cls, iface); ALOGD(""setting scan oui %p"", handle); static const unsigned oui_len = 3; /* OUI is upper 3 bytes of mac_address */ int len = helper.getArrayLength(param); if (len != oui_len) { ALOGE(""invalid oui length %d"", len); return false; } ScopedBytesRO paramBytes(env, param); const jbyte* bytes = paramBytes.get(); if (bytes == NULL) { ALOGE(""failed to get array""); return false; } return hal_fn.wifi_set_scanning_mac_oui(handle, (byte *)bytes) == WIFI_SUCCESS; } ",0 "void icmpv6_cleanup(void) { inet6_unregister_icmp_sender(icmp6_send); unregister_pernet_subsys(&icmpv6_sk_ops); inet6_del_protocol(&icmpv6_protocol, IPPROTO_ICMPV6); } ",0 "int udf_build_ustr(struct ustr *dest, dstring *ptr, int size) { int usesize; if (!dest || !ptr || !size) return -1; BUG_ON(size < 2); usesize = min_t(size_t, ptr[size - 1], sizeof(dest->u_name)); usesize = min(usesize, size - 2); dest->u_cmpID = ptr[0]; dest->u_len = usesize; memcpy(dest->u_name, ptr + 1, usesize); memset(dest->u_name + usesize, 0, sizeof(dest->u_name) - usesize); return 0; } ",0 "void SynchronousCompositorExternalBeginFrameSource::BeginFrame( const cc::BeginFrameArgs& args) { DCHECK(CalledOnValidThread()); CallOnBeginFrame(args); } ",0 "void RilSapSocket::sendDisconnect() { size_t encoded_size = 0; uint32_t written_size; size_t buffer_size = 0; pb_ostream_t ostream; bool success = false; RIL_SIM_SAP_DISCONNECT_REQ disconnectReq; if ((success = pb_get_encoded_size(&encoded_size, RIL_SIM_SAP_DISCONNECT_REQ_fields, &disconnectReq)) && encoded_size <= INT32_MAX) { buffer_size = encoded_size + sizeof(uint32_t); uint8_t buffer[buffer_size]; written_size = htonl((uint32_t) encoded_size); ostream = pb_ostream_from_buffer(buffer, buffer_size); pb_write(&ostream, (uint8_t *)&written_size, sizeof(written_size)); success = pb_encode(&ostream, RIL_SIM_SAP_DISCONNECT_REQ_fields, buffer); if(success) { pb_bytes_array_t *payload = (pb_bytes_array_t *)calloc(1, sizeof(pb_bytes_array_t) + written_size); if (!payload) { RLOGE(""sendDisconnect: OOM""); return; } memcpy(payload->bytes, buffer, written_size); payload->size = written_size; MsgHeader *hdr = (MsgHeader *)malloc(sizeof(MsgHeader)); if (!hdr) { RLOGE(""sendDisconnect: OOM""); free(payload); return; } hdr->payload = payload; hdr->type = MsgType_REQUEST; hdr->id = MsgId_RIL_SIM_SAP_DISCONNECT; hdr->error = Error_RIL_E_SUCCESS; dispatchDisconnect(hdr); } else { RLOGE(""Encode failed in send disconnect!""); } } } ",1 "static Image *ReadPICTImage(const ImageInfo *image_info, ExceptionInfo *exception) { char geometry[MaxTextExtent], header_ole[4]; Image *image; IndexPacket index; int c, code; MagickBooleanType jpeg, status; PICTRectangle frame; PICTPixmap pixmap; register IndexPacket *indexes; register ssize_t x; register PixelPacket *q; register ssize_t i; size_t extent, length; ssize_t count, flags, j, version, y; StringInfo *profile; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read PICT header. */ pixmap.bits_per_pixel=0; pixmap.component_count=0; /* Skip header : 512 for standard PICT and 4, ie ""PICT"" for OLE2 */ header_ole[0]=ReadBlobByte(image); header_ole[1]=ReadBlobByte(image); header_ole[2]=ReadBlobByte(image); header_ole[3]=ReadBlobByte(image); if (!((header_ole[0] == 0x50) && (header_ole[1] == 0x49) && (header_ole[2] == 0x43) && (header_ole[3] == 0x54))) for (i=0; i < 508; i++) if (ReadBlobByte(image) == EOF) break; (void) ReadBlobMSBShort(image); /* skip picture size */ if (ReadRectangle(image,&frame) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); while ((c=ReadBlobByte(image)) == 0) ; if (c != 0x11) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); version=ReadBlobByte(image); if (version == 2) { c=ReadBlobByte(image); if (c != 0xff) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } else if (version != 1) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if ((frame.left < 0) || (frame.right < 0) || (frame.top < 0) || (frame.bottom < 0) || (frame.left >= frame.right) || (frame.top >= frame.bottom)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); /* Create black canvas. */ flags=0; image->depth=8; image->columns=1UL*(frame.right-frame.left); image->rows=1UL*(frame.bottom-frame.top); image->x_resolution=DefaultResolution; image->y_resolution=DefaultResolution; image->units=UndefinedResolution; if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) { (void) CloseBlob(image); return(GetFirstImageInList(image)); } status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } /* Interpret PICT opcodes. */ jpeg=MagickFalse; for (code=0; EOFBlob(image) == MagickFalse; ) { if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; if ((version == 1) || ((TellBlob(image) % 2) != 0)) code=ReadBlobByte(image); if (version == 2) code=ReadBlobMSBSignedShort(image); if (code < 0) break; if (code > 0xa1) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""%04X:"",code); } else { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" %04X %s: %s"",code,codes[code].name,codes[code].description); switch (code) { case 0x01: { /* Clipping rectangle. */ length=ReadBlobMSBShort(image); if (length != 0x000a) { for (i=0; i < (ssize_t) (length-2); i++) if (ReadBlobByte(image) == EOF) break; break; } if (ReadRectangle(image,&frame) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (((frame.left & 0x8000) != 0) || ((frame.top & 0x8000) != 0)) break; image->columns=1UL*(frame.right-frame.left); image->rows=1UL*(frame.bottom-frame.top); status=SetImageExtent(image,image->columns,image->rows); if (status == MagickFalse) { InheritException(exception,&image->exception); return(DestroyImageList(image)); } (void) SetImageBackgroundColor(image); break; } case 0x12: case 0x13: case 0x14: { ssize_t pattern; size_t height, width; /* Skip pattern definition. */ pattern=1L*ReadBlobMSBShort(image); for (i=0; i < 8; i++) if (ReadBlobByte(image) == EOF) break; if (pattern == 2) { for (i=0; i < 5; i++) if (ReadBlobByte(image) == EOF) break; break; } if (pattern != 1) ThrowReaderException(CorruptImageError,""UnknownPatternType""); length=ReadBlobMSBShort(image); if (ReadRectangle(image,&frame) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); ReadPixmap(pixmap); image->depth=1UL*pixmap.component_size; image->x_resolution=1.0*pixmap.horizontal_resolution; image->y_resolution=1.0*pixmap.vertical_resolution; image->units=PixelsPerInchResolution; (void) ReadBlobMSBLong(image); flags=1L*ReadBlobMSBShort(image); length=ReadBlobMSBShort(image); for (i=0; i <= (ssize_t) length; i++) (void) ReadBlobMSBLong(image); width=1UL*(frame.bottom-frame.top); height=1UL*(frame.right-frame.left); if (pixmap.bits_per_pixel <= 8) length&=0x7fff; if (pixmap.bits_per_pixel == 16) width<<=1; if (length == 0) length=width; if (length < 8) { for (i=0; i < (ssize_t) (length*height); i++) if (ReadBlobByte(image) == EOF) break; } else for (j=0; j < (int) height; j++) if (length > 200) { for (j=0; j < (ssize_t) ReadBlobMSBShort(image); j++) if (ReadBlobByte(image) == EOF) break; } else for (j=0; j < (ssize_t) ReadBlobByte(image); j++) if (ReadBlobByte(image) == EOF) break; break; } case 0x1b: { /* Initialize image background color. */ image->background_color.red=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); image->background_color.green=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); image->background_color.blue=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); break; } case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: { /* Skip polygon or region. */ length=ReadBlobMSBShort(image); for (i=0; i < (ssize_t) (length-2); i++) if (ReadBlobByte(image) == EOF) break; break; } case 0x90: case 0x91: case 0x98: case 0x99: case 0x9a: case 0x9b: { ssize_t bytes_per_line; PICTRectangle source, destination; register unsigned char *p; size_t j; unsigned char *pixels; Image *tile_image; /* Pixmap clipped by a rectangle. */ bytes_per_line=0; if ((code != 0x9a) && (code != 0x9b)) bytes_per_line=1L*ReadBlobMSBShort(image); else { (void) ReadBlobMSBShort(image); (void) ReadBlobMSBShort(image); (void) ReadBlobMSBShort(image); } if (ReadRectangle(image,&frame) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); /* Initialize tile image. */ tile_image=CloneImage(image,1UL*(frame.right-frame.left), 1UL*(frame.bottom-frame.top),MagickTrue,exception); if (tile_image == (Image *) NULL) return((Image *) NULL); if ((code == 0x9a) || (code == 0x9b) || ((bytes_per_line & 0x8000) != 0)) { ReadPixmap(pixmap); tile_image->depth=1UL*pixmap.component_size; tile_image->matte=pixmap.component_count == 4 ? MagickTrue : MagickFalse; tile_image->x_resolution=(double) pixmap.horizontal_resolution; tile_image->y_resolution=(double) pixmap.vertical_resolution; tile_image->units=PixelsPerInchResolution; if (tile_image->matte != MagickFalse) image->matte=tile_image->matte; } if ((code != 0x9a) && (code != 0x9b)) { /* Initialize colormap. */ tile_image->colors=2; if ((bytes_per_line & 0x8000) != 0) { (void) ReadBlobMSBLong(image); flags=1L*ReadBlobMSBShort(image); tile_image->colors=1UL*ReadBlobMSBShort(image)+1; } status=AcquireImageColormap(tile_image,tile_image->colors); if (status == MagickFalse) { tile_image=DestroyImage(tile_image); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } if ((bytes_per_line & 0x8000) != 0) { for (i=0; i < (ssize_t) tile_image->colors; i++) { j=ReadBlobMSBShort(image) % tile_image->colors; if ((flags & 0x8000) != 0) j=(size_t) i; tile_image->colormap[j].red=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); tile_image->colormap[j].green=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); tile_image->colormap[j].blue=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); } } else { for (i=0; i < (ssize_t) tile_image->colors; i++) { tile_image->colormap[i].red=(Quantum) (QuantumRange- tile_image->colormap[i].red); tile_image->colormap[i].green=(Quantum) (QuantumRange- tile_image->colormap[i].green); tile_image->colormap[i].blue=(Quantum) (QuantumRange- tile_image->colormap[i].blue); } } } if (ReadRectangle(image,&source) == MagickFalse) { tile_image=DestroyImage(tile_image); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } if (ReadRectangle(image,&destination) == MagickFalse) { tile_image=DestroyImage(tile_image); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } (void) ReadBlobMSBShort(image); if ((code == 0x91) || (code == 0x99) || (code == 0x9b)) { /* Skip region. */ length=ReadBlobMSBShort(image); for (i=0; i < (ssize_t) (length-2); i++) if (ReadBlobByte(image) == EOF) break; } if ((code != 0x9a) && (code != 0x9b) && (bytes_per_line & 0x8000) == 0) pixels=DecodeImage(image,tile_image,1UL*bytes_per_line,1,&extent); else pixels=DecodeImage(image,tile_image,1UL*bytes_per_line,1U* pixmap.bits_per_pixel,&extent); if (pixels == (unsigned char *) NULL) { tile_image=DestroyImage(tile_image); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } /* Convert PICT tile image to pixel packets. */ p=pixels; for (y=0; y < (ssize_t) tile_image->rows; y++) { if (p > (pixels+extent+image->columns)) { tile_image=DestroyImage(tile_image); ThrowReaderException(CorruptImageError,""NotEnoughPixelData""); } q=QueueAuthenticPixels(tile_image,0,y,tile_image->columns,1, exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(tile_image); for (x=0; x < (ssize_t) tile_image->columns; x++) { if (tile_image->storage_class == PseudoClass) { index=ConstrainColormapIndex(tile_image,*p); SetPixelIndex(indexes+x,index); SetPixelRed(q, tile_image->colormap[(ssize_t) index].red); SetPixelGreen(q, tile_image->colormap[(ssize_t) index].green); SetPixelBlue(q, tile_image->colormap[(ssize_t) index].blue); } else { if (pixmap.bits_per_pixel == 16) { i=(*p++); j=(*p); SetPixelRed(q,ScaleCharToQuantum( (unsigned char) ((i & 0x7c) << 1))); SetPixelGreen(q,ScaleCharToQuantum( (unsigned char) (((i & 0x03) << 6) | ((j & 0xe0) >> 2)))); SetPixelBlue(q,ScaleCharToQuantum( (unsigned char) ((j & 0x1f) << 3))); } else if (tile_image->matte == MagickFalse) { if (p > (pixels+extent+2*image->columns)) { tile_image=DestroyImage(tile_image); ThrowReaderException(CorruptImageError, ""NotEnoughPixelData""); } SetPixelRed(q,ScaleCharToQuantum(*p)); SetPixelGreen(q,ScaleCharToQuantum( *(p+tile_image->columns))); SetPixelBlue(q,ScaleCharToQuantum( *(p+2*tile_image->columns))); } else { if (p > (pixels+extent+3*image->columns)) { tile_image=DestroyImage(tile_image); ThrowReaderException(CorruptImageError, ""NotEnoughPixelData""); } SetPixelAlpha(q,ScaleCharToQuantum(*p)); SetPixelRed(q,ScaleCharToQuantum( *(p+tile_image->columns))); SetPixelGreen(q,ScaleCharToQuantum( *(p+2*tile_image->columns))); SetPixelBlue(q,ScaleCharToQuantum( *(p+3*tile_image->columns))); } } p++; q++; } if (SyncAuthenticPixels(tile_image,exception) == MagickFalse) break; if ((tile_image->storage_class == DirectClass) && (pixmap.bits_per_pixel != 16)) { p+=(pixmap.component_count-1)*tile_image->columns; if (p < pixels) break; } status=SetImageProgress(image,LoadImageTag,y,tile_image->rows); if (status == MagickFalse) break; } pixels=(unsigned char *) RelinquishMagickMemory(pixels); if (jpeg == MagickFalse) if ((code == 0x9a) || (code == 0x9b) || ((bytes_per_line & 0x8000) != 0)) (void) CompositeImage(image,CopyCompositeOp,tile_image, destination.left,destination.top); tile_image=DestroyImage(tile_image); break; } case 0xa1: { unsigned char *info; size_t type; /* Comment. */ type=ReadBlobMSBShort(image); length=ReadBlobMSBShort(image); if (length == 0) break; (void) ReadBlobMSBLong(image); length-=4; if (length == 0) break; info=(unsigned char *) AcquireQuantumMemory(length,sizeof(*info)); if (info == (unsigned char *) NULL) break; count=ReadBlob(image,length,info); if (count != (ssize_t) length) ThrowReaderException(ResourceLimitError,""UnableToReadImageData""); switch (type) { case 0xe0: { profile=BlobToStringInfo((const void *) NULL,length); SetStringInfoDatum(profile,info); status=SetImageProfile(image,""icc"",profile); profile=DestroyStringInfo(profile); if (status == MagickFalse) { info=(unsigned char *) RelinquishMagickMemory(info); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } break; } case 0x1f2: { profile=BlobToStringInfo((const void *) NULL,length); SetStringInfoDatum(profile,info); status=SetImageProfile(image,""iptc"",profile); if (status == MagickFalse) { info=(unsigned char *) RelinquishMagickMemory(info); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } profile=DestroyStringInfo(profile); break; } default: break; } info=(unsigned char *) RelinquishMagickMemory(info); break; } default: { /* Skip to next op code. */ if (codes[code].length == -1) (void) ReadBlobMSBShort(image); else for (i=0; i < (ssize_t) codes[code].length; i++) if (ReadBlobByte(image) == EOF) break; } } } if (code == 0xc00) { /* Skip header. */ for (i=0; i < 24; i++) if (ReadBlobByte(image) == EOF) break; continue; } if (((code >= 0xb0) && (code <= 0xcf)) || ((code >= 0x8000) && (code <= 0x80ff))) continue; if (code == 0x8200) { FILE *file; Image *tile_image; ImageInfo *read_info; int unique_file; /* Embedded JPEG. */ jpeg=MagickTrue; read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(read_info->filename); if (unique_file != -1) file=fdopen(unique_file,""wb""); if ((unique_file == -1) || (file == (FILE *) NULL)) { (void) RelinquishUniqueFileResource(read_info->filename); (void) CopyMagickString(image->filename,read_info->filename, MaxTextExtent); ThrowFileException(exception,FileOpenError, ""UnableToCreateTemporaryFile"",image->filename); image=DestroyImageList(image); return((Image *) NULL); } length=ReadBlobMSBLong(image); if (length > 154) { for (i=0; i < 6; i++) (void) ReadBlobMSBLong(image); if (ReadRectangle(image,&frame) == MagickFalse) { (void) fclose(file); (void) RelinquishUniqueFileResource(read_info->filename); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } for (i=0; i < 122; i++) if (ReadBlobByte(image) == EOF) break; for (i=0; i < (ssize_t) (length-154); i++) { c=ReadBlobByte(image); if (c == EOF) break; (void) fputc(c,file); } } (void) fclose(file); (void) close(unique_file); tile_image=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); if (tile_image == (Image *) NULL) continue; (void) FormatLocaleString(geometry,MaxTextExtent,""%.20gx%.20g"", (double) MagickMax(image->columns,tile_image->columns), (double) MagickMax(image->rows,tile_image->rows)); (void) SetImageExtent(image, MagickMax(image->columns,tile_image->columns), MagickMax(image->rows,tile_image->rows)); (void) TransformImageColorspace(image,tile_image->colorspace); (void) CompositeImage(image,CopyCompositeOp,tile_image,frame.left, frame.right); image->compression=tile_image->compression; tile_image=DestroyImage(tile_image); continue; } if ((code == 0xff) || (code == 0xffff)) break; if (((code >= 0xd0) && (code <= 0xfe)) || ((code >= 0x8100) && (code <= 0xffff))) { /* Skip reserved. */ length=ReadBlobMSBShort(image); for (i=0; i < (ssize_t) length; i++) if (ReadBlobByte(image) == EOF) break; continue; } if ((code >= 0x100) && (code <= 0x7fff)) { /* Skip reserved. */ length=(size_t) ((code >> 7) & 0xff); for (i=0; i < (ssize_t) length; i++) if (ReadBlobByte(image) == EOF) break; continue; } } (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",0 "static ssize_t nfs_idmap_get_key(const char *name, size_t namelen, const char *type, void *data, size_t data_size, struct idmap *idmap) { const struct cred *saved_cred; struct key *rkey; struct user_key_payload *payload; ssize_t ret; saved_cred = override_creds(id_resolver_cache); rkey = nfs_idmap_request_key(name, namelen, type, idmap); revert_creds(saved_cred); if (IS_ERR(rkey)) { ret = PTR_ERR(rkey); goto out; } rcu_read_lock(); rkey->perm |= KEY_USR_VIEW; ret = key_validate(rkey); if (ret < 0) goto out_up; payload = rcu_dereference(rkey->payload.rcudata); if (IS_ERR_OR_NULL(payload)) { ret = PTR_ERR(payload); goto out_up; } ret = payload->datalen; if (ret > 0 && ret <= data_size) memcpy(data, payload->data, ret); else ret = -EINVAL; out_up: rcu_read_unlock(); key_put(rkey); out: return ret; } ",0 "static int do_sysfs_registration(void) { int rc; ecryptfs_kobj = kobject_create_and_add(""ecryptfs"", fs_kobj); if (!ecryptfs_kobj) { printk(KERN_ERR ""Unable to create ecryptfs kset\n""); rc = -ENOMEM; goto out; } rc = sysfs_create_group(ecryptfs_kobj, &attr_group); if (rc) { printk(KERN_ERR ""Unable to create ecryptfs version attributes\n""); kobject_put(ecryptfs_kobj); } out: return rc; } ",0 "void RenderWidgetHostImpl::ForwardMouseEvent(const WebMouseEvent& mouse_event) { ForwardMouseEventWithLatencyInfo(mouse_event, ui::LatencyInfo()); if (owner_delegate_) owner_delegate_->RenderWidgetDidForwardMouseEvent(mouse_event); } ",0 "void GLES2DecoderImpl::DoGetProgramiv(GLuint program_id, GLenum pname, GLint* params, GLsizei params_size) { Program* program = GetProgramInfoNotShader(program_id, ""glGetProgramiv""); if (!program) { return; } program->GetProgramiv(pname, params); } ",0 "static inline void nested_release_vmcs12(struct vcpu_vmx *vmx) { if (vmx->nested.current_vmptr == -1ull) return; /* current_vmptr and current_vmcs12 are always set/reset together */ if (WARN_ON(vmx->nested.current_vmcs12 == NULL)) return; if (enable_shadow_vmcs) { /* copy to memory all shadowed fields in case they were modified */ copy_shadow_to_vmcs12(vmx); vmx->nested.sync_shadow_vmcs = false; vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL, SECONDARY_EXEC_SHADOW_VMCS); vmcs_write64(VMCS_LINK_POINTER, -1ull); } vmx->nested.posted_intr_nv = -1; kunmap(vmx->nested.current_vmcs12_page); nested_release_page(vmx->nested.current_vmcs12_page); vmx->nested.current_vmptr = -1ull; vmx->nested.current_vmcs12 = NULL; } ",0 "static int pppol2tp_getsockopt(struct socket *sock, int level, int optname, char __user *optval, int __user *optlen) { struct sock *sk = sock->sk; struct l2tp_session *session; struct l2tp_tunnel *tunnel; int val, len; int err; struct pppol2tp_session *ps; if (level != SOL_PPPOL2TP) return udp_prot.getsockopt(sk, level, optname, optval, optlen); if (get_user(len, optlen)) return -EFAULT; len = min_t(unsigned int, len, sizeof(int)); if (len < 0) return -EINVAL; err = -ENOTCONN; if (sk->sk_user_data == NULL) goto end; /* Get the session context */ err = -EBADF; session = pppol2tp_sock_to_session(sk); if (session == NULL) goto end; /* Special case: if session_id == 0x0000, treat as operation on tunnel */ ps = l2tp_session_priv(session); if ((session->session_id == 0) && (session->peer_session_id == 0)) { err = -EBADF; tunnel = l2tp_sock_to_tunnel(ps->tunnel_sock); if (tunnel == NULL) goto end_put_sess; err = pppol2tp_tunnel_getsockopt(sk, tunnel, optname, &val); sock_put(ps->tunnel_sock); } else err = pppol2tp_session_getsockopt(sk, session, optname, &val); err = -EFAULT; if (put_user(len, optlen)) goto end_put_sess; if (copy_to_user((void __user *) optval, &val, len)) goto end_put_sess; err = 0; end_put_sess: sock_put(sk); end: return err; } ",0 "namePush(xmlParserCtxtPtr ctxt, const xmlChar * value) { if (ctxt == NULL) return (-1); if (ctxt->nameNr >= ctxt->nameMax) { const xmlChar * *tmp; tmp = (const xmlChar * *) xmlRealloc((xmlChar * *)ctxt->nameTab, ctxt->nameMax * 2 * sizeof(ctxt->nameTab[0])); if (tmp == NULL) { goto mem_error; } ctxt->nameTab = tmp; ctxt->nameMax *= 2; } ctxt->nameTab[ctxt->nameNr] = value; ctxt->name = value; return (ctxt->nameNr++); mem_error: xmlErrMemory(ctxt, NULL); return (-1); } ",0 "name_ptr(netdissect_options *ndo, const u_char *buf, int ofs, const u_char *maxbuf) { const u_char *p; u_char c; p = buf + ofs; if (p >= maxbuf) return(NULL); /* name goes past the end of the buffer */ ND_TCHECK2(*p, 1); c = *p; /* XXX - this should use the same code that the DNS dissector does */ if ((c & 0xC0) == 0xC0) { uint16_t l; ND_TCHECK2(*p, 2); if ((p + 1) >= maxbuf) return(NULL); /* name goes past the end of the buffer */ l = EXTRACT_16BITS(p) & 0x3FFF; if (l == 0) { /* We have a pointer that points to itself. */ return(NULL); } p = buf + l; if (p >= maxbuf) return(NULL); /* name goes past the end of the buffer */ ND_TCHECK2(*p, 1); } return(p); trunc: return(NULL); /* name goes past the end of the buffer */ } ",0 "_dbus_get_standard_system_servicedirs (DBusList **dirs) { *dirs = NULL; return TRUE; } ",0 "struct xt_target *xt_find_target(u8 af, const char *name, u8 revision) { struct xt_target *t; int err = -ENOENT; mutex_lock(&xt[af].mutex); list_for_each_entry(t, &xt[af].target, list) { if (strcmp(t->name, name) == 0) { if (t->revision == revision) { if (try_module_get(t->me)) { mutex_unlock(&xt[af].mutex); return t; } } else err = -EPROTOTYPE; /* Found something. */ } } mutex_unlock(&xt[af].mutex); if (af != NFPROTO_UNSPEC) /* Try searching again in the family-independent list */ return xt_find_target(NFPROTO_UNSPEC, name, revision); return ERR_PTR(err); } ",0 "struct rtable *ip_route_output_flow(struct net *net, struct flowi4 *flp4, struct sock *sk) { struct rtable *rt = __ip_route_output_key(net, flp4); if (IS_ERR(rt)) return rt; if (flp4->flowi4_proto) rt = (struct rtable *) xfrm_lookup(net, &rt->dst, flowi4_to_flowi(flp4), sk, 0); return rt; } ",0 "static int cornerStart(const RenderStyle* style, int minX, int maxX, int thickness) { if (style->shouldPlaceBlockDirectionScrollbarOnLogicalLeft()) return minX + style->borderLeftWidth(); return maxX - thickness - style->borderRightWidth(); } ",0 "ZEND_API void ZEND_FASTCALL zend_hash_to_packed(HashTable *ht) { void *new_data, *old_data = HT_GET_DATA_ADDR(ht); Bucket *old_buckets = ht->arData; HT_ASSERT(GC_REFCOUNT(ht) == 1); HANDLE_BLOCK_INTERRUPTIONS(); new_data = pemalloc(HT_SIZE_EX(ht->nTableSize, HT_MIN_MASK), (ht)->u.flags & HASH_FLAG_PERSISTENT); ht->u.flags |= HASH_FLAG_PACKED | HASH_FLAG_STATIC_KEYS; ht->nTableMask = HT_MIN_MASK; HT_SET_DATA_ADDR(ht, new_data); HT_HASH_RESET_PACKED(ht); memcpy(ht->arData, old_buckets, sizeof(Bucket) * ht->nNumUsed); pefree(old_data, (ht)->u.flags & HASH_FLAG_PERSISTENT); HANDLE_UNBLOCK_INTERRUPTIONS(); } ",0 " ExceptionInfo *magick_unused(exception)) { magick_unreferenced(exception); if (module_list == (SplayTreeInfo *) NULL) { if (module_semaphore == (SemaphoreInfo *) NULL) ActivateSemaphoreInfo(&module_semaphore); LockSemaphoreInfo(module_semaphore); if (module_list == (SplayTreeInfo *) NULL) { MagickBooleanType status; ModuleInfo *module_info; module_list=NewSplayTree(CompareSplayTreeString, (void *(*)(void *)) NULL,DestroyModuleNode); if (module_list == (SplayTreeInfo *) NULL) ThrowFatalException(ResourceLimitFatalError, ""MemoryAllocationFailed""); module_info=AcquireModuleInfo((const char *) NULL,""[boot-strap]""); module_info->stealth=MagickTrue; status=AddValueToSplayTree(module_list,module_info->tag,module_info); if (status == MagickFalse) ThrowFatalException(ResourceLimitFatalError, ""MemoryAllocationFailed""); if (lt_dlinit() != 0) ThrowFatalException(ModuleFatalError, ""UnableToInitializeModuleLoader""); } UnlockSemaphoreInfo(module_semaphore); } return(module_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse); } ",0 "static void nfs4_xdr_enc_get_lease_time(struct rpc_rqst *req, struct xdr_stream *xdr, struct nfs4_get_lease_time_args *args) { struct compound_hdr hdr = { .minorversion = nfs4_xdr_minorversion(&args->la_seq_args), }; const u32 lease_bitmap[3] = { FATTR4_WORD0_LEASE_TIME }; encode_compound_hdr(xdr, req, &hdr); encode_sequence(xdr, &args->la_seq_args, &hdr); encode_putrootfh(xdr, &hdr); encode_fsinfo(xdr, lease_bitmap, &hdr); encode_nops(&hdr); } ",0 "static void set_carrier(struct net_device *net) { pegasus_t *pegasus = netdev_priv(net); u16 tmp; if (read_mii_word(pegasus, pegasus->phy, MII_BMSR, &tmp)) return; if (tmp & BMSR_LSTATUS) netif_carrier_on(net); else netif_carrier_off(net); } ",0 "bool IsCreditCardExpirationType(ServerFieldType type) { return type == CREDIT_CARD_EXP_MONTH || type == CREDIT_CARD_EXP_2_DIGIT_YEAR || type == CREDIT_CARD_EXP_4_DIGIT_YEAR || type == CREDIT_CARD_EXP_DATE_2_DIGIT_YEAR || type == CREDIT_CARD_EXP_DATE_4_DIGIT_YEAR; } ",0 "GF_Err trun_dump(GF_Box *a, FILE * trace) { u32 i; GF_TrunEntry *ent; GF_TrackFragmentRunBox *p; p = (GF_TrackFragmentRunBox *)a; gf_isom_box_dump_start(a, ""TrackRunBox"", trace); fprintf(trace, ""SampleCount=\""%d\"""", p->sample_count); if (p->flags & GF_ISOM_TRUN_DATA_OFFSET) fprintf(trace, "" DataOffset=\""%d\"""", p->data_offset); fprintf(trace, "">\n""); if (p->flags & GF_ISOM_TRUN_FIRST_FLAG) { sample_flags_dump(""FirstSampleFlags"", p->first_sample_flags, trace); } if (p->flags & (GF_ISOM_TRUN_DURATION|GF_ISOM_TRUN_SIZE|GF_ISOM_TRUN_CTS_OFFSET|GF_ISOM_TRUN_FLAGS)) { i=0; while ((ent = (GF_TrunEntry *)gf_list_enum(p->entries, &i))) { fprintf(trace, ""flags & GF_ISOM_TRUN_DURATION) fprintf(trace, "" Duration=\""%u\"""", ent->Duration); if (p->flags & GF_ISOM_TRUN_SIZE) fprintf(trace, "" Size=\""%u\"""", ent->size); if (p->flags & GF_ISOM_TRUN_CTS_OFFSET) { if (p->version == 0) fprintf(trace, "" CTSOffset=\""%u\"""", (u32) ent->CTS_Offset); else fprintf(trace, "" CTSOffset=\""%d\"""", ent->CTS_Offset); } if (p->flags & GF_ISOM_TRUN_FLAGS) { frag_dump_sample_flags(trace, ent->flags); } fprintf(trace, ""/>\n""); } } else if (p->size) { fprintf(trace, ""\n""); } else { fprintf(trace, ""\n""); } gf_isom_box_dump_done(""TrackRunBox"", a, trace); return GF_OK; } ",0 "static u32 Mmcop1(dpbStorage_t *dpb, u32 currPicNum, u32 differenceOfPicNums) { /* Variables */ i32 index, picNum; /* Code */ ASSERT(currPicNum < dpb->maxFrameNum); picNum = (i32)currPicNum - (i32)differenceOfPicNums; index = FindDpbPic(dpb, picNum, HANTRO_TRUE); if (index < 0) return(HANTRO_NOK); SET_UNUSED(dpb->buffer[index]); dpb->numRefFrames--; if (!dpb->buffer[index].toBeDisplayed) dpb->fullness--; return(HANTRO_OK); } ",0 "status_t OMXNodeInstance::freeBuffer( OMX_U32 portIndex, OMX::buffer_id buffer) { Mutex::Autolock autoLock(mLock); CLOG_BUFFER(freeBuffer, ""%s:%u %#x"", portString(portIndex), portIndex, buffer); removeActiveBuffer(portIndex, buffer); OMX_BUFFERHEADERTYPE *header = findBufferHeader(buffer); BufferMeta *buffer_meta = static_cast(header->pAppPrivate); OMX_ERRORTYPE err = OMX_FreeBuffer(mHandle, portIndex, header); CLOG_IF_ERROR(freeBuffer, err, ""%s:%u %#x"", portString(portIndex), portIndex, buffer); delete buffer_meta; buffer_meta = NULL; invalidateBufferID(buffer); return StatusFromOMXError(err); } ",1 "static void get_fs_root_and_pwd_rcu(struct fs_struct *fs, struct path *root, struct path *pwd) { unsigned seq; do { seq = read_seqcount_begin(&fs->seq); *root = fs->root; *pwd = fs->pwd; } while (read_seqcount_retry(&fs->seq, seq)); } ",0 "static void resched_cpu(int cpu) { struct rq *rq = cpu_rq(cpu); unsigned long flags; if (!raw_spin_trylock_irqsave(&rq->lock, flags)) return; resched_task(cpu_curr(cpu)); raw_spin_unlock_irqrestore(&rq->lock, flags); } ",0 "void blk_register_region(dev_t devt, unsigned long range, struct module *module, struct kobject *(*probe)(dev_t, int *, void *), int (*lock)(dev_t, void *), void *data) { kobj_map(bdev_map, devt, range, module, probe, lock, data); } ",0 " scoped_refptr GetSslParams() { if (GetParam() == HTTP) return scoped_refptr(); return ignored_ssl_socket_params_; } ",0 " static void Ins_DIV( INS_ARG ) { if ( args[1] == 0 ) { CUR.error = TT_Err_Divide_By_Zero; return; } args[0] = MulDiv_Round( args[0], 64L, args[1] ); DBG_PRINT1("" %d"", args[0]); } ",0 "void ResourceDispatcherHost::BeginRequest( int request_id, const ViewHostMsg_Resource_Request& request_data, IPC::Message* sync_result, // only valid for sync int route_id) { ChildProcessInfo::ProcessType process_type = receiver_->type(); int child_id = receiver_->id(); ChromeURLRequestContext* context = static_cast( receiver_->GetRequestContext(request_id, request_data)); if (!context) { URLRequestContextGetter* context_getter = Profile::GetDefaultRequestContext(); if (context_getter) { context = static_cast( context_getter->GetURLRequestContext()); } } if (is_shutdown_ || !ShouldServiceRequest(process_type, child_id, request_data)) { URLRequestStatus status(URLRequestStatus::FAILED, net::ERR_ABORTED); if (sync_result) { SyncLoadResult result; result.status = status; ViewHostMsg_SyncLoad::WriteReplyParams(sync_result, result); receiver_->Send(sync_result); } else { receiver_->Send(new ViewMsg_Resource_RequestComplete( route_id, request_id, status, std::string())); // No security info needed, connection was not } return; } PluginService::GetInstance()->LoadChromePlugins(this); scoped_refptr handler; if (sync_result) { handler = new SyncResourceHandler(receiver_, request_data.url, sync_result); } else { handler = new AsyncResourceHandler(receiver_, child_id, route_id, receiver_->handle(), request_data.url, this); } if (HandleExternalProtocol(request_id, child_id, route_id, request_data.url, request_data.resource_type, handler)) { return; } URLRequest* request = new URLRequest(request_data.url, this); request->set_method(request_data.method); request->set_first_party_for_cookies(request_data.first_party_for_cookies); request->set_referrer(CommandLine::ForCurrentProcess()->HasSwitch( switches::kNoReferrers) ? std::string() : request_data.referrer.spec()); request->SetExtraRequestHeaders(request_data.headers); int load_flags = request_data.load_flags; if (request_data.resource_type == ResourceType::MAIN_FRAME) load_flags |= net::LOAD_VERIFY_EV_CERT; request->set_load_flags(load_flags); request->set_context(context); if (ResourceType::IsFrame(request_data.resource_type)) { request->set_priority(net::HIGHEST); } else { switch (request_data.resource_type) { case ResourceType::STYLESHEET: case ResourceType::SCRIPT: request->set_priority(net::MEDIUM); break; case ResourceType::IMAGE: request->set_priority(net::LOWEST); break; default: request->set_priority(net::LOW); } } uint64 upload_size = 0; if (request_data.upload_data) { request->set_upload(request_data.upload_data); upload_size = request_data.upload_data->GetContentLength(); } if (request_data.resource_type == ResourceType::MAIN_FRAME && process_type == ChildProcessInfo::RENDER_PROCESS && Singleton::get()-> HasPendingCrossSiteRequest(child_id, route_id)) { handler = new CrossSiteResourceHandler(handler, child_id, route_id, this); } handler = new BufferedResourceHandler(handler, this, request); if (safe_browsing_->enabled() && safe_browsing_->CanCheckUrl(request_data.url)) { handler = new SafeBrowsingResourceHandler(handler, child_id, route_id, request_data.resource_type, safe_browsing_, this, receiver_); } ResourceDispatcherHostRequestInfo* extra_info = new ResourceDispatcherHostRequestInfo( handler, process_type, child_id, route_id, request_id, request_data.frame_origin, request_data.main_frame_origin, request_data.resource_type, upload_size, false, // is download ResourceType::IsFrame(request_data.resource_type), // allow_download request_data.host_renderer_id, request_data.host_render_view_id); ApplyExtensionMessageFilterPolicy(request_data.url, request_data.resource_type, extra_info); SetRequestInfo(request, extra_info); // Request takes ownership. chrome_browser_net::SetOriginProcessUniqueIDForRequest( request_data.origin_child_id, request); appcache::AppCacheInterceptor::SetExtraRequestInfo( request, context ? context->appcache_service() : NULL, child_id, request_data.appcache_host_id, request_data.resource_type); if (CommandLine::ForCurrentProcess()->HasSwitch( switches::kEnablePrivacyBlacklists)) { request->SetUserData(&BlacklistRequestInfo::kURLRequestDataKey, new BlacklistRequestInfo(request_data.url, request_data.resource_type, context ? context->GetPrivacyBlacklist() : NULL)); } BeginRequestInternal(request); } ",0 " void CheckPluginAndContinueOnReceiveResponse( const network::ResourceResponseHead& head, network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints, bool is_download_if_not_handled_by_plugin, const std::vector& plugins) { bool stale; WebPluginInfo plugin; bool has_plugin = PluginService::GetInstance()->GetPluginInfo( -1 /* render_process_id */, -1 /* render_frame_id */, resource_context_, resource_request_->url, url::Origin(), head.mime_type, false /* allow_wildcard */, &stale, &plugin, nullptr); if (stale) { PluginService::GetInstance()->GetPlugins(base::BindOnce( &URLLoaderRequestController::CheckPluginAndContinueOnReceiveResponse, weak_factory_.GetWeakPtr(), head, std::move(url_loader_client_endpoints), is_download_if_not_handled_by_plugin)); return; } bool is_download = !has_plugin && is_download_if_not_handled_by_plugin; CallOnReceivedResponse(head, std::move(url_loader_client_endpoints), nullptr, is_download, false /* is_stream */, PREVIEWS_OFF /* previews_state */); } ",0 "void BackRenderbuffer::Create() { ScopedGLErrorSuppressor suppressor(""BackRenderbuffer::Create"", decoder_->state_.GetErrorState()); Destroy(); api()->glGenRenderbuffersEXTFn(1, &id_); } ",0 "line_construct_pp(PG_FUNCTION_ARGS) { Point *pt1 = PG_GETARG_POINT_P(0); Point *pt2 = PG_GETARG_POINT_P(1); LINE *result = (LINE *) palloc(sizeof(LINE)); line_construct_pts(result, pt1, pt2); PG_RETURN_LINE_P(result); } ",0 "bool Browser::TakeFocus(content::WebContents* source, bool reverse) { content::NotificationService::current()->Notify( chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, content::Source(this), content::NotificationService::NoDetails()); return false; } ",0 "string16 WindowCaptionFromPageTitle(const string16& page_title) { #if defined(OS_MACOSX) || defined(OS_CHROMEOS) if (page_title.empty()) return l10n_util::GetStringUTF16(IDS_BROWSER_WINDOW_MAC_TAB_UNTITLED); return page_title; #else if (page_title.empty()) return l10n_util::GetStringUTF16(IDS_PRODUCT_NAME); return l10n_util::GetStringFUTF16(IDS_BROWSER_WINDOW_TITLE_FORMAT, page_title); #endif } ",0 " explicit PrunedListener(NavigationControllerImpl* controller) : notification_count_(0) { registrar_.Add(this, NOTIFICATION_NAV_LIST_PRUNED, Source(controller)); } ",0 "void PageInfoBubbleView::HandleLinkClickedAsync(views::Link* source) { if (web_contents() == nullptr || web_contents()->IsBeingDestroyed()) { return; } switch (source->id()) { case PageInfoBubbleView::VIEW_ID_PAGE_INFO_LINK_SITE_SETTINGS: presenter_->OpenSiteSettingsView(); break; case PageInfoBubbleView::VIEW_ID_PAGE_INFO_LINK_COOKIE_DIALOG: presenter_->RecordPageInfoAction( PageInfo::PAGE_INFO_COOKIES_DIALOG_OPENED); new CollectedCookiesViews(web_contents()); break; case PageInfoBubbleView::VIEW_ID_PAGE_INFO_LINK_CERTIFICATE_VIEWER: { gfx::NativeWindow top_window = web_contents()->GetTopLevelNativeWindow(); if (certificate_ && top_window) { presenter_->RecordPageInfoAction( PageInfo::PAGE_INFO_CERTIFICATE_DIALOG_OPENED); ShowCertificateViewer(web_contents(), top_window, certificate_.get()); } break; } default: NOTREACHED(); } } ",0 "static int scoop_post_load(void *opaque, int version_id) { ScoopInfo *s = (ScoopInfo *) opaque; int i; uint32_t level; level = s->gpio_level & s->gpio_dir; for (i = 0; i < 16; i++) { qemu_set_irq(s->handler[i], (level >> i) & 1); } s->prev_level = level; return 0; } ",0 "void StyleResolver::collectPseudoRulesForElement(Element* element, ElementRuleCollector& collector, PseudoId pseudoId, unsigned rulesToInclude) { collector.setPseudoStyleRequest(PseudoStyleRequest(pseudoId)); if (rulesToInclude & UAAndUserCSSRules) matchUARules(collector); if (rulesToInclude & AuthorCSSRules) { collector.setSameOriginOnly(!(rulesToInclude & CrossOriginCSSRules)); matchAuthorRules(element, collector, rulesToInclude & EmptyCSSRules); } } ",0 "FLAC__bool find_metadata_(FLAC__StreamDecoder *decoder) { FLAC__uint32 x; unsigned i, id; FLAC__bool first = true; FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); for(i = id = 0; i < 4; ) { if(decoder->private_->cached) { x = (FLAC__uint32)decoder->private_->lookahead; decoder->private_->cached = false; } else { if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) return false; /* read_callback_ sets the state for us */ } if(x == FLAC__STREAM_SYNC_STRING[i]) { first = true; i++; id = 0; continue; } if(id >= 3) return false; if(x == ID3V2_TAG_[id]) { id++; i = 0; if(id == 3) { if(!skip_id3v2_tag_(decoder)) return false; /* skip_id3v2_tag_ sets the state for us */ } continue; } id = 0; if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ decoder->private_->header_warmup[0] = (FLAC__byte)x; if(!FLAC__bitreader_read_raw_uint32(decoder->private_->input, &x, 8)) return false; /* read_callback_ sets the state for us */ /* we have to check if we just read two 0xff's in a row; the second may actually be the beginning of the sync code */ /* else we have to check if the second byte is the end of a sync code */ if(x == 0xff) { /* MAGIC NUMBER for the first 8 frame sync bits */ decoder->private_->lookahead = (FLAC__byte)x; decoder->private_->cached = true; } else if(x >> 1 == 0x7c) { /* MAGIC NUMBER for the last 6 sync bits and reserved 7th bit */ decoder->private_->header_warmup[1] = (FLAC__byte)x; decoder->protected_->state = FLAC__STREAM_DECODER_READ_FRAME; return true; } } i = 0; if(first) { send_error_to_client_(decoder, FLAC__STREAM_DECODER_ERROR_STATUS_LOST_SYNC); first = false; } } decoder->protected_->state = FLAC__STREAM_DECODER_READ_METADATA; return true; } ",0 "int GpuChannel::TakeRendererFileDescriptor() { if (!channel_.get()) { NOTREACHED(); return -1; } return channel_->TakeClientFileDescriptor(); } ",0 "net::SocketStreamJob* WebSocketJobFactory( const GURL& url, net::SocketStream::Delegate* delegate) { net::WebSocketJob* job = new net::WebSocketJob(delegate); job->InitSocketStream(new net::SocketStream(url, job)); return job; } ",0 "static irqreturn_t i8042_interrupt(int irq, void *dev_id) { struct i8042_port *port; struct serio *serio; unsigned long flags; unsigned char str, data; unsigned int dfl; unsigned int port_no; bool filtered; int ret = 1; spin_lock_irqsave(&i8042_lock, flags); str = i8042_read_status(); if (unlikely(~str & I8042_STR_OBF)) { spin_unlock_irqrestore(&i8042_lock, flags); if (irq) dbg(""Interrupt %d, without any data\n"", irq); ret = 0; goto out; } data = i8042_read_data(); if (i8042_mux_present && (str & I8042_STR_AUXDATA)) { static unsigned long last_transmit; static unsigned char last_str; dfl = 0; if (str & I8042_STR_MUXERR) { dbg(""MUX error, status is %02x, data is %02x\n"", str, data); /* * When MUXERR condition is signalled the data register can only contain * 0xfd, 0xfe or 0xff if implementation follows the spec. Unfortunately * it is not always the case. Some KBCs also report 0xfc when there is * nothing connected to the port while others sometimes get confused which * port the data came from and signal error leaving the data intact. They * _do not_ revert to legacy mode (actually I've never seen KBC reverting * to legacy mode yet, when we see one we'll add proper handling). * Anyway, we process 0xfc, 0xfd, 0xfe and 0xff as timeouts, and for the * rest assume that the data came from the same serio last byte * was transmitted (if transmission happened not too long ago). */ switch (data) { default: if (time_before(jiffies, last_transmit + HZ/10)) { str = last_str; break; } /* fall through - report timeout */ case 0xfc: case 0xfd: case 0xfe: dfl = SERIO_TIMEOUT; data = 0xfe; break; case 0xff: dfl = SERIO_PARITY; data = 0xfe; break; } } port_no = I8042_MUX_PORT_NO + ((str >> 6) & 3); last_str = str; last_transmit = jiffies; } else { dfl = ((str & I8042_STR_PARITY) ? SERIO_PARITY : 0) | ((str & I8042_STR_TIMEOUT && !i8042_notimeout) ? SERIO_TIMEOUT : 0); port_no = (str & I8042_STR_AUXDATA) ? I8042_AUX_PORT_NO : I8042_KBD_PORT_NO; } port = &i8042_ports[port_no]; serio = port->exists ? port->serio : NULL; filter_dbg(port->driver_bound, data, ""<- i8042 (interrupt, %d, %d%s%s)\n"", port_no, irq, dfl & SERIO_PARITY ? "", bad parity"" : """", dfl & SERIO_TIMEOUT ? "", timeout"" : """"); filtered = i8042_filter(data, str, serio); spin_unlock_irqrestore(&i8042_lock, flags); if (likely(port->exists && !filtered)) serio_interrupt(serio, data, dfl); out: return IRQ_RETVAL(ret); } ",1 "void AudioRendererAlgorithm::CrossfadeFrame( uint8* outtro_bytes, const uint8* intro_bytes) { Type* outtro = reinterpret_cast(outtro_bytes); const Type* intro = reinterpret_cast(intro_bytes); int frames_in_crossfade = bytes_in_crossfade_ / bytes_per_frame_; float crossfade_ratio = static_cast(crossfade_frame_number_) / frames_in_crossfade; for (int channel = 0; channel < channels_; ++channel) { *outtro *= 1.0 - crossfade_ratio; *outtro++ += (*intro++) * crossfade_ratio; } crossfade_frame_number_++; } ",0 " ft_service_list_lookup( FT_ServiceDesc service_descriptors, const char* service_id ) { FT_Pointer result = NULL; FT_ServiceDesc desc = service_descriptors; if ( desc && service_id ) { for ( ; desc->serv_id != NULL; desc++ ) { if ( ft_strcmp( desc->serv_id, service_id ) == 0 ) { result = (FT_Pointer)desc->serv_data; break; } } } return result; } ",0 "void RenderViewImpl::OnSetHistoryLengthAndPrune(int history_length, int32 minimum_page_id) { DCHECK(history_length >= 0); DCHECK(history_list_offset_ == history_list_length_ - 1); DCHECK(minimum_page_id >= -1); std::vector new_history_page_ids(history_length, -1); for (size_t i = 0; i < history_page_ids_.size(); ++i) { if (minimum_page_id >= 0 && history_page_ids_[i] < minimum_page_id) continue; new_history_page_ids.push_back(history_page_ids_[i]); } new_history_page_ids.swap(history_page_ids_); history_list_length_ = history_page_ids_.size(); history_list_offset_ = history_list_length_ - 1; } ",0 "void WebGLRenderingContextBase::bufferData(GLenum target, DOMArrayBuffer* data, GLenum usage) { if (isContextLost()) return; if (!data) { SynthesizeGLError(GL_INVALID_VALUE, ""bufferData"", ""no data""); return; } BufferDataImpl(target, data->ByteLength(), data->Data(), usage); } ",0 "ipv4_connect(struct TCP_Server_Info *server) { int rc = 0; int val; bool connected = false; __be16 orig_port = 0; struct socket *socket = server->ssocket; if (socket == NULL) { rc = sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &socket); if (rc < 0) { cERROR(1, ""Error %d creating socket"", rc); return rc; } /* BB other socket options to set KEEPALIVE, NODELAY? */ cFYI(1, ""Socket created""); server->ssocket = socket; socket->sk->sk_allocation = GFP_NOFS; cifs_reclassify_socket4(socket); } /* user overrode default port */ if (server->addr.sockAddr.sin_port) { rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr, sizeof(struct sockaddr_in), 0); if (rc >= 0) connected = true; } if (!connected) { /* save original port so we can retry user specified port later if fall back ports fail this time */ orig_port = server->addr.sockAddr.sin_port; /* do not retry on the same port we just failed on */ if (server->addr.sockAddr.sin_port != htons(CIFS_PORT)) { server->addr.sockAddr.sin_port = htons(CIFS_PORT); rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr, sizeof(struct sockaddr_in), 0); if (rc >= 0) connected = true; } } if (!connected) { server->addr.sockAddr.sin_port = htons(RFC1001_PORT); rc = socket->ops->connect(socket, (struct sockaddr *) &server->addr.sockAddr, sizeof(struct sockaddr_in), 0); if (rc >= 0) connected = true; } /* give up here - unless we want to retry on different protocol families some day */ if (!connected) { if (orig_port) server->addr.sockAddr.sin_port = orig_port; cFYI(1, ""Error %d connecting to server via ipv4"", rc); sock_release(socket); server->ssocket = NULL; return rc; } /* * Eventually check for other socket options to change from * the default. sock_setsockopt not used because it expects * user space buffer */ socket->sk->sk_rcvtimeo = 7 * HZ; socket->sk->sk_sndtimeo = 5 * HZ; /* make the bufsizes depend on wsize/rsize and max requests */ if (server->noautotune) { if (socket->sk->sk_sndbuf < (200 * 1024)) socket->sk->sk_sndbuf = 200 * 1024; if (socket->sk->sk_rcvbuf < (140 * 1024)) socket->sk->sk_rcvbuf = 140 * 1024; } if (server->tcp_nodelay) { val = 1; rc = kernel_setsockopt(socket, SOL_TCP, TCP_NODELAY, (char *)&val, sizeof(val)); if (rc) cFYI(1, ""set TCP_NODELAY socket option error %d"", rc); } cFYI(1, ""sndbuf %d rcvbuf %d rcvtimeo 0x%lx"", socket->sk->sk_sndbuf, socket->sk->sk_rcvbuf, socket->sk->sk_rcvtimeo); /* send RFC1001 sessinit */ if (server->addr.sockAddr.sin_port == htons(RFC1001_PORT)) { /* some servers require RFC1001 sessinit before sending negprot - BB check reconnection in case where second sessinit is sent but no second negprot */ struct rfc1002_session_packet *ses_init_buf; struct smb_hdr *smb_buf; ses_init_buf = kzalloc(sizeof(struct rfc1002_session_packet), GFP_KERNEL); if (ses_init_buf) { ses_init_buf->trailer.session_req.called_len = 32; if (server->server_RFC1001_name && server->server_RFC1001_name[0] != 0) rfc1002mangle(ses_init_buf->trailer. session_req.called_name, server->server_RFC1001_name, RFC1001_NAME_LEN_WITH_NULL); else rfc1002mangle(ses_init_buf->trailer. session_req.called_name, DEFAULT_CIFS_CALLED_NAME, RFC1001_NAME_LEN_WITH_NULL); ses_init_buf->trailer.session_req.calling_len = 32; /* calling name ends in null (byte 16) from old smb convention. */ if (server->workstation_RFC1001_name && server->workstation_RFC1001_name[0] != 0) rfc1002mangle(ses_init_buf->trailer. session_req.calling_name, server->workstation_RFC1001_name, RFC1001_NAME_LEN_WITH_NULL); else rfc1002mangle(ses_init_buf->trailer. session_req.calling_name, ""LINUX_CIFS_CLNT"", RFC1001_NAME_LEN_WITH_NULL); ses_init_buf->trailer.session_req.scope1 = 0; ses_init_buf->trailer.session_req.scope2 = 0; smb_buf = (struct smb_hdr *)ses_init_buf; /* sizeof RFC1002_SESSION_REQUEST with no scope */ smb_buf->smb_buf_length = 0x81000044; rc = smb_send(server, smb_buf, 0x44); kfree(ses_init_buf); msleep(1); /* RFC1001 layer in at least one server requires very short break before negprot presumably because not expecting negprot to follow so fast. This is a simple solution that works without complicating the code and causes no significant slowing down on mount for everyone else */ } /* else the negprot may still work without this even though malloc failed */ } return rc; } ",0 "close_uzbl (WebKitWebView *page, GArray *argv, GString *result) { (void)page; (void)argv; (void)result; gtk_main_quit (); } ",0 "GF_Err hnti_Read(GF_Box *s, GF_BitStream *bs) { return gf_isom_box_array_read_ex(s, bs, hnti_AddBox, s->type); } ",0 "const FilePath& DownloadItemImpl::GetTargetFilePath() const { return target_path_; } ",0 "static void wakeup_pipe_writers(struct pipe_inode_info *pipe) { smp_mb(); if (waitqueue_active(&pipe->wait)) wake_up_interruptible(&pipe->wait); kill_fasync(&pipe->fasync_writers, SIGIO, POLL_OUT); } ",0 "int f2fs_setattr(struct dentry *dentry, struct iattr *attr) { struct inode *inode = dentry->d_inode; struct f2fs_inode_info *fi = F2FS_I(inode); int err; err = inode_change_ok(inode, attr); if (err) return err; if ((attr->ia_valid & ATTR_SIZE) && attr->ia_size != i_size_read(inode)) { err = f2fs_convert_inline_data(inode, attr->ia_size); if (err) return err; truncate_setsize(inode, attr->ia_size); f2fs_truncate(inode); f2fs_balance_fs(F2FS_SB(inode->i_sb)); } __setattr_copy(inode, attr); if (attr->ia_valid & ATTR_MODE) { err = posix_acl_chmod(inode, get_inode_mode(inode)); if (err || is_inode_flag_set(fi, FI_ACL_MODE)) { inode->i_mode = fi->i_acl_mode; clear_inode_flag(fi, FI_ACL_MODE); } } mark_inode_dirty(inode); return err; } ",0 "static void print_usage(int argc, char *argv[]) { char *name = NULL; name = strrchr(argv[0], '/'); printf(""Usage: %s -i|--infile FILE [-o|--outfile FILE] [-d|--debug]\n"", (name ? name + 1: argv[0])); printf(""Convert a plist FILE from binary to XML format or vice-versa.\n\n""); printf("" -i, --infile FILE\tThe FILE to convert from\n""); printf("" -o, --outfile FILE\tOptional FILE to convert to or stdout if not used\n""); printf("" -d, --debug\t\tEnable extended debug output\n""); printf(""\n""); } ",0 "calc_load(unsigned long load, unsigned long exp, unsigned long active) { load *= exp; load += active * (FIXED_1 - exp); load += 1UL << (FSHIFT - 1); return load >> FSHIFT; } ",0 "sf_read_int (SNDFILE *sndfile, int *ptr, sf_count_t len) { SF_PRIVATE *psf ; sf_count_t count, extra ; VALIDATE_SNDFILE_AND_ASSIGN_PSF (sndfile, psf, 1) ; if (psf->file.mode == SFM_WRITE) { psf->error = SFE_NOT_READMODE ; return 0 ; } ; if (len % psf->sf.channels) { psf->error = SFE_BAD_READ_ALIGN ; return 0 ; } ; if (len <= 0 || psf->read_current >= psf->sf.frames) { psf_memset (ptr, 0, len * sizeof (int)) ; return 0 ; } ; if (psf->read_int == NULL || psf->seek == NULL) { psf->error = SFE_UNIMPLEMENTED ; return 0 ; } ; if (psf->last_op != SFM_READ) if (psf->seek (psf, SFM_READ, psf->read_current) < 0) return 0 ; count = psf->read_int (psf, ptr, len) ; if (psf->read_current + count / psf->sf.channels <= psf->sf.frames) psf->read_current += count / psf->sf.channels ; else { count = (psf->sf.frames - psf->read_current) * psf->sf.channels ; extra = len - count ; psf_memset (ptr + count, 0, extra * sizeof (int)) ; psf->read_current = psf->sf.frames ; } ; psf->last_op = SFM_READ ; return count ; } /* sf_read_int */ ",0 "bool BookmarksFunction::GetBookmarkIdAsInt64(const std::string& id_string, int64* id) { if (base::StringToInt64(id_string, id)) return true; error_ = keys::kInvalidIdError; return false; } ",0 "bool TopSitesCache::GetPageThumbnail( const GURL& url, scoped_refptr* bytes) const { std::map::const_iterator found = images_.find(GetCanonicalURL(url)); if (found != images_.end()) { base::RefCountedMemory* data = found->second.thumbnail.get(); if (data) { *bytes = data; return true; } } return false; } ",0 "void RenderViewHostImpl::OnShouldCloseACK( bool proceed, const base::TimeTicks& renderer_before_unload_start_time, const base::TimeTicks& renderer_before_unload_end_time) { decrement_in_flight_event_count(); StopHangMonitorTimeout(); if (!is_waiting_for_beforeunload_ack_ || is_swapped_out_) return; is_waiting_for_beforeunload_ack_ = false; RenderViewHostDelegate::RendererManagement* management_delegate = delegate_->GetRendererManagementDelegate(); if (management_delegate) { base::TimeTicks before_unload_end_time; if (!send_should_close_start_time_.is_null() && !renderer_before_unload_start_time.is_null() && !renderer_before_unload_end_time.is_null()) { InterProcessTimeTicksConverter converter( LocalTimeTicks::FromTimeTicks(send_should_close_start_time_), LocalTimeTicks::FromTimeTicks(base::TimeTicks::Now()), RemoteTimeTicks::FromTimeTicks(renderer_before_unload_start_time), RemoteTimeTicks::FromTimeTicks(renderer_before_unload_end_time)); LocalTimeTicks browser_before_unload_end_time = converter.ToLocalTimeTicks( RemoteTimeTicks::FromTimeTicks(renderer_before_unload_end_time)); before_unload_end_time = browser_before_unload_end_time.ToTimeTicks(); } management_delegate->ShouldClosePage( unload_ack_is_for_cross_site_transition_, proceed, before_unload_end_time); } if (!proceed) delegate_->DidCancelLoading(); } ",0 "GF_Err trun_Write(GF_Box *s, GF_BitStream *bs) { GF_TrunEntry *p; GF_Err e; u32 i, count; GF_TrackFragmentRunBox *ptr = (GF_TrackFragmentRunBox *) s; if (!s) return GF_BAD_PARAM; e = gf_isom_full_box_write(s, bs); if (e) return e; gf_bs_write_u32(bs, ptr->sample_count); if (ptr->flags & GF_ISOM_TRUN_DATA_OFFSET) { gf_bs_write_u32(bs, ptr->data_offset); } if (ptr->flags & GF_ISOM_TRUN_FIRST_FLAG) { gf_bs_write_u32(bs, ptr->first_sample_flags); } count = gf_list_count(ptr->entries); for (i=0; ientries, i); if (ptr->flags & GF_ISOM_TRUN_DURATION) { gf_bs_write_u32(bs, p->Duration); } if (ptr->flags & GF_ISOM_TRUN_SIZE) { gf_bs_write_u32(bs, p->size); } if (ptr->flags & GF_ISOM_TRUN_FLAGS) { gf_bs_write_u32(bs, p->flags); } if (ptr->flags & GF_ISOM_TRUN_CTS_OFFSET) { if (ptr->version==0) { gf_bs_write_u32(bs, p->CTS_Offset); } else { gf_bs_write_u32(bs, (u32) p->CTS_Offset); } } } return GF_OK; } ",0 "perf_lock_task_context(struct task_struct *task, int ctxn, unsigned long *flags) { struct perf_event_context *ctx; retry: /* * One of the few rules of preemptible RCU is that one cannot do * rcu_read_unlock() while holding a scheduler (or nested) lock when * part of the read side critical section was preemptible -- see * rcu_read_unlock_special(). * * Since ctx->lock nests under rq->lock we must ensure the entire read * side critical section is non-preemptible. */ preempt_disable(); rcu_read_lock(); ctx = rcu_dereference(task->perf_event_ctxp[ctxn]); if (ctx) { /* * If this context is a clone of another, it might * get swapped for another underneath us by * perf_event_task_sched_out, though the * rcu_read_lock() protects us from any context * getting freed. Lock the context and check if it * got swapped before we could get the lock, and retry * if so. If we locked the right context, then it * can't get swapped on us any more. */ raw_spin_lock_irqsave(&ctx->lock, *flags); if (ctx != rcu_dereference(task->perf_event_ctxp[ctxn])) { raw_spin_unlock_irqrestore(&ctx->lock, *flags); rcu_read_unlock(); preempt_enable(); goto retry; } if (!atomic_inc_not_zero(&ctx->refcount)) { raw_spin_unlock_irqrestore(&ctx->lock, *flags); ctx = NULL; } } rcu_read_unlock(); preempt_enable(); return ctx; } ",0 "static struct svc_rdma_fastreg_mr *rdma_alloc_frmr(struct svcxprt_rdma *xprt) { struct ib_mr *mr; struct scatterlist *sg; struct svc_rdma_fastreg_mr *frmr; u32 num_sg; frmr = kmalloc(sizeof(*frmr), GFP_KERNEL); if (!frmr) goto err; num_sg = min_t(u32, RPCSVC_MAXPAGES, xprt->sc_frmr_pg_list_len); mr = ib_alloc_mr(xprt->sc_pd, IB_MR_TYPE_MEM_REG, num_sg); if (IS_ERR(mr)) goto err_free_frmr; sg = kcalloc(RPCSVC_MAXPAGES, sizeof(*sg), GFP_KERNEL); if (!sg) goto err_free_mr; sg_init_table(sg, RPCSVC_MAXPAGES); frmr->mr = mr; frmr->sg = sg; INIT_LIST_HEAD(&frmr->frmr_list); return frmr; err_free_mr: ib_dereg_mr(mr); err_free_frmr: kfree(frmr); err: return ERR_PTR(-ENOMEM); } ",0 "account_entity_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se) { update_load_add(&cfs_rq->load, se->load.weight); if (!parent_entity(se)) update_load_add(&rq_of(cfs_rq)->load, se->load.weight); #ifdef CONFIG_SMP if (entity_is_task(se)) { struct rq *rq = rq_of(cfs_rq); account_numa_enqueue(rq, task_of(se)); list_add(&se->group_node, &rq->cfs_tasks); } #endif cfs_rq->nr_running++; } ",0 "String Document::cookie(ExceptionState& exception_state) const { if (GetSettings() && !GetSettings()->GetCookieEnabled()) return String(); UseCounter::Count(*this, WebFeature::kCookieGet); if (!GetSecurityOrigin()->CanAccessCookies()) { if (IsSandboxed(kSandboxOrigin)) exception_state.ThrowSecurityError( ""The document is sandboxed and lacks the 'allow-same-origin' flag.""); else if (Url().ProtocolIs(""data"")) exception_state.ThrowSecurityError( ""Cookies are disabled inside 'data:' URLs.""); else exception_state.ThrowSecurityError(""Access is denied for this document.""); return String(); } if (GetSecurityOrigin()->HasSuborigin() && !GetSecurityOrigin()->GetSuborigin()->PolicyContains( Suborigin::SuboriginPolicyOptions::kUnsafeCookies)) return String(); KURL cookie_url = CookieURL(); if (cookie_url.IsEmpty()) return String(); return Cookies(this, cookie_url); } ",0 "PHP_FUNCTION(radius_put_vendor_attr) { long type, vendor; int len; char *data; radius_descriptor *raddesc; zval *z_radh; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rlls"", &z_radh, &vendor, &type, &data, &len) == FAILURE) { return; } ZEND_FETCH_RESOURCE(raddesc, radius_descriptor *, &z_radh, -1, ""rad_handle"", le_radius); if (rad_put_vendor_attr(raddesc->radh, vendor, type, data, len) == -1) { RETURN_FALSE; } else { RETURN_TRUE; } } ",0 "void TextAutosizer::setMultiplier(RenderObject* renderer, float multiplier) { RefPtr newStyle = RenderStyle::clone(renderer->style()); newStyle->setTextAutosizingMultiplier(multiplier); renderer->setStyle(newStyle.release()); } ",0 "bool GLES2DecoderImpl::DoIsProgram(GLuint client_id) { const Program* program = GetProgram(client_id); return program != NULL && !program->IsDeleted(); } ",0 "void ResourceDispatcherHostImpl::CancelRequestsForProcess(int child_id) { CancelRequestsForRoute(child_id, -1 /* cancel all */); registered_temp_files_.erase(child_id); } ",0 "static int parsecreateargs(struct dlist **extargs) { int c; static struct buf arg, val; struct dlist *res; struct dlist *sub; char *p; const char *name; res = dlist_newkvlist(NULL, ""CREATE""); c = prot_getc(imapd_in); if (c == '(') { /* new style RFC4466 arguments */ do { c = getword(imapd_in, &arg); name = ucase(arg.s); if (c != ' ') goto fail; c = prot_getc(imapd_in); if (c == '(') { /* fun - more lists! */ sub = dlist_newlist(res, name); do { c = getword(imapd_in, &val); dlist_setatom(sub, name, val.s); } while (c == ' '); if (c != ')') goto fail; c = prot_getc(imapd_in); } else { prot_ungetc(c, imapd_in); c = getword(imapd_in, &val); dlist_setatom(res, name, val.s); } } while (c == ' '); if (c != ')') goto fail; c = prot_getc(imapd_in); } else { prot_ungetc(c, imapd_in); c = getword(imapd_in, &arg); if (c == EOF) goto fail; p = strchr(arg.s, '!'); if (p) { /* with a server */ *p = '\0'; dlist_setatom(res, ""SERVER"", arg.s); dlist_setatom(res, ""PARTITION"", p+1); } else { dlist_setatom(res, ""PARTITION"", arg.s); } } *extargs = res; return c; fail: dlist_free(&res); return EOF; } ",0 "void GraphicsContext::beginPlatformTransparencyLayer(float opacity) { if (paintingDisabled()) return; SkPaint layerPaint; layerPaint.setAlpha(static_cast(opacity * 255)); layerPaint.setXfermodeMode(platformContext()->getXfermodeMode()); platformContext()->canvas()->saveLayer( 0, &layerPaint, static_cast(SkCanvas::kHasAlphaLayer_SaveFlag | SkCanvas::kFullColorLayer_SaveFlag)); } ",0 "WORD16 ih264d_allocate_dynamic_bufs(dec_struct_t * ps_dec) { struct MemReq s_MemReq; struct MemBlock *p_MemBlock; pred_info_t *ps_pred_frame; dec_mb_info_t *ps_frm_mb_info; dec_slice_struct_t *ps_dec_slice_buf; UWORD8 *pu1_dec_mb_map, *pu1_recon_mb_map; UWORD16 *pu2_slice_num_map; WORD16 *pi16_res_coeff; WORD16 i16_status = 0; UWORD8 uc_frmOrFld = (1 - ps_dec->ps_cur_sps->u1_frame_mbs_only_flag); UWORD16 u4_luma_wd = ps_dec->u2_frm_wd_y; UWORD16 u4_chroma_wd = ps_dec->u2_frm_wd_uv; WORD8 c_i = 0; dec_seq_params_t *ps_sps = ps_dec->ps_cur_sps; UWORD32 u4_total_mbs = ps_sps->u2_total_num_of_mbs << uc_frmOrFld; UWORD32 u4_wd_mbs = ps_dec->u2_frm_wd_in_mbs; UWORD32 u4_ht_mbs = ps_dec->u2_frm_ht_in_mbs; UWORD32 u4_blk_wd; UWORD32 ui_size = 0; UWORD32 u4_int_scratch_size = 0, u4_ref_pred_size = 0; UWORD8 *pu1_buf; WORD32 num_entries; WORD32 size; void *pv_buf; UWORD32 u4_num_bufs; UWORD32 u4_luma_size, u4_chroma_size; void *pv_mem_ctxt = ps_dec->pv_mem_ctxt; size = u4_total_mbs; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu1_dec_mb_map = pv_buf; size = u4_total_mbs; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu1_recon_mb_map = pv_buf; size = u4_total_mbs * sizeof(UWORD16); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu2_slice_num_map = pv_buf; /************************************************************/ /* Post allocation Initialisations */ /************************************************************/ ps_dec->ps_parse_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); ps_dec->ps_decode_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); ps_dec->ps_computebs_cur_slice = &(ps_dec->ps_dec_slice_buf[0]); ps_dec->ps_pred_start = ps_dec->ps_pred; size = sizeof(parse_pmbarams_t) * (ps_dec->u1_recon_mb_grp); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_parse_mb_data = pv_buf; size = sizeof(parse_part_params_t) * ((ps_dec->u1_recon_mb_grp) << 4); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_parse_part_params = pv_buf; size = ((u4_wd_mbs * sizeof(deblkmb_neighbour_t)) << uc_frmOrFld); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_deblk_top_mb = pv_buf; size = ((sizeof(ctxt_inc_mb_info_t)) * (((u4_wd_mbs + 1) << uc_frmOrFld) + 1)); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->p_ctxt_inc_mb_map = pv_buf; size = (sizeof(mv_pred_t) * ps_dec->u1_recon_mb_grp * 16); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_mv_p[0] = pv_buf; size = (sizeof(mv_pred_t) * ps_dec->u1_recon_mb_grp * 16); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_mv_p[1] = pv_buf; { UWORD8 i; for(i = 0; i < MV_SCRATCH_BUFS; i++) { size = (sizeof(mv_pred_t) * ps_dec->u1_recon_mb_grp * 4); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_mv_top_p[i] = pv_buf; } } size = sizeof(UWORD8) * ((u4_wd_mbs + 2) * MB_SIZE) * 2; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu1_y_intra_pred_line = pv_buf; memset(ps_dec->pu1_y_intra_pred_line, 0, size); ps_dec->pu1_y_intra_pred_line += MB_SIZE; size = sizeof(UWORD8) * ((u4_wd_mbs + 2) * MB_SIZE) * 2; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu1_u_intra_pred_line = pv_buf; memset(ps_dec->pu1_u_intra_pred_line, 0, size); ps_dec->pu1_u_intra_pred_line += MB_SIZE; size = sizeof(UWORD8) * ((u4_wd_mbs + 2) * MB_SIZE) * 2; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu1_v_intra_pred_line = pv_buf; memset(ps_dec->pu1_v_intra_pred_line, 0, size); ps_dec->pu1_v_intra_pred_line += MB_SIZE; if(ps_dec->u1_separate_parse) { /* Needs one extra row of info, to hold top row data */ size = sizeof(mb_neigbour_params_t) * 2 * ((u4_wd_mbs + 2) * (u4_ht_mbs + 1)); } else { size = sizeof(mb_neigbour_params_t) * 2 * ((u4_wd_mbs + 2) << uc_frmOrFld); } pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_nbr_mb_row = pv_buf; memset(ps_dec->ps_nbr_mb_row, 0, size); /* Allocate deblock MB info */ size = (u4_total_mbs + u4_wd_mbs) * sizeof(deblk_mb_t); pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_deblk_pic = pv_buf; memset(ps_dec->ps_deblk_pic, 0, size); /* Allocate frame level mb info */ size = sizeof(dec_mb_info_t) * u4_total_mbs; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_frm_mb_info = pv_buf; memset(ps_dec->ps_frm_mb_info, 0, size); /* Allocate memory for slice headers dec_slice_struct_t */ num_entries = MAX_FRAMES; if((1 >= ps_dec->ps_cur_sps->u1_num_ref_frames) && (0 == ps_dec->i4_display_delay)) { num_entries = 1; } num_entries = ((2 * num_entries) + 1); if(BASE_PROFILE_IDC != ps_dec->ps_cur_sps->u1_profile_idc) { num_entries *= 2; } size = num_entries * sizeof(void *); size += PAD_MAP_IDX_POC * sizeof(void *); size *= u4_total_mbs; size += sizeof(dec_slice_struct_t) * u4_total_mbs; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_dec_slice_buf = pv_buf; memset(ps_dec->ps_dec_slice_buf, 0, size); pu1_buf = (UWORD8 *)ps_dec->ps_dec_slice_buf; pu1_buf += sizeof(dec_slice_struct_t) * u4_total_mbs; ps_dec->pv_map_ref_idx_to_poc_buf = (void *)pu1_buf; /* Allocate memory for packed pred info */ num_entries = u4_total_mbs; if(1 == ps_dec->ps_cur_sps->u1_num_ref_frames) num_entries *= 16; else num_entries *= 16 * 2; size = sizeof(pred_info_pkd_t) * num_entries; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->ps_pred_pkd = pv_buf; /* Allocate memory for coeff data */ size = MB_LUM_SIZE * sizeof(WORD16); /*For I16x16 MBs, 16 4x4 AC coeffs and 1 4x4 DC coeff TU blocks will be sent For all MBs along with 8 4x4 AC coeffs 2 2x2 DC coeff TU blocks will be sent So use 17 4x4 TU blocks for luma and 9 4x4 TU blocks for chroma */ size += u4_total_mbs * (MAX(17 * sizeof(tu_sblk4x4_coeff_data_t),4 * sizeof(tu_blk8x8_coeff_data_t)) + 9 * sizeof(tu_sblk4x4_coeff_data_t)); size += u4_total_mbs * 32; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pi2_coeff_data = pv_buf; ps_dec->pv_pic_tu_coeff_data = (void *)(ps_dec->pi2_coeff_data + MB_LUM_SIZE); /* Allocate MV bank buffer */ { UWORD32 col_flag_buffer_size, mvpred_buffer_size; col_flag_buffer_size = ((ps_dec->u2_pic_wd * ps_dec->u2_pic_ht) >> 4); mvpred_buffer_size = sizeof(mv_pred_t) * ((ps_dec->u2_pic_wd * (ps_dec->u2_pic_ht + PAD_MV_BANK_ROW)) >> 4); u4_num_bufs = ps_dec->ps_cur_sps->u1_num_ref_frames + 1; u4_num_bufs = MIN(u4_num_bufs, ps_dec->u1_pic_bufs); u4_num_bufs = MAX(u4_num_bufs, 2); size = ALIGN64(mvpred_buffer_size) + ALIGN64(col_flag_buffer_size); size *= u4_num_bufs; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu1_mv_bank_buf_base = pv_buf; } /* Allocate Pic buffer */ u4_luma_size = ps_dec->u2_frm_wd_y * ps_dec->u2_frm_ht_y; u4_chroma_size = ps_dec->u2_frm_wd_uv * ps_dec->u2_frm_ht_uv; { if(ps_dec->u4_share_disp_buf == 1) { /* In case of buffers getting shared between application and library there is no need of reference memtabs. Instead of setting the i4_size to zero, it is reduced to a small i4_size to ensure that changes in the code are minimal */ if((ps_dec->u1_chroma_format == IV_YUV_420SP_UV) || (ps_dec->u1_chroma_format == IV_YUV_420SP_VU) || (ps_dec->u1_chroma_format == IV_YUV_420P)) { u4_luma_size = 64; } if(ps_dec->u1_chroma_format == IV_YUV_420SP_UV) { u4_chroma_size = 64; } } } size = ALIGN64(u4_luma_size) + ALIGN64(u4_chroma_size); size *= ps_dec->u1_pic_bufs; pv_buf = ps_dec->pf_aligned_alloc(pv_mem_ctxt, 128, size); RETURN_IF((NULL == pv_buf), IV_FAIL); ps_dec->pu1_pic_buf_base = pv_buf; /* 0th entry of CtxtIncMbMap will be always be containing default values for CABAC context representing MB not available */ ps_dec->p_ctxt_inc_mb_map += 1; /* Post allocation Increment Actions */ /***************************************************************************/ /*Initialize cabac context pointers for every SE that has fixed contextIdx */ /***************************************************************************/ { bin_ctxt_model_t * const p_cabac_ctxt_table_t = ps_dec->p_cabac_ctxt_table_t; bin_ctxt_model_t * * p_coeff_abs_level_minus1_t = ps_dec->p_coeff_abs_level_minus1_t; bin_ctxt_model_t * * p_cbf_t = ps_dec->p_cbf_t; ps_dec->p_mb_field_dec_flag_t = p_cabac_ctxt_table_t + MB_FIELD_DECODING_FLAG; ps_dec->p_prev_intra4x4_pred_mode_flag_t = p_cabac_ctxt_table_t + PREV_INTRA4X4_PRED_MODE_FLAG; ps_dec->p_rem_intra4x4_pred_mode_t = p_cabac_ctxt_table_t + REM_INTRA4X4_PRED_MODE; ps_dec->p_intra_chroma_pred_mode_t = p_cabac_ctxt_table_t + INTRA_CHROMA_PRED_MODE; ps_dec->p_mb_qp_delta_t = p_cabac_ctxt_table_t + MB_QP_DELTA; ps_dec->p_ref_idx_t = p_cabac_ctxt_table_t + REF_IDX; ps_dec->p_mvd_x_t = p_cabac_ctxt_table_t + MVD_X; ps_dec->p_mvd_y_t = p_cabac_ctxt_table_t + MVD_Y; p_cbf_t[0] = p_cabac_ctxt_table_t + CBF + 0; p_cbf_t[1] = p_cabac_ctxt_table_t + CBF + 4; p_cbf_t[2] = p_cabac_ctxt_table_t + CBF + 8; p_cbf_t[3] = p_cabac_ctxt_table_t + CBF + 12; p_cbf_t[4] = p_cabac_ctxt_table_t + CBF + 16; ps_dec->p_cbp_luma_t = p_cabac_ctxt_table_t + CBP_LUMA; ps_dec->p_cbp_chroma_t = p_cabac_ctxt_table_t + CBP_CHROMA; p_coeff_abs_level_minus1_t[LUMA_DC_CTXCAT] = p_cabac_ctxt_table_t + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_0_OFFSET; p_coeff_abs_level_minus1_t[LUMA_AC_CTXCAT] = p_cabac_ctxt_table_t + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_1_OFFSET; p_coeff_abs_level_minus1_t[LUMA_4X4_CTXCAT] = p_cabac_ctxt_table_t + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_2_OFFSET; p_coeff_abs_level_minus1_t[CHROMA_DC_CTXCAT] = p_cabac_ctxt_table_t + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_3_OFFSET; p_coeff_abs_level_minus1_t[CHROMA_AC_CTXCAT] = p_cabac_ctxt_table_t + COEFF_ABS_LEVEL_MINUS1 + COEFF_ABS_LEVEL_CAT_4_OFFSET; p_coeff_abs_level_minus1_t[LUMA_8X8_CTXCAT] = p_cabac_ctxt_table_t + COEFF_ABS_LEVEL_MINUS1_8X8 + COEFF_ABS_LEVEL_CAT_5_OFFSET; /********************************************************/ /* context for the high profile related syntax elements */ /* This is maintained seperately in s_high_profile */ /********************************************************/ { ps_dec->s_high_profile.ps_transform8x8_flag = p_cabac_ctxt_table_t + TRANSFORM_SIZE_8X8_FLAG; ps_dec->s_high_profile.ps_sigcoeff_8x8_frame = p_cabac_ctxt_table_t + SIGNIFICANT_COEFF_FLAG_8X8_FRAME; ps_dec->s_high_profile.ps_last_sigcoeff_8x8_frame = p_cabac_ctxt_table_t + LAST_SIGNIFICANT_COEFF_FLAG_8X8_FRAME; ps_dec->s_high_profile.ps_coeff_abs_levelminus1 = p_cabac_ctxt_table_t + COEFF_ABS_LEVEL_MINUS1_8X8; ps_dec->s_high_profile.ps_sigcoeff_8x8_field = p_cabac_ctxt_table_t + SIGNIFICANT_COEFF_FLAG_8X8_FIELD; ps_dec->s_high_profile.ps_last_sigcoeff_8x8_field = p_cabac_ctxt_table_t + LAST_SIGNIFICANT_COEFF_FLAG_8X8_FIELD; } } return (i16_status); } ",0 "void Document::cloneDataFromDocument(const Document& other) { setCompatibilityMode(other.getCompatibilityMode()); setEncodingData(other.m_encodingData); setContextFeatures(other.contextFeatures()); setSecurityOrigin(other.getSecurityOrigin()->isolatedCopy()); setMimeType(other.contentType()); } ",0 "void migrate_page_copy(struct page *newpage, struct page *page) { int cpupid; if (PageHuge(page) || PageTransHuge(page)) copy_huge_page(newpage, page); else copy_highpage(newpage, page); if (PageError(page)) SetPageError(newpage); if (PageReferenced(page)) SetPageReferenced(newpage); if (PageUptodate(page)) SetPageUptodate(newpage); if (TestClearPageActive(page)) { VM_BUG_ON_PAGE(PageUnevictable(page), page); SetPageActive(newpage); } else if (TestClearPageUnevictable(page)) SetPageUnevictable(newpage); if (PageChecked(page)) SetPageChecked(newpage); if (PageMappedToDisk(page)) SetPageMappedToDisk(newpage); if (PageDirty(page)) { clear_page_dirty_for_io(page); /* * Want to mark the page and the radix tree as dirty, and * redo the accounting that clear_page_dirty_for_io undid, * but we can't use set_page_dirty because that function * is actually a signal that all of the page has become dirty. * Whereas only part of our page may be dirty. */ if (PageSwapBacked(page)) SetPageDirty(newpage); else __set_page_dirty_nobuffers(newpage); } if (page_is_young(page)) set_page_young(newpage); if (page_is_idle(page)) set_page_idle(newpage); /* * Copy NUMA information to the new page, to prevent over-eager * future migrations of this same page. */ cpupid = page_cpupid_xchg_last(page, -1); page_cpupid_xchg_last(newpage, cpupid); ksm_migrate_page(newpage, page); /* * Please do not reorder this without considering how mm/ksm.c's * get_ksm_page() depends upon ksm_migrate_page() and PageSwapCache(). */ if (PageSwapCache(page)) ClearPageSwapCache(page); ClearPagePrivate(page); set_page_private(page, 0); /* * If any waiters have accumulated on the new page then * wake them up. */ if (PageWriteback(newpage)) end_page_writeback(newpage); } ",1 "ResourceRequest CreateXHRRequest(const char* url) { ResourceRequest request; request.method = ""GET""; request.url = GURL(url); request.referrer_policy = blink::kWebReferrerPolicyDefault; request.request_initiator = url::Origin(); request.load_flags = 0; request.origin_pid = 0; request.resource_type = RESOURCE_TYPE_XHR; request.request_context = 0; request.appcache_host_id = kAppCacheNoHostId; request.download_to_file = false; request.should_reset_appcache = false; request.is_main_frame = true; request.parent_is_main_frame = false; request.parent_render_frame_id = -1; request.transition_type = ui::PAGE_TRANSITION_LINK; request.allow_download = true; return request; } ",0 "static MagickBooleanType InverseQuadrantSwap(const size_t width, const size_t height,const double *source,double *destination) { register ssize_t x; ssize_t center, y; /* Swap quadrants. */ center=(ssize_t) (width/2L)+1L; for (y=1L; y < (ssize_t) height; y++) for (x=0L; x < (ssize_t) (width/2L+1L); x++) destination[(height-y)*center-x+width/2L]=source[y*width+x]; for (y=0L; y < (ssize_t) height; y++) destination[y*center]=source[y*width+width/2L]; for (x=0L; x < center; x++) destination[x]=source[center-x-1L]; return(RollFourier(center,height,0L,(ssize_t) height/-2L,destination)); } ",0 "static void unicode_ssetup_strings(char **pbcc_area, struct cifs_ses *ses, const struct nls_table *nls_cp) { char *bcc_ptr = *pbcc_area; int bytes_ret = 0; /* BB FIXME add check that strings total less than 335 or will need to send them as arrays */ /* unicode strings, must be word aligned before the call */ /* if ((long) bcc_ptr % 2) { *bcc_ptr = 0; bcc_ptr++; } */ /* copy user */ if (ses->user_name == NULL) { /* null user mount */ *bcc_ptr = 0; *(bcc_ptr+1) = 0; } else { bytes_ret = cifs_strtoUTF16((__le16 *) bcc_ptr, ses->user_name, CIFS_MAX_USERNAME_LEN, nls_cp); } bcc_ptr += 2 * bytes_ret; bcc_ptr += 2; /* account for null termination */ unicode_domain_string(&bcc_ptr, ses, nls_cp); unicode_oslm_strings(&bcc_ptr, nls_cp); *pbcc_area = bcc_ptr; } ",0 "static int correct_orientation(struct image_data *image, unsigned char **work_buff_ptr) { uint16 mirror, rotation; unsigned char *work_buff; work_buff = *work_buff_ptr; if ((image == NULL) || (work_buff == NULL)) { TIFFError (""correct_orientatin"", ""Invalid image or buffer pointer""); return (-1); } if ((image->adjustments & MIRROR_HORIZ) || (image->adjustments & MIRROR_VERT)) { mirror = (uint16)(image->adjustments & MIRROR_BOTH); if (mirrorImage(image->spp, image->bps, mirror, image->width, image->length, work_buff)) { TIFFError (""correct_orientation"", ""Unable to mirror image""); return (-1); } } if (image->adjustments & ROTATE_ANY) { if (image->adjustments & ROTATECW_90) rotation = (uint16) 90; else if (image->adjustments & ROTATECW_180) rotation = (uint16) 180; else if (image->adjustments & ROTATECW_270) rotation = (uint16) 270; else { TIFFError (""correct_orientation"", ""Invalid rotation value: %d"", image->adjustments & ROTATE_ANY); return (-1); } if (rotateImage(rotation, image, &image->width, &image->length, work_buff_ptr)) { TIFFError (""correct_orientation"", ""Unable to rotate image""); return (-1); } image->orientation = ORIENTATION_TOPLEFT; } return (0); } /* end correct_orientation */ ",0 "void FrameFetchContext::CountUsage(WebFeature feature) const { if (IsDetached()) return; if (DocumentLoader* loader = MasterDocumentLoader()) loader->GetUseCounter().Count(feature, GetFrame()); } ",0 "static int __init logi_dj_init(void) { int retval; dbg_hid(""Logitech-DJ:%s\n"", __func__); retval = hid_register_driver(&logi_djreceiver_driver); if (retval) return retval; retval = hid_register_driver(&logi_djdevice_driver); if (retval) hid_unregister_driver(&logi_djreceiver_driver); return retval; } ",0 "die_oom(size_t bytes) { fprintf(stderr, ""Out of memory: %lu bytes unavailable!\n"", (unsigned long)bytes); exit(1); } ",0 "CustomDrawButton* BrowserTitlebar::BuildTitlebarButton(int image, int image_pressed, int image_hot, GtkWidget* box, int tooltip) { CustomDrawButton* button = new CustomDrawButton(image, image_pressed, image_hot, 0); gtk_widget_add_events(GTK_WIDGET(button->widget()), GDK_POINTER_MOTION_MASK); g_signal_connect(button->widget(), ""clicked"", G_CALLBACK(OnButtonClicked), this); g_signal_connect(button->widget(), ""motion-notify-event"", G_CALLBACK(OnMouseMoveEvent), browser_window_); std::string localized_tooltip = l10n_util::GetStringUTF8(tooltip); gtk_widget_set_tooltip_text(button->widget(), localized_tooltip.c_str()); gtk_box_pack_end(GTK_BOX(box), button->widget(), FALSE, FALSE, 0); return button; } ",0 "static void get_delta_sk(X509_STORE_CTX *ctx, X509_CRL **dcrl, int *pscore, X509_CRL *base, STACK_OF(X509_CRL) *crls) { X509_CRL *delta; int i; if (!(ctx->param->flags & X509_V_FLAG_USE_DELTAS)) return; if (!((ctx->current_cert->ex_flags | base->flags) & EXFLAG_FRESHEST)) return; for (i = 0; i < sk_X509_CRL_num(crls); i++) { delta = sk_X509_CRL_value(crls, i); if (check_delta_base(delta, base)) { if (check_crl_time(ctx, delta, 0)) *pscore |= CRL_SCORE_TIME_DELTA; CRYPTO_add(&delta->references, 1, CRYPTO_LOCK_X509_CRL); *dcrl = delta; return; } } *dcrl = NULL; } ",0 "static void nfs4_proc_rename_setup(struct rpc_message *msg, struct inode *dir) { struct nfs_server *server = NFS_SERVER(dir); struct nfs_renameargs *arg = msg->rpc_argp; struct nfs_renameres *res = msg->rpc_resp; msg->rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_RENAME]; arg->bitmask = server->attr_bitmask; res->server = server; } ",0 "static size_t vpack(uint8_t **p_data, const char *fmt, va_list ap1) { size_t size = 0; uint8_t *data = NULL; if (p_data) { va_list ap2; va_copy(ap2, ap1); size = vfill(NULL, 0, fmt, ap2); *p_data = data = g_malloc(size); va_end(ap2); } return vfill(data, size, fmt, ap1); } ",0 "WebMediaPlayer* RenderViewImpl::createMediaPlayer( WebFrame* frame, const WebKit::WebURL& url, WebMediaPlayerClient* client) { FOR_EACH_OBSERVER( RenderViewObserver, observers_, WillCreateMediaPlayer(frame, client)); const CommandLine* cmd_line = CommandLine::ForCurrentProcess(); #if defined(ENABLE_WEBRTC) if (!cmd_line->HasSwitch(switches::kDisableWebMediaPlayerMS) && MediaStreamImpl::CheckMediaStream(url)) { EnsureMediaStreamImpl(); return new webkit_media::WebMediaPlayerMS( frame, client, AsWeakPtr(), media_stream_impl_, new RenderMediaLog()); } #endif #if defined(OS_ANDROID) WebGraphicsContext3D* resource_context = GetWebView()->sharedGraphicsContext3D(); GpuChannelHost* gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync( CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); if (!gpu_channel_host) { LOG(ERROR) << ""Failed to establish GPU channel for media player""; return NULL; } if (cmd_line->HasSwitch(switches::kMediaPlayerInRenderProcess)) { if (!media_bridge_manager_.get()) { media_bridge_manager_.reset( new webkit_media::MediaPlayerBridgeManagerImpl(1)); } return new webkit_media::WebMediaPlayerInProcessAndroid( frame, client, cookieJar(frame), media_player_manager_.get(), media_bridge_manager_.get(), new StreamTextureFactoryImpl( resource_context, gpu_channel_host, routing_id_), cmd_line->HasSwitch(switches::kDisableMediaHistoryLogging)); } if (!media_player_proxy_) { media_player_proxy_ = new WebMediaPlayerProxyImplAndroid( this, media_player_manager_.get()); } return new webkit_media::WebMediaPlayerImplAndroid( frame, client, media_player_manager_.get(), media_player_proxy_, new StreamTextureFactoryImpl( resource_context, gpu_channel_host, routing_id_)); #endif scoped_refptr sink; if (!cmd_line->HasSwitch(switches::kDisableAudio)) { if (!cmd_line->HasSwitch(switches::kDisableRendererSideMixing)) { sink = RenderThreadImpl::current()->GetAudioRendererMixerManager()-> CreateInput(routing_id_); DVLOG(1) << ""Using AudioRendererMixerManager-provided sink: "" << sink; } else { scoped_refptr device = AudioDeviceFactory::NewOutputDevice(); device->SetSourceRenderView(routing_id_); sink = device; DVLOG(1) << ""Using AudioDeviceFactory-provided sink: "" << sink; } } scoped_refptr gpu_factories; WebGraphicsContext3DCommandBufferImpl* context3d = NULL; if (!cmd_line->HasSwitch(switches::kDisableAcceleratedVideoDecode)) context3d = RenderThreadImpl::current()->GetGpuVDAContext3D(); if (context3d) { scoped_refptr factories_loop = RenderThreadImpl::current()->compositor_thread() ? RenderThreadImpl::current()->compositor_thread()->GetWebThread() ->message_loop()->message_loop_proxy() : base::MessageLoopProxy::current(); GpuChannelHost* gpu_channel_host = RenderThreadImpl::current()->EstablishGpuChannelSync( CAUSE_FOR_GPU_LAUNCH_VIDEODECODEACCELERATOR_INITIALIZE); gpu_factories = new RendererGpuVideoDecoderFactories( gpu_channel_host, factories_loop, context3d); } webkit_media::WebMediaPlayerParams params( sink, gpu_factories, media_stream_impl_, new RenderMediaLog()); WebMediaPlayer* media_player = GetContentClient()->renderer()->OverrideCreateWebMediaPlayer( this, frame, client, AsWeakPtr(), params); if (!media_player) { media_player = new webkit_media::WebMediaPlayerImpl( frame, client, AsWeakPtr(), params); } return media_player; } ",0 "long Tracks::ParseTrackEntry(long long track_start, long long track_size, long long element_start, long long element_size, Track*& pResult) const { if (pResult) return -1; IMkvReader* const pReader = m_pSegment->m_pReader; long long pos = track_start; const long long track_stop = track_start + track_size; Track::Info info; info.type = 0; info.number = 0; info.uid = 0; info.defaultDuration = 0; Track::Settings v; v.start = -1; v.size = -1; Track::Settings a; a.start = -1; a.size = -1; Track::Settings e; // content_encodings_settings; e.start = -1; e.size = -1; long long lacing = 1; // default is true while (pos < track_stop) { long long id, size; const long status = ParseElementHeader(pReader, pos, track_stop, id, size); if (status < 0) // error return status; if (size < 0) return E_FILE_FORMAT_INVALID; const long long start = pos; if (id == 0x60) { // VideoSettings ID v.start = start; v.size = size; } else if (id == 0x61) { // AudioSettings ID a.start = start; a.size = size; } else if (id == 0x2D80) { // ContentEncodings ID e.start = start; e.size = size; } else if (id == 0x33C5) { // Track UID if (size > 8) return E_FILE_FORMAT_INVALID; info.uid = 0; long long pos_ = start; const long long pos_end = start + size; while (pos_ != pos_end) { unsigned char b; const int status = pReader->Read(pos_, 1, &b); if (status) return status; info.uid <<= 8; info.uid |= b; ++pos_; } } else if (id == 0x57) { // Track Number const long long num = UnserializeUInt(pReader, pos, size); if ((num <= 0) || (num > 127)) return E_FILE_FORMAT_INVALID; info.number = static_cast(num); } else if (id == 0x03) { // Track Type const long long type = UnserializeUInt(pReader, pos, size); if ((type <= 0) || (type > 254)) return E_FILE_FORMAT_INVALID; info.type = static_cast(type); } else if (id == 0x136E) { // Track Name const long status = UnserializeString(pReader, pos, size, info.nameAsUTF8); if (status) return status; } else if (id == 0x02B59C) { // Track Language const long status = UnserializeString(pReader, pos, size, info.language); if (status) return status; } else if (id == 0x03E383) { // Default Duration const long long duration = UnserializeUInt(pReader, pos, size); if (duration < 0) return E_FILE_FORMAT_INVALID; info.defaultDuration = static_cast(duration); } else if (id == 0x06) { // CodecID const long status = UnserializeString(pReader, pos, size, info.codecId); if (status) return status; } else if (id == 0x1C) { // lacing lacing = UnserializeUInt(pReader, pos, size); if ((lacing < 0) || (lacing > 1)) return E_FILE_FORMAT_INVALID; } else if (id == 0x23A2) { // Codec Private delete[] info.codecPrivate; info.codecPrivate = NULL; info.codecPrivateSize = 0; const size_t buflen = static_cast(size); if (buflen) { unsigned char* buf = SafeArrayAlloc(1, buflen); if (buf == NULL) return -1; const int status = pReader->Read(pos, static_cast(buflen), buf); if (status) { delete[] buf; return status; } info.codecPrivate = buf; info.codecPrivateSize = buflen; } } else if (id == 0x058688) { // Codec Name const long status = UnserializeString(pReader, pos, size, info.codecNameAsUTF8); if (status) return status; } else if (id == 0x16AA) { // Codec Delay info.codecDelay = UnserializeUInt(pReader, pos, size); } else if (id == 0x16BB) { // Seek Pre Roll info.seekPreRoll = UnserializeUInt(pReader, pos, size); } pos += size; // consume payload if (pos > track_stop) return E_FILE_FORMAT_INVALID; } if (pos != track_stop) return E_FILE_FORMAT_INVALID; if (info.number <= 0) // not specified return E_FILE_FORMAT_INVALID; if (GetTrackByNumber(info.number)) return E_FILE_FORMAT_INVALID; if (info.type <= 0) // not specified return E_FILE_FORMAT_INVALID; info.lacing = (lacing > 0) ? true : false; if (info.type == Track::kVideo) { if (v.start < 0) return E_FILE_FORMAT_INVALID; if (a.start >= 0) return E_FILE_FORMAT_INVALID; info.settings = v; VideoTrack* pTrack = NULL; const long status = VideoTrack::Parse(m_pSegment, info, element_start, element_size, pTrack); if (status) return status; pResult = pTrack; assert(pResult); if (e.start >= 0) pResult->ParseContentEncodingsEntry(e.start, e.size); } else if (info.type == Track::kAudio) { if (a.start < 0) return E_FILE_FORMAT_INVALID; if (v.start >= 0) return E_FILE_FORMAT_INVALID; info.settings = a; AudioTrack* pTrack = NULL; const long status = AudioTrack::Parse(m_pSegment, info, element_start, element_size, pTrack); if (status) return status; pResult = pTrack; assert(pResult); if (e.start >= 0) pResult->ParseContentEncodingsEntry(e.start, e.size); } else { if (a.start >= 0) return E_FILE_FORMAT_INVALID; if (v.start >= 0) return E_FILE_FORMAT_INVALID; if (info.type == Track::kMetadata && e.start >= 0) return E_FILE_FORMAT_INVALID; info.settings.start = -1; info.settings.size = 0; Track* pTrack = NULL; const long status = Track::Create(m_pSegment, info, element_start, element_size, pTrack); if (status) return status; pResult = pTrack; assert(pResult); } return 0; // success } ",0 "static void on_write_complete(h2o_socket_t *sock, int status) { h2o_http2_conn_t *conn = sock->data; assert(conn->_write.buf_in_flight != NULL); /* close by error if necessary */ if (status != 0) { close_connection_now(conn); return; } /* reset the other memory pool */ h2o_buffer_dispose(&conn->_write.buf_in_flight); assert(conn->_write.buf_in_flight == NULL); /* call the proceed callback of the streams that have been flushed (while unlinking them from the list) */ if (status == 0 && conn->state < H2O_HTTP2_CONN_STATE_IS_CLOSING) { while (!h2o_linklist_is_empty(&conn->_write.streams_to_proceed)) { h2o_http2_stream_t *stream = H2O_STRUCT_FROM_MEMBER(h2o_http2_stream_t, _refs.link, conn->_write.streams_to_proceed.next); assert(!h2o_http2_stream_has_pending_data(stream)); h2o_linklist_unlink(&stream->_refs.link); h2o_http2_stream_proceed(conn, stream); } } /* cancel the write callback if scheduled (as the generator may have scheduled a write just before this function gets called) */ if (h2o_timeout_is_linked(&conn->_write.timeout_entry)) h2o_timeout_unlink(&conn->_write.timeout_entry); /* write more, if possible */ if (do_emit_writereq(conn)) return; /* close the connection if necessary */ switch (conn->state) { case H2O_HTTP2_CONN_STATE_OPEN: break; case H2O_HTTP2_CONN_STATE_HALF_CLOSED: if (conn->num_streams.pull.half_closed + conn->num_streams.push.half_closed != 0) break; conn->state = H2O_HTTP2_CONN_STATE_IS_CLOSING; /* fall-thru */ case H2O_HTTP2_CONN_STATE_IS_CLOSING: close_connection_now(conn); return; } /* start receiving input if necessary, as well as parse the pending input */ if (conn->sock->input->size != 0) parse_input(conn); } ",0 "static int tcp_v4_inbound_md5_hash(struct sock *sk, struct sk_buff *skb) { /* * This gets called for each TCP segment that arrives * so we want to be efficient. * We have 3 drop cases: * o No MD5 hash and one expected. * o MD5 hash and we're not expecting one. * o MD5 hash and its wrong. */ __u8 *hash_location = NULL; struct tcp_md5sig_key *hash_expected; const struct iphdr *iph = ip_hdr(skb); struct tcphdr *th = tcp_hdr(skb); int genhash; unsigned char newhash[16]; hash_expected = tcp_v4_md5_do_lookup(sk, iph->saddr); hash_location = tcp_parse_md5sig_option(th); /* We've parsed the options - do we have a hash? */ if (!hash_expected && !hash_location) return 0; if (hash_expected && !hash_location) { NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5NOTFOUND); return 1; } if (!hash_expected && hash_location) { NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPMD5UNEXPECTED); return 1; } /* Okay, so this is hash_expected and hash_location - * so we need to calculate the checksum. */ genhash = tcp_v4_md5_hash_skb(newhash, hash_expected, NULL, NULL, skb); if (genhash || memcmp(hash_location, newhash, 16) != 0) { if (net_ratelimit()) { printk(KERN_INFO ""MD5 Hash failed for (%pI4, %d)->(%pI4, %d)%s\n"", &iph->saddr, ntohs(th->source), &iph->daddr, ntohs(th->dest), genhash ? "" tcp_v4_calc_md5_hash failed"" : """"); } return 1; } return 0; } ",0 "void BrowserEventRouter::Observe(int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (type == content::NOTIFICATION_NAV_ENTRY_COMMITTED) { NavigationController* source_controller = content::Source(source).ptr(); TabUpdated(source_controller->GetWebContents(), true); } else if (type == content::NOTIFICATION_WEB_CONTENTS_DESTROYED) { WebContents* contents = content::Source(source).ptr(); registrar_.Remove(this, content::NOTIFICATION_NAV_ENTRY_COMMITTED, content::Source(&contents->GetController())); registrar_.Remove(this, content::NOTIFICATION_WEB_CONTENTS_DESTROYED, content::Source(contents)); } else { NOTREACHED(); } } ",0 "arcStrokeCircle(const pointObj *p1, const pointObj *p2, const pointObj *p3, double segment_angle, int include_first, pointArrayObj *pa) { pointObj center; /* Center of our circular arc */ double radius; /* Radius of our circular arc */ double sweep_angle_r; /* Total angular size of our circular arc in radians */ double segment_angle_r; /* Segment angle in radians */ double a1, /*a2,*/ a3; /* Angles represented by p1, p2, p3 relative to center */ int side = arcSegmentSide(p1, p3, p2); /* What side of p1,p3 is the middle point? */ int num_edges; /* How many edges we will be generating */ double current_angle_r; /* What angle are we generating now (radians)? */ int i; /* Counter */ pointObj p; /* Temporary point */ int is_closed = MS_FALSE; /* We need to know if we're dealing with a circle early */ if ( FP_EQ(p1->x, p3->x) && FP_EQ(p1->y, p3->y) ) is_closed = MS_TRUE; /* Check if the ""arc"" is actually straight */ if ( ! is_closed && side == FP_COLINEAR ) { /* We just need to write in the end points */ if ( include_first ) pointArrayAddPoint(pa, p1); pointArrayAddPoint(pa, p3); return MS_SUCCESS; } /* We should always be able to find the center of a non-linear arc */ if ( arcCircleCenter(p1, p2, p3, ¢er, &radius) == MS_FAILURE ) return MS_FAILURE; /* Calculate the angles that our three points represent */ a1 = atan2(p1->y - center.y, p1->x - center.x); /* UNUSED a2 = atan2(p2->y - center.y, p2->x - center.x); */ a3 = atan2(p3->y - center.y, p3->x - center.x); segment_angle_r = M_PI * segment_angle / 180.0; /* Closed-circle case, we sweep the whole circle! */ if ( is_closed ) { sweep_angle_r = 2.0 * M_PI; } /* Clockwise sweep direction */ else if ( side == FP_LEFT ) { if ( a3 > a1 ) /* Wrapping past 180? */ sweep_angle_r = a1 + (2.0 * M_PI - a3); else sweep_angle_r = a1 - a3; } /* Counter-clockwise sweep direction */ else if ( side == FP_RIGHT ) { if ( a3 > a1 ) /* Wrapping past 180? */ sweep_angle_r = a3 - a1; else sweep_angle_r = a3 + (2.0 * M_PI - a1); } else sweep_angle_r = 0.0; /* We don't have enough resolution, let's invert our strategy. */ if ( (sweep_angle_r / segment_angle_r) < SEGMENT_MINPOINTS ) { segment_angle_r = sweep_angle_r / (SEGMENT_MINPOINTS + 1); } /* We don't have enough resolution to stroke this arc, * so just join the start to the end. */ if ( sweep_angle_r < segment_angle_r ) { if ( include_first ) pointArrayAddPoint(pa, p1); pointArrayAddPoint(pa, p3); return MS_SUCCESS; } /* How many edges to generate (we add the final edge * by sticking on the last point */ num_edges = floor(sweep_angle_r / fabs(segment_angle_r)); /* Go backwards (negative angular steps) if we are stroking clockwise */ if ( side == FP_LEFT ) segment_angle_r *= -1; /* What point should we start with? */ if( include_first ) { current_angle_r = a1; } else { current_angle_r = a1 + segment_angle_r; num_edges--; } /* For each edge, increment or decrement by our segment angle */ for( i = 0; i < num_edges; i++ ) { if (segment_angle_r > 0.0 && current_angle_r > M_PI) current_angle_r -= 2*M_PI; if (segment_angle_r < 0.0 && current_angle_r < -1*M_PI) current_angle_r -= 2*M_PI; p.x = center.x + radius*cos(current_angle_r); p.y = center.y + radius*sin(current_angle_r); pointArrayAddPoint(pa, &p); current_angle_r += segment_angle_r; } /* Add the last point */ pointArrayAddPoint(pa, p3); return MS_SUCCESS; } ",0 "static int TraceLineTo(FT_Vector *to,DrawInfo *draw_info) { AffineMatrix affine; char path[MagickPathExtent]; affine=draw_info->affine; (void) FormatLocaleString(path,MagickPathExtent,""L%g,%g"",affine.tx+to->x/64.0, affine.ty-to->y/64.0); (void) ConcatenateString(&draw_info->primitive,path); return(0); } ",0 "cifs_umount(struct super_block *sb, struct cifs_sb_info *cifs_sb) { struct rb_root *root = &cifs_sb->tlink_tree; struct rb_node *node; struct tcon_link *tlink; char *tmp; cancel_delayed_work_sync(&cifs_sb->prune_tlinks); spin_lock(&cifs_sb->tlink_tree_lock); while ((node = rb_first(root))) { tlink = rb_entry(node, struct tcon_link, tl_rbnode); cifs_get_tlink(tlink); clear_bit(TCON_LINK_IN_TREE, &tlink->tl_flags); rb_erase(node, root); spin_unlock(&cifs_sb->tlink_tree_lock); cifs_put_tlink(tlink); spin_lock(&cifs_sb->tlink_tree_lock); } spin_unlock(&cifs_sb->tlink_tree_lock); tmp = cifs_sb->prepath; cifs_sb->prepathlen = 0; cifs_sb->prepath = NULL; kfree(tmp); return 0; } ",0 "GestureSequence::Gestures* GestureSequence::ProcessTouchEventForGesture( const TouchEvent& event, ui::TouchStatus status) { if (status != ui::TOUCH_STATUS_UNKNOWN) return NULL; // The event was consumed by a touch sequence. if (event.touch_id() >= kMaxGesturePoints) return NULL; if (event.type() == ui::ET_TOUCH_PRESSED) { if (point_count_ == kMaxGesturePoints) return NULL; ++point_count_; } GestureState last_state = state_; scoped_ptr gestures(new Gestures()); GesturePoint& point = GesturePointForEvent(event); point.UpdateValues(event); flags_ = event.flags(); switch (Signature(state_, event.touch_id(), event.type(), false)) { case GST_NO_GESTURE_FIRST_PRESSED: TouchDown(event, point, gestures.get()); set_state(GS_PENDING_SYNTHETIC_CLICK); break; case GST_PENDING_SYNTHETIC_CLICK_FIRST_RELEASED: if (Click(event, point, gestures.get())) point.UpdateForTap(); set_state(GS_NO_GESTURE); break; case GST_PENDING_SYNTHETIC_CLICK_FIRST_MOVED: case GST_PENDING_SYNTHETIC_CLICK_FIRST_STATIONARY: if (ScrollStart(event, point, gestures.get())) { set_state(GS_SCROLL); if (ScrollUpdate(event, point, gestures.get())) point.UpdateForScroll(); } break; case GST_PENDING_SYNTHETIC_CLICK_FIRST_CANCELLED: NoGesture(event, point, gestures.get()); break; case GST_SCROLL_FIRST_MOVED: case GST_SCROLL_SECOND_MOVED: if (scroll_type_ == ST_VERTICAL || scroll_type_ == ST_HORIZONTAL) BreakRailScroll(event, point, gestures.get()); if (ScrollUpdate(event, point, gestures.get())) point.UpdateForScroll(); break; case GST_SCROLL_FIRST_RELEASED: case GST_SCROLL_FIRST_CANCELLED: case GST_SCROLL_SECOND_RELEASED: case GST_SCROLL_SECOND_CANCELLED: ScrollEnd(event, point, gestures.get()); set_state(GS_NO_GESTURE); break; case GST_SCROLL_FIRST_PRESSED: case GST_SCROLL_SECOND_PRESSED: case GST_PENDING_SYNTHETIC_CLICK_SECOND_PRESSED: PinchStart(event, point, gestures.get()); set_state(GS_PINCH); break; case GST_PINCH_FIRST_MOVED: case GST_PINCH_SECOND_MOVED: if (PinchUpdate(event, point, gestures.get())) { points_[0].UpdateForScroll(); points_[1].UpdateForScroll(); } break; case GST_PINCH_FIRST_RELEASED: case GST_PINCH_SECOND_RELEASED: case GST_PINCH_FIRST_CANCELLED: case GST_PINCH_SECOND_CANCELLED: PinchEnd(event, point, gestures.get()); scroll_type_ = ST_FREE; set_state(GS_SCROLL); break; } if (state_ != last_state) VLOG(4) << ""Gesture Sequence"" << "" State: "" << state_ << "" touch id: "" << event.touch_id(); if (event.type() == ui::ET_TOUCH_RELEASED) --point_count_; return gestures.release(); } ",0 "bool FrameLoaderClient::hasWebView() const { notImplemented(); return true; } ",0 "char *file_path(struct file *filp, char *buf, int buflen) { return d_path(&filp->f_path, buf, buflen); } ",0 "bool GLES2DecoderImpl::GetServiceTextureId(uint32 client_texture_id, uint32* service_texture_id) { TextureRef* texture_ref = texture_manager()->GetTexture(client_texture_id); if (texture_ref) { *service_texture_id = texture_ref->service_id(); return true; } return false; } ",0 "void SocketStream::DoRestartWithAuth() { DCHECK_EQ(next_state_, STATE_AUTH_REQUIRED); tunnel_request_headers_ = NULL; tunnel_request_headers_bytes_sent_ = 0; tunnel_response_headers_ = NULL; tunnel_response_headers_capacity_ = 0; tunnel_response_headers_len_ = 0; next_state_ = STATE_TCP_CONNECT; DoLoop(OK); } ",0 "const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const { DEFINE_STATIC_LOCAL(AtomicString, id_nonOverlay, (""-internal-media-controls-cast-button"")); DEFINE_STATIC_LOCAL(AtomicString, id_overlay, (""-internal-media-controls-overlay-cast-button"")); return m_isOverlayButton ? id_overlay : id_nonOverlay; } ",0 "unsigned lodepng_add_text(LodePNGInfo* info, const char* key, const char* str) { char** new_keys = (char**)(realloc(info->text_keys, sizeof(char*) * (info->text_num + 1))); char** new_strings = (char**)(realloc(info->text_strings, sizeof(char*) * (info->text_num + 1))); if(!new_keys || !new_strings) { free(new_keys); free(new_strings); return 83; /*alloc fail*/ } info->text_num++; info->text_keys = new_keys; info->text_strings = new_strings; string_init(&info->text_keys[info->text_num - 1]); string_set(&info->text_keys[info->text_num - 1], key); string_init(&info->text_strings[info->text_num - 1]); string_set(&info->text_strings[info->text_num - 1], str); return 0; } ",0 "expr_op_type_to_string(enum expr_op_type type) { if (type >= _EXPR_NUM_VALUES) return NULL; return expr_op_type_strings[type]; } ",0 "static int tun_xdp_set(struct net_device *dev, struct bpf_prog *prog, struct netlink_ext_ack *extack) { struct tun_struct *tun = netdev_priv(dev); struct bpf_prog *old_prog; old_prog = rtnl_dereference(tun->xdp_prog); rcu_assign_pointer(tun->xdp_prog, prog); if (old_prog) bpf_prog_put(old_prog); return 0; } ",0 "static void ActivityLoggingAccessForAllWorldsLongAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); V8SetReturnValueInt(info, impl->activityLoggingAccessForAllWorldsLongAttribute()); } ",0 " void SetReadExpectation(int result) { read_result_ = result; EXPECT_CALL(*this, Read(_, _, _)) .WillOnce(Invoke(this, &MockUploadElementReader::OnRead)); } ",0 "pp::Var ScriptableHandle::Construct(const std::vector& args, pp::Var* exception) { PLUGIN_PRINTF((""ScriptableHandle::Construct (%""NACL_PRIuS "" args)\n"", args.size())); return Error(""constructor"", ""Construct"", ""constructor is not supported"", exception); } ",0 "connection_edge_finished_connecting(edge_connection_t *edge_conn) { connection_t *conn; tor_assert(edge_conn); tor_assert(edge_conn->base_.type == CONN_TYPE_EXIT); conn = TO_CONN(edge_conn); tor_assert(conn->state == EXIT_CONN_STATE_CONNECTING); log_info(LD_EXIT,""Exit connection to %s:%u (%s) established."", escaped_safe_str(conn->address), conn->port, safe_str(fmt_and_decorate_addr(&conn->addr))); rep_hist_note_exit_stream_opened(conn->port); conn->state = EXIT_CONN_STATE_OPEN; connection_watch_events(conn, READ_EVENT); /* stop writing, keep reading */ if (connection_get_outbuf_len(conn)) /* in case there are any queued relay * cells */ connection_start_writing(conn); /* deliver a 'connected' relay cell back through the circuit. */ if (connection_edge_is_rendezvous_stream(edge_conn)) { if (connection_edge_send_command(edge_conn, RELAY_COMMAND_CONNECTED, NULL, 0) < 0) return 0; /* circuit is closed, don't continue */ } else { uint8_t connected_payload[MAX_CONNECTED_CELL_PAYLOAD_LEN]; int connected_payload_len = connected_cell_format_payload(connected_payload, &conn->addr, edge_conn->address_ttl); if (connected_payload_len < 0) return -1; if (connection_edge_send_command(edge_conn, RELAY_COMMAND_CONNECTED, (char*)connected_payload, connected_payload_len) < 0) return 0; /* circuit is closed, don't continue */ } tor_assert(edge_conn->package_window > 0); /* in case the server has written anything */ return connection_edge_process_inbuf(edge_conn, 1); } ",0 "void V8TestObject::OverloadedStaticMethodMethodCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_overloadedStaticMethod""); test_object_v8_internal::OverloadedStaticMethodMethod(info); } ",0 "static void flush_backlog(void *arg) { struct net_device *dev = arg; struct softnet_data *sd = this_cpu_ptr(&softnet_data); struct sk_buff *skb, *tmp; rps_lock(sd); skb_queue_walk_safe(&sd->input_pkt_queue, skb, tmp) { if (skb->dev == dev) { __skb_unlink(skb, &sd->input_pkt_queue); kfree_skb(skb); input_queue_head_incr(sd); } } rps_unlock(sd); skb_queue_walk_safe(&sd->process_queue, skb, tmp) { if (skb->dev == dev) { __skb_unlink(skb, &sd->process_queue); kfree_skb(skb); input_queue_head_incr(sd); } } } ",0 "xscale1pmu_read_counter(int counter) { u32 val = 0; switch (counter) { case XSCALE_CYCLE_COUNTER: asm volatile(""mrc p14, 0, %0, c1, c0, 0"" : ""=r"" (val)); break; case XSCALE_COUNTER0: asm volatile(""mrc p14, 0, %0, c2, c0, 0"" : ""=r"" (val)); break; case XSCALE_COUNTER1: asm volatile(""mrc p14, 0, %0, c3, c0, 0"" : ""=r"" (val)); break; } return val; } ",0 " void ValidateRendererAllocations(base::Value* dump_json) { SCOPED_TRACE(""Validating Renderer Allocation""); base::ProcessId renderer_pid = base::GetProcId(browser() ->tab_strip_model() ->GetActiveWebContents() ->GetMainFrame() ->GetProcess() ->GetHandle()); base::Value* heaps_v2 = FindHeapsV2(renderer_pid, dump_json); if (GetParam() == switches::kMemlogModeAll || GetParam() == switches::kMemlogModeRendererSampling) { ASSERT_TRUE(heaps_v2); } else { ASSERT_FALSE(heaps_v2) << ""There should be no heap dump for the renderer.""; } if (GetParam() == switches::kMemlogModeRendererSampling) { EXPECT_EQ(1, NumProcessesWithName(dump_json, ""Renderer"")); } else { EXPECT_GT(NumProcessesWithName(dump_json, ""Renderer""), 0); } } ",0 "static bool IsHTMLQuote(UChar c) { return (c == '""' || c == '\''); } ",0 "static bool LineDashSequenceIsValid(const Vector& dash) { for (size_t i = 0; i < dash.size(); i++) { if (!std::isfinite(dash[i]) || dash[i] < 0) return false; } return true; } ",0 "static void php_image_filter_colorize(INTERNAL_FUNCTION_PARAMETERS) { zval *SIM; gdImagePtr im_src; long r,g,b,tmp; long a = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""rllll|l"", &SIM, &tmp, &r, &g, &b, &a) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(im_src, gdImagePtr, &SIM, -1, ""Image"", le_gd); if (im_src == NULL) { RETURN_FALSE; } if (gdImageColor(im_src, (int) r, (int) g, (int) b, (int) a) == 1) { RETURN_TRUE; } RETURN_FALSE; } ",0 "long SeekHead::Parse() { IMkvReader* const pReader = m_pSegment->m_pReader; long long pos = m_start; const long long stop = m_start + m_size; int entry_count = 0; int void_element_count = 0; while (pos < stop) { long long id, size; const long status = ParseElementHeader( pReader, pos, stop, id, size); if (status < 0) //error return status; if (id == 0x0DBB) //SeekEntry ID ++entry_count; else if (id == 0x6C) //Void ID ++void_element_count; pos += size; //consume payload assert(pos <= stop); } assert(pos == stop); m_entries = new (std::nothrow) Entry[entry_count]; if (m_entries == NULL) return -1; m_void_elements = new (std::nothrow) VoidElement[void_element_count]; if (m_void_elements == NULL) return -1; Entry* pEntry = m_entries; VoidElement* pVoidElement = m_void_elements; pos = m_start; while (pos < stop) { const long long idpos = pos; long long id, size; const long status = ParseElementHeader( pReader, pos, stop, id, size); if (status < 0) //error return status; if (id == 0x0DBB) //SeekEntry ID { if (ParseEntry(pReader, pos, size, pEntry)) { Entry& e = *pEntry++; e.element_start = idpos; e.element_size = (pos + size) - idpos; } } else if (id == 0x6C) //Void ID { VoidElement& e = *pVoidElement++; e.element_start = idpos; e.element_size = (pos + size) - idpos; } pos += size; //consume payload assert(pos <= stop); } assert(pos == stop); ptrdiff_t count_ = ptrdiff_t(pEntry - m_entries); assert(count_ >= 0); assert(count_ <= entry_count); m_entry_count = static_cast(count_); count_ = ptrdiff_t(pVoidElement - m_void_elements); assert(count_ >= 0); assert(count_ <= void_element_count); m_void_element_count = static_cast(count_); return 0; } ",1 "xmlXPathEscapeUriFunction(xmlXPathParserContextPtr ctxt, int nargs) { xmlXPathObjectPtr str; int escape_reserved; xmlBufferPtr target; xmlChar *cptr; xmlChar escape[4]; CHECK_ARITY(2); escape_reserved = xmlXPathPopBoolean(ctxt); CAST_TO_STRING; str = valuePop(ctxt); target = xmlBufferCreate(); escape[0] = '%'; escape[3] = 0; if (target) { for (cptr = str->stringval; *cptr; cptr++) { if ((*cptr >= 'A' && *cptr <= 'Z') || (*cptr >= 'a' && *cptr <= 'z') || (*cptr >= '0' && *cptr <= '9') || *cptr == '-' || *cptr == '_' || *cptr == '.' || *cptr == '!' || *cptr == '~' || *cptr == '*' || *cptr == '\''|| *cptr == '(' || *cptr == ')' || (*cptr == '%' && ((cptr[1] >= 'A' && cptr[1] <= 'F') || (cptr[1] >= 'a' && cptr[1] <= 'f') || (cptr[1] >= '0' && cptr[1] <= '9')) && ((cptr[2] >= 'A' && cptr[2] <= 'F') || (cptr[2] >= 'a' && cptr[2] <= 'f') || (cptr[2] >= '0' && cptr[2] <= '9'))) || (!escape_reserved && (*cptr == ';' || *cptr == '/' || *cptr == '?' || *cptr == ':' || *cptr == '@' || *cptr == '&' || *cptr == '=' || *cptr == '+' || *cptr == '$' || *cptr == ','))) { xmlBufferAdd(target, cptr, 1); } else { if ((*cptr >> 4) < 10) escape[1] = '0' + (*cptr >> 4); else escape[1] = 'A' - 10 + (*cptr >> 4); if ((*cptr & 0xF) < 10) escape[2] = '0' + (*cptr & 0xF); else escape[2] = 'A' - 10 + (*cptr & 0xF); xmlBufferAdd(target, &escape[0], 3); } } } valuePush(ctxt, xmlXPathCacheNewString(ctxt->context, xmlBufferContent(target))); xmlBufferFree(target); xmlXPathReleaseObject(ctxt->context, str); } ",0 "void ResourceLoader::DidReceiveResponse(const WebURLResponse& response) { DidReceiveResponse(response, nullptr); } ",0 "static int ip_vs_svc_hash(struct ip_vs_service *svc) { unsigned hash; if (svc->flags & IP_VS_SVC_F_HASHED) { pr_err(""%s(): request for already hashed, called from %pF\n"", __func__, __builtin_return_address(0)); return 0; } if (svc->fwmark == 0) { /* * Hash it by in ip_vs_svc_table */ hash = ip_vs_svc_hashkey(svc->af, svc->protocol, &svc->addr, svc->port); list_add(&svc->s_list, &ip_vs_svc_table[hash]); } else { /* * Hash it by fwmark in ip_vs_svc_fwm_table */ hash = ip_vs_svc_fwm_hashkey(svc->fwmark); list_add(&svc->f_list, &ip_vs_svc_fwm_table[hash]); } svc->flags |= IP_VS_SVC_F_HASHED; /* increase its refcnt because it is referenced by the svc table */ atomic_inc(&svc->refcnt); return 1; } ",0 "PpapiPluginProcessHost* PluginServiceImpl::FindOrStartPpapiBrokerProcess( int render_process_id, const FilePath& plugin_path) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); if (filter_ && !filter_->CanLoadPlugin(render_process_id, plugin_path)) return NULL; PpapiPluginProcessHost* plugin_host = FindPpapiBrokerProcess(plugin_path); if (plugin_host) return plugin_host; PepperPluginInfo* info = GetRegisteredPpapiPluginInfo(plugin_path); if (!info) return NULL; return PpapiPluginProcessHost::CreateBrokerHost(*info); } ",0 "bool blk_end_request(struct request *rq, blk_status_t error, unsigned int nr_bytes) { WARN_ON_ONCE(rq->q->mq_ops); return blk_end_bidi_request(rq, error, nr_bytes, 0); } ",0 "struct svc_rdma_req_map *svc_rdma_get_req_map(struct svcxprt_rdma *xprt) { struct svc_rdma_req_map *map = NULL; spin_lock(&xprt->sc_map_lock); if (list_empty(&xprt->sc_maps)) goto out_empty; map = list_first_entry(&xprt->sc_maps, struct svc_rdma_req_map, free); list_del_init(&map->free); spin_unlock(&xprt->sc_map_lock); out: map->count = 0; return map; out_empty: spin_unlock(&xprt->sc_map_lock); /* Pre-allocation amount was incorrect */ map = alloc_req_map(GFP_NOIO); if (map) goto out; WARN_ONCE(1, ""svcrdma: empty request map list?\n""); return NULL; } ",1 "static void CL_GenerateQKey(void) { int len = 0; unsigned char buff[ QKEY_SIZE ]; fileHandle_t f; len = FS_SV_FOpenFileRead( QKEY_FILE, &f ); FS_FCloseFile( f ); if( len == QKEY_SIZE ) { Com_Printf( ""QKEY found.\n"" ); return; } else { if( len > 0 ) { Com_Printf( ""QKEY file size != %d, regenerating\n"", QKEY_SIZE ); } Com_Printf( ""QKEY building random string\n"" ); Com_RandomBytes( buff, sizeof(buff) ); f = FS_SV_FOpenFileWrite( QKEY_FILE ); if( !f ) { Com_Printf( ""QKEY could not open %s for write\n"", QKEY_FILE ); return; } FS_Write( buff, sizeof(buff), f ); FS_FCloseFile( f ); Com_Printf( ""QKEY generated\n"" ); } } ",0 "void TabStripGtk::DropInfo::SetContainerColorMap() { GdkScreen* screen = gtk_widget_get_screen(container); GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen); if (!colormap) colormap = gdk_screen_get_rgb_colormap(screen); gtk_widget_set_colormap(container, colormap); } ",0 " ManifestManager::ManifestManager(RenderFrame* render_frame) : RenderFrameObserver(render_frame), may_have_manifest_(false), manifest_dirty_(true) {} ",0 "void SyncManager::DoneRefreshNigori(const base::Closure& done_callback, bool is_ready) { if (is_ready) data_->RefreshEncryption(); done_callback.Run(); } ",0 " void Parse() { while (HasMoreCharacters()) { Process(Current()); if (HasMoreCharacters()) Advance(); } } ",0 "static void *create_core_dir_config(apr_pool_t *a, char *dir) { core_dir_config *conf; conf = (core_dir_config *)apr_pcalloc(a, sizeof(core_dir_config)); /* conf->r and conf->d[_*] are initialized by dirsection() or left NULL */ conf->opts = dir ? OPT_UNSET : OPT_UNSET|OPT_SYM_LINKS; conf->opts_add = conf->opts_remove = OPT_NONE; conf->override = OR_UNSET|OR_NONE; conf->override_opts = OPT_UNSET | OPT_ALL | OPT_SYM_OWNER | OPT_MULTI; conf->content_md5 = AP_CONTENT_MD5_UNSET; conf->accept_path_info = AP_ACCEPT_PATHINFO_UNSET; conf->use_canonical_name = USE_CANONICAL_NAME_UNSET; conf->use_canonical_phys_port = USE_CANONICAL_PHYS_PORT_UNSET; conf->hostname_lookups = HOSTNAME_LOOKUP_UNSET; /* * left as NULL (we use apr_pcalloc): * conf->limit_cpu = NULL; * conf->limit_mem = NULL; * conf->limit_nproc = NULL; * conf->sec_file = NULL; * conf->sec_if = NULL; */ conf->limit_req_body = AP_LIMIT_REQ_BODY_UNSET; conf->limit_xml_body = AP_LIMIT_UNSET; conf->server_signature = srv_sig_unset; conf->add_default_charset = ADD_DEFAULT_CHARSET_UNSET; conf->add_default_charset_name = DEFAULT_ADD_DEFAULT_CHARSET_NAME; /* Overriding all negotiation * Set NULL by apr_pcalloc: * conf->mime_type = NULL; * conf->handler = NULL; * conf->output_filters = NULL; * conf->input_filters = NULL; */ /* * Flag for use of inodes in ETags. */ conf->etag_bits = ETAG_UNSET; conf->etag_add = ETAG_UNSET; conf->etag_remove = ETAG_UNSET; conf->enable_mmap = ENABLE_MMAP_UNSET; conf->enable_sendfile = ENABLE_SENDFILE_UNSET; conf->allow_encoded_slashes = 0; conf->decode_encoded_slashes = 0; conf->max_ranges = AP_MAXRANGES_UNSET; conf->max_overlaps = AP_MAXRANGES_UNSET; conf->max_reversals = AP_MAXRANGES_UNSET; conf->cgi_pass_auth = AP_CGI_PASS_AUTH_UNSET; conf->qualify_redirect_url = AP_CORE_CONFIG_UNSET; return (void *)conf; } ",0 " void HttpAuthFilterWhitelist::SetWhitelist( const std::string& server_whitelist) { rules_.ParseFromString(server_whitelist); } ",1 "void ShelfBackgroundAnimator::CreateAnimator( ShelfBackgroundType background_type) { int duration_ms = 0; switch (background_type) { case SHELF_BACKGROUND_DEFAULT: case SHELF_BACKGROUND_APP_LIST: duration_ms = 500; break; case SHELF_BACKGROUND_MAXIMIZED: case SHELF_BACKGROUND_SPLIT_VIEW: case SHELF_BACKGROUND_OOBE: case SHELF_BACKGROUND_LOGIN: case SHELF_BACKGROUND_LOGIN_NONBLURRED_WALLPAPER: case SHELF_BACKGROUND_OVERVIEW: duration_ms = 250; break; } animator_ = std::make_unique(this); animator_->SetSlideDuration(duration_ms); } ",1 "RenderBox::RenderBox(ContainerNode* node) : RenderBoxModelObject(node) , m_intrinsicContentLogicalHeight(-1) , m_minPreferredLogicalWidth(-1) , m_maxPreferredLogicalWidth(-1) { setIsBox(); } ",0 "print_smb(netdissect_options *ndo, const u_char *buf, const u_char *maxbuf) { uint16_t flags2; int nterrcodes; int command; uint32_t nterror; const u_char *words, *maxwords, *data; const struct smbfns *fn; const char *fmt_smbheader = ""[P4]SMB Command = [B]\nError class = [BP1]\nError code = [d]\nFlags1 = [B]\nFlags2 = [B][P13]\nTree ID = [d]\nProc ID = [d]\nUID = [d]\nMID = [d]\nWord Count = [b]\n""; int smboffset; ND_TCHECK(buf[9]); request = (buf[9] & 0x80) ? 0 : 1; startbuf = buf; command = buf[4]; fn = smbfind(command, smb_fns); if (ndo->ndo_vflag > 1) ND_PRINT((ndo, ""\n"")); ND_PRINT((ndo, ""SMB PACKET: %s (%s)\n"", fn->name, request ? ""REQUEST"" : ""REPLY"")); if (ndo->ndo_vflag < 2) return; ND_TCHECK_16BITS(&buf[10]); flags2 = EXTRACT_LE_16BITS(&buf[10]); unicodestr = flags2 & 0x8000; nterrcodes = flags2 & 0x4000; /* print out the header */ smb_fdata(ndo, buf, fmt_smbheader, buf + 33, unicodestr); if (nterrcodes) { nterror = EXTRACT_LE_32BITS(&buf[5]); if (nterror) ND_PRINT((ndo, ""NTError = %s\n"", nt_errstr(nterror))); } else { if (buf[5]) ND_PRINT((ndo, ""SMBError = %s\n"", smb_errstr(buf[5], EXTRACT_LE_16BITS(&buf[7])))); } smboffset = 32; for (;;) { const char *f1, *f2; int wct; u_int bcc; int newsmboffset; words = buf + smboffset; ND_TCHECK(words[0]); wct = words[0]; data = words + 1 + wct * 2; maxwords = min(data, maxbuf); if (request) { f1 = fn->descript.req_f1; f2 = fn->descript.req_f2; } else { f1 = fn->descript.rep_f1; f2 = fn->descript.rep_f2; } if (fn->descript.fn) (*fn->descript.fn)(ndo, words, data, buf, maxbuf); else { if (wct) { if (f1) smb_fdata(ndo, words + 1, f1, words + 1 + wct * 2, unicodestr); else { int i; int v; for (i = 0; &words[1 + 2 * i] < maxwords; i++) { ND_TCHECK2(words[1 + 2 * i], 2); v = EXTRACT_LE_16BITS(words + 1 + 2 * i); ND_PRINT((ndo, ""smb_vwv[%d]=%d (0x%X)\n"", i, v, v)); } } } ND_TCHECK2(*data, 2); bcc = EXTRACT_LE_16BITS(data); ND_PRINT((ndo, ""smb_bcc=%u\n"", bcc)); if (f2) { if (bcc > 0) smb_fdata(ndo, data + 2, f2, data + 2 + bcc, unicodestr); } else { if (bcc > 0) { ND_PRINT((ndo, ""smb_buf[]=\n"")); smb_print_data(ndo, data + 2, min(bcc, PTR_DIFF(maxbuf, data + 2))); } } } if ((fn->flags & FLG_CHAIN) == 0) break; if (wct == 0) break; ND_TCHECK(words[1]); command = words[1]; if (command == 0xFF) break; ND_TCHECK2(words[3], 2); newsmboffset = EXTRACT_LE_16BITS(words + 3); fn = smbfind(command, smb_fns); ND_PRINT((ndo, ""\nSMB PACKET: %s (%s) (CHAINED)\n"", fn->name, request ? ""REQUEST"" : ""REPLY"")); if (newsmboffset <= smboffset) { ND_PRINT((ndo, ""Bad andX offset: %u <= %u\n"", newsmboffset, smboffset)); break; } smboffset = newsmboffset; } ND_PRINT((ndo, ""\n"")); return; trunc: ND_PRINT((ndo, ""%s"", tstr)); } ",0 "static void raisesExceptionStringMethodMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exceptionState(ExceptionState::ExecutionContext, ""raisesExceptionStringMethod"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); String result = imp->raisesExceptionStringMethod(exceptionState); if (exceptionState.throwIfNeeded()) return; v8SetReturnValueString(info, result, info.GetIsolate()); } ",0 "void LinkInfoBar::LinkActivated(views::Link* source, int event_flags) { DCHECK(source == link_); if (GetDelegate()->LinkClicked( event_utils::DispositionFromEventFlags(event_flags))) { RemoveInfoBar(); } } ",0 "error::Error GLES2DecoderPassthroughImpl::DoTexStorage2DEXT( GLenum target, GLsizei levels, GLenum internalFormat, GLsizei width, GLsizei height) { CheckErrorCallbackState(); api()->glTexStorage2DEXTFn(target, levels, internalFormat, width, height); if (CheckErrorCallbackState()) { return error::kNoError; } UpdateTextureSizeFromTarget(target); return error::kNoError; } ",0 "static void prepare_vmcs02(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { struct vcpu_vmx *vmx = to_vmx(vcpu); u32 exec_control; vmcs_write16(GUEST_ES_SELECTOR, vmcs12->guest_es_selector); vmcs_write16(GUEST_CS_SELECTOR, vmcs12->guest_cs_selector); vmcs_write16(GUEST_SS_SELECTOR, vmcs12->guest_ss_selector); vmcs_write16(GUEST_DS_SELECTOR, vmcs12->guest_ds_selector); vmcs_write16(GUEST_FS_SELECTOR, vmcs12->guest_fs_selector); vmcs_write16(GUEST_GS_SELECTOR, vmcs12->guest_gs_selector); vmcs_write16(GUEST_LDTR_SELECTOR, vmcs12->guest_ldtr_selector); vmcs_write16(GUEST_TR_SELECTOR, vmcs12->guest_tr_selector); vmcs_write32(GUEST_ES_LIMIT, vmcs12->guest_es_limit); vmcs_write32(GUEST_CS_LIMIT, vmcs12->guest_cs_limit); vmcs_write32(GUEST_SS_LIMIT, vmcs12->guest_ss_limit); vmcs_write32(GUEST_DS_LIMIT, vmcs12->guest_ds_limit); vmcs_write32(GUEST_FS_LIMIT, vmcs12->guest_fs_limit); vmcs_write32(GUEST_GS_LIMIT, vmcs12->guest_gs_limit); vmcs_write32(GUEST_LDTR_LIMIT, vmcs12->guest_ldtr_limit); vmcs_write32(GUEST_TR_LIMIT, vmcs12->guest_tr_limit); vmcs_write32(GUEST_GDTR_LIMIT, vmcs12->guest_gdtr_limit); vmcs_write32(GUEST_IDTR_LIMIT, vmcs12->guest_idtr_limit); vmcs_write32(GUEST_ES_AR_BYTES, vmcs12->guest_es_ar_bytes); vmcs_write32(GUEST_CS_AR_BYTES, vmcs12->guest_cs_ar_bytes); vmcs_write32(GUEST_SS_AR_BYTES, vmcs12->guest_ss_ar_bytes); vmcs_write32(GUEST_DS_AR_BYTES, vmcs12->guest_ds_ar_bytes); vmcs_write32(GUEST_FS_AR_BYTES, vmcs12->guest_fs_ar_bytes); vmcs_write32(GUEST_GS_AR_BYTES, vmcs12->guest_gs_ar_bytes); vmcs_write32(GUEST_LDTR_AR_BYTES, vmcs12->guest_ldtr_ar_bytes); vmcs_write32(GUEST_TR_AR_BYTES, vmcs12->guest_tr_ar_bytes); vmcs_writel(GUEST_ES_BASE, vmcs12->guest_es_base); vmcs_writel(GUEST_CS_BASE, vmcs12->guest_cs_base); vmcs_writel(GUEST_SS_BASE, vmcs12->guest_ss_base); vmcs_writel(GUEST_DS_BASE, vmcs12->guest_ds_base); vmcs_writel(GUEST_FS_BASE, vmcs12->guest_fs_base); vmcs_writel(GUEST_GS_BASE, vmcs12->guest_gs_base); vmcs_writel(GUEST_LDTR_BASE, vmcs12->guest_ldtr_base); vmcs_writel(GUEST_TR_BASE, vmcs12->guest_tr_base); vmcs_writel(GUEST_GDTR_BASE, vmcs12->guest_gdtr_base); vmcs_writel(GUEST_IDTR_BASE, vmcs12->guest_idtr_base); if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_DEBUG_CONTROLS) { kvm_set_dr(vcpu, 7, vmcs12->guest_dr7); vmcs_write64(GUEST_IA32_DEBUGCTL, vmcs12->guest_ia32_debugctl); } else { kvm_set_dr(vcpu, 7, vcpu->arch.dr7); vmcs_write64(GUEST_IA32_DEBUGCTL, vmx->nested.vmcs01_debugctl); } vmcs_write32(VM_ENTRY_INTR_INFO_FIELD, vmcs12->vm_entry_intr_info_field); vmcs_write32(VM_ENTRY_EXCEPTION_ERROR_CODE, vmcs12->vm_entry_exception_error_code); vmcs_write32(VM_ENTRY_INSTRUCTION_LEN, vmcs12->vm_entry_instruction_len); vmcs_write32(GUEST_INTERRUPTIBILITY_INFO, vmcs12->guest_interruptibility_info); vmcs_write32(GUEST_SYSENTER_CS, vmcs12->guest_sysenter_cs); vmx_set_rflags(vcpu, vmcs12->guest_rflags); vmcs_writel(GUEST_PENDING_DBG_EXCEPTIONS, vmcs12->guest_pending_dbg_exceptions); vmcs_writel(GUEST_SYSENTER_ESP, vmcs12->guest_sysenter_esp); vmcs_writel(GUEST_SYSENTER_EIP, vmcs12->guest_sysenter_eip); if (nested_cpu_has_xsaves(vmcs12)) vmcs_write64(XSS_EXIT_BITMAP, vmcs12->xss_exit_bitmap); vmcs_write64(VMCS_LINK_POINTER, -1ull); exec_control = vmcs12->pin_based_vm_exec_control; exec_control |= vmcs_config.pin_based_exec_ctrl; exec_control &= ~PIN_BASED_VMX_PREEMPTION_TIMER; if (nested_cpu_has_posted_intr(vmcs12)) { /* * Note that we use L0's vector here and in * vmx_deliver_nested_posted_interrupt. */ vmx->nested.posted_intr_nv = vmcs12->posted_intr_nv; vmx->nested.pi_pending = false; vmcs_write64(POSTED_INTR_NV, POSTED_INTR_VECTOR); vmcs_write64(POSTED_INTR_DESC_ADDR, page_to_phys(vmx->nested.pi_desc_page) + (unsigned long)(vmcs12->posted_intr_desc_addr & (PAGE_SIZE - 1))); } else exec_control &= ~PIN_BASED_POSTED_INTR; vmcs_write32(PIN_BASED_VM_EXEC_CONTROL, exec_control); vmx->nested.preemption_timer_expired = false; if (nested_cpu_has_preemption_timer(vmcs12)) vmx_start_preemption_timer(vcpu); /* * Whether page-faults are trapped is determined by a combination of * 3 settings: PFEC_MASK, PFEC_MATCH and EXCEPTION_BITMAP.PF. * If enable_ept, L0 doesn't care about page faults and we should * set all of these to L1's desires. However, if !enable_ept, L0 does * care about (at least some) page faults, and because it is not easy * (if at all possible?) to merge L0 and L1's desires, we simply ask * to exit on each and every L2 page fault. This is done by setting * MASK=MATCH=0 and (see below) EB.PF=1. * Note that below we don't need special code to set EB.PF beyond the * ""or""ing of the EB of vmcs01 and vmcs12, because when enable_ept, * vmcs01's EB.PF is 0 so the ""or"" will take vmcs12's value, and when * !enable_ept, EB.PF is 1, so the ""or"" will always be 1. * * A problem with this approach (when !enable_ept) is that L1 may be * injected with more page faults than it asked for. This could have * caused problems, but in practice existing hypervisors don't care. * To fix this, we will need to emulate the PFEC checking (on the L1 * page tables), using walk_addr(), when injecting PFs to L1. */ vmcs_write32(PAGE_FAULT_ERROR_CODE_MASK, enable_ept ? vmcs12->page_fault_error_code_mask : 0); vmcs_write32(PAGE_FAULT_ERROR_CODE_MATCH, enable_ept ? vmcs12->page_fault_error_code_match : 0); if (cpu_has_secondary_exec_ctrls()) { exec_control = vmx_secondary_exec_control(vmx); /* Take the following fields only from vmcs12 */ exec_control &= ~(SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | SECONDARY_EXEC_RDTSCP | SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY | SECONDARY_EXEC_APIC_REGISTER_VIRT | SECONDARY_EXEC_PCOMMIT); if (nested_cpu_has(vmcs12, CPU_BASED_ACTIVATE_SECONDARY_CONTROLS)) exec_control |= vmcs12->secondary_vm_exec_control; if (exec_control & SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES) { /* * If translation failed, no matter: This feature asks * to exit when accessing the given address, and if it * can never be accessed, this feature won't do * anything anyway. */ if (!vmx->nested.apic_access_page) exec_control &= ~SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; else vmcs_write64(APIC_ACCESS_ADDR, page_to_phys(vmx->nested.apic_access_page)); } else if (!(nested_cpu_has_virt_x2apic_mode(vmcs12)) && cpu_need_virtualize_apic_accesses(&vmx->vcpu)) { exec_control |= SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES; kvm_vcpu_reload_apic_access_page(vcpu); } if (exec_control & SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY) { vmcs_write64(EOI_EXIT_BITMAP0, vmcs12->eoi_exit_bitmap0); vmcs_write64(EOI_EXIT_BITMAP1, vmcs12->eoi_exit_bitmap1); vmcs_write64(EOI_EXIT_BITMAP2, vmcs12->eoi_exit_bitmap2); vmcs_write64(EOI_EXIT_BITMAP3, vmcs12->eoi_exit_bitmap3); vmcs_write16(GUEST_INTR_STATUS, vmcs12->guest_intr_status); } vmcs_write32(SECONDARY_VM_EXEC_CONTROL, exec_control); } /* * Set host-state according to L0's settings (vmcs12 is irrelevant here) * Some constant fields are set here by vmx_set_constant_host_state(). * Other fields are different per CPU, and will be set later when * vmx_vcpu_load() is called, and when vmx_save_host_state() is called. */ vmx_set_constant_host_state(vmx); /* * HOST_RSP is normally set correctly in vmx_vcpu_run() just before * entry, but only if the current (host) sp changed from the value * we wrote last (vmx->host_rsp). This cache is no longer relevant * if we switch vmcs, and rather than hold a separate cache per vmcs, * here we just force the write to happen on entry. */ vmx->host_rsp = 0; exec_control = vmx_exec_control(vmx); /* L0's desires */ exec_control &= ~CPU_BASED_VIRTUAL_INTR_PENDING; exec_control &= ~CPU_BASED_VIRTUAL_NMI_PENDING; exec_control &= ~CPU_BASED_TPR_SHADOW; exec_control |= vmcs12->cpu_based_vm_exec_control; if (exec_control & CPU_BASED_TPR_SHADOW) { vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, page_to_phys(vmx->nested.virtual_apic_page)); vmcs_write32(TPR_THRESHOLD, vmcs12->tpr_threshold); } if (cpu_has_vmx_msr_bitmap() && exec_control & CPU_BASED_USE_MSR_BITMAPS) { nested_vmx_merge_msr_bitmap(vcpu, vmcs12); /* MSR_BITMAP will be set by following vmx_set_efer. */ } else exec_control &= ~CPU_BASED_USE_MSR_BITMAPS; /* * Merging of IO bitmap not currently supported. * Rather, exit every time. */ exec_control &= ~CPU_BASED_USE_IO_BITMAPS; exec_control |= CPU_BASED_UNCOND_IO_EXITING; vmcs_write32(CPU_BASED_VM_EXEC_CONTROL, exec_control); /* EXCEPTION_BITMAP and CR0_GUEST_HOST_MASK should basically be the * bitwise-or of what L1 wants to trap for L2, and what we want to * trap. Note that CR0.TS also needs updating - we do this later. */ update_exception_bitmap(vcpu); vcpu->arch.cr0_guest_owned_bits &= ~vmcs12->cr0_guest_host_mask; vmcs_writel(CR0_GUEST_HOST_MASK, ~vcpu->arch.cr0_guest_owned_bits); /* L2->L1 exit controls are emulated - the hardware exit is to L0 so * we should use its exit controls. Note that VM_EXIT_LOAD_IA32_EFER * bits are further modified by vmx_set_efer() below. */ vmcs_write32(VM_EXIT_CONTROLS, vmcs_config.vmexit_ctrl); /* vmcs12's VM_ENTRY_LOAD_IA32_EFER and VM_ENTRY_IA32E_MODE are * emulated by vmx_set_efer(), below. */ vm_entry_controls_init(vmx, (vmcs12->vm_entry_controls & ~VM_ENTRY_LOAD_IA32_EFER & ~VM_ENTRY_IA32E_MODE) | (vmcs_config.vmentry_ctrl & ~VM_ENTRY_IA32E_MODE)); if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_PAT) { vmcs_write64(GUEST_IA32_PAT, vmcs12->guest_ia32_pat); vcpu->arch.pat = vmcs12->guest_ia32_pat; } else if (vmcs_config.vmentry_ctrl & VM_ENTRY_LOAD_IA32_PAT) vmcs_write64(GUEST_IA32_PAT, vmx->vcpu.arch.pat); set_cr4_guest_host_mask(vmx); if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_BNDCFGS) vmcs_write64(GUEST_BNDCFGS, vmcs12->guest_bndcfgs); if (vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_TSC_OFFSETING) vmcs_write64(TSC_OFFSET, vmx->nested.vmcs01_tsc_offset + vmcs12->tsc_offset); else vmcs_write64(TSC_OFFSET, vmx->nested.vmcs01_tsc_offset); if (enable_vpid) { /* * There is no direct mapping between vpid02 and vpid12, the * vpid02 is per-vCPU for L0 and reused while the value of * vpid12 is changed w/ one invvpid during nested vmentry. * The vpid12 is allocated by L1 for L2, so it will not * influence global bitmap(for vpid01 and vpid02 allocation) * even if spawn a lot of nested vCPUs. */ if (nested_cpu_has_vpid(vmcs12) && vmx->nested.vpid02) { vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->nested.vpid02); if (vmcs12->virtual_processor_id != vmx->nested.last_vpid) { vmx->nested.last_vpid = vmcs12->virtual_processor_id; __vmx_flush_tlb(vcpu, to_vmx(vcpu)->nested.vpid02); } } else { vmcs_write16(VIRTUAL_PROCESSOR_ID, vmx->vpid); vmx_flush_tlb(vcpu); } } if (nested_cpu_has_ept(vmcs12)) { kvm_mmu_unload(vcpu); nested_ept_init_mmu_context(vcpu); } if (vmcs12->vm_entry_controls & VM_ENTRY_LOAD_IA32_EFER) vcpu->arch.efer = vmcs12->guest_ia32_efer; else if (vmcs12->vm_entry_controls & VM_ENTRY_IA32E_MODE) vcpu->arch.efer |= (EFER_LMA | EFER_LME); else vcpu->arch.efer &= ~(EFER_LMA | EFER_LME); /* Note: modifies VM_ENTRY/EXIT_CONTROLS and GUEST/HOST_IA32_EFER */ vmx_set_efer(vcpu, vcpu->arch.efer); /* * This sets GUEST_CR0 to vmcs12->guest_cr0, with possibly a modified * TS bit (for lazy fpu) and bits which we consider mandatory enabled. * The CR0_READ_SHADOW is what L2 should have expected to read given * the specifications by L1; It's not enough to take * vmcs12->cr0_read_shadow because on our cr0_guest_host_mask we we * have more bits than L1 expected. */ vmx_set_cr0(vcpu, vmcs12->guest_cr0); vmcs_writel(CR0_READ_SHADOW, nested_read_cr0(vmcs12)); vmx_set_cr4(vcpu, vmcs12->guest_cr4); vmcs_writel(CR4_READ_SHADOW, nested_read_cr4(vmcs12)); /* shadow page tables on either EPT or shadow page tables */ kvm_set_cr3(vcpu, vmcs12->guest_cr3); kvm_mmu_reset_context(vcpu); if (!enable_ept) vcpu->arch.walk_mmu->inject_page_fault = vmx_inject_page_fault_nested; /* * L1 may access the L2's PDPTR, so save them to construct vmcs12 */ if (enable_ept) { vmcs_write64(GUEST_PDPTR0, vmcs12->guest_pdptr0); vmcs_write64(GUEST_PDPTR1, vmcs12->guest_pdptr1); vmcs_write64(GUEST_PDPTR2, vmcs12->guest_pdptr2); vmcs_write64(GUEST_PDPTR3, vmcs12->guest_pdptr3); } kvm_register_write(vcpu, VCPU_REGS_RSP, vmcs12->guest_rsp); kvm_register_write(vcpu, VCPU_REGS_RIP, vmcs12->guest_rip); } ",0 "static int mac80211_hwsim_get_et_sset_count(struct ieee80211_hw *hw, struct ieee80211_vif *vif, int sset) { if (sset == ETH_SS_STATS) return MAC80211_HWSIM_SSTATS_LEN; return 0; } ",0 "int PDFiumEngine::Form_Response(IPDF_JSPLATFORM* param, FPDF_WIDESTRING question, FPDF_WIDESTRING title, FPDF_WIDESTRING default_response, FPDF_WIDESTRING label, FPDF_BOOL password, void* response, int length) { std::string question_str = base::UTF16ToUTF8( reinterpret_cast(question)); std::string default_str = base::UTF16ToUTF8( reinterpret_cast(default_response)); PDFiumEngine* engine = static_cast(param); std::string rv = engine->client_->Prompt(question_str, default_str); base::string16 rv_16 = base::UTF8ToUTF16(rv); int rv_bytes = rv_16.size() * sizeof(base::char16); if (response) { int bytes_to_copy = rv_bytes < length ? rv_bytes : length; memcpy(response, rv_16.c_str(), bytes_to_copy); } return rv_bytes; } ",0 "const AtomicString& Document::bgColor() const { return BodyAttributeValue(kBgcolorAttr); } ",0 "pvscsi_msg_ring_put(PVSCSIState *s, struct PVSCSIRingMsgDesc *msg_desc) { hwaddr msg_descr_pa; msg_descr_pa = pvscsi_ring_pop_msg_descr(&s->rings); trace_pvscsi_msg_ring_put(msg_descr_pa); cpu_physical_memory_write(msg_descr_pa, (void *)msg_desc, sizeof(*msg_desc)); } ",0 "int HTMLSelectElement::optionCount() const { return listItems().size(); } ",0 "v8::Local Dispatcher::GetOrCreateObject( const v8::Local& object, const std::string& field, v8::Isolate* isolate) { v8::Local key = v8::String::NewFromUtf8(isolate, field.c_str()); if (object->HasRealNamedCallbackProperty(key)) { object->Delete(key); } else if (object->HasRealNamedProperty(key)) { v8::Local value = object->Get(key); CHECK(value->IsObject()); return v8::Local::Cast(value); } v8::Local new_object = v8::Object::New(isolate); object->Set(key, new_object); return new_object; } ",0 "static bool check_reg_sane_offset(struct bpf_verifier_env *env, const struct bpf_reg_state *reg, enum bpf_reg_type type) { bool known = tnum_is_const(reg->var_off); s64 val = reg->var_off.value; s64 smin = reg->smin_value; if (known && (val >= BPF_MAX_VAR_OFF || val <= -BPF_MAX_VAR_OFF)) { verbose(env, ""math between %s pointer and %lld is not allowed\n"", reg_type_str[type], val); return false; } if (reg->off >= BPF_MAX_VAR_OFF || reg->off <= -BPF_MAX_VAR_OFF) { verbose(env, ""%s pointer offset %d is not allowed\n"", reg_type_str[type], reg->off); return false; } if (smin == S64_MIN) { verbose(env, ""math between %s pointer and register with unbounded min value is not allowed\n"", reg_type_str[type]); return false; } if (smin >= BPF_MAX_VAR_OFF || smin <= -BPF_MAX_VAR_OFF) { verbose(env, ""value %lld makes %s pointer be out of bounds\n"", smin, reg_type_str[type]); return false; } return true; } ",0 "int DecodeIPV6(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) { int ret; StatsIncr(tv, dtv->counter_ipv6); /* do the actual decoding */ ret = DecodeIPV6Packet (tv, dtv, p, pkt, len); if (unlikely(ret < 0)) { p->ip6h = NULL; return TM_ECODE_FAILED; } #ifdef DEBUG if (SCLogDebugEnabled()) { /* only convert the addresses if debug is really enabled */ /* debug print */ char s[46], d[46]; PrintInet(AF_INET6, (const void *)GET_IPV6_SRC_ADDR(p), s, sizeof(s)); PrintInet(AF_INET6, (const void *)GET_IPV6_DST_ADDR(p), d, sizeof(d)); SCLogDebug(""IPV6 %s->%s - CLASS: %"" PRIu32 "" FLOW: %"" PRIu32 "" NH: %"" PRIu32 "" PLEN: %"" PRIu32 "" HLIM: %"" PRIu32 """", s,d, IPV6_GET_CLASS(p), IPV6_GET_FLOW(p), IPV6_GET_NH(p), IPV6_GET_PLEN(p), IPV6_GET_HLIM(p)); } #endif /* DEBUG */ /* now process the Ext headers and/or the L4 Layer */ switch(IPV6_GET_NH(p)) { case IPPROTO_TCP: IPV6_SET_L4PROTO (p, IPPROTO_TCP); DecodeTCP(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq); return TM_ECODE_OK; case IPPROTO_UDP: IPV6_SET_L4PROTO (p, IPPROTO_UDP); DecodeUDP(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq); return TM_ECODE_OK; case IPPROTO_ICMPV6: IPV6_SET_L4PROTO (p, IPPROTO_ICMPV6); DecodeICMPV6(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq); return TM_ECODE_OK; case IPPROTO_SCTP: IPV6_SET_L4PROTO (p, IPPROTO_SCTP); DecodeSCTP(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq); return TM_ECODE_OK; case IPPROTO_IPIP: IPV6_SET_L4PROTO(p, IPPROTO_IPIP); DecodeIPv4inIPv6(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq); return TM_ECODE_OK; case IPPROTO_IPV6: DecodeIP6inIP6(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq); return TM_ECODE_OK; case IPPROTO_FRAGMENT: case IPPROTO_HOPOPTS: case IPPROTO_ROUTING: case IPPROTO_NONE: case IPPROTO_DSTOPTS: case IPPROTO_AH: case IPPROTO_ESP: case IPPROTO_MH: case IPPROTO_HIP: case IPPROTO_SHIM6: DecodeIPV6ExtHdrs(tv, dtv, p, pkt + IPV6_HEADER_LEN, IPV6_GET_PLEN(p), pq); break; case IPPROTO_ICMP: ENGINE_SET_EVENT(p,IPV6_WITH_ICMPV4); break; default: ENGINE_SET_EVENT(p, IPV6_UNKNOWN_NEXT_HEADER); IPV6_SET_L4PROTO (p, IPV6_GET_NH(p)); break; } p->proto = IPV6_GET_L4PROTO (p); /* Pass to defragger if a fragment. */ if (IPV6_EXTHDR_ISSET_FH(p)) { Packet *rp = Defrag(tv, dtv, p, pq); if (rp != NULL) { PacketEnqueue(pq,rp); } } return TM_ECODE_OK; } ",0 " content::WebContents* web_contents() { return WebContentsObserver::web_contents(); } ",0 "IW_IMPL(void) iw_set_random_seed(struct iw_context *ctx, int randomize, int rand_seed) { ctx->randomize = randomize; ctx->random_seed = rand_seed; } ",0 "static void backtrace_address(void *data, unsigned long addr, int reliable) { struct perf_callchain_entry *entry = data; perf_callchain_store(entry, addr); } ",0 "ofputil_encode_table_desc_request(enum ofp_version ofp_version) { struct ofpbuf *request = NULL; if (ofp_version >= OFP14_VERSION) { request = ofpraw_alloc(OFPRAW_OFPST14_TABLE_DESC_REQUEST, ofp_version, 0); } else { ovs_fatal(0, ""dump-table-desc needs OpenFlow 1.4 or later "" ""(\'-O OpenFlow14\')""); } return request; } ",0 "void WebPage::firstRectForCharacterInSelectedRange(const uint64_t characterPosition, WebCore::IntRect& resultRect) { Frame* frame = m_page->focusController()->focusedOrMainFrame(); IntRect rect; if (RefPtr range = frame->editor()->hasComposition() ? frame->editor()->compositionRange() : frame->selection()->selection().toNormalizedRange()) { ExceptionCode ec = 0; RefPtr tempRange = range->cloneRange(ec); tempRange->setStart(tempRange->startContainer(ec), tempRange->startOffset(ec) + characterPosition, ec); rect = frame->editor()->firstRectForRange(tempRange.get()); } resultRect = frame->view()->contentsToWindow(rect); } ",0 "SProcRenderFillRectangles (ClientPtr client) { register int n; REQUEST(xRenderFillRectanglesReq); REQUEST_AT_LEAST_SIZE (xRenderFillRectanglesReq); swaps(&stuff->length, n); swapl(&stuff->dst, n); swaps(&stuff->color.red, n); swaps(&stuff->color.green, n); swaps(&stuff->color.blue, n); swaps(&stuff->color.alpha, n); SwapRestS(stuff); return (*ProcRenderVector[stuff->renderReqType]) (client); } ",0 "parse_action_bitmap(struct ofpbuf *payload, enum ofp_version ofp_version, uint64_t *ofpacts) { uint32_t types = 0; while (payload->size > 0) { enum ofperr error; uint64_t type; error = ofpprop_pull__(payload, NULL, 1, 0x10000, &type); if (error) { return error; } if (type < CHAR_BIT * sizeof types) { types |= 1u << type; } } *ofpacts = ofpact_bitmap_from_openflow(htonl(types), ofp_version); return 0; } ",0 " Ins_EIF( void ) { /* nothing to do */ } ",0 "VaapiVideoDecodeAccelerator::CreateSurface() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); base::AutoLock auto_lock(lock_); if (available_va_surfaces_.empty()) return nullptr; DCHECK(!awaiting_va_surfaces_recycle_); scoped_refptr va_surface(new VASurface( available_va_surfaces_.front(), requested_pic_size_, vaapi_wrapper_->va_surface_format(), va_surface_release_cb_)); available_va_surfaces_.pop_front(); return new VaapiDecodeSurface(curr_input_buffer_->id(), va_surface); } ",0 "size_t streamReplyWithRange(client *c, stream *s, streamID *start, streamID *end, size_t count, int rev, streamCG *group, streamConsumer *consumer, int flags, streamPropInfo *spi) { void *arraylen_ptr = NULL; size_t arraylen = 0; streamIterator si; int64_t numfields; streamID id; /* If a group was passed, we check if the request is about messages * never delivered so far (normally this happens when "">"" ID is passed). * * If instead the client is asking for some history, we serve it * using a different function, so that we return entries *solely* * from its own PEL. This ensures each consumer will always and only * see the history of messages delivered to it and not yet confirmed * as delivered. */ if (group && streamCompareID(start,&group->last_id) <= 0) { return streamReplyWithRangeFromConsumerPEL(c,s,start,end,count, consumer); } if (!(flags & STREAM_RWR_RAWENTRIES)) arraylen_ptr = addDeferredMultiBulkLength(c); streamIteratorStart(&si,s,start,end,rev); while(streamIteratorGetID(&si,&id,&numfields)) { /* Update the group last_id if needed. */ if (group && streamCompareID(&id,&group->last_id) > 0) group->last_id = id; /* Emit a two elements array for each item. The first is * the ID, the second is an array of field-value pairs. */ addReplyMultiBulkLen(c,2); addReplyStreamID(c,&id); addReplyMultiBulkLen(c,numfields*2); /* Emit the field-value pairs. */ while(numfields--) { unsigned char *key, *value; int64_t key_len, value_len; streamIteratorGetField(&si,&key,&value,&key_len,&value_len); addReplyBulkCBuffer(c,key,key_len); addReplyBulkCBuffer(c,value,value_len); } /* If a group is passed, we need to create an entry in the * PEL (pending entries list) of this group *and* this consumer. * * Note that we cannot be sure about the fact the message is not * already owned by another consumer, because the admin is able * to change the consumer group last delivered ID using the * XGROUP SETID command. So if we find that there is already * a NACK for the entry, we need to associate it to the new * consumer. */ if (group && !(flags & STREAM_RWR_NOACK)) { unsigned char buf[sizeof(streamID)]; streamEncodeID(buf,&id); /* Try to add a new NACK. Most of the time this will work and * will not require extra lookups. We'll fix the problem later * if we find that there is already a entry for this ID. */ streamNACK *nack = streamCreateNACK(consumer); int retval = 0; retval += raxTryInsert(group->pel,buf,sizeof(buf),nack,NULL); retval += raxTryInsert(consumer->pel,buf,sizeof(buf),nack,NULL); /* Now we can check if the entry was already busy, and * in that case reassign the entry to the new consumer. */ if (retval == 0) { streamFreeNACK(nack); nack = raxFind(group->pel,buf,sizeof(buf)); serverAssert(nack != raxNotFound); raxRemove(nack->consumer->pel,buf,sizeof(buf),NULL); /* Update the consumer and idle time. */ nack->consumer = consumer; nack->delivery_time = mstime(); nack->delivery_count++; /* Add the entry in the new consumer local PEL. */ raxInsert(consumer->pel,buf,sizeof(buf),nack,NULL); } else if (retval == 1) { serverPanic(""NACK half-created. Should not be possible.""); } /* Propagate as XCLAIM. */ if (spi) { robj *idarg = createObjectFromStreamID(&id); streamPropagateXCLAIM(c,spi->keyname,spi->groupname,idarg,nack); decrRefCount(idarg); } } arraylen++; if (count && count == arraylen) break; } streamIteratorStop(&si); if (arraylen_ptr) setDeferredMultiBulkLength(c,arraylen_ptr,arraylen); return arraylen; } ",0 "void Tab::SetData(TabRendererData data) { DCHECK(GetWidget()); if (data_ == data) return; TabRendererData old(std::move(data_)); data_ = std::move(data); icon_->SetData(data_); icon_->SetCanPaintToLayer(controller_->CanPaintThrobberToLayer()); UpdateTabIconNeedsAttentionBlocked(); base::string16 title = data_.title; if (title.empty()) { title = icon_->ShowingLoadingAnimation() ? l10n_util::GetStringUTF16(IDS_TAB_LOADING_TITLE) : CoreTabHelper::GetDefaultTitle(); } else { title = Browser::FormatTitleForDisplay(title); } title_->SetText(title); if (data_.alert_state != old.alert_state) alert_indicator_->TransitionToAlertState(data_.alert_state); if (old.pinned != data_.pinned) showing_alert_indicator_ = false; if (data_.alert_state != old.alert_state || data_.title != old.title) TooltipTextChanged(); Layout(); SchedulePaint(); } ",0 "static struct inode *f2fs_nfs_get_inode(struct super_block *sb, u64 ino, u32 generation) { struct f2fs_sb_info *sbi = F2FS_SB(sb); struct inode *inode; if (check_nid_range(sbi, ino)) return ERR_PTR(-ESTALE); /* * f2fs_iget isn't quite right if the inode is currently unallocated! * However f2fs_iget currently does appropriate checks to handle stale * inodes so everything is OK. */ inode = f2fs_iget(sb, ino); if (IS_ERR(inode)) return ERR_CAST(inode); if (unlikely(generation && inode->i_generation != generation)) { /* we didn't find the right inode.. */ iput(inode); return ERR_PTR(-ESTALE); } return inode; } ",0 "static void svm_set_interrupt_shadow(struct kvm_vcpu *vcpu, int mask) { struct vcpu_svm *svm = to_svm(vcpu); if (mask == 0) svm->vmcb->control.int_state &= ~SVM_INTERRUPT_SHADOW_MASK; else svm->vmcb->control.int_state |= SVM_INTERRUPT_SHADOW_MASK; } ",0 "static void vdi_port_unref_msg_to_client(SpiceCharDeviceMsgToClient *msg, void *opaque) { vdi_port_read_buf_unref(msg); } ",0 "static bool set_nr_if_polling(struct task_struct *p) { struct thread_info *ti = task_thread_info(p); typeof(ti->flags) old, val = READ_ONCE(ti->flags); for (;;) { if (!(val & _TIF_POLLING_NRFLAG)) return false; if (val & _TIF_NEED_RESCHED) return true; old = cmpxchg(&ti->flags, val, val | _TIF_NEED_RESCHED); if (old == val) break; val = old; } return true; } ",0 "bool PDFiumEngine::New(const char* url, const char* headers) { url_ = url; if (headers) headers_ = headers; else headers_.clear(); return true; } ",0 "compat_check_entry(struct ipt_entry *e, struct net *net, const char *name) { struct xt_entry_match *ematch; struct xt_mtchk_param mtpar; unsigned int j; int ret = 0; e->counters.pcnt = xt_percpu_counter_alloc(); if (IS_ERR_VALUE(e->counters.pcnt)) return -ENOMEM; j = 0; mtpar.net = net; mtpar.table = name; mtpar.entryinfo = &e->ip; mtpar.hook_mask = e->comefrom; mtpar.family = NFPROTO_IPV4; xt_ematch_foreach(ematch, e) { ret = check_match(ematch, &mtpar); if (ret != 0) goto cleanup_matches; ++j; } ret = check_target(e, net, name); if (ret) goto cleanup_matches; return 0; cleanup_matches: xt_ematch_foreach(ematch, e) { if (j-- == 0) break; cleanup_match(ematch, net); } xt_percpu_counter_free(e->counters.pcnt); return ret; } ",0 "void WebSettingsImpl::setStandardFontFamily(const WebString& font) { m_settings->setStandardFontFamily(font); } ",0 "static int tree_content_remove( struct tree_entry *root, const char *p, struct tree_entry *backup_leaf, int allow_root) { struct tree_content *t; const char *slash1; unsigned int i, n; struct tree_entry *e; slash1 = strchrnul(p, '/'); n = slash1 - p; if (!root->tree) load_tree(root); if (!*p && allow_root) { e = root; goto del_entry; } t = root->tree; for (i = 0; i < t->entry_count; i++) { e = t->entries[i]; if (e->name->str_len == n && !strncmp_icase(p, e->name->str_dat, n)) { if (*slash1 && !S_ISDIR(e->versions[1].mode)) /* * If p names a file in some subdirectory, and a * file or symlink matching the name of the * parent directory of p exists, then p cannot * exist and need not be deleted. */ return 1; if (!*slash1 || !S_ISDIR(e->versions[1].mode)) goto del_entry; if (!e->tree) load_tree(e); if (tree_content_remove(e, slash1 + 1, backup_leaf, 0)) { for (n = 0; n < e->tree->entry_count; n++) { if (e->tree->entries[n]->versions[1].mode) { hashclr(root->versions[1].sha1); return 1; } } backup_leaf = NULL; goto del_entry; } return 0; } } return 0; del_entry: if (backup_leaf) memcpy(backup_leaf, e, sizeof(*backup_leaf)); else if (e->tree) release_tree_content_recursive(e->tree); e->tree = NULL; e->versions[1].mode = 0; hashclr(e->versions[1].sha1); hashclr(root->versions[1].sha1); return 1; } ",0 "void HTMLMediaElement::SetMediaStreamRegistry(URLRegistry* registry) { DCHECK(!media_stream_registry_); media_stream_registry_ = registry; } ",0 "static uint32_t virtio_net_get_features(VirtIODevice *vdev, uint32_t features) { VirtIONet *n = VIRTIO_NET(vdev); NetClientState *nc = qemu_get_queue(n->nic); features |= (1 << VIRTIO_NET_F_MAC); if (!peer_has_vnet_hdr(n)) { features &= ~(0x1 << VIRTIO_NET_F_CSUM); features &= ~(0x1 << VIRTIO_NET_F_HOST_TSO4); features &= ~(0x1 << VIRTIO_NET_F_HOST_TSO6); features &= ~(0x1 << VIRTIO_NET_F_HOST_ECN); features &= ~(0x1 << VIRTIO_NET_F_GUEST_CSUM); features &= ~(0x1 << VIRTIO_NET_F_GUEST_TSO4); features &= ~(0x1 << VIRTIO_NET_F_GUEST_TSO6); features &= ~(0x1 << VIRTIO_NET_F_GUEST_ECN); } if (!peer_has_vnet_hdr(n) || !peer_has_ufo(n)) { features &= ~(0x1 << VIRTIO_NET_F_GUEST_UFO); features &= ~(0x1 << VIRTIO_NET_F_HOST_UFO); } if (!nc->peer || nc->peer->info->type != NET_CLIENT_OPTIONS_KIND_TAP) { return features; } if (!tap_get_vhost_net(nc->peer)) { return features; } return vhost_net_get_features(tap_get_vhost_net(nc->peer), features); } ",0 " explicit DefaultBrowserActionRecorder(base::Closure continuation) : continuation_(std::move(continuation)), settings_app_monitor_(this) {} ",0 "base::string16 OmniboxEditModel::UserTextFromDisplayText( const base::string16& text) const { return KeywordIsSelected() ? (keyword_ + base::char16(' ') + text) : text; } ",0 "data_close(ftpbuf_t *ftp, databuf_t *data) { #if HAVE_OPENSSL_EXT SSL_CTX *ctx; #endif if (data == NULL) { return NULL; } if (data->listener != -1) { #if HAVE_OPENSSL_EXT if (data->ssl_active) { ctx = SSL_get_SSL_CTX(data->ssl_handle); SSL_CTX_free(ctx); SSL_shutdown(data->ssl_handle); SSL_free(data->ssl_handle); data->ssl_active = 0; } #endif closesocket(data->listener); } if (data->fd != -1) { #if HAVE_OPENSSL_EXT if (data->ssl_active) { ctx = SSL_get_SSL_CTX(data->ssl_handle); SSL_CTX_free(ctx); SSL_shutdown(data->ssl_handle); SSL_free(data->ssl_handle); data->ssl_active = 0; } #endif closesocket(data->fd); } if (ftp) { ftp->data = NULL; } efree(data); return NULL; } ",0 "void AppCacheUpdateJob::OnManifestDataReadComplete(int result) { if (result > 0) { loaded_manifest_data_.append(read_manifest_buffer_->data(), result); manifest_response_reader_->ReadData( read_manifest_buffer_.get(), kAppCacheFetchBufferSize, base::BindOnce(&AppCacheUpdateJob::OnManifestDataReadComplete, base::Unretained(this))); // read more } else { read_manifest_buffer_ = nullptr; manifest_response_reader_.reset(); ContinueHandleManifestFetchCompleted( result < 0 || manifest_data_ != loaded_manifest_data_); } } ",0 "int GahpClient::dcloud_start_auto( const char *service_url, const char *username, const char *password, bool *autostart ) { static const char* command = ""DELTACLOUD_START_AUTO""; if ( server->m_commands_supported->contains_anycase( command ) == FALSE ) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if ( !service_url ) service_url = NULLSTRING; if ( !username ) username = NULLSTRING; if ( !password ) password = NULLSTRING; MyString reqline; char* esc1 = strdup( escapeGahpString(service_url) ); char* esc2 = strdup( escapeGahpString(username) ); char* esc3 = strdup( escapeGahpString(password) ); bool x = reqline.sprintf(""%s %s %s"", esc1, esc2, esc3); free( esc1 ); free( esc2 ); free( esc3 ); ASSERT( x == true ); const char *buf = reqline.Value(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command, buf, deleg_proxy); } Gahp_Args* result = get_pending_result(command, buf); if ( result ) { int rc = 0; if ( result->argc < 2 || result->argc > 3 ) { EXCEPT( ""Bad %s result"", command ); } else if ( result->argc == 2 ) { if ( !strcmp( result->argv[1], NULLSTRING ) ) { EXCEPT( ""Bad %s result"", command ); } error_string = result->argv[1]; rc = 1; } else { if ( strcmp( result->argv[1], NULLSTRING ) ) { EXCEPT( ""Bad %s result"", command ); } if ( strcmp( result->argv[2], ""TRUE"" ) == 0 ) { *autostart = TRUE; } else if ( strcmp( result->argv[2], ""FALSE"" ) == 0 ) { *autostart = FALSE; } else { EXCEPT( ""Bad %s result"", command ); } } delete result; return rc; } if ( check_pending_timeout(command, buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 " static void Ins_SPVTL( INS_ARG ) { if ( INS_SxVTL( args[1], args[0], CUR.opcode, &CUR.GS.projVector) == FAILURE ) return; CUR.GS.dualVector = CUR.GS.projVector; COMPUTE_Funcs(); } ",0 "bool SetPosixFilePermissions(const FilePath& path, int mode) { base::ThreadRestrictions::AssertIOAllowed(); DCHECK((mode & ~FILE_PERMISSION_MASK) == 0); stat_wrapper_t stat_buf; if (CallStat(path.value().c_str(), &stat_buf) != 0) return false; mode_t updated_mode_bits = stat_buf.st_mode & ~FILE_PERMISSION_MASK; updated_mode_bits |= mode & FILE_PERMISSION_MASK; if (HANDLE_EINTR(chmod(path.value().c_str(), updated_mode_bits)) != 0) return false; return true; } ",0 "void gscms_set_icc_range(cmm_profile_t **icc_profile) { int num_comp = (*icc_profile)->num_comps; int k; for ( k = 0; k < num_comp; k++) { (*icc_profile)->Range.ranges[k].rmin = 0.0; (*icc_profile)->Range.ranges[k].rmax = 1.0; } } ",0 " SoftwareDevice(SynchronousCompositorOutputSurface* surface) : surface_(surface) { } ",0 "v8::Isolate* mainThreadIsolate() { return V8PerIsolateData::mainThreadIsolate(); } ",0 "void WebPluginImpl::TearDownPluginInstance( WebURLLoader* loader_to_ignore) { if (container_) container_->clearScriptObjects(); if (delegate_) { delegate_->PluginDestroyed(); delegate_ = NULL; } std::vector::iterator client_index = clients_.begin(); while (client_index != clients_.end()) { ClientInfo& client_info = *client_index; if (loader_to_ignore == client_info.loader) { client_index++; continue; } if (client_info.loader.get()) client_info.loader->cancel(); client_index = clients_.erase(client_index); } webframe_ = NULL; method_factory_.RevokeAll(); } ",0 "ZEND_API int zend_next_free_module(void) /* {{{ */ { return zend_hash_num_elements(&module_registry) + 1; } /* }}} */ ",0 "int test_gf2m_mod_sqrt(BIO *bp, BN_CTX *ctx) { BIGNUM *a, *b[2], *c, *d, *e, *f; int i, j, ret = 0; int p0[] = { 163, 7, 6, 3, 0, -1 }; int p1[] = { 193, 15, 0, -1 }; a = BN_new(); b[0] = BN_new(); b[1] = BN_new(); c = BN_new(); d = BN_new(); e = BN_new(); f = BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i = 0; i < num0; i++) { BN_bntest_rand(a, 512, 0, 0); for (j = 0; j < 2; j++) { BN_GF2m_mod(c, a, b[j]); BN_GF2m_mod_sqrt(d, a, b[j], ctx); BN_GF2m_mod_sqr(e, d, b[j], ctx); # if 0 /* make test uses ouput in bc but bc can't * handle GF(2^m) arithmetic */ if (bp != NULL) { if (!results) { BN_print(bp, d); BIO_puts(bp, "" ^ 2 - ""); BN_print(bp, a); BIO_puts(bp, ""\n""); } } # endif BN_GF2m_add(f, c, e); /* Test that d^2 = a, where d = sqrt(a). */ if (!BN_is_zero(f)) { fprintf(stderr, ""GF(2^m) modular square root test failed!\n""); goto err; } } } ret = 1; err: BN_free(a); BN_free(b[0]); BN_free(b[1]); BN_free(c); BN_free(d); BN_free(e); BN_free(f); return ret; } ",0 "int XMLRPC_GetResponseFaultCode(XMLRPC_REQUEST response) { return XMLRPC_GetValueFaultCode( XMLRPC_RequestGetData(response) ); } ",0 "StreamingProcessor::~StreamingProcessor() { deletePreviewStream(); deleteRecordingStream(); } ",0 "static void DefaultFatalErrorHandler(const ExceptionType severity, const char *reason,const char *description) { if (reason == (char *) NULL) return; (void) FormatLocaleFile(stderr,""%s: %s"",GetClientName(),reason); if (description != (char *) NULL) (void) FormatLocaleFile(stderr,"" (%s)"",description); (void) FormatLocaleFile(stderr,"".\n""); (void) fflush(stderr); MagickCoreTerminus(); exit((int) (severity-FatalErrorException)+1); } ",0 "static int blkcipher_walk_first(struct blkcipher_desc *desc, struct blkcipher_walk *walk) { struct crypto_blkcipher *tfm = desc->tfm; unsigned int alignmask = crypto_blkcipher_alignmask(tfm); if (WARN_ON_ONCE(in_irq())) return -EDEADLK; walk->nbytes = walk->total; if (unlikely(!walk->total)) return 0; walk->buffer = NULL; walk->iv = desc->info; if (unlikely(((unsigned long)walk->iv & alignmask))) { int err = blkcipher_copy_iv(walk, tfm, alignmask); if (err) return err; } scatterwalk_start(&walk->in, walk->in.sg); scatterwalk_start(&walk->out, walk->out.sg); walk->page = NULL; return blkcipher_walk_next(desc, walk); } ",0 "unsigned long nr_iowait(void) { unsigned long i, sum = 0; for_each_possible_cpu(i) sum += atomic_read(&cpu_rq(i)->nr_iowait); return sum; } ",0 "LayerTreeHost::ReleaseCompositorFrameSink() { DCHECK(!visible_); DidLoseCompositorFrameSink(); proxy_->ReleaseCompositorFrameSink(); return std::move(current_compositor_frame_sink_); } ",0 "void js_pushundefined(js_State *J) { CHECKSTACK(1); STACK[TOP].type = JS_TUNDEFINED; ++TOP; } ",0 "static int h2s_frt_make_resp_headers(struct h2s *h2s, struct buffer *buf) { struct http_hdr list[MAX_HTTP_HDR]; struct h2c *h2c = h2s->h2c; struct h1m *h1m = &h2s->res; struct chunk outbuf; int es_now = 0; int ret = 0; int hdr; if (h2c_mux_busy(h2c, h2s)) { h2s->flags |= H2_SF_BLK_MBUSY; return 0; } if (!h2_get_buf(h2c, &h2c->mbuf)) { h2c->flags |= H2_CF_MUX_MALLOC; h2s->flags |= H2_SF_BLK_MROOM; return 0; } /* First, try to parse the H1 response and index it into . * NOTE! Since it comes from haproxy, we *know* that a response header * block does not wrap and we can safely read it this way without * having to realign the buffer. */ ret = h1_headers_to_hdr_list(bo_ptr(buf), bo_ptr(buf) + buf->o, list, sizeof(list)/sizeof(list[0]), h1m); if (ret <= 0) { /* incomplete or invalid response, this is abnormal coming from * haproxy and may only result in a bad errorfile or bad Lua code * so that won't be fixed, raise an error now. * * FIXME: we should instead add the ability to only return a * 502 bad gateway. But in theory this is not supposed to * happen. */ h2s_error(h2s, H2_ERR_INTERNAL_ERROR); ret = 0; goto end; } chunk_reset(&outbuf); while (1) { outbuf.str = bo_end(h2c->mbuf); outbuf.size = bo_contig_space(h2c->mbuf); outbuf.len = 0; if (outbuf.size >= 9 || !buffer_space_wraps(h2c->mbuf)) break; realign_again: buffer_slow_realign(h2c->mbuf); } if (outbuf.size < 9) { h2c->flags |= H2_CF_MUX_MFULL; h2s->flags |= H2_SF_BLK_MROOM; ret = 0; goto end; } /* len: 0x000000 (fill later), type: 1(HEADERS), flags: ENDH=4 */ memcpy(outbuf.str, ""\x00\x00\x00\x01\x04"", 5); write_n32(outbuf.str + 5, h2s->id); // 4 bytes outbuf.len = 9; /* encode status, which necessarily is the first one */ if (outbuf.len < outbuf.size && h1m->status == 200) outbuf.str[outbuf.len++] = 0x88; // indexed field : idx[08]=("":status"", ""200"") else if (outbuf.len < outbuf.size && h1m->status == 304) outbuf.str[outbuf.len++] = 0x8b; // indexed field : idx[11]=("":status"", ""304"") else if (unlikely(list[0].v.len != 3)) { /* this is an unparsable response */ h2s_error(h2s, H2_ERR_INTERNAL_ERROR); ret = 0; goto end; } else if (unlikely(outbuf.len + 2 + 3 <= outbuf.size)) { /* basic encoding of the status code */ outbuf.str[outbuf.len++] = 0x48; // indexed name -- name="":status"" (idx 8) outbuf.str[outbuf.len++] = 0x03; // 3 bytes status outbuf.str[outbuf.len++] = list[0].v.ptr[0]; outbuf.str[outbuf.len++] = list[0].v.ptr[1]; outbuf.str[outbuf.len++] = list[0].v.ptr[2]; } else { if (buffer_space_wraps(h2c->mbuf)) goto realign_again; h2c->flags |= H2_CF_MUX_MFULL; h2s->flags |= H2_SF_BLK_MROOM; ret = 0; goto end; } /* encode all headers, stop at empty name */ for (hdr = 1; hdr < sizeof(list)/sizeof(list[0]); hdr++) { /* these ones do not exist in H2 and must be dropped. */ if (isteq(list[hdr].n, ist(""connection"")) || isteq(list[hdr].n, ist(""proxy-connection"")) || isteq(list[hdr].n, ist(""keep-alive"")) || isteq(list[hdr].n, ist(""upgrade"")) || isteq(list[hdr].n, ist(""transfer-encoding""))) continue; if (isteq(list[hdr].n, ist(""""))) break; // end if (!hpack_encode_header(&outbuf, list[hdr].n, list[hdr].v)) { /* output full */ if (buffer_space_wraps(h2c->mbuf)) goto realign_again; h2c->flags |= H2_CF_MUX_MFULL; h2s->flags |= H2_SF_BLK_MROOM; ret = 0; goto end; } } /* we may need to add END_STREAM */ if (((h1m->flags & H1_MF_CLEN) && !h1m->body_len) || h2s->cs->flags & CS_FL_SHW) es_now = 1; /* update the frame's size */ h2_set_frame_size(outbuf.str, outbuf.len - 9); if (es_now) outbuf.str[4] |= H2_F_HEADERS_END_STREAM; /* consume incoming H1 response */ bo_del(buf, ret); /* commit the H2 response */ h2c->mbuf->o += outbuf.len; h2c->mbuf->p = b_ptr(h2c->mbuf, outbuf.len); h2s->flags |= H2_SF_HEADERS_SENT; /* for now we don't implemented CONTINUATION, so we wait for a * body or directly end in TRL2. */ if (es_now) { bo_del(buf, buf->o); h1m->state = HTTP_MSG_DONE; h2s->flags |= H2_SF_ES_SENT; if (h2s->st == H2_SS_OPEN) h2s->st = H2_SS_HLOC; else h2s_close(h2s); } else if (h1m->status >= 100 && h1m->status < 200) { /* we'll let the caller check if it has more headers to send */ h1m->state = HTTP_MSG_RPBEFORE; h1m->status = 0; h1m->flags = 0; goto end; } else h1m->state = (h1m->flags & H1_MF_CHNK) ? HTTP_MSG_CHUNK_SIZE : HTTP_MSG_BODY; end: return ret; } ",0 "static int lzo_init(struct crypto_tfm *tfm) { struct lzo_ctx *ctx = crypto_tfm_ctx(tfm); ctx->lzo_comp_mem = kmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL | __GFP_NOWARN | __GFP_REPEAT); if (!ctx->lzo_comp_mem) ctx->lzo_comp_mem = vmalloc(LZO1X_MEM_COMPRESS); if (!ctx->lzo_comp_mem) return -ENOMEM; return 0; } ",0 " virtual InputMethodDescriptors* GetSupportedInputMethods() { return GetInputMethodDescriptorsForTesting(); } ",1 "void destroy_node_manager(struct f2fs_sb_info *sbi) { struct f2fs_nm_info *nm_i = NM_I(sbi); struct free_nid *i, *next_i; struct nat_entry *natvec[NATVEC_SIZE]; struct nat_entry_set *setvec[SETVEC_SIZE]; nid_t nid = 0; unsigned int found; if (!nm_i) return; /* destroy free nid list */ spin_lock(&nm_i->nid_list_lock); list_for_each_entry_safe(i, next_i, &nm_i->nid_list[FREE_NID_LIST], list) { __remove_nid_from_list(sbi, i, FREE_NID_LIST, false); spin_unlock(&nm_i->nid_list_lock); kmem_cache_free(free_nid_slab, i); spin_lock(&nm_i->nid_list_lock); } f2fs_bug_on(sbi, nm_i->nid_cnt[FREE_NID_LIST]); f2fs_bug_on(sbi, nm_i->nid_cnt[ALLOC_NID_LIST]); f2fs_bug_on(sbi, !list_empty(&nm_i->nid_list[ALLOC_NID_LIST])); spin_unlock(&nm_i->nid_list_lock); /* destroy nat cache */ down_write(&nm_i->nat_tree_lock); while ((found = __gang_lookup_nat_cache(nm_i, nid, NATVEC_SIZE, natvec))) { unsigned idx; nid = nat_get_nid(natvec[found - 1]) + 1; for (idx = 0; idx < found; idx++) __del_from_nat_cache(nm_i, natvec[idx]); } f2fs_bug_on(sbi, nm_i->nat_cnt); /* destroy nat set cache */ nid = 0; while ((found = __gang_lookup_nat_set(nm_i, nid, SETVEC_SIZE, setvec))) { unsigned idx; nid = setvec[found - 1]->set + 1; for (idx = 0; idx < found; idx++) { /* entry_cnt is not zero, when cp_error was occurred */ f2fs_bug_on(sbi, !list_empty(&setvec[idx]->entry_list)); radix_tree_delete(&nm_i->nat_set_root, setvec[idx]->set); kmem_cache_free(nat_entry_set_slab, setvec[idx]); } } up_write(&nm_i->nat_tree_lock); kvfree(nm_i->nat_block_bitmap); kvfree(nm_i->free_nid_bitmap); kvfree(nm_i->free_nid_count); kfree(nm_i->nat_bitmap); kfree(nm_i->nat_bits); #ifdef CONFIG_F2FS_CHECK_FS kfree(nm_i->nat_bitmap_mir); #endif sbi->nm_info = NULL; kfree(nm_i); } ",0 "R_API ut64 r_bin_java_bootstrap_methods_attr_calc_size(RBinJavaAttrInfo *attr) { RListIter *iter, *iter_tmp; RBinJavaBootStrapMethod *bsm = NULL; ut64 size = 0; if (attr) { size += 6; size += 2; r_list_foreach_safe (attr->info.bootstrap_methods_attr.bootstrap_methods, iter, iter_tmp, bsm) { if (bsm) { size += r_bin_java_bootstrap_method_calc_size (bsm); } else { } } } return size; } ",0 "static bool isValidNameNonASCII(const UChar* characters, unsigned length) { for (unsigned i = 0; i < length;) { bool first = i == 0; UChar32 c; U16_NEXT(characters, i, length, c); // Increments i. if (first ? !isValidNameStart(c) : !isValidNamePart(c)) return false; } return true; } ",0 "static void OverloadedPerWorldBindingsMethod2Method(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""overloadedPerWorldBindingsMethod""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); int32_t long_arg; long_arg = NativeValueTraits::NativeValue(info.GetIsolate(), info[0], exception_state); if (exception_state.HadException()) return; impl->overloadedPerWorldBindingsMethod(long_arg); } ",0 "static HB_Error Do_ContextPos( GPOS_Instance* gpi, HB_UShort GlyphCount, HB_UShort PosCount, HB_PosLookupRecord* pos, HB_Buffer buffer, int nesting_level ) { HB_Error error; HB_UInt i, old_pos; i = 0; while ( i < GlyphCount ) { if ( PosCount && i == pos->SequenceIndex ) { old_pos = buffer->in_pos; /* Do a positioning */ error = GPOS_Do_Glyph_Lookup( gpi, pos->LookupListIndex, buffer, GlyphCount, nesting_level ); if ( error ) return error; pos++; PosCount--; i += buffer->in_pos - old_pos; } else { i++; (buffer->in_pos)++; } } return HB_Err_Ok; } ",0 "mrb_fiber_resume(mrb_state *mrb, mrb_value fib, mrb_int len, const mrb_value *a) { return fiber_switch(mrb, fib, len, a, TRUE, TRUE); } ",0 " static void Unregister(const GURL& url) { EXPECT_TRUE( content::BrowserThread::CurrentlyOn(content::BrowserThread::IO)); net::URLRequestFilter::GetInstance()->RemoveUrlHandler(url); } ",1 "int main(int argc, char** argv) { /* Kernel starts us with all fd's closed. * But it's dangerous: * fprintf(stderr) can dump messages into random fds, etc. * Ensure that if any of fd 0,1,2 is closed, we open it to /dev/null. */ int fd = xopen(""/dev/null"", O_RDWR); while (fd < 2) fd = xdup(fd); if (fd > 2) close(fd); if (argc < 8) { /* percent specifier: %s %c %p %u %g %t %e %h */ /* argv: [0] [1] [2] [3] [4] [5] [6] [7] [8]*/ error_msg_and_die(""Usage: %s SIGNO CORE_SIZE_LIMIT PID UID GID TIME BINARY_NAME [HOSTNAME]"", argv[0]); } /* Not needed on 2.6.30. * At least 2.6.18 has a bug where * argv[1] = ""SIGNO CORE_SIZE_LIMIT PID ..."" * argv[2] = ""CORE_SIZE_LIMIT PID ..."" * and so on. Fixing it: */ if (strchr(argv[1], ' ')) { int i; for (i = 1; argv[i]; i++) { strchrnul(argv[i], ' ')[0] = '\0'; } } logmode = LOGMODE_JOURNAL; /* Parse abrt.conf */ load_abrt_conf(); /* ... and plugins/CCpp.conf */ bool setting_MakeCompatCore; bool setting_SaveBinaryImage; { map_string_t *settings = new_map_string(); load_abrt_plugin_conf_file(""CCpp.conf"", settings); const char *value; value = get_map_string_item_or_NULL(settings, ""MakeCompatCore""); setting_MakeCompatCore = value && string_to_bool(value); value = get_map_string_item_or_NULL(settings, ""SaveBinaryImage""); setting_SaveBinaryImage = value && string_to_bool(value); value = get_map_string_item_or_NULL(settings, ""VerboseLog""); if (value) g_verbose = xatoi_positive(value); free_map_string(settings); } errno = 0; const char* signal_str = argv[1]; int signal_no = xatoi_positive(signal_str); off_t ulimit_c = strtoull(argv[2], NULL, 10); if (ulimit_c < 0) /* unlimited? */ { /* set to max possible >0 value */ ulimit_c = ~((off_t)1 << (sizeof(off_t)*8-1)); } const char *pid_str = argv[3]; pid_t pid = xatoi_positive(argv[3]); uid_t uid = xatoi_positive(argv[4]); if (errno || pid <= 0) { perror_msg_and_die(""PID '%s' or limit '%s' is bogus"", argv[3], argv[2]); } { char *s = xmalloc_fopen_fgetline_fclose(VAR_RUN""/abrt/saved_core_pattern""); /* If we have a saved pattern and it's not a ""|PROG ARGS"" thing... */ if (s && s[0] != '|') core_basename = s; else free(s); } struct utsname uts; if (!argv[8]) /* no HOSTNAME? */ { uname(&uts); argv[8] = uts.nodename; } char path[PATH_MAX]; int src_fd_binary = -1; char *executable = get_executable(pid, setting_SaveBinaryImage ? &src_fd_binary : NULL); if (executable && strstr(executable, ""/abrt-hook-ccpp"")) { error_msg_and_die(""PID %lu is '%s', not dumping it to avoid recursion"", (long)pid, executable); } user_pwd = get_cwd(pid); /* may be NULL on error */ log_notice(""user_pwd:'%s'"", user_pwd); sprintf(path, ""/proc/%lu/status"", (long)pid); proc_pid_status = xmalloc_xopen_read_close(path, /*maxsz:*/ NULL); uid_t fsuid = uid; uid_t tmp_fsuid = get_fsuid(); int suid_policy = dump_suid_policy(); if (tmp_fsuid != uid) { /* use root for suided apps unless it's explicitly set to UNSAFE */ fsuid = 0; if (suid_policy == DUMP_SUID_UNSAFE) { fsuid = tmp_fsuid; } } /* Open a fd to compat coredump, if requested and is possible */ if (setting_MakeCompatCore && ulimit_c != 0) /* note: checks ""user_pwd == NULL"" inside; updates core_basename */ user_core_fd = open_user_core(uid, fsuid, pid, &argv[1]); if (executable == NULL) { /* readlink on /proc/$PID/exe failed, don't create abrt dump dir */ error_msg(""Can't read /proc/%lu/exe link"", (long)pid); goto create_user_core; } const char *signame = NULL; switch (signal_no) { case SIGILL : signame = ""ILL"" ; break; case SIGFPE : signame = ""FPE"" ; break; case SIGSEGV: signame = ""SEGV""; break; case SIGBUS : signame = ""BUS"" ; break; //Bus error (bad memory access) case SIGABRT: signame = ""ABRT""; break; //usually when abort() was called case SIGTRAP: signame = ""TRAP""; break; //Trace/breakpoint trap default: goto create_user_core; // not a signal we care about } if (!daemon_is_ok()) { /* not an error, exit with exit code 0 */ log(""abrtd is not running. If it crashed, "" ""/proc/sys/kernel/core_pattern contains a stale value, "" ""consider resetting it to 'core'"" ); goto create_user_core; } if (g_settings_nMaxCrashReportsSize > 0) { /* If free space is less than 1/4 of MaxCrashReportsSize... */ if (low_free_space(g_settings_nMaxCrashReportsSize, g_settings_dump_location)) goto create_user_core; } /* Check /var/tmp/abrt/last-ccpp marker, do not dump repeated crashes * if they happen too often. Else, write new marker value. */ snprintf(path, sizeof(path), ""%s/last-ccpp"", g_settings_dump_location); if (check_recent_crash_file(path, executable)) { /* It is a repeating crash */ goto create_user_core; } const char *last_slash = strrchr(executable, '/'); if (last_slash && strncmp(++last_slash, ""abrt"", 4) == 0) { /* If abrtd/abrt-foo crashes, we don't want to create a _directory_, * since that can make new copy of abrtd to process it, * and maybe crash again... * Unlike dirs, mere files are ignored by abrtd. */ snprintf(path, sizeof(path), ""%s/%s-coredump"", g_settings_dump_location, last_slash); int abrt_core_fd = xopen3(path, O_WRONLY | O_CREAT | O_TRUNC, 0600); off_t core_size = copyfd_eof(STDIN_FILENO, abrt_core_fd, COPYFD_SPARSE); if (core_size < 0 || fsync(abrt_core_fd) != 0) { unlink(path); /* copyfd_eof logs the error including errno string, * but it does not log file name */ error_msg_and_die(""Error saving '%s'"", path); } log(""Saved core dump of pid %lu (%s) to %s (%llu bytes)"", (long)pid, executable, path, (long long)core_size); return 0; } unsigned path_len = snprintf(path, sizeof(path), ""%s/ccpp-%s-%lu.new"", g_settings_dump_location, iso_date_string(NULL), (long)pid); if (path_len >= (sizeof(path) - sizeof(""/""FILENAME_COREDUMP))) { goto create_user_core; } /* use fsuid instead of uid, so we don't expose any sensitive * information of suided app in /var/tmp/abrt */ dd = dd_create(path, fsuid, DEFAULT_DUMP_DIR_MODE); if (dd) { char *rootdir = get_rootdir(pid); dd_create_basic_files(dd, fsuid, (rootdir && strcmp(rootdir, ""/"") != 0) ? rootdir : NULL); char source_filename[sizeof(""/proc/%lu/somewhat_long_name"") + sizeof(long)*3]; int source_base_ofs = sprintf(source_filename, ""/proc/%lu/smaps"", (long)pid); source_base_ofs -= strlen(""smaps""); char *dest_filename = concat_path_file(dd->dd_dirname, ""also_somewhat_longish_name""); char *dest_base = strrchr(dest_filename, '/') + 1; strcpy(source_filename + source_base_ofs, ""maps""); strcpy(dest_base, FILENAME_MAPS); copy_file(source_filename, dest_filename, DEFAULT_DUMP_DIR_MODE); IGNORE_RESULT(chown(dest_filename, dd->dd_uid, dd->dd_gid)); strcpy(source_filename + source_base_ofs, ""limits""); strcpy(dest_base, FILENAME_LIMITS); copy_file(source_filename, dest_filename, DEFAULT_DUMP_DIR_MODE); IGNORE_RESULT(chown(dest_filename, dd->dd_uid, dd->dd_gid)); strcpy(source_filename + source_base_ofs, ""cgroup""); strcpy(dest_base, FILENAME_CGROUP); copy_file(source_filename, dest_filename, DEFAULT_DUMP_DIR_MODE); IGNORE_RESULT(chown(dest_filename, dd->dd_uid, dd->dd_gid)); strcpy(dest_base, FILENAME_OPEN_FDS); if (dump_fd_info(dest_filename, source_filename, source_base_ofs)) IGNORE_RESULT(chown(dest_filename, dd->dd_uid, dd->dd_gid)); free(dest_filename); dd_save_text(dd, FILENAME_ANALYZER, ""CCpp""); dd_save_text(dd, FILENAME_TYPE, ""CCpp""); dd_save_text(dd, FILENAME_EXECUTABLE, executable); dd_save_text(dd, FILENAME_PID, pid_str); dd_save_text(dd, FILENAME_PROC_PID_STATUS, proc_pid_status); if (user_pwd) dd_save_text(dd, FILENAME_PWD, user_pwd); if (rootdir) { if (strcmp(rootdir, ""/"") != 0) dd_save_text(dd, FILENAME_ROOTDIR, rootdir); } char *reason = xasprintf(""%s killed by SIG%s"", last_slash, signame ? signame : signal_str); dd_save_text(dd, FILENAME_REASON, reason); free(reason); char *cmdline = get_cmdline(pid); dd_save_text(dd, FILENAME_CMDLINE, cmdline ? : """"); free(cmdline); char *environ = get_environ(pid); dd_save_text(dd, FILENAME_ENVIRON, environ ? : """"); free(environ); char *fips_enabled = xmalloc_fopen_fgetline_fclose(""/proc/sys/crypto/fips_enabled""); if (fips_enabled) { if (strcmp(fips_enabled, ""0"") != 0) dd_save_text(dd, ""fips_enabled"", fips_enabled); free(fips_enabled); } dd_save_text(dd, FILENAME_ABRT_VERSION, VERSION); if (src_fd_binary > 0) { strcpy(path + path_len, ""/""FILENAME_BINARY); int dst_fd = create_or_die(path); off_t sz = copyfd_eof(src_fd_binary, dst_fd, COPYFD_SPARSE); if (fsync(dst_fd) != 0 || close(dst_fd) != 0 || sz < 0) { dd_delete(dd); error_msg_and_die(""Error saving '%s'"", path); } close(src_fd_binary); } strcpy(path + path_len, ""/""FILENAME_COREDUMP); int abrt_core_fd = create_or_die(path); /* We write both coredumps at once. * We can't write user coredump first, since it might be truncated * and thus can't be copied and used as abrt coredump; * and if we write abrt coredump first and then copy it as user one, * then we have a race when process exits but coredump does not exist yet: * $ echo -e '#include\nmain(){raise(SIGSEGV);}' | gcc -o test -x c - * $ rm -f core*; ulimit -c unlimited; ./test; ls -l core* * 21631 Segmentation fault (core dumped) ./test * ls: cannot access core*: No such file or directory <=== BAD */ off_t core_size = copyfd_sparse(STDIN_FILENO, abrt_core_fd, user_core_fd, ulimit_c); if (fsync(abrt_core_fd) != 0 || close(abrt_core_fd) != 0 || core_size < 0) { unlink(path); dd_delete(dd); if (user_core_fd >= 0) { xchdir(user_pwd); unlink(core_basename); } /* copyfd_sparse logs the error including errno string, * but it does not log file name */ error_msg_and_die(""Error writing '%s'"", path); } if (user_core_fd >= 0 /* error writing user coredump? */ && (fsync(user_core_fd) != 0 || close(user_core_fd) != 0 /* user coredump is too big? */ || (ulimit_c == 0 /* paranoia */ || core_size > ulimit_c) ) ) { /* nuke it (silently) */ xchdir(user_pwd); unlink(core_basename); } /* Save JVM crash log if it exists. (JVM's coredump per se * is nearly useless for JVM developers) */ { char *java_log = xasprintf(""/tmp/jvm-%lu/hs_error.log"", (long)pid); int src_fd = open(java_log, O_RDONLY); free(java_log); /* If we couldn't open the error log in /tmp directory we can try to * read the log from the current directory. It may produce AVC, it * may produce some error log but all these are expected. */ if (src_fd < 0) { java_log = xasprintf(""%s/hs_err_pid%lu.log"", user_pwd, (long)pid); src_fd = open(java_log, O_RDONLY); free(java_log); } if (src_fd >= 0) { strcpy(path + path_len, ""/hs_err.log""); int dst_fd = create_or_die(path); off_t sz = copyfd_eof(src_fd, dst_fd, COPYFD_SPARSE); if (close(dst_fd) != 0 || sz < 0) { dd_delete(dd); error_msg_and_die(""Error saving '%s'"", path); } close(src_fd); } } /* We close dumpdir before we start catering for crash storm case. * Otherwise, delete_dump_dir's from other concurrent * CCpp's won't be able to delete our dump (their delete_dump_dir * will wait for us), and we won't be able to delete their dumps. * Classic deadlock. */ dd_close(dd); path[path_len] = '\0'; /* path now contains only directory name */ char *newpath = xstrndup(path, path_len - (sizeof("".new"")-1)); if (rename(path, newpath) == 0) strcpy(path, newpath); free(newpath); log(""Saved core dump of pid %lu (%s) to %s (%llu bytes)"", (long)pid, executable, path, (long long)core_size); notify_new_path(path); /* rhbz#539551: ""abrt going crazy when crashing process is respawned"" */ if (g_settings_nMaxCrashReportsSize > 0) { /* x1.25 and round up to 64m: go a bit up, so that usual in-daemon trimming * kicks in first, and we don't ""fight"" with it: */ unsigned maxsize = g_settings_nMaxCrashReportsSize + g_settings_nMaxCrashReportsSize / 4; maxsize |= 63; trim_problem_dirs(g_settings_dump_location, maxsize * (double)(1024*1024), path); } free(rootdir); return 0; } /* We didn't create abrt dump, but may need to create compat coredump */ create_user_core: if (user_core_fd >= 0) { off_t core_size = copyfd_size(STDIN_FILENO, user_core_fd, ulimit_c, COPYFD_SPARSE); if (fsync(user_core_fd) != 0 || close(user_core_fd) != 0 || core_size < 0) { /* perror first, otherwise unlink may trash errno */ perror_msg(""Error writing '%s'"", full_core_basename); xchdir(user_pwd); unlink(core_basename); return 1; } if (ulimit_c == 0 || core_size > ulimit_c) { xchdir(user_pwd); unlink(core_basename); return 1; } log(""Saved core dump of pid %lu to %s (%llu bytes)"", (long)pid, full_core_basename, (long long)core_size); } return 0; } ",1 "static inline int tcp_fackets_out(const struct tcp_sock *tp) { return tcp_is_reno(tp) ? tp->sacked_out + 1 : tp->fackets_out; } ",0 "void FileAPIMessageFilter::OnChannelClosing() { BrowserMessageFilter::OnChannelClosing(); for (base::hash_set::const_iterator iter = blob_urls_.begin(); iter != blob_urls_.end(); ++iter) { blob_storage_context_->controller()->RemoveBlob(GURL(*iter)); } if (!open_filesystem_urls_.empty()) { DLOG(INFO) << ""File API: Renderer process shut down before NotifyCloseFile"" << "" for "" << open_filesystem_urls_.size() << "" files opened in PPAPI""; } for (std::multiset::const_iterator iter = open_filesystem_urls_.begin(); iter != open_filesystem_urls_.end(); ++iter) { FileSystemURL url(*iter); FileSystemOperation* operation = context_->CreateFileSystemOperation( url, NULL); if (operation) operation->NotifyCloseFile(url); } } ",0 "SYSCALL_DEFINE3(mknod, const char __user *, filename, umode_t, mode, unsigned, dev) { return sys_mknodat(AT_FDCWD, filename, mode, dev); } ",0 "std::string CryptohomeClient::GetStubSanitizedUsername( const std::string& username) { return username + kUserIdStubHashSuffix; } ",0 "PassRefPtr CSSComputedStyleDeclaration::valueForShadow(const ShadowData* shadow, CSSPropertyID propertyID, RenderStyle* style) const { if (!shadow) return cssValuePool().createIdentifierValue(CSSValueNone); RefPtr list = CSSValueList::createCommaSeparated(); for (const ShadowData* s = shadow; s; s = s->next()) { RefPtr x = zoomAdjustedPixelValue(s->x(), style); RefPtr y = zoomAdjustedPixelValue(s->y(), style); RefPtr blur = zoomAdjustedPixelValue(s->blur(), style); RefPtr spread = propertyID == CSSPropertyTextShadow ? PassRefPtr() : zoomAdjustedPixelValue(s->spread(), style); RefPtr style = propertyID == CSSPropertyTextShadow || s->style() == Normal ? PassRefPtr() : cssValuePool().createIdentifierValue(CSSValueInset); RefPtr color = cssValuePool().createColorValue(s->color().rgb()); list->prepend(ShadowValue::create(x.release(), y.release(), blur.release(), spread.release(), style.release(), color.release())); } return list.release(); } ",0 "static inline bool vmacache_valid_mm(struct mm_struct *mm) { return current->mm == mm && !(current->flags & PF_KTHREAD); } ",0 "bool ObjectBackedNativeHandler::GetPrivate(v8::Local context, v8::Local obj, const char* key, v8::Local* result) { return obj->GetPrivate(context, v8::Private::ForApi(context->GetIsolate(), v8::String::NewFromUtf8( context->GetIsolate(), key))) .ToLocal(result); } ",0 "static void OverloadedPerWorldBindingsMethodMethod(const v8::FunctionCallbackInfo& info) { scheduler::CooperativeSchedulingManager::Instance()->Safepoint(); bool is_arity_error = false; switch (std::min(1, info.Length())) { case 0: if (true) { OverloadedPerWorldBindingsMethod1Method(info); return; } break; case 1: if (true) { OverloadedPerWorldBindingsMethod2Method(info); return; } break; default: is_arity_error = true; } ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""overloadedPerWorldBindingsMethod""); if (is_arity_error) { } exception_state.ThrowTypeError(""No function was found that matched the signature provided.""); } ",0 "pushParseTest(const char *filename, const char *result, const char *err ATTRIBUTE_UNUSED, int options) { xmlParserCtxtPtr ctxt; xmlDocPtr doc; const char *base; int size, res; int cur = 0; nb_tests++; /* * load the document in memory and work from there. */ if (loadMem(filename, &base, &size) != 0) { fprintf(stderr, ""Failed to load %s\n"", filename); return(-1); } #ifdef LIBXML_HTML_ENABLED if (options & XML_PARSE_HTML) ctxt = htmlCreatePushParserCtxt(NULL, NULL, base + cur, 4, filename, XML_CHAR_ENCODING_NONE); else #endif ctxt = xmlCreatePushParserCtxt(NULL, NULL, base + cur, 4, filename); xmlCtxtUseOptions(ctxt, options); cur += 4; do { if (cur + 1024 >= size) { #ifdef LIBXML_HTML_ENABLED if (options & XML_PARSE_HTML) htmlParseChunk(ctxt, base + cur, size - cur, 1); else #endif xmlParseChunk(ctxt, base + cur, size - cur, 1); break; } else { #ifdef LIBXML_HTML_ENABLED if (options & XML_PARSE_HTML) htmlParseChunk(ctxt, base + cur, 1024, 0); else #endif xmlParseChunk(ctxt, base + cur, 1024, 0); cur += 1024; } } while (cur < size); doc = ctxt->myDoc; #ifdef LIBXML_HTML_ENABLED if (options & XML_PARSE_HTML) res = 1; else #endif res = ctxt->wellFormed; xmlFreeParserCtxt(ctxt); free((char *)base); if (!res) { xmlFreeDoc(doc); fprintf(stderr, ""Failed to parse %s\n"", filename); return(-1); } #ifdef LIBXML_HTML_ENABLED if (options & XML_PARSE_HTML) htmlDocDumpMemory(doc, (xmlChar **) &base, &size); else #endif xmlDocDumpMemory(doc, (xmlChar **) &base, &size); xmlFreeDoc(doc); res = compareFileMem(result, base, size); if ((base == NULL) || (res != 0)) { if (base != NULL) xmlFree((char *)base); fprintf(stderr, ""Result for %s failed in %s\n"", filename, result); return(-1); } xmlFree((char *)base); if (err != NULL) { res = compareFileMem(err, testErrors, testErrorsSize); if (res != 0) { fprintf(stderr, ""Error for %s failed\n"", filename); return(-1); } } return(0); } ",0 "void CameraClient::handleGenericDataTimestamp(nsecs_t timestamp, int32_t msgType, const sp& dataPtr) { sp c = mRemoteCallback; mLock.unlock(); if (c != 0) { c->dataCallbackTimestamp(timestamp, msgType, dataPtr); } } ",0 "static __always_inline int __vfs_follow_link(struct nameidata *nd, const char *link) { int res = 0; char *name; if (IS_ERR(link)) goto fail; if (*link == '/') { set_root(nd); path_put(&nd->path); nd->path = nd->root; path_get(&nd->root); } res = link_path_walk(link, nd); if (nd->depth || res || nd->last_type!=LAST_NORM) return res; /* * If it is an iterative symlinks resolution in open_namei() we * have to copy the last component. And all that crap because of * bloody create() on broken symlinks. Furrfu... */ name = __getname(); if (unlikely(!name)) { path_put(&nd->path); return -ENOMEM; } strcpy(name, nd->last.name); nd->last.name = name; return 0; fail: path_put(&nd->path); return PTR_ERR(link); } ",0 "running_vrrp(void) { return (__test_bit(DAEMON_VRRP, &daemon_mode) && (global_data->have_vrrp_config || __test_bit(RUN_ALL_CHILDREN, &daemon_mode))); } ",0 "void BrowserCommandController::UpdateCommandsForIncognitoAvailability() { IncognitoModePrefs::Availability incognito_availability = IncognitoModePrefs::GetAvailability(profile()->GetPrefs()); command_updater_.UpdateCommandEnabled( IDC_NEW_WINDOW, incognito_availability != IncognitoModePrefs::FORCED); command_updater_.UpdateCommandEnabled( IDC_NEW_INCOGNITO_WINDOW, incognito_availability != IncognitoModePrefs::DISABLED); const bool command_enabled = incognito_availability != IncognitoModePrefs::FORCED; command_updater_.UpdateCommandEnabled( IDC_SHOW_BOOKMARK_MANAGER, browser_defaults::bookmarks_enabled && command_enabled); ExtensionService* extension_service = profile()->GetExtensionService(); bool enable_extensions = extension_service && extension_service->extensions_enabled(); command_updater_.UpdateCommandEnabled(IDC_MANAGE_EXTENSIONS, enable_extensions && command_enabled); const bool show_main_ui = IsShowingMainUI(window() && window()->IsFullscreen()); command_updater_.UpdateCommandEnabled(IDC_IMPORT_SETTINGS, show_main_ui && command_enabled); command_updater_.UpdateCommandEnabled(IDC_OPTIONS, show_main_ui && command_enabled); } ",0 "bool SharedMemory::Delete(const std::string& name) { FilePath path; if (!FilePathForMemoryName(name, &path)) return false; if (file_util::PathExists(path)) { return base::Delete(path, false); } return true; } ",0 "void SimulateGesturePinchSequence(WebContents* web_contents, const gfx::Point& point, float scale, blink::WebGestureDevice source_device) { RenderWidgetHostImpl* widget_host = RenderWidgetHostImpl::From( web_contents->GetRenderViewHost()->GetWidget()); blink::WebGestureEvent pinch_begin(blink::WebInputEvent::kGesturePinchBegin, blink::WebInputEvent::kNoModifiers, ui::EventTimeForNow(), source_device); pinch_begin.SetPositionInWidget(gfx::PointF(point)); pinch_begin.SetPositionInScreen(gfx::PointF(point)); widget_host->ForwardGestureEvent(pinch_begin); blink::WebGestureEvent pinch_update(pinch_begin); pinch_update.SetType(blink::WebInputEvent::kGesturePinchUpdate); pinch_update.data.pinch_update.scale = scale; widget_host->ForwardGestureEvent(pinch_update); blink::WebGestureEvent pinch_end(pinch_begin); pinch_update.SetType(blink::WebInputEvent::kGesturePinchEnd); widget_host->ForwardGestureEvent(pinch_end); } ",0 "static void locationAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValueFast(info, WTF::getPtr(imp->location()), imp); } ",0 "void Field_CompletePlayerName( const char **names, int nameCount ) { qboolean whitespace; matchCount = 0; shortestMatch[ 0 ] = 0; if( nameCount <= 0 ) return; Name_PlayerNameCompletion( names, nameCount, FindMatches ); if( completionString[0] == '\0' ) { Com_PlayerNameToFieldString( shortestMatch, sizeof( shortestMatch ), names[ 0 ] ); } if( completionString[0] != '\0' && Q_stricmp( shortestMatch, completionString ) == 0 && nameCount > 1 ) { int i; for( i = 0; i < nameCount; i++ ) { if( Q_stricmp( names[ i ], completionString ) == 0 ) { i++; if( i >= nameCount ) { i = 0; } Com_PlayerNameToFieldString( shortestMatch, sizeof( shortestMatch ), names[ i ] ); break; } } } if( matchCount > 1 ) { Com_Printf( ""]%s\n"", completionField->buffer ); Name_PlayerNameCompletion( names, nameCount, PrintMatches ); } whitespace = nameCount == 1? qtrue: qfalse; if( !Field_CompletePlayerNameFinal( whitespace ) ) { } } ",0 "static int get_fsuid(void) { return get_proc_fs_id(/*UID*/'U'); } ",0 " int handle_volume_down_count() const { return handle_volume_down_count_; } ",0 "static RELOC_PTRS_WITH(dc_colored_masked_reloc_ptrs, gx_device_color *cptr) { RELOC_SUPER(gx_device_color, st_client_color, ccolor); if (cptr->colors.colored.c_ht != 0) { RELOC_PTR(gx_device_color, colors.colored.c_ht); } } ",0 "_crypt_extended_r(const char *key, const char *setting, struct php_crypt_extended_data *data) { int i; uint32_t count, salt, l, r0, r1, keybuf[2]; u_char *p, *q; if (!data->initialized) des_init_local(data); /* * Copy the key, shifting each character up by one bit * and padding with zeros. */ q = (u_char *) keybuf; while (q - (u_char *) keybuf < sizeof(keybuf)) { if ((*q++ = *key << 1)) key++; } if (des_setkey((u_char *) keybuf, data)) if (*setting == _PASSWORD_EFMT1) { /* * ""new""-style: * setting - underscore, 4 chars of count, 4 chars of salt * key - unlimited characters */ for (i = 1, count = 0; i < 5; i++) { int value = ascii_to_bin(setting[i]); if (ascii64[value] != setting[i]) return(NULL); count |= value << (i - 1) * 6; } if (!count) return(NULL); for (i = 5, salt = 0; i < 9; i++) { int value = ascii_to_bin(setting[i]); if (ascii64[value] != setting[i]) return(NULL); salt |= value << (i - 5) * 6; } while (*key) { /* * Encrypt the key with itself. */ if (des_cipher((u_char *) keybuf, (u_char *) keybuf, 0, 1, data)) return(NULL); /* * And XOR with the next 8 characters of the key. */ q = (u_char *) keybuf; while (q - (u_char *) keybuf < sizeof(keybuf) && *key) *q++ ^= *key++ << 1; if (des_setkey((u_char *) keybuf, data)) return(NULL); } memcpy(data->output, setting, 9); data->output[9] = '\0'; p = (u_char *) data->output + 9; } else { /* * ""old""-style: * setting - 2 chars of salt * key - up to 8 characters */ count = 25; if (ascii_is_unsafe(setting[0]) || ascii_is_unsafe(setting[1])) return(NULL); salt = (ascii_to_bin(setting[1]) << 6) | ascii_to_bin(setting[0]); data->output[0] = setting[0]; data->output[1] = setting[1]; p = (u_char *) data->output + 2; } setup_salt(salt, data); /* * Do it. */ if (do_des(0, 0, &r0, &r1, count, data)) return(NULL); /* * Now encode the result... */ l = (r0 >> 8); *p++ = ascii64[(l >> 18) & 0x3f]; *p++ = ascii64[(l >> 12) & 0x3f]; *p++ = ascii64[(l >> 6) & 0x3f]; *p++ = ascii64[l & 0x3f]; l = (r0 << 16) | ((r1 >> 16) & 0xffff); *p++ = ascii64[(l >> 18) & 0x3f]; *p++ = ascii64[(l >> 12) & 0x3f]; *p++ = ascii64[(l >> 6) & 0x3f]; *p++ = ascii64[l & 0x3f]; l = r1 << 2; *p++ = ascii64[(l >> 12) & 0x3f]; *p++ = ascii64[(l >> 6) & 0x3f]; *p++ = ascii64[l & 0x3f]; *p = 0; return(data->output); } ",1 " static unsigned int seedsize(struct crypto_alg *alg) { struct rng_alg *ralg = container_of(alg, struct rng_alg, base); return alg->cra_rng.rng_make_random ? alg->cra_rng.seedsize : ralg->seedsize; } ",1 "static v8::Handle methodWithOptionalArgCallback(const v8::Arguments& args) { INC_STATS(""DOM.TestObj.methodWithOptionalArg""); TestObj* imp = V8TestObj::toNative(args.Holder()); if (args.Length() <= 0) { imp->methodWithOptionalArg(); return v8::Handle(); } EXCEPTION_BLOCK(int, opt, toInt32(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))); imp->methodWithOptionalArg(opt); return v8::Handle(); } ",0 "ChromeMetricsServiceClient::FilterBrowserMetricsFiles( const base::FilePath& path) { base::ProcessId pid; if (!base::GlobalHistogramAllocator::ParseFilePath(path, nullptr, nullptr, &pid)) { return metrics::FileMetricsProvider::FILTER_PROCESS_FILE; } if (pid == base::GetCurrentProcId()) return metrics::FileMetricsProvider::FILTER_ACTIVE_THIS_PID; if (IsProcessRunning(pid)) return metrics::FileMetricsProvider::FILTER_TRY_LATER; return metrics::FileMetricsProvider::FILTER_PROCESS_FILE; } ",0 "static int fuse_send_open(struct fuse_conn *fc, u64 nodeid, struct file *file, int opcode, struct fuse_open_out *outargp) { struct fuse_open_in inarg; FUSE_ARGS(args); memset(&inarg, 0, sizeof(inarg)); inarg.flags = file->f_flags & ~(O_CREAT | O_EXCL | O_NOCTTY); if (!fc->atomic_o_trunc) inarg.flags &= ~O_TRUNC; args.in.h.opcode = opcode; args.in.h.nodeid = nodeid; args.in.numargs = 1; args.in.args[0].size = sizeof(inarg); args.in.args[0].value = &inarg; args.out.numargs = 1; args.out.args[0].size = sizeof(*outargp); args.out.args[0].value = outargp; return fuse_simple_request(fc, &args); } ",0 "static int mxf_read_partition_pack(void *arg, AVIOContext *pb, int tag, int size, UID uid, int64_t klv_offset) { MXFContext *mxf = arg; MXFPartition *partition, *tmp_part; UID op; uint64_t footer_partition; uint32_t nb_essence_containers; tmp_part = av_realloc_array(mxf->partitions, mxf->partitions_count + 1, sizeof(*mxf->partitions)); if (!tmp_part) return AVERROR(ENOMEM); mxf->partitions = tmp_part; if (mxf->parsing_backward) { /* insert the new partition pack in the middle * this makes the entries in mxf->partitions sorted by offset */ memmove(&mxf->partitions[mxf->last_forward_partition+1], &mxf->partitions[mxf->last_forward_partition], (mxf->partitions_count - mxf->last_forward_partition)*sizeof(*mxf->partitions)); partition = mxf->current_partition = &mxf->partitions[mxf->last_forward_partition]; } else { mxf->last_forward_partition++; partition = mxf->current_partition = &mxf->partitions[mxf->partitions_count]; } memset(partition, 0, sizeof(*partition)); mxf->partitions_count++; partition->pack_length = avio_tell(pb) - klv_offset + size; partition->pack_ofs = klv_offset; switch(uid[13]) { case 2: partition->type = Header; break; case 3: partition->type = BodyPartition; break; case 4: partition->type = Footer; break; default: av_log(mxf->fc, AV_LOG_ERROR, ""unknown partition type %i\n"", uid[13]); return AVERROR_INVALIDDATA; } /* consider both footers to be closed (there is only Footer and CompleteFooter) */ partition->closed = partition->type == Footer || !(uid[14] & 1); partition->complete = uid[14] > 2; avio_skip(pb, 4); partition->kag_size = avio_rb32(pb); partition->this_partition = avio_rb64(pb); partition->previous_partition = avio_rb64(pb); footer_partition = avio_rb64(pb); partition->header_byte_count = avio_rb64(pb); partition->index_byte_count = avio_rb64(pb); partition->index_sid = avio_rb32(pb); avio_skip(pb, 8); partition->body_sid = avio_rb32(pb); if (avio_read(pb, op, sizeof(UID)) != sizeof(UID)) { av_log(mxf->fc, AV_LOG_ERROR, ""Failed reading UID\n""); return AVERROR_INVALIDDATA; } nb_essence_containers = avio_rb32(pb); if (partition->this_partition && partition->previous_partition == partition->this_partition) { av_log(mxf->fc, AV_LOG_ERROR, ""PreviousPartition equal to ThisPartition %""PRIx64""\n"", partition->previous_partition); /* override with the actual previous partition offset */ if (!mxf->parsing_backward && mxf->last_forward_partition > 1) { MXFPartition *prev = mxf->partitions + mxf->last_forward_partition - 2; partition->previous_partition = prev->this_partition; } /* if no previous body partition are found point to the header * partition */ if (partition->previous_partition == partition->this_partition) partition->previous_partition = 0; av_log(mxf->fc, AV_LOG_ERROR, ""Overriding PreviousPartition with %""PRIx64""\n"", partition->previous_partition); } /* some files don't have FooterPartition set in every partition */ if (footer_partition) { if (mxf->footer_partition && mxf->footer_partition != footer_partition) { av_log(mxf->fc, AV_LOG_ERROR, ""inconsistent FooterPartition value: %""PRIu64"" != %""PRIu64""\n"", mxf->footer_partition, footer_partition); } else { mxf->footer_partition = footer_partition; } } av_log(mxf->fc, AV_LOG_TRACE, ""PartitionPack: ThisPartition = 0x%""PRIX64 "", PreviousPartition = 0x%""PRIX64"", "" ""FooterPartition = 0x%""PRIX64"", IndexSID = %i, BodySID = %i\n"", partition->this_partition, partition->previous_partition, footer_partition, partition->index_sid, partition->body_sid); /* sanity check PreviousPartition if set */ if (partition->previous_partition && mxf->run_in + partition->previous_partition >= klv_offset) { av_log(mxf->fc, AV_LOG_ERROR, ""PreviousPartition points to this partition or forward\n""); return AVERROR_INVALIDDATA; } if (op[12] == 1 && op[13] == 1) mxf->op = OP1a; else if (op[12] == 1 && op[13] == 2) mxf->op = OP1b; else if (op[12] == 1 && op[13] == 3) mxf->op = OP1c; else if (op[12] == 2 && op[13] == 1) mxf->op = OP2a; else if (op[12] == 2 && op[13] == 2) mxf->op = OP2b; else if (op[12] == 2 && op[13] == 3) mxf->op = OP2c; else if (op[12] == 3 && op[13] == 1) mxf->op = OP3a; else if (op[12] == 3 && op[13] == 2) mxf->op = OP3b; else if (op[12] == 3 && op[13] == 3) mxf->op = OP3c; else if (op[12] == 64&& op[13] == 1) mxf->op = OPSONYOpt; else if (op[12] == 0x10) { /* SMPTE 390m: ""There shall be exactly one essence container"" * The following block deals with files that violate this, namely: * 2011_DCPTEST_24FPS.V.mxf - two ECs, OP1a * abcdefghiv016f56415e.mxf - zero ECs, OPAtom, output by Avid AirSpeed */ if (nb_essence_containers != 1) { MXFOP op = nb_essence_containers ? OP1a : OPAtom; /* only nag once */ if (!mxf->op) av_log(mxf->fc, AV_LOG_WARNING, ""\""OPAtom\"" with %""PRIu32"" ECs - assuming %s\n"", nb_essence_containers, op == OP1a ? ""OP1a"" : ""OPAtom""); mxf->op = op; } else mxf->op = OPAtom; } else { av_log(mxf->fc, AV_LOG_ERROR, ""unknown operational pattern: %02xh %02xh - guessing OP1a\n"", op[12], op[13]); mxf->op = OP1a; } if (partition->kag_size <= 0 || partition->kag_size > (1 << 20)) { av_log(mxf->fc, AV_LOG_WARNING, ""invalid KAGSize %""PRId32"" - guessing "", partition->kag_size); if (mxf->op == OPSONYOpt) partition->kag_size = 512; else partition->kag_size = 1; av_log(mxf->fc, AV_LOG_WARNING, ""%""PRId32""\n"", partition->kag_size); } return 0; } ",0 "static void tcp_try_to_open(struct sock *sk, int flag) { struct tcp_sock *tp = tcp_sk(sk); tcp_verify_left_out(tp); if (!tp->frto_counter && !tcp_any_retrans_done(sk)) tp->retrans_stamp = 0; if (flag & FLAG_ECE) tcp_enter_cwr(sk, 1); if (inet_csk(sk)->icsk_ca_state != TCP_CA_CWR) { tcp_try_keep_open(sk); if (inet_csk(sk)->icsk_ca_state != TCP_CA_Open) tcp_moderate_cwnd(tp); } else { tcp_cwnd_down(sk, flag); } } ",0 "decode_OFPAT_RAW_SET_NW_DST(ovs_be32 ipv4, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { ofpact_put_SET_IPV4_DST(out)->ipv4 = ipv4; return 0; } ",0 "void WindowTreeHostManager::PostDisplayConfigurationChange() { focus_activation_store_->Restore(); DisplayManager* display_manager = GetDisplayManager(); display::DisplayLayoutStore* layout_store = display_manager->layout_store(); if (display_manager->num_connected_displays() > 1) { display::DisplayIdList list = display_manager->GetCurrentDisplayIdList(); const display::DisplayLayout& layout = layout_store->GetRegisteredDisplayLayout(list); layout_store->UpdateMultiDisplayState( list, display_manager->IsInMirrorMode(), layout.default_unified); if (display::Screen::GetScreen()->GetNumDisplays() > 1) { SetPrimaryDisplayId(layout.primary_id == display::Display::kInvalidDisplayID ? list[0] : layout.primary_id); } } for (const display::Display& display : display_manager->active_display_list()) { bool output_is_secure = !display_manager->IsInMirrorMode() && display.IsInternal(); GetAshWindowTreeHostForDisplayId(display.id()) ->AsWindowTreeHost() ->compositor() ->SetOutputIsSecure(output_is_secure); } FOR_EACH_OBSERVER(Observer, observers_, OnDisplayConfigurationChanged()); UpdateMouseLocationAfterDisplayChange(); } ",0 " float uncommittedWidth() const { return m_uncommittedWidth; } ",0 "iperf_set_test_one_off(struct iperf_test *ipt, int one_off) { ipt->one_off = one_off; } ",0 "static RList* libs(RBinFile *bf) { struct r_bin_elf_lib_t *libs = NULL; RList *ret = NULL; char *ptr = NULL; int i; if (!bf || !bf->o || !bf->o->bin_obj) { return NULL; } if (!(ret = r_list_newf (free))) { return NULL; } if (!(libs = Elf_(r_bin_elf_get_libs) (bf->o->bin_obj))) { return ret; } for (i = 0; !libs[i].last; i++) { ptr = strdup (libs[i].name); r_list_append (ret, ptr); } free (libs); return ret; } ",0 "invoke_NPN_UTF8FromIdentifier(NPIdentifier identifier) { npw_return_val_if_fail(rpc_method_invoke_possible(g_rpc_connection), NULL); int error = rpc_method_invoke(g_rpc_connection, RPC_METHOD_NPN_UTF8_FROM_IDENTIFIER, RPC_TYPE_NP_IDENTIFIER, &identifier, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror(""NPN_UTF8FromIdentifier() invoke"", error); return NULL; } NPUTF8 *str; error = rpc_method_wait_for_reply(g_rpc_connection, RPC_TYPE_NP_UTF8, &str, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror(""NPN_UTF8FromIdentifier() wait for reply"", error); return NULL; } return str; } ",0 "static void _sync_messages_kill(kill_job_msg_t *req) { int host_cnt, host_inx; char *host; hostset_t hosts; int epilog_msg_time; hosts = hostset_create(req->nodes); host_cnt = hostset_count(hosts); if (host_cnt <= 64) goto fini; if (conf->hostname == NULL) goto fini; /* should never happen */ for (host_inx=0; host_inxnode_name) == 0) { free(host); break; } free(host); } epilog_msg_time = slurm_get_epilog_msg_time(); _delay_rpc(host_inx, host_cnt, epilog_msg_time); fini: hostset_destroy(hosts); } ",0 "void TranslateInfoBarDelegate::ToggleTranslatableLanguageByPrefs() { if (ui_delegate_.IsLanguageBlocked()) { ui_delegate_.SetLanguageBlocked(false); } else { ui_delegate_.SetLanguageBlocked(true); infobar()->RemoveSelf(); } } ",0 "void RenderViewImpl::OnPostMessageEvent( const ViewMsg_PostMessage_Params& params) { WebFrame* frame = webview()->mainFrame(); WebFrame* source_frame = NULL; if (params.source_routing_id != MSG_ROUTING_NONE) { RenderViewImpl* source_view = FromRoutingID(params.source_routing_id); if (source_view) source_frame = source_view->webview()->mainFrame(); } WebDOMEvent event = frame->document().createEvent(""MessageEvent""); WebDOMMessageEvent msg_event = event.to(); msg_event.initMessageEvent(""message"", false, false, WebSerializedScriptValue::fromString(params.data), params.source_origin, source_frame, """"); WebSecurityOrigin target_origin; if (!params.target_origin.empty()) { target_origin = WebSecurityOrigin::createFromString(WebString(params.target_origin)); } frame->dispatchMessageEventWithOriginCheck(target_origin, msg_event); } ",0 "ScopedTextureUploadTimer::~ScopedTextureUploadTimer() { decoder_->texture_upload_count_++; decoder_->total_texture_upload_time_ += base::TimeTicks::HighResNow() - begin_time_; } ",0 "void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, unsigned long end, struct page *ref_page) { mutex_lock(&vma->vm_file->f_mapping->i_mmap_mutex); __unmap_hugepage_range(vma, start, end, ref_page); mutex_unlock(&vma->vm_file->f_mapping->i_mmap_mutex); } ",0 "int sas_ex_revalidate_domain(struct domain_device *port_dev) { int res; struct domain_device *dev = NULL; res = sas_find_bcast_dev(port_dev, &dev); while (res == 0 && dev) { struct expander_device *ex = &dev->ex_dev; int i = 0, phy_id; do { phy_id = -1; res = sas_find_bcast_phy(dev, &phy_id, i, true); if (phy_id == -1) break; res = sas_rediscover(dev, phy_id); i = phy_id + 1; } while (i < ex->num_phys); dev = NULL; res = sas_find_bcast_dev(port_dev, &dev); } return res; } ",1 "WebGLActiveInfo* WebGLRenderingContextBase::getActiveUniform( WebGLProgram* program, GLuint index) { if (!ValidateWebGLProgramOrShader(""getActiveUniform"", program)) return nullptr; GLuint program_id = ObjectNonZero(program); GLint max_name_length = -1; ContextGL()->GetProgramiv(program_id, GL_ACTIVE_UNIFORM_MAX_LENGTH, &max_name_length); if (max_name_length < 0) return nullptr; if (max_name_length == 0) { SynthesizeGLError(GL_INVALID_VALUE, ""getActiveUniform"", ""no active uniforms exist""); return nullptr; } LChar* name_ptr; scoped_refptr name_impl = StringImpl::CreateUninitialized(max_name_length, name_ptr); GLsizei length = 0; GLint size = -1; GLenum type = 0; ContextGL()->GetActiveUniform(program_id, index, max_name_length, &length, &size, &type, reinterpret_cast(name_ptr)); if (size < 0) return nullptr; return WebGLActiveInfo::Create(name_impl->Substring(0, length), type, size); } ",0 "z2grestore(i_ctx_t *i_ctx_p) { int code = restore_page_device(i_ctx_p, igs, gs_gstate_saved(igs)); if (code < 0) return code; if (code == 0) return gs_grestore(igs); return push_callout(i_ctx_p, ""%grestorepagedevice""); } ",0 "static void nested_get_vmcs12_pages(struct kvm_vcpu *vcpu, struct vmcs12 *vmcs12) { struct vcpu_vmx *vmx = to_vmx(vcpu); struct page *page; u64 hpa; if (nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) { /* * Translate L1 physical address to host physical * address for vmcs02. Keep the page pinned, so this * physical address remains valid. We keep a reference * to it so we can release it later. */ if (vmx->nested.apic_access_page) { /* shouldn't happen */ kvm_release_page_dirty(vmx->nested.apic_access_page); vmx->nested.apic_access_page = NULL; } page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->apic_access_addr); /* * If translation failed, no matter: This feature asks * to exit when accessing the given address, and if it * can never be accessed, this feature won't do * anything anyway. */ if (!is_error_page(page)) { vmx->nested.apic_access_page = page; hpa = page_to_phys(vmx->nested.apic_access_page); vmcs_write64(APIC_ACCESS_ADDR, hpa); } else { vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); } } if (nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW)) { if (vmx->nested.virtual_apic_page) { /* shouldn't happen */ kvm_release_page_dirty(vmx->nested.virtual_apic_page); vmx->nested.virtual_apic_page = NULL; } page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->virtual_apic_page_addr); /* * If translation failed, VM entry will fail because * prepare_vmcs02 set VIRTUAL_APIC_PAGE_ADDR to -1ull. * Failing the vm entry is _not_ what the processor * does but it's basically the only possibility we * have. We could still enter the guest if CR8 load * exits are enabled, CR8 store exits are enabled, and * virtualize APIC access is disabled; in this case * the processor would never use the TPR shadow and we * could simply clear the bit from the execution * control. But such a configuration is useless, so * let's keep the code simple. */ if (!is_error_page(page)) { vmx->nested.virtual_apic_page = page; hpa = page_to_phys(vmx->nested.virtual_apic_page); vmcs_write64(VIRTUAL_APIC_PAGE_ADDR, hpa); } } if (nested_cpu_has_posted_intr(vmcs12)) { if (vmx->nested.pi_desc_page) { /* shouldn't happen */ kunmap(vmx->nested.pi_desc_page); kvm_release_page_dirty(vmx->nested.pi_desc_page); vmx->nested.pi_desc_page = NULL; } page = kvm_vcpu_gpa_to_page(vcpu, vmcs12->posted_intr_desc_addr); if (is_error_page(page)) return; vmx->nested.pi_desc_page = page; vmx->nested.pi_desc = kmap(vmx->nested.pi_desc_page); vmx->nested.pi_desc = (struct pi_desc *)((void *)vmx->nested.pi_desc + (unsigned long)(vmcs12->posted_intr_desc_addr & (PAGE_SIZE - 1))); vmcs_write64(POSTED_INTR_DESC_ADDR, page_to_phys(vmx->nested.pi_desc_page) + (unsigned long)(vmcs12->posted_intr_desc_addr & (PAGE_SIZE - 1))); } if (nested_vmx_prepare_msr_bitmap(vcpu, vmcs12)) vmcs_set_bits(CPU_BASED_VM_EXEC_CONTROL, CPU_BASED_USE_MSR_BITMAPS); else vmcs_clear_bits(CPU_BASED_VM_EXEC_CONTROL, CPU_BASED_USE_MSR_BITMAPS); } ",0 "xfs_ioc_fsgeometry( xfs_mount_t *mp, void __user *arg) { xfs_fsop_geom_t fsgeo; int error; error = xfs_fs_geometry(mp, &fsgeo, 4); if (error) return -error; if (copy_to_user(arg, &fsgeo, sizeof(fsgeo))) return -XFS_ERROR(EFAULT); return 0; } ",0 "void RenderWidgetHostViewAura::ModifyEventMovementAndCoords( blink::WebMouseEvent* event) { if (event->type == blink::WebInputEvent::MouseEnter || event->type == blink::WebInputEvent::MouseLeave) global_mouse_position_.SetPoint(event->globalX, event->globalY); event->movementX = event->globalX - global_mouse_position_.x(); event->movementY = event->globalY - global_mouse_position_.y(); global_mouse_position_.SetPoint(event->globalX, event->globalY); if (mouse_locked_) { event->x = unlocked_mouse_position_.x(); event->y = unlocked_mouse_position_.y(); event->windowX = unlocked_mouse_position_.x(); event->windowY = unlocked_mouse_position_.y(); event->globalX = unlocked_global_mouse_position_.x(); event->globalY = unlocked_global_mouse_position_.y(); } else { unlocked_mouse_position_.SetPoint(event->windowX, event->windowY); unlocked_global_mouse_position_.SetPoint(event->globalX, event->globalY); } } ",0 "gfx::Size ConstrainedWidthView::CalculatePreferredSize() const { gfx::Size size = View::CalculatePreferredSize(); if (size.width() <= max_width_) return size; return gfx::Size(max_width_, GetHeightForWidth(max_width_)); } ",0 "static unsigned huffmanDecodeSymbol(const unsigned char* in, size_t* bp, const HuffmanTree* codetree, size_t inbitlength) { unsigned treepos = 0, ct; if (!codetree || !codetree->tree2d) return 0; for(;;) { if(*bp >= inbitlength) return (unsigned)(-1); /*error: end of input memory reached without endcode*/ /* decode the symbol from the tree. The ""readBitFromStream"" code is inlined in the expression below because this is the biggest bottleneck while decoding */ ct = codetree->tree2d[(treepos << 1) + READBIT(*bp, in)]; (*bp)++; if(ct < codetree->numcodes) return ct; /*the symbol is decoded, return it*/ else treepos = ct - codetree->numcodes; /*symbol not yet decoded, instead move tree position*/ if(treepos >= codetree->numcodes) return (unsigned)(-1); /*error: it appeared outside the codetree*/ } } ",0 "void LayerTreeHostImpl::OnCanDrawStateChangedForTree() { client_->OnCanDrawStateChanged(CanDraw()); } ",0 "mtree_atol16(char **p) { int64_t l, limit, last_digit_limit; int base, digit, sign; base = 16; if (**p == '-') { sign = -1; limit = ((uint64_t)(INT64_MAX) + 1) / base; last_digit_limit = ((uint64_t)(INT64_MAX) + 1) % base; ++(*p); } else { sign = 1; limit = INT64_MAX / base; last_digit_limit = INT64_MAX % base; } l = 0; digit = parsehex(**p); while (digit >= 0 && digit < base) { if (l > limit || (l == limit && digit > last_digit_limit)) return (sign < 0) ? INT64_MIN : INT64_MAX; l = (l * base) + digit; digit = parsehex(*++(*p)); } return (sign < 0) ? -l : l; } ",0 "static JSValueRef mouseMoveToCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { if (argumentCount < 2) return JSValueMakeUndefined(context); int x = static_cast(JSValueToNumber(context, arguments[0], exception)); ASSERT(!exception || !*exception); int y = static_cast(JSValueToNumber(context, arguments[1], exception)); ASSERT(!exception || !*exception); lastMousePosition = IntPoint(x, y); BlackBerry::WebKit::WebPage* page = BlackBerry::WebKit::DumpRenderTree::currentInstance()->page(); page->mouseEvent(BlackBerry::Platform::MouseEvent(BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, BlackBerry::Platform::MouseEvent::ScreenLeftMouseButton, lastMousePosition, IntPoint::zero(), 0, 0, 0)); return JSValueMakeUndefined(context); } ",0 "void Compositor::DisableSwapUntilResize() { DCHECK(context_factory_private_); context_factory_private_->DisableSwapUntilResize(this); disabled_swap_until_resize_ = true; } ",0 "int pid_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat) { struct inode *inode = d_inode(dentry); struct task_struct *task; const struct cred *cred; struct pid_namespace *pid = dentry->d_sb->s_fs_info; generic_fillattr(inode, stat); rcu_read_lock(); stat->uid = GLOBAL_ROOT_UID; stat->gid = GLOBAL_ROOT_GID; task = pid_task(proc_pid(inode), PIDTYPE_PID); if (task) { if (!has_pid_permissions(pid, task, 2)) { rcu_read_unlock(); /* * This doesn't prevent learning whether PID exists, * it only makes getattr() consistent with readdir(). */ return -ENOENT; } if ((inode->i_mode == (S_IFDIR|S_IRUGO|S_IXUGO)) || task_dumpable(task)) { cred = __task_cred(task); stat->uid = cred->euid; stat->gid = cred->egid; } } rcu_read_unlock(); return 0; } ",0 "static int find_base(ecc_point* g) { int x; for (x = 0; x < FP_ENTRIES; x++) { if (fp_cache[x].g != NULL && mp_cmp(fp_cache[x].g->x, g->x) == MP_EQ && mp_cmp(fp_cache[x].g->y, g->y) == MP_EQ && mp_cmp(fp_cache[x].g->z, g->z) == MP_EQ) { break; } } if (x == FP_ENTRIES) { x = -1; } return x; } ",0 "long long Segment::GetDuration() const { assert(m_pInfo); return m_pInfo->GetDuration(); } ",1 "InjectedBundlePage::InjectedBundlePage(WKBundlePageRef page) : m_page(page) , m_world(AdoptWK, WKBundleScriptWorldCreateWorld()) { WKBundlePageLoaderClient loaderClient = { kWKBundlePageLoaderClientCurrentVersion, this, didStartProvisionalLoadForFrame, didReceiveServerRedirectForProvisionalLoadForFrame, didFailProvisionalLoadWithErrorForFrame, didCommitLoadForFrame, didFinishDocumentLoadForFrame, didFinishLoadForFrame, didFailLoadWithErrorForFrame, didSameDocumentNavigationForFrame, didReceiveTitleForFrame, 0, // didFirstLayoutForFrame 0, // didFirstVisuallyNonEmptyLayoutForFrame 0, // didRemoveFrameFromHierarchy didDisplayInsecureContentForFrame, didRunInsecureContentForFrame, didClearWindowForFrame, didCancelClientRedirectForFrame, willPerformClientRedirectForFrame, didHandleOnloadEventsForFrame, 0, // didLayoutForFrame 0, // didNewFirstVisuallyNonEmptyLayoutForFrame didDetectXSSForFrame, 0, // shouldGoToBackForwardListItem 0, // didCreateGlobalObjectForFrame 0, // willDisconnectDOMWindowExtensionFromGlobalObject 0, // didReconnectDOMWindowExtensionToGlobalObject 0, // willDestroyGlobalObjectForDOMWindowExtension didFinishProgress, // didFinishProgress 0, // shouldForceUniversalAccessFromLocalURL 0, // didLayout }; WKBundlePageSetPageLoaderClient(m_page, &loaderClient); WKBundlePageResourceLoadClient resourceLoadClient = { kWKBundlePageResourceLoadClientCurrentVersion, this, didInitiateLoadForResource, willSendRequestForFrame, didReceiveResponseForResource, didReceiveContentLengthForResource, didFinishLoadForResource, didFailLoadForResource, shouldCacheResponse, 0 // shouldUseCredentialStorage }; WKBundlePageSetResourceLoadClient(m_page, &resourceLoadClient); WKBundlePagePolicyClient policyClient = { kWKBundlePagePolicyClientCurrentVersion, this, decidePolicyForNavigationAction, decidePolicyForNewWindowAction, decidePolicyForResponse, unableToImplementPolicy }; WKBundlePageSetPolicyClient(m_page, &policyClient); WKBundlePageUIClient uiClient = { kWKBundlePageUIClientCurrentVersion, this, willAddMessageToConsole, willSetStatusbarText, willRunJavaScriptAlert, willRunJavaScriptConfirm, willRunJavaScriptPrompt, 0, /*mouseDidMoveOverElement*/ 0, /*pageDidScroll*/ 0, /*paintCustomOverhangArea*/ 0, /*shouldGenerateFileForUpload*/ 0, /*generateFileForUpload*/ 0, /*shouldRubberBandInDirection*/ 0, /*statusBarIsVisible*/ 0, /*menuBarIsVisible*/ 0, /*toolbarsAreVisible*/ didReachApplicationCacheOriginQuota, didExceedDatabaseQuota, 0, /*plugInStartLabelTitle*/ 0, /*plugInStartLabelSubtitle*/ 0, /*plugInExtraStyleSheet*/ }; WKBundlePageSetUIClient(m_page, &uiClient); WKBundlePageEditorClient editorClient = { kWKBundlePageEditorClientCurrentVersion, this, shouldBeginEditing, shouldEndEditing, shouldInsertNode, shouldInsertText, shouldDeleteRange, shouldChangeSelectedRange, shouldApplyStyle, didBeginEditing, didEndEditing, didChange, didChangeSelection, 0, /* willWriteToPasteboard */ 0, /* getPasteboardDataForRange */ 0 /* didWriteToPasteboard */ }; WKBundlePageSetEditorClient(m_page, &editorClient); #if ENABLE(FULLSCREEN_API) WKBundlePageFullScreenClient fullScreenClient = { kWKBundlePageFullScreenClientCurrentVersion, this, supportsFullScreen, enterFullScreenForElement, exitFullScreenForElement, beganEnterFullScreen, beganExitFullScreen, closeFullScreen, }; WKBundlePageSetFullScreenClient(m_page, &fullScreenClient); #endif } ",1 "String HTMLTextAreaElement::suggestedValue() const { return m_suggestedValue; } ",0 "static int help(int argc, char **argv) { if (!argc) { printf(""No help command specified.\n""); return 1; } const command_t *command = find_command(argv[0]); if (!command) { printf(""No command named '%s'.\n"", argv[0]); return 2; } printf(""%s %s\n"", argv[0], command->help); return 0; } ",0 "static void opl3_reset(int devno) { int i; for (i = 0; i < 18; i++) devc->lv_map[i] = i; for (i = 0; i < devc->nr_voice; i++) { opl3_command(pv_map[devc->lv_map[i]].ioaddr, KSL_LEVEL + pv_map[devc->lv_map[i]].op[0], 0xff); opl3_command(pv_map[devc->lv_map[i]].ioaddr, KSL_LEVEL + pv_map[devc->lv_map[i]].op[1], 0xff); if (pv_map[devc->lv_map[i]].voice_mode == 4) { opl3_command(pv_map[devc->lv_map[i]].ioaddr, KSL_LEVEL + pv_map[devc->lv_map[i]].op[2], 0xff); opl3_command(pv_map[devc->lv_map[i]].ioaddr, KSL_LEVEL + pv_map[devc->lv_map[i]].op[3], 0xff); } opl3_kill_note(devno, i, 0, 64); } if (devc->model == 2) { devc->v_alloc->max_voice = devc->nr_voice = 18; for (i = 0; i < 18; i++) pv_map[i].voice_mode = 2; } } ",0 "void BrowserView::ChildPreferredSizeChanged(View* child) { Layout(); } ",0 "static gboolean rpc_event_check(GSource *source) { return rpc_wait_dispatch(g_rpc_connection, 0) > 0; } ",0 "static void update_irq(struct HPETTimer *timer, int set) { uint64_t mask; HPETState *s; int route; if (timer->tn <= 1 && hpet_in_legacy_mode(timer->state)) { /* if LegacyReplacementRoute bit is set, HPET specification requires * timer0 be routed to IRQ0 in NON-APIC or IRQ2 in the I/O APIC, * timer1 be routed to IRQ8 in NON-APIC or IRQ8 in the I/O APIC. */ route = (timer->tn == 0) ? 0 : RTC_ISA_IRQ; } else { route = timer_int_route(timer); } s = timer->state; mask = 1 << timer->tn; if (!set || !timer_enabled(timer) || !hpet_enabled(timer->state)) { s->isr &= ~mask; if (!timer_fsb_route(timer)) { /* fold the ICH PIRQ# pin's internal inversion logic into hpet */ if (route >= ISA_NUM_IRQS) { qemu_irq_raise(s->irqs[route]); } else { qemu_irq_lower(s->irqs[route]); } } } else if (timer_fsb_route(timer)) { stl_le_phys(&address_space_memory, timer->fsb >> 32, timer->fsb & 0xffffffff); } else if (timer->config & HPET_TN_TYPE_LEVEL) { s->isr |= mask; /* fold the ICH PIRQ# pin's internal inversion logic into hpet */ if (route >= ISA_NUM_IRQS) { qemu_irq_lower(s->irqs[route]); } else { qemu_irq_raise(s->irqs[route]); } } else { s->isr &= ~mask; qemu_irq_pulse(s->irqs[route]); } } ",0 "void ExtensionInstallUI::OnImageLoaded( SkBitmap* image, const ExtensionResource& resource, int index) { SetIcon(image); switch (prompt_type_) { case PERMISSIONS_PROMPT: case RE_ENABLE_PROMPT: case INSTALL_PROMPT: { content::NotificationService* service = content::NotificationService::current(); service->Notify(chrome::NOTIFICATION_EXTENSION_WILL_SHOW_CONFIRM_DIALOG, content::Source(this), content::NotificationService::NoDetails()); Prompt prompt(prompt_type_); prompt.SetPermissions(permissions_->GetWarningMessages()); ShowExtensionInstallDialog( profile_, delegate_, extension_, &icon_, prompt); break; } default: NOTREACHED() << ""Unknown message""; break; } } ",0 "static SQLITE_NOINLINE void backupUpdate( sqlite3_backup *p, Pgno iPage, const u8 *aData ){ assert( p!=0 ); do{ assert( sqlite3_mutex_held(p->pSrc->pBt->mutex) ); if( !isFatalError(p->rc) && iPageiNext ){ /* The backup process p has already copied page iPage. But now it ** has been modified by a transaction on the source pager. Copy ** the new data into the backup. */ int rc; assert( p->pDestDb ); sqlite3_mutex_enter(p->pDestDb->mutex); rc = backupOnePage(p, iPage, aData, 1); sqlite3_mutex_leave(p->pDestDb->mutex); assert( rc!=SQLITE_BUSY && rc!=SQLITE_LOCKED ); if( rc!=SQLITE_OK ){ p->rc = rc; } } }while( (p = p->pNext)!=0 ); } ",0 "void RenderProcessHostImpl::OnUnregisterAecDumpConsumer(int id) { BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, base::BindOnce( &RenderProcessHostImpl::UnregisterAecDumpConsumerOnUIThread, weak_factory_.GetWeakPtr(), id)); } ",0 "const wchar_t* _cmsMLUgetWide(const cmsMLU* mlu, cmsUInt32Number *len, cmsUInt16Number LanguageCode, cmsUInt16Number CountryCode, cmsUInt16Number* UsedLanguageCode, cmsUInt16Number* UsedCountryCode) { int i; int Best = -1; _cmsMLUentry* v; if (mlu == NULL) return NULL; if (mlu -> AllocatedEntries <= 0) return NULL; for (i=0; i < mlu ->UsedEntries; i++) { v = mlu ->Entries + i; if (v -> Language == LanguageCode) { if (Best == -1) Best = i; if (v -> Country == CountryCode) { if (UsedLanguageCode != NULL) *UsedLanguageCode = v ->Language; if (UsedCountryCode != NULL) *UsedCountryCode = v ->Country; if (len != NULL) *len = v ->Len; return (wchar_t*) ((cmsUInt8Number*) mlu ->MemPool + v -> StrW); // Found exact match } } } if (Best == -1) Best = 0; v = mlu ->Entries + Best; if (UsedLanguageCode != NULL) *UsedLanguageCode = v ->Language; if (UsedCountryCode != NULL) *UsedCountryCode = v ->Country; if (len != NULL) *len = v ->Len; return(wchar_t*) ((cmsUInt8Number*) mlu ->MemPool + v ->StrW); } ",0 "long user_read(const struct key *key, char __user *buffer, size_t buflen) { const struct user_key_payload *upayload; long ret; upayload = user_key_payload_locked(key); ret = upayload->datalen; /* we can return the data as is */ if (buffer && buflen > 0) { if (buflen > upayload->datalen) buflen = upayload->datalen; if (copy_to_user(buffer, upayload->data, buflen) != 0) ret = -EFAULT; } return ret; } ",0 "static void *kmalloc_large_node(size_t size, gfp_t flags, int node) { struct page *page = alloc_pages_node(node, flags | __GFP_COMP, get_order(size)); if (page) return page_address(page); else return NULL; } ",0 "void PreconnectManager::Stop(const GURL& url) { DCHECK_CURRENTLY_ON(content::BrowserThread::UI); auto it = preresolve_info_.find(url.host()); if (it == preresolve_info_.end()) { return; } it->second->was_canceled = true; } ",0 " explicit NoNavigationsObserver(WebContents* web_contents) : WebContentsObserver(web_contents) {} ",0 "static int set_next_request(void) { struct request_queue *q; int old_pos = fdc_queue; do { q = disks[fdc_queue]->queue; if (++fdc_queue == N_DRIVE) fdc_queue = 0; if (q) { current_req = blk_fetch_request(q); if (current_req) break; } } while (fdc_queue != old_pos); return current_req != NULL; } ",0 "static inline pmd_t *vmalloc_sync_one(pgd_t *pgd, unsigned long address) { unsigned index = pgd_index(address); pgd_t *pgd_k; pud_t *pud, *pud_k; pmd_t *pmd, *pmd_k; pgd += index; pgd_k = init_mm.pgd + index; if (!pgd_present(*pgd_k)) return NULL; pud = pud_offset(pgd, address); pud_k = pud_offset(pgd_k, address); if (!pud_present(*pud_k)) return NULL; if (!pud_present(*pud)) set_pud(pud, *pud_k); pmd = pmd_offset(pud, address); pmd_k = pmd_offset(pud_k, address); if (!pmd_present(*pmd_k)) return NULL; if (!pmd_present(*pmd)) set_pmd(pmd, *pmd_k); else { /* * The page tables are fully synchronised so there must * be another reason for the fault. Return NULL here to * signal that we have not taken care of the fault. */ BUG_ON(pmd_page(*pmd) != pmd_page(*pmd_k)); return NULL; } return pmd_k; } ",0 "BOOL security_fips_encrypt(BYTE* data, int length, rdpRdp* rdp) { crypto_des3_encrypt(rdp->fips_encrypt, length, data, data); rdp->encrypt_use_count++; return TRUE; } ",0 "static int wait_til_ready(void) { int status; int counter; if (FDCS->reset) return -1; for (counter = 0; counter < 10000; counter++) { status = fd_inb(FD_STATUS); if (status & STATUS_READY) return status; } if (initialized) { DPRINT(""Getstatus times out (%x) on fdc %d\n"", status, fdc); show_floppy(); } FDCS->reset = 1; return -1; } ",0 "void PluginServiceImpl::OpenChannelToNpapiPlugin( int render_process_id, int render_view_id, const GURL& url, const GURL& page_url, const std::string& mime_type, PluginProcessHost::Client* client) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); DCHECK(!ContainsKey(pending_plugin_clients_, client)); pending_plugin_clients_.insert(client); PluginServiceFilterParams params = { render_process_id, render_view_id, page_url, client->GetResourceContext() }; GetPlugins(base::Bind( &PluginServiceImpl::ForwardGetAllowedPluginForOpenChannelToPlugin, base::Unretained(this), params, url, mime_type, client)); } ",0 "void ServiceWorkerScriptContext::DidHandleInstallEvent(int request_id) { Send(request_id, ServiceWorkerHostMsg_InstallEventFinished()); } ",0 "bool Browser::CheckMediaAccessPermission( content::RenderFrameHost* render_frame_host, const GURL& security_origin, content::MediaStreamType type) { Profile* profile = Profile::FromBrowserContext( content::WebContents::FromRenderFrameHost(render_frame_host) ->GetBrowserContext()); const extensions::Extension* extension = GetExtensionForOrigin(profile, security_origin); return MediaCaptureDevicesDispatcher::GetInstance() ->CheckMediaAccessPermission(render_frame_host, security_origin, type, extension); } ",0 "mm_inform_authserv(char *service, char *style) { Buffer m; debug3(""%s entering"", __func__); buffer_init(&m); buffer_put_cstring(&m, service); buffer_put_cstring(&m, style ? style : """"); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_AUTHSERV, &m); buffer_free(&m); } ",0 "XineramaGetImageData(DrawablePtr *pDrawables, int left, int top, int width, int height, unsigned int format, unsigned long planemask, char *data, int pitch, Bool isRoot) { RegionRec SrcRegion, ScreenRegion, GrabRegion; BoxRec SrcBox, *pbox; int x, y, w, h, i, j, nbox, size, sizeNeeded, ScratchPitch, inOut, depth; DrawablePtr pDraw = pDrawables[0]; char *ScratchMem = NULL; size = 0; /* find box in logical screen space */ SrcBox.x1 = left; SrcBox.y1 = top; if (!isRoot) { SrcBox.x1 += pDraw->x + screenInfo.screens[0]->x; SrcBox.y1 += pDraw->y + screenInfo.screens[0]->y; } SrcBox.x2 = SrcBox.x1 + width; SrcBox.y2 = SrcBox.y1 + height; RegionInit(&SrcRegion, &SrcBox, 1); RegionNull(&GrabRegion); depth = (format == XYPixmap) ? 1 : pDraw->depth; FOR_NSCREENS(i) { BoxRec TheBox; ScreenPtr pScreen; pDraw = pDrawables[i]; pScreen = pDraw->pScreen; TheBox.x1 = pScreen->x; TheBox.x2 = TheBox.x1 + pScreen->width; TheBox.y1 = pScreen->y; TheBox.y2 = TheBox.y1 + pScreen->height; RegionInit(&ScreenRegion, &TheBox, 1); inOut = RegionContainsRect(&ScreenRegion, &SrcBox); if (inOut == rgnPART) RegionIntersect(&GrabRegion, &SrcRegion, &ScreenRegion); RegionUninit(&ScreenRegion); if (inOut == rgnIN) { (*pScreen->GetImage) (pDraw, SrcBox.x1 - pDraw->x - screenInfo.screens[i]->x, SrcBox.y1 - pDraw->y - screenInfo.screens[i]->y, width, height, format, planemask, data); break; } else if (inOut == rgnOUT) continue; nbox = RegionNumRects(&GrabRegion); if (nbox) { pbox = RegionRects(&GrabRegion); while (nbox--) { w = pbox->x2 - pbox->x1; h = pbox->y2 - pbox->y1; ScratchPitch = PixmapBytePad(w, depth); sizeNeeded = ScratchPitch * h; if (sizeNeeded > size) { char *tmpdata = ScratchMem; ScratchMem = realloc(ScratchMem, sizeNeeded); if (ScratchMem) size = sizeNeeded; else { ScratchMem = tmpdata; break; } } x = pbox->x1 - pDraw->x - screenInfo.screens[i]->x; y = pbox->y1 - pDraw->y - screenInfo.screens[i]->y; (*pScreen->GetImage) (pDraw, x, y, w, h, format, planemask, ScratchMem); /* copy the memory over */ if (depth == 1) { int k, shift, leftover, index, index2; x = pbox->x1 - SrcBox.x1; y = pbox->y1 - SrcBox.y1; shift = x & 7; x >>= 3; leftover = w & 7; w >>= 3; /* clean up the edge */ if (leftover) { int mask = (1 << leftover) - 1; for (j = h, k = w; j--; k += ScratchPitch) ScratchMem[k] &= mask; } for (j = 0, index = (pitch * y) + x, index2 = 0; j < h; j++, index += pitch, index2 += ScratchPitch) { if (w) { if (!shift) memcpy(data + index, ScratchMem + index2, w); else CopyBits(data + index, shift, ScratchMem + index2, w); } if (leftover) { data[index + w] |= SHIFT_L(ScratchMem[index2 + w], shift); if ((shift + leftover) > 8) data[index + w + 1] |= SHIFT_R(ScratchMem[index2 + w], (8 - shift)); } } } else { j = BitsPerPixel(depth) >> 3; x = (pbox->x1 - SrcBox.x1) * j; y = pbox->y1 - SrcBox.y1; w *= j; for (j = 0; j < h; j++) { memcpy(data + (pitch * (y + j)) + x, ScratchMem + (ScratchPitch * j), w); } } pbox++; } RegionSubtract(&SrcRegion, &SrcRegion, &GrabRegion); if (!RegionNotEmpty(&SrcRegion)) break; } } free(ScratchMem); RegionUninit(&SrcRegion); RegionUninit(&GrabRegion); } ",0 "nfsd3_proc_null(struct svc_rqst *rqstp, void *argp, void *resp) { return nfs_ok; } ",0 "static int read_config_info (WavpackContext *wpc, WavpackMetadata *wpmd) { int bytecnt = wpmd->byte_length; unsigned char *byteptr = (unsigned char *)wpmd->data; if (bytecnt >= 3) { wpc->config.flags &= 0xff; wpc->config.flags |= (int32_t) *byteptr++ << 8; wpc->config.flags |= (int32_t) *byteptr++ << 16; wpc->config.flags |= (int32_t) *byteptr++ << 24; bytecnt -= 3; if (bytecnt && (wpc->config.flags & CONFIG_EXTRA_MODE)) { wpc->config.xmode = *byteptr++; bytecnt--; } if (bytecnt) { wpc->config.qmode = (wpc->config.qmode & ~0xff) | *byteptr; wpc->version_five = 1; } } return TRUE; } ",0 "void AppListController::EnableAppList() { PrefService* local_state = g_browser_process->local_state(); bool has_been_enabled = local_state->GetBoolean( apps::prefs::kAppLauncherHasBeenEnabled); if (!has_been_enabled) { local_state->SetBoolean(apps::prefs::kAppLauncherHasBeenEnabled, true); ShellIntegration::ShortcutLocations shortcut_locations; shortcut_locations.on_desktop = true; shortcut_locations.in_quick_launch_bar = true; shortcut_locations.in_applications_menu = true; BrowserDistribution* dist = BrowserDistribution::GetDistribution(); shortcut_locations.applications_menu_subdir = dist->GetAppShortCutName(); base::FilePath user_data_dir( g_browser_process->profile_manager()->user_data_dir()); content::BrowserThread::PostTask( content::BrowserThread::FILE, FROM_HERE, base::Bind(&CreateAppListShortcuts, user_data_dir, GetAppModelId(), shortcut_locations)); } } ",1 "store_tabletWheel(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct aiptek *aiptek = dev_get_drvdata(dev); int err, w; err = kstrtoint(buf, 10, &w); if (err) return err; aiptek->newSetting.wheel = w; return count; } ",0 "KURL AXLayoutObject::url() const { if (isAnchor() && isHTMLAnchorElement(m_layoutObject->node())) { if (HTMLAnchorElement* anchor = toHTMLAnchorElement(anchorElement())) return anchor->href(); } if (isWebArea()) return m_layoutObject->document().url(); if (isImage() && isHTMLImageElement(m_layoutObject->node())) return toHTMLImageElement(*m_layoutObject->node()).src(); if (isInputImage()) return toHTMLInputElement(m_layoutObject->node())->src(); return KURL(); } ",0 "bool IsInteractiveDesktop(bool* is_interactive) { HDESK current_desk = ::GetThreadDesktop(::GetCurrentThreadId()); if (NULL == current_desk) { return false; } wchar_t current_desk_name[256] = {0}; if (!::GetUserObjectInformationW(current_desk, UOI_NAME, current_desk_name, sizeof(current_desk_name), NULL)) { return false; } *is_interactive = (0 == _wcsicmp(L""default"", current_desk_name)); return true; } ",0 "long Cluster::ParseBlockGroup(long long payload_size, long long& pos, long& len) { const long long payload_start = pos; const long long payload_stop = pos + payload_size; IMkvReader* const pReader = m_pSegment->m_pReader; long long total, avail; long status = pReader->Length(&total, &avail); if (status < 0) // error return status; assert((total < 0) || (avail <= total)); if ((total >= 0) && (payload_stop > total)) return E_FILE_FORMAT_INVALID; if (payload_stop > avail) { len = static_cast(payload_size); return E_BUFFER_NOT_FULL; } long long discard_padding = 0; while (pos < payload_stop) { if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } long long result = GetUIntLength(pReader, pos, len); if (result < 0) // error return static_cast(result); if (result > 0) // weird return E_BUFFER_NOT_FULL; if ((pos + len) > payload_stop) return E_FILE_FORMAT_INVALID; if ((pos + len) > avail) return E_BUFFER_NOT_FULL; const long long id = ReadUInt(pReader, pos, len); if (id < 0) // error return static_cast(id); if (id == 0) // not a value ID return E_FILE_FORMAT_INVALID; pos += len; // consume ID field if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } result = GetUIntLength(pReader, pos, len); if (result < 0) // error return static_cast(result); if (result > 0) // weird return E_BUFFER_NOT_FULL; if ((pos + len) > payload_stop) return E_FILE_FORMAT_INVALID; if ((pos + len) > avail) return E_BUFFER_NOT_FULL; const long long size = ReadUInt(pReader, pos, len); if (size < 0) // error return static_cast(size); pos += len; // consume size field if (pos > payload_stop) return E_FILE_FORMAT_INVALID; if (size == 0) // weird continue; const long long unknown_size = (1LL << (7 * len)) - 1; if (size == unknown_size) return E_FILE_FORMAT_INVALID; if (id == 0x35A2) { // DiscardPadding status = UnserializeInt(pReader, pos, size, discard_padding); if (status < 0) // error return status; } if (id != 0x21) { // sub-part of BlockGroup is not a Block pos += size; // consume sub-part of block group if (pos > payload_stop) return E_FILE_FORMAT_INVALID; continue; } const long long block_stop = pos + size; if (block_stop > payload_stop) return E_FILE_FORMAT_INVALID; if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } result = GetUIntLength(pReader, pos, len); if (result < 0) // error return static_cast(result); if (result > 0) // weird return E_BUFFER_NOT_FULL; if ((pos + len) > block_stop) return E_FILE_FORMAT_INVALID; if ((pos + len) > avail) return E_BUFFER_NOT_FULL; const long long track = ReadUInt(pReader, pos, len); if (track < 0) // error return static_cast(track); if (track == 0) return E_FILE_FORMAT_INVALID; #if 0 const Tracks* const pTracks = m_pSegment->GetTracks(); assert(pTracks); const long tn = static_cast(track); const Track* const pTrack = pTracks->GetTrackByNumber(tn); if (pTrack == NULL) return E_FILE_FORMAT_INVALID; #endif pos += len; // consume track number if ((pos + 2) > block_stop) return E_FILE_FORMAT_INVALID; if ((pos + 2) > avail) { len = 2; return E_BUFFER_NOT_FULL; } pos += 2; // consume timecode if ((pos + 1) > block_stop) return E_FILE_FORMAT_INVALID; if ((pos + 1) > avail) { len = 1; return E_BUFFER_NOT_FULL; } unsigned char flags; status = pReader->Read(pos, 1, &flags); if (status < 0) { // error or underflow len = 1; return status; } ++pos; // consume flags byte assert(pos <= avail); if (pos >= block_stop) return E_FILE_FORMAT_INVALID; const int lacing = int(flags & 0x06) >> 1; if ((lacing != 0) && (block_stop > avail)) { len = static_cast(block_stop - pos); return E_BUFFER_NOT_FULL; } pos = block_stop; // consume block-part of block group assert(pos <= payload_stop); } assert(pos == payload_stop); status = CreateBlock(0x20, // BlockGroup ID payload_start, payload_size, discard_padding); if (status != 0) return status; m_pos = payload_stop; return 0; // success } ",1 "void Document::resetLinkColor() { m_linkColor = Color(0, 0, 238); } ",0 "bool ChooserContextBase::CanRequestObjectPermission( const GURL& requesting_origin, const GURL& embedding_origin) { ContentSetting content_setting = host_content_settings_map_->GetContentSetting( requesting_origin, embedding_origin, guard_content_settings_type_, std::string()); DCHECK(content_setting == CONTENT_SETTING_ASK || content_setting == CONTENT_SETTING_BLOCK); return content_setting == CONTENT_SETTING_ASK; } ",0 "static void pl022_update(PL022State *s) { s->sr = 0; if (s->tx_fifo_len == 0) s->sr |= PL022_SR_TFE; if (s->tx_fifo_len != 8) s->sr |= PL022_SR_TNF; if (s->rx_fifo_len != 0) s->sr |= PL022_SR_RNE; if (s->rx_fifo_len == 8) s->sr |= PL022_SR_RFF; if (s->tx_fifo_len) s->sr |= PL022_SR_BSY; s->is = 0; if (s->rx_fifo_len >= 4) s->is |= PL022_INT_RX; if (s->tx_fifo_len <= 4) s->is |= PL022_INT_TX; qemu_set_irq(s->irq, (s->is & s->im) != 0); } ",0 "static int catc_probe(struct usb_interface *intf, const struct usb_device_id *id) { struct device *dev = &intf->dev; struct usb_device *usbdev = interface_to_usbdev(intf); struct net_device *netdev; struct catc *catc; u8 broadcast[ETH_ALEN]; int i, pktsz, ret; if (usb_set_interface(usbdev, intf->altsetting->desc.bInterfaceNumber, 1)) { dev_err(dev, ""Can't set altsetting 1.\n""); return -EIO; } netdev = alloc_etherdev(sizeof(struct catc)); if (!netdev) return -ENOMEM; catc = netdev_priv(netdev); netdev->netdev_ops = &catc_netdev_ops; netdev->watchdog_timeo = TX_TIMEOUT; netdev->ethtool_ops = &ops; catc->usbdev = usbdev; catc->netdev = netdev; spin_lock_init(&catc->tx_lock); spin_lock_init(&catc->ctrl_lock); init_timer(&catc->timer); catc->timer.data = (long) catc; catc->timer.function = catc_stats_timer; catc->ctrl_urb = usb_alloc_urb(0, GFP_KERNEL); catc->tx_urb = usb_alloc_urb(0, GFP_KERNEL); catc->rx_urb = usb_alloc_urb(0, GFP_KERNEL); catc->irq_urb = usb_alloc_urb(0, GFP_KERNEL); if ((!catc->ctrl_urb) || (!catc->tx_urb) || (!catc->rx_urb) || (!catc->irq_urb)) { dev_err(&intf->dev, ""No free urbs available.\n""); ret = -ENOMEM; goto fail_free; } /* The F5U011 has the same vendor/product as the netmate but a device version of 0x130 */ if (le16_to_cpu(usbdev->descriptor.idVendor) == 0x0423 && le16_to_cpu(usbdev->descriptor.idProduct) == 0xa && le16_to_cpu(catc->usbdev->descriptor.bcdDevice) == 0x0130) { dev_dbg(dev, ""Testing for f5u011\n""); catc->is_f5u011 = 1; atomic_set(&catc->recq_sz, 0); pktsz = RX_PKT_SZ; } else { pktsz = RX_MAX_BURST * (PKT_SZ + 2); } usb_fill_control_urb(catc->ctrl_urb, usbdev, usb_sndctrlpipe(usbdev, 0), NULL, NULL, 0, catc_ctrl_done, catc); usb_fill_bulk_urb(catc->tx_urb, usbdev, usb_sndbulkpipe(usbdev, 1), NULL, 0, catc_tx_done, catc); usb_fill_bulk_urb(catc->rx_urb, usbdev, usb_rcvbulkpipe(usbdev, 1), catc->rx_buf, pktsz, catc_rx_done, catc); usb_fill_int_urb(catc->irq_urb, usbdev, usb_rcvintpipe(usbdev, 2), catc->irq_buf, 2, catc_irq_done, catc, 1); if (!catc->is_f5u011) { dev_dbg(dev, ""Checking memory size\n""); i = 0x12345678; catc_write_mem(catc, 0x7a80, &i, 4); i = 0x87654321; catc_write_mem(catc, 0xfa80, &i, 4); catc_read_mem(catc, 0x7a80, &i, 4); switch (i) { case 0x12345678: catc_set_reg(catc, TxBufCount, 8); catc_set_reg(catc, RxBufCount, 32); dev_dbg(dev, ""64k Memory\n""); break; default: dev_warn(&intf->dev, ""Couldn't detect memory size, assuming 32k\n""); case 0x87654321: catc_set_reg(catc, TxBufCount, 4); catc_set_reg(catc, RxBufCount, 16); dev_dbg(dev, ""32k Memory\n""); break; } dev_dbg(dev, ""Getting MAC from SEEROM.\n""); catc_get_mac(catc, netdev->dev_addr); dev_dbg(dev, ""Setting MAC into registers.\n""); for (i = 0; i < 6; i++) catc_set_reg(catc, StationAddr0 - i, netdev->dev_addr[i]); dev_dbg(dev, ""Filling the multicast list.\n""); eth_broadcast_addr(broadcast); catc_multicast(broadcast, catc->multicast); catc_multicast(netdev->dev_addr, catc->multicast); catc_write_mem(catc, 0xfa80, catc->multicast, 64); dev_dbg(dev, ""Clearing error counters.\n""); for (i = 0; i < 8; i++) catc_set_reg(catc, EthStats + i, 0); catc->last_stats = jiffies; dev_dbg(dev, ""Enabling.\n""); catc_set_reg(catc, MaxBurst, RX_MAX_BURST); catc_set_reg(catc, OpModes, OpTxMerge | OpRxMerge | OpLenInclude | Op3MemWaits); catc_set_reg(catc, LEDCtrl, LEDLink); catc_set_reg(catc, RxUnit, RxEnable | RxPolarity | RxMultiCast); } else { dev_dbg(dev, ""Performing reset\n""); catc_reset(catc); catc_get_mac(catc, netdev->dev_addr); dev_dbg(dev, ""Setting RX Mode\n""); catc->rxmode[0] = RxEnable | RxPolarity | RxMultiCast; catc->rxmode[1] = 0; f5u011_rxmode(catc, catc->rxmode); } dev_dbg(dev, ""Init done.\n""); printk(KERN_INFO ""%s: %s USB Ethernet at usb-%s-%s, %pM.\n"", netdev->name, (catc->is_f5u011) ? ""Belkin F5U011"" : ""CATC EL1210A NetMate"", usbdev->bus->bus_name, usbdev->devpath, netdev->dev_addr); usb_set_intfdata(intf, catc); SET_NETDEV_DEV(netdev, &intf->dev); ret = register_netdev(netdev); if (ret) goto fail_clear_intfdata; return 0; fail_clear_intfdata: usb_set_intfdata(intf, NULL); fail_free: usb_free_urb(catc->ctrl_urb); usb_free_urb(catc->tx_urb); usb_free_urb(catc->rx_urb); usb_free_urb(catc->irq_urb); free_netdev(netdev); return ret; } ",1 "hook_fd_set (fd_set *read_fds, fd_set *write_fds, fd_set *exception_fds) { struct t_hook *ptr_hook; int max_fd; max_fd = 0; for (ptr_hook = weechat_hooks[HOOK_TYPE_FD]; ptr_hook; ptr_hook = ptr_hook->next_hook) { if (!ptr_hook->deleted) { /* skip invalid file descriptors */ if ((fcntl (HOOK_FD(ptr_hook,fd), F_GETFD) == -1) && (errno == EBADF)) { if (HOOK_FD(ptr_hook, error) == 0) { HOOK_FD(ptr_hook, error) = errno; gui_chat_printf (NULL, _(""%sError: bad file descriptor (%d) "" ""used in hook_fd""), gui_chat_prefix[GUI_CHAT_PREFIX_ERROR], HOOK_FD(ptr_hook, fd)); } } else { if (HOOK_FD(ptr_hook, flags) & HOOK_FD_FLAG_READ) { FD_SET (HOOK_FD(ptr_hook, fd), read_fds); if (HOOK_FD(ptr_hook, fd) > max_fd) max_fd = HOOK_FD(ptr_hook, fd); } if (HOOK_FD(ptr_hook, flags) & HOOK_FD_FLAG_WRITE) { FD_SET (HOOK_FD(ptr_hook, fd), write_fds); if (HOOK_FD(ptr_hook, fd) > max_fd) max_fd = HOOK_FD(ptr_hook, fd); } if (HOOK_FD(ptr_hook, flags) & HOOK_FD_FLAG_EXCEPTION) { FD_SET (HOOK_FD(ptr_hook, fd), exception_fds); if (HOOK_FD(ptr_hook, fd) > max_fd) max_fd = HOOK_FD(ptr_hook, fd); } } } } return max_fd; } ",0 "static bool drop_privileges() { gid_t groups[] = { AID_DEBUGGERD, AID_LOG, AID_READPROC }; if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) { ALOGE(""debuggerd: failed to setgroups: %s"", strerror(errno)); return false; } if (setresgid(AID_DEBUGGERD, AID_DEBUGGERD, AID_DEBUGGERD) != 0) { ALOGE(""debuggerd: failed to setresgid: %s"", strerror(errno)); return false; } if (setresuid(AID_DEBUGGERD, AID_DEBUGGERD, AID_DEBUGGERD) != 0) { ALOGE(""debuggerd: failed to setresuid: %s"", strerror(errno)); return false; } return true; } ",0 "node_get_prim_addr_ipv4h(const node_t *node) { /* Don't check the ORPort or DirPort, as this function isn't port-specific, * and the node might have a valid IPv4 address, yet have a zero * ORPort or DirPort. */ if (node->ri && tor_addr_is_valid_ipv4h(node->ri->addr, 0)) { return node->ri->addr; } else if (node->rs && tor_addr_is_valid_ipv4h(node->rs->addr, 0)) { return node->rs->addr; } return 0; } ",0 "static int php_sockop_cast(php_stream *stream, int castas, void **ret) { php_netstream_data_t *sock = (php_netstream_data_t*)stream->abstract; if (!sock) { return FAILURE; } switch(castas) { case PHP_STREAM_AS_STDIO: if (ret) { *(FILE**)ret = fdopen(sock->socket, stream->mode); if (*ret) return SUCCESS; return FAILURE; } return SUCCESS; case PHP_STREAM_AS_FD_FOR_SELECT: case PHP_STREAM_AS_FD: case PHP_STREAM_AS_SOCKETD: if (ret) *(php_socket_t *)ret = sock->socket; return SUCCESS; default: return FAILURE; } } ",0 "void RecordPercentageMatchHistogram(const base::string16& old_text, const base::string16& new_text, bool url_replacement_active, content::PageTransition transition, int omnibox_width) { size_t avg_length = (old_text.length() + new_text.length()) / 2; int percent = 0; if (!old_text.empty() && !new_text.empty()) { size_t shorter_length = std::min(old_text.length(), new_text.length()); base::string16::const_iterator end(old_text.begin() + shorter_length); base::string16::const_iterator mismatch( std::mismatch(old_text.begin(), end, new_text.begin()).first); size_t matching_characters = mismatch - old_text.begin(); percent = static_cast(matching_characters) / avg_length * 100; } std::string histogram_name; if (url_replacement_active) { if (transition == content::PAGE_TRANSITION_TYPED) { histogram_name = ""InstantExtended.PercentageMatchV2_QuerytoURL""; UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); } else { histogram_name = ""InstantExtended.PercentageMatchV2_QuerytoQuery""; UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); } } else { if (transition == content::PAGE_TRANSITION_TYPED) { histogram_name = ""InstantExtended.PercentageMatchV2_URLtoURL""; UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); } else { histogram_name = ""InstantExtended.PercentageMatchV2_URLtoQuery""; UMA_HISTOGRAM_PERCENTAGE(histogram_name, percent); } } std::string suffix = ""large""; for (size_t i = 0; i < arraysize(kPercentageMatchHistogramWidthBuckets); ++i) { if (omnibox_width < kPercentageMatchHistogramWidthBuckets[i]) { suffix = base::IntToString(kPercentageMatchHistogramWidthBuckets[i]); break; } } base::HistogramBase* counter = base::LinearHistogram::FactoryGet( histogram_name + ""_"" + suffix, 1, 101, 102, base::Histogram::kUmaTargetedHistogramFlag); counter->Add(percent); } ",0 "void ChromePasswordManagerClient::GenerationAvailableForForm( const autofill::PasswordForm& form) { if (!password_manager::bad_message::CheckChildProcessSecurityPolicy( password_generation_driver_bindings_.GetCurrentTargetFrame(), form, BadMessageReason::CPMD_BAD_ORIGIN_GENERATION_AVAILABLE_FOR_FORM)) return; password_manager_.GenerationAvailableForForm(form); } ",0 "static struct usb_function_instance *f_midi_alloc_inst(void) { struct f_midi_opts *opts; opts = kzalloc(sizeof(*opts), GFP_KERNEL); if (!opts) return ERR_PTR(-ENOMEM); mutex_init(&opts->lock); opts->func_inst.free_func_inst = f_midi_free_inst; opts->index = SNDRV_DEFAULT_IDX1; opts->id = SNDRV_DEFAULT_STR1; opts->buflen = 512; opts->qlen = 32; opts->in_ports = 1; opts->out_ports = 1; config_group_init_type_name(&opts->func_inst.group, """", &midi_func_type); return &opts->func_inst; } ",0 "void WallpaperManagerBase::SaveLastLoadTime(const base::TimeDelta elapsed) { while (last_load_times_.size() >= kLastLoadsStatsMsMaxSize) last_load_times_.pop_front(); if (elapsed > base::TimeDelta::FromMicroseconds(0)) { last_load_times_.push_back(elapsed); last_load_finished_at_ = base::Time::Now(); } } ",0 "static void raisesExceptionTestInterfaceEmptyAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); ExceptionState exceptionState(ExceptionState::GetterContext, ""raisesExceptionTestInterfaceEmptyAttribute"", ""TestObjectPython"", info.Holder(), info.GetIsolate()); RefPtr jsValue = imp->raisesExceptionTestInterfaceEmptyAttribute(exceptionState); if (UNLIKELY(exceptionState.throwIfNeeded())) return; v8SetReturnValueFast(info, WTF::getPtr(jsValue.release()), imp); } ",0 "void ExtensionApiTest::SetUpCommandLine(base::CommandLine* command_line) { ExtensionBrowserTest::SetUpCommandLine(command_line); test_data_dir_ = test_data_dir_.AppendASCII(""api_test""); extensions::RegisterPathProvider(); PathService::Get(extensions::DIR_TEST_DATA, &shared_test_data_dir_); shared_test_data_dir_ = shared_test_data_dir_.AppendASCII(""api_test""); command_line->AppendSwitch(switches::kDisableRendererBackgrounding); } ",0 "static int vnc_cursor_define(VncState *vs) { QEMUCursor *c = vs->vd->cursor; int isize; if (vnc_has_feature(vs, VNC_FEATURE_RICH_CURSOR)) { vnc_lock_output(vs); vnc_write_u8(vs, VNC_MSG_SERVER_FRAMEBUFFER_UPDATE); vnc_write_u8(vs, 0); /* padding */ vnc_write_u16(vs, 1); /* # of rects */ vnc_framebuffer_update(vs, c->hot_x, c->hot_y, c->width, c->height, VNC_ENCODING_RICH_CURSOR); isize = c->width * c->height * vs->client_pf.bytes_per_pixel; vnc_write_pixels_generic(vs, c->data, isize); vnc_write(vs, vs->vd->cursor_mask, vs->vd->cursor_msize); vnc_unlock_output(vs); return 0; } return -1; } ",0 "CloseHandleEx(LPHANDLE handle) { if (handle && *handle && *handle != INVALID_HANDLE_VALUE) { CloseHandle(*handle); *handle = INVALID_HANDLE_VALUE; } return INVALID_HANDLE_VALUE; } ",0 "static int get_seg_base_limit(struct insn *insn, struct pt_regs *regs, int regoff, unsigned long *base, unsigned long *limit) { int seg_reg_idx; if (!base) return -EINVAL; seg_reg_idx = resolve_seg_reg(insn, regs, regoff); if (seg_reg_idx < 0) return seg_reg_idx; *base = insn_get_seg_base(regs, seg_reg_idx); if (*base == -1L) return -EINVAL; if (!limit) return 0; *limit = get_seg_limit(regs, seg_reg_idx); if (!(*limit)) return -EINVAL; return 0; } ",0 "DecodeDate(char *str, int fmask, int *tmask, struct tm * tm, bool EuroDates) { fsec_t fsec; int nf = 0; int i, len; int bc = FALSE; int is2digits = FALSE; int type, val, dmask = 0; char *field[MAXDATEFIELDS]; /* parse this string... */ while (*str != '\0' && nf < MAXDATEFIELDS) { /* skip field separators */ while (!isalnum((unsigned char) *str)) str++; field[nf] = str; if (isdigit((unsigned char) *str)) { while (isdigit((unsigned char) *str)) str++; } else if (isalpha((unsigned char) *str)) { while (isalpha((unsigned char) *str)) str++; } /* Just get rid of any non-digit, non-alpha characters... */ if (*str != '\0') *str++ = '\0'; nf++; } #if 0 /* don't allow too many fields */ if (nf > 3) return -1; #endif *tmask = 0; /* look first for text fields, since that will be unambiguous month */ for (i = 0; i < nf; i++) { if (isalpha((unsigned char) *field[i])) { type = DecodeSpecial(i, field[i], &val); if (type == IGNORE_DTF) continue; dmask = DTK_M(type); switch (type) { case MONTH: tm->tm_mon = val; break; case ADBC: bc = (val == BC); break; default: return -1; } if (fmask & dmask) return -1; fmask |= dmask; *tmask |= dmask; /* mark this field as being completed */ field[i] = NULL; } } /* now pick up remaining numeric fields */ for (i = 0; i < nf; i++) { if (field[i] == NULL) continue; if ((len = strlen(field[i])) <= 0) return -1; if (DecodeNumber(len, field[i], fmask, &dmask, tm, &fsec, &is2digits, EuroDates) != 0) return -1; if (fmask & dmask) return -1; fmask |= dmask; *tmask |= dmask; } if ((fmask & ~(DTK_M(DOY) | DTK_M(TZ))) != DTK_DATE_M) return -1; /* there is no year zero in AD/BC notation; i.e. ""1 BC"" == year 0 */ if (bc) { if (tm->tm_year > 0) tm->tm_year = -(tm->tm_year - 1); else return -1; } else if (is2digits) { if (tm->tm_year < 70) tm->tm_year += 2000; else if (tm->tm_year < 100) tm->tm_year += 1900; } return 0; } /* DecodeDate() */ ",0 "static void GetMinimumPixelList(PixelList *pixel_list,MagickPixelPacket *pixel) { register SkipList *list; register ssize_t channel; size_t color, minimum; ssize_t count; unsigned short channels[ListChannels]; /* Find the minimum value for each of the color. */ for (channel=0; channel < 5; channel++) { list=pixel_list->lists+channel; count=0; color=65536UL; minimum=list->nodes[color].next[0]; do { color=list->nodes[color].next[0]; if (color < minimum) minimum=color; count+=list->nodes[color].count; } while (count < (ssize_t) pixel_list->length); channels[channel]=(unsigned short) minimum; } pixel->red=(MagickRealType) ScaleShortToQuantum(channels[0]); pixel->green=(MagickRealType) ScaleShortToQuantum(channels[1]); pixel->blue=(MagickRealType) ScaleShortToQuantum(channels[2]); pixel->opacity=(MagickRealType) ScaleShortToQuantum(channels[3]); pixel->index=(MagickRealType) ScaleShortToQuantum(channels[4]); } ",0 "static void catc_stats_timer(unsigned long data) { struct catc *catc = (void *) data; int i; for (i = 0; i < 8; i++) catc_get_reg_async(catc, EthStats + 7 - i, catc_stats_done); mod_timer(&catc->timer, jiffies + STATS_UPDATE); } ",0 "static int __init pmcraid_init(void) { dev_t dev; int error; pmcraid_info(""%s Device Driver version: %s\n"", PMCRAID_DRIVER_NAME, PMCRAID_DRIVER_VERSION); error = alloc_chrdev_region(&dev, 0, PMCRAID_MAX_ADAPTERS, PMCRAID_DEVFILE); if (error) { pmcraid_err(""failed to get a major number for adapters\n""); goto out_init; } pmcraid_major = MAJOR(dev); pmcraid_class = class_create(THIS_MODULE, PMCRAID_DEVFILE); if (IS_ERR(pmcraid_class)) { error = PTR_ERR(pmcraid_class); pmcraid_err(""failed to register with with sysfs, error = %x\n"", error); goto out_unreg_chrdev; } error = pmcraid_netlink_init(); if (error) goto out_unreg_chrdev; error = pci_register_driver(&pmcraid_driver); if (error == 0) goto out_init; pmcraid_err(""failed to register pmcraid driver, error = %x\n"", error); class_destroy(pmcraid_class); pmcraid_netlink_release(); out_unreg_chrdev: unregister_chrdev_region(MKDEV(pmcraid_major, 0), PMCRAID_MAX_ADAPTERS); out_init: return error; } ",0 "bool FrameLoader::canAuthenticateAgainstProtectionSpace(ResourceLoader* loader, const ProtectionSpace& protectionSpace) { return m_client->canAuthenticateAgainstProtectionSpace(loader->documentLoader(), loader->identifier(), protectionSpace); } ",0 "pvscsi_on_cmd_unknown(PVSCSIState *s) { trace_pvscsi_on_cmd_unknown_data(s->curr_cmd_data[0]); return PVSCSI_COMMAND_PROCESSING_FAILED; } ",0 "devzvol_handle_ioctl(int cmd, zfs_cmd_t *zc, size_t *alloc_size) { uint64_t cookie; int size = 8000; int unused; int rc; if (cmd != ZFS_IOC_POOL_CONFIGS) mutex_enter(&devzvol_mtx); if (!devzvol_isopen) { if ((rc = devzvol_open_zfs()) == 0) { devzvol_isopen = B_TRUE; } else { if (cmd != ZFS_IOC_POOL_CONFIGS) mutex_exit(&devzvol_mtx); return (ENXIO); } } cookie = zc->zc_cookie; again: zc->zc_nvlist_dst = (uint64_t)(intptr_t)kmem_alloc(size, KM_SLEEP); zc->zc_nvlist_dst_size = size; rc = ldi_ioctl(devzvol_lh, cmd, (intptr_t)zc, FKIOCTL, kcred, &unused); if (rc == ENOMEM) { int newsize; newsize = zc->zc_nvlist_dst_size; ASSERT(newsize > size); kmem_free((void *)(uintptr_t)zc->zc_nvlist_dst, size); size = newsize; zc->zc_cookie = cookie; goto again; } if (alloc_size == NULL) kmem_free((void *)(uintptr_t)zc->zc_nvlist_dst, size); else *alloc_size = size; if (cmd != ZFS_IOC_POOL_CONFIGS) mutex_exit(&devzvol_mtx); return (rc); } ",0 "cifs_lock_add_if(struct cifsFileInfo *cfile, struct cifsLockInfo *lock, bool wait) { struct cifsLockInfo *conf_lock; struct cifsInodeInfo *cinode = CIFS_I(cfile->dentry->d_inode); bool exist; int rc = 0; try_again: exist = false; down_write(&cinode->lock_sem); exist = cifs_find_lock_conflict(cfile, lock->offset, lock->length, lock->type, &conf_lock, CIFS_LOCK_OP); if (!exist && cinode->can_cache_brlcks) { list_add_tail(&lock->llist, &cfile->llist->locks); up_write(&cinode->lock_sem); return rc; } if (!exist) rc = 1; else if (!wait) rc = -EACCES; else { list_add_tail(&lock->blist, &conf_lock->blist); up_write(&cinode->lock_sem); rc = wait_event_interruptible(lock->block_q, (lock->blist.prev == &lock->blist) && (lock->blist.next == &lock->blist)); if (!rc) goto try_again; down_write(&cinode->lock_sem); list_del_init(&lock->blist); } up_write(&cinode->lock_sem); return rc; } ",0 "ssh_packet_send2(struct ssh *ssh) { struct session_state *state = ssh->state; struct packet *p; u_char type; int r; type = sshbuf_ptr(state->outgoing_packet)[5]; /* during rekeying we can only send key exchange messages */ if (state->rekeying) { if ((type < SSH2_MSG_TRANSPORT_MIN) || (type > SSH2_MSG_TRANSPORT_MAX) || (type == SSH2_MSG_SERVICE_REQUEST) || (type == SSH2_MSG_SERVICE_ACCEPT)) { debug(""enqueue packet: %u"", type); p = calloc(1, sizeof(*p)); if (p == NULL) return SSH_ERR_ALLOC_FAIL; p->type = type; p->payload = state->outgoing_packet; TAILQ_INSERT_TAIL(&state->outgoing, p, next); state->outgoing_packet = sshbuf_new(); if (state->outgoing_packet == NULL) return SSH_ERR_ALLOC_FAIL; return 0; } } /* rekeying starts with sending KEXINIT */ if (type == SSH2_MSG_KEXINIT) state->rekeying = 1; if ((r = ssh_packet_send2_wrapped(ssh)) != 0) return r; /* after a NEWKEYS message we can send the complete queue */ if (type == SSH2_MSG_NEWKEYS) { state->rekeying = 0; state->rekey_time = monotime(); while ((p = TAILQ_FIRST(&state->outgoing))) { type = p->type; debug(""dequeue packet: %u"", type); sshbuf_free(state->outgoing_packet); state->outgoing_packet = p->payload; TAILQ_REMOVE(&state->outgoing, p, next); free(p); if ((r = ssh_packet_send2_wrapped(ssh)) != 0) return r; } } return 0; } ",0 "void OxideQQuickWebViewPrivate::LoadingChanged() { Q_Q(OxideQQuickWebView); emit q->loadingStateChanged(); } ",0 "SProcRenderColorTrapezoids (ClientPtr client) { return BadImplementation; } ",0 "monitor_read_log(struct monitor *pmonitor) { Buffer logmsg; u_int len, level; char *msg; buffer_init(&logmsg); /* Read length */ buffer_append_space(&logmsg, 4); if (atomicio(read, pmonitor->m_log_recvfd, buffer_ptr(&logmsg), buffer_len(&logmsg)) != buffer_len(&logmsg)) { if (errno == EPIPE) { buffer_free(&logmsg); debug(""%s: child log fd closed"", __func__); close(pmonitor->m_log_recvfd); pmonitor->m_log_recvfd = -1; return -1; } fatal(""%s: log fd read: %s"", __func__, strerror(errno)); } len = buffer_get_int(&logmsg); if (len <= 4 || len > 8192) fatal(""%s: invalid log message length %u"", __func__, len); /* Read severity, message */ buffer_clear(&logmsg); buffer_append_space(&logmsg, len); if (atomicio(read, pmonitor->m_log_recvfd, buffer_ptr(&logmsg), buffer_len(&logmsg)) != buffer_len(&logmsg)) fatal(""%s: log fd read: %s"", __func__, strerror(errno)); /* Log it */ level = buffer_get_int(&logmsg); msg = buffer_get_string(&logmsg, NULL); if (log_level_name(level) == NULL) fatal(""%s: invalid log level %u (corrupted message?)"", __func__, level); do_log2(level, ""%s [preauth]"", msg); buffer_free(&logmsg); free(msg); return 0; } ",0 "PassRefPtrWillBeRawPtr Document::adoptNode(PassRefPtrWillBeRawPtr source, ExceptionState& exceptionState) { EventQueueScope scope; switch (source->nodeType()) { case DOCUMENT_NODE: exceptionState.throwDOMException(NotSupportedError, ""The node provided is of type '"" + source->nodeName() + ""', which may not be adopted.""); return nullptr; case ATTRIBUTE_NODE: { Attr* attr = toAttr(source.get()); if (RefPtrWillBeRawPtr ownerElement = attr->ownerElement()) ownerElement->removeAttributeNode(attr, exceptionState); break; } default: if (source->isShadowRoot()) { exceptionState.throwDOMException(HierarchyRequestError, ""The node provided is a shadow root, which may not be adopted.""); return nullptr; } if (source->isFrameOwnerElement()) { HTMLFrameOwnerElement* frameOwnerElement = toHTMLFrameOwnerElement(source.get()); if (frame() && frame()->tree().isDescendantOf(toLocalFrameTemporary(frameOwnerElement->contentFrame()))) { exceptionState.throwDOMException(HierarchyRequestError, ""The node provided is a frame which contains this document.""); return nullptr; } } if (source->parentNode()) { source->parentNode()->removeChild(source.get(), exceptionState); if (exceptionState.hadException()) return nullptr; } } this->adoptIfNeeded(*source); return source; } ",0 "static void audit_log_task(struct audit_buffer *ab) { kuid_t auid, uid; kgid_t gid; unsigned int sessionid; char comm[sizeof(current->comm)]; auid = audit_get_loginuid(current); sessionid = audit_get_sessionid(current); current_uid_gid(&uid, &gid); audit_log_format(ab, ""auid=%u uid=%u gid=%u ses=%u"", from_kuid(&init_user_ns, auid), from_kuid(&init_user_ns, uid), from_kgid(&init_user_ns, gid), sessionid); audit_log_task_context(ab); audit_log_format(ab, "" pid=%d comm="", task_pid_nr(current)); audit_log_untrustedstring(ab, get_task_comm(comm, current)); audit_log_d_path_exe(ab, current->mm); } ",0 "void BackFramebuffer::Create() { ScopedGLErrorSuppressor suppressor(""BackFramebuffer::Create"", decoder_->GetErrorState()); Destroy(); glGenFramebuffersEXT(1, &id_); } ",0 "unsigned long long Timing::responseStart() const { ResourceLoadTiming* timing = resourceLoadTiming(); if (!timing) return 0; ASSERT(timing->receiveHeadersEnd >= 0); return resourceLoadTimeRelativeToAbsolute(timing->receiveHeadersEnd); } ",0 "static void init_emulate_ctxt(struct kvm_vcpu *vcpu) { struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; int cs_db, cs_l; kvm_x86_ops->get_cs_db_l_bits(vcpu, &cs_db, &cs_l); ctxt->eflags = kvm_get_rflags(vcpu); ctxt->eip = kvm_rip_read(vcpu); ctxt->mode = (!is_protmode(vcpu)) ? X86EMUL_MODE_REAL : (ctxt->eflags & X86_EFLAGS_VM) ? X86EMUL_MODE_VM86 : cs_l ? X86EMUL_MODE_PROT64 : cs_db ? X86EMUL_MODE_PROT32 : X86EMUL_MODE_PROT16; ctxt->guest_mode = is_guest_mode(vcpu); init_decode_cache(ctxt); vcpu->arch.emulate_regs_need_sync_from_vcpu = false; } ",0 "static int attr_list_has_file( const char *attr, const char *path ) { char const *file; MyString str; file = condor_basename(path); Shadow->getJobAd()->LookupString(attr,str); StringList list(str.Value()); if( list.contains_withwildcard(path) || list.contains_withwildcard(file) ) { return 1; } else { return 0; } } ",0 "resync_start_show(struct mddev *mddev, char *page) { if (mddev->recovery_cp == MaxSector) return sprintf(page, ""none\n""); return sprintf(page, ""%llu\n"", (unsigned long long)mddev->recovery_cp); } ",0 "void PageInfoWindowGtk::InitContents() { if (contents_) gtk_widget_destroy(contents_); contents_ = gtk_vbox_new(FALSE, gtk_util::kContentAreaSpacing); for (int i = 0; i < model_.GetSectionCount(); i++) { gtk_box_pack_start(GTK_BOX(contents_), CreateSection(model_.GetSectionInfo(i)), FALSE, FALSE, 0); } gtk_widget_show_all(contents_); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog_)->vbox), contents_); } ",0 "void DownloadFileManager::CompleteDownload(DownloadId global_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); if (!ContainsKey(downloads_, global_id)) return; DownloadFile* download_file = downloads_[global_id]; VLOG(20) << "" "" << __FUNCTION__ << ""()"" << "" id = "" << global_id << "" download_file = "" << download_file->DebugString(); download_file->Detach(); EraseDownload(global_id); } ",1 "SYSCALL_DEFINE3(syslog, int, type, char __user *, buf, int, len) { return do_syslog(type, buf, len, SYSLOG_FROM_CALL); } ",0 "void RenderViewImpl::OnNavigate(const ViewMsg_Navigate_Params& params) { if (!params.embedder_channel_name.empty() && !GetGuestToEmbedderChannel()) { content::old::GuestToEmbedderChannel* embedder_channel = RenderThreadImpl::current()->browser_plugin_channel_manager()-> GetChannelByName(params.embedder_channel_name); DCHECK(embedder_channel); SetGuestToEmbedderChannel(embedder_channel); host_window_set_ = false; GetWebView()->loseCompositorContext(1); RenderThreadImpl::current()->browser_plugin_channel_manager()-> ReportChannelToEmbedder(this, embedder_channel->embedder_channel_handle(), params.embedder_channel_name, params.embedder_container_id); } MaybeHandleDebugURL(params.url); if (!webview()) return; FOR_EACH_OBSERVER(RenderViewObserver, observers_, Navigate(params.url)); bool is_reload = IsReload(params); if (IsBackForwardToStaleEntry(params, is_reload)) return; if (is_swapped_out_) { webview()->setVisibilityState(visibilityState(), false); SetSwappedOut(false); } history_list_offset_ = params.current_history_list_offset; history_list_length_ = params.current_history_list_length; if (history_list_length_ >= 0) history_page_ids_.resize(history_list_length_, -1); if (params.pending_history_list_offset >= 0 && params.pending_history_list_offset < history_list_length_) history_page_ids_[params.pending_history_list_offset] = params.page_id; content::GetContentClient()->SetActiveURL(params.url); WebFrame* main_frame = webview()->mainFrame(); if (is_reload && main_frame->currentHistoryItem().isNull()) { is_reload = false; } pending_navigation_params_.reset(new ViewMsg_Navigate_Params); *pending_navigation_params_.get() = params; if (is_reload) { bool reload_original_url = (params.navigation_type == ViewMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL); bool ignore_cache = (params.navigation_type == ViewMsg_Navigate_Type::RELOAD_IGNORING_CACHE); if (reload_original_url) main_frame->reloadWithOverrideURL(params.url, true); else main_frame->reload(ignore_cache); } else if (!params.state.empty()) { DCHECK_NE(params.page_id, -1); main_frame->loadHistoryItem( webkit_glue::HistoryItemFromString(params.state)); } else if (!params.base_url_for_data_url.is_empty()) { std::string mime_type, charset, data; if (net::DataURL::Parse(params.url, &mime_type, &charset, &data)) { main_frame->loadData( WebData(data.c_str(), data.length()), WebString::fromUTF8(mime_type), WebString::fromUTF8(charset), params.base_url_for_data_url, params.history_url_for_data_url, false); } else { CHECK(false) << ""Invalid URL passed: "" << params.url.possibly_invalid_spec(); } } else { WebURLRequest request(params.url); CHECK_EQ(params.page_id, -1); if (main_frame->isViewSourceModeEnabled()) request.setCachePolicy(WebURLRequest::ReturnCacheDataElseLoad); if (params.referrer.url.is_valid()) { WebString referrer = WebSecurityPolicy::generateReferrerHeader( params.referrer.policy, params.url, WebString::fromUTF8(params.referrer.url.spec())); if (!referrer.isEmpty()) request.setHTTPHeaderField(WebString::fromUTF8(""Referer""), referrer); } if (!params.extra_headers.empty()) { for (net::HttpUtil::HeadersIterator i(params.extra_headers.begin(), params.extra_headers.end(), ""\n""); i.GetNext(); ) { request.addHTTPHeaderField(WebString::fromUTF8(i.name()), WebString::fromUTF8(i.values())); } } if (params.is_post) { request.setHTTPMethod(WebString::fromUTF8(""POST"")); WebHTTPBody http_body; http_body.initialize(); http_body.appendData(WebData( reinterpret_cast( ¶ms.browser_initiated_post_data.front()), params.browser_initiated_post_data.size())); request.setHTTPBody(http_body); } main_frame->loadRequest(request); } pending_navigation_params_.reset(); } ",0 "static int vhost_update_avail_event(struct vhost_virtqueue *vq, u16 avail_event) { if (__put_user(vq->avail_idx, vhost_avail_event(vq))) return -EFAULT; if (unlikely(vq->log_used)) { void __user *used; /* Make sure the event is seen before log. */ smp_wmb(); /* Log avail event write */ used = vhost_avail_event(vq); log_write(vq->log_base, vq->log_addr + (used - (void __user *)vq->used), sizeof *vhost_avail_event(vq)); if (vq->log_ctx) eventfd_signal(vq->log_ctx, 1); } return 0; } ",0 "static inline struct net_device** get_dev_p(pvc_device *pvc, int type) { if (type == ARPHRD_ETHER) return &pvc->ether; else return &pvc->main; } ",0 "void BookmarkEventRouter::BookmarkNodeAdded(BookmarkModel* model, const BookmarkNode* parent, int index) { scoped_ptr args(new ListValue()); const BookmarkNode* node = parent->GetChild(index); args->Append(new StringValue(base::Int64ToString(node->id()))); scoped_ptr tree_node( bookmark_api_helpers::GetBookmarkTreeNode(node, false, false)); args->Append(tree_node->ToValue().release()); DispatchEvent(model->profile(), keys::kOnBookmarkCreated, args.Pass()); } ",0 "void UsageTracker::DidGetClientHostUsage(const std::string& host, StorageType type, int64 usage) { DCHECK_EQ(type, type_); TrackingInfo& info = outstanding_host_usage_[host]; info.usage += usage; if (--info.pending_clients == 0) { if (info.usage < 0) info.usage = 0; host_usage_callbacks_.Run(host, host, type, info.usage); outstanding_host_usage_.erase(host); } } ",0 "void RenderView::didCreateScriptContext(WebFrame* frame) { EventBindings::HandleContextCreated(frame, false); } ",0 "static struct cm_id_private * cm_insert_listen(struct cm_id_private *cm_id_priv) { struct rb_node **link = &cm.listen_service_table.rb_node; struct rb_node *parent = NULL; struct cm_id_private *cur_cm_id_priv; __be64 service_id = cm_id_priv->id.service_id; __be64 service_mask = cm_id_priv->id.service_mask; int data_cmp; while (*link) { parent = *link; cur_cm_id_priv = rb_entry(parent, struct cm_id_private, service_node); data_cmp = cm_compare_data(cm_id_priv->compare_data, cur_cm_id_priv->compare_data); if ((cur_cm_id_priv->id.service_mask & service_id) == (service_mask & cur_cm_id_priv->id.service_id) && (cm_id_priv->id.device == cur_cm_id_priv->id.device) && !data_cmp) return cur_cm_id_priv; if (cm_id_priv->id.device < cur_cm_id_priv->id.device) link = &(*link)->rb_left; else if (cm_id_priv->id.device > cur_cm_id_priv->id.device) link = &(*link)->rb_right; else if (be64_lt(service_id, cur_cm_id_priv->id.service_id)) link = &(*link)->rb_left; else if (be64_gt(service_id, cur_cm_id_priv->id.service_id)) link = &(*link)->rb_right; else if (data_cmp < 0) link = &(*link)->rb_left; else link = &(*link)->rb_right; } rb_link_node(&cm_id_priv->service_node, parent, link); rb_insert_color(&cm_id_priv->service_node, &cm.listen_service_table); return NULL; } ",0 " CreateJob(ProxyResolverV8TracingFactoryImpl* factory, scoped_ptr bindings, const scoped_refptr& pac_script, scoped_ptr* resolver_out, const CompletionCallback& callback) : factory_(factory), thread_(new base::Thread(""Proxy Resolver"")), resolver_out_(resolver_out), callback_(callback), num_outstanding_callbacks_(0) { base::Thread::Options options; options.timer_slack = base::TIMER_SLACK_MAXIMUM; CHECK(thread_->StartWithOptions(options)); job_params_.reset( new Job::Params(thread_->task_runner(), &num_outstanding_callbacks_)); create_resolver_job_ = new Job(job_params_.get(), std::move(bindings)); create_resolver_job_->StartCreateV8Resolver( pac_script, &v8_resolver_, base::Bind( &ProxyResolverV8TracingFactoryImpl::CreateJob::OnV8ResolverCreated, base::Unretained(this))); } ",0 "void ChromeContentBrowserClient::GetAdditionalMappedFilesForChildProcess( const CommandLine& command_line, int child_process_id, std::vector* mappings) { #if defined(OS_ANDROID) base::FilePath data_path; PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &data_path); DCHECK(!data_path.empty()); int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; base::FilePath chrome_pak = data_path.AppendASCII(""chrome.pak""); base::PlatformFile f = base::CreatePlatformFile(chrome_pak, flags, NULL, NULL); DCHECK(f != base::kInvalidPlatformFileValue); mappings->push_back(FileDescriptorInfo(kAndroidChromePakDescriptor, FileDescriptor(f, true))); base::FilePath chrome_resources_pak = data_path.AppendASCII(""chrome_100_percent.pak""); f = base::CreatePlatformFile(chrome_resources_pak, flags, NULL, NULL); DCHECK(f != base::kInvalidPlatformFileValue); mappings->push_back(FileDescriptorInfo(kAndroidChrome100PercentPakDescriptor, FileDescriptor(f, true))); const std::string locale = GetApplicationLocale(); base::FilePath locale_pak = ResourceBundle::GetSharedInstance(). GetLocaleFilePath(locale, false); f = base::CreatePlatformFile(locale_pak, flags, NULL, NULL); DCHECK(f != base::kInvalidPlatformFileValue); mappings->push_back(FileDescriptorInfo(kAndroidLocalePakDescriptor, FileDescriptor(f, true))); base::FilePath resources_pack_path; PathService::Get(chrome::FILE_RESOURCES_PACK, &resources_pack_path); f = base::CreatePlatformFile(resources_pack_path, flags, NULL, NULL); DCHECK(f != base::kInvalidPlatformFileValue); mappings->push_back(FileDescriptorInfo(kAndroidUIResourcesPakDescriptor, FileDescriptor(f, true))); #if defined(USE_LINUX_BREAKPAD) if (IsCrashReporterEnabled()) { f = CrashDumpManager::GetInstance()->CreateMinidumpFile(child_process_id); if (f == base::kInvalidPlatformFileValue) { LOG(ERROR) << ""Failed to create file for minidump, crash reporting will "" ""be disabled for this process.""; } else { mappings->push_back(FileDescriptorInfo(kAndroidMinidumpDescriptor, FileDescriptor(f, true))); } } #endif // defined(USE_LINUX_BREAKPAD) #else int crash_signal_fd = GetCrashSignalFD(command_line); if (crash_signal_fd >= 0) { mappings->push_back(FileDescriptorInfo(kCrashDumpSignal, FileDescriptor(crash_signal_fd, false))); } #endif // defined(OS_ANDROID) } ",0 "static inline void put_tpel_pixels_mc22_c(uint8_t *dst, const uint8_t *src, int stride, int width, int height){ int i,j; for (i=0; i < height; i++) { for (j=0; j < width; j++) { dst[j] = (2731*(2*src[j] + 3*src[j+1] + 3*src[j+stride] + 4*src[j+stride+1] + 6)) >> 15; } src += stride; dst += stride; } } ",0 "void SafeBrowsingBlockingPageV2::PopulateStringDictionary( DictionaryValue* strings, const string16& title, const string16& headline, const string16& description1, const string16& description2, const string16& description3) { strings->SetString(""title"", title); strings->SetString(""headLine"", headline); strings->SetString(""description1"", description1); strings->SetString(""description2"", description2); strings->SetString(""description3"", description3); strings->SetBoolean(""proceedDisabled"", IsPrefEnabled(prefs::kSafeBrowsingProceedAnywayDisabled)); strings->SetBoolean(""isMainFrame"", is_main_frame_load_blocked_); strings->SetBoolean(""isPhishing"", interstitial_type_ == TYPE_PHISHING); strings->SetString(""back_button"", l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_BACK_BUTTON)); strings->SetString(""seeMore"", l10n_util::GetStringUTF16( IDS_SAFE_BROWSING_MALWARE_V2_SEE_MORE)); strings->SetString(""proceed"", l10n_util::GetStringUTF16(IDS_SAFE_BROWSING_MALWARE_V2_PROCEED_LINK)); URLDataSource::SetFontAndTextDirection(strings); } ",0 "rpl_print(netdissect_options *ndo, const struct icmp6_hdr *hdr, const u_char *bp, u_int length) { int secured = hdr->icmp6_code & 0x80; int basecode= hdr->icmp6_code & 0x7f; if(secured) { ND_PRINT((ndo, "", (SEC) [worktodo]"")); /* XXX * the next header pointer needs to move forward to * skip the secure part. */ return; } else { ND_PRINT((ndo, "", (CLR)"")); } switch(basecode) { case ND_RPL_DAG_IS: ND_PRINT((ndo, ""DODAG Information Solicitation"")); if(ndo->ndo_vflag) { } break; case ND_RPL_DAG_IO: ND_PRINT((ndo, ""DODAG Information Object"")); if(ndo->ndo_vflag) { rpl_dio_print(ndo, bp, length); } break; case ND_RPL_DAO: ND_PRINT((ndo, ""Destination Advertisement Object"")); if(ndo->ndo_vflag) { rpl_dao_print(ndo, bp, length); } break; case ND_RPL_DAO_ACK: ND_PRINT((ndo, ""Destination Advertisement Object Ack"")); if(ndo->ndo_vflag) { rpl_daoack_print(ndo, bp, length); } break; default: ND_PRINT((ndo, ""RPL message, unknown code %u"",hdr->icmp6_code)); break; } return; #if 0 trunc: ND_PRINT((ndo,"" [|truncated]"")); return; #endif } ",0 "ikev1_t_print(netdissect_options *ndo, u_char tpay _U_, const struct isakmp_gen *ext, u_int item_len, const u_char *ep, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto, int depth _U_) { const struct ikev1_pl_t *p; struct ikev1_pl_t t; const u_char *cp; const char *idstr; const struct attrmap *map; size_t nmap; const u_char *ep2; ND_PRINT((ndo,""%s:"", NPSTR(ISAKMP_NPTYPE_T))); p = (const struct ikev1_pl_t *)ext; ND_TCHECK(*p); UNALIGNED_MEMCPY(&t, ext, sizeof(t)); switch (proto) { case 1: idstr = STR_OR_ID(t.t_id, ikev1_p_map); map = oakley_t_map; nmap = sizeof(oakley_t_map)/sizeof(oakley_t_map[0]); break; case 2: idstr = STR_OR_ID(t.t_id, ah_p_map); map = ipsec_t_map; nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]); break; case 3: idstr = STR_OR_ID(t.t_id, esp_p_map); map = ipsec_t_map; nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]); break; case 4: idstr = STR_OR_ID(t.t_id, ipcomp_p_map); map = ipsec_t_map; nmap = sizeof(ipsec_t_map)/sizeof(ipsec_t_map[0]); break; default: idstr = NULL; map = NULL; nmap = 0; break; } if (idstr) ND_PRINT((ndo,"" #%d id=%s "", t.t_no, idstr)); else ND_PRINT((ndo,"" #%d id=%d "", t.t_no, t.t_id)); cp = (const u_char *)(p + 1); ep2 = (const u_char *)p + item_len; while (cp < ep && cp < ep2) { if (map && nmap) { cp = ikev1_attrmap_print(ndo, cp, (ep < ep2) ? ep : ep2, map, nmap); } else cp = ikev1_attr_print(ndo, cp, (ep < ep2) ? ep : ep2); } if (ep < ep2) ND_PRINT((ndo,""..."")); return cp; trunc: ND_PRINT((ndo,"" [|%s]"", NPSTR(ISAKMP_NPTYPE_T))); return NULL; } ",1 " static void Ins_CALL( INS_ARG ) { PCallRecord pCrec; if ( BOUNDS( args[0], CUR.numFDefs ) || !CUR.FDefs[args[0]].Active ) { CUR.error = TT_Err_Invalid_Reference; return; } if ( CUR.callTop >= CUR.callSize ) { CUR.error = TT_Err_Stack_Overflow; return; } DBG_PRINT1(""%d"", args[0]); pCrec = &CUR.callStack[CUR.callTop]; pCrec->Caller_Range = CUR.curRange; pCrec->Caller_IP = CUR.IP + 1; pCrec->Cur_Count = 1; pCrec->Cur_Restart = CUR.FDefs[args[0]].Start; CUR.callTop++; INS_Goto_CodeRange( CUR.FDefs[args[0]].Range, CUR.FDefs[args[0]].Start ); CUR.step_ins = FALSE; } ",0 " void MonitorRequestOnMainThread( const net::test_server::HttpRequest& request) { accumulated_requests_.push_back(request); } ",0 "BlockedPlugin::BlockedPlugin(RenderView* render_view, WebFrame* frame, const webkit::npapi::PluginGroup& info, const WebPluginParams& params, const WebPreferences& preferences, int template_id, const string16& message, bool is_blocked_for_prerendering) : RenderViewObserver(render_view), frame_(frame), plugin_params_(params), is_blocked_for_prerendering_(is_blocked_for_prerendering), hidden_(false) { const base::StringPiece template_html( ResourceBundle::GetSharedInstance().GetRawDataResource(template_id)); DCHECK(!template_html.empty()) << ""unable to load template. ID: "" << template_id; DictionaryValue values; values.SetString(""message"", message); name_ = info.GetGroupName(); values.SetString(""name"", name_); values.SetString(""hide"", l10n_util::GetStringUTF8(IDS_PLUGIN_HIDE)); std::string html_data = jstemplate_builder::GetTemplatesHtml( template_html, &values, ""t""); plugin_ = webkit::npapi::WebViewPlugin::Create(this, preferences, html_data, GURL(kBlockedPluginDataURL)); } ",0 "void Shell::PlatformCleanUp() { } ",0 "static void ByteMethodMethod(const v8::FunctionCallbackInfo& info) { TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8SetReturnValueInt(info, impl->byteMethod()); } ",0 "void DeletedCookiesOnIO(base::OnceClosure callback, uint32_t num_deleted) { DCHECK_CURRENTLY_ON(BrowserThread::IO); BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, std::move(callback)); } ",0 " explicit SyncInternal(const std::string& name) : name_(name), weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), enable_sync_tabs_for_other_clients_(false), registrar_(NULL), change_delegate_(NULL), initialized_(false), testing_mode_(NON_TEST), observing_ip_address_changes_(false), traffic_recorder_(kMaxMessagesToRecord, kMaxMessageSizeToRecord), encryptor_(NULL), unrecoverable_error_handler_(NULL), report_unrecoverable_error_function_(NULL), created_on_loop_(MessageLoop::current()), nigori_overwrite_count_(0) { for (int i = syncable::FIRST_REAL_MODEL_TYPE; i < syncable::MODEL_TYPE_COUNT; ++i) { notification_info_map_.insert( std::make_pair(syncable::ModelTypeFromInt(i), NotificationInfo())); } BindJsMessageHandler( ""getNotificationState"", &SyncManager::SyncInternal::GetNotificationState); BindJsMessageHandler( ""getNotificationInfo"", &SyncManager::SyncInternal::GetNotificationInfo); BindJsMessageHandler( ""getRootNodeDetails"", &SyncManager::SyncInternal::GetRootNodeDetails); BindJsMessageHandler( ""getNodeSummariesById"", &SyncManager::SyncInternal::GetNodeSummariesById); BindJsMessageHandler( ""getNodeDetailsById"", &SyncManager::SyncInternal::GetNodeDetailsById); BindJsMessageHandler( ""getAllNodes"", &SyncManager::SyncInternal::GetAllNodes); BindJsMessageHandler( ""getChildNodeIds"", &SyncManager::SyncInternal::GetChildNodeIds); BindJsMessageHandler( ""getClientServerTraffic"", &SyncManager::SyncInternal::GetClientServerTraffic); } ",1 "static int init_wvc_bitstream (WavpackStream *wps, WavpackMetadata *wpmd) { if (!wpmd->byte_length || (wpmd->byte_length & 1)) return FALSE; bs_open_read (&wps->wvcbits, wpmd->data, (unsigned char *) wpmd->data + wpmd->byte_length); return TRUE; } ",0 "void RenderWidgetHostImpl::OnUnlockMouse() { const bool was_mouse_locked = !pending_mouse_lock_request_ && IsMouseLocked(); RejectMouseLockOrUnlockIfNecessary(); if (was_mouse_locked) is_last_unlocked_by_target_ = true; } ",0 "static int eseqiv_givencrypt_first(struct skcipher_givcrypt_request *req) { struct crypto_ablkcipher *geniv = skcipher_givcrypt_reqtfm(req); struct eseqiv_ctx *ctx = crypto_ablkcipher_ctx(geniv); int err = 0; spin_lock_bh(&ctx->lock); if (crypto_ablkcipher_crt(geniv)->givencrypt != eseqiv_givencrypt_first) goto unlock; crypto_ablkcipher_crt(geniv)->givencrypt = eseqiv_givencrypt; err = crypto_rng_get_bytes(crypto_default_rng, ctx->salt, crypto_ablkcipher_ivsize(geniv)); unlock: spin_unlock_bh(&ctx->lock); if (err) return err; return eseqiv_givencrypt(req); } ",0 "bool CSSComputedStyleDeclaration::useFixedFontDefaultSize() const { if (!m_node) return false; RefPtr style = m_node->computedStyle(m_pseudoElementSpecifier); if (!style) return false; return style->fontDescription().useFixedDefaultSize(); } ",0 "fst_tx_config(struct fst_port_info *port) { int i; int pi; unsigned int offset; unsigned long flags; struct fst_card_info *card; pi = port->index; card = port->card; spin_lock_irqsave(&card->card_lock, flags); for (i = 0; i < NUM_TX_BUFFER; i++) { offset = BUF_OFFSET(txBuffer[pi][i][0]); FST_WRW(card, txDescrRing[pi][i].ladr, (u16) offset); FST_WRB(card, txDescrRing[pi][i].hadr, (u8) (offset >> 16)); FST_WRW(card, txDescrRing[pi][i].bcnt, 0); FST_WRB(card, txDescrRing[pi][i].bits, 0); } port->txpos = 0; port->txipos = 0; port->start = 0; spin_unlock_irqrestore(&card->card_lock, flags); } ",0 "unsigned long ring_buffer_size(struct ring_buffer *buffer, int cpu) { /* * Earlier, this method returned * BUF_PAGE_SIZE * buffer->nr_pages * Since the nr_pages field is now removed, we have converted this to * return the per cpu buffer value. */ if (!cpumask_test_cpu(cpu, buffer->cpumask)) return 0; return BUF_PAGE_SIZE * buffer->buffers[cpu]->nr_pages; } ",0 "int ptrace_put_reg(struct task_struct *task, int regno, unsigned long data) { if (task->thread.regs == NULL) return -EIO; if (regno == PT_MSR) return set_user_msr(task, data); if (regno == PT_TRAP) return set_user_trap(task, data); if (regno == PT_DSCR) return set_user_dscr(task, data); if (regno <= PT_MAX_PUT_REG) { ((unsigned long *)task->thread.regs)[regno] = data; return 0; } return -EIO; } ",0 "bool MojoAudioOutputIPC::DoRequestDeviceAuthorization( int session_id, const std::string& device_id, AuthorizationCB callback) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); auto* factory = factory_accessor_.Run(); if (!factory) { LOG(ERROR) << ""MojoAudioOutputIPC failed to acquire factory""; callback.Reset(); return false; } static_assert(sizeof(int) == sizeof(int32_t), ""sizeof(int) == sizeof(int32_t)""); factory->RequestDeviceAuthorization(MakeProviderRequest(), session_id, device_id, std::move(callback)); return true; } ",0 "int btrfs_end_transaction(struct btrfs_trans_handle *trans, struct btrfs_root *root) { int ret; ret = __btrfs_end_transaction(trans, root, 0); if (ret) return ret; return 0; } ",0 "int yr_arena_create( size_t initial_size, int flags, YR_ARENA** arena) { YR_ARENA* new_arena; YR_ARENA_PAGE* new_page; *arena = NULL; new_arena = (YR_ARENA*) yr_malloc(sizeof(YR_ARENA)); if (new_arena == NULL) return ERROR_INSUFFICIENT_MEMORY; new_page = _yr_arena_new_page(initial_size); if (new_page == NULL) { yr_free(new_arena); return ERROR_INSUFFICIENT_MEMORY; } new_arena->page_list_head = new_page; new_arena->current_page = new_page; new_arena->flags = flags | ARENA_FLAGS_COALESCED; *arena = new_arena; return ERROR_SUCCESS; } ",0 "void LocalDOMWindow::AcceptLanguagesChanged() { if (navigator_) navigator_->SetLanguagesChanged(); DispatchEvent(Event::Create(EventTypeNames::languagechange)); } ",0 "nlmsvc_update_deferred_block(struct nlm_block *block, int result) { block->b_flags |= B_GOT_CALLBACK; if (result == 0) block->b_granted = 1; else block->b_flags |= B_TIMED_OUT; } ",0 "url_escape_dir (const char *dir) { char *newdir = url_escape_1 (dir, urlchr_unsafe | urlchr_reserved, 1); if (newdir == dir) return (char *)dir; unescape_single_char (newdir, '/'); return newdir; } ",0 "void smbXcli_session_set_disconnect_expired(struct smbXcli_session *session) { session->disconnect_expired = true; } ",0 "void Browser::FocusAppMenu() { UserMetrics::RecordAction(UserMetricsAction(""FocusAppMenu""), profile_); window_->FocusAppMenu(); } ",0 "void SyncBackendHost::Core::OnUpdatedToken(const std::string& token) { host_->frontend_loop_->PostTask(FROM_HERE, NewRunnableMethod(this, &Core::NotifyUpdatedToken, token)); } ",0 "gfx::Size ShellSurface::GetPreferredSize() const { if (!geometry_.IsEmpty()) return geometry_.size(); return surface_ ? surface_->window()->layer()->size() : gfx::Size(); } ",0 "void preempt_notifier_inc(void) { static_key_slow_inc(&preempt_notifier_key); } ",0 "env_set(const char *var, const char *val) { if (val) { #ifdef HAVE_SETENV setenv(var, val, 1); #else char *buf; size_t size = strlen(var) + 1 + strlen(val) + 1; buf = alloca(size); sprintf(buf, ""%s=%s"", var, val); if (getenv(var)) putenv(buf); else putenv(strdup(buf)); #endif } else { #ifdef HAVE_UNSETENV unsetenv(var); #else if (getenv(var)) putenv(var); #endif } } ",0 "void init_entity_runnable_average(struct sched_entity *se) { struct sched_avg *sa = &se->avg; memset(sa, 0, sizeof(*sa)); /* * Tasks are initialized with full load to be seen as heavy tasks until * they get a chance to stabilize to their real load level. * Group entities are initialized with zero load to reflect the fact that * nothing has been attached to the task group yet. */ if (entity_is_task(se)) sa->runnable_load_avg = sa->load_avg = scale_load_down(se->load.weight); se->runnable_weight = se->load.weight; /* when this task enqueue'ed, it will contribute to its cfs_rq's load_avg */ } ",0 "void DevToolsWindow::OpenDevToolsWindow( scoped_refptr agent_host, Profile* profile) { if (!profile) profile = Profile::FromBrowserContext(agent_host->GetBrowserContext()); if (!profile) return; std::string type = agent_host->GetType(); bool is_worker = type == DevToolsAgentHost::kTypeServiceWorker || type == DevToolsAgentHost::kTypeSharedWorker; if (!agent_host->GetFrontendURL().empty()) { FrontendType frontend_type = kFrontendRemote; if (is_worker) { frontend_type = kFrontendWorker; } else if (type == ""node"") { frontend_type = kFrontendV8; } DevToolsWindow::OpenExternalFrontend(profile, agent_host->GetFrontendURL(), agent_host, frontend_type); return; } if (is_worker) { DevToolsWindow::OpenDevToolsWindowForWorker(profile, agent_host); return; } if (type == content::DevToolsAgentHost::kTypeFrame) { DevToolsWindow::OpenDevToolsWindowForFrame(profile, agent_host); return; } content::WebContents* web_contents = agent_host->GetWebContents(); if (web_contents) DevToolsWindow::OpenDevToolsWindow(web_contents); } ",0 "PHPAPI char *php_escape_shell_cmd(char *str) { register int x, y, l = strlen(str); char *cmd; char *p = NULL; size_t estimate = (2 * l) + 1; TSRMLS_FETCH(); cmd = safe_emalloc(2, l, 1); for (x = 0, y = 0; x < l; x++) { int mb_len = php_mblen(str + x, (l - x)); /* skip non-valid multibyte characters */ if (mb_len < 0) { continue; } else if (mb_len > 1) { memcpy(cmd + y, str + x, mb_len); y += mb_len; x += mb_len - 1; continue; } switch (str[x]) { #ifndef PHP_WIN32 case '""': case '\'': if (!p && (p = memchr(str + x + 1, str[x], l - x - 1))) { /* noop */ } else if (p && *p == str[x]) { p = NULL; } else { cmd[y++] = '\\'; } cmd[y++] = str[x]; break; #else /* % is Windows specific for enviromental variables, ^%PATH% will output PATH whil ^%PATH^% not. escapeshellcmd will escape all %. */ case '%': case '""': case '\'': #endif case '#': /* This is character-set independent */ case '&': case ';': case '`': case '|': case '*': case '?': case '~': case '<': case '>': case '^': case '(': case ')': case '[': case ']': case '{': case '}': case '$': case '\\': case '\x0A': /* excluding these two */ case '\xFF': #ifdef PHP_WIN32 cmd[y++] = '^'; #else cmd[y++] = '\\'; #endif /* fall-through */ default: cmd[y++] = str[x]; } } cmd[y] = '\0'; if ((estimate - y) > 4096) { /* realloc if the estimate was way overill * Arbitrary cutoff point of 4096 */ cmd = erealloc(cmd, y + 1); } return cmd; } ",0 "void trace_parser_put(struct trace_parser *parser) { kfree(parser->buffer); parser->buffer = NULL; } ",0 "VOID ParaNdis_FreePhysicalMemory( PARANDIS_ADAPTER *pContext, tCompletePhysicalAddress *pAddresses) { NdisMFreeSharedMemory( pContext->MiniportHandle, pAddresses->size, TRUE, pAddresses->Virtual, pAddresses->Physical); } ",0 "string16 AutocompleteProvider::StringForURLDisplay(const GURL& url, bool check_accept_lang, bool trim_http) const { std::string languages = (check_accept_lang && profile_) ? profile_->GetPrefs()->GetString(prefs::kAcceptLanguages) : std::string(); return net::FormatUrl( url, languages, net::kFormatUrlOmitAll & ~(trim_http ? 0 : net::kFormatUrlOmitHTTP), net::UnescapeRule::SPACES, NULL, NULL, NULL); } ",0 "static void pci_vmsvga_realize(PCIDevice *dev, Error **errp) { struct pci_vmsvga_state_s *s = VMWARE_SVGA(dev); dev->config[PCI_CACHE_LINE_SIZE] = 0x08; dev->config[PCI_LATENCY_TIMER] = 0x40; dev->config[PCI_INTERRUPT_LINE] = 0xff; /* End */ memory_region_init_io(&s->io_bar, NULL, &vmsvga_io_ops, &s->chip, ""vmsvga-io"", 0x10); memory_region_set_flush_coalesced(&s->io_bar); pci_register_bar(dev, 0, PCI_BASE_ADDRESS_SPACE_IO, &s->io_bar); vmsvga_init(DEVICE(dev), &s->chip, pci_address_space(dev), pci_address_space_io(dev)); pci_register_bar(dev, 1, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->chip.vga.vram); pci_register_bar(dev, 2, PCI_BASE_ADDRESS_MEM_PREFETCH, &s->chip.fifo_ram); if (!dev->rom_bar) { /* compatibility with pc-0.13 and older */ vga_init_vbe(&s->chip.vga, OBJECT(dev), pci_address_space(dev)); } } ",0 "void InputDispatcher::InputState::addMotionMemento(const MotionEntry* entry, int32_t flags, bool hovering) { mMotionMementos.push(); MotionMemento& memento = mMotionMementos.editTop(); memento.deviceId = entry->deviceId; memento.source = entry->source; memento.flags = flags; memento.xPrecision = entry->xPrecision; memento.yPrecision = entry->yPrecision; memento.downTime = entry->downTime; memento.displayId = entry->displayId; memento.setPointers(entry); memento.hovering = hovering; memento.policyFlags = entry->policyFlags; } ",0 "static void createMask(WhereMaskSet *pMaskSet, int iCursor){ assert( pMaskSet->n < ArraySize(pMaskSet->ix) ); pMaskSet->ix[pMaskSet->n++] = iCursor; } ",0 " size_t transferred() const { return transferred_; } ",0 "void RenderThread::InformHostOfCacheStats() { EnsureWebKitInitialized(); WebCache::UsageStats stats; WebCache::getUsageStats(&stats); Send(new ViewHostMsg_UpdatedCacheStats(stats)); cache_stats_task_pending_ = false; } ",0 "p_string(FILE* f, int len, UChar* s) { fputs("":"", f); while (len-- > 0) { fputc(*s++, f); } } ",0 "static int lo_write_simple(struct loop_device *lo, struct request *rq, loff_t pos) { struct bio_vec bvec; struct req_iterator iter; int ret = 0; rq_for_each_segment(bvec, rq, iter) { ret = lo_write_bvec(lo->lo_backing_file, &bvec, &pos); if (ret < 0) break; cond_resched(); } return ret; } ",0 " Read_CVT( TT_ExecContext exc, FT_ULong idx ) { return exc->cvt[idx]; } ",0 "static void pdf_run_gs_BM(fz_context *ctx, pdf_processor *proc, const char *blendmode) { pdf_run_processor *pr = (pdf_run_processor *)proc; pdf_gstate *gstate = pdf_flush_text(ctx, pr); gstate->blendmode = fz_lookup_blendmode(blendmode); } ",0 "static int aes_ocb_cleanup(EVP_CIPHER_CTX *c) { EVP_AES_OCB_CTX *octx = EVP_C_DATA(EVP_AES_OCB_CTX,c); CRYPTO_ocb128_cleanup(&octx->ocb); return 1; } ",0 "bool AsyncPixelTransfersCompletedQuery::End( base::subtle::Atomic32 submit_count) { AsyncMemoryParams mem_params; Buffer buffer = manager()->decoder()->GetSharedMemoryBuffer(shm_id()); if (!buffer.shared_memory) return false; mem_params.shared_memory = buffer.shared_memory; mem_params.shm_size = buffer.size; mem_params.shm_data_offset = shm_offset(); mem_params.shm_data_size = sizeof(QuerySync); observer_ = new AsyncPixelTransferCompletionObserverImpl(submit_count); manager()->decoder()->GetAsyncPixelTransferManager() ->AsyncNotifyCompletion(mem_params, observer_); return AddToPendingTransferQueue(submit_count); } ",1 "static ssize_t sock_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct file *file = iocb->ki_filp; struct socket *sock = file->private_data; struct msghdr msg = {.msg_iter = *to, .msg_iocb = iocb}; ssize_t res; if (file->f_flags & O_NONBLOCK) msg.msg_flags = MSG_DONTWAIT; if (iocb->ki_pos != 0) return -ESPIPE; if (!iov_iter_count(to)) /* Match SYS5 behaviour */ return 0; res = sock_recvmsg(sock, &msg, iov_iter_count(to), msg.msg_flags); *to = msg.msg_iter; return res; } ",0 "static bool spd_can_coalesce(const struct splice_pipe_desc *spd, struct page *page, unsigned int offset) { return spd->nr_pages && spd->pages[spd->nr_pages - 1] == page && (spd->partial[spd->nr_pages - 1].offset + spd->partial[spd->nr_pages - 1].len == offset); } ",0 "bool GLES2DecoderImpl::ClearLevel( unsigned service_id, unsigned bind_target, unsigned target, int level, unsigned internal_format, unsigned format, unsigned type, int width, int height, bool is_texture_immutable) { uint32 channels = GLES2Util::GetChannelsForFormat(format); if (feature_info_->feature_flags().angle_depth_texture && (channels & GLES2Util::kDepth) != 0) { GLuint fb = 0; glGenFramebuffersEXT(1, &fb); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb); bool have_stencil = (channels & GLES2Util::kStencil) != 0; GLenum attachment = have_stencil ? GL_DEPTH_STENCIL_ATTACHMENT : GL_DEPTH_ATTACHMENT; glFramebufferTexture2DEXT( GL_DRAW_FRAMEBUFFER_EXT, attachment, target, service_id, level); if (glCheckFramebufferStatusEXT(GL_DRAW_FRAMEBUFFER_EXT) != GL_FRAMEBUFFER_COMPLETE) { return false; } glClearStencil(0); state_.SetDeviceStencilMaskSeparate(GL_FRONT, -1); state_.SetDeviceStencilMaskSeparate(GL_BACK, -1); glClearDepth(1.0f); state_.SetDeviceDepthMask(GL_TRUE); state_.SetDeviceCapabilityState(GL_SCISSOR_TEST, false); glClear(GL_DEPTH_BUFFER_BIT | (have_stencil ? GL_STENCIL_BUFFER_BIT : 0)); RestoreClearState(); glDeleteFramebuffersEXT(1, &fb); Framebuffer* framebuffer = GetFramebufferInfoForTarget(GL_DRAW_FRAMEBUFFER_EXT); GLuint fb_service_id = framebuffer ? framebuffer->service_id() : GetBackbufferServiceId(); glBindFramebufferEXT(GL_DRAW_FRAMEBUFFER_EXT, fb_service_id); return true; } static const uint32 kMaxZeroSize = 1024 * 1024 * 4; uint32 size; uint32 padded_row_size; if (!GLES2Util::ComputeImageDataSizes( width, height, format, type, state_.unpack_alignment, &size, NULL, &padded_row_size)) { return false; } TRACE_EVENT1(""gpu"", ""GLES2DecoderImpl::ClearLevel"", ""size"", size); int tile_height; if (size > kMaxZeroSize) { if (kMaxZeroSize < padded_row_size) { return false; } DCHECK_GT(padded_row_size, 0U); tile_height = kMaxZeroSize / padded_row_size; if (!GLES2Util::ComputeImageDataSizes( width, tile_height, format, type, state_.unpack_alignment, &size, NULL, NULL)) { return false; } } else { tile_height = height; } scoped_ptr zero(new char[size]); memset(zero.get(), 0, size); glBindTexture(bind_target, service_id); GLint y = 0; while (y < height) { GLint h = y + tile_height > height ? height - y : tile_height; if (is_texture_immutable || h != height) { glTexSubImage2D(target, level, 0, y, width, h, format, type, zero.get()); } else { glTexImage2D( target, level, internal_format, width, h, 0, format, type, zero.get()); } y += tile_height; } TextureRef* texture = texture_manager()->GetTextureInfoForTarget( &state_, bind_target); glBindTexture(bind_target, texture ? texture->service_id() : 0); return true; } ",0 "void Range::textQuads(Vector& quads, bool useSelectionHeight, RangeInFixedPosition* inFixed) const { Node* startContainer = m_start.container(); Node* endContainer = m_end.container(); if (!startContainer || !endContainer) { if (inFixed) *inFixed = NotFixedPosition; return; } bool allFixed = true; bool someFixed = false; Node* stopNode = pastLastNode(); for (Node* node = firstNode(); node != stopNode; node = node->traverseNextNode()) { RenderObject* r = node->renderer(); if (!r || !r->isText()) continue; RenderText* renderText = toRenderText(r); int startOffset = node == startContainer ? m_start.offset() : 0; int endOffset = node == endContainer ? m_end.offset() : numeric_limits::max(); bool isFixed = false; renderText->absoluteQuadsForRange(quads, startOffset, endOffset, useSelectionHeight, &isFixed); allFixed &= isFixed; someFixed |= isFixed; } if (inFixed) *inFixed = allFixed ? EntirelyFixedPosition : (someFixed ? PartiallyFixedPosition : NotFixedPosition); } ",0 "int yr_re_parse_hex( const char* hex_string, RE_AST** re_ast, RE_ERROR* error) { return yr_parse_hex_string(hex_string, re_ast, error); } ",0 "static void __do_fault_siginfo(int code, int sig, struct pt_regs *regs, unsigned long addr) { siginfo_t info; info.si_signo = sig; info.si_code = code; info.si_errno = 0; info.si_addr = (void __user *) addr; info.si_trapno = 0; if (unlikely(show_unhandled_signals)) show_signal_msg(regs, sig, info.si_code, addr, current); force_sig_info (sig, &info, current); } ",0 "void ServiceWorkerDevToolsAgentHost::WorkerRestarted(int worker_process_id, int worker_route_id) { DCHECK_EQ(WORKER_TERMINATED, state_); state_ = WORKER_NOT_READY; worker_process_id_ = worker_process_id; worker_route_id_ = worker_route_id; RenderProcessHost* host = RenderProcessHost::FromID(worker_process_id_); for (DevToolsSession* session : sessions()) session->SetRenderer(host, nullptr); } ",1 "BaseSessionService::Handle BaseSessionService::ScheduleGetLastSessionCommands( InternalGetCommandsRequest* request, CancelableRequestConsumerBase* consumer) { scoped_refptr request_wrapper(request); AddRequest(request, consumer); RunTaskOnBackendThread( FROM_HERE, base::Bind(&SessionBackend::ReadLastSessionCommands, backend(), request_wrapper)); return request->handle(); } ",0 "size_t RenderFrameHostImpl::GetProxyCount() { if (!IsCurrent()) return 0; return frame_tree_node_->render_manager()->GetProxyCount(); } ",0 "static int __perf_event_enable(void *info) { struct perf_event *event = info; struct perf_event_context *ctx = event->ctx; struct perf_event *leader = event->group_leader; struct perf_cpu_context *cpuctx = __get_cpu_context(ctx); int err; if (WARN_ON_ONCE(!ctx->is_active)) return -EINVAL; raw_spin_lock(&ctx->lock); update_context_time(ctx); if (event->state >= PERF_EVENT_STATE_INACTIVE) goto unlock; /* * set current task's cgroup time reference point */ perf_cgroup_set_timestamp(current, ctx); __perf_event_mark_enabled(event, ctx); if (!event_filter_match(event)) { if (is_cgroup_event(event)) perf_cgroup_defer_enabled(event); goto unlock; } /* * If the event is in a group and isn't the group leader, * then don't put it on unless the group is on. */ if (leader != event && leader->state != PERF_EVENT_STATE_ACTIVE) goto unlock; if (!group_can_go_on(event, cpuctx, 1)) { err = -EEXIST; } else { if (event == leader) err = group_sched_in(event, cpuctx, ctx); else err = event_sched_in(event, cpuctx, ctx); } if (err) { /* * If this event can't go on and it's part of a * group, then the whole group has to come off. */ if (leader != event) group_sched_out(leader, cpuctx, ctx); if (leader->attr.pinned) { update_group_times(leader); leader->state = PERF_EVENT_STATE_ERROR; } } unlock: raw_spin_unlock(&ctx->lock); return 0; } ",0 "CurrentHistoryCleaner::CurrentHistoryCleaner(content::WebContents* contents) : WebContentsObserver(contents) { content::NavigationController& nc = web_contents()->GetController(); history_index_to_remove_ = nc.GetLastCommittedEntryIndex(); } ",0 "void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans, struct btrfs_root *root) { struct btrfs_block_rsv *block_rsv; int ret; if (atomic_read(&root->orphan_inodes) || root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE) return; spin_lock(&root->orphan_lock); if (atomic_read(&root->orphan_inodes)) { spin_unlock(&root->orphan_lock); return; } if (root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE) { spin_unlock(&root->orphan_lock); return; } block_rsv = root->orphan_block_rsv; root->orphan_block_rsv = NULL; spin_unlock(&root->orphan_lock); if (test_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state) && btrfs_root_refs(&root->root_item) > 0) { ret = btrfs_del_orphan_item(trans, root->fs_info->tree_root, root->root_key.objectid); if (ret) btrfs_abort_transaction(trans, root, ret); else clear_bit(BTRFS_ROOT_ORPHAN_ITEM_INSERTED, &root->state); } if (block_rsv) { WARN_ON(block_rsv->size > 0); btrfs_free_block_rsv(root, block_rsv); } } ",0 "void V8TestObject::ReadonlyLongAttributeAttributeGetterCallback(const v8::FunctionCallbackInfo& info) { RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), ""Blink_TestObject_readonlyLongAttribute_Getter""); test_object_v8_internal::ReadonlyLongAttributeAttributeGetter(info); } ",0 "static void intel_ds_init(void) { /* * No support for 32bit formats */ if (!boot_cpu_has(X86_FEATURE_DTES64)) return; x86_pmu.bts = boot_cpu_has(X86_FEATURE_BTS); x86_pmu.pebs = boot_cpu_has(X86_FEATURE_PEBS); if (x86_pmu.pebs) { char pebs_type = x86_pmu.intel_cap.pebs_trap ? '+' : '-'; int format = x86_pmu.intel_cap.pebs_format; switch (format) { case 0: printk(KERN_CONT ""PEBS fmt0%c, "", pebs_type); x86_pmu.pebs_record_size = sizeof(struct pebs_record_core); x86_pmu.drain_pebs = intel_pmu_drain_pebs_core; break; case 1: printk(KERN_CONT ""PEBS fmt1%c, "", pebs_type); x86_pmu.pebs_record_size = sizeof(struct pebs_record_nhm); x86_pmu.drain_pebs = intel_pmu_drain_pebs_nhm; break; default: printk(KERN_CONT ""no PEBS fmt%d%c, "", format, pebs_type); x86_pmu.pebs = 0; } } } ",0 "static int btrfs_dirty_inode(struct inode *inode) { struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_trans_handle *trans; int ret; if (test_bit(BTRFS_INODE_DUMMY, &BTRFS_I(inode)->runtime_flags)) return 0; trans = btrfs_join_transaction(root); if (IS_ERR(trans)) return PTR_ERR(trans); ret = btrfs_update_inode(trans, root, inode); if (ret && ret == -ENOSPC) { /* whoops, lets try again with the full transaction */ btrfs_end_transaction(trans, root); trans = btrfs_start_transaction(root, 1); if (IS_ERR(trans)) return PTR_ERR(trans); ret = btrfs_update_inode(trans, root, inode); } btrfs_end_transaction(trans, root); if (BTRFS_I(inode)->delayed_node) btrfs_balance_delayed_items(root); return ret; } ",0 "BGD_DECLARE(void *) gdImageWebpPtrEx (gdImagePtr im, int *size, int quality) { void *rv; gdIOCtx *out = gdNewDynamicCtx(2048, NULL); if (out == NULL) { return NULL; } gdImageWebpCtx(im, out, quality); rv = gdDPExtractData(out, size); out->gd_free(out); return rv; } ",1 "bool NavigationController::RendererDidNavigate( const ViewHostMsg_FrameNavigate_Params& params, int extra_invalidate_flags, LoadCommittedDetails* details) { if (GetLastCommittedEntry()) { details->previous_url = GetLastCommittedEntry()->url(); details->previous_entry_index = last_committed_entry_index(); } else { details->previous_url = GURL(); details->previous_entry_index = -1; } if (pending_entry_index_ >= 0) pending_entry_->set_site_instance(tab_contents_->GetSiteInstance()); details->type = ClassifyNavigation(params); switch (details->type) { case NavigationType::NEW_PAGE: RendererDidNavigateToNewPage(params, &(details->did_replace_entry)); break; case NavigationType::EXISTING_PAGE: RendererDidNavigateToExistingPage(params); break; case NavigationType::SAME_PAGE: RendererDidNavigateToSamePage(params); break; case NavigationType::IN_PAGE: RendererDidNavigateInPage(params, &(details->did_replace_entry)); break; case NavigationType::NEW_SUBFRAME: RendererDidNavigateNewSubframe(params); break; case NavigationType::AUTO_SUBFRAME: if (!RendererDidNavigateAutoSubframe(params)) return false; break; case NavigationType::NAV_IGNORE: return false; default: NOTREACHED(); } SetContentStateIfEmpty(GetActiveEntry()); details->is_auto = (PageTransition::IsRedirect(params.transition) && !pending_entry()) || params.gesture == NavigationGestureAuto; details->entry = GetActiveEntry(); details->is_in_page = IsURLInPageNavigation(params.url); details->is_main_frame = PageTransition::IsMainFrame(params.transition); details->serialized_security_info = params.security_info; details->is_content_filtered = params.is_content_filtered; details->http_status_code = params.http_status_code; NotifyNavigationEntryCommitted(details, extra_invalidate_flags); user_gesture_observed_ = false; return true; } ",0 "void MockRenderThread::AddObserver(content::RenderProcessObserver* observer) { } ",0 "LazyBackgroundPageNativeHandler::LazyBackgroundPageNativeHandler( ScriptContext* context) : ObjectBackedNativeHandler(context) { RouteFunction( ""IncrementKeepaliveCount"", base::Bind(&LazyBackgroundPageNativeHandler::IncrementKeepaliveCount, base::Unretained(this))); RouteFunction( ""DecrementKeepaliveCount"", base::Bind(&LazyBackgroundPageNativeHandler::DecrementKeepaliveCount, base::Unretained(this))); } ",1 "void RenderThreadImpl::HistogramCustomizer::SetCommonHost( const std::string& host) { if (host != common_host_) { common_host_ = host; common_host_histogram_suffix_ = HostToCustomHistogramSuffix(host); blink::MainThreadIsolate()->SetCreateHistogramFunction(CreateHistogram); } } ",0 "PHP_FUNCTION(is_soap_fault) { zval *fault; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""z"", &fault) == SUCCESS && Z_TYPE_P(fault) == IS_OBJECT && instanceof_function(Z_OBJCE_P(fault), soap_fault_class_entry TSRMLS_CC)) { RETURN_TRUE; } RETURN_FALSE } ",0 "static inline ssize_t CacheOffset(CubeInfo *cube_info, const DoublePixelPacket *pixel) { #define RedShift(pixel) (((pixel) >> CacheShift) << (0*(8-CacheShift))) #define GreenShift(pixel) (((pixel) >> CacheShift) << (1*(8-CacheShift))) #define BlueShift(pixel) (((pixel) >> CacheShift) << (2*(8-CacheShift))) #define AlphaShift(pixel) (((pixel) >> CacheShift) << (3*(8-CacheShift))) ssize_t offset; offset=(ssize_t) (RedShift(ScaleQuantumToChar(ClampPixel(pixel->red))) | GreenShift(ScaleQuantumToChar(ClampPixel(pixel->green))) | BlueShift(ScaleQuantumToChar(ClampPixel(pixel->blue)))); if (cube_info->associate_alpha != MagickFalse) offset|=AlphaShift(ScaleQuantumToChar(ClampPixel(pixel->opacity))); return(offset); } ",0 " ExecutionContext* executionContext() { return m_executionContext.get(); } ",0 "int jpc_bitstream_putbits(jpc_bitstream_t *bitstream, int n, long v) { int m; /* We can reliably put at most 31 bits since ISO/IEC 9899 only guarantees that a long can represent values up to 2^31-1. */ assert(n >= 0 && n < 32); /* Ensure that only the bits to be output are nonzero. */ assert(!(v & (~JAS_ONES(n)))); /* Put the desired number of bits to the specified bit stream. */ m = n - 1; while (--n >= 0) { if (jpc_bitstream_putbit(bitstream, (v >> m) & 1) == EOF) { return EOF; } v <<= 1; } return 0; } ",1 "do_os_note(struct magic_set *ms, unsigned char *nbuf, uint32_t type, int swap, uint32_t namesz, uint32_t descsz, size_t noff, size_t doff, int *flags) { if (namesz == 5 && strcmp((char *)&nbuf[noff], ""SuSE"") == 0 && type == NT_GNU_VERSION && descsz == 2) { *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for SuSE %d.%d"", nbuf[doff], nbuf[doff + 1]) == -1) return -1; return 1; } if (namesz == 4 && strcmp((char *)&nbuf[noff], ""GNU"") == 0 && type == NT_GNU_VERSION && descsz == 16) { uint32_t desc[4]; memcpy(desc, &nbuf[doff], sizeof(desc)); *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for GNU/"") == -1) return 1; switch (elf_getu32(swap, desc[0])) { case GNU_OS_LINUX: if (file_printf(ms, ""Linux"") == -1) return 1; break; case GNU_OS_HURD: if (file_printf(ms, ""Hurd"") == -1) return 1; break; case GNU_OS_SOLARIS: if (file_printf(ms, ""Solaris"") == -1) return 1; break; case GNU_OS_KFREEBSD: if (file_printf(ms, ""kFreeBSD"") == -1) return 1; break; case GNU_OS_KNETBSD: if (file_printf(ms, ""kNetBSD"") == -1) return 1; break; default: if (file_printf(ms, """") == -1) return 1; } if (file_printf(ms, "" %d.%d.%d"", elf_getu32(swap, desc[1]), elf_getu32(swap, desc[2]), elf_getu32(swap, desc[3])) == -1) return 1; return 1; } if (namesz == 7 && strcmp((char *)&nbuf[noff], ""NetBSD"") == 0) { if (type == NT_NETBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; do_note_netbsd_version(ms, swap, &nbuf[doff]); return 1; } } if (namesz == 8 && strcmp((char *)&nbuf[noff], ""FreeBSD"") == 0) { if (type == NT_FREEBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; do_note_freebsd_version(ms, swap, &nbuf[doff]); return 1; } } if (namesz == 8 && strcmp((char *)&nbuf[noff], ""OpenBSD"") == 0 && type == NT_OPENBSD_VERSION && descsz == 4) { *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for OpenBSD"") == -1) return 1; /* Content of note is always 0 */ return 1; } if (namesz == 10 && strcmp((char *)&nbuf[noff], ""DragonFly"") == 0 && type == NT_DRAGONFLY_VERSION && descsz == 4) { uint32_t desc; *flags |= FLAGS_DID_OS_NOTE; if (file_printf(ms, "", for DragonFly"") == -1) return 1; memcpy(&desc, &nbuf[doff], sizeof(desc)); desc = elf_getu32(swap, desc); if (file_printf(ms, "" %d.%d.%d"", desc / 100000, desc / 10000 % 10, desc % 10000) == -1) return 1; return 1; } return 0; } ",0 "static int shash_prepare_alg(struct shash_alg *alg) { struct crypto_alg *base = &alg->base; if (alg->digestsize > PAGE_SIZE / 8 || alg->descsize > PAGE_SIZE / 8 || alg->statesize > PAGE_SIZE / 8) return -EINVAL; base->cra_type = &crypto_shash_type; base->cra_flags &= ~CRYPTO_ALG_TYPE_MASK; base->cra_flags |= CRYPTO_ALG_TYPE_SHASH; if (!alg->finup) alg->finup = shash_finup_unaligned; if (!alg->digest) alg->digest = shash_digest_unaligned; if (!alg->export) { alg->export = shash_default_export; alg->import = shash_default_import; alg->statesize = alg->descsize; } if (!alg->setkey) alg->setkey = shash_no_setkey; return 0; } ",0 "parse_register_file_bracket( struct translate_ctx *ctx, uint *file ) { if (!parse_file( &ctx->cur, file )) { report_error( ctx, ""Unknown register file"" ); return FALSE; } eat_opt_white( &ctx->cur ); if (*ctx->cur != '[') { report_error( ctx, ""Expected `['"" ); return FALSE; } ctx->cur++; return TRUE; } ",0 " void OnTimeout() { ASSERT(m_workerThread->workerGlobalScope()); m_lastQueuedTask = nullptr; if (m_sharedTimerFunction && m_running && !m_workerThread->workerGlobalScope()->isClosing()) m_sharedTimerFunction(); } ",0 "void menu_cache_unref(MenuCache* cache) { /* DEBUG(""cache_unref: %d"", cache->n_ref); */ /* we need a lock here unfortunately because item in hash isn't protected by reference therefore another thread may get access to it right now */ MENU_CACHE_LOCK; if( g_atomic_int_dec_and_test(&cache->n_ref) ) { /* g_assert(cache->reload_id != 0); */ unregister_menu_from_server( cache ); /* DEBUG(""unregister to server""); */ g_hash_table_remove( hash, cache->menu_name ); if( g_hash_table_size(hash) == 0 ) { /* DEBUG(""destroy hash""); */ g_hash_table_destroy(hash); /* DEBUG(""disconnect from server""); */ G_LOCK(connect); shutdown(server_fd, SHUT_RDWR); /* the IO thread will terminate itself */ server_fd = -1; G_UNLOCK(connect); hash = NULL; } MENU_CACHE_UNLOCK; if(G_LIKELY(cache->thr)) { g_cancellable_cancel(cache->cancellable); g_thread_join(cache->thr); } g_object_unref(cache->cancellable); if( G_LIKELY(cache->root_dir) ) { /* DEBUG(""unref root dir""); */ menu_cache_item_unref( MENU_CACHE_ITEM(cache->root_dir) ); /* DEBUG(""unref root dir finished""); */ } g_free( cache->cache_file ); g_free( cache->menu_name ); g_free(cache->reg); /* g_free( cache->menu_file_path ); */ g_strfreev(cache->known_des); g_slist_free(cache->notifiers); g_slice_free( MenuCache, cache ); } else MENU_CACHE_UNLOCK; } ",0 "void HTMLButtonElement::setActivatedSubmit(bool flag) { m_isActivatedSubmit = flag; } ",0 "int test_gf2m_mod_exp(BIO *bp,BN_CTX *ctx) { BIGNUM *a,*b[2],*c,*d,*e,*f; int i, j, ret = 0; int p0[] = {163,7,6,3,0,-1}; int p1[] = {193,15,0,-1}; a=BN_new(); b[0]=BN_new(); b[1]=BN_new(); c=BN_new(); d=BN_new(); e=BN_new(); f=BN_new(); BN_GF2m_arr2poly(p0, b[0]); BN_GF2m_arr2poly(p1, b[1]); for (i=0; isk_filter); if (filter != NULL) res = SK_RUN_FILTER(filter, skb); rcu_read_unlock(); return res; } ",0 "static int mmu_topup_memory_cache_page(struct kvm_mmu_memory_cache *cache, int min) { void *page; if (cache->nobjs >= min) return 0; while (cache->nobjs < ARRAY_SIZE(cache->objects)) { page = (void *)__get_free_page(GFP_KERNEL); if (!page) return -ENOMEM; cache->objects[cache->nobjs++] = page; } return 0; } ",0 "static void __unhash_process(struct task_struct *p, bool group_dead) { nr_threads--; detach_pid(p, PIDTYPE_PID); if (group_dead) { detach_pid(p, PIDTYPE_PGID); detach_pid(p, PIDTYPE_SID); list_del_rcu(&p->tasks); list_del_init(&p->sibling); __this_cpu_dec(process_counts); } list_del_rcu(&p->thread_group); list_del_rcu(&p->thread_node); } ",0 "static void hns_nic_net_timeout(struct net_device *ndev) { struct hns_nic_priv *priv = netdev_priv(ndev); hns_tx_timeout_reset(priv); } ",0 "v8::Handle SerializedScriptValue::deserialize(v8::Isolate* isolate, MessagePortArray* messagePorts, const WebBlobInfoArray* blobInfo) { if (!m_data.impl()) return v8::Null(isolate); COMPILE_ASSERT(sizeof(BufferValueType) == 2, BufferValueTypeIsTwoBytes); m_data.ensure16Bit(); Reader reader(reinterpret_cast(m_data.impl()->characters16()), 2 * m_data.length(), blobInfo, m_blobDataHandles, ScriptState::current(isolate)); Deserializer deserializer(reader, messagePorts, m_arrayBufferContentsArray.get()); RefPtr protect(this); return deserializer.deserialize(); } ",0 "static int query_formats(AVFilterContext *ctx) { ff_set_common_formats(ctx, ff_draw_supported_pixel_formats(0)); return 0; } ",0 "static bool encode_vlv_response(void *mem_ctx, void *in, DATA_BLOB *out) { struct ldb_vlv_resp_control *lvrc = talloc_get_type(in, struct ldb_vlv_resp_control); struct asn1_data *data = asn1_init(mem_ctx); if (!data) return false; if (!asn1_push_tag(data, ASN1_SEQUENCE(0))) { return false; } if (!asn1_write_Integer(data, lvrc->targetPosition)) { return false; } if (!asn1_write_Integer(data, lvrc->contentCount)) { return false; } if (!asn1_write_enumerated(data, lvrc->vlv_result)) { return false; } if (lvrc->ctxid_len) { if (!asn1_write_OctetString(data, lvrc->contextId, lvrc->ctxid_len)) { return false; } } if (!asn1_pop_tag(data)) { return false; } *out = data_blob_talloc(mem_ctx, data->data, data->length); if (out->data == NULL) { return false; } talloc_free(data); return true; } ",0 " std::string InputMethodLinuxX11::GetInputLocale() { return """"; } ",0 "void traverse_bitmap_commit_list(show_reachable_fn show_reachable) { assert(bitmap_git.result); show_objects_for_type(bitmap_git.result, bitmap_git.commits, OBJ_COMMIT, show_reachable); show_objects_for_type(bitmap_git.result, bitmap_git.trees, OBJ_TREE, show_reachable); show_objects_for_type(bitmap_git.result, bitmap_git.blobs, OBJ_BLOB, show_reachable); show_objects_for_type(bitmap_git.result, bitmap_git.tags, OBJ_TAG, show_reachable); show_extended_objects(bitmap_git.result, show_reachable); bitmap_free(bitmap_git.result); bitmap_git.result = NULL; } ",0 "void SoftOpus::onReset() { mInputBufferCount = 0; mNumFramesOutput = 0; if (mDecoder != NULL) { opus_multistream_decoder_destroy(mDecoder); mDecoder = NULL; } if (mHeader != NULL) { delete mHeader; mHeader = NULL; } mOutputPortSettingsChange = NONE; } ",0 "int unshare_userns(unsigned long unshare_flags, struct cred **new_cred) { struct cred *cred; if (!(unshare_flags & CLONE_NEWUSER)) return 0; cred = prepare_creds(); if (!cred) return -ENOMEM; *new_cred = cred; return create_user_ns(cred); } ",0 "uint32_t red_channel_min_pipe_size(RedChannel *channel) { RingItem *link; RedChannelClient *rcc; uint32_t pipe_size = ~0; RING_FOREACH(link, &channel->clients) { rcc = SPICE_CONTAINEROF(link, RedChannelClient, channel_link); pipe_size = pipe_size < rcc->pipe_size ? pipe_size : rcc->pipe_size; } return pipe_size == ~0 ? 0 : pipe_size; } ",0 "void PaymentRequestState::AddAutofillPaymentInstrument( bool selected, const autofill::CreditCard& card) { std::string basic_card_network = autofill::data_util::GetPaymentRequestData(card.network()) .basic_card_issuer_network; if (!spec_->supported_card_networks_set().count(basic_card_network) || !spec_->supported_card_types_set().count(card.card_type())) { return; } constexpr size_t kTotalNumberOfCardTypes = 4U; bool matches_merchant_card_type_exactly = card.card_type() != autofill::CreditCard::CARD_TYPE_UNKNOWN || spec_->supported_card_types_set().size() == kTotalNumberOfCardTypes; auto instrument = std::make_unique( basic_card_network, card, matches_merchant_card_type_exactly, shipping_profiles_, app_locale_, payment_request_delegate_); available_instruments_.push_back(std::move(instrument)); if (selected) SetSelectedInstrument(available_instruments_.back().get()); } ",0 "PHP_FUNCTION(radius_get_attr) { radius_descriptor *raddesc; int res; const void *data; size_t len; zval *z_radh; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""r"", &z_radh) == FAILURE) { return; } ZEND_FETCH_RESOURCE(raddesc, radius_descriptor *, &z_radh, -1, ""rad_handle"", le_radius); res = rad_get_attr(raddesc->radh, &data, &len); if (res == -1) { RETURN_FALSE; } else { if (res > 0) { array_init(return_value); add_assoc_long(return_value, ""attr"", res); add_assoc_stringl(return_value, ""data"", (char *) data, len, 1); return; } RETURN_LONG(res); } } ",0 "static inline unsigned char *echo_buf_addr(struct n_tty_data *ldata, size_t i) { return &ldata->echo_buf[i & (N_TTY_BUF_SIZE - 1)]; } ",0 "cifs_uncached_retry_writev(struct cifs_writedata *wdata) { int rc; struct TCP_Server_Info *server; server = tlink_tcon(wdata->cfile->tlink)->ses->server; do { if (wdata->cfile->invalidHandle) { rc = cifs_reopen_file(wdata->cfile, false); if (rc != 0) continue; } rc = server->ops->async_writev(wdata, cifs_uncached_writedata_release); } while (rc == -EAGAIN); return rc; } ",0 "person_get_frame_delay(const person_t* person) { return person->anim_frames; } ",0 "void WebPageProxy::didChangeScrollOffsetPinningForMainFrame(bool pinnedToLeftSide, bool pinnedToRightSide) { m_mainFrameIsPinnedToLeftSide = pinnedToLeftSide; m_mainFrameIsPinnedToRightSide = pinnedToRightSide; } ",0 "static struct in_ifaddr *find_matching_ifa(struct in_ifaddr *ifa) { struct in_device *in_dev = ifa->ifa_dev; struct in_ifaddr *ifa1, **ifap; if (!ifa->ifa_local) return NULL; for (ifap = &in_dev->ifa_list; (ifa1 = *ifap) != NULL; ifap = &ifa1->ifa_next) { if (ifa1->ifa_mask == ifa->ifa_mask && inet_ifa_match(ifa1->ifa_address, ifa) && ifa1->ifa_local == ifa->ifa_local) return ifa1; } return NULL; } ",0 "static unsigned char get_decimal_point(void) { #ifdef ENABLE_LOCALES struct lconv *lconv = localeconv(); return (unsigned char) lconv->decimal_point[0]; #else return '.'; #endif } ",0 "static void update_perf_cpu_limits(void) { u64 tmp = perf_sample_period_ns; tmp *= sysctl_perf_cpu_time_max_percent; tmp = div_u64(tmp, 100); if (!tmp) tmp = 1; WRITE_ONCE(perf_sample_allowed_ns, tmp); } ",0 "static TRBCCode xhci_address_slot(XHCIState *xhci, unsigned int slotid, uint64_t pictx, bool bsr) { XHCISlot *slot; USBPort *uport; USBDevice *dev; dma_addr_t ictx, octx, dcbaap; uint64_t poctx; uint32_t ictl_ctx[2]; uint32_t slot_ctx[4]; uint32_t ep0_ctx[5]; int i; TRBCCode res; assert(slotid >= 1 && slotid <= xhci->numslots); dcbaap = xhci_addr64(xhci->dcbaap_low, xhci->dcbaap_high); poctx = ldq_le_pci_dma(PCI_DEVICE(xhci), dcbaap + 8 * slotid); ictx = xhci_mask64(pictx); octx = xhci_mask64(poctx); DPRINTF(""xhci: input context at ""DMA_ADDR_FMT""\n"", ictx); DPRINTF(""xhci: output context at ""DMA_ADDR_FMT""\n"", octx); xhci_dma_read_u32s(xhci, ictx, ictl_ctx, sizeof(ictl_ctx)); if (ictl_ctx[0] != 0x0 || ictl_ctx[1] != 0x3) { DPRINTF(""xhci: invalid input context control %08x %08x\n"", ictl_ctx[0], ictl_ctx[1]); return CC_TRB_ERROR; } xhci_dma_read_u32s(xhci, ictx+32, slot_ctx, sizeof(slot_ctx)); xhci_dma_read_u32s(xhci, ictx+64, ep0_ctx, sizeof(ep0_ctx)); DPRINTF(""xhci: input slot context: %08x %08x %08x %08x\n"", slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]); DPRINTF(""xhci: input ep0 context: %08x %08x %08x %08x %08x\n"", ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]); uport = xhci_lookup_uport(xhci, slot_ctx); if (uport == NULL) { DPRINTF(""xhci: port not found\n""); return CC_TRB_ERROR; } trace_usb_xhci_slot_address(slotid, uport->path); dev = uport->dev; if (!dev || !dev->attached) { DPRINTF(""xhci: port %s not connected\n"", uport->path); return CC_USB_TRANSACTION_ERROR; } for (i = 0; i < xhci->numslots; i++) { if (i == slotid-1) { continue; } if (xhci->slots[i].uport == uport) { DPRINTF(""xhci: port %s already assigned to slot %d\n"", uport->path, i+1); return CC_TRB_ERROR; } } slot = &xhci->slots[slotid-1]; slot->uport = uport; slot->ctx = octx; if (bsr) { slot_ctx[3] = SLOT_DEFAULT << SLOT_STATE_SHIFT; } else { USBPacket p; uint8_t buf[1]; slot_ctx[3] = (SLOT_ADDRESSED << SLOT_STATE_SHIFT) | slotid; usb_device_reset(dev); memset(&p, 0, sizeof(p)); usb_packet_addbuf(&p, buf, sizeof(buf)); usb_packet_setup(&p, USB_TOKEN_OUT, usb_ep_get(dev, USB_TOKEN_OUT, 0), 0, 0, false, false); usb_device_handle_control(dev, &p, DeviceOutRequest | USB_REQ_SET_ADDRESS, slotid, 0, 0, NULL); assert(p.status != USB_RET_ASYNC); } res = xhci_enable_ep(xhci, slotid, 1, octx+32, ep0_ctx); DPRINTF(""xhci: output slot context: %08x %08x %08x %08x\n"", slot_ctx[0], slot_ctx[1], slot_ctx[2], slot_ctx[3]); DPRINTF(""xhci: output ep0 context: %08x %08x %08x %08x %08x\n"", ep0_ctx[0], ep0_ctx[1], ep0_ctx[2], ep0_ctx[3], ep0_ctx[4]); xhci_dma_write_u32s(xhci, octx, slot_ctx, sizeof(slot_ctx)); xhci_dma_write_u32s(xhci, octx+32, ep0_ctx, sizeof(ep0_ctx)); xhci->slots[slotid-1].addressed = 1; return res; } ",0 "int lrw_serpent_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { struct serpent_lrw_ctx *ctx = crypto_tfm_ctx(tfm); int err; err = __serpent_setkey(&ctx->serpent_ctx, key, keylen - SERPENT_BLOCK_SIZE); if (err) return err; return lrw_init_table(&ctx->lrw_table, key + keylen - SERPENT_BLOCK_SIZE); } ",0 "ExtensionSettings* ExtensionService::extension_settings() { return extension_settings_; } ",0 "bool ShadowRoot::childTypeAllowed(NodeType type) const { switch (type) { case ELEMENT_NODE: case PROCESSING_INSTRUCTION_NODE: case COMMENT_NODE: case TEXT_NODE: case CDATA_SECTION_NODE: case ENTITY_REFERENCE_NODE: return true; default: return false; } } ",0 "static void hevc_await_progress(HEVCContext *s, HEVCFrame *ref, const Mv *mv, int y0, int height) { if (s->threads_type == FF_THREAD_FRAME ) { int y = FFMAX(0, (mv->y >> 2) + y0 + height + 9); ff_thread_await_progress(&ref->tf, y, 0); } } ",0 "void PrintWebViewHelper::UpdateFrameMarginsCssInfo( const base::DictionaryValue& settings) { int margins_type = 0; if (!settings.GetInteger(kSettingMarginsType, &margins_type)) margins_type = DEFAULT_MARGINS; ignore_css_margins_ = (margins_type != DEFAULT_MARGINS); } ",0 "void ExtensionViewGuest::DidCommitProvisionalLoadForFrame( content::RenderFrameHost* render_frame_host, const GURL& url, ui::PageTransition transition_type) { if (render_frame_host->GetParent()) return; url_ = url; scoped_ptr args(new base::DictionaryValue()); args->SetString(guest_view::kUrl, url_.spec()); DispatchEventToView(make_scoped_ptr( new GuestViewEvent(extensionview::kEventLoadCommit, std::move(args)))); } ",0 "SPICE_GNUC_VISIBLE spice_image_compression_t spice_server_get_image_compression(SpiceServer *s) { spice_assert(reds == s); return image_compression; } ",0 "png_set_read_user_chunk_fn(png_structp png_ptr, png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn) { png_debug(1, ""in png_set_read_user_chunk_fn""); if (png_ptr == NULL) return; png_ptr->read_user_chunk_fn = read_user_chunk_fn; png_ptr->user_chunk_ptr = user_chunk_ptr; } ",0 "static void save_to_event_log(struct analyze_event_data *evd, const char *str) { static const char delim[] = { [LOGSTATE_FIRSTLINE] = '>', [LOGSTATE_BEGLINE] = ' ', [LOGSTATE_ERRLINE] = '*', }; while (str[0]) { char *end = strchrnul(str, '\n'); char end_char = *end; if (end_char == '\n') end++; switch (evd->event_log_state) { case LOGSTATE_FIRSTLINE: case LOGSTATE_BEGLINE: case LOGSTATE_ERRLINE: /* skip empty lines */ if (str[0] == '\n') goto next; strbuf_append_strf(evd->event_log, ""%s%c %.*s"", iso_date_string(NULL), delim[evd->event_log_state], (int)(end - str), str ); break; case LOGSTATE_MIDLINE: strbuf_append_strf(evd->event_log, ""%.*s"", (int)(end - str), str); break; } evd->event_log_state = LOGSTATE_MIDLINE; if (end_char != '\n') break; evd->event_log_state = LOGSTATE_BEGLINE; next: str = end; } } ",0 "int dtls1_query_mtu(SSL *s) { if (s->d1->link_mtu) { s->d1->mtu = s->d1->link_mtu - BIO_dgram_get_mtu_overhead(SSL_get_wbio(s)); s->d1->link_mtu = 0; } /* AHA! Figure out the MTU, and stick to the right size */ if (s->d1->mtu < dtls1_min_mtu(s)) { if (!(SSL_get_options(s) & SSL_OP_NO_QUERY_MTU)) { s->d1->mtu = BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_QUERY_MTU, 0, NULL); /* * I've seen the kernel return bogus numbers when it doesn't know * (initial write), so just make sure we have a reasonable number */ if (s->d1->mtu < dtls1_min_mtu(s)) { /* Set to min mtu */ s->d1->mtu = dtls1_min_mtu(s); BIO_ctrl(SSL_get_wbio(s), BIO_CTRL_DGRAM_SET_MTU, s->d1->mtu, NULL); } } else return 0; } return 1; } ",0 "static ssize_t ib_ucm_send_rep(struct ib_ucm_file *file, const char __user *inbuf, int in_len, int out_len) { struct ib_cm_rep_param param; struct ib_ucm_context *ctx; struct ib_ucm_rep cmd; int result; param.private_data = NULL; if (copy_from_user(&cmd, inbuf, sizeof(cmd))) return -EFAULT; result = ib_ucm_alloc_data(¶m.private_data, cmd.data, cmd.len); if (result) return result; param.qp_num = cmd.qpn; param.starting_psn = cmd.psn; param.private_data_len = cmd.len; param.responder_resources = cmd.responder_resources; param.initiator_depth = cmd.initiator_depth; param.failover_accepted = cmd.failover_accepted; param.flow_control = cmd.flow_control; param.rnr_retry_count = cmd.rnr_retry_count; param.srq = cmd.srq; ctx = ib_ucm_ctx_get(file, cmd.id); if (!IS_ERR(ctx)) { ctx->uid = cmd.uid; result = ib_send_cm_rep(ctx->cm_id, ¶m); ib_ucm_ctx_put(ctx); } else result = PTR_ERR(ctx); kfree(param.private_data); return result; } ",0 "SYSCALL_DEFINE4(epoll_ctl, int, epfd, int, op, int, fd, struct epoll_event __user *, event) { int error; int did_lock_epmutex = 0; struct file *file, *tfile; struct eventpoll *ep; struct epitem *epi; struct epoll_event epds; error = -EFAULT; if (ep_op_has_event(op) && copy_from_user(&epds, event, sizeof(struct epoll_event))) goto error_return; /* Get the ""struct file *"" for the eventpoll file */ error = -EBADF; file = fget(epfd); if (!file) goto error_return; /* Get the ""struct file *"" for the target file */ tfile = fget(fd); if (!tfile) goto error_fput; /* The target file descriptor must support poll */ error = -EPERM; if (!tfile->f_op || !tfile->f_op->poll) goto error_tgt_fput; /* * We have to check that the file structure underneath the file descriptor * the user passed to us _is_ an eventpoll file. And also we do not permit * adding an epoll file descriptor inside itself. */ error = -EINVAL; if (file == tfile || !is_file_epoll(file)) goto error_tgt_fput; /* * At this point it is safe to assume that the ""private_data"" contains * our own data structure. */ ep = file->private_data; /* * When we insert an epoll file descriptor, inside another epoll file * descriptor, there is the change of creating closed loops, which are * better be handled here, than in more critical paths. While we are * checking for loops we also determine the list of files reachable * and hang them on the tfile_check_list, so we can check that we * haven't created too many possible wakeup paths. * * We need to hold the epmutex across both ep_insert and ep_remove * b/c we want to make sure we are looking at a coherent view of * epoll network. */ if (op == EPOLL_CTL_ADD || op == EPOLL_CTL_DEL) { mutex_lock(&epmutex); did_lock_epmutex = 1; } if (op == EPOLL_CTL_ADD) { if (is_file_epoll(tfile)) { error = -ELOOP; if (ep_loop_check(ep, tfile) != 0) goto error_tgt_fput; } else list_add(&tfile->f_tfile_llink, &tfile_check_list); } mutex_lock_nested(&ep->mtx, 0); /* * Try to lookup the file inside our RB tree, Since we grabbed ""mtx"" * above, we can be sure to be able to use the item looked up by * ep_find() till we release the mutex. */ epi = ep_find(ep, tfile, fd); error = -EINVAL; switch (op) { case EPOLL_CTL_ADD: if (!epi) { epds.events |= POLLERR | POLLHUP; error = ep_insert(ep, &epds, tfile, fd); } else error = -EEXIST; clear_tfile_check_list(); break; case EPOLL_CTL_DEL: if (epi) error = ep_remove(ep, epi); else error = -ENOENT; break; case EPOLL_CTL_MOD: if (epi) { epds.events |= POLLERR | POLLHUP; error = ep_modify(ep, epi, &epds); } else error = -ENOENT; break; } mutex_unlock(&ep->mtx); error_tgt_fput: if (did_lock_epmutex) mutex_unlock(&epmutex); fput(tfile); error_fput: fput(file); error_return: return error; } ",1 "static void flush_fifo(AVFifoBuffer *fifo) { while (av_fifo_size(fifo)) { AVFrame *tmp; av_fifo_generic_read(fifo, &tmp, sizeof(tmp), NULL); av_frame_free(&tmp); } } ",0 "bool RenderBlockFlow::hitTestFloats(const HitTestRequest& request, HitTestResult& result, const HitTestLocation& locationInContainer, const LayoutPoint& accumulatedOffset) { if (!m_floatingObjects) return false; LayoutPoint adjustedLocation = accumulatedOffset; if (isRenderView()) { adjustedLocation += toLayoutSize(toRenderView(this)->frameView()->scrollPosition()); } const FloatingObjectSet& floatingObjectSet = m_floatingObjects->set(); FloatingObjectSetIterator begin = floatingObjectSet.begin(); for (FloatingObjectSetIterator it = floatingObjectSet.end(); it != begin;) { --it; FloatingObject* floatingObject = *it; if (floatingObject->shouldPaint() && !floatingObject->renderer()->hasSelfPaintingLayer()) { LayoutUnit xOffset = xPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->x(); LayoutUnit yOffset = yPositionForFloatIncludingMargin(floatingObject) - floatingObject->renderer()->y(); LayoutPoint childPoint = flipFloatForWritingModeForChild(floatingObject, adjustedLocation + LayoutSize(xOffset, yOffset)); if (floatingObject->renderer()->hitTest(request, result, locationInContainer, childPoint)) { updateHitTestResult(result, locationInContainer.point() - toLayoutSize(childPoint)); return true; } } } return false; } ",0 "programming_error (const char *format, ...) #else programming_error (format, va_alist) const char *format; va_dcl #endif { va_list args; char *h; #if defined (JOB_CONTROL) give_terminal_to (shell_pgrp, 0); #endif /* JOB_CONTROL */ SH_VA_START (args, format); vfprintf (stderr, format, args); fprintf (stderr, ""\n""); va_end (args); #if defined (HISTORY) if (remember_on_history) { h = last_history_line (); fprintf (stderr, _(""last command: %s\n""), h ? h : ""(null)""); } #endif #if 0 fprintf (stderr, ""Report this to %s\n"", the_current_maintainer); #endif fprintf (stderr, _(""Aborting..."")); fflush (stderr); abort (); } ",0 "static inline void mark_dirty(struct vmcb *vmcb, int bit) { vmcb->control.clean &= ~(1 << bit); } ",0 "http_ProtoVer(struct http *hp) { if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, ""HTTP/1.0"")) hp->protover = 10; else if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, ""HTTP/1.1"")) hp->protover = 11; else hp->protover = 9; } ",0 "hash_foreach (gpointer key, gpointer val, gpointer user_data) { const char *keystr = key; const char *valstr = val; guint *count = user_data; *count += (strlen (keystr) + strlen (valstr)); g_print (""%s -> %s\n"", keystr, valstr); } ",1 "static void yam_set_uart(struct net_device *dev) { struct yam_port *yp = netdev_priv(dev); int divisor = 115200 / yp->baudrate; outb(0, IER(dev->base_addr)); outb(LCR_DLAB | LCR_BIT8, LCR(dev->base_addr)); outb(divisor, DLL(dev->base_addr)); outb(0, DLM(dev->base_addr)); outb(LCR_BIT8, LCR(dev->base_addr)); outb(PTT_OFF, MCR(dev->base_addr)); outb(0x00, FCR(dev->base_addr)); /* Flush pending irq */ inb(RBR(dev->base_addr)); inb(MSR(dev->base_addr)); /* Enable rx irq */ outb(ENABLE_RTXINT, IER(dev->base_addr)); } ",0 "void sched_set_stop_task(int cpu, struct task_struct *stop) { struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 }; struct task_struct *old_stop = cpu_rq(cpu)->stop; if (stop) { /* * Make it appear like a SCHED_FIFO task, its something * userspace knows about and won't get confused about. * * Also, it will make PI more or less work without too * much confusion -- but then, stop work should not * rely on PI working anyway. */ sched_setscheduler_nocheck(stop, SCHED_FIFO, ¶m); stop->sched_class = &stop_sched_class; } cpu_rq(cpu)->stop = stop; if (old_stop) { /* * Reset it back to a normal scheduling class so that * it can die in pieces. */ old_stop->sched_class = &rt_sched_class; } } ",0 "int __init platform_bus_init(void) { int error; early_platform_cleanup(); error = device_register(&platform_bus); if (error) return error; error = bus_register(&platform_bus_type); if (error) device_unregister(&platform_bus); of_platform_register_reconfig_notifier(); return error; } ",0 "static void dequeue_task(struct rq *rq, struct task_struct *p, int flags) { update_rq_clock(rq); sched_info_dequeued(rq, p); p->sched_class->dequeue_task(rq, p, flags); } ",0 "XcursorFilenameLoadImage (const char *file, int size) { FILE *f; XcursorImage *image; if (!file || size < 0) return NULL; f = fopen (file, ""r""); if (!f) return NULL; image = XcursorFileLoadImage (f, size); fclose (f); return image; } ",0 "ScriptValue WebGLRenderingContextBase::getExtension(ScriptState* script_state, const String& name) { WebGLExtension* extension = nullptr; if (name == WebGLDebugRendererInfo::ExtensionName()) { ExecutionContext* context = ExecutionContext::From(script_state); UseCounter::Count(context, WebFeature::kWebGLDebugRendererInfo); Dactyloscoper::Record(context, WebFeature::kWebGLDebugRendererInfo); } if (!isContextLost()) { for (ExtensionTracker* tracker : extensions_) { if (tracker->MatchesNameWithPrefixes(name)) { if (ExtensionSupportedAndAllowed(tracker)) { extension = tracker->GetExtension(this); if (extension) { if (!extension_enabled_[extension->GetName()]) { extension_enabled_[extension->GetName()] = true; } } } break; } } } v8::Local wrapped_extension = ToV8(extension, script_state->GetContext()->Global(), script_state->GetIsolate()); return ScriptValue(script_state, wrapped_extension); } ",0 " static inline void perf_event_exit_cpu(int cpu) { } ",0 "PHP_METHOD(Phar, extractTo) { char *error = NULL; php_stream *fp; php_stream_statbuf ssb; phar_entry_info *entry; char *pathto, *filename; size_t pathto_len, filename_len; int ret, i; int nelems; zval *zval_files = NULL; zend_bool overwrite = 0; PHAR_ARCHIVE_OBJECT(); if (zend_parse_parameters(ZEND_NUM_ARGS(), ""s|z!b"", &pathto, &pathto_len, &zval_files, &overwrite) == FAILURE) { return; } fp = php_stream_open_wrapper(phar_obj->archive->fname, ""rb"", IGNORE_URL|STREAM_MUST_SEEK, NULL); if (!fp) { zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, ""Invalid argument, %s cannot be found"", phar_obj->archive->fname); return; } php_stream_close(fp); if (pathto_len < 1) { zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, ""Invalid argument, extraction path must be non-zero length""); return; } if (pathto_len >= MAXPATHLEN) { char *tmp = estrndup(pathto, 50); /* truncate for error message */ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, ""Cannot extract to \""%s...\"", destination directory is too long for filesystem"", tmp); efree(tmp); return; } if (php_stream_stat_path(pathto, &ssb) < 0) { ret = php_stream_mkdir(pathto, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL); if (!ret) { zend_throw_exception_ex(spl_ce_RuntimeException, 0, ""Unable to create path \""%s\"" for extraction"", pathto); return; } } else if (!(ssb.sb.st_mode & S_IFDIR)) { zend_throw_exception_ex(spl_ce_RuntimeException, 0, ""Unable to use path \""%s\"" for extraction, it is a file, must be a directory"", pathto); return; } if (zval_files) { switch (Z_TYPE_P(zval_files)) { case IS_NULL: goto all_files; case IS_STRING: filename = Z_STRVAL_P(zval_files); filename_len = Z_STRLEN_P(zval_files); break; case IS_ARRAY: nelems = zend_hash_num_elements(Z_ARRVAL_P(zval_files)); if (nelems == 0 ) { RETURN_FALSE; } for (i = 0; i < nelems; i++) { zval *zval_file; if ((zval_file = zend_hash_index_find(Z_ARRVAL_P(zval_files), i)) != NULL) { switch (Z_TYPE_P(zval_file)) { case IS_STRING: break; default: zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, ""Invalid argument, array of filenames to extract contains non-string value""); return; } if (NULL == (entry = zend_hash_find_ptr(&phar_obj->archive->manifest, Z_STR_P(zval_file)))) { zend_throw_exception_ex(phar_ce_PharException, 0, ""Phar Error: attempted to extract non-existent file \""%s\"" from phar \""%s\"""", Z_STRVAL_P(zval_file), phar_obj->archive->fname); } if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, ""Extraction from phar \""%s\"" failed: %s"", phar_obj->archive->fname, error); efree(error); return; } } } RETURN_TRUE; default: zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, ""Invalid argument, expected a filename (string) or array of filenames""); return; } if (NULL == (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, filename, filename_len))) { zend_throw_exception_ex(phar_ce_PharException, 0, ""Phar Error: attempted to extract non-existent file \""%s\"" from phar \""%s\"""", filename, phar_obj->archive->fname); return; } if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, ""Extraction from phar \""%s\"" failed: %s"", phar_obj->archive->fname, error); efree(error); return; } } else { phar_archive_data *phar; all_files: phar = phar_obj->archive; /* Extract all files */ if (!zend_hash_num_elements(&(phar->manifest))) { RETURN_TRUE; } ZEND_HASH_FOREACH_PTR(&phar->manifest, entry) { if (FAILURE == phar_extract_file(overwrite, entry, pathto, pathto_len, &error)) { zend_throw_exception_ex(phar_ce_PharException, 0, ""Extraction from phar \""%s\"" failed: %s"", phar->fname, error); efree(error); return; } } ZEND_HASH_FOREACH_END(); } RETURN_TRUE; } ",1 "RenderBlockFlow::RenderBlockFlow(ContainerNode* node) : RenderBlock(node) { COMPILE_ASSERT(sizeof(MarginInfo) == sizeof(SameSizeAsMarginInfo), MarginInfo_should_stay_small); } ",0 "static inline void GetMaximumPixelList(PixelList *pixel_list,Quantum *pixel) { register SkipList *p; size_t color, maximum; ssize_t count; /* Find the maximum value for each of the color. */ p=(&pixel_list->skip_list); color=65536L; count=0; maximum=p->nodes[color].next[0]; do { color=p->nodes[color].next[0]; if (color > maximum) maximum=color; count+=p->nodes[color].count; } while (count < (ssize_t) pixel_list->length); *pixel=ScaleShortToQuantum((unsigned short) maximum); } ",0 "static void png_filter_row(PNGDSPContext *dsp, uint8_t *dst, int filter_type, uint8_t *src, uint8_t *last, int size, int bpp) { int i, p, r, g, b, a; switch (filter_type) { case PNG_FILTER_VALUE_NONE: memcpy(dst, src, size); break; case PNG_FILTER_VALUE_SUB: for (i = 0; i < bpp; i++) dst[i] = src[i]; if (bpp == 4) { p = *(int *)dst; for (; i < size; i += bpp) { unsigned s = *(int *)(src + i); p = ((s & 0x7f7f7f7f) + (p & 0x7f7f7f7f)) ^ ((s ^ p) & 0x80808080); *(int *)(dst + i) = p; } } else { #define OP_SUB(x, s, l) ((x) + (s)) UNROLL_FILTER(OP_SUB); } break; case PNG_FILTER_VALUE_UP: dsp->add_bytes_l2(dst, src, last, size); break; case PNG_FILTER_VALUE_AVG: for (i = 0; i < bpp; i++) { p = (last[i] >> 1); dst[i] = p + src[i]; } #define OP_AVG(x, s, l) (((((x) + (l)) >> 1) + (s)) & 0xff) UNROLL_FILTER(OP_AVG); break; case PNG_FILTER_VALUE_PAETH: for (i = 0; i < bpp; i++) { p = last[i]; dst[i] = p + src[i]; } if (bpp > 2 && size > 4) { /* would write off the end of the array if we let it process * the last pixel with bpp=3 */ int w = (bpp & 3) ? size - 3 : size; if (w > i) { dsp->add_paeth_prediction(dst + i, src + i, last + i, size - i, bpp); i = w; } } ff_add_png_paeth_prediction(dst + i, src + i, last + i, size - i, bpp); break; } } ",0 "mboxlist_opensubs(const char *userid, struct db **ret) { int r = 0, flags; char *subsfname; /* Build subscription list filename */ subsfname = user_hash_subs(userid); flags = CYRUSDB_CREATE; if (config_getswitch(IMAPOPT_IMPROVED_MBOXLIST_SORT)) { flags |= CYRUSDB_MBOXSORT; } r = cyrusdb_open(SUBDB, subsfname, flags, ret); if (r != CYRUSDB_OK) { r = IMAP_IOERROR; } free(subsfname); return r; } ",0 "bgp_capabilities_print(netdissect_options *ndo, const u_char *opt, int caps_len) { int cap_type, cap_len, tcap_len, cap_offset; int i = 0; while (i < caps_len) { ND_TCHECK2(opt[i], BGP_CAP_HEADER_SIZE); cap_type=opt[i]; cap_len=opt[i+1]; tcap_len=cap_len; ND_PRINT((ndo, ""\n\t %s (%u), length: %u"", tok2str(bgp_capcode_values, ""Unknown"", cap_type), cap_type, cap_len)); ND_TCHECK2(opt[i+2], cap_len); switch (cap_type) { case BGP_CAPCODE_MP: ND_PRINT((ndo, ""\n\t\tAFI %s (%u), SAFI %s (%u)"", tok2str(af_values, ""Unknown"", EXTRACT_16BITS(opt+i+2)), EXTRACT_16BITS(opt+i+2), tok2str(bgp_safi_values, ""Unknown"", opt[i+5]), opt[i+5])); break; case BGP_CAPCODE_RESTART: /* Restart Flags (4 bits), Restart Time in seconds (12 bits) */ ND_TCHECK_16BITS(opt + i + 2); ND_PRINT((ndo, ""\n\t\tRestart Flags: [%s], Restart Time %us"", ((opt[i+2])&0x80) ? ""R"" : ""none"", EXTRACT_16BITS(opt+i+2)&0xfff)); tcap_len-=2; cap_offset=4; while(tcap_len>=4) { ND_PRINT((ndo, ""\n\t\t AFI %s (%u), SAFI %s (%u), Forwarding state preserved: %s"", tok2str(af_values,""Unknown"", EXTRACT_16BITS(opt+i+cap_offset)), EXTRACT_16BITS(opt+i+cap_offset), tok2str(bgp_safi_values,""Unknown"", opt[i+cap_offset+2]), opt[i+cap_offset+2], ((opt[i+cap_offset+3])&0x80) ? ""yes"" : ""no"" )); tcap_len-=4; cap_offset+=4; } break; case BGP_CAPCODE_RR: case BGP_CAPCODE_RR_CISCO: break; case BGP_CAPCODE_AS_NEW: /* * Extract the 4 byte AS number encoded. */ if (cap_len == 4) { ND_PRINT((ndo, ""\n\t\t 4 Byte AS %s"", as_printf(ndo, astostr, sizeof(astostr), EXTRACT_32BITS(opt + i + 2)))); } break; case BGP_CAPCODE_ADD_PATH: cap_offset=2; if (tcap_len == 0) { ND_PRINT((ndo, "" (bogus)"")); /* length */ break; } while (tcap_len > 0) { if (tcap_len < 4) { ND_PRINT((ndo, ""\n\t\t(invalid)"")); break; } ND_PRINT((ndo, ""\n\t\tAFI %s (%u), SAFI %s (%u), Send/Receive: %s"", tok2str(af_values,""Unknown"",EXTRACT_16BITS(opt+i+cap_offset)), EXTRACT_16BITS(opt+i+cap_offset), tok2str(bgp_safi_values,""Unknown"",opt[i+cap_offset+2]), opt[i+cap_offset+2], tok2str(bgp_add_path_recvsend,""Bogus (0x%02x)"",opt[i+cap_offset+3]) )); tcap_len-=4; cap_offset+=4; } break; default: ND_PRINT((ndo, ""\n\t\tno decoder for Capability %u"", cap_type)); if (ndo->ndo_vflag <= 1) print_unknown_data(ndo, &opt[i+2], ""\n\t\t"", cap_len); break; } if (ndo->ndo_vflag > 1 && cap_len > 0) { print_unknown_data(ndo, &opt[i+2], ""\n\t\t"", cap_len); } i += BGP_CAP_HEADER_SIZE + cap_len; } return; trunc: ND_PRINT((ndo, ""[|BGP]"")); } ",1 "static int ipgre_tap_init(struct net_device *dev) { struct ip_tunnel *tunnel; tunnel = netdev_priv(dev); tunnel->dev = dev; strcpy(tunnel->parms.name, dev->name); ipgre_tunnel_bind_dev(dev); dev->tstats = alloc_percpu(struct pcpu_tstats); if (!dev->tstats) return -ENOMEM; return 0; } ",0 "static void RaisesExceptionVoidMethodOptionalTestCallbackInterfaceArgMethod(const v8::FunctionCallbackInfo& info) { ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, ""TestObject"", ""raisesExceptionVoidMethodOptionalTestCallbackInterfaceArg""); TestObject* impl = V8TestObject::ToImpl(info.Holder()); V8TestCallbackInterface* optional_test_callback_interface_arg; if (info[0]->IsObject()) { optional_test_callback_interface_arg = V8TestCallbackInterface::Create(info[0].As()); } else if (info[0]->IsUndefined()) { optional_test_callback_interface_arg = nullptr; } else { exception_state.ThrowTypeError(""The callback provided as parameter 1 is not an object.""); return; } impl->raisesExceptionVoidMethodOptionalTestCallbackInterfaceArg(optional_test_callback_interface_arg, exception_state); if (exception_state.HadException()) { return; } } ",0 "unsigned int cdrom_check_events(struct cdrom_device_info *cdi, unsigned int clearing) { unsigned int events; cdrom_update_events(cdi, clearing); events = cdi->vfs_events; cdi->vfs_events = 0; return events; } ",0 "sched_write(struct file *file, const char __user *buf, size_t count, loff_t *offset) { struct inode *inode = file->f_path.dentry->d_inode; struct task_struct *p; p = get_proc_task(inode); if (!p) return -ESRCH; proc_sched_set_task(p); put_task_struct(p); return count; } ",0 "static bool containsVideoTags(Element* element) { for (Node* node = element->firstChild(); node; node = NodeTraversal::next(node, element)) { if (node->hasTagName(HTMLNames::videoTag)) return true; } return false; } ",0 "void FS_FreeFileList( char **list ) { int i; if ( !fs_searchpaths ) { Com_Error( ERR_FATAL, ""Filesystem call made without initialization"" ); } if ( !list ) { return; } for ( i = 0 ; list[i] ; i++ ) { Z_Free( list[i] ); } Z_Free( list ); } ",0 "bool BaseRenderingContext2D::isPointInPath(const double x, const double y, const String& winding_rule_string) { return IsPointInPathInternal(path_, x, y, winding_rule_string); } ",0 "static bool checkSelectorForClassChange(const SpaceSplitString& oldClasses, const SpaceSplitString& newClasses, const Checker& checker) { unsigned oldSize = oldClasses.size(); if (!oldSize) return checkSelectorForClassChange(newClasses, checker); BitVector remainingClassBits; remainingClassBits.ensureSize(oldSize); unsigned newSize = newClasses.size(); for (unsigned i = 0; i < newSize; ++i) { for (unsigned j = 0; j < oldSize; ++j) { if (newClasses[i] == oldClasses[j]) { remainingClassBits.quickSet(j); continue; } } if (checker.hasSelectorForClass(newClasses[i])) return true; } for (unsigned i = 0; i < oldSize; ++i) { if (remainingClassBits.quickGet(i)) continue; if (checker.hasSelectorForClass(oldClasses[i])) return true; } return false; } ",0 "ikev2_d_print(netdissect_options *ndo, u_char tpay, const struct isakmp_gen *ext, u_int item_len _U_, const u_char *ep _U_, uint32_t phase _U_, uint32_t doi _U_, uint32_t proto _U_, int depth _U_) { return ikev2_gen_print(ndo, tpay, ext); } ",0 "void RenderFrameImpl::OnJavaScriptExecuteRequest( const base::string16& jscript, int id, bool notify_result) { TRACE_EVENT_INSTANT0(""test_tracing"", ""OnJavaScriptExecuteRequest"", TRACE_EVENT_SCOPE_THREAD); v8::HandleScope handle_scope(v8::Isolate::GetCurrent()); v8::Local result = frame_->executeScriptAndReturnValue(WebScriptSource(jscript)); HandleJavascriptExecutionResult(jscript, id, notify_result, result); } ",0 "void PrintPreviewUI::OnReusePreviewData(int preview_request_id) { base::StringValue ui_identifier(preview_ui_addr_str_); base::FundamentalValue ui_preview_request_id(preview_request_id); web_ui()->CallJavascriptFunction(""reloadPreviewPages"", ui_identifier, ui_preview_request_id); } ",0 "static void __receive_buf(struct tty_struct *tty, const unsigned char *cp, char *fp, int count) { struct n_tty_data *ldata = tty->disc_data; bool preops = I_ISTRIP(tty) || (I_IUCLC(tty) && L_IEXTEN(tty)); if (ldata->real_raw) n_tty_receive_buf_real_raw(tty, cp, fp, count); else if (ldata->raw || (L_EXTPROC(tty) && !preops)) n_tty_receive_buf_raw(tty, cp, fp, count); else if (tty->closing && !L_EXTPROC(tty)) n_tty_receive_buf_closing(tty, cp, fp, count); else { if (ldata->lnext) { char flag = TTY_NORMAL; if (fp) flag = *fp++; n_tty_receive_char_lnext(tty, *cp++, flag); count--; } if (!preops && !I_PARMRK(tty)) n_tty_receive_buf_fast(tty, cp, fp, count); else n_tty_receive_buf_standard(tty, cp, fp, count); flush_echoes(tty); if (tty->ops->flush_chars) tty->ops->flush_chars(tty); } if ((!ldata->icanon && (read_cnt(ldata) >= ldata->minimum_to_wake)) || L_EXTPROC(tty)) { kill_fasync(&tty->fasync, SIGIO, POLL_IN); if (waitqueue_active(&tty->read_wait)) wake_up_interruptible(&tty->read_wait); } } ",0 "static int packet_rcv_has_room(struct packet_sock *po, struct sk_buff *skb) { int ret; bool has_room; spin_lock_bh(&po->sk.sk_receive_queue.lock); ret = __packet_rcv_has_room(po, skb); has_room = ret == ROOM_NORMAL; if (po->pressure == has_room) po->pressure = !has_room; spin_unlock_bh(&po->sk.sk_receive_queue.lock); return ret; } ",0 "status_t ProCamera2Client::exclusiveTryLock() { ATRACE_CALL(); ALOGV(""%s"", __FUNCTION__); Mutex::Autolock icl(mBinderSerializationLock); SharedCameraCallbacks::Lock l(mSharedCameraCallbacks); if (!mDevice.get()) return PERMISSION_DENIED; if (!mExclusiveLock) { mExclusiveLock = true; if (mRemoteCallback != NULL) { mRemoteCallback->onLockStatusChanged( IProCameraCallbacks::LOCK_ACQUIRED); } ALOGV(""%s: exclusive lock acquired"", __FUNCTION__); return OK; } ALOGW(""%s: exclusive lock already exists - recursive locking is not"" ""allowed"", __FUNCTION__); return ALREADY_EXISTS; } ",0 "evutil_socket_finished_connecting_(evutil_socket_t fd) { int e; ev_socklen_t elen = sizeof(e); if (getsockopt(fd, SOL_SOCKET, SO_ERROR, (void*)&e, &elen) < 0) return -1; if (e) { if (EVUTIL_ERR_CONNECT_RETRIABLE(e)) return 0; EVUTIL_SET_SOCKET_ERROR(e); return -1; } return 1; } ",0 " static void FocusInCallback(IBusPanelService* panel, const gchar* path, gpointer user_data) { g_return_if_fail(user_data); InputMethodStatusConnection* self = static_cast(user_data); self->FocusIn(path); } ",1 "void filter_mb_simple(VP8Context *s, uint8_t *dst, VP8FilterStrength *f, int mb_x, int mb_y) { int mbedge_lim, bedge_lim; int filter_level = f->filter_level; int inner_limit = f->inner_limit; int inner_filter = f->inner_filter; ptrdiff_t linesize = s->linesize; if (!filter_level) return; bedge_lim = 2 * filter_level + inner_limit; mbedge_lim = bedge_lim + 4; if (mb_x) s->vp8dsp.vp8_h_loop_filter_simple(dst, linesize, mbedge_lim); if (inner_filter) { s->vp8dsp.vp8_h_loop_filter_simple(dst + 4, linesize, bedge_lim); s->vp8dsp.vp8_h_loop_filter_simple(dst + 8, linesize, bedge_lim); s->vp8dsp.vp8_h_loop_filter_simple(dst + 12, linesize, bedge_lim); } if (mb_y) s->vp8dsp.vp8_v_loop_filter_simple(dst, linesize, mbedge_lim); if (inner_filter) { s->vp8dsp.vp8_v_loop_filter_simple(dst + 4 * linesize, linesize, bedge_lim); s->vp8dsp.vp8_v_loop_filter_simple(dst + 8 * linesize, linesize, bedge_lim); s->vp8dsp.vp8_v_loop_filter_simple(dst + 12 * linesize, linesize, bedge_lim); } } ",0 "void RenderViewHostImpl::DisableScrollbarsForThreshold(const gfx::Size& size) { Send(new ViewMsg_DisableScrollbarsForSmallWindows(GetRoutingID(), size)); } ",0 "jbig2_image_clone(Jbig2Ctx *ctx, Jbig2Image *image) { if (image) image->refcount++; return image; } ",0 "static bool isCompatibleBrand(uint32_t fourcc) { static const uint32_t kCompatibleBrands[] = { FOURCC('i', 's', 'o', 'm'), FOURCC('i', 's', 'o', '2'), FOURCC('a', 'v', 'c', '1'), FOURCC('3', 'g', 'p', '4'), FOURCC('m', 'p', '4', '1'), FOURCC('m', 'p', '4', '2'), FOURCC('q', 't', ' ', ' '), // Apple's QuickTime FOURCC('M', 'S', 'N', 'V'), // Sony's PSP FOURCC('3', 'g', '2', 'a'), // 3GPP2 FOURCC('3', 'g', '2', 'b'), }; for (size_t i = 0; i < sizeof(kCompatibleBrands) / sizeof(kCompatibleBrands[0]); ++i) { if (kCompatibleBrands[i] == fourcc) { return true; } } return false; } ",0 "struct fuse_req *fuse_get_req(struct fuse_conn *fc, unsigned npages) { return __fuse_get_req(fc, npages, false); } ",0 "bool Scrollbar::mouseExited() { setHoveredPart(NoPart); return true; } ",0 "void DisplayItemList::commitNewDisplayItemsAndAppendToWebDisplayItemList(WebDisplayItemList* list) { commitNewDisplayItems(); appendToWebDisplayItemList(list); } ",0 "vmxnet3_dump_tx_descr(struct Vmxnet3_TxDesc *descr) { VMW_PKPRN(""TX DESCR: "" ""addr %"" PRIx64 "", len: %d, gen: %d, rsvd: %d, "" ""dtype: %d, ext1: %d, msscof: %d, hlen: %d, om: %d, "" ""eop: %d, cq: %d, ext2: %d, ti: %d, tci: %d"", le64_to_cpu(descr->addr), descr->len, descr->gen, descr->rsvd, descr->dtype, descr->ext1, descr->msscof, descr->hlen, descr->om, descr->eop, descr->cq, descr->ext2, descr->ti, descr->tci); } ",0 "static int piv_general_mutual_authenticate(sc_card_t *card, unsigned int key_ref, unsigned int alg_id) { int r; #ifdef ENABLE_OPENSSL int N; int locked = 0; u8 *rbuf = NULL; size_t rbuflen; u8 *nonce = NULL; size_t nonce_len; u8 *p; u8 *key = NULL; size_t keylen; u8 *plain_text = NULL; size_t plain_text_len = 0; u8 *tmp; size_t tmplen, tmplen2; u8 *built = NULL; size_t built_len; const u8 *body = NULL; size_t body_len; const u8 *witness_data = NULL; size_t witness_len; const u8 *challenge_response = NULL; size_t challenge_response_len; u8 *decrypted_reponse = NULL; size_t decrypted_reponse_len; EVP_CIPHER_CTX * ctx = NULL; u8 sbuf[255]; const EVP_CIPHER *cipher; SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); ctx = EVP_CIPHER_CTX_new(); if (ctx == NULL) { r = SC_ERROR_OUT_OF_MEMORY; goto err; } cipher = get_cipher_for_algo(alg_id); if(!cipher) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Invalid cipher selector, none found for: %02x\n"", alg_id); r = SC_ERROR_INVALID_ARGUMENTS; goto err; } r = piv_get_key(card, alg_id, &key, &keylen); if (r) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Error getting General Auth key\n""); goto err; } r = sc_lock(card); if (r != SC_SUCCESS) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""sc_lock failed\n""); goto err; /* cleanup */ } locked = 1; p = sbuf; *p++ = 0x7C; *p++ = 0x02; *p++ = 0x80; *p++ = 0x00; /* get the encrypted nonce */ r = piv_general_io(card, 0x87, alg_id, key_ref, sbuf, p - sbuf, &rbuf, &rbuflen); if (r < 0) goto err; /* Remove the encompassing outer TLV of 0x7C and get the data */ body = sc_asn1_find_tag(card->ctx, rbuf, r, 0x7C, &body_len); if (!body) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Invalid Witness Data response of NULL\n""); r = SC_ERROR_INVALID_DATA; goto err; } /* Get the witness data indicated by the TAG 0x80 */ witness_data = sc_asn1_find_tag(card->ctx, body, body_len, 0x80, &witness_len); if (!witness_len) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Invalid Challenge Data none found in TLV\n""); r = SC_ERROR_INVALID_DATA; goto err; } /* Allocate an output buffer for openssl */ plain_text = malloc(witness_len); if (!plain_text) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Could not allocate buffer for plain text\n""); r = SC_ERROR_INTERNAL; goto err; } /* decrypt the data from the card */ if (!EVP_DecryptInit(ctx, cipher, key, NULL)) { /* may fail if des parity of key is wrong. depends on OpenSSL options */ r = SC_ERROR_INTERNAL; goto err; } EVP_CIPHER_CTX_set_padding(ctx,0); p = plain_text; if (!EVP_DecryptUpdate(ctx, p, &N, witness_data, witness_len)) { r = SC_ERROR_INTERNAL; goto err; } plain_text_len = tmplen = N; p += tmplen; if(!EVP_DecryptFinal(ctx, p, &N)) { r = SC_ERROR_INTERNAL; goto err; } tmplen = N; plain_text_len += tmplen; if (plain_text_len != witness_len) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Encrypted and decrypted lengths do not match: %""SC_FORMAT_LEN_SIZE_T""u:%""SC_FORMAT_LEN_SIZE_T""u\n"", witness_len, plain_text_len); r = SC_ERROR_INTERNAL; goto err; } /* Build a response to the card of: * [GEN AUTH][ 8081 ] * Start by computing the nonce for the * nonce length should match the witness length of * the card. */ nonce = malloc(witness_len); if(!nonce) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""OOM allocating nonce (%""SC_FORMAT_LEN_SIZE_T""u : %""SC_FORMAT_LEN_SIZE_T""u)\n"", witness_len, plain_text_len); r = SC_ERROR_INTERNAL; goto err; } nonce_len = witness_len; r = RAND_bytes(nonce, witness_len); if(!r) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Generating random for nonce (%""SC_FORMAT_LEN_SIZE_T""u : %""SC_FORMAT_LEN_SIZE_T""u)\n"", witness_len, plain_text_len); r = SC_ERROR_INTERNAL; goto err; } /* nonce for challenge */ tmplen = put_tag_and_len(0x81, witness_len, NULL); /* plain text witness keep a length separate for the 0x7C tag */ tmplen += put_tag_and_len(0x80, witness_len, NULL); tmplen2 = tmplen; /* outside 7C tag with 81:80 as innards */ tmplen = put_tag_and_len(0x7C, tmplen, NULL); built_len = tmplen; /* Build the response buffer */ p = built = malloc(built_len); if(!built) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""OOM Building witness response and challenge\n""); r = SC_ERROR_INTERNAL; goto err; } p = built; /* Start with the 7C Tag */ put_tag_and_len(0x7C, tmplen2, &p); /* Add the DECRYPTED witness, tag 0x80 */ put_tag_and_len(0x80, witness_len, &p); memcpy(p, plain_text, witness_len); p += witness_len; /* Add the challenge, tag 0x81 */ put_tag_and_len(0x81, witness_len, &p); memcpy(p, nonce, witness_len); /* Don't leak rbuf from above */ free(rbuf); rbuf = NULL; /* Send constructed data */ r = piv_general_io(card, 0x87, alg_id, key_ref, built,built_len, &rbuf, &rbuflen); if (r < 0) goto err; /* Remove the encompassing outer TLV of 0x7C and get the data */ body = sc_asn1_find_tag(card->ctx, rbuf, r, 0x7C, &body_len); if(!body) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Could not find outer tag 0x7C in response""); r = SC_ERROR_INVALID_DATA; goto err; } /* SP800-73 not clear if 80 or 82 */ challenge_response = sc_asn1_find_tag(card->ctx, body, body_len, 0x82, &challenge_response_len); if(!challenge_response) { challenge_response = sc_asn1_find_tag(card->ctx, body, body_len, 0x80, &challenge_response_len); if(!challenge_response) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""Could not find tag 0x82 or 0x80 in response""); r = SC_ERROR_INVALID_DATA; goto err; } } /* Decrypt challenge and check against nonce */ decrypted_reponse = malloc(challenge_response_len); if(!decrypted_reponse) { sc_debug(card->ctx, SC_LOG_DEBUG_VERBOSE, ""OOM Allocating decryption buffer""); r = SC_ERROR_INVALID_DATA; goto err; } EVP_CIPHER_CTX_cleanup(ctx); if (!EVP_DecryptInit(ctx, cipher, key, NULL)) { r = SC_ERROR_INTERNAL; goto err; } EVP_CIPHER_CTX_set_padding(ctx,0); tmp = decrypted_reponse; if (!EVP_DecryptUpdate(ctx, tmp, &N, challenge_response, challenge_response_len)) { r = SC_ERROR_INTERNAL; goto err; } decrypted_reponse_len = tmplen = N; tmp += tmplen; if(!EVP_DecryptFinal(ctx, tmp, &N)) { r = SC_ERROR_INTERNAL; goto err; } tmplen = N; decrypted_reponse_len += tmplen; if (decrypted_reponse_len != nonce_len || memcmp(nonce, decrypted_reponse, nonce_len) != 0) { sc_log(card->ctx, ""mutual authentication failed, card returned wrong value %""SC_FORMAT_LEN_SIZE_T""u:%""SC_FORMAT_LEN_SIZE_T""u"", decrypted_reponse_len, nonce_len); r = SC_ERROR_DECRYPT_FAILED; goto err; } r = SC_SUCCESS; err: if (ctx) EVP_CIPHER_CTX_free(ctx); if (locked) sc_unlock(card); if (rbuf) free(rbuf); if (decrypted_reponse) free(decrypted_reponse); if (built) free(built); if (plain_text) free(plain_text); if (nonce) free(nonce); if (key) free(key); #else sc_log(card->ctx, ""OpenSSL Required""); r = SC_ERROR_NOT_SUPPORTED; #endif /* ENABLE_OPENSSL */ LOG_FUNC_RETURN(card->ctx, r); } ",0 "smb_ofile_disallow_fclose(smb_ofile_t *of) { ASSERT(of); ASSERT(of->f_magic == SMB_OFILE_MAGIC); ASSERT(of->f_refcnt); switch (of->f_ftype) { case SMB_FTYPE_DISK: ASSERT(of->f_tree); return (of->f_node == of->f_tree->t_snode); case SMB_FTYPE_MESG_PIPE: ASSERT(of->f_pipe); if (smb_strcasecmp(of->f_pipe->p_name, ""SRVSVC"", 0) == 0) return (B_TRUE); break; default: break; } return (B_FALSE); } ",0 "jbig2_table(Jbig2Ctx *ctx, Jbig2Segment *segment, const byte *segment_data) { Jbig2HuffmanParams *params = NULL; Jbig2HuffmanLine *line = NULL; segment->result = NULL; if (segment->data_length < 10) goto too_short; { /* B.2 1) (B.2.1) Code table flags */ const int code_table_flags = segment_data[0]; const int HTOOB = code_table_flags & 0x01; /* Bit 0: HTOOB */ /* Bits 1-3: Number of bits used in code table line prefix size fields */ const int HTPS = (code_table_flags >> 1 & 0x07) + 1; /* Bits 4-6: Number of bits used in code table line range size fields */ const int HTRS = (code_table_flags >> 4 & 0x07) + 1; /* B.2 2) (B.2.2) The lower bound of the first table line in the encoded table */ const int32_t HTLOW = jbig2_get_int32(segment_data + 1); /* B.2 3) (B.2.3) One larger than the upeer bound of the last normal table line in the encoded table */ const int32_t HTHIGH = jbig2_get_int32(segment_data + 5); /* estimated number of lines int this table, used for alloacting memory for lines */ const size_t lines_max = (segment->data_length * 8 - HTPS * (HTOOB ? 3 : 2)) / (HTPS + HTRS) + (HTOOB ? 3 : 2); /* points to a first table line data */ const byte *lines_data = segment_data + 9; const size_t lines_data_bitlen = (segment->data_length - 9) * 8; /* length in bit */ /* bit offset: controls bit reading */ size_t boffset = 0; /* B.2 4) */ int32_t CURRANGELOW = HTLOW; size_t NTEMP = 0; #ifdef JBIG2_DEBUG jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, ""DECODING USER TABLE... Flags: %d, HTOOB: %d, HTPS: %d, HTRS: %d, HTLOW: %d, HTHIGH: %d"", code_table_flags, HTOOB, HTPS, HTRS, HTLOW, HTHIGH); #endif /* allocate HuffmanParams & HuffmanLine */ params = jbig2_new(ctx, Jbig2HuffmanParams, 1); if (params == NULL) { jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, ""Could not allocate Huffman Table Parameter""); goto error_exit; } line = jbig2_new(ctx, Jbig2HuffmanLine, lines_max); if (line == NULL) { jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, ""Could not allocate Huffman Table Lines""); goto error_exit; } /* B.2 5) */ while (CURRANGELOW < HTHIGH) { /* B.2 5) a) */ if (boffset + HTPS >= lines_data_bitlen) goto too_short; line[NTEMP].PREFLEN = jbig2_table_read_bits(lines_data, &boffset, HTPS); /* B.2 5) b) */ if (boffset + HTRS >= lines_data_bitlen) goto too_short; line[NTEMP].RANGELEN = jbig2_table_read_bits(lines_data, &boffset, HTRS); /* B.2 5) c) */ line[NTEMP].RANGELOW = CURRANGELOW; CURRANGELOW += (1 << line[NTEMP].RANGELEN); NTEMP++; } /* B.2 6), B.2 7) lower range table line */ if (boffset + HTPS >= lines_data_bitlen) goto too_short; line[NTEMP].PREFLEN = jbig2_table_read_bits(lines_data, &boffset, HTPS); line[NTEMP].RANGELEN = 32; line[NTEMP].RANGELOW = HTLOW - 1; NTEMP++; /* B.2 8), B.2 9) upper range table line */ if (boffset + HTPS >= lines_data_bitlen) goto too_short; line[NTEMP].PREFLEN = jbig2_table_read_bits(lines_data, &boffset, HTPS); line[NTEMP].RANGELEN = 32; line[NTEMP].RANGELOW = HTHIGH; NTEMP++; /* B.2 10) */ if (HTOOB) { /* B.2 10) a), B.2 10) b) out-of-bound table line */ if (boffset + HTPS >= lines_data_bitlen) goto too_short; line[NTEMP].PREFLEN = jbig2_table_read_bits(lines_data, &boffset, HTPS); line[NTEMP].RANGELEN = 0; line[NTEMP].RANGELOW = 0; NTEMP++; } if (NTEMP != lines_max) { Jbig2HuffmanLine *new_line = jbig2_renew(ctx, line, Jbig2HuffmanLine, NTEMP); if (new_line == NULL) { jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, ""Could not reallocate Huffman Table Lines""); goto error_exit; } line = new_line; } params->HTOOB = HTOOB; params->n_lines = NTEMP; params->lines = line; segment->result = params; #ifdef JBIG2_DEBUG { int i; for (i = 0; i < NTEMP; i++) { jbig2_error(ctx, JBIG2_SEVERITY_DEBUG, segment->number, ""Line: %d, PREFLEN: %d, RANGELEN: %d, RANGELOW: %d"", i, params->lines[i].PREFLEN, params->lines[i].RANGELEN, params->lines[i].RANGELOW); } } #endif } return 0; too_short: jbig2_error(ctx, JBIG2_SEVERITY_FATAL, segment->number, ""Segment too short""); error_exit: if (line != NULL) { jbig2_free(ctx->allocator, line); } if (params != NULL) { jbig2_free(ctx->allocator, params); } return -1; } ",0 "int platform_pm_resume(struct device *dev) { struct device_driver *drv = dev->driver; int ret = 0; if (!drv) return 0; if (drv->pm) { if (drv->pm->resume) ret = drv->pm->resume(dev); } else { ret = platform_legacy_resume(dev); } return ret; } ",0 "static CURLcode smtp_perform_ehlo(struct connectdata *conn) { CURLcode result = CURLE_OK; struct smtp_conn *smtpc = &conn->proto.smtpc; smtpc->sasl.authmechs = SASL_AUTH_NONE; /* No known auth. mechanism yet */ smtpc->sasl.authused = SASL_AUTH_NONE; /* Clear the authentication mechanism used for esmtp connections */ smtpc->tls_supported = FALSE; /* Clear the TLS capability */ smtpc->auth_supported = FALSE; /* Clear the AUTH capability */ /* Send the EHLO command */ result = Curl_pp_sendf(&smtpc->pp, ""EHLO %s"", smtpc->domain); if(!result) state(conn, SMTP_EHLO); return result; } ",0 "void RenderWidgetHostImpl::WindowSnapshotReachedScreen(int snapshot_id) { DCHECK(base::MessageLoopForUI::IsCurrent()); gfx::Rect view_bounds = GetView()->GetViewBounds(); gfx::Rect snapshot_bounds(view_bounds.size()); std::vector png; if (ui::GrabViewSnapshot( GetView()->GetNativeView(), &png, snapshot_bounds)) { OnSnapshotDataReceived(snapshot_id, &png.front(), png.size()); return; } ui::GrabViewSnapshotAsync( GetView()->GetNativeView(), snapshot_bounds, base::ThreadTaskRunnerHandle::Get(), base::Bind(&RenderWidgetHostImpl::OnSnapshotDataReceivedAsync, weak_factory_.GetWeakPtr(), snapshot_id)); } ",0 " void CreateSourceAndShuffle(size_t max_chunk_size_bytes) { max_chunk_size_bytes_ = max_chunk_size_bytes; std::unique_ptr chopped_stream( new OffsetSizePair[bytes_to_buffer_]); size_t start_chopping_offset = 0; size_t iterations = 0; while (start_chopping_offset < bytes_to_buffer_) { size_t max_chunk = std::min( max_chunk_size_bytes_, bytes_to_buffer_ - start_chopping_offset); size_t chunk_size = rng_.RandUint64() % max_chunk + 1; chopped_stream[iterations] = OffsetSizePair(start_chopping_offset, chunk_size); start_chopping_offset += chunk_size; ++iterations; } DCHECK(start_chopping_offset == bytes_to_buffer_); size_t chunk_num = iterations; for (int i = chunk_num - 1; i >= 0; --i) { size_t random_idx = rng_.RandUint64() % (i + 1); QUIC_DVLOG(1) << ""chunk offset "" << chopped_stream[random_idx].first << "" size "" << chopped_stream[random_idx].second; shuffled_buf_.push_front(chopped_stream[random_idx]); chopped_stream[random_idx] = chopped_stream[i]; } } ",0 "bool ContainsWidevine( const std::vector>& key_systems_properties) { for (const auto& key_system_properties : key_systems_properties) { if (key_system_properties->GetKeySystemName() == kWidevineKeySystem) return true; } return false; } ",0 "void Browser::DuplicateContentsAt(int index) { TabContentsWrapper* contents = GetTabContentsWrapperAt(index); CHECK(contents); TabContentsWrapper* contents_dupe = contents->Clone(); TabContents* new_contents = contents_dupe->tab_contents(); bool pinned = false; if (CanSupportWindowFeature(FEATURE_TABSTRIP)) { int index = tab_handler_->GetTabStripModel()-> GetIndexOfTabContents(contents); pinned = tab_handler_->GetTabStripModel()->IsTabPinned(index); int add_types = TabStripModel::ADD_ACTIVE | TabStripModel::ADD_INHERIT_GROUP | (pinned ? TabStripModel::ADD_PINNED : 0); tab_handler_->GetTabStripModel()->InsertTabContentsAt(index + 1, contents_dupe, add_types); } else { Browser* browser = NULL; if (type_ & TYPE_APP) { CHECK_EQ((type_ & TYPE_POPUP), 0); CHECK_NE(type_, TYPE_APP_PANEL); browser = Browser::CreateForApp(app_name_, gfx::Size(), profile_, false); } else if (type_ == TYPE_POPUP) { browser = Browser::CreateForType(TYPE_POPUP, profile_); } BrowserWindow* new_window = browser->window(); new_window->SetBounds(gfx::Rect(new_window->GetRestoredBounds().origin(), window()->GetRestoredBounds().size())); browser->window()->Show(); browser->AddTab(contents_dupe, PageTransition::LINK); } if (profile_->HasSessionService()) { SessionService* session_service = profile_->GetSessionService(); if (session_service) session_service->TabRestored(&new_contents->controller(), pinned); } } ",0 "int TcpSessionPacketSsnReuse(const Packet *p, const Flow *f, const void *tcp_ssn) { if (p->proto == IPPROTO_TCP && p->tcph != NULL) { if (TcpSessionPacketIsStreamStarter(p) == 1) { if (TcpSessionReuseDoneEnough(p, f, tcp_ssn) == 1) { return 1; } } } return 0; } ",0 " void UninstallExtension(ExtensionService* service, const std::string& id) { if (service && service->GetInstalledExtension(id)) { service->UninstallExtension(id, extensions::UNINSTALL_REASON_SYNC, base::Bind(&base::DoNothing), NULL); } } ",1 "static void _print_strings(RCore *r, RList *list, int mode, int va) { int minstr = r_config_get_i (r->config, ""bin.minstr""); int maxstr = r_config_get_i (r->config, ""bin.maxstr""); RBin *bin = r->bin; RListIter *iter; RBinString *string; RBinSection *section; char *q; bin->minstrlen = minstr; bin->maxstrlen = maxstr; if (IS_MODE_JSON (mode)) { r_cons_printf (""[""); } if (IS_MODE_RAD (mode)) { r_cons_printf (""fs strings""); } if (IS_MODE_SET (mode) && r_config_get_i (r->config, ""bin.strings"")) { r_flag_space_set (r->flags, ""strings""); r_cons_break_push (NULL, NULL); } r_list_foreach (list, iter, string) { const char *section_name, *type_string; ut64 paddr, vaddr, addr; if (!string_filter (r, string->string)) { continue; } paddr = string->paddr; vaddr = r_bin_get_vaddr (bin, paddr, string->vaddr); addr = va ? vaddr : paddr; if (string->length < minstr) { continue; } if (maxstr && string->length > maxstr) { continue; } section = r_bin_get_section_at (r_bin_cur_object (bin), paddr, 0); section_name = section ? section->name : ""unknown""; type_string = r_bin_string_type (string->type); if (IS_MODE_SET (mode)) { char *f_name, *str; if (r_cons_is_breaked ()) { break; } r_meta_add (r->anal, R_META_TYPE_STRING, addr, addr + string->size, string->string); f_name = strdup (string->string); r_name_filter (f_name, -1); if (r->bin->prefix) { str = r_str_newf (""%s.str.%s"", r->bin->prefix, f_name); } else { str = r_str_newf (""str.%s"", f_name); } r_flag_set (r->flags, str, addr, string->size); free (str); free (f_name); } else if (IS_MODE_SIMPLE (mode)) { r_cons_printf (""0x%""PFMT64x"" %d %d %s\n"", addr, string->size, string->length, string->string); } else if (IS_MODE_SIMPLEST (mode)) { r_cons_println (string->string); } else if (IS_MODE_JSON (mode)) { q = r_base64_encode_dyn (string->string, -1); r_cons_printf (""%s{\""vaddr\"":%""PFMT64d "",\""paddr\"":%""PFMT64d"",\""ordinal\"":%d"" "",\""size\"":%d,\""length\"":%d,\""section\"":\""%s\"","" ""\""type\"":\""%s\"",\""string\"":\""%s\""}"", iter->p ? "","": """", vaddr, paddr, string->ordinal, string->size, string->length, section_name, type_string, q); free (q); } else if (IS_MODE_RAD (mode)) { char *f_name, *str; f_name = strdup (string->string); r_name_filter (f_name, R_FLAG_NAME_SIZE); if (r->bin->prefix) { str = r_str_newf (""%s.str.%s"", r->bin->prefix, f_name); r_cons_printf (""f %s.str.%s %""PFMT64d"" @ 0x%08""PFMT64x""\n"" ""Cs %""PFMT64d"" @ 0x%08""PFMT64x""\n"", r->bin->prefix, f_name, string->size, addr, string->size, addr); } else { str = r_str_newf (""str.%s"", f_name); r_cons_printf (""f str.%s %""PFMT64d"" @ 0x%08""PFMT64x""\n"" ""Cs %""PFMT64d"" @ 0x%08""PFMT64x""\n"", f_name, string->size, addr, string->size, addr); } free (str); free (f_name); } else { r_cons_printf (""vaddr=0x%08""PFMT64x"" paddr=0x%08"" PFMT64x"" ordinal=%03u sz=%u len=%u "" ""section=%s type=%s string=%s\n"", vaddr, paddr, string->ordinal, string->size, string->length, section_name, type_string, string->string); } } if (IS_MODE_JSON (mode)) { r_cons_printf (""]""); } if (IS_MODE_SET (mode)) { r_cons_break_pop (); } } ",0 "int pid_ns_prepare_proc(struct pid_namespace *ns) { struct vfsmount *mnt; mnt = kern_mount_data(&proc_fs_type, ns); if (IS_ERR(mnt)) return PTR_ERR(mnt); ns->proc_mnt = mnt; return 0; } ",0 "StateStore* ExtensionSystemImpl::state_store() { return shared_->state_store(); } ",0 "static int write_index(git_oid *checksum, git_index *index, git_filebuf *file) { git_oid hash_final; struct index_header header; bool is_extended; uint32_t index_version_number; assert(index && file); if (index->version <= INDEX_VERSION_NUMBER_EXT) { is_extended = is_index_extended(index); index_version_number = is_extended ? INDEX_VERSION_NUMBER_EXT : INDEX_VERSION_NUMBER_LB; } else { index_version_number = index->version; } header.signature = htonl(INDEX_HEADER_SIG); header.version = htonl(index_version_number); header.entry_count = htonl((uint32_t)index->entries.length); if (git_filebuf_write(file, &header, sizeof(struct index_header)) < 0) return -1; if (write_entries(index, file) < 0) return -1; /* write the tree cache extension */ if (index->tree != NULL && write_tree_extension(index, file) < 0) return -1; /* write the rename conflict extension */ if (index->names.length > 0 && write_name_extension(index, file) < 0) return -1; /* write the reuc extension */ if (index->reuc.length > 0 && write_reuc_extension(index, file) < 0) return -1; /* get out the hash for all the contents we've appended to the file */ git_filebuf_hash(&hash_final, file); git_oid_cpy(checksum, &hash_final); /* write it at the end of the file */ if (git_filebuf_write(file, hash_final.id, GIT_OID_RAWSZ) < 0) return -1; /* file entries are no longer up to date */ clear_uptodate(index); return 0; } ",0 "base::SharedMemoryHandle GamepadProvider::DuplicateSharedMemoryHandle() { return gamepad_shared_buffer_->shared_memory()->handle().Duplicate(); } ",0 "static int check_crl_time(X509_STORE_CTX *ctx, X509_CRL *crl, int notify) { time_t *ptime; int i; if (notify) ctx->current_crl = crl; if (ctx->param->flags & X509_V_FLAG_USE_CHECK_TIME) ptime = &ctx->param->check_time; else ptime = NULL; i = X509_cmp_time(X509_CRL_get_lastUpdate(crl), ptime); if (i == 0) { if (!notify) return 0; ctx->error = X509_V_ERR_ERROR_IN_CRL_LAST_UPDATE_FIELD; if (!ctx->verify_cb(0, ctx)) return 0; } if (i > 0) { if (!notify) return 0; ctx->error = X509_V_ERR_CRL_NOT_YET_VALID; if (!ctx->verify_cb(0, ctx)) return 0; } if (X509_CRL_get_nextUpdate(crl)) { i = X509_cmp_time(X509_CRL_get_nextUpdate(crl), ptime); if (i == 0) { if (!notify) return 0; ctx->error = X509_V_ERR_ERROR_IN_CRL_NEXT_UPDATE_FIELD; if (!ctx->verify_cb(0, ctx)) return 0; } /* Ignore expiry of base CRL is delta is valid */ if ((i < 0) && !(ctx->current_crl_score & CRL_SCORE_TIME_DELTA)) { if (!notify) return 0; ctx->error = X509_V_ERR_CRL_HAS_EXPIRED; if (!ctx->verify_cb(0, ctx)) return 0; } } if (notify) ctx->current_crl = NULL; return 1; } ",0 "WebHistoryItem HistoryController::GetItemForNewChildFrame( RenderFrameImpl* frame) const { if (navigation_params_.get()) { frame->SetPendingNavigationParams(make_scoped_ptr( new NavigationParams(*navigation_params_.get()))); } if (!current_entry_) return WebHistoryItem(); return current_entry_->GetItemForFrame(frame); } ",0 "static int ndp_sock_recv(struct ndp *ndp) { struct ndp_msg *msg; enum ndp_msg_type msg_type; size_t len; int err; msg = ndp_msg_alloc(); if (!msg) return -ENOMEM; len = ndp_msg_payload_maxlen(msg); err = myrecvfrom6(ndp->sock, msg->buf, &len, 0, &msg->addrto, &msg->ifindex); if (err) { err(ndp, ""Failed to receive message""); goto free_msg; } dbg(ndp, ""rcvd from: %s, ifindex: %u"", str_in6_addr(&msg->addrto), msg->ifindex); if (len < sizeof(*msg->icmp6_hdr)) { warn(ndp, ""rcvd icmp6 packet too short (%luB)"", len); err = 0; goto free_msg; } err = ndp_msg_type_by_raw_type(&msg_type, msg->icmp6_hdr->icmp6_type); if (err) { err = 0; goto free_msg; } ndp_msg_init(msg, msg_type); ndp_msg_payload_len_set(msg, len); if (!ndp_msg_check_valid(msg)) { warn(ndp, ""rcvd invalid ND message""); err = 0; goto free_msg; } dbg(ndp, ""rcvd %s, len: %zuB"", ndp_msg_type_info(msg_type)->strabbr, len); if (!ndp_msg_check_opts(msg)) { err = 0; goto free_msg; } err = ndp_call_handlers(ndp, msg);; free_msg: ndp_msg_destroy(msg); return err; } ",1 "void ConfirmEmailDialogDelegate::OnCanceled() { base::ResetAndReturn(&callback_).Run( IDS_ONE_CLICK_SIGNIN_CONFIRM_EMAIL_DIALOG_CANCEL_BUTTON); } ",0 "GF_Err udta_dump(GF_Box *a, FILE * trace) { GF_UserDataBox *p; GF_UserDataMap *map; u32 i; p = (GF_UserDataBox *)a; gf_isom_box_dump_start(a, ""UserDataBox"", trace); fprintf(trace, "">\n""); i=0; while ((map = (GF_UserDataMap *)gf_list_enum(p->recordList, &i))) { gf_isom_box_array_dump(map->other_boxes, trace); } gf_isom_box_dump_done(""UserDataBox"", a, trace); return GF_OK; } ",0 "WebMediaPlayer::ReadyState WebMediaPlayerImpl::GetReadyState() const { DCHECK(main_task_runner_->BelongsToCurrentThread()); return ready_state_; } ",0 "NaClDesc* NaClIPCAdapter::MakeNaClDesc() { return MakeNaClDescCustom(this); } ",0 "static void sig_server_setup_read(IRC_SERVER_SETUP_REC *rec, CONFIG_NODE *node) { g_return_if_fail(rec != NULL); g_return_if_fail(node != NULL); if (!IS_IRC_SERVER_SETUP(rec)) return; rec->max_cmds_at_once = config_node_get_int(node, ""cmds_max_at_once"", 0); rec->cmd_queue_speed = config_node_get_int(node, ""cmd_queue_speed"", 0); rec->max_query_chans = config_node_get_int(node, ""max_query_chans"", 0); } ",0 "print_option(char *s, ssize_t len, int type, int dl, const uint8_t *data) { const uint8_t *e, *t; uint16_t u16; int16_t s16; uint32_t u32; int32_t s32; struct in_addr addr; ssize_t bytes = 0; ssize_t l; char *tmp; if (type & RFC3397) { l = decode_rfc3397(NULL, 0, dl, data); if (l < 1) return l; tmp = xmalloc(l); decode_rfc3397(tmp, l, dl, data); l = print_string(s, len, l - 1, (uint8_t *)tmp); free(tmp); return l; } if (type & RFC3361) { if ((tmp = decode_rfc3361(dl, data)) == NULL) return -1; l = strlen(tmp); l = print_string(s, len, l - 1, (uint8_t *)tmp); free(tmp); return l; } if (type & RFC3442) return decode_rfc3442(s, len, dl, data); if (type & RFC5969) return decode_rfc5969(s, len, dl, data); if (type & STRING) { /* Some DHCP servers return NULL strings */ if (*data == '\0') return 0; return print_string(s, len, dl, data); } if (!s) { if (type & UINT8) l = 3; else if (type & UINT16) { l = 5; dl /= 2; } else if (type & SINT16) { l = 6; dl /= 2; } else if (type & UINT32) { l = 10; dl /= 4; } else if (type & SINT32) { l = 11; dl /= 4; } else if (type & IPV4) { l = 16; dl /= 4; } else { errno = EINVAL; return -1; } return (l + 1) * dl; } t = data; e = data + dl; while (data < e) { if (data != t) { *s++ = ' '; bytes++; len--; } if (type & UINT8) { l = snprintf(s, len, ""%d"", *data); data++; } else if (type & UINT16) { memcpy(&u16, data, sizeof(u16)); u16 = ntohs(u16); l = snprintf(s, len, ""%d"", u16); data += sizeof(u16); } else if (type & SINT16) { memcpy(&s16, data, sizeof(s16)); s16 = ntohs(s16); l = snprintf(s, len, ""%d"", s16); data += sizeof(s16); } else if (type & UINT32) { memcpy(&u32, data, sizeof(u32)); u32 = ntohl(u32); l = snprintf(s, len, ""%d"", u32); data += sizeof(u32); } else if (type & SINT32) { memcpy(&s32, data, sizeof(s32)); s32 = ntohl(s32); l = snprintf(s, len, ""%d"", s32); data += sizeof(s32); } else if (type & IPV4) { memcpy(&addr.s_addr, data, sizeof(addr.s_addr)); l = snprintf(s, len, ""%s"", inet_ntoa(addr)); data += sizeof(addr.s_addr); } else l = 0; if (len <= l) { bytes += len; break; } len -= l; bytes += l; s += l; } return bytes; } ",0 "int qib_set_uevent_bits(struct qib_pportdata *ppd, const int evtbit) { struct qib_ctxtdata *rcd; unsigned ctxt; int ret = 0; unsigned long flags; spin_lock_irqsave(&ppd->dd->uctxt_lock, flags); for (ctxt = ppd->dd->first_user_ctxt; ctxt < ppd->dd->cfgctxts; ctxt++) { rcd = ppd->dd->rcd[ctxt]; if (!rcd) continue; if (rcd->user_event_mask) { int i; /* * subctxt_cnt is 0 if not shared, so do base * separately, first, then remaining subctxt, if any */ set_bit(evtbit, &rcd->user_event_mask[0]); for (i = 1; i < rcd->subctxt_cnt; i++) set_bit(evtbit, &rcd->user_event_mask[i]); } ret = 1; break; } spin_unlock_irqrestore(&ppd->dd->uctxt_lock, flags); return ret; } ",0 "g_verify_neg_token_init(unsigned char **buf_in, unsigned int cur_size) { unsigned char *buf = *buf_in; unsigned char *endptr = buf + cur_size; int seqsize; int ret = 0; unsigned int bytes; /* * Verify this is a NegotiationToken type token * - check for a0(context specific identifier) * - get length and verify that enoughd ata exists */ if (g_get_tag_and_length(&buf, CONTEXT, cur_size, &bytes) < 0) return (G_BAD_TOK_HEADER); cur_size = bytes; /* should indicate bytes remaining */ /* * Verify the next piece, it should identify this as * a strucure of type NegTokenInit. */ if (*buf++ == SEQUENCE) { if ((seqsize = gssint_get_der_length(&buf, cur_size, &bytes)) < 0) return (G_BAD_TOK_HEADER); /* * Make sure we have the entire buffer as described */ if (seqsize > endptr - buf) return (G_BAD_TOK_HEADER); } else { return (G_BAD_TOK_HEADER); } cur_size = seqsize; /* should indicate bytes remaining */ /* * Verify that the first blob is a sequence of mechTypes */ if (*buf++ == CONTEXT) { if ((seqsize = gssint_get_der_length(&buf, cur_size, &bytes)) < 0) return (G_BAD_TOK_HEADER); /* * Make sure we have the entire buffer as described */ if (seqsize > endptr - buf) return (G_BAD_TOK_HEADER); } else { return (G_BAD_TOK_HEADER); } /* * At this point, *buf should be at the beginning of the * DER encoded list of mech types that are to be negotiated. */ *buf_in = buf; return (ret); } ",0 "void Automation::GetCookies(const std::string& url, ListValue** cookies, Error** error) { std::string error_msg; if (!SendGetCookiesJSONRequest(automation(), url, cookies, &error_msg)) *error = new Error(kUnknownError, error_msg); } ",0 "ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, int reset, int enable) { return ftrace_set_hash(ops, buf, len, 0, 0, reset, enable); } ",0 "bool GetAtomArrayProperty(XID window, const std::string& property_name, std::vector* value) { Atom type = None; int format = 0; // size in bits of each item in 'property' unsigned long num_items = 0; unsigned char* properties = NULL; int result = GetProperty(window, property_name, (~0L), // (all of them) &type, &format, &num_items, &properties); if (result != Success) return false; if (type != XA_ATOM) { XFree(properties); return false; } Atom* atom_properties = reinterpret_cast(properties); value->clear(); value->insert(value->begin(), atom_properties, atom_properties + num_items); XFree(properties); return true; } ",0 "status_t MediaPlayerService::Client::setPlaybackSettings(const AudioPlaybackRate& rate) { ALOGV(""[%d] setPlaybackSettings(%f, %f, %d, %d)"", mConnId, rate.mSpeed, rate.mPitch, rate.mFallbackMode, rate.mStretchMode); sp p = getPlayer(); if (p == 0) return UNKNOWN_ERROR; return p->setPlaybackSettings(rate); } ",0 "const Document& SerializerMarkupAccumulator::document() { return *m_document; } ",0 "void CL_DemoFilename( int number, char *fileName, int fileNameSize ) { int a,b,c,d; if(number < 0 || number > 9999) number = 9999; a = number / 1000; number -= a * 1000; b = number / 100; number -= b * 100; c = number / 10; number -= c * 10; d = number; Com_sprintf( fileName, fileNameSize, ""demo%i%i%i%i"" , a, b, c, d ); } ",0 "Eina_Bool ewk_view_setting_minimum_timer_interval_set(Evas_Object* ewkView, double interval) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false); if (fabs(priv->settings.domTimerInterval - interval) >= std::numeric_limits::epsilon()) { priv->pageSettings->setMinDOMTimerInterval(interval); priv->settings.domTimerInterval = interval; } return true; } ",0 "static inline TCGMemOp mo_stacksize(DisasContext *s) { return CODE64(s) ? MO_64 : s->ss32 ? MO_32 : MO_16; } ",0 " SusanDeletingTest() : countdown_till_delete_(0) {} ",0 "PHP_FUNCTION(pg_free_result) { zval *result; pgsql_result_handle *pg_result; if (zend_parse_parameters(ZEND_NUM_ARGS(), ""r"", &result) == FAILURE) { return; } ZEND_FETCH_RESOURCE(pg_result, pgsql_result_handle *, result, -1, ""PostgreSQL result"", le_result); if (Z_RES_P(result) == NULL) { RETURN_FALSE; } zend_list_close(Z_RES_P(result)); RETURN_TRUE; } ",0 "void DatabaseImpl::IDBThreadHelper::SetIndexKeys( int64_t transaction_id, int64_t object_store_id, const IndexedDBKey& primary_key, const std::vector& index_keys) { DCHECK(idb_thread_checker_.CalledOnValidThread()); if (!connection_->IsConnected()) return; IndexedDBTransaction* transaction = connection_->GetTransaction(transaction_id); if (!transaction) return; connection_->database()->SetIndexKeys( transaction, object_store_id, base::MakeUnique(primary_key), index_keys); } ",0 " void AppCacheDatabase::ReadEntryRecord( const sql::Statement& statement, EntryRecord* record) { record->cache_id = statement.ColumnInt64(0); record->url = GURL(statement.ColumnString(1)); record->flags = statement.ColumnInt(2); record->response_id = statement.ColumnInt64(3); record->response_size = statement.ColumnInt64(4); } ",1 " void NotifyCacheOnIO( scoped_refptr request_context, const GURL& url, const std::string& http_method) { net::HttpCache* cache = request_context->GetURLRequestContext()-> http_transaction_factory()->GetCache(); if (cache) cache->OnExternalCacheHit(url, http_method); } ",0 "PHP_METHOD(Phar, delete) { char *fname; size_t fname_len; char *error; phar_entry_info *entry; PHAR_ARCHIVE_OBJECT(); if (PHAR_G(readonly) && !phar_obj->archive->is_data) { zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, ""Cannot write out phar archive, phar is read-only""); return; } if (zend_parse_parameters(ZEND_NUM_ARGS(), ""s"", &fname, &fname_len) == FAILURE) { RETURN_FALSE; } if (phar_obj->archive->is_persistent && FAILURE == phar_copy_on_write(&(phar_obj->archive))) { zend_throw_exception_ex(phar_ce_PharException, 0, ""phar \""%s\"" is persistent, unable to copy on write"", phar_obj->archive->fname); return; } if (zend_hash_str_exists(&phar_obj->archive->manifest, fname, (uint) fname_len)) { if (NULL != (entry = zend_hash_str_find_ptr(&phar_obj->archive->manifest, fname, (uint) fname_len))) { if (entry->is_deleted) { /* entry is deleted, but has not been flushed to disk yet */ RETURN_TRUE; } else { entry->is_deleted = 1; entry->is_modified = 1; phar_obj->archive->is_modified = 1; } } } else { zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, ""Entry %s does not exist and cannot be deleted"", fname); RETURN_FALSE; } phar_flush(phar_obj->archive, NULL, 0, 0, &error); if (error) { zend_throw_exception_ex(phar_ce_PharException, 0, ""%s"", error); efree(error); } RETURN_TRUE; } ",1 "static struct ucounts *inc_mnt_namespaces(struct user_namespace *ns) { return inc_ucount(ns, current_euid(), UCOUNT_MNT_NAMESPACES); } ",0 "void FaviconWebUIHandler::OnFaviconDataAvailable( FaviconService::Handle request_handle, history::FaviconData favicon) { FaviconService* favicon_service = web_ui_->GetProfile()->GetFaviconService(Profile::EXPLICIT_ACCESS); int id = consumer_.GetClientData(favicon_service, request_handle); if (favicon.is_valid()) { FundamentalValue id_value(id); color_utils::GridSampler sampler; SkColor color = color_utils::CalculateKMeanColorOfPNG(favicon.image_data, 100, 665, sampler); std::string css_color = base::StringPrintf(""rgb(%d, %d, %d)"", SkColorGetR(color), SkColorGetG(color), SkColorGetB(color)); StringValue color_value(css_color); web_ui_->CallJavascriptFunction(""ntp4.setFaviconDominantColor"", id_value, color_value); } } ",1 "static int php_pgsql_flush_query(PGconn *pgsql TSRMLS_DC) { PGresult *res; int leftover = 0; if (PQ_SETNONBLOCKING(pgsql, 1)) { php_error_docref(NULL TSRMLS_CC, E_NOTICE,""Cannot set connection to nonblocking mode""); return -1; } while ((res = PQgetResult(pgsql))) { PQclear(res); leftover++; } PQ_SETNONBLOCKING(pgsql, 0); return leftover; } ",0 "static int mailimf_subject_parse(const char * message, size_t length, size_t * indx, struct mailimf_subject ** result) { struct mailimf_subject * subject; char * value; size_t cur_token; int r; int res; cur_token = * indx; r = mailimf_token_case_insensitive_parse(message, length, &cur_token, ""Subject""); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_colon_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_unstructured_parse(message, length, &cur_token, &value); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_unstrict_crlf_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto free_value; } subject = mailimf_subject_new(value); if (subject == NULL) { res = MAILIMF_ERROR_MEMORY; goto free_value; } * result = subject; * indx = cur_token; return MAILIMF_NO_ERROR; free_value: mailimf_unstructured_free(value); err: return res; } ",0 "static int __init set_uhash_entries(char *str) { ssize_t ret; if (!str) return 0; ret = kstrtoul(str, 0, &uhash_entries); if (ret) return 0; if (uhash_entries && uhash_entries < UDP_HTABLE_SIZE_MIN) uhash_entries = UDP_HTABLE_SIZE_MIN; return 1; } ",0 "JSValue jsTestObjWithScriptStateAttributeRaises(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast(asObject(slotBase)); ExceptionCode ec = 0; TestObj* impl = static_cast(castedThis->impl()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->withScriptStateAttributeRaises(exec, ec))); setDOMException(exec, ec); return result; } ",0 "static void apic_update_ppr(struct kvm_lapic *apic) { u32 tpr, isrv, ppr, old_ppr; int isr; old_ppr = kvm_apic_get_reg(apic, APIC_PROCPRI); tpr = kvm_apic_get_reg(apic, APIC_TASKPRI); isr = apic_find_highest_isr(apic); isrv = (isr != -1) ? isr : 0; if ((tpr & 0xf0) >= (isrv & 0xf0)) ppr = tpr & 0xff; else ppr = isrv & 0xf0; apic_debug(""vlapic %p, ppr 0x%x, isr 0x%x, isrv 0x%x"", apic, ppr, isr, isrv); if (old_ppr != ppr) { apic_set_reg(apic, APIC_PROCPRI, ppr); if (ppr < old_ppr) kvm_make_request(KVM_REQ_EVENT, apic->vcpu); } } ",0 "static void convertToWithoutRowidTable(Parse *pParse, Table *pTab){ Index *pIdx; Index *pPk; int nPk; int i, j; sqlite3 *db = pParse->db; Vdbe *v = pParse->pVdbe; /* Mark every PRIMARY KEY column as NOT NULL (except for imposter tables) */ if( !db->init.imposterTable ){ for(i=0; inCol; i++){ if( (pTab->aCol[i].colFlags & COLFLAG_PRIMKEY)!=0 ){ pTab->aCol[i].notNull = OE_Abort; } } } /* Convert the P3 operand of the OP_CreateBtree opcode from BTREE_INTKEY ** into BTREE_BLOBKEY. */ if( pParse->addrCrTab ){ assert( v ); sqlite3VdbeChangeP3(v, pParse->addrCrTab, BTREE_BLOBKEY); } /* Locate the PRIMARY KEY index. Or, if this table was originally ** an INTEGER PRIMARY KEY table, create a new PRIMARY KEY index. */ if( pTab->iPKey>=0 ){ ExprList *pList; Token ipkToken; sqlite3TokenInit(&ipkToken, pTab->aCol[pTab->iPKey].zName); pList = sqlite3ExprListAppend(pParse, 0, sqlite3ExprAlloc(db, TK_ID, &ipkToken, 0)); if( pList==0 ) return; pList->a[0].sortOrder = pParse->iPkSortOrder; assert( pParse->pNewTable==pTab ); sqlite3CreateIndex(pParse, 0, 0, 0, pList, pTab->keyConf, 0, 0, 0, 0, SQLITE_IDXTYPE_PRIMARYKEY); if( db->mallocFailed || pParse->nErr ) return; pPk = sqlite3PrimaryKeyIndex(pTab); pTab->iPKey = -1; }else{ pPk = sqlite3PrimaryKeyIndex(pTab); /* ** Remove all redundant columns from the PRIMARY KEY. For example, change ** ""PRIMARY KEY(a,b,a,b,c,b,c,d)"" into just ""PRIMARY KEY(a,b,c,d)"". Later ** code assumes the PRIMARY KEY contains no repeated columns. */ for(i=j=1; inKeyCol; i++){ if( hasColumn(pPk->aiColumn, j, pPk->aiColumn[i]) ){ pPk->nColumn--; }else{ pPk->aiColumn[j++] = pPk->aiColumn[i]; } } pPk->nKeyCol = j; } assert( pPk!=0 ); pPk->isCovering = 1; if( !db->init.imposterTable ) pPk->uniqNotNull = 1; nPk = pPk->nKeyCol; /* Bypass the creation of the PRIMARY KEY btree and the sqlite_master ** table entry. This is only required if currently generating VDBE ** code for a CREATE TABLE (not when parsing one as part of reading ** a database schema). */ if( v && pPk->tnum>0 ){ assert( db->init.busy==0 ); sqlite3VdbeChangeOpcode(v, pPk->tnum, OP_Goto); } /* The root page of the PRIMARY KEY is the table root page */ pPk->tnum = pTab->tnum; /* Update the in-memory representation of all UNIQUE indices by converting ** the final rowid column into one or more columns of the PRIMARY KEY. */ for(pIdx=pTab->pIndex; pIdx; pIdx=pIdx->pNext){ int n; if( IsPrimaryKeyIndex(pIdx) ) continue; for(i=n=0; iaiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ) n++; } if( n==0 ){ /* This index is a superset of the primary key */ pIdx->nColumn = pIdx->nKeyCol; continue; } if( resizeIndexObject(db, pIdx, pIdx->nKeyCol+n) ) return; for(i=0, j=pIdx->nKeyCol; iaiColumn, pIdx->nKeyCol, pPk->aiColumn[i]) ){ pIdx->aiColumn[j] = pPk->aiColumn[i]; pIdx->azColl[j] = pPk->azColl[i]; j++; } } assert( pIdx->nColumn>=pIdx->nKeyCol+n ); assert( pIdx->nColumn>=j ); } /* Add all table columns to the PRIMARY KEY index */ if( nPknCol ){ if( resizeIndexObject(db, pPk, pTab->nCol) ) return; for(i=0, j=nPk; inCol; i++){ if( !hasColumn(pPk->aiColumn, j, i) ){ assert( jnColumn ); pPk->aiColumn[j] = i; pPk->azColl[j] = sqlite3StrBINARY; j++; } } assert( pPk->nColumn==j ); assert( pTab->nCol==j ); }else{ pPk->nColumn = pTab->nCol; } recomputeColumnsNotIndexed(pPk); } ",0 "void ChromeClientImpl::getPopupMenuInfo(PopupContainer* popupContainer, WebPopupMenuInfo* info) { const Vector& inputItems = popupContainer->popupData(); WebVector outputItems(inputItems.size()); for (size_t i = 0; i < inputItems.size(); ++i) { const PopupItem& inputItem = *inputItems[i]; WebMenuItemInfo& outputItem = outputItems[i]; outputItem.label = inputItem.label; outputItem.enabled = inputItem.enabled; if (inputItem.textDirection == WebCore::RTL) outputItem.textDirection = WebTextDirectionRightToLeft; else outputItem.textDirection = WebTextDirectionLeftToRight; outputItem.hasTextDirectionOverride = inputItem.hasTextDirectionOverride; switch (inputItem.type) { case PopupItem::TypeOption: outputItem.type = WebMenuItemInfo::Option; break; case PopupItem::TypeGroup: outputItem.type = WebMenuItemInfo::Group; break; case PopupItem::TypeSeparator: outputItem.type = WebMenuItemInfo::Separator; break; default: ASSERT_NOT_REACHED(); } } info->itemHeight = popupContainer->menuItemHeight(); info->itemFontSize = popupContainer->menuItemFontSize(); info->selectedIndex = popupContainer->selectedIndex(); info->items.swap(outputItems); info->rightAligned = popupContainer->menuStyle().textDirection() == RTL; } ",0 "void GpuProcessHost::OnImageCreated(const gfx::Size size) { TRACE_EVENT0(""gpu"", ""GpuProcessHost::OnImageCreated""); if (!create_image_requests_.empty()) { CreateImageCallback callback = create_image_requests_.front(); create_image_requests_.pop(); callback.Run(size); } } ",0 "static RList* fields(RBinFile *bf) { RList *ret = NULL; RBinField *ptr = NULL; struct r_bin_elf_field_t *field = NULL; int i; if (!(ret = r_list_new ())) { return NULL; } ret->free = free; if (!(field = Elf_(r_bin_elf_get_fields) (bf->o->bin_obj))) { return ret; } for (i = 0; !field[i].last; i++) { if (!(ptr = R_NEW0 (RBinField))) { break; } ptr->name = strdup (field[i].name); ptr->comment = NULL; ptr->vaddr = field[i].offset; ptr->paddr = field[i].offset; r_list_append (ret, ptr); } free (field); return ret; } ",0 "void license_send_new_license_request_packet(rdpLicense* license) { wStream* s; char* username; DEBUG_LICENSE(""Sending New License Packet""); s = license_send_stream_init(license); if (license->rdp->settings->Username != NULL) username = license->rdp->settings->Username; else username = ""username""; license->ClientUserName->data = (BYTE*) username; license->ClientUserName->length = strlen(username) + 1; license->ClientMachineName->data = (BYTE*) license->rdp->settings->ClientHostname; license->ClientMachineName->length = strlen(license->rdp->settings->ClientHostname) + 1; license_write_new_license_request_packet(license, s); license_send(license, s, NEW_LICENSE_REQUEST); license->ClientUserName->data = NULL; license->ClientUserName->length = 0; license->ClientMachineName->data = NULL; license->ClientMachineName->length = 0; } ",0 "void ExtensionReadyNotificationObserver::Observe( int type, const content::NotificationSource& source, const content::NotificationDetails& details) { if (!automation_) { delete this; return; } switch (type) { case content::NOTIFICATION_LOAD_STOP: if (!extension_ || !DidExtensionViewsStopLoading(manager_)) return; break; case chrome::NOTIFICATION_EXTENSION_LOADED: { const extensions::Extension* loaded_extension = content::Details(details).ptr(); extensions::Extension::Location location = loaded_extension->location(); if (location != extensions::Extension::INTERNAL && location != extensions::Extension::LOAD) return; extension_ = loaded_extension; if (!DidExtensionViewsStopLoading(manager_)) return; if (!service_->IsBackgroundPageReady(extension_)) return; break; } case chrome::NOTIFICATION_EXTENSION_INSTALL_ERROR: case chrome::NOTIFICATION_EXTENSION_LOAD_ERROR: case chrome::NOTIFICATION_EXTENSION_UPDATE_DISABLED: break; default: NOTREACHED(); break; } AutomationJSONReply reply(automation_, reply_message_.release()); if (extension_) { DictionaryValue dict; dict.SetString(""id"", extension_->id()); reply.SendSuccess(&dict); } else { reply.SendError(""Extension could not be installed""); } delete this; } ",0 "my_object_many_args (MyObject *obj, guint32 x, const char *str, double trouble, double *d_ret, char **str_ret, GError **error) { *d_ret = trouble + (x * 2); *str_ret = g_ascii_strup (str, -1); return TRUE; } ",1 "struct kvm_io_device *kvm_io_bus_get_dev(struct kvm *kvm, enum kvm_bus bus_idx, gpa_t addr) { struct kvm_io_bus *bus; int dev_idx, srcu_idx; struct kvm_io_device *iodev = NULL; srcu_idx = srcu_read_lock(&kvm->srcu); bus = srcu_dereference(kvm->buses[bus_idx], &kvm->srcu); dev_idx = kvm_io_bus_get_first_dev(bus, addr, 1); if (dev_idx < 0) goto out_unlock; iodev = bus->range[dev_idx].dev; out_unlock: srcu_read_unlock(&kvm->srcu, srcu_idx); return iodev; } ",0 "static ssize_t vmci_transport_stream_enqueue( struct vsock_sock *vsk, struct iovec *iov, size_t len) { return vmci_qpair_enquev(vmci_trans(vsk)->qpair, iov, len, 0); } ",0 "base::string16 ExtensionInstallPrompt::Prompt::GetRetainedDeviceMessageString( size_t index) const { CHECK_LT(index, retained_device_messages_.size()); return retained_device_messages_[index]; } ",0 " TT_MulFix14( FT_Int32 a, FT_Int b ) { FT_Int32 sign; FT_UInt32 ah, al, mid, lo, hi; sign = a ^ b; if ( a < 0 ) a = -a; if ( b < 0 ) b = -b; ah = (FT_UInt32)( ( a >> 16 ) & 0xFFFFU ); al = (FT_UInt32)( a & 0xFFFFU ); lo = al * b; mid = ah * b; hi = mid >> 16; mid = ( mid << 16 ) + ( 1 << 13 ); /* rounding */ lo += mid; if ( lo < mid ) hi += 1; mid = ( lo >> 14 ) | ( hi << 18 ); return sign >= 0 ? (FT_Int32)mid : -(FT_Int32)mid; } ",0 " explicit ClearAllServiceWorkersHelper(base::OnceClosure callback) : callback_(std::move(callback)) { DCHECK_CURRENTLY_ON(BrowserThread::IO); } ",0 "IntSize PaintLayerScrollableArea::OffsetFromResizeCorner( const IntPoint& absolute_point) const { IntSize element_size = Layer()->PixelSnappedSize(); if (GetLayoutBox()->ShouldPlaceBlockDirectionScrollbarOnLogicalLeft()) element_size.SetWidth(0); IntPoint resizer_point = IntPoint(element_size); IntPoint local_point = RoundedIntPoint(GetLayoutBox()->AbsoluteToLocal( FloatPoint(absolute_point), kUseTransforms)); return local_point - resizer_point; } ",0 "static void __exit camellia_aesni_fini(void) { crypto_unregister_algs(cmll_algs, ARRAY_SIZE(cmll_algs)); } ",0 "GahpClient::nordugrid_status(const char *hostname, const char *job_id, char *&status) { static const char* command = ""NORDUGRID_STATUS""; if (server->m_commands_supported->contains_anycase(command)==FALSE) { return GAHPCLIENT_COMMAND_NOT_SUPPORTED; } if (!hostname) hostname=NULLSTRING; if (!job_id) job_id=NULLSTRING; std::string reqline; char *esc1 = strdup( escapeGahpString(hostname) ); char *esc2 = strdup( escapeGahpString(job_id) ); int x = sprintf(reqline,""%s %s"", esc1, esc2 ); free( esc1 ); free( esc2 ); ASSERT( x > 0 ); const char *buf = reqline.c_str(); if ( !is_pending(command,buf) ) { if ( m_mode == results_only ) { return GAHPCLIENT_COMMAND_NOT_SUBMITTED; } now_pending(command,buf,deleg_proxy); } Gahp_Args* result = get_pending_result(command,buf); if ( result ) { if (result->argc != 4) { EXCEPT(""Bad %s Result"",command); } int rc = atoi(result->argv[1]); if ( strcasecmp(result->argv[2], NULLSTRING) ) { status = strdup(result->argv[2]); } if ( strcasecmp(result->argv[3], NULLSTRING) ) { error_string = result->argv[3]; } else { error_string = """"; } delete result; return rc; } if ( check_pending_timeout(command,buf) ) { sprintf( error_string, ""%s timed out"", command ); return GAHPCLIENT_COMMAND_TIMED_OUT; } return GAHPCLIENT_COMMAND_PENDING; } ",0 "void MemBackendImpl::OnEntryUpdated(MemEntryImpl* entry) { DCHECK(CheckLRUListOrder(lru_list_)); entry->RemoveFromList(); lru_list_.Append(entry); } ",0 "void GLES2DecoderImpl::DoClear(GLbitfield mask) { if (CheckBoundFramebuffersValid(""glClear"")) { UNSHIPPED_TRACE_EVENT_INSTANT2(""test_gpu"", ""DoClear"", ""red"", clear_red_, ""green"", clear_green_); ApplyDirtyState(); glClear(mask); } } ",0 "ssize_t AMediaCodec_dequeueInputBuffer(AMediaCodec *mData, int64_t timeoutUs) { size_t idx; status_t ret = mData->mCodec->dequeueInputBuffer(&idx, timeoutUs); requestActivityNotification(mData); if (ret == OK) { return idx; } return translate_error(ret); } ",0 "ExtensionGlobalError::~ExtensionGlobalError() { } ",0 "static void LiveNodeListBaseWriteBarrier(void* parent, const LiveNodeListBase* list) { if (IsHTMLCollectionType(list->GetType())) { ScriptWrappableVisitor::WriteBarrier( static_cast(list)); } else { ScriptWrappableVisitor::WriteBarrier( static_cast(list)); } } ",0 "get_loop_mode (int16_t mode) { switch (mode) { case 0 : return SF_LOOP_NONE ; case 1 : return SF_LOOP_FORWARD ; case 2 : return SF_LOOP_BACKWARD ; } ; return SF_LOOP_NONE ; } /* get_loop_mode */ ",0 "static int em_sysexit(struct x86_emulate_ctxt *ctxt) { const struct x86_emulate_ops *ops = ctxt->ops; struct desc_struct cs, ss; u64 msr_data; int usermode; u16 cs_sel = 0, ss_sel = 0; /* inject #GP if in real mode or Virtual 8086 mode */ if (ctxt->mode == X86EMUL_MODE_REAL || ctxt->mode == X86EMUL_MODE_VM86) return emulate_gp(ctxt, 0); setup_syscalls_segments(ctxt, &cs, &ss); if ((ctxt->rex_prefix & 0x8) != 0x0) usermode = X86EMUL_MODE_PROT64; else usermode = X86EMUL_MODE_PROT32; cs.dpl = 3; ss.dpl = 3; ops->get_msr(ctxt, MSR_IA32_SYSENTER_CS, &msr_data); switch (usermode) { case X86EMUL_MODE_PROT32: cs_sel = (u16)(msr_data + 16); if ((msr_data & 0xfffc) == 0x0) return emulate_gp(ctxt, 0); ss_sel = (u16)(msr_data + 24); break; case X86EMUL_MODE_PROT64: cs_sel = (u16)(msr_data + 32); if (msr_data == 0x0) return emulate_gp(ctxt, 0); ss_sel = cs_sel + 8; cs.d = 0; cs.l = 1; break; } cs_sel |= SELECTOR_RPL_MASK; ss_sel |= SELECTOR_RPL_MASK; ops->set_segment(ctxt, cs_sel, &cs, 0, VCPU_SREG_CS); ops->set_segment(ctxt, ss_sel, &ss, 0, VCPU_SREG_SS); ctxt->_eip = reg_read(ctxt, VCPU_REGS_RDX); *reg_write(ctxt, VCPU_REGS_RSP) = reg_read(ctxt, VCPU_REGS_RCX); return X86EMUL_CONTINUE; } ",1 "void WebContentsImpl::OnPepperInstanceDeleted() { FOR_EACH_OBSERVER(WebContentsObserver, observers_, PepperInstanceDeleted()); } ",0 "R_API int r_core_cmd0(RCore *core, const char *cmd) { return r_core_cmd (core, cmd, 0); } ",0 "int EVP_DecodeUpdate(EVP_ENCODE_CTX *ctx, unsigned char *out, int *outl, const unsigned char *in, int inl) { int seof = 0, eof = 0, rv = -1, ret = 0, i, v, tmp, n, decoded_len; unsigned char *d; n = ctx->num; d = ctx->enc_data; if (n > 0 && d[n - 1] == '=') { eof++; if (n > 1 && d[n - 2] == '=') eof++; } /* Legacy behaviour: an empty input chunk signals end of input. */ if (inl == 0) { rv = 0; goto end; } for (i = 0; i < inl; i++) { tmp = *(in++); v = conv_ascii2bin(tmp); if (v == B64_ERROR) { rv = -1; goto end; } if (tmp == '=') { eof++; } else if (eof > 0 && B64_BASE64(v)) { /* More data after padding. */ rv = -1; goto end; } if (eof > 2) { rv = -1; goto end; } if (v == B64_EOF) { seof = 1; goto tail; } /* Only save valid base64 characters. */ if (B64_BASE64(v)) { if (n >= 64) { /* * We increment n once per loop, and empty the buffer as soon as * we reach 64 characters, so this can only happen if someone's * manually messed with the ctx. Refuse to write any more data. */ rv = -1; goto end; } OPENSSL_assert(n < (int)sizeof(ctx->enc_data)); d[n++] = tmp; } if (n == 64) { decoded_len = EVP_DecodeBlock(out, d, n); n = 0; if (decoded_len < 0 || eof > decoded_len) { rv = -1; goto end; } ret += decoded_len - eof; out += decoded_len - eof; } } /* * Legacy behaviour: if the current line is a full base64-block (i.e., has * 0 mod 4 base64 characters), it is processed immediately. We keep this * behaviour as applications may not be calling EVP_DecodeFinal properly. */ tail: if (n > 0) { if ((n & 3) == 0) { decoded_len = EVP_DecodeBlock(out, d, n); n = 0; if (decoded_len < 0 || eof > decoded_len) { rv = -1; goto end; } ret += (decoded_len - eof); } else if (seof) { /* EOF in the middle of a base64 block. */ rv = -1; goto end; } } rv = seof || (n == 0 && eof) ? 0 : 1; end: /* Legacy behaviour. This should probably rather be zeroed on error. */ *outl = ret; ctx->num = n; return (rv); } ",0 "static void cachedAttributeAnyAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectPythonV8Internal::cachedAttributeAnyAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "AutocompleteResult::const_iterator AutocompleteResult::begin() const { return matches_.begin(); } ",0 "get_array_end(void *state) { GetState *_state = (GetState *) state; int lex_level = _state->lex->lex_level; if (lex_level == 0 && _state->npath == 0) { /* Special case: return the entire array */ char *start = _state->result_start; int len = _state->lex->prev_token_terminator - start; _state->tresult = cstring_to_text_with_len(start, len); } } ",0 "void kvm_apic_set_version(struct kvm_vcpu *vcpu) { struct kvm_lapic *apic = vcpu->arch.apic; struct kvm_cpuid_entry2 *feat; u32 v = APIC_VERSION; if (!kvm_vcpu_has_lapic(vcpu)) return; feat = kvm_find_cpuid_entry(apic->vcpu, 0x1, 0); if (feat && (feat->ecx & (1 << (X86_FEATURE_X2APIC & 31)))) v |= APIC_LVR_DIRECTED_EOI; apic_set_reg(apic, APIC_LVR, v); } ",0 "static int hashciedefspace(i_ctx_t *i_ctx_p, ref *space, gs_md5_state_t *md5) { int code = 0; ref CIEdict1, spacename; code = array_get(imemory, space, 0, &spacename); if (code < 0) return 0; gs_md5_append(md5, (const gs_md5_byte_t *)&spacename.value.pname, sizeof(spacename.value.pname)); code = array_get(imemory, space, 1, &CIEdict1); if (code < 0) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""WhitePoint"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""BlackPoint"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""RangeABC"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""DecodeABC"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""MatrixABC"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""RangeLMN"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""DecodeLMN"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""MatrixMN"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""RangeDEF"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""DecodeDEF"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""RangeHIJ"", md5)) return 0; if (!hashdictkey(i_ctx_p, &CIEdict1, (char *)""Table"", md5)) return 0; return 1; } ",0 "void AppCacheUpdateJob::HandleCacheFailure( const blink::mojom::AppCacheErrorDetails& error_details, ResultType result, const GURL& failed_resource_url) { DCHECK(internal_state_ != CACHE_FAILURE); DCHECK(!error_details.message.empty()); DCHECK(result != UPDATE_OK); internal_state_ = CACHE_FAILURE; LogHistogramStats(result, failed_resource_url); CancelAllUrlFetches(); CancelAllMasterEntryFetches(error_details); NotifyAllError(error_details); DiscardInprogressCache(); internal_state_ = COMPLETED; if (update_type_ == CACHE_ATTEMPT || !IsEvictableError(result, error_details) || service_->storage() != storage_) { DeleteSoon(); return; } if (group_->first_evictable_error_time().is_null()) { group_->set_first_evictable_error_time(base::Time::Now()); storage_->StoreEvictionTimes(group_); DeleteSoon(); return; } base::TimeDelta kMaxEvictableErrorDuration = base::TimeDelta::FromDays(14); base::TimeDelta error_duration = base::Time::Now() - group_->first_evictable_error_time(); if (error_duration > kMaxEvictableErrorDuration) { group_->SetUpdateAppCacheStatus(AppCacheGroup::IDLE); group_ = nullptr; service_->DeleteAppCacheGroup(manifest_url_, base::BindOnce(EmptyCompletionCallback)); } DeleteSoon(); // To unwind the stack prior to deletion. } ",0 "OpenUnixSocket(const char * path) { struct sockaddr_un addr; int s; int rv; s = socket(AF_UNIX, SOCK_STREAM, 0); if(s < 0) { syslog(LOG_ERR, ""socket(AF_UNIX): %m""); return -1; } /* unlink the socket pseudo file before binding */ rv = unlink(path); if(rv < 0 && errno != ENOENT) { syslog(LOG_ERR, ""unlink(unixsocket, \""%s\""): %m"", path); close(s); return -1; } addr.sun_family = AF_UNIX; strncpy(addr.sun_path, path, sizeof(addr.sun_path)); if(bind(s, (struct sockaddr *)&addr, sizeof(struct sockaddr_un)) < 0) { syslog(LOG_ERR, ""bind(unixsocket, \""%s\""): %m"", path); close(s); return -1; } else if(listen(s, 5) < 0) { syslog(LOG_ERR, ""listen(unixsocket): %m""); close(s); return -1; } /* Change rights so everyone can communicate with us */ if(chmod(path, 0666) < 0) { syslog(LOG_WARNING, ""chmod(\""%s\""): %m"", path); } return s; } ",0 "int config__read_file_core(struct mosquitto__config *config, bool reload, struct config_recurse *cr, int level, int *lineno, FILE *fptr, char **buf, int *buflen) { int rc; char *token; int tmp_int; char *saveptr = NULL; #ifdef WITH_BRIDGE char *tmp_char; struct mosquitto__bridge *cur_bridge = NULL; struct mosquitto__bridge_topic *cur_topic; #endif struct mosquitto__auth_plugin_config *cur_auth_plugin_config = NULL; time_t expiration_mult; char *key; char *conf_file; #ifdef WIN32 HANDLE fh; char dirpath[MAX_PATH]; WIN32_FIND_DATA find_data; #else DIR *dh; struct dirent *de; #endif int len; struct mosquitto__listener *cur_listener = &config->default_listener; int i; int lineno_ext; struct mosquitto__security_options *cur_security_options = NULL; *lineno = 0; while(fgets_extending(buf, buflen, fptr)){ (*lineno)++; if((*buf)[0] != '#' && (*buf)[0] != 10 && (*buf)[0] != 13){ while((*buf)[strlen((*buf))-1] == 10 || (*buf)[strlen((*buf))-1] == 13){ (*buf)[strlen((*buf))-1] = 0; } token = strtok_r((*buf), "" "", &saveptr); if(token){ if(!strcmp(token, ""acl_file"")){ conf__set_cur_security_options(config, cur_listener, &cur_security_options); if(reload){ mosquitto__free(cur_security_options->acl_file); cur_security_options->acl_file = NULL; } if(conf__parse_string(&token, ""acl_file"", &cur_security_options->acl_file, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""address"") || !strcmp(token, ""addresses"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge || cur_bridge->addresses){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } while((token = strtok_r(NULL, "" "", &saveptr))){ cur_bridge->address_count++; cur_bridge->addresses = mosquitto__realloc(cur_bridge->addresses, sizeof(struct bridge_address)*cur_bridge->address_count); if(!cur_bridge->addresses){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } cur_bridge->addresses[cur_bridge->address_count-1].address = token; } for(i=0; iaddress_count; i++){ /* cur_bridge->addresses[i].address is now * ""address[:port]"". If address is an IPv6 address, * then port is required. We must check for the : * backwards. */ tmp_char = strrchr(cur_bridge->addresses[i].address, ':'); if(tmp_char){ /* Remove ':', so cur_bridge->addresses[i].address * now just looks like the address. */ tmp_char[0] = '\0'; /* The remainder of the string */ tmp_int = atoi(&tmp_char[1]); if(tmp_int < 1 || tmp_int > 65535){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid port value (%d)."", tmp_int); return MOSQ_ERR_INVAL; } cur_bridge->addresses[i].port = tmp_int; }else{ cur_bridge->addresses[i].port = 1883; } /* This looks a bit weird, but isn't. Before this * call, cur_bridge->addresses[i].address points * to the tokenised part of the line, it will be * reused in a future parse of a config line so we * must duplicate it. */ cur_bridge->addresses[i].address = mosquitto__strdup(cur_bridge->addresses[i].address); conf__attempt_resolve(cur_bridge->addresses[i].address, ""bridge address"", MOSQ_LOG_WARNING, ""Warning""); } if(cur_bridge->address_count == 0){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty address value in configuration.""); return MOSQ_ERR_INVAL; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""allow_anonymous"")){ conf__set_cur_security_options(config, cur_listener, &cur_security_options); if(conf__parse_bool(&token, ""allow_anonymous"", (bool *)&cur_security_options->allow_anonymous, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""allow_duplicate_messages"")){ if(conf__parse_bool(&token, ""allow_duplicate_messages"", &config->allow_duplicate_messages, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""allow_zero_length_clientid"")){ conf__set_cur_security_options(config, cur_listener, &cur_security_options); if(conf__parse_bool(&token, ""allow_zero_length_clientid"", &cur_security_options->allow_zero_length_clientid, saveptr)) return MOSQ_ERR_INVAL; }else if(!strncmp(token, ""auth_opt_"", 9)){ if(reload) continue; // Auth plugin not currently valid for reloading. if(!cur_auth_plugin_config){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: An auth_opt_ option exists in the config file without an auth_plugin.""); return MOSQ_ERR_INVAL; } if(strlen(token) < 12){ /* auth_opt_ == 9, + one digit key == 10, + one space == 11, + one value == 12 */ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid auth_opt_ config option.""); return MOSQ_ERR_INVAL; } key = mosquitto__strdup(&token[9]); if(!key){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; }else if(STREMPTY(key)){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid auth_opt_ config option.""); mosquitto__free(key); return MOSQ_ERR_INVAL; } token += 9+strlen(key)+1; while(token[0] == ' ' || token[0] == '\t'){ token++; } if(token[0]){ cur_auth_plugin_config->option_count++; cur_auth_plugin_config->options = mosquitto__realloc(cur_auth_plugin_config->options, cur_auth_plugin_config->option_count*sizeof(struct mosquitto_auth_opt)); if(!cur_auth_plugin_config->options){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); mosquitto__free(key); return MOSQ_ERR_NOMEM; } cur_auth_plugin_config->options[cur_auth_plugin_config->option_count-1].key = key; cur_auth_plugin_config->options[cur_auth_plugin_config->option_count-1].value = mosquitto__strdup(token); if(!cur_auth_plugin_config->options[cur_auth_plugin_config->option_count-1].value){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty %s value in configuration."", key); mosquitto__free(key); return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""auth_plugin"")){ if(reload) continue; // Auth plugin not currently valid for reloading. conf__set_cur_security_options(config, cur_listener, &cur_security_options); cur_security_options->auth_plugin_configs = mosquitto__realloc(cur_security_options->auth_plugin_configs, (cur_security_options->auth_plugin_config_count+1)*sizeof(struct mosquitto__auth_plugin_config)); if(!cur_security_options->auth_plugin_configs){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } cur_auth_plugin_config = &cur_security_options->auth_plugin_configs[cur_security_options->auth_plugin_config_count]; memset(cur_auth_plugin_config, 0, sizeof(struct mosquitto__auth_plugin_config)); cur_auth_plugin_config->path = NULL; cur_auth_plugin_config->options = NULL; cur_auth_plugin_config->option_count = 0; cur_auth_plugin_config->deny_special_chars = true; cur_security_options->auth_plugin_config_count++; if(conf__parse_string(&token, ""auth_plugin"", &cur_auth_plugin_config->path, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""auth_plugin_deny_special_chars"")){ if(reload) continue; // Auth plugin not currently valid for reloading. if(!cur_auth_plugin_config){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: An auth_plugin_deny_special_chars option exists in the config file without an auth_plugin.""); return MOSQ_ERR_INVAL; } if(conf__parse_bool(&token, ""auth_plugin_deny_special_chars"", &cur_auth_plugin_config->deny_special_chars, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""auto_id_prefix"")){ conf__set_cur_security_options(config, cur_listener, &cur_security_options); if(conf__parse_string(&token, ""auto_id_prefix"", &cur_security_options->auto_id_prefix, saveptr)) return MOSQ_ERR_INVAL; if(cur_security_options->auto_id_prefix){ cur_security_options->auto_id_prefix_len = strlen(cur_security_options->auto_id_prefix); }else{ cur_security_options->auto_id_prefix_len = 0; } }else if(!strcmp(token, ""autosave_interval"")){ if(conf__parse_int(&token, ""autosave_interval"", &config->autosave_interval, saveptr)) return MOSQ_ERR_INVAL; if(config->autosave_interval < 0) config->autosave_interval = 0; }else if(!strcmp(token, ""autosave_on_changes"")){ if(conf__parse_bool(&token, ""autosave_on_changes"", &config->autosave_on_changes, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""bind_address"")){ if(reload) continue; // Listener not valid for reloading. if(conf__parse_string(&token, ""default listener bind_address"", &config->default_listener.host, saveptr)) return MOSQ_ERR_INVAL; if(conf__attempt_resolve(config->default_listener.host, ""bind_address"", MOSQ_LOG_ERR, ""Error"")){ return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""bridge_attempt_unsubscribe"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_bool(&token, ""bridge_attempt_unsubscribe"", &cur_bridge->attempt_unsubscribe, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""bridge_cafile"")){ #if defined(WITH_BRIDGE) && defined(WITH_TLS) if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } #ifdef WITH_TLS_PSK if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot use both certificate and psk encryption in a single bridge.""); return MOSQ_ERR_INVAL; } #endif if(conf__parse_string(&token, ""bridge_cafile"", &cur_bridge->tls_cafile, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge and/or TLS support not available.""); #endif }else if(!strcmp(token, ""bridge_capath"")){ #if defined(WITH_BRIDGE) && defined(WITH_TLS) if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } #ifdef WITH_TLS_PSK if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot use both certificate and psk encryption in a single bridge.""); return MOSQ_ERR_INVAL; } #endif if(conf__parse_string(&token, ""bridge_capath"", &cur_bridge->tls_capath, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge and/or TLS support not available.""); #endif }else if(!strcmp(token, ""bridge_certfile"")){ #if defined(WITH_BRIDGE) && defined(WITH_TLS) if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } #ifdef WITH_TLS_PSK if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot use both certificate and psk encryption in a single bridge.""); return MOSQ_ERR_INVAL; } #endif if(conf__parse_string(&token, ""bridge_certfile"", &cur_bridge->tls_certfile, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge and/or TLS support not available.""); #endif }else if(!strcmp(token, ""bridge_identity"")){ #if defined(WITH_BRIDGE) && defined(WITH_TLS_PSK) if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(cur_bridge->tls_cafile || cur_bridge->tls_capath || cur_bridge->tls_certfile || cur_bridge->tls_keyfile){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot use both certificate and identity encryption in a single bridge.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""bridge_identity"", &cur_bridge->tls_psk_identity, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge and/or TLS-PSK support not available.""); #endif }else if(!strcmp(token, ""bridge_insecure"")){ #if defined(WITH_BRIDGE) && defined(WITH_TLS) if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_bool(&token, ""bridge_insecure"", &cur_bridge->tls_insecure, saveptr)) return MOSQ_ERR_INVAL; if(cur_bridge->tls_insecure){ log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge %s using insecure mode."", cur_bridge->name); } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge and/or TLS-PSK support not available.""); #endif }else if(!strcmp(token, ""bridge_keyfile"")){ #if defined(WITH_BRIDGE) && defined(WITH_TLS) if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } #ifdef WITH_TLS_PSK if(cur_bridge->tls_psk_identity || cur_bridge->tls_psk){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot use both certificate and psk encryption in a single bridge.""); return MOSQ_ERR_INVAL; } #endif if(conf__parse_string(&token, ""bridge_keyfile"", &cur_bridge->tls_keyfile, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge and/or TLS support not available.""); #endif }else if(!strcmp(token, ""bridge_protocol_version"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } token = strtok_r(NULL, """", &saveptr); if(token){ if(!strcmp(token, ""mqttv31"")){ cur_bridge->protocol_version = mosq_p_mqtt31; }else if(!strcmp(token, ""mqttv311"")){ cur_bridge->protocol_version = mosq_p_mqtt311; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge_protocol_version value (%s)."", token); return MOSQ_ERR_INVAL; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty bridge_protocol_version value in configuration.""); return MOSQ_ERR_INVAL; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""bridge_psk"")){ #if defined(WITH_BRIDGE) && defined(WITH_TLS_PSK) if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(cur_bridge->tls_cafile || cur_bridge->tls_capath || cur_bridge->tls_certfile || cur_bridge->tls_keyfile){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot use both certificate and psk encryption in a single bridge.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""bridge_psk"", &cur_bridge->tls_psk, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge and/or TLS-PSK support not available.""); #endif }else if(!strcmp(token, ""bridge_tls_version"")){ #if defined(WITH_BRIDGE) && defined(WITH_TLS) if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""bridge_tls_version"", &cur_bridge->tls_version, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge and/or TLS support not available.""); #endif }else if(!strcmp(token, ""cafile"")){ #if defined(WITH_TLS) if(reload) continue; // Listeners not valid for reloading. if(cur_listener->psk_hint){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot use both certificate and psk encryption in a single listener.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""cafile"", &cur_listener->cafile, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""capath"")){ #ifdef WITH_TLS if(reload) continue; // Listeners not valid for reloading. if(conf__parse_string(&token, ""capath"", &cur_listener->capath, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""certfile"")){ #ifdef WITH_TLS if(reload) continue; // Listeners not valid for reloading. if(cur_listener->psk_hint){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot use both certificate and psk encryption in a single listener.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""certfile"", &cur_listener->certfile, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""ciphers"")){ #ifdef WITH_TLS if(reload) continue; // Listeners not valid for reloading. if(conf__parse_string(&token, ""ciphers"", &cur_listener->ciphers, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""clientid"") || !strcmp(token, ""remote_clientid"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""bridge remote clientid"", &cur_bridge->remote_clientid, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""cleansession"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_bool(&token, ""cleansession"", &cur_bridge->clean_session, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""clientid_prefixes"")){ if(reload){ mosquitto__free(config->clientid_prefixes); config->clientid_prefixes = NULL; } if(conf__parse_string(&token, ""clientid_prefixes"", &config->clientid_prefixes, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""connection"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME token = strtok_r(NULL, "" "", &saveptr); if(token){ /* Check for existing bridge name. */ for(i=0; ibridge_count; i++){ if(!strcmp(config->bridges[i].name, token)){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Duplicate bridge name \""%s\""."", token); return MOSQ_ERR_INVAL; } } config->bridge_count++; config->bridges = mosquitto__realloc(config->bridges, config->bridge_count*sizeof(struct mosquitto__bridge)); if(!config->bridges){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } cur_bridge = &(config->bridges[config->bridge_count-1]); memset(cur_bridge, 0, sizeof(struct mosquitto__bridge)); cur_bridge->name = mosquitto__strdup(token); if(!cur_bridge->name){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } cur_bridge->keepalive = 60; cur_bridge->notifications = true; cur_bridge->notifications_local_only = false; cur_bridge->start_type = bst_automatic; cur_bridge->idle_timeout = 60; cur_bridge->restart_timeout = 30; cur_bridge->threshold = 10; cur_bridge->try_private = true; cur_bridge->attempt_unsubscribe = true; cur_bridge->protocol_version = mosq_p_mqtt311; cur_bridge->primary_retry_sock = INVALID_SOCKET; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty connection value in configuration.""); return MOSQ_ERR_INVAL; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""connection_messages"")){ if(conf__parse_bool(&token, token, &config->connection_messages, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""crlfile"")){ #ifdef WITH_TLS if(reload) continue; // Listeners not valid for reloading. if(conf__parse_string(&token, ""crlfile"", &cur_listener->crlfile, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""http_dir"")){ #ifdef WITH_WEBSOCKETS if(reload) continue; // Listeners not valid for reloading. if(conf__parse_string(&token, ""http_dir"", &cur_listener->http_dir, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Websockets support not available.""); #endif }else if(!strcmp(token, ""idle_timeout"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_int(&token, ""idle_timeout"", &cur_bridge->idle_timeout, saveptr)) return MOSQ_ERR_INVAL; if(cur_bridge->idle_timeout < 1){ log__printf(NULL, MOSQ_LOG_NOTICE, ""idle_timeout interval too low, using 1 second.""); cur_bridge->idle_timeout = 1; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""include_dir"")){ if(level == 0){ /* Only process include_dir from the main config file. */ token = strtok_r(NULL, """", &saveptr); if(!token){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty include_dir value in configuration.""); return 1; } #ifdef WIN32 snprintf(dirpath, MAX_PATH, ""%s\\*.conf"", token); fh = FindFirstFile(dirpath, &find_data); if(fh == INVALID_HANDLE_VALUE){ /* No files found */ continue; } do{ len = strlen(token)+1+strlen(find_data.cFileName)+1; conf_file = mosquitto__malloc(len+1); if(!conf_file){ FindClose(fh); return MOSQ_ERR_NOMEM; } snprintf(conf_file, len, ""%s\\%s"", token, find_data.cFileName); conf_file[len] = '\0'; rc = config__read_file(config, reload, conf_file, cr, level+1, &lineno_ext); if(rc){ FindClose(fh); log__printf(NULL, MOSQ_LOG_ERR, ""Error found at %s:%d."", conf_file, lineno_ext); mosquitto__free(conf_file); return rc; } mosquitto__free(conf_file); }while(FindNextFile(fh, &find_data)); FindClose(fh); #else dh = opendir(token); if(!dh){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Unable to open include_dir '%s'."", token); return 1; } while((de = readdir(dh)) != NULL){ if(strlen(de->d_name) > 5){ if(!strcmp(&de->d_name[strlen(de->d_name)-5], "".conf"")){ len = strlen(token)+1+strlen(de->d_name)+1; conf_file = mosquitto__malloc(len+1); if(!conf_file){ closedir(dh); return MOSQ_ERR_NOMEM; } snprintf(conf_file, len, ""%s/%s"", token, de->d_name); conf_file[len] = '\0'; rc = config__read_file(config, reload, conf_file, cr, level+1, &lineno_ext); if(rc){ closedir(dh); log__printf(NULL, MOSQ_LOG_ERR, ""Error found at %s:%d."", conf_file, lineno_ext); mosquitto__free(conf_file); return rc; } mosquitto__free(conf_file); } } } closedir(dh); #endif } }else if(!strcmp(token, ""keepalive_interval"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_int(&token, ""keepalive_interval"", &cur_bridge->keepalive, saveptr)) return MOSQ_ERR_INVAL; if(cur_bridge->keepalive < 5){ log__printf(NULL, MOSQ_LOG_NOTICE, ""keepalive interval too low, using 5 seconds.""); cur_bridge->keepalive = 5; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""keyfile"")){ #ifdef WITH_TLS if(reload) continue; // Listeners not valid for reloading. if(conf__parse_string(&token, ""keyfile"", &cur_listener->keyfile, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""listener"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ tmp_int = atoi(token); if(tmp_int < 1 || tmp_int > 65535){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid port value (%d)."", tmp_int); return MOSQ_ERR_INVAL; } if(reload){ /* We reload listeners settings based on port number. * If the port number doesn't already exist, exit with a complaint. */ cur_listener = NULL; for(i=0; ilistener_count; i++){ if(config->listeners[i].port == tmp_int){ cur_listener = &config->listeners[i]; } } if(!cur_listener){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: It is not currently possible to add/remove listeners when reloading the config file.""); return MOSQ_ERR_INVAL; } }else{ config->listener_count++; config->listeners = mosquitto__realloc(config->listeners, sizeof(struct mosquitto__listener)*config->listener_count); if(!config->listeners){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } cur_listener = &config->listeners[config->listener_count-1]; memset(cur_listener, 0, sizeof(struct mosquitto__listener)); } cur_listener->security_options.allow_anonymous = -1; cur_listener->protocol = mp_mqtt; cur_listener->port = tmp_int; token = strtok_r(NULL, """", &saveptr); mosquitto__free(cur_listener->host); if(token){ cur_listener->host = mosquitto__strdup(token); }else{ cur_listener->host = NULL; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty listener value in configuration.""); return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""local_clientid"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""bridge local clientd"", &cur_bridge->local_clientid, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""local_password"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""bridge local_password"", &cur_bridge->local_password, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""local_username"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""bridge local_username"", &cur_bridge->local_username, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""log_dest"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ cr->log_dest_set = 1; if(!strcmp(token, ""none"")){ cr->log_dest = MQTT3_LOG_NONE; }else if(!strcmp(token, ""syslog"")){ cr->log_dest |= MQTT3_LOG_SYSLOG; }else if(!strcmp(token, ""stdout"")){ cr->log_dest |= MQTT3_LOG_STDOUT; }else if(!strcmp(token, ""stderr"")){ cr->log_dest |= MQTT3_LOG_STDERR; }else if(!strcmp(token, ""topic"")){ cr->log_dest |= MQTT3_LOG_TOPIC; }else if(!strcmp(token, ""file"")){ cr->log_dest |= MQTT3_LOG_FILE; if(config->log_fptr || config->log_file){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Duplicate \""log_dest file\"" value.""); return MOSQ_ERR_INVAL; } /* Get remaining string. */ token = &token[strlen(token)+1]; while(token[0] == ' ' || token[0] == '\t'){ token++; } if(token[0]){ config->log_file = mosquitto__strdup(token); if(!config->log_file){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty \""log_dest file\"" value in configuration.""); return MOSQ_ERR_INVAL; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid log_dest value (%s)."", token); return MOSQ_ERR_INVAL; } #if defined(WIN32) || defined(__CYGWIN__) if(service_handle){ if(cr->log_dest == MQTT3_LOG_STDOUT || cr->log_dest == MQTT3_LOG_STDERR){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Cannot log to stdout/stderr when running as a Windows service.""); return MOSQ_ERR_INVAL; } } #endif }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty log_dest value in configuration.""); return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""log_facility"")){ #if defined(WIN32) || defined(__CYGWIN__) log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: log_facility not supported on Windows.""); #else if(conf__parse_int(&token, ""log_facility"", &tmp_int, saveptr)) return MOSQ_ERR_INVAL; switch(tmp_int){ case 0: config->log_facility = LOG_LOCAL0; break; case 1: config->log_facility = LOG_LOCAL1; break; case 2: config->log_facility = LOG_LOCAL2; break; case 3: config->log_facility = LOG_LOCAL3; break; case 4: config->log_facility = LOG_LOCAL4; break; case 5: config->log_facility = LOG_LOCAL5; break; case 6: config->log_facility = LOG_LOCAL6; break; case 7: config->log_facility = LOG_LOCAL7; break; default: log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid log_facility value (%d)."", tmp_int); return MOSQ_ERR_INVAL; } #endif }else if(!strcmp(token, ""log_timestamp"")){ if(conf__parse_bool(&token, token, &config->log_timestamp, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""log_type"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ cr->log_type_set = 1; if(!strcmp(token, ""none"")){ cr->log_type = MOSQ_LOG_NONE; }else if(!strcmp(token, ""information"")){ cr->log_type |= MOSQ_LOG_INFO; }else if(!strcmp(token, ""notice"")){ cr->log_type |= MOSQ_LOG_NOTICE; }else if(!strcmp(token, ""warning"")){ cr->log_type |= MOSQ_LOG_WARNING; }else if(!strcmp(token, ""error"")){ cr->log_type |= MOSQ_LOG_ERR; }else if(!strcmp(token, ""debug"")){ cr->log_type |= MOSQ_LOG_DEBUG; }else if(!strcmp(token, ""subscribe"")){ cr->log_type |= MOSQ_LOG_SUBSCRIBE; }else if(!strcmp(token, ""unsubscribe"")){ cr->log_type |= MOSQ_LOG_UNSUBSCRIBE; #ifdef WITH_WEBSOCKETS }else if(!strcmp(token, ""websockets"")){ cr->log_type |= MOSQ_LOG_WEBSOCKETS; #endif }else if(!strcmp(token, ""all"")){ cr->log_type = INT_MAX; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid log_type value (%s)."", token); return MOSQ_ERR_INVAL; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty log_type value in configuration.""); } }else if(!strcmp(token, ""max_connections"")){ if(reload) continue; // Listeners not valid for reloading. token = strtok_r(NULL, "" "", &saveptr); if(token){ cur_listener->max_connections = atoi(token); if(cur_listener->max_connections < 0) cur_listener->max_connections = -1; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty max_connections value in configuration.""); } }else if(!strcmp(token, ""max_inflight_bytes"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ cr->max_inflight_bytes = atol(token); }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty max_inflight_bytes value in configuration.""); } }else if(!strcmp(token, ""max_inflight_messages"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ cr->max_inflight_messages = atoi(token); if(cr->max_inflight_messages < 0) cr->max_inflight_messages = 0; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty max_inflight_messages value in configuration.""); } }else if(!strcmp(token, ""max_queued_bytes"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ cr->max_queued_bytes = atol(token); /* 63 bits is ok right? */ }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty max_queued_bytes value in configuration.""); } }else if(!strcmp(token, ""max_queued_messages"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ cr->max_queued_messages = atoi(token); if(cr->max_queued_messages < 0) cr->max_queued_messages = 0; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty max_queued_messages value in configuration.""); } }else if(!strcmp(token, ""memory_limit"")){ ssize_t lim; if(conf__parse_ssize_t(&token, ""memory_limit"", &lim, saveptr)) return MOSQ_ERR_INVAL; if(lim < 0){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid memory_limit value (%ld)."", lim); return MOSQ_ERR_INVAL; } memory__set_limit(lim); }else if(!strcmp(token, ""message_size_limit"")){ if(conf__parse_int(&token, ""message_size_limit"", (int *)&config->message_size_limit, saveptr)) return MOSQ_ERR_INVAL; if(config->message_size_limit > MQTT_MAX_PAYLOAD){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid message_size_limit value (%u)."", config->message_size_limit); return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""mount_point"")){ if(reload) continue; // Listeners not valid for reloading. if(config->listener_count == 0){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: You must use create a listener before using the mount_point option in the configuration file.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""mount_point"", &cur_listener->mount_point, saveptr)) return MOSQ_ERR_INVAL; if(mosquitto_pub_topic_check(cur_listener->mount_point) != MOSQ_ERR_SUCCESS){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid mount_point '%s'. Does it contain a wildcard character?"", cur_listener->mount_point); return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""notifications"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_bool(&token, ""notifications"", &cur_bridge->notifications, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""notifications_local_only"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration""); return MOSQ_ERR_INVAL; } if(conf__parse_bool(&token, ""notifications_local_only"", &cur_bridge->notifications_local_only, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""notification_topic"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""notification_topic"", &cur_bridge->notification_topic, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""password"") || !strcmp(token, ""remote_password"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_string(&token, ""bridge remote_password"", &cur_bridge->remote_password, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""password_file"")){ conf__set_cur_security_options(config, cur_listener, &cur_security_options); if(reload){ mosquitto__free(cur_security_options->password_file); cur_security_options->password_file = NULL; } if(conf__parse_string(&token, ""password_file"", &cur_security_options->password_file, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""per_listener_settings"")){ if(conf__parse_bool(&token, ""per_listener_settings"", &config->per_listener_settings, saveptr)) return MOSQ_ERR_INVAL; if(cur_security_options && config->per_listener_settings){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: per_listener_settings must be set before any other security settings.""); return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""persistence"") || !strcmp(token, ""retained_persistence"")){ if(conf__parse_bool(&token, token, &config->persistence, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""persistence_file"")){ if(conf__parse_string(&token, ""persistence_file"", &config->persistence_file, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""persistence_location"")){ if(conf__parse_string(&token, ""persistence_location"", &config->persistence_location, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""persistent_client_expiration"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ switch(token[strlen(token)-1]){ case 'h': expiration_mult = 3600; break; case 'd': expiration_mult = 86400; break; case 'w': expiration_mult = 86400*7; break; case 'm': expiration_mult = 86400*30; break; case 'y': expiration_mult = 86400*365; break; default: log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid persistent_client_expiration duration in configuration.""); return MOSQ_ERR_INVAL; } token[strlen(token)-1] = '\0'; config->persistent_client_expiration = atoi(token)*expiration_mult; if(config->persistent_client_expiration <= 0){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid persistent_client_expiration duration in configuration.""); return MOSQ_ERR_INVAL; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty persistent_client_expiration value in configuration.""); } }else if(!strcmp(token, ""pid_file"")){ if(reload) continue; // pid file not valid for reloading. if(conf__parse_string(&token, ""pid_file"", &config->pid_file, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""port"")){ if(reload) continue; // Listener not valid for reloading. if(config->default_listener.port){ log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Default listener port specified multiple times. Only the latest will be used.""); } if(conf__parse_int(&token, ""port"", &tmp_int, saveptr)) return MOSQ_ERR_INVAL; if(tmp_int < 1 || tmp_int > 65535){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid port value (%d)."", tmp_int); return MOSQ_ERR_INVAL; } config->default_listener.port = tmp_int; }else if(!strcmp(token, ""protocol"")){ token = strtok_r(NULL, "" "", &saveptr); if(token){ if(!strcmp(token, ""mqtt"")){ cur_listener->protocol = mp_mqtt; /* }else if(!strcmp(token, ""mqttsn"")){ cur_listener->protocol = mp_mqttsn; */ }else if(!strcmp(token, ""websockets"")){ #ifdef WITH_WEBSOCKETS cur_listener->protocol = mp_websockets; config->have_websockets_listener = true; #else log__printf(NULL, MOSQ_LOG_ERR, ""Error: Websockets support not available.""); return MOSQ_ERR_INVAL; #endif }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid protocol value (%s)."", token); return MOSQ_ERR_INVAL; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty protocol value in configuration.""); } }else if(!strcmp(token, ""psk_file"")){ #ifdef WITH_TLS_PSK conf__set_cur_security_options(config, cur_listener, &cur_security_options); if(reload){ mosquitto__free(cur_security_options->psk_file); cur_security_options->psk_file = NULL; } if(conf__parse_string(&token, ""psk_file"", &cur_security_options->psk_file, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS/TLS-PSK support not available.""); #endif }else if(!strcmp(token, ""psk_hint"")){ #ifdef WITH_TLS_PSK if(reload) continue; // Listeners not valid for reloading. if(conf__parse_string(&token, ""psk_hint"", &cur_listener->psk_hint, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS/TLS-PSK support not available.""); #endif }else if(!strcmp(token, ""queue_qos0_messages"")){ if(conf__parse_bool(&token, token, &config->queue_qos0_messages, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""require_certificate"")){ #ifdef WITH_TLS if(reload) continue; // Listeners not valid for reloading. if(conf__parse_bool(&token, ""require_certificate"", &cur_listener->require_certificate, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""restart_timeout"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_int(&token, ""restart_timeout"", &cur_bridge->restart_timeout, saveptr)) return MOSQ_ERR_INVAL; if(cur_bridge->restart_timeout < 1){ log__printf(NULL, MOSQ_LOG_NOTICE, ""restart_timeout interval too low, using 1 second.""); cur_bridge->restart_timeout = 1; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""retry_interval"")){ log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: The retry_interval option is no longer available.""); }else if(!strcmp(token, ""round_robin"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_bool(&token, ""round_robin"", &cur_bridge->round_robin, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""set_tcp_nodelay"")){ if(conf__parse_bool(&token, ""set_tcp_nodelay"", &config->set_tcp_nodelay, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""start_type"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } token = strtok_r(NULL, "" "", &saveptr); if(token){ if(!strcmp(token, ""automatic"")){ cur_bridge->start_type = bst_automatic; }else if(!strcmp(token, ""lazy"")){ cur_bridge->start_type = bst_lazy; }else if(!strcmp(token, ""manual"")){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Manual start_type not supported.""); return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""once"")){ cur_bridge->start_type = bst_once; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid start_type value in configuration (%s)."", token); return MOSQ_ERR_INVAL; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty start_type value in configuration.""); return MOSQ_ERR_INVAL; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""socket_domain"")){ if(reload) continue; // Listeners not valid for reloading. token = strtok_r(NULL, "" "", &saveptr); if(token){ if(!strcmp(token, ""ipv4"")){ cur_listener->socket_domain = AF_INET; }else if(!strcmp(token, ""ipv6"")){ cur_listener->socket_domain = AF_INET6; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid socket_domain value \""%s\"" in configuration."", token); return MOSQ_ERR_INVAL; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty socket_domain value in configuration.""); return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""store_clean_interval"")){ log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: store_clean_interval is no longer needed.""); }else if(!strcmp(token, ""sys_interval"")){ if(conf__parse_int(&token, ""sys_interval"", &config->sys_interval, saveptr)) return MOSQ_ERR_INVAL; if(config->sys_interval < 0 || config->sys_interval > 65535){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid sys_interval value (%d)."", config->sys_interval); return MOSQ_ERR_INVAL; } }else if(!strcmp(token, ""threshold"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_int(&token, ""threshold"", &cur_bridge->threshold, saveptr)) return MOSQ_ERR_INVAL; if(cur_bridge->threshold < 1){ log__printf(NULL, MOSQ_LOG_NOTICE, ""threshold too low, using 1 message.""); cur_bridge->threshold = 1; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""tls_version"")){ #if defined(WITH_TLS) if(reload) continue; // Listeners not valid for reloading. if(conf__parse_string(&token, ""tls_version"", &cur_listener->tls_version, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""topic"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } token = strtok_r(NULL, "" "", &saveptr); if(token){ cur_bridge->topic_count++; cur_bridge->topics = mosquitto__realloc(cur_bridge->topics, sizeof(struct mosquitto__bridge_topic)*cur_bridge->topic_count); if(!cur_bridge->topics){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } cur_topic = &cur_bridge->topics[cur_bridge->topic_count-1]; if(!strcmp(token, ""\""\"""")){ cur_topic->topic = NULL; }else{ cur_topic->topic = mosquitto__strdup(token); if(!cur_topic->topic){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } } cur_topic->direction = bd_out; cur_topic->qos = 0; cur_topic->local_prefix = NULL; cur_topic->remote_prefix = NULL; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty topic value in configuration.""); return MOSQ_ERR_INVAL; } token = strtok_r(NULL, "" "", &saveptr); if(token){ if(!strcasecmp(token, ""out"")){ cur_topic->direction = bd_out; }else if(!strcasecmp(token, ""in"")){ cur_topic->direction = bd_in; }else if(!strcasecmp(token, ""both"")){ cur_topic->direction = bd_both; }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge topic direction '%s'."", token); return MOSQ_ERR_INVAL; } token = strtok_r(NULL, "" "", &saveptr); if(token){ cur_topic->qos = atoi(token); if(cur_topic->qos < 0 || cur_topic->qos > 2){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge QoS level '%s'."", token); return MOSQ_ERR_INVAL; } token = strtok_r(NULL, "" "", &saveptr); if(token){ cur_bridge->topic_remapping = true; if(!strcmp(token, ""\""\"""")){ cur_topic->local_prefix = NULL; }else{ if(mosquitto_pub_topic_check(token) != MOSQ_ERR_SUCCESS){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge topic local prefix '%s'."", token); return MOSQ_ERR_INVAL; } cur_topic->local_prefix = mosquitto__strdup(token); if(!cur_topic->local_prefix){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } } token = strtok_r(NULL, "" "", &saveptr); if(token){ if(!strcmp(token, ""\""\"""")){ cur_topic->remote_prefix = NULL; }else{ if(mosquitto_pub_topic_check(token) != MOSQ_ERR_SUCCESS){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge topic remote prefix '%s'."", token); return MOSQ_ERR_INVAL; } cur_topic->remote_prefix = mosquitto__strdup(token); if(!cur_topic->remote_prefix){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } } } } } } if(cur_topic->topic == NULL && (cur_topic->local_prefix == NULL || cur_topic->remote_prefix == NULL)){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge remapping.""); return MOSQ_ERR_INVAL; } if(cur_topic->local_prefix){ if(cur_topic->topic){ len = strlen(cur_topic->topic) + strlen(cur_topic->local_prefix)+1; cur_topic->local_topic = mosquitto__malloc(len+1); if(!cur_topic->local_topic){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } snprintf(cur_topic->local_topic, len+1, ""%s%s"", cur_topic->local_prefix, cur_topic->topic); cur_topic->local_topic[len] = '\0'; }else{ cur_topic->local_topic = mosquitto__strdup(cur_topic->local_prefix); if(!cur_topic->local_topic){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } } }else{ cur_topic->local_topic = mosquitto__strdup(cur_topic->topic); if(!cur_topic->local_topic){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } } if(cur_topic->remote_prefix){ if(cur_topic->topic){ len = strlen(cur_topic->topic) + strlen(cur_topic->remote_prefix)+1; cur_topic->remote_topic = mosquitto__malloc(len+1); if(!cur_topic->remote_topic){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } snprintf(cur_topic->remote_topic, len, ""%s%s"", cur_topic->remote_prefix, cur_topic->topic); cur_topic->remote_topic[len] = '\0'; }else{ cur_topic->remote_topic = mosquitto__strdup(cur_topic->remote_prefix); if(!cur_topic->remote_topic){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } } }else{ cur_topic->remote_topic = mosquitto__strdup(cur_topic->topic); if(!cur_topic->remote_topic){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""try_private"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } if(conf__parse_bool(&token, ""try_private"", &cur_bridge->try_private, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""upgrade_outgoing_qos"")){ if(conf__parse_bool(&token, token, &config->upgrade_outgoing_qos, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""use_identity_as_username"")){ #ifdef WITH_TLS if(reload) continue; // Listeners not valid for reloading. if(conf__parse_bool(&token, ""use_identity_as_username"", &cur_listener->use_identity_as_username, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""use_subject_as_username"")){ #ifdef WITH_TLS if(reload) continue; // Listeners not valid for reloading. if(conf__parse_bool(&token, ""use_subject_as_username"", &cur_listener->use_subject_as_username, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: TLS support not available.""); #endif }else if(!strcmp(token, ""user"")){ if(reload) continue; // Drop privileges user not valid for reloading. if(conf__parse_string(&token, ""user"", &config->user, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""use_username_as_clientid"")){ if(reload) continue; // Listeners not valid for reloading. if(conf__parse_bool(&token, ""use_username_as_clientid"", &cur_listener->use_username_as_clientid, saveptr)) return MOSQ_ERR_INVAL; }else if(!strcmp(token, ""username"") || !strcmp(token, ""remote_username"")){ #ifdef WITH_BRIDGE if(reload) continue; // FIXME if(!cur_bridge){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Invalid bridge configuration.""); return MOSQ_ERR_INVAL; } token = strtok_r(NULL, "" "", &saveptr); if(token){ if(cur_bridge->remote_username){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Duplicate username value in bridge configuration.""); return MOSQ_ERR_INVAL; } cur_bridge->remote_username = mosquitto__strdup(token); if(!cur_bridge->remote_username){ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Out of memory.""); return MOSQ_ERR_NOMEM; } }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Empty username value in configuration.""); return MOSQ_ERR_INVAL; } #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Bridge support not available.""); #endif }else if(!strcmp(token, ""websockets_log_level"")){ #ifdef WITH_WEBSOCKETS if(conf__parse_int(&token, ""websockets_log_level"", &config->websockets_log_level, saveptr)) return MOSQ_ERR_INVAL; #else log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Websockets support not available.""); #endif }else if(!strcmp(token, ""trace_level"") || !strcmp(token, ""ffdc_output"") || !strcmp(token, ""max_log_entries"") || !strcmp(token, ""trace_output"")){ log__printf(NULL, MOSQ_LOG_WARNING, ""Warning: Unsupported rsmb configuration option \""%s\""."", token); }else{ log__printf(NULL, MOSQ_LOG_ERR, ""Error: Unknown configuration variable \""%s\""."", token); return MOSQ_ERR_INVAL; } } } } return MOSQ_ERR_SUCCESS; } ",0 "void OverlayWindowViews::OnNativeWidgetMove() { if (is_initialized_) UpdateControlsVisibility(false); window_bounds_ = GetBounds(); #if defined(OS_CHROMEOS) WindowQuadrant quadrant = GetCurrentWindowQuadrant(GetBounds(), controller_); close_controls_view_->SetPosition(GetBounds().size(), quadrant); resize_handle_view_->SetPosition(GetBounds().size(), quadrant); #endif } ",0 "status_t Camera3Device::RequestThread::removeTriggers( const sp &request) { Mutex::Autolock al(mTriggerMutex); CameraMetadata &metadata = request->mSettings; /** * Replace all old entries with their old values. */ for (size_t i = 0; i < mTriggerReplacedMap.size(); ++i) { RequestTrigger trigger = mTriggerReplacedMap.valueAt(i); status_t res; uint32_t tag = trigger.metadataTag; switch (trigger.getTagType()) { case TYPE_BYTE: { uint8_t entryValue = static_cast(trigger.entryValue); res = metadata.update(tag, &entryValue, /*count*/1); break; } case TYPE_INT32: res = metadata.update(tag, &trigger.entryValue, /*count*/1); break; default: ALOGE(""%s: Type not supported: 0x%x"", __FUNCTION__, trigger.getTagType()); return INVALID_OPERATION; } if (res != OK) { ALOGE(""%s: Failed to restore request metadata with trigger tag %s"" "", trigger value %d"", __FUNCTION__, trigger.getTagName(), trigger.entryValue); return res; } } mTriggerReplacedMap.clear(); /** * Remove all new entries. */ for (size_t i = 0; i < mTriggerRemovedMap.size(); ++i) { RequestTrigger trigger = mTriggerRemovedMap.valueAt(i); status_t res = metadata.erase(trigger.metadataTag); if (res != OK) { ALOGE(""%s: Failed to erase metadata with trigger tag %s"" "", trigger value %d"", __FUNCTION__, trigger.getTagName(), trigger.entryValue); return res; } } mTriggerRemovedMap.clear(); return OK; } ",0 "netdutils::Status XfrmController::flushPolicyDb(const XfrmSocket& s) { std::vector iov = {{NULL, 0}}; // reserved for the eventual addition of a NLMSG_HDR return s.sendMessage(XFRM_MSG_FLUSHPOLICY, NETLINK_REQUEST_FLAGS, 0, &iov); } ",0 "equal_tm (const struct tm *a, const struct tm *b) { return ! ((a->tm_sec ^ b->tm_sec) | (a->tm_min ^ b->tm_min) | (a->tm_hour ^ b->tm_hour) | (a->tm_mday ^ b->tm_mday) | (a->tm_mon ^ b->tm_mon) | (a->tm_year ^ b->tm_year) | isdst_differ (a->tm_isdst, b->tm_isdst)); } ",0 "AccessTokenStore* ShellContentBrowserClient::CreateAccessTokenStore() { return new ShellAccessTokenStore(browser_context()); } ",0 " static void registerBlobURLFromTask(void* context) { OwnPtr blobRegistryContext = adoptPtr(static_cast(context)); blobRegistry().registerBlobURL(blobRegistryContext->url, blobRegistryContext->srcURL); } ",1 "void ScreenOrientation::lockOrientationAsync(blink::WebScreenOrientations orientations) { if (m_lockedOrientations == orientations) return; m_lockedOrientations = orientations; if (!m_orientationLockTimer.isActive()) m_orientationLockTimer.startOneShot(0, FROM_HERE); } ",0 "bool TabStripGtk::IsCompatibleWith(TabStripGtk* other) { return model_->profile() == other->model()->profile(); } ",0 "static int ipip_rcv(struct sk_buff *skb) { struct ip_tunnel *tunnel; const struct iphdr *iph = ip_hdr(skb); rcu_read_lock(); tunnel = ipip_tunnel_lookup(dev_net(skb->dev), iph->saddr, iph->daddr); if (tunnel != NULL) { struct pcpu_tstats *tstats; if (!xfrm4_policy_check(NULL, XFRM_POLICY_IN, skb)) { rcu_read_unlock(); kfree_skb(skb); return 0; } secpath_reset(skb); skb->mac_header = skb->network_header; skb_reset_network_header(skb); skb->protocol = htons(ETH_P_IP); skb->pkt_type = PACKET_HOST; tstats = this_cpu_ptr(tunnel->dev->tstats); tstats->rx_packets++; tstats->rx_bytes += skb->len; __skb_tunnel_rx(skb, tunnel->dev); ipip_ecn_decapsulate(iph, skb); netif_rx(skb); rcu_read_unlock(); return 0; } rcu_read_unlock(); return -1; } ",0 "on_javascript_alert(Ewk_View_Smart_Data *smartData, const char *message) { Browser_Window *window = browser_view_find(smartData->self); Evas_Object *alert_popup = elm_popup_add(window->window); evas_object_size_hint_weight_set(alert_popup, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND); elm_object_text_set(alert_popup, message); elm_object_part_text_set(alert_popup, ""title,text"", ""Alert""); /* Popup buttons */ Evas_Object *button = elm_button_add(alert_popup); elm_object_text_set(button, ""OK""); elm_object_part_content_set(alert_popup, ""button1"", button); evas_object_smart_callback_add(button, ""clicked"", quit_event_loop, NULL); elm_object_focus_set(button, EINA_TRUE); evas_object_show(alert_popup); /* Make modal */ ecore_main_loop_begin(); evas_object_del(alert_popup); } ",0 "void php_mysqlnd_greet_free_mem(void * _packet, zend_bool stack_allocation TSRMLS_DC) { MYSQLND_PACKET_GREET *p= (MYSQLND_PACKET_GREET *) _packet; if (p->server_version) { efree(p->server_version); p->server_version = NULL; } if (p->auth_plugin_data && p->auth_plugin_data != p->intern_auth_plugin_data) { efree(p->auth_plugin_data); p->auth_plugin_data = NULL; } if (p->auth_protocol) { efree(p->auth_protocol); p->auth_protocol = NULL; } if (!stack_allocation) { mnd_pefree(p, p->header.persistent); } } ",0 " static v8::Local createFunction(ScriptState* scriptState, String* value) { StringCapturingFunction* self = new StringCapturingFunction(scriptState, value); return self->bindToV8Function(); } ",0 "void Document::setBgColor(const AtomicString& value) { SetBodyAttribute(bgcolorAttr, value); } ",0 "btpan_conn_t * btpan_find_conn_handle(UINT16 handle) { for (int i = 0; i < MAX_PAN_CONNS; i++) { if (btpan_cb.conns[i].handle == handle) return &btpan_cb.conns[i]; } return NULL; } ",0 "ObjectContentType FrameLoaderClient::objectContentType(const KURL& url, const String& mimeType) { String type = mimeType; if (type.isEmpty()) type = MIMETypeRegistry::getMIMETypeForExtension(url.path().substring(url.path().reverseFind('.') + 1)); if (type.isEmpty()) return WebCore::ObjectContentFrame; if (MIMETypeRegistry::isSupportedImageMIMEType(type)) return WebCore::ObjectContentImage; if (PluginDatabase::installedPlugins()->isMIMETypeRegistered(mimeType)) return WebCore::ObjectContentNetscapePlugin; if (MIMETypeRegistry::isSupportedNonImageMIMEType(type)) return WebCore::ObjectContentFrame; return WebCore::ObjectContentNone; } ",0 "pubkey_cleanup(Authctxt *authctxt) { Identity *id; if (authctxt->agent_fd != -1) ssh_close_authentication_socket(authctxt->agent_fd); for (id = TAILQ_FIRST(&authctxt->keys); id; id = TAILQ_FIRST(&authctxt->keys)) { TAILQ_REMOVE(&authctxt->keys, id, next); sshkey_free(id->key); free(id->filename); free(id); } } ",0 "void SyncManager::SyncInternal::BootstrapEncryption( const std::string& restored_key_for_bootstrapping) { ReadTransaction trans(FROM_HERE, GetUserShare()); Cryptographer* cryptographer = trans.GetCryptographer(); cryptographer->Bootstrap(restored_key_for_bootstrapping); } ",0 "ChromeContentBrowserClient::GetSystemNetworkContext() { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(g_browser_process->system_network_context_manager()); return g_browser_process->system_network_context_manager()->GetContext(); } ",0 "raptor_rdfxml_parser_stats_print(raptor_rdfxml_parser* rdf_xml_parser, FILE *stream) { fputs(""rdf:ID set "", stream); raptor_id_set_stats_print(rdf_xml_parser->id_set, stream); } ",0 "sg_add_request(Sg_fd * sfp) { int k; unsigned long iflags; Sg_request *resp; Sg_request *rp = sfp->req_arr; write_lock_irqsave(&sfp->rq_list_lock, iflags); resp = sfp->headrp; if (!resp) { memset(rp, 0, sizeof (Sg_request)); rp->parentfp = sfp; resp = rp; sfp->headrp = resp; } else { if (0 == sfp->cmd_q) resp = NULL; /* command queuing disallowed */ else { for (k = 0; k < SG_MAX_QUEUE; ++k, ++rp) { if (!rp->parentfp) break; } if (k < SG_MAX_QUEUE) { memset(rp, 0, sizeof (Sg_request)); rp->parentfp = sfp; while (resp->nextrp) resp = resp->nextrp; resp->nextrp = rp; resp = rp; } else resp = NULL; } } if (resp) { resp->nextrp = NULL; resp->header.duration = jiffies_to_msecs(jiffies); } write_unlock_irqrestore(&sfp->rq_list_lock, iflags); return resp; } ",0 "static int is_in_vphdr (Elf_(Phdr) *p, ut64 addr) { return addr >= p->p_vaddr && addr < p->p_vaddr + p->p_memsz; } ",0 "static int rev_same_tree_as_empty(struct rev_info *revs, struct commit *commit) { int retval; struct tree *t1 = commit->tree; if (!t1) return 0; tree_difference = REV_TREE_SAME; DIFF_OPT_CLR(&revs->pruning, HAS_CHANGES); retval = diff_tree_sha1(NULL, t1->object.oid.hash, """", &revs->pruning); return retval >= 0 && (tree_difference == REV_TREE_SAME); } ",0 "js_run_command (JSContextRef ctx, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception) { (void) function; (void) thisObject; (void) exception; JSStringRef js_result_string; GString *result = g_string_new(""""); if (argumentCount >= 1) { JSStringRef arg = JSValueToStringCopy(ctx, arguments[0], NULL); size_t arg_size = JSStringGetMaximumUTF8CStringSize(arg); char ctl_line[arg_size]; JSStringGetUTF8CString(arg, ctl_line, arg_size); parse_cmd_line(ctl_line, result); JSStringRelease(arg); } js_result_string = JSStringCreateWithUTF8CString(result->str); g_string_free(result, TRUE); return JSValueMakeString(ctx, js_result_string); } ",0 "void RenderViewImpl::didChangeSelection(bool is_empty_selection) { if (!handling_input_event_ && !handling_select_range_) return; handling_select_range_ = false; SyncSelectionIfRequired(); } ",0 "handle_t *jbd2__journal_start(journal_t *journal, int nblocks, gfp_t gfp_mask) { handle_t *handle = journal_current_handle(); int err; if (!journal) return ERR_PTR(-EROFS); if (handle) { J_ASSERT(handle->h_transaction->t_journal == journal); handle->h_ref++; return handle; } handle = new_handle(nblocks); if (!handle) return ERR_PTR(-ENOMEM); current->journal_info = handle; err = start_this_handle(journal, handle, gfp_mask); if (err < 0) { jbd2_free_handle(handle); current->journal_info = NULL; handle = ERR_PTR(err); } return handle; } ",0 "int GetFontCharset(FPDF_SYSFONTINFO* sysfontinfo, void* hFont) { auto* fontinfo_with_metrics = static_cast(sysfontinfo); if (!fontinfo_with_metrics->default_sysfontinfo->GetFontCharset) return 0; return fontinfo_with_metrics->default_sysfontinfo->GetFontCharset( fontinfo_with_metrics->default_sysfontinfo, hFont); } ",0 "void XMLRPC_SetValueBase64(XMLRPC_VALUE value, const char* s, int len) { if(value && s) { simplestring_clear(&value->str); (len > 0) ? simplestring_addn(&value->str, s, len) : simplestring_add(&value->str, s); value->type = xmlrpc_base64; } } ",0 "long kvm_arch_vcpu_ioctl(struct file *filp, unsigned int ioctl, unsigned long arg) { struct kvm_vcpu *vcpu = filp->private_data; void __user *argp = (void __user *)arg; int r; union { struct kvm_lapic_state *lapic; struct kvm_xsave *xsave; struct kvm_xcrs *xcrs; void *buffer; } u; u.buffer = NULL; switch (ioctl) { case KVM_GET_LAPIC: { r = -EINVAL; if (!vcpu->arch.apic) goto out; u.lapic = kzalloc(sizeof(struct kvm_lapic_state), GFP_KERNEL); r = -ENOMEM; if (!u.lapic) goto out; r = kvm_vcpu_ioctl_get_lapic(vcpu, u.lapic); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, u.lapic, sizeof(struct kvm_lapic_state))) goto out; r = 0; break; } case KVM_SET_LAPIC: { r = -EINVAL; if (!vcpu->arch.apic) goto out; u.lapic = memdup_user(argp, sizeof(*u.lapic)); if (IS_ERR(u.lapic)) { r = PTR_ERR(u.lapic); goto out; } r = kvm_vcpu_ioctl_set_lapic(vcpu, u.lapic); if (r) goto out; r = 0; break; } case KVM_INTERRUPT: { struct kvm_interrupt irq; r = -EFAULT; if (copy_from_user(&irq, argp, sizeof irq)) goto out; r = kvm_vcpu_ioctl_interrupt(vcpu, &irq); if (r) goto out; r = 0; break; } case KVM_NMI: { r = kvm_vcpu_ioctl_nmi(vcpu); if (r) goto out; r = 0; break; } case KVM_SET_CPUID: { struct kvm_cpuid __user *cpuid_arg = argp; struct kvm_cpuid cpuid; r = -EFAULT; if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) goto out; r = kvm_vcpu_ioctl_set_cpuid(vcpu, &cpuid, cpuid_arg->entries); if (r) goto out; break; } case KVM_SET_CPUID2: { struct kvm_cpuid2 __user *cpuid_arg = argp; struct kvm_cpuid2 cpuid; r = -EFAULT; if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) goto out; r = kvm_vcpu_ioctl_set_cpuid2(vcpu, &cpuid, cpuid_arg->entries); if (r) goto out; break; } case KVM_GET_CPUID2: { struct kvm_cpuid2 __user *cpuid_arg = argp; struct kvm_cpuid2 cpuid; r = -EFAULT; if (copy_from_user(&cpuid, cpuid_arg, sizeof cpuid)) goto out; r = kvm_vcpu_ioctl_get_cpuid2(vcpu, &cpuid, cpuid_arg->entries); if (r) goto out; r = -EFAULT; if (copy_to_user(cpuid_arg, &cpuid, sizeof cpuid)) goto out; r = 0; break; } case KVM_GET_MSRS: r = msr_io(vcpu, argp, kvm_get_msr, 1); break; case KVM_SET_MSRS: r = msr_io(vcpu, argp, do_set_msr, 0); break; case KVM_TPR_ACCESS_REPORTING: { struct kvm_tpr_access_ctl tac; r = -EFAULT; if (copy_from_user(&tac, argp, sizeof tac)) goto out; r = vcpu_ioctl_tpr_access_reporting(vcpu, &tac); if (r) goto out; r = -EFAULT; if (copy_to_user(argp, &tac, sizeof tac)) goto out; r = 0; break; }; case KVM_SET_VAPIC_ADDR: { struct kvm_vapic_addr va; r = -EINVAL; if (!irqchip_in_kernel(vcpu->kvm)) goto out; r = -EFAULT; if (copy_from_user(&va, argp, sizeof va)) goto out; r = 0; kvm_lapic_set_vapic_addr(vcpu, va.vapic_addr); break; } case KVM_X86_SETUP_MCE: { u64 mcg_cap; r = -EFAULT; if (copy_from_user(&mcg_cap, argp, sizeof mcg_cap)) goto out; r = kvm_vcpu_ioctl_x86_setup_mce(vcpu, mcg_cap); break; } case KVM_X86_SET_MCE: { struct kvm_x86_mce mce; r = -EFAULT; if (copy_from_user(&mce, argp, sizeof mce)) goto out; r = kvm_vcpu_ioctl_x86_set_mce(vcpu, &mce); break; } case KVM_GET_VCPU_EVENTS: { struct kvm_vcpu_events events; kvm_vcpu_ioctl_x86_get_vcpu_events(vcpu, &events); r = -EFAULT; if (copy_to_user(argp, &events, sizeof(struct kvm_vcpu_events))) break; r = 0; break; } case KVM_SET_VCPU_EVENTS: { struct kvm_vcpu_events events; r = -EFAULT; if (copy_from_user(&events, argp, sizeof(struct kvm_vcpu_events))) break; r = kvm_vcpu_ioctl_x86_set_vcpu_events(vcpu, &events); break; } case KVM_GET_DEBUGREGS: { struct kvm_debugregs dbgregs; kvm_vcpu_ioctl_x86_get_debugregs(vcpu, &dbgregs); r = -EFAULT; if (copy_to_user(argp, &dbgregs, sizeof(struct kvm_debugregs))) break; r = 0; break; } case KVM_SET_DEBUGREGS: { struct kvm_debugregs dbgregs; r = -EFAULT; if (copy_from_user(&dbgregs, argp, sizeof(struct kvm_debugregs))) break; r = kvm_vcpu_ioctl_x86_set_debugregs(vcpu, &dbgregs); break; } case KVM_GET_XSAVE: { u.xsave = kzalloc(sizeof(struct kvm_xsave), GFP_KERNEL); r = -ENOMEM; if (!u.xsave) break; kvm_vcpu_ioctl_x86_get_xsave(vcpu, u.xsave); r = -EFAULT; if (copy_to_user(argp, u.xsave, sizeof(struct kvm_xsave))) break; r = 0; break; } case KVM_SET_XSAVE: { u.xsave = memdup_user(argp, sizeof(*u.xsave)); if (IS_ERR(u.xsave)) { r = PTR_ERR(u.xsave); goto out; } r = kvm_vcpu_ioctl_x86_set_xsave(vcpu, u.xsave); break; } case KVM_GET_XCRS: { u.xcrs = kzalloc(sizeof(struct kvm_xcrs), GFP_KERNEL); r = -ENOMEM; if (!u.xcrs) break; kvm_vcpu_ioctl_x86_get_xcrs(vcpu, u.xcrs); r = -EFAULT; if (copy_to_user(argp, u.xcrs, sizeof(struct kvm_xcrs))) break; r = 0; break; } case KVM_SET_XCRS: { u.xcrs = memdup_user(argp, sizeof(*u.xcrs)); if (IS_ERR(u.xcrs)) { r = PTR_ERR(u.xcrs); goto out; } r = kvm_vcpu_ioctl_x86_set_xcrs(vcpu, u.xcrs); break; } case KVM_SET_TSC_KHZ: { u32 user_tsc_khz; r = -EINVAL; if (!kvm_has_tsc_control) break; user_tsc_khz = (u32)arg; if (user_tsc_khz >= kvm_max_guest_tsc_khz) goto out; kvm_x86_ops->set_tsc_khz(vcpu, user_tsc_khz); r = 0; goto out; } case KVM_GET_TSC_KHZ: { r = -EIO; if (check_tsc_unstable()) goto out; r = vcpu_tsc_khz(vcpu); goto out; } default: r = -EINVAL; } out: kfree(u.buffer); return r; } ",0 "static int hot_remove_disk(struct mddev *mddev, dev_t dev) { char b[BDEVNAME_SIZE]; struct md_rdev *rdev; rdev = find_rdev(mddev, dev); if (!rdev) return -ENXIO; if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_start(mddev); clear_bit(Blocked, &rdev->flags); remove_and_add_spares(mddev, rdev); if (rdev->raid_disk >= 0) goto busy; if (mddev_is_clustered(mddev)) md_cluster_ops->remove_disk(mddev, rdev); md_kick_rdev_from_array(rdev); md_update_sb(mddev, 1); md_new_event(mddev); if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_finish(mddev); return 0; busy: if (mddev_is_clustered(mddev)) md_cluster_ops->metadata_update_cancel(mddev); printk(KERN_WARNING ""md: cannot remove active disk %s from %s ...\n"", bdevname(rdev->bdev,b), mdname(mddev)); return -EBUSY; } ",0 "HTMLElement* HTMLInputElement::list() const { return DataList(); } ",0 "void __noreturn die(const char *str, struct pt_regs *regs) { static int die_counter; int sig = SIGSEGV; #ifdef CONFIG_MIPS_MT_SMTC unsigned long dvpret = dvpe(); #endif /* CONFIG_MIPS_MT_SMTC */ if (notify_die(DIE_OOPS, str, regs, 0, regs_to_trapnr(regs), SIGSEGV) == NOTIFY_STOP) sig = 0; console_verbose(); spin_lock_irq(&die_lock); bust_spinlocks(1); #ifdef CONFIG_MIPS_MT_SMTC mips_mt_regdump(dvpret); #endif /* CONFIG_MIPS_MT_SMTC */ printk(""%s[#%d]:\n"", str, ++die_counter); show_registers(regs); add_taint(TAINT_DIE); spin_unlock_irq(&die_lock); if (in_interrupt()) panic(""Fatal exception in interrupt""); if (panic_on_oops) { printk(KERN_EMERG ""Fatal exception: panic in 5 seconds\n""); ssleep(5); panic(""Fatal exception""); } do_exit(sig); } ",0 "static unsigned int udf_count_free(struct super_block *sb) { unsigned int accum = 0; struct udf_sb_info *sbi; struct udf_part_map *map; sbi = UDF_SB(sb); if (sbi->s_lvid_bh) { struct logicalVolIntegrityDesc *lvid = (struct logicalVolIntegrityDesc *) sbi->s_lvid_bh->b_data; if (le32_to_cpu(lvid->numOfPartitions) > sbi->s_partition) { accum = le32_to_cpu( lvid->freeSpaceTable[sbi->s_partition]); if (accum == 0xFFFFFFFF) accum = 0; } } if (accum) return accum; map = &sbi->s_partmaps[sbi->s_partition]; if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_BITMAP) { accum += udf_count_free_bitmap(sb, map->s_uspace.s_bitmap); } if (map->s_partition_flags & UDF_PART_FLAG_FREED_BITMAP) { accum += udf_count_free_bitmap(sb, map->s_fspace.s_bitmap); } if (accum) return accum; if (map->s_partition_flags & UDF_PART_FLAG_UNALLOC_TABLE) { accum += udf_count_free_table(sb, map->s_uspace.s_table); } if (map->s_partition_flags & UDF_PART_FLAG_FREED_TABLE) { accum += udf_count_free_table(sb, map->s_fspace.s_table); } return accum; } ",0 "void FrameLoader::prepareForCachedPageRestore() { ASSERT(!m_frame->tree()->parent()); ASSERT(m_frame->page()); ASSERT(m_frame->page()->mainFrame() == m_frame); m_frame->redirectScheduler()->cancel(); closeURL(); if (m_frame->script()->canExecuteScripts(NotAboutToExecuteScript)) { if (DOMWindow* window = m_frame->existingDOMWindow()) { window->setStatus(String()); window->setDefaultStatus(String()); } } } ",0 "mm_start_pam(Authctxt *authctxt) { Buffer m; debug3(""%s entering"", __func__); if (!options.use_pam) fatal(""UsePAM=no, but ended up in %s anyway"", __func__); buffer_init(&m); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_PAM_START, &m); buffer_free(&m); } ",0 " ShelfBackgroundType previous_background_type() const { return animator_->previous_background_type_; } ",0 "error::Error GLES2DecoderPassthroughImpl::DoUniform3fv( GLint location, GLsizei count, const volatile GLfloat* v) { api()->glUniform3fvFn(location, count, const_cast(v)); return error::kNoError; } ",0 "int Label::GetBaseline() { return GetInsets().top() + font_.GetBaseline(); } ",0 "int compat_udp_getsockopt(struct sock *sk, int level, int optname, char __user *optval, int __user *optlen) { if (level == SOL_UDP || level == SOL_UDPLITE) return udp_lib_getsockopt(sk, level, optname, optval, optlen); return compat_ip_getsockopt(sk, level, optname, optval, optlen); } ",0 "void t2p_read_tiff_init(T2P* t2p, TIFF* input){ tdir_t directorycount=0; tdir_t i=0; uint16 pagen=0; uint16 paged=0; uint16 xuint16=0; directorycount=TIFFNumberOfDirectories(input); t2p->tiff_pages = (T2P_PAGE*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,directorycount,sizeof(T2P_PAGE))); if(t2p->tiff_pages==NULL){ TIFFError( TIFF2PDF_MODULE, ""Can't allocate "" TIFF_SIZE_FORMAT "" bytes of memory for tiff_pages array, %s"", (TIFF_SIZE_T) directorycount * sizeof(T2P_PAGE), TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } _TIFFmemset( t2p->tiff_pages, 0x00, directorycount * sizeof(T2P_PAGE)); t2p->tiff_tiles = (T2P_TILES*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,directorycount,sizeof(T2P_TILES))); if(t2p->tiff_tiles==NULL){ TIFFError( TIFF2PDF_MODULE, ""Can't allocate "" TIFF_SIZE_FORMAT "" bytes of memory for tiff_tiles array, %s"", (TIFF_SIZE_T) directorycount * sizeof(T2P_TILES), TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } _TIFFmemset( t2p->tiff_tiles, 0x00, directorycount * sizeof(T2P_TILES)); for(i=0;it2p_error = T2P_ERR_ERROR; return; } if(TIFFGetField(input, TIFFTAG_PAGENUMBER, &pagen, &paged)){ if((pagen>paged) && (paged != 0)){ t2p->tiff_pages[t2p->tiff_pagecount].page_number = paged; } else { t2p->tiff_pages[t2p->tiff_pagecount].page_number = pagen; } goto ispage2; } if(TIFFGetField(input, TIFFTAG_SUBFILETYPE, &subfiletype)){ if ( ((subfiletype & FILETYPE_PAGE) != 0) || (subfiletype == 0)){ goto ispage; } else { goto isnotpage; } } if(TIFFGetField(input, TIFFTAG_OSUBFILETYPE, &subfiletype)){ if ((subfiletype == OFILETYPE_IMAGE) || (subfiletype == OFILETYPE_PAGE) || (subfiletype == 0) ){ goto ispage; } else { goto isnotpage; } } ispage: t2p->tiff_pages[t2p->tiff_pagecount].page_number=t2p->tiff_pagecount; ispage2: t2p->tiff_pages[t2p->tiff_pagecount].page_directory=i; if(TIFFIsTiled(input)){ t2p->tiff_pages[t2p->tiff_pagecount].page_tilecount = TIFFNumberOfTiles(input); } t2p->tiff_pagecount++; isnotpage: (void)0; } qsort((void*) t2p->tiff_pages, t2p->tiff_pagecount, sizeof(T2P_PAGE), t2p_cmp_t2p_page); for(i=0;itiff_pagecount;i++){ t2p->pdf_xrefcount += 5; TIFFSetDirectory(input, t2p->tiff_pages[i].page_directory ); if((TIFFGetField(input, TIFFTAG_PHOTOMETRIC, &xuint16) && (xuint16==PHOTOMETRIC_PALETTE)) || TIFFGetField(input, TIFFTAG_INDEXED, &xuint16)) { t2p->tiff_pages[i].page_extra++; t2p->pdf_xrefcount++; } #ifdef ZIP_SUPPORT if (TIFFGetField(input, TIFFTAG_COMPRESSION, &xuint16)) { if( (xuint16== COMPRESSION_DEFLATE || xuint16== COMPRESSION_ADOBE_DEFLATE) && ((t2p->tiff_pages[i].page_tilecount != 0) || TIFFNumberOfStrips(input)==1) && (t2p->pdf_nopassthrough==0) ){ if(t2p->pdf_minorversion<2){t2p->pdf_minorversion=2;} } } #endif if (TIFFGetField(input, TIFFTAG_TRANSFERFUNCTION, &(t2p->tiff_transferfunction[0]), &(t2p->tiff_transferfunction[1]), &(t2p->tiff_transferfunction[2]))) { if((t2p->tiff_transferfunction[1] != (float*) NULL) && (t2p->tiff_transferfunction[2] != (float*) NULL) && (t2p->tiff_transferfunction[1] != t2p->tiff_transferfunction[0])) { t2p->tiff_transferfunctioncount = 3; t2p->tiff_pages[i].page_extra += 4; t2p->pdf_xrefcount += 4; } else { t2p->tiff_transferfunctioncount = 1; t2p->tiff_pages[i].page_extra += 2; t2p->pdf_xrefcount += 2; } if(t2p->pdf_minorversion < 2) t2p->pdf_minorversion = 2; } else { t2p->tiff_transferfunctioncount=0; } if( TIFFGetField( input, TIFFTAG_ICCPROFILE, &(t2p->tiff_iccprofilelength), &(t2p->tiff_iccprofile)) != 0){ t2p->tiff_pages[i].page_extra++; t2p->pdf_xrefcount++; if(t2p->pdf_minorversion<3){t2p->pdf_minorversion=3;} } t2p->tiff_tiles[i].tiles_tilecount= t2p->tiff_pages[i].page_tilecount; if( (TIFFGetField(input, TIFFTAG_PLANARCONFIG, &xuint16) != 0) && (xuint16 == PLANARCONFIG_SEPARATE ) ){ if( !TIFFGetField(input, TIFFTAG_SAMPLESPERPIXEL, &xuint16) ) { TIFFError( TIFF2PDF_MODULE, ""Missing SamplesPerPixel, %s"", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } if( (t2p->tiff_tiles[i].tiles_tilecount % xuint16) != 0 ) { TIFFError( TIFF2PDF_MODULE, ""Invalid tile count, %s"", TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } t2p->tiff_tiles[i].tiles_tilecount/= xuint16; } if( t2p->tiff_tiles[i].tiles_tilecount > 0){ t2p->pdf_xrefcount += (t2p->tiff_tiles[i].tiles_tilecount -1)*2; TIFFGetField(input, TIFFTAG_TILEWIDTH, &( t2p->tiff_tiles[i].tiles_tilewidth) ); TIFFGetField(input, TIFFTAG_TILELENGTH, &( t2p->tiff_tiles[i].tiles_tilelength) ); t2p->tiff_tiles[i].tiles_tiles = (T2P_TILE*) _TIFFmalloc(TIFFSafeMultiply(tmsize_t,t2p->tiff_tiles[i].tiles_tilecount, sizeof(T2P_TILE)) ); if( t2p->tiff_tiles[i].tiles_tiles == NULL){ TIFFError( TIFF2PDF_MODULE, ""Can't allocate "" TIFF_SIZE_FORMAT "" bytes of memory for t2p_read_tiff_init, %s"", (TIFF_SIZE_T) t2p->tiff_tiles[i].tiles_tilecount * sizeof(T2P_TILE), TIFFFileName(input)); t2p->t2p_error = T2P_ERR_ERROR; return; } } } return; } ",0 "static Image *SparseColorOption(const Image *image,const ChannelType channel, const SparseColorMethod method,const char *arguments, const MagickBooleanType color_from_image,ExceptionInfo *exception) { ChannelType channels; char token[MaxTextExtent]; const char *p; double *sparse_arguments; Image *sparse_image; MagickBooleanType error; MagickPixelPacket color; register size_t x; size_t number_arguments, number_colors; /* SparseColorOption() parses the complex -sparse-color argument into an an array of floating point values then calls SparseColorImage(). Argument is a complex mix of floating-point pixel coodinates, and color specifications (or direct floating point numbers). The number of floats needed to represent a color varies depending on the current channel setting. */ 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); /* Limit channels according to image - and add up number of color channel. */ channels=channel; if (image->colorspace != CMYKColorspace) channels=(ChannelType) (channels & ~IndexChannel); /* no index channel */ if (image->matte == MagickFalse) channels=(ChannelType) (channels & ~OpacityChannel); /* no alpha channel */ number_colors=0; if ((channels & RedChannel) != 0) number_colors++; if ((channels & GreenChannel) != 0) number_colors++; if ((channels & BlueChannel) != 0) number_colors++; if ((channels & IndexChannel) != 0) number_colors++; if ((channels & OpacityChannel) != 0) number_colors++; /* Read string, to determine number of arguments needed, */ p=arguments; x=0; while( *p != '\0' ) { GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == ',' ) continue; if ( isalpha((int) token[0]) || token[0] == '#' ) { if ( color_from_image ) { (void) ThrowMagickException(exception,GetMagickModule(), OptionError, ""InvalidArgument"", ""`%s': %s"", ""sparse-color"", ""Color arg given, when colors are coming from image""); return( (Image *) NULL); } x += number_colors; /* color argument */ } else { x++; /* floating point argument */ } } error=MagickTrue; if ( color_from_image ) { /* just the control points are being given */ error = ( x % 2 != 0 ) ? MagickTrue : MagickFalse; number_arguments=(x/2)*(2+number_colors); } else { /* control points and color values */ error = ( x % (2+number_colors) != 0 ) ? MagickTrue : MagickFalse; number_arguments=x; } if ( error ) { (void) ThrowMagickException(exception,GetMagickModule(), OptionError, ""InvalidArgument"", ""`%s': %s"", ""sparse-color"", ""Invalid number of Arguments""); return( (Image *) NULL); } /* Allocate and fill in the floating point arguments */ sparse_arguments=(double *) AcquireQuantumMemory(number_arguments, sizeof(*sparse_arguments)); if (sparse_arguments == (double *) NULL) { (void) ThrowMagickException(exception,GetMagickModule(),ResourceLimitError, "" MemoryAllocationFailed\n""""%s"",""SparseColorOption""); return( (Image *) NULL); } (void) memset(sparse_arguments,0,number_arguments* sizeof(*sparse_arguments)); p=arguments; x=0; while( *p != '\0' && x < number_arguments ) { /* X coordinate */ token[0]=','; while ( token[0] == ',' ) GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == '\0' ) break; if ( isalpha((int) token[0]) || token[0] == '#' ) { (void) ThrowMagickException(exception,GetMagickModule(), OptionError, ""InvalidArgument"", ""`%s': %s"", ""sparse-color"", ""Color found, instead of X-coord""); error = MagickTrue; break; } sparse_arguments[x++]=StringToDouble(token,(char **) NULL); /* Y coordinate */ token[0]=','; while ( token[0] == ',' ) GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == '\0' ) break; if ( isalpha((int) token[0]) || token[0] == '#' ) { (void) ThrowMagickException(exception,GetMagickModule(), OptionError, ""InvalidArgument"", ""`%s': %s"", ""sparse-color"", ""Color found, instead of Y-coord""); error = MagickTrue; break; } sparse_arguments[x++]=StringToDouble(token,(char **) NULL); /* color values for this control point */ #if 0 if ( (color_from_image ) { /* get color from image */ /* HOW??? */ } else #endif { /* color name or function given in string argument */ token[0]=','; while ( token[0] == ',' ) GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == '\0' ) break; if ( isalpha((int) token[0]) || token[0] == '#' ) { /* Color string given */ (void) QueryMagickColor(token,&color,exception); if ( channels & RedChannel ) sparse_arguments[x++] = QuantumScale*color.red; if ( channels & GreenChannel ) sparse_arguments[x++] = QuantumScale*color.green; if ( channels & BlueChannel ) sparse_arguments[x++] = QuantumScale*color.blue; if ( channels & IndexChannel ) sparse_arguments[x++] = QuantumScale*color.index; if ( channels & OpacityChannel ) sparse_arguments[x++] = QuantumScale*color.opacity; } else { /* Colors given as a set of floating point values - experimental */ /* NB: token contains the first floating point value to use! */ if ( channels & RedChannel ) { while ( token[0] == ',' ) GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if ( channels & GreenChannel ) { while ( token[0] == ',' ) GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if ( channels & BlueChannel ) { while ( token[0] == ',' ) GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if ( channels & IndexChannel ) { while ( token[0] == ',' ) GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } if ( channels & OpacityChannel ) { while ( token[0] == ',' ) GetNextToken(p,&p,MaxTextExtent,token); if ( token[0] == '\0' || isalpha((int)token[0]) || token[0] == '#' ) break; sparse_arguments[x++]=StringToDouble(token,(char **) NULL); token[0] = ','; /* used this token - get another */ } } } } if ( number_arguments != x && !error ) { (void) ThrowMagickException(exception,GetMagickModule(),OptionError, "" InvalidArgument"",""`%s': %s"",""sparse-color"",""Argument Parsing Error""); sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments); return( (Image *) NULL); } if ( error ) return( (Image *) NULL); /* Call the Interpolation function with the parsed arguments */ sparse_image=SparseColorImage(image,channels,method,number_arguments, sparse_arguments,exception); sparse_arguments=(double *) RelinquishMagickMemory(sparse_arguments); return( sparse_image ); } ",0 "static void ReportToUMA(VAVDADecoderFailure failure) { UMA_HISTOGRAM_ENUMERATION(""Media.VAVDA.DecoderFailure"", failure, VAVDA_DECODER_FAILURES_MAX); } ",0 "begin_softmask(fz_context *ctx, pdf_run_processor *pr, softmask_save *save) { pdf_gstate *gstate = pr->gstate + pr->gtop; pdf_xobject *softmask = gstate->softmask; fz_rect mask_bbox; fz_matrix tos_save[2], save_ctm; fz_matrix mask_matrix; fz_colorspace *mask_colorspace; save->softmask = softmask; if (softmask == NULL) return gstate; save->page_resources = gstate->softmask_resources; save->ctm = gstate->softmask_ctm; save_ctm = gstate->ctm; pdf_xobject_bbox(ctx, softmask, &mask_bbox); pdf_xobject_matrix(ctx, softmask, &mask_matrix); pdf_tos_save(ctx, &pr->tos, tos_save); if (gstate->luminosity) mask_bbox = fz_infinite_rect; else { fz_transform_rect(&mask_bbox, &mask_matrix); fz_transform_rect(&mask_bbox, &gstate->softmask_ctm); } gstate->softmask = NULL; gstate->softmask_resources = NULL; gstate->ctm = gstate->softmask_ctm; mask_colorspace = pdf_xobject_colorspace(ctx, softmask); if (gstate->luminosity && !mask_colorspace) mask_colorspace = fz_keep_colorspace(ctx, fz_device_gray(ctx)); fz_try(ctx) { fz_begin_mask(ctx, pr->dev, &mask_bbox, gstate->luminosity, mask_colorspace, gstate->softmask_bc, &gstate->fill.color_params); pdf_run_xobject(ctx, pr, softmask, save->page_resources, &fz_identity, 1); } fz_always(ctx) fz_drop_colorspace(ctx, mask_colorspace); fz_catch(ctx) { fz_rethrow_if(ctx, FZ_ERROR_TRYLATER); /* FIXME: Ignore error - nasty, but if we throw from * here the clip stack would be messed up. */ /* TODO: pass cookie here to increase the cookie error count */ } fz_end_mask(ctx, pr->dev); pdf_tos_restore(ctx, &pr->tos, tos_save); gstate = pr->gstate + pr->gtop; gstate->ctm = save_ctm; return gstate; } ",0 "xdr_krb5_deltat(XDR *xdrs, krb5_deltat *objp) { /* This assumes that int32 and krb5_deltat are the same size. This shouldn't be a problem, since we've got a unit test which checks for this. */ if (!xdr_int32(xdrs, (int32_t *) objp)) { return (FALSE); } return (TRUE); } ",0 "PageLoadTracker* MetricsWebContentsObserver::GetTrackerOrNullForRequest( const content::GlobalRequestID& request_id, content::RenderFrameHost* render_frame_host_or_null, content::ResourceType resource_type, base::TimeTicks creation_time) { if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { DCHECK(request_id != content::GlobalRequestID()); for (const auto& kv : provisional_loads_) { PageLoadTracker* candidate = kv.second.get(); if (candidate->HasMatchingNavigationRequestID(request_id)) { return candidate; } } if (committed_load_ && committed_load_->HasMatchingNavigationRequestID(request_id)) { return committed_load_.get(); } } else { if (!committed_load_ || creation_time < committed_load_->navigation_start()) return nullptr; if (resource_type == content::RESOURCE_TYPE_SUB_FRAME) return committed_load_.get(); if (!render_frame_host_or_null) return nullptr; content::RenderFrameHost* main_frame_for_resource = GetMainFrame(render_frame_host_or_null); if (main_frame_for_resource == web_contents()->GetMainFrame()) return committed_load_.get(); } return nullptr; } ",0 "static int sha224_sparc64_init(struct shash_desc *desc) { struct sha256_state *sctx = shash_desc_ctx(desc); sctx->state[0] = SHA224_H0; sctx->state[1] = SHA224_H1; sctx->state[2] = SHA224_H2; sctx->state[3] = SHA224_H3; sctx->state[4] = SHA224_H4; sctx->state[5] = SHA224_H5; sctx->state[6] = SHA224_H6; sctx->state[7] = SHA224_H7; sctx->count = 0; return 0; } ",0 "WORK_STATE tls_prepare_client_certificate(SSL *s, WORK_STATE wst) { X509 *x509 = NULL; EVP_PKEY *pkey = NULL; int i; if (wst == WORK_MORE_A) { /* Let cert callback update client certificates if required */ if (s->cert->cert_cb) { i = s->cert->cert_cb(s, s->cert->cert_cb_arg); if (i < 0) { s->rwstate = SSL_X509_LOOKUP; return WORK_MORE_A; } if (i == 0) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); ossl_statem_set_error(s); return 0; } s->rwstate = SSL_NOTHING; } if (ssl3_check_client_certificate(s)) return WORK_FINISHED_CONTINUE; /* Fall through to WORK_MORE_B */ wst = WORK_MORE_B; } /* We need to get a client cert */ if (wst == WORK_MORE_B) { /* * If we get an error, we need to ssl->rwstate=SSL_X509_LOOKUP; * return(-1); We then get retied later */ i = ssl_do_client_cert_cb(s, &x509, &pkey); if (i < 0) { s->rwstate = SSL_X509_LOOKUP; return WORK_MORE_B; } s->rwstate = SSL_NOTHING; if ((i == 1) && (pkey != NULL) && (x509 != NULL)) { if (!SSL_use_certificate(s, x509) || !SSL_use_PrivateKey(s, pkey)) i = 0; } else if (i == 1) { i = 0; SSLerr(SSL_F_TLS_PREPARE_CLIENT_CERTIFICATE, SSL_R_BAD_DATA_RETURNED_BY_CALLBACK); } X509_free(x509); EVP_PKEY_free(pkey); if (i && !ssl3_check_client_certificate(s)) i = 0; if (i == 0) { if (s->version == SSL3_VERSION) { s->s3->tmp.cert_req = 0; ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_NO_CERTIFICATE); return WORK_FINISHED_CONTINUE; } else { s->s3->tmp.cert_req = 2; if (!ssl3_digest_cached_records(s, 0)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); ossl_statem_set_error(s); return 0; } } } return WORK_FINISHED_CONTINUE; } /* Shouldn't ever get here */ return WORK_ERROR; } ",0 "static void fb_set_logo_truepalette(struct fb_info *info, const struct linux_logo *logo, u32 *palette) { static const unsigned char mask[] = { 0,0x80,0xc0,0xe0,0xf0,0xf8,0xfc,0xfe,0xff }; unsigned char redmask, greenmask, bluemask; int redshift, greenshift, blueshift; int i; const unsigned char *clut = logo->clut; /* * We have to create a temporary palette since console palette is only * 16 colors long. */ /* Bug: Doesn't obey msb_right ... (who needs that?) */ redmask = mask[info->var.red.length < 8 ? info->var.red.length : 8]; greenmask = mask[info->var.green.length < 8 ? info->var.green.length : 8]; bluemask = mask[info->var.blue.length < 8 ? info->var.blue.length : 8]; redshift = info->var.red.offset - (8 - info->var.red.length); greenshift = info->var.green.offset - (8 - info->var.green.length); blueshift = info->var.blue.offset - (8 - info->var.blue.length); for ( i = 0; i < logo->clutsize; i++) { palette[i+32] = (safe_shift((clut[0] & redmask), redshift) | safe_shift((clut[1] & greenmask), greenshift) | safe_shift((clut[2] & bluemask), blueshift)); clut += 3; } } ",0 "void JSSharedWorker::visitChildren(JSCell* cell, SlotVisitor& visitor) { JSSharedWorker* thisObject = jsCast(cell); ASSERT_GC_OBJECT_INHERITS(thisObject, &s_info); COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag); ASSERT(thisObject->structure()->typeInfo().overridesVisitChildren()); Base::visitChildren(thisObject, visitor); if (MessagePort* port = thisObject->impl()->port()) visitor.addOpaqueRoot(port); } ",0 "PrintWebViewHelper::PrintWebViewHelper(content::RenderView* render_view, scoped_ptr delegate) : content::RenderViewObserver(render_view), content::RenderViewObserverTracker(render_view), reset_prep_frame_view_(false), is_print_ready_metafile_sent_(false), ignore_css_margins_(false), is_scripted_printing_blocked_(false), notify_browser_of_print_failure_(true), print_for_preview_(false), delegate_(delegate.Pass()), print_node_in_progress_(false), is_loading_(false), is_scripted_preview_delayed_(false), weak_ptr_factory_(this) { if (!delegate_->IsPrintPreviewEnabled()) DisablePreview(); } ",1 "error::Error GLES2DecoderPassthroughImpl::DoVertexAttribDivisorANGLE( GLuint index, GLuint divisor) { api()->glVertexAttribDivisorANGLEFn(index, divisor); return error::kNoError; } ",0 "void *copy_mount_options(const void __user * data) { int i; unsigned long size; char *copy; if (!data) return NULL; copy = kmalloc(PAGE_SIZE, GFP_KERNEL); if (!copy) return ERR_PTR(-ENOMEM); /* We only care that *some* data at the address the user * gave us is valid. Just in case, we'll zero * the remainder of the page. */ /* copy_from_user cannot cross TASK_SIZE ! */ size = TASK_SIZE - (unsigned long)data; if (size > PAGE_SIZE) size = PAGE_SIZE; i = size - exact_copy_from_user(copy, data, size); if (!i) { kfree(copy); return ERR_PTR(-EFAULT); } if (i != PAGE_SIZE) memset(copy + i, 0, PAGE_SIZE - i); return copy; } ",0 "void IndexedDBDatabase::Commit(IndexedDBTransaction* transaction) { if (transaction) { scoped_refptr factory = factory_; Status result = transaction->Commit(); if (!result.ok()) ReportError(result); } } ",0 "static int create_auto_midi_quirk(struct snd_usb_audio *chip, struct usb_interface *iface, struct usb_driver *driver) { struct usb_host_interface *alts; struct usb_interface_descriptor *altsd; struct usb_endpoint_descriptor *epd; int err; alts = &iface->altsetting[0]; altsd = get_iface_desc(alts); /* must have at least one bulk/interrupt endpoint for streaming */ if (altsd->bNumEndpoints < 1) return -ENODEV; epd = get_endpoint(alts, 0); if (!usb_endpoint_xfer_bulk(epd) && !usb_endpoint_xfer_int(epd)) return -ENODEV; switch (USB_ID_VENDOR(chip->usb_id)) { case 0x0499: /* Yamaha */ err = create_yamaha_midi_quirk(chip, iface, driver, alts); if (err != -ENODEV) return err; break; case 0x0582: /* Roland */ err = create_roland_midi_quirk(chip, iface, driver, alts); if (err != -ENODEV) return err; break; } return create_std_midi_quirk(chip, iface, driver, alts); } ",0 "MagickExport Image *DisposeImages(const Image *images,ExceptionInfo *exception) { Image *dispose_image, *dispose_images; RectangleInfo bounds; register Image *image, *next; /* Run the image through the animation sequence */ assert(images != (Image *) NULL); assert(images->signature == MagickCoreSignature); if (images->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",images->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); image=GetFirstImageInList(images); dispose_image=CloneImage(image,image->page.width,image->page.height, MagickTrue,exception); if (dispose_image == (Image *) NULL) return((Image *) NULL); dispose_image->page=image->page; dispose_image->page.x=0; dispose_image->page.y=0; dispose_image->dispose=NoneDispose; dispose_image->background_color.alpha=(MagickRealType) TransparentAlpha; (void) SetImageBackgroundColor(dispose_image,exception); dispose_images=NewImageList(); for (next=image; image != (Image *) NULL; image=GetNextImageInList(image)) { Image *current_image; /* Overlay this frame's image over the previous disposal image. */ current_image=CloneImage(dispose_image,0,0,MagickTrue,exception); if (current_image == (Image *) NULL) { dispose_images=DestroyImageList(dispose_images); dispose_image=DestroyImage(dispose_image); return((Image *) NULL); } (void) CompositeImage(current_image,next, next->alpha_trait != UndefinedPixelTrait ? OverCompositeOp : CopyCompositeOp, MagickTrue,next->page.x,next->page.y,exception); /* Handle Background dispose: image is displayed for the delay period. */ if (next->dispose == BackgroundDispose) { bounds=next->page; bounds.width=next->columns; bounds.height=next->rows; if (bounds.x < 0) { bounds.width+=bounds.x; bounds.x=0; } if ((ssize_t) (bounds.x+bounds.width) > (ssize_t) current_image->columns) bounds.width=current_image->columns-bounds.x; if (bounds.y < 0) { bounds.height+=bounds.y; bounds.y=0; } if ((ssize_t) (bounds.y+bounds.height) > (ssize_t) current_image->rows) bounds.height=current_image->rows-bounds.y; ClearBounds(current_image,&bounds,exception); } /* Select the appropriate previous/disposed image. */ if (next->dispose == PreviousDispose) current_image=DestroyImage(current_image); else { dispose_image=DestroyImage(dispose_image); dispose_image=current_image; current_image=(Image *) NULL; } /* Save the dispose image just calculated for return. */ { Image *dispose; dispose=CloneImage(dispose_image,0,0,MagickTrue,exception); if (dispose == (Image *) NULL) { dispose_images=DestroyImageList(dispose_images); dispose_image=DestroyImage(dispose_image); return((Image *) NULL); } (void) CloneImageProfiles(dispose,next); (void) CloneImageProperties(dispose,next); (void) CloneImageArtifacts(dispose,next); dispose->page.x=0; dispose->page.y=0; dispose->dispose=next->dispose; AppendImageToList(&dispose_images,dispose); } } dispose_image=DestroyImage(dispose_image); return(GetFirstImageInList(dispose_images)); } ",0 "const char* MACH0_(get_os)(struct MACH0_(obj_t)* bin) { if (bin) switch (bin->os) { case 1: return ""osx""; case 2: return ""ios""; case 3: return ""watchos""; case 4: return ""tvos""; } return ""darwin""; } ",0 " void InspectorPageAgent::setContinuousPaintingEnabled(ErrorString*, bool enabled) { bool viewMetricsOverride = m_state->getLong(PageAgentState::pageAgentScreenWidthOverride); m_state->setBoolean(PageAgentState::pageAgentContinuousPaintingEnabled, enabled); m_client->setContinuousPaintingEnabled(enabled && !viewMetricsOverride); updateOverridesTopOffset(); } ",1 "static future_t *clean_up(void) { gki_buffer_cleanup(); pthread_mutex_destroy(&gki_cb.lock); return NULL; } ",0 "static RGBA32 parseColorStringWithCrazyLegacyRules(const String& colorString) { const size_t maxColorLength = 128; Vector digitBuffer; size_t i = 0; if (colorString[0] == '#') i = 1; for (; i < colorString.length() && digitBuffer.size() < maxColorLength; i++) { if (!isASCIIHexDigit(colorString[i])) digitBuffer.append('0'); else digitBuffer.append(colorString[i]); } if (!digitBuffer.size()) return Color::black; digitBuffer.append('0'); digitBuffer.append('0'); if (digitBuffer.size() < 6) return makeRGB(toASCIIHexValue(digitBuffer[0]), toASCIIHexValue(digitBuffer[1]), toASCIIHexValue(digitBuffer[2])); ASSERT(digitBuffer.size() >= 6); size_t componentLength = digitBuffer.size() / 3; size_t componentSearchWindowLength = min(componentLength, 8); size_t redIndex = componentLength - componentSearchWindowLength; size_t greenIndex = componentLength * 2 - componentSearchWindowLength; size_t blueIndex = componentLength * 3 - componentSearchWindowLength; while (digitBuffer[redIndex] == '0' && digitBuffer[greenIndex] == '0' && digitBuffer[blueIndex] == '0' && (componentLength - redIndex) > 2) { redIndex++; greenIndex++; blueIndex++; } ASSERT(redIndex + 1 < componentLength); ASSERT(greenIndex >= componentLength); ASSERT(greenIndex + 1 < componentLength * 2); ASSERT(blueIndex >= componentLength * 2); ASSERT(blueIndex + 1 < digitBuffer.size()); int redValue = toASCIIHexValue(digitBuffer[redIndex], digitBuffer[redIndex + 1]); int greenValue = toASCIIHexValue(digitBuffer[greenIndex], digitBuffer[greenIndex + 1]); int blueValue = toASCIIHexValue(digitBuffer[blueIndex], digitBuffer[blueIndex + 1]); return makeRGB(redValue, greenValue, blueValue); } ",0 "COMPAT_SYSCALL_DEFINE3(sigprocmask, int, how, compat_old_sigset_t __user *, nset, compat_old_sigset_t __user *, oset) { old_sigset_t old_set, new_set; sigset_t new_blocked; old_set = current->blocked.sig[0]; if (nset) { if (get_user(new_set, nset)) return -EFAULT; new_set &= ~(sigmask(SIGKILL) | sigmask(SIGSTOP)); new_blocked = current->blocked; switch (how) { case SIG_BLOCK: sigaddsetmask(&new_blocked, new_set); break; case SIG_UNBLOCK: sigdelsetmask(&new_blocked, new_set); break; case SIG_SETMASK: compat_sig_setmask(&new_blocked, new_set); break; default: return -EINVAL; } set_current_blocked(&new_blocked); } if (oset) { if (put_user(old_set, oset)) return -EFAULT; } return 0; } ",0 "bool ImageBitmap::isResizeOptionValid(const ImageBitmapOptions& options, ExceptionState& exceptionState) { if ((options.hasResizeWidth() && options.resizeWidth() == 0) || (options.hasResizeHeight() && options.resizeHeight() == 0)) { exceptionState.throwDOMException( InvalidStateError, ""The resizeWidth or/and resizeHeight is equal to 0.""); return false; } return true; } ",0 "void DefaultBindingsDelegate::OpenInNewTab(const std::string& url) { content::OpenURLParams params(GURL(url), content::Referrer(), WindowOpenDisposition::NEW_FOREGROUND_TAB, ui::PAGE_TRANSITION_LINK, false); Browser* browser = FindBrowser(web_contents_); browser->OpenURL(params); } ",0 "void ATSParser::parseProgramAssociationTable(ABitReader *br) { unsigned table_id = br->getBits(8); ALOGV("" table_id = %u"", table_id); if (table_id != 0x00u) { ALOGE(""PAT data error!""); return ; } unsigned section_syntax_indictor = br->getBits(1); ALOGV("" section_syntax_indictor = %u"", section_syntax_indictor); br->skipBits(1); // '0' MY_LOGV("" reserved = %u"", br->getBits(2)); unsigned section_length = br->getBits(12); ALOGV("" section_length = %u"", section_length); MY_LOGV("" transport_stream_id = %u"", br->getBits(16)); MY_LOGV("" reserved = %u"", br->getBits(2)); MY_LOGV("" version_number = %u"", br->getBits(5)); MY_LOGV("" current_next_indicator = %u"", br->getBits(1)); MY_LOGV("" section_number = %u"", br->getBits(8)); MY_LOGV("" last_section_number = %u"", br->getBits(8)); size_t numProgramBytes = (section_length - 5 /* header */ - 4 /* crc */); for (size_t i = 0; i < numProgramBytes / 4; ++i) { unsigned program_number = br->getBits(16); ALOGV("" program_number = %u"", program_number); MY_LOGV("" reserved = %u"", br->getBits(3)); if (program_number == 0) { MY_LOGV("" network_PID = 0x%04x"", br->getBits(13)); } else { unsigned programMapPID = br->getBits(13); ALOGV("" program_map_PID = 0x%04x"", programMapPID); bool found = false; for (size_t index = 0; index < mPrograms.size(); ++index) { const sp &program = mPrograms.itemAt(index); if (program->number() == program_number) { program->updateProgramMapPID(programMapPID); found = true; break; } } if (!found) { mPrograms.push( new Program(this, program_number, programMapPID, mLastRecoveredPTS)); } if (mPSISections.indexOfKey(programMapPID) < 0) { mPSISections.add(programMapPID, new PSISection); } } } MY_LOGV("" CRC = 0x%08x"", br->getBits(32)); } ",0 " ClearReportingCacheTester(TestingProfile* profile, bool create_service) : profile_(profile) { if (create_service) service_ = std::make_unique(); net::URLRequestContext* request_context = profile_->GetRequestContext()->GetURLRequestContext(); old_service_ = request_context->reporting_service(); request_context->set_reporting_service(service_.get()); } ",0 "MIMETypeRegistry::SupportsType HTMLMediaElement::GetSupportsType( const ContentType& content_type) { DEFINE_STATIC_LOCAL(const String, codecs, (""codecs"")); static base::debug::CrashKeyString* content_type_crash_key = base::debug::AllocateCrashKeyString(""media_content_type"", base::debug::CrashKeySize::Size256); base::debug::ScopedCrashKeyString scoped_crash_key( content_type_crash_key, content_type.Raw().Utf8().data()); String type = content_type.GetType().DeprecatedLower(); String type_codecs = content_type.Parameter(codecs); if (type.IsEmpty()) return MIMETypeRegistry::kIsNotSupported; if (type == ""application/octet-stream"") return MIMETypeRegistry::kIsNotSupported; MIMETypeRegistry::SupportsType result = MIMETypeRegistry::SupportsMediaMIMEType(type, type_codecs); ReportContentTypeResultToUMA(content_type.Raw(), result); return result; } ",0 "static int nfs4_write_done_cb(struct rpc_task *task, struct nfs_pgio_header *hdr) { struct inode *inode = hdr->inode; trace_nfs4_write(hdr, task->tk_status); if (nfs4_async_handle_error(task, NFS_SERVER(inode), hdr->args.context->state, NULL) == -EAGAIN) { rpc_restart_call_prepare(task); return -EAGAIN; } if (task->tk_status >= 0) { renew_lease(NFS_SERVER(inode), hdr->timestamp); nfs_writeback_update_inode(hdr); } return 0; } ",0 "void __bin2hex(char *s, const unsigned char *p, size_t len) { int i; static const char hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'}; for (i = 0; i < (int)len; i++) { *s++ = hex[p[i] >> 4]; *s++ = hex[p[i] & 0xF]; } *s++ = '\0'; } ",0 "void Document::PluginLoadingTimerFired(TimerBase*) { UpdateStyleAndLayout(); } ",0 "SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags) { return do_pipe2(fildes, flags); } ",0 "void jspSetNoExecute() { execInfo.execute = (execInfo.execute & (JsExecFlags)(int)~EXEC_RUN_MASK) | EXEC_NO; } ",0 "xmlDocPtr XSLStyleSheet::document() { if (m_embedded && ownerDocument() && ownerDocument()->transformSource()) return (xmlDocPtr)ownerDocument()->transformSource()->platformSource(); return m_stylesheetDoc; } ",0 "ofproto_rule_ref(struct rule *rule) { if (rule) { ovs_refcount_ref(&rule->ref_count); } } ",0 "PHP_MINFO_FUNCTION(gd) { php_info_print_table_start(); php_info_print_table_row(2, ""GD Support"", ""enabled""); /* need to use a PHPAPI function here because it is external module in windows */ #if defined(HAVE_GD_BUNDLED) php_info_print_table_row(2, ""GD Version"", PHP_GD_VERSION_STRING); #else php_info_print_table_row(2, ""GD headers Version"", PHP_GD_VERSION_STRING); #if defined(HAVE_GD_LIBVERSION) php_info_print_table_row(2, ""GD library Version"", gdVersionString()); #endif #endif #ifdef ENABLE_GD_TTF php_info_print_table_row(2, ""FreeType Support"", ""enabled""); #if HAVE_LIBFREETYPE php_info_print_table_row(2, ""FreeType Linkage"", ""with freetype""); { char tmp[256]; #ifdef FREETYPE_PATCH snprintf(tmp, sizeof(tmp), ""%d.%d.%d"", FREETYPE_MAJOR, FREETYPE_MINOR, FREETYPE_PATCH); #elif defined(FREETYPE_MAJOR) snprintf(tmp, sizeof(tmp), ""%d.%d"", FREETYPE_MAJOR, FREETYPE_MINOR); #else snprintf(tmp, sizeof(tmp), ""1.x""); #endif php_info_print_table_row(2, ""FreeType Version"", tmp); } #else php_info_print_table_row(2, ""FreeType Linkage"", ""with unknown library""); #endif #endif #ifdef HAVE_LIBT1 php_info_print_table_row(2, ""T1Lib Support"", ""enabled""); #endif php_info_print_table_row(2, ""GIF Read Support"", ""enabled""); php_info_print_table_row(2, ""GIF Create Support"", ""enabled""); #ifdef HAVE_GD_JPG { php_info_print_table_row(2, ""JPEG Support"", ""enabled""); php_info_print_table_row(2, ""libJPEG Version"", gdJpegGetVersionString()); } #endif #ifdef HAVE_GD_PNG php_info_print_table_row(2, ""PNG Support"", ""enabled""); php_info_print_table_row(2, ""libPNG Version"", gdPngGetVersionString()); #endif php_info_print_table_row(2, ""WBMP Support"", ""enabled""); #if defined(HAVE_GD_XPM) php_info_print_table_row(2, ""XPM Support"", ""enabled""); { char tmp[12]; snprintf(tmp, sizeof(tmp), ""%d"", XpmLibraryVersion()); php_info_print_table_row(2, ""libXpm Version"", tmp); } #endif php_info_print_table_row(2, ""XBM Support"", ""enabled""); #if defined(USE_GD_JISX0208) php_info_print_table_row(2, ""JIS-mapped Japanese Font Support"", ""enabled""); #endif #ifdef HAVE_GD_WEBP php_info_print_table_row(2, ""WebP Support"", ""enabled""); #endif php_info_print_table_end(); DISPLAY_INI_ENTRIES(); } ",0 "void RenderWidgetHostViewAura::OnCompositingEnded( ui::Compositor* compositor) { } ",0 "static int btrfs_setsize(struct inode *inode, loff_t newsize) { struct btrfs_root *root = BTRFS_I(inode)->root; struct btrfs_trans_handle *trans; loff_t oldsize = i_size_read(inode); int ret; if (newsize == oldsize) return 0; if (newsize > oldsize) { truncate_pagecache(inode, oldsize, newsize); ret = btrfs_cont_expand(inode, oldsize, newsize); if (ret) return ret; trans = btrfs_start_transaction(root, 1); if (IS_ERR(trans)) return PTR_ERR(trans); i_size_write(inode, newsize); btrfs_ordered_update_i_size(inode, i_size_read(inode), NULL); ret = btrfs_update_inode(trans, root, inode); btrfs_end_transaction(trans, root); } else { /* * We're truncating a file that used to have good data down to * zero. Make sure it gets into the ordered flush list so that * any new writes get down to disk quickly. */ if (newsize == 0) set_bit(BTRFS_INODE_ORDERED_DATA_CLOSE, &BTRFS_I(inode)->runtime_flags); /* we don't support swapfiles, so vmtruncate shouldn't fail */ truncate_setsize(inode, newsize); ret = btrfs_truncate(inode); } return ret; } ",0 "void big_key_destroy(struct key *key) { if (key->type_data.x[1] > BIG_KEY_FILE_THRESHOLD) { struct path *path = (struct path *)&key->payload.data2; path_put(path); path->mnt = NULL; path->dentry = NULL; } else { kfree(key->payload.data); key->payload.data = NULL; } } ",0 "enumerate_children_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { DirectoryLoadState *state; GFileEnumerator *enumerator; GError *error; state = user_data; if (state->directory == NULL) { /* Operation was cancelled. Bail out */ directory_load_state_free (state); return; } error = NULL; enumerator = g_file_enumerate_children_finish (G_FILE (source_object), res, &error); if (enumerator == NULL) { directory_load_done (state->directory, error); g_error_free (error); directory_load_state_free (state); return; } else { state->enumerator = enumerator; g_file_enumerator_next_files_async (state->enumerator, DIRECTORY_LOAD_ITEMS_PER_CALLBACK, G_PRIORITY_DEFAULT, state->cancellable, more_files_callback, state); } } ",0 "_XcursorAddPathElt (char *path, const char *elt, int len) { int pathlen = strlen (path); /* append / if the path doesn't currently have one */ if (path[0] == '\0' || path[pathlen - 1] != '/') { strcat (path, ""/""); pathlen++; } if (len == -1) len = strlen (elt); /* strip leading slashes */ while (len && elt[0] == '/') { elt++; len--; } strncpy (path + pathlen, elt, len); path[pathlen + len] = '\0'; } ",0 "static inline void free_abs_cgroup(char *cgroup) { if (!cgroup) return; if (abs_cgroup_supported()) nih_free(cgroup); else free(cgroup); } ",0 "void HeapDoesNotContainCache::addEntry(Address address) { ASSERT(ThreadState::current()->isInGC()); m_hasEntries = true; size_t index = hash(address); ASSERT(!(index & 1)); Address cachePage = roundToBlinkPageStart(address); m_entries[index + 1] = m_entries[index]; m_entries[index] = cachePage; } ",0 "ModuleExport size_t RegisterEXRImage(void) { MagickInfo *entry; entry=SetMagickInfo(""EXR""); #if defined(MAGICKCORE_OPENEXR_DELEGATE) entry->decoder=(DecodeImageHandler *) ReadEXRImage; entry->encoder=(EncodeImageHandler *) WriteEXRImage; #endif entry->magick=(IsImageFormatHandler *) IsEXR; entry->adjoin=MagickFalse; entry->description=ConstantString(""High Dynamic-range (HDR)""); entry->blob_support=MagickFalse; entry->module=ConstantString(""EXR""); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "evutil_sockaddr_is_loopback_(const struct sockaddr *addr) { static const char LOOPBACK_S6[16] = ""\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\1""; if (addr->sa_family == AF_INET) { struct sockaddr_in *sin = (struct sockaddr_in *)addr; return (ntohl(sin->sin_addr.s_addr) & 0xff000000) == 0x7f000000; } else if (addr->sa_family == AF_INET6) { struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)addr; return !memcmp(sin6->sin6_addr.s6_addr, LOOPBACK_S6, 16); } return 0; } ",0 "static int use_fetch( const char * /* method */, const char *path ) { return attr_list_has_file( ATTR_FETCH_FILES, path ); } ",0 "static void p4_pmu_disable_pebs(void) { /* * FIXME * * It's still allowed that two threads setup same cache * events so we can't simply clear metrics until we knew * no one is depending on us, so we need kind of counter * for ""ReplayEvent"" users. * * What is more complex -- RAW events, if user (for some * reason) will pass some cache event metric with improper * event opcode -- it's fine from hardware point of view * but completely nonsense from ""meaning"" of such action. * * So at moment let leave metrics turned on forever -- it's * ok for now but need to be revisited! * * (void)checking_wrmsrl(MSR_IA32_PEBS_ENABLE, (u64)0); * (void)checking_wrmsrl(MSR_P4_PEBS_MATRIX_VERT, (u64)0); */ } ",0 "static void arch_reinit_sched_domains(void) { get_online_cpus(); /* Destroy domains first to force the rebuild */ partition_sched_domains(0, NULL, NULL); rebuild_sched_domains(); put_online_cpus(); } ",0 " void Verify_FindMainResponseWithMultipleHits2() { EXPECT_EQ(kEntryUrl, delegate()->found_url_); EXPECT_EQ(kManifestUrl, delegate()->found_manifest_url_); EXPECT_EQ(1, delegate()->found_cache_id_); EXPECT_EQ(1, delegate()->found_group_id_); EXPECT_EQ(1, delegate()->found_entry_.response_id()); EXPECT_TRUE(delegate()->found_entry_.IsExplicit()); EXPECT_FALSE(delegate()->found_fallback_entry_.has_response_id()); delegate_.reset(new MockStorageDelegate(this)); PushNextTask(base::BindOnce( &AppCacheStorageImplTest::Verify_FindMainResponseWithMultipleHits3, base::Unretained(this))); storage()->FindResponseForMainRequest(kEntryUrl, kManifestUrl2, delegate()); EXPECT_NE(kEntryUrl, delegate()->found_url_); } ",0 "void TemplateURL::EncodeSearchTerms( const TemplateURLRef::SearchTermsArgs& search_terms_args, bool is_in_query, std::string* input_encoding, base::string16* encoded_terms, base::string16* encoded_original_query) const { std::vector encodings(input_encodings()); if (std::find(encodings.begin(), encodings.end(), ""UTF-8"") == encodings.end()) encodings.push_back(""UTF-8""); for (std::vector::const_iterator i(encodings.begin()); i != encodings.end(); ++i) { if (TryEncoding(search_terms_args.search_terms, search_terms_args.original_query, i->c_str(), is_in_query, encoded_terms, encoded_original_query)) { *input_encoding = *i; return; } } NOTREACHED(); } ",0 " explicit TestCase(const char* name) : test_case_name(name) { CHECK(name) << ""FATAL: no test case name""; } ",0 "static int fsck_blob(struct blob *blob, const char *buf, unsigned long size, struct fsck_options *options) { struct fsck_gitmodules_data data; if (!oidset_contains(&gitmodules_found, &blob->object.oid)) return 0; oidset_insert(&gitmodules_done, &blob->object.oid); if (!buf) { /* * A missing buffer here is a sign that the caller found the * blob too gigantic to load into memory. Let's just consider * that an error. */ return report(options, &blob->object, FSCK_MSG_GITMODULES_PARSE, "".gitmodules too large to parse""); } data.obj = &blob->object; data.options = options; data.ret = 0; if (git_config_from_mem(fsck_gitmodules_fn, CONFIG_ORIGIN_BLOB, "".gitmodules"", buf, size, &data)) data.ret |= report(options, &blob->object, FSCK_MSG_GITMODULES_PARSE, ""could not parse gitmodules blob""); return data.ret; } ",0 "error::Error GLES2DecoderImpl::HandleGetString( uint32 immediate_data_size, const gles2::GetString& c) { GLenum name = static_cast(c.name); if (!validators_->string_type.IsValid(name)) { SetGLError(GL_INVALID_ENUM, ""glGetString: name GL_INVALID_ENUM""); return error::kNoError; } const char* gl_str = reinterpret_cast(glGetString(name)); const char* str = NULL; switch (name) { case GL_VERSION: str = ""OpenGL ES 2.0 Chromium""; break; case GL_SHADING_LANGUAGE_VERSION: str = ""OpenGL ES GLSL ES 1.0 Chromium""; break; case GL_EXTENSIONS: str = feature_info_->extensions().c_str(); break; default: str = gl_str; break; } Bucket* bucket = CreateBucket(c.bucket_id); bucket->SetFromString(str); return error::kNoError; } ",0 "static int get_dotl_openflags(V9fsState *s, int oflags) { int flags; /* * Filter the client open flags */ flags = dotl_to_open_flags(oflags); flags &= ~(O_NOCTTY | O_ASYNC | O_CREAT); /* * Ignore direct disk access hint until the server supports it. */ flags &= ~O_DIRECT; return flags; } ",0 "void ass_shaper_determine_script(ASS_Shaper *shaper, GlyphInfo *glyphs, size_t len) { int i; int backwards_scan = 0; hb_unicode_funcs_t *ufuncs = hb_unicode_funcs_get_default(); hb_script_t last_script = HB_SCRIPT_UNKNOWN; for (i = 0; i < len; i++) { GlyphInfo *info = glyphs + i; info->script = hb_unicode_script(ufuncs, info->symbol); if (info->script == HB_SCRIPT_COMMON || info->script == HB_SCRIPT_INHERITED) { if (last_script != HB_SCRIPT_UNKNOWN) info->script = last_script; else backwards_scan = 1; } else { last_script = info->script; } } last_script = HB_SCRIPT_UNKNOWN; for (i = len - 1; i >= 0 && backwards_scan; i--) { GlyphInfo *info = glyphs + i; if (info->script == HB_SCRIPT_COMMON || info->script == HB_SCRIPT_INHERITED) { if (last_script != HB_SCRIPT_UNKNOWN) info->script = last_script; } else { last_script = info->script; } } } ",0 "static void sysbus_esp_mem_write(void *opaque, hwaddr addr, uint64_t val, unsigned int size) { SysBusESPState *sysbus = opaque; uint32_t saddr; saddr = addr >> sysbus->it_shift; esp_reg_write(&sysbus->esp, saddr, val); } ",0 "void MediaRecorderHandler::OnVideoFrameForTesting( const scoped_refptr& frame, const TimeTicks& timestamp) { for (const auto& recorder : video_recorders_) recorder->OnVideoFrameForTesting(frame, timestamp); } ",0 "JSValue jsTestObjWithScriptExecutionContextAttributeRaises(ExecState* exec, JSValue slotBase, const Identifier&) { JSTestObj* castedThis = jsCast(asObject(slotBase)); ExceptionCode ec = 0; ScriptExecutionContext* scriptContext = jsCast(exec->lexicalGlobalObject())->scriptExecutionContext(); if (!scriptContext) return jsUndefined(); TestObj* impl = static_cast(castedThis->impl()); JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(impl->withScriptExecutionContextAttributeRaises(scriptContext, ec))); setDOMException(exec, ec); return result; } ",0 "static int set_segment_reg(struct task_struct *task, unsigned long offset, u16 value) { /* * The value argument was already truncated to 16 bits. */ if (invalid_selector(value)) return -EIO; /* * For %cs and %ss we cannot permit a null selector. * We can permit a bogus selector as long as it has USER_RPL. * Null selectors are fine for other segment registers, but * we will never get back to user mode with invalid %cs or %ss * and will take the trap in iret instead. Much code relies * on user_mode() to distinguish a user trap frame (which can * safely use invalid selectors) from a kernel trap frame. */ switch (offset) { case offsetof(struct user_regs_struct, cs): case offsetof(struct user_regs_struct, ss): if (unlikely(value == 0)) return -EIO; default: *pt_regs_access(task_pt_regs(task), offset) = value; break; case offsetof(struct user_regs_struct, gs): if (task == current) set_user_gs(task_pt_regs(task), value); else task_user_gs(task) = value; } return 0; } ",0 "static int ssb_prctl_get(struct task_struct *task) { switch (ssb_mode) { case SPEC_STORE_BYPASS_DISABLE: return PR_SPEC_DISABLE; case SPEC_STORE_BYPASS_SECCOMP: case SPEC_STORE_BYPASS_PRCTL: if (task_spec_ssb_force_disable(task)) return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE; if (task_spec_ssb_disable(task)) return PR_SPEC_PRCTL | PR_SPEC_DISABLE; return PR_SPEC_PRCTL | PR_SPEC_ENABLE; default: if (boot_cpu_has_bug(X86_BUG_SPEC_STORE_BYPASS)) return PR_SPEC_ENABLE; return PR_SPEC_NOT_AFFECTED; } } ",0 "static int hci_sock_bound_ioctl(struct sock *sk, unsigned int cmd, unsigned long arg) { struct hci_dev *hdev = hci_pi(sk)->hdev; if (!hdev) return -EBADFD; if (test_bit(HCI_USER_CHANNEL, &hdev->dev_flags)) return -EBUSY; if (hdev->dev_type != HCI_BREDR) return -EOPNOTSUPP; switch (cmd) { case HCISETRAW: if (!capable(CAP_NET_ADMIN)) return -EPERM; if (test_bit(HCI_QUIRK_RAW_DEVICE, &hdev->quirks)) return -EPERM; if (arg) set_bit(HCI_RAW, &hdev->flags); else clear_bit(HCI_RAW, &hdev->flags); return 0; case HCIGETCONNINFO: return hci_get_conn_info(hdev, (void __user *) arg); case HCIGETAUTHINFO: return hci_get_auth_info(hdev, (void __user *) arg); case HCIBLOCKADDR: if (!capable(CAP_NET_ADMIN)) return -EPERM; return hci_sock_blacklist_add(hdev, (void __user *) arg); case HCIUNBLOCKADDR: if (!capable(CAP_NET_ADMIN)) return -EPERM; return hci_sock_blacklist_del(hdev, (void __user *) arg); } return -ENOIOCTLCMD; } ",0 "void ChromotingInstance::UnregisterLoggingInstance() { base::AutoLock lock(g_logging_lock.Get()); if (this != g_logging_instance.Get().get()) return; g_has_logging_instance = false; g_logging_instance.Get().reset(); g_logging_task_runner.Get() = nullptr; VLOG(1) << ""Unregistering global log handler""; } ",0 "void hns_ppe_uninit(struct dsaf_device *dsaf_dev) { u32 i; for (i = 0; i < HNS_PPE_COM_NUM; i++) { if (dsaf_dev->ppe_common[i]) hns_ppe_uninit_ex(dsaf_dev->ppe_common[i]); hns_rcb_common_free_cfg(dsaf_dev, i); hns_ppe_common_free_cfg(dsaf_dev, i); } } ",0 "void AutomationProvider::RemoveBrowsingData(int remove_mask) { BrowsingDataRemover* remover; remover = new BrowsingDataRemover(profile(), BrowsingDataRemover::EVERYTHING, // All time periods. base::Time()); remover->Remove(remove_mask); } ",0 "int nntp_post(const char *msg) { struct NntpData *nntp_data, nntp_tmp; char buf[LONG_STRING]; if (Context && Context->magic == MUTT_NNTP) nntp_data = Context->data; else { CurrentNewsSrv = nntp_select_server(NewsServer, false); if (!CurrentNewsSrv) return -1; nntp_data = &nntp_tmp; nntp_data->nserv = CurrentNewsSrv; nntp_data->group = NULL; } FILE *fp = mutt_file_fopen(msg, ""r""); if (!fp) { mutt_perror(msg); return -1; } mutt_str_strfcpy(buf, ""POST\r\n"", sizeof(buf)); if (nntp_query(nntp_data, buf, sizeof(buf)) < 0) { mutt_file_fclose(&fp); return -1; } if (buf[0] != '3') { mutt_error(_(""Can't post article: %s""), buf); mutt_file_fclose(&fp); return -1; } buf[0] = '.'; buf[1] = '\0'; while (fgets(buf + 1, sizeof(buf) - 2, fp)) { size_t len = strlen(buf); if (buf[len - 1] == '\n') { buf[len - 1] = '\r'; buf[len] = '\n'; len++; buf[len] = '\0'; } if (mutt_socket_send_d(nntp_data->nserv->conn, buf[1] == '.' ? buf : buf + 1, MUTT_SOCK_LOG_HDR) < 0) { mutt_file_fclose(&fp); return nntp_connect_error(nntp_data->nserv); } } mutt_file_fclose(&fp); if ((buf[strlen(buf) - 1] != '\n' && mutt_socket_send_d(nntp_data->nserv->conn, ""\r\n"", MUTT_SOCK_LOG_HDR) < 0) || mutt_socket_send_d(nntp_data->nserv->conn, "".\r\n"", MUTT_SOCK_LOG_HDR) < 0 || mutt_socket_readln(buf, sizeof(buf), nntp_data->nserv->conn) < 0) { return nntp_connect_error(nntp_data->nserv); } if (buf[0] != '2') { mutt_error(_(""Can't post article: %s""), buf); return -1; } return 0; } ",0 "BN_ULONG bn_mul_add_words(BN_ULONG *rp, const BN_ULONG *ap, int num, BN_ULONG w) { BN_ULONG c1=0; assert(num >= 0); if (num <= 0) return(c1); #ifndef OPENSSL_SMALL_FOOTPRINT while (num&~3) { mul_add(rp[0],ap[0],w,c1); mul_add(rp[1],ap[1],w,c1); mul_add(rp[2],ap[2],w,c1); mul_add(rp[3],ap[3],w,c1); ap+=4; rp+=4; num-=4; } #endif while (num) { mul_add(rp[0],ap[0],w,c1); ap++; rp++; num--; } return(c1); } ",0 "void RenderBox::scrollByRecursively(const IntSize& delta, ScrollOffsetClamping clamp) { if (delta.isZero()) return; bool restrictedByLineClamp = false; if (parent()) restrictedByLineClamp = !parent()->style()->lineClamp().isNone(); if (hasOverflowClip() && !restrictedByLineClamp) { IntSize newScrollOffset = layer()->scrollableArea()->adjustedScrollOffset() + delta; layer()->scrollableArea()->scrollToOffset(newScrollOffset, clamp); IntSize remainingScrollOffset = newScrollOffset - layer()->scrollableArea()->adjustedScrollOffset(); if (!remainingScrollOffset.isZero() && parent()) { if (RenderBox* scrollableBox = enclosingScrollableBox()) scrollableBox->scrollByRecursively(remainingScrollOffset, clamp); LocalFrame* frame = this->frame(); if (frame && frame->page()) frame->page()->autoscrollController().updateAutoscrollRenderer(); } } else if (view()->frameView()) { view()->frameView()->scrollBy(delta); } } ",0 "static void stop_ep_timer(struct iwch_ep *ep) { PDBG(""%s ep %p\n"", __func__, ep); if (!timer_pending(&ep->timer)) { WARN(1, ""%s timer stopped when its not running! ep %p state %u\n"", __func__, ep, ep->com.state); return; } del_timer_sync(&ep->timer); put_ep(&ep->com); } ",0 "__archive_write_filter(struct archive_write_filter *f, const void *buff, size_t length) { int r; if (length == 0) return(ARCHIVE_OK); if (f->write == NULL) /* If unset, a fatal error has already ocuured, so this filter * didn't open. We cannot write anything. */ return(ARCHIVE_FATAL); r = (f->write)(f, buff, length); f->bytes_written += length; return (r); } ",0 "void RenderWidgetHostImpl::ImeCommitText( const base::string16& text, const std::vector& ime_text_spans, const gfx::Range& replacement_range, int relative_cursor_pos) { GetWidgetInputHandler()->ImeCommitText(text, ime_text_spans, replacement_range, relative_cursor_pos, base::OnceClosure()); } ",0 "parse_device(dev_t *pdev, struct archive *a, char *val) { #define MAX_PACK_ARGS 3 unsigned long numbers[MAX_PACK_ARGS]; char *p, *dev; int argc; pack_t *pack; dev_t result; const char *error = NULL; memset(pdev, 0, sizeof(*pdev)); if ((dev = strchr(val, ',')) != NULL) { /* * Device's major/minor are given in a specified format. * Decode and pack it accordingly. */ *dev++ = '\0'; if ((pack = pack_find(val)) == NULL) { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, ""Unknown format `%s'"", val); return ARCHIVE_WARN; } argc = 0; while ((p = la_strsep(&dev, "","")) != NULL) { if (*p == '\0') { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, ""Missing number""); return ARCHIVE_WARN; } if (argc >= MAX_PACK_ARGS) { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, ""Too many arguments""); return ARCHIVE_WARN; } numbers[argc++] = (unsigned long)mtree_atol(&p); } if (argc < 2) { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, ""Not enough arguments""); return ARCHIVE_WARN; } result = (*pack)(argc, numbers, &error); if (error != NULL) { archive_set_error(a, ARCHIVE_ERRNO_FILE_FORMAT, ""%s"", error); return ARCHIVE_WARN; } } else { /* file system raw value. */ result = (dev_t)mtree_atol(&val); } *pdev = result; return ARCHIVE_OK; #undef MAX_PACK_ARGS } ",0 "static bool valid_pat_type(unsigned t) { return t < 8 && (1 << t) & 0xf3; /* 0, 1, 4, 5, 6, 7 */ } ",0 "std::string DownloadItemImpl::GetContentDisposition() const { return content_disposition_; } ",0 "exsltDateMonthInYear (const xmlChar *dateTime) { exsltDateValPtr dt; double ret; if (dateTime == NULL) { #ifdef WITH_TIME dt = exsltDateCurrent(); if (dt == NULL) #endif return xmlXPathNAN; } else { dt = exsltDateParse(dateTime); if (dt == NULL) return xmlXPathNAN; if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE) && (dt->type != XS_GYEARMONTH) && (dt->type != XS_GMONTH) && (dt->type != XS_GMONTHDAY)) { exsltDateFreeDate(dt); return xmlXPathNAN; } } ret = (double) dt->value.date.mon; exsltDateFreeDate(dt); return ret; } ",0 "void TestingAutomationProvider::SetProxySettings(Browser* browser, DictionaryValue* args, IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); std::string key; base::Value* value; if (!args->GetString(""key"", &key) || !args->Get(""value"", &value)) { reply.SendError(""Invalid or missing args.""); return; } std::string setting_path = ""cros.session.proxy.""; setting_path.append(key); chromeos::proxy_cros_settings_parser::SetProxyPrefValue( browser->profile(), setting_path, value); reply.SendSuccess(NULL); } ",0 "static int unshare_fs(unsigned long unshare_flags, struct fs_struct **new_fsp) { struct fs_struct *fs = current->fs; if (!(unshare_flags & CLONE_FS) || !fs) return 0; /* don't need lock here; in the worst case we'll do useless copy */ if (fs->users == 1) return 0; *new_fsp = copy_fs_struct(fs); if (!*new_fsp) return -ENOMEM; return 0; } ",0 "AppCacheUpdateJob::URLFetcher::~URLFetcher() { } ",0 "PepperPluginInfo* PluginServiceImpl::GetRegisteredPpapiPluginInfo( const FilePath& plugin_path) { PepperPluginInfo* info = NULL; for (size_t i = 0; i < ppapi_plugins_.size(); i++) { if (ppapi_plugins_[i].path == plugin_path) { info = &ppapi_plugins_[i]; break; } } if (info) return info; webkit::WebPluginInfo webplugin_info; if (!GetPluginInfoByPath(plugin_path, &webplugin_info)) return NULL; PepperPluginInfo new_pepper_info; if (!MakePepperPluginInfo(webplugin_info, &new_pepper_info)) return NULL; ppapi_plugins_.push_back(new_pepper_info); return &ppapi_plugins_[ppapi_plugins_.size() - 1]; } ",0 "FLAC__bool read_metadata_vorbiscomment_(FLAC__StreamDecoder *decoder, FLAC__StreamMetadata_VorbisComment *obj, unsigned length) { FLAC__uint32 i; FLAC__ASSERT(FLAC__bitreader_is_consumed_byte_aligned(decoder->private_->input)); /* read vendor string */ if (length >= 8) { length -= 8; /* vendor string length + num comments entries alone take 8 bytes */ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); if (!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->vendor_string.length)) return false; /* read_callback_ sets the state for us */ if (obj->vendor_string.length > 0) { if (length < obj->vendor_string.length) { obj->vendor_string.length = 0; obj->vendor_string.entry = 0; goto skip; } else length -= obj->vendor_string.length; if (0 == (obj->vendor_string.entry = safe_malloc_add_2op_(obj->vendor_string.length, /*+*/1))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } if (!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->vendor_string.entry, obj->vendor_string.length)) return false; /* read_callback_ sets the state for us */ obj->vendor_string.entry[obj->vendor_string.length] = '\0'; } else obj->vendor_string.entry = 0; /* read num comments */ FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_NUM_COMMENTS_LEN == 32); if (!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->num_comments)) return false; /* read_callback_ sets the state for us */ /* read comments */ if (obj->num_comments > 100000) { /* Possibly malicious file. */ obj->num_comments = 0; return false; } if (obj->num_comments > 0) { if (0 == (obj->comments = safe_malloc_mul_2op_p(obj->num_comments, /*times*/sizeof(FLAC__StreamMetadata_VorbisComment_Entry)))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } for (i = 0; i < obj->num_comments; i++) { /* Initialize here just to make sure. */ obj->comments[i].length = 0; obj->comments[i].entry = 0; FLAC__ASSERT(FLAC__STREAM_METADATA_VORBIS_COMMENT_ENTRY_LENGTH_LEN == 32); if (length < 4) { obj->num_comments = i; goto skip; } else length -= 4; if (!FLAC__bitreader_read_uint32_little_endian(decoder->private_->input, &obj->comments[i].length)) return false; /* read_callback_ sets the state for us */ if (obj->comments[i].length > 0) { if (length < obj->comments[i].length) { obj->num_comments = i; goto skip; } else length -= obj->comments[i].length; if (0 == (obj->comments[i].entry = safe_malloc_add_2op_(obj->comments[i].length, /*+*/1))) { decoder->protected_->state = FLAC__STREAM_DECODER_MEMORY_ALLOCATION_ERROR; return false; } memset (obj->comments[i].entry, 0, obj->comments[i].length) ; if (!FLAC__bitreader_read_byte_block_aligned_no_crc(decoder->private_->input, obj->comments[i].entry, obj->comments[i].length)) { obj->num_comments = i; goto skip; } obj->comments[i].entry[obj->comments[i].length] = '\0'; } else obj->comments[i].entry = 0; } } else obj->comments = 0; } skip: if (length > 0) { /* This will only happen on files with invalid data in comments */ if(!FLAC__bitreader_skip_byte_block_aligned_no_crc(decoder->private_->input, length)) return false; /* read_callback_ sets the state for us */ } return true; } ",1 "log_as_req(krb5_context context, krb5_kdc_configuration *config, krb5_enctype cetype, krb5_enctype setype, const KDC_REQ_BODY *b) { krb5_error_code ret; struct rk_strpool *p; char *str; size_t i; p = rk_strpoolprintf(NULL, ""%s"", ""Client supported enctypes: ""); for (i = 0; i < b->etype.len; i++) { ret = krb5_enctype_to_string(context, b->etype.val[i], &str); if (ret == 0) { p = rk_strpoolprintf(p, ""%s"", str); free(str); } else p = rk_strpoolprintf(p, ""%d"", b->etype.val[i]); if (p && i + 1 < b->etype.len) p = rk_strpoolprintf(p, "", ""); if (p == NULL) { kdc_log(context, config, 0, ""out of memory""); return; } } if (p == NULL) p = rk_strpoolprintf(p, ""no encryption types""); { char *cet; char *set; ret = krb5_enctype_to_string(context, cetype, &cet); if(ret == 0) { ret = krb5_enctype_to_string(context, setype, &set); if (ret == 0) { p = rk_strpoolprintf(p, "", using %s/%s"", cet, set); free(set); } free(cet); } if (ret != 0) p = rk_strpoolprintf(p, "", using enctypes %d/%d"", cetype, setype); } str = rk_strpoolcollect(p); kdc_log(context, config, 0, ""%s"", str); free(str); { char fixedstr[128]; unparse_flags(KDCOptions2int(b->kdc_options), asn1_KDCOptions_units(), fixedstr, sizeof(fixedstr)); if(*fixedstr) kdc_log(context, config, 0, ""Requested flags: %s"", fixedstr); } } ",0 "NavigationHandle* TestNavigationManager::GetNavigationHandle() { return handle_; } ",0 "void WebPluginImpl::InvalidateRect(const gfx::Rect& rect) { if (container_) container_->invalidateRect(rect); } ",0 "static int cg_releasedir(const char *path, struct fuse_file_info *fi) { struct file_info *d = (struct file_info *)fi->fh; do_release_file_info(d); return 0; } ",0 "void WebGLRenderingContextBase::stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { if (isContextLost()) return; ContextGL()->StencilOpSeparate(face, fail, zfail, zpass); } ",0 "AMediaCodec* AMediaCodec_createCodecByName(const char *name) { return createAMediaCodec(name, false, false); } ",0 "bool BluetoothSocketAbstractConnectFunction::PreRunValidation( std::string* error) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (!BluetoothSocketAsyncApiFunction::PreRunValidation(error)) return false; params_ = bluetooth_socket::Connect::Params::Create(*args_); EXTENSION_FUNCTION_PRERUN_VALIDATE(params_.get()); socket_event_dispatcher_ = GetSocketEventDispatcher(browser_context()); return socket_event_dispatcher_ != nullptr; } ",0 "void WebRuntimeFeatures::EnableOriginTrials(bool enable) { RuntimeEnabledFeatures::SetOriginTrialsEnabled(enable); } ",0 "std::vector GetSideloadFontFiles() { std::vector files; const base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kRegisterFontFiles)) { base::SplitString( command_line.GetSwitchValueASCII(switches::kRegisterFontFiles), ';', &files); } return files; } ",0 "bool WebMediaPlayerImpl::Seeking() const { DCHECK(main_task_runner_->BelongsToCurrentThread()); if (ready_state_ == WebMediaPlayer::kReadyStateHaveNothing) return false; return seeking_; } ",0 "void bdrv_round_to_clusters(BlockDriverState *bs, int64_t sector_num, int nb_sectors, int64_t *cluster_sector_num, int *cluster_nb_sectors) { BlockDriverInfo bdi; if (bdrv_get_info(bs, &bdi) < 0 || bdi.cluster_size == 0) { *cluster_sector_num = sector_num; *cluster_nb_sectors = nb_sectors; } else { int64_t c = bdi.cluster_size / BDRV_SECTOR_SIZE; *cluster_sector_num = QEMU_ALIGN_DOWN(sector_num, c); *cluster_nb_sectors = QEMU_ALIGN_UP(sector_num - *cluster_sector_num + nb_sectors, c); } } ",0 "bool IsInPasswordFieldWithUnrevealedPassword(const Position& position) { TextControlElement* text_control = EnclosingTextControl(position); if (!isHTMLInputElement(text_control)) return false; HTMLInputElement* input = toHTMLInputElement(text_control); return (input->type() == InputTypeNames::password) && !input->ShouldRevealPassword(); } ",0 "static int jpc_pi_nextpcrl(register jpc_pi_t *pi) { int rlvlno; jpc_pirlvl_t *pirlvl; jpc_pchg_t *pchg; int prchind; int prcvind; int *prclyrno; int compno; jpc_picomp_t *picomp; int xstep; int ystep; uint_fast32_t trx0; uint_fast32_t try0; uint_fast32_t r; uint_fast32_t rpx; uint_fast32_t rpy; pchg = pi->pchg; if (!pi->prgvolfirst) { goto skip; } else { pi->xstep = 0; pi->ystep = 0; for (compno = 0, picomp = pi->picomps; compno < pi->numcomps; ++compno, ++picomp) { for (rlvlno = 0, pirlvl = picomp->pirlvls; rlvlno < picomp->numrlvls; ++rlvlno, ++pirlvl) { if (pirlvl->prcwidthexpn + pi->picomp->numrlvls > JAS_UINTFAST32_NUMBITS - 2 || pirlvl->prcheightexpn + pi->picomp->numrlvls > JAS_UINTFAST32_NUMBITS - 2) { return -1; } xstep = picomp->hsamp * (JAS_CAST(uint_fast32_t, 1) << (pirlvl->prcwidthexpn + picomp->numrlvls - rlvlno - 1)); ystep = picomp->vsamp * (JAS_CAST(uint_fast32_t, 1) << (pirlvl->prcheightexpn + picomp->numrlvls - rlvlno - 1)); pi->xstep = (!pi->xstep) ? xstep : JAS_MIN(pi->xstep, xstep); pi->ystep = (!pi->ystep) ? ystep : JAS_MIN(pi->ystep, ystep); } } pi->prgvolfirst = 0; } for (pi->y = pi->ystart; pi->y < pi->yend; pi->y += pi->ystep - (pi->y % pi->ystep)) { for (pi->x = pi->xstart; pi->x < pi->xend; pi->x += pi->xstep - (pi->x % pi->xstep)) { for (pi->compno = pchg->compnostart, pi->picomp = &pi->picomps[pi->compno]; pi->compno < pi->numcomps && pi->compno < JAS_CAST(int, pchg->compnoend); ++pi->compno, ++pi->picomp) { for (pi->rlvlno = pchg->rlvlnostart, pi->pirlvl = &pi->picomp->pirlvls[pi->rlvlno]; pi->rlvlno < pi->picomp->numrlvls && pi->rlvlno < pchg->rlvlnoend; ++pi->rlvlno, ++pi->pirlvl) { if (pi->pirlvl->numprcs == 0) { continue; } r = pi->picomp->numrlvls - 1 - pi->rlvlno; trx0 = JPC_CEILDIV(pi->xstart, pi->picomp->hsamp << r); try0 = JPC_CEILDIV(pi->ystart, pi->picomp->vsamp << r); rpx = r + pi->pirlvl->prcwidthexpn; rpy = r + pi->pirlvl->prcheightexpn; if (((pi->x == pi->xstart && ((trx0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpx))) || !(pi->x % (pi->picomp->hsamp << rpx))) && ((pi->y == pi->ystart && ((try0 << r) % (JAS_CAST(uint_fast32_t, 1) << rpy))) || !(pi->y % (pi->picomp->vsamp << rpy)))) { prchind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->x, pi->picomp->hsamp << r), pi->pirlvl->prcwidthexpn) - JPC_FLOORDIVPOW2(trx0, pi->pirlvl->prcwidthexpn); prcvind = JPC_FLOORDIVPOW2(JPC_CEILDIV(pi->y, pi->picomp->vsamp << r), pi->pirlvl->prcheightexpn) - JPC_FLOORDIVPOW2(try0, pi->pirlvl->prcheightexpn); pi->prcno = prcvind * pi->pirlvl->numhprcs + prchind; assert(pi->prcno < pi->pirlvl->numprcs); for (pi->lyrno = 0; pi->lyrno < pi->numlyrs && pi->lyrno < JAS_CAST(int, pchg->lyrnoend); ++pi->lyrno) { prclyrno = &pi->pirlvl->prclyrnos[pi->prcno]; if (pi->lyrno >= *prclyrno) { ++(*prclyrno); return 0; } skip: ; } } } } } } return 1; } ",0 "int fz_colorspace_is_subtractive(fz_context *ctx, const fz_colorspace *cs) { return cs && (cs->type == FZ_COLORSPACE_CMYK || cs->type == FZ_COLORSPACE_SEPARATION); } ",0 "PHP_MSHUTDOWN_FUNCTION(date) { UNREGISTER_INI_ENTRIES(); if (DATEG(last_errors)) { timelib_error_container_dtor(DATEG(last_errors)); } return SUCCESS; } ",0 " v8::Handle deserialize() { v8::Isolate* isolate = m_reader.scriptState()->isolate(); if (!m_reader.readVersion(m_version) || m_version > SerializedScriptValue::wireFormatVersion) return v8::Null(isolate); m_reader.setVersion(m_version); v8::EscapableHandleScope scope(isolate); while (!m_reader.isEof()) { if (!doDeserialize()) return v8::Null(isolate); } if (stackDepth() != 1 || m_openCompositeReferenceStack.size()) return v8::Null(isolate); v8::Handle result = scope.Escape(element(0)); return result; } ",0 "void HTMLConstructionSite::insertHTMLBodyStartTagInBody(AtomicHTMLToken& token) { mergeAttributesFromTokenIntoElement(token, m_openElements.bodyElement()); } ",0 "MagickExport MagickBooleanType GammaImage(Image *image,const double gamma, ExceptionInfo *exception) { #define GammaCorrectImageTag ""GammaCorrect/Image"" CacheView *image_view; MagickBooleanType status; MagickOffsetType progress; Quantum *gamma_map; register ssize_t i; ssize_t y; /* Allocate and initialize gamma maps. */ assert(image != (Image *) NULL); assert(image->signature == MagickCoreSignature); if (image->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"",image->filename); if (gamma == 1.0) return(MagickTrue); gamma_map=(Quantum *) AcquireQuantumMemory(MaxMap+1UL,sizeof(*gamma_map)); if (gamma_map == (Quantum *) NULL) ThrowBinaryException(ResourceLimitError,""MemoryAllocationFailed"", image->filename); (void) ResetMagickMemory(gamma_map,0,(MaxMap+1)*sizeof(*gamma_map)); if (gamma != 0.0) for (i=0; i <= (ssize_t) MaxMap; i++) gamma_map[i]=ScaleMapToQuantum((double) (MaxMap*pow((double) i/ MaxMap,1.0/gamma))); if (image->storage_class == PseudoClass) for (i=0; i < (ssize_t) image->colors; i++) { /* Gamma-correct colormap. */ #if !defined(MAGICKCORE_HDRI_SUPPORT) if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].red=(double) gamma_map[ScaleQuantumToMap( ClampToQuantum(image->colormap[i].red))]; if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].green=(double) gamma_map[ScaleQuantumToMap( ClampToQuantum(image->colormap[i].green))]; if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].blue=(double) gamma_map[ScaleQuantumToMap( ClampToQuantum(image->colormap[i].blue))]; if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].alpha=(double) gamma_map[ScaleQuantumToMap( ClampToQuantum(image->colormap[i].alpha))]; #else if ((GetPixelRedTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].red=QuantumRange*gamma_pow(QuantumScale* image->colormap[i].red,1.0/gamma); if ((GetPixelGreenTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].green=QuantumRange*gamma_pow(QuantumScale* image->colormap[i].green,1.0/gamma); if ((GetPixelBlueTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].blue=QuantumRange*gamma_pow(QuantumScale* image->colormap[i].blue,1.0/gamma); if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].alpha=QuantumRange*gamma_pow(QuantumScale* image->colormap[i].alpha,1.0/gamma); #endif } /* Gamma-correct image. */ status=MagickTrue; progress=0; image_view=AcquireAuthenticCacheView(image,exception); #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp parallel for schedule(static,4) shared(progress,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++) { register ssize_t j; if (GetPixelWriteMask(image,q) == 0) { q+=GetPixelChannels(image); continue; } for (j=0; j < (ssize_t) GetPixelChannels(image); j++) { PixelChannel channel=GetPixelChannelChannel(image,j); PixelTrait traits=GetPixelChannelTraits(image,channel); if ((traits & UpdatePixelTrait) == 0) continue; #if !defined(MAGICKCORE_HDRI_SUPPORT) q[j]=gamma_map[ScaleQuantumToMap(q[j])]; #else q[j]=QuantumRange*gamma_pow(QuantumScale*q[j],1.0/gamma); #endif } q+=GetPixelChannels(image); } if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse) status=MagickFalse; if (image->progress_monitor != (MagickProgressMonitor) NULL) { MagickBooleanType proceed; #if defined(MAGICKCORE_OPENMP_SUPPORT) #pragma omp critical (MagickCore_GammaImage) #endif proceed=SetImageProgress(image,GammaCorrectImageTag,progress++, image->rows); if (proceed == MagickFalse) status=MagickFalse; } } image_view=DestroyCacheView(image_view); gamma_map=(Quantum *) RelinquishMagickMemory(gamma_map); if (image->gamma != 0.0) image->gamma*=gamma; return(status); } ",0 "void NavigationRequest::OnRendererAbortedNavigation() { frame_tree_node_->navigator()->CancelNavigation(frame_tree_node_, false); } ",0 "bool DocumentLoader::RedirectReceived( Resource* resource, const ResourceRequest& request, const ResourceResponse& redirect_response) { DCHECK(frame_); DCHECK_EQ(resource, GetResource()); DCHECK(!redirect_response.IsNull()); request_ = request; const KURL& request_url = request_.Url(); scoped_refptr redirecting_origin = SecurityOrigin::Create(redirect_response.Url()); if (!redirecting_origin->CanDisplay(request_url)) { frame_->Console().AddMessage(ConsoleMessage::Create( kSecurityMessageSource, kErrorMessageLevel, ""Not allowed to load local resource: "" + request_url.GetString())); fetcher_->StopFetching(); return false; } if (GetFrameLoader().ShouldContinueForRedirectNavigationPolicy( request_, SubstituteData(), this, kCheckContentSecurityPolicy, navigation_type_, kNavigationPolicyCurrentTab, load_type_, IsClientRedirect(), nullptr) != kNavigationPolicyCurrentTab) { fetcher_->StopFetching(); return false; } DCHECK(!GetTiming().FetchStart().is_null()); AppendRedirect(request_url); GetTiming().AddRedirect(redirect_response.Url(), request_url); history_item_.Clear(); GetLocalFrameClient().DispatchDidReceiveServerRedirectForProvisionalLoad(); return true; } ",0 "pvscsi_queue_pending_descriptor(PVSCSIState *s, SCSIDevice **d, struct PVSCSIRingReqDesc *descr) { PVSCSIRequest *pvscsi_req; uint8_t lun; pvscsi_req = g_malloc0(sizeof(*pvscsi_req)); pvscsi_req->dev = s; pvscsi_req->req = *descr; pvscsi_req->cmp.context = pvscsi_req->req.context; QTAILQ_INSERT_TAIL(&s->pending_queue, pvscsi_req, next); *d = pvscsi_device_find(s, descr->bus, descr->target, descr->lun, &lun); if (*d) { pvscsi_req->lun = lun; } return pvscsi_req; } ",0 "parse_CONTROLLER(char *arg, struct ofpbuf *ofpacts, enum ofputil_protocol *usable_protocols OVS_UNUSED) { enum ofp_packet_in_reason reason = OFPR_ACTION; uint16_t controller_id = 0; uint16_t max_len = UINT16_MAX; const char *userdata = NULL; bool pause = false; if (!arg[0]) { /* Use defaults. */ } else if (strspn(arg, ""0123456789"") == strlen(arg)) { char *error = str_to_u16(arg, ""max_len"", &max_len); if (error) { return error; } } else { char *name, *value; while (ofputil_parse_key_value(&arg, &name, &value)) { if (!strcmp(name, ""reason"")) { if (!ofputil_packet_in_reason_from_string(value, &reason)) { return xasprintf(""unknown reason \""%s\"""", value); } } else if (!strcmp(name, ""max_len"")) { char *error = str_to_u16(value, ""max_len"", &max_len); if (error) { return error; } } else if (!strcmp(name, ""id"")) { char *error = str_to_u16(value, ""id"", &controller_id); if (error) { return error; } } else if (!strcmp(name, ""userdata"")) { userdata = value; } else if (!strcmp(name, ""pause"")) { pause = true; } else { return xasprintf(""unknown key \""%s\"" parsing controller "" ""action"", name); } } } if (reason == OFPR_ACTION && controller_id == 0 && !userdata && !pause) { struct ofpact_output *output; output = ofpact_put_OUTPUT(ofpacts); output->port = OFPP_CONTROLLER; output->max_len = max_len; } else { struct ofpact_controller *controller; controller = ofpact_put_CONTROLLER(ofpacts); controller->max_len = max_len; controller->reason = reason; controller->controller_id = controller_id; controller->pause = pause; if (userdata) { size_t start_ofs = ofpacts->size; const char *end = ofpbuf_put_hex(ofpacts, userdata, NULL); if (*end) { return xstrdup(""bad hex digit in `controller' "" ""action `userdata'""); } size_t userdata_len = ofpacts->size - start_ofs; controller = ofpacts->header; controller->userdata_len = userdata_len; } ofpact_finish_CONTROLLER(ofpacts, &controller); } return NULL; } ",0 "void GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL( GLuint client_id, const volatile GLbyte* data) { TRACE_EVENT2(""gpu"", ""GLES2DecoderImpl::DoCreateAndConsumeTextureINTERNAL"", ""context"", logger_.GetLogPrefix(), ""mailbox[0]"", static_cast(data[0])); Mailbox mailbox = Mailbox::FromVolatile(*reinterpret_cast(data)); DLOG_IF(ERROR, !mailbox.Verify()) << ""CreateAndConsumeTextureCHROMIUM was "" ""passed a mailbox that was not "" ""generated by GenMailboxCHROMIUM.""; if (!client_id) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glCreateAndConsumeTextureCHROMIUM"", ""invalid client id""); return; } TextureRef* texture_ref = GetTexture(client_id); if (texture_ref) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glCreateAndConsumeTextureCHROMIUM"", ""client id already in use""); return; } Texture* texture = Texture::CheckedCast(group_->mailbox_manager()->ConsumeTexture(mailbox)); if (!texture) { bool result = GenTexturesHelper(1, &client_id); DCHECK(result); LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glCreateAndConsumeTextureCHROMIUM"", ""invalid mailbox name""); return; } texture_ref = texture_manager()->Consume(client_id, texture); } ",0 "static inline int get_sd_load_idx(struct sched_domain *sd, enum cpu_idle_type idle) { int load_idx; switch (idle) { case CPU_NOT_IDLE: load_idx = sd->busy_idx; break; case CPU_NEWLY_IDLE: load_idx = sd->newidle_idx; break; default: load_idx = sd->idle_idx; break; } return load_idx; } ",0 " static WebCore::FloatSize computeRelativeOffset(const WebCore::IntPoint& absoluteOffset, const WebCore::LayoutRect& rect) { WebCore::FloatSize relativeOffset = WebCore::FloatPoint(absoluteOffset) - rect.location(); relativeOffset.scale(1.f / rect.width(), 1.f / rect.height()); return relativeOffset; } ",0 "static void nsc_decode(NSC_CONTEXT* context) { UINT16 x; UINT16 y; UINT16 rw = ROUND_UP_TO(context->width, 8); BYTE shift = context->ColorLossLevel - 1; /* colorloss recovery + YCoCg shift */ BYTE* bmpdata = context->BitmapData; for (y = 0; y < context->height; y++) { const BYTE* yplane; const BYTE* coplane; const BYTE* cgplane; const BYTE* aplane = context->priv->PlaneBuffers[3] + y * context->width; /* A */ if (context->ChromaSubsamplingLevel) { yplane = context->priv->PlaneBuffers[0] + y * rw; /* Y */ coplane = context->priv->PlaneBuffers[1] + (y >> 1) * (rw >> 1); /* Co, supersampled */ cgplane = context->priv->PlaneBuffers[2] + (y >> 1) * (rw >> 1); /* Cg, supersampled */ } else { yplane = context->priv->PlaneBuffers[0] + y * context->width; /* Y */ coplane = context->priv->PlaneBuffers[1] + y * context->width; /* Co */ cgplane = context->priv->PlaneBuffers[2] + y * context->width; /* Cg */ } for (x = 0; x < context->width; x++) { INT16 y_val = (INT16) * yplane; INT16 co_val = (INT16)(INT8)(*coplane << shift); INT16 cg_val = (INT16)(INT8)(*cgplane << shift); INT16 r_val = y_val + co_val - cg_val; INT16 g_val = y_val + cg_val; INT16 b_val = y_val - co_val - cg_val; *bmpdata++ = MINMAX(b_val, 0, 0xFF); *bmpdata++ = MINMAX(g_val, 0, 0xFF); *bmpdata++ = MINMAX(r_val, 0, 0xFF); *bmpdata++ = *aplane; yplane++; coplane += (context->ChromaSubsamplingLevel ? x % 2 : 1); cgplane += (context->ChromaSubsamplingLevel ? x % 2 : 1); aplane++; } } } ",1 "static inline void utf32_codepoint_to_utf8(uint8_t* dstP, char32_t srcChar, size_t bytes) { dstP += bytes; switch (bytes) { /* note: everything falls through. */ case 4: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; case 3: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; case 2: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; case 1: *--dstP = (uint8_t)(srcChar | kFirstByteMark[bytes]); } } ",0 "void qrio_gpio_direction_output(u8 port_off, u8 gpio_nr, bool value) { u32 direct, mask; void __iomem *qrio_base = (void *)CONFIG_SYS_QRIO_BASE; mask = 1U << gpio_nr; direct = in_be32(qrio_base + port_off + DIRECT_OFF); direct |= mask; out_be32(qrio_base + port_off + DIRECT_OFF, direct); qrio_set_gpio(port_off, gpio_nr, value); } ",0 "static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb) { UNIXCB(skb).secid = scm->secid; } ",0 "void CameraClient::disableMsgType(int32_t msgType) { android_atomic_and(~msgType, &mMsgEnabled); mHardware->disableMsgType(msgType); } ",0 " AllocateLockedDiscardableSharedMemoryForClient( int client_id, size_t size, int32_t id, base::SharedMemoryHandle* shared_memory_handle) { AllocateLockedDiscardableSharedMemory(client_id, size, id, shared_memory_handle); } ",0 "sparse_diff_file (int fd, struct tar_stat_info *st) { bool rc = true; struct tar_sparse_file file; size_t i; off_t offset = 0; if (!tar_sparse_init (&file)) return dump_status_not_implemented; file.stat_info = st; file.fd = fd; file.seekable = true; /* File *must* be seekable for compare to work */ rc = tar_sparse_decode_header (&file); mv_begin_read (st); for (i = 0; rc && i < file.stat_info->sparse_map_avail; i++) { rc = check_sparse_region (&file, offset, file.stat_info->sparse_map[i].offset) && check_data_region (&file, i); offset = file.stat_info->sparse_map[i].offset + file.stat_info->sparse_map[i].numbytes; } if (!rc) skip_file (file.stat_info->archive_file_size - file.dumped_size); mv_end (); tar_sparse_done (&file); return rc; } ",0 "static int enable_snd_device(struct audio_device *adev, struct audio_usecase *uc_info, snd_device_t snd_device, bool update_mixer) { struct mixer_card *mixer_card; struct listnode *node; const char *snd_device_name = get_snd_device_name(snd_device); if (snd_device_name == NULL) return -EINVAL; adev->snd_dev_ref_cnt[snd_device]++; if (adev->snd_dev_ref_cnt[snd_device] > 1) { ALOGV(""%s: snd_device(%d: %s) is already active"", __func__, snd_device, snd_device_name); return 0; } ALOGV(""%s: snd_device(%d: %s)"", __func__, snd_device, snd_device_name); list_for_each(node, &uc_info->mixer_list) { mixer_card = node_to_item(node, struct mixer_card, uc_list_node[uc_info->id]); audio_route_apply_path(mixer_card->audio_route, snd_device_name); if (update_mixer) audio_route_update_mixer(mixer_card->audio_route); } return 0; } ",0 "cifs_read(struct file *file, char *read_data, size_t read_size, loff_t *offset) { int rc = -EACCES; unsigned int bytes_read = 0; unsigned int total_read; unsigned int current_read_size; unsigned int rsize; struct cifs_sb_info *cifs_sb; struct cifs_tcon *tcon; struct TCP_Server_Info *server; unsigned int xid; char *cur_offset; struct cifsFileInfo *open_file; struct cifs_io_parms io_parms; int buf_type = CIFS_NO_BUFFER; __u32 pid; xid = get_xid(); cifs_sb = CIFS_SB(file->f_path.dentry->d_sb); /* FIXME: set up handlers for larger reads and/or convert to async */ rsize = min_t(unsigned int, cifs_sb->rsize, CIFSMaxBufSize); if (file->private_data == NULL) { rc = -EBADF; free_xid(xid); return rc; } open_file = file->private_data; tcon = tlink_tcon(open_file->tlink); server = tcon->ses->server; if (!server->ops->sync_read) { free_xid(xid); return -ENOSYS; } if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD) pid = open_file->pid; else pid = current->tgid; if ((file->f_flags & O_ACCMODE) == O_WRONLY) cifs_dbg(FYI, ""attempting read on write only file instance\n""); for (total_read = 0, cur_offset = read_data; read_size > total_read; total_read += bytes_read, cur_offset += bytes_read) { current_read_size = min_t(uint, read_size - total_read, rsize); /* * For windows me and 9x we do not want to request more than it * negotiated since it will refuse the read then. */ if ((tcon->ses) && !(tcon->ses->capabilities & tcon->ses->server->vals->cap_large_files)) { current_read_size = min_t(uint, current_read_size, CIFSMaxBufSize); } rc = -EAGAIN; while (rc == -EAGAIN) { if (open_file->invalidHandle) { rc = cifs_reopen_file(open_file, true); if (rc != 0) break; } io_parms.pid = pid; io_parms.tcon = tcon; io_parms.offset = *offset; io_parms.length = current_read_size; rc = server->ops->sync_read(xid, open_file, &io_parms, &bytes_read, &cur_offset, &buf_type); } if (rc || (bytes_read == 0)) { if (total_read) { break; } else { free_xid(xid); return rc; } } else { cifs_stats_bytes_read(tcon, total_read); *offset += bytes_read; } } free_xid(xid); return total_read; } ",0 "bool smbXcli_session_is_authenticated(struct smbXcli_session *session) { const DATA_BLOB *application_key; if (session->conn == NULL) { return false; } /* * If we have an application key we had a session key negotiated * at auth time. */ if (session->conn->protocol >= PROTOCOL_SMB2_02) { application_key = &session->smb2->application_key; } else { application_key = &session->smb1.application_key; } if (application_key->length == 0) { return false; } return true; } ",0 "std::unique_ptr SparseHistogram::SnapshotFinalDelta() const { DCHECK(!final_delta_created_); final_delta_created_ = true; std::unique_ptr snapshot(new SampleMap(name_hash())); base::AutoLock auto_lock(lock_); snapshot->Add(*samples_); snapshot->Subtract(*logged_samples_); return std::move(snapshot); } ",0 "static int pop_hcache_namer(const char *path, char *dest, size_t destlen) { return snprintf(dest, destlen, ""%s."" HC_FEXT, path); } ",0 "void TestingAutomationProvider::GetIndicesFromTab( DictionaryValue* args, IPC::Message* reply_message) { AutomationJSONReply reply(this, reply_message); int id_or_handle = 0; bool has_id = args->HasKey(""tab_id""); bool has_handle = args->HasKey(""tab_handle""); if (has_id && has_handle) { reply.SendError( ""Both 'tab_id' and 'tab_handle' were specified. Only one is allowed""); return; } else if (!has_id && !has_handle) { reply.SendError(""Either 'tab_id' or 'tab_handle' must be specified""); return; } if (has_id && !args->GetInteger(""tab_id"", &id_or_handle)) { reply.SendError(""'tab_id' is invalid""); return; } if (has_handle && (!args->GetInteger(""tab_handle"", &id_or_handle) || !tab_tracker_->ContainsHandle(id_or_handle))) { reply.SendError(""'tab_handle' is invalid""); return; } int id = id_or_handle; if (has_handle) { TabContentsWrapper* tab = TabContentsWrapper::GetCurrentWrapperForContents( tab_tracker_->GetResource(id_or_handle)->GetWebContents()); id = tab->restore_tab_helper()->session_id().id(); } BrowserList::const_iterator iter = BrowserList::begin(); int browser_index = 0; for (; iter != BrowserList::end(); ++iter, ++browser_index) { Browser* browser = *iter; for (int tab_index = 0; tab_index < browser->tab_count(); ++tab_index) { TabContentsWrapper* tab = browser->GetTabContentsWrapperAt(tab_index); if (tab->restore_tab_helper()->session_id().id() == id) { DictionaryValue dict; dict.SetInteger(""windex"", browser_index); dict.SetInteger(""tab_index"", tab_index); reply.SendSuccess(&dict); return; } } } reply.SendError(""Could not find tab among current browser windows""); } ",0 "FontSelector* RenderMenuList::fontSelector() const { return document()->styleSelector()->fontSelector(); } ",0 "void AeroPeekManager::TabSelectedAt(TabContents* old_contents, TabContents* new_contents, int index, bool user_gesture) { AeroPeekWindow* old_window = GetAeroPeekWindow(GetTabID(old_contents)); if (old_window) old_window->Deactivate(); AeroPeekWindow* new_window = GetAeroPeekWindow(GetTabID(new_contents)); if (new_window) new_window->Activate(); } ",0 "static void activityLoggingGetterPerWorldBindingsLongAttributeAttributeGetter(const v8::PropertyCallbackInfo& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); v8SetReturnValueInt(info, imp->activityLoggingGetterPerWorldBindingsLongAttribute()); } ",0 "AP_DECLARE(const char *) ap_auth_name(request_rec *r) { if (authn_ap_auth_name) { return authn_ap_auth_name(r); } return NULL; } ",0 "int create_flush_cmd_control(struct f2fs_sb_info *sbi) { dev_t dev = sbi->sb->s_bdev->bd_dev; struct flush_cmd_control *fcc; int err = 0; if (SM_I(sbi)->fcc_info) { fcc = SM_I(sbi)->fcc_info; goto init_thread; } fcc = kzalloc(sizeof(struct flush_cmd_control), GFP_KERNEL); if (!fcc) return -ENOMEM; atomic_set(&fcc->issued_flush, 0); atomic_set(&fcc->issing_flush, 0); init_waitqueue_head(&fcc->flush_wait_queue); init_llist_head(&fcc->issue_list); SM_I(sbi)->fcc_info = fcc; init_thread: fcc->f2fs_issue_flush = kthread_run(issue_flush_thread, sbi, ""f2fs_flush-%u:%u"", MAJOR(dev), MINOR(dev)); if (IS_ERR(fcc->f2fs_issue_flush)) { err = PTR_ERR(fcc->f2fs_issue_flush); kfree(fcc); SM_I(sbi)->fcc_info = NULL; return err; } return err; } ",1 "bool ParseCIDRBlock(const std::string& cidr_literal, IPAddressNumber* ip_number, size_t* prefix_length_in_bits) { std::vector parts; base::SplitString(cidr_literal, '/', &parts); if (parts.size() != 2) return false; if (!ParseIPLiteralToNumber(parts[0], ip_number)) return false; int number_of_bits = -1; if (!base::StringToInt(parts[1], &number_of_bits)) return false; if (number_of_bits < 0 || number_of_bits > static_cast(ip_number->size() * 8)) return false; *prefix_length_in_bits = static_cast(number_of_bits); return true; } ",0 "CommandBufferProxyImpl::~CommandBufferProxyImpl() { for (auto& observer : deletion_observers_) observer.OnWillDeleteImpl(); DisconnectChannel(); } ",0 "void RTCVoidRequestImpl::requestFailed(const String& error) { if (m_errorCallback.get()) m_errorCallback->handleEvent(error); clear(); } ",0 "static unsigned int cqspi_calc_rdreg(struct spi_nor *nor, const u8 opcode) { struct cqspi_flash_pdata *f_pdata = nor->priv; u32 rdreg = 0; rdreg |= f_pdata->inst_width << CQSPI_REG_RD_INSTR_TYPE_INSTR_LSB; rdreg |= f_pdata->addr_width << CQSPI_REG_RD_INSTR_TYPE_ADDR_LSB; rdreg |= f_pdata->data_width << CQSPI_REG_RD_INSTR_TYPE_DATA_LSB; return rdreg; } ",0 "bool SVGDocumentExtensions::isElementPendingResource(Element* element, const AtomicString& id) const { ASSERT(element); if (!hasPendingResource(id)) return false; return m_pendingResources.get(id)->contains(element); } ",0 "WORD32 ih264d_set_params(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op) { dec_struct_t * ps_dec; WORD32 ret = IV_SUCCESS; ivd_ctl_set_config_ip_t *ps_ctl_ip = (ivd_ctl_set_config_ip_t *)pv_api_ip; ivd_ctl_set_config_op_t *ps_ctl_op = (ivd_ctl_set_config_op_t *)pv_api_op; ps_dec = (dec_struct_t *)(dec_hdl->pv_codec_handle); ps_dec->u4_skip_frm_mask = 0; ps_ctl_op->u4_error_code = 0; ps_dec->i4_app_skip_mode = ps_ctl_ip->e_frm_skip_mode; /*Is it really supported test it when you so the corner testing using test app*/ if(ps_ctl_ip->e_frm_skip_mode != IVD_SKIP_NONE) { if(ps_ctl_ip->e_frm_skip_mode == IVD_SKIP_P) ps_dec->u4_skip_frm_mask |= 1 << P_SLC_BIT; else if(ps_ctl_ip->e_frm_skip_mode == IVD_SKIP_B) ps_dec->u4_skip_frm_mask |= 1 << B_SLC_BIT; else if(ps_ctl_ip->e_frm_skip_mode == IVD_SKIP_PB) { ps_dec->u4_skip_frm_mask |= 1 << B_SLC_BIT; ps_dec->u4_skip_frm_mask |= 1 << P_SLC_BIT; } else if(ps_ctl_ip->e_frm_skip_mode == IVD_SKIP_I) ps_dec->u4_skip_frm_mask |= 1 << I_SLC_BIT; else { ps_ctl_op->u4_error_code = (1 << IVD_UNSUPPORTEDPARAM); ret = IV_FAIL; } } if((0 != ps_dec->u4_app_disp_width) && (ps_ctl_ip->u4_disp_wd != ps_dec->u4_app_disp_width)) { ps_ctl_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM); ps_ctl_op->u4_error_code |= ERROR_DISP_WIDTH_INVALID; ret = IV_FAIL; } else { if((ps_ctl_ip->u4_disp_wd >= ps_dec->u2_pic_wd)/* && (ps_ctl_ip->u4_disp_wd <= ps_dec->u4_width_at_init) */) { ps_dec->u4_app_disp_width = ps_ctl_ip->u4_disp_wd; } else if((0 == ps_dec->i4_header_decoded) /*&& (ps_ctl_ip->u4_disp_wd <= ps_dec->u4_width_at_init)*/) { ps_dec->u4_app_disp_width = ps_ctl_ip->u4_disp_wd; } else if(ps_ctl_ip->u4_disp_wd == 0) { ps_dec->u4_app_disp_width = 0; } else { /* * Set the display width to zero. This will ensure that the wrong value we had stored (0xFFFFFFFF) * does not propogate. */ ps_dec->u4_app_disp_width = 0; ps_ctl_op->u4_error_code |= (1 << IVD_UNSUPPORTEDPARAM); ps_ctl_op->u4_error_code |= ERROR_DISP_WIDTH_INVALID; ret = IV_FAIL; } } if(ps_ctl_ip->e_vid_dec_mode == IVD_DECODE_FRAME) ps_dec->i4_decode_header = 0; else if(ps_ctl_ip->e_vid_dec_mode == IVD_DECODE_HEADER) ps_dec->i4_decode_header = 1; else { ps_ctl_op->u4_error_code = (1 << IVD_UNSUPPORTEDPARAM); ps_dec->i4_decode_header = 1; ret = IV_FAIL; } return ret; } ",0 "WebsiteSettingsPopupView::WebsiteSettingsPopupView( views::View* anchor_view, gfx::NativeView parent_window, Profile* profile, content::WebContents* web_contents, const GURL& url, const content::SSLStatus& ssl) : BubbleDelegateView(anchor_view, views::BubbleBorder::TOP_LEFT), web_contents_(web_contents), header_(nullptr), tabbed_pane_(nullptr), permissions_tab_(nullptr), site_data_content_(nullptr), cookie_dialog_link_(nullptr), permissions_content_(nullptr), connection_tab_(nullptr), identity_info_content_(nullptr), certificate_dialog_link_(nullptr), reset_decisions_button_(nullptr), help_center_content_(nullptr), cert_id_(0), help_center_link_(nullptr), connection_info_content_(nullptr), weak_factory_(this) { set_parent_window(parent_window); set_anchor_view_insets(gfx::Insets(kLocationIconVerticalMargin, 0, kLocationIconVerticalMargin, 0)); views::GridLayout* layout = new views::GridLayout(this); SetLayoutManager(layout); const int content_column = 0; views::ColumnSet* column_set = layout->AddColumnSet(content_column); column_set->AddColumn(views::GridLayout::FILL, views::GridLayout::FILL, 1, views::GridLayout::USE_PREF, 0, 0); header_ = new PopupHeaderView(this); layout->StartRow(1, content_column); layout->AddView(header_); layout->AddPaddingRow(1, kHeaderMarginBottom); tabbed_pane_ = new views::TabbedPane(); layout->StartRow(1, content_column); layout->AddView(tabbed_pane_); permissions_tab_ = CreatePermissionsTab(); tabbed_pane_->AddTabAtIndex( TAB_ID_PERMISSIONS, l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_PERMISSIONS), permissions_tab_); connection_tab_ = CreateConnectionTab(); tabbed_pane_->AddTabAtIndex( TAB_ID_CONNECTION, l10n_util::GetStringUTF16(IDS_WEBSITE_SETTINGS_TAB_LABEL_CONNECTION), connection_tab_); DCHECK_EQ(tabbed_pane_->GetTabCount(), NUM_TAB_IDS); tabbed_pane_->set_listener(this); set_margins(gfx::Insets(kPopupMarginTop, kPopupMarginLeft, kPopupMarginBottom, kPopupMarginRight)); views::BubbleDelegateView::CreateBubble(this); presenter_.reset(new WebsiteSettings( this, profile, TabSpecificContentSettings::FromWebContents(web_contents), InfoBarService::FromWebContents(web_contents), url, ssl, content::CertStore::GetInstance())); } ",1 "static inline bool nested_cpu_has_xsaves(struct vmcs12 *vmcs12) { return nested_cpu_has2(vmcs12, SECONDARY_EXEC_XSAVES); } ",0 "void DevToolsUIBindings::SetPreference(const std::string& name, const std::string& value) { DictionaryPrefUpdate update(profile_->GetPrefs(), prefs::kDevToolsPreferences); update.Get()->SetStringWithoutPathExpansion(name, value); } ",0 "BlockDriverState *bdrv_find_overlay(BlockDriverState *active, BlockDriverState *bs) { BlockDriverState *overlay = NULL; BlockDriverState *intermediate; assert(active != NULL); assert(bs != NULL); /* if bs is the same as active, then by definition it has no overlay */ if (active == bs) { return NULL; } intermediate = active; while (intermediate->backing_hd) { if (intermediate->backing_hd == bs) { overlay = intermediate; break; } intermediate = intermediate->backing_hd; } return overlay; } ",0 "int bt_sock_wait_ready(struct sock *sk, unsigned long flags) { DECLARE_WAITQUEUE(wait, current); unsigned long timeo; int err = 0; BT_DBG(""sk %p"", sk); timeo = sock_sndtimeo(sk, flags & O_NONBLOCK); add_wait_queue(sk_sleep(sk), &wait); set_current_state(TASK_INTERRUPTIBLE); while (test_bit(BT_SK_SUSPEND, &bt_sk(sk)->flags)) { if (!timeo) { err = -EAGAIN; break; } if (signal_pending(current)) { err = sock_intr_errno(timeo); break; } release_sock(sk); timeo = schedule_timeout(timeo); lock_sock(sk); set_current_state(TASK_INTERRUPTIBLE); err = sock_error(sk); if (err) break; } __set_current_state(TASK_RUNNING); remove_wait_queue(sk_sleep(sk), &wait); return err; } ",0 "int default_wake_function(wait_queue_t *curr, unsigned mode, int wake_flags, void *key) { return try_to_wake_up(curr->private, mode, wake_flags); } ",0 "static int compat_rawv6_setsockopt(struct sock *sk, int level, int optname, char __user *optval, unsigned int optlen) { switch (level) { case SOL_RAW: break; case SOL_ICMPV6: if (inet_sk(sk)->inet_num != IPPROTO_ICMPV6) return -EOPNOTSUPP; return rawv6_seticmpfilter(sk, level, optname, optval, optlen); case SOL_IPV6: if (optname == IPV6_CHECKSUM) break; default: return compat_ipv6_setsockopt(sk, level, optname, optval, optlen); } return do_rawv6_setsockopt(sk, level, optname, optval, optlen); } ",0 "void SessionService::BuildCommandsForBrowser( Browser* browser, std::vector* commands, IdToRange* tab_to_available_range, std::set* windows_to_track) { DCHECK(browser && commands); DCHECK(browser->session_id().id()); ui::WindowShowState show_state = ui::SHOW_STATE_NORMAL; if (browser->window()->IsMaximized()) show_state = ui::SHOW_STATE_MAXIMIZED; else if (browser->window()->IsMinimized()) show_state = ui::SHOW_STATE_MINIMIZED; commands->push_back( CreateSetWindowBoundsCommand(browser->session_id(), browser->window()->GetRestoredBounds(), show_state)); commands->push_back(CreateSetWindowTypeCommand( browser->session_id(), WindowTypeForBrowserType(browser->type()))); bool added_to_windows_to_track = false; for (int i = 0; i < browser->tab_count(); ++i) { TabContentsWrapper* tab = browser->GetTabContentsWrapperAt(i); DCHECK(tab); if (tab->profile() == profile() || profile() == NULL) { BuildCommandsForTab(browser->session_id(), tab, i, browser->IsTabPinned(i), commands, tab_to_available_range); if (windows_to_track && !added_to_windows_to_track) { windows_to_track->insert(browser->session_id().id()); added_to_windows_to_track = true; } } } commands->push_back( CreateSetSelectedTabInWindow(browser->session_id(), browser->active_index())); } ",0 "void snd_interval_mul(const struct snd_interval *a, const struct snd_interval *b, struct snd_interval *c) { if (a->empty || b->empty) { snd_interval_none(c); return; } c->empty = 0; c->min = mul(a->min, b->min); c->openmin = (a->openmin || b->openmin); c->max = mul(a->max, b->max); c->openmax = (a->openmax || b->openmax); c->integer = (a->integer && b->integer); } ",0 "static int query_formats(AVFilterContext *ctx) { static const enum PixelFormat pix_fmts[] = { AV_PIX_FMT_YUV420P, AV_PIX_FMT_YUYV422, AV_PIX_FMT_ARGB, AV_PIX_FMT_0RGB, AV_PIX_FMT_ABGR, AV_PIX_FMT_0BGR, AV_PIX_FMT_RGBA, AV_PIX_FMT_RGB0, AV_PIX_FMT_BGRA, AV_PIX_FMT_BGR0, AV_PIX_FMT_NONE }; ff_set_common_formats(ctx, ff_make_format_list(pix_fmts)); return 0; } ",0 "void RenderFrameHostImpl::InsertVisualStateCallback( const VisualStateCallback& callback) { static uint64_t next_id = 1; uint64_t key = next_id++; Send(new FrameMsg_VisualStateRequest(routing_id_, key)); visual_state_callbacks_.insert(std::make_pair(key, callback)); } ",0 "free_config_tinker( config_tree *ptree ) { FREE_ATTR_VAL_FIFO(ptree->tinker); } ",0 "MagickExport ImageInfo *CloneImageInfo(const ImageInfo *image_info) { ImageInfo *clone_info; clone_info=AcquireImageInfo(); if (image_info == (ImageInfo *) NULL) return(clone_info); clone_info->compression=image_info->compression; clone_info->temporary=image_info->temporary; clone_info->adjoin=image_info->adjoin; clone_info->antialias=image_info->antialias; clone_info->scene=image_info->scene; clone_info->number_scenes=image_info->number_scenes; clone_info->depth=image_info->depth; (void) CloneString(&clone_info->size,image_info->size); (void) CloneString(&clone_info->extract,image_info->extract); (void) CloneString(&clone_info->scenes,image_info->scenes); (void) CloneString(&clone_info->page,image_info->page); clone_info->interlace=image_info->interlace; clone_info->endian=image_info->endian; clone_info->units=image_info->units; clone_info->quality=image_info->quality; (void) CloneString(&clone_info->sampling_factor,image_info->sampling_factor); (void) CloneString(&clone_info->server_name,image_info->server_name); (void) CloneString(&clone_info->font,image_info->font); (void) CloneString(&clone_info->texture,image_info->texture); (void) CloneString(&clone_info->density,image_info->density); clone_info->pointsize=image_info->pointsize; clone_info->fuzz=image_info->fuzz; clone_info->alpha_color=image_info->alpha_color; clone_info->background_color=image_info->background_color; clone_info->border_color=image_info->border_color; clone_info->transparent_color=image_info->transparent_color; clone_info->dither=image_info->dither; clone_info->monochrome=image_info->monochrome; clone_info->colorspace=image_info->colorspace; clone_info->type=image_info->type; clone_info->orientation=image_info->orientation; clone_info->ping=image_info->ping; clone_info->verbose=image_info->verbose; clone_info->progress_monitor=image_info->progress_monitor; clone_info->client_data=image_info->client_data; clone_info->cache=image_info->cache; if (image_info->cache != (void *) NULL) clone_info->cache=ReferencePixelCache(image_info->cache); if (image_info->profile != (void *) NULL) clone_info->profile=(void *) CloneStringInfo((StringInfo *) image_info->profile); SetImageInfoFile(clone_info,image_info->file); SetImageInfoBlob(clone_info,image_info->blob,image_info->length); clone_info->stream=image_info->stream; (void) CopyMagickString(clone_info->magick,image_info->magick, MagickPathExtent); (void) CopyMagickString(clone_info->unique,image_info->unique, MagickPathExtent); (void) CopyMagickString(clone_info->filename,image_info->filename, MagickPathExtent); clone_info->channel=image_info->channel; (void) CloneImageOptions(clone_info,image_info); clone_info->debug=IsEventLogging(); clone_info->signature=image_info->signature; return(clone_info); } ",0 "static inline void ModulateHSB(const double percent_hue, const double percent_saturation,const double percent_brightness,double *red, double *green,double *blue) { double brightness, hue, saturation; /* Increase or decrease color brightness, saturation, or hue. */ ConvertRGBToHSB(*red,*green,*blue,&hue,&saturation,&brightness); hue+=0.5*(0.01*percent_hue-1.0); while (hue < 0.0) hue+=1.0; while (hue > 1.0) hue-=1.0; saturation*=0.01*percent_saturation; brightness*=0.01*percent_brightness; ConvertHSBToRGB(hue,saturation,brightness,red,green,blue); } ",0 "void WebRuntimeFeatures::EnableCompositorTouchAction(bool enable) { RuntimeEnabledFeatures::SetCompositorTouchActionEnabled(enable); } ",0 "void GLES2DecoderImpl::DoBindRenderbuffer(GLenum target, GLuint client_id) { Renderbuffer* renderbuffer = NULL; GLuint service_id = 0; if (client_id != 0) { renderbuffer = GetRenderbuffer(client_id); if (!renderbuffer) { if (!group_->bind_generates_resource()) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, ""glBindRenderbuffer"", ""id not generated by glGenRenderbuffers""); return; } glGenRenderbuffersEXT(1, &service_id); CreateRenderbuffer(client_id, service_id); renderbuffer = GetRenderbuffer(client_id); IdAllocatorInterface* id_allocator = group_->GetIdAllocator(id_namespaces::kRenderbuffers); id_allocator->MarkAsUsed(client_id); } else { service_id = renderbuffer->service_id(); } renderbuffer->MarkAsValid(); } LogClientServiceForInfo(renderbuffer, client_id, ""glBindRenderbuffer""); state_.bound_renderbuffer = renderbuffer; glBindRenderbufferEXT(target, service_id); } ",0 "static int virtnet_vlan_rx_kill_vid(struct net_device *dev, __be16 proto, u16 vid) { struct virtnet_info *vi = netdev_priv(dev); struct scatterlist sg; sg_init_one(&sg, &vid, sizeof(vid)); if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, VIRTIO_NET_CTRL_VLAN_DEL, &sg)) dev_warn(&dev->dev, ""Failed to kill VLAN ID %d.\n"", vid); return 0; } ",0 "static int nr_create(struct net *net, struct socket *sock, int protocol, int kern) { struct sock *sk; struct nr_sock *nr; if (!net_eq(net, &init_net)) return -EAFNOSUPPORT; if (sock->type != SOCK_SEQPACKET || protocol != 0) return -ESOCKTNOSUPPORT; sk = sk_alloc(net, PF_NETROM, GFP_ATOMIC, &nr_proto); if (sk == NULL) return -ENOMEM; nr = nr_sk(sk); sock_init_data(sock, sk); sock->ops = &nr_proto_ops; sk->sk_protocol = protocol; skb_queue_head_init(&nr->ack_queue); skb_queue_head_init(&nr->reseq_queue); skb_queue_head_init(&nr->frag_queue); nr_init_timers(sk); nr->t1 = msecs_to_jiffies(sysctl_netrom_transport_timeout); nr->t2 = msecs_to_jiffies(sysctl_netrom_transport_acknowledge_delay); nr->n2 = msecs_to_jiffies(sysctl_netrom_transport_maximum_tries); nr->t4 = msecs_to_jiffies(sysctl_netrom_transport_busy_delay); nr->idle = msecs_to_jiffies(sysctl_netrom_transport_no_activity_timeout); nr->window = sysctl_netrom_transport_requested_window_size; nr->bpqext = 1; nr->state = NR_STATE_0; return 0; } ",0 "group_is_overloaded(struct lb_env *env, struct sg_lb_stats *sgs) { if (sgs->sum_nr_running <= sgs->group_weight) return false; if ((sgs->group_capacity * 100) < (sgs->group_util * env->sd->imbalance_pct)) return true; return false; } ",0 " static void __exit exit_ext2_fs(void) { unregister_filesystem(&ext2_fs_type); destroy_inodecache(); exit_ext2_xattr(); } ",1 " WebviewHandler::WebviewHandler() { } ",0 " virtual void ConnectToWifiNetwork(const WifiNetwork* network, const std::string& password, const std::string& identity, const std::string& certpath) {} ",0 "irc_server_recv_cb (void *data, int fd) { struct t_irc_server *server; static char buffer[4096 + 2]; int num_read; /* make C compiler happy */ (void) fd; server = (struct t_irc_server *)data; if (!server) return WEECHAT_RC_ERROR; #ifdef HAVE_GNUTLS if (server->ssl_connected) num_read = gnutls_record_recv (server->gnutls_sess, buffer, sizeof (buffer) - 2); else #endif num_read = recv (server->sock, buffer, sizeof (buffer) - 2, 0); if (num_read > 0) { buffer[num_read] = '\0'; irc_server_msgq_add_buffer (server, buffer); irc_server_msgq_flush (); } else { #ifdef HAVE_GNUTLS if (server->ssl_connected) { if ((num_read == 0) || ((num_read != GNUTLS_E_AGAIN) && (num_read != GNUTLS_E_INTERRUPTED))) { weechat_printf (server->buffer, _(""%s%s: reading data on socket: error %d %s""), weechat_prefix (""error""), IRC_PLUGIN_NAME, num_read, (num_read == 0) ? _(""(connection closed by peer)"") : gnutls_strerror (num_read)); weechat_printf (server->buffer, _(""%s: disconnecting from server...""), IRC_PLUGIN_NAME); irc_server_disconnect (server, !server->is_connected, 1); } } else #endif { if ((num_read == 0) || ((errno != EAGAIN) && (errno != EWOULDBLOCK))) { weechat_printf (server->buffer, _(""%s%s: reading data on socket: error %d %s""), weechat_prefix (""error""), IRC_PLUGIN_NAME, errno, (num_read == 0) ? _(""(connection closed by peer)"") : strerror (errno)); weechat_printf (server->buffer, _(""%s: disconnecting from server...""), IRC_PLUGIN_NAME); irc_server_disconnect (server, !server->is_connected, 1); } } } return WEECHAT_RC_OK; } ",0 "void FeatureInfo::InitializeBasicState(const base::CommandLine* command_line) { if (!command_line) return; feature_flags_.enable_shader_name_hashing = !command_line->HasSwitch(switches::kDisableShaderNameHashing); feature_flags_.is_swiftshader_for_webgl = (command_line->GetSwitchValueASCII(switches::kUseGL) == gl::kGLImplementationSwiftShaderForWebGLName); feature_flags_.is_swiftshader = (command_line->GetSwitchValueASCII(switches::kUseGL) == gl::kGLImplementationSwiftShaderName); disable_shader_translator_ = command_line->HasSwitch(switches::kDisableGLSLTranslator); } ",0 "static inline int is_atext(char ch) { switch (ch) { case ' ': case '\t': case '\n': case '\r': #if 0 case '(': case ')': #endif case '<': case '>': #if 0 case '@': #endif case ',': case '""': case ':': case ';': return FALSE; default: return TRUE; } } ",0 "path_mountpoint(struct nameidata *nd, unsigned flags, struct path *path) { const char *s = path_init(nd, flags); int err; if (IS_ERR(s)) return PTR_ERR(s); while (!(err = link_path_walk(s, nd)) && (err = mountpoint_last(nd)) > 0) { s = trailing_symlink(nd); if (IS_ERR(s)) { err = PTR_ERR(s); break; } } if (!err) { *path = nd->path; nd->path.mnt = NULL; nd->path.dentry = NULL; follow_mount(path); } terminate_walk(nd); return err; } ",0 "int Section::GetHeightForWidth(int width) { int height = 0; gfx::Size size = title_label_->GetPreferredSize(); height += size.height() + kVGapTitleToImage; gfx::Size image_size = status_image_->GetPreferredSize(); int text_height = 0; if (!head_line_label_->GetText().empty()) { size = head_line_label_->GetPreferredSize(); text_height = size.height() + kVGapHeadLineToDescription; } int description_width = width - image_size.width() - kHGapImageToDescription - kHGapToBorder; text_height += description_label_->GetHeightForWidth(description_width); height += std::max(image_size.height(), text_height); return height; } ",0 "intro_point_should_expire_now(rend_intro_point_t *intro, time_t now) { tor_assert(intro != NULL); if (intro->time_published == -1) { /* Don't expire an intro point if we haven't even published it yet. */ return 0; } if (intro_point_accepted_intro_count(intro) >= intro->max_introductions) { /* This intro point has been used too many times. Expire it now. */ return 1; } if (intro->time_to_expire == -1) { /* This intro point has been published, but we haven't picked an * expiration time for it. Pick one now. */ int intro_point_lifetime_seconds = crypto_rand_int_range(INTRO_POINT_LIFETIME_MIN_SECONDS, INTRO_POINT_LIFETIME_MAX_SECONDS); /* Start the expiration timer now, rather than when the intro * point was first published. There shouldn't be much of a time * difference. */ intro->time_to_expire = now + intro_point_lifetime_seconds; return 0; } /* This intro point has a time to expire set already. Use it. */ return (now >= intro->time_to_expire); } ",0 "bool RenderFrameImpl::IsPasting() { return is_pasting_; } ",0 "void HTMLMediaElement::setIgnorePreloadNone() { BLINK_MEDIA_LOG << ""setIgnorePreloadNone("" << (void*)this << "")""; m_ignorePreloadNone = true; setPlayerPreload(); } ",0 "print_lcp_config_options(netdissect_options *ndo, const u_char *p, int length) { int len, opt; if (length < 2) return 0; ND_TCHECK2(*p, 2); len = p[1]; opt = p[0]; if (length < len) return 0; if (len < 2) { if ((opt >= LCPOPT_MIN) && (opt <= LCPOPT_MAX)) ND_PRINT((ndo, ""\n\t %s Option (0x%02x), length %u (length bogus, should be >= 2)"", lcpconfopts[opt], opt, len)); else ND_PRINT((ndo, ""\n\tunknown LCP option 0x%02x"", opt)); return 0; } if ((opt >= LCPOPT_MIN) && (opt <= LCPOPT_MAX)) ND_PRINT((ndo, ""\n\t %s Option (0x%02x), length %u"", lcpconfopts[opt], opt, len)); else { ND_PRINT((ndo, ""\n\tunknown LCP option 0x%02x"", opt)); return len; } switch (opt) { case LCPOPT_VEXT: if (len < 6) { ND_PRINT((ndo, "" (length bogus, should be >= 6)"")); return len; } ND_TCHECK_24BITS(p + 2); ND_PRINT((ndo, "": Vendor: %s (%u)"", tok2str(oui_values,""Unknown"",EXTRACT_24BITS(p+2)), EXTRACT_24BITS(p + 2))); #if 0 ND_TCHECK(p[5]); ND_PRINT((ndo, "", kind: 0x%02x"", p[5])); ND_PRINT((ndo, "", Value: 0x"")); for (i = 0; i < len - 6; i++) { ND_TCHECK(p[6 + i]); ND_PRINT((ndo, ""%02x"", p[6 + i])); } #endif break; case LCPOPT_MRU: if (len != 4) { ND_PRINT((ndo, "" (length bogus, should be = 4)"")); return len; } ND_TCHECK_16BITS(p + 2); ND_PRINT((ndo, "": %u"", EXTRACT_16BITS(p + 2))); break; case LCPOPT_ACCM: if (len != 6) { ND_PRINT((ndo, "" (length bogus, should be = 6)"")); return len; } ND_TCHECK_32BITS(p + 2); ND_PRINT((ndo, "": 0x%08x"", EXTRACT_32BITS(p + 2))); break; case LCPOPT_AP: if (len < 4) { ND_PRINT((ndo, "" (length bogus, should be >= 4)"")); return len; } ND_TCHECK_16BITS(p + 2); ND_PRINT((ndo, "": %s"", tok2str(ppptype2str, ""Unknown Auth Proto (0x04x)"", EXTRACT_16BITS(p + 2)))); switch (EXTRACT_16BITS(p+2)) { case PPP_CHAP: ND_TCHECK(p[4]); ND_PRINT((ndo, "", %s"", tok2str(authalg_values, ""Unknown Auth Alg %u"", p[4]))); break; case PPP_PAP: /* fall through */ case PPP_EAP: case PPP_SPAP: case PPP_SPAP_OLD: break; default: print_unknown_data(ndo, p, ""\n\t"", len); } break; case LCPOPT_QP: if (len < 4) { ND_PRINT((ndo, "" (length bogus, should be >= 4)"")); return 0; } ND_TCHECK_16BITS(p+2); if (EXTRACT_16BITS(p+2) == PPP_LQM) ND_PRINT((ndo, "": LQR"")); else ND_PRINT((ndo, "": unknown"")); break; case LCPOPT_MN: if (len != 6) { ND_PRINT((ndo, "" (length bogus, should be = 6)"")); return 0; } ND_TCHECK_32BITS(p + 2); ND_PRINT((ndo, "": 0x%08x"", EXTRACT_32BITS(p + 2))); break; case LCPOPT_PFC: break; case LCPOPT_ACFC: break; case LCPOPT_LD: if (len != 4) { ND_PRINT((ndo, "" (length bogus, should be = 4)"")); return 0; } ND_TCHECK_16BITS(p + 2); ND_PRINT((ndo, "": 0x%04x"", EXTRACT_16BITS(p + 2))); break; case LCPOPT_CBACK: if (len < 3) { ND_PRINT((ndo, "" (length bogus, should be >= 3)"")); return 0; } ND_PRINT((ndo, "": "")); ND_TCHECK(p[2]); ND_PRINT((ndo, "": Callback Operation %s (%u)"", tok2str(ppp_callback_values, ""Unknown"", p[2]), p[2])); break; case LCPOPT_MLMRRU: if (len != 4) { ND_PRINT((ndo, "" (length bogus, should be = 4)"")); return 0; } ND_TCHECK_16BITS(p + 2); ND_PRINT((ndo, "": %u"", EXTRACT_16BITS(p + 2))); break; case LCPOPT_MLED: if (len < 3) { ND_PRINT((ndo, "" (length bogus, should be >= 3)"")); return 0; } ND_TCHECK(p[2]); switch (p[2]) { /* class */ case MEDCLASS_NULL: ND_PRINT((ndo, "": Null"")); break; case MEDCLASS_LOCAL: ND_PRINT((ndo, "": Local"")); /* XXX */ break; case MEDCLASS_IPV4: if (len != 7) { ND_PRINT((ndo, "" (length bogus, should be = 7)"")); return 0; } ND_TCHECK2(*(p + 3), 4); ND_PRINT((ndo, "": IPv4 %s"", ipaddr_string(ndo, p + 3))); break; case MEDCLASS_MAC: if (len != 9) { ND_PRINT((ndo, "" (length bogus, should be = 9)"")); return 0; } ND_TCHECK2(*(p + 3), 6); ND_PRINT((ndo, "": MAC %s"", etheraddr_string(ndo, p + 3))); break; case MEDCLASS_MNB: ND_PRINT((ndo, "": Magic-Num-Block"")); /* XXX */ break; case MEDCLASS_PSNDN: ND_PRINT((ndo, "": PSNDN"")); /* XXX */ break; default: ND_PRINT((ndo, "": Unknown class %u"", p[2])); break; } break; /* XXX: to be supported */ #if 0 case LCPOPT_DEP6: case LCPOPT_FCSALT: case LCPOPT_SDP: case LCPOPT_NUMMODE: case LCPOPT_DEP12: case LCPOPT_DEP14: case LCPOPT_DEP15: case LCPOPT_DEP16: case LCPOPT_MLSSNHF: case LCPOPT_PROP: case LCPOPT_DCEID: case LCPOPT_MPP: case LCPOPT_LCPAOPT: case LCPOPT_COBS: case LCPOPT_PE: case LCPOPT_MLHF: case LCPOPT_I18N: case LCPOPT_SDLOS: case LCPOPT_PPPMUX: break; #endif default: /* * Unknown option; dump it as raw bytes now if we're * not going to do so below. */ if (ndo->ndo_vflag < 2) print_unknown_data(ndo, &p[2], ""\n\t "", len - 2); break; } if (ndo->ndo_vflag > 1) print_unknown_data(ndo, &p[2], ""\n\t "", len - 2); /* exclude TLV header */ return len; trunc: ND_PRINT((ndo, ""[|lcp]"")); return 0; } ",0 "gfx::Size DelegatedFrameHost::GetRequestedRendererSize() const { if (resize_lock_) return resize_lock_->expected_size(); else return client_->DesiredFrameSize(); } ",0 " virtual const Network* active_network() const { if (ethernet_ && ethernet_->is_active()) return ethernet_; if (wifi_ && wifi_->is_active()) return wifi_; if (cellular_ && cellular_->is_active()) return cellular_; return NULL; } ",0 "static int __udp_queue_rcv_skb(struct sock *sk, struct sk_buff *skb) { int rc; if (inet_sk(sk)->inet_daddr) { sock_rps_save_rxhash(sk, skb); sk_mark_napi_id(sk, skb); sk_incoming_cpu_update(sk); } rc = sock_queue_rcv_skb(sk, skb); if (rc < 0) { int is_udplite = IS_UDPLITE(sk); /* Note that an ENOMEM error is charged twice */ if (rc == -ENOMEM) UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_RCVBUFERRORS, is_udplite); UDP_INC_STATS_BH(sock_net(sk), UDP_MIB_INERRORS, is_udplite); kfree_skb(skb); trace_udp_fail_queue_rcv_skb(rc, sk); return -1; } return 0; } ",0 "static struct posix_acl *f2fs_acl_from_disk(const char *value, size_t size) { int i, count; struct posix_acl *acl; struct f2fs_acl_header *hdr = (struct f2fs_acl_header *)value; struct f2fs_acl_entry *entry = (struct f2fs_acl_entry *)(hdr + 1); const char *end = value + size; if (hdr->a_version != cpu_to_le32(F2FS_ACL_VERSION)) return ERR_PTR(-EINVAL); count = f2fs_acl_count(size); if (count < 0) return ERR_PTR(-EINVAL); if (count == 0) return NULL; acl = posix_acl_alloc(count, GFP_NOFS); if (!acl) return ERR_PTR(-ENOMEM); for (i = 0; i < count; i++) { if ((char *)entry > end) goto fail; acl->a_entries[i].e_tag = le16_to_cpu(entry->e_tag); acl->a_entries[i].e_perm = le16_to_cpu(entry->e_perm); switch (acl->a_entries[i].e_tag) { case ACL_USER_OBJ: case ACL_GROUP_OBJ: case ACL_MASK: case ACL_OTHER: entry = (struct f2fs_acl_entry *)((char *)entry + sizeof(struct f2fs_acl_entry_short)); break; case ACL_USER: acl->a_entries[i].e_uid = make_kuid(&init_user_ns, le32_to_cpu(entry->e_id)); entry = (struct f2fs_acl_entry *)((char *)entry + sizeof(struct f2fs_acl_entry)); break; case ACL_GROUP: acl->a_entries[i].e_gid = make_kgid(&init_user_ns, le32_to_cpu(entry->e_id)); entry = (struct f2fs_acl_entry *)((char *)entry + sizeof(struct f2fs_acl_entry)); break; default: goto fail; } } if ((char *)entry != end) goto fail; return acl; fail: posix_acl_release(acl); return ERR_PTR(-EINVAL); } ",0 "void Plugin::GetLastError(NaClSrpcArg* prop_value) { PLUGIN_PRINTF((""GetLastError (this=%p)\n"", reinterpret_cast(this))); prop_value->tag = NACL_SRPC_ARG_TYPE_STRING; prop_value->arrays.str = strdup(last_error_string().c_str()); } ",0 "static ZIPARCHIVE_METHOD(extractTo) { struct zip *intern; zval *this = getThis(); zval *zval_files = NULL; zval **zval_file = NULL; php_stream_statbuf ssb; char *pathto; int pathto_len; int ret, i; int nelems; if (!this) { RETURN_FALSE; } if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s|z"", &pathto, &pathto_len, &zval_files) == FAILURE) { return; } if (pathto_len < 1) { RETURN_FALSE; } if (php_stream_stat_path_ex(pathto, PHP_STREAM_URL_STAT_QUIET, &ssb, NULL) < 0) { ret = php_stream_mkdir(pathto, 0777, PHP_STREAM_MKDIR_RECURSIVE, NULL); if (!ret) { RETURN_FALSE; } } ZIP_FROM_OBJECT(intern, this); if (zval_files && (Z_TYPE_P(zval_files) != IS_NULL)) { switch (Z_TYPE_P(zval_files)) { case IS_STRING: if (!php_zip_extract_file(intern, pathto, Z_STRVAL_P(zval_files), Z_STRLEN_P(zval_files) TSRMLS_CC)) { RETURN_FALSE; } break; case IS_ARRAY: nelems = zend_hash_num_elements(Z_ARRVAL_P(zval_files)); if (nelems == 0 ) { RETURN_FALSE; } for (i = 0; i < nelems; i++) { if (zend_hash_index_find(Z_ARRVAL_P(zval_files), i, (void **) &zval_file) == SUCCESS) { switch (Z_TYPE_PP(zval_file)) { case IS_LONG: break; case IS_STRING: if (!php_zip_extract_file(intern, pathto, Z_STRVAL_PP(zval_file), Z_STRLEN_PP(zval_file) TSRMLS_CC)) { RETURN_FALSE; } break; } } } break; case IS_LONG: default: php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Invalid argument, expect string or array of strings""); break; } } else { /* Extract all files */ int filecount = zip_get_num_files(intern); if (filecount == -1) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""Illegal archive""); RETURN_FALSE; } for (i = 0; i < filecount; i++) { char *file = (char*)zip_get_name(intern, i, ZIP_FL_UNCHANGED); if (!php_zip_extract_file(intern, pathto, file, strlen(file) TSRMLS_CC)) { RETURN_FALSE; } } } RETURN_TRUE; } ",0 "static uint16_t tsc2102_audio_register_read(TSC210xState *s, int reg) { int l_ch, r_ch; uint16_t val; switch (reg) { case 0x00: /* Audio Control 1 */ return s->audio_ctrl1; case 0x01: return 0xff00; case 0x02: /* DAC Volume Control */ return s->volume; case 0x03: return 0x8b00; case 0x04: /* Audio Control 2 */ l_ch = 1; r_ch = 1; if (s->softstep && !(s->dac_power & (1 << 10))) { l_ch = (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) > s->volume_change + TSC_SOFTSTEP_DELAY); r_ch = (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) > s->volume_change + TSC_SOFTSTEP_DELAY); } return s->audio_ctrl2 | (l_ch << 3) | (r_ch << 2); case 0x05: /* Stereo DAC Power Control */ return 0x2aa0 | s->dac_power | (((s->dac_power & (1 << 10)) && (qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL) > s->powerdown + TSC_POWEROFF_DELAY)) << 6); case 0x06: /* Audio Control 3 */ val = s->audio_ctrl3 | 0x0001; s->audio_ctrl3 &= 0xff3f; return val; case 0x07: /* LCH_BASS_BOOST_N0 */ case 0x08: /* LCH_BASS_BOOST_N1 */ case 0x09: /* LCH_BASS_BOOST_N2 */ case 0x0a: /* LCH_BASS_BOOST_N3 */ case 0x0b: /* LCH_BASS_BOOST_N4 */ case 0x0c: /* LCH_BASS_BOOST_N5 */ case 0x0d: /* LCH_BASS_BOOST_D1 */ case 0x0e: /* LCH_BASS_BOOST_D2 */ case 0x0f: /* LCH_BASS_BOOST_D4 */ case 0x10: /* LCH_BASS_BOOST_D5 */ case 0x11: /* RCH_BASS_BOOST_N0 */ case 0x12: /* RCH_BASS_BOOST_N1 */ case 0x13: /* RCH_BASS_BOOST_N2 */ case 0x14: /* RCH_BASS_BOOST_N3 */ case 0x15: /* RCH_BASS_BOOST_N4 */ case 0x16: /* RCH_BASS_BOOST_N5 */ case 0x17: /* RCH_BASS_BOOST_D1 */ case 0x18: /* RCH_BASS_BOOST_D2 */ case 0x19: /* RCH_BASS_BOOST_D4 */ case 0x1a: /* RCH_BASS_BOOST_D5 */ return s->filter_data[reg - 0x07]; case 0x1b: /* PLL Programmability 1 */ return s->pll[0]; case 0x1c: /* PLL Programmability 2 */ return s->pll[1]; case 0x1d: /* Audio Control 4 */ return (!s->softstep) << 14; default: #ifdef TSC_VERBOSE fprintf(stderr, ""tsc2102_audio_register_read: "" ""no such register: 0x%02x\n"", reg); #endif return 0xffff; } } ",0 "String Element::outerText() { return innerText(); } ",0 "deep_count_callback (GObject *source_object, GAsyncResult *res, gpointer user_data) { DeepCountState *state; GFileEnumerator *enumerator; NautilusFile *file; state = user_data; if (state->directory == NULL) { /* Operation was cancelled. Bail out */ deep_count_state_free (state); return; } file = state->directory->details->deep_count_file; enumerator = g_file_enumerate_children_finish (G_FILE (source_object), res, NULL); if (enumerator == NULL) { file->details->deep_unreadable_count += 1; deep_count_next_dir (state); } else { state->enumerator = enumerator; g_file_enumerator_next_files_async (state->enumerator, DIRECTORY_LOAD_ITEMS_PER_CALLBACK, G_PRIORITY_LOW, state->cancellable, deep_count_more_files_callback, state); } } ",0 "HostContentSettingsMap* DownloadRequestLimiter::GetContentSettings( content::WebContents* contents) { return HostContentSettingsMapFactory::GetForProfile( Profile::FromBrowserContext(contents->GetBrowserContext())); } ",0 "void SyncBackendHost::Core::DoRequestConfig( const syncable::ModelTypeBitSet& added_types, sync_api::ConfigureReason reason) { syncapi_->RequestConfig(added_types, reason); } ",0 "static void perf_event_switch_output(struct perf_event *event, void *data) { struct perf_switch_event *se = data; struct perf_output_handle handle; struct perf_sample_data sample; int ret; if (!perf_event_switch_match(event)) return; /* Only CPU-wide events are allowed to see next/prev pid/tid */ if (event->ctx->task) { se->event_id.header.type = PERF_RECORD_SWITCH; se->event_id.header.size = sizeof(se->event_id.header); } else { se->event_id.header.type = PERF_RECORD_SWITCH_CPU_WIDE; se->event_id.header.size = sizeof(se->event_id); se->event_id.next_prev_pid = perf_event_pid(event, se->next_prev); se->event_id.next_prev_tid = perf_event_tid(event, se->next_prev); } perf_event_header__init_id(&se->event_id.header, &sample, event); ret = perf_output_begin(&handle, event, se->event_id.header.size); if (ret) return; if (event->ctx->task) perf_output_put(&handle, se->event_id.header); else perf_output_put(&handle, se->event_id); perf_event__output_id_sample(event, &handle, &sample); perf_output_end(&handle); } ",0 "static void php_imagettftext_common(INTERNAL_FUNCTION_PARAMETERS, int mode, int extended) { zval *IM, *EXT = NULL; gdImagePtr im=NULL; long col = -1, x = -1, y = -1; int str_len, fontname_len, i, brect[8]; double ptsize, angle; char *str = NULL, *fontname = NULL; char *error = NULL; int argc = ZEND_NUM_ARGS(); gdFTStringExtra strex = {0}; if (mode == TTFTEXT_BBOX) { if (argc < 4 || argc > ((extended) ? 5 : 4)) { ZEND_WRONG_PARAM_COUNT(); } else if (zend_parse_parameters(argc TSRMLS_CC, ""ddss|a"", &ptsize, &angle, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) { RETURN_FALSE; } } else { if (argc < 8 || argc > ((extended) ? 9 : 8)) { ZEND_WRONG_PARAM_COUNT(); } else if (zend_parse_parameters(argc TSRMLS_CC, ""rddlllss|a"", &IM, &ptsize, &angle, &x, &y, &col, &fontname, &fontname_len, &str, &str_len, &EXT) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, ""Image"", le_gd); } /* convert angle to radians */ angle = angle * (M_PI/180); if (extended && EXT) { /* parse extended info */ HashPosition pos; /* walk the assoc array */ zend_hash_internal_pointer_reset_ex(HASH_OF(EXT), &pos); do { zval ** item; char * key; ulong num_key; if (zend_hash_get_current_key_ex(HASH_OF(EXT), &key, NULL, &num_key, 0, &pos) != HASH_KEY_IS_STRING) { continue; } if (zend_hash_get_current_data_ex(HASH_OF(EXT), (void **) &item, &pos) == FAILURE) { continue; } if (strcmp(""linespacing"", key) == 0) { convert_to_double_ex(item); strex.flags |= gdFTEX_LINESPACE; strex.linespacing = Z_DVAL_PP(item); } } while (zend_hash_move_forward_ex(HASH_OF(EXT), &pos) == SUCCESS); } #ifdef VIRTUAL_DIR { char tmp_font_path[MAXPATHLEN]; if (!VCWD_REALPATH(fontname, tmp_font_path)) { fontname = NULL; } } #endif /* VIRTUAL_DIR */ PHP_GD_CHECK_OPEN_BASEDIR(fontname, ""Invalid font filename""); #ifdef HAVE_GD_FREETYPE if (extended) { error = gdImageStringFTEx(im, brect, col, fontname, ptsize, angle, x, y, str, &strex); } else error = gdImageStringFT(im, brect, col, fontname, ptsize, angle, x, y, str); #endif /* HAVE_GD_FREETYPE */ if (error) { php_error_docref(NULL TSRMLS_CC, E_WARNING, ""%s"", error); RETURN_FALSE; } array_init(return_value); /* return array with the text's bounding box */ for (i = 0; i < 8; i++) { add_next_index_long(return_value, brect[i]); } } ",1 "void ChromeContentBrowserClient::PluginProcessHostCreated( PluginProcessHost* host) { host->AddFilter(new ChromePluginMessageFilter(host)); } ",0 "ppp_unregister_channel(struct ppp_channel *chan) { struct channel *pch = chan->ppp; struct ppp_net *pn; if (!pch) return; /* should never happen */ chan->ppp = NULL; /* * This ensures that we have returned from any calls into the * the channel's start_xmit or ioctl routine before we proceed. */ down_write(&pch->chan_sem); spin_lock_bh(&pch->downl); pch->chan = NULL; spin_unlock_bh(&pch->downl); up_write(&pch->chan_sem); ppp_disconnect_channel(pch); pn = ppp_pernet(pch->chan_net); spin_lock_bh(&pn->all_channels_lock); list_del(&pch->list); spin_unlock_bh(&pn->all_channels_lock); pch->file.dead = 1; wake_up_interruptible(&pch->file.rwait); if (atomic_dec_and_test(&pch->file.refcnt)) ppp_destroy_channel(pch); } ",1 "void add_entry(struct hash_table_entry *hash_table[], long long start, long long bytes) { int hash = CALCULATE_HASH(start); struct hash_table_entry *hash_table_entry; hash_table_entry = malloc(sizeof(struct hash_table_entry)); if(hash_table_entry == NULL) EXIT_UNSQUASH(""Out of memory in add_entry\n""); hash_table_entry->start = start; hash_table_entry->bytes = bytes; hash_table_entry->next = hash_table[hash]; hash_table[hash] = hash_table_entry; } ",0 "static int perf_swevent_init(struct perf_event *event) { int event_id = event->attr.config; if (event->attr.type != PERF_TYPE_SOFTWARE) return -ENOENT; switch (event_id) { case PERF_COUNT_SW_CPU_CLOCK: case PERF_COUNT_SW_TASK_CLOCK: return -ENOENT; default: break; } if (event_id >= PERF_COUNT_SW_MAX) return -ENOENT; if (!event->parent) { int err; err = swevent_hlist_get(event); if (err) return err; jump_label_inc(&perf_swevent_enabled[event_id]); event->destroy = sw_perf_event_destroy; } return 0; } ",0 "static int mac80211_hwsim_roc(struct ieee80211_hw *hw, struct ieee80211_vif *vif, struct ieee80211_channel *chan, int duration, enum ieee80211_roc_type type) { struct mac80211_hwsim_data *hwsim = hw->priv; mutex_lock(&hwsim->mutex); if (WARN_ON(hwsim->tmp_chan || hwsim->hw_scan_request)) { mutex_unlock(&hwsim->mutex); return -EBUSY; } hwsim->roc_chan = chan; hwsim->roc_duration = duration; mutex_unlock(&hwsim->mutex); wiphy_dbg(hw->wiphy, ""hwsim ROC (%d MHz, %d ms)\n"", chan->center_freq, duration); ieee80211_queue_delayed_work(hw, &hwsim->roc_start, HZ/50); return 0; } ",0 "static HB_Error GPOS_Do_Glyph_Lookup( GPOS_Instance* gpi, HB_UShort lookup_index, HB_Buffer buffer, HB_UShort context_length, int nesting_level ) { HB_Error error = HB_Err_Not_Covered; HB_UShort i, flags, lookup_count; HB_GPOSHeader* gpos = gpi->gpos; HB_Lookup* lo; int lookup_type; nesting_level++; if ( nesting_level > HB_MAX_NESTING_LEVEL ) return ERR(HB_Err_Not_Covered); /* ERR() call intended */ lookup_count = gpos->LookupList.LookupCount; if (lookup_index >= lookup_count) return error; lo = &gpos->LookupList.Lookup[lookup_index]; flags = lo->LookupFlag; lookup_type = lo->LookupType; for ( i = 0; i < lo->SubTableCount; i++ ) { HB_GPOS_SubTable *st = &lo->SubTable[i].st.gpos; switch (lookup_type) { case HB_GPOS_LOOKUP_SINGLE: error = Lookup_SinglePos ( gpi, st, buffer, flags, context_length, nesting_level ); break; case HB_GPOS_LOOKUP_PAIR: error = Lookup_PairPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; case HB_GPOS_LOOKUP_CURSIVE: error = Lookup_CursivePos ( gpi, st, buffer, flags, context_length, nesting_level ); break; case HB_GPOS_LOOKUP_MARKBASE: error = Lookup_MarkBasePos ( gpi, st, buffer, flags, context_length, nesting_level ); break; case HB_GPOS_LOOKUP_MARKLIG: error = Lookup_MarkLigPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; case HB_GPOS_LOOKUP_MARKMARK: error = Lookup_MarkMarkPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; case HB_GPOS_LOOKUP_CONTEXT: error = Lookup_ContextPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; case HB_GPOS_LOOKUP_CHAIN: error = Lookup_ChainContextPos ( gpi, st, buffer, flags, context_length, nesting_level ); break; /*case HB_GPOS_LOOKUP_EXTENSION: error = Lookup_ExtensionPos ( gpi, st, buffer, flags, context_length, nesting_level ); break;*/ default: error = HB_Err_Not_Covered; } /* Check whether we have a successful positioning or an error other than HB_Err_Not_Covered */ if ( error != HB_Err_Not_Covered ) return error; } return HB_Err_Not_Covered; } ",0 "static LocalFrame* FrameForExecutionContext(ExecutionContext* context) { LocalFrame* frame = nullptr; if (context->IsDocument()) frame = ToDocument(context)->GetFrame(); return frame; } ",0 "SYSCALL_DEFINE2(osf_sigstack, struct sigstack __user *, uss, struct sigstack __user *, uoss) { unsigned long usp = rdusp(); unsigned long oss_sp = current->sas_ss_sp + current->sas_ss_size; unsigned long oss_os = on_sig_stack(usp); int error; if (uss) { void __user *ss_sp; error = -EFAULT; if (get_user(ss_sp, &uss->ss_sp)) goto out; /* If the current stack was set with sigaltstack, don't swap stacks while we are on it. */ error = -EPERM; if (current->sas_ss_sp && on_sig_stack(usp)) goto out; /* Since we don't know the extent of the stack, and we don't track onstack-ness, but rather calculate it, we must presume a size. Ho hum this interface is lossy. */ current->sas_ss_sp = (unsigned long)ss_sp - SIGSTKSZ; current->sas_ss_size = SIGSTKSZ; } if (uoss) { error = -EFAULT; if (! access_ok(VERIFY_WRITE, uoss, sizeof(*uoss)) || __put_user(oss_sp, &uoss->ss_sp) || __put_user(oss_os, &uoss->ss_onstack)) goto out; } error = 0; out: return error; } ",0 "validate_as_request(kdc_realm_t *kdc_active_realm, register krb5_kdc_req *request, krb5_db_entry client, krb5_db_entry server, krb5_timestamp kdc_time, const char **status, krb5_pa_data ***e_data) { int errcode; krb5_error_code ret; /* * If an option is set that is only allowed in TGS requests, complain. */ if (request->kdc_options & AS_INVALID_OPTIONS) { *status = ""INVALID AS OPTIONS""; return KDC_ERR_BADOPTION; } /* The client must not be expired */ if (client.expiration && ts_after(kdc_time, client.expiration)) { *status = ""CLIENT EXPIRED""; if (vague_errors) return(KRB_ERR_GENERIC); else return(KDC_ERR_NAME_EXP); } /* The client's password must not be expired, unless the server is a KRB5_KDC_PWCHANGE_SERVICE. */ if (client.pw_expiration && ts_after(kdc_time, client.pw_expiration) && !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) { *status = ""CLIENT KEY EXPIRED""; if (vague_errors) return(KRB_ERR_GENERIC); else return(KDC_ERR_KEY_EXP); } /* The server must not be expired */ if (server.expiration && ts_after(kdc_time, server.expiration)) { *status = ""SERVICE EXPIRED""; return(KDC_ERR_SERVICE_EXP); } /* * If the client requires password changing, then only allow the * pwchange service. */ if (isflagset(client.attributes, KRB5_KDB_REQUIRES_PWCHANGE) && !isflagset(server.attributes, KRB5_KDB_PWCHANGE_SERVICE)) { *status = ""REQUIRED PWCHANGE""; return(KDC_ERR_KEY_EXP); } /* Client and server must allow postdating tickets */ if ((isflagset(request->kdc_options, KDC_OPT_ALLOW_POSTDATE) || isflagset(request->kdc_options, KDC_OPT_POSTDATED)) && (isflagset(client.attributes, KRB5_KDB_DISALLOW_POSTDATED) || isflagset(server.attributes, KRB5_KDB_DISALLOW_POSTDATED))) { *status = ""POSTDATE NOT ALLOWED""; return(KDC_ERR_CANNOT_POSTDATE); } /* * A Windows KDC will return KDC_ERR_PREAUTH_REQUIRED instead of * KDC_ERR_POLICY in the following case: * * - KDC_OPT_FORWARDABLE is set in KDCOptions but local * policy has KRB5_KDB_DISALLOW_FORWARDABLE set for the * client, and; * - KRB5_KDB_REQUIRES_PRE_AUTH is set for the client but * preauthentication data is absent in the request. * * Hence, this check most be done after the check for preauth * data, and is now performed by validate_forwardable() (the * contents of which were previously below). */ /* Client and server must allow proxiable tickets */ if (isflagset(request->kdc_options, KDC_OPT_PROXIABLE) && (isflagset(client.attributes, KRB5_KDB_DISALLOW_PROXIABLE) || isflagset(server.attributes, KRB5_KDB_DISALLOW_PROXIABLE))) { *status = ""PROXIABLE NOT ALLOWED""; return(KDC_ERR_POLICY); } /* Check to see if client is locked out */ if (isflagset(client.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) { *status = ""CLIENT LOCKED OUT""; return(KDC_ERR_CLIENT_REVOKED); } /* Check to see if server is locked out */ if (isflagset(server.attributes, KRB5_KDB_DISALLOW_ALL_TIX)) { *status = ""SERVICE LOCKED OUT""; return(KDC_ERR_S_PRINCIPAL_UNKNOWN); } /* Check to see if server is allowed to be a service */ if (isflagset(server.attributes, KRB5_KDB_DISALLOW_SVR)) { *status = ""SERVICE NOT ALLOWED""; return(KDC_ERR_MUST_USE_USER2USER); } if (check_anon(kdc_active_realm, client.princ, request->server) != 0) { *status = ""ANONYMOUS NOT ALLOWED""; return(KDC_ERR_POLICY); } /* Perform KDB module policy checks. */ ret = krb5_db_check_policy_as(kdc_context, request, &client, &server, kdc_time, status, e_data); if (ret && ret != KRB5_PLUGIN_OP_NOTSUPP) return errcode_to_protocol(ret); /* Check against local policy. */ errcode = against_local_policy_as(request, client, server, kdc_time, status, e_data); if (errcode) return errcode; return 0; } ",0 " void setAtBeforeSideOfBlock(bool b) { m_atBeforeSideOfBlock = b; } ",0 "void MasterPreferences::InitializeFromFilePath( const base::FilePath& prefs_path) { std::string json_data; if (base::PathExists(prefs_path) && !base::ReadFileToString(prefs_path, &json_data)) { LOG(ERROR) << ""Failed to read preferences from "" << prefs_path.value(); } if (InitializeFromString(json_data)) preferences_read_from_file_ = true; } ",0 "spnego_gss_export_sec_context( OM_uint32 *minor_status, gss_ctx_id_t *context_handle, gss_buffer_t interprocess_token) { OM_uint32 ret; ret = gss_export_sec_context(minor_status, context_handle, interprocess_token); return (ret); } ",0 "void re_yyset_extra (YY_EXTRA_TYPE user_defined , yyscan_t yyscanner) { struct yyguts_t * yyg = (struct yyguts_t*)yyscanner; yyextra = user_defined ; } ",0 "static int collationMatch(const char *zColl, Index *pIndex){ int i; assert( zColl!=0 ); for(i=0; inColumn; i++){ const char *z = pIndex->azColl[i]; assert( z!=0 || pIndex->aiColumn[i]<0 ); if( pIndex->aiColumn[i]>=0 && 0==sqlite3StrICmp(z, zColl) ){ return 1; } } return 0; } ",0 "status_t OMX::prepareForAdaptivePlayback( node_id node, OMX_U32 portIndex, OMX_BOOL enable, OMX_U32 maxFrameWidth, OMX_U32 maxFrameHeight) { return findInstance(node)->prepareForAdaptivePlayback( portIndex, enable, maxFrameWidth, maxFrameHeight); } ",0 "fst_clear_intr(struct fst_card_info *card) { if (card->family == FST_FAMILY_TXU) { (void) readb(card->ctlmem); } else { /* Poke the appropriate PLX chip register (same as enabling interrupts) */ outw(0x0543, card->pci_conf + INTCSR_9052); } } ",0 "int compat_ptrace_request(struct task_struct *child, compat_long_t request, compat_ulong_t addr, compat_ulong_t data) { compat_ulong_t __user *datap = compat_ptr(data); compat_ulong_t word; siginfo_t siginfo; int ret; switch (request) { case PTRACE_PEEKTEXT: case PTRACE_PEEKDATA: ret = access_process_vm(child, addr, &word, sizeof(word), 0); if (ret != sizeof(word)) ret = -EIO; else ret = put_user(word, datap); break; case PTRACE_POKETEXT: case PTRACE_POKEDATA: ret = access_process_vm(child, addr, &data, sizeof(data), 1); ret = (ret != sizeof(data) ? -EIO : 0); break; case PTRACE_GETEVENTMSG: ret = put_user((compat_ulong_t) child->ptrace_message, datap); break; case PTRACE_GETSIGINFO: ret = ptrace_getsiginfo(child, &siginfo); if (!ret) ret = copy_siginfo_to_user32( (struct compat_siginfo __user *) datap, &siginfo); break; case PTRACE_SETSIGINFO: memset(&siginfo, 0, sizeof siginfo); if (copy_siginfo_from_user32( &siginfo, (struct compat_siginfo __user *) datap)) ret = -EFAULT; else ret = ptrace_setsiginfo(child, &siginfo); break; #ifdef CONFIG_HAVE_ARCH_TRACEHOOK case PTRACE_GETREGSET: case PTRACE_SETREGSET: { struct iovec kiov; struct compat_iovec __user *uiov = (struct compat_iovec __user *) datap; compat_uptr_t ptr; compat_size_t len; if (!access_ok(VERIFY_WRITE, uiov, sizeof(*uiov))) return -EFAULT; if (__get_user(ptr, &uiov->iov_base) || __get_user(len, &uiov->iov_len)) return -EFAULT; kiov.iov_base = compat_ptr(ptr); kiov.iov_len = len; ret = ptrace_regset(child, request, addr, &kiov); if (!ret) ret = __put_user(kiov.iov_len, &uiov->iov_len); break; } #endif default: ret = ptrace_request(child, request, addr, data); } return ret; } ",0 "static void ksm_do_scan(unsigned int scan_npages) { struct rmap_item *rmap_item; struct page *uninitialized_var(page); while (scan_npages-- && likely(!freezing(current))) { cond_resched(); rmap_item = scan_get_next_rmap_item(&page); if (!rmap_item) return; if (!PageKsm(page) || !in_stable_tree(rmap_item)) cmp_and_merge_page(page, rmap_item); put_page(page); } } ",0 "hook_valid (struct t_hook *hook) { int type; struct t_hook *ptr_hook; for (type = 0; type < HOOK_NUM_TYPES; type++) { for (ptr_hook = weechat_hooks[type]; ptr_hook; ptr_hook = ptr_hook->next_hook) { if (!ptr_hook->deleted && (ptr_hook == hook)) return 1; } } /* hook not found */ return 0; } ",0 "static int crypto_aead_report(struct sk_buff *skb, struct crypto_alg *alg) { return -ENOSYS; } ",0 " void VerifyDailyContentLengthPrefLists( const int64* original_values, size_t original_count, const int64* received_values, size_t received_count, const int64* original_with_data_reduction_proxy_enabled_values, size_t original_with_data_reduction_proxy_enabled_count, const int64* received_with_data_reduction_proxy_enabled_values, size_t received_with_data_reduction_proxy_count, const int64* original_via_data_reduction_proxy_values, size_t original_via_data_reduction_proxy_count, const int64* received_via_data_reduction_proxy_values, size_t received_via_data_reduction_proxy_count) { VerifyPrefList(prefs::kDailyHttpOriginalContentLength, original_values, original_count); VerifyPrefList(prefs::kDailyHttpReceivedContentLength, received_values, received_count); VerifyPrefList( prefs::kDailyOriginalContentLengthWithDataReductionProxyEnabled, original_with_data_reduction_proxy_enabled_values, original_with_data_reduction_proxy_enabled_count); VerifyPrefList( prefs::kDailyContentLengthWithDataReductionProxyEnabled, received_with_data_reduction_proxy_enabled_values, received_with_data_reduction_proxy_count); VerifyPrefList( prefs::kDailyOriginalContentLengthViaDataReductionProxy, original_via_data_reduction_proxy_values, original_via_data_reduction_proxy_count); VerifyPrefList( prefs::kDailyContentLengthViaDataReductionProxy, received_via_data_reduction_proxy_values, received_via_data_reduction_proxy_count); } ",1 "std::unique_ptr MemBackendImpl::CreateBackend( int max_bytes, net::NetLog* net_log) { std::unique_ptr cache( std::make_unique(net_log)); cache->SetMaxSize(max_bytes); if (cache->Init()) return cache; LOG(ERROR) << ""Unable to create cache""; return nullptr; } ",0 "my_send(ftpbuf_t *ftp, php_socket_t s, void *buf, size_t len) { long size, sent; int n; size = len; while (size) { n = php_pollfd_for_ms(s, POLLOUT, ftp->timeout_sec * 1000); if (n < 1) { #if !defined(PHP_WIN32) && !(defined(NETWARE) && defined(USE_WINSOCK)) if (n == 0) { errno = ETIMEDOUT; } #endif return -1; } #if HAVE_OPENSSL_EXT if (ftp->use_ssl && ftp->fd == s && ftp->ssl_active) { sent = SSL_write(ftp->ssl_handle, buf, size); } else if (ftp->use_ssl && ftp->fd != s && ftp->use_ssl_for_data && ftp->data->ssl_active) { sent = SSL_write(ftp->data->ssl_handle, buf, size); } else { #endif sent = send(s, buf, size, 0); #if HAVE_OPENSSL_EXT } #endif if (sent == -1) { return -1; } buf = (char*) buf + sent; size -= sent; } return len; } ",0 "free_map(struct map* map) { struct map_trigger* trigger; struct map_zone* zone; iter_t iter; int i; if (map == NULL) return; for (i = 0; i < MAP_SCRIPT_MAX; ++i) script_unref(map->scripts[i]); for (i = 0; i < map->num_layers; ++i) { script_unref(map->layers[i].render_script); lstr_free(map->layers[i].name); free(map->layers[i].tilemap); obsmap_free(map->layers[i].obsmap); } for (i = 0; i < map->num_persons; ++i) { lstr_free(map->persons[i].name); lstr_free(map->persons[i].spriteset); lstr_free(map->persons[i].create_script); lstr_free(map->persons[i].destroy_script); lstr_free(map->persons[i].command_script); lstr_free(map->persons[i].talk_script); lstr_free(map->persons[i].touch_script); } iter = vector_enum(s_map->triggers); while ((trigger = iter_next(&iter))) script_unref(trigger->script); iter = vector_enum(s_map->zones); while ((zone = iter_next(&iter))) script_unref(zone->script); lstr_free(s_map->bgm_file); tileset_free(map->tileset); free(map->layers); free(map->persons); vector_free(map->triggers); vector_free(map->zones); free(map); } ",0 "void RenderProcessHost::PostTaskWhenProcessIsReady(base::OnceClosure task) { DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK(!task.is_null()); new RenderProcessHostIsReadyObserver(this, std::move(task)); } ",0 "uiserver_release (void *engine) { engine_uiserver_t uiserver = engine; if (!uiserver) return; uiserver_cancel (engine); free (uiserver->colon.attic.line); free (uiserver); } ",0 "BOOL IsVolumeClassFilterRegistered () { UNICODE_STRING name; NTSTATUS status; BOOL registered = FALSE; PKEY_VALUE_PARTIAL_INFORMATION data; RtlInitUnicodeString (&name, L""\\REGISTRY\\MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Class\\{71A27CDD-812A-11D0-BEC7-08002BE2092F}""); status = TCReadRegistryKey (&name, L""UpperFilters"", &data); if (NT_SUCCESS (status)) { if (data->Type == REG_MULTI_SZ && data->DataLength >= 9 * sizeof (wchar_t)) { ULONG i; for (i = 0; i <= data->DataLength - 9 * sizeof (wchar_t); ++i) { if (memcmp (data->Data + i, L""veracrypt"", 9 * sizeof (wchar_t)) == 0) { Dump (""Volume class filter active\n""); registered = TRUE; break; } } } TCfree (data); } return registered; } ",0 "localjump_error(mrb_state *mrb, localjump_error_kind kind) { char kind_str[3][7] = { ""return"", ""break"", ""yield"" }; char kind_str_len[] = { 6, 5, 5 }; static const char lead[] = ""unexpected ""; mrb_value msg; mrb_value exc; msg = mrb_str_new_capa(mrb, sizeof(lead) + 7); mrb_str_cat(mrb, msg, lead, sizeof(lead) - 1); mrb_str_cat(mrb, msg, kind_str[kind], kind_str_len[kind]); exc = mrb_exc_new_str(mrb, E_LOCALJUMP_ERROR, msg); mrb_exc_set(mrb, exc); } ",0 "static bool vmxnet3_peer_has_vnet_hdr(VMXNET3State *s) { NetClientState *nc = qemu_get_queue(s->nic); if (qemu_has_vnet_hdr(nc->peer)) { return true; } VMW_WRPRN(""Peer has no virtio extension. Task offloads will be emulated.""); return false; } ",0 "static int rxe_mem_alloc(struct rxe_dev *rxe, struct rxe_mem *mem, int num_buf) { int i; int num_map; struct rxe_map **map = mem->map; num_map = (num_buf + RXE_BUF_PER_MAP - 1) / RXE_BUF_PER_MAP; mem->map = kmalloc_array(num_map, sizeof(*map), GFP_KERNEL); if (!mem->map) goto err1; for (i = 0; i < num_map; i++) { mem->map[i] = kmalloc(sizeof(**map), GFP_KERNEL); if (!mem->map[i]) goto err2; } WARN_ON(!is_power_of_2(RXE_BUF_PER_MAP)); mem->map_shift = ilog2(RXE_BUF_PER_MAP); mem->map_mask = RXE_BUF_PER_MAP - 1; mem->num_buf = num_buf; mem->num_map = num_map; mem->max_buf = num_map * RXE_BUF_PER_MAP; return 0; err2: for (i--; i >= 0; i--) kfree(mem->map[i]); kfree(mem->map); err1: return -ENOMEM; } ",0 "file_apprentice(struct magic_set *ms, const char *fn, int action) { char *p, *mfn; int file_err, errs = -1; size_t i; file_reset(ms); /* XXX disabling default magic loading so the compiled in data is used */ #if 0 if ((fn = magic_getpath(fn, action)) == NULL) return -1; #endif init_file_tables(); if (fn == NULL) fn = getenv(""MAGIC""); if (fn == NULL) { for (i = 0; i < MAGIC_SETS; i++) { mlist_free(ms->mlist[i]); if ((ms->mlist[i] = mlist_alloc()) == NULL) { file_oomem(ms, sizeof(*ms->mlist[i])); return -1; } } return apprentice_1(ms, fn, action); } if ((mfn = estrdup(fn)) == NULL) { file_oomem(ms, strlen(fn)); return -1; } for (i = 0; i < MAGIC_SETS; i++) { mlist_free(ms->mlist[i]); if ((ms->mlist[i] = mlist_alloc()) == NULL) { file_oomem(ms, sizeof(*ms->mlist[i])); if (i != 0) { --i; do mlist_free(ms->mlist[i]); while (i != 0); } efree(mfn); return -1; } } fn = mfn; while (fn) { p = strchr(fn, PATHSEP); if (p) *p++ = '\0'; if (*fn == '\0') break; file_err = apprentice_1(ms, fn, action); errs = MAX(errs, file_err); fn = p; } efree(mfn); if (errs == -1) { for (i = 0; i < MAGIC_SETS; i++) { mlist_free(ms->mlist[i]); ms->mlist[i] = NULL; } file_error(ms, 0, ""could not find any valid magic files!""); return -1; } #if 0 /* * Always leave the database loaded */ if (action == FILE_LOAD) return 0; for (i = 0; i < MAGIC_SETS; i++) { mlist_free(ms->mlist[i]); ms->mlist[i] = NULL; } #endif switch (action) { case FILE_LOAD: case FILE_COMPILE: case FILE_CHECK: case FILE_LIST: return 0; default: file_error(ms, 0, ""Invalid action %d"", action); return -1; } } ",0 "static void tun_poll_controller(struct net_device *dev) { /* * Tun only receives frames when: * 1) the char device endpoint gets data from user space * 2) the tun socket gets a sendmsg call from user space * Since both of those are syncronous operations, we are guaranteed * never to have pending data when we poll for it * so theres nothing to do here but return. * We need this though so netpoll recognizes us as an interface that * supports polling, which enables bridge devices in virt setups to * still use netconsole */ return; } ",0 "static int cm_lap_handler(struct cm_work *work) { struct cm_id_private *cm_id_priv; struct cm_lap_msg *lap_msg; struct ib_cm_lap_event_param *param; struct ib_mad_send_buf *msg = NULL; int ret; /* todo: verify LAP request and send reject APR if invalid. */ lap_msg = (struct cm_lap_msg *)work->mad_recv_wc->recv_buf.mad; cm_id_priv = cm_acquire_id(lap_msg->remote_comm_id, lap_msg->local_comm_id); if (!cm_id_priv) return -EINVAL; param = &work->cm_event.param.lap_rcvd; param->alternate_path = &work->path[0]; cm_format_path_from_lap(cm_id_priv, param->alternate_path, lap_msg); work->cm_event.private_data = &lap_msg->private_data; spin_lock_irq(&cm_id_priv->lock); if (cm_id_priv->id.state != IB_CM_ESTABLISHED) goto unlock; switch (cm_id_priv->id.lap_state) { case IB_CM_LAP_UNINIT: case IB_CM_LAP_IDLE: break; case IB_CM_MRA_LAP_SENT: atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES]. counter[CM_LAP_COUNTER]); if (cm_alloc_response_msg(work->port, work->mad_recv_wc, &msg)) goto unlock; cm_format_mra((struct cm_mra_msg *) msg->mad, cm_id_priv, CM_MSG_RESPONSE_OTHER, cm_id_priv->service_timeout, cm_id_priv->private_data, cm_id_priv->private_data_len); spin_unlock_irq(&cm_id_priv->lock); if (ib_post_send_mad(msg, NULL)) cm_free_msg(msg); goto deref; case IB_CM_LAP_RCVD: atomic_long_inc(&work->port->counter_group[CM_RECV_DUPLICATES]. counter[CM_LAP_COUNTER]); goto unlock; default: goto unlock; } cm_id_priv->id.lap_state = IB_CM_LAP_RCVD; cm_id_priv->tid = lap_msg->hdr.tid; cm_init_av_for_response(work->port, work->mad_recv_wc->wc, work->mad_recv_wc->recv_buf.grh, &cm_id_priv->av); cm_init_av_by_path(param->alternate_path, &cm_id_priv->alt_av); ret = atomic_inc_and_test(&cm_id_priv->work_count); if (!ret) list_add_tail(&work->list, &cm_id_priv->work_list); spin_unlock_irq(&cm_id_priv->lock); if (ret) cm_process_work(cm_id_priv, work); else cm_deref_id(cm_id_priv); return 0; unlock: spin_unlock_irq(&cm_id_priv->lock); deref: cm_deref_id(cm_id_priv); return -EINVAL; } ",0 "static void vlan_dev_set_lockdep_one(struct net_device *dev, struct netdev_queue *txq, void *_subclass) { lockdep_set_class_and_subclass(&txq->_xmit_lock, &vlan_netdev_xmit_lock_key, *(int *)_subclass); } ",0 "void DevToolsWindow::UpdateTheme() { ThemeService* tp = ThemeServiceFactory::GetForProfile(profile_); DCHECK(tp); std::string command(""InspectorFrontendAPI.setToolbarColors(\"""" + SkColorToRGBAString(tp->GetColor(ThemeProperties::COLOR_TOOLBAR)) + ""\"", \"""" + SkColorToRGBAString(tp->GetColor(ThemeProperties::COLOR_BOOKMARK_TEXT)) + ""\"")""); web_contents_->GetRenderViewHost()->ExecuteJavascriptInWebFrame( base::string16(), base::ASCIIToUTF16(command)); } ",0 "skip_sfx(struct archive_read *a) { const void *h; const char *p, *q; size_t skip, total; ssize_t bytes, window; total = 0; window = 4096; while (total + window <= (1024 * 128)) { h = __archive_read_ahead(a, window, &bytes); if (h == NULL) { /* Remaining bytes are less than window. */ window >>= 1; if (window < 0x40) goto fatal; continue; } if (bytes < 0x40) goto fatal; p = h; q = p + bytes; /* * Scan ahead until we find something that looks * like the RAR header. */ while (p + 7 < q) { if (memcmp(p, RAR_SIGNATURE, 7) == 0) { skip = p - (const char *)h; __archive_read_consume(a, skip); return (ARCHIVE_OK); } p += 0x10; } skip = p - (const char *)h; __archive_read_consume(a, skip); total += skip; } fatal: archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, ""Couldn't find out RAR header""); return (ARCHIVE_FATAL); } ",0 "lacks_filesystem_info (NautilusFile *file) { return !file->details->filesystem_info_is_up_to_date; } ",0 "static int sctp_v4_cmp_addr(const union sctp_addr *addr1, const union sctp_addr *addr2) { if (addr1->sa.sa_family != addr2->sa.sa_family) return 0; if (addr1->v4.sin_port != addr2->v4.sin_port) return 0; if (addr1->v4.sin_addr.s_addr != addr2->v4.sin_addr.s_addr) return 0; return 1; } ",0 "nautilus_self_check_file_operations (void) { setlocale (LC_MESSAGES, ""C""); /* test the next duplicate name generator */ EEL_CHECK_STRING_RESULT (get_duplicate_name ("" (copy)"", 1, -1), "" (another copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo"", 1, -1), ""foo (copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name ("".bashrc"", 1, -1), "".bashrc (copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name ("".foo.txt"", 1, -1), "".foo (copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo foo"", 1, -1), ""foo foo (copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo.txt"", 1, -1), ""foo (copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo foo.txt"", 1, -1), ""foo foo (copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo foo.txt txt"", 1, -1), ""foo foo (copy).txt txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo...txt"", 1, -1), ""foo.. (copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo..."", 1, -1), ""foo... (copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo. (copy)"", 1, -1), ""foo. (another copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (copy)"", 1, -1), ""foo (another copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (copy).txt"", 1, -1), ""foo (another copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (another copy)"", 1, -1), ""foo (3rd copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (another copy).txt"", 1, -1), ""foo (3rd copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo foo (another copy).txt"", 1, -1), ""foo foo (3rd copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (13th copy)"", 1, -1), ""foo (14th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (13th copy).txt"", 1, -1), ""foo (14th copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (21st copy)"", 1, -1), ""foo (22nd copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (21st copy).txt"", 1, -1), ""foo (22nd copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (22nd copy)"", 1, -1), ""foo (23rd copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (22nd copy).txt"", 1, -1), ""foo (23rd copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (23rd copy)"", 1, -1), ""foo (24th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (23rd copy).txt"", 1, -1), ""foo (24th copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (24th copy)"", 1, -1), ""foo (25th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (24th copy).txt"", 1, -1), ""foo (25th copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo foo (24th copy)"", 1, -1), ""foo foo (25th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo foo (24th copy).txt"", 1, -1), ""foo foo (25th copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo foo (100000000000000th copy).txt"", 1, -1), ""foo foo (copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (10th copy)"", 1, -1), ""foo (11th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (10th copy).txt"", 1, -1), ""foo (11th copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (11th copy)"", 1, -1), ""foo (12th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (11th copy).txt"", 1, -1), ""foo (12th copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (12th copy)"", 1, -1), ""foo (13th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (12th copy).txt"", 1, -1), ""foo (13th copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (110th copy)"", 1, -1), ""foo (111th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (110th copy).txt"", 1, -1), ""foo (111th copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (122nd copy)"", 1, -1), ""foo (123rd copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (122nd copy).txt"", 1, -1), ""foo (123rd copy).txt""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (123rd copy)"", 1, -1), ""foo (124th copy)""); EEL_CHECK_STRING_RESULT (get_duplicate_name (""foo (123rd copy).txt"", 1, -1), ""foo (124th copy).txt""); setlocale (LC_MESSAGES, """"); } ",0 " static int read_request(int fd, debugger_request_t* out_request) { ucred cr; socklen_t len = sizeof(cr); int status = getsockopt(fd, SOL_SOCKET, SO_PEERCRED, &cr, &len); if (status != 0) { ALOGE(""cannot get credentials""); return -1; } ALOGV(""reading tid""); fcntl(fd, F_SETFL, O_NONBLOCK); pollfd pollfds[1]; pollfds[0].fd = fd; pollfds[0].events = POLLIN; pollfds[0].revents = 0; status = TEMP_FAILURE_RETRY(poll(pollfds, 1, 3000)); if (status != 1) { ALOGE(""timed out reading tid (from pid=%d uid=%d)\n"", cr.pid, cr.uid); return -1; } debugger_msg_t msg; memset(&msg, 0, sizeof(msg)); status = TEMP_FAILURE_RETRY(read(fd, &msg, sizeof(msg))); if (status < 0) { ALOGE(""read failure? %s (pid=%d uid=%d)\n"", strerror(errno), cr.pid, cr.uid); return -1; } if (status != sizeof(debugger_msg_t)) { ALOGE(""invalid crash request of size %d (from pid=%d uid=%d)\n"", status, cr.pid, cr.uid); return -1; } out_request->action = static_cast(msg.action); out_request->tid = msg.tid; out_request->pid = cr.pid; out_request->uid = cr.uid; out_request->gid = cr.gid; out_request->abort_msg_address = msg.abort_msg_address; out_request->original_si_code = msg.original_si_code; if (msg.action == DEBUGGER_ACTION_CRASH) { char buf[64]; struct stat s; snprintf(buf, sizeof buf, ""/proc/%d/task/%d"", out_request->pid, out_request->tid); if (stat(buf, &s)) { ALOGE(""tid %d does not exist in pid %d. ignoring debug request\n"", out_request->tid, out_request->pid); return -1; } } else if (cr.uid == 0 || (cr.uid == AID_SYSTEM && msg.action == DEBUGGER_ACTION_DUMP_BACKTRACE)) { status = get_process_info(out_request->tid, &out_request->pid, &out_request->uid, &out_request->gid); if (status < 0) { ALOGE(""tid %d does not exist. ignoring explicit dump request\n"", out_request->tid); return -1; } if (!selinux_action_allowed(fd, out_request)) return -1; } else { return -1; } return 0; } ",1 "ReadUserLogState::LogRecordNo( const ReadUserLog::FileState &state ) const { const ReadUserLogFileState::FileState *istate; if ( ( !convertState(state, istate) ) || ( !istate->m_version ) ) { return -1; } return (filesize_t) istate->m_log_record.asint; } ",0 "COMPS_MRTreeData * comps_mrtree_data_create_n(COMPS_MRTree * tree, char * key, size_t keylen, void * data) { COMPS_MRTreeData * rtd; if ((rtd = malloc(sizeof(*rtd))) == NULL) return NULL; if ((rtd->key = malloc(sizeof(char) * (keylen+1))) == NULL) { free(rtd); return NULL; } memcpy(rtd->key, key, sizeof(char)*keylen); rtd->key[keylen] = 0; rtd->is_leaf = 1; rtd->data = comps_hslist_create(); comps_hslist_init(rtd->data, NULL, tree->data_cloner, tree->data_destructor); if (data) comps_hslist_append(rtd->data, data, 0); rtd->subnodes = comps_hslist_create(); comps_hslist_init(rtd->subnodes, NULL, NULL, &comps_mrtree_data_destroy_v); return rtd; } ",0 "local_wcslen (const wchar_t *s) { const wchar_t *ptr; for (ptr = s; *ptr != (wchar_t) 0; ptr++) ; return ptr - s; } ",0 "AirPDcapGetBssidAddress( const AIRPDCAP_MAC_FRAME_ADDR4 *frame) { switch(AIRPDCAP_DS_BITS(frame->fc[1])) { /* Bit 1 = FromDS, bit 0 = ToDS */ case 0: return frame->addr3; case 1: return frame->addr1; case 2: return frame->addr2; case 3: if (memcmp(frame->addr1, frame->addr2, AIRPDCAP_MAC_LEN) > 0) return frame->addr1; else return frame->addr2; default: return NULL; } } ",0 " void ServiceWorkerDevToolsAgentHost::WorkerDestroyed() { DCHECK_NE(WORKER_TERMINATED, state_); state_ = WORKER_TERMINATED; agent_ptr_.reset(); for (auto* inspector : protocol::InspectorHandler::ForAgentHost(this)) inspector->TargetCrashed(); for (DevToolsSession* session : sessions()) session->SetRenderer(nullptr, nullptr); } ",1 "static int uas_probe(struct usb_interface *intf, const struct usb_device_id *id) { int result = -ENOMEM; struct Scsi_Host *shost = NULL; struct uas_dev_info *devinfo; struct usb_device *udev = interface_to_usbdev(intf); unsigned long dev_flags; if (!uas_use_uas_driver(intf, id, &dev_flags)) return -ENODEV; if (uas_switch_interface(udev, intf)) return -ENODEV; shost = scsi_host_alloc(&uas_host_template, sizeof(struct uas_dev_info)); if (!shost) goto set_alt0; shost->max_cmd_len = 16 + 252; shost->max_id = 1; shost->max_lun = 256; shost->max_channel = 0; shost->sg_tablesize = udev->bus->sg_tablesize; devinfo = (struct uas_dev_info *)shost->hostdata; devinfo->intf = intf; devinfo->udev = udev; devinfo->resetting = 0; devinfo->shutdown = 0; devinfo->flags = dev_flags; init_usb_anchor(&devinfo->cmd_urbs); init_usb_anchor(&devinfo->sense_urbs); init_usb_anchor(&devinfo->data_urbs); spin_lock_init(&devinfo->lock); INIT_WORK(&devinfo->work, uas_do_work); result = uas_configure_endpoints(devinfo); if (result) goto set_alt0; /* * 1 tag is reserved for untagged commands + * 1 tag to avoid off by one errors in some bridge firmwares */ shost->can_queue = devinfo->qdepth - 2; usb_set_intfdata(intf, shost); result = scsi_add_host(shost, &intf->dev); if (result) goto free_streams; scsi_scan_host(shost); return result; free_streams: uas_free_streams(devinfo); usb_set_intfdata(intf, NULL); set_alt0: usb_set_interface(udev, intf->altsetting[0].desc.bInterfaceNumber, 0); if (shost) scsi_host_put(shost); return result; } ",0 "int FS_GetFileList( const char *path, const char *extension, char *listbuf, int bufsize ) { int nFiles, i, nTotal, nLen; char **pFiles = NULL; *listbuf = 0; nFiles = 0; nTotal = 0; if (Q_stricmp(path, ""$modlist"") == 0) { return FS_GetModList(listbuf, bufsize); } pFiles = FS_ListFiles(path, extension, &nFiles); for (i =0; i < nFiles; i++) { nLen = strlen(pFiles[i]) + 1; if (nTotal + nLen + 1 < bufsize) { strcpy(listbuf, pFiles[i]); listbuf += nLen; nTotal += nLen; } else { nFiles = i; break; } } FS_FreeFileList(pFiles); return nFiles; } ",0 "group_sched_in(struct perf_event *group_event, struct perf_cpu_context *cpuctx, struct perf_event_context *ctx) { struct perf_event *event, *partial_group = NULL; struct pmu *pmu = ctx->pmu; u64 now = ctx->time; bool simulate = false; if (group_event->state == PERF_EVENT_STATE_OFF) return 0; pmu->start_txn(pmu); if (event_sched_in(group_event, cpuctx, ctx)) { pmu->cancel_txn(pmu); perf_cpu_hrtimer_restart(cpuctx); return -EAGAIN; } /* * Schedule in siblings as one group (if any): */ list_for_each_entry(event, &group_event->sibling_list, group_entry) { if (event_sched_in(event, cpuctx, ctx)) { partial_group = event; goto group_error; } } if (!pmu->commit_txn(pmu)) return 0; group_error: /* * Groups can be scheduled in as one unit only, so undo any * partial group before returning: * The events up to the failed event are scheduled out normally, * tstamp_stopped will be updated. * * The failed events and the remaining siblings need to have * their timings updated as if they had gone thru event_sched_in() * and event_sched_out(). This is required to get consistent timings * across the group. This also takes care of the case where the group * could never be scheduled by ensuring tstamp_stopped is set to mark * the time the event was actually stopped, such that time delta * calculation in update_event_times() is correct. */ list_for_each_entry(event, &group_event->sibling_list, group_entry) { if (event == partial_group) simulate = true; if (simulate) { event->tstamp_running += now - event->tstamp_stopped; event->tstamp_stopped = now; } else { event_sched_out(event, cpuctx, ctx); } } event_sched_out(group_event, cpuctx, ctx); pmu->cancel_txn(pmu); perf_cpu_hrtimer_restart(cpuctx); return -EAGAIN; } ",0 " bool WaitForExtensionHostsToLoad() { NotificationRegistrar registrar; registrar.Add(this, NotificationType::EXTENSION_HOST_DID_STOP_LOADING, NotificationService::AllSources()); CancelableQuitTask* delayed_quit = new CancelableQuitTask(""Extension host load timed out.""); MessageLoop::current()->PostDelayedTask(FROM_HERE, delayed_quit, 4*1000); ExtensionProcessManager* manager = browser()->profile()->GetExtensionProcessManager(); for (ExtensionProcessManager::const_iterator iter = manager->begin(); iter != manager->end();) { if ((*iter)->did_stop_loading()) ++iter; else ui_test_utils::RunMessageLoop(); } delayed_quit->cancel(); return true; } ",0 "gfx::Size ScaleSizeToFitView(const gfx::Size& size, const gfx::Size& view_size) { if ((size.width() > view_size.width() || size.height() > view_size.height()) || (size.width() < view_size.width() && size.height() < view_size.height())) { const float scale = std::min(view_size.width() / static_cast(size.width()), view_size.height() / static_cast(size.height())); return gfx::ScaleToFlooredSize(size, scale); } return size; } ",0 "CommonNavigationParams MakeCommonNavigationParams( const WebSecurityOrigin& current_origin, std::unique_ptr info, int load_flags, bool has_download_sandbox_flag, bool from_ad) { DCHECK(!info->url_request.RequestorOrigin().IsNull()); Referrer referrer( GURL(info->url_request.HttpHeaderField(WebString::FromUTF8(""Referer"")) .Latin1()), info->url_request.GetReferrerPolicy()); DCHECK(info->navigation_type != blink::kWebNavigationTypeBackForward); FrameMsg_Navigate_Type::Value navigation_type = FrameMsg_Navigate_Type::DIFFERENT_DOCUMENT; if (info->navigation_type == blink::kWebNavigationTypeReload) { if (load_flags & net::LOAD_BYPASS_CACHE) navigation_type = FrameMsg_Navigate_Type::RELOAD_BYPASSING_CACHE; else navigation_type = FrameMsg_Navigate_Type::RELOAD; } base::Optional source_location; if (!info->source_location.url.IsNull()) { source_location = SourceLocation(info->source_location.url.Latin1(), info->source_location.line_number, info->source_location.column_number); } CSPDisposition should_check_main_world_csp = info->should_check_main_world_content_security_policy == blink::kWebContentSecurityPolicyDispositionCheck ? CSPDisposition::CHECK : CSPDisposition::DO_NOT_CHECK; const RequestExtraData* extra_data = static_cast(info->url_request.GetExtraData()); DCHECK(extra_data); NavigationDownloadPolicy download_policy; RenderFrameImpl::MaybeSetDownloadFramePolicy( info->is_opener_navigation, info->url_request, current_origin, has_download_sandbox_flag, info->blocking_downloads_in_sandbox_without_user_activation_enabled, from_ad, &download_policy); return CommonNavigationParams( info->url_request.Url(), info->url_request.RequestorOrigin(), referrer, extra_data->transition_type(), navigation_type, download_policy, info->frame_load_type == WebFrameLoadType::kReplaceCurrentItem, GURL(), GURL(), static_cast(info->url_request.GetPreviewsState()), base::TimeTicks::Now(), info->url_request.HttpMethod().Latin1(), GetRequestBodyForWebURLRequest(info->url_request), source_location, false /* started_from_context_menu */, info->url_request.HasUserGesture(), InitiatorCSPInfo(should_check_main_world_csp, BuildContentSecurityPolicyList(info->initiator_csp), info->initiator_csp.self_source.has_value() ? base::Optional(BuildCSPSource( info->initiator_csp.self_source.value())) : base::nullopt), info->href_translate.Latin1(), info->input_start); } ",0 "void Document::write(const String& text, Document* entered_document, ExceptionState& exception_state) { if (ImportLoader()) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, ""Imported document doesn't support write().""); return; } if (!IsHTMLDocument()) { exception_state.ThrowDOMException(DOMExceptionCode::kInvalidStateError, ""Only HTML documents support write().""); return; } if (throw_on_dynamic_markup_insertion_count_) { exception_state.ThrowDOMException( DOMExceptionCode::kInvalidStateError, ""Custom Element constructor should not use write().""); return; } if (entered_document && !GetSecurityOrigin()->IsSameSchemeHostPort( entered_document->GetSecurityOrigin())) { exception_state.ThrowSecurityError( ""Can only call write() on same-origin documents.""); return; } NestingLevelIncrementer nesting_level_incrementer(write_recursion_depth_); write_recursion_is_too_deep_ = (write_recursion_depth_ > 1) && write_recursion_is_too_deep_; write_recursion_is_too_deep_ = (write_recursion_depth_ > kCMaxWriteRecursionDepth) || write_recursion_is_too_deep_; if (write_recursion_is_too_deep_) return; bool has_insertion_point = parser_ && parser_->HasInsertionPoint(); if (!has_insertion_point && ignore_destructive_write_count_) { AddConsoleMessage( ConsoleMessage::Create(kJSMessageSource, kWarningMessageLevel, ExceptionMessages::FailedToExecute( ""write"", ""Document"", ""It isn't possible to write into a document "" ""from an asynchronously-loaded external "" ""script unless it is explicitly opened.""))); return; } if (!has_insertion_point) open(entered_document, ASSERT_NO_EXCEPTION); DCHECK(parser_); PerformanceMonitor::ReportGenericViolation( this, PerformanceMonitor::kDiscouragedAPIUse, ""Avoid using document.write()."", base::TimeDelta(), nullptr); probe::breakableLocation(this, ""Document.write""); parser_->insert(text); } ",0 "int jas_image_strtofmt(char *name) { jas_image_fmtinfo_t *fmtinfo; if (!(fmtinfo = jas_image_lookupfmtbyname(name))) { return -1; } return fmtinfo->id; } ",0 "check_KRB5SignedPath(krb5_context context, krb5_kdc_configuration *config, hdb_entry_ex *krbtgt, krb5_principal cp, EncTicketPart *tkt, krb5_principals *delegated, int *signedpath) { krb5_error_code ret; krb5_data data; krb5_crypto crypto = NULL; if (delegated) *delegated = NULL; ret = find_KRB5SignedPath(context, tkt->authorization_data, &data); if (ret == 0) { KRB5SignedPathData spd; KRB5SignedPath sp; size_t size = 0; ret = decode_KRB5SignedPath(data.data, data.length, &sp, NULL); krb5_data_free(&data); if (ret) return ret; spd.client = cp; spd.authtime = tkt->authtime; spd.delegated = sp.delegated; spd.method_data = sp.method_data; ASN1_MALLOC_ENCODE(KRB5SignedPathData, data.data, data.length, &spd, &size, ret); if (ret) { free_KRB5SignedPath(&sp); return ret; } if (data.length != size) krb5_abortx(context, ""internal asn.1 encoder error""); { Key *key; ret = hdb_enctype2key(context, &krbtgt->entry, NULL, /* XXX use correct kvno! */ sp.etype, &key); if (ret == 0) ret = krb5_crypto_init(context, &key->key, 0, &crypto); if (ret) { free(data.data); free_KRB5SignedPath(&sp); return ret; } } ret = krb5_verify_checksum(context, crypto, KRB5_KU_KRB5SIGNEDPATH, data.data, data.length, &sp.cksum); krb5_crypto_destroy(context, crypto); free(data.data); if (ret) { free_KRB5SignedPath(&sp); kdc_log(context, config, 5, ""KRB5SignedPath not signed correctly, not marking as signed""); return 0; } if (delegated && sp.delegated) { *delegated = malloc(sizeof(*sp.delegated)); if (*delegated == NULL) { free_KRB5SignedPath(&sp); return ENOMEM; } ret = copy_Principals(*delegated, sp.delegated); if (ret) { free_KRB5SignedPath(&sp); free(*delegated); *delegated = NULL; return ret; } } free_KRB5SignedPath(&sp); *signedpath = 1; } return 0; } ",0 "static int _nfs4_do_setattr(struct inode *inode, struct rpc_cred *cred, struct nfs_fattr *fattr, struct iattr *sattr, struct nfs4_state *state) { struct nfs_server *server = NFS_SERVER(inode); struct nfs_setattrargs arg = { .fh = NFS_FH(inode), .iap = sattr, .server = server, .bitmask = server->attr_bitmask, }; struct nfs_setattrres res = { .fattr = fattr, .server = server, }; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_SETATTR], .rpc_argp = &arg, .rpc_resp = &res, .rpc_cred = cred, }; unsigned long timestamp = jiffies; int status; nfs_fattr_init(fattr); if (state != NULL) { struct nfs_lockowner lockowner = { .l_owner = current->files, .l_pid = current->tgid, }; nfs4_select_rw_stateid(&arg.stateid, state, FMODE_WRITE, &lockowner); } else if (nfs4_copy_delegation_stateid(&arg.stateid, inode, FMODE_WRITE)) { /* Use that stateid */ } else nfs4_stateid_copy(&arg.stateid, &zero_stateid); status = nfs4_call_sync(server->client, server, &msg, &arg.seq_args, &res.seq_res, 1); if (status == 0 && state != NULL) renew_lease(server, timestamp); return status; } ",0 "QList Smb4KGlobal::findShareByUNC(const QString &unc) { QList shares; mutex.lock(); if (!unc.isEmpty() && !p->mountedSharesList.isEmpty()) { for (Smb4KShare *s : p->mountedSharesList) { if (QString::compare(s->unc(), unc, Qt::CaseInsensitive) == 0) { shares += s; } else { } } } else { } mutex.unlock(); return shares; } ",0 "int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to_spawn, int is_debug) /* {{{ */ { pid_t pid; struct fpm_child_s *child; int max; static int warned = 0; if (wp->config->pm == PM_STYLE_DYNAMIC) { if (!in_event_loop) { /* starting */ max = wp->config->pm_start_servers; } else { max = wp->running_children + nb_to_spawn; } } else if (wp->config->pm == PM_STYLE_ONDEMAND) { if (!in_event_loop) { /* starting */ max = 0; /* do not create any child at startup */ } else { max = wp->running_children + nb_to_spawn; } } else { /* PM_STYLE_STATIC */ max = wp->config->pm_max_children; } /* * fork children while: * - fpm_pctl_can_spawn_children : FPM is running in a NORMAL state (aka not restart, stop or reload) * - wp->running_children < max : there is less than the max process for the current pool * - (fpm_global_config.process_max < 1 || fpm_globals.running_children < fpm_global_config.process_max): * if fpm_global_config.process_max is set, FPM has not fork this number of processes (globaly) */ while (fpm_pctl_can_spawn_children() && wp->running_children < max && (fpm_global_config.process_max < 1 || fpm_globals.running_children < fpm_global_config.process_max)) { warned = 0; child = fpm_resources_prepare(wp); if (!child) { return 2; } pid = fork(); switch (pid) { case 0 : fpm_child_resources_use(child); fpm_globals.is_child = 1; fpm_child_init(wp); return 0; case -1 : zlog(ZLOG_SYSERROR, ""fork() failed""); fpm_resources_discard(child); return 2; default : child->pid = pid; fpm_clock_get(&child->started); fpm_parent_resources_use(child); zlog(is_debug ? ZLOG_DEBUG : ZLOG_NOTICE, ""[pool %s] child %d started"", wp->config->name, (int) pid); } } if (!warned && fpm_global_config.process_max > 0 && fpm_globals.running_children >= fpm_global_config.process_max) { if (wp->running_children < max) { warned = 1; zlog(ZLOG_WARNING, ""The maximum number of processes has been reached. Please review your configuration and consider raising 'process.max'""); } } return 1; /* we are done */ } /* }}} */ ",0 "pch_normalize (enum diff format) { lin old = 1; lin new = p_ptrn_lines + 1; while (p_Char[new] == '=' || p_Char[new] == '\n') new++; if (format == UNI_DIFF) { /* Convert '!' markers into '-' and '+' as defined by the Unified Format. */ for (; old <= p_ptrn_lines; old++) if (p_Char[old] == '!') p_Char[old] = '-'; for (; new <= p_end; new++) if (p_Char[new] == '!') p_Char[new] = '+'; } else { /* Convert '-' and '+' markers which are part of a group into '!' as defined by the Context Format. */ while (old <= p_ptrn_lines) { if (p_Char[old] == '-') { if (new <= p_end && p_Char[new] == '+') { do { p_Char[old] = '!'; old++; } while (old <= p_ptrn_lines && p_Char[old] == '-'); do { p_Char[new] = '!'; new++; } while (new <= p_end && p_Char[new] == '+'); } else { do old++; while (old <= p_ptrn_lines && p_Char[old] == '-'); } } else if (new <= p_end && p_Char[new] == '+') { do new++; while (new <= p_end && p_Char[new] == '+'); } else { old++; new++; } } } } ",0 "int key_update(key_ref_t key_ref, const void *payload, size_t plen) { struct key_preparsed_payload prep; struct key *key = key_ref_to_ptr(key_ref); int ret; key_check(key); /* the key must be writable */ ret = key_permission(key_ref, KEY_NEED_WRITE); if (ret < 0) goto error; /* attempt to update it if supported */ ret = -EOPNOTSUPP; if (!key->type->update) goto error; memset(&prep, 0, sizeof(prep)); prep.data = payload; prep.datalen = plen; prep.quotalen = key->type->def_datalen; prep.expiry = TIME_T_MAX; if (key->type->preparse) { ret = key->type->preparse(&prep); if (ret < 0) goto error; } down_write(&key->sem); ret = key->type->update(key, &prep); if (ret == 0) /* updating a negative key instantiates it */ clear_bit(KEY_FLAG_NEGATIVE, &key->flags); up_write(&key->sem); error: if (key->type->preparse) key->type->free_preparse(&prep); return ret; } ",0 "static void cache_grow_end(struct kmem_cache *cachep, struct page *page) { struct kmem_cache_node *n; void *list = NULL; check_irq_off(); if (!page) return; INIT_LIST_HEAD(&page->lru); n = get_node(cachep, page_to_nid(page)); spin_lock(&n->list_lock); n->total_slabs++; if (!page->active) { list_add_tail(&page->lru, &(n->slabs_free)); n->free_slabs++; } else fixup_slab_list(cachep, n, page, &list); STATS_INC_GROWN(cachep); n->free_objects += cachep->num - page->active; spin_unlock(&n->list_lock); fixup_objfreelist_debug(cachep, &list); } ",0 "static int bin_search(struct extent_buffer *eb, struct btrfs_key *key, int level, int *slot) { if (level == 0) return generic_bin_search(eb, offsetof(struct btrfs_leaf, items), sizeof(struct btrfs_item), key, btrfs_header_nritems(eb), slot); else return generic_bin_search(eb, offsetof(struct btrfs_node, ptrs), sizeof(struct btrfs_key_ptr), key, btrfs_header_nritems(eb), slot); } ",0 "static unsigned int sock_poll(struct file *file, poll_table *wait) { unsigned int busy_flag = 0; struct socket *sock; /* * We can't return errors to poll, so it's either yes or no. */ sock = file->private_data; if (sk_can_busy_loop(sock->sk)) { /* this socket can poll_ll so tell the system call */ busy_flag = POLL_BUSY_LOOP; /* once, only if requested by syscall */ if (wait && (wait->_key & POLL_BUSY_LOOP)) sk_busy_loop(sock->sk, 1); } return busy_flag | sock->ops->poll(file, sock, wait); } ",0 "exclPrefixPush(xsltStylesheetPtr style, xmlChar * value) { int i; if (style->exclPrefixMax == 0) { style->exclPrefixMax = 4; style->exclPrefixTab = (xmlChar * *)xmlMalloc(style->exclPrefixMax * sizeof(style->exclPrefixTab[0])); if (style->exclPrefixTab == NULL) { xmlGenericError(xmlGenericErrorContext, ""malloc failed !\n""); return (-1); } } /* do not push duplicates */ for (i = 0;i < style->exclPrefixNr;i++) { if (xmlStrEqual(style->exclPrefixTab[i], value)) return(-1); } if (style->exclPrefixNr >= style->exclPrefixMax) { style->exclPrefixMax *= 2; style->exclPrefixTab = (xmlChar * *)xmlRealloc(style->exclPrefixTab, style->exclPrefixMax * sizeof(style->exclPrefixTab[0])); if (style->exclPrefixTab == NULL) { xmlGenericError(xmlGenericErrorContext, ""realloc failed !\n""); return (-1); } } style->exclPrefixTab[style->exclPrefixNr] = value; style->exclPrefix = value; return (style->exclPrefixNr++); } ",0 "void InterstitialPage::UpdateTitle(RenderViewHost* render_view_host, int32 page_id, const std::wstring& title) { DCHECK(render_view_host == render_view_host_); NavigationEntry* entry = tab_->controller().GetActiveEntry(); if (!entry) { NOTREACHED(); return; } if (!new_navigation_ && !should_revert_tab_title_) { original_tab_title_ = UTF16ToWideHack(entry->title()); should_revert_tab_title_ = true; } entry->set_title(WideToUTF16Hack(title)); tab_->NotifyNavigationStateChanged(TabContents::INVALIDATE_TITLE); } ",0 "static int config_props(AVFilterLink *inlink) { KerndeintContext *kerndeint = inlink->dst->priv; const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(inlink->format); int ret; kerndeint->is_packed_rgb = av_pix_fmt_desc_get(inlink->format)->flags & AV_PIX_FMT_FLAG_RGB; kerndeint->vsub = desc->log2_chroma_h; ret = av_image_alloc(kerndeint->tmp_data, kerndeint->tmp_linesize, inlink->w, inlink->h, inlink->format, 16); if (ret < 0) return ret; memset(kerndeint->tmp_data[0], 0, ret); if ((ret = av_image_fill_linesizes(kerndeint->tmp_bwidth, inlink->format, inlink->w)) < 0) return ret; return 0; } ",0 " void RunGetNodesByIdTest(const char* message_name, bool is_detailed) { int64 root_id = kInvalidId; { ReadTransaction trans(FROM_HERE, sync_manager_.GetUserShare()); ReadNode root_node(&trans); root_node.InitByRootLookup(); root_id = root_node.GetId(); } int64 child_id = MakeNode(sync_manager_.GetUserShare(), syncable::BOOKMARKS, ""testtag""); StrictMock reply_handler; JsArgList return_args; const int64 ids[] = { root_id, child_id }; EXPECT_CALL(reply_handler, HandleJsReply(message_name, _)) .Times(arraysize(ids)).WillRepeatedly(SaveArg<1>(&return_args)); for (size_t i = 0; i < arraysize(ids); ++i) { ListValue args; ListValue* id_values = new ListValue(); args.Append(id_values); id_values->Append(Value::CreateStringValue(base::Int64ToString(ids[i]))); SendJsMessage(message_name, JsArgList(&args), reply_handler.AsWeakHandle()); CheckGetNodesByIdReturnArgs(sync_manager_, return_args, ids[i], is_detailed); } } ",0 "static int tracing_eval_map_open(struct inode *inode, struct file *filp) { if (tracing_disabled) return -ENODEV; return seq_open(filp, &tracing_eval_map_seq_ops); } ",0 "static void update_exception_bitmap(struct kvm_vcpu *vcpu) { u32 eb; eb = (1u << PF_VECTOR) | (1u << UD_VECTOR) | (1u << MC_VECTOR) | (1u << NM_VECTOR) | (1u << DB_VECTOR); if ((vcpu->guest_debug & (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) == (KVM_GUESTDBG_ENABLE | KVM_GUESTDBG_USE_SW_BP)) eb |= 1u << BP_VECTOR; if (to_vmx(vcpu)->rmode.vm86_active) eb = ~0; if (enable_ept) eb &= ~(1u << PF_VECTOR); /* bypass_guest_pf = 0 */ if (vcpu->fpu_active) eb &= ~(1u << NM_VECTOR); /* When we are running a nested L2 guest and L1 specified for it a * certain exception bitmap, we must trap the same exceptions and pass * them to L1. When running L2, we will only handle the exceptions * specified above if L1 did not want them. */ if (is_guest_mode(vcpu)) eb |= get_vmcs12(vcpu)->exception_bitmap; vmcs_write32(EXCEPTION_BITMAP, eb); } ",0 "void RenderWidgetHostImpl::PasteAndMatchStyle() { Send(new ViewMsg_PasteAndMatchStyle(GetRoutingID())); RecordAction(UserMetricsAction(""PasteAndMatchStyle"")); } ",0 "void WebPluginDelegateStub::OnDidReceiveResponse( const PluginMsg_DidReceiveResponseParams& params) { WebPluginResourceClient* client = webplugin_->GetResourceClient(params.id); if (!client) return; client->DidReceiveResponse(params.mime_type, params.headers, params.expected_length, params.last_modified, params.request_is_seekable); } ",0 "nm_setting_vpn_remove_secret (NMSettingVPN *setting, const char *key) { g_return_if_fail (NM_IS_SETTING_VPN (setting)); g_hash_table_remove (NM_SETTING_VPN_GET_PRIVATE (setting)->secrets, key); } ",0 "xmlParse3986Userinfo(xmlURIPtr uri, const char **str) { const char *cur; cur = *str; while (ISA_UNRESERVED(cur) || ISA_PCT_ENCODED(cur) || ISA_SUB_DELIM(cur) || (*cur == ':')) NEXT(cur); if (*cur == '@') { if (uri != NULL) { if (uri->user != NULL) xmlFree(uri->user); if (uri->cleanup & 2) uri->user = STRNDUP(*str, cur - *str); else uri->user = xmlURIUnescapeString(*str, cur - *str, NULL); } *str = cur; return(0); } return(1); } ",0 "static void vmw_surface_destroy_encode(uint32_t id, void *cmd_space) { struct vmw_surface_destroy *cmd = (struct vmw_surface_destroy *) cmd_space; cmd->header.id = SVGA_3D_CMD_SURFACE_DESTROY; cmd->header.size = sizeof(cmd->body); cmd->body.sid = id; } ",0 "ModuleExport size_t RegisterSUNImage(void) { MagickInfo *entry; entry=SetMagickInfo(""RAS""); entry->decoder=(DecodeImageHandler *) ReadSUNImage; entry->encoder=(EncodeImageHandler *) WriteSUNImage; entry->magick=(IsImageFormatHandler *) IsSUN; entry->description=ConstantString(""SUN Rasterfile""); entry->module=ConstantString(""SUN""); (void) RegisterMagickInfo(entry); entry=SetMagickInfo(""SUN""); entry->decoder=(DecodeImageHandler *) ReadSUNImage; entry->encoder=(EncodeImageHandler *) WriteSUNImage; entry->description=ConstantString(""SUN Rasterfile""); entry->module=ConstantString(""SUN""); (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "static void ebt_standard_compat_from_user(void *dst, const void *src) { int v = *(compat_int_t *)src; if (v >= 0) v += xt_compat_calc_jump(NFPROTO_BRIDGE, v); memcpy(dst, &v, sizeof(v)); } ",0 "SAPI_API int sapi_add_header_ex(char *header_line, uint header_line_len, zend_bool duplicate, zend_bool replace TSRMLS_DC) { sapi_header_line ctr = {0}; int r; ctr.line = header_line; ctr.line_len = header_line_len; r = sapi_header_op(replace ? SAPI_HEADER_REPLACE : SAPI_HEADER_ADD, &ctr TSRMLS_CC); if (!duplicate) efree(header_line); return r; } ",0 " void Reinitialize2() { Reinitialize(CORRUPT_CACHE_ON_LOAD_EXISTING); } ",0 "xscale1pmu_read_pmnc(void) { u32 val; asm volatile(""mrc p14, 0, %0, c0, c0, 0"" : ""=r"" (val)); return val; } ",0 "HeadlessWebContents::Builder::SetEnableBeginFrameControl( bool enable_begin_frame_control) { enable_begin_frame_control_ = enable_begin_frame_control; return *this; } ",0 "static void _c2s_pidfile(c2s_t c2s) { const char *pidfile; FILE *f; pid_t pid; pidfile = config_get_one(c2s->config, ""pidfile"", 0); if(pidfile == NULL) return; pid = getpid(); if((f = fopen(pidfile, ""w+"")) == NULL) { log_write(c2s->log, LOG_ERR, ""couldn't open %s for writing: %s"", pidfile, strerror(errno)); return; } if(fprintf(f, ""%d"", pid) < 0) { log_write(c2s->log, LOG_ERR, ""couldn't write to %s: %s"", pidfile, strerror(errno)); fclose(f); return; } fclose(f); log_write(c2s->log, LOG_INFO, ""process id is %d, written to %s"", pid, pidfile); } ",0 "process_bitmap_updates(STREAM s) { uint16 num_updates; uint16 left, top, right, bottom, width, height; uint16 cx, cy, bpp, Bpp, compress, bufsize, size; uint8 *data, *bmpdata; int i; logger(Protocol, Debug, ""%s()"", __func__); in_uint16_le(s, num_updates); for (i = 0; i < num_updates; i++) { in_uint16_le(s, left); in_uint16_le(s, top); in_uint16_le(s, right); in_uint16_le(s, bottom); in_uint16_le(s, width); in_uint16_le(s, height); in_uint16_le(s, bpp); Bpp = (bpp + 7) / 8; in_uint16_le(s, compress); in_uint16_le(s, bufsize); cx = right - left + 1; cy = bottom - top + 1; logger(Graphics, Debug, ""process_bitmap_updates(), [%d,%d,%d,%d], [%d,%d], bpp=%d, compression=%d"", left, top, right, bottom, width, height, Bpp, compress); if (!compress) { int y; bmpdata = (uint8 *) xmalloc(width * height * Bpp); for (y = 0; y < height; y++) { in_uint8a(s, &bmpdata[(height - y - 1) * (width * Bpp)], width * Bpp); } ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata); xfree(bmpdata); continue; } if (compress & 0x400) { size = bufsize; } else { in_uint8s(s, 2); /* pad */ in_uint16_le(s, size); in_uint8s(s, 4); /* line_size, final_size */ } in_uint8p(s, data, size); bmpdata = (uint8 *) xmalloc(width * height * Bpp); if (bitmap_decompress(bmpdata, width, height, data, size, Bpp)) { ui_paint_bitmap(left, top, cx, cy, width, height, bmpdata); } else { logger(Graphics, Warning, ""process_bitmap_updates(), failed to decompress bitmap""); } xfree(bmpdata); } } ",1 "v8::Handle V8DataView::setInt8Callback(const v8::Arguments& args) { INC_STATS(""DOM.DataView.setInt8""); if (args.Length() < 2) return V8Proxy::throwNotEnoughArgumentsError(); DataView* imp = V8DataView::toNative(args.Holder()); ExceptionCode ec = 0; EXCEPTION_BLOCK(unsigned, byteOffset, toUInt32(args[0])); EXCEPTION_BLOCK(int, value, toInt32(args[1])); imp->setInt8(byteOffset, static_cast(value), ec); if (UNLIKELY(ec)) V8Proxy::setDOMException(ec, args.GetIsolate()); return v8::Handle(); } ",1 "jas_image_t *jas_image_create(int numcmpts, jas_image_cmptparm_t *cmptparms, int clrspc) { jas_image_t *image; uint_fast32_t rawsize; uint_fast32_t inmem; int cmptno; jas_image_cmptparm_t *cmptparm; if (!(image = jas_image_create0())) { return 0; } image->clrspc_ = clrspc; image->maxcmpts_ = numcmpts; image->inmem_ = true; //// image->inmem_ = true; /* Allocate memory for the per-component information. */ if (!(image->cmpts_ = jas_alloc2(image->maxcmpts_, sizeof(jas_image_cmpt_t *)))) { jas_image_destroy(image); return 0; } /* Initialize in case of failure. */ for (cmptno = 0; cmptno < image->maxcmpts_; ++cmptno) { image->cmpts_[cmptno] = 0; } /* Compute the approximate raw size of the image. */ rawsize = 0; for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno, ++cmptparm) { rawsize += cmptparm->width * cmptparm->height * (cmptparm->prec + 7) / 8; } /* Decide whether to buffer the image data in memory, based on the raw size of the image. */ inmem = (rawsize < JAS_IMAGE_INMEMTHRESH); /* Create the individual image components. */ for (cmptno = 0, cmptparm = cmptparms; cmptno < numcmpts; ++cmptno, ++cmptparm) { if (!(image->cmpts_[cmptno] = jas_image_cmpt_create(cmptparm->tlx, cmptparm->tly, cmptparm->hstep, cmptparm->vstep, cmptparm->width, cmptparm->height, cmptparm->prec, cmptparm->sgnd, inmem))) { jas_image_destroy(image); return 0; } ++image->numcmpts_; } /* Determine the bounding box for all of the components on the reference grid (i.e., the image area) */ jas_image_setbbox(image); return image; } ",1 "void VideoCaptureManager::RemoveAllVideoCaptureObservers() { DCHECK_CURRENTLY_ON(BrowserThread::IO); capture_observers_.Clear(); } ",0 " explicit ClipboardMessageWatcher(InterstitialPage* interstitial) { interstitial->GetMainFrame()->GetProcess()->GetChannel()->AddFilter(this); } ",0 "bool AutolaunchInfoBarDelegate::ShouldExpire( const content::LoadCommittedDetails& details) const { return details.is_navigation_to_different_page() && should_expire_; } ",0 "void ID3::Iterator::getString(String8 *id, String8 *comment) const { getstring(id, false); if (comment != NULL) { getstring(comment, true); } } ",0 "static av_cold int lutrgb_init(AVFilterContext *ctx) { LutContext *s = ctx->priv; s->is_rgb = 1; return 0; } ",0 "int trace_array_get(struct trace_array *this_tr) { struct trace_array *tr; int ret = -ENODEV; mutex_lock(&trace_types_lock); list_for_each_entry(tr, &ftrace_trace_arrays, list) { if (tr == this_tr) { tr->ref++; ret = 0; break; } } mutex_unlock(&trace_types_lock); return ret; } ",0 "ui::AXNode* AutomationInternalCustomBindings::GetParent( ui::AXNode* node, TreeCache** in_out_cache) { if (node->parent()) return node->parent(); int parent_tree_id = (*in_out_cache)->tree.data().parent_tree_id; if (parent_tree_id < 0) return nullptr; TreeCache* parent_cache = GetTreeCacheFromTreeID(parent_tree_id); if (!parent_cache) return nullptr; if (parent_cache->parent_node_id_from_parent_tree > 0) { ui::AXNode* parent = parent_cache->tree.GetFromId( parent_cache->parent_node_id_from_parent_tree); if (parent) { int parent_child_tree_id = parent->data().GetIntAttribute(ui::AX_ATTR_CHILD_TREE_ID); if (parent_child_tree_id == (*in_out_cache)->tree_id) { *in_out_cache = parent_cache; return parent; } } } ui::AXNode* parent = FindNodeWithChildTreeId(parent_cache->tree.root(), (*in_out_cache)->tree_id); if (parent) { (*in_out_cache)->parent_node_id_from_parent_tree = parent->id(); *in_out_cache = parent_cache; return parent; } return nullptr; } ",0 "void DownloadProtectionService::CheckDownloadUrl( const content::DownloadItem& item, const CheckDownloadCallback& callback) { DCHECK(!item.GetUrlChain().empty()); scoped_refptr client( new DownloadUrlSBClient(item, callback, ui_manager_, database_manager_)); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&DownloadUrlSBClient::StartCheck, client)); } ",0 " const std::vector& redirected_navigation_urls() const { return redirected_navigation_urls_; } ",0 "void InspectorPageAgent::updateSensorsOverlayMessage() { m_overlay->setOverride(InspectorOverlay::SensorsOverride, m_geolocationOverridden || m_deviceOrientation); } ",1 "void ChromotingInstance::DidChangeFocus(bool has_focus) { DCHECK(plugin_task_runner_->BelongsToCurrentThread()); if (!IsConnected()) return; input_handler_.DidChangeFocus(has_focus); if (mouse_locker_) mouse_locker_->DidChangeFocus(has_focus); } ",0 "MagickExport void *GetBlobStreamData(const Image *image) { assert(image != (const Image *) NULL); assert(image->signature == MagickCoreSignature); return(image->blob->data); } ",0 "status_t Parcel::writeParcelFileDescriptor(int fd, int commChannel) { status_t status; if (fd < 0) { status = writeInt32(0); // ParcelFileDescriptor is null if (status) return status; } else { status = writeInt32(1); // ParcelFileDescriptor is not null if (status) return status; status = writeDupFileDescriptor(fd); if (status) return status; if (commChannel < 0) { status = writeInt32(0); // commChannel is null if (status) return status; } else { status = writeInt32(1); // commChannel is not null if (status) return status; status = writeDupFileDescriptor(commChannel); } } return status; } ",0 "static int __cfs_schedulable(struct task_group *tg, u64 period, u64 quota) { int ret; struct cfs_schedulable_data data = { .tg = tg, .period = period, .quota = quota, }; if (quota != RUNTIME_INF) { do_div(data.period, NSEC_PER_USEC); do_div(data.quota, NSEC_PER_USEC); } rcu_read_lock(); ret = walk_tg_tree(tg_cfs_schedulable_down, tg_nop, &data); rcu_read_unlock(); return ret; } ",0 "static NOINLINE int send_decline(/*uint32_t xid,*/ uint32_t server, uint32_t requested) { struct dhcp_packet packet; /* Fill in: op, htype, hlen, cookie, chaddr, random xid fields, * client-id option (unless -C), message type option: */ init_packet(&packet, DHCPDECLINE); #if 0 /* RFC 2131 says DHCPDECLINE's xid is randomly selected by client, * but in case the server is buggy and wants DHCPDECLINE's xid * to match the xid which started entire handshake, * we use the same xid we used in initial DHCPDISCOVER: */ packet.xid = xid; #endif /* DHCPDECLINE uses ""requested ip"", not ciaddr, to store offered IP */ udhcp_add_simple_option(&packet, DHCP_REQUESTED_IP, requested); udhcp_add_simple_option(&packet, DHCP_SERVER_ID, server); bb_error_msg(""sending %s"", ""decline""); return raw_bcast_from_client_config_ifindex(&packet, INADDR_ANY); } ",0 "SelectorQueryCache& Document::selectorQueryCache() { if (!m_selectorQueryCache) m_selectorQueryCache = wrapUnique(new SelectorQueryCache()); return *m_selectorQueryCache; } ",0 "ext4_ext_rm_leaf(handle_t *handle, struct inode *inode, struct ext4_ext_path *path, long long *partial_cluster, ext4_lblk_t start, ext4_lblk_t end) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); int err = 0, correct_index = 0; int depth = ext_depth(inode), credits; struct ext4_extent_header *eh; ext4_lblk_t a, b; unsigned num; ext4_lblk_t ex_ee_block; unsigned short ex_ee_len; unsigned unwritten = 0; struct ext4_extent *ex; ext4_fsblk_t pblk; /* the header must be checked already in ext4_ext_remove_space() */ ext_debug(""truncate since %u in leaf to %u\n"", start, end); if (!path[depth].p_hdr) path[depth].p_hdr = ext_block_hdr(path[depth].p_bh); eh = path[depth].p_hdr; if (unlikely(path[depth].p_hdr == NULL)) { EXT4_ERROR_INODE(inode, ""path[%d].p_hdr == NULL"", depth); return -EIO; } /* find where to start removing */ ex = path[depth].p_ext; if (!ex) ex = EXT_LAST_EXTENT(eh); ex_ee_block = le32_to_cpu(ex->ee_block); ex_ee_len = ext4_ext_get_actual_len(ex); trace_ext4_ext_rm_leaf(inode, start, ex, *partial_cluster); while (ex >= EXT_FIRST_EXTENT(eh) && ex_ee_block + ex_ee_len > start) { if (ext4_ext_is_unwritten(ex)) unwritten = 1; else unwritten = 0; ext_debug(""remove ext %u:[%d]%d\n"", ex_ee_block, unwritten, ex_ee_len); path[depth].p_ext = ex; a = ex_ee_block > start ? ex_ee_block : start; b = ex_ee_block+ex_ee_len - 1 < end ? ex_ee_block+ex_ee_len - 1 : end; ext_debug("" border %u:%u\n"", a, b); /* If this extent is beyond the end of the hole, skip it */ if (end < ex_ee_block) { /* * We're going to skip this extent and move to another, * so note that its first cluster is in use to avoid * freeing it when removing blocks. Eventually, the * right edge of the truncated/punched region will * be just to the left. */ if (sbi->s_cluster_ratio > 1) { pblk = ext4_ext_pblock(ex); *partial_cluster = -(long long) EXT4_B2C(sbi, pblk); } ex--; ex_ee_block = le32_to_cpu(ex->ee_block); ex_ee_len = ext4_ext_get_actual_len(ex); continue; } else if (b != ex_ee_block + ex_ee_len - 1) { EXT4_ERROR_INODE(inode, ""can not handle truncate %u:%u "" ""on extent %u:%u"", start, end, ex_ee_block, ex_ee_block + ex_ee_len - 1); err = -EIO; goto out; } else if (a != ex_ee_block) { /* remove tail of the extent */ num = a - ex_ee_block; } else { /* remove whole extent: excellent! */ num = 0; } /* * 3 for leaf, sb, and inode plus 2 (bmap and group * descriptor) for each block group; assume two block * groups plus ex_ee_len/blocks_per_block_group for * the worst case */ credits = 7 + 2*(ex_ee_len/EXT4_BLOCKS_PER_GROUP(inode->i_sb)); if (ex == EXT_FIRST_EXTENT(eh)) { correct_index = 1; credits += (ext_depth(inode)) + 1; } credits += EXT4_MAXQUOTAS_TRANS_BLOCKS(inode->i_sb); err = ext4_ext_truncate_extend_restart(handle, inode, credits); if (err) goto out; err = ext4_ext_get_access(handle, inode, path + depth); if (err) goto out; err = ext4_remove_blocks(handle, inode, ex, partial_cluster, a, b); if (err) goto out; if (num == 0) /* this extent is removed; mark slot entirely unused */ ext4_ext_store_pblock(ex, 0); ex->ee_len = cpu_to_le16(num); /* * Do not mark unwritten if all the blocks in the * extent have been removed. */ if (unwritten && num) ext4_ext_mark_unwritten(ex); /* * If the extent was completely released, * we need to remove it from the leaf */ if (num == 0) { if (end != EXT_MAX_BLOCKS - 1) { /* * For hole punching, we need to scoot all the * extents up when an extent is removed so that * we dont have blank extents in the middle */ memmove(ex, ex+1, (EXT_LAST_EXTENT(eh) - ex) * sizeof(struct ext4_extent)); /* Now get rid of the one at the end */ memset(EXT_LAST_EXTENT(eh), 0, sizeof(struct ext4_extent)); } le16_add_cpu(&eh->eh_entries, -1); } err = ext4_ext_dirty(handle, inode, path + depth); if (err) goto out; ext_debug(""new extent: %u:%u:%llu\n"", ex_ee_block, num, ext4_ext_pblock(ex)); ex--; ex_ee_block = le32_to_cpu(ex->ee_block); ex_ee_len = ext4_ext_get_actual_len(ex); } if (correct_index && eh->eh_entries) err = ext4_ext_correct_indexes(handle, inode, path); /* * If there's a partial cluster and at least one extent remains in * the leaf, free the partial cluster if it isn't shared with the * current extent. If it is shared with the current extent * we zero partial_cluster because we've reached the start of the * truncated/punched region and we're done removing blocks. */ if (*partial_cluster > 0 && ex >= EXT_FIRST_EXTENT(eh)) { pblk = ext4_ext_pblock(ex) + ex_ee_len - 1; if (*partial_cluster != (long long) EXT4_B2C(sbi, pblk)) { ext4_free_blocks(handle, inode, NULL, EXT4_C2B(sbi, *partial_cluster), sbi->s_cluster_ratio, get_default_free_blocks_flags(inode)); } *partial_cluster = 0; } /* if this leaf is free, then we should * remove it from index block above */ if (err == 0 && eh->eh_entries == 0 && path[depth].p_bh != NULL) err = ext4_ext_rm_idx(handle, inode, path, depth); out: return err; } ",0 "void AppCacheDatabase::ReadNamespaceRecord( const sql::Statement* statement, NamespaceRecord* record) { record->cache_id = statement->ColumnInt64(0); record->origin = url::Origin::Create(GURL(statement->ColumnString(1))); record->namespace_.type = static_cast(statement->ColumnInt(2)); record->namespace_.namespace_url = GURL(statement->ColumnString(3)); record->namespace_.target_url = GURL(statement->ColumnString(4)); record->namespace_.is_pattern = statement->ColumnBool(5); DCHECK(record->namespace_.type == APPCACHE_FALLBACK_NAMESPACE || record->namespace_.type == APPCACHE_INTERCEPT_NAMESPACE); } ",0 "static void destroy_async_on_interface(struct usb_dev_state *ps, unsigned int ifnum) { struct list_head *p, *q, hitlist; unsigned long flags; INIT_LIST_HEAD(&hitlist); spin_lock_irqsave(&ps->lock, flags); list_for_each_safe(p, q, &ps->async_pending) if (ifnum == list_entry(p, struct async, asynclist)->ifnum) list_move_tail(p, &hitlist); spin_unlock_irqrestore(&ps->lock, flags); destroy_async(ps, &hitlist); } ",0 "void SoftwareEmulation(struct pt_regs *regs) { extern int do_mathemu(struct pt_regs *); extern int Soft_emulate_8xx(struct pt_regs *); int errcode; CHECK_FULL_REGS(regs); if (!user_mode(regs)) { debugger(regs); die(""Kernel Mode Software FPU Emulation"", regs, SIGFPE); } #ifdef CONFIG_MATH_EMULATION errcode = do_mathemu(regs); #else errcode = Soft_emulate_8xx(regs); #endif if (errcode) { if (errcode > 0) _exception(SIGFPE, regs, 0, 0); else if (errcode == -EFAULT) _exception(SIGSEGV, regs, 0, 0); else _exception(SIGILL, regs, ILL_ILLOPC, regs->nip); } else emulate_single_step(regs); } ",0 " void ParseCommandLineAndFieldTrials(const base::CommandLine& command_line) { network_session_configurator::ParseCommandLineAndFieldTrials( command_line, /*is_quic_force_disabled=*/false, quic_user_agent_id_, ¶ms_); } ",0 "static js_Ast *identifiername(js_State *J) { if (J->lookahead == TK_IDENTIFIER || J->lookahead >= TK_BREAK) { js_Ast *a = jsP_newstrnode(J, AST_IDENTIFIER, J->text); jsP_next(J); return a; } jsP_error(J, ""unexpected token: %s (expected identifier or keyword)"", jsY_tokenstring(J->lookahead)); } ",0 "bool TestURLLoader::Init() { if (!CheckTestingInterface()) { instance_->AppendError(""Testing interface not available""); return false; } const PPB_FileIO* file_io_interface = static_cast( pp::Module::Get()->GetBrowserInterface(PPB_FILEIO_INTERFACE)); if (!file_io_interface) instance_->AppendError(""FileIO interface not available""); file_io_private_interface_ = static_cast( pp::Module::Get()->GetBrowserInterface(PPB_FILEIO_PRIVATE_INTERFACE)); if (!file_io_private_interface_) instance_->AppendError(""FileIO_Private interface not available""); url_loader_trusted_interface_ = static_cast( pp::Module::Get()->GetBrowserInterface(PPB_URLLOADERTRUSTED_INTERFACE)); if (!testing_interface_->IsOutOfProcess()) { #if !(defined __native_client__) if (!url_loader_trusted_interface_) instance_->AppendError(""URLLoaderTrusted interface not available""); #else if (url_loader_trusted_interface_) instance_->AppendError(""URLLoaderTrusted interface is supported by NaCl""); #endif } return EnsureRunningOverHTTP(); } ",0 "ResetView* OobeUI::GetResetView() { return reset_view_; } ",0 "ssize_t generic_file_aio_write(struct kiocb *iocb, const struct iovec *iov, unsigned long nr_segs, loff_t pos) { struct file *file = iocb->ki_filp; struct address_space *mapping = file->f_mapping; struct inode *inode = mapping->host; ssize_t ret; BUG_ON(iocb->ki_pos != pos); mutex_lock(&inode->i_mutex); ret = __generic_file_aio_write_nolock(iocb, iov, nr_segs, &iocb->ki_pos); mutex_unlock(&inode->i_mutex); if (ret > 0 && ((file->f_flags & O_SYNC) || IS_SYNC(inode))) { ssize_t err; err = sync_page_range(inode, mapping, pos, ret); if (err < 0) ret = err; } return ret; } ",0 "MagickExport XMLTreeInfo *GetXMLTreePath(XMLTreeInfo *xml_info,const char *path) { char **components, subnode[MaxTextExtent], tag[MaxTextExtent]; register ssize_t i; size_t number_components; ssize_t j; XMLTreeInfo *node; assert(xml_info != (XMLTreeInfo *) NULL); assert((xml_info->signature == MagickSignature) || (((XMLTreeRoot *) xml_info)->signature == MagickSignature)); if (xml_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""...""); node=xml_info; components=GetPathComponents(path,&number_components); if (components == (char **) NULL) return((XMLTreeInfo *) NULL); for (i=0; i < (ssize_t) number_components; i++) { GetPathComponent(components[i],SubimagePath,subnode); GetPathComponent(components[i],CanonicalPath,tag); node=GetXMLTreeChild(node,tag); if (node == (XMLTreeInfo *) NULL) break; for (j=(ssize_t) StringToLong(subnode)-1; j > 0; j--) { node=GetXMLTreeOrdered(node); if (node == (XMLTreeInfo *) NULL) break; } if (node == (XMLTreeInfo *) NULL) break; components[i]=DestroyString(components[i]); } for ( ; i < (ssize_t) number_components; i++) components[i]=DestroyString(components[i]); components=(char **) RelinquishMagickMemory(components); return(node); } ",0 "static CHANNEL_SETUP_REC *create_channel_setup(void) { return g_malloc0(sizeof(CHANNEL_SETUP_REC)); } ",0 "_TIFFmemcmp(const void* p1, const void* p2, tmsize_t c) { return (memcmp(p1, p2, (size_t) c)); } ",0 "static int ftrace_function_set_regexp(struct ftrace_ops *ops, int filter, int reset, char *re, int len) { int ret; if (filter) ret = ftrace_set_filter(ops, re, len, reset); else ret = ftrace_set_notrace(ops, re, len, reset); return ret; } ",0 "bool ChromeContentBrowserClient::ShouldUseProcessPerSite( content::BrowserContext* browser_context, const GURL& effective_url) { Profile* profile = Profile::FromBrowserContext(browser_context); if (!profile) return false; if (chrome::search::ShouldAssignURLToInstantRenderer(effective_url, profile)) return true; if (!effective_url.SchemeIs(extensions::kExtensionScheme)) return false; ExtensionService* extension_service = extensions::ExtensionSystem::Get(profile)->extension_service(); if (!extension_service) return false; const Extension* extension = extension_service->extensions()-> GetExtensionOrAppByURL(ExtensionURLInfo(effective_url)); if (!extension) return false; if (extension->GetType() == Manifest::TYPE_HOSTED_APP) { if (!extension->HasAPIPermission(APIPermission::kBackground) || !extension->allow_background_js_access()) { return false; } } return true; } ",0 "void TestingAutomationProvider::SetPolicies( DictionaryValue* args, IPC::Message* reply_message) { scoped_ptr reply( new AutomationJSONReply(this, reply_message)); #if !defined(ENABLE_CONFIGURATION_POLICY) || defined(OFFICIAL_BUILD) reply->SendError(""Configuration Policy disabled""); #else const policy::PolicyDefinitionList* list = policy::GetChromePolicyDefinitionList(); policy::BrowserPolicyConnector* connector = g_browser_process->browser_policy_connector(); struct { std::string name; policy::ConfigurationPolicyProvider* provider; } providers[] = { { ""managed_cloud"", connector->GetManagedCloudProvider() }, { ""managed_platform"", connector->GetManagedPlatformProvider() }, { ""recommended_cloud"", connector->GetRecommendedCloudProvider() }, { ""recommended_platform"", connector->GetRecommendedPlatformProvider() } }; for (size_t i = 0; i < ARRAYSIZE_UNSAFE(providers); ++i) { DictionaryValue* policies = NULL; if (args->GetDictionary(providers[i].name, &policies) && policies && !providers[i].provider) { reply->SendError(""Provider not available: "" + providers[i].name); return; } } for (size_t i = 0; i < ARRAYSIZE_UNSAFE(providers); ++i) { DictionaryValue* policies = NULL; if (args->GetDictionary(providers[i].name, &policies) && policies) { policy::PolicyMap* map = new policy::PolicyMap; map->LoadFrom(policies, list); providers[i].provider->OverridePolicies(map); } } PolicyUpdatesObserver::PostCallbackAfterPolicyUpdates( base::Bind(&AutomationJSONReply::SendSuccess, base::Owned(reply.release()), static_cast(NULL))); #endif // defined(OFFICIAL_BUILD) } ",0 "static bool access_pmovs(struct kvm_vcpu *vcpu, struct sys_reg_params *p, const struct sys_reg_desc *r) { u64 mask = kvm_pmu_valid_counter_mask(vcpu); if (!kvm_arm_pmu_v3_ready(vcpu)) return trap_raz_wi(vcpu, p, r); if (pmu_access_el0_disabled(vcpu)) return false; if (p->is_write) { if (r->CRm & 0x2) /* accessing PMOVSSET_EL0 */ kvm_pmu_overflow_set(vcpu, p->regval & mask); else /* accessing PMOVSCLR_EL0 */ vcpu_sys_reg(vcpu, PMOVSSET_EL0) &= ~(p->regval & mask); } else { p->regval = vcpu_sys_reg(vcpu, PMOVSSET_EL0) & mask; } return true; } ",0 "horAcc32(TIFF* tif, uint8* cp0, tmsize_t cc) { tmsize_t stride = PredictorState(tif)->stride; uint32* wp = (uint32*) cp0; tmsize_t wc = cc / 4; if((cc%(4*stride))!=0) { TIFFErrorExt(tif->tif_clientdata, ""horAcc32"", ""%s"", ""cc%(4*stride))!=0""); return 0; } if (wc > stride) { wc -= stride; do { REPEAT4(stride, wp[stride] += wp[0]; wp++) wc -= stride; } while (wc > 0); } return 1; } ",0 "do_motd(void) { FILE *f; char buf[256]; if (options.print_motd) { #ifdef HAVE_LOGIN_CAP f = fopen(login_getcapstr(lc, ""welcome"", ""/etc/motd"", ""/etc/motd""), ""r""); #else f = fopen(""/etc/motd"", ""r""); #endif if (f) { while (fgets(buf, sizeof(buf), f)) fputs(buf, stdout); fclose(f); } } } ",0 " RemoveFaviconTester() {} ",0 "circle_poly(PG_FUNCTION_ARGS) { int32 npts = PG_GETARG_INT32(0); CIRCLE *circle = PG_GETARG_CIRCLE_P(1); POLYGON *poly; int base_size, size; int i; double angle; double anglestep; if (FPzero(circle->radius)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg(""cannot convert circle with radius zero to polygon""))); if (npts < 2) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg(""must request at least 2 points""))); base_size = sizeof(poly->p[0]) * npts; size = offsetof(POLYGON, p[0]) +base_size; /* Check for integer overflow */ if (base_size / npts != sizeof(poly->p[0]) || size <= base_size) ereport(ERROR, (errcode(ERRCODE_PROGRAM_LIMIT_EXCEEDED), errmsg(""too many points requested""))); poly = (POLYGON *) palloc0(size); /* zero any holes */ SET_VARSIZE(poly, size); poly->npts = npts; anglestep = (2.0 * M_PI) / npts; for (i = 0; i < npts; i++) { angle = i * anglestep; poly->p[i].x = circle->center.x - (circle->radius * cos(angle)); poly->p[i].y = circle->center.y + (circle->radius * sin(angle)); } make_bound_box(poly); PG_RETURN_POLYGON_P(poly); } ",0 "static int cxusb_d680_dmb_frontend_attach(struct dvb_usb_adapter *adap) { struct dvb_usb_device *d = adap->dev; int n; /* Select required USB configuration */ if (usb_set_interface(d->udev, 0, 0) < 0) err(""set interface failed""); /* Unblock all USB pipes */ usb_clear_halt(d->udev, usb_sndbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.generic_bulk_ctrl_endpoint)); usb_clear_halt(d->udev, usb_rcvbulkpipe(d->udev, d->props.adapter[0].fe[0].stream.endpoint)); /* Drain USB pipes to avoid hang after reboot */ for (n = 0; n < 5; n++) { cxusb_d680_dmb_drain_message(d); cxusb_d680_dmb_drain_video(d); msleep(200); } /* Reset the tuner */ if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 0) < 0) { err(""clear tuner gpio failed""); return -EIO; } msleep(100); if (cxusb_d680_dmb_gpio_tuner(d, 0x07, 1) < 0) { err(""set tuner gpio failed""); return -EIO; } msleep(100); /* Attach frontend */ adap->fe_adap[0].fe = dvb_attach(lgs8gxx_attach, &d680_lgs8gl5_cfg, &d->i2c_adap); if (adap->fe_adap[0].fe == NULL) return -EIO; return 0; } ",0 "void* message_thread(void *input) { omx_vdec* omx = reinterpret_cast(input); unsigned char id; int n; DEBUG_PRINT_HIGH(""omx_vdec: message thread start""); prctl(PR_SET_NAME, (unsigned long)""VideoDecMsgThread"", 0, 0, 0); while (1) { n = read(omx->m_pipe_in, &id, 1); if (0 == n) { break; } if (1 == n) { omx->process_event_cb(omx, id); } if ((n < 0) && (errno != EINTR)) { DEBUG_PRINT_LOW(""ERROR: read from pipe failed, ret %d errno %d"", n, errno); break; } } DEBUG_PRINT_HIGH(""omx_vdec: message thread stop""); return 0; } ",0 "Window enl_ipc_get_win(void) { unsigned char *str = NULL; Atom prop, prop2, ever; unsigned long num, after; int format; Window dummy_win; int dummy_int; unsigned int dummy_uint; D((""Searching for IPC window.\n"")); /* * Shortcircuit this entire func * if we already know it's an e17 fake */ if (e17_fake_ipc) return(ipc_win); prop = XInternAtom(disp, ""ENLIGHTENMENT_COMMS"", True); if (prop == None) { D((""Enlightenment is not running.\n"")); return(None); } else { /* XXX: This will only work with E17 prior to 6/22/2005 */ ever = XInternAtom(disp, ""ENLIGHTENMENT_VERSION"", True); if (ever == None) { /* This is an E without ENLIGHTENMENT_VERSION */ D((""E16 IPC Protocol not supported"")); return(None); } } XGetWindowProperty(disp, root, prop, 0, 14, False, AnyPropertyType, &prop2, &format, &num, &after, &str); if (str) { sscanf((char *) str, ""%*s %x"", (unsigned int *) &ipc_win); XFree(str); } if (ipc_win != None) { if (!XGetGeometry (disp, ipc_win, &dummy_win, &dummy_int, &dummy_int, &dummy_uint, &dummy_uint, &dummy_uint, &dummy_uint)) { D(("" -> IPC Window property is valid, but the window doesn't exist.\n"")); ipc_win = None; } str = NULL; if (ipc_win != None) { XGetWindowProperty(disp, ipc_win, prop, 0, 14, False, AnyPropertyType, &prop2, &format, &num, &after, &str); if (str) { XFree(str); } else { D(("" -> IPC Window lacks the proper atom. I can't talk to fake IPC windows....\n"")); ipc_win = None; } } } if (ipc_win != None) { XGetWindowProperty(disp, ipc_win, ever, 0, 14, False, AnyPropertyType, &prop2, &format, &num, &after, &str); if (str) { /* * This is E17's way of telling us it's only pretending * as a workaround for a bug related to the way java handles * Window Managers. * (Only valid after date of this comment) * -- richlowe 2005-06-22 */ XFree(str); D(("" -> Found a fake E17 IPC window, ignoring"")); ipc_win = None; e17_fake_ipc = 1; return(ipc_win); } D(("" -> IPC Window found and verified as 0x%08x. Registering feh as an IPC client.\n"", (int) ipc_win)); XSelectInput(disp, ipc_win, StructureNotifyMask | SubstructureNotifyMask); enl_ipc_send(""set clientname "" PACKAGE); enl_ipc_send(""set version "" VERSION); enl_ipc_send(""set email tom@linuxbrit.co.uk""); enl_ipc_send(""set web http://www.linuxbrit.co.uk""); enl_ipc_send(""set info Feh - be pr0n or be dead""); } if (my_ipc_win == None) { my_ipc_win = XCreateSimpleWindow(disp, root, -2, -2, 1, 1, 0, 0, 0); } return(ipc_win); } ",0 "static BOOLEAN btif_hl_proc_sdp_query_cfm(tBTA_HL *p_data){ btif_hl_app_cb_t *p_acb; btif_hl_mcl_cb_t *p_mcb; tBTA_HL_SDP *p_sdp; tBTA_HL_CCH_OPEN_PARAM open_param; UINT8 app_idx, mcl_idx, sdp_idx = 0; UINT8 num_recs, i, num_mdeps, j; btif_hl_cch_op_t old_cch_oper; BOOLEAN status =FALSE; btif_hl_pending_chan_cb_t *p_pcb; BTIF_TRACE_DEBUG(""%s"", __FUNCTION__); p_sdp = p_data->sdp_query_cfm.p_sdp; num_recs = p_sdp->num_recs; BTIF_TRACE_DEBUG(""num of SDP records=%d"",num_recs); for (i=0; isdp_rec[i].ctrl_psm, p_sdp->sdp_rec[i].data_psm); BTIF_TRACE_DEBUG(""MCAP supported procedures=0x%x"",p_sdp->sdp_rec[i].mcap_sup_proc); num_mdeps = p_sdp->sdp_rec[i].num_mdeps; BTIF_TRACE_DEBUG(""num of mdeps =%d"",num_mdeps); for (j=0; j< num_mdeps; j++) { BTIF_TRACE_DEBUG(""mdep_idx=%d mdep_id=0x%x data_type=0x%x mdep_role=0x%x"", (j+1), p_sdp->sdp_rec[i].mdep_cfg[j].mdep_id, p_sdp->sdp_rec[i].mdep_cfg[j].data_type, p_sdp->sdp_rec[i].mdep_cfg[j].mdep_role ); } } if (btif_hl_find_app_idx_using_app_id(p_data->sdp_query_cfm.app_id, &app_idx)) { p_acb = BTIF_HL_GET_APP_CB_PTR(app_idx); if (btif_hl_find_mcl_idx(app_idx, p_data->sdp_query_cfm.bd_addr, &mcl_idx)) { p_mcb = BTIF_HL_GET_MCL_CB_PTR(app_idx, mcl_idx); if (p_mcb->cch_oper != BTIF_HL_CCH_OP_NONE) { memcpy(&p_mcb->sdp, p_sdp, sizeof(tBTA_HL_SDP)); old_cch_oper = p_mcb->cch_oper; p_mcb->cch_oper = BTIF_HL_CCH_OP_NONE; switch (old_cch_oper) { case BTIF_HL_CCH_OP_MDEP_FILTERING: status = btif_hl_find_sdp_idx_using_mdep_filter(app_idx, mcl_idx, &sdp_idx); break; default: break; } if (status) { p_mcb->sdp_idx = sdp_idx; p_mcb->valid_sdp_idx = TRUE; p_mcb->ctrl_psm = p_mcb->sdp.sdp_rec[sdp_idx].ctrl_psm; switch (old_cch_oper) { case BTIF_HL_CCH_OP_MDEP_FILTERING: p_pcb = BTIF_HL_GET_PCB_PTR(app_idx, mcl_idx); if (p_pcb->in_use) { if (!p_pcb->abort_pending) { switch (p_pcb->op) { case BTIF_HL_PEND_DCH_OP_OPEN: btif_hl_send_setup_connecting_cb(app_idx, mcl_idx); break; case BTIF_HL_PEND_DCH_OP_DELETE_MDL: default: break; } open_param.ctrl_psm = p_mcb->ctrl_psm; bdcpy(open_param.bd_addr, p_mcb->bd_addr); open_param.sec_mask = (BTA_SEC_AUTHENTICATE | BTA_SEC_ENCRYPT); BTA_HlCchOpen(p_acb->app_id,p_acb->app_handle, &open_param); } else { BTIF_TRACE_DEBUG(""channel abort pending""); } } break; case BTIF_HL_CCH_OP_DCH_OPEN: status = btif_hl_proc_pending_op(app_idx,mcl_idx); break; default: BTIF_TRACE_ERROR(""Invalid CCH oper %d"", old_cch_oper); break; } } else { BTIF_TRACE_ERROR(""Can not find SDP idx discard CCH Open request""); } } } } return status; } ",0 "void FFmpegVideoDecoder::Decode(const scoped_refptr& buffer, const DecodeCB& decode_cb) { DCHECK(task_runner_->BelongsToCurrentThread()); DCHECK(!decode_cb.is_null()); CHECK_NE(state_, kUninitialized); CHECK(decode_cb_.is_null()) << ""Overlapping decodes are not supported.""; decode_cb_ = BindToCurrentLoop(decode_cb); if (state_ == kError) { base::ResetAndReturn(&decode_cb_).Run(kDecodeError, NULL); return; } if (state_ == kDecodeFinished) { base::ResetAndReturn(&decode_cb_).Run(kOk, VideoFrame::CreateEOSFrame()); return; } DecodeBuffer(buffer); } ",0 "int vcc_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *m, size_t total_len) { struct sock *sk = sock->sk; DEFINE_WAIT(wait); struct atm_vcc *vcc; struct sk_buff *skb; int eff, error; const void __user *buff; int size; lock_sock(sk); if (sock->state != SS_CONNECTED) { error = -ENOTCONN; goto out; } if (m->msg_name) { error = -EISCONN; goto out; } if (m->msg_iovlen != 1) { error = -ENOSYS; /* fix this later @@@ */ goto out; } buff = m->msg_iov->iov_base; size = m->msg_iov->iov_len; vcc = ATM_SD(sock); if (test_bit(ATM_VF_RELEASED, &vcc->flags) || test_bit(ATM_VF_CLOSE, &vcc->flags) || !test_bit(ATM_VF_READY, &vcc->flags)) { error = -EPIPE; send_sig(SIGPIPE, current, 0); goto out; } if (!size) { error = 0; goto out; } if (size < 0 || size > vcc->qos.txtp.max_sdu) { error = -EMSGSIZE; goto out; } eff = (size+3) & ~3; /* align to word boundary */ prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); error = 0; while (!(skb = alloc_tx(vcc, eff))) { if (m->msg_flags & MSG_DONTWAIT) { error = -EAGAIN; break; } schedule(); if (signal_pending(current)) { error = -ERESTARTSYS; break; } if (test_bit(ATM_VF_RELEASED, &vcc->flags) || test_bit(ATM_VF_CLOSE, &vcc->flags) || !test_bit(ATM_VF_READY, &vcc->flags)) { error = -EPIPE; send_sig(SIGPIPE, current, 0); break; } prepare_to_wait(sk_sleep(sk), &wait, TASK_INTERRUPTIBLE); } finish_wait(sk_sleep(sk), &wait); if (error) goto out; skb->dev = NULL; /* for paths shared with net_device interfaces */ ATM_SKB(skb)->atm_options = vcc->atm_options; if (copy_from_user(skb_put(skb, size), buff, size)) { kfree_skb(skb); error = -EFAULT; goto out; } if (eff != size) memset(skb->data + size, 0, eff-size); error = vcc->dev->ops->send(vcc, skb); error = error ? error : size; out: release_sock(sk); return error; } ",0 "void CustomButton::SetState(ButtonState state) { if (state == state_) return; if (animate_on_state_change_ && (!is_throbbing_ || !hover_animation_->is_animating())) { is_throbbing_ = false; if ((state_ == STATE_HOVERED) && (state == STATE_NORMAL)) { hover_animation_->Hide(); } else if (state != STATE_HOVERED) { hover_animation_->Reset(); } else if (state_ == STATE_NORMAL) { hover_animation_->Show(); } else { hover_animation_->Reset(1); } } state_ = state; StateChanged(); SchedulePaint(); } ",0 "v8::Handle SerializedScriptValue::deserialize(MessagePortArray* messagePorts) { return deserialize(v8::Isolate::GetCurrent(), messagePorts, 0); } ",0 "void RenderProcessImpl::ClearTransportDIBCache() { for (size_t i = 0; i < arraysize(shared_mem_cache_); ++i) { if (shared_mem_cache_[i]) { FreeTransportDIB(shared_mem_cache_[i]); shared_mem_cache_[i] = NULL; } } } ",0 "void sidx_del(GF_Box *s) { GF_SegmentIndexBox *ptr = (GF_SegmentIndexBox *) s; if (ptr == NULL) return; if (ptr->refs) gf_free(ptr->refs); gf_free(ptr); } ",0 "static void DetectRunPostMatch(ThreadVars *tv, DetectEngineThreadCtx *det_ctx, Packet *p, const Signature *s) { /* run the packet match functions */ const SigMatchData *smd = s->sm_arrays[DETECT_SM_LIST_POSTMATCH]; if (smd != NULL) { KEYWORD_PROFILING_SET_LIST(det_ctx, DETECT_SM_LIST_POSTMATCH); SCLogDebug(""running match functions, sm %p"", smd); while (1) { KEYWORD_PROFILING_START; (void)sigmatch_table[smd->type].Match(tv, det_ctx, p, s, smd->ctx); KEYWORD_PROFILING_END(det_ctx, smd->type, 1); if (smd->is_last) break; smd++; } } DetectReplaceExecute(p, det_ctx); if (s->flags & SIG_FLAG_FILESTORE) DetectFilestorePostMatch(tv, det_ctx, p, s); return; } ",0 "void ExpandableContainerView::ButtonPressed( views::Button* sender, const ui::Event& event) { ToggleDetailLevel(); } ",0 " bool pinch_update() const { return pinch_update_; } ",0 "int WebSocketExperimentTask::DoURLFetchComplete(int result) { url_fetcher_.reset(); if (result < 0) return result; next_state_ = STATE_WEBSOCKET_CONNECT; return net::OK; } ",0 "static void shrink_dentry_list(struct list_head *list) { struct dentry *dentry, *parent; while (!list_empty(list)) { struct inode *inode; dentry = list_entry(list->prev, struct dentry, d_lru); spin_lock(&dentry->d_lock); parent = lock_parent(dentry); /* * The dispose list is isolated and dentries are not accounted * to the LRU here, so we can simply remove it from the list * here regardless of whether it is referenced or not. */ d_shrink_del(dentry); /* * We found an inuse dentry which was not removed from * the LRU because of laziness during lookup. Do not free it. */ if (dentry->d_lockref.count > 0) { spin_unlock(&dentry->d_lock); if (parent) spin_unlock(&parent->d_lock); continue; } if (unlikely(dentry->d_flags & DCACHE_DENTRY_KILLED)) { bool can_free = dentry->d_flags & DCACHE_MAY_FREE; spin_unlock(&dentry->d_lock); if (parent) spin_unlock(&parent->d_lock); if (can_free) dentry_free(dentry); continue; } inode = dentry->d_inode; if (inode && unlikely(!spin_trylock(&inode->i_lock))) { d_shrink_add(dentry, list); spin_unlock(&dentry->d_lock); if (parent) spin_unlock(&parent->d_lock); continue; } __dentry_kill(dentry); /* * We need to prune ancestors too. This is necessary to prevent * quadratic behavior of shrink_dcache_parent(), but is also * expected to be beneficial in reducing dentry cache * fragmentation. */ dentry = parent; while (dentry && !lockref_put_or_lock(&dentry->d_lockref)) { parent = lock_parent(dentry); if (dentry->d_lockref.count != 1) { dentry->d_lockref.count--; spin_unlock(&dentry->d_lock); if (parent) spin_unlock(&parent->d_lock); break; } inode = dentry->d_inode; /* can't be NULL */ if (unlikely(!spin_trylock(&inode->i_lock))) { spin_unlock(&dentry->d_lock); if (parent) spin_unlock(&parent->d_lock); cpu_relax(); continue; } __dentry_kill(dentry); dentry = parent; } } } ",0 "QuicStreamOffset QuicStreamSequencerBuffer::BytesConsumed() const { return total_bytes_read_; } ",0 "CJSON_PUBLIC(void) cJSON_AddItemReferenceToObject(cJSON *object, const char *string, cJSON *item) { if ((object == NULL) || (string == NULL)) { return; } add_item_to_object(object, string, create_reference(item, &global_hooks), &global_hooks, false); } ",0 "static int itacns_init(sc_pkcs15_card_t *p15card) { int r; sc_path_t path; int certificate_count = 0; int found_certs; int card_is_cie_v1, cns0_secenv; SC_FUNC_CALLED(p15card->card->ctx, 1); set_string(&p15card->tokeninfo->label, p15card->card->name); if(p15card->card->drv_data) { unsigned int mask_code, ic_code; char buffer[256]; itacns_drv_data_t *data = (itacns_drv_data_t*) p15card->card->drv_data; mask_code = data->mask_manufacturer_code; if (mask_code >= sizeof(itacns_mask_manufacturers) /sizeof(itacns_mask_manufacturers[0])) mask_code = 0; ic_code = data->ic_manufacturer_code; if (ic_code >= sizeof(iso7816_ic_manufacturers) /sizeof(iso7816_ic_manufacturers[0])) ic_code = 0; snprintf(buffer, sizeof(buffer), ""IC: %s; mask: %s"", iso7816_ic_manufacturers[ic_code], itacns_mask_manufacturers[mask_code]); set_string(&p15card->tokeninfo->manufacturer_id, buffer); } /* Read and set serial */ { u8 serial[17]; int bytes; sc_format_path(path_serial, &path); bytes = loadFile(p15card, &path, serial, 16); if (bytes < 0) return bytes; if (bytes > 16) return -1; serial[bytes] = '\0'; set_string(&p15card->tokeninfo->serial_number, (char*)serial); } /* Is the card a CIE v1? */ card_is_cie_v1 = (p15card->card->type == SC_CARD_TYPE_ITACNS_CIE_V1) || (p15card->card->type == SC_CARD_TYPE_CARDOS_CIE_V1); cns0_secenv = (card_is_cie_v1 ? 0x31 : 0x01); /* If it's a Siemens CIE v1 card, set algo flags accordingly. */ if (card_is_cie_v1) { int i; for (i = 0; i < p15card->card->algorithm_count; i++) { sc_algorithm_info_t *info = &p15card->card->algorithms[i]; if (info->algorithm != SC_ALGORITHM_RSA) continue; info->flags &= ~(SC_ALGORITHM_RSA_RAW | SC_ALGORITHM_RSA_HASH_NONE); info->flags |= (SC_ALGORITHM_RSA_PAD_PKCS1 | SC_ALGORITHM_RSA_HASHES); } } /* Data files */ r = itacns_add_data_files(p15card); SC_TEST_RET(p15card->card->ctx, SC_LOG_DEBUG_NORMAL, r, ""Could not add data files""); /*** Certificate and keys. ***/ /* Standard CNS */ r = itacns_check_and_add_keyset(p15card, ""CNS0"", cns0_secenv, 0, ""3F0011001101"", ""3F003F01"", NULL, 0x10, &found_certs); SC_TEST_RET(p15card->card->ctx, SC_LOG_DEBUG_NORMAL, r, ""Could not add CNS0""); certificate_count += found_certs; /* Infocamere 1204 */ r = itacns_check_and_add_keyset(p15card, ""CNS01"", 0x21, 5, ""3F002FFF8228"", NULL, ""3F002FFF0000"", 0x10, &found_certs); SC_TEST_RET(p15card->card->ctx, SC_LOG_DEBUG_NORMAL, r, ""Could not add CNS01""); certificate_count += found_certs; /* Digital signature */ r = itacns_check_and_add_keyset(p15card, ""CNS1"", 0x10, 0, ""3F0014009010"", ""3F00140081108010"", ""3F0014008110"", 0x1a, &found_certs); SC_TEST_RET(p15card->card->ctx, SC_LOG_DEBUG_NORMAL, r, ""Could not add CNS1""); certificate_count += found_certs; /* Did we find anything? */ if (certificate_count == 0) sc_debug(p15card->card->ctx, SC_LOG_DEBUG_VERBOSE, ""Warning: no certificates found!""); /* Back to Master File */ sc_format_path(""3F00"", &path); r = sc_select_file(p15card->card, &path, NULL); SC_TEST_RET(p15card->card->ctx, SC_LOG_DEBUG_NORMAL, r, ""Could not select master file again""); return r; } ",0 "u64 dma_get_required_mask(struct device *dev) { u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT); u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT)); u64 mask; if (!high_totalram) { /* convert to mask just covering totalram */ low_totalram = (1 << (fls(low_totalram) - 1)); low_totalram += low_totalram - 1; mask = low_totalram; } else { high_totalram = (1 << (fls(high_totalram) - 1)); high_totalram += high_totalram - 1; mask = (((u64)high_totalram) << 32) + 0xffffffff; } return mask; } ",0 "chrand_principal3_2_svc(chrand3_arg *arg, struct svc_req *rqstp) { static chrand_ret ret; krb5_keyblock *k; int nkeys; char *prime_arg, *funcname; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_chrand_ret, &ret); if ((ret.code = new_server_handle(arg->api_version, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; funcname = ""kadm5_randkey_principal""; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } if (krb5_unparse_name(handle->context, arg->princ, &prime_arg)) { ret.code = KADM5_BAD_PRINCIPAL; goto exit_func; } if (cmp_gss_krb5_name(handle, rqst2name(rqstp), arg->princ)) { ret.code = randkey_principal_wrapper_3((void *)handle, arg->princ, arg->keepold, arg->n_ks_tuple, arg->ks_tuple, &k, &nkeys); } else if (!(CHANGEPW_SERVICE(rqstp)) && kadm5int_acl_check(handle->context, rqst2name(rqstp), ACL_CHANGEPW, arg->princ, NULL)) { ret.code = kadm5_randkey_principal_3((void *)handle, arg->princ, arg->keepold, arg->n_ks_tuple, arg->ks_tuple, &k, &nkeys); } else { log_unauth(funcname, prime_arg, &client_name, &service_name, rqstp); ret.code = KADM5_AUTH_CHANGEPW; } if(ret.code == KADM5_OK) { ret.keys = k; ret.n_keys = nkeys; } if(ret.code != KADM5_AUTH_CHANGEPW) { if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done(funcname, prime_arg, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); } free(prime_arg); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; } ",1 "static void DoubleOrNullStringAttributeAttributeGetter(const v8::FunctionCallbackInfo& info) { v8::Local holder = info.Holder(); TestObject* impl = V8TestObject::ToImpl(holder); DoubleOrString result; impl->doubleOrNullStringAttribute(result); V8SetReturnValue(info, result); } ",0 "void FeatureInfo::InitializeFloatAndHalfFloatFeatures( const gfx::ExtensionSet& extensions) { bool enable_texture_float = false; bool enable_texture_float_linear = false; bool enable_texture_half_float = false; bool enable_texture_half_float_linear = false; bool enable_ext_color_buffer_float = false; bool enable_ext_color_buffer_half_float = false; bool may_enable_chromium_color_buffer_float = false; bool enable_es3 = IsWebGL2OrES3OrHigherContext(); if (gfx::HasExtension(extensions, ""GL_EXT_color_buffer_float"")) enable_ext_color_buffer_float = true; if (gfx::HasExtension(extensions, ""GL_EXT_color_buffer_half_float"")) { enable_ext_color_buffer_half_float = true; } if (gfx::HasExtension(extensions, ""GL_ARB_texture_float"") || gl_version_info_->is_desktop_core_profile) { enable_texture_float = true; enable_texture_float_linear = true; enable_texture_half_float = true; enable_texture_half_float_linear = true; may_enable_chromium_color_buffer_float = true; } else { if (gfx::HasExtension(extensions, ""GL_OES_texture_float"")) { enable_texture_float = true; if (enable_ext_color_buffer_float) { may_enable_chromium_color_buffer_float = true; } } if (gfx::HasExtension(extensions, ""GL_OES_texture_float_linear"")) { enable_texture_float_linear = true; } if (gfx::HasExtension(extensions, ""GL_OES_texture_half_float"")) { enable_texture_half_float = true; } if (gfx::HasExtension(extensions, ""GL_OES_texture_half_float_linear"")) { enable_texture_half_float_linear = true; } } if (enable_texture_float) { validators_.pixel_type.AddValue(GL_FLOAT); validators_.read_pixel_type.AddValue(GL_FLOAT); AddExtensionString(""GL_OES_texture_float""); } if (enable_texture_float_linear) { oes_texture_float_linear_available_ = true; if (!disallowed_features_.oes_texture_float_linear) EnableOESTextureFloatLinear(); } if (enable_texture_half_float) { validators_.pixel_type.AddValue(GL_HALF_FLOAT_OES); validators_.read_pixel_type.AddValue(GL_HALF_FLOAT_OES); AddExtensionString(""GL_OES_texture_half_float""); } if (enable_texture_half_float_linear) { oes_texture_half_float_linear_available_ = true; if (!disallowed_features_.oes_texture_half_float_linear) EnableOESTextureHalfFloatLinear(); } bool had_native_chromium_color_buffer_float_ext = false; if (gfx::HasExtension(extensions, ""GL_CHROMIUM_color_buffer_float_rgb"")) { had_native_chromium_color_buffer_float_ext = true; feature_flags_.chromium_color_buffer_float_rgb = true; if (!disallowed_features_.chromium_color_buffer_float_rgb) { EnableCHROMIUMColorBufferFloatRGB(); } } if (gfx::HasExtension(extensions, ""GL_CHROMIUM_color_buffer_float_rgba"")) { had_native_chromium_color_buffer_float_ext = true; feature_flags_.chromium_color_buffer_float_rgba = true; if (!disallowed_features_.chromium_color_buffer_float_rgba) { EnableCHROMIUMColorBufferFloatRGBA(); } } if (!gl_version_info_->is_es || gfx::HasExtension(extensions, ""GL_EXT_float_blend"")) { if (!disallowed_features_.ext_float_blend) { EnableEXTFloatBlend(); } } if (may_enable_chromium_color_buffer_float && !had_native_chromium_color_buffer_float_ext) { static_assert(GL_RGBA32F_ARB == GL_RGBA32F && GL_RGBA32F_EXT == GL_RGBA32F && GL_RGB32F_ARB == GL_RGB32F && GL_RGB32F_EXT == GL_RGB32F, ""sized float internal format variations must match""); GLint fb_binding = 0; GLint tex_binding = 0; glGetIntegerv(GL_FRAMEBUFFER_BINDING, &fb_binding); glGetIntegerv(GL_TEXTURE_BINDING_2D, &tex_binding); GLuint tex_id = 0; GLuint fb_id = 0; GLsizei width = 16; glGenTextures(1, &tex_id); glGenFramebuffersEXT(1, &fb_id); glBindTexture(GL_TEXTURE_2D, tex_id); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, width, width, 0, GL_RGBA, GL_FLOAT, nullptr); glBindFramebufferEXT(GL_FRAMEBUFFER, fb_id); glFramebufferTexture2DEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tex_id, 0); GLenum status_rgba = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB32F, width, width, 0, GL_RGB, GL_FLOAT, nullptr); GLenum status_rgb = glCheckFramebufferStatusEXT(GL_FRAMEBUFFER); if (status_rgba == GL_FRAMEBUFFER_COMPLETE && enable_es3) { bool full_float_support = true; GLenum internal_formats[] = { GL_R16F, GL_RG16F, GL_RGBA16F, GL_R32F, GL_RG32F, GL_R11F_G11F_B10F, }; GLenum formats[] = { GL_RED, GL_RG, GL_RGBA, GL_RED, GL_RG, GL_RGB, }; DCHECK_EQ(base::size(internal_formats), base::size(formats)); for (size_t i = 0; i < base::size(formats); ++i) { glTexImage2D(GL_TEXTURE_2D, 0, internal_formats[i], width, width, 0, formats[i], GL_FLOAT, nullptr); full_float_support &= glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE; } enable_ext_color_buffer_float = full_float_support; } if (IsWebGL1OrES2Context() && !enable_ext_color_buffer_half_float && (gl_version_info_->IsAtLeastGLES(3, 0) || gl_version_info_->IsAtLeastGL(3, 0))) { GLenum internal_format = GL_RGBA16F; GLenum format = GL_RGBA; GLenum data_type = GL_HALF_FLOAT; glTexImage2D(GL_TEXTURE_2D, 0, internal_format, width, width, 0, format, data_type, nullptr); enable_ext_color_buffer_half_float = (glCheckFramebufferStatusEXT(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE); } glDeleteFramebuffersEXT(1, &fb_id); glDeleteTextures(1, &tex_id); glBindFramebufferEXT(GL_FRAMEBUFFER, static_cast(fb_binding)); glBindTexture(GL_TEXTURE_2D, static_cast(tex_binding)); DCHECK_EQ(glGetError(), static_cast(GL_NO_ERROR)); if (status_rgba == GL_FRAMEBUFFER_COMPLETE) { feature_flags_.chromium_color_buffer_float_rgba = true; if (!disallowed_features_.chromium_color_buffer_float_rgba) EnableCHROMIUMColorBufferFloatRGBA(); } if (status_rgb == GL_FRAMEBUFFER_COMPLETE) { feature_flags_.chromium_color_buffer_float_rgb = true; if (!disallowed_features_.chromium_color_buffer_float_rgb) EnableCHROMIUMColorBufferFloatRGB(); } } if (enable_ext_color_buffer_float && enable_es3) { ext_color_buffer_float_available_ = true; if (!disallowed_features_.ext_color_buffer_float) EnableEXTColorBufferFloat(); } if (enable_ext_color_buffer_half_float) { ext_color_buffer_half_float_available_ = true; if (!disallowed_features_.ext_color_buffer_half_float) EnableEXTColorBufferHalfFloat(); } if (enable_texture_float) { validators_.texture_internal_format_storage.AddValue(GL_RGBA32F_EXT); validators_.texture_internal_format_storage.AddValue(GL_RGB32F_EXT); validators_.texture_internal_format_storage.AddValue(GL_ALPHA32F_EXT); validators_.texture_internal_format_storage.AddValue(GL_LUMINANCE32F_EXT); validators_.texture_internal_format_storage.AddValue( GL_LUMINANCE_ALPHA32F_EXT); } if (enable_texture_half_float) { validators_.texture_internal_format_storage.AddValue(GL_RGBA16F_EXT); validators_.texture_internal_format_storage.AddValue(GL_RGB16F_EXT); validators_.texture_internal_format_storage.AddValue(GL_ALPHA16F_EXT); validators_.texture_internal_format_storage.AddValue(GL_LUMINANCE16F_EXT); validators_.texture_internal_format_storage.AddValue( GL_LUMINANCE_ALPHA16F_EXT); } g_l16_is_present = enable_texture_half_float && feature_flags_.ext_texture_storage; } ",0 "static void *__videobuf_alloc(size_t size) { struct videbuf_vmalloc_memory *mem; struct videobuf_buffer *vb; vb = kzalloc(size+sizeof(*mem),GFP_KERNEL); mem = vb->priv = ((char *)vb)+size; mem->magic=MAGIC_VMAL_MEM; dprintk(1,""%s: allocated at %p(%ld+%ld) & %p(%ld)\n"", __FUNCTION__,vb,(long)sizeof(*vb),(long)size-sizeof(*vb), mem,(long)sizeof(*mem)); return vb; } ",0 "smb2_readv_callback(struct mid_q_entry *mid) { struct cifs_readdata *rdata = mid->callback_data; struct cifs_tcon *tcon = tlink_tcon(rdata->cfile->tlink); struct TCP_Server_Info *server = tcon->ses->server; struct smb2_sync_hdr *shdr = (struct smb2_sync_hdr *)rdata->iov[0].iov_base; struct cifs_credits credits = { .value = 0, .instance = 0 }; struct smb_rqst rqst = { .rq_iov = rdata->iov, .rq_nvec = 2, .rq_pages = rdata->pages, .rq_offset = rdata->page_offset, .rq_npages = rdata->nr_pages, .rq_pagesz = rdata->pagesz, .rq_tailsz = rdata->tailsz }; cifs_dbg(FYI, ""%s: mid=%llu state=%d result=%d bytes=%u\n"", __func__, mid->mid, mid->mid_state, rdata->result, rdata->bytes); switch (mid->mid_state) { case MID_RESPONSE_RECEIVED: credits.value = le16_to_cpu(shdr->CreditRequest); credits.instance = server->reconnect_instance; /* result already set, check signature */ if (server->sign && !mid->decrypted) { int rc; rc = smb2_verify_signature(&rqst, server); if (rc) cifs_dbg(VFS, ""SMB signature verification returned error = %d\n"", rc); } /* FIXME: should this be counted toward the initiating task? */ task_io_account_read(rdata->got_bytes); cifs_stats_bytes_read(tcon, rdata->got_bytes); break; case MID_REQUEST_SUBMITTED: case MID_RETRY_NEEDED: rdata->result = -EAGAIN; if (server->sign && rdata->got_bytes) /* reset bytes number since we can not check a sign */ rdata->got_bytes = 0; /* FIXME: should this be counted toward the initiating task? */ task_io_account_read(rdata->got_bytes); cifs_stats_bytes_read(tcon, rdata->got_bytes); break; case MID_RESPONSE_MALFORMED: credits.value = le16_to_cpu(shdr->CreditRequest); credits.instance = server->reconnect_instance; /* fall through */ default: rdata->result = -EIO; } #ifdef CONFIG_CIFS_SMB_DIRECT /* * If this rdata has a memmory registered, the MR can be freed * MR needs to be freed as soon as I/O finishes to prevent deadlock * because they have limited number and are used for future I/Os */ if (rdata->mr) { smbd_deregister_mr(rdata->mr); rdata->mr = NULL; } #endif if (rdata->result && rdata->result != -ENODATA) { cifs_stats_fail_inc(tcon, SMB2_READ_HE); trace_smb3_read_err(0 /* xid */, rdata->cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, rdata->offset, rdata->bytes, rdata->result); } else trace_smb3_read_done(0 /* xid */, rdata->cfile->fid.persistent_fid, tcon->tid, tcon->ses->Suid, rdata->offset, rdata->got_bytes); queue_work(cifsiod_wq, &rdata->work); DeleteMidQEntry(mid); add_credits(server, &credits, 0); } ",0 "bool WebPluginDelegatePepper::SetCursor(NPCursorType type) { cursor_.reset(new WebCursorInfo(static_cast(type))); return true; } ",0 "static void promiseAttributeAttributeGetterCallback(v8::Local, const v8::PropertyCallbackInfo& info) { TRACE_EVENT_SET_SAMPLING_STATE(""Blink"", ""DOMGetter""); TestObjectPythonV8Internal::promiseAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE(""V8"", ""V8Execution""); } ",0 "int kvm_arch_vcpu_ioctl_set_guest_debug(struct kvm_vcpu *vcpu, struct kvm_guest_debug *dbg) { unsigned long rflags; int i, r; if (dbg->control & (KVM_GUESTDBG_INJECT_DB | KVM_GUESTDBG_INJECT_BP)) { r = -EBUSY; if (vcpu->arch.exception.pending) goto out; if (dbg->control & KVM_GUESTDBG_INJECT_DB) kvm_queue_exception(vcpu, DB_VECTOR); else kvm_queue_exception(vcpu, BP_VECTOR); } /* * Read rflags as long as potentially injected trace flags are still * filtered out. */ rflags = kvm_get_rflags(vcpu); vcpu->guest_debug = dbg->control; if (!(vcpu->guest_debug & KVM_GUESTDBG_ENABLE)) vcpu->guest_debug = 0; if (vcpu->guest_debug & KVM_GUESTDBG_USE_HW_BP) { for (i = 0; i < KVM_NR_DB_REGS; ++i) vcpu->arch.eff_db[i] = dbg->arch.debugreg[i]; vcpu->arch.guest_debug_dr7 = dbg->arch.debugreg[7]; } else { for (i = 0; i < KVM_NR_DB_REGS; i++) vcpu->arch.eff_db[i] = vcpu->arch.db[i]; } kvm_update_dr7(vcpu); if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) vcpu->arch.singlestep_rip = kvm_rip_read(vcpu) + get_segment_base(vcpu, VCPU_SREG_CS); /* * Trigger an rflags update that will inject or remove the trace * flags. */ kvm_set_rflags(vcpu, rflags); kvm_x86_ops->update_db_bp_intercept(vcpu); r = 0; out: return r; } ",0 "static int lua_type_checker_harness(request_rec *r) { return lua_request_rec_hook_harness(r, ""type_checker"", APR_HOOK_MIDDLE); } ",0 "void Document::setLinkColor(const AtomicString& value) { SetBodyAttribute(linkAttr, value); } ",0 "static int svm_set_msr(struct kvm_vcpu *vcpu, struct msr_data *msr) { struct vcpu_svm *svm = to_svm(vcpu); u32 ecx = msr->index; u64 data = msr->data; switch (ecx) { case MSR_IA32_TSC: kvm_write_tsc(vcpu, msr); break; case MSR_STAR: svm->vmcb->save.star = data; break; #ifdef CONFIG_X86_64 case MSR_LSTAR: svm->vmcb->save.lstar = data; break; case MSR_CSTAR: svm->vmcb->save.cstar = data; break; case MSR_KERNEL_GS_BASE: svm->vmcb->save.kernel_gs_base = data; break; case MSR_SYSCALL_MASK: svm->vmcb->save.sfmask = data; break; #endif case MSR_IA32_SYSENTER_CS: svm->vmcb->save.sysenter_cs = data; break; case MSR_IA32_SYSENTER_EIP: svm->sysenter_eip = data; svm->vmcb->save.sysenter_eip = data; break; case MSR_IA32_SYSENTER_ESP: svm->sysenter_esp = data; svm->vmcb->save.sysenter_esp = data; break; case MSR_IA32_DEBUGCTLMSR: if (!boot_cpu_has(X86_FEATURE_LBRV)) { vcpu_unimpl(vcpu, ""%s: MSR_IA32_DEBUGCTL 0x%llx, nop\n"", __func__, data); break; } if (data & DEBUGCTL_RESERVED_BITS) return 1; svm->vmcb->save.dbgctl = data; mark_dirty(svm->vmcb, VMCB_LBR); if (data & (1ULL<<0)) svm_enable_lbrv(svm); else svm_disable_lbrv(svm); break; case MSR_VM_HSAVE_PA: svm->nested.hsave_msr = data; break; case MSR_VM_CR: return svm_set_vm_cr(vcpu, data); case MSR_VM_IGNNE: vcpu_unimpl(vcpu, ""unimplemented wrmsr: 0x%x data 0x%llx\n"", ecx, data); break; default: return kvm_set_msr_common(vcpu, msr); } return 0; } ",0 "void WebContentsImpl::WasOccluded() { if (!IsBeingCaptured()) { for (RenderWidgetHostView* view : GetRenderWidgetHostViewsInTree()) view->WasOccluded(); } SetVisibility(Visibility::OCCLUDED); } ",0 "void JSTestEventTarget::finishCreation(JSGlobalData& globalData) { Base::finishCreation(globalData); ASSERT(inherits(&s_info)); } ",0 "bool ShouldQuicMigrateSessionsEarlyV2( const VariationParameters& quic_trial_params) { return base::LowerCaseEqualsASCII( GetVariationParam(quic_trial_params, ""migrate_sessions_early_v2""), ""true""); } ",0 " void setEmpty(bool empty, RenderBlock* block = 0, LineWidth* lineWidth = 0) { if (m_isEmpty == empty) return; m_isEmpty = empty; if (!empty && block && floatPaginationStrut()) { block->setLogicalHeight(block->logicalHeight() + floatPaginationStrut()); setFloatPaginationStrut(0); lineWidth->updateAvailableWidth(); } } ",0 "bool kvm_rdpmc(struct kvm_vcpu *vcpu) { u32 ecx = kvm_register_read(vcpu, VCPU_REGS_RCX); u64 data; int err; err = kvm_pmu_read_pmc(vcpu, ecx, &data); if (err) return err; kvm_register_write(vcpu, VCPU_REGS_RAX, (u32)data); kvm_register_write(vcpu, VCPU_REGS_RDX, data >> 32); return err; } ",0 "static int shmem_removexattr(struct dentry *dentry, const char *name) { struct shmem_inode_info *info = SHMEM_I(dentry->d_inode); int err; /* * If this is a request for a synthetic attribute in the system.* * namespace use the generic infrastructure to resolve a handler * for it via sb->s_xattr. */ if (!strncmp(name, XATTR_SYSTEM_PREFIX, XATTR_SYSTEM_PREFIX_LEN)) return generic_removexattr(dentry, name); err = shmem_xattr_validate(name); if (err) return err; return simple_xattr_remove(&info->xattrs, name); } ",0 "void GetIntersection (uint64 start1, uint32 length1, uint64 start2, uint64 end2, uint64 *intersectStart, uint32 *intersectLength) { uint64 end1 = start1 + length1 - 1; uint64 intersectEnd = (end1 <= end2) ? end1 : end2; *intersectStart = (start1 >= start2) ? start1 : start2; *intersectLength = (uint32) ((*intersectStart > intersectEnd) ? 0 : intersectEnd + 1 - *intersectStart); if (*intersectLength == 0) *intersectStart = start1; } ",0 "void ChromePasswordManagerClient::HideManualFallbackForSaving() { if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL())) return; #if !defined(OS_ANDROID) PasswordsClientUIDelegate* manage_passwords_ui_controller = PasswordsClientUIDelegateFromWebContents(web_contents()); if (manage_passwords_ui_controller) manage_passwords_ui_controller->OnHideManualFallbackForSaving(); #endif // !defined(OS_ANDROID) } ",0 "void FileSystemOperationRunner::DidGetMetadata( const OperationID id, GetMetadataCallback callback, base::File::Error rv, const base::File::Info& file_info) { if (is_beginning_operation_) { finished_operations_.insert(id); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::BindOnce(&FileSystemOperationRunner::DidGetMetadata, weak_ptr_, id, std::move(callback), rv, file_info)); return; } std::move(callback).Run(rv, file_info); FinishOperation(id); } ",0 "static int compat_do_replace(struct net *net, void __user *user, unsigned int len) { int ret; struct compat_arpt_replace tmp; struct xt_table_info *newinfo; void *loc_cpu_entry; struct arpt_entry *iter; if (copy_from_user(&tmp, user, sizeof(tmp)) != 0) return -EFAULT; /* overflow check */ if (tmp.size >= INT_MAX / num_possible_cpus()) return -ENOMEM; if (tmp.num_counters >= INT_MAX / sizeof(struct xt_counters)) return -ENOMEM; if (tmp.num_counters == 0) return -EINVAL; tmp.name[sizeof(tmp.name)-1] = 0; newinfo = xt_alloc_table_info(tmp.size); if (!newinfo) return -ENOMEM; loc_cpu_entry = newinfo->entries; if (copy_from_user(loc_cpu_entry, user + sizeof(tmp), tmp.size) != 0) { ret = -EFAULT; goto free_newinfo; } ret = translate_compat_table(tmp.name, tmp.valid_hooks, &newinfo, &loc_cpu_entry, tmp.size, tmp.num_entries, tmp.hook_entry, tmp.underflow); if (ret != 0) goto free_newinfo; duprintf(""compat_do_replace: Translated table\n""); ret = __do_replace(net, tmp.name, tmp.valid_hooks, newinfo, tmp.num_counters, compat_ptr(tmp.counters)); if (ret) goto free_newinfo_untrans; return 0; free_newinfo_untrans: xt_entry_foreach(iter, loc_cpu_entry, newinfo->size) cleanup_entry(iter); free_newinfo: xt_free_table_info(newinfo); return ret; } ",0 "static void flush_end_io(struct request *flush_rq, int error) { struct request_queue *q = flush_rq->q; struct list_head *running; bool queued = false; struct request *rq, *n; unsigned long flags = 0; struct blk_flush_queue *fq = blk_get_flush_queue(q, flush_rq->mq_ctx); if (q->mq_ops) { spin_lock_irqsave(&fq->mq_flush_lock, flags); flush_rq->tag = -1; } running = &fq->flush_queue[fq->flush_running_idx]; BUG_ON(fq->flush_pending_idx == fq->flush_running_idx); /* account completion of the flush request */ fq->flush_running_idx ^= 1; if (!q->mq_ops) elv_completed_request(q, flush_rq); /* and push the waiting requests to the next stage */ list_for_each_entry_safe(rq, n, running, flush.list) { unsigned int seq = blk_flush_cur_seq(rq); BUG_ON(seq != REQ_FSEQ_PREFLUSH && seq != REQ_FSEQ_POSTFLUSH); queued |= blk_flush_complete_seq(rq, fq, seq, error); } /* * Kick the queue to avoid stall for two cases: * 1. Moving a request silently to empty queue_head may stall the * queue. * 2. When flush request is running in non-queueable queue, the * queue is hold. Restart the queue after flush request is finished * to avoid stall. * This function is called from request completion path and calling * directly into request_fn may confuse the driver. Always use * kblockd. */ if (queued || fq->flush_queue_delayed) { WARN_ON(q->mq_ops); blk_run_queue_async(q); } fq->flush_queue_delayed = 0; if (q->mq_ops) spin_unlock_irqrestore(&fq->mq_flush_lock, flags); } ",1 "GF_Box *srpp_New() { ISOM_DECL_BOX_ALLOC(GF_SRTPProcessBox, GF_ISOM_BOX_TYPE_SRPP); return (GF_Box *)tmp; } ",0 "InputEventAckState InputMsgWatcher::WaitForAck() { DCHECK_CURRENTLY_ON(BrowserThread::UI); base::RunLoop run_loop; base::AutoReset reset_quit(&quit_, run_loop.QuitClosure()); run_loop.Run(); return ack_result_; } ",0 "reportComment(XML_Parser parser, const ENCODING *enc, const char *start, const char *end) { XML_Char *data; if (!parser->m_commentHandler) { if (parser->m_defaultHandler) reportDefault(parser, enc, start, end); return 1; } data = poolStoreString(&parser->m_tempPool, enc, start + enc->minBytesPerChar * 4, end - enc->minBytesPerChar * 3); if (!data) return 0; normalizeLines(data); parser->m_commentHandler(parser->m_handlerArg, data); poolClear(&parser->m_tempPool); return 1; } ",0 "bool ImageDataNaClBackend::IsMapped() const { return map_count_ > 0; } ",0 "void AutofillPopupBaseView::SetSelection(const gfx::Point& point) { if (delegate_) delegate_->SetSelectionAtPoint(point); } ",0 "NavigationControllerImpl::NavigationControllerImpl( NavigationControllerDelegate* delegate, BrowserContext* browser_context) : browser_context_(browser_context), pending_entry_(nullptr), failed_pending_entry_id_(0), last_committed_entry_index_(-1), pending_entry_index_(-1), transient_entry_index_(-1), delegate_(delegate), ssl_manager_(this), needs_reload_(false), is_initial_navigation_(true), in_navigate_to_pending_entry_(false), pending_reload_(ReloadType::NONE), get_timestamp_callback_(base::Bind(&base::Time::Now)), screenshot_manager_(new NavigationEntryScreenshotManager(this)), last_committed_reload_type_(ReloadType::NONE) { DCHECK(browser_context_); } ",0 "getParameterEntityDebug(void *ctx ATTRIBUTE_UNUSED, const xmlChar *name) { callbacks++; if (quiet) return(NULL); fprintf(SAXdebug, ""SAX.getParameterEntity(%s)\n"", name); return(NULL); } ",0 "unassociate_proxies (gpointer key, gpointer val, gpointer user_data) { DBusGProxyList *list; const char *name; GSList *tmp; DBusGProxyUnassociateData *data; list = val; data = user_data; name = data->name; for (tmp = list->proxies; tmp; tmp = tmp->next) { DBusGProxy *proxy = DBUS_G_PROXY (tmp->data); DBusGProxyPrivate *priv = DBUS_G_PROXY_GET_PRIVATE(proxy); DBusGProxyManager *manager; manager = priv->manager; if (priv->name != NULL && !strcmp (priv->name, name)) { if (!priv->for_owner) { /* If a service appeared and then vanished very quickly, * it's conceivable we have an inflight request for * GetNameOwner here. Cancel it. * https://bugs.freedesktop.org/show_bug.cgi?id=18573 */ if (priv->name_call) dbus_g_proxy_cancel_call (manager->bus_proxy, priv->name_call); priv->name_call = NULL; priv->associated = FALSE; manager->unassociated_proxies = g_slist_prepend (manager->unassociated_proxies, proxy); } else { data->destroyed = g_slist_prepend (data->destroyed, proxy); /* make contents of list into weak pointers in case the objects * unref each other when disposing */ g_object_add_weak_pointer (G_OBJECT (proxy), &(data->destroyed->data)); } } } } ",0 "static void sd_free_ctl_entry(struct ctl_table **tablep) { struct ctl_table *entry; /* * In the intermediate directories, both the child directory and * procname are dynamically allocated and could fail but the mode * will always be set. In the lowest directory the names are * static strings and all have proc handlers. */ for (entry = *tablep; entry->mode; entry++) { if (entry->child) sd_free_ctl_entry(&entry->child); if (entry->proc_handler == NULL) kfree(entry->procname); } kfree(*tablep); *tablep = NULL; } ",0 "static void d_walk(struct dentry *parent, void *data, enum d_walk_ret (*enter)(void *, struct dentry *), void (*finish)(void *)) { struct dentry *this_parent; struct list_head *next; unsigned seq = 0; enum d_walk_ret ret; bool retry = true; again: read_seqbegin_or_lock(&rename_lock, &seq); this_parent = parent; spin_lock(&this_parent->d_lock); ret = enter(data, this_parent); switch (ret) { case D_WALK_CONTINUE: break; case D_WALK_QUIT: case D_WALK_SKIP: goto out_unlock; case D_WALK_NORETRY: retry = false; break; } repeat: next = this_parent->d_subdirs.next; resume: while (next != &this_parent->d_subdirs) { struct list_head *tmp = next; struct dentry *dentry = list_entry(tmp, struct dentry, d_child); next = tmp->next; spin_lock_nested(&dentry->d_lock, DENTRY_D_LOCK_NESTED); ret = enter(data, dentry); switch (ret) { case D_WALK_CONTINUE: break; case D_WALK_QUIT: spin_unlock(&dentry->d_lock); goto out_unlock; case D_WALK_NORETRY: retry = false; break; case D_WALK_SKIP: spin_unlock(&dentry->d_lock); continue; } if (!list_empty(&dentry->d_subdirs)) { spin_unlock(&this_parent->d_lock); spin_release(&dentry->d_lock.dep_map, 1, _RET_IP_); this_parent = dentry; spin_acquire(&this_parent->d_lock.dep_map, 0, 1, _RET_IP_); goto repeat; } spin_unlock(&dentry->d_lock); } /* * All done at this level ... ascend and resume the search. */ rcu_read_lock(); ascend: if (this_parent != parent) { struct dentry *child = this_parent; this_parent = child->d_parent; spin_unlock(&child->d_lock); spin_lock(&this_parent->d_lock); /* might go back up the wrong parent if we have had a rename. */ if (need_seqretry(&rename_lock, seq)) goto rename_retry; /* go into the first sibling still alive */ do { next = child->d_child.next; if (next == &this_parent->d_subdirs) goto ascend; child = list_entry(next, struct dentry, d_child); } while (unlikely(child->d_flags & DCACHE_DENTRY_KILLED)); rcu_read_unlock(); goto resume; } if (need_seqretry(&rename_lock, seq)) goto rename_retry; rcu_read_unlock(); if (finish) finish(data); out_unlock: spin_unlock(&this_parent->d_lock); done_seqretry(&rename_lock, seq); return; rename_retry: spin_unlock(&this_parent->d_lock); rcu_read_unlock(); BUG_ON(seq & 1); if (!retry) return; seq = 1; goto again; } ",0 "static unsigned int task_scan_max(struct task_struct *p) { unsigned long smin = task_scan_min(p); unsigned long smax; /* Watch for min being lower than max due to floor calculations */ smax = sysctl_numa_balancing_scan_period_max / task_nr_scan_windows(p); /* Scale the maximum scan period with the amount of shared memory. */ if (p->numa_group) { struct numa_group *ng = p->numa_group; unsigned long shared = group_faults_shared(ng); unsigned long private = group_faults_priv(ng); unsigned long period = smax; period *= atomic_read(&ng->refcount); period *= shared + 1; period /= private + shared + 1; smax = max(smax, period); } return max(smin, smax); } ",0 "static int rsa_cms_verify(CMS_SignerInfo *si) { int nid, nid2; X509_ALGOR *alg; EVP_PKEY_CTX *pkctx = CMS_SignerInfo_get0_pkey_ctx(si); CMS_SignerInfo_get0_algs(si, NULL, NULL, NULL, &alg); nid = OBJ_obj2nid(alg->algorithm); if (nid == NID_rsaEncryption) return 1; if (nid == NID_rsassaPss) return rsa_pss_to_ctx(NULL, pkctx, alg, NULL); /* Workaround for some implementation that use a signature OID */ if (OBJ_find_sigid_algs(nid, NULL, &nid2)) { if (nid2 == NID_rsaEncryption) return 1; } return 0; } ",0 "static void apic_sync_pv_eoi_to_guest(struct kvm_vcpu *vcpu, struct kvm_lapic *apic) { if (!pv_eoi_enabled(vcpu) || /* IRR set or many bits in ISR: could be nested. */ apic->irr_pending || /* Cache not set: could be safe but we don't bother. */ apic->highest_isr_cache == -1 || /* Need EOI to update ioapic. */ kvm_ioapic_handles_vector(vcpu->kvm, apic->highest_isr_cache)) { /* * PV EOI was disabled by apic_sync_pv_eoi_from_guest * so we need not do anything here. */ return; } pv_eoi_set_pending(apic->vcpu); } ",0 "static struct sock *tcp_v6_syn_recv_sock(const struct sock *sk, struct sk_buff *skb, struct request_sock *req, struct dst_entry *dst, struct request_sock *req_unhash, bool *own_req) { struct inet_request_sock *ireq; struct ipv6_pinfo *newnp; const struct ipv6_pinfo *np = inet6_sk(sk); struct ipv6_txoptions *opt; struct tcp6_sock *newtcp6sk; struct inet_sock *newinet; struct tcp_sock *newtp; struct sock *newsk; #ifdef CONFIG_TCP_MD5SIG struct tcp_md5sig_key *key; #endif struct flowi6 fl6; if (skb->protocol == htons(ETH_P_IP)) { /* * v6 mapped */ newsk = tcp_v4_syn_recv_sock(sk, skb, req, dst, req_unhash, own_req); if (!newsk) return NULL; newtcp6sk = (struct tcp6_sock *)newsk; inet_sk(newsk)->pinet6 = &newtcp6sk->inet6; newinet = inet_sk(newsk); newnp = inet6_sk(newsk); newtp = tcp_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); newnp->saddr = newsk->sk_v6_rcv_saddr; inet_csk(newsk)->icsk_af_ops = &ipv6_mapped; newsk->sk_backlog_rcv = tcp_v4_do_rcv; #ifdef CONFIG_TCP_MD5SIG newtp->af_specific = &tcp_sock_ipv6_mapped_specific; #endif newnp->ipv6_ac_list = NULL; newnp->ipv6_fl_list = NULL; newnp->pktoptions = NULL; newnp->opt = NULL; newnp->mcast_oif = tcp_v6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; newnp->rcv_flowinfo = ip6_flowinfo(ipv6_hdr(skb)); if (np->repflow) newnp->flow_label = ip6_flowlabel(ipv6_hdr(skb)); /* * No need to charge this sock to the relevant IPv6 refcnt debug socks count * here, tcp_create_openreq_child now does this for us, see the comment in * that function for the gory details. -acme */ /* It is tricky place. Until this moment IPv4 tcp worked with IPv6 icsk.icsk_af_ops. Sync it now. */ tcp_sync_mss(newsk, inet_csk(newsk)->icsk_pmtu_cookie); return newsk; } ireq = inet_rsk(req); if (sk_acceptq_is_full(sk)) goto out_overflow; if (!dst) { dst = inet6_csk_route_req(sk, &fl6, req, IPPROTO_TCP); if (!dst) goto out; } newsk = tcp_create_openreq_child(sk, req, skb); if (!newsk) goto out_nonewsk; /* * No need to charge this sock to the relevant IPv6 refcnt debug socks * count here, tcp_create_openreq_child now does this for us, see the * comment in that function for the gory details. -acme */ newsk->sk_gso_type = SKB_GSO_TCPV6; ip6_dst_store(newsk, dst, NULL, NULL); inet6_sk_rx_dst_set(newsk, skb); newtcp6sk = (struct tcp6_sock *)newsk; inet_sk(newsk)->pinet6 = &newtcp6sk->inet6; newtp = tcp_sk(newsk); newinet = inet_sk(newsk); newnp = inet6_sk(newsk); memcpy(newnp, np, sizeof(struct ipv6_pinfo)); newsk->sk_v6_daddr = ireq->ir_v6_rmt_addr; newnp->saddr = ireq->ir_v6_loc_addr; newsk->sk_v6_rcv_saddr = ireq->ir_v6_loc_addr; newsk->sk_bound_dev_if = ireq->ir_iif; /* Now IPv6 options... First: no IPv4 options. */ newinet->inet_opt = NULL; newnp->ipv6_ac_list = NULL; newnp->ipv6_fl_list = NULL; /* Clone RX bits */ newnp->rxopt.all = np->rxopt.all; newnp->pktoptions = NULL; newnp->opt = NULL; newnp->mcast_oif = tcp_v6_iif(skb); newnp->mcast_hops = ipv6_hdr(skb)->hop_limit; newnp->rcv_flowinfo = ip6_flowinfo(ipv6_hdr(skb)); if (np->repflow) newnp->flow_label = ip6_flowlabel(ipv6_hdr(skb)); /* Clone native IPv6 options from listening socket (if any) Yes, keeping reference count would be much more clever, but we make one more one thing there: reattach optmem to newsk. */ opt = ireq->ipv6_opt; if (!opt) opt = rcu_dereference(np->opt); if (opt) { opt = ipv6_dup_options(newsk, opt); RCU_INIT_POINTER(newnp->opt, opt); } inet_csk(newsk)->icsk_ext_hdr_len = 0; if (opt) inet_csk(newsk)->icsk_ext_hdr_len = opt->opt_nflen + opt->opt_flen; tcp_ca_openreq_child(newsk, dst); tcp_sync_mss(newsk, dst_mtu(dst)); newtp->advmss = dst_metric_advmss(dst); if (tcp_sk(sk)->rx_opt.user_mss && tcp_sk(sk)->rx_opt.user_mss < newtp->advmss) newtp->advmss = tcp_sk(sk)->rx_opt.user_mss; tcp_initialize_rcv_mss(newsk); newinet->inet_daddr = newinet->inet_saddr = LOOPBACK4_IPV6; newinet->inet_rcv_saddr = LOOPBACK4_IPV6; #ifdef CONFIG_TCP_MD5SIG /* Copy over the MD5 key from the original socket */ key = tcp_v6_md5_do_lookup(sk, &newsk->sk_v6_daddr); if (key) { /* We're using one, so create a matching key * on the newsk structure. If we fail to get * memory, then we end up not copying the key * across. Shucks. */ tcp_md5_do_add(newsk, (union tcp_md5_addr *)&newsk->sk_v6_daddr, AF_INET6, key->key, key->keylen, sk_gfp_mask(sk, GFP_ATOMIC)); } #endif if (__inet_inherit_port(sk, newsk) < 0) { inet_csk_prepare_forced_close(newsk); tcp_done(newsk); goto out; } *own_req = inet_ehash_nolisten(newsk, req_to_sk(req_unhash)); if (*own_req) { tcp_move_syn(newtp, req); /* Clone pktoptions received with SYN, if we own the req */ if (ireq->pktopts) { newnp->pktoptions = skb_clone(ireq->pktopts, sk_gfp_mask(sk, GFP_ATOMIC)); consume_skb(ireq->pktopts); ireq->pktopts = NULL; if (newnp->pktoptions) skb_set_owner_r(newnp->pktoptions, newsk); } } return newsk; out_overflow: __NET_INC_STATS(sock_net(sk), LINUX_MIB_LISTENOVERFLOWS); out_nonewsk: dst_release(dst); out: tcp_listendrop(sk); return NULL; } ",0 "htmlParseErr(xmlParserCtxtPtr ctxt, xmlParserErrors error, const char *msg, const xmlChar *str1, const xmlChar *str2) { if ((ctxt != NULL) && (ctxt->disableSAX != 0) && (ctxt->instate == XML_PARSER_EOF)) return; if (ctxt != NULL) ctxt->errNo = error; __xmlRaiseError(NULL, NULL, NULL, ctxt, NULL, XML_FROM_HTML, error, XML_ERR_ERROR, NULL, 0, (const char *) str1, (const char *) str2, NULL, 0, 0, msg, str1, str2); if (ctxt != NULL) ctxt->wellFormed = 0; } ",0 "static int check_alu_op(struct bpf_verifier_env *env, struct bpf_insn *insn) { struct bpf_reg_state *regs = cur_regs(env); u8 opcode = BPF_OP(insn->code); int err; if (opcode == BPF_END || opcode == BPF_NEG) { if (opcode == BPF_NEG) { if (BPF_SRC(insn->code) != 0 || insn->src_reg != BPF_REG_0 || insn->off != 0 || insn->imm != 0) { verbose(env, ""BPF_NEG uses reserved fields\n""); return -EINVAL; } } else { if (insn->src_reg != BPF_REG_0 || insn->off != 0 || (insn->imm != 16 && insn->imm != 32 && insn->imm != 64) || BPF_CLASS(insn->code) == BPF_ALU64) { verbose(env, ""BPF_END uses reserved fields\n""); return -EINVAL; } } /* check src operand */ err = check_reg_arg(env, insn->dst_reg, SRC_OP); if (err) return err; if (is_pointer_value(env, insn->dst_reg)) { verbose(env, ""R%d pointer arithmetic prohibited\n"", insn->dst_reg); return -EACCES; } /* check dest operand */ err = check_reg_arg(env, insn->dst_reg, DST_OP); if (err) return err; } else if (opcode == BPF_MOV) { if (BPF_SRC(insn->code) == BPF_X) { if (insn->imm != 0 || insn->off != 0) { verbose(env, ""BPF_MOV uses reserved fields\n""); return -EINVAL; } /* check src operand */ err = check_reg_arg(env, insn->src_reg, SRC_OP); if (err) return err; } else { if (insn->src_reg != BPF_REG_0 || insn->off != 0) { verbose(env, ""BPF_MOV uses reserved fields\n""); return -EINVAL; } } /* check dest operand */ err = check_reg_arg(env, insn->dst_reg, DST_OP); if (err) return err; if (BPF_SRC(insn->code) == BPF_X) { if (BPF_CLASS(insn->code) == BPF_ALU64) { /* case: R1 = R2 * copy register state to dest reg */ regs[insn->dst_reg] = regs[insn->src_reg]; regs[insn->dst_reg].live |= REG_LIVE_WRITTEN; } else { /* R1 = (u32) R2 */ if (is_pointer_value(env, insn->src_reg)) { verbose(env, ""R%d partial copy of pointer\n"", insn->src_reg); return -EACCES; } mark_reg_unknown(env, regs, insn->dst_reg); /* high 32 bits are known zero. */ regs[insn->dst_reg].var_off = tnum_cast( regs[insn->dst_reg].var_off, 4); __update_reg_bounds(®s[insn->dst_reg]); } } else { /* case: R = imm * remember the value we stored into this reg */ regs[insn->dst_reg].type = SCALAR_VALUE; __mark_reg_known(regs + insn->dst_reg, insn->imm); } } else if (opcode > BPF_END) { verbose(env, ""invalid BPF_ALU opcode %x\n"", opcode); return -EINVAL; } else { /* all other ALU ops: and, sub, xor, add, ... */ if (BPF_SRC(insn->code) == BPF_X) { if (insn->imm != 0 || insn->off != 0) { verbose(env, ""BPF_ALU uses reserved fields\n""); return -EINVAL; } /* check src1 operand */ err = check_reg_arg(env, insn->src_reg, SRC_OP); if (err) return err; } else { if (insn->src_reg != BPF_REG_0 || insn->off != 0) { verbose(env, ""BPF_ALU uses reserved fields\n""); return -EINVAL; } } /* check src2 operand */ err = check_reg_arg(env, insn->dst_reg, SRC_OP); if (err) return err; if ((opcode == BPF_MOD || opcode == BPF_DIV) && BPF_SRC(insn->code) == BPF_K && insn->imm == 0) { verbose(env, ""div by zero\n""); return -EINVAL; } if ((opcode == BPF_LSH || opcode == BPF_RSH || opcode == BPF_ARSH) && BPF_SRC(insn->code) == BPF_K) { int size = BPF_CLASS(insn->code) == BPF_ALU64 ? 64 : 32; if (insn->imm < 0 || insn->imm >= size) { verbose(env, ""invalid shift %d\n"", insn->imm); return -EINVAL; } } /* check dest operand */ err = check_reg_arg(env, insn->dst_reg, DST_OP_NO_MARK); if (err) return err; return adjust_reg_min_max_vals(env, insn); } return 0; } ",1 "PHP_FUNCTION(parse_ini_string) { char *string = NULL, *str = NULL; int str_len = 0; zend_bool process_sections = 0; long scanner_mode = ZEND_INI_SCANNER_NORMAL; zend_ini_parser_cb_t ini_parser_cb; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s|bl"", &str, &str_len, &process_sections, &scanner_mode) == FAILURE) { RETURN_FALSE; } if (INT_MAX - str_len < ZEND_MMAP_AHEAD) { RETVAL_FALSE; } /* Set callback function */ if (process_sections) { BG(active_ini_file_section) = NULL; ini_parser_cb = (zend_ini_parser_cb_t) php_ini_parser_cb_with_sections; } else { ini_parser_cb = (zend_ini_parser_cb_t) php_simple_ini_parser_cb; } /* Setup string */ string = (char *) emalloc(str_len + ZEND_MMAP_AHEAD); memcpy(string, str, str_len); memset(string + str_len, 0, ZEND_MMAP_AHEAD); array_init(return_value); if (zend_parse_ini_string(string, 0, scanner_mode, ini_parser_cb, return_value TSRMLS_CC) == FAILURE) { zend_hash_destroy(Z_ARRVAL_P(return_value)); efree(Z_ARRVAL_P(return_value)); RETVAL_FALSE; } efree(string); } ",0 "sshkey_load_cert(const char *filename, struct sshkey **keyp) { struct sshkey *pub = NULL; char *file = NULL; int r = SSH_ERR_INTERNAL_ERROR; if (keyp != NULL) *keyp = NULL; if (asprintf(&file, ""%s-cert.pub"", filename) == -1) return SSH_ERR_ALLOC_FAIL; if ((pub = sshkey_new(KEY_UNSPEC)) == NULL) { goto out; } if ((r = sshkey_try_load_public(pub, file, NULL)) != 0) goto out; /* success */ if (keyp != NULL) { *keyp = pub; pub = NULL; } r = 0; out: free(file); sshkey_free(pub); return r; } ",0 "static int __nl80211_set_channel(struct cfg80211_registered_device *rdev, struct wireless_dev *wdev, struct genl_info *info) { enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; u32 freq; int result; if (!info->attrs[NL80211_ATTR_WIPHY_FREQ]) return -EINVAL; if (!nl80211_can_set_dev_channel(wdev)) return -EOPNOTSUPP; if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { channel_type = nla_get_u32(info->attrs[ NL80211_ATTR_WIPHY_CHANNEL_TYPE]); if (channel_type != NL80211_CHAN_NO_HT && channel_type != NL80211_CHAN_HT20 && channel_type != NL80211_CHAN_HT40PLUS && channel_type != NL80211_CHAN_HT40MINUS) return -EINVAL; } freq = nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]); mutex_lock(&rdev->devlist_mtx); if (wdev) { wdev_lock(wdev); result = cfg80211_set_freq(rdev, wdev, freq, channel_type); wdev_unlock(wdev); } else { result = cfg80211_set_freq(rdev, NULL, freq, channel_type); } mutex_unlock(&rdev->devlist_mtx); return result; } ",0 "int __khugepaged_enter(struct mm_struct *mm) { struct mm_slot *mm_slot; int wakeup; mm_slot = alloc_mm_slot(); if (!mm_slot) return -ENOMEM; /* __khugepaged_exit() must not run from under us */ VM_BUG_ON(khugepaged_test_exit(mm)); if (unlikely(test_and_set_bit(MMF_VM_HUGEPAGE, &mm->flags))) { free_mm_slot(mm_slot); return 0; } spin_lock(&khugepaged_mm_lock); insert_to_mm_slots_hash(mm, mm_slot); /* * Insert just behind the scanning cursor, to let the area settle * down a little. */ wakeup = list_empty(&khugepaged_scan.mm_head); list_add_tail(&mm_slot->mm_node, &khugepaged_scan.mm_head); spin_unlock(&khugepaged_mm_lock); atomic_inc(&mm->mm_count); if (wakeup) wake_up_interruptible(&khugepaged_wait); return 0; } ",0 "SYSCALL_DEFINE2(listen, int, fd, int, backlog) { return __sys_listen(fd, backlog); } ",0 "base::string16 AuthenticatorSelectAccountSheetModel::GetAcceptButtonLabel() const { return l10n_util::GetStringUTF16(IDS_WEBAUTHN_WELCOME_SCREEN_NEXT); } ",0 "base::string16 Textfield::GetSelectedText() const { return model_->GetSelectedText(); } ",0 "static void set_tx_flow_on(struct caifsock *cf_sk) { set_bit(TX_FLOW_ON_BIT, (void *) &cf_sk->flow_state); } ",0 "int generic_file_readonly_mmap(struct file * file, struct vm_area_struct * vma) { return -ENOSYS; } ",0 "static void JPEGSetImageQuality(struct jpeg_decompress_struct *jpeg_info, Image *image) { image->quality=UndefinedCompressionQuality; #if defined(D_PROGRESSIVE_SUPPORTED) if (image->compression == LosslessJPEGCompression) { image->quality=100; (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Quality: 100 (lossless)""); } else #endif { ssize_t j, qvalue, sum; register ssize_t i; /* Determine the JPEG compression quality from the quantization tables. */ sum=0; for (i=0; i < NUM_QUANT_TBLS; i++) { if (jpeg_info->quant_tbl_ptrs[i] != NULL) for (j=0; j < DCTSIZE2; j++) sum+=jpeg_info->quant_tbl_ptrs[i]->quantval[j]; } if ((jpeg_info->quant_tbl_ptrs[0] != NULL) && (jpeg_info->quant_tbl_ptrs[1] != NULL)) { ssize_t hash[101] = { 1020, 1015, 932, 848, 780, 735, 702, 679, 660, 645, 632, 623, 613, 607, 600, 594, 589, 585, 581, 571, 555, 542, 529, 514, 494, 474, 457, 439, 424, 410, 397, 386, 373, 364, 351, 341, 334, 324, 317, 309, 299, 294, 287, 279, 274, 267, 262, 257, 251, 247, 243, 237, 232, 227, 222, 217, 213, 207, 202, 198, 192, 188, 183, 177, 173, 168, 163, 157, 153, 148, 143, 139, 132, 128, 125, 119, 115, 108, 104, 99, 94, 90, 84, 79, 74, 70, 64, 59, 55, 49, 45, 40, 34, 30, 25, 20, 15, 11, 6, 4, 0 }, sums[101] = { 32640, 32635, 32266, 31495, 30665, 29804, 29146, 28599, 28104, 27670, 27225, 26725, 26210, 25716, 25240, 24789, 24373, 23946, 23572, 22846, 21801, 20842, 19949, 19121, 18386, 17651, 16998, 16349, 15800, 15247, 14783, 14321, 13859, 13535, 13081, 12702, 12423, 12056, 11779, 11513, 11135, 10955, 10676, 10392, 10208, 9928, 9747, 9564, 9369, 9193, 9017, 8822, 8639, 8458, 8270, 8084, 7896, 7710, 7527, 7347, 7156, 6977, 6788, 6607, 6422, 6236, 6054, 5867, 5684, 5495, 5305, 5128, 4945, 4751, 4638, 4442, 4248, 4065, 3888, 3698, 3509, 3326, 3139, 2957, 2775, 2586, 2405, 2216, 2037, 1846, 1666, 1483, 1297, 1109, 927, 735, 554, 375, 201, 128, 0 }; qvalue=(ssize_t) (jpeg_info->quant_tbl_ptrs[0]->quantval[2]+ jpeg_info->quant_tbl_ptrs[0]->quantval[53]+ jpeg_info->quant_tbl_ptrs[1]->quantval[0]+ jpeg_info->quant_tbl_ptrs[1]->quantval[DCTSIZE2-1]); for (i=0; i < 100; i++) { if ((qvalue < hash[i]) && (sum < sums[i])) continue; if (((qvalue <= hash[i]) && (sum <= sums[i])) || (i >= 50)) image->quality=(size_t) i+1; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Quality: %.20g (%s)"",(double) i+1,(qvalue <= hash[i]) && (sum <= sums[i]) ? ""exact"" : ""approximate""); break; } } else if (jpeg_info->quant_tbl_ptrs[0] != NULL) { ssize_t hash[101] = { 510, 505, 422, 380, 355, 338, 326, 318, 311, 305, 300, 297, 293, 291, 288, 286, 284, 283, 281, 280, 279, 278, 277, 273, 262, 251, 243, 233, 225, 218, 211, 205, 198, 193, 186, 181, 177, 172, 168, 164, 158, 156, 152, 148, 145, 142, 139, 136, 133, 131, 129, 126, 123, 120, 118, 115, 113, 110, 107, 105, 102, 100, 97, 94, 92, 89, 87, 83, 81, 79, 76, 74, 70, 68, 66, 63, 61, 57, 55, 52, 50, 48, 44, 42, 39, 37, 34, 31, 29, 26, 24, 21, 18, 16, 13, 11, 8, 6, 3, 2, 0 }, sums[101] = { 16320, 16315, 15946, 15277, 14655, 14073, 13623, 13230, 12859, 12560, 12240, 11861, 11456, 11081, 10714, 10360, 10027, 9679, 9368, 9056, 8680, 8331, 7995, 7668, 7376, 7084, 6823, 6562, 6345, 6125, 5939, 5756, 5571, 5421, 5240, 5086, 4976, 4829, 4719, 4616, 4463, 4393, 4280, 4166, 4092, 3980, 3909, 3835, 3755, 3688, 3621, 3541, 3467, 3396, 3323, 3247, 3170, 3096, 3021, 2952, 2874, 2804, 2727, 2657, 2583, 2509, 2437, 2362, 2290, 2211, 2136, 2068, 1996, 1915, 1858, 1773, 1692, 1620, 1552, 1477, 1398, 1326, 1251, 1179, 1109, 1031, 961, 884, 814, 736, 667, 592, 518, 441, 369, 292, 221, 151, 86, 64, 0 }; qvalue=(ssize_t) (jpeg_info->quant_tbl_ptrs[0]->quantval[2]+ jpeg_info->quant_tbl_ptrs[0]->quantval[53]); for (i=0; i < 100; i++) { if ((qvalue < hash[i]) && (sum < sums[i])) continue; if (((qvalue <= hash[i]) && (sum <= sums[i])) || (i >= 50)) image->quality=(size_t)i+1; if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), ""Quality: %.20g (%s)"",(double) i+1,(qvalue <= hash[i]) && (sum <= sums[i]) ? ""exact"" : ""approximate""); break; } } } } ",0 "RenderFrameImpl::MakeDidCommitProvisionalLoadParams( blink::WebHistoryCommitType commit_type, ui::PageTransition transition) { WebDocumentLoader* document_loader = frame_->GetDocumentLoader(); const WebURLResponse& response = document_loader->GetResponse(); InternalDocumentStateData* internal_data = InternalDocumentStateData::FromDocumentLoader( frame_->GetDocumentLoader()); NavigationState* navigation_state = internal_data->navigation_state(); std::unique_ptr params = std::make_unique(); params->http_status_code = response.HttpStatusCode(); params->url_is_unreachable = document_loader->HasUnreachableURL(); params->method = ""GET""; params->intended_as_new_entry = navigation_state->commit_params().intended_as_new_entry; params->should_replace_current_entry = document_loader->ReplacesCurrentHistoryItem(); params->post_id = -1; params->nav_entry_id = navigation_state->commit_params().nav_entry_id; params->navigation_token = navigation_state->commit_params().navigation_token; if (params->navigation_token.is_empty()) params->navigation_token = base::UnguessableToken::Create(); params->did_create_new_entry = (commit_type == blink::kWebStandardCommit) || (commit_type == blink::kWebHistoryInertCommit && !frame_->Parent() && params->should_replace_current_entry && !navigation_state->WasWithinSameDocument()); WebDocument frame_document = frame_->GetDocument(); WebSecurityOrigin frame_origin = frame_document.GetSecurityOrigin(); params->origin = frame_origin; params->insecure_request_policy = frame_->GetInsecureRequestPolicy(); params->insecure_navigations_set = frame_->GetInsecureRequestToUpgrade(); params->has_potentially_trustworthy_unique_origin = frame_origin.IsUnique() && frame_origin.IsPotentiallyTrustworthy(); params->url = GetLoadingUrl(); if (GURL(frame_document.BaseURL()) != params->url) params->base_url = frame_document.BaseURL(); GetRedirectChain(document_loader, ¶ms->redirects); params->should_update_history = !document_loader->HasUnreachableURL() && response.HttpStatusCode() != 404; params->gesture = document_loader->HadUserGesture() ? NavigationGestureUser : NavigationGestureAuto; params->page_state = SingleHistoryItemToPageState(current_history_item_); params->content_source_id = GetLocalRootRenderWidget()->GetContentSourceId(); params->method = document_loader->HttpMethod().Latin1(); if (params->method == ""POST"") params->post_id = ExtractPostId(current_history_item_); params->item_sequence_number = current_history_item_.ItemSequenceNumber(); params->document_sequence_number = current_history_item_.DocumentSequenceNumber(); if (document_loader->IsClientRedirect()) { params->referrer = Referrer(params->redirects[0], document_loader->GetReferrerPolicy()); } else { params->referrer = Referrer(blink::WebStringToGURL(document_loader->Referrer()), document_loader->GetReferrerPolicy()); } if (!frame_->Parent()) { params->contents_mime_type = document_loader->GetResponse().MimeType().Utf8(); params->transition = transition; DCHECK(ui::PageTransitionIsMainFrame(params->transition)); if (document_loader->IsClientRedirect()) { params->transition = ui::PageTransitionFromInt( params->transition | ui::PAGE_TRANSITION_CLIENT_REDIRECT); } params->is_overriding_user_agent = internal_data->is_overriding_user_agent(); params->original_request_url = GetOriginalRequestURL(document_loader); params->history_list_was_cleared = navigation_state->commit_params().should_clear_history_list; } else { if (commit_type == blink::kWebStandardCommit) params->transition = ui::PAGE_TRANSITION_MANUAL_SUBFRAME; else params->transition = ui::PAGE_TRANSITION_AUTO_SUBFRAME; DCHECK(!navigation_state->commit_params().should_clear_history_list); params->history_list_was_cleared = false; } if (!params->origin.opaque() && params->url.IsStandard() && render_view_->GetWebkitPreferences().web_security_enabled) { if (params->origin.scheme() != url::kFileScheme || !render_view_->GetWebkitPreferences() .allow_universal_access_from_file_urls) { CHECK(params->origin.IsSameOriginWith(url::Origin::Create(params->url))) << "" url:"" << params->url << "" origin:"" << params->origin; } } params->request_id = internal_data->request_id(); return params; } ",0 "smp_fetch_fhdr_cnt(struct proxy *px, struct session *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw) { struct http_txn *txn = l7; struct hdr_idx *idx = &txn->hdr_idx; struct hdr_ctx ctx; const struct http_msg *msg = ((opt & SMP_OPT_DIR) == SMP_OPT_DIR_REQ) ? &txn->req : &txn->rsp; int cnt; if (!args || args->type != ARGT_STR) return 0; CHECK_HTTP_MESSAGE_FIRST(); ctx.idx = 0; cnt = 0; while (http_find_full_header2(args->data.str.str, args->data.str.len, msg->chn->buf->p, idx, &ctx)) cnt++; smp->type = SMP_T_UINT; smp->data.uint = cnt; smp->flags = SMP_F_VOL_HDR; return 1; } ",0 "static void follow_dotdot(struct nameidata *nd) { set_root(nd); while(1) { struct dentry *old = nd->path.dentry; if (nd->path.dentry == nd->root.dentry && nd->path.mnt == nd->root.mnt) { break; } if (nd->path.dentry != nd->path.mnt->mnt_root) { /* rare case of legitimate dget_parent()... */ nd->path.dentry = dget_parent(nd->path.dentry); dput(old); break; } if (!follow_up(&nd->path)) break; } follow_mount(&nd->path); nd->inode = nd->path.dentry->d_inode; } ",0 "void GetFileInfoOnBlockingPool(const FilePath& path, base::PlatformFileInfo* file_info, bool* result) { *result = file_util::GetFileInfo(path, file_info); } ",0 "static void ocfs2_free_unwritten_list(struct inode *inode, struct list_head *head) { struct ocfs2_inode_info *oi = OCFS2_I(inode); struct ocfs2_unwritten_extent *ue = NULL, *tmp = NULL; list_for_each_entry_safe(ue, tmp, head, ue_node) { list_del(&ue->ue_node); spin_lock(&oi->ip_lock); list_del(&ue->ue_ip_node); spin_unlock(&oi->ip_lock); kfree(ue); } } ",0 "fz_default_cmyk(fz_context *ctx, const fz_default_colorspaces *default_cs) { if (default_cs) return default_cs->cmyk; else return fz_device_cmyk(ctx); } ",0 "static inline unsigned int ahash_align_buffer_size(unsigned len, unsigned long mask) { return len + (mask & ~(crypto_tfm_ctx_alignment() - 1)); } ",0 "media_status_t AMediaCodecCryptoInfo_delete(AMediaCodecCryptoInfo* info) { free(info); return AMEDIA_OK; } ",0 "static inline u64 nsec_to_cycles(struct kvm_vcpu *vcpu, u64 nsec) { return pvclock_scale_delta(nsec, vcpu->arch.virtual_tsc_mult, vcpu->arch.virtual_tsc_shift); } ",0 "g_NPN_ReleaseObject_Now(NPObject *npobj) { D(bugiI(""NPN_ReleaseObject npobj=%p\n"", npobj)); uint32_t refcount = invoke_NPN_ReleaseObject(npobj); D(bugiD(""NPN_ReleaseObject done (refcount: %d)\n"", refcount)); if ((npobj->referenceCount = refcount) == 0) npobject_destroy(npobj); } ",0 " static void ndp_msg_addrto_adjust_all_nodes(struct in6_addr *addr) { struct in6_addr any = IN6ADDR_ANY_INIT; if (memcmp(addr, &any, sizeof(any))) return; addr->s6_addr32[0] = htonl(0xFF020000); addr->s6_addr32[1] = 0; addr->s6_addr32[2] = 0; addr->s6_addr32[3] = htonl(0x1); } ",0 "static struct crypto_alg *crypto_user_aead_alg(const char *name, u32 type, u32 mask) { int err; struct crypto_alg *alg; type &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV); type |= CRYPTO_ALG_TYPE_AEAD; mask &= ~(CRYPTO_ALG_TYPE_MASK | CRYPTO_ALG_GENIV); mask |= CRYPTO_ALG_TYPE_MASK; for (;;) { alg = crypto_lookup_aead(name, type, mask); if (!IS_ERR(alg)) return alg; err = PTR_ERR(alg); if (err != -EAGAIN) break; if (signal_pending(current)) { err = -EINTR; break; } } return ERR_PTR(err); } ",0 "int test_set_oom_score_adj(int new_val) { struct sighand_struct *sighand = current->sighand; int old_val; spin_lock_irq(&sighand->siglock); old_val = current->signal->oom_score_adj; if (new_val != old_val) { if (new_val == OOM_SCORE_ADJ_MIN) atomic_inc(¤t->mm->oom_disable_count); else if (old_val == OOM_SCORE_ADJ_MIN) atomic_dec(¤t->mm->oom_disable_count); current->signal->oom_score_adj = new_val; } spin_unlock_irq(&sighand->siglock); return old_val; } ",0 "SYSCALL_DEFINE2(getpriority, int, which, int, who) { struct task_struct *g, *p; struct user_struct *user; const struct cred *cred = current_cred(); long niceval, retval = -ESRCH; struct pid *pgrp; if (which > PRIO_USER || which < PRIO_PROCESS) return -EINVAL; rcu_read_lock(); read_lock(&tasklist_lock); switch (which) { case PRIO_PROCESS: if (who) p = find_task_by_vpid(who); else p = current; if (p) { niceval = 20 - task_nice(p); if (niceval > retval) retval = niceval; } break; case PRIO_PGRP: if (who) pgrp = find_vpid(who); else pgrp = task_pgrp(current); do_each_pid_thread(pgrp, PIDTYPE_PGID, p) { niceval = 20 - task_nice(p); if (niceval > retval) retval = niceval; } while_each_pid_thread(pgrp, PIDTYPE_PGID, p); break; case PRIO_USER: user = (struct user_struct *) cred->user; if (!who) who = cred->uid; else if ((who != cred->uid) && !(user = find_user(who))) goto out_unlock; /* No processes for this user */ do_each_thread(g, p) { if (__task_cred(p)->uid == who) { niceval = 20 - task_nice(p); if (niceval > retval) retval = niceval; } } while_each_thread(g, p); if (who != cred->uid) free_uid(user); /* for find_user() */ break; } out_unlock: read_unlock(&tasklist_lock); rcu_read_unlock(); return retval; } ",0 "map_engine_get_talk_key(player_id_t player_id) { return s_players[player_id].talk_key; } ",0 "void impeg2d_next_code(dec_state_t *ps_dec, UWORD32 u4_start_code_val) { stream_t *ps_stream; ps_stream = &ps_dec->s_bit_stream; impeg2d_bit_stream_flush_to_byte_boundary(ps_stream); while ((impeg2d_bit_stream_nxt(ps_stream,START_CODE_LEN) != u4_start_code_val) && (ps_dec->s_bit_stream.u4_offset < ps_dec->s_bit_stream.u4_max_offset)) { if (impeg2d_bit_stream_get(ps_stream,8) != 0) { /* Ignore stuffing bit errors. */ } } return; } ",0 "WebInsecureRequestPolicy FrameLoader::getInsecureRequestPolicy() const { Frame* parentFrame = m_frame->tree().parent(); if (!parentFrame) return kLeaveInsecureRequestsAlone; return parentFrame->securityContext()->getInsecureRequestPolicy(); } ",0 "int decode_block_coeffs(VP56RangeCoder *c, int16_t block[16], uint8_t probs[16][3][NUM_DCT_TOKENS - 1], int i, int zero_nhood, int16_t qmul[2], const uint8_t scan[16], int vp7) { uint8_t *token_prob = probs[i][zero_nhood]; if (!vp56_rac_get_prob_branchy(c, token_prob[0])) // DCT_EOB return 0; return vp7 ? vp7_decode_block_coeffs_internal(c, block, probs, i, token_prob, qmul, scan) : vp8_decode_block_coeffs_internal(c, block, probs, i, token_prob, qmul); } ",0 "static int __init crypto_pcbc_module_init(void) { return crypto_register_template(&crypto_pcbc_tmpl); } ",0 "static int atrtr_delete(struct atalk_addr * addr) { struct atalk_route **r = &atalk_routes; int retval = 0; struct atalk_route *tmp; write_lock_bh(&atalk_routes_lock); while ((tmp = *r) != NULL) { if (tmp->target.s_net == addr->s_net && (!(tmp->flags&RTF_GATEWAY) || tmp->target.s_node == addr->s_node)) { *r = tmp->next; dev_put(tmp->dev); kfree(tmp); goto out; } r = &tmp->next; } retval = -ENOENT; out: write_unlock_bh(&atalk_routes_lock); return retval; } ",0 "void __init llc_build_offset_table(void) { struct llc_conn_state *curr_state; int state, ev_type, next_offset; for (state = 0; state < NBR_CONN_STATES; state++) { curr_state = &llc_conn_state_table[state]; next_offset = 0; for (ev_type = 0; ev_type < NBR_CONN_EV; ev_type++) { llc_offset_table[state][ev_type] = next_offset; next_offset += llc_find_next_offset(curr_state, next_offset) + 1; } } } ",0 "void Automation::SetCookie(const std::string& url, DictionaryValue* cookie_dict, Error** error) { std::string error_msg; if (!SendSetCookieJSONRequest(automation(), url, cookie_dict, &error_msg)) *error = new Error(kUnknownError, error_msg); } ",0 "uint64_t WebContentsImpl::GetUploadSize() const { return upload_size_; } ",0 "bool ChildProcessSecurityPolicyImpl::CanCreateFileSystemFile( int child_id, const storage::FileSystemURL& url) { return HasPermissionsForFileSystemFile(child_id, url, CREATE_NEW_FILE_GRANT); } ",0 " jas_seq2d_t *jas_seq2d_copy(jas_seq2d_t *x) { jas_matrix_t *y; int i; int j; y = jas_seq2d_create(jas_seq2d_xstart(x), jas_seq2d_ystart(x), jas_seq2d_xend(x), jas_seq2d_yend(x)); assert(y); for (i = 0; i < x->numrows_; ++i) { for (j = 0; j < x->numcols_; ++j) { *jas_matrix_getref(y, i, j) = jas_matrix_get(x, i, j); } } return y; } ",1 "static const MediaQueryEvaluator& printEval() { DEFINE_STATIC_LOCAL(const MediaQueryEvaluator, staticPrintEval, (""print"")); return staticPrintEval; } ",0 "static inline LineContribType * _gdContributionsAlloc(unsigned int line_length, unsigned int windows_size) { unsigned int u = 0; LineContribType *res; int overflow_error = 0; res = (LineContribType *) gdMalloc(sizeof(LineContribType)); if (!res) { return NULL; } res->WindowSize = windows_size; res->LineLength = line_length; if (overflow2(line_length, sizeof(ContributionType))) { gdFree(res); return NULL; } res->ContribRow = (ContributionType *) gdMalloc(line_length * sizeof(ContributionType)); if (res->ContribRow == NULL) { gdFree(res); return NULL; } for (u = 0 ; u < line_length ; u++) { if (overflow2(windows_size, sizeof(double))) { overflow_error = 1; } else { res->ContribRow[u].Weights = (double *) gdMalloc(windows_size * sizeof(double)); } if (overflow_error == 1 || res->ContribRow[u].Weights == NULL) { unsigned int i; u--; for (i=0;i<=u;i++) { gdFree(res->ContribRow[i].Weights); } gdFree(res->ContribRow); gdFree(res); return NULL; } } return res; } ",1 "void Gfx::pushStateGuard() { stateGuards.push_back(stackHeight); } ",0 "RenderWidgetHostViewPort* GetRenderWidgetHostViewFromSurfaceID( int surface_id) { int render_process_id = 0; int render_widget_id = 0; if (!GpuSurfaceTracker::Get()->GetRenderWidgetIDForSurface( surface_id, &render_process_id, &render_widget_id)) return NULL; RenderProcessHost* process = RenderProcessHost::FromID(render_process_id); if (!process) return NULL; RenderWidgetHost* host = process->GetRenderWidgetHostByID(render_widget_id); return host ? RenderWidgetHostViewPort::FromRWHV(host->GetView()) : NULL; } ",0 "WORD32 impeg2d_dec_p_mb_params(dec_state_t *ps_dec) { stream_t *ps_stream = &ps_dec->s_bit_stream; UWORD16 u2_mb_addr_incr; UWORD16 u2_total_len; UWORD16 u2_len; UWORD16 u2_mb_type; UWORD32 u4_next_word; const dec_mb_params_t *ps_dec_mb_params; if(impeg2d_bit_stream_nxt(ps_stream,1) == 1) { impeg2d_bit_stream_flush(ps_stream,1); } else { u2_mb_addr_incr = impeg2d_get_mb_addr_incr(ps_stream); if(0 == ps_dec->u2_first_mb) { /****************************************************************/ /* If the 2nd member of a field picture pair is a P picture and */ /* the first one was an I picture, there cannot be any skipped */ /* MBs in the second field picture */ /****************************************************************/ /* if((dec->picture_structure != FRAME_PICTURE) && (dec->f->FieldFuncCall != 0) && (dec->las->u1_last_coded_vop_type == I)) { core0_err_handler((void *)(VOLParams), ITTMPEG2_ERR_INVALID_MB_SKIP); } */ /****************************************************************/ /* In MPEG-2, the last MB of the row cannot be skipped and the */ /* MBAddrIncr cannot be such that it will take the current MB */ /* beyond the current row */ /* In MPEG-1, the slice could start and end anywhere and is not */ /* restricted to a row like in MPEG-2. Hence this check should */ /* not be done for MPEG-1 streams. */ /****************************************************************/ if(ps_dec->u2_is_mpeg2 && ((ps_dec->u2_mb_x + u2_mb_addr_incr) > ps_dec->u2_num_horiz_mb) ) { u2_mb_addr_incr = ps_dec->u2_num_horiz_mb - ps_dec->u2_mb_x; } if ((u2_mb_addr_incr - 1) > ps_dec->u2_num_mbs_left) { /* If the number of skip MBs are more than the number of MBs * left, indicate error. */ return IV_FAIL; } impeg2d_dec_skip_mbs(ps_dec, (UWORD16)(u2_mb_addr_incr - 1)); } } u4_next_word = (UWORD16)impeg2d_bit_stream_nxt(ps_stream,16); /*-----------------------------------------------------------------------*/ /* MB type */ /*-----------------------------------------------------------------------*/ { u2_mb_type = ps_dec->pu2_mb_type[BITS((UWORD16)u4_next_word,15,10)]; u2_len = BITS(u2_mb_type,15,8); u2_total_len = u2_len; u4_next_word = (UWORD16)LSW((UWORD16)u4_next_word << u2_len); } /*-----------------------------------------------------------------------*/ /* motion type */ /*-----------------------------------------------------------------------*/ { if((u2_mb_type & MB_FORW_OR_BACK) && ps_dec->u2_read_motion_type) { WORD32 i4_motion_type; ps_dec->u2_motion_type = BITS((UWORD16)u4_next_word,15,14); u2_total_len += MB_MOTION_TYPE_LEN; u4_next_word = (UWORD16)LSW((UWORD16)u4_next_word << MB_MOTION_TYPE_LEN); i4_motion_type = ps_dec->u2_motion_type; if((i4_motion_type == 0) || (i4_motion_type == 4) || (i4_motion_type > 7)) { i4_motion_type = 1; } } } /*-----------------------------------------------------------------------*/ /* dct type */ /*-----------------------------------------------------------------------*/ { if((u2_mb_type & MB_CODED) && ps_dec->u2_read_dct_type) { ps_dec->u2_field_dct = BIT((UWORD16)u4_next_word,15); u2_total_len += MB_DCT_TYPE_LEN; u4_next_word = (UWORD16)LSW((UWORD16)u4_next_word << MB_DCT_TYPE_LEN); } } /*-----------------------------------------------------------------------*/ /* Quant scale code */ /*-----------------------------------------------------------------------*/ if(u2_mb_type & MB_QUANT) { UWORD16 u2_quant_scale_code; u2_quant_scale_code = BITS((UWORD16)u4_next_word,15,11); ps_dec->u1_quant_scale = (ps_dec->u2_q_scale_type) ? gau1_impeg2_non_linear_quant_scale[u2_quant_scale_code] : (u2_quant_scale_code << 1); u2_total_len += MB_QUANT_SCALE_CODE_LEN; } impeg2d_bit_stream_flush(ps_stream,u2_total_len); /*-----------------------------------------------------------------------*/ /* Set the function pointers */ /*-----------------------------------------------------------------------*/ ps_dec->u2_coded_mb = (UWORD16)(u2_mb_type & MB_CODED); if(u2_mb_type & MB_FORW_OR_BACK) { UWORD16 refPic = !(u2_mb_type & MB_MV_FORW); UWORD16 index = (ps_dec->u2_motion_type); ps_dec->u2_prev_intra_mb = 0; ps_dec->e_mb_pred = (e_pred_direction_t)refPic; ps_dec_mb_params = &ps_dec->ps_func_forw_or_back[index]; ps_dec->s_mb_type = ps_dec_mb_params->s_mb_type; if(NULL == ps_dec_mb_params->pf_func_mb_params) return -1; ps_dec_mb_params->pf_func_mb_params(ps_dec); } else if(u2_mb_type & MB_TYPE_INTRA) { ps_dec->u2_prev_intra_mb = 1; impeg2d_dec_intra_mb(ps_dec); } else { ps_dec->u2_prev_intra_mb = 0; ps_dec->e_mb_pred = FORW; ps_dec->u2_motion_type = 0; impeg2d_dec_0mv_coded_mb(ps_dec); } /*-----------------------------------------------------------------------*/ /* decode cbp */ /*-----------------------------------------------------------------------*/ if((u2_mb_type & MB_TYPE_INTRA)) { ps_dec->u2_cbp = 0x3f; ps_dec->u2_prev_intra_mb = 1; } else { ps_dec->u2_prev_intra_mb = 0; ps_dec->u2_def_dc_pred[Y_LUMA] = 128 << ps_dec->u2_intra_dc_precision; ps_dec->u2_def_dc_pred[U_CHROMA] = 128 << ps_dec->u2_intra_dc_precision; ps_dec->u2_def_dc_pred[V_CHROMA] = 128 << ps_dec->u2_intra_dc_precision; if((ps_dec->u2_coded_mb)) { UWORD16 cbpValue; cbpValue = gau2_impeg2d_cbp_code[impeg2d_bit_stream_nxt(ps_stream,MB_CBP_LEN)]; ps_dec->u2_cbp = cbpValue & 0xFF; impeg2d_bit_stream_flush(ps_stream,(cbpValue >> 8) & 0x0FF); } else { ps_dec->u2_cbp = 0; } } return 0; } ",0 "BGD_DECLARE(gdImagePtr) gdImageCreateFromGd2PartPtr (int size, void *data, int srcx, int srcy, int w, int h) { _noLibzError(); return NULL; } ",0 "int ar6000_stop_ap_interface(struct ar6_softc *ar) { struct ar_virtual_interface *arApDev; /* Change net_device to point to sta instance */ arApDev = (struct ar_virtual_interface *)ar->arApDev; if (arApDev) { ar->arNetDev = arApDev->arStaNetDev; } return 0; } ",0 "void FS_Flush( fileHandle_t f ) { fflush(fsh[f].handleFiles.file.o); } ",0 "bool InputDispatcher::dispatchMotionLocked( nsecs_t currentTime, MotionEntry* entry, DropReason* dropReason, nsecs_t* nextWakeupTime) { if (! entry->dispatchInProgress) { entry->dispatchInProgress = true; logOutboundMotionDetailsLocked(""dispatchMotion - "", entry); } if (*dropReason != DROP_REASON_NOT_DROPPED) { setInjectionResultLocked(entry, *dropReason == DROP_REASON_POLICY ? INPUT_EVENT_INJECTION_SUCCEEDED : INPUT_EVENT_INJECTION_FAILED); return true; } bool isPointerEvent = entry->source & AINPUT_SOURCE_CLASS_POINTER; Vector inputTargets; bool conflictingPointerActions = false; int32_t injectionResult; if (isPointerEvent) { injectionResult = findTouchedWindowTargetsLocked(currentTime, entry, inputTargets, nextWakeupTime, &conflictingPointerActions); } else { injectionResult = findFocusedWindowTargetsLocked(currentTime, entry, inputTargets, nextWakeupTime); } if (injectionResult == INPUT_EVENT_INJECTION_PENDING) { return false; } setInjectionResultLocked(entry, injectionResult); if (injectionResult != INPUT_EVENT_INJECTION_SUCCEEDED) { if (injectionResult != INPUT_EVENT_INJECTION_PERMISSION_DENIED) { CancelationOptions::Mode mode(isPointerEvent ? CancelationOptions::CANCEL_POINTER_EVENTS : CancelationOptions::CANCEL_NON_POINTER_EVENTS); CancelationOptions options(mode, ""input event injection failed""); synthesizeCancelationEventsForMonitorsLocked(options); } return true; } if (isMainDisplay(entry->displayId)) { addMonitoringTargetsLocked(inputTargets); } if (conflictingPointerActions) { CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, ""conflicting pointer actions""); synthesizeCancelationEventsForAllConnectionsLocked(options); } dispatchEventLocked(currentTime, entry, inputTargets); return true; } ",0 "static int airspy_s_ctrl(struct v4l2_ctrl *ctrl) { struct airspy *s = container_of(ctrl->handler, struct airspy, hdl); int ret; switch (ctrl->id) { case V4L2_CID_RF_TUNER_LNA_GAIN_AUTO: case V4L2_CID_RF_TUNER_LNA_GAIN: ret = airspy_set_lna_gain(s); break; case V4L2_CID_RF_TUNER_MIXER_GAIN_AUTO: case V4L2_CID_RF_TUNER_MIXER_GAIN: ret = airspy_set_mixer_gain(s); break; case V4L2_CID_RF_TUNER_IF_GAIN: ret = airspy_set_if_gain(s); break; default: dev_dbg(s->dev, ""unknown ctrl: id=%d name=%s\n"", ctrl->id, ctrl->name); ret = -EINVAL; } return ret; } ",0 "void ProfileSyncService::OnSyncManagedPrefChange(bool is_sync_managed) { NotifyObservers(); if (is_sync_managed) { DisableForUser(); } else if (HasSyncSetupCompleted() && IsSyncEnabledAndLoggedIn() && IsSyncTokenAvailable()) { StartUp(); } } ",0 "bool PDFiumEngine::IsPageVisible(int index) const { return base::ContainsValue(visible_pages_, index); } ",0 "Strfree(Str x) { GC_free(x->ptr); GC_free(x); } ",0 "void RenderWidgetHostViewGuest::AboutToWaitForBackingStoreMsg() { NOTIMPLEMENTED(); } ",0 "void btrfs_orphan_commit_root(struct btrfs_trans_handle *trans, struct btrfs_root *root) { struct btrfs_block_rsv *block_rsv; int ret; if (atomic_read(&root->orphan_inodes) || root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE) return; spin_lock(&root->orphan_lock); if (atomic_read(&root->orphan_inodes)) { spin_unlock(&root->orphan_lock); return; } if (root->orphan_cleanup_state != ORPHAN_CLEANUP_DONE) { spin_unlock(&root->orphan_lock); return; } block_rsv = root->orphan_block_rsv; root->orphan_block_rsv = NULL; spin_unlock(&root->orphan_lock); if (root->orphan_item_inserted && btrfs_root_refs(&root->root_item) > 0) { ret = btrfs_del_orphan_item(trans, root->fs_info->tree_root, root->root_key.objectid); BUG_ON(ret); root->orphan_item_inserted = 0; } if (block_rsv) { WARN_ON(block_rsv->size > 0); btrfs_free_block_rsv(root, block_rsv); } } ",0 "void RenderViewImpl::CreatedPluginWindow(gfx::PluginWindowHandle window) { #if defined(USE_X11) Send(new ViewHostMsg_CreatePluginContainer(routing_id(), window)); #endif } ",0 "static int ext4_end_io_nolock(ext4_io_end_t *io) { struct inode *inode = io->inode; loff_t offset = io->offset; ssize_t size = io->size; int ret = 0; ext4_debug(""ext4_end_io_nolock: io 0x%p from inode %lu,list->next 0x%p,"" ""list->prev 0x%p\n"", io, inode->i_ino, io->list.next, io->list.prev); if (list_empty(&io->list)) return ret; if (io->flag != EXT4_IO_UNWRITTEN) return ret; if (offset + size <= i_size_read(inode)) ret = ext4_convert_unwritten_extents(inode, offset, size); if (ret < 0) { printk(KERN_EMERG ""%s: failed to convert unwritten"" ""extents to written extents, error is %d"" "" io is still on inode %lu aio dio list\n"", __func__, ret, inode->i_ino); return ret; } /* clear the DIO AIO unwritten flag */ io->flag = 0; return ret; } ",1 "void Document::documentWillBecomeInactive() { #if USE(ACCELERATED_COMPOSITING) if (renderer()) renderView()->setIsInWindow(false); #endif } ",0 "long sys_rt_sigreturn(int r3, int r4, int r5, int r6, int r7, int r8, struct pt_regs *regs) { struct rt_sigframe __user *rt_sf; #ifdef CONFIG_PPC_TRANSACTIONAL_MEM struct ucontext __user *uc_transact; unsigned long msr_hi; unsigned long tmp; int tm_restore = 0; #endif /* Always make any pending restarted system calls return -EINTR */ current->restart_block.fn = do_no_restart_syscall; rt_sf = (struct rt_sigframe __user *) (regs->gpr[1] + __SIGNAL_FRAMESIZE + 16); if (!access_ok(VERIFY_READ, rt_sf, sizeof(*rt_sf))) goto bad; #ifdef CONFIG_PPC_TRANSACTIONAL_MEM if (__get_user(tmp, &rt_sf->uc.uc_link)) goto bad; uc_transact = (struct ucontext __user *)(uintptr_t)tmp; if (uc_transact) { u32 cmcp; struct mcontext __user *mcp; if (__get_user(cmcp, &uc_transact->uc_regs)) return -EFAULT; mcp = (struct mcontext __user *)(u64)cmcp; /* The top 32 bits of the MSR are stashed in the transactional * ucontext. */ if (__get_user(msr_hi, &mcp->mc_gregs[PT_MSR])) goto bad; if (MSR_TM_ACTIVE(msr_hi<<32)) { /* We only recheckpoint on return if we're * transaction. */ tm_restore = 1; if (do_setcontext_tm(&rt_sf->uc, uc_transact, regs)) goto bad; } } if (!tm_restore) /* Fall through, for non-TM restore */ #endif if (do_setcontext(&rt_sf->uc, regs, 1)) goto bad; /* * It's not clear whether or why it is desirable to save the * sigaltstack setting on signal delivery and restore it on * signal return. But other architectures do this and we have * always done it up until now so it is probably better not to * change it. -- paulus */ #ifdef CONFIG_PPC64 if (compat_restore_altstack(&rt_sf->uc.uc_stack)) goto bad; #else if (restore_altstack(&rt_sf->uc.uc_stack)) goto bad; #endif set_thread_flag(TIF_RESTOREALL); return 0; bad: if (show_unhandled_signals) printk_ratelimited(KERN_INFO ""%s[%d]: bad frame in sys_rt_sigreturn: "" ""%p nip %08lx lr %08lx\n"", current->comm, current->pid, rt_sf, regs->nip, regs->link); force_sig(SIGSEGV, current); return 0; } ",0 "put_queue_stats(struct queue_stats_cbdata *cbdata, uint32_t queue_id, const struct netdev_queue_stats *stats) { struct ofputil_queue_stats oqs; oqs.port_no = cbdata->ofport->pp.port_no; oqs.queue_id = queue_id; oqs.tx_bytes = stats->tx_bytes; oqs.tx_packets = stats->tx_packets; oqs.tx_errors = stats->tx_errors; if (stats->created != LLONG_MIN) { calc_duration(stats->created, cbdata->now, &oqs.duration_sec, &oqs.duration_nsec); } else { oqs.duration_sec = oqs.duration_nsec = UINT32_MAX; } ofputil_append_queue_stat(&cbdata->replies, &oqs); } ",0 "nfsd_inject_print_locks(void) { struct nfs4_client *clp; u64 count = 0; struct nfsd_net *nn = net_generic(current->nsproxy->net_ns, nfsd_net_id); if (!nfsd_netns_ready(nn)) return 0; spin_lock(&nn->client_lock); list_for_each_entry(clp, &nn->client_lru, cl_lru) count += nfsd_print_client_locks(clp); spin_unlock(&nn->client_lock); return count; } ",0 "static int parse_label_menu(char **c, struct pxe_menu *cfg, struct pxe_label *label) { struct token t; char *s; s = *c; get_token(c, &t, L_KEYWORD); switch (t.type) { case T_DEFAULT: if (!cfg->default_label) cfg->default_label = strdup(label->name); if (!cfg->default_label) return -ENOMEM; break; case T_LABEL: parse_sliteral(c, &label->menu); break; default: printf(""Ignoring malformed menu command: %.*s\n"", (int)(*c - s), s); } eol_or_eof(c); return 0; } ",0 "const Cluster* Segment::FindOrPreloadCluster(long long requested_pos) { if (requested_pos < 0) return 0; Cluster** const ii = m_clusters; Cluster** i = ii; const long count = m_clusterCount + m_clusterPreloadCount; Cluster** const jj = ii + count; Cluster** j = jj; while (i < j) { Cluster** const k = i + (j - i) / 2; assert(k < jj); Cluster* const pCluster = *k; assert(pCluster); const long long pos = pCluster->GetPosition(); assert(pos >= 0); if (pos < requested_pos) i = k + 1; else if (pos > requested_pos) j = k; else return pCluster; } assert(i == j); Cluster* const pCluster = Cluster::Create( this, -1, requested_pos); assert(pCluster); const ptrdiff_t idx = i - m_clusters; PreloadCluster(pCluster, idx); assert(m_clusters); assert(m_clusterPreloadCount > 0); assert(m_clusters[idx] == pCluster); return pCluster; } ",1 "static void vmx_load_eoi_exitmap(struct kvm_vcpu *vcpu, u64 *eoi_exit_bitmap) { if (!vmx_vm_has_apicv(vcpu->kvm)) return; vmcs_write64(EOI_EXIT_BITMAP0, eoi_exit_bitmap[0]); vmcs_write64(EOI_EXIT_BITMAP1, eoi_exit_bitmap[1]); vmcs_write64(EOI_EXIT_BITMAP2, eoi_exit_bitmap[2]); vmcs_write64(EOI_EXIT_BITMAP3, eoi_exit_bitmap[3]); } ",0 "int tls_construct_client_hello(SSL *s) { unsigned char *buf; unsigned char *p, *d; int i; int protverr; unsigned long l; int al = 0; #ifndef OPENSSL_NO_COMP int j; SSL_COMP *comp; #endif SSL_SESSION *sess = s->session; buf = (unsigned char *)s->init_buf->data; /* Work out what SSL/TLS/DTLS version to use */ protverr = ssl_set_client_hello_version(s); if (protverr != 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, protverr); goto err; } if ((sess == NULL) || !ssl_version_supported(s, sess->ssl_version) || /* * In the case of EAP-FAST, we can have a pre-shared * ""ticket"" without a session ID. */ (!sess->session_id_length && !sess->tlsext_tick) || (sess->not_resumable)) { if (!ssl_get_new_session(s, 0)) goto err; } /* else use the pre-loaded session */ p = s->s3->client_random; /* * for DTLS if client_random is initialized, reuse it, we are * required to use same upon reply to HelloVerify */ if (SSL_IS_DTLS(s)) { size_t idx; i = 1; for (idx = 0; idx < sizeof(s->s3->client_random); idx++) { if (p[idx]) { i = 0; break; } } } else i = 1; if (i && ssl_fill_hello_random(s, 0, p, sizeof(s->s3->client_random)) <= 0) goto err; /* Do the message type and length last */ d = p = ssl_handshake_start(s); /*- * version indicates the negotiated version: for example from * an SSLv2/v3 compatible client hello). The client_version * field is the maximum version we permit and it is also * used in RSA encrypted premaster secrets. Some servers can * choke if we initially report a higher version then * renegotiate to a lower one in the premaster secret. This * didn't happen with TLS 1.0 as most servers supported it * but it can with TLS 1.1 or later if the server only supports * 1.0. * * Possible scenario with previous logic: * 1. Client hello indicates TLS 1.2 * 2. Server hello says TLS 1.0 * 3. RSA encrypted premaster secret uses 1.2. * 4. Handshake proceeds using TLS 1.0. * 5. Server sends hello request to renegotiate. * 6. Client hello indicates TLS v1.0 as we now * know that is maximum server supports. * 7. Server chokes on RSA encrypted premaster secret * containing version 1.0. * * For interoperability it should be OK to always use the * maximum version we support in client hello and then rely * on the checking of version to ensure the servers isn't * being inconsistent: for example initially negotiating with * TLS 1.0 and renegotiating with TLS 1.2. We do this by using * client_version in client hello and not resetting it to * the negotiated version. */ *(p++) = s->client_version >> 8; *(p++) = s->client_version & 0xff; /* Random stuff */ memcpy(p, s->s3->client_random, SSL3_RANDOM_SIZE); p += SSL3_RANDOM_SIZE; /* Session ID */ if (s->new_session) i = 0; else i = s->session->session_id_length; *(p++) = i; if (i != 0) { if (i > (int)sizeof(s->session->session_id)) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } memcpy(p, s->session->session_id, i); p += i; } /* cookie stuff for DTLS */ if (SSL_IS_DTLS(s)) { if (s->d1->cookie_len > sizeof(s->d1->cookie)) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } *(p++) = s->d1->cookie_len; memcpy(p, s->d1->cookie, s->d1->cookie_len); p += s->d1->cookie_len; } /* Ciphers supported */ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2])); if (i == 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, SSL_R_NO_CIPHERS_AVAILABLE); goto err; } #ifdef OPENSSL_MAX_TLS1_2_CIPHER_LENGTH /* * Some servers hang if client hello > 256 bytes as hack workaround * chop number of supported ciphers to keep it well below this if we * use TLS v1.2 */ if (TLS1_get_version(s) >= TLS1_2_VERSION && i > OPENSSL_MAX_TLS1_2_CIPHER_LENGTH) i = OPENSSL_MAX_TLS1_2_CIPHER_LENGTH & ~1; #endif s2n(i, p); p += i; /* COMPRESSION */ #ifdef OPENSSL_NO_COMP *(p++) = 1; #else if (!ssl_allow_compression(s) || !s->ctx->comp_methods) j = 0; else j = sk_SSL_COMP_num(s->ctx->comp_methods); *(p++) = 1 + j; for (i = 0; i < j; i++) { comp = sk_SSL_COMP_value(s->ctx->comp_methods, i); *(p++) = comp->id; } #endif *(p++) = 0; /* Add the NULL method */ /* TLS extensions */ if (ssl_prepare_clienthello_tlsext(s) <= 0) { SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); goto err; } if ((p = ssl_add_clienthello_tlsext(s, p, buf + SSL3_RT_MAX_PLAIN_LENGTH, &al)) == NULL) { ssl3_send_alert(s, SSL3_AL_FATAL, al); SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } l = p - d; if (!ssl_set_handshake_header(s, SSL3_MT_CLIENT_HELLO, l)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_TLS_CONSTRUCT_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } return 1; err: ossl_statem_set_error(s); return 0; } ",0 " void Read(VideoDecoder::DecoderStatus* status, scoped_refptr* video_frame) { EXPECT_CALL(*this, FrameReady(_, _)) .WillOnce(DoAll(SaveArg<0>(status), SaveArg<1>(video_frame))); decoder_->Read(read_cb_); message_loop_.RunAllPending(); } ",0 "dispatchGsmBrSmsCnf(Parcel &p, RequestInfo *pRI) { int32_t t; status_t status; int32_t num; status = p.readInt32(&num); if (status != NO_ERROR) { goto invalid; } { RIL_GSM_BroadcastSmsConfigInfo gsmBci[num]; RIL_GSM_BroadcastSmsConfigInfo *gsmBciPtrs[num]; startRequest; for (int i = 0 ; i < num ; i++ ) { gsmBciPtrs[i] = &gsmBci[i]; status = p.readInt32(&t); gsmBci[i].fromServiceId = (int) t; status = p.readInt32(&t); gsmBci[i].toServiceId = (int) t; status = p.readInt32(&t); gsmBci[i].fromCodeScheme = (int) t; status = p.readInt32(&t); gsmBci[i].toCodeScheme = (int) t; status = p.readInt32(&t); gsmBci[i].selected = (uint8_t) t; appendPrintBuf(""%s [%d: fromServiceId=%d, toServiceId =%d, \ fromCodeScheme=%d, toCodeScheme=%d, selected =%d]"", printBuf, i, gsmBci[i].fromServiceId, gsmBci[i].toServiceId, gsmBci[i].fromCodeScheme, gsmBci[i].toCodeScheme, gsmBci[i].selected); } closeRequest; if (status != NO_ERROR) { goto invalid; } CALL_ONREQUEST(pRI->pCI->requestNumber, gsmBciPtrs, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *), pRI, pRI->socket_id); #ifdef MEMSET_FREED memset(gsmBci, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo)); memset(gsmBciPtrs, 0, num * sizeof(RIL_GSM_BroadcastSmsConfigInfo *)); #endif } return; invalid: invalidCommandBlock(pRI); return; } ",0 "static __latent_entropy void net_rx_action(struct softirq_action *h) { struct softnet_data *sd = this_cpu_ptr(&softnet_data); unsigned long time_limit = jiffies + usecs_to_jiffies(netdev_budget_usecs); int budget = netdev_budget; LIST_HEAD(list); LIST_HEAD(repoll); local_irq_disable(); list_splice_init(&sd->poll_list, &list); local_irq_enable(); for (;;) { struct napi_struct *n; if (list_empty(&list)) { if (!sd_has_rps_ipi_waiting(sd) && list_empty(&repoll)) goto out; break; } n = list_first_entry(&list, struct napi_struct, poll_list); budget -= napi_poll(n, &repoll); /* If softirq window is exhausted then punt. * Allow this to run for 2 jiffies since which will allow * an average latency of 1.5/HZ. */ if (unlikely(budget <= 0 || time_after_eq(jiffies, time_limit))) { sd->time_squeeze++; break; } } local_irq_disable(); list_splice_tail_init(&sd->poll_list, &list); list_splice_tail(&repoll, &list); list_splice(&list, &sd->poll_list); if (!list_empty(&sd->poll_list)) __raise_softirq_irqoff(NET_RX_SOFTIRQ); net_rps_action_and_irq_enable(sd); out: __kfree_skb_flush(); } ",0 "void DevToolsWindow::UpgradeDraggedFileSystemPermissions( const std::string& file_system_url) { CHECK(web_contents_->GetURL().SchemeIs(chrome::kChromeDevToolsScheme)); file_helper_->UpgradeDraggedFileSystemPermissions( file_system_url, base::Bind(&DevToolsWindow::FileSystemAdded, weak_factory_.GetWeakPtr()), base::Bind(&DevToolsWindow::ShowDevToolsConfirmInfoBar, weak_factory_.GetWeakPtr())); } ",0 "int BrowserCommandController::GetLastBlockedCommand( WindowOpenDisposition* disposition) { if (disposition) *disposition = last_blocked_command_disposition_; return last_blocked_command_id_; } ",0 " void AddLog(const std::string& message) { log_ += message; } ",0 "AttachUnboundGPU(ScreenPtr pScreen, ScreenPtr new) { assert(new->isGPU); assert(!new->current_master); xorg_list_add(&new->unattached_head, &pScreen->unattached_list); new->current_master = pScreen; } ",0 "bool Tar::Create(const wxString& dmod_folder, double *compression_ratio, wxProgressDialog* aProgressDialog) { if (!bCanCompress) return wxEmptyString; wxString strCwd = ::wxGetCwd(); ::wxSetWorkingDirectory(strCompressDir); bool result = CreateReal(dmod_folder, compression_ratio, aProgressDialog); ::wxSetWorkingDirectory(strCwd); return result; } ",0 "Evas_Object* ewk_view_frame_focused_get(const Evas_Object* ewkView) { EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0); EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0); WebCore::Frame* core = priv->page->focusController()->focusedFrame(); if (!core) return 0; WebCore::FrameLoaderClientEfl* client = static_cast(core->loader()->client()); if (!client) return 0; return client->webFrame(); } ",0 "bool FrameView::scheduleAnimation() { if (HostWindow* window = hostWindow()) { window->scheduleAnimation(); return true; } return false; } ",0 "static unsigned mounts_poll(struct file *file, poll_table *wait) { struct proc_mounts *p = file->private_data; struct mnt_namespace *ns = p->ns; unsigned res = POLLIN | POLLRDNORM; poll_wait(file, &ns->poll, wait); spin_lock(&vfsmount_lock); if (p->event != ns->event) { p->event = ns->event; res |= POLLERR | POLLPRI; } spin_unlock(&vfsmount_lock); return res; } ",0 "bool PrintWebViewHelper::PrintPages(WebFrame* frame, const WebNode& node) { const PrintMsg_PrintPages_Params& params = *print_pages_params_; const PrintMsg_Print_Params& print_params = params.params; PrepareFrameAndViewForPrint prep_frame_view(print_params, frame, node); UpdateFrameAndViewFromCssPageLayout(frame, node, &prep_frame_view, print_params, ignore_css_margins_); int page_count = prep_frame_view.GetExpectedPageCount(); if (!page_count) return false; Send(new PrintHostMsg_DidGetPrintedPagesCount(routing_id(), print_params.document_cookie, page_count)); const gfx::Size& canvas_size = prep_frame_view.GetPrintCanvasSize(); PrintMsg_PrintPage_Params page_params; page_params.params = print_params; if (params.pages.empty()) { for (int i = 0; i < page_count; ++i) { page_params.page_number = i; PrintPageInternal(page_params, canvas_size, frame); } } else { for (size_t i = 0; i < params.pages.size(); ++i) { if (params.pages[i] >= page_count) break; page_params.page_number = params.pages[i]; PrintPageInternal(page_params, canvas_size, frame); } } return true; } ",0 "static void dns_update_resolvers_timeout(struct dns_resolvers *resolvers) { struct dns_resolution *res; int next; next = tick_add(now_ms, resolvers->timeout.resolve); if (!LIST_ISEMPTY(&resolvers->resolutions.curr)) { res = LIST_NEXT(&resolvers->resolutions.curr, struct dns_resolution *, list); next = MIN(next, tick_add(res->last_query, resolvers->timeout.retry)); } list_for_each_entry(res, &resolvers->resolutions.wait, list) next = MIN(next, tick_add(res->last_resolution, dns_resolution_timeout(res))); resolvers->t->expire = next; task_queue(resolvers->t); } ",0 "void WebLocalFrameImpl::MoveCaretSelection(const WebPoint& point_in_viewport) { TRACE_EVENT0(""blink"", ""WebLocalFrameImpl::moveCaretSelection""); GetFrame()->GetDocument()->UpdateStyleAndLayoutIgnorePendingStylesheets(); const IntPoint point_in_contents = GetFrame()->View()->ViewportToFrame(point_in_viewport); GetFrame()->Selection().MoveCaretSelection(point_in_contents); } ",0 "relay_set_digest(crypto_digest_t *digest, cell_t *cell) { char integrity[4]; relay_header_t rh; crypto_digest_add_bytes(digest, (char*)cell->payload, CELL_PAYLOAD_SIZE); crypto_digest_get_digest(digest, integrity, 4); relay_header_unpack(&rh, cell->payload); memcpy(rh.integrity, integrity, 4); relay_header_pack(cell->payload, &rh); } ",0 "static int process_line(URLContext *h, char *line, int line_count, int *new_location) { HTTPContext *s = h->priv_data; const char *auto_method = h->flags & AVIO_FLAG_READ ? ""POST"" : ""GET""; char *tag, *p, *end, *method, *resource, *version; int ret; /* end of header */ if (line[0] == '\0') { s->end_header = 1; return 0; } p = line; if (line_count == 0) { if (s->is_connected_server) { method = p; while (*p && !av_isspace(*p)) p++; *(p++) = '\0'; av_log(h, AV_LOG_TRACE, ""Received method: %s\n"", method); if (s->method) { if (av_strcasecmp(s->method, method)) { av_log(h, AV_LOG_ERROR, ""Received and expected HTTP method do not match. (%s expected, %s received)\n"", s->method, method); return ff_http_averror(400, AVERROR(EIO)); } } else { av_log(h, AV_LOG_TRACE, ""Autodetected %s HTTP method\n"", auto_method); if (av_strcasecmp(auto_method, method)) { av_log(h, AV_LOG_ERROR, ""Received and autodetected HTTP method did not match "" ""(%s autodetected %s received)\n"", auto_method, method); return ff_http_averror(400, AVERROR(EIO)); } if (!(s->method = av_strdup(method))) return AVERROR(ENOMEM); } while (av_isspace(*p)) p++; resource = p; while (!av_isspace(*p)) p++; *(p++) = '\0'; av_log(h, AV_LOG_TRACE, ""Requested resource: %s\n"", resource); if (!(s->resource = av_strdup(resource))) return AVERROR(ENOMEM); while (av_isspace(*p)) p++; version = p; while (*p && !av_isspace(*p)) p++; *p = '\0'; if (av_strncasecmp(version, ""HTTP/"", 5)) { av_log(h, AV_LOG_ERROR, ""Malformed HTTP version string.\n""); return ff_http_averror(400, AVERROR(EIO)); } av_log(h, AV_LOG_TRACE, ""HTTP version string: %s\n"", version); } else { while (!av_isspace(*p) && *p != '\0') p++; while (av_isspace(*p)) p++; s->http_code = strtol(p, &end, 10); av_log(h, AV_LOG_TRACE, ""http_code=%d\n"", s->http_code); if ((ret = check_http_code(h, s->http_code, end)) < 0) return ret; } } else { while (*p != '\0' && *p != ':') p++; if (*p != ':') return 1; *p = '\0'; tag = line; p++; while (av_isspace(*p)) p++; if (!av_strcasecmp(tag, ""Location"")) { if ((ret = parse_location(s, p)) < 0) return ret; *new_location = 1; } else if (!av_strcasecmp(tag, ""Content-Length"") && s->filesize == -1) { s->filesize = strtoll(p, NULL, 10); } else if (!av_strcasecmp(tag, ""Content-Range"")) { parse_content_range(h, p); } else if (!av_strcasecmp(tag, ""Accept-Ranges"") && !strncmp(p, ""bytes"", 5) && s->seekable == -1) { h->is_streamed = 0; } else if (!av_strcasecmp(tag, ""Transfer-Encoding"") && !av_strncasecmp(p, ""chunked"", 7)) { s->filesize = -1; s->chunksize = 0; } else if (!av_strcasecmp(tag, ""WWW-Authenticate"")) { ff_http_auth_handle_header(&s->auth_state, tag, p); } else if (!av_strcasecmp(tag, ""Authentication-Info"")) { ff_http_auth_handle_header(&s->auth_state, tag, p); } else if (!av_strcasecmp(tag, ""Proxy-Authenticate"")) { ff_http_auth_handle_header(&s->proxy_auth_state, tag, p); } else if (!av_strcasecmp(tag, ""Connection"")) { if (!strcmp(p, ""close"")) s->willclose = 1; } else if (!av_strcasecmp(tag, ""Server"")) { if (!av_strcasecmp(p, ""AkamaiGHost"")) { s->is_akamai = 1; } else if (!av_strncasecmp(p, ""MediaGateway"", 12)) { s->is_mediagateway = 1; } } else if (!av_strcasecmp(tag, ""Content-Type"")) { av_free(s->mime_type); s->mime_type = av_strdup(p); } else if (!av_strcasecmp(tag, ""Set-Cookie"")) { if (parse_cookie(s, p, &s->cookie_dict)) av_log(h, AV_LOG_WARNING, ""Unable to parse '%s'\n"", p); } else if (!av_strcasecmp(tag, ""Icy-MetaInt"")) { s->icy_metaint = strtoll(p, NULL, 10); } else if (!av_strncasecmp(tag, ""Icy-"", 4)) { if ((ret = parse_icy(s, tag, p)) < 0) return ret; } else if (!av_strcasecmp(tag, ""Content-Encoding"")) { if ((ret = parse_content_encoding(h, p)) < 0) return ret; } } return 1; } ",1 "xfs_attr3_leaf_clearflag( struct xfs_da_args *args) { struct xfs_attr_leafblock *leaf; struct xfs_attr_leaf_entry *entry; struct xfs_attr_leaf_name_remote *name_rmt; struct xfs_buf *bp; int error; #ifdef DEBUG struct xfs_attr3_icleaf_hdr ichdr; xfs_attr_leaf_name_local_t *name_loc; int namelen; char *name; #endif /* DEBUG */ trace_xfs_attr_leaf_clearflag(args); /* * Set up the operation. */ error = xfs_attr3_leaf_read(args->trans, args->dp, args->blkno, -1, &bp); if (error) return error; leaf = bp->b_addr; entry = &xfs_attr3_leaf_entryp(leaf)[args->index]; ASSERT(entry->flags & XFS_ATTR_INCOMPLETE); #ifdef DEBUG xfs_attr3_leaf_hdr_from_disk(args->geo, &ichdr, leaf); ASSERT(args->index < ichdr.count); ASSERT(args->index >= 0); if (entry->flags & XFS_ATTR_LOCAL) { name_loc = xfs_attr3_leaf_name_local(leaf, args->index); namelen = name_loc->namelen; name = (char *)name_loc->nameval; } else { name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index); namelen = name_rmt->namelen; name = (char *)name_rmt->name; } ASSERT(be32_to_cpu(entry->hashval) == args->hashval); ASSERT(namelen == args->namelen); ASSERT(memcmp(name, args->name, namelen) == 0); #endif /* DEBUG */ entry->flags &= ~XFS_ATTR_INCOMPLETE; xfs_trans_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, entry, sizeof(*entry))); if (args->rmtblkno) { ASSERT((entry->flags & XFS_ATTR_LOCAL) == 0); name_rmt = xfs_attr3_leaf_name_remote(leaf, args->index); name_rmt->valueblk = cpu_to_be32(args->rmtblkno); name_rmt->valuelen = cpu_to_be32(args->rmtvaluelen); xfs_trans_log_buf(args->trans, bp, XFS_DA_LOGRANGE(leaf, name_rmt, sizeof(*name_rmt))); } /* * Commit the flag value change and start the next trans in series. */ return xfs_trans_roll_inode(&args->trans, args->dp); } ",0 "content::WebContents* ExtensionWebContentsObserver::GetAssociatedWebContents() const { return web_contents(); } ",0 "static void close_table_device(struct table_device *td, struct mapped_device *md) { if (!td->dm_dev.bdev) return; bd_unlink_disk_holder(td->dm_dev.bdev, dm_disk(md)); blkdev_put(td->dm_dev.bdev, td->dm_dev.mode | FMODE_EXCL); put_dax(td->dm_dev.dax_dev); td->dm_dev.bdev = NULL; td->dm_dev.dax_dev = NULL; } ",0 "GF_Err stbl_AddBox(GF_Box *s, GF_Box *a) { GF_SampleTableBox *ptr = (GF_SampleTableBox *)s; if (!a) return GF_OK; switch (a->type) { case GF_ISOM_BOX_TYPE_STTS: if (ptr->TimeToSample) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->TimeToSample = (GF_TimeToSampleBox *)a; break; case GF_ISOM_BOX_TYPE_CTTS: if (ptr->CompositionOffset) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->CompositionOffset = (GF_CompositionOffsetBox *)a; break; case GF_ISOM_BOX_TYPE_CSLG: if (ptr->CompositionToDecode) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->CompositionToDecode = (GF_CompositionToDecodeBox *)a; break; case GF_ISOM_BOX_TYPE_STSS: if (ptr->SyncSample) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->SyncSample = (GF_SyncSampleBox *)a; break; case GF_ISOM_BOX_TYPE_STSD: if (ptr->SampleDescription) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->SampleDescription =(GF_SampleDescriptionBox *)a; break; case GF_ISOM_BOX_TYPE_STZ2: case GF_ISOM_BOX_TYPE_STSZ: if (ptr->SampleSize) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->SampleSize = (GF_SampleSizeBox *)a; break; case GF_ISOM_BOX_TYPE_STSC: if (ptr->SampleToChunk) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->SampleToChunk = (GF_SampleToChunkBox *)a; break; case GF_ISOM_BOX_TYPE_PADB: if (ptr->PaddingBits) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->PaddingBits = (GF_PaddingBitsBox *) a; break; case GF_ISOM_BOX_TYPE_CO64: case GF_ISOM_BOX_TYPE_STCO: if (ptr->ChunkOffset) { gf_isom_box_del(ptr->ChunkOffset); } ptr->ChunkOffset = a; return GF_OK; case GF_ISOM_BOX_TYPE_STSH: if (ptr->ShadowSync) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->ShadowSync = (GF_ShadowSyncBox *)a; break; case GF_ISOM_BOX_TYPE_STDP: if (ptr->DegradationPriority) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->DegradationPriority = (GF_DegradationPriorityBox *)a; break; case GF_ISOM_BOX_TYPE_SDTP: if (ptr->SampleDep) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->SampleDep= (GF_SampleDependencyTypeBox *)a; break; case GF_ISOM_BOX_TYPE_STSF: if (ptr->Fragments) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->Fragments = (GF_SampleFragmentBox *)a; break; case GF_ISOM_BOX_TYPE_SUBS: if (!ptr->sub_samples) ptr->sub_samples = gf_list_new(); gf_list_add(ptr->sub_samples, a); { GF_SubSampleInformationBox *subs = (GF_SubSampleInformationBox *)a; GF_SubSampleInfoEntry *ent = gf_list_get(subs->Samples, 0); if (ent->sample_delta==0) { GF_LOG(GF_LOG_WARNING, GF_LOG_CONTAINER, (""[iso file] first entry in SubSample in track SampleTable has sample_delta of 0, should be one. Fixing\n"")); ent->sample_delta = 1; } } break; case GF_ISOM_BOX_TYPE_SBGP: if (!ptr->sampleGroups) ptr->sampleGroups = gf_list_new(); gf_list_add(ptr->sampleGroups, a); break; case GF_ISOM_BOX_TYPE_SGPD: if (!ptr->sampleGroupsDescription) ptr->sampleGroupsDescription = gf_list_new(); gf_list_add(ptr->sampleGroupsDescription, a); break; case GF_ISOM_BOX_TYPE_SAIZ: if (!ptr->sai_sizes) ptr->sai_sizes = gf_list_new(); gf_list_add(ptr->sai_sizes, a); break; case GF_ISOM_BOX_TYPE_SAIO: if (!ptr->sai_offsets) ptr->sai_offsets = gf_list_new(); gf_list_add(ptr->sai_offsets, a); break; default: return gf_isom_box_add_default((GF_Box *)ptr, a); } return GF_OK; } ",0 " Read(gfx::mojom::BufferUsageAndFormatDataView data, gfx::BufferUsageAndFormat* out) { return data.ReadUsage(&out->usage) && data.ReadFormat(&out->format); } ",0 "void DocumentLoader::DidInstallNewDocument(Document* document) { document->SetReadyState(Document::kLoading); if (content_security_policy_) { document->InitContentSecurityPolicy(content_security_policy_.Release()); } if (history_item_ && IsBackForwardLoadType(load_type_)) document->SetStateForNewFormElements(history_item_->GetDocumentState()); DCHECK(document->GetFrame()); document->GetFrame()->GetClientHintsPreferences().UpdateFrom( client_hints_preferences_); Settings* settings = document->GetSettings(); fetcher_->SetImagesEnabled(settings->GetImagesEnabled()); fetcher_->SetAutoLoadImages(settings->GetLoadsImagesAutomatically()); const AtomicString& dns_prefetch_control = response_.HttpHeaderField(HTTPNames::X_DNS_Prefetch_Control); if (!dns_prefetch_control.IsEmpty()) document->ParseDNSPrefetchControlHeader(dns_prefetch_control); String header_content_language = response_.HttpHeaderField(HTTPNames::Content_Language); if (!header_content_language.IsEmpty()) { size_t comma_index = header_content_language.find(','); header_content_language.Truncate(comma_index); header_content_language = header_content_language.StripWhiteSpace(IsHTMLSpace); if (!header_content_language.IsEmpty()) document->SetContentLanguage(AtomicString(header_content_language)); } String referrer_policy_header = response_.HttpHeaderField(HTTPNames::Referrer_Policy); if (!referrer_policy_header.IsNull()) { UseCounter::Count(*document, WebFeature::kReferrerPolicyHeader); document->ParseAndSetReferrerPolicy(referrer_policy_header); } if (response_.IsSignedExchangeInnerResponse()) UseCounter::Count(*document, WebFeature::kSignedExchangeInnerResponse); GetLocalFrameClient().DidCreateNewDocument(); } ",1 "static int bmpr_read_uncompressed(struct iwbmprcontext *rctx) { iw_byte *rowbuf = NULL; size_t bmp_bpr; int j; int retval = 0; if(rctx->has_alpha_channel) { rctx->img->imgtype = IW_IMGTYPE_RGBA; rctx->img->bit_depth = rctx->need_16bit ? 16 : 8; rctx->img->bpr = iw_calc_bytesperrow(rctx->width,4*rctx->img->bit_depth); } else { rctx->img->imgtype = IW_IMGTYPE_RGB; rctx->img->bit_depth = rctx->need_16bit ? 16 : 8; rctx->img->bpr = iw_calc_bytesperrow(rctx->width,3*rctx->img->bit_depth); } bmp_bpr = iwbmp_calc_bpr(rctx->bitcount,rctx->width); rctx->img->pixels = (iw_byte*)iw_malloc_large(rctx->ctx,rctx->img->bpr,rctx->img->height); if(!rctx->img->pixels) goto done; rowbuf = iw_malloc(rctx->ctx,bmp_bpr); for(j=0;jimg->height;j++) { if(!iwbmp_read(rctx,rowbuf,bmp_bpr)) { goto done; } switch(rctx->bitcount) { case 32: case 16: bmpr_convert_row_32_16(rctx,rowbuf,j); break; case 24: bmpr_convert_row_24(rctx,rowbuf,j); break; case 8: bmpr_convert_row_8(rctx,rowbuf,j); break; case 4: bmpr_convert_row_4(rctx,rowbuf,j); break; case 2: bmpr_convert_row_2(rctx,rowbuf,j); break; case 1: bmpr_convert_row_1(rctx,rowbuf,j); break; } } retval = 1; done: if(rowbuf) iw_free(rctx->ctx,rowbuf); return retval; } ",0 "void V8Console::markTimelineCallback(const v8::FunctionCallbackInfo& info) { ConsoleHelper(info).reportDeprecatedCall(""V8Console#markTimelineDeprecated"", ""'console.markTimeline' is deprecated. Please use 'console.timeStamp' instead.""); timeStampCallback(info); } ",0 "void Document::elementDataCacheClearTimerFired(Timer*) { m_elementDataCache.clear(); } ",0 "ssh_userauth2(const char *local_user, const char *server_user, char *host, Sensitive *sensitive) { struct ssh *ssh = active_state; Authctxt authctxt; int r; if (options.challenge_response_authentication) options.kbd_interactive_authentication = 1; if (options.preferred_authentications == NULL) options.preferred_authentications = authmethods_get(); /* setup authentication context */ memset(&authctxt, 0, sizeof(authctxt)); pubkey_prepare(&authctxt); authctxt.server_user = server_user; authctxt.local_user = local_user; authctxt.host = host; authctxt.service = ""ssh-connection""; /* service name */ authctxt.success = 0; authctxt.method = authmethod_lookup(""none""); authctxt.authlist = NULL; authctxt.methoddata = NULL; authctxt.sensitive = sensitive; authctxt.active_ktype = authctxt.oktypes = authctxt.ktypes = NULL; authctxt.info_req_seen = 0; authctxt.agent_fd = -1; if (authctxt.method == NULL) fatal(""ssh_userauth2: internal error: cannot send userauth none request""); if ((r = sshpkt_start(ssh, SSH2_MSG_SERVICE_REQUEST)) != 0 || (r = sshpkt_put_cstring(ssh, ""ssh-userauth"")) != 0 || (r = sshpkt_send(ssh)) != 0) fatal(""%s: %s"", __func__, ssh_err(r)); ssh_dispatch_init(ssh, &input_userauth_error); ssh_dispatch_set(ssh, SSH2_MSG_EXT_INFO, &input_userauth_ext_info); ssh_dispatch_set(ssh, SSH2_MSG_SERVICE_ACCEPT, &input_userauth_service_accept); ssh_dispatch_run(ssh, DISPATCH_BLOCK, &authctxt.success, &authctxt); /* loop until success */ pubkey_cleanup(&authctxt); ssh_dispatch_range(ssh, SSH2_MSG_USERAUTH_MIN, SSH2_MSG_USERAUTH_MAX, NULL); if (!authctxt.success) fatal(""Authentication failed.""); debug(""Authentication succeeded (%s)."", authctxt.method->name); } ",0 "SPL_METHOD(Array, unserialize) { spl_array_object *intern = (spl_array_object*)zend_object_store_get_object(getThis() TSRMLS_CC); char *buf; int buf_len; const unsigned char *p, *s; php_unserialize_data_t var_hash; zval *pmembers, *pflags = NULL; HashTable *aht; long flags; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, ""s"", &buf, &buf_len) == FAILURE) { return; } if (buf_len == 0) { return; } aht = spl_array_get_hash_table(intern, 0 TSRMLS_CC); if (aht->nApplyCount > 0) { zend_error(E_WARNING, ""Modification of ArrayObject during sorting is prohibited""); return; } /* storage */ s = p = (const unsigned char*)buf; PHP_VAR_UNSERIALIZE_INIT(var_hash); if (*p!= 'x' || *++p != ':') { goto outexcept; } ++p; ALLOC_INIT_ZVAL(pflags); if (!php_var_unserialize(&pflags, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pflags) != IS_LONG) { goto outexcept; } var_push_dtor(&var_hash, &pflags); --p; /* for ';' */ flags = Z_LVAL_P(pflags); /* flags needs to be verified and we also need to verify whether the next * thing we get is ';'. After that we require an 'm' or somethign else * where 'm' stands for members and anything else should be an array. If * neither 'a' or 'm' follows we have an error. */ if (*p != ';') { goto outexcept; } ++p; if (*p!='m') { if (*p!='a' && *p!='O' && *p!='C' && *p!='r') { goto outexcept; } intern->ar_flags &= ~SPL_ARRAY_CLONE_MASK; intern->ar_flags |= flags & SPL_ARRAY_CLONE_MASK; zval_ptr_dtor(&intern->array); ALLOC_INIT_ZVAL(intern->array); if (!php_var_unserialize(&intern->array, &p, s + buf_len, &var_hash TSRMLS_CC)) { goto outexcept; } var_push_dtor(&var_hash, &intern->array); } if (*p != ';') { goto outexcept; } ++p; /* members */ if (*p!= 'm' || *++p != ':') { goto outexcept; } ++p; ALLOC_INIT_ZVAL(pmembers); if (!php_var_unserialize(&pmembers, &p, s + buf_len, &var_hash TSRMLS_CC) || Z_TYPE_P(pmembers) != IS_ARRAY) { zval_ptr_dtor(&pmembers); goto outexcept; } var_push_dtor(&var_hash, &pmembers); /* copy members */ if (!intern->std.properties) { rebuild_object_properties(&intern->std); } zend_hash_copy(intern->std.properties, Z_ARRVAL_P(pmembers), (copy_ctor_func_t) zval_add_ref, (void *) NULL, sizeof(zval *)); zval_ptr_dtor(&pmembers); /* done reading $serialized */ PHP_VAR_UNSERIALIZE_DESTROY(var_hash); if (pflags) { zval_ptr_dtor(&pflags); } return; outexcept: PHP_VAR_UNSERIALIZE_DESTROY(var_hash); if (pflags) { zval_ptr_dtor(&pflags); } zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0 TSRMLS_CC, ""Error at offset %ld of %d bytes"", (long)((char*)p - buf), buf_len); return; } /* }}} */ /* {{{ arginfo and function table */ ",1 "static void arcmsr_remove(struct pci_dev *pdev) { struct Scsi_Host *host = pci_get_drvdata(pdev); struct AdapterControlBlock *acb = (struct AdapterControlBlock *) host->hostdata; int poll_count = 0; arcmsr_free_sysfs_attr(acb); scsi_remove_host(host); flush_work(&acb->arcmsr_do_message_isr_bh); del_timer_sync(&acb->eternal_timer); arcmsr_disable_outbound_ints(acb); arcmsr_stop_adapter_bgrb(acb); arcmsr_flush_adapter_cache(acb); acb->acb_flags |= ACB_F_SCSISTOPADAPTER; acb->acb_flags &= ~ACB_F_IOP_INITED; for (poll_count = 0; poll_count < ARCMSR_MAX_OUTSTANDING_CMD; poll_count++){ if (!atomic_read(&acb->ccboutstandingcount)) break; arcmsr_interrupt(acb);/* FIXME: need spinlock */ msleep(25); } if (atomic_read(&acb->ccboutstandingcount)) { int i; arcmsr_abort_allcmd(acb); arcmsr_done4abort_postqueue(acb); for (i = 0; i < ARCMSR_MAX_FREECCB_NUM; i++) { struct CommandControlBlock *ccb = acb->pccb_pool[i]; if (ccb->startdone == ARCMSR_CCB_START) { ccb->startdone = ARCMSR_CCB_ABORTED; ccb->pcmd->result = DID_ABORT << 16; arcmsr_ccb_complete(ccb); } } } arcmsr_free_irq(pdev, acb); arcmsr_free_ccb_pool(acb); arcmsr_free_mu(acb); arcmsr_unmap_pciregion(acb); pci_release_regions(pdev); scsi_host_put(host); pci_disable_device(pdev); } ",0 " ImageTransportClientTexture( WebKit::WebGraphicsContext3D* host_context, const gfx::Size& size, float device_scale_factor, uint64 surface_id) : ui::Texture(true, size, device_scale_factor), host_context_(host_context), texture_id_(surface_id) { } ",1 "static int jpc_dec_cp_setfromqcx(jpc_dec_cp_t *cp, jpc_dec_ccp_t *ccp, jpc_qcxcp_t *compparms, int flags) { int bandno; /* Eliminate compiler warnings about unused variables. */ cp = 0; if ((flags & JPC_QCC) || !(ccp->flags & JPC_QCC)) { ccp->flags |= flags | JPC_QSET; for (bandno = 0; bandno < compparms->numstepsizes; ++bandno) { ccp->stepsizes[bandno] = compparms->stepsizes[bandno]; } ccp->numstepsizes = compparms->numstepsizes; ccp->numguardbits = compparms->numguard; ccp->qsty = compparms->qntsty; } return 0; } ",0 "void RenderBlockFlow::layoutBlockChildren(bool relayoutChildren, SubtreeLayoutScope& layoutScope, LayoutUnit beforeEdge, LayoutUnit afterEdge) { dirtyForLayoutFromPercentageHeightDescendants(layoutScope); MarginInfo marginInfo(this, beforeEdge, afterEdge); RenderObject* childToExclude = layoutSpecialExcludedChild(relayoutChildren, layoutScope); LayoutUnit previousFloatLogicalBottom = 0; RenderBox* next = firstChildBox(); RenderBox* lastNormalFlowChild = 0; while (next) { RenderBox* child = next; next = child->nextSiblingBox(); child->setLayoutDidGetCalled(true); if (childToExclude == child) continue; // Skip this child, since it will be positioned by the specialized subclass (fieldsets and ruby runs). updateBlockChildDirtyBitsBeforeLayout(relayoutChildren, child); if (child->isOutOfFlowPositioned()) { child->containingBlock()->insertPositionedObject(child); adjustPositionedBlock(child, marginInfo); continue; } if (child->isFloating()) { insertFloatingObject(child); adjustFloatingBlock(marginInfo); continue; } layoutBlockChild(child, marginInfo, previousFloatLogicalBottom); lastNormalFlowChild = child; } handleAfterSideOfBlock(lastNormalFlowChild, beforeEdge, afterEdge, marginInfo); } ",0 "void hid_disconnect(struct hid_device *hdev) { device_remove_file(&hdev->dev, &dev_attr_country); if (hdev->claimed & HID_CLAIMED_INPUT) hidinput_disconnect(hdev); if (hdev->claimed & HID_CLAIMED_HIDDEV) hdev->hiddev_disconnect(hdev); if (hdev->claimed & HID_CLAIMED_HIDRAW) hidraw_disconnect(hdev); hdev->claimed = 0; } ",0 "static int vsock_auto_bind(struct vsock_sock *vsk) { struct sock *sk = sk_vsock(vsk); struct sockaddr_vm local_addr; if (vsock_addr_bound(&vsk->local_addr)) return 0; vsock_addr_init(&local_addr, VMADDR_CID_ANY, VMADDR_PORT_ANY); return __vsock_bind(sk, &local_addr); } ",0 "static int unsupported_set_interface_altsetting(int sub_api, struct libusb_device_handle *dev_handle, int iface, int altsetting) { PRINT_UNSUPPORTED_API(set_interface_altsetting); } ",0 "void FileSystemManagerImpl::RemoveOpListener(OperationListenerID listener_id) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(op_listeners_.find(listener_id) != op_listeners_.end()); op_listeners_.erase(listener_id); } ",0 "static av_cold int aac_parse_init(AVCodecParserContext *s1) { AACAC3ParseContext *s = s1->priv_data; s->header_size = AAC_ADTS_HEADER_SIZE; s->sync = aac_sync; return 0; } ",0 "int strdup_if_nonnull(char **target, char *source) { if (source) { *target = kstrdup(source, GFP_KERNEL); if (!*target) return -ENOMEM; } else *target = NULL; return 0; } ",1 "WORD32 ih264d_insert_st_node(dpb_manager_t *ps_dpb_mgr, struct pic_buffer_t *ps_pic_buf, UWORD8 u1_buf_id, UWORD32 u4_cur_pic_num) { WORD32 i; struct dpb_info_t *ps_dpb_info = ps_dpb_mgr->as_dpb_info; UWORD8 u1_picture_type = ps_pic_buf->u1_picturetype; /* Find an unused dpb location */ for(i = 0; i < MAX_REF_BUFS; i++) { if((ps_dpb_info[i].ps_pic_buf == ps_pic_buf) && ps_dpb_info[i].u1_used_as_ref) { /* Can occur only for field bottom pictures */ ps_dpb_info[i].s_bot_field.u1_reference_info = IS_SHORT_TERM; /*signal an error in the case of frame pic*/ if(ps_dpb_info[i].ps_pic_buf->u1_pic_type == FRM_PIC) { return ERROR_DBP_MANAGER_T; } else { return OK; } } if((ps_dpb_info[i].u1_used_as_ref == UNUSED_FOR_REF) && (ps_dpb_info[i].s_top_field.u1_reference_info == UNUSED_FOR_REF) && (ps_dpb_info[i].s_bot_field.u1_reference_info == UNUSED_FOR_REF)) break; } if(i == MAX_REF_BUFS) { UWORD32 i4_error_code; i4_error_code = ERROR_DBP_MANAGER_T; return i4_error_code; } /* Create dpb info */ ps_dpb_info[i].ps_pic_buf = ps_pic_buf; ps_dpb_info[i].ps_prev_short = ps_dpb_mgr->ps_dpb_st_head; ps_dpb_info[i].u1_buf_id = u1_buf_id; ps_dpb_info[i].u1_used_as_ref = TRUE; ps_dpb_info[i].u1_lt_idx = MAX_REF_BUFS + 1; ps_dpb_info[i].i4_frame_num = u4_cur_pic_num; ps_dpb_info[i].ps_pic_buf->i4_frame_num = u4_cur_pic_num; /* update the head node of linked list to point to the cur Pic */ ps_dpb_mgr->ps_dpb_st_head = ps_dpb_info + i; ps_dpb_mgr->u1_num_st_ref_bufs++; /* Identify the picture as a short term picture buffer */ ps_pic_buf->u1_is_short = IS_SHORT_TERM; if((u1_picture_type & 0x03) == FRM_PIC) { ps_dpb_info[i].u1_used_as_ref = IS_SHORT_TERM; ps_dpb_info[i].s_top_field.u1_reference_info = IS_SHORT_TERM; ps_dpb_info[i].s_bot_field.u1_reference_info = IS_SHORT_TERM; } if((u1_picture_type & 0x03) == TOP_FLD) ps_dpb_info[i].s_top_field.u1_reference_info = IS_SHORT_TERM; if((u1_picture_type & 0x03) == BOT_FLD) ps_dpb_info[i].s_bot_field.u1_reference_info = IS_SHORT_TERM; return OK; } ",0 "static Image *ReadPICTImage(const ImageInfo *image_info, ExceptionInfo *exception) { char geometry[MaxTextExtent], header_ole[4]; Image *image; IndexPacket index; int c, code; MagickBooleanType jpeg, status; PICTRectangle frame; PICTPixmap pixmap; register IndexPacket *indexes; register ssize_t x; register PixelPacket *q; register ssize_t i; size_t extent, length; ssize_t count, flags, j, version, y; StringInfo *profile; /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickSignature); if (image_info->debug != MagickFalse) (void) LogMagickEvent(TraceEvent,GetMagickModule(),""%s"", image_info->filename); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickSignature); image=AcquireImage(image_info); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read PICT header. */ pixmap.bits_per_pixel=0; pixmap.component_count=0; /* Skip header : 512 for standard PICT and 4, ie ""PICT"" for OLE2 */ header_ole[0]=ReadBlobByte(image); header_ole[1]=ReadBlobByte(image); header_ole[2]=ReadBlobByte(image); header_ole[3]=ReadBlobByte(image); if (!((header_ole[0] == 0x50) && (header_ole[1] == 0x49) && (header_ole[2] == 0x43) && (header_ole[3] == 0x54))) for (i=0; i < 508; i++) (void) ReadBlobByte(image); (void) ReadBlobMSBShort(image); /* skip picture size */ if (ReadRectangle(image,&frame) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); while ((c=ReadBlobByte(image)) == 0) ; if (c != 0x11) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); version=ReadBlobByte(image); if (version == 2) { c=ReadBlobByte(image); if (c != 0xff) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } else if (version != 1) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if ((frame.left < 0) || (frame.right < 0) || (frame.top < 0) || (frame.bottom < 0) || (frame.left >= frame.right) || (frame.top >= frame.bottom)) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); /* Create black canvas. */ flags=0; image->depth=8; image->columns=1UL*(frame.right-frame.left); image->rows=1UL*(frame.bottom-frame.top); image->x_resolution=DefaultResolution; image->y_resolution=DefaultResolution; image->units=UndefinedResolution; /* Interpret PICT opcodes. */ jpeg=MagickFalse; for (code=0; EOFBlob(image) == MagickFalse; ) { if ((image_info->ping != MagickFalse) && (image_info->number_scenes != 0)) if (image->scene >= (image_info->scene+image_info->number_scenes-1)) break; if ((version == 1) || ((TellBlob(image) % 2) != 0)) code=ReadBlobByte(image); if (version == 2) code=(int) ReadBlobMSBShort(image); if (code < 0) break; if (code > 0xa1) { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(),""%04X:"",code); } else { if (image->debug != MagickFalse) (void) LogMagickEvent(CoderEvent,GetMagickModule(), "" %04X %s: %s"",code,codes[code].name,codes[code].description); switch (code) { case 0x01: { /* Clipping rectangle. */ length=ReadBlobMSBShort(image); if (length != 0x000a) { for (i=0; i < (ssize_t) (length-2); i++) (void) ReadBlobByte(image); break; } if (ReadRectangle(image,&frame) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (((frame.left & 0x8000) != 0) || ((frame.top & 0x8000) != 0)) break; image->columns=1UL*(frame.right-frame.left); image->rows=1UL*(frame.bottom-frame.top); (void) SetImageBackgroundColor(image); break; } case 0x12: case 0x13: case 0x14: { ssize_t pattern; size_t height, width; /* Skip pattern definition. */ pattern=1L*ReadBlobMSBShort(image); for (i=0; i < 8; i++) (void) ReadBlobByte(image); if (pattern == 2) { for (i=0; i < 5; i++) (void) ReadBlobByte(image); break; } if (pattern != 1) ThrowReaderException(CorruptImageError,""UnknownPatternType""); length=ReadBlobMSBShort(image); if (ReadRectangle(image,&frame) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); ReadPixmap(pixmap); image->depth=1UL*pixmap.component_size; image->x_resolution=1.0*pixmap.horizontal_resolution; image->y_resolution=1.0*pixmap.vertical_resolution; image->units=PixelsPerInchResolution; (void) ReadBlobMSBLong(image); flags=1L*ReadBlobMSBShort(image); length=ReadBlobMSBShort(image); for (i=0; i <= (ssize_t) length; i++) (void) ReadBlobMSBLong(image); width=1UL*(frame.bottom-frame.top); height=1UL*(frame.right-frame.left); if (pixmap.bits_per_pixel <= 8) length&=0x7fff; if (pixmap.bits_per_pixel == 16) width<<=1; if (length == 0) length=width; if (length < 8) { for (i=0; i < (ssize_t) (length*height); i++) (void) ReadBlobByte(image); } else for (j=0; j < (int) height; j++) if (length > 200) for (j=0; j < (ssize_t) ReadBlobMSBShort(image); j++) (void) ReadBlobByte(image); else for (j=0; j < (ssize_t) ReadBlobByte(image); j++) (void) ReadBlobByte(image); break; } case 0x1b: { /* Initialize image background color. */ image->background_color.red=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); image->background_color.green=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); image->background_color.blue=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); break; } case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77: { /* Skip polygon or region. */ length=ReadBlobMSBShort(image); for (i=0; i < (ssize_t) (length-2); i++) (void) ReadBlobByte(image); break; } case 0x90: case 0x91: case 0x98: case 0x99: case 0x9a: case 0x9b: { ssize_t bytes_per_line; PICTRectangle source, destination; register unsigned char *p; size_t j; unsigned char *pixels; Image *tile_image; /* Pixmap clipped by a rectangle. */ bytes_per_line=0; if ((code != 0x9a) && (code != 0x9b)) bytes_per_line=1L*ReadBlobMSBShort(image); else { (void) ReadBlobMSBShort(image); (void) ReadBlobMSBShort(image); (void) ReadBlobMSBShort(image); } if (ReadRectangle(image,&frame) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); /* Initialize tile image. */ tile_image=CloneImage(image,1UL*(frame.right-frame.left), 1UL*(frame.bottom-frame.top),MagickTrue,exception); if (tile_image == (Image *) NULL) return((Image *) NULL); if ((code == 0x9a) || (code == 0x9b) || ((bytes_per_line & 0x8000) != 0)) { ReadPixmap(pixmap); tile_image->depth=1UL*pixmap.component_size; tile_image->matte=pixmap.component_count == 4 ? MagickTrue : MagickFalse; tile_image->x_resolution=(double) pixmap.horizontal_resolution; tile_image->y_resolution=(double) pixmap.vertical_resolution; tile_image->units=PixelsPerInchResolution; if (tile_image->matte != MagickFalse) image->matte=tile_image->matte; } if ((code != 0x9a) && (code != 0x9b)) { /* Initialize colormap. */ tile_image->colors=2; if ((bytes_per_line & 0x8000) != 0) { (void) ReadBlobMSBLong(image); flags=1L*ReadBlobMSBShort(image); tile_image->colors=1UL*ReadBlobMSBShort(image)+1; } status=AcquireImageColormap(tile_image,tile_image->colors); if (status == MagickFalse) { tile_image=DestroyImage(tile_image); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } if ((bytes_per_line & 0x8000) != 0) { for (i=0; i < (ssize_t) tile_image->colors; i++) { j=ReadBlobMSBShort(image) % tile_image->colors; if ((flags & 0x8000) != 0) j=(size_t) i; tile_image->colormap[j].red=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); tile_image->colormap[j].green=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); tile_image->colormap[j].blue=(Quantum) ScaleShortToQuantum(ReadBlobMSBShort(image)); } } else { for (i=0; i < (ssize_t) tile_image->colors; i++) { tile_image->colormap[i].red=(Quantum) (QuantumRange- tile_image->colormap[i].red); tile_image->colormap[i].green=(Quantum) (QuantumRange- tile_image->colormap[i].green); tile_image->colormap[i].blue=(Quantum) (QuantumRange- tile_image->colormap[i].blue); } } } if (ReadRectangle(image,&source) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); if (ReadRectangle(image,&destination) == MagickFalse) ThrowReaderException(CorruptImageError,""ImproperImageHeader""); (void) ReadBlobMSBShort(image); if ((code == 0x91) || (code == 0x99) || (code == 0x9b)) { /* Skip region. */ length=ReadBlobMSBShort(image); for (i=0; i < (ssize_t) (length-2); i++) (void) ReadBlobByte(image); } if ((code != 0x9a) && (code != 0x9b) && (bytes_per_line & 0x8000) == 0) pixels=DecodeImage(image,tile_image,1UL*bytes_per_line,1,&extent); else pixels=DecodeImage(image,tile_image,1UL*bytes_per_line,1U* pixmap.bits_per_pixel,&extent); if (pixels == (unsigned char *) NULL) { tile_image=DestroyImage(tile_image); ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); } /* Convert PICT tile image to pixel packets. */ p=pixels; for (y=0; y < (ssize_t) tile_image->rows; y++) { if (p > (pixels+extent+image->columns)) ThrowReaderException(CorruptImageError,""NotEnoughPixelData""); q=QueueAuthenticPixels(tile_image,0,y,tile_image->columns,1, exception); if (q == (PixelPacket *) NULL) break; indexes=GetAuthenticIndexQueue(tile_image); for (x=0; x < (ssize_t) tile_image->columns; x++) { if (tile_image->storage_class == PseudoClass) { index=ConstrainColormapIndex(tile_image,*p); SetPixelIndex(indexes+x,index); SetPixelRed(q, tile_image->colormap[(ssize_t) index].red); SetPixelGreen(q, tile_image->colormap[(ssize_t) index].green); SetPixelBlue(q, tile_image->colormap[(ssize_t) index].blue); } else { if (pixmap.bits_per_pixel == 16) { i=(*p++); j=(*p); SetPixelRed(q,ScaleCharToQuantum( (unsigned char) ((i & 0x7c) << 1))); SetPixelGreen(q,ScaleCharToQuantum( (unsigned char) (((i & 0x03) << 6) | ((j & 0xe0) >> 2)))); SetPixelBlue(q,ScaleCharToQuantum( (unsigned char) ((j & 0x1f) << 3))); } else if (tile_image->matte == MagickFalse) { if (p > (pixels+extent+2*image->columns)) ThrowReaderException(CorruptImageError, ""NotEnoughPixelData""); SetPixelRed(q,ScaleCharToQuantum(*p)); SetPixelGreen(q,ScaleCharToQuantum( *(p+tile_image->columns))); SetPixelBlue(q,ScaleCharToQuantum( *(p+2*tile_image->columns))); } else { if (p > (pixels+extent+3*image->columns)) ThrowReaderException(CorruptImageError, ""NotEnoughPixelData""); SetPixelAlpha(q,ScaleCharToQuantum(*p)); SetPixelRed(q,ScaleCharToQuantum( *(p+tile_image->columns))); SetPixelGreen(q,ScaleCharToQuantum( *(p+2*tile_image->columns))); SetPixelBlue(q,ScaleCharToQuantum( *(p+3*tile_image->columns))); } } p++; q++; } if (SyncAuthenticPixels(tile_image,exception) == MagickFalse) break; if ((tile_image->storage_class == DirectClass) && (pixmap.bits_per_pixel != 16)) { p+=(pixmap.component_count-1)*tile_image->columns; if (p < pixels) break; } status=SetImageProgress(image,LoadImageTag,y,tile_image->rows); if (status == MagickFalse) break; } pixels=(unsigned char *) RelinquishMagickMemory(pixels); if (jpeg == MagickFalse) if ((code == 0x9a) || (code == 0x9b) || ((bytes_per_line & 0x8000) != 0)) (void) CompositeImage(image,CopyCompositeOp,tile_image, destination.left,destination.top); tile_image=DestroyImage(tile_image); break; } case 0xa1: { unsigned char *info; size_t type; /* Comment. */ type=ReadBlobMSBShort(image); length=ReadBlobMSBShort(image); if (length == 0) break; (void) ReadBlobMSBLong(image); length-=4; if (length == 0) break; info=(unsigned char *) AcquireQuantumMemory(length,sizeof(*info)); if (info == (unsigned char *) NULL) break; count=ReadBlob(image,length,info); (void) count; switch (type) { case 0xe0: { if (length == 0) break; profile=BlobToStringInfo((const void *) NULL,length); SetStringInfoDatum(profile,info); status=SetImageProfile(image,""icc"",profile); profile=DestroyStringInfo(profile); if (status == MagickFalse) ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); break; } case 0x1f2: { if (length == 0) break; profile=BlobToStringInfo((const void *) NULL,length); SetStringInfoDatum(profile,info); status=SetImageProfile(image,""iptc"",profile); if (status == MagickFalse) ThrowReaderException(ResourceLimitError, ""MemoryAllocationFailed""); profile=DestroyStringInfo(profile); break; } default: break; } info=(unsigned char *) RelinquishMagickMemory(info); break; } default: { /* Skip to next op code. */ if (code < 0) break; if (codes[code].length == -1) (void) ReadBlobMSBShort(image); else for (i=0; i < (ssize_t) codes[code].length; i++) (void) ReadBlobByte(image); } } } if (code == 0xc00) { /* Skip header. */ for (i=0; i < 24; i++) (void) ReadBlobByte(image); continue; } if (((code >= 0xb0) && (code <= 0xcf)) || ((code >= 0x8000) && (code <= 0x80ff))) continue; if (code == 0x8200) { FILE *file; Image *tile_image; ImageInfo *read_info; int unique_file; /* Embedded JPEG. */ jpeg=MagickTrue; read_info=CloneImageInfo(image_info); SetImageInfoBlob(read_info,(void *) NULL,0); file=(FILE *) NULL; unique_file=AcquireUniqueFileResource(read_info->filename); if (unique_file != -1) file=fdopen(unique_file,""wb""); if ((unique_file == -1) || (file == (FILE *) NULL)) { if (file != (FILE *) NULL) (void) fclose(file); (void) RelinquishUniqueFileResource(read_info->filename); (void) CopyMagickString(image->filename,read_info->filename, MaxTextExtent); ThrowFileException(exception,FileOpenError, ""UnableToCreateTemporaryFile"",image->filename); image=DestroyImageList(image); return((Image *) NULL); } length=ReadBlobMSBLong(image); for (i=0; i < 6; i++) (void) ReadBlobMSBLong(image); if (ReadRectangle(image,&frame) == MagickFalse) { (void) fclose(file); (void) RelinquishUniqueFileResource(read_info->filename); ThrowReaderException(CorruptImageError,""ImproperImageHeader""); } for (i=0; i < 122; i++) (void) ReadBlobByte(image); for (i=0; i < (ssize_t) (length-154); i++) { c=ReadBlobByte(image); (void) fputc(c,file); } (void) fclose(file); (void) close(unique_file); tile_image=ReadImage(read_info,exception); (void) RelinquishUniqueFileResource(read_info->filename); read_info=DestroyImageInfo(read_info); if (tile_image == (Image *) NULL) continue; (void) FormatLocaleString(geometry,MaxTextExtent,""%.20gx%.20g"", (double) MagickMax(image->columns,tile_image->columns), (double) MagickMax(image->rows,tile_image->rows)); (void) SetImageExtent(image, MagickMax(image->columns,tile_image->columns), MagickMax(image->rows,tile_image->rows)); (void) TransformImageColorspace(image,tile_image->colorspace); (void) CompositeImage(image,CopyCompositeOp,tile_image,frame.left, frame.right); image->compression=tile_image->compression; tile_image=DestroyImage(tile_image); continue; } if ((code == 0xff) || (code == 0xffff)) break; if (((code >= 0xd0) && (code <= 0xfe)) || ((code >= 0x8100) && (code <= 0xffff))) { /* Skip reserved. */ length=ReadBlobMSBShort(image); for (i=0; i < (ssize_t) length; i++) (void) ReadBlobByte(image); continue; } if ((code >= 0x100) && (code <= 0x7fff)) { /* Skip reserved. */ length=(size_t) ((code >> 7) & 0xff); for (i=0; i < (ssize_t) length; i++) (void) ReadBlobByte(image); continue; } } (void) CloseBlob(image); return(GetFirstImageInList(image)); } ",1 "int FS_LoadStack( void ) { return fs_loadStack; } ",0 "static int is_valid_clean_head(struct hnae_ring *ring, int h) { int u = ring->next_to_use; int c = ring->next_to_clean; if (unlikely(h > ring->desc_num)) return 0; assert(u > 0 && u < ring->desc_num); assert(c > 0 && c < ring->desc_num); assert(u != c && h != c); /* must be checked before call this func */ return u > c ? (h > c && h <= u) : (h > c || h <= u); } ",0 "void WebGL2RenderingContextBase::framebufferTextureLayer(GLenum target, GLenum attachment, WebGLTexture* texture, GLint level, GLint layer) { if (isContextLost() || !ValidateFramebufferFuncParameters( ""framebufferTextureLayer"", target, attachment)) return; if (texture && !texture->Validate(ContextGroup(), this)) { SynthesizeGLError(GL_INVALID_VALUE, ""framebufferTextureLayer"", ""no texture or texture not from this context""); return; } GLenum textarget = texture ? texture->GetTarget() : 0; if (texture) { if (textarget != GL_TEXTURE_3D && textarget != GL_TEXTURE_2D_ARRAY) { SynthesizeGLError(GL_INVALID_OPERATION, ""framebufferTextureLayer"", ""invalid texture type""); return; } if (!ValidateTexFuncLayer(""framebufferTextureLayer"", textarget, layer)) return; if (!ValidateTexFuncLevel(""framebufferTextureLayer"", textarget, level)) return; } WebGLFramebuffer* framebuffer_binding = GetFramebufferBinding(target); if (!framebuffer_binding || !framebuffer_binding->Object()) { SynthesizeGLError(GL_INVALID_OPERATION, ""framebufferTextureLayer"", ""no framebuffer bound""); return; } framebuffer_binding->SetAttachmentForBoundFramebuffer( target, attachment, textarget, texture, level, layer); ApplyStencilTest(); } ",0 "add_compile_string(UChar* s, int mb_len, int str_len, regex_t* reg, int ignore_case) { int op; int r; int byte_len; UChar* p; UChar* end; op = select_str_opcode(mb_len, str_len, ignore_case); r = add_op(reg, op); if (r != 0) return r; byte_len = mb_len * str_len; end = s + byte_len; if (op == OP_EXACTMBN) { p = onigenc_strdup(reg->enc, s, end); CHECK_NULL_RETURN_MEMERR(p); COP(reg)->exact_len_n.len = mb_len; COP(reg)->exact_len_n.n = str_len; COP(reg)->exact_len_n.s = p; } else if (IS_NEED_STR_LEN_OP_EXACT(op)) { p = onigenc_strdup(reg->enc, s, end); CHECK_NULL_RETURN_MEMERR(p); if (op == OP_EXACTN_IC) COP(reg)->exact_n.n = byte_len; else COP(reg)->exact_n.n = str_len; COP(reg)->exact_n.s = p; } else { xmemcpy(COP(reg)->exact.s, s, (size_t )byte_len); COP(reg)->exact.s[byte_len] = '\0'; } return 0; } ",0 "int ossl_statem_server_construct_message(SSL *s) { OSSL_STATEM *st = &s->statem; switch (st->hand_state) { case DTLS_ST_SW_HELLO_VERIFY_REQUEST: return dtls_construct_hello_verify_request(s); case TLS_ST_SW_HELLO_REQ: return tls_construct_hello_request(s); case TLS_ST_SW_SRVR_HELLO: return tls_construct_server_hello(s); case TLS_ST_SW_CERT: return tls_construct_server_certificate(s); case TLS_ST_SW_KEY_EXCH: return tls_construct_server_key_exchange(s); case TLS_ST_SW_CERT_REQ: return tls_construct_certificate_request(s); case TLS_ST_SW_SRVR_DONE: return tls_construct_server_done(s); case TLS_ST_SW_SESSION_TICKET: return tls_construct_new_session_ticket(s); case TLS_ST_SW_CERT_STATUS: return tls_construct_cert_status(s); case TLS_ST_SW_CHANGE: if (SSL_IS_DTLS(s)) return dtls_construct_change_cipher_spec(s); else return tls_construct_change_cipher_spec(s); case TLS_ST_SW_FINISHED: return tls_construct_finished(s, s->method-> ssl3_enc->server_finished_label, s->method-> ssl3_enc->server_finished_label_len); default: /* Shouldn't happen */ break; } return 0; } ",0 "SMB2_set_info(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid, u64 volatile_fid, FILE_BASIC_INFO *buf) { unsigned int size; size = sizeof(FILE_BASIC_INFO); return send_set_info(xid, tcon, persistent_fid, volatile_fid, current->tgid, FILE_BASIC_INFORMATION, 1, (void **)&buf, &size); } ",0 "OMX_ERRORTYPE OMXNodeInstance::OnEmptyBufferDone( OMX_IN OMX_HANDLETYPE /* hComponent */, OMX_IN OMX_PTR pAppData, OMX_IN OMX_BUFFERHEADERTYPE* pBuffer) { OMXNodeInstance *instance = static_cast(pAppData); if (instance->mDying) { return OMX_ErrorNone; } return instance->owner()->OnEmptyBufferDone(instance->nodeID(), instance->findBufferID(pBuffer), pBuffer); } ",0 "void GranularityStrategyTest::SetupTextSpan(String str1, String str2, String str3, size_t sel_begin, size_t sel_end) { Text* text1 = GetDocument().createTextNode(str1); Text* text2 = GetDocument().createTextNode(str2); Text* text3 = GetDocument().createTextNode(str3); Element* span = HTMLSpanElement::Create(GetDocument()); Element* div = GetDocument().getElementById(""mytext""); div->AppendChild(text1); div->AppendChild(span); span->AppendChild(text2); div->AppendChild(text3); GetDocument().View()->UpdateAllLifecyclePhases(); Vector letter_pos; Vector word_middle_pos; TextNodeVector text_nodes; text_nodes.push_back(text1); text_nodes.push_back(text2); text_nodes.push_back(text3); ParseText(text_nodes); Position p1; Position p2; if (sel_begin < str1.length()) p1 = Position(text1, sel_begin); else if (sel_begin < str1.length() + str2.length()) p1 = Position(text2, sel_begin - str1.length()); else p1 = Position(text3, sel_begin - str1.length() - str2.length()); if (sel_end < str1.length()) p2 = Position(text1, sel_end); else if (sel_end < str1.length() + str2.length()) p2 = Position(text2, sel_end - str1.length()); else p2 = Position(text3, sel_end - str1.length() - str2.length()); Selection().SetSelection( SelectionInDOMTree::Builder().SetBaseAndExtent(p1, p2).Build()); } ",0 "int main(int argc, char **argv) { blkid_cache cache = NULL; char **devices = NULL; char *show[128] = { NULL, }; char *search_type = NULL, *search_value = NULL; char *read = NULL; int fltr_usage = 0; char **fltr_type = NULL; int fltr_flag = BLKID_FLTR_ONLYIN; unsigned int numdev = 0, numtag = 0; int version = 0; int err = BLKID_EXIT_OTHER; unsigned int i; int output_format = 0; int lookup = 0, gc = 0, lowprobe = 0, eval = 0; int c; uintmax_t offset = 0, size = 0; static const ul_excl_t excl[] = { /* rows and cols in in ASCII order */ { 'n','u' }, { 0 } }; int excl_st[ARRAY_SIZE(excl)] = UL_EXCL_STATUS_INIT; show[0] = NULL; atexit(close_stdout); while ((c = getopt (argc, argv, ""c:df:ghilL:n:ko:O:ps:S:t:u:U:w:Vv"")) != EOF) { err_exclusive_options(c, NULL, excl, excl_st); switch (c) { case 'c': if (optarg && !*optarg) read = NULL; else read = optarg; break; case 'd': raw_chars = 1; break; case 'L': eval++; search_value = xstrdup(optarg); search_type = xstrdup(""LABEL""); break; case 'n': fltr_type = list_to_types(optarg, &fltr_flag); break; case 'u': fltr_usage = list_to_usage(optarg, &fltr_flag); break; case 'U': eval++; search_value = xstrdup(optarg); search_type = xstrdup(""UUID""); break; case 'i': lowprobe |= LOWPROBE_TOPOLOGY; break; case 'l': lookup++; break; case 'g': gc = 1; break; case 'k': { size_t idx = 0; const char *name = NULL; while (blkid_superblocks_get_name(idx++, &name, NULL) == 0) printf(""%s\n"", name); exit(EXIT_SUCCESS); } case 'o': if (!strcmp(optarg, ""value"")) output_format = OUTPUT_VALUE_ONLY; else if (!strcmp(optarg, ""device"")) output_format = OUTPUT_DEVICE_ONLY; else if (!strcmp(optarg, ""list"")) output_format = OUTPUT_PRETTY_LIST; /* deprecated */ else if (!strcmp(optarg, ""udev"")) output_format = OUTPUT_UDEV_LIST; else if (!strcmp(optarg, ""export"")) output_format = OUTPUT_EXPORT_LIST; else if (!strcmp(optarg, ""full"")) output_format = 0; else { fprintf(stderr, ""Invalid output format %s. "" ""Choose from value,\n\t"" ""device, list, udev or full\n"", optarg); exit(BLKID_EXIT_OTHER); } break; case 'O': offset = strtosize_or_err(optarg, ""invalid offset argument""); break; case 'p': lowprobe |= LOWPROBE_SUPERBLOCKS; break; case 's': if (numtag + 1 >= sizeof(show) / sizeof(*show)) { fprintf(stderr, ""Too many tags specified\n""); usage(err); } show[numtag++] = optarg; show[numtag] = NULL; break; case 'S': size = strtosize_or_err(optarg, ""invalid size argument""); break; case 't': if (search_type) { fprintf(stderr, ""Can only search for "" ""one NAME=value pair\n""); usage(err); } if (blkid_parse_tag_string(optarg, &search_type, &search_value)) { fprintf(stderr, ""-t needs NAME=value pair\n""); usage(err); } break; case 'V': case 'v': version = 1; break; case 'w': /* ignore - backward compatibility */ break; case 'h': err = 0; /* fallthrough */ default: usage(err); } } /* The rest of the args are device names */ if (optind < argc) { devices = xcalloc(argc - optind, sizeof(char *)); while (optind < argc) devices[numdev++] = argv[optind++]; } if (version) { print_version(stdout); goto exit; } /* convert LABEL/UUID lookup to evaluate request */ if (lookup && output_format == OUTPUT_DEVICE_ONLY && search_type && (!strcmp(search_type, ""LABEL"") || !strcmp(search_type, ""UUID""))) { eval++; lookup = 0; } if (!lowprobe && !eval && blkid_get_cache(&cache, read) < 0) goto exit; if (gc) { blkid_gc_cache(cache); err = 0; goto exit; } err = BLKID_EXIT_NOTFOUND; if (eval == 0 && (output_format & OUTPUT_PRETTY_LIST)) { if (lowprobe) { fprintf(stderr, ""The low-level probing mode does not "" ""support 'list' output format\n""); exit(BLKID_EXIT_OTHER); } pretty_print_dev(NULL); } if (lowprobe) { /* * Low-level API */ blkid_probe pr; if (!numdev) { fprintf(stderr, ""The low-level probing mode "" ""requires a device\n""); exit(BLKID_EXIT_OTHER); } /* automatically enable 'export' format for I/O Limits */ if (!output_format && (lowprobe & LOWPROBE_TOPOLOGY)) output_format = OUTPUT_EXPORT_LIST; pr = blkid_new_probe(); if (!pr) goto exit; if (lowprobe & LOWPROBE_SUPERBLOCKS) { blkid_probe_set_superblocks_flags(pr, BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | BLKID_SUBLKS_TYPE | BLKID_SUBLKS_SECTYPE | BLKID_SUBLKS_USAGE | BLKID_SUBLKS_VERSION); if (fltr_usage && blkid_probe_filter_superblocks_usage( pr, fltr_flag, fltr_usage)) goto exit; else if (fltr_type && blkid_probe_filter_superblocks_type( pr, fltr_flag, fltr_type)) goto exit; } for (i = 0; i < numdev; i++) { err = lowprobe_device(pr, devices[i], lowprobe, show, output_format, (blkid_loff_t) offset, (blkid_loff_t) size); if (err) break; } blkid_free_probe(pr); } else if (eval) { /* * Evaluate API */ char *res = blkid_evaluate_tag(search_type, search_value, NULL); if (res) { err = 0; printf(""%s\n"", res); } } else if (lookup) { /* * Classic (cache based) API */ blkid_dev dev; if (!search_type) { fprintf(stderr, ""The lookup option requires a "" ""search type specified using -t\n""); exit(BLKID_EXIT_OTHER); } /* Load any additional devices not in the cache */ for (i = 0; i < numdev; i++) blkid_get_dev(cache, devices[i], BLKID_DEV_NORMAL); if ((dev = blkid_find_dev_with_tag(cache, search_type, search_value))) { print_tags(dev, show, output_format); err = 0; } /* If we didn't specify a single device, show all available devices */ } else if (!numdev) { blkid_dev_iterate iter; blkid_dev dev; blkid_probe_all(cache); iter = blkid_dev_iterate_begin(cache); blkid_dev_set_search(iter, search_type, search_value); while (blkid_dev_next(iter, &dev) == 0) { dev = blkid_verify(cache, dev); if (!dev) continue; print_tags(dev, show, output_format); err = 0; } blkid_dev_iterate_end(iter); /* Add all specified devices to cache (optionally display tags) */ } else for (i = 0; i < numdev; i++) { blkid_dev dev = blkid_get_dev(cache, devices[i], BLKID_DEV_NORMAL); if (dev) { if (search_type && !blkid_dev_has_tag(dev, search_type, search_value)) continue; print_tags(dev, show, output_format); err = 0; } } exit: free(search_type); free(search_value); free_types_list(fltr_type); if (!lowprobe && !eval) blkid_put_cache(cache); free(devices); return err; } ",0 "void RenderThread::WidgetHidden() { DCHECK(hidden_widget_count_ < widget_count_); hidden_widget_count_++ ; if (widget_count_ && hidden_widget_count_ == widget_count_) { idle_notification_delay_in_s_ = kInitialIdleHandlerDelayS; MessageLoop::current()->PostDelayedTask(FROM_HERE, task_factory_->NewRunnableMethod(&RenderThread::IdleHandler), static_cast(floor(idle_notification_delay_in_s_)) * 1000); } } ",0 "static int close_collection(struct hid_parser *parser) { if (!parser->collection_stack_ptr) { hid_err(parser->device, ""collection stack underflow\n""); return -EINVAL; } parser->collection_stack_ptr--; return 0; } ",0 "parse_rockridge(struct archive_read *a, struct file_info *file, const unsigned char *p, const unsigned char *end) { struct iso9660 *iso9660; iso9660 = (struct iso9660 *)(a->format->data); while (p + 4 <= end /* Enough space for another entry. */ && p[0] >= 'A' && p[0] <= 'Z' /* Sanity-check 1st char of name. */ && p[1] >= 'A' && p[1] <= 'Z' /* Sanity-check 2nd char of name. */ && p[2] >= 4 /* Sanity-check length. */ && p + p[2] <= end) { /* Sanity-check length. */ const unsigned char *data = p + 4; int data_length = p[2] - 4; int version = p[3]; switch(p[0]) { case 'C': if (p[1] == 'E') { if (version == 1 && data_length == 24) { /* * CE extension comprises: * 8 byte sector containing extension * 8 byte offset w/in above sector * 8 byte length of continuation */ int32_t location = archive_le32dec(data); file->ce_offset = archive_le32dec(data+8); file->ce_size = archive_le32dec(data+16); if (register_CE(a, location, file) != ARCHIVE_OK) return (ARCHIVE_FATAL); } } else if (p[1] == 'L') { if (version == 1 && data_length == 8) { file->cl_offset = (uint64_t) iso9660->logical_block_size * (uint64_t)archive_le32dec(data); iso9660->seenRockridge = 1; } } break; case 'N': if (p[1] == 'M') { if (version == 1) { parse_rockridge_NM1(file, data, data_length); iso9660->seenRockridge = 1; } } break; case 'P': /* * PD extension is padding; * contents are always ignored. * * PL extension won't appear; * contents are always ignored. */ if (p[1] == 'N') { if (version == 1 && data_length == 16) { file->rdev = toi(data,4); file->rdev <<= 32; file->rdev |= toi(data + 8, 4); iso9660->seenRockridge = 1; } } else if (p[1] == 'X') { /* * PX extension comprises: * 8 bytes for mode, * 8 bytes for nlinks, * 8 bytes for uid, * 8 bytes for gid, * 8 bytes for inode. */ if (version == 1) { if (data_length >= 8) file->mode = toi(data, 4); if (data_length >= 16) file->nlinks = toi(data + 8, 4); if (data_length >= 24) file->uid = toi(data + 16, 4); if (data_length >= 32) file->gid = toi(data + 24, 4); if (data_length >= 40) file->number = toi(data + 32, 4); iso9660->seenRockridge = 1; } } break; case 'R': if (p[1] == 'E' && version == 1) { file->re = 1; iso9660->seenRockridge = 1; } else if (p[1] == 'R' && version == 1) { /* * RR extension comprises: * one byte flag value * This extension is obsolete, * so contents are always ignored. */ } break; case 'S': if (p[1] == 'L') { if (version == 1) { parse_rockridge_SL1(file, data, data_length); iso9660->seenRockridge = 1; } } else if (p[1] == 'T' && data_length == 0 && version == 1) { /* * ST extension marks end of this * block of SUSP entries. * * It allows SUSP to coexist with * non-SUSP uses of the System * Use Area by placing non-SUSP data * after SUSP data. */ iso9660->seenSUSP = 0; iso9660->seenRockridge = 0; return (ARCHIVE_OK); } break; case 'T': if (p[1] == 'F') { if (version == 1) { parse_rockridge_TF1(file, data, data_length); iso9660->seenRockridge = 1; } } break; case 'Z': if (p[1] == 'F') { if (version == 1) parse_rockridge_ZF1(file, data, data_length); } break; default: break; } p += p[2]; } return (ARCHIVE_OK); } ",0 "void hci_send_to_control(struct sk_buff *skb, struct sock *skip_sk) { struct sock *sk; struct hlist_node *node; BT_DBG(""len %d"", skb->len); read_lock(&hci_sk_list.lock); sk_for_each(sk, node, &hci_sk_list.head) { struct sk_buff *nskb; /* Skip the original socket */ if (sk == skip_sk) continue; if (sk->sk_state != BT_BOUND) continue; if (hci_pi(sk)->channel != HCI_CHANNEL_CONTROL) continue; nskb = skb_clone(skb, GFP_ATOMIC); if (!nskb) continue; if (sock_queue_rcv_skb(sk, nskb)) kfree_skb(nskb); } read_unlock(&hci_sk_list.lock); } ",0 "void V8Console::copyCallback(const v8::FunctionCallbackInfo& info) { inspectImpl(info, true); } ",0 "mainloop_del_ipc_client(mainloop_io_t *client) { mainloop_del_fd(client); } ",0 "uint32_t pcnet_ioport_readl(void *opaque, uint32_t addr) { PCNetState *s = opaque; uint32_t val = -1; pcnet_poll_timer(s); if (BCR_DWIO(s)) { switch (addr & 0x0f) { case 0x00: /* RDP */ val = pcnet_csr_readw(s, s->rap); break; case 0x04: val = s->rap; break; case 0x08: pcnet_s_reset(s); val = 0; break; case 0x0c: val = pcnet_bcr_readw(s, s->rap); break; } } pcnet_update_irq(s); #ifdef PCNET_DEBUG_IO printf(""pcnet_ioport_readl addr=0x%08x val=0x%08x\n"", addr, val); #endif return val; } ",0 "cmsBool Type_vcgt_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems) { cmsToneCurve** Curves = (cmsToneCurve**) Ptr; cmsUInt32Number i, j; if (cmsGetToneCurveParametricType(Curves[0]) == 5 && cmsGetToneCurveParametricType(Curves[1]) == 5 && cmsGetToneCurveParametricType(Curves[2]) == 5) { if (!_cmsWriteUInt32Number(io, cmsVideoCardGammaFormulaType)) return FALSE; for (i=0; i < 3; i++) { _cmsVCGTGAMMA v; v.Gamma = Curves[i] ->Segments[0].Params[0]; v.Min = Curves[i] ->Segments[0].Params[5]; v.Max = pow(Curves[i] ->Segments[0].Params[1], v.Gamma) + v.Min; if (!_cmsWrite15Fixed16Number(io, v.Gamma)) return FALSE; if (!_cmsWrite15Fixed16Number(io, v.Min)) return FALSE; if (!_cmsWrite15Fixed16Number(io, v.Max)) return FALSE; } } else { if (!_cmsWriteUInt32Number(io, cmsVideoCardGammaTableType)) return FALSE; if (!_cmsWriteUInt16Number(io, 3)) return FALSE; if (!_cmsWriteUInt16Number(io, 256)) return FALSE; if (!_cmsWriteUInt16Number(io, 2)) return FALSE; for (i=0; i < 3; i++) { for (j=0; j < 256; j++) { cmsFloat32Number v = cmsEvalToneCurveFloat(Curves[i], (cmsFloat32Number) (j / 255.0)); cmsUInt16Number n = _cmsQuickSaturateWord(v * 65535.0); if (!_cmsWriteUInt16Number(io, n)) return FALSE; } } } return TRUE; cmsUNUSED_PARAMETER(self); cmsUNUSED_PARAMETER(nItems); } ",0 "static void watchdog_interrupt_count(void) { __this_cpu_inc(hrtimer_interrupts); } ",0 "static void encode_nops(struct compound_hdr *hdr) { BUG_ON(hdr->nops > NFS4_MAX_OPS); *hdr->nops_p = htonl(hdr->nops); } ",0 "bool SessionService::IsOnlyOneTabLeft() { if (!profile()) { return false; } int window_count = 0; for (BrowserList::const_iterator i = BrowserList::begin(); i != BrowserList::end(); ++i) { const SessionID::id_type window_id = (*i)->session_id().id(); if (should_track_changes_for_browser_type((*i)->type()) && (*i)->profile() == profile() && window_closing_ids_.find(window_id) == window_closing_ids_.end()) { if (++window_count > 1) return false; if ((*i)->tab_count() > 0) return false; } } return true; } ",0 "static void ctimeFunc( sqlite3_context *context, int NotUsed, sqlite3_value **NotUsed2 ){ UNUSED_PARAMETER2(NotUsed, NotUsed2); timeFunc(context, 0, 0); } ",0 "void GLES2DecoderImpl::DoVertexAttrib1fv(GLuint index, const GLfloat* v) { VertexAttribManager::VertexAttribInfo* info = vertex_attrib_manager_.GetVertexAttribInfo(index); if (!info) { SetGLError(GL_INVALID_VALUE, ""glVertexAttrib1fv: index out of range""); return; } VertexAttribManager::VertexAttribInfo::Vec4 value; value.v[0] = v[0]; value.v[1] = 0.0f; value.v[2] = 0.0f; value.v[3] = 1.0f; info->set_value(value); glVertexAttrib1fv(index, v); } ",0 "void btrfs_destroy_inode(struct inode *inode) { struct btrfs_ordered_extent *ordered; struct btrfs_root *root = BTRFS_I(inode)->root; WARN_ON(!hlist_empty(&inode->i_dentry)); WARN_ON(inode->i_data.nrpages); WARN_ON(BTRFS_I(inode)->outstanding_extents); WARN_ON(BTRFS_I(inode)->reserved_extents); WARN_ON(BTRFS_I(inode)->delalloc_bytes); WARN_ON(BTRFS_I(inode)->csum_bytes); /* * This can happen where we create an inode, but somebody else also * created the same inode and we need to destroy the one we already * created. */ if (!root) goto free; /* * Make sure we're properly removed from the ordered operation * lists. */ smp_mb(); if (!list_empty(&BTRFS_I(inode)->ordered_operations)) { spin_lock(&root->fs_info->ordered_extent_lock); list_del_init(&BTRFS_I(inode)->ordered_operations); spin_unlock(&root->fs_info->ordered_extent_lock); } if (test_bit(BTRFS_INODE_HAS_ORPHAN_ITEM, &BTRFS_I(inode)->runtime_flags)) { printk(KERN_INFO ""BTRFS: inode %llu still on the orphan list\n"", (unsigned long long)btrfs_ino(inode)); atomic_dec(&root->orphan_inodes); } while (1) { ordered = btrfs_lookup_first_ordered_extent(inode, (u64)-1); if (!ordered) break; else { printk(KERN_ERR ""btrfs found ordered "" ""extent %llu %llu on inode cleanup\n"", (unsigned long long)ordered->file_offset, (unsigned long long)ordered->len); btrfs_remove_ordered_extent(inode, ordered); btrfs_put_ordered_extent(ordered); btrfs_put_ordered_extent(ordered); } } inode_tree_del(inode); btrfs_drop_extent_cache(inode, 0, (u64)-1, 0); free: btrfs_remove_delayed_node(inode); call_rcu(&inode->i_rcu, btrfs_i_callback); } ",0 "ModuleExport size_t RegisterTXTImage(void) { MagickInfo *entry; entry=AcquireMagickInfo(""TXT"",""SPARSE-COLOR"",""Sparse Color""); entry->encoder=(EncodeImageHandler *) WriteTXTImage; entry->flags|=CoderRawSupportFlag; entry->flags|=CoderEndianSupportFlag; (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo(""TXT"",""TEXT"",""Text""); entry->decoder=(DecodeImageHandler *) ReadTEXTImage; entry->format_type=ImplicitFormatType; entry->flags|=CoderRawSupportFlag; entry->flags|=CoderEndianSupportFlag; (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo(""TXT"",""TXT"",""Text""); entry->decoder=(DecodeImageHandler *) ReadTXTImage; entry->encoder=(EncodeImageHandler *) WriteTXTImage; entry->magick=(IsImageFormatHandler *) IsTXT; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); } ",0 "void PasswordInputType::RestoreFormControlState(const FormControlState&) { NOTREACHED(); } ",0 "gss_context_time (minor_status, context_handle, time_rec) OM_uint32 * minor_status; gss_ctx_id_t context_handle; OM_uint32 * time_rec; { OM_uint32 status; gss_union_ctx_id_t ctx; gss_mechanism mech; if (minor_status == NULL) return (GSS_S_CALL_INACCESSIBLE_WRITE); *minor_status = 0; if (time_rec == NULL) return (GSS_S_CALL_INACCESSIBLE_WRITE); if (context_handle == GSS_C_NO_CONTEXT) return (GSS_S_CALL_INACCESSIBLE_READ | GSS_S_NO_CONTEXT); /* * select the approprate underlying mechanism routine and * call it. */ ctx = (gss_union_ctx_id_t) context_handle; mech = gssint_get_mechanism (ctx->mech_type); if (mech) { if (mech->gss_context_time) { status = mech->gss_context_time( minor_status, ctx->internal_ctx_id, time_rec); if (status != GSS_S_COMPLETE) map_error(minor_status, mech); } else status = GSS_S_UNAVAILABLE; return(status); } return (GSS_S_BAD_MECH); } ",1 "static inline void posix_cpu_timers_init(struct task_struct *tsk) { } ",0 "char* MACH0_(get_cputype)(struct MACH0_(obj_t)* bin) { if (bin) { return MACH0_(get_cputype_from_hdr) (&bin->hdr); } return strdup (""unknown""); } ",0 "void RenderBox::setMarginAfter(LayoutUnit margin) { switch (style()->writingMode()) { case TopToBottomWritingMode: m_marginBottom = margin; break; case BottomToTopWritingMode: m_marginTop = margin; break; case LeftToRightWritingMode: m_marginRight = margin; break; case RightToLeftWritingMode: m_marginLeft = margin; break; } } ",0 "static void get_lock_access(struct nfs4_ol_stateid *lock_stp, u32 access) { struct nfs4_file *fp = lock_stp->st_stid.sc_file; lockdep_assert_held(&fp->fi_lock); if (test_access(access, lock_stp)) return; __nfs4_file_get_access(fp, access); set_access(access, lock_stp); } ",0 "void GLES2DecoderPassthroughImpl::SetIgnoreCachedStateForTest(bool ignore) {} ",0 "HTMLIFrameElement::ConstructContainerPolicy(Vector* messages, bool* old_syntax) const { scoped_refptr src_origin = GetOriginForFeaturePolicy(); scoped_refptr self_origin = GetDocument().GetSecurityOrigin(); Vector container_policy = ParseFeaturePolicyAttribute(allow_, self_origin, src_origin, messages, old_syntax); if (AllowFullscreen()) { bool has_fullscreen_policy = false; for (const auto& declaration : container_policy) { if (declaration.feature == WebFeaturePolicyFeature::kFullscreen) { has_fullscreen_policy = true; if (messages) { messages->push_back( ""allow attribute is overriding 'allowfullscreen'.""); } break; } } if (!has_fullscreen_policy) { WebParsedFeaturePolicyDeclaration whitelist; whitelist.feature = WebFeaturePolicyFeature::kFullscreen; whitelist.matches_all_origins = true; whitelist.origins = Vector(0UL); container_policy.push_back(whitelist); } } if (AllowPaymentRequest()) { bool has_payment_policy = false; for (const auto& declaration : container_policy) { if (declaration.feature == WebFeaturePolicyFeature::kPayment) { has_payment_policy = true; if (messages) { messages->push_back( ""allow attribute is overriding 'allowpaymentrequest'.""); } break; } } if (!has_payment_policy) { WebParsedFeaturePolicyDeclaration whitelist; whitelist.feature = WebFeaturePolicyFeature::kPayment; whitelist.matches_all_origins = true; whitelist.origins = Vector(0UL); container_policy.push_back(whitelist); } } return container_policy; } ",0 "static void xhci_reset(DeviceState *dev) { XHCIState *xhci = XHCI(dev); int i; trace_usb_xhci_reset(); if (!(xhci->usbsts & USBSTS_HCH)) { DPRINTF(""xhci: reset while running!\n""); } xhci->usbcmd = 0; xhci->usbsts = USBSTS_HCH; xhci->dnctrl = 0; xhci->crcr_low = 0; xhci->crcr_high = 0; xhci->dcbaap_low = 0; xhci->dcbaap_high = 0; xhci->config = 0; for (i = 0; i < xhci->numslots; i++) { xhci_disable_slot(xhci, i+1); } for (i = 0; i < xhci->numports; i++) { xhci_port_update(xhci->ports + i, 0); } for (i = 0; i < xhci->numintrs; i++) { xhci->intr[i].iman = 0; xhci->intr[i].imod = 0; xhci->intr[i].erstsz = 0; xhci->intr[i].erstba_low = 0; xhci->intr[i].erstba_high = 0; xhci->intr[i].erdp_low = 0; xhci->intr[i].erdp_high = 0; xhci->intr[i].msix_used = 0; xhci->intr[i].er_ep_idx = 0; xhci->intr[i].er_pcs = 1; xhci->intr[i].er_full = 0; xhci->intr[i].ev_buffer_put = 0; xhci->intr[i].ev_buffer_get = 0; } xhci->mfindex_start = qemu_clock_get_ns(QEMU_CLOCK_VIRTUAL); xhci_mfwrap_update(xhci); } ",0 "int kvm_task_switch(struct kvm_vcpu *vcpu, u16 tss_selector, int reason, bool has_error_code, u32 error_code) { struct x86_emulate_ctxt *ctxt = &vcpu->arch.emulate_ctxt; int ret; init_emulate_ctxt(vcpu); ret = emulator_task_switch(ctxt, tss_selector, reason, has_error_code, error_code); if (ret) return EMULATE_FAIL; memcpy(vcpu->arch.regs, ctxt->regs, sizeof ctxt->regs); kvm_rip_write(vcpu, ctxt->eip); kvm_set_rflags(vcpu, ctxt->eflags); kvm_make_request(KVM_REQ_EVENT, vcpu); return EMULATE_DONE; } ",0 "void DraggedTabGtk::Resize(int width) { attached_tab_size_.set_width(width); ResizeContainer(); } ",0 "error::Error GLES2DecoderImpl::HandleDrawArraysInstancedANGLE( uint32 immediate_data_size, const void* cmd_data) { const gles2::cmds::DrawArraysInstancedANGLE& c = *static_cast(cmd_data); if (!features().angle_instanced_arrays) { LOCAL_SET_GL_ERROR( GL_INVALID_OPERATION, ""glDrawArraysInstancedANGLE"", ""function not available""); return error::kNoError; } return DoDrawArrays(""glDrawArraysIntancedANGLE"", true, static_cast(c.mode), static_cast(c.first), static_cast(c.count), static_cast(c.primcount)); } ",0 "void *Type_XYZ_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag) { cmsCIEXYZ* xyz; *nItems = 0; xyz = (cmsCIEXYZ*) _cmsMallocZero(self ->ContextID, sizeof(cmsCIEXYZ)); if (xyz == NULL) return NULL; if (!_cmsReadXYZNumber(io, xyz)) { _cmsFree(self ->ContextID, xyz); return NULL; } *nItems = 1; return (void*) xyz; cmsUNUSED_PARAMETER(SizeOfTag); } ",0 "void task_oncpu_function_call(struct task_struct *p, void (*func) (void *info), void *info) { int cpu; preempt_disable(); cpu = task_cpu(p); if (task_curr(p)) smp_call_function_single(cpu, func, info, 1); preempt_enable(); } ",0 "void nw_buf_pool_release(nw_buf_pool *pool) { for (uint32_t i = 0; i < pool->free; ++i) { free(pool->free_arr[i]); } free(pool->free_arr); free(pool); } ",0 "ftrace_snapshot_print(struct seq_file *m, unsigned long ip, struct ftrace_probe_ops *ops, void *data) { struct ftrace_func_mapper *mapper = data; long *count = NULL; seq_printf(m, ""%ps:"", (void *)ip); seq_puts(m, ""snapshot""); if (mapper) count = (long *)ftrace_func_mapper_find_ip(mapper, ip); if (count) seq_printf(m, "":count=%ld\n"", *count); else seq_puts(m, "":unlimited\n""); return 0; } ",0 " WebPluginResourceClient* WebPluginDelegateImpl::CreateResourceClient( unsigned long resource_id, const GURL& url, bool notify_needed, intptr_t notify_data, intptr_t existing_stream) { if (existing_stream) { NPAPI::PluginStream* plugin_stream = reinterpret_cast(existing_stream); return plugin_stream->AsResourceClient(); } std::string mime_type; NPAPI::PluginStreamUrl *stream = instance()->CreateStream( resource_id, url, mime_type, notify_needed, reinterpret_cast(notify_data)); return stream; } ",1 "void RenderWidgetHostViewAura::SetTooltipText(const string16& tooltip_text) { tooltip_ = tooltip_text; aura::RootWindow* root_window = window_->GetRootWindow(); if (aura::client::GetTooltipClient(root_window)) aura::client::GetTooltipClient(root_window)->UpdateTooltip(window_); } ",0 " ~FileBrowserPrivateGetDriveFilesFunction() { } ",0 "WORD32 ih264d_cavlc_parse4x4coeff_n8(WORD16 *pi2_coeff_block, UWORD32 u4_isdc, /* is it a DC block */ WORD32 u4_n, dec_struct_t *ps_dec, UWORD32 *pu4_total_coeff) { dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm; UWORD32 *pu4_bitstrm_buf = ps_bitstrm->pu4_buffer; UWORD32 u4_bitstream_offset = ps_bitstrm->u4_ofst; UWORD32 u4_code; UNUSED(u4_n); UNUSED(pi2_coeff_block); GETBITS(u4_code, u4_bitstream_offset, pu4_bitstrm_buf, 6); ps_bitstrm->u4_ofst = u4_bitstream_offset; *pu4_total_coeff = 0; if(u4_code != 3) { UWORD8 *pu1_offset = (UWORD8 *)gau1_ih264d_total_coeff_fn_ptr_offset; UWORD32 u4_trailing_ones, u4_offset, u4_total_coeff_tone; *pu4_total_coeff = (u4_code >> 2) + 1; u4_trailing_ones = u4_code & 0x03; u4_offset = pu1_offset[*pu4_total_coeff - 1]; u4_total_coeff_tone = (*pu4_total_coeff << 16) | u4_trailing_ones; ps_dec->pf_cavlc_4x4res_block[u4_offset](u4_isdc, u4_total_coeff_tone, ps_bitstrm); } return OK; } ",0