idx
int64
func
string
target
int64
457,470
int ring_buffer_print_entry_header(struct trace_seq *s) { trace_seq_puts(s, "# compressed entry header\n"); trace_seq_puts(s, "\ttype_len : 5 bits\n"); trace_seq_puts(s, "\ttime_delta : 27 bits\n"); trace_seq_puts(s, "\tarray : 32 bits\n"); trace_seq_putc(s, '\n'); trace_seq_printf(s, "\tpadding : type == %d\n", RINGBUF_TYPE_PADDING); trace_seq_printf(s, "\ttime_extend : type == %d\n", RINGBUF_TYPE_TIME_EXTEND); trace_seq_printf(s, "\ttime_stamp : type == %d\n", RINGBUF_TYPE_TIME_STAMP); trace_seq_printf(s, "\tdata max type_len == %d\n", RINGBUF_TYPE_DATA_TYPE_LEN_MAX); return !trace_seq_has_overflowed(s); }
0
208,334
void OmniboxViewViews::OnFocus() { views::Textfield::OnFocus(); model()->OnSetFocus(false); if (saved_selection_for_focus_change_.IsValid()) { SelectRange(saved_selection_for_focus_change_); saved_selection_for_focus_change_ = gfx::Range::InvalidRange(); } GetRenderText()->SetElideBehavior(gfx::NO_ELIDE); if (model()->is_keyword_hint()) location_bar_view_->Layout(); #if BUILDFLAG(ENABLE_DESKTOP_IN_PRODUCT_HELP) if (controller()->GetToolbarModel()->ShouldDisplayURL()) { feature_engagement::NewTabTrackerFactory::GetInstance() ->GetForProfile(location_bar_view_->profile()) ->OnOmniboxFocused(); } #endif }
0
11,407
Packet *PacketTunnelPktSetup(ThreadVars *tv, DecodeThreadVars *dtv, Packet *parent, uint8_t *pkt, uint32_t len, enum DecodeTunnelProto proto, PacketQueue *pq) { int ret; SCEnter(); /* get us a packet */ Packet *p = PacketGetFromQueueOrAlloc(); if (unlikely(p == NULL)) { SCReturnPtr(NULL, "Packet"); } /* copy packet and set lenght, proto */ PacketCopyData(p, pkt, len); p->recursion_level = parent->recursion_level + 1; p->ts.tv_sec = parent->ts.tv_sec; p->ts.tv_usec = parent->ts.tv_usec; p->datalink = DLT_RAW; p->tenant_id = parent->tenant_id; /* set the root ptr to the lowest layer */ if (parent->root != NULL) p->root = parent->root; else p->root = parent; /* tell new packet it's part of a tunnel */ SET_TUNNEL_PKT(p); ret = DecodeTunnel(tv, dtv, p, GET_PKT_DATA(p), GET_PKT_LEN(p), pq, proto); if (unlikely(ret != TM_ECODE_OK)) { /* Not a tunnel packet, just a pseudo packet */ p->root = NULL; UNSET_TUNNEL_PKT(p); TmqhOutputPacketpool(tv, p); SCReturnPtr(NULL, "Packet"); } /* tell parent packet it's part of a tunnel */ SET_TUNNEL_PKT(parent); /* increment tunnel packet refcnt in the root packet */ TUNNEL_INCR_PKT_TPR(p); /* disable payload (not packet) inspection on the parent, as the payload * is the packet we will now run through the system separately. We do * check it against the ip/port/other header checks though */ DecodeSetNoPayloadInspectionFlag(parent); SCReturnPtr(p, "Packet"); }
1
383,329
gpgsm_get_fingerprint_string (ksba_cert_t cert, int algo) { unsigned char digest[MAX_DIGEST_LEN]; char *buf; int len; if (!algo) algo = GCRY_MD_SHA1; len = gcry_md_get_algo_dlen (algo); assert (len <= MAX_DIGEST_LEN ); gpgsm_get_fingerprint (cert, algo, digest, NULL); buf = xmalloc (len*3+1); bin2hexcolon (digest, len, buf); return buf; }
0
251,003
void Performance::BuildJSONValue(V8ObjectBuilder& builder) const { builder.AddNumber("timeOrigin", timeOrigin()); }
0
75,916
static bool tcp_rcv_fastopen_synack(struct sock *sk, struct sk_buff *synack, struct tcp_fastopen_cookie *cookie) { struct tcp_sock *tp = tcp_sk(sk); struct sk_buff *data = tp->syn_data ? tcp_write_queue_head(sk) : NULL; u16 mss = tp->rx_opt.mss_clamp, try_exp = 0; bool syn_drop = false; if (mss == tp->rx_opt.user_mss) { struct tcp_options_received opt; /* Get original SYNACK MSS value if user MSS sets mss_clamp */ tcp_clear_options(&opt); opt.user_mss = opt.mss_clamp = 0; tcp_parse_options(synack, &opt, 0, NULL); mss = opt.mss_clamp; } if (!tp->syn_fastopen) { /* Ignore an unsolicited cookie */ cookie->len = -1; } else if (tp->total_retrans) { /* SYN timed out and the SYN-ACK neither has a cookie nor * acknowledges data. Presumably the remote received only * the retransmitted (regular) SYNs: either the original * SYN-data or the corresponding SYN-ACK was dropped. */ syn_drop = (cookie->len < 0 && data); } else if (cookie->len < 0 && !tp->syn_data) { /* We requested a cookie but didn't get it. If we did not use * the (old) exp opt format then try so next time (try_exp=1). * Otherwise we go back to use the RFC7413 opt (try_exp=2). */ try_exp = tp->syn_fastopen_exp ? 2 : 1; } tcp_fastopen_cache_set(sk, mss, cookie, syn_drop, try_exp); if (data) { /* Retransmit unacked data in SYN */ tcp_for_write_queue_from(data, sk) { if (data == tcp_send_head(sk) || __tcp_retransmit_skb(sk, data, 1)) break; } tcp_rearm_rto(sk); NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVEFAIL); return true; } tp->syn_data_acked = tp->syn_data; if (tp->syn_data_acked) NET_INC_STATS(sock_net(sk), LINUX_MIB_TCPFASTOPENACTIVE); tcp_fastopen_add_skb(sk, synack); return false; }
0
372,260
void jcopy_markers_execute(j_decompress_ptr srcinfo, j_compress_ptr dstinfo) { jpeg_saved_marker_ptr marker; /* In the current implementation, we don't actually need to examine the * option flag here; we just copy everything that got saved. * But to avoid confusion, we do not output JFIF and Adobe APP14 markers * if the encoder library already wrote one. */ for (marker = srcinfo->marker_list; marker != NULL; marker = marker->next) { if (dstinfo->write_JFIF_header && marker->marker == JPEG_APP0 && marker->data_length >= 5 && GETJOCTET(marker->data[0]) == 0x4A && GETJOCTET(marker->data[1]) == 0x46 && GETJOCTET(marker->data[2]) == 0x49 && GETJOCTET(marker->data[3]) == 0x46 && GETJOCTET(marker->data[4]) == 0) continue; /* reject duplicate JFIF */ if (dstinfo->write_Adobe_marker && marker->marker == JPEG_APP0+14 && marker->data_length >= 5 && GETJOCTET(marker->data[0]) == 0x41 && GETJOCTET(marker->data[1]) == 0x64 && GETJOCTET(marker->data[2]) == 0x6F && GETJOCTET(marker->data[3]) == 0x62 && GETJOCTET(marker->data[4]) == 0x65) continue; /* reject duplicate Adobe */ jpeg_write_marker(dstinfo, marker->marker, marker->data, marker->data_length); } }
0
37,270
static void se_io_cb(void *context, u8 *apdu, size_t apdu_len, int err) { struct se_io_ctx *ctx = context; struct sk_buff *msg; void *hdr; msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); if (!msg) { kfree(ctx); return; } hdr = genlmsg_put(msg, 0, 0, &nfc_genl_family, 0, NFC_CMD_SE_IO); if (!hdr) goto free_msg; if (nla_put_u32(msg, NFC_ATTR_DEVICE_INDEX, ctx->dev_idx) || nla_put_u32(msg, NFC_ATTR_SE_INDEX, ctx->se_idx) || nla_put(msg, NFC_ATTR_SE_APDU, apdu_len, apdu)) goto nla_put_failure; genlmsg_end(msg, hdr); genlmsg_multicast(&nfc_genl_family, msg, 0, 0, GFP_KERNEL); kfree(ctx); return; nla_put_failure: free_msg: nlmsg_free(msg); kfree(ctx); return; }
0
507,108
int ssl3_client_hello(SSL *s) { unsigned char *buf; unsigned char *p,*d; int i; unsigned long l; #ifndef OPENSSL_NO_COMP int j; SSL_COMP *comp; #endif buf=(unsigned char *)s->init_buf->data; if (s->state == SSL3_ST_CW_CLNT_HELLO_A) { SSL_SESSION *sess = s->session; if ((sess == NULL) || (sess->ssl_version != s->version) || !sess->session_id_length || (sess->not_resumable)) { if (!ssl_get_new_session(s,0)) goto err; } /* else use the pre-loaded session */ p=s->s3->client_random; if (ssl_fill_hello_random(s, 0, p, SSL3_RANDOM_SIZE) <= 0) goto err; /* Do the message type and length last */ d=p= &(buf[4]); /* version indicates the negotiated version: for example from * an SSLv2/v3 compatible client hello). The client_version * field is the maximum version we permit and it is also * used in RSA encrypted premaster secrets. Some servers can * choke if we initially report a higher version then * renegotiate to a lower one in the premaster secret. This * didn't happen with TLS 1.0 as most servers supported it * but it can with TLS 1.1 or later if the server only supports * 1.0. * * Possible scenario with previous logic: * 1. Client hello indicates TLS 1.2 * 2. Server hello says TLS 1.0 * 3. RSA encrypted premaster secret uses 1.2. * 4. Handhaked proceeds using TLS 1.0. * 5. Server sends hello request to renegotiate. * 6. Client hello indicates TLS v1.0 as we now * know that is maximum server supports. * 7. Server chokes on RSA encrypted premaster secret * containing version 1.0. * * For interoperability it should be OK to always use the * maximum version we support in client hello and then rely * on the checking of version to ensure the servers isn't * being inconsistent: for example initially negotiating with * TLS 1.0 and renegotiating with TLS 1.2. We do this by using * client_version in client hello and not resetting it to * the negotiated version. */ #if 0 *(p++)=s->version>>8; *(p++)=s->version&0xff; s->client_version=s->version; #else *(p++)=s->client_version>>8; *(p++)=s->client_version&0xff; #endif /* Random stuff */ memcpy(p,s->s3->client_random,SSL3_RANDOM_SIZE); p+=SSL3_RANDOM_SIZE; /* Session ID */ if (s->new_session) i=0; else i=s->session->session_id_length; *(p++)=i; if (i != 0) { if (i > (int)sizeof(s->session->session_id)) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } memcpy(p,s->session->session_id,i); p+=i; } /* Ciphers supported */ i=ssl_cipher_list_to_bytes(s,SSL_get_ciphers(s),&(p[2]),0); if (i == 0) { SSLerr(SSL_F_SSL3_CLIENT_HELLO,SSL_R_NO_CIPHERS_AVAILABLE); goto err; } #ifdef OPENSSL_MAX_TLS1_2_CIPHER_LENGTH /* Some servers hang if client hello > 256 bytes * as hack workaround chop number of supported ciphers * to keep it well below this if we use TLS v1.2 */ if (TLS1_get_version(s) >= TLS1_2_VERSION && i > OPENSSL_MAX_TLS1_2_CIPHER_LENGTH) i = OPENSSL_MAX_TLS1_2_CIPHER_LENGTH & ~1; #endif s2n(i,p); p+=i; /* COMPRESSION */ #ifdef OPENSSL_NO_COMP *(p++)=1; #else if ((s->options & SSL_OP_NO_COMPRESSION) || !s->ctx->comp_methods) j=0; else j=sk_SSL_COMP_num(s->ctx->comp_methods); *(p++)=1+j; for (i=0; i<j; i++) { comp=sk_SSL_COMP_value(s->ctx->comp_methods,i); *(p++)=comp->id; } #endif *(p++)=0; /* Add the NULL method */ #ifndef OPENSSL_NO_TLSEXT /* TLS extensions*/ if (ssl_prepare_clienthello_tlsext(s) <= 0) { SSLerr(SSL_F_SSL3_CLIENT_HELLO,SSL_R_CLIENTHELLO_TLSEXT); goto err; } if ((p = ssl_add_clienthello_tlsext(s, p, buf+SSL3_RT_MAX_PLAIN_LENGTH)) == NULL) { SSLerr(SSL_F_SSL3_CLIENT_HELLO,ERR_R_INTERNAL_ERROR); goto err; } #endif l=(p-d); d=buf; *(d++)=SSL3_MT_CLIENT_HELLO; l2n3(l,d); s->state=SSL3_ST_CW_CLNT_HELLO_B; /* number of bytes to write */ s->init_num=p-buf; s->init_off=0; } /* SSL3_ST_CW_CLNT_HELLO_B */ return(ssl3_do_write(s,SSL3_RT_HANDSHAKE)); err: return(-1); }
0
253,692
void WebSettingsImpl::setStandardFontFamily(const WebString& font) { m_settings->setStandardFontFamily(font); }
0
238,803
DictionaryValue* BrowserEventRouter::TabEntry::DidNavigate( const WebContents* contents) { complete_waiting_on_load_ = true; DictionaryValue* changed_properties = new DictionaryValue(); changed_properties->SetString(tab_keys::kStatusKey, tab_keys::kStatusValueLoading); if (contents->GetURL() != url_) { url_ = contents->GetURL(); changed_properties->SetString(tab_keys::kUrlKey, url_.spec()); } return changed_properties; }
0
147,953
static struct ucma_context *ucma_get_ctx(struct ucma_file *file, int id) { struct ucma_context *ctx; mutex_lock(&mut); ctx = _ucma_find_context(id, file); if (!IS_ERR(ctx)) { if (ctx->closing) ctx = ERR_PTR(-EIO); else atomic_inc(&ctx->ref); } mutex_unlock(&mut); return ctx; }
0
337,601
static int vnc_display_connect(VncDisplay *vd, SocketAddressLegacy **saddr, size_t nsaddr, SocketAddressLegacy **wsaddr, size_t nwsaddr, Error **errp) { /* connect to viewer */ QIOChannelSocket *sioc = NULL; if (nwsaddr != 0) { error_setg(errp, "Cannot use websockets in reverse mode"); return -1; } if (nsaddr != 1) { error_setg(errp, "Expected a single address in reverse mode"); return -1; } /* TODO SOCKET_ADDRESS_LEGACY_KIND_FD when fd has AF_UNIX */ vd->is_unix = saddr[0]->type == SOCKET_ADDRESS_LEGACY_KIND_UNIX; sioc = qio_channel_socket_new(); qio_channel_set_name(QIO_CHANNEL(sioc), "vnc-reverse"); if (qio_channel_socket_connect_sync(sioc, saddr[0], errp) < 0) { return -1; } vnc_connect(vd, sioc, false, false); object_unref(OBJECT(sioc)); return 0; }
0
382,021
void *zend_shared_alloc(size_t size) { int i; unsigned int block_size = ZEND_ALIGNED_SIZE(size); #if 1 if (!ZCG(locked)) { zend_accel_error(ACCEL_LOG_ERROR, "Shared memory lock not obtained"); } #endif if (block_size > ZSMMG(shared_free)) { /* No hope to find a big-enough block */ SHARED_ALLOC_FAILED(); return NULL; } for (i = 0; i < ZSMMG(shared_segments_count); i++) { if (ZSMMG(shared_segments)[i]->size - ZSMMG(shared_segments)[i]->pos >= block_size) { /* found a valid block */ void *retval = (void *) (((char *) ZSMMG(shared_segments)[i]->p) + ZSMMG(shared_segments)[i]->pos); ZSMMG(shared_segments)[i]->pos += block_size; ZSMMG(shared_free) -= block_size; memset(retval, 0, block_size); return retval; } } SHARED_ALLOC_FAILED(); return NULL; }
0
203,015
NodeIterator::~NodeIterator() { if (!root()->isAttributeNode()) root()->document().detachNodeIterator(this); }
0
374,411
fmgr(Oid procedureId,...) { FmgrInfo flinfo; FunctionCallInfoData fcinfo; int n_arguments; Datum result; fmgr_info(procedureId, &flinfo); MemSet(&fcinfo, 0, sizeof(fcinfo)); fcinfo.flinfo = &flinfo; fcinfo.nargs = flinfo.fn_nargs; n_arguments = fcinfo.nargs; if (n_arguments > 0) { va_list pvar; int i; if (n_arguments > FUNC_MAX_ARGS) ereport(ERROR, (errcode(ERRCODE_TOO_MANY_ARGUMENTS), errmsg("function %u has too many arguments (%d, maximum is %d)", flinfo.fn_oid, n_arguments, FUNC_MAX_ARGS))); va_start(pvar, procedureId); for (i = 0; i < n_arguments; i++) fcinfo.arg[i] = PointerGetDatum(va_arg(pvar, char *)); va_end(pvar); } result = FunctionCallInvoke(&fcinfo); /* Check for null result, since caller is clearly not expecting one */ if (fcinfo.isnull) elog(ERROR, "function %u returned NULL", flinfo.fn_oid); return DatumGetPointer(result); }
0
448,019
int sftp_reply_attr(sftp_client_message msg, sftp_attributes attr) { ssh_buffer out; out = ssh_buffer_new(); if (out == NULL) { return -1; } if (ssh_buffer_add_u32(out, msg->id) < 0 || buffer_add_attributes(out, attr) < 0 || sftp_packet_write(msg->sftp, SSH_FXP_ATTRS, out) < 0) { SSH_BUFFER_FREE(out); return -1; } SSH_BUFFER_FREE(out); return 0; }
0
26,588
static uint64_t byte_budget ( const EVP_CIPHER * cipher ) { int ivlen = EVP_CIPHER_iv_length ( cipher ) ; int blklen = EVP_CIPHER_block_size ( cipher ) ; int len = blklen > 1 ? blklen : ivlen > 1 ? ivlen : 8 ; int bits = len * 4 - 1 ; return bits < 64 ? UINT64_C ( 1 ) << bits : UINT64_MAX ; }
0
337,829
static int parse_dsd_diin(AVFormatContext *s, AVStream *st, uint64_t eof) { AVIOContext *pb = s->pb; while (avio_tell(pb) + 12 <= eof) { uint32_t tag = avio_rl32(pb); uint64_t size = avio_rb64(pb); uint64_t orig_pos = avio_tell(pb); const char * metadata_tag = NULL; switch(tag) { case MKTAG('D','I','A','R'): metadata_tag = "artist"; break; case MKTAG('D','I','T','I'): metadata_tag = "title"; break; } if (metadata_tag && size > 4) { unsigned int tag_size = avio_rb32(pb); int ret = get_metadata(s, metadata_tag, FFMIN(tag_size, size - 4)); if (ret < 0) { av_log(s, AV_LOG_ERROR, "cannot allocate metadata tag %s!\n", metadata_tag); return ret; } } avio_skip(pb, size - (avio_tell(pb) - orig_pos) + (size & 1)); } return 0; }
1
108,635
GF_Err audio_sample_entry_on_child_box(GF_Box *s, GF_Box *a) { GF_UnknownBox *wave = NULL; Bool drop_wave=GF_FALSE; GF_MPEGAudioSampleEntryBox *ptr = (GF_MPEGAudioSampleEntryBox *)s; switch (a->type) { case GF_ISOM_BOX_TYPE_ESDS: if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->esd = (GF_ESDBox *)a; ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_NONE; break; case GF_ISOM_BOX_TYPE_DAMR: case GF_ISOM_BOX_TYPE_DEVC: case GF_ISOM_BOX_TYPE_DQCP: case GF_ISOM_BOX_TYPE_DSMV: if (ptr->cfg_3gpp) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->cfg_3gpp = (GF_3GPPConfigBox *) a; /*for 3GP config, remember sample entry type in config*/ ptr->cfg_3gpp->cfg.type = ptr->type; ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_NONE; break; case GF_ISOM_BOX_TYPE_DOPS: if (ptr->cfg_opus) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->cfg_opus = (GF_OpusSpecificBox *)a; ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_NONE; break; case GF_ISOM_BOX_TYPE_DAC3: if (ptr->cfg_ac3) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->cfg_ac3 = (GF_AC3ConfigBox *) a; ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_NONE; break; case GF_ISOM_BOX_TYPE_DEC3: if (ptr->cfg_ac3) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->cfg_ac3 = (GF_AC3ConfigBox *) a; break; case GF_ISOM_BOX_TYPE_MHAC: if (ptr->cfg_mha) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->cfg_mha = (GF_MHAConfigBox *) a; ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_NONE; break; case GF_ISOM_BOX_TYPE_DFLA: if (ptr->cfg_flac) ERROR_ON_DUPLICATED_BOX(a, ptr) ptr->cfg_flac = (GF_FLACConfigBox *) a; ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_NONE; break; case GF_ISOM_BOX_TYPE_UNKNOWN: wave = (GF_UnknownBox *)a; /*HACK for QT files: get the esds box from the track*/ if (s->type == GF_ISOM_BOX_TYPE_MP4A) { if (ptr->esd) ERROR_ON_DUPLICATED_BOX(a, ptr) //wave subboxes may have been properly parsed if ((wave->original_4cc == GF_QT_BOX_TYPE_WAVE) && gf_list_count(wave->child_boxes)) { u32 i; for (i =0; i<gf_list_count(wave->child_boxes); i++) { GF_Box *inner_box = (GF_Box *)gf_list_get(wave->child_boxes, i); if (inner_box->type == GF_ISOM_BOX_TYPE_ESDS) { ptr->esd = (GF_ESDBox *)inner_box; if (ptr->qtff_mode & GF_ISOM_AUDIO_QTFF_CONVERT_FLAG) { gf_list_rem(a->child_boxes, i); drop_wave=GF_TRUE; ptr->compression_id = 0; gf_list_add(ptr->child_boxes, inner_box); } } } if (drop_wave) { gf_isom_box_del_parent(&ptr->child_boxes, a); ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_NONE; ptr->version = 0; return GF_OK; } ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_ON_EXT_VALID; return GF_OK; } gf_isom_box_del_parent(&ptr->child_boxes, a); return GF_ISOM_INVALID_MEDIA; } ptr->qtff_mode &= ~GF_ISOM_AUDIO_QTFF_CONVERT_FLAG; if ((wave->original_4cc == GF_QT_BOX_TYPE_WAVE) && gf_list_count(wave->child_boxes)) { ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_ON_NOEXT; } return GF_OK; case GF_QT_BOX_TYPE_WAVE: { u32 subtype = 0; GF_Box **cfg_ptr = NULL; if (s->type == GF_ISOM_BOX_TYPE_MP4A) { cfg_ptr = (GF_Box **) &ptr->esd; subtype = GF_ISOM_BOX_TYPE_ESDS; } else if (s->type == GF_ISOM_BOX_TYPE_AC3) { cfg_ptr = (GF_Box **) &ptr->cfg_ac3; subtype = GF_ISOM_BOX_TYPE_DAC3; } else if (s->type == GF_ISOM_BOX_TYPE_EC3) { cfg_ptr = (GF_Box **) &ptr->cfg_ac3; subtype = GF_ISOM_BOX_TYPE_DEC3; } else if (s->type == GF_ISOM_BOX_TYPE_OPUS) { cfg_ptr = (GF_Box **) &ptr->cfg_opus; subtype = GF_ISOM_BOX_TYPE_DOPS; } else if ((s->type == GF_ISOM_BOX_TYPE_MHA1) || (s->type == GF_ISOM_BOX_TYPE_MHA2) || (s->type == GF_ISOM_BOX_TYPE_MHM1) || (s->type == GF_ISOM_BOX_TYPE_MHM2) ) { cfg_ptr = (GF_Box **) &ptr->cfg_mha; subtype = GF_ISOM_BOX_TYPE_MHAC; } if (cfg_ptr) { if (*cfg_ptr) ERROR_ON_DUPLICATED_BOX(a, ptr) //wave subboxes may have been properly parsed if (gf_list_count(a->child_boxes)) { u32 i; for (i =0; i<gf_list_count(a->child_boxes); i++) { GF_Box *inner_box = (GF_Box *)gf_list_get(a->child_boxes, i); if (inner_box->type == subtype) { *cfg_ptr = inner_box; if (ptr->qtff_mode & GF_ISOM_AUDIO_QTFF_CONVERT_FLAG) { gf_list_rem(a->child_boxes, i); drop_wave=GF_TRUE; gf_list_add(ptr->child_boxes, inner_box); } break; } } if (drop_wave) { gf_isom_box_del_parent(&ptr->child_boxes, a); ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_NONE; ptr->compression_id = 0; ptr->version = 0; return GF_OK; } ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_ON_EXT_VALID; return GF_OK; } } } ptr->qtff_mode = GF_ISOM_AUDIO_QTFF_ON_EXT_VALID; return GF_OK; } return GF_OK; }
0
420,679
static int h2c_handle_settings(struct h2c *h2c) { unsigned int offset; int error; if (h2c->dff & H2_F_SETTINGS_ACK) { if (h2c->dfl) { error = H2_ERR_FRAME_SIZE_ERROR; goto fail; } return 1; } if (h2c->dsi != 0) { error = H2_ERR_PROTOCOL_ERROR; goto fail; } if (h2c->dfl % 6) { error = H2_ERR_FRAME_SIZE_ERROR; goto fail; } /* that's the limit we can process */ if (h2c->dfl > global.tune.bufsize) { error = H2_ERR_FRAME_SIZE_ERROR; goto fail; } /* process full frame only */ if (b_data(&h2c->dbuf) < h2c->dfl) return 0; /* parse the frame */ for (offset = 0; offset < h2c->dfl; offset += 6) { uint16_t type = h2_get_n16(&h2c->dbuf, offset); int32_t arg = h2_get_n32(&h2c->dbuf, offset + 2); switch (type) { case H2_SETTINGS_INITIAL_WINDOW_SIZE: /* we need to update all existing streams with the * difference from the previous iws. */ if (arg < 0) { // RFC7540#6.5.2 error = H2_ERR_FLOW_CONTROL_ERROR; goto fail; } h2c_update_all_ws(h2c, arg - h2c->miw); h2c->miw = arg; break; case H2_SETTINGS_MAX_FRAME_SIZE: if (arg < 16384 || arg > 16777215) { // RFC7540#6.5.2 error = H2_ERR_PROTOCOL_ERROR; goto fail; } h2c->mfs = arg; break; case H2_SETTINGS_ENABLE_PUSH: if (arg < 0 || arg > 1) { // RFC7540#6.5.2 error = H2_ERR_PROTOCOL_ERROR; goto fail; } break; } } /* need to ACK this frame now */ h2c->st0 = H2_CS_FRAME_A; return 1; fail: sess_log(h2c->conn->owner); h2c_error(h2c, error); return 0; }
0
69,295
archive_wstring_ensure(struct archive_wstring *as, size_t s) { return (struct archive_wstring *) archive_string_ensure((struct archive_string *)as, s * sizeof(wchar_t)); }
0
444,074
TEST_P(Http2CodecImplTest, LargeRequestHeadersAtMaxConfigurable) { // Raising the limit past this triggers some unexpected nghttp2 error. // Further debugging required to increase past ~96 KiB. max_request_headers_kb_ = 96; initialize(); TestRequestHeaderMapImpl request_headers; HttpTestUtility::addDefaultHeaders(request_headers); std::string long_string = std::string(1024, 'q'); for (int i = 0; i < 95; i++) { request_headers.addCopy(std::to_string(i), long_string); } EXPECT_CALL(request_decoder_, decodeHeaders_(_, _)).Times(1); EXPECT_CALL(server_stream_callbacks_, onResetStream(_, _)).Times(0); request_encoder_->encodeHeaders(request_headers, true); }
0
166,459
void GLES2DecoderWithShaderTestBase::SetupIndexBuffer() { DoBindBuffer(GL_ELEMENT_ARRAY_BUFFER, client_element_buffer_id_, kServiceElementBufferId); static const GLshort indices[] = {100, 1, 2, 3, 4, 5, 6, 7, 100, 9}; COMPILE_ASSERT(arraysize(indices) == kNumIndices, Indices_is_not_10); DoBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices)); DoBufferSubData(GL_ELEMENT_ARRAY_BUFFER, 0, sizeof(indices), indices); }
0
124,054
static int kvm_vm_ioctl_set_msr_filter(struct kvm *kvm, void __user *argp) { struct kvm_msr_filter __user *user_msr_filter = argp; struct kvm_x86_msr_filter *new_filter, *old_filter; struct kvm_msr_filter filter; bool default_allow; bool empty = true; int r = 0; u32 i; if (copy_from_user(&filter, user_msr_filter, sizeof(filter))) return -EFAULT; for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) empty &= !filter.ranges[i].nmsrs; default_allow = !(filter.flags & KVM_MSR_FILTER_DEFAULT_DENY); if (empty && !default_allow) return -EINVAL; new_filter = kvm_alloc_msr_filter(default_allow); if (!new_filter) return -ENOMEM; for (i = 0; i < ARRAY_SIZE(filter.ranges); i++) { r = kvm_add_msr_filter(new_filter, &filter.ranges[i]); if (r) { kvm_free_msr_filter(new_filter); return r; } } mutex_lock(&kvm->lock); /* The per-VM filter is protected by kvm->lock... */ old_filter = srcu_dereference_check(kvm->arch.msr_filter, &kvm->srcu, 1); rcu_assign_pointer(kvm->arch.msr_filter, new_filter); synchronize_srcu(&kvm->srcu); kvm_free_msr_filter(old_filter); kvm_make_all_cpus_request(kvm, KVM_REQ_MSR_FILTER_CHANGED); mutex_unlock(&kvm->lock); return 0; }
0
79,914
static int nfs4_proc_setlk(struct nfs4_state *state, int cmd, struct file_lock *request) { struct nfs4_exception exception = { }; int err; do { err = nfs4_handle_exception(NFS_SERVER(state->inode), _nfs4_proc_setlk(state, cmd, request), &exception); } while (exception.retry); return err; }
0
63,844
inline void TransposeConv( const ConvParams& params, const RuntimeShape& input_shape, const float* input_data, const RuntimeShape& filter_shape, const float* filter_data, const RuntimeShape& output_shape, float* output_data, const RuntimeShape& im2col_shape, float* im2col_data) { ruy::profiler::ScopeLabel label("TransposeConv"); // Note we could use transposed weights with forward conv for unstrided // cases. But we are already getting good performance with this code as-is. TFLITE_DCHECK(im2col_data); TransposeIm2col(params, 0, input_shape, input_data, filter_shape, output_shape, im2col_data); const auto im2col_matrix_map = MapAsMatrixWithLastDimAsRows(im2col_data, im2col_shape); const auto filter_matrix_map = MapAsMatrixWithFirstDimAsCols(filter_data, filter_shape); auto output_matrix_map = MapAsMatrixWithLastDimAsRows(output_data, output_shape); Gemm(filter_matrix_map.transpose(), im2col_matrix_map, &output_matrix_map); }
0
149,065
DEFUN(linend, LINE_END, "Go to the end of the line") { if (Currentbuf->firstLine == NULL) return; while (Currentbuf->currentLine->next && Currentbuf->currentLine->next->bpos) cursorDown0(Currentbuf, 1); Currentbuf->pos = Currentbuf->currentLine->len - 1; arrangeCursor(Currentbuf); displayBuffer(Currentbuf, B_NORMAL); }
0
357,448
int audit_match_class(int class, unsigned syscall) { if (unlikely(syscall >= AUDIT_BITMASK_SIZE * 32)) return 0; if (unlikely(class >= AUDIT_SYSCALL_CLASSES || !classes[class])) return 0; return classes[class][AUDIT_WORD(syscall)] & AUDIT_BIT(syscall); }
0
230,453
exsltDateAddDurationFunction (xmlXPathParserContextPtr ctxt, int nargs) { xmlChar *ret, *xstr, *ystr; if (nargs != 2) { xmlXPathSetArityError(ctxt); return; } ystr = xmlXPathPopString(ctxt); if (xmlXPathCheckError(ctxt)) return; xstr = xmlXPathPopString(ctxt); if (xmlXPathCheckError(ctxt)) { xmlFree(ystr); return; } ret = exsltDateAddDuration(xstr, ystr); xmlFree(ystr); xmlFree(xstr); if (ret == NULL) xmlXPathReturnEmptyString(ctxt); else xmlXPathReturnString(ctxt, ret); }
0
325,684
POWERPC_FAMILY(POWER8E)(ObjectClass *oc, void *data) { DeviceClass *dc = DEVICE_CLASS(oc); PowerPCCPUClass *pcc = POWERPC_CPU_CLASS(oc); dc->fw_name = "PowerPC,POWER8"; dc->desc = "POWER8E"; dc->props = powerpc_servercpu_properties; pcc->pvr_match = ppc_pvr_match_power8; pcc->pcr_mask = PCR_COMPAT_2_05 | PCR_COMPAT_2_06; pcc->init_proc = init_proc_POWER8; pcc->check_pow = check_pow_nocheck; pcc->insns_flags = PPC_INSNS_BASE | PPC_ISEL | PPC_STRING | PPC_MFTB | PPC_FLOAT | PPC_FLOAT_FSEL | PPC_FLOAT_FRES | PPC_FLOAT_FSQRT | PPC_FLOAT_FRSQRTE | PPC_FLOAT_FRSQRTES | PPC_FLOAT_STFIWX | PPC_FLOAT_EXT | PPC_CACHE | PPC_CACHE_ICBI | PPC_CACHE_DCBZ | PPC_MEM_SYNC | PPC_MEM_EIEIO | PPC_MEM_TLBIE | PPC_MEM_TLBSYNC | PPC_64B | PPC_64BX | PPC_ALTIVEC | PPC_SEGMENT_64B | PPC_SLBI | PPC_POPCNTB | PPC_POPCNTWD; pcc->insns_flags2 = PPC2_VSX | PPC2_VSX207 | PPC2_DFP | PPC2_DBRX | PPC2_PERM_ISA206 | PPC2_DIVE_ISA206 | PPC2_ATOMIC_ISA206 | PPC2_FP_CVT_ISA206 | PPC2_FP_TST_ISA206 | PPC2_BCTAR_ISA207 | PPC2_LSQ_ISA207 | PPC2_ALTIVEC_207 | PPC2_ISA205 | PPC2_ISA207S; pcc->msr_mask = (1ull << MSR_SF) | (1ull << MSR_TM) | (1ull << MSR_VR) | (1ull << MSR_VSX) | (1ull << MSR_EE) | (1ull << MSR_PR) | (1ull << MSR_FP) | (1ull << MSR_ME) | (1ull << MSR_FE0) | (1ull << MSR_SE) | (1ull << MSR_DE) | (1ull << MSR_FE1) | (1ull << MSR_IR) | (1ull << MSR_DR) | (1ull << MSR_PMM) | (1ull << MSR_RI) | (1ull << MSR_LE); pcc->mmu_model = POWERPC_MMU_2_06; #if defined(CONFIG_SOFTMMU) pcc->handle_mmu_fault = ppc_hash64_handle_mmu_fault; #endif pcc->excp_model = POWERPC_EXCP_POWER7; pcc->bus_model = PPC_FLAGS_INPUT_POWER7; pcc->bfd_mach = bfd_mach_ppc64; pcc->flags = POWERPC_FLAG_VRE | POWERPC_FLAG_SE | POWERPC_FLAG_BE | POWERPC_FLAG_PMM | POWERPC_FLAG_BUS_CLK | POWERPC_FLAG_CFAR | POWERPC_FLAG_VSX; pcc->l1_dcache_size = 0x8000; pcc->l1_icache_size = 0x8000; pcc->interrupts_big_endian = ppc_cpu_interrupts_big_endian_lpcr; }
0
480,259
static bool io_cancel_defer_files(struct io_ring_ctx *ctx, struct task_struct *task, bool cancel_all) { struct io_defer_entry *de; LIST_HEAD(list); spin_lock_irq(&ctx->completion_lock); list_for_each_entry_reverse(de, &ctx->defer_list, list) { if (io_match_task(de->req, task, cancel_all)) { list_cut_position(&list, &ctx->defer_list, &de->list); break; } } spin_unlock_irq(&ctx->completion_lock); if (list_empty(&list)) return false; while (!list_empty(&list)) { de = list_first_entry(&list, struct io_defer_entry, list); list_del_init(&de->list); io_req_complete_failed(de->req, -ECANCELED); kfree(de); } return true;
0
86,870
user_func_error(int error, char_u *name, funcexe_T *funcexe) { switch (error) { case FCERR_UNKNOWN: if (funcexe->fe_found_var) semsg(_(e_not_callable_type_str), name); else emsg_funcname(e_unknown_function_str, name); break; case FCERR_NOTMETHOD: emsg_funcname( N_(e_cannot_use_function_as_method_str), name); break; case FCERR_DELETED: emsg_funcname(e_function_was_deleted_str, name); break; case FCERR_TOOMANY: emsg_funcname(e_too_many_arguments_for_function_str, name); break; case FCERR_TOOFEW: emsg_funcname(e_not_enough_arguments_for_function_str, name); break; case FCERR_SCRIPT: emsg_funcname( e_using_sid_not_in_script_context_str, name); break; case FCERR_DICT: emsg_funcname(e_calling_dict_function_without_dictionary_str, name); break; } }
0
55,094
gc_generational_mode_set(mrb_state *mrb, mrb_value self) { mrb_bool enable; mrb_get_args(mrb, "b", &enable); if (mrb->gc.generational != enable) change_gen_gc_mode(mrb, &mrb->gc, enable); return mrb_bool_value(enable); }
0
350,587
wolfssl_connect_step1(struct Curl_easy *data, struct connectdata *conn, int sockindex) { char *ciphers; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; struct ssl_backend_data *backend = connssl->backend; SSL_METHOD* req_method = NULL; curl_socket_t sockfd = conn->sock[sockindex]; #ifdef HAVE_SNI bool sni = FALSE; #define use_sni(x) sni = (x) #else #define use_sni(x) Curl_nop_stmt #endif if(connssl->state == ssl_connection_complete) return CURLE_OK; if(SSL_CONN_CONFIG(version_max) != CURL_SSLVERSION_MAX_NONE) { failf(data, "wolfSSL does not support to set maximum SSL/TLS version"); return CURLE_SSL_CONNECT_ERROR; } /* check to see if we've been told to use an explicit SSL/TLS version */ switch(SSL_CONN_CONFIG(version)) { case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_TLSv1: #if LIBWOLFSSL_VERSION_HEX >= 0x03003000 /* >= 3.3.0 */ /* minimum protocol version is set later after the CTX object is created */ req_method = SSLv23_client_method(); #else infof(data, "wolfSSL <3.3.0 cannot be configured to use TLS 1.0-1.2, " "TLS 1.0 is used exclusively\n"); req_method = TLSv1_client_method(); #endif use_sni(TRUE); break; case CURL_SSLVERSION_TLSv1_0: #if defined(WOLFSSL_ALLOW_TLSV10) && !defined(NO_OLD_TLS) req_method = TLSv1_client_method(); use_sni(TRUE); #else failf(data, "wolfSSL does not support TLS 1.0"); return CURLE_NOT_BUILT_IN; #endif break; case CURL_SSLVERSION_TLSv1_1: #ifndef NO_OLD_TLS req_method = TLSv1_1_client_method(); use_sni(TRUE); #else failf(data, "wolfSSL does not support TLS 1.1"); return CURLE_NOT_BUILT_IN; #endif break; case CURL_SSLVERSION_TLSv1_2: req_method = TLSv1_2_client_method(); use_sni(TRUE); break; case CURL_SSLVERSION_TLSv1_3: #ifdef WOLFSSL_TLS13 req_method = wolfTLSv1_3_client_method(); use_sni(TRUE); break; #else failf(data, "wolfSSL: TLS 1.3 is not yet supported"); return CURLE_SSL_CONNECT_ERROR; #endif case CURL_SSLVERSION_SSLv3: #ifdef WOLFSSL_ALLOW_SSLV3 req_method = SSLv3_client_method(); use_sni(FALSE); #else failf(data, "wolfSSL does not support SSLv3"); return CURLE_NOT_BUILT_IN; #endif break; case CURL_SSLVERSION_SSLv2: failf(data, "wolfSSL does not support SSLv2"); return CURLE_SSL_CONNECT_ERROR; default: failf(data, "Unrecognized parameter passed via CURLOPT_SSLVERSION"); return CURLE_SSL_CONNECT_ERROR; } if(!req_method) { failf(data, "SSL: couldn't create a method!"); return CURLE_OUT_OF_MEMORY; } if(backend->ctx) SSL_CTX_free(backend->ctx); backend->ctx = SSL_CTX_new(req_method); if(!backend->ctx) { failf(data, "SSL: couldn't create a context!"); return CURLE_OUT_OF_MEMORY; } switch(SSL_CONN_CONFIG(version)) { case CURL_SSLVERSION_DEFAULT: case CURL_SSLVERSION_TLSv1: #if LIBWOLFSSL_VERSION_HEX > 0x03004006 /* > 3.4.6 */ /* Versions 3.3.0 to 3.4.6 we know the minimum protocol version is * whatever minimum version of TLS was built in and at least TLS 1.0. For * later library versions that could change (eg TLS 1.0 built in but * defaults to TLS 1.1) so we have this short circuit evaluation to find * the minimum supported TLS version. */ if((wolfSSL_CTX_SetMinVersion(backend->ctx, WOLFSSL_TLSV1) != 1) && (wolfSSL_CTX_SetMinVersion(backend->ctx, WOLFSSL_TLSV1_1) != 1) && (wolfSSL_CTX_SetMinVersion(backend->ctx, WOLFSSL_TLSV1_2) != 1) #ifdef WOLFSSL_TLS13 && (wolfSSL_CTX_SetMinVersion(backend->ctx, WOLFSSL_TLSV1_3) != 1) #endif ) { failf(data, "SSL: couldn't set the minimum protocol version"); return CURLE_SSL_CONNECT_ERROR; } #endif break; } ciphers = SSL_CONN_CONFIG(cipher_list); if(ciphers) { if(!SSL_CTX_set_cipher_list(backend->ctx, ciphers)) { failf(data, "failed setting cipher list: %s", ciphers); return CURLE_SSL_CIPHER; } infof(data, "Cipher selection: %s\n", ciphers); } #ifndef NO_FILESYSTEM /* load trusted cacert */ if(SSL_CONN_CONFIG(CAfile)) { if(1 != SSL_CTX_load_verify_locations(backend->ctx, SSL_CONN_CONFIG(CAfile), SSL_CONN_CONFIG(CApath))) { if(SSL_CONN_CONFIG(verifypeer)) { /* Fail if we insist on successfully verifying the server. */ failf(data, "error setting certificate verify locations:" " CAfile: %s CApath: %s", SSL_CONN_CONFIG(CAfile)? SSL_CONN_CONFIG(CAfile): "none", SSL_CONN_CONFIG(CApath)? SSL_CONN_CONFIG(CApath) : "none"); return CURLE_SSL_CACERT_BADFILE; } else { /* Just continue with a warning if no strict certificate verification is required. */ infof(data, "error setting certificate verify locations," " continuing anyway:\n"); } } else { /* Everything is fine. */ infof(data, "successfully set certificate verify locations:\n"); } infof(data, " CAfile: %s\n", SSL_CONN_CONFIG(CAfile) ? SSL_CONN_CONFIG(CAfile) : "none"); infof(data, " CApath: %s\n", SSL_CONN_CONFIG(CApath) ? SSL_CONN_CONFIG(CApath) : "none"); } /* Load the client certificate, and private key */ if(SSL_SET_OPTION(primary.clientcert) && SSL_SET_OPTION(key)) { int file_type = do_file_type(SSL_SET_OPTION(cert_type)); if(SSL_CTX_use_certificate_file(backend->ctx, SSL_SET_OPTION(primary.clientcert), file_type) != 1) { failf(data, "unable to use client certificate (no key or wrong pass" " phrase?)"); return CURLE_SSL_CONNECT_ERROR; } file_type = do_file_type(SSL_SET_OPTION(key_type)); if(SSL_CTX_use_PrivateKey_file(backend->ctx, SSL_SET_OPTION(key), file_type) != 1) { failf(data, "unable to set private key"); return CURLE_SSL_CONNECT_ERROR; } } #endif /* !NO_FILESYSTEM */ /* SSL always tries to verify the peer, this only says whether it should * fail to connect if the verification fails, or if it should continue * anyway. In the latter case the result of the verification is checked with * SSL_get_verify_result() below. */ SSL_CTX_set_verify(backend->ctx, SSL_CONN_CONFIG(verifypeer)?SSL_VERIFY_PEER: SSL_VERIFY_NONE, NULL); #ifdef HAVE_SNI if(sni) { struct in_addr addr4; #ifdef ENABLE_IPV6 struct in6_addr addr6; #endif #ifndef CURL_DISABLE_PROXY const char * const hostname = SSL_IS_PROXY() ? conn->http_proxy.host.name : conn->host.name; #else const char * const hostname = conn->host.name; #endif size_t hostname_len = strlen(hostname); if((hostname_len < USHRT_MAX) && (0 == Curl_inet_pton(AF_INET, hostname, &addr4)) && #ifdef ENABLE_IPV6 (0 == Curl_inet_pton(AF_INET6, hostname, &addr6)) && #endif (wolfSSL_CTX_UseSNI(backend->ctx, WOLFSSL_SNI_HOST_NAME, hostname, (unsigned short)hostname_len) != 1)) { infof(data, "WARNING: failed to configure server name indication (SNI) " "TLS extension\n"); } } #endif /* give application a chance to interfere with SSL set up. */ if(data->set.ssl.fsslctx) { CURLcode result = (*data->set.ssl.fsslctx)(data, backend->ctx, data->set.ssl.fsslctxp); if(result) { failf(data, "error signaled by ssl ctx callback"); return result; } } #ifdef NO_FILESYSTEM else if(SSL_CONN_CONFIG(verifypeer)) { failf(data, "SSL: Certificates can't be loaded because wolfSSL was built" " with \"no filesystem\". Either disable peer verification" " (insecure) or if you are building an application with libcurl you" " can load certificates via CURLOPT_SSL_CTX_FUNCTION."); return CURLE_SSL_CONNECT_ERROR; } #endif /* Let's make an SSL structure */ if(backend->handle) SSL_free(backend->handle); backend->handle = SSL_new(backend->ctx); if(!backend->handle) { failf(data, "SSL: couldn't create a context (handle)!"); return CURLE_OUT_OF_MEMORY; } #ifdef HAVE_ALPN if(conn->bits.tls_enable_alpn) { char protocols[128]; *protocols = '\0'; /* wolfSSL's ALPN protocol name list format is a comma separated string of protocols in descending order of preference, eg: "h2,http/1.1" */ #ifdef USE_NGHTTP2 if(data->state.httpversion >= CURL_HTTP_VERSION_2) { strcpy(protocols + strlen(protocols), NGHTTP2_PROTO_VERSION_ID ","); infof(data, "ALPN, offering %s\n", NGHTTP2_PROTO_VERSION_ID); } #endif strcpy(protocols + strlen(protocols), ALPN_HTTP_1_1); infof(data, "ALPN, offering %s\n", ALPN_HTTP_1_1); if(wolfSSL_UseALPN(backend->handle, protocols, (unsigned)strlen(protocols), WOLFSSL_ALPN_CONTINUE_ON_MISMATCH) != SSL_SUCCESS) { failf(data, "SSL: failed setting ALPN protocols"); return CURLE_SSL_CONNECT_ERROR; } } #endif /* HAVE_ALPN */ #ifdef OPENSSL_EXTRA if(Curl_tls_keylog_enabled()) { /* Ensure the Client Random is preserved. */ wolfSSL_KeepArrays(backend->handle); #if defined(HAVE_SECRET_CALLBACK) && defined(WOLFSSL_TLS13) wolfSSL_set_tls13_secret_cb(backend->handle, wolfssl_tls13_secret_callback, NULL); #endif } #endif /* OPENSSL_EXTRA */ #ifdef HAVE_SECURE_RENEGOTIATION if(wolfSSL_UseSecureRenegotiation(backend->handle) != SSL_SUCCESS) { failf(data, "SSL: failed setting secure renegotiation"); return CURLE_SSL_CONNECT_ERROR; } #endif /* HAVE_SECURE_RENEGOTIATION */ /* Check if there's a cached ID we can/should use here! */ if(SSL_SET_OPTION(primary.sessionid)) { void *ssl_sessionid = NULL; Curl_ssl_sessionid_lock(data); if(!Curl_ssl_getsessionid(data, conn, &ssl_sessionid, NULL, sockindex)) { /* we got a session id, use it! */ if(!SSL_set_session(backend->handle, ssl_sessionid)) { char error_buffer[WOLFSSL_MAX_ERROR_SZ]; Curl_ssl_sessionid_unlock(data); failf(data, "SSL: SSL_set_session failed: %s", ERR_error_string(SSL_get_error(backend->handle, 0), error_buffer)); return CURLE_SSL_CONNECT_ERROR; } /* Informational message */ infof(data, "SSL re-using session ID\n"); } Curl_ssl_sessionid_unlock(data); } /* pass the raw socket into the SSL layer */ if(!SSL_set_fd(backend->handle, (int)sockfd)) { failf(data, "SSL: SSL_set_fd failed"); return CURLE_SSL_CONNECT_ERROR; } connssl->connecting_state = ssl_connect_2; return CURLE_OK; }
1
402,916
string t_cpp_generator::namespace_open(string ns) { if (ns.size() == 0) { return ""; } string result = ""; string separator = ""; string::size_type loc; while ((loc = ns.find(".")) != string::npos) { result += separator; result += "namespace "; result += ns.substr(0, loc); result += " {"; separator = " "; ns = ns.substr(loc + 1); } if (ns.size() > 0) { result += separator + "namespace " + ns + " {"; } return result; }
0
285,110
Ins_ODD( INS_ARG ) { DO_ODD }
0
123,233
vrrp_netlink_cmd_rcv_bufs_force_handler(vector_t *strvec) { int res = true; if (!strvec) return; if (vector_size(strvec) >= 2) { res = check_true_false(strvec_slot(strvec,1)); if (res < 0) { report_config_error(CONFIG_GENERAL_ERROR, "Invalid value '%s' for global vrrp_netlink_cmd_rcv_bufs_force specified", FMT_STR_VSLOT(strvec, 1)); return; } } global_data->vrrp_netlink_cmd_rcv_bufs_force = res; }
0
116,289
static int x509_name_oneline(X509_NAME *a, char *buf, size_t size) { BIO *bio_out = BIO_new(BIO_s_mem()); BUF_MEM *biomem; int rc; if(!bio_out) return 1; /* alloc failed! */ rc = X509_NAME_print_ex(bio_out, a, 0, XN_FLAG_SEP_SPLUS_SPC); BIO_get_mem_ptr(bio_out, &biomem); if((size_t)biomem->length < size) size = biomem->length; else size--; /* don't overwrite the buffer end */ memcpy(buf, biomem->data, size); buf[size] = 0; BIO_free(bio_out); return !rc; }
0
389,426
void cgit_stats_link(const char *name, const char *title, const char *class, const char *head, const char *path) { reporevlink("stats", name, title, class, head, NULL, path); }
0
480,105
evdev_device_get_sysname(struct evdev_device *device) { return device->sysname; }
0
446,492
void virDomainHostdevDefFree(virDomainHostdevDefPtr def) { if (!def) return; /* free all subordinate objects */ virDomainHostdevDefClear(def); /* If there is a parentnet device object, it will handle freeing * the memory. */ if (!def->parentnet) VIR_FREE(def); }
0
506,781
static char *sapi_cli_server_read_cookies(TSRMLS_D) /* {{{ */ { php_cli_server_client *client = SG(server_context); char **val; if (FAILURE == zend_hash_find(&client->request.headers, "Cookie", sizeof("Cookie"), (void**)&val)) { return NULL; } return *val; } /* }}} */
0
323,258
static void i440fx_realize(PCIDevice *dev, Error **errp) { dev->config[I440FX_SMRAM] = 0x02; if (object_property_get_bool(qdev_get_machine(), "iommu", NULL)) { error_report("warning: i440fx doesn't support emulated iommu"); } }
0
496,837
TEST_P(Security, BuiltinAuthenticationAndCryptoPlugin_besteffort_submessage_large_string) { PubSubReader<StringType> reader(TEST_TOPIC_NAME); PubSubWriter<StringType> writer(TEST_TOPIC_NAME); PropertyPolicy pub_part_property_policy, sub_part_property_policy, pub_property_policy, sub_property_policy; sub_part_property_policy.properties().emplace_back(Property("dds.sec.auth.plugin", "builtin.PKI-DH")); sub_part_property_policy.properties().emplace_back(Property("dds.sec.auth.builtin.PKI-DH.identity_ca", "file://" + std::string(certs_path) + "/maincacert.pem")); sub_part_property_policy.properties().emplace_back(Property("dds.sec.auth.builtin.PKI-DH.identity_certificate", "file://" + std::string(certs_path) + "/mainsubcert.pem")); sub_part_property_policy.properties().emplace_back(Property("dds.sec.auth.builtin.PKI-DH.private_key", "file://" + std::string(certs_path) + "/mainsubkey.pem")); sub_part_property_policy.properties().emplace_back(Property("dds.sec.crypto.plugin", "builtin.AES-GCM-GMAC")); sub_property_policy.properties().emplace_back("rtps.endpoint.submessage_protection_kind", "ENCRYPT"); reader.history_depth(10). property_policy(sub_part_property_policy). entity_property_policy(sub_property_policy).init(); ASSERT_TRUE(reader.isInitialized()); pub_part_property_policy.properties().emplace_back(Property("dds.sec.auth.plugin", "builtin.PKI-DH")); pub_part_property_policy.properties().emplace_back(Property("dds.sec.auth.builtin.PKI-DH.identity_ca", "file://" + std::string(certs_path) + "/maincacert.pem")); pub_part_property_policy.properties().emplace_back(Property("dds.sec.auth.builtin.PKI-DH.identity_certificate", "file://" + std::string(certs_path) + "/mainpubcert.pem")); pub_part_property_policy.properties().emplace_back(Property("dds.sec.auth.builtin.PKI-DH.private_key", "file://" + std::string(certs_path) + "/mainpubkey.pem")); pub_part_property_policy.properties().emplace_back(Property("dds.sec.crypto.plugin", "builtin.AES-GCM-GMAC")); pub_property_policy.properties().emplace_back("rtps.endpoint.submessage_protection_kind", "ENCRYPT"); writer.history_depth(10). reliability(eprosima::fastrtps::BEST_EFFORT_RELIABILITY_QOS). property_policy(pub_part_property_policy). entity_property_policy(pub_property_policy).init(); ASSERT_TRUE(writer.isInitialized()); // Wait for authorization reader.waitAuthorized(); writer.waitAuthorized(); // Wait for discovery. writer.wait_discovery(); reader.wait_discovery(); auto data = default_large_string_data_generator(); reader.startReception(data); // Send data writer.send(data); // In this test all data should be sent. ASSERT_TRUE(data.empty()); // Block reader until reception finished or timeout. reader.block_for_at_least(2); }
0
117,089
static TEE_Result map_kinit(struct user_ta_ctx *utc __maybe_unused) { TEE_Result res; struct mobj *mobj; size_t offs; vaddr_t va; size_t sz; thread_get_user_kcode(&mobj, &offs, &va, &sz); if (sz) { res = vm_map(utc, &va, sz, TEE_MATTR_PRX | TEE_MATTR_PERMANENT, mobj, offs); if (res) return res; } thread_get_user_kdata(&mobj, &offs, &va, &sz); if (sz) return vm_map(utc, &va, sz, TEE_MATTR_PRW | TEE_MATTR_PERMANENT, mobj, offs); return TEE_SUCCESS; }
0
133,671
static void save_xattr_block(long long start, int offset) { struct hash_entry *hash_entry = malloc(sizeof(*hash_entry)); int hash = start & 0xffff; TRACE("save_xattr_block: start %lld, offset %d\n", start, offset); if(hash_entry == NULL) MEM_ERROR(); hash_entry->start = start; hash_entry->offset = offset; hash_entry->next = hash_table[hash]; hash_table[hash] = hash_entry; }
0
142,894
struct ares_addrinfo_node *ares__malloc_addrinfo_node() { struct ares_addrinfo_node *node = ares_malloc(sizeof(struct ares_addrinfo_node)); if (!node) return NULL; *node = empty_addrinfo_node; return node; }
0
389,362
PHP_FUNCTION(xmlrpc_encode_request) { XMLRPC_REQUEST xRequest = NULL; char *outBuf; zval *vals, *out_opts = NULL; char *method = NULL; size_t method_len; php_output_options out; if (zend_parse_parameters(ZEND_NUM_ARGS(), "s!z|a", &method, &method_len, &vals, &out_opts) == FAILURE) { return; } set_output_options(&out, out_opts ? out_opts : 0); if (USED_RET()) { xRequest = XMLRPC_RequestNew(); if (xRequest) { XMLRPC_RequestSetOutputOptions(xRequest, &out.xmlrpc_out); if (method == NULL) { XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_response); } else { XMLRPC_RequestSetMethodName(xRequest, method); XMLRPC_RequestSetRequestType(xRequest, xmlrpc_request_call); } if (Z_TYPE_P(vals) != IS_NULL) { XMLRPC_RequestSetData(xRequest, PHP_to_XMLRPC(vals)); } outBuf = XMLRPC_REQUEST_ToXML(xRequest, 0); if (outBuf) { RETVAL_STRING(outBuf); free(outBuf); } XMLRPC_RequestFree(xRequest, 1); } } if (strcmp(out.xmlrpc_out.xml_elem_opts.encoding, ENCODING_DEFAULT) != 0) { efree((char *)out.xmlrpc_out.xml_elem_opts.encoding); } }
0
415,723
int vbin_printf(u32 *bin_buf, size_t size, const char *fmt, va_list args) { struct printf_spec spec = {0}; char *str, *end; str = (char *)bin_buf; end = (char *)(bin_buf + size); #define save_arg(type) \ do { \ if (sizeof(type) == 8) { \ unsigned long long value; \ str = PTR_ALIGN(str, sizeof(u32)); \ value = va_arg(args, unsigned long long); \ if (str + sizeof(type) <= end) { \ *(u32 *)str = *(u32 *)&value; \ *(u32 *)(str + 4) = *((u32 *)&value + 1); \ } \ } else { \ unsigned long value; \ str = PTR_ALIGN(str, sizeof(type)); \ value = va_arg(args, int); \ if (str + sizeof(type) <= end) \ *(typeof(type) *)str = (type)value; \ } \ str += sizeof(type); \ } while (0) while (*fmt) { int read = format_decode(fmt, &spec); fmt += read; switch (spec.type) { case FORMAT_TYPE_NONE: case FORMAT_TYPE_PERCENT_CHAR: break; case FORMAT_TYPE_INVALID: goto out; case FORMAT_TYPE_WIDTH: case FORMAT_TYPE_PRECISION: save_arg(int); break; case FORMAT_TYPE_CHAR: save_arg(char); break; case FORMAT_TYPE_STR: { const char *save_str = va_arg(args, char *); size_t len; if ((unsigned long)save_str > (unsigned long)-PAGE_SIZE || (unsigned long)save_str < PAGE_SIZE) save_str = "(null)"; len = strlen(save_str) + 1; if (str + len < end) memcpy(str, save_str, len); str += len; break; } case FORMAT_TYPE_PTR: save_arg(void *); /* skip all alphanumeric pointer suffixes */ while (isalnum(*fmt)) fmt++; break; default: switch (spec.type) { case FORMAT_TYPE_LONG_LONG: save_arg(long long); break; case FORMAT_TYPE_ULONG: case FORMAT_TYPE_LONG: save_arg(unsigned long); break; case FORMAT_TYPE_SIZE_T: save_arg(size_t); break; case FORMAT_TYPE_PTRDIFF: save_arg(ptrdiff_t); break; case FORMAT_TYPE_UBYTE: case FORMAT_TYPE_BYTE: save_arg(char); break; case FORMAT_TYPE_USHORT: case FORMAT_TYPE_SHORT: save_arg(short); break; default: save_arg(int); } } } out: return (u32 *)(PTR_ALIGN(str, sizeof(u32))) - bin_buf; #undef save_arg }
0
28,159
static void libschroedinger_flush ( AVCodecContext * avctx ) { SchroDecoderParams * p_schro_params = avctx -> priv_data ; ff_schro_queue_free ( & p_schro_params -> dec_frame_queue , libschroedinger_decode_frame_free ) ; ff_schro_queue_init ( & p_schro_params -> dec_frame_queue ) ; schro_decoder_reset ( p_schro_params -> decoder ) ; p_schro_params -> eos_pulled = 0 ; p_schro_params -> eos_signalled = 0 ; }
0
322,202
static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) { AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0); AVFilterContext *ctx = inlink->dst; OverlayContext *over = ctx->priv; av_unused AVFilterLink *outlink = ctx->outputs[0]; inlink->dst->outputs[0]->out_buf = outpicref; outpicref->pts = av_rescale_q(outpicref->pts, ctx->inputs[MAIN]->time_base, ctx->outputs[0]->time_base); if (!over->overpicref || over->overpicref->pts < outpicref->pts) { if (!over->overpicref_next) avfilter_request_frame(ctx->inputs[OVERLAY]); if (over->overpicref && over->overpicref_next && over->overpicref_next->pts <= outpicref->pts) { avfilter_unref_buffer(over->overpicref); over->overpicref = over->overpicref_next; over->overpicref_next = NULL; } } av_dlog(ctx, "main_pts:%s main_pts_time:%s", av_ts2str(outpicref->pts), av_ts2timestr(outpicref->pts, &outlink->time_base)); if (over->overpicref) av_dlog(ctx, " over_pts:%s over_pts_time:%s", av_ts2str(over->overpicref->pts), av_ts2timestr(over->overpicref->pts, &outlink->time_base)); av_dlog(ctx, "\n"); avfilter_start_frame(inlink->dst->outputs[0], outpicref); }
1
238,720
void CSoundFile::ExtraFinePortamentoDown(ModChannel *pChn, ModCommand::PARAM param) const { if(GetType() == MOD_TYPE_XM) { if(param) pChn->nOldExtraFinePortaUpDown = (pChn->nOldExtraFinePortaUpDown & 0xF0) | (param & 0x0F); else param = (pChn->nOldExtraFinePortaUpDown & 0x0F); } else if(GetType() == MOD_TYPE_MT2) { if(param) pChn->nOldFinePortaUpDown = param; else param = pChn->nOldFinePortaUpDown; } if(pChn->isFirstTick) { if ((pChn->nPeriod) && (param)) { if(m_SongFlags[SONG_LINEARSLIDES] && GetType() != MOD_TYPE_XM) { int oldPeriod = pChn->nPeriod; pChn->nPeriod = Util::muldivr(pChn->nPeriod, GetFineLinearSlideDownTable(this, param & 0x0F), 65536); if(oldPeriod == pChn->nPeriod) pChn->nPeriod--; } else { pChn->nPeriod += (int)(param); if (pChn->nPeriod > 0xFFFF) pChn->nPeriod = 0xFFFF; } } } }
0
129,753
cockpit_web_response_gerror (CockpitWebResponse *self, GHashTable *headers, GError *error) { int code; g_return_if_fail (COCKPIT_IS_WEB_RESPONSE (self)); if (g_error_matches (error, COCKPIT_ERROR, COCKPIT_ERROR_AUTHENTICATION_FAILED)) code = 401; else if (g_error_matches (error, COCKPIT_ERROR, COCKPIT_ERROR_PERMISSION_DENIED)) code = 403; else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_INVALID_DATA)) code = 400; else if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_NO_SPACE)) code = 413; else code = 500; cockpit_web_response_error (self, code, headers, "%s", error->message); }
0
3,634
buf_copy_options(buf_T *buf, int flags) { int should_copy = TRUE; char_u *save_p_isk = NULL; // init for GCC int dont_do_help; int did_isk = FALSE; /* * Skip this when the option defaults have not been set yet. Happens when * main() allocates the first buffer. */ if (p_cpo != NULL) { /* * Always copy when entering and 'cpo' contains 'S'. * Don't copy when already initialized. * Don't copy when 'cpo' contains 's' and not entering. * 'S' BCO_ENTER initialized 's' should_copy * yes yes X X TRUE * yes no yes X FALSE * no X yes X FALSE * X no no yes FALSE * X no no no TRUE * no yes no X TRUE */ if ((vim_strchr(p_cpo, CPO_BUFOPTGLOB) == NULL || !(flags & BCO_ENTER)) && (buf->b_p_initialized || (!(flags & BCO_ENTER) && vim_strchr(p_cpo, CPO_BUFOPT) != NULL))) should_copy = FALSE; if (should_copy || (flags & BCO_ALWAYS)) { #ifdef FEAT_EVAL CLEAR_FIELD(buf->b_p_script_ctx); init_buf_opt_idx(); #endif // Don't copy the options specific to a help buffer when // BCO_NOHELP is given or the options were initialized already // (jumping back to a help file with CTRL-T or CTRL-O) dont_do_help = ((flags & BCO_NOHELP) && buf->b_help) || buf->b_p_initialized; if (dont_do_help) // don't free b_p_isk { save_p_isk = buf->b_p_isk; buf->b_p_isk = NULL; } /* * Always free the allocated strings. If not already initialized, * reset 'readonly' and copy 'fileformat'. */ if (!buf->b_p_initialized) { free_buf_options(buf, TRUE); buf->b_p_ro = FALSE; // don't copy readonly buf->b_p_tx = p_tx; buf->b_p_fenc = vim_strsave(p_fenc); switch (*p_ffs) { case 'm': buf->b_p_ff = vim_strsave((char_u *)FF_MAC); break; case 'd': buf->b_p_ff = vim_strsave((char_u *)FF_DOS); break; case 'u': buf->b_p_ff = vim_strsave((char_u *)FF_UNIX); break; default: buf->b_p_ff = vim_strsave(p_ff); } if (buf->b_p_ff != NULL) buf->b_start_ffc = *buf->b_p_ff; buf->b_p_bh = empty_option; buf->b_p_bt = empty_option; } else free_buf_options(buf, FALSE); buf->b_p_ai = p_ai; COPY_OPT_SCTX(buf, BV_AI); buf->b_p_ai_nopaste = p_ai_nopaste; buf->b_p_sw = p_sw; COPY_OPT_SCTX(buf, BV_SW); buf->b_p_tw = p_tw; COPY_OPT_SCTX(buf, BV_TW); buf->b_p_tw_nopaste = p_tw_nopaste; buf->b_p_tw_nobin = p_tw_nobin; buf->b_p_wm = p_wm; COPY_OPT_SCTX(buf, BV_WM); buf->b_p_wm_nopaste = p_wm_nopaste; buf->b_p_wm_nobin = p_wm_nobin; buf->b_p_bin = p_bin; COPY_OPT_SCTX(buf, BV_BIN); buf->b_p_bomb = p_bomb; COPY_OPT_SCTX(buf, BV_BOMB); buf->b_p_fixeol = p_fixeol; COPY_OPT_SCTX(buf, BV_FIXEOL); buf->b_p_et = p_et; COPY_OPT_SCTX(buf, BV_ET); buf->b_p_et_nobin = p_et_nobin; buf->b_p_et_nopaste = p_et_nopaste; buf->b_p_ml = p_ml; COPY_OPT_SCTX(buf, BV_ML); buf->b_p_ml_nobin = p_ml_nobin; buf->b_p_inf = p_inf; COPY_OPT_SCTX(buf, BV_INF); if (cmdmod.cmod_flags & CMOD_NOSWAPFILE) buf->b_p_swf = FALSE; else { buf->b_p_swf = p_swf; COPY_OPT_SCTX(buf, BV_SWF); } buf->b_p_cpt = vim_strsave(p_cpt); COPY_OPT_SCTX(buf, BV_CPT); #ifdef BACKSLASH_IN_FILENAME buf->b_p_csl = vim_strsave(p_csl); COPY_OPT_SCTX(buf, BV_CSL); #endif #ifdef FEAT_COMPL_FUNC buf->b_p_cfu = vim_strsave(p_cfu); COPY_OPT_SCTX(buf, BV_CFU); set_buflocal_cfu_callback(buf); buf->b_p_ofu = vim_strsave(p_ofu); COPY_OPT_SCTX(buf, BV_OFU); set_buflocal_ofu_callback(buf); #endif #ifdef FEAT_EVAL buf->b_p_tfu = vim_strsave(p_tfu); COPY_OPT_SCTX(buf, BV_TFU); set_buflocal_tfu_callback(buf); #endif buf->b_p_sts = p_sts; COPY_OPT_SCTX(buf, BV_STS); buf->b_p_sts_nopaste = p_sts_nopaste; #ifdef FEAT_VARTABS buf->b_p_vsts = vim_strsave(p_vsts); COPY_OPT_SCTX(buf, BV_VSTS); if (p_vsts && p_vsts != empty_option) (void)tabstop_set(p_vsts, &buf->b_p_vsts_array); else buf->b_p_vsts_array = 0; buf->b_p_vsts_nopaste = p_vsts_nopaste ? vim_strsave(p_vsts_nopaste) : NULL; #endif buf->b_p_sn = p_sn; COPY_OPT_SCTX(buf, BV_SN); buf->b_p_com = vim_strsave(p_com); COPY_OPT_SCTX(buf, BV_COM); #ifdef FEAT_FOLDING buf->b_p_cms = vim_strsave(p_cms); COPY_OPT_SCTX(buf, BV_CMS); #endif buf->b_p_fo = vim_strsave(p_fo); COPY_OPT_SCTX(buf, BV_FO); buf->b_p_flp = vim_strsave(p_flp); COPY_OPT_SCTX(buf, BV_FLP); // NOTE: Valgrind may report a bogus memory leak for 'nrformats' // when it is set to 8 bytes in defaults.vim. buf->b_p_nf = vim_strsave(p_nf); COPY_OPT_SCTX(buf, BV_NF); buf->b_p_mps = vim_strsave(p_mps); COPY_OPT_SCTX(buf, BV_MPS); #ifdef FEAT_SMARTINDENT buf->b_p_si = p_si; COPY_OPT_SCTX(buf, BV_SI); #endif buf->b_p_ci = p_ci; COPY_OPT_SCTX(buf, BV_CI); #ifdef FEAT_CINDENT buf->b_p_cin = p_cin; COPY_OPT_SCTX(buf, BV_CIN); buf->b_p_cink = vim_strsave(p_cink); COPY_OPT_SCTX(buf, BV_CINK); buf->b_p_cino = vim_strsave(p_cino); COPY_OPT_SCTX(buf, BV_CINO); #endif // Don't copy 'filetype', it must be detected buf->b_p_ft = empty_option; buf->b_p_pi = p_pi; COPY_OPT_SCTX(buf, BV_PI); #if defined(FEAT_SMARTINDENT) || defined(FEAT_CINDENT) buf->b_p_cinw = vim_strsave(p_cinw); COPY_OPT_SCTX(buf, BV_CINW); #endif #ifdef FEAT_LISP buf->b_p_lisp = p_lisp; COPY_OPT_SCTX(buf, BV_LISP); #endif #ifdef FEAT_SYN_HL // Don't copy 'syntax', it must be set buf->b_p_syn = empty_option; buf->b_p_smc = p_smc; COPY_OPT_SCTX(buf, BV_SMC); buf->b_s.b_syn_isk = empty_option; #endif #ifdef FEAT_SPELL buf->b_s.b_p_spc = vim_strsave(p_spc); COPY_OPT_SCTX(buf, BV_SPC); (void)compile_cap_prog(&buf->b_s); buf->b_s.b_p_spf = vim_strsave(p_spf); COPY_OPT_SCTX(buf, BV_SPF); buf->b_s.b_p_spl = vim_strsave(p_spl); COPY_OPT_SCTX(buf, BV_SPL); buf->b_s.b_p_spo = vim_strsave(p_spo); COPY_OPT_SCTX(buf, BV_SPO); #endif #if defined(FEAT_CINDENT) && defined(FEAT_EVAL) buf->b_p_inde = vim_strsave(p_inde); COPY_OPT_SCTX(buf, BV_INDE); buf->b_p_indk = vim_strsave(p_indk); COPY_OPT_SCTX(buf, BV_INDK); #endif buf->b_p_fp = empty_option; #if defined(FEAT_EVAL) buf->b_p_fex = vim_strsave(p_fex); COPY_OPT_SCTX(buf, BV_FEX); #endif #ifdef FEAT_CRYPT buf->b_p_key = vim_strsave(p_key); COPY_OPT_SCTX(buf, BV_KEY); #endif #ifdef FEAT_SEARCHPATH buf->b_p_sua = vim_strsave(p_sua); COPY_OPT_SCTX(buf, BV_SUA); #endif #ifdef FEAT_KEYMAP buf->b_p_keymap = vim_strsave(p_keymap); COPY_OPT_SCTX(buf, BV_KMAP); buf->b_kmap_state |= KEYMAP_INIT; #endif #ifdef FEAT_TERMINAL buf->b_p_twsl = p_twsl; COPY_OPT_SCTX(buf, BV_TWSL); #endif // This isn't really an option, but copying the langmap and IME // state from the current buffer is better than resetting it. buf->b_p_iminsert = p_iminsert; COPY_OPT_SCTX(buf, BV_IMI); buf->b_p_imsearch = p_imsearch; COPY_OPT_SCTX(buf, BV_IMS); // options that are normally global but also have a local value // are not copied, start using the global value buf->b_p_ar = -1; buf->b_p_ul = NO_LOCAL_UNDOLEVEL; buf->b_p_bkc = empty_option; buf->b_bkc_flags = 0; #ifdef FEAT_QUICKFIX buf->b_p_gp = empty_option; buf->b_p_mp = empty_option; buf->b_p_efm = empty_option; #endif buf->b_p_ep = empty_option; buf->b_p_kp = empty_option; buf->b_p_path = empty_option; buf->b_p_tags = empty_option; buf->b_p_tc = empty_option; buf->b_tc_flags = 0; #ifdef FEAT_FIND_ID buf->b_p_def = empty_option; buf->b_p_inc = empty_option; # ifdef FEAT_EVAL buf->b_p_inex = vim_strsave(p_inex); COPY_OPT_SCTX(buf, BV_INEX); # endif #endif buf->b_p_dict = empty_option; buf->b_p_tsr = empty_option; #ifdef FEAT_COMPL_FUNC buf->b_p_tsrfu = empty_option; #endif #ifdef FEAT_TEXTOBJ buf->b_p_qe = vim_strsave(p_qe); COPY_OPT_SCTX(buf, BV_QE); #endif #if defined(FEAT_BEVAL) && defined(FEAT_EVAL) buf->b_p_bexpr = empty_option; #endif #if defined(FEAT_CRYPT) buf->b_p_cm = empty_option; #endif #ifdef FEAT_PERSISTENT_UNDO buf->b_p_udf = p_udf; COPY_OPT_SCTX(buf, BV_UDF); #endif #ifdef FEAT_LISP buf->b_p_lw = empty_option; #endif buf->b_p_menc = empty_option; /* * Don't copy the options set by ex_help(), use the saved values, * when going from a help buffer to a non-help buffer. * Don't touch these at all when BCO_NOHELP is used and going from * or to a help buffer. */ if (dont_do_help) { buf->b_p_isk = save_p_isk; #ifdef FEAT_VARTABS if (p_vts && p_vts != empty_option && !buf->b_p_vts_array) (void)tabstop_set(p_vts, &buf->b_p_vts_array); else buf->b_p_vts_array = NULL; #endif } else { buf->b_p_isk = vim_strsave(p_isk); COPY_OPT_SCTX(buf, BV_ISK); did_isk = TRUE; buf->b_p_ts = p_ts; COPY_OPT_SCTX(buf, BV_TS); #ifdef FEAT_VARTABS buf->b_p_vts = vim_strsave(p_vts); COPY_OPT_SCTX(buf, BV_VTS); if (p_vts && p_vts != empty_option && !buf->b_p_vts_array) (void)tabstop_set(p_vts, &buf->b_p_vts_array); else buf->b_p_vts_array = NULL; #endif buf->b_help = FALSE; if (buf->b_p_bt[0] == 'h') clear_string_option(&buf->b_p_bt); buf->b_p_ma = p_ma; COPY_OPT_SCTX(buf, BV_MA); } } /* * When the options should be copied (ignoring BCO_ALWAYS), set the * flag that indicates that the options have been initialized. */ if (should_copy) buf->b_p_initialized = TRUE; } check_buf_options(buf); // make sure we don't have NULLs if (did_isk) (void)buf_init_chartab(buf, FALSE); }
1
376,337
int rt6_route_rcv(struct net_device *dev, u8 *opt, int len, const struct in6_addr *gwaddr) { struct net *net = dev_net(dev); struct route_info *rinfo = (struct route_info *) opt; struct in6_addr prefix_buf, *prefix; unsigned int pref; unsigned long lifetime; struct rt6_info *rt; if (len < sizeof(struct route_info)) { return -EINVAL; } /* Sanity check for prefix_len and length */ if (rinfo->length > 3) { return -EINVAL; } else if (rinfo->prefix_len > 128) { return -EINVAL; } else if (rinfo->prefix_len > 64) { if (rinfo->length < 2) { return -EINVAL; } } else if (rinfo->prefix_len > 0) { if (rinfo->length < 1) { return -EINVAL; } } pref = rinfo->route_pref; if (pref == ICMPV6_ROUTER_PREF_INVALID) return -EINVAL; lifetime = addrconf_timeout_fixup(ntohl(rinfo->lifetime), HZ); if (rinfo->length == 3) prefix = (struct in6_addr *)rinfo->prefix; else { /* this function is safe */ ipv6_addr_prefix(&prefix_buf, (struct in6_addr *)rinfo->prefix, rinfo->prefix_len); prefix = &prefix_buf; } if (rinfo->prefix_len == 0) rt = rt6_get_dflt_router(gwaddr, dev); else rt = rt6_get_route_info(net, prefix, rinfo->prefix_len, gwaddr, dev->ifindex); if (rt && !lifetime) { ip6_del_rt(rt); rt = NULL; } if (!rt && lifetime) rt = rt6_add_route_info(net, prefix, rinfo->prefix_len, gwaddr, dev->ifindex, pref); else if (rt) rt->rt6i_flags = RTF_ROUTEINFO | (rt->rt6i_flags & ~RTF_PREF_MASK) | RTF_PREF(pref); if (rt) { if (!addrconf_finite_timeout(lifetime)) rt6_clean_expires(rt); else rt6_set_expires(rt, jiffies + HZ * lifetime); ip6_rt_put(rt); } return 0; }
0
164,652
void DevToolsWindow::InspectElementCompleted() { if (!inspect_element_start_time_.is_null()) { UMA_HISTOGRAM_TIMES("DevTools.InspectElement", base::TimeTicks::Now() - inspect_element_start_time_); inspect_element_start_time_ = base::TimeTicks(); } }
0
470,194
static void svm_sched_in(struct kvm_vcpu *vcpu, int cpu) { if (!kvm_pause_in_guest(vcpu->kvm)) shrink_ple_window(vcpu); }
0
338,960
static av_cold int cook_decode_init(AVCodecContext *avctx) { COOKContext *q = avctx->priv_data; const uint8_t *edata_ptr = avctx->extradata; const uint8_t *edata_ptr_end = edata_ptr + avctx->extradata_size; int extradata_size = avctx->extradata_size; int s = 0; unsigned int channel_mask = 0; int samples_per_frame; int ret; q->avctx = avctx; /* Take care of the codec specific extradata. */ if (extradata_size < 8) { av_log(avctx, AV_LOG_ERROR, "Necessary extradata missing!\n"); return AVERROR_INVALIDDATA; } av_log(avctx, AV_LOG_DEBUG, "codecdata_length=%d\n", avctx->extradata_size); /* Take data from the AVCodecContext (RM container). */ if (!avctx->channels) { av_log(avctx, AV_LOG_ERROR, "Invalid number of channels\n"); return AVERROR_INVALIDDATA; } /* Initialize RNG. */ av_lfg_init(&q->random_state, 0); ff_audiodsp_init(&q->adsp); while (edata_ptr < edata_ptr_end) { /* 8 for mono, 16 for stereo, ? for multichannel Swap to right endianness so we don't need to care later on. */ if (extradata_size >= 8) { q->subpacket[s].cookversion = bytestream_get_be32(&edata_ptr); samples_per_frame = bytestream_get_be16(&edata_ptr); q->subpacket[s].subbands = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } if (extradata_size >= 8) { bytestream_get_be32(&edata_ptr); // Unknown unused q->subpacket[s].js_subband_start = bytestream_get_be16(&edata_ptr); q->subpacket[s].js_vlc_bits = bytestream_get_be16(&edata_ptr); extradata_size -= 8; } /* Initialize extradata related variables. */ q->subpacket[s].samples_per_channel = samples_per_frame / avctx->channels; q->subpacket[s].bits_per_subpacket = avctx->block_align * 8; /* Initialize default data states. */ q->subpacket[s].log2_numvector_size = 5; q->subpacket[s].total_subbands = q->subpacket[s].subbands; q->subpacket[s].num_channels = 1; /* Initialize version-dependent variables */ av_log(avctx, AV_LOG_DEBUG, "subpacket[%i].cookversion=%x\n", s, q->subpacket[s].cookversion); q->subpacket[s].joint_stereo = 0; switch (q->subpacket[s].cookversion) { case MONO: if (avctx->channels != 1) { avpriv_request_sample(avctx, "Container channels != 1"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "MONO\n"); break; case STEREO: if (avctx->channels != 1) { q->subpacket[s].bits_per_subpdiv = 1; q->subpacket[s].num_channels = 2; } av_log(avctx, AV_LOG_DEBUG, "STEREO\n"); break; case JOINT_STEREO: if (avctx->channels != 2) { avpriv_request_sample(avctx, "Container channels != 2"); return AVERROR_PATCHWELCOME; } av_log(avctx, AV_LOG_DEBUG, "JOINT_STEREO\n"); if (avctx->extradata_size >= 16) { q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; q->subpacket[s].joint_stereo = 1; q->subpacket[s].num_channels = 2; } if (q->subpacket[s].samples_per_channel > 256) { q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { q->subpacket[s].log2_numvector_size = 7; } break; case MC_COOK: av_log(avctx, AV_LOG_DEBUG, "MULTI_CHANNEL\n"); if (extradata_size >= 4) channel_mask |= q->subpacket[s].channel_mask = bytestream_get_be32(&edata_ptr); if (av_get_channel_layout_nb_channels(q->subpacket[s].channel_mask) > 1) { q->subpacket[s].total_subbands = q->subpacket[s].subbands + q->subpacket[s].js_subband_start; q->subpacket[s].joint_stereo = 1; q->subpacket[s].num_channels = 2; q->subpacket[s].samples_per_channel = samples_per_frame >> 1; if (q->subpacket[s].samples_per_channel > 256) { q->subpacket[s].log2_numvector_size = 6; } if (q->subpacket[s].samples_per_channel > 512) { q->subpacket[s].log2_numvector_size = 7; } } else q->subpacket[s].samples_per_channel = samples_per_frame; break; default: avpriv_request_sample(avctx, "Cook version %d", q->subpacket[s].cookversion); return AVERROR_PATCHWELCOME; } if (s > 1 && q->subpacket[s].samples_per_channel != q->samples_per_channel) { av_log(avctx, AV_LOG_ERROR, "different number of samples per channel!\n"); return AVERROR_INVALIDDATA; } else q->samples_per_channel = q->subpacket[0].samples_per_channel; /* Initialize variable relations */ q->subpacket[s].numvector_size = (1 << q->subpacket[s].log2_numvector_size); /* Try to catch some obviously faulty streams, otherwise it might be exploitable */ if (q->subpacket[s].total_subbands > 53) { avpriv_request_sample(avctx, "total_subbands > 53"); return AVERROR_PATCHWELCOME; } if ((q->subpacket[s].js_vlc_bits > 6) || (q->subpacket[s].js_vlc_bits < 2 * q->subpacket[s].joint_stereo)) { av_log(avctx, AV_LOG_ERROR, "js_vlc_bits = %d, only >= %d and <= 6 allowed!\n", q->subpacket[s].js_vlc_bits, 2 * q->subpacket[s].joint_stereo); return AVERROR_INVALIDDATA; } if (q->subpacket[s].subbands > 50) { avpriv_request_sample(avctx, "subbands > 50"); return AVERROR_PATCHWELCOME; } q->subpacket[s].gains1.now = q->subpacket[s].gain_1; q->subpacket[s].gains1.previous = q->subpacket[s].gain_2; q->subpacket[s].gains2.now = q->subpacket[s].gain_3; q->subpacket[s].gains2.previous = q->subpacket[s].gain_4; q->num_subpackets++; s++; if (s > MAX_SUBPACKETS) { avpriv_request_sample(avctx, "subpackets > %d", MAX_SUBPACKETS); return AVERROR_PATCHWELCOME; } } /* Generate tables */ init_pow2table(); init_gain_table(q); init_cplscales_table(q); if ((ret = init_cook_vlc_tables(q))) return ret; if (avctx->block_align >= UINT_MAX / 2) return AVERROR(EINVAL); /* Pad the databuffer with: DECODE_BYTES_PAD1 or DECODE_BYTES_PAD2 for decode_bytes(), AV_INPUT_BUFFER_PADDING_SIZE, for the bitstreamreader. */ q->decoded_bytes_buffer = av_mallocz(avctx->block_align + DECODE_BYTES_PAD1(avctx->block_align) + AV_INPUT_BUFFER_PADDING_SIZE); if (!q->decoded_bytes_buffer) return AVERROR(ENOMEM); /* Initialize transform. */ if ((ret = init_cook_mlt(q))) return ret; /* Initialize COOK signal arithmetic handling */ if (1) { q->scalar_dequant = scalar_dequant_float; q->decouple = decouple_float; q->imlt_window = imlt_window_float; q->interpolate = interpolate_float; q->saturate_output = saturate_output_float; } /* Try to catch some obviously faulty streams, otherwise it might be exploitable */ if (q->samples_per_channel != 256 && q->samples_per_channel != 512 && q->samples_per_channel != 1024) { avpriv_request_sample(avctx, "samples_per_channel = %d", q->samples_per_channel); return AVERROR_PATCHWELCOME; } avctx->sample_fmt = AV_SAMPLE_FMT_FLTP; if (channel_mask) avctx->channel_layout = channel_mask; else avctx->channel_layout = (avctx->channels == 2) ? AV_CH_LAYOUT_STEREO : AV_CH_LAYOUT_MONO; #ifdef DEBUG dump_cook_context(q); #endif return 0; }
1
326,762
static int decode_ext_header(Wmv2Context *w){ MpegEncContext * const s= &w->s; GetBitContext gb; int fps; int code; if(s->avctx->extradata_size<4) return -1; init_get_bits(&gb, s->avctx->extradata, s->avctx->extradata_size*8); fps = get_bits(&gb, 5); s->bit_rate = get_bits(&gb, 11)*1024; w->mspel_bit = get_bits1(&gb); w->flag3 = get_bits1(&gb); w->abt_flag = get_bits1(&gb); w->j_type_bit = get_bits1(&gb); w->top_left_mv_flag= get_bits1(&gb); w->per_mb_rl_bit = get_bits1(&gb); code = get_bits(&gb, 3); if(code==0) return -1; s->slice_height = s->mb_height / code; if(s->avctx->debug&FF_DEBUG_PICT_INFO){ av_log(s->avctx, AV_LOG_DEBUG, "fps:%d, br:%d, qpbit:%d, abt_flag:%d, j_type_bit:%d, tl_mv_flag:%d, mbrl_bit:%d, code:%d, flag3:%d, slices:%d\n", fps, s->bit_rate, w->mspel_bit, w->abt_flag, w->j_type_bit, w->top_left_mv_flag, w->per_mb_rl_bit, code, w->flag3, code); } return 0; }
0
278,450
bool BrowserCommandController::IsShowingMainUI() { return browser_->SupportsWindowFeature(Browser::FEATURE_TABSTRIP); }
0
168,545
void Browser::OpenOptionsDialog() { UserMetrics::RecordAction(UserMetricsAction("ShowOptions")); ShowOptionsTab(""); }
0
334,117
static void test_visitor_in_native_list_number(TestInputVisitorData *data, const void *unused) { UserDefNativeListUnion *cvalue = NULL; numberList *elem = NULL; Error *err = NULL; Visitor *v; GString *gstr_list = g_string_new(""); GString *gstr_union = g_string_new(""); int i; for (i = 0; i < 32; i++) { g_string_append_printf(gstr_list, "%f", (double)i / 3); if (i != 31) { g_string_append(gstr_list, ", "); } } g_string_append_printf(gstr_union, "{ 'type': 'number', 'data': [ %s ] }", gstr_list->str); v = visitor_input_test_init_raw(data, gstr_union->str); visit_type_UserDefNativeListUnion(v, &cvalue, NULL, &err); g_assert(err == NULL); g_assert(cvalue != NULL); g_assert_cmpint(cvalue->type, ==, USER_DEF_NATIVE_LIST_UNION_KIND_NUMBER); for (i = 0, elem = cvalue->u.number; elem; elem = elem->next, i++) { GString *double_expected = g_string_new(""); GString *double_actual = g_string_new(""); g_string_printf(double_expected, "%.6f", (double)i / 3); g_string_printf(double_actual, "%.6f", elem->value); g_assert_cmpstr(double_expected->str, ==, double_actual->str); g_string_free(double_expected, true); g_string_free(double_actual, true); } g_string_free(gstr_union, true); g_string_free(gstr_list, true); qapi_free_UserDefNativeListUnion(cvalue); }
0
67,308
static void xen_netbk_tx_submit(struct xen_netbk *netbk) { struct gnttab_copy *gop = netbk->tx_copy_ops; struct sk_buff *skb; while ((skb = __skb_dequeue(&netbk->tx_queue)) != NULL) { struct xen_netif_tx_request *txp; struct xenvif *vif; u16 pending_idx; unsigned data_len; pending_idx = *((u16 *)skb->data); vif = netbk->pending_tx_info[pending_idx].vif; txp = &netbk->pending_tx_info[pending_idx].req; /* Check the remap error code. */ if (unlikely(xen_netbk_tx_check_gop(netbk, skb, &gop))) { netdev_dbg(vif->dev, "netback grant failed.\n"); skb_shinfo(skb)->nr_frags = 0; kfree_skb(skb); continue; } data_len = skb->len; memcpy(skb->data, (void *)(idx_to_kaddr(netbk, pending_idx)|txp->offset), data_len); if (data_len < txp->size) { /* Append the packet payload as a fragment. */ txp->offset += data_len; txp->size -= data_len; } else { /* Schedule a response immediately. */ xen_netbk_idx_release(netbk, pending_idx, XEN_NETIF_RSP_OKAY); } if (txp->flags & XEN_NETTXF_csum_blank) skb->ip_summed = CHECKSUM_PARTIAL; else if (txp->flags & XEN_NETTXF_data_validated) skb->ip_summed = CHECKSUM_UNNECESSARY; xen_netbk_fill_frags(netbk, skb); /* * If the initial fragment was < PKT_PROT_LEN then * pull through some bytes from the other fragments to * increase the linear region to PKT_PROT_LEN bytes. */ if (skb_headlen(skb) < PKT_PROT_LEN && skb_is_nonlinear(skb)) { int target = min_t(int, skb->len, PKT_PROT_LEN); __pskb_pull_tail(skb, target - skb_headlen(skb)); } skb->dev = vif->dev; skb->protocol = eth_type_trans(skb, skb->dev); if (checksum_setup(vif, skb)) { netdev_dbg(vif->dev, "Can't setup checksum in net_tx_action\n"); kfree_skb(skb); continue; } vif->dev->stats.rx_bytes += skb->len; vif->dev->stats.rx_packets++; xenvif_receive_skb(vif, skb); } }
0
137,895
flatpak_filesystem_key_in_home (const char *filesystem) { /* "home" is definitely in home */ if (strcmp (filesystem, "home") == 0) return TRUE; /* All the other special fs:es are non-home. * Note: This considers absolute paths that are in the homedir as non-home. */ if (g_strv_contains (flatpak_context_special_filesystems, filesystem) || g_str_has_prefix (filesystem, "/")) return FALSE; /* Files in xdg-run are not in home */ if (g_str_has_prefix (filesystem, "xdg-run")) return FALSE; /* All remaining keys (~/, xdg-data, etc) are considered in home, * Note: technically $XDG_HOME_DATA could point outside the homedir, but we ignore that. */ return TRUE; }
0
8,864
trustedGenDkgSecretAES(int *errStatus, char *errString, uint8_t *encrypted_dkg_secret, uint32_t *enc_len, size_t _t) { LOG_INFO(__FUNCTION__); INIT_ERROR_STATE CHECK_STATE(encrypted_dkg_secret); SAFE_CHAR_BUF(dkg_secret, DKG_BUFER_LENGTH); int status = gen_dkg_poly(dkg_secret, _t); CHECK_STATUS("gen_dkg_poly failed") status = AES_encrypt(dkg_secret, encrypted_dkg_secret, 3 * BUF_LEN); CHECK_STATUS("SGX AES encrypt DKG poly failed"); *enc_len = strlen(dkg_secret) + SGX_AESGCM_MAC_SIZE + SGX_AESGCM_IV_SIZE; SAFE_CHAR_BUF(decr_dkg_secret, DKG_BUFER_LENGTH); status = AES_decrypt(encrypted_dkg_secret, *enc_len, decr_dkg_secret, DKG_BUFER_LENGTH); CHECK_STATUS("aes decrypt dkg poly failed"); if (strcmp(dkg_secret, decr_dkg_secret) != 0) { snprintf(errString, BUF_LEN, "encrypted poly is not equal to decrypted poly"); LOG_ERROR(errString); *errStatus = -333; goto clean; } SET_SUCCESS clean: ; LOG_INFO(__FUNCTION__ ); LOG_INFO("SGX call completed"); }
1
57,416
void Hub::connect(std::string uri, void *user, int timeoutMs, Group<CLIENT> *eh) { if (!eh) { eh = (Group<CLIENT> *) this; } int offset = 0; std::string protocol = uri.substr(offset, uri.find("://")), hostname, portStr, path; if ((offset += protocol.length() + 3) < uri.length()) { hostname = uri.substr(offset, uri.find_first_of(":/", offset) - offset); offset += hostname.length(); if (uri[offset] == ':') { offset++; portStr = uri.substr(offset, uri.find("/", offset) - offset); } offset += portStr.length(); if (uri[offset] == '/') { path = uri.substr(++offset); } } if (hostname.length()) { int port = 80; bool secure = false; if (protocol == "wss") { port = 443; secure = true; } else if (protocol != "ws") { eh->errorHandler(user); } if (portStr.length()) { port = stoi(portStr); } uS::SocketData socketData((uS::NodeData *) eh); HTTPSocket<CLIENT>::Data *httpSocketData = new HTTPSocket<CLIENT>::Data(&socketData); httpSocketData->host = hostname; httpSocketData->path = path; httpSocketData->httpUser = user; uS::Socket s = uS::Node::connect<onClientConnection>(hostname.c_str(), port, secure, httpSocketData); if (s) { s.startTimeout<HTTPSocket<CLIENT>::onEnd>(timeoutMs); } } else { eh->errorHandler(user); } }
0
133,212
void meta_box_del(GF_Box *s) { meta_reset(s); gf_free(s); }
0
153,986
su_main (int argc, char **argv, int mode) { int optc; const char *new_user = DEFAULT_USER, *runuser_user = NULL; char *command = NULL; int request_same_session = 0; char *shell = NULL; struct passwd *pw; struct passwd pw_copy; gid_t *groups = NULL; size_t ngroups = 0; bool use_supp = false; bool use_gid = false; gid_t gid = 0; static const struct option longopts[] = { {"command", required_argument, NULL, 'c'}, {"session-command", required_argument, NULL, 'C'}, {"fast", no_argument, NULL, 'f'}, {"login", no_argument, NULL, 'l'}, {"preserve-environment", no_argument, NULL, 'p'}, {"shell", required_argument, NULL, 's'}, {"group", required_argument, NULL, 'g'}, {"supp-group", required_argument, NULL, 'G'}, {"user", required_argument, NULL, 'u'}, /* runuser only */ {"help", no_argument, 0, 'h'}, {"version", no_argument, 0, 'V'}, {NULL, 0, NULL, 0} }; setlocale (LC_ALL, ""); bindtextdomain (PACKAGE, LOCALEDIR); textdomain (PACKAGE); atexit(close_stdout); su_mode = mode; fast_startup = false; simulate_login = false; change_environment = true; while ((optc = getopt_long (argc, argv, "c:fg:G:lmps:u:hV", longopts, NULL)) != -1) { switch (optc) { case 'c': command = optarg; break; case 'C': command = optarg; request_same_session = 1; break; case 'f': fast_startup = true; break; case 'g': use_gid = true; gid = add_supp_group(optarg, &groups, &ngroups); break; case 'G': use_supp = true; add_supp_group(optarg, &groups, &ngroups); break; case 'l': simulate_login = true; break; case 'm': case 'p': change_environment = false; break; case 's': shell = optarg; break; case 'u': if (su_mode != RUNUSER_MODE) usage (EXIT_FAILURE); runuser_user = optarg; break; case 'h': usage(0); case 'V': printf(UTIL_LINUX_VERSION); exit(EXIT_SUCCESS); default: errtryhelp(EXIT_FAILURE); } } restricted = evaluate_uid (); if (optind < argc && !strcmp (argv[optind], "-")) { simulate_login = true; ++optind; } if (simulate_login && !change_environment) { warnx(_("ignoring --preserve-environment, it's mutually exclusive with --login")); change_environment = true; } switch (su_mode) { case RUNUSER_MODE: if (runuser_user) { /* runuser -u <user> <command> */ new_user = runuser_user; if (shell || fast_startup || command || simulate_login) { errx(EXIT_FAILURE, _("options --{shell,fast,command,session-command,login} and " "--user are mutually exclusive")); } if (optind == argc) errx(EXIT_FAILURE, _("no command was specified")); break; } /* fallthrough if -u <user> is not specified, then follow * traditional su(1) behavior */ case SU_MODE: if (optind < argc) new_user = argv[optind++]; break; } if ((use_supp || use_gid) && restricted) errx(EXIT_FAILURE, _("only root can specify alternative groups")); logindefs_load_defaults = load_config; pw = getpwnam (new_user); if (! (pw && pw->pw_name && pw->pw_name[0] && pw->pw_dir && pw->pw_dir[0] && pw->pw_passwd)) errx (EXIT_FAILURE, _("user %s does not exist"), new_user); /* Make a copy of the password information and point pw at the local copy instead. Otherwise, some systems (e.g. Linux) would clobber the static data through the getlogin call from log_su. Also, make sure pw->pw_shell is a nonempty string. It may be NULL when NEW_USER is a username that is retrieved via NIS (YP), but that doesn't have a default shell listed. */ pw_copy = *pw; pw = &pw_copy; pw->pw_name = xstrdup (pw->pw_name); pw->pw_passwd = xstrdup (pw->pw_passwd); pw->pw_dir = xstrdup (pw->pw_dir); pw->pw_shell = xstrdup (pw->pw_shell && pw->pw_shell[0] ? pw->pw_shell : DEFAULT_SHELL); endpwent (); if (use_supp && !use_gid) pw->pw_gid = groups[0]; else if (use_gid) pw->pw_gid = gid; authenticate (pw); if (request_same_session || !command || !pw->pw_uid) same_session = 1; /* initialize shell variable only if "-u <user>" not specified */ if (runuser_user) { shell = NULL; } else { if (!shell && !change_environment) shell = getenv ("SHELL"); if (shell && getuid () != 0 && restricted_shell (pw->pw_shell)) { /* The user being su'd to has a nonstandard shell, and so is probably a uucp account or has restricted access. Don't compromise the account by allowing access with a standard shell. */ warnx (_("using restricted shell %s"), pw->pw_shell); shell = NULL; } shell = xstrdup (shell ? shell : pw->pw_shell); } init_groups (pw, groups, ngroups); if (!simulate_login || command) suppress_pam_info = 1; /* don't print PAM info messages */ create_watching_parent (); /* Now we're in the child. */ change_identity (pw); if (!same_session) setsid (); /* Set environment after pam_open_session, which may put KRB5CCNAME into the pam_env, etc. */ modify_environment (pw, shell); if (simulate_login && chdir (pw->pw_dir) != 0) warn (_("warning: cannot change directory to %s"), pw->pw_dir); if (shell) run_shell (shell, command, argv + optind, max (0, argc - optind)); else { execvp(argv[optind], &argv[optind]); err(EXIT_FAILURE, _("failed to execute %s"), argv[optind]); } }
0
377,007
static int get_dpifindex(struct datapath *dp) { struct vport *local; int ifindex; rcu_read_lock(); local = ovs_vport_rcu(dp, OVSP_LOCAL); if (local) ifindex = netdev_vport_priv(local)->dev->ifindex; else ifindex = 0; rcu_read_unlock(); return ifindex; }
0
18,445
static bool check_grant_db_routine ( THD * thd , const char * db , HASH * hash ) { Security_context * sctx = thd -> security_ctx ; for ( uint idx = 0 ; idx < hash -> records ; ++ idx ) { GRANT_NAME * item = ( GRANT_NAME * ) hash_element ( hash , idx ) ; if ( strcmp ( item -> user , sctx -> priv_user ) == 0 && strcmp ( item -> db , db ) == 0 && compare_hostname ( & item -> host , sctx -> host , sctx -> ip ) ) { return FALSE ; } } return TRUE ; }
0
308,055
static ssize_t kernel_readv(struct file *file, const struct kvec *vec, unsigned long vlen, loff_t offset) { mm_segment_t old_fs; loff_t pos = offset; ssize_t res; old_fs = get_fs(); set_fs(KERNEL_DS); /* The cast to a user pointer is valid due to the set_fs() */ res = vfs_readv(file, (const struct iovec __user *)vec, vlen, &pos, 0); set_fs(old_fs); return res; }
0
205,454
WORD32 ih264d_set_degrade(iv_obj_t *ps_codec_obj, void *pv_api_ip, void *pv_api_op) { ih264d_ctl_degrade_ip_t *ps_ip; ih264d_ctl_degrade_op_t *ps_op; dec_struct_t *ps_codec = (dec_struct_t *)ps_codec_obj->pv_codec_handle; ps_ip = (ih264d_ctl_degrade_ip_t *)pv_api_ip; ps_op = (ih264d_ctl_degrade_op_t *)pv_api_op; ps_codec->i4_degrade_type = ps_ip->i4_degrade_type; ps_codec->i4_nondegrade_interval = ps_ip->i4_nondegrade_interval; ps_codec->i4_degrade_pics = ps_ip->i4_degrade_pics; ps_op->u4_error_code = 0; ps_codec->i4_degrade_pic_cnt = 0; return IV_SUCCESS; }
0
179,913
bool ImageLoader::GetImageAnimationPolicy(ImageAnimationPolicy& policy) { if (!GetElement()->GetDocument().GetSettings()) return false; policy = GetElement()->GetDocument().GetSettings()->GetImageAnimationPolicy(); return true; }
0
432,758
http1_splitline(struct http *hp, struct http_conn *htc, const int *hf, unsigned maxhdr) { char *p, *q; int i; assert(hf == HTTP1_Req || hf == HTTP1_Resp); CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC); CHECK_OBJ_NOTNULL(hp, HTTP_MAGIC); assert(htc->rxbuf_e >= htc->rxbuf_b); AZ(hp->hd[hf[0]].b); AZ(hp->hd[hf[1]].b); AZ(hp->hd[hf[2]].b); /* Skip leading LWS */ for (p = htc->rxbuf_b ; vct_islws(*p); p++) continue; hp->hd[hf[0]].b = p; /* First field cannot contain SP or CTL */ for (; !vct_issp(*p); p++) { if (vct_isctl(*p)) return (400); } hp->hd[hf[0]].e = p; assert(Tlen(hp->hd[hf[0]])); *p++ = '\0'; /* Skip SP */ for (; vct_issp(*p); p++) { if (vct_isctl(*p)) return (400); } hp->hd[hf[1]].b = p; /* Second field cannot contain LWS or CTL */ for (; !vct_islws(*p); p++) { if (vct_isctl(*p)) return (400); } hp->hd[hf[1]].e = p; if (!Tlen(hp->hd[hf[1]])) return (400); /* Skip SP */ q = p; for (; vct_issp(*p); p++) { if (vct_isctl(*p)) return (400); } if (q < p) *q = '\0'; /* Nul guard for the 2nd field. If q == p * (the third optional field is not * present), the last nul guard will * cover this field. */ /* Third field is optional and cannot contain CTL except TAB */ q = p; for (; p < htc->rxbuf_e && !vct_iscrlf(p, htc->rxbuf_e); p++) { if (vct_isctl(*p) && !vct_issp(*p)) return (400); } if (p > q) { hp->hd[hf[2]].b = q; hp->hd[hf[2]].e = p; } /* Skip CRLF */ i = vct_iscrlf(p, htc->rxbuf_e); if (!i) return (400); *p = '\0'; p += i; http_Proto(hp); return (http1_dissect_hdrs(hp, p, htc, maxhdr)); }
0
437,114
static void atusb_in(struct urb *urb) { struct usb_device *usb_dev = urb->dev; struct sk_buff *skb = urb->context; struct atusb *atusb = SKB_ATUSB(skb); dev_dbg(&usb_dev->dev, "%s: status %d len %d\n", __func__, urb->status, urb->actual_length); if (urb->status) { if (urb->status == -ENOENT) { /* being killed */ kfree_skb(skb); urb->context = NULL; return; } dev_dbg(&usb_dev->dev, "%s: URB error %d\n", __func__, urb->status); } else { atusb_in_good(urb); } usb_anchor_urb(urb, &atusb->idle_urbs); if (!atusb->shutdown) schedule_delayed_work(&atusb->work, 0); }
0
111,376
int ff_unlock_avcodec(const AVCodec *codec) { if (codec->caps_internal & FF_CODEC_CAP_INIT_THREADSAFE || !codec->init) return 0; av_assert0(ff_avcodec_locked); ff_avcodec_locked = 0; atomic_fetch_add(&entangled_thread_counter, -1); if (lockmgr_cb) { if ((*lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE)) return -1; } return 0; }
1
302,366
EditorButton(XtermWidget xw, XButtonEvent *event) { TScreen *screen = TScreenOf(xw); int pty = screen->respond; int mouse_limit = MouseLimit(screen); Char line[32]; Char final = 'M'; int row, col; int button; unsigned count = 0; Boolean changed = True; /* If button event, get button # adjusted for DEC compatibility */ button = (int) (event->button - 1); if (button >= 3) button++; /* Ignore buttons that cannot be encoded */ if (screen->send_mouse_pos == X10_MOUSE) { if (button > 3) return; } else if (screen->extend_coords == SET_SGR_EXT_MODE_MOUSE || screen->extend_coords == SET_URXVT_EXT_MODE_MOUSE || screen->extend_coords == SET_PIXEL_POSITION_MOUSE) { if (button > 15) { return; } } else { if (button > 11) { return; } } if (screen->extend_coords == SET_PIXEL_POSITION_MOUSE) { row = event->y - OriginY(screen); col = event->x - OriginX(screen); } else { /* Compute character position of mouse pointer */ row = (event->y - screen->border) / FontHeight(screen); col = (event->x - OriginX(screen)) / FontWidth(screen); /* Limit to screen dimensions */ if (row < 0) row = 0; else if (row > screen->max_row) row = screen->max_row; if (col < 0) col = 0; else if (col > screen->max_col) col = screen->max_col; if (mouse_limit > 0) { /* Limit to representable mouse dimensions */ if (row > mouse_limit) row = mouse_limit; if (col > mouse_limit) col = mouse_limit; } } /* Build key sequence starting with \E[M */ if (screen->control_eight_bits) { line[count++] = ANSI_CSI; } else { line[count++] = ANSI_ESC; line[count++] = '['; } switch (screen->extend_coords) { case 0: case SET_EXT_MODE_MOUSE: #if OPT_SCO_FUNC_KEYS if (xw->keyboard.type == keyboardIsSCO) { /* * SCO function key F1 is \E[M, which would conflict with xterm's * normal kmous. */ line[count++] = '>'; } #endif line[count++] = final; break; case SET_SGR_EXT_MODE_MOUSE: case SET_PIXEL_POSITION_MOUSE: line[count++] = '<'; break; } /* Add event code to key sequence */ if (okSendMousePos(xw) == X10_MOUSE) { count = EMIT_BUTTON(button); } else { /* Button-Motion events */ switch (event->type) { case ButtonPress: screen->mouse_button |= ButtonBit(button); count = EMIT_BUTTON(button); break; case ButtonRelease: /* * The (vertical) wheel mouse interface generates release-events * for buttons 4 and 5. * * The X10/X11 xterm protocol maps the release for buttons 1..3 to * a -1, which will be later mapped into a "0" (some button was * released), At this point, buttons 1..3 are encoded 0..2 (the * code 3 is unused). * * The SGR (extended) xterm mouse protocol keeps the button number * and uses a "m" to indicate button release. * * The behavior for mice with more buttons is unclear, and may be * revised -TD */ screen->mouse_button &= ~ButtonBit(button); if (button < 3 || button > 5) { switch (screen->extend_coords) { case SET_SGR_EXT_MODE_MOUSE: case SET_PIXEL_POSITION_MOUSE: final = 'm'; break; default: button = -1; break; } } count = EMIT_BUTTON(button); break; case MotionNotify: /* BTN_EVENT_MOUSE and ANY_EVENT_MOUSE modes send motion * events only if character cell has changed. */ if ((row == screen->mouse_row) && (col == screen->mouse_col)) { changed = False; } else { count = EMIT_BUTTON(FirstBitN(screen->mouse_button)); } break; default: changed = False; break; } } if (changed) { screen->mouse_row = row; screen->mouse_col = col; TRACE(("mouse at %d,%d button+mask = %#x\n", row, col, line[count - 1])); /* Add pointer position to key sequence */ count = EmitMousePositionSeparator(screen, line, count); count = EmitMousePosition(screen, line, count, col); count = EmitMousePositionSeparator(screen, line, count); count = EmitMousePosition(screen, line, count, row); switch (screen->extend_coords) { case SET_SGR_EXT_MODE_MOUSE: case SET_URXVT_EXT_MODE_MOUSE: case SET_PIXEL_POSITION_MOUSE: line[count++] = final; break; } /* Transmit key sequence to process running under xterm */ TRACE(("EditorButton -> %s\n", visibleChars(line, count))); v_write(pty, line, count); } return; }
0
236,079
smp_fetch_hdr_val(const struct arg *args, struct sample *smp, const char *kw, void *private) { int ret = smp_fetch_hdr(args, smp, kw, private); if (ret > 0) { smp->data.type = SMP_T_SINT; smp->data.u.sint = strl2ic(smp->data.u.str.str, smp->data.u.str.len); } return ret; }
0
113,932
process_mkdir(u_int32_t id) { Attrib a; char *name; int r, mode, status = SSH2_FX_FAILURE; if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 || (r = decode_attrib(iqueue, &a)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); mode = (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a.perm & 07777 : 0777; debug3("request %u: mkdir", id); logit("mkdir name \"%s\" mode 0%o", name, mode); r = mkdir(name, mode); status = (r == -1) ? errno_to_portable(errno) : SSH2_FX_OK; send_status(id, status); free(name); }
0
206,789
ModuleExport void UnregisterRAWImage(void) { (void) UnregisterMagickInfo("R"); (void) UnregisterMagickInfo("C"); (void) UnregisterMagickInfo("G"); (void) UnregisterMagickInfo("M"); (void) UnregisterMagickInfo("B"); (void) UnregisterMagickInfo("Y"); (void) UnregisterMagickInfo("A"); (void) UnregisterMagickInfo("O"); (void) UnregisterMagickInfo("K"); }
0
219,029
void Document::InitSecurityContext(const DocumentInit& initializer) { DCHECK(!GetSecurityOrigin()); if (!initializer.HasSecurityContext()) { cookie_url_ = KURL(g_empty_string); SetSecurityOrigin(SecurityOrigin::CreateUniqueOpaque()); InitContentSecurityPolicy(); ApplyFeaturePolicy({}); return; } SandboxFlags sandbox_flags = initializer.GetSandboxFlags(); if (fetcher_->Archive()) { sandbox_flags |= kSandboxAll & ~(kSandboxPopups | kSandboxPropagatesToAuxiliaryBrowsingContexts); } EnforceSandboxFlags(sandbox_flags); SetInsecureRequestPolicy(initializer.GetInsecureRequestPolicy()); if (initializer.InsecureNavigationsToUpgrade()) { for (auto to_upgrade : *initializer.InsecureNavigationsToUpgrade()) AddInsecureNavigationUpgrade(to_upgrade); } ContentSecurityPolicy* policy_to_inherit = nullptr; if (IsSandboxed(kSandboxOrigin)) { cookie_url_ = url_; scoped_refptr<SecurityOrigin> security_origin = SecurityOrigin::CreateUniqueOpaque(); Document* owner = initializer.OwnerDocument(); if (owner) { if (owner->GetSecurityOrigin()->IsPotentiallyTrustworthy()) security_origin->SetOpaqueOriginIsPotentiallyTrustworthy(true); if (owner->GetSecurityOrigin()->CanLoadLocalResources()) security_origin->GrantLoadLocalResources(); policy_to_inherit = owner->GetContentSecurityPolicy(); } SetSecurityOrigin(std::move(security_origin)); } else if (Document* owner = initializer.OwnerDocument()) { cookie_url_ = owner->CookieURL(); SetSecurityOrigin(owner->GetMutableSecurityOrigin()); policy_to_inherit = owner->GetContentSecurityPolicy(); } else { cookie_url_ = url_; SetSecurityOrigin(SecurityOrigin::Create(url_)); } if (initializer.IsHostedInReservedIPRange()) { SetAddressSpace(GetSecurityOrigin()->IsLocalhost() ? mojom::IPAddressSpace::kLocal : mojom::IPAddressSpace::kPrivate); } else if (GetSecurityOrigin()->IsLocal()) { SetAddressSpace(mojom::IPAddressSpace::kLocal); } else { SetAddressSpace(mojom::IPAddressSpace::kPublic); } if (ImportsController()) { SetContentSecurityPolicy( ImportsController()->Master()->GetContentSecurityPolicy()); } else { InitContentSecurityPolicy(nullptr, policy_to_inherit); } if (Settings* settings = initializer.GetSettings()) { if (!settings->GetWebSecurityEnabled()) { GetMutableSecurityOrigin()->GrantUniversalAccess(); } else if (GetSecurityOrigin()->IsLocal()) { if (settings->GetAllowUniversalAccessFromFileURLs()) { GetMutableSecurityOrigin()->GrantUniversalAccess(); } else if (!settings->GetAllowFileAccessFromFileURLs()) { GetMutableSecurityOrigin()->BlockLocalAccessFromLocalOrigin(); } } } if (GetSecurityOrigin()->IsOpaque() && SecurityOrigin::Create(url_)->IsPotentiallyTrustworthy()) GetMutableSecurityOrigin()->SetOpaqueOriginIsPotentiallyTrustworthy(true); ApplyFeaturePolicy({}); InitSecureContextState(); }
0
50,233
int get_unused_fd_flags(unsigned flags) { return __get_unused_fd_flags(flags, rlimit(RLIMIT_NOFILE)); }
0
496,951
cached_h_origin(hb_font_t *font, void *font_data, hb_codepoint_t glyph, hb_position_t *x, hb_position_t *y, void *user_data) { return true; }
0
407,462
void irc_servers_init(void) { settings_add_choice("servers", "rejoin_channels_on_reconnect", 1, "off;on;auto"); settings_add_str("misc", "usermode", DEFAULT_USER_MODE); settings_add_str("misc", "split_line_start", ""); settings_add_str("misc", "split_line_end", ""); settings_add_bool("misc", "split_line_on_space", TRUE); settings_add_time("flood", "cmd_queue_speed", DEFAULT_CMD_QUEUE_SPEED); settings_add_int("flood", "cmds_max_at_once", DEFAULT_CMDS_MAX_AT_ONCE); cmd_tag = -1; signal_add_first("server connected", (SIGNAL_FUNC) sig_connected); signal_add_last("server disconnected", (SIGNAL_FUNC) sig_disconnected); signal_add_last("server quit", (SIGNAL_FUNC) sig_server_quit); signal_add("event 001", (SIGNAL_FUNC) event_connected); signal_add("event 004", (SIGNAL_FUNC) event_server_info); signal_add("event 005", (SIGNAL_FUNC) event_isupport); signal_add("event 375", (SIGNAL_FUNC) event_motd); signal_add_last("event 376", (SIGNAL_FUNC) event_end_of_motd); signal_add_last("event 422", (SIGNAL_FUNC) event_end_of_motd); /* no motd */ signal_add("event 254", (SIGNAL_FUNC) event_channels_formed); signal_add("event 396", (SIGNAL_FUNC) event_hosthidden); signal_add("event 465", (SIGNAL_FUNC) event_server_banned); signal_add("event error", (SIGNAL_FUNC) event_error); signal_add("event ping", (SIGNAL_FUNC) event_ping); signal_add("event empty", (SIGNAL_FUNC) event_empty); irc_servers_setup_init(); irc_servers_reconnect_init(); servers_redirect_init(); servers_idle_init(); }
0
439,758
static void splashOutBlendExclusion(SplashColorPtr src, SplashColorPtr dest, SplashColorPtr blend, SplashColorMode cm) { int i; #ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; src[i] = 255 - src[i]; } } #endif { for (i = 0; i < splashColorModeNComps[cm]; ++i) { blend[i] = dest[i] + src[i] - (2 * dest[i] * src[i]) / 255; } } #ifdef SPLASH_CMYK if (cm == splashModeCMYK8 || cm == splashModeDeviceN8) { for (i = 0; i < splashColorModeNComps[cm]; ++i) { dest[i] = 255 - dest[i]; src[i] = 255 - src[i]; blend[i] = 255 - blend[i]; } } if (cm == splashModeDeviceN8) { for (i = 4; i < splashColorModeNComps[cm]; ++i) { if (dest[i] == 0 && src[i] == 0) blend[i] = 0; } } #endif }
0
322,286
static void sdp_parse_fmtp_config(AVCodecContext *codec, char *attr, char *value) { switch (codec->codec_id) { case CODEC_ID_MPEG4: case CODEC_ID_AAC: if (!strcmp(attr, "config")) { /* decode the hexa encoded parameter */ int len = hex_to_data(NULL, value); codec->extradata = av_mallocz(len + FF_INPUT_BUFFER_PADDING_SIZE); if (!codec->extradata) return; codec->extradata_size = len; hex_to_data(codec->extradata, value); } break; default: break; } return; }
1
130,419
static void *perf_mmap_alloc_page(int cpu) { struct page *page; int node; node = (cpu == -1) ? cpu : cpu_to_node(cpu); page = alloc_pages_node(node, GFP_KERNEL | __GFP_ZERO, 0); if (!page) return NULL; return page_address(page); }
0
405,961
netdev_port_features_from_ofp10(ovs_be32 ofp10_) { uint32_t ofp10 = ntohl(ofp10_); return (ofp10 & 0x7f) | ((ofp10 & 0xf80) << 4); }
0
335,084
static int count_contiguous_clusters_by_type(int nb_clusters, uint64_t *l2_table, int wanted_type) { int i; for (i = 0; i < nb_clusters; i++) { int type = qcow2_get_cluster_type(be64_to_cpu(l2_table[i])); if (type != wanted_type) { break; } } return i; }
0
103,109
void npw_close_all_open_files(void) { const int min_fd = 3; #if defined(__linux__) DIR *dir = opendir("/proc/self/fd"); if (dir) { const int dfd = dirfd(dir); struct dirent *d; while ((d = readdir(dir)) != NULL) { char *end; long n = strtol(d->d_name, &end, 10); if (*end == '\0') { int fd = n; if (fd >= min_fd && fd != dfd) close(fd); } } closedir(dir); return; } #endif const int open_max = get_open_max(); for (int fd = min_fd; fd < open_max; fd++) close(fd); }
0
478,769
T& atXYZ(const int x, const int y, const int z, const int c, const T& out_value) { return (x<0 || y<0 || z<0 || x>=width() || y>=height() || z>=depth())? (cimg::temporary(out_value)=out_value):(*this)(x,y,z,c); }
0
57,404
static int packet_rcv_has_room(struct packet_sock *po, struct sk_buff *skb) { int ret; bool has_room; spin_lock_bh(&po->sk.sk_receive_queue.lock); ret = __packet_rcv_has_room(po, skb); has_room = ret == ROOM_NORMAL; if (po->pressure == has_room) po->pressure = !has_room; spin_unlock_bh(&po->sk.sk_receive_queue.lock); return ret; }
0
21,865
static int x ( struct vcache * avc , int afun , struct vrequest * areq , \ struct afs_pdata * ain , struct afs_pdata * aout , \ afs_ucred_t * * acred ) DECL_PIOCTL ( PGetFID ) ; DECL_PIOCTL ( PSetAcl ) ; DECL_PIOCTL ( PStoreBehind ) ; DECL_PIOCTL ( PGCPAGs ) ; DECL_PIOCTL ( PGetAcl ) ; DECL_PIOCTL ( PNoop ) ; DECL_PIOCTL ( PBogus ) ; DECL_PIOCTL ( PGetFileCell ) ; DECL_PIOCTL ( PGetWSCell ) ; DECL_PIOCTL ( PGetUserCell ) ; DECL_PIOCTL ( PSetTokens ) ; DECL_PIOCTL ( PGetVolumeStatus ) ; DECL_PIOCTL ( PSetVolumeStatus ) ; DECL_PIOCTL ( PFlush ) ; DECL_PIOCTL ( PNewStatMount ) ; DECL_PIOCTL ( PGetTokens ) ; DECL_PIOCTL ( PUnlog ) ; DECL_PIOCTL ( PMariner ) ; DECL_PIOCTL ( PCheckServers ) ; DECL_PIOCTL ( PCheckVolNames ) ; DECL_PIOCTL ( PCheckAuth ) ; DECL_PIOCTL ( PFindVolume ) ; DECL_PIOCTL ( PViceAccess ) ; DECL_PIOCTL ( PSetCacheSize ) ; DECL_PIOCTL ( PGetCacheSize ) ; DECL_PIOCTL ( PRemoveCallBack ) ; DECL_PIOCTL ( PNewCell ) ; DECL_PIOCTL ( PNewAlias ) ; DECL_PIOCTL ( PListCells )
0
381,801
comparetup_heap(const SortTuple *a, const SortTuple *b, Tuplesortstate *state) { SortSupport sortKey = state->sortKeys; HeapTupleData ltup; HeapTupleData rtup; TupleDesc tupDesc; int nkey; int32 compare; AttrNumber attno; Datum datum1, datum2; bool isnull1, isnull2; /* Compare the leading sort key */ compare = ApplySortComparator(a->datum1, a->isnull1, b->datum1, b->isnull1, sortKey); if (compare != 0) return compare; /* Compare additional sort keys */ ltup.t_len = ((MinimalTuple) a->tuple)->t_len + MINIMAL_TUPLE_OFFSET; ltup.t_data = (HeapTupleHeader) ((char *) a->tuple - MINIMAL_TUPLE_OFFSET); rtup.t_len = ((MinimalTuple) b->tuple)->t_len + MINIMAL_TUPLE_OFFSET; rtup.t_data = (HeapTupleHeader) ((char *) b->tuple - MINIMAL_TUPLE_OFFSET); tupDesc = state->tupDesc; if (sortKey->abbrev_converter) { attno = sortKey->ssup_attno; datum1 = heap_getattr(&ltup, attno, tupDesc, &isnull1); datum2 = heap_getattr(&rtup, attno, tupDesc, &isnull2); compare = ApplySortAbbrevFullComparator(datum1, isnull1, datum2, isnull2, sortKey); if (compare != 0) return compare; } sortKey++; for (nkey = 1; nkey < state->nKeys; nkey++, sortKey++) { attno = sortKey->ssup_attno; datum1 = heap_getattr(&ltup, attno, tupDesc, &isnull1); datum2 = heap_getattr(&rtup, attno, tupDesc, &isnull2); compare = ApplySortComparator(datum1, isnull1, datum2, isnull2, sortKey); if (compare != 0) return compare; } return 0; }
0
351,949
static SECURITY_STATUS SEC_ENTRY negotiate_SetCredentialsAttributesW(PCredHandle phCredential, ULONG ulAttribute, void* pBuffer, ULONG cbBuffer) { MechCred* creds; creds = sspi_SecureHandleGetLowerPointer(phCredential); if (!creds) return SEC_E_INVALID_HANDLE; for (size_t i = 0; i < MECH_COUNT; i++) { MechCred* cred = &creds[i]; if (!cred->valid) continue; WINPR_ASSERT(cred->mech); WINPR_ASSERT(cred->mech->pkg); WINPR_ASSERT(cred->mech->pkg->table); WINPR_ASSERT(cred->mech->pkg->table_w->SetCredentialsAttributesW); cred->mech->pkg->table_w->SetCredentialsAttributesW(&cred->cred, ulAttribute, pBuffer, cbBuffer); } return SEC_E_OK; }
1
104,806
char * get_fru_area_str(uint8_t * data, uint32_t * offset) { static const char bcd_plus[] = "0123456789 -.:,_"; char * str; int len, off, size, i, j, k, typecode, char_idx; union { uint32_t bits; char chars[4]; } u; size = 0; off = *offset; /* bits 6:7 contain format */ typecode = ((data[off] & 0xC0) >> 6); // printf("Typecode:%i\n", typecode); /* bits 0:5 contain length */ len = data[off++]; len &= 0x3f; switch (typecode) { case 0: /* 00b: binary/unspecified */ case 1: /* 01b: BCD plus */ /* hex dump or BCD -> 2x length */ size = (len * 2); break; case 2: /* 10b: 6-bit ASCII */ /* 4 chars per group of 1-3 bytes */ size = (((len * 4 + 2) / 3) & ~3); break; case 3: /* 11b: 8-bit ASCII */ /* no length adjustment */ size = len; break; } if (size < 1) { *offset = off; return NULL; } str = malloc(size+1); if (!str) return NULL; memset(str, 0, size+1); if (size == 0) { str[0] = '\0'; *offset = off; return str; } switch (typecode) { case 0: /* Binary */ strncpy(str, buf2str(&data[off], len), size); break; case 1: /* BCD plus */ for (k = 0; k < size; k++) str[k] = bcd_plus[((data[off + k / 2] >> ((k % 2) ? 0 : 4)) & 0x0f)]; str[k] = '\0'; break; case 2: /* 6-bit ASCII */ for (i = j = 0; i < len; i += 3) { u.bits = 0; k = ((len - i) < 3 ? (len - i) : 3); #if WORDS_BIGENDIAN u.chars[3] = data[off+i]; u.chars[2] = (k > 1 ? data[off+i+1] : 0); u.chars[1] = (k > 2 ? data[off+i+2] : 0); char_idx = 3; #else memcpy((void *)&u.bits, &data[off+i], k); char_idx = 0; #endif for (k=0; k<4; k++) { str[j++] = ((u.chars[char_idx] & 0x3f) + 0x20); u.bits >>= 6; } } str[j] = '\0'; break; case 3: memcpy(str, &data[off], size); str[size] = '\0'; break; } off += len; *offset = off; return str; }
0
34,108
static int handle_NPP_Destroy(rpc_connection_t *connection) { D(bug("handle_NPP_Destroy\n")); int error; PluginInstance *plugin; error = rpc_method_get_args(connection, RPC_TYPE_NPW_PLUGIN_INSTANCE, &plugin, RPC_TYPE_INVALID); if (error != RPC_ERROR_NO_ERROR) { npw_perror("NPP_Destroy() get args", error); return error; } NPSavedData *save_area = NULL; NPError ret = NPERR_NO_ERROR; /* Take a ref for the rpc_method_send_reply; otherwise the * rpc_connection_unref in g_NPP_Destroy_Now may cause a slight * nuisance. */ rpc_connection_ref(connection); if (!rpc_method_in_invoke(connection)) { /* The plugin is not on the stack; it's safe to call this. */ D(bug("NPP_Destroy is fine.\n")); ret = g_NPP_Destroy_Now(plugin, &save_area); } else { /* It is not safe to call NPP_Destroy right now. Delay it until we * return to the event loop. * * NOTE: This means that the browser never sees the real return * value of NPP_Destroy; the NPSavedData will be discarded, and any * error code will be ignored. */ D(bug("NPP_Destroy raced; delaying it to get a clean stack.\n")); delayed_destroys_add(plugin); } error = rpc_method_send_reply(connection, RPC_TYPE_INT32, ret, RPC_TYPE_NP_SAVED_DATA, save_area, RPC_TYPE_INVALID); if (save_area) { if (save_area->buf) NPN_MemFree(save_area->buf); NPN_MemFree(save_area); } rpc_connection_unref(connection); return error; }
0
486,028
struct my_mntent *my_getmntent (mntFILE *mfp) { return NULL; }
0
251,341
vpx_codec_err_t SetFrameBufferFunctions( int num_buffers, vpx_get_frame_buffer_cb_fn_t cb_get, vpx_release_frame_buffer_cb_fn_t cb_release) { if (num_buffers > 0) { num_buffers_ = num_buffers; EXPECT_TRUE(fb_list_.CreateBufferList(num_buffers_)); } return decoder_->SetFrameBufferFunctions(cb_get, cb_release, &fb_list_); }
0