unique_id
int64
13
189k
target
int64
0
1
code
stringlengths
20
241k
__index_level_0__
int64
0
18.9k
183,591
1
uint32 PluginInstance::ScheduleTimer(uint32 interval, NPBool repeat, void (*func)(NPP id, uint32 timer_id)) { // Use next timer id. uint32 timer_id; timer_id = next_timer_id_; ++next_timer_id_; DCHECK(next_timer_id_ != 0); // Record timer interval and repeat. TimerInfo info; info.interval = interval; info.repeat = repeat; timers_[timer_id] = info; // Schedule the callback. message_loop_->PostDelayedTask(FROM_HERE, NewRunnableMethod(this, &PluginInstance::OnTimerCall, func, npp_, timer_id), interval); return timer_id; }
17,400
165,810
0
void SVGElement::MapInstanceToElement(SVGElement* instance) { DCHECK(instance); DCHECK(instance->InUseShadowTree()); HeapHashSet<WeakMember<SVGElement>>& instances = EnsureSVGRareData()->ElementInstances(); DCHECK(!instances.Contains(instance)); instances.insert(instance); }
17,401
188,615
1
void VarianceTest<VarianceFunctionType>::ZeroTest() { for (int i = 0; i <= 255; ++i) { memset(src_, i, block_size_); for (int j = 0; j <= 255; ++j) { memset(ref_, j, block_size_); unsigned int sse; unsigned int var; REGISTER_STATE_CHECK(var = variance_(src_, width_, ref_, width_, &sse)); EXPECT_EQ(0u, var) << "src values: " << i << "ref values: " << j; } } }
17,402
179,871
1
static int rt_fill_info(struct net *net, __be32 dst, __be32 src, struct flowi4 *fl4, struct sk_buff *skb, u32 portid, u32 seq, int event, int nowait, unsigned int flags) { struct rtable *rt = skb_rtable(skb); struct rtmsg *r; struct nlmsghdr *nlh; unsigned long expires = 0; u32 error; u32 metrics[RTAX_MAX]; nlh = nlmsg_put(skb, portid, seq, event, sizeof(*r), flags); if (nlh == NULL) return -EMSGSIZE; r = nlmsg_data(nlh); r->rtm_family = AF_INET; r->rtm_dst_len = 32; r->rtm_src_len = 0; r->rtm_tos = fl4->flowi4_tos; r->rtm_table = RT_TABLE_MAIN; if (nla_put_u32(skb, RTA_TABLE, RT_TABLE_MAIN)) goto nla_put_failure; r->rtm_type = rt->rt_type; r->rtm_scope = RT_SCOPE_UNIVERSE; r->rtm_protocol = RTPROT_UNSPEC; r->rtm_flags = (rt->rt_flags & ~0xFFFF) | RTM_F_CLONED; if (rt->rt_flags & RTCF_NOTIFY) r->rtm_flags |= RTM_F_NOTIFY; if (nla_put_be32(skb, RTA_DST, dst)) goto nla_put_failure; if (src) { r->rtm_src_len = 32; if (nla_put_be32(skb, RTA_SRC, src)) goto nla_put_failure; } if (rt->dst.dev && nla_put_u32(skb, RTA_OIF, rt->dst.dev->ifindex)) goto nla_put_failure; #ifdef CONFIG_IP_ROUTE_CLASSID if (rt->dst.tclassid && nla_put_u32(skb, RTA_FLOW, rt->dst.tclassid)) goto nla_put_failure; #endif if (!rt_is_input_route(rt) && fl4->saddr != src) { if (nla_put_be32(skb, RTA_PREFSRC, fl4->saddr)) goto nla_put_failure; } if (rt->rt_uses_gateway && nla_put_be32(skb, RTA_GATEWAY, rt->rt_gateway)) goto nla_put_failure; expires = rt->dst.expires; if (expires) { unsigned long now = jiffies; if (time_before(now, expires)) expires -= now; else expires = 0; } memcpy(metrics, dst_metrics_ptr(&rt->dst), sizeof(metrics)); if (rt->rt_pmtu && expires) metrics[RTAX_MTU - 1] = rt->rt_pmtu; if (rtnetlink_put_metrics(skb, metrics) < 0) goto nla_put_failure; if (fl4->flowi4_mark && nla_put_u32(skb, RTA_MARK, fl4->flowi4_mark)) goto nla_put_failure; error = rt->dst.error; if (rt_is_input_route(rt)) { #ifdef CONFIG_IP_MROUTE if (ipv4_is_multicast(dst) && !ipv4_is_local_multicast(dst) && IPV4_DEVCONF_ALL(net, MC_FORWARDING)) { int err = ipmr_get_route(net, skb, fl4->saddr, fl4->daddr, r, nowait); if (err <= 0) { if (!nowait) { if (err == 0) return 0; goto nla_put_failure; } else { if (err == -EMSGSIZE) goto nla_put_failure; error = err; } } } else #endif if (nla_put_u32(skb, RTA_IIF, skb->dev->ifindex)) goto nla_put_failure; } if (rtnl_put_cacheinfo(skb, &rt->dst, 0, expires, error) < 0) goto nla_put_failure; return nlmsg_end(skb, nlh); nla_put_failure: nlmsg_cancel(skb, nlh); return -EMSGSIZE; }
17,403
97,556
0
string16 BuildSnippet(const std::string& document, const std::string& query) { const std::string document_folded = StringToLowerASCII(std::string(document)); std::vector<std::string> query_words; SplitString(query, ' ', &query_words); Snippet::MatchPositions match_positions; match_positions.clear(); for (std::vector<std::string>::iterator qw = query_words.begin(); qw != query_words.end(); ++qw) { size_t ofs = 0; while ((ofs = document_folded.find(*qw, ofs)) != std::string::npos) { match_positions.push_back(std::make_pair(ofs, ofs + qw->size())); ofs += qw->size(); } } std::sort(match_positions.begin(), match_positions.end(), ComparePair1st); Snippet snippet; snippet.ComputeSnippet(match_positions, document); string16 star_snippet; Snippet::MatchPositions::const_iterator match; size_t pos = 0; for (match = snippet.matches().begin(); match != snippet.matches().end(); ++match) { star_snippet += snippet.text().substr(pos, match->first - pos); star_snippet += UTF8ToUTF16("**"); star_snippet += snippet.text().substr(match->first, match->second - match->first); star_snippet += UTF8ToUTF16("**"); pos = match->second; } star_snippet += snippet.text().substr(pos); return star_snippet; }
17,404
8,502
0
CSoundFile::~CSoundFile() { Destroy(); }
17,405
59,370
0
static bool xfrm_is_alive(const struct km_event *c) { return (bool)xfrm_acquire_is_on(c->net); }
17,406
151,717
0
bool Browser::PreHandleKeyboardEvent(content::WebContents* source, const NativeWebKeyboardEvent& event, bool* is_keyboard_shortcut) { if (exclusive_access_manager_->HandleUserKeyPress(event)) return true; return window()->PreHandleKeyboardEvent(event, is_keyboard_shortcut); }
17,407
87,082
0
CJSON_PUBLIC(cJSON_bool) cJSON_Compare(const cJSON * const a, const cJSON * const b, const cJSON_bool case_sensitive) { if ((a == NULL) || (b == NULL) || ((a->type & 0xFF) != (b->type & 0xFF)) || cJSON_IsInvalid(a)) { return false; } /* check if type is valid */ switch (a->type & 0xFF) { case cJSON_False: case cJSON_True: case cJSON_NULL: case cJSON_Number: case cJSON_String: case cJSON_Raw: case cJSON_Array: case cJSON_Object: break; default: return false; } /* identical objects are equal */ if (a == b) { return true; } switch (a->type & 0xFF) { /* in these cases and equal type is enough */ case cJSON_False: case cJSON_True: case cJSON_NULL: return true; case cJSON_Number: if (a->valuedouble == b->valuedouble) { return true; } return false; case cJSON_String: case cJSON_Raw: if ((a->valuestring == NULL) || (b->valuestring == NULL)) { return false; } if (strcmp(a->valuestring, b->valuestring) == 0) { return true; } return false; case cJSON_Array: { cJSON *a_element = a->child; cJSON *b_element = b->child; for (; (a_element != NULL) && (b_element != NULL);) { if (!cJSON_Compare(a_element, b_element, case_sensitive)) { return false; } a_element = a_element->next; b_element = b_element->next; } /* one of the arrays is longer than the other */ if (a_element != b_element) { return false; } return true; } case cJSON_Object: { cJSON *a_element = NULL; cJSON *b_element = NULL; cJSON_ArrayForEach(a_element, a) { /* TODO This has O(n^2) runtime, which is horrible! */ b_element = get_object_item(b, a_element->string, case_sensitive); if (b_element == NULL) { return false; } if (!cJSON_Compare(a_element, b_element, case_sensitive)) { return false; } } /* doing this twice, once on a and b to prevent true comparison if a subset of b * TODO: Do this the proper way, this is just a fix for now */ cJSON_ArrayForEach(b_element, b) { a_element = get_object_item(a, b_element->string, case_sensitive); if (a_element == NULL) { return false; } if (!cJSON_Compare(b_element, a_element, case_sensitive)) { return false; } } return true; } default: return false; } }
17,408
80,655
0
GF_Box *uuid_New() { ISOM_DECL_BOX_ALLOC(GF_UnknownUUIDBox, GF_ISOM_BOX_TYPE_UUID); return (GF_Box *) tmp; }
17,409
122,916
0
bool RenderProcessHostImpl::ShouldUseProcessPerSite( BrowserContext* browser_context, const GURL& url) { const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kProcessPerSite)) return true; if (GetContentClient()->browser()-> ShouldUseProcessPerSite(browser_context, url)) { return true; } WebUIControllerFactory* factory = GetContentClient()->browser()->GetWebUIControllerFactory(); if (factory && factory->UseWebUIForURL(browser_context, url) && !url.SchemeIs(chrome::kChromeDevToolsScheme)) { return true; } return false; }
17,410
166,912
0
void Performance::mark( ScriptState* script_state, const String& mark_name, DoubleOrPerformanceMarkOptions& start_time_or_mark_options, ExceptionState& exception_state) { if (!RuntimeEnabledFeatures::CustomUserTimingEnabled()) { DCHECK(start_time_or_mark_options.IsNull()); } if (!user_timing_) user_timing_ = UserTiming::Create(*this); DOMHighResTimeStamp start = 0.0; if (start_time_or_mark_options.IsDouble()) { start = start_time_or_mark_options.GetAsDouble(); } else if (start_time_or_mark_options.IsPerformanceMarkOptions() && start_time_or_mark_options.GetAsPerformanceMarkOptions() .hasStartTime()) { start = start_time_or_mark_options.GetAsPerformanceMarkOptions().startTime(); } else { start = now(); } ScriptValue detail = ScriptValue::CreateNull(script_state); if (start_time_or_mark_options.IsPerformanceMarkOptions()) { detail = start_time_or_mark_options.GetAsPerformanceMarkOptions().detail(); } if (PerformanceEntry* entry = user_timing_->Mark( script_state, mark_name, start, detail, exception_state)) NotifyObserversOfEntry(*entry); }
17,411
82,609
0
bool isNumeric(char ch) { return (ch>='0') && (ch<='9'); }
17,412
103,357
0
void ConvertRGB24ToYUV(const uint8* rgbframe, uint8* yplane, uint8* uplane, uint8* vplane, int width, int height, int rgbstride, int ystride, int uvstride) { ConvertRGB24ToYUV_C(rgbframe, yplane, uplane, vplane, width, height, rgbstride, ystride, uvstride); }
17,413
111,443
0
void InputHandler::cancelSelection() { if (!isActiveTextEdit()) return; ASSERT(m_currentFocusElement->document() && m_currentFocusElement->document()->frame()); int selectionStartPosition = selectionStart(); ProcessingChangeGuard guard(this); setCursorPosition(selectionStartPosition); }
17,414
174,662
0
sp<IMemoryHeap> HeapCache::get_heap(const sp<IBinder>& binder) { sp<IMemoryHeap> realHeap; Mutex::Autolock _l(mHeapCacheLock); ssize_t i = mHeapCache.indexOfKey(binder); if (i>=0) realHeap = mHeapCache.valueAt(i).heap; else realHeap = interface_cast<IMemoryHeap>(binder); return realHeap; }
17,415
74,656
0
struct wif *net_open(char *iface) { struct wif *wi; struct priv_net *pn; int s; /* setup wi struct */ wi = wi_alloc(sizeof(*pn)); if (!wi) return NULL; wi->wi_read = net_read; wi->wi_write = net_write; wi->wi_set_channel = net_set_channel; wi->wi_get_channel = net_get_channel; wi->wi_set_rate = net_set_rate; wi->wi_get_rate = net_get_rate; wi->wi_close = net_close; wi->wi_fd = net_fd; wi->wi_get_mac = net_get_mac; wi->wi_get_monitor = net_get_monitor; /* setup iface */ s = do_net_open(iface); if (s == -1) { do_net_free(wi); return NULL; } /* setup private state */ pn = wi_priv(wi); pn->pn_s = s; pn->pn_queue.q_next = pn->pn_queue.q_prev = &pn->pn_queue; pn->pn_queue_free.q_next = pn->pn_queue_free.q_prev = &pn->pn_queue_free; return wi; }
17,416
155,420
0
void ChromeContentBrowserClient::OnNetworkServiceDataUseUpdate( int32_t network_traffic_annotation_id_hash, int64_t recv_bytes, int64_t sent_bytes) { if (data_use_measurement::ChromeDataUseMeasurement::GetInstance()) { data_use_measurement::ChromeDataUseMeasurement::GetInstance() ->ReportNetworkServiceDataUse(network_traffic_annotation_id_hash, recv_bytes, sent_bytes); } }
17,417
127,767
0
int MockNetworkTransaction::Start(const HttpRequestInfo* request, const CompletionCallback& callback, const BoundNetLog& net_log) { if (request_) return ERR_FAILED; request_ = request; return StartInternal(request, callback, net_log); }
17,418
178,149
1
static void php_snmp_object_free_storage(void *object TSRMLS_DC) { php_snmp_object *intern = (php_snmp_object *)object; if (!intern) { return; } netsnmp_session_free(&(intern->session)); zend_object_std_dtor(&intern->zo TSRMLS_CC); efree(intern); }
17,419
172,596
0
AudioFlinger::EffectChain::EffectChain(ThreadBase *thread, int sessionId) : mThread(thread), mSessionId(sessionId), mActiveTrackCnt(0), mTrackCnt(0), mTailBufferCount(0), mOwnInBuffer(false), mVolumeCtrlIdx(-1), mLeftVolume(UINT_MAX), mRightVolume(UINT_MAX), mNewLeftVolume(UINT_MAX), mNewRightVolume(UINT_MAX), mForceVolume(false) { mStrategy = AudioSystem::getStrategyForStream(AUDIO_STREAM_MUSIC); if (thread == NULL) { return; } mMaxTailBuffers = ((kProcessTailDurationMs * thread->sampleRate()) / 1000) / thread->frameCount(); }
17,420
155,296
0
bool ChromeContentBrowserClient::CanIgnoreCertificateErrorIfNeeded() { return base::CommandLine::ForCurrentProcess()->HasSwitch( switches::kUserDataDir); }
17,421
38,936
0
make_bound_box(POLYGON *poly) { int i; double x1, y1, x2, y2; if (poly->npts > 0) { x2 = x1 = poly->p[0].x; y2 = y1 = poly->p[0].y; for (i = 1; i < poly->npts; i++) { if (poly->p[i].x < x1) x1 = poly->p[i].x; if (poly->p[i].x > x2) x2 = poly->p[i].x; if (poly->p[i].y < y1) y1 = poly->p[i].y; if (poly->p[i].y > y2) y2 = poly->p[i].y; } box_fill(&(poly->boundbox), x1, x2, y1, y2); } else ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("cannot create bounding box for empty polygon"))); }
17,422
130,291
0
ULONG DataObjectImpl::Release() { base::RefCountedThreadSafe<DownloadFileObserver>::Release(); return 0; }
17,423
23,739
0
int bond_release(struct net_device *bond_dev, struct net_device *slave_dev) { struct bonding *bond = netdev_priv(bond_dev); struct slave *slave, *oldcurrent; struct sockaddr addr; u32 old_features = bond_dev->features; /* slave is not a slave or master is not master of this slave */ if (!(slave_dev->flags & IFF_SLAVE) || (slave_dev->master != bond_dev)) { pr_err("%s: Error: cannot release %s.\n", bond_dev->name, slave_dev->name); return -EINVAL; } block_netpoll_tx(); netdev_bonding_change(bond_dev, NETDEV_RELEASE); write_lock_bh(&bond->lock); slave = bond_get_slave_by_dev(bond, slave_dev); if (!slave) { /* not a slave of this bond */ pr_info("%s: %s not enslaved\n", bond_dev->name, slave_dev->name); write_unlock_bh(&bond->lock); unblock_netpoll_tx(); return -EINVAL; } /* unregister rx_handler early so bond_handle_frame wouldn't be called * for this slave anymore. */ netdev_rx_handler_unregister(slave_dev); write_unlock_bh(&bond->lock); synchronize_net(); write_lock_bh(&bond->lock); if (!bond->params.fail_over_mac) { if (!compare_ether_addr(bond_dev->dev_addr, slave->perm_hwaddr) && bond->slave_cnt > 1) pr_warning("%s: Warning: the permanent HWaddr of %s - %pM - is still in use by %s. Set the HWaddr of %s to a different address to avoid conflicts.\n", bond_dev->name, slave_dev->name, slave->perm_hwaddr, bond_dev->name, slave_dev->name); } /* Inform AD package of unbinding of slave. */ if (bond->params.mode == BOND_MODE_8023AD) { /* must be called before the slave is * detached from the list */ bond_3ad_unbind_slave(slave); } pr_info("%s: releasing %s interface %s\n", bond_dev->name, bond_is_active_slave(slave) ? "active" : "backup", slave_dev->name); oldcurrent = bond->curr_active_slave; bond->current_arp_slave = NULL; /* release the slave from its bond */ bond_detach_slave(bond, slave); if (bond->primary_slave == slave) bond->primary_slave = NULL; if (oldcurrent == slave) bond_change_active_slave(bond, NULL); if (bond_is_lb(bond)) { /* Must be called only after the slave has been * detached from the list and the curr_active_slave * has been cleared (if our_slave == old_current), * but before a new active slave is selected. */ write_unlock_bh(&bond->lock); bond_alb_deinit_slave(bond, slave); write_lock_bh(&bond->lock); } if (oldcurrent == slave) { /* * Note that we hold RTNL over this sequence, so there * is no concern that another slave add/remove event * will interfere. */ write_unlock_bh(&bond->lock); read_lock(&bond->lock); write_lock_bh(&bond->curr_slave_lock); bond_select_active_slave(bond); write_unlock_bh(&bond->curr_slave_lock); read_unlock(&bond->lock); write_lock_bh(&bond->lock); } if (bond->slave_cnt == 0) { bond_set_carrier(bond); /* if the last slave was removed, zero the mac address * of the master so it will be set by the application * to the mac address of the first slave */ memset(bond_dev->dev_addr, 0, bond_dev->addr_len); if (bond_vlan_used(bond)) { pr_warning("%s: Warning: clearing HW address of %s while it still has VLANs.\n", bond_dev->name, bond_dev->name); pr_warning("%s: When re-adding slaves, make sure the bond's HW address matches its VLANs'.\n", bond_dev->name); } } write_unlock_bh(&bond->lock); unblock_netpoll_tx(); bond_compute_features(bond); if (!(bond_dev->features & NETIF_F_VLAN_CHALLENGED) && (old_features & NETIF_F_VLAN_CHALLENGED)) pr_info("%s: last VLAN challenged slave %s left bond %s. VLAN blocking is removed\n", bond_dev->name, slave_dev->name, bond_dev->name); /* must do this from outside any spinlocks */ bond_destroy_slave_symlinks(bond_dev, slave_dev); bond_del_vlans_from_slave(bond, slave_dev); /* If the mode USES_PRIMARY, then we should only remove its * promisc and mc settings if it was the curr_active_slave, but that was * already taken care of above when we detached the slave */ if (!USES_PRIMARY(bond->params.mode)) { /* unset promiscuity level from slave */ if (bond_dev->flags & IFF_PROMISC) dev_set_promiscuity(slave_dev, -1); /* unset allmulti level from slave */ if (bond_dev->flags & IFF_ALLMULTI) dev_set_allmulti(slave_dev, -1); /* flush master's mc_list from slave */ netif_addr_lock_bh(bond_dev); bond_mc_list_flush(bond_dev, slave_dev); netif_addr_unlock_bh(bond_dev); } netdev_set_bond_master(slave_dev, NULL); slave_disable_netpoll(slave); /* close slave before restoring its mac address */ dev_close(slave_dev); if (bond->params.fail_over_mac != BOND_FOM_ACTIVE) { /* restore original ("permanent") mac address */ memcpy(addr.sa_data, slave->perm_hwaddr, ETH_ALEN); addr.sa_family = slave_dev->type; dev_set_mac_address(slave_dev, &addr); } dev_set_mtu(slave_dev, slave->original_mtu); slave_dev->priv_flags &= ~IFF_BONDING; kfree(slave); return 0; /* deletion OK */ }
17,424
153,630
0
void GLES2Implementation::DisableVertexAttribArray(GLuint index) { GPU_CLIENT_SINGLE_THREAD_CHECK(); GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glDisableVertexAttribArray(" << index << ")"); vertex_array_object_manager_->SetAttribEnable(index, false); helper_->DisableVertexAttribArray(index); CheckGLError(); }
17,425
133,182
0
void HWNDMessageHandler::UpdateDwmNcRenderingPolicy() { if (base::win::GetVersion() < base::win::VERSION_VISTA) return; DWMNCRENDERINGPOLICY policy = DWMNCRP_ENABLED; if (remove_standard_frame_ || delegate_->IsUsingCustomFrame()) policy = DWMNCRP_DISABLED; DwmSetWindowAttribute(hwnd(), DWMWA_NCRENDERING_POLICY, &policy, sizeof(DWMNCRENDERINGPOLICY)); }
17,426
63,408
0
static void entropy_decode_stereo_3860(APEContext *ctx, int blockstodecode) { int32_t *decoded0 = ctx->decoded[0]; int32_t *decoded1 = ctx->decoded[1]; int blocks = blockstodecode; while (blockstodecode--) *decoded0++ = ape_decode_value_3860(ctx, &ctx->gb, &ctx->riceY); while (blocks--) *decoded1++ = ape_decode_value_3860(ctx, &ctx->gb, &ctx->riceX); }
17,427
124,437
0
void WebRuntimeFeatures::enableNotifications(bool enable) { RuntimeEnabledFeatures::setNotificationsEnabled(enable); }
17,428
112,506
0
KURL Document::openSearchDescriptionURL() { static const char* const openSearchMIMEType = "application/opensearchdescription+xml"; static const char* const openSearchRelation = "search"; if (!frame() || frame()->tree()->parent()) return KURL(); if (frame()->loader()->state() != FrameStateComplete) return KURL(); if (!head()) return KURL(); RefPtr<HTMLCollection> children = head()->children(); for (unsigned i = 0; Node* child = children->item(i); i++) { if (!child->hasTagName(linkTag)) continue; HTMLLinkElement* linkElement = static_cast<HTMLLinkElement*>(child); if (!equalIgnoringCase(linkElement->type(), openSearchMIMEType) || !equalIgnoringCase(linkElement->rel(), openSearchRelation)) continue; if (linkElement->href().isEmpty()) continue; return linkElement->href(); } return KURL(); }
17,429
81,864
0
static int wc_ecc_curve_load(const ecc_set_type* dp, ecc_curve_spec** pCurve, byte load_mask) { int ret = 0, x; ecc_curve_spec* curve; byte load_items = 0; /* mask of items to load */ if (dp == NULL || pCurve == NULL) return BAD_FUNC_ARG; #ifdef ECC_CACHE_CURVE x = wc_ecc_get_curve_idx(dp->id); if (x == ECC_CURVE_INVALID) return ECC_BAD_ARG_E; #if !defined(SINGLE_THREADED) ret = wc_LockMutex(&ecc_curve_cache_mutex); if (ret != 0) { return ret; } #endif /* make sure cache has been allocated */ if (ecc_curve_spec_cache[x] == NULL) { ecc_curve_spec_cache[x] = (ecc_curve_spec*)XMALLOC( sizeof(ecc_curve_spec), NULL, DYNAMIC_TYPE_ECC); if (ecc_curve_spec_cache[x] == NULL) { #if defined(ECC_CACHE_CURVE) && !defined(SINGLE_THREADED) wc_UnLockMutex(&ecc_curve_cache_mutex); #endif return MEMORY_E; } XMEMSET(ecc_curve_spec_cache[x], 0, sizeof(ecc_curve_spec)); } /* set curve pointer to cache */ *pCurve = ecc_curve_spec_cache[x]; #endif /* ECC_CACHE_CURVE */ curve = *pCurve; /* make sure the curve is initialized */ if (curve->dp != dp) { curve->load_mask = 0; #ifdef ECC_CACHE_CURVE curve->prime = &curve->prime_lcl; curve->Af = &curve->Af_lcl; #ifdef USE_ECC_B_PARAM curve->Bf = &curve->Bf_lcl; #endif curve->order = &curve->order_lcl; curve->Gx = &curve->Gx_lcl; curve->Gy = &curve->Gy_lcl; #endif } curve->dp = dp; /* set dp info */ /* determine items to load */ load_items = (~curve->load_mask & load_mask); curve->load_mask |= load_items; /* load items */ x = 0; if (load_items & ECC_CURVE_FIELD_PRIME) x += wc_ecc_curve_load_item(dp->prime, &curve->prime, curve, ECC_CURVE_FIELD_PRIME); if (load_items & ECC_CURVE_FIELD_AF) x += wc_ecc_curve_load_item(dp->Af, &curve->Af, curve, ECC_CURVE_FIELD_AF); #ifdef USE_ECC_B_PARAM if (load_items & ECC_CURVE_FIELD_BF) x += wc_ecc_curve_load_item(dp->Bf, &curve->Bf, curve, ECC_CURVE_FIELD_BF); #endif if (load_items & ECC_CURVE_FIELD_ORDER) x += wc_ecc_curve_load_item(dp->order, &curve->order, curve, ECC_CURVE_FIELD_ORDER); if (load_items & ECC_CURVE_FIELD_GX) x += wc_ecc_curve_load_item(dp->Gx, &curve->Gx, curve, ECC_CURVE_FIELD_GX); if (load_items & ECC_CURVE_FIELD_GY) x += wc_ecc_curve_load_item(dp->Gy, &curve->Gy, curve, ECC_CURVE_FIELD_GY); /* check for error */ if (x != 0) { wc_ecc_curve_free(curve); ret = MP_READ_E; } #if defined(ECC_CACHE_CURVE) && !defined(SINGLE_THREADED) wc_UnLockMutex(&ecc_curve_cache_mutex); #endif return ret; }
17,430
4,050
0
void CachedFileStream::setPos(Guint pos, int dir) { Guint size; if (dir >= 0) { cc->seek(pos, SEEK_SET); bufPos = pos; } else { cc->seek(0, SEEK_END); size = (Guint)cc->tell(); if (pos > size) pos = (Guint)size; cc->seek(-(int)pos, SEEK_END); bufPos = (Guint)cc->tell(); } bufPtr = bufEnd = buf; }
17,431
401
0
fz_new_indexed_colorspace(fz_context *ctx, fz_colorspace *base, int high, unsigned char *lookup) { fz_colorspace *cs = NULL; struct indexed *idx; idx = fz_malloc_struct(ctx, struct indexed); idx->lookup = lookup; idx->base = fz_keep_colorspace(ctx, base); idx->high = high; fz_try(ctx) cs = fz_new_colorspace(ctx, "Indexed", FZ_COLORSPACE_INDEXED, 0, 1, fz_colorspace_is_icc(ctx, fz_device_rgb(ctx)) ? indexed_to_alt : indexed_to_rgb, NULL, base_indexed, clamp_indexed, free_indexed, idx, sizeof(*idx) + (base->n * (idx->high + 1)) + base->size); fz_catch(ctx) { fz_free(ctx, idx); fz_rethrow(ctx); } return cs; }
17,432
134,807
0
bool TouchEventConverterEvdev::HasTouchscreen() const { return true; }
17,433
47,687
0
static struct dst_entry *icmpv6_route_lookup(struct net *net, struct sk_buff *skb, struct sock *sk, struct flowi6 *fl6) { struct dst_entry *dst, *dst2; struct flowi6 fl2; int err; err = ip6_dst_lookup(net, sk, &dst, fl6); if (err) return ERR_PTR(err); /* * We won't send icmp if the destination is known * anycast. */ if (ipv6_anycast_destination(dst, &fl6->daddr)) { net_dbg_ratelimited("icmp6_send: acast source\n"); dst_release(dst); return ERR_PTR(-EINVAL); } /* No need to clone since we're just using its address. */ dst2 = dst; dst = xfrm_lookup(net, dst, flowi6_to_flowi(fl6), sk, 0); if (!IS_ERR(dst)) { if (dst != dst2) return dst; } else { if (PTR_ERR(dst) == -EPERM) dst = NULL; else return dst; } err = xfrm_decode_session_reverse(skb, flowi6_to_flowi(&fl2), AF_INET6); if (err) goto relookup_failed; err = ip6_dst_lookup(net, sk, &dst2, &fl2); if (err) goto relookup_failed; dst2 = xfrm_lookup(net, dst2, flowi6_to_flowi(&fl2), sk, XFRM_LOOKUP_ICMP); if (!IS_ERR(dst2)) { dst_release(dst); dst = dst2; } else { err = PTR_ERR(dst2); if (err == -EPERM) { dst_release(dst); return dst2; } else goto relookup_failed; } relookup_failed: if (dst) return dst; return ERR_PTR(err); }
17,434
113,222
0
ui::Layer* GetLayer(views::Widget* widget) { return widget->GetNativeView()->layer(); }
17,435
100,374
0
virtual void Init() { #if defined(OS_WIN) CoInitialize(NULL); #endif render_process_ = new RenderProcess(); render_process_->set_main_thread(new RenderThread(channel_id_)); base::Thread::SetThreadWasQuitProperly(true); }
17,436
139,243
0
void AudioSystemImpl::HasInputDevices(OnBoolCallback on_has_devices_cb) const { if (GetTaskRunner()->BelongsToCurrentThread()) { GetTaskRunner()->PostTask( FROM_HERE, base::Bind(on_has_devices_cb, audio_manager_->HasAudioInputDevices())); return; } base::PostTaskAndReplyWithResult( GetTaskRunner(), FROM_HERE, base::Bind(&AudioManager::HasAudioInputDevices, base::Unretained(audio_manager_)), std::move(on_has_devices_cb)); }
17,437
61,558
0
static int is_pcm(enum AVCodecID codec_id) { /* we only care about "normal" PCM codecs until we get samples */ return codec_id >= AV_CODEC_ID_PCM_S16LE && codec_id < AV_CODEC_ID_PCM_S24DAUD; }
17,438
44,737
0
static int keyring_detect_cycle_iterator(const void *object, void *iterator_data) { struct keyring_search_context *ctx = iterator_data; const struct key *key = keyring_ptr_to_key(object); kenter("{%d}", key->serial); /* We might get a keyring with matching index-key that is nonetheless a * different keyring. */ if (key != ctx->match_data.raw_data) return 0; ctx->result = ERR_PTR(-EDEADLK); return 1; }
17,439
142,490
0
void ShelfLayoutManager::UpdateAutoHideForMouseEvent(ui::MouseEvent* event, aura::Window* target) { in_mouse_drag_ = (event->type() == ui::ET_MOUSE_DRAGGED || (in_mouse_drag_ && event->type() != ui::ET_MOUSE_RELEASED && event->type() != ui::ET_MOUSE_CAPTURE_CHANGED)) && !IsShelfWindow(target) && !IsStatusAreaWindow(target); if (visibility_state() != SHELF_AUTO_HIDE || in_shutdown_) return; if (event->type() == ui::ET_MOUSE_PRESSED || (event->type() == ui::ET_MOUSE_MOVED && GetVisibleShelfBounds().Contains( display::Screen::GetScreen()->GetCursorScreenPoint()))) { UpdateAutoHideState(); } }
17,440
143,229
0
void Document::notifyLayoutTreeOfSubtreeChanges() { if (!layoutView()->wasNotifiedOfSubtreeChange()) return; m_lifecycle.advanceTo(DocumentLifecycle::InLayoutSubtreeChange); layoutView()->handleSubtreeModifications(); DCHECK(!layoutView()->wasNotifiedOfSubtreeChange()); m_lifecycle.advanceTo(DocumentLifecycle::LayoutSubtreeChangeClean); }
17,441
107,733
0
void FrameLoader::ClientDroppedNavigation() { if (!provisional_document_loader_ || provisional_document_loader_->DidStart()) return; DetachProvisionalDocumentLoader(provisional_document_loader_); Settings* settings = frame_->GetSettings(); if (settings && settings->GetForceMainWorldInitialization()) { frame_->GetScriptController().WindowProxy(DOMWrapperWorld::MainWorld()); } }
17,442
175,383
0
int Downmix_Configure(downmix_module_t *pDwmModule, effect_config_t *pConfig, bool init) { downmix_object_t *pDownmixer = &pDwmModule->context; if (pConfig->inputCfg.samplingRate != pConfig->outputCfg.samplingRate || pConfig->outputCfg.channels != DOWNMIX_OUTPUT_CHANNELS || pConfig->inputCfg.format != AUDIO_FORMAT_PCM_16_BIT || pConfig->outputCfg.format != AUDIO_FORMAT_PCM_16_BIT) { ALOGE("Downmix_Configure error: invalid config"); return -EINVAL; } if (&pDwmModule->config != pConfig) { memcpy(&pDwmModule->config, pConfig, sizeof(effect_config_t)); } if (init) { pDownmixer->type = DOWNMIX_TYPE_FOLD; pDownmixer->apply_volume_correction = false; pDownmixer->input_channel_count = 8; // matches default input of AUDIO_CHANNEL_OUT_7POINT1 } else { if (!Downmix_validChannelMask(pConfig->inputCfg.channels)) { ALOGE("Downmix_Configure error: input channel mask(0x%x) not supported", pConfig->inputCfg.channels); return -EINVAL; } pDownmixer->input_channel_count = audio_channel_count_from_out_mask(pConfig->inputCfg.channels); } Downmix_Reset(pDownmixer, init); return 0; }
17,443
178,521
1
static NOINLINE char *xmalloc_optname_optval(uint8_t *option, const struct dhcp_optflag *optflag, const char *opt_name) { unsigned upper_length; int len, type, optlen; char *dest, *ret; /* option points to OPT_DATA, need to go back to get OPT_LEN */ len = option[-OPT_DATA + OPT_LEN]; type = optflag->flags & OPTION_TYPE_MASK; optlen = dhcp_option_lengths[type]; upper_length = len_of_option_as_string[type] * ((unsigned)(len + optlen - 1) / (unsigned)optlen); dest = ret = xmalloc(upper_length + strlen(opt_name) + 2); dest += sprintf(ret, "%s=", opt_name); while (len >= optlen) { switch (type) { case OPTION_IP: case OPTION_IP_PAIR: dest += sprint_nip(dest, "", option); if (type == OPTION_IP) break; dest += sprint_nip(dest, "/", option + 4); break; // case OPTION_BOOLEAN: // dest += sprintf(dest, *option ? "yes" : "no"); // break; case OPTION_U8: dest += sprintf(dest, "%u", *option); break; // case OPTION_S16: case OPTION_U16: { uint16_t val_u16; move_from_unaligned16(val_u16, option); dest += sprintf(dest, "%u", ntohs(val_u16)); break; } case OPTION_S32: case OPTION_U32: { uint32_t val_u32; move_from_unaligned32(val_u32, option); dest += sprintf(dest, type == OPTION_U32 ? "%lu" : "%ld", (unsigned long) ntohl(val_u32)); break; } /* Note: options which use 'return' instead of 'break' * (for example, OPTION_STRING) skip the code which handles * the case of list of options. */ case OPTION_STRING: case OPTION_STRING_HOST: memcpy(dest, option, len); dest[len] = '\0'; if (type == OPTION_STRING_HOST && !good_hostname(dest)) safe_strncpy(dest, "bad", len); return ret; case OPTION_STATIC_ROUTES: { /* Option binary format: * mask [one byte, 0..32] * ip [big endian, 0..4 bytes depending on mask] * router [big endian, 4 bytes] * may be repeated * * We convert it to a string "IP/MASK ROUTER IP2/MASK2 ROUTER2" */ const char *pfx = ""; while (len >= 1 + 4) { /* mask + 0-byte ip + router */ uint32_t nip; uint8_t *p; unsigned mask; int bytes; mask = *option++; if (mask > 32) break; len--; nip = 0; p = (void*) &nip; bytes = (mask + 7) / 8; /* 0 -> 0, 1..8 -> 1, 9..16 -> 2 etc */ while (--bytes >= 0) { *p++ = *option++; len--; } if (len < 4) break; /* print ip/mask */ dest += sprint_nip(dest, pfx, (void*) &nip); pfx = " "; dest += sprintf(dest, "/%u ", mask); /* print router */ dest += sprint_nip(dest, "", option); option += 4; len -= 4; } return ret; } case OPTION_6RD: /* Option binary format (see RFC 5969): * 0 1 2 3 * 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | OPTION_6RD | option-length | IPv4MaskLen | 6rdPrefixLen | * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * | 6rdPrefix | * ... (16 octets) ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * ... 6rdBRIPv4Address(es) ... * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ * We convert it to a string * "IPv4MaskLen 6rdPrefixLen 6rdPrefix 6rdBRIPv4Address..." * * Sanity check: ensure that our length is at least 22 bytes, that * IPv4MaskLen <= 32, * 6rdPrefixLen <= 128, * 6rdPrefixLen + (32 - IPv4MaskLen) <= 128 * (2nd condition need no check - it follows from 1st and 3rd). * Else, return envvar with empty value ("optname=") */ if (len >= (1 + 1 + 16 + 4) && option[0] <= 32 && (option[1] + 32 - option[0]) <= 128 ) { /* IPv4MaskLen */ dest += sprintf(dest, "%u ", *option++); /* 6rdPrefixLen */ dest += sprintf(dest, "%u ", *option++); /* 6rdPrefix */ dest += sprint_nip6(dest, /* "", */ option); option += 16; len -= 1 + 1 + 16 + 4; /* "+ 4" above corresponds to the length of IPv4 addr * we consume in the loop below */ while (1) { /* 6rdBRIPv4Address(es) */ dest += sprint_nip(dest, " ", option); option += 4; len -= 4; /* do we have yet another 4+ bytes? */ if (len < 0) break; /* no */ } } return ret; #if ENABLE_FEATURE_UDHCP_RFC3397 case OPTION_DNS_STRING: /* unpack option into dest; use ret for prefix (i.e., "optname=") */ dest = dname_dec(option, len, ret); if (dest) { free(ret); return dest; } /* error. return "optname=" string */ return ret; case OPTION_SIP_SERVERS: /* Option binary format: * type: byte * type=0: domain names, dns-compressed * type=1: IP addrs */ option++; len--; if (option[-1] == 0) { dest = dname_dec(option, len, ret); if (dest) { free(ret); return dest; } } else if (option[-1] == 1) { const char *pfx = ""; while (1) { len -= 4; if (len < 0) break; dest += sprint_nip(dest, pfx, option); pfx = " "; option += 4; } } return ret; #endif } /* switch */ /* If we are here, try to format any remaining data * in the option as another, similarly-formatted option */ option += optlen; len -= optlen; // TODO: it can be a list only if (optflag->flags & OPTION_LIST). // Should we bail out/warn if we see multi-ip option which is // not allowed to be such (for example, DHCP_BROADCAST)? - if (len < optlen /* || !(optflag->flags & OPTION_LIST) */) break; *dest++ = ' '; *dest = '\0'; } /* while */ return ret; }
17,444
147,671
0
static void OverloadedStaticMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { scheduler::CooperativeSchedulingManager::Instance()->Safepoint(); bool is_arity_error = false; switch (std::min(2, info.Length())) { case 1: if (true) { OverloadedStaticMethod1Method(info); return; } break; case 2: if (true) { OverloadedStaticMethod2Method(info); return; } break; default: is_arity_error = true; } ExceptionState exception_state(info.GetIsolate(), ExceptionState::kExecutionContext, "TestObject", "overloadedStaticMethod"); if (is_arity_error) { if (info.Length() < 1) { exception_state.ThrowTypeError(ExceptionMessages::NotEnoughArguments(1, info.Length())); return; } } exception_state.ThrowTypeError("No function was found that matched the signature provided."); }
17,445
145,863
0
ImmersiveFullscreenController* controller() { return controller_.get(); }
17,446
159,631
0
void RenderFrameHostManager::CreateProxiesForNewRenderFrameHost( SiteInstance* old_instance, SiteInstance* new_instance) { if (new_instance->IsRelatedSiteInstance(old_instance)) { CreateOpenerProxies(new_instance, frame_tree_node_); } else { frame_tree_node_->frame_tree()->CreateProxiesForSiteInstance( frame_tree_node_, new_instance); } }
17,447
146,931
0
size_t WebLocalFrameImpl::CharacterIndexForPoint( const WebPoint& point_in_viewport) const { if (!GetFrame()) return kNotFound; IntPoint point = GetFrame()->View()->ViewportToContents(point_in_viewport); HitTestResult result = GetFrame()->GetEventHandler().HitTestResultAtPoint( point, HitTestRequest::kReadOnly | HitTestRequest::kActive); const EphemeralRange range = GetFrame()->RangeForPoint(result.RoundedPointInInnerNodeFrame()); if (range.IsNull()) return kNotFound; Element* editable = GetFrame()->Selection().RootEditableElementOrDocumentElement(); DCHECK(editable); return PlainTextRange::Create(*editable, range).Start(); }
17,448
128,525
0
void Instance::Alert(const std::string& message) { GetWindowObject().Call("alert", message); }
17,449
178,472
1
PHP_FUNCTION(pg_get_notify) { zval *pgsql_link; int id = -1; long result_type = PGSQL_ASSOC; PGconn *pgsql; PGnotify *pgsql_notify; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r|l", &pgsql_link, &result_type) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); if (!(result_type & PGSQL_BOTH)) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Invalid result type"); RETURN_FALSE; } PQconsumeInput(pgsql); pgsql_notify = PQnotifies(pgsql); if (!pgsql_notify) { /* no notify message */ RETURN_FALSE; } array_init(return_value); if (result_type & PGSQL_NUM) { add_index_string(return_value, 0, pgsql_notify->relname, 1); add_index_long(return_value, 1, pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { #else if (atof(PG_VERSION) >= 9.0) { #endif #if HAVE_PQPARAMETERSTATUS add_index_string(return_value, 2, pgsql_notify->extra, 1); #endif } } if (result_type & PGSQL_ASSOC) { add_assoc_string(return_value, "message", pgsql_notify->relname, 1); add_assoc_long(return_value, "pid", pgsql_notify->be_pid); #if HAVE_PQPROTOCOLVERSION && HAVE_PQPARAMETERSTATUS if (PQprotocolVersion(pgsql) >= 3 && atof(PQparameterStatus(pgsql, "server_version")) >= 9.0) { #else if (atof(PG_VERSION) >= 9.0) { #endif #if HAVE_PQPARAMETERSTATUS add_assoc_string(return_value, "payload", pgsql_notify->extra, 1); #endif } } PQfreemem(pgsql_notify); } /* }}} */ /* {{{ proto int pg_get_pid([resource connection) Get backend(server) pid */ PHP_FUNCTION(pg_get_pid) { zval *pgsql_link; int id = -1; PGconn *pgsql; if (zend_parse_parameters_ex(ZEND_PARSE_PARAMS_QUIET, ZEND_NUM_ARGS() TSRMLS_CC, "r", &pgsql_link) == FAILURE) { RETURN_FALSE; } ZEND_FETCH_RESOURCE2(pgsql, PGconn *, &pgsql_link, id, "PostgreSQL link", le_link, le_plink); RETURN_LONG(PQbackendPID(pgsql)); } /* }}} */ /* {{{ php_pgsql_meta_data * TODO: Add meta_data cache for better performance */ PHP_PGSQL_API int php_pgsql_meta_data(PGconn *pg_link, const char *table_name, zval *meta TSRMLS_DC) { PGresult *pg_result; char *src, *tmp_name, *tmp_name2 = NULL; char *escaped; smart_str querystr = {0}; size_t new_len; int i, num_rows; zval *elem; if (!*table_name) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "The table name must be specified"); return FAILURE; } src = estrdup(table_name); tmp_name = php_strtok_r(src, ".", &tmp_name2); if (!tmp_name2 || !*tmp_name2) { /* Default schema */ tmp_name2 = tmp_name; "SELECT a.attname, a.attnum, t.typname, a.attlen, a.attnotnull, a.atthasdef, a.attndims, t.typtype = 'e' " "FROM pg_class as c, pg_attribute a, pg_type t, pg_namespace n " "WHERE a.attnum > 0 AND a.attrelid = c.oid AND c.relname = '"); escaped = (char *)safe_emalloc(strlen(tmp_name2), 2, 1); new_len = PQescapeStringConn(pg_link, escaped, tmp_name2, strlen(tmp_name2), NULL); if (new_len) { smart_str_appendl(&querystr, escaped, new_len); } efree(escaped); smart_str_appends(&querystr, "' AND c.relnamespace = n.oid AND n.nspname = '"); escaped = (char *)safe_emalloc(strlen(tmp_name), 2, 1); new_len = PQescapeStringConn(pg_link, escaped, tmp_name, strlen(tmp_name), NULL); if (new_len) { smart_str_appendl(&querystr, escaped, new_len); } efree(escaped); smart_str_appends(&querystr, "' AND a.atttypid = t.oid ORDER BY a.attnum;"); smart_str_0(&querystr); efree(src); pg_result = PQexec(pg_link, querystr.c); if (PQresultStatus(pg_result) != PGRES_TUPLES_OK || (num_rows = PQntuples(pg_result)) == 0) { php_error_docref(NULL TSRMLS_CC, E_WARNING, "Table '%s' doesn't exists", table_name); smart_str_free(&querystr); PQclear(pg_result); return FAILURE; } smart_str_free(&querystr); for (i = 0; i < num_rows; i++) { char *name; MAKE_STD_ZVAL(elem); array_init(elem); add_assoc_long(elem, "num", atoi(PQgetvalue(pg_result,i,1))); add_assoc_string(elem, "type", PQgetvalue(pg_result,i,2), 1); add_assoc_long(elem, "len", atoi(PQgetvalue(pg_result,i,3))); if (!strcmp(PQgetvalue(pg_result,i,4), "t")) { add_assoc_bool(elem, "not null", 1); } else { add_assoc_bool(elem, "not null", 0); } if (!strcmp(PQgetvalue(pg_result,i,5), "t")) { add_assoc_bool(elem, "has default", 1); } else { add_assoc_bool(elem, "has default", 0); } add_assoc_long(elem, "array dims", atoi(PQgetvalue(pg_result,i,6))); if (!strcmp(PQgetvalue(pg_result,i,7), "t")) { add_assoc_bool(elem, "is enum", 1); } else { add_assoc_bool(elem, "is enum", 0); } name = PQgetvalue(pg_result,i,0); add_assoc_zval(meta, name, elem); } PQclear(pg_result); return SUCCESS; } /* }}} */
17,450
55,442
0
static int proc_root_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *stat ) { generic_fillattr(d_inode(dentry), stat); stat->nlink = proc_root.nlink + nr_processes(); return 0; }
17,451
110,774
0
bool AutocompleteEditModel::CanPasteAndGo(const string16& text) const { if (!view_->GetCommandUpdater()->IsCommandEnabled(IDC_OPEN_CURRENT_URL)) return false; profile_->GetAutocompleteClassifier()->Classify(text, string16(), false, false, &paste_and_go_match_, &paste_and_go_alternate_nav_url_); return paste_and_go_match_.destination_url.is_valid(); }
17,452
36,520
0
int __exit snd_card_info_done(void) { snd_info_free_entry(snd_card_info_entry); #ifdef MODULE snd_info_free_entry(snd_card_module_info_entry); #endif return 0; }
17,453
26,233
0
static void perf_output_get_handle(struct perf_output_handle *handle) { struct ring_buffer *rb = handle->rb; preempt_disable(); local_inc(&rb->nest); handle->wakeup = local_read(&rb->wakeup); }
17,454
113,698
0
DesktopNativeWidgetHelperAura::DesktopNativeWidgetHelperAura( NativeWidgetAura* widget) : widget_(widget), root_window_event_filter_(NULL), is_embedded_window_(false) { }
17,455
148,814
0
void InterstitialPageImpl::InterstitialPageRVHDelegateView::ShowPopupMenu( RenderFrameHost* render_frame_host, const gfx::Rect& bounds, int item_height, double item_font_size, int selected_item, const std::vector<MenuItem>& items, bool right_aligned, bool allow_multiple_selection) { NOTREACHED() << "InterstitialPage does not support showing popup menus."; }
17,456
170,459
0
status_t Parcel::readAligned(T *pArg) const { COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE(sizeof(T)) == sizeof(T)); if ((mDataPos+sizeof(T)) <= mDataSize) { const void* data = mData+mDataPos; mDataPos += sizeof(T); *pArg = *reinterpret_cast<const T*>(data); return NO_ERROR; } else { return NOT_ENOUGH_DATA; } }
17,457
92,391
0
int get_kernel_consoles(char ***ret) { _cleanup_strv_free_ char **l = NULL; _cleanup_free_ char *line = NULL; const char *p; int r; assert(ret); /* If /sys is mounted read-only this means we are running in some kind of container environment. In that * case /sys would reflect the host system, not us, hence ignore the data we can read from it. */ if (path_is_read_only_fs("/sys") > 0) goto fallback; r = read_one_line_file("/sys/class/tty/console/active", &line); if (r < 0) return r; p = line; for (;;) { _cleanup_free_ char *tty = NULL; char *path; r = extract_first_word(&p, &tty, NULL, 0); if (r < 0) return r; if (r == 0) break; if (streq(tty, "tty0")) { tty = mfree(tty); r = read_one_line_file("/sys/class/tty/tty0/active", &tty); if (r < 0) return r; } path = strappend("/dev/", tty); if (!path) return -ENOMEM; if (access(path, F_OK) < 0) { log_debug_errno(errno, "Console device %s is not accessible, skipping: %m", path); free(path); continue; } r = strv_consume(&l, path); if (r < 0) return r; } if (strv_isempty(l)) { log_debug("No devices found for system console"); goto fallback; } *ret = TAKE_PTR(l); return 0; fallback: r = strv_extend(&l, "/dev/console"); if (r < 0) return r; *ret = TAKE_PTR(l); return 0; }
17,458
89,882
0
upnp_event_create_notify(struct subscriber * sub) { struct upnp_event_notify * obj; /*struct timeval sock_timeout;*/ obj = calloc(1, sizeof(struct upnp_event_notify)); if(!obj) { syslog(LOG_ERR, "%s: calloc(): %m", "upnp_event_create_notify"); return; } obj->sub = sub; obj->state = ECreated; #ifdef ENABLE_IPV6 obj->s = socket((obj->sub->callback[7] == '[') ? PF_INET6 : PF_INET, SOCK_STREAM, 0); #else obj->s = socket(PF_INET, SOCK_STREAM, 0); #endif if(obj->s<0) { syslog(LOG_ERR, "%s: socket(): %m", "upnp_event_create_notify"); goto error; } #if 0 /* does not work for non blocking connect() */ /* set timeout to 3 seconds */ sock_timeout.tv_sec = 3; sock_timeout.tv_usec = 0; if(setsockopt(obj->s, SOL_SOCKET, SO_RCVTIMEO, &sock_timeout, sizeof(struct timeval)) < 0) { syslog(LOG_WARNING, "%s: setsockopt(SO_RCVTIMEO): %m", "upnp_event_create_notify"); } sock_timeout.tv_sec = 3; sock_timeout.tv_usec = 0; if(setsockopt(obj->s, SOL_SOCKET, SO_SNDTIMEO, &sock_timeout, sizeof(struct timeval)) < 0) { syslog(LOG_WARNING, "%s: setsockopt(SO_SNDTIMEO): %m", "upnp_event_create_notify"); } #endif /* set socket non blocking */ if(!set_non_blocking(obj->s)) { syslog(LOG_ERR, "%s: set_non_blocking(): %m", "upnp_event_create_notify"); goto error; } if(sub) sub->notify = obj; LIST_INSERT_HEAD(&notifylist, obj, entries); return; error: if(obj->s >= 0) close(obj->s); free(obj); }
17,459
104,915
0
PPB_Widget_Impl::PPB_Widget_Impl(PluginInstance* instance) : Resource(instance) { }
17,460
12,799
0
SSL_SESSION *SSL_get_session(const SSL *ssl) /* aka SSL_get0_session; gets 0 objects, just returns a copy of the pointer */ { return (ssl->session); }
17,461
170,031
0
xsltFreeStackElemList(xsltStackElemPtr elem) { xsltStackElemPtr next; while (elem != NULL) { next = elem->next; xsltFreeStackElem(elem); elem = next; } }
17,462
91,945
0
void __blk_end_request_all(struct request *rq, blk_status_t error) { bool pending; unsigned int bidi_bytes = 0; lockdep_assert_held(rq->q->queue_lock); WARN_ON_ONCE(rq->q->mq_ops); if (unlikely(blk_bidi_rq(rq))) bidi_bytes = blk_rq_bytes(rq->next_rq); pending = __blk_end_bidi_request(rq, error, blk_rq_bytes(rq), bidi_bytes); BUG_ON(pending); }
17,463
119,634
0
static LayoutUnit logicalHeightForLine(const RenderBlock* block, bool isFirstLine, LayoutUnit replacedHeight = 0) { if (!block->document().inNoQuirksMode() && replacedHeight) return replacedHeight; if (!(block->style(isFirstLine)->lineBoxContain() & LineBoxContainBlock)) return 0; return max<LayoutUnit>(replacedHeight, block->lineHeight(isFirstLine, block->isHorizontalWritingMode() ? HorizontalLine : VerticalLine, PositionOfInteriorLineBoxes)); }
17,464
75,633
0
static int read_wrapper_data (WavpackContext *wpc, WavpackMetadata *wpmd) { if ((wpc->open_flags & OPEN_WRAPPER) && wpc->wrapper_bytes < MAX_WRAPPER_BYTES && wpmd->byte_length) { wpc->wrapper_data = (unsigned char *)realloc (wpc->wrapper_data, wpc->wrapper_bytes + wpmd->byte_length); if (!wpc->wrapper_data) return FALSE; memcpy (wpc->wrapper_data + wpc->wrapper_bytes, wpmd->data, wpmd->byte_length); wpc->wrapper_bytes += wpmd->byte_length; } return TRUE; }
17,465
137,825
0
MediaControlTimeRemainingDisplayElement(MediaControls& mediaControls) : MediaControlTimeDisplayElement(mediaControls, MediaTimeRemainingDisplay) { }
17,466
139,146
0
void RenderProcessHostImpl::FilterURL(bool empty_allowed, GURL* url) { FilterURL(this, empty_allowed, url); }
17,467
166,430
0
void RecordDownloadContentTypeSecurity( const GURL& download_url, const std::vector<GURL>& url_chain, const std::string& mime_type, const base::RepeatingCallback<bool(const GURL&)>& is_origin_secure_callback) { bool is_final_download_secure = is_origin_secure_callback.Run(download_url); bool is_redirect_chain_secure = true; for (const auto& url : url_chain) { if (!is_origin_secure_callback.Run(url)) { is_redirect_chain_secure = false; break; } } DownloadContent download_content = download::DownloadContentFromMimeType(mime_type, false); if (is_final_download_secure && is_redirect_chain_secure) { UMA_HISTOGRAM_ENUMERATION("Download.Start.ContentType.SecureChain", download_content, DownloadContent::MAX); } else { UMA_HISTOGRAM_ENUMERATION("Download.Start.ContentType.InsecureChain", download_content, DownloadContent::MAX); } }
17,468
67,331
0
static void __init dcache_init_early(void) { unsigned int loop; /* If hashes are distributed across NUMA nodes, defer * hash allocation until vmalloc space is available. */ if (hashdist) return; dentry_hashtable = alloc_large_system_hash("Dentry cache", sizeof(struct hlist_bl_head), dhash_entries, 13, HASH_EARLY, &d_hash_shift, &d_hash_mask, 0, 0); for (loop = 0; loop < (1U << d_hash_shift); loop++) INIT_HLIST_BL_HEAD(dentry_hashtable + loop); }
17,469
31,695
0
COMPAT_SYSCALL_DEFINE2(sigaltstack, const compat_stack_t __user *, uss_ptr, compat_stack_t __user *, uoss_ptr) { stack_t uss, uoss; int ret; mm_segment_t seg; if (uss_ptr) { compat_stack_t uss32; memset(&uss, 0, sizeof(stack_t)); if (copy_from_user(&uss32, uss_ptr, sizeof(compat_stack_t))) return -EFAULT; uss.ss_sp = compat_ptr(uss32.ss_sp); uss.ss_flags = uss32.ss_flags; uss.ss_size = uss32.ss_size; } seg = get_fs(); set_fs(KERNEL_DS); ret = do_sigaltstack((stack_t __force __user *) (uss_ptr ? &uss : NULL), (stack_t __force __user *) &uoss, compat_user_stack_pointer()); set_fs(seg); if (ret >= 0 && uoss_ptr) { if (!access_ok(VERIFY_WRITE, uoss_ptr, sizeof(compat_stack_t)) || __put_user(ptr_to_compat(uoss.ss_sp), &uoss_ptr->ss_sp) || __put_user(uoss.ss_flags, &uoss_ptr->ss_flags) || __put_user(uoss.ss_size, &uoss_ptr->ss_size)) ret = -EFAULT; } return ret; }
17,470
159,338
0
void WebGLRenderingContextBase::getHTMLOrOffscreenCanvas( HTMLCanvasElementOrOffscreenCanvas& result) const { if (canvas()) { result.SetHTMLCanvasElement(static_cast<HTMLCanvasElement*>(Host())); } else { result.SetOffscreenCanvas(static_cast<OffscreenCanvas*>(Host())); } }
17,471
66,912
0
char *enl_wait_for_reply(void) { XEvent ev; static char msg_buffer[20]; register unsigned char i; alarm(2); for (; !XCheckTypedWindowEvent(disp, my_ipc_win, ClientMessage, &ev) && !timeout;); alarm(0); if (ev.xany.type != ClientMessage) { return(IPC_TIMEOUT); } for (i = 0; i < 20; i++) { msg_buffer[i] = ev.xclient.data.b[i]; } return(msg_buffer + 8); }
17,472
69,509
0
static int rxrpc_krb5_decode_principal(struct krb5_principal *princ, const __be32 **_xdr, unsigned int *_toklen) { const __be32 *xdr = *_xdr; unsigned int toklen = *_toklen, n_parts, loop, tmp; /* there must be at least one name, and at least #names+1 length * words */ if (toklen <= 12) return -EINVAL; _enter(",{%x,%x,%x},%u", ntohl(xdr[0]), ntohl(xdr[1]), ntohl(xdr[2]), toklen); n_parts = ntohl(*xdr++); toklen -= 4; if (n_parts <= 0 || n_parts > AFSTOKEN_K5_COMPONENTS_MAX) return -EINVAL; princ->n_name_parts = n_parts; if (toklen <= (n_parts + 1) * 4) return -EINVAL; princ->name_parts = kcalloc(n_parts, sizeof(char *), GFP_KERNEL); if (!princ->name_parts) return -ENOMEM; for (loop = 0; loop < n_parts; loop++) { if (toklen < 4) return -EINVAL; tmp = ntohl(*xdr++); toklen -= 4; if (tmp <= 0 || tmp > AFSTOKEN_STRING_MAX) return -EINVAL; if (tmp > toklen) return -EINVAL; princ->name_parts[loop] = kmalloc(tmp + 1, GFP_KERNEL); if (!princ->name_parts[loop]) return -ENOMEM; memcpy(princ->name_parts[loop], xdr, tmp); princ->name_parts[loop][tmp] = 0; tmp = (tmp + 3) & ~3; toklen -= tmp; xdr += tmp >> 2; } if (toklen < 4) return -EINVAL; tmp = ntohl(*xdr++); toklen -= 4; if (tmp <= 0 || tmp > AFSTOKEN_K5_REALM_MAX) return -EINVAL; if (tmp > toklen) return -EINVAL; princ->realm = kmalloc(tmp + 1, GFP_KERNEL); if (!princ->realm) return -ENOMEM; memcpy(princ->realm, xdr, tmp); princ->realm[tmp] = 0; tmp = (tmp + 3) & ~3; toklen -= tmp; xdr += tmp >> 2; _debug("%s/...@%s", princ->name_parts[0], princ->realm); *_xdr = xdr; *_toklen = toklen; _leave(" = 0 [toklen=%u]", toklen); return 0; }
17,473
153,235
0
::Region DesktopWindowTreeHostX11::GetWindowShape() const { return window_shape_.get(); }
17,474
126,929
0
TabContextMenuContents(BaseTab* tab, BrowserTabStripController* controller) : tab_(tab), controller_(controller), last_command_(TabStripModel::CommandFirst) { model_.reset(new TabMenuModel( this, controller->model_, controller->tabstrip_->GetModelIndexOfBaseTab(tab))); menu_model_adapter_.reset(new views::MenuModelAdapter(model_.get())); menu_runner_.reset( new views::MenuRunner(menu_model_adapter_->CreateMenu())); }
17,475
86,780
0
TIFFFdOpen(int fd, const char* name, const char* mode) { TIFF* tif; tif = TIFFClientOpen(name, mode, ddd (thandle_t) fd, _tiffReadProc, _tiffWriteProc, _tiffSeekProc, _tiffCloseProc, _tiffSizeProc, _tiffMapProc, _tiffUnmapProc); if (tif) tif->tif_fd = fd; return (tif); }
17,476
183,133
1
static Image *ReadWPGImage(const ImageInfo *image_info, ExceptionInfo *exception) { typedef struct { size_t FileId; MagickOffsetType DataOffset; unsigned int ProductType; unsigned int FileType; unsigned char MajorVersion; unsigned char MinorVersion; unsigned int EncryptKey; unsigned int Reserved; } WPGHeader; typedef struct { unsigned char RecType; size_t RecordLength; } WPGRecord; typedef struct { unsigned char Class; unsigned char RecType; size_t Extension; size_t RecordLength; } WPG2Record; typedef struct { unsigned HorizontalUnits; unsigned VerticalUnits; unsigned char PosSizePrecision; } WPG2Start; typedef struct { unsigned int Width; unsigned int Height; unsigned int Depth; unsigned int HorzRes; unsigned int VertRes; } WPGBitmapType1; typedef struct { unsigned int Width; unsigned int Height; unsigned char Depth; unsigned char Compression; } WPG2BitmapType1; typedef struct { unsigned int RotAngle; unsigned int LowLeftX; unsigned int LowLeftY; unsigned int UpRightX; unsigned int UpRightY; unsigned int Width; unsigned int Height; unsigned int Depth; unsigned int HorzRes; unsigned int VertRes; } WPGBitmapType2; typedef struct { unsigned int StartIndex; unsigned int NumOfEntries; } WPGColorMapRec; /* typedef struct { size_t PS_unknown1; unsigned int PS_unknown2; unsigned int PS_unknown3; } WPGPSl1Record; */ Image *image; unsigned int status; WPGHeader Header; WPGRecord Rec; WPG2Record Rec2; WPG2Start StartWPG; WPGBitmapType1 BitmapHeader1; WPG2BitmapType1 Bitmap2Header1; WPGBitmapType2 BitmapHeader2; WPGColorMapRec WPG_Palette; int i, bpp, WPG2Flags; ssize_t ldblk; size_t one; unsigned char *BImgBuff; tCTM CTM; /*current transform matrix*/ /* Open image file. */ assert(image_info != (const ImageInfo *) NULL); assert(image_info->signature == MagickCoreSignature); assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); one=1; image=AcquireImage(image_info,exception); image->depth=8; status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception); if (status == MagickFalse) { image=DestroyImageList(image); return((Image *) NULL); } /* Read WPG image. */ Header.FileId=ReadBlobLSBLong(image); Header.DataOffset=(MagickOffsetType) ReadBlobLSBLong(image); Header.ProductType=ReadBlobLSBShort(image); Header.FileType=ReadBlobLSBShort(image); Header.MajorVersion=ReadBlobByte(image); Header.MinorVersion=ReadBlobByte(image); Header.EncryptKey=ReadBlobLSBShort(image); Header.Reserved=ReadBlobLSBShort(image); if (Header.FileId!=0x435057FF || (Header.ProductType>>8)!=0x16) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); if (Header.EncryptKey!=0) ThrowReaderException(CoderError,"EncryptedWPGImageFileNotSupported"); image->columns = 1; image->rows = 1; image->colors = 0; bpp=0; BitmapHeader2.RotAngle=0; switch(Header.FileType) { case 1: /* WPG level 1 */ while(!EOFBlob(image)) /* object parser loop */ { (void) SeekBlob(image,Header.DataOffset,SEEK_SET); if(EOFBlob(image)) break; Rec.RecType=(i=ReadBlobByte(image)); if(i==EOF) break; Rd_WP_DWORD(image,&Rec.RecordLength); if(EOFBlob(image)) break; Header.DataOffset=TellBlob(image)+Rec.RecordLength; switch(Rec.RecType) { case 0x0B: /* bitmap type 1 */ BitmapHeader1.Width=ReadBlobLSBShort(image); BitmapHeader1.Height=ReadBlobLSBShort(image); if ((BitmapHeader1.Width == 0) || (BitmapHeader1.Height == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); BitmapHeader1.Depth=ReadBlobLSBShort(image); BitmapHeader1.HorzRes=ReadBlobLSBShort(image); BitmapHeader1.VertRes=ReadBlobLSBShort(image); if(BitmapHeader1.HorzRes && BitmapHeader1.VertRes) { image->units=PixelsPerCentimeterResolution; image->resolution.x=BitmapHeader1.HorzRes/470.0; image->resolution.y=BitmapHeader1.VertRes/470.0; } image->columns=BitmapHeader1.Width; image->rows=BitmapHeader1.Height; bpp=BitmapHeader1.Depth; goto UnpackRaster; case 0x0E: /*Color palette */ WPG_Palette.StartIndex=ReadBlobLSBShort(image); WPG_Palette.NumOfEntries=ReadBlobLSBShort(image); image->colors=WPG_Palette.NumOfEntries; if (!AcquireImageColormap(image,image->colors,exception)) goto NoMemory; for (i=WPG_Palette.StartIndex; i < (int)WPG_Palette.NumOfEntries; i++) { image->colormap[i].red=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); image->colormap[i].green=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); image->colormap[i].blue=ScaleCharToQuantum((unsigned char) ReadBlobByte(image)); } break; case 0x11: /* Start PS l1 */ if(Rec.RecordLength > 8) image=ExtractPostscript(image,image_info, TellBlob(image)+8, /* skip PS header in the wpg */ (ssize_t) Rec.RecordLength-8,exception); break; case 0x14: /* bitmap type 2 */ BitmapHeader2.RotAngle=ReadBlobLSBShort(image); BitmapHeader2.LowLeftX=ReadBlobLSBShort(image); BitmapHeader2.LowLeftY=ReadBlobLSBShort(image); BitmapHeader2.UpRightX=ReadBlobLSBShort(image); BitmapHeader2.UpRightY=ReadBlobLSBShort(image); BitmapHeader2.Width=ReadBlobLSBShort(image); BitmapHeader2.Height=ReadBlobLSBShort(image); if ((BitmapHeader2.Width == 0) || (BitmapHeader2.Height == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); BitmapHeader2.Depth=ReadBlobLSBShort(image); BitmapHeader2.HorzRes=ReadBlobLSBShort(image); BitmapHeader2.VertRes=ReadBlobLSBShort(image); image->units=PixelsPerCentimeterResolution; image->page.width=(unsigned int) ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightX)/470.0); image->page.height=(unsigned int) ((BitmapHeader2.LowLeftX-BitmapHeader2.UpRightY)/470.0); image->page.x=(int) (BitmapHeader2.LowLeftX/470.0); image->page.y=(int) (BitmapHeader2.LowLeftX/470.0); if(BitmapHeader2.HorzRes && BitmapHeader2.VertRes) { image->resolution.x=BitmapHeader2.HorzRes/470.0; image->resolution.y=BitmapHeader2.VertRes/470.0; } image->columns=BitmapHeader2.Width; image->rows=BitmapHeader2.Height; bpp=BitmapHeader2.Depth; UnpackRaster: status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) break; if ((image->colors == 0) && (bpp != 24)) { image->colors=one << bpp; if (!AcquireImageColormap(image,image->colors,exception)) { NoMemory: ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); } /* printf("Load default colormap \n"); */ for (i=0; (i < (int) image->colors) && (i < 256); i++) { image->colormap[i].red=ScaleCharToQuantum(WPG1_Palette[i].Red); image->colormap[i].green=ScaleCharToQuantum(WPG1_Palette[i].Green); image->colormap[i].blue=ScaleCharToQuantum(WPG1_Palette[i].Blue); } } else { if (bpp < 24) if ( (image->colors < (one << bpp)) && (bpp != 24) ) image->colormap=(PixelInfo *) ResizeQuantumMemory( image->colormap,(size_t) (one << bpp), sizeof(*image->colormap)); } if (bpp == 1) { if(image->colormap[0].red==0 && image->colormap[0].green==0 && image->colormap[0].blue==0 && image->colormap[1].red==0 && image->colormap[1].green==0 && image->colormap[1].blue==0) { /* fix crippled monochrome palette */ image->colormap[1].red = image->colormap[1].green = image->colormap[1].blue = QuantumRange; } } if(UnpackWPGRaster(image,bpp,exception) < 0) /* The raster cannot be unpacked */ { DecompressionFailed: ThrowReaderException(CoderError,"UnableToDecompressImage"); } if(Rec.RecType==0x14 && BitmapHeader2.RotAngle!=0 && !image_info->ping) { /* flop command */ if(BitmapHeader2.RotAngle & 0x8000) { Image *flop_image; flop_image = FlopImage(image, exception); if (flop_image != (Image *) NULL) { DuplicateBlob(flop_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,flop_image); } } /* flip command */ if(BitmapHeader2.RotAngle & 0x2000) { Image *flip_image; flip_image = FlipImage(image, exception); if (flip_image != (Image *) NULL) { DuplicateBlob(flip_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,flip_image); } } /* rotate command */ if(BitmapHeader2.RotAngle & 0x0FFF) { Image *rotate_image; rotate_image=RotateImage(image,(BitmapHeader2.RotAngle & 0x0FFF), exception); if (rotate_image != (Image *) NULL) { DuplicateBlob(rotate_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,rotate_image); } } } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); image->depth=8; if (image->next == (Image *) NULL) goto Finish; image=SyncNextImageInList(image); image->columns=image->rows=1; image->colors=0; break; case 0x1B: /* Postscript l2 */ if(Rec.RecordLength>0x3C) image=ExtractPostscript(image,image_info, TellBlob(image)+0x3C, /* skip PS l2 header in the wpg */ (ssize_t) Rec.RecordLength-0x3C,exception); break; } } break; case 2: /* WPG level 2 */ (void) memset(CTM,0,sizeof(CTM)); StartWPG.PosSizePrecision = 0; while(!EOFBlob(image)) /* object parser loop */ { (void) SeekBlob(image,Header.DataOffset,SEEK_SET); if(EOFBlob(image)) break; Rec2.Class=(i=ReadBlobByte(image)); if(i==EOF) break; Rec2.RecType=(i=ReadBlobByte(image)); if(i==EOF) break; Rd_WP_DWORD(image,&Rec2.Extension); Rd_WP_DWORD(image,&Rec2.RecordLength); if(EOFBlob(image)) break; Header.DataOffset=TellBlob(image)+Rec2.RecordLength; switch(Rec2.RecType) { case 1: StartWPG.HorizontalUnits=ReadBlobLSBShort(image); StartWPG.VerticalUnits=ReadBlobLSBShort(image); StartWPG.PosSizePrecision=ReadBlobByte(image); break; case 0x0C: /* Color palette */ WPG_Palette.StartIndex=ReadBlobLSBShort(image); WPG_Palette.NumOfEntries=ReadBlobLSBShort(image); image->colors=WPG_Palette.NumOfEntries; if (AcquireImageColormap(image,image->colors,exception) == MagickFalse) ThrowReaderException(ResourceLimitError, "MemoryAllocationFailed"); for (i=WPG_Palette.StartIndex; i < (int)WPG_Palette.NumOfEntries; i++) { image->colormap[i].red=ScaleCharToQuantum((char) ReadBlobByte(image)); image->colormap[i].green=ScaleCharToQuantum((char) ReadBlobByte(image)); image->colormap[i].blue=ScaleCharToQuantum((char) ReadBlobByte(image)); (void) ReadBlobByte(image); /*Opacity??*/ } break; case 0x0E: Bitmap2Header1.Width=ReadBlobLSBShort(image); Bitmap2Header1.Height=ReadBlobLSBShort(image); if ((Bitmap2Header1.Width == 0) || (Bitmap2Header1.Height == 0)) ThrowReaderException(CorruptImageError,"ImproperImageHeader"); Bitmap2Header1.Depth=ReadBlobByte(image); Bitmap2Header1.Compression=ReadBlobByte(image); if(Bitmap2Header1.Compression > 1) continue; /*Unknown compression method */ switch(Bitmap2Header1.Depth) { case 1: bpp=1; break; case 2: bpp=2; break; case 3: bpp=4; break; case 4: bpp=8; break; case 8: bpp=24; break; default: continue; /*Ignore raster with unknown depth*/ } image->columns=Bitmap2Header1.Width; image->rows=Bitmap2Header1.Height; status=SetImageExtent(image,image->columns,image->rows,exception); if (status == MagickFalse) break; if ((image->colors == 0) && (bpp != 24)) { size_t one; one=1; image->colors=one << bpp; if (!AcquireImageColormap(image,image->colors,exception)) goto NoMemory; } else { if(bpp < 24) if( image->colors<(one << bpp) && bpp!=24 ) image->colormap=(PixelInfo *) ResizeQuantumMemory( image->colormap,(size_t) (one << bpp), sizeof(*image->colormap)); } switch(Bitmap2Header1.Compression) { case 0: /*Uncompressed raster*/ { ldblk=(ssize_t) ((bpp*image->columns+7)/8); BImgBuff=(unsigned char *) AcquireQuantumMemory((size_t) ldblk+1,sizeof(*BImgBuff)); if (BImgBuff == (unsigned char *) NULL) goto NoMemory; for(i=0; i< (ssize_t) image->rows; i++) { (void) ReadBlob(image,ldblk,BImgBuff); InsertRow(image,BImgBuff,i,bpp,exception); } if(BImgBuff) BImgBuff=(unsigned char *) RelinquishMagickMemory(BImgBuff); break; } case 1: /*RLE for WPG2 */ { if( UnpackWPG2Raster(image,bpp,exception) < 0) goto DecompressionFailed; break; } } if(CTM[0][0]<0 && !image_info->ping) { /*?? RotAngle=360-RotAngle;*/ Image *flop_image; flop_image = FlopImage(image, exception); if (flop_image != (Image *) NULL) { DuplicateBlob(flop_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,flop_image); } /* Try to change CTM according to Flip - I am not sure, must be checked. Tx(0,0)=-1; Tx(1,0)=0; Tx(2,0)=0; Tx(0,1)= 0; Tx(1,1)=1; Tx(2,1)=0; Tx(0,2)=(WPG._2Rect.X_ur+WPG._2Rect.X_ll); Tx(1,2)=0; Tx(2,2)=1; */ } if(CTM[1][1]<0 && !image_info->ping) { /*?? RotAngle=360-RotAngle;*/ Image *flip_image; flip_image = FlipImage(image, exception); if (flip_image != (Image *) NULL) { DuplicateBlob(flip_image,image); (void) RemoveLastImageFromList(&image); AppendImageToList(&image,flip_image); } /* Try to change CTM according to Flip - I am not sure, must be checked. float_matrix Tx(3,3); Tx(0,0)= 1; Tx(1,0)= 0; Tx(2,0)=0; Tx(0,1)= 0; Tx(1,1)=-1; Tx(2,1)=0; Tx(0,2)= 0; Tx(1,2)=(WPG._2Rect.Y_ur+WPG._2Rect.Y_ll); Tx(2,2)=1; */ } /* Allocate next image structure. */ AcquireNextImage(image_info,image,exception); image->depth=8; if (image->next == (Image *) NULL) goto Finish; image=SyncNextImageInList(image); image->columns=image->rows=1; image->colors=0; break; case 0x12: /* Postscript WPG2*/ i=ReadBlobLSBShort(image); if(Rec2.RecordLength > (unsigned int) i) image=ExtractPostscript(image,image_info, TellBlob(image)+i, /*skip PS header in the wpg2*/ (ssize_t) (Rec2.RecordLength-i-2),exception); break; case 0x1B: /*bitmap rectangle*/ WPG2Flags = LoadWPG2Flags(image,StartWPG.PosSizePrecision,NULL,&CTM); (void) WPG2Flags; break; } } break; default: { ThrowReaderException(CoderError,"DataEncodingSchemeIsNotSupported"); } } Finish: (void) CloseBlob(image); { Image *p; ssize_t scene=0; /* Rewind list, removing any empty images while rewinding. */ p=image; image=NULL; while (p != (Image *) NULL) { Image *tmp=p; if ((p->rows == 0) || (p->columns == 0)) { p=p->previous; DeleteImageFromList(&tmp); } else { image=p; p=p->previous; } } /* Fix scene numbers. */ for (p=image; p != (Image *) NULL; p=p->next) p->scene=(size_t) scene++; } if (image == (Image *) NULL) ThrowReaderException(CorruptImageError, "ImageFileDoesNotContainAnyImageData"); return(image); }
17,477
56,903
0
static enum iwch_ep_state state_read(struct iwch_ep_common *epc) { unsigned long flags; enum iwch_ep_state state; spin_lock_irqsave(&epc->lock, flags); state = epc->state; spin_unlock_irqrestore(&epc->lock, flags); return state; }
17,478
34,383
0
static void init_once(void *foo) { struct btrfs_inode *ei = (struct btrfs_inode *) foo; inode_init_once(&ei->vfs_inode); }
17,479
24,131
0
static void DoHTCSendPktsTest(struct ar6_softc *ar, int MapNo, HTC_ENDPOINT_ID eid, struct sk_buff *dupskb) { struct ar_cookie *cookie; struct ar_cookie *cookieArray[HTC_TEST_DUPLICATE]; struct sk_buff *new_skb; int i; int pkts = 0; struct htc_packet_queue pktQueue; EPPING_HEADER *eppingHdr; eppingHdr = A_NETBUF_DATA(dupskb); if (eppingHdr->Cmd_h == EPPING_CMD_NO_ECHO) { /* skip test if this is already a tx perf test */ return; } for (i = 0; i < HTC_TEST_DUPLICATE; i++,pkts++) { AR6000_SPIN_LOCK(&ar->arLock, 0); cookie = ar6000_alloc_cookie(ar); if (cookie != NULL) { ar->arTxPending[eid]++; ar->arTotalTxDataPending++; } AR6000_SPIN_UNLOCK(&ar->arLock, 0); if (NULL == cookie) { break; } new_skb = A_NETBUF_ALLOC(A_NETBUF_LEN(dupskb)); if (new_skb == NULL) { AR6000_SPIN_LOCK(&ar->arLock, 0); ar6000_free_cookie(ar,cookie); AR6000_SPIN_UNLOCK(&ar->arLock, 0); break; } A_NETBUF_PUT_DATA(new_skb, A_NETBUF_DATA(dupskb), A_NETBUF_LEN(dupskb)); cookie->arc_bp[0] = (unsigned long)new_skb; cookie->arc_bp[1] = MapNo; SET_HTC_PACKET_INFO_TX(&cookie->HtcPkt, cookie, A_NETBUF_DATA(new_skb), A_NETBUF_LEN(new_skb), eid, AR6K_DATA_PKT_TAG); cookieArray[i] = cookie; { EPPING_HEADER *pHdr = (EPPING_HEADER *)A_NETBUF_DATA(new_skb); pHdr->Cmd_h = EPPING_CMD_NO_ECHO; /* do not echo the packet */ } } if (pkts == 0) { return; } INIT_HTC_PACKET_QUEUE(&pktQueue); for (i = 0; i < pkts; i++) { HTC_PACKET_ENQUEUE(&pktQueue,&cookieArray[i]->HtcPkt); } HTCSendPktsMultiple(ar->arHtcTarget, &pktQueue); }
17,480
68,921
0
static bool set_on_slab_cache(struct kmem_cache *cachep, size_t size, unsigned long flags) { size_t left; cachep->num = 0; left = calculate_slab_order(cachep, size, flags); if (!cachep->num) return false; cachep->colour = left / cachep->colour_off; return true; }
17,481
113,166
0
Launcher::~Launcher() { }
17,482
73,325
0
void ass_stripe_unpack_c(int16_t *dst, const uint8_t *src, ptrdiff_t src_stride, uintptr_t width, uintptr_t height) { for (uintptr_t y = 0; y < height; ++y) { int16_t *ptr = dst; for (uintptr_t x = 0; x < width; x += STRIPE_WIDTH) { for (int k = 0; k < STRIPE_WIDTH; ++k) ptr[k] = (uint16_t)(((src[x + k] << 7) | (src[x + k] >> 1)) + 1) >> 1; ptr += STRIPE_WIDTH * height; } dst += STRIPE_WIDTH; src += src_stride; } }
17,483
65,398
0
static void __nfsd4_hash_conn(struct nfsd4_conn *conn, struct nfsd4_session *ses) { conn->cn_session = ses; list_add(&conn->cn_persession, &ses->se_conns); }
17,484
39,678
0
static long do_rmdir(int dfd, const char __user *pathname) { int error = 0; char * name; struct dentry *dentry; struct nameidata nd; error = user_path_parent(dfd, pathname, &nd, &name); if (error) return error; switch(nd.last_type) { case LAST_DOTDOT: error = -ENOTEMPTY; goto exit1; case LAST_DOT: error = -EINVAL; goto exit1; case LAST_ROOT: error = -EBUSY; goto exit1; } nd.flags &= ~LOOKUP_PARENT; mutex_lock_nested(&nd.path.dentry->d_inode->i_mutex, I_MUTEX_PARENT); dentry = lookup_hash(&nd); error = PTR_ERR(dentry); if (IS_ERR(dentry)) goto exit2; error = mnt_want_write(nd.path.mnt); if (error) goto exit3; error = security_path_rmdir(&nd.path, dentry); if (error) goto exit4; error = vfs_rmdir(nd.path.dentry->d_inode, dentry); exit4: mnt_drop_write(nd.path.mnt); exit3: dput(dentry); exit2: mutex_unlock(&nd.path.dentry->d_inode->i_mutex); exit1: path_put(&nd.path); putname(name); return error; }
17,485
171,523
0
OMX_ERRORTYPE SimpleSoftOMXComponent::emptyThisBuffer( OMX_BUFFERHEADERTYPE *buffer) { sp<AMessage> msg = new AMessage(kWhatEmptyThisBuffer, mHandler); msg->setPointer("header", buffer); msg->post(); return OMX_ErrorNone; }
17,486
95,803
0
const char *FS_LoadedPakChecksums( void ) { static char info[BIG_INFO_STRING]; searchpath_t *search; info[0] = 0; for ( search = fs_searchpaths ; search ; search = search->next ) { if ( !search->pack ) { continue; } Q_strcat( info, sizeof( info ), va( "%i ", search->pack->checksum ) ); } return info; }
17,487
52,231
0
arpt_error(struct sk_buff *skb, const struct xt_action_param *par) { net_err_ratelimited("arp_tables: error: '%s'\n", (const char *)par->targinfo); return NF_DROP; }
17,488
164,938
0
ResourceDispatcherHostImpl::HeaderInterceptorInfo::HeaderInterceptorInfo( const HeaderInterceptorInfo& other) {}
17,489
4,946
0
gst_qtdemux_handle_src_event (GstPad * pad, GstEvent * event) { gboolean res = TRUE; GstQTDemux *qtdemux = GST_QTDEMUX (gst_pad_get_parent (pad)); switch (GST_EVENT_TYPE (event)) { case GST_EVENT_SEEK: if (qtdemux->pullbased) { res = gst_qtdemux_do_seek (qtdemux, pad, event); } else { GST_DEBUG_OBJECT (qtdemux, "cannot seek in streaming mode"); res = FALSE; } gst_event_unref (event); break; case GST_EVENT_QOS: case GST_EVENT_NAVIGATION: res = FALSE; gst_event_unref (event); break; default: res = gst_pad_event_default (pad, event); break; } gst_object_unref (qtdemux); return res; }
17,490
38,002
0
static inline struct sk_buff *handle_ing(struct sk_buff *skb, struct packet_type **pt_prev, int *ret, struct net_device *orig_dev) { if (skb->dev->rx_queue.qdisc == &noop_qdisc) goto out; if (*pt_prev) { *ret = deliver_skb(skb, *pt_prev, orig_dev); *pt_prev = NULL; } switch (ing_filter(skb)) { case TC_ACT_SHOT: case TC_ACT_STOLEN: kfree_skb(skb); return NULL; } out: skb->tc_verd = 0; return skb; }
17,491
180,432
1
void xmlrpc_char_encode(char *outbuffer, const char *s1) { long unsigned int i; unsigned char c; char buf2[15]; mowgli_string_t *s = mowgli_string_create(); *buf2 = '\0'; *outbuffer = '\0'; if ((!(s1) || (*(s1) == '\0'))) { return; } for (i = 0; s1[i] != '\0'; i++) { c = s1[i]; if (c > 127) { snprintf(buf2, sizeof buf2, "&#%d;", c); s->append(s, buf2, strlen(buf2)); } else if (c == '&') { s->append(s, "&amp;", 5); } else if (c == '<') { s->append(s, "&lt;", 4); } else if (c == '>') { s->append(s, "&gt;", 4); } else if (c == '"') { s->append(s, "&quot;", 6); } else { s->append_char(s, c); } } memcpy(outbuffer, s->str, XMLRPC_BUFSIZE); }
17,492
89,654
0
int mdiobus_write_nested(struct mii_bus *bus, int addr, u32 regnum, u16 val) { int err; BUG_ON(in_interrupt()); mutex_lock_nested(&bus->mdio_lock, MDIO_MUTEX_NESTED); err = __mdiobus_write(bus, addr, regnum, val); mutex_unlock(&bus->mdio_lock); return err; }
17,493
25,280
0
xscale1_pmnc_counter_has_overflowed(unsigned long pmnc, enum xscale_counters counter) { int ret = 0; switch (counter) { case XSCALE_CYCLE_COUNTER: ret = pmnc & XSCALE1_CCOUNT_OVERFLOW; break; case XSCALE_COUNTER0: ret = pmnc & XSCALE1_COUNT0_OVERFLOW; break; case XSCALE_COUNTER1: ret = pmnc & XSCALE1_COUNT1_OVERFLOW; break; default: WARN_ONCE(1, "invalid counter number (%d)\n", counter); } return ret; }
17,494
130,715
0
static void deprecatedMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); imp->deprecatedMethod(); }
17,495
57,782
0
int kvm_vm_ioctl_get_dirty_log(struct kvm *kvm, struct kvm_dirty_log *log) { bool is_dirty = false; int r; mutex_lock(&kvm->slots_lock); /* * Flush potentially hardware-cached dirty pages to dirty_bitmap. */ if (kvm_x86_ops->flush_log_dirty) kvm_x86_ops->flush_log_dirty(kvm); r = kvm_get_dirty_log_protect(kvm, log, &is_dirty); /* * All the TLBs can be flushed out of mmu lock, see the comments in * kvm_mmu_slot_remove_write_access(). */ lockdep_assert_held(&kvm->slots_lock); if (is_dirty) kvm_flush_remote_tlbs(kvm); mutex_unlock(&kvm->slots_lock); return r; }
17,496
67,566
0
static int auth_count_scoreboard(cmd_rec *cmd, const char *user) { char *key; void *v; pr_scoreboard_entry_t *score = NULL; long cur = 0, hcur = 0, ccur = 0, hostsperuser = 1, usersessions = 0; config_rec *c = NULL, *maxc = NULL; /* First, check to see which Max* directives are configured. If none * are configured, then there is no need for us to needlessly scan the * ScoreboardFile. */ if (have_client_limits(cmd) == FALSE) { return 0; } /* Determine how many users are currently connected. */ /* We use this call to get the possibly-changed user name. */ c = pr_auth_get_anon_config(cmd->tmp_pool, &user, NULL, NULL); /* Gather our statistics. */ if (user != NULL) { char curr_server_addr[80] = {'\0'}; snprintf(curr_server_addr, sizeof(curr_server_addr), "%s:%d", pr_netaddr_get_ipstr(session.c->local_addr), main_server->ServerPort); curr_server_addr[sizeof(curr_server_addr)-1] = '\0'; if (pr_rewind_scoreboard() < 0) { pr_log_pri(PR_LOG_NOTICE, "error rewinding scoreboard: %s", strerror(errno)); } while ((score = pr_scoreboard_entry_read()) != NULL) { unsigned char same_host = FALSE; pr_signals_handle(); /* Make sure it matches our current server. */ if (strcmp(score->sce_server_addr, curr_server_addr) == 0) { if ((c != NULL && c->config_type == CONF_ANON && !strcmp(score->sce_user, user)) || c == NULL) { /* This small hack makes sure that cur is incremented properly * when dealing with anonymous logins (the timing of anonymous * login updates to the scoreboard makes this...odd). */ if (c != NULL && c->config_type == CONF_ANON && cur == 0) { cur = 1; } /* Only count authenticated clients, as per the documentation. */ if (strncmp(score->sce_user, "(none)", 7) == 0) { continue; } cur++; /* Count up sessions on a per-host basis. */ if (!strcmp(score->sce_client_addr, pr_netaddr_get_ipstr(session.c->remote_addr))) { same_host = TRUE; /* This small hack makes sure that hcur is incremented properly * when dealing with anonymous logins (the timing of anonymous * login updates to the scoreboard makes this...odd). */ if (c != NULL && c->config_type == CONF_ANON && hcur == 0) { hcur = 1; } hcur++; } /* Take a per-user count of connections. */ if (strcmp(score->sce_user, user) == 0) { usersessions++; /* Count up unique hosts. */ if (!same_host) { hostsperuser++; } } } if (session.conn_class != NULL && strcasecmp(score->sce_class, session.conn_class->cls_name) == 0) { ccur++; } } } pr_restore_scoreboard(); PRIVS_RELINQUISH } key = "client-count"; (void) pr_table_remove(session.notes, key, NULL); v = palloc(session.pool, sizeof(unsigned int)); *((unsigned int *) v) = cur; if (pr_table_add(session.notes, key, v, sizeof(unsigned int)) < 0) { if (errno != EEXIST) { pr_log_pri(PR_LOG_WARNING, "warning: error stashing '%s': %s", key, strerror(errno)); } } if (session.conn_class != NULL) { key = "class-client-count"; (void) pr_table_remove(session.notes, key, NULL); v = palloc(session.pool, sizeof(unsigned int)); *((unsigned int *) v) = ccur; if (pr_table_add(session.notes, key, v, sizeof(unsigned int)) < 0) { if (errno != EEXIST) { pr_log_pri(PR_LOG_WARNING, "warning: error stashing '%s': %s", key, strerror(errno)); } } } /* Try to determine what MaxClients/MaxHosts limits apply to this session * (if any) and count through the runtime file to see if this limit would * be exceeded. */ maxc = find_config(cmd->server->conf, CONF_PARAM, "MaxClientsPerClass", FALSE); while (session.conn_class != NULL && maxc) { char *maxstr = "Sorry, the maximum number of clients (%m) from your class " "are already connected."; unsigned int *max = maxc->argv[1]; if (strcmp(maxc->argv[0], session.conn_class->cls_name) != 0) { maxc = find_config_next(maxc, maxc->next, CONF_PARAM, "MaxClientsPerClass", FALSE); continue; } if (maxc->argc > 2) { maxstr = maxc->argv[2]; } if (*max && ccur > *max) { char maxn[20] = {'\0'}; pr_event_generate("mod_auth.max-clients-per-class", session.conn_class->cls_name); snprintf(maxn, sizeof(maxn), "%u", *max); pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn, NULL)); (void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0); pr_log_auth(PR_LOG_NOTICE, "Connection refused (MaxClientsPerClass %s %u)", session.conn_class->cls_name, *max); pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL, "Denied by MaxClientsPerClass"); } break; } maxc = find_config(TOPLEVEL_CONF, CONF_PARAM, "MaxClientsPerHost", FALSE); if (maxc) { char *maxstr = "Sorry, the maximum number of clients (%m) from your host " "are already connected."; unsigned int *max = maxc->argv[0]; if (maxc->argc > 1) { maxstr = maxc->argv[1]; } if (*max && hcur > *max) { char maxn[20] = {'\0'}; pr_event_generate("mod_auth.max-clients-per-host", session.c); snprintf(maxn, sizeof(maxn), "%u", *max); pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn, NULL)); (void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0); pr_log_auth(PR_LOG_NOTICE, "Connection refused (MaxClientsPerHost %u)", *max); pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL, "Denied by MaxClientsPerHost"); } } /* Check for any configured MaxClientsPerUser. */ maxc = find_config(TOPLEVEL_CONF, CONF_PARAM, "MaxClientsPerUser", FALSE); if (maxc) { char *maxstr = "Sorry, the maximum number of clients (%m) for this user " "are already connected."; unsigned int *max = maxc->argv[0]; if (maxc->argc > 1) { maxstr = maxc->argv[1]; } if (*max && usersessions > *max) { char maxn[20] = {'\0'}; pr_event_generate("mod_auth.max-clients-per-user", user); snprintf(maxn, sizeof(maxn), "%u", *max); pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn, NULL)); (void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0); pr_log_auth(PR_LOG_NOTICE, "Connection refused (MaxClientsPerUser %u)", *max); pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL, "Denied by MaxClientsPerUser"); } } maxc = find_config(TOPLEVEL_CONF, CONF_PARAM, "MaxClients", FALSE); if (maxc) { char *maxstr = "Sorry, the maximum number of allowed clients (%m) are " "already connected."; unsigned int *max = maxc->argv[0]; if (maxc->argc > 1) { maxstr = maxc->argv[1]; } if (*max && cur > *max) { char maxn[20] = {'\0'}; pr_event_generate("mod_auth.max-clients", NULL); snprintf(maxn, sizeof(maxn), "%u", *max); pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn, NULL)); (void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0); pr_log_auth(PR_LOG_NOTICE, "Connection refused (MaxClients %u)", *max); pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL, "Denied by MaxClients"); } } maxc = find_config(TOPLEVEL_CONF, CONF_PARAM, "MaxHostsPerUser", FALSE); if (maxc) { char *maxstr = "Sorry, the maximum number of hosts (%m) for this user are " "already connected."; unsigned int *max = maxc->argv[0]; if (maxc->argc > 1) { maxstr = maxc->argv[1]; } if (*max && hostsperuser > *max) { char maxn[20] = {'\0'}; pr_event_generate("mod_auth.max-hosts-per-user", user); snprintf(maxn, sizeof(maxn), "%u", *max); pr_response_send(R_530, "%s", sreplace(cmd->tmp_pool, maxstr, "%m", maxn, NULL)); (void) pr_cmd_dispatch_phase(cmd, LOG_CMD_ERR, 0); pr_log_auth(PR_LOG_NOTICE, "Connection refused (MaxHostsPerUser %u)", *max); pr_session_disconnect(&auth_module, PR_SESS_DISCONNECT_CONFIG_ACL, "Denied by MaxHostsPerUser"); } } return 0; }
17,497
161,669
0
VaapiVideoDecodeAccelerator::CreateSurface() { DCHECK(decoder_thread_task_runner_->BelongsToCurrentThread()); base::AutoLock auto_lock(lock_); if (available_va_surfaces_.empty()) return nullptr; DCHECK(!awaiting_va_surfaces_recycle_); scoped_refptr<VASurface> va_surface(new VASurface( available_va_surfaces_.front(), requested_pic_size_, vaapi_wrapper_->va_surface_format(), va_surface_release_cb_)); available_va_surfaces_.pop_front(); return new VaapiDecodeSurface(curr_input_buffer_->id(), va_surface); }
17,498
1,471
0
static ssize_t pdu_unmarshal(V9fsPDU *pdu, size_t offset, const char *fmt, ...) { ssize_t ret; va_list ap; va_start(ap, fmt); ret = pdu->s->transport->pdu_vunmarshal(pdu, offset, fmt, ap); va_end(ap); return ret; }
17,499