unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
96,624
0
static Image *RenderHoughLines(const ImageInfo *image_info,const size_t columns, const size_t rows,ExceptionInfo *exception) { #define BoundingBox "viewbox" DrawInfo *draw_info; Image *image; MagickBooleanType status; /* Open image. */ image=AcquireImage(image_info,exception); status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } image->columns=columns; image->rows=rows; draw_info=CloneDrawInfo(image_info,(DrawInfo *) NULL); draw_info->affine.sx=image->resolution.x == 0.0 ? 1.0 : image->resolution.x/ DefaultResolution; draw_info->affine.sy=image->resolution.y == 0.0 ? 1.0 : image->resolution.y/ DefaultResolution; image->columns=(size_t) (draw_info->affine.sx*image->columns); image->rows=(size_t) (draw_info->affine.sy*image->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); } /* Render drawing. */ if (GetBlobStreamData(image) == (unsigned char *) NULL) draw_info->primitive=FileToString(image->filename,~0UL,exception); else { draw_info->primitive=(char *) AcquireMagickMemory((size_t) GetBlobSize(image)+1); if (draw_info->primitive != (char *) NULL) { (void) memcpy(draw_info->primitive,GetBlobStreamData(image), (size_t) GetBlobSize(image)); draw_info->primitive[GetBlobSize(image)]='\0'; } } (void) DrawImage(image,draw_info,exception); draw_info=DestroyDrawInfo(draw_info); (void) CloseBlob(image); return(GetFirstImageInList(image)); }
7,500
179,745
1
int rds_sendmsg(struct socket *sock, struct msghdr *msg, size_t payload_len) { struct sock *sk = sock->sk; struct rds_sock *rs = rds_sk_to_rs(sk); DECLARE_SOCKADDR(struct sockaddr_in *, usin, msg->msg_name); __be32 daddr; __be16 dport; struct rds_message *rm = NULL; struct rds_connection *conn; int ret = 0; int queued = 0, allocated_mr = 0; int nonblock = msg->msg_flags & MSG_DONTWAIT; long timeo = sock_sndtimeo(sk, nonblock); /* Mirror Linux UDP mirror of BSD error message compatibility */ /* XXX: Perhaps MSG_MORE someday */ if (msg->msg_flags & ~(MSG_DONTWAIT | MSG_CMSG_COMPAT)) { ret = -EOPNOTSUPP; goto out; } if (msg->msg_namelen) { /* XXX fail non-unicast destination IPs? */ if (msg->msg_namelen < sizeof(*usin) || usin->sin_family != AF_INET) { ret = -EINVAL; goto out; } daddr = usin->sin_addr.s_addr; dport = usin->sin_port; } else { /* We only care about consistency with ->connect() */ lock_sock(sk); daddr = rs->rs_conn_addr; dport = rs->rs_conn_port; release_sock(sk); } /* racing with another thread binding seems ok here * if (daddr == 0 || rs->rs_bound_addr == 0) { ret = -ENOTCONN; /* XXX not a great errno */ goto out; } if (payload_len > rds_sk_sndbuf(rs)) { ret = -EMSGSIZE; goto out; } /* size of rm including all sgs */ ret = rds_rm_size(msg, payload_len); if (ret < 0) goto out; rm = rds_message_alloc(ret, GFP_KERNEL); if (!rm) { ret = -ENOMEM; goto out; } /* Attach data to the rm */ if (payload_len) { rm->data.op_sg = rds_message_alloc_sgs(rm, ceil(payload_len, PAGE_SIZE)); if (!rm->data.op_sg) { ret = -ENOMEM; goto out; } ret = rds_message_copy_from_user(rm, &msg->msg_iter); if (ret) goto out; } rm->data.op_active = 1; rm->m_daddr = daddr; /* rds_conn_create has a spinlock that runs with IRQ off. * Caching the conn in the socket helps a lot. */ if (rs->rs_conn && rs->rs_conn->c_faddr == daddr) conn = rs->rs_conn; else { conn = rds_conn_create_outgoing(sock_net(sock->sk), rs->rs_bound_addr, daddr, rs->rs_transport, sock->sk->sk_allocation); if (IS_ERR(conn)) { ret = PTR_ERR(conn); goto out; } rs->rs_conn = conn; } /* Parse any control messages the user may have included. */ ret = rds_cmsg_send(rs, rm, msg, &allocated_mr); if (ret) goto out; if (rm->rdma.op_active && !conn->c_trans->xmit_rdma) { printk_ratelimited(KERN_NOTICE "rdma_op %p conn xmit_rdma %p\n", &rm->rdma, conn->c_trans->xmit_rdma); ret = -EOPNOTSUPP; goto out; } if (rm->atomic.op_active && !conn->c_trans->xmit_atomic) { printk_ratelimited(KERN_NOTICE "atomic_op %p conn xmit_atomic %p\n", &rm->atomic, conn->c_trans->xmit_atomic); ret = -EOPNOTSUPP; goto out; } rds_conn_connect_if_down(conn); ret = rds_cong_wait(conn->c_fcong, dport, nonblock, rs); if (ret) { rs->rs_seen_congestion = 1; goto out; } while (!rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port, dport, &queued)) { rds_stats_inc(s_send_queue_full); if (nonblock) { ret = -EAGAIN; goto out; } timeo = wait_event_interruptible_timeout(*sk_sleep(sk), rds_send_queue_rm(rs, conn, rm, rs->rs_bound_port, dport, &queued), timeo); rdsdebug("sendmsg woke queued %d timeo %ld\n", queued, timeo); if (timeo > 0 || timeo == MAX_SCHEDULE_TIMEOUT) continue; ret = timeo; if (ret == 0) ret = -ETIMEDOUT; goto out; } /* * By now we've committed to the send. We reuse rds_send_worker() * to retry sends in the rds thread if the transport asks us to. */ rds_stats_inc(s_send_queued); ret = rds_send_xmit(conn); if (ret == -ENOMEM || ret == -EAGAIN) queue_delayed_work(rds_wq, &conn->c_send_w, 1); rds_message_put(rm); return payload_len; out: /* If the user included a RDMA_MAP cmsg, we allocated a MR on the fly. * If the sendmsg goes through, we keep the MR. If it fails with EAGAIN * or in any other way, we need to destroy the MR again */ if (allocated_mr) rds_rdma_unuse(rs, rds_rdma_cookie_key(rm->m_rdma_cookie), 1); if (rm) rds_message_put(rm); return ret; }
7,501
70,153
0
static enum TIFFReadDirEntryErr TIFFReadDirEntryCheckRangeSbyteShort(uint16 value) { if (value>0x7F) return(TIFFReadDirEntryErrRange); else return(TIFFReadDirEntryErrOk); }
7,502
44,580
0
int lxc_clear_automounts(struct lxc_conf *c) { c->auto_mounts = 0; return 0; }
7,503
146,778
0
bool Document::IsRenderingReady() const { return style_engine_->IgnoringPendingStylesheets() || (HaveImportsLoaded() && HaveRenderBlockingStylesheetsLoaded()); }
7,504
143,421
0
int num_cancelled_requests() const { return num_cancelled_requests_; }
7,505
101,245
0
int64 CreateUnsyncedDirectory(const string& entry_name, const syncable::Id& id) { ScopedDirLookup dir(syncdb_.manager(), syncdb_.name()); EXPECT_TRUE(dir.good()); WriteTransaction wtrans(FROM_HERE, UNITTEST, dir); MutableEntry entry(&wtrans, syncable::CREATE, wtrans.root_id(), entry_name); EXPECT_TRUE(entry.good()); entry.Put(syncable::IS_UNSYNCED, true); entry.Put(syncable::IS_DIR, true); entry.Put(syncable::SPECIFICS, DefaultBookmarkSpecifics()); entry.Put(syncable::BASE_VERSION, id.ServerKnows() ? 1 : 0); entry.Put(syncable::ID, id); return entry.Get(META_HANDLE); }
7,506
28,919
0
static cycle_t read_tsc(void) { cycle_t ret; u64 last; /* * Empirically, a fence (of type that depends on the CPU) * before rdtsc is enough to ensure that rdtsc is ordered * with respect to loads. The various CPU manuals are unclear * as to whether rdtsc can be reordered with later loads, * but no one has ever seen it happen. */ rdtsc_barrier(); ret = (cycle_t)vget_cycles(); last = pvclock_gtod_data.clock.cycle_last; if (likely(ret >= last)) return ret; /* * GCC likes to generate cmov here, but this branch is extremely * predictable (it's just a funciton of time and the likely is * very likely) and there's a data dependence, so force GCC * to generate a branch instead. I don't barrier() because * we don't actually need a barrier, and if this function * ever gets inlined it will generate worse code. */ asm volatile (""); return last; }
7,507
100,746
0
xmlParsePubidLiteral(xmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len = 0; int size = XML_PARSER_BUFFER_SIZE; xmlChar cur; xmlChar stop; int count = 0; xmlParserInputState oldstate = ctxt->instate; 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_PUBLIC_LITERAL; cur = CUR; while ((IS_PUBIDCHAR_CH(cur)) && (cur != stop)) { /* checked */ 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; count++; if (count > 50) { GROW; count = 0; } NEXT; cur = CUR; if (cur == 0) { GROW; SHRINK; cur = CUR; } } buf[len] = 0; if (cur != stop) { xmlFatalErr(ctxt, XML_ERR_LITERAL_NOT_FINISHED, NULL); } else { NEXT; } ctxt->instate = oldstate; return(buf); }
7,508
118,532
0
bool RenderFrameImpl::runModalBeforeUnloadDialog( bool is_reload, const blink::WebString& message) { if (render_view()->is_swapped_out_) return true; if (render_view()->suppress_dialogs_until_swap_out_) return false; bool success = false; base::string16 ignored_result; render_view()->SendAndRunNestedMessageLoop( new FrameHostMsg_RunBeforeUnloadConfirm( routing_id_, frame_->document().url(), message, is_reload, &success, &ignored_result)); return success; }
7,509
15,978
0
ImportSingleTIFF_SRational ( 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. #if SUNOS_SPARC || XMP_IOS_ARM XMP_Uns32 binPtr[2]; memcpy(&binPtr, tagInfo.dataPtr, sizeof(XMP_Uns32)*2); #else XMP_Uns32 * binPtr = (XMP_Uns32*)tagInfo.dataPtr; #endif //#if SUNOS_SPARC || XMP_IOS_ARM XMP_Int32 binNum = GetUns32AsIs ( &binPtr[0] ); XMP_Int32 binDenom = GetUns32AsIs ( &binPtr[1] ); if ( ! nativeEndian ) { Flip4 ( &binNum ); Flip4 ( &binDenom ); } char strValue[40]; snprintf ( strValue, sizeof(strValue), "%ld/%ld", (unsigned long)binNum, (unsigned long)binDenom ); // AUDIT: Using sizeof(strValue) is safe. xmp->SetProperty ( xmpNS, xmpProp, strValue ); } catch ( ... ) { } } // ImportSingleTIFF_SRational
7,510
61,896
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; } } }
7,511
137,513
0
bool PrintWebViewHelper::PrintPreviewContext::CreatePreviewDocument( PrepareFrameAndViewForPrint* prepared_frame, const std::vector<int>& pages) { DCHECK_EQ(INITIALIZED, state_); state_ = RENDERING; prep_frame_view_.reset(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_.reset(new PdfMetafileSkia); if (!metafile_->Init()) { set_error(PREVIEW_ERROR_METAFILE_INIT_FAILED); LOG(ERROR) << "PdfMetafileSkia Init failed"; return false; } 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; }
7,512
148,935
0
static int ChooseLeaf( Rtree *pRtree, /* Rtree table */ RtreeCell *pCell, /* Cell to insert into rtree */ int iHeight, /* Height of sub-tree rooted at pCell */ RtreeNode **ppLeaf /* OUT: Selected leaf page */ ){ int rc; int ii; RtreeNode *pNode; rc = nodeAcquire(pRtree, 1, 0, &pNode); for(ii=0; rc==SQLITE_OK && ii<(pRtree->iDepth-iHeight); ii++){ int iCell; sqlite3_int64 iBest = 0; RtreeDValue fMinGrowth = RTREE_ZERO; RtreeDValue fMinArea = RTREE_ZERO; int nCell = NCELL(pNode); RtreeCell cell; RtreeNode *pChild; RtreeCell *aCell = 0; /* Select the child node which will be enlarged the least if pCell ** is inserted into it. Resolve ties by choosing the entry with ** the smallest area. */ for(iCell=0; iCell<nCell; iCell++){ int bBest = 0; RtreeDValue growth; RtreeDValue area; nodeGetCell(pRtree, pNode, iCell, &cell); growth = cellGrowth(pRtree, &cell, pCell); area = cellArea(pRtree, &cell); if( iCell==0||growth<fMinGrowth||(growth==fMinGrowth && area<fMinArea) ){ bBest = 1; } if( bBest ){ fMinGrowth = growth; fMinArea = area; iBest = cell.iRowid; } } sqlite3_free(aCell); rc = nodeAcquire(pRtree, iBest, pNode, &pChild); nodeRelease(pRtree, pNode); pNode = pChild; } *ppLeaf = pNode; return rc; }
7,513
180,217
1
SPL_METHOD(RecursiveDirectoryIterator, getChildren) { zval *zpath, *zflags; spl_filesystem_object *intern = (spl_filesystem_object*)zend_object_store_get_object(getThis() TSRMLS_CC); spl_filesystem_object *subdir; char slash = SPL_HAS_FLAG(intern->flags, SPL_FILE_DIR_UNIXPATHS) ? '/' : DEFAULT_SLASH; if (zend_parse_parameters_none() == FAILURE) { return; } spl_filesystem_object_get_file_name(intern TSRMLS_CC); MAKE_STD_ZVAL(zflags); MAKE_STD_ZVAL(zpath); ZVAL_LONG(zflags, intern->flags); ZVAL_STRINGL(zpath, intern->file_name, intern->file_name_len, 1); spl_instantiate_arg_ex2(Z_OBJCE_P(getThis()), &return_value, 0, zpath, zflags TSRMLS_CC); zval_ptr_dtor(&zpath); zval_ptr_dtor(&zflags); subdir = (spl_filesystem_object*)zend_object_store_get_object(return_value TSRMLS_CC); if (subdir) { if (intern->u.dir.sub_path && intern->u.dir.sub_path[0]) { subdir->u.dir.sub_path_len = spprintf(&subdir->u.dir.sub_path, 0, "%s%c%s", intern->u.dir.sub_path, slash, intern->u.dir.entry.d_name); } else { subdir->u.dir.sub_path_len = strlen(intern->u.dir.entry.d_name); subdir->u.dir.sub_path = estrndup(intern->u.dir.entry.d_name, subdir->u.dir.sub_path_len); } subdir->info_class = intern->info_class; subdir->file_class = intern->file_class; subdir->oth = intern->oth; } }
7,514
4,476
0
static int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g) { dh->p = p; dh->q = q; dh->g = g; return 1; }
7,515
42,718
0
static inline int pi_test_on(struct pi_desc *pi_desc) { return test_bit(POSTED_INTR_ON, (unsigned long *)&pi_desc->control); }
7,516
29,739
0
static int get_field_base(int match, int field) { return match < 3 ? 2 - field : 1 + field; }
7,517
154,024
0
void GLES2DecoderImpl::DoGetVertexAttribImpl( GLuint index, GLenum pname, T* params) { VertexAttrib* attrib = state_.vertex_attrib_manager->GetVertexAttrib(index); if (!attrib) { LOCAL_SET_GL_ERROR( GL_INVALID_VALUE, "glGetVertexAttrib", "index out of range"); return; } switch (pname) { case GL_CURRENT_VERTEX_ATTRIB: state_.attrib_values[index].GetValues(params); break; default: { GLint value = 0; GetVertexAttribHelper(attrib, pname, &value); *params = static_cast<T>(value); break; } } }
7,518
13,186
0
xps_parse_arc_segment(fz_context *doc, fz_path *path, fz_xml *root, int stroking, int *skipped_stroke) { /* ArcSegment pretty much follows the SVG algorithm for converting an * arc in endpoint representation to an arc in centerpoint * representation. Once in centerpoint it can be given to the * graphics library in the form of a postscript arc. */ float rotation_angle; int is_large_arc, is_clockwise; float point_x, point_y; float size_x, size_y; int is_stroked; char *point_att = fz_xml_att(root, "Point"); char *size_att = fz_xml_att(root, "Size"); char *rotation_angle_att = fz_xml_att(root, "RotationAngle"); char *is_large_arc_att = fz_xml_att(root, "IsLargeArc"); char *sweep_direction_att = fz_xml_att(root, "SweepDirection"); char *is_stroked_att = fz_xml_att(root, "IsStroked"); if (!point_att || !size_att || !rotation_angle_att || !is_large_arc_att || !sweep_direction_att) { fz_warn(doc, "ArcSegment element is missing attributes"); return; } is_stroked = 1; if (is_stroked_att && !strcmp(is_stroked_att, "false")) is_stroked = 0; if (!is_stroked) *skipped_stroke = 1; point_x = point_y = 0; size_x = size_y = 0; xps_parse_point(point_att, &point_x, &point_y); xps_parse_point(size_att, &size_x, &size_y); rotation_angle = fz_atof(rotation_angle_att); is_large_arc = !strcmp(is_large_arc_att, "true"); is_clockwise = !strcmp(sweep_direction_att, "Clockwise"); if (stroking && !is_stroked) { fz_moveto(doc, path, point_x, point_y); return; } xps_draw_arc(doc, path, size_x, size_y, rotation_angle, is_large_arc, is_clockwise, point_x, point_y); }
7,519
105,915
0
static const HashTable* getJSFloat64ArrayPrototypeTable(ExecState* exec) { return getHashTableForGlobalData(exec->globalData(), &JSFloat64ArrayPrototypeTable); }
7,520
14,225
0
PHP_FUNCTION(openssl_get_md_methods) { zend_bool aliases = 0; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|b", &aliases) == FAILURE) { return; } array_init(return_value); OBJ_NAME_do_all_sorted(OBJ_NAME_TYPE_MD_METH, aliases ? openssl_add_method_or_alias: openssl_add_method, return_value); }
7,521
146,114
0
GLboolean WebGL2RenderingContextBase::isSync(WebGLSync* sync) { if (isContextLost() || !sync) return 0; return ContextGL()->IsSync(sync->Object()); }
7,522
23,979
0
static int airo_open(struct net_device *dev) { struct airo_info *ai = dev->ml_priv; int rc = 0; if (test_bit(FLAG_FLASHING, &ai->flags)) return -EIO; /* Make sure the card is configured. * Wireless Extensions may postpone config changes until the card * is open (to pipeline changes and speed-up card setup). If * those changes are not yet committed, do it now - Jean II */ if (test_bit(FLAG_COMMIT, &ai->flags)) { disable_MAC(ai, 1); writeConfigRid(ai, 1); } if (ai->wifidev != dev) { clear_bit(JOB_DIE, &ai->jobs); ai->airo_thread_task = kthread_run(airo_thread, dev, dev->name); if (IS_ERR(ai->airo_thread_task)) return (int)PTR_ERR(ai->airo_thread_task); rc = request_irq(dev->irq, airo_interrupt, IRQF_SHARED, dev->name, dev); if (rc) { airo_print_err(dev->name, "register interrupt %d failed, rc %d", dev->irq, rc); set_bit(JOB_DIE, &ai->jobs); kthread_stop(ai->airo_thread_task); return rc; } /* Power on the MAC controller (which may have been disabled) */ clear_bit(FLAG_RADIO_DOWN, &ai->flags); enable_interrupts(ai); try_auto_wep(ai); } enable_MAC(ai, 1); netif_start_queue(dev); return 0; }
7,523
119,063
0
void WebContentsImpl::UpdateTitle(RenderViewHost* rvh, int32 page_id, const string16& title, base::i18n::TextDirection title_direction) { SetNotWaitingForResponse(); NavigationEntryImpl* entry = controller_.GetEntryWithPageID( rvh->GetSiteInstance(), page_id); if (!entry && rvh != GetRenderViewHost()) return; if (!UpdateTitleForEntry(entry, title)) return; if (entry == controller_.GetEntryAtOffset(0)) NotifyNavigationStateChanged(INVALIDATE_TYPE_TITLE); }
7,524
106,777
0
void WebView::windowAncestryDidChange() { HWND newTopLevelParentWindow; if (m_window) newTopLevelParentWindow = findTopLevelParentWindow(m_window); else { newTopLevelParentWindow = 0; } if (newTopLevelParentWindow == m_topLevelParentWindow) return; if (m_topLevelParentWindow) WindowMessageBroadcaster::removeListener(m_topLevelParentWindow, this); m_topLevelParentWindow = newTopLevelParentWindow; if (m_topLevelParentWindow) WindowMessageBroadcaster::addListener(m_topLevelParentWindow, this); updateActiveState(); }
7,525
66,101
0
static int purge_port(struct usb_serial_port *port, __u16 mask) { int port_number = port->port_number; dev_dbg(&port->dev, "%s - port %d, mask %x\n", __func__, port_number, mask); return send_cmd(port->serial->dev, UMPC_PURGE_PORT, (__u8)(UMPM_UART1_PORT + port_number), mask, NULL, 0); }
7,526
58,538
0
static void freerdp_peer_disconnect(freerdp_peer* client) { transport_disconnect(client->context->rdp->transport); }
7,527
162,585
0
void Resource::ServiceWorkerResponseCachedMetadataHandler::Trace( blink::Visitor* visitor) { CachedMetadataHandlerImpl::Trace(visitor); }
7,528
25,071
0
static inline int compute_score(struct sock *sk, struct net *net, const unsigned short hnum, const __be32 daddr, const int dif) { int score = -1; struct inet_sock *inet = inet_sk(sk); if (net_eq(sock_net(sk), net) && inet->inet_num == hnum && !ipv6_only_sock(sk)) { __be32 rcv_saddr = inet->inet_rcv_saddr; score = sk->sk_family == PF_INET ? 1 : 0; if (rcv_saddr) { if (rcv_saddr != daddr) return -1; score += 2; } if (sk->sk_bound_dev_if) { if (sk->sk_bound_dev_if != dif) return -1; score += 2; } } return score; }
7,529
62,428
0
mgmt_header_print(netdissect_options *ndo, const u_char *p) { const struct mgmt_header_t *hp = (const struct mgmt_header_t *) p; ND_PRINT((ndo, "BSSID:%s DA:%s SA:%s ", etheraddr_string(ndo, (hp)->bssid), etheraddr_string(ndo, (hp)->da), etheraddr_string(ndo, (hp)->sa))); }
7,530
63,551
0
_boolean_handled_accumulator (GSignalInvocationHint *ihint, GValue *return_accu, const GValue *handler_return, gpointer dummy) { gboolean continue_emission; gboolean signal_handled; signal_handled = g_value_get_boolean (handler_return); g_value_set_boolean (return_accu, signal_handled); continue_emission = !signal_handled; return continue_emission; }
7,531
30,022
0
int br_multicast_rcv(struct net_bridge *br, struct net_bridge_port *port, struct sk_buff *skb) { BR_INPUT_SKB_CB(skb)->igmp = 0; BR_INPUT_SKB_CB(skb)->mrouters_only = 0; if (br->multicast_disabled) return 0; switch (skb->protocol) { case htons(ETH_P_IP): return br_multicast_ipv4_rcv(br, port, skb); #if IS_ENABLED(CONFIG_IPV6) case htons(ETH_P_IPV6): return br_multicast_ipv6_rcv(br, port, skb); #endif } return 0; }
7,532
155,410
0
bool ChromeContentBrowserClient::IsWebUIAllowedToMakeNetworkRequests( const url::Origin& origin) { return ChromeWebUIControllerFactory::IsWebUIAllowedToMakeNetworkRequests( origin); }
7,533
101,231
0
base::TimeDelta SyncerProtoUtil::GetThrottleDelay( const sync_pb::ClientToServerResponse& response) { base::TimeDelta throttle_delay = base::TimeDelta::FromSeconds(kSyncDelayAfterThrottled); if (response.has_client_command()) { const sync_pb::ClientCommand& command = response.client_command(); if (command.has_throttle_delay_seconds()) { throttle_delay = base::TimeDelta::FromSeconds(command.throttle_delay_seconds()); } } return throttle_delay; }
7,534
55,420
0
static void tcp_update_reordering(struct sock *sk, const int metric, const int ts) { struct tcp_sock *tp = tcp_sk(sk); if (metric > tp->reordering) { int mib_idx; tp->reordering = min(sysctl_tcp_max_reordering, metric); /* This exciting event is worth to be remembered. 8) */ if (ts) mib_idx = LINUX_MIB_TCPTSREORDER; else if (tcp_is_reno(tp)) mib_idx = LINUX_MIB_TCPRENOREORDER; else if (tcp_is_fack(tp)) mib_idx = LINUX_MIB_TCPFACKREORDER; else mib_idx = LINUX_MIB_TCPSACKREORDER; NET_INC_STATS_BH(sock_net(sk), mib_idx); #if FASTRETRANS_DEBUG > 1 pr_debug("Disorder%d %d %u f%u s%u rr%d\n", tp->rx_opt.sack_ok, inet_csk(sk)->icsk_ca_state, tp->reordering, tp->fackets_out, tp->sacked_out, tp->undo_marker ? tp->undo_retrans : 0); #endif tcp_disable_fack(tp); } if (metric > 0) tcp_disable_early_retrans(tp); tp->rack.reord = 1; }
7,535
34,688
0
static int gfs2_allocate_page_backing(struct page *page) { struct inode *inode = page->mapping->host; struct buffer_head bh; unsigned long size = PAGE_CACHE_SIZE; u64 lblock = page->index << (PAGE_CACHE_SHIFT - inode->i_blkbits); do { bh.b_state = 0; bh.b_size = size; gfs2_block_map(inode, lblock, &bh, 1); if (!buffer_mapped(&bh)) return -EIO; size -= bh.b_size; lblock += (bh.b_size >> inode->i_blkbits); } while(size > 0); return 0; }
7,536
179,630
1
struct sk_buff *skb_segment(struct sk_buff *head_skb, netdev_features_t features) { struct sk_buff *segs = NULL; struct sk_buff *tail = NULL; struct sk_buff *list_skb = skb_shinfo(head_skb)->frag_list; skb_frag_t *frag = skb_shinfo(head_skb)->frags; unsigned int mss = skb_shinfo(head_skb)->gso_size; unsigned int doffset = head_skb->data - skb_mac_header(head_skb); unsigned int offset = doffset; unsigned int tnl_hlen = skb_tnl_header_len(head_skb); unsigned int headroom; unsigned int len; __be16 proto; bool csum; int sg = !!(features & NETIF_F_SG); int nfrags = skb_shinfo(head_skb)->nr_frags; int err = -ENOMEM; int i = 0; int pos; proto = skb_network_protocol(head_skb); if (unlikely(!proto)) return ERR_PTR(-EINVAL); csum = !!can_checksum_protocol(features, proto); __skb_push(head_skb, doffset); headroom = skb_headroom(head_skb); pos = skb_headlen(head_skb); do { struct sk_buff *nskb; skb_frag_t *nskb_frag; int hsize; int size; len = head_skb->len - offset; if (len > mss) len = mss; hsize = skb_headlen(head_skb) - offset; if (hsize < 0) hsize = 0; if (hsize > len || !sg) hsize = len; if (!hsize && i >= nfrags && skb_headlen(list_skb) && (skb_headlen(list_skb) == len || sg)) { BUG_ON(skb_headlen(list_skb) > len); i = 0; nfrags = skb_shinfo(list_skb)->nr_frags; frag = skb_shinfo(list_skb)->frags; pos += skb_headlen(list_skb); while (pos < offset + len) { BUG_ON(i >= nfrags); size = skb_frag_size(frag); if (pos + size > offset + len) break; i++; pos += size; frag++; } nskb = skb_clone(list_skb, GFP_ATOMIC); list_skb = list_skb->next; if (unlikely(!nskb)) goto err; if (unlikely(pskb_trim(nskb, len))) { kfree_skb(nskb); goto err; } hsize = skb_end_offset(nskb); if (skb_cow_head(nskb, doffset + headroom)) { kfree_skb(nskb); goto err; } nskb->truesize += skb_end_offset(nskb) - hsize; skb_release_head_state(nskb); __skb_push(nskb, doffset); } else { nskb = __alloc_skb(hsize + doffset + headroom, GFP_ATOMIC, skb_alloc_rx_flag(head_skb), NUMA_NO_NODE); if (unlikely(!nskb)) goto err; skb_reserve(nskb, headroom); __skb_put(nskb, doffset); } if (segs) tail->next = nskb; else segs = nskb; tail = nskb; __copy_skb_header(nskb, head_skb); nskb->mac_len = head_skb->mac_len; skb_headers_offset_update(nskb, skb_headroom(nskb) - headroom); skb_copy_from_linear_data_offset(head_skb, -tnl_hlen, nskb->data - tnl_hlen, doffset + tnl_hlen); if (nskb->len == len + doffset) goto perform_csum_check; if (!sg) { nskb->ip_summed = CHECKSUM_NONE; nskb->csum = skb_copy_and_csum_bits(head_skb, offset, skb_put(nskb, len), len, 0); continue; } nskb_frag = skb_shinfo(nskb)->frags; skb_copy_from_linear_data_offset(head_skb, offset, skb_put(nskb, hsize), hsize); skb_shinfo(nskb)->tx_flags = skb_shinfo(head_skb)->tx_flags & SKBTX_SHARED_FRAG; while (pos < offset + len) { if (i >= nfrags) { BUG_ON(skb_headlen(list_skb)); i = 0; nfrags = skb_shinfo(list_skb)->nr_frags; frag = skb_shinfo(list_skb)->frags; BUG_ON(!nfrags); list_skb = list_skb->next; } if (unlikely(skb_shinfo(nskb)->nr_frags >= MAX_SKB_FRAGS)) { net_warn_ratelimited( "skb_segment: too many frags: %u %u\n", pos, mss); goto err; } *nskb_frag = *frag; __skb_frag_ref(nskb_frag); size = skb_frag_size(nskb_frag); if (pos < offset) { nskb_frag->page_offset += offset - pos; skb_frag_size_sub(nskb_frag, offset - pos); } skb_shinfo(nskb)->nr_frags++; if (pos + size <= offset + len) { i++; frag++; pos += size; } else { skb_frag_size_sub(nskb_frag, pos + size - (offset + len)); goto skip_fraglist; } nskb_frag++; } skip_fraglist: nskb->data_len = len - hsize; nskb->len += nskb->data_len; nskb->truesize += nskb->data_len; perform_csum_check: if (!csum) { nskb->csum = skb_checksum(nskb, doffset, nskb->len - doffset, 0); nskb->ip_summed = CHECKSUM_NONE; } } while ((offset += len) < head_skb->len); return segs; err: kfree_skb_list(segs); return ERR_PTR(err); }
7,537
126,125
0
void BrowserEventRouter::TabClosingAt(TabStripModel* tab_strip_model, WebContents* contents, int index) { int tab_id = ExtensionTabUtil::GetTabId(contents); scoped_ptr<ListValue> args(new ListValue()); args->Append(Value::CreateIntegerValue(tab_id)); DictionaryValue* object_args = new DictionaryValue(); object_args->SetBoolean(tab_keys::kWindowClosing, tab_strip_model->closing_all()); args->Append(object_args); Profile* profile = Profile::FromBrowserContext(contents->GetBrowserContext()); DispatchEvent(profile, events::kOnTabRemoved, args.Pass(), EventRouter::USER_GESTURE_UNKNOWN); int removed_count = tab_entries_.erase(tab_id); DCHECK_GT(removed_count, 0); UnregisterForTabNotifications(contents); }
7,538
182,517
1
w3m_exit(int i) { #ifdef USE_MIGEMO init_migemo(); /* close pipe to migemo */ #endif stopDownload(); deleteFiles(); #ifdef USE_SSL free_ssl_ctx(); #endif disconnectFTP(); #ifdef USE_NNTP disconnectNews(); #endif #ifdef __MINGW32_VERSION WSACleanup(); #endif exit(i); }
7,539
108,861
0
void RenderViewImpl::EnsureMediaStreamImpl() { if (!RenderThreadImpl::current()) // Will be NULL during unit tests. return; #if defined(ENABLE_WEBRTC) if (!media_stream_dispatcher_) media_stream_dispatcher_ = new MediaStreamDispatcher(this); if (!media_stream_impl_) { media_stream_impl_ = new MediaStreamImpl( this, media_stream_dispatcher_, RenderThreadImpl::current()->video_capture_impl_manager(), RenderThreadImpl::current()->GetMediaStreamDependencyFactory()); } #endif }
7,540
136,851
0
Vector<String> HTMLInputElement::AcceptMIMETypes() const { return ParseAcceptAttribute(FastGetAttribute(acceptAttr), IsValidMIMEType); }
7,541
53,887
0
int acpi_register_debugger(struct module *owner, const struct acpi_debugger_ops *ops) { int ret = 0; mutex_lock(&acpi_debugger.lock); if (acpi_debugger.ops) { ret = -EBUSY; goto err_lock; } acpi_debugger.owner = owner; acpi_debugger.ops = ops; err_lock: mutex_unlock(&acpi_debugger.lock); return ret; }
7,542
150,698
0
ContentSetting GetEffectiveSetting(Profile* profile, ContentSettingsType type, ContentSetting setting, ContentSetting default_setting) { ContentSetting effective_setting = setting; if (effective_setting == CONTENT_SETTING_DEFAULT) effective_setting = default_setting; if (effective_setting == CONTENT_SETTING_DETECT_IMPORTANT_CONTENT) effective_setting = CONTENT_SETTING_ASK; return effective_setting; }
7,543
2,286
0
_PUBLIC_ codepoint_t tolower_m(codepoint_t val) { if (val < 128) { return tolower(val); } if (val >= ARRAY_SIZE(lowcase_table)) { return val; } return lowcase_table[val]; }
7,544
7,245
0
static void add_request_header(char *var, unsigned int var_len, char *val, unsigned int val_len, void *arg TSRMLS_DC) /* {{{ */ { zval *return_value = (zval*)arg; char *str = NULL; char *p; ALLOCA_FLAG(use_heap) if (var_len > 5 && var[0] == 'H' && var[1] == 'T' && var[2] == 'T' && var[3] == 'P' && var[4] == '_') { var_len -= 5; p = var + 5; var = str = do_alloca(var_len + 1, use_heap); *str++ = *p++; while (*p) { if (*p == '_') { *str++ = '-'; p++; if (*p) { *str++ = *p++; } } else if (*p >= 'A' && *p <= 'Z') { *str++ = (*p++ - 'A' + 'a'); } else { *str++ = *p++; } } *str = 0; } else if (var_len == sizeof("CONTENT_TYPE")-1 && memcmp(var, "CONTENT_TYPE", sizeof("CONTENT_TYPE")-1) == 0) { var = "Content-Type"; } else if (var_len == sizeof("CONTENT_LENGTH")-1 && memcmp(var, "CONTENT_LENGTH", sizeof("CONTENT_LENGTH")-1) == 0) { var = "Content-Length"; } else { return; } add_assoc_stringl_ex(return_value, var, var_len+1, val, val_len, 1); if (str) { free_alloca(var, use_heap); } } /* }}} */
7,545
95,959
0
void CL_ForwardCommandToServer( const char *string ) { char *cmd; cmd = Cmd_Argv(0); if ( cmd[0] == '-' ) { return; } if ( clc.demoplaying || clc.state < CA_CONNECTED || cmd[0] == '+' ) { Com_Printf ("Unknown command \"%s" S_COLOR_WHITE "\"\n", cmd); return; } if ( Cmd_Argc() > 1 ) { CL_AddReliableCommand(string, qfalse); } else { CL_AddReliableCommand(cmd, qfalse); } }
7,546
172,738
0
void ih264d_update_nnz_for_skipmb(dec_struct_t * ps_dec, dec_mb_info_t * ps_cur_mb_info, UWORD8 u1_entrpy) { UWORD32 *pu4_buf; UWORD8 *pu1_buf; UNUSED(u1_entrpy); pu1_buf = ps_dec->pu1_left_nnz_y; pu4_buf = (UWORD32 *)pu1_buf; *pu4_buf = 0; pu1_buf = ps_dec->pu1_left_nnz_uv; pu4_buf = (UWORD32 *)pu1_buf; *pu4_buf = 0; pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_y; pu4_buf = (UWORD32 *)pu1_buf; *pu4_buf = 0; pu1_buf = ps_cur_mb_info->ps_curmb->pu1_nnz_uv; pu4_buf = (UWORD32 *)pu1_buf; *pu4_buf = 0; ps_cur_mb_info->ps_curmb->u2_luma_csbp = 0; ps_cur_mb_info->u2_luma_csbp = 0; ps_cur_mb_info->u2_chroma_csbp = 0; }
7,547
67,823
0
void DefragInitConfig(char quiet) { SCLogDebug("initializing defrag engine..."); memset(&defrag_config, 0, sizeof(defrag_config)); SC_ATOMIC_INIT(defragtracker_counter); SC_ATOMIC_INIT(defrag_memuse); SC_ATOMIC_INIT(defragtracker_prune_idx); DefragTrackerQueueInit(&defragtracker_spare_q); #ifndef AFLFUZZ_NO_RANDOM unsigned int seed = RandomTimePreseed(); /* set defaults */ defrag_config.hash_rand = (int)(DEFRAG_DEFAULT_HASHSIZE * (rand_r(&seed) / RAND_MAX + 1.0)); #endif defrag_config.hash_size = DEFRAG_DEFAULT_HASHSIZE; defrag_config.memcap = DEFRAG_DEFAULT_MEMCAP; defrag_config.prealloc = DEFRAG_DEFAULT_PREALLOC; /* Check if we have memcap and hash_size defined at config */ char *conf_val; uint32_t configval = 0; /** set config values for memcap, prealloc and hash_size */ if ((ConfGet("defrag.memcap", &conf_val)) == 1) { if (ParseSizeStringU64(conf_val, &defrag_config.memcap) < 0) { SCLogError(SC_ERR_SIZE_PARSE, "Error parsing defrag.memcap " "from conf file - %s. Killing engine", conf_val); exit(EXIT_FAILURE); } } if ((ConfGet("defrag.hash-size", &conf_val)) == 1) { if (ByteExtractStringUint32(&configval, 10, strlen(conf_val), conf_val) > 0) { defrag_config.hash_size = configval; } else { WarnInvalidConfEntry("defrag.hash-size", "%"PRIu32, defrag_config.hash_size); } } if ((ConfGet("defrag.trackers", &conf_val)) == 1) { if (ByteExtractStringUint32(&configval, 10, strlen(conf_val), conf_val) > 0) { defrag_config.prealloc = configval; } else { WarnInvalidConfEntry("defrag.trackers", "%"PRIu32, defrag_config.prealloc); } } SCLogDebug("DefragTracker config from suricata.yaml: memcap: %"PRIu64", hash-size: " "%"PRIu32", prealloc: %"PRIu32, defrag_config.memcap, defrag_config.hash_size, defrag_config.prealloc); /* alloc hash memory */ uint64_t hash_size = defrag_config.hash_size * sizeof(DefragTrackerHashRow); if (!(DEFRAG_CHECK_MEMCAP(hash_size))) { SCLogError(SC_ERR_DEFRAG_INIT, "allocating defrag hash failed: " "max defrag memcap is smaller than projected hash size. " "Memcap: %"PRIu64", Hash table size %"PRIu64". Calculate " "total hash size by multiplying \"defrag.hash-size\" with %"PRIuMAX", " "which is the hash bucket size.", defrag_config.memcap, hash_size, (uintmax_t)sizeof(DefragTrackerHashRow)); exit(EXIT_FAILURE); } defragtracker_hash = SCCalloc(defrag_config.hash_size, sizeof(DefragTrackerHashRow)); if (unlikely(defragtracker_hash == NULL)) { SCLogError(SC_ERR_FATAL, "Fatal error encountered in DefragTrackerInitConfig. Exiting..."); exit(EXIT_FAILURE); } memset(defragtracker_hash, 0, defrag_config.hash_size * sizeof(DefragTrackerHashRow)); uint32_t i = 0; for (i = 0; i < defrag_config.hash_size; i++) { DRLOCK_INIT(&defragtracker_hash[i]); } (void) SC_ATOMIC_ADD(defrag_memuse, (defrag_config.hash_size * sizeof(DefragTrackerHashRow))); if (quiet == FALSE) { SCLogConfig("allocated %llu bytes of memory for the defrag hash... " "%" PRIu32 " buckets of size %" PRIuMAX "", SC_ATOMIC_GET(defrag_memuse), defrag_config.hash_size, (uintmax_t)sizeof(DefragTrackerHashRow)); } if ((ConfGet("defrag.prealloc", &conf_val)) == 1) { if (ConfValIsTrue(conf_val)) { /* pre allocate defrag trackers */ for (i = 0; i < defrag_config.prealloc; i++) { if (!(DEFRAG_CHECK_MEMCAP(sizeof(DefragTracker)))) { SCLogError(SC_ERR_DEFRAG_INIT, "preallocating defrag trackers failed: " "max defrag memcap reached. Memcap %"PRIu64", " "Memuse %"PRIu64".", defrag_config.memcap, ((uint64_t)SC_ATOMIC_GET(defrag_memuse) + (uint64_t)sizeof(DefragTracker))); exit(EXIT_FAILURE); } DefragTracker *h = DefragTrackerAlloc(); if (h == NULL) { SCLogError(SC_ERR_DEFRAG_INIT, "preallocating defrag failed: %s", strerror(errno)); exit(EXIT_FAILURE); } DefragTrackerEnqueue(&defragtracker_spare_q,h); } if (quiet == FALSE) { SCLogConfig("preallocated %" PRIu32 " defrag trackers of size %" PRIuMAX "", defragtracker_spare_q.len, (uintmax_t)sizeof(DefragTracker)); } } } if (quiet == FALSE) { SCLogConfig("defrag memory usage: %llu bytes, maximum: %"PRIu64, SC_ATOMIC_GET(defrag_memuse), defrag_config.memcap); } return; }
7,548
92,114
0
static void *get_recv_wqe(struct mlx5_ib_qp *qp, int n) { return get_wqe(qp, qp->rq.offset + (n << qp->rq.wqe_shift)); }
7,549
126,670
0
void TabStripModelObserver::TabMoved(TabContents* contents, int from_index, int to_index) { }
7,550
100,657
0
bool IsURLAllowedInIncognito(const GURL& url) { return url.scheme() == chrome::kChromeUIScheme && (url.host() == chrome::kChromeUISettingsHost || url.host() == chrome::kChromeUIExtensionsHost || url.host() == chrome::kChromeUIBookmarksHost); }
7,551
133,807
0
void ExtractFileFeatures(const base::FilePath& file_path) { base::TimeTicks start_time = base::TimeTicks::Now(); binary_feature_extractor_->CheckSignature(file_path, &signature_info_); bool is_signed = (signature_info_.certificate_chain_size() > 0); if (is_signed) { DVLOG(2) << "Downloaded a signed binary: " << file_path.value(); } else { DVLOG(2) << "Downloaded an unsigned binary: " << file_path.value(); } UMA_HISTOGRAM_BOOLEAN("SBClientDownload.SignedBinaryDownload", is_signed); UMA_HISTOGRAM_TIMES("SBClientDownload.ExtractSignatureFeaturesTime", base::TimeTicks::Now() - start_time); start_time = base::TimeTicks::Now(); image_headers_.reset(new ClientDownloadRequest_ImageHeaders()); if (!binary_feature_extractor_->ExtractImageFeatures( file_path, BinaryFeatureExtractor::kDefaultOptions, image_headers_.get(), nullptr /* signed_data */)) { image_headers_.reset(); } UMA_HISTOGRAM_TIMES("SBClientDownload.ExtractImageHeadersTime", base::TimeTicks::Now() - start_time); OnFileFeatureExtractionDone(); }
7,552
83,884
0
file_add_class( VipsForeignClass *class, GSList **files ) { /* Append so we don't reverse the list of files. Sort will not reorder * items of equal priority. */ *files = g_slist_append( *files, class ); return( NULL ); }
7,553
151,917
0
void RenderFrameHostImpl::DetachFromProxy() { if (unload_state_ != UnloadState::NotRun) return; DeleteRenderFrame(); StartPendingDeletionOnSubtree(); PendingDeletionCheckCompletedOnSubtree(); }
7,554
91,768
0
void comps_objmrtree_data_destroy(COMPS_ObjMRTreeData * rtd) { free(rtd->key); COMPS_OBJECT_DESTROY(rtd->data); comps_hslist_destroy(&rtd->subnodes); free(rtd); }
7,555
109,090
0
void RenderViewImpl::didCompleteClientRedirect( WebFrame* frame, const WebURL& from) { if (!frame->parent()) { WebDataSource* ds = frame->provisionalDataSource(); completed_client_redirect_src_ = Referrer( from, ds ? GetReferrerPolicyFromRequest(frame, ds->request()) : frame->document().referrerPolicy()); } FOR_EACH_OBSERVER( RenderViewObserver, observers_, DidCompleteClientRedirect(frame, from)); }
7,556
92,099
0
static void destroy_qp_user(struct mlx5_ib_dev *dev, struct ib_pd *pd, struct mlx5_ib_qp *qp, struct mlx5_ib_qp_base *base) { struct mlx5_ib_ucontext *context; context = to_mucontext(pd->uobject->context); mlx5_ib_db_unmap_user(context, &qp->db); if (base->ubuffer.umem) ib_umem_release(base->ubuffer.umem); /* * Free only the BFREGs which are handled by the kernel. * BFREGs of UARs allocated dynamically are handled by user. */ if (qp->bfregn != MLX5_IB_INVALID_BFREG) mlx5_ib_free_bfreg(dev, &context->bfregi, qp->bfregn); }
7,557
18,780
0
static int inet_create(struct net *net, struct socket *sock, int protocol, int kern) { struct sock *sk; struct inet_protosw *answer; struct inet_sock *inet; struct proto *answer_prot; unsigned char answer_flags; char answer_no_check; int try_loading_module = 0; int err; if (unlikely(!inet_ehash_secret)) if (sock->type != SOCK_RAW && sock->type != SOCK_DGRAM) build_ehash_secret(); sock->state = SS_UNCONNECTED; /* Look for the requested type/protocol pair. */ lookup_protocol: err = -ESOCKTNOSUPPORT; rcu_read_lock(); list_for_each_entry_rcu(answer, &inetsw[sock->type], list) { err = 0; /* Check the non-wild match. */ if (protocol == answer->protocol) { if (protocol != IPPROTO_IP) break; } else { /* Check for the two wild cases. */ if (IPPROTO_IP == protocol) { protocol = answer->protocol; break; } if (IPPROTO_IP == answer->protocol) break; } err = -EPROTONOSUPPORT; } if (unlikely(err)) { if (try_loading_module < 2) { rcu_read_unlock(); /* * Be more specific, e.g. net-pf-2-proto-132-type-1 * (net-pf-PF_INET-proto-IPPROTO_SCTP-type-SOCK_STREAM) */ if (++try_loading_module == 1) request_module("net-pf-%d-proto-%d-type-%d", PF_INET, protocol, sock->type); /* * Fall back to generic, e.g. net-pf-2-proto-132 * (net-pf-PF_INET-proto-IPPROTO_SCTP) */ else request_module("net-pf-%d-proto-%d", PF_INET, protocol); goto lookup_protocol; } else goto out_rcu_unlock; } err = -EPERM; if (sock->type == SOCK_RAW && !kern && !capable(CAP_NET_RAW)) goto out_rcu_unlock; err = -EAFNOSUPPORT; if (!inet_netns_ok(net, protocol)) goto out_rcu_unlock; sock->ops = answer->ops; answer_prot = answer->prot; answer_no_check = answer->no_check; answer_flags = answer->flags; rcu_read_unlock(); WARN_ON(answer_prot->slab == NULL); err = -ENOBUFS; sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot); if (sk == NULL) goto out; err = 0; sk->sk_no_check = answer_no_check; if (INET_PROTOSW_REUSE & answer_flags) sk->sk_reuse = 1; inet = inet_sk(sk); inet->is_icsk = (INET_PROTOSW_ICSK & answer_flags) != 0; inet->nodefrag = 0; if (SOCK_RAW == sock->type) { inet->inet_num = protocol; if (IPPROTO_RAW == protocol) inet->hdrincl = 1; } if (ipv4_config.no_pmtu_disc) inet->pmtudisc = IP_PMTUDISC_DONT; else inet->pmtudisc = IP_PMTUDISC_WANT; inet->inet_id = 0; sock_init_data(sock, sk); sk->sk_destruct = inet_sock_destruct; sk->sk_protocol = protocol; sk->sk_backlog_rcv = sk->sk_prot->backlog_rcv; inet->uc_ttl = -1; inet->mc_loop = 1; inet->mc_ttl = 1; inet->mc_all = 1; inet->mc_index = 0; inet->mc_list = NULL; sk_refcnt_debug_inc(sk); if (inet->inet_num) { /* It assumes that any protocol which allows * the user to assign a number at socket * creation time automatically * shares. */ inet->inet_sport = htons(inet->inet_num); /* Add to protocol hash chains. */ sk->sk_prot->hash(sk); } if (sk->sk_prot->init) { err = sk->sk_prot->init(sk); if (err) sk_common_release(sk); } out: return err; out_rcu_unlock: rcu_read_unlock(); goto out; }
7,558
48,631
0
static void cleanup_streams(h2_session *session) { stream_sel_ctx ctx; ctx.session = session; ctx.candidate = NULL; while (1) { h2_mplx_stream_do(session->mplx, find_cleanup_stream, &ctx); if (ctx.candidate) { h2_session_stream_done(session, ctx.candidate); ctx.candidate = NULL; } else { break; } } }
7,559
122,932
0
void RenderWidgetHostImpl::AccessibilitySetFocus(int object_id) { Send(new AccessibilityMsg_SetFocus(GetRoutingID(), object_id)); }
7,560
46,257
0
blkdev_get_block(struct inode *inode, sector_t iblock, struct buffer_head *bh, int create) { bh->b_bdev = I_BDEV(inode); bh->b_blocknr = iblock; set_buffer_mapped(bh); return 0; }
7,561
63,836
0
send_dirredirect( httpd_conn* hc ) { static char* location; static char* header; static size_t maxlocation = 0, maxheader = 0; static char headstr[] = "Location: "; if ( hc->query[0] != '\0') { char* cp = strchr( hc->encodedurl, '?' ); if ( cp != (char*) 0 ) /* should always find it */ *cp = '\0'; httpd_realloc_str( &location, &maxlocation, strlen( hc->encodedurl ) + 2 + strlen( hc->query ) ); (void) my_snprintf( location, maxlocation, "%s/?%s", hc->encodedurl, hc->query ); } else { httpd_realloc_str( &location, &maxlocation, strlen( hc->encodedurl ) + 1 ); (void) my_snprintf( location, maxlocation, "%s/", hc->encodedurl ); } httpd_realloc_str( &header, &maxheader, sizeof(headstr) + strlen( location ) ); (void) my_snprintf( header, maxheader, "%s%s\015\012", headstr, location ); send_response( hc, 302, err302title, header, err302form, location ); }
7,562
147,132
0
bool DocumentLoader::RedirectReceived( Resource* resource, const ResourceRequest& request, const ResourceResponse& redirect_response) { DCHECK(frame_); DCHECK_EQ(resource, main_resource_); DCHECK(!redirect_response.IsNull()); request_ = request; const KURL& request_url = request_.Url(); RefPtr<SecurityOrigin> 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()); AppendRedirect(request_url); GetTiming().AddRedirect(redirect_response.Url(), request_url); history_item_.Clear(); GetLocalFrameClient().DispatchDidReceiveServerRedirectForProvisionalLoad(); return true; }
7,563
123,256
0
void RenderWidgetHostViewAura::TextInputStateChanged( const ViewHostMsg_TextInputState_Params& params) { if (text_input_type_ != params.type || can_compose_inline_ != params.can_compose_inline) { text_input_type_ = params.type; can_compose_inline_ = params.can_compose_inline; if (GetInputMethod()) GetInputMethod()->OnTextInputTypeChanged(this); } }
7,564
154,285
0
GLES2DecoderImpl::HandleStencilThenCoverStrokePathInstancedCHROMIUM( uint32_t immediate_data_size, const volatile void* cmd_data) { static const char kFunctionName[] = "glStencilThenCoverStrokeInstancedCHROMIUM"; const volatile gles2::cmds::StencilThenCoverStrokePathInstancedCHROMIUM& c = *static_cast<const volatile gles2::cmds:: StencilThenCoverStrokePathInstancedCHROMIUM*>(cmd_data); if (!features().chromium_path_rendering) return error::kUnknownCommand; PathCommandValidatorContext v(this, kFunctionName); GLuint num_paths = 0; GLenum path_name_type = GL_NONE; GLenum cover_mode = GL_BOUNDING_BOX_OF_BOUNDING_BOXES_CHROMIUM; GLenum transform_type = GL_NONE; if (!v.GetPathCountAndType(c, &num_paths, &path_name_type) || !v.GetCoverMode(c, &cover_mode) || !v.GetTransformType(c, &transform_type)) return v.error(); if (num_paths == 0) return error::kNoError; std::unique_ptr<GLuint[]> paths; if (!v.GetPathNameData(c, num_paths, path_name_type, &paths)) return v.error(); const GLfloat* transforms = nullptr; if (!v.GetTransforms(c, num_paths, transform_type, &transforms)) return v.error(); GLint reference = static_cast<GLint>(c.reference); GLuint mask = static_cast<GLuint>(c.mask); if (!CheckBoundDrawFramebufferValid(kFunctionName)) return error::kNoError; ApplyDirtyState(); api()->glStencilThenCoverStrokePathInstancedNVFn( num_paths, GL_UNSIGNED_INT, paths.get(), 0, reference, mask, cover_mode, transform_type, transforms); return error::kNoError; }
7,565
44,055
0
getDocPtr(xmlNode * node) { xmlDoc *doc = NULL; CRM_CHECK(node != NULL, return NULL); doc = node->doc; if (doc == NULL) { doc = xmlNewDoc((const xmlChar *)"1.0"); xmlDocSetRootElement(doc, node); xmlSetTreeDoc(node, doc); } return doc; }
7,566
95,799
0
char **FS_ListFiles( const char *path, const char *extension, int *numfiles ) { return FS_ListFilteredFiles( path, extension, NULL, numfiles, qfalse ); }
7,567
146,944
0
WebLocalFrameImpl* WebLocalFrameImpl::CreateMainFrame( WebView* web_view, WebFrameClient* client, InterfaceRegistry* interface_registry, WebFrame* opener, const WebString& name, WebSandboxFlags sandbox_flags) { WebLocalFrameImpl* frame = new WebLocalFrameImpl(WebTreeScopeType::kDocument, client, interface_registry); frame->SetOpener(opener); Page& page = *static_cast<WebViewBase*>(web_view)->GetPage(); DCHECK(!page.MainFrame()); frame->InitializeCoreFrame(page, nullptr, name); frame->GetFrame()->Loader().ForceSandboxFlags( static_cast<SandboxFlags>(sandbox_flags)); return frame; }
7,568
63,775
0
static int _sx_sasl_process(sx_t s, sx_plugin_t p, nad_t nad) { Gsasl_session *sd = (Gsasl_session *) s->plugin_data[p->index]; int attr; char mech[128]; sx_error_t sxe; int flags; char *ns = NULL, *to = NULL, *from = NULL, *version = NULL; /* only want sasl packets */ if(NAD_ENS(nad, 0) < 0 || NAD_NURI_L(nad, NAD_ENS(nad, 0)) != strlen(uri_SASL) || strncmp(NAD_NURI(nad, NAD_ENS(nad, 0)), uri_SASL, strlen(uri_SASL)) != 0) return 1; /* quietly drop it if sasl is disabled, or if not ready */ if(s->state != state_STREAM) { _sx_debug(ZONE, "not correct state for sasl, ignoring"); nad_free(nad); return 0; } /* packets from the client */ if(s->type == type_SERVER) { if(!(s->flags & SX_SASL_OFFER)) { _sx_debug(ZONE, "they tried to do sasl, but we never offered it, ignoring"); nad_free(nad); return 0; } #ifdef HAVE_SSL if((s->flags & SX_SSL_STARTTLS_REQUIRE) && s->ssf == 0) { _sx_debug(ZONE, "they tried to do sasl, but they have to do starttls first, ignoring"); nad_free(nad); return 0; } #endif /* auth */ if(NAD_ENAME_L(nad, 0) == 4 && strncmp("auth", NAD_ENAME(nad, 0), NAD_ENAME_L(nad, 0)) == 0) { /* require mechanism */ if((attr = nad_find_attr(nad, 0, -1, "mechanism", NULL)) < 0) { _sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_INVALID_MECHANISM, NULL), 0); nad_free(nad); return 0; } /* extract */ snprintf(mech, 127, "%.*s", NAD_AVAL_L(nad, attr), NAD_AVAL(nad, attr)); /* go */ _sx_sasl_client_process(s, p, sd, mech, NAD_CDATA(nad, 0), NAD_CDATA_L(nad, 0)); nad_free(nad); return 0; } /* response */ else if(NAD_ENAME_L(nad, 0) == 8 && strncmp("response", NAD_ENAME(nad, 0), NAD_ENAME_L(nad, 0)) == 0) { /* process it */ _sx_sasl_client_process(s, p, sd, NULL, NAD_CDATA(nad, 0), NAD_CDATA_L(nad, 0)); nad_free(nad); return 0; } /* abort */ else if(NAD_ENAME_L(nad, 0) == 5 && strncmp("abort", NAD_ENAME(nad, 0), NAD_ENAME_L(nad, 0)) == 0) { _sx_debug(ZONE, "sasl handshake aborted"); _sx_nad_write(s, _sx_sasl_failure(s, _sasl_err_ABORTED, NULL), 0); nad_free(nad); return 0; } } /* packets from the server */ else if(s->type == type_CLIENT) { if(sd == NULL) { _sx_debug(ZONE, "got sasl client packets, but they never started sasl, ignoring"); nad_free(nad); return 0; } /* challenge */ if(NAD_ENAME_L(nad, 0) == 9 && strncmp("challenge", NAD_ENAME(nad, 0), NAD_ENAME_L(nad, 0)) == 0) { /* process it */ _sx_sasl_server_process(s, p, sd, NAD_CDATA(nad, 0), NAD_CDATA_L(nad, 0)); nad_free(nad); return 0; } /* success */ else if(NAD_ENAME_L(nad, 0) == 7 && strncmp("success", NAD_ENAME(nad, 0), NAD_ENAME_L(nad, 0)) == 0) { _sx_debug(ZONE, "sasl handshake completed, resetting"); nad_free(nad); /* save interesting bits */ flags = s->flags; if(s->ns != NULL) ns = strdup(s->ns); if(s->req_to != NULL) to = strdup(s->req_to); if(s->req_from != NULL) from = strdup(s->req_from); if(s->req_version != NULL) version = strdup(s->req_version); /* reset state */ _sx_reset(s); _sx_debug(ZONE, "restarting stream with sasl layer established"); /* second time round */ sx_client_init(s, flags, ns, to, from, version); /* free bits */ if(ns != NULL) free(ns); if(to != NULL) free(to); if(from != NULL) free(from); if(version != NULL) free(version); return 0; } /* failure */ else if(NAD_ENAME_L(nad, 0) == 7 && strncmp("failure", NAD_ENAME(nad, 0), NAD_ENAME_L(nad, 0)) == 0) { /* fire the error */ _sx_gen_error(sxe, SX_ERR_AUTH, "Authentication failed", NULL); _sx_event(s, event_ERROR, (void *) &sxe); /* cleanup */ gsasl_finish(sd); s->plugin_data[p->index] = NULL; nad_free(nad); return 0; } } /* invalid sasl command, quietly drop it */ _sx_debug(ZONE, "unknown sasl command '%.*s', ignoring", NAD_ENAME_L(nad, 0), NAD_ENAME(nad, 0)); nad_free(nad); return 0; }
7,569
168,746
0
void RenderWidgetHostImpl::ForwardMouseEventWithLatencyInfo( const blink::WebMouseEvent& mouse_event, const ui::LatencyInfo& latency) { TRACE_EVENT2("input", "RenderWidgetHostImpl::ForwardMouseEvent", "x", mouse_event.PositionInWidget().x, "y", mouse_event.PositionInWidget().y); DCHECK_GE(mouse_event.GetType(), blink::WebInputEvent::kMouseTypeFirst); DCHECK_LE(mouse_event.GetType(), blink::WebInputEvent::kMouseTypeLast); for (size_t i = 0; i < mouse_event_callbacks_.size(); ++i) { if (mouse_event_callbacks_[i].Run(mouse_event)) return; } if (ShouldDropInputEvents()) return; if (touch_emulator_ && touch_emulator_->HandleMouseEvent(mouse_event)) return; MouseEventWithLatencyInfo mouse_with_latency(mouse_event, latency); DispatchInputEventWithLatencyInfo(mouse_event, &mouse_with_latency.latency); input_router_->SendMouseEvent(mouse_with_latency); }
7,570
39,412
0
static int raw_cmd_ioctl(int cmd, void __user *param) { struct floppy_raw_cmd *my_raw_cmd; int drive; int ret2; int ret; if (FDCS->rawcmd <= 1) FDCS->rawcmd = 1; for (drive = 0; drive < N_DRIVE; drive++) { if (FDC(drive) != fdc) continue; if (drive == current_drive) { if (UDRS->fd_ref > 1) { FDCS->rawcmd = 2; break; } } else if (UDRS->fd_ref) { FDCS->rawcmd = 2; break; } } if (FDCS->reset) return -EIO; ret = raw_cmd_copyin(cmd, param, &my_raw_cmd); if (ret) { raw_cmd_free(&my_raw_cmd); return ret; } raw_cmd = my_raw_cmd; cont = &raw_cmd_cont; ret = wait_til_done(floppy_start, true); debug_dcl(DP->flags, "calling disk change from raw_cmd ioctl\n"); if (ret != -EINTR && FDCS->reset) ret = -EIO; DRS->track = NO_TRACK; ret2 = raw_cmd_copyout(cmd, param, my_raw_cmd); if (!ret) ret = ret2; raw_cmd_free(&my_raw_cmd); return ret; }
7,571
134,348
0
gfx::ImageSkia NewTabButton::GetImageForScale( ui::ScaleFactor scale_factor) const { if (!hover_animation_->is_animating()) return GetImageForState(state(), scale_factor); return gfx::ImageSkiaOperations::CreateBlendedImage( GetImageForState(views::CustomButton::STATE_NORMAL, scale_factor), GetImageForState(views::CustomButton::STATE_HOVERED, scale_factor), hover_animation_->GetCurrentValue()); }
7,572
6,576
0
bool Smb4KGlobal::removeShare( Smb4KShare *share ) { Q_ASSERT( share ); bool removed = false; mutex.lock(); int index = p->sharesList.indexOf( share ); if ( index != -1 ) { delete p->sharesList.takeAt( index ); removed = true; } else { Smb4KShare *s = findShare( share->shareName(), share->hostName(), share->workgroupName() ); if ( s ) { index = p->sharesList.indexOf( s ); if ( index != -1 ) { delete p->sharesList.takeAt( index ); removed = true; } else { } } else { } delete share; } mutex.unlock(); return removed; }
7,573
95,446
0
void QDECL Com_DPrintf( const char *fmt, ...) { va_list argptr; char msg[MAXPRINTMSG]; if ( !com_developer || !com_developer->integer ) { return; // don't confuse non-developers with techie stuff... } va_start (argptr,fmt); Q_vsnprintf (msg, sizeof(msg), fmt, argptr); va_end (argptr); Com_Printf ("%s", msg); }
7,574
58,654
0
void security_UINT32_le(BYTE* output, UINT32 value) { output[0] = (value) & 0xFF; output[1] = (value >> 8) & 0xFF; output[2] = (value >> 16) & 0xFF; output[3] = (value >> 24) & 0xFF; }
7,575
153,322
0
void Tab::FrameColorsChanged() { UpdateForegroundColors(); }
7,576
13,896
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); }
7,577
23,235
0
static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) { struct nfs4_exception exception = { }; int err; do { err = _nfs4_proc_setlk(state, cmd, request); if (err == -NFS4ERR_DENIED) err = -EAGAIN; err = nfs4_handle_exception(NFS_SERVER(state->inode), err, &exception); } while (exception.retry); return err; }
7,578
74,063
0
dwarf_elf_object_relocate_a_section(void* obj_in, Dwarf_Half section_index, Dwarf_Debug dbg, int* error) { int res = DW_DLV_ERROR; dwarf_elf_object_access_internals_t*obj = 0; struct Dwarf_Section_s * relocatablesec = 0; if (section_index == 0) { return DW_DLV_NO_ENTRY; } obj = (dwarf_elf_object_access_internals_t*)obj_in; /* The section to relocate must already be loaded into memory. */ res = find_section_to_relocate(dbg, section_index,&relocatablesec,error); if (res != DW_DLV_OK) { return res; } /* Sun and possibly others do not always set sh_link in .debug_* sections. So we cannot do full consistency checks. */ if (relocatablesec->dss_reloc_index == 0 ) { /* Something is wrong. */ *error = DW_DLE_RELOC_SECTION_MISSING_INDEX; return DW_DLV_ERROR; } /* Now load the relocations themselves. */ res = dwarf_elf_object_access_load_section(obj_in, relocatablesec->dss_reloc_index, &relocatablesec->dss_reloc_data, error); if (res != DW_DLV_OK) { return res; } /* Now get the symtab. */ if (!obj->symtab) { obj->symtab = &dbg->de_elf_symtab; obj->strtab = &dbg->de_elf_strtab; } if (obj->symtab->dss_index != relocatablesec->dss_reloc_link) { /* Something is wrong. */ *error = DW_DLE_RELOC_MISMATCH_RELOC_INDEX; return DW_DLV_ERROR; } if (obj->strtab->dss_index != obj->symtab->dss_link) { /* Something is wrong. */ *error = DW_DLE_RELOC_MISMATCH_STRTAB_INDEX; return DW_DLV_ERROR; } if (!obj->symtab->dss_data) { /* Now load the symtab */ res = dwarf_elf_object_access_load_section(obj_in, obj->symtab->dss_index, &obj->symtab->dss_data, error); if (res != DW_DLV_OK) { return res; } } if (!obj->strtab->dss_data) { /* Now load the strtab */ res = dwarf_elf_object_access_load_section(obj_in, obj->strtab->dss_index, &obj->strtab->dss_data,error); if (res != DW_DLV_OK){ return res; } } /* We have all the data we need in memory. */ res = loop_through_relocations(dbg,obj,relocatablesec,error); return res; }
7,579
34,123
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; }
7,580
156,130
0
void HTMLLinkElement::StartLoadingDynamicSheet() { DCHECK(GetLinkStyle()); GetLinkStyle()->StartLoadingDynamicSheet(); }
7,581
148,901
0
void RenderFrameHostManager::OnDidUpdateFrameOwnerProperties( const FrameOwnerProperties& properties) { if (!SiteIsolationPolicy::AreCrossProcessFramesPossible()) return; CHECK(frame_tree_node_->parent()); SiteInstance* parent_instance = frame_tree_node_->parent()->current_frame_host()->GetSiteInstance(); if (render_frame_host_->GetSiteInstance() != parent_instance) { render_frame_host_->Send(new FrameMsg_SetFrameOwnerProperties( render_frame_host_->GetRoutingID(), properties)); } for (const auto& pair : proxy_hosts_) { if (pair.second->GetSiteInstance() != parent_instance) { pair.second->Send(new FrameMsg_SetFrameOwnerProperties( pair.second->GetRoutingID(), properties)); } } }
7,582
105,313
0
void AutofillDownloadManager::SetPositiveUploadRate(double rate) { if (rate == positive_upload_rate_) return; positive_upload_rate_ = rate; DCHECK_GE(rate, 0.0); DCHECK_LE(rate, 1.0); DCHECK(profile_); PrefService* preferences = profile_->GetPrefs(); preferences->SetDouble(prefs::kAutofillPositiveUploadRate, rate); }
7,583
117,430
0
bool InputMethodBase::IsTextInputTypeNone() const { return GetTextInputType() == TEXT_INPUT_TYPE_NONE; }
7,584
61,041
0
delete_file_recursively (GFile *file, GCancellable *cancellable, DeleteCallback callback, gpointer callback_data) { gboolean success; g_autoptr (GError) error = NULL; do { g_autoptr (GFileEnumerator) enumerator = NULL; success = g_file_delete (file, cancellable, &error); if (success || !g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NOT_EMPTY)) { break; } g_clear_error (&error); enumerator = g_file_enumerate_children (file, G_FILE_ATTRIBUTE_STANDARD_NAME, G_FILE_QUERY_INFO_NONE, cancellable, &error); if (enumerator) { GFileInfo *info; success = TRUE; info = g_file_enumerator_next_file (enumerator, cancellable, &error); while (info != NULL) { g_autoptr (GFile) child = NULL; child = g_file_enumerator_get_child (enumerator, info); success = success && delete_file_recursively (child, cancellable, callback, callback_data); g_object_unref (info); info = g_file_enumerator_next_file (enumerator, cancellable, &error); } } if (error != NULL) { success = FALSE; } } while (success); if (callback) { callback (file, error, callback_data); } return success; }
7,585
75,285
0
static int next_segment(vorb *f) { int len; if (f->last_seg) return 0; if (f->next_seg == -1) { f->last_seg_which = f->segment_count-1; // in case start_page fails if (!start_page(f)) { f->last_seg = 1; return 0; } if (!(f->page_flag & PAGEFLAG_continued_packet)) return error(f, VORBIS_continued_packet_flag_invalid); } len = f->segments[f->next_seg++]; if (len < 255) { f->last_seg = TRUE; f->last_seg_which = f->next_seg-1; } if (f->next_seg >= f->segment_count) f->next_seg = -1; assert(f->bytes_in_seg == 0); f->bytes_in_seg = len; return len; }
7,586
138,063
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; }
7,587
41,694
0
static noinline int btrfs_update_inode_item(struct btrfs_trans_handle *trans, struct btrfs_root *root, struct inode *inode) { struct btrfs_inode_item *inode_item; struct btrfs_path *path; struct extent_buffer *leaf; int ret; path = btrfs_alloc_path(); if (!path) return -ENOMEM; path->leave_spinning = 1; ret = btrfs_lookup_inode(trans, root, path, &BTRFS_I(inode)->location, 1); if (ret) { if (ret > 0) ret = -ENOENT; goto failed; } leaf = path->nodes[0]; inode_item = btrfs_item_ptr(leaf, path->slots[0], struct btrfs_inode_item); fill_inode_item(trans, leaf, inode_item, inode); btrfs_mark_buffer_dirty(leaf); btrfs_set_inode_last_trans(trans, inode); ret = 0; failed: btrfs_free_path(path); return ret; }
7,588
18,481
0
netlink_send(int fd, struct cn_msg *msg) { struct nlmsghdr *nlh; unsigned int size; struct msghdr message; char buffer[64]; struct iovec iov[2]; size = NLMSG_SPACE(sizeof(struct cn_msg) + msg->len); nlh = (struct nlmsghdr *)buffer; nlh->nlmsg_seq = 0; nlh->nlmsg_pid = getpid(); nlh->nlmsg_type = NLMSG_DONE; nlh->nlmsg_len = NLMSG_LENGTH(size - sizeof(*nlh)); nlh->nlmsg_flags = 0; iov[0].iov_base = nlh; iov[0].iov_len = sizeof(*nlh); iov[1].iov_base = msg; iov[1].iov_len = size; memset(&message, 0, sizeof(message)); message.msg_name = &addr; message.msg_namelen = sizeof(addr); message.msg_iov = iov; message.msg_iovlen = 2; return sendmsg(fd, &message, 0); }
7,589
188,484
1
CuePoint::~CuePoint() { delete[] m_track_positions; }
7,590
4,103
0
void Splash::flattenCurve(SplashCoord x0, SplashCoord y0, SplashCoord x1, SplashCoord y1, SplashCoord x2, SplashCoord y2, SplashCoord x3, SplashCoord y3, SplashCoord *matrix, SplashCoord flatness2, SplashPath *fPath) { SplashCoord cx[splashMaxCurveSplits + 1][3]; SplashCoord cy[splashMaxCurveSplits + 1][3]; int cNext[splashMaxCurveSplits + 1]; SplashCoord xl0, xl1, xl2, xr0, xr1, xr2, xr3, xx1, xx2, xh; SplashCoord yl0, yl1, yl2, yr0, yr1, yr2, yr3, yy1, yy2, yh; SplashCoord dx, dy, mx, my, tx, ty, d1, d2; int p1, p2, p3; p1 = 0; p2 = splashMaxCurveSplits; cx[p1][0] = x0; cy[p1][0] = y0; cx[p1][1] = x1; cy[p1][1] = y1; cx[p1][2] = x2; cy[p1][2] = y2; cx[p2][0] = x3; cy[p2][0] = y3; cNext[p1] = p2; while (p1 < splashMaxCurveSplits) { xl0 = cx[p1][0]; yl0 = cy[p1][0]; xx1 = cx[p1][1]; yy1 = cy[p1][1]; xx2 = cx[p1][2]; yy2 = cy[p1][2]; p2 = cNext[p1]; xr3 = cx[p2][0]; yr3 = cy[p2][0]; transform(matrix, (xl0 + xr3) * 0.5, (yl0 + yr3) * 0.5, &mx, &my); transform(matrix, xx1, yy1, &tx, &ty); #if USE_FIXEDPOINT d1 = splashDist(tx, ty, mx, my); #else dx = tx - mx; dy = ty - my; d1 = dx*dx + dy*dy; #endif transform(matrix, xx2, yy2, &tx, &ty); #if USE_FIXEDPOINT d2 = splashDist(tx, ty, mx, my); #else dx = tx - mx; dy = ty - my; d2 = dx*dx + dy*dy; #endif if (p2 - p1 == 1 || (d1 <= flatness2 && d2 <= flatness2)) { fPath->lineTo(xr3, yr3); p1 = p2; } else { xl1 = splashAvg(xl0, xx1); yl1 = splashAvg(yl0, yy1); xh = splashAvg(xx1, xx2); yh = splashAvg(yy1, yy2); xl2 = splashAvg(xl1, xh); yl2 = splashAvg(yl1, yh); xr2 = splashAvg(xx2, xr3); yr2 = splashAvg(yy2, yr3); xr1 = splashAvg(xh, xr2); yr1 = splashAvg(yh, yr2); xr0 = splashAvg(xl2, xr1); yr0 = splashAvg(yl2, yr1); p3 = (p1 + p2) / 2; cx[p1][1] = xl1; cy[p1][1] = yl1; cx[p1][2] = xl2; cy[p1][2] = yl2; cNext[p1] = p3; cx[p3][0] = xr0; cy[p3][0] = yr0; cx[p3][1] = xr1; cy[p3][1] = yr1; cx[p3][2] = xr2; cy[p3][2] = yr2; cNext[p3] = p2; } } }
7,591
51,293
0
static void php_zip_get_from(INTERNAL_FUNCTION_PARAMETERS, int type) /* {{{ */ { struct zip *intern; zval *this = getThis(); struct zip_stat sb; struct zip_file *zf; char *filename; int filename_len; long index = -1; long flags = 0; long len = 0; char *buffer; int n = 0; if (!this) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, this); if (type == 1) { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|ll", &filename, &filename_len, &len, &flags) == FAILURE) { return; } PHP_ZIP_STAT_PATH(intern, filename, filename_len, flags, sb); } else { if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l|ll", &index, &len, &flags) == FAILURE) { return; } PHP_ZIP_STAT_INDEX(intern, index, 0, sb); } if (sb.size < 1) { RETURN_EMPTY_STRING(); } if (len < 1) { len = sb.size; } if (index >= 0) { zf = zip_fopen_index(intern, index, flags); } else { zf = zip_fopen(intern, filename, flags); } if (zf == NULL) { RETURN_FALSE; } buffer = safe_emalloc(len, 1, 2); n = zip_fread(zf, buffer, len); if (n < 1) { efree(buffer); RETURN_EMPTY_STRING(); } zip_fclose(zf); buffer[n] = 0; RETURN_STRINGL(buffer, n, 0); } /* }}} */
7,592
38,013
0
static unsigned long __peek_user(struct task_struct *child, addr_t addr) { struct user *dummy = NULL; addr_t offset, tmp; if (addr < (addr_t) &dummy->regs.acrs) { /* * psw and gprs are stored on the stack */ tmp = *(addr_t *)((addr_t) &task_pt_regs(child)->psw + addr); if (addr == (addr_t) &dummy->regs.psw.mask) { /* Return a clean psw mask. */ tmp &= PSW_MASK_USER | PSW_MASK_RI; tmp |= PSW_USER_BITS; } } else if (addr < (addr_t) &dummy->regs.orig_gpr2) { /* * access registers are stored in the thread structure */ offset = addr - (addr_t) &dummy->regs.acrs; #ifdef CONFIG_64BIT /* * Very special case: old & broken 64 bit gdb reading * from acrs[15]. Result is a 64 bit value. Read the * 32 bit acrs[15] value and shift it by 32. Sick... */ if (addr == (addr_t) &dummy->regs.acrs[15]) tmp = ((unsigned long) child->thread.acrs[15]) << 32; else #endif tmp = *(addr_t *)((addr_t) &child->thread.acrs + offset); } else if (addr == (addr_t) &dummy->regs.orig_gpr2) { /* * orig_gpr2 is stored on the kernel stack */ tmp = (addr_t) task_pt_regs(child)->orig_gpr2; } else if (addr < (addr_t) &dummy->regs.fp_regs) { /* * prevent reads of padding hole between * orig_gpr2 and fp_regs on s390. */ tmp = 0; } else if (addr < (addr_t) (&dummy->regs.fp_regs + 1)) { /* * floating point regs. are stored in the thread structure */ offset = addr - (addr_t) &dummy->regs.fp_regs; tmp = *(addr_t *)((addr_t) &child->thread.fp_regs + offset); if (addr == (addr_t) &dummy->regs.fp_regs.fpc) tmp <<= BITS_PER_LONG - 32; } else if (addr < (addr_t) (&dummy->regs.per_info + 1)) { /* * Handle access to the per_info structure. */ addr -= (addr_t) &dummy->regs.per_info; tmp = __peek_user_per(child, addr); } else tmp = 0; return tmp; }
7,593
138,475
0
void HTMLScriptRunner::execute(PassRefPtrWillBeRawPtr<Element> scriptElement, const TextPosition& scriptStartPosition) { ASSERT(scriptElement); bool hadPreloadScanner = m_host->hasPreloadScanner(); runScript(scriptElement.get(), scriptStartPosition); if (hasParserBlockingScript()) { if (isExecutingScript()) return; // Unwind to the outermost HTMLScriptRunner::execute before continuing parsing. if (!hadPreloadScanner && m_host->hasPreloadScanner()) m_host->appendCurrentInputStreamToPreloadScannerAndScan(); executeParsingBlockingScripts(); } }
7,594
100,910
0
void TaskManagerHandler::HandleActivatePage(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_->ActivateProcess(resource_index); break; } }
7,595
45,965
0
process(struct magic_set *ms, const char *inname, int wid) { const char *type; int std_in = strcmp(inname, "-") == 0; if (wid > 0 && !bflag) { (void)printf("%s", std_in ? "/dev/stdin" : inname); if (nulsep) (void)putc('\0', stdout); (void)printf("%s", separator); (void)printf("%*s ", (int) (nopad ? 0 : (wid - file_mbswidth(inname))), ""); } type = magic_file(ms, std_in ? NULL : inname); if (type == NULL) { (void)printf("ERROR: %s\n", magic_error(ms)); return 1; } else { (void)printf("%s\n", type); return 0; } }
7,596
152,852
0
MetricsWebContentsObserver::TestingObserver::TestingObserver( content::WebContents* web_contents) : observer_(page_load_metrics::MetricsWebContentsObserver::FromWebContents( web_contents)) { observer_->AddTestingObserver(this); }
7,597
107,463
0
static void _ewk_view_on_mouse_move(void* data, Evas* eventType, Evas_Object* callback, void* eventInfo) { Evas_Event_Mouse_Move* moveEvent = static_cast<Evas_Event_Mouse_Move*>(eventInfo); Ewk_View_Smart_Data* smartData = static_cast<Ewk_View_Smart_Data*>(data); EINA_SAFETY_ON_NULL_RETURN(smartData->api); EINA_SAFETY_ON_NULL_RETURN(smartData->api->mouse_move); smartData->api->mouse_move(smartData, moveEvent); }
7,598
165,896
0
void RenderFrameImpl::DidHandleOnloadEvents() { if (!frame_->Parent()) { Send(new FrameHostMsg_DocumentOnLoadCompleted(routing_id_)); } for (auto& observer : observers_) observer.DidHandleOnloadEvents(); }
7,599