unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
14,900 | 0 | static int spl_heap_it_valid(zend_object_iterator *iter TSRMLS_DC) /* {{{ */
{
spl_heap_it *iterator = (spl_heap_it *)iter;
return (iterator->object->heap->count != 0 ? SUCCESS : FAILURE);
}
/* }}} */
| 6,900 |
148,247 | 0 | void BrowserPpapiHostImpl::OnThrottleStateChanged(PP_Instance instance,
bool is_throttled) {
auto it = instance_map_.find(instance);
if (it != instance_map_.end()) {
it->second->is_throttled = is_throttled;
for (auto& observer : it->second->observer_list)
observer.OnThrottleStateChanged(is_throttled);
}
}
| 6,901 |
139,406 | 0 | static bool ExecuteCut(LocalFrame& frame,
Event*,
EditorCommandSource source,
const String&) {
if (!CanWriteClipboard(frame, source))
return false;
frame.GetEditor().Cut(source);
return true;
}
| 6,902 |
97,622 | 0 | xmlXPathCompVariableReference(xmlXPathParserContextPtr ctxt) {
xmlChar *name;
xmlChar *prefix;
SKIP_BLANKS;
if (CUR != '$') {
XP_ERROR(XPATH_VARIABLE_REF_ERROR);
}
NEXT;
name = xmlXPathParseQName(ctxt, &prefix);
if (name == NULL) {
XP_ERROR(XPATH_VARIABLE_REF_ERROR);
}
ctxt->comp->last = -1;
PUSH_LONG_EXPR(XPATH_OP_VARIABLE, 0, 0, 0,
name, prefix);
SKIP_BLANKS;
if ((ctxt->context != NULL) && (ctxt->context->flags & XML_XPATH_NOVAR)) {
XP_ERROR(XPATH_UNDEF_VARIABLE_ERROR);
}
}
| 6,903 |
37,717 | 0 | static void pit_do_work(struct kthread_work *work)
{
struct kvm_pit *pit = container_of(work, struct kvm_pit, expired);
struct kvm *kvm = pit->kvm;
struct kvm_vcpu *vcpu;
int i;
struct kvm_kpit_state *ps = &pit->pit_state;
int inject = 0;
/* Try to inject pending interrupts when
* last one has been acked.
*/
spin_lock(&ps->inject_lock);
if (ps->irq_ack) {
ps->irq_ack = 0;
inject = 1;
}
spin_unlock(&ps->inject_lock);
if (inject) {
kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 1, false);
kvm_set_irq(kvm, kvm->arch.vpit->irq_source_id, 0, 0, false);
/*
* Provides NMI watchdog support via Virtual Wire mode.
* The route is: PIT -> PIC -> LVT0 in NMI mode.
*
* Note: Our Virtual Wire implementation is simplified, only
* propagating PIT interrupts to all VCPUs when they have set
* LVT0 to NMI delivery. Other PIC interrupts are just sent to
* VCPU0, and only if its LVT0 is in EXTINT mode.
*/
if (kvm->arch.vapics_in_nmi_mode > 0)
kvm_for_each_vcpu(i, vcpu, kvm)
kvm_apic_nmi_wd_deliver(vcpu);
}
}
| 6,904 |
127,050 | 0 | void ChromeClientImpl::print(Frame* frame)
{
if (m_webView->client())
m_webView->client()->printPage(WebFrameImpl::fromFrame(frame));
}
| 6,905 |
132,570 | 0 | WebKitTestController* WebKitTestController::Get() {
DCHECK(instance_);
return instance_;
}
| 6,906 |
44,085 | 0 | string2xml(const char *input)
{
xmlNode *xml = NULL;
xmlDocPtr output = NULL;
xmlParserCtxtPtr ctxt = NULL;
xmlErrorPtr last_error = NULL;
if (input == NULL) {
crm_err("Can't parse NULL input");
return NULL;
}
/* create a parser context */
ctxt = xmlNewParserCtxt();
CRM_CHECK(ctxt != NULL, return NULL);
/* xmlCtxtUseOptions(ctxt, XML_PARSE_NOBLANKS|XML_PARSE_RECOVER); */
xmlCtxtResetLastError(ctxt);
xmlSetGenericErrorFunc(ctxt, crm_xml_err);
/* initGenericErrorDefaultFunc(crm_xml_err); */
output =
xmlCtxtReadDoc(ctxt, (const xmlChar *)input, NULL, NULL,
XML_PARSE_NOBLANKS | XML_PARSE_RECOVER);
if (output) {
xml = xmlDocGetRootElement(output);
}
last_error = xmlCtxtGetLastError(ctxt);
if (last_error && last_error->code != XML_ERR_OK) {
/* crm_abort(__FILE__,__FUNCTION__,__LINE__, "last_error->code != XML_ERR_OK", TRUE, TRUE); */
/*
* http://xmlsoft.org/html/libxml-xmlerror.html#xmlErrorLevel
* http://xmlsoft.org/html/libxml-xmlerror.html#xmlParserErrors
*/
crm_warn("Parsing failed (domain=%d, level=%d, code=%d): %s",
last_error->domain, last_error->level, last_error->code, last_error->message);
if (last_error->code == XML_ERR_DOCUMENT_EMPTY) {
CRM_LOG_ASSERT("Cannot parse an empty string");
} else if (last_error->code != XML_ERR_DOCUMENT_END) {
crm_err("Couldn't%s parse %d chars: %s", xml ? " fully" : "", (int)strlen(input),
input);
if (xml != NULL) {
crm_log_xml_err(xml, "Partial");
}
} else {
int len = strlen(input);
int lpc = 0;
while(lpc < len) {
crm_warn("Parse error[+%.3d]: %.80s", lpc, input+lpc);
lpc += 80;
}
CRM_LOG_ASSERT("String parsing error");
}
}
xmlFreeParserCtxt(ctxt);
return xml;
}
| 6,907 |
97,903 | 0 | bool RenderView::GetAllChildFrames(
WebFrame* parent_frame,
std::vector<WebFrame*>* frames_vector) const {
if (!parent_frame)
return false;
for (WebFrame* child_frame = parent_frame->firstChild(); child_frame;
child_frame = child_frame->nextSibling()) {
frames_vector->push_back(child_frame);
GetAllChildFrames(child_frame, frames_vector);
}
return true;
}
| 6,908 |
1,826 | 0 | gstate_to_update(fz_context *ctx, pdf_filter_processor *p)
{
filter_gstate *gstate = p->gstate;
/* If we're not the top, that's fine */
if (gstate->next != NULL)
return gstate;
/* We are the top. Push a group, so we're not */
filter_push(ctx, p);
gstate = p->gstate;
gstate->pushed = 1;
if (p->chain->op_q)
p->chain->op_q(ctx, p->chain);
return p->gstate;
}
| 6,909 |
137,755 | 0 | HeadlessDevToolsTarget* HeadlessWebContentsImpl::GetDevToolsTarget() {
return web_contents()->GetMainFrame()->IsRenderFrameLive() ? this : nullptr;
}
| 6,910 |
3,918 | 0 | void CCITTFaxStream::ccittReset(GBool unfiltered) {
if (unfiltered)
str->unfilteredReset();
else
str->reset();
row = 0;
nextLine2D = encoding < 0;
inputBits = 0;
a0i = 0;
outputBits = 0;
buf = EOF;
}
| 6,911 |
14,785 | 0 | ftp_cdup(ftpbuf_t *ftp)
{
if (ftp == NULL) {
return 0;
}
if (ftp->pwd) {
efree(ftp->pwd);
ftp->pwd = NULL;
}
if (!ftp_putcmd(ftp, "CDUP", NULL)) {
return 0;
}
if (!ftp_getresp(ftp) || ftp->resp != 250) {
return 0;
}
return 1;
}
| 6,912 |
23,013 | 0 | static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
{
__be32 *p;
READ_BUF(8);
READ32(hdr->status);
READ32(hdr->taglen);
READ_BUF(hdr->taglen + 4);
hdr->tag = (char *)p;
p += XDR_QUADLEN(hdr->taglen);
READ32(hdr->nops);
return 0;
}
| 6,913 |
169,805 | 0 | exsltDateWeekInYear (const xmlChar *dateTime)
{
exsltDateValPtr dt;
long diy, diw, year, ret;
if (dateTime == NULL) {
#ifdef WITH_TIME
dt = exsltDateCurrent();
if (dt == NULL)
#endif
return xmlXPathNAN;
} else {
dt = exsltDateParse(dateTime);
if (dt == NULL)
return xmlXPathNAN;
if ((dt->type != XS_DATETIME) && (dt->type != XS_DATE)) {
exsltDateFreeDate(dt);
return xmlXPathNAN;
}
}
diy = DAY_IN_YEAR(dt->value.date.day, dt->value.date.mon,
dt->value.date.year);
/*
* Determine day-in-week (0=Sun, 1=Mon, etc.) then adjust so Monday
* is the first day-in-week
*/
diw = (_exsltDateDayInWeek(diy, dt->value.date.year) + 6) % 7;
/* ISO 8601 adjustment, 3 is Thu */
diy += (3 - diw);
if(diy < 1) {
year = dt->value.date.year - 1;
if(year == 0) year--;
diy = DAY_IN_YEAR(31, 12, year) + diy;
} else if (diy > (long)DAY_IN_YEAR(31, 12, dt->value.date.year)) {
diy -= DAY_IN_YEAR(31, 12, dt->value.date.year);
}
ret = ((diy - 1) / 7) + 1;
exsltDateFreeDate(dt);
return (double) ret;
}
| 6,914 |
78,998 | 0 | InterpCreate(xkb_keysym_t sym, ExprDef *match)
{
InterpDef *def = malloc(sizeof(*def));
if (!def)
return NULL;
def->common.type = STMT_INTERP;
def->common.next = NULL;
def->sym = sym;
def->match = match;
def->def = NULL;
return def;
}
| 6,915 |
84,348 | 0 | UNCURL_EXPORT int32_t uncurl_write_body(struct uncurl_conn *ucc, char *body, uint32_t body_len)
{
int32_t e;
e = ucc->write(ucc->ctx, body, body_len);
return e;
}
| 6,916 |
111,668 | 0 | void GDataRootDirectory::UpdateCacheMap(const std::string& resource_id,
const std::string& md5,
CacheSubDirectoryType subdir,
int cache_state) {
CacheMap::iterator iter = cache_map_.find(resource_id);
if (iter == cache_map_.end()) { // New resource, create new entry.
DCHECK(cache_state != GDataFile::CACHE_STATE_NONE);
if (cache_state != GDataFile::CACHE_STATE_NONE) {
CacheEntry* entry = new CacheEntry(md5, subdir, cache_state);
cache_map_.insert(std::make_pair(resource_id, entry));
DVLOG(1) << "Added res_id=" << resource_id
<< ", " << entry->ToString();
}
} else { // Resource exists.
CacheEntry* entry = iter->second;
if (cache_state == GDataFile::CACHE_STATE_NONE) {
DVLOG(1) << "Deleting res_id=" << resource_id
<< ", " << entry->ToString();
delete entry;
cache_map_.erase(iter);
} else { // Otherwise, update entry in cache map.
entry->md5 = md5;
entry->sub_dir_type = subdir;
entry->cache_state = cache_state;
DVLOG(1) << "Updated res_id=" << resource_id
<< ", " << entry->ToString();
}
}
}
| 6,917 |
61,212 | 0 | open_with_response_cb (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
GtkWindow *parent_window;
NautilusFile *file;
GList files;
GAppInfo *info;
ActivateParametersInstall *parameters = user_data;
if (response_id != GTK_RESPONSE_OK)
{
gtk_widget_destroy (GTK_WIDGET (dialog));
return;
}
parent_window = parameters->parent_window;
file = g_object_get_data (G_OBJECT (dialog), "mime-action:file");
info = gtk_app_chooser_get_app_info (GTK_APP_CHOOSER (dialog));
gtk_widget_destroy (GTK_WIDGET (dialog));
g_signal_emit_by_name (nautilus_signaller_get_current (), "mime-data-changed");
files.next = NULL;
files.prev = NULL;
files.data = file;
nautilus_launch_application (info, &files, parent_window);
g_object_unref (info);
activate_parameters_install_free (parameters);
}
| 6,918 |
50,295 | 0 | static struct mt_connection *list_find_connection(unsigned short seskey, unsigned char *srcmac) {
struct mt_connection *p;
DL_FOREACH(connections_head, p) {
if (p->seskey == seskey && memcmp(srcmac, p->srcmac, ETH_ALEN) == 0) {
return p;
}
}
return NULL;
}
| 6,919 |
166,522 | 0 | bool ChromeContentBrowserClient::WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
content::RenderFrameHost* frame,
bool is_navigation,
const url::Origin& request_initiator,
network::mojom::URLLoaderFactoryRequest* factory_request,
bool* bypass_redirect_checks) {
DCHECK(base::FeatureList::IsEnabled(network::features::kNetworkService));
bool use_proxy = false;
#if BUILDFLAG(ENABLE_EXTENSIONS)
auto* web_request_api =
extensions::BrowserContextKeyedAPIFactory<extensions::WebRequestAPI>::Get(
browser_context);
if (web_request_api) {
bool use_proxy_for_web_request =
web_request_api->MaybeProxyURLLoaderFactory(frame, is_navigation,
factory_request);
if (bypass_redirect_checks)
*bypass_redirect_checks = use_proxy_for_web_request;
use_proxy |= use_proxy_for_web_request;
}
#endif
use_proxy |= signin::ProxyingURLLoaderFactory::MaybeProxyRequest(
frame, is_navigation, request_initiator, factory_request);
return use_proxy;
}
| 6,920 |
116,404 | 0 | void ChromeContentRendererClient::OnPurgeMemory() {
DVLOG(1) << "Resetting spellcheck in renderer client";
RenderThread* thread = RenderThread::Get();
if (spellcheck_.get())
thread->RemoveObserver(spellcheck_.get());
spellcheck_.reset(new SpellCheck());
thread->AddObserver(spellcheck_.get());
}
| 6,921 |
123,603 | 0 | void InspectorPageAgent::captureScreenshot(ErrorString*, const String*, const int*, const int*, const int*, String*, RefPtr<TypeBuilder::Page::ScreencastFrameMetadata>&)
{
}
| 6,922 |
181,346 | 1 | void svc_rdma_send_error(struct svcxprt_rdma *xprt, struct rpcrdma_msg *rmsgp,
int status)
{
struct ib_send_wr err_wr;
struct page *p;
struct svc_rdma_op_ctxt *ctxt;
enum rpcrdma_errcode err;
__be32 *va;
int length;
int ret;
ret = svc_rdma_repost_recv(xprt, GFP_KERNEL);
if (ret)
return;
p = alloc_page(GFP_KERNEL);
if (!p)
return;
va = page_address(p);
/* XDR encode an error reply *
err = ERR_CHUNK;
if (status == -EPROTONOSUPPORT)
err = ERR_VERS;
length = svc_rdma_xdr_encode_error(xprt, rmsgp, err, va);
ctxt = svc_rdma_get_context(xprt);
ctxt->direction = DMA_TO_DEVICE;
ctxt->count = 1;
ctxt->pages[0] = p;
/* Prepare SGE for local address *
ctxt->sge[0].lkey = xprt->sc_pd->local_dma_lkey;
ctxt->sge[0].length = length;
ctxt->sge[0].addr = ib_dma_map_page(xprt->sc_cm_id->device,
p, 0, length, DMA_TO_DEVICE);
if (ib_dma_mapping_error(xprt->sc_cm_id->device, ctxt->sge[0].addr)) {
dprintk("svcrdma: Error mapping buffer for protocol error\n");
svc_rdma_put_context(ctxt, 1);
return;
}
svc_rdma_count_mappings(xprt, ctxt);
/* Prepare SEND WR *
memset(&err_wr, 0, sizeof(err_wr));
ctxt->cqe.done = svc_rdma_wc_send;
err_wr.wr_cqe = &ctxt->cqe;
err_wr.sg_list = ctxt->sge;
err_wr.num_sge = 1;
err_wr.opcode = IB_WR_SEND;
err_wr.send_flags = IB_SEND_SIGNALED;
/* Post It *
ret = svc_rdma_send(xprt, &err_wr);
if (ret) {
dprintk("svcrdma: Error %d posting send for protocol error\n",
ret);
svc_rdma_unmap_dma(ctxt);
svc_rdma_put_context(ctxt, 1);
}
}
| 6,923 |
162,708 | 0 | void BaseRenderingContext2D::Trace(blink::Visitor* visitor) {
visitor->Trace(state_stack_);
}
| 6,924 |
1,475 | 0 | static uint32_t stat_to_v9mode(const struct stat *stbuf)
{
uint32_t mode;
mode = stbuf->st_mode & 0777;
if (S_ISDIR(stbuf->st_mode)) {
mode |= P9_STAT_MODE_DIR;
}
if (S_ISLNK(stbuf->st_mode)) {
mode |= P9_STAT_MODE_SYMLINK;
}
if (S_ISSOCK(stbuf->st_mode)) {
mode |= P9_STAT_MODE_SOCKET;
}
if (S_ISFIFO(stbuf->st_mode)) {
mode |= P9_STAT_MODE_NAMED_PIPE;
}
if (S_ISBLK(stbuf->st_mode) || S_ISCHR(stbuf->st_mode)) {
mode |= P9_STAT_MODE_DEVICE;
}
if (stbuf->st_mode & S_ISUID) {
mode |= P9_STAT_MODE_SETUID;
}
if (stbuf->st_mode & S_ISGID) {
mode |= P9_STAT_MODE_SETGID;
}
if (stbuf->st_mode & S_ISVTX) {
mode |= P9_STAT_MODE_SETVTX;
}
return mode;
}
| 6,925 |
137,256 | 0 | void Textfield::OnGestureEvent(ui::GestureEvent* event) {
switch (event->type()) {
case ui::ET_GESTURE_TAP_DOWN:
RequestFocus();
ShowImeIfNeeded();
event->SetHandled();
break;
case ui::ET_GESTURE_TAP:
if (controller_ && controller_->HandleGestureEvent(this, *event)) {
event->SetHandled();
return;
}
if (event->details().tap_count() == 1) {
if (touch_selection_controller_ ||
!GetRenderText()->IsPointInSelection(event->location())) {
OnBeforeUserAction();
MoveCursorTo(event->location(), false);
OnAfterUserAction();
}
} else if (event->details().tap_count() == 2) {
OnBeforeUserAction();
SelectWordAt(event->location());
OnAfterUserAction();
} else {
OnBeforeUserAction();
SelectAll(false);
OnAfterUserAction();
}
CreateTouchSelectionControllerAndNotifyIt();
#if defined(OS_WIN)
if (!read_only()) {
DCHECK(ui::OnScreenKeyboardDisplayManager::GetInstance());
ui::OnScreenKeyboardDisplayManager::GetInstance()
->DisplayVirtualKeyboard(nullptr);
}
#endif
event->SetHandled();
break;
case ui::ET_GESTURE_LONG_PRESS:
if (!GetRenderText()->IsPointInSelection(event->location())) {
OnBeforeUserAction();
SelectWordAt(event->location());
OnAfterUserAction();
CreateTouchSelectionControllerAndNotifyIt();
if (touch_selection_controller_)
event->SetHandled();
} else {
DestroyTouchSelection();
initiating_drag_ = switches::IsTouchDragDropEnabled();
}
break;
case ui::ET_GESTURE_LONG_TAP:
if (touch_selection_controller_)
event->SetHandled();
break;
case ui::ET_GESTURE_SCROLL_BEGIN:
touch_handles_hidden_due_to_scroll_ = touch_selection_controller_ != NULL;
DestroyTouchSelection();
drag_start_location_ = event->location();
drag_start_display_offset_ =
GetRenderText()->GetUpdatedDisplayOffset().x();
event->SetHandled();
break;
case ui::ET_GESTURE_SCROLL_UPDATE: {
int new_offset = drag_start_display_offset_ + event->location().x() -
drag_start_location_.x();
GetRenderText()->SetDisplayOffset(new_offset);
SchedulePaint();
event->SetHandled();
break;
}
case ui::ET_GESTURE_SCROLL_END:
case ui::ET_SCROLL_FLING_START:
if (touch_handles_hidden_due_to_scroll_) {
CreateTouchSelectionControllerAndNotifyIt();
touch_handles_hidden_due_to_scroll_ = false;
}
event->SetHandled();
break;
default:
return;
}
}
| 6,926 |
158,408 | 0 | explicit FullscreenLayoutManager(aura::Window* owner) : owner_(owner) {}
| 6,927 |
151,673 | 0 | void Browser::FindReply(WebContents* web_contents,
int request_id,
int number_of_matches,
const gfx::Rect& selection_rect,
int active_match_ordinal,
bool final_update) {
FindTabHelper* find_tab_helper = FindTabHelper::FromWebContents(web_contents);
if (!find_tab_helper)
return;
find_tab_helper->HandleFindReply(request_id,
number_of_matches,
selection_rect,
active_match_ordinal,
final_update);
}
| 6,928 |
51,078 | 0 | static int apparmor_cred_prepare(struct cred *new, const struct cred *old,
gfp_t gfp)
{
/* freed by apparmor_cred_free */
struct aa_task_cxt *cxt = aa_alloc_task_context(gfp);
if (!cxt)
return -ENOMEM;
aa_dup_task_context(cxt, cred_cxt(old));
cred_cxt(new) = cxt;
return 0;
}
| 6,929 |
136,848 | 0 | DOMVisualViewport* LocalDOMWindow::visualViewport() {
return visualViewport_;
}
| 6,930 |
151,557 | 0 | ResourceFetcher::DetermineRevalidationPolicyInternal(
Resource::Type type,
const FetchParameters& fetch_params,
const Resource& existing_resource,
bool is_static_data) const {
const ResourceRequest& request = fetch_params.GetResourceRequest();
if (IsDownloadOrStreamRequest(request))
return kReload;
if (IsImageResourceDisallowedToBeReused(existing_resource))
return kReload;
if (existing_resource.Loader() &&
existing_resource.Loader()->Fetcher() != this) {
return kReload;
}
if ((fetch_params.IsLinkPreload() || fetch_params.IsSpeculativePreload()) &&
existing_resource.IsUnusedPreload()) {
return kReload;
}
if (existing_resource.MustRefetchDueToIntegrityMetadata(fetch_params)) {
return kReload;
}
if (existing_resource.GetType() != type) {
RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::DetermineRevalidationPolicy "
"reloading due to type mismatch.";
return kReload;
}
if (is_static_data)
return kUse;
if (!existing_resource.CanReuse(fetch_params)) {
RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::DetermineRevalidationPolicy "
"reloading due to Resource::CanReuse() "
"returning false.";
return kReload;
}
if (allow_stale_resources_)
return kUse;
if (request.GetCachePolicy() == WebCachePolicy::kReturnCacheDataElseLoad)
return kUse;
if (existing_resource.HasCacheControlNoStoreHeader()) {
RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::DetermineRevalidationPolicy "
"reloading due to Cache-control: no-store.";
return kReload;
}
if (type != Resource::kRaw) {
if (!Context().IsLoadComplete() &&
cached_resources_map_.Contains(
MemoryCache::RemoveFragmentIdentifierIfNeeded(
existing_resource.Url())))
return kUse;
if (existing_resource.IsLoading())
return kUse;
}
if (request.GetCachePolicy() == WebCachePolicy::kBypassingCache) {
RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::DetermineRevalidationPolicy "
"reloading due to "
"WebCachePolicy::BypassingCache.";
return kReload;
}
if (existing_resource.ErrorOccurred()) {
RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::DetermineRevalidationPolicy "
"reloading due to resource being in the error "
"state";
return kReload;
}
if (type == Resource::kImage &&
&existing_resource == CachedResource(request.Url())) {
return kUse;
}
if (existing_resource.MustReloadDueToVaryHeader(request))
return kReload;
if (!existing_resource.CanReuseRedirectChain()) {
RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::DetermineRevalidationPolicy "
"reloading due to an uncacheable redirect";
return kReload;
}
if (request.GetCachePolicy() == WebCachePolicy::kValidatingCacheData ||
existing_resource.MustRevalidateDueToCacheHeaders() ||
request.CacheControlContainsNoCache()) {
if (existing_resource.IsUnusedPreload())
return kReload;
if (existing_resource.CanUseCacheValidator() &&
!Context().IsControlledByServiceWorker()) {
if (existing_resource.IsCacheValidator()) {
DCHECK(existing_resource.StillNeedsLoad());
return kUse;
}
return kRevalidate;
}
RESOURCE_LOADING_DVLOG(1) << "ResourceFetcher::DetermineRevalidationPolicy "
"reloading due to missing cache validators.";
return kReload;
}
return kUse;
}
| 6,931 |
182,060 | 1 | tTcpIpPacketParsingResult ParaNdis_CheckSumVerify(
tCompletePhysicalAddress *pDataPages,
ULONG ulDataLength,
ULONG ulStartOffset,
ULONG flags,
LPCSTR caller)
{
IPHeader *pIpHeader = (IPHeader *) RtlOffsetToPointer(pDataPages[0].Virtual, ulStartOffset);
tTcpIpPacketParsingResult res = QualifyIpPacket(pIpHeader, ulDataLength);
if (res.ipStatus == ppresIPV4)
{
if (flags & pcrIpChecksum)
res = VerifyIpChecksum(&pIpHeader->v4, res, (flags & pcrFixIPChecksum) != 0);
if(res.xxpStatus == ppresXxpKnown)
{
if (res.TcpUdp == ppresIsTCP) /* TCP */
{
if(flags & pcrTcpV4Checksum)
{
res = VerifyTcpChecksum(pDataPages, ulDataLength, ulStartOffset, res, flags & (pcrFixPHChecksum | pcrFixTcpV4Checksum));
}
}
else /* UDP */
{
if (flags & pcrUdpV4Checksum)
{
res = VerifyUdpChecksum(pDataPages, ulDataLength, ulStartOffset, res, flags & (pcrFixPHChecksum | pcrFixUdpV4Checksum));
}
}
}
}
else if (res.ipStatus == ppresIPV6)
{
if(res.xxpStatus == ppresXxpKnown)
{
if (res.TcpUdp == ppresIsTCP) /* TCP */
{
if(flags & pcrTcpV6Checksum)
{
res = VerifyTcpChecksum(pDataPages, ulDataLength, ulStartOffset, res, flags & (pcrFixPHChecksum | pcrFixTcpV6Checksum));
}
}
else /* UDP */
{
if (flags & pcrUdpV6Checksum)
{
res = VerifyUdpChecksum(pDataPages, ulDataLength, ulStartOffset, res, flags & (pcrFixPHChecksum | pcrFixUdpV6Checksum));
}
}
}
}
PrintOutParsingResult(res, 1, caller);
return res;
}
| 6,932 |
166,119 | 0 | void RenderFrameHostImpl::CreateDedicatedWorkerHostFactory(
blink::mojom::DedicatedWorkerFactoryRequest request) {
content::CreateDedicatedWorkerHostFactory(process_->GetID(), routing_id_,
last_committed_origin_,
std::move(request));
}
| 6,933 |
165,065 | 0 | CanvasRenderingContextFactory* OffscreenCanvas::GetRenderingContextFactory(
int type) {
DCHECK_LE(type, CanvasRenderingContext::kMaxValue);
return RenderingContextFactories()[type].get();
}
| 6,934 |
188,136 | 1 | resetLppTransposer (HANDLE_SBR_LPP_TRANS hLppTrans, /*!< Handle of lpp transposer */
UCHAR highBandStartSb, /*!< High band area: start subband */
UCHAR *v_k_master, /*!< Master table */
UCHAR numMaster, /*!< Valid entries in master table */
UCHAR *noiseBandTable, /*!< Mapping of SBR noise bands to QMF bands */
UCHAR noNoiseBands, /*!< Number of noise bands */
UCHAR usb, /*!< High band area: stop subband */
UINT fs /*!< SBR output sampling frequency */
)
{
TRANSPOSER_SETTINGS *pSettings = hLppTrans->pSettings;
PATCH_PARAM *patchParam = pSettings->patchParam;
int i, patch;
int targetStopBand;
int sourceStartBand;
int patchDistance;
int numBandsInPatch;
int lsb = v_k_master[0]; /* Start subband expressed in "non-critical" sampling terms*/
int xoverOffset = highBandStartSb - lsb; /* Calculate distance in QMF bands between k0 and kx */
int startFreqHz;
int desiredBorder;
usb = fixMin(usb, v_k_master[numMaster]); /* Avoid endless loops (compare with float code). */
/*
* Plausibility check
*/
if ( lsb - SHIFT_START_SB < 4 ) {
return SBRDEC_UNSUPPORTED_CONFIG;
}
/*
* Initialize the patching parameter
*/
/* ISO/IEC 14496-3 (Figure 4.48): goalSb = round( 2.048e6 / fs ) */
desiredBorder = (((2048000*2) / fs) + 1) >> 1;
desiredBorder = findClosestEntry(desiredBorder, v_k_master, numMaster, 1); /* Adapt region to master-table */
/* First patch */
sourceStartBand = SHIFT_START_SB + xoverOffset;
targetStopBand = lsb + xoverOffset; /* upperBand */
/* Even (odd) numbered channel must be patched to even (odd) numbered channel */
patch = 0;
while(targetStopBand < usb) {
/* Too many patches?
Allow MAX_NUM_PATCHES+1 patches here.
we need to check later again, since patch might be the highest patch
AND contain less than 3 bands => actual number of patches will be reduced by 1.
*/
if (patch > MAX_NUM_PATCHES) {
return SBRDEC_UNSUPPORTED_CONFIG;
}
patchParam[patch].guardStartBand = targetStopBand;
patchParam[patch].targetStartBand = targetStopBand;
numBandsInPatch = desiredBorder - targetStopBand; /* Get the desired range of the patch */
if ( numBandsInPatch >= lsb - sourceStartBand ) {
/* Desired number bands are not available -> patch whole source range */
patchDistance = targetStopBand - sourceStartBand; /* Get the targetOffset */
patchDistance = patchDistance & ~1; /* Rounding off odd numbers and make all even */
numBandsInPatch = lsb - (targetStopBand - patchDistance); /* Update number of bands to be patched */
numBandsInPatch = findClosestEntry(targetStopBand + numBandsInPatch, v_k_master, numMaster, 0) -
targetStopBand; /* Adapt region to master-table */
}
/* Desired number bands are available -> get the minimal even patching distance */
patchDistance = numBandsInPatch + targetStopBand - lsb; /* Get minimal distance */
patchDistance = (patchDistance + 1) & ~1; /* Rounding up odd numbers and make all even */
if (numBandsInPatch > 0) {
patchParam[patch].sourceStartBand = targetStopBand - patchDistance;
patchParam[patch].targetBandOffs = patchDistance;
patchParam[patch].numBandsInPatch = numBandsInPatch;
patchParam[patch].sourceStopBand = patchParam[patch].sourceStartBand + numBandsInPatch;
targetStopBand += patchParam[patch].numBandsInPatch;
patch++;
}
/* All patches but first */
sourceStartBand = SHIFT_START_SB;
/* Check if we are close to desiredBorder */
if( desiredBorder - targetStopBand < 3) /* MPEG doc */
{
desiredBorder = usb;
}
}
patch--;
/* If highest patch contains less than three subband: skip it */
if ( (patch>0) && (patchParam[patch].numBandsInPatch < 3) ) {
patch--;
targetStopBand = patchParam[patch].targetStartBand + patchParam[patch].numBandsInPatch;
}
/* now check if we don't have one too many */
if (patch >= MAX_NUM_PATCHES) {
return SBRDEC_UNSUPPORTED_CONFIG;
}
pSettings->noOfPatches = patch + 1;
/* Check lowest and highest source subband */
pSettings->lbStartPatching = targetStopBand;
pSettings->lbStopPatching = 0;
for ( patch = 0; patch < pSettings->noOfPatches; patch++ ) {
pSettings->lbStartPatching = fixMin( pSettings->lbStartPatching, patchParam[patch].sourceStartBand );
pSettings->lbStopPatching = fixMax( pSettings->lbStopPatching, patchParam[patch].sourceStopBand );
}
for(i = 0 ; i < noNoiseBands; i++){
pSettings->bwBorders[i] = noiseBandTable[i+1];
}
/*
* Choose whitening factors
*/
startFreqHz = ( (lsb + xoverOffset)*fs ) >> 7; /* Shift does a division by 2*(64) */
for( i = 1; i < NUM_WHFACTOR_TABLE_ENTRIES; i++ )
{
if( startFreqHz < FDK_sbrDecoder_sbr_whFactorsIndex[i])
break;
}
i--;
pSettings->whFactors.off = FDK_sbrDecoder_sbr_whFactorsTable[i][0];
pSettings->whFactors.transitionLevel = FDK_sbrDecoder_sbr_whFactorsTable[i][1];
pSettings->whFactors.lowLevel = FDK_sbrDecoder_sbr_whFactorsTable[i][2];
pSettings->whFactors.midLevel = FDK_sbrDecoder_sbr_whFactorsTable[i][3];
pSettings->whFactors.highLevel = FDK_sbrDecoder_sbr_whFactorsTable[i][4];
return SBRDEC_OK;
}
| 6,935 |
27,071 | 0 | g_NPN_RetainObject(NPObject *npobj)
{
if (!thread_check()) {
npw_printf("WARNING: NPN_RetainObject not called from the main thread\n");
return NULL;
}
if (npobj == NULL)
return NULL;
D(bugiI("NPN_RetainObject npobj=%p\n", npobj));
uint32_t refcount = invoke_NPN_RetainObject(npobj);
D(bugiD("NPN_RetainObject return: %p (refcount: %d)\n", npobj, refcount));
npobj->referenceCount = refcount;
return npobj;
}
| 6,936 |
148,501 | 0 | void WebContentsImpl::OnRegisterProtocolHandler(RenderFrameHostImpl* source,
const std::string& protocol,
const GURL& url,
const base::string16& title,
bool user_gesture) {
if (!delegate_)
return;
ChildProcessSecurityPolicyImpl* policy =
ChildProcessSecurityPolicyImpl::GetInstance();
if (policy->IsPseudoScheme(protocol))
return;
delegate_->RegisterProtocolHandler(this, protocol, url, user_gesture);
}
| 6,937 |
120,544 | 0 | bool Element::hasNamedNodeMap() const
{
return hasRareData() && elementRareData()->attributeMap();
}
| 6,938 |
87,669 | 0 | inline bool is_hsr_master(struct net_device *dev)
{
return (dev->netdev_ops->ndo_start_xmit == hsr_dev_xmit);
}
| 6,939 |
89,106 | 0 | alt_merge_node_opt_info(OptNode* to, OptNode* add, OptEnv* env)
{
alt_merge_opt_anc_info(&to->anc, &add->anc);
alt_merge_opt_exact(&to->sb, &add->sb, env);
alt_merge_opt_exact(&to->sm, &add->sm, env);
alt_merge_opt_exact(&to->spr, &add->spr, env);
alt_merge_opt_map(env->enc, &to->map, &add->map);
alt_merge_mml(&to->len, &add->len);
}
| 6,940 |
171,480 | 0 | WORD32 ih264d_create(iv_obj_t *dec_hdl, void *pv_api_ip, void *pv_api_op)
{
ih264d_create_op_t *ps_create_op;
WORD32 ret;
ps_create_op = (ih264d_create_op_t *)pv_api_op;
ps_create_op->s_ivd_create_op_t.u4_error_code = 0;
ret = ih264d_allocate_static_bufs(&dec_hdl, pv_api_ip, pv_api_op);
/* If allocation of some buffer fails, then free buffers allocated till then */
if((IV_FAIL == ret) && (NULL != dec_hdl))
{
ih264d_free_static_bufs(dec_hdl);
ps_create_op->s_ivd_create_op_t.u4_error_code = IVD_MEM_ALLOC_FAILED;
ps_create_op->s_ivd_create_op_t.u4_error_code = 1 << IVD_FATALERROR;
return IV_FAIL;
}
return IV_SUCCESS;
}
| 6,941 |
159,238 | 0 | void DownloadManagerImpl::CreateSavePackageDownloadItemWithId(
const base::FilePath& main_file_path,
const GURL& page_url,
const std::string& mime_type,
std::unique_ptr<DownloadRequestHandleInterface> request_handle,
const DownloadItemImplCreated& item_created,
uint32_t id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK_NE(content::DownloadItem::kInvalidId, id);
DCHECK(!base::ContainsKey(downloads_, id));
DownloadItemImpl* download_item = item_factory_->CreateSavePageItem(
this, id, main_file_path, page_url, mime_type, std::move(request_handle));
downloads_[download_item->GetId()] = base::WrapUnique(download_item);
DCHECK(!base::ContainsKey(downloads_by_guid_, download_item->GetGuid()));
downloads_by_guid_[download_item->GetGuid()] = download_item;
for (auto& observer : observers_)
observer.OnDownloadCreated(this, download_item);
if (!item_created.is_null())
item_created.Run(download_item);
}
| 6,942 |
160,271 | 0 | void MimeHandlerViewContainer::DidReceiveData(const char* data,
int data_length) {
view_id_ += std::string(data, data_length);
}
| 6,943 |
98,585 | 0 | void CaptureVisibleTabFunction::SendResultFromBitmap(
const SkBitmap& screen_capture) {
scoped_refptr<RefCountedBytes> image_data(new RefCountedBytes);
SkAutoLockPixels screen_capture_lock(screen_capture);
bool encoded = false;
std::string mime_type;
switch (image_format_) {
case FORMAT_JPEG:
encoded = gfx::JPEGCodec::Encode(
reinterpret_cast<unsigned char*>(screen_capture.getAddr32(0, 0)),
gfx::JPEGCodec::FORMAT_BGRA,
screen_capture.width(),
screen_capture.height(),
static_cast<int>(screen_capture.rowBytes()), image_quality_,
&image_data->data);
mime_type = keys::kMimeTypeJpeg;
break;
case FORMAT_PNG:
encoded = gfx::PNGCodec::Encode(
reinterpret_cast<unsigned char*>(screen_capture.getAddr32(0, 0)),
gfx::PNGCodec::FORMAT_BGRA,
screen_capture.width(),
screen_capture.height(),
static_cast<int>(screen_capture.rowBytes()), false,
&image_data->data);
mime_type = keys::kMimeTypePng;
break;
default:
NOTREACHED() << "Invalid image format.";
}
if (!encoded) {
error_ = ExtensionErrorUtils::FormatErrorMessage(
keys::kInternalVisibleTabCaptureError, "");
SendResponse(false);
return;
}
std::string base64_result;
std::string stream_as_string;
stream_as_string.resize(image_data->data.size());
memcpy(&stream_as_string[0],
reinterpret_cast<const char*>(&image_data->data[0]),
image_data->data.size());
base::Base64Encode(stream_as_string, &base64_result);
base64_result.insert(0, StringPrintf("data:%s;base64,", mime_type.c_str()));
result_.reset(new StringValue(base64_result));
SendResponse(true);
}
| 6,944 |
128,702 | 0 | url::Parsed::ComponentType TemplateURLRef::GetSearchTermKeyLocation(
const SearchTermsData& search_terms_data) const {
ParseIfNecessary(search_terms_data);
return search_term_key_location_;
}
| 6,945 |
159,254 | 0 | int DownloadManagerImpl::InProgressCount() const {
int count = 0;
for (const auto& it : downloads_) {
if (it.second->GetState() == DownloadItem::IN_PROGRESS)
++count;
}
return count;
}
| 6,946 |
70,234 | 0 | LogLuv24toXYZ(uint32 p, float XYZ[3])
{
int Ce;
double L, u, v, s, x, y;
/* decode luminance */
L = LogL10toY(p>>14 & 0x3ff);
if (L <= 0.) {
XYZ[0] = XYZ[1] = XYZ[2] = 0.;
return;
}
/* decode color */
Ce = p & 0x3fff;
if (uv_decode(&u, &v, Ce) < 0) {
u = U_NEU; v = V_NEU;
}
s = 1./(6.*u - 16.*v + 12.);
x = 9.*u * s;
y = 4.*v * s;
/* convert to XYZ */
XYZ[0] = (float)(x/y * L);
XYZ[1] = (float)L;
XYZ[2] = (float)((1.-x-y)/y * L);
}
| 6,947 |
96,705 | 0 | static inline Image *GetImageCache(const ImageInfo *image_info,const char *path,
ExceptionInfo *exception)
{
char
key[MagickPathExtent];
ExceptionInfo
*sans_exception;
Image
*image;
ImageInfo
*read_info;
/*
Read an image into a image cache (for repeated usage) if not already in
cache. Then return the image that is in the cache.
*/
(void) FormatLocaleString(key,MagickPathExtent,"cache:%s",path);
sans_exception=AcquireExceptionInfo();
image=(Image *) GetImageRegistry(ImageRegistryType,key,sans_exception);
sans_exception=DestroyExceptionInfo(sans_exception);
if (image != (Image *) NULL)
return(image);
read_info=CloneImageInfo(image_info);
(void) CopyMagickString(read_info->filename,path,MagickPathExtent);
image=ReadImage(read_info,exception);
read_info=DestroyImageInfo(read_info);
if (image != (Image *) NULL)
(void) SetImageRegistry(ImageRegistryType,key,image,exception);
return(image);
}
| 6,948 |
117,007 | 0 | bool GestureSequence::PinchStart(const TouchEvent& event,
const GesturePoint& point, Gestures* gestures) {
DCHECK(state_ == GS_SCROLL ||
state_ == GS_PENDING_SYNTHETIC_CLICK);
AppendTapDownGestureEvent(point, gestures);
pinch_distance_current_ = points_[0].Distance(points_[1]);
pinch_distance_start_ = pinch_distance_current_;
AppendPinchGestureBegin(points_[0], points_[1], gestures);
if (state_ == GS_PENDING_SYNTHETIC_CLICK) {
gfx::Point center = points_[0].last_touch_position().Middle(
points_[1].last_touch_position());
AppendScrollGestureBegin(point, center, gestures);
}
return true;
}
| 6,949 |
105,574 | 0 | void Automation::DeleteCookie(const std::string& url,
const std::string& cookie_name,
Error** error) {
std::string error_msg;
if (!SendDeleteCookieJSONRequest(
automation(), url, cookie_name, &error_msg)) {
*error = new Error(kUnknownError, error_msg);
}
}
| 6,950 |
34,767 | 0 | static inline int ext4_ext_space_root(struct inode *inode, int check)
{
int size;
size = sizeof(EXT4_I(inode)->i_data);
size -= sizeof(struct ext4_extent_header);
size /= sizeof(struct ext4_extent);
if (!check) {
#ifdef AGGRESSIVE_TEST
if (size > 3)
size = 3;
#endif
}
return size;
}
| 6,951 |
111,676 | 0 | EditorClientBlackBerry::EditorClientBlackBerry(WebPagePrivate* webPagePrivate)
: m_webPagePrivate(webPagePrivate)
, m_waitingForCursorFocus(false)
, m_spellCheckState(SpellCheckDefault)
, m_inRedo(false)
{
}
| 6,952 |
95,530 | 0 | static qboolean S_AL_HearingThroughEntity( int entityNum )
{
float distanceSq;
if( lastListenerNumber == entityNum )
{
distanceSq = DistanceSquared(
entityList[ entityNum ].origin,
lastListenerOrigin );
if( distanceSq > THIRD_PERSON_THRESHOLD_SQ )
return qfalse; //we're the player, but third person
else
return qtrue; //we're the player
}
else
return qfalse; //not the player
}
| 6,953 |
63,768 | 0 | static nad_t _sx_sasl_challenge(sx_t s, const char *data, int dlen) {
nad_t nad;
int ns;
nad = nad_new();
ns = nad_add_namespace(nad, uri_SASL, NULL);
nad_append_elem(nad, ns, "challenge", 0);
if(data != NULL)
nad_append_cdata(nad, data, dlen, 1);
return nad;
}
| 6,954 |
93,972 | 0 | xfs_vm_readpages(
struct file *unused,
struct address_space *mapping,
struct list_head *pages,
unsigned nr_pages)
{
trace_xfs_vm_readpages(mapping->host, nr_pages);
return mpage_readpages(mapping, pages, nr_pages, xfs_get_blocks);
}
| 6,955 |
170,416 | 0 | RgnIterPair(const SkRegion& rgn) : fRgn(rgn) {
fIter.reset(fRgn);
}
| 6,956 |
20,014 | 0 | static void nfs4_recover_open_prepare(struct rpc_task *task, void *calldata)
{
rpc_task_set_priority(task, RPC_PRIORITY_PRIVILEGED);
nfs4_open_prepare(task, calldata);
}
| 6,957 |
46,698 | 0 | static void __exit des_s390_exit(void)
{
if (ctrblk) {
crypto_unregister_alg(&ctr_des_alg);
crypto_unregister_alg(&ctr_des3_alg);
free_page((unsigned long) ctrblk);
}
crypto_unregister_alg(&cbc_des3_alg);
crypto_unregister_alg(&ecb_des3_alg);
crypto_unregister_alg(&des3_alg);
crypto_unregister_alg(&cbc_des_alg);
crypto_unregister_alg(&ecb_des_alg);
crypto_unregister_alg(&des_alg);
}
| 6,958 |
39,391 | 0 | static int invalidate_drive(struct block_device *bdev)
{
/* invalidate the buffer track to force a reread */
set_bit((long)bdev->bd_disk->private_data, &fake_change);
process_fd_request();
check_disk_change(bdev);
return 0;
}
| 6,959 |
44,559 | 0 | static bool append_ptyname(char **pp, char *name)
{
char *p;
if (!*pp) {
*pp = malloc(strlen(name) + strlen("container_ttys=") + 1);
if (!*pp)
return false;
sprintf(*pp, "container_ttys=%s", name);
return true;
}
p = realloc(*pp, strlen(*pp) + strlen(name) + 2);
if (!p)
return false;
*pp = p;
strcat(p, " ");
strcat(p, name);
return true;
}
| 6,960 |
155,731 | 0 | base::Optional<Gamepad> GamepadBuilder::GetGamepad() const {
if (IsValid())
return gamepad_;
return base::nullopt;
}
| 6,961 |
109,869 | 0 | FrameView* Document::view() const
{
return m_frame ? m_frame->view() : 0;
}
| 6,962 |
136,104 | 0 | void WebsiteSettingsPopupView::TabSelectedAt(int index) {
switch (index) {
case TAB_ID_PERMISSIONS:
presenter_->RecordWebsiteSettingsAction(
WebsiteSettings::WEBSITE_SETTINGS_PERMISSIONS_TAB_SELECTED);
break;
case TAB_ID_CONNECTION:
if (presenter_) {
presenter_->RecordWebsiteSettingsAction(
WebsiteSettings::WEBSITE_SETTINGS_CONNECTION_TAB_SELECTED);
}
break;
default:
NOTREACHED();
}
tabbed_pane_->GetSelectedTab()->Layout();
SizeToContents();
}
| 6,963 |
117,126 | 0 | void webkitWebViewBaseCreateWebPage(WebKitWebViewBase* webkitWebViewBase, WKContextRef context, WKPageGroupRef pageGroup)
{
WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
priv->pageProxy = toImpl(context)->createWebPage(priv->pageClient.get(), toImpl(pageGroup));
priv->pageProxy->initializeWebPage();
#if ENABLE(FULLSCREEN_API)
priv->pageProxy->fullScreenManager()->setWebView(webkitWebViewBase);
#endif
}
| 6,964 |
150,232 | 0 | std::string GetPlacementOverride(aura::Window* window) {
gfx::Rect* bounds = window->GetProperty(kRestoreBoundsOverrideKey);
if (bounds) {
gfx::Rect restore_bounds = *bounds;
ui::WindowShowState restore_state = ToWindowShowState(
window->GetProperty(kRestoreWindowStateTypeOverrideKey));
return GetPlacementString(restore_bounds, restore_state);
}
return std::string();
}
| 6,965 |
67,477 | 0 | static void DeleteSession( SESSION *session )
{
SESSION_LIST_ENTRY *predSession;
void *newNextEntry;
if( session == &local_sessions_list->session )
local_sessions_list = 0;
else
{
for( predSession = local_sessions_list;
predSession != 0 && &( ( ( SESSION_LIST_ENTRY *)predSession->nextEntry )->session ) != session;
predSession = predSession->nextEntry )
;
if( predSession != 0 )
{
local_session_entries_used--;
newNextEntry = &( (SESSION_LIST_ENTRY *)predSession->nextEntry)->nextEntry;
free( predSession->nextEntry );
predSession->nextEntry = newNextEntry;
}
}
}
| 6,966 |
5,892 | 0 | static int handle_cmd(AHCIState *s, int port, uint8_t slot)
{
IDEState *ide_state;
uint64_t tbl_addr;
AHCICmdHdr *cmd;
uint8_t *cmd_fis;
dma_addr_t cmd_len;
if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
/* Engine currently busy, try again later */
DPRINTF(port, "engine busy\n");
return -1;
}
if (!s->dev[port].lst) {
DPRINTF(port, "error: lst not given but cmd handled");
return -1;
}
cmd = get_cmd_header(s, port, slot);
/* remember current slot handle for later */
s->dev[port].cur_cmd = cmd;
/* The device we are working for */
ide_state = &s->dev[port].port.ifs[0];
if (!ide_state->blk) {
DPRINTF(port, "error: guest accessed unused port");
return -1;
}
tbl_addr = le64_to_cpu(cmd->tbl_addr);
cmd_len = 0x80;
cmd_fis = dma_memory_map(s->as, tbl_addr, &cmd_len,
DMA_DIRECTION_FROM_DEVICE);
if (!cmd_fis) {
DPRINTF(port, "error: guest passed us an invalid cmd fis\n");
return -1;
} else if (cmd_len != 0x80) {
ahci_trigger_irq(s, &s->dev[port], PORT_IRQ_HBUS_ERR);
DPRINTF(port, "error: dma_memory_map failed: "
"(len(%02"PRIx64") != 0x80)\n",
cmd_len);
goto out;
}
debug_print_fis(cmd_fis, 0x80);
switch (cmd_fis[0]) {
case SATA_FIS_TYPE_REGISTER_H2D:
handle_reg_h2d_fis(s, port, slot, cmd_fis);
break;
default:
DPRINTF(port, "unknown command cmd_fis[0]=%02x cmd_fis[1]=%02x "
"cmd_fis[2]=%02x\n", cmd_fis[0], cmd_fis[1],
cmd_fis[2]);
break;
}
out:
dma_memory_unmap(s->as, cmd_fis, cmd_len, DMA_DIRECTION_FROM_DEVICE,
cmd_len);
if (s->dev[port].port.ifs[0].status & (BUSY_STAT|DRQ_STAT)) {
/* async command, complete later */
s->dev[port].busy_slot = slot;
return -1;
}
/* done handling the command */
return 0;
}
| 6,967 |
163,107 | 0 | void BlobStorageContext::OnEnoughSpaceForCopies(const std::string& uuid,
bool success) {
if (!success) {
CancelBuildingBlob(uuid, BlobStatus::ERR_OUT_OF_MEMORY);
return;
}
BlobEntry* entry = registry_.GetEntry(uuid);
if (!entry)
return;
if (entry->CanFinishBuilding())
FinishBuilding(entry);
}
| 6,968 |
188,245 | 1 | OMX_ERRORTYPE SimpleSoftOMXComponent::internalSetParameter(
OMX_INDEXTYPE index, const OMX_PTR params) {
switch (index) {
case OMX_IndexParamPortDefinition:
{
OMX_PARAM_PORTDEFINITIONTYPE *defParams =
(OMX_PARAM_PORTDEFINITIONTYPE *)params;
if (defParams->nPortIndex >= mPorts.size()) {
return OMX_ErrorBadPortIndex;
}
if (defParams->nSize != sizeof(OMX_PARAM_PORTDEFINITIONTYPE)) {
return OMX_ErrorUnsupportedSetting;
}
PortInfo *port =
&mPorts.editItemAt(defParams->nPortIndex);
if (defParams->nBufferSize > port->mDef.nBufferSize) {
port->mDef.nBufferSize = defParams->nBufferSize;
}
if (defParams->nBufferCountActual < port->mDef.nBufferCountMin) {
ALOGW("component requires at least %u buffers (%u requested)",
port->mDef.nBufferCountMin, defParams->nBufferCountActual);
return OMX_ErrorUnsupportedSetting;
}
port->mDef.nBufferCountActual = defParams->nBufferCountActual;
return OMX_ErrorNone;
}
default:
return OMX_ErrorUnsupportedIndex;
}
}
| 6,969 |
164,551 | 0 | static void constructAutomaticIndex(
Parse *pParse, /* The parsing context */
WhereClause *pWC, /* The WHERE clause */
struct SrcList_item *pSrc, /* The FROM clause term to get the next index */
Bitmask notReady, /* Mask of cursors that are not available */
WhereLevel *pLevel /* Write new index here */
){
int nKeyCol; /* Number of columns in the constructed index */
WhereTerm *pTerm; /* A single term of the WHERE clause */
WhereTerm *pWCEnd; /* End of pWC->a[] */
Index *pIdx; /* Object describing the transient index */
Vdbe *v; /* Prepared statement under construction */
int addrInit; /* Address of the initialization bypass jump */
Table *pTable; /* The table being indexed */
int addrTop; /* Top of the index fill loop */
int regRecord; /* Register holding an index record */
int n; /* Column counter */
int i; /* Loop counter */
int mxBitCol; /* Maximum column in pSrc->colUsed */
CollSeq *pColl; /* Collating sequence to on a column */
WhereLoop *pLoop; /* The Loop object */
char *zNotUsed; /* Extra space on the end of pIdx */
Bitmask idxCols; /* Bitmap of columns used for indexing */
Bitmask extraCols; /* Bitmap of additional columns */
u8 sentWarning = 0; /* True if a warnning has been issued */
Expr *pPartial = 0; /* Partial Index Expression */
int iContinue = 0; /* Jump here to skip excluded rows */
struct SrcList_item *pTabItem; /* FROM clause term being indexed */
int addrCounter = 0; /* Address where integer counter is initialized */
int regBase; /* Array of registers where record is assembled */
/* Generate code to skip over the creation and initialization of the
** transient index on 2nd and subsequent iterations of the loop. */
v = pParse->pVdbe;
assert( v!=0 );
addrInit = sqlite3VdbeAddOp0(v, OP_Once); VdbeCoverage(v);
/* Count the number of columns that will be added to the index
** and used to match WHERE clause constraints */
nKeyCol = 0;
pTable = pSrc->pTab;
pWCEnd = &pWC->a[pWC->nTerm];
pLoop = pLevel->pWLoop;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
Expr *pExpr = pTerm->pExpr;
assert( !ExprHasProperty(pExpr, EP_FromJoin) /* prereq always non-zero */
|| pExpr->iRightJoinTable!=pSrc->iCursor /* for the right-hand */
|| pLoop->prereq!=0 ); /* table of a LEFT JOIN */
if( pLoop->prereq==0
&& (pTerm->wtFlags & TERM_VIRTUAL)==0
&& !ExprHasProperty(pExpr, EP_FromJoin)
&& sqlite3ExprIsTableConstant(pExpr, pSrc->iCursor) ){
pPartial = sqlite3ExprAnd(pParse->db, pPartial,
sqlite3ExprDup(pParse->db, pExpr, 0));
}
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS );
testcase( iCol==BMS-1 );
if( !sentWarning ){
sqlite3_log(SQLITE_WARNING_AUTOINDEX,
"automatic index on %s(%s)", pTable->zName,
pTable->aCol[iCol].zName);
sentWarning = 1;
}
if( (idxCols & cMask)==0 ){
if( whereLoopResize(pParse->db, pLoop, nKeyCol+1) ){
goto end_auto_index_create;
}
pLoop->aLTerm[nKeyCol++] = pTerm;
idxCols |= cMask;
}
}
}
assert( nKeyCol>0 );
pLoop->u.btree.nEq = pLoop->nLTerm = nKeyCol;
pLoop->wsFlags = WHERE_COLUMN_EQ | WHERE_IDX_ONLY | WHERE_INDEXED
| WHERE_AUTO_INDEX;
/* Count the number of additional columns needed to create a
** covering index. A "covering index" is an index that contains all
** columns that are needed by the query. With a covering index, the
** original table never needs to be accessed. Automatic indices must
** be a covering index because the index will not be updated if the
** original table changes and the index and table cannot both be used
** if they go out of sync.
*/
extraCols = pSrc->colUsed & (~idxCols | MASKBIT(BMS-1));
mxBitCol = MIN(BMS-1,pTable->nCol);
testcase( pTable->nCol==BMS-1 );
testcase( pTable->nCol==BMS-2 );
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ) nKeyCol++;
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
nKeyCol += pTable->nCol - BMS + 1;
}
/* Construct the Index object to describe this index */
pIdx = sqlite3AllocateIndexObject(pParse->db, nKeyCol+1, 0, &zNotUsed);
if( pIdx==0 ) goto end_auto_index_create;
pLoop->u.btree.pIndex = pIdx;
pIdx->zName = "auto-index";
pIdx->pTable = pTable;
n = 0;
idxCols = 0;
for(pTerm=pWC->a; pTerm<pWCEnd; pTerm++){
if( termCanDriveIndex(pTerm, pSrc, notReady) ){
int iCol = pTerm->u.leftColumn;
Bitmask cMask = iCol>=BMS ? MASKBIT(BMS-1) : MASKBIT(iCol);
testcase( iCol==BMS-1 );
testcase( iCol==BMS );
if( (idxCols & cMask)==0 ){
Expr *pX = pTerm->pExpr;
idxCols |= cMask;
pIdx->aiColumn[n] = pTerm->u.leftColumn;
pColl = sqlite3BinaryCompareCollSeq(pParse, pX->pLeft, pX->pRight);
pIdx->azColl[n] = pColl ? pColl->zName : sqlite3StrBINARY;
n++;
}
}
}
assert( (u32)n==pLoop->u.btree.nEq );
/* Add additional columns needed to make the automatic index into
** a covering index */
for(i=0; i<mxBitCol; i++){
if( extraCols & MASKBIT(i) ){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
if( pSrc->colUsed & MASKBIT(BMS-1) ){
for(i=BMS-1; i<pTable->nCol; i++){
pIdx->aiColumn[n] = i;
pIdx->azColl[n] = sqlite3StrBINARY;
n++;
}
}
assert( n==nKeyCol );
pIdx->aiColumn[n] = XN_ROWID;
pIdx->azColl[n] = sqlite3StrBINARY;
/* Create the automatic index */
assert( pLevel->iIdxCur>=0 );
pLevel->iIdxCur = pParse->nTab++;
sqlite3VdbeAddOp2(v, OP_OpenAutoindex, pLevel->iIdxCur, nKeyCol+1);
sqlite3VdbeSetP4KeyInfo(pParse, pIdx);
VdbeComment((v, "for %s", pTable->zName));
/* Fill the automatic index with content */
pTabItem = &pWC->pWInfo->pTabList->a[pLevel->iFrom];
if( pTabItem->fg.viaCoroutine ){
int regYield = pTabItem->regReturn;
addrCounter = sqlite3VdbeAddOp2(v, OP_Integer, 0, 0);
sqlite3VdbeAddOp3(v, OP_InitCoroutine, regYield, 0, pTabItem->addrFillSub);
addrTop = sqlite3VdbeAddOp1(v, OP_Yield, regYield);
VdbeCoverage(v);
VdbeComment((v, "next row of %s", pTabItem->pTab->zName));
}else{
addrTop = sqlite3VdbeAddOp1(v, OP_Rewind, pLevel->iTabCur); VdbeCoverage(v);
}
if( pPartial ){
iContinue = sqlite3VdbeMakeLabel(pParse);
sqlite3ExprIfFalse(pParse, pPartial, iContinue, SQLITE_JUMPIFNULL);
pLoop->wsFlags |= WHERE_PARTIALIDX;
}
regRecord = sqlite3GetTempReg(pParse);
regBase = sqlite3GenerateIndexKey(
pParse, pIdx, pLevel->iTabCur, regRecord, 0, 0, 0, 0
);
sqlite3VdbeAddOp2(v, OP_IdxInsert, pLevel->iIdxCur, regRecord);
sqlite3VdbeChangeP5(v, OPFLAG_USESEEKRESULT);
if( pPartial ) sqlite3VdbeResolveLabel(v, iContinue);
if( pTabItem->fg.viaCoroutine ){
sqlite3VdbeChangeP2(v, addrCounter, regBase+n);
testcase( pParse->db->mallocFailed );
translateColumnToCopy(pParse, addrTop, pLevel->iTabCur,
pTabItem->regResult, 1);
sqlite3VdbeGoto(v, addrTop);
pTabItem->fg.viaCoroutine = 0;
}else{
sqlite3VdbeAddOp2(v, OP_Next, pLevel->iTabCur, addrTop+1); VdbeCoverage(v);
}
sqlite3VdbeChangeP5(v, SQLITE_STMTSTATUS_AUTOINDEX);
sqlite3VdbeJumpHere(v, addrTop);
sqlite3ReleaseTempReg(pParse, regRecord);
/* Jump here when skipping the initialization */
sqlite3VdbeJumpHere(v, addrInit);
end_auto_index_create:
sqlite3ExprDelete(pParse->db, pPartial);
}
| 6,970 |
109,313 | 0 | DeviceOrientationData* InspectorPageAgent::overrideDeviceOrientation(DeviceOrientationData* deviceOrientation)
{
if (m_deviceOrientation)
deviceOrientation = m_deviceOrientation.get();
return deviceOrientation;
}
| 6,971 |
107,071 | 0 | void QQuickWebViewPrivate::setNeedsDisplay()
{
Q_Q(QQuickWebView);
if (renderToOffscreenBuffer()) {
QImage dummyImage(1, 1, QImage::Format_ARGB32);
QPainter painter(&dummyImage);
q->page()->d->paint(&painter);
return;
}
q->page()->update();
}
| 6,972 |
93,404 | 0 | static int __init net_dev_init(void)
{
int i, rc = -ENOMEM;
BUG_ON(!dev_boot_phase);
if (dev_proc_init())
goto out;
if (netdev_kobject_init())
goto out;
INIT_LIST_HEAD(&ptype_all);
for (i = 0; i < PTYPE_HASH_SIZE; i++)
INIT_LIST_HEAD(&ptype_base[i]);
INIT_LIST_HEAD(&offload_base);
if (register_pernet_subsys(&netdev_net_ops))
goto out;
/*
* Initialise the packet receive queues.
*/
for_each_possible_cpu(i) {
struct work_struct *flush = per_cpu_ptr(&flush_works, i);
struct softnet_data *sd = &per_cpu(softnet_data, i);
INIT_WORK(flush, flush_backlog);
skb_queue_head_init(&sd->input_pkt_queue);
skb_queue_head_init(&sd->process_queue);
INIT_LIST_HEAD(&sd->poll_list);
sd->output_queue_tailp = &sd->output_queue;
#ifdef CONFIG_RPS
sd->csd.func = rps_trigger_softirq;
sd->csd.info = sd;
sd->cpu = i;
#endif
sd->backlog.poll = process_backlog;
sd->backlog.weight = weight_p;
}
dev_boot_phase = 0;
/* The loopback device is special if any other network devices
* is present in a network namespace the loopback device must
* be present. Since we now dynamically allocate and free the
* loopback device ensure this invariant is maintained by
* keeping the loopback device as the first device on the
* list of network devices. Ensuring the loopback devices
* is the first device that appears and the last network device
* that disappears.
*/
if (register_pernet_device(&loopback_net_ops))
goto out;
if (register_pernet_device(&default_device_ops))
goto out;
open_softirq(NET_TX_SOFTIRQ, net_tx_action);
open_softirq(NET_RX_SOFTIRQ, net_rx_action);
rc = cpuhp_setup_state_nocalls(CPUHP_NET_DEV_DEAD, "net/dev:dead",
NULL, dev_cpu_dead);
WARN_ON(rc < 0);
rc = 0;
out:
return rc;
}
| 6,973 |
175,475 | 0 | static void lock_output_stream(struct stream_out *out)
{
pthread_mutex_lock(&out->pre_lock);
pthread_mutex_lock(&out->lock);
pthread_mutex_unlock(&out->pre_lock);
}
| 6,974 |
174,268 | 0 | void Camera3Device::RequestThread::setNotificationListener(
NotificationListener *listener) {
Mutex::Autolock l(mRequestLock);
mListener = listener;
}
| 6,975 |
166,481 | 0 | std::unique_ptr<base::Value> StringVectorToValue(
const std::vector<std::string>& strings) {
ListBuilder builder;
for (const auto& str : strings)
builder.Append(str);
return builder.Build();
}
| 6,976 |
160,939 | 0 | void ChromeClientImpl::ClearCompositedSelection(LocalFrame* frame) {
LocalFrame& local_root = frame->LocalFrameRoot();
WebFrameWidgetBase* widget =
WebLocalFrameImpl::FromFrame(&local_root)->FrameWidget();
WebWidgetClient* client = widget->Client();
if (!client)
return;
if (WebLayerTreeView* layer_tree_view = widget->GetLayerTreeView())
layer_tree_view->ClearSelection();
}
| 6,977 |
133,944 | 0 | void AppListControllerDelegateImpl::LaunchApp(
Profile* profile,
const extensions::Extension* extension,
AppListSource source,
int event_flags) {
AppListServiceImpl::RecordAppListAppLaunch();
AppLaunchParams params(profile, extension, NEW_FOREGROUND_TAB,
extensions::SOURCE_APP_LAUNCHER);
if (source != LAUNCH_FROM_UNKNOWN &&
extension->id() == extensions::kWebStoreAppId) {
GURL extension_url = extensions::AppLaunchInfo::GetFullLaunchURL(extension);
params.override_url = net::AppendQueryParameter(
extension_url,
extension_urls::kWebstoreSourceField,
AppListSourceToString(source));
}
FillLaunchParams(¶ms);
OpenApplication(params);
}
| 6,978 |
141,985 | 0 | void AutofillExternalDelegate::OnAutofillAvailabilityEvent(
bool has_suggestions) {
if (has_suggestions) {
ui::AXPlatformNode::OnInputSuggestionsAvailable();
} else {
ui::AXPlatformNode::OnInputSuggestionsUnavailable();
}
}
| 6,979 |
97,759 | 0 | xmlXPathParseNCName(xmlXPathParserContextPtr ctxt) {
const xmlChar *in;
xmlChar *ret;
int count = 0;
if ((ctxt == NULL) || (ctxt->cur == NULL)) return(NULL);
/*
* Accelerator for simple ASCII names
*/
in = ctxt->cur;
if (((*in >= 0x61) && (*in <= 0x7A)) ||
((*in >= 0x41) && (*in <= 0x5A)) ||
(*in == '_')) {
in++;
while (((*in >= 0x61) && (*in <= 0x7A)) ||
((*in >= 0x41) && (*in <= 0x5A)) ||
((*in >= 0x30) && (*in <= 0x39)) ||
(*in == '_') || (*in == '.') ||
(*in == '-'))
in++;
if ((*in == ' ') || (*in == '>') || (*in == '/') ||
(*in == '[') || (*in == ']') || (*in == ':') ||
(*in == '@') || (*in == '*')) {
count = in - ctxt->cur;
if (count == 0)
return(NULL);
ret = xmlStrndup(ctxt->cur, count);
ctxt->cur = in;
return(ret);
}
}
return(xmlXPathParseNameComplex(ctxt, 0));
}
| 6,980 |
67,970 | 0 | static int jp2_jp_getdata(jp2_box_t *box, jas_stream_t *in)
{
jp2_jp_t *jp = &box->data.jp;
if (jp2_getuint32(in, &jp->magic)) {
return -1;
}
return 0;
}
| 6,981 |
3,681 | 0 | static void lsi_do_dma(LSIState *s, int out)
{
uint32_t count;
dma_addr_t addr;
SCSIDevice *dev;
assert(s->current);
if (!s->current->dma_len) {
/* Wait until data is available. */
trace_lsi_do_dma_unavailable();
return;
}
dev = s->current->req->dev;
assert(dev);
count = s->dbc;
if (count > s->current->dma_len)
count = s->current->dma_len;
addr = s->dnad;
/* both 40 and Table Indirect 64-bit DMAs store upper bits in dnad64 */
if (lsi_dma_40bit(s) || lsi_dma_ti64bit(s))
addr |= ((uint64_t)s->dnad64 << 32);
else if (s->dbms)
addr |= ((uint64_t)s->dbms << 32);
else if (s->sbms)
addr |= ((uint64_t)s->sbms << 32);
trace_lsi_do_dma(addr, count);
s->csbc += count;
s->dnad += count;
s->dbc -= count;
if (s->current->dma_buf == NULL) {
s->current->dma_buf = scsi_req_get_buf(s->current->req);
}
/* ??? Set SFBR to first data byte. */
if (out) {
lsi_mem_read(s, addr, s->current->dma_buf, count);
} else {
lsi_mem_write(s, addr, s->current->dma_buf, count);
}
s->current->dma_len -= count;
if (s->current->dma_len == 0) {
s->current->dma_buf = NULL;
scsi_req_continue(s->current->req);
} else {
s->current->dma_buf += count;
lsi_resume_script(s);
}
}
| 6,982 |
109,404 | 0 | void AsyncFileSystemChromium::createDirectory(const KURL& path, bool exclusive, PassOwnPtr<AsyncFileSystemCallbacks> callbacks)
{
m_webFileSystem->createDirectory(path, exclusive, new WebKit::WebFileSystemCallbacksImpl(callbacks));
}
| 6,983 |
2,401 | 0 | uint32_t smb1cli_conn_server_session_key(struct smbXcli_conn *conn)
{
return conn->smb1.server.session_key;
}
| 6,984 |
103,081 | 0 | void Browser::ConfirmSetDefaultSearchProvider(
TabContents* tab_contents,
TemplateURL* template_url,
TemplateURLModel* template_url_model) {
window()->ConfirmSetDefaultSearchProvider(tab_contents, template_url,
template_url_model);
}
| 6,985 |
62,361 | 0 | ip_printts(netdissect_options *ndo,
register const u_char *cp, u_int length)
{
register u_int ptr;
register u_int len;
int hoplen;
const char *type;
if (length < 4) {
ND_PRINT((ndo, "[bad length %u]", length));
return;
}
ND_PRINT((ndo, " TS{"));
hoplen = ((cp[3]&0xF) != IPOPT_TS_TSONLY) ? 8 : 4;
if ((length - 4) & (hoplen-1))
ND_PRINT((ndo, "[bad length %u]", length));
ptr = cp[2] - 1;
len = 0;
if (ptr < 4 || ((ptr - 4) & (hoplen-1)) || ptr > length + 1)
ND_PRINT((ndo, "[bad ptr %u]", cp[2]));
switch (cp[3]&0xF) {
case IPOPT_TS_TSONLY:
ND_PRINT((ndo, "TSONLY"));
break;
case IPOPT_TS_TSANDADDR:
ND_PRINT((ndo, "TS+ADDR"));
break;
/*
* prespecified should really be 3, but some ones might send 2
* instead, and the IPOPT_TS_PRESPEC constant can apparently
* have both values, so we have to hard-code it here.
*/
case 2:
ND_PRINT((ndo, "PRESPEC2.0"));
break;
case 3: /* IPOPT_TS_PRESPEC */
ND_PRINT((ndo, "PRESPEC"));
break;
default:
ND_PRINT((ndo, "[bad ts type %d]", cp[3]&0xF));
goto done;
}
type = " ";
for (len = 4; len < length; len += hoplen) {
if (ptr == len)
type = " ^ ";
ND_PRINT((ndo, "%s%d@%s", type, EXTRACT_32BITS(&cp[len+hoplen-4]),
hoplen!=8 ? "" : ipaddr_string(ndo, &cp[len])));
type = " ";
}
done:
ND_PRINT((ndo, "%s", ptr == len ? " ^ " : ""));
if (cp[3]>>4)
ND_PRINT((ndo, " [%d hops not recorded]} ", cp[3]>>4));
else
ND_PRINT((ndo, "}"));
| 6,986 |
39,941 | 0 | static bool spd_fill_page(struct splice_pipe_desc *spd,
struct pipe_inode_info *pipe, struct page *page,
unsigned int *len, unsigned int offset,
bool linear,
struct sock *sk)
{
if (unlikely(spd->nr_pages == MAX_SKB_FRAGS))
return true;
if (linear) {
page = linear_to_page(page, len, &offset, sk);
if (!page)
return true;
}
if (spd_can_coalesce(spd, page, offset)) {
spd->partial[spd->nr_pages - 1].len += *len;
return false;
}
get_page(page);
spd->pages[spd->nr_pages] = page;
spd->partial[spd->nr_pages].len = *len;
spd->partial[spd->nr_pages].offset = offset;
spd->nr_pages++;
return false;
}
| 6,987 |
109,675 | 0 | void Document::explicitClose()
{
if (RefPtr<DocumentParser> parser = m_parser)
parser->finish();
if (!m_frame) {
implicitClose();
return;
}
m_frame->loader()->checkCompleted();
}
| 6,988 |
161,421 | 0 | Response ServiceWorkerHandler::SkipWaiting(const std::string& scope_url) {
if (!enabled_)
return CreateDomainNotEnabledErrorResponse();
if (!context_)
return CreateContextErrorResponse();
context_->SkipWaitingWorker(GURL(scope_url));
return Response::OK();
}
| 6,989 |
69,545 | 0 | static struct key *construct_key_and_link(struct keyring_search_context *ctx,
const char *callout_info,
size_t callout_len,
void *aux,
struct key *dest_keyring,
unsigned long flags)
{
struct key_user *user;
struct key *key;
int ret;
kenter("");
user = key_user_lookup(current_fsuid());
if (!user)
return ERR_PTR(-ENOMEM);
construct_get_dest_keyring(&dest_keyring);
ret = construct_alloc_key(ctx, dest_keyring, flags, user, &key);
key_user_put(user);
if (ret == 0) {
ret = construct_key(key, callout_info, callout_len, aux,
dest_keyring);
if (ret < 0) {
kdebug("cons failed");
goto construction_failed;
}
} else if (ret == -EINPROGRESS) {
ret = 0;
} else {
goto couldnt_alloc_key;
}
key_put(dest_keyring);
kleave(" = key %d", key_serial(key));
return key;
construction_failed:
key_negate_and_link(key, key_negative_timeout, NULL, NULL);
key_put(key);
couldnt_alloc_key:
key_put(dest_keyring);
kleave(" = %d", ret);
return ERR_PTR(ret);
}
| 6,990 |
34,593 | 0 | pkinit_server_plugin_fini(krb5_context context,
krb5_kdcpreauth_moddata moddata)
{
pkinit_kdc_context *realm_contexts = (pkinit_kdc_context *)moddata;
int i;
if (realm_contexts == NULL)
return;
for (i = 0; realm_contexts[i] != NULL; i++) {
pkinit_server_plugin_fini_realm(context, realm_contexts[i]);
}
pkiDebug("%s: freeing context at %p\n", __FUNCTION__, realm_contexts);
free(realm_contexts);
}
| 6,991 |
103,859 | 0 | bool RenderView::SupportsAsynchronousSwapBuffers() {
WebKit::WebGraphicsContext3D* context = webview()->graphicsContext3D();
if (!context)
return false;
std::string extensions(context->getRequestableExtensionsCHROMIUM().utf8());
return extensions.find("GL_CHROMIUM_swapbuffers_complete_callback") !=
std::string::npos;
}
| 6,992 |
95,773 | 0 | long FS_FOpenFileReadDir(const char *filename, searchpath_t *search, fileHandle_t *file, qboolean uniqueFILE, qboolean unpure)
{
long hash;
pack_t *pak;
fileInPack_t *pakFile;
directory_t *dir;
char *netpath;
FILE *filep;
int len;
if(filename == NULL)
Com_Error(ERR_FATAL, "FS_FOpenFileRead: NULL 'filename' parameter passed");
if(filename[0] == '/' || filename[0] == '\\')
filename++;
if(strstr(filename, ".." ) || strstr(filename, "::"))
{
if(file == NULL)
return qfalse;
*file = 0;
return -1;
}
if(com_fullyInitialized && strstr(filename, "rtcwkey"))
{
if(file == NULL)
return qfalse;
*file = 0;
return -1;
}
if(file == NULL)
{
if(search->pack)
{
hash = FS_HashFileName(filename, search->pack->hashSize);
if(search->pack->hashTable[hash] && !(fs_filter_flag & FS_EXCLUDE_PK3))
{
pak = search->pack;
pakFile = pak->hashTable[hash];
do
{
if(!FS_FilenameCompare(pakFile->name, filename))
{
if(pakFile->len)
return pakFile->len;
else
{
return 1;
}
}
pakFile = pakFile->next;
} while(pakFile != NULL);
}
}
else if(search->dir && !(fs_filter_flag & FS_EXCLUDE_DIR))
{
dir = search->dir;
netpath = FS_BuildOSPath(dir->path, dir->gamedir, filename);
filep = Sys_FOpen(netpath, "rb");
if(filep)
{
len = FS_fplength(filep);
fclose(filep);
if(len)
return len;
else
return 1;
}
}
return 0;
}
*file = FS_HandleForFile();
fsh[*file].handleFiles.unique = uniqueFILE;
if(search->pack)
{
hash = FS_HashFileName(filename, search->pack->hashSize);
if(search->pack->hashTable[hash] && !(fs_filter_flag & FS_EXCLUDE_PK3))
{
if(!unpure && !FS_PakIsPure(search->pack))
{
*file = 0;
return -1;
}
pak = search->pack;
pakFile = pak->hashTable[hash];
do
{
if(!FS_FilenameCompare(pakFile->name, filename))
{
len = strlen(filename);
if (!(pak->referenced & FS_GENERAL_REF))
{
if(!FS_IsExt(filename, ".shader", len) &&
!FS_IsExt(filename, ".txt", len) &&
!FS_IsExt(filename, ".cfg", len) &&
!FS_IsExt(filename, ".config", len) &&
!FS_IsExt(filename, ".bot", len) &&
!FS_IsExt(filename, ".arena", len) &&
!FS_IsExt(filename, ".menu", len) &&
!strstr(filename, "levelshots"))
{
pak->referenced |= FS_GENERAL_REF;
}
}
if(strstr(filename, Sys_GetDLLName( "cgame" )))
pak->referenced |= FS_CGAME_REF;
if(strstr(filename, Sys_GetDLLName( "ui" )))
pak->referenced |= FS_UI_REF;
if(strstr(filename, "cgame.mp.qvm"))
pak->referenced |= FS_CGAME_REF;
if(strstr(filename, "ui.mp.qvm"))
pak->referenced |= FS_UI_REF;
if ( Q_stricmp( filename + len - 4, ".bsp" ) == 0 &&
Q_stricmp( pak->pakBasename, "pak0" ) == 0 ) {
*file = 0;
return -1;
}
if(uniqueFILE)
{
fsh[*file].handleFiles.file.z = unzOpen(pak->pakFilename);
if(fsh[*file].handleFiles.file.z == NULL)
Com_Error(ERR_FATAL, "Couldn't open %s", pak->pakFilename);
}
else
fsh[*file].handleFiles.file.z = pak->handle;
Q_strncpyz(fsh[*file].name, filename, sizeof(fsh[*file].name));
fsh[*file].zipFile = qtrue;
unzSetOffset(fsh[*file].handleFiles.file.z, pakFile->pos);
unzOpenCurrentFile(fsh[*file].handleFiles.file.z);
fsh[*file].zipFilePos = pakFile->pos;
fsh[*file].zipFileLen = pakFile->len;
if(fs_debug->integer)
{
Com_Printf("FS_FOpenFileRead: %s (found in '%s')\n",
filename, pak->pakFilename);
}
return pakFile->len;
}
pakFile = pakFile->next;
} while(pakFile != NULL);
}
}
else if(search->dir && !(fs_filter_flag & FS_EXCLUDE_DIR))
{
len = strlen(filename);
if(!unpure && fs_numServerPaks)
{
if(!FS_IsExt(filename, ".cfg", len) && // for config files
!FS_IsExt(filename, ".menu", len) && // menu files
!FS_IsExt(filename, ".game", len) && // menu files
!FS_IsExt(filename, ".dat", len) && // for journal files
!FS_IsDemoExt(filename, len)) // demos
{
*file = 0;
return -1;
}
}
dir = search->dir;
netpath = FS_BuildOSPath(dir->path, dir->gamedir, filename);
filep = Sys_FOpen(netpath, "rb");
if (filep == NULL)
{
*file = 0;
return -1;
}
Q_strncpyz(fsh[*file].name, filename, sizeof(fsh[*file].name));
fsh[*file].zipFile = qfalse;
if(fs_debug->integer)
{
Com_Printf("FS_FOpenFileRead: %s (found in '%s%c%s')\n", filename,
dir->path, PATH_SEP, dir->gamedir);
}
fsh[*file].handleFiles.file.o = filep;
return FS_fplength(filep);
}
*file = 0;
return -1;
}
| 6,993 |
131,110 | 0 | static void unsignedShortAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
TestObjectV8Internal::unsignedShortAttrAttributeSetter(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 6,994 |
18,800 | 0 | static int __init init_ipv4_mibs(void)
{
return register_pernet_subsys(&ipv4_mib_ops);
}
| 6,995 |
92,178 | 0 | static void raw_packet_qp_copy_info(struct mlx5_ib_qp *qp,
struct mlx5_ib_raw_packet_qp *raw_packet_qp)
{
struct mlx5_ib_sq *sq = &raw_packet_qp->sq;
struct mlx5_ib_rq *rq = &raw_packet_qp->rq;
sq->sq = &qp->sq;
rq->rq = &qp->rq;
sq->doorbell = &qp->db;
rq->doorbell = &qp->db;
}
| 6,996 |
38,552 | 0 | void rdma_leave_multicast(struct rdma_cm_id *id, struct sockaddr *addr)
{
struct rdma_id_private *id_priv;
struct cma_multicast *mc;
id_priv = container_of(id, struct rdma_id_private, id);
spin_lock_irq(&id_priv->lock);
list_for_each_entry(mc, &id_priv->mc_list, list) {
if (!memcmp(&mc->addr, addr, rdma_addr_size(addr))) {
list_del(&mc->list);
spin_unlock_irq(&id_priv->lock);
if (id->qp)
ib_detach_mcast(id->qp,
&mc->multicast.ib->rec.mgid,
be16_to_cpu(mc->multicast.ib->rec.mlid));
if (rdma_node_get_transport(id_priv->cma_dev->device->node_type) == RDMA_TRANSPORT_IB) {
switch (rdma_port_get_link_layer(id->device, id->port_num)) {
case IB_LINK_LAYER_INFINIBAND:
ib_sa_free_multicast(mc->multicast.ib);
kfree(mc);
break;
case IB_LINK_LAYER_ETHERNET:
kref_put(&mc->mcref, release_mc);
break;
default:
break;
}
}
return;
}
}
spin_unlock_irq(&id_priv->lock);
}
| 6,997 |
164,686 | 0 | bool RenderFrameHostImpl::CreateRenderFrame(int proxy_routing_id,
int opener_routing_id,
int parent_routing_id,
int previous_sibling_routing_id) {
TRACE_EVENT0("navigation", "RenderFrameHostImpl::CreateRenderFrame");
DCHECK(!IsRenderFrameLive()) << "Creating frame twice";
if (!GetProcess()->Init())
return false;
DCHECK(GetProcess()->IsInitializedAndNotDead());
service_manager::mojom::InterfaceProviderPtr interface_provider;
BindInterfaceProviderRequest(mojo::MakeRequest(&interface_provider));
blink::mojom::DocumentInterfaceBrokerPtrInfo
document_interface_broker_content_info;
blink::mojom::DocumentInterfaceBrokerPtrInfo
document_interface_broker_blink_info;
BindDocumentInterfaceBrokerRequest(
mojo::MakeRequest(&document_interface_broker_content_info),
mojo::MakeRequest(&document_interface_broker_blink_info));
mojom::CreateFrameParamsPtr params = mojom::CreateFrameParams::New();
params->interface_bundle = mojom::DocumentScopedInterfaceBundle::New(
interface_provider.PassInterface(),
std::move(document_interface_broker_content_info),
std::move(document_interface_broker_blink_info));
params->routing_id = routing_id_;
params->proxy_routing_id = proxy_routing_id;
params->opener_routing_id = opener_routing_id;
params->parent_routing_id = parent_routing_id;
params->previous_sibling_routing_id = previous_sibling_routing_id;
params->replication_state = frame_tree_node()->current_replication_state();
params->devtools_frame_token = frame_tree_node()->devtools_frame_token();
params->replication_state.frame_policy =
frame_tree_node()->pending_frame_policy();
params->frame_owner_properties =
FrameOwnerProperties(frame_tree_node()->frame_owner_properties());
params->has_committed_real_load =
frame_tree_node()->has_committed_real_load();
params->widget_params = mojom::CreateFrameWidgetParams::New();
if (render_widget_host_) {
params->widget_params->routing_id = render_widget_host_->GetRoutingID();
params->widget_params->hidden = render_widget_host_->is_hidden();
} else {
params->widget_params->routing_id = MSG_ROUTING_NONE;
params->widget_params->hidden = true;
}
GetProcess()->GetRendererInterface()->CreateFrame(std::move(params));
if (parent_routing_id != MSG_ROUTING_NONE && render_widget_host_) {
RenderWidgetHostView* rwhv =
RenderWidgetHostViewChildFrame::Create(render_widget_host_);
rwhv->Hide();
}
if (proxy_routing_id != MSG_ROUTING_NONE) {
RenderFrameProxyHost* proxy = RenderFrameProxyHost::FromID(
GetProcess()->GetID(), proxy_routing_id);
proxy->set_render_frame_proxy_created(true);
}
SetRenderFrameCreated(true);
return true;
}
| 6,998 |
131,051 | 0 | static void shortAttrAttributeSetter(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
ExceptionState exceptionState(ExceptionState::SetterContext, "shortAttr", "TestObject", info.Holder(), info.GetIsolate());
TestObject* imp = V8TestObject::toNative(info.Holder());
V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt16(jsValue, exceptionState), exceptionState);
imp->setShortAttr(cppValue);
}
| 6,999 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.