unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
57,595
0
long keyctl_assume_authority(key_serial_t id) { struct key *authkey; long ret; /* special key IDs aren't permitted */ ret = -EINVAL; if (id < 0) goto error; /* we divest ourselves of authority if given an ID of 0 */ if (id == 0) { ret = keyctl_change_reqkey_auth(NULL); goto error; } /* attempt to assume the authority temporarily granted to us whilst we * instantiate the specified key * - the authorisation key must be in the current task's keyrings * somewhere */ authkey = key_get_instantiation_authkey(id); if (IS_ERR(authkey)) { ret = PTR_ERR(authkey); goto error; } ret = keyctl_change_reqkey_auth(authkey); if (ret < 0) goto error; key_put(authkey); ret = authkey->serial; error: return ret; }
3,800
158,774
0
bool CurrentFullscreenFrameTreeNodeIsEmpty() { WebContentsImpl* web_contents = static_cast<WebContentsImpl*>(shell()->web_contents()); return web_contents->current_fullscreen_frame_tree_node_id_ == RenderFrameHost::kNoFrameTreeNodeId; }
3,801
124,982
0
void RenderFlexibleBox::alignFlexLines(Vector<LineContext>& lineContexts) { if (!isMultiline() || style()->alignContent() == AlignContentFlexStart) return; LayoutUnit availableCrossAxisSpace = crossAxisContentExtent(); for (size_t i = 0; i < lineContexts.size(); ++i) availableCrossAxisSpace -= lineContexts[i].crossAxisExtent; RenderBox* child = m_orderIterator.first(); LayoutUnit lineOffset = initialAlignContentOffset(availableCrossAxisSpace, style()->alignContent(), lineContexts.size()); for (unsigned lineNumber = 0; lineNumber < lineContexts.size(); ++lineNumber) { lineContexts[lineNumber].crossAxisOffset += lineOffset; for (size_t childNumber = 0; childNumber < lineContexts[lineNumber].numberOfChildren; ++childNumber, child = m_orderIterator.next()) adjustAlignmentForChild(child, lineOffset); if (style()->alignContent() == AlignContentStretch && availableCrossAxisSpace > 0) lineContexts[lineNumber].crossAxisExtent += availableCrossAxisSpace / static_cast<unsigned>(lineContexts.size()); lineOffset += alignContentSpaceBetweenChildren(availableCrossAxisSpace, style()->alignContent(), lineContexts.size()); } }
3,802
75,717
0
const URI_TYPE(Uri) * source, UriMemoryManager * memory) { /* From this functions usage we know that * * the dest URI cannot be uri->owner */ /* Copy userInfo */ dest->userInfo = source->userInfo; /* Copy hostText */ dest->hostText = source->hostText; /* Copy hostData */ if (source->hostData.ip4 != NULL) { dest->hostData.ip4 = memory->malloc(memory, sizeof(UriIp4)); if (dest->hostData.ip4 == NULL) { return URI_FALSE; /* Raises malloc error */ } *(dest->hostData.ip4) = *(source->hostData.ip4); dest->hostData.ip6 = NULL; dest->hostData.ipFuture.first = NULL; dest->hostData.ipFuture.afterLast = NULL; } else if (source->hostData.ip6 != NULL) { dest->hostData.ip4 = NULL; dest->hostData.ip6 = memory->malloc(memory, sizeof(UriIp6)); if (dest->hostData.ip6 == NULL) { return URI_FALSE; /* Raises malloc error */ } *(dest->hostData.ip6) = *(source->hostData.ip6); dest->hostData.ipFuture.first = NULL; dest->hostData.ipFuture.afterLast = NULL; } else { dest->hostData.ip4 = NULL; dest->hostData.ip6 = NULL; dest->hostData.ipFuture = source->hostData.ipFuture; } /* Copy portText */ dest->portText = source->portText; return URI_TRUE; }
3,803
78,351
0
static int entersafe_process_fci(struct sc_card *card, struct sc_file *file, const u8 *buf, size_t buflen) { int r; assert(file); SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE); r = iso_ops->process_fci(card,file,buf,buflen); SC_TEST_RET(card->ctx, SC_LOG_DEBUG_NORMAL, r, "Process fci failed"); if(file->namelen) { file->type = SC_FILE_TYPE_DF; file->ef_structure = SC_FILE_EF_UNKNOWN; } else { file->type = SC_FILE_TYPE_WORKING_EF; file->ef_structure = SC_FILE_EF_TRANSPARENT; } SC_FUNC_RETURN(card->ctx, SC_LOG_DEBUG_VERBOSE, r); }
3,804
43,459
0
static void aes_encrypt(struct crypto_tfm *tfm, u8 *dst, const u8 *src) { struct crypto_aes_ctx *ctx = aes_ctx(crypto_tfm_ctx(tfm)); if (!irq_fpu_usable()) crypto_aes_encrypt_x86(ctx, dst, src); else { kernel_fpu_begin(); aesni_enc(ctx, dst, src); kernel_fpu_end(); } }
3,805
154,762
0
error::Error GLES2DecoderPassthroughImpl::DoPolygonOffset(GLfloat factor, GLfloat units) { api()->glPolygonOffsetFn(factor, units); return error::kNoError; }
3,806
88,265
0
externalEntityInitProcessor2(XML_Parser parser, const char *start, const char *end, const char **endPtr) { const char *next = start; /* XmlContentTok doesn't always set the last arg */ int tok = XmlContentTok(parser->m_encoding, start, end, &next); switch (tok) { case XML_TOK_BOM: /* If we are at the end of the buffer, this would cause the next stage, i.e. externalEntityInitProcessor3, to pass control directly to doContent (by detecting XML_TOK_NONE) without processing any xml text declaration - causing the error XML_ERROR_MISPLACED_XML_PI in doContent. */ if (next == end && ! parser->m_parsingStatus.finalBuffer) { *endPtr = next; return XML_ERROR_NONE; } start = next; break; case XML_TOK_PARTIAL: if (! parser->m_parsingStatus.finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } parser->m_eventPtr = start; return XML_ERROR_UNCLOSED_TOKEN; case XML_TOK_PARTIAL_CHAR: if (! parser->m_parsingStatus.finalBuffer) { *endPtr = start; return XML_ERROR_NONE; } parser->m_eventPtr = start; return XML_ERROR_PARTIAL_CHAR; } parser->m_processor = externalEntityInitProcessor3; return externalEntityInitProcessor3(parser, start, end, endPtr); }
3,807
184,310
1
PP_Bool LaunchSelLdr(PP_Instance instance, const char* alleged_url, int socket_count, void* imc_handles) { std::vector<nacl::FileDescriptor> sockets; IPC::Sender* sender = content::RenderThread::Get(); if (sender == NULL) sender = g_background_thread_sender.Pointer()->get(); IPC::ChannelHandle channel_handle; if (!sender->Send(new ChromeViewHostMsg_LaunchNaCl( GURL(alleged_url), socket_count, &sockets, &channel_handle))) { return PP_FALSE; } // Don't save invalid channel handles. bool invalid_handle = channel_handle.name.empty(); #if defined(OS_POSIX) if (!invalid_handle) invalid_handle = (channel_handle.socket.fd == -1); #endif if (!invalid_handle) g_channel_handle_map.Get()[instance] = channel_handle; CHECK(static_cast<int>(sockets.size()) == socket_count); for (int i = 0; i < socket_count; i++) { static_cast<nacl::Handle*>(imc_handles)[i] = nacl::ToNativeHandle(sockets[i]); } return PP_TRUE; }
3,808
141,876
0
bool AutofillPopupBaseView::OnMouseDragged(const ui::MouseEvent& event) { if (HitTestPoint(event.location())) { SetSelection(event.location()); return true; } ClearSelection(); return false; }
3,809
102,200
0
DictionaryValue* ToValue() const { DictionaryValue* value = new DictionaryValue(); value->SetInteger("totalCount", total_count); value->SetString("payload", payload); return value; }
3,810
66,237
0
mailimf_sender_parse(const char * message, size_t length, size_t * indx, struct mailimf_sender ** result) { struct mailimf_mailbox * mb; struct mailimf_sender * sender; size_t cur_token; int r; int res; cur_token = * indx; r = mailimf_token_case_insensitive_parse(message, length, &cur_token, "Sender"); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_colon_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_mailbox_parse(message, length, &cur_token, &mb); if (r != MAILIMF_NO_ERROR) { res = r; goto err; } r = mailimf_unstrict_crlf_parse(message, length, &cur_token); if (r != MAILIMF_NO_ERROR) { res = r; goto free_mb; } sender = mailimf_sender_new(mb); if (sender == NULL) { res = MAILIMF_ERROR_MEMORY; goto free_mb; } * result = sender; * indx = cur_token; return MAILIMF_NO_ERROR; free_mb: mailimf_mailbox_free(mb); err: return res; }
3,811
125,867
0
void ParamTraits<gfx::Vector2d>::Log(const gfx::Vector2d& v, std::string* l) { l->append(base::StringPrintf("(%d, %d)", v.x(), v.y())); }
3,812
114,317
0
getRequestableExtensionsCHROMIUM() { return WebKit::WebString::fromUTF8( gl_->GetRequestableExtensionsCHROMIUM()); }
3,813
129,907
0
void SpeechSynthesis::voicesDidChange() { m_voiceList.clear(); if (!executionContext()->activeDOMObjectsAreStopped()) dispatchEvent(Event::create(EventTypeNames::voiceschanged)); }
3,814
14,105
0
SProcRenderCreateSolidFill(ClientPtr client) { register int n; REQUEST (xRenderCreateSolidFillReq); REQUEST_AT_LEAST_SIZE (xRenderCreateSolidFillReq); swaps(&stuff->length, n); swapl(&stuff->pid, n); swaps(&stuff->color.alpha, n); swaps(&stuff->color.red, n); swaps(&stuff->color.green, n); swaps(&stuff->color.blue, n); return (*ProcRenderVector[stuff->renderReqType]) (client); }
3,815
160,747
0
void RenderFrameImpl::WasHidden() { for (auto& observer : observers_) observer.WasHidden(); #if BUILDFLAG(ENABLE_PLUGINS) for (auto* plugin : active_pepper_instances_) plugin->PageVisibilityChanged(false); #endif // ENABLE_PLUGINS if (GetWebFrame()->FrameWidget()) { GetWebFrame()->FrameWidget()->SetVisibilityState(VisibilityState()); } }
3,816
161,729
0
void PlatformSensor::NotifySensorError() { for (auto& client : clients_) client.OnSensorError(); }
3,817
4,956
0
gst_qtdemux_push_event (GstQTDemux * qtdemux, GstEvent * event) { guint n; GST_DEBUG_OBJECT (qtdemux, "pushing %s event on all source pads", GST_EVENT_TYPE_NAME (event)); for (n = 0; n < qtdemux->n_streams; n++) { GstPad *pad; if ((pad = qtdemux->streams[n]->pad)) gst_pad_push_event (pad, gst_event_ref (event)); } gst_event_unref (event); }
3,818
54,550
0
static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) { #ifdef MOV_EXPORT_ALL_METADATA char tmp_key[5]; #endif char str[1024], key2[16], language[4] = {0}; const char *key = NULL; uint16_t str_size, langcode = 0; uint32_t data_type = 0; int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL; switch (atom.type) { case MKTAG(0xa9,'n','a','m'): key = "title"; break; case MKTAG(0xa9,'a','u','t'): case MKTAG(0xa9,'A','R','T'): key = "artist"; break; case MKTAG( 'a','A','R','T'): key = "album_artist"; break; case MKTAG(0xa9,'w','r','t'): key = "composer"; break; case MKTAG( 'c','p','r','t'): case MKTAG(0xa9,'c','p','y'): key = "copyright"; break; case MKTAG(0xa9,'g','r','p'): key = "grouping"; break; case MKTAG(0xa9,'l','y','r'): key = "lyrics"; break; case MKTAG(0xa9,'c','m','t'): case MKTAG(0xa9,'i','n','f'): key = "comment"; break; case MKTAG(0xa9,'a','l','b'): key = "album"; break; case MKTAG(0xa9,'d','a','y'): key = "date"; break; case MKTAG(0xa9,'g','e','n'): key = "genre"; break; case MKTAG( 'g','n','r','e'): key = "genre"; parse = mov_metadata_gnre; break; case MKTAG(0xa9,'t','o','o'): case MKTAG(0xa9,'s','w','r'): key = "encoder"; break; case MKTAG(0xa9,'e','n','c'): key = "encoder"; break; case MKTAG( 'd','e','s','c'): key = "description";break; case MKTAG( 'l','d','e','s'): key = "synopsis"; break; case MKTAG( 't','v','s','h'): key = "show"; break; case MKTAG( 't','v','e','n'): key = "episode_id";break; case MKTAG( 't','v','n','n'): key = "network"; break; case MKTAG( 't','r','k','n'): key = "track"; parse = mov_metadata_track_or_disc_number; break; case MKTAG( 'd','i','s','k'): key = "disc"; parse = mov_metadata_track_or_disc_number; break; case MKTAG( 't','v','e','s'): key = "episode_sort"; parse = mov_metadata_int8_bypass_padding; break; case MKTAG( 't','v','s','n'): key = "season_number"; parse = mov_metadata_int8_bypass_padding; break; case MKTAG( 's','t','i','k'): key = "media_type"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 'h','d','v','d'): key = "hd_video"; parse = mov_metadata_int8_no_padding; break; case MKTAG( 'p','g','a','p'): key = "gapless_playback"; parse = mov_metadata_int8_no_padding; break; } if (c->itunes_metadata && atom.size > 8) { int data_size = avio_rb32(pb); int tag = avio_rl32(pb); if (tag == MKTAG('d','a','t','a')) { data_type = avio_rb32(pb); // type avio_rb32(pb); // unknown str_size = data_size - 16; atom.size -= 16; } else return 0; } else if (atom.size > 4 && key && !c->itunes_metadata) { str_size = avio_rb16(pb); // string length langcode = avio_rb16(pb); ff_mov_lang_to_iso639(langcode, language); atom.size -= 4; } else str_size = atom.size; #ifdef MOV_EXPORT_ALL_METADATA if (!key) { snprintf(tmp_key, 5, "%.4s", (char*)&atom.type); key = tmp_key; } #endif if (!key) return 0; if (atom.size < 0) return AVERROR_INVALIDDATA; str_size = FFMIN3(sizeof(str)-1, str_size, atom.size); if (parse) parse(c, pb, str_size, key); else { if (data_type == 3 || (data_type == 0 && (langcode < 0x400 || langcode == 0x7fff))) { // MAC Encoded mov_read_mac_string(c, pb, str_size, str, sizeof(str)); } else { avio_read(pb, str, str_size); str[str_size] = 0; } av_dict_set(&c->fc->metadata, key, str, 0); if (*language && strcmp(language, "und")) { snprintf(key2, sizeof(key2), "%s-%s", key, language); av_dict_set(&c->fc->metadata, key2, str, 0); } } av_dlog(c->fc, "lang \"%3s\" ", language); av_dlog(c->fc, "tag \"%s\" value \"%s\" atom \"%.4s\" %d %"PRId64"\n", key, str, (char*)&atom.type, str_size, atom.size); return 0; }
3,819
61,920
0
int mbedtls_x509_crt_verify( mbedtls_x509_crt *crt, mbedtls_x509_crt *trust_ca, mbedtls_x509_crl *ca_crl, const char *cn, uint32_t *flags, int (*f_vrfy)(void *, mbedtls_x509_crt *, int, uint32_t *), void *p_vrfy ) { return( mbedtls_x509_crt_verify_with_profile( crt, trust_ca, ca_crl, &mbedtls_x509_crt_profile_default, cn, flags, f_vrfy, p_vrfy ) ); }
3,820
1,885
0
static void reds_handle_ssl_accept(int fd, int event, void *data) { RedLinkInfo *link = (RedLinkInfo *)data; int return_code; if ((return_code = SSL_accept(link->stream->ssl)) != 1) { int ssl_error = SSL_get_error(link->stream->ssl, return_code); if (ssl_error != SSL_ERROR_WANT_READ && ssl_error != SSL_ERROR_WANT_WRITE) { spice_warning("SSL_accept failed, error=%d", ssl_error); reds_link_free(link); } else { if (ssl_error == SSL_ERROR_WANT_READ) { core->watch_update_mask(link->stream->watch, SPICE_WATCH_EVENT_READ); } else { core->watch_update_mask(link->stream->watch, SPICE_WATCH_EVENT_WRITE); } } return; } reds_stream_remove_watch(link->stream); reds_handle_new_link(link); }
3,821
156,123
0
void HTMLLinkElement::ParseAttribute( const AttributeModificationParams& params) { const QualifiedName& name = params.name; const AtomicString& value = params.new_value; if (name == relAttr) { rel_attribute_ = LinkRelAttribute(value); if (rel_attribute_.IsImport()) { Deprecation::CountDeprecation(GetDocument(), WebFeature::kHTMLImports); } rel_list_->DidUpdateAttributeValue(params.old_value, value); Process(); } else if (name == hrefAttr) { LogUpdateAttributeIfIsolatedWorldAndInDocument("link", params); Process(); } else if (name == typeAttr) { type_ = value; Process(); } else if (name == asAttr) { as_ = value; Process(); } else if (name == referrerpolicyAttr) { if (!value.IsNull()) { SecurityPolicy::ReferrerPolicyFromString( value, kDoNotSupportReferrerPolicyLegacyKeywords, &referrer_policy_); UseCounter::Count(GetDocument(), WebFeature::kHTMLLinkElementReferrerPolicyAttribute); } } else if (name == sizesAttr) { sizes_->DidUpdateAttributeValue(params.old_value, value); WebVector<WebSize> web_icon_sizes = WebIconSizesParser::ParseIconSizes(value); icon_sizes_.resize(SafeCast<wtf_size_t>(web_icon_sizes.size())); for (wtf_size_t i = 0; i < icon_sizes_.size(); ++i) icon_sizes_[i] = web_icon_sizes[i]; Process(); } else if (name == mediaAttr) { media_ = value.DeprecatedLower(); Process(); } else if (name == scopeAttr) { scope_ = value; Process(); } else if (name == integrityAttr) { integrity_ = value; } else if (name == importanceAttr && RuntimeEnabledFeatures::PriorityHintsEnabled()) { importance_ = value; } else if (name == disabledAttr) { UseCounter::Count(GetDocument(), WebFeature::kHTMLLinkElementDisabled); if (params.reason == AttributeModificationReason::kByParser) UseCounter::Count(GetDocument(), WebFeature::kHTMLLinkElementDisabledByParser); if (LinkStyle* link = GetLinkStyle()) link->SetDisabledState(!value.IsNull()); } else { if (name == titleAttr) { if (LinkStyle* link = GetLinkStyle()) link->SetSheetTitle(value); } HTMLElement::ParseAttribute(params); } }
3,822
34,963
0
void rpc_init_wait_queue(struct rpc_wait_queue *queue, const char *qname) { __rpc_init_priority_wait_queue(queue, qname, 1); }
3,823
58,427
0
cmsIntentsList* SearchIntent(cmsUInt32Number Intent) { cmsIntentsList* pt; for (pt = Intents; pt != NULL; pt = pt -> Next) if (pt ->Intent == Intent) return pt; return NULL; }
3,824
23,306
0
static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fattr *fattr, struct nfs_fh *fh, const struct nfs_server *server, int may_sleep) { int status; umode_t fmode = 0; uint32_t type; int32_t err; status = decode_attr_type(xdr, bitmap, &type); if (status < 0) goto xdr_error; fattr->mode = 0; if (status != 0) { fattr->mode |= nfs_type2fmt[type]; fattr->valid |= status; } status = decode_attr_change(xdr, bitmap, &fattr->change_attr); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_size(xdr, bitmap, &fattr->size); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_fsid(xdr, bitmap, &fattr->fsid); if (status < 0) goto xdr_error; fattr->valid |= status; err = 0; status = decode_attr_error(xdr, bitmap, &err); if (status < 0) goto xdr_error; if (err == -NFS4ERR_WRONGSEC) nfs_fixup_secinfo_attributes(fattr, fh); status = decode_attr_filehandle(xdr, bitmap, fh); if (status < 0) goto xdr_error; status = decode_attr_fileid(xdr, bitmap, &fattr->fileid); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_fs_locations(xdr, bitmap, container_of(fattr, struct nfs4_fs_locations, fattr)); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_mode(xdr, bitmap, &fmode); if (status < 0) goto xdr_error; if (status != 0) { fattr->mode |= fmode; fattr->valid |= status; } status = decode_attr_nlink(xdr, bitmap, &fattr->nlink); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_owner(xdr, bitmap, server, &fattr->uid, may_sleep); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_group(xdr, bitmap, server, &fattr->gid, may_sleep); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_rdev(xdr, bitmap, &fattr->rdev); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_space_used(xdr, bitmap, &fattr->du.nfs3.used); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_time_access(xdr, bitmap, &fattr->atime); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_time_metadata(xdr, bitmap, &fattr->ctime); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_time_modify(xdr, bitmap, &fattr->mtime); if (status < 0) goto xdr_error; fattr->valid |= status; status = decode_attr_mounted_on_fileid(xdr, bitmap, &fattr->mounted_on_fileid); if (status < 0) goto xdr_error; fattr->valid |= status; xdr_error: dprintk("%s: xdr returned %d\n", __func__, -status); return status; }
3,825
87,242
0
choose_volume(struct archive_read *a, struct iso9660 *iso9660) { struct file_info *file; int64_t skipsize; struct vd *vd; const void *block; char seenJoliet; vd = &(iso9660->primary); if (!iso9660->opt_support_joliet) iso9660->seenJoliet = 0; if (iso9660->seenJoliet && vd->location > iso9660->joliet.location) /* This condition is unlikely; by way of caution. */ vd = &(iso9660->joliet); skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location; skipsize = __archive_read_consume(a, skipsize); if (skipsize < 0) return ((int)skipsize); iso9660->current_position = skipsize; block = __archive_read_ahead(a, vd->size, NULL); if (block == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Failed to read full block when scanning " "ISO9660 directory list"); return (ARCHIVE_FATAL); } /* * While reading Root Directory, flag seenJoliet must be zero to * avoid converting special name 0x00(Current Directory) and * next byte to UCS2. */ seenJoliet = iso9660->seenJoliet;/* Save flag. */ iso9660->seenJoliet = 0; file = parse_file_info(a, NULL, block, vd->size); if (file == NULL) return (ARCHIVE_FATAL); iso9660->seenJoliet = seenJoliet; /* * If the iso image has both RockRidge and Joliet, we preferentially * use RockRidge Extensions rather than Joliet ones. */ if (vd == &(iso9660->primary) && iso9660->seenRockridge && iso9660->seenJoliet) iso9660->seenJoliet = 0; if (vd == &(iso9660->primary) && !iso9660->seenRockridge && iso9660->seenJoliet) { /* Switch reading data from primary to joliet. */ vd = &(iso9660->joliet); skipsize = LOGICAL_BLOCK_SIZE * (int64_t)vd->location; skipsize -= iso9660->current_position; skipsize = __archive_read_consume(a, skipsize); if (skipsize < 0) return ((int)skipsize); iso9660->current_position += skipsize; block = __archive_read_ahead(a, vd->size, NULL); if (block == NULL) { archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, "Failed to read full block when scanning " "ISO9660 directory list"); return (ARCHIVE_FATAL); } iso9660->seenJoliet = 0; file = parse_file_info(a, NULL, block, vd->size); if (file == NULL) return (ARCHIVE_FATAL); iso9660->seenJoliet = seenJoliet; } /* Store the root directory in the pending list. */ if (add_entry(a, iso9660, file) != ARCHIVE_OK) return (ARCHIVE_FATAL); if (iso9660->seenRockridge) { a->archive.archive_format = ARCHIVE_FORMAT_ISO9660_ROCKRIDGE; a->archive.archive_format_name = "ISO9660 with Rockridge extensions"; } return (ARCHIVE_OK); }
3,826
30,636
0
static void irda_connect_confirm(void *instance, void *sap, struct qos_info *qos, __u32 max_sdu_size, __u8 max_header_size, struct sk_buff *skb) { struct irda_sock *self; struct sock *sk; self = instance; IRDA_DEBUG(2, "%s(%p)\n", __func__, self); sk = instance; if (sk == NULL) { dev_kfree_skb(skb); return; } dev_kfree_skb(skb); /* How much header space do we need to reserve */ self->max_header_size = max_header_size; /* IrTTP max SDU size in transmit direction */ self->max_sdu_size_tx = max_sdu_size; /* Find out what the largest chunk of data that we can transmit is */ switch (sk->sk_type) { case SOCK_STREAM: if (max_sdu_size != 0) { IRDA_ERROR("%s: max_sdu_size must be 0\n", __func__); return; } self->max_data_size = irttp_get_max_seg_size(self->tsap); break; case SOCK_SEQPACKET: if (max_sdu_size == 0) { IRDA_ERROR("%s: max_sdu_size cannot be 0\n", __func__); return; } self->max_data_size = max_sdu_size; break; default: self->max_data_size = irttp_get_max_seg_size(self->tsap); } IRDA_DEBUG(2, "%s(), max_data_size=%d\n", __func__, self->max_data_size); memcpy(&self->qos_tx, qos, sizeof(struct qos_info)); /* We are now connected! */ sk->sk_state = TCP_ESTABLISHED; sk->sk_state_change(sk); }
3,827
69,451
0
nfs_idmap_abort_pipe_upcall(struct idmap *idmap, int ret) { if (idmap->idmap_upcall_data != NULL) nfs_idmap_complete_pipe_upcall_locked(idmap, ret); }
3,828
96,610
0
static int bin_relocs(RCore *r, int mode, int va) { bool bin_demangle = r_config_get_i (r->config, "bin.demangle"); bool keep_lib = r_config_get_i (r->config, "bin.demangle.libs"); const char *lang = r_config_get (r->config, "bin.lang"); RBIter iter; RBinReloc *reloc = NULL; Sdb *db = NULL; PJ *pj = NULL; char *sdb_module = NULL; int i = 0; R_TIME_BEGIN; va = VA_TRUE; // XXX relocs always vaddr? RBNode *relocs = r_bin_patch_relocs (r->bin); if (!relocs) { relocs = r_bin_get_relocs (r->bin); } if (IS_MODE_RAD (mode)) { r_cons_println ("fs relocs"); } else if (IS_MODE_NORMAL (mode)) { r_cons_println ("[Relocations]"); } else if (IS_MODE_JSON (mode)) { pj = pj_new (); if (pj) { pj_a (pj); } } else if (IS_MODE_SET (mode)) { r_flag_space_set (r->flags, R_FLAGS_FS_RELOCS); } r_rbtree_foreach (relocs, iter, reloc, RBinReloc, vrb) { ut64 addr = rva (r->bin, reloc->paddr, reloc->vaddr, va); if (IS_MODE_SET (mode) && (is_section_reloc (reloc) || is_file_reloc (reloc))) { /* * Skip section reloc because they will have their own flag. * Skip also file reloc because not useful for now. */ } else if (IS_MODE_SET (mode)) { set_bin_relocs (r, reloc, addr, &db, &sdb_module); add_metadata (r, reloc, addr, mode); } else if (IS_MODE_SIMPLE (mode)) { r_cons_printf ("0x%08"PFMT64x" %s\n", addr, reloc->import ? reloc->import->name : ""); } else if (IS_MODE_RAD (mode)) { char *name = reloc->import ? strdup (reloc->import->name) : (reloc->symbol ? strdup (reloc->symbol->name) : NULL); if (name && bin_demangle) { char *mn = r_bin_demangle (r->bin->cur, NULL, name, addr, keep_lib); if (mn) { free (name); name = mn; } } if (name) { int reloc_size = 4; char *n = __filterQuotedShell (name); r_cons_printf ("\"f %s%s%s %d 0x%08"PFMT64x"\"\n", r->bin->prefix ? r->bin->prefix : "reloc.", r->bin->prefix ? "." : "", n, reloc_size, addr); add_metadata (r, reloc, addr, mode); free (n); free (name); } } else if (IS_MODE_JSON (mode)) { if (pj) { pj_o (pj); char *mn = NULL; char *relname = NULL; if (reloc->import) { mn = r_bin_demangle (r->bin->cur, lang, reloc->import->name, addr, keep_lib); relname = strdup (reloc->import->name); } else if (reloc->symbol) { mn = r_bin_demangle (r->bin->cur, lang, reloc->symbol->name, addr, keep_lib); relname = strdup (reloc->symbol->name); } pj_ks (pj, "name", (relname && strcmp (relname, "")) ? relname : "N/A"); pj_ks (pj, "demname", mn ? mn : ""); pj_ks (pj, "type", bin_reloc_type_name (reloc)); pj_kn (pj, "vaddr", reloc->vaddr); pj_kn (pj, "paddr", reloc->paddr); if (reloc->symbol) { pj_kn (pj, "sym_va", reloc->symbol->vaddr); } pj_kb (pj, "is_ifunc", reloc->is_ifunc); pj_end (pj); free (mn); if (relname) { free (relname); } } } else if (IS_MODE_NORMAL (mode)) { char *name = reloc->import ? strdup (reloc->import->name) : reloc->symbol ? strdup (reloc->symbol->name) : strdup ("null"); if (bin_demangle) { char *mn = r_bin_demangle (r->bin->cur, NULL, name, addr, keep_lib); if (mn && *mn) { free (name); name = mn; } } r_cons_printf ("vaddr=0x%08"PFMT64x" paddr=0x%08"PFMT64x" type=%s", addr, reloc->paddr, bin_reloc_type_name (reloc)); if (reloc->import && reloc->import->name[0]) { r_cons_printf (" %s", name); } else if (reloc->symbol && name && name[0]) { r_cons_printf (" %s", name); } R_FREE (name); if (reloc->addend) { if ((reloc->import || (reloc->symbol && !R_STR_ISEMPTY (name))) && reloc->addend > 0) { r_cons_printf (" +"); } if (reloc->addend < 0) { r_cons_printf (" - 0x%08"PFMT64x, -reloc->addend); } else { r_cons_printf (" 0x%08"PFMT64x, reloc->addend); } } if (reloc->is_ifunc) { r_cons_print (" (ifunc)"); } r_cons_newline (); } i++; } if (IS_MODE_JSON (mode)) { pj_end (pj); r_cons_println (pj_string (pj)); } if (IS_MODE_NORMAL (mode)) { r_cons_printf ("\n%i relocations\n", i); } if (pj) { pj_free (pj); } R_FREE (sdb_module); sdb_free (db); db = NULL; R_TIME_END; return relocs != NULL; }
3,829
10,719
0
TT_Load_Context( TT_ExecContext exec, TT_Face face, TT_Size size ) { FT_Int i; FT_ULong tmp; TT_MaxProfile* maxp; FT_Error error; exec->face = face; maxp = &face->max_profile; exec->size = size; if ( size ) { exec->numFDefs = size->num_function_defs; exec->maxFDefs = size->max_function_defs; exec->numIDefs = size->num_instruction_defs; exec->maxIDefs = size->max_instruction_defs; exec->FDefs = size->function_defs; exec->IDefs = size->instruction_defs; exec->pointSize = size->point_size; exec->tt_metrics = size->ttmetrics; exec->metrics = *size->metrics; exec->maxFunc = size->max_func; exec->maxIns = size->max_ins; for ( i = 0; i < TT_MAX_CODE_RANGES; i++ ) exec->codeRangeTable[i] = size->codeRangeTable[i]; /* set graphics state */ exec->GS = size->GS; exec->cvtSize = size->cvt_size; exec->cvt = size->cvt; exec->storeSize = size->storage_size; exec->storage = size->storage; exec->twilight = size->twilight; /* In case of multi-threading it can happen that the old size object */ /* no longer exists, thus we must clear all glyph zone references. */ FT_ZERO( &exec->zp0 ); exec->zp1 = exec->zp0; exec->zp2 = exec->zp0; } /* XXX: We reserve a little more elements on the stack to deal safely */ /* with broken fonts like arialbs, courbs, timesbs, etc. */ tmp = (FT_ULong)exec->stackSize; error = Update_Max( exec->memory, &tmp, sizeof ( FT_F26Dot6 ), (void*)&exec->stack, maxp->maxStackElements + 32 ); exec->stackSize = (FT_Long)tmp; if ( error ) return error; tmp = exec->glyphSize; error = Update_Max( exec->memory, &tmp, sizeof ( FT_Byte ), (void*)&exec->glyphIns, maxp->maxSizeOfInstructions ); exec->glyphSize = (FT_UShort)tmp; if ( error ) return error; exec->pts.n_points = 0; exec->pts.n_contours = 0; exec->zp1 = exec->pts; exec->zp2 = exec->pts; exec->zp0 = exec->pts; exec->instruction_trap = FALSE; return FT_Err_Ok; }
3,830
158,171
0
void CallOnReceivedResponse( const network::ResourceResponseHead& head, network::mojom::URLLoaderClientEndpointsPtr url_loader_client_endpoints, std::unique_ptr<NavigationData> cloned_navigation_data, bool is_download, bool is_stream, PreviewsState previews_state) { scoped_refptr<network::ResourceResponse> response( new network::ResourceResponse()); response->head = head; base::PostTaskWithTraits( FROM_HERE, {BrowserThread::UI}, base::BindOnce(&NavigationURLLoaderImpl::OnReceiveResponse, owner_, response->DeepCopy(), std::move(url_loader_client_endpoints), std::move(cloned_navigation_data), global_request_id_, is_download, is_stream, previews_state)); }
3,831
38,657
0
static void tm_reclaim_thread(struct thread_struct *thr, struct thread_info *ti, uint8_t cause) { unsigned long msr_diff = 0; /* * If FP/VSX registers have been already saved to the * thread_struct, move them to the transact_fp array. * We clear the TIF_RESTORE_TM bit since after the reclaim * the thread will no longer be transactional. */ if (test_ti_thread_flag(ti, TIF_RESTORE_TM)) { msr_diff = thr->tm_orig_msr & ~thr->regs->msr; if (msr_diff & MSR_FP) memcpy(&thr->transact_fp, &thr->fp_state, sizeof(struct thread_fp_state)); if (msr_diff & MSR_VEC) memcpy(&thr->transact_vr, &thr->vr_state, sizeof(struct thread_vr_state)); clear_ti_thread_flag(ti, TIF_RESTORE_TM); msr_diff &= MSR_FP | MSR_VEC | MSR_VSX | MSR_FE0 | MSR_FE1; } tm_reclaim(thr, thr->regs->msr, cause); /* Having done the reclaim, we now have the checkpointed * FP/VSX values in the registers. These might be valid * even if we have previously called enable_kernel_fp() or * flush_fp_to_thread(), so update thr->regs->msr to * indicate their current validity. */ thr->regs->msr |= msr_diff; }
3,832
40,264
0
misdn_sock_cleanup(void) { sock_unregister(PF_ISDN); }
3,833
30,727
0
static void rfcomm_sk_state_change(struct rfcomm_dlc *d, int err) { struct sock *sk = d->owner, *parent; unsigned long flags; if (!sk) return; BT_DBG("dlc %p state %ld err %d", d, d->state, err); local_irq_save(flags); bh_lock_sock(sk); if (err) sk->sk_err = err; sk->sk_state = d->state; parent = bt_sk(sk)->parent; if (parent) { if (d->state == BT_CLOSED) { sock_set_flag(sk, SOCK_ZAPPED); bt_accept_unlink(sk); } parent->sk_data_ready(parent, 0); } else { if (d->state == BT_CONNECTED) rfcomm_session_getaddr(d->session, &bt_sk(sk)->src, NULL); sk->sk_state_change(sk); } bh_unlock_sock(sk); local_irq_restore(flags); if (parent && sock_flag(sk, SOCK_ZAPPED)) { /* We have to drop DLC lock here, otherwise * rfcomm_sock_destruct() will dead lock. */ rfcomm_dlc_unlock(d); rfcomm_sock_kill(sk); rfcomm_dlc_lock(d); } }
3,834
5,102
0
static size_t curl_progress(void *clientp, double dltotal, double dlnow, double ultotal, double ulnow) { php_curl *ch = (php_curl *)clientp; php_curl_progress *t = ch->handlers->progress; size_t rval = 0; #if PHP_CURL_DEBUG fprintf(stderr, "curl_progress() called\n"); fprintf(stderr, "clientp = %x, dltotal = %f, dlnow = %f, ultotal = %f, ulnow = %f\n", clientp, dltotal, dlnow, ultotal, ulnow); #endif switch (t->method) { case PHP_CURL_USER: { zval argv[5]; zval retval; int error; zend_fcall_info fci; ZVAL_RES(&argv[0], ch->res); Z_ADDREF(argv[0]); ZVAL_LONG(&argv[1], (zend_long)dltotal); ZVAL_LONG(&argv[2], (zend_long)dlnow); ZVAL_LONG(&argv[3], (zend_long)ultotal); ZVAL_LONG(&argv[4], (zend_long)ulnow); fci.size = sizeof(fci); fci.function_table = EG(function_table); ZVAL_COPY_VALUE(&fci.function_name, &t->func_name); fci.object = NULL; fci.retval = &retval; fci.param_count = 5; fci.params = argv; fci.no_separation = 0; fci.symbol_table = NULL; ch->in_callback = 1; error = zend_call_function(&fci, &t->fci_cache); ch->in_callback = 0; if (error == FAILURE) { php_error_docref(NULL, E_WARNING, "Cannot call the CURLOPT_PROGRESSFUNCTION"); } else if (!Z_ISUNDEF(retval)) { if (Z_TYPE(retval) != IS_LONG) { convert_to_long_ex(&retval); } if (0 != Z_LVAL(retval)) { rval = 1; } } zval_ptr_dtor(&argv[0]); zval_ptr_dtor(&argv[1]); zval_ptr_dtor(&argv[2]); zval_ptr_dtor(&argv[3]); zval_ptr_dtor(&argv[4]); break; } } return rval; }
3,835
48,699
0
apr_status_t h2_stream_close_input(h2_stream *stream) { conn_rec *c = stream->session->c; apr_status_t status; apr_bucket_brigade *tmp; apr_bucket *b; ap_log_cerror(APLOG_MARK, APLOG_TRACE1, 0, stream->session->c, "h2_stream(%ld-%d): closing input", stream->session->id, stream->id); if (stream->rst_error) { return APR_ECONNRESET; } tmp = apr_brigade_create(stream->pool, c->bucket_alloc); if (stream->trailers && !apr_is_empty_table(stream->trailers)) { h2_headers *r = h2_headers_create(HTTP_OK, stream->trailers, NULL, stream->pool); b = h2_bucket_headers_create(c->bucket_alloc, r); APR_BRIGADE_INSERT_TAIL(tmp, b); stream->trailers = NULL; } b = apr_bucket_eos_create(c->bucket_alloc); APR_BRIGADE_INSERT_TAIL(tmp, b); status = h2_beam_send(stream->input, tmp, APR_BLOCK_READ); apr_brigade_destroy(tmp); return status; }
3,836
98,599
0
void DraggedTabGtk::SetContainerColorMap() { GdkScreen* screen = gtk_widget_get_screen(container_); GdkColormap* colormap = gdk_screen_get_rgba_colormap(screen); if (!colormap) colormap = gdk_screen_get_rgb_colormap(screen); gtk_widget_set_colormap(container_, colormap); }
3,837
167,633
0
void OnShowWidget(int routing_id, const gfx::Rect& initial_rect) { content::BrowserThread::PostTask( content::BrowserThread::UI, FROM_HERE, base::BindOnce(&PendingWidgetMessageFilter::OnReceivedRoutingIDOnUI, this, routing_id)); }
3,838
15,241
0
PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC) { PGresult *pg_result; char *src, *tmp_name, *tmp_name2 = NULL; char *escaped; smart_str querystr = {0}; size_t new_len; int i, num_rows; zval *elem; if (!*table_name) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The table name must be specified"); return FAILURE; } src = estrdup(table_name); tmp_name = php_strtok_r(src, ".", &tmp_name2); if (!tmp_name2 || !*tmp_name2) { /* Default schema */ tmp_name2 = tmp_name; tmp_name = "public"; } smart_str_appends(&querystr, "SELECT a.attname, a.attnum, t.typname, a.attlen, a.attnotnull, a.atthasdef, a.attndims, t.typtype = 'e' " "FROM pg_class as c, pg_attribute a, pg_type t, pg_namespace n " "WHERE a.attnum > 0 AND a.attrelid = c.oid AND c.relname = '"); escaped = (char *)safe_emalloc(strlen(tmp_name2), 2, 1); new_len = PQescapeStringConn(pg_link, escaped, tmp_name2, strlen(tmp_name2), NULL); if (new_len) { smart_str_appendl(&querystr, escaped, new_len); } efree(escaped); smart_str_appends(&querystr, "' AND c.relnamespace = n.oid AND n.nspname = '"); escaped = (char *)safe_emalloc(strlen(tmp_name), 2, 1); new_len = PQescapeStringConn(pg_link, escaped, tmp_name, strlen(tmp_name), NULL); if (new_len) { smart_str_appendl(&querystr, escaped, new_len); } efree(escaped); smart_str_appends(&querystr, "' AND a.atttypid = t.oid ORDER BY a.attnum;"); smart_str_0(&querystr); efree(src); pg_result = PQexec(pg_link, querystr.c); if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Table '%s' doesn't exists", table_name); smart_str_free(&querystr); PQclear(pg_result); return FAILURE; } smart_str_free(&querystr); for (i = 0; i < num_rows; i++) { char *name; MAKE_STD_ZVAL(elem); array_init(elem); add_assoc_long(elem, "num", atoi(PQgetvalue(pg_result,i,1))); add_assoc_string(elem, "type", PQgetvalue(pg_result,i,2), 1); add_assoc_long(elem, "len", atoi(PQgetvalue(pg_result,i,3))); if (!strcmp(PQgetvalue(pg_result,i,4), "t")) { add_assoc_bool(elem, "not null", 1); } else { add_assoc_bool(elem, "not null", 0); } if (!strcmp(PQgetvalue(pg_result,i,5), "t")) { add_assoc_bool(elem, "has default", 1); } else { add_assoc_bool(elem, "has default", 0); } add_assoc_long(elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); if (!strcmp(PQgetvalue(pg_result,i,7), "t")) { add_assoc_bool(elem, "is enum", 1); } else { add_assoc_bool(elem, "is enum", 0); } name = PQgetvalue(pg_result,i,0); add_assoc_zval(meta, name, elem); } PQclear(pg_result); return SUCCESS; }
3,839
167,542
0
void WebMediaPlayerImpl::SwitchToLocalRenderer( MediaObserverClient::ReasonToSwitchToLocal reason) { DCHECK(main_task_runner_->BelongsToCurrentThread()); DCHECK(disable_pipeline_auto_suspend_); disable_pipeline_auto_suspend_ = false; CreateVideoDecodeStatsReporter(); ScheduleRestart(); if (client_) client_->MediaRemotingStopped(GetSwitchToLocalMessage(reason)); }
3,840
24,618
0
static int fuse_notify_store(struct fuse_conn *fc, unsigned int size, struct fuse_copy_state *cs) { struct fuse_notify_store_out outarg; struct inode *inode; struct address_space *mapping; u64 nodeid; int err; pgoff_t index; unsigned int offset; unsigned int num; loff_t file_size; loff_t end; err = -EINVAL; if (size < sizeof(outarg)) goto out_finish; err = fuse_copy_one(cs, &outarg, sizeof(outarg)); if (err) goto out_finish; err = -EINVAL; if (size - sizeof(outarg) != outarg.size) goto out_finish; nodeid = outarg.nodeid; down_read(&fc->killsb); err = -ENOENT; if (!fc->sb) goto out_up_killsb; inode = ilookup5(fc->sb, nodeid, fuse_inode_eq, &nodeid); if (!inode) goto out_up_killsb; mapping = inode->i_mapping; index = outarg.offset >> PAGE_CACHE_SHIFT; offset = outarg.offset & ~PAGE_CACHE_MASK; file_size = i_size_read(inode); end = outarg.offset + outarg.size; if (end > file_size) { file_size = end; fuse_write_update_size(inode, file_size); } num = outarg.size; while (num) { struct page *page; unsigned int this_num; err = -ENOMEM; page = find_or_create_page(mapping, index, mapping_gfp_mask(mapping)); if (!page) goto out_iput; this_num = min_t(unsigned, num, PAGE_CACHE_SIZE - offset); err = fuse_copy_page(cs, &page, offset, this_num, 0); if (!err && offset == 0 && (num != 0 || file_size == end)) SetPageUptodate(page); unlock_page(page); page_cache_release(page); if (err) goto out_iput; num -= this_num; offset = 0; index++; } err = 0; out_iput: iput(inode); out_up_killsb: up_read(&fc->killsb); out_finish: fuse_copy_finish(cs); return err; }
3,841
151,232
0
void InspectorPageAgent::Did(const probe::UpdateLayout&) { PageLayoutInvalidated(false); }
3,842
1,088
0
void GfxSubpath::offset(double dx, double dy) { int i; for (i = 0; i < n; ++i) { x[i] += dx; y[i] += dy; } }
3,843
121,112
0
String HTMLInputElement::accept() const { return fastGetAttribute(acceptAttr); }
3,844
44,213
0
SSL_SESSION *SSL_SESSION_new(void) { SSL_SESSION *ss; ss = OPENSSL_malloc(sizeof(*ss)); if (ss == NULL) { SSLerr(SSL_F_SSL_SESSION_NEW, ERR_R_MALLOC_FAILURE); return (0); } memset(ss, 0, sizeof(*ss)); ss->verify_result = 1; /* avoid 0 (= X509_V_OK) just in case */ ss->references = 1; ss->timeout = 60 * 5 + 4; /* 5 minute timeout by default */ ss->time = (unsigned long)time(NULL); ss->prev = NULL; ss->next = NULL; ss->compress_meth = 0; ss->tlsext_hostname = NULL; #ifndef OPENSSL_NO_EC ss->tlsext_ecpointformatlist_length = 0; ss->tlsext_ecpointformatlist = NULL; ss->tlsext_ellipticcurvelist_length = 0; ss->tlsext_ellipticcurvelist = NULL; #endif CRYPTO_new_ex_data(CRYPTO_EX_INDEX_SSL_SESSION, ss, &ss->ex_data); #ifndef OPENSSL_NO_PSK ss->psk_identity_hint = NULL; ss->psk_identity = NULL; #endif #ifndef OPENSSL_NO_SRP ss->srp_username = NULL; #endif return (ss); }
3,845
2,047
0
static int parse_username(char *rawuser, struct parsed_mount_info *parsed_info) { char *user, *password, slash; int rc = 0; /* everything after first % sign is a password */ password = strchr(rawuser, '%'); if (password) { rc = set_password(parsed_info, password + 1); if (rc) return rc; *password = '\0'; } /* everything after first '/' or '\' is a username */ user = strchr(rawuser, '/'); if (!user) user = strchr(rawuser, '\\'); /* everything before that slash is a domain */ if (user) { slash = *user; *user = '\0'; strlcpy(parsed_info->domain, rawuser, sizeof(parsed_info->domain)); *(user++) = slash; } else { user = rawuser; } strlcpy(parsed_info->username, user, sizeof(parsed_info->username)); parsed_info->got_user = 1; if (password) *password = '%'; return 0; }
3,846
109,994
0
void HTMLSelectElement::accessKeySetSelectedIndex(int index) { if (!focused()) accessKeyAction(false); const Vector<HTMLElement*>& items = listItems(); int listIndex = optionToListIndex(index); if (listIndex >= 0) { HTMLElement* element = items[listIndex]; if (element->hasTagName(optionTag)) { if (toHTMLOptionElement(element)->selected()) toHTMLOptionElement(element)->setSelectedState(false); else selectOption(index, DispatchChangeEvent | UserDriven); } } if (usesMenuList()) dispatchChangeEventForMenuList(); else listBoxOnChange(); scrollToSelection(); }
3,847
166,441
0
void RecordDownloadVideoType(const std::string& mime_type_string) { DownloadVideo download_video = DownloadVideo( GetMimeTypeMatch(mime_type_string, getMimeTypeToDownloadVideoMap())); UMA_HISTOGRAM_ENUMERATION("Download.ContentType.Video", download_video, DOWNLOAD_VIDEO_MAX); }
3,848
5,983
0
e1000e_intrmgr_fire_all_timers(E1000ECore *core) { int i; uint32_t val = e1000e_intmgr_collect_delayed_causes(core); trace_e1000e_irq_adding_delayed_causes(val, core->mac[ICR]); core->mac[ICR] |= val; if (core->itr.running) { timer_del(core->itr.timer); e1000e_intrmgr_on_throttling_timer(&core->itr); } for (i = 0; i < E1000E_MSIX_VEC_NUM; i++) { if (core->eitr[i].running) { timer_del(core->eitr[i].timer); e1000e_intrmgr_on_msix_throttling_timer(&core->eitr[i]); } } }
3,849
31,589
0
sctp_disposition_t sctp_sf_do_8_5_1_E_sa(struct net *net, const struct sctp_endpoint *ep, const struct sctp_association *asoc, const sctp_subtype_t type, void *arg, sctp_cmd_seq_t *commands) { struct sctp_chunk *chunk = arg; /* Make sure that the SHUTDOWN_ACK chunk has a valid length. */ if (!sctp_chunk_length_valid(chunk, sizeof(sctp_chunkhdr_t))) return sctp_sf_violation_chunklen(net, ep, asoc, type, arg, commands); /* Although we do have an association in this case, it corresponds * to a restarted association. So the packet is treated as an OOTB * packet and the state function that handles OOTB SHUTDOWN_ACK is * called with a NULL association. */ SCTP_INC_STATS(net, SCTP_MIB_OUTOFBLUES); return sctp_sf_shut_8_4_5(net, ep, NULL, type, arg, commands); }
3,850
145,579
0
void GenerateResponseDesl(base::span<const uint8_t, kNtlmHashLen> hash, base::span<const uint8_t, kChallengeLen> challenge, base::span<uint8_t, kResponseLenV1> response) { constexpr size_t block_count = 3; constexpr size_t block_size = sizeof(DES_cblock); static_assert(kChallengeLen == block_size, "kChallengeLen must equal block_size"); static_assert(kResponseLenV1 == block_count * block_size, "kResponseLenV1 must equal block_count * block_size"); const DES_cblock* challenge_block = reinterpret_cast<const DES_cblock*>(challenge.data()); uint8_t keys[block_count * block_size]; Create3DesKeysFromNtlmHash(hash, keys); for (size_t ix = 0; ix < block_count * block_size; ix += block_size) { DES_cblock* key_block = reinterpret_cast<DES_cblock*>(keys + ix); DES_cblock* response_block = reinterpret_cast<DES_cblock*>(response.data() + ix); DES_key_schedule key_schedule; DES_set_odd_parity(key_block); DES_set_key(key_block, &key_schedule); DES_ecb_encrypt(challenge_block, response_block, &key_schedule, DES_ENCRYPT); } }
3,851
162,732
0
void BaseRenderingContext2D::fillStyle( StringOrCanvasGradientOrCanvasPattern& return_value) const { ConvertCanvasStyleToUnionType(GetState().FillStyle(), return_value); }
3,852
76,549
0
my_asnprintf (char *resultbuf, size_t *lengthp, const char *format, ...) { va_list args; char *ret; va_start (args, format); ret = vasnprintf (resultbuf, lengthp, format, args); va_end (args); return ret; }
3,853
70,336
0
TIFFReadRawStrip(TIFF* tif, uint32 strip, void* buf, tmsize_t size) { static const char module[] = "TIFFReadRawStrip"; TIFFDirectory *td = &tif->tif_dir; uint64 bytecount; tmsize_t bytecountm; if (!TIFFCheckRead(tif, 0)) return ((tmsize_t)(-1)); if (strip >= td->td_nstrips) { TIFFErrorExt(tif->tif_clientdata, module, "%lu: Strip out of range, max %lu", (unsigned long) strip, (unsigned long) td->td_nstrips); return ((tmsize_t)(-1)); } if (tif->tif_flags&TIFF_NOREADRAW) { TIFFErrorExt(tif->tif_clientdata, module, "Compression scheme does not support access to raw uncompressed data"); return ((tmsize_t)(-1)); } bytecount = td->td_stripbytecount[strip]; if ((int64)bytecount <= 0) { #if defined(__WIN32__) && (defined(_MSC_VER) || defined(__MINGW32__)) TIFFErrorExt(tif->tif_clientdata, module, "%I64u: Invalid strip byte count, strip %lu", (unsigned __int64) bytecount, (unsigned long) strip); #else TIFFErrorExt(tif->tif_clientdata, module, "%llu: Invalid strip byte count, strip %lu", (unsigned long long) bytecount, (unsigned long) strip); #endif return ((tmsize_t)(-1)); } bytecountm = (tmsize_t)bytecount; if ((uint64)bytecountm!=bytecount) { TIFFErrorExt(tif->tif_clientdata, module, "Integer overflow"); return ((tmsize_t)(-1)); } if (size != (tmsize_t)(-1) && size < bytecountm) bytecountm = size; return (TIFFReadRawStrip1(tif, strip, buf, bytecountm, module)); }
3,854
18,860
0
static void icmp_redirect(struct sk_buff *skb) { const struct iphdr *iph; if (skb->len < sizeof(struct iphdr)) goto out_err; /* * Get the copied header of the packet that caused the redirect */ if (!pskb_may_pull(skb, sizeof(struct iphdr))) goto out; iph = (const struct iphdr *)skb->data; switch (icmp_hdr(skb)->code & 7) { case ICMP_REDIR_NET: case ICMP_REDIR_NETTOS: /* * As per RFC recommendations now handle it as a host redirect. */ case ICMP_REDIR_HOST: case ICMP_REDIR_HOSTTOS: ip_rt_redirect(ip_hdr(skb)->saddr, iph->daddr, icmp_hdr(skb)->un.gateway, iph->saddr, skb->dev); break; } out: return; out_err: ICMP_INC_STATS_BH(dev_net(skb->dev), ICMP_MIB_INERRORS); goto out; }
3,855
182,922
1
void comps_mrtree_unite(COMPS_MRTree *rt1, COMPS_MRTree *rt2) { COMPS_HSList *tmplist, *tmp_subnodes; COMPS_HSListItem *it, *it2; struct Pair { COMPS_HSList * subnodes; char * key; char added; } *pair, *parent_pair; pair = malloc(sizeof(struct Pair)); pair->subnodes = rt2->subnodes; pair->key = NULL; tmplist = comps_hslist_create(); comps_hslist_init(tmplist, NULL, NULL, &free); comps_hslist_append(tmplist, pair, 0); while (tmplist->first != NULL) { it = tmplist->first; comps_hslist_remove(tmplist, tmplist->first); tmp_subnodes = ((struct Pair*)it->data)->subnodes; parent_pair = (struct Pair*) it->data; free(it); pair->added = 0; for (it = tmp_subnodes->first; it != NULL; it=it->next) { pair = malloc(sizeof(struct Pair)); pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes; if (parent_pair->key != NULL) { pair->key = malloc(sizeof(char) * (strlen(((COMPS_MRTreeData*)it->data)->key) + strlen(parent_pair->key) + 1)); memcpy(pair->key, parent_pair->key, sizeof(char) * strlen(parent_pair->key)); memcpy(pair->key+strlen(parent_pair->key), ((COMPS_MRTreeData*)it->data)->key, sizeof(char)*(strlen(((COMPS_MRTreeData*)it->data)->key)+1)); } else { pair->key = malloc(sizeof(char)* (strlen(((COMPS_MRTreeData*)it->data)->key) + 1)); memcpy(pair->key, ((COMPS_MRTreeData*)it->data)->key, sizeof(char)*(strlen(((COMPS_MRTreeData*)it->data)->key)+1)); } /* current node has data */ if (((COMPS_MRTreeData*)it->data)->data->first != NULL) { for (it2 = ((COMPS_MRTreeData*)it->data)->data->first; it2 != NULL; it2 = it2->next) { comps_mrtree_set(rt1, pair->key, it2->data); } if (((COMPS_MRTreeData*)it->data)->subnodes->first) { comps_hslist_append(tmplist, pair, 0); } else { free(pair->key); free(pair); } /* current node hasn't data */ } else { if (((COMPS_MRTreeData*)it->data)->subnodes->first) { comps_hslist_append(tmplist, pair, 0); } else { free(pair->key); free(pair); } } } free(parent_pair->key); free(parent_pair); } comps_hslist_destroy(&tmplist); }
3,856
138,964
0
bool WallpaperManagerBase::TestApi::GetWallpaperFromCache( const AccountId& account_id, gfx::ImageSkia* image) { return wallpaper_manager_->GetWallpaperFromCache(account_id, image); }
3,857
86,143
0
static void ssl_write_encrypt_then_mac_ext( mbedtls_ssl_context *ssl, unsigned char *buf, size_t *olen ) { unsigned char *p = buf; const mbedtls_ssl_ciphersuite_t *suite = NULL; const mbedtls_cipher_info_t *cipher = NULL; if( ssl->session_negotiate->encrypt_then_mac == MBEDTLS_SSL_EXTENDED_MS_DISABLED || ssl->minor_ver == MBEDTLS_SSL_MINOR_VERSION_0 ) { *olen = 0; return; } /* * RFC 7366: "If a server receives an encrypt-then-MAC request extension * from a client and then selects a stream or Authenticated Encryption * with Associated Data (AEAD) ciphersuite, it MUST NOT send an * encrypt-then-MAC response extension back to the client." */ if( ( suite = mbedtls_ssl_ciphersuite_from_id( ssl->session_negotiate->ciphersuite ) ) == NULL || ( cipher = mbedtls_cipher_info_from_type( suite->cipher ) ) == NULL || cipher->mode != MBEDTLS_MODE_CBC ) { *olen = 0; return; } MBEDTLS_SSL_DEBUG_MSG( 3, ( "server hello, adding encrypt then mac extension" ) ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC >> 8 ) & 0xFF ); *p++ = (unsigned char)( ( MBEDTLS_TLS_EXT_ENCRYPT_THEN_MAC ) & 0xFF ); *p++ = 0x00; *p++ = 0x00; *olen = 4; }
3,858
41,341
0
int emulator_write_emulated(unsigned long addr, const void *val, unsigned int bytes, struct x86_exception *exception, struct kvm_vcpu *vcpu) { /* Crossing a page boundary? */ if (((addr + bytes - 1) ^ addr) & PAGE_MASK) { int rc, now; now = -addr & ~PAGE_MASK; rc = emulator_write_emulated_onepage(addr, val, now, exception, vcpu); if (rc != X86EMUL_CONTINUE) return rc; addr += now; val += now; bytes -= now; } return emulator_write_emulated_onepage(addr, val, bytes, exception, vcpu); }
3,859
64,150
0
static int _server_handle_s(libgdbr_t *g, int (*cmd_cb) (void*, const char*, char*, size_t), void *core_ptr) { char message[64]; if (send_ack (g) < 0) { return -1; } if (g->data_len > 1) { return send_msg (g, "E01"); } if (cmd_cb (core_ptr, "ds", NULL, 0) < 0) { send_msg (g, "E01"); return -1; } snprintf (message, sizeof (message) - 1, "T05thread:%x;", cmd_cb (core_ptr, "dptr", NULL, 0)); return send_msg (g, message); }
3,860
54,925
0
void count_bitmap_commit_list(uint32_t *commits, uint32_t *trees, uint32_t *blobs, uint32_t *tags) { assert(bitmap_git.result); if (commits) *commits = count_object_type(bitmap_git.result, OBJ_COMMIT); if (trees) *trees = count_object_type(bitmap_git.result, OBJ_TREE); if (blobs) *blobs = count_object_type(bitmap_git.result, OBJ_BLOB); if (tags) *tags = count_object_type(bitmap_git.result, OBJ_TAG); }
3,861
178,134
1
static SUB_STATE_RETURN read_state_machine(SSL *s) { OSSL_STATEM *st = &s->statem; int ret, mt; unsigned long len = 0; int (*transition) (SSL *s, int mt); PACKET pkt; MSG_PROCESS_RETURN(*process_message) (SSL *s, PACKET *pkt); WORK_STATE(*post_process_message) (SSL *s, WORK_STATE wst); unsigned long (*max_message_size) (SSL *s); void (*cb) (const SSL *ssl, int type, int val) = NULL; cb = get_callback(s); if (s->server) { transition = ossl_statem_server_read_transition; process_message = ossl_statem_server_process_message; max_message_size = ossl_statem_server_max_message_size; post_process_message = ossl_statem_server_post_process_message; } else { transition = ossl_statem_client_read_transition; process_message = ossl_statem_client_process_message; max_message_size = ossl_statem_client_max_message_size; post_process_message = ossl_statem_client_post_process_message; } if (st->read_state_first_init) { s->first_packet = 1; st->read_state_first_init = 0; } while (1) { switch (st->read_state) { case READ_STATE_HEADER: /* Get the state the peer wants to move to */ if (SSL_IS_DTLS(s)) { /* * In DTLS we get the whole message in one go - header and body */ ret = dtls_get_message(s, &mt, &len); } else { ret = tls_get_message_header(s, &mt); } if (ret == 0) { /* Could be non-blocking IO */ return SUB_STATE_ERROR; } if (cb != NULL) { /* Notify callback of an impending state change */ if (s->server) cb(s, SSL_CB_ACCEPT_LOOP, 1); else cb(s, SSL_CB_CONNECT_LOOP, 1); } /* * Validate that we are allowed to move to the new state and move * to that state if so */ if (!transition(s, mt)) { ossl_statem_set_error(s); return SUB_STATE_ERROR; } if (s->s3->tmp.message_size > max_message_size(s)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_ILLEGAL_PARAMETER); SSLerr(SSL_F_READ_STATE_MACHINE, SSL_R_EXCESSIVE_MESSAGE_SIZE); return SUB_STATE_ERROR; } st->read_state = READ_STATE_BODY; /* Fall through */ if (!PACKET_buf_init(&pkt, s->init_msg, len)) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); SSLerr(SSL_F_READ_STATE_MACHINE, ERR_R_INTERNAL_ERROR); return SUB_STATE_ERROR; } ret = process_message(s, &pkt); /* Discard the packet data */ s->init_num = 0; switch (ret) { case MSG_PROCESS_ERROR: return SUB_STATE_ERROR; case MSG_PROCESS_FINISHED_READING: if (SSL_IS_DTLS(s)) { dtls1_stop_timer(s); } return SUB_STATE_FINISHED; case MSG_PROCESS_CONTINUE_PROCESSING: st->read_state = READ_STATE_POST_PROCESS; st->read_state_work = WORK_MORE_A; break; default: st->read_state = READ_STATE_HEADER; break; } break; case READ_STATE_POST_PROCESS: st->read_state_work = post_process_message(s, st->read_state_work); switch (st->read_state_work) { default: return SUB_STATE_ERROR; case WORK_FINISHED_CONTINUE: st->read_state = READ_STATE_HEADER; break; case WORK_FINISHED_STOP: if (SSL_IS_DTLS(s)) { dtls1_stop_timer(s); } return SUB_STATE_FINISHED; } break; default: /* Shouldn't happen */ ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_INTERNAL_ERROR); SSLerr(SSL_F_READ_STATE_MACHINE, ERR_R_INTERNAL_ERROR); ossl_statem_set_error(s); return SUB_STATE_ERROR; } } }
3,862
31,941
0
static void perf_event_exit_task_context(struct task_struct *child, int ctxn) { struct perf_event *child_event, *tmp; struct perf_event_context *child_ctx; unsigned long flags; if (likely(!child->perf_event_ctxp[ctxn])) { perf_event_task(child, NULL, 0); return; } local_irq_save(flags); /* * We can't reschedule here because interrupts are disabled, * and either child is current or it is a task that can't be * scheduled, so we are now safe from rescheduling changing * our context. */ child_ctx = rcu_dereference_raw(child->perf_event_ctxp[ctxn]); /* * Take the context lock here so that if find_get_context is * reading child->perf_event_ctxp, we wait until it has * incremented the context's refcount before we do put_ctx below. */ raw_spin_lock(&child_ctx->lock); task_ctx_sched_out(child_ctx); child->perf_event_ctxp[ctxn] = NULL; /* * If this context is a clone; unclone it so it can't get * swapped to another process while we're removing all * the events from it. */ unclone_ctx(child_ctx); update_context_time(child_ctx); raw_spin_unlock_irqrestore(&child_ctx->lock, flags); /* * Report the task dead after unscheduling the events so that we * won't get any samples after PERF_RECORD_EXIT. We can however still * get a few PERF_RECORD_READ events. */ perf_event_task(child, child_ctx, 0); /* * We can recurse on the same lock type through: * * __perf_event_exit_task() * sync_child_event() * put_event() * mutex_lock(&ctx->mutex) * * But since its the parent context it won't be the same instance. */ mutex_lock(&child_ctx->mutex); again: list_for_each_entry_safe(child_event, tmp, &child_ctx->pinned_groups, group_entry) __perf_event_exit_task(child_event, child_ctx, child); list_for_each_entry_safe(child_event, tmp, &child_ctx->flexible_groups, group_entry) __perf_event_exit_task(child_event, child_ctx, child); /* * If the last event was a group event, it will have appended all * its siblings to the list, but we obtained 'tmp' before that which * will still point to the list head terminating the iteration. */ if (!list_empty(&child_ctx->pinned_groups) || !list_empty(&child_ctx->flexible_groups)) goto again; mutex_unlock(&child_ctx->mutex); put_ctx(child_ctx); }
3,863
74,302
0
void remove_hash_table(struct cache *cache, struct cache_entry *entry) { if(entry->hash_prev) entry->hash_prev->hash_next = entry->hash_next; else cache->hash_table[CALCULATE_HASH(entry->block)] = entry->hash_next; if(entry->hash_next) entry->hash_next->hash_prev = entry->hash_prev; entry->hash_prev = entry->hash_next = NULL; }
3,864
135,915
0
void TextTrackCueList::RemoveAll() { if (list_.IsEmpty()) return; first_invalid_index_ = 0; for (auto& cue : list_) cue->InvalidateCueIndex(); Clear(); }
3,865
178,690
1
static gboolean irssi_ssl_verify(SSL *ssl, SSL_CTX *ctx, X509 *cert) { if (SSL_get_verify_result(ssl) != X509_V_OK) { unsigned char md[EVP_MAX_MD_SIZE]; unsigned int n; char *str; g_warning("Could not verify SSL servers certificate:"); if ((str = X509_NAME_oneline(X509_get_subject_name(cert), 0, 0)) == NULL) g_warning(" Could not get subject-name from peer certificate"); else { g_warning(" Subject : %s", str); free(str); } if ((str = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0)) == NULL) g_warning(" Could not get issuer-name from peer certificate"); else { g_warning(" Issuer : %s", str); free(str); } if (! X509_digest(cert, EVP_md5(), md, &n)) g_warning(" Could not get fingerprint from peer certificate"); else { char hex[] = "0123456789ABCDEF"; char fp[EVP_MAX_MD_SIZE*3]; if (n < sizeof(fp)) { unsigned int i; for (i = 0; i < n; i++) { fp[i*3+0] = hex[(md[i] >> 4) & 0xF]; fp[i*3+1] = hex[(md[i] >> 0) & 0xF]; fp[i*3+2] = i == n - 1 ? '\0' : ':'; } g_warning(" MD5 Fingerprint : %s", fp); } } return FALSE; } return TRUE; }
3,866
117,080
0
void SessionService::RecordUpdatedSaveTime(base::TimeDelta delta, bool use_long_period) { std::string name("SessionRestore.SavePeriod"); UMA_HISTOGRAM_CUSTOM_TIMES(name, delta, save_delay_in_millis_, save_delay_in_mins_, 50); if (use_long_period) { std::string long_name_("SessionRestore.SaveLongPeriod"); UMA_HISTOGRAM_CUSTOM_TIMES(long_name_, delta, save_delay_in_mins_, save_delay_in_hrs_, 50); } }
3,867
15,375
0
EC_PRE_COMP *EC_ec_pre_comp_dup(EC_PRE_COMP *pre) { int i; if (pre != NULL) CRYPTO_atomic_add(&pre->references, 1, &i, pre->lock); return pre; }
3,868
111,821
0
void SyncBackendHost::Core::OnConnectionStatusChange( sync_api::ConnectionStatus status) { if (!sync_loop_) return; DCHECK_EQ(MessageLoop::current(), sync_loop_); host_.Call( FROM_HERE, &SyncBackendHost::HandleConnectionStatusChangeOnFrontendLoop, status); }
3,869
90,895
0
static MagickBooleanType LoadLocaleCache(SplayTreeInfo *cache,const char *xml, const char *filename,const char *locale,const size_t depth,ExceptionInfo *exception) { char keyword[MagickLocaleExtent], message[MagickLocaleExtent], tag[MagickLocaleExtent], *token; const char *q; FatalErrorHandler fatal_handler; LocaleInfo *locale_info; MagickStatusType status; register char *p; size_t extent; /* Read the locale configure file. */ (void) LogMagickEvent(ConfigureEvent,GetMagickModule(), "Loading locale configure file \"%s\" ...",filename); if (xml == (const char *) NULL) return(MagickFalse); status=MagickTrue; locale_info=(LocaleInfo *) NULL; *tag='\0'; *message='\0'; *keyword='\0'; fatal_handler=SetFatalErrorHandler(LocaleFatalErrorHandler); token=AcquireString(xml); extent=strlen(token)+MagickPathExtent; for (q=(char *) xml; *q != '\0'; ) { /* Interpret XML. */ GetNextToken(q,&q,extent,token); if (*token == '\0') break; (void) CopyMagickString(keyword,token,MagickLocaleExtent); if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0) { /* Doctype element. */ while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0')) { GetNextToken(q,&q,extent,token); while (isspace((int) ((unsigned char) *q)) != 0) q++; } continue; } if (LocaleNCompare(keyword,"<!--",4) == 0) { /* Comment element. */ while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0')) { GetNextToken(q,&q,extent,token); while (isspace((int) ((unsigned char) *q)) != 0) q++; } continue; } if (LocaleCompare(keyword,"<include") == 0) { /* Include element. */ while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0')) { (void) CopyMagickString(keyword,token,MagickLocaleExtent); GetNextToken(q,&q,extent,token); if (*token != '=') continue; GetNextToken(q,&q,extent,token); if (LocaleCompare(keyword,"locale") == 0) { if (LocaleCompare(locale,token) != 0) break; continue; } if (LocaleCompare(keyword,"file") == 0) { if (depth > MagickMaxRecursionDepth) (void) ThrowMagickException(exception,GetMagickModule(), ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token); else { char path[MagickPathExtent], *file_xml; *path='\0'; GetPathComponent(filename,HeadPath,path); if (*path != '\0') (void) ConcatenateMagickString(path,DirectorySeparator, MagickPathExtent); if (*token == *DirectorySeparator) (void) CopyMagickString(path,token,MagickPathExtent); else (void) ConcatenateMagickString(path,token,MagickPathExtent); file_xml=FileToXML(path,~0UL); if (file_xml != (char *) NULL) { status&=LoadLocaleCache(cache,file_xml,path,locale, depth+1,exception); file_xml=DestroyString(file_xml); } } } } continue; } if (LocaleCompare(keyword,"<locale") == 0) { /* Locale element. */ while ((*token != '>') && (*q != '\0')) { (void) CopyMagickString(keyword,token,MagickLocaleExtent); GetNextToken(q,&q,extent,token); if (*token != '=') continue; GetNextToken(q,&q,extent,token); } continue; } if (LocaleCompare(keyword,"</locale>") == 0) { ChopLocaleComponents(tag,1); (void) ConcatenateMagickString(tag,"/",MagickLocaleExtent); continue; } if (LocaleCompare(keyword,"<localemap>") == 0) continue; if (LocaleCompare(keyword,"</localemap>") == 0) continue; if (LocaleCompare(keyword,"<message") == 0) { /* Message element. */ while ((*token != '>') && (*q != '\0')) { (void) CopyMagickString(keyword,token,MagickLocaleExtent); GetNextToken(q,&q,extent,token); if (*token != '=') continue; GetNextToken(q,&q,extent,token); if (LocaleCompare(keyword,"name") == 0) { (void) ConcatenateMagickString(tag,token,MagickLocaleExtent); (void) ConcatenateMagickString(tag,"/",MagickLocaleExtent); } } for (p=(char *) q; (*q != '<') && (*q != '\0'); q++) ; while (isspace((int) ((unsigned char) *p)) != 0) p++; q--; while ((isspace((int) ((unsigned char) *q)) != 0) && (q > p)) q--; (void) CopyMagickString(message,p,MagickMin((size_t) (q-p+2), MagickLocaleExtent)); locale_info=(LocaleInfo *) AcquireCriticalMemory(sizeof(*locale_info)); (void) memset(locale_info,0,sizeof(*locale_info)); locale_info->path=ConstantString(filename); locale_info->tag=ConstantString(tag); locale_info->message=ConstantString(message); locale_info->signature=MagickCoreSignature; status=AddValueToSplayTree(cache,locale_info->tag,locale_info); if (status == MagickFalse) (void) ThrowMagickException(exception,GetMagickModule(), ResourceLimitError,"MemoryAllocationFailed","`%s'", locale_info->tag); (void) ConcatenateMagickString(tag,message,MagickLocaleExtent); (void) ConcatenateMagickString(tag,"\n",MagickLocaleExtent); q++; continue; } if (LocaleCompare(keyword,"</message>") == 0) { ChopLocaleComponents(tag,2); (void) ConcatenateMagickString(tag,"/",MagickLocaleExtent); continue; } if (*keyword == '<') { /* Subpath element. */ if (*(keyword+1) == '?') continue; if (*(keyword+1) == '/') { ChopLocaleComponents(tag,1); if (*tag != '\0') (void) ConcatenateMagickString(tag,"/",MagickLocaleExtent); continue; } token[strlen(token)-1]='\0'; (void) CopyMagickString(token,token+1,MagickLocaleExtent); (void) ConcatenateMagickString(tag,token,MagickLocaleExtent); (void) ConcatenateMagickString(tag,"/",MagickLocaleExtent); continue; } GetNextToken(q,(const char **) NULL,extent,token); if (*token != '=') continue; } token=(char *) RelinquishMagickMemory(token); (void) SetFatalErrorHandler(fatal_handler); return(status != 0 ? MagickTrue : MagickFalse); }
3,870
130,636
0
static void anyAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); v8SetReturnValue(info, imp->anyAttribute().v8Value()); }
3,871
129,565
0
void CorePageLoadMetricsObserver::OnLoadEventStart( const page_load_metrics::PageLoadTiming& timing, const page_load_metrics::PageLoadExtraInfo& info) { if (WasStartedInForegroundOptionalEventInForeground(timing.load_event_start, info)) { PAGE_LOAD_HISTOGRAM(internal::kHistogramLoadImmediate, timing.load_event_start.value()); } else { PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramLoadImmediate, timing.load_event_start.value()); } }
3,872
46,414
0
static void release_new_page_budget(struct ubifs_info *c) { struct ubifs_budget_req req = { .recalculate = 1, .new_page = 1 }; ubifs_release_budget(c, &req); }
3,873
32,085
0
static void __net_exit default_device_exit(struct net *net) { struct net_device *dev, *aux; /* * Push all migratable network devices back to the * initial network namespace */ rtnl_lock(); for_each_netdev_safe(net, dev, aux) { int err; char fb_name[IFNAMSIZ]; /* Ignore unmoveable devices (i.e. loopback) */ if (dev->features & NETIF_F_NETNS_LOCAL) continue; /* Leave virtual devices for the generic cleanup */ if (dev->rtnl_link_ops) continue; /* Push remaing network devices to init_net */ snprintf(fb_name, IFNAMSIZ, "dev%d", dev->ifindex); err = dev_change_net_namespace(dev, &init_net, fb_name); if (err) { printk(KERN_EMERG "%s: failed to move %s to init_net: %d\n", __func__, dev->name, err); BUG(); } } rtnl_unlock(); }
3,874
157,275
0
void WebMediaPlayerImpl::OnPipelineSuspended() { #if defined(OS_ANDROID) if (IsRemote() && !IsNewRemotePlaybackPipelineEnabled()) { scoped_refptr<VideoFrame> frame = cast_impl_.GetCastingBanner(); if (frame) compositor_->PaintSingleFrame(frame); } #endif if (data_source_) data_source_->OnBufferingHaveEnough(true); ReportMemoryUsage(); if (pending_suspend_resume_cycle_) { pending_suspend_resume_cycle_ = false; UpdatePlayState(); } }
3,875
5,874
0
static void ahci_port_write(AHCIState *s, int port, int offset, uint32_t val) { AHCIPortRegs *pr = &s->dev[port].port_regs; DPRINTF(port, "offset: 0x%x val: 0x%x\n", offset, val); switch (offset) { case PORT_LST_ADDR: pr->lst_addr = val; break; case PORT_LST_ADDR_HI: pr->lst_addr_hi = val; break; case PORT_FIS_ADDR: pr->fis_addr = val; break; case PORT_FIS_ADDR_HI: pr->fis_addr_hi = val; break; case PORT_IRQ_STAT: pr->irq_stat &= ~val; ahci_check_irq(s); break; case PORT_IRQ_MASK: pr->irq_mask = val & 0xfdc000ff; ahci_check_irq(s); break; case PORT_CMD: /* Block any Read-only fields from being set; * including LIST_ON and FIS_ON. * The spec requires to set ICC bits to zero after the ICC change * is done. We don't support ICC state changes, therefore always * force the ICC bits to zero. */ pr->cmd = (pr->cmd & PORT_CMD_RO_MASK) | (val & ~(PORT_CMD_RO_MASK|PORT_CMD_ICC_MASK)); /* Check FIS RX and CLB engines */ ahci_cond_start_engines(&s->dev[port]); /* XXX usually the FIS would be pending on the bus here and issuing deferred until the OS enables FIS receival. Instead, we only submit it once - which works in most cases, but is a hack. */ if ((pr->cmd & PORT_CMD_FIS_ON) && !s->dev[port].init_d2h_sent) { ahci_init_d2h(&s->dev[port]); } check_cmd(s, port); break; case PORT_TFDATA: /* Read Only. */ break; case PORT_SIG: /* Read Only */ break; case PORT_SCR_STAT: /* Read Only */ break; case PORT_SCR_CTL: if (((pr->scr_ctl & AHCI_SCR_SCTL_DET) == 1) && ((val & AHCI_SCR_SCTL_DET) == 0)) { ahci_reset_port(s, port); } pr->scr_ctl = val; break; case PORT_SCR_ERR: pr->scr_err &= ~val; break; case PORT_SCR_ACT: /* RW1 */ pr->scr_act |= val; break; case PORT_CMD_ISSUE: pr->cmd_issue |= val; check_cmd(s, port); break; default: break; } }
3,876
161,800
0
PlatformSensorProviderLinux* PlatformSensorProviderLinux::GetInstance() { return base::Singleton< PlatformSensorProviderLinux, base::LeakySingletonTraits<PlatformSensorProviderLinux>>::get(); }
3,877
40,722
0
static int setsockopt(struct socket *sock, int lvl, int opt, char __user *ov, unsigned int ol) { struct sock *sk = sock->sk; struct tipc_port *tport = tipc_sk_port(sk); u32 value; int res; if ((lvl == IPPROTO_TCP) && (sock->type == SOCK_STREAM)) return 0; if (lvl != SOL_TIPC) return -ENOPROTOOPT; if (ol < sizeof(value)) return -EINVAL; res = get_user(value, (u32 __user *)ov); if (res) return res; lock_sock(sk); switch (opt) { case TIPC_IMPORTANCE: res = tipc_set_portimportance(tport->ref, value); break; case TIPC_SRC_DROPPABLE: if (sock->type != SOCK_STREAM) res = tipc_set_portunreliable(tport->ref, value); else res = -ENOPROTOOPT; break; case TIPC_DEST_DROPPABLE: res = tipc_set_portunreturnable(tport->ref, value); break; case TIPC_CONN_TIMEOUT: tipc_sk(sk)->conn_timeout = value; /* no need to set "res", since already 0 at this point */ break; default: res = -EINVAL; } release_sock(sk); return res; }
3,878
88,974
0
static char *EscapeParenthesis(const char *source) { char *destination; register char *q; register const char *p; size_t length; assert(source != (const char *) NULL); length=0; for (p=source; *p != '\0'; p++) { if ((*p == '\\') || (*p == '(') || (*p == ')')) { if (~length < 1) ThrowFatalException(ResourceLimitFatalError,"UnableToEscapeString"); length++; } length++; } destination=(char *) NULL; if (~length >= (MagickPathExtent-1)) destination=(char *) AcquireQuantumMemory(length+MagickPathExtent, sizeof(*destination)); if (destination == (char *) NULL) ThrowFatalException(ResourceLimitFatalError,"UnableToEscapeString"); *destination='\0'; q=destination; for (p=source; *p != '\0'; p++) { if ((*p == '\\') || (*p == '(') || (*p == ')')) *q++='\\'; *q++=(*p); } *q='\0'; return(destination); }
3,879
96,766
0
rijndael_setkey (void *context, const byte *key, const unsigned keylen, gcry_cipher_hd_t hd) { RIJNDAEL_context *ctx = context; return do_setkey (ctx, key, keylen, hd); }
3,880
77,373
0
ofproto_rule_unref(struct rule *rule) { if (rule && ovs_refcount_unref_relaxed(&rule->ref_count) == 1) { ovs_assert(rule->state != RULE_INSERTED); ovsrcu_postpone(rule_destroy_cb, rule); } }
3,881
180,939
1
atol10(const char *p, size_t char_cnt) { uint64_t l; int digit; l = 0; digit = *p - '0'; while (digit >= 0 && digit < 10 && char_cnt-- > 0) { l = (l * 10) + digit; digit = *++p - '0'; } return (l); }
3,882
161,117
0
bool MediaStreamManager::DoesMediaDeviceIDMatchHMAC( const std::string& salt, const url::Origin& security_origin, const std::string& device_guid, const std::string& raw_unique_id) { DCHECK(!raw_unique_id.empty()); std::string guid_from_raw_device_id = GetHMACForMediaDeviceID(salt, security_origin, raw_unique_id); return guid_from_raw_device_id == device_guid; }
3,883
35,090
0
static ssize_t defrag_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) { return double_flag_store(kobj, attr, buf, count, TRANSPARENT_HUGEPAGE_DEFRAG_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG); }
3,884
164,052
0
void DownloadManagerImpl::OnHistoryNextIdRetrived(uint32_t next_id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); is_history_download_id_retrieved_ = true; if (next_id == download::DownloadItem::kInvalidId) next_id++; else should_persist_new_download_ = true; SetNextId(next_id); }
3,885
51,129
0
void __audit_mmap_fd(int fd, int flags) { struct audit_context *context = current->audit_context; context->mmap.fd = fd; context->mmap.flags = flags; context->type = AUDIT_MMAP; }
3,886
101,088
0
void DidDumpOriginInfoTable(const OriginInfoTableEntries& entries) { origin_info_entries_ = entries; }
3,887
15,433
0
bits_image_fetch_untransformed_32 (pixman_iter_t * iter, const uint32_t *mask) { pixman_image_t *image = iter->image; int x = iter->x; int y = iter->y; int width = iter->width; uint32_t * buffer = iter->buffer; if (image->common.repeat == PIXMAN_REPEAT_NONE) { bits_image_fetch_untransformed_repeat_none ( &image->bits, FALSE, x, y, width, buffer); } else { bits_image_fetch_untransformed_repeat_normal ( &image->bits, FALSE, x, y, width, buffer); } iter->y++; return buffer; }
3,888
29,516
0
static inline struct msg_queue *msg_lock_check(struct ipc_namespace *ns, int id) { struct kern_ipc_perm *ipcp = ipc_lock_check(&msg_ids(ns), id); if (IS_ERR(ipcp)) return (struct msg_queue *)ipcp; return container_of(ipcp, struct msg_queue, q_perm); }
3,889
157,398
0
void HTMLMediaElement::SetSrc(const AtomicString& url) { setAttribute(srcAttr, url); }
3,890
88,641
0
static void dwc3_clear_stall_all_ep(struct dwc3 *dwc) { u32 epnum; for (epnum = 1; epnum < DWC3_ENDPOINTS_NUM; epnum++) { struct dwc3_ep *dep; int ret; dep = dwc->eps[epnum]; if (!dep) continue; if (!(dep->flags & DWC3_EP_STALL)) continue; dep->flags &= ~DWC3_EP_STALL; ret = dwc3_send_clear_stall_ep_cmd(dep); WARN_ON_ONCE(ret); } }
3,891
38,257
0
int sk_unattached_filter_create(struct sk_filter **pfp, struct sock_fprog *fprog) { unsigned int fsize = sk_filter_proglen(fprog); struct sk_filter *fp; /* Make sure new filter is there and in the right amounts. */ if (fprog->filter == NULL) return -EINVAL; fp = kmalloc(sk_filter_size(fprog->len), GFP_KERNEL); if (!fp) return -ENOMEM; memcpy(fp->insns, fprog->filter, fsize); atomic_set(&fp->refcnt, 1); fp->len = fprog->len; /* Since unattached filters are not copied back to user * space through sk_get_filter(), we do not need to hold * a copy here, and can spare us the work. */ fp->orig_prog = NULL; /* __sk_prepare_filter() already takes care of uncharging * memory in case something goes wrong. */ fp = __sk_prepare_filter(fp, NULL); if (IS_ERR(fp)) return PTR_ERR(fp); *pfp = fp; return 0; }
3,892
25,031
0
void add_input_randomness(unsigned int type, unsigned int code, unsigned int value) { static unsigned char last_value; /* ignore autorepeat and the like */ if (value == last_value) return; DEBUG_ENT("input event\n"); last_value = value; add_timer_randomness(&input_timer_state, (type << 4) ^ code ^ (code >> 4) ^ value); }
3,893
148,369
0
RenderFrameHostImpl* WebContentsImpl::FindFrameByFrameTreeNodeId( int frame_tree_node_id, int process_id) { FrameTreeNode* frame = frame_tree_.FindByID(frame_tree_node_id); if (!frame || frame->current_frame_host()->GetProcess()->GetID() != process_id) return nullptr; return frame->current_frame_host(); }
3,894
46,351
0
static int ramfs_nommu_resize(struct inode *inode, loff_t newsize, loff_t size) { int ret; /* assume a truncate from zero size is going to be for the purposes of * shared mmap */ if (size == 0) { if (unlikely(newsize >> 32)) return -EFBIG; return ramfs_nommu_expand_for_mapping(inode, newsize); } /* check that a decrease in size doesn't cut off any shared mappings */ if (newsize < size) { ret = nommu_shrink_inode_mappings(inode, size, newsize); if (ret < 0) return ret; } truncate_setsize(inode, newsize); return 0; }
3,895
119,054
0
void WebContentsImpl::ToggleFullscreenMode(bool enter_fullscreen) { RenderWidgetHostView* const widget_view = GetFullscreenRenderWidgetHostView(); if (widget_view) RenderWidgetHostImpl::From(widget_view->GetRenderWidgetHost())->Shutdown(); if (delegate_) delegate_->ToggleFullscreenModeForTab(this, enter_fullscreen); }
3,896
251
0
bgp_attr_extra_new (void) { return XCALLOC (MTYPE_ATTR_EXTRA, sizeof (struct attr_extra)); }
3,897
8,347
0
static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx) { uint64_t mfindex; DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid); xfer->in_xfer = epctx->type>>2; switch(epctx->type) { case ET_INTR_OUT: case ET_INTR_IN: xfer->pkts = 0; xfer->iso_xfer = false; xfer->timed_xfer = true; mfindex = xhci_mfindex_get(xhci); xhci_calc_intr_kick(xhci, xfer, epctx, mfindex); xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { return -1; } break; case ET_BULK_OUT: case ET_BULK_IN: xfer->pkts = 0; xfer->iso_xfer = false; xfer->timed_xfer = false; break; case ET_ISO_OUT: case ET_ISO_IN: xfer->pkts = 1; xfer->iso_xfer = true; xfer->timed_xfer = true; mfindex = xhci_mfindex_get(xhci); xhci_calc_iso_kick(xhci, xfer, epctx, mfindex); xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex); if (xfer->running_retry) { return -1; } break; default: trace_usb_xhci_unimplemented("endpoint type", epctx->type); return -1; } if (xhci_setup_packet(xfer) < 0) { return -1; } usb_handle_packet(xfer->packet.ep->dev, &xfer->packet); xhci_complete_packet(xfer); if (!xfer->running_async && !xfer->running_retry) { xhci_kick_ep(xhci, xfer->slotid, xfer->epid, xfer->streamid); } return 0; }
3,898
127,847
0
std::string GetOrientationType() { std::string type; ExecuteScriptAndGetValue(shell()->web_contents()->GetMainFrame(), "screen.orientation.type")->GetAsString(&type); return type; }
3,899