idx
int64
func
string
target
int64
117,264
static const char *req_log_id_field(request_rec *r) { return r->log_id; }
0
339,629
static inline void vc1_pred_mv_intfr(VC1Context *v, int n, int dmv_x, int dmv_y, int mvn, int r_x, int r_y, uint8_t* is_intra, int dir) { MpegEncContext *s = &v->s; int xy, wrap, off = 0; int A[2], B[2], C[2]; int px = 0, py = 0; int a_valid = 0, b_valid = 0, c_valid = 0; int field_a, field_b, field_c; // 0: same, 1: opposit int total_valid, num_samefield, num_oppfield; int pos_c, pos_b, n_adj; wrap = s->b8_stride; xy = s->block_index[n]; if (s->mb_intra) { s->mv[0][n][0] = s->current_picture.motion_val[0][xy][0] = 0; s->mv[0][n][1] = s->current_picture.motion_val[0][xy][1] = 0; s->current_picture.motion_val[1][xy][0] = 0; s->current_picture.motion_val[1][xy][1] = 0; if (mvn == 1) { /* duplicate motion data for 1-MV block */ s->current_picture.motion_val[0][xy + 1][0] = 0; s->current_picture.motion_val[0][xy + 1][1] = 0; s->current_picture.motion_val[0][xy + wrap][0] = 0; s->current_picture.motion_val[0][xy + wrap][1] = 0; s->current_picture.motion_val[0][xy + wrap + 1][0] = 0; s->current_picture.motion_val[0][xy + wrap + 1][1] = 0; v->luma_mv[s->mb_x][0] = v->luma_mv[s->mb_x][1] = 0; s->current_picture.motion_val[1][xy + 1][0] = 0; s->current_picture.motion_val[1][xy + 1][1] = 0; s->current_picture.motion_val[1][xy + wrap][0] = 0; s->current_picture.motion_val[1][xy + wrap][1] = 0; s->current_picture.motion_val[1][xy + wrap + 1][0] = 0; s->current_picture.motion_val[1][xy + wrap + 1][1] = 0; } return; } off = ((n == 0) || (n == 1)) ? 1 : -1; /* predict A */ if (s->mb_x || (n == 1) || (n == 3)) { if ((v->blk_mv_type[xy]) // current block (MB) has a field MV || (!v->blk_mv_type[xy] && !v->blk_mv_type[xy - 1])) { // or both have frame MV A[0] = s->current_picture.motion_val[dir][xy - 1][0]; A[1] = s->current_picture.motion_val[dir][xy - 1][1]; a_valid = 1; } else { // current block has frame mv and cand. has field MV (so average) A[0] = (s->current_picture.motion_val[dir][xy - 1][0] + s->current_picture.motion_val[dir][xy - 1 + off * wrap][0] + 1) >> 1; A[1] = (s->current_picture.motion_val[dir][xy - 1][1] + s->current_picture.motion_val[dir][xy - 1 + off * wrap][1] + 1) >> 1; a_valid = 1; } if (!(n & 1) && v->is_intra[s->mb_x - 1]) { a_valid = 0; A[0] = A[1] = 0; } } else A[0] = A[1] = 0; /* Predict B and C */ B[0] = B[1] = C[0] = C[1] = 0; if (n == 0 || n == 1 || v->blk_mv_type[xy]) { if (!s->first_slice_line) { if (!v->is_intra[s->mb_x - s->mb_stride]) { b_valid = 1; n_adj = n | 2; pos_b = s->block_index[n_adj] - 2 * wrap; if (v->blk_mv_type[pos_b] && v->blk_mv_type[xy]) { n_adj = (n & 2) | (n & 1); } B[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][0]; B[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap][1]; if (v->blk_mv_type[pos_b] && !v->blk_mv_type[xy]) { B[0] = (B[0] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][0] + 1) >> 1; B[1] = (B[1] + s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap][1] + 1) >> 1; } } if (s->mb_width > 1) { if (!v->is_intra[s->mb_x - s->mb_stride + 1]) { c_valid = 1; n_adj = 2; pos_c = s->block_index[2] - 2 * wrap + 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n & 2; } C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][0]; C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap + 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][0])) >> 1; C[1] = (1 + C[1] + (s->current_picture.motion_val[dir][s->block_index[n_adj ^ 2] - 2 * wrap + 2][1])) >> 1; } if (s->mb_x == s->mb_width - 1) { if (!v->is_intra[s->mb_x - s->mb_stride - 1]) { c_valid = 1; n_adj = 3; pos_c = s->block_index[3] - 2 * wrap - 2; if (v->blk_mv_type[pos_c] && v->blk_mv_type[xy]) { n_adj = n | 1; } C[0] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][0]; C[1] = s->current_picture.motion_val[dir][s->block_index[n_adj] - 2 * wrap - 2][1]; if (v->blk_mv_type[pos_c] && !v->blk_mv_type[xy]) { C[0] = (1 + C[0] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][0]) >> 1; C[1] = (1 + C[1] + s->current_picture.motion_val[dir][s->block_index[1] - 2 * wrap - 2][1]) >> 1; } } else c_valid = 0; } } } } } else { pos_b = s->block_index[1]; b_valid = 1; B[0] = s->current_picture.motion_val[dir][pos_b][0]; B[1] = s->current_picture.motion_val[dir][pos_b][1]; pos_c = s->block_index[0]; c_valid = 1; C[0] = s->current_picture.motion_val[dir][pos_c][0]; C[1] = s->current_picture.motion_val[dir][pos_c][1]; } total_valid = a_valid + b_valid + c_valid; // check if predictor A is out of bounds if (!s->mb_x && !(n == 1 || n == 3)) { A[0] = A[1] = 0; } // check if predictor B is out of bounds if ((s->first_slice_line && v->blk_mv_type[xy]) || (s->first_slice_line && !(n & 2))) { B[0] = B[1] = C[0] = C[1] = 0; } if (!v->blk_mv_type[xy]) { if (s->mb_width == 1) { px = B[0]; py = B[1]; } else { if (total_valid >= 2) { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } else if (total_valid) { if (a_valid) { px = A[0]; py = A[1]; } else if (b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else av_assert2(0); } } } else { if (a_valid) field_a = (A[1] & 4) ? 1 : 0; else field_a = 0; if (b_valid) field_b = (B[1] & 4) ? 1 : 0; else field_b = 0; if (c_valid) field_c = (C[1] & 4) ? 1 : 0; else field_c = 0; num_oppfield = field_a + field_b + field_c; num_samefield = total_valid - num_oppfield; if (total_valid == 3) { if ((num_samefield == 3) || (num_oppfield == 3)) { px = mid_pred(A[0], B[0], C[0]); py = mid_pred(A[1], B[1], C[1]); } else if (num_samefield >= num_oppfield) { /* take one MV from same field set depending on priority the check for B may not be necessary */ px = !field_a ? A[0] : B[0]; py = !field_a ? A[1] : B[1]; } else { px = field_a ? A[0] : B[0]; py = field_a ? A[1] : B[1]; } } else if (total_valid == 2) { if (num_samefield >= num_oppfield) { if (!field_a && a_valid) { px = A[0]; py = A[1]; } else if (!field_b && b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } else px = py = 0; } else { if (field_a && a_valid) { px = A[0]; py = A[1]; } else if (field_b && b_valid) { px = B[0]; py = B[1]; } else if (c_valid) { px = C[0]; py = C[1]; } } } else if (total_valid == 1) { px = (a_valid) ? A[0] : ((b_valid) ? B[0] : C[0]); py = (a_valid) ? A[1] : ((b_valid) ? B[1] : C[1]); } } /* store MV using signed modulus of MV range defined in 4.11 */ s->mv[dir][n][0] = s->current_picture.motion_val[dir][xy][0] = ((px + dmv_x + r_x) & ((r_x << 1) - 1)) - r_x; s->mv[dir][n][1] = s->current_picture.motion_val[dir][xy][1] = ((py + dmv_y + r_y) & ((r_y << 1) - 1)) - r_y; if (mvn == 1) { /* duplicate motion data for 1-MV block */ s->current_picture.motion_val[dir][xy + 1 ][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + 1 ][1] = s->current_picture.motion_val[dir][xy][1]; s->current_picture.motion_val[dir][xy + wrap ][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + wrap ][1] = s->current_picture.motion_val[dir][xy][1]; s->current_picture.motion_val[dir][xy + wrap + 1][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + wrap + 1][1] = s->current_picture.motion_val[dir][xy][1]; } else if (mvn == 2) { /* duplicate motion data for 2-Field MV block */ s->current_picture.motion_val[dir][xy + 1][0] = s->current_picture.motion_val[dir][xy][0]; s->current_picture.motion_val[dir][xy + 1][1] = s->current_picture.motion_val[dir][xy][1]; s->mv[dir][n + 1][0] = s->mv[dir][n][0]; s->mv[dir][n + 1][1] = s->mv[dir][n][1]; } }
0
469,137
static int io_sq_offload_start(struct io_ring_ctx *ctx, struct io_uring_params *p) { int ret; mmgrab(current->mm); ctx->sqo_mm = current->mm; if (ctx->flags & IORING_SETUP_SQPOLL) { ret = -EPERM; if (!capable(CAP_SYS_ADMIN)) goto err; ctx->sq_thread_idle = msecs_to_jiffies(p->sq_thread_idle); if (!ctx->sq_thread_idle) ctx->sq_thread_idle = HZ; if (p->flags & IORING_SETUP_SQ_AFF) { int cpu = p->sq_thread_cpu; ret = -EINVAL; if (cpu >= nr_cpu_ids) goto err; if (!cpu_online(cpu)) goto err; ctx->sqo_thread = kthread_create_on_cpu(io_sq_thread, ctx, cpu, "io_uring-sq"); } else { ctx->sqo_thread = kthread_create(io_sq_thread, ctx, "io_uring-sq"); } if (IS_ERR(ctx->sqo_thread)) { ret = PTR_ERR(ctx->sqo_thread); ctx->sqo_thread = NULL; goto err; } wake_up_process(ctx->sqo_thread); } else if (p->flags & IORING_SETUP_SQ_AFF) { /* Can't have SQ_AFF without SQPOLL */ ret = -EINVAL; goto err; } ret = io_init_wq_offload(ctx, p); if (ret) goto err; return 0; err: io_finish_async(ctx); if (ctx->sqo_mm) { mmdrop(ctx->sqo_mm); ctx->sqo_mm = NULL; } return ret; }
0
257,359
void _cmsAllocMPETypePluginChunk ( struct _cmsContext_struct * ctx , const struct _cmsContext_struct * src ) { if ( src != NULL ) { DupTagTypeList ( ctx , src , MPEPlugin ) ; } else { static _cmsTagTypePluginChunkType TagTypePluginChunk = { NULL } ; ctx -> chunks [ MPEPlugin ] = _cmsSubAllocDup ( ctx -> MemPool , & TagTypePluginChunk , sizeof ( _cmsTagTypePluginChunkType ) ) ; } }
0
260,934
int dbd_db_login(SV* dbh, imp_dbh_t* imp_dbh, char* dbname, char* user, char* password) { #ifdef dTHR dTHR; #endif dTHX; D_imp_xxh(dbh); if (DBIc_TRACE_LEVEL(imp_xxh) >= 2) PerlIO_printf(DBIc_LOGPIO(imp_xxh), "imp_dbh->connect: dsn = %s, uid = %s, pwd = %s\n", dbname ? dbname : "NULL", user ? user : "NULL", password ? password : "NULL"); imp_dbh->stats.auto_reconnects_ok= 0; imp_dbh->stats.auto_reconnects_failed= 0; imp_dbh->bind_type_guessing= FALSE; imp_dbh->bind_comment_placeholders= FALSE; imp_dbh->has_transactions= TRUE; /* Safer we flip this to TRUE perl side if we detect a mod_perl env. */ imp_dbh->auto_reconnect = FALSE; /* HELMUT */ #if defined(sv_utf8_decode) && MYSQL_VERSION_ID >=SERVER_PREPARE_VERSION imp_dbh->enable_utf8 = FALSE; /* initialize mysql_enable_utf8 */ #endif if (!my_login(aTHX_ dbh, imp_dbh)) { if(imp_dbh->pmysql) do_error(dbh, mysql_errno(imp_dbh->pmysql), mysql_error(imp_dbh->pmysql) ,mysql_sqlstate(imp_dbh->pmysql)); return FALSE; } /* * Tell DBI, that dbh->disconnect should be called for this handle */ DBIc_ACTIVE_on(imp_dbh); /* Tell DBI, that dbh->destroy should be called for this handle */ DBIc_on(imp_dbh, DBIcf_IMPSET); return TRUE; }
0
117,663
OPJ_BOOL opj_tcd_t1_encode ( opj_tcd_t *p_tcd ) { opj_t1_t * l_t1; const OPJ_FLOAT64 * l_mct_norms; OPJ_UINT32 l_mct_numcomps = 0U; opj_tcp_t * l_tcp = p_tcd->tcp; l_t1 = opj_t1_create(OPJ_TRUE); if (l_t1 == 00) { return OPJ_FALSE; } if (l_tcp->mct == 1) { l_mct_numcomps = 3U; /* irreversible encoding */ if (l_tcp->tccps->qmfbid == 0) { l_mct_norms = opj_mct_get_mct_norms_real(); } else { l_mct_norms = opj_mct_get_mct_norms(); } } else { l_mct_numcomps = p_tcd->image->numcomps; l_mct_norms = (const OPJ_FLOAT64 *) (l_tcp->mct_norms); } if (! opj_t1_encode_cblks(l_t1, p_tcd->tcd_image->tiles , l_tcp, l_mct_norms, l_mct_numcomps)) { opj_t1_destroy(l_t1); return OPJ_FALSE; } opj_t1_destroy(l_t1); return OPJ_TRUE; }
0
304,538
static struct mg_fd *packed_open(const char *path, int flags) { size_t size = 0; const char *data = mg_unpack(path, &size, NULL); struct packed_file *fp = NULL; struct mg_fd *fd = NULL; if (data == NULL) return NULL; if (flags & MG_FS_WRITE) return NULL; fp = (struct packed_file *) calloc(1, sizeof(*fp)); fd = (struct mg_fd *) calloc(1, sizeof(*fd)); fp->size = size; fp->data = data; fd->fd = fp; fd->fs = &mg_fs_packed; return fd; }
0
39,338
void MainWindow::openMultiple(const QList<QUrl>& urls) { if (urls.size() > 1) { m_multipleFiles = Util::sortedFileList(Util::expandDirectories(urls)); open(m_multipleFiles.first()); } else { QUrl url = urls.first(); open(Util::removeFileScheme(url)); } }
0
130,018
void nfs40_shutdown_client(struct nfs_client *clp) { if (clp->cl_slot_tbl) { nfs4_shutdown_slot_table(clp->cl_slot_tbl); kfree(clp->cl_slot_tbl); } }
0
252,888
void AutomationInternalCustomBindings::RouteTreeIDFunction( const std::string& name, TreeIDFunction callback) { scoped_refptr<TreeIDWrapper> wrapper = new TreeIDWrapper(this, callback); RouteFunction(name, base::Bind(&TreeIDWrapper::Run, wrapper)); }
0
287,496
static void perf_event_init_cpu(int cpu) { struct swevent_htable *swhash = &per_cpu(swevent_htable, cpu); mutex_lock(&swhash->hlist_mutex); swhash->online = true; if (swhash->hlist_refcount > 0) { struct swevent_hlist *hlist; hlist = kzalloc_node(sizeof(*hlist), GFP_KERNEL, cpu_to_node(cpu)); WARN_ON(!hlist); rcu_assign_pointer(swhash->swevent_hlist, hlist); } mutex_unlock(&swhash->hlist_mutex); }
1
239,717
void RenderViewHostImpl::DisassociateFromPopupCount() { Send(new ViewMsg_DisassociateFromPopupCount(GetRoutingID())); }
0
265,163
static Pipeline MakeExp(const int32* bias_data, int output_rows, int32 output_offset, int32 output_multiplier, int output_left_shift, int32 output_activation_min, int32 output_activation_max) { ColVectorMap bias_vector(bias_data, output_rows); gemmlowp::OutputStageBiasAddition<ColVectorMap> bias_addition_stage; bias_addition_stage.bias_vector = bias_vector; gemmlowp::OutputStageScaleInt32ByFixedPointAndExponent quantize_down_stage; quantize_down_stage.result_offset_after_shift = output_offset; quantize_down_stage.result_fixedpoint_multiplier = output_multiplier; quantize_down_stage.result_exponent = output_left_shift; gemmlowp::OutputStageClamp clamp_stage; clamp_stage.min = output_activation_min; clamp_stage.max = output_activation_max; gemmlowp::OutputStageSaturatingCastToUint8 saturating_cast_stage; return std::make_tuple(bias_addition_stage, quantize_down_stage, clamp_stage, saturating_cast_stage); }
0
338,442
static int mov_read_hdlr(MOVContext *c, ByteIOContext *pb, MOVAtom atom) { AVStream *st = c->fc->streams[c->fc->nb_streams-1]; uint32_t type; uint32_t ctype; get_byte(pb); /* version */ get_be24(pb); /* flags */ /* component type */ ctype = get_le32(pb); type = get_le32(pb); /* component subtype */ dprintf(c->fc, "ctype= %c%c%c%c (0x%08x)\n", *((char *)&ctype), ((char *)&ctype)[1], ((char *)&ctype)[2], ((char *)&ctype)[3], (int) ctype); dprintf(c->fc, "stype= %c%c%c%c\n", *((char *)&type), ((char *)&type)[1], ((char *)&type)[2], ((char *)&type)[3]); if(!ctype) c->isom = 1; if (type == MKTAG('v','i','d','e')) st->codec->codec_type = CODEC_TYPE_VIDEO; else if(type == MKTAG('s','o','u','n')) st->codec->codec_type = CODEC_TYPE_AUDIO; else if(type == MKTAG('m','1','a',' ')) st->codec->codec_id = CODEC_ID_MP2; else if(type == MKTAG('s','u','b','p')) { st->codec->codec_type = CODEC_TYPE_SUBTITLE; } get_be32(pb); /* component manufacture */ get_be32(pb); /* component flags */ get_be32(pb); /* component flags mask */ if(atom.size <= 24) return 0; /* nothing left to read */ url_fskip(pb, atom.size - (url_ftell(pb) - atom.offset)); return 0; }
1
73,174
static void encode_lookup(struct xdr_stream *xdr, const struct qstr *name, struct compound_hdr *hdr) { int len = name->len; __be32 *p; p = reserve_space(xdr, 8 + len); *p++ = cpu_to_be32(OP_LOOKUP); xdr_encode_opaque(p, name->name, len); hdr->nops++; hdr->replen += decode_lookup_maxsz; }
0
468,749
yin_parse_extcomplex_bool(struct lys_module *mod, struct lyxml_elem *node, struct lys_ext_instance_complex *ext, LY_STMT stmt, const char *true_val, const char *false_val, struct unres_schema *unres) { uint8_t *val; const char *str; struct lyext_substmt *info; val = lys_ext_complex_get_substmt(stmt, ext, &info); if (!val) { LOGVAL(mod->ctx, LYE_INCHILDSTMT, LY_VLOG_NONE, NULL, node->name, node->parent->name); return EXIT_FAILURE; } if (*val) { LOGVAL(mod->ctx, LYE_TOOMANY, LY_VLOG_NONE, NULL, node->name, node->parent->name); return EXIT_FAILURE; } if (lyp_yin_parse_subnode_ext(mod, ext, LYEXT_PAR_EXTINST, node, (LYEXT_SUBSTMT)stmt, 0, unres)) { return EXIT_FAILURE; } str = lyxml_get_attr(node, "value", NULL); if (!str) { LOGVAL(mod->ctx, LYE_MISSARG, LY_VLOG_NONE, NULL, "value", node->name); } else if (true_val && !strcmp(true_val, str)) { /* true value */ *val = 1; } else if (false_val && !strcmp(false_val, str)) { /* false value */ *val = 2; } else { /* unknown value */ LOGVAL(mod->ctx, LYE_INARG, LY_VLOG_NONE, NULL, str, node->name); return EXIT_FAILURE; } return EXIT_SUCCESS; }
0
419,115
tty_free(struct tty *tty) { tty_close(tty); free(tty->ccolour); free(tty->term_name); }
0
38,503
static u32 gf_media_nalu_locate_start_code_bs(GF_BitStream *bs, Bool locate_trailing) { u32 v, bpos, nb_cons_zeros = 0; char avc_cache[AVC_CACHE_SIZE]; u64 end, cache_start, load_size; u64 start = gf_bs_get_position(bs); if (start < 3) return 0; load_size = 0; bpos = 0; cache_start = 0; end = 0; v = 0xffffffff; while (!end) { /*refill cache*/ if (bpos == (u32)load_size) { if (!gf_bs_available(bs)) break; load_size = gf_bs_available(bs); if (load_size > AVC_CACHE_SIZE) load_size = AVC_CACHE_SIZE; bpos = 0; cache_start = gf_bs_get_position(bs); gf_bs_read_data(bs, avc_cache, (u32)load_size); } v = ( (v<<8) & 0xFFFFFF00) | ((u32) avc_cache[bpos]); bpos++; if (locate_trailing) { if ((v & 0x000000FF) == 0) nb_cons_zeros++; else nb_cons_zeros = 0; } if (v == 0x00000001) end = cache_start + bpos - 4; else if ((v & 0x00FFFFFF) == 0x00000001) end = cache_start + bpos - 3; } gf_bs_seek(bs, start); if (!end) end = gf_bs_get_size(bs); if (locate_trailing) { if (nb_cons_zeros >= 3) return (u32)(end - start - nb_cons_zeros); } return (u32)(end - start); }
0
70,972
flatpak_transaction_add_op (FlatpakTransaction *self, const char *remote, FlatpakDecomposed *ref, const char **subpaths, const char **previous_ids, const char *commit, GFile *bundle, FlatpakTransactionOperationType kind, gboolean pin_on_deploy, GError **error) { FlatpakTransactionPrivate *priv = flatpak_transaction_get_instance_private (self); FlatpakTransactionOperation *op; g_autofree char *subpaths_str = NULL; subpaths_str = subpaths_to_string (subpaths); g_debug ("Transaction: %s %s:%s%s%s%s", kind_to_str (kind), remote, flatpak_decomposed_get_ref (ref), commit != NULL ? "@" : "", commit != NULL ? commit : "", subpaths_str); op = flatpak_transaction_get_last_op_for_ref (self, ref); /* If previous_ids is given, then this is a rebase operation. */ if (op != NULL && kind_compatible (kind, op->kind, previous_ids != NULL)) { g_auto(GStrv) old_subpaths = NULL; g_auto(GStrv) old_previous_ids = NULL; old_subpaths = op->subpaths; op->subpaths = flatpak_subpaths_merge (old_subpaths, (char **) subpaths); old_previous_ids = op->previous_ids; op->previous_ids = flatpak_strv_merge (old_previous_ids, (char **) previous_ids); return op; } op = flatpak_transaction_operation_new (remote, ref, subpaths, previous_ids, commit, bundle, kind, pin_on_deploy); g_hash_table_insert (priv->last_op_for_ref, flatpak_decomposed_ref (ref), op); priv->ops = g_list_prepend (priv->ops, op); priv->needs_resolve = TRUE; return op; }
0
117,548
void gdImageGetClip (gdImagePtr im, int *x1P, int *y1P, int *x2P, int *y2P) { *x1P = im->cx1; *y1P = im->cy1; *x2P = im->cx2; *y2P = im->cy2; }
0
242,722
xmlXPathRoot(xmlXPathParserContextPtr ctxt) { if ((ctxt == NULL) || (ctxt->context == NULL)) return; ctxt->context->node = (xmlNodePtr) ctxt->context->doc; valuePush(ctxt, xmlXPathCacheNewNodeSet(ctxt->context, ctxt->context->node)); }
0
254,701
void PageHandler::PrintToPDF(Maybe<bool> landscape, Maybe<bool> display_header_footer, Maybe<bool> print_background, Maybe<double> scale, Maybe<double> paper_width, Maybe<double> paper_height, Maybe<double> margin_top, Maybe<double> margin_bottom, Maybe<double> margin_left, Maybe<double> margin_right, Maybe<String> page_ranges, Maybe<bool> ignore_invalid_page_ranges, Maybe<String> header_template, Maybe<String> footer_template, std::unique_ptr<PrintToPDFCallback> callback) { callback->sendFailure(Response::Error("PrintToPDF is not implemented")); return; }
0
262,928
static int build_mapping(struct sk_buff *skb, struct xfrm_state *x, xfrm_address_t *new_saddr, __be16 new_sport) { struct xfrm_user_mapping *um; struct nlmsghdr *nlh; nlh = nlmsg_put(skb, 0, 0, XFRM_MSG_MAPPING, sizeof(*um), 0); if (nlh == NULL) return -EMSGSIZE; um = nlmsg_data(nlh); memcpy(&um->id.daddr, &x->id.daddr, sizeof(um->id.daddr)); um->id.spi = x->id.spi; um->id.family = x->props.family; um->id.proto = x->id.proto; memcpy(&um->new_saddr, new_saddr, sizeof(um->new_saddr)); memcpy(&um->old_saddr, &x->props.saddr, sizeof(um->old_saddr)); um->new_sport = new_sport; um->old_sport = x->encap->encap_sport; um->reqid = x->props.reqid; nlmsg_end(skb, nlh); return 0; }
0
44,683
struct file *filp_open(const char *filename, int flags, int mode) { return do_filp_open(AT_FDCWD, filename, flags, mode, 0); }
0
45,340
static int ti_vread_sync(struct usb_device *dev, __u8 request, __u16 value, __u16 index, u8 *data, int size) { int status; status = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), request, (USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN), value, index, data, size, 1000); if (status < 0) return status; if (status != size) { dev_dbg(&dev->dev, "%s - wanted to write %d, but only wrote %d\n", __func__, size, status); return -ECOMM; } return 0; }
0
151,282
//! Invert endianness of all pixel values \newinstance. CImg<T> get_invert_endianness() const { return (+*this).invert_endianness();
0
406,766
partition_element *ha_partition::find_partition_element(uint part_id) { uint i; uint curr_part_id= 0; List_iterator_fast <partition_element> part_it(m_part_info->partitions); for (i= 0; i < m_part_info->num_parts; i++) { partition_element *part_elem; part_elem= part_it++; if (m_is_sub_partitioned) { uint j; List_iterator_fast <partition_element> sub_it(part_elem->subpartitions); for (j= 0; j < m_part_info->num_subparts; j++) { part_elem= sub_it++; if (part_id == curr_part_id++) return part_elem; } } else if (part_id == curr_part_id++) return part_elem; } DBUG_ASSERT(0); my_error(ER_OUT_OF_RESOURCES, MYF(ME_FATALERROR)); return NULL; }
0
386,637
static struct gfxinfo *php_handle_swf (php_stream * stream TSRMLS_DC) { struct gfxinfo *result = NULL; long bits; unsigned char a[32]; if (php_stream_seek(stream, 5, SEEK_CUR)) return NULL; if (php_stream_read(stream, a, sizeof(a)) != sizeof(a)) return NULL; result = (struct gfxinfo *) ecalloc (1, sizeof (struct gfxinfo)); bits = php_swf_get_bits (a, 0, 5); result->width = (php_swf_get_bits (a, 5 + bits, bits) - php_swf_get_bits (a, 5, bits)) / 20; result->height = (php_swf_get_bits (a, 5 + (3 * bits), bits) - php_swf_get_bits (a, 5 + (2 * bits), bits)) / 20; result->bits = 0; result->channels = 0; return result; }
0
399,351
switch_hrtimer_base(struct hrtimer *timer, struct hrtimer_clock_base *base, int pinned) { struct hrtimer_cpu_base *new_cpu_base, *this_cpu_base; struct hrtimer_clock_base *new_base; int basenum = base->index; this_cpu_base = this_cpu_ptr(&hrtimer_bases); new_cpu_base = get_target_base(this_cpu_base, pinned); again: new_base = &new_cpu_base->clock_base[basenum]; if (base != new_base) { /* * We are trying to move timer to new_base. * However we can't change timer's base while it is running, * so we keep it on the same CPU. No hassle vs. reprogramming * the event source in the high resolution case. The softirq * code will take care of this when the timer function has * completed. There is no conflict as we hold the lock until * the timer is enqueued. */ if (unlikely(hrtimer_callback_running(timer))) return base; /* See the comment in lock_hrtimer_base() */ timer->base = &migration_base; raw_spin_unlock(&base->cpu_base->lock); raw_spin_lock(&new_base->cpu_base->lock); if (new_cpu_base != this_cpu_base && hrtimer_check_target(timer, new_base)) { raw_spin_unlock(&new_base->cpu_base->lock); raw_spin_lock(&base->cpu_base->lock); new_cpu_base = this_cpu_base; timer->base = base; goto again; } timer->base = new_base; } else { if (new_cpu_base != this_cpu_base && hrtimer_check_target(timer, new_base)) { new_cpu_base = this_cpu_base; goto again; } } return new_base; }
0
162,274
DEFINE_TEST(test_read_format_rar5_multiple_files_solid) { const int DATA_SIZE = 4096; uint8_t buff[4096]; PROLOGUE("test_read_format_rar5_multiple_files_solid.rar"); assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("test1.bin", archive_entry_pathname(ae)); assertEqualInt(DATA_SIZE, archive_entry_size(ae)); assertA(DATA_SIZE == archive_read_data(a, buff, DATA_SIZE)); assertA(verify_data(buff, 1, DATA_SIZE)); assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("test2.bin", archive_entry_pathname(ae)); assertEqualInt(DATA_SIZE, archive_entry_size(ae)); assertA(DATA_SIZE == archive_read_data(a, buff, DATA_SIZE)); assertA(verify_data(buff, 2, DATA_SIZE)); assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("test3.bin", archive_entry_pathname(ae)); assertEqualInt(DATA_SIZE, archive_entry_size(ae)); assertA(DATA_SIZE == archive_read_data(a, buff, DATA_SIZE)); assertA(verify_data(buff, 3, DATA_SIZE)); assertA(0 == archive_read_next_header(a, &ae)); assertEqualString("test4.bin", archive_entry_pathname(ae)); assertEqualInt(DATA_SIZE, archive_entry_size(ae)); assertA(DATA_SIZE == archive_read_data(a, buff, DATA_SIZE)); assertA(verify_data(buff, 4, DATA_SIZE)); assertA(ARCHIVE_EOF == archive_read_next_header(a, &ae)); EPILOGUE(); }
0
78,412
void jspInit() { jspSoftInit(); }
0
175,744
static void* dvcman_get_rdp_settings(IDRDYNVC_ENTRY_POINTS* pEntryPoints) { return (void*)((DVCMAN_ENTRY_POINTS*) pEntryPoints)->settings; }
0
457,626
static int io_sync_file_range(struct io_kiocb *req, bool force_nonblock) { int ret; /* sync_file_range always requires a blocking context */ if (force_nonblock) return -EAGAIN; ret = sync_file_range(req->file, req->sync.off, req->sync.len, req->sync.flags); if (ret < 0) req_set_fail_links(req); io_req_complete(req, ret); return 0; }
0
23,418
static int dissect_h245_INTEGER_0_65535 ( tvbuff_t * tvb _U_ , int offset _U_ , asn1_ctx_t * actx _U_ , proto_tree * tree _U_ , int hf_index _U_ ) { offset = dissect_per_constrained_integer ( tvb , offset , actx , tree , hf_index , 0U , 65535U , NULL , FALSE ) ; return offset ; }
0
408,839
static void fli_write_short(FILE *f, unsigned short w) { unsigned char b[2]; b[0]=w&255; b[1]=(w>>8)&255; fwrite(&b,1,2,f); }
0
420,851
deinit_sockets (void) { WSACleanup(); }
0
32,390
void LeptonCodec::ThreadState::decode_row_internal(BlockBasedImagePerChannel<force_memory_optimization>& image_data, Sirikata::Array1d<uint32_t, (uint32_t)ColorChannel:: NumBlockTypes> component_size_in_blocks, int component, int curr_y) { using std::tuple; tuple<ProbabilityTablesTuple(false, false, false)> corner(EACH_BLOCK_TYPE(false,false,false)); tuple<ProbabilityTablesTuple(true, false, false)> top(EACH_BLOCK_TYPE(true,false,false)); tuple<ProbabilityTablesTuple(false, true, true)> midleft(EACH_BLOCK_TYPE(false, true, true)); tuple<ProbabilityTablesTuple(true, true, true)> middle(EACH_BLOCK_TYPE(true,true,true)); tuple<ProbabilityTablesTuple(true, true, false)> midright(EACH_BLOCK_TYPE(true, true, false)); tuple<ProbabilityTablesTuple(false, true, false)> width_one(EACH_BLOCK_TYPE(false, true, false)); context_.at(component) = image_data[component]->off_y(curr_y, num_nonzeros_.at(component).begin()); int block_width = image_data[component]->block_width(); if (is_top_row_.at(component)) { is_top_row_.at(component) = false; switch((BlockType)component) { case BlockType::Y: decode_row(std::get<(int)BlockType::Y>(corner), std::get<(int)BlockType::Y>(top), std::get<(int)BlockType::Y>(top), curr_y, image_data, component_size_in_blocks[component]); break; case BlockType::Cb: decode_row(std::get<(int)BlockType::Cb>(corner), std::get<(int)BlockType::Cb>(top), std::get<(int)BlockType::Cb>(top), curr_y, image_data, component_size_in_blocks[component]); break; case BlockType::Cr: decode_row(std::get<(int)BlockType::Cr>(corner), std::get<(int)BlockType::Cr>(top), std::get<(int)BlockType::Cr>(top), curr_y, image_data, component_size_in_blocks[component]); break; #ifdef ALLOW_FOUR_COLORS case BlockType::Ck: decode_row(std::get<(int)BlockType::Ck>(corner), std::get<(int)BlockType::Ck>(top), std::get<(int)BlockType::Ck>(top), curr_y, image_data, component_size_in_blocks[component]); break; #endif } } else if (block_width > 1) { dev_assert(curr_y); // just a sanity check that the zeroth row took the first branch switch((BlockType)component) { case BlockType::Y: decode_row(std::get<(int)BlockType::Y>(midleft), std::get<(int)BlockType::Y>(middle), std::get<(int)BlockType::Y>(midright), curr_y, image_data, component_size_in_blocks[component]); break; case BlockType::Cb: decode_row(std::get<(int)BlockType::Cb>(midleft), std::get<(int)BlockType::Cb>(middle), std::get<(int)BlockType::Cb>(midright), curr_y, image_data, component_size_in_blocks[component]); break; case BlockType::Cr: decode_row(std::get<(int)BlockType::Cr>(midleft), std::get<(int)BlockType::Cr>(middle), std::get<(int)BlockType::Cr>(midright), curr_y, image_data, component_size_in_blocks[component]); break; #ifdef ALLOW_FOUR_COLORS case BlockType::Ck: decode_row(std::get<(int)BlockType::Ck>(midleft), std::get<(int)BlockType::Ck>(middle), std::get<(int)BlockType::Ck>(midright), curr_y, image_data, component_size_in_blocks[component]); break; #endif } } else { dev_assert(curr_y); // just a sanity check that the zeroth row took the first branch dev_assert(block_width == 1); switch((BlockType)component) { case BlockType::Y: decode_row(std::get<(int)BlockType::Y>(width_one), std::get<(int)BlockType::Y>(width_one), std::get<(int)BlockType::Y>(width_one), curr_y, image_data, component_size_in_blocks[component]); break; case BlockType::Cb: decode_row(std::get<(int)BlockType::Cb>(width_one), std::get<(int)BlockType::Cb>(width_one), std::get<(int)BlockType::Cb>(width_one), curr_y, image_data, component_size_in_blocks[component]); break; case BlockType::Cr: decode_row(std::get<(int)BlockType::Cr>(width_one), std::get<(int)BlockType::Cr>(width_one), std::get<(int)BlockType::Cr>(width_one), curr_y, image_data, component_size_in_blocks[component]); break; #ifdef ALLOW_FOUR_COLORS case BlockType::Ck: decode_row(std::get<(int)BlockType::Ck>(width_one), std::get<(int)BlockType::Ck>(width_one), std::get<(int)BlockType::Ck>(width_one), curr_y, image_data, component_size_in_blocks[component]); break; #endif } } }
0
238,244
js_Function *jsC_compilefunction(js_State *J, js_Ast *prog) { return newfun(J, prog->a, prog->b, prog->c, 0); }
0
194,690
bool Extension::IdIsValid(const std::string& id) { if (id.size() != (kIdSize * 2)) return false; std::string temp = StringToLowerASCII(id); for (size_t i = 0; i < temp.size(); i++) if (temp[i] < 'a' || temp[i] > 'p') return false; return true; }
0
307,538
SchedulerHelper::~SchedulerHelper() { }
0
98,481
epass2003_create_file(struct sc_card *card, sc_file_t * file) { int r; size_t len; u8 sbuf[SC_MAX_APDU_BUFFER_SIZE] = { 0 }; struct sc_apdu apdu; len = SC_MAX_APDU_BUFFER_SIZE; epass2003_hook_file(file, 1); if (card->ops->construct_fci == NULL) LOG_FUNC_RETURN(card->ctx, SC_ERROR_NOT_SUPPORTED); r = epass2003_construct_fci(card, file, sbuf, &len); LOG_TEST_RET(card->ctx, r, "construct_fci() failed"); sc_format_apdu(card, &apdu, SC_APDU_CASE_3_SHORT, 0xE0, 0x00, 0x00); apdu.lc = len; apdu.datalen = len; apdu.data = sbuf; r = sc_transmit_apdu_t(card, &apdu); LOG_TEST_RET(card->ctx, r, "APDU transmit failed"); r = sc_check_sw(card, apdu.sw1, apdu.sw2); LOG_TEST_RET(card->ctx, r, "APDU sw1/2 wrong"); epass2003_hook_file(file, 0); return r; }
0
254,659
void RenderWidgetHostViewGuest::TextInputStateChanged( const ViewHostMsg_TextInputState_Params& params) { NOTIMPLEMENTED(); }
0
137,316
bool TrustedPrimitives::IsOutsideEnclave(const void *addr, size_t size) { return sgx_is_outside_enclave(addr, size) == 1; }
0
374,985
_copyList(const List *from) { List *new; ListCell *curr_old; ListCell *prev_new; Assert(list_length(from) >= 1); new = makeNode(List); new->length = from->length; COPY_NODE_CELL(new->head, from->head); prev_new = new->head; curr_old = lnext(from->head); while (curr_old) { COPY_NODE_CELL(prev_new->next, curr_old); prev_new = prev_new->next; curr_old = curr_old->next; } prev_new->next = NULL; new->tail = prev_new; return new; }
0
248,315
htmlParseComment(htmlParserCtxtPtr ctxt) { xmlChar *buf = NULL; int len; int size = HTML_PARSER_BUFFER_SIZE; int q, ql; int r, rl; int cur, l; xmlParserInputState state; /* * Check that there is a comment right here. */ if ((RAW != '<') || (NXT(1) != '!') || (NXT(2) != '-') || (NXT(3) != '-')) return; state = ctxt->instate; ctxt->instate = XML_PARSER_COMMENT; SHRINK; SKIP(4); buf = (xmlChar *) xmlMallocAtomic(size * sizeof(xmlChar)); if (buf == NULL) { htmlErrMemory(ctxt, "buffer allocation failed\n"); ctxt->instate = state; return; } len = 0; buf[len] = 0; q = CUR_CHAR(ql); if (!IS_CHAR(q)) goto unfinished; NEXTL(ql); r = CUR_CHAR(rl); if (!IS_CHAR(r)) goto unfinished; NEXTL(rl); cur = CUR_CHAR(l); while (IS_CHAR(cur) && ((cur != '>') || (r != '-') || (q != '-'))) { if (len + 5 >= size) { xmlChar *tmp; size *= 2; tmp = (xmlChar *) xmlRealloc(buf, size * sizeof(xmlChar)); if (tmp == NULL) { xmlFree(buf); htmlErrMemory(ctxt, "growing buffer failed\n"); ctxt->instate = state; return; } buf = tmp; } COPY_BUF(ql,buf,len,q); q = r; ql = rl; r = cur; rl = l; NEXTL(l); cur = CUR_CHAR(l); if (cur == 0) { SHRINK; GROW; cur = CUR_CHAR(l); } } buf[len] = 0; if (IS_CHAR(cur)) { NEXT; if ((ctxt->sax != NULL) && (ctxt->sax->comment != NULL) && (!ctxt->disableSAX)) ctxt->sax->comment(ctxt->userData, buf); xmlFree(buf); ctxt->instate = state; return; } unfinished: htmlParseErr(ctxt, XML_ERR_COMMENT_NOT_FINISHED, "Comment not terminated \n<!--%.50s\n", buf, NULL); xmlFree(buf); }
0
112,810
static void nf_conntrack_standalone_fini_sysctl(struct net *net) { struct nf_conntrack_net *cnet = net_generic(net, nf_conntrack_net_id); struct ctl_table *table; table = cnet->sysctl_header->ctl_table_arg; unregister_net_sysctl_table(cnet->sysctl_header); kfree(table); }
0
13,197
int sc_asn1_read_tag(const u8 ** buf, size_t buflen, unsigned int *cla_out, unsigned int *tag_out, size_t *taglen) { const u8 *p = *buf; size_t left = buflen, len; unsigned int cla, tag, i; if (left < 2) return SC_ERROR_INVALID_ASN1_OBJECT; *buf = NULL; if (*p == 0xff || *p == 0) { /* end of data reached */ *taglen = 0; *tag_out = SC_ASN1_TAG_EOC; return SC_SUCCESS; } /* parse tag byte(s) * Resulted tag is presented by integer that has not to be * confused with the 'tag number' part of ASN.1 tag. */ cla = (*p & SC_ASN1_TAG_CLASS) | (*p & SC_ASN1_TAG_CONSTRUCTED); tag = *p & SC_ASN1_TAG_PRIMITIVE; p++; left--; if (tag == SC_ASN1_TAG_PRIMITIVE) { /* high tag number */ size_t n = SC_ASN1_TAGNUM_SIZE - 1; /* search the last tag octet */ while (left-- != 0 && n != 0) { tag <<= 8; tag |= *p; if ((*p++ & 0x80) == 0) break; n--; } if (left == 0 || n == 0) /* either an invalid tag or it doesn't fit in * unsigned int */ return SC_ERROR_INVALID_ASN1_OBJECT; } /* parse length byte(s) */ len = *p & 0x7f; if (*p++ & 0x80) { unsigned int a = 0; if (len > 4 || len > left) return SC_ERROR_INVALID_ASN1_OBJECT; left -= len; for (i = 0; i < len; i++) { a <<= 8; a |= *p; p++; } len = a; } *cla_out = cla; *tag_out = tag; *taglen = len; *buf = p; if (len > left) return SC_ERROR_ASN1_END_OF_CONTENTS; return SC_SUCCESS; }
1
166,445
cf2_getScaleAndHintFlag( CFF_Decoder* decoder, CF2_Fixed* x_scale, CF2_Fixed* y_scale, FT_Bool* hinted, FT_Bool* scaled ) { FT_ASSERT( decoder && decoder->builder.glyph ); /* note: FreeType scale includes a factor of 64 */ *hinted = decoder->builder.glyph->hint; *scaled = decoder->builder.glyph->scaled; if ( *hinted ) { *x_scale = FT_DivFix( decoder->builder.glyph->x_scale, cf2_intToFixed( 64 ) ); *y_scale = FT_DivFix( decoder->builder.glyph->y_scale, cf2_intToFixed( 64 ) ); } else { /* for unhinted outlines, `cff_slot_load' does the scaling, */ /* thus render at `unity' scale */ *x_scale = 0x0400; /* 1/64 as 16.16 */ *y_scale = 0x0400; } }
0
347,295
CURLcode Curl_ntlm_core_mk_ntlmv2_hash(const char *user, size_t userlen, const char *domain, size_t domlen, unsigned char *ntlmhash, unsigned char *ntlmv2hash) { /* Unicode representation */ size_t identity_len = (userlen + domlen) * 2; unsigned char *identity = malloc(identity_len); CURLcode result = CURLE_OK; if(!identity) return CURLE_OUT_OF_MEMORY; ascii_uppercase_to_unicode_le(identity, user, userlen); ascii_to_unicode_le(identity + (userlen << 1), domain, domlen); result = Curl_hmac_md5(ntlmhash, 16, identity, curlx_uztoui(identity_len), ntlmv2hash); free(identity); return result; }
1
248,255
gamma_component_compose(int do_background, double input_sample, double alpha, double background, int *compose) { switch (do_background) { #ifdef PNG_READ_BACKGROUND_SUPPORTED case PNG_BACKGROUND_GAMMA_SCREEN: case PNG_BACKGROUND_GAMMA_FILE: case PNG_BACKGROUND_GAMMA_UNIQUE: /* Standard PNG background processing. */ if (alpha < 1) { if (alpha > 0) { input_sample = input_sample * alpha + background * (1-alpha); if (compose != NULL) *compose = 1; } else input_sample = background; } break; #endif #ifdef PNG_READ_ALPHA_MODE_SUPPORTED case ALPHA_MODE_OFFSET + PNG_ALPHA_STANDARD: case ALPHA_MODE_OFFSET + PNG_ALPHA_BROKEN: /* The components are premultiplied in either case and the output is * gamma encoded (to get standard Porter-Duff we expect the output * gamma to be set to 1.0!) */ case ALPHA_MODE_OFFSET + PNG_ALPHA_OPTIMIZED: /* The optimization is that the partial-alpha entries are linear * while the opaque pixels are gamma encoded, but this only affects the * output encoding. */ if (alpha < 1) { if (alpha > 0) { input_sample *= alpha; if (compose != NULL) *compose = 1; } else input_sample = 0; } break; #endif default: /* Standard cases where no compositing is done (so the component * value is already correct.) */ UNUSED(alpha) UNUSED(background) UNUSED(compose) break; } return input_sample; }
0
320,539
static int curl_open(BlockDriverState *bs, QDict *options, int flags, Error **errp) { BDRVCURLState *s = bs->opaque; CURLState *state = NULL; QemuOpts *opts; Error *local_err = NULL; const char *file; const char *cookie; const char *cookie_secret; double d; const char *secretid; const char *protocol_delimiter; static int inited = 0; if (flags & BDRV_O_RDWR) { error_setg(errp, "curl block device does not support writes"); return -EROFS; } qemu_mutex_init(&s->mutex); opts = qemu_opts_create(&runtime_opts, NULL, 0, &error_abort); qemu_opts_absorb_qdict(opts, options, &local_err); if (local_err) { error_propagate(errp, local_err); goto out_noclean; } s->readahead_size = qemu_opt_get_size(opts, CURL_BLOCK_OPT_READAHEAD, READ_AHEAD_DEFAULT); if ((s->readahead_size & 0x1ff) != 0) { error_setg(errp, "HTTP_READAHEAD_SIZE %zd is not a multiple of 512", s->readahead_size); goto out_noclean; } s->timeout = qemu_opt_get_number(opts, CURL_BLOCK_OPT_TIMEOUT, CURL_TIMEOUT_DEFAULT); if (s->timeout > CURL_TIMEOUT_MAX) { error_setg(errp, "timeout parameter is too large or negative"); goto out_noclean; } s->sslverify = qemu_opt_get_bool(opts, CURL_BLOCK_OPT_SSLVERIFY, true); cookie = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE); cookie_secret = qemu_opt_get(opts, CURL_BLOCK_OPT_COOKIE_SECRET); if (cookie && cookie_secret) { error_setg(errp, "curl driver cannot handle both cookie and cookie secret"); goto out_noclean; } if (cookie_secret) { s->cookie = qcrypto_secret_lookup_as_utf8(cookie_secret, errp); if (!s->cookie) { goto out_noclean; } } else { s->cookie = g_strdup(cookie); } file = qemu_opt_get(opts, CURL_BLOCK_OPT_URL); if (file == NULL) { error_setg(errp, "curl block driver requires an 'url' option"); goto out_noclean; } if (!strstart(file, bs->drv->protocol_name, &protocol_delimiter) || !strstart(protocol_delimiter, "://", NULL)) { error_setg(errp, "%s curl driver cannot handle the URL '%s' (does not " "start with '%s://')", bs->drv->protocol_name, file, bs->drv->protocol_name); goto out_noclean; } s->username = g_strdup(qemu_opt_get(opts, CURL_BLOCK_OPT_USERNAME)); secretid = qemu_opt_get(opts, CURL_BLOCK_OPT_PASSWORD_SECRET); if (secretid) { s->password = qcrypto_secret_lookup_as_utf8(secretid, errp); if (!s->password) { goto out_noclean; } } s->proxyusername = g_strdup( qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_USERNAME)); secretid = qemu_opt_get(opts, CURL_BLOCK_OPT_PROXY_PASSWORD_SECRET); if (secretid) { s->proxypassword = qcrypto_secret_lookup_as_utf8(secretid, errp); if (!s->proxypassword) { goto out_noclean; } } if (!inited) { curl_global_init(CURL_GLOBAL_ALL); inited = 1; } DPRINTF("CURL: Opening %s\n", file); QSIMPLEQ_INIT(&s->free_state_waitq); s->aio_context = bdrv_get_aio_context(bs); s->url = g_strdup(file); qemu_mutex_lock(&s->mutex); state = curl_find_state(s); qemu_mutex_unlock(&s->mutex); if (!state) { goto out_noclean; } // Get file size if (curl_init_state(s, state) < 0) { goto out; } s->accept_range = false; curl_easy_setopt(state->curl, CURLOPT_NOBODY, 1); curl_easy_setopt(state->curl, CURLOPT_HEADERFUNCTION, curl_header_cb); curl_easy_setopt(state->curl, CURLOPT_HEADERDATA, s); if (curl_easy_perform(state->curl)) goto out; if (curl_easy_getinfo(state->curl, CURLINFO_CONTENT_LENGTH_DOWNLOAD, &d)) { goto out; } /* Prior CURL 7.19.4 return value of 0 could mean that the file size is not * know or the size is zero. From 7.19.4 CURL returns -1 if size is not * known and zero if it is realy zero-length file. */ #if LIBCURL_VERSION_NUM >= 0x071304 if (d < 0) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server didn't report file size."); goto out; } #else if (d <= 0) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Unknown file size or zero-length file."); goto out; } #endif s->len = d; if ((!strncasecmp(s->url, "http://", strlen("http://")) || !strncasecmp(s->url, "https://", strlen("https://"))) && !s->accept_range) { pstrcpy(state->errmsg, CURL_ERROR_SIZE, "Server does not support 'range' (byte ranges)."); goto out; } DPRINTF("CURL: Size = %" PRIu64 "\n", s->len); qemu_mutex_lock(&s->mutex); curl_clean_state(state); qemu_mutex_unlock(&s->mutex); curl_easy_cleanup(state->curl); state->curl = NULL; curl_attach_aio_context(bs, bdrv_get_aio_context(bs)); qemu_opts_del(opts); return 0; out: error_setg(errp, "CURL: Error opening file: %s", state->errmsg); curl_easy_cleanup(state->curl); state->curl = NULL; out_noclean: qemu_mutex_destroy(&s->mutex); g_free(s->cookie); g_free(s->url); qemu_opts_del(opts); return -EINVAL; }
1
523,318
void cancel_delete_all_rows() { deleting_all_rows= false; }
0
423,880
dlz_ssumatch(const char *signer, const char *name, const char *tcpaddr, const char *type, const char *key, uint32_t keydatalen, unsigned char *keydata, void *dbdata) { struct dlz_example_data *state = (struct dlz_example_data *)dbdata; UNUSED(tcpaddr); UNUSED(type); UNUSED(key); UNUSED(keydatalen); UNUSED(keydata); if (strncmp(name, "deny.", 5) == 0) { if (state->log != NULL) state->log(ISC_LOG_INFO, "dlz_example: denying update " "of name=%s by %s", name, signer); return (false); } if (state->log != NULL) state->log(ISC_LOG_INFO, "dlz_example: allowing update of " "name=%s by %s", name, signer); return (true); }
0
207,324
PassRefPtr<Element> Element::create(const QualifiedName& tagName, Document* document) { return adoptRef(new Element(tagName, document, CreateElement)); }
0
475,428
static int sev_guest_init(struct kvm *kvm, struct kvm_sev_cmd *argp) { struct kvm_sev_info *sev = &to_kvm_svm(kvm)->sev_info; int asid, ret; if (kvm->created_vcpus) return -EINVAL; ret = -EBUSY; if (unlikely(sev->active)) return ret; sev->active = true; sev->es_active = argp->id == KVM_SEV_ES_INIT; asid = sev_asid_new(sev); if (asid < 0) goto e_no_asid; sev->asid = asid; ret = sev_platform_init(&argp->error); if (ret) goto e_free; INIT_LIST_HEAD(&sev->regions_list); INIT_LIST_HEAD(&sev->mirror_vms); kvm_set_apicv_inhibit(kvm, APICV_INHIBIT_REASON_SEV); return 0; e_free: sev_asid_free(sev); sev->asid = 0; e_no_asid: sev->es_active = false; sev->active = false; return ret; }
0
309,169
void InspectorOverlay::highlightQuad(PassOwnPtr<FloatQuad> quad, const HighlightConfig& highlightConfig) { m_quadHighlightConfig = highlightConfig; m_highlightQuad = quad; update(); }
0
234,053
void ScreenOrientationDispatcherHost::OnOrientationChange() { if (provider_) provider_->OnOrientationChange(); }
0
439,057
static ImageList *SFDGetImagePNG(FILE *sfd) { int pnglen; ImageList *img; struct enc85 dec = {0}; int i, ch; img = calloc(1,sizeof(ImageList)); dec.pos = -1; dec.sfd = sfd; getint(sfd,&pnglen); getreal(sfd,&img->xoff); getreal(sfd,&img->yoff); getreal(sfd,&img->xscale); getreal(sfd,&img->yscale); while ( (ch=nlgetc(sfd))==' ' || ch=='\t' ) /* skip */; char* pngbuf = malloc(pnglen * sizeof(char)); if (pngbuf == NULL) { IError("Failed to allocate buffer to read PNG in SFD file"); return NULL; } for (i = 0; i<pnglen; ++i) { pngbuf[i] = Dec85(&dec); } img->image = GImageReadPngBuf(pngbuf, pnglen); free(pngbuf); if (img->image == NULL) { IError("Failed to read PNG in SFD file, skipping it."); free(img); return NULL; } img->bb.minx = img->xoff; img->bb.maxy = img->yoff; img->bb.maxx = img->xoff + GImageGetWidth(img->image)*img->xscale; img->bb.miny = img->yoff - GImageGetHeight(img->image)*img->yscale; return img; }
0
240,304
MediaControlPlayButtonElement* MediaControlPlayButtonElement::create( MediaControls& mediaControls) { MediaControlPlayButtonElement* button = new MediaControlPlayButtonElement(mediaControls); button->ensureUserAgentShadowRoot(); button->setType(InputTypeNames::button); button->setShadowPseudoId(AtomicString("-webkit-media-controls-play-button")); return button; }
0
202,603
ofputil_count_port_stats(const struct ofp_header *oh) { struct ofpbuf b = ofpbuf_const_initializer(oh, ntohs(oh->length)); ofpraw_pull_assert(&b); for (size_t n = 0; ; n++) { struct ofputil_port_stats ps; if (ofputil_decode_port_stats(&ps, &b)) { return n; } } }
0
176,335
void DownloadItemImpl::OnContentCheckCompleted( content::DownloadDangerType danger_type) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); DCHECK(AllDataSaved()); SetDangerType(danger_type); }
0
93,617
static void substSelect( SubstContext *pSubst, /* Description of the substitution */ Select *p, /* SELECT statement in which to make substitutions */ int doPrior /* Do substitutes on p->pPrior too */ ){ SrcList *pSrc; struct SrcList_item *pItem; int i; if( !p ) return; do{ substExprList(pSubst, p->pEList); substExprList(pSubst, p->pGroupBy); substExprList(pSubst, p->pOrderBy); p->pHaving = substExpr(pSubst, p->pHaving); p->pWhere = substExpr(pSubst, p->pWhere); pSrc = p->pSrc; assert( pSrc!=0 ); for(i=pSrc->nSrc, pItem=pSrc->a; i>0; i--, pItem++){ substSelect(pSubst, pItem->pSelect, 1); if( pItem->fg.isTabFunc ){ substExprList(pSubst, pItem->u1.pFuncArg); } } }while( doPrior && (p = p->pPrior)!=0 ); }
0
339,349
static void scsi_do_read(void *opaque, int ret) { SCSIDiskReq *r = opaque; SCSIDiskState *s = DO_UPCAST(SCSIDiskState, qdev, r->req.dev); uint32_t n; if (r->req.aiocb != NULL) { r->req.aiocb = NULL; bdrv_acct_done(s->qdev.conf.bs, &r->acct); if (ret < 0) { if (scsi_handle_rw_error(r, -ret)) { goto done; if (r->req.sg) { dma_acct_start(s->qdev.conf.bs, &r->acct, r->req.sg, BDRV_ACCT_READ); r->req.resid -= r->req.sg->size; r->req.aiocb = dma_bdrv_read(s->qdev.conf.bs, r->req.sg, r->sector, scsi_dma_complete, r); } else { n = scsi_init_iovec(r, SCSI_DMA_BUF_SIZE); bdrv_acct_start(s->qdev.conf.bs, &r->acct, n * BDRV_SECTOR_SIZE, BDRV_ACCT_READ); r->req.aiocb = bdrv_aio_readv(s->qdev.conf.bs, r->sector, &r->qiov, n, scsi_read_complete, r); done: if (!r->req.io_canceled) { scsi_req_unref(&r->req);
1
140,348
} void free_last_set(REP_SETS *sets) { sets->count--; sets->extra++;
0
7,591
void Context::onDone() { if (wasm_->onDone_) { wasm_->onDone_(this, id_); } }
1
508,037
int ssl3_send_client_key_exchange(SSL *s) { unsigned char *p, *d; int n; unsigned long alg_k; #ifndef OPENSSL_NO_RSA unsigned char *q; EVP_PKEY *pkey = NULL; #endif #ifndef OPENSSL_NO_KRB5 KSSL_ERR kssl_err; #endif /* OPENSSL_NO_KRB5 */ #ifndef OPENSSL_NO_ECDH EC_KEY *clnt_ecdh = NULL; const EC_POINT *srvr_ecpoint = NULL; EVP_PKEY *srvr_pub_pkey = NULL; unsigned char *encodedPoint = NULL; int encoded_pt_len = 0; BN_CTX *bn_ctx = NULL; #endif if (s->state == SSL3_ST_CW_KEY_EXCH_A) { d = (unsigned char *)s->init_buf->data; p = &(d[4]); alg_k = s->s3->tmp.new_cipher->algorithm_mkey; /* Fool emacs indentation */ if (0) { } #ifndef OPENSSL_NO_RSA else if (alg_k & SSL_kRSA) { RSA *rsa; unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH]; if (s->session->sess_cert == NULL) { /* * We should always have a server certificate with SSL_kRSA. */ SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } if (s->session->sess_cert->peer_rsa_tmp != NULL) rsa = s->session->sess_cert->peer_rsa_tmp; else { pkey = X509_get_pubkey(s->session-> sess_cert->peer_pkeys[SSL_PKEY_RSA_ENC]. x509); if ((pkey == NULL) || (pkey->type != EVP_PKEY_RSA) || (pkey->pkey.rsa == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); EVP_PKEY_free(pkey); goto err; } rsa = pkey->pkey.rsa; EVP_PKEY_free(pkey); } tmp_buf[0] = s->client_version >> 8; tmp_buf[1] = s->client_version & 0xff; if (RAND_bytes(&(tmp_buf[2]), sizeof tmp_buf - 2) <= 0) goto err; s->session->master_key_length = sizeof tmp_buf; q = p; /* Fix buf for TLS and beyond */ if (s->version > SSL3_VERSION) p += 2; n = RSA_public_encrypt(sizeof tmp_buf, tmp_buf, p, rsa, RSA_PKCS1_PADDING); # ifdef PKCS1_CHECK if (s->options & SSL_OP_PKCS1_CHECK_1) p[1]++; if (s->options & SSL_OP_PKCS1_CHECK_2) tmp_buf[0] = 0x70; # endif if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_BAD_RSA_ENCRYPT); goto err; } /* Fix buf for TLS and beyond */ if (s->version > SSL3_VERSION) { s2n(n, q); n += 2; } s->session->master_key_length = s->method->ssl3_enc->generate_master_secret(s, s-> session->master_key, tmp_buf, sizeof tmp_buf); OPENSSL_cleanse(tmp_buf, sizeof tmp_buf); } #endif #ifndef OPENSSL_NO_KRB5 else if (alg_k & SSL_kKRB5) { krb5_error_code krb5rc; KSSL_CTX *kssl_ctx = s->kssl_ctx; /* krb5_data krb5_ap_req; */ krb5_data *enc_ticket; krb5_data authenticator, *authp = NULL; EVP_CIPHER_CTX ciph_ctx; const EVP_CIPHER *enc = NULL; unsigned char iv[EVP_MAX_IV_LENGTH]; unsigned char tmp_buf[SSL_MAX_MASTER_KEY_LENGTH]; unsigned char epms[SSL_MAX_MASTER_KEY_LENGTH + EVP_MAX_IV_LENGTH]; int padl, outl = sizeof(epms); EVP_CIPHER_CTX_init(&ciph_ctx); # ifdef KSSL_DEBUG fprintf(stderr, "ssl3_send_client_key_exchange(%lx & %lx)\n", alg_k, SSL_kKRB5); # endif /* KSSL_DEBUG */ authp = NULL; # ifdef KRB5SENDAUTH if (KRB5SENDAUTH) authp = &authenticator; # endif /* KRB5SENDAUTH */ krb5rc = kssl_cget_tkt(kssl_ctx, &enc_ticket, authp, &kssl_err); enc = kssl_map_enc(kssl_ctx->enctype); if (enc == NULL) goto err; # ifdef KSSL_DEBUG { fprintf(stderr, "kssl_cget_tkt rtn %d\n", krb5rc); if (krb5rc && kssl_err.text) fprintf(stderr, "kssl_cget_tkt kssl_err=%s\n", kssl_err.text); } # endif /* KSSL_DEBUG */ if (krb5rc) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, kssl_err.reason); goto err; } /*- * 20010406 VRS - Earlier versions used KRB5 AP_REQ * in place of RFC 2712 KerberosWrapper, as in: * * Send ticket (copy to *p, set n = length) * n = krb5_ap_req.length; * memcpy(p, krb5_ap_req.data, krb5_ap_req.length); * if (krb5_ap_req.data) * kssl_krb5_free_data_contents(NULL,&krb5_ap_req); * * Now using real RFC 2712 KerberosWrapper * (Thanks to Simon Wilkinson <sxw@sxw.org.uk>) * Note: 2712 "opaque" types are here replaced * with a 2-byte length followed by the value. * Example: * KerberosWrapper= xx xx asn1ticket 0 0 xx xx encpms * Where "xx xx" = length bytes. Shown here with * optional authenticator omitted. */ /* KerberosWrapper.Ticket */ s2n(enc_ticket->length, p); memcpy(p, enc_ticket->data, enc_ticket->length); p += enc_ticket->length; n = enc_ticket->length + 2; /* KerberosWrapper.Authenticator */ if (authp && authp->length) { s2n(authp->length, p); memcpy(p, authp->data, authp->length); p += authp->length; n += authp->length + 2; free(authp->data); authp->data = NULL; authp->length = 0; } else { s2n(0, p); /* null authenticator length */ n += 2; } tmp_buf[0] = s->client_version >> 8; tmp_buf[1] = s->client_version & 0xff; if (RAND_bytes(&(tmp_buf[2]), sizeof tmp_buf - 2) <= 0) goto err; /*- * 20010420 VRS. Tried it this way; failed. * EVP_EncryptInit_ex(&ciph_ctx,enc, NULL,NULL); * EVP_CIPHER_CTX_set_key_length(&ciph_ctx, * kssl_ctx->length); * EVP_EncryptInit_ex(&ciph_ctx,NULL, key,iv); */ memset(iv, 0, sizeof iv); /* per RFC 1510 */ EVP_EncryptInit_ex(&ciph_ctx, enc, NULL, kssl_ctx->key, iv); EVP_EncryptUpdate(&ciph_ctx, epms, &outl, tmp_buf, sizeof tmp_buf); EVP_EncryptFinal_ex(&ciph_ctx, &(epms[outl]), &padl); outl += padl; if (outl > (int)sizeof epms) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } EVP_CIPHER_CTX_cleanup(&ciph_ctx); /* KerberosWrapper.EncryptedPreMasterSecret */ s2n(outl, p); memcpy(p, epms, outl); p += outl; n += outl + 2; s->session->master_key_length = s->method->ssl3_enc->generate_master_secret(s, s-> session->master_key, tmp_buf, sizeof tmp_buf); OPENSSL_cleanse(tmp_buf, sizeof tmp_buf); OPENSSL_cleanse(epms, outl); } #endif #ifndef OPENSSL_NO_DH else if (alg_k & (SSL_kEDH | SSL_kDHr | SSL_kDHd)) { DH *dh_srvr, *dh_clnt; if (s->session->sess_cert == NULL) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_UNEXPECTED_MESSAGE); goto err; } if (s->session->sess_cert->peer_dh_tmp != NULL) dh_srvr = s->session->sess_cert->peer_dh_tmp; else { /* we get them from the cert */ ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_UNABLE_TO_FIND_DH_PARAMETERS); goto err; } /* generate a new random key */ if ((dh_clnt = DHparams_dup(dh_srvr)) == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_DH_LIB); goto err; } if (!DH_generate_key(dh_clnt)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_DH_LIB); DH_free(dh_clnt); goto err; } /* * use the 'p' output buffer for the DH key, but make sure to * clear it out afterwards */ n = DH_compute_key(p, dh_srvr->pub_key, dh_clnt); if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_DH_LIB); DH_free(dh_clnt); goto err; } /* generate master key from the result */ s->session->master_key_length = s->method->ssl3_enc->generate_master_secret(s, s-> session->master_key, p, n); /* clean up */ memset(p, 0, n); /* send off the data */ n = BN_num_bytes(dh_clnt->pub_key); s2n(n, p); BN_bn2bin(dh_clnt->pub_key, p); n += 2; DH_free(dh_clnt); } #endif #ifndef OPENSSL_NO_ECDH else if (alg_k & (SSL_kEECDH | SSL_kECDHr | SSL_kECDHe)) { const EC_GROUP *srvr_group = NULL; EC_KEY *tkey; int ecdh_clnt_cert = 0; int field_size = 0; if (s->session->sess_cert == NULL) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_UNEXPECTED_MESSAGE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_UNEXPECTED_MESSAGE); goto err; } /* * Did we send out the client's ECDH share for use in premaster * computation as part of client certificate? If so, set * ecdh_clnt_cert to 1. */ if ((alg_k & (SSL_kECDHr | SSL_kECDHe)) && (s->cert != NULL)) { /*- * XXX: For now, we do not support client * authentication using ECDH certificates. * To add such support, one needs to add * code that checks for appropriate * conditions and sets ecdh_clnt_cert to 1. * For example, the cert have an ECC * key on the same curve as the server's * and the key should be authorized for * key agreement. * * One also needs to add code in ssl3_connect * to skip sending the certificate verify * message. * * if ((s->cert->key->privatekey != NULL) && * (s->cert->key->privatekey->type == * EVP_PKEY_EC) && ...) * ecdh_clnt_cert = 1; */ } if (s->session->sess_cert->peer_ecdh_tmp != NULL) { tkey = s->session->sess_cert->peer_ecdh_tmp; } else { /* Get the Server Public Key from Cert */ srvr_pub_pkey = X509_get_pubkey(s->session-> sess_cert->peer_pkeys[SSL_PKEY_ECC].x509); if ((srvr_pub_pkey == NULL) || (srvr_pub_pkey->type != EVP_PKEY_EC) || (srvr_pub_pkey->pkey.ec == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } tkey = srvr_pub_pkey->pkey.ec; } srvr_group = EC_KEY_get0_group(tkey); srvr_ecpoint = EC_KEY_get0_public_key(tkey); if ((srvr_group == NULL) || (srvr_ecpoint == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } if ((clnt_ecdh = EC_KEY_new()) == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } if (!EC_KEY_set_group(clnt_ecdh, srvr_group)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_EC_LIB); goto err; } if (ecdh_clnt_cert) { /* * Reuse key info from our certificate We only need our * private key to perform the ECDH computation. */ const BIGNUM *priv_key; tkey = s->cert->key->privatekey->pkey.ec; priv_key = EC_KEY_get0_private_key(tkey); if (priv_key == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } if (!EC_KEY_set_private_key(clnt_ecdh, priv_key)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_EC_LIB); goto err; } } else { /* Generate a new ECDH key pair */ if (!(EC_KEY_generate_key(clnt_ecdh))) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } } /* * use the 'p' output buffer for the ECDH key, but make sure to * clear it out afterwards */ field_size = EC_GROUP_get_degree(srvr_group); if (field_size <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } n = ECDH_compute_key(p, (field_size + 7) / 8, srvr_ecpoint, clnt_ecdh, NULL); if (n <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_ECDH_LIB); goto err; } /* generate master key from the result */ s->session->master_key_length = s->method->ssl3_enc->generate_master_secret(s, s-> session->master_key, p, n); memset(p, 0, n); /* clean up */ if (ecdh_clnt_cert) { /* Send empty client key exch message */ n = 0; } else { /* * First check the size of encoding and allocate memory * accordingly. */ encoded_pt_len = EC_POINT_point2oct(srvr_group, EC_KEY_get0_public_key(clnt_ecdh), POINT_CONVERSION_UNCOMPRESSED, NULL, 0, NULL); encodedPoint = (unsigned char *) OPENSSL_malloc(encoded_pt_len * sizeof(unsigned char)); bn_ctx = BN_CTX_new(); if ((encodedPoint == NULL) || (bn_ctx == NULL)) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } /* Encode the public key */ n = EC_POINT_point2oct(srvr_group, EC_KEY_get0_public_key(clnt_ecdh), POINT_CONVERSION_UNCOMPRESSED, encodedPoint, encoded_pt_len, bn_ctx); *p = n; /* length of encoded point */ /* Encoded point will be copied here */ p += 1; /* copy the point */ memcpy((unsigned char *)p, encodedPoint, n); /* increment n to account for length field */ n += 1; } /* Free allocated memory */ BN_CTX_free(bn_ctx); if (encodedPoint != NULL) OPENSSL_free(encodedPoint); if (clnt_ecdh != NULL) EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); } #endif /* !OPENSSL_NO_ECDH */ else if (alg_k & SSL_kGOST) { /* GOST key exchange message creation */ EVP_PKEY_CTX *pkey_ctx; X509 *peer_cert; size_t msglen; unsigned int md_len; int keytype; unsigned char premaster_secret[32], shared_ukm[32], tmp[256]; EVP_MD_CTX *ukm_hash; EVP_PKEY *pub_key; /* * Get server sertificate PKEY and create ctx from it */ peer_cert = s->session-> sess_cert->peer_pkeys[(keytype = SSL_PKEY_GOST01)].x509; if (!peer_cert) peer_cert = s->session-> sess_cert->peer_pkeys[(keytype = SSL_PKEY_GOST94)].x509; if (!peer_cert) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_NO_GOST_CERTIFICATE_SENT_BY_PEER); goto err; } pkey_ctx = EVP_PKEY_CTX_new(pub_key = X509_get_pubkey(peer_cert), NULL); if (pkey_ctx == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } /* * If we have send a certificate, and certificate key * * * parameters match those of server certificate, use * certificate key for key exchange */ /* Otherwise, generate ephemeral key pair */ if (pkey_ctx == NULL || EVP_PKEY_encrypt_init(pkey_ctx) <= 0 /* Generate session key */ || RAND_bytes(premaster_secret, 32) <= 0) { EVP_PKEY_CTX_free(pkey_ctx); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } /* * Compute shared IV and store it in algorithm-specific context * data */ ukm_hash = EVP_MD_CTX_create(); if (EVP_DigestInit(ukm_hash, EVP_get_digestbynid(NID_id_GostR3411_94)) <= 0 || EVP_DigestUpdate(ukm_hash, s->s3->client_random, SSL3_RANDOM_SIZE) <= 0 || EVP_DigestUpdate(ukm_hash, s->s3->server_random, SSL3_RANDOM_SIZE) <= 0 || EVP_DigestFinal_ex(ukm_hash, shared_ukm, &md_len) <= 0) { EVP_MD_CTX_destroy(ukm_hash); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } EVP_MD_CTX_destroy(ukm_hash); if (EVP_PKEY_CTX_ctrl (pkey_ctx, -1, EVP_PKEY_OP_ENCRYPT, EVP_PKEY_CTRL_SET_IV, 8, shared_ukm) < 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_LIBRARY_BUG); goto err; } /* Make GOST keytransport blob message */ /* * Encapsulate it into sequence */ *(p++) = V_ASN1_SEQUENCE | V_ASN1_CONSTRUCTED; msglen = 255; if (EVP_PKEY_encrypt(pkey_ctx, tmp, &msglen, premaster_secret, 32) <= 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_LIBRARY_BUG); goto err; } if (msglen >= 0x80) { *(p++) = 0x81; *(p++) = msglen & 0xff; n = msglen + 3; } else { *(p++) = msglen & 0xff; n = msglen + 2; } memcpy(p, tmp, msglen); EVP_PKEY_CTX_free(pkey_ctx); s->session->master_key_length = s->method->ssl3_enc->generate_master_secret(s, s-> session->master_key, premaster_secret, 32); EVP_PKEY_free(pub_key); } #ifndef OPENSSL_NO_SRP else if (alg_k & SSL_kSRP) { if (s->srp_ctx.A != NULL) { /* send off the data */ n = BN_num_bytes(s->srp_ctx.A); s2n(n, p); BN_bn2bin(s->srp_ctx.A, p); n += 2; } else { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } if (s->session->srp_username != NULL) OPENSSL_free(s->session->srp_username); s->session->srp_username = BUF_strdup(s->srp_ctx.login); if (s->session->srp_username == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto err; } if ((s->session->master_key_length = SRP_generate_client_master_secret(s, s->session->master_key)) < 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } } #endif #ifndef OPENSSL_NO_PSK else if (alg_k & SSL_kPSK) { /* * The callback needs PSK_MAX_IDENTITY_LEN + 1 bytes to return a * \0-terminated identity. The last byte is for us for simulating * strnlen. */ char identity[PSK_MAX_IDENTITY_LEN + 2]; size_t identity_len; unsigned char *t = NULL; unsigned char psk_or_pre_ms[PSK_MAX_PSK_LEN * 2 + 4]; unsigned int pre_ms_len = 0, psk_len = 0; int psk_err = 1; n = 0; if (s->psk_client_callback == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_PSK_NO_CLIENT_CB); goto err; } memset(identity, 0, sizeof(identity)); psk_len = s->psk_client_callback(s, s->session->psk_identity_hint, identity, sizeof(identity) - 1, psk_or_pre_ms, sizeof(psk_or_pre_ms)); if (psk_len > PSK_MAX_PSK_LEN) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto psk_err; } else if (psk_len == 0) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, SSL_R_PSK_IDENTITY_NOT_FOUND); goto psk_err; } identity[PSK_MAX_IDENTITY_LEN + 1] = '\0'; identity_len = strlen(identity); if (identity_len > PSK_MAX_IDENTITY_LEN) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto psk_err; } /* create PSK pre_master_secret */ pre_ms_len = 2 + psk_len + 2 + psk_len; t = psk_or_pre_ms; memmove(psk_or_pre_ms + psk_len + 4, psk_or_pre_ms, psk_len); s2n(psk_len, t); memset(t, 0, psk_len); t += psk_len; s2n(psk_len, t); if (s->session->psk_identity_hint != NULL) OPENSSL_free(s->session->psk_identity_hint); s->session->psk_identity_hint = BUF_strdup(s->ctx->psk_identity_hint); if (s->ctx->psk_identity_hint != NULL && s->session->psk_identity_hint == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto psk_err; } if (s->session->psk_identity != NULL) OPENSSL_free(s->session->psk_identity); s->session->psk_identity = BUF_strdup(identity); if (s->session->psk_identity == NULL) { SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_MALLOC_FAILURE); goto psk_err; } s->session->master_key_length = s->method->ssl3_enc->generate_master_secret(s, s-> session->master_key, psk_or_pre_ms, pre_ms_len); s2n(identity_len, p); memcpy(p, identity, identity_len); n = 2 + identity_len; psk_err = 0; psk_err: OPENSSL_cleanse(identity, sizeof(identity)); OPENSSL_cleanse(psk_or_pre_ms, sizeof(psk_or_pre_ms)); if (psk_err != 0) { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); goto err; } } #endif else { ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_HANDSHAKE_FAILURE); SSLerr(SSL_F_SSL3_SEND_CLIENT_KEY_EXCHANGE, ERR_R_INTERNAL_ERROR); goto err; } *(d++) = SSL3_MT_CLIENT_KEY_EXCHANGE; l2n3(n, d); s->state = SSL3_ST_CW_KEY_EXCH_B; /* number of bytes to write */ s->init_num = n + 4; s->init_off = 0; } /* SSL3_ST_CW_KEY_EXCH_B */ return (ssl3_do_write(s, SSL3_RT_HANDSHAKE)); err: #ifndef OPENSSL_NO_ECDH BN_CTX_free(bn_ctx); if (encodedPoint != NULL) OPENSSL_free(encodedPoint); if (clnt_ecdh != NULL) EC_KEY_free(clnt_ecdh); EVP_PKEY_free(srvr_pub_pkey); #endif s->state = SSL_ST_ERR; return (-1); }
0
449,817
static void pp_error_list_macros(errflags severity) { const MMacro *m; severity |= ERR_PP_LISTMACRO | ERR_NO_SEVERITY | ERR_HERE; while ((m = src_error_down())) { if ((m->nolist & NL_LIST) || !m->where.filename) break; nasm_error(severity, "... from macro `%s' defined", m->name); } src_error_reset(); }
0
362,110
event_help( RenderState state ) { ADisplay display = (ADisplay)state->display.disp; grEvent dummy_event; adisplay_clear( display ); grGotoxy( 0, 0 ); grSetMargin( 2, 1 ); grGotobitmap( display->bitmap ); grWriteln( "Text Viewer - Simple text/font proofer for the FreeType project" ); grLn(); grWriteln( "This program is used to display text using two distinct algorithms." ); grWriteln( "On the left, text is rendered by the TrueType bytecode interpreter." ); grWriteln( "In the middle, text is rendered through the FreeType auto-hinter." ); grWriteln( "On the right, text is rendered unhinted." ); grLn(); grWriteln( "Use the following keys:" ); grLn(); grWriteln( " F1, ? display this help screen" ); grLn(); grWriteln( " n, p select previous/next font" ); grLn(); grWriteln( " 1, 2, 3 select left, middle, or right column" ); grWriteln( " a toggle `ignore global advance width flag'" ); grWriteln( " d toggle lsb/rsb deltas" ); grWriteln( " h toggle hinting mode" ); grWriteln( " k toggle kerning" ); grWriteln( " g, v adjust gamma value" ); grWriteln( " r toggle rendering mode" ); grLn(); grWriteln( " l change LCD filter type" ); grWriteln( " [, ] select custom LCD filter weight" ); grWriteln( " -, +(=) adjust selected custom LCD filter weight"); grLn(); grWriteln( " Up, Down adjust pointsize by 0.5 unit" ); grWriteln( " PgUp, PgDn adjust pointsize by 5 units" ); grLn(); grWriteln( "press any key to exit this help screen" ); grRefreshSurface( display->surface ); grListenSurface( display->surface, gr_event_key, &dummy_event ); }
0
43,060
hfs_attr_walk_compressed_rsrc(const TSK_FS_ATTR * fs_attr, int flags, TSK_FS_FILE_WALK_CB a_action, void *ptr, int (*read_block_table)(const TSK_FS_ATTR *rAttr, CMP_OFFSET_ENTRY** offsetTableOut, uint32_t* tableSizeOut, uint32_t* tableOffsetOut), int (*decompress_block)(char* rawBuf, uint32_t len, char* uncBuf, uint64_t* uncLen)) { TSK_FS_INFO *fs; TSK_FS_FILE *fs_file; const TSK_FS_ATTR *rAttr; // resource fork attribute char *rawBuf = NULL; // compressed data char *uncBuf = NULL; // uncompressed data uint32_t offsetTableOffset; uint32_t offsetTableSize; // The number of table entries CMP_OFFSET_ENTRY *offsetTable = NULL; size_t indx; // index for looping over the offset table TSK_OFF_T off = 0; // the offset in the uncompressed data stream consumed thus far if (tsk_verbose) tsk_fprintf(stderr, "%s: Entered, because this is a compressed file with compressed data in the resource fork\n", __func__); // clean up any error messages that are lying around tsk_error_reset(); if ((fs_attr == NULL) || (fs_attr->fs_file == NULL) || (fs_attr->fs_file->meta == NULL) || (fs_attr->fs_file->fs_info == NULL)) { tsk_error_set_errno(TSK_ERR_FS_ARG); tsk_error_set_errstr("%s: Null arguments given\n", __func__); return 1; } // Check that the ATTR being read is the main DATA resource, 128-0, // because this is the only one that can be compressed in HFS+ if ((fs_attr->id != HFS_FS_ATTR_ID_DATA) || (fs_attr->type != TSK_FS_ATTR_TYPE_HFS_DATA)) { error_detected(TSK_ERR_FS_ARG, "%s: arg specified an attribute %u-%u that is not the data fork, " "Only the data fork can be compressed.", __func__, fs_attr->type, fs_attr->id); return 1; } /* This MUST be a compressed attribute */ if (!(fs_attr->flags & TSK_FS_ATTR_COMP)) { error_detected(TSK_ERR_FS_FWALK, "%s: called with non-special attribute: %x", __func__, fs_attr->flags); return 1; } fs = fs_attr->fs_file->fs_info; fs_file = fs_attr->fs_file; /******** Open the Resource Fork ***********/ // find the attribute for the resource fork rAttr = tsk_fs_file_attr_get_type(fs_file, TSK_FS_ATTR_TYPE_HFS_RSRC, HFS_FS_ATTR_ID_RSRC, TRUE); if (rAttr == NULL) { error_returned (" %s: could not get the attribute for the resource fork of the file", __func__); return 1; } // read the offset table from the fork header if (!read_block_table(rAttr, &offsetTable, &offsetTableSize, &offsetTableOffset)) { return 1; } // Allocate two buffers for the raw and uncompressed data /* Raw data can be COMPRESSION_UNIT_SIZE+1 if the data is not * compressed and there is a 1-byte flag that indicates that * the data is not compressed. */ rawBuf = (char *) tsk_malloc(COMPRESSION_UNIT_SIZE + 1); if (rawBuf == NULL) { error_returned (" %s: buffers for reading and uncompressing", __func__); goto on_error; } uncBuf = (char *) tsk_malloc(COMPRESSION_UNIT_SIZE); if (uncBuf == NULL) { error_returned (" %s: buffers for reading and uncompressing", __func__); goto on_error; } // FOR entry in the table DO for (indx = 0; indx < offsetTableSize; ++indx) { ssize_t uncLen; // uncompressed length unsigned int blockSize; uint64_t lumpSize; uint64_t remaining; char *lumpStart; switch ((uncLen = read_and_decompress_block( rAttr, rawBuf, uncBuf, offsetTable, offsetTableSize, offsetTableOffset, indx, decompress_block))) { case -1: goto on_error; case 0: continue; default: break; } // Call the a_action callback with "Lumps" // that are at most the block size. blockSize = fs->block_size; remaining = uncLen; lumpStart = uncBuf; while (remaining > 0) { int retval; // action return value lumpSize = remaining <= blockSize ? remaining : blockSize; // Apply the callback function if (tsk_verbose) tsk_fprintf(stderr, "%s: Calling action on lump of size %" PRIu64 " offset %" PRIu64 " in the compression unit\n", __func__, lumpSize, uncLen - remaining); if (lumpSize > SIZE_MAX) { error_detected(TSK_ERR_FS_FWALK, " %s: lumpSize is too large for the action", __func__); goto on_error; } retval = a_action(fs_attr->fs_file, off, 0, lumpStart, (size_t) lumpSize, // cast OK because of above test TSK_FS_BLOCK_FLAG_COMP, ptr); if (retval == TSK_WALK_ERROR) { error_detected(TSK_ERR_FS | 201, "%s: callback returned an error", __func__); goto on_error; } else if (retval == TSK_WALK_STOP) { break; } // Find the next lump off += lumpSize; remaining -= lumpSize; lumpStart += lumpSize; } } // Done, so free up the allocated resources. free(offsetTable); free(rawBuf); free(uncBuf); return 0; on_error: free(offsetTable); free(rawBuf); free(uncBuf); return 0; }
0
385,037
static void curl_free_string(void **string) { efree(*string); }
0
176,858
void InitializeSpdySsl() { ssl_data_->SetNextProto(kProtoSPDY3); }
0
386,199
xsltFreeStylePreComp(xsltStylePreCompPtr comp) { if (comp == NULL) return; #ifdef XSLT_REFACTORED /* * URGENT TODO: Implement destructors. */ switch (comp->type) { case XSLT_FUNC_LITERAL_RESULT_ELEMENT: break; case XSLT_FUNC_COPY: break; case XSLT_FUNC_SORT: { xsltStyleItemSortPtr item = (xsltStyleItemSortPtr) comp; if (item->locale != (xsltLocale)0) xsltFreeLocale(item->locale); if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_TEXT: break; case XSLT_FUNC_ELEMENT: break; case XSLT_FUNC_ATTRIBUTE: break; case XSLT_FUNC_COMMENT: break; case XSLT_FUNC_PI: break; case XSLT_FUNC_COPYOF: { xsltStyleItemCopyOfPtr item = (xsltStyleItemCopyOfPtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_VALUEOF: { xsltStyleItemValueOfPtr item = (xsltStyleItemValueOfPtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_NUMBER: { xsltStyleItemNumberPtr item = (xsltStyleItemNumberPtr) comp; if (item->numdata.countPat != NULL) xsltFreeCompMatchList(item->numdata.countPat); if (item->numdata.fromPat != NULL) xsltFreeCompMatchList(item->numdata.fromPat); } break; case XSLT_FUNC_APPLYIMPORTS: break; case XSLT_FUNC_CALLTEMPLATE: break; case XSLT_FUNC_APPLYTEMPLATES: { xsltStyleItemApplyTemplatesPtr item = (xsltStyleItemApplyTemplatesPtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_CHOOSE: break; case XSLT_FUNC_IF: { xsltStyleItemIfPtr item = (xsltStyleItemIfPtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_FOREACH: { xsltStyleItemForEachPtr item = (xsltStyleItemForEachPtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_DOCUMENT: break; case XSLT_FUNC_WITHPARAM: { xsltStyleItemWithParamPtr item = (xsltStyleItemWithParamPtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_PARAM: { xsltStyleItemParamPtr item = (xsltStyleItemParamPtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_VARIABLE: { xsltStyleItemVariablePtr item = (xsltStyleItemVariablePtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_WHEN: { xsltStyleItemWhenPtr item = (xsltStyleItemWhenPtr) comp; if (item->comp != NULL) xmlXPathFreeCompExpr(item->comp); } break; case XSLT_FUNC_OTHERWISE: case XSLT_FUNC_FALLBACK: case XSLT_FUNC_MESSAGE: case XSLT_FUNC_INCLUDE: case XSLT_FUNC_ATTRSET: break; default: /* TODO: Raise error. */ break; } #else if (comp->locale != (xsltLocale)0) xsltFreeLocale(comp->locale); if (comp->comp != NULL) xmlXPathFreeCompExpr(comp->comp); if (comp->numdata.countPat != NULL) xsltFreeCompMatchList(comp->numdata.countPat); if (comp->numdata.fromPat != NULL) xsltFreeCompMatchList(comp->numdata.fromPat); if (comp->nsList != NULL) xmlFree(comp->nsList); #endif xmlFree(comp); }
0
365,515
static int proc_fd_info(struct inode *inode, struct path *path, char *info) { struct task_struct *task = get_proc_task(inode); struct files_struct *files = NULL; struct file *file; int fd = proc_fd(inode); if (task) { files = get_files_struct(task); put_task_struct(task); } if (files) { /* * We are not taking a ref to the file structure, so we must * hold ->file_lock. */ spin_lock(&files->file_lock); file = fcheck_files(files, fd); if (file) { unsigned int f_flags; struct fdtable *fdt; fdt = files_fdtable(files); f_flags = file->f_flags & ~O_CLOEXEC; if (FD_ISSET(fd, fdt->close_on_exec)) f_flags |= O_CLOEXEC; if (path) { *path = file->f_path; path_get(&file->f_path); } if (info) snprintf(info, PROC_FDINFO_MAX, "pos:\t%lli\n" "flags:\t0%o\n", (long long) file->f_pos, f_flags); spin_unlock(&files->file_lock); put_files_struct(files); return 0; } spin_unlock(&files->file_lock); put_files_struct(files); } return -ENOENT; }
0
185,586
SYSCALL_DEFINE1(olduname, struct oldold_utsname __user *, name) { int error; if (!name) return -EFAULT; if (!access_ok(VERIFY_WRITE, name, sizeof(struct oldold_utsname))) return -EFAULT; down_read(&uts_sem); error = __copy_to_user(&name->sysname, &utsname()->sysname, __OLD_UTS_LEN); error |= __put_user(0, name->sysname + __OLD_UTS_LEN); error |= __copy_to_user(&name->nodename, &utsname()->nodename, __OLD_UTS_LEN); error |= __put_user(0, name->nodename + __OLD_UTS_LEN); error |= __copy_to_user(&name->release, &utsname()->release, __OLD_UTS_LEN); error |= __put_user(0, name->release + __OLD_UTS_LEN); error |= __copy_to_user(&name->version, &utsname()->version, __OLD_UTS_LEN); error |= __put_user(0, name->version + __OLD_UTS_LEN); error |= __copy_to_user(&name->machine, &utsname()->machine, __OLD_UTS_LEN); error |= __put_user(0, name->machine + __OLD_UTS_LEN); up_read(&uts_sem); if (!error && override_architecture(name)) error = -EFAULT; if (!error && override_release(name->release, sizeof(name->release))) error = -EFAULT; return error ? -EFAULT : 0; }
0
390,178
const char* SSL_get_cipher_list(SSL* ssl, int priority) { if (priority < 0 || priority >= MAX_CIPHERS) return 0; if (ssl->getSecurity().get_parms().cipher_list_[priority][0]) return ssl->getSecurity().get_parms().cipher_list_[priority]; return 0; }
0
188,087
virtual void TearDown() { delete[] modified_buf_; }
0
104,924
static void show_object(struct object *obj, const char *name, void *data) { add_preferred_base_object(name); add_object_entry(obj->oid.hash, obj->type, name, 0); obj->flags |= OBJECT_ADDED; }
0
297,709
exif_mnote_data_pentax_count (ExifMnoteData *n) { return n ? ((ExifMnoteDataPentax *) n)->count : 0; }
0
370,167
static inline void sctp_outq_tail_data(struct sctp_outq *q, struct sctp_chunk *ch) { list_add_tail(&ch->list, &q->out_chunk_list); q->out_qlen += ch->skb->len; }
0
170,127
void ResourceFetcher::MakePreloadedResourceBlockOnloadIfNeeded( Resource* resource, const FetchRequest& request) { if (resource && resource->Loader() && resource->IsLoadEventBlockingResourceType() && resource->IsLinkPreload() && !request.IsLinkPreload() && non_blocking_loaders_.Contains(resource->Loader())) { non_blocking_loaders_.erase(resource->Loader()); loaders_.insert(resource->Loader()); } }
0
69,767
static void vmx_disable_shadow_vmcs(struct vcpu_vmx *vmx) { vmcs_clear_bits(SECONDARY_VM_EXEC_CONTROL, SECONDARY_EXEC_SHADOW_VMCS); vmcs_write64(VMCS_LINK_POINTER, -1ull); }
0
43,590
getcmdline_int( int firstc, long count UNUSED, // only used for incremental search int indent, // indent for inside conditionals int clear_ccline) // clear ccline first { static int depth = 0; // call depth int c; int i; int j; int gotesc = FALSE; // TRUE when <ESC> just typed int do_abbr; // when TRUE check for abbr. char_u *lookfor = NULL; // string to match int hiscnt; // current history line in use int histype; // history type to be used #ifdef FEAT_SEARCH_EXTRA incsearch_state_T is_state; #endif int did_wild_list = FALSE; // did wild_list() recently int wim_index = 0; // index in wim_flags[] int res; int save_msg_scroll = msg_scroll; int save_State = State; // remember State when called int some_key_typed = FALSE; // one of the keys was typed // mouse drag and release events are ignored, unless they are // preceded with a mouse down event int ignore_drag_release = TRUE; #ifdef FEAT_EVAL int break_ctrl_c = FALSE; #endif expand_T xpc; long *b_im_ptr = NULL; cmdline_info_T save_ccline; int did_save_ccline = FALSE; int cmdline_type; int wild_type; // one recursion level deeper ++depth; if (ccline.cmdbuff != NULL) { // Being called recursively. Since ccline is global, we need to save // the current buffer and restore it when returning. save_cmdline(&save_ccline); did_save_ccline = TRUE; } if (clear_ccline) CLEAR_FIELD(ccline); #ifdef FEAT_EVAL if (firstc == -1) { firstc = NUL; break_ctrl_c = TRUE; } #endif #ifdef FEAT_RIGHTLEFT // start without Hebrew mapping for a command line if (firstc == ':' || firstc == '=' || firstc == '>') cmd_hkmap = 0; #endif #ifdef FEAT_SEARCH_EXTRA init_incsearch_state(&is_state); #endif if (init_ccline(firstc, indent) != OK) goto theend; // out of memory if (depth == 50) { // Somehow got into a loop recursively calling getcmdline(), bail out. emsg(_(e_command_too_recursive)); goto theend; } ExpandInit(&xpc); ccline.xpc = &xpc; #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl && *curwin->w_p_rlc == 's' && (firstc == '/' || firstc == '?')) cmdmsg_rl = TRUE; else cmdmsg_rl = FALSE; #endif redir_off = TRUE; // don't redirect the typed command if (!cmd_silent) { i = msg_scrolled; msg_scrolled = 0; // avoid wait_return message gotocmdline(TRUE); msg_scrolled += i; redrawcmdprompt(); // draw prompt or indent set_cmdspos(); } xpc.xp_context = EXPAND_NOTHING; xpc.xp_backslash = XP_BS_NONE; #ifndef BACKSLASH_IN_FILENAME xpc.xp_shell = FALSE; #endif #if defined(FEAT_EVAL) if (ccline.input_fn) { xpc.xp_context = ccline.xp_context; xpc.xp_pattern = ccline.cmdbuff; xpc.xp_arg = ccline.xp_arg; } #endif /* * Avoid scrolling when called by a recursive do_cmdline(), e.g. when * doing ":@0" when register 0 doesn't contain a CR. */ msg_scroll = FALSE; State = MODE_CMDLINE; if (firstc == '/' || firstc == '?' || firstc == '@') { // Use ":lmap" mappings for search pattern and input(). if (curbuf->b_p_imsearch == B_IMODE_USE_INSERT) b_im_ptr = &curbuf->b_p_iminsert; else b_im_ptr = &curbuf->b_p_imsearch; if (*b_im_ptr == B_IMODE_LMAP) State |= MODE_LANGMAP; #ifdef HAVE_INPUT_METHOD im_set_active(*b_im_ptr == B_IMODE_IM); #endif } #ifdef HAVE_INPUT_METHOD else if (p_imcmdline) im_set_active(TRUE); #endif setmouse(); #ifdef CURSOR_SHAPE ui_cursor_shape(); // may show different cursor shape #endif // When inside an autocommand for writing "exiting" may be set and // terminal mode set to cooked. Need to set raw mode here then. settmode(TMODE_RAW); // Trigger CmdlineEnter autocommands. cmdline_type = firstc == NUL ? '-' : firstc; trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINEENTER); #ifdef FEAT_EVAL if (!debug_mode) may_trigger_modechanged(); #endif init_history(); hiscnt = get_hislen(); // set hiscnt to impossible history value histype = hist_char2type(firstc); #ifdef FEAT_DIGRAPHS do_digraph(-1); // init digraph typeahead #endif // If something above caused an error, reset the flags, we do want to type // and execute commands. Display may be messed up a bit. if (did_emsg) redrawcmd(); #ifdef FEAT_STL_OPT // Redraw the statusline in case it uses the current mode using the mode() // function. if (!cmd_silent && msg_scrolled == 0) { int found_one = FALSE; win_T *wp; FOR_ALL_WINDOWS(wp) if (*p_stl != NUL || *wp->w_p_stl != NUL) { wp->w_redr_status = TRUE; found_one = TRUE; } if (found_one) redraw_statuslines(); } #endif did_emsg = FALSE; got_int = FALSE; /* * Collect the command string, handling editing keys. */ for (;;) { int trigger_cmdlinechanged = TRUE; int end_wildmenu; redir_off = TRUE; // Don't redirect the typed command. // Repeated, because a ":redir" inside // completion may switch it on. #ifdef USE_ON_FLY_SCROLL dont_scroll = FALSE; // allow scrolling here #endif quit_more = FALSE; // reset after CTRL-D which had a more-prompt did_emsg = FALSE; // There can't really be a reason why an error // that occurs while typing a command should // cause the command not to be executed. // Trigger SafeState if nothing is pending. may_trigger_safestate(xpc.xp_numfiles <= 0); // Get a character. Ignore K_IGNORE and K_NOP, they should not do // anything, such as stop completion. do { cursorcmd(); // set the cursor on the right spot c = safe_vgetc(); } while (c == K_IGNORE || c == K_NOP); if (c == K_COMMAND || c == K_SCRIPT_COMMAND) { int clen = ccline.cmdlen; if (do_cmdkey_command(c, DOCMD_NOWAIT) == OK) { if (clen == ccline.cmdlen) trigger_cmdlinechanged = FALSE; goto cmdline_changed; } } if (KeyTyped) { some_key_typed = TRUE; #ifdef FEAT_RIGHTLEFT if (cmd_hkmap) c = hkmap(c); if (cmdmsg_rl && !KeyStuffed) { // Invert horizontal movements and operations. Only when // typed by the user directly, not when the result of a // mapping. switch (c) { case K_RIGHT: c = K_LEFT; break; case K_S_RIGHT: c = K_S_LEFT; break; case K_C_RIGHT: c = K_C_LEFT; break; case K_LEFT: c = K_RIGHT; break; case K_S_LEFT: c = K_S_RIGHT; break; case K_C_LEFT: c = K_C_RIGHT; break; } } #endif } /* * Ignore got_int when CTRL-C was typed here. * Don't ignore it in :global, we really need to break then, e.g., for * ":g/pat/normal /pat" (without the <CR>). * Don't ignore it for the input() function. */ if ((c == Ctrl_C #ifdef UNIX || c == intr_char #endif ) #if defined(FEAT_EVAL) || defined(FEAT_CRYPT) && firstc != '@' #endif #ifdef FEAT_EVAL && !break_ctrl_c #endif && !global_busy) got_int = FALSE; // free old command line when finished moving around in the history // list if (lookfor != NULL && c != K_S_DOWN && c != K_S_UP && c != K_DOWN && c != K_UP && c != K_PAGEDOWN && c != K_PAGEUP && c != K_KPAGEDOWN && c != K_KPAGEUP && c != K_LEFT && c != K_RIGHT && (xpc.xp_numfiles > 0 || (c != Ctrl_P && c != Ctrl_N))) VIM_CLEAR(lookfor); /* * When there are matching completions to select <S-Tab> works like * CTRL-P (unless 'wc' is <S-Tab>). */ if (c != p_wc && c == K_S_TAB && xpc.xp_numfiles > 0) c = Ctrl_P; #ifdef FEAT_WILDMENU if (p_wmnu) c = wildmenu_translate_key(&ccline, c, &xpc, did_wild_list); if (cmdline_pum_active()) { // Ctrl-Y: Accept the current selection and close the popup menu. // Ctrl-E: cancel the cmdline popup menu and return the original // text. if (c == Ctrl_E || c == Ctrl_Y) { wild_type = (c == Ctrl_E) ? WILD_CANCEL : WILD_APPLY; if (nextwild(&xpc, wild_type, WILD_NO_BEEP, firstc != '@') == FAIL) break; c = Ctrl_E; } } #endif // The wildmenu is cleared if the pressed key is not used for // navigating the wild menu (i.e. the key is not 'wildchar' or // 'wildcharm' or Ctrl-N or Ctrl-P or Ctrl-A or Ctrl-L). // If the popup menu is displayed, then PageDown and PageUp keys are // also used to navigate the menu. end_wildmenu = (!(c == p_wc && KeyTyped) && c != p_wcm && c != Ctrl_N && c != Ctrl_P && c != Ctrl_A && c != Ctrl_L); #ifdef FEAT_WILDMENU end_wildmenu = end_wildmenu && (!cmdline_pum_active() || (c != K_PAGEDOWN && c != K_PAGEUP && c != K_KPAGEDOWN && c != K_KPAGEUP)); #endif // free expanded names when finished walking through matches if (end_wildmenu) { #ifdef FEAT_WILDMENU if (cmdline_pum_active()) cmdline_pum_remove(); #endif if (xpc.xp_numfiles != -1) (void)ExpandOne(&xpc, NULL, NULL, 0, WILD_FREE); did_wild_list = FALSE; #ifdef FEAT_WILDMENU if (!p_wmnu || (c != K_UP && c != K_DOWN)) #endif xpc.xp_context = EXPAND_NOTHING; wim_index = 0; #ifdef FEAT_WILDMENU wildmenu_cleanup(&ccline); #endif } #ifdef FEAT_WILDMENU if (p_wmnu) c = wildmenu_process_key(&ccline, c, &xpc); #endif // CTRL-\ CTRL-N goes to Normal mode, CTRL-\ CTRL-G goes to Insert // mode when 'insertmode' is set, CTRL-\ e prompts for an expression. if (c == Ctrl_BSL) { res = cmdline_handle_backslash_key(c, &gotesc); if (res == CMDLINE_CHANGED) goto cmdline_changed; else if (res == CMDLINE_NOT_CHANGED) goto cmdline_not_changed; else if (res == GOTO_NORMAL_MODE) goto returncmd; // back to cmd mode c = Ctrl_BSL; // backslash key not processed by // cmdline_handle_backslash_key() } #ifdef FEAT_CMDWIN if (c == cedit_key || c == K_CMDWIN) { // TODO: why is ex_normal_busy checked here? if ((c == K_CMDWIN || ex_normal_busy == 0) && got_int == FALSE) { /* * Open a window to edit the command line (and history). */ c = open_cmdwin(); some_key_typed = TRUE; } } # ifdef FEAT_DIGRAPHS else # endif #endif #ifdef FEAT_DIGRAPHS c = do_digraph(c); #endif if (c == '\n' || c == '\r' || c == K_KENTER || (c == ESC && (!KeyTyped || vim_strchr(p_cpo, CPO_ESC) != NULL))) { // In Ex mode a backslash escapes a newline. if (exmode_active && c != ESC && ccline.cmdpos == ccline.cmdlen && ccline.cmdpos > 0 && ccline.cmdbuff[ccline.cmdpos - 1] == '\\') { if (c == K_KENTER) c = '\n'; } else { gotesc = FALSE; // Might have typed ESC previously, don't // truncate the cmdline now. if (ccheck_abbr(c + ABBR_OFF)) goto cmdline_changed; if (!cmd_silent) { windgoto(msg_row, 0); out_flush(); } break; } } // Completion for 'wildchar' or 'wildcharm' key. if ((c == p_wc && !gotesc && KeyTyped) || c == p_wcm) { res = cmdline_wildchar_complete(c, firstc != '@', &did_wild_list, &wim_index, &xpc, &gotesc); if (res == CMDLINE_CHANGED) goto cmdline_changed; } gotesc = FALSE; // <S-Tab> goes to last match, in a clumsy way if (c == K_S_TAB && KeyTyped) { if (nextwild(&xpc, WILD_EXPAND_KEEP, 0, firstc != '@') == OK) { if (xpc.xp_numfiles > 1) { #ifdef FEAT_WILDMENU // Trigger the popup menu when wildoptions=pum showmatches(&xpc, p_wmnu && ((wim_flags[wim_index] & WIM_LIST) == 0)); #else (void)showmatches(&xpc, FALSE); #endif } if (nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK && nextwild(&xpc, WILD_PREV, 0, firstc != '@') == OK) goto cmdline_changed; } } if (c == NUL || c == K_ZERO) // NUL is stored as NL c = NL; do_abbr = TRUE; // default: check for abbreviation /* * Big switch for a typed command line character. */ switch (c) { case K_BS: case Ctrl_H: case K_DEL: case K_KDEL: case Ctrl_W: res = cmdline_erase_chars(c, indent #ifdef FEAT_SEARCH_EXTRA , &is_state #endif ); if (res == CMDLINE_NOT_CHANGED) goto cmdline_not_changed; else if (res == GOTO_NORMAL_MODE) goto returncmd; // back to cmd mode goto cmdline_changed; case K_INS: case K_KINS: ccline.overstrike = !ccline.overstrike; #ifdef CURSOR_SHAPE ui_cursor_shape(); // may show different cursor shape #endif goto cmdline_not_changed; case Ctrl_HAT: cmdline_toggle_langmap(b_im_ptr); goto cmdline_not_changed; // case '@': only in very old vi case Ctrl_U: // delete all characters left of the cursor j = ccline.cmdpos; ccline.cmdlen -= j; i = ccline.cmdpos = 0; while (i < ccline.cmdlen) ccline.cmdbuff[i++] = ccline.cmdbuff[j++]; // Truncate at the end, required for multi-byte chars. ccline.cmdbuff[ccline.cmdlen] = NUL; #ifdef FEAT_SEARCH_EXTRA if (ccline.cmdlen == 0) is_state.search_start = is_state.save_cursor; #endif redrawcmd(); goto cmdline_changed; #ifdef FEAT_CLIPBOARD case Ctrl_Y: // Copy the modeless selection, if there is one. if (clip_star.state != SELECT_CLEARED) { if (clip_star.state == SELECT_DONE) clip_copy_modeless_selection(TRUE); goto cmdline_not_changed; } break; #endif case ESC: // get here if p_wc != ESC or when ESC typed twice case Ctrl_C: // In exmode it doesn't make sense to return. Except when // ":normal" runs out of characters. if (exmode_active && (ex_normal_busy == 0 || typebuf.tb_len > 0)) goto cmdline_not_changed; gotesc = TRUE; // will free ccline.cmdbuff after // putting it in history goto returncmd; // back to cmd mode case Ctrl_R: // insert register res = cmdline_insert_reg(&gotesc); if (res == CMDLINE_NOT_CHANGED) goto cmdline_not_changed; else if (res == GOTO_NORMAL_MODE) goto returncmd; goto cmdline_changed; case Ctrl_D: if (showmatches(&xpc, FALSE) == EXPAND_NOTHING) break; // Use ^D as normal char instead redrawcmd(); continue; // don't do incremental search now case K_RIGHT: case K_S_RIGHT: case K_C_RIGHT: do { if (ccline.cmdpos >= ccline.cmdlen) break; i = cmdline_charsize(ccline.cmdpos); if (KeyTyped && ccline.cmdspos + i >= Columns * Rows) break; ccline.cmdspos += i; if (has_mbyte) ccline.cmdpos += (*mb_ptr2len)(ccline.cmdbuff + ccline.cmdpos); else ++ccline.cmdpos; } while ((c == K_S_RIGHT || c == K_C_RIGHT || (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL))) && ccline.cmdbuff[ccline.cmdpos] != ' '); if (has_mbyte) set_cmdspos_cursor(); goto cmdline_not_changed; case K_LEFT: case K_S_LEFT: case K_C_LEFT: if (ccline.cmdpos == 0) goto cmdline_not_changed; do { --ccline.cmdpos; if (has_mbyte) // move to first byte of char ccline.cmdpos -= (*mb_head_off)(ccline.cmdbuff, ccline.cmdbuff + ccline.cmdpos); ccline.cmdspos -= cmdline_charsize(ccline.cmdpos); } while (ccline.cmdpos > 0 && (c == K_S_LEFT || c == K_C_LEFT || (mod_mask & (MOD_MASK_SHIFT|MOD_MASK_CTRL))) && ccline.cmdbuff[ccline.cmdpos - 1] != ' '); if (has_mbyte) set_cmdspos_cursor(); goto cmdline_not_changed; case K_IGNORE: // Ignore mouse event or open_cmdwin() result. goto cmdline_not_changed; #ifdef FEAT_GUI_MSWIN // On MS-Windows ignore <M-F4>, we get it when closing the window // was cancelled. case K_F4: if (mod_mask == MOD_MASK_ALT) { redrawcmd(); // somehow the cmdline is cleared goto cmdline_not_changed; } break; #endif case K_MIDDLEDRAG: case K_MIDDLERELEASE: goto cmdline_not_changed; // Ignore mouse case K_MIDDLEMOUSE: # ifdef FEAT_GUI // When GUI is active, also paste when 'mouse' is empty if (!gui.in_use) # endif if (!mouse_has(MOUSE_COMMAND)) goto cmdline_not_changed; // Ignore mouse # ifdef FEAT_CLIPBOARD if (clip_star.available) cmdline_paste('*', TRUE, TRUE); else # endif cmdline_paste(0, TRUE, TRUE); redrawcmd(); goto cmdline_changed; # ifdef FEAT_DND case K_DROP: cmdline_paste('~', TRUE, FALSE); redrawcmd(); goto cmdline_changed; # endif case K_LEFTDRAG: case K_LEFTRELEASE: case K_RIGHTDRAG: case K_RIGHTRELEASE: // Ignore drag and release events when the button-down wasn't // seen before. if (ignore_drag_release) goto cmdline_not_changed; // FALLTHROUGH case K_LEFTMOUSE: case K_RIGHTMOUSE: cmdline_left_right_mouse(c, &ignore_drag_release); goto cmdline_not_changed; // Mouse scroll wheel: ignored here case K_MOUSEDOWN: case K_MOUSEUP: case K_MOUSELEFT: case K_MOUSERIGHT: // Alternate buttons ignored here case K_X1MOUSE: case K_X1DRAG: case K_X1RELEASE: case K_X2MOUSE: case K_X2DRAG: case K_X2RELEASE: case K_MOUSEMOVE: goto cmdline_not_changed; #ifdef FEAT_GUI case K_LEFTMOUSE_NM: // mousefocus click, ignored case K_LEFTRELEASE_NM: goto cmdline_not_changed; case K_VER_SCROLLBAR: if (msg_scrolled == 0) { gui_do_scroll(); redrawcmd(); } goto cmdline_not_changed; case K_HOR_SCROLLBAR: if (msg_scrolled == 0) { gui_do_horiz_scroll(scrollbar_value, FALSE); redrawcmd(); } goto cmdline_not_changed; #endif #ifdef FEAT_GUI_TABLINE case K_TABLINE: case K_TABMENU: // Don't want to change any tabs here. Make sure the same tab // is still selected. if (gui_use_tabline()) gui_mch_set_curtab(tabpage_index(curtab)); goto cmdline_not_changed; #endif case K_SELECT: // end of Select mode mapping - ignore goto cmdline_not_changed; case Ctrl_B: // begin of command line case K_HOME: case K_KHOME: case K_S_HOME: case K_C_HOME: ccline.cmdpos = 0; set_cmdspos(); goto cmdline_not_changed; case Ctrl_E: // end of command line case K_END: case K_KEND: case K_S_END: case K_C_END: ccline.cmdpos = ccline.cmdlen; set_cmdspos_cursor(); goto cmdline_not_changed; case Ctrl_A: // all matches #ifdef FEAT_WILDMENU if (cmdline_pum_active()) // As Ctrl-A completes all the matches, close the popup // menu (if present) cmdline_pum_cleanup(&ccline); #endif if (nextwild(&xpc, WILD_ALL, 0, firstc != '@') == FAIL) break; xpc.xp_context = EXPAND_NOTHING; did_wild_list = FALSE; goto cmdline_changed; case Ctrl_L: #ifdef FEAT_SEARCH_EXTRA if (may_add_char_to_search(firstc, &c, &is_state) == OK) goto cmdline_not_changed; #endif // completion: longest common part if (nextwild(&xpc, WILD_LONGEST, 0, firstc != '@') == FAIL) break; goto cmdline_changed; case Ctrl_N: // next match case Ctrl_P: // previous match if (xpc.xp_numfiles > 0) { wild_type = (c == Ctrl_P) ? WILD_PREV : WILD_NEXT; if (nextwild(&xpc, wild_type, 0, firstc != '@') == FAIL) break; goto cmdline_not_changed; } // FALLTHROUGH case K_UP: case K_DOWN: case K_S_UP: case K_S_DOWN: case K_PAGEUP: case K_KPAGEUP: case K_PAGEDOWN: case K_KPAGEDOWN: #ifdef FEAT_WILDMENU if (cmdline_pum_active() && (c == K_PAGEUP || c == K_PAGEDOWN || c == K_KPAGEUP || c == K_KPAGEDOWN)) { // If the popup menu is displayed, then PageUp and PageDown // are used to scroll the menu. wild_type = WILD_PAGEUP; if (c == K_PAGEDOWN || c == K_KPAGEDOWN) wild_type = WILD_PAGEDOWN; if (nextwild(&xpc, wild_type, 0, firstc != '@') == FAIL) break; goto cmdline_not_changed; } else #endif { res = cmdline_browse_history(c, firstc, &lookfor, histype, &hiscnt, &xpc); if (res == CMDLINE_CHANGED) goto cmdline_changed; else if (res == GOTO_NORMAL_MODE) goto returncmd; } goto cmdline_not_changed; #ifdef FEAT_SEARCH_EXTRA case Ctrl_G: // next match case Ctrl_T: // previous match if (may_adjust_incsearch_highlighting( firstc, count, &is_state, c) == FAIL) goto cmdline_not_changed; break; #endif case Ctrl_V: case Ctrl_Q: { ignore_drag_release = TRUE; putcmdline('^', TRUE); // Get next (two) character(s). Do not change any // modifyOtherKeys ESC sequence to a normal key for // CTRL-SHIFT-V. c = get_literal(mod_mask & MOD_MASK_SHIFT); do_abbr = FALSE; // don't do abbreviation now extra_char = NUL; // may need to remove ^ when composing char was typed if (enc_utf8 && utf_iscomposing(c) && !cmd_silent) { draw_cmdline(ccline.cmdpos, ccline.cmdlen - ccline.cmdpos); msg_putchar(' '); cursorcmd(); } } break; #ifdef FEAT_DIGRAPHS case Ctrl_K: ignore_drag_release = TRUE; putcmdline('?', TRUE); # ifdef USE_ON_FLY_SCROLL dont_scroll = TRUE; // disallow scrolling here # endif c = get_digraph(TRUE); extra_char = NUL; if (c != NUL) break; redrawcmd(); goto cmdline_not_changed; #endif // FEAT_DIGRAPHS #ifdef FEAT_RIGHTLEFT case Ctrl__: // CTRL-_: switch language mode if (!p_ari) break; cmd_hkmap = !cmd_hkmap; goto cmdline_not_changed; #endif case K_PS: bracketed_paste(PASTE_CMDLINE, FALSE, NULL); goto cmdline_changed; default: #ifdef UNIX if (c == intr_char) { gotesc = TRUE; // will free ccline.cmdbuff after // putting it in history goto returncmd; // back to Normal mode } #endif /* * Normal character with no special meaning. Just set mod_mask * to 0x0 so that typing Shift-Space in the GUI doesn't enter * the string <S-Space>. This should only happen after ^V. */ if (!IS_SPECIAL(c)) mod_mask = 0x0; break; } /* * End of switch on command line character. * We come here if we have a normal character. */ if (do_abbr && (IS_SPECIAL(c) || !vim_iswordc(c)) && (ccheck_abbr( // Add ABBR_OFF for characters above 0x100, this is // what check_abbr() expects. (has_mbyte && c >= 0x100) ? (c + ABBR_OFF) : c) || c == Ctrl_RSB)) goto cmdline_changed; /* * put the character in the command line */ if (IS_SPECIAL(c) || mod_mask != 0) put_on_cmdline(get_special_key_name(c, mod_mask), -1, TRUE); else { if (has_mbyte) { j = (*mb_char2bytes)(c, IObuff); IObuff[j] = NUL; // exclude composing chars put_on_cmdline(IObuff, j, TRUE); } else { IObuff[0] = c; put_on_cmdline(IObuff, 1, TRUE); } } goto cmdline_changed; /* * This part implements incremental searches for "/" and "?" * Jump to cmdline_not_changed when a character has been read but the command * line did not change. Then we only search and redraw if something changed in * the past. * Jump to cmdline_changed when the command line did change. * (Sorry for the goto's, I know it is ugly). */ cmdline_not_changed: #ifdef FEAT_SEARCH_EXTRA if (!is_state.incsearch_postponed) continue; #endif cmdline_changed: #ifdef FEAT_SEARCH_EXTRA // If the window changed incremental search state is not valid. if (is_state.winid != curwin->w_id) init_incsearch_state(&is_state); #endif if (trigger_cmdlinechanged) // Trigger CmdlineChanged autocommands. trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINECHANGED); #ifdef FEAT_SEARCH_EXTRA if (xpc.xp_context == EXPAND_NOTHING && (KeyTyped || vpeekc() == NUL)) may_do_incsearch_highlighting(firstc, count, &is_state); #endif #ifdef FEAT_RIGHTLEFT if (cmdmsg_rl # ifdef FEAT_ARABIC || (p_arshape && !p_tbidi && cmdline_has_arabic(0, ccline.cmdlen)) # endif ) // Always redraw the whole command line to fix shaping and // right-left typing. Not efficient, but it works. // Do it only when there are no characters left to read // to avoid useless intermediate redraws. if (vpeekc() == NUL) redrawcmd(); #endif } returncmd: #ifdef FEAT_RIGHTLEFT cmdmsg_rl = FALSE; #endif ExpandCleanup(&xpc); ccline.xpc = NULL; #ifdef FEAT_SEARCH_EXTRA finish_incsearch_highlighting(gotesc, &is_state, FALSE); #endif if (ccline.cmdbuff != NULL) { /* * Put line in history buffer (":" and "=" only when it was typed). */ if (ccline.cmdlen && firstc != NUL && (some_key_typed || histype == HIST_SEARCH)) { add_to_history(histype, ccline.cmdbuff, TRUE, histype == HIST_SEARCH ? firstc : NUL); if (firstc == ':') { vim_free(new_last_cmdline); new_last_cmdline = vim_strsave(ccline.cmdbuff); } } if (gotesc) abandon_cmdline(); } /* * If the screen was shifted up, redraw the whole screen (later). * If the line is too long, clear it, so ruler and shown command do * not get printed in the middle of it. */ msg_check(); msg_scroll = save_msg_scroll; redir_off = FALSE; // When the command line was typed, no need for a wait-return prompt. if (some_key_typed) need_wait_return = FALSE; // Trigger CmdlineLeave autocommands. trigger_cmd_autocmd(cmdline_type, EVENT_CMDLINELEAVE); State = save_State; #ifdef FEAT_EVAL if (!debug_mode) may_trigger_modechanged(); #endif #ifdef HAVE_INPUT_METHOD if (b_im_ptr != NULL && *b_im_ptr != B_IMODE_LMAP) im_save_status(b_im_ptr); im_set_active(FALSE); #endif setmouse(); #ifdef CURSOR_SHAPE ui_cursor_shape(); // may show different cursor shape #endif sb_text_end_cmdline(); theend: { char_u *p = ccline.cmdbuff; --depth; if (did_save_ccline) restore_cmdline(&save_ccline); else ccline.cmdbuff = NULL; return p; } }
0
160,766
bool operator()(const pair<spg_t, PGQueueable> &op) { if (op.first == pgid) { accumulate(op.second); return true; } else { return false; } }
0
157,714
sigbuffer_init (SigBuffer *buf, int size) { buf->buf = g_malloc (size); buf->p = buf->buf; buf->end = buf->buf + size; }
0
492,867
static int PamLocalCallback(int num_msg, #if defined(__sun) struct pam_message** msgm, #else const struct pam_message** msgm, #endif struct pam_response** response, void* appdata_ptr) { struct pam_response* resp = static_cast<pam_response*>( calloc(num_msg, sizeof(struct pam_response))); PamData* pam_data = static_cast<PamData*>(appdata_ptr); if (num_msg == 1) { resp[0].resp = strdup(pam_data->passwd_.c_str()); resp[0].resp_retcode = 0; } *response = resp; return PAM_SUCCESS; }
0
39,502
ar6000_sysfs_bmi_read(struct file *fp, struct kobject *kobj, struct bin_attribute *bin_attr, char *buf, loff_t pos, size_t count) { int index; struct ar6_softc *ar; struct hif_device_os_device_info *osDevInfo; AR_DEBUG_PRINTF(ATH_DEBUG_INFO,("BMI: Read %d bytes\n", (u32)count)); for (index=0; index < MAX_AR6000; index++) { ar = (struct ar6_softc *)ar6k_priv(ar6000_devices[index]); osDevInfo = &ar->osDevInfo; if (kobj == (&(((struct device *)osDevInfo->pOSDevice)->kobj))) { break; } } if (index == MAX_AR6000) return 0; if ((BMIRawRead(ar->arHifDevice, (u8*)buf, count, true)) != 0) { return 0; } return count; }
0
495,716
void Curl_ssl_version(char *buffer, size_t size) { #ifdef CURL_WITH_MULTI_SSL (void)multissl_version(buffer, size); #else (void)Curl_ssl->version(buffer, size); #endif }
0
355,342
expand_user_macro (struct obstack *obs, symbol *sym, int argc, token_data **argv) { const char *text; int i; for (text = SYMBOL_TEXT (sym); *text != '\0';) { if (*text != '$') { obstack_1grow (obs, *text); text++; continue; } text++; switch (*text) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (no_gnu_extensions) { i = *text++ - '0'; } else { for (i = 0; isdigit (to_uchar (*text)); text++) i = i*10 + (*text - '0'); } if (i < argc) obstack_grow (obs, TOKEN_DATA_TEXT (argv[i]), strlen (TOKEN_DATA_TEXT (argv[i]))); break; case '#': /* number of arguments */ shipout_int (obs, argc - 1); text++; break; case '*': /* all arguments */ case '@': /* ... same, but quoted */ dump_args (obs, argc, argv, ",", *text == '@'); text++; break; default: obstack_1grow (obs, '$'); break; } } }
0
434,364
static int parse_spam_list (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) { BUFFER templ; memset(&templ, 0, sizeof(templ)); /* Insist on at least one parameter */ if (!MoreArgs(s)) { if (data == M_SPAM) strfcpy(err->data, _("spam: no matching pattern"), err->dsize); else strfcpy(err->data, _("nospam: no matching pattern"), err->dsize); return -1; } /* Extract the first token, a regexp */ mutt_extract_token (buf, s, 0); /* data should be either M_SPAM or M_NOSPAM. M_SPAM is for spam commands. */ if (data == M_SPAM) { /* If there's a second parameter, it's a template for the spam tag. */ if (MoreArgs(s)) { mutt_extract_token (&templ, s, 0); /* Add to the spam list. */ if (add_to_spam_list (&SpamList, buf->data, templ.data, err) != 0) { FREE(&templ.data); return -1; } FREE(&templ.data); } /* If not, try to remove from the nospam list. */ else { mutt_remove_from_rx_list(&NoSpamList, buf->data); } return 0; } /* M_NOSPAM is for nospam commands. */ else if (data == M_NOSPAM) { /* nospam only ever has one parameter. */ /* "*" is a special case. */ if (!mutt_strcmp(buf->data, "*")) { mutt_free_spam_list (&SpamList); mutt_free_rx_list (&NoSpamList); return 0; } /* If it's on the spam list, just remove it. */ if (remove_from_spam_list(&SpamList, buf->data) != 0) return 0; /* Otherwise, add it to the nospam list. */ if (mutt_add_to_rx_list (&NoSpamList, buf->data, REG_ICASE, err) != 0) return -1; return 0; } /* This should not happen. */ strfcpy(err->data, "This is no good at all.", err->dsize); return -1; }
0
473,342
static void scrub_spilled_slot(u8 *stype) { if (*stype != STACK_INVALID) *stype = STACK_MISC; }
0
288,977
static int selinux_inode_setsecurity ( struct inode * inode , const char * name , const void * value , size_t size , int flags ) { struct inode_security_struct * isec = inode_security_novalidate ( inode ) ; u32 newsid ; int rc ; if ( strcmp ( name , XATTR_SELINUX_SUFFIX ) ) return - EOPNOTSUPP ; if ( ! value || ! size ) return - EACCES ; rc = security_context_to_sid ( value , size , & newsid , GFP_KERNEL ) ; if ( rc ) return rc ; spin_lock ( & isec -> lock ) ; isec -> sclass = inode_mode_to_security_class ( inode -> i_mode ) ; isec -> sid = newsid ; isec -> initialized = LABEL_INITIALIZED ; spin_unlock ( & isec -> lock ) ; return 0 ; }
0
281,085
static void cirrus_linear_write(void *opaque, hwaddr addr, uint64_t val, unsigned size) { CirrusVGAState *s = opaque; unsigned mode; addr &= s->cirrus_addr_mask; if (((s->vga.sr[0x17] & 0x44) == 0x44) && ((addr & s->linear_mmio_mask) == s->linear_mmio_mask)) { /* memory-mapped I/O */ cirrus_mmio_blt_write(s, addr & 0xff, val); } else if (s->cirrus_srcptr != s->cirrus_srcptr_end) { /* bitblt */ *s->cirrus_srcptr++ = (uint8_t) val; if (s->cirrus_srcptr >= s->cirrus_srcptr_end) { cirrus_bitblt_cputovideo_next(s); } } else { /* video memory */ if ((s->vga.gr[0x0B] & 0x14) == 0x14) { addr <<= 4; } else if (s->vga.gr[0x0B] & 0x02) { addr <<= 3; } addr &= s->cirrus_addr_mask; mode = s->vga.gr[0x05] & 0x7; if (mode < 4 || mode > 5 || ((s->vga.gr[0x0B] & 0x4) == 0)) { *(s->vga.vram_ptr + addr) = (uint8_t) val; memory_region_set_dirty(&s->vga.vram, addr, 1); } else { if ((s->vga.gr[0x0B] & 0x14) != 0x14) { cirrus_mem_writeb_mode4and5_8bpp(s, mode, addr, val); } else { cirrus_mem_writeb_mode4and5_16bpp(s, mode, addr, val); } } } }
0
436,742
int mingw_open (const char *filename, int oflags, ...) { va_list args; unsigned mode; int fd; wchar_t wfilename[MAX_PATH]; va_start(args, oflags); mode = va_arg(args, int); va_end(args); if (filename && !strcmp(filename, "/dev/null")) filename = "nul"; if (xutftowcs_path(wfilename, filename) < 0) return -1; fd = _wopen(wfilename, oflags, mode); if (fd < 0 && (oflags & O_ACCMODE) != O_RDONLY && errno == EACCES) { DWORD attrs = GetFileAttributesW(wfilename); if (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY)) errno = EISDIR; } if ((oflags & O_CREAT) && needs_hiding(filename)) { /* * Internally, _wopen() uses the CreateFile() API which errors * out with an ERROR_ACCESS_DENIED if CREATE_ALWAYS was * specified and an already existing file's attributes do not * match *exactly*. As there is no mode or flag we can set that * would correspond to FILE_ATTRIBUTE_HIDDEN, let's just try * again *without* the O_CREAT flag (that corresponds to the * CREATE_ALWAYS flag of CreateFile()). */ if (fd < 0 && errno == EACCES) fd = _wopen(wfilename, oflags & ~O_CREAT, mode); if (fd >= 0 && set_hidden_flag(wfilename, 1)) warning("could not mark '%s' as hidden.", filename); } return fd; }
0
66,592
viminfo_encoding(vir_T *virp) { char_u *p; int i; if (get_viminfo_parameter('c') != 0) { p = vim_strchr(virp->vir_line, '='); if (p != NULL) { /* remove trailing newline */ ++p; for (i = 0; vim_isprintc(p[i]); ++i) ; p[i] = NUL; convert_setup(&virp->vir_conv, p, p_enc); } } return viminfo_readline(virp); }
0
261,637
inline void StridedSlice(const tflite::StridedSliceParams& op_params, const RuntimeShape& unextended_input_shape, const RuntimeShape& unextended_output_shape, SequentialTensorWriter<T>* writer) { using strided_slice::LoopCondition; using strided_slice::StartForAxis; using strided_slice::StopForAxis; ruy::profiler::ScopeLabel label("StridedSlice"); // Note that the output_shape is not used herein. tflite::StridedSliceParams params_copy = op_params; TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 5); TFLITE_DCHECK_LE(unextended_output_shape.DimensionsCount(), 5); const RuntimeShape input_shape = RuntimeShape::ExtendedShape(5, unextended_input_shape); const RuntimeShape output_shape = RuntimeShape::ExtendedShape(5, unextended_output_shape); // Reverse and pad to 5 dimensions because that is what the runtime code // requires (ie. all shapes must be 5D and are given backwards). strided_slice::StridedSlicePadIndices(&params_copy, 5); const int start_0 = StartForAxis(params_copy, input_shape, 0); const int stop_0 = StopForAxis(params_copy, input_shape, 0, start_0); const int start_1 = StartForAxis(params_copy, input_shape, 1); const int stop_1 = StopForAxis(params_copy, input_shape, 1, start_1); const int start_2 = StartForAxis(params_copy, input_shape, 2); const int stop_2 = StopForAxis(params_copy, input_shape, 2, start_2); const int start_3 = StartForAxis(params_copy, input_shape, 3); const int stop_3 = StopForAxis(params_copy, input_shape, 3, start_3); const int start_4 = StartForAxis(params_copy, input_shape, 4); const int stop_4 = StopForAxis(params_copy, input_shape, 4, start_4); const bool inner_stride_is_1 = params_copy.strides[4] == 1; for (int offset_0 = start_0 * input_shape.Dims(1), end_0 = stop_0 * input_shape.Dims(1), step_0 = params_copy.strides[0] * input_shape.Dims(1); !LoopCondition(offset_0, end_0, params_copy.strides[0]); offset_0 += step_0) { for (int offset_1 = (offset_0 + start_1) * input_shape.Dims(2), end_1 = (offset_0 + stop_1) * input_shape.Dims(2), step_1 = params_copy.strides[1] * input_shape.Dims(2); !LoopCondition(offset_1, end_1, params_copy.strides[1]); offset_1 += step_1) { for (int offset_2 = (offset_1 + start_2) * input_shape.Dims(3), end_2 = (offset_1 + stop_2) * input_shape.Dims(3), step_2 = params_copy.strides[2] * input_shape.Dims(3); !LoopCondition(offset_2, end_2, params_copy.strides[2]); offset_2 += step_2) { for (int offset_3 = (offset_2 + start_3) * input_shape.Dims(4), end_3 = (offset_2 + stop_3) * input_shape.Dims(4), step_3 = params_copy.strides[3] * input_shape.Dims(4); !LoopCondition(offset_3, end_3, params_copy.strides[3]); offset_3 += step_3) { // When the stride is 1, the inner loop is equivalent to the // optimized slice inner loop. Otherwise, it is identical to the // strided_slice reference implementation inner loop. if (inner_stride_is_1) { const int len = stop_4 - start_4; if (len > 0) { writer->WriteN(offset_3 + start_4, len); } } else { for (int offset_4 = offset_3 + start_4, end_4 = offset_3 + stop_4; !LoopCondition(offset_4, end_4, params_copy.strides[4]); offset_4 += params_copy.strides[4]) { writer->Write(offset_4); } } } } } } }
0
372,459
cmsBool _cmsWriteHeader(_cmsICCPROFILE* Icc, cmsUInt32Number UsedSpace) { cmsICCHeader Header; cmsUInt32Number i; cmsTagEntry Tag; cmsInt32Number Count = 0; Header.size = _cmsAdjustEndianess32(UsedSpace); Header.cmmId = _cmsAdjustEndianess32(lcmsSignature); Header.version = _cmsAdjustEndianess32(Icc ->Version); Header.deviceClass = (cmsProfileClassSignature) _cmsAdjustEndianess32(Icc -> DeviceClass); Header.colorSpace = (cmsColorSpaceSignature) _cmsAdjustEndianess32(Icc -> ColorSpace); Header.pcs = (cmsColorSpaceSignature) _cmsAdjustEndianess32(Icc -> PCS); // NOTE: in v4 Timestamp must be in UTC rather than in local time _cmsEncodeDateTimeNumber(&Header.date, &Icc ->Created); Header.magic = _cmsAdjustEndianess32(cmsMagicNumber); #ifdef CMS_IS_WINDOWS_ Header.platform = (cmsPlatformSignature) _cmsAdjustEndianess32(cmsSigMicrosoft); #else Header.platform = (cmsPlatformSignature) _cmsAdjustEndianess32(cmsSigMacintosh); #endif Header.flags = _cmsAdjustEndianess32(Icc -> flags); Header.manufacturer = _cmsAdjustEndianess32(Icc -> manufacturer); Header.model = _cmsAdjustEndianess32(Icc -> model); _cmsAdjustEndianess64(&Header.attributes, &Icc -> attributes); // Rendering intent in the header (for embedded profiles) Header.renderingIntent = _cmsAdjustEndianess32(Icc -> RenderingIntent); // Illuminant is always D50 Header.illuminant.X = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(cmsD50_XYZ()->X)); Header.illuminant.Y = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(cmsD50_XYZ()->Y)); Header.illuminant.Z = _cmsAdjustEndianess32(_cmsDoubleTo15Fixed16(cmsD50_XYZ()->Z)); // Created by LittleCMS (that's me!) Header.creator = _cmsAdjustEndianess32(lcmsSignature); memset(&Header.reserved, 0, sizeof(Header.reserved)); // Set profile ID. Endianess is always big endian memmove(&Header.profileID, &Icc ->ProfileID, 16); // Dump the header if (!Icc -> IOhandler->Write(Icc->IOhandler, sizeof(cmsICCHeader), &Header)) return FALSE; // Saves Tag directory // Get true count for (i=0; i < Icc -> TagCount; i++) { if (Icc ->TagNames[i] != 0) Count++; } // Store number of tags if (!_cmsWriteUInt32Number(Icc ->IOhandler, Count)) return FALSE; for (i=0; i < Icc -> TagCount; i++) { if (Icc ->TagNames[i] == 0) continue; // It is just a placeholder Tag.sig = (cmsTagSignature) _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagNames[i]); Tag.offset = _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagOffsets[i]); Tag.size = _cmsAdjustEndianess32((cmsInt32Number) Icc -> TagSizes[i]); if (!Icc ->IOhandler -> Write(Icc-> IOhandler, sizeof(cmsTagEntry), &Tag)) return FALSE; } return TRUE; }
0
468,361
urnStart(HttpRequest * r, StoreEntry * e) { UrnState *anUrn = new UrnState(); anUrn->start (r, e); }
0
165,717
void NotifyCacheOnIO( scoped_refptr<net::URLRequestContextGetter> request_context, const GURL& url, const std::string& http_method) { net::HttpCache* cache = request_context->GetURLRequestContext()-> http_transaction_factory()->GetCache(); if (cache) cache->OnExternalCacheHit(url, http_method); }
0
134,100
void ByteCodeGenerator::EnsureNoRedeclarations(ParseNode *pnodeBlock, FuncInfo *funcInfo) { // Emit dynamic runtime checks for variable re-declarations. Only necessary for global functions (script or eval). // In eval only var declarations can cause redeclaration, and only in non-strict mode, because let/const variables // remain local to the eval code. Assert(pnodeBlock->nop == knopBlock); Assert(pnodeBlock->sxBlock.blockType == PnodeBlockType::Global || pnodeBlock->sxBlock.scope->GetScopeType() == ScopeType_GlobalEvalBlock); if (!(this->flags & fscrEvalCode)) { IterateBlockScopedVariables(pnodeBlock, [this](ParseNode *pnode) { FuncInfo *funcInfo = this->TopFuncInfo(); Symbol *sym = pnode->sxVar.sym; Assert(sym->GetIsGlobal()); Js::PropertyId propertyId = sym->EnsurePosition(this); this->m_writer.ElementRootU(Js::OpCode::EnsureNoRootFld, funcInfo->FindOrAddReferencedPropertyId(propertyId)); }); } for (ParseNode *pnode = funcInfo->root->sxFnc.pnodeVars; pnode; pnode = pnode->sxVar.pnodeNext) { Symbol* sym = pnode->sxVar.sym; if (sym == nullptr || pnode->sxVar.isBlockScopeFncDeclVar) continue; if (sym->GetIsCatch() || (pnode->nop == knopVarDecl && sym->GetIsBlockVar())) { // The init node was bound to the catch object, because it's inside a catch and has the // same name as the catch object. But we want to define a user var at function scope, // so find the right symbol. (We'll still assign the RHS value to the catch object symbol.) // This also applies to a var declaration in the same scope as a let declaration. // Assert that catch cannot be at function scope and let and var at function scope is redeclaration error. Assert(sym->GetIsCatch() || funcInfo->bodyScope != sym->GetScope()); sym = funcInfo->bodyScope->FindLocalSymbol(sym->GetName()); Assert(sym && !sym->GetIsCatch() && !sym->GetIsBlockVar()); } Assert(sym->GetIsGlobal()); if (sym->GetSymbolType() == STVariable) { Js::PropertyId propertyId = sym->EnsurePosition(this); if (this->flags & fscrEval) { if (!funcInfo->byteCodeFunction->GetIsStrictMode()) { this->m_writer.ScopedProperty(Js::OpCode::ScopedEnsureNoRedeclFld, ByteCodeGenerator::RootObjectRegister, funcInfo->FindOrAddReferencedPropertyId(propertyId)); } } else { this->m_writer.ElementRootU(Js::OpCode::EnsureNoRootRedeclFld, funcInfo->FindOrAddReferencedPropertyId(propertyId)); } } } }
0
18,857
REGRESSION_TEST ( SDK_API_DEBUG_NAME_LOOKUPS ) ( RegressionTest * test , int , int * pstatus ) { bool success = true ; const char state_name [ ] = "INACTIVE_TIMEOUT" ; const char hook_name [ ] = "TS_HTTP_READ_RESPONSE_HDR_HOOK" ; const char event_name [ ] = "VC_EVENT_IMMEDIATE" ; const char * str ; * pstatus = REGRESSION_TEST_INPROGRESS ; str = TSHttpServerStateNameLookup ( TS_SRVSTATE_INACTIVE_TIMEOUT ) ; if ( ( strlen ( str ) != strlen ( state_name ) || strcmp ( str , state_name ) ) ) { SDK_RPRINT ( test , "TSHttpServerStateNameLookup" , "TestCase1" , TC_FAIL , "Failed on %d, expected %s, got %s" , TS_SRVSTATE_INACTIVE_TIMEOUT , state_name , str ) ; success = false ; } else { SDK_RPRINT ( test , "TSHttpServerStateNameLookup" , "TestCase1" , TC_PASS , "ok" ) ; } str = TSHttpHookNameLookup ( TS_HTTP_READ_RESPONSE_HDR_HOOK ) ; if ( ( strlen ( str ) != strlen ( hook_name ) || strcmp ( str , hook_name ) ) ) { SDK_RPRINT ( test , "TSHttpHookNameLookup" , "TestCase1" , TC_FAIL , "Failed on %d, expected %s, got %s" , TS_HTTP_READ_RESPONSE_HDR_HOOK , hook_name , str ) ; success = false ; } else { SDK_RPRINT ( test , "TSHttpHookNameLookup" , "TestCase1" , TC_PASS , "ok" ) ; } str = TSHttpEventNameLookup ( TS_EVENT_IMMEDIATE ) ; if ( ( strlen ( str ) != strlen ( event_name ) || strcmp ( str , event_name ) ) ) { SDK_RPRINT ( test , "TSHttpEventNameLookup" , "TestCase1" , TC_FAIL , "Failed on %d, expected %s, got %s" , TS_EVENT_IMMEDIATE , hook_name , str ) ; success = false ; } else { SDK_RPRINT ( test , "TSHttpEventNameLookup" , "TestCase1" , TC_PASS , "ok" ) ; } * pstatus = success ? REGRESSION_TEST_PASSED : REGRESSION_TEST_FAILED ; return ; }
0