idx
int64 | func
string | target
int64 |
|---|---|---|
423,987
|
free_tree (void *extra, bin_tree_t *node)
{
free_token (&node->token);
return REG_NOERROR;
}
| 0
|
199,137
|
static unsigned addChunk_tEXt(ucvector* out, const char* keyword, const char* textstring)
{
unsigned error = 0;
size_t i;
ucvector text;
ucvector_init(&text);
for(i = 0; keyword[i] != 0; i++) ucvector_push_back(&text, (unsigned char)keyword[i]);
if(i < 1 || i > 79) return 89; /*error: invalid keyword size*/
ucvector_push_back(&text, 0); /*0 termination char*/
for(i = 0; textstring[i] != 0; i++) ucvector_push_back(&text, (unsigned char)textstring[i]);
error = addChunk(out, "tEXt", text.data, text.size);
ucvector_cleanup(&text);
return error;
}
| 0
|
23,667
|
err_status_t srtp_unprotect_rtcp ( srtp_t ctx , void * srtcp_hdr , int * pkt_octet_len ) {
srtcp_hdr_t * hdr = ( srtcp_hdr_t * ) srtcp_hdr ;
uint32_t * enc_start ;
uint32_t * auth_start ;
uint32_t * trailer ;
unsigned int enc_octet_len = 0 ;
uint8_t * auth_tag = NULL ;
uint8_t tmp_tag [ SRTP_MAX_TAG_LEN ] ;
uint8_t tag_copy [ SRTP_MAX_TAG_LEN ] ;
err_status_t status ;
unsigned int auth_len ;
int tag_len ;
srtp_stream_ctx_t * stream ;
int prefix_len ;
uint32_t seq_num ;
int e_bit_in_packet ;
int sec_serv_confidentiality ;
if ( * pkt_octet_len < octets_in_rtcp_header + sizeof ( srtcp_trailer_t ) ) return err_status_bad_param ;
stream = srtp_get_stream ( ctx , hdr -> ssrc ) ;
if ( stream == NULL ) {
if ( ctx -> stream_template != NULL ) {
stream = ctx -> stream_template ;
if ( stream -> ekt != NULL ) {
status = srtp_stream_init_from_ekt ( stream , srtcp_hdr , * pkt_octet_len ) ;
if ( status ) return status ;
}
debug_print ( mod_srtp , "srtcp using provisional stream (SSRC: 0x%08x)" , hdr -> ssrc ) ;
}
else {
return err_status_no_ctx ;
}
}
tag_len = auth_get_tag_length ( stream -> rtcp_auth ) ;
if ( * pkt_octet_len < ( int ) ( octets_in_rtcp_header + tag_len + sizeof ( srtcp_trailer_t ) ) ) {
return err_status_bad_param ;
}
if ( stream -> rtp_cipher -> algorithm == AES_128_GCM || stream -> rtp_cipher -> algorithm == AES_256_GCM ) {
return srtp_unprotect_rtcp_aead ( ctx , stream , srtcp_hdr , ( unsigned int * ) pkt_octet_len ) ;
}
sec_serv_confidentiality = stream -> rtcp_services == sec_serv_conf || stream -> rtcp_services == sec_serv_conf_and_auth ;
enc_octet_len = * pkt_octet_len - ( octets_in_rtcp_header + tag_len + sizeof ( srtcp_trailer_t ) ) ;
trailer = ( uint32_t * ) ( ( char * ) hdr + * pkt_octet_len - ( tag_len + sizeof ( srtcp_trailer_t ) ) ) ;
e_bit_in_packet = ( * ( ( unsigned char * ) trailer ) & SRTCP_E_BYTE_BIT ) == SRTCP_E_BYTE_BIT ;
if ( e_bit_in_packet != sec_serv_confidentiality ) {
return err_status_cant_check ;
}
if ( sec_serv_confidentiality ) {
enc_start = ( uint32_t * ) hdr + uint32s_in_rtcp_header ;
}
else {
enc_octet_len = 0 ;
enc_start = NULL ;
}
auth_start = ( uint32_t * ) hdr ;
auth_len = * pkt_octet_len - tag_len ;
auth_tag = ( uint8_t * ) hdr + auth_len ;
if ( stream -> ekt ) {
auth_tag -= ekt_octets_after_base_tag ( stream -> ekt ) ;
memcpy ( tag_copy , auth_tag , tag_len ) ;
octet_string_set_to_zero ( auth_tag , tag_len ) ;
auth_tag = tag_copy ;
auth_len += tag_len ;
}
seq_num = ntohl ( * trailer ) & SRTCP_INDEX_MASK ;
debug_print ( mod_srtp , "srtcp index: %x" , seq_num ) ;
status = rdb_check ( & stream -> rtcp_rdb , seq_num ) ;
if ( status ) return status ;
if ( stream -> rtcp_cipher -> type -> id == AES_ICM ) {
v128_t iv ;
iv . v32 [ 0 ] = 0 ;
iv . v32 [ 1 ] = hdr -> ssrc ;
iv . v32 [ 2 ] = htonl ( seq_num >> 16 ) ;
iv . v32 [ 3 ] = htonl ( seq_num << 16 ) ;
status = cipher_set_iv ( stream -> rtcp_cipher , & iv , direction_decrypt ) ;
}
else {
v128_t iv ;
iv . v32 [ 0 ] = 0 ;
iv . v32 [ 1 ] = 0 ;
iv . v32 [ 2 ] = 0 ;
iv . v32 [ 3 ] = htonl ( seq_num ) ;
status = cipher_set_iv ( stream -> rtcp_cipher , & iv , direction_decrypt ) ;
}
if ( status ) return err_status_cipher_fail ;
auth_start ( stream -> rtcp_auth ) ;
status = auth_compute ( stream -> rtcp_auth , ( uint8_t * ) auth_start , auth_len , tmp_tag ) ;
debug_print ( mod_srtp , "srtcp computed tag: %s" , octet_string_hex_string ( tmp_tag , tag_len ) ) ;
if ( status ) return err_status_auth_fail ;
debug_print ( mod_srtp , "srtcp tag from packet: %s" , octet_string_hex_string ( auth_tag , tag_len ) ) ;
if ( octet_string_is_eq ( tmp_tag , auth_tag , tag_len ) ) return err_status_auth_fail ;
prefix_len = auth_get_prefix_length ( stream -> rtcp_auth ) ;
if ( prefix_len ) {
status = cipher_output ( stream -> rtcp_cipher , auth_tag , prefix_len ) ;
debug_print ( mod_srtp , "keystream prefix: %s" , octet_string_hex_string ( auth_tag , prefix_len ) ) ;
if ( status ) return err_status_cipher_fail ;
}
if ( enc_start ) {
status = cipher_decrypt ( stream -> rtcp_cipher , ( uint8_t * ) enc_start , & enc_octet_len ) ;
if ( status ) return err_status_cipher_fail ;
}
* pkt_octet_len -= ( tag_len + sizeof ( srtcp_trailer_t ) ) ;
* pkt_octet_len -= ekt_octets_after_base_tag ( stream -> ekt ) ;
if ( stream -> direction != dir_srtp_receiver ) {
if ( stream -> direction == dir_unknown ) {
stream -> direction = dir_srtp_receiver ;
}
else {
srtp_handle_event ( ctx , stream , event_ssrc_collision ) ;
}
}
if ( stream == ctx -> stream_template ) {
srtp_stream_ctx_t * new_stream ;
status = srtp_stream_clone ( ctx -> stream_template , hdr -> ssrc , & new_stream ) ;
if ( status ) return status ;
new_stream -> next = ctx -> stream_list ;
ctx -> stream_list = new_stream ;
stream = new_stream ;
}
rdb_add_index ( & stream -> rtcp_rdb , seq_num ) ;
return err_status_ok ;
}
| 0
|
510,827
|
inline bool Http2Session::CanAddStream() {
uint32_t maxConcurrentStreams =
nghttp2_session_get_local_settings(
session_, NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS);
size_t maxSize =
std::min(streams_.max_size(), static_cast<size_t>(maxConcurrentStreams));
// We can add a new stream so long as we are less than the current
// maximum on concurrent streams
return streams_.size() < maxSize;
}
| 0
|
277,935
|
void Document::ViewportDefiningElementDidChange() {
HTMLBodyElement* body = FirstBodyElement();
if (!body)
return;
if (body->NeedsReattachLayoutTree())
return;
LayoutObject* layout_object = body->GetLayoutObject();
if (layout_object && layout_object->IsLayoutBlock()) {
layout_object->SetStyle(ComputedStyle::Clone(*layout_object->Style()));
if (layout_object->HasLayer()) {
ToLayoutBoxModelObject(layout_object)
->Layer()
->SetNeedsCompositingReasonsUpdate();
}
}
}
| 0
|
20,619
|
static int dissect_h225_INTEGER_0_65535 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 65535U , NULL , FALSE ) ;
return offset ;
}
| 0
|
129,982
|
static ssize_t _hostsock_recvmsg(
oe_fd_t* sock_,
struct oe_msghdr* msg,
int flags)
{
ssize_t ret = -1;
sock_t* sock = _cast_sock(sock_);
oe_errno = 0;
void* buf = NULL;
size_t buf_size = 0;
size_t data_size = 0;
oe_socklen_t namelen_out = 0;
size_t controllen_out = 0;
/* Check the parameters. */
if (!sock || !msg || (msg->msg_iovlen && !msg->msg_iov))
OE_RAISE_ERRNO(OE_EINVAL);
/* Flatten the IO vector into contiguous heap memory. */
if (oe_iov_pack(
msg->msg_iov, (int)msg->msg_iovlen, &buf, &buf_size, &data_size) !=
0)
OE_RAISE_ERRNO(OE_ENOMEM);
/*
* According to the POSIX specification, when the data_size is greater
* than SSIZE_MAX, the result is implementation-defined. OE raises an
* error in this case.
* Refer to
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/recvmsg.html
* for more detail.
*/
if (data_size > OE_SSIZE_MAX)
OE_RAISE_ERRNO(OE_EINVAL);
/* Call the host. */
{
if (oe_syscall_recvmsg_ocall(
&ret,
sock->host_fd,
msg->msg_name,
msg->msg_namelen,
&namelen_out,
buf,
msg->msg_iovlen,
buf_size,
msg->msg_control,
msg->msg_controllen,
&controllen_out,
flags) != OE_OK)
{
OE_RAISE_ERRNO(OE_EINVAL);
}
if (ret == -1)
OE_RAISE_ERRNO(oe_errno);
}
if (!msg->msg_name)
msg->msg_namelen = 0;
else
{
/*
* Error out the case if the namelen_out is greater than the size
* of sockaddr_storage.
*/
if (namelen_out > sizeof(struct oe_sockaddr_storage))
OE_RAISE_ERRNO(OE_EINVAL);
/*
* Note that the returned value can still exceed the supplied one,
* which indicates a truncation.
*/
if (msg->msg_namelen >= namelen_out)
msg->msg_namelen = namelen_out;
}
if (!msg->msg_control)
msg->msg_controllen = 0;
else
{
/*
* Update the msg_controllen only if the supplied value is greater than
* or equal to the returned value. Otherwise, keep the msg_controllen
* unchanged, which indicates a truncation. In addition, explicitly
* setting the MSG_CTRUNC flag when the truncation occurs.
*/
if (msg->msg_controllen >= controllen_out)
msg->msg_controllen = controllen_out;
else
msg->msg_flags |= OE_MSG_CTRUNC;
}
/*
* Guard the special case that a host sets an arbitrarily large value.
* The return value should not exceed data_size.
*/
if (ret > (ssize_t)data_size)
{
ret = -1;
OE_RAISE_ERRNO(OE_EINVAL);
}
/* Synchronize data read with IO vector. */
if (oe_iov_sync(msg->msg_iov, (int)msg->msg_iovlen, buf, buf_size) != 0)
OE_RAISE_ERRNO(OE_EINVAL);
done:
if (buf)
oe_free(buf);
return ret;
}
| 0
|
171,627
|
void PepperPlatformAudioInput::StopCapture() {
DCHECK(main_message_loop_proxy_->BelongsToCurrentThread());
io_message_loop_proxy_->PostTask(
FROM_HERE,
base::Bind(&PepperPlatformAudioInput::StopCaptureOnIOThread, this));
}
| 0
|
236,718
|
void RenderView::ShowModalHTMLDialogForPlugin(
const GURL& url,
const gfx::Size& size,
const std::string& json_arguments,
std::string* json_retval) {
SendAndRunNestedMessageLoop(new ViewHostMsg_ShowModalHTMLDialog(
routing_id_, url, size.width(), size.height(), json_arguments,
json_retval));
}
| 0
|
274,425
|
static inline spinlock_t *pmd_lockptr(struct mm_struct *mm, pmd_t *pmd)
{
return ptlock_ptr(pmd_to_page(pmd));
}
| 0
|
187,344
|
void ReportResultsIfComplete() {
CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
if (!icon_decode_complete_ || !manifest_parse_complete_)
return;
utility_host_->EndBatchMode();
utility_host_ = NULL;
BrowserThread::PostTask(
BrowserThread::UI,
FROM_HERE,
NewRunnableMethod(this,
&SafeBeginInstallHelper::ReportResultFromUIThread));
}
| 0
|
156,881
|
SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
{
int read_bytes;
int allocated_bytes=SAPI_POST_BLOCK_SIZE+1;
if ((SG(post_max_size) > 0) && (SG(request_info).content_length > SG(post_max_size))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "POST Content-Length of %ld bytes exceeds the limit of %ld bytes",
SG(request_info).content_length, SG(post_max_size));
return;
}
SG(request_info).post_data = emalloc(allocated_bytes);
for (;;) {
read_bytes = sapi_module.read_post(SG(request_info).post_data+SG(read_post_bytes), SAPI_POST_BLOCK_SIZE TSRMLS_CC);
if (read_bytes<=0) {
break;
}
SG(read_post_bytes) += read_bytes;
if ((SG(post_max_size) > 0) && (SG(read_post_bytes) > SG(post_max_size))) {
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Actual POST length does not match Content-Length, and exceeds %ld bytes", SG(post_max_size));
break;
}
if (read_bytes < SAPI_POST_BLOCK_SIZE) {
break;
}
if (SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE >= allocated_bytes) {
allocated_bytes = SG(read_post_bytes)+SAPI_POST_BLOCK_SIZE+1;
SG(request_info).post_data = erealloc(SG(request_info).post_data, allocated_bytes);
}
}
SG(request_info).post_data[SG(read_post_bytes)] = 0; /* terminating NULL */
SG(request_info).post_data_length = SG(read_post_bytes);
}
| 0
|
176,255
|
FrameFetchContext::GetPreviewsResourceLoadingHints() const {
if (IsDetached())
return nullptr;
DocumentLoader* document_loader = MasterDocumentLoader();
if (!document_loader)
return nullptr;
return document_loader->GetPreviewsResourceLoadingHints();
}
| 0
|
500,855
|
GF_Err mvcg_box_size(GF_Box *s)
{
u32 i;
GF_MultiviewGroupBox *ptr = (GF_MultiviewGroupBox *) s;
ptr->size += 7;
for (i=0; i<ptr->num_entries; i++) {
switch (ptr->entries[i].entry_type) {
case 0:
ptr->size += 1 + 4;
break;
case 1:
ptr->size += 1 + 6;
break;
case 2:
ptr->size += 1 + 2;
break;
case 3:
ptr->size += 1 + 4;
break;
}
}
return GF_OK;
}
| 0
|
245,487
|
void set_num_buffers(int num_buffers) { num_buffers_ = num_buffers; }
| 0
|
414,764
|
static enum alarmtimer_restart alarm_handle_timer(struct alarm *alarm,
ktime_t now)
{
struct k_itimer *ptr = container_of(alarm, struct k_itimer,
it.alarm.alarmtimer);
enum alarmtimer_restart result = ALARMTIMER_NORESTART;
unsigned long flags;
int si_private = 0;
spin_lock_irqsave(&ptr->it_lock, flags);
ptr->it_active = 0;
if (ptr->it_interval)
si_private = ++ptr->it_requeue_pending;
if (posix_timer_event(ptr, si_private) && ptr->it_interval) {
/*
* Handle ignored signals and rearm the timer. This will go
* away once we handle ignored signals proper.
*/
ptr->it_overrun += alarm_forward_now(alarm, ptr->it_interval);
++ptr->it_requeue_pending;
ptr->it_active = 1;
result = ALARMTIMER_RESTART;
}
spin_unlock_irqrestore(&ptr->it_lock, flags);
return result;
}
| 0
|
428,789
|
XML_SetReturnNSTriplet(XML_Parser parser, int do_nst)
{
if (parser == NULL)
return;
/* block after XML_Parse()/XML_ParseBuffer() has been called */
if (parser->m_parsingStatus.parsing == XML_PARSING || parser->m_parsingStatus.parsing == XML_SUSPENDED)
return;
parser->m_ns_triplets = do_nst ? XML_TRUE : XML_FALSE;
}
| 0
|
75,503
|
rend_service_derive_key_digests(struct rend_service_t *s)
{
if (rend_get_service_id(s->private_key, s->service_id)<0) {
log_warn(LD_BUG, "Internal error: couldn't encode service ID.");
return -1;
}
if (crypto_pk_get_digest(s->private_key, s->pk_digest)<0) {
log_warn(LD_BUG, "Couldn't compute hash of public key.");
return -1;
}
return 0;
}
| 0
|
421,251
|
static NOINLINE void read_config(const char *file)
{
parser_t *parser;
const struct config_keyword *k;
unsigned i;
char *token[2];
for (i = 0; i < KWS_WITH_DEFAULTS; i++)
keywords[i].handler(keywords[i].def, (char*)&server_config + keywords[i].ofs);
parser = config_open(file);
while (config_read(parser, token, 2, 2, "# \t", PARSE_NORMAL)) {
for (k = keywords, i = 0; i < ARRAY_SIZE(keywords); k++, i++) {
if (strcasecmp(token[0], k->keyword) == 0) {
if (!k->handler(token[1], (char*)&server_config + k->ofs)) {
bb_error_msg("can't parse line %u in %s",
parser->lineno, file);
/* reset back to the default value */
k->handler(k->def, (char*)&server_config + k->ofs);
}
break;
}
}
}
config_close(parser);
server_config.start_ip = ntohl(server_config.start_ip);
server_config.end_ip = ntohl(server_config.end_ip);
}
| 0
|
253,445
|
AddGPUScreen(Bool (*pfnInit) (ScreenPtr /*pScreen */ ,
int /*argc */ ,
char ** /*argv */
),
int argc, char **argv)
{
int i;
ScreenPtr pScreen;
Bool ret;
i = screenInfo.numGPUScreens;
if (i == MAXGPUSCREENS)
return -1;
pScreen = (ScreenPtr) calloc(1, sizeof(ScreenRec));
if (!pScreen)
return -1;
ret = init_screen(pScreen, i, TRUE);
if (ret != 0) {
free(pScreen);
return ret;
}
/* This is where screen specific stuff gets initialized. Load the
screen structure, call the hardware, whatever.
This is also where the default colormap should be allocated and
also pixel values for blackPixel, whitePixel, and the cursor
Note that InitScreen is NOT allowed to modify argc, argv, or
any of the strings pointed to by argv. They may be passed to
multiple screens.
*/
screenInfo.gpuscreens[i] = pScreen;
screenInfo.numGPUScreens++;
if (!(*pfnInit) (pScreen, argc, argv)) {
dixFreePrivates(pScreen->devPrivates, PRIVATE_SCREEN);
free(pScreen);
screenInfo.numGPUScreens--;
return -1;
}
update_desktop_dimensions();
/*
* We cannot register the Screen PRIVATE_CURSOR key if cursors are already
* created, because dix/privates.c does not have relocation code for
* PRIVATE_CURSOR. Once this is fixed the if() can be removed and we can
* register the Screen PRIVATE_CURSOR key unconditionally.
*/
if (!dixPrivatesCreated(PRIVATE_CURSOR))
dixRegisterScreenPrivateKey(&cursorScreenDevPriv, pScreen,
PRIVATE_CURSOR, 0);
return i;
}
| 0
|
54,365
|
static void http_log(const char *fmt, ...)
{
va_list vargs;
va_start(vargs, fmt);
http_vlog(fmt, vargs);
va_end(vargs);
}
| 0
|
178,277
|
void OxideQQuickWebViewPrivate::NavigationRequested(
OxideQNavigationRequest* request) {
Q_Q(OxideQQuickWebView);
emit q->navigationRequested(request);
}
| 0
|
184,233
|
bool SyncManager::IsUsingExplicitPassphrase() {
return data_ && data_->IsUsingExplicitPassphrase();
}
| 0
|
394,924
|
static CURLMcode multi_addmsg(struct Curl_multi *multi,
struct Curl_message *msg)
{
if(!Curl_llist_insert_next(multi->msglist, multi->msglist->tail, msg))
return CURLM_OUT_OF_MEMORY;
return CURLM_OK;
}
| 0
|
28,086
|
static void decode_band_structure ( GetBitContext * gbc , int blk , int eac3 , int ecpl , int start_subband , int end_subband , const uint8_t * default_band_struct , int * num_bands , uint8_t * band_sizes ) {
int subbnd , bnd , n_subbands , n_bands = 0 ;
uint8_t bnd_sz [ 22 ] ;
uint8_t coded_band_struct [ 22 ] ;
const uint8_t * band_struct ;
n_subbands = end_subband - start_subband ;
if ( ! eac3 || get_bits1 ( gbc ) ) {
for ( subbnd = 0 ;
subbnd < n_subbands - 1 ;
subbnd ++ ) {
coded_band_struct [ subbnd ] = get_bits1 ( gbc ) ;
}
band_struct = coded_band_struct ;
}
else if ( ! blk ) {
band_struct = & default_band_struct [ start_subband + 1 ] ;
}
else {
return ;
}
if ( num_bands || band_sizes ) {
n_bands = n_subbands ;
bnd_sz [ 0 ] = ecpl ? 6 : 12 ;
for ( bnd = 0 , subbnd = 1 ;
subbnd < n_subbands ;
subbnd ++ ) {
int subbnd_size = ( ecpl && subbnd < 4 ) ? 6 : 12 ;
if ( band_struct [ subbnd - 1 ] ) {
n_bands -- ;
bnd_sz [ bnd ] += subbnd_size ;
}
else {
bnd_sz [ ++ bnd ] = subbnd_size ;
}
}
}
if ( num_bands ) * num_bands = n_bands ;
if ( band_sizes ) memcpy ( band_sizes , bnd_sz , n_bands ) ;
}
| 0
|
328,058
|
float64 helper_fqtod(CPUSPARCState *env)
{
float64 ret;
clear_float_exceptions(env);
ret = float128_to_float64(QT1, &env->fp_status);
check_ieee_exceptions(env);
return ret;
}
| 0
|
451,610
|
static void StoreSymbolWithContext(BlockEncoder* self, size_t symbol,
size_t context, const uint32_t* context_map, size_t* storage_ix,
uint8_t* storage, const size_t context_bits) {
if (self->block_len_ == 0) {
size_t block_ix = ++self->block_ix_;
uint32_t block_len = self->block_lengths_[block_ix];
uint8_t block_type = self->block_types_[block_ix];
self->block_len_ = block_len;
self->entropy_ix_ = (size_t)block_type << context_bits;
StoreBlockSwitch(&self->block_split_code_, block_len, block_type, 0,
storage_ix, storage);
}
--self->block_len_;
{
size_t histo_ix = context_map[self->entropy_ix_ + context];
size_t ix = histo_ix * self->histogram_length_ + symbol;
BrotliWriteBits(self->depths_[ix], self->bits_[ix], storage_ix, storage);
}
}
| 0
|
257,912
|
static inline void NVRAM_set_lword ( m48t59_t * nvram , uint32_t addr , uint32_t value ) {
m48t59_set_addr ( nvram , addr ) ;
m48t59_write ( nvram , value >> 24 ) ;
m48t59_set_addr ( nvram , addr + 1 ) ;
m48t59_write ( nvram , ( value >> 16 ) & 0xFF ) ;
m48t59_set_addr ( nvram , addr + 2 ) ;
m48t59_write ( nvram , ( value >> 8 ) & 0xFF ) ;
m48t59_set_addr ( nvram , addr + 3 ) ;
m48t59_write ( nvram , value & 0xFF ) ;
}
| 0
|
316,159
|
static int test_weird_arguments(void)
{
int errors = 0;
char buf[256];
int rc;
/* MAX_PARAMETERS is 128, try exact 128! */
rc = curl_msnprintf(buf, sizeof(buf),
"%d%d%d%d%d%d%d%d%d%d" /* 10 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 1 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 2 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 3 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 4 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 5 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 6 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 7 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 8 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 9 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 10 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 11 */
"%d%d%d%d%d%d%d%d" /* 8 */
,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 1 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 2 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 3 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 4 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 5 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 6 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 7 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 8 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 9 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 10 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 11 */
0, 1, 2, 3, 4, 5, 6, 7); /* 8 */
if(rc != 128) {
printf("curl_mprintf() returned %d and not 128!\n", rc);
errors++;
}
errors += string_check(buf,
"0123456789" /* 10 */
"0123456789" /* 10 1 */
"0123456789" /* 10 2 */
"0123456789" /* 10 3 */
"0123456789" /* 10 4 */
"0123456789" /* 10 5 */
"0123456789" /* 10 6 */
"0123456789" /* 10 7 */
"0123456789" /* 10 8 */
"0123456789" /* 10 9 */
"0123456789" /* 10 10*/
"0123456789" /* 10 11 */
"01234567" /* 8 */
);
/* MAX_PARAMETERS is 128, try more! */
buf[0] = 0;
rc = curl_msnprintf(buf, sizeof(buf),
"%d%d%d%d%d%d%d%d%d%d" /* 10 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 1 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 2 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 3 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 4 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 5 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 6 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 7 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 8 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 9 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 10 */
"%d%d%d%d%d%d%d%d%d%d" /* 10 11 */
"%d%d%d%d%d%d%d%d%d" /* 9 */
,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 1 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 2 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 3 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 4 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 5 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 6 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 7 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 8 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 9 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 10 */
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, /* 10 11 */
0, 1, 2, 3, 4, 5, 6, 7, 8); /* 9 */
if(rc != -1) {
printf("curl_mprintf() returned %d and not -1!\n", rc);
errors++;
}
errors += string_check(buf, "");
if(errors)
printf("Some curl_mprintf() weird arguments tests failed!\n");
return errors;
}
| 0
|
483,970
|
static struct device *wakeup_source_device_create(struct device *parent,
struct wakeup_source *ws)
{
struct device *dev = NULL;
int retval = -ENODEV;
dev = kzalloc(sizeof(*dev), GFP_KERNEL);
if (!dev) {
retval = -ENOMEM;
goto error;
}
device_initialize(dev);
dev->devt = MKDEV(0, 0);
dev->class = wakeup_class;
dev->parent = parent;
dev->groups = wakeup_source_groups;
dev->release = device_create_release;
dev_set_drvdata(dev, ws);
device_set_pm_not_required(dev);
retval = kobject_set_name(&dev->kobj, "wakeup%d", ws->id);
if (retval)
goto error;
retval = device_add(dev);
if (retval)
goto error;
return dev;
error:
put_device(dev);
return ERR_PTR(retval);
}
| 0
|
501,169
|
GF_Err stvi_box_size(GF_Box *s)
{
GF_StereoVideoBox *ptr = (GF_StereoVideoBox *)s;
ptr->size+= 12 + ptr->sit_len;
return GF_OK;
}
| 0
|
114,804
|
static struct hash_cell *__get_name_cell(const char *str)
{
struct hash_cell *hc;
unsigned int h = hash_str(str);
list_for_each_entry (hc, _name_buckets + h, name_list)
if (!strcmp(hc->name, str)) {
dm_get(hc->md);
return hc;
}
return NULL;
}
| 0
|
291,464
|
mrb_obj_freeze(mrb_state *mrb, mrb_value self)
{
struct RBasic *b;
switch (mrb_type(self)) {
case MRB_TT_FALSE:
case MRB_TT_TRUE:
case MRB_TT_FIXNUM:
case MRB_TT_SYMBOL:
#ifndef MRB_WITHOUT_FLOAT
case MRB_TT_FLOAT:
#endif
return self;
default:
break;
}
b = mrb_basic_ptr(self);
if (!MRB_FROZEN_P(b)) {
MRB_SET_FROZEN_FLAG(b);
}
return self;
}
| 0
|
297,481
|
int mnt_fs_set_bindsrc(struct libmnt_fs *fs, const char *src)
{
return strdup_to_struct_member(fs, bindsrc, src);
}
| 0
|
399,605
|
static inline void init_timer_on_stack_key(struct timer_list *timer,
unsigned int flags, const char *name,
struct lock_class_key *key)
{
init_timer_key(timer, flags, name, key);
}
| 0
|
265,456
|
SystemAgent::Write (const YCPPath& path, const YCPValue& value,
const YCPValue& arg)
{
y2debug ("Write (%s)", path->toString().c_str());
if (path->isRoot())
{
ycp2error ("Write () called without sub-path");
return YCPBoolean (false);
}
const string cmd = path->component_str (0); // just a shortcut
if (cmd == "passwd")
{
/**
* @builtin Write (.target.passwd.<name>, string cryptval) -> bool
* .passwd can be used to set or modify the encrypted password
* of an already existing user in /etc/passwd and /etc/shadow.
*
* This call returns true on success and false, if it fails.
*
* @example Write (.target.passwd.root, crypt (a_passwd))
*/
if (path->length() != 2)
{
ycp2error ("Bad path argument in call to Write (.passwd.name)");
return YCPBoolean (false);
}
if (value.isNull() || !value->isString())
{
ycp2error ("Bad password argument in call to Write (.passwd)");
return YCPBoolean (false);
}
string passwd = value->asString()->value();
string bashcommand =
string ("/bin/echo '") +
path->component_str (1).c_str () + ":" + passwd +
"' |/usr/sbin/chpasswd -e >/dev/null 2>&1";
// Don't write the password into the log - even though it's crypted
// y2debug("Executing: '%s'", bashcommand.c_str());
int exitcode = system(bashcommand.c_str());
return YCPBoolean (WIFEXITED (exitcode) && WEXITSTATUS (exitcode) == 0);
}
else if (cmd == "string")
{
/**
* @builtin Write (.target.string, string filename, string value) -> boolean
* @builtin Write (.target.string, [string filename, integer filemode] , string value) -> boolean
* Writes the string <tt>value</tt> into a file. If the file already
* exists, the existing file is overwritten. The return value is
* true, if the file has been written successfully.
*
* @example Write(.target.string, "/etc/papersize", "a4") -> true
* @example Write(.target.string, ["/etc/rsyncd.secrets", 0600], "user:passwd") -> true
*/
if (value.isNull() || !(value->isString() || value->isList()))
{
ycp2error ("Bad filename arg for Write (.string ...)");
return YCPBoolean (false);
}
string filename;
mode_t filemode = 0644;
if (value->isString())
{
filename = value->asString()->value();
}
else
{ // value is list
YCPList flist = value->asList();
if ((flist->size() != 2)
|| (!flist->value(0)->isString())
|| (!flist->value(1)->isInteger()))
{
ycp2error ("Bad [filename, mode] list in call to Write (%s, [ string filename, integer mode ], ...)",
cmd.c_str ());
return YCPBoolean (false);
}
filename = flist->value(0)->asString()->value();
filemode = (int)(flist->value(1)->asInteger()->value());
}
if (arg.isNull() || !arg->isString())
{
ycp2error ("Bad string value for Write (.string ...)");
return YCPBoolean (false);
}
int fd = open(filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC, filemode);
if (fd >= 0)
{
string cont = arg->asString()->value();
const char *buffer = cont.c_str();
size_t length = cont.length();
size_t written = write(fd, buffer, length);
close(fd);
return YCPBoolean (written == length);
}
ycp2error ("Write (.string, \"%s\") failed: %s", filename.c_str (), strerror (errno));
return YCPBoolean(false);
}
else if (cmd == "byte")
{
/**
* @builtin Write (.target.byte, string filename, byteblock) -> boolean
* Write a byteblock into a file.
*/
if (value.isNull () || !value->isString ())
{
ycp2error ("Bad filename arg for Write (.byte, ...)");
return YCPBoolean (false);
}
if (arg.isNull () || !arg->isByteblock ())
{
ycp2error ("Bad value for Write (.byte, filename, byteblock)");
return YCPBoolean (false);
}
string filename = value->asString ()->value ();
YCPByteblock byteblock = arg->asByteblock ();
int fd = open (filename.c_str (), O_WRONLY | O_CREAT | O_TRUNC, 0644);
if (fd >= 0)
{
size_t size = byteblock->size ();
size_t write_size = write (fd, byteblock->value (), size);
close (fd);
return YCPBoolean (write_size == size);
}
ycp2error ("Write (.byte, \"%s\") failed: %s", filename.c_str (), strerror (errno));
return YCPBoolean (false);
}
else if (cmd == "ycp" || cmd == "yast2")
{
/**
* @builtin Write (.target.ycp, string filename, any value) -> boolean
* Opens a file for writing and prints the value <tt>value</tt> in
* YCP syntax to that file. Returns true, if the file has
* been written, false otherwise. The newly created file gets
* the mode 0644 minus umask. Furthermore any missing directory in the
* pathname <tt>filename</tt> is created automatically.
*/
/**
* @builtin Write (.target.ycp, [ string filename, integer mode], any value) -> boolean
* Opens a file for writing and prints the value <tt>value</tt> in
* YCP syntax to that file. Returns true, if the file has
* been written, false otherwise. The newly created file gets
* the mode mode minus umask. Furthermore any missing directory in the
* pathname <tt>filename</tt> is created automatically.
*/
// either string or list
if (value.isNull() || !(value->isString() || value->isList()))
{
ycp2error ("Bad arguments to Write (%s, string filename ...)", cmd.c_str ());
return YCPBoolean (false);
}
string filename;
mode_t filemode = 0644;
if (value->isString())
{
filename = value->asString()->value();
}
else
{ // value is list
YCPList flist = value->asList();
if ((flist->size() != 2)
|| (!flist->value(0)->isString())
|| (!flist->value(1)->isInteger()))
{
ycp2error ("Bad [filename, mode] list in call to Write (%s, [ string filename, integer mode ], ...)",
cmd.c_str ());
return YCPBoolean (false);
}
filename = flist->value(0)->asString()->value();
filemode = (int)(flist->value(1)->asInteger()->value());
}
if (filename.length() == 0)
{
ycp2error ("Invalid empty filename in Write (%s, ...)", cmd.c_str ());
return YCPBoolean (false);
}
// Create directory, if missing
size_t pos = 0;
while (pos = filename.find('/', pos + 1), pos != string::npos)
mkdir (filename.substr(0, pos).c_str(), 0775);
// Remove file, if existing
remove (filename.c_str());
int fd = open (filename.c_str(), O_WRONLY | O_CREAT | O_TRUNC , filemode);
bool success = false;
if (fd < 0)
{
ycp2error ("Error opening '%s': %s", filename.c_str (), strerror (errno));
return YCPBoolean (false);
}
// string contents = (arg.isNull() ? "" : arg->toString());
string contents = (arg.isNull() ? "" : dump_value(0, arg));
ssize_t size = contents.length();
if (size == write(fd, contents.c_str(), size)
&& write(fd, "\n", 1) == 1)
success = true;
close(fd);
return YCPBoolean(success);
}
ycp2error ("Undefined subpath for Write (%s)", path->toString ().c_str ());
return YCPBoolean (false);
}
| 0
|
165,412
|
void WebContentsImpl::GetRenderViewHostAtPosition(
int x,
int y,
const base::Callback<void(RenderViewHost*, int, int)>& callback) {
BrowserPluginEmbedder* embedder = GetBrowserPluginEmbedder();
if (embedder)
embedder->GetRenderViewHostAtPosition(x, y, callback);
else
callback.Run(GetRenderViewHost(), x, y);
}
| 0
|
197,414
|
void GLES2DecoderImpl::DoTexStorage2DEXT(GLenum target,
GLsizei levels,
GLenum internal_format,
GLsizei width,
GLsizei height) {
TRACE_EVENT2("gpu", "GLES2DecoderImpl::DoTexStorage2D",
"width", width, "height", height);
TexStorageImpl(target, levels, internal_format, width, height, 1,
ContextState::k2D, "glTexStorage2D");
}
| 0
|
320,057
|
void *qemu_realloc(void *ptr, size_t size)
{
if (!size && !allow_zero_malloc()) {
abort();
}
return oom_check(realloc(ptr, size ? size : 1));
}
| 1
|
483,660
|
static ssize_t print_cpus_nohz_full(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%*pbl\n", cpumask_pr_args(tick_nohz_full_mask));
}
| 0
|
73,106
|
void qeth_trace_features(struct qeth_card *card)
{
QETH_CARD_TEXT(card, 2, "features");
QETH_CARD_TEXT_(card, 2, "%x", card->options.ipa4.supported_funcs);
QETH_CARD_TEXT_(card, 2, "%x", card->options.ipa4.enabled_funcs);
QETH_CARD_TEXT_(card, 2, "%x", card->options.ipa6.supported_funcs);
QETH_CARD_TEXT_(card, 2, "%x", card->options.ipa6.enabled_funcs);
QETH_CARD_TEXT_(card, 2, "%x", card->options.adp.supported_funcs);
QETH_CARD_TEXT_(card, 2, "%x", card->options.adp.enabled_funcs);
QETH_CARD_TEXT_(card, 2, "%x", card->info.diagass_support);
}
| 0
|
349,069
|
TEST_F(ConnectionHandlerTest, TransportProtocolCustom) {
TestListener* test_listener = addListener(1, true, false, "test_listener");
Network::MockListener* listener = new Network::MockListener();
Network::ListenerCallbacks* listener_callbacks;
EXPECT_CALL(dispatcher_, createListener_(_, _, _))
.WillOnce(
Invoke([&](Network::Socket&, Network::ListenerCallbacks& cb, bool) -> Network::Listener* {
listener_callbacks = &cb;
return listener;
}));
EXPECT_CALL(test_listener->socket_, localAddress());
handler_->addListener(*test_listener);
Network::MockListenerFilter* test_filter = new Network::MockListenerFilter();
EXPECT_CALL(factory_, createListenerFilterChain(_))
.WillRepeatedly(Invoke([&](Network::ListenerFilterManager& manager) -> bool {
manager.addAcceptFilter(Network::ListenerFilterPtr{test_filter});
return true;
}));
absl::string_view dummy = "dummy";
EXPECT_CALL(*test_filter, onAccept(_))
.WillOnce(Invoke([&](Network::ListenerFilterCallbacks& cb) -> Network::FilterStatus {
cb.socket().setDetectedTransportProtocol(dummy);
return Network::FilterStatus::Continue;
}));
Network::MockConnectionSocket* accepted_socket = new NiceMock<Network::MockConnectionSocket>();
EXPECT_CALL(*accepted_socket, setDetectedTransportProtocol(dummy));
EXPECT_CALL(*accepted_socket, detectedTransportProtocol()).WillOnce(Return(dummy));
EXPECT_CALL(manager_, findFilterChain(_)).WillOnce(Return(nullptr));
listener_callbacks->onAccept(Network::ConnectionSocketPtr{accepted_socket});
EXPECT_CALL(*listener, onDestroy());
}
| 1
|
303,066
|
lldpd_send(struct lldpd_hardware *hardware)
{
struct lldpd *cfg = hardware->h_cfg;
struct lldpd_port *port;
int i, sent;
if (cfg->g_config.c_receiveonly || cfg->g_config.c_paused) return;
if (hardware->h_lport.p_disable_tx) return;
if ((hardware->h_flags & IFF_RUNNING) == 0)
return;
log_debug("send", "send PDU on %s", hardware->h_ifname);
sent = 0;
for (i=0; cfg->g_protocols[i].mode != 0; i++) {
if (!cfg->g_protocols[i].enabled)
continue;
/* We send only if we have at least one remote system
* speaking this protocol or if the protocol is forced */
if (cfg->g_protocols[i].enabled > 1) {
cfg->g_protocols[i].send(cfg, hardware);
sent++;
continue;
}
TAILQ_FOREACH(port, &hardware->h_rports, p_entries) {
/* If this remote port is disabled, we don't
* consider it */
if (port->p_hidden_out)
continue;
if (port->p_protocol ==
cfg->g_protocols[i].mode) {
TRACE(LLDPD_FRAME_SEND(hardware->h_ifname,
cfg->g_protocols[i].name));
log_debug("send", "send PDU on %s with protocol %s",
hardware->h_ifname,
cfg->g_protocols[i].name);
cfg->g_protocols[i].send(cfg,
hardware);
sent++;
break;
}
}
}
if (!sent) {
/* Nothing was sent for this port, let's speak the first
* available protocol. */
for (i = 0; cfg->g_protocols[i].mode != 0; i++) {
if (!cfg->g_protocols[i].enabled) continue;
TRACE(LLDPD_FRAME_SEND(hardware->h_ifname,
cfg->g_protocols[i].name));
log_debug("send", "fallback to protocol %s for %s",
cfg->g_protocols[i].name, hardware->h_ifname);
cfg->g_protocols[i].send(cfg,
hardware);
break;
}
if (cfg->g_protocols[i].mode == 0)
log_warnx("send", "no protocol enabled, dunno what to send");
}
}
| 0
|
137,971
|
String HHVM_FUNCTION(number_format,
double number,
int decimals /* = 0 */,
const Variant& dec_point_in /* = "." */,
const Variant& thousands_sep_in /* = "," */) {
String dec_point(".");
if (!dec_point_in.isNull()) {
dec_point = dec_point_in.toString();
}
String thousands_sep(",");
if (!thousands_sep_in.isNull()) {
thousands_sep = thousands_sep_in.toString();
}
return string_number_format(number, decimals, dec_point, thousands_sep);
}
| 0
|
133,304
|
gstd_accept(int fd, char **display_creds, char **export_name, char **mech)
{
gss_name_t client;
gss_OID mech_oid;
struct gstd_tok *tok;
gss_ctx_id_t ctx = GSS_C_NO_CONTEXT;
gss_buffer_desc in, out;
OM_uint32 maj, min;
int ret;
*display_creds = NULL;
*export_name = NULL;
out.length = 0;
in.length = 0;
read_packet(fd, &in, 60000, 1);
again:
while ((ret = read_packet(fd, &in, 60000, 0)) == -2)
;
if (ret < 1)
return NULL;
maj = gss_accept_sec_context(&min, &ctx, GSS_C_NO_CREDENTIAL,
&in, GSS_C_NO_CHANNEL_BINDINGS, &client, &mech_oid, &out, NULL,
NULL, NULL);
gss_release_buffer(&min, &in);
if (out.length && write_packet(fd, &out)) {
gss_release_buffer(&min, &out);
return NULL;
}
gss_release_buffer(&min, &out);
GSTD_GSS_ERROR(maj, min, NULL, "gss_accept_sec_context");
if (maj & GSS_S_CONTINUE_NEEDED)
goto again;
*display_creds = gstd_get_display_name(client);
*export_name = gstd_get_export_name(client);
*mech = gstd_get_mech(mech_oid);
gss_release_name(&min, &client);
SETUP_GSTD_TOK(tok, ctx, fd, "gstd_accept");
return tok;
}
| 0
|
159,623
|
static inline uint16_t vring_used_event(VirtQueue *vq)
{
return vring_avail_ring(vq, vq->vring.num);
}
| 0
|
328,529
|
static int xhci_submit(XHCIState *xhci, XHCITransfer *xfer, XHCIEPContext *epctx)
{
uint64_t mfindex;
DPRINTF("xhci_submit(slotid=%d,epid=%d)\n", xfer->slotid, xfer->epid);
xfer->in_xfer = epctx->type>>2;
switch(epctx->type) {
case ET_INTR_OUT:
case ET_INTR_IN:
xfer->pkts = 0;
xfer->iso_xfer = false;
xfer->timed_xfer = true;
mfindex = xhci_mfindex_get(xhci);
xhci_calc_intr_kick(xhci, xfer, epctx, mfindex);
xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex);
if (xfer->running_retry) {
return -1;
}
break;
case ET_BULK_OUT:
case ET_BULK_IN:
xfer->pkts = 0;
xfer->iso_xfer = false;
xfer->timed_xfer = false;
break;
case ET_ISO_OUT:
case ET_ISO_IN:
xfer->pkts = 1;
xfer->iso_xfer = true;
xfer->timed_xfer = true;
mfindex = xhci_mfindex_get(xhci);
xhci_calc_iso_kick(xhci, xfer, epctx, mfindex);
xhci_check_intr_iso_kick(xhci, xfer, epctx, mfindex);
if (xfer->running_retry) {
return -1;
}
break;
default:
trace_usb_xhci_unimplemented("endpoint type", epctx->type);
return -1;
}
if (xhci_setup_packet(xfer) < 0) {
return -1;
}
usb_handle_packet(xfer->packet.ep->dev, &xfer->packet);
xhci_try_complete_packet(xfer);
if (!xfer->running_async && !xfer->running_retry) {
xhci_kick_epctx(xfer->epctx, xfer->streamid);
}
return 0;
}
| 0
|
354,162
|
bool TABLE::vcol_fix_exprs(THD *thd)
{
if (pos_in_table_list->placeholder() || !s->vcols_need_refixing ||
pos_in_table_list->lock_type < TL_WRITE_ALLOW_WRITE)
return false;
DBUG_ASSERT(pos_in_table_list != thd->lex->first_not_own_table());
bool result= true;
Security_context *save_security_ctx= thd->security_ctx;
Query_arena *stmt_backup= thd->stmt_arena;
if (thd->stmt_arena->is_conventional())
thd->stmt_arena= expr_arena;
if (pos_in_table_list->security_ctx)
thd->security_ctx= pos_in_table_list->security_ctx;
for (Field **vf= vfield; vf && *vf; vf++)
if ((*vf)->vcol_info->fix_session_expr(thd))
goto end;
for (Field **df= default_field; df && *df; df++)
if ((*df)->default_value &&
(*df)->default_value->fix_session_expr(thd))
goto end;
for (Virtual_column_info **cc= check_constraints; cc && *cc; cc++)
if ((*cc)->fix_session_expr(thd))
goto end;
result= false;
end:
thd->security_ctx= save_security_ctx;
thd->stmt_arena= stmt_backup;
return result;
}
| 1
|
471,939
|
sds sdsResize(sds s, size_t size) {
void *sh, *newsh;
char type, oldtype = s[-1] & SDS_TYPE_MASK;
int hdrlen, oldhdrlen = sdsHdrSize(oldtype);
size_t len = sdslen(s);
sh = (char*)s-oldhdrlen;
/* Return ASAP if the size is already good. */
if (sdsalloc(s) == size) return s;
/* Truncate len if needed. */
if (size < len) len = size;
/* Check what would be the minimum SDS header that is just good enough to
* fit this string. */
type = sdsReqType(size);
/* Don't use type 5, it is not good for strings that are resized. */
if (type == SDS_TYPE_5) type = SDS_TYPE_8;
hdrlen = sdsHdrSize(type);
/* If the type is the same, or can hold the size in it with low overhead
* (larger than SDS_TYPE_8), we just realloc(), letting the allocator
* to do the copy only if really needed. Otherwise if the change is
* huge, we manually reallocate the string to use the different header
* type. */
if (oldtype==type || (type < oldtype && type > SDS_TYPE_8)) {
newsh = s_realloc(sh, oldhdrlen+size+1);
if (newsh == NULL) return NULL;
s = (char*)newsh+oldhdrlen;
} else {
newsh = s_malloc(hdrlen+size+1);
if (newsh == NULL) return NULL;
memcpy((char*)newsh+hdrlen, s, len);
s_free(sh);
s = (char*)newsh+hdrlen;
s[-1] = type;
}
s[len] = 0;
sdssetlen(s, len);
sdssetalloc(s, size);
return s;
}
| 0
|
191,676
|
offline_pages::RequestStats* GetRequestStats() {
return offliner_->GetRequestStatsForTest();
}
| 0
|
511,501
|
num_fifos ()
{
return nfds;
}
| 0
|
78,314
|
get_callout_arg_type_by_name_id(int name_id, int index)
{
return GlobalCalloutNameList->v[name_id].arg_types[index];
}
| 0
|
166,371
|
long sched_getaffinity(pid_t pid, struct cpumask *mask)
{
struct task_struct *p;
unsigned long flags;
int retval;
rcu_read_lock();
retval = -ESRCH;
p = find_process_by_pid(pid);
if (!p)
goto out_unlock;
retval = security_task_getscheduler(p);
if (retval)
goto out_unlock;
raw_spin_lock_irqsave(&p->pi_lock, flags);
cpumask_and(mask, &p->cpus_allowed, cpu_active_mask);
raw_spin_unlock_irqrestore(&p->pi_lock, flags);
out_unlock:
rcu_read_unlock();
return retval;
}
| 0
|
402,234
|
static void ahci_init_d2h(AHCIDevice *ad)
{
IDEState *ide_state = &ad->port.ifs[0];
AHCIPortRegs *pr = &ad->port_regs;
if (ad->init_d2h_sent) {
return;
}
if (ahci_write_fis_d2h(ad)) {
ad->init_d2h_sent = true;
/* We're emulating receiving the first Reg H2D Fis from the device;
* Update the SIG register, but otherwise proceed as normal. */
pr->sig = ((uint32_t)ide_state->hcyl << 24) |
(ide_state->lcyl << 16) |
(ide_state->sector << 8) |
(ide_state->nsector & 0xFF);
}
}
| 0
|
397,812
|
png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
png_const_charp name, png_uint_32 profile_length)
{
if (!icc_check_length(png_ptr, colorspace, name, profile_length))
return 0;
/* This needs to be here because the 'normal' check is in
* png_decompress_chunk, yet this happens after the attempt to
* png_malloc_base the required data. We only need this on read; on write
* the caller supplies the profile buffer so libpng doesn't allocate it. See
* the call to icc_check_length below (the write case).
*/
# ifdef PNG_SET_USER_LIMITS_SUPPORTED
else if (png_ptr->user_chunk_malloc_max > 0 &&
png_ptr->user_chunk_malloc_max < profile_length)
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"exceeds application limits");
# elif PNG_USER_CHUNK_MALLOC_MAX > 0
else if (PNG_USER_CHUNK_MALLOC_MAX < profile_length)
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"exceeds libpng limits");
# else /* !SET_USER_LIMITS */
/* This will get compiled out on all 32-bit and better systems. */
else if (PNG_SIZE_MAX < profile_length)
return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
"exceeds system limits");
# endif /* !SET_USER_LIMITS */
return 1;
}
| 0
|
285,519
|
static const OSExchangeData::CustomFormat& GetRendererTaintCustomType() {
CR_DEFINE_STATIC_LOCAL(
ui::OSExchangeData::CustomFormat,
format,
(ui::Clipboard::GetFormatType("chromium/x-renderer-taint")));
return format;
}
| 0
|
152,094
|
static int ssb_prctl_get(struct task_struct *task)
{
switch (ssb_mode) {
case SPEC_STORE_BYPASS_DISABLE:
return PR_SPEC_DISABLE;
case SPEC_STORE_BYPASS_SECCOMP:
case SPEC_STORE_BYPASS_PRCTL:
if (task_spec_ssb_force_disable(task))
return PR_SPEC_PRCTL | PR_SPEC_FORCE_DISABLE;
if (task_spec_ssb_disable(task))
return PR_SPEC_PRCTL | PR_SPEC_DISABLE;
return PR_SPEC_PRCTL | PR_SPEC_ENABLE;
default:
if (boot_cpu_has_bug(X86_BUG_SPEC_STORE_BYPASS))
return PR_SPEC_ENABLE;
return PR_SPEC_NOT_AFFECTED;
}
}
| 0
|
222,140
|
PHP_FUNCTION(mb_ereg_search_getregs)
{
int n, i, len, beg, end;
OnigUChar *str;
if (MBREX(search_regs) != NULL && Z_TYPE_P(MBREX(search_str)) == IS_STRING && Z_STRVAL_P(MBREX(search_str)) != NULL) {
array_init(return_value);
str = (OnigUChar *)Z_STRVAL_P(MBREX(search_str));
len = Z_STRLEN_P(MBREX(search_str));
n = MBREX(search_regs)->num_regs;
for (i = 0; i < n; i++) {
beg = MBREX(search_regs)->beg[i];
end = MBREX(search_regs)->end[i];
if (beg >= 0 && beg <= end && end <= len) {
add_index_stringl(return_value, i, (char *)&str[beg], end - beg, 1);
} else {
add_index_bool(return_value, i, 0);
}
}
} else {
RETVAL_FALSE;
}
}
| 0
|
208,356
|
static void CallWithScriptStateVoidMethodMethod(const v8::FunctionCallbackInfo<v8::Value>& info) {
TestObject* impl = V8TestObject::ToImpl(info.Holder());
ScriptState* script_state = ScriptState::ForRelevantRealm(info);
impl->callWithScriptStateVoidMethod(script_state);
}
| 0
|
110,624
|
static int mov_write_mdta_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
AVFormatContext *s)
{
AVDictionaryEntry *t = NULL;
int64_t pos = avio_tell(pb);
int count = 1; /* keys are 1-index based */
avio_wb32(pb, 0); /* size */
ffio_wfourcc(pb, "ilst");
while (t = av_dict_get(s->metadata, "", t, AV_DICT_IGNORE_SUFFIX)) {
int64_t entry_pos = avio_tell(pb);
avio_wb32(pb, 0); /* size */
avio_wb32(pb, count); /* key */
mov_write_string_data_tag(pb, t->value, 0, 1);
update_size(pb, entry_pos);
count += 1;
}
return update_size(pb, pos);
}
| 0
|
209,944
|
void OfflineLoadPage::GetAppOfflineStrings(
const Extension* app,
const string16& failed_url,
DictionaryValue* strings) const {
strings->SetString("title", app->name());
GURL icon_url = app->GetIconURL(Extension::EXTENSION_ICON_LARGE,
ExtensionIconSet::MATCH_EXACTLY);
if (icon_url.is_empty()) {
strings->SetString("display_icon", "none");
strings->SetString("icon", string16());
} else {
strings->SetString("display_icon", "block");
strings->SetString("icon", icon_url.spec());
}
strings->SetString(
"msg",
l10n_util::GetStringFUTF16(IDS_APP_OFFLINE_LOAD_DESCRIPTION,
failed_url));
}
| 0
|
263,666
|
AVCPBProperties *av_cpb_properties_alloc(size_t *size)
{
AVCPBProperties *props = av_mallocz(sizeof(AVCPBProperties));
if (!props)
return NULL;
if (size)
*size = sizeof(*props);
props->vbv_delay = UINT64_MAX;
return props;
}
| 0
|
11,751
|
static Image *ExtractPostscript(Image *image,const ImageInfo *image_info,
MagickOffsetType PS_Offset,ssize_t PS_Size,ExceptionInfo *exception)
{
char
postscript_file[MaxTextExtent];
const MagicInfo
*magic_info;
FILE
*ps_file;
ImageInfo
*clone_info;
Image
*image2;
unsigned char
magick[2*MaxTextExtent];
if ((clone_info=CloneImageInfo(image_info)) == NULL)
return(image);
clone_info->blob=(void *) NULL;
clone_info->length=0;
/* Obtain temporary file */
(void) AcquireUniqueFilename(postscript_file);
ps_file=fopen_utf8(postscript_file,"wb");
if (ps_file == (FILE *) NULL)
goto FINISH;
/* Copy postscript to temporary file */
(void) SeekBlob(image,PS_Offset,SEEK_SET);
(void) ReadBlob(image, 2*MaxTextExtent, magick);
(void) SeekBlob(image,PS_Offset,SEEK_SET);
while(PS_Size-- > 0)
{
(void) fputc(ReadBlobByte(image),ps_file);
}
(void) fclose(ps_file);
/* Detect file format - Check magic.mgk configuration file. */
magic_info=GetMagicInfo(magick,2*MaxTextExtent,exception);
if(magic_info == (const MagicInfo *) NULL) goto FINISH_UNL;
/* printf("Detected:%s \n",magic_info->name); */
if(exception->severity != UndefinedException) goto FINISH_UNL;
if(magic_info->name == (char *) NULL) goto FINISH_UNL;
(void) CopyMagickMemory(clone_info->magick,magic_info->name,MaxTextExtent);
/* Read nested image */
/*FormatString(clone_info->filename,"%s:%s",magic_info->name,postscript_file);*/
FormatLocaleString(clone_info->filename,MaxTextExtent,"%s",postscript_file);
image2=ReadImage(clone_info,exception);
if (!image2)
goto FINISH_UNL;
/*
Replace current image with new image while copying base image
attributes.
*/
(void) CopyMagickMemory(image2->filename,image->filename,MaxTextExtent);
(void) CopyMagickMemory(image2->magick_filename,image->magick_filename,MaxTextExtent);
(void) CopyMagickMemory(image2->magick,image->magick,MaxTextExtent);
image2->depth=image->depth;
DestroyBlob(image2);
image2->blob=ReferenceBlob(image->blob);
if ((image->rows == 0) || (image->columns == 0))
DeleteImageFromList(&image);
AppendImageToList(&image,image2);
FINISH_UNL:
(void) RelinquishUniqueFileResource(postscript_file);
FINISH:
DestroyImageInfo(clone_info);
return(image);
}
| 1
|
321,464
|
static void init_proc_750fx (CPUPPCState *env)
{
gen_spr_ne_601(env);
gen_spr_7xx(env);
/* XXX : not implemented */
spr_register(env, SPR_L2CR, "L2CR",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, NULL,
0x00000000);
/* Time base */
gen_tbl(env);
/* Thermal management */
gen_spr_thrm(env);
/* XXX : not implemented */
spr_register(env, SPR_750_THRM4, "THRM4",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* Hardware implementation registers */
/* XXX : not implemented */
spr_register(env, SPR_HID0, "HID0",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_HID1, "HID1",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* XXX : not implemented */
spr_register(env, SPR_750FX_HID2, "HID2",
SPR_NOACCESS, SPR_NOACCESS,
&spr_read_generic, &spr_write_generic,
0x00000000);
/* Memory management */
gen_low_BATs(env);
/* PowerPC 750fx & 750gx has 8 DBATs and 8 IBATs */
gen_high_BATs(env);
init_excp_7x0(env);
env->dcache_line_size = 32;
env->icache_line_size = 32;
/* Allocate hardware IRQ controller */
ppc6xx_irq_init(env);
}
| 1
|
6,687
|
_PyMem_RawFree(void *ctx, void *ptr)
{
free(ptr);
}
| 1
|
477,802
|
CImg<_cimg_Tt> get_erode(const CImg<t>& kernel, const unsigned int boundary_conditions=1,
const bool is_real=false) const {
if (is_empty() || !kernel) return *this;
if (!is_real && kernel==0) return CImg<T>(width(),height(),depth(),spectrum(),0);
typedef _cimg_Tt Tt;
CImg<Tt> res(_width,_height,_depth,std::max(_spectrum,kernel._spectrum));
const int
mx2 = kernel.width()/2, my2 = kernel.height()/2, mz2 = kernel.depth()/2,
mx1 = kernel.width() - mx2 - 1, my1 = kernel.height() - my2 - 1, mz1 = kernel.depth() - mz2 - 1,
mxe = width() - mx2, mye = height() - my2, mze = depth() - mz2,
w2 = 2*width(), h2 = 2*height(), d2 = 2*depth();
const bool
is_inner_parallel = _width*_height*_depth>=(cimg_openmp_sizefactor)*32768,
is_outer_parallel = res.size()>=(cimg_openmp_sizefactor)*32768;
cimg::unused(is_inner_parallel,is_outer_parallel);
_cimg_abort_init_openmp;
cimg_abort_init;
cimg_pragma_openmp(parallel for cimg_openmp_if(!is_inner_parallel && is_outer_parallel))
cimg_forC(res,c) _cimg_abort_try_openmp {
cimg_abort_test;
const CImg<T> img = get_shared_channel(c%_spectrum);
const CImg<t> K = kernel.get_shared_channel(c%kernel._spectrum);
if (is_real) { // Real erosion
cimg_pragma_openmp(parallel for cimg_openmp_collapse(3) cimg_openmp_if(is_inner_parallel))
for (int z = mz1; z<mze; ++z)
for (int y = my1; y<mye; ++y)
for (int x = mx1; x<mxe; ++x) _cimg_abort_try_openmp2 {
cimg_abort_test2;
Tt min_val = cimg::type<Tt>::max();
for (int zm = -mz1; zm<=mz2; ++zm)
for (int ym = -my1; ym<=my2; ++ym)
for (int xm = -mx1; xm<=mx2; ++xm) {
const t mval = K(mx1 + xm,my1 + ym,mz1 + zm);
const Tt cval = (Tt)(img(x + xm,y + ym,z + zm) - mval);
if (cval<min_val) min_val = cval;
}
res(x,y,z,c) = min_val;
} _cimg_abort_catch_openmp2
cimg_pragma_openmp(parallel for cimg_openmp_collapse(2) cimg_openmp_if(is_inner_parallel))
cimg_forYZ(res,y,z) _cimg_abort_try_openmp2 {
cimg_abort_test2;
for (int x = 0; x<width(); (y<my1 || y>=mye || z<mz1 || z>=mze)?++x:((x<mx1 - 1 || x>=mxe)?++x:(x=mxe))) {
Tt min_val = cimg::type<Tt>::max();
for (int zm = -mz1; zm<=mz2; ++zm)
for (int ym = -my1; ym<=my2; ++ym)
for (int xm = -mx1; xm<=mx2; ++xm) {
const t mval = K(mx1 + xm,my1 + ym,mz1 + zm);
Tt cval;
switch (boundary_conditions) {
case 0 : cval = (Tt)(img.atXYZ(x + xm,y + ym,z + zm,0,(T)0) - mval); break;
case 1 : cval = (Tt)(img._atXYZ(x + xm,y + ym,z + zm) - mval); break;
case 2 : {
const int
nx = cimg::mod(x + xm,width()),
ny = cimg::mod(y + ym,height()),
nz = cimg::mod(z + zm,depth());
cval = img(nx,ny,nz) - mval;
} break;
default : {
const int
tx = cimg::mod(x + xm,w2),
ty = cimg::mod(y + ym,h2),
tz = cimg::mod(z + zm,d2),
nx = tx<width()?tx:w2 - tx - 1,
ny = ty<height()?ty:h2 - ty - 1,
nz = tz<depth()?tz:d2 - tz - 1;
cval = img(nx,ny,nz) - mval;
}
}
if (cval<min_val) min_val = cval;
}
res(x,y,z,c) = min_val;
}
} _cimg_abort_catch_openmp2
} else { // Binary erosion
cimg_pragma_openmp(parallel for cimg_openmp_collapse(3) cimg_openmp_if(is_inner_parallel))
for (int z = mz1; z<mze; ++z)
for (int y = my1; y<mye; ++y)
for (int x = mx1; x<mxe; ++x) _cimg_abort_try_openmp2 {
cimg_abort_test2;
Tt min_val = cimg::type<Tt>::max();
for (int zm = -mz1; zm<=mz2; ++zm)
for (int ym = -my1; ym<=my2; ++ym)
for (int xm = -mx1; xm<=mx2; ++xm)
if (K(mx1 + xm,my1 + ym,mz1 + zm)) {
const Tt cval = (Tt)img(x + xm,y + ym,z + zm);
if (cval<min_val) min_val = cval;
}
res(x,y,z,c) = min_val;
} _cimg_abort_catch_openmp2
cimg_pragma_openmp(parallel for cimg_openmp_collapse(2) cimg_openmp_if(is_inner_parallel))
cimg_forYZ(res,y,z) _cimg_abort_try_openmp2 {
cimg_abort_test2;
for (int x = 0; x<width(); (y<my1 || y>=mye || z<mz1 || z>=mze)?++x:((x<mx1 - 1 || x>=mxe)?++x:(x=mxe))) {
Tt min_val = cimg::type<Tt>::max();
for (int zm = -mz1; zm<=mz2; ++zm)
for (int ym = -my1; ym<=my2; ++ym)
for (int xm = -mx1; xm<=mx2; ++xm) {
if (K(mx1 + xm,my1 + ym,mz1 + zm)) {
Tt cval;
switch (boundary_conditions) {
case 0 : cval = (Tt)img.atXYZ(x + xm,y + ym,z + zm,0,(T)0); break;
case 1 : cval = (Tt)img._atXYZ(x + xm,y + ym,z + zm); break;
case 2 : {
const int
nx = cimg::mod(x + xm,width()),
ny = cimg::mod(y + ym,height()),
nz = cimg::mod(z + zm,depth());
cval = img(nx,ny,nz);
} break;
default : {
const int
tx = cimg::mod(x + xm,w2),
ty = cimg::mod(y + ym,h2),
tz = cimg::mod(z + zm,d2),
nx = tx<width()?tx:w2 - tx - 1,
ny = ty<height()?ty:h2 - ty - 1,
nz = tz<depth()?tz:d2 - tz - 1;
cval = img(nx,ny,nz);
}
}
if (cval<min_val) min_val = cval;
}
}
res(x,y,z,c) = min_val;
}
} _cimg_abort_catch_openmp2
}
} _cimg_abort_catch_openmp
cimg_abort_test;
return res;
}
| 0
|
174,422
|
void Document::setDomain(const String& newDomain, ExceptionState& exceptionState)
{
UseCounter::count(*this, UseCounter::DocumentSetDomain);
if (isSandboxed(SandboxDocumentDomain)) {
exceptionState.throwSecurityError("Assignment is forbidden for sandboxed iframes.");
return;
}
if (SchemeRegistry::isDomainRelaxationForbiddenForURLScheme(getSecurityOrigin()->protocol())) {
exceptionState.throwSecurityError("Assignment is forbidden for the '" + getSecurityOrigin()->protocol() + "' scheme.");
return;
}
if (newDomain.isEmpty()) {
exceptionState.throwSecurityError("'" + newDomain + "' is an empty domain.");
return;
}
OriginAccessEntry accessEntry(getSecurityOrigin()->protocol(), newDomain, OriginAccessEntry::AllowSubdomains);
OriginAccessEntry::MatchResult result = accessEntry.matchesOrigin(*getSecurityOrigin());
if (result == OriginAccessEntry::DoesNotMatchOrigin) {
exceptionState.throwSecurityError("'" + newDomain + "' is not a suffix of '" + domain() + "'.");
return;
}
if (result == OriginAccessEntry::MatchesOriginButIsPublicSuffix) {
exceptionState.throwSecurityError("'" + newDomain + "' is a top-level domain.");
return;
}
getSecurityOrigin()->setDomainFromDOM(newDomain);
if (m_frame)
m_frame->script().updateSecurityOrigin(getSecurityOrigin());
}
| 0
|
439,407
|
static void sas_suspend_devices(struct work_struct *work)
{
struct asd_sas_phy *phy;
struct domain_device *dev;
struct sas_discovery_event *ev = to_sas_discovery_event(work);
struct asd_sas_port *port = ev->port;
struct Scsi_Host *shost = port->ha->core.shost;
struct sas_internal *si = to_sas_internal(shost->transportt);
clear_bit(DISCE_SUSPEND, &port->disc.pending);
sas_suspend_sata(port);
/* lldd is free to forget the domain_device across the
* suspension, we force the issue here to keep the reference
* counts aligned
*/
list_for_each_entry(dev, &port->dev_list, dev_list_node)
sas_notify_lldd_dev_gone(dev);
/* we are suspending, so we know events are disabled and
* phy_list is not being mutated
*/
list_for_each_entry(phy, &port->phy_list, port_phy_el) {
if (si->dft->lldd_port_deformed)
si->dft->lldd_port_deformed(phy);
phy->suspended = 1;
port->suspended = 1;
}
}
| 0
|
95,928
|
static void edge_release(struct usb_serial *serial)
{
kfree(usb_get_serial_data(serial));
}
| 0
|
325,806
|
static const char *pxb_host_root_bus_path(PCIHostState *host_bridge,
PCIBus *rootbus)
{
PXBBus *bus = PXB_BUS(rootbus);
snprintf(bus->bus_path, 8, "0000:%02x", pxb_bus_num(rootbus));
return bus->bus_path;
}
| 0
|
12,725
|
static Frame* ReuseExistingWindow(LocalFrame& active_frame,
LocalFrame& lookup_frame,
const AtomicString& frame_name,
NavigationPolicy policy,
const KURL& destination_url) {
if (!frame_name.IsEmpty() && !EqualIgnoringASCIICase(frame_name, "_blank") &&
policy == kNavigationPolicyIgnore) {
if (Frame* frame = lookup_frame.FindFrameForNavigation(
frame_name, active_frame, destination_url)) {
if (!EqualIgnoringASCIICase(frame_name, "_self")) {
if (Page* page = frame->GetPage()) {
if (page == active_frame.GetPage())
page->GetFocusController().SetFocusedFrame(frame);
else
page->GetChromeClient().Focus();
}
}
return frame;
}
}
return nullptr;
}
| 1
|
152,571
|
static void vmx_complete_atomic_exit(struct vcpu_vmx *vmx)
{
u32 exit_intr_info;
if (!(vmx->exit_reason == EXIT_REASON_MCE_DURING_VMENTRY
|| vmx->exit_reason == EXIT_REASON_EXCEPTION_NMI))
return;
vmx->exit_intr_info = vmcs_read32(VM_EXIT_INTR_INFO);
exit_intr_info = vmx->exit_intr_info;
/* Handle machine checks before interrupts are enabled */
if (is_machine_check(exit_intr_info))
kvm_machine_check();
/* We need to handle NMIs before interrupts are enabled */
if (is_nmi(exit_intr_info)) {
kvm_before_handle_nmi(&vmx->vcpu);
asm("int $2");
kvm_after_handle_nmi(&vmx->vcpu);
}
}
| 0
|
319,935
|
static int qemu_rbd_set_conf(rados_t cluster, const char *conf)
{
char *p, *buf;
char name[RBD_MAX_CONF_NAME_SIZE];
char value[RBD_MAX_CONF_VAL_SIZE];
int ret = 0;
buf = g_strdup(conf);
p = buf;
while (p) {
ret = qemu_rbd_next_tok(name, sizeof(name), p,
'=', "conf option name", &p);
if (ret < 0) {
break;
}
if (!p) {
error_report("conf option %s has no value", name);
ret = -EINVAL;
break;
}
ret = qemu_rbd_next_tok(value, sizeof(value), p,
':', "conf option value", &p);
if (ret < 0) {
break;
}
if (strcmp(name, "conf")) {
ret = rados_conf_set(cluster, name, value);
if (ret < 0) {
error_report("invalid conf option %s", name);
ret = -EINVAL;
break;
}
} else {
ret = rados_conf_read_file(cluster, value);
if (ret < 0) {
error_report("error reading conf file %s", value);
break;
}
}
}
g_free(buf);
return ret;
}
| 0
|
520,662
|
Item** addr(uint i) { return arg_count ? args + i : NULL; }
| 0
|
331,193
|
static void channel_load_d(struct fs_dma_ctrl *ctrl, int c)
{
target_phys_addr_t addr = channel_reg(ctrl, c, RW_SAVED_DATA);
/* Load and decode. FIXME: handle endianness. */
D(printf("%s ch=%d addr=" TARGET_FMT_plx "\n", __func__, c, addr));
cpu_physical_memory_read (addr,
(void *) &ctrl->channels[c].current_d,
sizeof ctrl->channels[c].current_d);
D(dump_d(c, &ctrl->channels[c].current_d));
ctrl->channels[c].regs[RW_DATA] = addr;
}
| 0
|
3,843
|
error_t tja1101Init(NetInterface *interface)
{
uint16_t value;
//Debug message
TRACE_INFO("Initializing TJA1101...\r\n");
//Undefined PHY address?
if(interface->phyAddr >= 32)
{
//Use the default address
interface->phyAddr = TJA1101_PHY_ADDR;
}
//Initialize serial management interface
if(interface->smiDriver != NULL)
{
interface->smiDriver->init();
}
//Initialize external interrupt line driver
if(interface->extIntDriver != NULL)
{
interface->extIntDriver->init();
}
//Reset PHY transceiver
tja1101WritePhyReg(interface, TJA1101_BASIC_CTRL,
TJA1101_BASIC_CTRL_RESET);
//Wait for the reset to complete
while(tja1101ReadPhyReg(interface, TJA1101_BASIC_CTRL) &
TJA1101_BASIC_CTRL_RESET)
{
}
//Dump PHY registers for debugging purpose
tja1101DumpPhyReg(interface);
//Enable configuration register access
value = tja1101ReadPhyReg(interface, TJA1101_EXTENDED_CTRL);
value |= TJA1101_EXTENDED_CTRL_CONFIG_EN;
tja1101WritePhyReg(interface, TJA1101_EXTENDED_CTRL, value);
//Select RMII mode (25MHz XTAL)
value = tja1101ReadPhyReg(interface, TJA1101_CONFIG1);
value &= ~TJA1101_CONFIG1_MII_MODE;
value |= TJA1101_CONFIG1_MII_MODE_RMII_25MHZ;
tja1101WritePhyReg(interface, TJA1101_CONFIG1, value);
//The PHY is configured for autonomous operation
value = tja1101ReadPhyReg(interface, TJA1101_COMM_CTRL);
value |= TJA1101_COMM_CTRL_AUTO_OP;
tja1101WritePhyReg(interface, TJA1101_COMM_CTRL, value);
//Force the TCP/IP stack to poll the link state at startup
interface->phyEvent = TRUE;
//Notify the TCP/IP stack of the event
osSetEvent(&netEvent);
//Successful initialization
return NO_ERROR;
}
| 1
|
112,544
|
uint8_t* SecureElementGetPin( void )
{
return SeNvmCtx.Pin;
}
| 0
|
451,865
|
static void rbd_img_capture_header(struct rbd_img_request *img_req)
{
struct rbd_device *rbd_dev = img_req->rbd_dev;
lockdep_assert_held(&rbd_dev->header_rwsem);
if (rbd_img_is_write(img_req))
img_req->snapc = ceph_get_snap_context(rbd_dev->header.snapc);
else
img_req->snap_id = rbd_dev->spec->snap_id;
if (rbd_dev_parent_get(rbd_dev))
img_request_layered_set(img_req);
}
| 0
|
312,092
|
void AppCacheHost::PrepareForTransfer() {
DCHECK(!associated_cache());
DCHECK(!is_selection_pending());
DCHECK(!group_being_updated_.get());
host_id_ = kAppCacheNoHostId;
frontend_ = NULL;
}
| 0
|
330,119
|
static int vc1t_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
ByteIOContext *pb = s->pb;
AVStream *st;
int fps, frames;
frames = get_le24(pb);
if(get_byte(pb) != 0xC5 || get_le32(pb) != 4)
return -1;
/* init video codec */
st = av_new_stream(s, 0);
if (!st)
return -1;
st->codec->codec_type = CODEC_TYPE_VIDEO;
st->codec->codec_id = CODEC_ID_WMV3;
st->codec->extradata = av_malloc(VC1_EXTRADATA_SIZE);
st->codec->extradata_size = VC1_EXTRADATA_SIZE;
get_buffer(pb, st->codec->extradata, VC1_EXTRADATA_SIZE);
st->codec->height = get_le32(pb);
st->codec->width = get_le32(pb);
if(get_le32(pb) != 0xC)
return -1;
url_fskip(pb, 8);
fps = get_le32(pb);
if(fps == -1)
av_set_pts_info(st, 32, 1, 1000);
else{
av_set_pts_info(st, 24, 1, fps);
st->duration = frames;
}
return 0;
}
| 0
|
88,241
|
int openssl_push_general_name(lua_State*L, const GENERAL_NAME* general_name)
{
if (general_name == NULL)
{
lua_pushnil(L);
return 1;
}
lua_newtable(L);
switch (general_name->type)
{
case GEN_OTHERNAME:
{
OTHERNAME *otherName = general_name->d.otherName;
lua_newtable(L);
openssl_push_asn1object(L, otherName->type_id);
PUSH_ASN1_STRING(L, otherName->value->value.asn1_string);
lua_settable(L, -3);
lua_setfield(L, -2, "otherName");
lua_pushstring(L, "otherName");
lua_setfield(L, -2, "type");
break;
}
case GEN_EMAIL:
PUSH_ASN1_STRING(L, general_name->d.rfc822Name);
lua_setfield(L, -2, "rfc822Name");
lua_pushstring(L, "rfc822Name");
lua_setfield(L, -2, "type");
break;
case GEN_DNS:
PUSH_ASN1_STRING(L, general_name->d.dNSName);
lua_setfield(L, -2, "dNSName");
lua_pushstring(L, "dNSName");
lua_setfield(L, -2, "type");
break;
case GEN_X400:
openssl_push_asn1type(L, general_name->d.x400Address);
lua_setfield(L, -2, "x400Address");
lua_pushstring(L, "x400Address");
lua_setfield(L, -2, "type");
break;
case GEN_DIRNAME:
{
X509_NAME* xn = general_name->d.directoryName;
openssl_push_xname_asobject(L, xn);
lua_setfield(L, -2, "directoryName");
lua_pushstring(L, "directoryName");
lua_setfield(L, -2, "type");
}
break;
case GEN_URI:
PUSH_ASN1_STRING(L, general_name->d.uniformResourceIdentifier);
lua_setfield(L, -2, "uniformResourceIdentifier");
lua_pushstring(L, "uniformResourceIdentifier");
lua_setfield(L, -2, "type");
break;
case GEN_IPADD:
lua_newtable(L);
PUSH_ASN1_OCTET_STRING(L, general_name->d.iPAddress);
lua_setfield(L, -2, "iPAddress");
lua_pushstring(L, "iPAddress");
lua_setfield(L, -2, "type");
break;
case GEN_EDIPARTY:
lua_newtable(L);
PUSH_ASN1_STRING(L, general_name->d.ediPartyName->nameAssigner);
lua_setfield(L, -2, "nameAssigner");
PUSH_ASN1_STRING(L, general_name->d.ediPartyName->partyName);
lua_setfield(L, -2, "partyName");
lua_setfield(L, -2, "ediPartyName");
lua_pushstring(L, "ediPartyName");
lua_setfield(L, -2, "type");
break;
case GEN_RID:
lua_newtable(L);
openssl_push_asn1object(L, general_name->d.registeredID);
lua_setfield(L, -2, "registeredID");
lua_pushstring(L, "registeredID");
lua_setfield(L, -2, "type");
break;
default:
lua_pushstring(L, "unsupport");
lua_setfield(L, -2, "type");
}
return 1;
};
| 0
|
53,651
|
static void __tcp_ecn_check_ce(struct tcp_sock *tp, const struct sk_buff *skb)
{
switch (TCP_SKB_CB(skb)->ip_dsfield & INET_ECN_MASK) {
case INET_ECN_NOT_ECT:
/* Funny extension: if ECT is not set on a segment,
* and we already seen ECT on a previous segment,
* it is probably a retransmit.
*/
if (tp->ecn_flags & TCP_ECN_SEEN)
tcp_enter_quickack_mode((struct sock *)tp);
break;
case INET_ECN_CE:
if (tcp_ca_needs_ecn((struct sock *)tp))
tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_IS_CE);
if (!(tp->ecn_flags & TCP_ECN_DEMAND_CWR)) {
/* Better not delay acks, sender can have a very low cwnd */
tcp_enter_quickack_mode((struct sock *)tp);
tp->ecn_flags |= TCP_ECN_DEMAND_CWR;
}
tp->ecn_flags |= TCP_ECN_SEEN;
break;
default:
if (tcp_ca_needs_ecn((struct sock *)tp))
tcp_ca_event((struct sock *)tp, CA_EVENT_ECN_NO_CE);
tp->ecn_flags |= TCP_ECN_SEEN;
break;
}
}
| 0
|
421,825
|
flatpak_dir_get_default_locale_languages (FlatpakDir *self)
{
g_autoptr(GPtrArray) langs = g_ptr_array_new_with_free_func (g_free);
g_autoptr(GDBusProxy) localed_proxy = NULL;
g_autoptr(GDBusProxy) accounts_proxy = NULL;
if (flatpak_dir_is_user (self))
return flatpak_get_current_locale_langs ();
/* First get the system default locales */
localed_proxy = get_localed_dbus_proxy ();
if (localed_proxy != NULL)
get_locale_langs_from_localed_dbus (localed_proxy, langs);
/* Now add the user account locales from AccountsService. If accounts_proxy is
* not NULL, it means that AccountsService exists */
accounts_proxy = get_accounts_dbus_proxy ();
if (accounts_proxy != NULL)
get_locale_langs_from_accounts_dbus (accounts_proxy, langs);
/* If none were found, fall back to using all languages */
if (langs->len == 0)
return g_new0 (char *, 1);
g_ptr_array_sort (langs, flatpak_strcmp0_ptr);
g_ptr_array_add (langs, NULL);
return (char **) g_ptr_array_free (g_steal_pointer (&langs), FALSE);
}
| 0
|
498,829
|
smb2_set_compression(const unsigned int xid, struct cifs_tcon *tcon,
struct cifsFileInfo *cfile)
{
return SMB2_set_compression(xid, tcon, cfile->fid.persistent_fid,
cfile->fid.volatile_fid);
}
| 0
|
289,407
|
IN_PROC_BROWSER_TEST_F ( ContentSettingBubbleDialogTest , InvokeDialog_mediastream_mic ) {
RunDialog ( ) ;
}
| 0
|
27,599
|
static int dissect_h225_SEQUENCE_OF_ServiceControlSession ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_SEQUENCE_OF_ServiceControlSession , SEQUENCE_OF_ServiceControlSession_sequence_of ) ;
return offset ;
}
| 0
|
521,566
|
Field *Field_string::make_new_field(MEM_ROOT *root, TABLE *new_table,
bool keep_type)
{
Field *field;
if (type() != MYSQL_TYPE_VAR_STRING || keep_type)
field= Field::make_new_field(root, new_table, keep_type);
else if ((field= new (root) Field_varstring(field_length, maybe_null(),
field_name,
new_table->s, charset())))
{
/*
Old VARCHAR field which should be modified to a VARCHAR on copy
This is done to ensure that ALTER TABLE will convert old VARCHAR fields
to now VARCHAR fields.
*/
field->init_for_make_new_field(new_table, orig_table);
}
return field;
}
| 0
|
503,681
|
WebContents::WebContents(v8::Isolate* isolate,
std::unique_ptr<content::WebContents> web_contents,
Type type)
: content::WebContentsObserver(web_contents.get()),
type_(type),
id_(GetAllWebContents().Add(this)),
devtools_file_system_indexer_(
base::MakeRefCounted<DevToolsFileSystemIndexer>()),
file_task_runner_(
base::ThreadPool::CreateSequencedTaskRunner({base::MayBlock()}))
#if BUILDFLAG(ENABLE_PRINTING)
,
print_task_runner_(CreatePrinterHandlerTaskRunner())
#endif
{
DCHECK(type != Type::kRemote)
<< "Can't take ownership of a remote WebContents";
auto session = Session::CreateFrom(isolate, GetBrowserContext());
session_.Reset(isolate, session.ToV8());
InitWithSessionAndOptions(isolate, std::move(web_contents), session,
gin::Dictionary::CreateEmpty(isolate));
}
| 0
|
431,463
|
Status acquireUserForSessionRefresh(OperationContext*,
const UserName&,
const User::UserId&,
User**) override {
UASSERT_NOT_IMPLEMENTED;
}
| 0
|
515,528
|
int setup_tests(void)
{
#ifdef OPENSSL_NO_SM2
TEST_note("SM2 is disabled.");
#else
ADD_TEST(sm2_crypt_test);
ADD_TEST(sm2_sig_test);
#endif
return 1;
}
| 0
|
206,111
|
void DelegatedFrameHost::WillDrawSurface(const viz::LocalSurfaceId& id,
const gfx::Rect& damage_rect) {
if (id != local_surface_id_)
return;
AttemptFrameSubscriberCapture(damage_rect);
}
| 0
|
108,863
|
mailimf_name_val_pair_parse(const char * message, size_t length,
size_t * indx,
struct mailimf_name_val_pair ** result)
{
size_t cur_token;
char * item_name;
struct mailimf_item_value * item_value;
struct mailimf_name_val_pair * name_val_pair;
int r;
int res;
cur_token = * indx;
r = mailimf_cfws_parse(message, length, &cur_token);
if ((r != MAILIMF_NO_ERROR) && (r != MAILIMF_ERROR_PARSE)) {
res = r;
goto err;
}
r = mailimf_item_name_parse(message, length, &cur_token, &item_name);
if (r != MAILIMF_NO_ERROR) {
res = r;
goto err;
}
r = mailimf_cfws_parse(message, length, &cur_token);
if (r != MAILIMF_NO_ERROR) {
res = r;
goto free_item_name;
}
r = mailimf_item_value_parse(message, length, &cur_token, &item_value);
if (r != MAILIMF_NO_ERROR) {
res = r;
goto free_item_name;
}
name_val_pair = mailimf_name_val_pair_new(item_name, item_value);
if (name_val_pair == NULL) {
res = MAILIMF_ERROR_MEMORY;
goto free_item_value;
}
* result = name_val_pair;
* indx = cur_token;
return MAILIMF_NO_ERROR;
free_item_value:
mailimf_item_value_free(item_value);
free_item_name:
mailimf_item_name_free(item_name);
err:
return res;
}
| 0
|
46,059
|
fiber_resume(mrb_state *mrb, mrb_value self)
{
const mrb_value *a;
mrb_int len;
mrb_bool vmexec = FALSE;
mrb_get_args(mrb, "*!", &a, &len);
if (mrb->c->ci->cci > 0) {
vmexec = TRUE;
}
return fiber_switch(mrb, self, len, a, TRUE, vmexec);
}
| 0
|
390,768
|
static PHP_INI_MH(OnUpdateInternalEncoding)
{
if (new_value) {
OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage);
}
return SUCCESS;
}
| 0
|
483,915
|
static int really_probe(struct device *dev, struct device_driver *drv)
{
int ret = -EPROBE_DEFER;
int local_trigger_count = atomic_read(&deferred_trigger_count);
bool test_remove = IS_ENABLED(CONFIG_DEBUG_TEST_DRIVER_REMOVE) &&
!drv->suppress_bind_attrs;
if (defer_all_probes) {
/*
* Value of defer_all_probes can be set only by
* device_block_probing() which, in turn, will call
* wait_for_device_probe() right after that to avoid any races.
*/
dev_dbg(dev, "Driver %s force probe deferral\n", drv->name);
driver_deferred_probe_add(dev);
return ret;
}
ret = device_links_check_suppliers(dev);
if (ret == -EPROBE_DEFER)
driver_deferred_probe_add_trigger(dev, local_trigger_count);
if (ret)
return ret;
atomic_inc(&probe_count);
pr_debug("bus: '%s': %s: probing driver %s with device %s\n",
drv->bus->name, __func__, drv->name, dev_name(dev));
if (!list_empty(&dev->devres_head)) {
dev_crit(dev, "Resources present before probing\n");
ret = -EBUSY;
goto done;
}
re_probe:
dev->driver = drv;
/* If using pinctrl, bind pins now before probing */
ret = pinctrl_bind_pins(dev);
if (ret)
goto pinctrl_bind_failed;
if (dev->bus->dma_configure) {
ret = dev->bus->dma_configure(dev);
if (ret)
goto probe_failed;
}
if (driver_sysfs_add(dev)) {
pr_err("%s: driver_sysfs_add(%s) failed\n",
__func__, dev_name(dev));
goto probe_failed;
}
if (dev->pm_domain && dev->pm_domain->activate) {
ret = dev->pm_domain->activate(dev);
if (ret)
goto probe_failed;
}
if (dev->bus->probe) {
ret = dev->bus->probe(dev);
if (ret)
goto probe_failed;
} else if (drv->probe) {
ret = drv->probe(dev);
if (ret)
goto probe_failed;
}
if (device_add_groups(dev, drv->dev_groups)) {
dev_err(dev, "device_add_groups() failed\n");
goto dev_groups_failed;
}
if (dev_has_sync_state(dev) &&
device_create_file(dev, &dev_attr_state_synced)) {
dev_err(dev, "state_synced sysfs add failed\n");
goto dev_sysfs_state_synced_failed;
}
if (test_remove) {
test_remove = false;
device_remove_file(dev, &dev_attr_state_synced);
device_remove_groups(dev, drv->dev_groups);
if (dev->bus->remove)
dev->bus->remove(dev);
else if (drv->remove)
drv->remove(dev);
devres_release_all(dev);
driver_sysfs_remove(dev);
dev->driver = NULL;
dev_set_drvdata(dev, NULL);
if (dev->pm_domain && dev->pm_domain->dismiss)
dev->pm_domain->dismiss(dev);
pm_runtime_reinit(dev);
goto re_probe;
}
pinctrl_init_done(dev);
if (dev->pm_domain && dev->pm_domain->sync)
dev->pm_domain->sync(dev);
driver_bound(dev);
ret = 1;
pr_debug("bus: '%s': %s: bound device %s to driver %s\n",
drv->bus->name, __func__, dev_name(dev), drv->name);
goto done;
dev_sysfs_state_synced_failed:
device_remove_groups(dev, drv->dev_groups);
dev_groups_failed:
if (dev->bus->remove)
dev->bus->remove(dev);
else if (drv->remove)
drv->remove(dev);
probe_failed:
if (dev->bus)
blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
BUS_NOTIFY_DRIVER_NOT_BOUND, dev);
pinctrl_bind_failed:
device_links_no_driver(dev);
devres_release_all(dev);
arch_teardown_dma_ops(dev);
driver_sysfs_remove(dev);
dev->driver = NULL;
dev_set_drvdata(dev, NULL);
if (dev->pm_domain && dev->pm_domain->dismiss)
dev->pm_domain->dismiss(dev);
pm_runtime_reinit(dev);
dev_pm_set_driver_flags(dev, 0);
switch (ret) {
case -EPROBE_DEFER:
/* Driver requested deferred probing */
dev_dbg(dev, "Driver %s requests probe deferral\n", drv->name);
driver_deferred_probe_add_trigger(dev, local_trigger_count);
break;
case -ENODEV:
case -ENXIO:
pr_debug("%s: probe of %s rejects match %d\n",
drv->name, dev_name(dev), ret);
break;
default:
/* driver matched but the probe failed */
pr_warn("%s: probe of %s failed with error %d\n",
drv->name, dev_name(dev), ret);
}
/*
* Ignore errors returned by ->probe so that the next driver can try
* its luck.
*/
ret = 0;
done:
atomic_dec(&probe_count);
wake_up_all(&probe_waitqueue);
return ret;
}
| 0
|
168,405
|
void GpuCommandBufferStub::SetMemoryAllocation(
const GpuMemoryAllocation& allocation) {
Send(new GpuCommandBufferMsg_SetMemoryAllocation(
route_id_, allocation.renderer_allocation));
if (!surface_ || !MakeCurrent())
return;
surface_->SetFrontbufferAllocation(
allocation.browser_allocation.suggest_have_frontbuffer);
}
| 0
|
105,915
|
static u8 *uvesafb_vbe_state_save(struct uvesafb_par *par)
{
struct uvesafb_ktask *task;
u8 *state;
int err;
if (!par->vbe_state_size)
return NULL;
state = kmalloc(par->vbe_state_size, GFP_KERNEL);
if (!state)
return ERR_PTR(-ENOMEM);
task = uvesafb_prep();
if (!task) {
kfree(state);
return NULL;
}
task->t.regs.eax = 0x4f04;
task->t.regs.ecx = 0x000f;
task->t.regs.edx = 0x0001;
task->t.flags = TF_BUF_RET | TF_BUF_ESBX;
task->t.buf_len = par->vbe_state_size;
task->buf = state;
err = uvesafb_exec(task);
if (err || (task->t.regs.eax & 0xffff) != 0x004f) {
pr_warn("VBE get state call failed (eax=0x%x, err=%d)\n",
task->t.regs.eax, err);
kfree(state);
state = NULL;
}
uvesafb_free(task);
return state;
}
| 0
|
370,127
|
static PHP_FUNCTION(libxml_get_last_error)
{
xmlErrorPtr error;
error = xmlGetLastError();
if (error) {
object_init_ex(return_value, libxmlerror_class_entry);
add_property_long(return_value, "level", error->level);
add_property_long(return_value, "code", error->code);
add_property_long(return_value, "column", error->int2);
if (error->message) {
add_property_string(return_value, "message", error->message, 1);
} else {
add_property_stringl(return_value, "message", "", 0, 1);
}
if (error->file) {
add_property_string(return_value, "file", error->file, 1);
} else {
add_property_stringl(return_value, "file", "", 0, 1);
}
add_property_long(return_value, "line", error->line);
} else {
RETURN_FALSE;
}
}
| 0
|
442,870
|
CreateMultiStringPopUp (
IN UINTN RequestedWidth,
IN UINTN NumberOfLines,
...
)
{
VA_LIST Marker;
VA_START (Marker, NumberOfLines);
CreateSharedPopUp (RequestedWidth, NumberOfLines, Marker);
VA_END (Marker);
}
| 0
|
520,644
|
Item *get_copy(THD *thd)
{ return get_item_copy<Item_ref_null_helper>(thd, this); }
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.