unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
111,753
0
void FlagsState::ConvertFlagsToSwitches( PrefService* prefs, CommandLine* command_line) { if (command_line->HasSwitch(switches::kNoExperiments)) return; std::set<std::string> enabled_experiments; GetSanitizedEnabledFlagsForCurrentPlatform(prefs, &enabled_experiments); typedef std::map<std::string, std::pair<std::string, std::string> > NameToSwitchAndValueMap; NameToSwitchAndValueMap name_to_switch_map; for (size_t i = 0; i < num_experiments; ++i) { const Experiment& e = experiments[i]; if (e.type == Experiment::SINGLE_VALUE) { name_to_switch_map[e.internal_name] = std::pair<std::string, std::string>(e.command_line_switch, e.command_line_value); } else { for (int j = 0; j < e.num_choices; ++j) name_to_switch_map[NameForChoice(e, j)] = std::pair<std::string, std::string>( e.choices[j].command_line_switch, e.choices[j].command_line_value); } } command_line->AppendSwitch(switches::kFlagSwitchesBegin); flags_switches_.insert( std::pair<std::string, std::string>(switches::kFlagSwitchesBegin, std::string())); for (std::set<std::string>::iterator it = enabled_experiments.begin(); it != enabled_experiments.end(); ++it) { const std::string& experiment_name = *it; NameToSwitchAndValueMap::const_iterator name_to_switch_it = name_to_switch_map.find(experiment_name); if (name_to_switch_it == name_to_switch_map.end()) { NOTREACHED(); continue; } const std::pair<std::string, std::string>& switch_and_value_pair = name_to_switch_it->second; command_line->AppendSwitchASCII(switch_and_value_pair.first, switch_and_value_pair.second); flags_switches_[switch_and_value_pair.first] = switch_and_value_pair.second; } command_line->AppendSwitch(switches::kFlagSwitchesEnd); flags_switches_.insert( std::pair<std::string, std::string>(switches::kFlagSwitchesEnd, std::string())); }
11,200
135,148
0
const KURL& Document::baseURLForOverride(const KURL& baseURLOverride) const { const KURL* baseURLFromParent = 0; bool shouldUseParentBaseURL = baseURLOverride.isEmpty(); if (!shouldUseParentBaseURL) { const KURL& aboutBlankURL = blankURL(); shouldUseParentBaseURL = (baseURLOverride == aboutBlankURL); } if (shouldUseParentBaseURL) { if (Document* parent = parentDocument()) baseURLFromParent = &parent->baseURL(); } return baseURLFromParent ? *baseURLFromParent : baseURLOverride; }
11,201
152,353
0
PreviewsState RenderFrameImpl::GetPreviewsState() { return previews_state_; }
11,202
35,606
0
static bool vendor_intel(struct x86_emulate_ctxt *ctxt) { u32 eax, ebx, ecx, edx; eax = ecx = 0; ctxt->ops->get_cpuid(ctxt, &eax, &ebx, &ecx, &edx); return ebx == X86EMUL_CPUID_VENDOR_GenuineIntel_ebx && ecx == X86EMUL_CPUID_VENDOR_GenuineIntel_ecx && edx == X86EMUL_CPUID_VENDOR_GenuineIntel_edx; }
11,203
132,138
0
LayoutBlockFlow::~LayoutBlockFlow() { }
11,204
42,952
0
static void sctp_v4_to_sk_daddr(union sctp_addr *addr, struct sock *sk) { inet_sk(sk)->inet_daddr = addr->v4.sin_addr.s_addr; }
11,205
155,759
0
void UpdateCachedToken(const std::string& token, const base::TimeDelta& ttl) { last_token_ = token; last_token_expiry_ = host_->clock_->Now() + ttl; }
11,206
187,616
1
freeimage(Image *image) { freebuffer(image); png_image_free(&image->image); if (image->input_file != NULL) { fclose(image->input_file); image->input_file = NULL; } if (image->input_memory != NULL) { free(image->input_memory); image->input_memory = NULL; image->input_memory_size = 0; } if (image->tmpfile_name[0] != 0 && (image->opts & KEEP_TMPFILES) == 0) { remove(image->tmpfile_name); image->tmpfile_name[0] = 0; } }
11,207
35,876
0
struct sctp_chunk *sctp_make_shutdown_ack(const struct sctp_association *asoc, const struct sctp_chunk *chunk) { struct sctp_chunk *retval; retval = sctp_make_control(asoc, SCTP_CID_SHUTDOWN_ACK, 0, 0); /* RFC 2960 6.4 Multi-homed SCTP Endpoints * * An endpoint SHOULD transmit reply chunks (e.g., SACK, * HEARTBEAT ACK, * etc.) to the same destination transport * address from which it * received the DATA or control chunk * to which it is replying. * * [ACK back to where the SHUTDOWN came from.] */ if (retval && chunk) retval->transport = chunk->transport; return retval; }
11,208
19,827
0
static int _nfs4_proc_mknod(struct inode *dir, struct dentry *dentry, struct iattr *sattr, dev_t rdev) { struct nfs4_createdata *data; int mode = sattr->ia_mode; int status = -ENOMEM; BUG_ON(!(sattr->ia_valid & ATTR_MODE)); BUG_ON(!S_ISFIFO(mode) && !S_ISBLK(mode) && !S_ISCHR(mode) && !S_ISSOCK(mode)); data = nfs4_alloc_createdata(dir, &dentry->d_name, sattr, NF4SOCK); if (data == NULL) goto out; if (S_ISFIFO(mode)) data->arg.ftype = NF4FIFO; else if (S_ISBLK(mode)) { data->arg.ftype = NF4BLK; data->arg.u.device.specdata1 = MAJOR(rdev); data->arg.u.device.specdata2 = MINOR(rdev); } else if (S_ISCHR(mode)) { data->arg.ftype = NF4CHR; data->arg.u.device.specdata1 = MAJOR(rdev); data->arg.u.device.specdata2 = MINOR(rdev); } status = nfs4_do_create(dir, dentry, data); nfs4_free_createdata(data); out: return status; }
11,209
181,283
1
int dns_packet_is_reply_for(DnsPacket *p, const DnsResourceKey *key) { int r; assert(p); assert(key); /* Checks if the specified packet is a reply for the specified * key and the specified key is the only one in the question * section. */ if (DNS_PACKET_QR(p) != 1) return 0; /* Let's unpack the packet, if that hasn't happened yet. */ r = dns_packet_extract(p); if (r < 0) return r; if (p->question->n_keys != 1) return 0; return dns_resource_key_equal(p->question->keys[0], key); }
11,210
56,327
0
static double filter_hamming(const double x) { /* should be (0.54+0.46*cos(M_PI*(double) x)); but this approximation is sufficient */ if (x < -1.0f) return 0.0f; if (x < 0.0f) return 0.92f*(-2.0f*x-3.0f)*x*x+1.0f; if (x < 1.0f) return 0.92f*(2.0f*x-3.0f)*x*x+1.0f; return 0.0f; }
11,211
149,038
0
static void cacheEntryClear(Parse *pParse, int i){ if( pParse->aColCache[i].tempReg ){ if( pParse->nTempReg<ArraySize(pParse->aTempReg) ){ pParse->aTempReg[pParse->nTempReg++] = pParse->aColCache[i].iReg; } } pParse->nColCache--; if( i<pParse->nColCache ){ pParse->aColCache[i] = pParse->aColCache[pParse->nColCache]; } }
11,212
132,978
0
void RenderWidgetHostViewAura::OnAcceleratedCompositingStateChange() { accelerated_compositing_state_changed_ = true; }
11,213
113,471
0
InputMethodIBus::~InputMethodIBus() { AbandonAllPendingKeyEvents(); DestroyContext(); g_signal_handlers_disconnect_by_func( GetBus(), reinterpret_cast<gpointer>(OnIBusConnectedThunk), this); g_signal_handlers_disconnect_by_func( GetBus(), reinterpret_cast<gpointer>(OnIBusDisconnectedThunk), this); }
11,214
86,294
0
static void ops_free_list(const struct pernet_operations *ops, struct list_head *net_exit_list) { struct net *net; if (ops->size && ops->id) { list_for_each_entry(net, net_exit_list, exit_list) ops_free(ops, net); } }
11,215
143,429
0
static void handleMetaNameAttribute(const Token& token, CachedDocumentParameters* documentParameters, MediaValuesCached* mediaValues, CSSPreloadScanner* cssScanner, ViewportDescriptionWrapper* viewport) { const typename Token::Attribute* nameAttribute = token.getAttributeItem(nameAttr); if (!nameAttribute) return; String nameAttributeValue(nameAttribute->value()); const typename Token::Attribute* contentAttribute = token.getAttributeItem(contentAttr); if (!contentAttribute) return; String contentAttributeValue(contentAttribute->value()); if (equalIgnoringCase(nameAttributeValue, "viewport")) { handleMetaViewport(contentAttributeValue, documentParameters, mediaValues, viewport); return; } if (equalIgnoringCase(nameAttributeValue, "referrer")) { handleMetaReferrer(contentAttributeValue, documentParameters, cssScanner); } }
11,216
72,325
0
server_init_dispatch(void) { debug("server_init_dispatch"); dispatch_init(&dispatch_protocol_error); dispatch_set(SSH2_MSG_CHANNEL_CLOSE, &channel_input_oclose); dispatch_set(SSH2_MSG_CHANNEL_DATA, &channel_input_data); dispatch_set(SSH2_MSG_CHANNEL_EOF, &channel_input_ieof); dispatch_set(SSH2_MSG_CHANNEL_EXTENDED_DATA, &channel_input_extended_data); dispatch_set(SSH2_MSG_CHANNEL_OPEN, &server_input_channel_open); dispatch_set(SSH2_MSG_CHANNEL_OPEN_CONFIRMATION, &channel_input_open_confirmation); dispatch_set(SSH2_MSG_CHANNEL_OPEN_FAILURE, &channel_input_open_failure); dispatch_set(SSH2_MSG_CHANNEL_REQUEST, &server_input_channel_req); dispatch_set(SSH2_MSG_CHANNEL_WINDOW_ADJUST, &channel_input_window_adjust); dispatch_set(SSH2_MSG_GLOBAL_REQUEST, &server_input_global_request); /* client_alive */ dispatch_set(SSH2_MSG_CHANNEL_SUCCESS, &server_input_keep_alive); dispatch_set(SSH2_MSG_CHANNEL_FAILURE, &server_input_keep_alive); dispatch_set(SSH2_MSG_REQUEST_SUCCESS, &server_input_keep_alive); dispatch_set(SSH2_MSG_REQUEST_FAILURE, &server_input_keep_alive); /* rekeying */ dispatch_set(SSH2_MSG_KEXINIT, &kex_input_kexinit); }
11,217
173,026
0
main(void) { fprintf(stderr, "pngimage: no support for png_read/write_image\n"); return 77; }
11,218
53,834
0
acpi_os_create_cache(char *name, u16 size, u16 depth, acpi_cache_t ** cache) { *cache = kmem_cache_create(name, size, 0, 0, NULL); if (*cache == NULL) return AE_ERROR; else return AE_OK; }
11,219
120,299
0
void FolderHeaderView::OnFolderItemRemoved() { folder_item_ = NULL; }
11,220
143,126
0
static void assertLayoutTreeUpdated(Node& root) { for (Node& node : NodeTraversal::inclusiveDescendantsOf(root)) { if (!node.isElementNode() && !node.isTextNode() && !node.isShadowRoot() && !node.isDocumentNode()) continue; DCHECK(!node.needsStyleRecalc()); DCHECK(!node.childNeedsStyleRecalc()); DCHECK(!node.childNeedsDistributionRecalc()); DCHECK(!node.needsStyleInvalidation()); DCHECK(!node.childNeedsStyleInvalidation()); for (ShadowRoot* shadowRoot = node.youngestShadowRoot(); shadowRoot; shadowRoot = shadowRoot->olderShadowRoot()) assertLayoutTreeUpdated(*shadowRoot); } }
11,221
185,978
1
v8::Local<v8::Value> V8Debugger::functionLocation(v8::Local<v8::Context> context, v8::Local<v8::Function> function) { int scriptId = function->ScriptId(); if (scriptId == v8::UnboundScript::kNoScriptId) return v8::Null(m_isolate); int lineNumber = function->GetScriptLineNumber(); int columnNumber = function->GetScriptColumnNumber(); if (lineNumber == v8::Function::kLineOffsetNotFound || columnNumber == v8::Function::kLineOffsetNotFound) return v8::Null(m_isolate); v8::Local<v8::Object> location = v8::Object::New(m_isolate); if (!location->Set(context, toV8StringInternalized(m_isolate, "scriptId"), toV8String(m_isolate, String16::fromInteger(scriptId))).FromMaybe(false)) return v8::Null(m_isolate); if (!location->Set(context, toV8StringInternalized(m_isolate, "lineNumber"), v8::Integer::New(m_isolate, lineNumber)).FromMaybe(false)) return v8::Null(m_isolate); if (!location->Set(context, toV8StringInternalized(m_isolate, "columnNumber"), v8::Integer::New(m_isolate, columnNumber)).FromMaybe(false)) return v8::Null(m_isolate); if (!markAsInternal(context, location, V8InternalValueType::kLocation)) return v8::Null(m_isolate); return location; }
11,222
46,306
0
static void __setattr_copy(struct inode *inode, const struct iattr *attr) { struct f2fs_inode_info *fi = F2FS_I(inode); unsigned int ia_valid = attr->ia_valid; if (ia_valid & ATTR_UID) inode->i_uid = attr->ia_uid; if (ia_valid & ATTR_GID) inode->i_gid = attr->ia_gid; if (ia_valid & ATTR_ATIME) inode->i_atime = timespec_trunc(attr->ia_atime, inode->i_sb->s_time_gran); if (ia_valid & ATTR_MTIME) inode->i_mtime = timespec_trunc(attr->ia_mtime, inode->i_sb->s_time_gran); if (ia_valid & ATTR_CTIME) inode->i_ctime = timespec_trunc(attr->ia_ctime, inode->i_sb->s_time_gran); if (ia_valid & ATTR_MODE) { umode_t mode = attr->ia_mode; if (!in_group_p(inode->i_gid) && !capable(CAP_FSETID)) mode &= ~S_ISGID; set_acl_inode(fi, mode); } }
11,223
26,758
0
static int nl80211_send_station(struct sk_buff *msg, u32 pid, u32 seq, int flags, struct net_device *dev, const u8 *mac_addr, struct station_info *sinfo) { void *hdr; struct nlattr *sinfoattr, *bss_param; hdr = nl80211hdr_put(msg, pid, seq, flags, NL80211_CMD_NEW_STATION); if (!hdr) return -1; NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, dev->ifindex); NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, mac_addr); NLA_PUT_U32(msg, NL80211_ATTR_GENERATION, sinfo->generation); sinfoattr = nla_nest_start(msg, NL80211_ATTR_STA_INFO); if (!sinfoattr) goto nla_put_failure; if (sinfo->filled & STATION_INFO_CONNECTED_TIME) NLA_PUT_U32(msg, NL80211_STA_INFO_CONNECTED_TIME, sinfo->connected_time); if (sinfo->filled & STATION_INFO_INACTIVE_TIME) NLA_PUT_U32(msg, NL80211_STA_INFO_INACTIVE_TIME, sinfo->inactive_time); if (sinfo->filled & STATION_INFO_RX_BYTES) NLA_PUT_U32(msg, NL80211_STA_INFO_RX_BYTES, sinfo->rx_bytes); if (sinfo->filled & STATION_INFO_TX_BYTES) NLA_PUT_U32(msg, NL80211_STA_INFO_TX_BYTES, sinfo->tx_bytes); if (sinfo->filled & STATION_INFO_LLID) NLA_PUT_U16(msg, NL80211_STA_INFO_LLID, sinfo->llid); if (sinfo->filled & STATION_INFO_PLID) NLA_PUT_U16(msg, NL80211_STA_INFO_PLID, sinfo->plid); if (sinfo->filled & STATION_INFO_PLINK_STATE) NLA_PUT_U8(msg, NL80211_STA_INFO_PLINK_STATE, sinfo->plink_state); if (sinfo->filled & STATION_INFO_SIGNAL) NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL, sinfo->signal); if (sinfo->filled & STATION_INFO_SIGNAL_AVG) NLA_PUT_U8(msg, NL80211_STA_INFO_SIGNAL_AVG, sinfo->signal_avg); if (sinfo->filled & STATION_INFO_TX_BITRATE) { if (!nl80211_put_sta_rate(msg, &sinfo->txrate, NL80211_STA_INFO_TX_BITRATE)) goto nla_put_failure; } if (sinfo->filled & STATION_INFO_RX_BITRATE) { if (!nl80211_put_sta_rate(msg, &sinfo->rxrate, NL80211_STA_INFO_RX_BITRATE)) goto nla_put_failure; } if (sinfo->filled & STATION_INFO_RX_PACKETS) NLA_PUT_U32(msg, NL80211_STA_INFO_RX_PACKETS, sinfo->rx_packets); if (sinfo->filled & STATION_INFO_TX_PACKETS) NLA_PUT_U32(msg, NL80211_STA_INFO_TX_PACKETS, sinfo->tx_packets); if (sinfo->filled & STATION_INFO_TX_RETRIES) NLA_PUT_U32(msg, NL80211_STA_INFO_TX_RETRIES, sinfo->tx_retries); if (sinfo->filled & STATION_INFO_TX_FAILED) NLA_PUT_U32(msg, NL80211_STA_INFO_TX_FAILED, sinfo->tx_failed); if (sinfo->filled & STATION_INFO_BSS_PARAM) { bss_param = nla_nest_start(msg, NL80211_STA_INFO_BSS_PARAM); if (!bss_param) goto nla_put_failure; if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_CTS_PROT) NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_CTS_PROT); if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_PREAMBLE) NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_SHORT_PREAMBLE); if (sinfo->bss_param.flags & BSS_PARAM_FLAGS_SHORT_SLOT_TIME) NLA_PUT_FLAG(msg, NL80211_STA_BSS_PARAM_SHORT_SLOT_TIME); NLA_PUT_U8(msg, NL80211_STA_BSS_PARAM_DTIM_PERIOD, sinfo->bss_param.dtim_period); NLA_PUT_U16(msg, NL80211_STA_BSS_PARAM_BEACON_INTERVAL, sinfo->bss_param.beacon_interval); nla_nest_end(msg, bss_param); } nla_nest_end(msg, sinfoattr); return genlmsg_end(msg, hdr); nla_put_failure: genlmsg_cancel(msg, hdr); return -EMSGSIZE; }
11,224
186,285
1
void SkiaOutputSurfaceImpl::Reshape(const gfx::Size& size, float device_scale_factor, const gfx::ColorSpace& color_space, bool has_alpha, bool use_stencil) { DCHECK_CALLED_ON_VALID_THREAD(thread_checker_); if (initialize_waitable_event_) { initialize_waitable_event_->Wait(); initialize_waitable_event_ = nullptr; } SkSurfaceCharacterization* characterization = nullptr; if (characterization_.isValid()) { // TODO(weiliang): support color space. https://crbug.com/795132 characterization_ = characterization_.createResized(size.width(), size.height()); RecreateRootRecorder(); } else { characterization = &characterization_; initialize_waitable_event_ = std::make_unique<base::WaitableEvent>( base::WaitableEvent::ResetPolicy::MANUAL, base::WaitableEvent::InitialState::NOT_SIGNALED); } // impl_on_gpu_ is released on the GPU thread by a posted task from // SkiaOutputSurfaceImpl::dtor. So it is safe to use base::Unretained. auto callback = base::BindOnce( &SkiaOutputSurfaceImplOnGpu::Reshape, base::Unretained(impl_on_gpu_.get()), size, device_scale_factor, std::move(color_space), has_alpha, use_stencil, pre_transform_, characterization, initialize_waitable_event_.get()); ScheduleGpuTask(std::move(callback), std::vector<gpu::SyncToken>()); }
11,225
131,649
0
static void readonlyWindowAttributeAttributeGetterCallback(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); TestObjectPythonV8Internal::readonlyWindowAttributeAttributeGetter(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
11,226
118,525
0
blink::WebHistoryItem RenderFrameImpl::historyItemForNewChildFrame( blink::WebFrame* frame) { DCHECK(!frame_ || frame_ == frame); return render_view_->history_controller()->GetItemForNewChildFrame(this); }
11,227
34,919
0
static void rpc_show_header(void) { printk(KERN_INFO "-pid- flgs status -client- --rqstp- " "-timeout ---ops--\n"); }
11,228
2,022
0
static time_t asn1_time_to_time_t(ASN1_UTCTIME * timestr TSRMLS_DC) /* {{{ */ { /* This is how the time string is formatted: snprintf(p, sizeof(p), "%02d%02d%02d%02d%02d%02dZ",ts->tm_year%100, ts->tm_mon+1,ts->tm_mday,ts->tm_hour,ts->tm_min,ts->tm_sec); */ time_t ret; struct tm thetime; char * strbuf; char * thestr; long gmadjust = 0; if (timestr->length < 13) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "extension author too lazy to parse %s correctly", timestr->data); return (time_t)-1; } strbuf = estrdup((char *)timestr->data); memset(&thetime, 0, sizeof(thetime)); /* we work backwards so that we can use atoi more easily */ thestr = strbuf + timestr->length - 3; thetime.tm_sec = atoi(thestr); *thestr = '\0'; thestr -= 2; thetime.tm_min = atoi(thestr); *thestr = '\0'; thestr -= 2; thetime.tm_hour = atoi(thestr); *thestr = '\0'; thestr -= 2; thetime.tm_mday = atoi(thestr); *thestr = '\0'; thestr -= 2; thetime.tm_mon = atoi(thestr)-1; *thestr = '\0'; thestr -= 2; thetime.tm_year = atoi(thestr); if (thetime.tm_year < 68) { thetime.tm_year += 100; } thetime.tm_isdst = -1; ret = mktime(&thetime); #if HAVE_TM_GMTOFF gmadjust = thetime.tm_gmtoff; #else /* ** If correcting for daylight savings time, we set the adjustment to ** the value of timezone - 3600 seconds. Otherwise, we need to overcorrect and ** set the adjustment to the main timezone + 3600 seconds. */ gmadjust = -(thetime.tm_isdst ? (long)timezone - 3600 : (long)timezone + 3600); #endif ret += gmadjust; efree(strbuf); return ret; } /* }}} */
11,229
18,062
0
jbig2_decode_mmr_consume(Jbig2MmrCtx *mmr, int n_bits) { mmr->word <<= n_bits; mmr->bit_index += n_bits; while (mmr->bit_index >= 8) { mmr->bit_index -= 8; if (mmr->data_index + 4 < mmr->size) mmr->word |= (mmr->data[mmr->data_index + 4] << mmr->bit_index); mmr->data_index++; } }
11,230
43,692
0
inline struct dentry *user_path_create(int dfd, const char __user *pathname, struct path *path, unsigned int lookup_flags) { return filename_create(dfd, getname(pathname), path, lookup_flags); }
11,231
78,762
0
static void muscle_load_single_acl(sc_file_t* file, int operation, unsigned short acl) { int key; /* Everybody by default.... */ sc_file_add_acl_entry(file, operation, SC_AC_NONE, 0); if(acl == 0xFFFF) { sc_file_add_acl_entry(file, operation, SC_AC_NEVER, 0); return; } for(key = 0; key < 16; key++) { if(acl >> key & 1) { sc_file_add_acl_entry(file, operation, SC_AC_CHV, key); } } }
11,232
74,833
0
static int mxf_get_next_track_edit_unit(MXFContext *mxf, MXFTrack *track, int64_t current_offset, int64_t *edit_unit_out) { int64_t a, b, m, offset; MXFIndexTable *t = mxf_find_index_table(mxf, track->index_sid); if (!t || track->original_duration <= 0) return -1; a = -1; b = track->original_duration; while (b - a > 1) { m = (a + b) >> 1; if (mxf_edit_unit_absolute_offset(mxf, t, m, track->edit_rate, NULL, &offset, NULL, 0) < 0) return -1; if (offset < current_offset) a = m; else b = m; } *edit_unit_out = b; return 0; }
11,233
186,610
1
bool BaseAudioContext::WouldTaintOrigin(const KURL& url) const { // Data URLs don't taint the origin. if (url.ProtocolIsData()) { return false; } Document* document = GetDocument(); if (document && document->GetSecurityOrigin()) { // The origin is tainted if and only if we cannot read content from the URL. return !document->GetSecurityOrigin()->CanRequest(url); } // Be conservative and assume it's tainted if it's not a data url and if we // can't get the security origin of the document. return true; }
11,234
92,406
0
int reset_terminal(const char *name) { _cleanup_close_ int fd = -1; /* We open the terminal with O_NONBLOCK here, to ensure we * don't block on carrier if this is a terminal with carrier * configured. */ fd = open_terminal(name, O_RDWR|O_NOCTTY|O_CLOEXEC|O_NONBLOCK); if (fd < 0) return fd; return reset_terminal_fd(fd, true); }
11,235
178,011
1
void ide_dma_cb(void *opaque, int ret) { IDEState *s = opaque; int n; int64_t sector_num; bool stay_active = false; if (ret == -ECANCELED) { return; } if (ret < 0) { int op = IDE_RETRY_DMA; if (s->dma_cmd == IDE_DMA_READ) op |= IDE_RETRY_READ; else if (s->dma_cmd == IDE_DMA_TRIM) op |= IDE_RETRY_TRIM; if (ide_handle_rw_error(s, -ret, op)) { return; } } n = s->io_buffer_size >> 9; if (n > s->nsector) { /* The PRDs were longer than needed for this request. Shorten them so * we don't get a negative remainder. The Active bit must remain set * after the request completes. */ n = s->nsector; stay_active = true; } sector_num = ide_get_sector(s); if (n > 0) { assert(s->io_buffer_size == s->sg.size); dma_buf_commit(s, s->io_buffer_size); sector_num += n; ide_set_sector(s, sector_num); s->nsector -= n; } /* end of transfer ? */ if (s->nsector == 0) { s->status = READY_STAT | SEEK_STAT; ide_set_irq(s->bus); goto eot; } /* launch next transfer */ n = s->nsector; s->io_buffer_index = 0; s->io_buffer_size = n * 512; if (s->bus->dma->ops->prepare_buf(s->bus->dma, ide_cmd_is_read(s)) == 0) { /* The PRDs were too short. Reset the Active bit, but don't raise an * interrupt. */ s->status = READY_STAT | SEEK_STAT; goto eot; } printf("ide_dma_cb: sector_num=%" PRId64 " n=%d, cmd_cmd=%d\n", sector_num, n, s->dma_cmd); #endif if ((s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) && !ide_sect_range_ok(s, sector_num, n)) { ide_dma_error(s); return; } switch (s->dma_cmd) { case IDE_DMA_READ: s->bus->dma->aiocb = dma_blk_read(s->blk, &s->sg, sector_num, ide_dma_cb, s); break; case IDE_DMA_WRITE: s->bus->dma->aiocb = dma_blk_write(s->blk, &s->sg, sector_num, ide_dma_cb, s); break; case IDE_DMA_TRIM: s->bus->dma->aiocb = dma_blk_io(s->blk, &s->sg, sector_num, ide_issue_trim, ide_dma_cb, s, DMA_DIRECTION_TO_DEVICE); break; } return; eot: if (s->dma_cmd == IDE_DMA_READ || s->dma_cmd == IDE_DMA_WRITE) { block_acct_done(blk_get_stats(s->blk), &s->acct); } ide_set_inactive(s, stay_active); }
11,236
73,136
0
CHUNK_REMAINING_CAPACITY(const chunk_t *chunk) { return (chunk->mem + chunk->memlen) - (chunk->data + chunk->datalen); }
11,237
103,874
0
void RenderView::didChangeIcon(WebFrame* frame, WebIconURL::Type type) { FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidChangeIcon(frame, type)); }
11,238
83,095
0
static void WritePixel(struct ngiflib_img * i, struct ngiflib_decode_context * context, u8 v) { struct ngiflib_gif * p = i->parent; if(v!=i->gce.transparent_color || !i->gce.transparent_flag) { #ifndef NGIFLIB_INDEXED_ONLY if(p->mode & NGIFLIB_MODE_INDEXED) { #endif /* NGIFLIB_INDEXED_ONLY */ *context->frbuff_p.p8 = v; #ifndef NGIFLIB_INDEXED_ONLY } else *context->frbuff_p.p32 = GifIndexToTrueColor(i->palette, v); #endif /* NGIFLIB_INDEXED_ONLY */ } if(--(context->Xtogo) <= 0) { #ifdef NGIFLIB_ENABLE_CALLBACKS if(p->line_cb) p->line_cb(p, context->line_p, context->curY); #endif /* NGIFLIB_ENABLE_CALLBACKS */ context->Xtogo = i->width; switch(context->pass) { case 0: context->curY++; break; case 1: /* 1st pass : every eighth row starting from 0 */ context->curY += 8; if(context->curY >= p->height) { context->pass++; context->curY = i->posY + 4; } break; case 2: /* 2nd pass : every eighth row starting from 4 */ context->curY += 8; if(context->curY >= p->height) { context->pass++; context->curY = i->posY + 2; } break; case 3: /* 3rd pass : every fourth row starting from 2 */ context->curY += 4; if(context->curY >= p->height) { context->pass++; context->curY = i->posY + 1; } break; case 4: /* 4th pass : every odd row */ context->curY += 2; break; } #ifndef NGIFLIB_INDEXED_ONLY if(p->mode & NGIFLIB_MODE_INDEXED) { #endif /* NGIFLIB_INDEXED_ONLY */ #ifdef NGIFLIB_ENABLE_CALLBACKS context->line_p.p8 = p->frbuff.p8 + (u32)context->curY*p->width; context->frbuff_p.p8 = context->line_p.p8 + i->posX; #else context->frbuff_p.p8 = p->frbuff.p8 + (u32)context->curY*p->width + i->posX; #endif /* NGIFLIB_ENABLE_CALLBACKS */ #ifndef NGIFLIB_INDEXED_ONLY } else { #ifdef NGIFLIB_ENABLE_CALLBACKS context->line_p.p32 = p->frbuff.p32 + (u32)context->curY*p->width; context->frbuff_p.p32 = context->line_p.p32 + i->posX; #else context->frbuff_p.p32 = p->frbuff.p32 + (u32)context->curY*p->width + i->posX; #endif /* NGIFLIB_ENABLE_CALLBACKS */ } #endif /* NGIFLIB_INDEXED_ONLY */ } else { #ifndef NGIFLIB_INDEXED_ONLY if(p->mode & NGIFLIB_MODE_INDEXED) { #endif /* NGIFLIB_INDEXED_ONLY */ context->frbuff_p.p8++; #ifndef NGIFLIB_INDEXED_ONLY } else { context->frbuff_p.p32++; } #endif /* NGIFLIB_INDEXED_ONLY */ } }
11,239
46,796
0
static int sha224_sparc64_final(struct shash_desc *desc, u8 *hash) { u8 D[SHA256_DIGEST_SIZE]; sha256_sparc64_final(desc, D); memcpy(hash, D, SHA224_DIGEST_SIZE); memset(D, 0, SHA256_DIGEST_SIZE); return 0; }
11,240
119,503
0
virtual void TearDown() { Platform::current()->unitTestSupport()->unregisterAllMockedURLs(); }
11,241
13,626
0
static int ebcdic_new(BIO *bi) { EBCDIC_OUTBUFF *wbuf; wbuf = (EBCDIC_OUTBUFF *) OPENSSL_malloc(sizeof(EBCDIC_OUTBUFF) + 1024); if (!wbuf) return 0; wbuf->alloced = 1024; wbuf->buff[0] = '\0'; bi->ptr = (char *)wbuf; bi->init = 1; bi->flags = 0; return (1); }
11,242
72,979
0
AuthBasicCred(struct http_auth *ha, Str uname, Str pw, ParsedURL *pu, HRequest *hr, FormList *request) { Str s = Strdup(uname); Strcat_char(s, ':'); Strcat(s, pw); return Strnew_m_charp("Basic ", encodeB(s->ptr)->ptr, NULL); }
11,243
172,100
0
static future_t *shut_down(void) { module_started = false; update_logging(); return NULL; }
11,244
72,905
0
static jpc_enc_band_t *band_create(jpc_enc_band_t *band, jpc_enc_cp_t *cp, jpc_enc_rlvl_t *rlvl, jpc_tsfb_band_t *bandinfos) { uint_fast16_t bandno; uint_fast16_t gblbandno; uint_fast16_t rlvlno; jpc_tsfb_band_t *bandinfo; jpc_enc_tcmpt_t *tcmpt; uint_fast32_t prcno; jpc_enc_prc_t *prc; tcmpt = rlvl->tcmpt; band->data = 0; band->prcs = 0; band->rlvl = rlvl; /* Deduce the resolution level and band number. */ rlvlno = rlvl - rlvl->tcmpt->rlvls; bandno = band - rlvl->bands; gblbandno = (!rlvlno) ? 0 : (3 * (rlvlno - 1) + bandno + 1); bandinfo = &bandinfos[gblbandno]; if (bandinfo->xstart != bandinfo->xend && bandinfo->ystart != bandinfo->yend) { if (!(band->data = jas_seq2d_create(0, 0, 0, 0))) { goto error; } jas_seq2d_bindsub(band->data, tcmpt->data, bandinfo->locxstart, bandinfo->locystart, bandinfo->locxend, bandinfo->locyend); jas_seq2d_setshift(band->data, bandinfo->xstart, bandinfo->ystart); } band->orient = bandinfo->orient; band->analgain = JPC_NOMINALGAIN(cp->tccp.qmfbid, tcmpt->numrlvls, rlvlno, band->orient); band->numbps = 0; band->absstepsize = 0; band->stepsize = 0; band->synweight = bandinfo->synenergywt; if (band->data) { if (!(band->prcs = jas_alloc2(rlvl->numprcs, sizeof(jpc_enc_prc_t)))) { goto error; } for (prcno = 0, prc = band->prcs; prcno < rlvl->numprcs; ++prcno, ++prc) { prc->cblks = 0; prc->incltree = 0; prc->nlibtree = 0; prc->savincltree = 0; prc->savnlibtree = 0; prc->band = band; } for (prcno = 0, prc = band->prcs; prcno < rlvl->numprcs; ++prcno, ++prc) { if (!prc_create(prc, cp, band)) { goto error; } } } return band; error: band_destroy(band); return 0; }
11,245
54,504
0
static int mov_probe(AVProbeData *p) { unsigned int offset; uint32_t tag; int score = 0; /* check file header */ offset = 0; for (;;) { /* ignore invalid offset */ if ((offset + 8) > (unsigned int)p->buf_size) return score; tag = AV_RL32(p->buf + offset + 4); switch(tag) { /* check for obvious tags */ case MKTAG('j','P',' ',' '): /* jpeg 2000 signature */ case MKTAG('m','o','o','v'): case MKTAG('m','d','a','t'): case MKTAG('p','n','o','t'): /* detect movs with preview pics like ew.mov and april.mov */ case MKTAG('u','d','t','a'): /* Packet Video PVAuthor adds this and a lot of more junk */ case MKTAG('f','t','y','p'): return AVPROBE_SCORE_MAX; /* those are more common words, so rate then a bit less */ case MKTAG('e','d','i','w'): /* xdcam files have reverted first tags */ case MKTAG('w','i','d','e'): case MKTAG('f','r','e','e'): case MKTAG('j','u','n','k'): case MKTAG('p','i','c','t'): return AVPROBE_SCORE_MAX - 5; case MKTAG(0x82,0x82,0x7f,0x7d): case MKTAG('s','k','i','p'): case MKTAG('u','u','i','d'): case MKTAG('p','r','f','l'): offset = AV_RB32(p->buf+offset) + offset; /* if we only find those cause probedata is too small at least rate them */ score = AVPROBE_SCORE_MAX - 50; break; default: /* unrecognized tag */ return score; } } }
11,246
31,035
0
static unsigned int rtnl_dev_combine_flags(const struct net_device *dev, const struct ifinfomsg *ifm) { unsigned int flags = ifm->ifi_flags; /* bugwards compatibility: ifi_change == 0 is treated as ~0 */ if (ifm->ifi_change) flags = (flags & ifm->ifi_change) | (rtnl_dev_get_flags(dev) & ~ifm->ifi_change); return flags; }
11,247
158,957
0
void PDFiumEngine::GetTextRunInfo(int page_index, int start_char_index, uint32_t* out_len, double* out_font_size, pp::FloatRect* out_bounds) { DCHECK(PageIndexInBounds(page_index)); return pages_[page_index]->GetTextRunInfo(start_char_index, out_len, out_font_size, out_bounds); }
11,248
131,190
0
static void activityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttributeAttributeGetterCallbackForMainWorld(v8::Local<v8::String>, const v8::PropertyCallbackInfo<v8::Value>& info) { TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMGetter"); TestObjectPythonV8Internal::activityLoggingGetterForIsolatedWorldsPerWorldBindingsLongAttributeAttributeGetterForMainWorld(info); TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution"); }
11,249
132,139
0
ContentBrowserClient* RenderViewTest::CreateContentBrowserClient() { return new ContentBrowserClient; }
11,250
155,060
0
void WebGLRenderingContextBase::texSubImage2D( ExecutionContext* execution_context, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLenum format, GLenum type, CanvasRenderingContextHost* context_host, ExceptionState& exception_state) { TexImageHelperCanvasRenderingContextHost( execution_context->GetSecurityOrigin(), kTexSubImage2D, target, level, 0, format, type, xoffset, yoffset, 0, context_host, GetTextureSourceSize(context_host), 1, 0, exception_state); }
11,251
21,188
0
static int __follow_pte(struct mm_struct *mm, unsigned long address, pte_t **ptepp, spinlock_t **ptlp) { pgd_t *pgd; pud_t *pud; pmd_t *pmd; pte_t *ptep; pgd = pgd_offset(mm, address); if (pgd_none(*pgd) || unlikely(pgd_bad(*pgd))) goto out; pud = pud_offset(pgd, address); if (pud_none(*pud) || unlikely(pud_bad(*pud))) goto out; pmd = pmd_offset(pud, address); VM_BUG_ON(pmd_trans_huge(*pmd)); if (pmd_none(*pmd) || unlikely(pmd_bad(*pmd))) goto out; /* We cannot handle huge page PFN maps. Luckily they don't exist. */ if (pmd_huge(*pmd)) goto out; ptep = pte_offset_map_lock(mm, pmd, address, ptlp); if (!ptep) goto out; if (!pte_present(*ptep)) goto unlock; *ptepp = ptep; return 0; unlock: pte_unmap_unlock(ptep, *ptlp); out: return -EINVAL; }
11,252
117,059
0
SessionCommand* SessionService::CreatePinnedStateCommand( const SessionID& tab_id, bool is_pinned) { PinnedStatePayload payload = { 0 }; payload.tab_id = tab_id.id(); payload.pinned_state = is_pinned; SessionCommand* command = new SessionCommand(kCommandSetPinnedState, sizeof(payload)); memcpy(command->contents(), &payload, sizeof(payload)); return command; }
11,253
25,299
0
xscale2pmu_read_event_select(void) { u32 val; asm volatile("mrc p14, 0, %0, c8, c1, 0" : "=r" (val)); return val; }
11,254
23,793
0
static int macvlan_addr_busy(const struct macvlan_port *port, const unsigned char *addr) { /* Test to see if the specified multicast address is * currently in use by the underlying device or * another macvlan. */ if (!compare_ether_addr_64bits(port->dev->dev_addr, addr)) return 1; if (macvlan_hash_lookup(port, addr)) return 1; return 0; }
11,255
97,862
0
void RenderView::AcceleratedSurfaceSetIOSurface(gfx::PluginWindowHandle window, int32 width, int32 height, uint64 io_surface_identifier) { Send(new ViewHostMsg_AcceleratedSurfaceSetIOSurface( routing_id(), window, width, height, io_surface_identifier)); }
11,256
173,662
0
bool ATSParser::PSISection::isComplete() const { if (mBuffer == NULL || mBuffer->size() < 3) { return false; } unsigned sectionLength = U16_AT(mBuffer->data() + 1) & 0xfff; return mBuffer->size() >= sectionLength + 3; }
11,257
59,825
0
void usbhid_init_reports(struct hid_device *hid) { struct hid_report *report; struct usbhid_device *usbhid = hid->driver_data; struct hid_report_enum *report_enum; int err, ret; report_enum = &hid->report_enum[HID_INPUT_REPORT]; list_for_each_entry(report, &report_enum->report_list, list) usbhid_submit_report(hid, report, USB_DIR_IN); report_enum = &hid->report_enum[HID_FEATURE_REPORT]; list_for_each_entry(report, &report_enum->report_list, list) usbhid_submit_report(hid, report, USB_DIR_IN); err = 0; ret = usbhid_wait_io(hid); while (ret) { err |= ret; if (test_bit(HID_CTRL_RUNNING, &usbhid->iofl)) usb_kill_urb(usbhid->urbctrl); if (test_bit(HID_OUT_RUNNING, &usbhid->iofl)) usb_kill_urb(usbhid->urbout); ret = usbhid_wait_io(hid); } if (err) hid_warn(hid, "timeout initializing reports\n"); }
11,258
128,220
0
void FrameView::adjustViewSize() { RenderView* renderView = this->renderView(); if (!renderView) return; ASSERT(m_frame->view() == this); const IntRect rect = renderView->documentRect(); const IntSize& size = rect.size(); ScrollView::setScrollOrigin(IntPoint(-rect.x(), -rect.y()), !m_frame->document()->printing(), size == contentsSize()); setContentsSize(size); }
11,259
118,703
0
void V8Window::eventAttributeGetterCustom(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) { v8::Handle<v8::Object> holder = info.This()->FindInstanceInPrototypeChain(V8Window::GetTemplate(info.GetIsolate(), worldTypeInMainThread(info.GetIsolate()))); if (holder.IsEmpty()) return; Frame* frame = V8Window::toNative(holder)->frame(); ExceptionState es(info.GetIsolate()); if (!BindingSecurity::shouldAllowAccessToFrame(frame, es)) { es.throwIfNeeded(); return; } ASSERT(frame); v8::Local<v8::Context> context = frame->script()->currentWorldContext(); if (context.IsEmpty()) return; v8::Handle<v8::String> eventSymbol = V8HiddenPropertyName::event(info.GetIsolate()); v8::Handle<v8::Value> jsEvent = context->Global()->GetHiddenValue(eventSymbol); if (jsEvent.IsEmpty()) return; v8SetReturnValue(info, jsEvent); }
11,260
35,089
0
static ssize_t defrag_show(struct kobject *kobj, struct kobj_attribute *attr, char *buf) { return double_flag_show(kobj, attr, buf, TRANSPARENT_HUGEPAGE_DEFRAG_FLAG, TRANSPARENT_HUGEPAGE_DEFRAG_REQ_MADV_FLAG); }
11,261
143,283
0
StyleSheetList& Document::styleSheets() { if (!m_styleSheetList) m_styleSheetList = StyleSheetList::create(this); return *m_styleSheetList; }
11,262
159,681
0
bool IDNSpoofChecker::SafeToDisplayAsUnicode(base::StringPiece16 label, bool is_tld_ascii) { UErrorCode status = U_ZERO_ERROR; int32_t result = uspoof_check(checker_, label.data(), base::checked_cast<int32_t>(label.size()), nullptr, &status); if (U_FAILURE(status) || (result & USPOOF_ALL_CHECKS)) return false; icu::UnicodeString label_string(FALSE, label.data(), base::checked_cast<int32_t>(label.size())); if (deviation_characters_.containsSome(label_string)) return false; result &= USPOOF_RESTRICTION_LEVEL_MASK; if (result == USPOOF_ASCII) return true; if (result == USPOOF_SINGLE_SCRIPT_RESTRICTIVE && kana_letters_exceptions_.containsNone(label_string) && combining_diacritics_exceptions_.containsNone(label_string)) { return !is_tld_ascii || !IsMadeOfLatinAlikeCyrillic(label_string); } if (non_ascii_latin_letters_.containsSome(label_string) && !lgc_letters_n_ascii_.containsAll(label_string)) return false; if (!tls_index.initialized()) tls_index.Initialize(&OnThreadTermination); icu::RegexMatcher* dangerous_pattern = reinterpret_cast<icu::RegexMatcher*>(tls_index.Get()); if (!dangerous_pattern) { dangerous_pattern = new icu::RegexMatcher( icu::UnicodeString( R"([^\p{scx=kana}\p{scx=hira}\p{scx=hani}])" R"([\u30ce\u30f3\u30bd\u30be])" R"([^\p{scx=kana}\p{scx=hira}\p{scx=hani}]|)" R"([^\p{scx=kana}\p{scx=hira}]\u30fc|^\u30fc|)" R"([^\p{scx=kana}][\u30fd\u30fe]|^[\u30fd\u30fe]|)" R"(^[\p{scx=kana}]+[\u3078-\u307a][\p{scx=kana}]+$|)" R"(^[\p{scx=hira}]+[\u30d8-\u30da][\p{scx=hira}]+$|)" R"([a-z]\u30fb|\u30fb[a-z]|)" R"([^\p{scx=latn}\p{scx=grek}\p{scx=cyrl}][\u0300-\u0339]|)" R"(\u0131[\u0300-\u0339]|)" R"([ijl]\u0307)", -1, US_INV), 0, status); tls_index.Set(dangerous_pattern); } dangerous_pattern->reset(label_string); return !dangerous_pattern->find(); }
11,263
68,519
0
asf_demux_parse_picture_tag (GstTagList * tags, const guint8 * tag_data, guint tag_data_len) { GstByteReader r; const guint8 *img_data = NULL; guint32 img_data_len = 0; guint8 pic_type = 0; gst_byte_reader_init (&r, tag_data, tag_data_len); /* skip mime type string (we don't trust it and do our own typefinding), * and also skip the description string, since we don't use it */ if (!gst_byte_reader_get_uint8 (&r, &pic_type) || !gst_byte_reader_get_uint32_le (&r, &img_data_len) || !gst_byte_reader_skip_string_utf16 (&r) || !gst_byte_reader_skip_string_utf16 (&r) || !gst_byte_reader_get_data (&r, img_data_len, &img_data)) { goto not_enough_data; } if (!gst_tag_list_add_id3_image (tags, img_data, img_data_len, pic_type)) GST_DEBUG ("failed to add image extracted from WM/Picture tag to taglist"); return; not_enough_data: { GST_DEBUG ("Failed to read WM/Picture tag: not enough data"); GST_MEMDUMP ("WM/Picture data", tag_data, tag_data_len); return; } }
11,264
126,725
0
void BrowserView::ConfirmAddSearchProvider(TemplateURL* template_url, Profile* profile) { chrome::EditSearchEngine(GetWidget()->GetNativeWindow(), template_url, NULL, profile); }
11,265
185,349
1
TemplateURLRef::SearchTermsArgs::ContextualSearchParams::ContextualSearchParams( int version, const std::string& selection, const std::string& base_page_url, int now_on_tap_version) : version(version), start(base::string16::npos), end(base::string16::npos), selection(selection), base_page_url(base_page_url), now_on_tap_version(now_on_tap_version) {}
11,266
182,081
1
static int parse_token(char **name, char **value, char **cp) { char *end; if (!name || !value || !cp) return -BLKID_ERR_PARAM; if (!(*value = strchr(*cp, '='))) return 0; **value = '\0'; *name = strip_line(*cp); *value = skip_over_blank(*value + 1); if (**value == '"') { end = strchr(*value + 1, '"'); if (!end) { DBG(READ, ul_debug("unbalanced quotes at: %s", *value)); *cp = *value; return -BLKID_ERR_CACHE; } (*value)++; *end = '\0'; end++; } else { end = skip_over_word(*value); if (*end) { *end = '\0'; end++; } } *cp = end; return 1; }
11,267
118,777
0
void ContainerNode::replaceChild(PassRefPtr<Node> newChild, Node* oldChild, ExceptionState& es) { ASSERT(refCount() || parentOrShadowHostNode()); RefPtr<Node> protect(this); if (oldChild == newChild) // nothing to do return; if (!oldChild) { es.throwUninformativeAndGenericDOMException(NotFoundError); return; } if (!checkReplaceChild(this, newChild.get(), oldChild, es)) return; if (oldChild->parentNode() != this) { es.throwUninformativeAndGenericDOMException(NotFoundError); return; } ChildListMutationScope mutation(this); RefPtr<Node> next = oldChild->nextSibling(); RefPtr<Node> removedChild = oldChild; removeChild(oldChild, es); if (es.hadException()) return; if (next && (next->previousSibling() == newChild || next == newChild)) // nothing to do return; if (!checkReplaceChild(this, newChild.get(), oldChild, es)) return; NodeVector targets; collectChildrenAndRemoveFromOldParent(newChild.get(), targets, es); if (es.hadException()) return; if (!checkReplaceChild(this, newChild.get(), oldChild, es)) return; InspectorInstrumentation::willInsertDOMNode(&document(), this); for (NodeVector::const_iterator it = targets.begin(); it != targets.end(); ++it) { Node* child = it->get(); if (next && next->parentNode() != this) break; if (child->parentNode()) break; treeScope().adoptIfNeeded(child); { NoEventDispatchAssertion assertNoEventDispatch; if (next) insertBeforeCommon(next.get(), child); else appendChildToContainer(child, this); } updateTreeAfterInsertion(this, child); } dispatchSubtreeModifiedEvent(); }
11,268
37,153
0
static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) { u32 intr_info = vmcs_read32(VM_EXIT_INTR_INFO); struct vcpu_vmx *vmx = to_vmx(vcpu); struct vmcs12 *vmcs12 = get_vmcs12(vcpu); u32 exit_reason = vmx->exit_reason; trace_kvm_nested_vmexit(kvm_rip_read(vcpu), exit_reason, vmcs_readl(EXIT_QUALIFICATION), vmx->idt_vectoring_info, intr_info, vmcs_read32(VM_EXIT_INTR_ERROR_CODE), KVM_ISA_VMX); if (vmx->nested.nested_run_pending) return 0; if (unlikely(vmx->fail)) { pr_info_ratelimited("%s failed vm entry %x\n", __func__, vmcs_read32(VM_INSTRUCTION_ERROR)); return 1; } switch (exit_reason) { case EXIT_REASON_EXCEPTION_NMI: if (!is_exception(intr_info)) return 0; else if (is_page_fault(intr_info)) return enable_ept; else if (is_no_device(intr_info) && !(vmcs12->guest_cr0 & X86_CR0_TS)) return 0; return vmcs12->exception_bitmap & (1u << (intr_info & INTR_INFO_VECTOR_MASK)); case EXIT_REASON_EXTERNAL_INTERRUPT: return 0; case EXIT_REASON_TRIPLE_FAULT: return 1; case EXIT_REASON_PENDING_INTERRUPT: return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_INTR_PENDING); case EXIT_REASON_NMI_WINDOW: return nested_cpu_has(vmcs12, CPU_BASED_VIRTUAL_NMI_PENDING); case EXIT_REASON_TASK_SWITCH: return 1; case EXIT_REASON_CPUID: if (kvm_register_read(vcpu, VCPU_REGS_RAX) == 0xa) return 0; return 1; case EXIT_REASON_HLT: return nested_cpu_has(vmcs12, CPU_BASED_HLT_EXITING); case EXIT_REASON_INVD: return 1; case EXIT_REASON_INVLPG: return nested_cpu_has(vmcs12, CPU_BASED_INVLPG_EXITING); case EXIT_REASON_RDPMC: return nested_cpu_has(vmcs12, CPU_BASED_RDPMC_EXITING); case EXIT_REASON_RDTSC: return nested_cpu_has(vmcs12, CPU_BASED_RDTSC_EXITING); case EXIT_REASON_VMCALL: case EXIT_REASON_VMCLEAR: case EXIT_REASON_VMLAUNCH: case EXIT_REASON_VMPTRLD: case EXIT_REASON_VMPTRST: case EXIT_REASON_VMREAD: case EXIT_REASON_VMRESUME: case EXIT_REASON_VMWRITE: case EXIT_REASON_VMOFF: case EXIT_REASON_VMON: case EXIT_REASON_INVEPT: /* * VMX instructions trap unconditionally. This allows L1 to * emulate them for its L2 guest, i.e., allows 3-level nesting! */ return 1; case EXIT_REASON_CR_ACCESS: return nested_vmx_exit_handled_cr(vcpu, vmcs12); case EXIT_REASON_DR_ACCESS: return nested_cpu_has(vmcs12, CPU_BASED_MOV_DR_EXITING); case EXIT_REASON_IO_INSTRUCTION: return nested_vmx_exit_handled_io(vcpu, vmcs12); case EXIT_REASON_MSR_READ: case EXIT_REASON_MSR_WRITE: return nested_vmx_exit_handled_msr(vcpu, vmcs12, exit_reason); case EXIT_REASON_INVALID_STATE: return 1; case EXIT_REASON_MWAIT_INSTRUCTION: return nested_cpu_has(vmcs12, CPU_BASED_MWAIT_EXITING); case EXIT_REASON_MONITOR_INSTRUCTION: return nested_cpu_has(vmcs12, CPU_BASED_MONITOR_EXITING); case EXIT_REASON_PAUSE_INSTRUCTION: return nested_cpu_has(vmcs12, CPU_BASED_PAUSE_EXITING) || nested_cpu_has2(vmcs12, SECONDARY_EXEC_PAUSE_LOOP_EXITING); case EXIT_REASON_MCE_DURING_VMENTRY: return 0; case EXIT_REASON_TPR_BELOW_THRESHOLD: return nested_cpu_has(vmcs12, CPU_BASED_TPR_SHADOW); case EXIT_REASON_APIC_ACCESS: return nested_cpu_has2(vmcs12, SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES); case EXIT_REASON_EPT_VIOLATION: /* * L0 always deals with the EPT violation. If nested EPT is * used, and the nested mmu code discovers that the address is * missing in the guest EPT table (EPT12), the EPT violation * will be injected with nested_ept_inject_page_fault() */ return 0; case EXIT_REASON_EPT_MISCONFIG: /* * L2 never uses directly L1's EPT, but rather L0's own EPT * table (shadow on EPT) or a merged EPT table that L0 built * (EPT on EPT). So any problems with the structure of the * table is L0's fault. */ return 0; case EXIT_REASON_WBINVD: return nested_cpu_has2(vmcs12, SECONDARY_EXEC_WBINVD_EXITING); case EXIT_REASON_XSETBV: return 1; default: return 1; } }
11,269
150,243
0
bool IsTabDraggingSourceWindow(aura::Window* window) { if (!window) return false; MruWindowTracker::WindowList window_list = Shell::Get()->mru_window_tracker()->BuildMruWindowList(kActiveDesk); if (window_list.empty()) return false; aura::Window* dragged_window = nullptr; for (auto* window : window_list) { if (wm::IsDraggingTabs(window)) { dragged_window = window; break; } } if (!dragged_window) return false; return dragged_window->GetProperty(ash::kTabDraggingSourceWindowKey) == window; }
11,270
21,467
0
static int padzero(unsigned long elf_bss) { unsigned long nbyte; nbyte = ELF_PAGEOFFSET(elf_bss); if (nbyte) { nbyte = ELF_MIN_ALIGN - nbyte; if (clear_user((void __user *) elf_bss, nbyte)) return -EFAULT; } return 0; }
11,271
89,183
0
onig_compile(regex_t* reg, const UChar* pattern, const UChar* pattern_end, OnigErrorInfo* einfo) { int r; Node* root; ScanEnv scan_env; #ifdef USE_CALL UnsetAddrList uslist; #endif root = 0; if (IS_NOT_NULL(einfo)) { einfo->enc = reg->enc; einfo->par = (UChar* )NULL; } #ifdef ONIG_DEBUG print_enc_string(stderr, reg->enc, pattern, pattern_end); #endif if (reg->ops_alloc == 0) { r = ops_init(reg, OPS_INIT_SIZE); if (r != 0) goto end; } else reg->ops_used = 0; reg->string_pool = 0; reg->string_pool_end = 0; reg->num_mem = 0; reg->num_repeat = 0; reg->num_null_check = 0; reg->repeat_range_alloc = 0; reg->repeat_range = (OnigRepeatRange* )NULL; r = onig_parse_tree(&root, pattern, pattern_end, reg, &scan_env); if (r != 0) goto err; /* mixed use named group and no-named group */ if (scan_env.num_named > 0 && IS_SYNTAX_BV(scan_env.syntax, ONIG_SYN_CAPTURE_ONLY_NAMED_GROUP) && ! ONIG_IS_OPTION_ON(reg->options, ONIG_OPTION_CAPTURE_GROUP)) { if (scan_env.num_named != scan_env.num_mem) r = disable_noname_group_capture(&root, reg, &scan_env); else r = numbered_ref_check(root); if (r != 0) goto err; } r = check_backrefs(root, &scan_env); if (r != 0) goto err; #ifdef USE_CALL if (scan_env.num_call > 0) { r = unset_addr_list_init(&uslist, scan_env.num_call); if (r != 0) goto err; scan_env.unset_addr_list = &uslist; r = setup_call(root, &scan_env, 0); if (r != 0) goto err_unset; r = setup_call2(root); if (r != 0) goto err_unset; r = recursive_call_check_trav(root, &scan_env, 0); if (r < 0) goto err_unset; r = infinite_recursive_call_check_trav(root, &scan_env); if (r != 0) goto err_unset; setup_called_state(root, 0); } reg->num_call = scan_env.num_call; #endif r = setup_tree(root, reg, 0, &scan_env); if (r != 0) goto err_unset; #ifdef ONIG_DEBUG_PARSE print_tree(stderr, root); #endif reg->capture_history = scan_env.capture_history; reg->bt_mem_start = scan_env.bt_mem_start; reg->bt_mem_start |= reg->capture_history; if (IS_FIND_CONDITION(reg->options)) MEM_STATUS_ON_ALL(reg->bt_mem_end); else { reg->bt_mem_end = scan_env.bt_mem_end; reg->bt_mem_end |= reg->capture_history; } reg->bt_mem_start |= reg->bt_mem_end; clear_optimize_info(reg); #ifndef ONIG_DONT_OPTIMIZE r = set_optimize_info_from_tree(root, reg, &scan_env); if (r != 0) goto err_unset; #endif if (IS_NOT_NULL(scan_env.mem_env_dynamic)) { xfree(scan_env.mem_env_dynamic); scan_env.mem_env_dynamic = (MemEnv* )NULL; } r = compile_tree(root, reg, &scan_env); if (r == 0) { if (scan_env.keep_num > 0) { r = add_op(reg, OP_UPDATE_VAR); if (r != 0) goto err; COP(reg)->update_var.type = UPDATE_VAR_KEEP_FROM_STACK_LAST; COP(reg)->update_var.id = 0; /* not used */ } r = add_op(reg, OP_END); if (r != 0) goto err; #ifdef USE_CALL if (scan_env.num_call > 0) { r = fix_unset_addr_list(&uslist, reg); unset_addr_list_end(&uslist); if (r != 0) goto err; } #endif if ((reg->num_repeat != 0) || (reg->bt_mem_end != 0) #ifdef USE_CALLOUT || (IS_NOT_NULL(reg->extp) && reg->extp->callout_num != 0) #endif ) reg->stack_pop_level = STACK_POP_LEVEL_ALL; else { if (reg->bt_mem_start != 0) reg->stack_pop_level = STACK_POP_LEVEL_MEM_START; else reg->stack_pop_level = STACK_POP_LEVEL_FREE; } r = ops_make_string_pool(reg); if (r != 0) goto err; } #ifdef USE_CALL else if (scan_env.num_call > 0) { unset_addr_list_end(&uslist); } #endif onig_node_free(root); #ifdef ONIG_DEBUG_COMPILE onig_print_names(stderr, reg); onig_print_compiled_byte_code_list(stderr, reg); #endif #ifdef USE_DIRECT_THREADED_CODE /* opcode -> opaddr */ onig_init_for_match_at(reg); #endif end: return r; err_unset: #ifdef USE_CALL if (scan_env.num_call > 0) { unset_addr_list_end(&uslist); } #endif err: if (IS_NOT_NULL(scan_env.error)) { if (IS_NOT_NULL(einfo)) { einfo->par = scan_env.error; einfo->par_end = scan_env.error_end; } } onig_node_free(root); if (IS_NOT_NULL(scan_env.mem_env_dynamic)) xfree(scan_env.mem_env_dynamic); return r; }
11,272
43,454
0
static int ablk_ctr_init(struct crypto_tfm *tfm) { return ablk_init_common(tfm, "__driver-ctr-aes-aesni"); }
11,273
125,631
0
void RenderViewHostImpl::LostMouseLock() { RenderWidgetHostImpl::LostMouseLock(); delegate_->LostMouseLock(); }
11,274
44,773
0
void process_unlock(void) { unlock_mutex(&thread_mutex); }
11,275
67,969
0
static int jp2_ihdr_putdata(jp2_box_t *box, jas_stream_t *out) { jp2_ihdr_t *ihdr = &box->data.ihdr; if (jp2_putuint32(out, ihdr->height) || jp2_putuint32(out, ihdr->width) || jp2_putuint16(out, ihdr->numcmpts) || jp2_putuint8(out, ihdr->bpc) || jp2_putuint8(out, ihdr->comptype) || jp2_putuint8(out, ihdr->csunk) || jp2_putuint8(out, ihdr->ipr)) { return -1; } return 0; }
11,276
187,725
1
store_current_palette(png_store *ps, int *npalette) { /* This is an internal error (the call has been made outside a read * operation.) */ if (ps->current == NULL) store_log(ps, ps->pread, "no current stream for palette", 1); /* The result may be null if there is no palette. */ *npalette = ps->current->npalette; return ps->current->palette; }
11,277
170,230
0
const extensions::Extension* InstallExtension( const base::FilePath::StringType& name) { base::FilePath extension_path(ui_test_utils::GetTestFilePath( base::FilePath(kTestExtensionsDir), base::FilePath(name))); scoped_refptr<extensions::CrxInstaller> installer = extensions::CrxInstaller::CreateSilent(extension_service()); installer->set_allow_silent_install(true); installer->set_install_cause(extension_misc::INSTALL_CAUSE_UPDATE); installer->set_creation_flags(extensions::Extension::FROM_WEBSTORE); content::WindowedNotificationObserver observer( extensions::NOTIFICATION_CRX_INSTALLER_DONE, content::NotificationService::AllSources()); installer->InstallCrx(extension_path); observer.Wait(); content::Details<const extensions::Extension> details = observer.details(); return details.ptr(); }
11,278
137,883
0
const AtomicString& MediaControlCastButtonElement::shadowPseudoId() const { DEFINE_STATIC_LOCAL(AtomicString, id_nonOverlay, ("-internal-media-controls-cast-button")); DEFINE_STATIC_LOCAL(AtomicString, id_overlay, ("-internal-media-controls-overlay-cast-button")); return m_isOverlayButton ? id_overlay : id_nonOverlay; }
11,279
173,007
0
buffer_from_file(struct buffer *buffer, FILE *fp) { struct buffer_list *last = &buffer->first; size_t count = 0; for (;;) { size_t r = fread(last->buffer+count, 1/*size*/, (sizeof last->buffer)-count, fp); if (r > 0) { count += r; if (count >= sizeof last->buffer) { assert(count == sizeof last->buffer); count = 0; if (last->next == NULL) { last = buffer_extend(last); if (last == NULL) return MEMORY; } else last = last->next; } } else /* fread failed - probably end of file */ { if (feof(fp)) { buffer->last = last; buffer->end_count = count; return 0; /* no error */ } /* Some kind of funky error; errno should be non-zero */ return errno == 0 ? ERANGE : errno; } } }
11,280
150,976
0
void DevToolsUIBindings::DevicesDiscoveryConfigUpdated() { CallClientFunction( "DevToolsAPI.devicesDiscoveryConfigChanged", profile_->GetPrefs()->FindPreference( prefs::kDevToolsDiscoverUsbDevicesEnabled)->GetValue(), profile_->GetPrefs()->FindPreference( prefs::kDevToolsPortForwardingEnabled)->GetValue(), profile_->GetPrefs()->FindPreference( prefs::kDevToolsPortForwardingConfig)->GetValue()); }
11,281
170,333
0
uint32_t SampleTable::getCompositionTimeOffset(uint32_t sampleIndex) { return mCompositionDeltaLookup->getCompositionTimeOffset(sampleIndex); }
11,282
133,144
0
void HWNDMessageHandler::OnSysCommand(UINT notification_code, const CPoint& point) { if (!delegate_->ShouldHandleSystemCommands()) return; static const int sc_mask = 0xFFF0; if (fullscreen_handler_->fullscreen() && (((notification_code & sc_mask) == SC_SIZE) || ((notification_code & sc_mask) == SC_MOVE) || ((notification_code & sc_mask) == SC_MAXIMIZE))) return; if (delegate_->IsUsingCustomFrame()) { if ((notification_code & sc_mask) == SC_MINIMIZE || (notification_code & sc_mask) == SC_MAXIMIZE || (notification_code & sc_mask) == SC_RESTORE) { delegate_->ResetWindowControls(); } else if ((notification_code & sc_mask) == SC_MOVE || (notification_code & sc_mask) == SC_SIZE) { if (!IsVisible()) { SetWindowLong(hwnd(), GWL_STYLE, GetWindowLong(hwnd(), GWL_STYLE) | WS_VISIBLE); } } } if ((notification_code & sc_mask) == SC_KEYMENU && point.x == 0) { int modifiers = ui::EF_NONE; if (base::win::IsShiftPressed()) modifiers |= ui::EF_SHIFT_DOWN; if (base::win::IsCtrlPressed()) modifiers |= ui::EF_CONTROL_DOWN; ui::Accelerator accelerator(ui::KeyboardCodeForWindowsKeyCode(VK_MENU), modifiers); delegate_->HandleAccelerator(accelerator); return; } if (!delegate_->HandleCommand(notification_code)) { DefWindowProc(hwnd(), WM_SYSCOMMAND, notification_code, MAKELPARAM(point.x, point.y)); } }
11,283
46,465
0
kg_seal_iov_length(OM_uint32 *minor_status, gss_ctx_id_t context_handle, int conf_req_flag, gss_qop_t qop_req, int *conf_state, gss_iov_buffer_desc *iov, int iov_count, int toktype) { krb5_gss_ctx_id_rec *ctx; gss_iov_buffer_t header, trailer, padding; size_t data_length, assoc_data_length; size_t gss_headerlen, gss_padlen, gss_trailerlen; unsigned int k5_headerlen = 0, k5_trailerlen = 0, k5_padlen = 0; krb5_error_code code; krb5_context context; int dce_or_mic; if (qop_req != GSS_C_QOP_DEFAULT) { *minor_status = (OM_uint32)G_UNKNOWN_QOP; return GSS_S_FAILURE; } ctx = (krb5_gss_ctx_id_rec *)context_handle; if (!ctx->established) { *minor_status = KG_CTX_INCOMPLETE; return GSS_S_NO_CONTEXT; } header = kg_locate_header_iov(iov, iov_count, toktype); if (header == NULL) { *minor_status = EINVAL; return GSS_S_FAILURE; } INIT_IOV_DATA(header); trailer = kg_locate_iov(iov, iov_count, GSS_IOV_BUFFER_TYPE_TRAILER); if (trailer != NULL) { INIT_IOV_DATA(trailer); } /* MIC tokens and DCE-style wrap tokens have similar length considerations: * no padding, and the framing surrounds the header only, not the data. */ dce_or_mic = ((ctx->gss_flags & GSS_C_DCE_STYLE) != 0 || toktype == KG_TOK_MIC_MSG); /* For CFX, EC is used instead of padding, and is placed in header or trailer */ padding = kg_locate_iov(iov, iov_count, GSS_IOV_BUFFER_TYPE_PADDING); if (padding == NULL) { if (conf_req_flag && ctx->proto == 0 && !dce_or_mic) { *minor_status = EINVAL; return GSS_S_FAILURE; } } else { INIT_IOV_DATA(padding); } kg_iov_msglen(iov, iov_count, &data_length, &assoc_data_length); if (conf_req_flag && kg_integ_only_iov(iov, iov_count)) conf_req_flag = FALSE; context = ctx->k5_context; gss_headerlen = gss_padlen = gss_trailerlen = 0; if (ctx->proto == 1) { krb5_key key; krb5_enctype enctype; size_t ec; key = (ctx->have_acceptor_subkey) ? ctx->acceptor_subkey : ctx->subkey; enctype = key->keyblock.enctype; code = krb5_c_crypto_length(context, enctype, conf_req_flag ? KRB5_CRYPTO_TYPE_TRAILER : KRB5_CRYPTO_TYPE_CHECKSUM, &k5_trailerlen); if (code != 0) { *minor_status = code; return GSS_S_FAILURE; } if (conf_req_flag) { code = krb5_c_crypto_length(context, enctype, KRB5_CRYPTO_TYPE_HEADER, &k5_headerlen); if (code != 0) { *minor_status = code; return GSS_S_FAILURE; } } gss_headerlen = 16; /* Header */ if (conf_req_flag) { gss_headerlen += k5_headerlen; /* Kerb-Header */ gss_trailerlen = 16 /* E(Header) */ + k5_trailerlen; /* Kerb-Trailer */ code = krb5_c_padding_length(context, enctype, data_length - assoc_data_length + 16 /* E(Header) */, &k5_padlen); if (code != 0) { *minor_status = code; return GSS_S_FAILURE; } if (k5_padlen == 0 && dce_or_mic) { /* Windows rejects AEAD tokens with non-zero EC */ code = krb5_c_block_size(context, enctype, &ec); if (code != 0) { *minor_status = code; return GSS_S_FAILURE; } } else ec = k5_padlen; gss_trailerlen += ec; } else { gss_trailerlen = k5_trailerlen; /* Kerb-Checksum */ } } else if (!dce_or_mic) { k5_padlen = (ctx->sealalg == SEAL_ALG_MICROSOFT_RC4) ? 1 : 8; if (k5_padlen == 1) gss_padlen = 1; else gss_padlen = k5_padlen - ((data_length - assoc_data_length) % k5_padlen); } data_length += gss_padlen; if (ctx->proto == 0) { /* Header | Checksum | Confounder | Data | Pad */ size_t data_size; k5_headerlen = kg_confounder_size(context, ctx->enc->keyblock.enctype); data_size = 14 /* Header */ + ctx->cksum_size + k5_headerlen; if (!dce_or_mic) data_size += data_length; gss_headerlen = g_token_size(ctx->mech_used, data_size); /* g_token_size() will include data_size as well as the overhead, so * subtract data_length just to get the overhead (ie. token size) */ if (!dce_or_mic) gss_headerlen -= data_length; } if (minor_status != NULL) *minor_status = 0; if (trailer == NULL) gss_headerlen += gss_trailerlen; else trailer->buffer.length = gss_trailerlen; assert(gss_padlen == 0 || padding != NULL); if (padding != NULL) padding->buffer.length = gss_padlen; header->buffer.length = gss_headerlen; if (conf_state != NULL) *conf_state = conf_req_flag; return GSS_S_COMPLETE; }
11,284
55,584
0
void rt_mutex_setprio(struct task_struct *p, int prio) { int oldprio, queued, running, queue_flag = DEQUEUE_SAVE | DEQUEUE_MOVE; const struct sched_class *prev_class; struct rq_flags rf; struct rq *rq; BUG_ON(prio > MAX_PRIO); rq = __task_rq_lock(p, &rf); /* * Idle task boosting is a nono in general. There is one * exception, when PREEMPT_RT and NOHZ is active: * * The idle task calls get_next_timer_interrupt() and holds * the timer wheel base->lock on the CPU and another CPU wants * to access the timer (probably to cancel it). We can safely * ignore the boosting request, as the idle CPU runs this code * with interrupts disabled and will complete the lock * protected section without being interrupted. So there is no * real need to boost. */ if (unlikely(p == rq->idle)) { WARN_ON(p != rq->curr); WARN_ON(p->pi_blocked_on); goto out_unlock; } trace_sched_pi_setprio(p, prio); oldprio = p->prio; if (oldprio == prio) queue_flag &= ~DEQUEUE_MOVE; prev_class = p->sched_class; queued = task_on_rq_queued(p); running = task_current(rq, p); if (queued) dequeue_task(rq, p, queue_flag); if (running) put_prev_task(rq, p); /* * Boosting condition are: * 1. -rt task is running and holds mutex A * --> -dl task blocks on mutex A * * 2. -dl task is running and holds mutex A * --> -dl task blocks on mutex A and could preempt the * running task */ if (dl_prio(prio)) { struct task_struct *pi_task = rt_mutex_get_top_task(p); if (!dl_prio(p->normal_prio) || (pi_task && dl_entity_preempt(&pi_task->dl, &p->dl))) { p->dl.dl_boosted = 1; queue_flag |= ENQUEUE_REPLENISH; } else p->dl.dl_boosted = 0; p->sched_class = &dl_sched_class; } else if (rt_prio(prio)) { if (dl_prio(oldprio)) p->dl.dl_boosted = 0; if (oldprio < prio) queue_flag |= ENQUEUE_HEAD; p->sched_class = &rt_sched_class; } else { if (dl_prio(oldprio)) p->dl.dl_boosted = 0; if (rt_prio(oldprio)) p->rt.timeout = 0; p->sched_class = &fair_sched_class; } p->prio = prio; if (running) p->sched_class->set_curr_task(rq); if (queued) enqueue_task(rq, p, queue_flag); check_class_changed(rq, p, prev_class, oldprio); out_unlock: preempt_disable(); /* avoid rq from going away on us */ __task_rq_unlock(rq, &rf); balance_callback(rq); preempt_enable(); }
11,285
131,396
0
static void floatAttributeAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_VOID(float, cppValue, static_cast<float>(jsValue->NumberValue())); imp->setFloatAttribute(cppValue); }
11,286
88,334
0
xfs_setattr_size( struct xfs_inode *ip, struct iattr *iattr) { struct xfs_mount *mp = ip->i_mount; struct inode *inode = VFS_I(ip); xfs_off_t oldsize, newsize; struct xfs_trans *tp; int error; uint lock_flags = 0; bool did_zeroing = false; ASSERT(xfs_isilocked(ip, XFS_IOLOCK_EXCL)); ASSERT(xfs_isilocked(ip, XFS_MMAPLOCK_EXCL)); ASSERT(S_ISREG(inode->i_mode)); ASSERT((iattr->ia_valid & (ATTR_UID|ATTR_GID|ATTR_ATIME|ATTR_ATIME_SET| ATTR_MTIME_SET|ATTR_KILL_PRIV|ATTR_TIMES_SET)) == 0); oldsize = inode->i_size; newsize = iattr->ia_size; /* * Short circuit the truncate case for zero length files. */ if (newsize == 0 && oldsize == 0 && ip->i_d.di_nextents == 0) { if (!(iattr->ia_valid & (ATTR_CTIME|ATTR_MTIME))) return 0; /* * Use the regular setattr path to update the timestamps. */ iattr->ia_valid &= ~ATTR_SIZE; return xfs_setattr_nonsize(ip, iattr, 0); } /* * Make sure that the dquots are attached to the inode. */ error = xfs_qm_dqattach(ip); if (error) return error; /* * Wait for all direct I/O to complete. */ inode_dio_wait(inode); /* * File data changes must be complete before we start the transaction to * modify the inode. This needs to be done before joining the inode to * the transaction because the inode cannot be unlocked once it is a * part of the transaction. * * Start with zeroing any data beyond EOF that we may expose on file * extension, or zeroing out the rest of the block on a downward * truncate. */ if (newsize > oldsize) { trace_xfs_zero_eof(ip, oldsize, newsize - oldsize); error = iomap_zero_range(inode, oldsize, newsize - oldsize, &did_zeroing, &xfs_iomap_ops); } else { error = iomap_truncate_page(inode, newsize, &did_zeroing, &xfs_iomap_ops); } if (error) return error; /* * We've already locked out new page faults, so now we can safely remove * pages from the page cache knowing they won't get refaulted until we * drop the XFS_MMAP_EXCL lock after the extent manipulations are * complete. The truncate_setsize() call also cleans partial EOF page * PTEs on extending truncates and hence ensures sub-page block size * filesystems are correctly handled, too. * * We have to do all the page cache truncate work outside the * transaction context as the "lock" order is page lock->log space * reservation as defined by extent allocation in the writeback path. * Hence a truncate can fail with ENOMEM from xfs_trans_alloc(), but * having already truncated the in-memory version of the file (i.e. made * user visible changes). There's not much we can do about this, except * to hope that the caller sees ENOMEM and retries the truncate * operation. * * And we update in-core i_size and truncate page cache beyond newsize * before writeback the [di_size, newsize] range, so we're guaranteed * not to write stale data past the new EOF on truncate down. */ truncate_setsize(inode, newsize); /* * We are going to log the inode size change in this transaction so * any previous writes that are beyond the on disk EOF and the new * EOF that have not been written out need to be written here. If we * do not write the data out, we expose ourselves to the null files * problem. Note that this includes any block zeroing we did above; * otherwise those blocks may not be zeroed after a crash. */ if (did_zeroing || (newsize > ip->i_d.di_size && oldsize != ip->i_d.di_size)) { error = filemap_write_and_wait_range(VFS_I(ip)->i_mapping, ip->i_d.di_size, newsize - 1); if (error) return error; } error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp); if (error) return error; lock_flags |= XFS_ILOCK_EXCL; xfs_ilock(ip, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, ip, 0); /* * Only change the c/mtime if we are changing the size or we are * explicitly asked to change it. This handles the semantic difference * between truncate() and ftruncate() as implemented in the VFS. * * The regular truncate() case without ATTR_CTIME and ATTR_MTIME is a * special case where we need to update the times despite not having * these flags set. For all other operations the VFS set these flags * explicitly if it wants a timestamp update. */ if (newsize != oldsize && !(iattr->ia_valid & (ATTR_CTIME | ATTR_MTIME))) { iattr->ia_ctime = iattr->ia_mtime = current_time(inode); iattr->ia_valid |= ATTR_CTIME | ATTR_MTIME; } /* * The first thing we do is set the size to new_size permanently on * disk. This way we don't have to worry about anyone ever being able * to look at the data being freed even in the face of a crash. * What we're getting around here is the case where we free a block, it * is allocated to another file, it is written to, and then we crash. * If the new data gets written to the file but the log buffers * containing the free and reallocation don't, then we'd end up with * garbage in the blocks being freed. As long as we make the new size * permanent before actually freeing any blocks it doesn't matter if * they get written to. */ ip->i_d.di_size = newsize; xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); if (newsize <= oldsize) { error = xfs_itruncate_extents(&tp, ip, XFS_DATA_FORK, newsize); if (error) goto out_trans_cancel; /* * Truncated "down", so we're removing references to old data * here - if we delay flushing for a long time, we expose * ourselves unduly to the notorious NULL files problem. So, * we mark this inode and flush it when the file is closed, * and do not wait the usual (long) time for writeout. */ xfs_iflags_set(ip, XFS_ITRUNCATED); /* A truncate down always removes post-EOF blocks. */ xfs_inode_clear_eofblocks_tag(ip); } if (iattr->ia_valid & ATTR_MODE) xfs_setattr_mode(ip, iattr); if (iattr->ia_valid & (ATTR_ATIME|ATTR_CTIME|ATTR_MTIME)) xfs_setattr_time(ip, iattr); xfs_trans_log_inode(tp, ip, XFS_ILOG_CORE); XFS_STATS_INC(mp, xs_ig_attrchg); if (mp->m_flags & XFS_MOUNT_WSYNC) xfs_trans_set_sync(tp); error = xfs_trans_commit(tp); out_unlock: if (lock_flags) xfs_iunlock(ip, lock_flags); return error; out_trans_cancel: xfs_trans_cancel(tp); goto out_unlock; }
11,287
48,371
0
tsize_t t2p_write_pdf_header(T2P* t2p, TIFF* output){ tsize_t written=0; char buffer[16]; int buflen=0; buflen = snprintf(buffer, sizeof(buffer), "%%PDF-%u.%u ", t2p->pdf_majorversion&0xff, t2p->pdf_minorversion&0xff); check_snprintf_ret(t2p, buflen, buffer); written += t2pWriteFile(output, (tdata_t) buffer, buflen); written += t2pWriteFile(output, (tdata_t)"\n%\342\343\317\323\n", 7); return(written); }
11,288
135,244
0
LocalFrame* Document::executingFrame() { LocalDOMWindow* window = executingWindow(); if (!window) return 0; return window->frame(); }
11,289
136,640
0
void DocumentLoader::WillCommitNavigation() { if (GetFrameLoader().StateMachine()->CreatingInitialEmptyDocument()) return; probe::willCommitLoad(frame_, this); frame_->GetIdlenessDetector()->WillCommitLoad(); }
11,290
56,399
0
static int stream_check_done(struct jv_parser* p, jv* out) { if (p->stacklen == 0 && jv_is_valid(p->next)) { *out = JV_ARRAY(jv_copy(p->path),p->next); p->next = jv_invalid(); return 1; } else if (jv_is_valid(p->output)) { if (jv_array_length(jv_copy(p->output)) > 2) { *out = jv_array_slice(jv_copy(p->output), 0, 2); p->output = jv_array_slice(p->output, 0, 1); // arrange one more output } else { *out = p->output; p->output = jv_invalid(); } return 1; } else { return 0; } }
11,291
66,301
0
void* iwpvt_default_malloc(void *userdata, unsigned int flags, size_t n) { if(flags & IW_MALLOCFLAG_ZEROMEM) { return calloc(n,1); } return malloc(n); }
11,292
65,247
0
int nfs_callback_up(u32 minorversion, struct rpc_xprt *xprt) { struct svc_serv *serv; struct nfs_callback_data *cb_info = &nfs_callback_info[minorversion]; int ret; struct net *net = xprt->xprt_net; mutex_lock(&nfs_callback_mutex); serv = nfs_callback_create_svc(minorversion); if (IS_ERR(serv)) { ret = PTR_ERR(serv); goto err_create; } ret = nfs_callback_up_net(minorversion, serv, net, xprt); if (ret < 0) goto err_net; ret = nfs_callback_start_svc(minorversion, xprt, serv); if (ret < 0) goto err_start; cb_info->users++; /* * svc_create creates the svc_serv with sv_nrthreads == 1, and then * svc_prepare_thread increments that. So we need to call svc_destroy * on both success and failure so that the refcount is 1 when the * thread exits. */ err_net: if (!cb_info->users) cb_info->serv = NULL; svc_destroy(serv); err_create: mutex_unlock(&nfs_callback_mutex); return ret; err_start: nfs_callback_down_net(minorversion, serv, net); dprintk("NFS: Couldn't create server thread; err = %d\n", ret); goto err_net; }
11,293
84,881
0
int CIFS_SessSetup(const unsigned int xid, struct cifs_ses *ses, const struct nls_table *nls_cp) { int rc = 0; struct sess_data *sess_data; if (ses == NULL) { WARN(1, "%s: ses == NULL!", __func__); return -EINVAL; } sess_data = kzalloc(sizeof(struct sess_data), GFP_KERNEL); if (!sess_data) return -ENOMEM; rc = select_sec(ses, sess_data); if (rc) goto out; sess_data->xid = xid; sess_data->ses = ses; sess_data->buf0_type = CIFS_NO_BUFFER; sess_data->nls_cp = (struct nls_table *) nls_cp; while (sess_data->func) sess_data->func(sess_data); /* Store result before we free sess_data */ rc = sess_data->result; out: kfree(sess_data); return rc; }
11,294
72,386
0
static PHP_METHOD(PDOStatement, execute) { zval *input_params = NULL; int ret = 1; PHP_STMT_GET_OBJ; if (FAILURE == zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a!", &input_params)) { RETURN_FALSE; } PDO_STMT_CLEAR_ERR(); if (input_params) { struct pdo_bound_param_data param; zval **tmp; uint str_length; ulong num_index; if (stmt->bound_params) { zend_hash_destroy(stmt->bound_params); FREE_HASHTABLE(stmt->bound_params); stmt->bound_params = NULL; } zend_hash_internal_pointer_reset(Z_ARRVAL_P(input_params)); while (SUCCESS == zend_hash_get_current_data(Z_ARRVAL_P(input_params), (void*)&tmp)) { memset(&param, 0, sizeof(param)); if (HASH_KEY_IS_STRING == zend_hash_get_current_key_ex(Z_ARRVAL_P(input_params), &param.name, &str_length, &num_index, 0, NULL)) { /* yes this is correct. we don't want to count the null byte. ask wez */ param.namelen = str_length - 1; param.paramno = -1; } else { /* we're okay to be zero based here */ if (num_index < 0) { pdo_raise_impl_error(stmt->dbh, stmt, "HY093", NULL TSRMLS_CC); RETURN_FALSE; } param.paramno = num_index; } param.param_type = PDO_PARAM_STR; MAKE_STD_ZVAL(param.parameter); MAKE_COPY_ZVAL(tmp, param.parameter); if (!really_register_bound_param(&param, stmt, 1 TSRMLS_CC)) { if (param.parameter) { zval_ptr_dtor(&param.parameter); } RETURN_FALSE; } zend_hash_move_forward(Z_ARRVAL_P(input_params)); } } if (PDO_PLACEHOLDER_NONE == stmt->supports_placeholders) { /* handle the emulated parameter binding, * stmt->active_query_string holds the query with binds expanded and * quoted. */ ret = pdo_parse_params(stmt, stmt->query_string, stmt->query_stringlen, &stmt->active_query_string, &stmt->active_query_stringlen TSRMLS_CC); if (ret == 0) { /* no changes were made */ stmt->active_query_string = stmt->query_string; stmt->active_query_stringlen = stmt->query_stringlen; ret = 1; } else if (ret == -1) { /* something broke */ PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } } else if (!dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_PRE TSRMLS_CC)) { PDO_HANDLE_STMT_ERR(); RETURN_FALSE; } if (stmt->methods->executer(stmt TSRMLS_CC)) { if (stmt->active_query_string && stmt->active_query_string != stmt->query_string) { efree(stmt->active_query_string); } stmt->active_query_string = NULL; if (!stmt->executed) { /* this is the first execute */ if (stmt->dbh->alloc_own_columns && !stmt->columns) { /* for "big boy" drivers, we need to allocate memory to fetch * the results into, so lets do that now */ ret = pdo_stmt_describe_columns(stmt TSRMLS_CC); } stmt->executed = 1; } if (ret && !dispatch_param_event(stmt, PDO_PARAM_EVT_EXEC_POST TSRMLS_CC)) { RETURN_FALSE; } RETURN_BOOL(ret); } if (stmt->active_query_string && stmt->active_query_string != stmt->query_string) { efree(stmt->active_query_string); } stmt->active_query_string = NULL; PDO_HANDLE_STMT_ERR(); RETURN_FALSE; }
11,295
12,332
0
SPL_METHOD(Array, offsetSet) { zval *index, *value; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "zz", &index, &value) == FAILURE) { return; } spl_array_write_dimension_ex(0, getThis(), index, value TSRMLS_CC); } /* }}} */ void spl_array_iterator_append(zval *object, zval *append_value TSRMLS_DC) /* {{{ */
11,296
77,928
0
test_bson_steal (void) { bson_t stack_alloced; bson_t *heap_alloced; bson_t dst; uint8_t *alloc; uint8_t *buf; size_t len; uint32_t len_le; /* inline, stack-allocated */ bson_init (&stack_alloced); BSON_APPEND_INT32 (&stack_alloced, "a", 1); ASSERT (bson_steal (&dst, &stack_alloced)); ASSERT (bson_has_field (&dst, "a")); ASSERT (dst.flags & BSON_FLAG_INLINE); /* src was invalidated */ ASSERT (!bson_validate (&stack_alloced, BSON_VALIDATE_NONE, 0)); bson_destroy (&dst); /* spilled over, stack-allocated */ bson_init (&stack_alloced); bloat (&stack_alloced); alloc = ((bson_impl_alloc_t *) &stack_alloced)->alloc; ASSERT (bson_steal (&dst, &stack_alloced)); /* data was transferred */ ASSERT (alloc == ((bson_impl_alloc_t *) &dst)->alloc); ASSERT (bson_has_field (&dst, "99")); ASSERT (!(dst.flags & BSON_FLAG_INLINE)); ASSERT (!bson_validate (&stack_alloced, BSON_VALIDATE_NONE, 0)); bson_destroy (&dst); /* inline, heap-allocated */ heap_alloced = bson_new (); BSON_APPEND_INT32 (heap_alloced, "a", 1); ASSERT (bson_steal (&dst, heap_alloced)); ASSERT (bson_has_field (&dst, "a")); ASSERT (dst.flags & BSON_FLAG_INLINE); bson_destroy (&dst); /* spilled over, heap-allocated */ heap_alloced = bson_new (); bloat (heap_alloced); alloc = ((bson_impl_alloc_t *) heap_alloced)->alloc; ASSERT (bson_steal (&dst, heap_alloced)); /* data was transferred */ ASSERT (alloc == ((bson_impl_alloc_t *) &dst)->alloc); ASSERT (bson_has_field (&dst, "99")); ASSERT (!(dst.flags & BSON_FLAG_INLINE)); bson_destroy (&dst); /* test stealing from a bson created with bson_new_from_buffer */ buf = bson_malloc0 (5); len = 5; len_le = BSON_UINT32_TO_LE (5); memcpy (buf, &len_le, sizeof (len_le)); heap_alloced = bson_new_from_buffer (&buf, &len, bson_realloc_ctx, NULL); ASSERT (bson_steal (&dst, heap_alloced)); ASSERT (dst.flags & BSON_FLAG_NO_FREE); ASSERT (dst.flags & BSON_FLAG_STATIC); ASSERT (((bson_impl_alloc_t *) &dst)->realloc == bson_realloc_ctx); ASSERT (((bson_impl_alloc_t *) &dst)->realloc_func_ctx == NULL); bson_destroy (&dst); bson_free (buf); }
11,297
163,435
0
bool OmniboxViewViews::HandleAccessibleAction( const ui::AXActionData& action_data) { if (read_only()) return Textfield::HandleAccessibleAction(action_data); if (action_data.action == ui::AX_ACTION_SET_VALUE) { SetUserText(action_data.value, true); return true; } else if (action_data.action == ui::AX_ACTION_REPLACE_SELECTED_TEXT) { model()->SetInputInProgress(true); if (saved_selection_for_focus_change_.IsValid()) { SelectRange(saved_selection_for_focus_change_); saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); } InsertOrReplaceText(action_data.value); TextChanged(); return true; } return Textfield::HandleAccessibleAction(action_data); }
11,298
26,871
0
struct inode *proc_pid_make_inode(struct super_block * sb, struct task_struct *task) { struct inode * inode; struct proc_inode *ei; const struct cred *cred; /* We need a new inode */ inode = new_inode(sb); if (!inode) goto out; /* Common stuff */ ei = PROC_I(inode); inode->i_ino = get_next_ino(); inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; inode->i_op = &proc_def_inode_operations; /* * grab the reference to task. */ ei->pid = get_task_pid(task, PIDTYPE_PID); if (!ei->pid) goto out_unlock; if (task_dumpable(task)) { rcu_read_lock(); cred = __task_cred(task); inode->i_uid = cred->euid; inode->i_gid = cred->egid; rcu_read_unlock(); } security_task_to_inode(task, inode); out: return inode; out_unlock: iput(inode); return NULL; }
11,299