idx
int64
func
string
target
int64
83,816
ssize_t xdr_stream_decode_opaque(struct xdr_stream *xdr, void *ptr, size_t size) { ssize_t ret; void *p; ret = xdr_stream_decode_opaque_inline(xdr, &p, size); if (ret <= 0) return ret; memcpy(ptr, p, ret); return ret; }
0
353,344
dtls1_get_message_fragment(SSL *s, int st1, int stn, long max, int *ok) { unsigned char wire[DTLS1_HM_HEADER_LENGTH]; unsigned long len, frag_off, frag_len; int i,al; struct hm_header_st msg_hdr; /* see if we have the required fragment already */ if ((frag_len = dtls1_retrieve_buffered_fragment(s,max,ok)) || *ok) { if (*ok) s->init_num = frag_len; return frag_len; } /* read handshake message header */ i=s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE,wire, DTLS1_HM_HEADER_LENGTH, 0); if (i <= 0) /* nbio, or an error */ { s->rwstate=SSL_READING; *ok = 0; return i; } /* Handshake fails if message header is incomplete */ if (i != DTLS1_HM_HEADER_LENGTH) { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT,SSL_R_UNEXPECTED_MESSAGE); goto f_err; } /* parse the message fragment header */ dtls1_get_message_header(wire, &msg_hdr); /* * if this is a future (or stale) message it gets buffered * (or dropped)--no further processing at this time * While listening, we accept seq 1 (ClientHello with cookie) * although we're still expecting seq 0 (ClientHello) */ if (msg_hdr.seq != s->d1->handshake_read_seq && !(s->d1->listen && msg_hdr.seq == 1)) return dtls1_process_out_of_seq_message(s, &msg_hdr, ok); len = msg_hdr.msg_len; frag_off = msg_hdr.frag_off; frag_len = msg_hdr.frag_len; if (frag_len && frag_len < len) return dtls1_reassemble_fragment(s, &msg_hdr, ok); if (!s->server && s->d1->r_msg_hdr.frag_off == 0 && wire[0] == SSL3_MT_HELLO_REQUEST) { /* The server may always send 'Hello Request' messages -- * we are doing a handshake anyway now, so ignore them * if their format is correct. Does not count for * 'Finished' MAC. */ if (wire[1] == 0 && wire[2] == 0 && wire[3] == 0) { if (s->msg_callback) s->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, wire, DTLS1_HM_HEADER_LENGTH, s, s->msg_callback_arg); s->init_num = 0; return dtls1_get_message_fragment(s, st1, stn, max, ok); } else /* Incorrectly formated Hello request */ { al=SSL_AD_UNEXPECTED_MESSAGE; SSLerr(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT,SSL_R_UNEXPECTED_MESSAGE); goto f_err; } } if ((al=dtls1_preprocess_fragment(s,&msg_hdr,max))) goto f_err; /* XDTLS: ressurect this when restart is in place */ s->state=stn; if ( frag_len > 0) { unsigned char *p=(unsigned char *)s->init_buf->data+DTLS1_HM_HEADER_LENGTH; i=s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, &p[frag_off],frag_len,0); /* XDTLS: fix this--message fragments cannot span multiple packets */ if (i <= 0) { s->rwstate=SSL_READING; *ok = 0; return i; } } else i = 0; /* XDTLS: an incorrectly formatted fragment should cause the * handshake to fail */ if (i != (int)frag_len) { al=SSL3_AD_ILLEGAL_PARAMETER; SSLerr(SSL_F_DTLS1_GET_MESSAGE_FRAGMENT,SSL3_AD_ILLEGAL_PARAMETER); goto f_err; } *ok = 1; /* Note that s->init_num is *not* used as current offset in * s->init_buf->data, but as a counter summing up fragments' * lengths: as soon as they sum up to handshake packet * length, we assume we have got all the fragments. */ s->init_num = frag_len; return frag_len; f_err: ssl3_send_alert(s,SSL3_AL_FATAL,al); s->init_num = 0; *ok=0; return(-1); }
1
80,531
int is_logbook(char *logbook) { char str[256]; if (strieq(logbook, "global")) return 0; /* check for 'global group' or 'global_xxx' */ strlcpy(str, logbook, sizeof(str)); str[7] = 0; return !strieq(str, "global "); }
0
157,316
void OSDService::shutdown() { { Mutex::Locker l(watch_lock); watch_timer.shutdown(); } objecter->shutdown(); objecter_finisher.wait_for_empty(); objecter_finisher.stop(); { Mutex::Locker l(recovery_request_lock); recovery_request_timer.shutdown(); } { Mutex::Locker l(snap_sleep_lock); snap_sleep_timer.shutdown(); } { Mutex::Locker l(scrub_sleep_lock); scrub_sleep_timer.shutdown(); } osdmap = OSDMapRef(); next_osdmap = OSDMapRef(); }
0
319,474
static int v9fs_synth_utimensat(FsContext *fs_ctx, V9fsPath *path, const struct timespec *buf) { errno = EPERM; return 0; }
0
161,395
cockpit_auth_check_cookie (CockpitAuth *self, const gchar *path, GHashTable *in_headers) { CockpitSession *session; CockpitCreds *creds; session = session_for_headers (self, path, in_headers); if (session) { creds = cockpit_web_service_get_creds (session->service); g_debug ("received %s credential cookie for session", cockpit_creds_get_application (creds)); return g_object_ref (session->service); } else { g_debug ("received unknown/invalid credential cookie"); return NULL; } }
0
49,432
static int vma_has_reserves(struct vm_area_struct *vma) { if (vma->vm_flags & VM_MAYSHARE) return 1; if (is_vma_resv_set(vma, HPAGE_RESV_OWNER)) return 1; return 0; }
0
168,955
static MagickBooleanType ReadPSDChannel(Image *image, const ImageInfo *image_info,const PSDInfo *psd_info,LayerInfo* layer_info, const size_t channel,const PSDCompressionType compression, ExceptionInfo *exception) { Image *channel_image, *mask; MagickOffsetType offset; MagickBooleanType status; channel_image=image; mask=(Image *) NULL; if (layer_info->channel_info[channel].type < -1) { const char *option; /* Ignore mask that is not a user supplied layer mask, if the mask is disabled or if the flags have unsupported values. */ option=GetImageOption(image_info,"psd:preserve-opacity-mask"); if ((layer_info->channel_info[channel].type != -2) || (layer_info->mask.flags > 2) || ((layer_info->mask.flags & 0x02) && (IsStringTrue(option) == MagickFalse))) { SeekBlob(image,layer_info->channel_info[channel].size-2,SEEK_CUR); return(MagickTrue); } mask=CloneImage(image,layer_info->mask.page.width, layer_info->mask.page.height,MagickFalse,exception); mask->matte=MagickFalse; channel_image=mask; } offset=TellBlob(image); status=MagickTrue; switch(compression) { case Raw: status=ReadPSDChannelRaw(channel_image,psd_info->channels, layer_info->channel_info[channel].type,exception); break; case RLE: { MagickOffsetType *sizes; sizes=ReadPSDRLESizes(channel_image,psd_info,channel_image->rows); if (sizes == (MagickOffsetType *) NULL) ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed", image->filename); status=ReadPSDChannelRLE(channel_image,psd_info, layer_info->channel_info[channel].type,sizes,exception); sizes=(MagickOffsetType *) RelinquishMagickMemory(sizes); } break; case ZipWithPrediction: case ZipWithoutPrediction: #ifdef MAGICKCORE_ZLIB_DELEGATE status=ReadPSDChannelZip(channel_image,layer_info->channels, layer_info->channel_info[channel].type,compression, layer_info->channel_info[channel].size-2,exception); #else (void) ThrowMagickException(exception,GetMagickModule(), MissingDelegateWarning,"DelegateLibrarySupportNotBuiltIn", "'%s' (ZLIB)",image->filename); #endif break; default: (void) ThrowMagickException(exception,GetMagickModule(),TypeWarning, "CompressionNotSupported","'%.20g'",(double) compression); break; } SeekBlob(image,offset+layer_info->channel_info[channel].size-2,SEEK_SET); if (status == MagickFalse) { if (mask != (Image *) NULL) DestroyImage(mask); ThrowBinaryException(CoderError,"UnableToDecompressImage", image->filename); } if (mask != (Image *) NULL) { if (status != MagickFalse) layer_info->mask.image=mask; else mask=DestroyImage(mask); } return(status); }
0
137,820
static int mov_metadata_int8_bypass_padding(MOVContext *c, AVIOContext *pb, unsigned len, const char *key) { /* bypass padding bytes */ avio_r8(pb); avio_r8(pb); avio_r8(pb); c->fc->event_flags |= AVFMT_EVENT_FLAG_METADATA_UPDATED; av_dict_set_int(&c->fc->metadata, key, avio_r8(pb), 0); return 0; }
0
25,552
IN_PROC_BROWSER_TEST_F ( UnloadTest , BrowserListDoubleCloseBeforeUnloadCancel ) { NavigateToDataURL ( BEFORE_UNLOAD_HTML , "beforeunload" ) ; UnloadResults unload_results ; BrowserList : : CloseAllBrowsersWithProfile ( browser ( ) -> profile ( ) , base : : Bind ( & UnloadResults : : AddSuccess , base : : Unretained ( & unload_results ) ) , base : : Bind ( & UnloadResults : : AddAbort , base : : Unretained ( & unload_results ) ) , false ) ; BrowserList : : CloseAllBrowsersWithProfile ( browser ( ) -> profile ( ) , base : : Bind ( & UnloadResults : : AddSuccess , base : : Unretained ( & unload_results ) ) , base : : Bind ( & UnloadResults : : AddAbort , base : : Unretained ( & unload_results ) ) , false ) ; base : : string16 expected_title = base : : ASCIIToUTF16 ( "cancelled" ) ; content : : TitleWatcher title_watcher ( browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) , expected_title ) ; ClickModalDialogButton ( false ) ; ASSERT_EQ ( expected_title , title_watcher . WaitAndGetTitle ( ) ) ; EXPECT_EQ ( 0 , unload_results . get_successes ( ) ) ; EXPECT_EQ ( 1 , unload_results . get_aborts ( ) ) ; content : : WindowedNotificationObserver window_observer ( chrome : : NOTIFICATION_BROWSER_CLOSED , content : : NotificationService : : AllSources ( ) ) ; chrome : : CloseWindow ( browser ( ) ) ; ClickModalDialogButton ( true ) ; window_observer . Wait ( ) ; }
0
108,934
CModule::EModRet CModule::OnChanBufferPlayLine(CChan& Chan, CClient& Client, CString& sLine) { return CONTINUE; }
0
201,247
void StartAnimation() { animation_timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds( base::TimeTicks::kMillisecondsPerSecond / gfx::LinearAnimation::kDefaultFrameRate), this, &VoiceInteractionIcon::AnimationProgressed); }
0
393,955
static inline void check_class_changed(struct rq *rq, struct task_struct *p, const struct sched_class *prev_class, int oldprio) { if (prev_class != p->sched_class) { if (prev_class->switched_from) prev_class->switched_from(rq, p); p->sched_class->switched_to(rq, p); } else if (oldprio != p->prio || dl_task(p)) p->sched_class->prio_changed(rq, p, oldprio); }
0
698
unsigned long # define BN_LONG long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK ( 0xffffffffffffffffffffffffffffffffLL ) # define BN_MASK2 ( 0xffffffffffffffffL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000L ) # define BN_MASK2h1 ( 0xffffffff80000000L ) # define BN_TBIT ( 0x8000000000000000L ) # define BN_DEC_CONV ( 10000000000000000000UL ) # define BN_DEC_FMT1 "%lu" # define BN_DEC_FMT2 "%019lu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%lX" # define BN_HEX_FMT2 "%016lX" # endif # ifdef SIXTY_FOUR_BIT # undef BN_LLONG # undef BN_ULLONG # define BN_ULONG unsigned long long # define BN_LONG long long # define BN_BITS 128 # define BN_BYTES 8 # define BN_BITS2 64 # define BN_BITS4 32 # define BN_MASK2 ( 0xffffffffffffffffLL ) # define BN_MASK2l ( 0xffffffffL ) # define BN_MASK2h ( 0xffffffff00000000LL ) # define BN_MASK2h1 ( 0xffffffff80000000LL ) # define BN_TBIT ( 0x8000000000000000LL ) # define BN_DEC_CONV ( 10000000000000000000ULL ) # define BN_DEC_FMT1 "%llu" # define BN_DEC_FMT2 "%019llu" # define BN_DEC_NUM 19 # define BN_HEX_FMT1 "%llX" # define BN_HEX_FMT2 "%016llX" # endif # ifdef THIRTY_TWO_BIT # ifdef BN_LLONG # if defined ( _WIN32 ) && ! defined ( __GNUC__ ) # define BN_ULLONG unsigned __int64 # define BN_MASK ( 0xffffffffffffffffI64 ) # else # define BN_ULLONG unsigned long long # define BN_MASK ( 0xffffffffffffffffLL ) # endif # endif # define BN_ULONG unsigned int # define BN_LONG int # define BN_BITS 64 # define BN_BYTES 4 # define BN_BITS2 32 # define BN_BITS4 16 # define BN_MASK2 ( 0xffffffffL ) # define BN_MASK2l ( 0xffff ) # define BN_MASK2h1 ( 0xffff8000L ) # define BN_MASK2h ( 0xffff0000L ) # define BN_TBIT ( 0x80000000L ) # define BN_DEC_CONV ( 1000000000L ) # define BN_DEC_FMT1 "%u" # define BN_DEC_FMT2 "%09u" # define BN_DEC_NUM 9 # define BN_HEX_FMT1 "%X" # define BN_HEX_FMT2 "%08X" # endif # define BN_DEFAULT_BITS 1280 # define BN_FLG_MALLOCED 0x01 # define BN_FLG_STATIC_DATA 0x02 # define BN_FLG_CONSTTIME 0x04 # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_EXP_CONSTTIME BN_FLG_CONSTTIME # endif # ifndef OPENSSL_NO_DEPRECATED # define BN_FLG_FREE 0x8000 # endif # define BN_set_flags ( b , n ) ( ( b ) -> flags |= ( n ) ) # define BN_get_flags ( b , n ) ( ( b ) -> flags & ( n ) ) # define BN_with_flags ( dest , b , n ) ( ( dest ) -> d = ( b ) -> d , \ ( dest ) -> top = ( b ) -> top , \ ( dest ) -> dmax = ( b ) -> dmax , \ ( dest ) -> neg = ( b ) -> neg , \ ( dest ) -> flags = ( ( ( dest ) -> flags & BN_FLG_MALLOCED ) \ | ( ( b ) -> flags & ~ BN_FLG_MALLOCED ) \ | BN_FLG_STATIC_DATA \ | ( n ) ) ) # if 0 typedef struct bignum_st BIGNUM ; typedef struct bignum_ctx BN_CTX ; typedef struct bn_blinding_st BN_BLINDING ; typedef struct bn_mont_ctx_st BN_MONT_CTX ; typedef struct bn_recp_ctx_st BN_RECP_CTX ; typedef struct bn_gencb_st BN_GENCB ; # endif struct bignum_st { BN_ULONG * d ; int top ; int dmax ; int neg ; int flags ; } ; struct bn_mont_ctx_st { int ri ; BIGNUM RR ; BIGNUM N ; BIGNUM Ni ; BN_ULONG n0 [ 2 ] ; int flags ; } ; struct bn_recp_ctx_st { BIGNUM N ; BIGNUM Nr ; int num_bits ; int shift ; int flags ; } ; struct bn_gencb_st { unsigned int ver ; void * arg ; union { void ( * cb_1 ) ( int , int , void * ) ; int ( * cb_2 ) ( int , int , BN_GENCB * ) ; } cb ; } ; int BN_GENCB_call ( BN_GENCB * cb , int a , int b ) ; # define BN_GENCB_set_old ( gencb , callback , cb_arg ) { \ BN_GENCB * tmp_gencb = ( gencb ) ; \ tmp_gencb -> ver = 1 ; \ tmp_gencb -> arg = ( cb_arg ) ; \ tmp_gencb -> cb . cb_1 = ( callback ) ; } # define BN_GENCB_set ( gencb , callback , cb_arg ) { \ BN_GENCB * tmp_gencb = ( gencb ) ; \ tmp_gencb -> ver = 2 ; \ tmp_gencb -> arg = ( cb_arg ) ; \ tmp_gencb -> cb . cb_2 = ( callback ) ; } # define BN_prime_checks 0 # define BN_prime_checks_for_size ( b ) ( ( b ) >= 1300 ? 2 : \ ( b ) >= 850 ? 3 : \ ( b ) >= 650 ? 4 : \ ( b ) >= 550 ? 5 : \ ( b ) >= 450 ? 6 : \ ( b ) >= 400 ? 7 : \ ( b ) >= 350 ? 8 : \ ( b ) >= 300 ? 9 : \ ( b ) >= 250 ? 12 : \ ( b ) >= 200 ? 15 : \ ( b ) >= 150 ? 18 : \ 27 ) # define BN_num_bytes ( a ) ( ( BN_num_bits ( a ) + 7 ) / 8 ) # define BN_abs_is_word ( a , w ) ( ( ( ( a ) -> top == 1 ) && ( ( a ) -> d [ 0 ] == ( BN_ULONG ) ( w ) ) ) || \ ( ( ( w ) == 0 ) && ( ( a ) -> top == 0 ) ) ) # define BN_is_zero ( a ) ( ( a ) -> top == 0 ) # define BN_is_one ( a ) ( BN_abs_is_word ( ( a ) , 1 ) && ! ( a ) -> neg ) # define BN_is_word ( a , w ) ( BN_abs_is_word ( ( a ) , ( w ) ) && ( ! ( w ) || ! ( a ) -> neg ) ) # define BN_is_odd ( a ) ( ( ( a ) -> top > 0 ) && ( ( a ) -> d [ 0 ] & 1 ) ) # define BN_one ( a ) ( BN_set_word ( ( a ) , 1 ) ) # define BN_zero_ex ( a ) \ do { \ BIGNUM * _tmp_bn = ( a ) ; \ _tmp_bn -> top = 0 ; \ _tmp_bn -> neg = 0 ; \ } while ( 0 ) # ifdef OPENSSL_NO_DEPRECATED # define BN_zero ( a ) BN_zero_ex ( a ) # else # define BN_zero ( a ) ( BN_set_word ( ( a ) , 0 ) ) # endif const BIGNUM * BN_value_one ( void ) ; char * BN_options ( void ) ; BN_CTX * BN_CTX_new ( void ) ; # ifndef OPENSSL_NO_DEPRECATED void BN_CTX_init ( BN_CTX * c ) ; # endif void BN_CTX_free ( BN_CTX * c ) ; void BN_CTX_start ( BN_CTX * ctx ) ; BIGNUM * BN_CTX_get ( BN_CTX * ctx ) ; void BN_CTX_end ( BN_CTX * ctx ) ; int BN_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ; int BN_pseudo_rand ( BIGNUM * rnd , int bits , int top , int bottom ) ; int BN_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ; int BN_pseudo_rand_range ( BIGNUM * rnd , const BIGNUM * range ) ; int BN_num_bits ( const BIGNUM * a ) ; int BN_num_bits_word ( BN_ULONG l ) ; BIGNUM * BN_new ( void ) ; void BN_init ( BIGNUM * ) ; void BN_clear_free ( BIGNUM * a ) ; BIGNUM * BN_copy ( BIGNUM * a , const BIGNUM * b ) ; void BN_swap ( BIGNUM * a , BIGNUM * b ) ; BIGNUM * BN_bin2bn ( const unsigned char * s , int len , BIGNUM * ret ) ; int BN_bn2bin ( const BIGNUM * a , unsigned char * to ) ; BIGNUM * BN_mpi2bn ( const unsigned char * s , int len , BIGNUM * ret ) ; int BN_bn2mpi ( const BIGNUM * a , unsigned char * to ) ; int BN_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_usub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_uadd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; int BN_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ; int BN_sqr ( BIGNUM * r , const BIGNUM * a , BN_CTX * ctx ) ; void BN_set_negative ( BIGNUM * b , int n ) ; # define BN_is_negative ( a ) ( ( a ) -> neg != 0 ) int BN_div ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ; # define BN_mod ( rem , m , d , ctx ) BN_div ( NULL , ( rem ) , ( m ) , ( d ) , ( ctx ) ) int BN_nnmod ( BIGNUM * r , const BIGNUM * m , const BIGNUM * d , BN_CTX * ctx ) ; int BN_mod_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_add_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ; int BN_mod_sub ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_sub_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m ) ; int BN_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift1 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift1_quick ( BIGNUM * r , const BIGNUM * a , const BIGNUM * m ) ; int BN_mod_lshift ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_lshift_quick ( BIGNUM * r , const BIGNUM * a , int n , const BIGNUM * m ) ; BN_ULONG BN_mod_word ( const BIGNUM * a , BN_ULONG w ) ; BN_ULONG BN_div_word ( BIGNUM * a , BN_ULONG w ) ; int BN_mul_word ( BIGNUM * a , BN_ULONG w ) ; int BN_add_word ( BIGNUM * a , BN_ULONG w ) ; int BN_sub_word ( BIGNUM * a , BN_ULONG w ) ; int BN_set_word ( BIGNUM * a , BN_ULONG w ) ; BN_ULONG BN_get_word ( const BIGNUM * a ) ; int BN_cmp ( const BIGNUM * a , const BIGNUM * b ) ; void BN_free ( BIGNUM * a ) ; int BN_is_bit_set ( const BIGNUM * a , int n ) ; int BN_lshift ( BIGNUM * r , const BIGNUM * a , int n ) ; int BN_lshift1 ( BIGNUM * r , const BIGNUM * a ) ; int BN_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; int BN_mod_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mod_exp_mont ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ; int BN_mod_exp_mont_consttime ( BIGNUM * rr , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * in_mont ) ; int BN_mod_exp_mont_word ( BIGNUM * r , BN_ULONG a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ; int BN_mod_exp2_mont ( BIGNUM * r , const BIGNUM * a1 , const BIGNUM * p1 , const BIGNUM * a2 , const BIGNUM * p2 , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) ; int BN_mod_exp_simple ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ; int BN_mask_bits ( BIGNUM * a , int n ) ; # ifndef OPENSSL_NO_FP_API int BN_print_fp ( FILE * fp , const BIGNUM * a ) ; # endif # ifdef HEADER_BIO_H int BN_print ( BIO * fp , const BIGNUM * a ) ; # else int BN_print ( void * fp , const BIGNUM * a ) ; # endif int BN_reciprocal ( BIGNUM * r , const BIGNUM * m , int len , BN_CTX * ctx ) ; int BN_rshift ( BIGNUM * r , const BIGNUM * a , int n ) ; int BN_rshift1 ( BIGNUM * r , const BIGNUM * a ) ; void BN_clear ( BIGNUM * a ) ; BIGNUM * BN_dup ( const BIGNUM * a ) ; int BN_ucmp ( const BIGNUM * a , const BIGNUM * b ) ; int BN_set_bit ( BIGNUM * a , int n ) ; int BN_clear_bit ( BIGNUM * a , int n ) ; char * BN_bn2hex ( const BIGNUM * a ) ; char * BN_bn2dec ( const BIGNUM * a ) ; int BN_hex2bn ( BIGNUM * * a , const char * str ) ; int BN_dec2bn ( BIGNUM * * a , const char * str ) ; int BN_asc2bn ( BIGNUM * * a , const char * str ) ; int BN_gcd ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ; int BN_kronecker ( const BIGNUM * a , const BIGNUM * b , BN_CTX * ctx ) ; BIGNUM * BN_mod_inverse ( BIGNUM * ret , const BIGNUM * a , const BIGNUM * n , BN_CTX * ctx ) ; BIGNUM * BN_mod_sqrt ( BIGNUM * ret , const BIGNUM * a , const BIGNUM * n , BN_CTX * ctx ) ; # ifndef OPENSSL_NO_DEPRECATED BIGNUM * BN_generate_prime ( BIGNUM * ret , int bits , int safe , const BIGNUM * add , const BIGNUM * rem , void ( * callback ) ( int , int , void * ) , void * cb_arg ) ; int BN_is_prime ( const BIGNUM * p , int nchecks , void ( * callback ) ( int , int , void * ) , BN_CTX * ctx , void * cb_arg ) ; int BN_is_prime_fasttest ( const BIGNUM * p , int nchecks , void ( * callback ) ( int , int , void * ) , BN_CTX * ctx , void * cb_arg , int do_trial_division ) ; # endif int BN_generate_prime_ex ( BIGNUM * ret , int bits , int safe , const BIGNUM * add , const BIGNUM * rem , BN_GENCB * cb ) ; int BN_is_prime_ex ( const BIGNUM * p , int nchecks , BN_CTX * ctx , BN_GENCB * cb ) ; int BN_is_prime_fasttest_ex ( const BIGNUM * p , int nchecks , BN_CTX * ctx , int do_trial_division , BN_GENCB * cb ) ; int BN_X931_generate_Xpq ( BIGNUM * Xp , BIGNUM * Xq , int nbits , BN_CTX * ctx ) ; int BN_X931_derive_prime_ex ( BIGNUM * p , BIGNUM * p1 , BIGNUM * p2 , const BIGNUM * Xp , const BIGNUM * Xp1 , const BIGNUM * Xp2 , const BIGNUM * e , BN_CTX * ctx , BN_GENCB * cb ) ; int BN_X931_generate_prime_ex ( BIGNUM * p , BIGNUM * p1 , BIGNUM * p2 , BIGNUM * Xp1 , BIGNUM * Xp2 , const BIGNUM * Xp , const BIGNUM * e , BN_CTX * ctx , BN_GENCB * cb ) ; BN_MONT_CTX * BN_MONT_CTX_new ( void ) ; void BN_MONT_CTX_init ( BN_MONT_CTX * ctx ) ; int BN_mod_mul_montgomery ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , BN_MONT_CTX * mont , BN_CTX * ctx ) ; # define BN_to_montgomery ( r , a , mont , ctx ) BN_mod_mul_montgomery ( \ ( r ) , ( a ) , & ( ( mont ) -> RR ) , ( mont ) , ( ctx ) ) int BN_from_montgomery ( BIGNUM * r , const BIGNUM * a , BN_MONT_CTX * mont , BN_CTX * ctx ) ; void BN_MONT_CTX_free ( BN_MONT_CTX * mont ) ; int BN_MONT_CTX_set ( BN_MONT_CTX * mont , const BIGNUM * mod , BN_CTX * ctx ) ; BN_MONT_CTX * BN_MONT_CTX_copy ( BN_MONT_CTX * to , BN_MONT_CTX * from ) ; BN_MONT_CTX * BN_MONT_CTX_set_locked ( BN_MONT_CTX * * pmont , int lock , const BIGNUM * mod , BN_CTX * ctx ) ; # define BN_BLINDING_NO_UPDATE 0x00000001 # define BN_BLINDING_NO_RECREATE 0x00000002 BN_BLINDING * BN_BLINDING_new ( const BIGNUM * A , const BIGNUM * Ai , BIGNUM * mod ) ; void BN_BLINDING_free ( BN_BLINDING * b ) ; int BN_BLINDING_update ( BN_BLINDING * b , BN_CTX * ctx ) ; int BN_BLINDING_convert ( BIGNUM * n , BN_BLINDING * b , BN_CTX * ctx ) ; int BN_BLINDING_invert ( BIGNUM * n , BN_BLINDING * b , BN_CTX * ctx ) ; int BN_BLINDING_convert_ex ( BIGNUM * n , BIGNUM * r , BN_BLINDING * b , BN_CTX * ) ; int BN_BLINDING_invert_ex ( BIGNUM * n , const BIGNUM * r , BN_BLINDING * b , BN_CTX * ) ; # ifndef OPENSSL_NO_DEPRECATED unsigned long BN_BLINDING_get_thread_id ( const BN_BLINDING * ) ; void BN_BLINDING_set_thread_id ( BN_BLINDING * , unsigned long ) ; # endif CRYPTO_THREADID * BN_BLINDING_thread_id ( BN_BLINDING * ) ; unsigned long BN_BLINDING_get_flags ( const BN_BLINDING * ) ; void BN_BLINDING_set_flags ( BN_BLINDING * , unsigned long ) ; BN_BLINDING * BN_BLINDING_create_param ( BN_BLINDING * b , const BIGNUM * e , BIGNUM * m , BN_CTX * ctx , int ( * bn_mod_exp ) ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx , BN_MONT_CTX * m_ctx ) , BN_MONT_CTX * m_ctx ) ; # ifndef OPENSSL_NO_DEPRECATED void BN_set_params ( int mul , int high , int low , int mont ) ; int BN_get_params ( int which ) ; # endif void BN_RECP_CTX_init ( BN_RECP_CTX * recp ) ; BN_RECP_CTX * BN_RECP_CTX_new ( void ) ; void BN_RECP_CTX_free ( BN_RECP_CTX * recp ) ; int BN_RECP_CTX_set ( BN_RECP_CTX * recp , const BIGNUM * rdiv , BN_CTX * ctx ) ; int BN_mod_mul_reciprocal ( BIGNUM * r , const BIGNUM * x , const BIGNUM * y , BN_RECP_CTX * recp , BN_CTX * ctx ) ; int BN_mod_exp_recp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , const BIGNUM * m , BN_CTX * ctx ) ; int BN_div_recp ( BIGNUM * dv , BIGNUM * rem , const BIGNUM * m , BN_RECP_CTX * recp , BN_CTX * ctx ) ; # ifndef OPENSSL_NO_EC2M int BN_GF2m_add ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b ) ; # define BN_GF2m_sub ( r , a , b ) BN_GF2m_add ( r , a , b ) int BN_GF2m_mod ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p ) ; int BN_GF2m_mod_mul ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ; int BN_GF2m_mod_sqr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; int BN_GF2m_mod_inv ( BIGNUM * r , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ; int BN_GF2m_mod_div ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ; int BN_GF2m_mod_exp ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const BIGNUM * p , BN_CTX * ctx ) ; int BN_GF2m_mod_sqrt ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; int BN_GF2m_mod_solve_quad ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; # define BN_GF2m_cmp ( a , b ) BN_ucmp ( ( a ) , ( b ) ) int BN_GF2m_mod_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] ) ; int BN_GF2m_mod_mul_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ; int BN_GF2m_mod_sqr_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ; int BN_GF2m_mod_inv_arr ( BIGNUM * r , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ; int BN_GF2m_mod_div_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ; int BN_GF2m_mod_exp_arr ( BIGNUM * r , const BIGNUM * a , const BIGNUM * b , const int p [ ] , BN_CTX * ctx ) ; int BN_GF2m_mod_sqrt_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ; int BN_GF2m_mod_solve_quad_arr ( BIGNUM * r , const BIGNUM * a , const int p [ ] , BN_CTX * ctx ) ; int BN_GF2m_poly2arr ( const BIGNUM * a , int p [ ] , int max ) ; int BN_GF2m_arr2poly ( const int p [ ] , BIGNUM * a ) ; # endif int BN_nist_mod_192 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; int BN_nist_mod_224 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; int BN_nist_mod_256 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; int BN_nist_mod_384 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; int BN_nist_mod_521 ( BIGNUM * r , const BIGNUM * a , const BIGNUM * p , BN_CTX * ctx ) ; const BIGNUM * BN_get0_nist_prime_192 ( void ) ; const BIGNUM * BN_get0_nist_prime_224 ( void ) ; const BIGNUM * BN_get0_nist_prime_256 ( void ) ; const BIGNUM * BN_get0_nist_prime_384 ( void ) ; const BIGNUM * BN_get0_nist_prime_521 ( void ) ; int ( * BN_nist_mod_func ( const BIGNUM * p ) ) ( BIGNUM * r , const BIGNUM * a , const BIGNUM * field , BN_CTX * ctx ) ; int BN_generate_dsa_nonce ( BIGNUM * out , const BIGNUM * range , const BIGNUM * priv , const unsigned char * message , size_t message_len , BN_CTX * ctx ) ; # define bn_expand ( a , bits ) ( ( ( ( ( ( bits + BN_BITS2 - 1 ) ) / BN_BITS2 ) ) <= ( a ) -> dmax ) ? \ ( a ) : bn_expand2 ( ( a ) , ( bits + BN_BITS2 - 1 ) / BN_BITS2 ) ) # define bn_wexpand ( a , words ) ( ( ( words ) <= ( a ) -> dmax ) ? ( a ) : bn_expand2 ( ( a ) , ( words ) ) ) BIGNUM * bn_expand2 ( BIGNUM * a , int words ) ; # ifndef OPENSSL_NO_DEPRECATED BIGNUM * bn_dup_expand ( const BIGNUM * a , int words ) ; # endif # ifdef BN_DEBUG # include < assert . h > # ifdef BN_DEBUG_RAND # ifndef RAND_pseudo_bytes int RAND_pseudo_bytes ( unsigned char * buf , int num ) ; # define BN_DEBUG_TRIX # endif # define bn_pollute ( a ) \ do { \ const BIGNUM * _bnum1 = ( a ) ; \ if ( _bnum1 -> top < _bnum1 -> dmax ) { \ unsigned char _tmp_char ; \ \ BN_ULONG * _not_const ; \ memcpy ( & _not_const , & _bnum1 -> d , sizeof ( BN_ULONG * ) ) ; \ RAND_pseudo_bytes ( & _tmp_char , 1 ) ; \ memset ( ( unsigned char * ) ( _not_const + _bnum1 -> top ) , _tmp_char , \ ( _bnum1 -> dmax - _bnum1 -> top ) * sizeof ( BN_ULONG ) ) ; \ } \ } while ( 0 ) # ifdef BN_DEBUG_TRIX # undef RAND_pseudo_bytes # endif # else # define bn_pollute ( a ) # endif # define bn_check_top ( a ) \ do { \ const BIGNUM * _bnum2 = ( a ) ; \ if ( _bnum2 != NULL ) { \ assert ( ( _bnum2 -> top == 0 ) || \ ( _bnum2 -> d [ _bnum2 -> top - 1 ] != 0 ) ) ; \ bn_pollute ( _bnum2 ) ; \ } \ } while ( 0 ) # define bn_fix_top ( a ) bn_check_top ( a ) # else # define bn_pollute ( a ) # define bn_check_top ( a ) # define bn_fix_top ( a ) bn_correct_top ( a ) # endif # define bn_correct_top ( a ) \ { \ BN_ULONG * ftl ; \ int tmp_top = ( a ) -> top ; \ if ( tmp_top > 0 ) \ { \ for ( ftl = & ( ( a ) -> d [ tmp_top - 1 ] ) ; tmp_top > 0 ; tmp_top -- ) \ if ( * ( ftl -- ) ) break ; \ ( a ) -> top = tmp_top ; \ } \ bn_pollute ( a ) ; \ } BN_ULONG bn_mul_add_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) ; BN_ULONG bn_mul_words ( BN_ULONG * rp , const BN_ULONG * ap , int num , BN_ULONG w ) ; void bn_sqr_words ( BN_ULONG * rp , const BN_ULONG * ap , int num ) ; BN_ULONG bn_div_words ( BN_ULONG h , BN_ULONG l , BN_ULONG d ) ; BN_ULONG bn_add_words ( BN_ULONG * rp , const BN_ULONG * ap , const BN_ULONG * bp , int num )
1
302,618
QInt16() : value(0) {}
0
395,303
int TC_LOG_BINLOG::open(const char *opt_name) { LOG_INFO log_info; int error= 1; DBUG_ASSERT(total_ha_2pc > 1); DBUG_ASSERT(opt_name && opt_name[0]); mysql_mutex_init(key_BINLOG_LOCK_prep_xids, &LOCK_prep_xids, MY_MUTEX_INIT_FAST); mysql_cond_init(key_BINLOG_COND_prep_xids, &COND_prep_xids, 0); if (!my_b_inited(&index_file)) { /* There was a failure to open the index file, can't open the binlog */ cleanup(); return 1; } if (using_heuristic_recover()) { /* generate a new binlog to mask a corrupted one */ open(opt_name, LOG_BIN, 0, WRITE_CACHE, 0, max_binlog_size, 0, TRUE); cleanup(); return 1; } if ((error= find_log_pos(&log_info, NullS, 1))) { if (error != LOG_INFO_EOF) sql_print_error("find_log_pos() failed (error: %d)", error); else error= 0; goto err; } { const char *errmsg; IO_CACHE log; File file; Log_event *ev=0; Format_description_log_event fdle(BINLOG_VERSION); char log_name[FN_REFLEN]; if (! fdle.is_valid()) goto err; do { strmake(log_name, log_info.log_file_name, sizeof(log_name)-1); } while (!(error= find_next_log(&log_info, 1))); if (error != LOG_INFO_EOF) { sql_print_error("find_log_pos() failed (error: %d)", error); goto err; } if ((file= open_binlog(&log, log_name, &errmsg)) < 0) { sql_print_error("%s", errmsg); goto err; } if ((ev= Log_event::read_log_event(&log, 0, &fdle)) && ev->get_type_code() == FORMAT_DESCRIPTION_EVENT && ev->flags & LOG_EVENT_BINLOG_IN_USE_F) { sql_print_information("Recovering after a crash using %s", opt_name); error= recover(&log, (Format_description_log_event *)ev); } else error=0; delete ev; end_io_cache(&log); mysql_file_close(file, MYF(MY_WME)); if (error) goto err; } err: return error; }
0
226,698
static String capitalizeRFC822HeaderFieldName(const String& name) { bool capitalizeCharacter = true; String result; for (unsigned i = 0; i < name.length(); i++) { UChar c; if (capitalizeCharacter && name[i] >= 'a' && name[i] <= 'z') c = toASCIIUpper(name[i]); else if (!capitalizeCharacter && name[i] >= 'A' && name[i] <= 'Z') c = toASCIILower(name[i]); else c = name[i]; if (name[i] == '-') capitalizeCharacter = true; else capitalizeCharacter = false; result.append(c); } return result; }
0
90,960
static int double_lock_balance(struct rq *this_rq, struct rq *busiest) { if (unlikely(!irqs_disabled())) { /* printk() doesn't work good under rq->lock */ raw_spin_unlock(&this_rq->lock); BUG_ON(1); } return _double_lock_balance(this_rq, busiest); }
0
367,309
update_pal_halt_status(int status) { can_do_pal_halt = pal_halt && status; }
0
506,451
static int sk_comp_cmp(const SSL_COMP * const *a, const SSL_COMP * const *b) { return((*a)->id-(*b)->id); }
0
71,740
void KaxInternalBlock::ReleaseFrames() { // free the allocated Frames int i; for (i=myBuffers.size()-1; i>=0; i--) { if (myBuffers[i] != NULL) { myBuffers[i]->FreeBuffer(*myBuffers[i]); delete myBuffers[i]; myBuffers[i] = NULL; } } }
0
52,423
R_API void r_bin_java_print_constant_value_attr_summary(RBinJavaAttrInfo *attr) { if (!attr) { eprintf ("Attempting to print an invalid RBinJavaAttrInfo *ConstantValue.\n"); return; } printf ("Constant Value Attribute Information:\n"); printf (" Attribute Offset: 0x%08"PFMT64x "\n", attr->file_offset); printf (" Attribute Name Index: %d (%s)\n", attr->name_idx, attr->name); printf (" Attribute Length: %d\n", attr->length); printf (" ConstantValue Index: %d\n", attr->info.constant_value_attr.constantvalue_idx); }
0
296,853
int Jsi_Remove(Jsi_Interp *interp, Jsi_Value* path, int flags) { void *data; Jsi_Filesystem *fsPtr = Jsi_FilesystemForPath(interp, path, &data); if (fsPtr == NULL || !fsPtr->removeProc) return -1; return fsPtr->removeProc(interp, path, flags); }
0
248,029
static int rgbbasecolor(i_ctx_t * i_ctx_p, ref *space, int base, int *stage, int *cont, int *stack_depth) { os_ptr op = osp; float RGB[3], CMYK[4], Gray, UCR, BG; int i; const gs_color_space * pcs = gs_currentcolorspace(igs); if (pcs->id == cs_DeviceGray_id) { /* UGLY hack. Its possible for the graphics library to change the * colour space to DeviceGray (setcachedevice), but this does not * change the PostScript space. It can't, because the graphics library * doesn't know about the PostScript objects. If we get a current* * operation before the space has been restored, the colour space in * the graphics library and the PostScript stored space won't match. * If that happens then we need to pretend the PS colour space was * DeviceGray */ return(graybasecolor(i_ctx_p, space, base, stage, cont, stack_depth)); } switch (*stage) { case 0: *cont = 0; check_op(3); op -= 2; for (i=0;i<3;i++) { if (!r_has_type(op, t_integer)) { if (r_has_type(op, t_real)) { RGB[i] = op->value.realval; } else return_error(gs_error_typecheck); } else RGB[i] = (float)op->value.intval; if (RGB[i] < 0 || RGB[i] > 1) return_error(gs_error_rangecheck); op++; } op = osp; switch (base) { case 0: pop(2); op = osp; /* If R == G == B, then this is gray, so just use it. Avoids * rounding errors. */ if (RGB[0] == RGB[1] && RGB[1] == RGB[2]) Gray = RGB[0]; else Gray = (0.3 * RGB[0]) + (0.59 * RGB[1]) + (0.11 * RGB[2]); make_real(op, Gray); return 0; break; case 1: rgb2hsb((float *)&RGB); make_real(&op[-2], RGB[0]); make_real(&op[-1], RGB[1]); make_real(op, RGB[2]); return 0; break; case 2: make_real(&op[-2], RGB[0]); make_real(&op[-1], RGB[1]); make_real(op, RGB[2]); return 0; break; case 3: *stage = 1; *cont = 1; for (i=0;i<3;i++) CMYK[i] = 1 - RGB[i]; if (CMYK[0] < CMYK[1]) { if (CMYK[0] < CMYK[2]) CMYK[3] = CMYK[0]; else CMYK[3] = CMYK[2]; } else { if (CMYK[1] < CMYK[2]) CMYK[3] = CMYK[1]; else CMYK[3] = CMYK[2]; } check_estack(1); push(2); op = osp - 4; for (i=0;i<4;i++) { make_real(op, CMYK[i]); op++; } make_real(op, CMYK[3]); esp++; *esp = istate->undercolor_removal; return o_push_estack; break; default: return_error(gs_error_undefined); break; } break; case 1: (*stage)++; *cont = 1; check_estack(1); check_op(5); op -= 4; for (i=0;i<4;i++) { if (!r_has_type(op, t_integer)) { if (r_has_type(op, t_real)) { CMYK[i] = op->value.realval; } else return_error(gs_error_typecheck); } else CMYK[i] = (float)op->value.intval; op++; } if (!r_has_type(op, t_integer)) { if (r_has_type(op, t_real)) { UCR = op->value.realval; } else return_error(gs_error_typecheck); } else UCR = (float)op->value.intval; for (i=0;i<3;i++) { CMYK[i] = CMYK[i] - UCR; if (CMYK[i] < 0) CMYK[i] = 0; if (CMYK[i] > 1) CMYK[i] = 1.0; } op -= 4; for (i=0;i<4;i++) { make_real(op, CMYK[i]); op++; } make_real(op, CMYK[3]); esp++; *esp = istate->black_generation; return o_push_estack; break; case 2: *stage = 0; *cont = 0; check_op(5); if (!r_has_type(op, t_integer)) { if (r_has_type(op, t_real)) { BG = op->value.realval; } else return_error(gs_error_typecheck); } else BG = (float)op->value.intval; pop(1); op = osp; if (BG < 0) BG = 0; if (BG > 1) BG = 1; make_real(op, BG); break; } return 0; }
0
470,468
copyin_file (struct cpio_file_stat *file_hdr, int in_file_des) { bool existing_dir = false; if (!to_stdout_option && try_existing_file (file_hdr, in_file_des, &existing_dir) < 0) return; /* Do the real copy or link. */ switch (file_hdr->c_mode & CP_IFMT) { case CP_IFREG: copyin_regular_file (file_hdr, in_file_des); break; case CP_IFDIR: cpio_create_dir (file_hdr, existing_dir); break; case CP_IFCHR: case CP_IFBLK: #ifdef CP_IFSOCK case CP_IFSOCK: #endif #ifdef CP_IFIFO case CP_IFIFO: #endif copyin_device (file_hdr); break; #ifdef CP_IFLNK case CP_IFLNK: copyin_link (file_hdr, in_file_des); break; #endif default: error (0, 0, _("%s: unknown file type"), file_hdr->c_name); tape_toss_input (in_file_des, file_hdr->c_filesize); tape_skip_padding (in_file_des, file_hdr->c_filesize); } }
0
140,579
TEST_P(JSITest, ArrayTest) { eval("x = {1:2, '3':4, 5:'six', 'seven':['eight', 'nine']}"); Object x = rt.global().getPropertyAsObject(rt, "x"); Array names = x.getPropertyNames(rt); EXPECT_EQ(names.size(rt), 4); std::unordered_set<std::string> strNames; for (size_t i = 0; i < names.size(rt); ++i) { Value n = names.getValueAtIndex(rt, i); EXPECT_TRUE(n.isString()); strNames.insert(n.getString(rt).utf8(rt)); } EXPECT_EQ(strNames.size(), 4); EXPECT_EQ(strNames.count("1"), 1); EXPECT_EQ(strNames.count("3"), 1); EXPECT_EQ(strNames.count("5"), 1); EXPECT_EQ(strNames.count("seven"), 1); Object seven = x.getPropertyAsObject(rt, "seven"); Array arr = seven.getArray(rt); EXPECT_EQ(arr.size(rt), 2); EXPECT_EQ(arr.getValueAtIndex(rt, 0).getString(rt).utf8(rt), "eight"); EXPECT_EQ(arr.getValueAtIndex(rt, 1).getString(rt).utf8(rt), "nine"); // TODO: test out of range EXPECT_EQ(x.getPropertyAsObject(rt, "seven").getArray(rt).size(rt), 2); // Check that property access with both symbols and strings can access // array values. EXPECT_EQ(seven.getProperty(rt, "0").getString(rt).utf8(rt), "eight"); EXPECT_EQ(seven.getProperty(rt, "1").getString(rt).utf8(rt), "nine"); seven.setProperty(rt, "1", "modified"); EXPECT_EQ(seven.getProperty(rt, "1").getString(rt).utf8(rt), "modified"); EXPECT_EQ(arr.getValueAtIndex(rt, 1).getString(rt).utf8(rt), "modified"); EXPECT_EQ( seven.getProperty(rt, PropNameID::forAscii(rt, "0")) .getString(rt) .utf8(rt), "eight"); seven.setProperty(rt, PropNameID::forAscii(rt, "0"), "modified2"); EXPECT_EQ(arr.getValueAtIndex(rt, 0).getString(rt).utf8(rt), "modified2"); Array alpha = Array(rt, 4); EXPECT_TRUE(alpha.getValueAtIndex(rt, 0).isUndefined()); EXPECT_TRUE(alpha.getValueAtIndex(rt, 3).isUndefined()); EXPECT_EQ(alpha.size(rt), 4); alpha.setValueAtIndex(rt, 0, "a"); alpha.setValueAtIndex(rt, 1, "b"); EXPECT_EQ(alpha.length(rt), 4); alpha.setValueAtIndex(rt, 2, "c"); alpha.setValueAtIndex(rt, 3, "d"); EXPECT_EQ(alpha.size(rt), 4); EXPECT_TRUE( function( "function (arr) { return " "arr.length == 4 && " "['a','b','c','d'].every(function(v,i) { return v === arr[i]}); }") .call(rt, alpha) .getBool()); Array alpha2 = Array(rt, 1); alpha2 = std::move(alpha); EXPECT_EQ(alpha2.size(rt), 4); }
0
25,165
static void pk_proxy_appeared_cb ( GObject * source , GAsyncResult * res , gpointer user_data ) { ActivateParametersInstall * parameters_install = user_data ; char * mime_type , * name_owner ; char * error_message ; GtkWidget * dialog ; GDBusProxy * proxy ; GError * error = NULL ; proxy = g_dbus_proxy_new_for_bus_finish ( res , & error ) ; name_owner = g_dbus_proxy_get_name_owner ( proxy ) ; if ( error != NULL || name_owner == NULL ) { g_warning ( "Couldn't call Modify on the PackageKit interface: %s" , error != NULL ? error -> message : "no owner for PackageKit" ) ; g_clear_error ( & error ) ; show_unhandled_type_error ( parameters_install ) ; return ; } g_free ( name_owner ) ; mime_type = nautilus_file_get_mime_type ( parameters_install -> file ) ; error_message = get_application_no_mime_type_handler_message ( parameters_install -> file , parameters_install -> uri ) ; dialog = gtk_message_dialog_new ( parameters_install -> parent_window , 0 , GTK_MESSAGE_ERROR , GTK_BUTTONS_YES_NO , "%s" , error_message ) ; gtk_message_dialog_format_secondary_text ( GTK_MESSAGE_DIALOG ( dialog ) , _ ( "There is no application installed for “%s” files.\n" "Do you want to search for an application to open this file?" ) , g_content_type_get_description ( mime_type ) ) ; gtk_window_set_resizable ( GTK_WINDOW ( dialog ) , FALSE ) ; parameters_install -> dialog = dialog ; parameters_install -> proxy = proxy ; g_signal_connect ( dialog , "response" , G_CALLBACK ( application_unhandled_file_install ) , parameters_install ) ; g_signal_connect ( dialog , "delete-event" , G_CALLBACK ( delete_cb ) , NULL ) ; gtk_widget_show_all ( dialog ) ; g_free ( mime_type ) ; }
0
305,845
GF_Err gf_isom_end_hint_sample(GF_ISOFile *the_file, u32 trackNumber, u8 IsRandomAccessPoint) { GF_TrackBox *trak; GF_HintSampleEntryBox *entry; u32 dataRefIndex; GF_Err e; GF_BitStream *bs; GF_ISOSample *samp; trak = gf_isom_get_track_from_file(the_file, trackNumber); if (!trak || !IsHintTrack(trak)) return GF_BAD_PARAM; e = Media_GetSampleDesc(trak->Media, trak->Media->information->sampleTable->currentEntryIndex, (GF_SampleEntryBox **) &entry, &dataRefIndex); if (e) return e; if (!entry->hint_sample) return GF_BAD_PARAM; //first of all, we need to adjust the offset for data referenced IN THIS hint sample //and get some PckSize e = AdjustHintInfo(entry, trak->Media->information->sampleTable->SampleSize->sampleCount + 1); if (e) return e; //ok, let's write the sample bs = gf_bs_new(NULL, 0, GF_BITSTREAM_WRITE); e = gf_isom_hint_sample_write(entry->hint_sample, bs); if (e) { gf_bs_del(bs); return e; } samp = gf_isom_sample_new(); samp->CTS_Offset = 0; samp->IsRAP = IsRandomAccessPoint; samp->DTS = entry->hint_sample->TransmissionTime; //get the sample gf_bs_get_content(bs, &samp->data, &samp->dataLength); gf_bs_del(bs); //finally add the sample e = gf_isom_add_sample(the_file, trackNumber, trak->Media->information->sampleTable->currentEntryIndex, samp); gf_isom_sample_del(&samp); //and delete the sample in our entry ... gf_isom_hint_sample_del(entry->hint_sample); entry->hint_sample = NULL; return e; }
0
504,788
_rsvg_node_text_length_tref (RsvgNodeTref * self, RsvgDrawingCtx * ctx, gdouble * x, gboolean * lastwasspace) { if (self->link) return _rsvg_node_text_length_children (self->link, ctx, x, lastwasspace); return FALSE; }
0
490,103
static coolkey_private_data_t *coolkey_new_private_data(void) { coolkey_private_data_t *priv; /* allocate priv and zero all the fields */ priv = calloc(1, sizeof(coolkey_private_data_t)); if (!priv) return NULL; /* set other fields as appropriate */ priv->key_id = COOLKEY_INVALID_KEY; list_init(&priv->objects_list); list_attributes_comparator(&priv->objects_list, coolkey_compare_id); list_attributes_copy(&priv->objects_list, coolkey_list_meter, 1); return priv; }
0
147,388
static int xts_aesni_setkey(struct crypto_tfm *tfm, const u8 *key, unsigned int keylen) { struct aesni_xts_ctx *ctx = crypto_tfm_ctx(tfm); u32 *flags = &tfm->crt_flags; int err; /* key consists of keys of equal size concatenated, therefore * the length must be even */ if (keylen % 2) { *flags |= CRYPTO_TFM_RES_BAD_KEY_LEN; return -EINVAL; } /* first half of xts-key is for crypt */ err = aes_set_key_common(tfm, ctx->raw_crypt_ctx, key, keylen / 2); if (err) return err; /* second half of xts-key is for tweak */ return aes_set_key_common(tfm, ctx->raw_tweak_ctx, key + keylen / 2, keylen / 2); }
0
507,242
static void s_server_init(void) { accept_socket=-1; cipher=NULL; s_server_verify=SSL_VERIFY_NONE; s_dcert_file=NULL; s_dkey_file=NULL; s_dchain_file=NULL; s_cert_file=TEST_CERT; s_key_file=NULL; s_chain_file=NULL; #ifndef OPENSSL_NO_TLSEXT curves=NULL; s_cert_file2=TEST_CERT2; s_key_file2=NULL; ctx2=NULL; #endif #ifdef FIONBIO s_nbio=0; #endif s_nbio_test=0; ctx=NULL; www=0; bio_s_out=NULL; s_debug=0; s_msg=0; s_quiet=0; hack=0; #ifndef OPENSSL_NO_ENGINE engine_id=NULL; #endif }
0
219,602
void AudioSource::trackMaxAmplitude(int16_t *data, int nSamples) { for (int i = nSamples; i > 0; --i) { int16_t value = *data++; if (value < 0) { value = -value; } if (mMaxAmplitude < value) { mMaxAmplitude = value; } } }
0
175,022
void MimeHandlerViewContainer::DidReceiveData(const char* data, int data_length) { view_id_ += std::string(data, data_length); }
0
140,271
static int udf_read_extent_cache(struct inode *inode, loff_t bcount, loff_t *lbcount, struct extent_position *pos) { struct udf_inode_info *iinfo = UDF_I(inode); int ret = 0; spin_lock(&iinfo->i_extent_cache_lock); if ((iinfo->cached_extent.lstart <= bcount) && (iinfo->cached_extent.lstart != -1)) { /* Cache hit */ *lbcount = iinfo->cached_extent.lstart; memcpy(pos, &iinfo->cached_extent.epos, sizeof(struct extent_position)); if (pos->bh) get_bh(pos->bh); ret = 1; } spin_unlock(&iinfo->i_extent_cache_lock); return ret; }
0
104,517
static const char *columnTypeImpl( NameContext *pNC, #ifndef SQLITE_ENABLE_COLUMN_METADATA Expr *pExpr #else Expr *pExpr, const char **pzOrigDb, const char **pzOrigTab, const char **pzOrigCol #endif ){ char const *zType = 0; int j; #ifdef SQLITE_ENABLE_COLUMN_METADATA char const *zOrigDb = 0; char const *zOrigTab = 0; char const *zOrigCol = 0; #endif assert( pExpr!=0 ); assert( pNC->pSrcList!=0 ); switch( pExpr->op ){ case TK_COLUMN: { /* The expression is a column. Locate the table the column is being ** extracted from in NameContext.pSrcList. This table may be real ** database table or a subquery. */ Table *pTab = 0; /* Table structure column is extracted from */ Select *pS = 0; /* Select the column is extracted from */ int iCol = pExpr->iColumn; /* Index of column in pTab */ while( pNC && !pTab ){ SrcList *pTabList = pNC->pSrcList; for(j=0;j<pTabList->nSrc && pTabList->a[j].iCursor!=pExpr->iTable;j++); if( j<pTabList->nSrc ){ pTab = pTabList->a[j].pTab; pS = pTabList->a[j].pSelect; }else{ pNC = pNC->pNext; } } if( pTab==0 ){ /* At one time, code such as "SELECT new.x" within a trigger would ** cause this condition to run. Since then, we have restructured how ** trigger code is generated and so this condition is no longer ** possible. However, it can still be true for statements like ** the following: ** ** CREATE TABLE t1(col INTEGER); ** SELECT (SELECT t1.col) FROM FROM t1; ** ** when columnType() is called on the expression "t1.col" in the ** sub-select. In this case, set the column type to NULL, even ** though it should really be "INTEGER". ** ** This is not a problem, as the column type of "t1.col" is never ** used. When columnType() is called on the expression ** "(SELECT t1.col)", the correct type is returned (see the TK_SELECT ** branch below. */ break; } assert( pTab && pExpr->y.pTab==pTab ); if( pS ){ /* The "table" is actually a sub-select or a view in the FROM clause ** of the SELECT statement. Return the declaration type and origin ** data for the result-set column of the sub-select. */ if( iCol>=0 && iCol<pS->pEList->nExpr ){ /* If iCol is less than zero, then the expression requests the ** rowid of the sub-select or view. This expression is legal (see ** test case misc2.2.2) - it always evaluates to NULL. */ NameContext sNC; Expr *p = pS->pEList->a[iCol].pExpr; sNC.pSrcList = pS->pSrc; sNC.pNext = pNC; sNC.pParse = pNC->pParse; zType = columnType(&sNC, p,&zOrigDb,&zOrigTab,&zOrigCol); } }else{ /* A real table or a CTE table */ assert( !pS ); #ifdef SQLITE_ENABLE_COLUMN_METADATA if( iCol<0 ) iCol = pTab->iPKey; assert( iCol==XN_ROWID || (iCol>=0 && iCol<pTab->nCol) ); if( iCol<0 ){ zType = "INTEGER"; zOrigCol = "rowid"; }else{ zOrigCol = pTab->aCol[iCol].zName; zType = sqlite3ColumnType(&pTab->aCol[iCol],0); } zOrigTab = pTab->zName; if( pNC->pParse && pTab->pSchema ){ int iDb = sqlite3SchemaToIndex(pNC->pParse->db, pTab->pSchema); zOrigDb = pNC->pParse->db->aDb[iDb].zDbSName; } #else assert( iCol==XN_ROWID || (iCol>=0 && iCol<pTab->nCol) ); if( iCol<0 ){ zType = "INTEGER"; }else{ zType = sqlite3ColumnType(&pTab->aCol[iCol],0); } #endif } break; } #ifndef SQLITE_OMIT_SUBQUERY case TK_SELECT: { /* The expression is a sub-select. Return the declaration type and ** origin info for the single column in the result set of the SELECT ** statement. */ NameContext sNC; Select *pS = pExpr->x.pSelect; Expr *p = pS->pEList->a[0].pExpr; assert( ExprHasProperty(pExpr, EP_xIsSelect) ); sNC.pSrcList = pS->pSrc; sNC.pNext = pNC; sNC.pParse = pNC->pParse; zType = columnType(&sNC, p, &zOrigDb, &zOrigTab, &zOrigCol); break; } #endif } #ifdef SQLITE_ENABLE_COLUMN_METADATA if( pzOrigDb ){ assert( pzOrigTab && pzOrigCol ); *pzOrigDb = zOrigDb; *pzOrigTab = zOrigTab; *pzOrigCol = zOrigCol; } #endif return zType; }
0
483,557
bool kill_device(struct device *dev) { /* * Require the device lock and set the "dead" flag to guarantee that * the update behavior is consistent with the other bitfields near * it and that we cannot have an asynchronous probe routine trying * to run while we are tearing out the bus/class/sysfs from * underneath the device. */ lockdep_assert_held(&dev->mutex); if (dev->p->dead) return false; dev->p->dead = true; return true; }
0
353,414
dtls1_process_out_of_seq_message(SSL *s, struct hm_header_st* msg_hdr, int *ok) { int i=-1; hm_fragment *frag = NULL; pitem *item = NULL; unsigned char seq64be[8]; unsigned long frag_len = msg_hdr->frag_len; if ((msg_hdr->frag_off+frag_len) > msg_hdr->msg_len) goto err; /* Try to find item in queue, to prevent duplicate entries */ memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char) (msg_hdr->seq>>8); seq64be[7] = (unsigned char) msg_hdr->seq; item = pqueue_find(s->d1->buffered_messages, seq64be); /* If we already have an entry and this one is a fragment, * don't discard it and rather try to reassemble it. */ if (item != NULL && frag_len < msg_hdr->msg_len) item = NULL; /* Discard the message if sequence number was already there, is * too far in the future, already in the queue or if we received * a FINISHED before the SERVER_HELLO, which then must be a stale * retransmit. */ if (msg_hdr->seq <= s->d1->handshake_read_seq || msg_hdr->seq > s->d1->handshake_read_seq + 10 || item != NULL || (s->d1->handshake_read_seq == 0 && msg_hdr->type == SSL3_MT_FINISHED)) { unsigned char devnull [256]; while (frag_len) { i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, devnull, frag_len>sizeof(devnull)?sizeof(devnull):frag_len,0); if (i<=0) goto err; frag_len -= i; } } else { if (frag_len && frag_len < msg_hdr->msg_len) return dtls1_reassemble_fragment(s, msg_hdr, ok); frag = dtls1_hm_fragment_new(frag_len, 0); if ( frag == NULL) goto err; memcpy(&(frag->msg_header), msg_hdr, sizeof(*msg_hdr)); if (frag_len) { /* read the body of the fragment (header has already been read */ i = s->method->ssl_read_bytes(s,SSL3_RT_HANDSHAKE, frag->fragment,frag_len,0); if (i<=0 || (unsigned long)i!=frag_len) goto err; } memset(seq64be,0,sizeof(seq64be)); seq64be[6] = (unsigned char)(msg_hdr->seq>>8); seq64be[7] = (unsigned char)(msg_hdr->seq); item = pitem_new(seq64be, frag); if ( item == NULL) goto err; pqueue_insert(s->d1->buffered_messages, item); } return DTLS1_HM_FRAGMENT_RETRY; err: if (frag != NULL && item == NULL) dtls1_hm_fragment_free(frag); *ok = 0; return i; }
1
122,109
static int mov_open_dref(MOVContext *c, AVIOContext **pb, const char *src, MOVDref *ref, AVIOInterruptCB *int_cb) { AVOpenCallback open_func = c->fc->open_cb; if (!open_func) open_func = ffio_open2_wrapper; /* try relative path, we do not try the absolute because it can leak information about our system to an attacker */ if (ref->nlvl_to > 0 && ref->nlvl_from > 0 && ref->path[0] != '/') { char filename[1025]; const char *src_path; int i, l; /* find a source dir */ src_path = strrchr(src, '/'); if (src_path) src_path++; else src_path = src; /* find a next level down to target */ for (i = 0, l = strlen(ref->path) - 1; l >= 0; l--) if (ref->path[l] == '/') { if (i == ref->nlvl_to - 1) break; else i++; } /* compose filename if next level down to target was found */ if (i == ref->nlvl_to - 1 && src_path - src < sizeof(filename)) { memcpy(filename, src, src_path - src); filename[src_path - src] = 0; for (i = 1; i < ref->nlvl_from; i++) av_strlcat(filename, "../", sizeof(filename)); av_strlcat(filename, ref->path + l + 1, sizeof(filename)); if (!c->use_absolute_path && !c->fc->open_cb) if(strstr(ref->path + l + 1, "..") || ref->nlvl_from > 1) return AVERROR(ENOENT); if (strlen(filename) + 1 == sizeof(filename)) return AVERROR(ENOENT); if (!open_func(c->fc, pb, filename, AVIO_FLAG_READ, int_cb, NULL)) return 0; } } else if (c->use_absolute_path) { av_log(c->fc, AV_LOG_WARNING, "Using absolute path on user request, " "this is a possible security issue\n"); if (!open_func(c->fc, pb, ref->path, AVIO_FLAG_READ, int_cb, NULL)) return 0; } else if (c->fc->open_cb) { if (!open_func(c->fc, pb, ref->path, AVIO_FLAG_READ, int_cb, NULL)) return 0; } else { av_log(c->fc, AV_LOG_ERROR, "Absolute path %s not tried for security reasons, " "set demuxer option use_absolute_path to allow absolute paths\n", ref->path); } return AVERROR(ENOENT); }
0
200,673
ModuleExport size_t RegisterPSImage(void) { MagickInfo *entry; entry=AcquireMagickInfo("PS","EPI", "Encapsulated PostScript Interchange format"); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; entry->flags^=CoderBlobSupportFlag; entry->mime_type=ConstantString("application/postscript"); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo("PS","EPS","Encapsulated PostScript"); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; entry->flags^=CoderBlobSupportFlag; entry->mime_type=ConstantString("application/postscript"); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo("PS","EPSF","Encapsulated PostScript"); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; entry->flags^=CoderBlobSupportFlag; entry->mime_type=ConstantString("application/postscript"); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo("PS","EPSI", "Encapsulated PostScript Interchange format"); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderAdjoinFlag; entry->flags^=CoderBlobSupportFlag; entry->mime_type=ConstantString("application/postscript"); (void) RegisterMagickInfo(entry); entry=AcquireMagickInfo("PS","PS","PostScript"); entry->decoder=(DecodeImageHandler *) ReadPSImage; entry->encoder=(EncodeImageHandler *) WritePSImage; entry->magick=(IsImageFormatHandler *) IsPS; entry->mime_type=ConstantString("application/postscript"); entry->flags|=CoderDecoderSeekableStreamFlag; entry->flags^=CoderBlobSupportFlag; (void) RegisterMagickInfo(entry); return(MagickImageCoderSignature); }
0
485,216
DEFUN (clear_ip_bgp_all_ipv4_soft, clear_ip_bgp_all_ipv4_soft_cmd, "clear ip bgp * ipv4 (unicast|multicast) soft", CLEAR_STR IP_STR BGP_STR "Clear all peers\n" "Address family\n" "Address Family Modifier\n" "Address Family Modifier\n" "Soft reconfig\n") { if (strncmp (argv[0], "m", 1) == 0) return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_MULTICAST, clear_all, BGP_CLEAR_SOFT_BOTH, NULL); return bgp_clear_vty (vty, NULL, AFI_IP, SAFI_UNICAST, clear_all, BGP_CLEAR_SOFT_BOTH, NULL); }
0
76,477
DNSRecordContent* DNSRecordContent::mastermake(uint16_t qtype, uint16_t qclass, const string& content) { zmakermap_t::const_iterator i=getZmakermap().find(make_pair(qclass, qtype)); if(i==getZmakermap().end()) { return new UnknownRecordContent(content); } return i->second(content); }
0
431,645
BSONArray roleSetToBSONArray(const unordered_set<RoleName>& roles) { BSONArrayBuilder rolesArrayBuilder; for (unordered_set<RoleName>::const_iterator it = roles.begin(); it != roles.end(); ++it) { const RoleName& role = *it; rolesArrayBuilder.append(BSON(AuthorizationManager::ROLE_NAME_FIELD_NAME << role.getRole() << AuthorizationManager::ROLE_DB_FIELD_NAME << role.getDB())); } return rolesArrayBuilder.arr(); }
0
503,121
connection_handle_read_body_unknown (request_st * const r, chunkqueue * const cq, chunkqueue * const dst_cq) { /* r->conf.max_request_size is in kBytes */ const off_t max_request_size = (off_t)r->conf.max_request_size << 10; chunkqueue_append_chunkqueue(dst_cq, cq); if (0 != max_request_size && dst_cq->bytes_in > max_request_size) { log_error(r->conf.errh, __FILE__, __LINE__, "request-size too long: %lld -> 413", (long long)dst_cq->bytes_in); /* 413 Payload Too Large */ return http_response_reqbody_read_error(r, 413); } return HANDLER_GO_ON; }
0
94,026
static void hci_req_clear_event_filter(struct hci_request *req) { struct hci_cp_set_event_filter f; memset(&f, 0, sizeof(f)); f.flt_type = HCI_FLT_CLEAR_ALL; hci_req_add(req, HCI_OP_SET_EVENT_FLT, 1, &f); /* Update page scan state (since we may have modified it when setting * the event filter). */ __hci_req_update_scan(req); }
0
510,604
my_decimal *Item_copy_string::val_decimal(my_decimal *decimal_value) { // Item_copy_string is used without fix_fields call if (null_value) return (my_decimal *) 0; string2my_decimal(E_DEC_FATAL_ERROR, &str_value, decimal_value); return (decimal_value); }
0
78,247
setSanMatchers(std::vector<envoy::extensions::transport_sockets::tls::v3::SubjectAltNameMatcher> san_matchers) { san_matchers_ = san_matchers; return *this; }
0
168,204
static void limitedWithMissingDefaultAttributeAttributeGetter(const v8::PropertyCallbackInfo<v8::Value>& info) { TestObject* imp = V8TestObject::toNative(info.Holder()); String resultValue = imp->fastGetAttribute(HTMLNames::limitedwithmissingdefaultattributeAttr); if (resultValue.isEmpty()) { resultValue = "rsa"; } else if (equalIgnoringCase(resultValue, "rsa")) { resultValue = "rsa"; } else if (equalIgnoringCase(resultValue, "dsa")) { resultValue = "dsa"; } else { resultValue = ""; } v8SetReturnValueString(info, resultValue, info.GetIsolate()); }
0
467,479
j2k_error(const char *msg, void *client_data) { JPEG2KDECODESTATE *state = (JPEG2KDECODESTATE *)client_data; free((void *)state->error_msg); state->error_msg = strdup(msg); }
0
387,972
png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size, png_uint_32p chunk_bytes, png_bytep next_out, png_alloc_size_t *out_size, int finish) { if (png_ptr->zowner == png_ptr->chunk_name) { int ret; /* next_in and avail_in must have been initialized by the caller. */ png_ptr->zstream.next_out = next_out; png_ptr->zstream.avail_out = 0; /* set in the loop */ do { if (png_ptr->zstream.avail_in == 0) { if (read_size > *chunk_bytes) read_size = (uInt)*chunk_bytes; *chunk_bytes -= read_size; if (read_size > 0) png_crc_read(png_ptr, read_buffer, read_size); png_ptr->zstream.next_in = read_buffer; png_ptr->zstream.avail_in = read_size; } if (png_ptr->zstream.avail_out == 0) { uInt avail = ZLIB_IO_MAX; if (avail > *out_size) avail = (uInt)*out_size; *out_size -= avail; png_ptr->zstream.avail_out = avail; } /* Use Z_SYNC_FLUSH when there is no more chunk data to ensure that all * the available output is produced; this allows reading of truncated * streams. */ ret = inflate(&png_ptr->zstream, *chunk_bytes > 0 ? Z_NO_FLUSH : (finish ? Z_FINISH : Z_SYNC_FLUSH)); } while (ret == Z_OK && (*out_size > 0 || png_ptr->zstream.avail_out > 0)); *out_size += png_ptr->zstream.avail_out; png_ptr->zstream.avail_out = 0; /* Should not be required, but is safe */ /* Ensure the error message pointer is always set: */ png_zstream_error(png_ptr, ret); return ret; } else { png_ptr->zstream.msg = PNGZ_MSG_CAST("zstream unclaimed"); return Z_STREAM_ERROR; } }
0
341,943
static void ppc_hash64_set_isi(CPUState *cs, CPUPPCState *env, uint64_t error_code) { bool vpm; if (msr_ir) { vpm = !!(env->spr[SPR_LPCR] & LPCR_VPM1); } else { vpm = !!(env->spr[SPR_LPCR] & LPCR_VPM0); } if (vpm && !msr_hv) { cs->exception_index = POWERPC_EXCP_HISI; } else { cs->exception_index = POWERPC_EXCP_ISI; } env->error_code = error_code; }
0
14,415
z2grestore(i_ctx_t *i_ctx_p) { if (!restore_page_device(igs, gs_gstate_saved(igs))) return gs_grestore(igs); return push_callout(i_ctx_p, "%grestorepagedevice"); }
1
61,147
static int spawn_next_command_in_evd(struct analyze_event_data *evd) { evd->env_list = export_event_config(evd->event_name); int r = spawn_next_command(evd->run_state, g_dump_dir_name, evd->event_name, EXECFLG_SETPGID); if (r >= 0) { g_event_child_pid = evd->run_state->command_pid; } else { unexport_event_config(evd->env_list); evd->env_list = NULL; } return r; }
0
343,403
static void cirrus_do_copy(CirrusVGAState *s, int dst, int src, int w, int h) { int sx, sy; int dx, dy; int width, height; int depth; int notify = 0; depth = s->get_bpp((VGAState *)s) / 8; s->get_resolution((VGAState *)s, &width, &height); /* extra x, y */ sx = (src % (width * depth)) / depth; sy = (src / (width * depth)); dx = (dst % (width *depth)) / depth; dy = (dst / (width * depth)); /* normalize width */ w /= depth; /* if we're doing a backward copy, we have to adjust our x/y to be the upper left corner (instead of the lower right corner) */ if (s->cirrus_blt_dstpitch < 0) { sx -= (s->cirrus_blt_width / depth) - 1; dx -= (s->cirrus_blt_width / depth) - 1; sy -= s->cirrus_blt_height - 1; dy -= s->cirrus_blt_height - 1; } /* are we in the visible portion of memory? */ if (sx >= 0 && sy >= 0 && dx >= 0 && dy >= 0 && (sx + w) <= width && (sy + h) <= height && (dx + w) <= width && (dy + h) <= height) { notify = 1; } /* make to sure only copy if it's a plain copy ROP */ if (*s->cirrus_rop != cirrus_bitblt_rop_fwd_src && *s->cirrus_rop != cirrus_bitblt_rop_bkwd_src) notify = 0; /* we have to flush all pending changes so that the copy is generated at the appropriate moment in time */ if (notify) vga_hw_update(); (*s->cirrus_rop) (s, s->vram_ptr + s->cirrus_blt_dstaddr, s->vram_ptr + s->cirrus_blt_srcaddr, s->cirrus_blt_dstpitch, s->cirrus_blt_srcpitch, s->cirrus_blt_width, s->cirrus_blt_height); if (notify) s->ds->dpy_copy(s->ds, sx, sy, dx, dy, s->cirrus_blt_width / depth, s->cirrus_blt_height); /* we don't have to notify the display that this portion has changed since dpy_copy implies this */ if (!notify) cirrus_invalidate_region(s, s->cirrus_blt_dstaddr, s->cirrus_blt_dstpitch, s->cirrus_blt_width, s->cirrus_blt_height); }
1
275,291
RenderViewZoomer(const GURL& url, double zoom_level) : zoom_level_(zoom_level) { host_ = net::GetHostOrSpecFromURL(url); }
0
412,213
static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode, const void *buf, int bufsize) { struct buffer_head *bh = NULL; unsigned long block = 0; int blocksize = ea_inode->i_sb->s_blocksize; int max_blocks = (bufsize + blocksize - 1) >> ea_inode->i_blkbits; int csize, wsize = 0; int ret = 0; int retries = 0; retry: while (ret >= 0 && ret < max_blocks) { struct ext4_map_blocks map; map.m_lblk = block += ret; map.m_len = max_blocks -= ret; ret = ext4_map_blocks(handle, ea_inode, &map, EXT4_GET_BLOCKS_CREATE); if (ret <= 0) { ext4_mark_inode_dirty(handle, ea_inode); if (ret == -ENOSPC && ext4_should_retry_alloc(ea_inode->i_sb, &retries)) { ret = 0; goto retry; } break; } } if (ret < 0) return ret; block = 0; while (wsize < bufsize) { if (bh != NULL) brelse(bh); csize = (bufsize - wsize) > blocksize ? blocksize : bufsize - wsize; bh = ext4_getblk(handle, ea_inode, block, 0); if (IS_ERR(bh)) return PTR_ERR(bh); ret = ext4_journal_get_write_access(handle, bh); if (ret) goto out; memcpy(bh->b_data, buf, csize); set_buffer_uptodate(bh); ext4_handle_dirty_metadata(handle, ea_inode, bh); buf += csize; wsize += csize; block += 1; } inode_lock(ea_inode); i_size_write(ea_inode, wsize); ext4_update_i_disksize(ea_inode, wsize); inode_unlock(ea_inode); ext4_mark_inode_dirty(handle, ea_inode); out: brelse(bh); return ret; }
0
186,678
void RenderFrameHostImpl::DidReceiveFirstUserActivation() { delegate_->DidReceiveFirstUserActivation(this); }
0
496,073
is_nfs4_flags_w(const wchar_t *start, const wchar_t *end, int *permset) { const wchar_t *p = start; while (p < end) { switch(*p++) { case L'f': *permset |= ARCHIVE_ENTRY_ACL_ENTRY_FILE_INHERIT; break; case L'd': *permset |= ARCHIVE_ENTRY_ACL_ENTRY_DIRECTORY_INHERIT; break; case L'i': *permset |= ARCHIVE_ENTRY_ACL_ENTRY_INHERIT_ONLY; break; case L'n': *permset |= ARCHIVE_ENTRY_ACL_ENTRY_NO_PROPAGATE_INHERIT; break; case L'S': *permset |= ARCHIVE_ENTRY_ACL_ENTRY_SUCCESSFUL_ACCESS; break; case L'F': *permset |= ARCHIVE_ENTRY_ACL_ENTRY_FAILED_ACCESS; break; case L'I': *permset |= ARCHIVE_ENTRY_ACL_ENTRY_INHERITED; break; case L'-': break; default: return (0); } } return (1); }
0
257,832
void vp9_init_dsmotion_compensation ( search_site_config * cfg , int stride ) { int len , ss_count = 1 ; cfg -> ss [ 0 ] . mv . col = cfg -> ss [ 0 ] . mv . row = 0 ; cfg -> ss [ 0 ] . offset = 0 ; for ( len = MAX_FIRST_STEP ; len > 0 ; len /= 2 ) { const MV ss_mvs [ ] = { { - len , 0 } , { len , 0 } , { 0 , - len } , { 0 , len } } ; int i ; for ( i = 0 ; i < 4 ; ++ i ) { search_site * const ss = & cfg -> ss [ ss_count ++ ] ; ss -> mv = ss_mvs [ i ] ; ss -> offset = ss -> mv . row * stride + ss -> mv . col ; } } cfg -> ss_count = ss_count ; cfg -> searches_per_step = 4 ; }
0
370,462
int apply_filters_to_request(struct session *s, struct channel *req, struct proxy *px) { struct http_txn *txn = &s->txn; struct hdr_exp *exp; for (exp = px->req_exp; exp; exp = exp->next) { int ret; /* * The interleaving of transformations and verdicts * makes it difficult to decide to continue or stop * the evaluation. */ if (txn->flags & (TX_CLDENY|TX_CLTARPIT)) break; if ((txn->flags & TX_CLALLOW) && (exp->action == ACT_ALLOW || exp->action == ACT_DENY || exp->action == ACT_TARPIT || exp->action == ACT_PASS)) continue; /* if this filter had a condition, evaluate it now and skip to * next filter if the condition does not match. */ if (exp->cond) { ret = acl_exec_cond(exp->cond, px, s, txn, SMP_OPT_DIR_REQ|SMP_OPT_FINAL); ret = acl_pass(ret); if (((struct acl_cond *)exp->cond)->pol == ACL_COND_UNLESS) ret = !ret; if (!ret) continue; } /* Apply the filter to the request line. */ ret = apply_filter_to_req_line(s, req, exp); if (unlikely(ret < 0)) return -1; if (likely(ret == 0)) { /* The filter did not match the request, it can be * iterated through all headers. */ apply_filter_to_req_headers(s, req, exp); } } return 0; }
0
252,058
void PrintPreviewDialogController::RemoveInitiator( WebContents* initiator) { WebContents* preview_dialog = GetPrintPreviewForContents(initiator); DCHECK(preview_dialog); preview_dialog_map_[preview_dialog] = nullptr; RemoveObservers(initiator); PrintViewManager::FromWebContents(initiator)->PrintPreviewDone(); if (content::WebUI* web_ui = preview_dialog->GetWebUI()) { PrintPreviewUI* print_preview_ui = static_cast<PrintPreviewUI*>(web_ui->GetController()); if (print_preview_ui) print_preview_ui->OnInitiatorClosed(); } }
0
199,421
static void GrowCapacityAndConvertImpl(Handle<JSObject> object, uint32_t capacity) { Handle<FixedArray> parameter_map(FixedArray::cast(object->elements())); Handle<FixedArray> old_elements(FixedArray::cast(parameter_map->get(1))); ElementsKind from_kind = object->GetElementsKind(); DCHECK(from_kind == SLOW_SLOPPY_ARGUMENTS_ELEMENTS || static_cast<uint32_t>(old_elements->length()) < capacity); Handle<FixedArrayBase> elements = ConvertElementsWithCapacity(object, old_elements, from_kind, capacity); Handle<Map> new_map = JSObject::GetElementsTransitionMap( object, FAST_SLOPPY_ARGUMENTS_ELEMENTS); JSObject::MigrateToMap(object, new_map); parameter_map->set(1, *elements); JSObject::ValidateElements(object); }
0
265,191
int tcp_filter(struct sock *sk, struct sk_buff *skb) { struct tcphdr *th = (struct tcphdr *)skb->data; unsigned int eaten = skb->len; int err; err = sk_filter_trim_cap(sk, skb, th->doff * 4); if (!err) { eaten -= skb->len; TCP_SKB_CB(skb)->end_seq -= eaten; } return err; }
0
383,530
void precompute_partition_info_escapes_( const FLAC__int32 residual[], unsigned raw_bits_per_partition[], unsigned residual_samples, unsigned predictor_order, unsigned min_partition_order, unsigned max_partition_order ) { int partition_order; unsigned from_partition, to_partition = 0; const unsigned blocksize = residual_samples + predictor_order; /* first do max_partition_order */ for(partition_order = (int)max_partition_order; partition_order >= 0; partition_order--) { FLAC__int32 r; FLAC__uint32 rmax; unsigned partition, partition_sample, partition_samples, residual_sample; const unsigned partitions = 1u << partition_order; const unsigned default_partition_samples = blocksize >> partition_order; FLAC__ASSERT(default_partition_samples > predictor_order); for(partition = residual_sample = 0; partition < partitions; partition++) { partition_samples = default_partition_samples; if(partition == 0) partition_samples -= predictor_order; rmax = 0; for(partition_sample = 0; partition_sample < partition_samples; partition_sample++) { r = residual[residual_sample++]; /* OPT: maybe faster: rmax |= r ^ (r>>31) */ if(r < 0) rmax |= ~r; else rmax |= r; } /* now we know all residual values are in the range [-rmax-1,rmax] */ raw_bits_per_partition[partition] = rmax? FLAC__bitmath_ilog2(rmax) + 2 : 1; } to_partition = partitions; break; /*@@@ yuck, should remove the 'for' loop instead */ } /* now merge partitions for lower orders */ for(from_partition = 0, --partition_order; partition_order >= (int)min_partition_order; partition_order--) { unsigned m; unsigned i; const unsigned partitions = 1u << partition_order; for(i = 0; i < partitions; i++) { m = raw_bits_per_partition[from_partition]; from_partition++; raw_bits_per_partition[to_partition] = flac_max(m, raw_bits_per_partition[from_partition]); from_partition++; to_partition++; } } }
0
481,120
static bool kvm_zap_rmapp(struct kvm *kvm, struct kvm_rmap_head *rmap_head, const struct kvm_memory_slot *slot) { return pte_list_destroy(kvm, rmap_head); }
0
2,282
process_open(u_int32_t id) { u_int32_t pflags; Attrib a; char *name; int r, handle, fd, flags, mode, status = SSH2_FX_FAILURE; if ((r = sshbuf_get_cstring(iqueue, &name, NULL)) != 0 || (r = sshbuf_get_u32(iqueue, &pflags)) != 0 || /* portable flags */ (r = decode_attrib(iqueue, &a)) != 0) fatal("%s: buffer error: %s", __func__, ssh_err(r)); debug3("request %u: open flags %d", id, pflags); flags = flags_from_portable(pflags); mode = (a.flags & SSH2_FILEXFER_ATTR_PERMISSIONS) ? a.perm : 0666; logit("open \"%s\" flags %s mode 0%o", name, string_from_portable(pflags), mode); if (readonly && ((flags & O_ACCMODE) == O_WRONLY || (flags & O_ACCMODE) == O_RDWR)) { verbose("Refusing open request in read-only mode"); status = SSH2_FX_PERMISSION_DENIED; } else { fd = open(name, flags, mode); if (fd < 0) { status = errno_to_portable(errno); } else { handle = handle_new(HANDLE_FILE, name, fd, flags, NULL); if (handle < 0) { close(fd); } else { send_handle(id, handle); status = SSH2_FX_OK; } } } if (status != SSH2_FX_OK) send_status(id, status); free(name); }
1
23,012
static const char * hfinfo_number_value_format64 ( const header_field_info * hfinfo , char buf [ 64 ] , guint64 value ) { int display = hfinfo -> display ; if ( hfinfo -> type == FT_FRAMENUM ) { display = BASE_DEC ; } return hfinfo_number_value_format_display64 ( hfinfo , display , buf , value ) ; }
0
393,460
parse_list(xmlChar *str) { xmlChar **buffer; xmlChar **out = NULL; int buffer_size = 0; int len; if(str == NULL) { return(NULL); } len = xmlStrlen(str); if((str[0] == '\'') && (str[len - 1] == '\'')) { str[len - 1] = '\0'; str++; } /* * allocate an translation buffer. */ buffer_size = 1000; buffer = (xmlChar **) xmlMalloc(buffer_size * sizeof(xmlChar*)); if (buffer == NULL) { perror("malloc failed"); return(NULL); } out = buffer; while(*str != '\0') { if (out - buffer > buffer_size - 10) { int indx = out - buffer; xxx_growBufferReentrant(); out = &buffer[indx]; } (*out++) = str; while(*str != ',' && *str != '\0') ++str; if(*str == ',') *(str++) = '\0'; } (*out) = NULL; return buffer; }
0
339,539
static int mov_read_stsc(MOVContext *c, AVIOContext *pb, MOVAtom atom) { AVStream *st; MOVStreamContext *sc; unsigned int i, entries; if (c->fc->nb_streams < 1) return 0; st = c->fc->streams[c->fc->nb_streams-1]; sc = st->priv_data; avio_r8(pb); /* version */ avio_rb24(pb); /* flags */ entries = avio_rb32(pb); av_log(c->fc, AV_LOG_TRACE, "track[%i].stsc.entries = %i\n", c->fc->nb_streams-1, entries); if (!entries) return 0; if (entries >= UINT_MAX / sizeof(*sc->stsc_data)) return AVERROR_INVALIDDATA; sc->stsc_data = av_malloc(entries * sizeof(*sc->stsc_data)); if (!sc->stsc_data) return AVERROR(ENOMEM); for (i = 0; i < entries && !pb->eof_reached; i++) { sc->stsc_data[i].first = avio_rb32(pb); sc->stsc_data[i].count = avio_rb32(pb); sc->stsc_data[i].id = avio_rb32(pb); if (sc->stsc_data[i].id < 0 || sc->stsc_data[i].id > sc->stsd_count) { sc->stsc_data[i].id = 0; if (c->fc->error_recognition & AV_EF_EXPLODE) { av_log(c->fc, AV_LOG_ERROR, "Invalid stsc index.\n"); return AVERROR_INVALIDDATA; } } } sc->stsc_count = i; if (pb->eof_reached) return AVERROR_EOF; return 0; }
0
40,386
make_etype_info2_entry(ETYPE_INFO2_ENTRY *ent, Key *key) { krb5_error_code ret; ent->etype = key->key.keytype; if(key->salt) { ALLOC(ent->salt); if (ent->salt == NULL) return ENOMEM; *ent->salt = malloc(key->salt->salt.length + 1); if (*ent->salt == NULL) { free(ent->salt); ent->salt = NULL; return ENOMEM; } memcpy(*ent->salt, key->salt->salt.data, key->salt->salt.length); (*ent->salt)[key->salt->salt.length] = '\0'; } else ent->salt = NULL; ent->s2kparams = NULL; switch (key->key.keytype) { case ETYPE_AES128_CTS_HMAC_SHA1_96: case ETYPE_AES256_CTS_HMAC_SHA1_96: ret = make_s2kparams(_krb5_AES_SHA1_string_to_default_iterator, 4, &ent->s2kparams); break; case KRB5_ENCTYPE_AES128_CTS_HMAC_SHA256_128: case KRB5_ENCTYPE_AES256_CTS_HMAC_SHA384_192: ret = make_s2kparams(_krb5_AES_SHA2_string_to_default_iterator, 4, &ent->s2kparams); break; case ETYPE_DES_CBC_CRC: case ETYPE_DES_CBC_MD4: case ETYPE_DES_CBC_MD5: /* Check if this was a AFS3 salted key */ if(key->salt && key->salt->type == hdb_afs3_salt) ret = make_s2kparams(1, 1, &ent->s2kparams); else ret = 0; break; default: ret = 0; break; } return ret; }
0
430,548
static struct istream *quoted_string_istream_create (struct managesieve_parser *parser) { struct quoted_string_istream *qsstream; qsstream = i_new(struct quoted_string_istream, 1); qsstream->istream.max_buffer_size = parser->input->real_stream->max_buffer_size; qsstream->istream.read = quoted_string_istream_read; qsstream->istream.istream.readable_fd = FALSE; qsstream->istream.istream.blocking = parser->input->blocking; qsstream->istream.istream.seekable = FALSE; return i_stream_create(&qsstream->istream, parser->input, i_stream_get_fd(parser->input), 0); }
0
56,057
filepos_t EbmlElement::MakeRenderHead(IOCallback & output, bool bKeepPosition) { binary FinalHead[4+8]; // Class D + 64 bits coded size unsigned int FinalHeadSize; FinalHeadSize = EBML_ID_LENGTH((const EbmlId&)*this); EbmlId(*this).Fill(FinalHead); int CodedSize = CodedSizeLength(Size, SizeLength, bSizeIsFinite); CodedValueLength(Size, CodedSize, &FinalHead[FinalHeadSize]); FinalHeadSize += CodedSize; output.writeFully(FinalHead, FinalHeadSize); if (!bKeepPosition) { ElementPosition = output.getFilePointer() - FinalHeadSize; SizePosition = ElementPosition + EBML_ID_LENGTH((const EbmlId&)*this); } return FinalHeadSize; }
0
81,548
static inline void SetPixelGray(const Image *restrict image,const Quantum gray, Quantum *restrict pixel) { pixel[image->channel_map[GrayPixelChannel].offset]=gray; }
0
84,233
static void *cgm_init(const char *name) { struct cgm_data *d; if (!cgm_dbus_connect()) { ERROR("Error connecting to cgroup manager"); return NULL; } check_supports_multiple_controllers(-1); d = malloc(sizeof(*d)); if (!d) { cgm_dbus_disconnect(); return NULL; } memset(d, 0, sizeof(*d)); d->name = strdup(name); if (!d->name) { cgm_dbus_disconnect(); goto err1; } d->cgroup_pattern = lxc_global_config_value("lxc.cgroup.pattern"); // cgm_create immediately gets called so keep the connection open return d; err1: free(d); return NULL; }
0
468,263
llsec_dev_find_long(struct mac802154_llsec *sec, __le64 hwaddr) { struct mac802154_llsec_device *dev; u64 key = llsec_dev_hash_long(hwaddr); hash_for_each_possible_rcu(sec->devices_hw, dev, bucket_hw, key) { if (dev->dev.hwaddr == hwaddr) return dev; } return NULL; }
0
103,369
static int sctp_connect(struct sock *sk, struct sockaddr *addr, int addr_len) { int err = 0; struct sctp_af *af; lock_sock(sk); pr_debug("%s: sk:%p, sockaddr:%p, addr_len:%d\n", __func__, sk, addr, addr_len); /* Validate addr_len before calling common connect/connectx routine. */ af = sctp_get_af_specific(addr->sa_family); if (!af || addr_len < af->sockaddr_len) { err = -EINVAL; } else { /* Pass correct addr len to common routine (so it knows there * is only one address being passed. */ err = __sctp_connect(sk, addr, af->sockaddr_len, NULL); } release_sock(sk); return err; }
0
490,809
read_2007_section_appinfohistory (Bit_Chain *restrict dat, Dwg_Data *restrict dwg, r2007_section *restrict sections_map, r2007_page *restrict pages_map) { Bit_Chain old_dat, sec_dat = { 0 }; //Bit_Chain *str_dat; Dwg_AppInfoHistory *_obj = &dwg->appinfohistory; Dwg_Object *obj = NULL; int error = 0; //BITCODE_RL rcount1 = 0, rcount2 = 0; // compressed, page size: 0x580 error = read_data_section (&sec_dat, dat, sections_map, pages_map, SECTION_APPINFOHISTORY); if (error >= DWG_ERR_CRITICAL || !sec_dat.chain) { LOG_INFO ("%s section not found\n", "AppInfoHistory"); if (sec_dat.chain) free (sec_dat.chain); return error; } LOG_TRACE ("\nAppInfoHistory (%lu)\n-------------------\n", sec_dat.size) old_dat = *dat; dat = &sec_dat; // restrict in size bit_chain_set_version (&old_dat, dat); DEBUG_HERE _obj->size = dat->size; _obj->unknown_bits = bit_read_TF (dat, _obj->size); LOG_TRACE_TF (_obj->unknown_bits, _obj->size) LOG_TRACE ("\n") if (sec_dat.chain) free (sec_dat.chain); *dat = old_dat; // unrestrict return error; }
0
349,922
absl::string_view hostAndPort() const { return host_and_port_; }
1
329,882
static int ast_read_packet(AVFormatContext *s, AVPacket *pkt) { uint32_t type, size; int64_t pos; int ret; if (avio_feof(s->pb)) return AVERROR_EOF; pos = avio_tell(s->pb); type = avio_rl32(s->pb); size = avio_rb32(s->pb); if (size > INT_MAX / s->streams[0]->codecpar->channels) return AVERROR_INVALIDDATA; size *= s->streams[0]->codecpar->channels; if ((ret = avio_skip(s->pb, 24)) < 0) // padding return ret; if (type == MKTAG('B','L','C','K')) { ret = av_get_packet(s->pb, pkt, size); pkt->stream_index = 0; pkt->pos = pos; } else { av_log(s, AV_LOG_ERROR, "unknown chunk %x\n", type); avio_skip(s->pb, size); ret = AVERROR_INVALIDDATA; } return ret; }
1
181,808
RenderWidgetHostImpl::RenderWidgetHostImpl(RenderWidgetHostDelegate* delegate, RenderProcessHost* process, int routing_id) : view_(NULL), renderer_initialized_(false), hung_renderer_delay_ms_(kHungRendererDelayMs), delegate_(delegate), process_(process), routing_id_(routing_id), surface_id_(0), is_loading_(false), is_hidden_(false), is_fullscreen_(false), is_accelerated_compositing_active_(false), repaint_ack_pending_(false), resize_ack_pending_(false), should_auto_resize_(false), waiting_for_screen_rects_ack_(false), mouse_move_pending_(false), mouse_wheel_pending_(false), select_range_pending_(false), needs_repainting_on_restore_(false), is_unresponsive_(false), in_flight_event_count_(0), in_get_backing_store_(false), abort_get_backing_store_(false), view_being_painted_(false), ignore_input_events_(false), text_direction_updated_(false), text_direction_(WebKit::WebTextDirectionLeftToRight), text_direction_canceled_(false), suppress_next_char_events_(false), pending_mouse_lock_request_(false), allow_privileged_mouse_lock_(false), has_touch_handler_(false), ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)), tick_active_smooth_scroll_gestures_task_posted_(false), touch_event_queue_(new TouchEventQueue(this)), gesture_event_filter_(new GestureEventFilter(this)) { CHECK(delegate_); if (routing_id_ == MSG_ROUTING_NONE) { routing_id_ = process_->GetNextRoutingID(); surface_id_ = GpuSurfaceTracker::Get()->AddSurfaceForRenderer( process_->GetID(), routing_id_); } else { surface_id_ = GpuSurfaceTracker::Get()->LookupSurfaceForRenderer( process_->GetID(), routing_id_); DCHECK(surface_id_); } is_threaded_compositing_enabled_ = IsThreadedCompositingEnabled(); process_->Attach(this, routing_id_); process_->WidgetRestored(); #if defined(USE_AURA) bool overscroll_enabled = CommandLine::ForCurrentProcess()-> HasSwitch(switches::kEnableOverscrollHistoryNavigation); if (overscroll_enabled) InitializeOverscrollController(); #endif }
0
63,319
void testCompareRangeHelper(const char * a, const char * b, int expected, bool avoidNullRange = true) { UriTextRangeA ra; UriTextRangeA rb; if (a) { ra.first = a; ra.afterLast = a + strlen(a); } else { ra.first = NULL; ra.afterLast = NULL; } if (b) { rb.first = b; rb.afterLast = b + strlen(b); } else { rb.first = NULL; rb.afterLast = NULL; } const int received = uriCompareRangeA( ((a == NULL) && avoidNullRange) ? NULL : &ra, ((b == NULL) && avoidNullRange) ? NULL : &rb); if (received != expected) { printf("Comparing <%s> to <%s> yields %d, expected %d.\n", a, b, received, expected); } ASSERT_TRUE(received == expected); }
0
53,437
GF_Err iinf_box_size(GF_Box *s) { u32 pos=0; GF_ItemInfoBox *ptr = (GF_ItemInfoBox *)s; if (!s) return GF_BAD_PARAM; ptr->size += (ptr->version == 0) ? 2 : 4; gf_isom_check_position_list(s, ptr->item_infos, &pos); return GF_OK; }
0
240,496
inline bool SearchBuffer::isBadMatch(const UChar* match, size_t matchLength) const { if (!m_targetRequiresKanaWorkaround) return false; normalizeCharacters(match, matchLength, m_normalizedMatch); const UChar* a = m_normalizedTarget.begin(); const UChar* aEnd = m_normalizedTarget.end(); const UChar* b = m_normalizedMatch.begin(); const UChar* bEnd = m_normalizedMatch.end(); while (true) { while (a != aEnd && !isKanaLetter(*a)) ++a; while (b != bEnd && !isKanaLetter(*b)) ++b; if (a == aEnd || b == bEnd) { ASSERT(a == aEnd); ASSERT(b == bEnd); return false; } if (isSmallKanaLetter(*a) != isSmallKanaLetter(*b)) return true; if (composedVoicedSoundMark(*a) != composedVoicedSoundMark(*b)) return true; ++a; ++b; while (1) { if (!(a != aEnd && isCombiningVoicedSoundMark(*a))) { if (b != bEnd && isCombiningVoicedSoundMark(*b)) return true; break; } if (!(b != bEnd && isCombiningVoicedSoundMark(*b))) return true; if (*a != *b) return true; ++a; ++b; } } }
0
32,078
static int opdec(RAsm *a, ut8 *data, const Opcode *op) { if (op->operands[1].type) { eprintf ("Error: Invalid operands\n"); return -1; } int l = 0; int size = op->operands[0].type & ALL_SIZE; if (op->operands[0].explicit_size) { size = op->operands[0].dest_size; } if (size & OT_WORD) { data[l++] = 0x66; } //rex prefix int rex = 1 << 6; bool use_rex = false; if (size & OT_QWORD) { //W field use_rex = true; rex |= 1 << 3; } if (op->operands[0].extended) { //B field use_rex = true; rex |= 1; } //opcode selection int opcode; if (size & OT_BYTE) { opcode = 0xfe; } else { opcode = 0xff; } if (!(op->operands[0].type & OT_MEMORY)) { if (use_rex) { data[l++] = rex; } if (a->bits > 32 || size & OT_BYTE) { data[l++] = opcode; } if (a->bits == 32 && size & (OT_DWORD | OT_WORD)) { data[l++] = 0x48 | op->operands[0].reg; } else { data[l++] = 0xc8 | op->operands[0].reg; } return l; } //modrm and SIB selection bool rip_rel = op->operands[0].regs[0] == X86R_RIP; int offset = op->operands[0].offset * op->operands[0].offset_sign; int modrm = 0; int mod; int reg = 0; int rm; bool use_sib = false; int sib; //mod if (offset == 0) { mod = 0; } else if (offset < 128 && offset > -129) { mod = 1; } else { mod = 2; } if (op->operands[0].regs[0] & OT_WORD) { if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_SI) { rm = B0000; } else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == X86R_DI) { rm = B0001; } else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_SI) { rm = B0010; } else if (op->operands[0].regs[0] == X86R_BP && op->operands[0].regs[1] == X86R_DI) { rm = B0011; } else if (op->operands[0].regs[0] == X86R_SI && op->operands[0].regs[1] == -1) { rm = B0100; } else if (op->operands[0].regs[0] == X86R_DI && op->operands[0].regs[1] == -1) { rm = B0101; } else if (op->operands[0].regs[0] == X86R_BX && op->operands[0].regs[1] == -1) { rm = B0111; } else { //TODO allow for displacement only when parser is reworked return -1; } modrm = (mod << 6) | (reg << 3) | rm; } else { //rm if (op->operands[0].extended) { rm = op->operands[0].reg; } else { rm = op->operands[0].regs[0]; } //[epb] alone is illegal, so we need to fake a [ebp+0] if (rm == 5 && mod == 0) { mod = 1; } //sib int index = op->operands[0].regs[1]; int scale = getsib(op->operands[0].scale[1]); if (index != -1) { use_sib = true; sib = (scale << 6) | (index << 3) | rm; } else if (rm == 4) { use_sib = true; sib = 0x24; } if (use_sib) { rm = B0100; } if (rip_rel) { modrm = (B0000 << 6) | (reg << 3) | B0101; sib = (scale << 6) | (B0100 << 3) | B0101; } else { modrm = (mod << 6) | (reg << 3) | rm; } modrm |= 1<<3; } if (use_rex) { data[l++] = rex; } data[l++] = opcode; data[l++] = modrm; if (use_sib) { data[l++] = sib; } //offset if (mod == 1) { data[l++] = offset; } else if (op->operands[0].regs[0] & OT_WORD && mod == 2) { data[l++] = offset; data[l++] = offset >> 8; } else if (mod == 2 || rip_rel) { data[l++] = offset; data[l++] = offset >> 8; data[l++] = offset >> 16; data[l++] = offset >> 24; } return l; }
0
463,599
static int io_poll_cancel(struct io_ring_ctx *ctx, __u64 sqe_addr) { struct hlist_head *list; struct io_kiocb *req; list = &ctx->cancel_hash[hash_long(sqe_addr, ctx->cancel_hash_bits)]; hlist_for_each_entry(req, list, hash_node) { if (sqe_addr != req->user_data) continue; if (io_poll_remove_one(req)) return 0; return -EALREADY; } return -ENOENT;
0
42,823
XMLReader::XMLReader() : m_ptr(nullptr), m_input(nullptr), m_schema(nullptr) { }
0
443,748
static unsigned int selinux_ip_postroute(struct sk_buff *skb, const struct net_device *outdev, u16 family) { u32 secmark_perm; u32 peer_sid; int ifindex = outdev->ifindex; struct sock *sk; struct common_audit_data ad; struct lsm_network_audit net = {0,}; char *addrp; u8 secmark_active; u8 peerlbl_active; /* If any sort of compatibility mode is enabled then handoff processing * to the selinux_ip_postroute_compat() function to deal with the * special handling. We do this in an attempt to keep this function * as fast and as clean as possible. */ if (!selinux_policycap_netpeer()) return selinux_ip_postroute_compat(skb, ifindex, family); secmark_active = selinux_secmark_enabled(); peerlbl_active = selinux_peerlbl_enabled(); if (!secmark_active && !peerlbl_active) return NF_ACCEPT; sk = skb_to_full_sk(skb); #ifdef CONFIG_XFRM /* If skb->dst->xfrm is non-NULL then the packet is undergoing an IPsec * packet transformation so allow the packet to pass without any checks * since we'll have another chance to perform access control checks * when the packet is on it's final way out. * NOTE: there appear to be some IPv6 multicast cases where skb->dst * is NULL, in this case go ahead and apply access control. * NOTE: if this is a local socket (skb->sk != NULL) that is in the * TCP listening state we cannot wait until the XFRM processing * is done as we will miss out on the SA label if we do; * unfortunately, this means more work, but it is only once per * connection. */ if (skb_dst(skb) != NULL && skb_dst(skb)->xfrm != NULL && !(sk && sk_listener(sk))) return NF_ACCEPT; #endif if (sk == NULL) { /* Without an associated socket the packet is either coming * from the kernel or it is being forwarded; check the packet * to determine which and if the packet is being forwarded * query the packet directly to determine the security label. */ if (skb->skb_iif) { secmark_perm = PACKET__FORWARD_OUT; if (selinux_skb_peerlbl_sid(skb, family, &peer_sid)) return NF_DROP; } else { secmark_perm = PACKET__SEND; peer_sid = SECINITSID_KERNEL; } } else if (sk_listener(sk)) { /* Locally generated packet but the associated socket is in the * listening state which means this is a SYN-ACK packet. In * this particular case the correct security label is assigned * to the connection/request_sock but unfortunately we can't * query the request_sock as it isn't queued on the parent * socket until after the SYN-ACK packet is sent; the only * viable choice is to regenerate the label like we do in * selinux_inet_conn_request(). See also selinux_ip_output() * for similar problems. */ u32 skb_sid; struct sk_security_struct *sksec; sksec = sk->sk_security; if (selinux_skb_peerlbl_sid(skb, family, &skb_sid)) return NF_DROP; /* At this point, if the returned skb peerlbl is SECSID_NULL * and the packet has been through at least one XFRM * transformation then we must be dealing with the "final" * form of labeled IPsec packet; since we've already applied * all of our access controls on this packet we can safely * pass the packet. */ if (skb_sid == SECSID_NULL) { switch (family) { case PF_INET: if (IPCB(skb)->flags & IPSKB_XFRM_TRANSFORMED) return NF_ACCEPT; break; case PF_INET6: if (IP6CB(skb)->flags & IP6SKB_XFRM_TRANSFORMED) return NF_ACCEPT; break; default: return NF_DROP_ERR(-ECONNREFUSED); } } if (selinux_conn_sid(sksec->sid, skb_sid, &peer_sid)) return NF_DROP; secmark_perm = PACKET__SEND; } else { /* Locally generated packet, fetch the security label from the * associated socket. */ struct sk_security_struct *sksec = sk->sk_security; peer_sid = sksec->sid; secmark_perm = PACKET__SEND; } ad.type = LSM_AUDIT_DATA_NET; ad.u.net = &net; ad.u.net->netif = ifindex; ad.u.net->family = family; if (selinux_parse_skb(skb, &ad, &addrp, 0, NULL)) return NF_DROP; if (secmark_active) if (avc_has_perm(&selinux_state, peer_sid, skb->secmark, SECCLASS_PACKET, secmark_perm, &ad)) return NF_DROP_ERR(-ECONNREFUSED); if (peerlbl_active) { u32 if_sid; u32 node_sid; if (sel_netif_sid(dev_net(outdev), ifindex, &if_sid)) return NF_DROP; if (avc_has_perm(&selinux_state, peer_sid, if_sid, SECCLASS_NETIF, NETIF__EGRESS, &ad)) return NF_DROP_ERR(-ECONNREFUSED); if (sel_netnode_sid(addrp, family, &node_sid)) return NF_DROP; if (avc_has_perm(&selinux_state, peer_sid, node_sid, SECCLASS_NODE, NODE__SENDTO, &ad)) return NF_DROP_ERR(-ECONNREFUSED); } return NF_ACCEPT; }
0
111,695
TEST(CombineHashes, TestHashOutputsDifferent) { size_t output1 = CombineHashes({1, 2, 3, 4}); size_t output2 = CombineHashes({1, 2, 2, 4}); EXPECT_NE(output1, output2); }
0
268,166
ex_scriptencoding(exarg_T *eap) { source_cookie_T *sp; char_u *name; if (!sourcing_a_script(eap)) { emsg(_(e_scriptencoding_used_outside_of_sourced_file)); return; } if (*eap->arg != NUL) { name = enc_canonize(eap->arg); if (name == NULL) // out of memory return; } else name = eap->arg; // Setup for conversion from the specified encoding to 'encoding'. sp = (source_cookie_T *)getline_cookie(eap->getline, eap->cookie); convert_setup(&sp->conv, name, p_enc); if (name != eap->arg) vim_free(name); }
0
288,424
void TSMimeParserClear ( TSMimeParser parser ) { sdk_assert ( sdk_sanity_check_mime_parser ( parser ) == TS_SUCCESS ) ; mime_parser_clear ( ( MIMEParser * ) parser ) ; }
0
387,997
xmlDictCreate(void) { xmlDictPtr dict; if (!xmlDictInitialized) if (!__xmlInitializeDict()) return(NULL); #ifdef DICT_DEBUG_PATTERNS fprintf(stderr, "C"); #endif dict = xmlMalloc(sizeof(xmlDict)); if (dict) { dict->ref_counter = 1; dict->limit = 0; dict->size = MIN_DICT_SIZE; dict->nbElems = 0; dict->dict = xmlMalloc(MIN_DICT_SIZE * sizeof(xmlDictEntry)); dict->strings = NULL; dict->subdict = NULL; if (dict->dict) { memset(dict->dict, 0, MIN_DICT_SIZE * sizeof(xmlDictEntry)); #ifdef DICT_RANDOMIZATION dict->seed = __xmlRandom(); #else dict->seed = 0; #endif return(dict); } xmlFree(dict); } return(NULL); }
0
128,110
IMAP_DATA* imap_conn_find (const ACCOUNT* account, int flags) { CONNECTION* conn = NULL; ACCOUNT* creds = NULL; IMAP_DATA* idata = NULL; int new = 0; while ((conn = mutt_conn_find (conn, account))) { if (!creds) creds = &conn->account; else memcpy (&conn->account, creds, sizeof (ACCOUNT)); idata = (IMAP_DATA*)conn->data; if (flags & MUTT_IMAP_CONN_NONEW) { if (!idata) { /* This should only happen if we've come to the end of the list */ mutt_socket_free (conn); return NULL; } else if (idata->state < IMAP_AUTHENTICATED) continue; } if (flags & MUTT_IMAP_CONN_NOSELECT && idata && idata->state >= IMAP_SELECTED) continue; if (idata && idata->status == IMAP_FATAL) continue; break; } if (!conn) return NULL; /* this happens when the initial connection fails */ /* The current connection is a new connection */ if (!idata) { idata = imap_new_idata (); conn->data = idata; idata->conn = conn; new = 1; } if (idata->state == IMAP_DISCONNECTED) imap_open_connection (idata); if (idata->state == IMAP_CONNECTED) { if (!imap_authenticate (idata)) { idata->state = IMAP_AUTHENTICATED; FREE (&idata->capstr); new = 1; if (idata->conn->ssf) dprint (2, (debugfile, "Communication encrypted at %d bits\n", idata->conn->ssf)); } else mutt_account_unsetpass (&idata->conn->account); } if (new && idata->state == IMAP_AUTHENTICATED) { /* capabilities may have changed */ imap_exec (idata, "CAPABILITY", IMAP_CMD_FAIL_OK); #if defined(USE_ZLIB) /* RFC 4978 */ if (mutt_bit_isset (idata->capabilities, COMPRESS_DEFLATE)) { if (option (OPTIMAPDEFLATE) && imap_exec (idata, "COMPRESS DEFLATE", IMAP_CMD_FAIL_OK) == 0) mutt_zstrm_wrap_conn (idata->conn); } #endif /* enable RFC6855, if the server supports that */ if (mutt_bit_isset (idata->capabilities, ENABLE)) imap_exec (idata, "ENABLE UTF8=ACCEPT", IMAP_CMD_QUEUE); /* enable QRESYNC. Advertising QRESYNC also means CONDSTORE * is supported (even if not advertised), so flip that bit. */ if (mutt_bit_isset (idata->capabilities, QRESYNC)) { mutt_bit_set (idata->capabilities, CONDSTORE); if (option (OPTIMAPQRESYNC)) imap_exec (idata, "ENABLE QRESYNC", IMAP_CMD_QUEUE); } /* get root delimiter, '/' as default */ idata->delim = '/'; imap_exec (idata, "LIST \"\" \"\"", IMAP_CMD_QUEUE); if (option (OPTIMAPCHECKSUBSCRIBED)) imap_exec (idata, "LSUB \"\" \"*\"", IMAP_CMD_QUEUE); /* we may need the root delimiter before we open a mailbox */ imap_exec (idata, NULL, IMAP_CMD_FAIL_OK); } if (idata->state < IMAP_AUTHENTICATED) return NULL; return idata; }
0
523,558
void SELECT_LEX::mark_const_derived(bool empty) { TABLE_LIST *derived= master_unit()->derived; /* join == NULL in DELETE ... RETURNING */ if (!(join && join->thd->lex->describe) && derived) { if (!empty) increase_derived_records(1); if (!master_unit()->is_unit_op() && !derived->is_merged_derived() && !(join && join->with_two_phase_optimization)) derived->fill_me= TRUE; } }
0
100,943
static void gluster_cache_refresh(glfs_t *fs, const char *cfgstring) { struct gluster_cacheconn **entry; char** config; size_t i = 0; size_t j = 0; if (!fs) return; darray_foreach(entry, cache) { if ((*entry)->fs == fs) { if (cfgstring) { darray_foreach(config, (*entry)->cfgstring) { if (!strcmp(*config, cfgstring)) { free(*config); darray_remove((*entry)->cfgstring, j); break; } j++; } } if (darray_size((*entry)->cfgstring)) return; free((*entry)->volname); glfs_fini((*entry)->fs); (*entry)->fs = NULL; gluster_free_host((*entry)->server); free((*entry)->server); (*entry)->server = NULL; free((*entry)); darray_remove(cache, i); return; } else { i++; } } }
0
500,670
static int cfg_print_pff_indent(cfg_t *cfg, FILE *fp, cfg_print_filter_func_t fb_pff, int indent) { int i, result = CFG_SUCCESS; for (i = 0; cfg->opts[i].name; i++) { cfg_print_filter_func_t pff = cfg->pff ? cfg->pff : fb_pff; if (pff && pff(cfg, &cfg->opts[i])) continue; result += cfg_opt_print_pff_indent(&cfg->opts[i], fp, pff, indent); } return result; }
0
89,702
qemuProcessHandleNicRxFilterChanged(qemuMonitorPtr mon G_GNUC_UNUSED, virDomainObjPtr vm, const char *devAlias, void *opaque) { virQEMUDriverPtr driver = opaque; struct qemuProcessEvent *processEvent = NULL; char *data; virObjectLock(vm); VIR_DEBUG("Device %s RX Filter changed in domain %p %s", devAlias, vm, vm->def->name); processEvent = g_new0(struct qemuProcessEvent, 1); processEvent->eventType = QEMU_PROCESS_EVENT_NIC_RX_FILTER_CHANGED; data = g_strdup(devAlias); processEvent->data = data; processEvent->vm = virObjectRef(vm); if (virThreadPoolSendJob(driver->workerPool, 0, processEvent) < 0) { virObjectUnref(vm); goto error; } cleanup: virObjectUnlock(vm); return 0; error: qemuProcessEventFree(processEvent); goto cleanup; }
0
331,896
static int assigned_device_pci_cap_init(PCIDevice *pci_dev, Error **errp) { AssignedDevice *dev = PCI_ASSIGN(pci_dev); PCIRegion *pci_region = dev->real_device.regions; int ret, pos; /* Clear initial capabilities pointer and status copied from hw */ pci_set_byte(pci_dev->config + PCI_CAPABILITY_LIST, 0); pci_set_word(pci_dev->config + PCI_STATUS, pci_get_word(pci_dev->config + PCI_STATUS) & ~PCI_STATUS_CAP_LIST); /* Expose MSI capability * MSI capability is the 1st capability in capability config */ pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_MSI, 0); if (pos != 0 && kvm_check_extension(kvm_state, KVM_CAP_ASSIGN_DEV_IRQ)) { if (verify_irqchip_in_kernel(errp) < 0) { return -ENOTSUP; } dev->dev.cap_present |= QEMU_PCI_CAP_MSI; dev->cap.available |= ASSIGNED_DEVICE_CAP_MSI; /* Only 32-bit/no-mask currently supported */ ret = pci_add_capability(pci_dev, PCI_CAP_ID_MSI, pos, 10, errp); if (ret < 0) { return ret; } pci_dev->msi_cap = pos; pci_set_word(pci_dev->config + pos + PCI_MSI_FLAGS, pci_get_word(pci_dev->config + pos + PCI_MSI_FLAGS) & PCI_MSI_FLAGS_QMASK); pci_set_long(pci_dev->config + pos + PCI_MSI_ADDRESS_LO, 0); pci_set_word(pci_dev->config + pos + PCI_MSI_DATA_32, 0); /* Set writable fields */ pci_set_word(pci_dev->wmask + pos + PCI_MSI_FLAGS, PCI_MSI_FLAGS_QSIZE | PCI_MSI_FLAGS_ENABLE); pci_set_long(pci_dev->wmask + pos + PCI_MSI_ADDRESS_LO, 0xfffffffc); pci_set_word(pci_dev->wmask + pos + PCI_MSI_DATA_32, 0xffff); } /* Expose MSI-X capability */ pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_MSIX, 0); if (pos != 0 && kvm_device_msix_supported(kvm_state)) { int bar_nr; uint32_t msix_table_entry; uint16_t msix_max; if (verify_irqchip_in_kernel(errp) < 0) { return -ENOTSUP; } dev->dev.cap_present |= QEMU_PCI_CAP_MSIX; dev->cap.available |= ASSIGNED_DEVICE_CAP_MSIX; ret = pci_add_capability(pci_dev, PCI_CAP_ID_MSIX, pos, 12, errp); if (ret < 0) { return ret; } pci_dev->msix_cap = pos; msix_max = (pci_get_word(pci_dev->config + pos + PCI_MSIX_FLAGS) & PCI_MSIX_FLAGS_QSIZE) + 1; msix_max = MIN(msix_max, KVM_MAX_MSIX_PER_DEV); pci_set_word(pci_dev->config + pos + PCI_MSIX_FLAGS, msix_max - 1); /* Only enable and function mask bits are writable */ pci_set_word(pci_dev->wmask + pos + PCI_MSIX_FLAGS, PCI_MSIX_FLAGS_ENABLE | PCI_MSIX_FLAGS_MASKALL); msix_table_entry = pci_get_long(pci_dev->config + pos + PCI_MSIX_TABLE); bar_nr = msix_table_entry & PCI_MSIX_FLAGS_BIRMASK; msix_table_entry &= ~PCI_MSIX_FLAGS_BIRMASK; dev->msix_table_addr = pci_region[bar_nr].base_addr + msix_table_entry; dev->msix_table_size = msix_max * sizeof(MSIXTableEntry); dev->msix_max = msix_max; } /* Minimal PM support, nothing writable, device appears to NAK changes */ pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_PM, 0); if (pos) { uint16_t pmc; ret = pci_add_capability(pci_dev, PCI_CAP_ID_PM, pos, PCI_PM_SIZEOF, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, PCI_PM_SIZEOF); pmc = pci_get_word(pci_dev->config + pos + PCI_CAP_FLAGS); pmc &= (PCI_PM_CAP_VER_MASK | PCI_PM_CAP_DSI); pci_set_word(pci_dev->config + pos + PCI_CAP_FLAGS, pmc); /* assign_device will bring the device up to D0, so we don't need * to worry about doing that ourselves here. */ pci_set_word(pci_dev->config + pos + PCI_PM_CTRL, PCI_PM_CTRL_NO_SOFT_RESET); pci_set_byte(pci_dev->config + pos + PCI_PM_PPB_EXTENSIONS, 0); pci_set_byte(pci_dev->config + pos + PCI_PM_DATA_REGISTER, 0); } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_EXP, 0); if (pos) { uint8_t version, size = 0; uint16_t type, devctl, lnksta; uint32_t devcap, lnkcap; version = pci_get_byte(pci_dev->config + pos + PCI_EXP_FLAGS); version &= PCI_EXP_FLAGS_VERS; if (version == 1) { size = 0x14; } else if (version == 2) { /* * Check for non-std size, accept reduced size to 0x34, * which is what bcm5761 implemented, violating the * PCIe v3.0 spec that regs should exist and be read as 0, * not optionally provided and shorten the struct size. */ size = MIN(0x3c, PCI_CONFIG_SPACE_SIZE - pos); if (size < 0x34) { error_setg(errp, "Invalid size PCIe cap-id 0x%x", PCI_CAP_ID_EXP); return -EINVAL; } else if (size != 0x3c) { error_report("WARNING, %s: PCIe cap-id 0x%x has " "non-standard size 0x%x; std size should be 0x3c", __func__, PCI_CAP_ID_EXP, size); } } else if (version == 0) { uint16_t vid, did; vid = pci_get_word(pci_dev->config + PCI_VENDOR_ID); did = pci_get_word(pci_dev->config + PCI_DEVICE_ID); if (vid == PCI_VENDOR_ID_INTEL && did == 0x10ed) { /* * quirk for Intel 82599 VF with invalid PCIe capability * version, should really be version 2 (same as PF) */ size = 0x3c; } } if (size == 0) { error_setg(errp, "Unsupported PCI express capability version %d", version); return -EINVAL; } ret = pci_add_capability(pci_dev, PCI_CAP_ID_EXP, pos, size, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, size); type = pci_get_word(pci_dev->config + pos + PCI_EXP_FLAGS); type = (type & PCI_EXP_FLAGS_TYPE) >> 4; if (type != PCI_EXP_TYPE_ENDPOINT && type != PCI_EXP_TYPE_LEG_END && type != PCI_EXP_TYPE_RC_END) { error_setg(errp, "Device assignment only supports endpoint " "assignment, device type %d", type); return -EINVAL; } /* capabilities, pass existing read-only copy * PCI_EXP_FLAGS_IRQ: updated by hardware, should be direct read */ /* device capabilities: hide FLR */ devcap = pci_get_long(pci_dev->config + pos + PCI_EXP_DEVCAP); devcap &= ~PCI_EXP_DEVCAP_FLR; pci_set_long(pci_dev->config + pos + PCI_EXP_DEVCAP, devcap); /* device control: clear all error reporting enable bits, leaving * only a few host values. Note, these are * all writable, but not passed to hw. */ devctl = pci_get_word(pci_dev->config + pos + PCI_EXP_DEVCTL); devctl = (devctl & (PCI_EXP_DEVCTL_READRQ | PCI_EXP_DEVCTL_PAYLOAD)) | PCI_EXP_DEVCTL_RELAX_EN | PCI_EXP_DEVCTL_NOSNOOP_EN; pci_set_word(pci_dev->config + pos + PCI_EXP_DEVCTL, devctl); devctl = PCI_EXP_DEVCTL_BCR_FLR | PCI_EXP_DEVCTL_AUX_PME; pci_set_word(pci_dev->wmask + pos + PCI_EXP_DEVCTL, ~devctl); /* Clear device status */ pci_set_word(pci_dev->config + pos + PCI_EXP_DEVSTA, 0); /* Link capabilities, expose links and latencues, clear reporting */ lnkcap = pci_get_long(pci_dev->config + pos + PCI_EXP_LNKCAP); lnkcap &= (PCI_EXP_LNKCAP_SLS | PCI_EXP_LNKCAP_MLW | PCI_EXP_LNKCAP_ASPMS | PCI_EXP_LNKCAP_L0SEL | PCI_EXP_LNKCAP_L1EL); pci_set_long(pci_dev->config + pos + PCI_EXP_LNKCAP, lnkcap); /* Link control, pass existing read-only copy. Should be writable? */ /* Link status, only expose current speed and width */ lnksta = pci_get_word(pci_dev->config + pos + PCI_EXP_LNKSTA); lnksta &= (PCI_EXP_LNKSTA_CLS | PCI_EXP_LNKSTA_NLW); pci_set_word(pci_dev->config + pos + PCI_EXP_LNKSTA, lnksta); if (version >= 2) { /* Slot capabilities, control, status - not needed for endpoints */ pci_set_long(pci_dev->config + pos + PCI_EXP_SLTCAP, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_SLTCTL, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_SLTSTA, 0); /* Root control, capabilities, status - not needed for endpoints */ pci_set_word(pci_dev->config + pos + PCI_EXP_RTCTL, 0); pci_set_word(pci_dev->config + pos + PCI_EXP_RTCAP, 0); pci_set_long(pci_dev->config + pos + PCI_EXP_RTSTA, 0); /* Device capabilities/control 2, pass existing read-only copy */ /* Link control 2, pass existing read-only copy */ } } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_PCIX, 0); if (pos) { uint16_t cmd; uint32_t status; /* Only expose the minimum, 8 byte capability */ ret = pci_add_capability(pci_dev, PCI_CAP_ID_PCIX, pos, 8, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, 8); /* Command register, clear upper bits, including extended modes */ cmd = pci_get_word(pci_dev->config + pos + PCI_X_CMD); cmd &= (PCI_X_CMD_DPERR_E | PCI_X_CMD_ERO | PCI_X_CMD_MAX_READ | PCI_X_CMD_MAX_SPLIT); pci_set_word(pci_dev->config + pos + PCI_X_CMD, cmd); /* Status register, update with emulated PCI bus location, clear * error bits, leave the rest. */ status = pci_get_long(pci_dev->config + pos + PCI_X_STATUS); status &= ~(PCI_X_STATUS_BUS | PCI_X_STATUS_DEVFN); status |= pci_get_bdf(pci_dev); status &= ~(PCI_X_STATUS_SPL_DISC | PCI_X_STATUS_UNX_SPL | PCI_X_STATUS_SPL_ERR); pci_set_long(pci_dev->config + pos + PCI_X_STATUS, status); } pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_VPD, 0); if (pos) { /* Direct R/W passthrough */ ret = pci_add_capability(pci_dev, PCI_CAP_ID_VPD, pos, 8, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, 8); /* direct write for cap content */ assigned_dev_direct_config_write(dev, pos + 2, 6); } /* Devices can have multiple vendor capabilities, get them all */ for (pos = 0; (pos = pci_find_cap_offset(pci_dev, PCI_CAP_ID_VNDR, pos)); pos += PCI_CAP_LIST_NEXT) { uint8_t len = pci_get_byte(pci_dev->config + pos + PCI_CAP_FLAGS); /* Direct R/W passthrough */ ret = pci_add_capability(pci_dev, PCI_CAP_ID_VNDR, pos, len, errp); if (ret < 0) { return ret; } assigned_dev_setup_cap_read(dev, pos, len); /* direct write for cap content */ assigned_dev_direct_config_write(dev, pos + 2, len - 2); } /* If real and virtual capability list status bits differ, virtualize the * access. */ if ((pci_get_word(pci_dev->config + PCI_STATUS) & PCI_STATUS_CAP_LIST) != (assigned_dev_pci_read_byte(pci_dev, PCI_STATUS) & PCI_STATUS_CAP_LIST)) { dev->emulate_config_read[PCI_STATUS] |= PCI_STATUS_CAP_LIST; } return 0; }
0
240,405
void OnIceCandidateImpl(const std::string& sdp, const std::string& sdp_mid, int sdp_mline_index, int component, int address_family) { DCHECK(main_thread_->BelongsToCurrentThread()); if (handler_) { handler_->OnIceCandidate(sdp, sdp_mid, sdp_mline_index, component, address_family); } }
0
161,866
gboolean mono_verifier_is_enabled_for_class (MonoClass *klass) { return verify_all || (verifier_mode > MONO_VERIFIER_MODE_OFF && !klass->image->assembly->in_gac && klass->image != mono_defaults.corlib);
0
105,689
XML_SetBase(XML_Parser parser, const XML_Char *p) { if (parser == NULL) return XML_STATUS_ERROR; if (p) { p = poolCopyString(&parser->m_dtd->pool, p); if (! p) return XML_STATUS_ERROR; parser->m_curBase = p; } else parser->m_curBase = NULL; return XML_STATUS_OK; }
0