unique_id
int64 13
189k
| target
int64 0
1
| code
stringlengths 20
241k
| __index_level_0__
int64 0
18.9k
|
---|---|---|---|
23,955 | 0 | static int airo_get_name(struct net_device *dev,
struct iw_request_info *info,
char *cwrq,
char *extra)
{
strcpy(cwrq, "IEEE 802.11-DS");
return 0;
}
| 7,300 |
104,395 | 0 | inline static PassRefPtr<CSSPrimitiveValue> zoomAdjustedNumberValue(double value, const RenderStyle* style)
{
return cssValuePool().createValue(value / style->effectiveZoom(), CSSPrimitiveValue::CSS_NUMBER);
}
| 7,301 |
48,962 | 0 | static struct sk_buff **inet_gro_receive(struct sk_buff **head,
struct sk_buff *skb)
{
const struct net_offload *ops;
struct sk_buff **pp = NULL;
struct sk_buff *p;
const struct iphdr *iph;
unsigned int hlen;
unsigned int off;
unsigned int id;
int flush = 1;
int proto;
off = skb_gro_offset(skb);
hlen = off + sizeof(*iph);
iph = skb_gro_header_fast(skb, off);
if (skb_gro_header_hard(skb, hlen)) {
iph = skb_gro_header_slow(skb, hlen, off);
if (unlikely(!iph))
goto out;
}
proto = iph->protocol;
rcu_read_lock();
ops = rcu_dereference(inet_offloads[proto]);
if (!ops || !ops->callbacks.gro_receive)
goto out_unlock;
if (*(u8 *)iph != 0x45)
goto out_unlock;
if (unlikely(ip_fast_csum((u8 *)iph, 5)))
goto out_unlock;
id = ntohl(*(__be32 *)&iph->id);
flush = (u16)((ntohl(*(__be32 *)iph) ^ skb_gro_len(skb)) | (id & ~IP_DF));
id >>= 16;
for (p = *head; p; p = p->next) {
struct iphdr *iph2;
if (!NAPI_GRO_CB(p)->same_flow)
continue;
iph2 = (struct iphdr *)(p->data + off);
/* The above works because, with the exception of the top
* (inner most) layer, we only aggregate pkts with the same
* hdr length so all the hdrs we'll need to verify will start
* at the same offset.
*/
if ((iph->protocol ^ iph2->protocol) |
((__force u32)iph->saddr ^ (__force u32)iph2->saddr) |
((__force u32)iph->daddr ^ (__force u32)iph2->daddr)) {
NAPI_GRO_CB(p)->same_flow = 0;
continue;
}
/* All fields must match except length and checksum. */
NAPI_GRO_CB(p)->flush |=
(iph->ttl ^ iph2->ttl) |
(iph->tos ^ iph2->tos) |
((iph->frag_off ^ iph2->frag_off) & htons(IP_DF));
/* Save the IP ID check to be included later when we get to
* the transport layer so only the inner most IP ID is checked.
* This is because some GSO/TSO implementations do not
* correctly increment the IP ID for the outer hdrs.
*/
NAPI_GRO_CB(p)->flush_id =
((u16)(ntohs(iph2->id) + NAPI_GRO_CB(p)->count) ^ id);
NAPI_GRO_CB(p)->flush |= flush;
}
NAPI_GRO_CB(skb)->flush |= flush;
skb_set_network_header(skb, off);
/* The above will be needed by the transport layer if there is one
* immediately following this IP hdr.
*/
/* Note : No need to call skb_gro_postpull_rcsum() here,
* as we already checked checksum over ipv4 header was 0
*/
skb_gro_pull(skb, sizeof(*iph));
skb_set_transport_header(skb, skb_gro_offset(skb));
pp = ops->callbacks.gro_receive(head, skb);
out_unlock:
rcu_read_unlock();
out:
NAPI_GRO_CB(skb)->flush |= flush;
return pp;
}
| 7,302 |
22,559 | 0 | static ssize_t sched_mc_power_savings_show(struct sysdev_class *class,
struct sysdev_class_attribute *attr,
char *page)
{
return sprintf(page, "%u\n", sched_mc_power_savings);
}
| 7,303 |
118,842 | 0 | DestructionObserver(WebContentsImpl* owner, WebContents* watched_contents)
: WebContentsObserver(watched_contents),
owner_(owner) {
}
| 7,304 |
131,202 | 0 | static void activityLoggingGetterPerWorldBindingsLongAttributeAttributeSetterForMainWorld(v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
ExceptionState exceptionState(ExceptionState::SetterContext, "activityLoggingGetterPerWorldBindingsLongAttribute", "TestObjectPython", info.Holder(), info.GetIsolate());
TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder());
V8TRYCATCH_EXCEPTION_VOID(int, cppValue, toInt32(jsValue, exceptionState), exceptionState);
imp->setActivityLoggingGetterPerWorldBindingsLongAttribute(cppValue);
}
| 7,305 |
65,027 | 0 | int bpf_analyzer(struct bpf_prog *prog, const struct bpf_ext_analyzer_ops *ops,
void *priv)
{
struct bpf_verifier_env *env;
int ret;
env = kzalloc(sizeof(struct bpf_verifier_env), GFP_KERNEL);
if (!env)
return -ENOMEM;
env->insn_aux_data = vzalloc(sizeof(struct bpf_insn_aux_data) *
prog->len);
ret = -ENOMEM;
if (!env->insn_aux_data)
goto err_free_env;
env->prog = prog;
env->analyzer_ops = ops;
env->analyzer_priv = priv;
/* grab the mutex to protect few globals used by verifier */
mutex_lock(&bpf_verifier_lock);
log_level = 0;
env->explored_states = kcalloc(env->prog->len,
sizeof(struct bpf_verifier_state_list *),
GFP_KERNEL);
ret = -ENOMEM;
if (!env->explored_states)
goto skip_full_check;
ret = check_cfg(env);
if (ret < 0)
goto skip_full_check;
env->allow_ptr_leaks = capable(CAP_SYS_ADMIN);
ret = do_check(env);
skip_full_check:
while (pop_stack(env, NULL) >= 0);
free_states(env);
mutex_unlock(&bpf_verifier_lock);
vfree(env->insn_aux_data);
err_free_env:
kfree(env);
return ret;
}
| 7,306 |
54,370 | 0 | free_berdata(struct berval **array)
{
int i;
if (array != NULL) {
for (i = 0; array[i] != NULL; i++) {
if (array[i]->bv_val != NULL)
free(array[i]->bv_val);
free(array[i]);
}
free(array);
}
}
| 7,307 |
158,982 | 0 | bool PDFiumEngine::OnChar(const pp::KeyboardInputEvent& event) {
if (last_page_mouse_down_ == -1)
return false;
base::string16 str = base::UTF8ToUTF16(event.GetCharacterText().AsString());
return !!FORM_OnChar(form_, pages_[last_page_mouse_down_]->GetPage(), str[0],
event.GetModifiers());
}
| 7,308 |
86,632 | 0 | static void blk_flush_restore_request(struct request *rq)
{
/*
* After flush data completion, @rq->bio is %NULL but we need to
* complete the bio again. @rq->biotail is guaranteed to equal the
* original @rq->bio. Restore it.
*/
rq->bio = rq->biotail;
/* make @rq a normal request */
rq->cmd_flags &= ~REQ_FLUSH_SEQ;
rq->end_io = rq->flush.saved_end_io;
}
| 7,309 |
20,438 | 0 | static void dump_orphan_list(struct super_block *sb, struct ext4_sb_info *sbi)
{
struct list_head *l;
ext4_msg(sb, KERN_ERR, "sb orphan head is %d",
le32_to_cpu(sbi->s_es->s_last_orphan));
printk(KERN_ERR "sb_info orphan list:\n");
list_for_each(l, &sbi->s_orphan) {
struct inode *inode = orphan_list_entry(l);
printk(KERN_ERR " "
"inode %s:%lu at %p: mode %o, nlink %d, next %d\n",
inode->i_sb->s_id, inode->i_ino, inode,
inode->i_mode, inode->i_nlink,
NEXT_ORPHAN(inode));
}
}
| 7,310 |
146,296 | 0 | void WebGLRenderingContextBase::ForceNextWebGLContextCreationToFail() {
g_should_fail_context_creation_for_testing = true;
}
| 7,311 |
112,318 | 0 | void ResourceDispatcherHostImpl::CancelRequest(int child_id,
int request_id,
bool from_renderer) {
if (from_renderer) {
if (IsTransferredNavigation(GlobalRequestID(child_id, request_id)))
return;
}
ResourceLoader* loader = GetLoader(child_id, request_id);
if (!loader) {
DVLOG(1) << "Canceling a request that wasn't found";
return;
}
loader->CancelRequest(from_renderer);
}
| 7,312 |
171,822 | 0 | static int get_keylockstates()
{
return btif_hh_keylockstates;
}
| 7,313 |
98,238 | 0 | void Download::platformInvalidate()
{
notImplemented();
}
| 7,314 |
44,803 | 0 | local char *justname(char *path)
{
char *p;
p = strrchr(path, '/');
return p == NULL ? path : p + 1;
}
| 7,315 |
132,579 | 0 | void WebKitTestController::OnGpuProcessCrashed(
base::TerminationStatus exit_code) {
DCHECK(CalledOnValidThread());
printer_->AddErrorMessage("#CRASHED - gpu");
DiscardMainWindow();
}
| 7,316 |
130,776 | 0 | static void enforcedRangeUnsignedShortAttrAttributeSetterCallback(v8::Local<v8::String>, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackInfo<void>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMSetter");
TestObjectV8Internal::enforcedRangeUnsignedShortAttrAttributeSetter(jsValue, info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 7,317 |
145,164 | 0 | void GpuProcessHost::InitOzone() {
if (features::IsOzoneDrmMojo()) {
auto interface_binder = base::BindRepeating(&GpuProcessHost::BindInterface,
weak_ptr_factory_.GetWeakPtr());
auto io_callback = base::BindOnce(
[](const base::RepeatingCallback<void(const std::string&,
mojo::ScopedMessagePipeHandle)>&
interface_binder,
ui::OzonePlatform* platform) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
platform->GetGpuPlatformSupportHost()->OnGpuServiceLaunched(
BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
interface_binder);
},
interface_binder);
OzoneRegisterStartupCallbackHelper(std::move(io_callback));
} else {
auto send_callback = base::BindRepeating(&SendGpuProcessMessage,
weak_ptr_factory_.GetWeakPtr());
auto io_callback = base::BindOnce(
[](int host_id,
const base::RepeatingCallback<void(IPC::Message*)>& send_callback,
ui::OzonePlatform* platform) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
platform->GetGpuPlatformSupportHost()->OnGpuProcessLaunched(
host_id, BrowserThread::GetTaskRunnerForThread(BrowserThread::UI),
BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
send_callback);
},
host_id_, send_callback);
OzoneRegisterStartupCallbackHelper(std::move(io_callback));
}
}
| 7,318 |
171,105 | 0 | int get_camera_metadata_entry(camera_metadata_t *src,
size_t index,
camera_metadata_entry_t *entry) {
if (src == NULL || entry == NULL) return ERROR;
if (index >= src->entry_count) return ERROR;
camera_metadata_buffer_entry_t *buffer_entry = get_entries(src) + index;
entry->index = index;
entry->tag = buffer_entry->tag;
entry->type = buffer_entry->type;
entry->count = buffer_entry->count;
if (buffer_entry->count *
camera_metadata_type_size[buffer_entry->type] > 4) {
entry->data.u8 = get_data(src) + buffer_entry->data.offset;
} else {
entry->data.u8 = buffer_entry->data.value;
}
return OK;
}
| 7,319 |
43,000 | 0 | static void virtnet_get_drvinfo(struct net_device *dev,
struct ethtool_drvinfo *info)
{
struct virtnet_info *vi = netdev_priv(dev);
struct virtio_device *vdev = vi->vdev;
strlcpy(info->driver, KBUILD_MODNAME, sizeof(info->driver));
strlcpy(info->version, VIRTNET_DRIVER_VERSION, sizeof(info->version));
strlcpy(info->bus_info, virtio_bus_name(vdev), sizeof(info->bus_info));
}
| 7,320 |
180,399 | 1 | static void parse_input(h2o_http2_conn_t *conn)
{
size_t http2_max_concurrent_requests_per_connection = conn->super.ctx->globalconf->http2.max_concurrent_requests_per_connection;
int perform_early_exit = 0;
if (conn->num_streams.pull.half_closed + conn->num_streams.push.half_closed != http2_max_concurrent_requests_per_connection)
perform_early_exit = 1;
/* handle the input */
while (conn->state < H2O_HTTP2_CONN_STATE_IS_CLOSING && conn->sock->input->size != 0) {
if (perform_early_exit == 1 &&
conn->num_streams.pull.half_closed + conn->num_streams.push.half_closed == http2_max_concurrent_requests_per_connection)
goto EarlyExit;
/* process a frame */
const char *err_desc = NULL;
ssize_t ret = conn->_read_expect(conn, (uint8_t *)conn->sock->input->bytes, conn->sock->input->size, &err_desc);
if (ret == H2O_HTTP2_ERROR_INCOMPLETE) {
break;
} else if (ret < 0) {
if (ret != H2O_HTTP2_ERROR_PROTOCOL_CLOSE_IMMEDIATELY) {
enqueue_goaway(conn, (int)ret,
err_desc != NULL ? (h2o_iovec_t){(char *)err_desc, strlen(err_desc)} : (h2o_iovec_t){});
}
close_connection(conn);
return;
}
/* advance to the next frame */
h2o_buffer_consume(&conn->sock->input, ret);
}
if (!h2o_socket_is_reading(conn->sock))
h2o_socket_read_start(conn->sock, on_read);
return;
EarlyExit:
if (h2o_socket_is_reading(conn->sock))
h2o_socket_read_stop(conn->sock);
}
| 7,321 |
83,558 | 0 | rdpUpdate* update_new(rdpRdp* rdp)
{
const wObject cb = { NULL, NULL, NULL, update_free_queued_message, NULL };
rdpUpdate* update;
OFFSCREEN_DELETE_LIST* deleteList;
update = (rdpUpdate*) calloc(1, sizeof(rdpUpdate));
if (!update)
return NULL;
update->log = WLog_Get("com.freerdp.core.update");
update->pointer = (rdpPointerUpdate*) calloc(1, sizeof(rdpPointerUpdate));
if (!update->pointer)
goto fail;
update->primary = (rdpPrimaryUpdate*) calloc(1, sizeof(rdpPrimaryUpdate));
if (!update->primary)
goto fail;
update->secondary = (rdpSecondaryUpdate*) calloc(1, sizeof(rdpSecondaryUpdate));
if (!update->secondary)
goto fail;
update->altsec = (rdpAltSecUpdate*) calloc(1, sizeof(rdpAltSecUpdate));
if (!update->altsec)
goto fail;
update->window = (rdpWindowUpdate*) calloc(1, sizeof(rdpWindowUpdate));
if (!update->window)
goto fail;
deleteList = &(update->altsec->create_offscreen_bitmap.deleteList);
deleteList->sIndices = 64;
deleteList->indices = calloc(deleteList->sIndices, 2);
if (!deleteList->indices)
goto fail;
deleteList->cIndices = 0;
update->SuppressOutput = update_send_suppress_output;
update->initialState = TRUE;
update->queue = MessageQueue_New(&cb);
if (!update->queue)
goto fail;
return update;
fail:
update_free(update);
return NULL;
}
| 7,322 |
162,737 | 0 | String BaseRenderingContext2D::globalCompositeOperation() const {
return CompositeOperatorName(
CompositeOperatorFromSkia(GetState().GlobalComposite()),
BlendModeFromSkia(GetState().GlobalComposite()));
}
| 7,323 |
47,556 | 0 | static int hmac_sha256_init(struct ahash_request *req)
{
struct crypto_ahash *tfm = crypto_ahash_reqtfm(req);
struct hash_ctx *ctx = crypto_ahash_ctx(tfm);
ctx->config.data_format = HASH_DATA_8_BITS;
ctx->config.algorithm = HASH_ALGO_SHA256;
ctx->config.oper_mode = HASH_OPER_MODE_HMAC;
ctx->digestsize = SHA256_DIGEST_SIZE;
return hash_init(req);
}
| 7,324 |
6,689 | 0 | static bool cmd_data_set_management(IDEState *s, uint8_t cmd)
{
switch (s->feature) {
case DSM_TRIM:
if (s->blk) {
ide_sector_start_dma(s, IDE_DMA_TRIM);
return false;
}
break;
}
ide_abort_command(s);
return true;
}
| 7,325 |
48,441 | 0 | static int big_key_crypt(enum big_key_op op, u8 *data, size_t datalen, u8 *key)
{
int ret = -EINVAL;
struct scatterlist sgio;
SKCIPHER_REQUEST_ON_STACK(req, big_key_skcipher);
if (crypto_skcipher_setkey(big_key_skcipher, key, ENC_KEY_SIZE)) {
ret = -EAGAIN;
goto error;
}
skcipher_request_set_tfm(req, big_key_skcipher);
skcipher_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP,
NULL, NULL);
sg_init_one(&sgio, data, datalen);
skcipher_request_set_crypt(req, &sgio, &sgio, datalen, NULL);
if (op == BIG_KEY_ENC)
ret = crypto_skcipher_encrypt(req);
else
ret = crypto_skcipher_decrypt(req);
skcipher_request_zero(req);
error:
return ret;
}
| 7,326 |
59,817 | 0 | static int hid_start_in(struct hid_device *hid)
{
unsigned long flags;
int rc = 0;
struct usbhid_device *usbhid = hid->driver_data;
spin_lock_irqsave(&usbhid->lock, flags);
if (test_bit(HID_IN_POLLING, &usbhid->iofl) &&
!test_bit(HID_DISCONNECTED, &usbhid->iofl) &&
!test_bit(HID_SUSPENDED, &usbhid->iofl) &&
!test_and_set_bit(HID_IN_RUNNING, &usbhid->iofl)) {
rc = usb_submit_urb(usbhid->urbin, GFP_ATOMIC);
if (rc != 0) {
clear_bit(HID_IN_RUNNING, &usbhid->iofl);
if (rc == -ENOSPC)
set_bit(HID_NO_BANDWIDTH, &usbhid->iofl);
} else {
clear_bit(HID_NO_BANDWIDTH, &usbhid->iofl);
}
}
spin_unlock_irqrestore(&usbhid->lock, flags);
return rc;
}
| 7,327 |
142,296 | 0 | void ChromePasswordManagerClient::HideManualFallbackForSaving() {
if (!CanShowBubbleOnURL(web_contents()->GetLastCommittedURL()))
return;
#if !defined(OS_ANDROID)
PasswordsClientUIDelegate* manage_passwords_ui_controller =
PasswordsClientUIDelegateFromWebContents(web_contents());
if (manage_passwords_ui_controller)
manage_passwords_ui_controller->OnHideManualFallbackForSaving();
#endif // !defined(OS_ANDROID)
}
| 7,328 |
146,343 | 0 | WebLayer* WebGLRenderingContextBase::PlatformLayer() const {
return isContextLost() ? 0 : GetDrawingBuffer()->PlatformLayer();
}
| 7,329 |
11,281 | 0 | asn1_decode_simple_der (unsigned int etype, const unsigned char *der,
unsigned int _der_len, const unsigned char **str,
unsigned int *str_len)
{
int tag_len, len_len;
const unsigned char *p;
int der_len = _der_len;
unsigned char class;
unsigned long tag;
long ret;
if (der == NULL || der_len == 0)
return ASN1_VALUE_NOT_VALID;
if (ETYPE_OK (etype) == 0 || ETYPE_IS_STRING(etype) == 0)
return ASN1_VALUE_NOT_VALID;
/* doesn't handle constructed classes */
if (ETYPE_CLASS (etype) != ASN1_CLASS_UNIVERSAL)
return ASN1_VALUE_NOT_VALID;
p = der;
ret = asn1_get_tag_der (p, der_len, &class, &tag_len, &tag);
if (ret != ASN1_SUCCESS)
return ret;
if (class != ETYPE_CLASS (etype) || tag != ETYPE_TAG (etype))
return ASN1_DER_ERROR;
p += tag_len;
der_len -= tag_len;
if (der_len <= 0)
return ASN1_DER_ERROR;
ret = asn1_get_length_der (p, der_len, &len_len);
if (ret < 0)
return ASN1_DER_ERROR;
p += len_len;
der_len -= len_len;
if (der_len <= 0)
return ASN1_DER_ERROR;
*str_len = ret;
*str = p;
return ASN1_SUCCESS;
}
| 7,330 |
130,022 | 0 | void RecordVariationSeedEmptyHistogram(VariationSeedEmptyState state) {
UMA_HISTOGRAM_ENUMERATION("Variations.SeedEmpty", state,
VARIATIONS_SEED_EMPTY_ENUM_SIZE);
}
| 7,331 |
47,076 | 0 | static int xts_encrypt(struct blkcipher_desc *desc, struct scatterlist *dst,
struct scatterlist *src, unsigned int nbytes)
{
struct twofish_xts_ctx *ctx = crypto_blkcipher_ctx(desc->tfm);
return glue_xts_crypt_128bit(&twofish_enc_xts, desc, dst, src, nbytes,
XTS_TWEAK_CAST(twofish_enc_blk),
&ctx->tweak_ctx, &ctx->crypt_ctx);
}
| 7,332 |
23,215 | 0 | static void nfs4_locku_prepare(struct rpc_task *task, void *data)
{
struct nfs4_unlockdata *calldata = data;
if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0)
return;
if ((calldata->lsp->ls_flags & NFS_LOCK_INITIALIZED) == 0) {
/* Note: exit _without_ running nfs4_locku_done */
task->tk_action = NULL;
return;
}
calldata->timestamp = jiffies;
if (nfs4_setup_sequence(calldata->server,
&calldata->arg.seq_args,
&calldata->res.seq_res, 1, task))
return;
rpc_call_start(task);
}
| 7,333 |
81,091 | 0 | static int vmx_vm_init(struct kvm *kvm)
{
if (!ple_gap)
kvm->arch.pause_in_guest = true;
return 0;
}
| 7,334 |
120,917 | 0 | int SocketStream::AllowCertErrorForReconnection(SSLConfig* ssl_config) {
DCHECK(ssl_config);
SSLClientSocket* ssl_socket = static_cast<SSLClientSocket*>(socket_.get());
SSLInfo ssl_info;
ssl_socket->GetSSLInfo(&ssl_info);
if (ssl_info.cert.get() == NULL ||
ssl_config->IsAllowedBadCert(ssl_info.cert.get(), NULL)) {
next_state_ = STATE_CLOSE;
return ERR_UNEXPECTED;
}
SSLConfig::CertAndStatus bad_cert;
if (!X509Certificate::GetDEREncoded(ssl_info.cert->os_cert_handle(),
&bad_cert.der_cert)) {
next_state_ = STATE_CLOSE;
return ERR_UNEXPECTED;
}
bad_cert.cert_status = ssl_info.cert_status;
ssl_config->allowed_bad_certs.push_back(bad_cert);
socket_->Disconnect();
socket_.reset();
next_state_ = STATE_TCP_CONNECT;
return OK;
}
| 7,335 |
137,151 | 0 | void Textfield::ApplyColor(SkColor value, const gfx::Range& range) {
GetRenderText()->ApplyColor(value, range);
SchedulePaint();
}
| 7,336 |
122,939 | 0 | void RenderWidgetHostImpl::Blur() {
if (IsMouseLocked())
view_->UnlockMouse();
Send(new ViewMsg_SetFocus(routing_id_, false));
}
| 7,337 |
43,138 | 0 | static ssize_t vhost_scsi_tpg_show_nexus(struct se_portal_group *se_tpg,
char *page)
{
struct vhost_scsi_tpg *tpg = container_of(se_tpg,
struct vhost_scsi_tpg, se_tpg);
struct vhost_scsi_nexus *tv_nexus;
ssize_t ret;
mutex_lock(&tpg->tv_tpg_mutex);
tv_nexus = tpg->tpg_nexus;
if (!tv_nexus) {
mutex_unlock(&tpg->tv_tpg_mutex);
return -ENODEV;
}
ret = snprintf(page, PAGE_SIZE, "%s\n",
tv_nexus->tvn_se_sess->se_node_acl->initiatorname);
mutex_unlock(&tpg->tv_tpg_mutex);
return ret;
}
| 7,338 |
60,750 | 0 | server_check_dh(krb5_context context,
pkinit_plg_crypto_context cryptoctx,
pkinit_req_crypto_context req_cryptoctx,
pkinit_identity_crypto_context id_cryptoctx,
krb5_data *dh_params,
int minbits)
{
DH *dh = NULL;
const BIGNUM *p;
int dh_prime_bits;
krb5_error_code retval = KRB5KDC_ERR_DH_KEY_PARAMETERS_NOT_ACCEPTED;
dh = decode_dh_params((uint8_t *)dh_params->data, dh_params->length);
if (dh == NULL) {
pkiDebug("failed to decode dhparams\n");
goto cleanup;
}
/* KDC SHOULD check to see if the key parameters satisfy its policy */
DH_get0_pqg(dh, &p, NULL, NULL);
dh_prime_bits = BN_num_bits(p);
if (minbits && dh_prime_bits < minbits) {
pkiDebug("client sent dh params with %d bits, we require %d\n",
dh_prime_bits, minbits);
goto cleanup;
}
if (check_dh_wellknown(cryptoctx, dh, dh_prime_bits))
retval = 0;
cleanup:
if (retval == 0)
req_cryptoctx->dh = dh;
else
DH_free(dh);
return retval;
}
| 7,339 |
58,997 | 0 | static void CacheThru_write(HTStream *me, const char *str, int l)
{
if (me->status == HT_OK && l != 0) {
if (me->fp) {
if (fwrite(str, (size_t) 1, (size_t) l, me->fp) < (size_t) l
|| ferror(me->fp)) {
me->status = HT_ERROR;
}
} else if (me->chunk) {
me->last_chunk = HTChunkPutb2(me->last_chunk, str, l);
if (me->last_chunk == NULL || me->last_chunk->allocated == 0)
me->status = HT_ERROR;
}
}
(*me->actions->put_block) (me->target, str, l);
}
| 7,340 |
130,206 | 0 | scoped_refptr<PrintBackend> PrintBackend::CreateInstance(
const base::DictionaryValue* print_backend_settings) {
return new PrintBackendWin;
}
| 7,341 |
36,956 | 0 | create_socket_name (const char *template)
{
char *name, *p;
size_t len;
/* Prepend the tmp directory to the template. */
p = getenv ("TMPDIR");
if (!p || !*p)
p = "/tmp";
len = strlen (p) + strlen (template) + 2;
name = xcharalloc (len);
memset (name, 0, len);
memcpy (name, p, strlen (p));
if (p[strlen (p) - 1] != '/')
name = strcat (name, "/");
name = strcat (name, template);
p = strrchr (name, '/');
*p = '\0';
if (!mkdtemp (name))
{
free (name);
return NULL;
}
*p = '/';
return name;
}
| 7,342 |
113,272 | 0 | LocationBar* GetLocationBar() const {
return browser()->window()->GetLocationBar();
}
| 7,343 |
45,305 | 0 | static inline u64 btrfs_inc_tree_mod_seq(struct btrfs_fs_info *fs_info)
{
return atomic64_inc_return(&fs_info->tree_mod_seq);
}
| 7,344 |
28,225 | 0 | const uint8_t *ff_h264_decode_nal(H264Context *h, const uint8_t *src,
int *dst_length, int *consumed, int length)
{
int i, si, di;
uint8_t *dst;
int bufidx;
h->nal_ref_idc = src[0] >> 5;
h->nal_unit_type = src[0] & 0x1F;
src++;
length--;
#define STARTCODE_TEST \
if (i + 2 < length && src[i + 1] == 0 && src[i + 2] <= 3) { \
if (src[i + 2] != 3) { \
/* startcode, so we must be past the end */ \
length = i; \
} \
break; \
}
#if HAVE_FAST_UNALIGNED
#define FIND_FIRST_ZERO \
if (i > 0 && !src[i]) \
i--; \
while (src[i]) \
i++
#if HAVE_FAST_64BIT
for (i = 0; i + 1 < length; i += 9) {
if (!((~AV_RN64A(src + i) &
(AV_RN64A(src + i) - 0x0100010001000101ULL)) &
0x8000800080008080ULL))
continue;
FIND_FIRST_ZERO;
STARTCODE_TEST;
i -= 7;
}
#else
for (i = 0; i + 1 < length; i += 5) {
if (!((~AV_RN32A(src + i) &
(AV_RN32A(src + i) - 0x01000101U)) &
0x80008080U))
continue;
FIND_FIRST_ZERO;
STARTCODE_TEST;
i -= 3;
}
#endif
#else
for (i = 0; i + 1 < length; i += 2) {
if (src[i])
continue;
if (i > 0 && src[i - 1] == 0)
i--;
STARTCODE_TEST;
}
#endif
bufidx = h->nal_unit_type == NAL_DPC ? 1 : 0;
si = h->rbsp_buffer_size[bufidx];
av_fast_padded_malloc(&h->rbsp_buffer[bufidx], &h->rbsp_buffer_size[bufidx], length+MAX_MBPAIR_SIZE);
dst = h->rbsp_buffer[bufidx];
if (dst == NULL)
return NULL;
if(i>=length-1){ //no escaped 0
*dst_length= length;
*consumed= length+1; //+1 for the header
if(h->avctx->flags2 & CODEC_FLAG2_FAST){
return src;
}else{
memcpy(dst, src, length);
return dst;
}
}
memcpy(dst, src, i);
si = di = i;
while (si + 2 < length) {
if (src[si + 2] > 3) {
dst[di++] = src[si++];
dst[di++] = src[si++];
} else if (src[si] == 0 && src[si + 1] == 0) {
if (src[si + 2] == 3) { // escape
dst[di++] = 0;
dst[di++] = 0;
si += 3;
continue;
} else // next start code
goto nsc;
}
dst[di++] = src[si++];
}
while (si < length)
dst[di++] = src[si++];
nsc:
memset(dst + di, 0, FF_INPUT_BUFFER_PADDING_SIZE);
*dst_length = di;
*consumed = si + 1; // +1 for the header
/* FIXME store exact number of bits in the getbitcontext
* (it is needed for decoding) */
return dst;
}
| 7,345 |
59,361 | 0 | static int xfrm_exp_policy_notify(struct xfrm_policy *xp, int dir, const struct km_event *c)
{
struct net *net = xp_net(xp);
struct sk_buff *skb;
skb = nlmsg_new(xfrm_polexpire_msgsize(xp), GFP_ATOMIC);
if (skb == NULL)
return -ENOMEM;
if (build_polexpire(skb, xp, dir, c) < 0)
BUG();
return xfrm_nlmsg_multicast(net, skb, 0, XFRMNLGRP_EXPIRE);
}
| 7,346 |
119,618 | 0 | static LayoutUnit inlineLogicalWidth(RenderObject* child, bool start = true, bool end = true)
{
unsigned lineDepth = 1;
LayoutUnit extraWidth = 0;
RenderObject* parent = child->parent();
while (parent->isRenderInline() && lineDepth++ < cMaxLineDepth) {
RenderInline* parentAsRenderInline = toRenderInline(parent);
if (!isEmptyInline(parentAsRenderInline)) {
if (start && shouldAddBorderPaddingMargin(child->previousSibling(), start))
extraWidth += borderPaddingMarginStart(parentAsRenderInline);
if (end && shouldAddBorderPaddingMargin(child->nextSibling(), end))
extraWidth += borderPaddingMarginEnd(parentAsRenderInline);
if (!start && !end)
return extraWidth;
}
child = parent;
parent = child->parent();
}
return extraWidth;
}
| 7,347 |
49,410 | 0 | static ssize_t proc_coredump_filter_read(struct file *file, char __user *buf,
size_t count, loff_t *ppos)
{
struct task_struct *task = get_proc_task(file_inode(file));
struct mm_struct *mm;
char buffer[PROC_NUMBUF];
size_t len;
int ret;
if (!task)
return -ESRCH;
ret = 0;
mm = get_task_mm(task);
if (mm) {
len = snprintf(buffer, sizeof(buffer), "%08lx\n",
((mm->flags & MMF_DUMP_FILTER_MASK) >>
MMF_DUMP_FILTER_SHIFT));
mmput(mm);
ret = simple_read_from_buffer(buf, count, ppos, buffer, len);
}
put_task_struct(task);
return ret;
}
| 7,348 |
15,498 | 0 | request_method (const struct request *req)
{
return req->method;
}
| 7,349 |
149,348 | 0 | bool BinaryUploadService::IsActive(Request* request) {
return (active_requests_.find(request) != active_requests_.end());
}
| 7,350 |
41,733 | 0 | static void wait_for_snapshot_creation(struct btrfs_root *root)
{
while (true) {
int ret;
ret = btrfs_start_write_no_snapshoting(root);
if (ret)
break;
wait_on_atomic_t(&root->will_be_snapshoted,
wait_snapshoting_atomic_t,
TASK_UNINTERRUPTIBLE);
}
}
| 7,351 |
75,006 | 0 | layer_replace_tiles(int layer, int old_index, int new_index)
{
int layer_h;
int layer_w;
struct map_tile* tile;
int i_x, i_y;
layer_w = s_map->layers[layer].width;
layer_h = s_map->layers[layer].height;
for (i_x = 0; i_x < layer_w; ++i_x) for (i_y = 0; i_y < layer_h; ++i_y) {
tile = &s_map->layers[layer].tilemap[i_x + i_y * layer_w];
if (tile->tile_index == old_index)
tile->tile_index = new_index;
}
}
| 7,352 |
90,218 | 0 | static struct smi_info *find_dup_si(struct smi_info *info)
{
struct smi_info *e;
list_for_each_entry(e, &smi_infos, link) {
if (e->io.addr_type != info->io.addr_type)
continue;
if (e->io.addr_data == info->io.addr_data) {
/*
* This is a cheap hack, ACPI doesn't have a defined
* slave address but SMBIOS does. Pick it up from
* any source that has it available.
*/
if (info->io.slave_addr && !e->io.slave_addr)
e->io.slave_addr = info->io.slave_addr;
return e;
}
}
return NULL;
}
| 7,353 |
152,116 | 0 | RenderFrameHostImpl::~RenderFrameHostImpl() {
ResetChildren();
ResetNavigationRequests();
ClearAllWebUI();
SetLastCommittedSiteUrl(GURL());
if (overlay_routing_token_)
g_token_frame_map.Get().erase(*overlay_routing_token_);
site_instance_->RemoveObserver(this);
const bool was_created = render_frame_created_;
render_frame_created_ = false;
if (delegate_ && was_created)
delegate_->RenderFrameDeleted(this);
OnAudibleStateChanged(false);
GetSiteInstance()->DecrementActiveFrameCount();
if (was_created && render_view_host_->GetMainFrame() != this)
CHECK(!is_active());
GetProcess()->RemoveRoute(routing_id_);
g_routing_id_frame_map.Get().erase(
RenderFrameHostID(GetProcess()->GetID(), routing_id_));
swapout_event_monitor_timeout_.reset();
for (auto& iter : visual_state_callbacks_)
std::move(iter.second).Run(false);
if (render_widget_host_ &&
render_widget_host_->owned_by_render_frame_host()) {
render_widget_host_->ShutdownAndDestroyWidget(true);
}
frame_tree_->ReleaseRenderViewHostRef(render_view_host_);
RenderFrameHostImpl* beforeunload_initiator = GetBeforeUnloadInitiator();
if (beforeunload_initiator && beforeunload_initiator != this) {
base::TimeTicks approx_renderer_start_time = send_before_unload_start_time_;
beforeunload_initiator->ProcessBeforeUnloadACKFromFrame(
true /* proceed */, false /* treat_as_final_ack */, this,
true /* is_frame_being_destroyed */, approx_renderer_start_time,
base::TimeTicks::Now());
}
}
| 7,354 |
181,582 | 1 | ZEND_API void ZEND_FASTCALL _zend_hash_init(HashTable *ht, uint32_t nSize, dtor_func_t pDestructor, zend_bool persistent ZEND_FILE_LINE_DC)
{
GC_REFCOUNT(ht) = 1;
GC_TYPE_INFO(ht) = IS_ARRAY;
ht->u.flags = (persistent ? HASH_FLAG_PERSISTENT : 0) | HASH_FLAG_APPLY_PROTECTION | HASH_FLAG_STATIC_KEYS;
ht->nTableSize = zend_hash_check_size(nSize);
ht->nTableMask = HT_MIN_MASK;
HT_SET_DATA_ADDR(ht, &uninitialized_bucket);
ht->nNumUsed = 0;
ht->nNumOfElements = 0;
ht->nInternalPointer = HT_INVALID_IDX;
ht->nNextFreeElement = 0;
ht->pDestructor = pDestructor;
}
| 7,355 |
140,391 | 0 | void TypingCommand::deleteSelectionIfRange(const VisibleSelection& selection,
EditingState* editingState,
bool smartDelete,
bool mergeBlocksAfterDelete,
bool expandForSpecialElements,
bool sanitizeMarkup) {
if (!selection.isRange())
return;
applyCommandToComposite(DeleteSelectionCommand::create(
selection, smartDelete, mergeBlocksAfterDelete,
expandForSpecialElements, sanitizeMarkup),
editingState);
}
| 7,356 |
85,048 | 0 | static CURLcode smtp_multi_statemach(struct connectdata *conn, bool *done)
{
CURLcode result = CURLE_OK;
struct smtp_conn *smtpc = &conn->proto.smtpc;
if((conn->handler->flags & PROTOPT_SSL) && !smtpc->ssldone) {
result = Curl_ssl_connect_nonblocking(conn, FIRSTSOCKET, &smtpc->ssldone);
if(result || !smtpc->ssldone)
return result;
}
result = Curl_pp_statemach(&smtpc->pp, FALSE);
*done = (smtpc->state == SMTP_STOP) ? TRUE : FALSE;
return result;
}
| 7,357 |
33,966 | 0 | static char *msr_devnode(struct device *dev, umode_t *mode)
{
return kasprintf(GFP_KERNEL, "cpu/%u/msr", MINOR(dev->devt));
}
| 7,358 |
170,180 | 0 | void ComponentUpdaterPolicyTest::BeginTest() {
cus_ = g_browser_process->component_updater();
const auto config = component_updater::MakeChromeComponentUpdaterConfigurator(
base::CommandLine::ForCurrentProcess(), g_browser_process->local_state());
const auto urls = config->UpdateUrl();
ASSERT_TRUE(urls.size());
const GURL url = urls.front();
cur_test_case_ = std::make_pair(
&ComponentUpdaterPolicyTest::DefaultPolicy_GroupPolicySupported,
&ComponentUpdaterPolicyTest::FinishDefaultPolicy_GroupPolicySupported);
CallAsync(cur_test_case_.first);
}
| 7,359 |
73,396 | 0 | static inline const unsigned char *ReadResourceLong(const unsigned char *p,
unsigned int *quantum)
{
*quantum=(unsigned int) (*p++) << 24;
*quantum|=(unsigned int) (*p++) << 16;
*quantum|=(unsigned int) (*p++) << 8;
*quantum|=(unsigned int) (*p++) << 0;
return(p);
}
| 7,360 |
89,055 | 0 | static double TriangleThreshold(const double *histogram)
{
double
a,
b,
c,
count,
distance,
inverse_ratio,
max_distance,
segment,
x1,
x2,
y1,
y2;
register ssize_t
i;
ssize_t
end,
max,
start,
threshold;
/*
Compute optimal threshold with triangle algorithm.
*/
start=0; /* find start bin, first bin not zero count */
for (i=0; i <= (ssize_t) MaxIntensity; i++)
if (histogram[i] > 0.0)
{
start=i;
break;
}
end=0; /* find end bin, last bin not zero count */
for (i=(ssize_t) MaxIntensity; i >= 0; i--)
if (histogram[i] > 0.0)
{
end=i;
break;
}
max=0; /* find max bin, bin with largest count */
count=0.0;
for (i=0; i <= (ssize_t) MaxIntensity; i++)
if (histogram[i] > count)
{
max=i;
count=histogram[i];
}
/*
Compute threshold at split point.
*/
x1=(double) max;
y1=histogram[max];
x2=(double) end;
if ((max-start) >= (end-max))
x2=(double) start;
y2=0.0;
a=y1-y2;
b=x2-x1;
c=(-1.0)*(a*x1+b*y1);
inverse_ratio=1.0/sqrt(a*a+b*b+c*c);
threshold=0;
max_distance=0.0;
if (x2 == (double) start)
for (i=start; i < max; i++)
{
segment=inverse_ratio*(a*i+b*histogram[i]+c);
distance=sqrt(segment*segment);
if ((distance > max_distance) && (segment > 0.0))
{
threshold=i;
max_distance=distance;
}
}
else
for (i=end; i > max; i--)
{
segment=inverse_ratio*(a*i+b*histogram[i]+c);
distance=sqrt(segment*segment);
if ((distance > max_distance) && (segment < 0.0))
{
threshold=i;
max_distance=distance;
}
}
return(100.0*threshold/MaxIntensity);
}
| 7,361 |
26,608 | 0 | static int ip6_call_ra_chain(struct sk_buff *skb, int sel)
{
struct ip6_ra_chain *ra;
struct sock *last = NULL;
read_lock(&ip6_ra_lock);
for (ra = ip6_ra_chain; ra; ra = ra->next) {
struct sock *sk = ra->sk;
if (sk && ra->sel == sel &&
(!sk->sk_bound_dev_if ||
sk->sk_bound_dev_if == skb->dev->ifindex)) {
if (last) {
struct sk_buff *skb2 = skb_clone(skb, GFP_ATOMIC);
if (skb2)
rawv6_rcv(last, skb2);
}
last = sk;
}
}
if (last) {
rawv6_rcv(last, skb);
read_unlock(&ip6_ra_lock);
return 1;
}
read_unlock(&ip6_ra_lock);
return 0;
}
| 7,362 |
119,098 | 0 | void ProcessBacktrace(void *const *trace,
size_t size,
BacktraceOutputHandler* handler) {
#if defined(USE_SYMBOLIZE)
for (size_t i = 0; i < size; ++i) {
OutputFrameId(i, handler);
handler->HandleOutput(" ");
OutputPointer(trace[i], handler);
handler->HandleOutput(" ");
char buf[1024] = { '\0' };
void* address = static_cast<char*>(trace[i]) - 1;
if (google::Symbolize(address, buf, sizeof(buf)))
handler->HandleOutput(buf);
else
handler->HandleOutput("<unknown>");
handler->HandleOutput("\n");
}
#elif !defined(__UCLIBC__)
bool printed = false;
if (in_signal_handler == 0) {
scoped_ptr<char*, FreeDeleter>
trace_symbols(backtrace_symbols(trace, size));
if (trace_symbols.get()) {
for (size_t i = 0; i < size; ++i) {
std::string trace_symbol = trace_symbols.get()[i];
DemangleSymbols(&trace_symbol);
handler->HandleOutput(trace_symbol.c_str());
handler->HandleOutput("\n");
}
printed = true;
}
}
if (!printed) {
for (size_t i = 0; i < size; ++i) {
handler->HandleOutput(" [");
OutputPointer(trace[i], handler);
handler->HandleOutput("]\n");
}
}
#endif // defined(USE_SYMBOLIZE)
}
| 7,363 |
89,054 | 0 | MagickExport MagickBooleanType RangeThresholdImage(Image *image,
const double low_black,const double low_white,const double high_white,
const double high_black,ExceptionInfo *exception)
{
#define ThresholdImageTag "Threshold/Image"
CacheView
*image_view;
MagickBooleanType
status;
MagickOffsetType
progress;
ssize_t
y;
assert(image != (Image *) NULL);
assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (SetImageStorageClass(image,DirectClass,exception) == MagickFalse)
return(MagickFalse);
if (IsGrayColorspace(image->colorspace) != MagickFalse)
(void) TransformImageColorspace(image,sRGBColorspace,exception);
/*
Range threshold image.
*/
status=MagickTrue;
progress=0;
image_view=AcquireAuthenticCacheView(image,exception);
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp parallel for schedule(static) shared(progress,status) \
magick_number_threads(image,image,image->rows,1)
#endif
for (y=0; y < (ssize_t) image->rows; y++)
{
register ssize_t
x;
register Quantum
*magick_restrict q;
if (status == MagickFalse)
continue;
q=GetCacheViewAuthenticPixels(image_view,0,y,image->columns,1,exception);
if (q == (Quantum *) NULL)
{
status=MagickFalse;
continue;
}
for (x=0; x < (ssize_t) image->columns; x++)
{
double
pixel;
register ssize_t
i;
pixel=GetPixelIntensity(image,q);
for (i=0; i < (ssize_t) GetPixelChannels(image); i++)
{
PixelChannel channel = GetPixelChannelChannel(image,i);
PixelTrait traits = GetPixelChannelTraits(image,channel);
if ((traits & UpdatePixelTrait) == 0)
continue;
if (image->channel_mask != DefaultChannels)
pixel=(double) q[i];
if (pixel < low_black)
q[i]=0;
else
if ((pixel >= low_black) && (pixel < low_white))
q[i]=ClampToQuantum(QuantumRange*
PerceptibleReciprocal(low_white-low_black)*(pixel-low_black));
else
if ((pixel >= low_white) && (pixel <= high_white))
q[i]=QuantumRange;
else
if ((pixel > high_white) && (pixel <= high_black))
q[i]=ClampToQuantum(QuantumRange*PerceptibleReciprocal(
high_black-high_white)*(high_black-pixel));
else
if (pixel > high_black)
q[i]=0;
else
q[i]=0;
}
q+=GetPixelChannels(image);
}
if (SyncCacheViewAuthenticPixels(image_view,exception) == MagickFalse)
status=MagickFalse;
if (image->progress_monitor != (MagickProgressMonitor) NULL)
{
MagickBooleanType
proceed;
#if defined(MAGICKCORE_OPENMP_SUPPORT)
#pragma omp atomic
#endif
progress++;
proceed=SetImageProgress(image,ThresholdImageTag,progress,
image->rows);
if (proceed == MagickFalse)
status=MagickFalse;
}
}
image_view=DestroyCacheView(image_view);
return(status);
}
| 7,364 |
153,703 | 0 | GLuint GLES2Implementation::GetProgramResourceIndexHelper(
GLuint program,
GLenum program_interface,
const char* name) {
typedef cmds::GetProgramResourceIndex::Result Result;
SetBucketAsCString(kResultBucketId, name);
auto result = GetResultAs<Result>();
if (!result) {
return GL_INVALID_INDEX;
}
*result = GL_INVALID_INDEX;
helper_->GetProgramResourceIndex(program, program_interface, kResultBucketId,
GetResultShmId(), result.offset());
WaitForCmd();
helper_->SetBucketSize(kResultBucketId, 0);
return *result;
}
| 7,365 |
3,705 | 0 | static void lsi_update_irq(LSIState *s)
{
int level;
static int last_level;
/* It's unclear whether the DIP/SIP bits should be cleared when the
Interrupt Status Registers are cleared or when istat0 is read.
We currently do the formwer, which seems to work. */
level = 0;
if (s->dstat) {
if (s->dstat & s->dien)
level = 1;
s->istat0 |= LSI_ISTAT0_DIP;
} else {
s->istat0 &= ~LSI_ISTAT0_DIP;
}
if (s->sist0 || s->sist1) {
if ((s->sist0 & s->sien0) || (s->sist1 & s->sien1))
level = 1;
s->istat0 |= LSI_ISTAT0_SIP;
} else {
s->istat0 &= ~LSI_ISTAT0_SIP;
}
if (s->istat0 & LSI_ISTAT0_INTF)
level = 1;
if (level != last_level) {
trace_lsi_update_irq(level, s->dstat, s->sist1, s->sist0);
last_level = level;
}
lsi_set_irq(s, level);
if (!s->current && !level && lsi_irq_on_rsl(s) && !(s->scntl1 & LSI_SCNTL1_CON)) {
lsi_request *p;
trace_lsi_update_irq_disconnected();
p = get_pending_req(s);
if (p) {
lsi_reselect(s, p);
}
}
}
| 7,366 |
16,061 | 0 | Chunk::Chunk( ContainerChunk* parent, ChunkType c, XMP_Uns32 id )
{
this->hasChange = false;
this->chunkType = c; // base class assumption
this->parent = parent;
this->id = id;
this->oldSize = 0;
this->newSize = 8;
this->oldPos = 0; // inevitable for ad-hoc
this->needSizeFix = false;
if ( this->parent != NULL )
{
this->parent->children.push_back( this );
if( this->chunkType == chunk_VALUE )
this->parent->childmap.insert( std::make_pair( this->id, (ValueChunk*) this ) );
}
}
| 7,367 |
76,017 | 0 | vrrp_native_ipv6_handler(__attribute__((unused)) vector_t *strvec)
{
vrrp_t *vrrp = LIST_TAIL_DATA(vrrp_data->vrrp);
if (vrrp->family == AF_INET) {
report_config_error(CONFIG_GENERAL_ERROR,"(%s) Cannot specify native_ipv6 with IPv4 addresses", vrrp->iname);
return;
}
vrrp->family = AF_INET6;
vrrp->version = VRRP_VERSION_3;
}
| 7,368 |
147,857 | 0 | void V8TestObject::StaticNullableTestDictionaryMethodMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info) {
RUNTIME_CALL_TIMER_SCOPE_DISABLED_BY_DEFAULT(info.GetIsolate(), "Blink_TestObject_staticNullableTestDictionaryMethod");
test_object_v8_internal::StaticNullableTestDictionaryMethodMethod(info);
}
| 7,369 |
93,146 | 0 | print_smb(netdissect_options *ndo,
const u_char *buf, const u_char *maxbuf)
{
uint16_t flags2;
int nterrcodes;
int command;
uint32_t nterror;
const u_char *words, *maxwords, *data;
const struct smbfns *fn;
const char *fmt_smbheader =
"[P4]SMB Command = [B]\nError class = [BP1]\nError code = [d]\nFlags1 = [B]\nFlags2 = [B][P13]\nTree ID = [d]\nProc ID = [d]\nUID = [d]\nMID = [d]\nWord Count = [b]\n";
int smboffset;
ND_TCHECK(buf[9]);
request = (buf[9] & 0x80) ? 0 : 1;
startbuf = buf;
command = buf[4];
fn = smbfind(command, smb_fns);
if (ndo->ndo_vflag > 1)
ND_PRINT((ndo, "\n"));
ND_PRINT((ndo, "SMB PACKET: %s (%s)\n", fn->name, request ? "REQUEST" : "REPLY"));
if (ndo->ndo_vflag < 2)
return;
ND_TCHECK_16BITS(&buf[10]);
flags2 = EXTRACT_LE_16BITS(&buf[10]);
unicodestr = flags2 & 0x8000;
nterrcodes = flags2 & 0x4000;
/* print out the header */
smb_fdata(ndo, buf, fmt_smbheader, buf + 33, unicodestr);
if (nterrcodes) {
nterror = EXTRACT_LE_32BITS(&buf[5]);
if (nterror)
ND_PRINT((ndo, "NTError = %s\n", nt_errstr(nterror)));
} else {
if (buf[5])
ND_PRINT((ndo, "SMBError = %s\n", smb_errstr(buf[5], EXTRACT_LE_16BITS(&buf[7]))));
}
smboffset = 32;
for (;;) {
const char *f1, *f2;
int wct;
u_int bcc;
int newsmboffset;
words = buf + smboffset;
ND_TCHECK(words[0]);
wct = words[0];
data = words + 1 + wct * 2;
maxwords = min(data, maxbuf);
if (request) {
f1 = fn->descript.req_f1;
f2 = fn->descript.req_f2;
} else {
f1 = fn->descript.rep_f1;
f2 = fn->descript.rep_f2;
}
if (fn->descript.fn)
(*fn->descript.fn)(ndo, words, data, buf, maxbuf);
else {
if (wct) {
if (f1)
smb_fdata(ndo, words + 1, f1, words + 1 + wct * 2, unicodestr);
else {
int i;
int v;
for (i = 0; &words[1 + 2 * i] < maxwords; i++) {
ND_TCHECK2(words[1 + 2 * i], 2);
v = EXTRACT_LE_16BITS(words + 1 + 2 * i);
ND_PRINT((ndo, "smb_vwv[%d]=%d (0x%X)\n", i, v, v));
}
}
}
ND_TCHECK2(*data, 2);
bcc = EXTRACT_LE_16BITS(data);
ND_PRINT((ndo, "smb_bcc=%u\n", bcc));
if (f2) {
if (bcc > 0)
smb_fdata(ndo, data + 2, f2, data + 2 + bcc, unicodestr);
} else {
if (bcc > 0) {
ND_PRINT((ndo, "smb_buf[]=\n"));
smb_print_data(ndo, data + 2, min(bcc, PTR_DIFF(maxbuf, data + 2)));
}
}
}
if ((fn->flags & FLG_CHAIN) == 0)
break;
if (wct == 0)
break;
ND_TCHECK(words[1]);
command = words[1];
if (command == 0xFF)
break;
ND_TCHECK2(words[3], 2);
newsmboffset = EXTRACT_LE_16BITS(words + 3);
fn = smbfind(command, smb_fns);
ND_PRINT((ndo, "\nSMB PACKET: %s (%s) (CHAINED)\n",
fn->name, request ? "REQUEST" : "REPLY"));
if (newsmboffset <= smboffset) {
ND_PRINT((ndo, "Bad andX offset: %u <= %u\n", newsmboffset, smboffset));
break;
}
smboffset = newsmboffset;
}
ND_PRINT((ndo, "\n"));
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
}
| 7,370 |
27,421 | 0 | static inline int ip6_tnl_rcv_ctl(struct ip6_tnl *t)
{
struct ip6_tnl_parm *p = &t->parms;
int ret = 0;
struct net *net = dev_net(t->dev);
if (p->flags & IP6_TNL_F_CAP_RCV) {
struct net_device *ldev = NULL;
if (p->link)
ldev = dev_get_by_index_rcu(net, p->link);
if ((ipv6_addr_is_multicast(&p->laddr) ||
likely(ipv6_chk_addr(net, &p->laddr, ldev, 0))) &&
likely(!ipv6_chk_addr(net, &p->raddr, NULL, 0)))
ret = 1;
}
return ret;
}
| 7,371 |
13,108 | 0 | int qemu_fdt_setprop_sized_cells_from_array(void *fdt,
const char *node_path,
const char *property,
int numvalues,
uint64_t *values)
{
uint32_t *propcells;
uint64_t value;
int cellnum, vnum, ncells;
uint32_t hival;
int ret;
propcells = g_new0(uint32_t, numvalues * 2);
cellnum = 0;
for (vnum = 0; vnum < numvalues; vnum++) {
ncells = values[vnum * 2];
if (ncells != 1 && ncells != 2) {
ret = -1;
goto out;
}
value = values[vnum * 2 + 1];
hival = cpu_to_be32(value >> 32);
if (ncells > 1) {
propcells[cellnum++] = hival;
} else if (hival != 0) {
ret = -1;
goto out;
}
propcells[cellnum++] = cpu_to_be32(value);
}
ret = qemu_fdt_setprop(fdt, node_path, property, propcells,
cellnum * sizeof(uint32_t));
out:
g_free(propcells);
return ret;
}
| 7,372 |
185 | 0 | char * phar_compress_filter(phar_entry_info * entry, int return_unknown) /* {{{ */
{
switch (entry->flags & PHAR_ENT_COMPRESSION_MASK) {
case PHAR_ENT_COMPRESSED_GZ:
return "zlib.deflate";
case PHAR_ENT_COMPRESSED_BZ2:
return "bzip2.compress";
default:
return return_unknown ? "unknown" : NULL;
}
}
/* }}} */
| 7,373 |
186,251 | 1 | void ExtensionViewGuest::DidNavigateMainFrame(
const content::LoadCommittedDetails& details,
const content::FrameNavigateParams& params) {
if (attached() && (params.url.GetOrigin() != url_.GetOrigin())) {
bad_message::ReceivedBadMessage(web_contents()->GetRenderProcessHost(),
bad_message::EVG_BAD_ORIGIN);
}
}
| 7,374 |
30,065 | 0 | int fib6_add(struct fib6_node *root, struct rt6_info *rt, struct nl_info *info)
{
struct fib6_node *fn, *pn = NULL;
int err = -ENOMEM;
int allow_create = 1;
int replace_required = 0;
if (info->nlh) {
if (!(info->nlh->nlmsg_flags & NLM_F_CREATE))
allow_create = 0;
if (info->nlh->nlmsg_flags & NLM_F_REPLACE)
replace_required = 1;
}
if (!allow_create && !replace_required)
pr_warn("RTM_NEWROUTE with no NLM_F_CREATE or NLM_F_REPLACE\n");
fn = fib6_add_1(root, &rt->rt6i_dst.addr, sizeof(struct in6_addr),
rt->rt6i_dst.plen, offsetof(struct rt6_info, rt6i_dst),
allow_create, replace_required);
if (IS_ERR(fn)) {
err = PTR_ERR(fn);
goto out;
}
pn = fn;
#ifdef CONFIG_IPV6_SUBTREES
if (rt->rt6i_src.plen) {
struct fib6_node *sn;
if (!fn->subtree) {
struct fib6_node *sfn;
/*
* Create subtree.
*
* fn[main tree]
* |
* sfn[subtree root]
* \
* sn[new leaf node]
*/
/* Create subtree root node */
sfn = node_alloc();
if (!sfn)
goto st_failure;
sfn->leaf = info->nl_net->ipv6.ip6_null_entry;
atomic_inc(&info->nl_net->ipv6.ip6_null_entry->rt6i_ref);
sfn->fn_flags = RTN_ROOT;
sfn->fn_sernum = fib6_new_sernum();
/* Now add the first leaf node to new subtree */
sn = fib6_add_1(sfn, &rt->rt6i_src.addr,
sizeof(struct in6_addr), rt->rt6i_src.plen,
offsetof(struct rt6_info, rt6i_src),
allow_create, replace_required);
if (IS_ERR(sn)) {
/* If it is failed, discard just allocated
root, and then (in st_failure) stale node
in main tree.
*/
node_free(sfn);
err = PTR_ERR(sn);
goto st_failure;
}
/* Now link new subtree to main tree */
sfn->parent = fn;
fn->subtree = sfn;
} else {
sn = fib6_add_1(fn->subtree, &rt->rt6i_src.addr,
sizeof(struct in6_addr), rt->rt6i_src.plen,
offsetof(struct rt6_info, rt6i_src),
allow_create, replace_required);
if (IS_ERR(sn)) {
err = PTR_ERR(sn);
goto st_failure;
}
}
if (!fn->leaf) {
fn->leaf = rt;
atomic_inc(&rt->rt6i_ref);
}
fn = sn;
}
#endif
err = fib6_add_rt2node(fn, rt, info);
if (!err) {
fib6_start_gc(info->nl_net, rt);
if (!(rt->rt6i_flags & RTF_CACHE))
fib6_prune_clones(info->nl_net, pn, rt);
}
out:
if (err) {
#ifdef CONFIG_IPV6_SUBTREES
/*
* If fib6_add_1 has cleared the old leaf pointer in the
* super-tree leaf node we have to find a new one for it.
*/
if (pn != fn && pn->leaf == rt) {
pn->leaf = NULL;
atomic_dec(&rt->rt6i_ref);
}
if (pn != fn && !pn->leaf && !(pn->fn_flags & RTN_RTINFO)) {
pn->leaf = fib6_find_prefix(info->nl_net, pn);
#if RT6_DEBUG >= 2
if (!pn->leaf) {
WARN_ON(pn->leaf == NULL);
pn->leaf = info->nl_net->ipv6.ip6_null_entry;
}
#endif
atomic_inc(&pn->leaf->rt6i_ref);
}
#endif
dst_free(&rt->dst);
}
return err;
#ifdef CONFIG_IPV6_SUBTREES
/* Subtree creation failed, probably main tree node
is orphan. If it is, shoot it.
*/
st_failure:
if (fn && !(fn->fn_flags & (RTN_RTINFO|RTN_ROOT)))
fib6_repair_tree(info->nl_net, fn);
dst_free(&rt->dst);
return err;
#endif
}
| 7,375 |
9,107 | 0 | static int vrend_decode_draw_vbo(struct vrend_decode_ctx *ctx, int length)
{
struct pipe_draw_info info;
uint32_t cso;
if (length != VIRGL_DRAW_VBO_SIZE)
return EINVAL;
memset(&info, 0, sizeof(struct pipe_draw_info));
info.start = get_buf_entry(ctx, VIRGL_DRAW_VBO_START);
info.count = get_buf_entry(ctx, VIRGL_DRAW_VBO_COUNT);
info.mode = get_buf_entry(ctx, VIRGL_DRAW_VBO_MODE);
info.indexed = get_buf_entry(ctx, VIRGL_DRAW_VBO_INDEXED);
info.instance_count = get_buf_entry(ctx, VIRGL_DRAW_VBO_INSTANCE_COUNT);
info.index_bias = get_buf_entry(ctx, VIRGL_DRAW_VBO_INDEX_BIAS);
info.start_instance = get_buf_entry(ctx, VIRGL_DRAW_VBO_START_INSTANCE);
info.primitive_restart = get_buf_entry(ctx, VIRGL_DRAW_VBO_PRIMITIVE_RESTART);
info.restart_index = get_buf_entry(ctx, VIRGL_DRAW_VBO_RESTART_INDEX);
info.min_index = get_buf_entry(ctx, VIRGL_DRAW_VBO_MIN_INDEX);
info.max_index = get_buf_entry(ctx, VIRGL_DRAW_VBO_MAX_INDEX);
cso = get_buf_entry(ctx, VIRGL_DRAW_VBO_COUNT_FROM_SO);
vrend_draw_vbo(ctx->grctx, &info, cso);
return 0;
}
| 7,376 |
39,192 | 0 | nfs_scan_commit(struct inode *inode, struct list_head *dst,
struct nfs_commit_info *cinfo)
{
int ret = 0;
spin_lock(cinfo->lock);
if (cinfo->mds->ncommit > 0) {
const int max = INT_MAX;
ret = nfs_scan_commit_list(&cinfo->mds->list, dst,
cinfo, max);
ret += pnfs_scan_commit_lists(inode, cinfo, max - ret);
}
spin_unlock(cinfo->lock);
return ret;
}
| 7,377 |
106,242 | 0 | void setJSTestObjWithScriptExecutionContextAndScriptStateAttribute(ExecState* exec, JSObject* thisObject, JSValue value)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject);
TestObj* impl = static_cast<TestObj*>(castedThis->impl());
ScriptExecutionContext* scriptContext = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject())->scriptExecutionContext();
if (!scriptContext)
return;
impl->setWithScriptExecutionContextAndScriptStateAttribute(exec, scriptContext, toTestObj(value));
}
| 7,378 |
106,093 | 0 | JSValue jsTestObjCONST_VALUE_10(ExecState* exec, JSValue, const Identifier&)
{
return jsStringOrNull(exec, String("my constant string"));
}
| 7,379 |
172,272 | 0 | static jboolean android_net_wifi_setPnoListNative(
JNIEnv *env, jclass cls, jint iface, jint id, jobject list) {
JNIHelper helper(env);
wifi_epno_handler handler;
handler.on_network_found = &onPnoNetworkFound;
wifi_interface_handle handle = getIfaceHandle(helper, cls, iface);
ALOGD("configure ePno list request [%d] = %p", id, handle);
if (list == NULL) {
int result = hal_fn.wifi_set_epno_list(id, handle, 0, NULL, handler);
ALOGE(" setPnoListNative: STOP result = %d", result);
return result >= 0;
}
wifi_epno_network net_list[MAX_PNO_SSID];
memset(&net_list, 0, sizeof(net_list));
size_t len = helper.getArrayLength((jobjectArray)list);
if (len > (size_t)MAX_PNO_SSID) {
return false;
}
for (unsigned int i = 0; i < len; i++) {
JNIObject<jobject> pno_net = helper.getObjectArrayElement((jobjectArray)list, i);
if (pno_net == NULL) {
ALOGD("setPnoListNative: could not get element %d", i);
continue;
}
JNIObject<jstring> sssid = helper.getStringField(pno_net, "SSID");
if (sssid == NULL) {
ALOGE("Error setPnoListNative: getting ssid field");
return false;
}
ScopedUtfChars chars(env, (jstring)sssid.get());
const char *ssid = chars.c_str();
if (ssid == NULL) {
ALOGE("Error setPnoListNative: getting ssid");
return false;
}
int ssid_len = strnlen((const char*)ssid, 33);
if (ssid_len > 32) {
ALOGE("Error setPnoListNative: long ssid %u", strnlen((const char*)ssid, 256));
return false;
}
if (ssid_len > 1 && ssid[0] == '"' && ssid[ssid_len-1])
{
ssid++;
ssid_len-=2;
}
if (ssid_len == 0) {
ALOGE("Error setPnoListNative: zero length ssid, skip it");
continue;
}
memcpy(net_list[i].ssid, ssid, ssid_len);
int rssit = helper.getIntField(pno_net, "rssi_threshold");
net_list[i].rssi_threshold = (byte)rssit;
int a = helper.getIntField(pno_net, "auth");
net_list[i].auth_bit_field = a;
int f = helper.getIntField(pno_net, "flags");
net_list[i].flags = f;
ALOGE(" setPnoListNative: idx %u rssi %d/%d auth %x/%x flags %x/%x [%s]", i,
(signed)net_list[i].rssi_threshold, net_list[i].rssi_threshold,
net_list[i].auth_bit_field, a, net_list[i].flags, f, net_list[i].ssid);
}
int result = hal_fn.wifi_set_epno_list(id, handle, len, net_list, handler);
ALOGE(" setPnoListNative: result %d", result);
return result >= 0;
}
| 7,380 |
94,264 | 0 | static enum test_return test_binary_incr_impl(const char* key, uint8_t cmd) {
union {
protocol_binary_request_no_extras request;
protocol_binary_response_no_extras response_header;
protocol_binary_response_incr response;
char bytes[1024];
} send, receive;
size_t len = arithmetic_command(send.bytes, sizeof(send.bytes), cmd,
key, strlen(key), 1, 0, 0);
int ii;
for (ii = 0; ii < 10; ++ii) {
safe_send(send.bytes, len, false);
if (cmd == PROTOCOL_BINARY_CMD_INCREMENT) {
safe_recv_packet(receive.bytes, sizeof(receive.bytes));
validate_response_header(&receive.response_header, cmd,
PROTOCOL_BINARY_RESPONSE_SUCCESS);
assert(ntohll(receive.response.message.body.value) == ii);
}
}
if (cmd == PROTOCOL_BINARY_CMD_INCREMENTQ) {
test_binary_noop();
}
return TEST_PASS;
}
| 7,381 |
133,053 | 0 | void RenderWidgetHostViewAura::UpdateExternalTexture() {
if (accelerated_compositing_state_changed_)
accelerated_compositing_state_changed_ = false;
bool is_compositing_active = host_->is_accelerated_compositing_active();
if (is_compositing_active && current_surface_.get()) {
window_->layer()->SetExternalTexture(current_surface_.get());
current_frame_size_ = ConvertSizeToDIP(
current_surface_->device_scale_factor(), current_surface_->size());
CheckResizeLock();
software_frame_manager_->DiscardCurrentFrame();
} else if (is_compositing_active &&
software_frame_manager_->HasCurrentFrame()) {
cc::TextureMailbox mailbox;
scoped_ptr<cc::SingleReleaseCallback> callback;
software_frame_manager_->GetCurrentFrameMailbox(&mailbox, &callback);
window_->layer()->SetTextureMailbox(mailbox,
callback.Pass(),
last_swapped_surface_scale_factor_);
current_frame_size_ = ConvertSizeToDIP(last_swapped_surface_scale_factor_,
mailbox.shared_memory_size());
CheckResizeLock();
} else {
window_->layer()->SetShowPaintedContent();
resize_lock_.reset();
host_->WasResized();
software_frame_manager_->DiscardCurrentFrame();
}
}
| 7,382 |
185,491 | 1 | bool CanRendererHandleEvent(const ui::MouseEvent* event) {
if (event->type() == ui::ET_MOUSE_CAPTURE_CHANGED)
return false;
#if defined(OS_WIN)
switch (event->native_event().message) {
case WM_XBUTTONDOWN:
case WM_XBUTTONUP:
case WM_XBUTTONDBLCLK:
case WM_NCMOUSELEAVE:
case WM_NCMOUSEMOVE:
case WM_NCXBUTTONDOWN:
case WM_NCXBUTTONUP:
case WM_NCXBUTTONDBLCLK:
return false;
default:
break;
}
#endif
return true;
}
| 7,383 |
7,142 | 0 | cf2_glyphpath_moveTo( CF2_GlyphPath glyphpath,
CF2_Fixed x,
CF2_Fixed y )
{
cf2_glyphpath_closeOpenPath( glyphpath );
/* save the parameters of the move for later, when we'll know how to */
/* offset it; */
/* also save last move point */
glyphpath->currentCS.x = glyphpath->start.x = x;
glyphpath->currentCS.y = glyphpath->start.y = y;
glyphpath->moveIsPending = TRUE;
/* ensure we have a valid map with current mask */
if ( !cf2_hintmap_isValid( &glyphpath->hintMap ) ||
cf2_hintmask_isNew( glyphpath->hintMask ) )
cf2_hintmap_build( &glyphpath->hintMap,
glyphpath->hStemHintArray,
glyphpath->vStemHintArray,
glyphpath->hintMask,
glyphpath->hintOriginY,
FALSE );
/* save a copy of current HintMap to use when drawing initial point */
glyphpath->firstHintMap = glyphpath->hintMap; /* structure copy */
}
| 7,384 |
41,285 | 0 | static int comedi_mmap(struct file *file, struct vm_area_struct *vma)
{
const unsigned minor = iminor(file->f_dentry->d_inode);
struct comedi_device_file_info *dev_file_info =
comedi_get_device_file_info(minor);
struct comedi_device *dev = dev_file_info->device;
struct comedi_async *async = NULL;
unsigned long start = vma->vm_start;
unsigned long size;
int n_pages;
int i;
int retval;
struct comedi_subdevice *s;
mutex_lock(&dev->mutex);
if (!dev->attached) {
DPRINTK("no driver configured on comedi%i\n", dev->minor);
retval = -ENODEV;
goto done;
}
if (vma->vm_flags & VM_WRITE)
s = comedi_get_write_subdevice(dev_file_info);
else
s = comedi_get_read_subdevice(dev_file_info);
if (s == NULL) {
retval = -EINVAL;
goto done;
}
async = s->async;
if (async == NULL) {
retval = -EINVAL;
goto done;
}
if (vma->vm_pgoff != 0) {
DPRINTK("comedi: mmap() offset must be 0.\n");
retval = -EINVAL;
goto done;
}
size = vma->vm_end - vma->vm_start;
if (size > async->prealloc_bufsz) {
retval = -EFAULT;
goto done;
}
if (size & (~PAGE_MASK)) {
retval = -EFAULT;
goto done;
}
n_pages = size >> PAGE_SHIFT;
for (i = 0; i < n_pages; ++i) {
if (remap_pfn_range(vma, start,
page_to_pfn(virt_to_page
(async->buf_page_list
[i].virt_addr)), PAGE_SIZE,
PAGE_SHARED)) {
retval = -EAGAIN;
goto done;
}
start += PAGE_SIZE;
}
vma->vm_ops = &comedi_vm_ops;
vma->vm_private_data = async;
async->mmap_count++;
retval = 0;
done:
mutex_unlock(&dev->mutex);
return retval;
}
| 7,385 |
51,991 | 0 | SpoolssSetPrinter_q(tvbuff_t *tvb, int offset, packet_info *pinfo,
proto_tree *tree, dcerpc_info *di, guint8 *drep _U_)
{
guint32 level;
/* Parse packet */
offset = dissect_nt_policy_hnd(
tvb, offset, pinfo, tree, di, drep, hf_hnd, NULL, NULL,
FALSE, FALSE);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, tree, di, drep, hf_level, &level);
col_append_fstr(pinfo->cinfo, COL_INFO, ", level %d", level);
offset = dissect_SPOOL_PRINTER_INFO(
tvb, offset, pinfo, tree, di, drep);
offset = dissect_ndr_uint32(
tvb, offset, pinfo, tree, di, drep,
hf_setprinter_cmd, NULL);
return offset;
}
| 7,386 |
129,042 | 0 | void writeRegExp(v8::Local<v8::String> pattern, v8::RegExp::Flags flags)
{
append(RegExpTag);
v8::String::Utf8Value patternUtf8Value(pattern);
doWriteString(*patternUtf8Value, patternUtf8Value.length());
doWriteUint32(static_cast<uint32_t>(flags));
}
| 7,387 |
145,878 | 0 | std::unique_ptr<views::Widget> CreateWindowWidget(const gfx::Rect& bounds) {
std::unique_ptr<views::Widget> widget(new views::Widget);
views::Widget::InitParams params;
params.bounds = bounds;
params.type = views::Widget::InitParams::TYPE_WINDOW;
params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
widget->Init(params);
widget->Show();
aura::Window* window = widget->GetNativeWindow();
window->SetProperty(aura::client::kTopViewInset, kHeaderHeight);
ParentWindowInPrimaryRootWindow(window);
return widget;
}
| 7,388 |
187,775 | 1 | omx_vdec::omx_vdec(): m_error_propogated(false),
m_state(OMX_StateInvalid),
m_app_data(NULL),
m_inp_mem_ptr(NULL),
m_out_mem_ptr(NULL),
input_flush_progress (false),
output_flush_progress (false),
input_use_buffer (false),
output_use_buffer (false),
ouput_egl_buffers(false),
m_use_output_pmem(OMX_FALSE),
m_out_mem_region_smi(OMX_FALSE),
m_out_pvt_entry_pmem(OMX_FALSE),
pending_input_buffers(0),
pending_output_buffers(0),
m_out_bm_count(0),
m_inp_bm_count(0),
m_inp_bPopulated(OMX_FALSE),
m_out_bPopulated(OMX_FALSE),
m_flags(0),
#ifdef _ANDROID_
m_heap_ptr(NULL),
#endif
m_inp_bEnabled(OMX_TRUE),
m_out_bEnabled(OMX_TRUE),
m_in_alloc_cnt(0),
m_platform_list(NULL),
m_platform_entry(NULL),
m_pmem_info(NULL),
h264_parser(NULL),
arbitrary_bytes (true),
psource_frame (NULL),
pdest_frame (NULL),
m_inp_heap_ptr (NULL),
m_phdr_pmem_ptr(NULL),
m_heap_inp_bm_count (0),
codec_type_parse ((codec_type)0),
first_frame_meta (true),
frame_count (0),
nal_count (0),
nal_length(0),
look_ahead_nal (false),
first_frame(0),
first_buffer(NULL),
first_frame_size (0),
m_device_file_ptr(NULL),
m_vc1_profile((vc1_profile_type)0),
h264_last_au_ts(LLONG_MAX),
h264_last_au_flags(0),
m_disp_hor_size(0),
m_disp_vert_size(0),
prev_ts(LLONG_MAX),
rst_prev_ts(true),
frm_int(0),
in_reconfig(false),
m_display_id(NULL),
client_extradata(0),
m_reject_avc_1080p_mp (0),
#ifdef _ANDROID_
m_enable_android_native_buffers(OMX_FALSE),
m_use_android_native_buffers(OMX_FALSE),
iDivXDrmDecrypt(NULL),
#endif
m_desc_buffer_ptr(NULL),
secure_mode(false),
m_other_extradata(NULL),
m_profile(0),
client_set_fps(false),
m_last_rendered_TS(-1),
m_queued_codec_config_count(0),
secure_scaling_to_non_secure_opb(false)
{
/* Assumption is that , to begin with , we have all the frames with decoder */
DEBUG_PRINT_HIGH("In %u bit OMX vdec Constructor", (unsigned int)sizeof(long) * 8);
memset(&m_debug,0,sizeof(m_debug));
#ifdef _ANDROID_
char property_value[PROPERTY_VALUE_MAX] = {0};
property_get("vidc.debug.level", property_value, "1");
debug_level = atoi(property_value);
property_value[0] = '\0';
DEBUG_PRINT_HIGH("In OMX vdec Constructor");
property_get("vidc.dec.debug.perf", property_value, "0");
perf_flag = atoi(property_value);
if (perf_flag) {
DEBUG_PRINT_HIGH("vidc.dec.debug.perf is %d", perf_flag);
dec_time.start();
proc_frms = latency = 0;
}
prev_n_filled_len = 0;
property_value[0] = '\0';
property_get("vidc.dec.debug.ts", property_value, "0");
m_debug_timestamp = atoi(property_value);
DEBUG_PRINT_HIGH("vidc.dec.debug.ts value is %d",m_debug_timestamp);
if (m_debug_timestamp) {
time_stamp_dts.set_timestamp_reorder_mode(true);
time_stamp_dts.enable_debug_print(true);
}
property_value[0] = '\0';
property_get("vidc.dec.debug.concealedmb", property_value, "0");
m_debug_concealedmb = atoi(property_value);
DEBUG_PRINT_HIGH("vidc.dec.debug.concealedmb value is %d",m_debug_concealedmb);
property_value[0] = '\0';
property_get("vidc.dec.profile.check", property_value, "0");
m_reject_avc_1080p_mp = atoi(property_value);
DEBUG_PRINT_HIGH("vidc.dec.profile.check value is %d",m_reject_avc_1080p_mp);
property_value[0] = '\0';
property_get("vidc.dec.log.in", property_value, "0");
m_debug.in_buffer_log = atoi(property_value);
property_value[0] = '\0';
property_get("vidc.dec.log.out", property_value, "0");
m_debug.out_buffer_log = atoi(property_value);
sprintf(m_debug.log_loc, "%s", BUFFER_LOG_LOC);
property_value[0] = '\0';
property_get("vidc.log.loc", property_value, "");
if (*property_value)
strlcpy(m_debug.log_loc, property_value, PROPERTY_VALUE_MAX);
property_value[0] = '\0';
property_get("vidc.dec.120fps.enabled", property_value, "0");
if(atoi(property_value)) {
DEBUG_PRINT_LOW("feature 120 FPS decode enabled");
m_last_rendered_TS = 0;
}
property_value[0] = '\0';
property_get("vidc.dec.debug.dyn.disabled", property_value, "0");
m_disable_dynamic_buf_mode = atoi(property_value);
DEBUG_PRINT_HIGH("vidc.dec.debug.dyn.disabled value is %d",m_disable_dynamic_buf_mode);
#endif
memset(&m_cmp,0,sizeof(m_cmp));
memset(&m_cb,0,sizeof(m_cb));
memset (&drv_ctx,0,sizeof(drv_ctx));
memset (&h264_scratch,0,sizeof (OMX_BUFFERHEADERTYPE));
memset (m_hwdevice_name,0,sizeof(m_hwdevice_name));
memset(m_demux_offsets, 0, ( sizeof(OMX_U32) * 8192) );
memset(&m_custom_buffersize, 0, sizeof(m_custom_buffersize));
m_demux_entries = 0;
msg_thread_id = 0;
async_thread_id = 0;
msg_thread_created = false;
async_thread_created = false;
#ifdef _ANDROID_ICS_
memset(&native_buffer, 0 ,(sizeof(struct nativebuffer) * MAX_NUM_INPUT_OUTPUT_BUFFERS));
#endif
memset(&drv_ctx.extradata_info, 0, sizeof(drv_ctx.extradata_info));
/* invalidate m_frame_pack_arrangement */
memset(&m_frame_pack_arrangement, 0, sizeof(OMX_QCOM_FRAME_PACK_ARRANGEMENT));
m_frame_pack_arrangement.cancel_flag = 1;
drv_ctx.timestamp_adjust = false;
drv_ctx.video_driver_fd = -1;
m_vendor_config.pData = NULL;
pthread_mutex_init(&m_lock, NULL);
pthread_mutex_init(&c_lock, NULL);
sem_init(&m_cmd_lock,0,0);
sem_init(&m_safe_flush, 0, 0);
streaming[CAPTURE_PORT] =
streaming[OUTPUT_PORT] = false;
#ifdef _ANDROID_
char extradata_value[PROPERTY_VALUE_MAX] = {0};
property_get("vidc.dec.debug.extradata", extradata_value, "0");
m_debug_extradata = atoi(extradata_value);
DEBUG_PRINT_HIGH("vidc.dec.debug.extradata value is %d",m_debug_extradata);
#endif
m_fill_output_msg = OMX_COMPONENT_GENERATE_FTB;
client_buffers.set_vdec_client(this);
dynamic_buf_mode = false;
out_dynamic_list = NULL;
is_down_scalar_enabled = false;
m_smoothstreaming_mode = false;
m_smoothstreaming_width = 0;
m_smoothstreaming_height = 0;
is_q6_platform = false;
}
| 7,389 |
91,713 | 0 | am_get_service_url(request_rec *r, LassoProfile *profile, char *service_name)
{
LassoProvider *provider;
gchar *url;
provider = lasso_server_get_provider(profile->server,
profile->remote_providerID);
if (LASSO_IS_PROVIDER(provider) == FALSE) {
AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r,
"Cannot find provider service %s, no provider.",
service_name);
return NULL;
}
url = lasso_provider_get_metadata_one(provider, service_name);
if (url == NULL) {
AM_LOG_RERROR(APLOG_MARK, APLOG_WARNING, 0, r,
"Cannot find provider service %s from metadata.",
service_name);
return NULL;
}
return url;
}
| 7,390 |
67,399 | 0 | static int debugfs_parse_options(char *data, struct debugfs_mount_opts *opts)
{
substring_t args[MAX_OPT_ARGS];
int option;
int token;
kuid_t uid;
kgid_t gid;
char *p;
opts->mode = DEBUGFS_DEFAULT_MODE;
while ((p = strsep(&data, ",")) != NULL) {
if (!*p)
continue;
token = match_token(p, tokens, args);
switch (token) {
case Opt_uid:
if (match_int(&args[0], &option))
return -EINVAL;
uid = make_kuid(current_user_ns(), option);
if (!uid_valid(uid))
return -EINVAL;
opts->uid = uid;
break;
case Opt_gid:
if (match_int(&args[0], &option))
return -EINVAL;
gid = make_kgid(current_user_ns(), option);
if (!gid_valid(gid))
return -EINVAL;
opts->gid = gid;
break;
case Opt_mode:
if (match_octal(&args[0], &option))
return -EINVAL;
opts->mode = option & S_IALLUGO;
break;
/*
* We might like to report bad mount options here;
* but traditionally debugfs has ignored all mount options
*/
}
}
return 0;
}
| 7,391 |
130,890 | 0 | static void methodWithUnsignedLongSequenceMethodCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
{
TRACE_EVENT_SET_SAMPLING_STATE("Blink", "DOMMethod");
TestObjectV8Internal::methodWithUnsignedLongSequenceMethod(info);
TRACE_EVENT_SET_SAMPLING_STATE("V8", "V8Execution");
}
| 7,392 |
49,962 | 0 | size_t php_mysqlnd_sha256_pk_request_write(void * _packet, MYSQLND_CONN_DATA * conn TSRMLS_DC)
{
zend_uchar buffer[MYSQLND_HEADER_SIZE + 1];
size_t sent;
DBG_ENTER("php_mysqlnd_sha256_pk_request_write");
int1store(buffer + MYSQLND_HEADER_SIZE, '\1');
sent = conn->net->data->m.send_ex(conn->net, buffer, 1, conn->stats, conn->error_info TSRMLS_CC);
DBG_RETURN(sent);
}
| 7,393 |
4,564 | 0 | static int php_openssl_make_REQ(struct php_x509_request * req, X509_REQ * csr, zval * dn, zval * attribs)
{
STACK_OF(CONF_VALUE) * dn_sk, *attr_sk = NULL;
char * str, *dn_sect, *attr_sect;
dn_sect = CONF_get_string(req->req_config, req->section_name, "distinguished_name");
if (dn_sect == NULL) {
return FAILURE;
}
dn_sk = CONF_get_section(req->req_config, dn_sect);
if (dn_sk == NULL) {
return FAILURE;
}
attr_sect = CONF_get_string(req->req_config, req->section_name, "attributes");
if (attr_sect == NULL) {
attr_sk = NULL;
} else {
attr_sk = CONF_get_section(req->req_config, attr_sect);
if (attr_sk == NULL) {
return FAILURE;
}
}
/* setup the version number: version 1 */
if (X509_REQ_set_version(csr, 0L)) {
int i, nid;
char * type;
CONF_VALUE * v;
X509_NAME * subj;
zval * item;
zend_string * strindex = NULL;
subj = X509_REQ_get_subject_name(csr);
/* apply values from the dn hash */
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(dn), strindex, item) {
if (strindex) {
int nid;
convert_to_string_ex(item);
nid = OBJ_txt2nid(ZSTR_VAL(strindex));
if (nid != NID_undef) {
if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_UTF8,
(unsigned char*)Z_STRVAL_P(item), -1, -1, 0))
{
php_error_docref(NULL, E_WARNING,
"dn: add_entry_by_NID %d -> %s (failed; check error"
" queue and value of string_mask OpenSSL option "
"if illegal characters are reported)",
nid, Z_STRVAL_P(item));
return FAILURE;
}
} else {
php_error_docref(NULL, E_WARNING, "dn: %s is not a recognized name", ZSTR_VAL(strindex));
}
}
} ZEND_HASH_FOREACH_END();
/* Finally apply defaults from config file */
for(i = 0; i < sk_CONF_VALUE_num(dn_sk); i++) {
int len;
char buffer[200 + 1]; /*200 + \0 !*/
v = sk_CONF_VALUE_value(dn_sk, i);
type = v->name;
len = (int)strlen(type);
if (len < sizeof("_default")) {
continue;
}
len -= sizeof("_default") - 1;
if (strcmp("_default", type + len) != 0) {
continue;
}
if (len > 200) {
len = 200;
}
memcpy(buffer, type, len);
buffer[len] = '\0';
type = buffer;
/* Skip past any leading X. X: X, etc to allow for multiple
* instances */
for (str = type; *str; str++) {
if (*str == ':' || *str == ',' || *str == '.') {
str++;
if (*str) {
type = str;
}
break;
}
}
/* if it is already set, skip this */
nid = OBJ_txt2nid(type);
if (X509_NAME_get_index_by_NID(subj, nid, -1) >= 0) {
continue;
}
if (!X509_NAME_add_entry_by_txt(subj, type, MBSTRING_UTF8, (unsigned char*)v->value, -1, -1, 0)) {
php_error_docref(NULL, E_WARNING, "add_entry_by_txt %s -> %s (failed)", type, v->value);
return FAILURE;
}
if (!X509_NAME_entry_count(subj)) {
php_error_docref(NULL, E_WARNING, "no objects specified in config file");
return FAILURE;
}
}
if (attribs) {
ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(attribs), strindex, item) {
int nid;
if (NULL == strindex) {
php_error_docref(NULL, E_WARNING, "dn: numeric fild names are not supported");
continue;
}
convert_to_string_ex(item);
nid = OBJ_txt2nid(ZSTR_VAL(strindex));
if (nid != NID_undef) {
if (!X509_NAME_add_entry_by_NID(subj, nid, MBSTRING_UTF8, (unsigned char*)Z_STRVAL_P(item), -1, -1, 0)) {
php_error_docref(NULL, E_WARNING, "attribs: add_entry_by_NID %d -> %s (failed)", nid, Z_STRVAL_P(item));
return FAILURE;
}
} else {
php_error_docref(NULL, E_WARNING, "dn: %s is not a recognized name", ZSTR_VAL(strindex));
}
} ZEND_HASH_FOREACH_END();
for (i = 0; i < sk_CONF_VALUE_num(attr_sk); i++) {
v = sk_CONF_VALUE_value(attr_sk, i);
/* if it is already set, skip this */
nid = OBJ_txt2nid(v->name);
if (X509_REQ_get_attr_by_NID(csr, nid, -1) >= 0) {
continue;
}
if (!X509_REQ_add1_attr_by_txt(csr, v->name, MBSTRING_UTF8, (unsigned char*)v->value, -1)) {
php_error_docref(NULL, E_WARNING,
"add1_attr_by_txt %s -> %s (failed; check error queue "
"and value of string_mask OpenSSL option if illegal "
"characters are reported)",
v->name, v->value);
return FAILURE;
}
}
}
}
X509_REQ_set_pubkey(csr, req->priv_key);
return SUCCESS;
}
| 7,394 |
121,855 | 0 | SystemURLRequestContextGetter::GetNetworkTaskRunner() const {
return network_task_runner_;
}
| 7,395 |
33,144 | 0 | static int xfrm_dump_policy_done(struct netlink_callback *cb)
{
struct xfrm_policy_walk *walk = (struct xfrm_policy_walk *) &cb->args[1];
xfrm_policy_walk_done(walk);
return 0;
}
| 7,396 |
14,711 | 0 | void JBIG2Stream::readPageInfoSeg(Guint length) {
Guint xRes, yRes, flags, striping;
if (!readULong(&pageW) || !readULong(&pageH) ||
!readULong(&xRes) || !readULong(&yRes) ||
!readUByte(&flags) || !readUWord(&striping)) {
goto eofError;
}
pageDefPixel = (flags >> 2) & 1;
defCombOp = (flags >> 3) & 3;
if (pageH == 0xffffffff) {
curPageH = striping & 0x7fff;
} else {
curPageH = pageH;
}
pageBitmap = new JBIG2Bitmap(0, pageW, curPageH);
if (!pageBitmap->isOk()) {
delete pageBitmap;
pageBitmap = NULL;
return;
}
if (pageDefPixel) {
pageBitmap->clearToOne();
} else {
pageBitmap->clearToZero();
}
return;
eofError:
error(errSyntaxError, curStr->getPos(), "Unexpected EOF in JBIG2 stream");
}
| 7,397 |
52,561 | 0 | static int handle_headers_frame(h2o_http2_conn_t *conn, h2o_http2_frame_t *frame, const char **err_desc)
{
h2o_http2_headers_payload_t payload;
h2o_http2_stream_t *stream;
int ret;
/* decode */
if ((ret = h2o_http2_decode_headers_payload(&payload, frame, err_desc)) != 0)
return ret;
if ((frame->stream_id & 1) == 0) {
*err_desc = "invalid stream id in HEADERS frame";
return H2O_HTTP2_ERROR_PROTOCOL;
}
if (!(conn->pull_stream_ids.max_open < frame->stream_id)) {
if ((stream = h2o_http2_conn_get_stream(conn, frame->stream_id)) != NULL &&
stream->state == H2O_HTTP2_STREAM_STATE_RECV_BODY) {
/* is a trailer */
if ((frame->flags & H2O_HTTP2_FRAME_FLAG_END_STREAM) == 0) {
*err_desc = "trailing HEADERS frame MUST have END_STREAM flag set";
return H2O_HTTP2_ERROR_PROTOCOL;
}
stream->req.entity = h2o_iovec_init(stream->_req_body->bytes, stream->_req_body->size);
if ((frame->flags & H2O_HTTP2_FRAME_FLAG_END_HEADERS) == 0)
goto PREPARE_FOR_CONTINUATION;
return handle_trailing_headers(conn, stream, payload.headers, payload.headers_len, err_desc);
}
*err_desc = "invalid stream id in HEADERS frame";
return H2O_HTTP2_ERROR_STREAM_CLOSED;
}
if (frame->stream_id == payload.priority.dependency) {
*err_desc = "stream cannot depend on itself";
return H2O_HTTP2_ERROR_PROTOCOL;
}
if (conn->state >= H2O_HTTP2_CONN_STATE_HALF_CLOSED)
return 0;
/* open or determine the stream and prepare */
if ((stream = h2o_http2_conn_get_stream(conn, frame->stream_id)) != NULL) {
if ((frame->flags & H2O_HTTP2_FRAME_FLAG_PRIORITY) != 0)
set_priority(conn, stream, &payload.priority, 1);
} else {
stream = h2o_http2_stream_open(conn, frame->stream_id, NULL);
set_priority(conn, stream, &payload.priority, 0);
}
h2o_http2_stream_prepare_for_request(conn, stream);
/* setup container for request body if it is expected to arrive */
if ((frame->flags & H2O_HTTP2_FRAME_FLAG_END_STREAM) == 0)
h2o_buffer_init(&stream->_req_body, &h2o_socket_buffer_prototype);
if ((frame->flags & H2O_HTTP2_FRAME_FLAG_END_HEADERS) != 0) {
/* request is complete, handle it */
return handle_incoming_request(conn, stream, payload.headers, payload.headers_len, err_desc);
}
PREPARE_FOR_CONTINUATION:
/* request is not complete, store in buffer */
conn->_read_expect = expect_continuation_of_headers;
h2o_buffer_init(&conn->_headers_unparsed, &h2o_socket_buffer_prototype);
h2o_buffer_reserve(&conn->_headers_unparsed, payload.headers_len);
memcpy(conn->_headers_unparsed->bytes, payload.headers, payload.headers_len);
conn->_headers_unparsed->size = payload.headers_len;
return 0;
}
| 7,398 |
74,948 | 0 | next_field(const char **p, const char **start,
const char **end, char *sep)
{
/* Skip leading whitespace to find start of field. */
while (**p == ' ' || **p == '\t' || **p == '\n') {
(*p)++;
}
*start = *p;
/* Scan for the separator. */
while (**p != '\0' && **p != ',' && **p != ':' && **p != '\n' &&
**p != '#') {
(*p)++;
}
*sep = **p;
/* Locate end of field, trim trailing whitespace if necessary */
if (*p == *start) {
*end = *p;
} else {
*end = *p - 1;
while (**end == ' ' || **end == '\t' || **end == '\n') {
(*end)--;
}
(*end)++;
}
/* Handle in-field comments */
if (*sep == '#') {
while (**p != '\0' && **p != ',' && **p != '\n') {
(*p)++;
}
*sep = **p;
}
/* Adjust scanner location. */
if (**p != '\0')
(*p)++;
}
| 7,399 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.