unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
60,339
0
handle_new(int use, const char *name, int fd, int flags, DIR *dirp) { int i; if (first_unused_handle == -1) { if (num_handles + 1 <= num_handles) return -1; num_handles++; handles = xreallocarray(handles, num_handles, sizeof(Handle)); handle_unused(num_handles - 1); } i = first_unused_handle; first_unused_handle = handles[i].next_unused; handles[i].use = use; handles[i].dirp = dirp; handles[i].fd = fd; handles[i].flags = flags; handles[i].name = xstrdup(name); handles[i].bytes_read = handles[i].bytes_write = 0; return i; }
14,100
39,382
0
static void floppy_shutdown(struct work_struct *arg) { unsigned long flags; if (initialized) show_floppy(); cancel_activity(); flags = claim_dma_lock(); fd_disable_dma(); release_dma_lock(flags); /* avoid dma going to a random drive after shutdown */ if (initialized) DPRINT("floppy timeout called\n"); FDCS->reset = 1; if (cont) { cont->done(0); cont->redo(); /* this will recall reset when needed */ } else { pr_info("no cont in shutdown!\n"); process_fd_request(); } is_alive(__func__, ""); }
14,101
41,205
0
tcp_sacktag_write_queue(struct sock *sk, const struct sk_buff *ack_skb, u32 prior_snd_una) { const struct inet_connection_sock *icsk = inet_csk(sk); struct tcp_sock *tp = tcp_sk(sk); const unsigned char *ptr = (skb_transport_header(ack_skb) + TCP_SKB_CB(ack_skb)->sacked); struct tcp_sack_block_wire *sp_wire = (struct tcp_sack_block_wire *)(ptr+2); struct tcp_sack_block sp[TCP_NUM_SACKS]; struct tcp_sack_block *cache; struct tcp_sacktag_state state; struct sk_buff *skb; int num_sacks = min(TCP_NUM_SACKS, (ptr[1] - TCPOLEN_SACK_BASE) >> 3); int used_sacks; int found_dup_sack = 0; int i, j; int first_sack_index; state.flag = 0; state.reord = tp->packets_out; if (!tp->sacked_out) { if (WARN_ON(tp->fackets_out)) tp->fackets_out = 0; tcp_highest_sack_reset(sk); } found_dup_sack = tcp_check_dsack(sk, ack_skb, sp_wire, num_sacks, prior_snd_una); if (found_dup_sack) state.flag |= FLAG_DSACKING_ACK; /* Eliminate too old ACKs, but take into * account more or less fresh ones, they can * contain valid SACK info. */ if (before(TCP_SKB_CB(ack_skb)->ack_seq, prior_snd_una - tp->max_window)) return 0; if (!tp->packets_out) goto out; used_sacks = 0; first_sack_index = 0; for (i = 0; i < num_sacks; i++) { int dup_sack = !i && found_dup_sack; sp[used_sacks].start_seq = get_unaligned_be32(&sp_wire[i].start_seq); sp[used_sacks].end_seq = get_unaligned_be32(&sp_wire[i].end_seq); if (!tcp_is_sackblock_valid(tp, dup_sack, sp[used_sacks].start_seq, sp[used_sacks].end_seq)) { int mib_idx; if (dup_sack) { if (!tp->undo_marker) mib_idx = LINUX_MIB_TCPDSACKIGNOREDNOUNDO; else mib_idx = LINUX_MIB_TCPDSACKIGNOREDOLD; } else { /* Don't count olds caused by ACK reordering */ if ((TCP_SKB_CB(ack_skb)->ack_seq != tp->snd_una) && !after(sp[used_sacks].end_seq, tp->snd_una)) continue; mib_idx = LINUX_MIB_TCPSACKDISCARD; } NET_INC_STATS_BH(sock_net(sk), mib_idx); if (i == 0) first_sack_index = -1; continue; } /* Ignore very old stuff early */ if (!after(sp[used_sacks].end_seq, prior_snd_una)) continue; used_sacks++; } /* order SACK blocks to allow in order walk of the retrans queue */ for (i = used_sacks - 1; i > 0; i--) { for (j = 0; j < i; j++) { if (after(sp[j].start_seq, sp[j + 1].start_seq)) { swap(sp[j], sp[j + 1]); /* Track where the first SACK block goes to */ if (j == first_sack_index) first_sack_index = j + 1; } } } skb = tcp_write_queue_head(sk); state.fack_count = 0; i = 0; if (!tp->sacked_out) { /* It's already past, so skip checking against it */ cache = tp->recv_sack_cache + ARRAY_SIZE(tp->recv_sack_cache); } else { cache = tp->recv_sack_cache; /* Skip empty blocks in at head of the cache */ while (tcp_sack_cache_ok(tp, cache) && !cache->start_seq && !cache->end_seq) cache++; } while (i < used_sacks) { u32 start_seq = sp[i].start_seq; u32 end_seq = sp[i].end_seq; int dup_sack = (found_dup_sack && (i == first_sack_index)); struct tcp_sack_block *next_dup = NULL; if (found_dup_sack && ((i + 1) == first_sack_index)) next_dup = &sp[i + 1]; /* Event "B" in the comment above. */ if (after(end_seq, tp->high_seq)) state.flag |= FLAG_DATA_LOST; /* Skip too early cached blocks */ while (tcp_sack_cache_ok(tp, cache) && !before(start_seq, cache->end_seq)) cache++; /* Can skip some work by looking recv_sack_cache? */ if (tcp_sack_cache_ok(tp, cache) && !dup_sack && after(end_seq, cache->start_seq)) { /* Head todo? */ if (before(start_seq, cache->start_seq)) { skb = tcp_sacktag_skip(skb, sk, &state, start_seq); skb = tcp_sacktag_walk(skb, sk, next_dup, &state, start_seq, cache->start_seq, dup_sack); } /* Rest of the block already fully processed? */ if (!after(end_seq, cache->end_seq)) goto advance_sp; skb = tcp_maybe_skipping_dsack(skb, sk, next_dup, &state, cache->end_seq); /* ...tail remains todo... */ if (tcp_highest_sack_seq(tp) == cache->end_seq) { /* ...but better entrypoint exists! */ skb = tcp_highest_sack(sk); if (skb == NULL) break; state.fack_count = tp->fackets_out; cache++; goto walk; } skb = tcp_sacktag_skip(skb, sk, &state, cache->end_seq); /* Check overlap against next cached too (past this one already) */ cache++; continue; } if (!before(start_seq, tcp_highest_sack_seq(tp))) { skb = tcp_highest_sack(sk); if (skb == NULL) break; state.fack_count = tp->fackets_out; } skb = tcp_sacktag_skip(skb, sk, &state, start_seq); walk: skb = tcp_sacktag_walk(skb, sk, next_dup, &state, start_seq, end_seq, dup_sack); advance_sp: /* SACK enhanced FRTO (RFC4138, Appendix B): Clearing correct * due to in-order walk */ if (after(end_seq, tp->frto_highmark)) state.flag &= ~FLAG_ONLY_ORIG_SACKED; i++; } /* Clear the head of the cache sack blocks so we can skip it next time */ for (i = 0; i < ARRAY_SIZE(tp->recv_sack_cache) - used_sacks; i++) { tp->recv_sack_cache[i].start_seq = 0; tp->recv_sack_cache[i].end_seq = 0; } for (j = 0; j < used_sacks; j++) tp->recv_sack_cache[i++] = sp[j]; tcp_mark_lost_retrans(sk); tcp_verify_left_out(tp); if ((state.reord < tp->fackets_out) && ((icsk->icsk_ca_state != TCP_CA_Loss) || tp->undo_marker) && (!tp->frto_highmark || after(tp->snd_una, tp->frto_highmark))) tcp_update_reordering(sk, tp->fackets_out - state.reord, 0); out: #if FASTRETRANS_DEBUG > 0 WARN_ON((int)tp->sacked_out < 0); WARN_ON((int)tp->lost_out < 0); WARN_ON((int)tp->retrans_out < 0); WARN_ON((int)tcp_packets_in_flight(tp) < 0); #endif return state.flag; }
14,102
89,511
0
SWFShape_getFills(SWFShape shape, SWFFillStyle** fills, int* nFills) { *fills = shape->fills; *nFills = shape->nFills; }
14,103
179,626
1
static __always_inline int __do_follow_link(struct path *path, struct nameidata *nd) { int error; void *cookie; struct dentry *dentry = path->dentry; touch_atime(path->mnt, dentry); nd_set_link(nd, NULL); if (path->mnt != nd->path.mnt) { path_to_nameidata(path, nd); dget(dentry); } mntget(path->mnt); cookie = dentry->d_inode->i_op->follow_link(dentry, nd); error = PTR_ERR(cookie); if (!IS_ERR(cookie)) { char *s = nd_get_link(nd); error = 0; if (s) error = __vfs_follow_link(nd, s); else if (nd->last_type == LAST_BIND) { error = force_reval_path(&nd->path, nd); if (error) path_put(&nd->path); } if (dentry->d_inode->i_op->put_link) dentry->d_inode->i_op->put_link(dentry, nd, cookie); } return error; }
14,104
135,932
0
static void collectChildrenAndRemoveFromOldParent(Node& node, NodeVector& nodes, ExceptionState& exceptionState) { if (node.isDocumentFragment()) { DocumentFragment& fragment = toDocumentFragment(node); getChildNodes(fragment, nodes); fragment.removeChildren(); return; } nodes.append(&node); if (ContainerNode* oldParent = node.parentNode()) oldParent->removeChild(&node, exceptionState); }
14,105
137,712
0
bool PrintViewManagerBase::RenderAllMissingPagesNow() { if (!print_job_.get() || !print_job_->is_job_pending()) return false; if (!web_contents() || !web_contents()->GetRenderViewHost() || !web_contents()->GetRenderViewHost()->IsRenderViewLive()) { return false; } if (print_job_->document() && print_job_->document()->IsComplete()) { printing_succeeded_ = true; return true; } if (!RunInnerMessageLoop()) { return false; } return true; }
14,106
138,887
0
void WallpaperManager::InitializeRegisteredDeviceWallpaper() { if (user_manager::UserManager::Get()->IsUserLoggedIn()) return; bool disable_boot_animation = GetCommandLine()->HasSwitch(switches::kDisableBootAnimation); bool show_users = true; bool result = CrosSettings::Get()->GetBoolean( kAccountsPrefShowUserNamesOnSignIn, &show_users); DCHECK(result) << "Unable to fetch setting " << kAccountsPrefShowUserNamesOnSignIn; const user_manager::UserList& users = user_manager::UserManager::Get()->GetUsers(); int public_session_user_index = FindPublicSession(users); if ((!show_users && public_session_user_index == -1) || !HasNonDeviceLocalAccounts(users)) { if (!SetDeviceWallpaperIfApplicable(user_manager::SignInAccountId())) SetDefaultWallpaperDelayed(user_manager::SignInAccountId()); return; } if (!disable_boot_animation) { int index = public_session_user_index != -1 ? public_session_user_index : 0; SetUserWallpaperDelayed(users[index]->GetAccountId()); } }
14,107
181,268
1
MagickExport Image *CloneImage(const Image *image,const size_t columns, const size_t rows,const MagickBooleanType detach,ExceptionInfo *exception) { double scale; Image *clone_image; size_t length; /* Clone the image. */ assert(image != (const 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); if ((image->columns == 0) || (image->rows == 0)) { (void) ThrowMagickException(exception,GetMagickModule(),CorruptImageError, "NegativeOrZeroImageSize","`%s'",image->filename); return((Image *) NULL); } clone_image=(Image *) AcquireMagickMemory(sizeof(*clone_image)); if (clone_image == (Image *) NULL) ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); (void) ResetMagickMemory(clone_image,0,sizeof(*clone_image)); clone_image->signature=MagickSignature; clone_image->storage_class=image->storage_class; clone_image->channels=image->channels; clone_image->colorspace=image->colorspace; clone_image->matte=image->matte; clone_image->columns=image->columns; clone_image->rows=image->rows; clone_image->dither=image->dither; if (image->colormap != (PixelPacket *) NULL) { /* Allocate and copy the image colormap. */ clone_image->colors=image->colors; length=(size_t) image->colors; clone_image->colormap=(PixelPacket *) AcquireQuantumMemory(length, sizeof(*clone_image->colormap)); if (clone_image->colormap == (PixelPacket *) NULL) { clone_image=DestroyImage(clone_image); ThrowImageException(ResourceLimitError,"MemoryAllocationFailed"); } (void) CopyMagickMemory(clone_image->colormap,image->colormap,length* sizeof(*clone_image->colormap)); } (void) CloneImageProfiles(clone_image,image); (void) CloneImageProperties(clone_image,image); (void) CloneImageArtifacts(clone_image,image); GetTimerInfo(&clone_image->timer); InitializeExceptionInfo(&clone_image->exception); InheritException(&clone_image->exception,&image->exception); if (image->ascii85 != (void *) NULL) Ascii85Initialize(clone_image); clone_image->magick_columns=image->magick_columns; clone_image->magick_rows=image->magick_rows; clone_image->type=image->type; (void) CopyMagickString(clone_image->magick_filename,image->magick_filename, MaxTextExtent); (void) CopyMagickString(clone_image->magick,image->magick,MaxTextExtent); (void) CopyMagickString(clone_image->filename,image->filename,MaxTextExtent); clone_image->progress_monitor=image->progress_monitor; clone_image->client_data=image->client_data; clone_image->reference_count=1; clone_image->next=image->next; clone_image->previous=image->previous; clone_image->list=NewImageList(); clone_image->clip_mask=NewImageList(); clone_image->mask=NewImageList(); if (detach == MagickFalse) clone_image->blob=ReferenceBlob(image->blob); else { clone_image->next=NewImageList(); clone_image->previous=NewImageList(); clone_image->blob=CloneBlobInfo((BlobInfo *) NULL); } clone_image->ping=image->ping; clone_image->debug=IsEventLogging(); clone_image->semaphore=AllocateSemaphoreInfo(); if ((columns == 0) || (rows == 0)) { if (image->montage != (char *) NULL) (void) CloneString(&clone_image->montage,image->montage); if (image->directory != (char *) NULL) (void) CloneString(&clone_image->directory,image->directory); if (image->clip_mask != (Image *) NULL) clone_image->clip_mask=CloneImage(image->clip_mask,0,0,MagickTrue, exception); if (image->mask != (Image *) NULL) clone_image->mask=CloneImage(image->mask,0,0,MagickTrue,exception); clone_image->cache=ReferencePixelCache(image->cache); return(clone_image); } if ((columns == image->columns) && (rows == image->rows)) { if (image->clip_mask != (Image *) NULL) clone_image->clip_mask=CloneImage(image->clip_mask,0,0,MagickTrue, exception); if (image->mask != (Image *) NULL) clone_image->mask=CloneImage(image->mask,0,0,MagickTrue,exception); } scale=1.0; if (image->columns != 0) scale=(double) columns/(double) image->columns; clone_image->page.width=(size_t) floor(scale*image->page.width+0.5); clone_image->page.x=(ssize_t) ceil(scale*image->page.x-0.5); clone_image->tile_offset.x=(ssize_t) ceil(scale*image->tile_offset.x-0.5); scale=1.0; if (image->rows != 0) scale=(double) rows/(double) image->rows; clone_image->page.height=(size_t) floor(scale*image->page.height+0.5); clone_image->page.y=(ssize_t) ceil(scale*image->page.y-0.5); clone_image->tile_offset.y=(ssize_t) ceil(scale*image->tile_offset.y-0.5); clone_image->cache=ClonePixelCache(image->cache); if (SetImageExtent(clone_image,columns,rows) == MagickFalse) { InheritException(exception,&clone_image->exception); clone_image=DestroyImage(clone_image); } return(clone_image); }
14,108
44,974
0
xfs_attr_rmtval_copyout( struct xfs_mount *mp, struct xfs_buf *bp, xfs_ino_t ino, int *offset, int *valuelen, __uint8_t **dst) { char *src = bp->b_addr; xfs_daddr_t bno = bp->b_bn; int len = BBTOB(bp->b_length); ASSERT(len >= XFS_LBSIZE(mp)); while (len > 0 && *valuelen > 0) { int hdr_size = 0; int byte_cnt = XFS_ATTR3_RMT_BUF_SPACE(mp, XFS_LBSIZE(mp)); byte_cnt = min(*valuelen, byte_cnt); if (xfs_sb_version_hascrc(&mp->m_sb)) { if (!xfs_attr3_rmt_hdr_ok(mp, src, ino, *offset, byte_cnt, bno)) { xfs_alert(mp, "remote attribute header mismatch bno/off/len/owner (0x%llx/0x%x/Ox%x/0x%llx)", bno, *offset, byte_cnt, ino); return EFSCORRUPTED; } hdr_size = sizeof(struct xfs_attr3_rmt_hdr); } memcpy(*dst, src + hdr_size, byte_cnt); /* roll buffer forwards */ len -= XFS_LBSIZE(mp); src += XFS_LBSIZE(mp); bno += mp->m_bsize; /* roll attribute data forwards */ *valuelen -= byte_cnt; *dst += byte_cnt; *offset += byte_cnt; } return 0; }
14,109
27,265
0
static void insert_to_mm_slots_hash(struct mm_struct *mm, struct mm_slot *mm_slot) { struct hlist_head *bucket; bucket = &mm_slots_hash[hash_ptr(mm, MM_SLOTS_HASH_SHIFT)]; mm_slot->mm = mm; hlist_add_head(&mm_slot->link, bucket); }
14,110
144,528
0
base::TimeTicks WebContentsImpl::GetLastActiveTime() const { return last_active_time_; }
14,111
103,827
0
void RenderView::OnScriptEvalRequest(const string16& frame_xpath, const string16& jscript, int id, bool notify_result) { EvaluateScript(frame_xpath, jscript, id, notify_result); }
14,112
12,438
0
static char *spl_object_storage_get_hash(spl_SplObjectStorage *intern, zval *this, zval *obj, int *hash_len_ptr TSRMLS_DC) { if (intern->fptr_get_hash) { zval *rv; zend_call_method_with_1_params(&this, intern->std.ce, &intern->fptr_get_hash, "getHash", &rv, obj); if (rv) { if (Z_TYPE_P(rv) == IS_STRING) { int hash_len = Z_STRLEN_P(rv); char *hash = emalloc((hash_len+1)*sizeof(char)); strncpy(hash, Z_STRVAL_P(rv), hash_len); hash[hash_len] = 0; zval_ptr_dtor(&rv); if (hash_len_ptr) { *hash_len_ptr = hash_len; } return hash; } else { zend_throw_exception(spl_ce_RuntimeException, "Hash needs to be a string", 0 TSRMLS_CC); zval_ptr_dtor(&rv); return NULL; } } else { return NULL; } } else { int hash_len = sizeof(zend_object_value); #if HAVE_PACKED_OBJECT_VALUE if (hash_len_ptr) { *hash_len_ptr = hash_len; } return (char*)&Z_OBJVAL_P(obj); #else char *hash = emalloc(hash_len + 1); zend_object_value zvalue; memset(&zvalue, 0, sizeof(zend_object_value)); zvalue.handle = Z_OBJ_HANDLE_P(obj); zvalue.handlers = Z_OBJ_HT_P(obj); memcpy(hash, (char *)&zvalue, hash_len); hash[hash_len] = 0; if (hash_len_ptr) { *hash_len_ptr = hash_len; } return hash; #endif } }
14,113
60,744
0
pkinit_fini_pkinit_oids(pkinit_plg_crypto_context ctx) { if (ctx == NULL) return; ASN1_OBJECT_free(ctx->id_pkinit_san); ASN1_OBJECT_free(ctx->id_pkinit_authData); ASN1_OBJECT_free(ctx->id_pkinit_DHKeyData); ASN1_OBJECT_free(ctx->id_pkinit_rkeyData); ASN1_OBJECT_free(ctx->id_pkinit_KPClientAuth); ASN1_OBJECT_free(ctx->id_pkinit_KPKdc); ASN1_OBJECT_free(ctx->id_ms_kp_sc_logon); ASN1_OBJECT_free(ctx->id_ms_san_upn); ASN1_OBJECT_free(ctx->id_kp_serverAuth); }
14,114
158,474
0
bool context_menu_request_received() const { return context_menu_request_received_; }
14,115
186,432
1
std::string SanitizeRevision(const std::string& revision) { for (size_t i = 0; i < revision.length(); i++) { if (!(revision[i] == '@' && i == 0) && !(revision[i] >= '0' && revision[i] <= '9') && !(revision[i] >= 'a' && revision[i] <= 'z') && !(revision[i] >= 'A' && revision[i] <= 'Z')) { return std::string(); } } return revision; }
14,116
49,700
0
void disk_unblock_events(struct gendisk *disk) { if (disk->ev) __disk_unblock_events(disk, false); }
14,117
111,170
0
void WebPage::goToBackForwardEntry(BackForwardId id) { HistoryItem* item = historyItemFromBackForwardId(id); ASSERT(item); d->m_page->goToItem(item, FrameLoadTypeIndexedBackForward); }
14,118
86,375
0
u32 hugetlb_fault_mutex_hash(struct hstate *h, struct mm_struct *mm, struct vm_area_struct *vma, struct address_space *mapping, pgoff_t idx, unsigned long address) { return 0; }
14,119
100,979
0
static void texImage2DResourceSafe(size_t width, size_t height) { const int pixelSize = 4; // RGBA OwnArrayPtr<unsigned char> zero; if (width && height) { unsigned int size = width * height * pixelSize; zero = adoptArrayPtr(new unsigned char[size]); memset(zero.get(), 0, size); } GL_CMD(glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, zero.get())) }
14,120
86,620
0
void fpm_stdio_child_use_pipes(struct fpm_child_s *child) /* {{{ */ { if (child->wp->config->catch_workers_output) { dup2(fd_stdout[1], STDOUT_FILENO); dup2(fd_stderr[1], STDERR_FILENO); close(fd_stdout[0]); close(fd_stdout[1]); close(fd_stderr[0]); close(fd_stderr[1]); } else { /* stdout of parent is always /dev/null */ dup2(STDOUT_FILENO, STDERR_FILENO); } } /* }}} */
14,121
24,715
0
mktime(const unsigned int year0, const unsigned int mon0, const unsigned int day, const unsigned int hour, const unsigned int min, const unsigned int sec) { unsigned int mon = mon0, year = year0; /* 1..12 -> 11,12,1..10 */ if (0 >= (int) (mon -= 2)) { mon += 12; /* Puts Feb last since it has leap day */ year -= 1; } return ((((unsigned long) (year/4 - year/100 + year/400 + 367*mon/12 + day) + year*365 - 719499 )*24 + hour /* now have hours */ )*60 + min /* now have minutes */ )*60 + sec; /* finally seconds */ }
14,122
149,313
0
void DatabaseImpl::RemoveObservers(const std::vector<int32_t>& observers) { idb_runner_->PostTask(FROM_HERE, base::Bind(&IDBThreadHelper::RemoveObservers, base::Unretained(helper_), observers)); }
14,123
51,952
0
SpoolssEnumPrinters_q(tvbuff_t *tvb, int offset, packet_info *pinfo, proto_tree *tree, dcerpc_info *di, guint8 *drep _U_) { guint32 level, flags; dcerpc_call_value *dcv = (dcerpc_call_value *)di->call_data; static const int * hf_flags[] = { &hf_enumprinters_flags_network, &hf_enumprinters_flags_shared, &hf_enumprinters_flags_remote, &hf_enumprinters_flags_name, &hf_enumprinters_flags_connections, &hf_enumprinters_flags_local, &hf_enumprinters_flags_default, NULL }; /* Parse packet */ offset = dissect_ndr_uint32(tvb, offset, pinfo, NULL, di, drep, -1, &flags); proto_tree_add_bitmask_value(tree, tvb, offset - 4, hf_enumprinters_flags, ett_enumprinters_flags, hf_flags, flags); offset = dissect_ndr_str_pointer_item( tvb, offset, pinfo, tree, di, drep, NDR_POINTER_UNIQUE, "Server name", hf_servername, 0); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_level, &level); /* GetPrinter() stores the level in se_data */ if(!pinfo->fd->flags.visited){ dcv->se_data = GINT_TO_POINTER((int)level); } col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level); offset = dissect_spoolss_buffer( tvb, offset, pinfo, tree, di, drep, NULL); offset = dissect_ndr_uint32( tvb, offset, pinfo, tree, di, drep, hf_offered, NULL); return offset; }
14,124
35,654
0
handle_annotation(struct magic_set *ms, struct magic *m) { if (ms->flags & MAGIC_APPLE) { if (file_printf(ms, "%.8s", m->apple) == -1) return -1; return 1; } if ((ms->flags & MAGIC_MIME_TYPE) && m->mimetype[0]) { if (file_printf(ms, "%s", m->mimetype) == -1) return -1; return 1; } return 0; }
14,125
109,023
0
void RenderViewImpl::Repaint(const gfx::Size& size) { OnMsgRepaint(size); }
14,126
174,933
0
Camera2Client::~Camera2Client() { ATRACE_CALL(); ALOGV("~Camera2Client"); mDestructionStarted = true; disconnect(); ALOGI("Camera %d: Closed", mCameraId); }
14,127
81,847
0
int wc_X963_KDF(enum wc_HashType type, const byte* secret, word32 secretSz, const byte* sinfo, word32 sinfoSz, byte* out, word32 outSz) { int ret, i; int digestSz, copySz; int remaining = outSz; byte* outIdx; byte counter[4]; byte tmp[WC_MAX_DIGEST_SIZE]; #ifdef WOLFSSL_SMALL_STACK wc_HashAlg* hash; #else wc_HashAlg hash[1]; #endif if (secret == NULL || secretSz == 0 || out == NULL) return BAD_FUNC_ARG; /* X9.63 allowed algos only */ if (type != WC_HASH_TYPE_SHA && type != WC_HASH_TYPE_SHA224 && type != WC_HASH_TYPE_SHA256 && type != WC_HASH_TYPE_SHA384 && type != WC_HASH_TYPE_SHA512) return BAD_FUNC_ARG; digestSz = wc_HashGetDigestSize(type); if (digestSz < 0) return digestSz; #ifdef WOLFSSL_SMALL_STACK hash = (wc_HashAlg*)XMALLOC(sizeof(wc_HashAlg), NULL, DYNAMIC_TYPE_HASHES); if (hash == NULL) return MEMORY_E; #endif ret = wc_HashInit(hash, type); if (ret != 0) { #ifdef WOLFSSL_SMALL_STACK XFREE(hash, NULL, DYNAMIC_TYPE_HASHES); #endif return ret; } outIdx = out; XMEMSET(counter, 0, sizeof(counter)); for (i = 1; remaining > 0; i++) { IncrementX963KdfCounter(counter); ret = wc_HashUpdate(hash, type, secret, secretSz); if (ret != 0) { #ifdef WOLFSSL_SMALL_STACK XFREE(hash, NULL, DYNAMIC_TYPE_HASHES); #endif return ret; } ret = wc_HashUpdate(hash, type, counter, sizeof(counter)); if (ret != 0) { #ifdef WOLFSSL_SMALL_STACK XFREE(hash, NULL, DYNAMIC_TYPE_HASHES); #endif return ret; } if (sinfo) { ret = wc_HashUpdate(hash, type, sinfo, sinfoSz); if (ret != 0) { #ifdef WOLFSSL_SMALL_STACK XFREE(hash, NULL, DYNAMIC_TYPE_HASHES); #endif return ret; } } ret = wc_HashFinal(hash, type, tmp); if (ret != 0) { #ifdef WOLFSSL_SMALL_STACK XFREE(hash, NULL, DYNAMIC_TYPE_HASHES); #endif return ret; } copySz = min(remaining, digestSz); XMEMCPY(outIdx, tmp, copySz); remaining -= copySz; outIdx += copySz; } #ifdef WOLFSSL_SMALL_STACK XFREE(hash, NULL, DYNAMIC_TYPE_HASHES); #endif return 0; }
14,128
132,252
0
void RenderFrameImpl::OnStop() { DCHECK(frame_); frame_->stopLoading(); if (!frame_->parent()) FOR_EACH_OBSERVER(RenderViewObserver, render_view_->observers_, OnStop()); FOR_EACH_OBSERVER(RenderFrameObserver, observers_, OnStop()); }
14,129
186,760
1
void ServiceWorkerDevToolsAgentHost::AttachSession(DevToolsSession* session) { if (state_ == WORKER_READY) { if (sessions().size() == 1) { BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, base::BindOnce(&SetDevToolsAttachedOnIO, context_weak_, version_id_, true)); } // RenderProcessHost should not be null here, but even if it _is_ null, // session does not depend on the process to do messaging. session->SetRenderer(RenderProcessHost::FromID(worker_process_id_), nullptr); session->AttachToAgent(agent_ptr_); } session->AddHandler(base::WrapUnique(new protocol::InspectorHandler())); session->AddHandler(base::WrapUnique(new protocol::NetworkHandler(GetId()))); session->AddHandler(base::WrapUnique(new protocol::SchemaHandler())); }
14,130
150,429
0
int bounds_change_count() const { return bounds_change_count_; }
14,131
128,750
0
ScriptPromise ReadableStream::cancelInternal(ScriptState* scriptState, ScriptValue reason) { setIsDisturbed(); closeInternal(); return m_source->cancelSource(scriptState, reason).then(ConstUndefined::create(scriptState)); }
14,132
7,745
0
TT_Set_MM_Blend( TT_Face face, FT_UInt num_coords, FT_Fixed* coords ) { FT_Error error = TT_Err_Ok; GX_Blend blend; FT_MM_Var* mmvar; FT_UInt i; FT_Memory memory = face->root.memory; enum { mcvt_retain, mcvt_modify, mcvt_load } manageCvt; face->doblend = FALSE; if ( face->blend == NULL ) { if ( (error = TT_Get_MM_Var( face, NULL)) != 0 ) goto Exit; } blend = face->blend; mmvar = blend->mmvar; if ( num_coords != mmvar->num_axis ) { error = TT_Err_Invalid_Argument; goto Exit; } for ( i = 0; i < num_coords; ++i ) if ( coords[i] < -0x00010000L || coords[i] > 0x00010000L ) { error = TT_Err_Invalid_Argument; goto Exit; } if ( blend->glyphoffsets == NULL ) if ( (error = ft_var_load_gvar( face )) != 0 ) goto Exit; if ( blend->normalizedcoords == NULL ) { if ( FT_NEW_ARRAY( blend->normalizedcoords, num_coords ) ) goto Exit; manageCvt = mcvt_modify; /* If we have not set the blend coordinates before this, then the */ /* cvt table will still be what we read from the `cvt ' table and */ /* we don't need to reload it. We may need to change it though... */ } else { manageCvt = mcvt_retain; for ( i = 0; i < num_coords; ++i ) { if ( blend->normalizedcoords[i] != coords[i] ) { manageCvt = mcvt_load; break; } } /* If we don't change the blend coords then we don't need to do */ /* anything to the cvt table. It will be correct. Otherwise we */ /* no longer have the original cvt (it was modified when we set */ /* the blend last time), so we must reload and then modify it. */ } blend->num_axis = num_coords; FT_MEM_COPY( blend->normalizedcoords, coords, num_coords * sizeof ( FT_Fixed ) ); face->doblend = TRUE; if ( face->cvt != NULL ) { switch ( manageCvt ) { case mcvt_load: /* The cvt table has been loaded already; every time we change the */ /* blend we may need to reload and remodify the cvt table. */ FT_FREE( face->cvt ); face->cvt = NULL; tt_face_load_cvt( face, face->root.stream ); break; case mcvt_modify: /* The original cvt table is in memory. All we need to do is */ /* apply the `cvar' table (if any). */ tt_face_vary_cvt( face, face->root.stream ); break; case mcvt_retain: /* The cvt table is correct for this set of coordinates. */ break; } } Exit: return error; }
14,133
34,258
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); }
14,134
161,328
0
Response NetworkHandler::EmulateNetworkConditions( bool offline, double latency, double download_throughput, double upload_throughput, Maybe<protocol::Network::ConnectionType>) { network::mojom::NetworkConditionsPtr network_conditions; bool throttling_enabled = offline || latency > 0 || download_throughput > 0 || upload_throughput > 0; if (throttling_enabled) { network_conditions = network::mojom::NetworkConditions::New(); network_conditions->offline = offline; network_conditions->latency = base::TimeDelta::FromMilliseconds(latency); network_conditions->download_throughput = download_throughput; network_conditions->upload_throughput = upload_throughput; } SetNetworkConditions(std::move(network_conditions)); return Response::FallThrough(); }
14,135
153,427
0
bool TabStrip::IsLastVisibleTab(const Tab* tab) const { return GetLastVisibleTab() == tab; }
14,136
179,618
1
cdf_file_summary_info(struct magic_set *ms, const cdf_header_t *h, const cdf_stream_t *sst, const uint64_t clsid[2]) { cdf_summary_info_header_t si; cdf_property_info_t *info; size_t count; int m; if (cdf_unpack_summary_info(sst, h, &si, &info, &count) == -1) return -1; if (NOTMIME(ms)) { const char *str; if (file_printf(ms, "Composite Document File V2 Document") == -1) return -1; if (file_printf(ms, ", %s Endian", si.si_byte_order == 0xfffe ? "Little" : "Big") == -1) return -2; switch (si.si_os) { case 2: if (file_printf(ms, ", Os: Windows, Version %d.%d", si.si_os_version & 0xff, (uint32_t)si.si_os_version >> 8) == -1) return -2; break; case 1: if (file_printf(ms, ", Os: MacOS, Version %d.%d", (uint32_t)si.si_os_version >> 8, si.si_os_version & 0xff) == -1) return -2; break; default: if (file_printf(ms, ", Os %d, Version: %d.%d", si.si_os, si.si_os_version & 0xff, (uint32_t)si.si_os_version >> 8) == -1) return -2; break; } str = cdf_clsid_to_mime(clsid, clsid2desc); if (str) if (file_printf(ms, ", %s", str) == -1) return -2; } m = cdf_file_property_info(ms, info, count, clsid); free(info); return m == -1 ? -2 : m; }
14,137
165,618
0
String Location::hostname() const { return DOMURLUtilsReadOnly::hostname(Url()); }
14,138
6,063
0
e1000e_set_ics(E1000ECore *core, int index, uint32_t val) { trace_e1000e_irq_write_ics(val); e1000e_set_interrupt_cause(core, val); }
14,139
144,451
0
void WebContentsImpl::CreateBrowserPluginEmbedderIfNecessary() { if (browser_plugin_embedder_) return; browser_plugin_embedder_.reset(BrowserPluginEmbedder::Create(this)); }
14,140
37,856
0
static unsigned long svm_get_rflags(struct kvm_vcpu *vcpu) { return to_svm(vcpu)->vmcb->save.rflags; }
14,141
14,946
0
ProcAllocColorPlanes(ClientPtr client) { ColormapPtr pcmp; int rc; REQUEST(xAllocColorPlanesReq); REQUEST_SIZE_MATCH(xAllocColorPlanesReq); rc = dixLookupResourceByType((void **) &pcmp, stuff->cmap, RT_COLORMAP, client, DixAddAccess); if (rc == Success) { xAllocColorPlanesReply acpr; int npixels; long length; Pixel *ppixels; npixels = stuff->colors; if (!npixels) { client->errorValue = npixels; return BadValue; } if (stuff->contiguous != xTrue && stuff->contiguous != xFalse) { client->errorValue = stuff->contiguous; return BadValue; } acpr = (xAllocColorPlanesReply) { .type = X_Reply, .sequenceNumber = client->sequence, .nPixels = npixels }; length = (long) npixels *sizeof(Pixel); ppixels = malloc(length); if (!ppixels) return BadAlloc; if ((rc = AllocColorPlanes(client->index, pcmp, npixels, (int) stuff->red, (int) stuff->green, (int) stuff->blue, (Bool) stuff->contiguous, ppixels, &acpr.redMask, &acpr.greenMask, &acpr.blueMask))) { free(ppixels); return rc; } acpr.length = bytes_to_int32(length); #ifdef PANORAMIX if (noPanoramiXExtension || !pcmp->pScreen->myNum) #endif { WriteReplyToClient(client, sizeof(xAllocColorPlanesReply), &acpr); client->pSwapReplyFunc = (ReplySwapPtr) Swap32Write; WriteSwappedDataToClient(client, length, ppixels); } free(ppixels); return Success; } else { client->errorValue = stuff->cmap; return rc; } }
14,142
23,694
0
void bond_change_active_slave(struct bonding *bond, struct slave *new_active) { struct slave *old_active = bond->curr_active_slave; if (old_active == new_active) return; if (new_active) { new_active->jiffies = jiffies; if (new_active->link == BOND_LINK_BACK) { if (USES_PRIMARY(bond->params.mode)) { pr_info("%s: making interface %s the new active one %d ms earlier.\n", bond->dev->name, new_active->dev->name, (bond->params.updelay - new_active->delay) * bond->params.miimon); } new_active->delay = 0; new_active->link = BOND_LINK_UP; if (bond->params.mode == BOND_MODE_8023AD) bond_3ad_handle_link_change(new_active, BOND_LINK_UP); if (bond_is_lb(bond)) bond_alb_handle_link_change(bond, new_active, BOND_LINK_UP); } else { if (USES_PRIMARY(bond->params.mode)) { pr_info("%s: making interface %s the new active one.\n", bond->dev->name, new_active->dev->name); } } } if (USES_PRIMARY(bond->params.mode)) bond_mc_swap(bond, new_active, old_active); if (bond_is_lb(bond)) { bond_alb_handle_active_change(bond, new_active); if (old_active) bond_set_slave_inactive_flags(old_active); if (new_active) bond_set_slave_active_flags(new_active); } else { bond->curr_active_slave = new_active; } if (bond->params.mode == BOND_MODE_ACTIVEBACKUP) { if (old_active) bond_set_slave_inactive_flags(old_active); if (new_active) { bool should_notify_peers = false; bond_set_slave_active_flags(new_active); if (bond->params.fail_over_mac) bond_do_fail_over_mac(bond, new_active, old_active); if (netif_running(bond->dev)) { bond->send_peer_notif = bond->params.num_peer_notif; should_notify_peers = bond_should_notify_peers(bond); } write_unlock_bh(&bond->curr_slave_lock); read_unlock(&bond->lock); netdev_bonding_change(bond->dev, NETDEV_BONDING_FAILOVER); if (should_notify_peers) netdev_bonding_change(bond->dev, NETDEV_NOTIFY_PEERS); read_lock(&bond->lock); write_lock_bh(&bond->curr_slave_lock); } } /* resend IGMP joins since active slave has changed or * all were sent on curr_active_slave. * resend only if bond is brought up with the affected * bonding modes and the retransmission is enabled */ if (netif_running(bond->dev) && (bond->params.resend_igmp > 0) && ((USES_PRIMARY(bond->params.mode) && new_active) || bond->params.mode == BOND_MODE_ROUNDROBIN)) { bond->igmp_retrans = bond->params.resend_igmp; queue_delayed_work(bond->wq, &bond->mcast_work, 0); } }
14,143
4,109
0
static inline int imgCoordMungeUpper(SplashCoord x) { return splashFloor(x) + 1; }
14,144
19,531
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; }
14,145
161,215
0
static bool SniffForHTML(const char* content, size_t size, bool* have_enough_content, std::string* result) { *have_enough_content &= TruncateSize(512, &size); const char* const end = content + size; const char* pos; for (pos = content; pos < end; ++pos) { if (!base::IsAsciiWhitespace(*pos)) break; } return CheckForMagicNumbers(pos, end - pos, kSniffableTags, arraysize(kSniffableTags), result); }
14,146
152,284
0
void RenderFrameImpl::DidObserveLoadingBehavior( blink::WebLoadingBehaviorFlag behavior) { for (auto& observer : observers_) observer.DidObserveLoadingBehavior(behavior); }
14,147
60,975
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; }
14,148
6,188
0
int ssl3_read_bytes(SSL *s, int 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 (s->s3->rbuf.buf == NULL) /* Not initialized yet */ if (!ssl3_setup_read_buffer(s)) return (-1); if ((type && (type != SSL3_RT_APPLICATION_DATA) && (type != SSL3_RT_HANDSHAKE)) || (peek && (type != SSL3_RT_APPLICATION_DATA))) { SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); return -1; } if ((type == SSL3_RT_HANDSHAKE) && (s->s3->handshake_fragment_len > 0)) /* (partially) satisfy request from storage */ { unsigned char *src = s->s3->handshake_fragment; unsigned char *dst = buf; unsigned int k; /* peek == 0 */ n = 0; while ((len > 0) && (s->s3->handshake_fragment_len > 0)) { *dst++ = *src++; len--; s->s3->handshake_fragment_len--; n++; } /* move any remaining fragment bytes: */ for (k = 0; k < s->s3->handshake_fragment_len; k++) s->s3->handshake_fragment[k] = *src++; return n; } /* * Now s->s3->handshake_fragment_len == 0 if type == SSL3_RT_HANDSHAKE. */ if (!s->in_handshake && SSL_in_init(s)) { /* type == SSL3_RT_APPLICATION_DATA */ i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_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->s3->rrec); /* get new packet if necessary */ if ((rr->length == 0) || (s->rstate == SSL_ST_READ_BODY)) { ret = ssl3_get_record(s); if (ret <= 0) return (ret); } /* we now have a packet which can be read and processed */ if (s->s3->change_cipher_spec /* set when we receive ChangeCipherSpec, * reset by ssl3_get_finished */ && (rr->type != SSL3_RT_HANDSHAKE)) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_DATA_BETWEEN_CCS_AND_FINISHED); goto f_err; } /* * If the other end has shut down, throw anything we read away (even in * 'peek' mode) */ if (s->shutdown & SSL_RECEIVED_SHUTDOWN) { rr->length = 0; s->rwstate = SSL_NOTHING; return (0); } if (type == rr->type) { /* SSL3_RT_APPLICATION_DATA or * SSL3_RT_HANDSHAKE */ /* * make sure that we are not getting application data when we are * doing a handshake for the first time */ if (SSL_in_init(s) && (type == SSL3_RT_APPLICATION_DATA) && (s->enc_read_ctx == NULL)) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_APP_DATA_IN_HANDSHAKE); goto f_err; } if (len <= 0) return (len); if ((unsigned int)len > rr->length) n = rr->length; else n = (unsigned int)len; memcpy(buf, &(rr->data[rr->off]), n); if (!peek) { rr->length -= n; rr->off += n; if (rr->length == 0) { s->rstate = SSL_ST_READ_HEADER; rr->off = 0; if (s->mode & SSL_MODE_RELEASE_BUFFERS && s->s3->rbuf.left == 0) ssl3_release_read_buffer(s); } } return (n); } /* * If we get here, then type != rr->type; if we have a handshake message, * then it was unexpected (Hello Request or Client Hello). */ /* * In case of record types for which we have 'fragment' storage, fill * that so that we can process the data at a fixed place. */ { unsigned int dest_maxlen = 0; unsigned char *dest = NULL; unsigned int *dest_len = NULL; if (rr->type == SSL3_RT_HANDSHAKE) { dest_maxlen = sizeof s->s3->handshake_fragment; dest = s->s3->handshake_fragment; dest_len = &s->s3->handshake_fragment_len; } else if (rr->type == SSL3_RT_ALERT) { dest_maxlen = sizeof s->s3->alert_fragment; dest = s->s3->alert_fragment; dest_len = &s->s3->alert_fragment_len; } #ifndef OPENSSL_NO_HEARTBEATS else if (rr->type == TLS1_RT_HEARTBEAT) { tls1_process_heartbeat(s); /* Exit and notify application to read again */ rr->length = 0; s->rwstate = SSL_READING; BIO_clear_retry_flags(SSL_get_rbio(s)); BIO_set_retry_read(SSL_get_rbio(s)); return (-1); } #endif if (dest_maxlen > 0) { n = dest_maxlen - *dest_len; /* available space in 'dest' */ if (rr->length < n) n = rr->length; /* available bytes */ /* now move 'n' bytes: */ while (n-- > 0) { dest[(*dest_len)++] = rr->data[rr->off++]; rr->length--; } if (*dest_len < dest_maxlen) goto start; /* fragment was too small */ } } /*- * s->s3->handshake_fragment_len == 4 iff rr->type == SSL3_RT_HANDSHAKE; * s->s3->alert_fragment_len == 2 iff rr->type == SSL3_RT_ALERT. * (Possibly rr is 'empty' now, i.e. rr->length may be 0.) */ /* If we are a client, check for an incoming 'Hello Request': */ if ((!s->server) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_HELLO_REQUEST) && (s->session != NULL) && (s->session->cipher != NULL)) { s->s3->handshake_fragment_len = 0; if ((s->s3->handshake_fragment[1] != 0) || (s->s3->handshake_fragment[2] != 0) || (s->s3->handshake_fragment[3] != 0)) { al = SSL_AD_DECODE_ERROR; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_BAD_HELLO_REQUEST); goto f_err; } if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, s->s3->handshake_fragment, 4, s, s->msg_callback_arg); if (SSL_is_init_finished(s) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && !s->s3->renegotiate) { ssl3_renegotiate(s); if (ssl3_renegotiate_check(s)) { i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) { /* no read-ahead left? */ BIO *bio; /* * In the case where we try to read application data, * but we trigger an SSL handshake, we return -1 with * the retry option set. Otherwise renegotiation may * cause nasty problems in the blocking world */ s->rwstate = SSL_READING; bio = SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return (-1); } } } } /* * we either finished a handshake or ignored the request, now try * again to obtain the (application) data we were asked for */ goto start; } /* * If we are a server and get a client hello when renegotiation isn't * allowed send back a no renegotiation alert and carry on. WARNING: * experimental code, needs reviewing (steve) */ if (s->server && SSL_is_init_finished(s) && !s->s3->send_connection_binding && (s->version > SSL3_VERSION) && (s->s3->handshake_fragment_len >= 4) && (s->s3->handshake_fragment[0] == SSL3_MT_CLIENT_HELLO) && (s->session != NULL) && (s->session->cipher != NULL) && !(s->ctx->options & SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION)) { /* * s->s3->handshake_fragment_len = 0; */ rr->length = 0; ssl3_send_alert(s, SSL3_AL_WARNING, SSL_AD_NO_RENEGOTIATION); goto start; } if (s->s3->alert_fragment_len >= 2) { int alert_level = s->s3->alert_fragment[0]; int alert_descr = s->s3->alert_fragment[1]; s->s3->alert_fragment_len = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_ALERT, s->s3->alert_fragment, 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 = (alert_level << 8) | alert_descr; cb(s, SSL_CB_READ_ALERT, j); } if (alert_level == SSL3_AL_WARNING) { s->s3->warn_alert = alert_descr; if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->shutdown |= SSL_RECEIVED_SHUTDOWN; return (0); } /* * This is a warning but we receive it if we requested * renegotiation and the peer denied it. Terminate with a fatal * alert because if application tried to renegotiatie it * presumably had a good reason and expects it to succeed. In * future we might have a renegotiation where we don't care if * the peer refused it where we carry on. */ else if (alert_descr == SSL_AD_NO_RENEGOTIATION) { al = SSL_AD_HANDSHAKE_FAILURE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_NO_RENEGOTIATION); goto f_err; } #ifdef SSL_AD_MISSING_SRP_USERNAME else if (alert_descr == SSL_AD_MISSING_SRP_USERNAME) return (0); #endif } else if (alert_level == SSL3_AL_FATAL) { char tmp[16]; s->rwstate = SSL_NOTHING; s->s3->fatal_alert = alert_descr; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_AD_REASON_OFFSET + alert_descr); BIO_snprintf(tmp, sizeof tmp, "%d", alert_descr); ERR_add_error_data(2, "SSL alert number ", tmp); s->shutdown |= SSL_RECEIVED_SHUTDOWN; SSL_CTX_remove_session(s->ctx, s->session); return (0); } else { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNKNOWN_ALERT_TYPE); goto f_err; } goto start; } if (s->shutdown & SSL_SENT_SHUTDOWN) { /* but we have not received a * shutdown */ s->rwstate = SSL_NOTHING; rr->length = 0; return (0); } if (rr->type == SSL3_RT_CHANGE_CIPHER_SPEC) { /* * 'Change Cipher Spec' is just a single byte, so we know exactly * what the record payload has to look like */ if ((rr->length != 1) || (rr->off != 0) || (rr->data[0] != SSL3_MT_CCS)) { al = SSL_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_BAD_CHANGE_CIPHER_SPEC); goto f_err; } /* Check we have a cipher to change to */ if (s->s3->tmp.new_cipher == NULL) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_CCS_RECEIVED_EARLY); goto f_err; } if (!(s->s3->flags & SSL3_FLAGS_CCS_OK)) { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_CCS_RECEIVED_EARLY); goto f_err; } s->s3->flags &= ~SSL3_FLAGS_CCS_OK; rr->length = 0; if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1, s, s->msg_callback_arg); s->s3->change_cipher_spec = 1; if (!ssl3_do_change_cipher_spec(s)) goto err; else goto start; } /* * Unexpected handshake message (Client Hello, or protocol violation) */ if ((s->s3->handshake_fragment_len >= 4) && !s->in_handshake) { if (((s->state & SSL_ST_MASK) == SSL_ST_OK) && !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS)) { #if 0 /* worked only because C operator preferences * are not as expected (and because this is * not really needed for clients except for * detecting protocol violations): */ s->state = SSL_ST_BEFORE | (s->server) ? SSL_ST_ACCEPT : SSL_ST_CONNECT; #else s->state = s->server ? SSL_ST_ACCEPT : SSL_ST_CONNECT; #endif s->renegotiate = 1; s->new_session = 1; } i = s->handshake_func(s); if (i < 0) return (i); if (i == 0) { SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_SSL_HANDSHAKE_FAILURE); return (-1); } if (!(s->mode & SSL_MODE_AUTO_RETRY)) { if (s->s3->rbuf.left == 0) { /* no read-ahead left? */ BIO *bio; /* * In the case where we try to read application data, but we * trigger an SSL handshake, we return -1 with the retry * option set. Otherwise renegotiation may cause nasty * problems in the blocking world */ s->rwstate = SSL_READING; bio = SSL_get_rbio(s); BIO_clear_retry_flags(bio); BIO_set_retry_read(bio); return (-1); } } goto start; } switch (rr->type) { default: #ifndef OPENSSL_NO_TLS /* * TLS up to v1.1 just ignores unknown message types: TLS v1.2 give * an unexpected message alert. */ if (s->version >= TLS1_VERSION && s->version <= TLS1_1_VERSION) { rr->length = 0; goto start; } #endif al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNEXPECTED_RECORD); goto f_err; case SSL3_RT_CHANGE_CIPHER_SPEC: case SSL3_RT_ALERT: case SSL3_RT_HANDSHAKE: /* * we already handled all of these, with the possible exception of * SSL3_RT_HANDSHAKE when s->in_handshake is set, but that should not * happen when type != rr->type */ al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, ERR_R_INTERNAL_ERROR); goto f_err; case SSL3_RT_APPLICATION_DATA: /* * At this point, we were expecting handshake data, but have * application data. If the library was running inside ssl3_read() * (i.e. in_read_app_data is set) and it makes sense to read * application data at this point (session renegotiation not yet * started), we will indulge it. */ if (s->s3->in_read_app_data && (s->s3->total_renegotiations != 0) && (((s->state & SSL_ST_CONNECT) && (s->state >= SSL3_ST_CW_CLNT_HELLO_A) && (s->state <= SSL3_ST_CR_SRVR_HELLO_A) ) || ((s->state & SSL_ST_ACCEPT) && (s->state <= SSL3_ST_SW_HELLO_REQ_A) && (s->state >= SSL3_ST_SR_CLNT_HELLO_A) ) )) { s->s3->in_read_app_data = 2; return (-1); } else { al = SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_SSL3_READ_BYTES, SSL_R_UNEXPECTED_RECORD); goto f_err; } } /* not reached */ f_err: ssl3_send_alert(s, SSL3_AL_FATAL, al); err: return (-1); }
14,149
142,972
0
void HTMLMediaElement::setVolume(double vol, ExceptionState& exception_state) { BLINK_MEDIA_LOG << "setVolume(" << (void*)this << ", " << vol << ")"; if (volume_ == vol) return; if (vol < 0.0f || vol > 1.0f) { exception_state.ThrowDOMException( DOMExceptionCode::kIndexSizeError, ExceptionMessages::IndexOutsideRange( "volume", vol, 0.0, ExceptionMessages::kInclusiveBound, 1.0, ExceptionMessages::kInclusiveBound)); return; } volume_ = vol; if (GetWebMediaPlayer()) GetWebMediaPlayer()->SetVolume(EffectiveMediaVolume()); ScheduleEvent(event_type_names::kVolumechange); }
14,150
124,518
0
LayoutUnit RenderBlock::collapsedMarginBeforeForChild(const RenderBox* child) const { if (!child->isWritingModeRoot()) return child->collapsedMarginBefore(); if (child->isHorizontalWritingMode() == isHorizontalWritingMode()) return child->collapsedMarginAfter(); return marginBeforeForChild(child); }
14,151
27,692
0
ebt_dev_check(const char *entry, const struct net_device *device) { int i = 0; const char *devname; if (*entry == '\0') return 0; if (!device) return 1; devname = device->name; /* 1 is the wildcard token */ while (entry[i] != '\0' && entry[i] != 1 && entry[i] == devname[i]) i++; return (devname[i] != entry[i] && entry[i] != 1); }
14,152
97,199
0
void WebFrameLoaderClient::dispatchDidReceiveServerRedirectForProvisionalLoad() { WebDataSourceImpl* ds = webframe_->GetProvisionalDataSourceImpl(); if (!ds) { NOTREACHED() << "Got a server redirect when there is no provisional DS"; return; } if (ds->request().isNull()) return; DCHECK(ds->hasRedirectChain()); ds->appendRedirect(ds->request().url()); if (webframe_->client()) webframe_->client()->didReceiveServerRedirectForProvisionalLoad(webframe_); }
14,153
172,202
0
virtual void TearDown() { semaphore_free(semaphore); AlarmTestHarness::TearDown(); }
14,154
111,879
0
void ProfileSyncService::GetDataTypeControllerStates( browser_sync::DataTypeController::StateMap* state_map) const { for (browser_sync::DataTypeController::TypeMap::const_iterator iter = data_type_controllers_.begin(); iter != data_type_controllers_.end(); ++iter) (*state_map)[iter->first] = iter->second.get()->state(); }
14,155
84,058
0
u32 _ilog_(u32 v) { u32 ret=0; while(v) { ret++; v>>=1; } return(ret); }
14,156
101,197
0
int64 BuildCommitCommand::GetLastPosition() { return std::numeric_limits<int64>::max(); }
14,157
94,902
0
static int __init usbnet_init(void) { /* Compiler should optimize this out. */ BUILD_BUG_ON( FIELD_SIZEOF(struct sk_buff, cb) < sizeof(struct skb_data)); eth_random_addr(node_id); return 0; }
14,158
186,408
1
PageInfoUI::GetSecurityDescription(const IdentityInfo& identity_info) const { std::unique_ptr<PageInfoUI::SecurityDescription> security_description( new PageInfoUI::SecurityDescription()); switch (identity_info.safe_browsing_status) { case PageInfo::SAFE_BROWSING_STATUS_NONE: break; case PageInfo::SAFE_BROWSING_STATUS_MALWARE: return CreateSecurityDescription(SecuritySummaryColor::RED, IDS_PAGE_INFO_MALWARE_SUMMARY, IDS_PAGE_INFO_MALWARE_DETAILS); case PageInfo::SAFE_BROWSING_STATUS_SOCIAL_ENGINEERING: return CreateSecurityDescription( SecuritySummaryColor::RED, IDS_PAGE_INFO_SOCIAL_ENGINEERING_SUMMARY, IDS_PAGE_INFO_SOCIAL_ENGINEERING_DETAILS); case PageInfo::SAFE_BROWSING_STATUS_UNWANTED_SOFTWARE: return CreateSecurityDescription(SecuritySummaryColor::RED, IDS_PAGE_INFO_UNWANTED_SOFTWARE_SUMMARY, IDS_PAGE_INFO_UNWANTED_SOFTWARE_DETAILS); case PageInfo::SAFE_BROWSING_STATUS_SIGN_IN_PASSWORD_REUSE: #if defined(FULL_SAFE_BROWSING) return CreateSecurityDescriptionForPasswordReuse( /*is_enterprise_password=*/false); #endif NOTREACHED(); break; case PageInfo::SAFE_BROWSING_STATUS_ENTERPRISE_PASSWORD_REUSE: #if defined(FULL_SAFE_BROWSING) return CreateSecurityDescriptionForPasswordReuse( /*is_enterprise_password=*/true); #endif NOTREACHED(); break; case PageInfo::SAFE_BROWSING_STATUS_BILLING: return CreateSecurityDescription(SecuritySummaryColor::RED, IDS_PAGE_INFO_BILLING_SUMMARY, IDS_PAGE_INFO_BILLING_DETAILS); } switch (identity_info.identity_status) { case PageInfo::SITE_IDENTITY_STATUS_INTERNAL_PAGE: #if defined(OS_ANDROID) // We provide identical summary and detail strings for Android, which // deduplicates them in the UI code. return CreateSecurityDescription(SecuritySummaryColor::GREEN, IDS_PAGE_INFO_INTERNAL_PAGE, IDS_PAGE_INFO_INTERNAL_PAGE); #else // Internal pages on desktop have their own UI implementations which // should never call this function. NOTREACHED(); FALLTHROUGH; #endif case PageInfo::SITE_IDENTITY_STATUS_EV_CERT: FALLTHROUGH; case PageInfo::SITE_IDENTITY_STATUS_CERT: FALLTHROUGH; case PageInfo::SITE_IDENTITY_STATUS_CERT_REVOCATION_UNKNOWN: FALLTHROUGH; case PageInfo::SITE_IDENTITY_STATUS_ADMIN_PROVIDED_CERT: switch (identity_info.connection_status) { case PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE: return CreateSecurityDescription(SecuritySummaryColor::RED, IDS_PAGE_INFO_NOT_SECURE_SUMMARY, IDS_PAGE_INFO_NOT_SECURE_DETAILS); case PageInfo::SITE_CONNECTION_STATUS_INSECURE_FORM_ACTION: return CreateSecurityDescription(SecuritySummaryColor::RED, IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY, IDS_PAGE_INFO_NOT_SECURE_DETAILS); case PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE: return CreateSecurityDescription(SecuritySummaryColor::RED, IDS_PAGE_INFO_MIXED_CONTENT_SUMMARY, IDS_PAGE_INFO_MIXED_CONTENT_DETAILS); default: return CreateSecurityDescription(SecuritySummaryColor::GREEN, IDS_PAGE_INFO_SECURE_SUMMARY, IDS_PAGE_INFO_SECURE_DETAILS); } case PageInfo::SITE_IDENTITY_STATUS_DEPRECATED_SIGNATURE_ALGORITHM: case PageInfo::SITE_IDENTITY_STATUS_UNKNOWN: case PageInfo::SITE_IDENTITY_STATUS_NO_CERT: default: return CreateSecurityDescription(SecuritySummaryColor::RED, IDS_PAGE_INFO_NOT_SECURE_SUMMARY, IDS_PAGE_INFO_NOT_SECURE_DETAILS); } }
14,159
119,513
0
static int computeOffset(WebCore::RenderObject* renderer, int x, int y) { return WebCore::VisiblePosition(renderer->positionForPoint(WebCore::LayoutPoint(x, y))).deepEquivalent().computeOffsetInContainerNode(); }
14,160
40,867
0
void *hashtable_iter_next(hashtable_t *hashtable, void *iter) { list_t *list = (list_t *)iter; if(list->next == &hashtable->list) return NULL; return list->next; }
14,161
44,171
0
size_t iov_iter_single_seg_count(const struct iov_iter *i) { const struct iovec *iov = i->iov; if (i->nr_segs == 1) return i->count; else return min(i->count, iov->iov_len - i->iov_offset); }
14,162
52,854
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; }
14,163
102,033
0
void GraphicsSurface::platformUnlock() { }
14,164
183,039
1
static int cx24116_send_diseqc_msg(struct dvb_frontend *fe, struct dvb_diseqc_master_cmd *d) { struct cx24116_state *state = fe->demodulator_priv; int i, ret; /* Dump DiSEqC message */ if (debug) { printk(KERN_INFO "cx24116: %s(", __func__); for (i = 0 ; i < d->msg_len ;) { printk(KERN_INFO "0x%02x", d->msg[i]); if (++i < d->msg_len) printk(KERN_INFO ", "); } printk(") toneburst=%d\n", toneburst); } /* Validate length * if (d->msg_len > (CX24116_ARGLEN - CX24116_DISEQC_MSGOFS)) return -EINVAL; /* DiSEqC message */ for (i = 0; i < d->msg_len; i++) state->dsec_cmd.args[CX24116_DISEQC_MSGOFS + i] = d->msg[i]; /* DiSEqC message length */ state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] = d->msg_len; /* Command length */ state->dsec_cmd.len = CX24116_DISEQC_MSGOFS + state->dsec_cmd.args[CX24116_DISEQC_MSGLEN]; /* DiSEqC toneburst */ if (toneburst == CX24116_DISEQC_MESGCACHE) /* Message is cached */ return 0; else if (toneburst == CX24116_DISEQC_TONEOFF) /* Message is sent without burst */ state->dsec_cmd.args[CX24116_DISEQC_BURST] = 0; else if (toneburst == CX24116_DISEQC_TONECACHE) { /* * Message is sent with derived else cached burst * * WRITE PORT GROUP COMMAND 38 * * 0/A/A: E0 10 38 F0..F3 * 1/B/B: E0 10 38 F4..F7 * 2/C/A: E0 10 38 F8..FB * 3/D/B: E0 10 38 FC..FF * * databyte[3]= 8421:8421 * ABCD:WXYZ * CLR :SET * * WX= PORT SELECT 0..3 (X=TONEBURST) * Y = VOLTAGE (0=13V, 1=18V) * Z = BAND (0=LOW, 1=HIGH(22K)) */ if (d->msg_len >= 4 && d->msg[2] == 0x38) state->dsec_cmd.args[CX24116_DISEQC_BURST] = ((d->msg[3] & 4) >> 2); if (debug) dprintk("%s burst=%d\n", __func__, state->dsec_cmd.args[CX24116_DISEQC_BURST]); } /* Wait for LNB ready */ ret = cx24116_wait_for_lnb(fe); if (ret != 0) return ret; /* Wait for voltage/min repeat delay */ msleep(100); /* Command */ ret = cx24116_cmd_execute(fe, &state->dsec_cmd); if (ret != 0) return ret; /* * Wait for send * * Eutelsat spec: * >15ms delay + (XXX determine if FW does this, see set_tone) * 13.5ms per byte + * >15ms delay + * 12.5ms burst + * >15ms delay (XXX determine if FW does this, see set_tone) */ msleep((state->dsec_cmd.args[CX24116_DISEQC_MSGLEN] << 4) + ((toneburst == CX24116_DISEQC_TONEOFF) ? 30 : 60)); return 0; }
14,165
130,298
0
void OSExchangeDataProviderWin::SetFileContents( const base::FilePath& filename, const std::string& file_contents) { STGMEDIUM* storage = GetStorageForFileDescriptor(filename); data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( Clipboard::GetFileDescriptorFormatType().ToFormatEtc(), storage)); storage = GetStorageForBytes(file_contents.data(), file_contents.length()); data_->contents_.push_back(new DataObjectImpl::StoredDataInfo( Clipboard::GetFileContentZeroFormatType().ToFormatEtc(), storage)); }
14,166
50,298
0
void mndp_broadcast() { struct mt_packet pdata; struct utsname s_uname; struct net_interface *interface; unsigned int uptime; #if defined(__APPLE__) int mib[] = {CTL_KERN, KERN_BOOTTIME}; struct timeval boottime; size_t tv_size = sizeof(boottime); if (sysctl(mib, sizeof(mib)/sizeof(mib[0]), &boottime, &tv_size, NULL, 0) == -1) { return; } uptime = htole32(boottime.tv_sec); #elif defined(__linux__) struct sysinfo s_sysinfo; if (sysinfo(&s_sysinfo) != 0) { return; } /* Seems like ping uptime is transmitted as little endian? */ uptime = htole32(s_sysinfo.uptime); #else struct timespec ts; if (clock_gettime(CLOCK_UPTIME, &ts) != -1) { uptime = htole32(((unsigned int)ts.tv_sec)); } #endif if (uname(&s_uname) != 0) { return; } DL_FOREACH(interfaces, interface) { struct mt_mndp_hdr *header = (struct mt_mndp_hdr *)&(pdata.data); if (interface->has_mac == 0) { continue; } mndp_init_packet(&pdata, 0, 1); mndp_add_attribute(&pdata, MT_MNDPTYPE_ADDRESS, interface->mac_addr, ETH_ALEN); mndp_add_attribute(&pdata, MT_MNDPTYPE_IDENTITY, s_uname.nodename, strlen(s_uname.nodename)); mndp_add_attribute(&pdata, MT_MNDPTYPE_VERSION, s_uname.release, strlen(s_uname.release)); mndp_add_attribute(&pdata, MT_MNDPTYPE_PLATFORM, PLATFORM_NAME, strlen(PLATFORM_NAME)); mndp_add_attribute(&pdata, MT_MNDPTYPE_HARDWARE, s_uname.machine, strlen(s_uname.machine)); mndp_add_attribute(&pdata, MT_MNDPTYPE_TIMESTAMP, &uptime, 4); mndp_add_attribute(&pdata, MT_MNDPTYPE_SOFTID, MT_SOFTID_MACTELNET, strlen(MT_SOFTID_MACTELNET)); mndp_add_attribute(&pdata, MT_MNDPTYPE_IFNAME, interface->name, strlen(interface->name)); header->cksum = in_cksum((unsigned short *)&(pdata.data), pdata.size); send_special_udp(interface, MT_MNDP_PORT, &pdata); } }
14,167
158,273
0
void RenderWidgetHostImpl::ForwardWheelEvent( const WebMouseWheelEvent& wheel_event) { ForwardWheelEventWithLatencyInfo(wheel_event, ui::LatencyInfo(ui::SourceEventType::WHEEL)); }
14,168
124,515
0
RenderBlock* RenderBlock::clone() const { RenderBlock* cloneBlock; if (isAnonymousBlock()) { cloneBlock = createAnonymousBlock(); cloneBlock->setChildrenInline(childrenInline()); } else { RenderObject* cloneRenderer = toElement(node())->createRenderer(style()); cloneBlock = toRenderBlock(cloneRenderer); cloneBlock->setStyle(style()); cloneBlock->setChildrenInline(cloneBlock->firstChild() ? cloneBlock->firstChild()->isInline() : childrenInline()); } cloneBlock->setFlowThreadState(flowThreadState()); return cloneBlock; }
14,169
43,983
0
__xml_acl_free(void *data) { if(data) { xml_acl_t *acl = data; free(acl->xpath); free(acl); } }
14,170
177,926
1
gst_vorbis_tag_add_coverart (GstTagList * tags, const gchar * img_data_base64, gint base64_len) { GstBuffer *img; guchar *img_data; gsize img_len; guint save = 0; gint state = 0; if (base64_len < 2) goto not_enough_data; img_data = g_try_malloc0 (base64_len * 3 / 4); if (img_data == NULL) goto alloc_failed; img_len = g_base64_decode_step (img_data_base64, base64_len, img_data, &state, &save); if (img_len == 0) goto decode_failed; img = gst_tag_image_data_to_image_buffer (img_data, img_len, GST_TAG_IMAGE_TYPE_NONE); if (img == NULL) gst_tag_list_add (tags, GST_TAG_MERGE_APPEND, GST_TAG_PREVIEW_IMAGE, img, NULL); GST_TAG_PREVIEW_IMAGE, img, NULL); gst_buffer_unref (img); g_free (img_data); return; /* ERRORS */ { GST_WARNING ("COVERART tag with too little base64-encoded data"); GST_WARNING ("COVERART tag with too little base64-encoded data"); return; } alloc_failed: { GST_WARNING ("Couldn't allocate enough memory to decode COVERART tag"); return; } decode_failed: { GST_WARNING ("Couldn't decode bas64 image data from COVERART tag"); g_free (img_data); return; } convert_failed: { GST_WARNING ("Couldn't extract image or image type from COVERART tag"); g_free (img_data); return; } }
14,171
163,113
0
void BlobStorageContext::RunOnConstructionBegin( const std::string& uuid, const BlobStatusCallback& done) { BlobEntry* entry = registry_.GetEntry(uuid); DCHECK(entry); if (entry->status() == BlobStatus::PENDING_CONSTRUCTION) { entry->building_state_->build_started_callbacks.push_back(done); return; } done.Run(entry->status()); }
14,172
55,638
0
u64 scheduler_tick_max_deferment(void) { struct rq *rq = this_rq(); unsigned long next, now = READ_ONCE(jiffies); next = rq->last_sched_tick + HZ; if (time_before_eq(next, now)) return 0; return jiffies_to_nsecs(next - now); }
14,173
62,175
0
void ClrFormatPromptHook(void) { UnhookWinEvent(fp_weh); fp_weh = NULL; }
14,174
142,773
0
void HTMLMediaElement::DeferredLoadTimerFired(TimerBase*) { SetShouldDelayLoadEvent(false); if (deferred_load_state_ == kExecuteOnStopDelayingLoadEventTask) { ExecuteDeferredLoad(); return; } DCHECK_EQ(deferred_load_state_, kWaitingForStopDelayingLoadEventTask); deferred_load_state_ = kWaitingForTrigger; }
14,175
169,693
0
void V8ValueConverterImpl::SetFunctionAllowed(bool val) { function_allowed_ = val; }
14,176
85,669
0
static void fill_tso_desc(struct hnae_ring *ring, void *priv, int size, dma_addr_t dma, int frag_end, int buf_num, enum hns_desc_type type, int mtu) { int frag_buf_num; int sizeoflast; int k; frag_buf_num = (size + BD_MAX_SEND_SIZE - 1) / BD_MAX_SEND_SIZE; sizeoflast = size % BD_MAX_SEND_SIZE; sizeoflast = sizeoflast ? sizeoflast : BD_MAX_SEND_SIZE; /* when the frag size is bigger than hardware, split this frag */ for (k = 0; k < frag_buf_num; k++) fill_v2_desc(ring, priv, (k == frag_buf_num - 1) ? sizeoflast : BD_MAX_SEND_SIZE, dma + BD_MAX_SEND_SIZE * k, frag_end && (k == frag_buf_num - 1) ? 1 : 0, buf_num, (type == DESC_TYPE_SKB && !k) ? DESC_TYPE_SKB : DESC_TYPE_PAGE, mtu); }
14,177
9,620
0
PHPAPI int php_get_session_var(char *name, size_t namelen, zval ***state_var TSRMLS_DC) /* {{{ */ { int ret = FAILURE; IF_SESSION_VARS() { ret = zend_hash_find(Z_ARRVAL_P(PS(http_session_vars)), name, namelen + 1, (void **) state_var); } return ret; } /* }}} */
14,178
166,878
0
void Performance::AddPaintTiming(PerformancePaintTiming::PaintType type, TimeTicks start_time) { if (!RuntimeEnabledFeatures::PerformancePaintTimingEnabled()) return; PerformanceEntry* entry = new PerformancePaintTiming( type, MonotonicTimeToDOMHighResTimeStamp(start_time)); if (type == PerformancePaintTiming::PaintType::kFirstPaint) first_paint_timing_ = entry; else if (type == PerformancePaintTiming::PaintType::kFirstContentfulPaint) first_contentful_paint_timing_ = entry; NotifyObserversOfEntry(*entry); }
14,179
116,175
0
void SocketStreamDispatcherHost::ContinueSSLRequest( const content::GlobalRequestID& id) { int socket_id = id.request_id; DVLOG(1) << "SocketStreamDispatcherHost::ContinueSSLRequest socket_id=" << socket_id; DCHECK_NE(content::kNoSocketId, socket_id); SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); DCHECK(socket_stream_host); socket_stream_host->ContinueDespiteError(); }
14,180
135,987
0
const GURL& GetLastUrl() { download_run_loop_.Run(); return last_url_; }
14,181
47,455
0
static int padlock_sha256_final(struct shash_desc *desc, u8 *out) { u8 buf[4]; return padlock_sha256_finup(desc, buf, 0, out); }
14,182
82,235
0
int __sys_accept4(int fd, struct sockaddr __user *upeer_sockaddr, int __user *upeer_addrlen, int flags) { struct socket *sock, *newsock; struct file *newfile; int err, len, newfd, fput_needed; struct sockaddr_storage address; if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) return -EINVAL; if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; sock = sockfd_lookup_light(fd, &err, &fput_needed); if (!sock) goto out; err = -ENFILE; newsock = sock_alloc(); if (!newsock) goto out_put; newsock->type = sock->type; newsock->ops = sock->ops; /* * We don't need try_module_get here, as the listening socket (sock) * has the protocol module (sock->ops->owner) held. */ __module_get(newsock->ops->owner); newfd = get_unused_fd_flags(flags); if (unlikely(newfd < 0)) { err = newfd; sock_release(newsock); goto out_put; } newfile = sock_alloc_file(newsock, flags, sock->sk->sk_prot_creator->name); if (IS_ERR(newfile)) { err = PTR_ERR(newfile); put_unused_fd(newfd); goto out_put; } err = security_socket_accept(sock, newsock); if (err) goto out_fd; err = sock->ops->accept(sock, newsock, sock->file->f_flags, false); if (err < 0) goto out_fd; if (upeer_sockaddr) { len = newsock->ops->getname(newsock, (struct sockaddr *)&address, 2); if (len < 0) { err = -ECONNABORTED; goto out_fd; } err = move_addr_to_user(&address, len, upeer_sockaddr, upeer_addrlen); if (err < 0) goto out_fd; } /* File flags are not inherited via accept() unlike another OSes. */ fd_install(newfd, newfile); err = newfd; out_put: fput_light(sock->file, fput_needed); out: return err; out_fd: fput(newfile); put_unused_fd(newfd); goto out_put; }
14,183
159,554
0
void Document::AdjustFloatQuadsForScrollAndAbsoluteZoom( Vector<FloatQuad>& quads, const LayoutObject& layout_object) const { if (!View()) return; LayoutRect visible_content_rect(View()->VisibleContentRect()); for (size_t i = 0; i < quads.size(); ++i) { quads[i].Move(-FloatSize(visible_content_rect.X().ToFloat(), visible_content_rect.Y().ToFloat())); AdjustForAbsoluteZoom::AdjustFloatQuad(quads[i], layout_object); } }
14,184
146,394
0
ImageBitmap* WebGLRenderingContextBase::TransferToImageBitmapBase( ScriptState* script_state) { WebFeature feature = WebFeature::kOffscreenCanvasTransferToImageBitmapWebGL; UseCounter::Count(ExecutionContext::From(script_state), feature); if (!GetDrawingBuffer()) return nullptr; return ImageBitmap::Create(GetDrawingBuffer()->TransferToStaticBitmapImage()); }
14,185
38,210
0
static long futex_wait_restart(struct restart_block *restart) { u32 __user *uaddr = restart->futex.uaddr; ktime_t t, *tp = NULL; if (restart->futex.flags & FLAGS_HAS_TIMEOUT) { t.tv64 = restart->futex.time; tp = &t; } restart->fn = do_no_restart_syscall; return (long)futex_wait(uaddr, restart->futex.flags, restart->futex.val, tp, restart->futex.bitset); }
14,186
167,981
0
void LocalFrame::SetPrinting(bool printing, bool use_printing_layout, const FloatSize& page_size, const FloatSize& original_page_size, float maximum_shrink_ratio) { ResourceCacheValidationSuppressor validation_suppressor( GetDocument()->Fetcher()); GetDocument()->SetPrinting(printing ? Document::kPrinting : Document::kFinishingPrinting); View()->AdjustMediaTypeForPrinting(printing); if (TextAutosizer* text_autosizer = GetDocument()->GetTextAutosizer()) text_autosizer->UpdatePageInfo(); if (use_printing_layout && ShouldUsePrintingLayout()) { View()->ForceLayoutForPagination(page_size, original_page_size, maximum_shrink_ratio); } else { if (LayoutView* layout_view = View()->GetLayoutView()) { layout_view->SetPreferredLogicalWidthsDirty(); layout_view->SetNeedsLayout(LayoutInvalidationReason::kPrintingChanged); layout_view->SetShouldDoFullPaintInvalidationForViewAndAllDescendants(); } View()->UpdateLayout(); View()->AdjustViewSize(); } for (Frame* child = Tree().FirstChild(); child; child = child->Tree().NextSibling()) { if (child->IsLocalFrame()) { if (printing) ToLocalFrame(child)->StartPrintingWithoutPrintingLayout(); else ToLocalFrame(child)->EndPrinting(); } } View()->SetSubtreeNeedsPaintPropertyUpdate(); if (!printing) GetDocument()->SetPrinting(Document::kNotPrinting); }
14,187
58,850
0
static int snd_timer_stop1(struct snd_timer_instance *timeri, bool stop) { struct snd_timer *timer; int result = 0; unsigned long flags; timer = timeri->timer; if (!timer) return -EINVAL; spin_lock_irqsave(&timer->lock, flags); if (!(timeri->flags & (SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START))) { result = -EBUSY; goto unlock; } list_del_init(&timeri->ack_list); list_del_init(&timeri->active_list); if (timer->card && timer->card->shutdown) goto unlock; if (stop) { timeri->cticks = timeri->ticks; timeri->pticks = 0; } if ((timeri->flags & SNDRV_TIMER_IFLG_RUNNING) && !(--timer->running)) { timer->hw.stop(timer); if (timer->flags & SNDRV_TIMER_FLG_RESCHED) { timer->flags &= ~SNDRV_TIMER_FLG_RESCHED; snd_timer_reschedule(timer, 0); if (timer->flags & SNDRV_TIMER_FLG_CHANGE) { timer->flags &= ~SNDRV_TIMER_FLG_CHANGE; timer->hw.start(timer); } } } timeri->flags &= ~(SNDRV_TIMER_IFLG_RUNNING | SNDRV_TIMER_IFLG_START); if (stop) timeri->flags &= ~SNDRV_TIMER_IFLG_PAUSED; else timeri->flags |= SNDRV_TIMER_IFLG_PAUSED; snd_timer_notify1(timeri, stop ? SNDRV_TIMER_EVENT_STOP : SNDRV_TIMER_EVENT_CONTINUE); unlock: spin_unlock_irqrestore(&timer->lock, flags); return result; }
14,188
175,649
0
SoftMPEG4Encoder::SoftMPEG4Encoder( const char *name, const OMX_CALLBACKTYPE *callbacks, OMX_PTR appData, OMX_COMPONENTTYPE **component) : SoftVideoEncoderOMXComponent(name, callbacks, appData, component), mEncodeMode(COMBINE_MODE_WITH_ERR_RES), mVideoWidth(176), mVideoHeight(144), mVideoFrameRate(30), mVideoBitRate(192000), mVideoColorFormat(OMX_COLOR_FormatYUV420Planar), mStoreMetaDataInBuffers(false), mIDRFrameRefreshIntervalInSec(1), mNumInputFrames(-1), mStarted(false), mSawInputEOS(false), mSignalledError(false), mHandle(new tagvideoEncControls), mEncParams(new tagvideoEncOptions), mInputFrameData(NULL) { if (!strcmp(name, "OMX.google.h263.encoder")) { mEncodeMode = H263_MODE; } else { CHECK(!strcmp(name, "OMX.google.mpeg4.encoder")); } initPorts(); ALOGI("Construct SoftMPEG4Encoder"); }
14,189
13,736
0
ZEND_API int add_index_resource(zval *arg, ulong index, int r) /* {{{ */ { zval *tmp; MAKE_STD_ZVAL(tmp); ZVAL_RESOURCE(tmp, r); return zend_hash_index_update(Z_ARRVAL_P(arg), index, (void *) &tmp, sizeof(zval *), NULL); } /* }}} */
14,190
166,404
0
bool GLES2Util::IsUnsignedIntegerFormat(uint32_t internal_format) { switch (internal_format) { case GL_R8UI: case GL_R16UI: case GL_R32UI: case GL_RG8UI: case GL_RG16UI: case GL_RG32UI: case GL_RGB8UI: case GL_RGB16UI: case GL_RGB32UI: case GL_RGBA8UI: case GL_RGB10_A2UI: case GL_RGBA16UI: case GL_RGBA32UI: return true; default: return false; } }
14,191
135,640
0
const SelectionInDOMTree& FrameSelection::GetSelectionInDOMTree() const { return selection_editor_->GetSelectionInDOMTree(); }
14,192
97,954
0
void RenderView::OnFillPasswordForm( const webkit_glue::PasswordFormFillData& form_data) { #if defined(WEBKIT_BUG_41283_IS_FIXED) password_autocomplete_manager_.ReceivedPasswordFormFillData(webview(), form_data); #else webkit_glue::FillPasswordForm(this->webview(), form_data); #endif }
14,193
91,501
0
static int gifPutWord(int w, gdIOCtx *out) { /* Byte order is little-endian */ gdPutC(w & 0xFF, out); gdPutC((w >> 8) & 0xFF, out); return 0; }
14,194
62,597
0
init_servarray(netdissect_options *ndo) { struct servent *sv; register struct hnamemem *table; register int i; char buf[sizeof("0000000000")]; while ((sv = getservent()) != NULL) { int port = ntohs(sv->s_port); i = port & (HASHNAMESIZE-1); if (strcmp(sv->s_proto, "tcp") == 0) table = &tporttable[i]; else if (strcmp(sv->s_proto, "udp") == 0) table = &uporttable[i]; else continue; while (table->name) table = table->nxt; if (ndo->ndo_nflag) { (void)snprintf(buf, sizeof(buf), "%d", port); table->name = strdup(buf); } else table->name = strdup(sv->s_name); if (table->name == NULL) (*ndo->ndo_error)(ndo, "init_servarray: strdup"); table->addr = port; table->nxt = newhnamemem(ndo); } endservent(); }
14,195
90,234
0
int ipmi_std_irq_setup(struct si_sm_io *io) { int rv; if (!io->irq) return 0; rv = request_irq(io->irq, ipmi_si_irq_handler, IRQF_SHARED, DEVICE_NAME, io->irq_handler_data); if (rv) { dev_warn(io->dev, "%s unable to claim interrupt %d," " running polled\n", DEVICE_NAME, io->irq); io->irq = 0; } else { io->irq_cleanup = std_irq_cleanup; ipmi_irq_finish_setup(io); dev_info(io->dev, "Using irq %d\n", io->irq); } return rv; }
14,196
160,965
0
void ChromeClientImpl::HandleKeyboardEventOnTextField( HTMLInputElement& input_element, KeyboardEvent& event) { if (auto* fill_client = AutofillClientFromFrame(input_element.GetDocument().GetFrame())) { fill_client->TextFieldDidReceiveKeyDown(WebInputElement(&input_element), WebKeyboardEventBuilder(event)); } }
14,197
81,957
0
static void findHotKeys(void) { redisReply *keys, *reply; unsigned long long counters[HOTKEYS_SAMPLE] = {0}; sds hotkeys[HOTKEYS_SAMPLE] = {NULL}; unsigned long long sampled = 0, total_keys, *freqs = NULL, it = 0; unsigned int arrsize = 0, i, k; double pct; /* Total keys pre scanning */ total_keys = getDbSize(); /* Status message */ printf("\n# Scanning the entire keyspace to find hot keys as well as\n"); printf("# average sizes per key type. You can use -i 0.1 to sleep 0.1 sec\n"); printf("# per 100 SCAN commands (not usually needed).\n\n"); /* SCAN loop */ do { /* Calculate approximate percentage completion */ pct = 100 * (double)sampled/total_keys; /* Grab some keys and point to the keys array */ reply = sendScan(&it); keys = reply->element[1]; /* Reallocate our freqs array if we need to */ if(keys->elements > arrsize) { freqs = zrealloc(freqs, sizeof(unsigned long long)*keys->elements); if(!freqs) { fprintf(stderr, "Failed to allocate storage for keys!\n"); exit(1); } arrsize = keys->elements; } getKeyFreqs(keys, freqs); /* Now update our stats */ for(i=0;i<keys->elements;i++) { sampled++; /* Update overall progress */ if(sampled % 1000000 == 0) { printf("[%05.2f%%] Sampled %llu keys so far\n", pct, sampled); } /* Use eviction pool here */ k = 0; while (k < HOTKEYS_SAMPLE && freqs[i] > counters[k]) k++; if (k == 0) continue; k--; if (k == 0 || counters[k] == 0) { sdsfree(hotkeys[k]); } else { sdsfree(hotkeys[0]); memmove(counters,counters+1,sizeof(counters[0])*k); memmove(hotkeys,hotkeys+1,sizeof(hotkeys[0])*k); } counters[k] = freqs[i]; hotkeys[k] = sdsnew(keys->element[i]->str); printf( "[%05.2f%%] Hot key '%s' found so far with counter %llu\n", pct, keys->element[i]->str, freqs[i]); } /* Sleep if we've been directed to do so */ if(sampled && (sampled %100) == 0 && config.interval) { usleep(config.interval); } freeReplyObject(reply); } while(it != 0); if (freqs) zfree(freqs); /* We're done */ printf("\n-------- summary -------\n\n"); printf("Sampled %llu keys in the keyspace!\n", sampled); for (i=1; i<= HOTKEYS_SAMPLE; i++) { k = HOTKEYS_SAMPLE - i; if(counters[k]>0) { printf("hot key found with counter: %llu\tkeyname: %s\n", counters[k], hotkeys[k]); sdsfree(hotkeys[k]); } } exit(0); }
14,198
21,481
0
renew_parental_timestamps(struct dentry *direntry) { /* BB check if there is a way to get the kernel to do this or if we really need this */ do { direntry->d_time = jiffies; direntry = direntry->d_parent; } while (!IS_ROOT(direntry)); }
14,199