unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
176,098
0
virtual void unsetHeap(int32_t seqNum) { Parcel data, reply; data.writeInterfaceToken(ICrypto::getInterfaceDescriptor()); data.writeInt32(seqNum); remote()->transact(UNSET_HEAP, data, &reply); return; }
12,000
185,775
1
bool IsSiteMuted(const TabStripModel& tab_strip, const int index) { content::WebContents* web_contents = tab_strip.GetWebContentsAt(index); GURL url = web_contents->GetLastCommittedURL(); if (url.SchemeIs(content::kChromeUIScheme)) { return web_contents->IsAudioMuted() && GetTabAudioMutedReason(web_contents) == TabMutedReason::CONTENT_SETTING_CHROME; } Profile* profile = Profile::FromBrowserContext(web_contents->GetBrowserContext()); HostContentSettingsMap* settings = HostContentSettingsMapFactory::GetForProfile(profile); return settings->GetContentSetting(url, url, CONTENT_SETTINGS_TYPE_SOUND, std::string()) == CONTENT_SETTING_BLOCK; }
12,001
104,647
0
bool Extension::ParsePEMKeyBytes(const std::string& input, std::string* output) { DCHECK(output); if (!output) return false; if (input.length() == 0) return false; std::string working = input; if (StartsWithASCII(working, kKeyBeginHeaderMarker, true)) { working = CollapseWhitespaceASCII(working, true); size_t header_pos = working.find(kKeyInfoEndMarker, sizeof(kKeyBeginHeaderMarker) - 1); if (header_pos == std::string::npos) return false; size_t start_pos = header_pos + sizeof(kKeyInfoEndMarker) - 1; size_t end_pos = working.rfind(kKeyBeginFooterMarker); if (end_pos == std::string::npos) return false; if (start_pos >= end_pos) return false; working = working.substr(start_pos, end_pos - start_pos); if (working.length() == 0) return false; } return base::Base64Decode(working, output); }
12,002
5,922
0
static int ohci_port_set_if_connected(OHCIState *ohci, int i, uint32_t val) { int ret = 1; /* writing a 0 has no effect */ if (val == 0) return 0; /* If CurrentConnectStatus is cleared we set * ConnectStatusChange */ if (!(ohci->rhport[i].ctrl & OHCI_PORT_CCS)) { ohci->rhport[i].ctrl |= OHCI_PORT_CSC; if (ohci->rhstatus & OHCI_RHS_DRWE) { /* TODO: CSC is a wakeup event */ } return 0; } if (ohci->rhport[i].ctrl & val) ret = 0; /* set the bit */ ohci->rhport[i].ctrl |= val; return ret; }
12,003
79,029
0
ExprCreateInteger(int ival) { EXPR_CREATE(ExprInteger, expr, EXPR_VALUE, EXPR_TYPE_INT); expr->integer.ival = ival; return expr; }
12,004
36,532
0
static loff_t snd_disconnect_llseek(struct file *file, loff_t offset, int orig) { return -ENODEV; }
12,005
153,859
0
GLES2Implementation::~GLES2Implementation() { WaitForCmd(); query_tracker_.reset(); if (support_client_side_arrays_ && reserved_ids_[0]) { DeleteBuffers(base::size(reserved_ids_), &reserved_ids_[0]); } ClearMappedBufferRangeMap(); share_group_->FreeContext(this); buffer_tracker_.reset(); readback_buffer_shadow_tracker_.reset(); WaitForCmd(); }
12,006
162,130
0
void RenderProcessHostImpl::RegisterAecDumpConsumerOnUIThread(int id) { DCHECK_CURRENTLY_ON(BrowserThread::UI); aec_dump_consumers_.push_back(id); WebRTCInternals* webrtc_internals = WebRTCInternals::GetInstance(); if (webrtc_internals->IsAudioDebugRecordingsEnabled()) { base::FilePath file_with_extensions = GetAecDumpFilePathWithExtensions( webrtc_internals->GetAudioDebugRecordingsFilePath()); EnableAecDumpForId(file_with_extensions, id); } }
12,007
77,361
0
ofproto_port_set_bfd(struct ofproto *ofproto, ofp_port_t ofp_port, const struct smap *cfg) { struct ofport *ofport; int error; ofport = ofproto_get_port(ofproto, ofp_port); if (!ofport) { VLOG_WARN("%s: cannot configure bfd on nonexistent port %"PRIu32, ofproto->name, ofp_port); return; } error = (ofproto->ofproto_class->set_bfd ? ofproto->ofproto_class->set_bfd(ofport, cfg) : EOPNOTSUPP); if (error) { VLOG_WARN("%s: bfd configuration on port %"PRIu32" (%s) failed (%s)", ofproto->name, ofp_port, netdev_get_name(ofport->netdev), ovs_strerror(error)); } }
12,008
102,075
0
bool SyncBackendHost::IsCryptographerReady( const sync_api::BaseTransaction* trans) const { return initialized() && trans->GetCryptographer()->is_ready(); }
12,009
131,153
0
static void TestObjectPythonReplaceableAttributeSetterCallback(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TestObjectPythonV8Internal::TestObjectPythonReplaceableAttributeSetter(name, jsValue, info); }
12,010
120,689
0
void Element::webkitRequestFullScreen(unsigned short flags) { FullscreenController::from(document())->requestFullScreenForElement(this, (flags | LEGACY_MOZILLA_REQUEST), FullscreenController::EnforceIFrameAllowFullScreenRequirement); }
12,011
61,391
0
static inline int mov_get_stsc_samples(MOVStreamContext *sc, int index) { int chunk_count; if (mov_stsc_index_valid(index, sc->stsc_count)) chunk_count = sc->stsc_data[index + 1].first - sc->stsc_data[index].first; else chunk_count = sc->chunk_count - (sc->stsc_data[index].first - 1); return sc->stsc_data[index].count * chunk_count; }
12,012
45,814
0
static inline void setbit128_bbe(void *b, int bit) { __set_bit(bit ^ (0x80 - #ifdef __BIG_ENDIAN BITS_PER_LONG #else BITS_PER_BYTE #endif ), b); }
12,013
83,806
0
static inline void hwsim_net_set_netgroup(struct net *net) { struct hwsim_net *hwsim_net = net_generic(net, hwsim_net_id); hwsim_net->netgroup = hwsim_netgroup++; }
12,014
149,411
0
bool ContentSecurityPolicy::allowJavaScriptURLs( Element* element, const String& source, const String& contextURL, const WTF::OrdinalNumber& contextLine, SecurityViolationReportingPolicy reportingPolicy) const { return isAllowedByAll<&CSPDirectiveList::allowJavaScriptURLs>( m_policies, element, source, contextURL, contextLine, reportingPolicy); }
12,015
7,674
0
static ssize_t handle_llistxattr(FsContext *ctx, V9fsPath *fs_path, void *value, size_t size) { int fd, ret; struct handle_data *data = (struct handle_data *)ctx->private; fd = open_by_handle(data->mountfd, fs_path->data, O_NONBLOCK); if (fd < 0) { return fd; } ret = flistxattr(fd, value, size); close(fd); return ret; }
12,016
9,853
0
smp_fetch_http_auth(struct proxy *px, struct session *l4, void *l7, unsigned int opt, const struct arg *args, struct sample *smp, const char *kw) { if (!args || args->type != ARGT_USR) return 0; CHECK_HTTP_MESSAGE_FIRST(); if (!get_http_auth(l4)) return 0; smp->type = SMP_T_BOOL; smp->data.uint = check_user(args->data.usr, l4->txn.auth.user, l4->txn.auth.pass); return 1; }
12,017
115,303
0
OmniboxViewWin::ScopedFreeze::~ScopedFreeze() { if (edit_->IsWindow() && text_object_model_) { long count; text_object_model_->Unfreeze(&count); if (count == 0) { edit_->InvalidateRect(NULL, false); edit_->UpdateWindow(); } } }
12,018
77,094
0
parse_set_vlan_vid(char *arg, struct ofpbuf *ofpacts, bool push_vlan_if_needed) { struct ofpact_vlan_vid *vlan_vid; uint16_t vid; char *error; error = str_to_u16(arg, "VLAN VID", &vid); if (error) { return error; } if (vid & ~VLAN_VID_MASK) { return xasprintf("%s: not a valid VLAN VID", arg); } vlan_vid = ofpact_put_SET_VLAN_VID(ofpacts); vlan_vid->vlan_vid = vid; vlan_vid->push_vlan_if_needed = push_vlan_if_needed; return NULL; }
12,019
56,243
0
static void __dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle, struct dma_attrs *attrs) { bool freed; phys_addr_t paddr = dma_to_phys(dev, dma_handle); if (dev == NULL) { WARN_ONCE(1, "Use an actual device structure for DMA allocation\n"); return; } freed = dma_release_from_contiguous(dev, phys_to_page(paddr), size >> PAGE_SHIFT); if (!freed) swiotlb_free_coherent(dev, size, vaddr, dma_handle); }
12,020
151,898
0
bool RenderFrameHostImpl::CheckOrDispatchBeforeUnloadForSubtree( bool subframes_only, bool send_ipc, bool is_reload) { bool found_beforeunload = false; for (FrameTreeNode* node : frame_tree_node_->frame_tree()->SubtreeNodes(frame_tree_node_)) { RenderFrameHostImpl* rfh = node->current_frame_host(); if (subframes_only && rfh->GetSiteInstance() == GetSiteInstance()) continue; if (!rfh->IsRenderFrameLive()) continue; bool should_run_beforeunload = rfh->GetSuddenTerminationDisablerState(blink::kBeforeUnloadHandler); if (rfh == this) should_run_beforeunload = true; if (!should_run_beforeunload) continue; found_beforeunload = true; if (!send_ipc) return true; while (!rfh->is_local_root() && rfh != this) rfh = rfh->GetParent(); if (base::ContainsKey(beforeunload_pending_replies_, rfh)) continue; bool has_same_site_ancestor = false; for (auto* added_rfh : beforeunload_pending_replies_) { if (rfh->IsDescendantOf(added_rfh) && rfh->GetSiteInstance() == added_rfh->GetSiteInstance()) { has_same_site_ancestor = true; break; } } if (has_same_site_ancestor) continue; beforeunload_pending_replies_.insert(rfh); rfh->Send(new FrameMsg_BeforeUnload(rfh->GetRoutingID(), is_reload)); } return found_beforeunload; }
12,021
138,873
0
void WallpaperManager::EnsureLoggedInUserWallpaperLoaded() { WallpaperInfo info; if (GetLoggedInUserWallpaperInfo(&info)) { UMA_HISTOGRAM_ENUMERATION("Ash.Wallpaper.Type", info.type, wallpaper::WALLPAPER_TYPE_COUNT); RecordWallpaperAppType(); if (info == current_user_wallpaper_info_) return; } SetUserWallpaperNow( user_manager::UserManager::Get()->GetActiveUser()->GetAccountId()); }
12,022
119,226
0
void ApplyBlockElementCommand::rangeForParagraphSplittingTextNodesIfNeeded(const VisiblePosition& endOfCurrentParagraph, Position& start, Position& end) { start = startOfParagraph(endOfCurrentParagraph).deepEquivalent(); end = endOfCurrentParagraph.deepEquivalent(); document().updateStyleIfNeeded(); bool isStartAndEndOnSameNode = false; if (RenderStyle* startStyle = renderStyleOfEnclosingTextNode(start)) { isStartAndEndOnSameNode = renderStyleOfEnclosingTextNode(end) && start.containerNode() == end.containerNode(); bool isStartAndEndOfLastParagraphOnSameNode = renderStyleOfEnclosingTextNode(m_endOfLastParagraph) && start.containerNode() == m_endOfLastParagraph.containerNode(); if (startStyle->preserveNewline() && isNewLineAtPosition(start) && !isNewLineAtPosition(start.previous()) && start.offsetInContainerNode() > 0) start = startOfParagraph(end.previous()).deepEquivalent(); if (!startStyle->collapseWhiteSpace() && start.offsetInContainerNode() > 0) { int startOffset = start.offsetInContainerNode(); Text* startText = start.containerText(); splitTextNode(startText, startOffset); start = firstPositionInNode(startText); if (isStartAndEndOnSameNode) { ASSERT(end.offsetInContainerNode() >= startOffset); end = Position(startText, end.offsetInContainerNode() - startOffset); } if (isStartAndEndOfLastParagraphOnSameNode) { ASSERT(m_endOfLastParagraph.offsetInContainerNode() >= startOffset); m_endOfLastParagraph = Position(startText, m_endOfLastParagraph.offsetInContainerNode() - startOffset); } } } document().updateStyleIfNeeded(); if (RenderStyle* endStyle = renderStyleOfEnclosingTextNode(end)) { bool isEndAndEndOfLastParagraphOnSameNode = renderStyleOfEnclosingTextNode(m_endOfLastParagraph) && end.deprecatedNode() == m_endOfLastParagraph.deprecatedNode(); if (endStyle->preserveNewline() && start == end && end.offsetInContainerNode() < end.containerNode()->maxCharacterOffset()) { int endOffset = end.offsetInContainerNode(); if (!isNewLineAtPosition(end.previous()) && isNewLineAtPosition(end)) end = Position(end.containerText(), endOffset + 1); if (isEndAndEndOfLastParagraphOnSameNode && end.offsetInContainerNode() >= m_endOfLastParagraph.offsetInContainerNode()) m_endOfLastParagraph = end; } if (!endStyle->collapseWhiteSpace() && end.offsetInContainerNode() && end.offsetInContainerNode() < end.containerNode()->maxCharacterOffset()) { RefPtr<Text> endContainer = end.containerText(); splitTextNode(endContainer, end.offsetInContainerNode()); if (isStartAndEndOnSameNode) start = firstPositionInOrBeforeNode(endContainer->previousSibling()); if (isEndAndEndOfLastParagraphOnSameNode) { if (m_endOfLastParagraph.offsetInContainerNode() == end.offsetInContainerNode()) m_endOfLastParagraph = lastPositionInOrAfterNode(endContainer->previousSibling()); else m_endOfLastParagraph = Position(endContainer, m_endOfLastParagraph.offsetInContainerNode() - end.offsetInContainerNode()); } end = lastPositionInNode(endContainer->previousSibling()); } } }
12,023
183,796
1
void RTCPeerConnection::setRemoteDescription(PassRefPtr<RTCSessionDescription> prpSessionDescription, PassRefPtr<VoidCallback> successCallback, PassRefPtr<RTCErrorCallback> errorCallback, ExceptionCode& ec) { if (m_readyState == ReadyStateClosing || m_readyState == ReadyStateClosed) { ec = INVALID_STATE_ERR; return; } RefPtr<RTCSessionDescription> sessionDescription = prpSessionDescription; if (!sessionDescription) { ec = TYPE_MISMATCH_ERR; return; } RefPtr<RTCVoidRequestImpl> request = RTCVoidRequestImpl::create(scriptExecutionContext(), successCallback, errorCallback); m_peerHandler->setRemoteDescription(request.release(), sessionDescription->descriptor()); }
12,024
94,485
0
static void rfcomm_dev_state_change(struct rfcomm_dlc *dlc, int err) { struct rfcomm_dev *dev = dlc->owner; if (!dev) return; BT_DBG("dlc %p dev %p err %d", dlc, dev, err); dev->err = err; wake_up_interruptible(&dev->wait); if (dlc->state == BT_CLOSED) { if (!dev->port.tty) { if (test_bit(RFCOMM_RELEASE_ONHUP, &dev->flags)) { /* Drop DLC lock here to avoid deadlock * 1. rfcomm_dev_get will take rfcomm_dev_lock * but in rfcomm_dev_add there's lock order: * rfcomm_dev_lock -> dlc lock * 2. tty_port_put will deadlock if it's * the last reference */ rfcomm_dlc_unlock(dlc); if (rfcomm_dev_get(dev->id) == NULL) { rfcomm_dlc_lock(dlc); return; } rfcomm_dev_del(dev); tty_port_put(&dev->port); rfcomm_dlc_lock(dlc); } } else tty_hangup(dev->port.tty); } }
12,025
87
0
int ssl3_get_req_cert_type(SSL *s, unsigned char *p) { int ret=0; unsigned long alg_k; alg_k = s->s3->tmp.new_cipher->algorithm_mkey; #ifndef OPENSSL_NO_GOST if (s->version >= TLS1_VERSION) { if (alg_k & SSL_kGOST) { p[ret++]=TLS_CT_GOST94_SIGN; p[ret++]=TLS_CT_GOST01_SIGN; return(ret); } } #endif #ifndef OPENSSL_NO_DH if (alg_k & (SSL_kDHr|SSL_kEDH)) { # ifndef OPENSSL_NO_RSA p[ret++]=SSL3_CT_RSA_FIXED_DH; # endif # ifndef OPENSSL_NO_DSA p[ret++]=SSL3_CT_DSS_FIXED_DH; # endif } if ((s->version == SSL3_VERSION) && (alg_k & (SSL_kEDH|SSL_kDHd|SSL_kDHr))) { # ifndef OPENSSL_NO_RSA p[ret++]=SSL3_CT_RSA_EPHEMERAL_DH; # endif # ifndef OPENSSL_NO_DSA p[ret++]=SSL3_CT_DSS_EPHEMERAL_DH; # endif } #endif /* !OPENSSL_NO_DH */ #ifndef OPENSSL_NO_RSA p[ret++]=SSL3_CT_RSA_SIGN; #endif #ifndef OPENSSL_NO_DSA p[ret++]=SSL3_CT_DSS_SIGN; #endif #ifndef OPENSSL_NO_ECDH if ((alg_k & (SSL_kECDHr|SSL_kECDHe)) && (s->version >= TLS1_VERSION)) { p[ret++]=TLS_CT_RSA_FIXED_ECDH; p[ret++]=TLS_CT_ECDSA_FIXED_ECDH; } #endif #ifndef OPENSSL_NO_ECDSA /* ECDSA certs can be used with RSA cipher suites as well * so we don't need to check for SSL_kECDH or SSL_kEECDH */ if (s->version >= TLS1_VERSION) { p[ret++]=TLS_CT_ECDSA_SIGN; } #endif return(ret); }
12,026
153,694
0
bool GLES2Implementation::GetInternalformativHelper(GLenum target, GLenum format, GLenum pname, GLsizei bufSize, GLint* params) { return false; }
12,027
99,639
0
void VaapiVideoDecodeAccelerator::InitiateSurfaceSetChange(size_t num_pics, gfx::Size size) { DCHECK_EQ(message_loop_, base::MessageLoop::current()); DCHECK(!awaiting_va_surfaces_recycle_); DVLOG(1) << "Initiating surface set change"; awaiting_va_surfaces_recycle_ = true; requested_num_pics_ = num_pics; requested_pic_size_ = size; TryFinishSurfaceSetChange(); }
12,028
51,267
0
static ZIPARCHIVE_METHOD(locateName) { struct zip *intern; zval *this = getThis(); char *name; int name_len; long flags = 0; long idx = -1; if (!this) { RETURN_FALSE; } ZIP_FROM_OBJECT(intern, this); if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "p|l", &name, &name_len, &flags) == FAILURE) { return; } if (name_len<1) { RETURN_FALSE; } idx = (long)zip_name_locate(intern, (const char *)name, flags); if (idx >= 0) { RETURN_LONG(idx); } else { RETURN_FALSE; } }
12,029
144,042
0
png_do_read_invert_alpha(png_row_infop row_info, png_bytep row) { png_debug(1, "in png_do_read_invert_alpha"); #ifdef PNG_USELESS_TESTS_SUPPORTED if (row != NULL && row_info != NULL) #endif { png_uint_32 row_width = row_info->width; if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA) { /* This inverts the alpha channel in RGBA */ if (row_info->bit_depth == 8) { png_bytep sp = row + row_info->rowbytes; png_bytep dp = sp; png_uint_32 i; for (i = 0; i < row_width; i++) { *(--dp) = (png_byte)(255 - *(--sp)); /* This does nothing: *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); We can replace it with: */ sp-=3; dp=sp; } } /* This inverts the alpha channel in RRGGBBAA */ else { png_bytep sp = row + row_info->rowbytes; png_bytep dp = sp; png_uint_32 i; for (i = 0; i < row_width; i++) { *(--dp) = (png_byte)(255 - *(--sp)); *(--dp) = (png_byte)(255 - *(--sp)); /* This does nothing: *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); *(--dp) = *(--sp); We can replace it with: */ sp-=6; dp=sp; } } } else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { /* This inverts the alpha channel in GA */ if (row_info->bit_depth == 8) { png_bytep sp = row + row_info->rowbytes; png_bytep dp = sp; png_uint_32 i; for (i = 0; i < row_width; i++) { *(--dp) = (png_byte)(255 - *(--sp)); *(--dp) = *(--sp); } } /* This inverts the alpha channel in GGAA */ else { png_bytep sp = row + row_info->rowbytes; png_bytep dp = sp; png_uint_32 i; for (i = 0; i < row_width; i++) { *(--dp) = (png_byte)(255 - *(--sp)); *(--dp) = (png_byte)(255 - *(--sp)); /* *(--dp) = *(--sp); *(--dp) = *(--sp); */ sp-=2; dp=sp; } } } } }
12,030
153,896
0
ALWAYS_INLINE bool GLES2DecoderImpl::CheckMultiDrawElementsVertices( const char* function_name, bool instanced, const GLsizei* counts, GLenum type, const int32_t* offsets, const GLsizei* primcounts, GLsizei drawcount, Buffer* element_array_buffer, GLuint* total_max_vertex_accessed, GLsizei* total_max_primcount) { DCHECK_GE(drawcount, 0); for (GLsizei draw_id = 0; draw_id < drawcount; ++draw_id) { GLsizei count = counts[draw_id]; GLsizei offset = offsets[draw_id]; GLsizei primcount = instanced ? primcounts[draw_id] : 1; if (count < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "count < 0"); return false; } if (offset < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "offset < 0"); return false; } if (primcount < 0) { LOCAL_SET_GL_ERROR(GL_INVALID_VALUE, function_name, "primcount < 0"); return false; } if (count == 0 || primcount == 0) { continue; } GLuint max_vertex_accessed; if (!element_array_buffer->GetMaxValueForRange( offset, count, type, state_.enable_flags.primitive_restart_fixed_index, &max_vertex_accessed)) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, function_name, "range out of bounds for buffer"); return false; } if (!IsDrawValid(function_name, max_vertex_accessed, instanced, primcount)) { return false; } *total_max_vertex_accessed = std::max(*total_max_vertex_accessed, max_vertex_accessed); *total_max_primcount = std::max(*total_max_primcount, primcount); } return true; }
12,031
152,644
0
HTMLFormElement* HTMLFormControlElement::formOwner() const { return ListedElement::form(); }
12,032
67,044
0
int ff_unlock_avcodec(const AVCodec *codec) { if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; av_assert0(ff_avcodec_locked); ff_avcodec_locked = 0; avpriv_atomic_int_add_and_fetch(&entangled_thread_counter, -1); if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
12,033
29,856
0
kvec_array_init(struct kvec *new, struct kvec *iov, unsigned int nr_segs, size_t bytes) { size_t base = 0; while (bytes || !iov->iov_len) { int copy = min(bytes, iov->iov_len); bytes -= copy; base += copy; if (iov->iov_len == base) { iov++; nr_segs--; base = 0; } } memcpy(new, iov, sizeof(*iov) * nr_segs); new->iov_base += base; new->iov_len -= base; return nr_segs; }
12,034
117,401
0
png_handle_bKGD(png_structp png_ptr, png_infop info_ptr, png_uint_32 length) { png_size_t truelen; png_byte buf[6]; png_debug(1, "in png_handle_bKGD"); if (!(png_ptr->mode & PNG_HAVE_IHDR)) png_error(png_ptr, "Missing IHDR before bKGD"); else if (png_ptr->mode & PNG_HAVE_IDAT) { png_warning(png_ptr, "Invalid bKGD after IDAT"); png_crc_finish(png_ptr, length); return; } else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE && !(png_ptr->mode & PNG_HAVE_PLTE)) { png_warning(png_ptr, "Missing PLTE before bKGD"); png_crc_finish(png_ptr, length); return; } else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD)) { png_warning(png_ptr, "Duplicate bKGD chunk"); png_crc_finish(png_ptr, length); return; } if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) truelen = 1; else if (png_ptr->color_type & PNG_COLOR_MASK_COLOR) truelen = 6; else truelen = 2; if (length != truelen) { png_warning(png_ptr, "Incorrect bKGD chunk length"); png_crc_finish(png_ptr, length); return; } png_crc_read(png_ptr, buf, truelen); if (png_crc_finish(png_ptr, 0)) return; /* We convert the index value into RGB components so that we can allow * arbitrary RGB values for background when we have transparency, and * so it is easy to determine the RGB values of the background color * from the info_ptr struct. */ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { png_ptr->background.index = buf[0]; if (info_ptr && info_ptr->num_palette) { if (buf[0] >= info_ptr->num_palette) { png_warning(png_ptr, "Incorrect bKGD chunk index value"); return; } png_ptr->background.red = (png_uint_16)png_ptr->palette[buf[0]].red; png_ptr->background.green = (png_uint_16)png_ptr->palette[buf[0]].green; png_ptr->background.blue = (png_uint_16)png_ptr->palette[buf[0]].blue; } } else if (!(png_ptr->color_type & PNG_COLOR_MASK_COLOR)) /* GRAY */ { png_ptr->background.red = png_ptr->background.green = png_ptr->background.blue = png_ptr->background.gray = png_get_uint_16(buf); } else { png_ptr->background.red = png_get_uint_16(buf); png_ptr->background.green = png_get_uint_16(buf + 2); png_ptr->background.blue = png_get_uint_16(buf + 4); } png_set_bKGD(png_ptr, info_ptr, &(png_ptr->background)); }
12,035
168,392
0
void TestBrowserWindow::ExecuteExtensionCommand( const extensions::Extension* extension, const extensions::Command& command) {}
12,036
109,282
0
void InspectorPageAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world) { if (world != mainThreadNormalWorld()) return; if (frame == m_page->mainFrame()) m_injectedScriptManager->discardInjectedScripts(); if (!m_frontend) return; RefPtr<JSONObject> scripts = m_state->getObject(PageAgentState::pageAgentScriptsToEvaluateOnLoad); if (scripts) { JSONObject::const_iterator end = scripts->end(); for (JSONObject::const_iterator it = scripts->begin(); it != end; ++it) { String scriptText; if (it->value->asString(&scriptText)) frame->script().executeScriptInMainWorld(scriptText); } } if (!m_scriptToEvaluateOnLoadOnce.isEmpty()) frame->script().executeScriptInMainWorld(m_scriptToEvaluateOnLoadOnce); }
12,037
82,542
0
void jslSeekTo(size_t seekToChar) { if (lex->it.var) jsvLockAgain(lex->it.var); // see jslGetNextCh jsvStringIteratorFree(&lex->it); jsvStringIteratorNew(&lex->it, lex->sourceVar, seekToChar); jsvUnLock(lex->it.var); // see jslGetNextCh lex->tokenStart.it.var = 0; lex->tokenStart.currCh = 0; jslPreload(); }
12,038
139,164
0
mojom::RouteProvider* RenderProcessHostImpl::GetRemoteRouteProvider() { return remote_route_provider_.get(); }
12,039
27,456
0
static void __exit sit_cleanup(void) { xfrm4_tunnel_deregister(&sit_handler, AF_INET6); unregister_pernet_device(&sit_net_ops); rcu_barrier(); /* Wait for completion of call_rcu()'s */ }
12,040
115,110
0
void Clipboard::InsertMapping(const char* key, char* data, size_t data_len) { DCHECK(clipboard_data_->find(key) == clipboard_data_->end()); (*clipboard_data_)[key] = std::make_pair(data, data_len); }
12,041
183,451
1
void Preferences::NotifyPrefChanged(const std::wstring* pref_name) { if (!pref_name || *pref_name == prefs::kTapToClickEnabled) { CrosLibrary::Get()->GetSynapticsLibrary()->SetBoolParameter( PARAM_BOOL_TAP_TO_CLICK, tap_to_click_enabled_.GetValue()); } if (!pref_name || *pref_name == prefs::kVertEdgeScrollEnabled) { CrosLibrary::Get()->GetSynapticsLibrary()->SetBoolParameter( PARAM_BOOL_VERTICAL_EDGE_SCROLLING, vert_edge_scroll_enabled_.GetValue()); } if (!pref_name || *pref_name == prefs::kTouchpadSpeedFactor) { CrosLibrary::Get()->GetSynapticsLibrary()->SetRangeParameter( PARAM_RANGE_SPEED_SENSITIVITY, speed_factor_.GetValue()); } if (!pref_name || *pref_name == prefs::kTouchpadSensitivity) { CrosLibrary::Get()->GetSynapticsLibrary()->SetRangeParameter( PARAM_RANGE_TOUCH_SENSITIVITY, sensitivity_.GetValue()); } if (!pref_name || *pref_name == prefs::kLanguageHotkeyNextEngineInMenu) { SetLanguageConfigStringListAsCSV( kHotKeySectionName, kNextEngineInMenuConfigName, language_hotkey_next_engine_in_menu_.GetValue()); } if (!pref_name || *pref_name == prefs::kLanguageHotkeyPreviousEngine) { SetLanguageConfigStringListAsCSV( kHotKeySectionName, kPreviousEngineConfigName, language_hotkey_previous_engine_.GetValue()); } if (!pref_name || *pref_name == prefs::kLanguagePreloadEngines) { SetLanguageConfigStringListAsCSV(kGeneralSectionName, kPreloadEnginesConfigName, language_preload_engines_.GetValue()); } for (size_t i = 0; i < kNumChewingBooleanPrefs; ++i) { if (!pref_name || *pref_name == kChewingBooleanPrefs[i].pref_name) { SetLanguageConfigBoolean(kChewingSectionName, kChewingBooleanPrefs[i].ibus_config_name, language_chewing_boolean_prefs_[i].GetValue()); } } for (size_t i = 0; i < kNumChewingMultipleChoicePrefs; ++i) { if (!pref_name || *pref_name == kChewingMultipleChoicePrefs[i].pref_name) { SetLanguageConfigString( kChewingSectionName, kChewingMultipleChoicePrefs[i].ibus_config_name, language_chewing_multiple_choice_prefs_[i].GetValue()); } } if (!pref_name || *pref_name == kChewingHsuSelKeyType.pref_name) { SetLanguageConfigInteger( kChewingSectionName, kChewingHsuSelKeyType.ibus_config_name, language_chewing_hsu_sel_key_type_.GetValue()); } for (size_t i = 0; i < kNumChewingIntegerPrefs; ++i) { if (!pref_name || *pref_name == kChewingIntegerPrefs[i].pref_name) { SetLanguageConfigInteger(kChewingSectionName, kChewingIntegerPrefs[i].ibus_config_name, language_chewing_integer_prefs_[i].GetValue()); } } if (!pref_name || *pref_name == prefs::kLanguageHangulKeyboard) { SetLanguageConfigString(kHangulSectionName, kHangulKeyboardConfigName, language_hangul_keyboard_.GetValue()); } for (size_t i = 0; i < kNumPinyinBooleanPrefs; ++i) { if (!pref_name || *pref_name == kPinyinBooleanPrefs[i].pref_name) { SetLanguageConfigBoolean(kPinyinSectionName, kPinyinBooleanPrefs[i].ibus_config_name, language_pinyin_boolean_prefs_[i].GetValue()); } } for (size_t i = 0; i < kNumPinyinIntegerPrefs; ++i) { if (!pref_name || *pref_name == kPinyinIntegerPrefs[i].pref_name) { SetLanguageConfigInteger(kPinyinSectionName, kPinyinIntegerPrefs[i].ibus_config_name, language_pinyin_int_prefs_[i].GetValue()); } } if (!pref_name || *pref_name == kPinyinDoublePinyinSchema.pref_name) { SetLanguageConfigInteger( kPinyinSectionName, kPinyinDoublePinyinSchema.ibus_config_name, language_pinyin_double_pinyin_schema_.GetValue()); } for (size_t i = 0; i < kNumMozcBooleanPrefs; ++i) { if (!pref_name || *pref_name == kMozcBooleanPrefs[i].pref_name) { SetLanguageConfigBoolean(kMozcSectionName, kMozcBooleanPrefs[i].ibus_config_name, language_mozc_boolean_prefs_[i].GetValue()); } } for (size_t i = 0; i < kNumMozcMultipleChoicePrefs; ++i) { if (!pref_name || *pref_name == kMozcMultipleChoicePrefs[i].pref_name) { SetLanguageConfigString( kMozcSectionName, kMozcMultipleChoicePrefs[i].ibus_config_name, language_mozc_multiple_choice_prefs_[i].GetValue()); } } for (size_t i = 0; i < kNumMozcIntegerPrefs; ++i) { if (!pref_name || *pref_name == kMozcIntegerPrefs[i].pref_name) { SetLanguageConfigInteger(kMozcSectionName, kMozcIntegerPrefs[i].ibus_config_name, language_mozc_integer_prefs_[i].GetValue()); } } }
12,042
10,972
0
PHP_FUNCTION(xml_set_processing_instruction_handler) { xml_parser *parser; zval *pind, **hdl; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rZ", &pind, &hdl) == FAILURE) { return; } ZEND_FETCH_RESOURCE(parser,xml_parser *, &pind, -1, "XML Parser", le_xml_parser); xml_set_handler(&parser->processingInstructionHandler, hdl); XML_SetProcessingInstructionHandler(parser->parser, _xml_processingInstructionHandler); RETVAL_TRUE; }
12,043
163,672
0
xmlBufGetAllocationScheme(xmlBufPtr buf) { if (buf == NULL) { #ifdef DEBUG_BUFFER xmlGenericError(xmlGenericErrorContext, "xmlBufGetAllocationScheme: buf == NULL\n"); #endif return(-1); } return(buf->alloc); }
12,044
46,266
0
static int blkdev_write_end(struct file *file, struct address_space *mapping, loff_t pos, unsigned len, unsigned copied, struct page *page, void *fsdata) { int ret; ret = block_write_end(file, mapping, pos, len, copied, page, fsdata); unlock_page(page); page_cache_release(page); return ret; }
12,045
182,649
1
int DecodeTeredo(ThreadVars *tv, DecodeThreadVars *dtv, Packet *p, uint8_t *pkt, uint16_t len, PacketQueue *pq) { if (!g_teredo_enabled) return TM_ECODE_FAILED; uint8_t *start = pkt; /* Is this packet to short to contain an IPv6 packet ? */ if (len < IPV6_HEADER_LEN) return TM_ECODE_FAILED; /* Teredo encapsulate IPv6 in UDP and can add some custom message * part before the IPv6 packet. In our case, we just want to get * over an ORIGIN indication. So we just make one offset if needed. */ if (start[0] == 0x0) { switch (start[1]) { /* origin indication: compatible with tunnel */ case 0x0: /* offset is coherent with len and presence of an IPv6 header */ if (len >= TEREDO_ORIG_INDICATION_LENGTH + IPV6_HEADER_LEN) start += TEREDO_ORIG_INDICATION_LENGTH; else return TM_ECODE_FAILED; break; /* authentication: negotiation not real tunnel */ case 0x1: return TM_ECODE_FAILED; /* this case is not possible in Teredo: not that protocol */ default: return TM_ECODE_FAILED; } } /* There is no specific field that we can check to prove that the packet * is a Teredo packet. We've zapped here all the possible Teredo header * and we should have an IPv6 packet at the start pointer. * We then can only do two checks before sending the encapsulated packets * to decoding: * - The packet has a protocol version which is IPv6. * - The IPv6 length of the packet matches what remains in buffer. */ if (IP_GET_RAW_VER(start) == 6) { IPV6Hdr *thdr = (IPV6Hdr *)start; if (len == IPV6_HEADER_LEN + IPV6_GET_RAW_PLEN(thdr) + (start - pkt)) { if (pq != NULL) { int blen = len - (start - pkt); /* spawn off tunnel packet */ Packet *tp = PacketTunnelPktSetup(tv, dtv, p, start, blen, DECODE_TUNNEL_IPV6, pq); if (tp != NULL) { PKT_SET_SRC(tp, PKT_SRC_DECODER_TEREDO); /* add the tp to the packet queue. */ PacketEnqueue(pq,tp); StatsIncr(tv, dtv->counter_teredo); return TM_ECODE_OK; } } } return TM_ECODE_FAILED; } return TM_ECODE_FAILED; }
12,046
40,317
0
static int atalk_pick_and_bind_port(struct sock *sk, struct sockaddr_at *sat) { int retval; write_lock_bh(&atalk_sockets_lock); for (sat->sat_port = ATPORT_RESERVED; sat->sat_port < ATPORT_LAST; sat->sat_port++) { struct sock *s; sk_for_each(s, &atalk_sockets) { struct atalk_sock *at = at_sk(s); if (at->src_net == sat->sat_addr.s_net && at->src_node == sat->sat_addr.s_node && at->src_port == sat->sat_port) goto try_next_port; } /* Wheee, it's free, assign and insert. */ __atalk_insert_socket(sk); at_sk(sk)->src_port = sat->sat_port; retval = 0; goto out; try_next_port:; } retval = -EBUSY; out: write_unlock_bh(&atalk_sockets_lock); return retval; }
12,047
144,751
0
WebContents* GetActiveWebContents() { return browser()->tab_strip_model()->GetActiveWebContents(); }
12,048
92,867
0
GF_Err gf_sm_aggregate(GF_SceneManager *ctx, u16 ESID) { GF_Err e; u32 i, stream_count; #ifndef GPAC_DISABLE_VRML u32 j; GF_AUContext *au; GF_Command *com; #endif e = GF_OK; #if DEBUG_RAP com_count = 0; stream_count = gf_list_count(ctx->streams); for (i=0; i<stream_count; i++) { GF_StreamContext *sc = (GF_StreamContext *)gf_list_get(ctx->streams, i); if (sc->streamType == GF_STREAM_SCENE) { au_count = gf_list_count(sc->AUs); for (j=0; j<au_count; j++) { au = (GF_AUContext *)gf_list_get(sc->AUs, j); com_count += gf_list_count(au->commands); } } } GF_LOG(GF_LOG_INFO, GF_LOG_SCENE, ("[SceneManager] Making RAP with %d commands\n", com_count)); #endif stream_count = gf_list_count(ctx->streams); for (i=0; i<stream_count; i++) { GF_AUContext *carousel_au; GF_List *carousel_commands; GF_StreamContext *aggregate_on_stream; GF_StreamContext *sc = (GF_StreamContext *)gf_list_get(ctx->streams, i); if (ESID && (sc->ESID!=ESID)) continue; /*locate the AU in which our commands will be aggregated*/ carousel_au = NULL; carousel_commands = NULL; aggregate_on_stream = sc->aggregate_on_esid ? gf_sm_get_stream(ctx, sc->aggregate_on_esid) : NULL; if (aggregate_on_stream==sc) { carousel_commands = gf_list_new(); } else if (aggregate_on_stream) { if (!gf_list_count(aggregate_on_stream->AUs)) { carousel_au = gf_sm_stream_au_new(aggregate_on_stream, 0, 0, 1); } else { /* assert we already performed aggregation */ assert(gf_list_count(aggregate_on_stream->AUs)==1); carousel_au = gf_list_get(aggregate_on_stream->AUs, 0); } carousel_commands = carousel_au->commands; } /*TODO - do this as well for ODs*/ #ifndef GPAC_DISABLE_VRML if (sc->streamType == GF_STREAM_SCENE) { Bool has_modif = 0; /*we check for each stream if it is a base stream (SceneReplace ...) - several streams may carry RAPs if inline nodes are used*/ Bool base_stream_found = 0; /*in DIMS we use an empty initial AU with no commands to signal the RAP*/ if (sc->objectType == GPAC_OTI_SCENE_DIMS) base_stream_found = 1; /*apply all commands - this will also apply the SceneReplace*/ while (gf_list_count(sc->AUs)) { u32 count; au = (GF_AUContext *) gf_list_get(sc->AUs, 0); gf_list_rem(sc->AUs, 0); /*AU not aggregated*/ if (au->flags & GF_SM_AU_NOT_AGGREGATED) { gf_sm_au_del(sc, au); continue; } count = gf_list_count(au->commands); for (j=0; j<count; j++) { u32 store=0; com = gf_list_get(au->commands, j); if (!base_stream_found) { switch (com->tag) { case GF_SG_SCENE_REPLACE: case GF_SG_LSR_NEW_SCENE: case GF_SG_LSR_REFRESH_SCENE: base_stream_found = 1; break; } } /*aggregate the command*/ /*if stream doesn't carry a carousel or carries the base carousel (scene replace), always apply the command*/ if (base_stream_found || !sc->aggregate_on_esid) { store = 0; } /*otherwise, check wether the command should be kept in this stream as is, or can be aggregated on this stream*/ else { switch (com->tag) { /*the following commands do not impact a sub-tree (eg do not deal with nodes), we cannot aggregate them... */ case GF_SG_ROUTE_REPLACE: case GF_SG_ROUTE_DELETE: case GF_SG_ROUTE_INSERT: case GF_SG_PROTO_INSERT: case GF_SG_PROTO_DELETE: case GF_SG_PROTO_DELETE_ALL: case GF_SG_GLOBAL_QUANTIZER: case GF_SG_LSR_RESTORE: case GF_SG_LSR_SAVE: case GF_SG_LSR_SEND_EVENT: case GF_SG_LSR_CLEAN: /*todo check in which category to put these commands*/ store = 1; break; /*other commands: !!! we need to know if the target node of the command has been inserted in this stream !!! This is a tedious task, for now we will consider the following cases: - locate a similar command in the stored list: remove the similar one and aggregate on stream - by default all AUs are stored if the stream is in aggregate mode - we should fix that by checking insertion points: if a command apllies on a node that has been inserted in this stream, we can aggregate, otherwise store */ default: /*check if we can directly store the command*/ assert(carousel_commands); store = store_or_aggregate(sc, com, carousel_commands, &has_modif); break; } } switch (store) { /*command has been merged with a previous command in carousel and needs to be destroyed*/ case 2: gf_list_rem(au->commands, j); j--; count--; gf_sg_command_del((GF_Command *)com); break; /*command shall be moved to carousel without being applied*/ case 1: gf_list_insert(carousel_commands, com, 0); gf_list_rem(au->commands, j); j--; count--; break; /*command can be applied*/ default: e = gf_sg_command_apply(ctx->scene_graph, com, 0); break; } } gf_sm_au_del(sc, au); } /*and recreate scene replace*/ if (base_stream_found) { au = gf_sm_stream_au_new(sc, 0, 0, 1); switch (sc->objectType) { case GPAC_OTI_SCENE_BIFS: case GPAC_OTI_SCENE_BIFS_V2: com = gf_sg_command_new(ctx->scene_graph, GF_SG_SCENE_REPLACE); break; case GPAC_OTI_SCENE_LASER: com = gf_sg_command_new(ctx->scene_graph, GF_SG_LSR_NEW_SCENE); break; case GPAC_OTI_SCENE_DIMS: /* We do not create a new command, empty AU is enough in DIMS*/ default: com = NULL; break; } if (com) { com->node = ctx->scene_graph->RootNode; ctx->scene_graph->RootNode = NULL; gf_list_del(com->new_proto_list); com->new_proto_list = ctx->scene_graph->protos; ctx->scene_graph->protos = NULL; /*indicate the command is the aggregated scene graph, so that PROTOs and ROUTEs are taken from the scenegraph when encoding*/ com->aggregated = 1; gf_list_add(au->commands, com); } } /*update carousel flags of the AU*/ else if (carousel_commands) { /*if current stream caries its own carousel*/ if (!carousel_au) { carousel_au = gf_sm_stream_au_new(sc, 0, 0, 1); gf_list_del(carousel_au->commands); carousel_au->commands = carousel_commands; } carousel_au->flags |= GF_SM_AU_RAP | GF_SM_AU_CAROUSEL; if (has_modif) carousel_au->flags |= GF_SM_AU_MODIFIED; } } #endif } return e; }
12,049
104,989
0
void GraphicsContext::setPlatformStrokeThickness(float thickness) { if (paintingDisabled()) return; if (m_data->context) m_data->context->SetPen(wxPen(strokeColor(), thickness, strokeStyleToWxPenStyle(strokeStyle()))); }
12,050
26,555
0
static int __init packet_init(void) { int rc = proto_register(&packet_proto, 0); if (rc != 0) goto out; sock_register(&packet_family_ops); register_pernet_subsys(&packet_net_ops); register_netdevice_notifier(&packet_netdev_notifier); out: return rc; }
12,051
115,276
0
void OmniboxViewWin::RevertAll() { ScopedFreeze freeze(this, GetTextObjectModel()); ClosePopup(); model_->Revert(); saved_selection_for_focus_change_.cpMin = -1; TextChanged(); }
12,052
13,211
0
nsPluginInstance::WriteReady(NPStream* /* stream */ ) { if ( _streamfd != -1 ) { return 1024; } else { return 0; } }
12,053
118,483
0
RenderFrameImpl::createWorkerPermissionClientProxy( blink::WebLocalFrame* frame) { if (!frame || !frame->view()) return NULL; DCHECK(!frame_ || frame_ == frame); return GetContentClient()->renderer()->CreateWorkerPermissionClientProxy( this, frame); }
12,054
123,909
0
void RenderViewImpl::OnSetCompositionFromExistingText( int start, int end, const std::vector<WebKit::WebCompositionUnderline>& underlines) { if (!webview()) return; DCHECK(!handling_ime_event_); handling_ime_event_ = true; webview()->setCompositionFromExistingText(start, end, underlines); handling_ime_event_ = false; UpdateTextInputState(DO_NOT_SHOW_IME); }
12,055
164,282
0
bool IsBlocked(const scoped_refptr<const Extension>& extension, const GURL& url, int tab_id) { return IsAllowed(extension, url, PERMITTED_NONE, tab_id); }
12,056
37,126
0
static inline bool nested_cpu_has2(struct vmcs12 *vmcs12, u32 bit) { return (vmcs12->cpu_based_vm_exec_control & CPU_BASED_ACTIVATE_SECONDARY_CONTROLS) && (vmcs12->secondary_vm_exec_control & bit); }
12,057
44,504
0
static struct cgroup_meta_data *lxc_cgroup_put_meta(struct cgroup_meta_data *meta_data) { size_t i; if (!meta_data) return NULL; if (--meta_data->ref > 0) return meta_data; lxc_free_array((void **)meta_data->mount_points, (lxc_free_fn)lxc_cgroup_mount_point_free); if (meta_data->hierarchies) { for (i = 0; i <= meta_data->maximum_hierarchy; i++) lxc_cgroup_hierarchy_free(meta_data->hierarchies[i]); } free(meta_data->hierarchies); free(meta_data); return NULL; }
12,058
182,148
1
int URI_FUNC(ComposeQueryEngine)(URI_CHAR * dest, const URI_TYPE(QueryList) * queryList, int maxChars, int * charsWritten, int * charsRequired, UriBool spaceToPlus, UriBool normalizeBreaks) { UriBool firstItem = URI_TRUE; int ampersandLen = 0; /* increased to 1 from second item on */ URI_CHAR * write = dest; /* Subtract terminator */ if (dest == NULL) { *charsRequired = 0; } else { maxChars--; } while (queryList != NULL) { const URI_CHAR * const key = queryList->key; const URI_CHAR * const value = queryList->value; const int worstCase = (normalizeBreaks == URI_TRUE ? 6 : 3); const int keyLen = (key == NULL) ? 0 : (int)URI_STRLEN(key); const int keyRequiredChars = worstCase * keyLen; const int valueLen = (value == NULL) ? 0 : (int)URI_STRLEN(value); const int valueRequiredChars = worstCase * valueLen; if (dest == NULL) { if (firstItem == URI_TRUE) { ampersandLen = 1; firstItem = URI_FALSE; } (*charsRequired) += ampersandLen + keyRequiredChars + ((value == NULL) ? 0 : 1 + valueRequiredChars); } else { URI_CHAR * afterKey; if ((write - dest) + ampersandLen + keyRequiredChars > maxChars) { return URI_ERROR_OUTPUT_TOO_LARGE; } /* Copy key */ if (firstItem == URI_TRUE) { firstItem = URI_FALSE; } else { write[0] = _UT('&'); write++; } afterKey = URI_FUNC(EscapeEx)(key, key + keyLen, write, spaceToPlus, normalizeBreaks); write += (afterKey - write); if (value != NULL) { URI_CHAR * afterValue; if ((write - dest) + 1 + valueRequiredChars > maxChars) { return URI_ERROR_OUTPUT_TOO_LARGE; } /* Copy value */ write[0] = _UT('='); write++; afterValue = URI_FUNC(EscapeEx)(value, value + valueLen, write, spaceToPlus, normalizeBreaks); write += (afterValue - write); } } queryList = queryList->next; } if (dest != NULL) { write[0] = _UT('\0'); if (charsWritten != NULL) { *charsWritten = (int)(write - dest) + 1; /* .. for terminator */ } } return URI_SUCCESS; }
12,059
171,616
0
char16_t* utf8_to_utf16_n(const uint8_t* src, size_t srcLen, char16_t* dst, size_t dstLen) { const uint8_t* const u8end = src + srcLen; const uint8_t* u8cur = src; const char16_t* const u16end = dst + dstLen; char16_t* u16cur = dst; while (u8cur < u8end && u16cur < u16end) { size_t u8len = utf8_codepoint_len(*u8cur); uint32_t codepoint = utf8_to_utf32_codepoint(u8cur, u8len); if (codepoint <= 0xFFFF) { *u16cur++ = (char16_t) codepoint; } else { codepoint = codepoint - 0x10000; *u16cur++ = (char16_t) ((codepoint >> 10) + 0xD800); if (u16cur >= u16end) { return u16cur-1; } *u16cur++ = (char16_t) ((codepoint & 0x3FF) + 0xDC00); } u8cur += u8len; } return u16cur; }
12,060
78,733
0
static int list_readers(void) { unsigned int i, rcount = sc_ctx_get_reader_count(ctx); if (rcount == 0) { printf("No smart card readers found.\n"); return 0; } printf("# Detected readers (%s)\n", ctx->reader_driver->short_name); printf("Nr. Card Features Name\n"); for (i = 0; i < rcount; i++) { sc_reader_t *reader = sc_ctx_get_reader(ctx, i); int state = sc_detect_card_presence(reader); printf("%-5d%-6s%-10s%s\n", i, state & SC_READER_CARD_PRESENT ? "Yes":"No", reader->capabilities & SC_READER_CAP_PIN_PAD ? "PIN pad":"", reader->name); if (state & SC_READER_CARD_PRESENT && verbose) { struct sc_card *card; int r; char tmp[SC_MAX_ATR_SIZE*3]; sc_bin_to_hex(reader->atr.value, reader->atr.len, tmp, sizeof(tmp) - 1, ':'); if (state & SC_READER_CARD_EXCLUSIVE) printf(" %s [EXCLUSIVE]\n", tmp); else { if ((r = sc_connect_card(reader, &card)) != SC_SUCCESS) { fprintf(stderr, " failed: %s\n", sc_strerror(r)); } else { printf(" %s %s %s\n", tmp, card->name ? card->name : "", state & SC_READER_CARD_INUSE ? "[IN USE]" : ""); sc_disconnect_card(card); } } } } return 0; }
12,061
147,012
0
int WebFrame::InstanceCount() { return g_frame_count; }
12,062
119,164
0
void XMLHttpRequest::createRequest(ExceptionState& es) { if (m_url.protocolIs("blob") && m_method != "GET") { es.throwDOMException(NetworkError, ExceptionMessages::failedToExecute("send", "XMLHttpRequest", "'GET' is the only method allowed for 'blob:' URLs.")); return; } bool uploadEvents = false; if (m_async) { m_progressEventThrottle.dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); if (m_requestEntityBody && m_upload) { uploadEvents = m_upload->hasEventListeners(); m_upload->dispatchEvent(XMLHttpRequestProgressEvent::create(eventNames().loadstartEvent)); } } m_sameOriginRequest = securityOrigin()->canRequest(m_url); m_uploadEventsAllowed = m_sameOriginRequest || uploadEvents || !isSimpleCrossOriginAccessRequest(m_method, m_requestHeaders); ResourceRequest request(m_url); request.setHTTPMethod(m_method); request.setTargetType(ResourceRequest::TargetIsXHR); InspectorInstrumentation::willLoadXHR(scriptExecutionContext(), this, m_method, m_url, m_async, m_requestEntityBody ? m_requestEntityBody->deepCopy() : 0, m_requestHeaders, m_includeCredentials); if (m_requestEntityBody) { ASSERT(m_method != "GET"); ASSERT(m_method != "HEAD"); request.setHTTPBody(m_requestEntityBody.release()); } if (m_requestHeaders.size() > 0) request.addHTTPHeaderFields(m_requestHeaders); ThreadableLoaderOptions options; options.sendLoadCallbacks = SendCallbacks; options.sniffContent = DoNotSniffContent; options.preflightPolicy = uploadEvents ? ForcePreflight : ConsiderPreflight; options.allowCredentials = (m_sameOriginRequest || m_includeCredentials) ? AllowStoredCredentials : DoNotAllowStoredCredentials; options.credentialsRequested = m_includeCredentials ? ClientRequestedCredentials : ClientDidNotRequestCredentials; options.crossOriginRequestPolicy = UseAccessControl; options.securityOrigin = securityOrigin(); options.initiator = FetchInitiatorTypeNames::xmlhttprequest; options.contentSecurityPolicyEnforcement = ContentSecurityPolicy::shouldBypassMainWorld(scriptExecutionContext()) ? DoNotEnforceContentSecurityPolicy : EnforceConnectSrcDirective; options.mixedContentBlockingTreatment = TreatAsActiveContent; options.timeoutMilliseconds = m_timeoutMilliseconds; m_exceptionCode = 0; m_error = false; if (m_async) { if (m_upload) request.setReportUploadProgress(true); ASSERT(!m_loader); m_loader = ThreadableLoader::create(scriptExecutionContext(), this, request, options); if (m_loader) { ASSERT(!hasPendingActivity()); setPendingActivity(this); } } else { request.setPriority(ResourceLoadPriorityVeryHigh); InspectorInstrumentation::willLoadXHRSynchronously(scriptExecutionContext()); ThreadableLoader::loadResourceSynchronously(scriptExecutionContext(), request, *this, options); InspectorInstrumentation::didLoadXHRSynchronously(scriptExecutionContext()); } if (!m_exceptionCode && m_error) m_exceptionCode = NetworkError; if (m_exceptionCode) es.throwDOMException(m_exceptionCode); }
12,063
9,951
0
Chunk::Chunk(Container* parent, WEBP_MetaHandler* handler) { this->needsRewrite = (parent) ? parent->needsRewrite : false; this->parent = parent; XMP_IO* file = handler->parent->ioRef; this->pos = file->Offset(); this->tag = XIO::ReadUns32_LE(file); this->size = XIO::ReadUns32_LE(file); if ((this->pos + this->size + 8) > handler->initialFileSize) { XMP_Throw("Bad RIFF chunk size", kXMPErr_BadFileFormat); } this->data.reserve((XMP_Int32) this->size); this->data.assign((XMP_Int32) this->size, '\0'); file->ReadAll((void*)this->data.data(), (XMP_Int32) this->size); if (this->size & 1) { file->Seek(1, kXMP_SeekFromCurrent); } }
12,064
167,961
0
void LocalFrame::PrintNavigationErrorMessage(const Frame& target_frame, const char* reason) { String target_frame_description = target_frame.IsLocalFrame() ? "with URL '" + ToLocalFrame(target_frame).GetDocument()->Url().GetString() + "'" : "with origin '" + target_frame.GetSecurityContext() ->GetSecurityOrigin() ->ToString() + "'"; String message = "Unsafe JavaScript attempt to initiate navigation for frame " + target_frame_description + " from frame with URL '" + GetDocument()->Url().GetString() + "'. " + reason + "\n"; DomWindow()->PrintErrorMessage(message); }
12,065
135,067
0
void AppCacheHost::GetResourceList( AppCacheResourceInfoVector* resource_infos) { if (associated_cache_.get() && associated_cache_->is_complete()) associated_cache_->ToResourceInfoVector(resource_infos); }
12,066
155,399
0
bool ChromeContentBrowserClient::IsBuiltinComponent( content::BrowserContext* browser_context, const url::Origin& origin) { #if BUILDFLAG(ENABLE_EXTENSIONS) return ChromeContentBrowserClientExtensionsPart::IsBuiltinComponent( browser_context, origin); #else return false; #endif }
12,067
149,583
0
net::NetworkIsolationKey CreateNetworkIsolationKey(const GURL& main_frame_url) { url::Origin origin = url::Origin::Create(main_frame_url); return net::NetworkIsolationKey(origin, origin); }
12,068
112,250
0
void UrlFetcher::Core::SetHeader(const std::string& key, const std::string& value) { request_headers_.SetHeader(key, value); }
12,069
58,863
0
exim_wait_tick(struct timeval *then_tv, int resolution) { struct timeval now_tv; long int now_true_usec; (void)gettimeofday(&now_tv, NULL); now_true_usec = now_tv.tv_usec; now_tv.tv_usec = (now_true_usec/resolution) * resolution; if (exim_tvcmp(&now_tv, then_tv) <= 0) { struct itimerval itval; itval.it_interval.tv_sec = 0; itval.it_interval.tv_usec = 0; itval.it_value.tv_sec = then_tv->tv_sec - now_tv.tv_sec; itval.it_value.tv_usec = then_tv->tv_usec + resolution - now_true_usec; /* We know that, overall, "now" is less than or equal to "then". Therefore, a negative value for the microseconds is possible only in the case when "now" is more than a second less than "then". That means that itval.it_value.tv_sec is greater than zero. The following correction is therefore safe. */ if (itval.it_value.tv_usec < 0) { itval.it_value.tv_usec += 1000000; itval.it_value.tv_sec -= 1; } DEBUG(D_transport|D_receive) { if (!running_in_test_harness) { debug_printf("tick check: " TIME_T_FMT ".%06lu " TIME_T_FMT ".%06lu\n", then_tv->tv_sec, (long) then_tv->tv_usec, now_tv.tv_sec, (long) now_tv.tv_usec); debug_printf("waiting " TIME_T_FMT ".%06lu\n", itval.it_value.tv_sec, (long) itval.it_value.tv_usec); } } milliwait(&itval); } }
12,070
32,273
0
static void ext4_dx_csum_set(struct inode *inode, struct ext4_dir_entry *dirent) { struct dx_countlimit *c; struct dx_tail *t; int count_offset, limit, count; if (!EXT4_HAS_RO_COMPAT_FEATURE(inode->i_sb, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) return; c = get_dx_countlimit(inode, dirent, &count_offset); if (!c) { EXT4_ERROR_INODE(inode, "dir seems corrupt? Run e2fsck -D."); return; } limit = le16_to_cpu(c->limit); count = le16_to_cpu(c->count); if (count_offset + (limit * sizeof(struct dx_entry)) > EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) { warn_no_space_for_csum(inode); return; } t = (struct dx_tail *)(((struct dx_entry *)c) + limit); t->dt_checksum = ext4_dx_csum(inode, dirent, count_offset, count, t); }
12,071
22,649
0
static void update_group_shares_cpu(struct task_group *tg, int cpu, unsigned long sd_shares, unsigned long sd_rq_weight, unsigned long *usd_rq_weight) { unsigned long shares, rq_weight; int boost = 0; rq_weight = usd_rq_weight[cpu]; if (!rq_weight) { boost = 1; rq_weight = NICE_0_LOAD; } /* * \Sum_j shares_j * rq_weight_i * shares_i = ----------------------------- * \Sum_j rq_weight_j */ shares = (sd_shares * rq_weight) / sd_rq_weight; shares = clamp_t(unsigned long, shares, MIN_SHARES, MAX_SHARES); if (abs(shares - tg->se[cpu]->load.weight) > sysctl_sched_shares_thresh) { struct rq *rq = cpu_rq(cpu); unsigned long flags; raw_spin_lock_irqsave(&rq->lock, flags); tg->cfs_rq[cpu]->rq_weight = boost ? 0 : rq_weight; tg->cfs_rq[cpu]->shares = boost ? 0 : shares; __set_se_shares(tg->se[cpu], shares); raw_spin_unlock_irqrestore(&rq->lock, flags); } }
12,072
23,228
0
int nfs4_proc_layoutget(struct nfs4_layoutget *lgp) { struct nfs_server *server = NFS_SERVER(lgp->args.inode); struct rpc_task *task; struct rpc_message msg = { .rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_LAYOUTGET], .rpc_argp = &lgp->args, .rpc_resp = &lgp->res, }; struct rpc_task_setup task_setup_data = { .rpc_client = server->client, .rpc_message = &msg, .callback_ops = &nfs4_layoutget_call_ops, .callback_data = lgp, .flags = RPC_TASK_ASYNC, }; int status = 0; dprintk("--> %s\n", __func__); lgp->res.layoutp = &lgp->args.layout; lgp->res.seq_res.sr_slot = NULL; task = rpc_run_task(&task_setup_data); if (IS_ERR(task)) return PTR_ERR(task); status = nfs4_wait_for_completion_rpc_task(task); if (status == 0) status = task->tk_status; if (status == 0) status = pnfs_layout_process(lgp); rpc_put_task(task); dprintk("<-- %s status=%d\n", __func__, status); return status; }
12,073
35,193
0
void signal_wake_up(struct task_struct *t, int resume) { unsigned int mask; set_tsk_thread_flag(t, TIF_SIGPENDING); /* * For SIGKILL, we want to wake it up in the stopped/traced/killable * case. We don't check t->state here because there is a race with it * executing another processor and just now entering stopped state. * By using wake_up_state, we ensure the process will wake up and * handle its death signal. */ mask = TASK_INTERRUPTIBLE; if (resume) mask |= TASK_WAKEKILL; if (!wake_up_state(t, mask)) kick_process(t); }
12,074
88,043
0
void genl_lock(void) { mutex_lock(&genl_mutex); }
12,075
165,981
0
void RTCPeerConnectionHandler::GetStats( std::unique_ptr<blink::WebRTCStatsReportCallback> callback, blink::RTCStatsFilter filter) { DCHECK(task_runner_->RunsTasksInCurrentSequence()); signaling_thread()->PostTask( FROM_HERE, base::BindOnce(&GetRTCStatsOnSignalingThread, task_runner_, native_peer_connection_, std::move(callback), filter)); }
12,076
25,472
0
static int del_instruction_bp(struct task_struct *child, int slot) { switch (slot) { case 1: if ((child->thread.dbcr0 & DBCR0_IAC1) == 0) return -ENOENT; if (dbcr_iac_range(child) & DBCR_IAC12MODE) { /* address range - clear slots 1 & 2 */ child->thread.iac2 = 0; dbcr_iac_range(child) &= ~DBCR_IAC12MODE; } child->thread.iac1 = 0; child->thread.dbcr0 &= ~DBCR0_IAC1; break; case 2: if ((child->thread.dbcr0 & DBCR0_IAC2) == 0) return -ENOENT; if (dbcr_iac_range(child) & DBCR_IAC12MODE) /* used in a range */ return -EINVAL; child->thread.iac2 = 0; child->thread.dbcr0 &= ~DBCR0_IAC2; break; #if CONFIG_PPC_ADV_DEBUG_IACS > 2 case 3: if ((child->thread.dbcr0 & DBCR0_IAC3) == 0) return -ENOENT; if (dbcr_iac_range(child) & DBCR_IAC34MODE) { /* address range - clear slots 3 & 4 */ child->thread.iac4 = 0; dbcr_iac_range(child) &= ~DBCR_IAC34MODE; } child->thread.iac3 = 0; child->thread.dbcr0 &= ~DBCR0_IAC3; break; case 4: if ((child->thread.dbcr0 & DBCR0_IAC4) == 0) return -ENOENT; if (dbcr_iac_range(child) & DBCR_IAC34MODE) /* Used in a range */ return -EINVAL; child->thread.iac4 = 0; child->thread.dbcr0 &= ~DBCR0_IAC4; break; #endif default: return -EINVAL; } return 0; }
12,077
65,123
0
static inline void VectorSubtract3(const DDSVector3 left, const DDSVector3 right, DDSVector3 *destination) { destination->x = left.x - right.x; destination->y = left.y - right.y; destination->z = left.z - right.z; }
12,078
133,758
0
static SSLContext* GetInstance() { return Singleton<SSLContext>::get(); }
12,079
53,871
0
acpi_os_table_override(struct acpi_table_header *existing_table, struct acpi_table_header **new_table) { if (!existing_table || !new_table) return AE_BAD_PARAMETER; *new_table = NULL; #ifdef CONFIG_ACPI_CUSTOM_DSDT if (strncmp(existing_table->signature, "DSDT", 4) == 0) *new_table = (struct acpi_table_header *)AmlCode; #endif if (*new_table != NULL) acpi_table_taint(existing_table); return AE_OK; }
12,080
14,184
0
__GLXcontext *__glXLookupContextByTag(__GLXclientState *cl, GLXContextTag tag) { int num = cl->numCurrentContexts; if (tag < 1 || tag > num) { return 0; } else { return cl->currentContexts[tag-1]; } }
12,081
49,769
0
static void arcmsr_hbaA_stop_bgrb(struct AdapterControlBlock *acb) { struct MessageUnit_A __iomem *reg = acb->pmuA; acb->acb_flags &= ~ACB_F_MSG_START_BGRB; writel(ARCMSR_INBOUND_MESG0_STOP_BGRB, &reg->inbound_msgaddr0); if (!arcmsr_hbaA_wait_msgint_ready(acb)) { printk(KERN_NOTICE "arcmsr%d: wait 'stop adapter background rebulid' timeout\n" , acb->host->host_no); } }
12,082
188,568
1
virtual void SetUp() { video_ = new libvpx_test::WebMVideoSource(kVP9TestFile); ASSERT_TRUE(video_ != NULL); video_->Init(); video_->Begin(); vpx_codec_dec_cfg_t cfg = {0}; decoder_ = new libvpx_test::VP9Decoder(cfg, 0); ASSERT_TRUE(decoder_ != NULL); }
12,083
32,113
0
static int dev_get_valid_name(struct net *net, const char *name, char *buf, bool fmt) { if (!dev_valid_name(name)) return -EINVAL; if (fmt && strchr(name, '%')) return __dev_alloc_name(net, name, buf); else if (__dev_get_by_name(net, name)) return -EEXIST; else if (buf != name) strlcpy(buf, name, IFNAMSIZ); return 0; }
12,084
126,539
0
bool TabStripGtk::IsTabDetached(const TabGtk* tab) const { if (drag_controller_.get()) return drag_controller_->IsTabDetached(tab); return false; }
12,085
15,556
0
process_mux_stdio_fwd(u_int rid, Channel *c, Buffer *m, Buffer *r) { Channel *nc; char *reserved, *chost; u_int cport, i, j; int new_fd[2]; struct mux_stdio_confirm_ctx *cctx; chost = reserved = NULL; if ((reserved = buffer_get_string_ret(m, NULL)) == NULL || (chost = buffer_get_string_ret(m, NULL)) == NULL || buffer_get_int_ret(&cport, m) != 0) { free(reserved); free(chost); error("%s: malformed message", __func__); return -1; } free(reserved); debug2("%s: channel %d: request stdio fwd to %s:%u", __func__, c->self, chost, cport); /* Gather fds from client */ for(i = 0; i < 2; i++) { if ((new_fd[i] = mm_receive_fd(c->sock)) == -1) { error("%s: failed to receive fd %d from slave", __func__, i); for (j = 0; j < i; j++) close(new_fd[j]); free(chost); /* prepare reply */ buffer_put_int(r, MUX_S_FAILURE); buffer_put_int(r, rid); buffer_put_cstring(r, "did not receive file descriptors"); return -1; } } debug3("%s: got fds stdin %d, stdout %d", __func__, new_fd[0], new_fd[1]); /* XXX support multiple child sessions in future */ if (c->remote_id != -1) { debug2("%s: session already open", __func__); /* prepare reply */ buffer_put_int(r, MUX_S_FAILURE); buffer_put_int(r, rid); buffer_put_cstring(r, "Multiple sessions not supported"); cleanup: close(new_fd[0]); close(new_fd[1]); free(chost); return 0; } if (options.control_master == SSHCTL_MASTER_ASK || options.control_master == SSHCTL_MASTER_AUTO_ASK) { if (!ask_permission("Allow forward to %s:%u? ", chost, cport)) { debug2("%s: stdio fwd refused by user", __func__); /* prepare reply */ buffer_put_int(r, MUX_S_PERMISSION_DENIED); buffer_put_int(r, rid); buffer_put_cstring(r, "Permission denied"); goto cleanup; } } /* enable nonblocking unless tty */ if (!isatty(new_fd[0])) set_nonblock(new_fd[0]); if (!isatty(new_fd[1])) set_nonblock(new_fd[1]); nc = channel_connect_stdio_fwd(chost, cport, new_fd[0], new_fd[1]); nc->ctl_chan = c->self; /* link session -> control channel */ c->remote_id = nc->self; /* link control -> session channel */ debug2("%s: channel_new: %d linked to control channel %d", __func__, nc->self, nc->ctl_chan); channel_register_cleanup(nc->self, mux_master_session_cleanup_cb, 1); cctx = xcalloc(1, sizeof(*cctx)); cctx->rid = rid; channel_register_open_confirm(nc->self, mux_stdio_confirm, cctx); c->mux_pause = 1; /* stop handling messages until open_confirm done */ /* reply is deferred, sent by mux_session_confirm */ return 0; }
12,086
47,734
0
static inline int netlink_allowed(const struct socket *sock, unsigned int flag) { return (nl_table[sock->sk->sk_protocol].flags & flag) || ns_capable(sock_net(sock->sk)->user_ns, CAP_NET_ADMIN); }
12,087
24,338
0
static void ieee80211_teardown_sdata(struct net_device *dev) { struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); struct ieee80211_local *local = sdata->local; int flushed; int i; /* free extra data */ ieee80211_free_keys(sdata); ieee80211_debugfs_remove_netdev(sdata); for (i = 0; i < IEEE80211_FRAGMENT_MAX; i++) __skb_queue_purge(&sdata->fragments[i].skb_list); sdata->fragment_next = 0; if (ieee80211_vif_is_mesh(&sdata->vif)) mesh_rmc_free(sdata); flushed = sta_info_flush(local, sdata); WARN_ON(flushed); }
12,088
36,500
0
int snd_ctl_replace(struct snd_card *card, struct snd_kcontrol *kcontrol, bool add_on_replace) { struct snd_ctl_elem_id id; unsigned int idx; struct snd_kcontrol *old; int ret; if (!kcontrol) return -EINVAL; if (snd_BUG_ON(!card || !kcontrol->info)) { ret = -EINVAL; goto error; } id = kcontrol->id; down_write(&card->controls_rwsem); old = snd_ctl_find_id(card, &id); if (!old) { if (add_on_replace) goto add; up_write(&card->controls_rwsem); ret = -EINVAL; goto error; } ret = snd_ctl_remove(card, old); if (ret < 0) { up_write(&card->controls_rwsem); goto error; } add: if (snd_ctl_find_hole(card, kcontrol->count) < 0) { up_write(&card->controls_rwsem); ret = -ENOMEM; goto error; } list_add_tail(&kcontrol->list, &card->controls); card->controls_count += kcontrol->count; kcontrol->id.numid = card->last_numid + 1; card->last_numid += kcontrol->count; up_write(&card->controls_rwsem); for (idx = 0; idx < kcontrol->count; idx++, id.index++, id.numid++) snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_ADD, &id); return 0; error: snd_ctl_free_one(kcontrol); return ret; }
12,089
140,100
0
void HTMLMediaElement::setMuted(bool muted) { BLINK_MEDIA_LOG << "setMuted(" << (void*)this << ", " << boolString(muted) << ")"; if (m_muted == muted) return; bool wasAutoplayingMuted = isAutoplayingMuted(); bool wasPendingAutoplayMuted = m_autoplayVisibilityObserver && paused() && m_muted && isLockedPendingUserGesture(); if (UserGestureIndicator::processingUserGesture()) unlockUserGesture(); m_muted = muted; scheduleEvent(EventTypeNames::volumechange); if (wasAutoplayingMuted) { if (isGestureNeededForPlayback()) { pause(); m_autoplayUmaHelper->recordAutoplayUnmuteStatus( AutoplayUnmuteActionStatus::Failure); } else { m_autoplayUmaHelper->recordAutoplayUnmuteStatus( AutoplayUnmuteActionStatus::Success); } } if (webMediaPlayer()) webMediaPlayer()->setVolume(effectiveMediaVolume()); if (wasPendingAutoplayMuted) { m_autoplayVisibilityObserver->stop(); m_autoplayVisibilityObserver = nullptr; } }
12,090
34,619
0
static void __sctp_unhash_established(struct sctp_association *asoc) { struct sctp_hashbucket *head; struct sctp_ep_common *epb; epb = &asoc->base; epb->hashent = sctp_assoc_hashfn(epb->bind_addr.port, asoc->peer.port); head = &sctp_assoc_hashtable[epb->hashent]; sctp_write_lock(&head->lock); __hlist_del(&epb->node); sctp_write_unlock(&head->lock); }
12,091
60,688
0
static int sctp_sendmsg(struct sock *sk, struct msghdr *msg, size_t msg_len) { struct net *net = sock_net(sk); struct sctp_sock *sp; struct sctp_endpoint *ep; struct sctp_association *new_asoc = NULL, *asoc = NULL; struct sctp_transport *transport, *chunk_tp; struct sctp_chunk *chunk; union sctp_addr to; struct sockaddr *msg_name = NULL; struct sctp_sndrcvinfo default_sinfo; struct sctp_sndrcvinfo *sinfo; struct sctp_initmsg *sinit; sctp_assoc_t associd = 0; struct sctp_cmsgs cmsgs = { NULL }; enum sctp_scope scope; bool fill_sinfo_ttl = false, wait_connect = false; struct sctp_datamsg *datamsg; int msg_flags = msg->msg_flags; __u16 sinfo_flags = 0; long timeo; int err; err = 0; sp = sctp_sk(sk); ep = sp->ep; pr_debug("%s: sk:%p, msg:%p, msg_len:%zu ep:%p\n", __func__, sk, msg, msg_len, ep); /* We cannot send a message over a TCP-style listening socket. */ if (sctp_style(sk, TCP) && sctp_sstate(sk, LISTENING)) { err = -EPIPE; goto out_nounlock; } /* Parse out the SCTP CMSGs. */ err = sctp_msghdr_parse(msg, &cmsgs); if (err) { pr_debug("%s: msghdr parse err:%x\n", __func__, err); goto out_nounlock; } /* Fetch the destination address for this packet. This * address only selects the association--it is not necessarily * the address we will send to. * For a peeled-off socket, msg_name is ignored. */ if (!sctp_style(sk, UDP_HIGH_BANDWIDTH) && msg->msg_name) { int msg_namelen = msg->msg_namelen; err = sctp_verify_addr(sk, (union sctp_addr *)msg->msg_name, msg_namelen); if (err) return err; if (msg_namelen > sizeof(to)) msg_namelen = sizeof(to); memcpy(&to, msg->msg_name, msg_namelen); msg_name = msg->msg_name; } sinit = cmsgs.init; if (cmsgs.sinfo != NULL) { memset(&default_sinfo, 0, sizeof(default_sinfo)); default_sinfo.sinfo_stream = cmsgs.sinfo->snd_sid; default_sinfo.sinfo_flags = cmsgs.sinfo->snd_flags; default_sinfo.sinfo_ppid = cmsgs.sinfo->snd_ppid; default_sinfo.sinfo_context = cmsgs.sinfo->snd_context; default_sinfo.sinfo_assoc_id = cmsgs.sinfo->snd_assoc_id; sinfo = &default_sinfo; fill_sinfo_ttl = true; } else { sinfo = cmsgs.srinfo; } /* Did the user specify SNDINFO/SNDRCVINFO? */ if (sinfo) { sinfo_flags = sinfo->sinfo_flags; associd = sinfo->sinfo_assoc_id; } pr_debug("%s: msg_len:%zu, sinfo_flags:0x%x\n", __func__, msg_len, sinfo_flags); /* SCTP_EOF or SCTP_ABORT cannot be set on a TCP-style socket. */ if (sctp_style(sk, TCP) && (sinfo_flags & (SCTP_EOF | SCTP_ABORT))) { err = -EINVAL; goto out_nounlock; } /* If SCTP_EOF is set, no data can be sent. Disallow sending zero * length messages when SCTP_EOF|SCTP_ABORT is not set. * If SCTP_ABORT is set, the message length could be non zero with * the msg_iov set to the user abort reason. */ if (((sinfo_flags & SCTP_EOF) && (msg_len > 0)) || (!(sinfo_flags & (SCTP_EOF|SCTP_ABORT)) && (msg_len == 0))) { err = -EINVAL; goto out_nounlock; } /* If SCTP_ADDR_OVER is set, there must be an address * specified in msg_name. */ if ((sinfo_flags & SCTP_ADDR_OVER) && (!msg->msg_name)) { err = -EINVAL; goto out_nounlock; } transport = NULL; pr_debug("%s: about to look up association\n", __func__); lock_sock(sk); /* If a msg_name has been specified, assume this is to be used. */ if (msg_name) { /* Look for a matching association on the endpoint. */ asoc = sctp_endpoint_lookup_assoc(ep, &to, &transport); /* If we could not find a matching association on the * endpoint, make sure that it is not a TCP-style * socket that already has an association or there is * no peeled-off association on another socket. */ if (!asoc && ((sctp_style(sk, TCP) && (sctp_sstate(sk, ESTABLISHED) || sctp_sstate(sk, CLOSING))) || sctp_endpoint_is_peeled_off(ep, &to))) { err = -EADDRNOTAVAIL; goto out_unlock; } } else { asoc = sctp_id2assoc(sk, associd); if (!asoc) { err = -EPIPE; goto out_unlock; } } if (asoc) { pr_debug("%s: just looked up association:%p\n", __func__, asoc); /* We cannot send a message on a TCP-style SCTP_SS_ESTABLISHED * socket that has an association in CLOSED state. This can * happen when an accepted socket has an association that is * already CLOSED. */ if (sctp_state(asoc, CLOSED) && sctp_style(sk, TCP)) { err = -EPIPE; goto out_unlock; } if (sinfo_flags & SCTP_EOF) { pr_debug("%s: shutting down association:%p\n", __func__, asoc); sctp_primitive_SHUTDOWN(net, asoc, NULL); err = 0; goto out_unlock; } if (sinfo_flags & SCTP_ABORT) { chunk = sctp_make_abort_user(asoc, msg, msg_len); if (!chunk) { err = -ENOMEM; goto out_unlock; } pr_debug("%s: aborting association:%p\n", __func__, asoc); sctp_primitive_ABORT(net, asoc, chunk); err = 0; goto out_unlock; } } /* Do we need to create the association? */ if (!asoc) { pr_debug("%s: there is no association yet\n", __func__); if (sinfo_flags & (SCTP_EOF | SCTP_ABORT)) { err = -EINVAL; goto out_unlock; } /* Check for invalid stream against the stream counts, * either the default or the user specified stream counts. */ if (sinfo) { if (!sinit || !sinit->sinit_num_ostreams) { /* Check against the defaults. */ if (sinfo->sinfo_stream >= sp->initmsg.sinit_num_ostreams) { err = -EINVAL; goto out_unlock; } } else { /* Check against the requested. */ if (sinfo->sinfo_stream >= sinit->sinit_num_ostreams) { err = -EINVAL; goto out_unlock; } } } /* * API 3.1.2 bind() - UDP Style Syntax * If a bind() or sctp_bindx() is not called prior to a * sendmsg() call that initiates a new association, the * system picks an ephemeral port and will choose an address * set equivalent to binding with a wildcard address. */ if (!ep->base.bind_addr.port) { if (sctp_autobind(sk)) { err = -EAGAIN; goto out_unlock; } } else { /* * If an unprivileged user inherits a one-to-many * style socket with open associations on a privileged * port, it MAY be permitted to accept new associations, * but it SHOULD NOT be permitted to open new * associations. */ if (ep->base.bind_addr.port < inet_prot_sock(net) && !ns_capable(net->user_ns, CAP_NET_BIND_SERVICE)) { err = -EACCES; goto out_unlock; } } scope = sctp_scope(&to); new_asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL); if (!new_asoc) { err = -ENOMEM; goto out_unlock; } asoc = new_asoc; err = sctp_assoc_set_bind_addr_from_ep(asoc, scope, GFP_KERNEL); if (err < 0) { err = -ENOMEM; goto out_free; } /* If the SCTP_INIT ancillary data is specified, set all * the association init values accordingly. */ if (sinit) { if (sinit->sinit_num_ostreams) { asoc->c.sinit_num_ostreams = sinit->sinit_num_ostreams; } if (sinit->sinit_max_instreams) { asoc->c.sinit_max_instreams = sinit->sinit_max_instreams; } if (sinit->sinit_max_attempts) { asoc->max_init_attempts = sinit->sinit_max_attempts; } if (sinit->sinit_max_init_timeo) { asoc->max_init_timeo = msecs_to_jiffies(sinit->sinit_max_init_timeo); } } /* Prime the peer's transport structures. */ transport = sctp_assoc_add_peer(asoc, &to, GFP_KERNEL, SCTP_UNKNOWN); if (!transport) { err = -ENOMEM; goto out_free; } } /* ASSERT: we have a valid association at this point. */ pr_debug("%s: we have a valid association\n", __func__); if (!sinfo) { /* If the user didn't specify SNDINFO/SNDRCVINFO, make up * one with some defaults. */ memset(&default_sinfo, 0, sizeof(default_sinfo)); default_sinfo.sinfo_stream = asoc->default_stream; default_sinfo.sinfo_flags = asoc->default_flags; default_sinfo.sinfo_ppid = asoc->default_ppid; default_sinfo.sinfo_context = asoc->default_context; default_sinfo.sinfo_timetolive = asoc->default_timetolive; default_sinfo.sinfo_assoc_id = sctp_assoc2id(asoc); sinfo = &default_sinfo; } else if (fill_sinfo_ttl) { /* In case SNDINFO was specified, we still need to fill * it with a default ttl from the assoc here. */ sinfo->sinfo_timetolive = asoc->default_timetolive; } /* API 7.1.7, the sndbuf size per association bounds the * maximum size of data that can be sent in a single send call. */ if (msg_len > sk->sk_sndbuf) { err = -EMSGSIZE; goto out_free; } if (asoc->pmtu_pending) sctp_assoc_pending_pmtu(asoc); /* If fragmentation is disabled and the message length exceeds the * association fragmentation point, return EMSGSIZE. The I-D * does not specify what this error is, but this looks like * a great fit. */ if (sctp_sk(sk)->disable_fragments && (msg_len > asoc->frag_point)) { err = -EMSGSIZE; goto out_free; } /* Check for invalid stream. */ if (sinfo->sinfo_stream >= asoc->stream.outcnt) { err = -EINVAL; goto out_free; } if (sctp_wspace(asoc) < msg_len) sctp_prsctp_prune(asoc, sinfo, msg_len - sctp_wspace(asoc)); timeo = sock_sndtimeo(sk, msg->msg_flags & MSG_DONTWAIT); if (!sctp_wspace(asoc)) { err = sctp_wait_for_sndbuf(asoc, &timeo, msg_len); if (err) goto out_free; } /* If an address is passed with the sendto/sendmsg call, it is used * to override the primary destination address in the TCP model, or * when SCTP_ADDR_OVER flag is set in the UDP model. */ if ((sctp_style(sk, TCP) && msg_name) || (sinfo_flags & SCTP_ADDR_OVER)) { chunk_tp = sctp_assoc_lookup_paddr(asoc, &to); if (!chunk_tp) { err = -EINVAL; goto out_free; } } else chunk_tp = NULL; /* Auto-connect, if we aren't connected already. */ if (sctp_state(asoc, CLOSED)) { err = sctp_primitive_ASSOCIATE(net, asoc, NULL); if (err < 0) goto out_free; wait_connect = true; pr_debug("%s: we associated primitively\n", __func__); } /* Break the message into multiple chunks of maximum size. */ datamsg = sctp_datamsg_from_user(asoc, sinfo, &msg->msg_iter); if (IS_ERR(datamsg)) { err = PTR_ERR(datamsg); goto out_free; } asoc->force_delay = !!(msg->msg_flags & MSG_MORE); /* Now send the (possibly) fragmented message. */ list_for_each_entry(chunk, &datamsg->chunks, frag_list) { sctp_chunk_hold(chunk); /* Do accounting for the write space. */ sctp_set_owner_w(chunk); chunk->transport = chunk_tp; } /* Send it to the lower layers. Note: all chunks * must either fail or succeed. The lower layer * works that way today. Keep it that way or this * breaks. */ err = sctp_primitive_SEND(net, asoc, datamsg); /* Did the lower layer accept the chunk? */ if (err) { sctp_datamsg_free(datamsg); goto out_free; } pr_debug("%s: we sent primitively\n", __func__); sctp_datamsg_put(datamsg); err = msg_len; if (unlikely(wait_connect)) { timeo = sock_sndtimeo(sk, msg_flags & MSG_DONTWAIT); sctp_wait_for_connect(asoc, &timeo); } /* If we are already past ASSOCIATE, the lower * layers are responsible for association cleanup. */ goto out_unlock; out_free: if (new_asoc) sctp_association_free(asoc); out_unlock: release_sock(sk); out_nounlock: return sctp_error(sk, msg_flags, err); #if 0 do_sock_err: if (msg_len) err = msg_len; else err = sock_error(sk); goto out; do_interrupted: if (msg_len) err = msg_len; goto out; #endif /* 0 */ }
12,092
10,969
0
PHP_FUNCTION(xml_parser_create_ns) { php_xml_parser_create_impl(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1); }
12,093
47,622
0
ap_queue_interruption_control(ap_qid_t qid, void *ind) { register unsigned long reg0 asm ("0") = qid | 0x03000000UL; register unsigned long reg1_in asm ("1") = 0x0000800000000000UL | AP_ISC; register struct ap_queue_status reg1_out asm ("1"); register void *reg2 asm ("2") = ind; asm volatile( ".long 0xb2af0000" /* PQAP(AQIC) */ : "+d" (reg0), "+d" (reg1_in), "=d" (reg1_out), "+d" (reg2) : : "cc" ); return reg1_out; }
12,094
164,623
0
void IndexedDBDatabase::DeleteRange( IndexedDBTransaction* transaction, int64_t object_store_id, std::unique_ptr<IndexedDBKeyRange> key_range, scoped_refptr<IndexedDBCallbacks> callbacks) { DCHECK(transaction); IDB_TRACE1("IndexedDBDatabase::DeleteRange", "txn.id", transaction->id()); DCHECK_NE(transaction->mode(), blink::mojom::IDBTransactionMode::ReadOnly); if (!ValidateObjectStoreId(object_store_id)) return; transaction->ScheduleTask( base::BindOnce(&IndexedDBDatabase::DeleteRangeOperation, this, object_store_id, std::move(key_range), callbacks)); }
12,095
28,421
0
static __inline__ u32 fib6_new_sernum(void) { u32 n = ++rt_sernum; if ((__s32)n <= 0) rt_sernum = n = 1; return n; }
12,096
116,364
0
void RangeTransactionServer::RangeHandler(const net::HttpRequestInfo* request, std::string* response_status, std::string* response_headers, std::string* response_data) { if (request->extra_headers.IsEmpty()) { response_status->assign("HTTP/1.1 416 Requested Range Not Satisfiable"); response_data->clear(); return; } EXPECT_TRUE(request->extra_headers.HasHeader(kExtraHeaderKey)); if (not_modified_) { response_status->assign("HTTP/1.1 304 Not Modified"); response_data->clear(); return; } std::vector<net::HttpByteRange> ranges; std::string range_header; if (!request->extra_headers.GetHeader( net::HttpRequestHeaders::kRange, &range_header) || !net::HttpUtil::ParseRangeHeader(range_header, &ranges) || bad_200_ || ranges.size() != 1) { response_status->assign("HTTP/1.1 200 OK"); response_headers->assign("Date: Wed, 28 Nov 2007 09:40:09 GMT"); response_data->assign("Not a range"); return; } net::HttpByteRange byte_range = ranges[0]; if (byte_range.first_byte_position() > 79) { response_status->assign("HTTP/1.1 416 Requested Range Not Satisfiable"); response_data->clear(); return; } EXPECT_TRUE(byte_range.ComputeBounds(80)); int start = static_cast<int>(byte_range.first_byte_position()); int end = static_cast<int>(byte_range.last_byte_position()); EXPECT_LT(end, 80); std::string content_range = base::StringPrintf( "Content-Range: bytes %d-%d/80\n", start, end); response_headers->append(content_range); if (!request->extra_headers.HasHeader("If-None-Match") || modified_) { std::string data; if (end == start) { EXPECT_EQ(0, end % 10); data = "r"; } else { EXPECT_EQ(9, (end - start) % 10); for (int block_start = start; block_start < end; block_start += 10) { base::StringAppendF(&data, "rg: %02d-%02d ", block_start, block_start + 9); } } *response_data = data; if (end - start != 9) { int len = end - start + 1; std::string content_length = base::StringPrintf("Content-Length: %d\n", len); response_headers->replace(response_headers->find("Content-Length:"), content_length.size(), content_length); } } else { response_status->assign("HTTP/1.1 304 Not Modified"); response_data->clear(); } }
12,097
58,010
0
static int nft_ctx_init_from_setattr(struct nft_ctx *ctx, const struct sk_buff *skb, const struct nlmsghdr *nlh, const struct nlattr * const nla[]) { struct net *net = sock_net(skb->sk); const struct nfgenmsg *nfmsg = nlmsg_data(nlh); struct nft_af_info *afi = NULL; struct nft_table *table = NULL; if (nfmsg->nfgen_family != NFPROTO_UNSPEC) { afi = nf_tables_afinfo_lookup(net, nfmsg->nfgen_family, false); if (IS_ERR(afi)) return PTR_ERR(afi); } if (nla[NFTA_SET_TABLE] != NULL) { if (afi == NULL) return -EAFNOSUPPORT; table = nf_tables_table_lookup(afi, nla[NFTA_SET_TABLE]); if (IS_ERR(table)) return PTR_ERR(table); if (table->flags & NFT_TABLE_INACTIVE) return -ENOENT; } nft_ctx_init(ctx, skb, nlh, afi, table, NULL, nla); return 0; }
12,098
112,538
0
void Document::resetActiveLinkColor() { m_activeLinkColor.setNamedColor("red"); }
12,099