code
stringlengths 32
241k
| label
int64 0
1
|
|---|---|
void prplcb_conv_del_users ( PurpleConversation * conv , GList * cbuddies ) {
struct groupchat * gc = conv -> ui_data ;
GList * b ;
for ( b = cbuddies ;
b ;
b = b -> next ) {
imcb_chat_remove_buddy ( gc , b -> data , "" ) ;
}
}
| 0
|
int rand_neg ( void ) {
static unsigned int neg = 0 ;
static int sign [ 8 ] = {
0 , 0 , 0 , 1 , 1 , 0 , 1 , 1 }
;
return ( sign [ ( neg ++ ) % 8 ] ) ;
}
| 0
|
static void activate_desktop_file ( ActivateParameters * parameters , NautilusFile * file ) {
ActivateParametersDesktop * parameters_desktop ;
char * primary , * secondary , * display_name ;
GtkWidget * dialog ;
GdkScreen * screen ;
char * uri ;
screen = gtk_widget_get_screen ( GTK_WIDGET ( parameters -> parent_window ) ) ;
if ( ! nautilus_file_is_trusted_link ( file ) ) {
parameters_desktop = g_new0 ( ActivateParametersDesktop , 1 ) ;
if ( parameters -> parent_window ) {
parameters_desktop -> parent_window = parameters -> parent_window ;
g_object_add_weak_pointer ( G_OBJECT ( parameters_desktop -> parent_window ) , ( gpointer * ) & parameters_desktop -> parent_window ) ;
}
parameters_desktop -> file = nautilus_file_ref ( file ) ;
primary = _ ( "Untrusted application launcher" ) ;
display_name = nautilus_file_get_display_name ( file ) ;
secondary = g_strdup_printf ( _ ( "The application launcher “%s” has not been marked as trusted. " "If you do not know the source of this file, launching it may be unsafe." ) , display_name ) ;
dialog = gtk_message_dialog_new ( parameters -> parent_window , 0 , GTK_MESSAGE_WARNING , GTK_BUTTONS_NONE , NULL ) ;
g_object_set ( dialog , "text" , primary , "secondary-text" , secondary , NULL ) ;
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( "_Launch Anyway" ) , RESPONSE_RUN ) ;
if ( nautilus_file_can_set_permissions ( file ) ) {
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( "Mark as _Trusted" ) , RESPONSE_MARK_TRUSTED ) ;
}
gtk_dialog_add_button ( GTK_DIALOG ( dialog ) , _ ( "_Cancel" ) , GTK_RESPONSE_CANCEL ) ;
gtk_dialog_set_default_response ( GTK_DIALOG ( dialog ) , GTK_RESPONSE_CANCEL ) ;
g_signal_connect ( dialog , "response" , G_CALLBACK ( untrusted_launcher_response_callback ) , parameters_desktop ) ;
gtk_widget_show ( dialog ) ;
g_free ( display_name ) ;
g_free ( secondary ) ;
return ;
}
uri = nautilus_file_get_uri ( file ) ;
DEBUG ( "Launching trusted launcher %s" , uri ) ;
nautilus_launch_desktop_file ( screen , uri , NULL , parameters -> parent_window ) ;
g_free ( uri ) ;
}
| 1
|
int jpc_pi_init ( jpc_pi_t * pi ) {
int compno ;
int rlvlno ;
int prcno ;
jpc_picomp_t * picomp ;
jpc_pirlvl_t * pirlvl ;
int * prclyrno ;
pi -> prgvolfirst = 0 ;
pi -> valid = 0 ;
pi -> pktno = - 1 ;
pi -> pchgno = - 1 ;
pi -> pchg = 0 ;
for ( compno = 0 , picomp = pi -> picomps ;
compno < pi -> numcomps ;
++ compno , ++ picomp ) {
for ( rlvlno = 0 , pirlvl = picomp -> pirlvls ;
rlvlno < picomp -> numrlvls ;
++ rlvlno , ++ pirlvl ) {
for ( prcno = 0 , prclyrno = pirlvl -> prclyrnos ;
prcno < pirlvl -> numprcs ;
++ prcno , ++ prclyrno ) {
* prclyrno = 0 ;
}
}
}
return 0 ;
}
| 0
|
static TX_SIZE read_selected_tx_size ( VP9_COMMON * cm , MACROBLOCKD * xd , TX_SIZE max_tx_size , vp9_reader * r ) {
const int ctx = vp9_get_tx_size_context ( xd ) ;
const vp9_prob * tx_probs = get_tx_probs ( max_tx_size , ctx , & cm -> fc . tx_probs ) ;
int tx_size = vp9_read ( r , tx_probs [ 0 ] ) ;
if ( tx_size != TX_4X4 && max_tx_size >= TX_16X16 ) {
tx_size += vp9_read ( r , tx_probs [ 1 ] ) ;
if ( tx_size != TX_8X8 && max_tx_size >= TX_32X32 ) tx_size += vp9_read ( r , tx_probs [ 2 ] ) ;
}
if ( ! cm -> frame_parallel_decoding_mode ) ++ get_tx_counts ( max_tx_size , ctx , & cm -> counts . tx ) [ tx_size ] ;
return ( TX_SIZE ) tx_size ;
}
| 0
|
static void setup_frame_size_with_refs ( VP9_COMMON * cm , struct vp9_read_bit_buffer * rb ) {
int width , height ;
int found = 0 , i ;
for ( i = 0 ;
i < REFS_PER_FRAME ;
++ i ) {
if ( vp9_rb_read_bit ( rb ) ) {
YV12_BUFFER_CONFIG * const buf = cm -> frame_refs [ i ] . buf ;
width = buf -> y_crop_width ;
height = buf -> y_crop_height ;
found = 1 ;
break ;
}
}
if ( ! found ) vp9_read_frame_size ( rb , & width , & height ) ;
for ( i = 0 ;
i < REFS_PER_FRAME ;
++ i ) {
RefBuffer * const ref_frame = & cm -> frame_refs [ i ] ;
const int ref_width = ref_frame -> buf -> y_width ;
const int ref_height = ref_frame -> buf -> y_height ;
if ( ! valid_ref_frame_size ( ref_width , ref_height , width , height ) ) vpx_internal_error ( & cm -> error , VPX_CODEC_CORRUPT_FRAME , "Referenced frame has invalid size" ) ;
}
apply_frame_size ( cm , width , height ) ;
setup_display_size ( cm , rb ) ;
}
| 0
|
void TSContDataSet ( TSCont contp , void * data ) {
sdk_assert ( sdk_sanity_check_iocore_structure ( contp ) == TS_SUCCESS ) ;
INKContInternal * i = ( INKContInternal * ) contp ;
i -> mdata = data ;
}
| 0
|
proto_item * proto_tree_add_string_format ( proto_tree * tree , int hfindex , tvbuff_t * tvb , gint start , gint length , const char * value , const char * format , ... ) {
proto_item * pi ;
va_list ap ;
pi = proto_tree_add_string ( tree , hfindex , tvb , start , length , value ) ;
if ( pi != tree ) {
TRY_TO_FAKE_THIS_REPR ( pi ) ;
va_start ( ap , format ) ;
proto_tree_set_representation ( pi , format , ap ) ;
va_end ( ap ) ;
}
return pi ;
}
| 0
|
jas_image_fmtinfo_t * jas_image_lookupfmtbyname ( const char * name ) {
int i ;
jas_image_fmtinfo_t * fmtinfo ;
for ( i = 0 , fmtinfo = jas_image_fmtinfos ;
i < jas_image_numfmts ;
++ i , ++ fmtinfo ) {
if ( ! strcmp ( fmtinfo -> name , name ) ) {
return fmtinfo ;
}
}
return 0 ;
}
| 0
|
int ff_generate_sliding_window_mmcos ( H264Context * h , int first_slice ) {
MMCO mmco_temp [ MAX_MMCO_COUNT ] , * mmco = first_slice ? h -> mmco : mmco_temp ;
int mmco_index = 0 , i ;
assert ( h -> long_ref_count + h -> short_ref_count <= h -> sps . ref_frame_count ) ;
if ( h -> short_ref_count && h -> long_ref_count + h -> short_ref_count == h -> sps . ref_frame_count && ! ( FIELD_PICTURE && ! h -> first_field && h -> cur_pic_ptr -> f . reference ) ) {
mmco [ 0 ] . opcode = MMCO_SHORT2UNUSED ;
mmco [ 0 ] . short_pic_num = h -> short_ref [ h -> short_ref_count - 1 ] -> frame_num ;
mmco_index = 1 ;
if ( FIELD_PICTURE ) {
mmco [ 0 ] . short_pic_num *= 2 ;
mmco [ 1 ] . opcode = MMCO_SHORT2UNUSED ;
mmco [ 1 ] . short_pic_num = mmco [ 0 ] . short_pic_num + 1 ;
mmco_index = 2 ;
}
}
if ( first_slice ) {
h -> mmco_index = mmco_index ;
}
else if ( ! first_slice && mmco_index >= 0 && ( mmco_index != h -> mmco_index || ( i = check_opcodes ( h -> mmco , mmco_temp , mmco_index ) ) ) ) {
av_log ( h -> avctx , AV_LOG_ERROR , "Inconsistent MMCO state between slices [%d, %d, %d]\n" , mmco_index , h -> mmco_index , i ) ;
return AVERROR_INVALIDDATA ;
}
return 0 ;
}
| 1
|
static int vvalue_tvb_blob ( tvbuff_t * tvb , int offset , void * val ) {
struct data_blob * blob = ( struct data_blob * ) val ;
guint32 len = tvb_get_letohl ( tvb , offset ) ;
blob -> size = len ;
blob -> data = ( guint8 * ) tvb_memdup ( wmem_packet_scope ( ) , tvb , offset + 4 , len ) ;
return 4 + len ;
}
| 0
|
const EVP_CIPHER * EVP_aes_ ## keylen ## _ ## mode ( void ) \ {
return & aes_ ## keylen ## _ ## mode ;
}
# endif # if defined ( OPENSSL_CPUID_OBJ ) && ( defined ( __arm__ ) || defined ( __arm ) || defined ( __aarch64__ ) ) # include "arm_arch.h" # if __ARM_MAX_ARCH__ >= 7 # if defined ( BSAES_ASM ) # define BSAES_CAPABLE ( OPENSSL_armcap_P & ARMV7_NEON ) # endif # if defined ( VPAES_ASM ) # define VPAES_CAPABLE ( OPENSSL_armcap_P & ARMV7_NEON ) # endif # define HWAES_CAPABLE ( OPENSSL_armcap_P & ARMV8_AES ) # define HWAES_set_encrypt_key aes_v8_set_encrypt_key # define HWAES_set_decrypt_key aes_v8_set_decrypt_key # define HWAES_encrypt aes_v8_encrypt # define HWAES_decrypt aes_v8_decrypt # define HWAES_cbc_encrypt aes_v8_cbc_encrypt # define HWAES_ctr32_encrypt_blocks aes_v8_ctr32_encrypt_blocks # endif # endif # if defined ( HWAES_CAPABLE ) int HWAES_set_encrypt_key ( const unsigned char * userKey , const int bits , AES_KEY * key ) ;
int HWAES_set_decrypt_key ( const unsigned char * userKey , const int bits , AES_KEY * key ) ;
void HWAES_encrypt ( const unsigned char * in , unsigned char * out , const AES_KEY * key ) ;
void HWAES_decrypt ( const unsigned char * in , unsigned char * out , const AES_KEY * key ) ;
void HWAES_cbc_encrypt ( const unsigned char * in , unsigned char * out , size_t length , const AES_KEY * key , unsigned char * ivec , const int enc ) ;
void HWAES_ctr32_encrypt_blocks ( const unsigned char * in , unsigned char * out , size_t len , const AES_KEY * key , const unsigned char ivec [ 16 ] ) ;
void HWAES_xts_encrypt ( const unsigned char * inp , unsigned char * out , size_t len , const AES_KEY * key1 , const AES_KEY * key2 , const unsigned char iv [ 16 ] ) ;
void HWAES_xts_decrypt ( const unsigned char * inp , unsigned char * out , size_t len , const AES_KEY * key1 , const AES_KEY * key2 , const unsigned char iv [ 16 ] ) ;
# endif # define BLOCK_CIPHER_generic_pack ( nid , keylen , flags ) \ BLOCK_CIPHER_generic ( nid , keylen , 16 , 16 , cbc , cbc , CBC , flags | EVP_CIPH_FLAG_DEFAULT_ASN1 ) \ BLOCK_CIPHER_generic ( nid , keylen , 16 , 0 , ecb , ecb , ECB , flags | EVP_CIPH_FLAG_DEFAULT_ASN1 ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , ofb128 , ofb , OFB , flags | EVP_CIPH_FLAG_DEFAULT_ASN1 ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , cfb128 , cfb , CFB , flags | EVP_CIPH_FLAG_DEFAULT_ASN1 ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , cfb1 , cfb1 , CFB , flags ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , cfb8 , cfb8 , CFB , flags ) \ BLOCK_CIPHER_generic ( nid , keylen , 1 , 16 , ctr , ctr , CTR , flags ) static int aes_init_key ( EVP_CIPHER_CTX * ctx , const unsigned char * key , const unsigned char * iv , int enc ) {
int ret , mode ;
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
mode = EVP_CIPHER_CTX_mode ( ctx ) ;
if ( ( mode == EVP_CIPH_ECB_MODE || mode == EVP_CIPH_CBC_MODE ) && ! enc ) {
# ifdef HWAES_CAPABLE if ( HWAES_CAPABLE ) {
ret = HWAES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) HWAES_decrypt ;
dat -> stream . cbc = NULL ;
# ifdef HWAES_cbc_encrypt if ( mode == EVP_CIPH_CBC_MODE ) dat -> stream . cbc = ( cbc128_f ) HWAES_cbc_encrypt ;
# endif }
else # endif # ifdef BSAES_CAPABLE if ( BSAES_CAPABLE && mode == EVP_CIPH_CBC_MODE ) {
ret = AES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) AES_decrypt ;
dat -> stream . cbc = ( cbc128_f ) bsaes_cbc_encrypt ;
}
else # endif # ifdef VPAES_CAPABLE if ( VPAES_CAPABLE ) {
ret = vpaes_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) vpaes_decrypt ;
dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) vpaes_cbc_encrypt : NULL ;
}
else # endif {
ret = AES_set_decrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) AES_decrypt ;
dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) AES_cbc_encrypt : NULL ;
}
}
else # ifdef HWAES_CAPABLE if ( HWAES_CAPABLE ) {
ret = HWAES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) HWAES_encrypt ;
dat -> stream . cbc = NULL ;
# ifdef HWAES_cbc_encrypt if ( mode == EVP_CIPH_CBC_MODE ) dat -> stream . cbc = ( cbc128_f ) HWAES_cbc_encrypt ;
else # endif # ifdef HWAES_ctr32_encrypt_blocks if ( mode == EVP_CIPH_CTR_MODE ) dat -> stream . ctr = ( ctr128_f ) HWAES_ctr32_encrypt_blocks ;
else # endif ( void ) 0 ;
}
else # endif # ifdef BSAES_CAPABLE if ( BSAES_CAPABLE && mode == EVP_CIPH_CTR_MODE ) {
ret = AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) AES_encrypt ;
dat -> stream . ctr = ( ctr128_f ) bsaes_ctr32_encrypt_blocks ;
}
else # endif # ifdef VPAES_CAPABLE if ( VPAES_CAPABLE ) {
ret = vpaes_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) vpaes_encrypt ;
dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) vpaes_cbc_encrypt : NULL ;
}
else # endif {
ret = AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & dat -> ks . ks ) ;
dat -> block = ( block128_f ) AES_encrypt ;
dat -> stream . cbc = mode == EVP_CIPH_CBC_MODE ? ( cbc128_f ) AES_cbc_encrypt : NULL ;
# ifdef AES_CTR_ASM if ( mode == EVP_CIPH_CTR_MODE ) dat -> stream . ctr = ( ctr128_f ) AES_ctr32_encrypt ;
# endif }
if ( ret < 0 ) {
EVPerr ( EVP_F_AES_INIT_KEY , EVP_R_AES_KEY_SETUP_FAILED ) ;
return 0 ;
}
return 1 ;
}
static int aes_cbc_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
if ( dat -> stream . cbc ) ( * dat -> stream . cbc ) ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , EVP_CIPHER_CTX_encrypting ( ctx ) ) ;
else if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) CRYPTO_cbc128_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , dat -> block ) ;
else CRYPTO_cbc128_decrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , dat -> block ) ;
return 1 ;
}
static int aes_ecb_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
size_t bl = EVP_CIPHER_CTX_block_size ( ctx ) ;
size_t i ;
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
if ( len < bl ) return 1 ;
for ( i = 0 , len -= bl ;
i <= len ;
i += bl ) ( * dat -> block ) ( in + i , out + i , & dat -> ks ) ;
return 1 ;
}
static int aes_ofb_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
int num = EVP_CIPHER_CTX_num ( ctx ) ;
CRYPTO_ofb128_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , dat -> block ) ;
EVP_CIPHER_CTX_set_num ( ctx , num ) ;
return 1 ;
}
static int aes_cfb_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
int num = EVP_CIPHER_CTX_num ( ctx ) ;
CRYPTO_cfb128_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ;
EVP_CIPHER_CTX_set_num ( ctx , num ) ;
return 1 ;
}
static int aes_cfb8_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
int num = EVP_CIPHER_CTX_num ( ctx ) ;
CRYPTO_cfb128_8_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ;
EVP_CIPHER_CTX_set_num ( ctx , num ) ;
return 1 ;
}
static int aes_cfb1_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
if ( EVP_CIPHER_CTX_test_flags ( ctx , EVP_CIPH_FLAG_LENGTH_BITS ) ) {
int num = EVP_CIPHER_CTX_num ( ctx ) ;
CRYPTO_cfb128_1_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ;
EVP_CIPHER_CTX_set_num ( ctx , num ) ;
return 1 ;
}
while ( len >= MAXBITCHUNK ) {
int num = EVP_CIPHER_CTX_num ( ctx ) ;
CRYPTO_cfb128_1_encrypt ( in , out , MAXBITCHUNK * 8 , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ;
EVP_CIPHER_CTX_set_num ( ctx , num ) ;
len -= MAXBITCHUNK ;
}
if ( len ) {
int num = EVP_CIPHER_CTX_num ( ctx ) ;
CRYPTO_cfb128_1_encrypt ( in , out , len * 8 , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , & num , EVP_CIPHER_CTX_encrypting ( ctx ) , dat -> block ) ;
EVP_CIPHER_CTX_set_num ( ctx , num ) ;
}
return 1 ;
}
static int aes_ctr_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
unsigned int num = EVP_CIPHER_CTX_num ( ctx ) ;
EVP_AES_KEY * dat = EVP_C_DATA ( EVP_AES_KEY , ctx ) ;
if ( dat -> stream . ctr ) CRYPTO_ctr128_encrypt_ctr32 ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , EVP_CIPHER_CTX_buf_noconst ( ctx ) , & num , dat -> stream . ctr ) ;
else CRYPTO_ctr128_encrypt ( in , out , len , & dat -> ks , EVP_CIPHER_CTX_iv_noconst ( ctx ) , EVP_CIPHER_CTX_buf_noconst ( ctx ) , & num , dat -> block ) ;
EVP_CIPHER_CTX_set_num ( ctx , num ) ;
return 1 ;
}
BLOCK_CIPHER_generic_pack ( NID_aes , 128 , 0 ) BLOCK_CIPHER_generic_pack ( NID_aes , 192 , 0 ) BLOCK_CIPHER_generic_pack ( NID_aes , 256 , 0 ) static int aes_gcm_cleanup ( EVP_CIPHER_CTX * c ) {
EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , c ) ;
OPENSSL_cleanse ( & gctx -> gcm , sizeof ( gctx -> gcm ) ) ;
if ( gctx -> iv != EVP_CIPHER_CTX_iv_noconst ( c ) ) OPENSSL_free ( gctx -> iv ) ;
return 1 ;
}
static void ctr64_inc ( unsigned char * counter ) {
int n = 8 ;
unsigned char c ;
do {
-- n ;
c = counter [ n ] ;
++ c ;
counter [ n ] = c ;
if ( c ) return ;
}
while ( n ) ;
}
static int aes_gcm_ctrl ( EVP_CIPHER_CTX * c , int type , int arg , void * ptr ) {
EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , c ) ;
switch ( type ) {
case EVP_CTRL_INIT : gctx -> key_set = 0 ;
gctx -> iv_set = 0 ;
gctx -> ivlen = EVP_CIPHER_CTX_iv_length ( c ) ;
gctx -> iv = EVP_CIPHER_CTX_iv_noconst ( c ) ;
gctx -> taglen = - 1 ;
gctx -> iv_gen = 0 ;
gctx -> tls_aad_len = - 1 ;
return 1 ;
case EVP_CTRL_AEAD_SET_IVLEN : if ( arg <= 0 ) return 0 ;
if ( ( arg > EVP_MAX_IV_LENGTH ) && ( arg > gctx -> ivlen ) ) {
if ( gctx -> iv != EVP_CIPHER_CTX_iv_noconst ( c ) ) OPENSSL_free ( gctx -> iv ) ;
gctx -> iv = OPENSSL_malloc ( arg ) ;
if ( gctx -> iv == NULL ) return 0 ;
}
gctx -> ivlen = arg ;
return 1 ;
case EVP_CTRL_AEAD_SET_TAG : if ( arg <= 0 || arg > 16 || EVP_CIPHER_CTX_encrypting ( c ) ) return 0 ;
memcpy ( EVP_CIPHER_CTX_buf_noconst ( c ) , ptr , arg ) ;
gctx -> taglen = arg ;
return 1 ;
case EVP_CTRL_AEAD_GET_TAG : if ( arg <= 0 || arg > 16 || ! EVP_CIPHER_CTX_encrypting ( c ) || gctx -> taglen < 0 ) return 0 ;
memcpy ( ptr , EVP_CIPHER_CTX_buf_noconst ( c ) , arg ) ;
return 1 ;
case EVP_CTRL_GCM_SET_IV_FIXED : if ( arg == - 1 ) {
memcpy ( gctx -> iv , ptr , gctx -> ivlen ) ;
gctx -> iv_gen = 1 ;
return 1 ;
}
if ( ( arg < 4 ) || ( gctx -> ivlen - arg ) < 8 ) return 0 ;
if ( arg ) memcpy ( gctx -> iv , ptr , arg ) ;
if ( EVP_CIPHER_CTX_encrypting ( c ) && RAND_bytes ( gctx -> iv + arg , gctx -> ivlen - arg ) <= 0 ) return 0 ;
gctx -> iv_gen = 1 ;
return 1 ;
case EVP_CTRL_GCM_IV_GEN : if ( gctx -> iv_gen == 0 || gctx -> key_set == 0 ) return 0 ;
CRYPTO_gcm128_setiv ( & gctx -> gcm , gctx -> iv , gctx -> ivlen ) ;
if ( arg <= 0 || arg > gctx -> ivlen ) arg = gctx -> ivlen ;
memcpy ( ptr , gctx -> iv + gctx -> ivlen - arg , arg ) ;
ctr64_inc ( gctx -> iv + gctx -> ivlen - 8 ) ;
gctx -> iv_set = 1 ;
return 1 ;
case EVP_CTRL_GCM_SET_IV_INV : if ( gctx -> iv_gen == 0 || gctx -> key_set == 0 || EVP_CIPHER_CTX_encrypting ( c ) ) return 0 ;
memcpy ( gctx -> iv + gctx -> ivlen - arg , ptr , arg ) ;
CRYPTO_gcm128_setiv ( & gctx -> gcm , gctx -> iv , gctx -> ivlen ) ;
gctx -> iv_set = 1 ;
return 1 ;
case EVP_CTRL_AEAD_TLS1_AAD : if ( arg != EVP_AEAD_TLS1_AAD_LEN ) return 0 ;
memcpy ( EVP_CIPHER_CTX_buf_noconst ( c ) , ptr , arg ) ;
gctx -> tls_aad_len = arg ;
{
unsigned int len = EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 2 ] << 8 | EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 1 ] ;
len -= EVP_GCM_TLS_EXPLICIT_IV_LEN ;
if ( ! EVP_CIPHER_CTX_encrypting ( c ) ) len -= EVP_GCM_TLS_TAG_LEN ;
EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 2 ] = len >> 8 ;
EVP_CIPHER_CTX_buf_noconst ( c ) [ arg - 1 ] = len & 0xff ;
}
return EVP_GCM_TLS_TAG_LEN ;
case EVP_CTRL_COPY : {
EVP_CIPHER_CTX * out = ptr ;
EVP_AES_GCM_CTX * gctx_out = EVP_C_DATA ( EVP_AES_GCM_CTX , out ) ;
if ( gctx -> gcm . key ) {
if ( gctx -> gcm . key != & gctx -> ks ) return 0 ;
gctx_out -> gcm . key = & gctx_out -> ks ;
}
if ( gctx -> iv == EVP_CIPHER_CTX_iv_noconst ( c ) ) gctx_out -> iv = EVP_CIPHER_CTX_iv_noconst ( out ) ;
else {
gctx_out -> iv = OPENSSL_malloc ( gctx -> ivlen ) ;
if ( gctx_out -> iv == NULL ) return 0 ;
memcpy ( gctx_out -> iv , gctx -> iv , gctx -> ivlen ) ;
}
return 1 ;
}
default : return - 1 ;
}
}
static int aes_gcm_init_key ( EVP_CIPHER_CTX * ctx , const unsigned char * key , const unsigned char * iv , int enc ) {
EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , ctx ) ;
if ( ! iv && ! key ) return 1 ;
if ( key ) {
do {
# ifdef HWAES_CAPABLE if ( HWAES_CAPABLE ) {
HWAES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & gctx -> ks . ks ) ;
CRYPTO_gcm128_init ( & gctx -> gcm , & gctx -> ks , ( block128_f ) HWAES_encrypt ) ;
# ifdef HWAES_ctr32_encrypt_blocks gctx -> ctr = ( ctr128_f ) HWAES_ctr32_encrypt_blocks ;
# else gctx -> ctr = NULL ;
# endif break ;
}
else # endif # ifdef BSAES_CAPABLE if ( BSAES_CAPABLE ) {
AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & gctx -> ks . ks ) ;
CRYPTO_gcm128_init ( & gctx -> gcm , & gctx -> ks , ( block128_f ) AES_encrypt ) ;
gctx -> ctr = ( ctr128_f ) bsaes_ctr32_encrypt_blocks ;
break ;
}
else # endif # ifdef VPAES_CAPABLE if ( VPAES_CAPABLE ) {
vpaes_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & gctx -> ks . ks ) ;
CRYPTO_gcm128_init ( & gctx -> gcm , & gctx -> ks , ( block128_f ) vpaes_encrypt ) ;
gctx -> ctr = NULL ;
break ;
}
else # endif ( void ) 0 ;
AES_set_encrypt_key ( key , EVP_CIPHER_CTX_key_length ( ctx ) * 8 , & gctx -> ks . ks ) ;
CRYPTO_gcm128_init ( & gctx -> gcm , & gctx -> ks , ( block128_f ) AES_encrypt ) ;
# ifdef AES_CTR_ASM gctx -> ctr = ( ctr128_f ) AES_ctr32_encrypt ;
# else gctx -> ctr = NULL ;
# endif }
while ( 0 ) ;
if ( iv == NULL && gctx -> iv_set ) iv = gctx -> iv ;
if ( iv ) {
CRYPTO_gcm128_setiv ( & gctx -> gcm , iv , gctx -> ivlen ) ;
gctx -> iv_set = 1 ;
}
gctx -> key_set = 1 ;
}
else {
if ( gctx -> key_set ) CRYPTO_gcm128_setiv ( & gctx -> gcm , iv , gctx -> ivlen ) ;
else memcpy ( gctx -> iv , iv , gctx -> ivlen ) ;
gctx -> iv_set = 1 ;
gctx -> iv_gen = 0 ;
}
return 1 ;
}
static int aes_gcm_tls_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , ctx ) ;
int rv = - 1 ;
if ( out != in || len < ( EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN ) ) return - 1 ;
if ( EVP_CIPHER_CTX_ctrl ( ctx , EVP_CIPHER_CTX_encrypting ( ctx ) ? EVP_CTRL_GCM_IV_GEN : EVP_CTRL_GCM_SET_IV_INV , EVP_GCM_TLS_EXPLICIT_IV_LEN , out ) <= 0 ) goto err ;
if ( CRYPTO_gcm128_aad ( & gctx -> gcm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , gctx -> tls_aad_len ) ) goto err ;
in += EVP_GCM_TLS_EXPLICIT_IV_LEN ;
out += EVP_GCM_TLS_EXPLICIT_IV_LEN ;
len -= EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN ;
if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) {
if ( gctx -> ctr ) {
size_t bulk = 0 ;
# if defined ( AES_GCM_ASM ) if ( len >= 32 && AES_GCM_ASM ( gctx ) ) {
if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , NULL , NULL , 0 ) ) return - 1 ;
bulk = AES_gcm_encrypt ( in , out , len , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ;
gctx -> gcm . len . u [ 1 ] += bulk ;
}
# endif if ( CRYPTO_gcm128_encrypt_ctr32 ( & gctx -> gcm , in + bulk , out + bulk , len - bulk , gctx -> ctr ) ) goto err ;
}
else {
size_t bulk = 0 ;
# if defined ( AES_GCM_ASM2 ) if ( len >= 32 && AES_GCM_ASM2 ( gctx ) ) {
if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , NULL , NULL , 0 ) ) return - 1 ;
bulk = AES_gcm_encrypt ( in , out , len , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ;
gctx -> gcm . len . u [ 1 ] += bulk ;
}
# endif if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , in + bulk , out + bulk , len - bulk ) ) goto err ;
}
out += len ;
CRYPTO_gcm128_tag ( & gctx -> gcm , out , EVP_GCM_TLS_TAG_LEN ) ;
rv = len + EVP_GCM_TLS_EXPLICIT_IV_LEN + EVP_GCM_TLS_TAG_LEN ;
}
else {
if ( gctx -> ctr ) {
size_t bulk = 0 ;
# if defined ( AES_GCM_ASM ) if ( len >= 16 && AES_GCM_ASM ( gctx ) ) {
if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , NULL , NULL , 0 ) ) return - 1 ;
bulk = AES_gcm_decrypt ( in , out , len , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ;
gctx -> gcm . len . u [ 1 ] += bulk ;
}
# endif if ( CRYPTO_gcm128_decrypt_ctr32 ( & gctx -> gcm , in + bulk , out + bulk , len - bulk , gctx -> ctr ) ) goto err ;
}
else {
size_t bulk = 0 ;
# if defined ( AES_GCM_ASM2 ) if ( len >= 16 && AES_GCM_ASM2 ( gctx ) ) {
if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , NULL , NULL , 0 ) ) return - 1 ;
bulk = AES_gcm_decrypt ( in , out , len , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ;
gctx -> gcm . len . u [ 1 ] += bulk ;
}
# endif if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , in + bulk , out + bulk , len - bulk ) ) goto err ;
}
CRYPTO_gcm128_tag ( & gctx -> gcm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , EVP_GCM_TLS_TAG_LEN ) ;
if ( CRYPTO_memcmp ( EVP_CIPHER_CTX_buf_noconst ( ctx ) , in + len , EVP_GCM_TLS_TAG_LEN ) ) {
OPENSSL_cleanse ( out , len ) ;
goto err ;
}
rv = len ;
}
err : gctx -> iv_set = 0 ;
gctx -> tls_aad_len = - 1 ;
return rv ;
}
static int aes_gcm_cipher ( EVP_CIPHER_CTX * ctx , unsigned char * out , const unsigned char * in , size_t len ) {
EVP_AES_GCM_CTX * gctx = EVP_C_DATA ( EVP_AES_GCM_CTX , ctx ) ;
if ( ! gctx -> key_set ) return - 1 ;
if ( gctx -> tls_aad_len >= 0 ) return aes_gcm_tls_cipher ( ctx , out , in , len ) ;
if ( ! gctx -> iv_set ) return - 1 ;
if ( in ) {
if ( out == NULL ) {
if ( CRYPTO_gcm128_aad ( & gctx -> gcm , in , len ) ) return - 1 ;
}
else if ( EVP_CIPHER_CTX_encrypting ( ctx ) ) {
if ( gctx -> ctr ) {
size_t bulk = 0 ;
# if defined ( AES_GCM_ASM ) if ( len >= 32 && AES_GCM_ASM ( gctx ) ) {
size_t res = ( 16 - gctx -> gcm . mres ) % 16 ;
if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , in , out , res ) ) return - 1 ;
bulk = AES_gcm_encrypt ( in + res , out + res , len - res , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ;
gctx -> gcm . len . u [ 1 ] += bulk ;
bulk += res ;
}
# endif if ( CRYPTO_gcm128_encrypt_ctr32 ( & gctx -> gcm , in + bulk , out + bulk , len - bulk , gctx -> ctr ) ) return - 1 ;
}
else {
size_t bulk = 0 ;
# if defined ( AES_GCM_ASM2 ) if ( len >= 32 && AES_GCM_ASM2 ( gctx ) ) {
size_t res = ( 16 - gctx -> gcm . mres ) % 16 ;
if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , in , out , res ) ) return - 1 ;
bulk = AES_gcm_encrypt ( in + res , out + res , len - res , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ;
gctx -> gcm . len . u [ 1 ] += bulk ;
bulk += res ;
}
# endif if ( CRYPTO_gcm128_encrypt ( & gctx -> gcm , in + bulk , out + bulk , len - bulk ) ) return - 1 ;
}
}
else {
if ( gctx -> ctr ) {
size_t bulk = 0 ;
# if defined ( AES_GCM_ASM ) if ( len >= 16 && AES_GCM_ASM ( gctx ) ) {
size_t res = ( 16 - gctx -> gcm . mres ) % 16 ;
if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , in , out , res ) ) return - 1 ;
bulk = AES_gcm_decrypt ( in + res , out + res , len - res , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ;
gctx -> gcm . len . u [ 1 ] += bulk ;
bulk += res ;
}
# endif if ( CRYPTO_gcm128_decrypt_ctr32 ( & gctx -> gcm , in + bulk , out + bulk , len - bulk , gctx -> ctr ) ) return - 1 ;
}
else {
size_t bulk = 0 ;
# if defined ( AES_GCM_ASM2 ) if ( len >= 16 && AES_GCM_ASM2 ( gctx ) ) {
size_t res = ( 16 - gctx -> gcm . mres ) % 16 ;
if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , in , out , res ) ) return - 1 ;
bulk = AES_gcm_decrypt ( in + res , out + res , len - res , gctx -> gcm . key , gctx -> gcm . Yi . c , gctx -> gcm . Xi . u ) ;
gctx -> gcm . len . u [ 1 ] += bulk ;
bulk += res ;
}
# endif if ( CRYPTO_gcm128_decrypt ( & gctx -> gcm , in + bulk , out + bulk , len - bulk ) ) return - 1 ;
}
}
return len ;
}
else {
if ( ! EVP_CIPHER_CTX_encrypting ( ctx ) ) {
if ( gctx -> taglen < 0 ) return - 1 ;
if ( CRYPTO_gcm128_finish ( & gctx -> gcm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , gctx -> taglen ) != 0 ) return - 1 ;
gctx -> iv_set = 0 ;
return 0 ;
}
CRYPTO_gcm128_tag ( & gctx -> gcm , EVP_CIPHER_CTX_buf_noconst ( ctx ) , 16 ) ;
gctx -> taglen = 16 ;
gctx -> iv_set = 0 ;
return 0 ;
}
}
# define CUSTOM_FLAGS ( EVP_CIPH_FLAG_DEFAULT_ASN1 \ | EVP_CIPH_CUSTOM_IV | EVP_CIPH_FLAG_CUSTOM_CIPHER \ | EVP_CIPH_ALWAYS_CALL_INIT | EVP_CIPH_CTRL_INIT \ | EVP_CIPH_CUSTOM_COPY ) BLOCK_CIPHER_custom ( NID_aes , 128 , 1 , 12 , gcm , GCM , EVP_CIPH_FLAG_AEAD_CIPHER | CUSTOM_FLAGS )
| 1
|
static int dissect_pvfs2_mgmt_event_mon_response ( tvbuff_t * tvb , proto_tree * tree , int offset ) {
proto_tree_add_item ( tree , hf_pvfs_mgmt_event_mon_response_api , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
proto_tree_add_item ( tree , hf_pvfs_mgmt_event_mon_response_operation , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
proto_tree_add_item ( tree , hf_pvfs_mgmt_event_mon_response_value , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
offset = dissect_pvfs_uint64 ( tvb , tree , offset , hf_pvfs_id_gen_t , NULL ) ;
proto_tree_add_item ( tree , hf_pvfs_mgmt_event_mon_response_flags , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
proto_tree_add_item ( tree , hf_pvfs_mgmt_event_mon_response_tv_sec , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
proto_tree_add_item ( tree , hf_pvfs_mgmt_event_mon_response_tv_usec , tvb , offset , 4 , ENC_LITTLE_ENDIAN ) ;
offset += 4 ;
offset += 4 ;
return offset ;
}
| 0
|
static struct cvec * range ( struct vars * v , celt a , celt b , int cases ) {
int nchrs ;
struct cvec * cv ;
celt c , cc ;
if ( a != b && ! before ( a , b ) ) {
ERR ( REG_ERANGE ) ;
return NULL ;
}
if ( ! cases ) {
cv = getcvec ( v , 0 , 1 ) ;
NOERRN ( ) ;
addrange ( cv , a , b ) ;
return cv ;
}
nchrs = b - a + 1 ;
if ( nchrs <= 0 || nchrs > 100000 ) nchrs = 100000 ;
cv = getcvec ( v , nchrs , 1 ) ;
NOERRN ( ) ;
addrange ( cv , a , b ) ;
for ( c = a ;
c <= b ;
c ++ ) {
cc = pg_wc_tolower ( ( chr ) c ) ;
if ( cc != c && ( before ( cc , a ) || before ( b , cc ) ) ) {
if ( cv -> nchrs >= cv -> chrspace ) {
ERR ( REG_ETOOBIG ) ;
return NULL ;
}
addchr ( cv , cc ) ;
}
cc = pg_wc_toupper ( ( chr ) c ) ;
if ( cc != c && ( before ( cc , a ) || before ( b , cc ) ) ) {
if ( cv -> nchrs >= cv -> chrspace ) {
ERR ( REG_ETOOBIG ) ;
return NULL ;
}
addchr ( cv , cc ) ;
}
if ( CANCEL_REQUESTED ( v -> re ) ) {
ERR ( REG_CANCEL ) ;
return NULL ;
}
}
return cv ;
}
| 0
|
unsigned int vp9_sad ## m ## x ## n ## _avg_c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , const uint8_t * second_pred ) {
uint8_t comp_pred [ m * n ] ;
vp9_comp_avg_pred ( comp_pred , second_pred , m , n , ref , ref_stride ) ;
return sad ( src , src_stride , comp_pred , m , m , n ) ;
\ }
# define sadMxNxK ( m , n , k ) void vp9_sad ## m ## x ## n ## x ## k ## _c ( const uint8_t * src , int src_stride , const uint8_t * ref , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < k ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , & ref [ i ] , ref_stride ) ;
\ }
# define sadMxNx4D ( m , n ) void vp9_sad ## m ## x ## n ## x4d_c ( const uint8_t * src , int src_stride , const uint8_t * const refs [ ] , int ref_stride , unsigned int * sads ) {
int i ;
for ( i = 0 ;
i < 4 ;
++ i ) sads [ i ] = vp9_sad ## m ## x ## n ## _c ( src , src_stride , refs [ i ] , ref_stride ) ;
\ }
sadMxN ( 64 , 64 ) sadMxNxK ( 64 , 64 , 3 ) sadMxNxK ( 64 , 64 , 8 ) sadMxNx4D ( 64 , 64 ) sadMxN ( 64 , 32 ) sadMxNx4D ( 64 , 32 ) sadMxN ( 32 , 64 ) sadMxNx4D ( 32 , 64 ) sadMxN ( 32 , 32 ) sadMxNxK ( 32 , 32 , 3 ) sadMxNxK ( 32 , 32 , 8 ) sadMxNx4D ( 32 , 32 ) sadMxN ( 32 , 16 ) sadMxNx4D ( 32 , 16 ) sadMxN ( 16 , 32 ) sadMxNx4D ( 16 , 32 ) sadMxN ( 16 , 16 ) sadMxNxK ( 16 , 16 , 3 ) sadMxNxK ( 16 , 16 , 8 ) sadMxNx4D ( 16 , 16 ) sadMxN ( 16 , 8 ) sadMxNxK ( 16 , 8 , 3 ) sadMxNxK ( 16 , 8 , 8 ) sadMxNx4D ( 16 , 8 ) sadMxN ( 8 , 16 ) sadMxNxK ( 8 , 16 , 3 ) sadMxNxK ( 8 , 16 , 8 ) sadMxNx4D ( 8 , 16 ) sadMxN ( 8 , 8 ) sadMxNxK ( 8 , 8 , 3 ) sadMxNxK ( 8 , 8 , 8 ) sadMxNx4D ( 8 , 8 ) sadMxN ( 8 , 4 ) sadMxNxK ( 8 , 4 , 8 ) sadMxNx4D ( 8 , 4 ) sadMxN ( 4 , 8 )
| 0
|
int dissect_ber_relative_oid ( gboolean implicit_tag , asn1_ctx_t * actx , proto_tree * tree , tvbuff_t * tvb , int offset , gint hf_id , tvbuff_t * * value_tvb ) {
return dissect_ber_any_oid ( implicit_tag , actx , tree , tvb , offset , hf_id , value_tvb , FALSE ) ;
}
| 0
|
static int uncompress_image ( Gif_Context * gfc , Gif_Image * gfi , Gif_Reader * grr ) {
int old_nerrors ;
if ( ! Gif_CreateUncompressedImage ( gfi , gfi -> interlace ) ) return 0 ;
gfc -> width = gfi -> width ;
gfc -> height = gfi -> height ;
gfc -> image = gfi -> image_data ;
gfc -> maximage = gfi -> image_data + ( unsigned ) gfi -> width * ( unsigned ) gfi -> height ;
old_nerrors = gfc -> errors [ 1 ] ;
read_image_data ( gfc , grr ) ;
gfi -> compressed_errors = gfc -> errors [ 1 ] - old_nerrors ;
return 1 ;
}
| 0
|
static void display_sorted_nicks ( CHANNEL_REC * channel , GSList * nicklist ) {
WINDOW_REC * window ;
TEXT_DEST_REC dest ;
GString * str ;
GSList * tmp ;
char * format , * stripped , * prefix_format ;
char * aligned_nick , nickmode [ 2 ] = {
0 , 0 }
;
int * columns , cols , rows , last_col_rows , col , row , max_width ;
int item_extra , formatnum ;
window = window_find_closest ( channel -> server , channel -> visible_name , MSGLEVEL_CLIENTCRAP ) ;
max_width = window -> width ;
format = format_get_text ( MODULE_NAME , NULL , channel -> server , channel -> visible_name , TXT_NAMES_NICK , " " , "" ) ;
stripped = strip_codes ( format ) ;
item_extra = strlen ( stripped ) ;
g_free ( stripped ) ;
g_free ( format ) ;
if ( settings_get_int ( "names_max_width" ) > 0 && settings_get_int ( "names_max_width" ) < max_width ) max_width = settings_get_int ( "names_max_width" ) ;
format_create_dest ( & dest , channel -> server , channel -> visible_name , MSGLEVEL_CLIENTCRAP , NULL ) ;
format = format_get_line_start ( current_theme , & dest , time ( NULL ) ) ;
if ( format != NULL ) {
stripped = strip_codes ( format ) ;
max_width -= strlen ( stripped ) ;
g_free ( stripped ) ;
g_free ( format ) ;
}
prefix_format = format_get_text ( MODULE_NAME , NULL , channel -> server , channel -> visible_name , TXT_NAMES_PREFIX , channel -> visible_name ) ;
if ( prefix_format != NULL ) {
stripped = strip_codes ( prefix_format ) ;
max_width -= strlen ( stripped ) ;
g_free ( stripped ) ;
}
if ( max_width <= 0 ) {
max_width = 10 ;
}
cols = get_max_column_count ( nicklist , get_nick_length , max_width , settings_get_int ( "names_max_columns" ) , item_extra , 3 , & columns , & rows ) ;
nicklist = columns_sort_list ( nicklist , rows ) ;
last_col_rows = rows - ( cols * rows - g_slist_length ( nicklist ) ) ;
if ( last_col_rows == 0 ) last_col_rows = rows ;
str = g_string_new ( prefix_format ) ;
col = 0 ;
row = 0 ;
for ( tmp = nicklist ;
tmp != NULL ;
tmp = tmp -> next ) {
NICK_REC * rec = tmp -> data ;
if ( rec -> prefixes [ 0 ] ) nickmode [ 0 ] = rec -> prefixes [ 0 ] ;
else nickmode [ 0 ] = ' ' ;
aligned_nick = get_alignment ( rec -> nick , columns [ col ] - item_extra , ALIGN_PAD , ' ' ) ;
formatnum = rec -> op ? TXT_NAMES_NICK_OP : rec -> halfop ? TXT_NAMES_NICK_HALFOP : rec -> voice ? TXT_NAMES_NICK_VOICE : TXT_NAMES_NICK ;
format = format_get_text ( MODULE_NAME , NULL , channel -> server , channel -> visible_name , formatnum , nickmode , aligned_nick ) ;
g_string_append ( str , format ) ;
g_free ( aligned_nick ) ;
g_free ( format ) ;
if ( ++ col == cols ) {
printtext ( channel -> server , channel -> visible_name , MSGLEVEL_CLIENTCRAP , "%s" , str -> str ) ;
g_string_truncate ( str , 0 ) ;
if ( prefix_format != NULL ) g_string_assign ( str , prefix_format ) ;
col = 0 ;
row ++ ;
if ( row == last_col_rows ) cols -- ;
}
}
if ( prefix_format != NULL && str -> len > strlen ( prefix_format ) ) {
printtext ( channel -> server , channel -> visible_name , MSGLEVEL_CLIENTCRAP , "%s" , str -> str ) ;
}
g_slist_free ( nicklist ) ;
g_string_free ( str , TRUE ) ;
g_free_not_null ( columns ) ;
g_free_not_null ( prefix_format ) ;
}
| 0
|
static int dissect_rsl_ie_cbch_load_inf ( tvbuff_t * tvb , packet_info * pinfo _U_ , proto_tree * tree , int offset , gboolean is_mandatory ) {
proto_item * item ;
proto_tree * ie_tree ;
guint8 ie_id ;
guint8 octet ;
if ( is_mandatory == FALSE ) {
ie_id = tvb_get_guint8 ( tvb , offset ) ;
if ( ie_id != RSL_IE_CBCH_LOAD_INF ) return offset ;
}
ie_tree = proto_tree_add_subtree ( tree , tvb , offset , 0 , ett_ie_cbch_load_inf , NULL , "CBCH Load Information IE" ) ;
proto_tree_add_item ( ie_tree , hf_rsl_ie_id , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
octet = tvb_get_guint8 ( tvb , offset ) ;
proto_tree_add_item ( ie_tree , hf_rsl_cbch_load_type , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
item = proto_tree_add_item ( ie_tree , hf_rsl_msg_slt_cnt , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
if ( ( octet & 0x80 ) == 0x80 ) {
proto_item_append_text ( item , "The amount of SMSCB messages (1 to 15) that are needed immediately by BTS" ) ;
}
else {
proto_item_append_text ( item , "The amount of delay in message slots (1 to 15) that is needed immediately by BTS" ) ;
}
offset ++ ;
return offset ;
}
| 0
|
static int dissect_h225_NonStandardMessage ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_NonStandardMessage , NonStandardMessage_sequence ) ;
return offset ;
}
| 0
|
static int znoaccess ( i_ctx_t * i_ctx_p ) {
os_ptr op = osp ;
check_op ( 1 ) ;
if ( r_has_type ( op , t_dictionary ) ) {
ref * aop = dict_access_ref ( op ) ;
if ( ! r_has_attrs ( aop , a_write ) ) {
if ( ! r_has_attrs ( aop , a_read ) && ! r_has_attrs ( aop , a_execute ) ) {
return 0 ;
}
return_error ( gs_error_invalidaccess ) ;
}
if ( dict_is_permanent_on_dstack ( op ) ) return_error ( gs_error_invalidaccess ) ;
}
return access_check ( i_ctx_p , 0 , true ) ;
}
| 0
|
static int svc_log ( SvcContext * svc_ctx , SVC_LOG_LEVEL level , const char * fmt , ... ) {
char buf [ 512 ] ;
int retval = 0 ;
va_list ap ;
SvcInternal * const si = get_svc_internal ( svc_ctx ) ;
if ( level > svc_ctx -> log_level ) {
return retval ;
}
va_start ( ap , fmt ) ;
retval = vsnprintf ( buf , sizeof ( buf ) , fmt , ap ) ;
va_end ( ap ) ;
if ( svc_ctx -> log_print ) {
printf ( "%s" , buf ) ;
}
else {
strncat ( si -> message_buffer , buf , sizeof ( si -> message_buffer ) - strlen ( si -> message_buffer ) - 1 ) ;
}
if ( level == SVC_LOG_ERROR ) {
si -> codec_ctx -> err_detail = si -> message_buffer ;
}
return retval ;
}
| 0
|
void vp8_post_proc_down_and_across_mb_row_c ( unsigned char * src_ptr , unsigned char * dst_ptr , int src_pixels_per_line , int dst_pixels_per_line , int cols , unsigned char * f , int size ) {
unsigned char * p_src , * p_dst ;
int row ;
int col ;
unsigned char v ;
unsigned char d [ 4 ] ;
for ( row = 0 ;
row < size ;
row ++ ) {
p_src = src_ptr ;
p_dst = dst_ptr ;
for ( col = 0 ;
col < cols ;
col ++ ) {
unsigned char p_above2 = p_src [ col - 2 * src_pixels_per_line ] ;
unsigned char p_above1 = p_src [ col - src_pixels_per_line ] ;
unsigned char p_below1 = p_src [ col + src_pixels_per_line ] ;
unsigned char p_below2 = p_src [ col + 2 * src_pixels_per_line ] ;
v = p_src [ col ] ;
if ( ( abs ( v - p_above2 ) < f [ col ] ) && ( abs ( v - p_above1 ) < f [ col ] ) && ( abs ( v - p_below1 ) < f [ col ] ) && ( abs ( v - p_below2 ) < f [ col ] ) ) {
unsigned char k1 , k2 , k3 ;
k1 = ( p_above2 + p_above1 + 1 ) >> 1 ;
k2 = ( p_below2 + p_below1 + 1 ) >> 1 ;
k3 = ( k1 + k2 + 1 ) >> 1 ;
v = ( k3 + v + 1 ) >> 1 ;
}
p_dst [ col ] = v ;
}
p_src = dst_ptr ;
p_dst = dst_ptr ;
p_src [ - 2 ] = p_src [ - 1 ] = p_src [ 0 ] ;
p_src [ cols ] = p_src [ cols + 1 ] = p_src [ cols - 1 ] ;
for ( col = 0 ;
col < cols ;
col ++ ) {
v = p_src [ col ] ;
if ( ( abs ( v - p_src [ col - 2 ] ) < f [ col ] ) && ( abs ( v - p_src [ col - 1 ] ) < f [ col ] ) && ( abs ( v - p_src [ col + 1 ] ) < f [ col ] ) && ( abs ( v - p_src [ col + 2 ] ) < f [ col ] ) ) {
unsigned char k1 , k2 , k3 ;
k1 = ( p_src [ col - 2 ] + p_src [ col - 1 ] + 1 ) >> 1 ;
k2 = ( p_src [ col + 2 ] + p_src [ col + 1 ] + 1 ) >> 1 ;
k3 = ( k1 + k2 + 1 ) >> 1 ;
v = ( k3 + v + 1 ) >> 1 ;
}
d [ col & 3 ] = v ;
if ( col >= 2 ) p_dst [ col - 2 ] = d [ ( col - 2 ) & 3 ] ;
}
p_dst [ col - 2 ] = d [ ( col - 2 ) & 3 ] ;
p_dst [ col - 1 ] = d [ ( col - 1 ) & 3 ] ;
src_ptr += src_pixels_per_line ;
dst_ptr += dst_pixels_per_line ;
}
}
| 0
|
static int dissect_h225_SEQUENCE_OF_SupportedPrefix ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence_of ( tvb , offset , actx , tree , hf_index , ett_h225_SEQUENCE_OF_SupportedPrefix , SEQUENCE_OF_SupportedPrefix_sequence_of ) ;
return offset ;
}
| 0
|
static void stroke_user_creds ( private_stroke_socket_t * this , stroke_msg_t * msg , FILE * out ) {
pop_string ( msg , & msg -> user_creds . name ) ;
pop_string ( msg , & msg -> user_creds . username ) ;
pop_string ( msg , & msg -> user_creds . password ) ;
DBG1 ( DBG_CFG , "received stroke: user-creds '%s'" , msg -> user_creds . name ) ;
this -> config -> set_user_credentials ( this -> config , msg , out ) ;
}
| 0
|
static time_t xstrpisotime ( const char * s , char * * endptr ) {
struct tm tm ;
time_t res = ( time_t ) - 1 ;
memset ( & tm , 0 , sizeof ( tm ) ) ;
while ( * s == ' ' || * s == '\t' ) ++ s ;
if ( ( tm . tm_year = strtoi_lim ( s , & s , 1583 , 4095 ) ) < 0 || * s ++ != '-' ) {
goto out ;
}
if ( ( tm . tm_mon = strtoi_lim ( s , & s , 1 , 12 ) ) < 0 || * s ++ != '-' ) {
goto out ;
}
if ( ( tm . tm_mday = strtoi_lim ( s , & s , 1 , 31 ) ) < 0 || * s ++ != 'T' ) {
goto out ;
}
if ( ( tm . tm_hour = strtoi_lim ( s , & s , 0 , 23 ) ) < 0 || * s ++ != ':' ) {
goto out ;
}
if ( ( tm . tm_min = strtoi_lim ( s , & s , 0 , 59 ) ) < 0 || * s ++ != ':' ) {
goto out ;
}
if ( ( tm . tm_sec = strtoi_lim ( s , & s , 0 , 60 ) ) < 0 || * s ++ != 'Z' ) {
goto out ;
}
tm . tm_year -= 1900 ;
tm . tm_mon -- ;
res = time_from_tm ( & tm ) ;
out : if ( endptr != NULL ) {
* endptr = deconst ( s ) ;
}
return res ;
}
| 0
|
static gcry_mpi_t hex2mpi ( const char * string ) {
gpg_error_t err ;
gcry_mpi_t val ;
err = gcry_mpi_scan ( & val , GCRYMPI_FMT_HEX , string , 0 , NULL ) ;
if ( err ) die ( "hex2mpi '%s' failed: %s\n" , gpg_strerror ( err ) ) ;
return val ;
}
| 0
|
static const UAmbiguousConverter * ucnv_getAmbiguous ( const UConverter * cnv ) {
UErrorCode errorCode ;
const char * name ;
int32_t i ;
if ( cnv == NULL ) {
return NULL ;
}
errorCode = U_ZERO_ERROR ;
name = ucnv_getName ( cnv , & errorCode ) ;
if ( U_FAILURE ( errorCode ) ) {
return NULL ;
}
for ( i = 0 ;
i < UPRV_LENGTHOF ( ambiguousConverters ) ;
++ i ) {
if ( 0 == uprv_strcmp ( name , ambiguousConverters [ i ] . name ) ) {
return ambiguousConverters + i ;
}
}
return NULL ;
}
| 0
|
static cmsBool Type_vcgt_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) {
cmsToneCurve * * Curves = ( cmsToneCurve * * ) Ptr ;
cmsUInt32Number i , j ;
if ( cmsGetToneCurveParametricType ( Curves [ 0 ] ) == 5 && cmsGetToneCurveParametricType ( Curves [ 1 ] ) == 5 && cmsGetToneCurveParametricType ( Curves [ 2 ] ) == 5 ) {
if ( ! _cmsWriteUInt32Number ( io , cmsVideoCardGammaFormulaType ) ) return FALSE ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
_cmsVCGTGAMMA v ;
v . Gamma = Curves [ i ] -> Segments [ 0 ] . Params [ 0 ] ;
v . Min = Curves [ i ] -> Segments [ 0 ] . Params [ 5 ] ;
v . Max = pow ( Curves [ i ] -> Segments [ 0 ] . Params [ 1 ] , v . Gamma ) + v . Min ;
if ( ! _cmsWrite15Fixed16Number ( io , v . Gamma ) ) return FALSE ;
if ( ! _cmsWrite15Fixed16Number ( io , v . Min ) ) return FALSE ;
if ( ! _cmsWrite15Fixed16Number ( io , v . Max ) ) return FALSE ;
}
}
else {
if ( ! _cmsWriteUInt32Number ( io , cmsVideoCardGammaTableType ) ) return FALSE ;
if ( ! _cmsWriteUInt16Number ( io , 3 ) ) return FALSE ;
if ( ! _cmsWriteUInt16Number ( io , 256 ) ) return FALSE ;
if ( ! _cmsWriteUInt16Number ( io , 2 ) ) return FALSE ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
for ( j = 0 ;
j < 256 ;
j ++ ) {
cmsFloat32Number v = cmsEvalToneCurveFloat ( Curves [ i ] , ( cmsFloat32Number ) ( j / 255.0 ) ) ;
cmsUInt16Number n = _cmsQuickSaturateWord ( v * 65535.0 ) ;
if ( ! _cmsWriteUInt16Number ( io , n ) ) return FALSE ;
}
}
}
return TRUE ;
cmsUNUSED_PARAMETER ( self ) ;
cmsUNUSED_PARAMETER ( nItems ) ;
}
| 0
|
int dtls1_send_server_done ( SSL * s ) {
unsigned char * p ;
if ( s -> state == SSL3_ST_SW_SRVR_DONE_A ) {
p = ( unsigned char * ) s -> init_buf -> data ;
p = dtls1_set_message_header ( s , p , SSL3_MT_SERVER_DONE , 0 , 0 , 0 ) ;
s -> state = SSL3_ST_SW_SRVR_DONE_B ;
s -> init_num = DTLS1_HM_HEADER_LENGTH ;
s -> init_off = 0 ;
dtls1_buffer_message ( s , 0 ) ;
}
return ( dtls1_do_write ( s , SSL3_RT_HANDSHAKE ) ) ;
}
| 0
|
void * hb_font_funcs_get_user_data ( hb_font_funcs_t * ffuncs , hb_user_data_key_t * key ) {
return hb_object_get_user_data ( ffuncs , key ) ;
}
| 0
|
void refresh_status ( THD * thd ) {
mysql_mutex_lock ( & LOCK_status ) ;
add_to_status ( & global_status_var , & thd -> status_var ) ;
bzero ( ( uchar * ) & thd -> status_var , sizeof ( thd -> status_var ) ) ;
bzero ( ( uchar * ) & thd -> org_status_var , sizeof ( thd -> org_status_var ) ) ;
thd -> start_bytes_received = 0 ;
reset_status_vars ( ) ;
process_key_caches ( reset_key_cache_counters , 0 ) ;
flush_status_time = time ( ( time_t * ) 0 ) ;
mysql_mutex_unlock ( & LOCK_status ) ;
mysql_mutex_lock ( & LOCK_thread_count ) ;
max_used_connections = thread_count - delayed_insert_threads ;
mysql_mutex_unlock ( & LOCK_thread_count ) ;
}
| 0
|
static inline size_t GetPixelChannels ( const Image * restrict image ) {
return ( image -> number_channels ) ;
}
| 0
|
static void remoteDispatchCopyError ( remote_error * rerr , virErrorPtr verr ) {
rerr -> code = verr -> code ;
rerr -> domain = verr -> domain ;
rerr -> message = verr -> message ? malloc ( sizeof ( char * ) ) : NULL ;
if ( rerr -> message ) * rerr -> message = strdup ( verr -> message ) ;
rerr -> level = verr -> level ;
rerr -> str1 = verr -> str1 ? malloc ( sizeof ( char * ) ) : NULL ;
if ( rerr -> str1 ) * rerr -> str1 = strdup ( verr -> str1 ) ;
rerr -> str2 = verr -> str2 ? malloc ( sizeof ( char * ) ) : NULL ;
if ( rerr -> str2 ) * rerr -> str2 = strdup ( verr -> str2 ) ;
rerr -> str3 = verr -> str3 ? malloc ( sizeof ( char * ) ) : NULL ;
if ( rerr -> str3 ) * rerr -> str3 = strdup ( verr -> str3 ) ;
rerr -> int1 = verr -> int1 ;
rerr -> int2 = verr -> int2 ;
}
| 0
|
static int _evdns_nameserver_add_impl ( unsigned long int address , int port ) {
const struct nameserver * server = server_head , * const started_at = server_head ;
struct nameserver * ns ;
int err = 0 ;
if ( server ) {
do {
if ( server -> address == address ) return 3 ;
server = server -> next ;
}
while ( server != started_at ) ;
}
ns = ( struct nameserver * ) malloc ( sizeof ( struct nameserver ) ) ;
if ( ! ns ) return - 1 ;
memset ( ns , 0 , sizeof ( struct nameserver ) ) ;
evtimer_set ( & ns -> timeout_event , nameserver_prod_callback , ns ) ;
ns -> socket = socket ( PF_INET , SOCK_DGRAM , 0 ) ;
if ( ns -> socket < 0 ) {
err = 1 ;
goto out1 ;
}
evutil_make_socket_nonblocking ( ns -> socket ) ;
ns -> address = address ;
ns -> port = htons ( port ) ;
ns -> state = 1 ;
event_set ( & ns -> event , ns -> socket , EV_READ | EV_PERSIST , nameserver_ready_callback , ns ) ;
if ( event_add ( & ns -> event , NULL ) < 0 ) {
err = 2 ;
goto out2 ;
}
log ( EVDNS_LOG_DEBUG , "Added nameserver %s" , debug_ntoa ( address ) ) ;
if ( ! server_head ) {
ns -> next = ns -> prev = ns ;
server_head = ns ;
}
else {
ns -> next = server_head -> next ;
ns -> prev = server_head ;
server_head -> next = ns ;
if ( server_head -> prev == server_head ) {
server_head -> prev = ns ;
}
}
global_good_nameservers ++ ;
return 0 ;
out2 : CLOSE_SOCKET ( ns -> socket ) ;
out1 : free ( ns ) ;
log ( EVDNS_LOG_WARN , "Unable to add nameserver %s: error %d" , debug_ntoa ( address ) , err ) ;
return err ;
}
| 1
|
static void * Type_LUT16_Read ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , cmsUInt32Number * nItems , cmsUInt32Number SizeOfTag ) {
cmsUInt8Number InputChannels , OutputChannels , CLUTpoints ;
cmsPipeline * NewLUT = NULL ;
cmsUInt32Number nTabSize ;
cmsFloat64Number Matrix [ 3 * 3 ] ;
cmsUInt16Number InputEntries , OutputEntries ;
* nItems = 0 ;
if ( ! _cmsReadUInt8Number ( io , & InputChannels ) ) return NULL ;
if ( ! _cmsReadUInt8Number ( io , & OutputChannels ) ) return NULL ;
if ( ! _cmsReadUInt8Number ( io , & CLUTpoints ) ) return NULL ;
if ( ! _cmsReadUInt8Number ( io , NULL ) ) return NULL ;
if ( InputChannels > cmsMAXCHANNELS ) goto Error ;
if ( OutputChannels > cmsMAXCHANNELS ) goto Error ;
NewLUT = cmsPipelineAlloc ( self -> ContextID , InputChannels , OutputChannels ) ;
if ( NewLUT == NULL ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 0 ] ) ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 1 ] ) ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 2 ] ) ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 3 ] ) ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 4 ] ) ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 5 ] ) ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 6 ] ) ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 7 ] ) ) goto Error ;
if ( ! _cmsRead15Fixed16Number ( io , & Matrix [ 8 ] ) ) goto Error ;
if ( ( InputChannels == 3 ) && ! _cmsMAT3isIdentity ( ( cmsMAT3 * ) Matrix ) ) {
if ( ! cmsPipelineInsertStage ( NewLUT , cmsAT_END , cmsStageAllocMatrix ( self -> ContextID , 3 , 3 , Matrix , NULL ) ) ) goto Error ;
}
if ( ! _cmsReadUInt16Number ( io , & InputEntries ) ) goto Error ;
if ( ! _cmsReadUInt16Number ( io , & OutputEntries ) ) goto Error ;
if ( InputEntries > 0x7FFF || OutputEntries > 0x7FFF ) goto Error ;
if ( CLUTpoints == 1 ) goto Error ;
if ( ! Read16bitTables ( self -> ContextID , io , NewLUT , InputChannels , InputEntries ) ) goto Error ;
nTabSize = uipow ( OutputChannels , CLUTpoints , InputChannels ) ;
if ( nTabSize == ( cmsUInt32Number ) - 1 ) goto Error ;
if ( nTabSize > 0 ) {
cmsUInt16Number * T ;
T = ( cmsUInt16Number * ) _cmsCalloc ( self -> ContextID , nTabSize , sizeof ( cmsUInt16Number ) ) ;
if ( T == NULL ) goto Error ;
if ( ! _cmsReadUInt16Array ( io , nTabSize , T ) ) {
_cmsFree ( self -> ContextID , T ) ;
goto Error ;
}
if ( ! cmsPipelineInsertStage ( NewLUT , cmsAT_END , cmsStageAllocCLut16bit ( self -> ContextID , CLUTpoints , InputChannels , OutputChannels , T ) ) ) {
_cmsFree ( self -> ContextID , T ) ;
goto Error ;
}
_cmsFree ( self -> ContextID , T ) ;
}
if ( ! Read16bitTables ( self -> ContextID , io , NewLUT , OutputChannels , OutputEntries ) ) goto Error ;
* nItems = 1 ;
return NewLUT ;
Error : if ( NewLUT != NULL ) cmsPipelineFree ( NewLUT ) ;
return NULL ;
cmsUNUSED_PARAMETER ( SizeOfTag ) ;
}
| 0
|
static void handle_message_header_expected_byte ( tvbuff_t * tvb , gint offset , proto_tree * field_tree , guint8 expected_value ) {
proto_item * item ;
guint8 byte_value ;
item = proto_tree_add_item ( field_tree , hf_alljoyn_uint8 , tvb , offset , 1 , ENC_NA ) ;
byte_value = tvb_get_guint8 ( tvb , offset ) ;
if ( expected_value == byte_value ) {
proto_item_set_text ( item , "0x%02x byte" , expected_value ) ;
}
else {
proto_item_set_text ( item , "Expected '0x%02x byte' but found '0x%02x'" , expected_value , byte_value ) ;
}
}
| 0
|
static bfd_boolean srec_write_record ( bfd * abfd , unsigned int type , bfd_vma address , const bfd_byte * data , const bfd_byte * end ) {
char buffer [ 2 * MAXCHUNK + 6 ] ;
unsigned int check_sum = 0 ;
const bfd_byte * src = data ;
char * dst = buffer ;
char * length ;
bfd_size_type wrlen ;
* dst ++ = 'S' ;
* dst ++ = '0' + type ;
length = dst ;
dst += 2 ;
switch ( type ) {
case 3 : case 7 : TOHEX ( dst , ( address >> 24 ) , check_sum ) ;
dst += 2 ;
case 8 : case 2 : TOHEX ( dst , ( address >> 16 ) , check_sum ) ;
dst += 2 ;
case 9 : case 1 : case 0 : TOHEX ( dst , ( address >> 8 ) , check_sum ) ;
dst += 2 ;
TOHEX ( dst , ( address ) , check_sum ) ;
dst += 2 ;
break ;
}
for ( src = data ;
src < end ;
src ++ ) {
TOHEX ( dst , * src , check_sum ) ;
dst += 2 ;
}
TOHEX ( length , ( dst - length ) / 2 , check_sum ) ;
check_sum &= 0xff ;
check_sum = 255 - check_sum ;
TOHEX ( dst , check_sum , check_sum ) ;
dst += 2 ;
* dst ++ = '\r' ;
* dst ++ = '\n' ;
wrlen = dst - buffer ;
return bfd_bwrite ( ( void * ) buffer , wrlen , abfd ) == wrlen ;
}
| 0
|
void send_protected_args ( int fd , char * args [ ] ) {
int i ;
# ifdef ICONV_OPTION int convert = ic_send != ( iconv_t ) - 1 ;
xbuf outbuf , inbuf ;
if ( convert ) alloc_xbuf ( & outbuf , 1024 ) ;
# endif for ( i = 0 ;
args [ i ] ;
i ++ ) {
}
args [ i ] = "rsync" ;
if ( DEBUG_GTE ( CMD , 1 ) ) print_child_argv ( "protected args:" , args + i + 1 ) ;
do {
if ( ! args [ i ] [ 0 ] ) write_buf ( fd , "." , 2 ) ;
# ifdef ICONV_OPTION else if ( convert ) {
INIT_XBUF_STRLEN ( inbuf , args [ i ] ) ;
iconvbufs ( ic_send , & inbuf , & outbuf , ICB_EXPAND_OUT | ICB_INCLUDE_BAD | ICB_INCLUDE_INCOMPLETE | ICB_INIT ) ;
outbuf . buf [ outbuf . len ] = '\0' ;
write_buf ( fd , outbuf . buf , outbuf . len + 1 ) ;
outbuf . len = 0 ;
}
# endif else write_buf ( fd , args [ i ] , strlen ( args [ i ] ) + 1 ) ;
}
while ( args [ ++ i ] ) ;
write_byte ( fd , 0 ) ;
# ifdef ICONV_OPTION if ( convert ) free ( outbuf . buf ) ;
# endif }
| 0
|
EC_KEY * d2i_ECPrivateKey_bio ( BIO * bp , EC_KEY * * eckey ) {
return ASN1_d2i_bio_of ( EC_KEY , EC_KEY_new , d2i_ECPrivateKey , bp , eckey ) ;
}
| 0
|
int gs_copydevice ( gx_device * * pnew_dev , const gx_device * dev , gs_memory_t * mem ) {
return gs_copydevice2 ( pnew_dev , dev , false , mem ) ;
}
| 0
|
static char * expand_escapes ( const char * line , SERVER_REC * server , WI_ITEM_REC * item ) {
char * ptr , * ret ;
const char * prev ;
int chr ;
prev = line ;
ret = ptr = g_malloc ( strlen ( line ) + 1 ) ;
for ( ;
* line != '\0' ;
line ++ ) {
if ( * line != '\\' ) {
* ptr ++ = * line ;
continue ;
}
line ++ ;
if ( * line == '\0' ) {
* ptr ++ = '\\' ;
break ;
}
chr = expand_escape ( & line ) ;
if ( chr == '\r' || chr == '\n' ) {
if ( prev != line ) {
char * prev_line = g_strndup ( prev , ( line - prev ) - 1 ) ;
event_text ( prev_line , server , item ) ;
g_free ( prev_line ) ;
prev = line + 1 ;
ptr = ret ;
}
}
else if ( chr != - 1 ) {
* ptr ++ = chr ;
}
else {
* ptr ++ = '\\' ;
* ptr ++ = * line ;
}
}
* ptr = '\0' ;
return ret ;
}
| 0
|
void mime_hdr_field_detach ( MIMEHdrImpl * mh , MIMEField * field , bool detach_all_dups ) {
MIMEField * next_dup = field -> m_next_dup ;
if ( field -> is_detached ( ) ) {
ink_assert ( next_dup == nullptr ) ;
return ;
}
ink_assert ( field -> is_live ( ) ) ;
MIME_HDR_SANITY_CHECK ( mh ) ;
if ( field -> m_flags & MIME_FIELD_SLOT_FLAGS_DUP_HEAD ) {
if ( ! next_dup ) {
mime_hdr_unset_accelerators_and_presence_bits ( mh , field ) ;
}
else {
next_dup -> m_flags |= MIME_FIELD_SLOT_FLAGS_DUP_HEAD ;
mime_hdr_set_accelerators_and_presence_bits ( mh , next_dup ) ;
}
}
else {
int name_length ;
const char * name = mime_field_name_get ( field , & name_length ) ;
MIMEField * prev = mime_hdr_field_find ( mh , name , name_length ) ;
while ( prev && ( prev -> m_next_dup != field ) ) {
prev = prev -> m_next_dup ;
}
ink_assert ( prev != nullptr ) ;
if ( prev -> m_next_dup == field ) {
prev -> m_next_dup = next_dup ;
}
}
field -> m_readiness = MIME_FIELD_SLOT_READINESS_DETACHED ;
field -> m_next_dup = nullptr ;
if ( field -> is_cooked ( ) ) {
mh -> recompute_cooked_stuff ( field ) ;
}
MIME_HDR_SANITY_CHECK ( mh ) ;
if ( detach_all_dups && next_dup ) {
mime_hdr_field_detach ( mh , next_dup , detach_all_dups ) ;
}
}
| 0
|
static void make_bands ( int16_t * bands , int start , int stop , int num_bands ) {
int k , previous , present ;
float base , prod ;
base = powf ( ( float ) stop / start , 1.0f / num_bands ) ;
prod = start ;
previous = start ;
for ( k = 0 ;
k < num_bands - 1 ;
k ++ ) {
prod *= base ;
present = lrintf ( prod ) ;
bands [ k ] = present - previous ;
previous = present ;
}
bands [ num_bands - 1 ] = stop - previous ;
}
| 1
|
static int _tiffCloseProc ( thandle_t fd ) {
fd_as_handle_union_t fdh ;
fdh . h = fd ;
return ( close ( fdh . fd ) ) ;
}
| 0
|
TSReturnCode TSHttpTxnUpdateCachedObject ( TSHttpTxn txnp ) {
sdk_assert ( sdk_sanity_check_txn ( txnp ) == TS_SUCCESS ) ;
HttpSM * sm = ( HttpSM * ) txnp ;
HttpTransact : : State * s = & ( sm -> t_state ) ;
HTTPInfo * cached_obj_store = & ( sm -> t_state . cache_info . object_store ) ;
HTTPHdr * client_request = & ( sm -> t_state . hdr_info . client_request ) ;
if ( ! cached_obj_store -> valid ( ) || ! cached_obj_store -> response_get ( ) ) {
return TS_ERROR ;
}
if ( ! cached_obj_store -> request_get ( ) && ! client_request -> valid ( ) ) {
return TS_ERROR ;
}
if ( s -> cache_info . write_lock_state == HttpTransact : : CACHE_WL_READ_RETRY ) {
return TS_ERROR ;
}
s -> api_update_cached_object = HttpTransact : : UPDATE_CACHED_OBJECT_PREPARE ;
return TS_SUCCESS ;
}
| 0
|
SPL_METHOD ( DirectoryIterator , getBasename ) {
spl_filesystem_object * intern = ( spl_filesystem_object * ) zend_object_store_get_object ( getThis ( ) TSRMLS_CC ) ;
char * suffix = 0 , * fname ;
int slen = 0 ;
size_t flen ;
if ( zend_parse_parameters ( ZEND_NUM_ARGS ( ) TSRMLS_CC , "|s" , & suffix , & slen ) == FAILURE ) {
return ;
}
php_basename ( intern -> u . dir . entry . d_name , strlen ( intern -> u . dir . entry . d_name ) , suffix , slen , & fname , & flen TSRMLS_CC ) ;
RETURN_STRINGL ( fname , flen , 0 ) ;
}
| 1
|
static char * default_opaque_literal_tag ( tvbuff_t * tvb , guint32 offset , const char * token _U_ , guint8 codepage _U_ , guint32 * length ) {
guint32 data_len = tvb_get_guintvar ( tvb , offset , length ) ;
char * str = wmem_strdup_printf ( wmem_packet_scope ( ) , "(%d bytes of opaque data)" , data_len ) ;
* length += data_len ;
return str ;
}
| 0
|
int main ( int argc , char * argv [ ] ) {
const char * globfile [ ] = {
"one" , "two" , "three" , NULL }
;
char tmpdir [ 32 ] ;
struct passwd * pw ;
const char * cwd ;
int test ;
int fail = 0 ;
int i ;
struct test_case_struct ts ;
if ( argc > 1 ) {
command_line_test ( argv [ 1 ] ) ;
return 0 ;
}
cwd = getcwd ( NULL , 0 ) ;
tmpnam ( tmpdir ) ;
if ( mkdir ( tmpdir , S_IRWXU ) || chdir ( tmpdir ) ) return - 1 ;
else {
int fd ;
for ( i = 0 ;
globfile [ i ] ;
++ i ) if ( ( fd = creat ( globfile [ i ] , S_IRUSR | S_IWUSR ) ) == - 1 || close ( fd ) ) return - 1 ;
}
for ( test = 0 ;
test_case [ test ] . retval != - 1 ;
test ++ ) if ( testit ( & test_case [ test ] ) ) ++ fail ;
pw = getpwnam ( "root" ) ;
if ( pw != NULL ) {
ts . retval = 0 ;
ts . env = NULL ;
ts . words = "~root " ;
ts . flags = 0 ;
ts . wordc = 1 ;
ts . wordv [ 0 ] = pw -> pw_dir ;
ts . ifs = IFS ;
if ( testit ( & ts ) ) ++ fail ;
ts . retval = 0 ;
ts . env = pw -> pw_dir ;
ts . words = "${
var#~root}
x" ;
ts . flags = 0 ;
ts . wordc = 1 ;
ts . wordv [ 0 ] = "x" ;
ts . ifs = IFS ;
if ( testit ( & ts ) ) ++ fail ;
}
setenv ( "HOME" , "/dummy/home" , 1 ) ;
ts . retval = 0 ;
ts . env = NULL ;
ts . words = "~ ~/foo" ;
ts . flags = 0 ;
ts . wordc = 2 ;
ts . wordv [ 0 ] = "/dummy/home" ;
ts . wordv [ 1 ] = "/dummy/home/foo" ;
ts . ifs = IFS ;
if ( testit ( & ts ) ) ++ fail ;
pw = getpwuid ( getuid ( ) ) ;
if ( pw != NULL ) {
unsetenv ( "HOME" ) ;
ts . retval = 0 ;
ts . env = NULL ;
ts . words = "~" ;
ts . flags = 0 ;
ts . wordc = 1 ;
ts . wordv [ 0 ] = pw -> pw_dir ;
ts . ifs = IFS ;
if ( testit ( & ts ) ) ++ fail ;
}
puts ( "tests completed, now cleaning up" ) ;
for ( i = 0 ;
globfile [ i ] ;
++ i ) remove ( globfile [ i ] ) ;
if ( cwd == NULL ) cwd = ".." ;
chdir ( cwd ) ;
rmdir ( tmpdir ) ;
printf ( "tests failed: %d\n" , fail ) ;
return fail != 0 ;
}
| 1
|
static void test_derived ( ) {
MYSQL_STMT * stmt ;
int rc , i ;
MYSQL_BIND my_bind [ 1 ] ;
int32 my_val = 0 ;
ulong my_length = 0L ;
my_bool my_null = FALSE ;
const char * query = "select count(1) from (select f.id from t1 f where f.id=?) as x" ;
myheader ( "test_derived" ) ;
rc = mysql_query ( mysql , "DROP TABLE IF EXISTS t1" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "create table t1 (id int(8), primary key (id)) \ ENGINE=InnoDB DEFAULT CHARSET=utf8" ) ;
myquery ( rc ) ;
rc = mysql_query ( mysql , "insert into t1 values (1)" ) ;
myquery ( rc ) ;
stmt = mysql_simple_prepare ( mysql , query ) ;
check_stmt ( stmt ) ;
memset ( my_bind , 0 , sizeof ( my_bind ) ) ;
my_bind [ 0 ] . buffer_type = MYSQL_TYPE_LONG ;
my_bind [ 0 ] . buffer = ( void * ) & my_val ;
my_bind [ 0 ] . length = & my_length ;
my_bind [ 0 ] . is_null = ( char * ) & my_null ;
my_val = 1 ;
rc = mysql_stmt_bind_param ( stmt , my_bind ) ;
check_execute ( stmt , rc ) ;
for ( i = 0 ;
i < 3 ;
i ++ ) {
rc = mysql_stmt_execute ( stmt ) ;
check_execute ( stmt , rc ) ;
rc = my_process_stmt_result ( stmt ) ;
DIE_UNLESS ( rc == 1 ) ;
}
mysql_stmt_close ( stmt ) ;
rc = mysql_query ( mysql , "DROP TABLE t1" ) ;
myquery ( rc ) ;
}
| 0
|
TEST_F ( WebFrameSimTest , NormalIFrameHasLayoutObjects ) {
SimRequest main_resource ( "https://example.com/test.html" , "text/html" ) ;
SimRequest frame_resource ( "https://example.com/frame.html" , "text/html" ) ;
LoadURL ( "https://example.com/test.html" ) ;
main_resource . Complete ( "<!DOCTYPE html>" "<iframe src=frame.html style='display: block'></iframe>" ) ;
frame_resource . Complete ( "<!DOCTYPE html>" "<html><body>This is a visible iframe.</body></html>" ) ;
Element * element = GetDocument ( ) . QuerySelector ( "iframe" ) ;
HTMLFrameOwnerElement * frame_owner_element = ToHTMLFrameOwnerElement ( element ) ;
Document * iframe_doc = frame_owner_element -> contentDocument ( ) ;
EXPECT_TRUE ( iframe_doc -> documentElement ( ) -> GetLayoutObject ( ) ) ;
element -> SetInlineStyleProperty ( CSSPropertyDisplay , CSSValueNone ) ;
Compositor ( ) . BeginFrame ( ) ;
EXPECT_FALSE ( iframe_doc -> documentElement ( ) -> GetLayoutObject ( ) ) ;
}
| 0
|
int i2d_ ## name ( type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( itname ) # define DECLARE_ASN1_ENCODE_FUNCTIONS_const ( type , name ) type * d2i_ ## name ( type * * a , const unsigned char * * in , long len ) ;
int i2d_ ## name ( const type * a , unsigned char * * out ) ;
DECLARE_ASN1_ITEM ( name ) # define DECLARE_ASN1_NDEF_FUNCTION ( name ) int i2d_ ## name ## _NDEF ( name * a , unsigned char * * out ) ;
# define DECLARE_ASN1_FUNCTIONS_const ( name ) DECLARE_ASN1_ALLOC_FUNCTIONS ( name ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( name , name ) # define DECLARE_ASN1_ALLOC_FUNCTIONS_name ( type , name ) type * name ## _new ( void ) ;
void name ## _free ( type * a ) ;
# define DECLARE_ASN1_PRINT_FUNCTION ( stname ) DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , stname ) # define DECLARE_ASN1_PRINT_FUNCTION_fname ( stname , fname ) int fname ## _print_ctx ( BIO * out , stname * x , int indent , const ASN1_PCTX * pctx ) ;
# define D2I_OF ( type ) type * ( * ) ( type * * , const unsigned char * * , long ) # define I2D_OF ( type ) int ( * ) ( type * , unsigned char * * ) # define I2D_OF_const ( type ) int ( * ) ( const type * , unsigned char * * ) # define CHECKED_D2I_OF ( type , d2i ) ( ( d2i_of_void * ) ( 1 ? d2i : ( ( D2I_OF ( type ) ) 0 ) ) ) # define CHECKED_I2D_OF ( type , i2d ) ( ( i2d_of_void * ) ( 1 ? i2d : ( ( I2D_OF ( type ) ) 0 ) ) ) # define CHECKED_NEW_OF ( type , xnew ) ( ( void * ( * ) ( void ) ) ( 1 ? xnew : ( ( type * ( * ) ( void ) ) 0 ) ) ) # define CHECKED_PTR_OF ( type , p ) ( ( void * ) ( 1 ? p : ( type * ) 0 ) ) # define CHECKED_PPTR_OF ( type , p ) ( ( void * * ) ( 1 ? p : ( type * * ) 0 ) ) # define TYPEDEF_D2I_OF ( type ) typedef type * d2i_of_ ## type ( type * * , const unsigned char * * , long ) # define TYPEDEF_I2D_OF ( type ) typedef int i2d_of_ ## type ( type * , unsigned char * * ) # define TYPEDEF_D2I2D_OF ( type ) TYPEDEF_D2I_OF ( type ) ;
TYPEDEF_I2D_OF ( type ) TYPEDEF_D2I2D_OF ( void ) ;
# ifndef OPENSSL_EXPORT_VAR_AS_FUNCTION typedef const ASN1_ITEM ASN1_ITEM_EXP ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ) # define ASN1_ITEM_ref ( iptr ) ( & ( iptr ## _it ) ) # define ASN1_ITEM_rptr ( ref ) ( & ( ref ## _it ) ) # define DECLARE_ASN1_ITEM ( name ) OPENSSL_EXTERN const ASN1_ITEM name ## _it ;
# else typedef const ASN1_ITEM * ASN1_ITEM_EXP ( void ) ;
# define ASN1_ITEM_ptr ( iptr ) ( iptr ( ) ) # define ASN1_ITEM_ref ( iptr ) ( iptr ## _it ) # define ASN1_ITEM_rptr ( ref ) ( ref ## _it ( ) ) # define DECLARE_ASN1_ITEM ( name ) const ASN1_ITEM * name ## _it ( void ) ;
# endif # define ASN1_STRFLGS_ESC_2253 1 # define ASN1_STRFLGS_ESC_CTRL 2 # define ASN1_STRFLGS_ESC_MSB 4 # define ASN1_STRFLGS_ESC_QUOTE 8 # define CHARTYPE_PRINTABLESTRING 0x10 # define CHARTYPE_FIRST_ESC_2253 0x20 # define CHARTYPE_LAST_ESC_2253 0x40 # define ASN1_STRFLGS_UTF8_CONVERT 0x10 # define ASN1_STRFLGS_IGNORE_TYPE 0x20 # define ASN1_STRFLGS_SHOW_TYPE 0x40 # define ASN1_STRFLGS_DUMP_ALL 0x80 # define ASN1_STRFLGS_DUMP_UNKNOWN 0x100 # define ASN1_STRFLGS_DUMP_DER 0x200 # define ASN1_STRFLGS_ESC_2254 0x400 # define ASN1_STRFLGS_RFC2253 ( ASN1_STRFLGS_ESC_2253 | ASN1_STRFLGS_ESC_CTRL | ASN1_STRFLGS_ESC_MSB | ASN1_STRFLGS_UTF8_CONVERT | ASN1_STRFLGS_DUMP_UNKNOWN | ASN1_STRFLGS_DUMP_DER ) DEFINE_STACK_OF ( ASN1_INTEGER ) DEFINE_STACK_OF ( ASN1_GENERALSTRING ) DEFINE_STACK_OF ( ASN1_UTF8STRING ) typedef struct asn1_type_st {
int type ;
union {
char * ptr ;
ASN1_BOOLEAN boolean ;
ASN1_STRING * asn1_string ;
ASN1_OBJECT * object ;
ASN1_INTEGER * integer ;
ASN1_ENUMERATED * enumerated ;
ASN1_BIT_STRING * bit_string ;
ASN1_OCTET_STRING * octet_string ;
ASN1_PRINTABLESTRING * printablestring ;
ASN1_T61STRING * t61string ;
ASN1_IA5STRING * ia5string ;
ASN1_GENERALSTRING * generalstring ;
ASN1_BMPSTRING * bmpstring ;
ASN1_UNIVERSALSTRING * universalstring ;
ASN1_UTCTIME * utctime ;
ASN1_GENERALIZEDTIME * generalizedtime ;
ASN1_VISIBLESTRING * visiblestring ;
ASN1_UTF8STRING * utf8string ;
ASN1_STRING * set ;
ASN1_STRING * sequence ;
ASN1_VALUE * asn1_value ;
}
value ;
}
ASN1_TYPE ;
DEFINE_STACK_OF ( ASN1_TYPE ) typedef STACK_OF ( ASN1_TYPE ) ASN1_SEQUENCE_ANY ;
DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SEQUENCE_ANY ) DECLARE_ASN1_ENCODE_FUNCTIONS_const ( ASN1_SEQUENCE_ANY , ASN1_SET_ANY ) typedef struct BIT_STRING_BITNAME_st {
int bitnum ;
const char * lname ;
const char * sname ;
}
BIT_STRING_BITNAME ;
# define B_ASN1_TIME B_ASN1_UTCTIME | B_ASN1_GENERALIZEDTIME # define B_ASN1_PRINTABLE B_ASN1_NUMERICSTRING | B_ASN1_PRINTABLESTRING | B_ASN1_T61STRING | B_ASN1_IA5STRING | B_ASN1_BIT_STRING | B_ASN1_UNIVERSALSTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING | B_ASN1_SEQUENCE | B_ASN1_UNKNOWN # define B_ASN1_DIRECTORYSTRING B_ASN1_PRINTABLESTRING | B_ASN1_TELETEXSTRING | B_ASN1_BMPSTRING | B_ASN1_UNIVERSALSTRING | B_ASN1_UTF8STRING # define B_ASN1_DISPLAYTEXT B_ASN1_IA5STRING | B_ASN1_VISIBLESTRING | B_ASN1_BMPSTRING | B_ASN1_UTF8STRING DECLARE_ASN1_FUNCTIONS_fname ( ASN1_TYPE , ASN1_ANY , ASN1_TYPE ) int ASN1_TYPE_get ( const ASN1_TYPE * a ) ;
void ASN1_TYPE_set ( ASN1_TYPE * a , int type , void * value ) ;
int ASN1_TYPE_set1 ( ASN1_TYPE * a , int type , const void * value ) ;
int ASN1_TYPE_cmp ( const ASN1_TYPE * a , const ASN1_TYPE * b ) ;
ASN1_TYPE * ASN1_TYPE_pack_sequence ( const ASN1_ITEM * it , void * s , ASN1_TYPE * * t ) ;
void * ASN1_TYPE_unpack_sequence ( const ASN1_ITEM * it , const ASN1_TYPE * t ) ;
ASN1_OBJECT * ASN1_OBJECT_new ( void ) ;
void ASN1_OBJECT_free ( ASN1_OBJECT * a ) ;
int i2d_ASN1_OBJECT ( const ASN1_OBJECT * a , unsigned char * * pp ) ;
ASN1_OBJECT * d2i_ASN1_OBJECT ( ASN1_OBJECT * * a , const unsigned char * * pp , long length ) ;
DECLARE_ASN1_ITEM ( ASN1_OBJECT ) DEFINE_STACK_OF ( ASN1_OBJECT ) ASN1_STRING * ASN1_STRING_new ( void ) ;
void ASN1_STRING_free ( ASN1_STRING * a ) ;
void ASN1_STRING_clear_free ( ASN1_STRING * a ) ;
int ASN1_STRING_copy ( ASN1_STRING * dst , const ASN1_STRING * str ) ;
ASN1_STRING * ASN1_STRING_dup ( const ASN1_STRING * a ) ;
ASN1_STRING * ASN1_STRING_type_new ( int type ) ;
int ASN1_STRING_cmp ( const ASN1_STRING * a , const ASN1_STRING * b ) ;
int ASN1_STRING_set ( ASN1_STRING * str , const void * data , int len ) ;
void ASN1_STRING_set0 ( ASN1_STRING * str , void * data , int len ) ;
int ASN1_STRING_length ( const ASN1_STRING * x ) ;
void ASN1_STRING_length_set ( ASN1_STRING * x , int n ) ;
int ASN1_STRING_type ( const ASN1_STRING * x ) ;
DEPRECATEDIN_1_1_0 ( unsigned char * ASN1_STRING_data ( ASN1_STRING * x ) ) const unsigned char * ASN1_STRING_get0_data ( const ASN1_STRING * x ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_BIT_STRING ) int ASN1_BIT_STRING_set ( ASN1_BIT_STRING * a , unsigned char * d , int length ) ;
int ASN1_BIT_STRING_set_bit ( ASN1_BIT_STRING * a , int n , int value ) ;
int ASN1_BIT_STRING_get_bit ( const ASN1_BIT_STRING * a , int n ) ;
int ASN1_BIT_STRING_check ( const ASN1_BIT_STRING * a , const unsigned char * flags , int flags_len ) ;
int ASN1_BIT_STRING_name_print ( BIO * out , ASN1_BIT_STRING * bs , BIT_STRING_BITNAME * tbl , int indent ) ;
int ASN1_BIT_STRING_num_asc ( const char * name , BIT_STRING_BITNAME * tbl ) ;
int ASN1_BIT_STRING_set_asc ( ASN1_BIT_STRING * bs , const char * name , int value , BIT_STRING_BITNAME * tbl ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_INTEGER ) ASN1_INTEGER * d2i_ASN1_UINTEGER ( ASN1_INTEGER * * a , const unsigned char * * pp , long length ) ;
ASN1_INTEGER * ASN1_INTEGER_dup ( const ASN1_INTEGER * x ) ;
int ASN1_INTEGER_cmp ( const ASN1_INTEGER * x , const ASN1_INTEGER * y ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_ENUMERATED ) int ASN1_UTCTIME_check ( const ASN1_UTCTIME * a ) ;
ASN1_UTCTIME * ASN1_UTCTIME_set ( ASN1_UTCTIME * s , time_t t ) ;
ASN1_UTCTIME * ASN1_UTCTIME_adj ( ASN1_UTCTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_UTCTIME_set_string ( ASN1_UTCTIME * s , const char * str ) ;
int ASN1_UTCTIME_cmp_time_t ( const ASN1_UTCTIME * s , time_t t ) ;
int ASN1_GENERALIZEDTIME_check ( const ASN1_GENERALIZEDTIME * a ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_set ( ASN1_GENERALIZEDTIME * s , time_t t ) ;
ASN1_GENERALIZEDTIME * ASN1_GENERALIZEDTIME_adj ( ASN1_GENERALIZEDTIME * s , time_t t , int offset_day , long offset_sec ) ;
int ASN1_GENERALIZEDTIME_set_string ( ASN1_GENERALIZEDTIME * s , const char * str ) ;
int ASN1_TIME_diff ( int * pday , int * psec , const ASN1_TIME * from , const ASN1_TIME * to ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_OCTET_STRING ) ASN1_OCTET_STRING * ASN1_OCTET_STRING_dup ( const ASN1_OCTET_STRING * a ) ;
int ASN1_OCTET_STRING_cmp ( const ASN1_OCTET_STRING * a , const ASN1_OCTET_STRING * b ) ;
int ASN1_OCTET_STRING_set ( ASN1_OCTET_STRING * str , const unsigned char * data , int len ) ;
DECLARE_ASN1_FUNCTIONS ( ASN1_VISIBLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UNIVERSALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTF8STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_NULL ) DECLARE_ASN1_FUNCTIONS ( ASN1_BMPSTRING ) int UTF8_getc ( const unsigned char * str , int len , unsigned long * val ) ;
int UTF8_putc ( unsigned char * str , int len , unsigned long value ) ;
DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , ASN1_PRINTABLE ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DIRECTORYSTRING ) DECLARE_ASN1_FUNCTIONS_name ( ASN1_STRING , DISPLAYTEXT ) DECLARE_ASN1_FUNCTIONS ( ASN1_PRINTABLESTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_T61STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_IA5STRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_GENERALSTRING ) DECLARE_ASN1_FUNCTIONS ( ASN1_UTCTIME ) DECLARE_ASN1_FUNCTIONS ( ASN1_GENERALIZEDTIME ) DECLARE_ASN1_FUNCTIONS ( ASN1_TIME )
| 1
|
static inline MagickRealType GetPixelInfoLuminance ( const PixelInfo * restrict pixel ) {
MagickRealType blue , green , red ;
if ( pixel -> colorspace == GRAYColorspace ) return ( pixel -> red ) ;
if ( pixel -> colorspace != sRGBColorspace ) return ( 0.212656f * pixel -> red + 0.715158f * pixel -> green + 0.072186f * pixel -> blue ) ;
red = DecodePixelGamma ( pixel -> red ) ;
green = DecodePixelGamma ( pixel -> green ) ;
blue = DecodePixelGamma ( pixel -> blue ) ;
return ( 0.212656f * red + 0.715158f * green + 0.072186f * blue ) ;
}
| 0
|
static int dissect_h225_SIPCaps ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_SIPCaps , SIPCaps_sequence ) ;
return offset ;
}
| 0
|
static int dissect_h225_Endpoint ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_sequence ( tvb , offset , actx , tree , hf_index , ett_h225_Endpoint , Endpoint_sequence ) ;
return offset ;
}
| 0
|
static void sbr_hf_apply_noise_0 ( float ( * Y ) [ 2 ] , const float * s_m , const float * q_filt , int noise , int kx , int m_max ) {
sbr_hf_apply_noise ( Y , s_m , q_filt , noise , 1.0 , 0.0 , m_max ) ;
}
| 1
|
static int dissect_h245_BOOLEAN ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_boolean ( tvb , offset , actx , tree , hf_index , NULL ) ;
return offset ;
}
| 0
|
static int rtp_packetize_spx ( sout_stream_id_sys_t * id , block_t * in ) {
uint8_t * p_buffer = in -> p_buffer ;
int i_data_size , i_payload_size , i_payload_padding ;
i_data_size = i_payload_size = in -> i_buffer ;
i_payload_padding = 0 ;
block_t * p_out ;
if ( in -> i_buffer > rtp_mtu ( id ) ) {
block_Release ( in ) ;
return VLC_SUCCESS ;
}
if ( i_payload_size % 4 ) {
i_payload_padding = 4 - ( i_payload_size % 4 ) ;
i_payload_size += i_payload_padding ;
}
p_out = block_Alloc ( 12 + i_payload_size ) ;
if ( i_payload_padding ) {
char c_first_pad , c_remaining_pad ;
c_first_pad = 0x7F ;
c_remaining_pad = 0xFF ;
p_out -> p_buffer [ 12 + i_data_size ] = c_first_pad ;
switch ( i_payload_padding ) {
case 2 : p_out -> p_buffer [ 12 + i_data_size + 1 ] = c_remaining_pad ;
break ;
case 3 : p_out -> p_buffer [ 12 + i_data_size + 1 ] = c_remaining_pad ;
p_out -> p_buffer [ 12 + i_data_size + 2 ] = c_remaining_pad ;
break ;
}
}
rtp_packetize_common ( id , p_out , 0 , ( in -> i_pts > VLC_TS_INVALID ? in -> i_pts : in -> i_dts ) ) ;
memcpy ( & p_out -> p_buffer [ 12 ] , p_buffer , i_data_size ) ;
p_out -> i_dts = in -> i_dts ;
p_out -> i_length = in -> i_length ;
block_Release ( in ) ;
rtp_packetize_send ( id , p_out ) ;
return VLC_SUCCESS ;
}
| 0
|
static void cat_blob ( struct object_entry * oe , unsigned char sha1 [ 20 ] ) {
struct strbuf line = STRBUF_INIT ;
unsigned long size ;
enum object_type type = 0 ;
char * buf ;
if ( ! oe || oe -> pack_id == MAX_PACK_ID ) {
buf = read_sha1_file ( sha1 , & type , & size ) ;
}
else {
type = oe -> type ;
buf = gfi_unpack_entry ( oe , & size ) ;
}
if ( type <= 0 ) {
strbuf_reset ( & line ) ;
strbuf_addf ( & line , "%s missing\n" , sha1_to_hex ( sha1 ) ) ;
cat_blob_write ( line . buf , line . len ) ;
strbuf_release ( & line ) ;
free ( buf ) ;
return ;
}
if ( ! buf ) die ( "Can't read object %s" , sha1_to_hex ( sha1 ) ) ;
if ( type != OBJ_BLOB ) die ( "Object %s is a %s but a blob was expected." , sha1_to_hex ( sha1 ) , typename ( type ) ) ;
strbuf_reset ( & line ) ;
strbuf_addf ( & line , "%s %s %lu\n" , sha1_to_hex ( sha1 ) , typename ( type ) , size ) ;
cat_blob_write ( line . buf , line . len ) ;
strbuf_release ( & line ) ;
cat_blob_write ( buf , size ) ;
cat_blob_write ( "\n" , 1 ) ;
if ( oe && oe -> pack_id == pack_id ) {
last_blob . offset = oe -> idx . offset ;
strbuf_attach ( & last_blob . data , buf , size , size ) ;
last_blob . depth = oe -> depth ;
}
else free ( buf ) ;
}
| 0
|
static int dissect_pbb_tlvblock ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , guint offset , guint maxoffset , gint8 addrCount , guint tlvCat ) {
guint16 tlvblockLength ;
guint tlvblockEnd ;
proto_tree * tlvblock_tree = NULL ;
proto_tree * tlv_tree = NULL ;
proto_tree * tlv_flags_tree = NULL ;
proto_tree * tlvValue_tree = NULL ;
proto_item * tlvBlock_item = NULL ;
proto_item * tlv_item = NULL ;
proto_item * tlvFlags_item = NULL ;
proto_item * tlvValue_item = NULL ;
proto_item * ti = NULL ;
int tlvCount = 0 ;
int hf_packetbb_tlv_type = 0 ;
const value_string * tlv_type_vals = NULL ;
if ( maxoffset < offset + 2 ) {
proto_tree_add_expert_format ( tree , pinfo , & ei_packetbb_error , tvb , offset , maxoffset - offset , "Not enough octets for minimal tlvblock" ) ;
return maxoffset ;
}
tlvblockLength = tvb_get_ntohs ( tvb , offset ) ;
tlvblockEnd = offset + 2 + tlvblockLength ;
if ( maxoffset < tlvblockEnd ) {
proto_tree_add_expert_format ( tree , pinfo , & ei_packetbb_error , tvb , offset , maxoffset - offset , "Not enough octets for tlvblock" ) ;
return maxoffset ;
}
tlvBlock_item = proto_tree_add_item ( tree , hf_packetbb_tlvblock , tvb , offset , tlvblockEnd - offset , ENC_NA ) ;
tlvblock_tree = proto_item_add_subtree ( tlvBlock_item , ett_packetbb_tlvblock ) ;
proto_tree_add_item ( tlvblock_tree , hf_packetbb_tlvblock_length , tvb , offset , 2 , ENC_BIG_ENDIAN ) ;
offset += 2 ;
while ( offset < tlvblockEnd ) {
guint tlvStart , tlvLength ;
guint8 tlvType , tlvFlags , tlvExtType , indexStart , indexEnd ;
guint16 length = 0 ;
tlvStart = offset ;
tlvType = tvb_get_guint8 ( tvb , offset ++ ) ;
tlvFlags = tvb_get_guint8 ( tvb , offset ++ ) ;
indexStart = 0 ;
indexEnd = addrCount ? ( addrCount - 1 ) : 0 ;
tlvExtType = 0 ;
if ( ( tlvFlags & TLV_HAS_TYPEEXT ) != 0 ) {
tlvExtType = tvb_get_guint8 ( tvb , offset ++ ) ;
}
if ( ( tlvFlags & TLV_HAS_SINGLEINDEX ) != 0 ) {
indexStart = indexEnd = tvb_get_guint8 ( tvb , offset ++ ) ;
}
else if ( ( tlvFlags & TLV_HAS_MULTIINDEX ) != 0 ) {
indexStart = tvb_get_guint8 ( tvb , offset ++ ) ;
indexEnd = tvb_get_guint8 ( tvb , offset ++ ) ;
}
if ( ( tlvFlags & TLV_HAS_VALUE ) != 0 ) {
if ( ( tlvFlags & TLV_HAS_EXTLEN ) != 0 ) {
length = tvb_get_ntohs ( tvb , offset ++ ) ;
}
else {
length = tvb_get_guint8 ( tvb , offset ++ ) ;
}
}
tlvLength = offset - tlvStart + length ;
offset = tlvStart ;
tlv_item = proto_tree_add_item ( tlvBlock_item , hf_packetbb_tlv , tvb , tlvStart , tlvLength , ENC_NA ) ;
tlv_tree = proto_item_add_subtree ( tlv_item , ett_packetbb_tlv [ tlvType ] ) ;
if ( tlvCat == TLV_CAT_PACKET ) {
hf_packetbb_tlv_type = hf_packetbb_pkttlv_type ;
tlv_type_vals = pkttlv_type_vals ;
}
else if ( tlvCat == TLV_CAT_MESSAGE ) {
hf_packetbb_tlv_type = hf_packetbb_msgtlv_type ;
tlv_type_vals = msgtlv_type_vals ;
}
else {
hf_packetbb_tlv_type = hf_packetbb_addrtlv_type ;
tlv_type_vals = addrtlv_type_vals ;
}
if ( ( tlvFlags & TLV_HAS_TYPEEXT ) == 0 ) {
proto_item_append_text ( tlv_item , " (%s)" , val_to_str_const ( tlvType , tlv_type_vals , "Unknown type" ) ) ;
}
else {
proto_item_append_text ( tlv_item , " (%s / %d)" , val_to_str_const ( tlvType , tlv_type_vals , "Unknown type" ) , tlvExtType ) ;
}
proto_tree_add_item ( tlv_tree , hf_packetbb_tlv_type , tvb , offset ++ , 1 , ENC_BIG_ENDIAN ) ;
tlvFlags_item = proto_tree_add_item ( tlv_tree , hf_packetbb_tlv_flags , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
tlv_flags_tree = proto_item_add_subtree ( tlvFlags_item , ett_packetbb_tlv_flags ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hastypext , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hassingleindex , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hasmultiindex , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hasvalue , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hasextlen , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
proto_tree_add_item ( tlv_flags_tree , hf_packetbb_tlv_flags_hasmultivalue , tvb , offset , 1 , ENC_BIG_ENDIAN ) ;
offset ++ ;
if ( ( tlvFlags & TLV_HAS_TYPEEXT ) != 0 ) {
proto_tree_add_item ( tlv_tree , hf_packetbb_tlv_typeext , tvb , offset ++ , 1 , ENC_BIG_ENDIAN ) ;
}
if ( addrCount > 0 ) {
if ( ( tlvFlags & TLV_HAS_SINGLEINDEX ) != 0 ) {
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexstart , tvb , offset ++ , 1 , indexStart ) ;
ti = proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexend , tvb , offset , 0 , indexEnd ) ;
proto_item_append_text ( ti , " (implicit)" ) ;
}
else if ( ( tlvFlags & TLV_HAS_MULTIINDEX ) != 0 ) {
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexstart , tvb , offset ++ , 1 , indexStart ) ;
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexend , tvb , offset ++ , 1 , indexEnd ) ;
}
else {
ti = proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexstart , tvb , offset , 0 , indexStart ) ;
proto_item_append_text ( ti , " (implicit)" ) ;
ti = proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_indexend , tvb , offset , 0 , indexEnd ) ;
proto_item_append_text ( ti , " (implicit)" ) ;
}
}
if ( ( tlvFlags & TLV_HAS_VALUE ) != 0 ) {
if ( ( tlvFlags & TLV_HAS_EXTLEN ) != 0 ) {
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_length , tvb , offset , 2 , length ) ;
offset += 2 ;
}
else {
proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_length , tvb , offset ++ , 1 , length ) ;
}
}
else {
ti = proto_tree_add_uint ( tlv_tree , hf_packetbb_tlv_length , tvb , offset , 0 , 0 ) ;
proto_item_append_text ( ti , " (implicit)" ) ;
}
if ( length > 0 ) {
tlvValue_item = proto_tree_add_item ( tlv_tree , hf_packetbb_tlv_value , tvb , offset , length , ENC_NA ) ;
if ( ( tlvFlags & TLV_HAS_MULTIVALUE ) == 0 ) {
offset += length ;
}
else {
int i ;
guint8 c = indexEnd - indexStart + 1 ;
tlvValue_tree = proto_item_add_subtree ( tlvValue_item , ett_packetbb_tlv_value ) ;
for ( i = indexStart ;
i <= indexEnd ;
i ++ ) {
proto_tree_add_item ( tlvValue_tree , hf_packetbb_tlv_multivalue , tvb , offset , length / c , ENC_NA ) ;
offset += ( length / c ) ;
}
}
}
tlvCount ++ ;
}
proto_item_append_text ( tlvBlock_item , " (%d TLVs)" , tlvCount ) ;
return offset ;
}
| 1
|
static int cirrus_get_bpp ( VGACommonState * s1 ) {
CirrusVGAState * s = container_of ( s1 , CirrusVGAState , vga ) ;
uint32_t ret = 8 ;
if ( ( s -> vga . sr [ 0x07 ] & 0x01 ) != 0 ) {
switch ( s -> vga . sr [ 0x07 ] & CIRRUS_SR7_BPP_MASK ) {
case CIRRUS_SR7_BPP_8 : ret = 8 ;
break ;
case CIRRUS_SR7_BPP_16_DOUBLEVCLK : ret = cirrus_get_bpp16_depth ( s ) ;
break ;
case CIRRUS_SR7_BPP_24 : ret = 24 ;
break ;
case CIRRUS_SR7_BPP_16 : ret = cirrus_get_bpp16_depth ( s ) ;
break ;
case CIRRUS_SR7_BPP_32 : ret = 32 ;
break ;
default : # ifdef DEBUG_CIRRUS printf ( "cirrus: unknown bpp - sr7=%x\n" , s -> vga . sr [ 0x7 ] ) ;
# endif ret = 8 ;
break ;
}
}
else {
ret = 0 ;
}
return ret ;
}
| 0
|
void proto_reg_handoff_zbee_zcl_basic ( void ) {
dissector_handle_t basic_handle ;
basic_handle = find_dissector ( ZBEE_PROTOABBREV_ZCL_BASIC ) ;
dissector_add_uint ( "zbee.zcl.cluster" , ZBEE_ZCL_CID_BASIC , basic_handle ) ;
zbee_zcl_init_cluster ( proto_zbee_zcl_basic , ett_zbee_zcl_basic , ZBEE_ZCL_CID_BASIC , hf_zbee_zcl_basic_attr_id , hf_zbee_zcl_basic_srv_rx_cmd_id , - 1 , ( zbee_zcl_fn_attr_data ) dissect_zcl_basic_attr_data ) ;
}
| 0
|
void mime_hdr_presence_set ( MIMEHdrImpl * h , int well_known_str_index ) {
const char * wks = hdrtoken_index_to_wks ( well_known_str_index ) ;
mime_hdr_presence_set ( h , wks ) ;
}
| 0
|
static void gst_asf_demux_get_guid ( ASFGuid * guid , guint8 * * p_data , guint64 * p_size ) {
g_assert ( * p_size >= 4 * sizeof ( guint32 ) ) ;
guid -> v1 = gst_asf_demux_get_uint32 ( p_data , p_size ) ;
guid -> v2 = gst_asf_demux_get_uint32 ( p_data , p_size ) ;
guid -> v3 = gst_asf_demux_get_uint32 ( p_data , p_size ) ;
guid -> v4 = gst_asf_demux_get_uint32 ( p_data , p_size ) ;
}
| 0
|
static int evport_dispatch ( struct event_base * base , void * arg , struct timeval * tv ) {
int i , res ;
struct evport_data * epdp = arg ;
port_event_t pevtlist [ EVENTS_PER_GETN ] ;
int nevents = 1 ;
struct timespec ts ;
struct timespec * ts_p = NULL ;
if ( tv != NULL ) {
ts . tv_sec = tv -> tv_sec ;
ts . tv_nsec = tv -> tv_usec * 1000 ;
ts_p = & ts ;
}
for ( i = 0 ;
i < EVENTS_PER_GETN ;
++ i ) {
struct fd_info * fdi = NULL ;
if ( epdp -> ed_pending [ i ] != - 1 ) {
fdi = & ( epdp -> ed_fds [ epdp -> ed_pending [ i ] ] ) ;
}
if ( fdi != NULL && FDI_HAS_EVENTS ( fdi ) ) {
int fd = FDI_HAS_READ ( fdi ) ? fdi -> fdi_revt -> ev_fd : fdi -> fdi_wevt -> ev_fd ;
reassociate ( epdp , fdi , fd ) ;
epdp -> ed_pending [ i ] = - 1 ;
}
}
if ( ( res = port_getn ( epdp -> ed_port , pevtlist , EVENTS_PER_GETN , ( unsigned int * ) & nevents , ts_p ) ) == - 1 ) {
if ( errno == EINTR || errno == EAGAIN ) {
evsignal_process ( base ) ;
return ( 0 ) ;
}
else if ( errno == ETIME ) {
if ( nevents == 0 ) return ( 0 ) ;
}
else {
event_warn ( "port_getn" ) ;
return ( - 1 ) ;
}
}
else if ( base -> sig . evsignal_caught ) {
evsignal_process ( base ) ;
}
event_debug ( ( "%s: port_getn reports %d events" , __func__ , nevents ) ) ;
for ( i = 0 ;
i < nevents ;
++ i ) {
struct event * ev ;
struct fd_info * fdi ;
port_event_t * pevt = & pevtlist [ i ] ;
int fd = ( int ) pevt -> portev_object ;
check_evportop ( epdp ) ;
check_event ( pevt ) ;
epdp -> ed_pending [ i ] = fd ;
res = 0 ;
if ( pevt -> portev_events & POLLIN ) res |= EV_READ ;
if ( pevt -> portev_events & POLLOUT ) res |= EV_WRITE ;
if ( pevt -> portev_events & ( POLLERR | POLLHUP | POLLNVAL ) ) res |= EV_READ | EV_WRITE ;
assert ( epdp -> ed_nevents > fd ) ;
fdi = & ( epdp -> ed_fds [ fd ] ) ;
if ( ( res & EV_READ ) && ( ( ev = fdi -> fdi_revt ) != NULL ) ) {
event_active ( ev , res , 1 ) ;
}
if ( ( res & EV_WRITE ) && ( ( ev = fdi -> fdi_wevt ) != NULL ) ) {
event_active ( ev , res , 1 ) ;
}
}
check_evportop ( epdp ) ;
return ( 0 ) ;
}
| 0
|
static inline bool SchroSetEnum ( const encoder_t * p_enc , int i_list_size , const char * list [ ] , const char * psz_name , const char * psz_name_text , const char * psz_value ) {
encoder_sys_t * p_sys = p_enc -> p_sys ;
if ( list && psz_name_text && psz_name && psz_value ) {
for ( int i = 0 ;
i < i_list_size ;
++ i ) {
if ( strcmp ( list [ i ] , psz_value ) ) continue ;
schro_encoder_setting_set_double ( p_sys -> p_schro , psz_name , i ) ;
return true ;
}
msg_Err ( p_enc , "Invalid %s: %s" , psz_name_text , psz_value ) ;
}
return false ;
}
| 0
|
static void set_VD_bp ( unsigned char * bp , enum VD_type type , unsigned char ver ) {
bp [ 1 ] = ( unsigned char ) type ;
memcpy ( bp + 2 , "CD001" , 5 ) ;
bp [ 7 ] = ver ;
}
| 0
|
static int dissect_h245_INTEGER_0_255 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 255U , NULL , FALSE ) ;
return offset ;
}
| 0
|
static void cmd_channel_modify ( const char * data ) {
cmd_channel_add_modify ( data , FALSE ) ;
}
| 0
|
static const char * cmd_request_encoding ( cmd_parms * cmd , void * _dcfg , const char * p1 ) {
directory_config * dcfg = ( directory_config * ) _dcfg ;
if ( dcfg == NULL ) return NULL ;
dcfg -> request_encoding = p1 ;
return NULL ;
}
| 0
|
int mi_repair_by_sort ( MI_CHECK * param , register MI_INFO * info , const char * name , int rep_quick ) {
int got_error ;
uint i ;
ulong length ;
ha_rows start_records ;
my_off_t new_header_length , del ;
File new_file ;
MI_SORT_PARAM sort_param ;
MYISAM_SHARE * share = info -> s ;
HA_KEYSEG * keyseg ;
ulong * rec_per_key_part ;
char llbuff [ 22 ] ;
SORT_INFO sort_info ;
ulonglong UNINIT_VAR ( key_map ) ;
DBUG_ENTER ( "mi_repair_by_sort" ) ;
start_records = info -> state -> records ;
got_error = 1 ;
new_file = - 1 ;
new_header_length = ( param -> testflag & T_UNPACK ) ? 0 : share -> pack . header_length ;
if ( ! ( param -> testflag & T_SILENT ) ) {
printf ( "- recovering (with sort) MyISAM-table '%s'\n" , name ) ;
printf ( "Data records: %s\n" , llstr ( start_records , llbuff ) ) ;
}
param -> testflag |= T_REP ;
if ( info -> s -> options & ( HA_OPTION_CHECKSUM | HA_OPTION_COMPRESS_RECORD ) ) param -> testflag |= T_CALC_CHECKSUM ;
bzero ( ( char * ) & sort_info , sizeof ( sort_info ) ) ;
bzero ( ( char * ) & sort_param , sizeof ( sort_param ) ) ;
if ( ! ( sort_info . key_block = alloc_key_blocks ( param , ( uint ) param -> sort_key_blocks , share -> base . max_key_block_length ) ) || init_io_cache ( & param -> read_cache , info -> dfile , ( uint ) param -> read_buffer_length , READ_CACHE , share -> pack . header_length , 1 , MYF ( MY_WME ) ) || ( ! rep_quick && init_io_cache ( & info -> rec_cache , info -> dfile , ( uint ) param -> write_buffer_length , WRITE_CACHE , new_header_length , 1 , MYF ( MY_WME | MY_WAIT_IF_FULL ) & param -> myf_rw ) ) ) goto err ;
sort_info . key_block_end = sort_info . key_block + param -> sort_key_blocks ;
info -> opt_flag |= WRITE_CACHE_USED ;
info -> rec_cache . file = info -> dfile ;
if ( ! mi_alloc_rec_buff ( info , - 1 , & sort_param . record ) || ! mi_alloc_rec_buff ( info , - 1 , & sort_param . rec_buff ) ) {
mi_check_print_error ( param , "Not enough memory for extra record" ) ;
goto err ;
}
if ( ! rep_quick ) {
if ( ( new_file = mysql_file_create ( mi_key_file_datatmp , fn_format ( param -> temp_filename , share -> data_file_name , "" , DATA_TMP_EXT , 2 + 4 ) , 0 , param -> tmpfile_createflag , MYF ( 0 ) ) ) < 0 ) {
mi_check_print_error ( param , "Can't create new tempfile: '%s'" , param -> temp_filename ) ;
goto err ;
}
if ( new_header_length && filecopy ( param , new_file , info -> dfile , 0L , new_header_length , "datafile-header" ) ) goto err ;
if ( param -> testflag & T_UNPACK ) {
share -> options &= ~ HA_OPTION_COMPRESS_RECORD ;
mi_int2store ( share -> state . header . options , share -> options ) ;
}
share -> state . dellink = HA_OFFSET_ERROR ;
info -> rec_cache . file = new_file ;
}
info -> update = ( short ) ( HA_STATE_CHANGED | HA_STATE_ROW_CHANGED ) ;
mi_drop_all_indexes ( param , info , FALSE ) ;
key_map = share -> state . key_map ;
if ( param -> testflag & T_CREATE_MISSING_KEYS ) {
key_map = ~ key_map ;
}
sort_info . info = info ;
sort_info . param = param ;
set_data_file_type ( & sort_info , share ) ;
sort_param . filepos = new_header_length ;
sort_info . dupp = 0 ;
sort_info . buff = 0 ;
param -> read_cache . end_of_file = sort_info . filelength = mysql_file_seek ( param -> read_cache . file , 0L , MY_SEEK_END , MYF ( 0 ) ) ;
sort_param . wordlist = NULL ;
init_alloc_root ( & sort_param . wordroot , FTPARSER_MEMROOT_ALLOC_SIZE , 0 ) ;
if ( share -> data_file_type == DYNAMIC_RECORD ) length = max ( share -> base . min_pack_length + 1 , share -> base . min_block_length ) ;
else if ( share -> data_file_type == COMPRESSED_RECORD ) length = share -> base . min_block_length ;
else length = share -> base . pack_reclength ;
sort_info . max_records = ( ( param -> testflag & T_CREATE_MISSING_KEYS ) ? info -> state -> records : ( ha_rows ) ( sort_info . filelength / length + 1 ) ) ;
sort_param . key_cmp = sort_key_cmp ;
sort_param . lock_in_memory = lock_memory ;
sort_param . tmpdir = param -> tmpdir ;
sort_param . sort_info = & sort_info ;
sort_param . fix_datafile = ( my_bool ) ( ! rep_quick ) ;
sort_param . master = 1 ;
del = info -> state -> del ;
param -> glob_crc = 0 ;
if ( param -> testflag & T_CALC_CHECKSUM ) sort_param . calc_checksum = 1 ;
rec_per_key_part = param -> rec_per_key_part ;
for ( sort_param . key = 0 ;
sort_param . key < share -> base . keys ;
rec_per_key_part += sort_param . keyinfo -> keysegs , sort_param . key ++ ) {
sort_param . read_cache = param -> read_cache ;
sort_param . keyinfo = share -> keyinfo + sort_param . key ;
sort_param . seg = sort_param . keyinfo -> seg ;
if ( ! mi_is_key_active ( key_map , sort_param . key ) ) {
memcpy ( ( char * ) rec_per_key_part , ( char * ) ( share -> state . rec_per_key_part + ( uint ) ( rec_per_key_part - param -> rec_per_key_part ) ) , sort_param . keyinfo -> keysegs * sizeof ( * rec_per_key_part ) ) ;
DBUG_PRINT ( "repair" , ( "skipping seemingly disabled index #: %u" , sort_param . key ) ) ;
continue ;
}
if ( ( ! ( param -> testflag & T_SILENT ) ) ) printf ( "- Fixing index %d\n" , sort_param . key + 1 ) ;
sort_param . max_pos = sort_param . pos = share -> pack . header_length ;
keyseg = sort_param . seg ;
bzero ( ( char * ) sort_param . unique , sizeof ( sort_param . unique ) ) ;
sort_param . key_length = share -> rec_reflength ;
for ( i = 0 ;
keyseg [ i ] . type != HA_KEYTYPE_END ;
i ++ ) {
sort_param . key_length += keyseg [ i ] . length ;
if ( keyseg [ i ] . flag & HA_SPACE_PACK ) sort_param . key_length += get_pack_length ( keyseg [ i ] . length ) ;
if ( keyseg [ i ] . flag & ( HA_BLOB_PART | HA_VAR_LENGTH_PART ) ) sort_param . key_length += 2 + test ( keyseg [ i ] . length >= 127 ) ;
if ( keyseg [ i ] . flag & HA_NULL_PART ) sort_param . key_length ++ ;
}
info -> state -> records = info -> state -> del = share -> state . split = 0 ;
info -> state -> empty = 0 ;
if ( sort_param . keyinfo -> flag & HA_FULLTEXT ) {
uint ft_max_word_len_for_sort = FT_MAX_WORD_LEN_FOR_SORT * sort_param . keyinfo -> seg -> charset -> mbmaxlen ;
sort_param . key_length += ft_max_word_len_for_sort - HA_FT_MAXBYTELEN ;
if ( sort_param . keyinfo -> parser == & ft_default_parser ) {
sort_info . max_records = ( ha_rows ) ( sort_info . filelength / ft_min_word_len + 1 ) ;
}
else {
sort_info . max_records = 10 * max ( param -> sort_buffer_length , MIN_SORT_BUFFER ) / sort_param . key_length ;
}
sort_param . key_read = sort_ft_key_read ;
sort_param . key_write = sort_ft_key_write ;
}
else {
sort_param . key_read = sort_key_read ;
sort_param . key_write = sort_key_write ;
}
if ( _create_index_by_sort ( & sort_param , ( my_bool ) ( ! ( param -> testflag & T_VERBOSE ) ) , param -> sort_buffer_length ) ) {
param -> retry_repair = 1 ;
goto err ;
}
sort_param . calc_checksum = 0 ;
free_root ( & sort_param . wordroot , MYF ( 0 ) ) ;
sort_info . max_records = ( ha_rows ) info -> state -> records ;
if ( param -> testflag & T_STATISTICS ) update_key_parts ( sort_param . keyinfo , rec_per_key_part , sort_param . unique , param -> stats_method == MI_STATS_METHOD_IGNORE_NULLS ? sort_param . notnull : NULL , ( ulonglong ) info -> state -> records ) ;
mi_set_key_active ( share -> state . key_map , sort_param . key ) ;
DBUG_PRINT ( "repair" , ( "set enabled index #: %u" , sort_param . key ) ) ;
if ( sort_param . fix_datafile ) {
param -> read_cache . end_of_file = sort_param . filepos ;
if ( write_data_suffix ( & sort_info , 1 ) || end_io_cache ( & info -> rec_cache ) ) goto err ;
if ( param -> testflag & T_SAFE_REPAIR ) {
if ( info -> state -> records + 1 < start_records ) {
info -> state -> records = start_records ;
goto err ;
}
}
share -> state . state . data_file_length = info -> state -> data_file_length = sort_param . filepos ;
share -> state . version = ( ulong ) time ( ( time_t * ) 0 ) ;
mysql_file_close ( info -> dfile , MYF ( 0 ) ) ;
info -> dfile = new_file ;
share -> data_file_type = sort_info . new_data_file_type ;
share -> pack . header_length = ( ulong ) new_header_length ;
sort_param . fix_datafile = 0 ;
}
else info -> state -> data_file_length = sort_param . max_pos ;
param -> read_cache . file = info -> dfile ;
reinit_io_cache ( & param -> read_cache , READ_CACHE , share -> pack . header_length , 1 , 1 ) ;
}
if ( param -> testflag & T_WRITE_LOOP ) {
( void ) fputs ( " \r" , stdout ) ;
( void ) fflush ( stdout ) ;
}
if ( rep_quick && del + sort_info . dupp != info -> state -> del ) {
mi_check_print_error ( param , "Couldn't fix table with quick recovery: Found wrong number of deleted records" ) ;
mi_check_print_error ( param , "Run recovery again without -q" ) ;
got_error = 1 ;
param -> retry_repair = 1 ;
param -> testflag |= T_RETRY_WITHOUT_QUICK ;
goto err ;
}
if ( rep_quick & T_FORCE_UNIQUENESS ) {
my_off_t skr = info -> state -> data_file_length + ( share -> options & HA_OPTION_COMPRESS_RECORD ? MEMMAP_EXTRA_MARGIN : 0 ) ;
# ifdef USE_RELOC if ( share -> data_file_type == STATIC_RECORD && skr < share -> base . reloc * share -> base . min_pack_length ) skr = share -> base . reloc * share -> base . min_pack_length ;
# endif if ( skr != sort_info . filelength ) if ( mysql_file_chsize ( info -> dfile , skr , 0 , MYF ( 0 ) ) ) mi_check_print_warning ( param , "Can't change size of datafile, error: %d" , my_errno ) ;
}
if ( param -> testflag & T_CALC_CHECKSUM ) info -> state -> checksum = param -> glob_crc ;
if ( mysql_file_chsize ( share -> kfile , info -> state -> key_file_length , 0 , MYF ( 0 ) ) ) mi_check_print_warning ( param , "Can't change size of indexfile, error: %d" , my_errno ) ;
if ( ! ( param -> testflag & T_SILENT ) ) {
if ( start_records != info -> state -> records ) printf ( "Data records: %s\n" , llstr ( info -> state -> records , llbuff ) ) ;
if ( sort_info . dupp ) mi_check_print_warning ( param , "%s records have been removed" , llstr ( sort_info . dupp , llbuff ) ) ;
}
got_error = 0 ;
if ( & share -> state . state != info -> state ) memcpy ( & share -> state . state , info -> state , sizeof ( * info -> state ) ) ;
err : got_error |= flush_blocks ( param , share -> key_cache , share -> kfile ) ;
( void ) end_io_cache ( & info -> rec_cache ) ;
if ( ! got_error ) {
if ( new_file >= 0 ) {
mysql_file_close ( new_file , MYF ( 0 ) ) ;
info -> dfile = new_file = - 1 ;
if ( change_to_newfile ( share -> data_file_name , MI_NAME_DEXT , DATA_TMP_EXT , ( param -> testflag & T_BACKUP_DATA ? MYF ( MY_REDEL_MAKE_BACKUP ) : MYF ( 0 ) ) ) || mi_open_datafile ( info , share , name , - 1 ) ) got_error = 1 ;
}
}
if ( got_error ) {
if ( ! param -> error_printed ) mi_check_print_error ( param , "%d when fixing table" , my_errno ) ;
if ( new_file >= 0 ) {
( void ) mysql_file_close ( new_file , MYF ( 0 ) ) ;
( void ) mysql_file_delete ( mi_key_file_datatmp , param -> temp_filename , MYF ( MY_WME ) ) ;
if ( info -> dfile == new_file ) if ( unlikely ( mi_open_datafile ( info , share , name , - 1 ) ) ) param -> retry_repair = 0 ;
}
mi_mark_crashed_on_repair ( info ) ;
}
else if ( key_map == share -> state . key_map ) share -> state . changed &= ~ STATE_NOT_OPTIMIZED_KEYS ;
share -> state . changed |= STATE_NOT_SORTED_PAGES ;
my_free ( mi_get_rec_buff_ptr ( info , sort_param . rec_buff ) ) ;
my_free ( mi_get_rec_buff_ptr ( info , sort_param . record ) ) ;
my_free ( sort_info . key_block ) ;
my_free ( sort_info . ft_buf ) ;
my_free ( sort_info . buff ) ;
( void ) end_io_cache ( & param -> read_cache ) ;
info -> opt_flag &= ~ ( READ_CACHE_USED | WRITE_CACHE_USED ) ;
if ( ! got_error && ( param -> testflag & T_UNPACK ) ) {
share -> state . header . options [ 0 ] &= ( uchar ) ~ HA_OPTION_COMPRESS_RECORD ;
share -> pack . header_length = 0 ;
}
DBUG_RETURN ( got_error ) ;
}
| 1
|
static int dissect_usb_video_endpoint_descriptor ( proto_tree * parent_tree , tvbuff_t * tvb , guint8 descriptor_len ) {
proto_tree * tree = NULL ;
int offset = 0 ;
guint8 subtype ;
subtype = tvb_get_guint8 ( tvb , offset + 2 ) ;
if ( parent_tree ) {
const gchar * subtype_str ;
subtype_str = val_to_str ( subtype , vc_ep_descriptor_subtypes , "Unknown (0x%x)" ) ;
tree = proto_tree_add_subtree_format ( parent_tree , tvb , offset , descriptor_len , ett_descriptor_video_endpoint , NULL , "VIDEO CONTROL ENDPOINT DESCRIPTOR [%s]" , subtype_str ) ;
}
dissect_usb_descriptor_header ( tree , tvb , offset , & vid_descriptor_type_vals_ext ) ;
proto_tree_add_item ( tree , hf_usb_vid_epdesc_subtype , tvb , offset + 2 , 1 , ENC_LITTLE_ENDIAN ) ;
offset += 3 ;
if ( subtype == EP_INTERRUPT ) {
proto_tree_add_item ( tree , hf_usb_vid_epdesc_max_transfer_sz , tvb , offset , 2 , ENC_LITTLE_ENDIAN ) ;
offset += 2 ;
}
if ( offset < descriptor_len ) proto_tree_add_item ( tree , hf_usb_vid_descriptor_data , tvb , offset , descriptor_len - offset , ENC_NA ) ;
return descriptor_len ;
}
| 0
|
static cmsBool Type_Screening_Write ( struct _cms_typehandler_struct * self , cmsIOHANDLER * io , void * Ptr , cmsUInt32Number nItems ) {
cmsScreening * sc = ( cmsScreening * ) Ptr ;
cmsUInt32Number i ;
if ( ! _cmsWriteUInt32Number ( io , sc -> Flag ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , sc -> nChannels ) ) return FALSE ;
for ( i = 0 ;
i < sc -> nChannels ;
i ++ ) {
if ( ! _cmsWrite15Fixed16Number ( io , sc -> Channels [ i ] . Frequency ) ) return FALSE ;
if ( ! _cmsWrite15Fixed16Number ( io , sc -> Channels [ i ] . ScreenAngle ) ) return FALSE ;
if ( ! _cmsWriteUInt32Number ( io , sc -> Channels [ i ] . SpotShape ) ) return FALSE ;
}
return TRUE ;
cmsUNUSED_PARAMETER ( nItems ) ;
cmsUNUSED_PARAMETER ( self ) ;
}
| 0
|
static int writer_register ( const Writer * writer ) {
static int next_registered_writer_idx = 0 ;
if ( next_registered_writer_idx == MAX_REGISTERED_WRITERS_NB ) return AVERROR ( ENOMEM ) ;
registered_writers [ next_registered_writer_idx ++ ] = writer ;
return 0 ;
}
| 0
|
kadm5_ret_t kadm5_get_principal_keys ( void * server_handle , krb5_principal principal , krb5_keyblock * * keyblocks , int * n_keys ) {
krb5_db_entry * kdb ;
osa_princ_ent_rec adb ;
kadm5_ret_t ret ;
kadm5_server_handle_t handle = server_handle ;
if ( keyblocks ) * keyblocks = NULL ;
CHECK_HANDLE ( server_handle ) ;
if ( principal == NULL ) return EINVAL ;
if ( ( ret = kdb_get_entry ( handle , principal , & kdb , & adb ) ) ) return ( ret ) ;
if ( keyblocks ) {
ret = decrypt_key_data ( handle -> context , kdb -> n_key_data , kdb -> key_data , keyblocks , n_keys ) ;
if ( ret ) goto done ;
}
ret = KADM5_OK ;
done : kdb_free_entry ( handle , kdb , & adb ) ;
return ret ;
}
| 0
|
static uint64_t s390_virtio_device_vq_token ( VirtIOS390Device * dev , int vq ) {
ram_addr_t token_off ;
token_off = ( dev -> dev_offs + VIRTIO_DEV_OFFS_CONFIG ) + ( vq * VIRTIO_VQCONFIG_LEN ) + VIRTIO_VQCONFIG_OFFS_TOKEN ;
return ldq_phys ( token_off ) ;
}
| 0
|
int ReadOffset ( ArchiveHandle * AH , pgoff_t * o ) {
int i ;
int off ;
int offsetFlg ;
* o = 0 ;
if ( AH -> version < K_VERS_1_7 ) {
i = ReadInt ( AH ) ;
if ( i < 0 ) return K_OFFSET_POS_NOT_SET ;
else if ( i == 0 ) return K_OFFSET_NO_DATA ;
* o = ( pgoff_t ) i ;
return K_OFFSET_POS_SET ;
}
offsetFlg = ( * AH -> ReadBytePtr ) ( AH ) & 0xFF ;
switch ( offsetFlg ) {
case K_OFFSET_POS_NOT_SET : case K_OFFSET_NO_DATA : case K_OFFSET_POS_SET : break ;
default : exit_horribly ( modulename , "unexpected data offset flag %d\n" , offsetFlg ) ;
}
for ( off = 0 ;
off < AH -> offSize ;
off ++ ) {
if ( off < sizeof ( pgoff_t ) ) * o |= ( ( pgoff_t ) ( ( * AH -> ReadBytePtr ) ( AH ) ) ) << ( off * 8 ) ;
else {
if ( ( * AH -> ReadBytePtr ) ( AH ) != 0 ) exit_horribly ( modulename , "file offset in dump file is too large\n" ) ;
}
}
return offsetFlg ;
}
| 0
|
static int dissect_h245_T_broadcastMyLogicalChannelResponse ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) {
offset = dissect_per_choice ( tvb , offset , actx , tree , hf_index , ett_h245_T_broadcastMyLogicalChannelResponse , T_broadcastMyLogicalChannelResponse_choice , NULL ) ;
return offset ;
}
| 0
|
bool is_pseudo_constant_clause ( Node * clause ) {
if ( ! contain_var_clause ( clause ) && ! contain_volatile_functions ( clause ) ) return true ;
return false ;
}
| 0
|
static inline int get_context ( PlaneContext * p , int16_t * src , int16_t * last , int16_t * last2 ) {
const int LT = last [ - 1 ] ;
const int T = last [ 0 ] ;
const int RT = last [ 1 ] ;
const int L = src [ - 1 ] ;
if ( p -> quant_table [ 3 ] [ 127 ] ) {
const int TT = last2 [ 0 ] ;
const int LL = src [ - 2 ] ;
return p -> quant_table [ 0 ] [ ( L - LT ) & 0xFF ] + p -> quant_table [ 1 ] [ ( LT - T ) & 0xFF ] + p -> quant_table [ 2 ] [ ( T - RT ) & 0xFF ] + p -> quant_table [ 3 ] [ ( LL - L ) & 0xFF ] + p -> quant_table [ 4 ] [ ( TT - T ) & 0xFF ] ;
}
else return p -> quant_table [ 0 ] [ ( L - LT ) & 0xFF ] + p -> quant_table [ 1 ] [ ( LT - T ) & 0xFF ] + p -> quant_table [ 2 ] [ ( T - RT ) & 0xFF ] ;
}
| 0
|
void TSFetchLaunch ( TSFetchSM fetch_sm ) {
sdk_assert ( sdk_sanity_check_fetch_sm ( fetch_sm ) == TS_SUCCESS ) ;
( ( FetchSM * ) fetch_sm ) -> ext_launch ( ) ;
}
| 0
|
int curl_msnprintf ( char * buffer , size_t maxlength , const char * format , ... ) {
int retcode ;
va_list ap_save ;
va_start ( ap_save , format ) ;
retcode = curl_mvsnprintf ( buffer , maxlength , format , ap_save ) ;
va_end ( ap_save ) ;
return retcode ;
}
| 0
|
int EVP_DecryptUpdate ( EVP_CIPHER_CTX * ctx , unsigned char * out , int * outl , const unsigned char * in , int inl ) {
int fix_len ;
unsigned int b ;
if ( ctx -> cipher -> flags & EVP_CIPH_FLAG_CUSTOM_CIPHER ) {
fix_len = ctx -> cipher -> do_cipher ( ctx , out , in , inl ) ;
if ( fix_len < 0 ) {
* outl = 0 ;
return 0 ;
}
else * outl = fix_len ;
return 1 ;
}
if ( inl <= 0 ) {
* outl = 0 ;
return inl == 0 ;
}
if ( ctx -> flags & EVP_CIPH_NO_PADDING ) return EVP_EncryptUpdate ( ctx , out , outl , in , inl ) ;
b = ctx -> cipher -> block_size ;
OPENSSL_assert ( b <= sizeof ctx -> final ) ;
if ( ctx -> final_used ) {
memcpy ( out , ctx -> final , b ) ;
out += b ;
fix_len = 1 ;
}
else fix_len = 0 ;
if ( ! EVP_EncryptUpdate ( ctx , out , outl , in , inl ) ) return 0 ;
if ( b > 1 && ! ctx -> buf_len ) {
* outl -= b ;
ctx -> final_used = 1 ;
memcpy ( ctx -> final , & out [ * outl ] , b ) ;
}
else ctx -> final_used = 0 ;
if ( fix_len ) * outl += b ;
return 1 ;
}
| 0
|
int ff_MPV_common_frame_size_change ( MpegEncContext * s ) {
int i , err = 0 ;
if ( s -> slice_context_count > 1 ) {
for ( i = 0 ;
i < s -> slice_context_count ;
i ++ ) {
free_duplicate_context ( s -> thread_context [ i ] ) ;
}
for ( i = 1 ;
i < s -> slice_context_count ;
i ++ ) {
av_freep ( & s -> thread_context [ i ] ) ;
}
}
else free_duplicate_context ( s ) ;
if ( ( err = free_context_frame ( s ) ) < 0 ) return err ;
if ( s -> picture ) for ( i = 0 ;
i < MAX_PICTURE_COUNT ;
i ++ ) {
s -> picture [ i ] . needs_realloc = 1 ;
}
s -> last_picture_ptr = s -> next_picture_ptr = s -> current_picture_ptr = NULL ;
if ( s -> codec_id == AV_CODEC_ID_MPEG2VIDEO && ! s -> progressive_sequence ) s -> mb_height = ( s -> height + 31 ) / 32 * 2 ;
else if ( s -> codec_id != AV_CODEC_ID_H264 ) s -> mb_height = ( s -> height + 15 ) / 16 ;
if ( ( s -> width || s -> height ) && av_image_check_size ( s -> width , s -> height , 0 , s -> avctx ) ) return AVERROR_INVALIDDATA ;
if ( ( err = init_context_frame ( s ) ) ) goto fail ;
s -> thread_context [ 0 ] = s ;
if ( s -> width && s -> height ) {
int nb_slices = s -> slice_context_count ;
if ( nb_slices > 1 ) {
for ( i = 1 ;
i < nb_slices ;
i ++ ) {
s -> thread_context [ i ] = av_malloc ( sizeof ( MpegEncContext ) ) ;
memcpy ( s -> thread_context [ i ] , s , sizeof ( MpegEncContext ) ) ;
}
for ( i = 0 ;
i < nb_slices ;
i ++ ) {
if ( init_duplicate_context ( s -> thread_context [ i ] ) < 0 ) goto fail ;
s -> thread_context [ i ] -> start_mb_y = ( s -> mb_height * ( i ) + nb_slices / 2 ) / nb_slices ;
s -> thread_context [ i ] -> end_mb_y = ( s -> mb_height * ( i + 1 ) + nb_slices / 2 ) / nb_slices ;
}
}
else {
if ( init_duplicate_context ( s ) < 0 ) goto fail ;
s -> start_mb_y = 0 ;
s -> end_mb_y = s -> mb_height ;
}
s -> slice_context_count = nb_slices ;
}
return 0 ;
fail : ff_MPV_common_end ( s ) ;
return err ;
}
| 0
|
TEST_F ( FullscreenControllerStateUnitTest , TwoFullscreenedTabsOneCaptured ) {
content : : WebContentsDelegate * const wc_delegate = static_cast < content : : WebContentsDelegate * > ( browser ( ) ) ;
ASSERT_TRUE ( wc_delegate -> EmbedsFullscreenWidget ( ) ) ;
AddTab ( browser ( ) , GURL ( url : : kAboutBlankURL ) ) ;
AddTab ( browser ( ) , GURL ( url : : kAboutBlankURL ) ) ;
content : : WebContents * const first_tab = browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 0 ) ;
content : : WebContents * const second_tab = browser ( ) -> tab_strip_model ( ) -> GetWebContentsAt ( 1 ) ;
browser ( ) -> tab_strip_model ( ) -> ActivateTabAt ( 0 , true ) ;
const gfx : : Size kCaptureSize ( 1280 , 720 ) ;
first_tab -> IncrementCapturerCount ( kCaptureSize ) ;
ASSERT_TRUE ( InvokeEvent ( TAB_FULLSCREEN_TRUE ) ) ;
EXPECT_FALSE ( browser ( ) -> window ( ) -> IsFullscreen ( ) ) ;
EXPECT_TRUE ( wc_delegate -> IsFullscreenForTabOrPending ( first_tab ) ) ;
EXPECT_FALSE ( wc_delegate -> IsFullscreenForTabOrPending ( second_tab ) ) ;
EXPECT_FALSE ( GetFullscreenController ( ) -> IsWindowFullscreenForTabOrPending ( ) ) ;
browser ( ) -> tab_strip_model ( ) -> ActivateTabAt ( 1 , true ) ;
ASSERT_TRUE ( InvokeEvent ( TAB_FULLSCREEN_TRUE ) ) ;
ASSERT_TRUE ( InvokeEvent ( WINDOW_CHANGE ) ) ;
EXPECT_TRUE ( browser ( ) -> window ( ) -> IsFullscreen ( ) ) ;
EXPECT_TRUE ( wc_delegate -> IsFullscreenForTabOrPending ( first_tab ) ) ;
EXPECT_TRUE ( wc_delegate -> IsFullscreenForTabOrPending ( second_tab ) ) ;
EXPECT_TRUE ( GetFullscreenController ( ) -> IsWindowFullscreenForTabOrPending ( ) ) ;
ASSERT_TRUE ( InvokeEvent ( TAB_FULLSCREEN_FALSE ) ) ;
ASSERT_TRUE ( InvokeEvent ( WINDOW_CHANGE ) ) ;
EXPECT_FALSE ( browser ( ) -> window ( ) -> IsFullscreen ( ) ) ;
EXPECT_TRUE ( wc_delegate -> IsFullscreenForTabOrPending ( first_tab ) ) ;
EXPECT_FALSE ( wc_delegate -> IsFullscreenForTabOrPending ( second_tab ) ) ;
EXPECT_FALSE ( GetFullscreenController ( ) -> IsWindowFullscreenForTabOrPending ( ) ) ;
browser ( ) -> tab_strip_model ( ) -> ActivateTabAt ( 0 , true ) ;
ASSERT_TRUE ( InvokeEvent ( TAB_FULLSCREEN_FALSE ) ) ;
EXPECT_FALSE ( browser ( ) -> window ( ) -> IsFullscreen ( ) ) ;
EXPECT_FALSE ( wc_delegate -> IsFullscreenForTabOrPending ( first_tab ) ) ;
EXPECT_FALSE ( wc_delegate -> IsFullscreenForTabOrPending ( second_tab ) ) ;
EXPECT_FALSE ( GetFullscreenController ( ) -> IsWindowFullscreenForTabOrPending ( ) ) ;
}
| 0
|
static int write_string ( buffer_t buffer , PyObject * py_string ) {
Py_ssize_t string_length ;
const char * string ;
# if PY_MAJOR_VERSION >= 3 if ( PyUnicode_Check ( py_string ) ) {
return write_unicode ( buffer , py_string ) ;
}
string = PyBytes_AsString ( py_string ) ;
# else string = PyString_AsString ( py_string ) ;
# endif if ( ! string ) {
return 0 ;
}
# if PY_MAJOR_VERSION >= 3 string_length = PyBytes_Size ( py_string ) + 1 ;
# else string_length = PyString_Size ( py_string ) + 1 ;
# endif if ( ! buffer_write_bytes ( buffer , ( const char * ) & string_length , 4 ) ) {
return 0 ;
}
if ( ! buffer_write_bytes ( buffer , string , string_length ) ) {
return 0 ;
}
return 1 ;
}
| 0
|
static void dissect_coap_opt_location_query ( tvbuff_t * tvb , proto_item * head_item , proto_tree * subtree , gint offset , gint opt_length , int hf ) {
const guint8 * str = NULL ;
if ( opt_length == 0 ) {
str = nullstr ;
}
else {
str = tvb_get_string_enc ( wmem_packet_scope ( ) , tvb , offset , opt_length , ENC_ASCII ) ;
}
proto_tree_add_string ( subtree , hf , tvb , offset , opt_length , str ) ;
proto_item_append_text ( head_item , ": %s" , str ) ;
}
| 0
|
IN_PROC_BROWSER_TEST_F ( ClientHintsBrowserTest , ClientHintsHttpsSubresourceDifferentOrigin ) {
base : : HistogramTester histogram_tester ;
ui_test_utils : : NavigateToURL ( browser ( ) , accept_ch_with_lifetime_url ( ) ) ;
histogram_tester . ExpectUniqueSample ( "ClientHints.UpdateEventCount" , 1 , 1 ) ;
ContentSettingsForOneType client_hints_settings ;
HostContentSettingsMap * host_content_settings_map = HostContentSettingsMapFactory : : GetForProfile ( browser ( ) -> profile ( ) ) ;
host_content_settings_map -> GetSettingsForOneType ( CONTENT_SETTINGS_TYPE_CLIENT_HINTS , std : : string ( ) , & client_hints_settings ) ;
ASSERT_EQ ( 1U , client_hints_settings . size ( ) ) ;
host_content_settings_map -> SetWebsiteSettingDefaultScope ( GURL ( "https://foo.com/" ) , GURL ( ) , CONTENT_SETTINGS_TYPE_CLIENT_HINTS , std : : string ( ) , std : : make_unique < base : : Value > ( client_hints_settings . at ( 0 ) . setting_value -> Clone ( ) ) ) ;
host_content_settings_map = HostContentSettingsMapFactory : : GetForProfile ( browser ( ) -> profile ( ) ) ;
host_content_settings_map -> GetSettingsForOneType ( CONTENT_SETTINGS_TYPE_CLIENT_HINTS , std : : string ( ) , & client_hints_settings ) ;
ASSERT_EQ ( 2U , client_hints_settings . size ( ) ) ;
SetClientHintExpectationsOnMainFrame ( true ) ;
SetClientHintExpectationsOnSubresources ( true ) ;
ui_test_utils : : NavigateToURL ( browser ( ) , without_accept_ch_without_lifetime_img_localhost ( ) ) ;
base : : RunLoop ( ) . RunUntilIdle ( ) ;
content : : FetchHistogramsFromChildProcesses ( ) ;
SubprocessMetricsProvider : : MergeHistogramDeltasForTesting ( ) ;
# if defined ( OS_ANDROID ) EXPECT_EQ ( 4u , count_client_hints_headers_seen ( ) ) ;
# else EXPECT_EQ ( 6u , count_client_hints_headers_seen ( ) ) ;
# endif ui_test_utils : : NavigateToURL ( browser ( ) , without_accept_ch_without_lifetime_img_foo_com ( ) ) ;
base : : RunLoop ( ) . RunUntilIdle ( ) ;
content : : FetchHistogramsFromChildProcesses ( ) ;
SubprocessMetricsProvider : : MergeHistogramDeltasForTesting ( ) ;
# if defined ( OS_ANDROID ) EXPECT_EQ ( 6u , count_client_hints_headers_seen ( ) ) ;
# else EXPECT_EQ ( 9u , count_client_hints_headers_seen ( ) ) ;
# endif EXPECT_EQ ( 1u , third_party_request_count_seen ( ) ) ;
EXPECT_EQ ( 0u , third_party_client_hints_count_seen ( ) ) ;
}
| 0
|
int gs_main_run_string_continue ( gs_main_instance * minst , const char * str , uint length , int user_errors , int * pexit_code , ref * perror_object ) {
ref rstr ;
if ( length == 0 ) return 0 ;
make_const_string ( & rstr , avm_foreign | a_readonly , length , ( const byte * ) str ) ;
return gs_main_interpret ( minst , & rstr , user_errors , pexit_code , perror_object ) ;
}
| 0
|
static inline void tb_reset_jump ( TranslationBlock * tb , int n ) {
tb_set_jmp_target ( tb , n , ( uintptr_t ) ( tb -> tc_ptr + tb -> tb_next_offset [ n ] ) ) ;
}
| 0
|
static int sad_hpel_motion_search ( MpegEncContext * s , int * mx_ptr , int * my_ptr , int dmin , int src_index , int ref_index , int size , int h ) {
MotionEstContext * const c = & s -> me ;
const int penalty_factor = c -> sub_penalty_factor ;
int mx , my , dminh ;
uint8_t * pix , * ptr ;
int stride = c -> stride ;
const int flags = c -> sub_flags ;
LOAD_COMMON assert ( flags == 0 ) ;
if ( c -> skip ) {
* mx_ptr = 0 ;
* my_ptr = 0 ;
return dmin ;
}
pix = c -> src [ src_index ] [ 0 ] ;
mx = * mx_ptr ;
my = * my_ptr ;
ptr = c -> ref [ ref_index ] [ 0 ] + ( my * stride ) + mx ;
dminh = dmin ;
if ( mx > xmin && mx < xmax && my > ymin && my < ymax ) {
int dx = 0 , dy = 0 ;
int d , pen_x , pen_y ;
const int index = ( my << ME_MAP_SHIFT ) + mx ;
const int t = score_map [ ( index - ( 1 << ME_MAP_SHIFT ) ) & ( ME_MAP_SIZE - 1 ) ] ;
const int l = score_map [ ( index - 1 ) & ( ME_MAP_SIZE - 1 ) ] ;
const int r = score_map [ ( index + 1 ) & ( ME_MAP_SIZE - 1 ) ] ;
const int b = score_map [ ( index + ( 1 << ME_MAP_SHIFT ) ) & ( ME_MAP_SIZE - 1 ) ] ;
mx <<= 1 ;
my <<= 1 ;
pen_x = pred_x + mx ;
pen_y = pred_y + my ;
ptr -= stride ;
if ( t <= b ) {
CHECK_SAD_HALF_MV ( y2 , 0 , - 1 ) if ( l <= r ) {
CHECK_SAD_HALF_MV ( xy2 , - 1 , - 1 ) if ( t + r <= b + l ) {
CHECK_SAD_HALF_MV ( xy2 , + 1 , - 1 ) ptr += stride ;
}
else {
ptr += stride ;
CHECK_SAD_HALF_MV ( xy2 , - 1 , + 1 ) }
CHECK_SAD_HALF_MV ( x2 , - 1 , 0 ) }
else {
CHECK_SAD_HALF_MV ( xy2 , + 1 , - 1 ) if ( t + l <= b + r ) {
CHECK_SAD_HALF_MV ( xy2 , - 1 , - 1 ) ptr += stride ;
}
else {
ptr += stride ;
CHECK_SAD_HALF_MV ( xy2 , + 1 , + 1 ) }
CHECK_SAD_HALF_MV ( x2 , + 1 , 0 ) }
}
else {
if ( l <= r ) {
if ( t + l <= b + r ) {
CHECK_SAD_HALF_MV ( xy2 , - 1 , - 1 ) ptr += stride ;
}
else {
ptr += stride ;
CHECK_SAD_HALF_MV ( xy2 , + 1 , + 1 ) }
CHECK_SAD_HALF_MV ( x2 , - 1 , 0 ) CHECK_SAD_HALF_MV ( xy2 , - 1 , + 1 ) }
else {
if ( t + r <= b + l ) {
CHECK_SAD_HALF_MV ( xy2 , + 1 , - 1 ) ptr += stride ;
}
else {
ptr += stride ;
CHECK_SAD_HALF_MV ( xy2 , - 1 , + 1 ) }
CHECK_SAD_HALF_MV ( x2 , + 1 , 0 ) CHECK_SAD_HALF_MV ( xy2 , + 1 , + 1 ) }
CHECK_SAD_HALF_MV ( y2 , 0 , + 1 ) }
mx += dx ;
my += dy ;
}
else {
mx <<= 1 ;
my <<= 1 ;
}
* mx_ptr = mx ;
* my_ptr = my ;
return dminh ;
}
| 0
|
vpx_codec_err_t vp9_copy_reference_dec ( VP9Decoder * pbi , VP9_REFFRAME ref_frame_flag , YV12_BUFFER_CONFIG * sd ) {
VP9_COMMON * cm = & pbi -> common ;
if ( ref_frame_flag == VP9_LAST_FLAG ) {
const YV12_BUFFER_CONFIG * const cfg = get_ref_frame ( cm , 0 ) ;
if ( cfg == NULL ) {
vpx_internal_error ( & cm -> error , VPX_CODEC_ERROR , "No 'last' reference frame" ) ;
return VPX_CODEC_ERROR ;
}
if ( ! equal_dimensions ( cfg , sd ) ) vpx_internal_error ( & cm -> error , VPX_CODEC_ERROR , "Incorrect buffer dimensions" ) ;
else vp8_yv12_copy_frame ( cfg , sd ) ;
}
else {
vpx_internal_error ( & cm -> error , VPX_CODEC_ERROR , "Invalid reference frame" ) ;
}
return cm -> error . error_code ;
}
| 0
|
static void _SCSUOpen ( UConverter * cnv , UConverterLoadArgs * pArgs , UErrorCode * pErrorCode ) {
const char * locale = pArgs -> locale ;
if ( pArgs -> onlyTestIsLoadable ) {
return ;
}
cnv -> extraInfo = uprv_malloc ( sizeof ( SCSUData ) ) ;
if ( cnv -> extraInfo != NULL ) {
if ( locale != NULL && locale [ 0 ] == 'j' && locale [ 1 ] == 'a' && ( locale [ 2 ] == 0 || locale [ 2 ] == '_' ) ) {
( ( SCSUData * ) cnv -> extraInfo ) -> locale = l_ja ;
}
else {
( ( SCSUData * ) cnv -> extraInfo ) -> locale = lGeneric ;
}
_SCSUReset ( cnv , UCNV_RESET_BOTH ) ;
}
else {
* pErrorCode = U_MEMORY_ALLOCATION_ERROR ;
}
cnv -> subUChars [ 0 ] = 0xfffd ;
cnv -> subCharLen = - 1 ;
}
| 1
|
static int parse_CRestrictionArray ( tvbuff_t * tvb , packet_info * pinfo , int offset , proto_tree * parent_tree , proto_tree * pad_tree , const char * fmt , ... ) {
guint8 present , count ;
proto_tree * tree ;
proto_item * item ;
const char * txt ;
va_list ap ;
va_start ( ap , fmt ) ;
txt = wmem_strdup_vprintf ( wmem_packet_scope ( ) , fmt , ap ) ;
va_end ( ap ) ;
tree = proto_tree_add_subtree ( parent_tree , tvb , offset , 0 , ett_CRestrictionArray , & item , txt ) ;
pad_tree = tree ;
count = tvb_get_guint8 ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_crestrictarray_count , tvb , offset , 1 , count ) ;
offset += 1 ;
present = tvb_get_guint8 ( tvb , offset ) ;
proto_tree_add_uint ( tree , hf_mswsp_crestrictarray_present , tvb , offset , 1 , present ) ;
offset += 1 ;
if ( present ) {
unsigned i ;
offset = parse_padding ( tvb , offset , 4 , pad_tree , "paddingCRestrictionPresent" ) ;
for ( i = 0 ;
i < count ;
i ++ ) {
struct CRestriction r ;
offset = parse_CRestriction ( tvb , pinfo , offset , tree , pad_tree , & r , "Restriction[%d]" , i ) ;
}
}
proto_item_set_end ( item , tvb , offset ) ;
return offset ;
}
| 0
|
static void xhci_kick_epctx ( XHCIEPContext * epctx , unsigned int streamid ) {
XHCIState * xhci = epctx -> xhci ;
XHCIStreamContext * stctx ;
XHCITransfer * xfer ;
XHCIRing * ring ;
USBEndpoint * ep = NULL ;
uint64_t mfindex ;
int length ;
int i ;
trace_usb_xhci_ep_kick ( epctx -> slotid , epctx -> epid , streamid ) ;
if ( ! xhci -> slots [ epctx -> slotid - 1 ] . uport || ! xhci -> slots [ epctx -> slotid - 1 ] . uport -> dev || ! xhci -> slots [ epctx -> slotid - 1 ] . uport -> dev -> attached ) {
return ;
}
if ( epctx -> retry ) {
XHCITransfer * xfer = epctx -> retry ;
trace_usb_xhci_xfer_retry ( xfer ) ;
assert ( xfer -> running_retry ) ;
if ( xfer -> timed_xfer ) {
mfindex = xhci_mfindex_get ( xhci ) ;
xhci_check_intr_iso_kick ( xhci , xfer , epctx , mfindex ) ;
if ( xfer -> running_retry ) {
return ;
}
xfer -> timed_xfer = 0 ;
xfer -> running_retry = 1 ;
}
if ( xfer -> iso_xfer ) {
if ( xhci_setup_packet ( xfer ) < 0 ) {
return ;
}
usb_handle_packet ( xfer -> packet . ep -> dev , & xfer -> packet ) ;
assert ( xfer -> packet . status != USB_RET_NAK ) ;
xhci_try_complete_packet ( xfer ) ;
}
else {
if ( xhci_setup_packet ( xfer ) < 0 ) {
return ;
}
usb_handle_packet ( xfer -> packet . ep -> dev , & xfer -> packet ) ;
if ( xfer -> packet . status == USB_RET_NAK ) {
return ;
}
xhci_try_complete_packet ( xfer ) ;
}
assert ( ! xfer -> running_retry ) ;
if ( xfer -> complete ) {
xhci_ep_free_xfer ( epctx -> retry ) ;
}
epctx -> retry = NULL ;
}
if ( epctx -> state == EP_HALTED ) {
DPRINTF ( "xhci: ep halted, not running schedule\n" ) ;
return ;
}
if ( epctx -> nr_pstreams ) {
uint32_t err ;
stctx = xhci_find_stream ( epctx , streamid , & err ) ;
if ( stctx == NULL ) {
return ;
}
ring = & stctx -> ring ;
xhci_set_ep_state ( xhci , epctx , stctx , EP_RUNNING ) ;
}
else {
ring = & epctx -> ring ;
streamid = 0 ;
xhci_set_ep_state ( xhci , epctx , NULL , EP_RUNNING ) ;
}
assert ( ring -> dequeue != 0 ) ;
while ( 1 ) {
length = xhci_ring_chain_length ( xhci , ring ) ;
if ( length <= 0 ) {
break ;
}
xfer = xhci_ep_alloc_xfer ( epctx , length ) ;
if ( xfer == NULL ) {
break ;
}
for ( i = 0 ;
i < length ;
i ++ ) {
TRBType type ;
type = xhci_ring_fetch ( xhci , ring , & xfer -> trbs [ i ] , NULL ) ;
assert ( type ) ;
}
xfer -> streamid = streamid ;
if ( epctx -> epid == 1 ) {
xhci_fire_ctl_transfer ( xhci , xfer ) ;
}
else {
xhci_fire_transfer ( xhci , xfer , epctx ) ;
}
if ( xfer -> complete ) {
xhci_ep_free_xfer ( xfer ) ;
xfer = NULL ;
}
if ( epctx -> state == EP_HALTED ) {
break ;
}
if ( xfer != NULL && xfer -> running_retry ) {
DPRINTF ( "xhci: xfer nacked, stopping schedule\n" ) ;
epctx -> retry = xfer ;
break ;
}
}
ep = xhci_epid_to_usbep ( epctx ) ;
if ( ep ) {
usb_device_flush_ep_queue ( ep -> dev , ep ) ;
}
}
| 1
|
static GList * make_activation_parameters ( GList * uris , GList * * unhandled_uris ) {
GList * ret , * l , * app_uris ;
NautilusFile * file ;
GAppInfo * app , * old_app ;
GHashTable * app_table ;
char * uri ;
ret = NULL ;
* unhandled_uris = NULL ;
app_table = g_hash_table_new_full ( ( GHashFunc ) mime_application_hash , ( GEqualFunc ) g_app_info_equal , ( GDestroyNotify ) g_object_unref , ( GDestroyNotify ) g_list_free ) ;
for ( l = uris ;
l != NULL ;
l = l -> next ) {
uri = l -> data ;
file = nautilus_file_get_by_uri ( uri ) ;
app = nautilus_mime_get_default_application_for_file ( file ) ;
if ( app != NULL ) {
app_uris = NULL ;
if ( g_hash_table_lookup_extended ( app_table , app , ( gpointer * ) & old_app , ( gpointer * ) & app_uris ) ) {
g_hash_table_steal ( app_table , old_app ) ;
app_uris = g_list_prepend ( app_uris , uri ) ;
g_object_unref ( app ) ;
app = old_app ;
}
else {
app_uris = g_list_prepend ( NULL , uri ) ;
}
g_hash_table_insert ( app_table , app , app_uris ) ;
}
else {
* unhandled_uris = g_list_prepend ( * unhandled_uris , uri ) ;
}
nautilus_file_unref ( file ) ;
}
g_hash_table_foreach ( app_table , ( GHFunc ) list_to_parameters_foreach , & ret ) ;
g_hash_table_destroy ( app_table ) ;
* unhandled_uris = g_list_reverse ( * unhandled_uris ) ;
return g_list_reverse ( ret ) ;
}
| 0
|
void hb_set_add ( hb_set_t * set , hb_codepoint_t codepoint ) {
set -> add ( codepoint ) ;
}
| 0
|
static void init_lengths ( BinkContext * c , int width , int bw ) {
width = FFALIGN ( width , 8 ) ;
c -> bundle [ BINK_SRC_BLOCK_TYPES ] . len = av_log2 ( ( width >> 3 ) + 511 ) + 1 ;
c -> bundle [ BINK_SRC_SUB_BLOCK_TYPES ] . len = av_log2 ( ( width >> 4 ) + 511 ) + 1 ;
c -> bundle [ BINK_SRC_COLORS ] . len = av_log2 ( bw * 64 + 511 ) + 1 ;
c -> bundle [ BINK_SRC_INTRA_DC ] . len = c -> bundle [ BINK_SRC_INTER_DC ] . len = c -> bundle [ BINK_SRC_X_OFF ] . len = c -> bundle [ BINK_SRC_Y_OFF ] . len = av_log2 ( ( width >> 3 ) + 511 ) + 1 ;
c -> bundle [ BINK_SRC_PATTERN ] . len = av_log2 ( ( bw << 3 ) + 511 ) + 1 ;
c -> bundle [ BINK_SRC_RUN ] . len = av_log2 ( bw * 48 + 511 ) + 1 ;
}
| 0
|
int ossl_statem_server_read_transition ( SSL * s , int mt ) {
OSSL_STATEM * st = & s -> statem ;
switch ( st -> hand_state ) {
case TLS_ST_BEFORE : case DTLS_ST_SW_HELLO_VERIFY_REQUEST : if ( mt == SSL3_MT_CLIENT_HELLO ) {
st -> hand_state = TLS_ST_SR_CLNT_HELLO ;
return 1 ;
}
break ;
case TLS_ST_SW_SRVR_DONE : if ( mt == SSL3_MT_CLIENT_KEY_EXCHANGE ) {
if ( s -> s3 -> tmp . cert_request ) {
if ( s -> version == SSL3_VERSION ) {
if ( ( s -> verify_mode & SSL_VERIFY_PEER ) && ( s -> verify_mode & SSL_VERIFY_FAIL_IF_NO_PEER_CERT ) ) {
ssl3_send_alert ( s , SSL3_AL_FATAL , SSL3_AD_HANDSHAKE_FAILURE ) ;
SSLerr ( SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION , SSL_R_PEER_DID_NOT_RETURN_A_CERTIFICATE ) ;
return 0 ;
}
st -> hand_state = TLS_ST_SR_KEY_EXCH ;
return 1 ;
}
}
else {
st -> hand_state = TLS_ST_SR_KEY_EXCH ;
return 1 ;
}
}
else if ( s -> s3 -> tmp . cert_request ) {
if ( mt == SSL3_MT_CERTIFICATE ) {
st -> hand_state = TLS_ST_SR_CERT ;
return 1 ;
}
}
break ;
case TLS_ST_SR_CERT : if ( mt == SSL3_MT_CLIENT_KEY_EXCHANGE ) {
st -> hand_state = TLS_ST_SR_KEY_EXCH ;
return 1 ;
}
break ;
case TLS_ST_SR_KEY_EXCH : if ( s -> session -> peer == NULL || st -> no_cert_verify ) {
if ( mt == SSL3_MT_CHANGE_CIPHER_SPEC ) {
st -> hand_state = TLS_ST_SR_CHANGE ;
return 1 ;
}
}
else {
if ( mt == SSL3_MT_CERTIFICATE_VERIFY ) {
st -> hand_state = TLS_ST_SR_CERT_VRFY ;
return 1 ;
}
}
break ;
case TLS_ST_SR_CERT_VRFY : if ( mt == SSL3_MT_CHANGE_CIPHER_SPEC ) {
st -> hand_state = TLS_ST_SR_CHANGE ;
return 1 ;
}
break ;
case TLS_ST_SR_CHANGE : # ifndef OPENSSL_NO_NEXTPROTONEG if ( s -> s3 -> next_proto_neg_seen ) {
if ( mt == SSL3_MT_NEXT_PROTO ) {
st -> hand_state = TLS_ST_SR_NEXT_PROTO ;
return 1 ;
}
}
else {
# endif if ( mt == SSL3_MT_FINISHED ) {
st -> hand_state = TLS_ST_SR_FINISHED ;
return 1 ;
}
# ifndef OPENSSL_NO_NEXTPROTONEG }
# endif break ;
# ifndef OPENSSL_NO_NEXTPROTONEG case TLS_ST_SR_NEXT_PROTO : if ( mt == SSL3_MT_FINISHED ) {
st -> hand_state = TLS_ST_SR_FINISHED ;
return 1 ;
}
break ;
# endif case TLS_ST_SW_FINISHED : if ( mt == SSL3_MT_CHANGE_CIPHER_SPEC ) {
st -> hand_state = TLS_ST_SR_CHANGE ;
return 1 ;
}
break ;
default : break ;
}
ssl3_send_alert ( s , SSL3_AL_FATAL , SSL3_AD_UNEXPECTED_MESSAGE ) ;
SSLerr ( SSL_F_OSSL_STATEM_SERVER_READ_TRANSITION , SSL_R_UNEXPECTED_MESSAGE ) ;
return 0 ;
}
| 0
|
ber_slen_t ber_write ( BerElement * ber , LDAP_CONST char * buf , ber_len_t len , int zero ) {
char * * p ;
assert ( ber != NULL ) ;
assert ( buf != NULL ) ;
assert ( LBER_VALID ( ber ) ) ;
if ( zero != 0 ) {
ber_log_printf ( LDAP_DEBUG_ANY , ber -> ber_debug , "%s" , "ber_write: nonzero 4th argument not supported\n" ) ;
return ( - 1 ) ;
}
p = ber -> ber_sos_ptr == NULL ? & ber -> ber_ptr : & ber -> ber_sos_ptr ;
if ( len > ( ber_len_t ) ( ber -> ber_end - * p ) ) {
if ( ber_realloc ( ber , len ) != 0 ) return ( - 1 ) ;
}
AC_MEMCPY ( * p , buf , len ) ;
* p += len ;
return ( ( ber_slen_t ) len ) ;
}
| 0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.