Dataset Viewer
Auto-converted to Parquet
idx
int64
func
string
target
int64
45,922
static FlatView *generate_memory_topology(struct uc_struct *uc, MemoryRegion *mr) { int i; FlatView *view; view = flatview_new(mr); if (mr) { render_memory_region(view, mr, int128_zero(), addrrange_make(int128_zero(), int128_2_64()), false); } flatview_simplify(view); view->dispatch = address_space_dispatch_new(uc, view); for (i = 0; i < view->nr; i++) { MemoryRegionSection mrs = section_from_flat_range(&view->ranges[i], view); flatview_add_to_dispatch(uc, view, &mrs); } address_space_dispatch_compact(view->dispatch); g_hash_table_replace(uc->flat_views, mr, view); return view; }
0
391,645
xmlNodeGetLang(const xmlNode *cur) { xmlChar *lang; if ((cur == NULL) || (cur->type == XML_NAMESPACE_DECL)) return(NULL); while (cur != NULL) { lang = xmlGetNsProp(cur, BAD_CAST "lang", XML_XML_NAMESPACE); if (lang != NULL) return(lang); cur = cur->parent; } return(NULL); }
0
327,145
av_cold int ff_mpv_encode_init(AVCodecContext *avctx) { MpegEncContext *s = avctx->priv_data; int i, ret, format_supported; mpv_encode_defaults(s); switch (avctx->codec_id) { case AV_CODEC_ID_MPEG2VIDEO: if (avctx->pix_fmt != AV_PIX_FMT_YUV420P && avctx->pix_fmt != AV_PIX_FMT_YUV422P) { av_log(avctx, AV_LOG_ERROR, "only YUV420 and YUV422 are supported\n"); return -1; } break; case AV_CODEC_ID_MJPEG: format_supported = 0; /* JPEG color space */ if (avctx->pix_fmt == AV_PIX_FMT_YUVJ420P || avctx->pix_fmt == AV_PIX_FMT_YUVJ422P || (avctx->color_range == AVCOL_RANGE_JPEG && (avctx->pix_fmt == AV_PIX_FMT_YUV420P || avctx->pix_fmt == AV_PIX_FMT_YUV422P))) format_supported = 1; /* MPEG color space */ else if (avctx->strict_std_compliance <= FF_COMPLIANCE_UNOFFICIAL && (avctx->pix_fmt == AV_PIX_FMT_YUV420P || avctx->pix_fmt == AV_PIX_FMT_YUV422P)) format_supported = 1; if (!format_supported) { av_log(avctx, AV_LOG_ERROR, "colorspace not supported in jpeg\n"); return -1; } break; default: if (avctx->pix_fmt != AV_PIX_FMT_YUV420P) { av_log(avctx, AV_LOG_ERROR, "only YUV420 is supported\n"); return -1; } } switch (avctx->pix_fmt) { case AV_PIX_FMT_YUVJ422P: case AV_PIX_FMT_YUV422P: s->chroma_format = CHROMA_422; break; case AV_PIX_FMT_YUVJ420P: case AV_PIX_FMT_YUV420P: default: s->chroma_format = CHROMA_420; break; } s->bit_rate = avctx->bit_rate; s->width = avctx->width; s->height = avctx->height; if (avctx->gop_size > 600 && avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL) { av_log(avctx, AV_LOG_ERROR, "Warning keyframe interval too large! reducing it ...\n"); avctx->gop_size = 600; } s->gop_size = avctx->gop_size; s->avctx = avctx; if (avctx->max_b_frames > MAX_B_FRAMES) { av_log(avctx, AV_LOG_ERROR, "Too many B-frames requested, maximum " "is %d.\n", MAX_B_FRAMES); } s->max_b_frames = avctx->max_b_frames; s->codec_id = avctx->codec->id; s->strict_std_compliance = avctx->strict_std_compliance; s->quarter_sample = (avctx->flags & AV_CODEC_FLAG_QPEL) != 0; s->mpeg_quant = avctx->mpeg_quant; s->rtp_mode = !!avctx->rtp_payload_size; s->intra_dc_precision = avctx->intra_dc_precision; s->user_specified_pts = AV_NOPTS_VALUE; if (s->gop_size <= 1) { s->intra_only = 1; s->gop_size = 12; } else { s->intra_only = 0; } #if FF_API_MOTION_EST FF_DISABLE_DEPRECATION_WARNINGS s->me_method = avctx->me_method; FF_ENABLE_DEPRECATION_WARNINGS #endif /* Fixed QSCALE */ s->fixed_qscale = !!(avctx->flags & AV_CODEC_FLAG_QSCALE); #if FF_API_MPV_OPT FF_DISABLE_DEPRECATION_WARNINGS if (avctx->border_masking != 0.0) s->border_masking = avctx->border_masking; FF_ENABLE_DEPRECATION_WARNINGS #endif s->adaptive_quant = (s->avctx->lumi_masking || s->avctx->dark_masking || s->avctx->temporal_cplx_masking || s->avctx->spatial_cplx_masking || s->avctx->p_masking || s->border_masking || (s->mpv_flags & FF_MPV_FLAG_QP_RD)) && !s->fixed_qscale; s->loop_filter = !!(s->avctx->flags & AV_CODEC_FLAG_LOOP_FILTER); if (avctx->rc_max_rate && !avctx->rc_buffer_size) { av_log(avctx, AV_LOG_ERROR, "a vbv buffer size is needed, " "for encoding with a maximum bitrate\n"); return -1; } if (avctx->rc_min_rate && avctx->rc_max_rate != avctx->rc_min_rate) { av_log(avctx, AV_LOG_INFO, "Warning min_rate > 0 but min_rate != max_rate isn't recommended!\n"); } if (avctx->rc_min_rate && avctx->rc_min_rate > avctx->bit_rate) { av_log(avctx, AV_LOG_ERROR, "bitrate below min bitrate\n"); return -1; } if (avctx->rc_max_rate && avctx->rc_max_rate < avctx->bit_rate) { av_log(avctx, AV_LOG_INFO, "bitrate above max bitrate\n"); return -1; } if (avctx->rc_max_rate && avctx->rc_max_rate == avctx->bit_rate && avctx->rc_max_rate != avctx->rc_min_rate) { av_log(avctx, AV_LOG_INFO, "impossible bitrate constraints, this will fail\n"); } if (avctx->rc_buffer_size && avctx->bit_rate * (int64_t)avctx->time_base.num > avctx->rc_buffer_size * (int64_t)avctx->time_base.den) { av_log(avctx, AV_LOG_ERROR, "VBV buffer too small for bitrate\n"); return -1; } if (!s->fixed_qscale && avctx->bit_rate * av_q2d(avctx->time_base) > avctx->bit_rate_tolerance) { av_log(avctx, AV_LOG_ERROR, "bitrate tolerance too small for bitrate\n"); return -1; } if (s->avctx->rc_max_rate && s->avctx->rc_min_rate == s->avctx->rc_max_rate && (s->codec_id == AV_CODEC_ID_MPEG1VIDEO || s->codec_id == AV_CODEC_ID_MPEG2VIDEO) && 90000LL * (avctx->rc_buffer_size - 1) > s->avctx->rc_max_rate * 0xFFFFLL) { av_log(avctx, AV_LOG_INFO, "Warning vbv_delay will be set to 0xFFFF (=VBR) as the " "specified vbv buffer is too large for the given bitrate!\n"); } if ((s->avctx->flags & AV_CODEC_FLAG_4MV) && s->codec_id != AV_CODEC_ID_MPEG4 && s->codec_id != AV_CODEC_ID_H263 && s->codec_id != AV_CODEC_ID_H263P && s->codec_id != AV_CODEC_ID_FLV1) { av_log(avctx, AV_LOG_ERROR, "4MV not supported by codec\n"); return -1; } if (s->obmc && s->avctx->mb_decision != FF_MB_DECISION_SIMPLE) { av_log(avctx, AV_LOG_ERROR, "OBMC is only supported with simple mb decision\n"); return -1; } if (s->quarter_sample && s->codec_id != AV_CODEC_ID_MPEG4) { av_log(avctx, AV_LOG_ERROR, "qpel not supported by codec\n"); return -1; } if (s->max_b_frames && s->codec_id != AV_CODEC_ID_MPEG4 && s->codec_id != AV_CODEC_ID_MPEG1VIDEO && s->codec_id != AV_CODEC_ID_MPEG2VIDEO) { av_log(avctx, AV_LOG_ERROR, "b frames not supported by codec\n"); return -1; } if ((s->codec_id == AV_CODEC_ID_MPEG4 || s->codec_id == AV_CODEC_ID_H263 || s->codec_id == AV_CODEC_ID_H263P) && (avctx->sample_aspect_ratio.num > 255 || avctx->sample_aspect_ratio.den > 255)) { av_log(avctx, AV_LOG_ERROR, "Invalid pixel aspect ratio %i/%i, limit is 255/255\n", avctx->sample_aspect_ratio.num, avctx->sample_aspect_ratio.den); return -1; } if ((s->avctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME)) && s->codec_id != AV_CODEC_ID_MPEG4 && s->codec_id != AV_CODEC_ID_MPEG2VIDEO) { av_log(avctx, AV_LOG_ERROR, "interlacing not supported by codec\n"); return -1; } // FIXME mpeg2 uses that too if (s->mpeg_quant && s->codec_id != AV_CODEC_ID_MPEG4) { av_log(avctx, AV_LOG_ERROR, "mpeg2 style quantization not supported by codec\n"); return -1; } if ((s->mpv_flags & FF_MPV_FLAG_CBP_RD) && !avctx->trellis) { av_log(avctx, AV_LOG_ERROR, "CBP RD needs trellis quant\n"); return -1; } if ((s->mpv_flags & FF_MPV_FLAG_QP_RD) && s->avctx->mb_decision != FF_MB_DECISION_RD) { av_log(avctx, AV_LOG_ERROR, "QP RD needs mbd=2\n"); return -1; } if (s->avctx->scenechange_threshold < 1000000000 && (s->avctx->flags & AV_CODEC_FLAG_CLOSED_GOP)) { av_log(avctx, AV_LOG_ERROR, "closed gop with scene change detection are not supported yet, " "set threshold to 1000000000\n"); return -1; } if (s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY) { if (s->codec_id != AV_CODEC_ID_MPEG2VIDEO) { av_log(avctx, AV_LOG_ERROR, "low delay forcing is only available for mpeg2\n"); return -1; } if (s->max_b_frames != 0) { av_log(avctx, AV_LOG_ERROR, "b frames cannot be used with low delay\n"); return -1; } } if (s->q_scale_type == 1) { if (avctx->qmax > 12) { av_log(avctx, AV_LOG_ERROR, "non linear quant only supports qmax <= 12 currently\n"); return -1; } } if (avctx->slices > 1 && (avctx->codec_id == AV_CODEC_ID_FLV1 || avctx->codec_id == AV_CODEC_ID_H261)) { av_log(avctx, AV_LOG_ERROR, "Multiple slices are not supported by this codec\n"); return AVERROR(EINVAL); } if (s->avctx->thread_count > 1 && s->codec_id != AV_CODEC_ID_MPEG4 && s->codec_id != AV_CODEC_ID_MPEG1VIDEO && s->codec_id != AV_CODEC_ID_MPEG2VIDEO && (s->codec_id != AV_CODEC_ID_H263P)) { av_log(avctx, AV_LOG_ERROR, "multi threaded encoding not supported by codec\n"); return -1; } if (s->avctx->thread_count < 1) { av_log(avctx, AV_LOG_ERROR, "automatic thread number detection not supported by codec," "patch welcome\n"); return -1; } if (s->avctx->thread_count > 1) s->rtp_mode = 1; if (!avctx->time_base.den || !avctx->time_base.num) { av_log(avctx, AV_LOG_ERROR, "framerate not set\n"); return -1; } if (avctx->b_frame_strategy && (avctx->flags & AV_CODEC_FLAG_PASS2)) { av_log(avctx, AV_LOG_INFO, "notice: b_frame_strategy only affects the first pass\n"); avctx->b_frame_strategy = 0; } i = av_gcd(avctx->time_base.den, avctx->time_base.num); if (i > 1) { av_log(avctx, AV_LOG_INFO, "removing common factors from framerate\n"); avctx->time_base.den /= i; avctx->time_base.num /= i; //return -1; } if (s->mpeg_quant || s->codec_id == AV_CODEC_ID_MPEG1VIDEO || s->codec_id == AV_CODEC_ID_MPEG2VIDEO || s->codec_id == AV_CODEC_ID_MJPEG) { // (a + x * 3 / 8) / x s->intra_quant_bias = 3 << (QUANT_BIAS_SHIFT - 3); s->inter_quant_bias = 0; } else { s->intra_quant_bias = 0; // (a - x / 4) / x s->inter_quant_bias = -(1 << (QUANT_BIAS_SHIFT - 2)); } #if FF_API_QUANT_BIAS FF_DISABLE_DEPRECATION_WARNINGS if (avctx->intra_quant_bias != FF_DEFAULT_QUANT_BIAS) s->intra_quant_bias = avctx->intra_quant_bias; if (avctx->inter_quant_bias != FF_DEFAULT_QUANT_BIAS) s->inter_quant_bias = avctx->inter_quant_bias; FF_ENABLE_DEPRECATION_WARNINGS #endif if (avctx->codec_id == AV_CODEC_ID_MPEG4 && s->avctx->time_base.den > (1 << 16) - 1) { av_log(avctx, AV_LOG_ERROR, "timebase %d/%d not supported by MPEG 4 standard, " "the maximum admitted value for the timebase denominator " "is %d\n", s->avctx->time_base.num, s->avctx->time_base.den, (1 << 16) - 1); return -1; } s->time_increment_bits = av_log2(s->avctx->time_base.den - 1) + 1; switch (avctx->codec->id) { case AV_CODEC_ID_MPEG1VIDEO: s->out_format = FMT_MPEG1; s->low_delay = !!(s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY); avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1); break; case AV_CODEC_ID_MPEG2VIDEO: s->out_format = FMT_MPEG1; s->low_delay = !!(s->avctx->flags & AV_CODEC_FLAG_LOW_DELAY); avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1); s->rtp_mode = 1; break; case AV_CODEC_ID_MJPEG: s->out_format = FMT_MJPEG; s->intra_only = 1; /* force intra only for jpeg */ if (!CONFIG_MJPEG_ENCODER || ff_mjpeg_encode_init(s) < 0) return -1; avctx->delay = 0; s->low_delay = 1; break; case AV_CODEC_ID_H261: if (!CONFIG_H261_ENCODER) return -1; if (ff_h261_get_picture_format(s->width, s->height) < 0) { av_log(avctx, AV_LOG_ERROR, "The specified picture size of %dx%d is not valid for the " "H.261 codec.\nValid sizes are 176x144, 352x288\n", s->width, s->height); return -1; } s->out_format = FMT_H261; avctx->delay = 0; s->low_delay = 1; s->rtp_mode = 0; /* Sliced encoding not supported */ break; case AV_CODEC_ID_H263: if (!CONFIG_H263_ENCODER) return -1; if (ff_match_2uint16(ff_h263_format, FF_ARRAY_ELEMS(ff_h263_format), s->width, s->height) == 8) { av_log(avctx, AV_LOG_INFO, "The specified picture size of %dx%d is not valid for " "the H.263 codec.\nValid sizes are 128x96, 176x144, " "352x288, 704x576, and 1408x1152." "Try H.263+.\n", s->width, s->height); return -1; } s->out_format = FMT_H263; avctx->delay = 0; s->low_delay = 1; break; case AV_CODEC_ID_H263P: s->out_format = FMT_H263; s->h263_plus = 1; /* Fx */ s->h263_aic = (avctx->flags & AV_CODEC_FLAG_AC_PRED) ? 1 : 0; s->modified_quant = s->h263_aic; s->loop_filter = (avctx->flags & AV_CODEC_FLAG_LOOP_FILTER) ? 1 : 0; s->unrestricted_mv = s->obmc || s->loop_filter || s->umvplus; /* /Fx */ /* These are just to be sure */ avctx->delay = 0; s->low_delay = 1; break; case AV_CODEC_ID_FLV1: s->out_format = FMT_H263; s->h263_flv = 2; /* format = 1; 11-bit codes */ s->unrestricted_mv = 1; s->rtp_mode = 0; /* don't allow GOB */ avctx->delay = 0; s->low_delay = 1; break; case AV_CODEC_ID_RV10: s->out_format = FMT_H263; avctx->delay = 0; s->low_delay = 1; break; case AV_CODEC_ID_RV20: s->out_format = FMT_H263; avctx->delay = 0; s->low_delay = 1; s->modified_quant = 1; s->h263_aic = 1; s->h263_plus = 1; s->loop_filter = 1; s->unrestricted_mv = 0; break; case AV_CODEC_ID_MPEG4: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->low_delay = s->max_b_frames ? 0 : 1; avctx->delay = s->low_delay ? 0 : (s->max_b_frames + 1); break; case AV_CODEC_ID_MSMPEG4V2: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version = 2; avctx->delay = 0; s->low_delay = 1; break; case AV_CODEC_ID_MSMPEG4V3: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version = 3; s->flipflop_rounding = 1; avctx->delay = 0; s->low_delay = 1; break; case AV_CODEC_ID_WMV1: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version = 4; s->flipflop_rounding = 1; avctx->delay = 0; s->low_delay = 1; break; case AV_CODEC_ID_WMV2: s->out_format = FMT_H263; s->h263_pred = 1; s->unrestricted_mv = 1; s->msmpeg4_version = 5; s->flipflop_rounding = 1; avctx->delay = 0; s->low_delay = 1; break; default: return -1; } avctx->has_b_frames = !s->low_delay; s->encoding = 1; s->progressive_frame = s->progressive_sequence = !(avctx->flags & (AV_CODEC_FLAG_INTERLACED_DCT | AV_CODEC_FLAG_INTERLACED_ME) || s->alternate_scan); /* init */ ff_mpv_idct_init(s); if (ff_mpv_common_init(s) < 0) return -1; if (ARCH_X86) ff_mpv_encode_init_x86(s); ff_fdctdsp_init(&s->fdsp, avctx); ff_me_cmp_init(&s->mecc, avctx); ff_mpegvideoencdsp_init(&s->mpvencdsp, avctx); ff_pixblockdsp_init(&s->pdsp, avctx); ff_qpeldsp_init(&s->qdsp); if (s->msmpeg4_version) { FF_ALLOCZ_OR_GOTO(s->avctx, s->ac_stats, 2 * 2 * (MAX_LEVEL + 1) * (MAX_RUN + 1) * 2 * sizeof(int), fail); } FF_ALLOCZ_OR_GOTO(s->avctx, s->avctx->stats_out, 256, fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix, 64 * 32 * sizeof(int), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix, 64 * 32 * sizeof(int), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->q_intra_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->q_inter_matrix16, 64 * 32 * 2 * sizeof(uint16_t), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->input_picture, MAX_PICTURE_COUNT * sizeof(Picture *), fail); FF_ALLOCZ_OR_GOTO(s->avctx, s->reordered_input_picture, MAX_PICTURE_COUNT * sizeof(Picture *), fail); if (s->avctx->noise_reduction) { FF_ALLOCZ_OR_GOTO(s->avctx, s->dct_offset, 2 * 64 * sizeof(uint16_t), fail); } if (CONFIG_H263_ENCODER) ff_h263dsp_init(&s->h263dsp); if (!s->dct_quantize) s->dct_quantize = ff_dct_quantize_c; if (!s->denoise_dct) s->denoise_dct = denoise_dct_c; s->fast_dct_quantize = s->dct_quantize; if (avctx->trellis) s->dct_quantize = dct_quantize_trellis_c; if ((CONFIG_H263P_ENCODER || CONFIG_RV20_ENCODER) && s->modified_quant) s->chroma_qscale_table = ff_h263_chroma_qscale_table; s->quant_precision = 5; ff_set_cmp(&s->mecc, s->mecc.ildct_cmp, s->avctx->ildct_cmp); ff_set_cmp(&s->mecc, s->mecc.frame_skip_cmp, s->avctx->frame_skip_cmp); if (CONFIG_H261_ENCODER && s->out_format == FMT_H261) ff_h261_encode_init(s); if (CONFIG_H263_ENCODER && s->out_format == FMT_H263) ff_h263_encode_init(s); if (CONFIG_MSMPEG4_ENCODER && s->msmpeg4_version) if ((ret = ff_msmpeg4_encode_init(s)) < 0) return ret; if ((CONFIG_MPEG1VIDEO_ENCODER || CONFIG_MPEG2VIDEO_ENCODER) && s->out_format == FMT_MPEG1) ff_mpeg1_encode_init(s); /* init q matrix */ for (i = 0; i < 64; i++) { int j = s->idsp.idct_permutation[i]; if (CONFIG_MPEG4_ENCODER && s->codec_id == AV_CODEC_ID_MPEG4 && s->mpeg_quant) { s->intra_matrix[j] = ff_mpeg4_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg4_default_non_intra_matrix[i]; } else if (s->out_format == FMT_H263 || s->out_format == FMT_H261) { s->intra_matrix[j] = s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; } else { /* mpeg1/2 */ s->intra_matrix[j] = ff_mpeg1_default_intra_matrix[i]; s->inter_matrix[j] = ff_mpeg1_default_non_intra_matrix[i]; } if (s->avctx->intra_matrix) s->intra_matrix[j] = s->avctx->intra_matrix[i]; if (s->avctx->inter_matrix) s->inter_matrix[j] = s->avctx->inter_matrix[i]; } /* precompute matrix */ /* for mjpeg, we do include qscale in the matrix */ if (s->out_format != FMT_MJPEG) { ff_convert_matrix(s, s->q_intra_matrix, s->q_intra_matrix16, s->intra_matrix, s->intra_quant_bias, avctx->qmin, 31, 1); ff_convert_matrix(s, s->q_inter_matrix, s->q_inter_matrix16, s->inter_matrix, s->inter_quant_bias, avctx->qmin, 31, 0); } if (ff_rate_control_init(s) < 0) return -1; #if FF_API_ERROR_RATE FF_DISABLE_DEPRECATION_WARNINGS if (avctx->error_rate) s->error_rate = avctx->error_rate; FF_ENABLE_DEPRECATION_WARNINGS; #endif #if FF_API_NORMALIZE_AQP FF_DISABLE_DEPRECATION_WARNINGS if (avctx->flags & CODEC_FLAG_NORMALIZE_AQP) s->mpv_flags |= FF_MPV_FLAG_NAQ; FF_ENABLE_DEPRECATION_WARNINGS; #endif #if FF_API_MV0 FF_DISABLE_DEPRECATION_WARNINGS if (avctx->flags & CODEC_FLAG_MV0) s->mpv_flags |= FF_MPV_FLAG_MV0; FF_ENABLE_DEPRECATION_WARNINGS #endif #if FF_API_MPV_OPT FF_DISABLE_DEPRECATION_WARNINGS if (avctx->rc_qsquish != 0.0) s->rc_qsquish = avctx->rc_qsquish; if (avctx->rc_qmod_amp != 0.0) s->rc_qmod_amp = avctx->rc_qmod_amp; if (avctx->rc_qmod_freq) s->rc_qmod_freq = avctx->rc_qmod_freq; if (avctx->rc_buffer_aggressivity != 1.0) s->rc_buffer_aggressivity = avctx->rc_buffer_aggressivity; if (avctx->rc_initial_cplx != 0.0) s->rc_initial_cplx = avctx->rc_initial_cplx; if (avctx->lmin) s->lmin = avctx->lmin; if (avctx->lmax) s->lmax = avctx->lmax; if (avctx->rc_eq) { av_freep(&s->rc_eq); s->rc_eq = av_strdup(avctx->rc_eq); if (!s->rc_eq) return AVERROR(ENOMEM); } FF_ENABLE_DEPRECATION_WARNINGS #endif if (avctx->b_frame_strategy == 2) { for (i = 0; i < s->max_b_frames + 2; i++) { s->tmp_frames[i] = av_frame_alloc(); if (!s->tmp_frames[i]) return AVERROR(ENOMEM); s->tmp_frames[i]->format = AV_PIX_FMT_YUV420P; s->tmp_frames[i]->width = s->width >> avctx->brd_scale; s->tmp_frames[i]->height = s->height >> avctx->brd_scale; ret = av_frame_get_buffer(s->tmp_frames[i], 32); if (ret < 0) return ret; } } return 0; fail: ff_mpv_encode_end(avctx); return AVERROR_UNKNOWN; }
1
102,824
static inline loff_t *io_kiocb_update_pos(struct io_kiocb *req) { struct kiocb *kiocb = &req->rw.kiocb; if (kiocb->ki_pos != -1) return &kiocb->ki_pos; if (!(req->file->f_mode & FMODE_STREAM)) { req->flags |= REQ_F_CUR_POS; kiocb->ki_pos = req->file->f_pos; return &kiocb->ki_pos; } kiocb->ki_pos = 0; return NULL; }
0
310,188
nfsd4_encode_lock(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_lock *lock) { struct xdr_stream *xdr = &resp->xdr; if (!nfserr) nfserr = nfsd4_encode_stateid(xdr, &lock->lk_resp_stateid); else if (nfserr == nfserr_denied) nfserr = nfsd4_encode_lock_denied(xdr, &lock->lk_denied); return nfserr; }
0
58,465
int do_netdev_del(Monitor *mon, const QDict *qdict, QObject **ret_data) { const char *id = qdict_get_str(qdict, "id"); VLANClientState *vc; vc = qemu_find_netdev(id); if (!vc || vc->info->type == NET_CLIENT_TYPE_NIC) { qerror_report(QERR_DEVICE_NOT_FOUND, id); return -1; } if (vc->peer) { qerror_report(QERR_DEVICE_IN_USE, id); return -1; } qemu_del_vlan_client(vc); qemu_opts_del(qemu_opts_find(&qemu_netdev_opts, id)); return 0; }
0
447,858
SendDeviceLedFBs(DeviceIntPtr dev, int class, int id, unsigned wantLength, ClientPtr client) { int length = 0; if (class == XkbDfltXIClass) { if (dev->kbdfeed) class = KbdFeedbackClass; else if (dev->leds) class = LedFeedbackClass; } if ((dev->kbdfeed) && ((class == KbdFeedbackClass) || (class == XkbAllXIClasses))) { KbdFeedbackPtr kf; for (kf = dev->kbdfeed; (kf); kf = kf->next) { if ((id == XkbAllXIIds) || (id == XkbDfltXIId) || (id == kf->ctrl.id)) { length += SendDeviceLedInfo(kf->xkb_sli, client); if (id != XkbAllXIIds) break; } } } if ((dev->leds) && ((class == LedFeedbackClass) || (class == XkbAllXIClasses))) { LedFeedbackPtr lf; for (lf = dev->leds; (lf); lf = lf->next) { if ((id == XkbAllXIIds) || (id == XkbDfltXIId) || (id == lf->ctrl.id)) { length += SendDeviceLedInfo(lf->xkb_sli, client); if (id != XkbAllXIIds) break; } } } if (length == wantLength) return Success; else return BadLength; }
0
338,772
int net_client_init(const char *device, const char *p) { static const char * const fd_params[] = { "vlan", "name", "fd", NULL }; char buf[1024]; int vlan_id, ret; VLANState *vlan; char *name = NULL; vlan_id = 0; if (get_param_value(buf, sizeof(buf), "vlan", p)) { vlan_id = strtol(buf, NULL, 0); } vlan = qemu_find_vlan(vlan_id); if (get_param_value(buf, sizeof(buf), "name", p)) { name = strdup(buf); } if (!strcmp(device, "nic")) { static const char * const nic_params[] = { "vlan", "name", "macaddr", "model", NULL }; NICInfo *nd; uint8_t *macaddr; int idx = nic_get_free_idx(); if (check_params(nic_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } if (idx == -1 || nb_nics >= MAX_NICS) { fprintf(stderr, "Too Many NICs\n"); ret = -1; goto out; } nd = &nd_table[idx]; macaddr = nd->macaddr; macaddr[0] = 0x52; macaddr[1] = 0x54; macaddr[2] = 0x00; macaddr[3] = 0x12; macaddr[4] = 0x34; macaddr[5] = 0x56 + idx; if (get_param_value(buf, sizeof(buf), "macaddr", p)) { if (parse_macaddr(macaddr, buf) < 0) { fprintf(stderr, "invalid syntax for ethernet address\n"); ret = -1; goto out; } } if (get_param_value(buf, sizeof(buf), "model", p)) { nd->model = strdup(buf); } nd->vlan = vlan; nd->name = name; nd->used = 1; name = NULL; nb_nics++; vlan->nb_guest_devs++; ret = idx; } else if (!strcmp(device, "none")) { if (*p != '\0') { fprintf(stderr, "qemu: 'none' takes no parameters\n"); return -1; } /* does nothing. It is needed to signal that no network cards are wanted */ ret = 0; } else #ifdef CONFIG_SLIRP if (!strcmp(device, "user")) { static const char * const slirp_params[] = { "vlan", "name", "hostname", "restrict", "ip", NULL }; if (check_params(slirp_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } if (get_param_value(buf, sizeof(buf), "hostname", p)) { pstrcpy(slirp_hostname, sizeof(slirp_hostname), buf); } if (get_param_value(buf, sizeof(buf), "restrict", p)) { slirp_restrict = (buf[0] == 'y') ? 1 : 0; } if (get_param_value(buf, sizeof(buf), "ip", p)) { slirp_ip = strdup(buf); } vlan->nb_host_devs++; ret = net_slirp_init(vlan, device, name); } else if (!strcmp(device, "channel")) { long port; char name[20], *devname; struct VMChannel *vmc; port = strtol(p, &devname, 10); devname++; if (port < 1 || port > 65535) { fprintf(stderr, "vmchannel wrong port number\n"); ret = -1; goto out; } vmc = malloc(sizeof(struct VMChannel)); snprintf(name, 20, "vmchannel%ld", port); vmc->hd = qemu_chr_open(name, devname, NULL); if (!vmc->hd) { fprintf(stderr, "qemu: could not open vmchannel device" "'%s'\n", devname); ret = -1; goto out; } vmc->port = port; slirp_add_exec(3, vmc->hd, 4, port); qemu_chr_add_handlers(vmc->hd, vmchannel_can_read, vmchannel_read, NULL, vmc); ret = 0; } else #endif #ifdef _WIN32 if (!strcmp(device, "tap")) { static const char * const tap_params[] = { "vlan", "name", "ifname", NULL }; char ifname[64]; if (check_params(tap_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { fprintf(stderr, "tap: no interface name\n"); ret = -1; goto out; } vlan->nb_host_devs++; ret = tap_win32_init(vlan, device, name, ifname); } else #elif defined (_AIX) #else if (!strcmp(device, "tap")) { char ifname[64]; char setup_script[1024], down_script[1024]; int fd; vlan->nb_host_devs++; if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { if (check_params(fd_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } fd = strtol(buf, NULL, 0); fcntl(fd, F_SETFL, O_NONBLOCK); net_tap_fd_init(vlan, device, name, fd); ret = 0; } else { static const char * const tap_params[] = { "vlan", "name", "ifname", "script", "downscript", NULL }; if (check_params(tap_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } if (get_param_value(ifname, sizeof(ifname), "ifname", p) <= 0) { ifname[0] = '\0'; } if (get_param_value(setup_script, sizeof(setup_script), "script", p) == 0) { pstrcpy(setup_script, sizeof(setup_script), DEFAULT_NETWORK_SCRIPT); } if (get_param_value(down_script, sizeof(down_script), "downscript", p) == 0) { pstrcpy(down_script, sizeof(down_script), DEFAULT_NETWORK_DOWN_SCRIPT); } ret = net_tap_init(vlan, device, name, ifname, setup_script, down_script); } } else #endif if (!strcmp(device, "socket")) { if (get_param_value(buf, sizeof(buf), "fd", p) > 0) { int fd; if (check_params(fd_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } fd = strtol(buf, NULL, 0); ret = -1; if (net_socket_fd_init(vlan, device, name, fd, 1)) ret = 0; } else if (get_param_value(buf, sizeof(buf), "listen", p) > 0) { static const char * const listen_params[] = { "vlan", "name", "listen", NULL }; if (check_params(listen_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } ret = net_socket_listen_init(vlan, device, name, buf); } else if (get_param_value(buf, sizeof(buf), "connect", p) > 0) { static const char * const connect_params[] = { "vlan", "name", "connect", NULL }; if (check_params(connect_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } ret = net_socket_connect_init(vlan, device, name, buf); } else if (get_param_value(buf, sizeof(buf), "mcast", p) > 0) { static const char * const mcast_params[] = { "vlan", "name", "mcast", NULL }; if (check_params(mcast_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } ret = net_socket_mcast_init(vlan, device, name, buf); } else { fprintf(stderr, "Unknown socket options: %s\n", p); ret = -1; goto out; } vlan->nb_host_devs++; } else #ifdef CONFIG_VDE if (!strcmp(device, "vde")) { static const char * const vde_params[] = { "vlan", "name", "sock", "port", "group", "mode", NULL }; char vde_sock[1024], vde_group[512]; int vde_port, vde_mode; if (check_params(vde_params, p) < 0) { fprintf(stderr, "qemu: invalid parameter '%s' in '%s'\n", buf, p); return -1; } vlan->nb_host_devs++; if (get_param_value(vde_sock, sizeof(vde_sock), "sock", p) <= 0) { vde_sock[0] = '\0'; } if (get_param_value(buf, sizeof(buf), "port", p) > 0) { vde_port = strtol(buf, NULL, 10); } else { vde_port = 0; } if (get_param_value(vde_group, sizeof(vde_group), "group", p) <= 0) { vde_group[0] = '\0'; } if (get_param_value(buf, sizeof(buf), "mode", p) > 0) { vde_mode = strtol(buf, NULL, 8); } else { vde_mode = 0700; } ret = net_vde_init(vlan, device, name, vde_sock, vde_port, vde_group, vde_mode); } else #endif if (!strcmp(device, "dump")) { int len = 65536; if (get_param_value(buf, sizeof(buf), "len", p) > 0) { len = strtol(buf, NULL, 0); } if (!get_param_value(buf, sizeof(buf), "file", p)) { snprintf(buf, sizeof(buf), "qemu-vlan%d.pcap", vlan_id); } ret = net_dump_init(vlan, device, name, buf, len); } else { fprintf(stderr, "Unknown network device: %s\n", device); ret = -1; goto out; } if (ret < 0) { fprintf(stderr, "Could not initialize device '%s'\n", device); } out: if (name) free(name); return ret; }
0
212,165
void GLES2DecoderImpl::DoCommitOverlayPlanes(uint64_t swap_id, GLbitfield flags) { TRACE_EVENT0("gpu", "GLES2DecoderImpl::DoCommitOverlayPlanes"); if (!supports_commit_overlay_planes_) { LOCAL_SET_GL_ERROR(GL_INVALID_OPERATION, "glCommitOverlayPlanes", "command not supported by surface"); return; } ClearScheduleCALayerState(); if (supports_async_swap_) { client()->OnSwapBuffers(swap_id, flags); surface_->CommitOverlayPlanesAsync( base::BindOnce(&GLES2DecoderImpl::FinishAsyncSwapBuffers, weak_ptr_factory_.GetWeakPtr(), swap_id), base::DoNothing()); } else { client()->OnSwapBuffers(swap_id, flags); FinishSwapBuffers(surface_->CommitOverlayPlanes(base::DoNothing())); } }
0
469,224
static struct xfrm6_tunnel_spi *__xfrm6_tunnel_spi_lookup(struct net *net, const xfrm_address_t *saddr) { struct xfrm6_tunnel_net *xfrm6_tn = xfrm6_tunnel_pernet(net); struct xfrm6_tunnel_spi *x6spi; hlist_for_each_entry_rcu(x6spi, &xfrm6_tn->spi_byaddr[xfrm6_tunnel_spi_hash_byaddr(saddr)], list_byaddr) { if (xfrm6_addr_equal(&x6spi->addr, saddr)) return x6spi; } return NULL; }
0
52,647
static int ext4_delete_entry(handle_t *handle, struct inode *dir, struct ext4_dir_entry_2 *de_del, struct buffer_head *bh) { int err, csum_size = 0; if (ext4_has_inline_data(dir)) { int has_inline_data = 1; err = ext4_delete_inline_entry(handle, dir, de_del, bh, &has_inline_data); if (has_inline_data) return err; } if (EXT4_HAS_RO_COMPAT_FEATURE(dir->i_sb, EXT4_FEATURE_RO_COMPAT_METADATA_CSUM)) csum_size = sizeof(struct ext4_dir_entry_tail); BUFFER_TRACE(bh, "get_write_access"); err = ext4_journal_get_write_access(handle, bh); if (unlikely(err)) goto out; err = ext4_generic_delete_entry(handle, dir, de_del, bh, bh->b_data, dir->i_sb->s_blocksize, csum_size); if (err) goto out; BUFFER_TRACE(bh, "call ext4_handle_dirty_metadata"); err = ext4_handle_dirty_dirent_node(handle, dir, bh); if (unlikely(err)) goto out; return 0; out: if (err != -ENOENT) ext4_std_error(dir->i_sb, err); return err; }
0
254,692
void RenderThreadImpl::OnCreateNewView(const ViewMsg_New_Params& params) { EnsureWebKitInitialized(); RenderViewImpl::Create(params.opener_route_id, params.window_was_created_with_opener, params.renderer_preferences, params.web_preferences, params.view_id, params.main_frame_routing_id, params.surface_id, params.session_storage_namespace_id, params.frame_name, false, params.swapped_out, params.proxy_routing_id, params.hidden, params.never_visible, params.next_page_id, params.screen_info); }
0
213,977
::ppapi::TrackerBase* GetTrackerBase() { return ResourceTracker::Get(); }
0
189,788
void ExtensionTtsController::CheckSpeechStatus() { std::set<std::string> desired_event_types; if (options->HasKey(constants::kDesiredEventTypesKey)) { ListValue* list; EXTENSION_FUNCTION_VALIDATE( options->GetList(constants::kDesiredEventTypesKey, &list)); for (size_t i = 0; i < list->GetSize(); i++) { std::string event_type; if (!list->GetString(i, &event_type)) desired_event_types.insert(event_type); } } std::string voice_extension_id; if (options->HasKey(constants::kExtensionIdKey)) { EXTENSION_FUNCTION_VALIDATE( options->GetString(constants::kExtensionIdKey, &voice_extension_id)); }
0
189,251
void GLES2DecoderWithShaderTestBase::SetUp() { GLES2DecoderTestBase::SetUp(); { static AttribInfo attribs[] = { { kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, }, { kAttrib2Name, kAttrib2Size, kAttrib2Type, kAttrib2Location, }, { kAttrib3Name, kAttrib3Size, kAttrib3Type, kAttrib3Location, }, }; static UniformInfo uniforms[] = { { kUniform1Name, kUniform1Size, kUniform1Type, kUniform1Location, }, { kUniform2Name, kUniform2Size, kUniform2Type, kUniform2Location, }, { kUniform3Name, kUniform3Size, kUniform3Type, kUniform3Location, }, }; SetupShader(attribs, arraysize(attribs), uniforms, arraysize(uniforms), client_program_id_, kServiceProgramId, client_vertex_shader_id_, kServiceVertexShaderId, client_fragment_shader_id_, kServiceFragmentShaderId); } { EXPECT_CALL(*gl_, UseProgram(kServiceProgramId)) .Times(1) .RetiresOnSaturation(); UseProgram cmd; cmd.Init(client_program_id_); EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); } }
0
315,835
static void phar_mung_server_vars(char *fname, char *entry, int entry_len, char *basename, int request_uri_len TSRMLS_DC) /* {{{ */ { HashTable *_SERVER; zval **stuff; char *path_info; int basename_len = strlen(basename); int code; zval *temp; /* "tweak" $_SERVER variables requested in earlier call to Phar::mungServer() */ if (!PG(http_globals)[TRACK_VARS_SERVER]) { return; } _SERVER = Z_ARRVAL_P(PG(http_globals)[TRACK_VARS_SERVER]); /* PATH_INFO and PATH_TRANSLATED should always be munged */ if (SUCCESS == zend_hash_find(_SERVER, "PATH_INFO", sizeof("PATH_INFO"), (void **) &stuff)) { path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); if (Z_STRLEN_PP(stuff) > entry_len && !memcmp(Z_STRVAL_PP(stuff), entry, entry_len)) { ZVAL_STRINGL(*stuff, Z_STRVAL_PP(stuff) + entry_len, request_uri_len, 1); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); zend_hash_update(_SERVER, "PHAR_PATH_INFO", sizeof("PHAR_PATH_INFO"), &temp, sizeof(zval **), NULL); } } if (SUCCESS == zend_hash_find(_SERVER, "PATH_TRANSLATED", sizeof("PATH_TRANSLATED"), (void **) &stuff)) { path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); Z_STRLEN_PP(stuff) = spprintf(&(Z_STRVAL_PP(stuff)), 4096, "phar://%s%s", fname, entry); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); zend_hash_update(_SERVER, "PHAR_PATH_TRANSLATED", sizeof("PHAR_PATH_TRANSLATED"), (void *) &temp, sizeof(zval **), NULL); } if (!PHAR_GLOBALS->phar_SERVER_mung_list) { return; } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_REQUEST_URI) { if (SUCCESS == zend_hash_find(_SERVER, "REQUEST_URI", sizeof("REQUEST_URI"), (void **) &stuff)) { path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); if (Z_STRLEN_PP(stuff) > basename_len && !memcmp(Z_STRVAL_PP(stuff), basename, basename_len)) { ZVAL_STRINGL(*stuff, Z_STRVAL_PP(stuff) + basename_len, Z_STRLEN_PP(stuff) - basename_len, 1); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); zend_hash_update(_SERVER, "PHAR_REQUEST_URI", sizeof("PHAR_REQUEST_URI"), (void *) &temp, sizeof(zval **), NULL); } } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_PHP_SELF) { if (SUCCESS == zend_hash_find(_SERVER, "PHP_SELF", sizeof("PHP_SELF"), (void **) &stuff)) { path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); if (Z_STRLEN_PP(stuff) > basename_len && !memcmp(Z_STRVAL_PP(stuff), basename, basename_len)) { ZVAL_STRINGL(*stuff, Z_STRVAL_PP(stuff) + basename_len, Z_STRLEN_PP(stuff) - basename_len, 1); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); zend_hash_update(_SERVER, "PHAR_PHP_SELF", sizeof("PHAR_PHP_SELF"), (void *) &temp, sizeof(zval **), NULL); } } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_SCRIPT_NAME) { if (SUCCESS == zend_hash_find(_SERVER, "SCRIPT_NAME", sizeof("SCRIPT_NAME"), (void **) &stuff)) { path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); ZVAL_STRINGL(*stuff, entry, entry_len, 1); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); zend_hash_update(_SERVER, "PHAR_SCRIPT_NAME", sizeof("PHAR_SCRIPT_NAME"), (void *) &temp, sizeof(zval **), NULL); } } if (PHAR_GLOBALS->phar_SERVER_mung_list & PHAR_MUNG_SCRIPT_FILENAME) { if (SUCCESS == zend_hash_find(_SERVER, "SCRIPT_FILENAME", sizeof("SCRIPT_FILENAME"), (void **) &stuff)) { path_info = Z_STRVAL_PP(stuff); code = Z_STRLEN_PP(stuff); Z_STRLEN_PP(stuff) = spprintf(&(Z_STRVAL_PP(stuff)), 4096, "phar://%s%s", fname, entry); MAKE_STD_ZVAL(temp); ZVAL_STRINGL(temp, path_info, code, 0); zend_hash_update(_SERVER, "PHAR_SCRIPT_FILENAME", sizeof("PHAR_SCRIPT_FILENAME"), (void *) &temp, sizeof(zval **), NULL); } } } /* }}} */
0
228,382
static void overloadedPerWorldBindingsMethod1Method(const v8::FunctionCallbackInfo<v8::Value>& info) { TestObjectPython* imp = V8TestObjectPython::toNative(info.Holder()); imp->overloadedPerWorldBindingsMethod(); }
0
229,961
e1000e_set_tidv(E1000ECore *core, int index, uint32_t val) { e1000e_set_16bit(core, index, val); if ((val & E1000_TIDV_FPD) && (core->tidv.running)) { trace_e1000e_irq_tidv_fpd_running(); e1000e_intrmgr_fire_delayed_interrupts(core); } else { trace_e1000e_irq_tidv_fpd_not_running(); } }
0
166,671
BluetoothSocketAsyncApiFunction::BluetoothSocketAsyncApiFunction() {}
0
338,003
static int dts_probe(AVProbeData *p) { const uint8_t *buf, *bufp; uint32_t state = -1; int markers[4*16] = {0}; int exss_markers = 0, exss_nextpos = 0; int sum, max, pos, i; int64_t diff = 0; uint8_t hdr[12 + AV_INPUT_BUFFER_PADDING_SIZE] = { 0 }; for (pos = FFMIN(4096, p->buf_size); pos < p->buf_size - 2; pos += 2) { int marker, sample_blocks, sample_rate, sr_code, framesize; int lfe, wide_hdr, hdr_size; GetBitContext gb; bufp = buf = p->buf + pos; state = (state << 16) | bytestream_get_be16(&bufp); if (pos >= 4) diff += FFABS(((int16_t)AV_RL16(buf)) - (int16_t)AV_RL16(buf-4)); /* extension substream (EXSS) */ if (state == DCA_SYNCWORD_SUBSTREAM) { if (pos < exss_nextpos) continue; init_get_bits(&gb, buf - 2, 96); skip_bits_long(&gb, 42); wide_hdr = get_bits1(&gb); hdr_size = get_bits(&gb, 8 + 4 * wide_hdr) + 1; framesize = get_bits(&gb, 16 + 4 * wide_hdr) + 1; if (hdr_size & 3 || framesize & 3) continue; if (hdr_size < 16 || framesize < hdr_size) continue; if (pos - 2 + hdr_size > p->buf_size) continue; if (av_crc(av_crc_get_table(AV_CRC_16_CCITT), 0xffff, buf + 3, hdr_size - 5)) continue; if (pos == exss_nextpos) exss_markers++; else exss_markers = FFMAX(1, exss_markers - 1); exss_nextpos = pos + framesize; continue; } /* regular bitstream */ if (state == DCA_SYNCWORD_CORE_BE && (bytestream_get_be16(&bufp) & 0xFC00) == 0xFC00) marker = 0; else if (state == DCA_SYNCWORD_CORE_LE && (bytestream_get_be16(&bufp) & 0x00FC) == 0x00FC) marker = 1; /* 14 bits big-endian bitstream */ else if (state == DCA_SYNCWORD_CORE_14B_BE && (bytestream_get_be16(&bufp) & 0xFFF0) == 0x07F0) marker = 2; /* 14 bits little-endian bitstream */ else if (state == DCA_SYNCWORD_CORE_14B_LE && (bytestream_get_be16(&bufp) & 0xF0FF) == 0xF007) marker = 3; else continue; if (avpriv_dca_convert_bitstream(buf-2, 12, hdr, 12) < 0) continue; init_get_bits(&gb, hdr, 96); skip_bits_long(&gb, 39); sample_blocks = get_bits(&gb, 7) + 1; if (sample_blocks < 8) continue; framesize = get_bits(&gb, 14) + 1; if (framesize < 95) continue; skip_bits(&gb, 6); sr_code = get_bits(&gb, 4); sample_rate = avpriv_dca_sample_rates[sr_code]; if (sample_rate == 0) continue; get_bits(&gb, 5); if (get_bits(&gb, 1)) continue; skip_bits_long(&gb, 9); lfe = get_bits(&gb, 2); if (lfe > 2) continue; marker += 4* sr_code; markers[marker] ++; } if (exss_markers > 3) return AVPROBE_SCORE_EXTENSION + 1; sum = max = 0; for (i=0; i<FF_ARRAY_ELEMS(markers); i++) { sum += markers[i]; if (markers[max] < markers[i]) max = i; } if (markers[max] > 3 && p->buf_size / markers[max] < 32*1024 && markers[max] * 4 > sum * 3 && diff / p->buf_size > 200) return AVPROBE_SCORE_EXTENSION + 1; return 0; }
0
456,819
static inline int free_consistency_checks(struct kmem_cache *s, struct page *page, void *object, unsigned long addr) { if (!check_valid_pointer(s, page, object)) { slab_err(s, page, "Invalid object pointer 0x%p", object); return 0; } if (on_freelist(s, page, object)) { object_err(s, page, object, "Object already free"); return 0; } if (!check_object(s, page, object, SLUB_RED_ACTIVE)) return 0; if (unlikely(s != page->slab_cache)) { if (!PageSlab(page)) { slab_err(s, page, "Attempt to free object(0x%p) outside of slab", object); } else if (!page->slab_cache) { pr_err("SLUB <none>: no slab for object 0x%p.\n", object); dump_stack(); } else object_err(s, page, object, "page slab pointer corrupt."); return 0; } return 1; }
0
59,101
sshpkt_get_bignum2(struct ssh *ssh, BIGNUM *v) { return sshbuf_get_bignum2(ssh->state->incoming_packet, v); }
0
239,664
void Browser::TabSelectedAt(TabContentsWrapper* old_contents, TabContentsWrapper* new_contents, int index, bool user_gesture) { if (old_contents == new_contents) return; if (user_gesture && new_contents->tab_contents()->crashed_status() == base::TERMINATION_STATUS_PROCESS_WAS_KILLED) { const CommandLine& parsed_command_line = *CommandLine::ForCurrentProcess(); if (parsed_command_line.HasSwitch(switches::kReloadKilledTabs)) { Reload(CURRENT_TAB); return; } } if (!chrome_updater_factory_.empty() && old_contents) ProcessPendingUIUpdates(); UpdateToolbar(true); UpdateReloadStopState(new_contents->tab_contents()->is_loading(), true); UpdateCommandsForTabState(); StatusBubble* status_bubble = GetStatusBubble(); if (status_bubble) { status_bubble->Hide(); status_bubble->SetStatus(GetSelectedTabContentsWrapper()->GetStatusText()); } if (HasFindBarController()) { find_bar_controller_->ChangeTabContents(new_contents); find_bar_controller_->find_bar()->MoveWindowIfNecessary(gfx::Rect(), true); } if (profile_->HasSessionService()) { SessionService* session_service = profile_->GetSessionService(); if (session_service && !tab_handler_->GetTabStripModel()->closing_all()) { session_service->SetSelectedTabInWindow( session_id(), tab_handler_->GetTabStripModel()->active_index()); } } }
0
108,380
static int regex_match_full(char *str, struct regex *r, int len) { /* len of zero means str is dynamic and ends with '\0' */ if (!len) return strcmp(str, r->pattern) == 0; return strncmp(str, r->pattern, len) == 0; }
0
257,516
static int dissect_h225_h225_RasMessage ( tvbuff_t * tvb , packet_info * pinfo , proto_tree * tree , void * data _U_ ) { proto_item * it ; proto_tree * tr ; guint32 offset = 0 ; h225_packet_info * h225_pi ; h225_pi = create_h225_packet_info ( pinfo ) ; h225_pi -> msg_type = H225_RAS ; p_add_proto_data ( wmem_packet_scope ( ) , pinfo , proto_h225 , 0 , h225_pi ) ; col_set_str ( pinfo -> cinfo , COL_PROTOCOL , PSNAME ) ; it = proto_tree_add_protocol_format ( tree , proto_h225 , tvb , offset , - 1 , PSNAME " RAS" ) ; tr = proto_item_add_subtree ( it , ett_h225 ) ; offset = dissect_RasMessage_PDU ( tvb , pinfo , tr , NULL ) ; ras_call_matching ( tvb , pinfo , tr , h225_pi ) ; tap_queue_packet ( h225_tap , pinfo , h225_pi ) ; return offset ; }
0
479,813
CImg<ulongT> get_label(const bool is_high_connectivity=false, const Tfloat tolerance=0, const bool is_L2_norm=true) const { if (is_empty()) return CImg<ulongT>(); // Create neighborhood tables. int dx[13], dy[13], dz[13], nb = 0; dx[nb] = 1; dy[nb] = 0; dz[nb++] = 0; dx[nb] = 0; dy[nb] = 1; dz[nb++] = 0; if (is_high_connectivity) { dx[nb] = 1; dy[nb] = 1; dz[nb++] = 0; dx[nb] = 1; dy[nb] = -1; dz[nb++] = 0; } if (_depth>1) { // 3D version dx[nb] = 0; dy[nb] = 0; dz[nb++]=1; if (is_high_connectivity) { dx[nb] = 1; dy[nb] = 1; dz[nb++] = -1; dx[nb] = 1; dy[nb] = 0; dz[nb++] = -1; dx[nb] = 1; dy[nb] = -1; dz[nb++] = -1; dx[nb] = 0; dy[nb] = 1; dz[nb++] = -1; dx[nb] = 0; dy[nb] = 1; dz[nb++] = 1; dx[nb] = 1; dy[nb] = -1; dz[nb++] = 1; dx[nb] = 1; dy[nb] = 0; dz[nb++] = 1; dx[nb] = 1; dy[nb] = 1; dz[nb++] = 1; } } return _label(nb,dx,dy,dz,tolerance,is_L2_norm); }
0
36,555
static void cbcmac_exit_tfm(struct crypto_tfm *tfm) { struct cbcmac_tfm_ctx *ctx = crypto_tfm_ctx(tfm); crypto_free_cipher(ctx->child); }
0
97,209
void BinaryProtocolReader::readI32(int32_t& i32) { i32 = in_.readBE<int32_t>(); }
0
293,258
line_interpt(PG_FUNCTION_ARGS) { LINE *l1 = PG_GETARG_LINE_P(0); LINE *l2 = PG_GETARG_LINE_P(1); Point *result; result = line_interpt_internal(l1, l2); if (result == NULL) PG_RETURN_NULL(); PG_RETURN_POINT_P(result); }
0
313,274
bool Dispatcher::IsRuntimeAvailableToContext(ScriptContext* context) { for (const auto& extension : *RendererExtensionRegistry::Get()->GetMainThreadExtensionSet()) { ExternallyConnectableInfo* info = static_cast<ExternallyConnectableInfo*>( extension->GetManifestData(manifest_keys::kExternallyConnectable)); if (info && info->matches.MatchesURL(context->url())) return true; } return false; }
0
305,999
TensorBuffer* root_buffer() override { return this; }
0
103,228
void jpeg_gdIOCtx_dest (j_compress_ptr cinfo, gdIOCtx * outfile) { my_dest_ptr dest; /* The destination object is made permanent so that multiple JPEG images * can be written to the same file without re-executing jpeg_stdio_dest. * This makes it dangerous to use this manager and a different destination * manager serially with the same JPEG object, because their private object * sizes may be different. Caveat programmer. */ if (cinfo->dest == NULL) { /* first time for this JPEG object? */ cinfo->dest = (struct jpeg_destination_mgr *) (*cinfo->mem->alloc_small) ((j_common_ptr) cinfo, JPOOL_PERMANENT, sizeof (my_destination_mgr)); } dest = (my_dest_ptr) cinfo->dest; dest->pub.init_destination = init_destination; dest->pub.empty_output_buffer = empty_output_buffer; dest->pub.term_destination = term_destination; dest->outfile = outfile; }
0
395,089
void FillFirstShaper(cmsS1Fixed14Number* Table, cmsToneCurve* Curve) { int i; cmsFloat32Number R, y; for (i=0; i < 256; i++) { R = (cmsFloat32Number) (i / 255.0); y = cmsEvalToneCurveFloat(Curve, R); if (y < 131072.0) Table[i] = DOUBLE_TO_1FIXED14(y); else Table[i] = 0x7fffffff; } }
0
276,228
void Document::writeln(const String& text, Document* ownerDocument) { write(text, ownerDocument); write("\n", ownerDocument); }
0
440,583
static u32 eth_hash(const unsigned char *addr) { u64 value = get_unaligned((u64 *)addr); /* only want 6 bytes */ #ifdef __BIG_ENDIAN value >>= 16; #else value <<= 16; #endif return hash_64(value, FDB_HASH_BITS); }
0
405,857
port_name_needs_quotes(const char *port_name) { if (!isalpha((unsigned char) port_name[0])) { return true; } for (const char *p = port_name + 1; *p; p++) { if (!isalnum((unsigned char) *p)) { return true; } } return false; }
0
423,496
dns_zone_setflag(dns_zone_t *zone, unsigned int flags, bool value) { REQUIRE(DNS_ZONE_VALID(zone)); LOCK_ZONE(zone); if (value) DNS_ZONE_SETFLAG(zone, flags); else DNS_ZONE_CLRFLAG(zone, flags); UNLOCK_ZONE(zone); }
0
289,447
static const char * hfinfo_number_vals_format64 ( const header_field_info * hfinfo , char buf [ 64 ] , guint64 value ) { int display = hfinfo -> display & FIELD_DISPLAY_E_MASK ; if ( display == BASE_NONE ) return NULL ; if ( display == BASE_DEC_HEX ) display = BASE_DEC ; if ( display == BASE_HEX_DEC ) display = BASE_HEX ; return hfinfo_number_value_format_display64 ( hfinfo , display , buf , value ) ; }
0
68,768
PHP_FUNCTION(imagealphablending) { zval *IM; zend_bool blend; gdImagePtr im; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rb", &IM, &blend) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); gdImageAlphaBlending(im, blend); RETURN_TRUE; }
0
216,799
V8LazyEventListener::V8LazyEventListener(const AtomicString& functionName, const AtomicString& eventParameterName, const String& code, const String sourceURL, const TextPosition& position, Node* node, v8::Isolate* isolate) : V8AbstractEventListener(true, DOMWrapperWorld::mainWorld(), isolate) , m_functionName(functionName) , m_eventParameterName(eventParameterName) , m_code(code) , m_sourceURL(sourceURL) , m_node(node) , m_position(position) { }
0
12,729
Blob::Blob(const KURL& srcURL, const String& type, long long size) : m_type(type) , m_size(size) { ScriptWrappable::init(this); m_internalURL = BlobURL::createInternalURL(); ThreadableBlobRegistry::registerBlobURL(0, m_internalURL, srcURL); }
1
242,216
void ScriptController::clearForOutOfMemory() { clearForClose(true); }
0
153,455
static int trace_die_handler(struct notifier_block *self, unsigned long val, void *data) { switch (val) { case DIE_OOPS: if (ftrace_dump_on_oops) ftrace_dump(ftrace_dump_on_oops); break; default: break; } return NOTIFY_OK; }
0
269,765
decode_NXAST_RAW_FIN_TIMEOUT(const struct nx_action_fin_timeout *naft, enum ofp_version ofp_version OVS_UNUSED, struct ofpbuf *out) { struct ofpact_fin_timeout *oft; oft = ofpact_put_FIN_TIMEOUT(out); oft->fin_idle_timeout = ntohs(naft->fin_idle_timeout); oft->fin_hard_timeout = ntohs(naft->fin_hard_timeout); return 0; }
0
272,830
IdentPtrList* Parser::EnsureRequestedModulesList() { if (m_currentNodeProg->sxModule.requestedModules == nullptr) { m_currentNodeProg->sxModule.requestedModules = Anew(&m_nodeAllocator, IdentPtrList, &m_nodeAllocator); } return m_currentNodeProg->sxModule.requestedModules; }
0
511,891
make_func_export_array () { char **list; SHELL_VAR **vars; vars = map_over_funcs (visible_and_exported); if (vars == 0) return (char **)NULL; list = make_env_array_from_var_list (vars); free (vars); return (list); }
0
174,662
JSValue JSTestEventTarget::indexGetter(ExecState* exec, JSValue slotBase, unsigned index) { JSTestEventTarget* thisObj = jsCast<JSTestEventTarget*>(asObject(slotBase)); ASSERT_GC_OBJECT_INHERITS(thisObj, &s_info); return toJS(exec, thisObj->globalObject(), static_cast<TestEventTarget*>(thisObj->impl())->item(index)); }
0
115,125
static int session_call_on_frame_received(nghttp2_session *session, nghttp2_frame *frame) { int rv; if (session->callbacks.on_frame_recv_callback) { rv = session->callbacks.on_frame_recv_callback(session, frame, session->user_data); if (rv != 0) { return NGHTTP2_ERR_CALLBACK_FAILURE; } } return 0; }
0
397,024
wc_ucs_to_iso2022(wc_uint32 ucs) { wc_table *t; wc_wchar_t cc; int f; if (ucs <= WC_C_UCS2_END) { for (f = 0; f <= WC_F_CS96_END - WC_F_ISO_BASE; f++) { t = &ucs_cs96_table[f]; if (t->map == NULL) continue; cc = wc_ucs_to_any((wc_uint16)ucs, t); if (!WC_CCS_IS_UNKNOWN(cc.ccs)) return cc; } for (f = 0; f <= WC_F_CS94_END - WC_F_ISO_BASE; f++) { t = &ucs_cs94_table[f]; if (t->map == NULL) continue; cc = wc_ucs_to_any((wc_uint16)ucs, t); if (!WC_CCS_IS_UNKNOWN(cc.ccs)) return cc; } for (f = 0; f <= WC_F_CS942_END - WC_F_ISO_BASE; f++) { t = &ucs_cs942_table[f]; if (t->map == NULL) continue; cc = wc_ucs_to_any((wc_uint16)ucs, t); if (!WC_CCS_IS_UNKNOWN(cc.ccs)) return cc; } } cc.ccs = WC_CCS_UNKNOWN; return cc; }
0
307,509
std::vector<RenderWidgetHostView*> GetInputEventRouterRenderWidgetHostViews( WebContents* web_contents) { return static_cast<WebContentsImpl*>(web_contents) ->GetInputEventRouter() ->GetRenderWidgetHostViewsForTests(); }
0
365,888
xmlHashGrow(xmlHashTablePtr table, int size) { unsigned long key; int oldsize, i; xmlHashEntryPtr iter, next; struct _xmlHashEntry *oldtable; #ifdef DEBUG_GROW unsigned long nbElem = 0; #endif if (table == NULL) return(-1); if (size < 8) return(-1); if (size > 8 * 2048) return(-1); oldsize = table->size; oldtable = table->table; if (oldtable == NULL) return(-1); table->table = xmlMalloc(size * sizeof(xmlHashEntry)); if (table->table == NULL) { table->table = oldtable; return(-1); } memset(table->table, 0, size * sizeof(xmlHashEntry)); table->size = size; /* If the two loops are merged, there would be situations where a new entry needs to allocated and data copied into it from the main table. So instead, we run through the array twice, first copying all the elements in the main array (where we can't get conflicts) and then the rest, so we only free (and don't allocate) */ for (i = 0; i < oldsize; i++) { if (oldtable[i].valid == 0) continue; key = xmlHashComputeKey(table, oldtable[i].name, oldtable[i].name2, oldtable[i].name3); memcpy(&(table->table[key]), &(oldtable[i]), sizeof(xmlHashEntry)); table->table[key].next = NULL; } for (i = 0; i < oldsize; i++) { iter = oldtable[i].next; while (iter) { next = iter->next; /* * put back the entry in the new table */ key = xmlHashComputeKey(table, iter->name, iter->name2, iter->name3); if (table->table[key].valid == 0) { memcpy(&(table->table[key]), iter, sizeof(xmlHashEntry)); table->table[key].next = NULL; xmlFree(iter); } else { iter->next = table->table[key].next; table->table[key].next = iter; } #ifdef DEBUG_GROW nbElem++; #endif iter = next; } } xmlFree(oldtable); #ifdef DEBUG_GROW xmlGenericError(xmlGenericErrorContext, "xmlHashGrow : from %d to %d, %d elems\n", oldsize, size, nbElem); #endif return(0); }
0
508,667
static int asn1_set_seq_out(STACK_OF(ASN1_VALUE) *sk, unsigned char **out, int skcontlen, const ASN1_ITEM *item, int do_sort, int iclass) { int i; ASN1_VALUE *skitem; unsigned char *tmpdat = NULL, *p = NULL; DER_ENC *derlst = NULL, *tder; if (do_sort) { /* Don't need to sort less than 2 items */ if (sk_ASN1_VALUE_num(sk) < 2) do_sort = 0; else { derlst = OPENSSL_malloc(sk_ASN1_VALUE_num(sk) * sizeof(*derlst)); if (!derlst) return 0; tmpdat = OPENSSL_malloc(skcontlen); if (!tmpdat) { OPENSSL_free(derlst); return 0; } } } /* If not sorting just output each item */ if (!do_sort) { for (i = 0; i < sk_ASN1_VALUE_num(sk); i++) { skitem = sk_ASN1_VALUE_value(sk, i); ASN1_item_ex_i2d(&skitem, out, item, -1, iclass); } return 1; } p = tmpdat; /* Doing sort: build up a list of each member's DER encoding */ for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) { skitem = sk_ASN1_VALUE_value(sk, i); tder->data = p; tder->length = ASN1_item_ex_i2d(&skitem, &p, item, -1, iclass); tder->field = skitem; } /* Now sort them */ qsort(derlst, sk_ASN1_VALUE_num(sk), sizeof(*derlst), der_cmp); /* Output sorted DER encoding */ p = *out; for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) { memcpy(p, tder->data, tder->length); p += tder->length; } *out = p; /* If do_sort is 2 then reorder the STACK */ if (do_sort == 2) { for (i = 0, tder = derlst; i < sk_ASN1_VALUE_num(sk); i++, tder++) (void)sk_ASN1_VALUE_set(sk, i, tder->field); } OPENSSL_free(derlst); OPENSSL_free(tmpdat); return 1; }
0
391,836
PHP_METHOD(Phar, getSupportedSignatures) { if (zend_parse_parameters_none() == FAILURE) { return; } array_init(return_value); add_next_index_stringl(return_value, "MD5", 3); add_next_index_stringl(return_value, "SHA-1", 5); #ifdef PHAR_HASH_OK add_next_index_stringl(return_value, "SHA-256", 7); add_next_index_stringl(return_value, "SHA-512", 7); #endif #if PHAR_HAVE_OPENSSL add_next_index_stringl(return_value, "OpenSSL", 7); #else if (zend_hash_str_exists(&module_registry, "openssl", sizeof("openssl")-1)) { add_next_index_stringl(return_value, "OpenSSL", 7); } #endif }
0
288,589
IN_PROC_BROWSER_TEST_F ( SitePerProcessInteractiveBrowserTest , SequentialFocusNavigation ) { GURL main_url ( embedded_test_server ( ) -> GetURL ( "a.com" , "/cross_site_iframe_factory.html?a(b,c)" ) ) ; ui_test_utils : : NavigateToURL ( browser ( ) , main_url ) ; content : : WebContents * web_contents = browser ( ) -> tab_strip_model ( ) -> GetActiveWebContents ( ) ; content : : RenderFrameHost * main_frame = web_contents -> GetMainFrame ( ) ; content : : RenderFrameHost * child1 = ChildFrameAt ( main_frame , 0 ) ; ASSERT_NE ( nullptr , child1 ) ; content : : RenderFrameHost * child2 = ChildFrameAt ( main_frame , 1 ) ; ASSERT_NE ( nullptr , child2 ) ; EXPECT_TRUE ( ExecuteScript ( main_frame , "window.name = 'root'; " ) ) ; EXPECT_TRUE ( ExecuteScript ( child1 , "window.name = 'child1'; " ) ) ; EXPECT_TRUE ( ExecuteScript ( child2 , "window.name = 'child2'; " ) ) ; std : : string script = "function onFocus(e) { " " domAutomationController.setAutomationId(0); " " domAutomationController.send(window.name + '-focused-' + e.target.id); " "} " "var input1 = document.createElement('input'); " "input1.id = 'input1'; " "var input2 = document.createElement('input'); " "input2.id = 'input2'; " "document.body.insertBefore(input1, document.body.firstChild); " "document.body.appendChild(input2); " "input1.addEventListener('focus', onFocus, false); " "input2.addEventListener('focus', onFocus, false); " ; EXPECT_TRUE ( ExecuteScript ( main_frame , script ) ) ; EXPECT_TRUE ( ExecuteScript ( child1 , script ) ) ; EXPECT_TRUE ( ExecuteScript ( child2 , script ) ) ; auto press_tab_and_wait_for_message = [ web_contents ] ( bool reverse ) { content : : DOMMessageQueue msg_queue ; std : : string reply ; SimulateKeyPress ( web_contents , ui : : DomKey : : TAB , ui : : DomCode : : TAB , ui : : VKEY_TAB , false , reverse , false , false ) ; EXPECT_TRUE ( msg_queue . WaitForMessage ( & reply ) ) ; return reply ; } ; EXPECT_EQ ( "\"root-focused-input1\"" , press_tab_and_wait_for_message ( false ) ) ; EXPECT_EQ ( main_frame , web_contents -> GetFocusedFrame ( ) ) ; EXPECT_EQ ( "\"child1-focused-input1\"" , press_tab_and_wait_for_message ( false ) ) ; EXPECT_EQ ( child1 , web_contents -> GetFocusedFrame ( ) ) ; EXPECT_EQ ( "\"child1-focused-input2\"" , press_tab_and_wait_for_message ( false ) ) ; EXPECT_EQ ( "\"child2-focused-input1\"" , press_tab_and_wait_for_message ( false ) ) ; EXPECT_EQ ( child2 , web_contents -> GetFocusedFrame ( ) ) ; EXPECT_EQ ( "\"child2-focused-input2\"" , press_tab_and_wait_for_message ( false ) ) ; EXPECT_EQ ( "\"root-focused-input2\"" , press_tab_and_wait_for_message ( false ) ) ; EXPECT_EQ ( main_frame , web_contents -> GetFocusedFrame ( ) ) ; EXPECT_EQ ( "\"child2-focused-input2\"" , press_tab_and_wait_for_message ( true ) ) ; EXPECT_EQ ( child2 , web_contents -> GetFocusedFrame ( ) ) ; EXPECT_EQ ( "\"child2-focused-input1\"" , press_tab_and_wait_for_message ( true ) ) ; EXPECT_EQ ( "\"child1-focused-input2\"" , press_tab_and_wait_for_message ( true ) ) ; EXPECT_EQ ( child1 , web_contents -> GetFocusedFrame ( ) ) ; EXPECT_EQ ( "\"child1-focused-input1\"" , press_tab_and_wait_for_message ( true ) ) ; EXPECT_EQ ( "\"root-focused-input1\"" , press_tab_and_wait_for_message ( true ) ) ; EXPECT_EQ ( main_frame , web_contents -> GetFocusedFrame ( ) ) ; }
0
37,220
UnicodeString::getTerminatedBuffer() { if(!isWritable()) { return nullptr; } UChar *array = getArrayStart(); int32_t len = length(); if(len < getCapacity()) { if(fUnion.fFields.fLengthAndFlags & kBufferIsReadonly) { // If len<capacity on a read-only alias, then array[len] is // either the original NUL (if constructed with (TRUE, s, length)) // or one of the original string contents characters (if later truncated), // therefore we can assume that array[len] is initialized memory. if(array[len] == 0) { return array; } } else if(((fUnion.fFields.fLengthAndFlags & kRefCounted) == 0 || refCount() == 1)) { // kRefCounted: Do not write the NUL if the buffer is shared. // That is mostly safe, except when the length of one copy was modified // without copy-on-write, e.g., via truncate(newLength) or remove(void). // Then the NUL would be written into the middle of another copy's string. // Otherwise, the buffer is fully writable and it is anyway safe to write the NUL. // Do not test if there is a NUL already because it might be uninitialized memory. // (That would be safe, but tools like valgrind & Purify would complain.) array[len] = 0; return array; } } if(len<INT32_MAX && cloneArrayIfNeeded(len+1)) { array = getArrayStart(); array[len] = 0; return array; } else { return nullptr; } }
0
238,368
OVS_REQUIRES(ofproto_mutex) { struct rule_collection *old_rules = &ofm->old_rules; enum ofperr error; error = collect_rules_loose(ofproto, &ofm->criteria, old_rules); if (!error) { error = modify_flows_start__(ofproto, ofm); } if (error) { rule_collection_destroy(old_rules); } return error; }
0
438,310
uint64_t max_block_additional_id() const { return max_block_additional_id_; }
0
483,841
bool device_is_bound(struct device *dev) { return dev->p && klist_node_attached(&dev->p->knode_driver); }
0
443,515
static void window_reset(struct psi_window *win, u64 now, u64 value, u64 prev_growth) { win->start_time = now; win->start_value = value; win->prev_growth = prev_growth; }
0
430,596
static apr_status_t h2_proxy_session_read(h2_proxy_session *session, int block, apr_interval_time_t timeout) { apr_status_t status = APR_SUCCESS; if (APR_BRIGADE_EMPTY(session->input)) { apr_socket_t *socket = NULL; apr_time_t save_timeout = -1; if (block) { socket = ap_get_conn_socket(session->c); if (socket) { apr_socket_timeout_get(socket, &save_timeout); apr_socket_timeout_set(socket, timeout); } else { /* cannot block on timeout */ ap_log_cerror(APLOG_MARK, APLOG_WARNING, 0, session->c, APLOGNO(03379) "h2_proxy_session(%s): unable to get conn socket", session->id); return APR_ENOTIMPL; } } status = ap_get_brigade(session->c->input_filters, session->input, AP_MODE_READBYTES, block? APR_BLOCK_READ : APR_NONBLOCK_READ, 64 * 1024); ap_log_cerror(APLOG_MARK, APLOG_TRACE3, status, session->c, "h2_proxy_session(%s): read from conn", session->id); if (socket && save_timeout != -1) { apr_socket_timeout_set(socket, save_timeout); } } if (status == APR_SUCCESS) { status = feed_brigade(session, session->input); } else if (APR_STATUS_IS_TIMEUP(status)) { /* nop */ } else if (!APR_STATUS_IS_EAGAIN(status)) { ap_log_cerror(APLOG_MARK, APLOG_DEBUG, status, session->c, APLOGNO(03380) "h2_proxy_session(%s): read error", session->id); dispatch_event(session, H2_PROXYS_EV_CONN_ERROR, status, NULL); } return status; }
0
510,338
Item *Item_static_float_func::safe_charset_converter(CHARSET_INFO *tocs) { Item_string *conv; char buf[64]; String *s, tmp(buf, sizeof(buf), &my_charset_bin); s= val_str(&tmp); if ((conv= new Item_static_string_func(func_name, s->ptr(), s->length(), s->charset()))) { conv->str_value.copy(); conv->str_value.mark_as_const(); } return conv; }
0
210,766
int32_t WebPage::finishComposition() { return d->m_inputHandler->finishComposition(); }
0
161,760
void CLASS phase_one_flat_field (int is_float, int nc) { ushort head[8]; unsigned wide, y, x, c, rend, cend, row, col; float *mrow, num, mult[4]; read_shorts (head, 8); wide = head[2] / head[4]; mrow = (float *) calloc (nc*wide, sizeof *mrow); merror (mrow, "phase_one_flat_field()"); for (y=0; y < head[3] / head[5]; y++) { for (x=0; x < wide; x++) for (c=0; c < nc; c+=2) { num = is_float ? getreal(11) : get2()/32768.0; if (y==0) mrow[c*wide+x] = num; else mrow[(c+1)*wide+x] = (num - mrow[c*wide+x]) / head[5]; } if (y==0) continue; rend = head[1] + y*head[5]; for (row = rend-head[5]; row < raw_height && row < rend; row++) { for (x=1; x < wide; x++) { for (c=0; c < nc; c+=2) { mult[c] = mrow[c*wide+x-1]; mult[c+1] = (mrow[c*wide+x] - mult[c]) / head[4]; } cend = head[0] + x*head[4]; for (col = cend-head[4]; col < raw_width && col < cend; col++) { c = nc > 2 ? FC(row-top_margin,col-left_margin) : 0; if (!(c & 1)) { c = RAW(row,col) * mult[c]; RAW(row,col) = LIM(c,0,65535); } for (c=0; c < nc; c+=2) mult[c] += mult[c+1]; } } for (x=0; x < wide; x++) for (c=0; c < nc; c+=2) mrow[c*wide+x] += mrow[(c+1)*wide+x]; } } free (mrow); }
0
380,984
int x86_emulate_insn(struct x86_emulate_ctxt *ctxt) { const struct x86_emulate_ops *ops = ctxt->ops; int rc = X86EMUL_CONTINUE; int saved_dst_type = ctxt->dst.type; ctxt->mem_read.pos = 0; /* LOCK prefix is allowed only with some instructions */ if (ctxt->lock_prefix && (!(ctxt->d & Lock) || ctxt->dst.type != OP_MEM)) { rc = emulate_ud(ctxt); goto done; } if ((ctxt->d & SrcMask) == SrcMemFAddr && ctxt->src.type != OP_MEM) { rc = emulate_ud(ctxt); goto done; } if (unlikely(ctxt->d & (No64|Undefined|Sse|Mmx|Intercept|CheckPerm|Priv|Prot|String))) { if ((ctxt->mode == X86EMUL_MODE_PROT64 && (ctxt->d & No64)) || (ctxt->d & Undefined)) { rc = emulate_ud(ctxt); goto done; } if (((ctxt->d & (Sse|Mmx)) && ((ops->get_cr(ctxt, 0) & X86_CR0_EM))) || ((ctxt->d & Sse) && !(ops->get_cr(ctxt, 4) & X86_CR4_OSFXSR))) { rc = emulate_ud(ctxt); goto done; } if ((ctxt->d & (Sse|Mmx)) && (ops->get_cr(ctxt, 0) & X86_CR0_TS)) { rc = emulate_nm(ctxt); goto done; } if (ctxt->d & Mmx) { rc = flush_pending_x87_faults(ctxt); if (rc != X86EMUL_CONTINUE) goto done; /* * Now that we know the fpu is exception safe, we can fetch * operands from it. */ fetch_possible_mmx_operand(ctxt, &ctxt->src); fetch_possible_mmx_operand(ctxt, &ctxt->src2); if (!(ctxt->d & Mov)) fetch_possible_mmx_operand(ctxt, &ctxt->dst); } if (unlikely(ctxt->guest_mode) && (ctxt->d & Intercept)) { rc = emulator_check_intercept(ctxt, ctxt->intercept, X86_ICPT_PRE_EXCEPT); if (rc != X86EMUL_CONTINUE) goto done; } /* Privileged instruction can be executed only in CPL=0 */ if ((ctxt->d & Priv) && ops->cpl(ctxt)) { if (ctxt->d & PrivUD) rc = emulate_ud(ctxt); else rc = emulate_gp(ctxt, 0); goto done; } /* Instruction can only be executed in protected mode */ if ((ctxt->d & Prot) && ctxt->mode < X86EMUL_MODE_PROT16) { rc = emulate_ud(ctxt); goto done; } /* Do instruction specific permission checks */ if (ctxt->d & CheckPerm) { rc = ctxt->check_perm(ctxt); if (rc != X86EMUL_CONTINUE) goto done; } if (unlikely(ctxt->guest_mode) && (ctxt->d & Intercept)) { rc = emulator_check_intercept(ctxt, ctxt->intercept, X86_ICPT_POST_EXCEPT); if (rc != X86EMUL_CONTINUE) goto done; } if (ctxt->rep_prefix && (ctxt->d & String)) { /* All REP prefixes have the same first termination condition */ if (address_mask(ctxt, reg_read(ctxt, VCPU_REGS_RCX)) == 0) { ctxt->eip = ctxt->_eip; ctxt->eflags &= ~EFLG_RF; goto done; } } } if ((ctxt->src.type == OP_MEM) && !(ctxt->d & NoAccess)) { rc = segmented_read(ctxt, ctxt->src.addr.mem, ctxt->src.valptr, ctxt->src.bytes); if (rc != X86EMUL_CONTINUE) goto done; ctxt->src.orig_val64 = ctxt->src.val64; } if (ctxt->src2.type == OP_MEM) { rc = segmented_read(ctxt, ctxt->src2.addr.mem, &ctxt->src2.val, ctxt->src2.bytes); if (rc != X86EMUL_CONTINUE) goto done; } if ((ctxt->d & DstMask) == ImplicitOps) goto special_insn; if ((ctxt->dst.type == OP_MEM) && !(ctxt->d & Mov)) { /* optimisation - avoid slow emulated read if Mov */ rc = segmented_read(ctxt, ctxt->dst.addr.mem, &ctxt->dst.val, ctxt->dst.bytes); if (rc != X86EMUL_CONTINUE) goto done; } ctxt->dst.orig_val = ctxt->dst.val; special_insn: if (unlikely(ctxt->guest_mode) && (ctxt->d & Intercept)) { rc = emulator_check_intercept(ctxt, ctxt->intercept, X86_ICPT_POST_MEMACCESS); if (rc != X86EMUL_CONTINUE) goto done; } if (ctxt->rep_prefix && (ctxt->d & String)) ctxt->eflags |= EFLG_RF; else ctxt->eflags &= ~EFLG_RF; if (ctxt->execute) { if (ctxt->d & Fastop) { void (*fop)(struct fastop *) = (void *)ctxt->execute; rc = fastop(ctxt, fop); if (rc != X86EMUL_CONTINUE) goto done; goto writeback; } rc = ctxt->execute(ctxt); if (rc != X86EMUL_CONTINUE) goto done; goto writeback; } if (ctxt->opcode_len == 2) goto twobyte_insn; else if (ctxt->opcode_len == 3) goto threebyte_insn; switch (ctxt->b) { case 0x63: /* movsxd */ if (ctxt->mode != X86EMUL_MODE_PROT64) goto cannot_emulate; ctxt->dst.val = (s32) ctxt->src.val; break; case 0x70 ... 0x7f: /* jcc (short) */ if (test_cc(ctxt->b, ctxt->eflags)) rc = jmp_rel(ctxt, ctxt->src.val); break; case 0x8d: /* lea r16/r32, m */ ctxt->dst.val = ctxt->src.addr.mem.ea; break; case 0x90 ... 0x97: /* nop / xchg reg, rax */ if (ctxt->dst.addr.reg == reg_rmw(ctxt, VCPU_REGS_RAX)) ctxt->dst.type = OP_NONE; else rc = em_xchg(ctxt); break; case 0x98: /* cbw/cwde/cdqe */ switch (ctxt->op_bytes) { case 2: ctxt->dst.val = (s8)ctxt->dst.val; break; case 4: ctxt->dst.val = (s16)ctxt->dst.val; break; case 8: ctxt->dst.val = (s32)ctxt->dst.val; break; } break; case 0xcc: /* int3 */ rc = emulate_int(ctxt, 3); break; case 0xcd: /* int n */ rc = emulate_int(ctxt, ctxt->src.val); break; case 0xce: /* into */ if (ctxt->eflags & EFLG_OF) rc = emulate_int(ctxt, 4); break; case 0xe9: /* jmp rel */ case 0xeb: /* jmp rel short */ rc = jmp_rel(ctxt, ctxt->src.val); ctxt->dst.type = OP_NONE; /* Disable writeback. */ break; case 0xf4: /* hlt */ ctxt->ops->halt(ctxt); break; case 0xf5: /* cmc */ /* complement carry flag from eflags reg */ ctxt->eflags ^= EFLG_CF; break; case 0xf8: /* clc */ ctxt->eflags &= ~EFLG_CF; break; case 0xf9: /* stc */ ctxt->eflags |= EFLG_CF; break; case 0xfc: /* cld */ ctxt->eflags &= ~EFLG_DF; break; case 0xfd: /* std */ ctxt->eflags |= EFLG_DF; break; default: goto cannot_emulate; } if (rc != X86EMUL_CONTINUE) goto done; writeback: if (ctxt->d & SrcWrite) { BUG_ON(ctxt->src.type == OP_MEM || ctxt->src.type == OP_MEM_STR); rc = writeback(ctxt, &ctxt->src); if (rc != X86EMUL_CONTINUE) goto done; } if (!(ctxt->d & NoWrite)) { rc = writeback(ctxt, &ctxt->dst); if (rc != X86EMUL_CONTINUE) goto done; } /* * restore dst type in case the decoding will be reused * (happens for string instruction ) */ ctxt->dst.type = saved_dst_type; if ((ctxt->d & SrcMask) == SrcSI) string_addr_inc(ctxt, VCPU_REGS_RSI, &ctxt->src); if ((ctxt->d & DstMask) == DstDI) string_addr_inc(ctxt, VCPU_REGS_RDI, &ctxt->dst); if (ctxt->rep_prefix && (ctxt->d & String)) { unsigned int count; struct read_cache *r = &ctxt->io_read; if ((ctxt->d & SrcMask) == SrcSI) count = ctxt->src.count; else count = ctxt->dst.count; register_address_increment(ctxt, reg_rmw(ctxt, VCPU_REGS_RCX), -count); if (!string_insn_completed(ctxt)) { /* * Re-enter guest when pio read ahead buffer is empty * or, if it is not used, after each 1024 iteration. */ if ((r->end != 0 || reg_read(ctxt, VCPU_REGS_RCX) & 0x3ff) && (r->end == 0 || r->end != r->pos)) { /* * Reset read cache. Usually happens before * decode, but since instruction is restarted * we have to do it here. */ ctxt->mem_read.end = 0; writeback_registers(ctxt); return EMULATION_RESTART; } goto done; /* skip rip writeback */ } ctxt->eflags &= ~EFLG_RF; } ctxt->eip = ctxt->_eip; done: if (rc == X86EMUL_PROPAGATE_FAULT) { WARN_ON(ctxt->exception.vector > 0x1f); ctxt->have_exception = true; } if (rc == X86EMUL_INTERCEPTED) return EMULATION_INTERCEPTED; if (rc == X86EMUL_CONTINUE) writeback_registers(ctxt); return (rc == X86EMUL_UNHANDLEABLE) ? EMULATION_FAILED : EMULATION_OK; twobyte_insn: switch (ctxt->b) { case 0x09: /* wbinvd */ (ctxt->ops->wbinvd)(ctxt); break; case 0x08: /* invd */ case 0x0d: /* GrpP (prefetch) */ case 0x18: /* Grp16 (prefetch/nop) */ case 0x1f: /* nop */ break; case 0x20: /* mov cr, reg */ ctxt->dst.val = ops->get_cr(ctxt, ctxt->modrm_reg); break; case 0x21: /* mov from dr to reg */ ops->get_dr(ctxt, ctxt->modrm_reg, &ctxt->dst.val); break; case 0x40 ... 0x4f: /* cmov */ if (test_cc(ctxt->b, ctxt->eflags)) ctxt->dst.val = ctxt->src.val; else if (ctxt->mode != X86EMUL_MODE_PROT64 || ctxt->op_bytes != 4) ctxt->dst.type = OP_NONE; /* no writeback */ break; case 0x80 ... 0x8f: /* jnz rel, etc*/ if (test_cc(ctxt->b, ctxt->eflags)) rc = jmp_rel(ctxt, ctxt->src.val); break; case 0x90 ... 0x9f: /* setcc r/m8 */ ctxt->dst.val = test_cc(ctxt->b, ctxt->eflags); break; case 0xb6 ... 0xb7: /* movzx */ ctxt->dst.bytes = ctxt->op_bytes; ctxt->dst.val = (ctxt->src.bytes == 1) ? (u8) ctxt->src.val : (u16) ctxt->src.val; break; case 0xbe ... 0xbf: /* movsx */ ctxt->dst.bytes = ctxt->op_bytes; ctxt->dst.val = (ctxt->src.bytes == 1) ? (s8) ctxt->src.val : (s16) ctxt->src.val; break; case 0xc3: /* movnti */ ctxt->dst.bytes = ctxt->op_bytes; ctxt->dst.val = (ctxt->op_bytes == 8) ? (u64) ctxt->src.val : (u32) ctxt->src.val; break; default: goto cannot_emulate; } threebyte_insn: if (rc != X86EMUL_CONTINUE) goto done; goto writeback; cannot_emulate: return EMULATION_FAILED; }
0
184,817
void GpuProcessHost::OnAcceleratedSurfaceSuspend(int32 surface_id) { TRACE_EVENT0("gpu", "GpuProcessHost::OnAcceleratedSurfaceSuspend"); gfx::PluginWindowHandle handle = GpuSurfaceTracker::Get()->GetSurfaceWindowHandle(surface_id); if (!handle) return; scoped_refptr<AcceleratedPresenter> presenter( AcceleratedPresenter::GetForWindow(handle)); if (!presenter) return; presenter->Suspend(); }
0
384,997
static PHP_FUNCTION(xmlwriter_full_end_element) { php_xmlwriter_end(INTERNAL_FUNCTION_PARAM_PASSTHRU, xmlTextWriterFullEndElement); }
0
269,942
void __init inode_init(void) { /* inode slab cache */ inode_cachep = kmem_cache_create("inode_cache", sizeof(struct inode), 0, (SLAB_RECLAIM_ACCOUNT|SLAB_PANIC| SLAB_MEM_SPREAD|SLAB_ACCOUNT), init_once); /* Hash may have been set up in inode_init_early */ if (!hashdist) return; inode_hashtable = alloc_large_system_hash("Inode-cache", sizeof(struct hlist_head), ihash_entries, 14, HASH_ZERO, &i_hash_shift, &i_hash_mask, 0, 0); }
0
106,055
validate_maphash(void) { if (!maphash_valid) { vim_memset(maphash, 0, sizeof(maphash)); maphash_valid = TRUE; } }
0
464,445
static void tipc_node_delete_from_list(struct tipc_node *node) { #ifdef CONFIG_TIPC_CRYPTO tipc_crypto_key_flush(node->crypto_rx); #endif list_del_rcu(&node->list); hlist_del_rcu(&node->hash); tipc_node_put(node); }
0
294,837
static int lua_apr_b64decode(lua_State *L) { const char *encoded; char *plain; size_t encoded_len, decoded_len; request_rec *r; r = ap_lua_check_request_rec(L, 1); luaL_checktype(L, 2, LUA_TSTRING); encoded = lua_tolstring(L, 2, &encoded_len); decoded_len = apr_base64_decode_len(encoded); if (decoded_len) { plain = apr_palloc(r->pool, decoded_len); decoded_len = apr_base64_decode(plain, encoded); if (decoded_len > 0 && plain[decoded_len - 1] == '\0') decoded_len--; lua_pushlstring(L, plain, decoded_len); return 1; } return 0; }
0
15,057
static void srtp_calc_aead_iv_srtcp ( srtp_stream_ctx_t * stream , v128_t * iv , uint32_t seq_num , srtcp_hdr_t * hdr ) { v128_t in ; v128_t salt ; memset ( & in , 0 , sizeof ( v128_t ) ) ; memset ( & salt , 0 , sizeof ( v128_t ) ) ; in . v16 [ 0 ] = 0 ; memcpy ( & in . v16 [ 1 ] , & hdr -> ssrc , 4 ) ; in . v16 [ 3 ] = 0 ; in . v32 [ 2 ] = 0x7FFFFFFF & htonl ( seq_num ) ; debug_print ( mod_srtp , "Pre-salted RTCP IV = %s\n" , v128_hex_string ( & in ) ) ; memcpy ( salt . v8 , stream -> c_salt , 12 ) ; debug_print ( mod_srtp , "RTCP SALT = %s\n" , v128_hex_string ( & salt ) ) ; v128_xor ( iv , & in , & salt ) ; }
0
240,406
void Splash::dumpXPath(SplashXPath *path) { int i; for (i = 0; i < path->length; ++i) { printf(" %4d: x0=%8.2f y0=%8.2f x1=%8.2f y1=%8.2f %s%s%s%s%s%s%s\n", i, (double)path->segs[i].x0, (double)path->segs[i].y0, (double)path->segs[i].x1, (double)path->segs[i].y1, (path->segs[i].flags & splashXPathFirst) ? "F" : " ", (path->segs[i].flags & splashXPathLast) ? "L" : " ", (path->segs[i].flags & splashXPathEnd0) ? "0" : " ", (path->segs[i].flags & splashXPathEnd1) ? "1" : " ", (path->segs[i].flags & splashXPathHoriz) ? "H" : " ", (path->segs[i].flags & splashXPathVert) ? "V" : " ", (path->segs[i].flags & splashXPathFlip) ? "P" : " "); } }
0
266,789
bool_t ipv6IsAnycastAddr(NetInterface *interface, const Ipv6Addr *ipAddr) { uint_t i; Ipv6Addr *anycastAddrList; //Point to the list of anycast addresses assigned to the interface anycastAddrList = interface->ipv6Context.anycastAddrList; //Loop through the list of IPv6 anycast addresses for(i = 0; i < IPV6_ANYCAST_ADDR_LIST_SIZE; i++) { //Valid entry? if(!ipv6CompAddr(&anycastAddrList[i], &IPV6_UNSPECIFIED_ADDR)) { //Check whether the specified address matches a valid anycast //address assigned to the interface if(ipv6CompAddr(&anycastAddrList[i], ipAddr)) { //The specified IPv6 address is an anycast address return TRUE; } } } //The specified IPv6 address is not an anycast address return FALSE; }
0
367,937
int pgmraw_to_fits (char *pgmfile, char *fitsfile) {FITS_FILE *fitsout = NULL; FILE *pgmin = NULL; FITS_HDU_LIST *hdu; char buffer[1024]; int width, height, numbytes, maxbytes; int retval = -1; fitsout = fits_open (fitsfile, "w"); if (fitsout == NULL) goto err_return; pgmin = g_fopen (pgmfile, "r"); if (pgmin == NULL) goto err_return; /* Read signature of PGM file */ if (fgets (buffer, sizeof (buffer), pgmin) == NULL) goto err_return; if ((buffer[0] != 'P') || (buffer[1] != '5')) goto err_return; /* Skip comments upto width/height */ do { if (fgets (buffer, sizeof (buffer), pgmin) == NULL) goto err_return; } while (buffer[0] == '#'); if (sscanf (buffer, "%d%d", &width, &height) != 2) goto err_return; if ((width < 1) || (height < 1)) goto err_return; /* Skip comments upto maxval */ do { if (fgets (buffer, sizeof (buffer), pgmin) == NULL) goto err_return; } while (buffer[0] == '#'); /* Ignore maxval */ hdu = fits_add_hdu (fitsout); /* Create a HDU for the FITS file */ if (hdu == NULL) goto err_return; hdu->used.simple = 1; /* Set proper values */ hdu->bitpix = 8; hdu->naxis = 2; hdu->naxisn[0] = width; hdu->naxisn[1] = height; hdu->used.datamin = 1; hdu->datamin = 0.0; hdu->used.datamax = 1; hdu->datamax = 255.0; hdu->used.bzero = 1; hdu->bzero = 0.0; hdu->used.bscale = 1; hdu->bscale = 1.0; fits_add_card (hdu, ""); fits_add_card (hdu, "HISTORY THIS FITS FILE WAS GENERATED BY FITSRW\ USING PGMRAW_TO_FITS"); /* Write the header. Blocking is done automatically */ if (fits_write_header (fitsout, hdu) < 0) goto err_return; /* The primary array plus blocking must be written manually */ numbytes = width * height; while (numbytes > 0) { maxbytes = sizeof (buffer); if (maxbytes > numbytes) maxbytes = numbytes; if (fread (buffer, 1, maxbytes, pgmin) != maxbytes) goto err_return; if (fwrite (buffer, 1, maxbytes, fitsout->fp) != maxbytes) goto err_return; numbytes -= maxbytes; } /* Do blocking */ numbytes = (width * height) % FITS_RECORD_SIZE; if (numbytes) { while (numbytes++ < FITS_RECORD_SIZE) if (putc (0, fitsout->fp) == EOF) goto err_return; } retval = 0; err_return: if (fitsout) fits_close (fitsout); if (pgmin) fclose (pgmin); return (retval); }
0
63,246
int _cdk_sk_get_csum(cdk_pkt_seckey_t sk) { u16 csum = 0, i; if (!sk) return 0; for (i = 0; i < cdk_pk_get_nskey(sk->pubkey_algo); i++) csum += checksum_mpi(sk->mpi[i]); return csum; }
0
349,562
HiiGetDatabaseInfo( IN CONST EFI_HII_DATABASE_PROTOCOL *This ) { EFI_STATUS Status; EFI_HII_PACKAGE_LIST_HEADER *DatabaseInfo; UINTN DatabaseInfoSize; DatabaseInfo = NULL; DatabaseInfoSize = 0; // // Get HiiDatabase information. // Status = HiiExportPackageLists(This, NULL, &DatabaseInfoSize, DatabaseInfo); ASSERT(Status == EFI_BUFFER_TOO_SMALL); if(DatabaseInfoSize > gDatabaseInfoSize ) { // // Do 25% overallocation to minimize the number of memory allocations after ReadyToBoot. // Since lots of allocation after ReadyToBoot may change memory map and cause S4 resume issue. // gDatabaseInfoSize = DatabaseInfoSize + (DatabaseInfoSize >> 2); if (gRTDatabaseInfoBuffer != NULL){ FreePool(gRTDatabaseInfoBuffer); DEBUG ((DEBUG_WARN, "[HiiDatabase]: Memory allocation is required after ReadyToBoot, which may change memory map and cause S4 resume issue.\n")); } gRTDatabaseInfoBuffer = AllocateRuntimeZeroPool (gDatabaseInfoSize); if (gRTDatabaseInfoBuffer == NULL){ DEBUG ((DEBUG_ERROR, "[HiiDatabase]: No enough memory resource to store the HiiDatabase info.\n")); return EFI_OUT_OF_RESOURCES; } } else { ZeroMem(gRTDatabaseInfoBuffer,gDatabaseInfoSize); } Status = HiiExportPackageLists(This, NULL, &DatabaseInfoSize, gRTDatabaseInfoBuffer); ASSERT_EFI_ERROR (Status); gBS->InstallConfigurationTable (&gEfiHiiDatabaseProtocolGuid, gRTDatabaseInfoBuffer); return EFI_SUCCESS; }
1
442,705
static void hci_cc_reset(struct hci_dev *hdev, struct sk_buff *skb) { __u8 status = *((__u8 *) skb->data); BT_DBG("%s status 0x%2.2x", hdev->name, status); clear_bit(HCI_RESET, &hdev->flags); if (status) return; /* Reset all non-persistent flags */ hci_dev_clear_volatile_flags(hdev); hci_discovery_set_state(hdev, DISCOVERY_STOPPED); hdev->inq_tx_power = HCI_TX_POWER_INVALID; hdev->adv_tx_power = HCI_TX_POWER_INVALID; memset(hdev->adv_data, 0, sizeof(hdev->adv_data)); hdev->adv_data_len = 0; memset(hdev->scan_rsp_data, 0, sizeof(hdev->scan_rsp_data)); hdev->scan_rsp_data_len = 0; hdev->le_scan_type = LE_SCAN_PASSIVE; hdev->ssp_debug_mode = 0; hci_bdaddr_list_clear(&hdev->le_white_list); hci_bdaddr_list_clear(&hdev->le_resolv_list); }
0
30,052
void EVP_EncodeFinal ( EVP_ENCODE_CTX * ctx , unsigned char * out , int * outl ) { unsigned int ret = 0 ; if ( ctx -> num != 0 ) { ret = EVP_EncodeBlock ( out , ctx -> enc_data , ctx -> num ) ; out [ ret ++ ] = '\n' ; out [ ret ] = '\0' ; ctx -> num = 0 ; } * outl = ret ; }
0
143,086
void fx_TypedArray_prototype_reduceRight(txMachine* the) { mxTypedArrayDeclarations; txInteger delta = dispatch->value.typedArray.dispatch->size; txSlot* function = fxArgToCallback(the, 0); txInteger index = length - 1; if (mxArgc > 1) *mxResult = *mxArgv(1); else if (index >= 0) { (*dispatch->value.typedArray.dispatch->getter)(the, buffer->value.reference->next, view->value.dataView.offset + (index * delta), mxResult, EndianNative); index--; } else mxTypeError("no initial value"); while (index >= 0) { fxReduceTypedArrayItem(the, function, dispatch, view, buffer->value.reference->next, index); index--; } }
0
465,611
static void sctp_sendmsg_update_sinfo(struct sctp_association *asoc, struct sctp_sndrcvinfo *sinfo, struct sctp_cmsgs *cmsgs) { if (!cmsgs->srinfo && !cmsgs->sinfo) { sinfo->sinfo_stream = asoc->default_stream; sinfo->sinfo_ppid = asoc->default_ppid; sinfo->sinfo_context = asoc->default_context; sinfo->sinfo_assoc_id = sctp_assoc2id(asoc); if (!cmsgs->prinfo) sinfo->sinfo_flags = asoc->default_flags; } if (!cmsgs->srinfo && !cmsgs->prinfo) sinfo->sinfo_timetolive = asoc->default_timetolive; if (cmsgs->authinfo) { /* Reuse sinfo_tsn to indicate that authinfo was set and * sinfo_ssn to save the keyid on tx path. */ sinfo->sinfo_tsn = 1; sinfo->sinfo_ssn = cmsgs->authinfo->auth_keynumber; } }
0
25,666
void notef ( struct GlobalConfig * config , const char * fmt , ... ) { va_list ap ; va_start ( ap , fmt ) ; if ( config -> tracetype ) voutf ( config , NOTE_PREFIX , fmt , ap ) ; va_end ( ap ) ; }
0
223,503
void FileSelectionCanceled() { proxy_ = nullptr; if (!render_frame_host_) return; std::move(callback_).Run(nullptr); }
0
392,738
xmlGzfileOpen_real (const char *filename) { const char *path = NULL; gzFile fd; if (!strcmp(filename, "-")) { int duped_fd = dup(fileno(stdin)); fd = gzdopen(duped_fd, "rb"); if (fd == Z_NULL && duped_fd >= 0) { close(duped_fd); /* gzdOpen() does not close on failure */ } return((void *) fd); } if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file://localhost/", 17)) #if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) path = &filename[17]; #else path = &filename[16]; #endif else if (!xmlStrncasecmp(BAD_CAST filename, BAD_CAST "file:///", 8)) { #if defined (_WIN32) || defined (__DJGPP__) && !defined(__CYGWIN__) path = &filename[8]; #else path = &filename[7]; #endif } else path = filename; if (path == NULL) return(NULL); if (!xmlCheckFilename(path)) return(NULL); #if defined(_WIN32) || defined (__DJGPP__) && !defined (__CYGWIN__) fd = xmlWrapGzOpen(path, "rb"); #else fd = gzopen(path, "rb"); #endif return((void *) fd); }
0
363,738
compat_copy_entry_from_user(struct compat_ip6t_entry *e, void **dstptr, unsigned int *size, const char *name, struct xt_table_info *newinfo, unsigned char *base) { struct xt_entry_target *t; struct xt_target *target; struct ip6t_entry *de; unsigned int origsize; int ret, h; struct xt_entry_match *ematch; ret = 0; origsize = *size; de = (struct ip6t_entry *)*dstptr; memcpy(de, e, sizeof(struct ip6t_entry)); memcpy(&de->counters, &e->counters, sizeof(e->counters)); *dstptr += sizeof(struct ip6t_entry); *size += sizeof(struct ip6t_entry) - sizeof(struct compat_ip6t_entry); xt_ematch_foreach(ematch, e) { ret = xt_compat_match_from_user(ematch, dstptr, size); if (ret != 0) return ret; } de->target_offset = e->target_offset - (origsize - *size); t = compat_ip6t_get_target(e); target = t->u.kernel.target; xt_compat_target_from_user(t, dstptr, size); de->next_offset = e->next_offset - (origsize - *size); for (h = 0; h < NF_INET_NUMHOOKS; h++) { if ((unsigned char *)de - base < newinfo->hook_entry[h]) newinfo->hook_entry[h] -= origsize - *size; if ((unsigned char *)de - base < newinfo->underflow[h]) newinfo->underflow[h] -= origsize - *size; } return ret; }
0
476,798
static void ax_encaps(struct net_device *dev, unsigned char *icp, int len) { struct mkiss *ax = netdev_priv(dev); unsigned char *p; int actual, count; if (ax->mtu != ax->dev->mtu + 73) /* Someone has been ifconfigging */ ax_changedmtu(ax); if (len > ax->mtu) { /* Sigh, shouldn't occur BUT ... */ printk(KERN_ERR "mkiss: %s: truncating oversized transmit packet!\n", ax->dev->name); dev->stats.tx_dropped++; netif_start_queue(dev); return; } p = icp; spin_lock_bh(&ax->buflock); if ((*p & 0x0f) != 0) { /* Configuration Command (kissparms(1). * Protocol spec says: never append CRC. * This fixes a very old bug in the linux * kiss driver. -- dl9sau */ switch (*p & 0xff) { case 0x85: /* command from userspace especially for us, * not for delivery to the tnc */ if (len > 1) { int cmd = (p[1] & 0xff); switch(cmd) { case 3: ax->crcmode = CRC_MODE_SMACK; break; case 2: ax->crcmode = CRC_MODE_FLEX; break; case 1: ax->crcmode = CRC_MODE_NONE; break; case 0: default: ax->crcmode = CRC_MODE_SMACK_TEST; cmd = 0; } ax->crcauto = (cmd ? 0 : 1); printk(KERN_INFO "mkiss: %s: crc mode set to %d\n", ax->dev->name, cmd); } spin_unlock_bh(&ax->buflock); netif_start_queue(dev); return; default: count = kiss_esc(p, ax->xbuff, len); } } else { unsigned short crc; switch (ax->crcmode) { case CRC_MODE_SMACK_TEST: ax->crcmode = CRC_MODE_FLEX_TEST; printk(KERN_INFO "mkiss: %s: Trying crc-smack\n", ax->dev->name); fallthrough; case CRC_MODE_SMACK: *p |= 0x80; crc = swab16(crc16(0, p, len)); count = kiss_esc_crc(p, ax->xbuff, crc, len+2); break; case CRC_MODE_FLEX_TEST: ax->crcmode = CRC_MODE_NONE; printk(KERN_INFO "mkiss: %s: Trying crc-flexnet\n", ax->dev->name); fallthrough; case CRC_MODE_FLEX: *p |= 0x20; crc = calc_crc_flex(p, len); count = kiss_esc_crc(p, ax->xbuff, crc, len+2); break; default: count = kiss_esc(p, ax->xbuff, len); } } spin_unlock_bh(&ax->buflock); set_bit(TTY_DO_WRITE_WAKEUP, &ax->tty->flags); actual = ax->tty->ops->write(ax->tty, ax->xbuff, count); dev->stats.tx_packets++; dev->stats.tx_bytes += actual; netif_trans_update(ax->dev); ax->xleft = count - actual; ax->xhead = ax->xbuff + actual; }
0
281,983
EncodedJSValue JSC_HOST_CALL JSDataViewConstructor::constructJSDataView(ExecState* exec) { if (exec->argument(0).isNull() || !exec->argument(0).isObject()) return throwVMTypeError(exec); RefPtr<DataView> view = constructArrayBufferViewWithArrayBufferArgument<DataView, char>(exec); if (!view.get()) { setDOMException(exec, INDEX_SIZE_ERR); return JSValue::encode(jsUndefined()); } JSDataViewConstructor* jsConstructor = jsCast<JSDataViewConstructor*>(exec->callee()); return JSValue::encode(asObject(toJS(exec, jsConstructor->globalObject(), view.get()))); }
0
228,204
void TouchEventConverterEvdev::OnFileCanReadWithoutBlocking(int fd) { TRACE_EVENT1("evdev", "TouchEventConverterEvdev::OnFileCanReadWithoutBlocking", "fd", fd); input_event inputs[kNumTouchEvdevSlots * 6 + 1]; ssize_t read_size = read(fd, inputs, sizeof(inputs)); if (read_size < 0) { if (errno == EINTR || errno == EAGAIN) return; if (errno != ENODEV) PLOG(ERROR) << "error reading device " << path_.value(); Stop(); return; } if (ignore_events_) return; for (unsigned i = 0; i < read_size / sizeof(*inputs); i++) { if (!has_mt_) { EmulateMultitouchEvent(inputs[i]); } ProcessMultitouchEvent(inputs[i]); } }
0
255,947
int ssl3_connect(SSL *s) { BUF_MEM *buf=NULL; unsigned long Time=(unsigned long)time(NULL); void (*cb)(const SSL *ssl,int type,int val)=NULL; int ret= -1; int new_state,state,skip=0; RAND_add(&Time,sizeof(Time),0); ERR_clear_error(); clear_sys_error(); if (s->info_callback != NULL) cb=s->info_callback; else if (s->ctx->info_callback != NULL) cb=s->ctx->info_callback; s->in_handshake++; if (!SSL_in_init(s) || SSL_in_before(s)) SSL_clear(s); #ifndef OPENSSL_NO_HEARTBEATS /* If we're awaiting a HeartbeatResponse, pretend we * already got and don't await it anymore, because * Heartbeats don't make sense during handshakes anyway. */ if (s->tlsext_hb_pending) { s->tlsext_hb_pending = 0; s->tlsext_hb_seq++; } #endif for (;;) { state=s->state; switch(s->state) { case SSL_ST_RENEGOTIATE: s->renegotiate=1; s->state=SSL_ST_CONNECT; s->ctx->stats.sess_connect_renegotiate++; /* break */ case SSL_ST_BEFORE: case SSL_ST_CONNECT: case SSL_ST_BEFORE|SSL_ST_CONNECT: case SSL_ST_OK|SSL_ST_CONNECT: s->server=0; if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_START,1); if ((s->version & 0xff00 ) != 0x0300) { SSLerr(SSL_F_SSL3_CONNECT, ERR_R_INTERNAL_ERROR); ret = -1; goto end; } /* s->version=SSL3_VERSION; */ s->type=SSL_ST_CONNECT; if (s->init_buf == NULL) { if ((buf=BUF_MEM_new()) == NULL) { ret= -1; goto end; } if (!BUF_MEM_grow(buf,SSL3_RT_MAX_PLAIN_LENGTH)) { ret= -1; goto end; } s->init_buf=buf; buf=NULL; } if (!ssl3_setup_buffers(s)) { ret= -1; goto end; } /* setup buffing BIO */ if (!ssl_init_wbio_buffer(s,0)) { ret= -1; goto end; } /* don't push the buffering BIO quite yet */ ssl3_init_finished_mac(s); s->state=SSL3_ST_CW_CLNT_HELLO_A; s->ctx->stats.sess_connect++; s->init_num=0; break; case SSL3_ST_CW_CLNT_HELLO_A: case SSL3_ST_CW_CLNT_HELLO_B: s->shutdown=0; ret=ssl3_client_hello(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_SRVR_HELLO_A; s->init_num=0; /* turn on buffering for the next lot of output */ if (s->bbio != s->wbio) s->wbio=BIO_push(s->bbio,s->wbio); break; case SSL3_ST_CR_SRVR_HELLO_A: case SSL3_ST_CR_SRVR_HELLO_B: ret=ssl3_get_server_hello(s); if (ret <= 0) goto end; if (s->hit) { s->state=SSL3_ST_CR_FINISHED_A; #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_ticket_expected) { /* receive renewed session ticket */ s->state=SSL3_ST_CR_SESSION_TICKET_A; } #endif } else s->state=SSL3_ST_CR_CERT_A; s->init_num=0; break; case SSL3_ST_CR_CERT_A: case SSL3_ST_CR_CERT_B: #ifndef OPENSSL_NO_TLSEXT ret=ssl3_check_finished(s); if (ret <= 0) goto end; if (ret == 2) { s->hit = 1; if (s->tlsext_ticket_expected) s->state=SSL3_ST_CR_SESSION_TICKET_A; else s->state=SSL3_ST_CR_FINISHED_A; s->init_num=0; break; } #endif /* Check if it is anon DH/ECDH */ /* or PSK */ if (!(s->s3->tmp.new_cipher->algorithm_auth & SSL_aNULL) && !(s->s3->tmp.new_cipher->algorithm_mkey & SSL_kPSK)) { ret=ssl3_get_server_certificate(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_TLSEXT if (s->tlsext_status_expected) s->state=SSL3_ST_CR_CERT_STATUS_A; else s->state=SSL3_ST_CR_KEY_EXCH_A; } else { skip = 1; s->state=SSL3_ST_CR_KEY_EXCH_A; } #else } else skip=1; s->state=SSL3_ST_CR_KEY_EXCH_A; #endif s->init_num=0; break; case SSL3_ST_CR_KEY_EXCH_A: case SSL3_ST_CR_KEY_EXCH_B: ret=ssl3_get_key_exchange(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_CERT_REQ_A; s->init_num=0; /* at this point we check that we have the * required stuff from the server */ if (!ssl3_check_cert_and_algorithm(s)) { ret= -1; goto end; } break; case SSL3_ST_CR_CERT_REQ_A: case SSL3_ST_CR_CERT_REQ_B: ret=ssl3_get_certificate_request(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_SRVR_DONE_A; s->init_num=0; break; case SSL3_ST_CR_SRVR_DONE_A: case SSL3_ST_CR_SRVR_DONE_B: ret=ssl3_get_server_done(s); if (ret <= 0) goto end; #ifndef OPENSSL_NO_SRP if (s->s3->tmp.new_cipher->algorithm_mkey & SSL_kSRP) { if ((ret = SRP_Calc_A_param(s))<=0) { SSLerr(SSL_F_SSL3_CONNECT,SSL_R_SRP_A_CALC); ssl3_send_alert(s,SSL3_AL_FATAL,SSL_AD_INTERNAL_ERROR); goto end; } } #endif if (s->s3->tmp.cert_req) s->state=SSL3_ST_CW_CERT_A; else s->state=SSL3_ST_CW_KEY_EXCH_A; s->init_num=0; break; case SSL3_ST_CW_CERT_A: case SSL3_ST_CW_CERT_B: case SSL3_ST_CW_CERT_C: case SSL3_ST_CW_CERT_D: ret=ssl3_send_client_certificate(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_KEY_EXCH_A; s->init_num=0; break; case SSL3_ST_CW_KEY_EXCH_A: case SSL3_ST_CW_KEY_EXCH_B: ret=ssl3_send_client_key_exchange(s); if (ret <= 0) goto end; /* EAY EAY EAY need to check for DH fix cert * sent back */ /* For TLS, cert_req is set to 2, so a cert chain * of nothing is sent, but no verify packet is sent */ /* XXX: For now, we do not support client * authentication in ECDH cipher suites with * ECDH (rather than ECDSA) certificates. * We need to skip the certificate verify * message when client's ECDH public key is sent * inside the client certificate. */ if (s->s3->tmp.cert_req == 1) { s->state=SSL3_ST_CW_CERT_VRFY_A; } else { s->state=SSL3_ST_CW_CHANGE_A; s->s3->change_cipher_spec=0; } if (s->s3->flags & TLS1_FLAGS_SKIP_CERT_VERIFY) { s->state=SSL3_ST_CW_CHANGE_A; s->s3->change_cipher_spec=0; } s->init_num=0; break; case SSL3_ST_CW_CERT_VRFY_A: case SSL3_ST_CW_CERT_VRFY_B: ret=ssl3_send_client_verify(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_CHANGE_A; s->init_num=0; s->s3->change_cipher_spec=0; break; case SSL3_ST_CW_CHANGE_A: case SSL3_ST_CW_CHANGE_B: ret=ssl3_send_change_cipher_spec(s, SSL3_ST_CW_CHANGE_A,SSL3_ST_CW_CHANGE_B); if (ret <= 0) goto end; #if defined(OPENSSL_NO_TLSEXT) || defined(OPENSSL_NO_NEXTPROTONEG) s->state=SSL3_ST_CW_FINISHED_A; #else if (s->s3->next_proto_neg_seen) s->state=SSL3_ST_CW_NEXT_PROTO_A; else s->state=SSL3_ST_CW_FINISHED_A; #endif s->init_num=0; s->session->cipher=s->s3->tmp.new_cipher; #ifdef OPENSSL_NO_COMP s->session->compress_meth=0; #else if (s->s3->tmp.new_compression == NULL) s->session->compress_meth=0; else s->session->compress_meth= s->s3->tmp.new_compression->id; #endif if (!s->method->ssl3_enc->setup_key_block(s)) { ret= -1; goto end; } if (!s->method->ssl3_enc->change_cipher_state(s, SSL3_CHANGE_CIPHER_CLIENT_WRITE)) { ret= -1; goto end; } break; #if !defined(OPENSSL_NO_TLSEXT) && !defined(OPENSSL_NO_NEXTPROTONEG) case SSL3_ST_CW_NEXT_PROTO_A: case SSL3_ST_CW_NEXT_PROTO_B: ret=ssl3_send_next_proto(s); if (ret <= 0) goto end; s->state=SSL3_ST_CW_FINISHED_A; break; #endif case SSL3_ST_CW_FINISHED_A: case SSL3_ST_CW_FINISHED_B: ret=ssl3_send_finished(s, SSL3_ST_CW_FINISHED_A,SSL3_ST_CW_FINISHED_B, s->method->ssl3_enc->client_finished_label, s->method->ssl3_enc->client_finished_label_len); if (ret <= 0) goto end; s->state=SSL3_ST_CW_FLUSH; /* clear flags */ s->s3->flags&= ~SSL3_FLAGS_POP_BUFFER; if (s->hit) { s->s3->tmp.next_state=SSL_ST_OK; if (s->s3->flags & SSL3_FLAGS_DELAY_CLIENT_FINISHED) { s->state=SSL_ST_OK; s->s3->flags|=SSL3_FLAGS_POP_BUFFER; s->s3->delay_buf_pop_ret=0; } } else { #ifndef OPENSSL_NO_TLSEXT /* Allow NewSessionTicket if ticket expected */ if (s->tlsext_ticket_expected) s->s3->tmp.next_state=SSL3_ST_CR_SESSION_TICKET_A; else #endif s->s3->tmp.next_state=SSL3_ST_CR_FINISHED_A; } s->init_num=0; break; #ifndef OPENSSL_NO_TLSEXT case SSL3_ST_CR_SESSION_TICKET_A: case SSL3_ST_CR_SESSION_TICKET_B: ret=ssl3_get_new_session_ticket(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_FINISHED_A; s->init_num=0; break; case SSL3_ST_CR_CERT_STATUS_A: case SSL3_ST_CR_CERT_STATUS_B: ret=ssl3_get_cert_status(s); if (ret <= 0) goto end; s->state=SSL3_ST_CR_KEY_EXCH_A; s->init_num=0; break; #endif case SSL3_ST_CR_FINISHED_A: case SSL3_ST_CR_FINISHED_B: ret=ssl3_get_finished(s,SSL3_ST_CR_FINISHED_A, SSL3_ST_CR_FINISHED_B); if (ret <= 0) goto end; if (s->hit) s->state=SSL3_ST_CW_CHANGE_A; else s->state=SSL_ST_OK; s->init_num=0; break; case SSL3_ST_CW_FLUSH: s->rwstate=SSL_WRITING; if (BIO_flush(s->wbio) <= 0) { ret= -1; goto end; } s->rwstate=SSL_NOTHING; s->state=s->s3->tmp.next_state; break; case SSL_ST_OK: /* clean a few things up */ ssl3_cleanup_key_block(s); if (s->init_buf != NULL) { BUF_MEM_free(s->init_buf); s->init_buf=NULL; } /* If we are not 'joining' the last two packets, * remove the buffering now */ if (!(s->s3->flags & SSL3_FLAGS_POP_BUFFER)) ssl_free_wbio_buffer(s); /* else do it later in ssl3_write */ s->init_num=0; s->renegotiate=0; s->new_session=0; ssl_update_cache(s,SSL_SESS_CACHE_CLIENT); if (s->hit) s->ctx->stats.sess_hit++; ret=1; /* s->server=0; */ s->handshake_func=ssl3_connect; s->ctx->stats.sess_connect_good++; if (cb != NULL) cb(s,SSL_CB_HANDSHAKE_DONE,1); goto end; /* break; */ default: SSLerr(SSL_F_SSL3_CONNECT,SSL_R_UNKNOWN_STATE); ret= -1; goto end; /* break; */ } /* did we do anything */ if (!s->s3->tmp.reuse_message && !skip) { if (s->debug) { if ((ret=BIO_flush(s->wbio)) <= 0) goto end; } if ((cb != NULL) && (s->state != state)) { new_state=s->state; s->state=state; cb(s,SSL_CB_CONNECT_LOOP,1); s->state=new_state; } } skip=0; }
1
156,833
void free_cache_bitmap_v2_order(rdpContext* context, CACHE_BITMAP_V2_ORDER* order) { if (order) free(order->bitmapDataStream); free(order); }
0
123,611
static void init_threaded_search(void) { init_recursive_mutex(&read_mutex); pthread_mutex_init(&cache_mutex, NULL); pthread_mutex_init(&progress_mutex, NULL); pthread_cond_init(&progress_cond, NULL); old_try_to_free_routine = set_try_to_free_routine(try_to_free_from_threads); }
0
293,305
void CWebServer::Cmd_AddSceneCode(WebEmSession & session, const request& req, Json::Value &root) { if (session.rights != 2) { session.reply_status = reply::forbidden; return; //Only admin user allowed } std::string sceneidx = request::findValue(&req, "sceneidx"); std::string idx = request::findValue(&req, "idx"); std::string cmnd = request::findValue(&req, "cmnd"); if ( (sceneidx.empty()) || (idx.empty()) || (cmnd.empty()) ) return; root["status"] = "OK"; root["title"] = "AddSceneCode"; //First check if we do not already have this device as activation code std::vector<std::vector<std::string> > result; result = m_sql.safe_query("SELECT Activators, SceneType FROM Scenes WHERE (ID==%q)", sceneidx.c_str()); if (result.empty()) return; std::string Activators = result[0][0]; unsigned char scenetype = atoi(result[0][1].c_str()); if (!Activators.empty()) { //Get Activator device names std::vector<std::string> arrayActivators; StringSplit(Activators, ";", arrayActivators); for (const auto & ittAct : arrayActivators) { std::string sCodeCmd = ittAct; std::vector<std::string> arrayCode; StringSplit(sCodeCmd, ":", arrayCode); std::string sID = arrayCode[0]; std::string sCode = ""; if (arrayCode.size() == 2) { sCode = arrayCode[1]; } if (sID == idx) { if (scenetype == 1) return; //Group does not work with separate codes, so already there if (sCode == cmnd) return; //same code, already there! } } } if (!Activators.empty()) Activators += ";"; Activators += idx; if (scenetype == 0) { Activators += ":" + cmnd; } m_sql.safe_query("UPDATE Scenes SET Activators='%q' WHERE (ID==%q)", Activators.c_str(), sceneidx.c_str()); }
0
158,948
lyp_check_mandatory_choice(struct lys_node *node) { const struct lys_node *mand, *dflt = ((struct lys_node_choice *)node)->dflt; if ((mand = lyp_check_mandatory_(dflt))) { if (mand != dflt) { LOGVAL(node->module->ctx, LYE_INSTMT, LY_VLOG_NONE, NULL, "mandatory"); LOGVAL(node->module->ctx, LYE_SPEC, LY_VLOG_NONE, NULL, "Mandatory node \"%s\" is directly under the default case \"%s\" of the \"%s\" choice.", mand->name, dflt->name, node->name); return -1; } return EXIT_FAILURE; } return EXIT_SUCCESS; }
0
460,552
int slap_sasl_regexp_rewrite_config( const char *fname, int lineno, const char *match, const char *replace, const char *context ) { int rc; char *argvRule[] = { "rewriteRule", NULL, NULL, ":@", NULL }; /* init at first call */ if ( sasl_rwinfo == NULL ) { char *argvEngine[] = { "rewriteEngine", "on", NULL }; char *argvContext[] = { "rewriteContext", NULL, NULL }; /* initialize rewrite engine */ sasl_rwinfo = rewrite_info_init( REWRITE_MODE_USE_DEFAULT ); /* switch on rewrite engine */ rc = rewrite_parse( sasl_rwinfo, fname, lineno, 2, argvEngine ); if (rc != LDAP_SUCCESS) { return rc; } /* create generic authid context */ argvContext[1] = AUTHID_CONTEXT; rc = rewrite_parse( sasl_rwinfo, fname, lineno, 2, argvContext ); if (rc != LDAP_SUCCESS) { return rc; } } argvRule[1] = (char *)match; argvRule[2] = (char *)replace; rc = rewrite_parse( sasl_rwinfo, fname, lineno, 4, argvRule ); return rc; }
0
264,174
static void ftrace_shutdown(struct ftrace_ops *ops, int command) { bool hash_disable = true; if (unlikely(ftrace_disabled)) return; ftrace_start_up--; /* * Just warn in case of unbalance, no need to kill ftrace, it's not * critical but the ftrace_call callers may be never nopped again after * further ftrace uses. */ WARN_ON_ONCE(ftrace_start_up < 0); if (ops->flags & FTRACE_OPS_FL_GLOBAL) { ops = &global_ops; global_start_up--; WARN_ON_ONCE(global_start_up < 0); /* Don't update hash if global still has users */ if (global_start_up) { WARN_ON_ONCE(!ftrace_start_up); hash_disable = false; } } if (hash_disable) ftrace_hash_rec_disable(ops, 1); if (ops != &global_ops || !global_start_up) ops->flags &= ~FTRACE_OPS_FL_ENABLED; command |= FTRACE_UPDATE_CALLS; if (saved_ftrace_func != ftrace_trace_function) { saved_ftrace_func = ftrace_trace_function; command |= FTRACE_UPDATE_TRACE_FUNC; } if (!command || !ftrace_enabled) return; ftrace_run_update_code(command); }
0
122,896
inline void LstmCell( const LstmCellParams& params, const RuntimeShape& unextended_input_shape, const float* input_data, const RuntimeShape& unextended_prev_activ_shape, const float* prev_activ_data, const RuntimeShape& weights_shape, const float* weights_data, const RuntimeShape& unextended_bias_shape, const float* bias_data, const RuntimeShape& unextended_prev_state_shape, const float* prev_state_data, const RuntimeShape& unextended_output_state_shape, float* output_state_data, const RuntimeShape& unextended_output_activ_shape, float* output_activ_data, const RuntimeShape& unextended_concat_temp_shape, float* concat_temp_data, const RuntimeShape& unextended_activ_temp_shape, float* activ_temp_data, CpuBackendContext* cpu_backend_context) { ruy::profiler::ScopeLabel label("LstmCell"); TFLITE_DCHECK_LE(unextended_input_shape.DimensionsCount(), 4); TFLITE_DCHECK_LE(unextended_prev_activ_shape.DimensionsCount(), 4); TFLITE_DCHECK_LE(unextended_bias_shape.DimensionsCount(), 4); TFLITE_DCHECK_LE(unextended_prev_state_shape.DimensionsCount(), 4); TFLITE_DCHECK_LE(unextended_output_state_shape.DimensionsCount(), 4); TFLITE_DCHECK_LE(unextended_output_activ_shape.DimensionsCount(), 4); TFLITE_DCHECK_LE(unextended_concat_temp_shape.DimensionsCount(), 4); TFLITE_DCHECK_LE(unextended_activ_temp_shape.DimensionsCount(), 4); const RuntimeShape input_shape = RuntimeShape::ExtendedShape(4, unextended_input_shape); const RuntimeShape prev_activ_shape = RuntimeShape::ExtendedShape(4, unextended_prev_activ_shape); const RuntimeShape bias_shape = RuntimeShape::ExtendedShape(4, unextended_bias_shape); const RuntimeShape prev_state_shape = RuntimeShape::ExtendedShape(4, unextended_prev_state_shape); const RuntimeShape output_state_shape = RuntimeShape::ExtendedShape(4, unextended_output_state_shape); const RuntimeShape output_activ_shape = RuntimeShape::ExtendedShape(4, unextended_output_activ_shape); const RuntimeShape concat_temp_shape = RuntimeShape::ExtendedShape(4, unextended_concat_temp_shape); const RuntimeShape activ_temp_shape = RuntimeShape::ExtendedShape(4, unextended_activ_temp_shape); TFLITE_DCHECK_GE(weights_shape.DimensionsCount(), 2); const int weights_dim_count = weights_shape.DimensionsCount(); MatchingDim( // batches input_shape, 0, prev_activ_shape, 0, prev_state_shape, 0, output_state_shape, 0, output_activ_shape, 0); MatchingDim( // height input_shape, 1, prev_activ_shape, 1, prev_state_shape, 1, output_state_shape, 1, output_activ_shape, 1); MatchingDim( // width input_shape, 2, prev_activ_shape, 2, prev_state_shape, 2, output_state_shape, 2, output_activ_shape, 2); const int input_depth = input_shape.Dims(3); const int prev_activ_depth = prev_activ_shape.Dims(3); const int total_input_depth = prev_activ_depth + input_depth; TFLITE_DCHECK_EQ(weights_shape.Dims(weights_dim_count - 1), total_input_depth); TFLITE_DCHECK_EQ(FlatSizeSkipDim(bias_shape, 3), 1); const int intern_activ_depth = MatchingDim(weights_shape, weights_dim_count - 2, bias_shape, 3); TFLITE_DCHECK_EQ(weights_shape.FlatSize(), intern_activ_depth * total_input_depth); TFLITE_DCHECK_EQ(intern_activ_depth % 4, 0); const int output_depth = MatchingDim(prev_state_shape, 3, prev_activ_shape, 3, output_state_shape, 3, output_activ_shape, 3); TFLITE_DCHECK_EQ(output_depth, intern_activ_depth / 4); // Concatenate prev_activ and input data together std::vector<float const*> concat_input_arrays_data; std::vector<RuntimeShape const*> concat_input_arrays_shapes; concat_input_arrays_data.push_back(input_data); concat_input_arrays_data.push_back(prev_activ_data); concat_input_arrays_shapes.push_back(&input_shape); concat_input_arrays_shapes.push_back(&prev_activ_shape); tflite::ConcatenationParams concat_params; concat_params.axis = 3; concat_params.inputs_count = concat_input_arrays_data.size(); Concatenation(concat_params, &(concat_input_arrays_shapes[0]), &(concat_input_arrays_data[0]), concat_temp_shape, concat_temp_data); // Fully connected tflite::FullyConnectedParams fc_params; fc_params.float_activation_min = std::numeric_limits<float>::lowest(); fc_params.float_activation_max = std::numeric_limits<float>::max(); fc_params.lhs_cacheable = false; fc_params.rhs_cacheable = false; FullyConnected(fc_params, concat_temp_shape, concat_temp_data, weights_shape, weights_data, bias_shape, bias_data, activ_temp_shape, activ_temp_data, cpu_backend_context); // Map raw arrays to Eigen arrays so we can use Eigen's optimized array // operations. ArrayMap<float> activ_temp_map = MapAsArrayWithLastDimAsRows(activ_temp_data, activ_temp_shape); auto input_gate_sm = activ_temp_map.block(0 * output_depth, 0, output_depth, activ_temp_map.cols()); auto new_input_sm = activ_temp_map.block(1 * output_depth, 0, output_depth, activ_temp_map.cols()); auto forget_gate_sm = activ_temp_map.block(2 * output_depth, 0, output_depth, activ_temp_map.cols()); auto output_gate_sm = activ_temp_map.block(3 * output_depth, 0, output_depth, activ_temp_map.cols()); ArrayMap<const float> prev_state_map = MapAsArrayWithLastDimAsRows(prev_state_data, prev_state_shape); ArrayMap<float> output_state_map = MapAsArrayWithLastDimAsRows(output_state_data, output_state_shape); ArrayMap<float> output_activ_map = MapAsArrayWithLastDimAsRows(output_activ_data, output_activ_shape); // Combined memory state and final output calculation ruy::profiler::ScopeLabel label2("MemoryStateAndFinalOutput"); output_state_map = input_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op<float>()) * new_input_sm.tanh() + forget_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op<float>()) * prev_state_map; output_activ_map = output_gate_sm.unaryExpr(Eigen::internal::scalar_logistic_op<float>()) * output_state_map.tanh(); }
0
448,027
int sftp_reply_names_add(sftp_client_message msg, const char *file, const char *longname, sftp_attributes attr) { ssh_string name; name = ssh_string_from_char(file); if (name == NULL) { return -1; } if (msg->attrbuf == NULL) { msg->attrbuf = ssh_buffer_new(); if (msg->attrbuf == NULL) { SSH_STRING_FREE(name); return -1; } } if (ssh_buffer_add_ssh_string(msg->attrbuf, name) < 0) { SSH_STRING_FREE(name); return -1; } SSH_STRING_FREE(name); name = ssh_string_from_char(longname); if (name == NULL) { return -1; } if (ssh_buffer_add_ssh_string(msg->attrbuf,name) < 0 || buffer_add_attributes(msg->attrbuf,attr) < 0) { SSH_STRING_FREE(name); return -1; } SSH_STRING_FREE(name); msg->attr_num++; return 0; }
0
208,191
void setJSTestObjUnsignedShortSequenceAttr(ExecState* exec, JSObject* thisObject, JSValue value) { JSTestObj* castedThis = jsCast<JSTestObj*>(thisObject); TestObj* impl = static_cast<TestObj*>(castedThis->impl()); impl->setUnsignedShortSequenceAttr(toNativeArray<unsigned short>(exec, value)); }
0
336,267
void msix_unuse_all_vectors(PCIDevice *dev) { if (!(dev->cap_present & QEMU_PCI_CAP_MSIX)) return; msix_free_irq_entries(dev); }
0
4,700
bool HHVM_FUNCTION(apc_clear_cache, const String& /*cache_type*/ /* = "" */) { if (!apcExtension::Enable) return false; return apc_store().clear(); }
1
79,310
SQLiteDBInstanceRef SQLiteDBManager::getUnique() { auto instance = std::make_shared<SQLiteDBInstance>(); attachVirtualTables(instance); return instance; }
0
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
28