unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
78,844
0
const sc_path_t *sc_get_mf_path(void) { static const sc_path_t mf_path = { {0x3f, 0x00, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}, 2, 0, 0, SC_PATH_TYPE_PATH, {{0},0} }; return &mf_path; }
1,200
186,923
1
htmlInitParserCtxt(htmlParserCtxtPtr ctxt) { htmlSAXHandler *sax; if (ctxt == NULL) return(-1); memset(ctxt, 0, sizeof(htmlParserCtxt)); ctxt->dict = xmlDictCreate(); if (ctxt->dict == NULL) { htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n"); return(-1); } sax = (htmlSAXHandler *) xmlMalloc(sizeof(htmlSAXHandler)); if (sax == NULL) { htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n"); return(-1); } else memset(sax, 0, sizeof(htmlSAXHandler)); /* Allocate the Input stack */ ctxt->inputTab = (htmlParserInputPtr *) xmlMalloc(5 * sizeof(htmlParserInputPtr)); if (ctxt->inputTab == NULL) { htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n"); ctxt->inputNr = 0; ctxt->inputMax = 0; ctxt->input = NULL; return(-1); } ctxt->inputNr = 0; ctxt->inputMax = 5; ctxt->input = NULL; ctxt->version = NULL; ctxt->encoding = NULL; ctxt->standalone = -1; ctxt->instate = XML_PARSER_START; /* Allocate the Node stack */ ctxt->nodeTab = (htmlNodePtr *) xmlMalloc(10 * sizeof(htmlNodePtr)); if (ctxt->nodeTab == NULL) { htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n"); ctxt->nodeNr = 0; ctxt->nodeMax = 0; ctxt->node = NULL; ctxt->inputNr = 0; ctxt->inputMax = 0; ctxt->input = NULL; return(-1); } ctxt->nodeNr = 0; ctxt->nodeMax = 10; ctxt->node = NULL; /* Allocate the Name stack */ ctxt->nameTab = (const xmlChar **) xmlMalloc(10 * sizeof(xmlChar *)); if (ctxt->nameTab == NULL) { htmlErrMemory(NULL, "htmlInitParserCtxt: out of memory\n"); ctxt->nameNr = 0; ctxt->nameMax = 0; ctxt->name = NULL; ctxt->nodeNr = 0; ctxt->nodeMax = 0; ctxt->node = NULL; ctxt->inputNr = 0; ctxt->inputMax = 0; ctxt->input = NULL; return(-1); } ctxt->nameNr = 0; ctxt->nameMax = 10; ctxt->name = NULL; ctxt->nodeInfoTab = NULL; ctxt->nodeInfoNr = 0; ctxt->nodeInfoMax = 0; if (sax == NULL) ctxt->sax = (xmlSAXHandlerPtr) &htmlDefaultSAXHandler; else { ctxt->sax = sax; memcpy(sax, &htmlDefaultSAXHandler, sizeof(xmlSAXHandlerV1)); } ctxt->userData = ctxt; ctxt->myDoc = NULL; ctxt->wellFormed = 1; ctxt->replaceEntities = 0; ctxt->linenumbers = xmlLineNumbersDefaultValue; ctxt->html = 1; ctxt->vctxt.finishDtd = XML_CTXT_FINISH_DTD_0; ctxt->vctxt.userData = ctxt; ctxt->vctxt.error = xmlParserValidityError; ctxt->vctxt.warning = xmlParserValidityWarning; ctxt->record_info = 0; ctxt->validate = 0; ctxt->nbChars = 0; ctxt->checkIndex = 0; ctxt->catalogs = NULL; xmlInitNodeInfoSeq(&ctxt->node_seq); return(0); }
1,201
129,760
0
ChildThread::ChildThread() : router_(this), channel_connected_factory_(this), in_browser_process_(false) { channel_name_ = CommandLine::ForCurrentProcess()->GetSwitchValueASCII( switches::kProcessChannelID); Init(); }
1,202
105,025
0
void FakeURLFetcherFactory::ClearFakeReponses() { fake_responses_.clear(); }
1,203
21,691
0
static void kiocb_batch_init(struct kiocb_batch *batch, long total) { INIT_LIST_HEAD(&batch->head); batch->count = total; }
1,204
77,794
0
static CURLcode fix_hostname(struct connectdata *conn, struct hostname *host) { size_t len; struct Curl_easy *data = conn->data; #ifndef USE_LIBIDN2 (void)data; (void)conn; #elif defined(CURL_DISABLE_VERBOSE_STRINGS) (void)conn; #endif /* set the name we use to display the host name */ host->dispname = host->name; len = strlen(host->name); if(len && (host->name[len-1] == '.')) /* strip off a single trailing dot if present, primarily for SNI but there's no use for it */ host->name[len-1] = 0; /* Check name for non-ASCII and convert hostname to ACE form if we can */ if(!is_ASCII_name(host->name)) { #ifdef USE_LIBIDN2 if(idn2_check_version(IDN2_VERSION)) { char *ace_hostname = NULL; #if IDN2_VERSION_NUMBER >= 0x00140000 /* IDN2_NFC_INPUT: Normalize input string using normalization form C. IDN2_NONTRANSITIONAL: Perform Unicode TR46 non-transitional processing. */ int flags = IDN2_NFC_INPUT | IDN2_NONTRANSITIONAL; #else int flags = IDN2_NFC_INPUT; #endif int rc = idn2_lookup_ul((const char *)host->name, &ace_hostname, flags); if(rc == IDN2_OK) { host->encalloc = (char *)ace_hostname; /* change the name pointer to point to the encoded hostname */ host->name = host->encalloc; } else { failf(data, "Failed to convert %s to ACE; %s\n", host->name, idn2_strerror(rc)); return CURLE_URL_MALFORMAT; } } #elif defined(USE_WIN32_IDN) char *ace_hostname = NULL; if(curl_win32_idn_to_ascii(host->name, &ace_hostname)) { host->encalloc = ace_hostname; /* change the name pointer to point to the encoded hostname */ host->name = host->encalloc; } else { failf(data, "Failed to convert %s to ACE;\n", host->name); return CURLE_URL_MALFORMAT; } #else infof(data, "IDN support not present, can't parse Unicode domains\n"); #endif } { char *hostp; for(hostp = host->name; *hostp; hostp++) { if(*hostp <= 32) { failf(data, "Host name '%s' contains bad letter", host->name); return CURLE_URL_MALFORMAT; } } } return CURLE_OK; }
1,205
6,766
0
static void ide_trim_bh_cb(void *opaque) { TrimAIOCB *iocb = opaque; iocb->common.cb(iocb->common.opaque, iocb->ret); qemu_bh_delete(iocb->bh); iocb->bh = NULL; qemu_aio_unref(iocb); }
1,206
34,921
0
void rpc_show_tasks(void) { struct rpc_clnt *clnt; struct rpc_task *task; int header = 0; spin_lock(&rpc_client_lock); list_for_each_entry(clnt, &all_clients, cl_clients) { spin_lock(&clnt->cl_lock); list_for_each_entry(task, &clnt->cl_tasks, tk_task) { if (!header) { rpc_show_header(); header++; } rpc_show_task(clnt, task); } spin_unlock(&clnt->cl_lock); } spin_unlock(&rpc_client_lock); }
1,207
111,764
0
bool FlagsState::IsRestartNeededToCommitChanges() { return needs_restart_; }
1,208
149,116
0
static void computeYMD_HMS(DateTime *p){ computeYMD(p); computeHMS(p); }
1,209
169,172
0
RenderFrameHostImpl::RenderFrameHostImpl(SiteInstance* site_instance, RenderViewHostImpl* render_view_host, RenderFrameHostDelegate* delegate, RenderWidgetHostDelegate* rwh_delegate, FrameTree* frame_tree, FrameTreeNode* frame_tree_node, int32_t routing_id, int32_t widget_routing_id, bool hidden, bool renderer_initiated_creation) : render_view_host_(render_view_host), delegate_(delegate), site_instance_(static_cast<SiteInstanceImpl*>(site_instance)), process_(site_instance->GetProcess()), frame_tree_(frame_tree), frame_tree_node_(frame_tree_node), parent_(nullptr), render_widget_host_(nullptr), routing_id_(routing_id), is_waiting_for_swapout_ack_(false), render_frame_created_(false), is_waiting_for_beforeunload_ack_(false), unload_ack_is_for_navigation_(false), was_discarded_(false), is_loading_(false), pending_commit_(false), nav_entry_id_(0), accessibility_reset_token_(0), accessibility_reset_count_(0), browser_plugin_embedder_ax_tree_id_(ui::AXTreeIDRegistry::kNoAXTreeID), no_create_browser_accessibility_manager_for_testing_(false), web_ui_type_(WebUI::kNoWebUI), pending_web_ui_type_(WebUI::kNoWebUI), should_reuse_web_ui_(false), has_selection_(false), is_audible_(false), last_navigation_previews_state_(PREVIEWS_UNSPECIFIED), frame_host_associated_binding_(this), waiting_for_init_(renderer_initiated_creation), has_focused_editable_element_(false), active_sandbox_flags_(blink::WebSandboxFlags::kNone), document_scoped_interface_provider_binding_(this), keep_alive_timeout_(base::TimeDelta::FromSeconds(30)), weak_ptr_factory_(this) { frame_tree_->AddRenderViewHostRef(render_view_host_); GetProcess()->AddRoute(routing_id_, this); g_routing_id_frame_map.Get().insert(std::make_pair( RenderFrameHostID(GetProcess()->GetID(), routing_id_), this)); site_instance_->AddObserver(this); GetSiteInstance()->IncrementActiveFrameCount(); if (frame_tree_node_->parent()) { parent_ = frame_tree_node_->parent()->current_frame_host(); if (parent_->GetEnabledBindings()) enabled_bindings_ = parent_->GetEnabledBindings(); set_nav_entry_id( frame_tree_node_->parent()->current_frame_host()->nav_entry_id()); } SetUpMojoIfNeeded(); swapout_event_monitor_timeout_.reset(new TimeoutMonitor(base::Bind( &RenderFrameHostImpl::OnSwappedOut, weak_ptr_factory_.GetWeakPtr()))); beforeunload_timeout_.reset( new TimeoutMonitor(base::Bind(&RenderFrameHostImpl::BeforeUnloadTimeout, weak_ptr_factory_.GetWeakPtr()))); if (widget_routing_id != MSG_ROUTING_NONE) { mojom::WidgetPtr widget; GetRemoteInterfaces()->GetInterface(&widget); render_widget_host_ = RenderWidgetHostImpl::FromID(GetProcess()->GetID(), widget_routing_id); mojom::WidgetInputHandlerAssociatedPtr widget_handler; mojom::WidgetInputHandlerHostRequest host_request; if (frame_input_handler_) { mojom::WidgetInputHandlerHostPtr host; host_request = mojo::MakeRequest(&host); frame_input_handler_->GetWidgetInputHandler( mojo::MakeRequest(&widget_handler), std::move(host)); } if (!render_widget_host_) { DCHECK(frame_tree_node->parent()); render_widget_host_ = RenderWidgetHostFactory::Create( rwh_delegate, GetProcess(), widget_routing_id, std::move(widget), hidden); render_widget_host_->set_owned_by_render_frame_host(true); } else { DCHECK(!render_widget_host_->owned_by_render_frame_host()); render_widget_host_->SetWidget(std::move(widget)); } render_widget_host_->SetFrameDepth(frame_tree_node_->depth()); render_widget_host_->SetWidgetInputHandler(std::move(widget_handler), std::move(host_request)); render_widget_host_->input_router()->SetFrameTreeNodeId( frame_tree_node_->frame_tree_node_id()); } ResetFeaturePolicy(); ax_tree_id_ = ui::AXTreeIDRegistry::GetInstance()->GetOrCreateAXTreeID( GetProcess()->GetID(), routing_id_); FrameTreeNode* frame_owner = frame_tree_node_->parent() ? frame_tree_node_->parent() : frame_tree_node_->opener(); if (frame_owner) CSPContext::SetSelf(frame_owner->current_origin()); }
1,210
142,535
0
bool changed_auto_hide_state() const { return changed_auto_hide_state_; }
1,211
1,501
0
static void coroutine_fn v9fs_read(void *opaque) { int32_t fid; uint64_t off; ssize_t err = 0; int32_t count = 0; size_t offset = 7; uint32_t max_count; V9fsFidState *fidp; V9fsPDU *pdu = opaque; V9fsState *s = pdu->s; err = pdu_unmarshal(pdu, offset, "dqd", &fid, &off, &max_count); if (err < 0) { goto out_nofid; } trace_v9fs_read(pdu->tag, pdu->id, fid, off, max_count); fidp = get_fid(pdu, fid); if (fidp == NULL) { err = -EINVAL; goto out_nofid; } if (fidp->fid_type == P9_FID_DIR) { if (off == 0) { v9fs_co_rewinddir(pdu, fidp); } count = v9fs_do_readdir_with_stat(pdu, fidp, max_count); if (count < 0) { err = count; goto out; } err = pdu_marshal(pdu, offset, "d", count); if (err < 0) { goto out; } err += offset + count; } else if (fidp->fid_type == P9_FID_FILE) { QEMUIOVector qiov_full; QEMUIOVector qiov; int32_t len; v9fs_init_qiov_from_pdu(&qiov_full, pdu, offset + 4, max_count, false); qemu_iovec_init(&qiov, qiov_full.niov); do { qemu_iovec_reset(&qiov); qemu_iovec_concat(&qiov, &qiov_full, count, qiov_full.size - count); if (0) { print_sg(qiov.iov, qiov.niov); } /* Loop in case of EINTR */ do { len = v9fs_co_preadv(pdu, fidp, qiov.iov, qiov.niov, off); if (len >= 0) { off += len; count += len; } } while (len == -EINTR && !pdu->cancelled); if (len < 0) { /* IO error return the error */ err = len; goto out_free_iovec; } } while (count < max_count && len > 0); err = pdu_marshal(pdu, offset, "d", count); if (err < 0) { goto out_free_iovec; } err += offset + count; out_free_iovec: qemu_iovec_destroy(&qiov); qemu_iovec_destroy(&qiov_full); } else if (fidp->fid_type == P9_FID_XATTR) { err = v9fs_xattr_read(s, pdu, fidp, off, max_count); } else { err = -EINVAL; } trace_v9fs_read_return(pdu->tag, pdu->id, count, err); out: put_fid(pdu, fidp); out_nofid: pdu_complete(pdu, err); }
1,212
75,908
0
start_keepalived(void) { bool have_child = false; #ifdef _WITH_BFD_ /* must be opened before vrrp and bfd start */ open_bfd_pipes(); #endif #ifdef _WITH_LVS_ /* start healthchecker child */ if (running_checker()) { start_check_child(); have_child = true; } #endif #ifdef _WITH_VRRP_ /* start vrrp child */ if (running_vrrp()) { start_vrrp_child(); have_child = true; } #endif #ifdef _WITH_BFD_ /* start bfd child */ if (running_bfd()) { start_bfd_child(); have_child = true; } #endif return have_child; }
1,213
145,894
0
gfx::Rect GetTransformedTargetBounds(aura::Window* window) { gfx::Rect bounds_in_screen = window->layer()->GetTargetBounds(); ::wm::ConvertRectToScreen(window->parent(), &bounds_in_screen); gfx::RectF bounds(bounds_in_screen); gfx::Transform transform( gfx::TransformAboutPivot(gfx::ToFlooredPoint(bounds.origin()), window->layer()->GetTargetTransform())); transform.TransformRect(&bounds); return gfx::ToEnclosingRect(bounds); }
1,214
141,357
0
void Document::setBgColor(const AtomicString& value) { if (!IsFrameSet()) SetBodyAttribute(kBgcolorAttr, value); }
1,215
99,237
0
void PrintJobWorker::DismissDialog() { printing_context_.DismissDialog(); }
1,216
82,831
0
char* MACH0_(get_cpusubtype)(struct MACH0_(obj_t)* bin) { if (bin) { return MACH0_(get_cpusubtype_from_hdr) (&bin->hdr); } return strdup ("Unknown"); }
1,217
13,988
0
gsicc_profile_reference(cmm_profile_t *icc_profile, int delta) { if (icc_profile != NULL) rc_adjust(icc_profile, delta, "gsicc_profile_reference"); }
1,218
172,075
0
static inline int connect_server_socket(const char* name) { int s = socket(AF_LOCAL, SOCK_STREAM, 0); if(s < 0) return -1; set_socket_blocking(s, TRUE); if(socket_local_client_connect(s, name, ANDROID_SOCKET_NAMESPACE_ABSTRACT, SOCK_STREAM) >= 0) { APPL_TRACE_DEBUG("connected to local socket:%s, fd:%d", name, s); return s; } else APPL_TRACE_ERROR("connect to local socket:%s, fd:%d failed, errno:%d", name, s, errno); close(s); return -1; }
1,219
117,118
0
static void toplevelWindowResizeGripVisibilityChanged(GObject* object, GParamSpec*, WebKitWebViewBase* webViewBase) { webkitWebViewBaseNotifyResizerSizeForWindow(webViewBase, GTK_WINDOW(object)); }
1,220
90,047
0
ZSTD_CStream* ZSTD_createCStream_advanced(ZSTD_customMem customMem) { /* CStream and CCtx are now same object */ return ZSTD_createCCtx_advanced(customMem); }
1,221
97,285
0
static void endElementNsHandler(void* closure, const xmlChar*, const xmlChar*, const xmlChar*) { if (hackAroundLibXMLEntityBug(closure)) return; getTokenizer(closure)->endElementNs(); }
1,222
94,558
0
cdf_u16tos8(char *buf, size_t len, const uint16_t *p) { size_t i; for (i = 0; i < len && p[i]; i++) buf[i] = (char)p[i]; buf[i] = '\0'; return buf; }
1,223
112,405
0
static Editor::Command command(Document* document, const String& commandName, bool userInterface = false) { Frame* frame = document->frame(); if (!frame || frame->document() != document) return Editor::Command(); document->updateStyleIfNeeded(); return frame->editor()->command(commandName, userInterface ? CommandFromDOMWithUserInterface : CommandFromDOM); }
1,224
151,338
0
void InspectorTraceEvents::Did(const probe::ParseHTML& probe) { TRACE_EVENT_END1( "devtools.timeline", "ParseHTML", "endData", InspectorParseHtmlEndData(probe.parser->LineNumber().ZeroBasedInt() - 1)); TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::Data()); }
1,225
48,305
0
PixarLogPreDecode(TIFF* tif, uint16 s) { static const char module[] = "PixarLogPreDecode"; PixarLogState* sp = DecoderState(tif); (void) s; assert(sp != NULL); sp->stream.next_in = tif->tif_rawdata; assert(sizeof(sp->stream.avail_in)==4); /* if this assert gets raised, we need to simplify this code to reflect a ZLib that is likely updated to deal with 8byte memory sizes, though this code will respond appropriately even before we simplify it */ sp->stream.avail_in = (uInt) tif->tif_rawcc; if ((tmsize_t)sp->stream.avail_in != tif->tif_rawcc) { TIFFErrorExt(tif->tif_clientdata, module, "ZLib cannot deal with buffers this size"); return (0); } return (inflateReset(&sp->stream) == Z_OK); }
1,226
53,750
0
static int fixed_mtrr_addr_seg_to_range_index(u64 addr, int seg) { struct fixed_mtrr_segment *mtrr_seg; int index; mtrr_seg = &fixed_seg_table[seg]; index = mtrr_seg->range_start; index += (addr - mtrr_seg->start) >> mtrr_seg->range_shift; return index; }
1,227
145,336
0
bool HTMLAnchorElement::isLiveLink() const { return isLink() && !hasEditableStyle(); }
1,228
107,986
0
void encode(ArgumentEncoder* encoder, CFArrayRef array) { CFIndex size = CFArrayGetCount(array); Vector<CFTypeRef, 32> values(size); CFArrayGetValues(array, CFRangeMake(0, size), values.data()); encoder->encodeUInt64(size); for (CFIndex i = 0; i < size; ++i) { ASSERT(values[i]); encode(encoder, values[i]); } }
1,229
131,259
0
static void callWithScriptStateExecutionContextVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); ScriptState* currentState = ScriptState::current(); if (!currentState) return; ScriptState& state = *currentState; ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()); imp->callWithScriptStateExecutionContextVoidMethod(&state, scriptContext); if (state.hadException()) { v8::Local<v8::Value> exception = state.exception(); state.clearException(); throwError(exception, info.GetIsolate()); return; } }
1,230
128,375
0
bool FrameView::wasScrolledByUser() const { return m_wasScrolledByUser; }
1,231
97,026
0
static int anon_pipe_buf_steal(struct pipe_inode_info *pipe, struct pipe_buffer *buf) { struct page *page = buf->page; if (page_count(page) == 1) { if (memcg_kmem_enabled()) memcg_kmem_uncharge(page, 0); __SetPageLocked(page); return 0; } return 1; }
1,232
34,832
0
static inline int iskeychar(int c) { return isalnum(c) || c == '-'; }
1,233
150,872
0
void BluetoothAdapter::NotifyGattServicesDiscovered(BluetoothDevice* device) { DCHECK(device->GetAdapter() == this); for (auto& observer : observers_) observer.GattServicesDiscovered(this, device); }
1,234
28,787
0
int kvm_x2apic_msr_write(struct kvm_vcpu *vcpu, u32 msr, u64 data) { struct kvm_lapic *apic = vcpu->arch.apic; u32 reg = (msr - APIC_BASE_MSR) << 4; if (!irqchip_in_kernel(vcpu->kvm) || !apic_x2apic_mode(apic)) return 1; /* if this is ICR write vector before command */ if (msr == 0x830) apic_reg_write(apic, APIC_ICR2, (u32)(data >> 32)); return apic_reg_write(apic, reg, (u32)data); }
1,235
86,952
0
static void show_elfs(struct user_ta_ctx *utc) { struct user_ta_elf *elf; size_t __maybe_unused idx = 0; TAILQ_FOREACH(elf, &utc->elfs, link) EMSG_RAW(" [%zu] %pUl @ %#" PRIxVA, idx++, (void *)&elf->uuid, elf->load_addr); }
1,236
175,159
0
sp<ABuffer> NuPlayer::GenericSource::mediaBufferToABuffer( MediaBuffer* mb, media_track_type trackType, int64_t *actualTimeUs) { bool audio = trackType == MEDIA_TRACK_TYPE_AUDIO; size_t outLength = mb->range_length(); if (audio && mAudioIsVorbis) { outLength += sizeof(int32_t); } sp<ABuffer> ab; if (mIsWidevine && !audio) { ab = new ABuffer(NULL, mb->range_length()); mb->add_ref(); ab->setMediaBufferBase(mb); } else { ab = new ABuffer(outLength); memcpy(ab->data(), (const uint8_t *)mb->data() + mb->range_offset(), mb->range_length()); } if (audio && mAudioIsVorbis) { int32_t numPageSamples; if (!mb->meta_data()->findInt32(kKeyValidSamples, &numPageSamples)) { numPageSamples = -1; } uint8_t* abEnd = ab->data() + mb->range_length(); memcpy(abEnd, &numPageSamples, sizeof(numPageSamples)); } sp<AMessage> meta = ab->meta(); int64_t timeUs; CHECK(mb->meta_data()->findInt64(kKeyTime, &timeUs)); meta->setInt64("timeUs", timeUs); if (trackType == MEDIA_TRACK_TYPE_TIMEDTEXT) { const char *mime; CHECK(mTimedTextTrack.mSource != NULL && mTimedTextTrack.mSource->getFormat()->findCString(kKeyMIMEType, &mime)); meta->setString("mime", mime); } int64_t durationUs; if (mb->meta_data()->findInt64(kKeyDuration, &durationUs)) { meta->setInt64("durationUs", durationUs); } if (trackType == MEDIA_TRACK_TYPE_SUBTITLE) { meta->setInt32("trackIndex", mSubtitleTrack.mIndex); } if (actualTimeUs) { *actualTimeUs = timeUs; } mb->release(); mb = NULL; return ab; }
1,237
103,901
0
void RenderView::didStopLoading() { if (!is_loading_) { DLOG(WARNING) << "DidStopLoading called while not loading"; return; } is_loading_ = false; Send(new ViewHostMsg_DidStopLoading(routing_id_)); if (load_progress_tracker_ != NULL) load_progress_tracker_->DidStopLoading(); FOR_EACH_OBSERVER(RenderViewObserver, observers_, DidStopLoading()); }
1,238
185,107
1
bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, bool recursive) { base::ThreadRestrictions::AssertIOAllowed(); // Some old callers of CopyDirectory want it to support wildcards. // After some discussion, we decided to fix those callers. // Break loudly here if anyone tries to do this. // TODO(evanm): remove this once we're sure it's ok. DCHECK(to_path.value().find('*') == std::string::npos); DCHECK(from_path.value().find('*') == std::string::npos); char top_dir[PATH_MAX]; if (base::strlcpy(top_dir, from_path.value().c_str(), arraysize(top_dir)) >= arraysize(top_dir)) { return false; } // This function does not properly handle destinations within the source FilePath real_to_path = to_path; if (PathExists(real_to_path)) { if (!AbsolutePath(&real_to_path)) return false; } else { real_to_path = real_to_path.DirName(); if (!AbsolutePath(&real_to_path)) return false; } FilePath real_from_path = from_path; if (!AbsolutePath(&real_from_path)) return false; if (real_to_path.value().size() >= real_from_path.value().size() && real_to_path.value().compare(0, real_from_path.value().size(), real_from_path.value()) == 0) return false; bool success = true; int traverse_type = FileEnumerator::FILES | FileEnumerator::SHOW_SYM_LINKS; if (recursive) traverse_type |= FileEnumerator::DIRECTORIES; FileEnumerator traversal(from_path, recursive, traverse_type); // We have to mimic windows behavior here. |to_path| may not exist yet, // start the loop with |to_path|. FileEnumerator::FindInfo info; FilePath current = from_path; if (stat(from_path.value().c_str(), &info.stat) < 0) { DLOG(ERROR) << "CopyDirectory() couldn't stat source directory: " << from_path.value() << " errno = " << errno; success = false; } struct stat to_path_stat; FilePath from_path_base = from_path; if (recursive && stat(to_path.value().c_str(), &to_path_stat) == 0 && S_ISDIR(to_path_stat.st_mode)) { // If the destination already exists and is a directory, then the // top level of source needs to be copied. from_path_base = from_path.DirName(); } // The Windows version of this function assumes that non-recursive calls // will always have a directory for from_path. DCHECK(recursive || S_ISDIR(info.stat.st_mode)); while (success && !current.empty()) { // current is the source path, including from_path, so paste // the suffix after from_path onto to_path to create the target_path. std::string suffix(&current.value().c_str()[from_path_base.value().size()]); // Strip the leading '/' (if any). if (!suffix.empty()) { DCHECK_EQ('/', suffix[0]); suffix.erase(0, 1); } const FilePath target_path = to_path.Append(suffix); if (S_ISDIR(info.stat.st_mode)) { if (mkdir(target_path.value().c_str(), info.stat.st_mode & 01777) != 0 && errno != EEXIST) { DLOG(ERROR) << "CopyDirectory() couldn't create directory: " << target_path.value() << " errno = " << errno; success = false; } } else if (S_ISREG(info.stat.st_mode)) { if (!CopyFile(current, target_path)) { DLOG(ERROR) << "CopyDirectory() couldn't create file: " << target_path.value(); success = false; } } else { DLOG(WARNING) << "CopyDirectory() skipping non-regular file: " << current.value(); } current = traversal.Next(); traversal.GetFindInfo(&info); } return success; }
1,239
37,043
0
static inline void ept_sync_global(void) { if (cpu_has_vmx_invept_global()) __invept(VMX_EPT_EXTENT_GLOBAL, 0, 0); }
1,240
117,689
0
void InProcessBrowserTest::SetUp() { ASSERT_TRUE(CreateUserDataDirectory()) << "Could not create user data directory."; DCHECK(g_browser_process); delete g_browser_process; g_browser_process = NULL; ASSERT_TRUE(SetUpUserDataDirectory()) << "Could not set up user data directory."; CommandLine* command_line = CommandLine::ForCurrentProcess(); SetUpCommandLine(command_line); PrepareTestCommandLine(command_line); if (command_line->HasSwitch(switches::kSingleProcess)) { content::RenderProcessHost::set_run_renderer_in_process(true); single_process_renderer_client_.reset( new content::MockContentRendererClient); content::GetContentClient()->set_renderer( single_process_renderer_client_.get()); } #if defined(OS_CHROMEOS) FilePath log_dir = logging::GetSessionLogFile(*command_line).DirName(); file_util::CreateDirectory(log_dir); #endif // defined(OS_CHROMEOS) host_resolver_ = new net::RuleBasedHostResolverProc(NULL); host_resolver_->AddSimulatedFailure("*.google.com"); host_resolver_->AddSimulatedFailure("wpad"); net::ScopedDefaultHostResolverProc scoped_host_resolver_proc( host_resolver_.get()); BrowserTestBase::SetUp(); }
1,241
24,932
0
static int sysfs_slab_alias(struct kmem_cache *s, const char *name) { struct saved_alias *al; if (slab_state == SYSFS) { /* * If we have a leftover link then remove it. */ sysfs_remove_link(&slab_kset->kobj, name); return sysfs_create_link(&slab_kset->kobj, &s->kobj, name); } al = kmalloc(sizeof(struct saved_alias), GFP_KERNEL); if (!al) return -ENOMEM; al->s = s; al->name = name; al->next = alias_list; alias_list = al; return 0; }
1,242
38,721
0
static struct ath_frame_info *get_frame_info(struct sk_buff *skb) { struct ieee80211_tx_info *tx_info = IEEE80211_SKB_CB(skb); BUILD_BUG_ON(sizeof(struct ath_frame_info) > sizeof(tx_info->rate_driver_data)); return (struct ath_frame_info *) &tx_info->rate_driver_data[0]; }
1,243
91,047
0
void CWebServer::RType_CustomLightIcons(WebEmSession & session, const request& req, Json::Value &root) { int ii = 0; std::vector<_tCustomIcon> temp_custom_light_icons = m_custom_light_icons; std::sort(temp_custom_light_icons.begin(), temp_custom_light_icons.end(), compareIconsByName); for (const auto & itt : temp_custom_light_icons) { root["result"][ii]["idx"] = itt.idx; root["result"][ii]["imageSrc"] = itt.RootFile; root["result"][ii]["text"] = itt.Title; root["result"][ii]["description"] = itt.Description; ii++; } root["status"] = "OK"; }
1,244
93,230
0
network_prefix(int ae, int plen, unsigned int omitted, const unsigned char *p, const unsigned char *dp, unsigned int len, unsigned char *p_r) { unsigned pb; unsigned char prefix[16]; int consumed = 0; if(plen >= 0) pb = (plen + 7) / 8; else if(ae == 1) pb = 4; else pb = 16; if(pb > 16) return -1; memset(prefix, 0, 16); switch(ae) { case 0: break; case 1: if(omitted > 4 || pb > 4 || (pb > omitted && len < pb - omitted)) return -1; memcpy(prefix, v4prefix, 12); if(omitted) { if (dp == NULL) return -1; memcpy(prefix, dp, 12 + omitted); } if(pb > omitted) { memcpy(prefix + 12 + omitted, p, pb - omitted); consumed = pb - omitted; } break; case 2: if(omitted > 16 || (pb > omitted && len < pb - omitted)) return -1; if(omitted) { if (dp == NULL) return -1; memcpy(prefix, dp, omitted); } if(pb > omitted) { memcpy(prefix + omitted, p, pb - omitted); consumed = pb - omitted; } break; case 3: if(pb > 8 && len < pb - 8) return -1; prefix[0] = 0xfe; prefix[1] = 0x80; if(pb > 8) { memcpy(prefix + 8, p, pb - 8); consumed = pb - 8; } break; default: return -1; } memcpy(p_r, prefix, 16); return consumed; }
1,245
108,806
0
void RevokeAllPermissionsForFile(const FilePath& file) { FilePath stripped = file.StripTrailingSeparators(); file_permissions_.erase(stripped); request_file_set_.erase(stripped); }
1,246
148,407
0
WebContentsImpl* WebContentsImpl::GetOuterWebContents() { if (GuestMode::IsCrossProcessFrameGuest(this)) return node_.outer_web_contents(); if (browser_plugin_guest_) return browser_plugin_guest_->embedder_web_contents(); return nullptr; }
1,247
88,705
0
static void dwc3_stop_active_transfer(struct dwc3 *dwc, u32 epnum, bool force) { struct dwc3_ep *dep; struct dwc3_gadget_ep_cmd_params params; u32 cmd; int ret; dep = dwc->eps[epnum]; if ((dep->flags & DWC3_EP_END_TRANSFER_PENDING) || !dep->resource_index) return; /* * NOTICE: We are violating what the Databook says about the * EndTransfer command. Ideally we would _always_ wait for the * EndTransfer Command Completion IRQ, but that's causing too * much trouble synchronizing between us and gadget driver. * * We have discussed this with the IP Provider and it was * suggested to giveback all requests here, but give HW some * extra time to synchronize with the interconnect. We're using * an arbitrary 100us delay for that. * * Note also that a similar handling was tested by Synopsys * (thanks a lot Paul) and nothing bad has come out of it. * In short, what we're doing is: * * - Issue EndTransfer WITH CMDIOC bit set * - Wait 100us * * As of IP version 3.10a of the DWC_usb3 IP, the controller * supports a mode to work around the above limitation. The * software can poll the CMDACT bit in the DEPCMD register * after issuing a EndTransfer command. This mode is enabled * by writing GUCTL2[14]. This polling is already done in the * dwc3_send_gadget_ep_cmd() function so if the mode is * enabled, the EndTransfer command will have completed upon * returning from this function and we don't need to delay for * 100us. * * This mode is NOT available on the DWC_usb31 IP. */ cmd = DWC3_DEPCMD_ENDTRANSFER; cmd |= force ? DWC3_DEPCMD_HIPRI_FORCERM : 0; cmd |= DWC3_DEPCMD_CMDIOC; cmd |= DWC3_DEPCMD_PARAM(dep->resource_index); memset(&params, 0, sizeof(params)); ret = dwc3_send_gadget_ep_cmd(dep, cmd, &params); WARN_ON_ONCE(ret); dep->resource_index = 0; dep->flags &= ~DWC3_EP_BUSY; if (dwc3_is_usb31(dwc) || dwc->revision < DWC3_REVISION_310A) { dep->flags |= DWC3_EP_END_TRANSFER_PENDING; udelay(100); } }
1,248
125,496
0
EntryInfoResult::EntryInfoResult() : error(GDATA_FILE_ERROR_FAILED) { }
1,249
26,527
0
static ssize_t pmcraid_store_log_level( struct device *dev, struct device_attribute *attr, const char *buf, size_t count ) { struct Scsi_Host *shost; struct pmcraid_instance *pinstance; unsigned long val; if (strict_strtoul(buf, 10, &val)) return -EINVAL; /* log-level should be from 0 to 2 */ if (val > 2) return -EINVAL; shost = class_to_shost(dev); pinstance = (struct pmcraid_instance *)shost->hostdata; pinstance->current_log_level = val; return strlen(buf); }
1,250
167,555
0
base::Process ShowSingletonTab(const GURL& page) { ::ShowSingletonTab(browser(), page); WebContents* wc = browser()->tab_strip_model()->GetActiveWebContents(); CHECK(wc->GetURL() == page); WaitForLauncherThread(); WaitForMessageProcessing(wc); return ProcessFromHandle( wc->GetMainFrame()->GetProcess()->GetProcess().Handle()); }
1,251
116,358
0
static void ETagGet_ConditionalRequest_NoStore_Handler( const net::HttpRequestInfo* request, std::string* response_status, std::string* response_headers, std::string* response_data) { EXPECT_TRUE( request->extra_headers.HasHeader(net::HttpRequestHeaders::kIfNoneMatch)); response_status->assign("HTTP/1.1 304 Not Modified"); response_headers->assign("Cache-Control: no-store\n"); response_data->clear(); }
1,252
112,933
0
void GetHostedDocumentURLBlockingThread(const FilePath& gdata_cache_path, GURL* url) { std::string json; if (!file_util::ReadFileToString(gdata_cache_path, &json)) { NOTREACHED() << "Unable to read file " << gdata_cache_path.value(); return; } DVLOG(1) << "Hosted doc content " << json; scoped_ptr<base::Value> val(base::JSONReader::Read(json)); base::DictionaryValue* dict_val; if (!val.get() || !val->GetAsDictionary(&dict_val)) { NOTREACHED() << "Parse failure for " << json; return; } std::string edit_url; if (!dict_val->GetString("url", &edit_url)) { NOTREACHED() << "url field doesn't exist in " << json; return; } *url = GURL(edit_url); DVLOG(1) << "edit url " << *url; }
1,253
55,154
0
static void write_branch_report(FILE *rpt, struct branch *b) { fprintf(rpt, "%s:\n", b->name); fprintf(rpt, " status :"); if (b->active) fputs(" active", rpt); if (b->branch_tree.tree) fputs(" loaded", rpt); if (is_null_sha1(b->branch_tree.versions[1].sha1)) fputs(" dirty", rpt); fputc('\n', rpt); fprintf(rpt, " tip commit : %s\n", sha1_to_hex(b->sha1)); fprintf(rpt, " old tree : %s\n", sha1_to_hex(b->branch_tree.versions[0].sha1)); fprintf(rpt, " cur tree : %s\n", sha1_to_hex(b->branch_tree.versions[1].sha1)); fprintf(rpt, " commit clock: %" PRIuMAX "\n", b->last_commit); fputs(" last pack : ", rpt); if (b->pack_id < MAX_PACK_ID) fprintf(rpt, "%u", b->pack_id); fputc('\n', rpt); fputc('\n', rpt); }
1,254
174,422
0
int aacDecoder_drcEpilog ( HANDLE_AAC_DRC self, HANDLE_FDK_BITSTREAM hBs, CAacDecoderStaticChannelInfo *pAacDecoderStaticChannelInfo[], UCHAR pceInstanceTag, UCHAR channelMapping[], /* Channel mapping translating drcChannel index to canonical channel index */ int validChannels ) { int err = 0; if (self == NULL) { return -1; } if (self->params.bsDelayEnable) { err = aacDecoder_drcExtractAndMap ( self, hBs, pAacDecoderStaticChannelInfo, pceInstanceTag, channelMapping, validChannels ); } return err; }
1,255
102,210
0
DirectoryManager* dir_manager() { return share_.dir_manager.get(); }
1,256
125,129
0
bool PluginServiceImpl::GetPluginInfoByPath(const FilePath& plugin_path, webkit::WebPluginInfo* info) { std::vector<webkit::WebPluginInfo> plugins; plugin_list_->GetPluginsNoRefresh(&plugins); for (std::vector<webkit::WebPluginInfo>::iterator it = plugins.begin(); it != plugins.end(); ++it) { if (it->path == plugin_path) { *info = *it; return true; } } return false; }
1,257
43,800
0
iakerb_release_context(iakerb_ctx_id_t ctx) { OM_uint32 tmp; if (ctx == NULL) return; krb5_gss_release_cred(&tmp, &ctx->defcred); krb5_init_creds_free(ctx->k5c, ctx->icc); krb5_tkt_creds_free(ctx->k5c, ctx->tcc); krb5_gss_delete_sec_context(&tmp, &ctx->gssc, NULL); krb5_free_data_contents(ctx->k5c, &ctx->conv); krb5_get_init_creds_opt_free(ctx->k5c, ctx->gic_opts); krb5_free_context(ctx->k5c); free(ctx); }
1,258
137,537
0
bool PrintWebViewHelper::InitPrintSettings(bool fit_to_paper_size) { PrintMsg_PrintPages_Params settings; Send(new PrintHostMsg_GetDefaultPrintSettings(routing_id(), &settings.params)); bool result = true; if (!PrintMsg_Print_Params_IsValid(settings.params)) result = false; ignore_css_margins_ = false; settings.pages.clear(); settings.params.print_scaling_option = blink::WebPrintScalingOptionSourceSize; if (fit_to_paper_size) { settings.params.print_scaling_option = blink::WebPrintScalingOptionFitToPrintableArea; } SetPrintPagesParams(settings); return result; }
1,259
149,631
0
void ResourcePrefetchPredictor::RecordPageRequestSummary( std::unique_ptr<PageRequestSummary> summary) { DCHECK_CURRENTLY_ON(BrowserThread::UI); if (initialization_state_ == NOT_INITIALIZED) { StartInitialization(); return; } else if (initialization_state_ == INITIALIZING) { return; } else if (initialization_state_ != INITIALIZED) { NOTREACHED() << "Unexpected initialization_state_: " << initialization_state_; return; } LearnRedirect(summary->initial_url.host(), summary->main_frame_url, host_redirect_data_.get()); LearnOrigins(summary->main_frame_url.host(), summary->main_frame_url.GetOrigin(), summary->origins); if (observer_) observer_->OnNavigationLearned(*summary); }
1,260
68,210
0
void llc_sap_remove_socket(struct llc_sap *sap, struct sock *sk) { struct llc_sock *llc = llc_sk(sk); spin_lock_bh(&sap->sk_lock); sk_nulls_del_node_init_rcu(sk); hlist_del(&llc->dev_hash_node); sap->sk_count--; spin_unlock_bh(&sap->sk_lock); llc_sap_put(sap); }
1,261
187,929
1
WORD32 ih264d_read_mmco_commands(struct _DecStruct * ps_dec) { dec_bit_stream_t *ps_bitstrm = ps_dec->ps_bitstrm; dpb_commands_t *ps_dpb_cmds = ps_dec->ps_dpb_cmds; dec_slice_params_t * ps_slice = ps_dec->ps_cur_slice; WORD32 j; UWORD8 u1_buf_mode; struct MMCParams *ps_mmc_params; UWORD32 *pu4_bitstrm_buf = ps_dec->ps_bitstrm->pu4_buffer; UWORD32 *pu4_bitstrm_ofst = &ps_bitstrm->u4_ofst; UWORD32 u4_bit_ofst = ps_dec->ps_bitstrm->u4_ofst; ps_slice->u1_mmco_equalto5 = 0; { if(ps_dec->u1_nal_unit_type == IDR_SLICE_NAL) { ps_slice->u1_no_output_of_prior_pics_flag = ih264d_get_bit_h264(ps_bitstrm); COPYTHECONTEXT("SH: no_output_of_prior_pics_flag", ps_slice->u1_no_output_of_prior_pics_flag); ps_slice->u1_long_term_reference_flag = ih264d_get_bit_h264( ps_bitstrm); COPYTHECONTEXT("SH: long_term_reference_flag", ps_slice->u1_long_term_reference_flag); ps_dpb_cmds->u1_idr_pic = 1; ps_dpb_cmds->u1_no_output_of_prior_pics_flag = ps_slice->u1_no_output_of_prior_pics_flag; ps_dpb_cmds->u1_long_term_reference_flag = ps_slice->u1_long_term_reference_flag; } else { u1_buf_mode = ih264d_get_bit_h264(ps_bitstrm); //0 - sliding window; 1 - arbitrary COPYTHECONTEXT("SH: adaptive_ref_pic_buffering_flag", u1_buf_mode); ps_dpb_cmds->u1_buf_mode = u1_buf_mode; j = 0; if(u1_buf_mode == 1) { UWORD32 u4_mmco; UWORD32 u4_diff_pic_num; UWORD32 u4_lt_idx, u4_max_lt_idx; u4_mmco = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); while(u4_mmco != END_OF_MMCO) { ps_mmc_params = &ps_dpb_cmds->as_mmc_params[j]; ps_mmc_params->u4_mmco = u4_mmco; switch(u4_mmco) { case MARK_ST_PICNUM_AS_NONREF: u4_diff_pic_num = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); ps_mmc_params->u4_diff_pic_num = u4_diff_pic_num; break; case MARK_LT_INDEX_AS_NONREF: u4_lt_idx = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); ps_mmc_params->u4_lt_idx = u4_lt_idx; break; case MARK_ST_PICNUM_AS_LT_INDEX: u4_diff_pic_num = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); ps_mmc_params->u4_diff_pic_num = u4_diff_pic_num; u4_lt_idx = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); ps_mmc_params->u4_lt_idx = u4_lt_idx; break; case SET_MAX_LT_INDEX: { u4_max_lt_idx = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); ps_mmc_params->u4_max_lt_idx_plus1 = u4_max_lt_idx; break; } case RESET_REF_PICTURES: { ps_slice->u1_mmco_equalto5 = 1; break; } case SET_LT_INDEX: u4_lt_idx = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); ps_mmc_params->u4_lt_idx = u4_lt_idx; break; default: break; } u4_mmco = ih264d_uev(pu4_bitstrm_ofst, pu4_bitstrm_buf); j++; } ps_dpb_cmds->u1_num_of_commands = j; } } ps_dpb_cmds->u1_dpb_commands_read = 1; ps_dpb_cmds->u1_dpb_commands_read_slc = 1; } u4_bit_ofst = ps_dec->ps_bitstrm->u4_ofst - u4_bit_ofst; return u4_bit_ofst; }
1,262
184,234
1
void InspectorOverlay::update() { if (isEmpty()) { m_client->hideHighlight(); return; } FrameView* view = m_page->mainFrame()->view(); if (!view) return; IntRect viewRect = view->visibleContentRect(); FrameView* overlayView = overlayPage()->mainFrame()->view(); // Include scrollbars to avoid masking them by the gutter. IntSize frameViewFullSize = view->visibleContentRect(ScrollableArea::IncludeScrollbars).size(); IntSize size = m_size.isEmpty() ? frameViewFullSize : m_size; size.scale(m_page->pageScaleFactor()); overlayView->resize(size); // Clear canvas and paint things. reset(size, m_size.isEmpty() ? IntSize() : frameViewFullSize, viewRect.x(), viewRect.y()); drawGutter(); drawNodeHighlight(); drawQuadHighlight(); if (!m_inspectModeEnabled) drawPausedInDebuggerMessage(); drawViewSize(); drawOverridesMessage(); // Position DOM elements. overlayPage()->mainFrame()->document()->recalcStyle(Force); if (overlayView->needsLayout()) overlayView->layout(); // Kick paint. m_client->highlight(); }
1,263
131,275
0
static void classAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, cppValue, jsValue); CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; imp->setAttribute(HTMLNames::classAttr, cppValue); }
1,264
24,651
0
mmtimer_interrupt(int irq, void *dev_id) { unsigned long expires = 0; int result = IRQ_NONE; unsigned indx = cpu_to_node(smp_processor_id()); struct mmtimer *base; spin_lock(&timers[indx].lock); base = rb_entry(timers[indx].next, struct mmtimer, list); if (base == NULL) { spin_unlock(&timers[indx].lock); return result; } if (base->cpu == smp_processor_id()) { if (base->timer) expires = base->timer->it.mmtimer.expires; /* expires test won't work with shared irqs */ if ((mmtimer_int_pending(COMPARATOR) > 0) || (expires && (expires <= rtc_time()))) { mmtimer_clr_int_pending(COMPARATOR); tasklet_schedule(&timers[indx].tasklet); result = IRQ_HANDLED; } } spin_unlock(&timers[indx].lock); return result; }
1,265
65,353
0
static inline u32 nfsd4_open_rsize(struct svc_rqst *rqstp, struct nfsd4_op *op) { return (op_encode_hdr_size + op_encode_stateid_maxsz + op_encode_change_info_maxsz + 1 + nfs4_fattr_bitmap_maxsz + op_encode_delegation_maxsz) * sizeof(__be32); }
1,266
77,735
0
parse_value(const char *s, const char *delimiters) { size_t n = 0; /* Iterate until we reach a delimiter. * * strchr(s, '\0') returns s+strlen(s), so this test handles the null * terminator at the end of 's'. */ while (!strchr(delimiters, s[n])) { if (s[n] == '(') { int level = 0; do { switch (s[n]) { case '\0': return n; case '(': level++; break; case ')': level--; break; } n++; } while (level > 0); } else { n++; } } return n; }
1,267
52,530
0
static u32 tsk_peer_port(struct tipc_sock *tsk) { return msg_destport(&tsk->phdr); }
1,268
123,029
0
void RenderWidgetHostImpl::ProcessGestureAck(bool processed, int type) { if (overscroll_controller_.get()) { overscroll_controller_->ReceivedEventACK( gesture_event_filter_->GetGestureEventAwaitingAck(), processed); } gesture_event_filter_->ProcessGestureAck(processed, type); }
1,269
67,761
0
bool r_pkcs7_parse_signerinfo (RPKCS7SignerInfo* si, RASN1Object *object) { RASN1Object **elems; ut32 shift = 3; if (!si || !object || object->list.length < 5) { return false; } elems = object->list.objects; si->version = (ut32) elems[0]->sector[0]; r_pkcs7_parse_issuerandserialnumber (&si->issuerAndSerialNumber, elems[1]); r_x509_parse_algorithmidentifier (&si->digestAlgorithm, elems[2]); if (shift < object->list.length && elems[shift]->klass == CLASS_CONTEXT && elems[shift]->tag == 0) { r_pkcs7_parse_attributes (&si->authenticatedAttributes, elems[shift]); shift++; } if (shift < object->list.length) { r_x509_parse_algorithmidentifier (&si->digestEncryptionAlgorithm, elems[shift]); shift++; } if (shift < object->list.length) { R_PTR_MOVE (si->encryptedDigest, object->list.objects[shift]); shift++; } if (shift < object->list.length && elems[shift]->klass == CLASS_CONTEXT && elems[shift]->tag == 1) { r_pkcs7_parse_attributes (&si->unauthenticatedAttributes, elems[shift]); } return true; }
1,270
15,526
0
compare_forward(struct Forward *a, struct Forward *b) { if (!compare_host(a->listen_host, b->listen_host)) return 0; if (!compare_host(a->listen_path, b->listen_path)) return 0; if (a->listen_port != b->listen_port) return 0; if (!compare_host(a->connect_host, b->connect_host)) return 0; if (!compare_host(a->connect_path, b->connect_path)) return 0; if (a->connect_port != b->connect_port) return 0; return 1; }
1,271
7,383
0
eatsize(const char **p) { const char *l = *p; if (LOWCASE(*l) == 'u') l++; switch (LOWCASE(*l)) { case 'l': /* long */ case 's': /* short */ case 'h': /* short */ case 'b': /* char/byte */ case 'c': /* char/byte */ l++; /*FALLTHROUGH*/ default: break; } *p = l; }
1,272
168,451
0
PlatformFontSkia::PlatformFontSkia(sk_sp<SkTypeface> typeface, const std::string& family, int size_pixels, int style, Font::Weight weight, const FontRenderParams& render_params) { InitFromDetails(std::move(typeface), family, size_pixels, style, weight, render_params); }
1,273
142,741
0
WebMediaPlayer::TrackId HTMLMediaElement::AddVideoTrack( const WebString& id, WebMediaPlayerClient::VideoTrackKind kind, const WebString& label, const WebString& language, bool selected) { AtomicString kind_string = VideoKindToString(kind); BLINK_MEDIA_LOG << "addVideoTrack(" << (void*)this << ", '" << (String)id << "', '" << (AtomicString)kind_string << "', '" << (String)label << "', '" << (String)language << "', " << BoolString(selected) << ")"; if (selected && videoTracks().selectedIndex() != -1) selected = false; VideoTrack* video_track = VideoTrack::Create(id, kind_string, label, language, selected); videoTracks().Add(video_track); return video_track->id(); }
1,274
161,647
0
void AudioHandler::UpdateChannelsForInputs() { for (auto& input : inputs_) input->ChangedOutputs(); }
1,275
18,392
0
run_js (WebKitWebView * web_view, GArray *argv, GString *result) { if (argv_idx(argv, 0)) eval_js(web_view, argv_idx(argv, 0), result); }
1,276
42,049
0
static int ipcget_new(struct ipc_namespace *ns, struct ipc_ids *ids, const struct ipc_ops *ops, struct ipc_params *params) { int err; down_write(&ids->rwsem); err = ops->getnew(ns, params); up_write(&ids->rwsem); return err; }
1,277
21,359
0
static void mincore_hugetlb_page_range(struct vm_area_struct *vma, unsigned long addr, unsigned long end, unsigned char *vec) { #ifdef CONFIG_HUGETLB_PAGE struct hstate *h; h = hstate_vma(vma); while (1) { unsigned char present; pte_t *ptep; /* * Huge pages are always in RAM for now, but * theoretically it needs to be checked. */ ptep = huge_pte_offset(current->mm, addr & huge_page_mask(h)); present = ptep && !huge_pte_none(huge_ptep_get(ptep)); while (1) { *vec = present; vec++; addr += PAGE_SIZE; if (addr == end) return; /* check hugepage border */ if (!(addr & ~huge_page_mask(h))) break; } } #else BUG(); #endif }
1,278
15,767
0
static int ahci_dma_rw_buf(IDEDMA *dma, int is_write) { AHCIDevice *ad = DO_UPCAST(AHCIDevice, dma, dma); IDEState *s = &ad->port.ifs[0]; uint8_t *p = s->io_buffer + s->io_buffer_index; int l = s->io_buffer_size - s->io_buffer_index; if (ahci_populate_sglist(ad, &s->sg, s->io_buffer_offset)) { return 0; } if (is_write) { dma_buf_read(p, l, &s->sg); } else { dma_buf_write(p, l, &s->sg); } /* free sglist that was created in ahci_populate_sglist() */ qemu_sglist_destroy(&s->sg); /* update number of transferred bytes */ ad->cur_cmd->status = cpu_to_le32(le32_to_cpu(ad->cur_cmd->status) + l); s->io_buffer_index += l; s->io_buffer_offset += l; DPRINTF(ad->port_no, "len=%#x\n", l); return 1; }
1,279
83,143
0
mrb_io_fileno(mrb_state *mrb, mrb_value io) { struct mrb_io *fptr; fptr = (struct mrb_io *)mrb_get_datatype(mrb, io, &mrb_io_type); return mrb_fixnum_value(fptr->fd); }
1,280
159,343
0
AppViewGuestDelegate* ChromeExtensionsAPIClient::CreateAppViewGuestDelegate() const { return new ChromeAppViewGuestDelegate(); }
1,281
174,630
0
void btm_sec_role_changed (void *p_ref_data) { tBTM_SEC_DEV_REC *p_dev_rec = (tBTM_SEC_DEV_REC *)p_ref_data; UINT8 res; BTM_TRACE_EVENT ("Security Manager: role changed"); /* If this role switch was started by peer do not need to do anything */ if (p_dev_rec->sec_state != BTM_SEC_STATE_SWITCHING_ROLE) return; /* If serurity required was to FORCE switch and it failed, notify the waiting layer */ if (((p_dev_rec->security_required & BTM_SEC_FORCE_MASTER) && !p_dev_rec->role_master) || ((p_dev_rec->security_required & BTM_SEC_FORCE_SLAVE) && p_dev_rec->role_master)) { btm_sec_dev_rec_cback_event (p_dev_rec, BTM_ERR_PROCESSING, FALSE); return; } p_dev_rec->sec_flags |= BTM_SEC_ROLE_SWITCHED; p_dev_rec->security_required &= ~(BTM_SEC_FORCE_MASTER | BTM_SEC_ATTEMPT_MASTER | BTM_SEC_FORCE_SLAVE | BTM_SEC_ATTEMPT_SLAVE); p_dev_rec->sec_state = BTM_SEC_STATE_IDLE; if ((res = (UINT8)btm_sec_execute_procedure (p_dev_rec)) != BTM_CMD_STARTED) { btm_sec_dev_rec_cback_event (p_dev_rec, res, FALSE); } }
1,282
185,031
1
void StoreAccumulatedContentLength(int received_content_length, int original_content_length, bool data_reduction_proxy_was_used) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(&UpdateContentLengthPrefs, received_content_length, original_content_length, data_reduction_proxy_was_used)); }
1,283
165,022
0
void HTMLCanvasElement::OnWebLayerUpdated() { SetNeedsCompositingUpdate(); }
1,284
11,090
0
static bool valid_smb_header(const uint8_t *inbuf) { if (is_encrypted_packet(inbuf)) { return true; } /* * This used to be (strncmp(smb_base(inbuf),"\377SMB",4) == 0) * but it just looks weird to call strncmp for this one. */ return (IVAL(smb_base(inbuf), 0) == 0x424D53FF); }
1,285
83,289
0
void CSoundFile::ExtendedMODCommands(CHANNELINDEX nChn, ModCommand::PARAM param) { ModChannel *pChn = &m_PlayState.Chn[nChn]; uint8 command = param & 0xF0; param &= 0x0F; switch(command) { case 0x00: for(CHANNELINDEX chn = 0; chn < GetNumChannels(); chn++) { m_PlayState.Chn[chn].dwFlags.set(CHN_AMIGAFILTER, !(param & 1)); } break; case 0x10: if ((param) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) FinePortamentoUp(pChn, param); break; case 0x20: if ((param) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) FinePortamentoDown(pChn, param); break; case 0x30: pChn->dwFlags.set(CHN_GLISSANDO, param != 0); break; case 0x40: pChn->nVibratoType = param & 0x07; break; case 0x50: if(!m_SongFlags[SONG_FIRSTTICK]) { break; } if(GetType() & (MOD_TYPE_MOD | MOD_TYPE_DIGI | MOD_TYPE_AMF0 | MOD_TYPE_MED)) { pChn->nFineTune = MOD2XMFineTune(param); if(pChn->nPeriod && pChn->rowCommand.IsNote()) pChn->nPeriod = GetPeriodFromNote(pChn->nNote, pChn->nFineTune, pChn->nC5Speed); } else if(pChn->rowCommand.IsNote()) { pChn->nFineTune = MOD2XMFineTune(param - 8); if(pChn->nPeriod) pChn->nPeriod = GetPeriodFromNote(pChn->nNote, pChn->nFineTune, pChn->nC5Speed); } break; case 0x70: pChn->nTremoloType = param & 0x07; break; case 0x80: if(m_SongFlags[SONG_FIRSTTICK]) { Panning(pChn, param, Pan4bit); } break; case 0x90: RetrigNote(nChn, param); break; case 0xA0: if ((param) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) FineVolumeUp(pChn, param, false); break; case 0xB0: if ((param) || (GetType() & (MOD_TYPE_XM|MOD_TYPE_MT2))) FineVolumeDown(pChn, param, false); break; case 0xC0: NoteCut(nChn, param, false); break; case 0xF0: if(GetType() == MOD_TYPE_MOD) // MOD: Invert Loop { pChn->nEFxSpeed = param; if(m_SongFlags[SONG_FIRSTTICK]) InvertLoop(pChn); } else // XM: Set Active Midi Macro { pChn->nActiveMacro = param; } break; } }
1,286
164,044
0
bool DownloadManagerImpl::IsMostRecentDownloadItemAtFilePath( download::DownloadItemImpl* download) { return delegate_ ? delegate_->IsMostRecentDownloadItemAtFilePath(download) : false; }
1,287
183,750
1
void CCLayerTreeHostTest::endTest() { // If we are called from the CCThread, re-call endTest on the main thread. if (!isMainThread()) CCMainThread::postTask(createMainThreadTask(this, &CCLayerTreeHostTest::endTest)); else { // For the case where we endTest during beginTest(), set a flag to indicate that // the test should end the second beginTest regains control. if (m_beginning) m_endWhenBeginReturns = true; else onEndTest(static_cast<void*>(this)); } }
1,288
107,964
0
LinkInfoBar::~LinkInfoBar() { }
1,289
156,557
0
void ChildProcessSecurityPolicyImpl::RegisterWebSafeScheme( const std::string& scheme) { base::AutoLock lock(lock_); DCHECK_EQ(0U, schemes_okay_to_request_in_any_process_.count(scheme)) << "Add schemes at most once."; DCHECK_EQ(0U, pseudo_schemes_.count(scheme)) << "Web-safe implies not pseudo."; schemes_okay_to_request_in_any_process_.insert(scheme); schemes_okay_to_commit_in_any_process_.insert(scheme); }
1,290
188,422
1
long Chapters::Parse() { IMkvReader* const pReader = m_pSegment->m_pReader; long long pos = m_start; // payload start const long long stop = pos + m_size; // payload stop while (pos < stop) { long long id, size; long status = ParseElementHeader( pReader, pos, stop, id, size); if (status < 0) // error return status; if (size == 0) // weird continue; if (id == 0x05B9) // EditionEntry ID { status = ParseEdition(pos, size); if (status < 0) // error return status; } pos += size; assert(pos <= stop); } assert(pos == stop); return 0; }
1,291
60,600
0
static int snd_seq_ioctl_remove_events(struct snd_seq_client *client, void *arg) { struct snd_seq_remove_events *info = arg; /* * Input mostly not implemented XXX. */ if (info->remove_mode & SNDRV_SEQ_REMOVE_INPUT) { /* * No restrictions so for a user client we can clear * the whole fifo */ if (client->type == USER_CLIENT && client->data.user.fifo) snd_seq_fifo_clear(client->data.user.fifo); } if (info->remove_mode & SNDRV_SEQ_REMOVE_OUTPUT) snd_seq_queue_remove_cells(client->number, info); return 0; }
1,292
60,945
0
mime_list_one (MimeListState *state, GFileInfo *info) { const char *mime_type; if (should_skip_file (NULL, info)) { g_object_unref (info); return; } mime_type = g_file_info_get_content_type (info); if (mime_type != NULL) { istr_set_insert (state->mime_list_hash, mime_type); } }
1,293
82,409
0
JsVar *jsvGetCommonCharacters(JsVar *va, JsVar *vb) { JsVar *v = jsvNewFromEmptyString(); if (!v) return 0; JsvStringIterator ita, itb; jsvStringIteratorNew(&ita, va, 0); jsvStringIteratorNew(&itb, vb, 0); int ca = jsvStringIteratorGetCharOrMinusOne(&ita); int cb = jsvStringIteratorGetCharOrMinusOne(&itb); while (ca>0 && cb>0 && ca == cb) { jsvAppendCharacter(v, (char)ca); jsvStringIteratorNext(&ita); jsvStringIteratorNext(&itb); ca = jsvStringIteratorGetCharOrMinusOne(&ita); cb = jsvStringIteratorGetCharOrMinusOne(&itb); } jsvStringIteratorFree(&ita); jsvStringIteratorFree(&itb); return v; }
1,294
43,484
0
static int lrw_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst, struct scatterlist *src, unsigned int nbytes) { struct aesni_lrw_ctx *ctx = crypto_blkcipher_ctx(desc->tfm); be128 buf[8]; struct lrw_crypt_req req = { .tbuf = buf, .tbuflen = sizeof(buf), .table_ctx = &ctx->lrw_table, .crypt_ctx = aes_ctx(ctx->raw_aes_ctx), .crypt_fn = lrw_xts_encrypt_callback, }; int ret; desc->flags &= ~CRYPTO_TFM_REQ_MAY_SLEEP; kernel_fpu_begin(); ret = lrw_crypt(desc, dst, src, nbytes, &req); kernel_fpu_end(); return ret; }
1,295
6,693
0
static bool cmd_ibm_sense_condition(IDEState *s, uint8_t cmd) { switch (s->feature) { case 0x01: /* sense temperature in device */ s->nsector = 0x50; /* +20 C */ break; default: ide_abort_command(s); return true; } return true; }
1,296
81,028
0
static void vmx_decache_cr3(struct kvm_vcpu *vcpu) { if (enable_unrestricted_guest || (enable_ept && is_paging(vcpu))) vcpu->arch.cr3 = vmcs_readl(GUEST_CR3); __set_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail); }
1,297
17,461
0
ProcXvGetVideo(ClientPtr client) { DrawablePtr pDraw; XvPortPtr pPort; GCPtr pGC; int status; REQUEST(xvGetVideoReq); REQUEST_SIZE_MATCH(xvGetVideoReq); VALIDATE_DRAWABLE_AND_GC(stuff->drawable, pDraw, DixReadAccess); VALIDATE_XV_PORT(stuff->port, pPort, DixReadAccess); if (!(pPort->pAdaptor->type & XvOutputMask) || !(pPort->pAdaptor->type & XvVideoMask)) { client->errorValue = stuff->port; return BadMatch; } status = XvdiMatchPort(pPort, pDraw); if (status != Success) { return status; } return XvdiGetVideo(client, pDraw, pPort, pGC, stuff->vid_x, stuff->vid_y, stuff->vid_w, stuff->vid_h, stuff->drw_x, stuff->drw_y, stuff->drw_w, stuff->drw_h); }
1,298
98,645
0
void RenderWidget::OnMsgRepaint(const gfx::Size& size_to_paint) { if (!webwidget_) return; set_next_paint_is_repaint_ack(); gfx::Rect repaint_rect(size_to_paint.width(), size_to_paint.height()); didInvalidateRect(repaint_rect); }
1,299