idx
int64
func
string
target
int64
273,454
static void mark_ptr_not_null_reg(struct bpf_reg_state *reg) { switch (reg->type) { case PTR_TO_MAP_VALUE_OR_NULL: { const struct bpf_map *map = reg->map_ptr; if (map->inner_map_meta) { reg->type = CONST_PTR_TO_MAP; reg->map_ptr = map->inner_map_meta; } else if (map->map_type == BPF_MAP_TYPE_XSKMAP) { reg->type = PTR_TO_XDP_SOCK; } else if (map->map_type == BPF_MAP_TYPE_SOCKMAP || map->map_type == BPF_MAP_TYPE_SOCKHASH) { reg->type = PTR_TO_SOCKET; } else { reg->type = PTR_TO_MAP_VALUE; } break; } case PTR_TO_SOCKET_OR_NULL: reg->type = PTR_TO_SOCKET; break; case PTR_TO_SOCK_COMMON_OR_NULL: reg->type = PTR_TO_SOCK_COMMON; break; case PTR_TO_TCP_SOCK_OR_NULL: reg->type = PTR_TO_TCP_SOCK; break; case PTR_TO_BTF_ID_OR_NULL: reg->type = PTR_TO_BTF_ID; break; case PTR_TO_MEM_OR_NULL: reg->type = PTR_TO_MEM; break; case PTR_TO_RDONLY_BUF_OR_NULL: reg->type = PTR_TO_RDONLY_BUF; break; case PTR_TO_RDWR_BUF_OR_NULL: reg->type = PTR_TO_RDWR_BUF; break; default: WARN_ONCE(1, "unknown nullable register type"); } }
0
397,083
ircam_type_find (GstTypeFind * tf, gpointer ununsed) { const guint8 *data = gst_type_find_peek (tf, 0, 4); guint8 mask[4] = { 0xFF, 0xFF, 0xF8, 0xFF }; guint8 match[4] = { 0x64, 0xA3, 0x00, 0x00 }; gint x; gboolean matched = TRUE; if (!data) { return; } for (x = 0; x < 4; x++) { if ((data[x] & mask[x]) != match[x]) { matched = FALSE; } } if (matched) { gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, IRCAM_CAPS); return; } /* now try the reverse version */ matched = TRUE; for (x = 0; x < 4; x++) { if ((data[x] & mask[3 - x]) != match[3 - x]) { matched = FALSE; } } }
0
496,710
static bool is_partition_in_criterias( const std::string& partition, const std::vector<Criteria>& criterias) { bool returned_value = false; for (auto criteria_it = criterias.begin(); !returned_value && criteria_it != criterias.end(); ++criteria_it) { for (auto part : (*criteria_it).partitions) { if (StringMatching::matchPattern(part.c_str(), partition.c_str())) { returned_value = true; break; } } } return returned_value; }
0
433,891
bool encode(FilterChar * & in0, FilterChar * & stop, FilterCharVector & out) const { FilterChar * in = in0; for (; in != stop; ++in) *in = lookup(*in); return true; }
0
409,183
static js_Ast *unary(js_State *J) { js_Ast *a; INCREC(); if (jsP_accept(J, TK_DELETE)) a = EXP1(DELETE, unary(J)); else if (jsP_accept(J, TK_VOID)) a = EXP1(VOID, unary(J)); else if (jsP_accept(J, TK_TYPEOF)) a = EXP1(TYPEOF, unary(J)); else if (jsP_accept(J, TK_INC)) a = EXP1(PREINC, unary(J)); else if (jsP_accept(J, TK_DEC)) a = EXP1(PREDEC, unary(J)); else if (jsP_accept(J, '+')) a = EXP1(POS, unary(J)); else if (jsP_accept(J, '-')) a = EXP1(NEG, unary(J)); else if (jsP_accept(J, '~')) a = EXP1(BITNOT, unary(J)); else if (jsP_accept(J, '!')) a = EXP1(LOGNOT, unary(J)); else a = postfix(J); DECREC(); return a; }
0
216,772
void ScrollableShelfView::ScrollToXOffset(float x_target_offset, bool animating) { x_target_offset = CalculateClampedScrollOffset(x_target_offset); const float old_x = scroll_offset_.x(); scroll_offset_.set_x(x_target_offset); Layout(); const float diff = x_target_offset - old_x; if (animating) StartShelfScrollAnimation(diff); }
0
41,652
static inline Quantum GetPixela(const Image *restrict image, const Quantum *restrict pixel) { return(pixel[image->channel_map[aPixelChannel].offset]); }
0
198,414
void OxideQQuickWebViewPrivate::DownloadRequested( const OxideQDownloadRequest& download_request) { Q_Q(OxideQQuickWebView); emit q->downloadRequested(download_request); }
0
488,783
static gboolean avdtp_parse_cmd(struct avdtp *session, uint8_t transaction, uint8_t signal_id, void *buf, int size) { switch (signal_id) { case AVDTP_DISCOVER: DBG("Received DISCOVER_CMD"); return avdtp_discover_cmd(session, transaction, buf, size); case AVDTP_GET_CAPABILITIES: DBG("Received GET_CAPABILITIES_CMD"); return avdtp_getcap_cmd(session, transaction, buf, size, FALSE); case AVDTP_GET_ALL_CAPABILITIES: DBG("Received GET_ALL_CAPABILITIES_CMD"); return avdtp_getcap_cmd(session, transaction, buf, size, TRUE); case AVDTP_SET_CONFIGURATION: DBG("Received SET_CONFIGURATION_CMD"); return avdtp_setconf_cmd(session, transaction, buf, size); case AVDTP_GET_CONFIGURATION: DBG("Received GET_CONFIGURATION_CMD"); return avdtp_getconf_cmd(session, transaction, buf, size); case AVDTP_RECONFIGURE: DBG("Received RECONFIGURE_CMD"); return avdtp_reconf_cmd(session, transaction, buf, size); case AVDTP_OPEN: DBG("Received OPEN_CMD"); return avdtp_open_cmd(session, transaction, buf, size); case AVDTP_START: DBG("Received START_CMD"); return avdtp_start_cmd(session, transaction, buf, size); case AVDTP_CLOSE: DBG("Received CLOSE_CMD"); return avdtp_close_cmd(session, transaction, buf, size); case AVDTP_SUSPEND: DBG("Received SUSPEND_CMD"); return avdtp_suspend_cmd(session, transaction, buf, size); case AVDTP_ABORT: DBG("Received ABORT_CMD"); return avdtp_abort_cmd(session, transaction, buf, size); case AVDTP_SECURITY_CONTROL: DBG("Received SECURITY_CONTROL_CMD"); return avdtp_secctl_cmd(session, transaction, buf, size); case AVDTP_DELAY_REPORT: DBG("Received DELAY_REPORT_CMD"); return avdtp_delayreport_cmd(session, transaction, buf, size); default: DBG("Received unknown request id %u", signal_id); return avdtp_unknown_cmd(session, transaction, signal_id); } }
0
521,284
With_sum_func_cache(const Item *a, const Item *b, const Item *c) :m_with_sum_func(a->with_sum_func() || b->with_sum_func() || c->with_sum_func()) { }
0
354,787
static int bad_file_flock(struct file *filp, int cmd, struct file_lock *fl) { return -EIO; }
0
488,201
static inline int ok_jpg_load_next_bits(ok_jpg_decoder *decoder, int num_bits) { ok_jpg_load_bits(decoder, num_bits); int mask = (1 << num_bits) - 1; decoder->input_buffer_bit_count -= num_bits; return (int)(decoder->input_buffer_bits >> decoder->input_buffer_bit_count) & mask; }
0
257,821
static int nntp_mbox_sync ( struct Context * ctx , int * index_hint ) { struct NntpData * nntp_data = ctx -> data ; int rc ; # ifdef USE_HCACHE header_cache_t * hc = NULL ; # endif nntp_data -> nserv -> check_time = 0 ; rc = check_mailbox ( ctx ) ; if ( rc ) return rc ; # ifdef USE_HCACHE nntp_data -> last_cached = 0 ; hc = nntp_hcache_open ( nntp_data ) ; # endif for ( int i = 0 ; i < ctx -> msgcount ; i ++ ) { struct Header * hdr = ctx -> hdrs [ i ] ; char buf [ 16 ] ; snprintf ( buf , sizeof ( buf ) , "%d" , NHDR ( hdr ) -> article_num ) ; if ( nntp_data -> bcache && hdr -> deleted ) { mutt_debug ( 2 , "mutt_bcache_del %s\n" , buf ) ; mutt_bcache_del ( nntp_data -> bcache , buf ) ; } # ifdef USE_HCACHE if ( hc && ( hdr -> changed || hdr -> deleted ) ) { if ( hdr -> deleted && ! hdr -> read ) nntp_data -> unread -- ; mutt_debug ( 2 , "mutt_hcache_store %s\n" , buf ) ; mutt_hcache_store ( hc , buf , strlen ( buf ) , hdr , 0 ) ; } # endif } # ifdef USE_HCACHE if ( hc ) { mutt_hcache_close ( hc ) ; nntp_data -> last_cached = nntp_data -> last_loaded ; } # endif nntp_newsrc_gen_entries ( ctx ) ; nntp_newsrc_update ( nntp_data -> nserv ) ; nntp_newsrc_close ( nntp_data -> nserv ) ; return 0 ; }
0
182,571
unsigned long AudioHandler::ChannelCount() { return channel_count_; }
0
210,635
void BrowserView::ToggleBookmarkBar() { bookmark_utils::ToggleWhenVisible(browser_->profile()); }
0
241,237
void RenderWidgetHostImpl::OnSnapshotReceived(int snapshot_id, gfx::Image image) { PendingSnapshotMap::iterator it = pending_browser_snapshots_.begin(); while (it != pending_browser_snapshots_.end()) { if (it->first <= snapshot_id) { it->second.Run(image); pending_browser_snapshots_.erase(it++); } else { ++it; } } #if defined(OS_MACOSX) if (pending_browser_snapshots_.empty()) GetWakeLock()->CancelWakeLock(); #endif }
0
254,885
static int spl_filesystem_file_read_csv ( spl_filesystem_object * intern , char delimiter , char enclosure , char escape , zval * return_value TSRMLS_DC ) { int ret = SUCCESS ; do { ret = spl_filesystem_file_read ( intern , 1 TSRMLS_CC ) ; } while ( ret == SUCCESS && ! intern -> u . file . current_line_len && SPL_HAS_FLAG ( intern -> flags , SPL_FILE_OBJECT_SKIP_EMPTY ) ) ; if ( ret == SUCCESS ) { size_t buf_len = intern -> u . file . current_line_len ; char * buf = estrndup ( intern -> u . file . current_line , buf_len ) ; if ( intern -> u . file . current_zval ) { zval_ptr_dtor ( & intern -> u . file . current_zval ) ; } ALLOC_INIT_ZVAL ( intern -> u . file . current_zval ) ; php_fgetcsv ( intern -> u . file . stream , delimiter , enclosure , escape , buf_len , buf , intern -> u . file . current_zval TSRMLS_CC ) ; if ( return_value ) { if ( Z_TYPE_P ( return_value ) != IS_NULL ) { zval_dtor ( return_value ) ; ZVAL_NULL ( return_value ) ; } ZVAL_ZVAL ( return_value , intern -> u . file . current_zval , 1 , 0 ) ; } } return ret ; }
1
34,013
static bool netlink_tx_is_mmaped(struct sock *sk) { return nlk_sk(sk)->tx_ring.pg_vec != NULL; }
0
319,165
void helper_dcbz(CPUPPCState *env, target_ulong addr, uint32_t is_dcbzl) { int dcbz_size = env->dcache_line_size; #if defined(TARGET_PPC64) if (!is_dcbzl && (env->excp_model == POWERPC_EXCP_970) && ((env->spr[SPR_970_HID5] >> 7) & 0x3) == 1) { dcbz_size = 32; } #endif /* XXX add e500mc support */ do_dcbz(env, addr, dcbz_size, GETPC()); }
1
333,918
static void write_fp_dreg(DisasContext *s, int reg, TCGv_i64 v) { TCGv_i64 tcg_zero = tcg_const_i64(0); tcg_gen_st_i64(v, cpu_env, fp_reg_offset(reg, MO_64)); tcg_gen_st_i64(tcg_zero, cpu_env, fp_reg_hi_offset(reg)); tcg_temp_free_i64(tcg_zero); }
0
40,951
int ssl_connect(struct tunnel *tunnel) { ssl_disconnect(tunnel); tunnel->ssl_socket = tcp_connect(tunnel); if (tunnel->ssl_socket == -1) return 1; // registration is deprecated from OpenSSL 1.1.0 onward #if OPENSSL_API_COMPAT < 0x10100000L // Register the error strings for libcrypto & libssl SSL_load_error_strings(); // Register the available ciphers and digests SSL_library_init(); #endif tunnel->ssl_context = SSL_CTX_new(SSLv23_client_method()); if (tunnel->ssl_context == NULL) { log_error("SSL_CTX_new: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } // Load the OS default CA files if (!SSL_CTX_set_default_verify_paths(tunnel->ssl_context)) log_error("Could not load OS OpenSSL files.\n"); if (tunnel->config->ca_file) { if (!SSL_CTX_load_verify_locations( tunnel->ssl_context, tunnel->config->ca_file, NULL)) { log_error("SSL_CTX_load_verify_locations: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } } /* Use engine for PIV if user-cert config starts with pkcs11 URI: */ if (tunnel->config->use_engine > 0) { ENGINE *e; ENGINE_load_builtin_engines(); e = ENGINE_by_id("pkcs11"); if (!e) { log_error("Could not load pkcs11 Engine: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } if (!ENGINE_init(e)) { log_error("Could not init pkcs11 Engine: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); ENGINE_free(e); return 1; } if (!ENGINE_set_default_RSA(e)) abort(); ENGINE_finish(e); ENGINE_free(e); struct token parms; parms.uri = tunnel->config->user_cert; parms.cert = NULL; if (!ENGINE_ctrl_cmd(e, "LOAD_CERT_CTRL", 0, &parms, NULL, 1)) { log_error("PKCS11 ENGINE_ctrl_cmd: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } if (!SSL_CTX_use_certificate(tunnel->ssl_context, parms.cert)) { log_error("PKCS11 SSL_CTX_use_certificate: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } EVP_PKEY * privkey = ENGINE_load_private_key( e, parms.uri, UI_OpenSSL(), NULL); if (!privkey) { log_error("PKCS11 ENGINE_load_private_key: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } if (!SSL_CTX_use_PrivateKey(tunnel->ssl_context, privkey)) { log_error("PKCS11 SSL_CTX_use_PrivateKey_file: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } if (!SSL_CTX_check_private_key(tunnel->ssl_context)) { log_error("PKCS11 SSL_CTX_check_private_key: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } } else { /* end PKCS11-engine */ if (tunnel->config->user_cert) { if (!SSL_CTX_use_certificate_file( tunnel->ssl_context, tunnel->config->user_cert, SSL_FILETYPE_PEM)) { log_error("SSL_CTX_use_certificate_file: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } } if (tunnel->config->user_key) { if (!SSL_CTX_use_PrivateKey_file( tunnel->ssl_context, tunnel->config->user_key, SSL_FILETYPE_PEM)) { log_error("SSL_CTX_use_PrivateKey_file: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } } if (tunnel->config->user_cert && tunnel->config->user_key) { if (!SSL_CTX_check_private_key(tunnel->ssl_context)) { log_error("SSL_CTX_check_private_key: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } } } if (!tunnel->config->insecure_ssl) { long sslctxopt = SSL_OP_NO_SSLv3 | SSL_OP_NO_COMPRESSION; long checkopt; checkopt = SSL_CTX_set_options(tunnel->ssl_context, sslctxopt); if ((checkopt & sslctxopt) != sslctxopt) { log_error("SSL_CTX_set_options didn't set opt: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } } tunnel->ssl_handle = SSL_new(tunnel->ssl_context); if (tunnel->ssl_handle == NULL) { log_error("SSL_new: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } if (!tunnel->config->insecure_ssl) { if (!tunnel->config->cipher_list) { const char *cipher_list; if (tunnel->config->seclevel_1) cipher_list = "HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4@SECLEVEL=1"; else cipher_list = "HIGH:!aNULL:!kRSA:!PSK:!SRP:!MD5:!RC4"; tunnel->config->cipher_list = strdup(cipher_list); } } else { #if OPENSSL_VERSION_NUMBER >= 0x10100000L if (tunnel->config->min_tls <= 0) tunnel->config->min_tls = TLS1_VERSION; #endif if (!tunnel->config->cipher_list && tunnel->config->seclevel_1) { const char *cipher_list = "DEFAULT@SECLEVEL=1"; tunnel->config->cipher_list = strdup(cipher_list); } } if (tunnel->config->cipher_list) { log_debug("Setting cipher list to: %s\n", tunnel->config->cipher_list); if (!SSL_set_cipher_list(tunnel->ssl_handle, tunnel->config->cipher_list)) { log_error("SSL_set_cipher_list failed: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } } #if OPENSSL_VERSION_NUMBER >= 0x10100000L if (tunnel->config->min_tls > 0) { log_debug("Setting min proto version to: 0x%x\n", tunnel->config->min_tls); if (!SSL_set_min_proto_version(tunnel->ssl_handle, tunnel->config->min_tls)) { log_error("SSL_set_min_proto_version failed: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } } #endif if (!SSL_set_fd(tunnel->ssl_handle, tunnel->ssl_socket)) { log_error("SSL_set_fd: %s\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } SSL_set_mode(tunnel->ssl_handle, SSL_MODE_AUTO_RETRY); // Initiate SSL handshake if (SSL_connect(tunnel->ssl_handle) != 1) { log_error("SSL_connect: %s\n" "You might want to try --insecure-ssl or specify a different --cipher-list\n", ERR_error_string(ERR_peek_last_error(), NULL)); return 1; } SSL_set_mode(tunnel->ssl_handle, SSL_MODE_AUTO_RETRY); if (ssl_verify_cert(tunnel)) return 1; // Disable SIGPIPE (occurs when trying to write to an already-closed // socket). signal(SIGPIPE, SIG_IGN); return 0; }
0
138,897
bool CIRCNetwork::PutIRC(const CMessage& Message) { CIRCSock* pIRCSock = GetIRCSock(); if (!pIRCSock) { return false; } pIRCSock->PutIRC(Message); return true; }
0
252,066
SingleThreadTaskGraphRunner() { Start("CompositorTileWorker1", base::SimpleThread::Options()); }
0
148,793
set_bound_node_opt_info(OptNode* opt, MinMax* plen) { copy_mml(&(opt->sb.mmd), plen); copy_mml(&(opt->spr.mmd), plen); copy_mml(&(opt->map.mmd), plen); }
0
186,914
on_fileselector_done(void *user_data, Evas_Object *file_selector, void *event_info) { FileSelectorData *fs_data = (FileSelectorData *)user_data; const char *selected = (const char *)event_info; if (selected && *selected) ewk_file_chooser_request_file_choose(fs_data->request, selected); close_file_picker(fs_data); }
0
142,477
static void i40e_pci_error_reset_prepare(struct pci_dev *pdev) { struct i40e_pf *pf = pci_get_drvdata(pdev); i40e_prep_for_reset(pf, false); }
0
154,904
get_login_name() { static char buf[BUFSZ]; struct passwd *pw = get_unix_pw(); buf[0] = '\0'; if (pw) (void)strcpy(buf, pw->pw_name); return buf; }
0
52,441
std::size_t num_entries() const { return ix_.dim_size(0); }
0
102,430
TfLiteRegistration* Register_BIDIRECTIONAL_SEQUENCE_RNN() { static TfLiteRegistration r = { bidirectional_sequence_rnn::Init, bidirectional_sequence_rnn::Free, bidirectional_sequence_rnn::Prepare, bidirectional_sequence_rnn::Eval}; return &r; }
0
41,565
static struct extent_map *defrag_lookup_extent(struct inode *inode, u64 start) { struct extent_map_tree *em_tree = &BTRFS_I(inode)->extent_tree; struct extent_io_tree *io_tree = &BTRFS_I(inode)->io_tree; struct extent_map *em; u64 len = PAGE_CACHE_SIZE; /* * hopefully we have this extent in the tree already, try without * the full extent lock */ read_lock(&em_tree->lock); em = lookup_extent_mapping(em_tree, start, len); read_unlock(&em_tree->lock); if (!em) { /* get the big lock and read metadata off disk */ lock_extent(io_tree, start, start + len - 1); em = btrfs_get_extent(inode, NULL, 0, start, len, 0); unlock_extent(io_tree, start, start + len - 1); if (IS_ERR(em)) return NULL; } return em; }
0
231,554
ofputil_nx_flow_format_is_valid(enum nx_flow_format flow_format) { return ofputil_nx_flow_format_to_protocol(flow_format) != 0; }
0
471,722
unsigned long zslGetRank(zskiplist *zsl, double score, sds ele) { zskiplistNode *x; unsigned long rank = 0; int i; x = zsl->header; for (i = zsl->level-1; i >= 0; i--) { while (x->level[i].forward && (x->level[i].forward->score < score || (x->level[i].forward->score == score && sdscmp(x->level[i].forward->ele,ele) <= 0))) { rank += x->level[i].span; x = x->level[i].forward; } /* x might be equal to zsl->header, so test if obj is non-NULL */ if (x->ele && sdscmp(x->ele,ele) == 0) { return rank; } } return 0; }
0
247,628
LayoutRect RenderBlock::rectWithOutlineForRepaint(const RenderLayerModelObject* repaintContainer, LayoutUnit outlineWidth) const { LayoutRect r(RenderBox::rectWithOutlineForRepaint(repaintContainer, outlineWidth)); if (isAnonymousBlockContinuation()) r.inflateY(collapsedMarginBefore()); // FIXME: This is wrong for block-flows that are horizontal. return r; }
0
433,583
static int iwl_pcie_load_section(struct iwl_trans *trans, u8 section_num, const struct fw_desc *section) { u8 *v_addr; dma_addr_t p_addr; u32 offset, chunk_sz = min_t(u32, FH_MEM_TB_MAX_LENGTH, section->len); int ret = 0; IWL_DEBUG_FW(trans, "[%d] uCode section being loaded...\n", section_num); v_addr = dma_alloc_coherent(trans->dev, chunk_sz, &p_addr, GFP_KERNEL | __GFP_NOWARN); if (!v_addr) { IWL_DEBUG_INFO(trans, "Falling back to small chunks of DMA\n"); chunk_sz = PAGE_SIZE; v_addr = dma_alloc_coherent(trans->dev, chunk_sz, &p_addr, GFP_KERNEL); if (!v_addr) return -ENOMEM; } for (offset = 0; offset < section->len; offset += chunk_sz) { u32 copy_size, dst_addr; bool extended_addr = false; copy_size = min_t(u32, chunk_sz, section->len - offset); dst_addr = section->offset + offset; if (dst_addr >= IWL_FW_MEM_EXTENDED_START && dst_addr <= IWL_FW_MEM_EXTENDED_END) extended_addr = true; if (extended_addr) iwl_set_bits_prph(trans, LMPM_CHICK, LMPM_CHICK_EXTENDED_ADDR_SPACE); memcpy(v_addr, (u8 *)section->data + offset, copy_size); ret = iwl_pcie_load_firmware_chunk(trans, dst_addr, p_addr, copy_size); if (extended_addr) iwl_clear_bits_prph(trans, LMPM_CHICK, LMPM_CHICK_EXTENDED_ADDR_SPACE); if (ret) { IWL_ERR(trans, "Could not load the [%d] uCode section\n", section_num); break; } } dma_free_coherent(trans->dev, chunk_sz, v_addr, p_addr); return ret; }
0
18,464
static int mpeg_decode_postinit ( AVCodecContext * avctx ) { Mpeg1Context * s1 = avctx -> priv_data ; MpegEncContext * s = & s1 -> mpeg_enc_ctx ; uint8_t old_permutation [ 64 ] ; if ( ( s1 -> mpeg_enc_ctx_allocated == 0 ) || avctx -> coded_width != s -> width || avctx -> coded_height != s -> height || s1 -> save_width != s -> width || s1 -> save_height != s -> height || s1 -> save_aspect_info != s -> aspect_ratio_info || s1 -> save_progressive_seq != s -> progressive_sequence || 0 ) { if ( s1 -> mpeg_enc_ctx_allocated ) { ParseContext pc = s -> parse_context ; s -> parse_context . buffer = 0 ; ff_MPV_common_end ( s ) ; s -> parse_context = pc ; } if ( ( s -> width == 0 ) || ( s -> height == 0 ) ) return - 2 ; avcodec_set_dimensions ( avctx , s -> width , s -> height ) ; avctx -> bit_rate = s -> bit_rate ; s1 -> save_aspect_info = s -> aspect_ratio_info ; s1 -> save_width = s -> width ; s1 -> save_height = s -> height ; s1 -> save_progressive_seq = s -> progressive_sequence ; avctx -> has_b_frames = ! s -> low_delay ; if ( avctx -> codec_id == AV_CODEC_ID_MPEG1VIDEO ) { avctx -> time_base . den = ff_mpeg12_frame_rate_tab [ s -> frame_rate_index ] . num ; avctx -> time_base . num = ff_mpeg12_frame_rate_tab [ s -> frame_rate_index ] . den ; avctx -> sample_aspect_ratio = av_d2q ( 1.0 / ff_mpeg1_aspect [ s -> aspect_ratio_info ] , 255 ) ; avctx -> ticks_per_frame = 1 ; } else { av_reduce ( & s -> avctx -> time_base . den , & s -> avctx -> time_base . num , ff_mpeg12_frame_rate_tab [ s -> frame_rate_index ] . num * s1 -> frame_rate_ext . num * 2 , ff_mpeg12_frame_rate_tab [ s -> frame_rate_index ] . den * s1 -> frame_rate_ext . den , 1 << 30 ) ; avctx -> ticks_per_frame = 2 ; if ( s -> aspect_ratio_info > 1 ) { AVRational dar = av_mul_q ( av_div_q ( ff_mpeg2_aspect [ s -> aspect_ratio_info ] , ( AVRational ) { s1 -> pan_scan . width , s1 -> pan_scan . height } ) , ( AVRational ) { s -> width , s -> height } ) ; if ( ( s1 -> pan_scan . width == 0 ) || ( s1 -> pan_scan . height == 0 ) || ( av_cmp_q ( dar , ( AVRational ) { 4 , 3 } ) && av_cmp_q ( dar , ( AVRational ) { 16 , 9 } ) ) ) { s -> avctx -> sample_aspect_ratio = av_div_q ( ff_mpeg2_aspect [ s -> aspect_ratio_info ] , ( AVRational ) { s -> width , s -> height } ) ; } else { s -> avctx -> sample_aspect_ratio = av_div_q ( ff_mpeg2_aspect [ s -> aspect_ratio_info ] , ( AVRational ) { s1 -> pan_scan . width , s1 -> pan_scan . height } ) ; av_dlog ( avctx , "A %d/%d\n" , ff_mpeg2_aspect [ s -> aspect_ratio_info ] . num , ff_mpeg2_aspect [ s -> aspect_ratio_info ] . den ) ; av_dlog ( avctx , "B %d/%d\n" , s -> avctx -> sample_aspect_ratio . num , s -> avctx -> sample_aspect_ratio . den ) ; } } else { s -> avctx -> sample_aspect_ratio = ff_mpeg2_aspect [ s -> aspect_ratio_info ] ; } } avctx -> pix_fmt = mpeg_get_pixelformat ( avctx ) ; avctx -> hwaccel = ff_find_hwaccel ( avctx -> codec -> id , avctx -> pix_fmt ) ; if ( avctx -> pix_fmt == AV_PIX_FMT_XVMC_MPEG2_IDCT || avctx -> hwaccel || s -> avctx -> codec -> capabilities & CODEC_CAP_HWACCEL_VDPAU ) if ( avctx -> idct_algo == FF_IDCT_AUTO ) avctx -> idct_algo = FF_IDCT_SIMPLE ; memcpy ( old_permutation , s -> dsp . idct_permutation , 64 * sizeof ( uint8_t ) ) ; if ( ff_MPV_common_init ( s ) < 0 ) return - 2 ; quant_matrix_rebuild ( s -> intra_matrix , old_permutation , s -> dsp . idct_permutation ) ; quant_matrix_rebuild ( s -> inter_matrix , old_permutation , s -> dsp . idct_permutation ) ; quant_matrix_rebuild ( s -> chroma_intra_matrix , old_permutation , s -> dsp . idct_permutation ) ; quant_matrix_rebuild ( s -> chroma_inter_matrix , old_permutation , s -> dsp . idct_permutation ) ; s1 -> mpeg_enc_ctx_allocated = 1 ; } return 0 ; }
0
469,299
int xfrm_dev_state_flush(struct net *net, struct net_device *dev, bool task_valid) { int i, err = 0, cnt = 0; spin_lock_bh(&net->xfrm.xfrm_state_lock); err = xfrm_dev_state_flush_secctx_check(net, dev, task_valid); if (err) goto out; err = -ESRCH; for (i = 0; i <= net->xfrm.state_hmask; i++) { struct xfrm_state *x; struct xfrm_state_offload *xso; restart: hlist_for_each_entry(x, net->xfrm.state_bydst+i, bydst) { xso = &x->xso; if (!xfrm_state_kern(x) && xso->dev == dev) { xfrm_state_hold(x); spin_unlock_bh(&net->xfrm.xfrm_state_lock); err = xfrm_state_delete(x); xfrm_audit_state_delete(x, err ? 0 : 1, task_valid); xfrm_state_put(x); if (!err) cnt++; spin_lock_bh(&net->xfrm.xfrm_state_lock); goto restart; } } } if (cnt) err = 0; out: spin_unlock_bh(&net->xfrm.xfrm_state_lock); return err; }
0
145,847
static int check_bpf_snprintf_call(struct bpf_verifier_env *env, struct bpf_reg_state *regs) { struct bpf_reg_state *fmt_reg = &regs[BPF_REG_3]; struct bpf_reg_state *data_len_reg = &regs[BPF_REG_5]; struct bpf_map *fmt_map = fmt_reg->map_ptr; int err, fmt_map_off, num_args; u64 fmt_addr; char *fmt; /* data must be an array of u64 */ if (data_len_reg->var_off.value % 8) return -EINVAL; num_args = data_len_reg->var_off.value / 8; /* fmt being ARG_PTR_TO_CONST_STR guarantees that var_off is const * and map_direct_value_addr is set. */ fmt_map_off = fmt_reg->off + fmt_reg->var_off.value; err = fmt_map->ops->map_direct_value_addr(fmt_map, &fmt_addr, fmt_map_off); if (err) { verbose(env, "verifier bug\n"); return -EFAULT; } fmt = (char *)(long)fmt_addr + fmt_map_off; /* We are also guaranteed that fmt+fmt_map_off is NULL terminated, we * can focus on validating the format specifiers. */ err = bpf_bprintf_prepare(fmt, UINT_MAX, NULL, NULL, num_args); if (err < 0) verbose(env, "Invalid format string\n"); return err; }
0
285,136
static void CollectScrollbarUpdates( ScrollAndScaleSet* scroll_info, std::unordered_map<int, std::unique_ptr<ScrollbarAnimationController>>* controllers) { scroll_info->scrollbars.reserve(controllers->size()); for (auto& pair : *controllers) { scroll_info->scrollbars.push_back(LayerTreeHostCommon::ScrollbarsUpdateInfo( pair.first, pair.second->ScrollbarsHidden())); } }
0
172,481
void gscms_set_icc_range(cmm_profile_t **icc_profile) { int num_comp = (*icc_profile)->num_comps; int k; for ( k = 0; k < num_comp; k++) { (*icc_profile)->Range.ranges[k].rmin = 0.0; (*icc_profile)->Range.ranges[k].rmax = 1.0; } }
0
138,890
static int set_procfs_val(const char *path, const char *val) { int rc = -1; FILE *fp = fopen(path, "w"); if (fp) { if (fprintf(fp, "%s", val) > 0) rc = 0; fclose(fp); } return rc; }
0
125,580
uint32_t writeFieldBegin( const char* name, const TType fieldType, const int16_t fieldId) { T_VIRTUAL_CALL(); return writeFieldBegin_virt(name, fieldType, fieldId); }
0
31,721
static int proc_pid_limits(struct seq_file *m, struct pid_namespace *ns, struct pid *pid, struct task_struct *task) { unsigned int i; unsigned long flags; struct rlimit rlim[RLIM_NLIMITS]; if (!lock_task_sighand(task, &flags)) return 0; memcpy(rlim, task->signal->rlim, sizeof(struct rlimit) * RLIM_NLIMITS); unlock_task_sighand(task, &flags); /* * print the file header */ seq_printf(m, "%-25s %-20s %-20s %-10s\n", "Limit", "Soft Limit", "Hard Limit", "Units"); for (i = 0; i < RLIM_NLIMITS; i++) { if (rlim[i].rlim_cur == RLIM_INFINITY) seq_printf(m, "%-25s %-20s ", lnames[i].name, "unlimited"); else seq_printf(m, "%-25s %-20lu ", lnames[i].name, rlim[i].rlim_cur); if (rlim[i].rlim_max == RLIM_INFINITY) seq_printf(m, "%-20s ", "unlimited"); else seq_printf(m, "%-20lu ", rlim[i].rlim_max); if (lnames[i].unit) seq_printf(m, "%-10s\n", lnames[i].unit); else seq_putc(m, '\n'); } return 0; }
0
522,874
static int rc4_hmac_md5_set_ctx_params(void *vctx, const OSSL_PARAM params[]) { PROV_RC4_HMAC_MD5_CTX *ctx = (PROV_RC4_HMAC_MD5_CTX *)vctx; const OSSL_PARAM *p; size_t sz; if (params == NULL) return 1; p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_KEYLEN); if (p != NULL) { if (!OSSL_PARAM_get_size_t(p, &sz)) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER); return 0; } if (ctx->base.keylen != sz) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_KEY_LENGTH); return 0; } } p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_IVLEN); if (p != NULL) { if (!OSSL_PARAM_get_size_t(p, &sz)) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER); return 0; } if (ctx->base.ivlen != sz) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_IV_LENGTH); return 0; } } p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_TLS1_AAD); if (p != NULL) { if (p->data_type != OSSL_PARAM_OCTET_STRING) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER); return 0; } sz = GET_HW(ctx)->tls_init(&ctx->base, p->data, p->data_size); if (sz == 0) { ERR_raise(ERR_LIB_PROV, PROV_R_INVALID_DATA); return 0; } ctx->tls_aad_pad_sz = sz; } p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_AEAD_MAC_KEY); if (p != NULL) { if (p->data_type != OSSL_PARAM_OCTET_STRING) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER); return 0; } GET_HW(ctx)->init_mackey(&ctx->base, p->data, p->data_size); } p = OSSL_PARAM_locate_const(params, OSSL_CIPHER_PARAM_TLS_VERSION); if (p != NULL) { if (!OSSL_PARAM_get_uint(p, &ctx->base.tlsversion)) { ERR_raise(ERR_LIB_PROV, PROV_R_FAILED_TO_GET_PARAMETER); return 0; } } return 1; }
0
52,618
int mp_invmod_mont_ct (mp_int * a, mp_int * b, mp_int * c, mp_digit mp) { return fp_invmod_mont_ct(a, b, c, mp); }
0
44,472
void c_SimpleXMLElementIterator::set_parent(c_SimpleXMLElement* parent) { m_parent = parent; reset_iterator(); }
0
28,533
static void flush ( AVCodecContext * avctx ) { WMAProDecodeCtx * s = avctx -> priv_data ; int i ; for ( i = 0 ; i < avctx -> channels ; i ++ ) memset ( s -> channel [ i ] . out , 0 , s -> samples_per_frame * sizeof ( * s -> channel [ i ] . out ) ) ; s -> packet_loss = 1 ; }
0
395,567
static int binlog_savepoint_set(handlerton *hton, THD *thd, void *sv) { DBUG_ENTER("binlog_savepoint_set"); binlog_trans_log_savepos(thd, (my_off_t*) sv); // buffer to store quoted identifier char* buffer= (char *)my_malloc(sizeof("SAVEPOINT ")+ 1 + NAME_LEN * 2 + 2, MYF(0)); String log_query(buffer, sizeof(buffer), system_charset_info); log_query.length(0); /* Write it to the binary log */ if (log_query.append(STRING_WITH_LEN("SAVEPOINT "))) DBUG_RETURN(1); else append_identifier(thd, &log_query, thd->lex->ident.str, thd->lex->ident.length); int errcode= query_error_code(thd, thd->killed == THD::NOT_KILLED); Query_log_event qinfo(thd, log_query.c_ptr_safe(), log_query.length(), TRUE, FALSE, TRUE, errcode); my_free(buffer); DBUG_RETURN(mysql_bin_log.write(&qinfo)); }
0
453,223
static bool address_char(int const c) { return filename_char(c) || (c == ':') || (c == '[') || (c == ']') || (c == '/'); }
0
49,699
nfs_commit_list(struct inode *inode, struct list_head *head, int how, struct nfs_commit_info *cinfo) { struct nfs_commit_data *data; data = nfs_commitdata_alloc(); if (!data) goto out_bad; /* Set up the argument struct */ nfs_init_commit(data, head, NULL, cinfo); atomic_inc(&cinfo->mds->rpcs_out); return nfs_initiate_commit(NFS_CLIENT(inode), data, data->mds_ops, how, 0); out_bad: nfs_retry_commit(head, NULL, cinfo); cinfo->completion_ops->error_cleanup(NFS_I(inode)); return -ENOMEM; }
0
458,767
conntrack_flush(struct conntrack *ct, const uint16_t *zone) { for (unsigned i = 0; i < CONNTRACK_BUCKETS; i++) { struct conntrack_bucket *ctb = &ct->buckets[i]; ovs_mutex_lock(&ctb->cleanup_mutex); ct_lock_lock(&ctb->lock); for (unsigned j = 0; j < N_CT_TM; j++) { struct conn *conn, *next; LIST_FOR_EACH_SAFE (conn, next, exp_node, &ctb->exp_lists[j]) { if (!zone || *zone == conn->key.zone) { conn_clean(ct, conn, ctb); } } } ct_lock_unlock(&ctb->lock); ovs_mutex_unlock(&ctb->cleanup_mutex); } return 0; }
0
306,903
void Document::moveNodeIteratorsToNewDocument(Node& node, Document& newDocument) { WillBeHeapHashSet<RawPtrWillBeWeakMember<NodeIterator>> nodeIteratorsList = m_nodeIterators; for (NodeIterator* ni : nodeIteratorsList) { if (ni->root() == node) { detachNodeIterator(ni); newDocument.attachNodeIterator(ni); } } }
0
414,613
static int __mb_check_buddy(struct ext4_buddy *e4b, char *file, const char *function, int line) { struct super_block *sb = e4b->bd_sb; int order = e4b->bd_blkbits + 1; int max; int max2; int i; int j; int k; int count; struct ext4_group_info *grp; int fragments = 0; int fstart; struct list_head *cur; void *buddy; void *buddy2; { static int mb_check_counter; if (mb_check_counter++ % 100 != 0) return 0; } while (order > 1) { buddy = mb_find_buddy(e4b, order, &max); MB_CHECK_ASSERT(buddy); buddy2 = mb_find_buddy(e4b, order - 1, &max2); MB_CHECK_ASSERT(buddy2); MB_CHECK_ASSERT(buddy != buddy2); MB_CHECK_ASSERT(max * 2 == max2); count = 0; for (i = 0; i < max; i++) { if (mb_test_bit(i, buddy)) { /* only single bit in buddy2 may be 1 */ if (!mb_test_bit(i << 1, buddy2)) { MB_CHECK_ASSERT( mb_test_bit((i<<1)+1, buddy2)); } else if (!mb_test_bit((i << 1) + 1, buddy2)) { MB_CHECK_ASSERT( mb_test_bit(i << 1, buddy2)); } continue; } /* both bits in buddy2 must be 1 */ MB_CHECK_ASSERT(mb_test_bit(i << 1, buddy2)); MB_CHECK_ASSERT(mb_test_bit((i << 1) + 1, buddy2)); for (j = 0; j < (1 << order); j++) { k = (i * (1 << order)) + j; MB_CHECK_ASSERT( !mb_test_bit(k, e4b->bd_bitmap)); } count++; } MB_CHECK_ASSERT(e4b->bd_info->bb_counters[order] == count); order--; } fstart = -1; buddy = mb_find_buddy(e4b, 0, &max); for (i = 0; i < max; i++) { if (!mb_test_bit(i, buddy)) { MB_CHECK_ASSERT(i >= e4b->bd_info->bb_first_free); if (fstart == -1) { fragments++; fstart = i; } continue; } fstart = -1; /* check used bits only */ for (j = 0; j < e4b->bd_blkbits + 1; j++) { buddy2 = mb_find_buddy(e4b, j, &max2); k = i >> j; MB_CHECK_ASSERT(k < max2); MB_CHECK_ASSERT(mb_test_bit(k, buddy2)); } } MB_CHECK_ASSERT(!EXT4_MB_GRP_NEED_INIT(e4b->bd_info)); MB_CHECK_ASSERT(e4b->bd_info->bb_fragments == fragments); grp = ext4_get_group_info(sb, e4b->bd_group); list_for_each(cur, &grp->bb_prealloc_list) { ext4_group_t groupnr; struct ext4_prealloc_space *pa; pa = list_entry(cur, struct ext4_prealloc_space, pa_group_list); ext4_get_group_no_and_offset(sb, pa->pa_pstart, &groupnr, &k); MB_CHECK_ASSERT(groupnr == e4b->bd_group); for (i = 0; i < pa->pa_len; i++) MB_CHECK_ASSERT(mb_test_bit(k + i, buddy)); } return 0; }
0
301,805
menu_add_link(WebKitWebView *page, GArray *argv, GString *result) { (void) page; (void) result; add_to_menu(argv, WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK); }
0
356,033
int udplite_get_port(struct sock *sk, unsigned short p, int (*c)(const struct sock *, const struct sock *)) { return __udp_lib_get_port(sk, p, udplite_hash, c); }
0
331,819
int av_opt_set_pixel_fmt(void *obj, const char *name, enum AVPixelFormat fmt, int search_flags) { return set_format(obj, name, fmt, search_flags, AV_OPT_TYPE_PIXEL_FMT, "pixel", AV_PIX_FMT_NB-1); }
0
105,635
static void ExportGrayQuantum(const Image *image,QuantumInfo *quantum_info, const MagickSizeType number_pixels,const Quantum *magick_restrict p, unsigned char *magick_restrict q,ExceptionInfo *exception) { QuantumAny range; ssize_t x; assert(exception != (ExceptionInfo *) NULL); assert(exception->signature == MagickCoreSignature); switch (quantum_info->depth) { case 1: { double threshold; unsigned char black, white; ssize_t bit; black=0x00; white=0x01; if (quantum_info->min_is_white != MagickFalse) { black=0x01; white=0x00; } threshold=QuantumRange/2.0; for (x=((ssize_t) number_pixels-7); x > 0; x-=8) { *q='\0'; *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 7; p+=GetPixelChannels(image); *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 6; p+=GetPixelChannels(image); *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 5; p+=GetPixelChannels(image); *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 4; p+=GetPixelChannels(image); *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 3; p+=GetPixelChannels(image); *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 2; p+=GetPixelChannels(image); *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 1; p+=GetPixelChannels(image); *q|=(GetPixelLuma(image,p) < threshold ? black : white) << 0; p+=GetPixelChannels(image); q++; } if ((number_pixels % 8) != 0) { *q='\0'; for (bit=7; bit >= (ssize_t) (8-(number_pixels % 8)); bit--) { *q|=(GetPixelLuma(image,p) < threshold ? black : white) << bit; p+=GetPixelChannels(image); } q++; } break; } case 4: { unsigned char pixel; for (x=0; x < (ssize_t) (number_pixels-1) ; x+=2) { pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p))); *q=(((pixel >> 4) & 0xf) << 4); p+=GetPixelChannels(image); pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p))); *q|=pixel >> 4; p+=GetPixelChannels(image); q++; } if ((number_pixels % 2) != 0) { pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p))); *q=(((pixel >> 4) & 0xf) << 4); p+=GetPixelChannels(image); q++; } break; } case 8: { unsigned char pixel; for (x=0; x < (ssize_t) number_pixels; x++) { pixel=ScaleQuantumToChar(ClampToQuantum(GetPixelLuma(image,p))); q=PopCharPixel(pixel,q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } case 10: { range=GetQuantumRange(quantum_info->depth); if (quantum_info->pack == MagickFalse) { unsigned int pixel; for (x=0; x < (ssize_t) (number_pixels-2); x+=3) { pixel=(unsigned int) (ScaleQuantumToAny(ClampToQuantum( GetPixelLuma(image,p+2*GetPixelChannels(image))),range) << 22 | ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p+ GetPixelChannels(image))),range) << 12 | ScaleQuantumToAny( ClampToQuantum(GetPixelLuma(image,p)),range) << 2); q=PopLongPixel(quantum_info->endian,pixel,q); p+=3*GetPixelChannels(image); q+=quantum_info->pad; } if (x < (ssize_t) number_pixels) { pixel=0U; if (x++ < (ssize_t) (number_pixels-1)) pixel|=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p+ GetPixelChannels(image))),range) << 12; if (x++ < (ssize_t) number_pixels) pixel|=ScaleQuantumToAny(ClampToQuantum(GetPixelLuma(image,p)), range) << 2; q=PopLongPixel(quantum_info->endian,pixel,q); } break; } for (x=0; x < (ssize_t) number_pixels; x++) { q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(ClampToQuantum( GetPixelLuma(image,p)),range),q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } case 12: { unsigned short pixel; range=GetQuantumRange(quantum_info->depth); if (quantum_info->pack == MagickFalse) { for (x=0; x < (ssize_t) number_pixels; x++) { pixel=ScaleQuantumToShort(ClampToQuantum(GetPixelLuma(image,p))); q=PopShortPixel(quantum_info->endian,(unsigned short) (pixel >> 4), q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } for (x=0; x < (ssize_t) number_pixels; x++) { q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(ClampToQuantum( GetPixelLuma(image,p)),range),q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } case 16: { unsigned short pixel; if (quantum_info->format == FloatingPointQuantumFormat) { for (x=0; x < (ssize_t) number_pixels; x++) { pixel=SinglePrecisionToHalf(QuantumScale*GetPixelLuma(image,p)); q=PopShortPixel(quantum_info->endian,pixel,q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } for (x=0; x < (ssize_t) number_pixels; x++) { pixel=ScaleQuantumToShort(ClampToQuantum(GetPixelLuma(image,p))); q=PopShortPixel(quantum_info->endian,pixel,q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } case 32: { unsigned int pixel; if (quantum_info->format == FloatingPointQuantumFormat) { for (x=0; x < (ssize_t) number_pixels; x++) { float float_pixel; float_pixel=(float) GetPixelLuma(image,p); q=PopFloatPixel(quantum_info,float_pixel,q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } for (x=0; x < (ssize_t) number_pixels; x++) { pixel=ScaleQuantumToLong(ClampToQuantum(GetPixelLuma(image,p))); q=PopLongPixel(quantum_info->endian,pixel,q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } case 64: { if (quantum_info->format == FloatingPointQuantumFormat) { for (x=0; x < (ssize_t) number_pixels; x++) { double pixel; pixel=GetPixelLuma(image,p); q=PopDoublePixel(quantum_info,pixel,q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } } default: { range=GetQuantumRange(quantum_info->depth); for (x=0; x < (ssize_t) number_pixels; x++) { q=PopQuantumPixel(quantum_info,ScaleQuantumToAny(ClampToQuantum( GetPixelLuma(image,p)),range),q); p+=GetPixelChannels(image); q+=quantum_info->pad; } break; } } }
0
379,886
static int ZEND_FASTCALL ZEND_FETCH_OBJ_RW_SPEC_CV_CV_HANDLER(ZEND_OPCODE_HANDLER_ARGS) { zend_op *opline = EX(opline); zend_free_op free_op1; zval *property = _get_zval_ptr_cv(&opline->op2, EX(Ts), BP_VAR_R TSRMLS_CC); zval **container = _get_zval_ptr_ptr_cv(&opline->op1, EX(Ts), BP_VAR_RW TSRMLS_CC); if (0) { MAKE_REAL_ZVAL_PTR(property); } if (IS_CV == IS_VAR && !container) { zend_error_noreturn(E_ERROR, "Cannot use string offset as an object"); } zend_fetch_property_address(&EX_T(opline->result.u.var), container, property, BP_VAR_RW TSRMLS_CC); if (0) { zval_ptr_dtor(&property); } else { } if (IS_CV == IS_VAR && 0 && READY_TO_DESTROY(free_op1.var)) { AI_USE_PTR(EX_T(opline->result.u.var).var); if (!PZVAL_IS_REF(*EX_T(opline->result.u.var).var.ptr_ptr) && Z_REFCOUNT_PP(EX_T(opline->result.u.var).var.ptr_ptr) > 2) { SEPARATE_ZVAL(EX_T(opline->result.u.var).var.ptr_ptr); } } ZEND_VM_NEXT_OPCODE(); }
0
368,683
eat_whitespace_no_nl(const char *s) { while (*s == ' ' || *s == '\t' || *s == '\r') ++s; return s; }
0
512,216
const char *imap_parser_read_word(struct imap_parser *parser) { const unsigned char *data; size_t i, data_size; data = i_stream_get_data(parser->input, &data_size); for (i = 0; i < data_size; i++) { if (data[i] == ' ' || data[i] == '\r' || data[i] == '\n') break; } if (i < data_size) { data_size = i + (data[i] == ' ' ? 1 : 0); parser->line_size += data_size; i_stream_skip(parser->input, data_size); return p_strndup(parser->pool, data, i); } else { return NULL; } }
0
351,254
void ServerSecurityFeature::collectOptions( std::shared_ptr<ProgramOptions> options) { options ->addOption( "--server.harden", "lock down REST APIs that reveal version information or server " "internals for non-admin users", new BooleanParameter(&_hardenedRestApi)) .setIntroducedIn(30500); options ->addOption("--foxx.api", "enables Foxx management REST APIs", new BooleanParameter(&_enableFoxxApi), arangodb::options::makeFlags( arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator, arangodb::options::Flags::OnSingle)) .setIntroducedIn(30500); options ->addOption("--foxx.store", "enables Foxx store in web interface", new BooleanParameter(&_enableFoxxStore), arangodb::options::makeFlags( arangodb::options::Flags::DefaultNoComponents, arangodb::options::Flags::OnCoordinator, arangodb::options::Flags::OnSingle)) .setIntroducedIn(30500); }
1
321,682
static always_inline void gen_arith3 (void *helper, int ra, int rb, int rc, int islit, uint8_t lit) { if (unlikely(rc == 31)) return; if (ra != 31) { if (islit) { TCGv tmp = tcg_const_i64(lit); tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], tmp); tcg_temp_free(tmp); } else tcg_gen_helper_1_2(helper, cpu_ir[rc], cpu_ir[ra], cpu_ir[rb]); } else { TCGv tmp1 = tcg_const_i64(0); if (islit) { TCGv tmp2 = tcg_const_i64(lit); tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, tmp2); tcg_temp_free(tmp2); } else tcg_gen_helper_1_2(helper, cpu_ir[rc], tmp1, cpu_ir[rb]); tcg_temp_free(tmp1); } }
0
305,778
schannel_recv(struct Curl_easy *data, int sockindex, char *buf, size_t len, CURLcode *err) { size_t size = 0; ssize_t nread = -1; struct connectdata *conn = data->conn; struct ssl_connect_data *connssl = &conn->ssl[sockindex]; unsigned char *reallocated_buffer; size_t reallocated_length; bool done = FALSE; SecBuffer inbuf[4]; SecBufferDesc inbuf_desc; SECURITY_STATUS sspi_status = SEC_E_OK; /* we want the length of the encrypted buffer to be at least large enough that it can hold all the bytes requested and some TLS record overhead. */ size_t min_encdata_length = len + CURL_SCHANNEL_BUFFER_FREE_SIZE; /**************************************************************************** * Don't return or set BACKEND->recv_unrecoverable_err unless in the cleanup. * The pattern for return error is set *err, optional infof, goto cleanup. * * Our priority is to always return as much decrypted data to the caller as * possible, even if an error occurs. The state of the decrypted buffer must * always be valid. Transfer of decrypted data to the caller's buffer is * handled in the cleanup. */ DEBUGF(infof(data, "schannel: client wants to read %zu bytes\n", len)); *err = CURLE_OK; if(len && len <= BACKEND->decdata_offset) { infof(data, "schannel: enough decrypted data is already available\n"); goto cleanup; } else if(BACKEND->recv_unrecoverable_err) { *err = BACKEND->recv_unrecoverable_err; infof(data, "schannel: an unrecoverable error occurred in a prior call\n"); goto cleanup; } else if(BACKEND->recv_sspi_close_notify) { /* once a server has indicated shutdown there is no more encrypted data */ infof(data, "schannel: server indicated shutdown in a prior call\n"); goto cleanup; } /* It's debatable what to return when !len. Regardless we can't return immediately because there may be data to decrypt (in the case we want to decrypt all encrypted cached data) so handle !len later in cleanup. */ else if(len && !BACKEND->recv_connection_closed) { /* increase enc buffer in order to fit the requested amount of data */ size = BACKEND->encdata_length - BACKEND->encdata_offset; if(size < CURL_SCHANNEL_BUFFER_FREE_SIZE || BACKEND->encdata_length < min_encdata_length) { reallocated_length = BACKEND->encdata_offset + CURL_SCHANNEL_BUFFER_FREE_SIZE; if(reallocated_length < min_encdata_length) { reallocated_length = min_encdata_length; } reallocated_buffer = realloc(BACKEND->encdata_buffer, reallocated_length); if(!reallocated_buffer) { *err = CURLE_OUT_OF_MEMORY; failf(data, "schannel: unable to re-allocate memory"); goto cleanup; } BACKEND->encdata_buffer = reallocated_buffer; BACKEND->encdata_length = reallocated_length; size = BACKEND->encdata_length - BACKEND->encdata_offset; DEBUGF(infof(data, "schannel: encdata_buffer resized %zu\n", BACKEND->encdata_length)); } DEBUGF(infof(data, "schannel: encrypted data buffer: offset %zu length %zu\n", BACKEND->encdata_offset, BACKEND->encdata_length)); /* read encrypted data from socket */ *err = Curl_read_plain(conn->sock[sockindex], (char *)(BACKEND->encdata_buffer + BACKEND->encdata_offset), size, &nread); if(*err) { nread = -1; if(*err == CURLE_AGAIN) DEBUGF(infof(data, "schannel: Curl_read_plain returned CURLE_AGAIN\n")); else if(*err == CURLE_RECV_ERROR) infof(data, "schannel: Curl_read_plain returned CURLE_RECV_ERROR\n"); else infof(data, "schannel: Curl_read_plain returned error %d\n", *err); } else if(nread == 0) { BACKEND->recv_connection_closed = true; DEBUGF(infof(data, "schannel: server closed the connection\n")); } else if(nread > 0) { BACKEND->encdata_offset += (size_t)nread; BACKEND->encdata_is_incomplete = false; DEBUGF(infof(data, "schannel: encrypted data got %zd\n", nread)); } } DEBUGF(infof(data, "schannel: encrypted data buffer: offset %zu length %zu\n", BACKEND->encdata_offset, BACKEND->encdata_length)); /* decrypt loop */ while(BACKEND->encdata_offset > 0 && sspi_status == SEC_E_OK && (!len || BACKEND->decdata_offset < len || BACKEND->recv_connection_closed)) { /* prepare data buffer for DecryptMessage call */ InitSecBuffer(&inbuf[0], SECBUFFER_DATA, BACKEND->encdata_buffer, curlx_uztoul(BACKEND->encdata_offset)); /* we need 3 more empty input buffers for possible output */ InitSecBuffer(&inbuf[1], SECBUFFER_EMPTY, NULL, 0); InitSecBuffer(&inbuf[2], SECBUFFER_EMPTY, NULL, 0); InitSecBuffer(&inbuf[3], SECBUFFER_EMPTY, NULL, 0); InitSecBufferDesc(&inbuf_desc, inbuf, 4); /* https://msdn.microsoft.com/en-us/library/windows/desktop/aa375348.aspx */ sspi_status = s_pSecFn->DecryptMessage(&BACKEND->ctxt->ctxt_handle, &inbuf_desc, 0, NULL); /* check if everything went fine (server may want to renegotiate or shutdown the connection context) */ if(sspi_status == SEC_E_OK || sspi_status == SEC_I_RENEGOTIATE || sspi_status == SEC_I_CONTEXT_EXPIRED) { /* check for successfully decrypted data, even before actual renegotiation or shutdown of the connection context */ if(inbuf[1].BufferType == SECBUFFER_DATA) { DEBUGF(infof(data, "schannel: decrypted data length: %lu\n", inbuf[1].cbBuffer)); /* increase buffer in order to fit the received amount of data */ size = inbuf[1].cbBuffer > CURL_SCHANNEL_BUFFER_FREE_SIZE ? inbuf[1].cbBuffer : CURL_SCHANNEL_BUFFER_FREE_SIZE; if(BACKEND->decdata_length - BACKEND->decdata_offset < size || BACKEND->decdata_length < len) { /* increase internal decrypted data buffer */ reallocated_length = BACKEND->decdata_offset + size; /* make sure that the requested amount of data fits */ if(reallocated_length < len) { reallocated_length = len; } reallocated_buffer = realloc(BACKEND->decdata_buffer, reallocated_length); if(!reallocated_buffer) { *err = CURLE_OUT_OF_MEMORY; failf(data, "schannel: unable to re-allocate memory"); goto cleanup; } BACKEND->decdata_buffer = reallocated_buffer; BACKEND->decdata_length = reallocated_length; } /* copy decrypted data to internal buffer */ size = inbuf[1].cbBuffer; if(size) { memcpy(BACKEND->decdata_buffer + BACKEND->decdata_offset, inbuf[1].pvBuffer, size); BACKEND->decdata_offset += size; } DEBUGF(infof(data, "schannel: decrypted data added: %zu\n", size)); DEBUGF(infof(data, "schannel: decrypted cached: offset %zu length %zu\n", BACKEND->decdata_offset, BACKEND->decdata_length)); } /* check for remaining encrypted data */ if(inbuf[3].BufferType == SECBUFFER_EXTRA && inbuf[3].cbBuffer > 0) { DEBUGF(infof(data, "schannel: encrypted data length: %lu\n", inbuf[3].cbBuffer)); /* check if the remaining data is less than the total amount * and therefore begins after the already processed data */ if(BACKEND->encdata_offset > inbuf[3].cbBuffer) { /* move remaining encrypted data forward to the beginning of buffer */ memmove(BACKEND->encdata_buffer, (BACKEND->encdata_buffer + BACKEND->encdata_offset) - inbuf[3].cbBuffer, inbuf[3].cbBuffer); BACKEND->encdata_offset = inbuf[3].cbBuffer; } DEBUGF(infof(data, "schannel: encrypted cached: offset %zu length %zu\n", BACKEND->encdata_offset, BACKEND->encdata_length)); } else { /* reset encrypted buffer offset, because there is no data remaining */ BACKEND->encdata_offset = 0; } /* check if server wants to renegotiate the connection context */ if(sspi_status == SEC_I_RENEGOTIATE) { infof(data, "schannel: remote party requests renegotiation\n"); if(*err && *err != CURLE_AGAIN) { infof(data, "schannel: can't renogotiate, an error is pending\n"); goto cleanup; } if(BACKEND->encdata_offset) { *err = CURLE_RECV_ERROR; infof(data, "schannel: can't renogotiate, " "encrypted data available\n"); goto cleanup; } /* begin renegotiation */ infof(data, "schannel: renegotiating SSL/TLS connection\n"); connssl->state = ssl_connection_negotiating; connssl->connecting_state = ssl_connect_2_writing; *err = schannel_connect_common(data, conn, sockindex, FALSE, &done); if(*err) { infof(data, "schannel: renegotiation failed\n"); goto cleanup; } /* now retry receiving data */ sspi_status = SEC_E_OK; infof(data, "schannel: SSL/TLS connection renegotiated\n"); continue; } /* check if the server closed the connection */ else if(sspi_status == SEC_I_CONTEXT_EXPIRED) { /* In Windows 2000 SEC_I_CONTEXT_EXPIRED (close_notify) is not returned so we have to work around that in cleanup. */ BACKEND->recv_sspi_close_notify = true; if(!BACKEND->recv_connection_closed) { BACKEND->recv_connection_closed = true; infof(data, "schannel: server closed the connection\n"); } goto cleanup; } } else if(sspi_status == SEC_E_INCOMPLETE_MESSAGE) { BACKEND->encdata_is_incomplete = true; if(!*err) *err = CURLE_AGAIN; infof(data, "schannel: failed to decrypt data, need more data\n"); goto cleanup; } else { #ifndef CURL_DISABLE_VERBOSE_STRINGS char buffer[STRERROR_LEN]; #endif *err = CURLE_RECV_ERROR; infof(data, "schannel: failed to read data from server: %s\n", Curl_sspi_strerror(sspi_status, buffer, sizeof(buffer))); goto cleanup; } } DEBUGF(infof(data, "schannel: encrypted data buffer: offset %zu length %zu\n", BACKEND->encdata_offset, BACKEND->encdata_length)); DEBUGF(infof(data, "schannel: decrypted data buffer: offset %zu length %zu\n", BACKEND->decdata_offset, BACKEND->decdata_length)); cleanup: /* Warning- there is no guarantee the encdata state is valid at this point */ DEBUGF(infof(data, "schannel: schannel_recv cleanup\n")); /* Error if the connection has closed without a close_notify. The behavior here is a matter of debate. We don't want to be vulnerable to a truncation attack however there's some browser precedent for ignoring the close_notify for compatibility reasons. Additionally, Windows 2000 (v5.0) is a special case since it seems it doesn't return close_notify. In that case if the connection was closed we assume it was graceful (close_notify) since there doesn't seem to be a way to tell. */ if(len && !BACKEND->decdata_offset && BACKEND->recv_connection_closed && !BACKEND->recv_sspi_close_notify) { bool isWin2k = curlx_verify_windows_version(5, 0, PLATFORM_WINNT, VERSION_EQUAL); if(isWin2k && sspi_status == SEC_E_OK) BACKEND->recv_sspi_close_notify = true; else { *err = CURLE_RECV_ERROR; infof(data, "schannel: server closed abruptly (missing close_notify)\n"); } } /* Any error other than CURLE_AGAIN is an unrecoverable error. */ if(*err && *err != CURLE_AGAIN) BACKEND->recv_unrecoverable_err = *err; size = len < BACKEND->decdata_offset ? len : BACKEND->decdata_offset; if(size) { memcpy(buf, BACKEND->decdata_buffer, size); memmove(BACKEND->decdata_buffer, BACKEND->decdata_buffer + size, BACKEND->decdata_offset - size); BACKEND->decdata_offset -= size; DEBUGF(infof(data, "schannel: decrypted data returned %zu\n", size)); DEBUGF(infof(data, "schannel: decrypted data buffer: offset %zu length %zu\n", BACKEND->decdata_offset, BACKEND->decdata_length)); *err = CURLE_OK; return (ssize_t)size; } if(!*err && !BACKEND->recv_connection_closed) *err = CURLE_AGAIN; /* It's debatable what to return when !len. We could return whatever error we got from decryption but instead we override here so the return is consistent. */ if(!len) *err = CURLE_OK; return *err ? -1 : 0; }
0
449,468
HttpHeader::getByNameListMember(const char *name, const char *member, const char separator) const { String header; const char *pos = NULL; const char *item; int ilen; int mlen = strlen(member); assert(name); header = getByName(name); String result; while (strListGetItem(&header, separator, &item, &ilen, &pos)) { if (strncmp(item, member, mlen) == 0 && item[mlen] == '=') { result.append(item + mlen + 1, ilen - mlen - 1); break; } } return result; }
0
424,472
add_opt_anc_info(OptAncInfo* to, int anc) { if (is_left_anchor(anc)) to->left_anchor |= anc; else to->right_anchor |= anc; }
0
144,435
COMPS_HSList* comps_mrtree_keys(COMPS_MRTree * rt) { COMPS_HSList *tmplist, *tmp_subnodes, *ret; COMPS_HSListItem *it; struct Pair { COMPS_HSList * subnodes; char * key; char added; } *pair, *parent_pair; pair = malloc(sizeof(struct Pair)); pair->subnodes = rt->subnodes; pair->key = NULL; pair->added = 0; tmplist = comps_hslist_create(); comps_hslist_init(tmplist, NULL, NULL, &free); ret = comps_hslist_create(); comps_hslist_init(ret, NULL, NULL, &free); comps_hslist_append(tmplist, pair, 0); while (tmplist->first != NULL) { it = tmplist->first; comps_hslist_remove(tmplist, tmplist->first); tmp_subnodes = ((struct Pair*)it->data)->subnodes; parent_pair = (struct Pair*) it->data; free(it); for (it = tmp_subnodes->first; it != NULL; it=it->next) { pair = malloc(sizeof(struct Pair)); pair->subnodes = ((COMPS_MRTreeData*)it->data)->subnodes; pair->added = 0; if (parent_pair->key != NULL) { pair->key = malloc(sizeof(char) * (strlen(((COMPS_MRTreeData*)it->data)->key) + strlen(parent_pair->key) + 1)); memcpy(pair->key, parent_pair->key, sizeof(char) * strlen(parent_pair->key)); memcpy(pair->key+strlen(parent_pair->key), ((COMPS_MRTreeData*)it->data)->key, sizeof(char)*(strlen(((COMPS_MRTreeData*)it->data)->key)+1)); } else { pair->key = malloc(sizeof(char)* (strlen(((COMPS_MRTreeData*)it->data)->key) + 1)); memcpy(pair->key, ((COMPS_MRTreeData*)it->data)->key, sizeof(char)*(strlen(((COMPS_MRTreeData*)it->data)->key)+1)); } /* current node has data */ if (((COMPS_MRTreeData*)it->data)->data->first != NULL) { //printf("data not null for |%s|\n", pair->key); comps_hslist_append(ret, pair->key, 0); pair->added = 1; if (((COMPS_MRTreeData*)it->data)->subnodes->first != NULL) { // printf("subnodes found\b"); comps_hslist_append(tmplist, pair, 0); } else { free(pair); } /* current node hasn't data */ } else { if (((COMPS_MRTreeData*)it->data)->subnodes->first) { comps_hslist_append(tmplist, pair, 0); } else { free(pair->key); free(pair); } } } if (parent_pair->added == 0) free(parent_pair->key); free(parent_pair); } comps_hslist_destroy(&tmplist); return ret; }
0
340,773
static int mov_write_packet(AVFormatContext *s, AVPacket *pkt) { MOVContext *mov = s->priv_data; ByteIOContext *pb = s->pb; MOVTrack *trk = &mov->tracks[pkt->stream_index]; AVCodecContext *enc = trk->enc; unsigned int samplesInChunk = 0; int size= pkt->size; if (url_is_streamed(s->pb)) return 0; /* Can't handle that */ if (!size) return 0; /* Discard 0 sized packets */ if (enc->codec_id == CODEC_ID_AMR_NB) { /* We must find out how many AMR blocks there are in one packet */ static uint16_t packed_size[16] = {13, 14, 16, 18, 20, 21, 27, 32, 6, 0, 0, 0, 0, 0, 0, 0}; int len = 0; while (len < size && samplesInChunk < 100) { len += packed_size[(pkt->data[len] >> 3) & 0x0F]; samplesInChunk++; } if(samplesInChunk > 1){ av_log(s, AV_LOG_ERROR, "fatal error, input is not a single packet, implement a AVParser for it\n"); return -1; } } else if (trk->sampleSize) samplesInChunk = size/trk->sampleSize; else samplesInChunk = 1; /* copy extradata if it exists */ if (trk->vosLen == 0 && enc->extradata_size > 0) { trk->vosLen = enc->extradata_size; trk->vosData = av_malloc(trk->vosLen); memcpy(trk->vosData, enc->extradata, trk->vosLen); } if (enc->codec_id == CODEC_ID_H264 && trk->vosLen > 0 && *(uint8_t *)trk->vosData != 1) { /* from x264 or from bytestream h264 */ /* nal reformating needed */ int ret = ff_avc_parse_nal_units(pkt->data, &pkt->data, &pkt->size); if (ret < 0) return ret; assert(pkt->size); size = pkt->size; } else if (enc->codec_id == CODEC_ID_DNXHD && !trk->vosLen) { /* copy frame header to create needed atoms */ if (size < 640) return -1; trk->vosLen = 640; trk->vosData = av_malloc(trk->vosLen); memcpy(trk->vosData, pkt->data, 640); } if (!(trk->entry % MOV_INDEX_CLUSTER_SIZE)) { trk->cluster = av_realloc(trk->cluster, (trk->entry + MOV_INDEX_CLUSTER_SIZE) * sizeof(*trk->cluster)); if (!trk->cluster) return -1; } trk->cluster[trk->entry].pos = url_ftell(pb); trk->cluster[trk->entry].samplesInChunk = samplesInChunk; trk->cluster[trk->entry].size = size; trk->cluster[trk->entry].entries = samplesInChunk; trk->cluster[trk->entry].dts = pkt->dts; trk->trackDuration = pkt->dts - trk->cluster[0].dts + pkt->duration; if(enc->codec_type == CODEC_TYPE_VIDEO) { if (pkt->dts != pkt->pts) trk->hasBframes = 1; trk->cluster[trk->entry].cts = pkt->pts - pkt->dts; trk->cluster[trk->entry].key_frame = !!(pkt->flags & PKT_FLAG_KEY); if(trk->cluster[trk->entry].key_frame) trk->hasKeyframes++; } trk->entry++; trk->sampleCount += samplesInChunk; mov->mdat_size += size; put_buffer(pb, pkt->data, size); put_flush_packet(pb); return 0; }
0
461,369
static void send_packet_to_client(GDHCPServer *dhcp_server, struct dhcp_packet *dhcp_pkt) { const uint8_t *chaddr; uint32_t ciaddr; if ((dhcp_pkt->flags & htons(BROADCAST_FLAG)) || dhcp_pkt->ciaddr == 0) { debug(dhcp_server, "Broadcasting packet to client"); ciaddr = INADDR_BROADCAST; chaddr = MAC_BCAST_ADDR; } else { debug(dhcp_server, "Unicasting packet to client ciaddr"); ciaddr = dhcp_pkt->ciaddr; chaddr = dhcp_pkt->chaddr; } dhcp_send_raw_packet(dhcp_pkt, dhcp_server->server_nip, SERVER_PORT, ciaddr, CLIENT_PORT, chaddr, dhcp_server->ifindex, false); }
0
350,386
serialNumberAndIssuerSerialCheck( struct berval *in, struct berval *sn, struct berval *is, struct berval *i_sn, /* contain serial of baseCertificateID */ void *ctx ) { /* Parse GSER format */ enum { HAVE_NONE = 0x0, HAVE_SN = 0x1, HAVE_ISSUER = 0x2, HAVE_ALL = ( HAVE_SN | HAVE_ISSUER ) } have = HAVE_NONE, have2 = HAVE_NONE; int numdquotes = 0; struct berval x = *in; struct berval ni; if ( in->bv_len < 3 ) return LDAP_INVALID_SYNTAX; /* no old format */ if ( in->bv_val[0] != '{' && in->bv_val[in->bv_len-1] != '}' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len -= 2; do { /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } /* should be at issuer or serialNumber NamedValue */ if ( strncasecmp( x.bv_val, "issuer", STRLENOF("issuer") ) == 0 ) { if ( have & HAVE_ISSUER ) { return LDAP_INVALID_SYNTAX; } /* parse IssuerSerial */ x.bv_val += STRLENOF("issuer"); x.bv_len -= STRLENOF("issuer"); if ( x.bv_val[0] != ' ' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( x.bv_val[0] != '{' /*}*/ ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( strncasecmp( x.bv_val, "baseCertificateID ", STRLENOF("baseCertificateID ") ) != 0 ) { return LDAP_INVALID_SYNTAX; } x.bv_val += STRLENOF("baseCertificateID "); x.bv_len -= STRLENOF("baseCertificateID "); /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( x.bv_val[0] != '{' /*}*/ ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; do { /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } /* parse issuer of baseCertificateID */ if ( strncasecmp( x.bv_val, "issuer ", STRLENOF("issuer ") ) == 0 ) { if ( have2 & HAVE_ISSUER ) { return LDAP_INVALID_SYNTAX; } x.bv_val += STRLENOF("issuer "); x.bv_len -= STRLENOF("issuer "); /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( x.bv_val[0] != '{' /*}*/ ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( strncasecmp( x.bv_val, "directoryName:rdnSequence:", STRLENOF("directoryName:rdnSequence:") ) != 0 ) { return LDAP_INVALID_SYNTAX; } x.bv_val += STRLENOF("directoryName:rdnSequence:"); x.bv_len -= STRLENOF("directoryName:rdnSequence:"); if ( x.bv_val[0] != '"' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; is->bv_val = x.bv_val; is->bv_len = 0; for ( ; is->bv_len < x.bv_len; ) { if ( is->bv_val[is->bv_len] != '"' ) { is->bv_len++; continue; } if ( is->bv_val[is->bv_len + 1] == '"' ) { /* double dquote */ numdquotes++; is->bv_len += 2; continue; } break; } x.bv_val += is->bv_len + 1; x.bv_len -= is->bv_len + 1; /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( x.bv_val[0] != /*{*/ '}' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; have2 |= HAVE_ISSUER; } else if ( strncasecmp( x.bv_val, "serial ", STRLENOF("serial ") ) == 0 ) { if ( have2 & HAVE_SN ) { return LDAP_INVALID_SYNTAX; } x.bv_val += STRLENOF("serial "); x.bv_len -= STRLENOF("serial "); /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len--) { /* empty */; } if ( checkNum( &x, i_sn ) ) { return LDAP_INVALID_SYNTAX; } x.bv_val += i_sn->bv_len; x.bv_len -= i_sn->bv_len; have2 |= HAVE_SN; } else { return LDAP_INVALID_SYNTAX; } /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( have2 == HAVE_ALL ) { break; } if ( x.bv_val[0] != ',' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; } while ( 1 ); if ( x.bv_val[0] != /*{*/ '}' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( x.bv_val[0] != /*{*/ '}' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; have |= HAVE_ISSUER; } else if ( strncasecmp( x.bv_val, "serialNumber", STRLENOF("serialNumber") ) == 0 ) { if ( have & HAVE_SN ) { return LDAP_INVALID_SYNTAX; } /* parse serialNumber */ x.bv_val += STRLENOF("serialNumber"); x.bv_len -= STRLENOF("serialNumber"); if ( x.bv_val[0] != ' ' ) return LDAP_INVALID_SYNTAX; x.bv_val++; x.bv_len--; /* eat leading spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( checkNum( &x, sn ) ) { return LDAP_INVALID_SYNTAX; } x.bv_val += sn->bv_len; x.bv_len -= sn->bv_len; have |= HAVE_SN; } else { return LDAP_INVALID_SYNTAX; } /* eat spaces */ for ( ; (x.bv_val[0] == ' ') && x.bv_len; x.bv_val++, x.bv_len-- ) { /* empty */; } if ( have == HAVE_ALL ) { break; } if ( x.bv_val[0] != ',' ) { return LDAP_INVALID_SYNTAX; } x.bv_val++ ; x.bv_len--; } while ( 1 ); /* should have no characters left... */ if( x.bv_len ) return LDAP_INVALID_SYNTAX; if ( numdquotes == 0 ) { ber_dupbv_x( &ni, is, ctx ); } else { ber_len_t src, dst; ni.bv_len = is->bv_len - numdquotes; ni.bv_val = ber_memalloc_x( ni.bv_len + 1, ctx ); for ( src = 0, dst = 0; src < is->bv_len; src++, dst++ ) { if ( is->bv_val[src] == '"' ) { src++; } ni.bv_val[dst] = is->bv_val[src]; } ni.bv_val[dst] = '\0'; } *is = ni; /* need to handle double dquotes here */ return 0; }
1
392,150
int check_password_policy(String *password) { plugin_ref plugin; String empty_string; if (!password) password= &empty_string; plugin= my_plugin_lock_by_name(0, &validate_password_plugin_name, MYSQL_VALIDATE_PASSWORD_PLUGIN); if (plugin) { st_mysql_validate_password *password_validate= (st_mysql_validate_password *) plugin_decl(plugin)->info; if (!password_validate->validate_password(password)) { my_error(ER_NOT_VALID_PASSWORD, MYF(0)); plugin_unlock(0, plugin); return (1); } plugin_unlock(0, plugin); } return (0); }
0
12,514
void WebSocketExperimentRunner::DoLoop() { if (next_state_ == STATE_NONE) { if (task_.get()) { AddRef(); // Release in OnTaskCompleted. task_->Cancel(); } return; } State state = next_state_; task_state_ = STATE_NONE; next_state_ = STATE_NONE; switch (state) { case STATE_IDLE: task_.reset(); next_state_ = STATE_RUN_WS; ChromeThread::PostDelayedTask( ChromeThread::IO, FROM_HERE, NewRunnableMethod(this, &WebSocketExperimentRunner::DoLoop), config_.next_delay_ms); break; case STATE_RUN_WS: case STATE_RUN_WSS: case STATE_RUN_WS_NODEFAULT_PORT: case STATE_RUN_WS_DRAFT75: case STATE_RUN_WSS_DRAFT75: case STATE_RUN_WS_NODEFAULT_PORT_DRAFT75: task_.reset(new WebSocketExperimentTask( config_.ws_config[state - STATE_RUN_WS], &task_callback_)); task_state_ = state; if (static_cast<State>(state + 1) == NUM_STATES) next_state_ = STATE_IDLE; else next_state_ = static_cast<State>(state + 1); break; default: NOTREACHED(); break; } if (task_.get()) task_->Run(); }
1
406,264
ModuleExport void UnregisterCAPTIONImage(void) { (void) UnregisterMagickInfo("CAPTION"); }
0
330,967
VirtIOSCSIReq *virtio_scsi_pop_req_vring(VirtIOSCSI *s, VirtIOSCSIVring *vring) { VirtIOSCSIReq *req = virtio_scsi_init_req(s, NULL); int r; req->vring = vring; r = vring_pop((VirtIODevice *)s, &vring->vring, &req->elem); if (r < 0) { virtio_scsi_free_req(req); req = NULL; } return req; }
0
184,973
void tracing_reset_online_cpus(struct trace_buffer *buf) { struct ring_buffer *buffer = buf->buffer; int cpu; if (!buffer) return; ring_buffer_record_disable(buffer); /* Make sure all commits have finished */ synchronize_sched(); buf->time_start = buffer_ftrace_now(buf, buf->cpu); for_each_online_cpu(cpu) ring_buffer_reset_cpu(buffer, cpu); ring_buffer_record_enable(buffer); }
0
471,441
void addReplyArrayLen(client *c, long length) { addReplyAggregateLen(c,length,'*'); }
0
202,360
void FrameBuffer::Destroy() { if (id_ != 0) { ScopedGLErrorSuppressor suppressor(decoder_); glDeleteFramebuffersEXT(1, &id_); id_ = 0; } }
0
313,375
void GLES2DecoderImpl::ProcessFinishedAsyncTransfers() { ProcessPendingReadPixels(false); }
0
444,741
TEST_F(Http1ServerConnectionImplTest, UnsupportedEncoding) { initialize(); InSequence sequence; MockRequestDecoder decoder; EXPECT_CALL(callbacks_, newStream(_, _)).WillOnce(ReturnRef(decoder)); Buffer::OwnedImpl buffer("GET / HTTP/1.1\r\ntransfer-encoding: gzip\r\n\r\n"); EXPECT_CALL(decoder, sendLocalReply(_, _, _, _, _, _, _)); auto status = codec_->dispatch(buffer); EXPECT_TRUE(isCodecProtocolError(status)); EXPECT_EQ(status.message(), "http/1.1 protocol error: unsupported transfer encoding"); }
0
37,299
MagickExport MagickBooleanType XPreferencesWidget(Display *display, XResourceInfo *resource_info,XWindows *windows) { #define ApplyButtonText "Apply" #define CacheButtonText "%lu mega-bytes of memory in the undo edit cache " #define CancelButtonText "Cancel" #define NumberPreferences 8 static const char *Preferences[] = { "display image centered on a backdrop", "confirm on program exit", "confirm on image edits", "correct image for display gamma", "display warning messages", "apply Floyd/Steinberg error diffusion to image", "use a shared colormap for colormapped X visuals", "display images as an X server pixmap" }; char cache[MaxTextExtent]; int x, y; int i; Status status; unsigned int height, text_width, width; size_t state; XEvent event; XFontStruct *font_info; XTextProperty window_name; XWidgetInfo apply_info, cache_info, cancel_info, preferences_info[NumberPreferences]; XWindowChanges window_changes; /* Determine Preferences widget attributes. */ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"..."); assert(display != (Display *) NULL); assert(resource_info != (XResourceInfo *) NULL); assert(windows != (XWindows *) NULL); XCheckRefreshWindows(display,windows); font_info=windows->widget.font_info; text_width=WidgetTextWidth(font_info,CacheButtonText); for (i=0; i < NumberPreferences; i++) if (WidgetTextWidth(font_info,(char *) Preferences[i]) > text_width) text_width=WidgetTextWidth(font_info,(char *) Preferences[i]); width=WidgetTextWidth(font_info,ApplyButtonText); if (WidgetTextWidth(font_info,CancelButtonText) > width) width=WidgetTextWidth(font_info,CancelButtonText); width+=(unsigned int) QuantumMargin; height=(unsigned int) (font_info->ascent+font_info->descent); /* Position Preferences widget. */ windows->widget.width=(unsigned int) (MagickMax((int) (width << 1), (int) text_width)+6*QuantumMargin); windows->widget.min_width=(width << 1)+QuantumMargin; if (windows->widget.width < windows->widget.min_width) windows->widget.width=windows->widget.min_width; windows->widget.height=(unsigned int) (7*height+NumberPreferences*(height+(QuantumMargin >> 1))); windows->widget.min_height=(unsigned int) (7*height+NumberPreferences*(height+(QuantumMargin >> 1))); if (windows->widget.height < windows->widget.min_height) windows->widget.height=windows->widget.min_height; XConstrainWindowPosition(display,&windows->widget); /* Map Preferences widget. */ (void) CopyMagickString(windows->widget.name,"Preferences",MaxTextExtent); status=XStringListToTextProperty(&windows->widget.name,1,&window_name); if (status != False) { XSetWMName(display,windows->widget.id,&window_name); XSetWMIconName(display,windows->widget.id,&window_name); (void) XFree((void *) window_name.value); } window_changes.width=(int) windows->widget.width; window_changes.height=(int) windows->widget.height; window_changes.x=windows->widget.x; window_changes.y=windows->widget.y; (void) XReconfigureWMWindow(display,windows->widget.id,windows->widget.screen, (unsigned int) (CWWidth | CWHeight | CWX | CWY),&window_changes); (void) XMapRaised(display,windows->widget.id); windows->widget.mapped=MagickFalse; /* Respond to X events. */ state=UpdateConfigurationState; XSetCursorState(display,windows,MagickTrue); do { if (state & UpdateConfigurationState) { /* Initialize button information. */ XGetWidgetInfo(CancelButtonText,&cancel_info); cancel_info.width=width; cancel_info.height=(unsigned int) (3*height) >> 1; cancel_info.x=(int) windows->widget.width-cancel_info.width- (QuantumMargin << 1); cancel_info.y=(int) windows->widget.height- cancel_info.height-QuantumMargin; XGetWidgetInfo(ApplyButtonText,&apply_info); apply_info.width=width; apply_info.height=(unsigned int) (3*height) >> 1; apply_info.x=QuantumMargin << 1; apply_info.y=cancel_info.y; y=(int) (height << 1); for (i=0; i < NumberPreferences; i++) { XGetWidgetInfo(Preferences[i],&preferences_info[i]); preferences_info[i].bevel_width--; preferences_info[i].width=(unsigned int) QuantumMargin >> 1; preferences_info[i].height=(unsigned int) QuantumMargin >> 1; preferences_info[i].x=QuantumMargin << 1; preferences_info[i].y=y; y+=height+(QuantumMargin >> 1); } preferences_info[0].raised=resource_info->backdrop == MagickFalse ? MagickTrue : MagickFalse; preferences_info[1].raised=resource_info->confirm_exit == MagickFalse ? MagickTrue : MagickFalse; preferences_info[2].raised=resource_info->confirm_edit == MagickFalse ? MagickTrue : MagickFalse; preferences_info[3].raised=resource_info->gamma_correct == MagickFalse ? MagickTrue : MagickFalse; preferences_info[4].raised=resource_info->display_warnings == MagickFalse ? MagickTrue : MagickFalse; preferences_info[5].raised=resource_info->quantize_info->dither == MagickFalse ? MagickTrue : MagickFalse; preferences_info[6].raised=resource_info->colormap != SharedColormap ? MagickTrue : MagickFalse; preferences_info[7].raised=resource_info->use_pixmap == MagickFalse ? MagickTrue : MagickFalse; (void) FormatLocaleString(cache,MaxTextExtent,CacheButtonText, (unsigned long) resource_info->undo_cache); XGetWidgetInfo(cache,&cache_info); cache_info.bevel_width--; cache_info.width=(unsigned int) QuantumMargin >> 1; cache_info.height=(unsigned int) QuantumMargin >> 1; cache_info.x=QuantumMargin << 1; cache_info.y=y; state&=(~UpdateConfigurationState); } if (state & RedrawWidgetState) { /* Redraw Preferences widget. */ XDrawBeveledButton(display,&windows->widget,&apply_info); XDrawBeveledButton(display,&windows->widget,&cancel_info); for (i=0; i < NumberPreferences; i++) XDrawBeveledButton(display,&windows->widget,&preferences_info[i]); XDrawTriangleEast(display,&windows->widget,&cache_info); XHighlightWidget(display,&windows->widget,BorderOffset,BorderOffset); state&=(~RedrawWidgetState); } /* Wait for next event. */ (void) XIfEvent(display,&event,XScreenEvent,(char *) windows); switch (event.type) { case ButtonPress: { if (MatteIsActive(apply_info,event.xbutton)) { /* User pressed Apply button. */ apply_info.raised=MagickFalse; XDrawBeveledButton(display,&windows->widget,&apply_info); break; } if (MatteIsActive(cancel_info,event.xbutton)) { /* User pressed Cancel button. */ cancel_info.raised=MagickFalse; XDrawBeveledButton(display,&windows->widget,&cancel_info); break; } for (i=0; i < NumberPreferences; i++) if (MatteIsActive(preferences_info[i],event.xbutton)) { /* User pressed a Preferences button. */ preferences_info[i].raised=preferences_info[i].raised == MagickFalse ? MagickTrue : MagickFalse; XDrawBeveledButton(display,&windows->widget,&preferences_info[i]); break; } if (MatteIsActive(cache_info,event.xbutton)) { /* User pressed Cache button. */ x=cache_info.x+cache_info.width+cache_info.bevel_width+ (QuantumMargin >> 1); y=cache_info.y+((cache_info.height-height) >> 1); width=WidgetTextWidth(font_info,cache); (void) XClearArea(display,windows->widget.id,x,y,width,height, False); resource_info->undo_cache<<=1; if (resource_info->undo_cache > 256) resource_info->undo_cache=1; (void) FormatLocaleString(cache,MaxTextExtent,CacheButtonText, (unsigned long) resource_info->undo_cache); cache_info.raised=MagickFalse; XDrawTriangleEast(display,&windows->widget,&cache_info); break; } break; } case ButtonRelease: { if (windows->widget.mapped == MagickFalse) break; if (apply_info.raised == MagickFalse) { if (event.xbutton.window == windows->widget.id) if (MatteIsActive(apply_info,event.xbutton)) state|=ExitState; apply_info.raised=MagickTrue; XDrawBeveledButton(display,&windows->widget,&apply_info); apply_info.raised=MagickFalse; } if (cancel_info.raised == MagickFalse) { if (event.xbutton.window == windows->widget.id) if (MatteIsActive(cancel_info,event.xbutton)) state|=ExitState; cancel_info.raised=MagickTrue; XDrawBeveledButton(display,&windows->widget,&cancel_info); } if (cache_info.raised == MagickFalse) { cache_info.raised=MagickTrue; XDrawTriangleEast(display,&windows->widget,&cache_info); } break; } case ClientMessage: { /* If client window delete message, exit. */ if (event.xclient.message_type != windows->wm_protocols) break; if (*event.xclient.data.l == (int) windows->wm_take_focus) { (void) XSetInputFocus(display,event.xclient.window,RevertToParent, (Time) event.xclient.data.l[1]); break; } if (*event.xclient.data.l != (int) windows->wm_delete_window) break; if (event.xclient.window == windows->widget.id) { state|=ExitState; break; } break; } case ConfigureNotify: { /* Update widget configuration. */ if (event.xconfigure.window != windows->widget.id) break; if ((event.xconfigure.width == (int) windows->widget.width) && (event.xconfigure.height == (int) windows->widget.height)) break; windows->widget.width=(unsigned int) MagickMax(event.xconfigure.width,(int) windows->widget.min_width); windows->widget.height=(unsigned int) MagickMax(event.xconfigure.height,(int) windows->widget.min_height); state|=UpdateConfigurationState; break; } case EnterNotify: { if (event.xcrossing.window != windows->widget.id) break; state&=(~InactiveWidgetState); break; } case Expose: { if (event.xexpose.window != windows->widget.id) break; if (event.xexpose.count != 0) break; state|=RedrawWidgetState; break; } case KeyPress: { static char command[MaxTextExtent]; static KeySym key_symbol; /* Respond to a user key press. */ if (event.xkey.window != windows->widget.id) break; (void) XLookupString((XKeyEvent *) &event.xkey,command, (int) sizeof(command),&key_symbol,(XComposeStatus *) NULL); if ((key_symbol == XK_Return) || (key_symbol == XK_KP_Enter)) { apply_info.raised=MagickFalse; XDrawBeveledButton(display,&windows->widget,&apply_info); state|=ExitState; break; } break; } case LeaveNotify: { if (event.xcrossing.window != windows->widget.id) break; state|=InactiveWidgetState; break; } case MotionNotify: { /* Discard pending button motion events. */ while (XCheckMaskEvent(display,ButtonMotionMask,&event)) ; if (state & InactiveWidgetState) break; if (apply_info.raised == MatteIsActive(apply_info,event.xmotion)) { /* Apply button status changed. */ apply_info.raised= apply_info.raised == MagickFalse ? MagickTrue : MagickFalse; XDrawBeveledButton(display,&windows->widget,&apply_info); break; } if (cancel_info.raised == MatteIsActive(cancel_info,event.xmotion)) { /* Cancel button status changed. */ cancel_info.raised= cancel_info.raised == MagickFalse ? MagickTrue : MagickFalse; XDrawBeveledButton(display,&windows->widget,&cancel_info); break; } break; } default: break; } } while ((state & ExitState) == 0); XSetCursorState(display,windows,MagickFalse); (void) XWithdrawWindow(display,windows->widget.id,windows->widget.screen); XCheckRefreshWindows(display,windows); if (apply_info.raised) return(MagickFalse); /* Save user preferences to the client configuration file. */ resource_info->backdrop= preferences_info[0].raised == MagickFalse ? MagickTrue : MagickFalse; resource_info->confirm_exit= preferences_info[1].raised == MagickFalse ? MagickTrue : MagickFalse; resource_info->confirm_edit= preferences_info[2].raised == MagickFalse ? MagickTrue : MagickFalse; resource_info->gamma_correct= preferences_info[3].raised == MagickFalse ? MagickTrue : MagickFalse; resource_info->display_warnings= preferences_info[4].raised == MagickFalse ? MagickTrue : MagickFalse; resource_info->quantize_info->dither= preferences_info[5].raised == MagickFalse ? MagickTrue : MagickFalse; resource_info->colormap=SharedColormap; if (preferences_info[6].raised) resource_info->colormap=PrivateColormap; resource_info->use_pixmap= preferences_info[7].raised == MagickFalse ? MagickTrue : MagickFalse; XUserPreferences(resource_info); return(MagickTrue); }
0
228,236
FolderHeaderView::FolderHeaderView(FolderHeaderViewDelegate* delegate) : folder_item_(NULL), back_button_(new views::ImageButton(this)), folder_name_view_(new FolderNameView), folder_name_placeholder_text_( ui::ResourceBundle::GetSharedInstance().GetLocalizedString( IDS_APP_LIST_FOLDER_NAME_PLACEHOLDER)), delegate_(delegate), folder_name_visible_(true) { ui::ResourceBundle& rb = ui::ResourceBundle::GetSharedInstance(); back_button_->SetImage(views::ImageButton::STATE_NORMAL, rb.GetImageSkiaNamed(IDR_APP_LIST_FOLDER_BACK_NORMAL)); back_button_->SetImageAlignment(views::ImageButton::ALIGN_CENTER, views::ImageButton::ALIGN_MIDDLE); AddChildView(back_button_); folder_name_view_->SetFontList( rb.GetFontList(ui::ResourceBundle::MediumFont)); folder_name_view_->set_placeholder_text_color(kHintTextColor); folder_name_view_->set_placeholder_text(folder_name_placeholder_text_); folder_name_view_->SetBorder(views::Border::NullBorder()); folder_name_view_->SetBackgroundColor(kContentsBackgroundColor); folder_name_view_->set_controller(this); AddChildView(folder_name_view_); }
0
288,646
int SRP_VBASE_init ( SRP_VBASE * vb , char * verifier_file ) { int error_code ; STACK_OF ( SRP_gN ) * SRP_gN_tab = sk_SRP_gN_new_null ( ) ; char * last_index = NULL ; int i ; char * * pp ; SRP_gN * gN = NULL ; SRP_user_pwd * user_pwd = NULL ; TXT_DB * tmpdb = NULL ; BIO * in = BIO_new ( BIO_s_file ( ) ) ; error_code = SRP_ERR_OPEN_FILE ; if ( in == NULL || BIO_read_filename ( in , verifier_file ) <= 0 ) goto err ; error_code = SRP_ERR_VBASE_INCOMPLETE_FILE ; if ( ( tmpdb = TXT_DB_read ( in , DB_NUMBER ) ) == NULL ) goto err ; error_code = SRP_ERR_MEMORY ; if ( vb -> seed_key ) { last_index = SRP_get_default_gN ( NULL ) -> id ; } for ( i = 0 ; i < sk_OPENSSL_PSTRING_num ( tmpdb -> data ) ; i ++ ) { pp = sk_OPENSSL_PSTRING_value ( tmpdb -> data , i ) ; if ( pp [ DB_srptype ] [ 0 ] == DB_SRP_INDEX ) { if ( ( gN = ( SRP_gN * ) OPENSSL_malloc ( sizeof ( SRP_gN ) ) ) == NULL ) goto err ; if ( ! ( gN -> id = BUF_strdup ( pp [ DB_srpid ] ) ) || ! ( gN -> N = SRP_gN_place_bn ( vb -> gN_cache , pp [ DB_srpverifier ] ) ) || ! ( gN -> g = SRP_gN_place_bn ( vb -> gN_cache , pp [ DB_srpsalt ] ) ) || sk_SRP_gN_insert ( SRP_gN_tab , gN , 0 ) == 0 ) goto err ; gN = NULL ; if ( vb -> seed_key != NULL ) { last_index = pp [ DB_srpid ] ; } } else if ( pp [ DB_srptype ] [ 0 ] == DB_SRP_VALID ) { SRP_gN * lgN ; if ( ( lgN = SRP_get_gN_by_id ( pp [ DB_srpgN ] , SRP_gN_tab ) ) != NULL ) { error_code = SRP_ERR_MEMORY ; if ( ( user_pwd = SRP_user_pwd_new ( ) ) == NULL ) goto err ; SRP_user_pwd_set_gN ( user_pwd , lgN -> g , lgN -> N ) ; if ( ! SRP_user_pwd_set_ids ( user_pwd , pp [ DB_srpid ] , pp [ DB_srpinfo ] ) ) goto err ; error_code = SRP_ERR_VBASE_BN_LIB ; if ( ! SRP_user_pwd_set_sv ( user_pwd , pp [ DB_srpsalt ] , pp [ DB_srpverifier ] ) ) goto err ; if ( sk_SRP_user_pwd_insert ( vb -> users_pwd , user_pwd , 0 ) == 0 ) goto err ; user_pwd = NULL ; } } } if ( last_index != NULL ) { if ( ( ( gN = SRP_get_gN_by_id ( last_index , SRP_gN_tab ) ) == NULL ) ) { error_code = SRP_ERR_VBASE_BN_LIB ; goto err ; } vb -> default_g = gN -> g ; vb -> default_N = gN -> N ; gN = NULL ; } error_code = SRP_NO_ERROR ; err : if ( gN != NULL ) { OPENSSL_free ( gN -> id ) ; OPENSSL_free ( gN ) ; } SRP_user_pwd_free ( user_pwd ) ; if ( tmpdb ) TXT_DB_free ( tmpdb ) ; if ( in ) BIO_free_all ( in ) ; sk_SRP_gN_free ( SRP_gN_tab ) ; return error_code ; }
0
288,025
void FileManagerBrowserTestBase::SetUpCommandLine( base::CommandLine* command_line) { command_line->AppendSwitch(switches::kDisableAudioOutput); if (!GetRequiresStartupBrowser()) { command_line->AppendSwitch(switches::kNoStartupWindow); set_exit_when_last_browser_closes(false); } if (IsGuestModeTest()) { command_line->AppendSwitch(chromeos::switches::kGuestSession); command_line->AppendSwitchNative(chromeos::switches::kLoginUser, "$guest"); command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); command_line->AppendSwitch(switches::kIncognito); set_chromeos_user_ = false; } if (IsIncognitoModeTest()) { command_line->AppendSwitch(switches::kIncognito); } std::vector<base::Feature> enabled_features; std::vector<base::Feature> disabled_features; if (!IsGuestModeTest()) { enabled_features.emplace_back(features::kCrostini); } if (!IsNativeSmbTest()) { disabled_features.emplace_back(features::kNativeSmb); } if (IsDriveFsTest()) { enabled_features.emplace_back(chromeos::features::kDriveFs); } else { disabled_features.emplace_back(chromeos::features::kDriveFs); } if (IsMyFilesVolume()) { enabled_features.emplace_back(chromeos::features::kMyFilesVolume); } else { disabled_features.emplace_back(chromeos::features::kMyFilesVolume); } if (IsArcTest()) { arc::SetArcAvailableCommandLineForTesting(command_line); } if (IsDocumentsProviderTest()) { enabled_features.emplace_back( arc::kEnableDocumentsProviderInFilesAppFeature); } else { disabled_features.emplace_back( arc::kEnableDocumentsProviderInFilesAppFeature); } feature_list_.InitWithFeatures(enabled_features, disabled_features); extensions::ExtensionApiTest::SetUpCommandLine(command_line); }
1
135,608
static int mov_write_vmhd_tag(AVIOContext *pb) { avio_wb32(pb, 0x14); /* size (always 0x14) */ ffio_wfourcc(pb, "vmhd"); avio_wb32(pb, 0x01); /* version & flags */ avio_wb64(pb, 0); /* reserved (graphics mode = copy) */ return 0x14; }
0
231,345
void ServiceWorkerContextCore::UnprotectVersion(int64_t version_id) { DCHECK(protected_versions_.find(version_id) != protected_versions_.end()); protected_versions_.erase(version_id); }
0
5,211
TEE_Result syscall_authenc_init(unsigned long state, const void *nonce, size_t nonce_len, size_t tag_len, size_t aad_len, size_t payload_len) { TEE_Result res; struct tee_cryp_state *cs; struct tee_ta_session *sess; struct tee_obj *o; struct tee_cryp_obj_secret *key; res = tee_ta_get_current_session(&sess); if (res != TEE_SUCCESS) return res; res = tee_mmu_check_access_rights(to_user_ta_ctx(sess->ctx), TEE_MEMORY_ACCESS_READ | TEE_MEMORY_ACCESS_ANY_OWNER, (uaddr_t)nonce, nonce_len); if (res != TEE_SUCCESS) return res; res = tee_svc_cryp_get_state(sess, tee_svc_uref_to_vaddr(state), &cs); if (res != TEE_SUCCESS) return res; res = tee_obj_get(to_user_ta_ctx(sess->ctx), cs->key1, &o); if (res != TEE_SUCCESS) return res; if ((o->info.handleFlags & TEE_HANDLE_FLAG_INITIALIZED) == 0) return TEE_ERROR_BAD_PARAMETERS; key = o->attr; res = crypto_authenc_init(cs->ctx, cs->algo, cs->mode, (uint8_t *)(key + 1), key->key_size, nonce, nonce_len, tag_len, aad_len, payload_len); if (res != TEE_SUCCESS) return res; cs->ctx_finalize = (tee_cryp_ctx_finalize_func_t)crypto_authenc_final; return TEE_SUCCESS; }
1
425,082
static int init_lookup(void) { int v, s, h; /* These ones are constant */ lookup_colors[0] = CACA_BLACK; lookup_colors[1] = CACA_DARKGRAY; lookup_colors[2] = CACA_LIGHTGRAY; lookup_colors[3] = CACA_WHITE; /* These ones will be overwritten */ lookup_colors[4] = CACA_MAGENTA; lookup_colors[5] = CACA_LIGHTMAGENTA; lookup_colors[6] = CACA_RED; lookup_colors[7] = CACA_LIGHTRED; for(v = 0; v < LOOKUP_VAL; v++) for(s = 0; s < LOOKUP_SAT; s++) for(h = 0; h < LOOKUP_HUE; h++) { int i, distbg, distfg, dist; int val, sat, hue; uint8_t outbg, outfg; val = 0xfff * v / (LOOKUP_VAL - 1); sat = 0xfff * s / (LOOKUP_SAT - 1); hue = 0xfff * h / (LOOKUP_HUE - 1); /* Initialise distances to the distance between pure black HSV * coordinates and our white colour (3) */ outbg = outfg = 3; distbg = distfg = HSV_DISTANCE(0, 0, 0, 3); /* Calculate distances to eight major colour values and store the * two nearest points in our lookup table. */ for(i = 0; i < 8; i++) { dist = HSV_DISTANCE(hue, sat, val, i); if(dist <= distbg) { outfg = outbg; distfg = distbg; outbg = i; distbg = dist; } else if(dist <= distfg) { outfg = i; distfg = dist; } } hsv_distances[v][s][h] = (outfg << 4) | outbg; } return 0; }
0
398,248
js_Value *js_tovalue(js_State *J, int idx) { return stackidx(J, idx); }
0
96,955
static int semctl_nolock(struct ipc_namespace *ns, int semid, int cmd, int version, void __user *p) { int err; struct sem_array *sma; switch(cmd) { case IPC_INFO: case SEM_INFO: { struct seminfo seminfo; int max_id; err = security_sem_semctl(NULL, cmd); if (err) return err; memset(&seminfo,0,sizeof(seminfo)); seminfo.semmni = ns->sc_semmni; seminfo.semmns = ns->sc_semmns; seminfo.semmsl = ns->sc_semmsl; seminfo.semopm = ns->sc_semopm; seminfo.semvmx = SEMVMX; seminfo.semmnu = SEMMNU; seminfo.semmap = SEMMAP; seminfo.semume = SEMUME; down_read(&sem_ids(ns).rw_mutex); if (cmd == SEM_INFO) { seminfo.semusz = sem_ids(ns).in_use; seminfo.semaem = ns->used_sems; } else { seminfo.semusz = SEMUSZ; seminfo.semaem = SEMAEM; } max_id = ipc_get_maxid(&sem_ids(ns)); up_read(&sem_ids(ns).rw_mutex); if (copy_to_user(p, &seminfo, sizeof(struct seminfo))) return -EFAULT; return (max_id < 0) ? 0: max_id; } case IPC_STAT: case SEM_STAT: { struct semid64_ds tbuf; int id = 0; memset(&tbuf, 0, sizeof(tbuf)); if (cmd == SEM_STAT) { rcu_read_lock(); sma = sem_obtain_object(ns, semid); if (IS_ERR(sma)) { err = PTR_ERR(sma); goto out_unlock; } id = sma->sem_perm.id; } else { rcu_read_lock(); sma = sem_obtain_object_check(ns, semid); if (IS_ERR(sma)) { err = PTR_ERR(sma); goto out_unlock; } } err = -EACCES; if (ipcperms(ns, &sma->sem_perm, S_IRUGO)) goto out_unlock; err = security_sem_semctl(sma, cmd); if (err) goto out_unlock; kernel_to_ipc64_perm(&sma->sem_perm, &tbuf.sem_perm); tbuf.sem_otime = sma->sem_otime; tbuf.sem_ctime = sma->sem_ctime; tbuf.sem_nsems = sma->sem_nsems; rcu_read_unlock(); if (copy_semid_to_user(p, &tbuf, version)) return -EFAULT; return id; } default: return -EINVAL; } out_unlock: rcu_read_unlock(); return err; }
0
372,159
auth_shadow ( const char *login __attribute__((unused)), const char *passwd __attribute__((unused)), const char *service __attribute__((unused)), const char *realm __attribute__((unused)) ) { return NULL; }
0
439,616
decodeModifyOtherKeys(int c) { char_u *p = typebuf.tb_buf + typebuf.tb_off; int idx; int form = 0; int argidx = 0; int arg[2] = {0, 0}; // Recognize: // form 0: {lead}{key};{modifier}u // form 1: {lead}27;{modifier};{key}~ if ((c == CSI || (c == ESC && *p == '[')) && typebuf.tb_len >= 4) { idx = (*p == '['); if (p[idx] == '2' && p[idx + 1] == '7' && p[idx + 2] == ';') { form = 1; idx += 3; } while (idx < typebuf.tb_len && argidx < 2) { if (p[idx] == ';') ++argidx; else if (VIM_ISDIGIT(p[idx])) arg[argidx] = arg[argidx] * 10 + (p[idx] - '0'); else break; ++idx; } if (idx < typebuf.tb_len && p[idx] == (form == 1 ? '~' : 'u') && argidx == 1) { // Match, consume the code. typebuf.tb_off += idx + 1; typebuf.tb_len -= idx + 1; mod_mask = decode_modifiers(arg[!form]); c = merge_modifyOtherKeys(arg[form]); } } return c; }
0
66,940
GF_Err moof_box_size(GF_Box *s) { u32 pos=0; GF_MovieFragmentBox *ptr = (GF_MovieFragmentBox *) s; if (!s) return GF_BAD_PARAM; //Header First gf_isom_check_position(s, (GF_Box *)ptr->mfhd, &pos); //then PSSH gf_isom_check_position_list(s, ptr->PSSHs, &pos); //then the track list gf_isom_check_position_list(s, ptr->TrackList, &pos); return GF_OK; }
0
293,662
__read_extent_tree_block(const char *function, unsigned int line, struct inode *inode, ext4_fsblk_t pblk, int depth, int flags) { struct buffer_head *bh; int err; bh = sb_getblk(inode->i_sb, pblk); if (unlikely(!bh)) return ERR_PTR(-ENOMEM); if (!bh_uptodate_or_lock(bh)) { trace_ext4_ext_load_extent(inode, pblk, _RET_IP_); err = bh_submit_read(bh); if (err < 0) goto errout; } if (buffer_verified(bh) && !(flags & EXT4_EX_FORCE_CACHE)) return bh; err = __ext4_ext_check(function, line, inode, ext_block_hdr(bh), depth, pblk); if (err) goto errout; set_buffer_verified(bh); /* * If this is a leaf block, cache all of its entries */ if (!(flags & EXT4_EX_NOCACHE) && depth == 0) { struct ext4_extent_header *eh = ext_block_hdr(bh); struct ext4_extent *ex = EXT_FIRST_EXTENT(eh); ext4_lblk_t prev = 0; int i; for (i = le16_to_cpu(eh->eh_entries); i > 0; i--, ex++) { unsigned int status = EXTENT_STATUS_WRITTEN; ext4_lblk_t lblk = le32_to_cpu(ex->ee_block); int len = ext4_ext_get_actual_len(ex); if (prev && (prev != lblk)) ext4_es_cache_extent(inode, prev, lblk - prev, ~0, EXTENT_STATUS_HOLE); if (ext4_ext_is_unwritten(ex)) status = EXTENT_STATUS_UNWRITTEN; ext4_es_cache_extent(inode, lblk, len, ext4_ext_pblock(ex), status); prev = lblk + len; } } return bh; errout: put_bh(bh); return ERR_PTR(err); }
0
231,342
virtual status_t listModules(struct sound_trigger_module_descriptor *modules, uint32_t *numModules) { if (numModules == NULL || (*numModules != 0 && modules == NULL)) { return BAD_VALUE; } Parcel data, reply; data.writeInterfaceToken(ISoundTriggerHwService::getInterfaceDescriptor()); unsigned int numModulesReq = (modules == NULL) ? 0 : *numModules; data.writeInt32(numModulesReq); status_t status = remote()->transact(LIST_MODULES, data, &reply); if (status == NO_ERROR) { status = (status_t)reply.readInt32(); *numModules = (unsigned int)reply.readInt32(); } ALOGV("listModules() status %d got *numModules %d", status, *numModules); if (status == NO_ERROR) { if (numModulesReq > *numModules) { numModulesReq = *numModules; } if (numModulesReq > 0) { reply.read(modules, numModulesReq * sizeof(struct sound_trigger_module_descriptor)); } } return status; }
0
357,404
static struct inotify_watch *inode_find_handle(struct inode *inode, struct inotify_handle *ih) { struct inotify_watch *watch; list_for_each_entry(watch, &inode->inotify_watches, i_list) { if (watch->ih == ih) return watch; } return NULL; }
0
176,024
my_object_get_hash (MyObject *obj, GHashTable **ret, GError **error)
0
45,584
int bcf_add_id(const bcf_hdr_t *hdr, bcf1_t *line, const char *id) { if ( !id ) return 0; if ( !(line->unpacked & BCF_UN_STR) ) bcf_unpack(line, BCF_UN_STR); kstring_t tmp; tmp.l = 0; tmp.s = line->d.id; tmp.m = line->d.m_id; int len = strlen(id); char *dst = line->d.id; while ( *dst && (dst=strstr(dst,id)) ) { if ( dst[len]!=0 && dst[len]!=';' ) dst++; // a prefix, not a match else if ( dst==line->d.id || dst[-1]==';' ) return 0; // already present dst++; // a suffix, not a match } if ( line->d.id && (line->d.id[0]!='.' || line->d.id[1]) ) { tmp.l = strlen(line->d.id); kputc(';',&tmp); } kputs(id,&tmp); line->d.id = tmp.s; line->d.m_id = tmp.m; line->d.shared_dirty |= BCF1_DIRTY_ID; return 0; }
0
446,548
virDomainVcpuParse(virDomainDefPtr def, xmlXPathContextPtr ctxt, virDomainXMLOptionPtr xmlopt) { int n; xmlNodePtr vcpuNode; size_t i; unsigned int maxvcpus; unsigned int vcpus; g_autofree char *tmp = NULL; g_autofree xmlNodePtr *nodes = NULL; vcpus = maxvcpus = 1; if ((vcpuNode = virXPathNode("./vcpu[1]", ctxt))) { if ((tmp = virXMLNodeContentString(vcpuNode))) { if (virStrToLong_ui(tmp, NULL, 10, &maxvcpus) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("maximum vcpus count must be an integer")); return -1; } VIR_FREE(tmp); } if ((tmp = virXMLPropString(vcpuNode, "current"))) { if (virStrToLong_ui(tmp, NULL, 10, &vcpus) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("current vcpus count must be an integer")); return -1; } VIR_FREE(tmp); } else { vcpus = maxvcpus; } tmp = virXMLPropString(vcpuNode, "placement"); if (tmp) { if ((def->placement_mode = virDomainCpuPlacementModeTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Unsupported CPU placement mode '%s'"), tmp); return -1; } VIR_FREE(tmp); } else { def->placement_mode = VIR_DOMAIN_CPU_PLACEMENT_MODE_STATIC; } if (def->placement_mode != VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO) { tmp = virXMLPropString(vcpuNode, "cpuset"); if (tmp) { if (virBitmapParse(tmp, &def->cpumask, VIR_DOMAIN_CPUMASK_LEN) < 0) return -1; if (virBitmapIsAllClear(def->cpumask)) { virReportError(VIR_ERR_CONFIG_UNSUPPORTED, _("Invalid value of 'cpuset': %s"), tmp); return -1; } VIR_FREE(tmp); } } } if (virDomainDefSetVcpusMax(def, maxvcpus, xmlopt) < 0) return -1; if ((n = virXPathNodeSet("./vcpus/vcpu", ctxt, &nodes)) < 0) return -1; if (n) { /* if individual vcpu states are provided take them as master */ def->individualvcpus = true; for (i = 0; i < n; i++) { virDomainVcpuDefPtr vcpu; int state; unsigned int id; unsigned int order; if (!(tmp = virXMLPropString(nodes[i], "id")) || virStrToLong_uip(tmp, NULL, 10, &id) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing or invalid vcpu id")); return -1; } VIR_FREE(tmp); if (id >= def->maxvcpus) { virReportError(VIR_ERR_XML_ERROR, _("vcpu id '%u' is out of range of maximum " "vcpu count"), id); return -1; } vcpu = virDomainDefGetVcpu(def, id); if (!(tmp = virXMLPropString(nodes[i], "enabled"))) { virReportError(VIR_ERR_XML_ERROR, "%s", _("missing vcpu enabled state")); return -1; } if ((state = virTristateBoolTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_XML_ERROR, _("invalid vcpu 'enabled' value '%s'"), tmp); return -1; } VIR_FREE(tmp); vcpu->online = state == VIR_TRISTATE_BOOL_YES; if ((tmp = virXMLPropString(nodes[i], "hotpluggable"))) { int hotpluggable; if ((hotpluggable = virTristateBoolTypeFromString(tmp)) < 0) { virReportError(VIR_ERR_XML_ERROR, _("invalid vcpu 'hotpluggable' value '%s'"), tmp); return -1; } vcpu->hotpluggable = hotpluggable; VIR_FREE(tmp); } if ((tmp = virXMLPropString(nodes[i], "order"))) { if (virStrToLong_uip(tmp, NULL, 10, &order) < 0) { virReportError(VIR_ERR_XML_ERROR, "%s", _("invalid vcpu order")); return -1; } vcpu->order = order; VIR_FREE(tmp); } } } else { if (virDomainDefSetVcpus(def, vcpus) < 0) return -1; } return 0; }
0
167,900
void AsyncFileSystemChromium::move(const KURL& sourcePath, const KURL& destinationPath, PassOwnPtr<AsyncFileSystemCallbacks> callbacks) { m_webFileSystem->move(sourcePath, destinationPath, new WebKit::WebFileSystemCallbacksImpl(callbacks)); }
0
416,574
gx_default_finish_copydevice(gx_device *dev, const gx_device *from_dev) { /* Only allow copying the prototype. */ return (from_dev->memory ? gs_note_error(gs_error_rangecheck) : 0); }
0
308,528
favicon::MockFaviconService* favicon_service() { return mock_favicon_service_.get(); }
0
265,356
static void __report_tpr_access(struct kvm_lapic *apic, bool write) { struct kvm_vcpu *vcpu = apic->vcpu; struct kvm_run *run = vcpu->run; kvm_make_request(KVM_REQ_REPORT_TPR_ACCESS, vcpu); run->tpr_access.rip = kvm_rip_read(vcpu); run->tpr_access.is_write = write; }
0